@kolisachint/hoocode-agent 0.4.2 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/core/task-store.d.ts +3 -1
- package/dist/core/task-store.d.ts.map +1 -1
- package/dist/core/task-store.js +7 -1
- package/dist/core/task-store.js.map +1 -1
- package/dist/core/tools/subagent.d.ts +1 -1
- package/dist/core/tools/subagent.d.ts.map +1 -1
- package/dist/core/tools/subagent.js +6 -10
- package/dist/core/tools/subagent.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +0 -41
- 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/task-panel.d.ts +14 -0
- package/dist/modes/interactive/components/task-panel.d.ts.map +1 -0
- package/dist/modes/interactive/components/task-panel.js +61 -0
- package/dist/modes/interactive/components/task-panel.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +7 -2
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/with-deps/package.json +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { truncateToWidth, visibleWidth } from "@kolisachint/hoocode-tui";
|
|
2
|
+
import { taskStore } from "../../../core/task-store.js";
|
|
3
|
+
import { theme } from "../theme/theme.js";
|
|
4
|
+
/** Max lines the task panel reserves above the editor. */
|
|
5
|
+
const MAX_TASK_PANEL_LINES = 4;
|
|
6
|
+
const TASK_STATUS_ICON = {
|
|
7
|
+
pending: "●",
|
|
8
|
+
in_progress: "◐",
|
|
9
|
+
done: "✓",
|
|
10
|
+
failed: "✗",
|
|
11
|
+
};
|
|
12
|
+
function taskStatusColor(status) {
|
|
13
|
+
switch (status) {
|
|
14
|
+
case "in_progress":
|
|
15
|
+
return "warning";
|
|
16
|
+
case "done":
|
|
17
|
+
return "success";
|
|
18
|
+
case "failed":
|
|
19
|
+
return "error";
|
|
20
|
+
default:
|
|
21
|
+
return "dim";
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function formatTaskLine(task, width) {
|
|
25
|
+
const icon = theme.fg(taskStatusColor(task.status), TASK_STATUS_ICON[task.status]);
|
|
26
|
+
const modeTag = task.subagentMode ? theme.fg("accent", ` [${task.subagentMode}]`) : "";
|
|
27
|
+
const plainModeTag = task.subagentMode ? ` [${task.subagentMode}]` : "";
|
|
28
|
+
const title = task.title;
|
|
29
|
+
const plainText = `${TASK_STATUS_ICON[task.status]} ${title}${plainModeTag}`;
|
|
30
|
+
const available = Math.max(0, width - visibleWidth(plainText) + visibleWidth(title));
|
|
31
|
+
const left = truncateToWidth(`${icon} ${title}`, available, "...");
|
|
32
|
+
return left + modeTag;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Task panel rendered just above the editor prompt.
|
|
36
|
+
*
|
|
37
|
+
* - Shows only active (pending / in_progress) tasks.
|
|
38
|
+
* - LIFO within the window: newest tasks appear at the bottom (closest to the prompt).
|
|
39
|
+
* - Completed or failed tasks drop out automatically so the panel only reflects ongoing work.
|
|
40
|
+
* - Collapses to zero lines when there is nothing running.
|
|
41
|
+
*/
|
|
42
|
+
export class TaskPanelComponent {
|
|
43
|
+
invalidate() {
|
|
44
|
+
// No cached rendering state.
|
|
45
|
+
}
|
|
46
|
+
render(width) {
|
|
47
|
+
const tasks = taskStore.list();
|
|
48
|
+
const active = tasks.filter((t) => t.status === "pending" || t.status === "in_progress");
|
|
49
|
+
if (active.length === 0) {
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
// LIFO: newest at bottom. Take the last N tasks.
|
|
53
|
+
const visible = active.slice(-MAX_TASK_PANEL_LINES);
|
|
54
|
+
const lines = [];
|
|
55
|
+
for (const task of visible) {
|
|
56
|
+
lines.push(formatTaskLine(task, width));
|
|
57
|
+
}
|
|
58
|
+
return lines;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=task-panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-panel.js","sourceRoot":"","sources":["../../../../src/modes/interactive/components/task-panel.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAEzE,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,0DAA0D;AAC1D,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAE/B,MAAM,gBAAgB,GAA+B;IACpD,OAAO,EAAE,KAAG;IACZ,WAAW,EAAE,KAAG;IAChB,IAAI,EAAE,KAAG;IACT,MAAM,EAAE,KAAG;CACX,CAAC;AAEF,SAAS,eAAe,CAAC,MAAkB,EAA2C;IACrF,QAAQ,MAAM,EAAE,CAAC;QAChB,KAAK,aAAa;YACjB,OAAO,SAAS,CAAC;QAClB,KAAK,MAAM;YACV,OAAO,SAAS,CAAC;QAClB,KAAK,QAAQ;YACZ,OAAO,OAAO,CAAC;QAChB;YACC,OAAO,KAAK,CAAC;IACf,CAAC;AAAA,CACD;AAED,SAAS,cAAc,CAAC,IAAU,EAAE,KAAa,EAAU;IAC1D,MAAM,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IACnF,MA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MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;YAC5B,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;QACzC,CAAC;QACD,OAAO,KAAK,CAAC;IAAA,CACb;CACD","sourcesContent":["import type { Component } from \"@kolisachint/hoocode-tui\";\nimport { truncateToWidth, visibleWidth } from \"@kolisachint/hoocode-tui\";\nimport type { Task, TaskStatus } from \"../../../core/task-store.js\";\nimport { taskStore } from \"../../../core/task-store.js\";\nimport { theme } from \"../theme/theme.js\";\n\n/** Max lines the task panel reserves above the editor. */\nconst MAX_TASK_PANEL_LINES = 4;\n\nconst TASK_STATUS_ICON: Record<TaskStatus, string> = {\n\tpending: \"●\",\n\tin_progress: \"◐\",\n\tdone: \"✓\",\n\tfailed: \"✗\",\n};\n\nfunction taskStatusColor(status: TaskStatus): \"dim\" | \"warning\" | \"success\" | \"error\" {\n\tswitch (status) {\n\t\tcase \"in_progress\":\n\t\t\treturn \"warning\";\n\t\tcase \"done\":\n\t\t\treturn \"success\";\n\t\tcase \"failed\":\n\t\t\treturn \"error\";\n\t\tdefault:\n\t\t\treturn \"dim\";\n\t}\n}\n\nfunction formatTaskLine(task: Task, width: number): string {\n\tconst icon = theme.fg(taskStatusColor(task.status), TASK_STATUS_ICON[task.status]);\n\tconst modeTag = task.subagentMode ? theme.fg(\"accent\", ` [${task.subagentMode}]`) : \"\";\n\tconst plainModeTag = task.subagentMode ? ` [${task.subagentMode}]` : \"\";\n\tconst title = task.title;\n\tconst plainText = `${TASK_STATUS_ICON[task.status]} ${title}${plainModeTag}`;\n\tconst available = Math.max(0, width - visibleWidth(plainText) + visibleWidth(title));\n\tconst left = truncateToWidth(`${icon} ${title}`, available, \"...\");\n\treturn left + modeTag;\n}\n\n/**\n * Task panel rendered just above the editor prompt.\n *\n * - Shows only active (pending / in_progress) tasks.\n * - LIFO within the window: newest tasks appear at the bottom (closest to the prompt).\n * - Completed or failed tasks drop out automatically so the panel only reflects ongoing work.\n * - Collapses to zero lines when there is nothing running.\n */\nexport class TaskPanelComponent implements Component {\n\tinvalidate(): void {\n\t\t// No cached rendering state.\n\t}\n\n\trender(width: number): string[] {\n\t\tconst tasks = taskStore.list();\n\t\tconst active = tasks.filter((t) => t.status === \"pending\" || t.status === \"in_progress\");\n\t\tif (active.length === 0) {\n\t\t\treturn [];\n\t\t}\n\n\t\t// LIFO: newest at bottom. Take the last N tasks.\n\t\tconst visible = active.slice(-MAX_TASK_PANEL_LINES);\n\t\tconst lines: string[] = [];\n\t\tfor (const task of visible) {\n\t\t\tlines.push(formatTaskLine(task, width));\n\t\t}\n\t\treturn lines;\n\t}\n}\n"]}
|