@oh-my-pi/pi-coding-agent 15.10.12 → 15.11.1
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 +90 -4
- package/dist/cli.js +869 -825
- package/dist/types/async/index.d.ts +0 -1
- package/dist/types/capability/mcp.d.ts +1 -0
- package/dist/types/cli/gallery-fixtures/types.d.ts +5 -0
- package/dist/types/config/keybindings.d.ts +6 -1
- package/dist/types/config/settings-schema.d.ts +66 -34
- package/dist/types/export/html/template.generated.d.ts +1 -1
- package/dist/types/extensibility/custom-tools/types.d.ts +2 -2
- package/dist/types/extensibility/shared-events.d.ts +2 -2
- package/dist/types/internal-urls/history-protocol.d.ts +14 -0
- package/dist/types/internal-urls/index.d.ts +1 -0
- package/dist/types/internal-urls/types.d.ts +1 -1
- package/dist/types/irc/bus.d.ts +66 -0
- package/dist/types/mcp/oauth-discovery.d.ts +2 -0
- package/dist/types/mcp/oauth-flow.d.ts +6 -1
- package/dist/types/mcp/transports/stdio.d.ts +1 -0
- package/dist/types/mcp/types.d.ts +2 -0
- package/dist/types/modes/components/agent-hub.d.ts +30 -0
- package/dist/types/modes/components/assistant-message.d.ts +1 -0
- package/dist/types/modes/components/compaction-summary-message.d.ts +10 -4
- package/dist/types/modes/components/custom-editor.d.ts +2 -0
- package/dist/types/modes/components/mcp-add-wizard.d.ts +2 -1
- package/dist/types/modes/components/settings-selector.d.ts +1 -0
- package/dist/types/modes/components/status-line/types.d.ts +3 -0
- package/dist/types/modes/components/tool-execution.d.ts +8 -0
- package/dist/types/modes/components/transcript-container.d.ts +3 -2
- package/dist/types/modes/components/ttsr-notification.d.ts +5 -1
- package/dist/types/modes/components/welcome.d.ts +3 -9
- package/dist/types/modes/controllers/selector-controller.d.ts +1 -1
- package/dist/types/modes/controllers/tool-args-reveal.d.ts +43 -0
- package/dist/types/modes/interactive-mode.d.ts +3 -2
- package/dist/types/modes/theme/theme.d.ts +3 -1
- package/dist/types/modes/types.d.ts +3 -2
- package/dist/types/modes/utils/ui-helpers.d.ts +1 -1
- package/dist/types/registry/agent-lifecycle.d.ts +51 -0
- package/dist/types/registry/agent-registry.d.ts +16 -5
- package/dist/types/session/agent-session.d.ts +35 -30
- package/dist/types/session/messages.d.ts +2 -4
- package/dist/types/session/session-history-format.d.ts +12 -0
- package/dist/types/session/session-manager.d.ts +21 -3
- package/dist/types/session/streaming-output.d.ts +23 -0
- package/dist/types/task/executor.d.ts +11 -2
- package/dist/types/task/index.d.ts +11 -4
- package/dist/types/task/output-manager.d.ts +0 -7
- package/dist/types/task/repair-args.d.ts +8 -7
- package/dist/types/task/types.d.ts +55 -51
- package/dist/types/tools/browser/tab-worker.d.ts +3 -1
- package/dist/types/tools/find.d.ts +0 -11
- package/dist/types/tools/grouped-file-output.d.ts +0 -49
- package/dist/types/tools/index.d.ts +1 -3
- package/dist/types/tools/irc.d.ts +76 -38
- package/dist/types/tools/job.d.ts +7 -1
- package/dist/types/tools/render-utils.d.ts +22 -0
- package/examples/extensions/with-deps/package.json +1 -0
- package/package.json +11 -10
- package/scripts/bundle-dist.ts +28 -19
- package/src/async/index.ts +0 -1
- package/src/capability/mcp.ts +1 -0
- package/src/cli/gallery-cli.ts +6 -5
- package/src/cli/gallery-fixtures/agentic.ts +230 -115
- package/src/cli/gallery-fixtures/types.ts +5 -0
- package/src/cli.ts +20 -6
- package/src/commit/agentic/tools/analyze-file.ts +38 -19
- package/src/config/keybindings.ts +6 -1
- package/src/config/mcp-schema.json +4 -0
- package/src/config/settings-schema.ts +68 -41
- package/src/config/settings.ts +7 -0
- package/src/edit/renderer.ts +96 -46
- package/src/eval/__tests__/agent-bridge.test.ts +5 -3
- package/src/eval/agent-bridge.ts +3 -16
- package/src/eval/js/shared/prelude.txt +1 -1
- package/src/eval/py/prelude.py +5 -6
- package/src/export/html/template.generated.ts +1 -1
- package/src/export/html/template.js +44 -14
- package/src/extensibility/custom-tools/types.ts +2 -2
- package/src/extensibility/shared-events.ts +2 -2
- package/src/internal-urls/docs-index.generated.ts +9 -9
- package/src/internal-urls/history-protocol.ts +113 -0
- package/src/internal-urls/index.ts +1 -0
- package/src/internal-urls/router.ts +3 -1
- package/src/internal-urls/types.ts +1 -1
- package/src/irc/bus.ts +292 -0
- package/src/main.ts +8 -60
- package/src/mcp/manager.ts +3 -0
- package/src/mcp/oauth-discovery.ts +27 -2
- package/src/mcp/oauth-flow.ts +47 -1
- package/src/mcp/transports/stdio.ts +3 -0
- package/src/mcp/types.ts +2 -0
- package/src/modes/components/{session-observer-overlay.ts → agent-hub.ts} +586 -367
- package/src/modes/components/assistant-message.ts +15 -0
- package/src/modes/components/btw-panel.ts +5 -1
- package/src/modes/components/compaction-summary-message.ts +68 -32
- package/src/modes/components/custom-editor.ts +10 -0
- package/src/modes/components/mcp-add-wizard.ts +13 -0
- package/src/modes/components/settings-selector.ts +2 -0
- package/src/modes/components/status-line/component.ts +22 -12
- package/src/modes/components/status-line/types.ts +3 -0
- package/src/modes/components/tool-execution.ts +31 -1
- package/src/modes/components/transcript-container.ts +99 -18
- package/src/modes/components/tree-selector.ts +6 -1
- package/src/modes/components/ttsr-notification.ts +72 -30
- package/src/modes/components/welcome.ts +9 -33
- package/src/modes/controllers/event-controller.ts +93 -4
- package/src/modes/controllers/extension-ui-controller.ts +8 -8
- package/src/modes/controllers/input-controller.ts +18 -2
- package/src/modes/controllers/mcp-command-controller.ts +34 -2
- package/src/modes/controllers/selector-controller.ts +25 -17
- package/src/modes/controllers/tool-args-reveal.ts +174 -0
- package/src/modes/interactive-mode.ts +17 -15
- package/src/modes/theme/theme.ts +24 -5
- package/src/modes/types.ts +3 -5
- package/src/modes/utils/hotkeys-markdown.ts +1 -0
- package/src/modes/utils/ui-helpers.ts +51 -49
- package/src/prompts/system/irc-incoming.md +3 -4
- package/src/prompts/system/orchestrate-notice.md +2 -2
- package/src/prompts/system/subagent-system-prompt.md +0 -5
- package/src/prompts/system/system-prompt.md +1 -0
- package/src/prompts/system/workflow-notice.md +2 -2
- package/src/prompts/tools/eval.md +3 -3
- package/src/prompts/tools/irc.md +29 -19
- package/src/prompts/tools/read.md +2 -2
- package/src/prompts/tools/task-summary.md +5 -16
- package/src/prompts/tools/task.md +43 -29
- package/src/registry/agent-lifecycle.ts +218 -0
- package/src/registry/agent-registry.ts +16 -5
- package/src/sdk.ts +29 -9
- package/src/session/agent-session.ts +268 -241
- package/src/session/messages.ts +11 -78
- package/src/session/session-history-format.ts +246 -0
- package/src/session/session-manager.ts +59 -5
- package/src/session/streaming-output.ts +60 -0
- package/src/task/executor.ts +855 -466
- package/src/task/index.ts +723 -794
- package/src/task/output-manager.ts +0 -11
- package/src/task/render.ts +142 -66
- package/src/task/repair-args.ts +21 -9
- package/src/task/types.ts +73 -66
- package/src/tools/ask.ts +4 -2
- package/src/tools/bash.ts +15 -5
- package/src/tools/browser/tab-worker.ts +26 -7
- package/src/tools/browser.ts +28 -1
- package/src/tools/find.ts +2 -27
- package/src/tools/grouped-file-output.ts +1 -118
- package/src/tools/index.ts +4 -12
- package/src/tools/irc.ts +596 -171
- package/src/tools/job.ts +41 -7
- package/src/tools/read.ts +57 -1
- package/src/tools/render-utils.ts +56 -0
- package/src/tools/renderers.ts +2 -0
- package/src/tools/resolve.ts +4 -1
- package/src/tools/write.ts +65 -47
- package/src/web/search/providers/anthropic.ts +29 -4
- package/dist/types/async/support.d.ts +0 -2
- package/dist/types/modes/components/session-observer-overlay.d.ts +0 -11
- package/dist/types/task/simple-mode.d.ts +0 -8
- package/src/async/support.ts +0 -5
- package/src/task/simple-mode.ts +0 -27
|
@@ -36,9 +36,9 @@ import { type FileSlashCommand } from "../extensibility/slash-commands";
|
|
|
36
36
|
import { GoalRuntime } from "../goals/runtime";
|
|
37
37
|
import type { Goal, GoalModeState } from "../goals/state";
|
|
38
38
|
import type { HindsightSessionState } from "../hindsight/state";
|
|
39
|
+
import type { IrcMessage } from "../irc/bus";
|
|
39
40
|
import { type MnemopiSessionState } from "../mnemopi/state";
|
|
40
41
|
import type { PlanModeState } from "../plan-mode/state";
|
|
41
|
-
import { type AgentRegistry } from "../registry/agent-registry";
|
|
42
42
|
import { type SecretObfuscator } from "../secrets/obfuscator";
|
|
43
43
|
import { type ConfiguredThinkingLevel } from "../thinking";
|
|
44
44
|
import { type DiscoverableTool, type DiscoverableToolSearchIndex } from "../tool-discovery/tool-index";
|
|
@@ -54,10 +54,10 @@ import { YieldQueue } from "./yield-queue";
|
|
|
54
54
|
export type AgentSessionEvent = AgentEvent | {
|
|
55
55
|
type: "auto_compaction_start";
|
|
56
56
|
reason: "threshold" | "overflow" | "idle" | "incomplete";
|
|
57
|
-
action: "context-full" | "handoff" | "shake";
|
|
57
|
+
action: "context-full" | "handoff" | "shake" | "snapcompact";
|
|
58
58
|
} | {
|
|
59
59
|
type: "auto_compaction_end";
|
|
60
|
-
action: "context-full" | "handoff" | "shake";
|
|
60
|
+
action: "context-full" | "handoff" | "shake" | "snapcompact";
|
|
61
61
|
result: CompactionResult | undefined;
|
|
62
62
|
aborted: boolean;
|
|
63
63
|
willRetry: boolean;
|
|
@@ -214,8 +214,6 @@ export interface AgentSessionConfig {
|
|
|
214
214
|
asyncJobManager?: AsyncJobManager;
|
|
215
215
|
/** Agent identity (registry id like "Main" or "Alice") used for IRC routing. */
|
|
216
216
|
agentId?: string;
|
|
217
|
-
/** Shared agent registry (for forwarding IRC observations to the main session UI). */
|
|
218
|
-
agentRegistry?: AgentRegistry;
|
|
219
217
|
/**
|
|
220
218
|
* Override the provider-facing session ID for all API requests from this session.
|
|
221
219
|
* When absent, `sessionManager.getSessionId()` is used. Needed when benchmark or
|
|
@@ -380,6 +378,16 @@ export declare class AgentSession {
|
|
|
380
378
|
* Multiple listeners can be added. Returns unsubscribe function for this listener.
|
|
381
379
|
*/
|
|
382
380
|
subscribe(listener: AgentSessionEventListener): () => void;
|
|
381
|
+
/**
|
|
382
|
+
* Synchronously mark the session as disposing so new work is rejected
|
|
383
|
+
* immediately: Python/eval starts throw, queued asides are dropped, and the
|
|
384
|
+
* aside provider is detached. Idempotent; `dispose()` runs it first.
|
|
385
|
+
*
|
|
386
|
+
* Wrappers that await other teardown before delegating to `dispose()` MUST
|
|
387
|
+
* call this before their first await — otherwise work started in that async
|
|
388
|
+
* gap slips past the disposal guards.
|
|
389
|
+
*/
|
|
390
|
+
beginDispose(): void;
|
|
383
391
|
/**
|
|
384
392
|
* Remove all listeners, flush pending writes, and disconnect from agent.
|
|
385
393
|
* Call this when completely done with the session.
|
|
@@ -483,6 +491,13 @@ export declare class AgentSession {
|
|
|
483
491
|
/** All messages including custom types like BashExecutionMessage */
|
|
484
492
|
get messages(): AgentMessage[];
|
|
485
493
|
buildDisplaySessionContext(): SessionContext;
|
|
494
|
+
/**
|
|
495
|
+
* Full-history transcript for TUI display: every path entry in
|
|
496
|
+
* chronological order with compactions rendered inline at the point they
|
|
497
|
+
* fired (instead of replacing prior history). Display-only — NEVER feed
|
|
498
|
+
* the result to `agent.replaceMessages` or a provider.
|
|
499
|
+
*/
|
|
500
|
+
buildTranscriptSessionContext(): SessionContext;
|
|
486
501
|
/** Convert session messages using the same pre-LLM pipeline as the active session. */
|
|
487
502
|
convertMessagesToLlm(messages: AgentMessage[], signal?: AbortSignal): Promise<Message[]>;
|
|
488
503
|
/** Apply session-level stream hooks to a direct side request. */
|
|
@@ -910,27 +925,23 @@ export declare class AgentSession {
|
|
|
910
925
|
/** Whether there are pending Python messages waiting to be flushed */
|
|
911
926
|
get hasPendingPythonMessages(): boolean;
|
|
912
927
|
/**
|
|
913
|
-
*
|
|
914
|
-
*
|
|
928
|
+
* Deliver an IRC message into this session (recipient side; called by the
|
|
929
|
+
* IrcBus). Emits the `irc_message` session event for UI cards and injects
|
|
930
|
+
* the rendered message into the model's context as an `irc:incoming`
|
|
931
|
+
* custom message:
|
|
915
932
|
*
|
|
916
|
-
*
|
|
917
|
-
*
|
|
918
|
-
*
|
|
919
|
-
*
|
|
920
|
-
*
|
|
921
|
-
*
|
|
922
|
-
*/
|
|
923
|
-
|
|
924
|
-
from: string;
|
|
925
|
-
message: string;
|
|
926
|
-
awaitReply?: boolean;
|
|
927
|
-
signal?: AbortSignal;
|
|
928
|
-
}): Promise<{
|
|
929
|
-
replyText: string | null;
|
|
930
|
-
}>;
|
|
933
|
+
* - mid-turn → queued on the aside channel and folded in at the next step
|
|
934
|
+
* boundary (non-interrupting, like async-result deliveries) → "injected";
|
|
935
|
+
* - idle → starts a real turn with the message so the recipient wakes
|
|
936
|
+
* → "woken".
|
|
937
|
+
*
|
|
938
|
+
* Never blocks on the recipient's turn: the wake turn is fire-and-forget.
|
|
939
|
+
*/
|
|
940
|
+
deliverIrcMessage(msg: IrcMessage): Promise<"injected" | "woken">;
|
|
931
941
|
/**
|
|
932
942
|
* Emit an IRC relay observation event on this session for UI rendering only.
|
|
933
|
-
* Does not persist the record to history.
|
|
943
|
+
* Does not persist the record to history. Called by the IrcBus to surface
|
|
944
|
+
* agent↔agent traffic on the main session.
|
|
934
945
|
*/
|
|
935
946
|
emitIrcRelayObservation(record: CustomMessage): void;
|
|
936
947
|
/**
|
|
@@ -939,7 +950,7 @@ export declare class AgentSession {
|
|
|
939
950
|
* does not block on, or interfere with, any in-flight main turn. The
|
|
940
951
|
* session's history and persisted state are NOT modified by this call.
|
|
941
952
|
*
|
|
942
|
-
* Used by `
|
|
953
|
+
* Used by `BtwController` (`/btw`) and `OmfgController` (`/omfg`) to share
|
|
943
954
|
* the snapshot + stream pipeline. The snapshot includes any in-flight
|
|
944
955
|
* streaming assistant text so the model sees the half-finished response
|
|
945
956
|
* rather than missing context.
|
|
@@ -1045,12 +1056,6 @@ export declare class AgentSession {
|
|
|
1045
1056
|
* Includes user messages, assistant text, thinking blocks, tool calls, and tool results.
|
|
1046
1057
|
*/
|
|
1047
1058
|
formatSessionAsText(): string;
|
|
1048
|
-
/**
|
|
1049
|
-
* Format the conversation as compact context for subagents.
|
|
1050
|
-
* Includes only user messages and assistant text responses.
|
|
1051
|
-
* Excludes: system prompt, tool definitions, tool calls/results, thinking blocks.
|
|
1052
|
-
*/
|
|
1053
|
-
formatCompactContext(): string;
|
|
1054
1059
|
/**
|
|
1055
1060
|
* Check if extensions have handlers for a specific event type.
|
|
1056
1061
|
*/
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import type { AgentMessage } from "@oh-my-pi/pi-agent-core";
|
|
8
8
|
import { type BranchSummaryMessage, type CompactionSummaryMessage } from "@oh-my-pi/pi-agent-core/compaction/messages";
|
|
9
9
|
import type { AssistantMessage, ImageContent, Message, MessageAttribution, TextContent } from "@oh-my-pi/pi-ai";
|
|
10
|
-
export { type BranchSummaryMessage, type CompactionSummaryMessage, createBranchSummaryMessage, createCompactionSummaryMessage, } from "@oh-my-pi/pi-agent-core/compaction/messages";
|
|
10
|
+
export { type BranchSummaryMessage, type CompactionSummaryMessage, createBranchSummaryMessage, createCompactionSummaryMessage, createCustomMessage, } from "@oh-my-pi/pi-agent-core/compaction/messages";
|
|
11
11
|
import type { OutputMeta } from "../tools/output-meta";
|
|
12
12
|
export declare const SKILL_PROMPT_MESSAGE_TYPE = "skill-prompt";
|
|
13
13
|
export declare const LSP_LATE_DIAGNOSTIC_MESSAGE_TYPE = "lsp-late-diagnostic";
|
|
@@ -33,7 +33,7 @@ export interface SkillPromptDetails {
|
|
|
33
33
|
*
|
|
34
34
|
* Consumers: `AgentSession.#handleAgentEvent` (stamper) writes this value;
|
|
35
35
|
* `EventController.#handleMessageEnd`, `AssistantMessageComponent`,
|
|
36
|
-
* `ui-helpers.addMessageToChat` (renderers), `
|
|
36
|
+
* `ui-helpers.addMessageToChat` (renderers), `AgentHubOverlayComponent
|
|
37
37
|
* #buildTranscriptLines`, `runPrintMode`, and `AcpAgent#replayAssistantMessage`
|
|
38
38
|
* (fallback error emission) read it via `isSilentAbort`. */
|
|
39
39
|
export declare const SILENT_ABORT_MARKER = "__omp.silent_abort__";
|
|
@@ -175,8 +175,6 @@ export declare function bashExecutionToText(msg: BashExecutionMessage): string;
|
|
|
175
175
|
*/
|
|
176
176
|
export declare function pythonExecutionToText(msg: PythonExecutionMessage): string;
|
|
177
177
|
export declare function sanitizeRehydratedOpenAIResponsesAssistantMessage(message: AssistantMessage): AssistantMessage;
|
|
178
|
-
/** Convert CustomMessageEntry to AgentMessage format */
|
|
179
|
-
export declare function createCustomMessage(customType: string, content: string | (TextContent | ImageContent)[], display: boolean, details: unknown | undefined, timestamp: string, attribution?: MessageAttribution): CustomMessage;
|
|
180
178
|
/**
|
|
181
179
|
* Transform AgentMessages (including custom types) to LLM-compatible Messages.
|
|
182
180
|
*
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface HistoryFormatOptions {
|
|
2
|
+
/** Optional H1 prepended to the transcript. */
|
|
3
|
+
title?: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Format a session's message array as a concise markdown transcript.
|
|
7
|
+
*
|
|
8
|
+
* `messages` is the session's in-memory message array (or the read-only
|
|
9
|
+
* equivalent loaded from a session file) — the same shapes
|
|
10
|
+
* `session-dump-format.ts` consumes.
|
|
11
|
+
*/
|
|
12
|
+
export declare function formatSessionHistoryMarkdown(messages: unknown[], opts?: HistoryFormatOptions): string;
|
|
@@ -214,14 +214,31 @@ export declare function migrateSessionEntries(entries: FileEntry[]): void;
|
|
|
214
214
|
/** Exported for compaction.test.ts */
|
|
215
215
|
export declare function parseSessionEntries(content: string): FileEntry[];
|
|
216
216
|
export declare function getLatestCompactionEntry(entries: SessionEntry[]): CompactionEntry | null;
|
|
217
|
+
export interface BuildSessionContextOptions {
|
|
218
|
+
/**
|
|
219
|
+
* Build the full-history display transcript instead of the LLM context:
|
|
220
|
+
* every path entry in chronological order, with each compaction emitted
|
|
221
|
+
* inline as a `compactionSummary` message at the position it fired rather
|
|
222
|
+
* than replacing the history before it. Display-only — never send the
|
|
223
|
+
* result to a provider.
|
|
224
|
+
*/
|
|
225
|
+
transcript?: boolean;
|
|
226
|
+
}
|
|
217
227
|
/**
|
|
218
228
|
* Build the session context from entries using tree traversal.
|
|
219
229
|
* If leafId is provided, walks from that entry to root.
|
|
220
230
|
* Handles compaction and branch summaries along the path.
|
|
221
231
|
*/
|
|
222
|
-
export declare function buildSessionContext(entries: SessionEntry[], leafId?: string | null, byId?: Map<string, SessionEntry
|
|
232
|
+
export declare function buildSessionContext(entries: SessionEntry[], leafId?: string | null, byId?: Map<string, SessionEntry>, options?: BuildSessionContextOptions): SessionContext;
|
|
223
233
|
/** Exported for testing */
|
|
224
234
|
export declare function loadEntriesFromFile(filePath: string, storage?: SessionStorage): Promise<FileEntry[]>;
|
|
235
|
+
/**
|
|
236
|
+
* Read-only message view of a session file: load entries, migrate to the
|
|
237
|
+
* current version, resolve blob refs, and build the context along the
|
|
238
|
+
* persisted leaf path (last entry). Does NOT create a writer or take the
|
|
239
|
+
* session lock — safe to call against a file another session is writing.
|
|
240
|
+
*/
|
|
241
|
+
export declare function loadSessionMessagesReadOnly(filePath: string): Promise<AgentMessage[]>;
|
|
225
242
|
declare class RecentSessionInfo {
|
|
226
243
|
#private;
|
|
227
244
|
readonly path: string;
|
|
@@ -507,10 +524,11 @@ export declare class SessionManager {
|
|
|
507
524
|
*/
|
|
508
525
|
getBranch(fromId?: string): SessionEntry[];
|
|
509
526
|
/**
|
|
510
|
-
* Build the session context (what gets sent to the LLM)
|
|
527
|
+
* Build the session context (what gets sent to the LLM), or — with
|
|
528
|
+
* `{ transcript: true }` — the full-history display transcript.
|
|
511
529
|
* Uses tree traversal from current leaf.
|
|
512
530
|
*/
|
|
513
|
-
buildSessionContext(): SessionContext;
|
|
531
|
+
buildSessionContext(options?: BuildSessionContextOptions): SessionContext;
|
|
514
532
|
/** Strip stale OpenAI Responses assistant replay metadata from loaded in-memory entries. */
|
|
515
533
|
sanitizeLoadedOpenAIResponsesReplayMetadata(): boolean;
|
|
516
534
|
/**
|
|
@@ -159,6 +159,29 @@ export declare function formatMiddleElisionMarker(elidedLines: number, elidedByt
|
|
|
159
159
|
* budget is empty or the content already fits.
|
|
160
160
|
*/
|
|
161
161
|
export declare function truncateMiddle(content: string, options?: TruncationOptions): TruncationResult;
|
|
162
|
+
/** Options for {@link enforceInlineByteCap}. */
|
|
163
|
+
export interface InlineByteCapOptions {
|
|
164
|
+
/** Inline byte budget. Defaults to {@link DEFAULT_MAX_BYTES}. */
|
|
165
|
+
maxBytes?: number;
|
|
166
|
+
/** What the text is, for the elision marker (e.g. "bash output"). */
|
|
167
|
+
label: string;
|
|
168
|
+
/**
|
|
169
|
+
* Persist the full text as a session artifact. When an artifact id is
|
|
170
|
+
* returned, a `[raw output: artifact://<id>]` footer is appended so the
|
|
171
|
+
* elided bytes stay recoverable.
|
|
172
|
+
*/
|
|
173
|
+
saveArtifact?: (full: string) => string | undefined | Promise<string | undefined>;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Final-defense inline size guard for tool results.
|
|
177
|
+
*
|
|
178
|
+
* No-op when `text` fits within `maxBytes` (the common path). Otherwise keeps
|
|
179
|
+
* ~60% of the budget from the head and ~25% from the tail — cut on line
|
|
180
|
+
* boundaries, never splitting a multi-byte UTF-8 sequence — with an elision
|
|
181
|
+
* marker between. The remaining ~15% is slack for the marker and the optional
|
|
182
|
+
* `[raw output: artifact://<id>]` footer, so the result stays under `maxBytes`.
|
|
183
|
+
*/
|
|
184
|
+
export declare function enforceInlineByteCap(text: string, options: InlineByteCapOptions): Promise<string>;
|
|
162
185
|
export declare class TailBuffer {
|
|
163
186
|
#private;
|
|
164
187
|
readonly maxBytes: number;
|
|
@@ -22,6 +22,16 @@ import type { ContextFileEntry } from "../tools";
|
|
|
22
22
|
import type { EventBus } from "../utils/event-bus";
|
|
23
23
|
import type { WorkspaceTree } from "../workspace-tree";
|
|
24
24
|
import { type AgentDefinition, type AgentProgress, type ReviewFinding, type SingleResult } from "./types";
|
|
25
|
+
/**
|
|
26
|
+
* Soft per-agent request budgets (assistant requests per run). When a subagent
|
|
27
|
+
* crosses its budget it receives ONE steering notice asking it to wrap up; at
|
|
28
|
+
* 1.5x the budget the run is aborted gracefully so partial output is salvaged.
|
|
29
|
+
* The `default` key applies to agents without an explicit entry and can be
|
|
30
|
+
* overridden via the `task.softRequestBudget` setting (0 disables the guard).
|
|
31
|
+
*/
|
|
32
|
+
export declare const SOFT_REQUEST_BUDGET: Record<string, number>;
|
|
33
|
+
/** Steering notice injected once when a subagent crosses its soft request budget. */
|
|
34
|
+
export declare function buildBudgetNotice(requests: number): string;
|
|
25
35
|
/** Options for subagent execution */
|
|
26
36
|
export interface ExecutorOptions {
|
|
27
37
|
cwd: string;
|
|
@@ -29,6 +39,7 @@ export interface ExecutorOptions {
|
|
|
29
39
|
agent: AgentDefinition;
|
|
30
40
|
task: string;
|
|
31
41
|
assignment?: string;
|
|
42
|
+
/** Shared background from the task call (`task.batch`), rendered into the subagent's system prompt. */
|
|
32
43
|
context?: string;
|
|
33
44
|
/**
|
|
34
45
|
* The session's active overall plan, handed off so subagents spawned during
|
|
@@ -66,8 +77,6 @@ export interface ExecutorOptions {
|
|
|
66
77
|
sessionFile?: string | null;
|
|
67
78
|
persistArtifacts?: boolean;
|
|
68
79
|
artifactsDir?: string;
|
|
69
|
-
/** Path to parent conversation context file */
|
|
70
|
-
contextFile?: string;
|
|
71
80
|
eventBus?: EventBus;
|
|
72
81
|
contextFiles?: ContextFileEntry[];
|
|
73
82
|
skills?: Skill[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AgentTool, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core";
|
|
2
2
|
import type { ToolSession } from "..";
|
|
3
3
|
import type { Theme } from "../modes/theme/theme";
|
|
4
|
-
import { type AgentDefinition, type TaskToolDetails, type TaskToolSchemaInstance } from "./types";
|
|
4
|
+
import { type AgentDefinition, type SingleResult, type TaskToolDetails, type TaskToolSchemaInstance } from "./types";
|
|
5
5
|
import "../tools/review";
|
|
6
6
|
import { renderResult, renderCall as renderTaskCall } from "./render";
|
|
7
7
|
export { loadBundledAgents as BUNDLED_AGENTS } from "./agents";
|
|
@@ -12,11 +12,18 @@ export type { AgentDefinition, AgentProgress, SingleResult, SubagentEventPayload
|
|
|
12
12
|
export { TASK_SUBAGENT_EVENT_CHANNEL, TASK_SUBAGENT_LIFECYCLE_CHANNEL, TASK_SUBAGENT_PROGRESS_CHANNEL, taskSchema, } from "./types";
|
|
13
13
|
export declare const READ_ONLY_TOOL_NAMES: ReadonlySet<string>;
|
|
14
14
|
export declare function isReadOnlyAgent(agent: AgentDefinition): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Preview text for a child result. Falls back to "(no output)" — annotated
|
|
17
|
+
* with the request count when the child actually did work, so the parent can
|
|
18
|
+
* tell a no-op child from one that burned requests before being cancelled.
|
|
19
|
+
*/
|
|
20
|
+
export declare function formatResultOutputFallback(result: Pick<SingleResult, "output" | "stderr" | "requests">): string;
|
|
15
21
|
/**
|
|
16
22
|
* Task tool - Delegate tasks to specialized agents.
|
|
17
23
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
24
|
+
* Each call spawns one subagent — or, with `task.batch`, one per `tasks[]`
|
|
25
|
+
* item. When `async.enabled` is on, spawns run as AsyncJobManager jobs; when
|
|
26
|
+
* disabled, the tool blocks until every spawn finishes.
|
|
20
27
|
*/
|
|
21
28
|
export declare class TaskTool implements AgentTool<TaskToolSchemaInstance, TaskToolDetails, Theme> {
|
|
22
29
|
#private;
|
|
@@ -25,7 +32,7 @@ export declare class TaskTool implements AgentTool<TaskToolSchemaInstance, TaskT
|
|
|
25
32
|
readonly approval: "exec";
|
|
26
33
|
readonly formatApprovalDetails: (args: unknown) => string[];
|
|
27
34
|
readonly label = "Task";
|
|
28
|
-
readonly summary = "Spawn
|
|
35
|
+
readonly summary = "Spawn subagents to complete delegated tasks";
|
|
29
36
|
readonly strict = true;
|
|
30
37
|
readonly loadMode = "discoverable";
|
|
31
38
|
readonly renderResult: typeof renderResult;
|
|
@@ -17,11 +17,4 @@ export declare class AgentOutputManager {
|
|
|
17
17
|
* @returns Unique ID ("Anna" first, then "Anna-2", "Anna-3", …)
|
|
18
18
|
*/
|
|
19
19
|
allocate(id: string): Promise<string>;
|
|
20
|
-
/**
|
|
21
|
-
* Allocate unique IDs for a batch of tasks.
|
|
22
|
-
*
|
|
23
|
-
* @param ids Array of requested IDs
|
|
24
|
-
* @returns Array of unique IDs in same order
|
|
25
|
-
*/
|
|
26
|
-
allocateBatch(ids: string[]): Promise<string[]>;
|
|
27
20
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Repair double-encoded JSON string arguments for the task tool.
|
|
3
3
|
*
|
|
4
4
|
* Models occasionally JSON-escape a string value twice when emitting a
|
|
5
|
-
* `task` tool call, so
|
|
5
|
+
* `task` tool call, so an `assignment` that should read
|
|
6
6
|
*
|
|
7
7
|
* # Role
|
|
8
8
|
* You are a judge … "describe this" … return —
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
* string.
|
|
25
25
|
*
|
|
26
26
|
* This is deliberately scoped to the task tool's natural-language fields
|
|
27
|
-
* (`
|
|
27
|
+
* (`assignment`, `description`). It is NOT applied to code-bearing
|
|
28
28
|
* tools (write/edit/bash/search), where a backslash or quote is load-bearing
|
|
29
29
|
* and a false-positive unescape would silently corrupt a file or command.
|
|
30
30
|
*/
|
|
@@ -43,10 +43,11 @@ import type { TaskParams } from "./types";
|
|
|
43
43
|
*/
|
|
44
44
|
export declare function repairDoubleEncodedJsonString(value: string): string;
|
|
45
45
|
/**
|
|
46
|
-
* Repair double-encoded prose in task-tool params (`
|
|
47
|
-
* `
|
|
48
|
-
* so callers can cheaply skip
|
|
49
|
-
* (missing/undefined fields,
|
|
50
|
-
* path as well as on
|
|
46
|
+
* Repair double-encoded prose in task-tool params (`assignment`,
|
|
47
|
+
* `description`, shared `context`, and each batch task item's prose fields).
|
|
48
|
+
* Returns the same reference when nothing changed so callers can cheaply skip
|
|
49
|
+
* work. Defensive against partially-streamed args (missing/undefined fields,
|
|
50
|
+
* partial task arrays) so it is safe on the render path as well as on
|
|
51
|
+
* execution.
|
|
51
52
|
*/
|
|
52
53
|
export declare function repairTaskParams(params: TaskParams): TaskParams;
|
|
@@ -2,7 +2,6 @@ import type { ThinkingLevel } from "@oh-my-pi/pi-agent-core";
|
|
|
2
2
|
import type { Usage } from "@oh-my-pi/pi-ai";
|
|
3
3
|
import * as z from "zod/v4";
|
|
4
4
|
import type { AgentSessionEvent } from "../session/agent-session";
|
|
5
|
-
import { type TaskSimpleMode } from "./simple-mode";
|
|
6
5
|
import type { NestedRepoPatch } from "./worktree";
|
|
7
6
|
/** Source of an agent definition */
|
|
8
7
|
export type AgentSource = "bundled" | "user" | "project";
|
|
@@ -43,85 +42,86 @@ export interface SubagentLifecyclePayload {
|
|
|
43
42
|
parentToolCallId?: string;
|
|
44
43
|
index: number;
|
|
45
44
|
}
|
|
46
|
-
/** Single task item for parallel execution (default shape with context enabled). */
|
|
47
45
|
export declare const taskItemSchema: z.ZodObject<{
|
|
48
|
-
id: z.ZodString
|
|
49
|
-
description: z.ZodString
|
|
46
|
+
id: z.ZodOptional<z.ZodString>;
|
|
47
|
+
description: z.ZodOptional<z.ZodString>;
|
|
50
48
|
assignment: z.ZodString;
|
|
51
49
|
}, z.core.$strip>;
|
|
52
|
-
|
|
50
|
+
/** Single task item. Fields are optional defensively: args stream in token by token. */
|
|
51
|
+
export interface TaskItem {
|
|
52
|
+
/** Stable agent id; default = generated AdjectiveNoun. */
|
|
53
|
+
id?: string;
|
|
54
|
+
/** UI label, not seen by the subagent. */
|
|
55
|
+
description?: string;
|
|
56
|
+
/** The work; required by the schema. */
|
|
57
|
+
assignment?: string;
|
|
58
|
+
/** Run this spawn in an isolated worktree (batch form; flat form carries it top-level). */
|
|
59
|
+
isolated?: boolean;
|
|
60
|
+
}
|
|
53
61
|
export declare const taskSchema: z.ZodObject<{
|
|
62
|
+
id: z.ZodOptional<z.ZodString>;
|
|
63
|
+
description: z.ZodOptional<z.ZodString>;
|
|
64
|
+
assignment: z.ZodString;
|
|
65
|
+
isolated: z.ZodOptional<z.ZodBoolean>;
|
|
54
66
|
agent: z.ZodString;
|
|
55
|
-
tasks: z.ZodArray<z.ZodObject<{
|
|
56
|
-
id: z.ZodString;
|
|
57
|
-
description: z.ZodString;
|
|
58
|
-
assignment: z.ZodString;
|
|
59
|
-
}, z.core.$strip>>;
|
|
60
|
-
}, z.core.$strip>;
|
|
61
|
-
export declare const taskSchemaNoIsolation: z.ZodObject<{
|
|
62
|
-
agent: z.ZodString;
|
|
63
|
-
tasks: z.ZodArray<z.ZodObject<{
|
|
64
|
-
id: z.ZodString;
|
|
65
|
-
description: z.ZodString;
|
|
66
|
-
assignment: z.ZodString;
|
|
67
|
-
}, z.core.$strip>>;
|
|
68
67
|
}, z.core.$strip>;
|
|
69
68
|
declare const ALL_TASK_SCHEMAS: readonly [z.ZodObject<{
|
|
69
|
+
id: z.ZodOptional<z.ZodString>;
|
|
70
|
+
description: z.ZodOptional<z.ZodString>;
|
|
71
|
+
assignment: z.ZodString;
|
|
72
|
+
isolated: z.ZodOptional<z.ZodBoolean>;
|
|
70
73
|
agent: z.ZodString;
|
|
71
|
-
tasks: z.ZodArray<z.ZodObject<{
|
|
72
|
-
id: z.ZodString;
|
|
73
|
-
description: z.ZodString;
|
|
74
|
-
assignment: z.ZodString;
|
|
75
|
-
}, z.core.$strip>>;
|
|
76
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
77
|
-
agent: z.ZodString;
|
|
78
|
-
tasks: z.ZodArray<z.ZodObject<{
|
|
79
|
-
id: z.ZodString;
|
|
80
|
-
description: z.ZodString;
|
|
81
|
-
assignment: z.ZodString;
|
|
82
|
-
}, z.core.$strip>>;
|
|
83
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
84
|
-
agent: z.ZodString;
|
|
85
|
-
tasks: z.ZodArray<z.ZodObject<{
|
|
86
|
-
id: z.ZodString;
|
|
87
|
-
description: z.ZodString;
|
|
88
|
-
assignment: z.ZodString;
|
|
89
|
-
}, z.core.$strip>>;
|
|
90
74
|
}, z.core.$strip>, z.ZodObject<{
|
|
75
|
+
id: z.ZodOptional<z.ZodString>;
|
|
76
|
+
description: z.ZodOptional<z.ZodString>;
|
|
77
|
+
assignment: z.ZodString;
|
|
91
78
|
agent: z.ZodString;
|
|
92
|
-
tasks: z.ZodArray<z.ZodObject<{
|
|
93
|
-
id: z.ZodString;
|
|
94
|
-
description: z.ZodString;
|
|
95
|
-
assignment: z.ZodString;
|
|
96
|
-
}, z.core.$strip>>;
|
|
97
79
|
}, z.core.$strip>, z.ZodObject<{
|
|
98
80
|
agent: z.ZodString;
|
|
81
|
+
context: z.ZodString;
|
|
99
82
|
tasks: z.ZodArray<z.ZodObject<{
|
|
100
|
-
id: z.ZodString
|
|
101
|
-
description: z.ZodString
|
|
83
|
+
id: z.ZodOptional<z.ZodString>;
|
|
84
|
+
description: z.ZodOptional<z.ZodString>;
|
|
102
85
|
assignment: z.ZodString;
|
|
86
|
+
isolated: z.ZodOptional<z.ZodBoolean>;
|
|
103
87
|
}, z.core.$strip>>;
|
|
104
88
|
}, z.core.$strip>, z.ZodObject<{
|
|
105
89
|
agent: z.ZodString;
|
|
90
|
+
context: z.ZodString;
|
|
106
91
|
tasks: z.ZodArray<z.ZodObject<{
|
|
107
|
-
id: z.ZodString
|
|
108
|
-
description: z.ZodString
|
|
92
|
+
id: z.ZodOptional<z.ZodString>;
|
|
93
|
+
description: z.ZodOptional<z.ZodString>;
|
|
109
94
|
assignment: z.ZodString;
|
|
110
95
|
}, z.core.$strip>>;
|
|
111
96
|
}, z.core.$strip>];
|
|
112
97
|
type DynamicTaskSchema = (typeof ALL_TASK_SCHEMAS)[number];
|
|
113
98
|
export type TaskSchema = typeof taskSchema;
|
|
114
|
-
/** Active task tool parameter schema for the current
|
|
99
|
+
/** Active task tool parameter schema for the current isolation / batch flags */
|
|
115
100
|
export type TaskToolSchemaInstance = DynamicTaskSchema;
|
|
116
101
|
export declare function getTaskSchema(options: {
|
|
117
102
|
isolationEnabled: boolean;
|
|
118
|
-
|
|
103
|
+
batchEnabled: boolean;
|
|
119
104
|
}): DynamicTaskSchema;
|
|
105
|
+
/**
|
|
106
|
+
* Runtime params union over both wire shapes. The model sees exactly one shape
|
|
107
|
+
* (`{ agent, context, tasks[] }` when `task.batch` is on, `{ agent, ...item }`
|
|
108
|
+
* otherwise); runtime stays permissive so internal callers and stale
|
|
109
|
+
* transcripts using the flat form keep working under either setting.
|
|
110
|
+
*/
|
|
120
111
|
export interface TaskParams {
|
|
121
|
-
|
|
112
|
+
/** Agent type; required. */
|
|
113
|
+
agent?: string;
|
|
114
|
+
/** Stable agent id (flat form); default = generated AdjectiveNoun. */
|
|
115
|
+
id?: string;
|
|
116
|
+
/** UI label (flat form), not seen by the subagent. */
|
|
117
|
+
description?: string;
|
|
118
|
+
/** The work (flat form). */
|
|
119
|
+
assignment?: string;
|
|
120
|
+
/** Batch form (`task.batch`): one subagent per item. */
|
|
121
|
+
tasks?: TaskItem[];
|
|
122
|
+
/** Batch form: shared background prepended to every assignment; required by the batch schema. */
|
|
122
123
|
context?: string;
|
|
123
|
-
|
|
124
|
-
tasks: TaskItem[];
|
|
124
|
+
/** Run in an isolated worktree (flat form; per-item in batch form). */
|
|
125
125
|
isolated?: boolean;
|
|
126
126
|
}
|
|
127
127
|
/** A code review finding reported by the reviewer agent */
|
|
@@ -183,6 +183,8 @@ export interface AgentProgress {
|
|
|
183
183
|
}>;
|
|
184
184
|
recentOutput: string[];
|
|
185
185
|
toolCount: number;
|
|
186
|
+
/** Count of assistant requests (assistant message_end events) across the run. Drives the soft request budget guard. */
|
|
187
|
+
requests: number;
|
|
186
188
|
/** Cumulative input + output + cacheWrite tokens across all turns. Excludes cacheRead (re-reads cached context every turn, making cumulative sum misleading). */
|
|
187
189
|
tokens: number;
|
|
188
190
|
/**
|
|
@@ -252,6 +254,8 @@ export interface SingleResult {
|
|
|
252
254
|
durationMs: number;
|
|
253
255
|
/** Cumulative input + output + cacheWrite tokens across all turns. Excludes cacheRead (re-reads cached context every turn, making cumulative sum misleading). */
|
|
254
256
|
tokens: number;
|
|
257
|
+
/** Count of assistant requests (assistant message_end events) across the run. */
|
|
258
|
+
requests: number;
|
|
255
259
|
/** Latest per-turn context size at task completion. See `AgentProgress.contextTokens`. */
|
|
256
260
|
contextTokens?: number;
|
|
257
261
|
/** Model's context window in tokens, when known. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HTMLElement } from "linkedom";
|
|
2
|
-
import type { ElementHandle } from "puppeteer-core";
|
|
2
|
+
import type { ElementHandle, ImageFormat } from "puppeteer-core";
|
|
3
3
|
import type { Transport } from "./tab-protocol";
|
|
4
4
|
declare global {
|
|
5
5
|
interface Element extends HTMLElement {
|
|
@@ -23,6 +23,8 @@ export interface InflightOp {
|
|
|
23
23
|
}
|
|
24
24
|
/** Human-readable label for a screenshot op, used in op tracking + timeout errors. */
|
|
25
25
|
export declare function describeScreenshot(opts?: ScreenshotOptions): string;
|
|
26
|
+
/** Map an explicit save path's extension to a puppeteer capture format (default png). */
|
|
27
|
+
export declare function imageFormatForPath(filePath: string): ImageFormat;
|
|
26
28
|
/** Summarize still-running helpers (oldest first) so a cell timeout names what stalled. */
|
|
27
29
|
export declare function describeInflight(inflight: Map<number, InflightOp>): string;
|
|
28
30
|
export declare class WorkerCore {
|
|
@@ -14,17 +14,6 @@ declare const findSchema: z.ZodObject<{
|
|
|
14
14
|
timeout: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
15
15
|
}, z.core.$strict>;
|
|
16
16
|
export type FindToolInput = z.infer<typeof findSchema>;
|
|
17
|
-
/**
|
|
18
|
-
* Group find matches into a multi-level directory tree so the model doesn't pay
|
|
19
|
-
* repeated tokens for shared path prefixes. Single-child directory chains fold
|
|
20
|
-
* into one header (`# a/b/c/`), so a common prefix — including an absolute root
|
|
21
|
-
* for out-of-cwd results — collapses to a single line. Each level adds one `#`;
|
|
22
|
-
* files are listed bare under the deepest directory header that owns them.
|
|
23
|
-
*
|
|
24
|
-
* Order follows the input (mtime-desc for native glob): a directory appears when
|
|
25
|
-
* its first member is emitted, and a node's own files precede its subdirectories.
|
|
26
|
-
*/
|
|
27
|
-
export declare function formatFindGroupedOutput(paths: readonly string[]): string;
|
|
28
17
|
export interface FindToolDetails {
|
|
29
18
|
truncation?: TruncationResult;
|
|
30
19
|
resultLimitReached?: number;
|
|
@@ -1,51 +1,3 @@
|
|
|
1
|
-
interface PathTreeNode {
|
|
2
|
-
/** Direct file leaves, in first-seen order. */
|
|
3
|
-
files: Array<{
|
|
4
|
-
name: string;
|
|
5
|
-
key: string;
|
|
6
|
-
}>;
|
|
7
|
-
/** Dedup set for `files` (a glob can surface the same path twice on retry). */
|
|
8
|
-
fileNames: Set<string>;
|
|
9
|
-
/** Child directories, in first-seen order. */
|
|
10
|
-
subdirs: Array<{
|
|
11
|
-
name: string;
|
|
12
|
-
node: PathTreeNode;
|
|
13
|
-
}>;
|
|
14
|
-
/** Dedup index for `subdirs`. */
|
|
15
|
-
dirIndex: Map<string, PathTreeNode>;
|
|
16
|
-
}
|
|
17
|
-
export interface PathTreeInput {
|
|
18
|
-
/** Path string; absolute, cwd-relative, or url-like. Backslashes are normalized. */
|
|
19
|
-
path: string;
|
|
20
|
-
/** Whether the leaf itself is a directory (trailing-slash match from find). */
|
|
21
|
-
isDir: boolean;
|
|
22
|
-
/** Opaque key carried onto file events for section lookup. Defaults to `path`. */
|
|
23
|
-
key?: string;
|
|
24
|
-
}
|
|
25
|
-
/** One node emitted while walking the tree: a folded directory or a file leaf. */
|
|
26
|
-
export interface GroupedTreeEvent {
|
|
27
|
-
kind: "dir" | "file";
|
|
28
|
-
/** 0-based nesting depth (root children are depth 0). */
|
|
29
|
-
depth: number;
|
|
30
|
-
/** Folded chain for dirs (e.g. `a/b/c`, no trailing slash); basename for files. */
|
|
31
|
-
name: string;
|
|
32
|
-
/** File key for `kind === "file"`; empty string for directories. */
|
|
33
|
-
key: string;
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Build a directory tree from a flat list of paths. URL-like entries are kept
|
|
37
|
-
* whole as root-level file leaves (they have no meaningful directory structure).
|
|
38
|
-
* Absolute paths carry a leading empty segment so they share a common `/` root
|
|
39
|
-
* and fold like any other prefix.
|
|
40
|
-
*/
|
|
41
|
-
export declare function buildPathTree(entries: Iterable<PathTreeInput>): PathTreeNode;
|
|
42
|
-
/**
|
|
43
|
-
* Depth-first walk yielding directory and file events. Directories collapse their
|
|
44
|
-
* single-child chains (`a` → `a/b` → `a/b/c`) so a shared prefix becomes one
|
|
45
|
-
* header. Each node's direct files are emitted before its subdirectories, keeping
|
|
46
|
-
* a file unambiguously attached to the header above it.
|
|
47
|
-
*/
|
|
48
|
-
export declare function walkPathTree(node: PathTreeNode, depth?: number): Generator<GroupedTreeEvent>;
|
|
49
1
|
/**
|
|
50
2
|
* One file's contribution to a grouped file output. The header itself is generated
|
|
51
3
|
* by `formatGroupedFiles` (one `#` per nesting level); use `headerSuffix` to tack
|
|
@@ -116,4 +68,3 @@ export declare function classifyGroupedLines(lines: readonly string[], headerBas
|
|
|
116
68
|
* indices lets callers slice parallel arrays (raw lines, styled lines, contexts).
|
|
117
69
|
*/
|
|
118
70
|
export declare function groupLineIndicesByBlank(rawLines: readonly string[]): number[][];
|
|
119
|
-
export {};
|
|
@@ -13,7 +13,7 @@ import type { LocalProtocolOptions } from "../internal-urls";
|
|
|
13
13
|
import type { MCPManager } from "../mcp";
|
|
14
14
|
import type { MnemopiSessionState } from "../mnemopi/state";
|
|
15
15
|
import type { PlanModeState } from "../plan-mode/state";
|
|
16
|
-
import {
|
|
16
|
+
import type { AgentRegistry } from "../registry/agent-registry";
|
|
17
17
|
import type { ArtifactManager } from "../session/artifacts";
|
|
18
18
|
import type { ClientBridge } from "../session/client-bridge";
|
|
19
19
|
import type { CustomMessage } from "../session/messages";
|
|
@@ -220,8 +220,6 @@ export interface ToolSession {
|
|
|
220
220
|
recordEvalSubagentUsage?: (output: number) => void;
|
|
221
221
|
/** Bridge to the connected client (e.g. ACP editor host). Tools should route fs/terminal/permission requests through this when available. */
|
|
222
222
|
getClientBridge?: () => ClientBridge | undefined;
|
|
223
|
-
/** Get compact conversation context for subagents (excludes tool results, system prompts) */
|
|
224
|
-
getCompactContext?: () => string;
|
|
225
223
|
/** Get cached todo phases for this session. */
|
|
226
224
|
getTodoPhases?: () => TodoPhase[];
|
|
227
225
|
/** Replace cached todo phases for this session. */
|