@oh-my-pi/pi-coding-agent 15.9.67 → 15.10.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 +136 -0
- package/dist/types/cli/args.d.ts +1 -1
- package/dist/types/cli/dry-balance-cli.d.ts +15 -1
- package/dist/types/cli/gallery-cli.d.ts +43 -0
- package/dist/types/cli/gallery-fixtures/agentic.d.ts +2 -0
- package/dist/types/cli/gallery-fixtures/codeintel.d.ts +3 -0
- package/dist/types/cli/gallery-fixtures/edit.d.ts +3 -0
- package/dist/types/cli/gallery-fixtures/fs.d.ts +2 -0
- package/dist/types/cli/gallery-fixtures/index.d.ts +4 -0
- package/dist/types/cli/gallery-fixtures/interaction.d.ts +3 -0
- package/dist/types/cli/gallery-fixtures/memory.d.ts +2 -0
- package/dist/types/cli/gallery-fixtures/misc.d.ts +3 -0
- package/dist/types/cli/gallery-fixtures/search.d.ts +3 -0
- package/dist/types/cli/gallery-fixtures/shell.d.ts +3 -0
- package/dist/types/cli/gallery-fixtures/types.d.ts +44 -0
- package/dist/types/cli/gallery-fixtures/web.d.ts +2 -0
- package/dist/types/cli/gallery-screenshot.d.ts +35 -0
- package/dist/types/commands/gallery.d.ts +47 -0
- package/dist/types/commit/analysis/conventional.d.ts +2 -2
- package/dist/types/commit/analysis/summary.d.ts +2 -2
- package/dist/types/commit/changelog/generate.d.ts +2 -2
- package/dist/types/commit/changelog/index.d.ts +2 -2
- package/dist/types/commit/map-reduce/index.d.ts +3 -3
- package/dist/types/commit/map-reduce/map-phase.d.ts +2 -2
- package/dist/types/commit/map-reduce/reduce-phase.d.ts +2 -2
- package/dist/types/commit/model-selection.d.ts +10 -4
- package/dist/types/config/api-key-resolver.d.ts +34 -0
- package/dist/types/config/keybindings.d.ts +6 -1
- package/dist/types/config/model-id-affixes.d.ts +2 -0
- package/dist/types/config/model-registry.d.ts +25 -2
- package/dist/types/config/settings-schema.d.ts +41 -6
- package/dist/types/dap/config.d.ts +14 -1
- package/dist/types/dap/types.d.ts +10 -0
- package/dist/types/extensibility/plugins/marketplace-auto-update.d.ts +8 -0
- package/dist/types/lsp/types.d.ts +10 -0
- package/dist/types/lsp/utils.d.ts +3 -2
- package/dist/types/main.d.ts +3 -2
- package/dist/types/memory-backend/index.d.ts +2 -1
- package/dist/types/memory-backend/resolve.d.ts +1 -1
- package/dist/types/memory-backend/types.d.ts +1 -1
- package/dist/types/modes/components/chat-block.d.ts +64 -0
- package/dist/types/modes/components/custom-editor.d.ts +5 -1
- package/dist/types/modes/components/overlay-box.d.ts +17 -0
- package/dist/types/modes/components/plan-review-overlay.d.ts +59 -0
- package/dist/types/modes/components/plan-toc.d.ts +41 -0
- package/dist/types/modes/components/read-tool-group.d.ts +2 -0
- package/dist/types/modes/components/tool-execution.d.ts +18 -0
- package/dist/types/modes/components/transcript-container.d.ts +11 -0
- package/dist/types/modes/controllers/command-controller.d.ts +1 -0
- package/dist/types/modes/controllers/event-controller.d.ts +0 -1
- package/dist/types/modes/controllers/extension-ui-controller.d.ts +0 -1
- package/dist/types/modes/controllers/input-controller.d.ts +1 -1
- package/dist/types/modes/controllers/selector-controller.d.ts +1 -1
- package/dist/types/modes/controllers/streaming-reveal.d.ts +22 -0
- package/dist/types/modes/controllers/tan-command-controller.d.ts +6 -0
- package/dist/types/modes/index.d.ts +5 -4
- package/dist/types/modes/interactive-mode.d.ts +16 -6
- package/dist/types/modes/setup-version.d.ts +11 -0
- package/dist/types/modes/setup-wizard/index.d.ts +2 -1
- package/dist/types/modes/setup-wizard/scenes/web-search.d.ts +2 -1
- package/dist/types/modes/theme/theme.d.ts +1 -1
- package/dist/types/modes/types.d.ts +19 -6
- package/dist/types/modes/utils/copy-targets.d.ts +21 -1
- package/dist/types/plan-mode/approved-plan.d.ts +27 -8
- package/dist/types/plan-mode/plan-protection.d.ts +4 -4
- package/dist/types/sdk.d.ts +3 -1
- package/dist/types/session/agent-session.d.ts +21 -0
- package/dist/types/session/messages.d.ts +12 -0
- package/dist/types/session/session-manager.d.ts +3 -1
- package/dist/types/slash-commands/types.d.ts +4 -6
- package/dist/types/task/executor.d.ts +14 -0
- package/dist/types/task/index.d.ts +1 -0
- package/dist/types/task/render.d.ts +3 -2
- package/dist/types/telemetry-export.d.ts +1 -1
- package/dist/types/tools/archive-reader.d.ts +5 -0
- package/dist/types/tools/ast-edit.d.ts +3 -0
- package/dist/types/tools/ast-grep.d.ts +3 -0
- package/dist/types/tools/bash.d.ts +1 -0
- package/dist/types/tools/eval-render.d.ts +1 -8
- package/dist/types/tools/fetch.d.ts +15 -7
- package/dist/types/tools/find.d.ts +8 -4
- package/dist/types/tools/grouped-file-output.d.ts +95 -12
- package/dist/types/tools/memory-render.d.ts +4 -1
- package/dist/types/tools/plan-mode-guard.d.ts +8 -9
- package/dist/types/tools/render-utils.d.ts +13 -9
- package/dist/types/tools/renderers.d.ts +16 -2
- package/dist/types/tools/search.d.ts +5 -1
- package/dist/types/tools/sqlite-reader.d.ts +1 -0
- package/dist/types/tools/todo.d.ts +3 -2
- package/dist/types/tools/write.d.ts +5 -0
- package/dist/types/tui/output-block.d.ts +16 -4
- package/dist/types/tui/status-line.d.ts +3 -0
- package/dist/types/utils/enhanced-paste.d.ts +20 -0
- package/dist/types/web/scrapers/github.d.ts +22 -0
- package/dist/types/web/search/providers/kimi.d.ts +1 -1
- package/dist/types/web/search/providers/perplexity.d.ts +8 -1
- package/dist/types/web/search/types.d.ts +1 -1
- package/package.json +9 -9
- package/scripts/dev-launch +42 -0
- package/scripts/dev-launch-preload.ts +19 -0
- package/src/auto-thinking/classifier.ts +5 -1
- package/src/cli/args.ts +2 -2
- package/src/cli/dry-balance-cli.ts +52 -17
- package/src/cli/gallery-cli.ts +226 -0
- package/src/cli/gallery-fixtures/agentic.ts +292 -0
- package/src/cli/gallery-fixtures/codeintel.ts +188 -0
- package/src/cli/gallery-fixtures/edit.ts +194 -0
- package/src/cli/gallery-fixtures/fs.ts +153 -0
- package/src/cli/gallery-fixtures/index.ts +40 -0
- package/src/cli/gallery-fixtures/interaction.ts +49 -0
- package/src/cli/gallery-fixtures/memory.ts +81 -0
- package/src/cli/gallery-fixtures/misc.ts +250 -0
- package/src/cli/gallery-fixtures/search.ts +213 -0
- package/src/cli/gallery-fixtures/shell.ts +167 -0
- package/src/cli/gallery-fixtures/types.ts +41 -0
- package/src/cli/gallery-fixtures/web.ts +158 -0
- package/src/cli/gallery-screenshot.ts +279 -0
- package/src/cli-commands.ts +1 -0
- package/src/commands/gallery.ts +52 -0
- package/src/commands/launch.ts +1 -1
- package/src/commit/analysis/conventional.ts +2 -2
- package/src/commit/analysis/summary.ts +2 -2
- package/src/commit/changelog/generate.ts +2 -2
- package/src/commit/changelog/index.ts +2 -2
- package/src/commit/map-reduce/index.ts +3 -3
- package/src/commit/map-reduce/map-phase.ts +2 -2
- package/src/commit/map-reduce/reduce-phase.ts +2 -2
- package/src/commit/model-selection.ts +33 -9
- package/src/commit/pipeline.ts +4 -4
- package/src/config/api-key-resolver.ts +58 -0
- package/src/config/keybindings.ts +15 -6
- package/src/config/model-equivalence.ts +35 -12
- package/src/config/model-id-affixes.ts +39 -22
- package/src/config/model-registry.ts +41 -18
- package/src/config/settings-schema.ts +28 -5
- package/src/config/settings.ts +31 -2
- package/src/dap/client.ts +14 -16
- package/src/dap/config.ts +41 -2
- package/src/dap/defaults.json +1 -0
- package/src/dap/session.ts +1 -0
- package/src/dap/types.ts +10 -0
- package/src/debug/index.ts +40 -54
- package/src/edit/renderer.ts +111 -119
- package/src/eval/__tests__/agent-bridge.test.ts +75 -32
- package/src/eval/__tests__/llm-bridge.test.ts +90 -31
- package/src/eval/agent-bridge.ts +34 -7
- package/src/eval/llm-bridge.ts +8 -3
- package/src/extensibility/extensions/runner.ts +1 -0
- package/src/extensibility/plugins/doctor.ts +0 -1
- package/src/extensibility/plugins/marketplace-auto-update.ts +49 -0
- package/src/goals/tools/goal-tool.ts +37 -27
- package/src/internal-urls/docs-index.generated.ts +10 -10
- package/src/lsp/client.ts +104 -55
- package/src/lsp/types.ts +10 -0
- package/src/lsp/utils.ts +3 -2
- package/src/main.ts +53 -56
- package/src/memories/index.ts +12 -5
- package/src/memory-backend/index.ts +13 -1
- package/src/memory-backend/resolve.ts +3 -5
- package/src/memory-backend/types.ts +1 -1
- package/src/mnemopi/backend.ts +5 -1
- package/src/modes/acp/acp-agent.ts +33 -26
- package/src/modes/components/assistant-message.ts +2 -9
- package/src/modes/components/chat-block.ts +111 -0
- package/src/modes/components/copy-selector.ts +1 -44
- package/src/modes/components/custom-editor.ts +33 -1
- package/src/modes/components/custom-message.ts +1 -3
- package/src/modes/components/execution-shared.ts +1 -2
- package/src/modes/components/hook-message.ts +1 -3
- package/src/modes/components/overlay-box.ts +108 -0
- package/src/modes/components/plan-review-overlay.ts +799 -0
- package/src/modes/components/plan-toc.ts +138 -0
- package/src/modes/components/read-tool-group.ts +20 -4
- package/src/modes/components/skill-message.ts +0 -1
- package/src/modes/components/status-line.ts +3 -5
- package/src/modes/components/tips.txt +1 -0
- package/src/modes/components/todo-reminder.ts +0 -2
- package/src/modes/components/tool-execution.ts +115 -90
- package/src/modes/components/transcript-container.ts +84 -24
- package/src/modes/components/user-message.ts +1 -2
- package/src/modes/controllers/command-controller-shared.ts +7 -6
- package/src/modes/controllers/command-controller.ts +70 -57
- package/src/modes/controllers/event-controller.ts +41 -40
- package/src/modes/controllers/extension-ui-controller.ts +10 -73
- package/src/modes/controllers/input-controller.ts +135 -122
- package/src/modes/controllers/mcp-command-controller.ts +69 -60
- package/src/modes/controllers/selector-controller.ts +25 -27
- package/src/modes/controllers/streaming-reveal.ts +212 -0
- package/src/modes/controllers/tan-command-controller.ts +173 -0
- package/src/modes/index.ts +5 -4
- package/src/modes/interactive-mode.ts +171 -82
- package/src/modes/setup-version.ts +11 -0
- package/src/modes/setup-wizard/index.ts +3 -2
- package/src/modes/setup-wizard/scenes/web-search.ts +3 -2
- package/src/modes/setup-wizard/wizard-overlay.ts +1 -1
- package/src/modes/theme/theme-schema.json +1 -1
- package/src/modes/theme/theme.ts +8 -4
- package/src/modes/types.ts +19 -8
- package/src/modes/utils/context-usage.ts +10 -6
- package/src/modes/utils/copy-targets.ts +133 -27
- package/src/modes/utils/hotkeys-markdown.ts +1 -0
- package/src/modes/utils/ui-helpers.ts +44 -46
- package/src/plan-mode/approved-plan.ts +66 -43
- package/src/plan-mode/plan-protection.ts +4 -4
- package/src/prompts/system/background-tan-dispatch.md +8 -0
- package/src/prompts/system/plan-mode-active.md +67 -58
- package/src/prompts/system/plan-mode-approved.md +1 -1
- package/src/sdk.ts +32 -60
- package/src/session/agent-session.ts +89 -13
- package/src/session/messages.ts +26 -0
- package/src/session/session-manager.ts +13 -5
- package/src/slash-commands/builtin-registry.ts +37 -10
- package/src/slash-commands/helpers/usage-report.ts +2 -0
- package/src/slash-commands/types.ts +4 -6
- package/src/task/executor.ts +25 -4
- package/src/task/index.ts +4 -0
- package/src/task/render.ts +212 -148
- package/src/telemetry-export.ts +25 -7
- package/src/tools/archive-reader.ts +64 -0
- package/src/tools/ask.ts +119 -164
- package/src/tools/ast-edit.ts +98 -71
- package/src/tools/ast-grep.ts +37 -43
- package/src/tools/bash.ts +50 -6
- package/src/tools/debug.ts +20 -8
- package/src/tools/eval-backends.ts +6 -17
- package/src/tools/eval-render.ts +21 -18
- package/src/tools/eval.ts +5 -4
- package/src/tools/fetch.ts +391 -91
- package/src/tools/find.ts +44 -30
- package/src/tools/gh-renderer.ts +81 -42
- package/src/tools/grouped-file-output.ts +272 -48
- package/src/tools/image-gen.ts +150 -103
- package/src/tools/inspect-image-renderer.ts +63 -41
- package/src/tools/inspect-image.ts +8 -1
- package/src/tools/job.ts +3 -4
- package/src/tools/memory-render.ts +4 -1
- package/src/tools/plan-mode-guard.ts +21 -39
- package/src/tools/read.ts +23 -16
- package/src/tools/render-utils.ts +38 -40
- package/src/tools/renderers.ts +16 -1
- package/src/tools/report-tool-issue.ts +1 -1
- package/src/tools/resolve.ts +14 -0
- package/src/tools/search-tool-bm25.ts +36 -23
- package/src/tools/search.ts +189 -95
- package/src/tools/sqlite-reader.ts +9 -12
- package/src/tools/todo.ts +138 -59
- package/src/tools/write.ts +100 -60
- package/src/tui/output-block.ts +60 -13
- package/src/tui/status-line.ts +5 -1
- package/src/utils/commit-message-generator.ts +9 -1
- package/src/utils/enhanced-paste.ts +202 -0
- package/src/utils/title-generator.ts +2 -1
- package/src/web/scrapers/github.ts +255 -3
- package/src/web/scrapers/youtube.ts +3 -2
- package/src/web/search/providers/anthropic.ts +25 -19
- package/src/web/search/providers/exa.ts +11 -3
- package/src/web/search/providers/kimi.ts +28 -17
- package/src/web/search/providers/parallel.ts +35 -24
- package/src/web/search/providers/perplexity.ts +199 -51
- package/src/web/search/providers/synthetic.ts +8 -6
- package/src/web/search/providers/tavily.ts +9 -8
- package/src/web/search/providers/zai.ts +8 -6
- package/src/web/search/render.ts +39 -54
- package/src/web/search/types.ts +5 -1
- package/dist/types/eval/__tests__/shared-executors.test.d.ts +0 -1
- package/src/eval/__tests__/shared-executors.test.ts +0 -609
|
@@ -41,6 +41,6 @@ export declare class SelectorController {
|
|
|
41
41
|
handleResumeSession(sessionPath: string): Promise<void>;
|
|
42
42
|
handleSessionDeleteCommand(): Promise<void>;
|
|
43
43
|
showOAuthSelector(mode: "login" | "logout", providerId?: string): Promise<void>;
|
|
44
|
-
showDebugSelector(): void
|
|
44
|
+
showDebugSelector(): Promise<void>;
|
|
45
45
|
showSessionObserver(registry: SessionObserverRegistry): void;
|
|
46
46
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AssistantMessage } from "@oh-my-pi/pi-ai";
|
|
2
|
+
import type { AssistantMessageComponent } from "../components/assistant-message";
|
|
3
|
+
export declare const STREAMING_REVEAL_FRAME_MS: number;
|
|
4
|
+
export declare const MIN_STEP = 3;
|
|
5
|
+
export declare const CATCHUP_FRAMES = 8;
|
|
6
|
+
type StreamingRevealComponent = Pick<AssistantMessageComponent, "updateContent">;
|
|
7
|
+
type StreamingRevealControllerOptions = {
|
|
8
|
+
getSmoothStreaming(): boolean;
|
|
9
|
+
getHideThinkingBlock(): boolean;
|
|
10
|
+
requestRender(): void;
|
|
11
|
+
};
|
|
12
|
+
export declare function visibleUnits(message: AssistantMessage, hideThinking: boolean): number;
|
|
13
|
+
export declare function buildDisplayMessage(target: AssistantMessage, revealed: number, hideThinking: boolean): AssistantMessage;
|
|
14
|
+
export declare function nextStep(backlog: number): number;
|
|
15
|
+
export declare class StreamingRevealController {
|
|
16
|
+
#private;
|
|
17
|
+
constructor(options: StreamingRevealControllerOptions);
|
|
18
|
+
begin(component: StreamingRevealComponent, message: AssistantMessage): void;
|
|
19
|
+
setTarget(message: AssistantMessage): void;
|
|
20
|
+
stop(): void;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Interactive mode and embeddable RPC client exports for the coding agent.
|
|
3
|
+
*
|
|
4
|
+
* Branch-specific runners live in their concrete modules so importing this
|
|
5
|
+
* barrel does not pull print, RPC server, or ACP server mode into the normal
|
|
6
|
+
* TUI graph.
|
|
3
7
|
*/
|
|
4
|
-
export { runAcpMode } from "./acp";
|
|
5
8
|
export { InteractiveMode, type InteractiveModeOptions } from "./interactive-mode";
|
|
6
|
-
export { type PrintModeOptions, runPrintMode } from "./print-mode";
|
|
7
9
|
export { defineRpcClientTool, type ModelInfo, RpcClient, type RpcClientCustomTool, type RpcClientOptions, type RpcClientToolContext, type RpcClientToolResult, type RpcEventListener, } from "./rpc/rpc-client";
|
|
8
|
-
export { runRpcMode } from "./rpc/rpc-mode";
|
|
9
10
|
export type { RpcCommand, RpcHostToolCallRequest, RpcHostToolCancelRequest, RpcHostToolDefinition, RpcHostToolResult, RpcHostToolUpdate, RpcResponse, RpcSessionState, } from "./rpc/rpc-types";
|
|
@@ -8,7 +8,7 @@ import { Settings } from "../config/settings";
|
|
|
8
8
|
import type { ExtensionUIContext, ExtensionUIDialogOptions, ExtensionUISelectItem, ExtensionWidgetContent, ExtensionWidgetOptions } from "../extensibility/extensions";
|
|
9
9
|
import type { CompactOptions } from "../extensibility/extensions/types";
|
|
10
10
|
import { type PlanApprovalDetails } from "../plan-mode/approved-plan";
|
|
11
|
-
import type { AgentSession
|
|
11
|
+
import type { AgentSession } from "../session/agent-session";
|
|
12
12
|
import { HistoryStorage } from "../session/history-storage";
|
|
13
13
|
import type { SessionContext, SessionManager } from "../session/session-manager";
|
|
14
14
|
import type { ShakeMode } from "../session/shake-types";
|
|
@@ -63,7 +63,6 @@ export declare class InteractiveMode implements InteractiveModeContext {
|
|
|
63
63
|
hookWidgetContainerBelow: Container;
|
|
64
64
|
statusLine: StatusLineComponent;
|
|
65
65
|
isInitialized: boolean;
|
|
66
|
-
isBackgrounded: boolean;
|
|
67
66
|
isBashMode: boolean;
|
|
68
67
|
toolOutputExpanded: boolean;
|
|
69
68
|
todoExpanded: boolean;
|
|
@@ -150,6 +149,16 @@ export declare class InteractiveMode implements InteractiveModeContext {
|
|
|
150
149
|
rebuildChatFromMessages(): void;
|
|
151
150
|
/** Apply any deferred model switch after the current stream ends. */
|
|
152
151
|
flushPendingModelSwitch(): Promise<void>;
|
|
152
|
+
showPlanReview(planContent: string, title: string, options: string[], dialogOptions?: {
|
|
153
|
+
helpText?: string;
|
|
154
|
+
disabledIndices?: number[];
|
|
155
|
+
onExternalEditor?: () => void;
|
|
156
|
+
onPlanEdited?: (content: string) => void;
|
|
157
|
+
onFeedbackChange?: (feedback: string) => void;
|
|
158
|
+
initialIndex?: number;
|
|
159
|
+
}, extra?: {
|
|
160
|
+
slider?: HookSelectorSlider;
|
|
161
|
+
}): Promise<string | undefined>;
|
|
153
162
|
handlePlanModeCommand(initialPrompt?: string): Promise<void>;
|
|
154
163
|
handleGoalModeCommand(rest?: string): Promise<void>;
|
|
155
164
|
handlePlanApproval(details: PlanApprovalDetails): Promise<void>;
|
|
@@ -158,9 +167,9 @@ export declare class InteractiveMode implements InteractiveModeContext {
|
|
|
158
167
|
checkShutdownRequested(): Promise<void>;
|
|
159
168
|
setToolUIContext(uiContext: ExtensionUIContext, hasUI: boolean): void;
|
|
160
169
|
initializeHookRunner(uiContext: ExtensionUIContext, hasUI: boolean): void;
|
|
161
|
-
createBackgroundUiContext(): ExtensionUIContext;
|
|
162
170
|
setEditorComponent(factory: ((tui: TUI, theme: EditorTheme, keybindings: KeybindingsManager) => CustomEditor) | undefined): void;
|
|
163
|
-
|
|
171
|
+
present(content: Component | readonly Component[]): void;
|
|
172
|
+
resetTranscript(): void;
|
|
164
173
|
showStatus(message: string, options?: {
|
|
165
174
|
dim?: boolean;
|
|
166
175
|
}): void;
|
|
@@ -208,13 +217,14 @@ export declare class InteractiveMode implements InteractiveModeContext {
|
|
|
208
217
|
handleToolsCommand(): void;
|
|
209
218
|
handleContextCommand(): void;
|
|
210
219
|
handleClearCommand(): Promise<void>;
|
|
220
|
+
handleFreshCommand(): Promise<void>;
|
|
211
221
|
handleDropCommand(): Promise<void>;
|
|
212
222
|
handleForkCommand(): Promise<void>;
|
|
213
223
|
handleMoveCommand(targetPath: string): Promise<void>;
|
|
214
224
|
handleRenameCommand(title: string): Promise<void>;
|
|
215
225
|
handleMemoryCommand(text: string): Promise<void>;
|
|
216
226
|
handleSTTToggle(): Promise<void>;
|
|
217
|
-
showDebugSelector(): void
|
|
227
|
+
showDebugSelector(): Promise<void>;
|
|
218
228
|
showSessionObserver(): void;
|
|
219
229
|
resetObserverRegistry(): void;
|
|
220
230
|
handleBashCommand(command: string, excludeFromContext?: boolean): Promise<void>;
|
|
@@ -246,9 +256,9 @@ export declare class InteractiveMode implements InteractiveModeContext {
|
|
|
246
256
|
handleCtrlD(): void;
|
|
247
257
|
handleCtrlZ(): void;
|
|
248
258
|
handleDequeue(): void;
|
|
249
|
-
handleBackgroundCommand(): void;
|
|
250
259
|
handleImagePaste(): Promise<boolean>;
|
|
251
260
|
handleBtwCommand(question: string): Promise<void>;
|
|
261
|
+
handleTanCommand(work: string): Promise<void>;
|
|
252
262
|
hasActiveBtw(): boolean;
|
|
253
263
|
handleBtwEscape(): boolean;
|
|
254
264
|
handleOmfgCommand(complaint: string): Promise<void>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Setup version the wizard advances a fresh install to. Bump it whenever a new
|
|
3
|
+
* setup scene lands (or an existing scene raises its `minVersion`).
|
|
4
|
+
*
|
|
5
|
+
* Kept in its own dependency-free module so the cold-launch gate in `main.ts`
|
|
6
|
+
* can answer "is the stored setup version stale?" without statically importing
|
|
7
|
+
* the full wizard — every scene (sign-in/OAuth, web search, theme previews) plus
|
|
8
|
+
* the overlay component and their TUI deps. MUST equal `max(scene.minVersion)`
|
|
9
|
+
* across `ALL_SCENES`; the `setup-wizard` barrel and test suite guard it.
|
|
10
|
+
*/
|
|
11
|
+
export declare const CURRENT_SETUP_VERSION = 1;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { Settings } from "../../config/settings";
|
|
2
|
+
import { CURRENT_SETUP_VERSION } from "../setup-version";
|
|
2
3
|
import type { InteractiveModeContext } from "../types";
|
|
3
4
|
import type { SetupScene } from "./scenes/types";
|
|
4
5
|
export type { SetupScene, SetupSceneController, SetupSceneHost, SetupSceneResult } from "./scenes/types";
|
|
6
|
+
export { CURRENT_SETUP_VERSION };
|
|
5
7
|
export declare const ALL_SCENES: readonly [SetupScene, SetupScene, SetupScene];
|
|
6
|
-
export declare const CURRENT_SETUP_VERSION: number;
|
|
7
8
|
export interface SetupSceneSelectionOptions {
|
|
8
9
|
resuming?: boolean;
|
|
9
10
|
isTTY?: boolean;
|
|
@@ -2,7 +2,8 @@ import type { SetupSceneHost, SetupTab } from "./types";
|
|
|
2
2
|
/**
|
|
3
3
|
* "Web search" panel: picks the provider the web_search tool should prefer and
|
|
4
4
|
* reports whether the highlighted provider is ready to use given current
|
|
5
|
-
* credentials (env keys or OAuth sign-ins from the Sign in tab)
|
|
5
|
+
* credentials (env keys or OAuth sign-ins from the Sign in tab) or an
|
|
6
|
+
* unauthenticated fallback.
|
|
6
7
|
*/
|
|
7
8
|
export declare class WebSearchTab implements SetupTab {
|
|
8
9
|
#private;
|
|
@@ -6,7 +6,7 @@ export type SymbolPreset = "unicode" | "nerd" | "ascii";
|
|
|
6
6
|
/**
|
|
7
7
|
* All available symbol keys organized by category.
|
|
8
8
|
*/
|
|
9
|
-
export type SymbolKey = "status.success" | "status.error" | "status.warning" | "status.info" | "status.pending" | "status.disabled" | "status.enabled" | "status.running" | "status.shadowed" | "status.aborted" | "nav.cursor" | "nav.selected" | "nav.expand" | "nav.collapse" | "nav.back" | "tree.branch" | "tree.last" | "tree.vertical" | "tree.horizontal" | "tree.hook" | "boxRound.topLeft" | "boxRound.topRight" | "boxRound.bottomLeft" | "boxRound.bottomRight" | "boxRound.horizontal" | "boxRound.vertical" | "boxSharp.topLeft" | "boxSharp.topRight" | "boxSharp.bottomLeft" | "boxSharp.bottomRight" | "boxSharp.horizontal" | "boxSharp.vertical" | "boxSharp.cross" | "boxSharp.teeDown" | "boxSharp.teeUp" | "boxSharp.teeRight" | "boxSharp.teeLeft" | "sep.powerline" | "sep.powerlineThin" | "sep.powerlineLeft" | "sep.powerlineRight" | "sep.powerlineThinLeft" | "sep.powerlineThinRight" | "sep.block" | "sep.space" | "sep.asciiLeft" | "sep.asciiRight" | "sep.dot" | "sep.slash" | "sep.pipe" | "icon.model" | "icon.plan" | "icon.goal" | "icon.pause" | "icon.loop" | "icon.folder" | "icon.scratchFolder" | "icon.file" | "icon.git" | "icon.branch" | "icon.pr" | "icon.tokens" | "icon.context" | "icon.cost" | "icon.time" | "icon.pi" | "icon.agents" | "icon.cache" | "icon.input" | "icon.output" | "icon.host" | "icon.session" | "icon.package" | "icon.warning" | "icon.rewind" | "icon.auto" | "icon.fast" | "icon.extensionSkill" | "icon.extensionTool" | "icon.extensionSlashCommand" | "icon.extensionMcp" | "icon.extensionRule" | "icon.extensionHook" | "icon.extensionPrompt" | "icon.extensionContextFile" | "icon.extensionInstruction" | "icon.mic" | "thinking.minimal" | "thinking.low" | "thinking.medium" | "thinking.high" | "thinking.xhigh" | "thinking.autoPending" | "checkbox.checked" | "checkbox.unchecked" | "radio.selected" | "radio.unselected" | "format.bullet" | "format.dash" | "format.bracketLeft" | "format.bracketRight" | "md.quoteBorder" | "md.hrChar" | "md.bullet" | "md.colorSwatch" | "lang.default" | "lang.typescript" | "lang.javascript" | "lang.python" | "lang.rust" | "lang.go" | "lang.java" | "lang.c" | "lang.cpp" | "lang.csharp" | "lang.ruby" | "lang.php" | "lang.swift" | "lang.kotlin" | "lang.shell" | "lang.html" | "lang.css" | "lang.json" | "lang.yaml" | "lang.markdown" | "lang.sql" | "lang.docker" | "lang.lua" | "lang.text" | "lang.env" | "lang.toml" | "lang.xml" | "lang.ini" | "lang.conf" | "lang.log" | "lang.csv" | "lang.tsv" | "lang.image" | "lang.pdf" | "lang.archive" | "lang.binary" | "tab.appearance" | "tab.model" | "tab.interaction" | "tab.context" | "tab.editing" | "tab.tools" | "tab.memory" | "tab.tasks" | "tab.providers";
|
|
9
|
+
export type SymbolKey = "status.success" | "status.error" | "status.warning" | "status.info" | "status.pending" | "status.disabled" | "status.enabled" | "status.running" | "status.shadowed" | "status.aborted" | "nav.cursor" | "nav.selected" | "nav.expand" | "nav.collapse" | "nav.back" | "tree.branch" | "tree.last" | "tree.vertical" | "tree.horizontal" | "tree.hook" | "boxRound.topLeft" | "boxRound.topRight" | "boxRound.bottomLeft" | "boxRound.bottomRight" | "boxRound.horizontal" | "boxRound.vertical" | "boxSharp.topLeft" | "boxSharp.topRight" | "boxSharp.bottomLeft" | "boxSharp.bottomRight" | "boxSharp.horizontal" | "boxSharp.vertical" | "boxSharp.cross" | "boxSharp.teeDown" | "boxSharp.teeUp" | "boxSharp.teeRight" | "boxSharp.teeLeft" | "sep.powerline" | "sep.powerlineThin" | "sep.powerlineLeft" | "sep.powerlineRight" | "sep.powerlineThinLeft" | "sep.powerlineThinRight" | "sep.block" | "sep.space" | "sep.asciiLeft" | "sep.asciiRight" | "sep.dot" | "sep.slash" | "sep.pipe" | "icon.model" | "icon.plan" | "icon.goal" | "icon.pause" | "icon.loop" | "icon.folder" | "icon.search" | "icon.scratchFolder" | "icon.file" | "icon.git" | "icon.branch" | "icon.pr" | "icon.tokens" | "icon.context" | "icon.cost" | "icon.time" | "icon.pi" | "icon.agents" | "icon.cache" | "icon.input" | "icon.output" | "icon.host" | "icon.session" | "icon.package" | "icon.warning" | "icon.rewind" | "icon.auto" | "icon.fast" | "icon.extensionSkill" | "icon.extensionTool" | "icon.extensionSlashCommand" | "icon.extensionMcp" | "icon.extensionRule" | "icon.extensionHook" | "icon.extensionPrompt" | "icon.extensionContextFile" | "icon.extensionInstruction" | "icon.mic" | "thinking.minimal" | "thinking.low" | "thinking.medium" | "thinking.high" | "thinking.xhigh" | "thinking.autoPending" | "checkbox.checked" | "checkbox.unchecked" | "radio.selected" | "radio.unselected" | "format.bullet" | "format.dash" | "format.bracketLeft" | "format.bracketRight" | "md.quoteBorder" | "md.hrChar" | "md.bullet" | "md.colorSwatch" | "lang.default" | "lang.typescript" | "lang.javascript" | "lang.python" | "lang.rust" | "lang.go" | "lang.java" | "lang.c" | "lang.cpp" | "lang.csharp" | "lang.ruby" | "lang.php" | "lang.swift" | "lang.kotlin" | "lang.shell" | "lang.html" | "lang.css" | "lang.json" | "lang.yaml" | "lang.markdown" | "lang.sql" | "lang.docker" | "lang.lua" | "lang.text" | "lang.env" | "lang.toml" | "lang.xml" | "lang.ini" | "lang.conf" | "lang.log" | "lang.csv" | "lang.tsv" | "lang.image" | "lang.pdf" | "lang.archive" | "lang.binary" | "tab.appearance" | "tab.model" | "tab.interaction" | "tab.context" | "tab.editing" | "tab.tools" | "tab.memory" | "tab.tasks" | "tab.providers";
|
|
10
10
|
export type SpinnerType = "status" | "activity";
|
|
11
11
|
export type ThemeColor = "accent" | "border" | "borderAccent" | "borderMuted" | "success" | "error" | "warning" | "muted" | "dim" | "text" | "thinkingText" | "userMessageText" | "customMessageText" | "customMessageLabel" | "toolTitle" | "toolOutput" | "mdHeading" | "mdLink" | "mdLinkUrl" | "mdCode" | "mdCodeBlock" | "mdCodeBlockBorder" | "mdQuote" | "mdQuoteBorder" | "mdHr" | "mdListBullet" | "toolDiffAdded" | "toolDiffRemoved" | "toolDiffContext" | "syntaxComment" | "syntaxKeyword" | "syntaxFunction" | "syntaxVariable" | "syntaxString" | "syntaxNumber" | "syntaxType" | "syntaxOperator" | "syntaxPunctuation" | "thinkingOff" | "thinkingMinimal" | "thinkingLow" | "thinkingMedium" | "thinkingHigh" | "thinkingXhigh" | "bashMode" | "pythonMode" | "statusLineSep" | "statusLineModel" | "statusLinePath" | "statusLineGitClean" | "statusLineGitDirty" | "statusLineContext" | "statusLineSpend" | "statusLineStaged" | "statusLineDirty" | "statusLineUntracked" | "statusLineOutput" | "statusLineCost" | "statusLineSubagents";
|
|
12
12
|
/** Check if a string is a valid ThemeColor value */
|
|
@@ -8,7 +8,7 @@ import type { ExtensionUIContext, ExtensionUIDialogOptions, ExtensionUISelectIte
|
|
|
8
8
|
import type { CompactOptions } from "../extensibility/extensions/types";
|
|
9
9
|
import type { MCPManager } from "../mcp";
|
|
10
10
|
import type { PlanApprovalDetails } from "../plan-mode/approved-plan";
|
|
11
|
-
import type { AgentSession
|
|
11
|
+
import type { AgentSession } from "../session/agent-session";
|
|
12
12
|
import type { HistoryStorage } from "../session/history-storage";
|
|
13
13
|
import type { SessionContext, SessionManager } from "../session/session-manager";
|
|
14
14
|
import type { ShakeMode } from "../session/shake-types";
|
|
@@ -51,6 +51,7 @@ export type TodoPhase = {
|
|
|
51
51
|
};
|
|
52
52
|
export interface InteractiveModeInitOptions {
|
|
53
53
|
suppressWelcomeIntro?: boolean;
|
|
54
|
+
clearInitialTerminalHistory?: boolean;
|
|
54
55
|
}
|
|
55
56
|
export type InteractiveSelectorDialogOptions = ExtensionUIDialogOptions & Pick<HookSelectorOptions, "disabledIndices">;
|
|
56
57
|
export interface InteractiveModeContext {
|
|
@@ -76,7 +77,6 @@ export interface InteractiveModeContext {
|
|
|
76
77
|
mcpManager?: MCPManager;
|
|
77
78
|
lspServers?: LspStartupServerInfo[];
|
|
78
79
|
isInitialized: boolean;
|
|
79
|
-
isBackgrounded: boolean;
|
|
80
80
|
isBashMode: boolean;
|
|
81
81
|
toolOutputExpanded: boolean;
|
|
82
82
|
todoExpanded: boolean;
|
|
@@ -126,9 +126,21 @@ export interface InteractiveModeContext {
|
|
|
126
126
|
checkShutdownRequested(): Promise<void>;
|
|
127
127
|
setToolUIContext(uiContext: ExtensionUIContext, hasUI: boolean): void;
|
|
128
128
|
initializeHookRunner(uiContext: ExtensionUIContext, hasUI: boolean): void;
|
|
129
|
-
createBackgroundUiContext(): ExtensionUIContext;
|
|
130
129
|
setEditorComponent(factory: ((tui: TUI, theme: EditorTheme, keybindings: KeybindingsManager) => CustomEditor) | undefined): void;
|
|
131
|
-
|
|
130
|
+
/**
|
|
131
|
+
* Mount transcript content and repaint once. The single sink for "show this in
|
|
132
|
+
* chat": producers build and return a `Component` (or a `ChatBlock` carrying
|
|
133
|
+
* its own lifecycle) and hand it here instead of touching `chatContainer` /
|
|
134
|
+
* `ui.requestRender()` directly. `ChatBlock`s are mounted (their `onMount`
|
|
135
|
+
* runs) so their timers/subscriptions start.
|
|
136
|
+
*/
|
|
137
|
+
present(content: Component | readonly Component[]): void;
|
|
138
|
+
/**
|
|
139
|
+
* Dispose every live block in the transcript (stopping timers/subscriptions)
|
|
140
|
+
* and clear it. Used before a full rebuild so animated/streaming blocks do not
|
|
141
|
+
* leak.
|
|
142
|
+
*/
|
|
143
|
+
resetTranscript(): void;
|
|
132
144
|
showStatus(message: string, options?: {
|
|
133
145
|
dim?: boolean;
|
|
134
146
|
}): void;
|
|
@@ -208,6 +220,7 @@ export interface InteractiveModeContext {
|
|
|
208
220
|
handleDumpCommand(): void;
|
|
209
221
|
handleDebugTranscriptCommand(): Promise<void>;
|
|
210
222
|
handleClearCommand(): Promise<void>;
|
|
223
|
+
handleFreshCommand(): Promise<void>;
|
|
211
224
|
handleDropCommand(): Promise<void>;
|
|
212
225
|
handleForkCommand(): Promise<void>;
|
|
213
226
|
handleBashCommand(command: string, excludeFromContext?: boolean): Promise<void>;
|
|
@@ -241,16 +254,16 @@ export interface InteractiveModeContext {
|
|
|
241
254
|
handleSessionDeleteCommand(): Promise<void>;
|
|
242
255
|
showOAuthSelector(mode: "login" | "logout", providerId?: string): Promise<void>;
|
|
243
256
|
showHookConfirm(title: string, message: string): Promise<boolean>;
|
|
244
|
-
showDebugSelector(): void
|
|
257
|
+
showDebugSelector(): Promise<void>;
|
|
245
258
|
showSessionObserver(): void;
|
|
246
259
|
resetObserverRegistry(): void;
|
|
247
260
|
handleCtrlC(): void;
|
|
248
261
|
handleCtrlD(): void;
|
|
249
262
|
handleCtrlZ(): void;
|
|
250
263
|
handleDequeue(): void;
|
|
251
|
-
handleBackgroundCommand(): void;
|
|
252
264
|
handleImagePaste(): Promise<boolean>;
|
|
253
265
|
handleBtwCommand(question: string): Promise<void>;
|
|
266
|
+
handleTanCommand(work: string): Promise<void>;
|
|
254
267
|
hasActiveBtw(): boolean;
|
|
255
268
|
handleBtwEscape(): boolean;
|
|
256
269
|
handleOmfgCommand(complaint: string): Promise<void>;
|
|
@@ -6,6 +6,17 @@ export interface CodeBlock {
|
|
|
6
6
|
/** Block body with the trailing newline stripped. */
|
|
7
7
|
code: string;
|
|
8
8
|
}
|
|
9
|
+
/** A blockquote block: a maximal run of `>`-prefixed lines from markdown. */
|
|
10
|
+
export interface QuoteBlock {
|
|
11
|
+
/** Block body with each line's `>` marker (and one optional space) removed. */
|
|
12
|
+
text: string;
|
|
13
|
+
}
|
|
14
|
+
/** A drillable block within an assistant message, in document order. */
|
|
15
|
+
export type MessageBlock = ({
|
|
16
|
+
kind: "code";
|
|
17
|
+
} & CodeBlock) | ({
|
|
18
|
+
kind: "quote";
|
|
19
|
+
} & QuoteBlock);
|
|
9
20
|
/** A runnable command found in the transcript. */
|
|
10
21
|
export interface LastCommand {
|
|
11
22
|
kind: "bash" | "eval";
|
|
@@ -19,7 +30,7 @@ export interface LastCommand {
|
|
|
19
30
|
* `children` to drill into.
|
|
20
31
|
*/
|
|
21
32
|
export interface CopyTarget {
|
|
22
|
-
/** Stable
|
|
33
|
+
/** Stable id (e.g. "msg:1", "msg:1:code:0", "msg:1:quote:0", "msg:1:all", "cmd:1"). */
|
|
23
34
|
id: string;
|
|
24
35
|
label: string;
|
|
25
36
|
/** Dim annotation: line/block counts, language, or tool name. */
|
|
@@ -40,8 +51,17 @@ export interface CopySource {
|
|
|
40
51
|
readonly messages: readonly AgentMessage[];
|
|
41
52
|
getLastVisibleHandoffText(): string | undefined;
|
|
42
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Split assistant markdown into drillable blocks — fenced code and `>`-quoted
|
|
56
|
+
* runs — in document order. Fences mask their bodies, so a `>` line inside a
|
|
57
|
+
* code block is never mistaken for a quote. An unclosed fence is treated as
|
|
58
|
+
* ordinary text, matching the fenced-block grammar.
|
|
59
|
+
*/
|
|
60
|
+
export declare function extractBlocks(text: string): MessageBlock[];
|
|
43
61
|
/** Extract fenced code blocks from assistant markdown, in document order. */
|
|
44
62
|
export declare function extractCodeBlocks(text: string): CodeBlock[];
|
|
63
|
+
/** Extract `>`-quoted blocks from assistant markdown, in document order. */
|
|
64
|
+
export declare function extractQuoteBlocks(text: string): QuoteBlock[];
|
|
45
65
|
/** Walk the transcript backwards for the most recent bash command or eval code. */
|
|
46
66
|
export declare function extractLastCommand(messages: readonly AgentMessage[]): LastCommand | undefined;
|
|
47
67
|
/**
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/** Shape forwarded from the plan-mode resolve handler to InteractiveMode's
|
|
2
2
|
* approval popup. Populated by the standing handler that the resolve tool
|
|
3
|
-
* dispatches to when the agent submits `resolve { action: "apply" }`.
|
|
3
|
+
* dispatches to when the agent submits `resolve { action: "apply" }`.
|
|
4
|
+
* `planFilePath` is the agent-chosen `local://<slug>-plan.md` artifact — it is
|
|
5
|
+
* never renamed on approval, so links to it stay valid for the session. */
|
|
4
6
|
export interface PlanApprovalDetails {
|
|
5
7
|
planFilePath: string;
|
|
6
|
-
finalPlanFilePath: string;
|
|
7
8
|
title: string;
|
|
8
9
|
planExists: boolean;
|
|
9
10
|
}
|
|
@@ -39,11 +40,29 @@ export declare function resolvePlanTitle(input: {
|
|
|
39
40
|
* Replaces `-`/`_` separators with spaces and capitalizes the first letter.
|
|
40
41
|
* Returns an empty string when the input collapses to whitespace. */
|
|
41
42
|
export declare function humanizePlanTitle(title: string): string;
|
|
42
|
-
|
|
43
|
+
/** The `local://` URL a plan slug maps to. The agent writes the plan here and
|
|
44
|
+
* passes the slug to `resolve`; the file is never renamed, so this URL — and
|
|
45
|
+
* any hyperlink to it — stays valid for the life of the session. */
|
|
46
|
+
export declare function planFileUrlForSlug(slug: string): string;
|
|
47
|
+
export interface ResolveApprovedPlanInput {
|
|
48
|
+
/** The agent's `extra.title` from the `resolve` call, if any. */
|
|
49
|
+
suppliedTitle?: unknown;
|
|
50
|
+
/** The plan path recorded in plan-mode state (the entry default or a prior plan). */
|
|
51
|
+
statePlanFilePath: string;
|
|
52
|
+
/** Read a plan `local://` URL, returning null when the file does not exist. */
|
|
53
|
+
readPlan: (planUrl: string) => Promise<string | null>;
|
|
54
|
+
/** Optional fallback: list candidate plan `local://` URLs (newest first) so a
|
|
55
|
+
* plan whose name can't be reconstructed (e.g. a dropped `extra.title`) is
|
|
56
|
+
* still found. */
|
|
57
|
+
listPlanFiles?: () => Promise<string[]>;
|
|
58
|
+
}
|
|
59
|
+
export interface ResolvedApprovedPlan {
|
|
43
60
|
planFilePath: string;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
getSessionId: () => string | null;
|
|
61
|
+
planContent: string;
|
|
62
|
+
title: string;
|
|
47
63
|
}
|
|
48
|
-
|
|
49
|
-
|
|
64
|
+
/** Locate the plan file the agent wrote and finalize its title — without
|
|
65
|
+
* renaming anything. Tries, in order: the slug derived from `extra.title`
|
|
66
|
+
* (`local://<slug>-plan.md`), the plan path from plan-mode state, then a scan
|
|
67
|
+
* of recent plan files. Throws a `ToolError` guiding the agent when none exist. */
|
|
68
|
+
export declare function resolveApprovedPlan(input: ResolveApprovedPlanInput): Promise<ResolvedApprovedPlan>;
|
|
@@ -3,10 +3,10 @@ import { type ProtectedToolContext } from "@oh-my-pi/pi-agent-core/compaction/to
|
|
|
3
3
|
* Build a compaction protection matcher that keeps `read` results for the active
|
|
4
4
|
* plan file intact through prune/shake — the plan analog of skill-read
|
|
5
5
|
* protection. Matches both the canonical `local://PLAN.md` alias and the
|
|
6
|
-
* session's current plan reference path (
|
|
7
|
-
* the plan survives compaction whether the agent reads it by alias or by
|
|
6
|
+
* session's current plan reference path (the agent-chosen `local://<slug>-plan.md`),
|
|
7
|
+
* so the plan survives compaction whether the agent reads it by alias or by name.
|
|
8
8
|
*
|
|
9
|
-
* `getPlanReferencePath` is evaluated at match time so
|
|
10
|
-
*
|
|
9
|
+
* `getPlanReferencePath` is evaluated at match time so the plan path set on
|
|
10
|
+
* approval is honored immediately.
|
|
11
11
|
*/
|
|
12
12
|
export declare function createPlanReadMatcher(getPlanReferencePath: () => string): (context: ProtectedToolContext) => boolean;
|
package/dist/types/sdk.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { type FileSlashCommand } from "./extensibility/slash-commands";
|
|
|
13
13
|
import type { HindsightSessionState } from "./hindsight/state";
|
|
14
14
|
import { type LocalProtocolOptions } from "./internal-urls";
|
|
15
15
|
import { MCPManager, type MCPToolsLoadResult } from "./mcp";
|
|
16
|
-
import {
|
|
16
|
+
import type { MnemopiSessionState } from "./mnemopi/state";
|
|
17
17
|
import { AgentRegistry } from "./registry/agent-registry";
|
|
18
18
|
import { AgentSession } from "./session/agent-session";
|
|
19
19
|
import { AuthStorage } from "./session/auth-storage";
|
|
@@ -51,6 +51,8 @@ export interface CreateAgentSessionOptions {
|
|
|
51
51
|
/** Optional provider-facing session identifier for prompt caches and sticky auth selection.
|
|
52
52
|
* Keeps persisted session files isolated while reusing provider-side caches. */
|
|
53
53
|
providerSessionId?: string;
|
|
54
|
+
/** Optional provider-facing prompt cache key, distinct from request lineage. */
|
|
55
|
+
providerPromptCacheKey?: string;
|
|
54
56
|
/** Custom tools to register (in addition to built-in tools). Accepts both CustomTool and ToolDefinition. */
|
|
55
57
|
customTools?: (CustomTool | ToolDefinition)[];
|
|
56
58
|
/** Inline extensions (merged with discovery). */
|
|
@@ -294,6 +294,11 @@ export interface SessionStats {
|
|
|
294
294
|
premiumRequests: number;
|
|
295
295
|
cost: number;
|
|
296
296
|
}
|
|
297
|
+
export interface FreshSessionResult {
|
|
298
|
+
previousSessionId: string;
|
|
299
|
+
sessionId: string;
|
|
300
|
+
closedProviderSessions: number;
|
|
301
|
+
}
|
|
297
302
|
export declare const ANTHROPIC_TOOL_CALL_BATCH_CAP = 4;
|
|
298
303
|
export declare function resolveToolCallBatchCapForModel(model: Model | undefined): number | undefined;
|
|
299
304
|
export declare class AgentSession {
|
|
@@ -308,6 +313,8 @@ export declare class AgentSession {
|
|
|
308
313
|
constructor(config: AgentSessionConfig);
|
|
309
314
|
/** Model registry for API key resolution and model discovery */
|
|
310
315
|
get modelRegistry(): ModelRegistry;
|
|
316
|
+
get asyncJobManager(): AsyncJobManager | undefined;
|
|
317
|
+
getAgentId(): string | undefined;
|
|
311
318
|
/** Advance the tool-choice queue and return the next directive for the upcoming LLM call. */
|
|
312
319
|
nextToolChoice(): ToolChoice | undefined;
|
|
313
320
|
/**
|
|
@@ -378,6 +385,7 @@ export declare class AgentSession {
|
|
|
378
385
|
* Call this when completely done with the session.
|
|
379
386
|
*/
|
|
380
387
|
dispose(): Promise<void>;
|
|
388
|
+
freshSession(): FreshSessionResult | undefined;
|
|
381
389
|
/** Full agent state */
|
|
382
390
|
get state(): AgentState;
|
|
383
391
|
/** Current model (may be undefined if not yet selected) */
|
|
@@ -609,9 +617,22 @@ export declare class AgentSession {
|
|
|
609
617
|
setTodoPhases(phases: TodoPhase[]): void;
|
|
610
618
|
/**
|
|
611
619
|
* Abort current operation and wait for agent to become idle.
|
|
620
|
+
*
|
|
621
|
+
* `reason` (e.g. `USER_INTERRUPT_LABEL`) rides the agent's `AbortController`
|
|
622
|
+
* and surfaces verbatim on the aborted assistant message's `errorMessage`, so
|
|
623
|
+
* the transcript can distinguish a deliberate user interrupt from an opaque
|
|
624
|
+
* abort. Omit it for internal/lifecycle aborts.
|
|
612
625
|
*/
|
|
613
626
|
abort(options?: {
|
|
614
627
|
goalReason?: "interrupted" | "internal";
|
|
628
|
+
reason?: string;
|
|
629
|
+
}): Promise<void>;
|
|
630
|
+
/**
|
|
631
|
+
* Abort active work, then immediately resume the agent so queued steer/follow-up
|
|
632
|
+
* messages drain instead of waiting for another natural turn boundary.
|
|
633
|
+
*/
|
|
634
|
+
interruptAndFlushQueuedMessages(options?: {
|
|
635
|
+
reason?: string;
|
|
615
636
|
}): Promise<void>;
|
|
616
637
|
/**
|
|
617
638
|
* Start a new session, optionally with initial messages and parent tracking.
|
|
@@ -40,6 +40,18 @@ export declare const SILENT_ABORT_MARKER = "__omp.silent_abort__";
|
|
|
40
40
|
* than string-comparing inline so refactors to the marker constant (e.g.,
|
|
41
41
|
* namespacing changes) propagate through every consumer in lockstep. */
|
|
42
42
|
export declare function isSilentAbort(errorMessage: string | undefined): boolean;
|
|
43
|
+
/** Reason threaded through `AbortController.abort(reason)` when the user aborts
|
|
44
|
+
* the turn with Esc (see `AgentSession.abort`). The agent surfaces it verbatim
|
|
45
|
+
* on the aborted assistant message's `errorMessage`, so the transcript reads as
|
|
46
|
+
* a deliberate user interrupt instead of an opaque failure. */
|
|
47
|
+
export declare const USER_INTERRUPT_LABEL = "Interrupted by user";
|
|
48
|
+
/** Resolve the operator-facing label for an aborted assistant turn. A custom
|
|
49
|
+
* abort reason (e.g. `USER_INTERRUPT_LABEL`) threaded onto `errorMessage` is
|
|
50
|
+
* shown verbatim; aborts with no threaded reason fall back to the retry-aware
|
|
51
|
+
* generic label. Centralizes the live-stream (`EventController`), replay
|
|
52
|
+
* (`ui-helpers`), and component (`AssistantMessageComponent`) render paths so
|
|
53
|
+
* they stay in lockstep. */
|
|
54
|
+
export declare function resolveAbortLabel(errorMessage: string | undefined, retryAttempt?: number): string;
|
|
43
55
|
/** Extract the optional `__pendingDisplayTag` field from a CustomMessage's
|
|
44
56
|
* `details` blob. Safe over `unknown`; returns undefined when the field is
|
|
45
57
|
* absent or non-string. */
|
|
@@ -565,7 +565,9 @@ export declare class SessionManager {
|
|
|
565
565
|
* Fork a session into the current project directory.
|
|
566
566
|
* Copies history from another session file while creating a new session file in the current sessionDir.
|
|
567
567
|
*/
|
|
568
|
-
static forkFrom(sourcePath: string, cwd: string, sessionDir?: string, storage?: SessionStorage
|
|
568
|
+
static forkFrom(sourcePath: string, cwd: string, sessionDir?: string, storage?: SessionStorage, options?: {
|
|
569
|
+
suppressBreadcrumb?: boolean;
|
|
570
|
+
}): Promise<SessionManager>;
|
|
569
571
|
/**
|
|
570
572
|
* Open a specific session file.
|
|
571
573
|
* @param path Path to session file
|
|
@@ -69,15 +69,13 @@ export interface SlashCommandRuntime {
|
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
71
71
|
* Runtime visible to TUI-only handlers (`handleTui`). Carries the interactive
|
|
72
|
-
* mode context
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* from `ctx`.
|
|
72
|
+
* mode context. Intentionally narrower than `SlashCommandRuntime` so existing
|
|
73
|
+
* callers can keep building it from just `{ ctx }`; when the TUI dispatcher
|
|
74
|
+
* needs to invoke a `handle` (no `handleTui` override), it synthesizes a
|
|
75
|
+
* `SlashCommandRuntime` from `ctx`.
|
|
77
76
|
*/
|
|
78
77
|
export interface TuiSlashCommandRuntime {
|
|
79
78
|
ctx: InteractiveModeContext;
|
|
80
|
-
handleBackgroundCommand: () => void;
|
|
81
79
|
}
|
|
82
80
|
/** Unified slash-command spec consumed by both TUI and ACP dispatchers. */
|
|
83
81
|
export interface SlashCommandSpec extends BuiltinSlashCommand {
|
|
@@ -7,6 +7,8 @@ import type { AgentTelemetryConfig, ThinkingLevel } from "@oh-my-pi/pi-agent-cor
|
|
|
7
7
|
import { ModelRegistry } from "../config/model-registry";
|
|
8
8
|
import type { PromptTemplate } from "../config/prompt-templates";
|
|
9
9
|
import { Settings } from "../config/settings";
|
|
10
|
+
import { type SettingPath } from "../config/settings-schema";
|
|
11
|
+
import type { CustomTool } from "../extensibility/custom-tools/types";
|
|
10
12
|
import { type Skill } from "../extensibility/skills";
|
|
11
13
|
import type { HindsightSessionState } from "../hindsight/state";
|
|
12
14
|
import type { LocalProtocolOptions } from "../internal-urls";
|
|
@@ -48,6 +50,13 @@ export interface ExecutorOptions {
|
|
|
48
50
|
outputSchema?: unknown;
|
|
49
51
|
/** Parent task recursion depth (0 = top-level, 1 = first child, etc.) */
|
|
50
52
|
taskDepth?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Override the `task.maxRuntimeMs` wall-clock cap for this run. When provided
|
|
55
|
+
* it wins over the settings value; `0` disables the per-subagent wall-clock
|
|
56
|
+
* limit entirely. Used by the eval `agent()` bridge, whose parent cell
|
|
57
|
+
* watchdog is already suspended for the call's duration.
|
|
58
|
+
*/
|
|
59
|
+
maxRuntimeMs?: number;
|
|
51
60
|
enableLsp?: boolean;
|
|
52
61
|
signal?: AbortSignal;
|
|
53
62
|
onProgress?: (progress: AgentProgress) => void;
|
|
@@ -114,6 +123,11 @@ interface FinalizeSubprocessOutputResult {
|
|
|
114
123
|
export declare const SUBAGENT_WARNING_NULL_YIELD = "SYSTEM WARNING: Subagent called yield with null data.";
|
|
115
124
|
export declare const SUBAGENT_WARNING_MISSING_YIELD = "SYSTEM WARNING: Subagent exited without calling yield tool after 3 reminders.";
|
|
116
125
|
export declare function finalizeSubprocessOutput(args: FinalizeSubprocessOutputArgs): FinalizeSubprocessOutputResult;
|
|
126
|
+
/**
|
|
127
|
+
* Create proxy tools that reuse the parent's MCP connections.
|
|
128
|
+
*/
|
|
129
|
+
export declare function createMCPProxyTools(mcpManager: MCPManager): CustomTool[];
|
|
130
|
+
export declare function createSubagentSettings(baseSettings: Settings, overrides?: Partial<Record<SettingPath, unknown>>): Settings;
|
|
117
131
|
/**
|
|
118
132
|
* Run a single agent in-process.
|
|
119
133
|
*/
|
|
@@ -29,6 +29,7 @@ export declare class TaskTool implements AgentTool<TaskToolSchemaInstance, TaskT
|
|
|
29
29
|
readonly strict = true;
|
|
30
30
|
readonly loadMode = "discoverable";
|
|
31
31
|
readonly renderResult: typeof renderResult;
|
|
32
|
+
readonly mergeCallAndResult = true;
|
|
32
33
|
get parameters(): TaskToolSchemaInstance;
|
|
33
34
|
renderCall(args: unknown, options: Parameters<typeof renderTaskCall>[1], theme: Theme): import("@oh-my-pi/pi-tui").Component;
|
|
34
35
|
/** Dynamic description that reflects current disabled-agent settings */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Component } from "@oh-my-pi/pi-tui";
|
|
2
2
|
import type { RenderResultOptions } from "../extensibility/custom-tools/types";
|
|
3
|
-
import type
|
|
3
|
+
import { type Theme } from "../modes/theme/theme";
|
|
4
4
|
import type { TaskParams, TaskToolDetails } from "./types";
|
|
5
5
|
/**
|
|
6
6
|
* Render the tool call arguments.
|
|
@@ -19,8 +19,9 @@ export declare function renderResult(result: {
|
|
|
19
19
|
text?: string;
|
|
20
20
|
}>;
|
|
21
21
|
details?: TaskToolDetails;
|
|
22
|
-
}, options: RenderResultOptions, theme: Theme): Component;
|
|
22
|
+
}, options: RenderResultOptions, theme: Theme, args?: TaskParams): Component;
|
|
23
23
|
export declare const taskToolRenderer: {
|
|
24
24
|
renderCall: typeof renderCall;
|
|
25
25
|
renderResult: typeof renderResult;
|
|
26
|
+
mergeCallAndResult: boolean;
|
|
26
27
|
};
|
|
@@ -10,7 +10,7 @@ export declare function isTelemetryExportEnabled(): boolean;
|
|
|
10
10
|
* the OTEL kill-switches are engaged), so it is safe to call unconditionally at
|
|
11
11
|
* startup.
|
|
12
12
|
*/
|
|
13
|
-
export declare function initTelemetryExport(): void
|
|
13
|
+
export declare function initTelemetryExport(): Promise<void>;
|
|
14
14
|
/**
|
|
15
15
|
* Flush any buffered spans to the exporter. No-op when export is disabled.
|
|
16
16
|
* Hosts embedding the agent can call this at natural boundaries (e.g. the end
|
|
@@ -31,6 +31,8 @@ type EntryStorage = TarStorage | ZipStorage;
|
|
|
31
31
|
interface ArchiveIndexEntry extends ArchiveNode {
|
|
32
32
|
storage?: EntryStorage;
|
|
33
33
|
}
|
|
34
|
+
export declare function formatArchiveEntryLines(entries: readonly ArchiveDirectoryEntry[]): string[];
|
|
35
|
+
export declare function sniffArchiveFormat(bytes: Uint8Array): ArchiveFormat | undefined;
|
|
34
36
|
export declare function parseArchivePathCandidates(filePath: string): ArchivePathCandidate[];
|
|
35
37
|
export declare class ArchiveReader {
|
|
36
38
|
#private;
|
|
@@ -41,4 +43,7 @@ export declare class ArchiveReader {
|
|
|
41
43
|
readFile(subPath: string): Promise<ExtractedArchiveFile>;
|
|
42
44
|
}
|
|
43
45
|
export declare function openArchive(filePath: string): Promise<ArchiveReader>;
|
|
46
|
+
export declare function listArchiveRoot(bytes: Uint8Array, format: ArchiveFormat, opts?: {
|
|
47
|
+
limit?: number;
|
|
48
|
+
}): Promise<string>;
|
|
44
49
|
export {};
|
|
@@ -34,6 +34,9 @@ export interface AstEditToolDetails {
|
|
|
34
34
|
/** Absolute base directory used during the edit. Used by the renderer to resolve
|
|
35
35
|
* display-relative paths to absolute paths for OSC 8 hyperlinks. */
|
|
36
36
|
searchPath?: string;
|
|
37
|
+
/** Session cwd at edit time. Display header paths are cwd-relative, so the
|
|
38
|
+
* renderer resolves them against this; `searchPath` is the scope target. */
|
|
39
|
+
cwd?: string;
|
|
37
40
|
}
|
|
38
41
|
export declare class AstEditTool implements AgentTool<typeof astEditSchema, AstEditToolDetails> {
|
|
39
42
|
private readonly session;
|
|
@@ -31,6 +31,9 @@ export interface AstGrepToolDetails {
|
|
|
31
31
|
/** Absolute base directory used during search. Used by the renderer to resolve
|
|
32
32
|
* display-relative paths to absolute paths for OSC 8 hyperlinks. */
|
|
33
33
|
searchPath?: string;
|
|
34
|
+
/** Session cwd at search time. Display header/match paths are cwd-relative, so
|
|
35
|
+
* the renderer resolves them against this; `searchPath` is the scope target. */
|
|
36
|
+
cwd?: string;
|
|
34
37
|
}
|
|
35
38
|
export declare class AstGrepTool implements AgentTool<typeof astGrepSchema, AstGrepToolDetails> {
|
|
36
39
|
private readonly session;
|
|
@@ -99,6 +99,7 @@ export interface ShellRendererConfig<TArgs> {
|
|
|
99
99
|
resolveCommand?: (args: TArgs | undefined) => string | undefined;
|
|
100
100
|
resolveCwd?: (args: TArgs | undefined) => string | undefined;
|
|
101
101
|
resolveEnv?: (args: TArgs | undefined) => Record<string, string> | undefined;
|
|
102
|
+
showHeader?: boolean;
|
|
102
103
|
}
|
|
103
104
|
export declare function getBashEnvForDisplay(args: BashRenderArgs): Record<string, string> | undefined;
|
|
104
105
|
/**
|