@tea-agent/loop-agent 0.53.0-next.1 → 0.53.0-next.2
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/CHANGELOG.md +18 -52
- package/dist/build-stamp.json +3 -3
- package/dist/shared/pi-context-pressure/compaction-policy.js +22 -34
- package/dist/shared/pi-context-pressure/index.js +1 -1
- package/dist/worker/console/automation-actions.js +62 -7
- package/dist/worker/console/chat/api-workbench-core.js +131 -4
- package/dist/worker/console/chat/api-workbench-schema.js +278 -0
- package/dist/worker/console/chat/api-workbench-spring.js +333 -0
- package/dist/worker/console/chat/api-workbench.js +88 -2
- package/dist/worker/console/chat/human-gate-card.js +16 -1
- package/dist/worker/console/chat/image-cache.js +39 -8
- package/dist/worker/console/chat/pi-runtime/custom-tools/apiworkbench-tools.js +120 -5
- package/dist/worker/console/chat/pi-runtime.js +2 -3
- package/dist/worker/console/chat/provider-error.js +12 -2
- package/dist/worker/console/chat/repo-walk.js +8 -0
- package/dist/worker/console/chat/routes.js +125 -13
- package/dist/worker/console/chat/todo-diff.js +90 -0
- package/dist/worker/console/chat/turn-process.js +3 -0
- package/dist/worker/console/network-proxy-settings.js +67 -1
- package/dist/worker/console/operator-actions.js +25 -0
- package/dist/worker/console/pi-compaction-settings.js +16 -13
- package/dist/worker/console/server.js +20 -0
- package/dist/worker/console/static/assets/{abnfDiagram-N423BO3Z-CR1jj_rz.js → abnfDiagram-N423BO3Z-9YdcTSkA.js} +1 -1
- package/dist/worker/console/static/assets/{arc-CjxcQfEu.js → arc-5o9a24RM.js} +1 -1
- package/dist/worker/console/static/assets/{architectureDiagram-T3A2C74G-D-3u2qFL.js → architectureDiagram-T3A2C74G-kk-Y4K8w.js} +1 -1
- package/dist/worker/console/static/assets/{blockDiagram-VBNYF7ZC-Bdr7gWVo.js → blockDiagram-VBNYF7ZC-BuMyp-i-.js} +1 -1
- package/dist/worker/console/static/assets/{c4Diagram-5PPSVZJV-hQHNe5T3.js → c4Diagram-5PPSVZJV-BnAbUXQM.js} +1 -1
- package/dist/worker/console/static/assets/channel-DzpJs7JM.js +1 -0
- package/dist/worker/console/static/assets/{chunk-2GRJ4B5K-BEg_su6q.js → chunk-2GRJ4B5K-sQ2VjuFx.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-2Q5K7J3B-DZnV6VTC.js → chunk-2Q5K7J3B-CbkqzTV8.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-5RXB4S5H-Dg0LzAqO.js → chunk-5RXB4S5H-CaP8JTC3.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-5VM5RSS4-D2vqr52W.js → chunk-5VM5RSS4-D7yUFtwu.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-6Q2QTUOP-D8We_g6R.js → chunk-6Q2QTUOP-zowLlgmO.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-GF5L2VYU-DbEU8drD.js → chunk-GF5L2VYU-KGzLFdSC.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-JWPE2WC7-Boi8TJYN.js → chunk-JWPE2WC7-DuVIxg_I.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-KBJHAD2P-CjJmKa9f.js → chunk-KBJHAD2P-CXP8iZrQ.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-RYQCIY6F-C-KV-ag7.js → chunk-RYQCIY6F-DASfOCYV.js} +1 -1
- package/dist/worker/console/static/assets/{chunk-XXDRQBXY-DZlTonsZ.js → chunk-XXDRQBXY-DFwLDf-r.js} +1 -1
- package/dist/worker/console/static/assets/classDiagram-JCYQIIEL-ClK7LSSv.js +1 -0
- package/dist/worker/console/static/assets/classDiagram-v2-OCEON4UE-ClK7LSSv.js +1 -0
- package/dist/worker/console/static/assets/{cose-bilkent-JH36ORCC-BIvFe3yn.js → cose-bilkent-JH36ORCC-CIrJSuNM.js} +1 -1
- package/dist/worker/console/static/assets/{cynefinDiagram-MW4NZA55-BOBPfv8u.js → cynefinDiagram-MW4NZA55-BrI5M-XP.js} +1 -1
- package/dist/worker/console/static/assets/{dagre-VZM6K2ZE-BF54orLO.js → dagre-VZM6K2ZE-BEJlUQi2.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-7IWD3JNH-CxjAP2AP.js → diagram-7IWD3JNH-Buw7nAqS.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-B4RE2ZJO-BXYkuNGt.js → diagram-B4RE2ZJO-DHURLBbb.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-LBJQPF4R-DQTu-2Iy.js → diagram-LBJQPF4R-CEFuptxk.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-Q27KOJAE-DNURuIYc.js → diagram-Q27KOJAE-Cejgl71p.js} +1 -1
- package/dist/worker/console/static/assets/{diagram-UB23O5K3-D69uANY8.js → diagram-UB23O5K3-Bwxq3Xoa.js} +1 -1
- package/dist/worker/console/static/assets/{ebnfDiagram-BXEA7PRR-C658EcrV.js → ebnfDiagram-BXEA7PRR-i4NNenm0.js} +1 -1
- package/dist/worker/console/static/assets/{erDiagram-JOGREHBK-BRccYtAl.js → erDiagram-JOGREHBK-BaSp03BR.js} +1 -1
- package/dist/worker/console/static/assets/{flowDiagram-UKHOOZJN-DnIR4sLs.js → flowDiagram-UKHOOZJN-CQtgCCPg.js} +1 -1
- package/dist/worker/console/static/assets/{ganttDiagram-PKOTCBZU-Bo3eWFVC.js → ganttDiagram-PKOTCBZU-DkS9Vbt8.js} +1 -1
- package/dist/worker/console/static/assets/{gitGraphDiagram-DS77QQ5N-EyWDCNU_.js → gitGraphDiagram-DS77QQ5N-Dm64UQgY.js} +1 -1
- package/dist/worker/console/static/assets/{infoDiagram-6WML65LV-B0Eld9u0.js → infoDiagram-6WML65LV-BpcLrRRV.js} +1 -1
- package/dist/worker/console/static/assets/{ishikawaDiagram-WSZJBQD7-DsJQiJ27.js → ishikawaDiagram-WSZJBQD7-DFjxaE3Q.js} +1 -1
- package/dist/worker/console/static/assets/{journeyDiagram-NVQOT4AX-fpE0yqjC.js → journeyDiagram-NVQOT4AX-G6kuLGYK.js} +1 -1
- package/dist/worker/console/static/assets/{kanban-definition-27J2QSJJ-Dq9IrDdT.js → kanban-definition-27J2QSJJ-DistDdnp.js} +1 -1
- package/dist/worker/console/static/assets/{linear-CFV4BDyf.js → linear-Cadcj4Jf.js} +1 -1
- package/dist/worker/console/static/assets/main-CKu0wCrM.js +654 -0
- package/dist/worker/console/static/assets/main-DpBoCiky.css +1 -0
- package/dist/worker/console/static/assets/{mermaid.core-BMMXqtrB.js → mermaid.core-CVqQBsGx.js} +4 -4
- package/dist/worker/console/static/assets/{mindmap-definition-FAOFIHXS-DurrK_Gi.js → mindmap-definition-FAOFIHXS-oIAAXLn3.js} +1 -1
- package/dist/worker/console/static/assets/{pegDiagram-VL7TDLO6-CzZayNy2.js → pegDiagram-VL7TDLO6-BgBPFLA0.js} +1 -1
- package/dist/worker/console/static/assets/{pieDiagram-7S7Q4E2Y-B1W7Y0cE.js → pieDiagram-7S7Q4E2Y-RTyZdL9S.js} +1 -1
- package/dist/worker/console/static/assets/{quadrantDiagram-CIZ2JOQS-BdbL83CU.js → quadrantDiagram-CIZ2JOQS-BHEYQMZx.js} +1 -1
- package/dist/worker/console/static/assets/{railroadDiagram-AXF67PYL-W-bQpd18.js → railroadDiagram-AXF67PYL-B2JIrks2.js} +1 -1
- package/dist/worker/console/static/assets/{requirementDiagram-LRYGKXZP-C9bi4tQJ.js → requirementDiagram-LRYGKXZP-TJ5_MWbY.js} +1 -1
- package/dist/worker/console/static/assets/{sankeyDiagram-W5VNT64P-D4kO56Wd.js → sankeyDiagram-W5VNT64P-BzjUsr0j.js} +1 -1
- package/dist/worker/console/static/assets/{sequenceDiagram-SI44F4Z6-CIbesK1e.js → sequenceDiagram-SI44F4Z6-DrmrPPVE.js} +1 -1
- package/dist/worker/console/static/assets/{sheet-workbook-kFN3yUBr.js → sheet-workbook-DCQgjy0Q.js} +1 -1
- package/dist/worker/console/static/assets/{sizeCapture-X5ZJPWSS-Dk4XAK7C.js → sizeCapture-X5ZJPWSS-BLp8F5fC.js} +1 -1
- package/dist/worker/console/static/assets/{stateDiagram-OKZ733FA-Bz9B6UZ7.js → stateDiagram-OKZ733FA-5MNm447q.js} +1 -1
- package/dist/worker/console/static/assets/stateDiagram-v2-UEYNNEHI-gP-t-MQJ.js +1 -0
- package/dist/worker/console/static/assets/{swimlanes-SLNWSIFB-qLEds93n.js → swimlanes-SLNWSIFB-Cs2RUkNq.js} +2 -2
- package/dist/worker/console/static/assets/swimlanesDiagram-ULZ7WXOC-D6MJJUTV.js +8 -0
- package/dist/worker/console/static/assets/{timeline-definition-Z64GVDOM-C9rVFC0h.js → timeline-definition-Z64GVDOM-BoeTHoWc.js} +1 -1
- package/dist/worker/console/static/assets/{vennDiagram-T6HMQDX7-CoKJ9hU0.js → vennDiagram-T6HMQDX7-DFWej-Mm.js} +1 -1
- package/dist/worker/console/static/assets/{wardleyDiagram-T6FBY63Y-tHz_S7-L.js → wardleyDiagram-T6FBY63Y-BcD0_2m5.js} +1 -1
- package/dist/worker/console/static/assets/{xychartDiagram-ELKLHX3M-DKzKYnvG.js → xychartDiagram-ELKLHX3M-y4PQYZiq.js} +1 -1
- package/dist/worker/console/static/index.html +2 -2
- package/dist/worker/console/static-src/markdown-incremental.js +138 -0
- package/dist/worker/console/static-src/operator-chat/automation-catalog-model.js +43 -0
- package/dist/worker/console/static-src/operator-chat/composer-drop.js +138 -0
- package/dist/worker/console/static-src/operator-chat/composer-image-paths.js +25 -5
- package/dist/worker/console/static-src/operator-chat/composer-image-preview.js +115 -0
- package/dist/worker/console/static-src/operator-chat/composer-session-ledger.js +44 -2
- package/dist/worker/console/static-src/operator-chat/composer-upload.js +115 -0
- package/dist/worker/console/static-src/operator-chat/gate-expiry.js +43 -0
- package/dist/worker/console/static-src/operator-chat/process-label.js +15 -2
- package/dist/worker/console/static-src/operator-chat/schedule-relative-time.js +54 -0
- package/dist/worker/console/static-src/operator-chat/schedule-rule-summary.js +213 -0
- package/dist/worker/console/static-src/operator-chat/tasks-model.js +4 -0
- package/dist/worker/console/static-src/operator-chat/turn-group-equality.js +8 -0
- package/dist/worker/console/static-src/operator-chat/turn-process-disclosure.js +12 -0
- package/dist/worker/console/static-src/operator-chat/turn-state-projection.js +51 -0
- package/dist/worker/console/static-src/operator-chat/useChatStream.js +22 -2
- package/dist/worker/console/static-src/operator-chat/useChatThread.js +15 -1
- package/dist/worker/console/static-src/operator-chat/useComposer.js +290 -21
- package/dist/worker/console/static-src/operator-chat/useSessionAutomationCounts.js +98 -0
- package/dist/worker/console/static-src/pages/api-request-template.js +144 -0
- package/dist/worker/console/static-src/session-search-shortcut.js +38 -0
- package/dist/worker/console/version-notes-comparison.js +52 -0
- package/dist/worker/console/version-notes.js +16 -1
- package/dist/worker/console/workspace-context.js +10 -0
- package/dist/worker/observe/static/console-theme.css +50 -3
- package/dist/worker/observe/static/console-theme.js +86 -1
- package/dist/worker/scheduler/automation-across-workspaces.js +120 -0
- package/docs/README.md +1 -0
- package/docs/operations/README.md +1 -0
- package/package.json +3 -3
- package/dist/worker/console/static/assets/channel-CBlJfald.js +0 -1
- package/dist/worker/console/static/assets/classDiagram-JCYQIIEL-mNUYCdDo.js +0 -1
- package/dist/worker/console/static/assets/classDiagram-v2-OCEON4UE-mNUYCdDo.js +0 -1
- package/dist/worker/console/static/assets/main-D-ZQ4gLb.css +0 -1
- package/dist/worker/console/static/assets/main-Dwhb3ZRq.js +0 -645
- package/dist/worker/console/static/assets/stateDiagram-v2-UEYNNEHI-BBRlxIq8.js +0 -1
- package/dist/worker/console/static/assets/swimlanesDiagram-ULZ7WXOC-CRBvOMCQ.js +0 -8
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** Compare documented list entries, never infer changes to the underlying code. */
|
|
2
|
+
export function compareNotesEntries(baseline, target) {
|
|
3
|
+
const parse = (body) => {
|
|
4
|
+
const entries = [];
|
|
5
|
+
let heading = "";
|
|
6
|
+
let entry;
|
|
7
|
+
for (const line of body.replaceAll("\r\n", "\n").split("\n")) {
|
|
8
|
+
if (!line.trim()) {
|
|
9
|
+
if (entry)
|
|
10
|
+
entry.text += "\n";
|
|
11
|
+
continue;
|
|
12
|
+
}
|
|
13
|
+
if (line === "本预发布快照记录构建时已整理的待发布变化,不表示相对上一构建全部新增。" || line === "未记录新增用户可见变化。")
|
|
14
|
+
continue;
|
|
15
|
+
if (/^### [^#]/.test(line)) {
|
|
16
|
+
heading = line.trimEnd();
|
|
17
|
+
entry = undefined;
|
|
18
|
+
continue;
|
|
19
|
+
}
|
|
20
|
+
// Complex Markdown stays intact in the full snapshot rather than being
|
|
21
|
+
// silently truncated or misrepresented as a reliable comparison.
|
|
22
|
+
if (/^\s*(?:`{3,}|~{3,})/.test(line))
|
|
23
|
+
return null;
|
|
24
|
+
if (/^[-*+] /.test(line)) {
|
|
25
|
+
entry = { heading, text: line.trimEnd() };
|
|
26
|
+
entries.push(entry);
|
|
27
|
+
}
|
|
28
|
+
else if (entry && /^ {2,}\S/.test(line))
|
|
29
|
+
entry.text += `\n${line.trimEnd()}`;
|
|
30
|
+
else
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
return entries.map(item => ({ ...item, text: item.text.trimEnd() }));
|
|
34
|
+
};
|
|
35
|
+
const oldEntries = parse(baseline), newEntries = parse(target);
|
|
36
|
+
if (!oldEntries || !newEntries)
|
|
37
|
+
return null;
|
|
38
|
+
const key = (item) => `${item.heading}\n${item.text.replace(/^[-*+] /, "- ")}`;
|
|
39
|
+
const previous = new Set(oldEntries.map(key));
|
|
40
|
+
const added = newEntries.filter(item => !previous.has(key(item)));
|
|
41
|
+
let heading = "";
|
|
42
|
+
const blocks = [];
|
|
43
|
+
for (const entry of added) {
|
|
44
|
+
if (entry.heading !== heading) {
|
|
45
|
+
heading = entry.heading;
|
|
46
|
+
if (heading)
|
|
47
|
+
blocks.push(heading);
|
|
48
|
+
}
|
|
49
|
+
blocks.push(entry.text);
|
|
50
|
+
}
|
|
51
|
+
return blocks.join("\n\n");
|
|
52
|
+
}
|
|
@@ -6,6 +6,7 @@ import path from "node:path";
|
|
|
6
6
|
import semver from "semver";
|
|
7
7
|
import { processTreeSpawnOptions, terminateProcessTree } from "../../executors/process-tree.js";
|
|
8
8
|
import { resolveUpdateCommandLaunch } from "../../shared/update/npm-client.js";
|
|
9
|
+
import { compareNotesEntries } from "./version-notes-comparison.js";
|
|
9
10
|
export const resolveNotesCommand = resolveUpdateCommandLaunch;
|
|
10
11
|
const PACKAGE = "@tea-agent/loop-agent";
|
|
11
12
|
const MAX_CHANGELOG = 256 * 1024;
|
|
@@ -283,7 +284,21 @@ export function createVersionNotes(options) {
|
|
|
283
284
|
const sections = parseVersionNotes(pkg.changelog).filter(s => channel === "next" ? s.version === version : !semver.prerelease(s.version) && semver.valid(options.installedVersion) && semver.gt(s.version, options.installedVersion) && semver.lte(s.version, version)).sort((a, b) => semver.rcompare(a.version, b.version)).slice(0, 10);
|
|
284
285
|
if (!sections.length)
|
|
285
286
|
return response("candidate", "not-documented", "missing-section", [], version);
|
|
286
|
-
|
|
287
|
+
const result = response("candidate", "ok", "documented", sections, version);
|
|
288
|
+
if (channel === "next" && semver.prerelease(version)) {
|
|
289
|
+
result.comparison = { status: "unavailable", baselineVersion: options.installedVersion };
|
|
290
|
+
try {
|
|
291
|
+
const baselineText = await boundedFile(path.join(options.packageRoot, "CHANGELOG.md"), MAX_CHANGELOG);
|
|
292
|
+
const baseline = parseVersionNotes(baselineText).filter(s => s.version === options.installedVersion);
|
|
293
|
+
if (baseline.length === 1 && sections.length === 1 && semver.valid(options.installedVersion) && semver.lt(options.installedVersion, version)) {
|
|
294
|
+
const body = compareNotesEntries(baseline[0].body, sections[0].body);
|
|
295
|
+
if (body !== null)
|
|
296
|
+
result.comparison = { status: "compared", baselineVersion: options.installedVersion, body };
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
catch { /* Missing or unreadable baseline must not hide the target notes. */ }
|
|
300
|
+
}
|
|
301
|
+
return result;
|
|
287
302
|
}
|
|
288
303
|
catch (error) {
|
|
289
304
|
const reason = error instanceof Error && ["download-timeout", "invalid-package", "changelog-too-large", "read-failed"].includes(error.message) ? error.message : "download-failed";
|
|
@@ -2,6 +2,7 @@ import { createApiWorkbenchService } from "./chat/api-workbench-core.js";
|
|
|
2
2
|
import { deliverScheduledGoalResult } from "./chat/scheduled-goal-delivery.js";
|
|
3
3
|
import { AutomationRuntime } from "./automation-runtime.js";
|
|
4
4
|
import { AutomationStore } from "../scheduler/automation-store.js";
|
|
5
|
+
import { readRegisteredWorkspaces } from "../scheduler/automation-across-workspaces.js";
|
|
5
6
|
import { deliverAutomationReminder } from "./chat/automation-delivery.js";
|
|
6
7
|
import { ScheduledGoalHost } from "./scheduled-goal-host.js";
|
|
7
8
|
/**
|
|
@@ -306,6 +307,15 @@ export async function createWorkspaceContext(record, deps) {
|
|
|
306
307
|
const actionContext = {
|
|
307
308
|
repoRoot,
|
|
308
309
|
appData,
|
|
310
|
+
/*
|
|
311
|
+
* The automation catalog spans every registered workspace.
|
|
312
|
+
*
|
|
313
|
+
* A task is stored in the ledger of the repository that owns it, so a
|
|
314
|
+
* single-workspace read hid every other workspace's tasks the moment the
|
|
315
|
+
* operator switched. The registry file is read here rather than threading the
|
|
316
|
+
* live registry instance down four layers for one array.
|
|
317
|
+
*/
|
|
318
|
+
automationWorkspaces: () => readRegisteredWorkspaces(appData.root),
|
|
309
319
|
operatorSessionId: deps.operatorSessionId,
|
|
310
320
|
client,
|
|
311
321
|
operations,
|
|
@@ -1,5 +1,52 @@
|
|
|
1
1
|
/* Opt-in palettes. Repeat tokens at the Inspect boundary: it owns local defaults
|
|
2
2
|
* and is loaded after the Console stylesheet. Specificity keeps load order safe. */
|
|
3
|
+
/*
|
|
4
|
+
* `auto` follows the operating system.
|
|
5
|
+
*
|
|
6
|
+
* The token body below is the SAME one `midnight` uses, repeated rather than
|
|
7
|
+
* aliased: CSS cannot select by media query and also reference another theme's
|
|
8
|
+
* declarations, and a second palette would drift. If midnight changes, this
|
|
9
|
+
* block must change with it — that coupling is the cost of not having a
|
|
10
|
+
* three-layer token system yet (a separate, larger refactor).
|
|
11
|
+
*/
|
|
12
|
+
@media (prefers-color-scheme: dark) {
|
|
13
|
+
:root[data-console-theme="auto"],
|
|
14
|
+
:root[data-console-theme="auto"] body[data-shell="observe-console"],
|
|
15
|
+
:root[data-console-theme="auto"] .inspect-workspace-root {
|
|
16
|
+
color-scheme: dark;
|
|
17
|
+
--canvas: #1c222a;
|
|
18
|
+
--canvas-soft: #202730;
|
|
19
|
+
--surface: #252d37;
|
|
20
|
+
--surface-muted: #2d3641;
|
|
21
|
+
--ink: #dce2e9;
|
|
22
|
+
--surface-ink: #dce2e9;
|
|
23
|
+
--body: #bcc5d0;
|
|
24
|
+
--muted: #a1acba;
|
|
25
|
+
--muted-soft: #909eaf;
|
|
26
|
+
--muted-ink: #a1acba;
|
|
27
|
+
--hairline: #353f4b;
|
|
28
|
+
--hairline-strong: #526171;
|
|
29
|
+
--orange: #a0bcd3;
|
|
30
|
+
--orange-active: #b8cfe0;
|
|
31
|
+
--blue: #a0bcd3;
|
|
32
|
+
--brand: #b2aacb;
|
|
33
|
+
--theme-action: #4d6b86;
|
|
34
|
+
--theme-action-hover: #557590;
|
|
35
|
+
--theme-on-action: #ffffff;
|
|
36
|
+
--green: #99c5b0;
|
|
37
|
+
--amber: #d3b783;
|
|
38
|
+
|
|
39
|
+
--red: #dea4ac;
|
|
40
|
+
--peach: #303e4d;
|
|
41
|
+
--mint: #2d403b;
|
|
42
|
+
--lavender: #393746;
|
|
43
|
+
--gold: #c3ac80;
|
|
44
|
+
--shadow-sm: 0 1px 2px rgb(0 0 0 / 12%);
|
|
45
|
+
--shadow-panel: 0 1px 2px rgb(0 0 0 / 12%), 0 6px 18px rgb(0 0 0 / 10%);
|
|
46
|
+
--shadow-soft: 0 8px 24px rgb(0 0 0 / 18%);
|
|
47
|
+
--shadow-lg: 0 16px 40px rgb(0 0 0 / 24%);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
3
50
|
:root[data-console-theme="midnight"],
|
|
4
51
|
:root[data-console-theme="midnight"] body[data-shell="observe-console"],
|
|
5
52
|
:root[data-console-theme="midnight"] .inspect-workspace-root {
|
|
@@ -25,7 +72,7 @@
|
|
|
25
72
|
--theme-on-action: #ffffff;
|
|
26
73
|
--green: #99c5b0;
|
|
27
74
|
--amber: #d3b783;
|
|
28
|
-
|
|
75
|
+
|
|
29
76
|
--red: #dea4ac;
|
|
30
77
|
--peach: #303e4d;
|
|
31
78
|
--mint: #2d403b;
|
|
@@ -62,7 +109,7 @@
|
|
|
62
109
|
--theme-on-action: #ffffff;
|
|
63
110
|
--green: #15803d;
|
|
64
111
|
--amber: #b45309;
|
|
65
|
-
|
|
112
|
+
|
|
66
113
|
--red: #dc2626;
|
|
67
114
|
--peach: #edf3fe;
|
|
68
115
|
--mint: #e6faed;
|
|
@@ -175,4 +222,4 @@
|
|
|
175
222
|
|
|
176
223
|
:root[data-console-theme="daylight"] {
|
|
177
224
|
.oc-bubble-user { background: var(--peach); }
|
|
178
|
-
}
|
|
225
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** Shared Console theme identities; the default leaves the original palette intact. */
|
|
2
2
|
export const CONSOLE_THEMES = Object.freeze([
|
|
3
3
|
{ id: "default", label: "默认" },
|
|
4
|
+
{ id: "auto", label: "跟随系统" },
|
|
4
5
|
{ id: "midnight", label: "深色" },
|
|
5
6
|
{ id: "daylight", label: "浅色" },
|
|
6
7
|
]);
|
|
@@ -12,13 +13,36 @@ const STORAGE_KEY = "loop-console.theme.v1";
|
|
|
12
13
|
* paints the OS window frame with the theme-color meta value, so it must track
|
|
13
14
|
* the active theme: a fixed brand colour leaves an orange titlebar above the
|
|
14
15
|
* dark midnight palette. Values mirror console-theme.css --canvas.
|
|
16
|
+
*
|
|
17
|
+
* `auto` has no fixed value — it resolves from the media query below.
|
|
15
18
|
*/
|
|
16
19
|
const TITLEBAR_COLOR = Object.freeze({
|
|
17
20
|
default: "#f4f2ee",
|
|
18
21
|
midnight: "#1c222a",
|
|
19
22
|
daylight: "#eef0f2",
|
|
23
|
+
autoDark: "#1c222a",
|
|
24
|
+
autoLight: "#f4f2ee",
|
|
20
25
|
});
|
|
21
26
|
|
|
27
|
+
/** @returns whether the operating system asks for a dark appearance. */
|
|
28
|
+
function prefersDark() {
|
|
29
|
+
try {
|
|
30
|
+
return typeof matchMedia === "function" && matchMedia("(prefers-color-scheme: dark)").matches;
|
|
31
|
+
} catch {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Resolve a theme id to the palette that should actually apply.
|
|
38
|
+
* @param theme - a stored or selected theme id.
|
|
39
|
+
* @returns `midnight`/`daylight`/`default`, with `auto` resolved by the media query.
|
|
40
|
+
*/
|
|
41
|
+
function resolvePalette(theme) {
|
|
42
|
+
if (theme !== "auto") return theme;
|
|
43
|
+
return prefersDark() ? "midnight" : "default";
|
|
44
|
+
}
|
|
45
|
+
|
|
22
46
|
function normalizeTheme(value) {
|
|
23
47
|
return CONSOLE_THEMES.some((theme) => theme.id === value) ? value : "default";
|
|
24
48
|
}
|
|
@@ -41,7 +65,10 @@ function syncTitlebarColor(theme) {
|
|
|
41
65
|
meta.setAttribute("name", "theme-color");
|
|
42
66
|
head.appendChild(meta);
|
|
43
67
|
}
|
|
44
|
-
|
|
68
|
+
const color = theme === "auto"
|
|
69
|
+
? (prefersDark() ? TITLEBAR_COLOR.autoDark : TITLEBAR_COLOR.autoLight)
|
|
70
|
+
: (TITLEBAR_COLOR[theme] ?? TITLEBAR_COLOR.default);
|
|
71
|
+
meta.setAttribute("content", color);
|
|
45
72
|
} catch {
|
|
46
73
|
// The palette switch above already succeeded; the titlebar is optional.
|
|
47
74
|
}
|
|
@@ -57,6 +84,7 @@ export function applyStoredConsoleTheme() {
|
|
|
57
84
|
const theme = normalizeTheme(value);
|
|
58
85
|
document.documentElement.dataset.consoleTheme = theme;
|
|
59
86
|
syncTitlebarColor(theme);
|
|
87
|
+
watchSystemTheme();
|
|
60
88
|
return theme;
|
|
61
89
|
}
|
|
62
90
|
|
|
@@ -65,6 +93,7 @@ export function setConsoleTheme(value) {
|
|
|
65
93
|
// Apply before persistence: a storage failure must not disable the picker.
|
|
66
94
|
document.documentElement.dataset.consoleTheme = theme;
|
|
67
95
|
syncTitlebarColor(theme);
|
|
96
|
+
watchSystemTheme();
|
|
68
97
|
try {
|
|
69
98
|
window.localStorage.setItem(STORAGE_KEY, theme);
|
|
70
99
|
} catch {
|
|
@@ -72,3 +101,59 @@ export function setConsoleTheme(value) {
|
|
|
72
101
|
}
|
|
73
102
|
return theme;
|
|
74
103
|
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Repaint the titlebar when the OS appearance flips while `auto` is selected.
|
|
107
|
+
*
|
|
108
|
+
* The palette itself needs no JavaScript — the `prefers-color-scheme` block in
|
|
109
|
+
* console-theme.css already follows the system. Only the `theme-color` meta tag
|
|
110
|
+
* is a value rather than a CSS rule, so it has to be rewritten by hand; without
|
|
111
|
+
* this an installed window keeps its light titlebar over a dark page.
|
|
112
|
+
*
|
|
113
|
+
* Attached once per page: re-running it on every picker click would stack
|
|
114
|
+
* listeners that all write the same tag.
|
|
115
|
+
*/
|
|
116
|
+
let watchingSystemTheme = false;
|
|
117
|
+
|
|
118
|
+
function watchSystemTheme() {
|
|
119
|
+
if (watchingSystemTheme) return;
|
|
120
|
+
try {
|
|
121
|
+
if (typeof matchMedia !== "function") return;
|
|
122
|
+
const query = matchMedia("(prefers-color-scheme: dark)");
|
|
123
|
+
if (typeof query.addEventListener !== "function") return;
|
|
124
|
+
query.addEventListener("change", () => {
|
|
125
|
+
if (document?.documentElement?.dataset?.consoleTheme === "auto") {
|
|
126
|
+
syncTitlebarColor("auto");
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
watchingSystemTheme = true;
|
|
130
|
+
} catch {
|
|
131
|
+
// Cosmetic only; the palettes still apply from CSS.
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Keep the titlebar in step with a theme attribute written from outside.
|
|
137
|
+
*
|
|
138
|
+
* The Console shell can switch the palette by writing
|
|
139
|
+
* `documentElement.dataset.consoleTheme` directly (the settings picker does
|
|
140
|
+
* exactly that). The CSS follows immediately because it is attribute-driven,
|
|
141
|
+
* but the `theme-color` meta tag is a plain value and would keep the previous
|
|
142
|
+
* theme's colour — a light titlebar above a dark page. A `MutationObserver` on
|
|
143
|
+
* that one attribute closes the gap without every caller having to remember to
|
|
144
|
+
* call {@link setConsoleTheme}.
|
|
145
|
+
*/
|
|
146
|
+
export function syncTitlebarWithThemeAttribute() {
|
|
147
|
+
try {
|
|
148
|
+
if (typeof MutationObserver !== "function" || typeof document === "undefined") return;
|
|
149
|
+
const target = document.documentElement;
|
|
150
|
+
if (!target) return;
|
|
151
|
+
const observer = new MutationObserver(() => {
|
|
152
|
+
syncTitlebarColor(normalizeTheme(target.dataset.consoleTheme));
|
|
153
|
+
});
|
|
154
|
+
observer.observe(target, { attributes: true, attributeFilter: ["data-console-theme"] });
|
|
155
|
+
syncTitlebarColor(normalizeTheme(target.dataset.consoleTheme));
|
|
156
|
+
} catch {
|
|
157
|
+
// Cosmetic only.
|
|
158
|
+
}
|
|
159
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { readFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { AutomationStore } from "./automation-store.js";
|
|
4
|
+
/**
|
|
5
|
+
* Read every workspace's ledger and merge the results.
|
|
6
|
+
*
|
|
7
|
+
* DSH has a single Host-level catalog with no workspace dimension at all
|
|
8
|
+
* (`schedule/src/index.ts`: `catalog()` reads the whole task table). Loop keeps
|
|
9
|
+
* tasks per repository on purpose — the ledger is committed inside that repo —
|
|
10
|
+
* so the equivalent view has to be assembled rather than read.
|
|
11
|
+
*
|
|
12
|
+
* Failures are per-workspace: a repository that was deleted, or whose ledger is
|
|
13
|
+
* corrupt, must not blank the whole list. The caller gets what could be read plus
|
|
14
|
+
* the ids that failed.
|
|
15
|
+
*
|
|
16
|
+
* @param workspaces - the registered workspaces to scan.
|
|
17
|
+
* @param options - optional store factory, for tests.
|
|
18
|
+
* @returns tasks across all readable workspaces, and the ids that failed.
|
|
19
|
+
*/
|
|
20
|
+
export async function listAcrossWorkspaces(workspaces, options = {}) {
|
|
21
|
+
const storeFor = options.storeFor ?? ((repoRoot) => new AutomationStore(repoRoot));
|
|
22
|
+
const tasks = [];
|
|
23
|
+
const failedWorkspaceIds = [];
|
|
24
|
+
// Sequential rather than parallel: each read may take the ledger's mutex, and a
|
|
25
|
+
// burst of parallel opens across many repositories gains little.
|
|
26
|
+
for (const workspace of workspaces) {
|
|
27
|
+
try {
|
|
28
|
+
const found = await storeFor(workspace.repoRoot).listTasks({ kind: "workspace" });
|
|
29
|
+
for (const task of found) {
|
|
30
|
+
tasks.push({ ...task, workspaceId: workspace.workspaceId, workspaceName: workspace.name });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
failedWorkspaceIds.push(workspace.workspaceId);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
tasks.sort((a, b) => b.updatedAt.localeCompare(a.updatedAt) || a.id.localeCompare(b.id));
|
|
38
|
+
return { tasks, failedWorkspaceIds };
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Which workspace a repository path belongs to.
|
|
42
|
+
*
|
|
43
|
+
* Used by the write paths: a task is addressed by id, but the store that owns it
|
|
44
|
+
* is chosen by workspace, so the id has to be resolved to a repository first.
|
|
45
|
+
*
|
|
46
|
+
* @param workspaces - the registered workspaces.
|
|
47
|
+
* @param repoRoot - an absolute repository root.
|
|
48
|
+
* @returns the matching workspace, when one is registered for that path.
|
|
49
|
+
*/
|
|
50
|
+
export function workspaceForRepoRoot(workspaces, repoRoot) {
|
|
51
|
+
const target = path.resolve(repoRoot);
|
|
52
|
+
return workspaces.find((workspace) => path.resolve(workspace.repoRoot) === target);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Read the registered workspaces straight from the registry file.
|
|
56
|
+
*
|
|
57
|
+
* The chat routes hold an app-data root but not the live `WorkspaceRegistry`
|
|
58
|
+
* instance, and threading that instance through four layers of dependencies to
|
|
59
|
+
* read one array is more coupling than the read is worth. The file is the same
|
|
60
|
+
* one the registry maintains (`<appDataRoot>/workspaces.json`) and is only read
|
|
61
|
+
* here, never written.
|
|
62
|
+
*
|
|
63
|
+
* A missing or unreadable file yields an empty list: the caller then falls back
|
|
64
|
+
* to the single-repository path, which is exactly the old behaviour.
|
|
65
|
+
*
|
|
66
|
+
* @param appDataRoot - the console app-data root.
|
|
67
|
+
* @returns registered, non-hidden workspaces.
|
|
68
|
+
*/
|
|
69
|
+
export async function readRegisteredWorkspaces(appDataRoot) {
|
|
70
|
+
try {
|
|
71
|
+
const raw = JSON.parse(await readFile(path.join(appDataRoot, "workspaces.json"), "utf8"));
|
|
72
|
+
if (!Array.isArray(raw.workspaces))
|
|
73
|
+
return [];
|
|
74
|
+
const out = [];
|
|
75
|
+
for (const entry of raw.workspaces) {
|
|
76
|
+
if (!entry || typeof entry !== "object")
|
|
77
|
+
continue;
|
|
78
|
+
const record = entry;
|
|
79
|
+
if (record.hidden === true)
|
|
80
|
+
continue;
|
|
81
|
+
if (typeof record.workspaceId !== "string" || typeof record.repoRoot !== "string")
|
|
82
|
+
continue;
|
|
83
|
+
out.push({
|
|
84
|
+
workspaceId: record.workspaceId,
|
|
85
|
+
name: typeof record.name === "string" && record.name !== "" ? record.name : record.repoRoot,
|
|
86
|
+
repoRoot: record.repoRoot,
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
return out;
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
return [];
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Find the workspace that owns one task id.
|
|
97
|
+
*
|
|
98
|
+
* Ids are unique inside a ledger, not across ledgers, so a write has to look
|
|
99
|
+
* before it can address anything: the caller wants "this task", not "this task in
|
|
100
|
+
* whichever repository I happen to be standing in".
|
|
101
|
+
*
|
|
102
|
+
* @param workspaces - the registered workspaces to search.
|
|
103
|
+
* @param taskId - the task id to locate.
|
|
104
|
+
* @param options - optional store factory, for tests.
|
|
105
|
+
* @returns the owning workspace, or undefined when none holds the id.
|
|
106
|
+
*/
|
|
107
|
+
export async function findWorkspaceOwningTask(workspaces, taskId, options = {}) {
|
|
108
|
+
const storeFor = options.storeFor ?? ((repoRoot) => new AutomationStore(repoRoot));
|
|
109
|
+
for (const workspace of workspaces) {
|
|
110
|
+
try {
|
|
111
|
+
// `requireTask` throws when the id is absent, which is the cheap answer here.
|
|
112
|
+
await storeFor(workspace.repoRoot).getTask({ kind: "workspace" }, taskId);
|
|
113
|
+
return workspace;
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return undefined;
|
|
120
|
+
}
|
package/docs/README.md
CHANGED
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
| 使用仓库内 GitHub 协作方式 | `operations/github-collaboration.md` |
|
|
40
40
|
| 发布版本、npm 渠道、release 分支或手工 latest promotion | `operations/version-and-release-management.md` |
|
|
41
41
|
| 排查本机开发环境问题 | `operations/local-development-environment.md` |
|
|
42
|
+
| 快速迭代时用 LSP / 定向测试验证(少跑全量) | `operations/fast-iteration-verification.md` |
|
|
42
43
|
| 使用明确的 Cursor one-shot sidecar | `runtime/cursor-prompt-sidecar.md` |
|
|
43
44
|
| 审查 npm 包与目标项目初始化文件面 | `init-surface.manifest.json` |
|
|
44
45
|
| 判断文档何时需要重新复核 | `governance/document-review-policy.md` |
|
|
@@ -16,5 +16,6 @@
|
|
|
16
16
|
- [`agent-worker-production-readiness.md`](agent-worker-production-readiness.md):agent-worker Feature/Task Pool 外层编排的 Production Readiness v1 操作合同。
|
|
17
17
|
- [`backend-test-jacoco-coverage.md`](backend-test-jacoco-coverage.md):Java 被测服务挂载 JaCoCo tcpserver agent 的 Maven、`java -jar` 与 Docker 操作手册。
|
|
18
18
|
- [`console-chat-dogfood-playbook.md`](console-chat-dogfood-playbook.md):Operator Chat(含 Explore 子 Agent)真实模型 dogfood 的 CLI 驱动步骤、mutation 双 token / SSE 超时 / question 应答等已知陷阱与验证方式。
|
|
19
|
+
- [`fast-iteration-verification.md`](fast-iteration-verification.md):快速迭代时用 LSP 与定向测试代替全量构建/全量测试的边界,含各作用域耗时实测与踩过的坑。
|
|
19
20
|
|
|
20
21
|
验证命令仍以 [`../governance/verification-matrix.md`](../governance/verification-matrix.md) 为准。
|