@yuriai/web 0.2.34-beta.1 → 0.2.34-beta.3
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/dist/assets/{AssistantContactStatus-D3bZnK40.js → AssistantContactStatus-D3ScljGl.js} +3 -3
- package/dist/assets/{AssistantUnreadBadge-DsAOi9YL.js → AssistantUnreadBadge-NkBCB4n9.js} +1 -1
- package/dist/assets/{AssistantView-CXLkqt06.js → AssistantView-CI2lhkIT.js} +1 -1
- package/dist/assets/{DiagramView-DlUhVvw4.js → DiagramView-DNQmqZTz.js} +1 -1
- package/dist/assets/{GuiPluginSurface-BON91cIm.js → GuiPluginSurface-Da61Xn7x.js} +1 -1
- package/dist/assets/{MarkdownRenderer-C95EeYCg.js → MarkdownRenderer-D-7r0LeT.js} +2 -2
- package/dist/assets/{MarkdownRendererImpl-diavhySA.js → MarkdownRendererImpl-yQaid-kp.js} +1 -1
- package/dist/assets/{MarkstreamRendererImpl-Dz6PwsbC.js → MarkstreamRendererImpl-B1S_vvdw.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-f2Sv5EE7.js → MobileDetailNavigation-Hd18mJ2l.js} +1 -1
- package/dist/assets/{MobileShareBridge-BVUjBjnC.js → MobileShareBridge-CgAoZoO9.js} +1 -1
- package/dist/assets/{MobileTabPageHeader-C11--9zz.js → MobileTabPageHeader-B9kurLFw.js} +1 -1
- package/dist/assets/{MultiRunWindow-_BaCaoK5.js → MultiRunWindow-CdUZs6BA.js} +1 -1
- package/dist/assets/{SettingsView-CJolJobA.js → SettingsView-C0P981Yx.js} +1 -1
- package/dist/assets/{SettingsWindow-BFlnXsRh.js → SettingsWindow-Bep47gp_.js} +1 -1
- package/dist/assets/{SetupTourDialog-CE2v5xl-.js → SetupTourDialog-CngeU4Gl.js} +1 -1
- package/dist/assets/{TerminalView-BgRND4lr.js → TerminalView-BRuYIzl6.js} +1 -1
- package/dist/assets/{ToolOutputDialog-CuzIPesg.js → ToolOutputDialog-DvBKkPyY.js} +1 -1
- package/dist/assets/{VoiceSettings-qZHJcPCQ.js → VoiceSettings-Bwq3L5vz.js} +1 -1
- package/dist/assets/{appThemeRegistry-CwQPkdSg.js → appThemeRegistry-DSbTAzmO.js} +1 -1
- package/dist/assets/{capgoAdapter-B1V03leY.js → capgoAdapter-D9oY9_ut.js} +1 -1
- package/dist/assets/{gitApi-7b3n0Cx6.js → gitApi-DSzxh9dp.js} +1 -1
- package/dist/assets/{insertionBoundaries-vVWTXLNP.js → insertionBoundaries-B_epKOnH.js} +1 -1
- package/dist/assets/{main-BGEWS191.js → main-C8bkHEMX.js} +2 -2
- package/dist/assets/{main-NOT5nP4j.js → main-DROYKEfx.js} +5 -5
- package/dist/assets/{mcpQueries-CxQRFZgw.js → mcpQueries-Daeejbnx.js} +1 -1
- package/dist/assets/{miniChat-CI-PV_Pb.js → miniChat-CoUl0Vav.js} +2 -2
- package/dist/assets/{mobile-C4BBlKYL.js → mobile-LaGrgSUM.js} +2 -2
- package/dist/assets/{mobileBackNavigation-BsZGPnR4.js → mobileBackNavigation-goIeVVNl.js} +1 -1
- package/dist/assets/{multirun-BDni7qIg.js → multirun-D_JGy3RU.js} +1 -1
- package/dist/assets/{native-config-ChlJd0rY.js → native-config-BFOCyZg2.js} +1 -1
- package/dist/assets/{projectMeta-YmXTkpkF.js → projectMeta-wNuM5rHW.js} +1 -1
- package/dist/assets/{pwa-BrAJac8T.js → pwa-xGAzXaZv.js} +1 -1
- package/dist/assets/{queue-abort-optimistic-qJxyHVmV.js → queue-abort-optimistic-BGuIwEZM.js} +1 -1
- package/dist/assets/{readiness-BN8RV2pd.js → readiness-BPbnvr2e.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-CeS3-aeo.js → renderElectronMiniChatApp-C3T22u2H.js} +2 -2
- package/dist/assets/{renderMobileApp-Dr0fMttr.js → renderMobileApp-DAQsqK1D.js} +4 -4
- package/dist/assets/{runtimeConfig-CXzo2d1T.js → runtimeConfig-DtKtvKA2.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-DoLnuVzh.js → runtimeEndpointReset-BwfxkwS0.js} +3 -3
- package/dist/assets/{sessionLookup-Yp_-O5tx.js → sessionLookup-pYkh3EU2.js} +1 -1
- package/dist/assets/{speechSettingsQueries-DuM5JE1k.js → speechSettingsQueries-6Ea0FfKL.js} +1 -1
- package/dist/assets/{types-Dk38H42n.js → types-CNECQLeq.js} +1 -1
- package/dist/assets/{useAppFontEffects-pHGi5wrv.js → useAppFontEffects-BW8yQWSG.js} +5 -5
- package/dist/assets/{useDesktopWindowControlsLayout-DDH-aUb0.js → useDesktopWindowControlsLayout-BC2wTKdJ.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-DNGQ5AO-.js → useEffectiveDirectory-OJzoI-nH.js} +1 -1
- package/dist/assets/{useMobileNavigationStore-CQ3OBccn.js → useMobileNavigationStore-C8nCzxDH.js} +4 -4
- package/dist/assets/{usePluginsStore-DzncuyZe.js → usePluginsStore-B3584ktF.js} +1 -1
- package/dist/assets/{useWorkerHighlightedLines-Dj11DQDS.js → useWorkerHighlightedLines-CZlfrVSP.js} +1 -1
- package/dist/index.html +5 -5
- package/dist/mini-chat.html +5 -5
- package/dist/mobile.html +5 -5
- package/package.json +1 -1
- package/server/lib/llm/DOCUMENTATION.md +17 -2
- package/server/lib/llm/bridge-plugin.bundle.js +10 -10
- package/server/lib/llm/bridge-plugin.js +30 -3
- package/server/lib/llm/bridge-plugin.test.js +49 -0
|
@@ -7,6 +7,22 @@ import { Service as PluginHooksService } from '@opencode/core/plugin/hooks';
|
|
|
7
7
|
import { LlmBridge, LLM_BRIDGE_VERSION } from './bridge-contract.js';
|
|
8
8
|
|
|
9
9
|
const sensitiveBodyKeys = ['messages', 'input', 'system', 'instructions', 'tools', 'tool_choice'];
|
|
10
|
+
const generationKeys = ['maxTokens', 'temperature', 'topP', 'topK', 'frequencyPenalty', 'presencePenalty', 'seed', 'stop'];
|
|
11
|
+
// OpenCode 2.2.6 uses flat request/model options; the bundled SDK uses nested defaults.
|
|
12
|
+
const legacyDefaults = options => options && ({
|
|
13
|
+
generation: Object.fromEntries(generationKeys.filter(key => options[key] !== undefined).map(key => [key, options[key]])),
|
|
14
|
+
providerOptions: options.providerOptions,
|
|
15
|
+
http: {
|
|
16
|
+
...options.http, headers: options.headers,
|
|
17
|
+
timeout: typeof options.timeout === 'object' ? options.timeout.total : options.timeout,
|
|
18
|
+
headerTimeout: options.timeout?.headers, chunkTimeout: options.timeout?.chunk,
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
const flatRequest = (request, model) => {
|
|
22
|
+
const { generation, http, ...rest } = request;
|
|
23
|
+
const { headers, timeout, headerTimeout, chunkTimeout, ...wire } = http ?? {};
|
|
24
|
+
return { ...rest, ...generation, model, headers, http: wire, timeout: { total: timeout, headers: headerTimeout, chunk: chunkTimeout } };
|
|
25
|
+
};
|
|
10
26
|
const unavailable = () => Object.assign(new Error('External OpenCode clean inference runtime is unavailable or incompatible'), { code: 'unavailable' });
|
|
11
27
|
const providerFailureData = error => {
|
|
12
28
|
const reason = error?.reason;
|
|
@@ -51,14 +67,24 @@ export const generateBridgeResponse = input => Effect.gen(function* () {
|
|
|
51
67
|
const { resolver, hooks } = yield* hostRuntime;
|
|
52
68
|
const model = yield* resolver.resolve({ providerID: input.providerID, id: input.modelID, ...(input.variant ? { variant: input.variant } : {}) });
|
|
53
69
|
if (!model) return yield* Effect.fail(unavailable());
|
|
54
|
-
if ([model.model.defaults?.http?.body, model.model.route.defaults?.http?.body
|
|
70
|
+
if ([model.model.defaults?.http?.body, model.model.route.defaults?.http?.body,
|
|
71
|
+
model.model.options?.http?.body, model.model.route.options?.http?.body].some(body => sensitiveBodyKeys.some(key => Object.hasOwn(body ?? {}, key)))) {
|
|
55
72
|
return yield* Effect.fail(unavailable());
|
|
56
73
|
}
|
|
74
|
+
const flatOptions = model.model.route.defaults === undefined;
|
|
57
75
|
// This ID is cache affinity only; it does not create a durable OpenCode Session.
|
|
58
76
|
const scope = { sessionID: `ses_${createHash('sha256').update(input.cacheKey).digest('hex')}`, agent: 'yuri-inference', model: model.ref, kind: 'generate' };
|
|
59
77
|
const base = LLM.request({
|
|
60
78
|
// The host and bundled SDK have distinct constructors; preserve the host's route, normalize its value wrapper.
|
|
61
|
-
model: LanguageModel.make(
|
|
79
|
+
model: LanguageModel.make(flatOptions ? {
|
|
80
|
+
...model.model,
|
|
81
|
+
defaults: legacyDefaults(model.model.options),
|
|
82
|
+
compatibility: {
|
|
83
|
+
...model.model.compatibility,
|
|
84
|
+
supportsPromptCacheKey: model.model.capabilities?.promptCacheKey,
|
|
85
|
+
supportsEffortUpdates: model.model.capabilities?.reasoning?.updates,
|
|
86
|
+
},
|
|
87
|
+
} : model.model),
|
|
62
88
|
system: input.messages.filter(message => message.role === 'system').map(message => message.content).join('\n\n'),
|
|
63
89
|
messages: input.messages.filter(message => message.role !== 'system').map(toMessage),
|
|
64
90
|
tools: input.tools ?? [],
|
|
@@ -74,9 +100,10 @@ export const generateBridgeResponse = input => Effect.gen(function* () {
|
|
|
74
100
|
// Provider transports may construct requests with their own SDK's nominal model schema.
|
|
75
101
|
// Cross that boundary with the original host wrapper, not the bundled SDK wrapper.
|
|
76
102
|
const hostModel = route === model.model.route ? model.model : model.model.constructor.update(model.model, { route });
|
|
77
|
-
const hostRequest = request => ({ ...request, model: hostModel });
|
|
103
|
+
const hostRequest = request => flatOptions ? flatRequest(request, hostModel) : ({ ...request, model: hostModel });
|
|
78
104
|
const bridgedRoute = {
|
|
79
105
|
...route,
|
|
106
|
+
...(flatOptions ? { defaults: {}, headers: route.headers && (({ request }) => route.headers({ request: hostRequest(request) })) } : {}),
|
|
80
107
|
body: { ...route.body, from: request => route.body.from(hostRequest(request)) },
|
|
81
108
|
prepareTransport: (body, request, options) => route.prepareTransport(body, hostRequest(request), options),
|
|
82
109
|
streamPrepared: (prepared, request, runtime, options) => route.streamPrepared(prepared, hostRequest(request), runtime, options),
|
|
@@ -166,6 +166,55 @@ describe.each(['source', 'prebundled'])('external runtime provider bridge (%s)',
|
|
|
166
166
|
expect(await run(input)).toMatchObject({ text: 'host model' });
|
|
167
167
|
});
|
|
168
168
|
|
|
169
|
+
it('adapts 2.2.6 flat host options at every route boundary', async () => {
|
|
170
|
+
const { input, resolve, headers, requests, run } = await fixture({ role: 'assistant', content: 'host 2.2.6' });
|
|
171
|
+
const original = resolve.getMockImplementation();
|
|
172
|
+
const boundaries = [];
|
|
173
|
+
resolve.mockImplementation(ref => original(ref).pipe(Effect.map(value => {
|
|
174
|
+
const legacy = value.model;
|
|
175
|
+
const { defaults, ...route } = legacy.route;
|
|
176
|
+
const host = { ...legacy, defaults: undefined, route, options: { maxTokens: 4096, temperature: 0.2, providerOptions: { fixture: { enabled: true } },
|
|
177
|
+
headers: { 'provider-header': 'retained' }, timeout: { headers: 5000, chunk: false }, http: { body: { provider_marker: true } } } };
|
|
178
|
+
// The actual 2.2.6 boundary has no route.defaults and consumes flat fields.
|
|
179
|
+
// Translate back only inside the fixture's 2.2.1 transport implementation.
|
|
180
|
+
const check = (name, request) => {
|
|
181
|
+
boundaries.push(name);
|
|
182
|
+
expect(request.model).toBe(host);
|
|
183
|
+
expect(request.maxTokens).toBe(64);
|
|
184
|
+
expect(request.temperature).toBe(0.2);
|
|
185
|
+
expect(request.providerOptions).toEqual({ fixture: { enabled: true } });
|
|
186
|
+
expect(request.headers).toMatchObject({ 'x-opencode-session': input.cacheKey, 'provider-header': 'retained' });
|
|
187
|
+
expect(request.timeout).toMatchObject({ headers: 5000, chunk: false });
|
|
188
|
+
expect(request.generation).toBeUndefined();
|
|
189
|
+
expect(request.http.headers).toBeUndefined();
|
|
190
|
+
return { ...request, model: legacy, generation: { maxTokens: request.maxTokens, temperature: request.temperature },
|
|
191
|
+
http: { ...request.http, headers: request.headers, headerTimeout: request.timeout.headers, chunkTimeout: request.timeout.chunk } };
|
|
192
|
+
};
|
|
193
|
+
route.headers = ({ request }) => { check('headers', request); return { 'route-header': 'retained' }; };
|
|
194
|
+
route.body = { ...route.body, from: request => legacy.route.body.from(check('body', request)) };
|
|
195
|
+
route.prepareTransport = (body, request, options) => legacy.route.prepareTransport(body, check('prepare', request), options);
|
|
196
|
+
route.streamPrepared = (prepared, request, runtime, options) => legacy.route.streamPrepared(prepared, check('stream', request), runtime, options);
|
|
197
|
+
return { ...value, model: host };
|
|
198
|
+
})));
|
|
199
|
+
expect(await run({ ...input, maxOutputTokens: 64 })).toMatchObject({ text: 'host 2.2.6' });
|
|
200
|
+
expect(boundaries).toEqual(['headers', 'body', 'prepare', 'stream']);
|
|
201
|
+
expect(requests[0]).toMatchObject({ messages: input.messages, temperature: 0.2, provider_marker: true });
|
|
202
|
+
expect(headers[0]['provider-header']).toBe('retained');
|
|
203
|
+
expect(headers[0]['route-header']).toBe('retained');
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
it.each(['model', 'route'])('rejects context injection in 2.2.6 %s options', async (owner) => {
|
|
207
|
+
const { input, resolve, run } = await fixture({ role: 'assistant', content: 'unused' });
|
|
208
|
+
const original = resolve.getMockImplementation();
|
|
209
|
+
resolve.mockImplementation(ref => original(ref).pipe(Effect.map(value => {
|
|
210
|
+
const host = { ...value.model, route: { ...value.model.route } };
|
|
211
|
+
delete host.route.defaults;
|
|
212
|
+
(owner === 'model' ? host : host.route).options = { http: { body: { messages: [] } } };
|
|
213
|
+
return { ...value, model: host };
|
|
214
|
+
})));
|
|
215
|
+
await expect(run(input)).rejects.toMatchObject({ code: 'unavailable' });
|
|
216
|
+
});
|
|
217
|
+
|
|
169
218
|
it('preserves interruption instead of converting cancellation into a provider error', async () => {
|
|
170
219
|
let handlers;
|
|
171
220
|
await Effect.runPromise(bridge.effect({ rpc: { register: (_definition, value) => { handlers = value; return Effect.void; } } }));
|