feat: compact vs. verbose chat settings
This commit is contained in:
@@ -12,6 +12,7 @@ import type { ProgressTracker } from "./progress";
|
||||
import type {
|
||||
ExtensionContext,
|
||||
ModelRuntime,
|
||||
AgentSessionEvent,
|
||||
} from "@earendil-works/pi-coding-agent";
|
||||
import {
|
||||
buildTaskPrompt,
|
||||
@@ -56,6 +57,28 @@ import {
|
||||
} from "./utils";
|
||||
import { updateTaskInFile } from "./parser";
|
||||
|
||||
// ─── Stream Forwarder (verbose chat style) ────────────────────────────────────
|
||||
|
||||
/**
|
||||
* Module-level callback for verbose per-event chat streaming. Set by
|
||||
* `index.ts` at extension startup via {@link setStreamForwarder} when the
|
||||
* config's `execution.chatStyle` is "verbose". `runTask`'s event callback
|
||||
* checks this and forwards each tool_execution_start/end + message_end as
|
||||
* its own chat message — the piolium/pygienium per-event stream. When null
|
||||
* (compact mode, the default), only the completion message with its
|
||||
* expandable tool-call tree shows.
|
||||
*/
|
||||
let _streamForwarder:
|
||||
| ((phase: string, event: AgentSessionEvent) => void)
|
||||
| null = null;
|
||||
|
||||
/** Register the verbose stream forwarder (called by index.ts at startup). */
|
||||
export function setStreamForwarder(
|
||||
fn: ((phase: string, event: AgentSessionEvent) => void) | null,
|
||||
): void {
|
||||
_streamForwarder = fn;
|
||||
}
|
||||
|
||||
/** Optional callback to post a progress message into the chat history. */
|
||||
export type SendChatMessage = (
|
||||
content: string,
|
||||
@@ -336,6 +359,10 @@ export async function runTask(
|
||||
projectDir,
|
||||
timeoutMs,
|
||||
(event) => {
|
||||
// Forward to the verbose stream when enabled.
|
||||
if (_streamForwarder && config.execution.chatStyle === "verbose") {
|
||||
_streamForwarder(`${task.id} · ${task.title}`, event);
|
||||
}
|
||||
if (event.type === "tool_execution_start") {
|
||||
const label = formatToolArg(event.toolName, event.args);
|
||||
toolCalls.push({
|
||||
|
||||
@@ -262,6 +262,12 @@ export interface RalpiConfig {
|
||||
* - "parallel": only when maxParallel > 1 and mode is parallel
|
||||
* - "always": every task gets its own worktree */
|
||||
worktrees: "always" | "parallel" | "never";
|
||||
/** Chat rendering style for tool calls during task execution.
|
||||
* - "compact": single completion message per task with an expandable
|
||||
* tool-call tree (collapsed shows last 3, expanded shows all).
|
||||
* - "verbose": per-event stream — each tool start/end and assistant
|
||||
* turn is its own chat line (piolium/pygienium-style). */
|
||||
chatStyle: "compact" | "verbose";
|
||||
};
|
||||
prompts: {
|
||||
/** Additional context injected into every task prompt */
|
||||
@@ -310,6 +316,7 @@ export const DEFAULT_CONFIG: RalpiConfig = {
|
||||
loopTimeoutMs: 0, // 0 = no limit
|
||||
worktrees: "parallel", // worktree isolation for parallel tasks by default
|
||||
maxSameModelAttempts: 5, // retry the same model up to 5 times before cycling to the next
|
||||
chatStyle: "compact", // compact = completion message with tool-call tree; verbose = per-event stream
|
||||
},
|
||||
prompts: {
|
||||
projectContext: "",
|
||||
|
||||
Reference in New Issue
Block a user