agent-things 1.2.2 → 1.3.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/mods/agent-things-ui/.claude-plugin/plugin.json +1 -1
- package/mods/agent-things-ui/hooks/controls.js +1 -1
- package/mods/agent-things-ui/hooks/foundation.js +120 -2
- package/mods/agent-things-ui/hooks/presentation.js +9 -6
- package/mods/agent-things-ui/hooks/register.js +2 -2
- package/outputs/antigravity-session-status.js +275 -98
- package/outputs/codex-session-status.js +235 -26
- package/package.json +1 -1
- package/scripts/build-shared-ui.cjs +13 -1
- package/skills/things/SKILL.en.md +3 -1
- package/skills/things/SKILL.md +3 -1
- package/src/antigravity-card.cjs +516 -88
- package/src/antigravity-hook.cjs +12 -7
- package/src/antigravity-mcp-config.cjs +45 -15
- package/src/cli/setup-orchestrator.cjs +6 -4
- package/src/harnesses/antigravity/antigravity-harness.js +159 -73
- package/src/harnesses/claude/claude-harness.js +583 -2
- package/src/harnesses/claude/claude-host-helper.cjs +5 -2
- package/src/harnesses/claude/claude-service.cjs +57 -1
- package/src/harnesses/codex/codex-card-bridge.js +19 -1
- package/src/harnesses/codex/codex-card.cjs +1 -1
- package/src/plugins/things/sidecars/things_board/index.html +275 -126
- package/src/plugins/things/sidecars/things_board/main.mjs +38 -5
- package/src/plugins/things/sidecars/things_board/styles.css +22 -6
- package/src/plugins/things/sidecars/things_board/ui-i18n.mjs +119 -1
- package/src/session-status.js +116 -25
- package/src/ui-foundation.cjs +119 -1
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
+
const fs = require('node:fs');
|
|
2
3
|
const path = require('node:path');
|
|
3
4
|
const os = require('node:os');
|
|
4
5
|
const crypto = require('node:crypto');
|
|
6
|
+
const { execFileSync } = require('node:child_process');
|
|
5
7
|
const { ManualStatusStore } = require('../../manual-status-store.cjs');
|
|
6
8
|
const { startProgressHttp } = require('../../local-progress-http.cjs');
|
|
7
9
|
const { callProgressTool } = require('../../progress-tools.cjs');
|
|
@@ -18,6 +20,44 @@ const { ClaudeLocalSource } = require('./claude-local-source.cjs');
|
|
|
18
20
|
const { sessionView, PROTOCOL_VERSION } = require('../../session-view.cjs');
|
|
19
21
|
const { errorDetails } = require('../../progress-error.cjs');
|
|
20
22
|
const { readConfiguredLang, getUi } = require('../../i18n.cjs');
|
|
23
|
+
const { createPresentation } = require('../../ui-foundation.cjs');
|
|
24
|
+
|
|
25
|
+
const claudePresentation = createPresentation('zh');
|
|
26
|
+
let cachedOsThemeMode = null;
|
|
27
|
+
let cachedOsThemeModeTs = 0;
|
|
28
|
+
function detectOsThemeMode() {
|
|
29
|
+
const now = Date.now();
|
|
30
|
+
if (cachedOsThemeMode && now - cachedOsThemeModeTs < 10000) return cachedOsThemeMode;
|
|
31
|
+
try {
|
|
32
|
+
const out = execFileSync('defaults', ['read', '-g', 'AppleInterfaceStyle'], {
|
|
33
|
+
encoding: 'utf8',
|
|
34
|
+
timeout: 300,
|
|
35
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
36
|
+
}).trim();
|
|
37
|
+
cachedOsThemeMode = /^dark$/i.test(out) ? 'dark' : 'light';
|
|
38
|
+
} catch {
|
|
39
|
+
// On macOS, AppleInterfaceStyle is absent when System Appearance is Light.
|
|
40
|
+
cachedOsThemeMode = 'light';
|
|
41
|
+
}
|
|
42
|
+
cachedOsThemeModeTs = now;
|
|
43
|
+
return cachedOsThemeMode;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function readClaudeDefaultAccent() {
|
|
47
|
+
let mode = detectOsThemeMode();
|
|
48
|
+
try {
|
|
49
|
+
const cfgPath = path.join(os.homedir(), 'Library', 'Application Support', 'Claude', 'config.json');
|
|
50
|
+
if (fs.existsSync(cfgPath)) {
|
|
51
|
+
const cfg = JSON.parse(fs.readFileSync(cfgPath, 'utf8'));
|
|
52
|
+
const rawMode = cfg?.userThemeMode;
|
|
53
|
+
if (rawMode === 'light' || rawMode === 'dark') mode = rawMode;
|
|
54
|
+
else if (!rawMode && (cfg?.darkMode === 'light' || cfg?.darkMode === 'dark')) mode = cfg.darkMode;
|
|
55
|
+
}
|
|
56
|
+
} catch {}
|
|
57
|
+
const fallbackHex = mode === 'light' ? '#C6613F' : '#D97757';
|
|
58
|
+
const palette = claudePresentation.resolveAccentPalette(fallbackHex, { isDark: mode === 'dark', fallback: fallbackHex });
|
|
59
|
+
return { ...palette, mode, codeTheme: mode === 'light' ? 'claude-light' : 'claude-dark' };
|
|
60
|
+
}
|
|
21
61
|
|
|
22
62
|
const DEFAULT_PORT = 29889;
|
|
23
63
|
const DEFAULT_STATE_FILE = path.join(os.homedir(), 'Library/Application Support/AgentThings/claude/manual-state.json');
|
|
@@ -48,6 +88,7 @@ class ClaudeService {
|
|
|
48
88
|
this.keyChanges = new Map(); this.keySignatures = new Map(); this.watchers = new Map(); this.loggedReads = new Map();
|
|
49
89
|
this.watchStartRevision = 0;
|
|
50
90
|
this.lastLang = this.currentLang();
|
|
91
|
+
this.currentAccent = null;
|
|
51
92
|
// 所有写入都经最外层 transaction(write 自身也会进入 transaction):在其结束后比对各会话的变化。
|
|
52
93
|
const transaction = this.store.transaction.bind(this.store);
|
|
53
94
|
this.store.transaction = operation => {
|
|
@@ -69,6 +110,9 @@ class ClaudeService {
|
|
|
69
110
|
if (typeof this.store?.lang === 'function') return this.store.lang();
|
|
70
111
|
return readConfiguredLang({ dataDir: path.dirname(this.stateFile) });
|
|
71
112
|
}
|
|
113
|
+
activeAccent() {
|
|
114
|
+
return this.currentAccent || readClaudeDefaultAccent();
|
|
115
|
+
}
|
|
72
116
|
requestHost(method, threadId, options) {
|
|
73
117
|
const id = crypto.randomUUID();
|
|
74
118
|
const en = this.currentLang() === 'en';
|
|
@@ -118,6 +162,18 @@ class ClaudeService {
|
|
|
118
162
|
try {
|
|
119
163
|
if (message.type === 'list') { /* Return the current snapshot. */ }
|
|
120
164
|
else if (message.type === 'panel-event') this.log(`panel.${message.action}`, { key: message.key });
|
|
165
|
+
else if (message.type === 'theme-sync') {
|
|
166
|
+
const mode = message.mode === 'light' ? 'light' : 'dark';
|
|
167
|
+
const palette = claudePresentation.resolveAccentPalette(message.accent, {
|
|
168
|
+
isDark: mode === 'dark',
|
|
169
|
+
fallback: mode === 'light' ? '#C6613F' : '#D97757',
|
|
170
|
+
});
|
|
171
|
+
const nextAccent = { ...palette, mode, codeTheme: typeof message.codeTheme === 'string' ? message.codeTheme : '' };
|
|
172
|
+
if (JSON.stringify(this.currentAccent) !== JSON.stringify(nextAccent)) {
|
|
173
|
+
this.currentAccent = nextAccent;
|
|
174
|
+
for (const k of [...this.watchers.keys()]) this.wakeWatchers(k, { changed: true });
|
|
175
|
+
}
|
|
176
|
+
}
|
|
121
177
|
else if (message.type === 'open-pane') {
|
|
122
178
|
if (!this.store.validKey(message.key) || JSON.parse(message.key)[0] !== 'local') throw new Error(en ? 'Invalid Claude session identifier' : '无效 Claude 会话标识');
|
|
123
179
|
pane = { delivered: await this.deliverPane(message.key, 4000) };
|
|
@@ -184,7 +240,7 @@ class ClaudeService {
|
|
|
184
240
|
const projection = this.store.readSessionProjection(key);
|
|
185
241
|
// 只记每个会话读到新修订号的那一次:旧版插件每 2 秒轮询,逐次记录会刷满日志并冲掉验收记录。
|
|
186
242
|
if (message.action === 'read' && this.loggedReads.get(key) !== projection.revision) { this.loggedReads.set(key, projection.revision); this.log('sync.inline_read', { revision: projection.revision }); }
|
|
187
|
-
return { session: sessionView(this.store, key, { capabilities: { locate: true }, projection, lang }), key, title: session.title || t('fallbackShortTitle'), record: projection.record, lang,
|
|
243
|
+
return { session: sessionView(this.store, key, { capabilities: { locate: true }, projection, lang }), key, title: session.title || t('fallbackShortTitle'), record: projection.record, lang, accent: this.activeAccent(),
|
|
188
244
|
revision: projection.revision, paneRequested: this.takePaneRequest(key), analysis: projection.analysis ? { ledger: { ...projection.analysis.ledger, tasks: projection.activeTasks } } : null, timeline: projection.timelineSummary, source,
|
|
189
245
|
...(message.action === 'read' && message.includeGit ? { projectGit: await this.projectGit(key) } : {}) };
|
|
190
246
|
}
|
|
@@ -108,13 +108,31 @@
|
|
|
108
108
|
mount();
|
|
109
109
|
} else if (data.method === 'ui/notifications/host-context-changed') {
|
|
110
110
|
theme = data.params?.theme;
|
|
111
|
+
if (theme === 'light' || theme === 'dark') {
|
|
112
|
+
document.documentElement.style.colorScheme = theme;
|
|
113
|
+
document.documentElement.setAttribute('data-theme', theme);
|
|
114
|
+
}
|
|
115
|
+
const hostAccent = data.params?.styles?.variables?.['--color-ring-primary'];
|
|
116
|
+
if (hostAccent) {
|
|
117
|
+
window.__agentThingsHostAccent = hostAccent;
|
|
118
|
+
document.documentElement.style.setProperty('--agent-things-accent', hostAccent);
|
|
119
|
+
}
|
|
111
120
|
window.__codexSessionStatus?.setTheme(theme);
|
|
112
121
|
}
|
|
113
122
|
});
|
|
114
123
|
|
|
115
|
-
request('ui/initialize', { appInfo: { name: 'agent-things', version: window.__agentThingsVersion || '1.
|
|
124
|
+
request('ui/initialize', { appInfo: { name: 'agent-things', version: window.__agentThingsVersion || '1.3.1' }, appCapabilities: {}, protocolVersion: '2026-01-26' }, 5000)
|
|
116
125
|
.then(result => {
|
|
117
126
|
theme = result?.hostContext?.theme;
|
|
127
|
+
if (theme === 'light' || theme === 'dark') {
|
|
128
|
+
document.documentElement.style.colorScheme = theme;
|
|
129
|
+
document.documentElement.setAttribute('data-theme', theme);
|
|
130
|
+
}
|
|
131
|
+
const hostAccent = result?.hostContext?.styles?.variables?.['--color-ring-primary'];
|
|
132
|
+
if (hostAccent) {
|
|
133
|
+
window.__agentThingsHostAccent = hostAccent;
|
|
134
|
+
document.documentElement.style.setProperty('--agent-things-accent', hostAccent);
|
|
135
|
+
}
|
|
118
136
|
ready = true;
|
|
119
137
|
notify('ui/notifications/initialized', {});
|
|
120
138
|
mount();
|
|
@@ -52,7 +52,7 @@ const resource = {
|
|
|
52
52
|
const renderer = fs.readFileSync(path.join(__dirname, '../../session-status.js'), 'utf8');
|
|
53
53
|
const bridge = fs.readFileSync(path.join(__dirname, 'codex-card-bridge.js'), 'utf8');
|
|
54
54
|
const htmlLang = lang === 'en' ? 'en' : 'zh-CN';
|
|
55
|
-
return `<!doctype html><html lang="${htmlLang}"><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><body style="margin:0"><main id="progress-card" aria-live="polite">${t('loadingTitle')}</main><script>window.__agentThingsVersion = ${JSON.stringify(require('../../../package.json').version)};window.__agentThingsLang = ${JSON.stringify(lang)};\n${browserSource}\n${renderer}\n${bridge}</script></body></html>`;
|
|
55
|
+
return `<!doctype html><html lang="${htmlLang}"><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><style>:root{color-scheme:light dark;color:light-dark(#576374,#a0a6ad);background:transparent}body{margin:0;font:13px/1.5 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}#progress-card:empty{display:none}</style><body style="margin:0"><main id="progress-card" aria-live="polite">${t('loadingTitle')}</main><script>window.__agentThingsVersion = ${JSON.stringify(require('../../../package.json').version)};window.__agentThingsLang = ${JSON.stringify(lang)};\n${browserSource}\n${renderer}\n${bridge}</script></body></html>`;
|
|
56
56
|
},
|
|
57
57
|
};
|
|
58
58
|
|