@orcareplay/adapters 0.1.1 → 0.2.0

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,40 @@
1
+ /**
2
+ * What OpenCode's own configuration says about a provider's base URL.
3
+ *
4
+ * The adapter redirects OpenCode's first-party providers through the proxy by writing a
5
+ * `provider.<id>.options.baseURL` override, and OpenCode merges config sources in an order that
6
+ * puts that override last — over a base URL the user configured for the same provider. Overriding
7
+ * someone's deliberate routing would make the recorded run talk to a host they never named, which
8
+ * is the one capture bug worse than an empty trace. So the adapter reads the same files OpenCode
9
+ * reads and carries the configured base URL *through* the redirect instead of replacing it.
10
+ *
11
+ * The files are JSONC — comments and trailing commas are allowed and the user's own config uses
12
+ * both — so a small stripper runs before `JSON.parse`. A file that still will not parse marks the
13
+ * whole scan untrusted: without knowing what the user intended, the adapter must not touch their
14
+ * routing at all, and the run degrades to the pre-override behaviour (uncaptured, with the
15
+ * end-of-run warning saying so) rather than to a captured run aimed at the wrong origin.
16
+ */
17
+ export interface OpenCodeConfigScan {
18
+ /** Provider id → the `options.baseURL` the user configured, when they configured one. */
19
+ overrides: Map<string, string>;
20
+ /** False when a config file existed but could not be parsed, so no override can be trusted. */
21
+ trusted: boolean;
22
+ }
23
+ /**
24
+ * Strip what JSONC allows and JSON does not: comments and trailing commas.
25
+ *
26
+ * Strings are copied verbatim with their escapes, because a config comment is prose that may
27
+ * contain `//` — a URL, say — and stripping inside a string would corrupt the value while the
28
+ * file still parsed. Trailing commas are removed only when the next significant character closes
29
+ * a value, which a comma inside a string never is.
30
+ */
31
+ export declare function stripJsonc(text: string): string;
32
+ /**
33
+ * Read the base URLs the user's OpenCode configuration sets per provider.
34
+ *
35
+ * A missing file is not a failure — most of these do not exist. A file that exists and will not
36
+ * parse is: the adapter then knows less than it must to rewrite routing safely, and reports that
37
+ * by clearing `trusted`.
38
+ */
39
+ export declare function openCodeConfiguredBaseURLs(env: Record<string, string | undefined>, cwd: string): Promise<OpenCodeConfigScan>;
40
+ //# sourceMappingURL=opencode-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opencode-config.d.ts","sourceRoot":"","sources":["../src/opencode-config.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,kBAAkB;IACjC,yFAAyF;IACzF,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,+FAA+F;IAC/F,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAyB/C;AAoHD;;;;;;GAMG;AACH,wBAAsB,0BAA0B,CAC9C,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EACvC,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,kBAAkB,CAAC,CAqB7B"}
@@ -0,0 +1,185 @@
1
+ import { readFile, stat } from 'node:fs/promises';
2
+ import { homedir } from 'node:os';
3
+ import { join } from 'node:path';
4
+ /**
5
+ * Strip what JSONC allows and JSON does not: comments and trailing commas.
6
+ *
7
+ * Strings are copied verbatim with their escapes, because a config comment is prose that may
8
+ * contain `//` — a URL, say — and stripping inside a string would corrupt the value while the
9
+ * file still parsed. Trailing commas are removed only when the next significant character closes
10
+ * a value, which a comma inside a string never is.
11
+ */
12
+ export function stripJsonc(text) {
13
+ let out = '';
14
+ let i = 0;
15
+ while (i < text.length) {
16
+ const ch = text[i];
17
+ if (ch === '"') {
18
+ const end = stringEnd(text, i);
19
+ out += text.slice(i, end);
20
+ i = end;
21
+ continue;
22
+ }
23
+ if (ch === '/' && text[i + 1] === '/') {
24
+ while (i < text.length && text[i] !== '\n')
25
+ i += 1;
26
+ continue;
27
+ }
28
+ if (ch === '/' && text[i + 1] === '*') {
29
+ const end = text.indexOf('*/', i + 2);
30
+ i = end === -1 ? text.length : end + 2;
31
+ out += ' ';
32
+ continue;
33
+ }
34
+ out += ch;
35
+ i += 1;
36
+ }
37
+ return stripTrailingCommas(out);
38
+ }
39
+ /** Index just past the closing quote of the string starting at `start`, or end of input. */
40
+ function stringEnd(text, start) {
41
+ let i = start + 1;
42
+ while (i < text.length) {
43
+ const ch = text[i];
44
+ if (ch === '\\') {
45
+ i += 2;
46
+ continue;
47
+ }
48
+ if (ch === '"')
49
+ return i + 1;
50
+ i += 1;
51
+ }
52
+ return text.length;
53
+ }
54
+ function stripTrailingCommas(text) {
55
+ let out = '';
56
+ let i = 0;
57
+ while (i < text.length) {
58
+ const ch = text[i];
59
+ if (ch === '"') {
60
+ const end = stringEnd(text, i);
61
+ out += text.slice(i, end);
62
+ i = end;
63
+ continue;
64
+ }
65
+ if (ch === ',') {
66
+ let look = i + 1;
67
+ while (look < text.length && /\s/.test(text[look]))
68
+ look += 1;
69
+ const next = text[look];
70
+ if (next === '}' || next === ']') {
71
+ i += 1;
72
+ continue;
73
+ }
74
+ }
75
+ out += ch;
76
+ i += 1;
77
+ }
78
+ return out;
79
+ }
80
+ /** Every `provider.<id>.options.baseURL` in one parsed config. */
81
+ function providerBaseURLs(config) {
82
+ const out = new Map();
83
+ if (config === null || typeof config !== 'object' || Array.isArray(config))
84
+ return out;
85
+ const provider = config['provider'];
86
+ if (provider === null || typeof provider !== 'object' || Array.isArray(provider))
87
+ return out;
88
+ for (const [id, entry] of Object.entries(provider)) {
89
+ if (entry === null || typeof entry !== 'object' || Array.isArray(entry))
90
+ continue;
91
+ const options = entry['options'];
92
+ if (options === null || typeof options !== 'object' || Array.isArray(options))
93
+ continue;
94
+ const baseURL = options['baseURL'];
95
+ if (typeof baseURL === 'string' && baseURL.trim() !== '')
96
+ out.set(id, baseURL.trim());
97
+ }
98
+ return out;
99
+ }
100
+ /**
101
+ * The config files OpenCode reads that could set a provider base URL.
102
+ *
103
+ * Global, then `OPENCODE_CONFIG`, then project-level `.opencode` directories walking up the way
104
+ * OpenCode's own loader walks — bounded at the git root or the home directory, because above
105
+ * those, neither OpenCode nor anyone else looks. Order does not matter here: the scan collects
106
+ * every override it can see, and a later source winning the merge is the same override either way.
107
+ */
108
+ async function openCodeConfigFiles(env, cwd) {
109
+ const files = [];
110
+ const globalDir = readEnvValue(env, 'OPENCODE_CONFIG_DIR') ??
111
+ (readEnvValue(env, 'XDG_CONFIG_HOME') !== undefined
112
+ ? join(readEnvValue(env, 'XDG_CONFIG_HOME'), 'opencode')
113
+ : join(homeOf(env), '.config', 'opencode'));
114
+ for (const file of ['config.json', 'opencode.json', 'opencode.jsonc']) {
115
+ files.push(join(globalDir, file));
116
+ }
117
+ const custom = readEnvValue(env, 'OPENCODE_CONFIG');
118
+ if (custom !== undefined)
119
+ files.push(custom);
120
+ const stop = new Set([homeOf(env)]);
121
+ let at = cwd;
122
+ for (let depth = 0; depth < 64; depth += 1) {
123
+ for (const file of ['opencode.json', 'opencode.jsonc']) {
124
+ files.push(join(at, '.opencode', file));
125
+ }
126
+ if (stop.has(at))
127
+ break;
128
+ if (await isDirectory(join(at, '.git')))
129
+ break;
130
+ const parent = at.slice(0, at.lastIndexOf('/'));
131
+ if (parent === '' || parent === at)
132
+ break;
133
+ at = parent;
134
+ }
135
+ return files;
136
+ }
137
+ function homeOf(env) {
138
+ return readEnvValue(env, 'HOME') ?? homedir();
139
+ }
140
+ function readEnvValue(env, name) {
141
+ const value = env[name];
142
+ return value !== undefined && value !== '' ? value : undefined;
143
+ }
144
+ async function isDirectory(path) {
145
+ try {
146
+ return (await stat(path)).isDirectory();
147
+ }
148
+ catch {
149
+ return false;
150
+ }
151
+ }
152
+ /**
153
+ * Read the base URLs the user's OpenCode configuration sets per provider.
154
+ *
155
+ * A missing file is not a failure — most of these do not exist. A file that exists and will not
156
+ * parse is: the adapter then knows less than it must to rewrite routing safely, and reports that
157
+ * by clearing `trusted`.
158
+ */
159
+ export async function openCodeConfiguredBaseURLs(env, cwd) {
160
+ const overrides = new Map();
161
+ let trusted = true;
162
+ for (const file of await openCodeConfigFiles(env, cwd)) {
163
+ let text;
164
+ try {
165
+ text = await readFile(file, 'utf8');
166
+ }
167
+ catch {
168
+ continue;
169
+ }
170
+ if (text.trim() === '')
171
+ continue;
172
+ let parsed;
173
+ try {
174
+ parsed = JSON.parse(stripJsonc(text));
175
+ }
176
+ catch {
177
+ trusted = false;
178
+ continue;
179
+ }
180
+ for (const [id, url] of providerBaseURLs(parsed))
181
+ overrides.set(id, url);
182
+ }
183
+ return { overrides, trusted };
184
+ }
185
+ //# sourceMappingURL=opencode-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"opencode-config.js","sourceRoot":"","sources":["../src/opencode-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AA0BjC;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;QACvB,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC,CAAE,CAAC;QACpB,IAAI,EAAE,KAAK,GAAG,EAAE,CAAC;YACf,MAAM,GAAG,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;YAC/B,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;YAC1B,CAAC,GAAG,GAAG,CAAC;YACR,SAAS;QACX,CAAC;QACD,IAAI,EAAE,KAAK,GAAG,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;YACtC,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI;g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ACH,OAAO,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IAC1C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,GAAuC,EACvC,GAAW;IAEX,MAAM,SAAS,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC5C,IAAI,OAAO,GAAG,IAAI,CAAC;IACnB,KAAK,MAAM,IAAI,IAAI,MAAM,mBAAmB,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;QACvD,IAAI,IAAY,CAAC;QACjB,IAAI,CAAC;YACH,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACtC,CAAC;QAAC,MAAM,CAAC;YACP,SAAS;QACX,CAAC;QACD,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE;YAAE,SAAS;QACjC,IAAI,MAAe,CAAC;QACpB,IAAI,CAAC;YACH,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;QACxC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,GAAG,KAAK,CAAC;YAChB,SAAS;QACX,CAAC;QACD,KAAK,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC,IAAI,gBAAgB,CAAC,MAAM,CAAC;YAAE,SAAS,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AAChC,CAAC"}
@@ -3,7 +3,9 @@ import type { Adapter } from '@orcareplay/plugin-api';
3
3
  export declare function opencodeHasOwnAuth(): boolean;
4
4
  /**
5
5
  * OpenCode picks its provider per model, so both origins are redirected: whichever protocol the
6
- * chosen model speaks, the traffic lands on the proxy.
6
+ * chosen model speaks, the traffic lands on the proxy. Providers whose origin is neither of the
7
+ * two — OpenCode's own first-party ones, most visibly — are redirected by the config overlay
8
+ * below, because no environment variable can name their origin for them.
7
9
  */
8
10
  export declare const openCodeAdapter: Adapter;
9
11
  //# sourceMappingURL=opencode.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"opencode.d.ts","sourceRoot":"","sources":["../src/opencode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAyB,MAAM,wBAAwB,CAAC;AAY7E,mFAAmF;AACnF,wBAAgB,kBAAkB,IAAI,OAAO,CAE5C;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,OAmC7B,CAAC"}
1
+ {"version":3,"file":"opencode.d.ts","sourceRoot":"","sources":["../src/opencode.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAyB,MAAM,wBAAwB,CAAC;AAe7E,mFAAmF;AACnF,wBAAgB,kBAAkB,IAAI,OAAO,CAE5C;AAmGD;;;;;GAKG;AACH,eAAO,MAAM,eAAe,EAAE,OA4C7B,CAAC"}
package/dist/opencode.js CHANGED
@@ -1,4 +1,8 @@
1
+ import { basename, join } from 'node:path';
2
+ import { forwardBasePath } from '@orcareplay/proxy';
3
+ import { resolveRealBinary } from '@orcareplay/shell-shim';
1
4
  import { detectAgent, homeDirHas } from './detect.js';
5
+ import { openCodeConfiguredBaseURLs } from './opencode-config.js';
2
6
  import { passKey, passThrough, proxyBase, readEnv } from './env.js';
3
7
  /**
4
8
  * Where OpenCode keeps the credentials `opencode auth login` writes.
@@ -11,9 +15,102 @@ const OPENCODE_AUTH_PATHS = ['.local/share/opencode/auth.json', '.config/opencod
11
15
  export function opencodeHasOwnAuth() {
12
16
  return OPENCODE_AUTH_PATHS.some(homeDirHas);
13
17
  }
18
+ /**
19
+ * OpenCode's first-party providers, and the base URL the models.dev catalog gives each.
20
+ *
21
+ * OpenCode resolves its API origin per model, and only the OpenAI and Anthropic origins can be
22
+ * named with an environment variable — so a run on one of these talked straight to its provider
23
+ * while the proxy saw nothing, and the trace came out empty while the agent answered happily.
24
+ * A config overlay (see `prepare`) points each at the proxy carrying its own destination, which
25
+ * is one mechanism for both and for any later first-party provider, at the cost of this table
26
+ * going stale: a provider added after it was written keeps bypassing capture the way it did
27
+ * before, which the end-of-run `capture.empty` warning is what says out loud.
28
+ */
29
+ const OPENCODE_FIRST_PARTY_BASE = {
30
+ opencode: 'https://opencode.ai/zen/v1',
31
+ 'opencode-go': 'https://opencode.ai/zen/go/v1',
32
+ };
33
+ /** The environment variable the overlay rides in on, and the one it must never clobber. */
34
+ const CONFIG_CONTENT_VAR = 'OPENCODE_CONFIG_CONTENT';
35
+ /**
36
+ * Shells whose real binary a shim can find again, from OpenCode's own acceptable set — the
37
+ * POSIX shells it runs commands with, minus the ones it refuses outright.
38
+ */
39
+ const SHIMMABLE_SHELLS = ['zsh', 'bash', 'sh', 'ksh', 'dash'];
40
+ /**
41
+ * The shell OpenCode falls back to when `SHELL` is unset or one it denies, which is what a
42
+ * recorded run should resolve through the shim so that it behaves like the unrecorded one.
43
+ */
44
+ function fallbackShells() {
45
+ return process.platform === 'darwin' ? ['zsh', 'bash', 'sh'] : ['bash', 'sh'];
46
+ }
47
+ /**
48
+ * Route OpenCode's shell tool through the shim, by pointing `SHELL` at one.
49
+ *
50
+ * OpenCode resolves its shell from this variable and then execs it *by absolute path*, so the
51
+ * PATH shim in front of `bash` and `sh` never engaged: on macOS every command ran under
52
+ * `/bin/zsh` and the frames file stayed empty while the trace showed shell tool calls. The shim
53
+ * named after the real shell keeps every flag OpenCode passes (`-c`, and the login wrappers)
54
+ * byte-identical — it is argv-transparent — so the run behaves the same and the shim sees it.
55
+ *
56
+ * The name is resolved before the run starts, because a shim whose real binary cannot be found
57
+ * on PATH would answer every command 127 and break the run instead of under-recording it.
58
+ * `installShellShim` writes one shim per name in its default set; a name that is not there
59
+ * simply never gets picked, and the end-of-run `shell.ineffective` warning is what reports the
60
+ * layer as unused.
61
+ */
62
+ async function shellThroughShim(env, runDir) {
63
+ if (process.platform === 'win32')
64
+ return undefined;
65
+ const shimDir = join(runDir, 'shims');
66
+ const current = basename(readEnv(env, 'SHELL') ?? '').toLowerCase();
67
+ const candidates = SHIMMABLE_SHELLS.includes(current)
68
+ ? [current, ...fallbackShells()]
69
+ : fallbackShells();
70
+ for (const name of new Set(candidates)) {
71
+ if ((await resolveRealBinary(name, env['PATH'] ?? '', shimDir)) !== undefined) {
72
+ return join(shimDir, name);
73
+ }
74
+ }
75
+ return undefined;
76
+ }
77
+ /**
78
+ * The config overlay that rewrites OpenCode's per-provider origins through the proxy.
79
+ *
80
+ * `provider.<id>.options.baseURL` is the one lever OpenCode honours over its catalog's origin,
81
+ * and `OPENCODE_CONFIG_CONTENT` is the config source merged last, so the overlay decides the
82
+ * final URL without touching the user's files. Each base URL is rewritten to
83
+ * `<proxy>/forward/<encoded base>`: the request arrives at the proxy naming where it was headed,
84
+ * the proxy records the exchange and forwards to that base — so an OpenAI-compatible provider
85
+ * whose origin is neither api.openai.com nor api.anthropic.com is captured, not bypassed.
86
+ *
87
+ * The user's own `options.baseURL` for the same provider is carried through rather than replaced.
88
+ * A config that could not be parsed clears the whole overlay: an unreadable intent is not a
89
+ * licence to reroute someone's provider. And an `OPENCODE_CONFIG_CONTENT` the user already set is
90
+ * relayed untouched — there is no way to merge two sources of one variable, and clobbering theirs
91
+ * to add capture would change more than the capture.
92
+ */
93
+ async function baseURLsThroughProxy(ctx) {
94
+ // There is no way to merge two sources of one variable, and clobbering theirs to add capture
95
+ // would change more than the capture — so it is relayed exactly as it arrived.
96
+ const theirs = readEnv(ctx.env, CONFIG_CONTENT_VAR);
97
+ if (theirs !== undefined)
98
+ return { [CONFIG_CONTENT_VAR]: theirs };
99
+ const scan = await openCodeConfiguredBaseURLs(ctx.env, ctx.cwd);
100
+ if (!scan.trusted)
101
+ return {};
102
+ const provider = {};
103
+ for (const [id, catalogBase] of Object.entries(OPENCODE_FIRST_PARTY_BASE)) {
104
+ const base = scan.overrides.get(id) ?? catalogBase;
105
+ provider[id] = { options: { baseURL: `${proxyBase(ctx.proxyUrl)}${forwardBasePath(base)}` } };
106
+ }
107
+ return { [CONFIG_CONTENT_VAR]: JSON.stringify({ provider }) };
108
+ }
14
109
  /**
15
110
  * OpenCode picks its provider per model, so both origins are redirected: whichever protocol the
16
- * chosen model speaks, the traffic lands on the proxy.
111
+ * chosen model speaks, the traffic lands on the proxy. Providers whose origin is neither of the
112
+ * two — OpenCode's own first-party ones, most visibly — are redirected by the config overlay
113
+ * below, because no environment variable can name their origin for them.
17
114
  */
18
115
  export const openCodeAdapter = {
19
116
  id: 'opencode',
@@ -46,6 +143,14 @@ export const openCodeAdapter = {
46
143
  passKey(env, ctx.env, 'OPENAI_API_KEY');
47
144
  passKey(env, ctx.env, 'ANTHROPIC_API_KEY');
48
145
  }
146
+ Object.assign(env, await baseURLsThroughProxy(ctx));
147
+ // `SHELL` overrides the user's own only to a shim standing in for a shell OpenCode would have
148
+ // picked anyway. With `--no-shell` there is no shim directory, OpenCode's own resolution
149
+ // finds nothing there and falls back exactly as it would unrecorded — so the wrong variable
150
+ // costs nothing, and the right one is what makes the frames file non-empty.
151
+ const shell = await shellThroughShim(ctx.env, ctx.runDir);
152
+ if (shell !== undefined)
153
+ env['SHELL'] = shell;
49
154
  return { command: 'opencode', args: [...ctx.userArgs], env };
50
155
  },
51
156
  };
@@ -1 +1 @@
1
- {"version":3,"file":"opencode.js","sourceRoot":"","sources":["../src/opencode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,mBAAmB,GAAG,CAAC,iCAAiC,EAAE,4BAA4B,CAAC,CAAC;AAE9F,mFAAmF;AACnF,MAAM,UAAU,kBAAkB;IAChC,OAAO,mBAAmB,CAA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AAS,CAAC;QACtD,IAAI,MAAM,IAAI,kBAAkB,EAAE,EAAE,CAAC;YACnC,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;YAC5C,WAAW,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAC;QACjD,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;YACxC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,mBAAmB,CAAC,CAAC;QAC7C,CAAC;QACD,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,MAAM,oBAAoB,CAAC,GAAG,CAAC,CAAC,CAAC;QAEpD,8FAA8F;QAC9F,yFAAyF;QACzF,4FAA4F;QAC5F,4EAA4E;QAC5E,MAAM,KAAK,GAAG,MAAM,gBAAgB,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;QAC1D,IAAI,KAAK,KAAK,SAAS;YAAE,GAAG,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC;QAE9C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC,GAAG,GAAG,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC;IAC/D,CAAC;CACF,CAAC"}
package/dist/qwen.d.ts ADDED
@@ -0,0 +1,51 @@
1
+ import type { Adapter } from '@orcareplay/plugin-api';
2
+ /** Whether Qwen Code can authenticate on its own, independent of the environment. */
3
+ export declare function qwenHasOwnAuth(): boolean;
4
+ /**
5
+ * Qwen Code, which reaches four different providers and reads a separate origin for each.
6
+ *
7
+ * Two of the four are redirected, and the other two deliberately are not. The line is not about
8
+ * the harness at all — it is about what orca can put on the other end.
9
+ *
10
+ * `OPENAI_BASE_URL` and `ANTHROPIC_BASE_URL` are moved, because the proxy can restore those
11
+ * origins: `resolveUpstream` produces `anthropic`, `openai` and `openai-responses` keys, and the
12
+ * dialects default to `api.anthropic.com` and `api.openai.com` when nothing is configured. A
13
+ * redirected call reaches the provider the client was already addressing.
14
+ *
15
+ * `DASHSCOPE_PROXY_BASE_URL` and `GEMINI_NEXT_GEN_API_BASE_URL` are left alone, and this is the
16
+ * uncomfortable part: they are the origins Qwen's *own* models and Gemini use, so leaving them is
17
+ * a real gap in what a run records. Redirecting them would be worse. The proxy resolves a live
18
+ * upstream by **wire dialect, not by provider**, and no `--upstream` form or gateway setting can
19
+ * name either destination — so with no gateway configured (a setup the README supports outright)
20
+ * a DashScope call arrives as `POST /v1/chat/completions`, is claimed by the openai dialect, and
21
+ * is forwarded to `api.openai.com` carrying `Authorization: Bearer <the user's DashScope key>`.
22
+ * A Gemini call reaches `/v1beta/models/...`, which no dialect claims, so `passthroughOrigin`
23
+ * guesses from headers — and it recognises only Anthropic's, treating everything else as OpenAI,
24
+ * which sends `x-goog-api-key` the same way. Its own comment says why that matters: "a wrong guess
25
+ * does not merely fail — it hands one vendor a key issued by another."
26
+ *
27
+ * So these two join `WEB_SEARCH_BASE_URL` as documented gaps. That one is the web-search tool's
28
+ * endpoint rather than a model origin — off unless `ENABLE_WEB_SEARCH` is set, keyed separately by
29
+ * `WEB_SEARCH_API_KEY` — and pointing it at the proxy without the matching key would break a tool
30
+ * that works today. Different reason, same conclusion: an origin orca cannot serve is one it
31
+ * should not take away.
32
+ *
33
+ * To record Qwen against its own models, terminate the TLS instead of moving the origin. One host
34
+ * is not enough, because `HostPolicy` matches a bare pattern exactly and the harness reaches a
35
+ * whole family — read off the same bundle: `dashscope.aliyuncs.com` is only the default, with
36
+ * `coding.dashscope.aliyuncs.com` and `coding-intl.dashscope.aliyuncs.com` for the coding plan,
37
+ * `cn-hongkong.dashscope.aliyuncs.com`, `dashscope-intl.aliyuncs.com` and
38
+ * `dashscope-us.aliyuncs.com` by region, and the token plan on a different domain again at
39
+ * `token-plan.cn-beijing.maas.aliyuncs.com` / `token-plan.ap-southeast-1.maas.aliyuncs.com`. So:
40
+ *
41
+ * orca record qwen --tls-intercept --tls-hosts \
42
+ * '+dashscope.aliyuncs.com,+*.dashscope.aliyuncs.com,+dashscope-intl.aliyuncs.com,+dashscope-us.aliyuncs.com'
43
+ *
44
+ * adding `+token-plan.cn-beijing.maas.aliyuncs.com` or the Singapore one if that is the plan in
45
+ * use, and `+api-inference.modelscope.cn` for a ModelScope endpoint. The wildcard covers the
46
+ * `*.dashscope` subdomains without reaching the console: DashScope's sign-in lives on
47
+ * `bailian.console.aliyun.com` and `modelstudio.console.alibabacloud.com`, different domains
48
+ * entirely, which is what makes the wildcard narrower here than one over a vendor's whole zone.
49
+ */
50
+ export declare const qwenAdapter: Adapter;
51
+ //# sourceMappingURL=qwen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qwen.d.ts","sourceRoot":"","sources":["../src/qwen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAyB,MAAM,wBAAwB,CAAC;AAO7E,qFAAqF;AACrF,wBAAgB,cAAc,IAAI,OAAO,CAExC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,eAAO,MAAM,WAAW,EAAE,OAsDzB,CAAC"}
package/dist/qwen.js ADDED
@@ -0,0 +1,105 @@
1
+ import { detectAgent, homeDirHas } from './detect.js';
2
+ import { passKey, passThrough, proxyBase, readEnv } from './env.js';
3
+ /** Where `qwen` writes the credentials its OAuth sign-in produces. */
4
+ const QWEN_AUTH_PATH = '.qwen/oauth_creds.json';
5
+ /** Whether Qwen Code can authenticate on its own, independent of the environment. */
6
+ export function qwenHasOwnAuth() {
7
+ return homeDirHas(QWEN_AUTH_PATH);
8
+ }
9
+ /**
10
+ * Qwen Code, which reaches four different providers and reads a separate origin for each.
11
+ *
12
+ * Two of the four are redirected, and the other two deliberately are not. The line is not about
13
+ * the harness at all — it is about what orca can put on the other end.
14
+ *
15
+ * `OPENAI_BASE_URL` and `ANTHROPIC_BASE_URL` are moved, because the proxy can restore those
16
+ * origins: `resolveUpstream` produces `anthropic`, `openai` and `openai-responses` keys, and the
17
+ * dialects default to `api.anthropic.com` and `api.openai.com` when nothing is configured. A
18
+ * redirected call reaches the provider the client was already addressing.
19
+ *
20
+ * `DASHSCOPE_PROXY_BASE_URL` and `GEMINI_NEXT_GEN_API_BASE_URL` are left alone, and this is the
21
+ * uncomfortable part: they are the origins Qwen's *own* models and Gemini use, so leaving them is
22
+ * a real gap in what a run records. Redirecting them would be worse. The proxy resolves a live
23
+ * upstream by **wire dialect, not by provider**, and no `--upstream` form or gateway setting can
24
+ * name either destination — so with no gateway configured (a setup the README supports outright)
25
+ * a DashScope call arrives as `POST /v1/chat/completions`, is claimed by the openai dialect, and
26
+ * is forwarded to `api.openai.com` carrying `Authorization: Bearer <the user's DashScope key>`.
27
+ * A Gemini call reaches `/v1beta/models/...`, which no dialect claims, so `passthroughOrigin`
28
+ * guesses from headers — and it recognises only Anthropic's, treating everything else as OpenAI,
29
+ * which sends `x-goog-api-key` the same way. Its own comment says why that matters: "a wrong guess
30
+ * does not merely fail — it hands one vendor a key issued by another."
31
+ *
32
+ * So these two join `WEB_SEARCH_BASE_URL` as documented gaps. That one is the web-search tool's
33
+ * endpoint rather than a model origin — off unless `ENABLE_WEB_SEARCH` is set, keyed separately by
34
+ * `WEB_SEARCH_API_KEY` — and pointing it at the proxy without the matching key would break a tool
35
+ * that works today. Different reason, same conclusion: an origin orca cannot serve is one it
36
+ * should not take away.
37
+ *
38
+ * To record Qwen against its own models, terminate the TLS instead of moving the origin. One host
39
+ * is not enough, because `HostPolicy` matches a bare pattern exactly and the harness reaches a
40
+ * whole family — read off the same bundle: `dashscope.aliyuncs.com` is only the default, with
41
+ * `coding.dashscope.aliyuncs.com` and `coding-intl.dashscope.aliyuncs.com` for the coding plan,
42
+ * `cn-hongkong.dashscope.aliyuncs.com`, `dashscope-intl.aliyuncs.com` and
43
+ * `dashscope-us.aliyuncs.com` by region, and the token plan on a different domain again at
44
+ * `token-plan.cn-beijing.maas.aliyuncs.com` / `token-plan.ap-southeast-1.maas.aliyuncs.com`. So:
45
+ *
46
+ * orca record qwen --tls-intercept --tls-hosts \
47
+ * '+dashscope.aliyuncs.com,+*.dashscope.aliyuncs.com,+dashscope-intl.aliyuncs.com,+dashscope-us.aliyuncs.com'
48
+ *
49
+ * adding `+token-plan.cn-beijing.maas.aliyuncs.com` or the Singapore one if that is the plan in
50
+ * use, and `+api-inference.modelscope.cn` for a ModelScope endpoint. The wildcard covers the
51
+ * `*.dashscope` subdomains without reaching the console: DashScope's sign-in lives on
52
+ * `bailian.console.aliyun.com` and `modelstudio.console.alibabacloud.com`, different domains
53
+ * entirely, which is what makes the wildcard narrower here than one over a vendor's whole zone.
54
+ */
55
+ export const qwenAdapter = {
56
+ id: 'qwen',
57
+ aliases: ['qwen-code'],
58
+ harnessVersions: '>=0.22.3',
59
+ async detect(_cwd) {
60
+ return detectAgent(['qwen'], ['.qwen']);
61
+ },
62
+ async prepare(ctx) {
63
+ // Only the two origins the proxy can put a real provider behind. See the note above for why
64
+ // DashScope and Gemini are left pointing at their own APIs rather than at a proxy that would
65
+ // forward them, and their credentials, to OpenAI.
66
+ const env = {
67
+ OPENAI_BASE_URL: proxyBase(ctx.proxyUrl, 'v1'),
68
+ ANTHROPIC_BASE_URL: proxyBase(ctx.proxyUrl),
69
+ };
70
+ // The same credential rule as OpenCode, and for the same two reasons. Which keys the harness
71
+ // can see decides which provider it picks, so a placeholder for a provider the user never
72
+ // configured can change which model answers — and a recorded run that answers differently
73
+ // from the same command uninstrumented is the worst kind of capture bug. Separately, `qwen`
74
+ // signs in on its own: an OAuth run writes `~/.qwen/oauth_creds.json`, and inventing keys in
75
+ // front of that credential makes the harness prefer an environment key that is not real.
76
+ //
77
+ // So placeholders stand in only when there is nothing to disturb: no key in the environment
78
+ // and no sign-in of its own.
79
+ const hasAny = readEnv(ctx.env, 'OPENAI_API_KEY') !== undefined ||
80
+ readEnv(ctx.env, 'ANTHROPIC_API_KEY') !== undefined ||
81
+ readEnv(ctx.env, 'ANTHROPIC_AUTH_TOKEN') !== undefined ||
82
+ readEnv(ctx.env, 'GEMINI_API_KEY') !== undefined ||
83
+ readEnv(ctx.env, 'GOOGLE_API_KEY') !== undefined ||
84
+ readEnv(ctx.env, 'DASHSCOPE_API_KEY') !== undefined;
85
+ if (hasAny || qwenHasOwnAuth()) {
86
+ passThrough(env, ctx.env, 'OPENAI_API_KEY');
87
+ passThrough(env, ctx.env, 'ANTHROPIC_API_KEY');
88
+ passThrough(env, ctx.env, 'ANTHROPIC_AUTH_TOKEN');
89
+ passThrough(env, ctx.env, 'GEMINI_API_KEY');
90
+ passThrough(env, ctx.env, 'GOOGLE_API_KEY');
91
+ passThrough(env, ctx.env, 'DASHSCOPE_API_KEY');
92
+ }
93
+ else {
94
+ passKey(env, ctx.env, 'OPENAI_API_KEY');
95
+ passKey(env, ctx.env, 'ANTHROPIC_API_KEY');
96
+ }
97
+ // `OPENAI_MODEL` is passed on, never invented: Qwen Code has no default for a
98
+ // custom endpoint, so the model id is the operator's to supply and the adapter has no way to
99
+ // know which one the recording is meant to exercise.
100
+ passThrough(env, ctx.env, 'OPENAI_MODEL');
101
+ passThrough(env, ctx.env, 'QWEN_CODE_MODEL');
102
+ return { command: 'qwen', args: [...ctx.userArgs], env };
103
+ },
104
+ };
105
+ //# sourceMappingURL=qwen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"qwen.js","sourceRoot":"","sources":["../src/qwen.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEpE,sEAAsE;AACtE,MAAM,cAAc,GAAG,wBAAwB,CAAC;AAEhD,qFAAqF;AACrF,MAAM,UAAU,cAAc;IAC5B,OAAO,UAAU,CAAC,c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G,IAAI,MAAM,EAAE;IAIf;;;;;OAKG;IACH,KAAK,IAAI,MAAM,EAAE;IASjB,0FAA0F;IACpF,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC;CAUxD;AAED,wBAAgB,eAAe,IAAI,eAAe,CAUjD"}
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AActD,qBAAa,eAAe;;IAK1B,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAuBhC,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO;IAYxB,oEAAoE;IACpE,GAAG,IAAI,MAAM,EAAE;IAIf;;;;;OAKG;IACH,KAAK,IAAI,MAAM,EAAE;IASjB,0FAA0F;IACpF,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC;CAUxD;AAED,wBAAgB,eAAe,IAAI,eAAe,CAgBjD"}
package/dist/registry.js CHANGED
@@ -1,10 +1,15 @@
1
1
  import { claudeCodeAdapter } from './claude-code.js';
2
2
  import { codexAdapter } from './codex.js';
3
+ import { cursorAdapter } from './cursor.js';
4
+ import { kiloAdapter } from './kilo.js';
5
+ import { mimoAdapter } from './mimo.js';
6
+ import { execAdapter } from './exec.js';
3
7
  import { genericOpenAiAdapter } from './generic-openai.js';
4
8
  import { grokAdapter } from './grok.js';
5
9
  import { openClawAdapter } from './openclaw.js';
6
10
  import { nodeAdapter } from './node.js';
7
11
  import { openCodeAdapter } from './opencode.js';
12
+ import { qwenAdapter } from './qwen.js';
8
13
  export class AdapterRegistry {
9
14
  #adapters = new Map();
10
15
  /** Alias → canonical id. Kept apart from #adapters so `ids()` stays the canonical id space. */
@@ -73,10 +78,16 @@ export function defaultAdapters() {
73
78
  registry.register(claudeCodeAdapter);
74
79
  registry.register(codexAdapter);
75
80
  registry.register(openCodeAdapter);
81
+ registry.register(qwenAdapter);
82
+ registry.register(mimoAdapter);
83
+ registry.register(kiloAdapter);
84
+ registry.register(cursorAdapter);
76
85
  registry.register(grokAdapter);
77
86
  registry.register(openClawAdapter);
78
87
  registry.register(nodeAdapter);
79
88
  registry.register(genericOpenAiAdapter);
89
+ // Last: it detects nothing, and it is the fallback someone reaches for by name.
90
+ registry.register(execAdapter);
80
91
  return registry;
81
92
  }
82
93
  //# sourceMappingURL=registry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,OAAO,eAAe;IACjB,SAAS,GAAG,IAAI,GAAG,EAAmB,CAAC;IAChD,+FAA+F;IACtF,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAC;IAE9C,QAAQ,CAAC,OAAgB;QACvB,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAChD,IAAI,QAAQ,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;YACrC,MAAM,IAAI,KAAK,CACb,eAAe,OAAO,CAAC,EAAE,6DAA6D;gBACpF,oBAAoB,CACvB,CAAC;QACJ,CAAC;QACD,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,OAAO,IAAI,EAAE,EAAE,CAAC;YAC1C,2FAA2F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