opencode-qoder-bridge 0.1.3 → 0.1.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/CHANGELOG.md +79 -0
- package/README.md +19 -0
- package/RELEASING.md +11 -2
- package/bin/statusline.mjs +10 -1
- package/dist/cost.d.ts.map +1 -1
- package/dist/cost.js +77 -32
- package/dist/cost.js.map +1 -1
- package/dist/errors.d.ts +36 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +42 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/language-model.d.ts +28 -1
- package/dist/language-model.d.ts.map +1 -1
- package/dist/language-model.js +31 -9
- package/dist/language-model.js.map +1 -1
- package/dist/logger.d.ts +6 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +20 -0
- package/dist/logger.js.map +1 -0
- package/dist/models.d.ts +7 -0
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js +55 -13
- package/dist/models.js.map +1 -1
- package/dist/prompt-builder.d.ts.map +1 -1
- package/dist/prompt-builder.js +21 -10
- package/dist/prompt-builder.js.map +1 -1
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +3 -2
- package/dist/provider.js.map +1 -1
- package/dist/session-store.d.ts.map +1 -1
- package/dist/session-store.js +20 -9
- package/dist/session-store.js.map +1 -1
- package/dist/state-dir.d.ts +6 -0
- package/dist/state-dir.d.ts.map +1 -0
- package/dist/state-dir.js +14 -0
- package/dist/state-dir.js.map +1 -0
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/usage.d.ts.map +1 -1
- package/dist/usage.js +3 -1
- package/dist/usage.js.map +1 -1
- package/package.json +1 -2
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,82 @@ All notable changes to this project are documented here. The format follows
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and releases use
|
|
5
5
|
[Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [0.1.5] - 2026-08-22
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- Model discovery now requests the live catalog (`fetchStrategy: "live"`).
|
|
12
|
+
The previous `"cache"` strategy could serve an empty or stale subset of the
|
|
13
|
+
account's models, which is why not all available Qoder models were detected.
|
|
14
|
+
The CLI re-queries the server on every refresh and falls back to its local
|
|
15
|
+
cache only when the server returns nothing.
|
|
16
|
+
|
|
17
|
+
### Added
|
|
18
|
+
|
|
19
|
+
- `QODER_SCENE` set in the host environment is forwarded to the catalog
|
|
20
|
+
discovery session, and a new provider option `env` passes arbitrary
|
|
21
|
+
environment variables to the qodercli child process for chat turns.
|
|
22
|
+
- Debug logging for discovery: usable/total entry counts and discovered model
|
|
23
|
+
IDs are emitted under `QODER_BRIDGE_DEBUG=1`.
|
|
24
|
+
- Documentation for model discovery behavior and scene filtering in the
|
|
25
|
+
README troubleshooting section.
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
- Catalog selection drops only disabled or malformed entries; BYOK and
|
|
30
|
+
tagged entries are kept so the bridge never hides a model the server
|
|
31
|
+
actually serves.
|
|
32
|
+
|
|
33
|
+
## [0.1.4] - 2026-08-22
|
|
34
|
+
|
|
35
|
+
### Fixed
|
|
36
|
+
|
|
37
|
+
- Removed an accidental self-dependency (`opencode-qoder-bridge`) from
|
|
38
|
+
`dependencies`, which made npm install a nested copy of the package into
|
|
39
|
+
itself.
|
|
40
|
+
- Provider metadata on stream finish is no longer double-nested; consumers now
|
|
41
|
+
read `providerMetadata.qoder.totalCostUSD`, `contextUsageRatio`, and
|
|
42
|
+
`usageEstimated` at the documented path.
|
|
43
|
+
- `doGenerate` no longer drops tool-call content parts, so non-streaming
|
|
44
|
+
callers receive tool invocations.
|
|
45
|
+
- History trimming in the prompt builder serializes each message once instead
|
|
46
|
+
of re-serializing the whole prompt per dropped turn (O(n²) → O(n)).
|
|
47
|
+
- The usage ledger flushes synchronously on process exit, so the most recent
|
|
48
|
+
turns are no longer lost when opencode shuts down inside the debounce window.
|
|
49
|
+
|
|
50
|
+
### Added
|
|
51
|
+
|
|
52
|
+
- Typed error hierarchy exported from `dist/errors.js`: `QoderBridgeError`
|
|
53
|
+
base with a stable `code`, plus `QoderCliNotFoundError`,
|
|
54
|
+
`QoderAuthError`, `QoderSessionError`, `QoderSdkResultError`, and
|
|
55
|
+
`UnsupportedCapabilityError`.
|
|
56
|
+
- Opt-in debug logging via `QODER_BRIDGE_DEBUG=1` covering model fallbacks,
|
|
57
|
+
stream aborts, background catalog refreshes, and ledger/session-store I/O
|
|
58
|
+
failures that were previously swallowed silently.
|
|
59
|
+
- Authorization failures now explain what is missing (CLI vs personal access
|
|
60
|
+
token) instead of returning an unlabeled failure.
|
|
61
|
+
- `QODER_BRIDGE_STATE_DIR` and `XDG_CONFIG_HOME` are now honored consistently
|
|
62
|
+
by every state file, including `usage.json`, `sessions.json`,
|
|
63
|
+
`models.json`, and the statusline binary (previously only the session store).
|
|
64
|
+
- Diagnostics section in the README.
|
|
65
|
+
|
|
66
|
+
### Changed
|
|
67
|
+
|
|
68
|
+
- Model catalog fetches de-duplicate concurrent refreshes into a single SDK
|
|
69
|
+
session.
|
|
70
|
+
- The `models.json` cache is written atomically with mode 0600 instead of a
|
|
71
|
+
direct partial-write-prone write.
|
|
72
|
+
- Unknown model IDs fall back to the default model with a debug log entry.
|
|
73
|
+
|
|
74
|
+
## [0.1.3] - 2026-08-20
|
|
75
|
+
|
|
76
|
+
### Changed
|
|
77
|
+
|
|
78
|
+
- Refreshed the fallback model catalog and quota reporting behavior.
|
|
79
|
+
- Removed the experimental model-backed quota command; account usage remains
|
|
80
|
+
available through the `qoder_usage` tool.
|
|
81
|
+
- Documentation updates for models and quota handling.
|
|
82
|
+
|
|
7
83
|
## [0.1.2] - 2026-08-20
|
|
8
84
|
|
|
9
85
|
### Security
|
|
@@ -66,3 +142,6 @@ also verified with an in-process MCP transport.
|
|
|
66
142
|
[0.1.1]: https://github.com/naoufalelbani/opencode-qoder-bridge/compare/v0.1.0...v0.1.1
|
|
67
143
|
[0.1.0]: https://github.com/naoufalelbani/opencode-qoder-bridge/releases/tag/v0.1.0
|
|
68
144
|
[0.1.2]: https://github.com/naoufalelbani/opencode-qoder-bridge/compare/v0.1.1...v0.1.2
|
|
145
|
+
[0.1.3]: https://github.com/naoufalelbani/opencode-qoder-bridge/compare/v0.1.2...v0.1.3
|
|
146
|
+
[0.1.4]: https://github.com/naoufalelbani/opencode-qoder-bridge/compare/v0.1.3...v0.1.4
|
|
147
|
+
[0.1.5]: https://github.com/naoufalelbani/opencode-qoder-bridge/compare/v0.1.4...v0.1.5
|
package/README.md
CHANGED
|
@@ -225,6 +225,15 @@ host environment is trusted.
|
|
|
225
225
|
| Auth prompt at startup | Run `qoder login`, then restart opencode |
|
|
226
226
|
| `qodercli not found` | Install the Qoder CLI; ensure `qodercli` is on PATH or under `~/.qoder/` |
|
|
227
227
|
| Model not found | Verify the model ID matches the table above |
|
|
228
|
+
| Missing models in the model list | Run `/qoder_models`; the bridge refreshes the live catalog at every startup and falls back to the last cached catalog plus the built-ins (`lite`, `auto`, `performance`) when offline. If your account serves models in a different Qoder scene, set `QODER_SCENE` before launching opencode (or via provider option `env`) |
|
|
229
|
+
|
|
230
|
+
### How model discovery works
|
|
231
|
+
|
|
232
|
+
At startup the bridge immediately exposes cached/built-in models, then
|
|
233
|
+
refreshes the live catalog from Qoder (`fetchStrategy: "live"` — the CLI
|
|
234
|
+
re-queries the server and falls back to its local cache if the server returns
|
|
235
|
+
nothing). Discovered models override built-ins with the same ID; a failed
|
|
236
|
+
refresh never removes previously known models.
|
|
228
237
|
|
|
229
238
|
## Development
|
|
230
239
|
|
|
@@ -237,6 +246,16 @@ npm run test:e2e # authenticated real-CLI test; requires QODER_E2E=1
|
|
|
237
246
|
npm run check # full pre-publish verification
|
|
238
247
|
```
|
|
239
248
|
|
|
249
|
+
### Diagnostics
|
|
250
|
+
|
|
251
|
+
Set `QODER_BRIDGE_DEBUG=1` before launching opencode to emit detailed bridge
|
|
252
|
+
logs (model fallbacks, stream aborts, background catalog refreshes, ledger and
|
|
253
|
+
session-store I/O failures). Warnings that need attention are always printed.
|
|
254
|
+
|
|
255
|
+
State files (usage ledger, session mapping, model cache) live under
|
|
256
|
+
`~/.config/opencode-qoder-bridge` by default; override with
|
|
257
|
+
`QODER_BRIDGE_STATE_DIR`, or relocate via `XDG_CONFIG_HOME`.
|
|
258
|
+
|
|
240
259
|
The end-to-end test is intentionally opt-in because it starts Qoder and may
|
|
241
260
|
consume account quota. Run it only after `qoder login`:
|
|
242
261
|
|
package/RELEASING.md
CHANGED
|
@@ -19,10 +19,18 @@ Run the complete release gate from a clean checkout:
|
|
|
19
19
|
```bash
|
|
20
20
|
npm ci
|
|
21
21
|
npm run check
|
|
22
|
+
QODER_E2E=1 npm run test:e2e # requires qoder login; consumes quota
|
|
22
23
|
npm pack --dry-run
|
|
23
24
|
npm publish
|
|
24
25
|
```
|
|
25
26
|
|
|
27
|
+
The end-to-end gate is mandatory for any release that touches
|
|
28
|
+
`src/language-model.ts`, `src/models.ts`, or `src/usage.ts`: unit tests mock
|
|
29
|
+
the SDK, so only `QODER_E2E=1` exercises real streaming, tool calls, provider
|
|
30
|
+
metadata, and live model discovery. Verify before publishing that the dry-run
|
|
31
|
+
tarball contains `dist/` (including `errors.js`, `logger.js`,
|
|
32
|
+
`state-dir.js`) and both `bin/` scripts, and nothing else unexpected.
|
|
33
|
+
|
|
26
34
|
Verify the registry package and install it through OpenCode:
|
|
27
35
|
|
|
28
36
|
```bash
|
|
@@ -51,8 +59,9 @@ After the package exists on npm:
|
|
|
51
59
|
|
|
52
60
|
## Subsequent releases
|
|
53
61
|
|
|
54
|
-
Update `version` using semantic versioning,
|
|
55
|
-
change, and push a matching
|
|
62
|
+
Update `version` using semantic versioning, document the release in
|
|
63
|
+
`CHANGELOG.md`, run the release gate, commit the change, and push a matching
|
|
64
|
+
tag:
|
|
56
65
|
|
|
57
66
|
```bash
|
|
58
67
|
npm version patch
|
package/bin/statusline.mjs
CHANGED
|
@@ -3,7 +3,16 @@ import { readFileSync } from "node:fs";
|
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
// Mirrors resolveStateDir() from src/state-dir.ts:
|
|
7
|
+
// QODER_BRIDGE_STATE_DIR > XDG_CONFIG_HOME > ~/.config.
|
|
8
|
+
function resolveStateDir(env = process.env) {
|
|
9
|
+
const override = env.QODER_BRIDGE_STATE_DIR?.trim();
|
|
10
|
+
if (override) return join(override);
|
|
11
|
+
const configHome = env.XDG_CONFIG_HOME?.trim();
|
|
12
|
+
return join(configHome || join(homedir(), ".config"), "opencode-qoder-bridge");
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const STATE_FILE = join(resolveStateDir(), "usage.json");
|
|
7
16
|
|
|
8
17
|
function fmt(usd) {
|
|
9
18
|
return `$${(usd ?? 0).toFixed(4)}`;
|
package/dist/cost.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cost.d.ts","sourceRoot":"","sources":["../src/cost.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cost.d.ts","sourceRoot":"","sources":["../src/cost.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAS5D,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MA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wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE9C"}
|
package/dist/cost.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { chmodSync, closeSync, fsyncSync, lstatSync, mkdirSync, openSync, readFileSync, renameSync, unlinkSync, writeFileSync, } from "node:fs";
|
|
2
2
|
import { randomUUID } from "node:crypto";
|
|
3
|
-
import { homedir } from "node:os";
|
|
4
3
|
import { join } from "node:path";
|
|
5
|
-
|
|
4
|
+
import { resolveStateDir } from "./state-dir.js";
|
|
5
|
+
import { debug, describeError } from "./logger.js";
|
|
6
|
+
const STATE_DIR = resolveStateDir();
|
|
6
7
|
const STATE_FILE = join(STATE_DIR, "usage.json");
|
|
7
8
|
const MAX_STATE_BYTES = 1_000_000;
|
|
8
9
|
const UNSAFE_KEYS = new Set(["__proto__", "prototype", "constructor"]);
|
|
@@ -14,6 +15,7 @@ function load() {
|
|
|
14
15
|
try {
|
|
15
16
|
const info = lstatSync(STATE_FILE);
|
|
16
17
|
if (!info.isFile() || info.isSymbolicLink() || info.size > MAX_STATE_BYTES) {
|
|
18
|
+
debug("Cost ledger reset (missing, symlinked, or oversized state file)");
|
|
17
19
|
return emptyState();
|
|
18
20
|
}
|
|
19
21
|
try {
|
|
@@ -23,7 +25,10 @@ function load() {
|
|
|
23
25
|
const raw = readFileSync(STATE_FILE, "utf8");
|
|
24
26
|
return sanitizeState(JSON.parse(raw));
|
|
25
27
|
}
|
|
26
|
-
catch {
|
|
28
|
+
catch (error) {
|
|
29
|
+
const code = error?.code;
|
|
30
|
+
if (code !== "ENOENT")
|
|
31
|
+
debug("Cost ledger unreadable; starting empty:", describeError(error));
|
|
27
32
|
return emptyState();
|
|
28
33
|
}
|
|
29
34
|
}
|
|
@@ -78,46 +83,86 @@ function sanitizeState(value) {
|
|
|
78
83
|
}
|
|
79
84
|
let state = null;
|
|
80
85
|
let writeTimer = null;
|
|
86
|
+
let dirty = false;
|
|
87
|
+
let exitHookInstalled = false;
|
|
81
88
|
function current() {
|
|
82
89
|
state ??= load();
|
|
83
90
|
return state;
|
|
84
91
|
}
|
|
85
|
-
function
|
|
86
|
-
|
|
92
|
+
function writeStateFile() {
|
|
93
|
+
let temporary;
|
|
94
|
+
let fd;
|
|
95
|
+
try {
|
|
96
|
+
mkdirSync(STATE_DIR, { recursive: true, mode: 0o700 });
|
|
97
|
+
chmodSync(STATE_DIR, 0o700);
|
|
98
|
+
temporary = join(STATE_DIR, `.usage.${process.pid}.${randomUUID()}.tmp`);
|
|
99
|
+
fd = openSync(temporary, "wx", 0o600);
|
|
100
|
+
writeFileSync(fd, JSON.stringify(current(), null, 2), "utf8");
|
|
101
|
+
fsyncSync(fd);
|
|
102
|
+
closeSync(fd);
|
|
103
|
+
fd = undefined;
|
|
104
|
+
renameSync(temporary, STATE_FILE);
|
|
105
|
+
temporary = undefined;
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
debug("Cost ledger persist failed:", describeError(error));
|
|
109
|
+
}
|
|
110
|
+
finally {
|
|
111
|
+
if (fd !== undefined) {
|
|
112
|
+
try {
|
|
113
|
+
closeSync(fd);
|
|
114
|
+
}
|
|
115
|
+
catch { /* best-effort */ }
|
|
116
|
+
}
|
|
117
|
+
if (temporary) {
|
|
118
|
+
try {
|
|
119
|
+
unlinkSync(temporary);
|
|
120
|
+
}
|
|
121
|
+
catch { /* best-effort */ }
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* The debounced timer is unref'd, so a fast-exiting host process would drop
|
|
127
|
+
* the most recent turns. A synchronous flush on "exit" closes that gap.
|
|
128
|
+
*/
|
|
129
|
+
function installExitFlush() {
|
|
130
|
+
if (exitHookInstalled)
|
|
87
131
|
return;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
132
|
+
exitHookInstalled = true;
|
|
133
|
+
process.on("exit", () => {
|
|
134
|
+
if (!dirty)
|
|
135
|
+
return;
|
|
136
|
+
dirty = false;
|
|
92
137
|
try {
|
|
93
138
|
mkdirSync(STATE_DIR, { recursive: true, mode: 0o700 });
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
139
|
+
const temporary = join(STATE_DIR, `.usage.${process.pid}.${randomUUID()}.exit.tmp`);
|
|
140
|
+
const fd = openSync(temporary, "wx", 0o600);
|
|
141
|
+
try {
|
|
142
|
+
writeFileSync(fd, JSON.stringify(current(), null, 2), "utf8");
|
|
143
|
+
fsyncSync(fd);
|
|
144
|
+
}
|
|
145
|
+
finally {
|
|
146
|
+
closeSync(fd);
|
|
147
|
+
}
|
|
101
148
|
renameSync(temporary, STATE_FILE);
|
|
102
|
-
temporary = undefined;
|
|
103
149
|
}
|
|
104
150
|
catch {
|
|
105
|
-
/*
|
|
106
|
-
}
|
|
107
|
-
finally {
|
|
108
|
-
if (fd !== undefined) {
|
|
109
|
-
try {
|
|
110
|
-
closeSync(fd);
|
|
111
|
-
}
|
|
112
|
-
catch { /* best-effort */ }
|
|
113
|
-
}
|
|
114
|
-
if (temporary) {
|
|
115
|
-
try {
|
|
116
|
-
unlinkSync(temporary);
|
|
117
|
-
}
|
|
118
|
-
catch { /* best-effort */ }
|
|
119
|
-
}
|
|
151
|
+
/* nothing left to do during exit */
|
|
120
152
|
}
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
function persist() {
|
|
156
|
+
dirty = true;
|
|
157
|
+
installExitFlush();
|
|
158
|
+
if (writeTimer)
|
|
159
|
+
return;
|
|
160
|
+
writeTimer = setTimeout(() => {
|
|
161
|
+
writeTimer = null;
|
|
162
|
+
if (!dirty)
|
|
163
|
+
return;
|
|
164
|
+
dirty = false;
|
|
165
|
+
writeStateFile();
|
|
121
166
|
}, 250);
|
|
122
167
|
if (typeof writeTimer.unref === "function")
|
|
123
168
|
writeTimer.unref();
|
package/dist/cost.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cost.js","sourceRoot":"","sources":["../src/cost.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,UAAU,EACV,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"cost.js","sourceRoot":"","sources":["../src/cost.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,UAAU,EACV,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEnD,MAAM,SAAS,GAAG,eAAe,EAAE,CAAC;AACpC,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;AACjD,MAAM,eAAe,GAAG,SAAS,CAAC;AAClC,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC;AAuBvE,MAAM,YAAY,GAAG,EAAE,CAAC;AAExB,SAAS,UAAU;IACjB,OAAO,EAAE,YAAY,EAAE,CAAC,EAAE,gBAAgB,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;AAC/G,CAAC;AAED,SAAS,IAAI;IACX,IAAI,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,MAAM,CAAC,YAAY,IAAI,KAAK,CAAC,YAAY,CAAC;IAC1C,MAAM,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC;IAE5B,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrB,IAAI,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,YAAY;QAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,YAAY,CAAC,CAAC;IAEvF,OAAO,EAAE,CAAC;IACV,OAAO,KAAK,CAAC;AACf,CAAC;AAWD,MAAM,UAAU,SAAS;IACvB,MAAM,CAAC,GAAG,OAAO,EAAE,CAAC;IACpB,OAAO;QACL,YAAY,EAAE,CAAC,CAAC,YAAY;QAC5B,gBAAgB,EAAE,CAAC,CAAC,gBAAgB;QACpC,iBAAiB,EAAE,CAAC,CAAC,iBAAiB;QACtC,SAAS,EAAE,CAAC,CAAC,SAAS;QACtB,OAAO,EAAE,CAAC,CAAC,OAAO;QAClB,MAAM,EAAE,CAAC,CAAC,MAAM;KACjB,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,WAAW;IACzB,KAAK,GAAG,UAAU,EAAE,CAAC;IACrB,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;AAC9B,CAAC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export type QoderBridgeErrorCode = "QODER_CLI_NOT_FOUND" | "QODER_AUTH_FAILED" | "QODER_SESSION_INVALID_KEY" | "QODER_SDK_RESULT_ERROR" | "QODER_UNSUPPORTED_CAPABILITY";
|
|
2
|
+
/**
|
|
3
|
+
* Base class for all errors raised by the bridge. Carries a stable `code`
|
|
4
|
+
* so callers and tests can branch on failure mode without parsing messages.
|
|
5
|
+
*/
|
|
6
|
+
export declare class QoderBridgeError extends Error {
|
|
7
|
+
readonly code: QoderBridgeErrorCode;
|
|
8
|
+
constructor(code: QoderBridgeErrorCode, message: string, options?: {
|
|
9
|
+
cause?: unknown;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export declare class QoderCliNotFoundError extends QoderBridgeError {
|
|
13
|
+
constructor(message?: string, options?: {
|
|
14
|
+
cause?: unknown;
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
export declare class QoderAuthError extends QoderBridgeError {
|
|
18
|
+
constructor(message: string, options?: {
|
|
19
|
+
cause?: unknown;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
export declare class QoderSessionError extends QoderBridgeError {
|
|
23
|
+
constructor(message: string, options?: {
|
|
24
|
+
cause?: unknown;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export declare class QoderSdkResultError extends QoderBridgeError {
|
|
28
|
+
readonly subtype: string;
|
|
29
|
+
constructor(subtype: string, detail?: string, options?: {
|
|
30
|
+
cause?: unknown;
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
export declare class UnsupportedCapabilityError extends QoderBridgeError {
|
|
34
|
+
constructor(capability: string);
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAC5B,qBAAqB,GACrB,mBAAmB,GACnB,2BAA2B,GAC3B,wBAAwB,GACxB,8BAA8B,CAAC;AAEnC;;;GAGG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;IACzC,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC;gBAExB,IAAI,EAAE,oBAAoB,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAMvF;AAED,qBAAa,qBAAsB,SAAQ,gBAAgB;gBAC7C,OAAO,SAA4E,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAG/H;AAED,qBAAa,cAAe,SAAQ,gBAAgB;gBACtC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAG3D;AAED,qBAAa,iBAAkB,SAAQ,gBAAgB;gBACzC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAG3D;AAED,qBAAa,mBAAoB,SAAQ,gBAAgB;IACvD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;gBAEb,OAAO,EAAE,MAAM,EAAE,MAAM,SAAK,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAIxE;AAED,qBAAa,0BAA2B,SAAQ,gBAAgB;gBAClD,UAAU,EAAE,MAAM;CAG/B"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base class for all errors raised by the bridge. Carries a stable `code`
|
|
3
|
+
* so callers and tests can branch on failure mode without parsing messages.
|
|
4
|
+
*/
|
|
5
|
+
export class QoderBridgeError extends Error {
|
|
6
|
+
code;
|
|
7
|
+
constructor(code, message, options) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.name = new.target.name;
|
|
10
|
+
this.code = code;
|
|
11
|
+
if (options?.cause !== undefined)
|
|
12
|
+
this.cause = options.cause;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export class QoderCliNotFoundError extends QoderBridgeError {
|
|
16
|
+
constructor(message = "qodercli not found. Install Qoder CLI first: https://docs.qoder.com/cli", options) {
|
|
17
|
+
super("QODER_CLI_NOT_FOUND", message, options);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export class QoderAuthError extends QoderBridgeError {
|
|
21
|
+
constructor(message, options) {
|
|
22
|
+
super("QODER_AUTH_FAILED", message, options);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export class QoderSessionError extends QoderBridgeError {
|
|
26
|
+
constructor(message, options) {
|
|
27
|
+
super("QODER_SESSION_INVALID_KEY", message, options);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export class QoderSdkResultError extends QoderBridgeError {
|
|
31
|
+
subtype;
|
|
32
|
+
constructor(subtype, detail = "", options) {
|
|
33
|
+
super("QODER_SDK_RESULT_ERROR", `Qoder SDK: ${subtype}${detail ? ` | ${detail}` : ""}`, options);
|
|
34
|
+
this.subtype = subtype;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export class UnsupportedCapabilityError extends QoderBridgeError {
|
|
38
|
+
constructor(capability) {
|
|
39
|
+
super("QODER_UNSUPPORTED_CAPABILITY", `Qoder provider does not support ${capability}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAOA;;;GAGG;AACH,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAChC,IAAI,CAAuB;IAEpC,YAAY,IAA0B,EAAE,OAAe,EAAE,OAA6B;QACpF,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,OAAO,EAAE,KAAK,KAAK,SAAS;YAAE,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAC/D,CAAC;CACF;AAED,MAAM,OAAO,qBAAsB,SAAQ,gBAAgB;IACzD,YAAY,OAAO,GAAG,yEAAyE,EAAE,OAA6B;QAC5H,KAAK,CAAC,qBAAqB,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;CACF;AAED,MAAM,OAAO,cAAe,SAAQ,gBAAgB;IAClD,YAAY,OAAe,EAAE,OAA6B;QACxD,KAAK,CAAC,mBAAmB,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC/C,CAAC;CACF;AAED,MAAM,OAAO,iBAAkB,SAAQ,gBAAgB;IACrD,YAAY,OAAe,EAAE,OAA6B;QACxD,KAAK,CAAC,2BAA2B,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;CACF;AAED,MAAM,OAAO,mBAAoB,SAAQ,gBAAgB;IAC9C,OAAO,CAAS;IAEzB,YAAY,OAAe,EAAE,MAAM,GAAG,EAAE,EAAE,OAA6B;QACrE,KAAK,CAAC,wBAAwB,EAAE,cAAc,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;QACjG,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAED,MAAM,OAAO,0BAA2B,SAAQ,gBAAgB;IAC9D,YAAY,UAAkB;QAC5B,KAAK,CAAC,8BAA8B,EAAE,mCAAmC,UAAU,EAAE,CAAC,CAAC;IACzF,CAAC;CACF"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,MAAM,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAkDjE,QAAA,MAAM,MAAM,EAAE,MA6Ib,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { getLiveUsage, formatUsageReport } from "./usage.js";
|
|
|
6
6
|
import { summarize, formatCost } from "./cost.js";
|
|
7
7
|
import { ensureTuiRegistered } from "./tui-register.js";
|
|
8
8
|
import { deleteQoderSession } from "./session-store.js";
|
|
9
|
+
import { debug, describeError, isDebugEnabled, warn } from "./logger.js";
|
|
9
10
|
const PROVIDER_URL = new URL("./provider.js", import.meta.url).href;
|
|
10
11
|
const UNSAFE_KEYS = new Set(["__proto__", "prototype", "constructor"]);
|
|
11
12
|
let configuredSessionKey;
|
|
@@ -43,6 +44,8 @@ function buildDynamicEntry(m) {
|
|
|
43
44
|
}
|
|
44
45
|
const plugin = async (input) => {
|
|
45
46
|
if (input) {
|
|
47
|
+
if (isDebugEnabled())
|
|
48
|
+
debug("Plugin initializing");
|
|
46
49
|
try {
|
|
47
50
|
const result = await ensureTuiRegistered();
|
|
48
51
|
if (result === "added") {
|
|
@@ -50,7 +53,7 @@ const plugin = async (input) => {
|
|
|
50
53
|
}
|
|
51
54
|
}
|
|
52
55
|
catch (error) {
|
|
53
|
-
|
|
56
|
+
warn("Could not register Qoder sidebar:", error);
|
|
54
57
|
}
|
|
55
58
|
}
|
|
56
59
|
return {
|
|
@@ -73,7 +76,9 @@ const plugin = async (input) => {
|
|
|
73
76
|
if (!UNSAFE_KEYS.has(m.id) && !builtinModels[m.id])
|
|
74
77
|
builtinModels[m.id] = buildFallbackEntry(m);
|
|
75
78
|
}
|
|
76
|
-
void fetchDynamicModels(true).catch(() => {
|
|
79
|
+
void fetchDynamicModels(true).catch((error) => {
|
|
80
|
+
debug("Background model refresh failed:", describeError(error));
|
|
81
|
+
});
|
|
77
82
|
const mergedModels = { ...builtinModels, ...(existing.models ?? {}) };
|
|
78
83
|
const bridgedMcp = bridgeMcpServers(config.mcp);
|
|
79
84
|
const mergedOptions = { ...(existing.options ?? {}) };
|
|
@@ -104,11 +109,13 @@ const plugin = async (input) => {
|
|
|
104
109
|
prompts: [],
|
|
105
110
|
async authorize() {
|
|
106
111
|
if (!findQoderCLI() && !hasQoderPAT()) {
|
|
112
|
+
warn("Authorize failed: qodercli not found on PATH and no", `${QODER_PAT_ENV} is set. Install the CLI (https://docs.qoder.com/cli)`, "or export a personal access token, then retry.");
|
|
107
113
|
return { type: "failed" };
|
|
108
114
|
}
|
|
109
115
|
if (hasQoderCredential()) {
|
|
110
116
|
return { type: "success", key: "qoder-cli-auth" };
|
|
111
117
|
}
|
|
118
|
+
warn("Authorize failed: no usable Qoder credential found.");
|
|
112
119
|
return { type: "failed" };
|
|
113
120
|
},
|
|
114
121
|
},
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEtG,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEtG,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,kBAA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elV3StreamResult } from "@ai-sdk/provider";
|
|
1
|
+
import type { LanguageModelV3, LanguageModelV3CallOptions, LanguageModelV3GenerateResult, LanguageModelV3StreamPart, LanguageModelV3StreamResult } from "@ai-sdk/provider";
|
|
2
2
|
import type { QoderBridgeOptions } from "./types.js";
|
|
3
|
+
type StreamController = ReadableStreamDefaultController<LanguageModelV3StreamPart>;
|
|
4
|
+
interface StreamState {
|
|
5
|
+
controller: StreamController;
|
|
6
|
+
contextWindow: number;
|
|
7
|
+
functionToolNames: Set<string>;
|
|
8
|
+
activeText: Set<number>;
|
|
9
|
+
activeReasoning: Set<number>;
|
|
10
|
+
toolBlocks: Map<number, {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
input: string;
|
|
14
|
+
providerExecuted: boolean;
|
|
15
|
+
}>;
|
|
16
|
+
sawStreamText: boolean;
|
|
17
|
+
sawStreamTool: boolean;
|
|
18
|
+
sawStreamReasoning: boolean;
|
|
19
|
+
emittedToolCall: boolean;
|
|
20
|
+
pendingToolCalls: Map<string, {
|
|
21
|
+
name: string;
|
|
22
|
+
providerExecuted: boolean;
|
|
23
|
+
}>;
|
|
24
|
+
lastStopReason: string | null;
|
|
25
|
+
blockCounter: number;
|
|
26
|
+
finished: boolean;
|
|
27
|
+
}
|
|
3
28
|
export declare function isProviderExecutedTool(name: string, functionToolNames: ReadonlySet<string>): boolean;
|
|
4
29
|
export declare class QoderLanguageModel implements LanguageModelV3 {
|
|
5
30
|
readonly specificationVersion: "v3";
|
|
@@ -12,4 +37,6 @@ export declare class QoderLanguageModel implements LanguageModelV3 {
|
|
|
12
37
|
doStream(options: LanguageModelV3CallOptions): Promise<LanguageModelV3StreamResult>;
|
|
13
38
|
private buildQueryOptions;
|
|
14
39
|
}
|
|
40
|
+
export declare function handleSdkMessage(m: Record<string, unknown>, state: StreamState): void;
|
|
41
|
+
export {};
|
|
15
42
|
//# sourceMappingURL=language-model.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"language-model.d.ts","sourceRoot":"","sources":["../src/language-model.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EACf,0BAA0B,EAG1B,6BAA6B,
|
|
1
|
+
{"version":3,"file":"language-model.d.ts","sourceRoot":"","sources":["../src/language-model.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EACf,0BAA0B,EAG1B,6BAA6B,EAC7B,yBAAyB,EACzB,2BAA2B,EAE5B,MAAM,kBAAkB,CAAC;AAQ1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAMrD,KAAK,gBAAgB,GAAG,+BAA+B,CAAC,yBAAyB,CAAC,CAAC;AAyCnF,UAAU,WAAW;IACnB,UAAU,EAAE,gBAAgB,CAAC;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,iBAAiB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC/B,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACxB,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,gBAAgB,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAChG,aAAa,EAAE,OAAO,CAAC;IACvB,aAAa,EAAE,OAAO,CAAC;IACvB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,eAAe,EAAE,OAAO,CAAC;IACzB,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,gBAAgB,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAC3E,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,wBAAgB,sB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