@kolisachint/hoocode-agent 0.4.9 → 0.4.11
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/dispatch-evaluator.d.ts +31 -0
- package/dist/core/dispatch-evaluator.d.ts.map +1 -0
- package/dist/core/dispatch-evaluator.js +300 -0
- package/dist/core/dispatch-evaluator.js.map +1 -0
- package/dist/core/lifeguard.d.ts +1 -0
- package/dist/core/lifeguard.d.ts.map +1 -1
- package/dist/core/lifeguard.js +6 -0
- package/dist/core/lifeguard.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/subagent-pool.d.ts +35 -0
- package/dist/core/subagent-pool.d.ts.map +1 -1
- package/dist/core/subagent-pool.js +152 -11
- package/dist/core/subagent-pool.js.map +1 -1
- package/dist/core/subagent.d.ts +9 -1
- package/dist/core/subagent.d.ts.map +1 -1
- package/dist/core/subagent.js +23 -2
- package/dist/core/subagent.js.map +1 -1
- package/dist/core/task-store.d.ts +12 -3
- package/dist/core/task-store.d.ts.map +1 -1
- package/dist/core/task-store.js +5 -2
- package/dist/core/task-store.js.map +1 -1
- package/dist/core/tools/subagent.d.ts +5 -1
- package/dist/core/tools/subagent.d.ts.map +1 -1
- package/dist/core/tools/subagent.js +64 -13
- package/dist/core/tools/subagent.js.map +1 -1
- package/dist/init-templates.generated.d.ts +1 -0
- package/dist/init-templates.generated.d.ts.map +1 -1
- package/dist/init-templates.generated.js +8 -0
- package/dist/init-templates.generated.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +2 -2
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +9 -14
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +1 -6
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +1 -5
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/task-panel.d.ts +5 -2
- package/dist/modes/interactive/components/task-panel.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-panel.js +103 -9
- package/dist/modes/interactive/components/task-panel.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +12 -10
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- 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 +64 -3
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/dark.json +5 -5
- package/dist/modes/interactive/theme/light.json +5 -5
- package/docs/routing.md +57 -0
- 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
- package/templates/agents/doc.md +35 -0
- package/templates/agents/edit.md +37 -0
- package/templates/agents/explore.md +35 -0
- package/templates/agents/review.md +36 -0
- package/templates/agents/test.md +35 -0
- package/templates/subagent/doc.md +16 -0
|
@@ -21,6 +21,7 @@ import { BUILT_IN_PROVIDER_DISPLAY_NAMES } from "../../core/provider-display-nam
|
|
|
21
21
|
import { formatMissingSessionCwdPrompt, MissingSessionCwdError } from "../../core/session-cwd.js";
|
|
22
22
|
import { SessionManager } from "../../core/session-manager.js";
|
|
23
23
|
import { BUILTIN_SLASH_COMMANDS } from "../../core/slash-commands.js";
|
|
24
|
+
import { runSubagent } from "../../core/subagent.js";
|
|
24
25
|
import { taskStore } from "../../core/task-store.js";
|
|
25
26
|
import { WORDMARK } from "../../core/wordmark.js";
|
|
26
27
|
import { getChangelogPath, getNewEntries, parseChangelog } from "../../utils/changelog.js";
|
|
@@ -2124,6 +2125,11 @@ export class InteractiveMode {
|
|
|
2124
2125
|
await this.shutdown();
|
|
2125
2126
|
return;
|
|
2126
2127
|
}
|
|
2128
|
+
if (text === "/subagent" || text.startsWith("/subagent ")) {
|
|
2129
|
+
this.editor.setText("");
|
|
2130
|
+
await this.handleSubagentCommand(text);
|
|
2131
|
+
return;
|
|
2132
|
+
}
|
|
2127
2133
|
// Handle bash command (! for normal, !! for excluded from context)
|
|
2128
2134
|
if (text.startsWith("!")) {
|
|
2129
2135
|
const isExcluded = text.startsWith("!!");
|
|
@@ -2228,14 +2234,16 @@ export class InteractiveMode {
|
|
|
2228
2234
|
this.ui.requestRender();
|
|
2229
2235
|
}
|
|
2230
2236
|
else if (event.message.role === "user") {
|
|
2237
|
+
// A new user message starts a new turn: retire any finished subagent
|
|
2238
|
+
// tasks from the previous turn. Finished tasks stay visible (with their
|
|
2239
|
+
// final status, tokens, and time) until this point — not the moment they
|
|
2240
|
+
// finish — so their outcome remains glanceable for the whole turn.
|
|
2241
|
+
taskStore.retireFinished();
|
|
2231
2242
|
this.addMessageToChat(event.message);
|
|
2232
2243
|
this.updatePendingMessagesDisplay();
|
|
2233
2244
|
this.ui.requestRender();
|
|
2234
2245
|
}
|
|
2235
2246
|
else if (event.message.role === "assistant") {
|
|
2236
|
-
// Main agent is moving on to its next turn: retire any finished subagent
|
|
2237
|
-
// tasks that were kept visible after a parallel spawn.
|
|
2238
|
-
taskStore.retireFinished();
|
|
2239
2247
|
this.streamingComponent = new AssistantMessageComponent(undefined, this.hideThinkingBlock, this.getMarkdownThemeWithSettings(), this.hiddenThinkingLabel);
|
|
2240
2248
|
this.streamingMessage = event.message;
|
|
2241
2249
|
this.chatContainer.addChild(this.streamingComponent);
|
|
@@ -3531,6 +3539,59 @@ export class InteractiveMode {
|
|
|
3531
3539
|
this.showError(error instanceof Error ? error.message : String(error));
|
|
3532
3540
|
}
|
|
3533
3541
|
}
|
|
3542
|
+
async handleSubagentCommand(text) {
|
|
3543
|
+
const prefix = "/subagent ";
|
|
3544
|
+
const args = text.startsWith(prefix) ? text.slice(prefix.length).trim() : "";
|
|
3545
|
+
if (!args) {
|
|
3546
|
+
this.showStatus("Usage: /subagent <mode> <task>");
|
|
3547
|
+
return;
|
|
3548
|
+
}
|
|
3549
|
+
const firstSpace = args.indexOf(" ");
|
|
3550
|
+
if (firstSpace === -1) {
|
|
3551
|
+
this.showStatus("Usage: /subagent <mode> <task>");
|
|
3552
|
+
return;
|
|
3553
|
+
}
|
|
3554
|
+
const mode = args.slice(0, firstSpace).trim();
|
|
3555
|
+
const task = args.slice(firstSpace + 1).trim();
|
|
3556
|
+
if (!task) {
|
|
3557
|
+
this.showStatus("Usage: /subagent <mode> <task>");
|
|
3558
|
+
return;
|
|
3559
|
+
}
|
|
3560
|
+
const validModes = ["explore", "edit", "test", "fix", "review", "doc"];
|
|
3561
|
+
if (!validModes.includes(mode)) {
|
|
3562
|
+
this.showStatus(`Unknown subagent mode: ${mode}. Valid: ${validModes.join(", ")}`);
|
|
3563
|
+
return;
|
|
3564
|
+
}
|
|
3565
|
+
this.showStatus(`Spawning ${mode} subagent...`);
|
|
3566
|
+
try {
|
|
3567
|
+
const result = await runSubagent({
|
|
3568
|
+
task,
|
|
3569
|
+
context: "",
|
|
3570
|
+
mode,
|
|
3571
|
+
cwd: this.session.sessionManager.getCwd(),
|
|
3572
|
+
model: this.session.model ?? undefined,
|
|
3573
|
+
modelRegistry: this.runtimeHost.services.modelRegistry,
|
|
3574
|
+
signal: undefined,
|
|
3575
|
+
});
|
|
3576
|
+
if (result.ok) {
|
|
3577
|
+
this.showStatus(`${mode} subagent completed`);
|
|
3578
|
+
// Inject the subagent answer as a custom message so the user can see it in the chat
|
|
3579
|
+
this.sessionManager.appendMessage({
|
|
3580
|
+
role: "custom",
|
|
3581
|
+
customType: "subagent",
|
|
3582
|
+
content: result.answer || "(no output)",
|
|
3583
|
+
display: true,
|
|
3584
|
+
timestamp: Date.now(),
|
|
3585
|
+
});
|
|
3586
|
+
}
|
|
3587
|
+
else {
|
|
3588
|
+
this.showError(`Subagent (${mode}) failed: ${result.error ?? "unknown error"}`);
|
|
3589
|
+
}
|
|
3590
|
+
}
|
|
3591
|
+
catch (error) {
|
|
3592
|
+
this.showError(error instanceof Error ? error.message : String(error));
|
|
3593
|
+
}
|
|
3594
|
+
}
|
|
3534
3595
|
showTreeSelector(initialSelectedId) {
|
|
3535
3596
|
const tree = this.sessionManager.getTree();
|
|
3536
3597
|
const realLeafId = this.sessionManager.getLeafId();
|