@bastani/atomic 0.9.89-alpha.1 → 0.9.89
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 +289 -0
- package/dist/builtin/intercom/CHANGELOG.md +31 -0
- package/dist/builtin/intercom/broker/broker-instance.ts +15 -1
- package/dist/builtin/intercom/broker/broker.ts +25 -8
- package/dist/builtin/intercom/broker/client.ts +29 -14
- package/dist/builtin/intercom/broker/multinode-router.ts +193 -52
- package/dist/builtin/intercom/broker/multinode-state-store.ts +6 -2
- package/dist/builtin/intercom/broker/restoring-recipients.ts +5 -0
- package/dist/builtin/intercom/broker/sql-outbox-store.ts +3 -2
- package/dist/builtin/intercom/index.bundle.mjs +19 -12
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/intercom/types.ts +6 -2
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +45 -0
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +17 -6
- package/dist/builtin/web-access/CHANGELOG.md +11 -0
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +106 -0
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +310 -344
- package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +99 -17
- package/dist/builtin/workflows/src/index.js +99 -17
- package/dist/builtin/workflows/src/local-worker-entry.mjs +99 -17
- package/dist/cli/storage-command.js +8 -0
- package/dist/cli/storage-command.js.map +1 -1
- package/dist/core/auth-storage-backends.d.ts.map +1 -1
- package/dist/core/auth-storage-backends.js +1 -0
- package/dist/core/auth-storage-backends.js.map +1 -1
- package/dist/core/keybindings.d.ts +8 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +4 -0
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/process-start-token.d.ts.map +1 -1
- package/dist/core/process-start-token.js +8 -1
- package/dist/core/process-start-token.js.map +1 -1
- package/dist/core/resume/blueprint/build-lock.d.ts.map +1 -1
- package/dist/core/resume/blueprint/build-lock.js +2 -1
- package/dist/core/resume/blueprint/build-lock.js.map +1 -1
- package/dist/core/storage/errors.d.ts +4 -2
- package/dist/core/storage/errors.d.ts.map +1 -1
- package/dist/core/storage/errors.js +6 -1
- package/dist/core/storage/errors.js.map +1 -1
- package/dist/core/tasks/completion.d.ts +5 -0
- package/dist/core/tasks/completion.d.ts.map +1 -1
- package/dist/core/tasks/completion.js +13 -0
- package/dist/core/tasks/completion.js.map +1 -1
- package/dist/core/tools/shell-task-render.d.ts +1 -2
- package/dist/core/tools/shell-task-render.d.ts.map +1 -1
- package/dist/core/tools/shell-task-render.js +3 -7
- package/dist/core/tools/shell-task-render.js.map +1 -1
- package/dist/core/tools/windows-directory-security.d.ts.map +1 -1
- package/dist/core/tools/windows-directory-security.js +3 -11
- package/dist/core/tools/windows-directory-security.js.map +1 -1
- package/dist/core/worktree-snapshot/capture.d.ts.map +1 -1
- package/dist/core/worktree-snapshot/capture.js +25 -1
- package/dist/core/worktree-snapshot/capture.js.map +1 -1
- package/dist/core/worktree-snapshot/restore.d.ts.map +1 -1
- package/dist/core/worktree-snapshot/restore.js +38 -9
- package/dist/core/worktree-snapshot/restore.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/components/agent-panel.d.ts +5 -0
- package/dist/modes/interactive/components/agent-panel.d.ts.map +1 -1
- package/dist/modes/interactive/components/agent-panel.js +13 -0
- package/dist/modes/interactive/components/agent-panel.js.map +1 -1
- package/dist/modes/interactive/components/chat-transcript.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-transcript.js +5 -2
- package/dist/modes/interactive/components/chat-transcript.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +1 -1
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/heartbeat-block.d.ts +34 -0
- package/dist/modes/interactive/components/heartbeat-block.d.ts.map +1 -0
- package/dist/modes/interactive/components/heartbeat-block.js +50 -0
- package/dist/modes/interactive/components/heartbeat-block.js.map +1 -0
- package/dist/modes/interactive/components/input-label.d.ts.map +1 -1
- package/dist/modes/interactive/components/input-label.js +8 -3
- package/dist/modes/interactive/components/input-label.js.map +1 -1
- package/dist/modes/interactive/components/main-composer-keys.d.ts.map +1 -1
- package/dist/modes/interactive/components/main-composer-keys.js +3 -7
- package/dist/modes/interactive/components/main-composer-keys.js.map +1 -1
- package/dist/modes/interactive/components/mermaid.d.ts.map +1 -1
- package/dist/modes/interactive/components/mermaid.js +13 -7
- package/dist/modes/interactive/components/mermaid.js.map +1 -1
- package/dist/modes/interactive/components/notice-line.d.ts +10 -2
- package/dist/modes/interactive/components/notice-line.d.ts.map +1 -1
- package/dist/modes/interactive/components/notice-line.js +13 -3
- package/dist/modes/interactive/components/notice-line.js.map +1 -1
- package/dist/modes/interactive/components/provider-brand.d.ts.map +1 -1
- package/dist/modes/interactive/components/provider-brand.js +3 -0
- package/dist/modes/interactive/components/provider-brand.js.map +1 -1
- package/dist/modes/interactive/components/task-heartbeat-message.d.ts +9 -4
- package/dist/modes/interactive/components/task-heartbeat-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-heartbeat-message.js +33 -27
- package/dist/modes/interactive/components/task-heartbeat-message.js.map +1 -1
- package/dist/modes/interactive/components/task-inspector.d.ts +16 -0
- package/dist/modes/interactive/components/task-inspector.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-inspector.js +95 -4
- package/dist/modes/interactive/components/task-inspector.js.map +1 -1
- package/dist/modes/interactive/components/task-list.d.ts +5 -1
- package/dist/modes/interactive/components/task-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-list.js +20 -3
- package/dist/modes/interactive/components/task-list.js.map +1 -1
- package/dist/modes/interactive/components/task-transcript-page.d.ts +1 -1
- package/dist/modes/interactive/components/task-transcript-page.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-transcript-page.js +10 -7
- package/dist/modes/interactive/components/task-transcript-page.js.map +1 -1
- package/dist/modes/interactive/interactive-startup.js +1 -2
- package/dist/modes/interactive/interactive-startup.js.map +1 -1
- package/dist/modes/interactive/theme/color-utils.d.ts +29 -1
- package/dist/modes/interactive/theme/color-utils.d.ts.map +1 -1
- package/dist/modes/interactive/theme/color-utils.js +81 -7
- package/dist/modes/interactive/theme/color-utils.js.map +1 -1
- package/dist/modes/interactive/theme/global-theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/global-theme.js +3 -0
- package/dist/modes/interactive/theme/global-theme.js.map +1 -1
- package/dist/modes/interactive/theme/theme-class.d.ts +22 -2
- package/dist/modes/interactive/theme/theme-class.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme-class.js +64 -18
- package/dist/modes/interactive/theme/theme-class.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts +1 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +1 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +2 -0
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +2 -1
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/tools-manager.d.ts +6 -0
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +170 -15
- package/dist/utils/tools-manager.js.map +1 -1
- package/dist/utils/windows-powershell.d.ts +9 -0
- package/dist/utils/windows-powershell.d.ts.map +1 -0
- package/dist/utils/windows-powershell.js +16 -0
- package/dist/utils/windows-powershell.js.map +1 -0
- package/docs/background-tasks.md +6 -6
- package/docs/getting-started/installation.md +4 -2
- package/docs/keybindings.md +3 -0
- package/docs/storage.md +24 -5
- package/docs/subagents.md +1 -1
- package/docs/themes/reference.md +7 -0
- package/docs/tui/reference.md +1 -1
- package/docs/windows.md +1 -1
- package/docs/workflows/api-reference.md +9 -1
- package/docs/workflows/operations.md +1 -1
- package/npm-shrinkwrap.json +49 -49
- package/package.json +6 -6
- package/schemas/keybindings.schema.json +4 -0
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { stripVTControlCharacters } from "node:util";
|
|
2
|
-
import { Box, truncateToWidth, wrapTextWithAnsi } from "@bastani/atomic-tui";
|
|
3
2
|
import { formatTaskHeartbeatDuration, formatTaskHeartbeatStatus, taskHeartbeatKindLabel, } from "../../../core/tasks/heartbeat-notice.js";
|
|
4
3
|
import { theme } from "../theme/theme.js";
|
|
5
|
-
import {
|
|
4
|
+
import { HeartbeatBlock } from "./heartbeat-block.js";
|
|
6
5
|
function isNamedTask(value) {
|
|
7
6
|
if (!value || typeof value !== "object")
|
|
8
7
|
return false;
|
|
@@ -32,45 +31,52 @@ export function heartbeatDetailsFrom(details) {
|
|
|
32
31
|
};
|
|
33
32
|
}
|
|
34
33
|
const clean = (value) => stripVTControlCharacters(value).replace(/[\x00-\x1f\x7f-\x9f]+/g, " ");
|
|
35
|
-
/**
|
|
34
|
+
/** Tasks listed while a task heartbeat is collapsed; the rest are counted in one `… +N more` row. */
|
|
35
|
+
export const TASK_HEARTBEAT_COLLAPSED_TASKS = 5;
|
|
36
|
+
/**
|
|
37
|
+
* A task heartbeat in its chat, in the shared notice anatomy: `♥ Task heartbeat · N tasks still running`, one
|
|
38
|
+
* connector row per task, and each task's status and last output lines when expanded.
|
|
39
|
+
*/
|
|
36
40
|
export class TaskHeartbeatMessage {
|
|
37
41
|
details;
|
|
38
42
|
expanded;
|
|
39
|
-
|
|
43
|
+
outputPad;
|
|
44
|
+
constructor(details, expanded, outputPad) {
|
|
40
45
|
this.details = details;
|
|
41
46
|
this.expanded = expanded;
|
|
47
|
+
this.outputPad = outputPad;
|
|
42
48
|
}
|
|
43
49
|
invalidate() { }
|
|
44
50
|
render(width) {
|
|
45
51
|
if (width < 1)
|
|
46
52
|
return [];
|
|
47
|
-
const card = new Box(width >= 3 ? 1 : 0, 1, (line) => theme.bg("customMessageBg", line));
|
|
48
|
-
card.addChild({
|
|
49
|
-
invalidate() { },
|
|
50
|
-
render: (innerWidth) => this.renderContent(innerWidth),
|
|
51
|
-
});
|
|
52
|
-
return card.render(width);
|
|
53
|
-
}
|
|
54
|
-
renderContent(width) {
|
|
55
53
|
const { tasks, moreCount } = this.details;
|
|
56
54
|
const total = tasks.length + moreCount;
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
55
|
+
const shown = this.expanded ? tasks : tasks.slice(0, TASK_HEARTBEAT_COLLAPSED_TASKS);
|
|
56
|
+
const records = shown.map((task) => {
|
|
57
|
+
const rows = [
|
|
58
|
+
`${theme.fg("accent", `${taskHeartbeatKindLabel(task.kind)} ${clean(task.taskId)}`)} ${theme.fg("text", clean(task.title))}${theme.fg("dim", ` · ${formatTaskHeartbeatDuration(task.elapsedMs)}`)}`,
|
|
59
|
+
];
|
|
62
60
|
if (!this.expanded)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
lines.push(theme.fg("muted", ` ${row}`));
|
|
61
|
+
return rows;
|
|
62
|
+
rows.push({ text: theme.fg("muted", clean(formatTaskHeartbeatStatus(task))), wrap: true });
|
|
66
63
|
for (const line of task.output?.tail ?? [])
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return
|
|
64
|
+
rows.push(theme.fg("dim", `│ ${clean(line)}`));
|
|
65
|
+
return rows;
|
|
66
|
+
});
|
|
67
|
+
const hidden = tasks.length - shown.length + moreCount;
|
|
68
|
+
if (hidden > 0)
|
|
69
|
+
records.push([theme.fg("muted", `… +${hidden} more`)]);
|
|
70
|
+
return new HeartbeatBlock({
|
|
71
|
+
title: "Task heartbeat",
|
|
72
|
+
meta: [`${total === 1 ? "1 task" : `${total} tasks`} still running`],
|
|
73
|
+
records,
|
|
74
|
+
hint: "/tasks to inspect",
|
|
75
|
+
// Collapsed, each task hides its status and output lines.
|
|
76
|
+
expandable: tasks.length > 0,
|
|
77
|
+
expanded: this.expanded,
|
|
78
|
+
outputPad: this.outputPad,
|
|
79
|
+
}).render(width);
|
|
74
80
|
}
|
|
75
81
|
}
|
|
76
82
|
//# sourceMappingURL=task-heartbeat-message.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-heartbeat-message.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/task-heartbeat-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"task-heartbeat-message.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/task-heartbeat-message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAErD,OAAO,EACN,2BAA2B,EAC3B,yBAAyB,EAGzB,sBAAsB,GACtB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAqB,MAAM,sBAAsB,CAAC;AAEzE,SAAS,WAAW,CAAC,KAAc;IAClC,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACtD,MAAM,IAAI,GAAG,KAAmC,CAAC;IACjD,OAAO,CACN,OAAO,IAAI,CAAC,MAAM,KAAK,QAAQ;QAC/B,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC;QAClD,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,CAC9B,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,KAAc;IACtC,IAAI,CAAC,WAAW,CAAC,KAAK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AC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;YAC3F,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,MAAM,EAAE,IAAI,IAAI,EAAE;gBAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;YAC3F,OAAO,IAAI,CAAC;QACb,CAAC,CAAC,CAAC;QACH,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC;QACvD,IAAI,MAAM,GAAG,CAAC;YAAE,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC;QACvE,OAAO,IAAI,cAAc,CAAC;YACzB,KAAK,EAAE,gBAAgB;YACvB,IAAI,EAAE,CAAC,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,KAAK,QAAQ,gBAAgB,CAAC;YACpE,OAAO;YACP,IAAI,EAAE,mBAAmB;YACzB,0DAA0D;YAC1D,UAAU,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC;YAC5B,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,SAAS,EAAE,IAAI,CAAC,SAAS;SACzB,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAClB,CAAC;CACD","sourcesContent":["import { stripVTControlCharacters } from \"node:util\";\nimport type { Component } from \"@bastani/atomic-tui\";\nimport {\n\tformatTaskHeartbeatDuration,\n\tformatTaskHeartbeatStatus,\n\ttype TaskHeartbeatDetails,\n\ttype TaskHeartbeatTask,\n\ttaskHeartbeatKindLabel,\n} from \"../../../core/tasks/heartbeat-notice.js\";\nimport { theme } from \"../theme/theme.js\";\nimport { HeartbeatBlock, type HeartbeatRow } from \"./heartbeat-block.ts\";\n\nfunction isNamedTask(value: unknown): value is TaskHeartbeatDetails[\"more\"][number] {\n\tif (!value || typeof value !== \"object\") return false;\n\tconst task = value as Partial<TaskHeartbeatTask>;\n\treturn (\n\t\ttypeof task.taskId === \"string\" &&\n\t\t(task.kind === \"agent\" || task.kind === \"command\") &&\n\t\ttypeof task.title === \"string\"\n\t);\n}\n\nfunction isHeartbeatTask(value: unknown): value is TaskHeartbeatTask {\n\tif (!isNamedTask(value)) return false;\n\tconst task = value as Partial<TaskHeartbeatTask>;\n\treturn typeof task.elapsedMs === \"number\" && typeof task.intervalMs === \"number\";\n}\n\n/** The structured heartbeat a card was raised with, or `undefined` when the entry does not carry one. */\nexport function heartbeatDetailsFrom(details: unknown): TaskHeartbeatDetails | undefined {\n\tif (!details || typeof details !== \"object\") return undefined;\n\tconst candidate = details as Partial<TaskHeartbeatDetails>;\n\tif (!Array.isArray(candidate.tasks) || !candidate.tasks.every(isHeartbeatTask)) return undefined;\n\treturn {\n\t\tscheduledAt: typeof candidate.scheduledAt === \"number\" ? candidate.scheduledAt : 0,\n\t\ttasks: candidate.tasks,\n\t\tmore: Array.isArray(candidate.more) ? candidate.more.filter(isNamedTask) : [],\n\t\tmoreCount: typeof candidate.moreCount === \"number\" ? candidate.moreCount : 0,\n\t};\n}\n\nconst clean = (value: string) => stripVTControlCharacters(value).replace(/[\\x00-\\x1f\\x7f-\\x9f]+/g, \" \");\n\n/** Tasks listed while a task heartbeat is collapsed; the rest are counted in one `… +N more` row. */\nexport const TASK_HEARTBEAT_COLLAPSED_TASKS = 5;\n\n/**\n * A task heartbeat in its chat, in the shared notice anatomy: `♥ Task heartbeat · N tasks still running`, one\n * connector row per task, and each task's status and last output lines when expanded.\n */\nexport class TaskHeartbeatMessage implements Component {\n\tprivate readonly details: TaskHeartbeatDetails;\n\tprivate readonly expanded: boolean;\n\tprivate readonly outputPad: number | undefined;\n\tconstructor(details: TaskHeartbeatDetails, expanded: boolean, outputPad?: number) {\n\t\tthis.details = details;\n\t\tthis.expanded = expanded;\n\t\tthis.outputPad = outputPad;\n\t}\n\tinvalidate(): void {}\n\trender(width: number): string[] {\n\t\tif (width < 1) return [];\n\t\tconst { tasks, moreCount } = this.details;\n\t\tconst total = tasks.length + moreCount;\n\t\tconst shown = this.expanded ? tasks : tasks.slice(0, TASK_HEARTBEAT_COLLAPSED_TASKS);\n\t\tconst records: HeartbeatRow[][] = shown.map((task) => {\n\t\t\tconst rows: HeartbeatRow[] = [\n\t\t\t\t`${theme.fg(\"accent\", `${taskHeartbeatKindLabel(task.kind)} ${clean(task.taskId)}`)} ${theme.fg(\"text\", clean(task.title))}${theme.fg(\"dim\", ` · ${formatTaskHeartbeatDuration(task.elapsedMs)}`)}`,\n\t\t\t];\n\t\t\tif (!this.expanded) return rows;\n\t\t\trows.push({ text: theme.fg(\"muted\", clean(formatTaskHeartbeatStatus(task))), wrap: true });\n\t\t\tfor (const line of task.output?.tail ?? []) rows.push(theme.fg(\"dim\", `│ ${clean(line)}`));\n\t\t\treturn rows;\n\t\t});\n\t\tconst hidden = tasks.length - shown.length + moreCount;\n\t\tif (hidden > 0) records.push([theme.fg(\"muted\", `… +${hidden} more`)]);\n\t\treturn new HeartbeatBlock({\n\t\t\ttitle: \"Task heartbeat\",\n\t\t\tmeta: [`${total === 1 ? \"1 task\" : `${total} tasks`} still running`],\n\t\t\trecords,\n\t\t\thint: \"/tasks to inspect\",\n\t\t\t// Collapsed, each task hides its status and output lines.\n\t\t\texpandable: tasks.length > 0,\n\t\t\texpanded: this.expanded,\n\t\t\toutputPad: this.outputPad,\n\t\t}).render(width);\n\t}\n}\n"]}
|
|
@@ -49,6 +49,12 @@ export declare class TaskInspector implements Component {
|
|
|
49
49
|
private helpOpen;
|
|
50
50
|
/** Where ← from an open task chat goes: the list, the task's detail page, or out to whatever opened the inspector. */
|
|
51
51
|
private chatFrom;
|
|
52
|
+
/**
|
|
53
|
+
* The shell whose output is open because a waiting subagent's key opened it, and the view the back key returns to
|
|
54
|
+
* as it was left: the subagent's chat (kept, not closed, so its scroll, draft and cursor stay), the list with its
|
|
55
|
+
* peek, or the detail page with its scroll and chosen action.
|
|
56
|
+
*/
|
|
57
|
+
private waitedShell;
|
|
52
58
|
closedByBack: boolean;
|
|
53
59
|
/** What ← from a chat opened by the caller names, such as `main chat`. */
|
|
54
60
|
private callerLabel;
|
|
@@ -141,6 +147,16 @@ export declare class TaskInspector implements Component {
|
|
|
141
147
|
/** A transcript's message failed after the reader left it: on the task pages if they are open, else through the host. */
|
|
142
148
|
private reportLate;
|
|
143
149
|
private closeTranscript;
|
|
150
|
+
/** The newest running shell of the selected subagent while it is released and waits; undefined otherwise. */
|
|
151
|
+
private waitedShellOfSelected;
|
|
152
|
+
/**
|
|
153
|
+
* Opens the output of the shell the selected waiting subagent waits on, as its key does from the subagent's chat,
|
|
154
|
+
* its detail page or its row. The shell is the subagent's, so it is shown without becoming the list's selection.
|
|
155
|
+
*/
|
|
156
|
+
private openWaitedShell;
|
|
157
|
+
private waitedShellRecord;
|
|
158
|
+
/** Back from a waiting subagent's shell to the view it was opened from, as it was left. */
|
|
159
|
+
private leaveWaitedShell;
|
|
144
160
|
private loadDetail;
|
|
145
161
|
/** A click on a block header in an open transcript expands or collapses that block. */
|
|
146
162
|
handleMouse(event: TuiMouseEvent): TuiMouseEventResult | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-inspector.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/task-inspector.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,SAAS,EAId,KAAK,aAAa,EAClB,KAAK,mBAAmB,EAIxB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACN,KAAK,uBAAuB,EAG5B,MAAM,2CAA2C,CAAC;
|
|
1
|
+
{"version":3,"file":"task-inspector.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/task-inspector.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,SAAS,EAId,KAAK,aAAa,EAClB,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,OAAO,CAExB;IAED,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,gBAAgB;IAmBxB,OAAO,CAAC,UAAU;IAqBlB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,EAAE,CAE3D;IACD,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAE9B;IACD,OAAO,CAAC,oBAAoB;IA8G5B,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAoEtD;IAED,OAAO,CAAC,gBAAgB;IAkCxB,OAAO,CAAC,WAAW;IA6OnB,OAAO,CAAC,SAAS;CAajB;AAKD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAmBhE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { stripVTControlCharacters } from "node:util";
|
|
2
2
|
import { getKeybindings, Input, matchesKey, truncateToWidth, visibleWidth, wrapTextWithAnsi, } from "@bastani/atomic-tui";
|
|
3
3
|
import { agentPanelItemReadAt, promptAnswerOptionsOf, } from "../../../core/tasks/agent-panel-source.js";
|
|
4
|
-
import { supersededReleasedAttempts, waitingReleasedTools } from "../../../core/tasks/completion.js";
|
|
4
|
+
import { supersededReleasedAttempts, waitingReleasedShells, waitingReleasedTools, } from "../../../core/tasks/completion.js";
|
|
5
5
|
import { liveElapsedFromRead, taskClockOf, taskClockRunning, taskClocksFor, } from "../../../core/tasks/live-elapsed.js";
|
|
6
6
|
import { isTaskTurnInterrupted, OwnerTaskStore } from "../../../core/tasks/owner-store.js";
|
|
7
7
|
import { ownerTaskViewSource } from "../../../core/tasks/task-view-source.js";
|
|
@@ -62,6 +62,8 @@ function escAndBack() {
|
|
|
62
62
|
}
|
|
63
63
|
function listKeys() {
|
|
64
64
|
return [
|
|
65
|
+
// First, so a narrow hint keeps it: a waiting subagent's shell is what its row is waiting on.
|
|
66
|
+
{ action: "app.tasks.openWaited", label: "shell" },
|
|
65
67
|
{ keys: "↑↓", label: "select" },
|
|
66
68
|
{ action: "app.list.peek", label: "peek" },
|
|
67
69
|
{ action: "app.list.open", label: "open" },
|
|
@@ -116,6 +118,12 @@ export class TaskInspector {
|
|
|
116
118
|
helpOpen = false;
|
|
117
119
|
/** Where ← from an open task chat goes: the list, the task's detail page, or out to whatever opened the inspector. */
|
|
118
120
|
chatFrom = "detail";
|
|
121
|
+
/**
|
|
122
|
+
* The shell whose output is open because a waiting subagent's key opened it, and the view the back key returns to
|
|
123
|
+
* as it was left: the subagent's chat (kept, not closed, so its scroll, draft and cursor stay), the list with its
|
|
124
|
+
* peek, or the detail page with its scroll and chosen action.
|
|
125
|
+
*/
|
|
126
|
+
waitedShell;
|
|
119
127
|
closedByBack = false;
|
|
120
128
|
/** What ← from a chat opened by the caller names, such as `main chat`. */
|
|
121
129
|
callerLabel = "back";
|
|
@@ -635,6 +643,63 @@ export class TaskInspector {
|
|
|
635
643
|
closeTranscript() {
|
|
636
644
|
this.transcript?.dispose();
|
|
637
645
|
this.transcript = undefined;
|
|
646
|
+
this.waitedShell?.suspended?.dispose();
|
|
647
|
+
this.waitedShell = undefined;
|
|
648
|
+
}
|
|
649
|
+
/** The newest running shell of the selected subagent while it is released and waits; undefined otherwise. */
|
|
650
|
+
waitedShellOfSelected() {
|
|
651
|
+
const task = this.selected();
|
|
652
|
+
if (task === undefined)
|
|
653
|
+
return undefined;
|
|
654
|
+
return waitingReleasedShells(task, this.store.ownerTasks ?? this.store.tasks).at(-1);
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* Opens the output of the shell the selected waiting subagent waits on, as its key does from the subagent's chat,
|
|
658
|
+
* its detail page or its row. The shell is the subagent's, so it is shown without becoming the list's selection.
|
|
659
|
+
*/
|
|
660
|
+
openWaitedShell() {
|
|
661
|
+
const shell = this.waitedShellOfSelected();
|
|
662
|
+
if (shell === undefined)
|
|
663
|
+
return false;
|
|
664
|
+
const suspended = this.transcript;
|
|
665
|
+
const returnTo = suspended !== undefined ? "chat" : this.navigation.focus.kind === "tasks" ? "list" : "detail";
|
|
666
|
+
// The chat, a peek or the detail page stays as it is under the shell's output, for the back key.
|
|
667
|
+
this.transcript = undefined;
|
|
668
|
+
const taskId = shell.ref.taskId;
|
|
669
|
+
const byteCount = () => BigInt(this.waitedShellRecord(taskId)?.output.byteCount ?? "0");
|
|
670
|
+
this.navigation.focus = { kind: "detail" };
|
|
671
|
+
this.transcript = new TaskCommandOutputPage(this.store, taskId, byteCount, this.transcriptEnvironment(), this.requestRender);
|
|
672
|
+
this.waitedShell = { taskId, returnTo, suspended, scroll: this.scroll, actionIndex: this.actionIndex };
|
|
673
|
+
this.requestRender();
|
|
674
|
+
void this.transcript.load();
|
|
675
|
+
return true;
|
|
676
|
+
}
|
|
677
|
+
waitedShellRecord(taskId) {
|
|
678
|
+
return (this.store.ownerTasks ?? this.store.tasks).find((task) => task.ref.taskId === taskId);
|
|
679
|
+
}
|
|
680
|
+
/** Back from a waiting subagent's shell to the view it was opened from, as it was left. */
|
|
681
|
+
leaveWaitedShell() {
|
|
682
|
+
const back = this.waitedShell;
|
|
683
|
+
if (back === undefined)
|
|
684
|
+
return;
|
|
685
|
+
this.waitedShell = undefined;
|
|
686
|
+
this.transcript?.dispose();
|
|
687
|
+
this.transcript = undefined;
|
|
688
|
+
this.scroll = back.scroll;
|
|
689
|
+
this.actionIndex = back.actionIndex;
|
|
690
|
+
if (back.suspended !== undefined) {
|
|
691
|
+
this.transcript = back.suspended;
|
|
692
|
+
this.navigation.focus = { kind: "detail" };
|
|
693
|
+
back.suspended.refresh();
|
|
694
|
+
}
|
|
695
|
+
else if (back.returnTo === "list") {
|
|
696
|
+
this.navigation.focus = { kind: "tasks" };
|
|
697
|
+
}
|
|
698
|
+
else {
|
|
699
|
+
this.navigation.focus = { kind: "detail" };
|
|
700
|
+
void this.loadDetail();
|
|
701
|
+
}
|
|
702
|
+
this.requestRender();
|
|
638
703
|
}
|
|
639
704
|
async loadDetail() {
|
|
640
705
|
const selectedId = this.selected()?.ref.taskId;
|
|
@@ -720,7 +785,8 @@ export class TaskInspector {
|
|
|
720
785
|
const selectionAction = stopKey ||
|
|
721
786
|
keys.matches(data, "app.list.open") ||
|
|
722
787
|
keys.matches(data, "app.list.peek") ||
|
|
723
|
-
keys.matches(data, "app.tasks.input")
|
|
788
|
+
keys.matches(data, "app.tasks.input") ||
|
|
789
|
+
keys.matches(data, "app.tasks.openWaited");
|
|
724
790
|
const armedBeforeRefresh = stopKey ? this.navigation.stopConfirm.pending() : undefined;
|
|
725
791
|
const selectedBeforeRefresh = this.navigation.selectedId;
|
|
726
792
|
const peekRow = this.peekId === undefined ? undefined : this.selectedRow();
|
|
@@ -816,6 +882,8 @@ export class TaskInspector {
|
|
|
816
882
|
this.requestRender();
|
|
817
883
|
return true;
|
|
818
884
|
}
|
|
885
|
+
if (!editingBoard && getKeybindings().matches(data, "app.tasks.openWaited") && this.openWaitedShell())
|
|
886
|
+
return true;
|
|
819
887
|
if (focus.kind === "tasks" && this.handleBoardInput(data)) {
|
|
820
888
|
this.requestRender();
|
|
821
889
|
return true;
|
|
@@ -883,8 +951,14 @@ export class TaskInspector {
|
|
|
883
951
|
return true;
|
|
884
952
|
}
|
|
885
953
|
const keys = getKeybindings();
|
|
954
|
+
if (keys.matches(data, "app.tasks.openWaited") && this.waitedShell === undefined && this.openWaitedShell())
|
|
955
|
+
return true;
|
|
886
956
|
// ← on an empty prompt, or at the start of a typed one (kept for the return), goes back one level.
|
|
887
957
|
if (!matchesKey(data, "escape") && keys.matches(data, "app.nav.back") && transcript.cursorAtStart()) {
|
|
958
|
+
if (this.waitedShell !== undefined) {
|
|
959
|
+
this.leaveWaitedShell();
|
|
960
|
+
return true;
|
|
961
|
+
}
|
|
888
962
|
if (this.chatFrom === "caller") {
|
|
889
963
|
this.closedByBack = true;
|
|
890
964
|
this.close();
|
|
@@ -1387,7 +1461,8 @@ export class TaskInspector {
|
|
|
1387
1461
|
this.transcriptTop = 0;
|
|
1388
1462
|
return transcript.render(width, budget);
|
|
1389
1463
|
}
|
|
1390
|
-
const
|
|
1464
|
+
const waitedShell = this.waitedShell;
|
|
1465
|
+
const task = waitedShell === undefined ? this.selected() : this.waitedShellRecord(waitedShell.taskId);
|
|
1391
1466
|
const fitWidth = (line) => truncateToWidth(line, Math.max(1, width));
|
|
1392
1467
|
const attachedAgentChat = this.chatFrom === "caller" && task?.kind === "agent";
|
|
1393
1468
|
const promptEcho = attachedAgentChat ? taskDisplayText(task.title || taskLabel(task)) : "";
|
|
@@ -1442,7 +1517,18 @@ export class TaskInspector {
|
|
|
1442
1517
|
return [mapped];
|
|
1443
1518
|
}), width, style, chatKeybindings),
|
|
1444
1519
|
].slice(0, Math.max(1, budget));
|
|
1445
|
-
const
|
|
1520
|
+
const waitingAgent = waitedShell === undefined ? undefined : this.selected();
|
|
1521
|
+
const back = waitedShell?.returnTo === "chat"
|
|
1522
|
+
? taskDisplayText(waitingAgent ? taskLabel(waitingAgent) : "agent")
|
|
1523
|
+
: waitedShell?.returnTo === "list"
|
|
1524
|
+
? "tasks"
|
|
1525
|
+
: waitedShell !== undefined
|
|
1526
|
+
? "task"
|
|
1527
|
+
: this.chatFrom === "caller"
|
|
1528
|
+
? this.callerLabel
|
|
1529
|
+
: this.chatFrom === "list"
|
|
1530
|
+
? "tasks"
|
|
1531
|
+
: "task";
|
|
1446
1532
|
const chatKeys = taskChatKeys(back, interruptible, hasTasks, expandable).flatMap((entry) => {
|
|
1447
1533
|
if (entry.action === "app.nav.back") {
|
|
1448
1534
|
return !questionActive || transcript.cursorAtStart()
|
|
@@ -1688,6 +1774,11 @@ export class TaskInspector {
|
|
|
1688
1774
|
key.action === "app.keys.help" ||
|
|
1689
1775
|
key.action === "app.list.filter")
|
|
1690
1776
|
.flatMap((key) => {
|
|
1777
|
+
if (key.action === "app.tasks.openWaited")
|
|
1778
|
+
return selected?.kind === "task" &&
|
|
1779
|
+
waitingReleasedShells(selected.task, this.store.ownerTasks ?? this.store.tasks).length > 0
|
|
1780
|
+
? [key]
|
|
1781
|
+
: [];
|
|
1691
1782
|
if (key.action === "app.list.stop") {
|
|
1692
1783
|
const finished = selected?.kind === "task"
|
|
1693
1784
|
? selected.task.execution.kind === "settled" &&
|