cli-jaw 1.7.33 → 1.7.34
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/bin/commands/dispatch.js +8 -0
- package/dist/bin/commands/dispatch.js.map +1 -1
- package/dist/bin/commands/memory.js +7 -1
- package/dist/bin/commands/memory.js.map +1 -1
- package/dist/bin/commands/orchestrate.js +67 -8
- package/dist/bin/commands/orchestrate.js.map +1 -1
- package/dist/src/agent/args.js +4 -0
- package/dist/src/agent/args.js.map +1 -1
- package/dist/src/agent/events.js +50 -20
- package/dist/src/agent/events.js.map +1 -1
- package/dist/src/agent/opencode-diagnostics.js +106 -0
- package/dist/src/agent/opencode-diagnostics.js.map +1 -0
- package/dist/src/agent/spawn-env.js +75 -4
- package/dist/src/agent/spawn-env.js.map +1 -1
- package/dist/src/agent/spawn.js +104 -15
- package/dist/src/agent/spawn.js.map +1 -1
- package/dist/src/cli/commands.js +1 -1
- package/dist/src/cli/commands.js.map +1 -1
- package/dist/src/cli/handlers-runtime.js +23 -5
- package/dist/src/cli/handlers-runtime.js.map +1 -1
- package/dist/src/core/compact.js +8 -7
- package/dist/src/core/compact.js.map +1 -1
- package/dist/src/core/runtime-settings-gate.js +40 -0
- package/dist/src/core/runtime-settings-gate.js.map +1 -0
- package/dist/src/core/runtime-settings.js +71 -64
- package/dist/src/core/runtime-settings.js.map +1 -1
- package/dist/src/orchestrator/pipeline.js +20 -0
- package/dist/src/orchestrator/pipeline.js.map +1 -1
- package/dist/src/orchestrator/state-machine.js +8 -5
- package/dist/src/orchestrator/state-machine.js.map +1 -1
- package/dist/src/prompt/templates/a1-system.md +9 -1
- package/dist/src/prompt/templates/employee.md +5 -1
- package/dist/src/routes/orchestrate.js +52 -11
- package/dist/src/routes/orchestrate.js.map +1 -1
- package/package.json +6 -5
- package/public/css/modals.css +126 -0
- package/public/dist/assets/{employees-Do9d6Xi5.js → employees-p53cgGmH.js} +1 -1
- package/public/dist/assets/{index-qALA03H1.css → index-CLKLbGzn.css} +1 -1
- package/public/dist/assets/index-wUWc2M5K.js +32 -0
- package/public/dist/assets/memory-6zLEr-qI.js +1 -0
- package/public/dist/assets/{memory-DeZSzBAb.js → memory-C2i7ZIvv.js} +2 -2
- package/public/dist/assets/{render-CQnnZ-_i.js → render-CulTuvJs.js} +1 -1
- package/public/dist/assets/settings-BUEiZgkm.js +40 -0
- package/public/dist/assets/settings-BhrOslae.js +1 -0
- package/public/dist/assets/{skills-Ci5t_dsV.js → skills-CSuSbBWa.js} +1 -1
- package/public/dist/assets/skills-CgwxEvFx.js +1 -0
- package/public/dist/assets/slash-commands-Bo8jvBfI.js +1 -0
- package/public/dist/assets/{slash-commands-0RvnZU9z.js → slash-commands-D-v0DlbY.js} +1 -1
- package/public/dist/assets/ui-4JiRyxJy.js +131 -0
- package/public/dist/assets/ui-Dx0MwI23.js +1 -0
- package/public/dist/assets/ws-DKtFfZsY.js +14 -0
- package/public/dist/index.html +74 -15
- package/public/index.html +72 -13
- package/public/js/features/attention-badge.ts +151 -0
- package/public/js/features/chat.ts +16 -0
- package/public/js/features/help-content.ts +75 -0
- package/public/js/features/help-dialog.ts +164 -0
- package/public/js/features/memory.ts +2 -2
- package/public/js/features/orchestrate-scope.ts +4 -0
- package/public/js/features/settings-core.ts +36 -11
- package/public/js/main.ts +4 -0
- package/public/js/ui.ts +21 -1
- package/public/js/virtual-scroll.ts +72 -8
- package/public/js/ws.ts +50 -6
- package/public/locales/en.json +183 -2
- package/public/locales/ko.json +183 -2
- package/scripts/smoke/opencode-external-dir-smoke.ts +350 -0
- package/public/dist/assets/index-yGExjgR_.js +0 -32
- package/public/dist/assets/memory-Dpe-qPbZ.js +0 -1
- package/public/dist/assets/settings-C8bSXG3q.js +0 -40
- package/public/dist/assets/settings-COrhSfDh.js +0 -1
- package/public/dist/assets/skills-BO0V4aHG.js +0 -1
- package/public/dist/assets/slash-commands-DbUvFtCk.js +0 -1
- package/public/dist/assets/ui-Cxk1_e0b.js +0 -1
- package/public/dist/assets/ui-IWxpAzJ7.js +0 -131
- package/public/dist/assets/ws-FsYmCE65.js +0 -14
- /package/public/dist/assets/{constants-IeOVgtYz.js → constants-BU8a_R5s.js} +0 -0
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import os from 'os';
|
|
3
|
+
import { dirname, join } from 'path';
|
|
4
|
+
import { spawn } from 'child_process';
|
|
5
|
+
import { buildArgs } from '../../src/agent/args.js';
|
|
6
|
+
import { extractFromEvent, extractOutputChunk } from '../../src/agent/events.js';
|
|
7
|
+
import {
|
|
8
|
+
applyCliEnvDefaults,
|
|
9
|
+
ensureOpencodeAlwaysAllowPermissions,
|
|
10
|
+
} from '../../src/agent/spawn-env.js';
|
|
11
|
+
import {
|
|
12
|
+
readOpencodeVersion,
|
|
13
|
+
resolveOpencodeBinary,
|
|
14
|
+
} from '../../src/agent/opencode-diagnostics.js';
|
|
15
|
+
|
|
16
|
+
type SmokeCase = {
|
|
17
|
+
id: string;
|
|
18
|
+
targetKind: 'temp-external' | 'jaw-like-external';
|
|
19
|
+
fileRel: string;
|
|
20
|
+
action: 'create' | 'modify' | 'summarize';
|
|
21
|
+
fileKind: 'text' | 'markdown' | 'json';
|
|
22
|
+
prompt: (targetFile: string, marker: string, extraFiles: string[]) => string;
|
|
23
|
+
seed?: (targetFile: string, marker: string, extraFiles: string[]) => void;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
type RunResult = {
|
|
27
|
+
id: string;
|
|
28
|
+
pass: boolean;
|
|
29
|
+
classification: 'PASS' | 'PERMISSION_FAILURE' | 'PARSER_FAILURE' | 'RUNTIME_STALL' | 'TOOL_EXECUTION_FAILURE';
|
|
30
|
+
exitCode: number | null;
|
|
31
|
+
signal: NodeJS.Signals | null;
|
|
32
|
+
durationMs: number;
|
|
33
|
+
cwd: string;
|
|
34
|
+
externalDir: string;
|
|
35
|
+
targetFile: string;
|
|
36
|
+
marker: string;
|
|
37
|
+
stdoutFile: string;
|
|
38
|
+
stderrFile: string;
|
|
39
|
+
resultFile: string;
|
|
40
|
+
eventCount: number;
|
|
41
|
+
eventTypes: Record<string, number>;
|
|
42
|
+
parseErrors: string[];
|
|
43
|
+
stderrPermissionHit: boolean;
|
|
44
|
+
stdoutPermissionHit: boolean;
|
|
45
|
+
hasErrorEvent: boolean;
|
|
46
|
+
hasStepFinish: boolean;
|
|
47
|
+
hasTextEvent: boolean;
|
|
48
|
+
parserFullTextLength: number;
|
|
49
|
+
parserLiveTextLength: number;
|
|
50
|
+
fileExists: boolean;
|
|
51
|
+
markerFound: boolean;
|
|
52
|
+
notes: string[];
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const MODEL = 'opencode-go/deepseek-v4-pro';
|
|
56
|
+
const RUNS = Number.parseInt(readArg('--runs') || '12', 10);
|
|
57
|
+
const TIMEOUT_MS = Number.parseInt(readArg('--timeout-ms') || '180000', 10);
|
|
58
|
+
const stamp = new Date().toISOString().replace(/[-:]/g, '').replace(/\..+/, '');
|
|
59
|
+
const baseFixtureDir = join(process.cwd(), 'devlog', '_plan', 'parse', 'fixtures', 'opencode-smoke-260426', stamp);
|
|
60
|
+
const tempRoot = join(os.tmpdir(), `jaw-opencode-smoke-${stamp}`);
|
|
61
|
+
|
|
62
|
+
const cases: SmokeCase[] = [
|
|
63
|
+
createCase('run-01', 'temp-external', 'note.txt', 'create', 'text'),
|
|
64
|
+
createCase('run-02', 'temp-external', 'note.txt', 'modify', 'text'),
|
|
65
|
+
createCase('run-03', 'temp-external', 'doc.md', 'create', 'markdown'),
|
|
66
|
+
createCase('run-04', 'temp-external', 'doc.md', 'modify', 'markdown'),
|
|
67
|
+
createCase('run-05', 'temp-external', 'data.json', 'create', 'json'),
|
|
68
|
+
createCase('run-06', 'temp-external', 'data.json', 'modify', 'json'),
|
|
69
|
+
createCase('run-07', 'temp-external', 'nested/report.md', 'create', 'markdown'),
|
|
70
|
+
createCase('run-08', 'temp-external', 'nested/report.md', 'modify', 'markdown'),
|
|
71
|
+
createCase('run-09', 'jaw-like-external', 'jaw-note.txt', 'create', 'text'),
|
|
72
|
+
createCase('run-10', 'jaw-like-external', 'jaw-note.txt', 'modify', 'text'),
|
|
73
|
+
summarizeCase('run-11', 'temp-external', 'summary.md'),
|
|
74
|
+
createCase('run-12', 'temp-external', 'final.md', 'modify', 'markdown'),
|
|
75
|
+
];
|
|
76
|
+
|
|
77
|
+
function readArg(name: string): string | null {
|
|
78
|
+
const idx = process.argv.indexOf(name);
|
|
79
|
+
if (idx === -1) return null;
|
|
80
|
+
return process.argv[idx + 1] || null;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function createCase(
|
|
84
|
+
id: string,
|
|
85
|
+
targetKind: SmokeCase['targetKind'],
|
|
86
|
+
fileRel: string,
|
|
87
|
+
action: SmokeCase['action'],
|
|
88
|
+
fileKind: SmokeCase['fileKind'],
|
|
89
|
+
): SmokeCase {
|
|
90
|
+
return {
|
|
91
|
+
id,
|
|
92
|
+
targetKind,
|
|
93
|
+
fileRel,
|
|
94
|
+
action,
|
|
95
|
+
fileKind,
|
|
96
|
+
seed: action === 'modify'
|
|
97
|
+
? (targetFile, marker) => {
|
|
98
|
+
fs.mkdirSync(dirname(targetFile), { recursive: true });
|
|
99
|
+
fs.writeFileSync(targetFile, `seed for ${id}\nold-marker=${marker}-old\n`, 'utf8');
|
|
100
|
+
}
|
|
101
|
+
: undefined,
|
|
102
|
+
prompt: (targetFile, marker) => buildPrompt(id, action, fileKind, targetFile, marker),
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function summarizeCase(
|
|
107
|
+
id: string,
|
|
108
|
+
targetKind: SmokeCase['targetKind'],
|
|
109
|
+
fileRel: string,
|
|
110
|
+
): SmokeCase {
|
|
111
|
+
return {
|
|
112
|
+
id,
|
|
113
|
+
targetKind,
|
|
114
|
+
fileRel,
|
|
115
|
+
action: 'summarize',
|
|
116
|
+
fileKind: 'markdown',
|
|
117
|
+
seed: (_targetFile, marker, extraFiles) => {
|
|
118
|
+
for (const [idx, file] of extraFiles.entries()) {
|
|
119
|
+
fs.mkdirSync(dirname(file), { recursive: true });
|
|
120
|
+
fs.writeFileSync(file, `source-${idx + 1}\nmarker=${marker}\n`, 'utf8');
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
prompt: (targetFile, marker, extraFiles) => [
|
|
124
|
+
`You are running an unattended smoke test ${id}.`,
|
|
125
|
+
`Working directory is intentionally different from the target directory.`,
|
|
126
|
+
`Read these external files: ${extraFiles.join(', ')}`,
|
|
127
|
+
`Create the external markdown file at this absolute path: ${targetFile}`,
|
|
128
|
+
`The file must contain this exact marker: ${marker}`,
|
|
129
|
+
`Do not ask for permission. Use tools directly.`,
|
|
130
|
+
`When finished, answer exactly: DONE ${id} ${marker}`,
|
|
131
|
+
].join('\n'),
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function buildPrompt(
|
|
136
|
+
id: string,
|
|
137
|
+
action: SmokeCase['action'],
|
|
138
|
+
fileKind: SmokeCase['fileKind'],
|
|
139
|
+
targetFile: string,
|
|
140
|
+
marker: string,
|
|
141
|
+
): string {
|
|
142
|
+
const verb = action === 'modify' ? 'Modify the existing' : 'Create a new';
|
|
143
|
+
const content = fileKind === 'json'
|
|
144
|
+
? `valid JSON with keys "run", "marker", and "status"; marker must be "${marker}"`
|
|
145
|
+
: `${fileKind} content containing the exact marker "${marker}"`;
|
|
146
|
+
return [
|
|
147
|
+
`You are running an unattended smoke test ${id}.`,
|
|
148
|
+
`Working directory is intentionally different from the target directory.`,
|
|
149
|
+
`${verb} external ${fileKind} file at this absolute path: ${targetFile}`,
|
|
150
|
+
`The file must contain ${content}.`,
|
|
151
|
+
`Do not ask for permission. Use tools directly.`,
|
|
152
|
+
`When finished, answer exactly: DONE ${id} ${marker}`,
|
|
153
|
+
].join('\n');
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
function permissionHit(text: string): boolean {
|
|
157
|
+
return /\b(?:permissions?|external_directory|denied|confirmation|approve|allow|ask)\b/i.test(text);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function classify(result: Omit<RunResult, 'classification' | 'pass'>): RunResult['classification'] {
|
|
161
|
+
if (result.stderrPermissionHit || result.stdoutPermissionHit) return 'PERMISSION_FAILURE';
|
|
162
|
+
if (result.exitCode !== 0 || result.signal) {
|
|
163
|
+
return result.hasStepFinish ? 'TOOL_EXECUTION_FAILURE' : 'RUNTIME_STALL';
|
|
164
|
+
}
|
|
165
|
+
if (result.hasErrorEvent) return 'TOOL_EXECUTION_FAILURE';
|
|
166
|
+
if (!result.fileExists || !result.markerFound) return 'TOOL_EXECUTION_FAILURE';
|
|
167
|
+
if (!result.hasStepFinish) return 'RUNTIME_STALL';
|
|
168
|
+
if (result.hasTextEvent && result.parserFullTextLength === 0) return 'PARSER_FAILURE';
|
|
169
|
+
return 'PASS';
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function parseEvents(stdout: string): { events: any[]; parseErrors: string[]; eventTypes: Record<string, number> } {
|
|
173
|
+
const events: any[] = [];
|
|
174
|
+
const parseErrors: string[] = [];
|
|
175
|
+
const eventTypes: Record<string, number> = {};
|
|
176
|
+
for (const line of stdout.split(/\r?\n/)) {
|
|
177
|
+
if (!line.trim()) continue;
|
|
178
|
+
try {
|
|
179
|
+
const parsed = JSON.parse(line);
|
|
180
|
+
events.push(parsed);
|
|
181
|
+
const type = typeof parsed.type === 'string' ? parsed.type : 'unknown';
|
|
182
|
+
eventTypes[type] = (eventTypes[type] || 0) + 1;
|
|
183
|
+
} catch (error) {
|
|
184
|
+
parseErrors.push(`${(error as Error).message}: ${line.slice(0, 200)}`);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return { events, parseErrors, eventTypes };
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function replayParser(events: any[]): { fullTextLength: number; liveTextLength: number } {
|
|
191
|
+
const ctx: any = {
|
|
192
|
+
fullText: '',
|
|
193
|
+
traceLog: [],
|
|
194
|
+
toolLog: [],
|
|
195
|
+
seenToolKeys: new Set<string>(),
|
|
196
|
+
pendingOutputChunk: '',
|
|
197
|
+
opencodePreToolText: '',
|
|
198
|
+
opencodePostToolText: '',
|
|
199
|
+
opencodeSawToolInStep: false,
|
|
200
|
+
opencodeHadToolErrorInStep: false,
|
|
201
|
+
opencodePendingToolRefs: [],
|
|
202
|
+
};
|
|
203
|
+
let liveText = '';
|
|
204
|
+
for (const event of events) {
|
|
205
|
+
extractFromEvent('opencode', event, ctx, 'opencode-smoke');
|
|
206
|
+
liveText += extractOutputChunk('opencode', event, ctx);
|
|
207
|
+
}
|
|
208
|
+
return { fullTextLength: ctx.fullText.length, liveTextLength: liveText.length };
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function runProcess(opencodeBinary: string, args: string[], cwd: string, env: NodeJS.ProcessEnv): Promise<{
|
|
212
|
+
stdout: string;
|
|
213
|
+
stderr: string;
|
|
214
|
+
exitCode: number | null;
|
|
215
|
+
signal: NodeJS.Signals | null;
|
|
216
|
+
durationMs: number;
|
|
217
|
+
}> {
|
|
218
|
+
return new Promise((resolve) => {
|
|
219
|
+
const started = Date.now();
|
|
220
|
+
const child = spawn(opencodeBinary, args, { cwd, env, stdio: ['ignore', 'pipe', 'pipe'] });
|
|
221
|
+
let stdout = '';
|
|
222
|
+
let stderr = '';
|
|
223
|
+
let settled = false;
|
|
224
|
+
const timer = setTimeout(() => {
|
|
225
|
+
if (settled) return;
|
|
226
|
+
settled = true;
|
|
227
|
+
child.kill('SIGTERM');
|
|
228
|
+
resolve({ stdout, stderr: `${stderr}\n[TIMEOUT ${TIMEOUT_MS}ms]`, exitCode: null, signal: 'SIGTERM', durationMs: Date.now() - started });
|
|
229
|
+
}, TIMEOUT_MS);
|
|
230
|
+
|
|
231
|
+
child.stdout.on('data', (chunk) => { stdout += chunk.toString(); });
|
|
232
|
+
child.stderr.on('data', (chunk) => { stderr += chunk.toString(); });
|
|
233
|
+
child.on('error', (error) => {
|
|
234
|
+
if (settled) return;
|
|
235
|
+
settled = true;
|
|
236
|
+
clearTimeout(timer);
|
|
237
|
+
resolve({ stdout, stderr: `${stderr}\n[SPAWN_ERROR] ${error.message}`, exitCode: 127, signal: null, durationMs: Date.now() - started });
|
|
238
|
+
});
|
|
239
|
+
child.on('close', (exitCode, signal) => {
|
|
240
|
+
if (settled) return;
|
|
241
|
+
settled = true;
|
|
242
|
+
clearTimeout(timer);
|
|
243
|
+
resolve({ stdout, stderr, exitCode, signal: signal as NodeJS.Signals | null, durationMs: Date.now() - started });
|
|
244
|
+
});
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
async function runCase(testCase: SmokeCase, env: NodeJS.ProcessEnv, opencodeBinary: string): Promise<RunResult> {
|
|
249
|
+
const caseRoot = join(tempRoot, testCase.id);
|
|
250
|
+
const workDir = join(caseRoot, 'work');
|
|
251
|
+
const externalDir = testCase.targetKind === 'jaw-like-external'
|
|
252
|
+
? join(os.homedir(), `.cli-jaw-smoke-${stamp}`, testCase.id, 'external')
|
|
253
|
+
: join(caseRoot, 'external');
|
|
254
|
+
const targetFile = join(externalDir, testCase.fileRel);
|
|
255
|
+
const marker = `SMOKE_${testCase.id}_${stamp}`;
|
|
256
|
+
const extraFiles = [join(externalDir, 'source-a.txt'), join(externalDir, 'nested', 'source-b.txt')];
|
|
257
|
+
fs.mkdirSync(workDir, { recursive: true });
|
|
258
|
+
fs.mkdirSync(externalDir, { recursive: true });
|
|
259
|
+
testCase.seed?.(targetFile, marker, extraFiles);
|
|
260
|
+
|
|
261
|
+
const prompt = testCase.prompt(targetFile, marker, extraFiles);
|
|
262
|
+
const args = buildArgs('opencode', MODEL, '', prompt, '', 'auto');
|
|
263
|
+
const stdoutFile = join(baseFixtureDir, `${testCase.id}.stdout.ndjson`);
|
|
264
|
+
const stderrFile = join(baseFixtureDir, `${testCase.id}.stderr.log`);
|
|
265
|
+
const resultFile = join(baseFixtureDir, `${testCase.id}.result.json`);
|
|
266
|
+
const proc = await runProcess(opencodeBinary, args, workDir, env);
|
|
267
|
+
fs.writeFileSync(stdoutFile, proc.stdout, 'utf8');
|
|
268
|
+
fs.writeFileSync(stderrFile, proc.stderr, 'utf8');
|
|
269
|
+
|
|
270
|
+
const { events, parseErrors, eventTypes } = parseEvents(proc.stdout);
|
|
271
|
+
const parser = replayParser(events);
|
|
272
|
+
const hasErrorEvent = events.some(event => event.type === 'error');
|
|
273
|
+
const hasStepFinish = events.some(event => event.type === 'step_finish');
|
|
274
|
+
const hasTextEvent = events.some(event => event.type === 'text');
|
|
275
|
+
const fileExists = fs.existsSync(targetFile);
|
|
276
|
+
const fileText = fileExists ? fs.readFileSync(targetFile, 'utf8') : '';
|
|
277
|
+
const partial: Omit<RunResult, 'classification' | 'pass'> = {
|
|
278
|
+
id: testCase.id,
|
|
279
|
+
exitCode: proc.exitCode,
|
|
280
|
+
signal: proc.signal,
|
|
281
|
+
durationMs: proc.durationMs,
|
|
282
|
+
cwd: workDir,
|
|
283
|
+
externalDir,
|
|
284
|
+
targetFile,
|
|
285
|
+
marker,
|
|
286
|
+
stdoutFile,
|
|
287
|
+
stderrFile,
|
|
288
|
+
resultFile,
|
|
289
|
+
eventCount: events.length,
|
|
290
|
+
eventTypes,
|
|
291
|
+
parseErrors,
|
|
292
|
+
stderrPermissionHit: permissionHit(proc.stderr),
|
|
293
|
+
stdoutPermissionHit: permissionHit(proc.stdout),
|
|
294
|
+
hasErrorEvent,
|
|
295
|
+
hasStepFinish,
|
|
296
|
+
hasTextEvent,
|
|
297
|
+
parserFullTextLength: parser.fullTextLength,
|
|
298
|
+
parserLiveTextLength: parser.liveTextLength,
|
|
299
|
+
fileExists,
|
|
300
|
+
markerFound: fileText.includes(marker),
|
|
301
|
+
notes: [],
|
|
302
|
+
};
|
|
303
|
+
if (parseErrors.length) partial.notes.push('stdout had non-JSON lines');
|
|
304
|
+
if (!partial.markerFound) partial.notes.push('expected marker missing from target file');
|
|
305
|
+
const classification = classify(partial);
|
|
306
|
+
const result: RunResult = { ...partial, classification, pass: classification === 'PASS' };
|
|
307
|
+
fs.writeFileSync(resultFile, `${JSON.stringify(result, null, 2)}\n`, 'utf8');
|
|
308
|
+
return result;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
async function main(): Promise<void> {
|
|
312
|
+
fs.mkdirSync(baseFixtureDir, { recursive: true });
|
|
313
|
+
ensureOpencodeAlwaysAllowPermissions();
|
|
314
|
+
const env = {
|
|
315
|
+
...process.env,
|
|
316
|
+
...applyCliEnvDefaults('opencode', {}, process.env),
|
|
317
|
+
} as NodeJS.ProcessEnv;
|
|
318
|
+
const opencodeBinary = resolveOpencodeBinary(env);
|
|
319
|
+
const version = readOpencodeVersion(opencodeBinary, env);
|
|
320
|
+
const selectedCases = cases.slice(0, RUNS);
|
|
321
|
+
const summary = {
|
|
322
|
+
model: MODEL,
|
|
323
|
+
runsRequested: RUNS,
|
|
324
|
+
timeoutMs: TIMEOUT_MS,
|
|
325
|
+
fixtureDir: baseFixtureDir,
|
|
326
|
+
tempRoot,
|
|
327
|
+
opencodePath: opencodeBinary,
|
|
328
|
+
opencodeVersion: version,
|
|
329
|
+
argsPreview: buildArgs('opencode', MODEL, '', '<prompt>', '', 'auto').slice(0, -1),
|
|
330
|
+
results: [] as RunResult[],
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
for (const testCase of selectedCases) {
|
|
334
|
+
console.log(`[opencode-smoke] ${testCase.id} start`);
|
|
335
|
+
const result = await runCase(testCase, env, opencodeBinary);
|
|
336
|
+
summary.results.push(result);
|
|
337
|
+
console.log(`[opencode-smoke] ${testCase.id} ${result.classification} ${result.durationMs}ms`);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
fs.writeFileSync(join(baseFixtureDir, 'summary.json'), `${JSON.stringify(summary, null, 2)}\n`, 'utf8');
|
|
341
|
+
const failed = summary.results.filter(result => !result.pass);
|
|
342
|
+
console.log(`[opencode-smoke] fixtureDir=${baseFixtureDir}`);
|
|
343
|
+
console.log(`[opencode-smoke] pass=${summary.results.length - failed.length} fail=${failed.length}`);
|
|
344
|
+
if (failed.length) process.exitCode = 1;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
main().catch((error) => {
|
|
348
|
+
console.error('[opencode-smoke] fatal:', error);
|
|
349
|
+
process.exitCode = 1;
|
|
350
|
+
});
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-render-Bjnw0wQ6.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{n as e,t}from"./vendor-render-D2YP6GiF.js";import{t as n}from"./state-O6NVkWcL.js";import{i as r,n as i,r as a,t as o}from"./api-DygAf_G_.js";import{Z as s}from"./vendor-mermaid-UktBx7L0.js";import{_ as c,f as l,g as u,h as ee,i as te,l as d,m as ne,n as f,s as re,t as ie}from"./render-CQnnZ-_i.js";import{S as ae,_ as oe,b as se,l as ce,n as p,s as le,t as m,x as ue,y as de}from"./ui-IWxpAzJ7.js";import{a as h,n as fe}from"./idb-cache-DbK81tgv.js";import{r as pe,t as me}from"./ws-FsYmCE65.js";import{t as he}from"./locale-CxI5nTcf.js";import{a as ge,i as _e,n as ve,o as ye,r as be,t as xe}from"./slash-commands-0RvnZU9z.js";import{i as Se,t as Ce}from"./skills-Ci5t_dsV.js";import{a as we,r as Te}from"./constants-IeOVgtYz.js";import{A as Ee,D as De,E as Oe,F as ke,I as Ae,M as je,N as Me,O as g,P as Ne,S as Pe,_ as Fe,a as Ie,c as Le,f as Re,g as ze,h as Be,i as Ve,j as He,k as Ue,l as We,m as Ge,n as Ke,o as qe,p as Je,r as Ye,s as Xe,t as _,u as Ze,v,w as Qe,x as $e}from"./settings-C8bSXG3q.js";import{a as et,c as y,d as tt,f as nt,i as rt,l as it,m as at,n as ot,o as st,p as ct,r as lt,s as ut,t as dt,u as b}from"./memory-DeZSzBAb.js";var x=[];function ft(e){return/^\/compact(?:\s|$)/i.test(String(e||``).trim())?300*1e3:1e4}var S=!1;async function C(){let e=document.getElementById(`chatInput`),t=document.getElementById(`btnSend`);if(!e||!t)return;let o=document.activeElement===t;if(t.classList.contains(`stop-mode`)&&o&&!e.value.trim()&&!n.attachedFiles.length){i(`/api/stop`,`POST`);return}if(S)return;let l=e.value.trim();if(!l&&!n.attachedFiles.length)return;S=!0;let u=t,ee=u.disabled;u.disabled=!0;try{let t=l.slice(1).trim().split(/\s+/)[0]||``,i=t.includes(`/`)||t.includes(`\\`);if(l.startsWith(`/`)&&!n.attachedFiles.length&&!i){e.value=``,D(),xe();try{let e,t,n=ft(l);if(typeof AbortSignal?.timeout==`function`)e=AbortSignal.timeout(n);else{let r=new AbortController;e=r.signal,t=setTimeout(()=>r.abort(),n)}let i=he(),o=await r(),s=await fetch(`/api/command`,{method:`POST`,headers:{"Content-Type":`application/json`,"Accept-Language":i,...o?{Authorization:`Bearer ${o}`}:{}},body:JSON.stringify({text:l,locale:i}),signal:e});t&&clearTimeout(t);let c=await s.json().catch(()=>({}));if(c?.code===`not_command`){m(`user`,l),h({role:`user`,content:l,timestamp:Date.now()}),await a(`/api/message`,`POST`,{prompt:l});return}if(!s.ok&&!c?.text)throw Error(`HTTP ${s.status}`);if(c?.code===`clear_screen`){ie(),se().clear();let e=document.getElementById(`chatMessages`);e&&(e.innerHTML=``)}c?.text&&p(f(c.text),``,c.type)}catch(e){p(c(`chat.cmd.fail`,{msg:e.message}),``,`error`)}return}if(n.attachedFiles.length){let t=`📎 [${n.attachedFiles.map(e=>e.name).join(`, `)}] ${l}`;m(`user`,t),h({role:`user`,content:t,timestamp:Date.now()}),e.value=``,D();try{let e=(await Promise.all(n.attachedFiles.map(e=>mt(e)))).map(e=>c(`chat.file.sent`,{path:e})).join(`
|
|
3
|
-
`);l&&(e+=c(`chat.file.sentWithMsg`,{text:l})),T(),await a(`/api/message`,`POST`,{prompt:e})}catch(e){p(c(`chat.file.uploadFail`,{msg:e.message})),T()}}else{e.value=``,D();let t=await fetch(`/api/message`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({prompt:l})}),n=await t.json().catch(()=>({}));if(t.status===409&&n?.error===`duplicate`)return;if(!t.ok){p(`${d.error} ${f(n.error||c(`chat.requestFail`,{status:t.status}))}`,``,`error`);return}if(n.queued){let{updateQueueBadge:e}=await s(async()=>{let{updateQueueBadge:e}=await import(`./ui-Cxk1_e0b.js`);return{updateQueueBadge:e}},__vite__mapDeps([0]));e(n.pending||1)}else n.continued?(m(`user`,l),h({role:`user`,content:l,timestamp:Date.now()}),p(c(`chat.continue`))):(m(`user`,l),h({role:`user`,content:l,timestamp:Date.now()}))}}finally{S=!1,u.disabled=ee}}function pt(e){e.key===`Enter`&&!e.shiftKey&&!e.isComposing&&(e.preventDefault(),C())}async function mt(e){let t=await fetch(`/api/upload`,{method:`POST`,headers:{"X-Filename":encodeURIComponent(e.name)},body:e});if(!t.ok)throw Error(`upload failed`);return(await t.json()).path}function w(e){for(let t of e)n.attachedFiles.some(e=>e.name===t.name)||n.attachedFiles.push(t);E(),document.getElementById(`chatInput`)?.focus()}function ht(e){n.attachedFiles.splice(e,1),E()}function T(){x.forEach(e=>URL.revokeObjectURL(e)),x=[],n.attachedFiles=[],E();let e=document.getElementById(`fileInput`);e&&(e.value=``)}function E(){let e=document.getElementById(`filePreview`),t=document.getElementById(`filePreviewList`);if(e){if(x.forEach(e=>URL.revokeObjectURL(e)),x=[],!n.attachedFiles.length){e.classList.remove(`visible`),t&&(t.innerHTML=``);return}e.classList.add(`visible`),t&&(t.innerHTML=n.attachedFiles.map((e,t)=>{let n=(e.size/1024).toFixed(1),r=e.type.startsWith(`image/`),i=``;if(r){let t=URL.createObjectURL(e);x.push(t),i=`<img src="${t}" class="file-chip-thumb" alt="">`}return`<div class="file-chip">
|
|
4
|
-
${i}
|
|
5
|
-
<span class="file-chip-name">${d.paperclip} ${f(e.name)} (${n}KB)</span>
|
|
6
|
-
<button class="file-chip-remove" data-file-idx="${t}" title="Remove">${d.close}</button>
|
|
7
|
-
</div>`}).join(``))}}async function gt(){ie(),se().clear();let e=document.getElementById(`chatMessages`);e&&(e.innerHTML=``);let{cleanupToolActivity:t}=await s(async()=>{let{cleanupToolActivity:e}=await import(`./ui-Cxk1_e0b.js`);return{cleanupToolActivity:e}},__vite__mapDeps([0]));t(),fe().catch(()=>{})}var _t=0;function vt(e){_t||=requestAnimationFrame(()=>{_t=0,e.style.height=`auto`,e.style.height=e.scrollHeight+`px`})}function yt(){let e=document.getElementById(`chatInput`);e&&e.addEventListener(`input`,()=>vt(e))}function D(){let e=document.getElementById(`chatInput`);e&&(e.style.height=`auto`)}function bt(){let e=document.querySelector(`.chat-area`),t=document.getElementById(`dragOverlay`);if(!e||!t)return;let n=0;e.addEventListener(`dragenter`,e=>{e.preventDefault(),n++,t.classList.add(`visible`)}),e.addEventListener(`dragleave`,e=>{e.preventDefault(),n--,n<=0&&(n=0,t.classList.remove(`visible`))}),e.addEventListener(`dragover`,e=>e.preventDefault()),e.addEventListener(`drop`,e=>{e.preventDefault(),n=0,t.classList.remove(`visible`);let r=[...e.dataTransfer?.files||[]];r.length&&w(r)}),document.getElementById(`fileInput`)?.addEventListener(`change`,e=>{let t=e.target,n=[...t.files||[]];n.length&&w(n),t.value=``}),document.addEventListener(`paste`,e=>{let t=e.clipboardData?.items;if(!t)return;let n=[];for(let e of t){if(e.kind!==`file`)continue;let t=e.getAsFile();if(t)if(!t.name||t.name===`image.png`){let e=new Date().toISOString().replace(/[:.]/g,`-`),r=t.type.split(`/`)[1]||`png`,i=new File([t],`pasted-${e}.${r}`,{type:t.type});n.push(i)}else n.push(t)}n.length&&(e.preventDefault(),w(n))})}async function xt(e,t,r){let i=document.getElementById(`chatInput`),o=i?.value.trim()||``,s=[...n.attachedFiles],l=[`🎤 [음성 메시지]`];s.length&&l.push(`📎 [${s.map(e=>e.name).join(`, `)}]`),o&&l.push(o),m(`user`,l.join(` `)),h({role:`user`,content:l.join(` `),timestamp:Date.now()}),i&&o&&(i.value=``,D()),s.length&&T();try{let n=await fetch(`/api/voice`,{method:`POST`,headers:{"Content-Type":r,"X-Voice-Ext":t,"X-STT-Only":`true`},body:e});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error||`HTTP ${n.status}`)}let i=await n.json().catch(()=>null);if(!i?.text)throw Error(`Empty STT result`);p(`${d.mic} STT (${f(i.engine||``)}, ${i.elapsed?.toFixed(1)}s): "${f(i.text.slice(0,100))}"`,``,`info`);let l=[];s.length&&(l=await Promise.all(s.map(e=>mt(e))));let u=[];for(let e of l)u.push(c(`chat.file.sent`,{path:e}));u.push(`🎤 ${i.text}`),o&&u.push(o),await a(`/api/message`,`POST`,{prompt:u.join(`
|
|
8
|
-
`)})}catch(e){p(c(`voice.sttFail`,{msg:e.message}),``,`error`)}}var St={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6},Ct={jan:1,feb:2,mar:3,apr:4,may:5,jun:6,jul:7,aug:8,sep:9,oct:10,nov:11,dec:12};function wt(e){let t=typeof e==`string`?e.trim():``;if(t)try{return new Intl.DateTimeFormat(`en-US`,{timeZone:t}).format(new Date),t}catch{return}}function Tt(e){let t=e&&typeof e==`object`?e:{},n=t.kind,r=typeof t.timeZone==`string`?t.timeZone.trim():``,i=wt(t.timeZone);if(r&&!i)return{ok:!1,code:`invalid_timezone`,error:`invalid timeZone "${r}"`};if(n===`cron`){let e=typeof t.cron==`string`?t.cron.trim().replace(/\s+/g,` `):``;if(!e)return{ok:!1,code:`invalid_cron`,error:`cron expression required`};let n=Et(e);return n?{ok:!1,code:`invalid_cron`,error:n}:{ok:!0,schedule:i?{kind:`cron`,cron:e,timeZone:i}:{kind:`cron`,cron:e}}}if(n==null||n===`every`){let e=typeof t.minutes==`number`?t.minutes:Number(t.minutes);if(!Number.isInteger(e)||e<1)return{ok:!1,code:`invalid_minutes`,error:`minutes must be an integer >= 1`};let n=Math.max(1,Math.floor(e));return{ok:!0,schedule:i?{kind:`every`,minutes:n,timeZone:i}:{kind:`every`,minutes:n}}}return{ok:!1,code:`invalid_kind`,error:`invalid heartbeat schedule kind "${String(n)}"`}}function Et(e){try{let[t,n,r,i,a]=Dt(e);return O(t,{min:0,max:59}),O(n,{min:0,max:23}),O(r,{min:1,max:31}),O(i,{min:1,max:12,aliases:Ct}),O(a,{min:0,max:7,aliases:St,normalize:At}),null}catch(e){return e.message}}function Dt(e){let t=String(e||``).trim().replace(/\s+/g,` `).split(` `);if(t.length!==5)throw Error(`cron must have 5 fields, got ${t.length}`);return t}function O(e,t){for(let n of e.split(`,`))Ot(n.trim(),t)}function Ot(e,t){if(!e)throw Error(`empty cron segment`);let n=e;if(e.includes(`/`)){let[t,r,...i]=e.split(`/`);if(!t||!r||i.length>0)throw Error(`invalid cron step segment "${e}"`);n=t,kt(r,`invalid cron step "${r}"`)}if(n!==`*`){if(n.includes(`-`)){let[e,r,...i]=n.split(`-`);if(!e||!r||i.length>0||k(e,t)>k(r,t))throw Error(`invalid cron range "${n}"`);return}k(n,t)}}function k(e,t){let n=e.trim().toLowerCase(),r=t.aliases?.[n]??Number(n);if(!Number.isInteger(r))throw Error(`invalid cron value "${e}"`);let i=t.normalize?t.normalize(r):r;if(!jt(i,t.min,t.max))throw Error(`cron value "${e}" out of range ${t.min}-${t.max}`);return i}function kt(e,t){let n=Number(e);if(!Number.isInteger(n)||n<=0)throw Error(t);return n}function At(e){return e===7?0:e}function jt(e,t,n){return e>=t&&e<=n}async function Mt(){n.heartbeatJobs=((await o(`/api/heartbeat`))?.jobs||[]).map(M),n.heartbeatErrors=P(n.heartbeatJobs),A(),document.getElementById(`heartbeatModal`)?.classList.add(`open`)}function Nt(e){e&&e.target!==e.currentTarget||document.getElementById(`heartbeatModal`)?.classList.remove(`open`)}function A(){let e=document.getElementById(`hbJobsList`);if(!e)return;let t=n.heartbeatJobs.map(M);n.heartbeatJobs=t,n.heartbeatErrors=P(t),t.length===0?e.innerHTML=`<p style="color:var(--text-dim);font-size:12px;text-align:center">${c(`hb.empty`)}</p>`:e.innerHTML=t.map((e,t)=>{let r=Rt(e.schedule),i=r.kind===`cron`,a=n.heartbeatErrors[e.id],o=a||Wt(r),s=a?`hb-schedule-meta hb-error`:`hb-schedule-meta hb-help`,l=i?`<input type="text" value="${f(r.cron)}" placeholder="${f(c(`hb.cronPlaceholder`))}"
|
|
9
|
-
data-hb-cron="${t}">`:`<input type="number" value="${r.minutes}" min="1" data-hb-minutes="${t}">`,u=i?`<span class="hb-chip">${f(c(`hb.cronLabel`))}</span>`:`<span class="hb-chip">${f(c(`hb.minutesLabel`))}</span>`;return`
|
|
10
|
-
<div class="hb-job-card">
|
|
11
|
-
<div class="hb-job-header">
|
|
12
|
-
<input type="text" value="${f(String(e.name||``))}" placeholder="${f(c(`hb.name`))}"
|
|
13
|
-
data-hb-name="${t}">
|
|
14
|
-
<button class="hb-toggle ${e.enabled?`on`:`off`}"
|
|
15
|
-
data-hb-toggle="${t}" aria-label="${f(String(e.name||`job`)+` toggle`)}"></button>
|
|
16
|
-
<button class="hb-del" data-hb-remove="${t}">${d.close}</button>
|
|
17
|
-
</div>
|
|
18
|
-
<div class="hb-job-schedule">
|
|
19
|
-
<select data-hb-kind="${t}">
|
|
20
|
-
<option value="every"${i?``:` selected`}>${f(c(`hb.kindEvery`))}</option>
|
|
21
|
-
<option value="cron"${i?` selected`:``}>${f(c(`hb.kindCron`))}</option>
|
|
22
|
-
</select>
|
|
23
|
-
${l}
|
|
24
|
-
${u}
|
|
25
|
-
<input type="text" value="${f(r.timeZone||``)}" placeholder="${f(Vt())}"
|
|
26
|
-
data-hb-timezone="${t}">
|
|
27
|
-
</div>
|
|
28
|
-
<p class="${s}">${f(o)}</p>
|
|
29
|
-
<textarea class="hb-prompt" rows="2" placeholder="${f(c(`hb.prompt`))}"
|
|
30
|
-
data-hb-prompt="${t}">${f(String(e.prompt||``))}</textarea>
|
|
31
|
-
</div>
|
|
32
|
-
`}).join(``);let r=t.filter(e=>e.enabled).length,i=document.getElementById(`hbSidebarBtn`);i&&(i.innerHTML=`${d.heartPulse} Heartbeat (${r})`)}function Pt(){n.heartbeatJobs.push({id:`hb_`+Date.now(),name:``,enabled:!0,schedule:Bt({kind:`every`,minutes:5}),prompt:``}),A(),j()}function Ft(e){n.heartbeatJobs.splice(e,1),A(),j()}function It(e){let t=n.heartbeatJobs[e];t&&(t.enabled=!t.enabled,A(),j())}async function j(){let e=n.heartbeatJobs.map(M);if(n.heartbeatJobs=e,n.heartbeatErrors=P(e),Object.keys(n.heartbeatErrors).length>0){A();return}let t=await a(`/api/heartbeat`,`PUT`,{jobs:e});t?.jobs&&(n.heartbeatJobs=t.jobs.map(M),n.heartbeatErrors=P(n.heartbeatJobs),A())}async function Lt(){try{let e=((await o(`/api/heartbeat`))?.jobs||[]).map(M).filter(e=>e.enabled).length,t=document.getElementById(`hbSidebarBtn`);t&&(t.innerHTML=`${d.heartPulse} Heartbeat (${e})`)}catch{}}function M(e){return{id:String(e.id||`hb_${Date.now()}`),name:String(e.name||``),enabled:e.enabled!==!1,schedule:Rt(e.schedule),prompt:String(e.prompt||``)}}function Rt(e){let t=zt(e?.timeZone);if(e?.kind===`cron`){let n=typeof e.cron==`string`?e.cron.trim().replace(/\s+/g,` `):`0 9 * * *`;return t?{kind:`cron`,cron:n,timeZone:t}:{kind:`cron`,cron:n}}let n=typeof e?.minutes==`number`&&Number.isFinite(e.minutes)&&e.minutes>0?Math.max(1,Math.floor(e.minutes)):5;return t?{kind:`every`,minutes:n,timeZone:t}:{kind:`every`,minutes:n}}function zt(e){return(typeof e==`string`?e.trim():``)||void 0}function Bt(e){let t=N();return t?{...e,timeZone:t}:e}function N(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||void 0}catch{return}}function Vt(){let e=N();return e?`${c(`hb.timezoneAuto`)} ${e}`:c(`hb.timezoneAuto`)}function P(e){let t={};for(let n of e){let e=Ht(n);e&&(t[n.id]=e)}return t}function Ht(e){let t=Tt(e.schedule);return t.ok?null:Ut(t.code,t.error)}function Ut(e,t){switch(e){case`invalid_cron`:return c(`hb.invalidCron`);case`invalid_timezone`:return c(`hb.invalidTimeZone`);case`invalid_minutes`:return c(`hb.invalidMinutes`);default:return t||c(`hb.invalidSchedule`)}}function Wt(e){let t=e.timeZone||N()||`Asia/Seoul`;return e.kind===`cron`?c(`hb.scheduleHintCron`,{cron:`0 9 * * *`,timeZone:t}):c(`hb.scheduleHintEvery`,{minutes:e.minutes,timeZone:t})}var F=`sidebarState`,I=900,Gt=768;function L(){return window.innerWidth<=Gt}function R(){document.body.classList.remove(`left-expanded`,`right-expanded`)}function Kt(e){let t=`${e}-expanded`,n=e===`left`?`right-expanded`:`left-expanded`,r=!document.body.classList.contains(t);document.body.classList.remove(n),document.body.classList.toggle(t,r)}function qt(){let e={};try{e=JSON.parse(localStorage.getItem(F)||`{}`)}catch{}e.left&&document.body.classList.add(`left-collapsed`),e.right&&document.body.classList.add(`right-collapsed`);let t=L();document.getElementById(`toggleLeft`)?.addEventListener(`click`,B),document.getElementById(`toggleRight`)?.addEventListener(`click`,V),window.addEventListener(`resize`,()=>{let e=L();if(window.innerWidth>I){R();let e={};try{e=JSON.parse(localStorage.getItem(F)||`{}`)}catch{}document.body.classList.toggle(`left-collapsed`,!!e.left),document.body.classList.toggle(`right-collapsed`,!!e.right)}else document.body.classList.remove(`left-collapsed`,`right-collapsed`),e!==t&&R();t=e,H()}),window.innerWidth<=I&&(document.body.classList.remove(`left-collapsed`,`right-collapsed`),L()&&R()),H()}function z(){return window.innerWidth<=I}function B(){z()?Kt(`left`):document.body.classList.toggle(`left-collapsed`),Xt(),H()}function V(){z()?Kt(`right`):document.body.classList.toggle(`right-collapsed`),Xt(),H()}function Jt(){return z()?document.body.classList.contains(`left-expanded`):!document.body.classList.contains(`left-collapsed`)}function Yt(){return z()?document.body.classList.contains(`right-expanded`):!document.body.classList.contains(`right-collapsed`)}function H(){let e=document.getElementById(`toggleLeft`),t=document.getElementById(`toggleRight`);e&&(e.innerHTML=Jt()?d.chevronLeft:d.chevronRight),t&&(t.innerHTML=Yt()?d.chevronRight:d.chevronLeft)}function Xt(){localStorage.setItem(F,JSON.stringify({left:document.body.classList.contains(`left-collapsed`),right:document.body.classList.contains(`right-collapsed`)}))}var Zt=`theme`,U=null;function Qt(n){let r=n===`light`?t:e;U||(U=document.createElement(`style`),U.id=`hljsTheme`,document.head.appendChild(U)),U.textContent=r}function $t(){let e=localStorage.getItem(Zt),t=window.matchMedia(`(prefers-color-scheme: light)`).matches?`light`:`dark`;tn(e||t),document.getElementById(`toggleTheme`)?.addEventListener(`click`,en)}function en(){let e=(document.documentElement.getAttribute(`data-theme`)||`dark`)===`dark`?`light`:`dark`;tn(e),localStorage.setItem(Zt,e)}function tn(e){document.documentElement.setAttribute(`data-theme`,e);let t=document.getElementById(`toggleTheme`);t&&t.classList.toggle(`is-light`,e===`light`),Qt(e),de(),re()}var nn=50,rn=30,an=80,on=500,W=null,sn=!1;function cn(){if(sn||!(`ontouchstart`in window))return;sn=!0;let e=document.querySelector(`.chat-area`);e&&(e.addEventListener(`touchstart`,ln,{passive:!0}),e.addEventListener(`touchend`,un,{passive:!0}))}function ln(e){let t=e.touches[0],n=window.innerWidth,r=null;t.clientX<rn?r=`left`:t.clientX>n-rn&&(r=`right`),W={startX:t.clientX,startY:t.clientY,startTime:Date.now(),isEdge:r}}function un(e){if(!W)return;let t=e.changedTouches[0],n=t.clientX-W.startX,r=Math.abs(t.clientY-W.startY),i=Date.now()-W.startTime,a=W;W=null,!(r>an||i>on||Math.abs(n)<nn)&&(n>0&&a.isEdge===`left`&&B(),n<0&&a.isEdge===`right`&&V())}var G=!1,K=null,q=[],J=null,Y=null,dn=0;function fn(){if(typeof MediaRecorder>`u`)return``;for(let e of[`audio/webm;codecs=opus`,`audio/mp4`,`audio/ogg;codecs=opus`])if(MediaRecorder.isTypeSupported(e))return e;return``}function pn(e){let t=e;switch(t.name){case`NotAllowedError`:return c(`voice.micDenied`);case`NotFoundError`:return c(`voice.micNotFound`);case`NotReadableError`:case`AbortError`:return c(`voice.micBusy`);default:return t instanceof TypeError||!navigator.mediaDevices?c(`voice.httpsRequired`):c(`voice.micDenied`)}}async function mn(){if(n.isRecording)return;if(typeof MediaRecorder>`u`||!navigator.mediaDevices?.getUserMedia){p(c(`voice.unsupported`),``,`error`);return}try{J=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(e){p(pn(e),``,`error`);return}let e=fn();K=new MediaRecorder(J,e?{mimeType:e}:{}),q=[],K.ondataavailable=e=>{e.data.size>0&&q.push(e.data)},K.onerror=()=>{hn(),p(c(`voice.interrupted`),``,`error`)},K.onstop=async()=>{if(G){q=[],vn(),G=!1;return}let t=K?.mimeType||e||`audio/webm`,n=t.includes(`mp4`)?`.m4a`:t.includes(`ogg`)?`.ogg`:`.webm`,r=new Blob(q,{type:t});if(q=[],vn(),r.size>20*1024*1024){p(c(`voice.tooLarge`),``,`error`);return}if(r.size<1e3){p(c(`voice.tooShort`),``,`error`);return}await xt(r,n,t)},K.start(),n.isRecording=!0,dn=Date.now(),X(!0),yn()}function hn(){!n.isRecording||!K||(K.state===`recording`&&K.stop(),n.isRecording=!1,bn(),X(!1))}function gn(){!n.isRecording||!K||(G=!0,K.state===`recording`&&K.stop(),n.isRecording=!1,bn(),X(!1))}function _n(){n.isRecording?hn():mn()}function vn(){J?.getTracks().forEach(e=>e.stop()),J=null}function yn(){let e=document.getElementById(`voiceTimer`);e&&(e.style.display=`inline`,Y=setInterval(()=>{let t=Math.floor((Date.now()-dn)/1e3);e.textContent=`${String(Math.floor(t/60)).padStart(2,`0`)}:${String(t%60).padStart(2,`0`)}`},500))}function bn(){Y&&=(clearInterval(Y),null);let e=document.getElementById(`voiceTimer`);e&&(e.style.display=`none`,e.textContent=`00:00`)}function X(e){let t=document.getElementById(`btnVoice`),n=document.getElementById(`btnVoiceCancel`);t&&(t.classList.toggle(`recording`,e),t.innerHTML=e?d.stop:d.mic,t.title=c(e?`voice.stop`:`voice.start`)),n&&(n.style.display=e?`inline-block`:`none`)}var Z=`jaw:stale-bundle-reload-pending`;function xn(e){let t=typeof e==`string`?e:e instanceof Error||typeof e?.message==`string`?e.message:``;if(!/(failed to fetch dynamically imported module|error loading dynamically imported module|importing a module script failed|chunkloaderror)/i.test(t))return!1;console.warn(`[stale-bundle] detected dynamic import failure:`,t);try{if(sessionStorage.getItem(Z)===`1`)return!0;sessionStorage.setItem(Z,`1`)}catch{}let n=()=>window.location.reload();return`serviceWorker`in navigator?(navigator.serviceWorker.getRegistration().then(e=>e?.update()).catch(()=>{}).finally(n),!0):(n(),!0)}window.addEventListener(`unhandledrejection`,e=>{if(xn(e.reason)){e.preventDefault();return}console.error(`[unhandled]`,e.reason),e.preventDefault()}),window.addEventListener(`error`,e=>{if(xn(e.error||e.message)){e.preventDefault();return}console.error(`[error]`,e.message,e.filename,e.lineno)});var{loadEmployees:Sn,addEmployee:Cn,deleteEmployee:wn,updateEmployee:Q,onEmpCliChange:Tn,onEmpRoleChange:En}=await s(async()=>{let{loadEmployees:e,addEmployee:t,deleteEmployee:n,updateEmployee:r,onEmpCliChange:i,onEmpRoleChange:a}=await import(`./employees-Do9d6Xi5.js`);return{loadEmployees:e,addEmployee:t,deleteEmployee:n,updateEmployee:r,onEmpCliChange:i,onEmpRoleChange:a}},__vite__mapDeps([0]));document.getElementById(`btnSend`)?.addEventListener(`click`,C);var Dn=document.getElementById(`chatInput`);Dn?.addEventListener(`keydown`,e=>{be(e)||pt(e)});var $=0;Dn?.addEventListener(`input`,e=>{e.isComposing||($&&cancelAnimationFrame($),$=requestAnimationFrame(()=>{ye(e.target?.value||``),$=0}))}),Dn?.addEventListener(`cmd-execute`,()=>{C()}),document.getElementById(`cmdDropdown`)?.addEventListener(`click`,ve),document.addEventListener(`click`,_e),pe(),document.getElementById(`filePreviewClear`)?.addEventListener(`click`,T),document.getElementById(`filePreviewList`)?.addEventListener(`click`,e=>{let t=e.target?.closest(`[data-file-idx]`);t&&ht(+(t.dataset.fileIdx||`0`))}),document.querySelector(`.btn-attach`)?.addEventListener(`click`,()=>{document.getElementById(`fileInput`)?.click()}),document.getElementById(`btnVoice`)?.addEventListener(`click`,()=>_n()),document.getElementById(`btnVoiceCancel`)?.addEventListener(`click`,()=>gn()),document.getElementById(`memorySidebarBtn`)?.addEventListener(`click`,rt),document.getElementById(`btnClearChat`)?.addEventListener(`click`,gt),document.getElementById(`hbSidebarBtn`)?.addEventListener(`click`,Mt),document.getElementById(`langToggle`)?.addEventListener(`click`,async()=>{let e=ne()===`ko`?`en`:`ko`;await u(e);let t=document.getElementById(`langToggle`);t&&(t.innerHTML=`${d.web} ${c(`lang.`+e)}`),n.ws&&n.ws.close()}),document.querySelector(`.tab-bar`)?.addEventListener(`click`,e=>{let t=e.target?.closest(`.tab-btn`);if(!t)return;let n=[...t.parentElement?.children||[]].filter(e=>e.classList.contains(`tab-btn`)).indexOf(t),r=[`agents`,`skills`,`settings`];r[n]&&oe(r[n],t)}),document.querySelector(`.sidebar-save-bar .btn-save`)?.addEventListener(`click`,le),document.getElementById(`selCli`)?.addEventListener(`change`,()=>Be()),document.getElementById(`selModel`)?.addEventListener(`change`,()=>Fe()),document.getElementById(`selEffort`)?.addEventListener(`change`,()=>Fe()),document.getElementById(`flushCli`)?.addEventListener(`change`,()=>ze()),document.getElementById(`flushModel`)?.addEventListener(`change`,()=>ze()),document.querySelector(`[data-action="addEmployee"]`)?.addEventListener(`click`,Cn),document.getElementById(`employeesList`)?.addEventListener(`click`,e=>{let t=e.target?.closest(`[data-emp-delete]`);if(t){wn(t.dataset.empDelete||``);return}}),document.getElementById(`employeesList`)?.addEventListener(`change`,e=>{let t=e.target,n=t.closest(`[data-emp-name]`);if(n){Q(n.dataset.empName||``,{name:t.value});return}let r=t.closest(`[data-emp-cli]`);if(r){Tn(r.dataset.empCli||``,t.value);return}let i=t.closest(`[data-emp-model]`);if(i){if(t.value===`__custom__`){let e=prompt(c(`model.promptInput`));if(e?.trim()){let n=document.createElement(`option`);n.value=e.trim(),n.textContent=e.trim();let r=t.querySelector(`option[value="__custom__"]`);r&&t.insertBefore(n,r),t.value=e.trim(),Q(i.dataset.empModel||``,{model:e.trim()})}else t.value=`default`}else Q(i.dataset.empModel||``,{model:t.value});return}let a=t.closest(`[data-emp-role]`);if(a){En(a.dataset.empRole||``,t.value);return}let o=t.closest(`[data-emp-custom]`);if(o){Q(o.dataset.empCustom||``,{role:t.value});return}}),document.getElementById(`skillsList`)?.addEventListener(`click`,e=>{let t=e.target?.closest(`[data-skill-id]`);t&&Se(t.dataset.skillId||``,t.dataset.skillEnabled===`true`)}),document.querySelector(`#tabSkills`)?.addEventListener(`click`,e=>{let t=e.target?.closest(`.skill-filter`);t&&Ce(t.dataset.filter||`all`,t)}),document.querySelector(`[data-action="openPrompt"]`)?.addEventListener(`click`,Ye),document.getElementById(`tgOff`)?.addEventListener(`click`,()=>ke(!1)),document.getElementById(`tgOn`)?.addEventListener(`click`,()=>ke(!0)),document.getElementById(`tgForwardOff`)?.addEventListener(`click`,()=>Ne(!1)),document.getElementById(`tgForwardOn`)?.addEventListener(`click`,()=>Ne(!0)),document.getElementById(`tgMentionOff`)?.addEventListener(`click`,()=>Ae(!1)),document.getElementById(`tgMentionOn`)?.addEventListener(`click`,()=>Ae(!0)),document.getElementById(`tgToken`)?.addEventListener(`change`,Me),document.getElementById(`tgChatIds`)?.addEventListener(`change`,Me),document.getElementById(`chTelegram`)?.addEventListener(`click`,()=>De(`telegram`)),document.getElementById(`chDiscord`)?.addEventListener(`click`,()=>De(`discord`)),document.getElementById(`dcOff`)?.addEventListener(`click`,()=>Ue(!1)),document.getElementById(`dcOn`)?.addEventListener(`click`,()=>Ue(!0)),document.getElementById(`dcForwardOff`)?.addEventListener(`click`,()=>He(!1)),document.getElementById(`dcForwardOn`)?.addEventListener(`click`,()=>He(!0)),document.getElementById(`dcAllowBotsOff`)?.addEventListener(`click`,()=>Ee(!1)),document.getElementById(`dcAllowBotsOn`)?.addEventListener(`click`,()=>Ee(!0)),document.getElementById(`dcMentionOff`)?.addEventListener(`click`,()=>je(!1)),document.getElementById(`dcMentionOn`)?.addEventListener(`click`,()=>je(!0)),document.getElementById(`dcToken`)?.addEventListener(`change`,g),document.getElementById(`dcGuildId`)?.addEventListener(`change`,g),document.getElementById(`dcChannelIds`)?.addEventListener(`change`,g),document.getElementById(`fallbackOrderList`)?.addEventListener(`change`,Oe);function On(e){let t=document.getElementById(`codexFastOn`),n=document.getElementById(`codexFastOff`);t&&n&&(t.classList.toggle(`active`,e),n.classList.toggle(`active`,!e)),v()}document.getElementById(`codexFastOn`)?.addEventListener(`click`,()=>On(!0)),document.getElementById(`codexFastOff`)?.addEventListener(`click`,()=>On(!1));function kn(e){let t=document.getElementById(`codexCtxOn`),n=document.getElementById(`codexCtxOff`),r=document.getElementById(`codexCtxValues`);t&&n&&(t.classList.toggle(`active`,e),n.classList.toggle(`active`,!e)),r&&(r.style.display=e?``:`none`),v()}document.getElementById(`codexCtxOn`)?.addEventListener(`click`,()=>kn(!0)),document.getElementById(`codexCtxOff`)?.addEventListener(`click`,()=>kn(!1)),document.getElementById(`codexCtxWindow`)?.addEventListener(`change`,v),document.getElementById(`codexCtxCompact`)?.addEventListener(`change`,v);function An(e){let t=document.getElementById(`claude1mOn`),n=document.getElementById(`claude1mOff`),r=document.getElementById(`modelClaude`),i=e;if(r){let t=r.value||``;if(e&&!t.endsWith(`[1m]`)){let e=t+`[1m]`;Array.from(r.options).some(t=>t.value===e)?r.value=e:i=!1}else if(!e&&t.endsWith(`[1m]`)){let e=t.replace(/\[1m\]$/,``);Array.from(r.options).some(t=>t.value===e)?r.value=e:i=!0}else i=t.endsWith(`[1m]`)}t&&n&&(t.classList.toggle(`active`,i),n.classList.toggle(`active`,!i)),v()}document.getElementById(`claude1mOn`)?.addEventListener(`click`,()=>An(!0)),document.getElementById(`claude1mOff`)?.addEventListener(`click`,()=>An(!1));function jn(){for(let e of Te()){let t=e.charAt(0).toUpperCase()+e.slice(1),n=document.getElementById(`model`+t);n&&n.addEventListener(`change`,function(){Re(e,this)});let r=document.getElementById(`customModel`+t);r&&r.addEventListener(`change`,function(){Ze(e,this)});let i=document.getElementById(`effort`+t);i&&i.addEventListener(`change`,v)}}document.querySelector(`[data-action="syncMcp"]`)?.addEventListener(`click`,Qe),document.querySelector(`[data-action="installMcp"]`)?.addEventListener(`click`,Pe),document.querySelector(`[data-action="refreshCli"]`)?.addEventListener(`click`,()=>We(!0)),document.getElementById(`cliStatusInterval`)?.addEventListener(`change`,function(){localStorage.setItem(`cliStatusInterval`,this.value)}),document.getElementById(`promptModal`)?.addEventListener(`click`,e=>_(e)),document.querySelector(`#promptModal .modal-box`)?.addEventListener(`click`,e=>e.stopPropagation()),document.querySelector(`[data-action="closePrompt"]`)?.addEventListener(`click`,()=>_()),document.querySelector(`[data-action="cancelPrompt"]`)?.addEventListener(`click`,()=>_()),document.querySelector(`[data-action="savePrompt"]`)?.addEventListener(`click`,Ie),document.addEventListener(`keydown`,e=>{e.key===`Escape`&&!n.isRecording&&_()}),document.querySelector(`[data-action="openTemplates"]`)?.addEventListener(`click`,Ve),document.querySelector(`[data-action="saveTemplate"]`)?.addEventListener(`click`,qe),document.querySelector(`[data-action="closeTemplate"]`)?.addEventListener(`click`,()=>Ke()),document.getElementById(`templateModal`)?.addEventListener(`click`,e=>Ke(e)),document.querySelector(`#templateModal .modal-box`)?.addEventListener(`click`,e=>e.stopPropagation()),document.getElementById(`templateBack`)?.addEventListener(`click`,Xe),document.getElementById(`templateDevToggle`)?.addEventListener(`click`,Le),document.getElementById(`heartbeatModal`)?.addEventListener(`click`,e=>Nt(e)),document.querySelector(`#heartbeatModal .modal-box`)?.addEventListener(`click`,e=>e.stopPropagation()),document.querySelector(`[data-action="closeHeartbeat"]`)?.addEventListener(`click`,()=>Nt()),document.querySelector(`[data-action="addHeartbeat"]`)?.addEventListener(`click`,Pt),document.getElementById(`hbJobsList`)?.addEventListener(`click`,e=>{let t=e.target?.closest(`[data-hb-toggle]`);if(t){It(+(t.dataset.hbToggle||`0`));return}let n=e.target?.closest(`[data-hb-remove]`);if(n){Ft(+(n.dataset.hbRemove||`0`));return}}),document.getElementById(`hbJobsList`)?.addEventListener(`change`,e=>{let t=e.target,r=t.closest(`[data-hb-name]`);if(r){n.heartbeatJobs[+(r.dataset.hbName||`0`)].name=t.value,j();return}let i=t.closest(`[data-hb-kind]`);if(i){let e=+(i.dataset.hbKind||`0`),r=n.heartbeatJobs[e]?.schedule,a=typeof r?.timeZone==`string`?r.timeZone:void 0;n.heartbeatJobs[e].schedule=t.value===`cron`?{kind:`cron`,cron:typeof r?.cron==`string`&&r.cron.trim()?r.cron:`0 9 * * *`,...a?{timeZone:a}:{}}:{kind:`every`,minutes:typeof r?.minutes==`number`&&r.minutes>0?Math.floor(r.minutes):5,...a?{timeZone:a}:{}},A(),j();return}let a=t.closest(`[data-hb-minutes]`);if(a){let e=+(a.dataset.hbMinutes||`0`),r=n.heartbeatJobs[e]?.schedule,i=Math.max(1,Math.floor(Number(t.value)||5)),o=typeof r?.timeZone==`string`?r.timeZone:void 0;n.heartbeatJobs[e].schedule={kind:`every`,minutes:i,...o?{timeZone:o}:{}},A(),j();return}let o=t.closest(`[data-hb-cron]`);if(o){let e=+(o.dataset.hbCron||`0`),r=n.heartbeatJobs[e]?.schedule,i=typeof r?.timeZone==`string`?r.timeZone:void 0,a=t.value.trim().replace(/\s+/g,` `);n.heartbeatJobs[e].schedule={kind:`cron`,cron:a,...i?{timeZone:i}:{}},A(),j();return}let s=t.closest(`[data-hb-timezone]`);if(s){let e=+(s.dataset.hbTimezone||`0`),r=n.heartbeatJobs[e]?.schedule;r?.kind===`cron`?n.heartbeatJobs[e].schedule={kind:`cron`,cron:typeof r.cron==`string`&&r.cron.trim()?r.cron:`0 9 * * *`,...t.value.trim()?{timeZone:t.value.trim()}:{}}:n.heartbeatJobs[e].schedule={kind:`every`,minutes:typeof r?.minutes==`number`&&r.minutes>0?Math.floor(r.minutes):5,...t.value.trim()?{timeZone:t.value.trim()}:{}},A(),j();return}let c=t.closest(`[data-hb-prompt]`);if(c){n.heartbeatJobs[+(c.dataset.hbPrompt||`0`)].prompt=t.value,j();return}}),document.getElementById(`memoryModal`)?.addEventListener(`click`,e=>dt(e)),document.querySelector(`#memoryModal .modal-box`)?.addEventListener(`click`,e=>e.stopPropagation()),document.querySelector(`[data-action="closeMemory"]`)?.addEventListener(`click`,()=>dt()),document.getElementById(`memTabBtnSettings`)?.addEventListener(`click`,()=>b(`settings`)),document.getElementById(`memTabBtnAdvOps`)?.addEventListener(`click`,()=>b(`status`)),document.getElementById(`memTabBtnFiles`)?.addEventListener(`click`,()=>b(`files`)),document.getElementById(`memOn`)?.addEventListener(`click`,()=>it(!0)),document.getElementById(`memOff`)?.addEventListener(`click`,()=>it(!1)),document.getElementById(`memFlushEvery`)?.addEventListener(`change`,y),document.getElementById(`memRetention`)?.addEventListener(`change`,y),document.getElementById(`memFlushLang`)?.addEventListener(`change`,y),document.getElementById(`memFlushNowBtn`)?.addEventListener(`click`,nt),document.getElementById(`advBootstrapBtn`)?.addEventListener(`click`,ut),document.getElementById(`advReindexBtn`)?.addEventListener(`click`,st),document.getElementById(`advReimportBtn`)?.addEventListener(`click`,ut),document.getElementById(`advOpenCorruptedBtn`)?.addEventListener(`click`,lt),document.getElementById(`advStatusBanner`)?.addEventListener(`click`,e=>{e.target?.id===`advUpgradeSoulBtn`&&ct(),e.target?.id===`advSynthesizeSoulBtn`&&tt()}),document.getElementById(`basicMemoryFiles`)?.addEventListener(`click`,e=>{let t=e.target?.closest(`[data-mem-delete]`);if(t){e.stopPropagation(),ot(t.dataset.memDelete||``);return}let n=e.target?.closest(`[data-mem-view]`);if(n){at(n.dataset.memView||``);return}if(e.target?.closest(`[data-mem-back]`)){rt();return}});async function Mn(){l(),$e(),$t(),await ee();let e=document.getElementById(`langToggle`);e&&(e.innerHTML=`${d.web} ${c(`lang.`+ne())}`),await we(),jn(),me(),bt(),yt(),await ge(),await Ge(),Je(),We(),Sn(),Lt(),et(),ae(),await ue(),qt(),ce(),cn();try{sessionStorage.removeItem(Z)}catch{}te(),`serviceWorker`in navigator&&navigator.serviceWorker.register(`/sw.js`).catch(()=>{})}Mn().catch(e=>{console.error(`[bootstrap]`,e)}),document.addEventListener(`keydown`,e=>{if(e.key===`Escape`){if(n.isRecording){e.preventDefault(),gn();return}document.querySelectorAll(`.modal-overlay.open`).forEach(e=>{e.classList.remove(`open`)})}(e.ctrlKey||e.metaKey)&&e.shiftKey&&e.code===`Space`&&(e.preventDefault(),_n())}),document.getElementById(`mobileMenuLeft`)?.addEventListener(`click`,B),document.getElementById(`mobileMenuRight`)?.addEventListener(`click`,V);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./memory-DeZSzBAb.js";export{e as refreshMemorySidebar};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import{t as e}from"./state-O6NVkWcL.js";import{n as t,r as n,t as r}from"./api-DygAf_G_.js";import{_ as i,l as a,n as o}from"./render-CQnnZ-_i.js";import{n as s,r as c}from"./locale-CxI5nTcf.js";import{a as l,i as u,r as d,t as f}from"./constants-IeOVgtYz.js";function p(e){let t=document.getElementById(`sttEngine`),r=document.getElementById(`sttGeminiKey`),i=document.getElementById(`sttGeminiModel`),a=document.getElementById(`sttGeminiModelCustom`),o=document.getElementById(`sttWhisperModel`),s=document.getElementById(`sttOpenaiBaseUrl`),c=document.getElementById(`sttOpenaiKey`),l=document.getElementById(`sttOpenaiModel`),u=document.getElementById(`sttVertexJson`);if(t&&(t.value=e.engine||`auto`),r&&(r.placeholder=e.geminiKeySet?`✓ 입력됨 ····${e.geminiKeyLast4||``}`:`AIza...`),i){let t=e.geminiModel||`gemini-2.5-flash-lite`;Array.from(i.options).some(e=>e.value===t)?i.value=t:(i.value=`__custom__`,a&&(a.value=t,a.style.display=``))}o&&(o.value=e.whisperModel||`mlx-community/whisper-large-v3-turbo`),s&&(s.value=e.openaiBaseUrl||``),c&&(c.placeholder=e.openaiKeySet?`✓ 입력됨 ····${e.openaiKeyLast4||``}`:`sk-...`),l&&(l.value=e.openaiModel||``),u&&(u.value=e.vertexConfig||``);function d(){let e=t?.value||`auto`,n=e===`auto`||e===`gemini`,r=e===`openai`,i=e===`vertex`,a=e===`auto`||e===`whisper`;document.querySelectorAll(`.stt-gemini`).forEach(e=>e.style.display=n?``:`none`),document.querySelectorAll(`.stt-openai`).forEach(e=>e.style.display=r?``:`none`),document.querySelectorAll(`.stt-vertex`).forEach(e=>e.style.display=i?``:`none`),document.querySelectorAll(`.stt-whisper`).forEach(e=>e.style.display=a?``:`none`)}d();async function f(){let e={stt:{engine:t?.value||`auto`,geminiModel:(i?.value===`__custom__`?a?.value:i?.value)||`gemini-2.5-flash-lite`,whisperModel:o?.value||``,openaiBaseUrl:s?.value||``,openaiModel:l?.value||``,vertexConfig:u?.value||``}};r?.value&&(e.stt.geminiApiKey=r.value),c?.value&&(e.stt.openaiApiKey=c.value),console.log(`[stt] saving:`,{engine:e.stt.engine,hasGeminiKey:!!e.stt.geminiApiKey,hasOpenaiKey:!!e.stt.openaiApiKey});try{if(await n(`/api/settings`,`PUT`,e),r?.value){let e=r.value.slice(-4);r.value=``,r.placeholder=`✓ 입력됨 ····${e}`}if(c?.value){let e=c.value.slice(-4);c.value=``,c.placeholder=`✓ 입력됨 ····${e}`}}catch(e){console.error(`[stt] save failed:`,e)}}t?.addEventListener(`change`,()=>{d(),f()}),i?.addEventListener(`change`,()=>{a&&(a.style.display=i.value===`__custom__`?``:`none`),i.value!==`__custom__`&&f()}),a?.addEventListener(`blur`,f),r?.addEventListener(`blur`,()=>{r.value&&f()}),c?.addEventListener(`blur`,()=>{c.value&&f()}),s?.addEventListener(`blur`,f),l?.addEventListener(`blur`,f),o?.addEventListener(`blur`,f),u?.addEventListener(`blur`,f)}async function ee(){let e=document.getElementById(`tgToken`)?.value.trim()||``,t=document.getElementById(`tgChatIds`)?.value.trim()||``;await n(`/api/settings`,`PUT`,{telegram:{token:e,allowedChatIds:t?t.split(`,`).map(e=>parseInt(e.trim(),10)).filter(e=>!isNaN(e)):[]}})}async function te(e){document.getElementById(`tgOn`)?.classList.toggle(`active`,e),document.getElementById(`tgOff`)?.classList.toggle(`active`,!e),await n(`/api/settings`,`PUT`,{telegram:{enabled:e}})}async function m(e){document.getElementById(`tgForwardOn`)?.classList.toggle(`active`,e),document.getElementById(`tgForwardOff`)?.classList.toggle(`active`,!e),await n(`/api/settings`,`PUT`,{telegram:{forwardAll:e}})}async function h(e){document.getElementById(`tgMentionOn`)?.classList.toggle(`active`,e),document.getElementById(`tgMentionOff`)?.classList.toggle(`active`,!e),await n(`/api/settings`,`PUT`,{telegram:{mentionOnly:e}})}function g(e){if(!e.telegram)return;let t=e.telegram;document.getElementById(`tgOn`)?.classList.toggle(`active`,!!t.enabled),document.getElementById(`tgOff`)?.classList.toggle(`active`,!t.enabled);let n=document.getElementById(`tgToken`);t.token&&n&&(n.value=t.token);let r=document.getElementById(`tgChatIds`);t.allowedChatIds?.length&&r&&(r.value=t.allowedChatIds.join(`, `));let i=t.forwardAll!==!1;document.getElementById(`tgForwardOn`)?.classList.toggle(`active`,i),document.getElementById(`tgForwardOff`)?.classList.toggle(`active`,!i);let a=t.mentionOnly!==!1;document.getElementById(`tgMentionOn`)?.classList.toggle(`active`,a),document.getElementById(`tgMentionOff`)?.classList.toggle(`active`,!a)}async function _(){let e=document.getElementById(`dcToken`)?.value.trim()||``,t=document.getElementById(`dcGuildId`)?.value.trim()||``,r=document.getElementById(`dcChannelIds`)?.value.trim()||``;await n(`/api/settings`,`PUT`,{discord:{token:e,guildId:t,channelIds:r?r.split(`,`).map(e=>e.trim()).filter(Boolean):[]}})}async function v(e){document.getElementById(`dcOn`)?.classList.toggle(`active`,e),document.getElementById(`dcOff`)?.classList.toggle(`active`,!e),await n(`/api/settings`,`PUT`,{discord:{enabled:e}})}async function y(e){document.getElementById(`dcForwardOn`)?.classList.toggle(`active`,e),document.getElementById(`dcForwardOff`)?.classList.toggle(`active`,!e),await n(`/api/settings`,`PUT`,{discord:{forwardAll:e}})}async function b(e){document.getElementById(`dcAllowBotsOn`)?.classList.toggle(`active`,e),document.getElementById(`dcAllowBotsOff`)?.classList.toggle(`active`,!e),await n(`/api/settings`,`PUT`,{discord:{allowBots:e}})}async function ne(e){document.getElementById(`dcMentionOn`)?.classList.toggle(`active`,e),document.getElementById(`dcMentionOff`)?.classList.toggle(`active`,!e),await n(`/api/settings`,`PUT`,{discord:{mentionOnly:e}})}function re(e){if(!e.discord)return;let t=e.discord;document.getElementById(`dcOn`)?.classList.toggle(`active`,!!t.enabled),document.getElementById(`dcOff`)?.classList.toggle(`active`,!t.enabled);let n=document.getElementById(`dcToken`);t.token&&n&&(n.value=t.token);let r=document.getElementById(`dcGuildId`);t.guildId&&r&&(r.value=t.guildId);let i=document.getElementById(`dcChannelIds`);t.channelIds?.length&&i&&(i.value=t.channelIds.join(`, `));let a=t.forwardAll!==!1;document.getElementById(`dcForwardOn`)?.classList.toggle(`active`,a),document.getElementById(`dcForwardOff`)?.classList.toggle(`active`,!a);let o=!!t.allowBots;document.getElementById(`dcAllowBotsOn`)?.classList.toggle(`active`,o),document.getElementById(`dcAllowBotsOff`)?.classList.toggle(`active`,!o);let s=!!t.mentionOnly;document.getElementById(`dcMentionOn`)?.classList.toggle(`active`,s),document.getElementById(`dcMentionOff`)?.classList.toggle(`active`,!s)}async function ie(e){document.getElementById(`chTelegram`)?.classList.toggle(`active`,e===`telegram`),document.getElementById(`chDiscord`)?.classList.toggle(`active`,e===`discord`),document.getElementById(`channelTelegramSettings`)?.style.setProperty(`display`,e===`telegram`?``:`none`),document.getElementById(`channelDiscordSettings`)?.style.setProperty(`display`,e===`discord`?``:`none`),await n(`/api/settings`,`PUT`,{channel:e})}function ae(e){let t=e.channel||`telegram`;document.getElementById(`chTelegram`)?.classList.toggle(`active`,t===`telegram`),document.getElementById(`chDiscord`)?.classList.toggle(`active`,t===`discord`),document.getElementById(`channelTelegramSettings`)?.style.setProperty(`display`,t===`telegram`?``:`none`),document.getElementById(`channelDiscordSettings`)?.style.setProperty(`display`,t===`discord`?``:`none`)}function x(e){let t=document.getElementById(`fallbackOrderList`);if(!t)return;let n=Object.keys(e.perCli||{}),r=e.fallbackOrder||[],a=Math.min(n.length-1,3),s=``;for(let e=0;e<a;e++){let t=r[e]||``,a=n.map(e=>`<option value="${o(e)}" ${e===t?`selected`:``}>${o(e)}</option>`).join(``);s+=`
|
|
2
|
-
<div class="settings-row sub-row">
|
|
3
|
-
<label style="min-width:60px">Fallback ${e+1}</label>
|
|
4
|
-
<select id="fallback${e}"
|
|
5
|
-
style="font-size:11px;padding:4px;background:var(--surface);color:var(--text);border:1px solid var(--border);border-radius:4px;flex:1">
|
|
6
|
-
<option value="">${i(`settings.none`)}</option>
|
|
7
|
-
${a}
|
|
8
|
-
</select>
|
|
9
|
-
</div>`}t.innerHTML=s}async function oe(){await n(`/api/settings`,`PUT`,{fallbackOrder:[...document.querySelectorAll(`#fallbackOrderList select`)].map(e=>e.value).filter(Boolean)})}async function S(){try{let e=await r(`/api/mcp`);if(!e)return;let t=document.getElementById(`mcpServerList`);if(!t)return;let n=Object.entries(e.servers||{});if(!n.length){t.textContent=i(`mcp.noServers`);return}t.innerHTML=n.map(([e,t])=>`<div style="padding:2px 0">• <b>${o(e)}</b> <span style="opacity:.6">${o(t.command)} ${(t.args||[]).slice(0,2).map(e=>o(e)).join(` `)}</span></div>`).join(``)}catch{}}async function C(){let e=document.getElementById(`mcpSyncResult`);if(e){e.style.display=`block`,e.textContent=i(`mcp.syncing`);try{let t=await n(`/api/mcp/sync`,`POST`,{});if(!t){e.innerHTML=`${a.error} sync failed`;return}let r=t.results||{};e.innerHTML=Object.entries(r).map(([e,t])=>`${t?a.check:a.skip} ${o(e)}`).join(` `)}catch(t){e.innerHTML=`${a.error} ${o(t.message)}`}}}async function se(){let e=document.getElementById(`mcpSyncResult`);if(e){e.style.display=`block`,e.textContent=i(`mcp.installing`);try{let t=await n(`/api/mcp/install`,`POST`,{});if(!t){e.innerHTML=`${a.error} install failed`;return}e.innerHTML=Object.entries(t.results||{}).map(([e,t])=>`${t.status===`installed`?a.check:t.status===`skip`?a.skip:a.error} <b>${o(e)}</b>: ${o(t.status)}${t.bin?` ${a.arrowRight} `+o(t.bin):``}`).join(`<br>`),S()}catch(t){e.innerHTML=`${a.error} ${o(t.message)}`}}}var ce=`<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Claude</title><path d="M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z" fill="#D97757" fill-rule="nonzero"></path></svg>`,w=`<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>OpenAI</title><path d="M9.205 8.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357 1.356-.523 2.117-.523 2.854 0 4.662 2.212 4.662 4.566 0 .167 0 .357-.024.547l-4.71-2.759a.797.797 0 00-.856 0l-5.97 3.473zm10.609 8.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473 1.95-1.118a.433.433 0 01.476 0l4.543 2.617c1.309.76 2.189 2.378 2.189 3.948 0 1.808-1.07 3.473-2.76 4.163zM7.802 12.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545 1.95-4.472 4.591-4.472 1 0 1.927.333 2.712.928L8.23 5.067c-.285.166-.428.404-.428.737v6.898zM12 15.128l-2.795-1.57v-3.33L12 8.658l2.795 1.57v3.33L12 15.128zm1.796 7.23c-1 0-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974 1.142c.167.095.238.238.238.428v5.233c0 2.545-1.974 4.472-4.614 4.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482 4.482 0 014.21 6.327v5.423c0 .333.143.571.428.738l5.947 3.449-1.95 1.118a.432.432 0 01-.476 0zm-.262 3.9c-2.688 0-4.662-2.021-4.662-4.519 0-.19.024-.38.047-.57l4.686 2.71c.286.167.571.167.856 0l5.97-3.448v2.26c0 .19-.07.333-.237.428l-4.543 2.616c-.619.357-1.356.523-2.117.523zm5.899 2.83a5.947 5.947 0 005.827-4.756C22.287 18.339 24 15.84 24 13.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498 0-3.401-2.759-5.947-5.946-5.947-.642 0-1.26.095-1.88.31A5.962 5.962 0 0010.205 0a5.947 5.947 0 00-5.827 4.757C1.713 5.447 0 7.945 0 10.49c0 1.666.713 3.283 1.998 4.448-.119.5-.19 1-.19 1.499 0 3.401 2.759 5.946 5.946 5.946.642 0 1.26-.095 1.88-.309a5.96 5.96 0 004.162 1.713z"></path></svg>`,le=`<svg height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Gemini</title><path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z" fill="#3186FF"></path><path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z" fill="url(#lobe-icons-gemini-0-_R_0_)"></path><path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z" fill="url(#lobe-icons-gemini-1-_R_0_)"></path><path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z" fill="url(#lobe-icons-gemini-2-_R_0_)"></path><defs><linearGradient gradientUnits="userSpaceOnUse" id="lobe-icons-gemini-0-_R_0_" x1="7" x2="11" y1="15.5" y2="12"><stop stop-color="#08B962"></stop><stop offset="1" stop-color="#08B962" stop-opacity="0"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="lobe-icons-gemini-1-_R_0_" x1="8" x2="11.5" y1="5.5" y2="11"><stop stop-color="#F94543"></stop><stop offset="1" stop-color="#F94543" stop-opacity="0"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="lobe-icons-gemini-2-_R_0_" x1="3.5" x2="17.5" y1="13.5" y2="12"><stop stop-color="#FABC12"></stop><stop offset=".46" stop-color="#FABC12" stop-opacity="0"></stop></linearGradient></defs></svg>`,T=`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><title>GitHub Copilot</title><path d="M23.922 16.997C23.061 18.492 18.063 22.02 12 22.02 5.937 22.02.939 18.492.078 16.997A.641.641 0 0 1 0 16.741v-2.869a.883.883 0 0 1 .053-.22c.372-.935 1.347-2.292 2.605-2.656.167-.429.414-1.055.644-1.517a10.098 10.098 0 0 1-.052-1.086c0-1.331.282-2.499 1.132-3.368.397-.406.89-.717 1.474-.952C7.255 2.937 9.248 1.98 11.978 1.98c2.731 0 4.767.957 6.166 2.093.584.235 1.077.546 1.474.952.85.869 1.132 2.037 1.132 3.368 0 .368-.014.733-.052 1.086.23.462.477 1.088.644 1.517 1.258.364 2.233 1.721 2.605 2.656a.841.841 0 0 1 .053.22v2.869a.641.641 0 0 1-.078.256Zm-11.75-5.992h-.344a4.359 4.359 0 0 1-.355.508c-.77.947-1.918 1.492-3.508 1.492-1.725 0-2.989-.359-3.782-1.259a2.137 2.137 0 0 1-.085-.104L4 11.746v6.585c1.435.779 4.514 2.179 8 2.179 3.486 0 6.565-1.4 8-2.179v-6.585l-.098-.104s-.033.045-.085.104c-.793.9-2.057 1.259-3.782 1.259-1.59 0-2.738-.545-3.508-1.492a4.359 4.359 0 0 1-.355-.508Zm2.328 3.25c.549 0 1 .451 1 1v2c0 .549-.451 1-1 1-.549 0-1-.451-1-1v-2c0-.549.451-1 1-1Zm-5 0c.549 0 1 .451 1 1v2c0 .549-.451 1-1 1-.549 0-1-.451-1-1v-2c0-.549.451-1 1-1Zm3.313-6.185c.136 1.057.403 1.913.878 2.497.442.544 1.134.938 2.344.938 1.573 0 2.292-.337 2.657-.751.384-.435.558-1.15.558-2.361 0-1.14-.243-1.847-.705-2.319-.477-.488-1.319-.862-2.824-1.025-1.487-.161-2.192.138-2.533.529-.269.307-.437.808-.438 1.578v.021c0 .265.021.562.063.893Zm-1.626 0c.042-.331.063-.628.063-.894v-.02c-.001-.77-.169-1.271-.438-1.578-.341-.391-1.046-.69-2.533-.529-1.505.163-2.347.537-2.824 1.025-.462.472-.705 1.179-.705 2.319 0 1.211.175 1.926.558 2.361.365.414 1.084.751 2.657.751 1.21 0 1.902-.394 2.344-.938.475-.584.742-1.44.878-2.497Z"/></svg>
|
|
10
|
-
`,ue=`<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Claude</title><path d="M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z"></path></svg>`,de=`<svg fill="currentColor" fill-rule="evenodd" height="1em" style="flex:none;line-height:1" viewBox="0 0 24 24" width="1em" xmlns="http://www.w3.org/2000/svg"><title>Gemini</title><path d="M20.616 10.835a14.147 14.147 0 01-4.45-3.001 14.111 14.111 0 01-3.678-6.452.503.503 0 00-.975 0 14.134 14.134 0 01-3.679 6.452 14.155 14.155 0 01-4.45 3.001c-.65.28-1.318.505-2.002.678a.502.502 0 000 .975c.684.172 1.35.397 2.002.677a14.147 14.147 0 014.45 3.001 14.112 14.112 0 013.679 6.453.502.502 0 00.975 0c.172-.685.397-1.351.677-2.003a14.145 14.145 0 013.001-4.45 14.113 14.113 0 016.453-3.678.503.503 0 000-.975 13.245 13.245 0 01-2.003-.678z"></path></svg>`,fe=`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><title>GitHub Copilot</title><path d="M23.922 16.997C23.061 18.492 18.063 22.02 12 22.02 5.937 22.02.939 18.492.078 16.997A.641.641 0 0 1 0 16.741v-2.869a.883.883 0 0 1 .053-.22c.372-.935 1.347-2.292 2.605-2.656.167-.429.414-1.055.644-1.517a10.098 10.098 0 0 1-.052-1.086c0-1.331.282-2.499 1.132-3.368.397-.406.89-.717 1.474-.952C7.255 2.937 9.248 1.98 11.978 1.98c2.731 0 4.767.957 6.166 2.093.584.235 1.077.546 1.474.952.85.869 1.132 2.037 1.132 3.368 0 .368-.014.733-.052 1.086.23.462.477 1.088.644 1.517 1.258.364 2.233 1.721 2.605 2.656a.841.841 0 0 1 .053.22v2.869a.641.641 0 0 1-.078.256Zm-11.75-5.992h-.344a4.359 4.359 0 0 1-.355.508c-.77.947-1.918 1.492-3.508 1.492-1.725 0-2.989-.359-3.782-1.259a2.137 2.137 0 0 1-.085-.104L4 11.746v6.585c1.435.779 4.514 2.179 8 2.179 3.486 0 6.565-1.4 8-2.179v-6.585l-.098-.104s-.033.045-.085.104c-.793.9-2.057 1.259-3.782 1.259-1.59 0-2.738-.545-3.508-1.492a4.359 4.359 0 0 1-.355-.508Zm2.328 3.25c.549 0 1 .451 1 1v2c0 .549-.451 1-1 1-.549 0-1-.451-1-1v-2c0-.549.451-1 1-1Zm-5 0c.549 0 1 .451 1 1v2c0 .549-.451 1-1 1-.549 0-1-.451-1-1v-2c0-.549.451-1 1-1Zm3.313-6.185c.136 1.057.403 1.913.878 2.497.442.544 1.134.938 2.344.938 1.573 0 2.292-.337 2.657-.751.384-.435.558-1.15.558-2.361 0-1.14-.243-1.847-.705-2.319-.477-.488-1.319-.862-2.824-1.025-1.487-.161-2.192.138-2.533.529-.269.307-.437.808-.438 1.578v.021c0 .265.021.562.063.893Zm-1.626 0c.042-.331.063-.628.063-.894v-.02c-.001-.77-.169-1.271-.438-1.578-.341-.391-1.046-.69-2.533-.529-1.505.163-2.347.537-2.824 1.025-.462.472-.705 1.179-.705 2.319 0 1.211.175 1.926.558 2.361.365.414 1.084.751 2.657.751 1.21 0 1.902-.394 2.344-.938.475-.584.742-1.44.878-2.497Z"/></svg>
|
|
11
|
-
`,E=`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><title>Discord</title><path d="M20.317 4.3698a19.7913 19.7913 0 00-4.8851-1.5152.0741.0741 0 00-.0785.0371c-.211.3753-.4447.8648-.6083 1.2495-1.8447-.2762-3.68-.2762-5.4868 0-.1636-.3933-.4058-.8742-.6177-1.2495a.077.077 0 00-.0785-.037 19.7363 19.7363 0 00-4.8852 1.515.0699.0699 0 00-.0321.0277C.5334 9.0458-.319 13.5799.0992 18.0578a.0824.0824 0 00.0312.0561c2.0528 1.5076 4.0413 2.4228 5.9929 3.0294a.0777.0777 0 00.0842-.0276c.4616-.6304.8731-1.2952 1.226-1.9942a.076.076 0 00-.0416-.1057c-.6528-.2476-1.2743-.5495-1.8722-.8923a.077.077 0 01-.0076-.1277c.1258-.0943.2517-.1923.3718-.2914a.0743.0743 0 01.0776-.0105c3.9278 1.7933 8.18 1.7933 12.0614 0a.0739.0739 0 01.0785.0095c.1202.099.246.1981.3728.2924a.077.077 0 01-.0066.1276 12.2986 12.2986 0 01-1.873.8914.0766.0766 0 00-.0407.1067c.3604.698.7719 1.3628 1.225 1.9932a.076.076 0 00.0842.0286c1.961-.6067 3.9495-1.5219 6.0023-3.0294a.077.077 0 00.0313-.0552c.5004-5.177-.8382-9.6739-3.5485-13.6604a.061.061 0 00-.0312-.0286zM8.02 15.3312c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9555-2.4189 2.157-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.9555 2.4189-2.1569 2.4189zm7.9748 0c-1.1825 0-2.1569-1.0857-2.1569-2.419 0-1.3332.9554-2.4189 2.1569-2.4189 1.2108 0 2.1757 1.0952 2.1568 2.419 0 1.3332-.946 2.4189-2.1568 2.4189Z"/></svg>`,D=`<svg role="img" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><title>Telegram</title><path d="M11.944 0A12 12 0 0 0 0 12a12 12 0 0 0 12 12 12 12 0 0 0 12-12A12 12 0 0 0 12 0a12 12 0 0 0-.056 0zm4.962 7.224c.1-.002.321.023.465.14a.506.506 0 0 1 .171.325c.016.093.036.306.02.472-.18 1.898-.962 6.502-1.36 8.627-.168.9-.499 1.201-.82 1.23-.696.065-1.225-.46-1.9-.902-1.056-.693-1.653-1.124-2.678-1.8-1.185-.78-.417-1.21.258-1.91.177-.184 3.247-2.977 3.307-3.23.007-.032.014-.15-.056-.212s-.174-.041-.249-.024c-.106.024-1.793 1.14-5.061 3.345-.48.33-.913.49-1.302.48-.428-.008-1.252-.241-1.865-.44-.752-.245-1.349-.374-1.297-.789.027-.216.325-.437.893-.663 3.498-1.524 5.83-2.529 6.998-3.014 3.332-1.386 4.025-1.627 4.476-1.635z"/></svg>`,O=`<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="4 17 10 11 4 5"/><line x1="12" y1="19" x2="20" y2="19"/></svg>
|
|
12
|
-
`,pe={claude:{color:ce,mono:ue,label:`Claude`},openai:{color:w,mono:w,label:`OpenAI`},gemini:{color:le,mono:de,label:`Gemini`},copilot:{color:T,mono:fe,label:`GitHub Copilot`},codex:{color:w,mono:w,label:`Codex (OpenAI)`},opencode:{color:O,mono:O,label:`OpenCode`},discord:{color:E,mono:E,label:`Discord`},telegram:{color:D,mono:D,label:`Telegram`}};function k(e,t=`color`){let n=e.toLowerCase().replace(/[-_\s]/g,``),r;if(n===`claude`||n.startsWith(`claude`))r=`claude`;else if(n===`gemini`||n.startsWith(`gemini`))r=`gemini`;else if(n.startsWith(`copilot`)||n===`githubcopilot`)r=`copilot`;else if(n===`codex`)r=`codex`;else if(n===`opencode`)r=`opencode`;else if(n===`openai`||n.startsWith(`gpt`)||n.startsWith(`o1`)||n.startsWith(`o3`)||n.startsWith(`o4`))r=`openai`;else if(n===`discord`)r=`discord`;else if(n===`telegram`)r=`telegram`;else return``;let i=pe[r];return t===`mono`?i.mono:i.color}function A(e=document.body){let t=e.querySelectorAll(`[data-provider]`);for(let e of t){let t=k(e.dataset.provider||``);t&&(e.innerHTML=t,e.classList.add(`cli-provider-icon`))}}function j(e){return e.charAt(0).toUpperCase()+e.slice(1)}function M(e){return document.getElementById(`model`+j(e))}function N(e){return document.getElementById(`customModel`+j(e))}function P(e){return document.getElementById(`effort`+j(e))}function F(e,t,{includeCustom:n=!1,includeDefault:r=!1,selected:a=``}={}){if(!e)return;let s=r?`<option value="default">default</option>`:``,c=n?`<option value="__custom__">${i(`model.customOption`)}</option>`:``;e.innerHTML=s+(t||[]).map(e=>`<option value="${o(e)}">${o(e)}</option>`).join(``)+c,a&&Array.from(e.options).some(e=>e.value===a)&&(e.value=a)}function I(e,t){if(!e||!t||Array.from(e.options).some(e=>e.value===t))return;let n=document.createElement(`option`);n.value=t,n.textContent=t;let r=e.querySelector(`option[value="__custom__"]`);r?e.insertBefore(n,r):e.appendChild(n)}function L(e=null){let t=d(),n=document.getElementById(`selCli`);if(n){let r=e?.cli||n.value||t[0]||`claude`;n.innerHTML=t.map(e=>{let t=u(e)?.label||e;return`<option value="${o(e)}">${o(t)}</option>`}).join(``),Array.from(n.options).some(e=>e.value===r)&&(n.value=r)}let r=document.getElementById(`flushCli`);if(r){let n=e?.memory?.cli||r.value||``;r.innerHTML=`<option value="">(active CLI)</option>`+t.map(e=>`<option value="${o(e)}">${o(e)}</option>`).join(``),Array.from(r.options).some(e=>e.value===n)&&(r.value=n)}}function R(e,t){if(e!==`claude`)return t;let n=(t||``).trim();switch(n){case`claude-opus-4-6[1m]`:case`claude-opus-4-6`:case`claude-opus-4-7[1m]`:case`claude-opus-4-7`:case`opus[1m]`:return`opus`;case`claude-sonnet-4-6[1m]`:return`sonnet[1m]`;case`claude-sonnet-4-6`:case`claude-sonnet-4-5`:return`sonnet`;case`claude-haiku-4-5`:case`claude-haiku-4-5-20251001`:return`haiku`;default:return n}}function z(e=null){for(let t of d()){let n=M(t);if(n){let r=R(t,e?.perCli?.[t]?.model||n.value||``);F(n,f[t]||[],{includeCustom:!0,selected:r}),r&&!Array.from(n.options).some(e=>e.value===r)&&(I(n,r),n.value=r)}let r=P(t);if(r){let n=u(t),i=[``].concat(n?.efforts||[]),a=e?.perCli?.[t]?.effort||r.value||``,s=[...new Set(i)],c=n?.efforts?.length===0&&n?.effortNote?n.effortNote:`— none`;r.innerHTML=s.map(e=>e?`<option value="${o(e)}">${o(e)}</option>`:`<option value="">${o(c)}</option>`).join(``),n?.effortNote&&(r.title=n.effortNote),r.disabled=n?.efforts?.length===0&&!!n?.effortNote,Array.from(r.options).some(e=>e.value===a)&&(r.value=a)}}}function B(e,t=``){let n=document.getElementById(`selEffort`);if(!n)return;let r=u(e);if(r?.effortNote){n.innerHTML=`<option value="">${o(r.effortNote)}</option>`,n.title=r.effortNote,n.disabled=!0;return}let i=[``].concat(r?.efforts||[]);n.innerHTML=[...new Set(i)].map(e=>e?`<option value="${o(e)}">${o(e)}</option>`:`<option value="">— none</option>`).join(``),n.disabled=!1,n.title=``,Array.from(n.options).some(e=>e.value===t)&&(n.value=t)}async function me(){await l();let e=await r(`/api/settings`);if(!e)return;s(e.locale??``),L(e),z(e);let t=document.getElementById(`selCli`);t&&Array.from(t.options).some(t=>t.value===e.cli)&&(t.value=e.cli);let n=document.getElementById(`inpCwd`);n&&(n.textContent=e.workingDir);let i=document.getElementById(`headerCli`);if(i){let t=k(e.cli);i.innerHTML=t?`${t} ${o(e.cli)}`:o(e.cli)}if(H(e.permissions,!1),e.perCli)for(let[t,n]of Object.entries(e.perCli)){let e=M(t),r=P(t);if(e&&n.model){let r=R(t,n.model);I(e,r),e.value=r}if(r&&(r.value=n.effort||``),t===`codex`&&n.fastMode!==void 0&&(document.getElementById(`codexFastOn`)?.classList.toggle(`active`,n.fastMode),document.getElementById(`codexFastOff`)?.classList.toggle(`active`,!n.fastMode)),t===`codex`){let e=!!n.contextWindow;document.getElementById(`codexCtxOn`)?.classList.toggle(`active`,e),document.getElementById(`codexCtxOff`)?.classList.toggle(`active`,!e);let t=document.getElementById(`codexCtxValues`);t&&(t.style.display=e?``:`none`);let r=document.getElementById(`codexCtxWindow`),i=document.getElementById(`codexCtxCompact`);r&&n.contextWindowSize&&(r.value=String(n.contextWindowSize)),i&&n.contextCompactLimit&&(i.value=String(n.contextCompactLimit))}if(t===`claude`){let e=!!(n.model&&String(n.model).endsWith(`[1m]`));document.getElementById(`claude1mOn`)?.classList.toggle(`active`,e),document.getElementById(`claude1mOff`)?.classList.toggle(`active`,!e)}}K(!1);let a=e.activeOverrides?.[e.cli]||{},c=e.perCli?.[e.cli]||{},u=a.model||c.model,d=a.effort||c.effort||``,f=document.getElementById(`selModel`);if(u&&f){let t=R(e.cli,u);t&&!Array.from(f.options).some(e=>e.value===t)&&I(f,t),f.value=t}B(e.cli,d),g(e),re(e),ae(e),x(e),S(),p(e.stt||{})}async function V(){let e={cli:document.getElementById(`selCli`)?.value||`claude`},t=document.getElementById(`headerCli`);if(t){let n=k(e.cli);t.innerHTML=n?`${n} ${o(e.cli)}`:o(e.cli)}await n(`/api/settings`,`PUT`,e)}function H(e,n=!0){n&&t(`/api/settings`,`PUT`,{permissions:`auto`})}function U(e){let t=M(e);return t?t.value===`__custom__`?N(e)?.value?.trim()||t.options[0]?.value||`default`:t.value:`default`}function he(e,t){let n=N(e);n&&(t.value===`__custom__`?(n.style.display=`block`,n.focus()):(n.style.display=`none`,e===`claude`&&W(t.value),G()))}function W(e){let t=!!(e&&e.endsWith(`[1m]`));document.getElementById(`claude1mOn`)?.classList.toggle(`active`,t),document.getElementById(`claude1mOff`)?.classList.toggle(`active`,!t)}function ge(e,t){let n=t.value.trim();if(!n)return;let r=M(e);r&&(I(r,n),r.value=n,t.style.display=`none`,e===`claude`&&W(n),G())}async function G(){let e={};for(let t of d()){if(!M(t))continue;let n=P(t),r={model:U(t),effort:n?n.value:``};if(t===`codex`){r.fastMode=document.getElementById(`codexFastOn`)?.classList.contains(`active`)??!1,r.contextWindow=document.getElementById(`codexCtxOn`)?.classList.contains(`active`)??!1;let e=document.getElementById(`codexCtxWindow`),t=document.getElementById(`codexCtxCompact`);r.contextWindowSize=parseInt(e?.value||`1000000`,10),r.contextCompactLimit=parseInt(t?.value||`900000`,10)}e[t]=r}await n(`/api/settings`,`PUT`,{perCli:e})}function K(e=!0){let t=document.getElementById(`selCli`)?.value||`claude`,n=f[t]||[],a=document.getElementById(`selModel`);F(a,n,{includeCustom:!0,includeDefault:!0});let s=document.getElementById(`headerCli`);if(s){let e=k(t);s.innerHTML=e?`${e} ${o(t)}`:o(t)}B(t);let c=document.getElementById(`selModelCustom`);c&&c.remove();let l=document.createElement(`input`);if(l.type=`text`,l.id=`selModelCustom`,l.className=`custom-model-input`,l.placeholder=i(`model.placeholder`),l.style.display=`none`,l.onchange=function(){let e=this.value.trim();!e||!a||(I(a,e),a.value=e,this.style.display=`none`,q())},!a){e&&V();return}a.parentElement?.appendChild(l),a.onchange=function(){this.value===`__custom__`?(l.style.display=`block`,l.focus()):(l.style.display=`none`,q())},r(`/api/settings`).then(e=>{if(!e)return;let n=e.activeOverrides?.[t]||{},r=e.perCli?.[t]||{},i=n.model||r.model,o=n.effort||r.effort||``;if(i&&a){let e=R(t,i);I(a,e),a.value=e}B(t,o)}),e&&V()}async function q(){let e=document.getElementById(`selCli`)?.value||`claude`,t=document.getElementById(`selModel`)?.value||`default`;t===`__custom__`&&(t=document.getElementById(`selModelCustom`)?.value?.trim()||`default`);let r=document.getElementById(`selEffort`),i={};i[e]={model:t},r&&!r.disabled&&(i[e].effort=r.value||``),await n(`/api/settings`,`PUT`,{activeOverrides:i})}function _e(){let e=f[document.getElementById(`flushCli`)?.value||document.getElementById(`selCli`)?.value||`claude`]||[];F(document.getElementById(`flushModel`),e,{includeDefault:!0}),J(),ye()}async function ve(){let e=await r(`/api/memory-files`);if(!e)return;let t=document.getElementById(`flushCli`),n=document.getElementById(`flushModel`);t&&e.cli&&(t.value=e.cli),F(n,f[e.cli||document.getElementById(`selCli`)?.value||`claude`]||[],{includeDefault:!0}),n&&e.model&&(I(n,e.model),n.value=e.model),J()}async function ye(){await n(`/api/memory-files/settings`,`PUT`,{cli:document.getElementById(`flushCli`)?.value||``,model:document.getElementById(`flushModel`)?.value||``})}function J(){let e=document.getElementById(`flushAgentBadge`);if(!e)return;let t=document.getElementById(`flushCli`)?.value||``,n=document.getElementById(`flushModel`)?.value||``,r=t||document.getElementById(`selCli`)?.value||``,i=[];r&&i.push(t?r:`${r}*`),n&&n!==`default`&&i.push(n),e.textContent=i.length?`(${i.join(` / `)})`:``}async function Y(t=!1){let n=Number(localStorage.getItem(`cliStatusInterval`)||300);if(!t&&e.cliStatusCache&&n>0&&Date.now()-e.cliStatusTs<n*1e3){X({cliStatus:e.cliStatusCache?.cliStatus,quota:e.cliStatusCache?.quota});return}let i=document.getElementById(`cliStatusList`);i&&(i.innerHTML=`<div style="color:var(--text-dim);font-size:11px">Loading...</div>`);let[a,o]=await Promise.all([r(`/api/cli-status`),r(`/api/quota`)]);e.cliStatusCache={cliStatus:a,quota:o},e.cliStatusTs=Date.now(),X({cliStatus:a,quota:o})}function X(e){let{cliStatus:t,quota:n}=e,s=document.getElementById(`cliStatusList`),c={claude:{install:`npm i -g @anthropic-ai/claude-code`,auth:`claude auth`},codex:{install:`npm i -g @openai/codex`,auth:`codex login`},gemini:{install:`npm i -g @google/gemini-cli`,auth:`gemini (${i(`cli.gemini.auth`)})`},opencode:{install:`npm i -g opencode-ai`,auth:`opencode auth`},copilot:{install:`npm i -g copilot`,auth:`copilot login 또는 gh auth login`}},l=``;if(!t||typeof t!=`object`){s&&(s.innerHTML=`<div style="color:var(--text-dim);font-size:11px">Failed to load CLI status</div>`);return}for(let[e,r]of Object.entries(t)){let t=n?.[e],s;s=r.available?!t||t.error?`ok`:t.authenticated===!1?`warn`:`ok`:`missing`;let u=``;if(t?.account){let e=[];t.account.email&&e.push(t.account.email),t.account.type&&e.push(t.account.type),t.account.plan&&e.push(t.account.plan),t.account.tier&&e.push(t.account.tier),e.length&&(u=`<div style="font-size:10px;color:var(--text-dim);margin:2px 0 4px 16px">${o(e.join(` · `))}</div>`)}let d=``;if(!r.available||s===`warn`){let t=c[e];if(t){let e=!r.available,n=i(e?`cli.authRequired`:`cli.notAuthenticated`),a=e?`#ef4444`:`#fbbf24`;d=`
|
|
13
|
-
<div style="font-size:10px;margin:4px 0 2px 16px;padding:6px 8px;background:var(--bg-dim, #1e1e2e);border-radius:4px;border-left:2px solid ${a}">
|
|
14
|
-
<div style="color:${a};margin-bottom:3px">${n}</div>
|
|
15
|
-
${e?`<div style="color:var(--text-dim)"><code style="font-size:10px;background:var(--border);padding:1px 4px;border-radius:2px">${o(t.install)}</code></div>`:``}
|
|
16
|
-
<div style="color:var(--text-dim)${e?`;margin-top:2px`:``}"><code style="font-size:10px;background:var(--border);padding:1px 4px;border-radius:2px">${o(t.auth)}</code></div>
|
|
17
|
-
</div>
|
|
18
|
-
`}}let f=``;if(t?.windows?.length)f=t.windows.map(e=>{let t=Math.round(e.percent),n=t>80?`#ef4444`:t>50?`#fbbf24`:`#38bdf8`,r=e.label.replace(`-hour`,`h`).replace(`-day`,`d`).replace(` Sonnet`,``).replace(` Opus`,``).replace(`plus monthly subscriber quota`,`plus`).replace(`Premium`,`Prem`),i=``;if(e.resetsAt){let t=new Date(typeof e.resetsAt==`number`?e.resetsAt*1e3:e.resetsAt),n=new Date;i=t.toDateString()===n.toDateString()?`${t.getHours()}:${String(t.getMinutes()).padStart(2,`0`)}`:`${t.getMonth()+1}/${t.getDate()}`}return`
|
|
19
|
-
<div style="display:flex;align-items:center;gap:4px;margin-left:16px;font-size:10px;color:var(--text-dim)">
|
|
20
|
-
<span style="min-width:18px;max-width:48px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis">${o(r)}</span>
|
|
21
|
-
<div style="flex:1;height:4px;background:var(--border);border-radius:2px;overflow:hidden">
|
|
22
|
-
<div style="width:${t}%;height:100%;background:${n};border-radius:2px"></div>
|
|
23
|
-
</div>
|
|
24
|
-
<span style="width:24px;text-align:right">${t}%</span>
|
|
25
|
-
${i?`<span style="width:30px;text-align:right;opacity:0.6">${i}</span>`:``}
|
|
26
|
-
</div>
|
|
27
|
-
`}).join(``);else if(t?.error&&r.available){let e=t.reason===`rate_limited`?`Rate limited — retry in a moment`:`Usage data unavailable`;f=`<div style="font-size:10px;color:var(--text-dim);margin:2px 0 0 16px;opacity:0.7">${a.warning} ${e}</div>`}l+=`
|
|
28
|
-
<div class="settings-group" style="margin-bottom:6px;padding:8px 10px">
|
|
29
|
-
<div class="cli-status-row">
|
|
30
|
-
<span class="cli-dot ${s}"></span>
|
|
31
|
-
<span class="cli-provider-icon" aria-hidden="true">${k(e)||``}</span>
|
|
32
|
-
<span class="cli-name" style="font-weight:600">${o(e)}</span>${e===`copilot`?`<button id="copilotKeychainBtn" style="font-size:9px;margin-left:6px;padding:1px 5px;background:var(--border);color:var(--text-dim);border:1px solid var(--text-dim);border-radius:3px;cursor:pointer;vertical-align:middle;line-height:1" title="${i(`copilot.keychainHint`)}">${a.key}</button>`:``}
|
|
33
|
-
</div>
|
|
34
|
-
${u}
|
|
35
|
-
${d}
|
|
36
|
-
${f}
|
|
37
|
-
</div>
|
|
38
|
-
`}s&&(s.innerHTML=l);let u=Object.entries(t);!u.some(([e,t])=>{if(!t.available)return!1;let r=n?.[e];return!r||r.authenticated!==!1})&&u.length>0&&s&&s.insertAdjacentHTML(`afterbegin`,`<div style="padding:8px 10px;margin-bottom:8px;background:#fbbf2422;border:1px solid #fbbf24;border-radius:6px;font-size:11px;color:#fbbf24">
|
|
39
|
-
${a.warning} ${i(`cli.noReadyCli`)}
|
|
40
|
-
</div>`);let d=document.getElementById(`copilotKeychainBtn`);d&&d.addEventListener(`click`,async()=>{let e=d;e.disabled=!0,e.innerHTML=a.hourglass;try{let t=await r(`/api/copilot/refresh`,{method:`POST`});e.innerHTML=t?.ok?a.check:a.error,t?.ok&&await Y(!0)}catch{e.innerHTML=a.error}setTimeout(()=>{e.innerHTML=a.key,e.disabled=!1},2e3)})}function be(){r(`/api/prompt`).then(e=>{if(!e)return;let t=document.getElementById(`modalPromptEditor`);t&&(t.value=e.content||``),document.getElementById(`promptModal`)?.classList.add(`open`)})}function xe(e){e&&e.target!==e.currentTarget||document.getElementById(`promptModal`)?.classList.remove(`open`)}async function Se(){await n(`/api/prompt`,`PUT`,{content:document.getElementById(`modalPromptEditor`)?.value||``}),document.getElementById(`promptModal`)?.classList.remove(`open`)}var Z=[],Q=!1;async function Ce(){let e=await r(`/api/prompt-templates`);e&&(Z=e.templates,Q=!1,we(e.tree),$(`tree`),document.getElementById(`templateModal`)?.classList.add(`open`))}function we(e){let t=document.getElementById(`templateTree`);if(t){t.innerHTML=``;for(let n of e){let e=document.createElement(`div`);e.style.cssText=`background:var(--bg);border:1px solid var(--accent);border-radius:6px;padding:8px 10px;margin:8px 0 4px;font-size:12px;color:var(--accent);font-weight:600`,e.textContent=`${n.emoji} ${n.label}`,t.appendChild(e);for(let e of n.children){let n=Z.find(t=>t.id===e);if(!n)continue;let r=document.createElement(`div`);r.style.cssText=`background:var(--bg);border:1px solid var(--border);border-radius:6px;padding:6px 10px;margin:2px 0 2px 24px;font-size:12px;cursor:pointer;transition:border-color .15s`,r.innerHTML=`${a.file} ${o(n.filename)}`,r.addEventListener(`mouseenter`,()=>{r.style.borderColor=`var(--accent2)`}),r.addEventListener(`mouseleave`,()=>{r.style.borderColor=`var(--border)`}),r.addEventListener(`click`,()=>{Te(n)}),t.appendChild(r)}}}}function Te(e){let t=document.getElementById(`templateEditor`);t.value=e.content,t.dataset.templateId=e.id,t.readOnly=!0,Q=!1;let n=document.getElementById(`templateEditorLabel`);n&&(n.innerHTML=`${a.file} ${o(e.filename)}`);let r=e.content.match(/\{\{[A-Z_]+\}\}/g),i=document.getElementById(`templateVars`);i&&(i.textContent=r?`vars: ${[...new Set(r)].join(`, `)}`:`no variables`);let s=document.getElementById(`templateSaveBtn`);s&&(s.style.display=`none`);let l=document.getElementById(`templateDevToggle`);l&&(l.style.color=`var(--text-dim)`,l.style.borderColor=`var(--border)`,l.innerHTML=`${a.tool} ${c(`devMode`)}`);let u=document.getElementById(`templateModalTitle`);u&&(u.innerHTML=`${a.file} ${o(e.filename)}`),$(`editor`)}function Ee(){if(!Q&&!confirm(c(`promptEditWarning`)))return;Q=!Q;let e=document.getElementById(`templateEditor`);e.readOnly=!Q;let t=document.getElementById(`templateSaveBtn`);t&&(t.style.display=Q?``:`none`);let n=document.getElementById(`templateDevToggle`);n&&(n.style.color=Q?`var(--stop-btn)`:`var(--text-dim)`,n.style.borderColor=Q?`var(--stop-btn)`:`var(--border)`,n.innerHTML=Q?`${a.lockOpen} ${c(`devModeOn`)}`:`${a.tool} ${c(`devMode`)}`)}async function De(){let e=document.getElementById(`templateEditor`),t=e.dataset.templateId;if(!t)return;await n(`/api/prompt-templates/${t}`,`PUT`,{content:e.value});let r=document.getElementById(`templateEditorLabel`);r&&(r.innerHTML=`${a.check} ${c(`savedAndReloaded`)}`,setTimeout(()=>{r.innerHTML=`${a.file} ${o(t)}.md`},2e3));let i=Z.find(e=>e.id===t);i&&(i.content=e.value)}function $(e){let t=document.getElementById(`templateTreeView`),n=document.getElementById(`templateEditorView`);t&&(t.style.display=e===`tree`?``:`none`),n&&(n.style.display=e===`editor`?`flex`:`none`);let r=document.getElementById(`templateModalTitle`);r&&e===`tree`&&(r.innerHTML=`${a.plan} ${c(`promptStructure`)}`)}function Oe(){$(`tree`)}function ke(e){e&&e.target!==e.currentTarget||document.getElementById(`templateModal`)?.classList.remove(`open`)}export{b as A,S as C,ie as D,oe as E,te as F,h as I,p as L,ne as M,ee as N,_ as O,m as P,se as S,x as T,q as _,Se as a,V as b,Ee as c,U as d,he as f,_e as g,K as h,Ce as i,y as j,v as k,Y as l,me as m,ke as n,De as o,ve as p,be as r,Oe as s,xe as t,ge as u,G as v,C as w,A as x,H as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as e,m as t,v as n}from"./settings-C8bSXG3q.js";export{t as loadSettings,n as savePerCli,e as updateSettings};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./skills-Ci5t_dsV.js";export{e as loadSkills};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./slash-commands-0RvnZU9z.js";export{e as loadCommands};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,d as t,v as n}from"./ui-IWxpAzJ7.js";export{e as cleanupToolActivity,t as loadMessages,n as updateQueueBadge};
|