@keyou007/agent-bot 0.1.27-alpha.2 → 0.1.27-alpha.4
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 +22 -0
- package/README.md +78 -13
- package/README.zh.md +78 -13
- package/assets/agent-bot.ico +0 -0
- package/assets/roboto-mono-OFL.txt +93 -0
- package/assets/roboto-mono-latin.woff2 +0 -0
- package/assets/workspace-drafts.js +88 -0
- package/assets/workspace-sessions.js +1935 -232
- package/assets/workspace.css +360 -35
- package/assets/workspace.js +2115 -249
- package/dist/cli/SelfUpdateObserver.js +124 -0
- package/dist/cli/SelfUpdateObserver.js.map +1 -0
- package/dist/cli/SelfUpdateRunner.js +267 -70
- package/dist/cli/SelfUpdateRunner.js.map +1 -1
- package/dist/cli/SelfUpdater.js +54 -15
- package/dist/cli/SelfUpdater.js.map +1 -1
- package/dist/cli/controlProtocol.js.map +1 -1
- package/dist/cli/help.js +6 -0
- package/dist/cli/help.js.map +1 -1
- package/dist/cli.js +85 -6
- package/dist/cli.js.map +1 -1
- package/dist/codex/CodexEventMapper.js +29 -5
- package/dist/codex/CodexEventMapper.js.map +1 -1
- package/dist/codex/CodexRuntime.js +3 -0
- package/dist/codex/CodexRuntime.js.map +1 -1
- package/dist/feishu/CardRenderer.js +45 -13
- package/dist/feishu/CardRenderer.js.map +1 -1
- package/dist/feishu/ConsoleFeishuClient.js +4 -0
- package/dist/feishu/ConsoleFeishuClient.js.map +1 -1
- package/dist/feishu/FeishuMarkdown.js +2 -14
- package/dist/feishu/FeishuMarkdown.js.map +1 -1
- package/dist/feishu/FeishuMessageClient.js +9 -0
- package/dist/feishu/FeishuMessageClient.js.map +1 -1
- package/dist/feishu/FeishuTurnPresenter.js +26 -14
- package/dist/feishu/FeishuTurnPresenter.js.map +1 -1
- package/dist/index.js +47 -12
- package/dist/index.js.map +1 -1
- package/dist/local-files/DiagramPreview.js +11 -6
- package/dist/local-files/DiagramPreview.js.map +1 -1
- package/dist/local-files/GitDiffPreview.js +40 -10
- package/dist/local-files/GitDiffPreview.js.map +1 -1
- package/dist/local-files/LiveMarkup.js +104 -0
- package/dist/local-files/LiveMarkup.js.map +1 -0
- package/dist/local-files/LocalFileViewerServer.js +219 -129
- package/dist/local-files/LocalFileViewerServer.js.map +1 -1
- package/dist/local-files/MarkdownExport.js +54 -0
- package/dist/local-files/MarkdownExport.js.map +1 -0
- package/dist/local-files/PreviewCodeFont.js +11 -0
- package/dist/local-files/PreviewCodeFont.js.map +1 -0
- package/dist/local-files/PreviewSyntaxHighlight.js +73 -0
- package/dist/local-files/PreviewSyntaxHighlight.js.map +1 -1
- package/dist/local-files/ToolCommandDisplay.js +111 -0
- package/dist/local-files/ToolCommandDisplay.js.map +1 -0
- package/dist/local-files/TurnPreviewPage.js +23 -269
- package/dist/local-files/TurnPreviewPage.js.map +1 -1
- package/dist/local-files/WorkspaceFileEvents.js +206 -0
- package/dist/local-files/WorkspaceFileEvents.js.map +1 -0
- package/dist/local-files/WorkspaceFiles.js +79 -3
- package/dist/local-files/WorkspaceFiles.js.map +1 -1
- package/dist/local-files/WorkspaceImages.js +15 -0
- package/dist/local-files/WorkspaceImages.js.map +1 -0
- package/dist/local-files/WorkspacePage.js +20 -5
- package/dist/local-files/WorkspacePage.js.map +1 -1
- package/dist/local-files/WorkspaceSessions.js +881 -79
- package/dist/local-files/WorkspaceSessions.js.map +1 -1
- package/dist/local-files/WorkspaceTimeline.js +105 -0
- package/dist/local-files/WorkspaceTimeline.js.map +1 -0
- package/dist/presentation/OutboundRouter.js +13 -6
- package/dist/presentation/OutboundRouter.js.map +1 -1
- package/dist/presentation/TurnStateReducer.js +28 -21
- package/dist/presentation/TurnStateReducer.js.map +1 -1
- package/dist/proxy/ProxySessionController.js +229 -92
- package/dist/proxy/ProxySessionController.js.map +1 -1
- package/dist/proxy/TaskMetadata.js +86 -0
- package/dist/proxy/TaskMetadata.js.map +1 -0
- package/dist/scheduling/ScheduleCards.js +10 -4
- package/dist/scheduling/ScheduleCards.js.map +1 -1
- package/dist/scheduling/ScheduleCommand.js +4 -0
- package/dist/scheduling/ScheduleCommand.js.map +1 -1
- package/dist/scheduling/ScheduledTaskStore.js +51 -12
- package/dist/scheduling/ScheduledTaskStore.js.map +1 -1
- package/dist/scheduling/types.js +18 -4
- package/dist/scheduling/types.js.map +1 -1
- package/dist/state/StateStore.js +145 -19
- package/dist/state/StateStore.js.map +1 -1
- package/dist/state/TurnPreviewJournal.js +143 -36
- package/dist/state/TurnPreviewJournal.js.map +1 -1
- package/dist/state/TurnToolText.js +172 -0
- package/dist/state/TurnToolText.js.map +1 -0
- package/dist/state/migrations.js +4 -0
- package/dist/state/migrations.js.map +1 -1
- package/dist/supervision/SafeRestartNotifier.js +9 -6
- package/dist/supervision/SafeRestartNotifier.js.map +1 -1
- package/dist/terminal/TerminalPage.js +5 -0
- package/dist/terminal/TerminalPage.js.map +1 -1
- package/dist/updates/AutomaticUpdatePreparer.js +63 -12
- package/dist/updates/AutomaticUpdatePreparer.js.map +1 -1
- package/dist/updates/ManualUpdateController.js +7 -2
- package/dist/updates/ManualUpdateController.js.map +1 -1
- package/dist/utils/promptAttachments.js +20 -0
- package/dist/utils/promptAttachments.js.map +1 -0
- package/dist/utils/toolTimestamp.js +6 -0
- package/dist/utils/toolTimestamp.js.map +1 -0
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/skills/agent-bot/SKILL.md +23 -2
- package/src/cli/SelfUpdateObserver.ts +111 -0
- package/src/cli/SelfUpdateRunner.ts +271 -85
- package/src/cli/SelfUpdater.ts +53 -16
- package/src/cli/controlProtocol.ts +1 -0
- package/src/cli/help.ts +6 -0
- package/src/cli.ts +71 -5
- package/src/codex/CodexEventMapper.ts +25 -5
- package/src/codex/CodexRuntime.ts +4 -0
- package/src/feishu/CardRenderer.ts +48 -13
- package/src/feishu/ConsoleFeishuClient.ts +6 -1
- package/src/feishu/FeishuMarkdown.ts +2 -14
- package/src/feishu/FeishuMessageClient.ts +10 -0
- package/src/feishu/FeishuTurnPresenter.ts +22 -8
- package/src/feishu/types.ts +1 -0
- package/src/index.ts +47 -12
- package/src/local-files/DiagramPreview.ts +11 -6
- package/src/local-files/GitDiffPreview.ts +38 -10
- package/src/local-files/LiveMarkup.ts +103 -0
- package/src/local-files/LocalFileViewerServer.ts +207 -132
- package/src/local-files/MarkdownExport.ts +54 -0
- package/src/local-files/PreviewCodeFont.ts +12 -0
- package/src/local-files/PreviewSyntaxHighlight.ts +75 -0
- package/src/local-files/ToolCommandDisplay.ts +104 -0
- package/src/local-files/TurnPreviewPage.ts +23 -254
- package/src/local-files/WorkspaceFileEvents.ts +186 -0
- package/src/local-files/WorkspaceFiles.ts +72 -5
- package/src/local-files/WorkspaceImages.ts +10 -0
- package/src/local-files/WorkspacePage.ts +20 -5
- package/src/local-files/WorkspaceSessions.ts +811 -82
- package/src/local-files/WorkspaceTimeline.ts +109 -0
- package/src/presentation/OutboundRouter.ts +15 -4
- package/src/presentation/TurnStateReducer.ts +27 -18
- package/src/presentation/turnViewTypes.ts +2 -0
- package/src/proxy/ProxySessionController.ts +226 -77
- package/src/proxy/TaskMetadata.ts +81 -0
- package/src/runtime/types.ts +2 -1
- package/src/scheduling/ScheduleCards.ts +10 -4
- package/src/scheduling/ScheduleCommand.ts +4 -0
- package/src/scheduling/ScheduledTaskStore.ts +54 -9
- package/src/scheduling/types.ts +24 -4
- package/src/state/StateStore.ts +157 -20
- package/src/state/TurnPreviewJournal.ts +138 -34
- package/src/state/TurnToolText.ts +156 -0
- package/src/state/migrations.ts +4 -0
- package/src/supervision/SafeRestartNotifier.ts +9 -6
- package/src/terminal/TerminalPage.ts +5 -0
- package/src/updates/AutomaticUpdatePreparer.ts +52 -11
- package/src/updates/ManualUpdateController.ts +8 -3
- package/src/utils/promptAttachments.ts +24 -0
- package/src/utils/toolTimestamp.ts +5 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
export const LIVE_MARKUP_CLIENT_SCRIPT = `(() => {
|
|
2
|
+
const nodeKey = (node) => {
|
|
3
|
+
if (node.nodeType !== 1) return undefined;
|
|
4
|
+
for (const attribute of ["data-preview-key", "data-activity", "data-activity-id", "data-scroll-id", "data-reasoning-field", "data-reasoning-part"]) {
|
|
5
|
+
if (node.hasAttribute(attribute)) return attribute + ":" + node.getAttribute(attribute);
|
|
6
|
+
}
|
|
7
|
+
if (node.tagName === "IMG") return "image:" + node.getAttribute("src");
|
|
8
|
+
// Keep Markdown image paragraphs/links anchored when text is inserted before them.
|
|
9
|
+
if (["P", "A", "FIGURE", "PICTURE"].includes(node.tagName)) {
|
|
10
|
+
const image = node.querySelector("img");
|
|
11
|
+
if (image) return node.tagName + ":image:" + image.getAttribute("src");
|
|
12
|
+
}
|
|
13
|
+
for (const name of ["markdown", "tool-command", "tool-image", "files", "tool-header", "tool-body", "tool-footer"]) {
|
|
14
|
+
if (node.classList.contains(name)) return node.tagName + ":" + name;
|
|
15
|
+
}
|
|
16
|
+
return undefined;
|
|
17
|
+
};
|
|
18
|
+
const compatible = (current, next) => current.nodeType === next.nodeType && current.nodeName === next.nodeName;
|
|
19
|
+
const patchNode = (current, next) => {
|
|
20
|
+
if (!compatible(current, next)) {
|
|
21
|
+
current.replaceWith(next.cloneNode(true));
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
// Summary snapshots never own a detail body that has already been fetched.
|
|
25
|
+
if (current.nodeType === 1 && current.hasAttribute("data-detail-body") && next.hasAttribute("data-detail-body")) return;
|
|
26
|
+
if (current.isEqualNode(next)) return;
|
|
27
|
+
if (current.nodeType !== 1) {
|
|
28
|
+
if (current.nodeValue !== next.nodeValue) current.nodeValue = next.nodeValue;
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (current.hasAttribute("data-diagram") && next.hasAttribute("data-diagram")) {
|
|
32
|
+
const code = current.querySelector(".diagram-source code");
|
|
33
|
+
const nextCode = next.querySelector(".diagram-source code");
|
|
34
|
+
if (code && nextCode && code.textContent !== nextCode.textContent) {
|
|
35
|
+
code.textContent = nextCode.textContent;
|
|
36
|
+
window.agentBotDiagrams.refresh(current);
|
|
37
|
+
}
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const preserveOpen = current.tagName === "DETAILS";
|
|
41
|
+
for (const attribute of Array.from(current.attributes)) {
|
|
42
|
+
if (preserveOpen && attribute.name === "open") continue;
|
|
43
|
+
if (!next.hasAttribute(attribute.name)) current.removeAttribute(attribute.name);
|
|
44
|
+
}
|
|
45
|
+
for (const attribute of Array.from(next.attributes)) {
|
|
46
|
+
if (preserveOpen && attribute.name === "open") continue;
|
|
47
|
+
if (current.getAttribute(attribute.name) !== attribute.value) current.setAttribute(attribute.name, attribute.value);
|
|
48
|
+
}
|
|
49
|
+
patchChildren(current, next);
|
|
50
|
+
};
|
|
51
|
+
const patchChildren = (parent, next) => {
|
|
52
|
+
const nextChildren = Array.from(next.childNodes);
|
|
53
|
+
const nextKeys = new Set(nextChildren.map(nodeKey).filter((key) => key !== undefined));
|
|
54
|
+
const remaining = new Set(Array.from(parent.childNodes));
|
|
55
|
+
const keyed = new Map();
|
|
56
|
+
for (const child of remaining) {
|
|
57
|
+
const key = nodeKey(child);
|
|
58
|
+
if (key === undefined) continue;
|
|
59
|
+
if (!nextKeys.has(key)) {
|
|
60
|
+
child.remove();
|
|
61
|
+
remaining.delete(child);
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
const matches = keyed.get(key) || [];
|
|
65
|
+
matches.push(child);
|
|
66
|
+
keyed.set(key, matches);
|
|
67
|
+
}
|
|
68
|
+
let cursor = parent.firstChild;
|
|
69
|
+
for (const child of nextChildren) {
|
|
70
|
+
const key = nodeKey(child);
|
|
71
|
+
const matches = key === undefined ? undefined : keyed.get(key);
|
|
72
|
+
const current = key === undefined
|
|
73
|
+
? cursor && nodeKey(cursor) === undefined && compatible(cursor, child) ? cursor : undefined
|
|
74
|
+
: matches?.find((candidate) => remaining.has(candidate) && compatible(candidate, child));
|
|
75
|
+
if (current) {
|
|
76
|
+
remaining.delete(current);
|
|
77
|
+
// Drop obsolete text/markup before a retained block without detaching that block.
|
|
78
|
+
while (cursor && cursor !== current && nodeKey(cursor) === undefined) {
|
|
79
|
+
const obsolete = cursor;
|
|
80
|
+
cursor = cursor.nextSibling;
|
|
81
|
+
remaining.delete(obsolete);
|
|
82
|
+
obsolete.remove();
|
|
83
|
+
}
|
|
84
|
+
if (current !== cursor) {
|
|
85
|
+
if (typeof parent.moveBefore === "function" && current.isConnected) parent.moveBefore(current, cursor);
|
|
86
|
+
else parent.insertBefore(current, cursor);
|
|
87
|
+
}
|
|
88
|
+
patchNode(current, child);
|
|
89
|
+
cursor = current.nextSibling;
|
|
90
|
+
} else {
|
|
91
|
+
const added = child.cloneNode(true);
|
|
92
|
+
parent.insertBefore(added, cursor);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
for (const child of remaining) child.remove();
|
|
96
|
+
};
|
|
97
|
+
const patchMarkup = (element, markup) => {
|
|
98
|
+
const template = document.createElement("template");
|
|
99
|
+
template.innerHTML = markup;
|
|
100
|
+
patchChildren(element, template.content);
|
|
101
|
+
};
|
|
102
|
+
window.agentBotLiveMarkup = { nodeKey, patchMarkup, patchNode };
|
|
103
|
+
})();\n`;
|
|
104
|
+
//# sourceMappingURL=LiveMarkup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LiveMarkup.js","sourceRoot":"","sources":["../../src/local-files/LiveMarkup.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAsGjC,CAAC"}
|