@openchamber/web 1.22.0 → 1.22.1
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/{CodeMirrorCommentWidgets-CPvfxh0N.js → CodeMirrorCommentWidgets-BO_2OW4E.js} +1 -1
- package/dist/assets/{DiffView-6xGdyI0n.js → DiffView-CNnDxRmO.js} +2 -2
- package/dist/assets/DirtyBranchSwitchDialog-jADfXQnR.js +1 -0
- package/dist/assets/{FilesView-Bm3vT63N.js → FilesView-8wdiG2mj.js} +8 -8
- package/dist/assets/GitView-Cv2xH-S6.js +6 -0
- package/dist/assets/{JsonTreeView-rwHz84MX.js → JsonTreeView-DUiIpERC.js} +1 -1
- package/dist/assets/LinearIssuesView-CoZ7pQN5.js +1 -0
- package/dist/assets/{MarkdownImageGallery-sGilV9Hs.js → MarkdownImageGallery-DffjmciG.js} +1 -1
- package/dist/assets/{MarkdownRendererImpl--4sRsKBn.js → MarkdownRendererImpl-DxqdYDAx.js} +2 -2
- package/dist/assets/{OnboardingScreen-CECL_Cms.js → OnboardingScreen-CTZe6HZn.js} +1 -1
- package/dist/assets/{PatchDiff-BGPl1s-U.js → PatchDiff-BymkP9JA.js} +1 -1
- package/dist/assets/{PierreDiffViewer-Cvz9Z-io.js → PierreDiffViewer-BvwtCxW4.js} +2 -2
- package/dist/assets/{PlanView-BFMsnHk3.js → PlanView-C1qvAm7m.js} +4 -4
- package/dist/assets/SettingsView-xGONHFGS.js +28 -0
- package/dist/assets/{SettingsWindow-C1Qa09YO.js → SettingsWindow-COzgfFxM.js} +1 -1
- package/dist/assets/{ToolOutputDialog-DzQlzMF4.js → ToolOutputDialog-Dlhh_-oe.js} +6 -6
- package/dist/assets/ToolPartDiffPreview-b9joNtXH.js +8 -0
- package/dist/assets/{VirtualizedFileDiff-DT5MDv-u.js → VirtualizedFileDiff-vqW3KKo5.js} +1 -1
- package/dist/assets/{WalkthroughView-D8sLH_M8.js → WalkthroughView-D-HFgdmM.js} +1 -1
- package/dist/assets/{computeVirtualFileMetrics-DmpLWhll.js → computeVirtualFileMetrics-DUnyszhW.js} +1 -1
- package/dist/assets/{contextPanelEmbeddedChat-BK78t3M_.js → contextPanelEmbeddedChat-CV-DwAiX.js} +1 -1
- package/dist/assets/{de-C3luvSd_.js → de-Cv_4FoXm.js} +6 -5
- package/dist/assets/{es-CmU4HLv9.js → es-BIWNEbnS.js} +6 -5
- package/dist/assets/{fr-Bgyni40l.js → fr-SD3OfMHJ.js} +6 -5
- package/dist/assets/index-CHUT_bDS.css +1 -0
- package/dist/assets/index-DDInLQDd.js +40 -0
- package/dist/assets/{index-CWYs7sMK.js → index-DLiD86ge.js} +1 -1
- package/dist/assets/{isDiffPlainText-BO_q5ezD.js → isDiffPlainText-TNageFjy.js} +1 -1
- package/dist/assets/{isFilePlainText-D8qPqUAf.js → isFilePlainText-JPmZOYSp.js} +1 -1
- package/dist/assets/{ja-C1ImKinT.js → ja-D7I9HofF.js} +7 -6
- package/dist/assets/{ko-CP7OdxYH.js → ko-BsVJM_PQ.js} +7 -6
- package/dist/assets/{main-D7fwjW2z.js → main-DCB4JgVe.js} +2 -2
- package/dist/assets/main-De8Z5w49.js +928 -0
- package/dist/assets/{markdownCore-BcmkWZPO.js → markdownCore-BoQVG5-a.js} +1 -1
- package/dist/assets/{miniChat-D5rraz-g.js → miniChat-BtV7N5OF.js} +2 -2
- package/dist/assets/{mobile-Cg_DE3KL.js → mobile-DZV_sfX7.js} +2 -2
- package/dist/assets/{patchFileDiff-Bpql0QGw.js → patchFileDiff-Chmiz6hq.js} +5 -5
- package/dist/assets/{pl-DQYSiGYX.js → pl-XR9Bs8Be.js} +6 -5
- package/dist/assets/{pt-BR-DytpsW4M.js → pt-BR-Due4be8g.js} +6 -5
- package/dist/assets/{renderElectronMiniChatApp-B_Bn7BbN.js → renderElectronMiniChatApp-8tXADjfl.js} +2 -2
- package/dist/assets/renderMobileApp-Cji7Hma5.js +25 -0
- package/dist/assets/runtimeEndpointReset-gWt3Lb5D.js +16 -0
- package/dist/assets/{scheduledTasksApi-BPvxrynl.js → scheduledTasksApi-9e-UX6im.js} +1 -1
- package/dist/assets/{shikiHighlight-CFAVs_lu.js → shikiHighlight-CRpCl7UT.js} +1 -1
- package/dist/assets/tr-DBJcAv4y.js +7 -0
- package/dist/assets/{uk-DwnRxJZd.js → uk-COYh2BaN.js} +6 -5
- package/dist/assets/{useAppFontEffects-DWXGRUPZ.js → useAppFontEffects-CCgvcQ6u.js} +145 -177
- package/dist/assets/{useInlineCommentController-Cc0OCXr0.js → useInlineCommentController-BkfXnjNZ.js} +2 -2
- package/dist/assets/{useRootScrollLock-BFZtfciC.js → useRootScrollLock-KzOUytpn.js} +1 -1
- package/dist/assets/{vendor-codemirror-language-data-BGFszm8n.js → vendor-codemirror-language-data-BxpoC5Fp.js} +2 -2
- package/dist/assets/vendor-zod-DVWEh-IS.js +39 -0
- package/dist/assets/{web-components-CD-GFayc.js → web-components-B6QgbmTo.js} +1 -1
- package/dist/assets/{zh-CN-UDNMxm7r.js → zh-CN-Cjk6lzhc.js} +6 -5
- package/dist/assets/{zh-TW-BsswdYL-.js → zh-TW-Dk0dOg03.js} +6 -5
- package/dist/index.html +5 -5
- package/dist/mini-chat.html +4 -4
- package/dist/mobile.html +4 -4
- package/package.json +2 -2
- package/server/index.js +31 -4
- package/server/lib/agent-tool/runtime.js +2 -19
- package/server/lib/dev-tunnel/DOCUMENTATION.md +13 -4
- package/server/lib/dev-tunnel/runtime.js +4 -4
- package/server/lib/dev-tunnel/tunnel.test.js +20 -0
- package/server/lib/git/DOCUMENTATION.md +3 -1
- package/server/lib/git/routes.js +16 -0
- package/server/lib/git/service.js +97 -17
- package/server/lib/git/service.test.js +153 -0
- package/server/lib/mcp-reconnect/DOCUMENTATION.md +55 -0
- package/server/lib/mcp-reconnect/runtime.js +122 -0
- package/server/lib/mcp-reconnect/runtime.test.js +140 -0
- package/server/lib/message-queue/DOCUMENTATION.md +148 -0
- package/server/lib/message-queue/runtime.js +818 -0
- package/server/lib/message-queue/runtime.test.js +426 -0
- package/server/lib/openchamber-sessions/routes.js +102 -0
- package/server/lib/openchamber-sessions/routes.test.js +88 -0
- package/server/lib/opencode/DOCUMENTATION.md +5 -1
- package/server/lib/opencode/core-routes.js +1 -0
- package/server/lib/opencode/feature-routes-runtime.js +3 -0
- package/server/lib/opencode/managed-plugin-config.js +35 -0
- package/server/lib/opencode/settings-runtime.js +2 -2
- package/server/lib/opencode/settings-runtime.test.js +29 -0
- package/server/lib/opencode/shutdown-runtime.js +2 -0
- package/server/lib/quota/DOCUMENTATION.md +2 -1
- package/server/lib/quota/credentials/providers.js +4 -0
- package/server/lib/quota/credentials/store.js +1 -1
- package/server/lib/quota/credentials/store.test.js +4 -4
- package/server/lib/quota/providers/exe-dev.js +75 -0
- package/server/lib/quota/providers/exe-dev.test.js +47 -0
- package/server/lib/quota/providers/index.js +7 -0
- package/server/lib/quota/providers/opencode-go.js +1 -0
- package/server/lib/quota/providers/opencode-go.test.js +5 -1
- package/server/lib/quota/routes.js +2 -0
- package/server/lib/relay/DOCUMENTATION.md +1 -1
- package/server/lib/relay/tunnel-host.js +3 -1
- package/server/lib/relay/tunnel-host.test.js +9 -1
- package/server/lib/security/request-security.js +21 -6
- package/server/lib/security/request-security.test.js +42 -8
- package/server/lib/session-assist/runtime.js +1 -0
- package/server/lib/session-goal/create.js +3 -1
- package/server/lib/session-goal/runtime.js +1 -0
- package/server/lib/small-model/DOCUMENTATION.md +4 -0
- package/server/lib/small-model/call.js +8 -2
- package/server/lib/small-model/call.test.js +23 -0
- package/server/lib/small-model/index.js +2 -1
- package/server/lib/small-model/routes.js +2 -1
- package/server/lib/system-prompt/runtime.js +2 -21
- package/server/lib/terminal/runtime.js +30 -7
- package/server/lib/ui-auth/ui-auth.js +4 -1
- package/server/lib/ui-auth/ui-auth.test.js +16 -0
- package/server/lib/walkthrough/index.js +1 -0
- package/dist/assets/CommitSection-CC5mFzO2.js +0 -1
- package/dist/assets/GitView-B6y1Y69c.js +0 -6
- package/dist/assets/LinearIssuesView-B0UM_Rkx.js +0 -1
- package/dist/assets/SettingsView-_Gtn5SdT.js +0 -28
- package/dist/assets/ToolPartDiffPreview-DfVOfwHy.js +0 -8
- package/dist/assets/index-C57jT0Sa.css +0 -1
- package/dist/assets/index-b0zDkWyg.js +0 -7
- package/dist/assets/main-D4rd8Hy5.js +0 -928
- package/dist/assets/renderMobileApp-DLfxMzGJ.js +0 -25
- package/dist/assets/runtimeEndpointReset-HlRmXFGW.js +0 -16
- package/dist/assets/tr-aizaUvft.js +0 -6
- package/dist/assets/vendor-zod-BLfBSgBh.js +0 -39
|
@@ -91,6 +91,10 @@ other runtime API.
|
|
|
91
91
|
a blocker instead of a raw 500 message.
|
|
92
92
|
- `call.js` — wire formats and per-provider auth, replicating OpenCode's
|
|
93
93
|
plugin auth loaders:
|
|
94
|
+
- OpenCode-hosted providers receive `x-opencode-session`. Session-backed
|
|
95
|
+
features reuse the real OpenCode session id, walkthrough retries reuse the
|
|
96
|
+
walkthrough cache key, and standalone one-shot actions receive a fresh
|
|
97
|
+
opaque id for that generation.
|
|
94
98
|
- **GitHub Copilot**: fetches the requested model's authenticated `/models`
|
|
95
99
|
metadata from `https://api.githubcopilot.com` (or
|
|
96
100
|
`copilot-api.<enterprise>`) and honors its advertised endpoint, preferring
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import os from 'os';
|
|
3
3
|
import path from 'path';
|
|
4
|
+
import { randomUUID } from 'node:crypto';
|
|
4
5
|
import { readAuthFile, writeAuthFile } from '../opencode/auth.js';
|
|
5
6
|
import { readConfig, readConfigLayers, isPlainObject } from '../opencode/shared.js';
|
|
6
7
|
import { getCatalogProvider } from './catalog.js';
|
|
@@ -645,7 +646,7 @@ export async function resolveProviderLogin({ auth, workingDirectory, providerID
|
|
|
645
646
|
|| null;
|
|
646
647
|
}
|
|
647
648
|
|
|
648
|
-
export async function callSmallModel({ auth, catalog, workingDirectory, providerID, modelID, prompt, system, maxOutputTokens, responseSchema, timeoutMs, signal }) {
|
|
649
|
+
export async function callSmallModel({ auth, catalog, workingDirectory, sessionID, providerID, modelID, prompt, system, maxOutputTokens, responseSchema, timeoutMs, signal }) {
|
|
649
650
|
const tokens = Number(maxOutputTokens) > 0 ? Number(maxOutputTokens) : DEFAULT_MAX_OUTPUT_TOKENS;
|
|
650
651
|
const providerConfig = readProviderConfig(workingDirectory, providerID);
|
|
651
652
|
const runtimeProvider = await getRuntimeProvider(providerID);
|
|
@@ -795,7 +796,12 @@ export async function callSmallModel({ auth, catalog, workingDirectory, provider
|
|
|
795
796
|
baseURL,
|
|
796
797
|
// Configured headers last: a gateway that authenticates on its own header
|
|
797
798
|
// must be able to override the bearer default rather than sit beside it.
|
|
798
|
-
headers: mergeHeadersCaseInsensitive(
|
|
799
|
+
headers: mergeHeadersCaseInsensitive(
|
|
800
|
+
mergeHeadersCaseInsensitive({ Authorization: `Bearer ${apiKey}` }, providerConfig?.headers),
|
|
801
|
+
providerID.startsWith('opencode')
|
|
802
|
+
? { 'x-opencode-session': typeof sessionID === 'string' && sessionID.trim() ? sessionID.trim() : randomUUID() }
|
|
803
|
+
: null,
|
|
804
|
+
),
|
|
799
805
|
modelID,
|
|
800
806
|
prompt,
|
|
801
807
|
system,
|
|
@@ -483,6 +483,29 @@ describe('callSmallModel — custom provider config', () => {
|
|
|
483
483
|
});
|
|
484
484
|
|
|
485
485
|
describe('catalog-based base URL (no config override)', () => {
|
|
486
|
+
it('identifies OpenCode Go requests with the owning conversation', async () => {
|
|
487
|
+
readConfig.mockReturnValue({});
|
|
488
|
+
fetchMock.mockResolvedValue(ok('ok'));
|
|
489
|
+
|
|
490
|
+
await callSmallModel({
|
|
491
|
+
auth: { 'opencode-go': { type: 'api', key: 'go-key' } },
|
|
492
|
+
catalog: {
|
|
493
|
+
'opencode-go': {
|
|
494
|
+
id: 'opencode-go',
|
|
495
|
+
api: 'https://opencode.ai/zen/go/v1',
|
|
496
|
+
models: { utility: { id: 'utility' } },
|
|
497
|
+
},
|
|
498
|
+
},
|
|
499
|
+
workingDirectory: '/proj',
|
|
500
|
+
sessionID: 'ses_conversation',
|
|
501
|
+
providerID: 'opencode-go',
|
|
502
|
+
modelID: 'utility',
|
|
503
|
+
prompt: 'hi',
|
|
504
|
+
});
|
|
505
|
+
|
|
506
|
+
expect(lastCall(fetchMock).init.headers['x-opencode-session']).toBe('ses_conversation');
|
|
507
|
+
});
|
|
508
|
+
|
|
486
509
|
it('uses the catalog api field when no config baseURL is set', async () => {
|
|
487
510
|
readConfig.mockReturnValue({});
|
|
488
511
|
fetchMock.mockResolvedValue(ok('ok'));
|
|
@@ -102,7 +102,7 @@ const readConfiguredSmallModel = (workingDirectory) => {
|
|
|
102
102
|
* Generates text with the user's small model, resolved and authenticated
|
|
103
103
|
* entirely server-side from the OpenCode config and auth store.
|
|
104
104
|
*/
|
|
105
|
-
export async function generateSmallModelText({ prompt, system, maxOutputTokens, model, directory, preferredProviderID, preferredModelID, restrictToPreferredProvider = false, responseSchema, timeoutMs, signal, onOverflow = 'truncate' }) {
|
|
105
|
+
export async function generateSmallModelText({ prompt, system, maxOutputTokens, model, directory, sessionID, preferredProviderID, preferredModelID, restrictToPreferredProvider = false, responseSchema, timeoutMs, signal, onOverflow = 'truncate' }) {
|
|
106
106
|
if (typeof prompt !== 'string' || !prompt.trim()) {
|
|
107
107
|
throw Object.assign(new Error('prompt is required'), { statusCode: 400 });
|
|
108
108
|
}
|
|
@@ -169,6 +169,7 @@ export async function generateSmallModelText({ prompt, system, maxOutputTokens,
|
|
|
169
169
|
auth,
|
|
170
170
|
catalog,
|
|
171
171
|
workingDirectory: directory,
|
|
172
|
+
sessionID,
|
|
172
173
|
providerID: resolved.providerID,
|
|
173
174
|
modelID: resolved.modelID,
|
|
174
175
|
prompt: clamped.prompt,
|
|
@@ -21,13 +21,14 @@ export function registerSmallModelRoutes(app, { getSmallModelService }) {
|
|
|
21
21
|
app.post('/api/small-model/generate', async (req, res) => {
|
|
22
22
|
try {
|
|
23
23
|
const { generateSmallModelText } = await getSmallModelService();
|
|
24
|
-
const { prompt, system, maxOutputTokens, model, directory, preferredProviderID, preferredModelID, restrictToPreferredProvider } = req.body || {};
|
|
24
|
+
const { prompt, system, maxOutputTokens, model, directory, sessionID, preferredProviderID, preferredModelID, restrictToPreferredProvider } = req.body || {};
|
|
25
25
|
const result = await generateSmallModelText({
|
|
26
26
|
prompt,
|
|
27
27
|
system,
|
|
28
28
|
maxOutputTokens,
|
|
29
29
|
model,
|
|
30
30
|
directory,
|
|
31
|
+
sessionID,
|
|
31
32
|
preferredProviderID,
|
|
32
33
|
preferredModelID,
|
|
33
34
|
restrictToPreferredProvider: restrictToPreferredProvider === true,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { parse as parseJsonc } from 'jsonc-parser';
|
|
2
1
|
import { pathToFileURL } from 'node:url';
|
|
2
|
+
import { appendManagedPlugin } from '../opencode/managed-plugin-config.js';
|
|
3
3
|
|
|
4
4
|
const PROVIDER_PROMPT_BOUNDARY = 'You are powered by the model named';
|
|
5
5
|
const MINIMAL_IDENTITY = 'You are OpenCode, a coding agent.';
|
|
@@ -33,25 +33,6 @@ export const OpenChamberSystemPromptPlugin = async () => ({
|
|
|
33
33
|
})
|
|
34
34
|
`;
|
|
35
35
|
|
|
36
|
-
const mergePluginConfig = (rawConfig, pluginUrl) => {
|
|
37
|
-
const errors = [];
|
|
38
|
-
const parsed = typeof rawConfig === 'string' && rawConfig.trim()
|
|
39
|
-
? parseJsonc(rawConfig, errors, { allowTrailingComma: true })
|
|
40
|
-
: {};
|
|
41
|
-
if (errors.length > 0 || !parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
|
|
42
|
-
throw new Error('OPENCODE_CONFIG_CONTENT must contain a valid JSON object before OpenChamber can inject its system prompt optimizer');
|
|
43
|
-
}
|
|
44
|
-
if (parsed.plugin !== undefined && !Array.isArray(parsed.plugin)) {
|
|
45
|
-
throw new Error('OPENCODE_CONFIG_CONTENT plugin must be an array before OpenChamber can inject its system prompt optimizer');
|
|
46
|
-
}
|
|
47
|
-
const configured = Array.isArray(parsed.plugin) ? parsed.plugin : [];
|
|
48
|
-
parsed.plugin = [
|
|
49
|
-
...configured.filter((value) => value !== pluginUrl && (!Array.isArray(value) || value[0] !== pluginUrl)),
|
|
50
|
-
pluginUrl,
|
|
51
|
-
];
|
|
52
|
-
return JSON.stringify(parsed);
|
|
53
|
-
};
|
|
54
|
-
|
|
55
36
|
export const createSystemPromptRuntime = ({ fsPromises, path, dataDir }) => {
|
|
56
37
|
const pluginDirectory = path.join(dataDir, 'system-prompt');
|
|
57
38
|
const pluginPath = path.join(pluginDirectory, 'openchamber-system-prompt-plugin.js');
|
|
@@ -60,7 +41,7 @@ export const createSystemPromptRuntime = ({ fsPromises, path, dataDir }) => {
|
|
|
60
41
|
await fsPromises.mkdir(pluginDirectory, { recursive: true });
|
|
61
42
|
await fsPromises.writeFile(pluginPath, createPluginSource(), { mode: 0o600 });
|
|
62
43
|
return {
|
|
63
|
-
OPENCODE_CONFIG_CONTENT:
|
|
44
|
+
OPENCODE_CONFIG_CONTENT: appendManagedPlugin(rawConfig, pathToFileURL(pluginPath).href, 'system prompt optimizer'),
|
|
64
45
|
};
|
|
65
46
|
};
|
|
66
47
|
|
|
@@ -276,16 +276,39 @@ export function createTerminalRuntime({
|
|
|
276
276
|
|
|
277
277
|
const upgradeHandler = (req, socket, head) => {
|
|
278
278
|
if (parseRequestPathname(req.url) !== TERMINAL_WS_PATH) return;
|
|
279
|
-
|
|
279
|
+
const accept = () => {
|
|
280
|
+
if (!wsServer) { rejectWebSocketUpgrade(socket, 500, 'Terminal WebSocket unavailable'); return; }
|
|
280
281
|
try {
|
|
281
|
-
if (uiAuthController?.enabled) {
|
|
282
|
-
if (!await uiAuthController.ensureSessionToken(req, null)) { rejectWebSocketUpgrade(socket, 401, 'UI authentication required'); return; }
|
|
283
|
-
if (!await isRequestOriginAllowed(req)) { rejectWebSocketUpgrade(socket, 403, 'Invalid origin'); return; }
|
|
284
|
-
}
|
|
285
|
-
if (!wsServer) { rejectWebSocketUpgrade(socket, 500, 'Terminal WebSocket unavailable'); return; }
|
|
286
282
|
wsServer.handleUpgrade(req, socket, head, (ws) => wsServer.emit('connection', ws, req));
|
|
287
283
|
} catch { rejectWebSocketUpgrade(socket, 500, 'Upgrade failed'); }
|
|
288
|
-
}
|
|
284
|
+
};
|
|
285
|
+
const checkOrigin = () => {
|
|
286
|
+
try {
|
|
287
|
+
const result = isRequestOriginAllowed(req);
|
|
288
|
+
if (!(result instanceof Promise)) {
|
|
289
|
+
if (result) accept();
|
|
290
|
+
else rejectWebSocketUpgrade(socket, 403, 'Invalid origin');
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
void result.then((allowed) => {
|
|
294
|
+
if (allowed) accept();
|
|
295
|
+
else rejectWebSocketUpgrade(socket, 403, 'Invalid origin');
|
|
296
|
+
}).catch(() => rejectWebSocketUpgrade(socket, 500, 'Upgrade failed'));
|
|
297
|
+
} catch { rejectWebSocketUpgrade(socket, 500, 'Upgrade failed'); }
|
|
298
|
+
};
|
|
299
|
+
if (!uiAuthController?.enabled) { accept(); return; }
|
|
300
|
+
try {
|
|
301
|
+
const result = uiAuthController.ensureSessionToken(req, null);
|
|
302
|
+
if (!(result instanceof Promise)) {
|
|
303
|
+
if (result) checkOrigin();
|
|
304
|
+
else rejectWebSocketUpgrade(socket, 401, 'UI authentication required');
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
void result.then((sessionToken) => {
|
|
308
|
+
if (sessionToken) checkOrigin();
|
|
309
|
+
else rejectWebSocketUpgrade(socket, 401, 'UI authentication required');
|
|
310
|
+
}).catch(() => rejectWebSocketUpgrade(socket, 500, 'Upgrade failed'));
|
|
311
|
+
} catch { rejectWebSocketUpgrade(socket, 500, 'Upgrade failed'); }
|
|
289
312
|
};
|
|
290
313
|
server.on('upgrade', upgradeHandler);
|
|
291
314
|
|
|
@@ -310,6 +310,7 @@ const isUrlAuthWebSocketPath = (pathname) => {
|
|
|
310
310
|
|| pathname === '/api/openchamber/realtime-proxy/ws'
|
|
311
311
|
|| pathname === '/api/terminal/ws'
|
|
312
312
|
|| pathname === '/api/dictation/ws'
|
|
313
|
+
|| pathname === '/api/dev-tunnel'
|
|
313
314
|
|| pathname.startsWith('/api/preview/proxy/');
|
|
314
315
|
};
|
|
315
316
|
|
|
@@ -984,7 +985,9 @@ export const createUiAuth = ({
|
|
|
984
985
|
handlePasskeyList,
|
|
985
986
|
handlePasskeyRevoke,
|
|
986
987
|
handleResetAuth,
|
|
987
|
-
ensureSessionToken:
|
|
988
|
+
ensureSessionToken: (req, _res) => {
|
|
989
|
+
const urlAuth = authenticateUrlAuthToken(req);
|
|
990
|
+
if (urlAuth) return clientSessionToken(urlAuth);
|
|
988
991
|
return resolveAuthenticatedSessionToken(req);
|
|
989
992
|
},
|
|
990
993
|
dispose,
|
|
@@ -221,6 +221,22 @@ describe('ui auth client credential seam', () => {
|
|
|
221
221
|
};
|
|
222
222
|
expect(await auth.ensureSessionToken(dictationWsReq, null)).toBe('client:device-1');
|
|
223
223
|
|
|
224
|
+
const devTunnelWsReq = {
|
|
225
|
+
method: 'GET',
|
|
226
|
+
path: '/api/dev-tunnel',
|
|
227
|
+
url: `/api/dev-tunnel?port=4322&oc_url_token=${encodeURIComponent(urlToken)}`,
|
|
228
|
+
headers: { upgrade: 'websocket' },
|
|
229
|
+
};
|
|
230
|
+
expect(await auth.ensureSessionToken(devTunnelWsReq, null)).toBe('client:device-1');
|
|
231
|
+
|
|
232
|
+
const devTunnelSubpathWsReq = {
|
|
233
|
+
method: 'GET',
|
|
234
|
+
path: '/api/dev-tunnel/private',
|
|
235
|
+
url: `/api/dev-tunnel/private?port=4322&oc_url_token=${encodeURIComponent(urlToken)}`,
|
|
236
|
+
headers: { upgrade: 'websocket' },
|
|
237
|
+
};
|
|
238
|
+
expect(await auth.ensureSessionToken(devTunnelSubpathWsReq, null)).toBe(null);
|
|
239
|
+
|
|
224
240
|
const dictationHttpReq = {
|
|
225
241
|
method: 'GET',
|
|
226
242
|
path: '/api/dictation/ws',
|
|
@@ -474,6 +474,7 @@ async function runGeneration({ directory, source, repoRoot, key, force, explicit
|
|
|
474
474
|
prompt: options.prompt,
|
|
475
475
|
system: options.system,
|
|
476
476
|
directory,
|
|
477
|
+
sessionID: `openchamber-walkthrough-${cacheKey}`,
|
|
477
478
|
model: `${model.providerID}/${model.modelID}`,
|
|
478
479
|
responseSchema: options.responseSchema,
|
|
479
480
|
onOverflow: 'error',
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{R as S,f as oe,j as s}from"./vendor-react-BUCujlKS.js";import{u as Ae}from"./vendor-tanstack-react-virtual-g05Cx3z9.js";import{f as Q,ap as ze,a6 as fe,a7 as me,I as R,a8 as ue,h as Z,B as J,a1 as Ee,h4 as Ie,bG as pe,bH as ge,bI as xe,bJ as be,bK as ye,bL as ve,b5 as Te}from"./useAppFontEffects-DWXGRUPZ.js";import{u as Ce}from"./index-b0zDkWyg.js";const ke={"?":{code:"?",color:"var(--status-info)",description:"Untracked file"},A:{code:"A",color:"var(--status-success)",description:"New file"},D:{code:"D",color:"var(--status-error)",description:"Deleted file"},R:{code:"R",color:"var(--status-info)",description:"Renamed file"},C:{code:"C",color:"var(--status-info)",description:"Copied file"},M:{code:"M",color:"var(--status-warning)",description:"Modified file"}},Me=ke.M;function He(p){const e=p.index?.trim(),t=p.working_dir?.trim();return e&&e!=="?"?e.charAt(0):t?t.charAt(0):e?.charAt(0)||t?.charAt(0)||"M"}function Re(p){const e=He(p);return ke[e]??Me}const $e=S.memo(function(e){const t=oe.c(58),{file:o,actionLabel:x,actionSymbol:b,onAction:m,onViewDiff:f,onRevert:l,isReverting:d,stats:z,rowPaddingClassName:g,indentPx:y,actionAtStart:A,showRevert:$}=e,j=y===void 0?0:y,r=A===void 0?!1:A,w=$===void 0?!0:$;let N;t[0]!==o?(N=Re(o),t[0]=o,t[1]=N):N=t[1];const h=N,{t:E}=Q(),F=h.description,M=z?.insertions??0,C=z?.deletions??0;let D;t[2]!==m||t[3]!==f?(D=U=>{U.key===" "?(U.preventDefault(),m()):U.key==="Enter"&&(U.preventDefault(),f())},t[2]=m,t[3]=f,t[4]=D):D=t[4];const V=D;let I;t[5]!==m?(I=U=>{U.preventDefault(),U.stopPropagation(),m()},t[5]=m,t[6]=I):I=t[6];const u=I;let P;t[7]!==l?(P=U=>{U.preventDefault(),U.stopPropagation(),l()},t[7]=l,t[8]=P):P=t[8];const W=P;let L;t[9]!==x||t[10]!==b||t[11]!==u?(L=s.jsx("button",{type:"button",onClick:u,className:"flex size-5 shrink-0 items-center justify-center rounded typography-micro font-semibold text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]","aria-label":x,title:x,children:b}),t[9]=x,t[10]=b,t[11]=u,t[12]=L):L=t[12];const H=L,X=`group flex items-center gap-2 py-1.5 cursor-pointer ${g??"px-3"}`;let T;t[13]!==j?(T=j>0?{paddingLeft:`${j}px`}:void 0,t[13]=j,t[14]=T):T=t[14];const Y=r?H:null;let K;t[15]!==h.color?(K={color:h.color},t[15]=h.color,t[16]=K):K=t[16];let G;t[17]!==h.code||t[18]!==F||t[19]!==K?(G=s.jsx("span",{className:"typography-micro font-semibold w-4 text-center uppercase",style:K,title:F,"aria-label":F,children:h.code}),t[17]=h.code,t[18]=F,t[19]=K,t[20]=G):G=t[20];let O;t[21]!==o.path?(O=s.jsx(ze,{filePath:o.path,className:"h-3.5 w-3.5 shrink-0"}),t[21]=o.path,t[22]=O):O=t[22];let B;if(t[23]!==o.path){e:{const U=o.path.lastIndexOf("/");if(U===-1){let ne;t[25]===Symbol.for("react.memo_cache_sentinel")?(ne={direction:"rtl",textAlign:"left",unicodeBidi:"plaintext"},t[25]=ne):ne=t[25],B=s.jsx("span",{className:"flex-1 min-w-0 truncate typography-ui-label text-foreground",style:ne,title:o.path,children:o.path});break e}const De=o.path.slice(0,U),Ve=o.path.slice(U);let te;t[26]===Symbol.for("react.memo_cache_sentinel")?(te={direction:"rtl",textAlign:"left",unicodeBidi:"plaintext"},t[26]=te):te=t[26];let se;t[27]===Symbol.for("react.memo_cache_sentinel")?(se=s.jsx("span",{className:"text-muted-foreground",children:"/"}),t[27]=se):se=t[27];const re=s.jsx("span",{className:"text-foreground",children:Ve.slice(1)});let ie;t[28]!==re?(ie=s.jsxs("span",{className:"flex-shrink-0 typography-ui-label",children:[se,re]}),t[28]=re,t[29]=ie):ie=t[29],B=s.jsxs("span",{className:"flex-1 min-w-0 flex items-baseline overflow-hidden",title:o.path,children:[s.jsx("span",{className:"min-w-0 truncate typography-ui-label text-muted-foreground",style:te,children:De}),ie]})}t[23]=o.path,t[24]=B}else B=t[24];let q;t[30]===Symbol.for("react.memo_cache_sentinel")?(q={color:"var(--status-success)"},t[30]=q):q=t[30];let i;t[31]!==M?(i=s.jsxs("span",{style:q,children:["+",M]}),t[31]=M,t[32]=i):i=t[32];let n,a;t[33]===Symbol.for("react.memo_cache_sentinel")?(n=s.jsx("span",{className:"text-muted-foreground mx-0.5",children:"/"}),a={color:"var(--status-error)"},t[33]=n,t[34]=a):(n=t[33],a=t[34]);let c;t[35]!==C?(c=s.jsxs("span",{style:a,children:["-",C]}),t[35]=C,t[36]=c):c=t[36];let k;t[37]!==i||t[38]!==c?(k=s.jsxs("span",{className:"shrink-0 typography-micro",children:[i,n,c]}),t[37]=i,t[38]=c,t[39]=k):k=t[39];let v;t[40]!==o.path||t[41]!==W||t[42]!==d||t[43]!==w||t[44]!==E?(v=w?s.jsxs(fe,{children:[s.jsx(me,{asChild:!0,children:s.jsx("button",{type:"button",onClick:W,disabled:d,className:"flex size-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary disabled:cursor-not-allowed disabled:opacity-50","aria-label":E("gitView.changes.revertFileAria",{path:o.path}),children:d?s.jsx(R,{name:"loader-4",className:"size-3.5 animate-spin"}):s.jsx(R,{name:"arrow-go-back",className:"size-3.5"})})}),s.jsx(ue,{sideOffset:8,children:E("gitView.changes.revertFileTooltip")})]}):null,t[40]=o.path,t[41]=W,t[42]=d,t[43]=w,t[44]=E,t[45]=v):v=t[45];const _=r?null:H;let ee;return t[46]!==V||t[47]!==f||t[48]!==T||t[49]!==Y||t[50]!==G||t[51]!==O||t[52]!==B||t[53]!==k||t[54]!==v||t[55]!==_||t[56]!==X?(ee=s.jsxs("div",{className:X,role:"button",tabIndex:0,onClick:f,onKeyDown:V,style:T,children:[Y,G,O,B,k,v,_]}),t[46]=V,t[47]=f,t[48]=T,t[49]=Y,t[50]=G,t[51]=O,t[52]=B,t[53]=k,t[54]=v,t[55]=_,t[56]=X,t[57]=ee):ee=t[57],ee}),je=14,Se=p=>p.replace(/\\/g,"/").replace(/^\/+/,"").trim(),we=(p,e)=>({id:`dir:${p}`,path:p,name:e,children:new Map,directFiles:[],files:[]}),Fe=p=>{const e=we("","");for(const t of p){const o=Se(t.path);if(!o)continue;const b=o.split("/").filter(Boolean).slice(0,-1);let m=e;if(m.files.push(t),b.length>0){let f="";for(const l of b){f=f?`${f}/${l}`:l;const d=m.children.get(l);if(d){d.files.push(t),m=d;continue}const z=we(f,l);z.files.push(t),m.children.set(l,z),m=z}}m.directFiles.push(t)}return e},Pe=(p,e)=>{const t=[],o=(x,b)=>{const m=Array.from(x.children.values()).sort((l,d)=>l.path.localeCompare(d.path));for(const l of m)t.push({key:l.id,kind:"directory",depth:b,directory:l}),e.has(l.path)&&o(l,b+1);const f=[...x.directFiles].sort((l,d)=>l.path.localeCompare(d.path));for(const l of f)t.push({key:`file:${Se(l.path)}`,kind:"file",depth:b,file:l})};return o(p,0),t},Le=1e3,Ne=34,ce=30,le="pl-0 pr-2",de=(p,e)=>`${p} ${e}`,Ye=({groups:p,diffStats:e,revertingPaths:t,isRevertingAll:o=!1,headerBackgroundClassName:x="bg-sidebar",onVisiblePathsChange:b,onRevertAll:m,onRevertDirectory:f})=>{const{t:l}=Q(),d=S.useRef(null),g=Ce(i=>i.gitChangesViewMode)==="tree",y=S.useMemo(()=>p.filter(i=>i.entries.length>0),[p]),[A,$]=S.useState(new Set),[j,r]=S.useState(new Set),[w,N]=S.useState(!1),[h,E]=S.useState(null),F=S.useMemo(()=>y.map(i=>Fe(i.entries)),[y]),M=S.useMemo(()=>{const i=[];return y.forEach((n,a)=>{Array.from(F[a]?.children.values()??[]).forEach(c=>{i.push(de(n.id,c.path))})}),i},[F,y]);S.useEffect(()=>{g&&r(i=>{const n=new Set,a=new Set(M);return i.forEach(c=>{(c.slice(c.indexOf(" ")+1).includes("/")||a.has(c))&&n.add(c)}),M.forEach(c=>n.add(c)),n})},[g,M]);const C=S.useMemo(()=>{const i=[];return y.forEach((n,a)=>{if(i.push({type:"header",key:`header:${n.id}`,groupIndex:a}),!A.has(n.id)){if(g){const c=new Set;j.forEach(v=>{v.startsWith(`${n.id} `)&&c.add(v.slice(n.id.length+1))}),Pe(F[a],c).forEach(v=>{v.kind==="file"?i.push({type:"file",key:`${n.id}:${v.key}`,groupIndex:a,file:v.file,depth:v.depth}):i.push({type:"directory",key:`${n.id}:${v.key}`,groupIndex:a,directory:v.directory,depth:v.depth})});return}n.entries.forEach(c=>{i.push({type:"file",key:`${n.id}:file:${c.path}`,groupIndex:a,file:c,depth:0})})}}),m&&y.length>0&&i.push({type:"revert-all",key:"revert-all"}),i},[A,j,g,m,F,y]),D=C.length,V=D>=Le,I=Ae({count:D,enabled:V,getScrollElement:()=>d.current,estimateSize:()=>Ne,overscan:12,getItemKey:i=>C[i]?.key??i}),u=I.getVirtualItems(),P=S.useMemo(()=>{if(!V)return 0;const i=d.current?.scrollTop??0;return u.find(a=>a.end>i)?.index??0},[V,u,d]);S.useEffect(()=>{if(!b)return;const i=n=>n&&n.type==="file"?n.file.path:null;if(D===0){b([]);return}if(!V){const n=[];for(const a of C)if(a.type==="file"&&(n.push(a.file.path),n.length>=ce))break;b(n);return}b(C.slice(P,P+Math.ceil((d.current?.clientHeight??0)/Ne)+ce).map(n=>i(n)).filter(n=>!!n).slice(0,ce))},[b,D,C,V,P]);const W=S.useCallback(i=>{$(n=>{const a=new Set(n);return a.has(i)?a.delete(i):a.add(i),a})},[]),L=S.useCallback((i,n)=>{r(a=>{const c=new Set(a),k=de(i,n);return c.has(k)?c.delete(k):c.add(k),c})},[]),H=S.useMemo(()=>{const i=new Set;return y.forEach(n=>n.entries.forEach(a=>i.add(a.path))),Array.from(i)},[y]),X=H.length,T=h?o||h.paths.some(i=>t.has(i)):!1,Y=S.useCallback(async()=>{!m||o||H.length===0||(await m(H),N(!1))},[H,o,m]),K=S.useCallback(async()=>{!f||!h||T||(await f(h.paths),E(null))},[T,f,h]),G=S.useCallback((i,n)=>{const a=A.has(i.id),c=i.entries.length;return s.jsxs("div",{className:Z("sticky top-0 z-10 flex items-center gap-2 py-2",x,le,!n&&"mt-1 border-t border-border/40"),children:[s.jsx("button",{type:"button",onClick:()=>i.onActionAll(i.entries.map(k=>k.path)),className:"flex size-5 shrink-0 items-center justify-center rounded typography-micro font-semibold text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]","aria-label":i.actionAllLabel,title:i.actionAllLabel,children:i.actionSymbol}),s.jsxs("button",{type:"button",onClick:()=>W(i.id),className:"flex min-w-0 flex-1 items-center gap-2 rounded text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]","aria-expanded":!a,children:[s.jsx("h3",{className:"truncate typography-ui-header font-semibold text-foreground",children:i.title}),s.jsx("span",{className:"typography-meta text-muted-foreground",children:c}),s.jsx(R,{name:"arrow-down-s",className:Z("size-3.5 shrink-0 text-muted-foreground transition-transform",a&&"-rotate-90")})]})]})},[A,x,W]),O=S.useCallback((i,n,a)=>{const c=j.has(de(i.id,n.path)),k=n.files.map(_=>_.path),v=o||k.some(_=>t.has(_));return s.jsxs("div",{className:Z("group flex items-center gap-2 py-1.5",le),style:{paddingLeft:`${a*je}px`},children:[s.jsxs("button",{type:"button",onClick:()=>L(i.id,n.path),className:"flex min-w-0 flex-1 items-center gap-2 rounded text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary","aria-label":c?l("gitView.changes.collapseDirectoryAria",{path:n.path}):l("gitView.changes.expandDirectoryAria",{path:n.path}),children:[c?s.jsx(R,{name:"folder-open-fill",className:"h-4 w-4 flex-shrink-0 text-primary/60"}):s.jsx(R,{name:"folder-3-fill",className:"h-4 w-4 flex-shrink-0 text-primary/60"}),s.jsx("span",{className:"min-w-0 flex-1 truncate typography-ui-label text-foreground",title:n.path,children:n.name}),s.jsx("span",{className:"ml-auto shrink-0 typography-micro text-muted-foreground",children:n.files.length})]}),i.showRevertActions!==!1&&f?s.jsx("button",{type:"button",onClick:()=>E({path:n.path,paths:k,count:k.length}),disabled:v,className:"flex size-5 shrink-0 items-center justify-center rounded text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)] disabled:cursor-not-allowed disabled:opacity-50","aria-label":l("gitView.changes.revertDirectoryAria",{path:n.path}),title:l("gitView.changes.revertDirectoryTooltip"),children:v?s.jsx(R,{name:"loader-4",className:"size-3.5 animate-spin"}):s.jsx(R,{name:"arrow-go-back",className:"size-3.5"})}):null,s.jsx("button",{type:"button",onClick:()=>i.onActionAll(n.files.map(_=>_.path)),className:"flex size-5 shrink-0 items-center justify-center rounded typography-micro font-semibold text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]","aria-label":l(i.actionSymbol==="+"?"gitView.changes.stageDirectoryAria":"gitView.changes.unstageDirectoryAria",{path:n.path}),title:l(i.actionSymbol==="+"?"gitView.changes.stageDirectoryAria":"gitView.changes.unstageDirectoryAria",{path:n.path}),children:i.actionSymbol})]})},[j,o,f,t,l,L]),B=S.useCallback((i,n)=>{if(i.type==="revert-all")return s.jsx("div",{className:Z("flex justify-end py-2",le),children:s.jsxs(J,{variant:"ghost",size:"sm",onClick:()=>N(!0),disabled:o,className:"gap-1.5 text-[var(--status-error)] hover:bg-[var(--status-error)]/10 hover:text-[var(--status-error)]",children:[s.jsx(R,{name:"arrow-go-back",className:"size-3.5"}),l("gitView.changes.revertAll")]})});const a=y[i.groupIndex];if(!a)return null;if(i.type==="header")return G(a,n);if(i.type==="directory")return O(a,i.directory,i.depth);const c=i.file;return s.jsx($e,{file:c,actionLabel:a.getActionLabel(c.path),actionSymbol:a.actionSymbol,onAction:()=>a.onActionFile(c.path),stats:e?.[c.path],onViewDiff:()=>a.onViewDiff(c.path),onRevert:()=>a.onRevertFile(c.path),isReverting:t.has(c.path)||o,rowPaddingClassName:le,indentPx:i.depth*je,actionAtStart:!g,showRevert:a.showRevertActions!==!1})},[e,o,g,O,G,t,l,y]),q=S.useCallback(i=>{const n=C[i],a=C[i-1];return!n||!a||n.type!=="file"&&n.type!=="directory"||a.type!=="file"&&a.type!=="directory"?!1:a.groupIndex===n.groupIndex},[C]);return s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"relative flex h-full min-h-0 w-full flex-col overflow-hidden",children:[s.jsx(Ee,{ref:d,className:"overlay-scrollbar-target overlay-scrollbar-container min-h-0 w-full flex-1 overflow-x-hidden overflow-y-auto",children:V?s.jsx("div",{style:{height:I.getTotalSize(),position:"relative"},children:u.map(i=>{const n=C[i.index];return n?s.jsx("div",{"data-index":i.index,ref:I.measureElement,style:{position:"absolute",top:0,left:0,width:"100%",transform:`translateY(${i.start}px)`},className:Z(q(i.index)&&"before:pointer-events-none before:absolute before:left-0 before:right-2 before:top-0 before:border-t before:border-border/60"),children:B(n,i.index===0)},n.key):null})}):s.jsx("div",{role:"list","aria-label":l("gitView.changes.changedFilesAria"),children:C.map((i,n)=>s.jsx("div",{className:Z("relative",q(n)&&"before:pointer-events-none before:absolute before:left-0 before:right-2 before:top-0 before:border-t before:border-border/60"),children:B(i,n===0)},i.key))})}),s.jsx(Ie,{containerRef:d,disableHorizontal:!0})]}),s.jsx(pe,{open:w,onOpenChange:i=>{!o&&!i&&N(!1)},children:s.jsxs(ge,{className:"max-w-md",children:[s.jsxs(xe,{children:[s.jsx(be,{children:l("gitView.changes.revertAllDialogTitle")}),s.jsx(ye,{children:X===1?l("gitView.changes.revertAllDescriptionSingle",{count:X}):l("gitView.changes.revertAllDescriptionPlural",{count:X})})]}),s.jsxs(ve,{children:[s.jsx(J,{variant:"outline",size:"sm",onClick:()=>N(!1),disabled:o,children:l("gitView.common.cancel")}),s.jsx(J,{variant:"destructive",size:"sm",onClick:()=>{Y()},disabled:o,children:l(o?"gitView.changes.reverting":"gitView.changes.revertAll")})]})]})}),s.jsx(pe,{open:!!h,onOpenChange:i=>{!T&&!i&&E(null)},children:s.jsxs(ge,{className:"max-w-md",children:[s.jsxs(xe,{children:[s.jsx(be,{children:l("gitView.changes.revertDirectoryDialogTitle")}),s.jsx(ye,{children:h?h.count===1?l("gitView.changes.revertDirectoryDescriptionSingle",{count:h.count,path:h.path}):l("gitView.changes.revertDirectoryDescriptionPlural",{count:h.count,path:h.path}):null})]}),s.jsxs(ve,{children:[s.jsx(J,{variant:"outline",size:"sm",onClick:()=>E(null),disabled:T,children:l("gitView.common.cancel")}),s.jsx(J,{variant:"destructive",size:"sm",onClick:()=>{K()},disabled:T||!h,children:l(T?"gitView.changes.reverting":"gitView.changes.revertDirectory")})]})]})})]})},he=38,ae=200,Ge=p=>{const e=oe.c(23),{value:t,onChange:o,onSubmit:x,placeholder:b,disabled:m,hasTouchInput:f,isMobile:l}=p,d=m===void 0?!1:m,z=f===void 0?!1:f,g=l===void 0?!1:l,{t:y}=Q(),A=S.useRef(null),$=Ce(Oe);let j;e[0]===Symbol.for("react.memo_cache_sentinel")?(j=()=>{const u=A.current;if(!u)return;const P=document.activeElement===u,W=()=>{u.style.height=`${he}px`;const H=u.scrollHeight,X=Math.min(Math.max(H,he),ae);u.style.height=`${X}px`,u.style.overflowY=H>ae?"auto":"hidden",H>ae&&!P&&(u.scrollTop=u.scrollHeight)};W();const L=window.requestAnimationFrame(W);return()=>{window.cancelAnimationFrame(L)}},e[0]=j):j=e[0];let r;e[1]!==t?(r=[t],e[1]=t,e[2]=r):r=e[2],S.useLayoutEffect(j,r);let w;e[3]!==o?(w=u=>o(u.target.value),e[3]=o,e[4]=w):w=e[4];let N;e[5]!==x?(N=u=>{u.key==="Enter"&&(u.metaKey||u.ctrlKey)&&!u.shiftKey&&!u.altKey&&(u.preventDefault(),x?.())},e[5]=x,e[6]=N):N=e[6];let h;e[7]!==b||e[8]!==y?(h=b??y("gitView.commit.messagePlaceholder"),e[7]=b,e[8]=y,e[9]=h):h=e[9];const E=z?"on":"off",F=z?"sentences":"off",M=g||$,C=d&&"opacity-50";let D;e[10]!==C?(D=Z("w-full rounded-lg border border-border/60 bg-surface-elevated px-3 py-2 typography-ui-label text-foreground placeholder:text-muted-foreground","resize-none outline-none transition-[border-color,box-shadow] duration-150","focus-visible:ring-2 focus-visible:ring-[var(--interactive-focus-ring)]",C),e[10]=C,e[11]=D):D=e[11];let V;e[12]===Symbol.for("react.memo_cache_sentinel")?(V={minHeight:he,maxHeight:ae},e[12]=V):V=e[12];let I;return e[13]!==d||e[14]!==F||e[15]!==M||e[16]!==D||e[17]!==w||e[18]!==N||e[19]!==h||e[20]!==E||e[21]!==t?(I=s.jsx("textarea",{ref:A,value:t,onChange:w,onKeyDown:N,placeholder:h,rows:1,disabled:d,autoCorrect:E,autoCapitalize:F,spellCheck:M,className:D,style:V}),e[13]=d,e[14]=F,e[15]=M,e[16]=D,e[17]=w,e[18]=N,e[19]=h,e[20]=E,e[21]=t,e[22]=I):I=e[22],I};function Oe(p){return p.inputSpellcheckEnabled}const Ke=p=>{const e=oe.c(30),{highlights:t,onInsert:o}=p,{t:x}=Q();if(t.length===0)return null;let b;e[0]!==t||e[1]!==o?(b=()=>{o(t)},e[0]=t,e[1]=o,e[2]=b):b=e[2];const m=b;let f;e[3]!==x?(f=x("gitView.commit.aiHighlights.title"),e[3]=x,e[4]=f):f=e[4];let l;e[5]!==f?(l=s.jsx("p",{className:"typography-micro text-muted-foreground",children:f}),e[5]=f,e[6]=l):l=e[6];let d;e[7]!==x?(d=x("gitView.commit.aiHighlights.insertAria"),e[7]=x,e[8]=d):d=e[8];let z;e[9]===Symbol.for("react.memo_cache_sentinel")?(z=s.jsx(R,{name:"arrow-down",className:"size-4"}),e[9]=z):z=e[9];let g;e[10]!==m||e[11]!==d?(g=s.jsx(me,{asChild:!0,children:s.jsx(J,{variant:"ghost",size:"icon",className:"size-6",onClick:m,"aria-label":d,children:z})}),e[10]=m,e[11]=d,e[12]=g):g=e[12];let y;e[13]!==x?(y=x("gitView.commit.aiHighlights.insertTooltip"),e[13]=x,e[14]=y):y=e[14];let A;e[15]!==y?(A=s.jsx(ue,{sideOffset:8,children:y}),e[15]=y,e[16]=A):A=e[16];let $;e[17]!==g||e[18]!==A?($=s.jsxs(fe,{children:[g,A]}),e[17]=g,e[18]=A,e[19]=$):$=e[19];let j;e[20]!==l||e[21]!==$?(j=s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[l,$]}),e[20]=l,e[21]=$,e[22]=j):j=e[22];let r;e[23]!==t?(r=t.map(Be),e[23]=t,e[24]=r):r=e[24];let w;e[25]!==r?(w=s.jsx("ul",{className:"space-y-1",children:r}),e[25]=r,e[26]=w):w=e[26];let N;return e[27]!==j||e[28]!==w?(N=s.jsxs("div",{className:"space-y-2 rounded-xl border border-border/60 bg-transparent px-3 py-2",children:[j,w]}),e[27]=j,e[28]=w,e[29]=N):N=e[29],N};function Be(p,e){return s.jsx("li",{className:"typography-meta text-foreground",children:p},`${p}-${e}`)}const qe=p=>{const e=oe.c(80),{stagedCount:t,commitMessage:o,onCommitMessageChange:x,generatedHighlights:b,onInsertHighlights:m,onGenerateMessage:f,isGeneratingMessage:l,onCommit:d,onCommitAndPush:z,commitAction:g,hasPendingIndexMutation:y,gitmojiEnabled:A,onOpenGitmojiPicker:$}=p,j=y===void 0?!1:y,{t:r}=Q(),w=t>0;let N;e[0]!==g||e[1]!==o||e[2]!==j||e[3]!==w?(N=o.trim()&&w&&g===null&&!j,e[0]=g,e[1]=o,e[2]=j,e[3]=w,e[4]=N):N=e[4];const h=N,{isMobile:E,hasTouchInput:F}=Te();let M;e[5]!==r?(M=r("gitView.commit.title"),e[5]=r,e[6]=M):M=e[6];let C;e[7]!==M?(C=s.jsx("h3",{className:"typography-ui-header font-semibold text-foreground",children:M}),e[7]=M,e[8]=C):C=e[8];let D;e[9]!==w||e[10]!==r?(D=w?null:s.jsx("span",{className:"min-w-0 truncate typography-meta text-muted-foreground",children:r("gitView.commit.stageFilesHint")}),e[9]=w,e[10]=r,e[11]=D):D=e[11];let V;e[12]!==C||e[13]!==D?(V=s.jsxs("div",{className:"flex w-full items-baseline gap-2 px-0 pt-2 pb-1",children:[C,D]}),e[12]=C,e[13]=D,e[14]=V):V=e[14];let I;e[15]!==b||e[16]!==m?(I=s.jsx(Ke,{highlights:b,onInsert:m}),e[15]=b,e[16]=m,e[17]=I):I=e[17];let u;e[18]!==h||e[19]!==l||e[20]!==d?(u=()=>{h&&!l&&d()},e[18]=h,e[19]=l,e[20]=d,e[21]=u):u=e[21];let P;e[22]!==r?(P=r("gitView.commit.messagePlaceholder"),e[22]=r,e[23]=P):P=e[23];const W=g!==null;let L;e[24]!==o||e[25]!==F||e[26]!==E||e[27]!==x||e[28]!==W||e[29]!==u||e[30]!==P?(L=s.jsx(Ge,{value:o,onChange:x,onSubmit:u,placeholder:P,disabled:W,hasTouchInput:F,isMobile:E}),e[24]=o,e[25]=F,e[26]=E,e[27]=x,e[28]=W,e[29]=u,e[30]=P,e[31]=L):L=e[31];let H;e[32]!==A||e[33]!==$||e[34]!==r?(H=A&&s.jsxs(J,{variant:"outline",size:"sm",onClick:$,className:"w-fit",type:"button",children:[s.jsx(R,{name:"emotion-happy",className:"size-4"}),r("gitView.commit.addGitmoji")]}),e[32]=A,e[33]=$,e[34]=r,e[35]=H):H=e[35];const X=l||g!==null||j||t===0;let T;e[36]!==r?(T=r("gitView.commit.generateAria"),e[36]=r,e[37]=T):T=e[37];let Y;e[38]!==l?(Y=l?s.jsx(R,{name:"loader-4",className:"size-4 animate-spin"}):s.jsx(R,{name:"ai-generate-2",className:"size-4 text-primary"}),e[38]=l,e[39]=Y):Y=e[39];let K;e[40]!==r?(K=r("gitView.commit.generate"),e[40]=r,e[41]=K):K=e[41];let G;e[42]!==K?(G=s.jsx("span",{className:"commit-actions__label",children:K}),e[42]=K,e[43]=G):G=e[43];let O;e[44]!==f||e[45]!==X||e[46]!==T||e[47]!==Y||e[48]!==G?(O=s.jsxs(J,{variant:"outline",size:"sm",onClick:f,disabled:X,type:"button","aria-label":T,className:"commit-actions__btn",children:[Y,G]}),e[44]=f,e[45]=X,e[46]=T,e[47]=Y,e[48]=G,e[49]=O):O=e[49];let B;e[50]===Symbol.for("react.memo_cache_sentinel")?(B=s.jsx("div",{className:"flex-1"}),e[50]=B):B=e[50];const q=!h||l;let i;e[51]!==r?(i=r("gitView.commit.commitAria"),e[51]=r,e[52]=i):i=e[52];let n;e[53]!==g||e[54]!==r?(n=g==="commit"?s.jsxs(s.Fragment,{children:[s.jsx(R,{name:"loader-4",className:"size-4 animate-spin"}),s.jsx("span",{className:"commit-actions__label",children:r("gitView.commit.committing")})]}):s.jsxs(s.Fragment,{children:[s.jsx(R,{name:"git-commit",className:"size-4"}),s.jsx("span",{className:"commit-actions__label",children:r("gitView.commit.commit")})]}),e[53]=g,e[54]=r,e[55]=n):n=e[55];let a;e[56]!==d||e[57]!==q||e[58]!==i||e[59]!==n?(a=s.jsx(J,{size:"sm",variant:"outline",onClick:d,disabled:q,className:"commit-actions__btn whitespace-nowrap","aria-label":i,children:n}),e[56]=d,e[57]=q,e[58]=i,e[59]=n,e[60]=a):a=e[60];let c;e[61]!==h||e[62]!==g||e[63]!==l||e[64]!==E||e[65]!==z||e[66]!==r?(c=E?s.jsxs(fe,{children:[s.jsx(me,{asChild:!0,children:s.jsx(J,{variant:"default",size:"sm",onClick:()=>z(),disabled:!h||l,className:"h-7 w-7 p-0","aria-label":r("gitView.commit.pushAria"),children:g==="commitAndPush"?s.jsx(R,{name:"loader-4",className:"size-4 animate-spin"}):s.jsx(R,{name:"arrow-up",className:"size-3.5"})})}),s.jsx(ue,{side:"top",children:s.jsx("p",{children:r("gitView.commit.push")})})]}):s.jsx(J,{size:"sm",variant:"default",onClick:()=>z(),disabled:!h||l,className:"commit-actions__btn","aria-label":r("gitView.commit.pushAria"),children:g==="commitAndPush"?s.jsxs(s.Fragment,{children:[s.jsx(R,{name:"loader-4",className:"size-4 animate-spin"}),s.jsx("span",{className:"commit-actions__label commit-actions__label--push",children:r("gitView.commit.pushing")})]}):s.jsxs(s.Fragment,{children:[s.jsx(R,{name:"arrow-up",className:"size-3.5"}),s.jsx("span",{className:"commit-actions__label commit-actions__label--push",children:r("gitView.commit.push")})]})}),e[61]=h,e[62]=g,e[63]=l,e[64]=E,e[65]=z,e[66]=r,e[67]=c):c=e[67];let k;e[68]!==O||e[69]!==a||e[70]!==c?(k=s.jsxs("div",{className:"@container/commit-actions flex items-center gap-2 min-w-0",children:[O,B,a,c]}),e[68]=O,e[69]=a,e[70]=c,e[71]=k):k=e[71];let v;e[72]!==L||e[73]!==H||e[74]!==k||e[75]!==I?(v=s.jsxs("div",{className:"flex flex-col gap-3 px-0 pt-1 pb-3",children:[I,L,H,k]}),e[72]=L,e[73]=H,e[74]=k,e[75]=I,e[76]=v):v=e[76];let _;return e[77]!==v||e[78]!==V?(_=s.jsxs("section",{className:"border-0 bg-transparent rounded-none",children:[V,v]}),e[77]=v,e[78]=V,e[79]=_):_=e[79],_};export{Ye as C,qe as a};
|