@myrialabs/clopen 0.4.45 → 0.4.46
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/backend/artifacts/project/sources.ts +2 -2
- package/backend/engine/adapters/claude/models.test.ts +49 -0
- package/backend/engine/adapters/claude/models.ts +81 -562
- package/backend/engine/adapters/claude/stream.ts +5 -4
- package/backend/engine/adapters/cline/credential.ts +42 -18
- package/backend/engine/adapters/cline/message-converter.ts +31 -1
- package/backend/engine/adapters/cline/models.test.ts +77 -0
- package/backend/engine/adapters/cline/models.ts +89 -3
- package/backend/engine/adapters/cline/presets.ts +5 -0
- package/backend/engine/adapters/cline/stream.ts +9 -2
- package/backend/engine/adapters/codex/message-converter.ts +1 -1
- package/backend/engine/adapters/codex/models.ts +54 -31
- package/backend/engine/adapters/codex/patch-rollout.test.ts +36 -1
- package/backend/engine/adapters/codex/patch-rollout.ts +60 -29
- package/backend/engine/adapters/codex/session-fork.ts +5 -0
- package/backend/engine/adapters/codex/stream.ts +8 -7
- package/backend/engine/adapters/copilot/models.test.ts +40 -0
- package/backend/engine/adapters/copilot/models.ts +51 -24
- package/backend/engine/adapters/copilot/permissions.test.ts +47 -0
- package/backend/engine/adapters/copilot/permissions.ts +72 -0
- package/backend/engine/adapters/copilot/stream.ts +77 -67
- package/backend/engine/adapters/cursor/stream.ts +8 -4
- package/backend/engine/adapters/pi/credential.test.ts +83 -0
- package/backend/engine/adapters/pi/credential.ts +68 -12
- package/backend/engine/adapters/pi/environment.ts +9 -5
- package/backend/engine/adapters/pi/mcp.test.ts +194 -0
- package/backend/engine/adapters/pi/mcp.ts +88 -0
- package/backend/engine/adapters/pi/message-converter.ts +6 -4
- package/backend/engine/adapters/pi/presets.ts +10 -5
- package/backend/engine/adapters/pi/stream.ts +42 -38
- package/backend/engine/adapters/qwen/environment.ts +39 -2
- package/backend/engine/adapters/qwen/message-converter.test.ts +64 -0
- package/backend/engine/adapters/qwen/message-converter.ts +40 -23
- package/backend/engine/adapters/qwen/models.test.ts +25 -0
- package/backend/engine/adapters/qwen/models.ts +42 -5
- package/backend/engine/adapters/qwen/session-store.test.ts +39 -0
- package/backend/engine/adapters/qwen/session-store.ts +66 -0
- package/backend/engine/adapters/qwen/stream.ts +110 -87
- package/backend/engine/docs/adapter-contract.md +7 -4
- package/backend/engine/docs/lessons-learned.md +405 -62
- package/backend/engine/docs/quick-reference.md +2 -2
- package/backend/engine/docs/stack.md +17 -4
- package/backend/engine/docs/websocket-routes.md +5 -5
- package/backend/engine/install-recipes.test.ts +105 -5
- package/backend/engine/install-recipes.ts +102 -42
- package/backend/engine/install-runner.ts +56 -2
- package/backend/engine/stack-project.ts +71 -1
- package/backend/index.ts +5 -0
- package/backend/mcp/README.md +2 -2
- package/backend/mcp/external/config.ts +18 -0
- package/backend/mcp/external/proxy.ts +2 -2
- package/backend/mcp/index.ts +8 -0
- package/backend/mcp/internal/config.ts +42 -3
- package/backend/memory/embedding/install.ts +29 -1
- package/backend/utils/keyed-lock.test.ts +33 -0
- package/backend/utils/keyed-lock.ts +17 -0
- package/backend/utils/port-utils.test.ts +29 -0
- package/backend/utils/port-utils.ts +19 -0
- package/backend/ws/engine/cline/accounts.ts +26 -6
- package/backend/ws/engine/codex/accounts.test.ts +49 -0
- package/backend/ws/engine/codex/accounts.ts +17 -13
- package/backend/ws/engine/pi/accounts.ts +61 -6
- package/dist/assets/{index-D-Ad1N96.js → index-BTcR1byF.js} +1 -1
- package/dist/assets/{index-Am-rJRxA.js → index-CwuKQelV.js} +1 -1
- package/dist/assets/{main--PLCDxSy.css → main-BiDNMWb3.css} +1 -1
- package/dist/assets/{main-DelPm2Xt.js → main-BlhKWz2B.js} +595 -593
- package/dist/index.html +2 -2
- package/package.json +19 -15
- package/backend/engine/adapters/pi/mcp-tools.ts +0 -153
- package/backend/engine/adapters/qwen/session-fork.ts +0 -109
|
@@ -194,38 +194,37 @@ flag is off.
|
|
|
194
194
|
### 10.9 Per-stream account override when the SDK takes the credential at construction
|
|
195
195
|
|
|
196
196
|
Most SDKs accept env vars per-call (Claude) or read them from the
|
|
197
|
-
subprocess environment (OpenCode). The Copilot
|
|
198
|
-
|
|
199
|
-
|
|
197
|
+
subprocess environment (OpenCode). The Copilot client takes a GitHub token
|
|
198
|
+
at construction — but that token only authenticates the runtime process
|
|
199
|
+
(and the model listing). Each session carries its own identity:
|
|
200
|
+
`SessionConfig.gitHubToken` is resolved by the runtime into the session's
|
|
201
|
+
login, plan, endpoints and quota, independently of the client's token.
|
|
200
202
|
|
|
201
203
|
Pattern in `copilot/stream.ts`:
|
|
202
204
|
|
|
203
205
|
```ts
|
|
204
|
-
private currentAccountId: number | null = null;
|
|
205
|
-
|
|
206
206
|
async initialize(accountId?: number): Promise<void> {
|
|
207
|
-
if (this._isInitialized
|
|
208
|
-
|
|
209
|
-
}
|
|
210
|
-
const account = accountId != null
|
|
211
|
-
? engineQueries.getAccount(accountId)
|
|
212
|
-
: engineQueries.getActiveAccountForEngine('copilot');
|
|
207
|
+
if (this._isInitialized) return; // one client per instance, whatever the account
|
|
208
|
+
const account = resolveCopilotAccount(accountId);
|
|
213
209
|
this.client = new CopilotClient({ gitHubToken: account.credential, ... });
|
|
214
|
-
this.currentAccountId = account.id;
|
|
215
210
|
...
|
|
216
211
|
}
|
|
217
212
|
|
|
218
213
|
async *streamQuery(options) {
|
|
219
|
-
|
|
220
|
-
if (this._isInitialized && options.accountId != null
|
|
221
|
-
&& options.accountId !== this.currentAccountId) {
|
|
222
|
-
await this.dispose();
|
|
223
|
-
}
|
|
214
|
+
const auth = sessionAuth(options.accountId); // { gitHubToken } of THIS stream's account
|
|
224
215
|
if (!this._isInitialized) await this.initialize(options.accountId);
|
|
216
|
+
const baseConfig = { ...auth, ... }; // on create AND resume
|
|
225
217
|
...
|
|
226
218
|
}
|
|
227
219
|
```
|
|
228
220
|
|
|
221
|
+
Until the 1.0.16 bump the adapter instead disposed and rebuilt the client
|
|
222
|
+
whenever a stream named a different account. `dispose()` stops **every** run
|
|
223
|
+
on the instance, so switching accounts in one chat aborted every other
|
|
224
|
+
Copilot chat streaming in the same project. Prefer a per-session credential
|
|
225
|
+
whenever the SDK has one; rebuilding a shared client is a cross-chat side
|
|
226
|
+
effect even when it looks like a local one.
|
|
227
|
+
|
|
229
228
|
The frontend wiring is shared with Claude (single-account-list engines —
|
|
230
229
|
see §6.2): both stores expose the same API, so `EngineModelPicker.svelte`
|
|
231
230
|
uses one derived `accountsForEngine` and one dropdown. To add a fourth
|
|
@@ -248,9 +247,9 @@ resume.
|
|
|
248
247
|
|-----------|----------------------------------------------------------------------------------------------|
|
|
249
248
|
| Claude | Pass `forkSession: true` in the SDK options on every call — native. |
|
|
250
249
|
| OpenCode | Call `client.session.fork({ path: { id: resume } })` on every resume — native. |
|
|
251
|
-
| Copilot | Call `client.rpc.sessions.fork({ sessionId: resume })` on every resume — native (added in `@github/copilot-sdk` 1.0.0-beta.4; still marked `@experimental` in 1.0.
|
|
250
|
+
| Copilot | Call `client.rpc.sessions.fork({ sessionId: resume })` on every resume — native (added in `@github/copilot-sdk` 1.0.0-beta.4; still marked `@experimental` in 1.0.16, so keep the fallback-to-plain-resume path). |
|
|
252
251
|
| Codex | **No native API yet** — fork by copying the rollout JSONL FILE on every resume. |
|
|
253
|
-
| Qwen Code |
|
|
252
|
+
| Qwen Code | Pass `resume` + `forkSession: true` on every resume — native since `@qwen-code/sdk` 0.1.17 (CLI `--fork-session`); plain resume when the source chat is gone (see §10.25). |
|
|
254
253
|
| Pi | `SessionManager.forkFrom()` on the on-disk JSONL tree (in Clopen's isolated sessions dir) — native, on every resume. |
|
|
255
254
|
| Cline | **No session store at all** (stateless `Agent`) — the adapter reconstructs branch history in memory and forks by copy. See "In-process, session-less SDKs" below. |
|
|
256
255
|
|
|
@@ -261,10 +260,9 @@ resume.
|
|
|
261
260
|
> the same session id is reused across every turn (visible in persisted
|
|
262
261
|
> assistant messages) and downstream branch logic breaks.
|
|
263
262
|
|
|
264
|
-
The
|
|
263
|
+
The remaining on-disk workaround (Codex) follows this
|
|
265
264
|
shape — copy the state, replace the source id with a fresh one, then
|
|
266
|
-
resume against the fork
|
|
267
|
-
the layout wrong and `sessionStateExists()` silently returns false on
|
|
265
|
+
resume against the fork. Get the on-disk layout wrong and `sessionStateExists()` silently returns false on
|
|
268
266
|
every turn, the fork block is skipped, and the engine resumes the
|
|
269
267
|
original session — exactly the symptom multi-branch checkpoints
|
|
270
268
|
surface as.
|
|
@@ -289,39 +287,34 @@ assumed a directory layout (`<CODEX_HOME>/sessions/<thread_id>/`) — the
|
|
|
289
287
|
result was a permanently-broken fork because `sessionStateExists()`
|
|
290
288
|
never matched. If you change the helper, watch for that regression.
|
|
291
289
|
|
|
292
|
-
**Qwen Code — single chat JSONL keyed by sanitised cwd.** The chat id
|
|
293
|
-
is the filename basename; the parent directory is derived from the
|
|
294
|
-
project's cwd via the SDK's `sanitizeCwd()`
|
|
295
|
-
(`cwd.replace(/[^a-zA-Z0-9]/g, '-')`, lowercased on win32):
|
|
296
|
-
|
|
297
|
-
```
|
|
298
|
-
<QWEN_RUNTIME_DIR>/projects/<sanitized-cwd>/chats/<sessionId>.jsonl
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
where `<QWEN_RUNTIME_DIR>` is Clopen's isolated `{clopenDir}/engine/qwen/user/`
|
|
302
|
-
(§10.19), **not** `~/.qwen` — both the env var and the fork helper
|
|
303
|
-
(`getQwenRuntimeDir()`) resolve to the same base, so they stay in sync.
|
|
304
|
-
|
|
305
|
-
Every record line carries a `sessionId` field equal to the file's
|
|
306
|
-
basename. The fork helper copies the file to
|
|
307
|
-
`<chats>/<forkId>.jsonl` in the same project directory and replaces
|
|
308
|
-
the source id throughout. The Qwen `session-fork.ts` therefore takes
|
|
309
|
-
`projectPath` as an extra argument — Codex and Copilot are
|
|
310
|
-
cwd-agnostic because their layouts aren't keyed on it.
|
|
311
|
-
|
|
312
290
|
```ts
|
|
313
|
-
// stream.ts (resume path) — fork on EVERY resume
|
|
314
|
-
// across copilot/codex/qwen, only the helper signature differs.
|
|
291
|
+
// codex/stream.ts (resume path) — fork on EVERY resume.
|
|
315
292
|
let resumeId = resume;
|
|
316
|
-
if (resume && sessionStateExists(
|
|
293
|
+
if (resume && sessionStateExists(resume)) {
|
|
317
294
|
const forkId = crypto.randomUUID();
|
|
318
|
-
if (
|
|
295
|
+
if (forkCodexSessionState(resume, forkId)) {
|
|
319
296
|
resumeId = forkId;
|
|
320
297
|
}
|
|
321
298
|
}
|
|
322
299
|
// then pass resumeId to the SDK's resume entry point.
|
|
323
300
|
```
|
|
324
301
|
|
|
302
|
+
**Qwen Code still needs the layout, even with a native fork.**
|
|
303
|
+
`--fork-session` on a missing source exits the CLI, so
|
|
304
|
+
`qwen/session-store.ts` checks the chat exists before asking for a fork. The
|
|
305
|
+
chat id is the filename basename; the parent directory is derived from the
|
|
306
|
+
project's cwd via the CLI's `sanitizeCwd()`
|
|
307
|
+
(`cwd.replace(/[^a-zA-Z0-9]/g, '-')`, lowercased on win32):
|
|
308
|
+
|
|
309
|
+
```
|
|
310
|
+
<QWEN_RUNTIME_DIR>/projects/<sanitized-cwd>/chats/<sessionId>.jsonl
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
where `<QWEN_RUNTIME_DIR>` is Clopen's isolated `{clopenDir}/engine/qwen/user/`
|
|
314
|
+
(§10.19), **not** `~/.qwen` — both the env var and the store
|
|
315
|
+
(`getQwenRuntimeDir()`) resolve to the same base, so they stay in sync. Get it
|
|
316
|
+
wrong and every resume silently skips the fork.
|
|
317
|
+
|
|
325
318
|
The expected effect, observable by logging the session/thread id per
|
|
326
319
|
turn:
|
|
327
320
|
|
|
@@ -447,6 +440,15 @@ When you add an engine whose CLI/SDK accepts a streamable-http MCP URL
|
|
|
447
440
|
of `mcp__<server>__<tool>` — the prefix didn't strip and the registry
|
|
448
441
|
lookup fell through to the `mcp__<mcpServerName>__<rawName>` fallback.
|
|
449
442
|
|
|
443
|
+
**The one exception is an engine whose names are lossy.** Pi turns every
|
|
444
|
+
character outside `[A-Za-z0-9_]` into `_` and hash-suffixes collisions
|
|
445
|
+
(`mcp__clopen_mcp__actions`, `mcp__my_server__get_page`), so no prefix
|
|
446
|
+
list can recover an external namespace or a hyphenated tool name. Pi
|
|
447
|
+
keeps the original on the tool's `label` (`<server>/<tool>`), so
|
|
448
|
+
`pi/mcp.ts::resolvePiToolName` reads that back and still hands the bare
|
|
449
|
+
internal tool name to `resolveOpenCodeToolName()`. Map through whatever
|
|
450
|
+
the SDK preserves; never parse a sanitized name.
|
|
451
|
+
|
|
450
452
|
3. If your engine has **no callback hook** for AskUserQuestion (Codex's
|
|
451
453
|
SDK is the canonical example), AskUserQuestion stays unsupported for
|
|
452
454
|
that engine until the upstream SDK exposes a native primitive. The
|
|
@@ -905,10 +907,26 @@ alone — confirm against the binary's OpenAPI doc.**
|
|
|
905
907
|
|
|
906
908
|
Consequence: the `question.asked` / `message.part.delta` / `permission.asked`
|
|
907
909
|
handlers in `opencode/stream.ts` are correct at runtime but **not**
|
|
908
|
-
type-checked against the SDK (the cast hides them).
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
910
|
+
type-checked against the SDK (the cast hides them). Every bump must therefore
|
|
911
|
+
diff the binary's `/doc` between the old and new pin — paths, event literals
|
|
912
|
+
and schemas — and watch one real prompt's event types arrive. The 1.18.34 pass
|
|
913
|
+
did exactly that: zero operations, literals or schemas added or removed (only
|
|
914
|
+
`ProviderConfig.timeout/chunkTimeout`, which Clopen never sets), and the
|
|
915
|
+
legacy events still flow.
|
|
916
|
+
|
|
917
|
+
**`@opencode-ai/sdk/v2` is not where OpenCode is going — OpenCode V2 is.**
|
|
918
|
+
OpenCode 2.x is a separate product: binary `@opencode/cli`, clients
|
|
919
|
+
`@opencode/client` (HTTP) and `@opencode/sdk` (in-process host, ~417 MB of
|
|
920
|
+
dependencies), a `/api/*` contract with `session.text.*` / `session.tool.*` /
|
|
921
|
+
`session.execution.*` events, `permissions[]` rules, forms for questions, and a
|
|
922
|
+
native config shape (`mcp.servers`, `providers`, `agents`). Its binary no longer
|
|
923
|
+
serves the v1 API at all — `/session`, `/event` and `/config/providers` fall
|
|
924
|
+
through to the web UI — so moving there is an adapter rewrite, not an import
|
|
925
|
+
swap. It does migrate a v1 `opencode.db` in place with session ids preserved,
|
|
926
|
+
and `serve` without `--service` stays inside the `XDG_*` sandbox. Clopen stayed
|
|
927
|
+
on the v1 line in October 2026 because V2's own OpenAPI calls itself an
|
|
928
|
+
"Experimental HttpApi" and shipped 21 releases in its first 19 days while the
|
|
929
|
+
1.18.x line kept releasing; revisit once that contract settles.
|
|
912
930
|
|
|
913
931
|
---
|
|
914
932
|
|
|
@@ -941,7 +959,8 @@ What this means for a new adapter:
|
|
|
941
959
|
shape. No stdio branch, no `oauth` flags, no third-party header forwarding —
|
|
942
960
|
the proxy injects the upstream credential itself. Every existing builder is
|
|
943
961
|
now identical bar the SDK field names
|
|
944
|
-
(`getClaude/OpenCode/Codex/Copilot/QwenExternalMcpConfig`);
|
|
962
|
+
(`getClaude/OpenCode/Codex/Copilot/Cursor/Pi/QwenExternalMcpConfig`);
|
|
963
|
+
mirror that.
|
|
945
964
|
|
|
946
965
|
2. **Use the engine's real URL/header field** — same per-SDK caveats as the
|
|
947
966
|
internal bridge (§10.12), because the shape is identical:
|
|
@@ -952,6 +971,8 @@ What this means for a new adapter:
|
|
|
952
971
|
- Copilot: set `tools: ['*']` so the CLI exposes the proxy's tools (its
|
|
953
972
|
"undefined = all" default is not honoured for dynamically discovered
|
|
954
973
|
servers).
|
|
974
|
+
- Pi: `exposure: 'direct'` (its default, `codemode`, hides the tools
|
|
975
|
+
behind a scripting tool) and `timeout` in **seconds**.
|
|
955
976
|
|
|
956
977
|
> **Two token systems — don't conflate them.** The bridge (internal AND
|
|
957
978
|
> external endpoints) is authed by a process-scoped, in-memory **service token**
|
|
@@ -995,7 +1016,7 @@ source of truth; do not hand-join the path.
|
|
|
995
1016
|
| Claude | `CLAUDE_CONFIG_DIR` | `claude/environment.ts` (`getClaudeUserConfigDir()` → helper) |
|
|
996
1017
|
| Codex | `CODEX_HOME` | `codex/credential.ts` (`CODEX_HOME` const) **+** the SDK's `env` in `codex/stream.ts` **+** the `codex login` PTY env in `ws/engine/codex/accounts.ts` |
|
|
997
1018
|
| Copilot | `baseDirectory` (SDK sets `COPILOT_HOME`) | `copilot/stream.ts` `new CopilotClient({ baseDirectory })` |
|
|
998
|
-
| Qwen | `QWEN_RUNTIME_DIR` | `qwen/environment.ts` **+** `getQwenRuntimeDir()` in `qwen/session-
|
|
1019
|
+
| Qwen | `QWEN_RUNTIME_DIR` | `qwen/environment.ts` **+** `getQwenRuntimeDir()` in `qwen/session-store.ts` |
|
|
999
1020
|
| OpenCode | `XDG_DATA_HOME` / `XDG_CONFIG_HOME` / `XDG_STATE_HOME` / `XDG_CACHE_HOME` | `opencode/server.ts` spawn env |
|
|
1000
1021
|
|
|
1001
1022
|
Sharp edges, each of which silently defeats isolation if missed:
|
|
@@ -1009,8 +1030,8 @@ Sharp edges, each of which silently defeats isolation if missed:
|
|
|
1009
1030
|
runs in a separate PTY (`ws/engine/codex/accounts.ts`); without
|
|
1010
1031
|
`CODEX_HOME` there, the OAuth `auth.json` lands in `~/.codex` while the
|
|
1011
1032
|
stream reads the isolated dir → "logged in but not authenticated".
|
|
1012
|
-
- **Keep the
|
|
1013
|
-
`session-fork.ts` reads `getCodexHomeDir()` and Qwen's reads
|
|
1033
|
+
- **Keep the session-store base in lockstep with the env var.** Codex's
|
|
1034
|
+
`session-fork.ts` reads `getCodexHomeDir()` and Qwen's `session-store.ts` reads
|
|
1014
1035
|
`getQwenRuntimeDir()` — both resolve to the same isolated base the env
|
|
1015
1036
|
var sets. If they drift, `sessionStateExists()` returns false and
|
|
1016
1037
|
multi-branch checkpoints break (see §10.10).
|
|
@@ -1162,6 +1183,17 @@ UNSAFE** — 45+ files (`@anthropic-ai/sdk`, `openai`, `elysia`, `mongodb`,
|
|
|
1162
1183
|
`@google/genai`) platform-detect on `Deno` and would break. Map `plan_required`
|
|
1163
1184
|
and socket errors to clear user messages in `error-handler.ts`.
|
|
1164
1185
|
|
|
1186
|
+
Since 1.0.37 the package carries a `"bun"` export condition, so
|
|
1187
|
+
`Bun.resolveSync('@cursor/sdk', …)` in `sdk-loader.ts` loads the flat
|
|
1188
|
+
single-file build (`dist/bundled/index.js`) instead of the lazily-chunked ESM
|
|
1189
|
+
build, and `@connectrpc/connect-node` is no longer a dependency. The flat build
|
|
1190
|
+
is Cursor's supported Bun path (agent streams default to HTTP/1.1 under Bun).
|
|
1191
|
+
Its SQLite store uses `bun:sqlite`, but keep `JsonlLocalAgentStore`: the store
|
|
1192
|
+
location is Clopen's isolation choice (§10.19), not a runtime workaround.
|
|
1193
|
+
Ripgrep and the sandbox helper still come from the native
|
|
1194
|
+
`@cursor/sdk-<os>-<arch>` package; without it, search falls back to `rg` on
|
|
1195
|
+
`PATH`.
|
|
1196
|
+
|
|
1165
1197
|
> **Global fixes that came out of this** (apply to ALL engines, not just Cursor):
|
|
1166
1198
|
> the List tool renders its directory listing with `CodeBlock` (monospace), not
|
|
1167
1199
|
> `TextMessage` (markdown); `AgentTool.svelte` hides an empty description line;
|
|
@@ -1270,18 +1302,21 @@ Three consequences worth internalizing:
|
|
|
1270
1302
|
**The model advertises, the UI obeys.** `EngineModel.capabilities.
|
|
1271
1303
|
reasoningControl` (`{ levels, default }`) is the entire contract. The
|
|
1272
1304
|
picker renders a pill when it's present and nothing when it's absent —
|
|
1273
|
-
which is how
|
|
1274
|
-
|
|
1275
|
-
from the SDK's own payload
|
|
1276
|
-
`
|
|
1277
|
-
|
|
1305
|
+
which is how OpenCode (and Qwen on endpoints that publish no
|
|
1306
|
+
capabilities) stays knob-less without a single engine name appearing in the
|
|
1307
|
+
frontend. Prefer deriving the level list from the SDK's own payload
|
|
1308
|
+
(Copilot's `supportedReasoningEfforts`, Pi's `getSupportedThinkingLevels`,
|
|
1309
|
+
Cursor's `ModelParameterDefinition`, Qwen's `/models` `supported_parameters`,
|
|
1310
|
+
Cline's catalog `reasoningOptions`)
|
|
1311
|
+
over hardcoding; only static catalogs (Claude, Codex) spell it out.
|
|
1278
1312
|
|
|
1279
1313
|
**Clamp on the way in.** The token reaching `streamQuery` may be stale —
|
|
1280
1314
|
persisted on a session whose model has since changed, or restored from a
|
|
1281
1315
|
`reasoningDefaults` entry written by an older catalog. Every adapter
|
|
1282
1316
|
validates against its own set and falls back to the engine default
|
|
1283
|
-
instead of forwarding garbage to the SDK (`clampThinkingLevel` for Pi,
|
|
1284
|
-
|
|
1317
|
+
instead of forwarding garbage to the SDK (`clampThinkingLevel` for Pi,
|
|
1318
|
+
`resolveClaudeReasoning` / `resolveCodexEffort` against the model's own
|
|
1319
|
+
levels, a literal `Set` for Copilot, a `::`-shape check for Cursor).
|
|
1285
1320
|
|
|
1286
1321
|
**Encode structure in the value, not in new fields.** Cursor needs a
|
|
1287
1322
|
parameter *id* alongside the level, so its tokens are
|
|
@@ -1502,7 +1537,8 @@ the string into `--config model_reasoning_effort="…"`. Reading the transport,
|
|
|
1502
1537
|
not just the type, is what made GPT-5.6's top levels reachable. Cast at the SDK
|
|
1503
1538
|
boundary and gate the value in one place (`resolveCodexEffort`), never by a
|
|
1504
1539
|
second copy of the allow-list next to the call site — that copy is exactly what
|
|
1505
|
-
had gone stale.
|
|
1540
|
+
had gone stale. (The SDK caught up in 0.149 — the union now runs to `ultra` —
|
|
1541
|
+
so the 0.159 bump dropped the cast and typed the catalog's levels against it.)
|
|
1506
1542
|
|
|
1507
1543
|
The mechanical part of an upgrade is cheap; budget the time for the union
|
|
1508
1544
|
diffs. `/tmp`-installing the old and new versions side by side and diffing the
|
|
@@ -1564,6 +1600,278 @@ default-off setting, and a fallback that special-cases `option_not_applied` —
|
|
|
1564
1600
|
that rejection means the session is **already running**, so the naive
|
|
1565
1601
|
"fall back to `query()`" double-sends the prompt.
|
|
1566
1602
|
|
|
1603
|
+
**The October 2026 Claude pass (0.3.284 → 0.3.296) found the CLI rewriting
|
|
1604
|
+
reasoning levels behind the picker's back.** The upgrade itself was quiet —
|
|
1605
|
+
`SDKMessage` unchanged, every type change additive, and the one behaviour
|
|
1606
|
+
change (an omitted `permissionMode` now follows the CLI's default) does not
|
|
1607
|
+
reach Clopen, which always passes `bypassPermissions`. CLI 2.1.296 adds
|
|
1608
|
+
`claude-haiku-5-5`, and the `haiku` alias now resolves to it. The finding was in
|
|
1609
|
+
how the CLI builds the request from `thinking` and `effort`, read straight out of
|
|
1610
|
+
the binary because no doc describes it:
|
|
1611
|
+
|
|
1612
|
+
- `thinking: { type: 'disabled' }` is sent only when the model's table entry
|
|
1613
|
+
lacks `rejects_disabled_thinking`. Otherwise the field is omitted and the
|
|
1614
|
+
model thinks adaptively. The API returns 400 for `disabled` on Opus 5.5,
|
|
1615
|
+
Fable 5/5.1 and Sonnet 5.5, so the CLI is protecting the request — but
|
|
1616
|
+
Clopen's picker kept offering "Off" on all of them, and it did nothing.
|
|
1617
|
+
- `effort` is deleted on a model without the `effort` capability (Opus 4.5),
|
|
1618
|
+
and `xhigh` exists only from Opus 4.7 on.
|
|
1619
|
+
- `adaptive` on a model without `adaptive_thinking` becomes a `budget_tokens`
|
|
1620
|
+
request.
|
|
1621
|
+
|
|
1622
|
+
None of these errors, which is the trap: the catalog's single level list for
|
|
1623
|
+
every model compiled, ran, and showed options that changed nothing. The levels
|
|
1624
|
+
are per model now, read from the same table that decides which slugs work
|
|
1625
|
+
(`strings -a <cli> | grep -oE '\{id:"claude-[a-z0-9-]+",family.{0,1500}'`, then
|
|
1626
|
+
the `capabilities:[…]` array), and `resolveClaudeReasoning` holds a stored
|
|
1627
|
+
preference to them — the Codex shape. When the next CLI changes a model's
|
|
1628
|
+
capabilities, that table is what to diff, alongside the slug list.
|
|
1629
|
+
|
|
1630
|
+
**The October 2026 Codex pass (0.147 → 0.159.3) hit both catalog traps and
|
|
1631
|
+
one quiet regression.** The SDK's `.d.ts` barely moved (`configOverrides`,
|
|
1632
|
+
`threadSource`, a wider effort union), and the event union was unchanged — so
|
|
1633
|
+
the risk sat entirely in the CLI-internal files the adapter reads.
|
|
1634
|
+
|
|
1635
|
+
- **The rollout patch event moved, and nothing failed.** `patch-rollout.ts`
|
|
1636
|
+
recovered Edit/Write contents from a `patch_apply_end` line. The 0.159 CLI no
|
|
1637
|
+
longer writes one; the same `changes` map now rides an `event_msg` →
|
|
1638
|
+
`item_completed` line whose `item.type` is `FileChange`. The adapter degraded
|
|
1639
|
+
exactly as designed — empty `oldString`/`newString` — which is why only a live
|
|
1640
|
+
turn that edits a file catches it. The reader accepts both lines now (older
|
|
1641
|
+
rollouts still carry the legacy one).
|
|
1642
|
+
- **The catalog had run ahead of the binary again.** Each preset in the CLI
|
|
1643
|
+
table carries `minimal_client_version`; the GPT-6 models already listed in
|
|
1644
|
+
`models.ts` needed 0.153/0.155 while the pin was 0.147 — the Claude 0.3.229
|
|
1645
|
+
trap above, on a second engine. Read that field on every catalog refresh.
|
|
1646
|
+
- **A model has two context windows.** `context_window` (272k) is what the CLI
|
|
1647
|
+
uses by default; `max_context_window` (872k for the 5.6/6 families) is the
|
|
1648
|
+
ceiling for a `model_context_window` override. The SDK bakes `config` once
|
|
1649
|
+
per client while the model changes per turn, so Clopen sends one value — the
|
|
1650
|
+
catalog's largest — and relies on the CLI clamping it per model (verified:
|
|
1651
|
+
2M on `gpt-5.6-luna` → 872k, 872k on `gpt-5.5` → 272k, each less a 5%
|
|
1652
|
+
reserve reported as `model_context_window` in `token_count`).
|
|
1653
|
+
- **A paginated rollout store is on the way.** The 0.159 binary carries
|
|
1654
|
+
`paginated_history.jsonl.zst` and a `legacy_to_paginated_v1` migration,
|
|
1655
|
+
behind `background_paginated_rollout_migration` and
|
|
1656
|
+
`local_thread_store_compression` — both "under development", off by default
|
|
1657
|
+
(`codex features list` with a scratch `CODEX_HOME`). When either flips, all
|
|
1658
|
+
three rollout readers (`patch-rollout`, `usage-rollout`, `session-fork`)
|
|
1659
|
+
break together; check that list on every bump.
|
|
1660
|
+
|
|
1661
|
+
**The October 2026 Copilot pass (1.0.9 → 1.0.16) changed how the runtime
|
|
1662
|
+
ships, not just the API.** The `.d.ts` diff was additive and the event union
|
|
1663
|
+
only lost the experimental `factory.*` events, so `bun run check` passed on
|
|
1664
|
+
the first try. The work was elsewhere:
|
|
1665
|
+
|
|
1666
|
+
- **The CLI package is gone; the runtime is a native binary.** 1.0.9 depended
|
|
1667
|
+
on `@github/copilot` and, under Bun, spawned `node <platform-pkg>/index.js`
|
|
1668
|
+
(`getNodeExecPath()` returns `"node"` when `process.versions.bun` is set) —
|
|
1669
|
+
so Copilot quietly needed Node on PATH in a Bun-only project. 1.0.16 ships
|
|
1670
|
+
`copilot-runtime` + `runtime.node` in per-platform optional packages
|
|
1671
|
+
(`@github/copilot-sdk-<platform>`) and spawns the binary directly; a live
|
|
1672
|
+
turn with `node` removed from PATH works. `ENGINE_PACKAGES.copilot` lost the
|
|
1673
|
+
CLI pin. `koffi` only loads for `RuntimeConnection.forInProcess()`, which
|
|
1674
|
+
Clopen does not use. `bun add` never removes a dropped pin, so existing
|
|
1675
|
+
stack dirs keep the old CLI declared (and installed) on their own.
|
|
1676
|
+
- **`askUserVariant: "elicitation"` is not reachable on runtime 1.0.90.** With
|
|
1677
|
+
only `onElicitationRequest`, the session has **no** `ask_user` tool; with
|
|
1678
|
+
`onUserInputRequest` as well, the runtime keeps the legacy shape. Neither a
|
|
1679
|
+
`featureFlags` entry, `COPILOT_EXPERIMENTS`, nor `enableExperimentalMode`
|
|
1680
|
+
changed that (the binary gates it behind an `ASK_USER_ELICITATION`
|
|
1681
|
+
experiment). The legacy `onUserInputRequest` path stays; re-probe on the next
|
|
1682
|
+
bump before building a form UI for it.
|
|
1683
|
+
- **`managedSettings` accepts three rule families.** `Shell`, `Write` and `Read`
|
|
1684
|
+
(any case, bare or with a `(glob)` argument). `url`, `memory`, MCP server
|
|
1685
|
+
names or anything unknown make `session.create` fail outright, so an
|
|
1686
|
+
unvalidated translation of Clopen's policy would break every turn instead of
|
|
1687
|
+
restricting it. A managed deny is enforced before `onPermissionRequest` is
|
|
1688
|
+
consulted — verified with `approveAll` in place — and the layer is not
|
|
1689
|
+
persisted: it must ride every `resumeSession` too. See
|
|
1690
|
+
`copilot/permissions.ts`; the hook still covers the other kinds.
|
|
1691
|
+
- **Instruction discovery is cached per runtime process.** The client outlives
|
|
1692
|
+
turns while artifact sync and the user rewrite AGENTS.md and Copilot's
|
|
1693
|
+
instruction files. New sessions pass `refreshCustomInstructions: true` (a
|
|
1694
|
+
create-only option); resumed ones call `session.rpc.instructions.reload()`.
|
|
1695
|
+
|
|
1696
|
+
**The Qwen pass (0.1.8 → 0.1.17) retired two workarounds whose cause had
|
|
1697
|
+
already been fixed — re-check a workaround's TODO condition against the bundled
|
|
1698
|
+
CLI on every bump, not only when the changelog mentions it.**
|
|
1699
|
+
|
|
1700
|
+
- **The SDK can learn a flag before its CLI does.** `QueryOptions.forkSession`
|
|
1701
|
+
already existed in 0.1.8 and pushed `--fork-session`, but the 0.1.8 CLI had
|
|
1702
|
+
no such option, so `session-fork.ts` copied the chat JSONL instead. 0.1.17's
|
|
1703
|
+
CLI forks natively (`sessionService.forkSession(src, randomUUID())`), so the
|
|
1704
|
+
adapter now passes `resume` + `forkSession: true`. Two details: the CLI mints
|
|
1705
|
+
the fork id itself and rejects `--session-id` next to `--resume`, so the new
|
|
1706
|
+
id is only known from the stream; and `--fork-session` on a missing source
|
|
1707
|
+
exits with code 1, so the on-disk existence check stays in front of it
|
|
1708
|
+
(`qwen/session-store.ts`). Grep the CLI's option table
|
|
1709
|
+
(`dist/cli/chunks/`), not the SDK's `.d.ts`, to know what actually works.
|
|
1710
|
+
- **AskUserQuestion had been fixed upstream since at least 0.1.8 — but
|
|
1711
|
+
re-enabling it exposed four Clopen-side faults, each invisible in the UI.**
|
|
1712
|
+
`handleOutgoingPermissionRequest` forwards `updatedInput` through
|
|
1713
|
+
`buildAllowConfirmationPayload`, so the `excludeTools` block outlived its
|
|
1714
|
+
cause. What it had been hiding:
|
|
1715
|
+
1. *Answer keys.* The CLI reads `answers` by question **index** and silently
|
|
1716
|
+
drops other keys (`parseAnswerQuestionIndex`), then tells the model "No
|
|
1717
|
+
valid answers were provided." The frontend keys by question **text**
|
|
1718
|
+
(Claude's shape). `toQwenAnswers` re-keys at the adapter boundary.
|
|
1719
|
+
2. *The prompt stream closed stdin after 60 s.* A one-shot prompt iterable
|
|
1720
|
+
completes immediately; the SDK then waits for the first `result` or
|
|
1721
|
+
`timeout.streamClose` (60 s) and ends the CLI's stdin. The CLI's
|
|
1722
|
+
`markInputClosed` rejects every pending and future control request, so in
|
|
1723
|
+
any turn longer than a minute AskUserQuestion, write approvals and
|
|
1724
|
+
interrupt all failed with "The host could not present the required
|
|
1725
|
+
approval". `openPromptStream` keeps the iterable open until `result`.
|
|
1726
|
+
3. *`timeout.canUseTool` above 10 min is ignored, not clamped.* The SDK
|
|
1727
|
+
forwards it to the CLI, which accepts at most `MAX_CAN_USE_TOOL_TIMEOUT_MS`
|
|
1728
|
+
(600 000) and otherwise keeps its 60 s default. The old
|
|
1729
|
+
`2_147_483_647` therefore meant "60 s".
|
|
1730
|
+
4. *The converter rewrote failures into answers.* It replaced every AUQ
|
|
1731
|
+
tool_result with the user's answers, so a call the CLI had cancelled showed
|
|
1732
|
+
as answered while the model was told the opposite. Errors pass through now.
|
|
1733
|
+
The SDK's message router also `await`s each control request, so while a
|
|
1734
|
+
question is open nothing else is read from the CLI — the transcript stalls
|
|
1735
|
+
until the user answers. That is upstream behaviour; it is harmless once
|
|
1736
|
+
stdin stays open, but it is why the stall looked like a hang.
|
|
1737
|
+
- **Managed auto-memory holds the turn's `result` hostage.** On by default in
|
|
1738
|
+
the 0.1.17 CLI: after every turn an extraction agent (up to 5 model calls,
|
|
1739
|
+
2 min) runs, and `result` is only emitted after it — the chat sat on
|
|
1740
|
+
"working" with the interrupt button up, spending the user's tokens on
|
|
1741
|
+
memories written to the CLI's own store, which no other engine reads.
|
|
1742
|
+
`environment.ts` points `QWEN_CODE_SYSTEM_SETTINGS_PATH` at a Clopen-owned
|
|
1743
|
+
file that sets `memory.enableManagedAutoMemory` / `enableManagedAutoDream`
|
|
1744
|
+
to `false`; the system tier outranks `~/.qwen` and the repo's `.qwen/`.
|
|
1745
|
+
- **Reproduce engine bugs against a fake endpoint, not by reading minified
|
|
1746
|
+
code.** A 40-line `Bun.serve` that speaks OpenAI SSE and scripts the model's
|
|
1747
|
+
tool calls ran the real bundled CLI through every failure above in seconds,
|
|
1748
|
+
with `timeout.streamClose` shortened to replay the 60 s case.
|
|
1749
|
+
- **`cli.js` is a loader now.** It shrank from a single 400k-line bundle to an
|
|
1750
|
+
11-line entry over `dist/cli/chunks/`, so every `cli.js:<line>` citation in
|
|
1751
|
+
the adapter went stale at once. Cite the symbol (`sanitizeCwd`,
|
|
1752
|
+
`FORK_PLACEHOLDER_RESULT`, `parseAnswerQuestionIndex`), never a line.
|
|
1753
|
+
- **Effort is honoured only where the endpoint says so.** The SDK's `effort`
|
|
1754
|
+
is turned by the CLI into the provider's own field (`reasoning_effort`,
|
|
1755
|
+
DashScope `enable_thinking`, …) and clamped to what it believes the endpoint
|
|
1756
|
+
accepts. Clopen shows the selector only when the model's `/models` entry
|
|
1757
|
+
lists `reasoning_effort` in `supported_parameters` (OpenRouter); DashScope and
|
|
1758
|
+
Fireworks publish no capability data, so no selector. When the CLI declines
|
|
1759
|
+
an effort, `Query.getInitialEffortStatus()` says why and the adapter logs it.
|
|
1760
|
+
|
|
1761
|
+
**The October 2026 Pi pass (0.84.1 → 1.1.0) traded the bespoke MCP bridge for
|
|
1762
|
+
Pi's own client.** `bun run check` found one error (`preflightResult` now
|
|
1763
|
+
receives a disposition string and is no longer called on rejection — the
|
|
1764
|
+
rejection throws, so the old "not accepted" notice was dead). The 0.86/0.87
|
|
1765
|
+
breaking changes (`TranscriptContext`, canonical `SessionManager` context,
|
|
1766
|
+
`shouldStopAfterTurn`) touch nothing Clopen calls. The real work was MCP:
|
|
1767
|
+
|
|
1768
|
+
- **SDK sessions don't load the built-in MCP/codemode/tool_search
|
|
1769
|
+
extensions** — the CLI does. Add `createMcpExtension()` to the resource
|
|
1770
|
+
loader yourself, and pass `loadConfig`, `logPath`, `openUrl` and
|
|
1771
|
+
`updateConfig`: every default falls back to Pi's `getAgentDir()`, i.e. the
|
|
1772
|
+
user's real `~/.pi/agent`, not the isolated `agentDir` the session got.
|
|
1773
|
+
Servers carrying an `Authorization` header never touch Pi's OAuth store.
|
|
1774
|
+
- **A `tools` allowlist drops every tool registered later.** MCP tools register
|
|
1775
|
+
when their server connects, after the session exists, and the allowlist
|
|
1776
|
+
filters them out. The built-ins go in as the `defaultTools` setting instead,
|
|
1777
|
+
denied ones in `excludeTools`; custom and extension tools stay enabled.
|
|
1778
|
+
- **`session_start` is not automatic, and neither is `session_shutdown`.**
|
|
1779
|
+
`bindExtensions({})` connects the servers (the first prompt waits up to 10 s
|
|
1780
|
+
for `direct` ones); `dispose()` does **not** emit `session_shutdown`, which is
|
|
1781
|
+
the only thing that closes them. Without the explicit emit every turn leaks
|
|
1782
|
+
one connection per server.
|
|
1783
|
+
- **The MCP extension reports failures only through `ctx.ui.notify`**, a no-op
|
|
1784
|
+
in an SDK session: a server that never connected (wrong port, 401) simply left
|
|
1785
|
+
its tools missing. `pi/mcp.ts` hands the extension a context whose `notify`
|
|
1786
|
+
writes to the debug log.
|
|
1787
|
+
- **Login flows can need app context the CLI supplies on its own.** Sign in
|
|
1788
|
+
with ChatGPT (`openai`, new in 0.99) throws "requires a device ID (UUID) for
|
|
1789
|
+
this installation" unless `ModelRuntime.login(…, { getDeviceId })` is given
|
|
1790
|
+
one; the CLI keeps it in its global settings, Clopen in the `settings` table
|
|
1791
|
+
(`getPiDeviceId`). Diff `LoginOptions` on every bump. The same pass added an
|
|
1792
|
+
SDK `loginLabel` per OAuth provider, which now wins over Clopen's own labels.
|
|
1793
|
+
- **`CredentialStore.modify` must be a real lock.** Pi's refresh re-checks
|
|
1794
|
+
expiry *inside* `modify` and relies on the store to serialize per provider —
|
|
1795
|
+
"cross-process too where the backing store supports it". `DbCredentialStore`
|
|
1796
|
+
read, refreshed and wrote with no lock, and Clopen builds one store per
|
|
1797
|
+
stream and per model-list refresh, so two turns could spend the same rotating
|
|
1798
|
+
refresh token; OpenAI and Anthropic then revoke the grant
|
|
1799
|
+
(`refresh_token_invalidated`). Writes now go through a process-wide
|
|
1800
|
+
per-account `createKeyedLock` (`backend/utils/keyed-lock.ts`), re-login and
|
|
1801
|
+
edits included. Cline's `resolveClineAuth` had the same race and shares the
|
|
1802
|
+
fix.
|
|
1803
|
+
- **A `manual_code` prompt is either a fallback or the only way in.** Pi races
|
|
1804
|
+
"paste the redirect URL" against its loopback callback and aborts the prompt
|
|
1805
|
+
(`AuthPrompt.signal`) when the callback wins; Anthropic's copy-code method
|
|
1806
|
+
asks for the same kind with nothing to race. A signal alone doesn't decide it
|
|
1807
|
+
(a flow whose port was taken still passes one), so the login handlers probe
|
|
1808
|
+
the auth URL's loopback `redirect_uri` (`hasLoopbackCallbackListener`) and
|
|
1809
|
+
send `optional`; `OAuthBrowserStep.svelte` folds an optional paste away on a
|
|
1810
|
+
local connection and asks for a required one outright.
|
|
1811
|
+
- **`invalid_grant` right after a successful ChatGPT sign-in was upstream**
|
|
1812
|
+
(earendil-works/pi#10258, same in Pi's CLI, closed 2026-10-02; 1.0.3 also
|
|
1813
|
+
fixed a `refresh_token_invalidated` after a refresh cancelled mid-flight). The
|
|
1814
|
+
login error still explains it should it recur.
|
|
1815
|
+
- **1.0.1 dropped `npm-shrinkwrap.json`.** Pi's own packages depend on each
|
|
1816
|
+
other with `^` ranges, so a Stack install of 1.1.0 would have taken whatever
|
|
1817
|
+
`pi-mcp`/`pi-tui`/`pi-codemode`/`pi-telemetry`/`chord` 1.x was newest — the
|
|
1818
|
+
typebox/peer float (#362) again, one level down. Every sibling is declared in
|
|
1819
|
+
`package.json` and listed in `ENGINE_PACKAGES.pi` now; their third-party
|
|
1820
|
+
dependencies are exact pins, so nothing else floats.
|
|
1821
|
+
- **Provider ids get renamed.** 1.0.3 turned `azure-openai-responses` into
|
|
1822
|
+
`azure`; accounts, chat sessions and saved model choices keep the id they were
|
|
1823
|
+
made with. `canonicalPiProviderId` (`pi/credential.ts`) reads every incoming
|
|
1824
|
+
and stored id through one rename map instead of migrating each store, and a
|
|
1825
|
+
credential is rewritten under the new id on its next save. Add future renames
|
|
1826
|
+
there.
|
|
1827
|
+
- **Sign in with ChatGPT no longer degrades when its port is taken** (1.0.1):
|
|
1828
|
+
it fails with "Port 1455 is in use". Codex's browser login listens there
|
|
1829
|
+
first and moves on when it can't, so in Clopen the holder is usually another
|
|
1830
|
+
pending sign-in; the login error says that rather than pi's "another pi
|
|
1831
|
+
session".
|
|
1832
|
+
- **Cache warming is on by default** (`cacheWarming: "streaming"`): during long
|
|
1833
|
+
tool runs Pi re-sends the prefix when it estimates ≥ $0.05 of avoided
|
|
1834
|
+
cache-miss cost. Left at the default; it is billed and not visible in
|
|
1835
|
+
Clopen's usage.
|
|
1836
|
+
- **New dependencies** (`pi-mcp`, `pi-codemode`, `quickjs-wasi`, `chord`,
|
|
1837
|
+
`pi-telemetry`): the MCP client loads only when a session has servers,
|
|
1838
|
+
codemode only when activated, and `pi-telemetry` is type contracts. `chord`
|
|
1839
|
+
pulls an `esbuild` whose postinstall Bun blocks, but no file in
|
|
1840
|
+
`pi-coding-agent/dist` imports `chord` at all.
|
|
1841
|
+
|
|
1842
|
+
**The October 2026 Cline pass (0.0.74 → 0.0.92) compiled clean on the first
|
|
1843
|
+
try** — every change to the public types is additive, and the five `@cline/*`
|
|
1844
|
+
packages still release in lockstep with exact pins on each other, so only
|
|
1845
|
+
`@cline/sdk` and `@cline/agents` need bumping. What the compile hid:
|
|
1846
|
+
|
|
1847
|
+
- **The catalog is no longer chat-only.** `ModelInfo` grew `operation`
|
|
1848
|
+
(`language`, `transcription`, `image-generation`, …) and `modalities`;
|
|
1849
|
+
`vercel-ai-gateway` alone lists 46 transcription / image / video models, and
|
|
1850
|
+
ElevenLabs is a provider with nothing but speech-to-text. The SDK filters its
|
|
1851
|
+
own pickers with `supportsChatModalities`, which `@cline/sdk` does not
|
|
1852
|
+
re-export, so `isClineChatModel` (`cline/models.ts`) mirrors it and gates both
|
|
1853
|
+
the model list and the provider presets.
|
|
1854
|
+
- **Reasoning became catalog data.** Each model carries `reasoningOptions`
|
|
1855
|
+
(`toggle`, `effort` with its own tier list, `budget_tokens`), and the `Agent`
|
|
1856
|
+
snaps `reasoningEffort` to the nearest advertised tier itself. Cline's
|
|
1857
|
+
selector is now built from that: `off` only where there is a toggle or a
|
|
1858
|
+
`none` effort, `auto` sends nothing, `on` for toggle-only models, and
|
|
1859
|
+
budget-only models (Claude Sonnet/Haiku 4.5) get no selector — there is no
|
|
1860
|
+
level to map a budget to.
|
|
1861
|
+
- **The finish-reason union grew `content-filter` and `unknown`.** A filtered
|
|
1862
|
+
turn with no output now fails the run with an actionable SDK message; one cut
|
|
1863
|
+
short mid-answer finishes normally, so the converter adds a notification.
|
|
1864
|
+
`unknown` is never treated as a completed turn by the SDK.
|
|
1865
|
+
- **New message parts can't render yet.** `media` (generated images) and
|
|
1866
|
+
provider-executed `tool-call`s (`execution: 'provider'`, from `modelTools`)
|
|
1867
|
+
have no unified block. Media becomes a text trace; provider tool calls are
|
|
1868
|
+
skipped, since no local result ever arrives to close them. Clopen passes no
|
|
1869
|
+
`modelTools`, so the latter only matters if that changes.
|
|
1870
|
+
- **Retries moved into the SDK.** The run loop now retries transient provider
|
|
1871
|
+
errors (429, 5xx, network) with backoff when the failed attempt emitted
|
|
1872
|
+
nothing, and compacts + retries a turn truncated at the output limit. The
|
|
1873
|
+
adapter's error mapping only sees what survives those retries.
|
|
1874
|
+
|
|
1567
1875
|
---
|
|
1568
1876
|
|
|
1569
1877
|
### 10.26 One engine instance, many chats — per-stream state cannot live on it
|
|
@@ -1696,3 +2004,38 @@ that feeds the rendered list — across 2140 stored Task blocks, not one carries
|
|
|
1696
2004
|
you its premise is wrong, so the replay lives in
|
|
1697
2005
|
`frontend/utils/chat/task-progress.ts` now, behind unit tests that state each
|
|
1698
2006
|
scenario, rather than inside a `$derived` where no test could reach it.
|
|
2007
|
+
|
|
2008
|
+
### 10.28 Managed stack dirs never shed anything on their own
|
|
2009
|
+
|
|
2010
|
+
Every managed stack only ever grew. Three independent mechanisms, one shape:
|
|
2011
|
+
|
|
2012
|
+
- **Engines (`~/.clopen/stack/engines`).** `bun add` only adds or re-pins, so a
|
|
2013
|
+
package dropped from `ENGINE_PACKAGES` / `ENGINE_CLI` stays declared — and
|
|
2014
|
+
installed — forever. Worse, `bun remove` is not enough either: dropping a
|
|
2015
|
+
package that carried per-platform optional dependencies leaves the platform
|
|
2016
|
+
package in `node_modules`, absent from `bun.lock` and untouched by
|
|
2017
|
+
`bun install --force` (measured: ~330 MB for a retired Copilot CLI). A
|
|
2018
|
+
successful engine install now runs `pruneStackDependencies`
|
|
2019
|
+
(`install-runner.ts`): `bun remove` whatever `knownStackEnginePackages()` no
|
|
2020
|
+
longer lists, then `sweepOrphanedModules` deletes every top-level module
|
|
2021
|
+
`bun.lock` does not resolve (plus dangling `.bin` links). The lockfile is the
|
|
2022
|
+
authority — without a readable one nothing is deleted. Removing a top-level
|
|
2023
|
+
declaration is safe while an older SDK still depends on the package: bun keeps
|
|
2024
|
+
it as a transitive dependency. The prune is skipped while another install
|
|
2025
|
+
shares the dir, because that install's extracted files may not be in the
|
|
2026
|
+
lockfile yet; the last install to finish cleans up.
|
|
2027
|
+
- **Embedding (`~/.clopen/stack/embedding/<version>`).** A version bump downloads
|
|
2028
|
+
into a fresh directory and nothing read the old one again. Other version dirs
|
|
2029
|
+
(and stale `.partial` staging dirs) are removed once the current version has
|
|
2030
|
+
**loaded** — gated on the load, so a failed upgrade keeps the previous
|
|
2031
|
+
artifact.
|
|
2032
|
+
- **Chrome for Testing (`~/.clopen/bin/chrome/<platform>-<buildId>`).**
|
|
2033
|
+
`chrome@stable` installs each build beside the last, and the resolver took the
|
|
2034
|
+
first `readdir` entry — alphabetical, so after an update it kept launching the
|
|
2035
|
+
**oldest** build (`mac_arm-140…` sorts before `mac_arm-141…`). It now sorts by numeric build id, and superseded builds are
|
|
2036
|
+
deleted at server startup, before anything can launch one: right after an
|
|
2037
|
+
update the old build may still be running, and deleting a live app bundle
|
|
2038
|
+
(macOS) or a locked executable (Windows) is not safe.
|
|
2039
|
+
|
|
2040
|
+
The rule for any future managed stack: decide at creation time **who removes
|
|
2041
|
+
what replaced it**, and gate the removal on the replacement being proven usable.
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
| Per-stream state on a shared instance | `adapters/run-registry.ts::EngineRuns` (+ each adapter's `XxxRun`; §10.26) |
|
|
23
23
|
| Cancel exactly one chat's stream | `adapters/run-registry.ts::select` → `stream.ts::stopRuns`; stream-manager passes `streamState.abortController` |
|
|
24
24
|
| Cancel-before-RPC ordering | `opencode/stream.ts::stopRuns`, `claude/stream.ts::stopRuns`, `copilot/stream.ts::stopRuns` |
|
|
25
|
-
| Fork session (native vs. on-disk vs. in-memory) | `claude/stream.ts` (`forkSession: true`), `opencode/stream.ts` (`client.session.fork`), `copilot/stream.ts` (`client.rpc.sessions.fork`), `codex/session-fork.ts`
|
|
25
|
+
| Fork session (native vs. on-disk vs. in-memory) | `claude/stream.ts` + `qwen/stream.ts` (`forkSession: true`), `opencode/stream.ts` (`client.session.fork`), `copilot/stream.ts` (`client.rpc.sessions.fork`), `codex/session-fork.ts` (copy disk state), `pi/session-fork.ts` (`SessionManager.forkFrom`), `cline/stream.ts` (**session-less** — fresh id per turn + in-memory copy-on-branch; see §10.10) |
|
|
26
26
|
| Sub-agent (`Task`/`Agent`) routing | `claude/message-converter.ts` (`parent_tool_use_id`), `opencode/message-converter.ts::convertSubtaskToolUseOnly`, `copilot/message-converter.ts::resolveParentToolUseId` + `agentParentMap`; **synthesized** `Agent` tool for bare-loop SDKs in `cline/agent-tool.ts` + `pi/agent-tool.ts` (see §10.15) |
|
|
27
27
|
| File-backed Workflow activity (event-driven) | `claude/workflow-transcript.ts` (filesystem watchers, byte offsets, terminal status) + `claude/stream.ts::EventQueue` merge; no interval polling (§10.15) |
|
|
28
28
|
| Keep parent-tool children out of root placeholders | `frontend/services/chat/chat.service.ts::handleMessageEvent` (`!message.parent?.toolUseId`) + `frontend/utils/chat/message-grouper.ts` (`subAgentMap`); frontend-and-chat §6.5 |
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
| Tolerant JSON extraction (fences, trailing prose, raw newlines) | `backend/engine/structured-helpers.ts::extractJson` + `structured-helpers.test.ts` |
|
|
41
41
|
| Keep engine/provider/model from drifting apart | `frontend/utils/model-override.ts::modelFieldsOf` (spread it when persisting a generator override) |
|
|
42
42
|
| Reasoning-effort levels a model offers | `EngineModel.capabilities.reasoningControl` built in `<engine>/models.ts` via `toReasoningOptions` (`shared/constants/engines.ts`); §2.4a |
|
|
43
|
-
| Apply the chosen reasoning level to the SDK | `claude/stream.ts` (`thinking` + `effort`), `codex/stream.ts` (`modelReasoningEffort`), `copilot/stream.ts` (`reasoningEffort`), `pi/stream.ts` (`thinkingLevel` + `clampThinkingLevel`), `cursor/stream.ts::buildCursorModelSelection` (`params[]`); §10.22 |
|
|
43
|
+
| Apply the chosen reasoning level to the SDK | `claude/stream.ts` (`thinking` + `effort`), `codex/stream.ts` (`modelReasoningEffort`), `copilot/stream.ts` (`reasoningEffort`), `pi/stream.ts` (`thinkingLevel` + `clampThinkingLevel`), `cursor/stream.ts::buildCursorModelSelection` (`params[]`), `qwen/stream.ts` (`effort`); §10.22 |
|
|
44
44
|
| Per-session reasoning persistence + collab sync | `chat_sessions.reasoning_effort` (migration `065`), `sessionQueries.updateReasoning`, `chat:reasoning-sync` in `backend/ws/chat/stream.ts` |
|
|
45
45
|
| Switch engine mid-session (carry the conversation) | `backend/chat/engine-handoff.ts::buildEngineHandoff` + `resolveBranchEngine`, wired in `backend/chat/stream-manager.ts` (suppress `resume`, prepend to the engine prompt only); frontend-and-chat §6.2a |
|
|
46
46
|
| Is this SDK session id mine? (engine-aware resume) | `resolveBranchEngine` (backend, authoritative) + the `engine.type` guard in `frontend/services/chat/chat.service.ts`; also `backend/ws/snapshot/restore.ts` when restoring into another engine's region |
|