agent-things 0.0.0-stage → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/NOTICE +5 -0
- package/README.md +221 -2
- package/README.zh-CN.md +222 -0
- package/bin/agent-things.cjs +8 -0
- package/bin/antigravity-session-status.cjs +96 -0
- package/bin/claude-session-status.cjs +55 -0
- package/bin/codex-session-status.cjs +287 -0
- package/mods/agent-things-ui/.claude-plugin/plugin.json +12 -0
- package/mods/agent-things-ui/SKILL.md +10 -0
- package/mods/agent-things-ui/hooks/controls.js +112 -0
- package/mods/agent-things-ui/hooks/foundation.js +431 -0
- package/mods/agent-things-ui/hooks/hooks.json +1 -0
- package/mods/agent-things-ui/hooks/presentation.js +223 -0
- package/mods/agent-things-ui/hooks/progress.js +1 -0
- package/mods/agent-things-ui/hooks/register.js +382 -0
- package/native/bin/bridge +0 -0
- package/native/bin/bridge.json +20 -0
- package/native/session-status-bridge.swift +280 -0
- package/outputs/antigravity-session-status.js +2476 -0
- package/outputs/codex-session-status.js +1761 -0
- package/package.json +75 -4
- package/scripts/build-antigravity-bundle.cjs +35 -0
- package/scripts/build-codex-bundle.cjs +31 -0
- package/scripts/build-native-bridge.cjs +55 -0
- package/scripts/build-shared-ui.cjs +16 -0
- package/scripts/setup-antigravity-service.cjs +71 -0
- package/scripts/setup-claude-service.cjs +21 -0
- package/skills/agent-things/SKILL.en.md +95 -0
- package/skills/agent-things/SKILL.md +99 -0
- package/skills/codex/things/SKILL.en.md +10 -0
- package/skills/codex/things/SKILL.md +10 -0
- package/skills/things/SKILL.en.md +10 -0
- package/skills/things/SKILL.md +10 -0
- package/skills/things/checklist.en.md +91 -0
- package/skills/things/checklist.md +95 -0
- package/src/analysis-app-server.cjs +74 -0
- package/src/analysis-assets/output.en.schema.json +93 -0
- package/src/analysis-assets/output.schema.json +93 -0
- package/src/analysis-assets/prompt.en.txt +17 -0
- package/src/analysis-assets/prompt.zh-CN.txt +18 -0
- package/src/analysis-budget.cjs +105 -0
- package/src/analysis-git.cjs +38 -0
- package/src/analysis-history.cjs +150 -0
- package/src/analysis-ledger.cjs +82 -0
- package/src/analysis-log.cjs +62 -0
- package/src/analysis-runner.cjs +203 -0
- package/src/analysis-service.cjs +197 -0
- package/src/analysis-source.cjs +72 -0
- package/src/antigravity-card.cjs +2063 -0
- package/src/antigravity-hook.cjs +138 -0
- package/src/antigravity-mcp-config.cjs +36 -0
- package/src/app-server.cjs +96 -0
- package/src/cdp.cjs +115 -0
- package/src/claude-inline-install.cjs +38 -0
- package/src/claude-mcp-config.cjs +29 -0
- package/src/cli/arguments.cjs +30 -0
- package/src/cli/environment-probe.cjs +130 -0
- package/src/cli/integration-state.cjs +15 -0
- package/src/cli/interactive-cli.cjs +236 -0
- package/src/cli/prompt-tui.cjs +420 -0
- package/src/cli/setup-orchestrator.cjs +449 -0
- package/src/codex-mcp-config.cjs +67 -0
- package/src/harnesses/antigravity/analysis-profile.cjs +41 -0
- package/src/harnesses/antigravity/antigravity-git.cjs +89 -0
- package/src/harnesses/antigravity/antigravity-harness.js +1477 -0
- package/src/harnesses/antigravity/antigravity-injector.cjs +104 -0
- package/src/harnesses/antigravity/antigravity-migration.cjs +235 -0
- package/src/harnesses/antigravity/antigravity-service.cjs +357 -0
- package/src/harnesses/antigravity/antigravity-title.cjs +155 -0
- package/src/harnesses/antigravity/gemini-runner.cjs +304 -0
- package/src/harnesses/antigravity/transcript-cleaner.cjs +129 -0
- package/src/harnesses/antigravity/transcript-source.cjs +100 -0
- package/src/harnesses/claude/claude-harness.js +93 -0
- package/src/harnesses/claude/claude-host-helper.cjs +176 -0
- package/src/harnesses/claude/claude-injector.cjs +95 -0
- package/src/harnesses/claude/claude-local-source.cjs +106 -0
- package/src/harnesses/claude/claude-navigation.cjs +99 -0
- package/src/harnesses/claude/claude-runner.cjs +74 -0
- package/src/harnesses/claude/claude-service.cjs +313 -0
- package/src/harnesses/claude/claude-source.cjs +70 -0
- package/src/harnesses/codex/codex-analysis.cjs +10 -0
- package/src/harnesses/codex/codex-card-bridge.js +123 -0
- package/src/harnesses/codex/codex-card-events.cjs +76 -0
- package/src/harnesses/codex/codex-card.cjs +169 -0
- package/src/harnesses/codex/codex-git.cjs +24 -0
- package/src/harnesses/codex/codex-harness.js +229 -0
- package/src/harnesses/codex/codex-local-card.js +97 -0
- package/src/harnesses/codex/codex-progress-context.cjs +84 -0
- package/src/harnesses/codex/codex-service.cjs +502 -0
- package/src/i18n.cjs +174 -0
- package/src/launchd.cjs +105 -0
- package/src/lifecycle-lock.cjs +13 -0
- package/src/local-progress-http.cjs +267 -0
- package/src/manual-status-agent.cjs +12 -0
- package/src/manual-status-startup.cjs +66 -0
- package/src/manual-status-store.cjs +466 -0
- package/src/mcp-stdio.cjs +67 -0
- package/src/model-router.cjs +63 -0
- package/src/native-bridge.cjs +17 -0
- package/src/npm-updates.cjs +228 -0
- package/src/plugins/things/assets/logo.svg +13 -0
- package/src/plugins/things/plugin.json +6 -0
- package/src/plugins/things/sidecars/things_board/app.js +447 -0
- package/src/plugins/things/sidecars/things_board/index.html +2141 -0
- package/src/plugins/things/sidecars/things_board/main.mjs +652 -0
- package/src/plugins/things/sidecars/things_board/package.json +6 -0
- package/src/plugins/things/sidecars/things_board/sidecar.json +21 -0
- package/src/plugins/things/sidecars/things_board/styles.css +560 -0
- package/src/plugins/things/sidecars/things_board/ui-i18n.mjs +434 -0
- package/src/progress-error.cjs +54 -0
- package/src/progress-tools.cjs +145 -0
- package/src/project-path.cjs +15 -0
- package/src/renderer-resource.cjs +17 -0
- package/src/request-budget.cjs +24 -0
- package/src/resolve.cjs +51 -0
- package/src/runtime-install.cjs +635 -0
- package/src/session-status-filter.cjs +136 -0
- package/src/session-status.js +992 -0
- package/src/session-view.cjs +34 -0
- package/src/startup/controller.cjs +354 -0
- package/src/startup/watch.cjs +126 -0
- package/src/state-file-lock.cjs +31 -0
- package/src/task-provenance.cjs +42 -0
- package/src/ui-foundation.cjs +435 -0
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const fs = require('node:fs');
|
|
3
|
+
const os = require('node:os');
|
|
4
|
+
const path = require('node:path');
|
|
5
|
+
const { spawn, execFileSync } = require('node:child_process');
|
|
6
|
+
const { getAnalysisInstructions, measureRequest } = require('../../analysis-budget.cjs');
|
|
7
|
+
const { readConfiguredLang } = require('../../i18n.cjs');
|
|
8
|
+
const { diagnosticFields } = require('../../analysis-log.cjs');
|
|
9
|
+
const { name: analysisAgent, syncAnalysisProfile } = require('./analysis-profile.cjs');
|
|
10
|
+
|
|
11
|
+
const DEFAULT_BASE_URL = 'https://generativelanguage.googleapis.com';
|
|
12
|
+
const DEFAULT_MODEL = 'gemini-3.8-flash-low';
|
|
13
|
+
|
|
14
|
+
function resolveAgyBin() {
|
|
15
|
+
const candidates = [
|
|
16
|
+
path.join(os.homedir(), '.local', 'bin', 'agy'),
|
|
17
|
+
'/usr/local/bin/agy',
|
|
18
|
+
'/opt/homebrew/bin/agy',
|
|
19
|
+
];
|
|
20
|
+
for (const c of candidates) {
|
|
21
|
+
if (fs.existsSync(c)) return c;
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
const found = execFileSync('which', ['agy'], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim();
|
|
25
|
+
if (found) return found;
|
|
26
|
+
} catch { /* ignore */ }
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function diagnosticHint(text, lang = readConfiguredLang()) {
|
|
31
|
+
const en = lang === 'en';
|
|
32
|
+
if (/unauthorized|authentication|not logged in|login|sign.in|\b401\b|API_KEY_INVALID/i.test(text)) return en ? 'Please check Antigravity login status' : '请检查 Antigravity 登录状态';
|
|
33
|
+
if (/model.*(not found|unavailable|not supported|access)|model_not_found/i.test(text)) return en ? 'Gemini model unavailable or unauthorized for this account' : 'Gemini 模型不可用或账户无权使用';
|
|
34
|
+
if (/rate.limit|quota|RESOURCE_EXHAUSTED|\b429\b/i.test(text)) return en ? 'Gemini API quota or rate limit reached' : 'Gemini API 请求达到配额限制';
|
|
35
|
+
if (/context.length|context.window|too many tokens/i.test(text)) return en ? 'Input exceeds model context limit' : '输入内容超过模型上下文限制';
|
|
36
|
+
if (/stream.*(disconnect|closed|reset|error)|connection.*(reset|closed)|unexpected eof/i.test(text)) return en ? 'Connection interrupted' : '连接中断';
|
|
37
|
+
if (/timed?.?out|timeout/i.test(text)) return en ? 'Request timed out' : '请求超时';
|
|
38
|
+
const status = text.match(/\b(?:http(?: status)?|status(?: code)?)[:= ]+(\d{3})\b/i);
|
|
39
|
+
if (status) return en ? `Upstream service returned HTTP ${status[1]}` : `上游服务返回 HTTP ${status[1]}`;
|
|
40
|
+
return en ? 'Please check network and Antigravity configuration' : '请检查网络及 Antigravity 配置';
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Validate the schema features used by our task-output contract before accepting JSON text.
|
|
44
|
+
function validateOutput(value, schema, location = 'result', lang = readConfiguredLang()) {
|
|
45
|
+
const en = lang === 'en';
|
|
46
|
+
const types = Array.isArray(schema.type) ? schema.type : [schema.type];
|
|
47
|
+
const type = value === null ? 'null' : Array.isArray(value) ? 'array' : typeof value;
|
|
48
|
+
if (!types.includes(type) && !(types.includes('integer') && Number.isInteger(value))) throw new Error(en ? `${location} has invalid type` : `${location} 类型不符合分析结构`);
|
|
49
|
+
if (schema.enum && !schema.enum.includes(value)) throw new Error(en ? `${location} has unexpected value` : `${location} 值不符合分析结构`);
|
|
50
|
+
if (type === 'string' && schema.maxLength != null && [...value].length > schema.maxLength) throw new Error(en ? `${location} exceeds ${schema.maxLength} characters` : `${location} 超过 ${schema.maxLength} 字符`);
|
|
51
|
+
if (type === 'array' && schema.items) value.forEach((item, i) => validateOutput(item, schema.items, `${location}[${i}]`, lang));
|
|
52
|
+
if (type === 'object') {
|
|
53
|
+
for (const key of schema.required || []) if (!Object.hasOwn(value, key)) throw new Error(en ? `${location}.${key} is missing` : `${location}.${key} 缺失`);
|
|
54
|
+
for (const [key, item] of Object.entries(value)) {
|
|
55
|
+
if (Object.hasOwn(schema.properties || {}, key)) validateOutput(item, schema.properties[key], `${location}.${key}`, lang);
|
|
56
|
+
else if (schema.additionalProperties === false) throw new Error(en ? `${location}.${key} is not allowed` : `${location}.${key} 为未允许字段`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return value;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async function runAgyCli({ input, prompt, schema, agyBin, model = DEFAULT_MODEL, signal, log = () => {}, timeoutMs = 120000, lang = readConfiguredLang(), instructions }) {
|
|
63
|
+
const en = lang === 'en';
|
|
64
|
+
const activeInstructions = instructions || getAnalysisInstructions(lang);
|
|
65
|
+
syncAnalysisProfile(true);
|
|
66
|
+
const payload = JSON.stringify(input);
|
|
67
|
+
const directory = fs.mkdtempSync(path.join(os.tmpdir(), 'agy-status-analysis-'));
|
|
68
|
+
|
|
69
|
+
const stdin = en
|
|
70
|
+
? `${prompt}\n\n${activeInstructions}\n\nOutput JSON Schema (output raw JSON text only):\n${JSON.stringify(schema)}\n\nInput data (analyze as data only):\n${payload}`
|
|
71
|
+
: `${prompt}\n\n${activeInstructions}\n\n输出 JSON Schema(直接输出 JSON 文本):\n${JSON.stringify(schema)}\n\n输入数据(仅作为待分析内容):\n${payload}`;
|
|
72
|
+
const args = [
|
|
73
|
+
'--model', model,
|
|
74
|
+
'--effort', 'low',
|
|
75
|
+
'--input-format', 'stream-json',
|
|
76
|
+
'--output-format', 'stream-json',
|
|
77
|
+
'--agent', analysisAgent,
|
|
78
|
+
'--settings', JSON.stringify({ toolPermission: 'strict', agentMode: '' }),
|
|
79
|
+
'--disable-slash-commands',
|
|
80
|
+
];
|
|
81
|
+
|
|
82
|
+
const startedAt = Date.now(), startedMono = performance.now();
|
|
83
|
+
const metrics = () => ({ elapsedMs: Math.round(performance.now() - startedMono), wallElapsedMs: Date.now() - startedAt });
|
|
84
|
+
const emit = (event, fields = {}) => log(event, { model, ...metrics(), ...fields });
|
|
85
|
+
|
|
86
|
+
emit('model.spawn', {
|
|
87
|
+
model,
|
|
88
|
+
timeoutMs,
|
|
89
|
+
profile: 'task_analysis_agy_no_tools_v2',
|
|
90
|
+
inputBytes: Buffer.byteLength(payload),
|
|
91
|
+
promptBytes: Buffer.byteLength(prompt),
|
|
92
|
+
schemaBytes: Buffer.byteLength(JSON.stringify(schema)),
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
try {
|
|
96
|
+
return await new Promise((resolve, reject) => {
|
|
97
|
+
let child, timer, exited = false, settled = false, lineBuffer = '', stderrBuffer = '', initialized = false, finalResult;
|
|
98
|
+
const finish = (error, result) => {
|
|
99
|
+
if (settled) return;
|
|
100
|
+
settled = true;
|
|
101
|
+
clearTimeout(timer);
|
|
102
|
+
signal?.removeEventListener('abort', onAbort);
|
|
103
|
+
if (error) {
|
|
104
|
+
emit('model.settled', { ok: false, ...diagnosticFields(error) });
|
|
105
|
+
reject(error);
|
|
106
|
+
} else {
|
|
107
|
+
emit('model.output.valid', { outputBytes: Buffer.byteLength(JSON.stringify(result)) });
|
|
108
|
+
emit('model.settled', { ok: true });
|
|
109
|
+
resolve(result);
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const abort = error => {
|
|
114
|
+
if (settled) return;
|
|
115
|
+
emit('model.stop', diagnosticFields(error));
|
|
116
|
+
if (!exited && child) {
|
|
117
|
+
child.kill('SIGTERM');
|
|
118
|
+
setTimeout(() => { if (!exited) child.kill('SIGKILL'); }, 1500);
|
|
119
|
+
}
|
|
120
|
+
finish(error);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const onAbort = () => abort(new Error(en ? 'Analysis aborted' : '分析已中断'));
|
|
124
|
+
if (signal?.aborted) return onAbort();
|
|
125
|
+
signal?.addEventListener('abort', onAbort, { once: true });
|
|
126
|
+
|
|
127
|
+
timer = setTimeout(() => abort(new Error(en ? 'Analysis timed out' : '分析超时')), timeoutMs);
|
|
128
|
+
|
|
129
|
+
try {
|
|
130
|
+
child = spawn(agyBin, args, { cwd: directory, stdio: ['pipe', 'pipe', 'pipe'] });
|
|
131
|
+
} catch (err) {
|
|
132
|
+
finish(err);
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const handleLine = line => {
|
|
137
|
+
if (!line.trim() || settled) return;
|
|
138
|
+
try {
|
|
139
|
+
const message = JSON.parse(line);
|
|
140
|
+
if (message.event === 'init') {
|
|
141
|
+
if (initialized || message.init?.agent !== analysisAgent || message.init?.permission_mode !== 'strict') {
|
|
142
|
+
return abort(new Error(en
|
|
143
|
+
? 'Read-only analysis profile not confirmed; please update agy CLI or check agent-things-analysis profile'
|
|
144
|
+
: '未确认只读分析配置,请更新 agy CLI 或检查 agent-things-analysis 配置'));
|
|
145
|
+
}
|
|
146
|
+
initialized = true;
|
|
147
|
+
emit('model.capabilities', { agent: analysisAgent, permissionMode: 'strict', toolProfile: 'empty' });
|
|
148
|
+
child.stdin.end(JSON.stringify({ event: 'user', message: { content: stdin } }) + '\n');
|
|
149
|
+
} else if (message.event === 'step_update' && message.step_update?.step_type === 'tool') {
|
|
150
|
+
abort(new Error(en
|
|
151
|
+
? 'Analysis requested a tool call and was aborted; only JSON output from input data is allowed'
|
|
152
|
+
: '分析请求了工具操作,已中断;仅允许根据输入资料返回 JSON'));
|
|
153
|
+
} else if (message.event === 'result' && initialized) finalResult = message.result;
|
|
154
|
+
} catch (error) { abort(new Error(en ? `Failed to parse agy stream message: ${error.message}` : `解析 agy 流消息失败:${error.message}`)); }
|
|
155
|
+
};
|
|
156
|
+
child.stdout.setEncoding('utf8');
|
|
157
|
+
child.stdout.on('data', chunk => {
|
|
158
|
+
lineBuffer += chunk;
|
|
159
|
+
let end;
|
|
160
|
+
while ((end = lineBuffer.indexOf('\n')) !== -1) {
|
|
161
|
+
const line = lineBuffer.slice(0, end);
|
|
162
|
+
lineBuffer = lineBuffer.slice(end + 1);
|
|
163
|
+
handleLine(line);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
child.stdin.on('error', error => abort(error));
|
|
167
|
+
child.stderr.on('data', chunk => { stderrBuffer += chunk.toString(); });
|
|
168
|
+
|
|
169
|
+
child.on('error', err => abort(err));
|
|
170
|
+
child.on('close', code => {
|
|
171
|
+
exited = true;
|
|
172
|
+
handleLine(lineBuffer);
|
|
173
|
+
if (settled) return;
|
|
174
|
+
if (code !== 0) {
|
|
175
|
+
const hint = diagnosticHint(stderrBuffer, lang);
|
|
176
|
+
return finish(new Error(en ? `agy process exited with code ${code}: ${hint}` : `agy 进程退出码 ${code}:${hint}`));
|
|
177
|
+
}
|
|
178
|
+
try {
|
|
179
|
+
const parsed = finalResult;
|
|
180
|
+
if (!parsed || parsed.status !== 'SUCCESS') throw new Error(parsed?.error || (en ? 'Analysis did not return a successful result' : '分析未返回成功结果'));
|
|
181
|
+
if (parsed.structured_output && typeof parsed.structured_output === 'object') {
|
|
182
|
+
return finish(null, validateOutput(parsed.structured_output, schema, 'result', lang));
|
|
183
|
+
}
|
|
184
|
+
if (parsed.response) {
|
|
185
|
+
// Strip possible markdown fences
|
|
186
|
+
const cleaned = parsed.response.replace(/```(?:json)?\s*([\s\S]*?)\s*```/i, '$1').trim();
|
|
187
|
+
const result = JSON.parse(cleaned);
|
|
188
|
+
return finish(null, validateOutput(result, schema, 'result', lang));
|
|
189
|
+
}
|
|
190
|
+
throw new Error(en ? 'agy output did not include structured analysis result' : 'agy 输出未包含结构化分析结果');
|
|
191
|
+
} catch (parseErr) {
|
|
192
|
+
finish(new Error(en ? `Failed to parse agy output: ${parseErr.message}` : `解析 agy 输出失败: ${parseErr.message}`));
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
} finally {
|
|
197
|
+
fs.rmSync(directory, { recursive: true, force: true });
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
async function runGeminiAnalysis({
|
|
202
|
+
input,
|
|
203
|
+
prompt,
|
|
204
|
+
schema,
|
|
205
|
+
apiKey = process.env.GEMINI_API_KEY,
|
|
206
|
+
baseUrl = process.env.GEMINI_API_BASE || DEFAULT_BASE_URL,
|
|
207
|
+
model = process.env.GEMINI_MODEL || DEFAULT_MODEL,
|
|
208
|
+
timeoutMs = 120000,
|
|
209
|
+
signal,
|
|
210
|
+
log = () => {},
|
|
211
|
+
fetchImpl = globalThis.fetch,
|
|
212
|
+
agyBin = resolveAgyBin(),
|
|
213
|
+
maxBytes = 4000000,
|
|
214
|
+
tokenBudget = 2000000,
|
|
215
|
+
lang = readConfiguredLang(),
|
|
216
|
+
instructions,
|
|
217
|
+
}) {
|
|
218
|
+
const en = lang === 'en';
|
|
219
|
+
const activeInstructions = instructions || getAnalysisInstructions(lang);
|
|
220
|
+
if (!measureRequest({ input, prompt, schema, maxBytes, tokenBudget, lang, instructions: activeInstructions }).fits) {
|
|
221
|
+
throw new Error(en ? 'Analysis payload exceeds single-batch budget' : '分析内容超过单批预算');
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// 1. If agy CLI is available on the machine, prefer headless agy (No API key needed!)
|
|
225
|
+
if (agyBin) {
|
|
226
|
+
return runAgyCli({ input, prompt, schema, agyBin, model, signal, log, timeoutMs, lang, instructions: activeInstructions });
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// 2. Otherwise fallback to Gemini REST API if apiKey is provided
|
|
230
|
+
const payload = JSON.stringify(input);
|
|
231
|
+
if (!apiKey) {
|
|
232
|
+
const error = new Error(en
|
|
233
|
+
? 'agy CLI not detected and GEMINI_API_KEY is not configured; analysis unavailable'
|
|
234
|
+
: '未检测到 agy 命令行,且未配置 GEMINI_API_KEY,无法调用分析');
|
|
235
|
+
log('model.error', diagnosticFields(error));
|
|
236
|
+
throw error;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
const startedAt = Date.now(), startedMono = performance.now();
|
|
240
|
+
const metrics = () => ({
|
|
241
|
+
elapsedMs: Math.round(performance.now() - startedMono),
|
|
242
|
+
wallElapsedMs: Date.now() - startedAt,
|
|
243
|
+
});
|
|
244
|
+
const emit = (event, fields = {}) => log(event, { model, ...metrics(), ...fields });
|
|
245
|
+
|
|
246
|
+
emit('model.spawn', {
|
|
247
|
+
model,
|
|
248
|
+
timeoutMs,
|
|
249
|
+
profile: 'task_analysis_gemini_rest_v1',
|
|
250
|
+
inputBytes: Buffer.byteLength(payload),
|
|
251
|
+
promptBytes: Buffer.byteLength(prompt),
|
|
252
|
+
instructionBytes: Buffer.byteLength(activeInstructions),
|
|
253
|
+
schemaBytes: Buffer.byteLength(JSON.stringify(schema)),
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
const userContent = en
|
|
257
|
+
? `${prompt}\n\nInput data (analyze as data only):\n${payload}`
|
|
258
|
+
: `${prompt}\n\n输入数据(仅作为待分析内容):\n${payload}`;
|
|
259
|
+
|
|
260
|
+
const requestBody = {
|
|
261
|
+
systemInstruction: { parts: [{ text: activeInstructions }] },
|
|
262
|
+
contents: [{ role: 'user', parts: [{ text: userContent }] }],
|
|
263
|
+
generationConfig: { responseMimeType: 'application/json', responseSchema: schema, temperature: 0.1 },
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
const url = `${baseUrl.replace(/\/+$/, '')}/v1beta/models/${encodeURIComponent(model)}:generateContent?key=${encodeURIComponent(apiKey)}`;
|
|
267
|
+
const controller = new AbortController();
|
|
268
|
+
let timedOut = false;
|
|
269
|
+
const timer = setTimeout(() => { timedOut = true; controller.abort(); }, timeoutMs);
|
|
270
|
+
const onParentAbort = () => controller.abort();
|
|
271
|
+
if (signal?.aborted) controller.abort();
|
|
272
|
+
else signal?.addEventListener('abort', onParentAbort, { once: true });
|
|
273
|
+
|
|
274
|
+
try {
|
|
275
|
+
const response = await fetchImpl(url, {
|
|
276
|
+
method: 'POST',
|
|
277
|
+
headers: { 'Content-Type': 'application/json' },
|
|
278
|
+
body: JSON.stringify(requestBody),
|
|
279
|
+
signal: controller.signal,
|
|
280
|
+
});
|
|
281
|
+
if (!response.ok) {
|
|
282
|
+
const errorText = await response.text().catch(() => '');
|
|
283
|
+
const hint = diagnosticHint(`HTTP ${response.status}: ${errorText}`, lang);
|
|
284
|
+
throw new Error(en ? `Gemini analysis request failed (HTTP ${response.status}): ${hint}` : `Gemini 分析请求失败(HTTP ${response.status}):${hint}`);
|
|
285
|
+
}
|
|
286
|
+
const data = await response.json();
|
|
287
|
+
const text = data.candidates?.[0]?.content?.parts?.[0]?.text;
|
|
288
|
+
if (!text) throw new Error(en ? 'Gemini returned empty content or unexpected shape' : 'Gemini 返回内容为空或结构不符');
|
|
289
|
+
const result = JSON.parse(text);
|
|
290
|
+
emit('model.output.valid', { outputBytes: Buffer.byteLength(text) });
|
|
291
|
+
emit('model.settled', { ok: true });
|
|
292
|
+
return result;
|
|
293
|
+
} catch (error) {
|
|
294
|
+
if (timedOut) throw new Error(en ? 'Analysis timed out' : '分析超时');
|
|
295
|
+
if (signal?.aborted) throw new Error(en ? 'Analysis aborted' : '分析已中断');
|
|
296
|
+
emit('model.settled', { ok: false, ...diagnosticFields(error) });
|
|
297
|
+
throw error;
|
|
298
|
+
} finally {
|
|
299
|
+
clearTimeout(timer);
|
|
300
|
+
signal?.removeEventListener('abort', onParentAbort);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
module.exports = { runGeminiAnalysis, runAgyCli, resolveAgyBin, diagnosticHint, DEFAULT_MODEL, DEFAULT_BASE_URL };
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const fs = require('node:fs');
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Antigravity 专属日志清洗器 (Transcript Cleaner)
|
|
6
|
+
* 专门处理 Antigravity 专有的 ~/.gemini/antigravity/brain/<id>/.system_generated/logs/transcript.jsonl 格式。
|
|
7
|
+
* 遵循 Codex 清洗法则:丢弃所有工具原始输出、后台调试日志与中间步骤,仅提取用户请求与智能体面向用户的正式回答。
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
function safeTruncateText(text, max = 20000) {
|
|
11
|
+
if (typeof text !== 'string' || text.length <= max) return text;
|
|
12
|
+
const half = Math.floor((max - 50) / 2);
|
|
13
|
+
return `${text.slice(0, half)}\n\n[...内容过长已截断...]\n\n${text.slice(-half)}`;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function cleanUserRequestText(rawText) {
|
|
17
|
+
if (!rawText || typeof rawText !== 'string') return '';
|
|
18
|
+
let text = rawText.trim();
|
|
19
|
+
// 1. 优先提取用户发送的请求正文
|
|
20
|
+
const reqMatch = text.match(/<USER_REQUEST>([\s\S]*?)<\/USER_REQUEST>/);
|
|
21
|
+
if (reqMatch) {
|
|
22
|
+
text = reqMatch[1].trim();
|
|
23
|
+
}
|
|
24
|
+
// 2. 剥离环境注入元数据、上下文摘要信封
|
|
25
|
+
text = text.replace(/<ADDITIONAL_METADATA>[\s\S]*?<\/ADDITIONAL_METADATA>/g, '').trim();
|
|
26
|
+
text = text.replace(/<CONTEXT_SUMMARY>[\s\S]*?<\/CONTEXT_SUMMARY>/g, '').trim();
|
|
27
|
+
return text;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function isFinalAgentResponse(step) {
|
|
31
|
+
if (!step || typeof step !== 'object') return false;
|
|
32
|
+
// 丢弃工具原始输出(GENERIC)、系统消息、检查点等
|
|
33
|
+
if (step.type !== 'PLANNER_RESPONSE') return false;
|
|
34
|
+
// 丢弃包含 tool_calls 的中间准备/调度步骤
|
|
35
|
+
if (Array.isArray(step.tool_calls) && step.tool_calls.length > 0) return false;
|
|
36
|
+
// 必须具备面向用户的正式答复文本
|
|
37
|
+
const text = (step.content || '').trim();
|
|
38
|
+
return text.length > 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function parseTranscriptSteps(filePath) {
|
|
42
|
+
if (!fs.existsSync(filePath)) return [];
|
|
43
|
+
const content = fs.readFileSync(filePath, 'utf8');
|
|
44
|
+
const lines = content.split('\n').filter(line => line.trim());
|
|
45
|
+
const steps = [];
|
|
46
|
+
for (const [index, line] of lines.entries()) {
|
|
47
|
+
try { steps.push(JSON.parse(line)); }
|
|
48
|
+
catch (error) {
|
|
49
|
+
if (index === lines.length - 1 && !content.endsWith('\n')) break;
|
|
50
|
+
throw new Error(`会话日志第 ${index + 1} 行格式无效`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return steps;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function timestampInSeconds(value) {
|
|
57
|
+
const ms = typeof value === 'number' ? value : Date.parse(value);
|
|
58
|
+
return Number.isFinite(ms) ? ms / 1000 : null;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function convertStepsToTurns(steps) {
|
|
62
|
+
const turns = [];
|
|
63
|
+
let currentTurn = null;
|
|
64
|
+
let turnIndex = 0;
|
|
65
|
+
|
|
66
|
+
for (let i = 0; i < steps.length; i++) {
|
|
67
|
+
const step = steps[i];
|
|
68
|
+
const isUserInput = step.type === 'USER_INPUT' || step.source === 'USER_EXPLICIT';
|
|
69
|
+
|
|
70
|
+
if (isUserInput) {
|
|
71
|
+
if (currentTurn && currentTurn.items.length) {
|
|
72
|
+
turns.push(currentTurn);
|
|
73
|
+
}
|
|
74
|
+
turnIndex++;
|
|
75
|
+
const timeMs = timestampInSeconds(step.created_at);
|
|
76
|
+
currentTurn = {
|
|
77
|
+
id: String(turnIndex),
|
|
78
|
+
status: 'completed',
|
|
79
|
+
startedAt: timeMs,
|
|
80
|
+
completedAt: timeMs,
|
|
81
|
+
itemsView: 'full',
|
|
82
|
+
items: []
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const userText = cleanUserRequestText(step.content || '');
|
|
86
|
+
currentTurn.items.push({
|
|
87
|
+
id: `u_${step.step_index ?? i}`,
|
|
88
|
+
type: 'userMessage',
|
|
89
|
+
content: [{ type: 'text', text: userText }]
|
|
90
|
+
});
|
|
91
|
+
} else if (isFinalAgentResponse(step)) {
|
|
92
|
+
if (!currentTurn) {
|
|
93
|
+
turnIndex++;
|
|
94
|
+
currentTurn = {
|
|
95
|
+
id: String(turnIndex),
|
|
96
|
+
status: 'completed',
|
|
97
|
+
startedAt: timestampInSeconds(step.created_at),
|
|
98
|
+
completedAt: timestampInSeconds(step.created_at),
|
|
99
|
+
itemsView: 'full',
|
|
100
|
+
items: []
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
if (step.created_at) {
|
|
104
|
+
currentTurn.completedAt = timestampInSeconds(step.created_at);
|
|
105
|
+
}
|
|
106
|
+
const agentText = (step.content || '').trim();
|
|
107
|
+
currentTurn.items.push({
|
|
108
|
+
id: `a_${step.step_index ?? i}`,
|
|
109
|
+
type: 'agentMessage',
|
|
110
|
+
phase: 'final_answer',
|
|
111
|
+
text: agentText
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
if (currentTurn && currentTurn.items.length) {
|
|
117
|
+
turns.push(currentTurn);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return turns;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
module.exports = {
|
|
124
|
+
safeTruncateText,
|
|
125
|
+
cleanUserRequestText,
|
|
126
|
+
isFinalAgentResponse,
|
|
127
|
+
parseTranscriptSteps,
|
|
128
|
+
convertStepsToTurns,
|
|
129
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const fs = require('node:fs');
|
|
3
|
+
const path = require('node:path');
|
|
4
|
+
const os = require('node:os');
|
|
5
|
+
const {
|
|
6
|
+
parseTranscriptSteps,
|
|
7
|
+
convertStepsToTurns,
|
|
8
|
+
cleanUserRequestText,
|
|
9
|
+
isFinalAgentResponse,
|
|
10
|
+
safeTruncateText,
|
|
11
|
+
} = require('./transcript-cleaner.cjs');
|
|
12
|
+
const { detectAntigravityGit } = require('./antigravity-git.cjs');
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Antigravity 数据源适配器 (Transcript Source Adapter)
|
|
16
|
+
* 专职负责:定位 Antigravity 宿主本地沙盒目录 (~/.gemini/antigravity/brain/) 并暴露标准 RPC 查询协议。
|
|
17
|
+
* 具体的日志清洗与步骤转换委托给独立的 transcript-cleaner.cjs 处理。
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
function loadAntigravityTurns(brainDir, threadId) {
|
|
21
|
+
const cleanId = typeof threadId === 'string' && threadId.startsWith('local:') ? threadId.slice(6) : threadId;
|
|
22
|
+
if (typeof cleanId !== 'string' || !cleanId || path.basename(cleanId) !== cleanId || ['.', '..'].includes(cleanId)) throw new Error('无效会话路径');
|
|
23
|
+
const logFile = path.join(brainDir, cleanId, '.system_generated', 'logs', 'transcript.jsonl');
|
|
24
|
+
if (!fs.existsSync(logFile)) {
|
|
25
|
+
// 降级检查完整日志文件 transcript_full.jsonl
|
|
26
|
+
const fullLog = path.join(brainDir, cleanId, '.system_generated', 'logs', 'transcript_full.jsonl');
|
|
27
|
+
if (fs.existsSync(fullLog)) {
|
|
28
|
+
return convertStepsToTurns(parseTranscriptSteps(fullLog));
|
|
29
|
+
}
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
return convertStepsToTurns(parseTranscriptSteps(logFile));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
class AntigravityTranscriptServer {
|
|
36
|
+
constructor({ brainDir = path.join(os.homedir(), '.gemini', 'antigravity', 'brain'), cwd = process.cwd() } = {}) {
|
|
37
|
+
this.brainDir = brainDir;
|
|
38
|
+
this.cwd = cwd;
|
|
39
|
+
this.turns = new Map();
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async initialize() {}
|
|
43
|
+
async close() { this.turns.clear(); }
|
|
44
|
+
|
|
45
|
+
async request(method, params = {}) {
|
|
46
|
+
if (method === 'thread/turns/list') {
|
|
47
|
+
const { threadId, sortDirection = 'asc', limit = 100, cursor = null } = params;
|
|
48
|
+
if (!this.turns.has(threadId)) this.turns.set(threadId, loadAntigravityTurns(this.brainDir, threadId));
|
|
49
|
+
let turns = this.turns.get(threadId);
|
|
50
|
+
if (sortDirection === 'desc') {
|
|
51
|
+
turns = [...turns].reverse();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
let startIndex = 0;
|
|
55
|
+
if (cursor != null && typeof cursor === 'string') {
|
|
56
|
+
const foundIndex = turns.findIndex(t => t.id === cursor);
|
|
57
|
+
if (foundIndex !== -1) {
|
|
58
|
+
startIndex = foundIndex + 1;
|
|
59
|
+
} else {
|
|
60
|
+
const parsed = parseInt(cursor, 10);
|
|
61
|
+
if (!isNaN(parsed) && parsed >= 0) {
|
|
62
|
+
startIndex = parsed;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const pageSize = Number.isInteger(limit) && limit > 0 ? limit : 100;
|
|
68
|
+
const pageData = turns.slice(startIndex, startIndex + pageSize);
|
|
69
|
+
const nextIndex = startIndex + pageData.length;
|
|
70
|
+
const nextCursor = nextIndex < turns.length && pageData.length > 0
|
|
71
|
+
? String(pageData.at(-1)?.id ?? nextIndex)
|
|
72
|
+
: null;
|
|
73
|
+
|
|
74
|
+
return { data: pageData, nextCursor };
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (method === 'thread/read') {
|
|
78
|
+
const gitInfo = await detectAntigravityGit(params.threadId, { brainDir: this.brainDir });
|
|
79
|
+
return {
|
|
80
|
+
thread: {
|
|
81
|
+
id: params.threadId,
|
|
82
|
+
cwd: gitInfo.detectedPath || this.cwd
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
throw new Error(`AntigravityTranscriptServer 未知方法: ${method}`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
module.exports = {
|
|
92
|
+
loadAntigravityTurns,
|
|
93
|
+
AntigravityTranscriptServer,
|
|
94
|
+
// 保持向后兼容的再导出
|
|
95
|
+
parseTranscriptSteps,
|
|
96
|
+
convertStepsToTurns,
|
|
97
|
+
cleanUserRequestText,
|
|
98
|
+
isFinalAgentResponse,
|
|
99
|
+
safeTruncateText,
|
|
100
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
(function () {
|
|
3
|
+
const getUiText = (key, fallback, zhFallback) => {
|
|
4
|
+
const p = window.__agentThingsPresentation;
|
|
5
|
+
const lang = window.__agentThingsLang || p?.lang || 'zh';
|
|
6
|
+
if (key) {
|
|
7
|
+
const ui = p?.forLang ? p.forLang(lang) : null;
|
|
8
|
+
const val = ui?.strings?.[key] ?? p?.strings?.[key];
|
|
9
|
+
if (val) return val;
|
|
10
|
+
}
|
|
11
|
+
return lang === 'en' ? fallback : (zhFallback || fallback);
|
|
12
|
+
};
|
|
13
|
+
const padding = new Map();
|
|
14
|
+
const identity = row => row.closest('[data-row-key]')?.getAttribute('data-row-key');
|
|
15
|
+
const mainButton = row => [...row.querySelectorAll('[data-row-main-button]')].find(node => node.closest('[data-row]') === row);
|
|
16
|
+
const harness = {
|
|
17
|
+
globalName: '__claudeSessionStatus',
|
|
18
|
+
startupRows: () => [...document.querySelectorAll('.dframe-sidebar .df-session-list [data-row]')].filter(row => identity(row)?.startsWith('code:')),
|
|
19
|
+
attributeFilter: ['data-row-key', 'data-selected', 'aria-current', 'class', 'hidden', 'aria-expanded', 'style', 'data-theme'],
|
|
20
|
+
send: payload => window.__agentThingsClaudeSend(payload),
|
|
21
|
+
isRowSelected: row => mainButton(row)?.getAttribute('aria-current') === 'page' || ['true', 'open', 'focused'].includes(row.getAttribute('data-selected')),
|
|
22
|
+
unmount(entry) {
|
|
23
|
+
const previous = padding.get(entry.row);
|
|
24
|
+
if (previous) { previous.button.style.paddingInlineStart = previous.padding; entry.row.style.position = previous.position; padding.delete(entry.row); }
|
|
25
|
+
},
|
|
26
|
+
async locate({ entry, source, analysisMessage, request }) {
|
|
27
|
+
const row = [...document.querySelectorAll('.dframe-sidebar [data-row]')].find(node => identity(node) === `code:${entry.threadId}`);
|
|
28
|
+
if (!row) { analysisMessage.textContent = getUiText(null, 'Please expand the corresponding session in the sidebar first', '请先在侧栏展开对应会话'); return; }
|
|
29
|
+
const scope = document.querySelector(`[data-session-id="${CSS.escape(entry.threadId)}"]`)?.closest('.epitaxy-chat-panel');
|
|
30
|
+
const target = source.itemId && scope?.querySelector(['data-epitaxy-entry', 'data-entry-key', 'data-turn-key']
|
|
31
|
+
.map(attribute => `[${attribute}="${CSS.escape(source.itemId)}"]`).join(','));
|
|
32
|
+
if (target) { target.scrollIntoView({ block: 'center', behavior: 'instant' }); analysisMessage.textContent = getUiText('locatedMessage', 'Located source', '已定位来源'); return; }
|
|
33
|
+
analysisMessage.textContent = getUiText('locatingSourceMessage', 'Locating source message...', '正在定位来源消息…');
|
|
34
|
+
const result = await request('locate-source', 22000, { source });
|
|
35
|
+
if (result?.located) analysisMessage.textContent = getUiText('locatedMessage', 'Located source', '已定位来源');
|
|
36
|
+
else analysisMessage.textContent = result?.message || getUiText('locateUnavailable', 'Unable to locate source message right now', '暂时无法定位来源消息');
|
|
37
|
+
},
|
|
38
|
+
async openPane({ entry, request }) {
|
|
39
|
+
// 先切到该会话,再请求本地后台转达给该会话的 mod,由 mod 打开常驻侧栏面板。
|
|
40
|
+
const row = [...document.querySelectorAll('.dframe-sidebar [data-row]')].find(node => identity(node) === `code:${entry.threadId}`);
|
|
41
|
+
const main = row && mainButton(row);
|
|
42
|
+
if (main && !harness.isRowSelected(row)) main.click();
|
|
43
|
+
const result = await request('open-pane', 9000);
|
|
44
|
+
if (!result?.delivered) throw new Error(getUiText(null,
|
|
45
|
+
'The Agent Things plugin is not running in this session yet. Type /reload-plugins or send a message in that session, then click again.',
|
|
46
|
+
'该会话的 Agent Things 插件未在运行。请在该会话输入 /reload-plugins 或先发送一条消息,再点一次。'));
|
|
47
|
+
},
|
|
48
|
+
reconcile({ mounted, unmount, attachHost, paint, paintVisibility, openPanel, closePanel, isPanelEntry }) {
|
|
49
|
+
for (const [row, entry] of [...mounted]) {
|
|
50
|
+
if (!row.isConnected || !entry.host.isConnected || identity(row) !== `code:${entry.threadId}`) unmount(entry);
|
|
51
|
+
}
|
|
52
|
+
for (const row of document.querySelectorAll('.dframe-sidebar .df-session-list [data-row]')) {
|
|
53
|
+
const key = identity(row);
|
|
54
|
+
const main = mainButton(row);
|
|
55
|
+
if (!key?.startsWith('code:') || row.tagName !== 'DIV' || !main) continue;
|
|
56
|
+
const threadId = key.slice(5);
|
|
57
|
+
if (!threadId || threadId.length > 256) continue;
|
|
58
|
+
const title = (row.querySelector('[data-row-label]')?.textContent || main.textContent || getUiText('fallbackThreadTitle', 'Session', '会话')).trim();
|
|
59
|
+
let entry = mounted.get(row);
|
|
60
|
+
if (entry) { if (entry.title !== title) { entry.title = title; paint(entry); } paintVisibility(entry); continue; }
|
|
61
|
+
padding.set(row, { button: main, padding: main.style.paddingInlineStart, position: row.style.position });
|
|
62
|
+
const inset = parseFloat(getComputedStyle(main).paddingInlineStart) || 0;
|
|
63
|
+
main.style.paddingInlineStart = `${inset + 28}px`;
|
|
64
|
+
if (getComputedStyle(row).position === 'static') row.style.position = 'relative';
|
|
65
|
+
const slot = document.createElement('span');
|
|
66
|
+
slot.className = 'status-slot-injected';
|
|
67
|
+
slot.style.cssText = `position:absolute;inset-inline-start:calc(${inset}px + var(--df-row-indent, 0px) * 0.3);top:50%;transform:translateY(-50%);width:24px;height:24px;display:flex;z-index:4;`;
|
|
68
|
+
row.append(slot);
|
|
69
|
+
const { host, button, original } = attachHost(slot, false, null);
|
|
70
|
+
const onEnter = () => { entry.hovered = true; paintVisibility(entry); };
|
|
71
|
+
const onLeave = () => { entry.hovered = false; paintVisibility(entry); };
|
|
72
|
+
row.addEventListener('pointerenter', onEnter); row.addEventListener('pointerleave', onLeave);
|
|
73
|
+
button.addEventListener('pointerdown', event => event.stopPropagation());
|
|
74
|
+
button.addEventListener('click', event => {
|
|
75
|
+
event.preventDefault(); event.stopPropagation();
|
|
76
|
+
if (isPanelEntry(entry)) closePanel(); else { closePanel(); openPanel(entry); }
|
|
77
|
+
});
|
|
78
|
+
entry = { row, key: JSON.stringify(['local', threadId]), threadId, rawHost: 'local', title, slot, host, button, original, hovered: false, ringKey: null, onEnter, onLeave };
|
|
79
|
+
mounted.set(row, entry); paint(entry);
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
dispose() { delete window.__sessionStatusHarness; },
|
|
83
|
+
};
|
|
84
|
+
window.__sessionStatusHarness = harness;
|
|
85
|
+
})();
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|