@bastani/atomic 0.9.76 → 0.9.77
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 +46 -0
- package/dist/builtin/intercom/CHANGELOG.md +26 -0
- package/dist/builtin/intercom/broker/broker.ts +153 -6
- package/dist/builtin/intercom/broker/client.ts +85 -3
- package/dist/builtin/intercom/broker/departed-children.ts +471 -0
- package/dist/builtin/intercom/broker/recipient-gone-errors.ts +280 -0
- package/dist/builtin/intercom/broker/restoring-recipients.ts +108 -7
- package/dist/builtin/intercom/broker/send-handler.ts +42 -0
- package/dist/builtin/intercom/broker/workflow-stage-aliases.ts +69 -0
- package/dist/builtin/intercom/index.bundle.mjs +374 -129
- package/dist/builtin/intercom/package.json +2 -2
- package/dist/builtin/intercom/types.ts +30 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +30 -0
- package/dist/builtin/subagents/README.md +1 -1
- package/dist/builtin/subagents/package.json +3 -3
- package/dist/builtin/subagents/skills/agent-browser/SKILL.md +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +64 -4
- package/dist/builtin/web-access/package.json +2 -2
- package/dist/builtin/workflows/CHANGELOG.md +28 -0
- package/dist/builtin/workflows/README.md +1 -1
- package/dist/builtin/workflows/package.json +2 -2
- package/dist/builtin/workflows/skills/impeccable/SKILL.md +3 -3
- package/dist/builtin/workflows/skills/impeccable/scripts/VERSION +1 -1
- package/dist/builtin/workflows/skills/impeccable/scripts/engine-checksums.txt +5 -5
- package/dist/builtin/workflows/skills/impeccable/scripts/live-browser.js +71 -56
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +315 -112
- package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +168 -9
- package/dist/builtin/workflows/src/index.js +168 -9
- package/dist/builtin/workflows/src/local-worker-entry.mjs +168 -9
- package/dist/core/agent-session-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-compaction.js +2 -1
- package/dist/core/agent-session-compaction.js.map +1 -1
- package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
- package/dist/core/agent-session-extension-bindings.js +2 -0
- package/dist/core/agent-session-extension-bindings.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +1 -0
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-state.d.ts.map +1 -1
- package/dist/core/agent-session-state.js +7 -2
- package/dist/core/agent-session-state.js.map +1 -1
- package/dist/core/agent-session-tasks.d.ts +6 -0
- package/dist/core/agent-session-tasks.d.ts.map +1 -1
- package/dist/core/agent-session-tasks.js +13 -25
- package/dist/core/agent-session-tasks.js.map +1 -1
- package/dist/core/agent-session-types.d.ts +2 -0
- package/dist/core/agent-session-types.d.ts.map +1 -1
- package/dist/core/agent-session-types.js.map +1 -1
- package/dist/core/agent-session.d.ts +1 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +2 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/extensions/loader-rollback.d.ts.map +1 -1
- package/dist/core/extensions/loader-rollback.js +1 -0
- package/dist/core/extensions/loader-rollback.js.map +1 -1
- package/dist/core/extensions/runner-context.d.ts +3 -3
- package/dist/core/extensions/runner-context.d.ts.map +1 -1
- package/dist/core/extensions/runner-context.js +2 -1
- package/dist/core/extensions/runner-context.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +9 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +16 -1
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/sdk-types.d.ts +5 -0
- package/dist/core/sdk-types.d.ts.map +1 -1
- package/dist/core/sdk-types.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +8 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/system-prompt.d.ts +6 -0
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +26 -18
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tasks/agent-adapter.js +2 -2
- package/dist/core/tasks/agent-adapter.js.map +1 -1
- package/dist/core/tasks/cancel-reason.d.ts +20 -0
- package/dist/core/tasks/cancel-reason.d.ts.map +1 -0
- package/dist/core/tasks/cancel-reason.js +47 -0
- package/dist/core/tasks/cancel-reason.js.map +1 -0
- package/dist/core/tasks/child-command-owner.d.ts +1 -1
- package/dist/core/tasks/child-command-owner.d.ts.map +1 -1
- package/dist/core/tasks/child-command-owner.js +22 -0
- package/dist/core/tasks/child-command-owner.js.map +1 -1
- package/dist/core/tasks/completion-message.d.ts +11 -0
- package/dist/core/tasks/completion-message.d.ts.map +1 -0
- package/dist/core/tasks/completion-message.js +30 -0
- package/dist/core/tasks/completion-message.js.map +1 -0
- package/dist/core/tasks/completion.d.ts +2 -0
- package/dist/core/tasks/completion.d.ts.map +1 -1
- package/dist/core/tasks/completion.js +30 -14
- package/dist/core/tasks/completion.js.map +1 -1
- package/dist/core/tasks/contracts.d.ts +4 -0
- package/dist/core/tasks/contracts.d.ts.map +1 -1
- package/dist/core/tasks/contracts.js.map +1 -1
- package/dist/core/tasks/supervisor.d.ts +29 -3
- package/dist/core/tasks/supervisor.d.ts.map +1 -1
- package/dist/core/tasks/supervisor.js +48 -25
- package/dist/core/tasks/supervisor.js.map +1 -1
- package/dist/core/tasks/task-view-source.d.ts +6 -0
- package/dist/core/tasks/task-view-source.d.ts.map +1 -1
- package/dist/core/tasks/task-view-source.js +49 -0
- package/dist/core/tasks/task-view-source.js.map +1 -1
- package/dist/core/tools/bash-pty-native.d.ts +6 -1
- package/dist/core/tools/bash-pty-native.d.ts.map +1 -1
- package/dist/core/tools/bash-pty-native.js +5 -1
- package/dist/core/tools/bash-pty-native.js.map +1 -1
- package/dist/core/tools/bash.d.ts +5 -0
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +14 -5
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/history-protocol.d.ts +15 -1
- package/dist/core/tools/history-protocol.d.ts.map +1 -1
- package/dist/core/tools/history-protocol.js +9 -7
- package/dist/core/tools/history-protocol.js.map +1 -1
- package/dist/core/tools/shell-task-status.d.ts.map +1 -1
- package/dist/core/tools/shell-task-status.js +3 -13
- package/dist/core/tools/shell-task-status.js.map +1 -1
- package/dist/core/workflow-stage-admission.d.ts +2 -0
- package/dist/core/workflow-stage-admission.d.ts.map +1 -1
- package/dist/core/workflow-stage-admission.js +36 -6
- package/dist/core/workflow-stage-admission.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.js +12 -8
- package/dist/modes/interactive/components/chat-session-host-rendering.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-state.d.ts +2 -0
- package/dist/modes/interactive/components/chat-session-host-state.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-state.js +2 -0
- package/dist/modes/interactive/components/chat-session-host-state.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-types.d.ts +6 -0
- package/dist/modes/interactive/components/chat-session-host-types.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-types.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.js +5 -2
- package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +8 -5
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +5 -2
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +1 -0
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js +1 -0
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/input-label.d.ts +29 -0
- package/dist/modes/interactive/components/input-label.d.ts.map +1 -0
- package/dist/modes/interactive/components/input-label.js +75 -0
- package/dist/modes/interactive/components/input-label.js.map +1 -0
- package/dist/modes/interactive/components/task-inspector.d.ts +4 -1
- package/dist/modes/interactive/components/task-inspector.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-inspector.js +6 -2
- package/dist/modes/interactive/components/task-inspector.js.map +1 -1
- package/dist/modes/interactive/components/task-transcript-page.d.ts +12 -1
- package/dist/modes/interactive/components/task-transcript-page.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-transcript-page.js +63 -6
- package/dist/modes/interactive/components/task-transcript-page.js.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.js +1 -0
- package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
- package/dist/modes/interactive/interactive-slash-commands.js +1 -0
- package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
- package/dist/modes/interactive-engine/engine-session-stats.d.ts +1 -1
- package/dist/modes/interactive-engine/engine-session-stats.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-session-stats.js.map +1 -1
- package/dist/modes/rpc/task-ui-bridge.d.ts +2 -2
- package/dist/modes/rpc/task-ui-bridge.d.ts.map +1 -1
- package/dist/modes/rpc/task-ui-bridge.js +2 -0
- package/dist/modes/rpc/task-ui-bridge.js.map +1 -1
- package/docs/background-tasks.md +14 -1
- package/docs/getting-started/first-session.md +1 -1
- package/docs/intercom/operations.md +4 -2
- package/docs/intercom/reference.md +18 -1
- package/docs/llama-cpp.md +1 -1
- package/docs/sessions.md +1 -1
- package/docs/subagents.md +5 -1
- package/docs/tools.md +1 -1
- package/docs/usage.md +1 -12
- package/docs/workflows/operations.md +3 -1
- package/docs/workflows/verification.md +1 -8
- package/npm-shrinkwrap.json +83 -98
- package/package.json +6 -6
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
|
|
2
|
+
import { stripAnsi } from "./chat-session-host-utils.js";
|
|
3
|
+
/** Supported terminal floor for naming the session in a chat input's top rule. */
|
|
4
|
+
export const INPUT_LABEL_MIN_COLUMNS = 40;
|
|
5
|
+
const RESET = "\x1b[0m";
|
|
6
|
+
const BOLD = "\x1b[1m";
|
|
7
|
+
const NORMAL_INTENSITY = "\x1b[22m";
|
|
8
|
+
const EDITOR_SUFFIX = "] ";
|
|
9
|
+
const EDITOR_OVERFLOW_RE = /^(─*)( ↑ \d+ more )(─*)$/;
|
|
10
|
+
/** The text that opens a `kind` label, such as `[stage:`; a line containing it is labeled already. */
|
|
11
|
+
export function inputLabelMarker(kind) {
|
|
12
|
+
return `[${kind}:`;
|
|
13
|
+
}
|
|
14
|
+
/** The colour a rendered rule opens with, so a label's fill continues in it. */
|
|
15
|
+
export function ruleOpenColor(line) {
|
|
16
|
+
return line.match(/^(\x1b\[[0-9;]*m)/)?.[1] ?? "";
|
|
17
|
+
}
|
|
18
|
+
function inputLabel(style, name, maxNameWidth, prefix, suffix) {
|
|
19
|
+
const shown = truncateToWidth(name, maxNameWidth, "…");
|
|
20
|
+
return {
|
|
21
|
+
plain: prefix + shown + suffix,
|
|
22
|
+
styled: style.textMuted(prefix) + BOLD + style.text(shown) + NORMAL_INTENSITY + style.textMuted(suffix),
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/** `prefix`, `name` truncated with an ellipsis to `maxNameWidth` columns, then `suffix`; nothing when no column fits. */
|
|
26
|
+
export function buildInputLabel(style, name, maxNameWidth, prefix, suffix) {
|
|
27
|
+
return maxNameWidth < 1 ? undefined : inputLabel(style, name, maxNameWidth, prefix, suffix);
|
|
28
|
+
}
|
|
29
|
+
function decorateEditorTopLine(style, kind, name, line, plain, overflow) {
|
|
30
|
+
const width = visibleWidth(plain);
|
|
31
|
+
if (width < INPUT_LABEL_MIN_COLUMNS)
|
|
32
|
+
return undefined;
|
|
33
|
+
const prefix = `${inputLabelMarker(kind)} `;
|
|
34
|
+
const overflowWidth = overflow === undefined ? 0 : visibleWidth(overflow);
|
|
35
|
+
const maxNameWidth = Math.max(1, width - overflowWidth - visibleWidth(prefix) - visibleWidth(EDITOR_SUFFIX) - 2);
|
|
36
|
+
const label = inputLabel(style, name, maxNameWidth, prefix, EDITOR_SUFFIX);
|
|
37
|
+
const labelWidth = visibleWidth(label.plain);
|
|
38
|
+
if (labelWidth + overflowWidth >= width)
|
|
39
|
+
return undefined;
|
|
40
|
+
const fillWidth = width - labelWidth - overflowWidth;
|
|
41
|
+
const openColor = ruleOpenColor(line);
|
|
42
|
+
if (overflow === undefined)
|
|
43
|
+
return openColor + RESET + label.styled + openColor + "─".repeat(fillWidth) + RESET;
|
|
44
|
+
const leftFill = Math.floor(fillWidth / 2);
|
|
45
|
+
return (openColor +
|
|
46
|
+
RESET +
|
|
47
|
+
label.styled +
|
|
48
|
+
openColor +
|
|
49
|
+
"─".repeat(leftFill) +
|
|
50
|
+
overflow +
|
|
51
|
+
"─".repeat(fillWidth - leftFill) +
|
|
52
|
+
RESET);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Names the session a chat input sends to in the editor's top rule, as `[kind: name]`. Call it on the editor's
|
|
56
|
+
* rendered lines: decorating the rule while the editor renders would stop it recognising the rule as a border and
|
|
57
|
+
* put the `❯` prompt on it. Only the first line is decorated, a plain `─` rule or a scrolled `↑ N more` rule, whose
|
|
58
|
+
* indicator stays; later rules never are. A labeled rule is no longer plain, so it is never labeled twice, and draft
|
|
59
|
+
* text that names a label does not count as one. A rule narrower than {@link INPUT_LABEL_MIN_COLUMNS} is left as it is.
|
|
60
|
+
*/
|
|
61
|
+
export function applyInputLabelToEditorTopRule(style, kind, name, editorLines) {
|
|
62
|
+
const lines = [...editorLines];
|
|
63
|
+
const topLine = lines[0];
|
|
64
|
+
if (!name || topLine === undefined)
|
|
65
|
+
return lines;
|
|
66
|
+
const plain = stripAnsi(topLine);
|
|
67
|
+
const overflow = EDITOR_OVERFLOW_RE.exec(plain)?.[2];
|
|
68
|
+
if (!/^─+$/.test(plain) && overflow === undefined)
|
|
69
|
+
return lines;
|
|
70
|
+
const decorated = decorateEditorTopLine(style, kind, name, topLine, plain, overflow);
|
|
71
|
+
if (decorated !== undefined)
|
|
72
|
+
lines[0] = decorated;
|
|
73
|
+
return lines;
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=input-label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"input-label.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/input-label.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,kFAAkF;AAClF,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAiB1C,MAAM,KAAK,GAAG,SAAS,CAAC;AACxB,MAAM,IAAI,GAAG,SAAS,CAAC;AACvB,MAAM,gBAAgB,GAAG,UAAU,CAAC;AACpC,MAAM,aAAa,GAAG,IAAI,CAAC;AAC3B,MAAM,kBAAkB,GAAG,0BAA0B,CAAC;AAEtD,sGAAsG;AACtG,MAAM,UAAU,gBAAgB,CAAC,IAAoB;IACpD,OAAO,IAAI,IAAI,GAAG,CAAC;AACpB,CAAC;AAED,gFAAgF;AAChF,MAAM,UAAU,aAAa,CAAC,IAAY;IACzC,OAAO,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACnD,CAAC;AAED,SAAS,UAAU,CAClB,KAAsB,EACtB,IAAY,EACZ,YAAoB,EACpB,MAAc,EACd,MAAc;IAEd,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,EAAE,YAAY,EAAE,GAAG,CAAC,CAAC;IACvD,OAAO;QACN,KAAK,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM;QAC9B,MAAM,EAAE,KAAK,CA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AAE,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAClD,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["import { truncateToWidth, visibleWidth } from \"@earendil-works/pi-tui\";\nimport { stripAnsi } from \"./chat-session-host-utils.ts\";\n\n/** Supported terminal floor for naming the session in a chat input's top rule. */\nexport const INPUT_LABEL_MIN_COLUMNS = 40;\n\n/** What kind of session a chat input sends to: an attached workflow stage, or a subagent. */\nexport type InputLabelKind = \"stage\" | \"subagent\";\n\n/** Colours of a label: the brackets and kind are muted, the name is bold in the text colour. */\nexport interface InputLabelStyle {\n\ttextMuted(text: string): string;\n\ttext(text: string): string;\n}\n\n/** A label for a rule: its plain text, for measuring, and its styled text. */\nexport interface InputLabel {\n\treadonly plain: string;\n\treadonly styled: string;\n}\n\nconst RESET = \"\\x1b[0m\";\nconst BOLD = \"\\x1b[1m\";\nconst NORMAL_INTENSITY = \"\\x1b[22m\";\nconst EDITOR_SUFFIX = \"] \";\nconst EDITOR_OVERFLOW_RE = /^(─*)( ↑ \\d+ more )(─*)$/;\n\n/** The text that opens a `kind` label, such as `[stage:`; a line containing it is labeled already. */\nexport function inputLabelMarker(kind: InputLabelKind): string {\n\treturn `[${kind}:`;\n}\n\n/** The colour a rendered rule opens with, so a label's fill continues in it. */\nexport function ruleOpenColor(line: string): string {\n\treturn line.match(/^(\\x1b\\[[0-9;]*m)/)?.[1] ?? \"\";\n}\n\nfunction inputLabel(\n\tstyle: InputLabelStyle,\n\tname: string,\n\tmaxNameWidth: number,\n\tprefix: string,\n\tsuffix: string,\n): InputLabel {\n\tconst shown = truncateToWidth(name, maxNameWidth, \"…\");\n\treturn {\n\t\tplain: prefix + shown + suffix,\n\t\tstyled: style.textMuted(prefix) + BOLD + style.text(shown) + NORMAL_INTENSITY + style.textMuted(suffix),\n\t};\n}\n\n/** `prefix`, `name` truncated with an ellipsis to `maxNameWidth` columns, then `suffix`; nothing when no column fits. */\nexport function buildInputLabel(\n\tstyle: InputLabelStyle,\n\tname: string,\n\tmaxNameWidth: number,\n\tprefix: string,\n\tsuffix: string,\n): InputLabel | undefined {\n\treturn maxNameWidth < 1 ? undefined : inputLabel(style, name, maxNameWidth, prefix, suffix);\n}\n\nfunction decorateEditorTopLine(\n\tstyle: InputLabelStyle,\n\tkind: InputLabelKind,\n\tname: string,\n\tline: string,\n\tplain: string,\n\toverflow: string | undefined,\n): string | undefined {\n\tconst width = visibleWidth(plain);\n\tif (width < INPUT_LABEL_MIN_COLUMNS) return undefined;\n\tconst prefix = `${inputLabelMarker(kind)} `;\n\tconst overflowWidth = overflow === undefined ? 0 : visibleWidth(overflow);\n\tconst maxNameWidth = Math.max(1, width - overflowWidth - visibleWidth(prefix) - visibleWidth(EDITOR_SUFFIX) - 2);\n\tconst label = inputLabel(style, name, maxNameWidth, prefix, EDITOR_SUFFIX);\n\tconst labelWidth = visibleWidth(label.plain);\n\tif (labelWidth + overflowWidth >= width) return undefined;\n\tconst fillWidth = width - labelWidth - overflowWidth;\n\tconst openColor = ruleOpenColor(line);\n\tif (overflow === undefined) return openColor + RESET + label.styled + openColor + \"─\".repeat(fillWidth) + RESET;\n\tconst leftFill = Math.floor(fillWidth / 2);\n\treturn (\n\t\topenColor +\n\t\tRESET +\n\t\tlabel.styled +\n\t\topenColor +\n\t\t\"─\".repeat(leftFill) +\n\t\toverflow +\n\t\t\"─\".repeat(fillWidth - leftFill) +\n\t\tRESET\n\t);\n}\n\n/**\n * Names the session a chat input sends to in the editor's top rule, as `[kind: name]`. Call it on the editor's\n * rendered lines: decorating the rule while the editor renders would stop it recognising the rule as a border and\n * put the `❯` prompt on it. Only the first line is decorated, a plain `─` rule or a scrolled `↑ N more` rule, whose\n * indicator stays; later rules never are. A labeled rule is no longer plain, so it is never labeled twice, and draft\n * text that names a label does not count as one. A rule narrower than {@link INPUT_LABEL_MIN_COLUMNS} is left as it is.\n */\nexport function applyInputLabelToEditorTopRule(\n\tstyle: InputLabelStyle,\n\tkind: InputLabelKind,\n\tname: string | undefined,\n\teditorLines: readonly string[],\n): string[] {\n\tconst lines = [...editorLines];\n\tconst topLine = lines[0];\n\tif (!name || topLine === undefined) return lines;\n\tconst plain = stripAnsi(topLine);\n\tconst overflow = EDITOR_OVERFLOW_RE.exec(plain)?.[2];\n\tif (!/^─+$/.test(plain) && overflow === undefined) return lines;\n\tconst decorated = decorateEditorTopLine(style, kind, name, topLine, plain, overflow);\n\tif (decorated !== undefined) lines[0] = decorated;\n\treturn lines;\n}\n"]}
|
|
@@ -50,7 +50,10 @@ export declare class TaskInspector implements Component {
|
|
|
50
50
|
/** Every key belongs to the inspector except the host's thinking toggle when it leaves that alone. */
|
|
51
51
|
handleInput(data: string): boolean;
|
|
52
52
|
private route;
|
|
53
|
-
/**
|
|
53
|
+
/**
|
|
54
|
+
* A transcript is a chat: Escape, or Left with nothing typed, goes back; every other key belongs to it. While its own
|
|
55
|
+
* task list is open, back keys belong to that list, which returns to the chat.
|
|
56
|
+
*/
|
|
54
57
|
private handleTranscriptInput;
|
|
55
58
|
private configuredTaskKey;
|
|
56
59
|
/** Only the task picker stays inline; drill-down and confirmation own the screen. */
|
|
@@ -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,EAOd,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAanG,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAGN,KAAK,yBAAyB,EAE9B,MAAM,2BAA2B,CAAC;AASnC,sFAAsF;AACtF,qBAAa,aAAc,YAAW,SAAS;IAC9C,QAAQ,CAAC,UAAU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IAyBtB,yHAAyH;IACzH,OAAO,CAAC,UAAU;IAQlB,OAAO,CAAC,eAAe;YAIT,UAAU;IAyCxB,sGAAsG;IACtG,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEjC;IACD,OAAO,CAAC,KAAK;IAgEb
|
|
1
|
+
{"version":3,"file":"task-inspector.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/task-inspector.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,SAAS,EAOd,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAuB,KAAK,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAanG,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,EAGN,KAAK,yBAAyB,EAE9B,MAAM,2BAA2B,CAAC;AASnC,sFAAsF;AACtF,qBAAa,aAAc,YAAW,SAAS;IAC9C,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IACpC,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,YAAY,CAAC,CAA4B;IACjD,0EAA0E;IAC1E,OAAO,CAAC,UAAU,CAAC,CAAqB;IACxC,OAAO,CAAC,MAAM,CAAM;IACpB,yFAAyF;IACzF,kEAAkE;IAClE,OAAO,CAAC,aAAa,CAAM;IAC3B,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,aAAa,CAAiD;IACtE,OAAO,CAAC,YAAY,CAAC,CAAS;IAC9B,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,WAAW,CAAC,CAA0C;IAC9D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAe;IACrC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa;IACzC,OAAO,CAAC,QA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EAAE,CAyEtD;IACD,OAAO,CAAC,SAAS;CAmDjB"}
|
|
@@ -318,9 +318,13 @@ export class TaskInspector {
|
|
|
318
318
|
this.requestRender();
|
|
319
319
|
return true;
|
|
320
320
|
}
|
|
321
|
-
/**
|
|
321
|
+
/**
|
|
322
|
+
* A transcript is a chat: Escape, or Left with nothing typed, goes back; every other key belongs to it. While its own
|
|
323
|
+
* task list is open, back keys belong to that list, which returns to the chat.
|
|
324
|
+
*/
|
|
322
325
|
handleTranscriptInput(data, transcript) {
|
|
323
|
-
if (
|
|
326
|
+
if (!transcript.handlesBack() &&
|
|
327
|
+
(matchesKey(data, "escape") || (matchesKey(data, "left") && !transcript.hasDraft()))) {
|
|
324
328
|
this.closeTranscript();
|
|
325
329
|
this.detailGeneration++;
|
|
326
330
|
this.scroll = 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-inspector.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/task-inspector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAEN,cAAc,EACd,KAAK,EACL,UAAU,EACV,IAAI,EACJ,eAAe,EACf,YAAY,GACZ,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAuB,MAAM,yCAAyC,CAAC;AACnG,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EACN,UAAU,EAEV,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAwB,gBAAgB,EAAE,MAAM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AAE,eAAe,CAAC,KAAK,aAAa,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;oBACvG,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,CAAC,KAAK,eAAe,CAAC,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;iBAChG,CAAC;YACH,CAAC,CAAC;SACF,CAAC,CAAC;IACJ,CAAC;CACD","sourcesContent":["import { stripVTControlCharacters } from \"node:util\";\nimport {\n\ttype Component,\n\tgetKeybindings,\n\tInput,\n\tmatchesKey,\n\tText,\n\ttruncateToWidth,\n\tvisibleWidth,\n} from \"@earendil-works/pi-tui\";\nimport type { KeybindingsManager } from \"../../../core/keybindings.ts\";\nimport type { PromptRoute, TaskId } from \"../../../core/tasks/contracts.js\";\nimport { OwnerTaskStore } from \"../../../core/tasks/owner-store.js\";\nimport { ownerTaskViewSource, type TaskViewSource } from \"../../../core/tasks/task-view-source.js\";\nimport { theme } from \"../theme/theme.js\";\nimport { parseWheelReport } from \"./chat-transcript.js\";\nimport { renderExtensionStatusRow } from \"./footer.ts\";\nimport { keyHintIfBound, keyText } from \"./keybinding-hints.js\";\nimport {\n\tTaskDetail,\n\ttype TaskDetailContent,\n\ttaskDetailActions,\n\ttaskDetailLabels,\n\ttaskDetailSummary,\n} from \"./task-detail.js\";\nimport { type TaskListSection, taskListSections } from \"./task-list.js\";\nimport { TaskNavigation } from \"./task-navigation.js\";\nimport { taskDisplayText, taskLabel, taskMetricsText, taskModelText, taskStatusAppearance } from \"./task-row.js\";\nimport {\n\tTaskAgentTranscriptPage,\n\tTaskCommandOutputPage,\n\ttype TaskTranscriptEnvironment,\n\ttype TaskTranscriptPage,\n} from \"./task-transcript-page.ts\";\n\nconst DETAIL_WHEEL_ROWS = 4;\n\n/** The host owns thinking display; only its default physical key, as a remap may reuse an editor key. */\nfunction isHostThinkingToggle(data: string): boolean {\n\treturn matchesKey(data, \"ctrl+t\") && getKeybindings().matches(data, \"app.thinking.toggle\");\n}\n\n/** Focused view only. The task source and original session remain the authorities. */\nexport class TaskInspector implements Component {\n\treadonly navigation: TaskNavigation;\n\tprivate actionIndex = 0;\n\tprivate confirmation?: (answer: boolean) => void;\n\t/** The open transcript of the selected task, on the shared chat stack. */\n\tprivate transcript?: TaskTranscriptPage;\n\tprivate status = \"\";\n\t/** Why the last stop did not reach its task; shown under the list until the next key. */\n\t/** A failure shown once on the task pages, until the next key. */\n\tprivate failureNotice = \"\";\n\tprivate scroll = 0;\n\tprivate detailContent: Omit<TaskDetailContent, \"stdinAvailable\"> = {};\n\tprivate detailTaskId?: TaskId;\n\tprivate detailGeneration = 0;\n\tprivate disposed = false;\n\tprivate statusWatch?: { taskId: TaskId; release: () => void };\n\tprivate readonly input = new Input();\n\tprivate readonly unsubscribe: () => void;\n\tprivate readonly transcriptEnvironment: () => TaskTranscriptEnvironment | undefined;\n\tconstructor(\n\t\tprivateStore: OwnerTaskStore | TaskViewSource,\n\t\tprivateRender: () => void,\n\t\tprivateClose: () => void,\n\t\topenQuestion?: (route: PromptRoute) => void,\n\t\ttranscriptEnvironment: () => TaskTranscriptEnvironment | undefined = () => undefined,\n\t) {\n\t\tthis.store = privateStore instanceof OwnerTaskStore ? ownerTaskViewSource(privateStore) : privateStore;\n\t\tthis.requestRender = privateRender;\n\t\tthis.close = privateClose;\n\t\tthis.transcriptEnvironment = transcriptEnvironment;\n\t\tthis.navigation = new TaskNavigation(getKeybindings() as KeybindingsManager, {\n\t\t\tinspect: () => {\n\t\t\t\tthis.closeTranscript();\n\t\t\t\tthis.actionIndex = 0;\n\t\t\t\tthis.scroll = 0;\n\t\t\t\tvoid this.loadDetail();\n\t\t\t},\n\t\t\ttranscript: () => {\n\t\t\t\tthis.detailGeneration++;\n\t\t\t\tthis.openTranscript();\n\t\t\t},\n\t\t\tforeground: (task) => {\n\t\t\t\tvoid this.store.foregroundTask(task.ref.taskId).then((result) => {\n\t\t\t\t\tthis.status = result.ok ? result.value.kind : result.error.message;\n\t\t\t\t\tthis.requestRender();\n\t\t\t\t});\n\t\t\t},\n\t\t\tconfirmCancel: () =>\n\t\t\t\tnew Promise<boolean>((resolve) => {\n\t\t\t\t\tthis.confirmation = resolve;\n\t\t\t\t\tthis.requestRender();\n\t\t\t\t}),\n\t\t\tcancel: (task) => {\n\t\t\t\tvoid this.store.cancelTask(task.ref.taskId).then((result) => {\n\t\t\t\t\t// A stop that did not reach the task says so, instead of leaving it looking untouched.\n\t\t\t\t\tthis.failureNotice = result.ok ? \"\" : `Could not stop the task: ${result.error.message}`;\n\t\t\t\t\tthis.requestRender();\n\t\t\t\t});\n\t\t\t},\n\t\t\tstdinAvailable: (task) => this.store.stdinAvailable(task.ref.taskId),\n\t\t\tinput: () => {\n\t\t\t\tthis.input.setValue(\"\");\n\t\t\t},\n\t\t\topenQuestion: (route) => {\n\t\t\t\tif (openQuestion) {\n\t\t\t\t\tthis.close();\n\t\t\t\t\topenQuestion(route);\n\t\t\t\t} else this.status = \"Question is available in its owning session.\";\n\t\t\t},\n\t\t});\n\t\tthis.unsubscribe = this.store.subscribe(() => {\n\t\t\tthis.navigation.update(this.orderedSections().flatMap((section) => section.tasks));\n\t\t\tif (this.transcript) this.transcript.refresh();\n\t\t\telse if (this.navigation.focus.kind === \"detail\") void this.loadDetail();\n\t\t\tthis.requestRender();\n\t\t});\n\t\tthis.navigation.update(this.orderedSections().flatMap((section) => section.tasks));\n\t\tthis.navigation.open();\n\t\tthis.input.onSubmit = (text) => {\n\t\t\tvoid this.sendInput(text);\n\t\t};\n\t}\n\tprivate readonly store: TaskViewSource;\n\tprivate readonly requestRender: () => void;\n\tprivate readonly close: () => void;\n\topen(id?: TaskId): void {\n\t\tthis.navigation.open(id);\n\t}\n\tprivate orderedSections(): TaskListSection[] {\n\t\treturn taskListSections(this.store.backgroundTasks, this.store.settlementOrder);\n\t}\n\tdispose(): void {\n\t\tthis.disposed = true;\n\t\tthis.releaseStatusWatch();\n\t\tthis.closeTranscript();\n\t\tthis.confirmation?.(false);\n\t\tthis.unsubscribe();\n\t}\n\tinvalidate(): void {\n\t\tthis.transcript?.invalidate();\n\t}\n\tprivate selected() {\n\t\treturn this.store.backgroundTasks.find((task) => task.ref.taskId === this.navigation.selectedTaskId);\n\t}\n\tprivate stdinAvailable(): boolean {\n\t\tconst task = this.selected();\n\t\tif (!task || task.execution.kind === \"settled\") return false;\n\t\treturn this.store.stdinAvailable(task.ref.taskId);\n\t}\n\tprivate async sendInput(text: string): Promise<void> {\n\t\tconst task = this.selected();\n\t\tif (!task) return;\n\t\tconst result = await this.store.writeTaskInput(task.ref.taskId, text);\n\t\tthis.status = result.ok ? `Sent ${result.value.acceptedBytes} bytes` : result.error.message;\n\t\tthis.input.setValue(\"\");\n\t\tthis.requestRender();\n\t}\n\tprivate releaseStatusWatch(): void {\n\t\tthis.statusWatch?.release();\n\t\tthis.statusWatch = undefined;\n\t}\n\t/**\n\t * The selected task's own extension statuses, as the row under its fullscreen page's footer. The\n\t * compact picker and confirmation page show none. A write repaints the page while it is shown.\n\t */\n\tprivate taskStatusRows(width: number): string[] {\n\t\tconst task = this.navigation.focus.kind === \"detail\" && !this.confirmation ? this.selected() : undefined;\n\t\tif (task?.kind !== \"agent\") {\n\t\t\tthis.releaseStatusWatch();\n\t\t\treturn [];\n\t\t}\n\t\tif (this.statusWatch?.taskId !== task.ref.taskId) {\n\t\t\tthis.releaseStatusWatch();\n\t\t\tthis.statusWatch = {\n\t\t\t\ttaskId: task.ref.taskId,\n\t\t\t\trelease: this.store.watchExtensionStatuses(task.ref.taskId, () => this.requestRender()),\n\t\t\t};\n\t\t}\n\t\tconst row = renderExtensionStatusRow(this.store.extensionStatuses(task.ref.taskId), width);\n\t\treturn row === undefined ? [] : [row];\n\t}\n\t/** Opens the selected task's transcript: an agent's chat or a shell's retained output, on the shared stack. */\n\tprivate openTranscript(): void {\n\t\tthis.closeTranscript();\n\t\tconst task = this.selected();\n\t\tif (!task) return;\n\t\tconst environment = this.transcriptEnvironment();\n\t\tif (task.kind === \"command\") {\n\t\t\tconst taskId = task.ref.taskId;\n\t\t\tconst byteCount = () =>\n\t\t\t\tBigInt(this.store.tasks.find((candidate) => candidate.ref.taskId === taskId)?.output.byteCount ?? \"0\");\n\t\t\tthis.transcript = new TaskCommandOutputPage(this.store, taskId, byteCount, environment, this.requestRender);\n\t\t} else if (environment === undefined) {\n\t\t\tthis.status = \"Transcript inspection is unavailable in this host.\";\n\t\t\tthis.requestRender();\n\t\t\treturn;\n\t\t} else\n\t\t\tthis.transcript = new TaskAgentTranscriptPage(\n\t\t\t\tthis.store,\n\t\t\t\ttask.ref.taskId,\n\t\t\t\tenvironment,\n\t\t\t\tthis.requestRender,\n\t\t\t\t(reason) => this.reportLate(reason, environment),\n\t\t\t);\n\t\tthis.requestRender();\n\t\tvoid this.transcript.load();\n\t}\n\t/** A transcript's message failed after the reader left it: on the task pages if they are open, else through the host. */\n\tprivate reportLate(reason: string, environment: TaskTranscriptEnvironment): void {\n\t\tif (this.disposed) {\n\t\t\tenvironment.notify?.(reason);\n\t\t\treturn;\n\t\t}\n\t\tthis.failureNotice = reason;\n\t\tthis.requestRender();\n\t}\n\tprivate closeTranscript(): void {\n\t\tthis.transcript?.dispose();\n\t\tthis.transcript = undefined;\n\t}\n\tprivate async loadDetail(): Promise<void> {\n\t\tconst selectedId = this.selected()?.ref.taskId;\n\t\tif (selectedId !== this.detailTaskId) {\n\t\t\tthis.detailContent = {};\n\t\t\tthis.detailTaskId = selectedId;\n\t\t}\n\t\tthis.status = \"\";\n\t\tconst generation = ++this.detailGeneration;\n\t\tconst focus = this.navigation.focus;\n\t\tconst task = this.selected();\n\t\tif (!task) return;\n\t\tconst current = () =>\n\t\t\t!this.disposed &&\n\t\t\tgeneration === this.detailGeneration &&\n\t\t\tthis.navigation.focus === focus &&\n\t\t\tfocus.kind === \"detail\" &&\n\t\t\tthis.navigation.selectedTaskId === task.ref.taskId;\n\t\tconst read = this.store.taskDetailText(task.ref.taskId);\n\t\tconst own = read instanceof Promise ? await read : read;\n\t\tif (!current()) return;\n\t\tif (own.prompt !== undefined) this.detailContent.prompt = own.prompt;\n\t\tif (own.output !== undefined) this.detailContent.output = own.output;\n\t\tif (task.kind === \"command\") {\n\t\t\ttry {\n\t\t\t\tconst count = BigInt(task.output.byteCount);\n\t\t\t\tconst output = await this.store.readTaskOutput(task.ref.taskId, {\n\t\t\t\t\tstart: String(count > 8192n ? count - 8192n : 0n),\n\t\t\t\t\tmaximumBytes: 8192,\n\t\t\t\t});\n\t\t\t\tif (!current()) return;\n\t\t\t\tif (output.ok) {\n\t\t\t\t\tthis.detailContent.output = output.value.text;\n\t\t\t\t\tthis.detailContent.outputOmitted = count > 8192n || output.value.omitted;\n\t\t\t\t} else this.status = output.error.message;\n\t\t\t} catch {\n\t\t\t\tif (!current()) return;\n\t\t\t\tthis.status = \"Command output unavailable\";\n\t\t\t}\n\t\t}\n\t\tif (current()) this.requestRender();\n\t}\n\t/** Every key belongs to the inspector except the host's thinking toggle when it leaves that alone. */\n\thandleInput(data: string): boolean {\n\t\treturn this.route(data) || !isHostThinkingToggle(data);\n\t}\n\tprivate route(data: string): boolean {\n\t\tthis.failureNotice = \"\";\n\t\tif (this.confirmation) {\n\t\t\tif (data === \"y\" || data === \"n\" || matchesKey(data, \"escape\")) {\n\t\t\t\tconst answer = this.confirmation;\n\t\t\t\tthis.confirmation = undefined;\n\t\t\t\tanswer(data === \"y\");\n\t\t\t}\n\t\t\tthis.requestRender();\n\t\t\treturn true;\n\t\t}\n\t\tif (this.transcript) return this.handleTranscriptInput(data, this.transcript);\n\t\tconst wheel = parseWheelReport(data);\n\t\tif (wheel !== undefined) {\n\t\t\tif (this.navigation.focus.kind === \"tasks\") this.navigation.moveSelection(wheel.direction);\n\t\t\telse if (this.navigation.focus.kind === \"detail\")\n\t\t\t\tthis.scroll = Math.max(0, this.scroll + wheel.direction * DETAIL_WHEEL_ROWS);\n\t\t\tthis.requestRender();\n\t\t\treturn true;\n\t\t}\n\t\t// Mouse reports are never text input, including horizontal wheel/release.\n\t\tif (/^\\x1b\\[<\\d+;\\d+;\\d+[mM]$/.test(data) || data.startsWith(\"\\x1b[M\")) return true;\n\t\tif (\n\t\t\tmatchesKey(data, \"escape\") ||\n\t\t\t(matchesKey(data, \"left\") && this.navigation.focus.kind !== \"stdin\" && !this.configuredTaskKey(data))\n\t\t) {\n\t\t\tthis.navigation.handleInput(\"\\x1b\", \"tasks\");\n\t\t\tif (this.navigation.focus.kind === \"composer\") this.close();\n\t\t\tthis.requestRender();\n\t\t\treturn true;\n\t\t}\n\t\tif (this.navigation.focus.kind === \"stdin\") {\n\t\t\tthis.input.handleInput(data);\n\t\t\tthis.requestRender();\n\t\t\treturn true;\n\t\t}\n\t\tif (data === \"x\" && this.navigation.focus.kind === \"detail\" && !this.configuredTaskKey(data)) {\n\t\t\tvoid this.navigation.activate(\"cancel\");\n\t\t\treturn true;\n\t\t}\n\t\tconst task = this.selected();\n\t\tif (task && this.navigation.focus.kind === \"detail\") {\n\t\t\tconst actions = taskDetailActions(task.execution, task.attention, this.stdinAvailable());\n\t\t\tif (this.configuredTaskKey(data)) {\n\t\t\t\tif (getKeybindings().matches(data, \"app.tasks.inspect\"))\n\t\t\t\t\tvoid this.navigation.activate(actions[Math.min(this.actionIndex, actions.length - 1)]);\n\t\t\t\telse this.navigation.handleInput(data, \"tasks\");\n\t\t\t\tthis.requestRender();\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (matchesKey(data, \"pageUp\") || matchesKey(data, \"pageDown\")) {\n\t\t\t\tthis.scroll = Math.max(0, this.scroll + (matchesKey(data, \"pageUp\") ? -5 : 5));\n\t\t\t\tthis.requestRender();\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (matchesKey(data, \"up\")) this.actionIndex = Math.max(0, this.actionIndex - 1);\n\t\t\telse if (matchesKey(data, \"down\")) this.actionIndex = Math.min(actions.length - 1, this.actionIndex + 1);\n\t\t\telse if (getKeybindings().matches(data, \"app.tasks.inspect\"))\n\t\t\t\tvoid this.navigation.activate(actions[Math.min(this.actionIndex, actions.length - 1)]);\n\t\t\telse if (!this.navigation.handleInput(data, \"tasks\")) return false;\n\t\t} else if (!this.navigation.handleInput(data, \"tasks\")) return false;\n\t\tthis.requestRender();\n\t\treturn true;\n\t}\n\t/** A transcript is a chat: Escape, or Left with nothing typed, goes back; every other key belongs to it. */\n\tprivate handleTranscriptInput(data: string, transcript: TaskTranscriptPage): boolean {\n\t\tif (matchesKey(data, \"escape\") || (matchesKey(data, \"left\") && !transcript.hasDraft())) {\n\t\t\tthis.closeTranscript();\n\t\t\tthis.detailGeneration++;\n\t\t\tthis.scroll = 0;\n\t\t\tvoid this.loadDetail();\n\t\t\tthis.requestRender();\n\t\t\treturn true;\n\t\t}\n\t\treturn transcript.handleInput(data);\n\t}\n\tprivate configuredTaskKey(data: string): boolean {\n\t\treturn ([\"app.tasks.inspect\", \"app.tasks.foreground\", \"app.tasks.cancel\", \"app.tasks.input\"] as const).some(\n\t\t\t(key) => getKeybindings().matches(data, key),\n\t\t);\n\t}\n\t/** Only the task picker stays inline; drill-down and confirmation own the screen. */\n\tget fullscreen(): boolean {\n\t\treturn (\n\t\t\tthis.confirmation !== undefined ||\n\t\t\tthis.navigation.focus.kind === \"detail\" ||\n\t\t\tthis.navigation.focus.kind === \"stdin\"\n\t\t);\n\t}\n\trenderPicker(width: number, availableRows: number): string[] {\n\t\treturn this.renderViewport(width, Math.max(1, Math.min(12, availableRows)));\n\t}\n\trender(width: number): string[] {\n\t\treturn this.renderViewport(width, Math.max(3, (process.stdout.rows || 24) - 5));\n\t}\n\tprivate renderTranscriptPage(width: number, budget: number, transcript: TaskTranscriptPage): string[] {\n\t\tconst task = this.selected();\n\t\tconst fitWidth = (line: string) => truncateToWidth(line, Math.max(1, width));\n\t\tconst header = [\n\t\t\ttheme.bold(`Transcript · ${task ? taskDisplayText(taskLabel(task)) : \"Task\"}`),\n\t\t\ttask ? taskDetailSummary(task) : \"\",\n\t\t\ttheme.fg(\"borderMuted\", \"─\".repeat(Math.max(0, width))),\n\t\t].map(fitWidth);\n\t\tconst notes = [transcript.status, this.status].filter(Boolean).join(\" · \");\n\t\tconst hints = [\n\t\t\t\"Esc back\",\n\t\t\ttask?.kind === \"agent\" && this.store.sendTaskMessage !== undefined ? \"Enter messages the agent\" : \"\",\n\t\t\t`${keyText(\"tui.altScreen.top\")}/${keyText(\"tui.altScreen.bottom\")} top/latest`,\n\t\t]\n\t\t\t.filter(Boolean)\n\t\t\t.join(\" · \");\n\t\tconst footer = [...(notes ? [notes] : []), hints].map((line) => fitWidth(theme.fg(\"dim\", line)));\n\t\tconst failure = this.failureNotice ? [fitWidth(theme.fg(\"warning\", this.failureNotice))] : [];\n\t\tconst statusRows = this.taskStatusRows(width);\n\t\tconst room = Math.max(1, budget - header.length - footer.length - failure.length - statusRows.length);\n\t\tconst body = transcript.render(width, room);\n\t\treturn [\n\t\t\t...header,\n\t\t\t...body,\n\t\t\t...Array.from({ length: Math.max(0, room - body.length) }, () => \"\"),\n\t\t\t...footer,\n\t\t\t...failure,\n\t\t\t...statusRows,\n\t\t].slice(0, Math.max(1, budget));\n\t}\n\trenderViewport(width: number, budget: number): string[] {\n\t\tif (this.transcript && !this.confirmation && this.navigation.focus.kind === \"detail\")\n\t\t\treturn this.renderTranscriptPage(width, budget, this.transcript);\n\t\tconst framed = width >= 20 && budget >= 7;\n\t\tconst inner = Math.max(1, width - (framed ? 4 : 0));\n\t\tconst current = this.selected();\n\t\tconst detail = this.navigation.focus.kind === \"detail\";\n\t\tconst selectingAction = current && detail && !this.transcript && !this.confirmation;\n\t\tconst actions = selectingAction\n\t\t\t? taskDetailActions(current.execution, current.attention, this.stdinAvailable())\n\t\t\t: [];\n\t\tthis.actionIndex = Math.max(0, Math.min(this.actionIndex, actions.length - 1));\n\t\tconst action = actions[this.actionIndex];\n\t\tconst actionRow = action ? [theme.fg(\"accent\", `› ${taskDetailLabels[action]}`)] : [];\n\t\tconst rows = this.renderAll(inner);\n\t\tconst compactSummary = !framed && detail && current && budget >= 4 ? [taskDetailSummary(current)] : [];\n\t\tconst statusRows = this.taskStatusRows(width);\n\t\tconst height = Math.max(\n\t\t\t0,\n\t\t\tbudget - (framed ? 4 : 1) - actionRow.length - compactSummary.length - statusRows.length,\n\t\t);\n\t\tconst selected = detail ? -1 : rows.findIndex((row) => stripVTControlCharacters(row).startsWith(\"›\"));\n\t\tthis.scroll = Math.min(this.scroll, Math.max(0, rows.length - height));\n\t\tconst selectionRows = Math.min(height, current?.kind === \"agent\" ? 3 : 2);\n\t\tconst offset = detail ? this.scroll : Math.max(0, selected + selectionRows - height);\n\t\tconst view = rows.slice(offset, offset + height);\n\t\tconst inspect = keyHintIfBound(\"app.tasks.inspect\", detail ? \"select\" : \"view\");\n\t\tconst hints = this.confirmation\n\t\t\t? \"y confirm · n/Esc keep running\"\n\t\t\t: this.navigation.focus.kind === \"stdin\"\n\t\t\t\t? \"Enter send · Esc back\"\n\t\t\t\t: [\n\t\t\t\t\t\tdetail ? \"PgUp/PgDn scroll · ↑↓ actions\" : \"↑↓ select\",\n\t\t\t\t\t\tinspect,\n\t\t\t\t\t\tcurrent && current.execution.kind !== \"settled\"\n\t\t\t\t\t\t\t? keyHintIfBound(\"app.tasks.cancel\", \"stop\") ||\n\t\t\t\t\t\t\t\t(detail && !this.configuredTaskKey(\"x\") ? \"x stop\" : \"\")\n\t\t\t\t\t\t\t: \"\",\n\t\t\t\t\t\t\"Esc back\",\n\t\t\t\t\t]\n\t\t\t\t\t\t.filter(Boolean)\n\t\t\t\t\t\t.join(\" · \");\n\t\tconst footer = theme.fg(\"dim\", truncateToWidth(`/tasks · ${hints}`, width));\n\t\tconst failure = this.failureNotice ? [theme.fg(\"warning\", truncateToWidth(this.failureNotice, width))] : [];\n\t\tif (!framed)\n\t\t\treturn [...compactSummary, ...view, ...actionRow, footer, ...failure, ...statusRows]\n\t\t\t\t.map((line) => truncateToWidth(line, width))\n\t\t\t\t.slice(-Math.max(1, budget));\n\t\tconst live = this.store.backgroundTasks.filter((task) => task.execution.kind !== \"settled\").length;\n\t\tconst title =\n\t\t\tdetail && current\n\t\t\t\t? `${taskDisplayText(taskLabel(current))} › ${taskDisplayText(current.title)}`\n\t\t\t\t: \"Background tasks\";\n\t\tconst heading = ` ${truncateToWidth(title, Math.max(1, width - 5))} `;\n\t\tconst border = (text: string) => theme.fg(\"borderMuted\", text);\n\t\tconst frameRow = (line: string) => {\n\t\t\tconst text = truncateToWidth(line, inner);\n\t\t\treturn border(\"│ \") + text + \" \".repeat(Math.max(0, inner - visibleWidth(text))) + border(\" │\");\n\t\t};\n\t\treturn [\n\t\t\tborder(\"╭─\") + theme.bold(heading) + border(`${\"─\".repeat(Math.max(0, width - visibleWidth(heading) - 3))}╮`),\n\t\t\tframeRow(\n\t\t\t\tdetail && current\n\t\t\t\t\t? taskDetailSummary(current)\n\t\t\t\t\t: theme.fg(\"muted\", `${live} active · ${this.store.backgroundTasks.length} total`),\n\t\t\t),\n\t\t\t...view.map(frameRow),\n\t\t\t...actionRow.map(frameRow),\n\t\t\tborder(`╰${\"─\".repeat(Math.max(0, width - 2))}╯`),\n\t\t\tfooter,\n\t\t\t...failure,\n\t\t\t...statusRows,\n\t\t].map((line) => truncateToWidth(line, width));\n\t}\n\tprivate renderAll(width: number): string[] {\n\t\tconst task = this.selected();\n\t\tif (this.confirmation)\n\t\t\treturn new Text(\n\t\t\t\t`Cancel ${task?.title}\\nTask ${task?.ref.taskId}\\ny: confirm · n/Escape: keep running`,\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t).render(width);\n\t\tif (this.navigation.focus.kind === \"stdin\")\n\t\t\treturn [`Input to ${task?.title} · Escape: tasks`, ...this.input.render(width), this.status];\n\t\tif (task && this.navigation.focus.kind === \"detail\") {\n\t\t\treturn [\n\t\t\t\t...new TaskDetail(task, {\n\t\t\t\t\t...this.detailContent,\n\t\t\t\t\tstdinAvailable: this.stdinAvailable(),\n\t\t\t\t\tactivity: this.store.recentActivity(task.ref.taskId),\n\t\t\t\t\tactivityOmitted: this.store.activityOmitted(task.ref.taskId),\n\t\t\t\t}).renderContent(width),\n\t\t\t\tthis.status,\n\t\t\t];\n\t\t}\n\t\tconst sections = this.orderedSections();\n\t\tif (!sections.length)\n\t\t\treturn new Text(\"No background tasks.\\nBackground agents and shells will appear here.\", 0, 0).render(width);\n\t\treturn sections.flatMap((section) => [\n\t\t\t\"\",\n\t\t\ttheme.fg(\"muted\", theme.bold(`${section.title} (${section.tasks.length})`)),\n\t\t\t...section.tasks.flatMap((item) => {\n\t\t\t\tconst selected = item.ref.taskId === this.navigation.selectedTaskId;\n\t\t\t\tconst { label: state, color, icon } = taskStatusAppearance(item);\n\t\t\t\tconst status = width < 32 ? ` ${icon}` : ` ${icon} ${state}`;\n\t\t\t\tconst name = taskDisplayText(item.title || taskLabel(item));\n\t\t\t\tconst marker = selected ? \"› \" : \" \";\n\t\t\t\tconst title = marker + truncateToWidth(name, Math.max(1, width - visibleWidth(status) - 3));\n\t\t\t\tconst row = `${selected ? theme.fg(\"accent\", theme.bold(title)) : title}${\" \".repeat(Math.max(1, width - visibleWidth(title) - visibleWidth(status)))}${theme.fg(color, status)}`;\n\t\t\t\tconst metadata = [\n\t\t\t\t\t...(width < 32 ? [state] : []),\n\t\t\t\t\ttaskLabel(item),\n\t\t\t\t\ttaskMetricsText(item),\n\t\t\t\t\titem.currentAction ? `${item.currentAction.tool} ${item.currentAction.text}` : \"\",\n\t\t\t\t]\n\t\t\t\t\t.filter(Boolean)\n\t\t\t\t\t.join(\" · \");\n\t\t\t\treturn [\n\t\t\t\t\ttruncateToWidth(row, width),\n\t\t\t\t\t...(item.kind === \"agent\" ? [theme.fg(\"dim\", truncateToWidth(` ${taskModelText(item)}`, width))] : []),\n\t\t\t\t\t...(selected ? [theme.fg(\"dim\", truncateToWidth(` ${taskDisplayText(metadata)}`, width))] : []),\n\t\t\t\t];\n\t\t\t}),\n\t\t]);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"task-inspector.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/task-inspector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAEN,cAAc,EACd,KAAK,EACL,UAAU,EACV,IAAI,EACJ,eAAe,EACf,YAAY,GACZ,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAuB,MAAM,yCAAyC,CAAC;AACnG,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EACN,UAAU,EAEV,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAwB,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,eAAe,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACjH,OAAO,EACN,uBAAuB,EACvB,qBAAqB,GAGrB,MAAM,2BAA2B,CAAC;AAEnC,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAE5B,yGAAyG;AACzG,SAAS,oBAAoB,CAAC,IAAY;IACzC,OAAO,UAAU,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,cAAc,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,qBAAqB,CAAC,CAAC;AAC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} from \"node:util\";\nimport {\n\ttype Component,\n\tgetKeybindings,\n\tInput,\n\tmatchesKey,\n\tText,\n\ttruncateToWidth,\n\tvisibleWidth,\n} from \"@earendil-works/pi-tui\";\nimport type { KeybindingsManager } from \"../../../core/keybindings.ts\";\nimport type { PromptRoute, TaskId } from \"../../../core/tasks/contracts.js\";\nimport { OwnerTaskStore } from \"../../../core/tasks/owner-store.js\";\nimport { ownerTaskViewSource, type TaskViewSource } from \"../../../core/tasks/task-view-source.js\";\nimport { theme } from \"../theme/theme.js\";\nimport { parseWheelReport } from \"./chat-transcript.js\";\nimport { renderExtensionStatusRow } from \"./footer.ts\";\nimport { keyHintIfBound, keyText } from \"./keybinding-hints.js\";\nimport {\n\tTaskDetail,\n\ttype TaskDetailContent,\n\ttaskDetailActions,\n\ttaskDetailLabels,\n\ttaskDetailSummary,\n} from \"./task-detail.js\";\nimport { type TaskListSection, taskListSections } from \"./task-list.js\";\nimport { TaskNavigation } from \"./task-navigation.js\";\nimport { taskDisplayText, taskLabel, taskMetricsText, taskModelText, taskStatusAppearance } from \"./task-row.js\";\nimport {\n\tTaskAgentTranscriptPage,\n\tTaskCommandOutputPage,\n\ttype TaskTranscriptEnvironment,\n\ttype TaskTranscriptPage,\n} from \"./task-transcript-page.ts\";\n\nconst DETAIL_WHEEL_ROWS = 4;\n\n/** The host owns thinking display; only its default physical key, as a remap may reuse an editor key. */\nfunction isHostThinkingToggle(data: string): boolean {\n\treturn matchesKey(data, \"ctrl+t\") && getKeybindings().matches(data, \"app.thinking.toggle\");\n}\n\n/** Focused view only. The task source and original session remain the authorities. */\nexport class TaskInspector implements Component {\n\treadonly navigation: TaskNavigation;\n\tprivate actionIndex = 0;\n\tprivate confirmation?: (answer: boolean) => void;\n\t/** The open transcript of the selected task, on the shared chat stack. */\n\tprivate transcript?: TaskTranscriptPage;\n\tprivate status = \"\";\n\t/** Why the last stop did not reach its task; shown under the list until the next key. */\n\t/** A failure shown once on the task pages, until the next key. */\n\tprivate failureNotice = \"\";\n\tprivate scroll = 0;\n\tprivate detailContent: Omit<TaskDetailContent, \"stdinAvailable\"> = {};\n\tprivate detailTaskId?: TaskId;\n\tprivate detailGeneration = 0;\n\tprivate disposed = false;\n\tprivate statusWatch?: { taskId: TaskId; release: () => void };\n\tprivate readonly input = new Input();\n\tprivate readonly unsubscribe: () => void;\n\tprivate readonly transcriptEnvironment: () => TaskTranscriptEnvironment | undefined;\n\tconstructor(\n\t\tprivateStore: OwnerTaskStore | TaskViewSource,\n\t\tprivateRender: () => void,\n\t\tprivateClose: () => void,\n\t\topenQuestion?: (route: PromptRoute) => void,\n\t\ttranscriptEnvironment: () => TaskTranscriptEnvironment | undefined = () => undefined,\n\t) {\n\t\tthis.store = privateStore instanceof OwnerTaskStore ? ownerTaskViewSource(privateStore) : privateStore;\n\t\tthis.requestRender = privateRender;\n\t\tthis.close = privateClose;\n\t\tthis.transcriptEnvironment = transcriptEnvironment;\n\t\tthis.navigation = new TaskNavigation(getKeybindings() as KeybindingsManager, {\n\t\t\tinspect: () => {\n\t\t\t\tthis.closeTranscript();\n\t\t\t\tthis.actionIndex = 0;\n\t\t\t\tthis.scroll = 0;\n\t\t\t\tvoid this.loadDetail();\n\t\t\t},\n\t\t\ttranscript: () => {\n\t\t\t\tthis.detailGeneration++;\n\t\t\t\tthis.openTranscript();\n\t\t\t},\n\t\t\tforeground: (task) => {\n\t\t\t\tvoid this.store.foregroundTask(task.ref.taskId).then((result) => {\n\t\t\t\t\tthis.status = result.ok ? result.value.kind : result.error.message;\n\t\t\t\t\tthis.requestRender();\n\t\t\t\t});\n\t\t\t},\n\t\t\tconfirmCancel: () =>\n\t\t\t\tnew Promise<boolean>((resolve) => {\n\t\t\t\t\tthis.confirmation = resolve;\n\t\t\t\t\tthis.requestRender();\n\t\t\t\t}),\n\t\t\tcancel: (task) => {\n\t\t\t\tvoid this.store.cancelTask(task.ref.taskId).then((result) => {\n\t\t\t\t\t// A stop that did not reach the task says so, instead of leaving it looking untouched.\n\t\t\t\t\tthis.failureNotice = result.ok ? \"\" : `Could not stop the task: ${result.error.message}`;\n\t\t\t\t\tthis.requestRender();\n\t\t\t\t});\n\t\t\t},\n\t\t\tstdinAvailable: (task) => this.store.stdinAvailable(task.ref.taskId),\n\t\t\tinput: () => {\n\t\t\t\tthis.input.setValue(\"\");\n\t\t\t},\n\t\t\topenQuestion: (route) => {\n\t\t\t\tif (openQuestion) {\n\t\t\t\t\tthis.close();\n\t\t\t\t\topenQuestion(route);\n\t\t\t\t} else this.status = \"Question is available in its owning session.\";\n\t\t\t},\n\t\t});\n\t\tthis.unsubscribe = this.store.subscribe(() => {\n\t\t\tthis.navigation.update(this.orderedSections().flatMap((section) => section.tasks));\n\t\t\tif (this.transcript) this.transcript.refresh();\n\t\t\telse if (this.navigation.focus.kind === \"detail\") void this.loadDetail();\n\t\t\tthis.requestRender();\n\t\t});\n\t\tthis.navigation.update(this.orderedSections().flatMap((section) => section.tasks));\n\t\tthis.navigation.open();\n\t\tthis.input.onSubmit = (text) => {\n\t\t\tvoid this.sendInput(text);\n\t\t};\n\t}\n\tprivate readonly store: TaskViewSource;\n\tprivate readonly requestRender: () => void;\n\tprivate readonly close: () => void;\n\topen(id?: TaskId): void {\n\t\tthis.navigation.open(id);\n\t}\n\tprivate orderedSections(): TaskListSection[] {\n\t\treturn taskListSections(this.store.backgroundTasks, this.store.settlementOrder);\n\t}\n\tdispose(): void {\n\t\tthis.disposed = true;\n\t\tthis.releaseStatusWatch();\n\t\tthis.closeTranscript();\n\t\tthis.confirmation?.(false);\n\t\tthis.unsubscribe();\n\t}\n\tinvalidate(): void {\n\t\tthis.transcript?.invalidate();\n\t}\n\tprivate selected() {\n\t\treturn this.store.backgroundTasks.find((task) => task.ref.taskId === this.navigation.selectedTaskId);\n\t}\n\tprivate stdinAvailable(): boolean {\n\t\tconst task = this.selected();\n\t\tif (!task || task.execution.kind === \"settled\") return false;\n\t\treturn this.store.stdinAvailable(task.ref.taskId);\n\t}\n\tprivate async sendInput(text: string): Promise<void> {\n\t\tconst task = this.selected();\n\t\tif (!task) return;\n\t\tconst result = await this.store.writeTaskInput(task.ref.taskId, text);\n\t\tthis.status = result.ok ? `Sent ${result.value.acceptedBytes} bytes` : result.error.message;\n\t\tthis.input.setValue(\"\");\n\t\tthis.requestRender();\n\t}\n\tprivate releaseStatusWatch(): void {\n\t\tthis.statusWatch?.release();\n\t\tthis.statusWatch = undefined;\n\t}\n\t/**\n\t * The selected task's own extension statuses, as the row under its fullscreen page's footer. The\n\t * compact picker and confirmation page show none. A write repaints the page while it is shown.\n\t */\n\tprivate taskStatusRows(width: number): string[] {\n\t\tconst task = this.navigation.focus.kind === \"detail\" && !this.confirmation ? this.selected() : undefined;\n\t\tif (task?.kind !== \"agent\") {\n\t\t\tthis.releaseStatusWatch();\n\t\t\treturn [];\n\t\t}\n\t\tif (this.statusWatch?.taskId !== task.ref.taskId) {\n\t\t\tthis.releaseStatusWatch();\n\t\t\tthis.statusWatch = {\n\t\t\t\ttaskId: task.ref.taskId,\n\t\t\t\trelease: this.store.watchExtensionStatuses(task.ref.taskId, () => this.requestRender()),\n\t\t\t};\n\t\t}\n\t\tconst row = renderExtensionStatusRow(this.store.extensionStatuses(task.ref.taskId), width);\n\t\treturn row === undefined ? [] : [row];\n\t}\n\t/** Opens the selected task's transcript: an agent's chat or a shell's retained output, on the shared stack. */\n\tprivate openTranscript(): void {\n\t\tthis.closeTranscript();\n\t\tconst task = this.selected();\n\t\tif (!task) return;\n\t\tconst environment = this.transcriptEnvironment();\n\t\tif (task.kind === \"command\") {\n\t\t\tconst taskId = task.ref.taskId;\n\t\t\tconst byteCount = () =>\n\t\t\t\tBigInt(this.store.tasks.find((candidate) => candidate.ref.taskId === taskId)?.output.byteCount ?? \"0\");\n\t\t\tthis.transcript = new TaskCommandOutputPage(this.store, taskId, byteCount, environment, this.requestRender);\n\t\t} else if (environment === undefined) {\n\t\t\tthis.status = \"Transcript inspection is unavailable in this host.\";\n\t\t\tthis.requestRender();\n\t\t\treturn;\n\t\t} else\n\t\t\tthis.transcript = new TaskAgentTranscriptPage(\n\t\t\t\tthis.store,\n\t\t\t\ttask.ref.taskId,\n\t\t\t\tenvironment,\n\t\t\t\tthis.requestRender,\n\t\t\t\t(reason) => this.reportLate(reason, environment),\n\t\t\t);\n\t\tthis.requestRender();\n\t\tvoid this.transcript.load();\n\t}\n\t/** A transcript's message failed after the reader left it: on the task pages if they are open, else through the host. */\n\tprivate reportLate(reason: string, environment: TaskTranscriptEnvironment): void {\n\t\tif (this.disposed) {\n\t\t\tenvironment.notify?.(reason);\n\t\t\treturn;\n\t\t}\n\t\tthis.failureNotice = reason;\n\t\tthis.requestRender();\n\t}\n\tprivate closeTranscript(): void {\n\t\tthis.transcript?.dispose();\n\t\tthis.transcript = undefined;\n\t}\n\tprivate async loadDetail(): Promise<void> {\n\t\tconst selectedId = this.selected()?.ref.taskId;\n\t\tif (selectedId !== this.detailTaskId) {\n\t\t\tthis.detailContent = {};\n\t\t\tthis.detailTaskId = selectedId;\n\t\t}\n\t\tthis.status = \"\";\n\t\tconst generation = ++this.detailGeneration;\n\t\tconst focus = this.navigation.focus;\n\t\tconst task = this.selected();\n\t\tif (!task) return;\n\t\tconst current = () =>\n\t\t\t!this.disposed &&\n\t\t\tgeneration === this.detailGeneration &&\n\t\t\tthis.navigation.focus === focus &&\n\t\t\tfocus.kind === \"detail\" &&\n\t\t\tthis.navigation.selectedTaskId === task.ref.taskId;\n\t\tconst read = this.store.taskDetailText(task.ref.taskId);\n\t\tconst own = read instanceof Promise ? await read : read;\n\t\tif (!current()) return;\n\t\tif (own.prompt !== undefined) this.detailContent.prompt = own.prompt;\n\t\tif (own.output !== undefined) this.detailContent.output = own.output;\n\t\tif (task.kind === \"command\") {\n\t\t\ttry {\n\t\t\t\tconst count = BigInt(task.output.byteCount);\n\t\t\t\tconst output = await this.store.readTaskOutput(task.ref.taskId, {\n\t\t\t\t\tstart: String(count > 8192n ? count - 8192n : 0n),\n\t\t\t\t\tmaximumBytes: 8192,\n\t\t\t\t});\n\t\t\t\tif (!current()) return;\n\t\t\t\tif (output.ok) {\n\t\t\t\t\tthis.detailContent.output = output.value.text;\n\t\t\t\t\tthis.detailContent.outputOmitted = count > 8192n || output.value.omitted;\n\t\t\t\t} else this.status = output.error.message;\n\t\t\t} catch {\n\t\t\t\tif (!current()) return;\n\t\t\t\tthis.status = \"Command output unavailable\";\n\t\t\t}\n\t\t}\n\t\tif (current()) this.requestRender();\n\t}\n\t/** Every key belongs to the inspector except the host's thinking toggle when it leaves that alone. */\n\thandleInput(data: string): boolean {\n\t\treturn this.route(data) || !isHostThinkingToggle(data);\n\t}\n\tprivate route(data: string): boolean {\n\t\tthis.failureNotice = \"\";\n\t\tif (this.confirmation) {\n\t\t\tif (data === \"y\" || data === \"n\" || matchesKey(data, \"escape\")) {\n\t\t\t\tconst answer = this.confirmation;\n\t\t\t\tthis.confirmation = undefined;\n\t\t\t\tanswer(data === \"y\");\n\t\t\t}\n\t\t\tthis.requestRender();\n\t\t\treturn true;\n\t\t}\n\t\tif (this.transcript) return this.handleTranscriptInput(data, this.transcript);\n\t\tconst wheel = parseWheelReport(data);\n\t\tif (wheel !== undefined) {\n\t\t\tif (this.navigation.focus.kind === \"tasks\") this.navigation.moveSelection(wheel.direction);\n\t\t\telse if (this.navigation.focus.kind === \"detail\")\n\t\t\t\tthis.scroll = Math.max(0, this.scroll + wheel.direction * DETAIL_WHEEL_ROWS);\n\t\t\tthis.requestRender();\n\t\t\treturn true;\n\t\t}\n\t\t// Mouse reports are never text input, including horizontal wheel/release.\n\t\tif (/^\\x1b\\[<\\d+;\\d+;\\d+[mM]$/.test(data) || data.startsWith(\"\\x1b[M\")) return true;\n\t\tif (\n\t\t\tmatchesKey(data, \"escape\") ||\n\t\t\t(matchesKey(data, \"left\") && this.navigation.focus.kind !== \"stdin\" && !this.configuredTaskKey(data))\n\t\t) {\n\t\t\tthis.navigation.handleInput(\"\\x1b\", \"tasks\");\n\t\t\tif (this.navigation.focus.kind === \"composer\") this.close();\n\t\t\tthis.requestRender();\n\t\t\treturn true;\n\t\t}\n\t\tif (this.navigation.focus.kind === \"stdin\") {\n\t\t\tthis.input.handleInput(data);\n\t\t\tthis.requestRender();\n\t\t\treturn true;\n\t\t}\n\t\tif (data === \"x\" && this.navigation.focus.kind === \"detail\" && !this.configuredTaskKey(data)) {\n\t\t\tvoid this.navigation.activate(\"cancel\");\n\t\t\treturn true;\n\t\t}\n\t\tconst task = this.selected();\n\t\tif (task && this.navigation.focus.kind === \"detail\") {\n\t\t\tconst actions = taskDetailActions(task.execution, task.attention, this.stdinAvailable());\n\t\t\tif (this.configuredTaskKey(data)) {\n\t\t\t\tif (getKeybindings().matches(data, \"app.tasks.inspect\"))\n\t\t\t\t\tvoid this.navigation.activate(actions[Math.min(this.actionIndex, actions.length - 1)]);\n\t\t\t\telse this.navigation.handleInput(data, \"tasks\");\n\t\t\t\tthis.requestRender();\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (matchesKey(data, \"pageUp\") || matchesKey(data, \"pageDown\")) {\n\t\t\t\tthis.scroll = Math.max(0, this.scroll + (matchesKey(data, \"pageUp\") ? -5 : 5));\n\t\t\t\tthis.requestRender();\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif (matchesKey(data, \"up\")) this.actionIndex = Math.max(0, this.actionIndex - 1);\n\t\t\telse if (matchesKey(data, \"down\")) this.actionIndex = Math.min(actions.length - 1, this.actionIndex + 1);\n\t\t\telse if (getKeybindings().matches(data, \"app.tasks.inspect\"))\n\t\t\t\tvoid this.navigation.activate(actions[Math.min(this.actionIndex, actions.length - 1)]);\n\t\t\telse if (!this.navigation.handleInput(data, \"tasks\")) return false;\n\t\t} else if (!this.navigation.handleInput(data, \"tasks\")) return false;\n\t\tthis.requestRender();\n\t\treturn true;\n\t}\n\t/**\n\t * A transcript is a chat: Escape, or Left with nothing typed, goes back; every other key belongs to it. While its own\n\t * task list is open, back keys belong to that list, which returns to the chat.\n\t */\n\tprivate handleTranscriptInput(data: string, transcript: TaskTranscriptPage): boolean {\n\t\tif (\n\t\t\t!transcript.handlesBack() &&\n\t\t\t(matchesKey(data, \"escape\") || (matchesKey(data, \"left\") && !transcript.hasDraft()))\n\t\t) {\n\t\t\tthis.closeTranscript();\n\t\t\tthis.detailGeneration++;\n\t\t\tthis.scroll = 0;\n\t\t\tvoid this.loadDetail();\n\t\t\tthis.requestRender();\n\t\t\treturn true;\n\t\t}\n\t\treturn transcript.handleInput(data);\n\t}\n\tprivate configuredTaskKey(data: string): boolean {\n\t\treturn ([\"app.tasks.inspect\", \"app.tasks.foreground\", \"app.tasks.cancel\", \"app.tasks.input\"] as const).some(\n\t\t\t(key) => getKeybindings().matches(data, key),\n\t\t);\n\t}\n\t/** Only the task picker stays inline; drill-down and confirmation own the screen. */\n\tget fullscreen(): boolean {\n\t\treturn (\n\t\t\tthis.confirmation !== undefined ||\n\t\t\tthis.navigation.focus.kind === \"detail\" ||\n\t\t\tthis.navigation.focus.kind === \"stdin\"\n\t\t);\n\t}\n\trenderPicker(width: number, availableRows: number): string[] {\n\t\treturn this.renderViewport(width, Math.max(1, Math.min(12, availableRows)));\n\t}\n\trender(width: number): string[] {\n\t\treturn this.renderViewport(width, Math.max(3, (process.stdout.rows || 24) - 5));\n\t}\n\tprivate renderTranscriptPage(width: number, budget: number, transcript: TaskTranscriptPage): string[] {\n\t\tconst task = this.selected();\n\t\tconst fitWidth = (line: string) => truncateToWidth(line, Math.max(1, width));\n\t\tconst header = [\n\t\t\ttheme.bold(`Transcript · ${task ? taskDisplayText(taskLabel(task)) : \"Task\"}`),\n\t\t\ttask ? taskDetailSummary(task) : \"\",\n\t\t\ttheme.fg(\"borderMuted\", \"─\".repeat(Math.max(0, width))),\n\t\t].map(fitWidth);\n\t\tconst notes = [transcript.status, this.status].filter(Boolean).join(\" · \");\n\t\tconst hints = [\n\t\t\t\"Esc back\",\n\t\t\ttask?.kind === \"agent\" && this.store.sendTaskMessage !== undefined ? \"Enter messages the agent\" : \"\",\n\t\t\t`${keyText(\"tui.altScreen.top\")}/${keyText(\"tui.altScreen.bottom\")} top/latest`,\n\t\t]\n\t\t\t.filter(Boolean)\n\t\t\t.join(\" · \");\n\t\tconst footer = [...(notes ? [notes] : []), hints].map((line) => fitWidth(theme.fg(\"dim\", line)));\n\t\tconst failure = this.failureNotice ? [fitWidth(theme.fg(\"warning\", this.failureNotice))] : [];\n\t\tconst statusRows = this.taskStatusRows(width);\n\t\tconst room = Math.max(1, budget - header.length - footer.length - failure.length - statusRows.length);\n\t\tconst body = transcript.render(width, room);\n\t\treturn [\n\t\t\t...header,\n\t\t\t...body,\n\t\t\t...Array.from({ length: Math.max(0, room - body.length) }, () => \"\"),\n\t\t\t...footer,\n\t\t\t...failure,\n\t\t\t...statusRows,\n\t\t].slice(0, Math.max(1, budget));\n\t}\n\trenderViewport(width: number, budget: number): string[] {\n\t\tif (this.transcript && !this.confirmation && this.navigation.focus.kind === \"detail\")\n\t\t\treturn this.renderTranscriptPage(width, budget, this.transcript);\n\t\tconst framed = width >= 20 && budget >= 7;\n\t\tconst inner = Math.max(1, width - (framed ? 4 : 0));\n\t\tconst current = this.selected();\n\t\tconst detail = this.navigation.focus.kind === \"detail\";\n\t\tconst selectingAction = current && detail && !this.transcript && !this.confirmation;\n\t\tconst actions = selectingAction\n\t\t\t? taskDetailActions(current.execution, current.attention, this.stdinAvailable())\n\t\t\t: [];\n\t\tthis.actionIndex = Math.max(0, Math.min(this.actionIndex, actions.length - 1));\n\t\tconst action = actions[this.actionIndex];\n\t\tconst actionRow = action ? [theme.fg(\"accent\", `› ${taskDetailLabels[action]}`)] : [];\n\t\tconst rows = this.renderAll(inner);\n\t\tconst compactSummary = !framed && detail && current && budget >= 4 ? [taskDetailSummary(current)] : [];\n\t\tconst statusRows = this.taskStatusRows(width);\n\t\tconst height = Math.max(\n\t\t\t0,\n\t\t\tbudget - (framed ? 4 : 1) - actionRow.length - compactSummary.length - statusRows.length,\n\t\t);\n\t\tconst selected = detail ? -1 : rows.findIndex((row) => stripVTControlCharacters(row).startsWith(\"›\"));\n\t\tthis.scroll = Math.min(this.scroll, Math.max(0, rows.length - height));\n\t\tconst selectionRows = Math.min(height, current?.kind === \"agent\" ? 3 : 2);\n\t\tconst offset = detail ? this.scroll : Math.max(0, selected + selectionRows - height);\n\t\tconst view = rows.slice(offset, offset + height);\n\t\tconst inspect = keyHintIfBound(\"app.tasks.inspect\", detail ? \"select\" : \"view\");\n\t\tconst hints = this.confirmation\n\t\t\t? \"y confirm · n/Esc keep running\"\n\t\t\t: this.navigation.focus.kind === \"stdin\"\n\t\t\t\t? \"Enter send · Esc back\"\n\t\t\t\t: [\n\t\t\t\t\t\tdetail ? \"PgUp/PgDn scroll · ↑↓ actions\" : \"↑↓ select\",\n\t\t\t\t\t\tinspect,\n\t\t\t\t\t\tcurrent && current.execution.kind !== \"settled\"\n\t\t\t\t\t\t\t? keyHintIfBound(\"app.tasks.cancel\", \"stop\") ||\n\t\t\t\t\t\t\t\t(detail && !this.configuredTaskKey(\"x\") ? \"x stop\" : \"\")\n\t\t\t\t\t\t\t: \"\",\n\t\t\t\t\t\t\"Esc back\",\n\t\t\t\t\t]\n\t\t\t\t\t\t.filter(Boolean)\n\t\t\t\t\t\t.join(\" · \");\n\t\tconst footer = theme.fg(\"dim\", truncateToWidth(`/tasks · ${hints}`, width));\n\t\tconst failure = this.failureNotice ? [theme.fg(\"warning\", truncateToWidth(this.failureNotice, width))] : [];\n\t\tif (!framed)\n\t\t\treturn [...compactSummary, ...view, ...actionRow, footer, ...failure, ...statusRows]\n\t\t\t\t.map((line) => truncateToWidth(line, width))\n\t\t\t\t.slice(-Math.max(1, budget));\n\t\tconst live = this.store.backgroundTasks.filter((task) => task.execution.kind !== \"settled\").length;\n\t\tconst title =\n\t\t\tdetail && current\n\t\t\t\t? `${taskDisplayText(taskLabel(current))} › ${taskDisplayText(current.title)}`\n\t\t\t\t: \"Background tasks\";\n\t\tconst heading = ` ${truncateToWidth(title, Math.max(1, width - 5))} `;\n\t\tconst border = (text: string) => theme.fg(\"borderMuted\", text);\n\t\tconst frameRow = (line: string) => {\n\t\t\tconst text = truncateToWidth(line, inner);\n\t\t\treturn border(\"│ \") + text + \" \".repeat(Math.max(0, inner - visibleWidth(text))) + border(\" │\");\n\t\t};\n\t\treturn [\n\t\t\tborder(\"╭─\") + theme.bold(heading) + border(`${\"─\".repeat(Math.max(0, width - visibleWidth(heading) - 3))}╮`),\n\t\t\tframeRow(\n\t\t\t\tdetail && current\n\t\t\t\t\t? taskDetailSummary(current)\n\t\t\t\t\t: theme.fg(\"muted\", `${live} active · ${this.store.backgroundTasks.length} total`),\n\t\t\t),\n\t\t\t...view.map(frameRow),\n\t\t\t...actionRow.map(frameRow),\n\t\t\tborder(`╰${\"─\".repeat(Math.max(0, width - 2))}╯`),\n\t\t\tfooter,\n\t\t\t...failure,\n\t\t\t...statusRows,\n\t\t].map((line) => truncateToWidth(line, width));\n\t}\n\tprivate renderAll(width: number): string[] {\n\t\tconst task = this.selected();\n\t\tif (this.confirmation)\n\t\t\treturn new Text(\n\t\t\t\t`Cancel ${task?.title}\\nTask ${task?.ref.taskId}\\ny: confirm · n/Escape: keep running`,\n\t\t\t\t0,\n\t\t\t\t0,\n\t\t\t).render(width);\n\t\tif (this.navigation.focus.kind === \"stdin\")\n\t\t\treturn [`Input to ${task?.title} · Escape: tasks`, ...this.input.render(width), this.status];\n\t\tif (task && this.navigation.focus.kind === \"detail\") {\n\t\t\treturn [\n\t\t\t\t...new TaskDetail(task, {\n\t\t\t\t\t...this.detailContent,\n\t\t\t\t\tstdinAvailable: this.stdinAvailable(),\n\t\t\t\t\tactivity: this.store.recentActivity(task.ref.taskId),\n\t\t\t\t\tactivityOmitted: this.store.activityOmitted(task.ref.taskId),\n\t\t\t\t}).renderContent(width),\n\t\t\t\tthis.status,\n\t\t\t];\n\t\t}\n\t\tconst sections = this.orderedSections();\n\t\tif (!sections.length)\n\t\t\treturn new Text(\"No background tasks.\\nBackground agents and shells will appear here.\", 0, 0).render(width);\n\t\treturn sections.flatMap((section) => [\n\t\t\t\"\",\n\t\t\ttheme.fg(\"muted\", theme.bold(`${section.title} (${section.tasks.length})`)),\n\t\t\t...section.tasks.flatMap((item) => {\n\t\t\t\tconst selected = item.ref.taskId === this.navigation.selectedTaskId;\n\t\t\t\tconst { label: state, color, icon } = taskStatusAppearance(item);\n\t\t\t\tconst status = width < 32 ? ` ${icon}` : ` ${icon} ${state}`;\n\t\t\t\tconst name = taskDisplayText(item.title || taskLabel(item));\n\t\t\t\tconst marker = selected ? \"› \" : \" \";\n\t\t\t\tconst title = marker + truncateToWidth(name, Math.max(1, width - visibleWidth(status) - 3));\n\t\t\t\tconst row = `${selected ? theme.fg(\"accent\", theme.bold(title)) : title}${\" \".repeat(Math.max(1, width - visibleWidth(title) - visibleWidth(status)))}${theme.fg(color, status)}`;\n\t\t\t\tconst metadata = [\n\t\t\t\t\t...(width < 32 ? [state] : []),\n\t\t\t\t\ttaskLabel(item),\n\t\t\t\t\ttaskMetricsText(item),\n\t\t\t\t\titem.currentAction ? `${item.currentAction.tool} ${item.currentAction.text}` : \"\",\n\t\t\t\t]\n\t\t\t\t\t.filter(Boolean)\n\t\t\t\t\t.join(\" · \");\n\t\t\t\treturn [\n\t\t\t\t\ttruncateToWidth(row, width),\n\t\t\t\t\t...(item.kind === \"agent\" ? [theme.fg(\"dim\", truncateToWidth(` ${taskModelText(item)}`, width))] : []),\n\t\t\t\t\t...(selected ? [theme.fg(\"dim\", truncateToWidth(` ${taskDisplayText(metadata)}`, width))] : []),\n\t\t\t\t];\n\t\t\t}),\n\t\t]);\n\t}\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TaskId } from "../../../core/tasks/contracts.js";
|
|
2
|
-
import type
|
|
2
|
+
import { type TaskViewSource } from "../../../core/tasks/task-view-source.js";
|
|
3
3
|
import type { ChatSessionHost } from "./chat-session-host.ts";
|
|
4
4
|
import type { ChatSessionHostOpts, ChatSessionHostStyle } from "./chat-session-host-types.ts";
|
|
5
5
|
/** Where a task's transcript view is mounted: the chat host it builds on and the render settings it inherits. */
|
|
@@ -11,6 +11,8 @@ export interface TaskTranscriptEnvironment {
|
|
|
11
11
|
readonly editorFactory?: ChatSessionHostOpts["editorFactory"];
|
|
12
12
|
readonly style: ChatSessionHostStyle;
|
|
13
13
|
readonly getChatRenderSettings?: ChatSessionHostOpts["getChatRenderSettings"];
|
|
14
|
+
/** What the transcript chat's footer reads of git and providers; without it the footer counts tasks only. */
|
|
15
|
+
readonly footerData?: ChatSessionHostOpts["footerData"];
|
|
14
16
|
readonly getToolsExpanded?: () => boolean;
|
|
15
17
|
readonly setToolsExpanded?: (expanded: boolean) => void;
|
|
16
18
|
/** Tells the reader about a message that failed after they left its transcript and the task pages. */
|
|
@@ -26,6 +28,8 @@ export interface TaskTranscriptPage {
|
|
|
26
28
|
handleInput(data: string): boolean;
|
|
27
29
|
/** Whether the reader is typing, so a key such as Left edits instead of leaving. */
|
|
28
30
|
hasDraft(): boolean;
|
|
31
|
+
/** Whether the page takes Escape and Left itself, as while its own task list is open. */
|
|
32
|
+
handlesBack(): boolean;
|
|
29
33
|
render(width: number, rows: number): string[];
|
|
30
34
|
invalidate(): void;
|
|
31
35
|
dispose(): void;
|
|
@@ -60,11 +64,17 @@ export declare class TaskAgentTranscriptPage implements TaskTranscriptPage {
|
|
|
60
64
|
refresh(): void;
|
|
61
65
|
handleInput(data: string): boolean;
|
|
62
66
|
private route;
|
|
67
|
+
/** The chat box of a stage chat: the transcript, then pending, working, usage, the named editor and the footer. */
|
|
63
68
|
render(width: number, rows: number): string[];
|
|
69
|
+
/** What the subagent's session is called: its Intercom name, else its agent's name. */
|
|
70
|
+
private sessionName;
|
|
64
71
|
invalidate(): void;
|
|
65
72
|
dispose(): void;
|
|
66
73
|
hasDraft(): boolean;
|
|
74
|
+
handlesBack(): boolean;
|
|
67
75
|
private adoptLatestPage;
|
|
76
|
+
/** A page opened mid-turn missed `agent_start` and `queue_update`, so it reads the turn and the queue now. */
|
|
77
|
+
private hydrateRunningTurn;
|
|
68
78
|
private loadEarlier;
|
|
69
79
|
private send;
|
|
70
80
|
/** The reader left before the answer: report it once, and give the text back when they return. */
|
|
@@ -89,6 +99,7 @@ export declare class TaskCommandOutputPage implements TaskTranscriptPage {
|
|
|
89
99
|
refresh(): void;
|
|
90
100
|
handleInput(data: string): boolean;
|
|
91
101
|
hasDraft(): boolean;
|
|
102
|
+
handlesBack(): boolean;
|
|
92
103
|
render(width: number, rows: number): string[];
|
|
93
104
|
invalidate(): void;
|
|
94
105
|
dispose(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-transcript-page.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/task-transcript-page.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"task-transcript-page.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/task-transcript-page.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAG/D,OAAO,EAIN,KAAK,cAAc,EACnB,MAAM,yCAAyC,CAAC;AAEjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAM9F,iHAAiH;AACjH,MAAM,WAAW,yBAAyB;IACzC,UAAU,CAAC,IAAI,EAAE,mBAAmB,GAAG,eAAe,CAAC;IACvD,QAAQ,CAAC,GAAG,CAAC,EAAE,mBAAmB,CAAC,KAAK,CAAC,CAAC;IAC1C,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,WAAW,EAAE,mBAAmB,CAAC,aAAa,CAAC,CAAC;IACzD,QAAQ,CAAC,aAAa,CAAC,EAAE,mBAAmB,CAAC,eAAe,CAAC,CAAC;IAC9D,QAAQ,CAAC,KAAK,EAAE,oB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IAClC,MAAM,SAAqB;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiB;IACxC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAe;IACzC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAa;IAC3C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA8B;IACvD,OAAO,CAAC,MAAM,CAAsB;IACpC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAS;IAEzB,YACC,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,MAAM,EACvB,GAAG,EAAE,IAAI,CAAC,yBAAyB,EAAE,aAAa,GAAG,uBAAuB,CAAC,GAAG,SAAS,EACzF,aAAa,EAAE,MAAM,IAAI,EAazB;IAEK,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CA4B1B;IAED,OAAO,IAAI,IAAI,CAEd;IAED,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAIjC;IAED,QAAQ,IAAI,OAAO,CAElB;IAED,WAAW,IAAI,OAAO,CAErB;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAG5C;IAED,UAAU,IAAI,IAAI,CAEjB;IAED,OAAO,IAAI,IAAI,CAGd;CACD"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { getKeybindings, matchesKey, Text } from "@earendil-works/pi-tui";
|
|
2
2
|
import { TaskMessageError } from "../../../core/tasks/message-error.js";
|
|
3
|
+
import { launchedTaskViewSource, } from "../../../core/tasks/task-view-source.js";
|
|
3
4
|
import { theme } from "../theme/theme.js";
|
|
4
5
|
import { ScrollableComponentViewport } from "./chat-transcript.js";
|
|
6
|
+
import { applyInputLabelToEditorTopRule } from "./input-label.js";
|
|
5
7
|
import { taskDisplayText } from "./task-row.js";
|
|
6
8
|
import { TRANSCRIPT_JUMP_TO_END_URL } from "./transcript-follow-indicator.js";
|
|
7
9
|
const undeliveredMessages = new WeakMap();
|
|
@@ -29,6 +31,15 @@ function keybindingsOf(candidate) {
|
|
|
29
31
|
? keybindings
|
|
30
32
|
: getKeybindings();
|
|
31
33
|
}
|
|
34
|
+
/** The subagent's footer shows its own session: the extension statuses of the chat that opened it are not its own. */
|
|
35
|
+
function withoutExtensionStatuses(data) {
|
|
36
|
+
return {
|
|
37
|
+
getGitBranch: (cwd) => data.getGitBranch(cwd),
|
|
38
|
+
getAvailableProviderCount: () => data.getAvailableProviderCount(),
|
|
39
|
+
onBranchChange: (callback, cwd) => data.onBranchChange(callback, cwd),
|
|
40
|
+
getExtensionStatuses: () => new Map(),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
32
43
|
async function settled(read) {
|
|
33
44
|
return read instanceof Promise ? await read : read;
|
|
34
45
|
}
|
|
@@ -68,12 +79,19 @@ export class TaskAgentTranscriptPage {
|
|
|
68
79
|
editorTheme: env.editorTheme,
|
|
69
80
|
editorFactory: env.editorFactory,
|
|
70
81
|
getChatRenderSettings: env.getChatRenderSettings,
|
|
82
|
+
...(env.footerData === undefined ? {} : { footerData: withoutExtensionStatuses(env.footerData) }),
|
|
83
|
+
getChatBoxSession: () => this.followed?.chatSession,
|
|
71
84
|
requestRender,
|
|
72
85
|
taskRowsInChat: false,
|
|
73
86
|
isStreaming: () => this.followed?.getStreamingMessage?.() !== undefined,
|
|
74
87
|
isDisabled: () => source.sendTaskMessage === undefined,
|
|
75
88
|
onNearTop: () => this.loadEarlier(),
|
|
76
|
-
|
|
89
|
+
// A subagent's `/tasks` lists the tasks it launched, as a stage chat's lists the stage's own.
|
|
90
|
+
getTaskSource: () => launchedTaskViewSource(source, taskId),
|
|
91
|
+
commands: {
|
|
92
|
+
send: (text) => this.send(text),
|
|
93
|
+
handleSlashCommand: (text) => this.chat.openTasks(text.split(/\s+/)[1]),
|
|
94
|
+
},
|
|
77
95
|
});
|
|
78
96
|
this.restoreUndelivered();
|
|
79
97
|
}
|
|
@@ -143,15 +161,38 @@ export class TaskAgentTranscriptPage {
|
|
|
143
161
|
this.requestRender();
|
|
144
162
|
return true;
|
|
145
163
|
}
|
|
146
|
-
|
|
164
|
+
// The subagent's own task list is modal while it is open, as in a stage chat.
|
|
165
|
+
const handled = this.chat.hasTaskInspector ? this.chat.handleTaskInput(data) : this.chat.handleInput(data);
|
|
147
166
|
this.requestRender();
|
|
148
167
|
return handled;
|
|
149
168
|
}
|
|
169
|
+
/** The chat box of a stage chat: the transcript, then pending, working, usage, the named editor and the footer. */
|
|
150
170
|
render(width, rows) {
|
|
151
|
-
const
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
171
|
+
const viewport = Math.max(1, rows);
|
|
172
|
+
if (this.chat.hasTaskInspector) {
|
|
173
|
+
const footer = this.chat.taskInspectorFullscreen ? [] : this.chat.renderFooter(width);
|
|
174
|
+
const shownFooter = footer.slice(0, viewport - 1);
|
|
175
|
+
return [...this.chat.renderBody(width, viewport - shownFooter.length), ...shownFooter];
|
|
176
|
+
}
|
|
177
|
+
let remaining = viewport;
|
|
178
|
+
// The editor keeps its rows first, then the footer, then the status rows; the transcript takes what is left.
|
|
179
|
+
const reserve = (lines, fromEnd = false) => {
|
|
180
|
+
const shown = fromEnd ? lines.slice(Math.max(0, lines.length - remaining)) : lines.slice(0, remaining);
|
|
181
|
+
remaining -= shown.length;
|
|
182
|
+
return shown;
|
|
183
|
+
};
|
|
184
|
+
const editor = reserve(applyInputLabelToEditorTopRule(this.env.style, "subagent", this.sessionName(), this.chat.renderEditor(width)));
|
|
185
|
+
const footer = reserve(this.chat.renderFooter(width));
|
|
186
|
+
const pending = reserve(this.chat.renderPendingMessages(width));
|
|
187
|
+
const working = reserve(this.chat.renderWorkingStatus(width), true);
|
|
188
|
+
const usage = reserve(this.chat.renderUsage(width));
|
|
189
|
+
const body = remaining > 0 ? this.chat.renderBody(width, remaining) : [];
|
|
190
|
+
return [...body, ...pending, ...working, ...usage, ...editor, ...footer];
|
|
191
|
+
}
|
|
192
|
+
/** What the subagent's session is called: its Intercom name, else its agent's name. */
|
|
193
|
+
sessionName() {
|
|
194
|
+
return (this.source.followTaskTranscript(this.taskId)?.session?.completionSource?.intercomTarget ??
|
|
195
|
+
this.source.tasks.find((task) => task.ref.taskId === this.taskId)?.agentName);
|
|
155
196
|
}
|
|
156
197
|
invalidate() {
|
|
157
198
|
this.chat.invalidate();
|
|
@@ -165,6 +206,9 @@ export class TaskAgentTranscriptPage {
|
|
|
165
206
|
hasDraft() {
|
|
166
207
|
return this.chat.hasInputText();
|
|
167
208
|
}
|
|
209
|
+
handlesBack() {
|
|
210
|
+
return this.chat.hasTaskInspector;
|
|
211
|
+
}
|
|
168
212
|
adoptLatestPage(page) {
|
|
169
213
|
if (!page.ok) {
|
|
170
214
|
this.status = page.error.message;
|
|
@@ -189,11 +233,21 @@ export class TaskAgentTranscriptPage {
|
|
|
189
233
|
if (session === undefined)
|
|
190
234
|
return;
|
|
191
235
|
this.chat.hydrateStreamingAssistantMessage(session.getStreamingMessage?.());
|
|
236
|
+
this.hydrateRunningTurn(session);
|
|
192
237
|
this.unsubscribe = session.subscribe?.((event) => {
|
|
193
238
|
this.chat.applyAgentEvent(event);
|
|
194
239
|
this.requestRender();
|
|
195
240
|
});
|
|
196
241
|
}
|
|
242
|
+
/** A page opened mid-turn missed `agent_start` and `queue_update`, so it reads the turn and the queue now. */
|
|
243
|
+
hydrateRunningTurn(session) {
|
|
244
|
+
if (session.isRunning?.() === true)
|
|
245
|
+
this.chat.beginExternalPromptLifecycle();
|
|
246
|
+
const queued = session.getQueuedMessages?.();
|
|
247
|
+
if (queued === undefined)
|
|
248
|
+
return;
|
|
249
|
+
this.chat.applyAgentEvent({ type: "queue_update", steering: queued.steering, followUp: queued.followUp });
|
|
250
|
+
}
|
|
197
251
|
loadEarlier() {
|
|
198
252
|
const cursor = this.cursor;
|
|
199
253
|
if (cursor === undefined || this.loadingEarlier || this.loading || this.disposed)
|
|
@@ -327,6 +381,9 @@ export class TaskCommandOutputPage {
|
|
|
327
381
|
hasDraft() {
|
|
328
382
|
return false;
|
|
329
383
|
}
|
|
384
|
+
handlesBack() {
|
|
385
|
+
return false;
|
|
386
|
+
}
|
|
330
387
|
render(width, rows) {
|
|
331
388
|
this.viewport.setVisibleRows(Math.max(1, rows));
|
|
332
389
|
return this.viewport.render(width);
|