@oh-my-pi/pi-coding-agent 15.10.11 → 15.11.0
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 +103 -2
- package/dist/cli.js +5790 -5731
- package/dist/types/async/index.d.ts +0 -1
- package/dist/types/cli/args.d.ts +1 -0
- package/dist/types/cli/gallery-fixtures/types.d.ts +5 -0
- package/dist/types/cli-commands.d.ts +12 -0
- package/dist/types/commands/launch.d.ts +4 -0
- package/dist/types/config/api-key-resolver.d.ts +3 -0
- package/dist/types/config/keybindings.d.ts +6 -1
- package/dist/types/config/model-registry.d.ts +1 -0
- package/dist/types/config/model-resolver.d.ts +18 -0
- package/dist/types/config/settings-schema.d.ts +85 -34
- package/dist/types/config/settings.d.ts +7 -0
- package/dist/types/edit/hashline/noop-loop-guard.d.ts +72 -0
- package/dist/types/eval/py/executor.d.ts +5 -0
- package/dist/types/eval/py/kernel.d.ts +6 -1
- package/dist/types/eval/py/runtime.d.ts +9 -0
- package/dist/types/exec/bash-executor.d.ts +2 -0
- 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/extensions/runner.d.ts +3 -2
- package/dist/types/extensibility/extensions/types.d.ts +3 -0
- 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/memory-backend/index.d.ts +1 -0
- package/dist/types/memory-backend/runtime.d.ts +4 -0
- package/dist/types/memory-backend/types.d.ts +66 -1
- package/dist/types/modes/components/agent-hub.d.ts +30 -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/tool-execution.d.ts +8 -0
- 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/index.d.ts +3 -3
- package/dist/types/modes/interactive-mode.d.ts +10 -4
- package/dist/types/modes/oauth-manual-input.d.ts +7 -0
- package/dist/types/modes/rpc/rpc-client.d.ts +39 -2
- package/dist/types/modes/rpc/rpc-mode.d.ts +31 -2
- package/dist/types/modes/rpc/rpc-subagents.d.ts +24 -0
- package/dist/types/modes/rpc/rpc-types.d.ts +75 -1
- package/dist/types/modes/setup-wizard/index.d.ts +5 -1
- package/dist/types/modes/setup-wizard/lazy.d.ts +2 -0
- package/dist/types/modes/theme/theme.d.ts +2 -1
- package/dist/types/modes/types.d.ts +5 -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/secrets/index.d.ts +1 -1
- package/dist/types/secrets/obfuscator.d.ts +8 -2
- package/dist/types/session/agent-session.d.ts +49 -32
- 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 +46 -0
- package/dist/types/slash-commands/acp-builtins.d.ts +16 -0
- package/dist/types/slash-commands/builtin-registry.d.ts +1 -0
- package/dist/types/slash-commands/types.d.ts +1 -1
- package/dist/types/system-prompt.d.ts +2 -0
- package/dist/types/task/executor.d.ts +12 -2
- package/dist/types/task/index.d.ts +13 -6
- 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 +63 -51
- package/dist/types/thinking.d.ts +4 -0
- package/dist/types/tiny/title-client.d.ts +11 -0
- package/dist/types/tiny/title-protocol.d.ts +1 -0
- 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 +7 -3
- package/dist/types/tools/irc.d.ts +76 -38
- package/dist/types/tools/job.d.ts +7 -1
- package/dist/types/utils/git.d.ts +15 -2
- package/dist/types/utils/title-generator.d.ts +3 -2
- 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/auto-thinking/classifier.ts +1 -0
- package/src/cli/args.ts +3 -0
- package/src/cli/gallery-cli.ts +1 -1
- package/src/cli/gallery-fixtures/agentic.ts +230 -115
- package/src/cli/gallery-fixtures/types.ts +5 -0
- package/src/cli-commands.ts +29 -0
- package/src/cli.ts +28 -15
- package/src/commands/launch.ts +4 -0
- package/src/commit/agentic/tools/analyze-file.ts +38 -19
- package/src/commit/model-selection.ts +3 -2
- package/src/config/api-key-resolver.ts +8 -6
- package/src/config/keybindings.ts +6 -1
- package/src/config/model-registry.ts +97 -30
- package/src/config/model-resolver.ts +60 -0
- package/src/config/settings-schema.ts +99 -55
- package/src/config/settings.ts +68 -3
- package/src/edit/hashline/execute.ts +39 -2
- package/src/edit/hashline/noop-loop-guard.ts +99 -0
- package/src/eval/__tests__/agent-bridge.test.ts +5 -3
- package/src/eval/agent-bridge.ts +3 -16
- package/src/eval/completion-bridge.ts +1 -0
- package/src/eval/js/shared/prelude.txt +1 -1
- package/src/eval/py/executor.ts +29 -7
- package/src/eval/py/index.ts +6 -1
- package/src/eval/py/kernel.ts +31 -11
- package/src/eval/py/prelude.py +5 -6
- package/src/eval/py/runtime.ts +37 -0
- package/src/exec/bash-executor.ts +82 -3
- package/src/export/html/template.generated.ts +1 -1
- package/src/export/html/template.js +38 -13
- package/src/extensibility/custom-tools/types.ts +2 -2
- package/src/extensibility/extensions/get-commands-handler.ts +2 -1
- package/src/extensibility/extensions/runner.ts +6 -1
- package/src/extensibility/extensions/types.ts +3 -0
- package/src/extensibility/shared-events.ts +2 -2
- package/src/hindsight/bank.ts +17 -2
- package/src/internal-urls/docs-index.generated.ts +11 -11
- 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 +26 -66
- package/src/memories/index.ts +2 -0
- package/src/memory-backend/index.ts +1 -0
- package/src/memory-backend/local-backend.ts +9 -0
- package/src/memory-backend/off-backend.ts +9 -0
- package/src/memory-backend/runtime.ts +66 -0
- package/src/memory-backend/types.ts +81 -1
- package/src/mnemopi/backend.ts +151 -4
- package/src/modes/acp/acp-agent.ts +119 -11
- package/src/modes/components/{session-observer-overlay.ts → agent-hub.ts} +586 -367
- package/src/modes/components/assistant-message.ts +19 -21
- package/src/modes/components/compaction-summary-message.ts +68 -32
- package/src/modes/components/custom-editor.ts +10 -0
- package/src/modes/components/footer.ts +3 -1
- package/src/modes/components/status-line/component.ts +118 -34
- package/src/modes/components/tool-execution.ts +31 -1
- package/src/modes/components/ttsr-notification.ts +72 -30
- package/src/modes/components/welcome.ts +9 -33
- package/src/modes/controllers/command-controller.ts +1 -1
- package/src/modes/controllers/event-controller.ts +65 -0
- package/src/modes/controllers/extension-ui-controller.ts +8 -8
- package/src/modes/controllers/input-controller.ts +19 -2
- package/src/modes/controllers/mcp-command-controller.ts +38 -3
- package/src/modes/controllers/selector-controller.ts +21 -17
- package/src/modes/index.ts +3 -21
- package/src/modes/interactive-mode.ts +47 -22
- package/src/modes/oauth-manual-input.ts +30 -3
- package/src/modes/rpc/rpc-client.ts +154 -3
- package/src/modes/rpc/rpc-mode.ts +97 -12
- package/src/modes/rpc/rpc-subagents.ts +265 -0
- package/src/modes/rpc/rpc-types.ts +81 -1
- package/src/modes/setup-wizard/index.ts +12 -2
- package/src/modes/setup-wizard/lazy.ts +16 -0
- package/src/modes/theme/theme.ts +18 -5
- package/src/modes/types.ts +5 -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 +38 -29
- package/src/registry/agent-lifecycle.ts +218 -0
- package/src/registry/agent-registry.ts +16 -5
- package/src/sdk.ts +37 -10
- package/src/secrets/index.ts +8 -1
- package/src/secrets/obfuscator.ts +39 -18
- package/src/session/agent-session.ts +422 -291
- 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 +226 -10
- package/src/slash-commands/acp-builtins.ts +24 -0
- package/src/slash-commands/builtin-registry.ts +20 -0
- package/src/slash-commands/types.ts +1 -1
- package/src/system-prompt.ts +14 -0
- package/src/task/executor.ts +851 -461
- package/src/task/index.ts +721 -796
- package/src/task/output-manager.ts +0 -11
- package/src/task/render.ts +148 -63
- package/src/task/repair-args.ts +21 -9
- package/src/task/types.ts +82 -66
- package/src/thinking.ts +7 -0
- package/src/tiny/title-client.ts +34 -5
- package/src/tiny/title-protocol.ts +1 -1
- package/src/tiny/worker.ts +6 -4
- package/src/tools/ask.ts +4 -2
- package/src/tools/bash.ts +61 -10
- 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/image-gen.ts +11 -4
- package/src/tools/index.ts +17 -13
- package/src/tools/inspect-image.ts +1 -0
- package/src/tools/irc.ts +596 -171
- package/src/tools/job.ts +41 -7
- package/src/tools/read.ts +57 -1
- package/src/tools/renderers.ts +2 -0
- package/src/tools/resolve.ts +4 -1
- package/src/utils/commit-message-generator.ts +1 -0
- package/src/utils/git.ts +267 -13
- package/src/utils/title-generator.ts +24 -5
- 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
|
@@ -9,7 +9,9 @@ import type { CompactionResult } from "@oh-my-pi/pi-agent-core/compaction";
|
|
|
9
9
|
import type { Effort, ImageContent, Model } from "@oh-my-pi/pi-ai";
|
|
10
10
|
import type { BashResult } from "../../exec/bash-executor";
|
|
11
11
|
import type { ContextUsage } from "../../extensibility/extensions/types";
|
|
12
|
-
import type { SessionStats } from "../../session/agent-session";
|
|
12
|
+
import type { AgentSessionEvent, SessionStats } from "../../session/agent-session";
|
|
13
|
+
import type { FileEntry } from "../../session/session-manager";
|
|
14
|
+
import type { AgentProgress, SubagentEventPayload, SubagentLifecyclePayload, SubagentProgressPayload } from "../../task";
|
|
13
15
|
import type { TodoPhase } from "../../tools/todo";
|
|
14
16
|
export type RpcCommand = {
|
|
15
17
|
id?: string;
|
|
@@ -54,6 +56,19 @@ export type RpcCommand = {
|
|
|
54
56
|
id?: string;
|
|
55
57
|
type: "set_host_uri_schemes";
|
|
56
58
|
schemes: RpcHostUriSchemeDefinition[];
|
|
59
|
+
} | {
|
|
60
|
+
id?: string;
|
|
61
|
+
type: "set_subagent_subscription";
|
|
62
|
+
level: RpcSubagentSubscriptionLevel;
|
|
63
|
+
} | {
|
|
64
|
+
id?: string;
|
|
65
|
+
type: "get_subagents";
|
|
66
|
+
} | {
|
|
67
|
+
id?: string;
|
|
68
|
+
type: "get_subagent_messages";
|
|
69
|
+
subagentId?: string;
|
|
70
|
+
sessionFile?: string;
|
|
71
|
+
fromByte?: number;
|
|
57
72
|
} | {
|
|
58
73
|
id?: string;
|
|
59
74
|
type: "set_model";
|
|
@@ -174,6 +189,29 @@ export interface RpcSessionState {
|
|
|
174
189
|
export interface RpcHandoffResult {
|
|
175
190
|
savedPath?: string;
|
|
176
191
|
}
|
|
192
|
+
export type RpcSubagentSubscriptionLevel = "off" | "progress" | "events";
|
|
193
|
+
export interface RpcSubagentSnapshot {
|
|
194
|
+
id: string;
|
|
195
|
+
index: number;
|
|
196
|
+
agent: string;
|
|
197
|
+
agentSource: AgentProgress["agentSource"];
|
|
198
|
+
description?: string;
|
|
199
|
+
status: AgentProgress["status"];
|
|
200
|
+
task?: string;
|
|
201
|
+
assignment?: string;
|
|
202
|
+
sessionFile?: string;
|
|
203
|
+
lastUpdate: number;
|
|
204
|
+
progress?: AgentProgress;
|
|
205
|
+
parentToolCallId?: string;
|
|
206
|
+
}
|
|
207
|
+
export interface RpcSubagentMessagesResult {
|
|
208
|
+
sessionFile: string;
|
|
209
|
+
fromByte: number;
|
|
210
|
+
nextByte: number;
|
|
211
|
+
reset: boolean;
|
|
212
|
+
entries: FileEntry[];
|
|
213
|
+
messages: AgentMessage[];
|
|
214
|
+
}
|
|
177
215
|
export type RpcResponse = {
|
|
178
216
|
id?: string;
|
|
179
217
|
type: "response";
|
|
@@ -237,6 +275,28 @@ export type RpcResponse = {
|
|
|
237
275
|
data: {
|
|
238
276
|
schemes: string[];
|
|
239
277
|
};
|
|
278
|
+
} | {
|
|
279
|
+
id?: string;
|
|
280
|
+
type: "response";
|
|
281
|
+
command: "set_subagent_subscription";
|
|
282
|
+
success: true;
|
|
283
|
+
data: {
|
|
284
|
+
level: RpcSubagentSubscriptionLevel;
|
|
285
|
+
};
|
|
286
|
+
} | {
|
|
287
|
+
id?: string;
|
|
288
|
+
type: "response";
|
|
289
|
+
command: "get_subagents";
|
|
290
|
+
success: true;
|
|
291
|
+
data: {
|
|
292
|
+
subagents: RpcSubagentSnapshot[];
|
|
293
|
+
};
|
|
294
|
+
} | {
|
|
295
|
+
id?: string;
|
|
296
|
+
type: "response";
|
|
297
|
+
command: "get_subagent_messages";
|
|
298
|
+
success: true;
|
|
299
|
+
data: RpcSubagentMessagesResult;
|
|
240
300
|
} | {
|
|
241
301
|
id?: string;
|
|
242
302
|
type: "response";
|
|
@@ -418,6 +478,20 @@ export type RpcResponse = {
|
|
|
418
478
|
success: false;
|
|
419
479
|
error: string;
|
|
420
480
|
};
|
|
481
|
+
export interface RpcSubagentLifecycleFrame {
|
|
482
|
+
type: "subagent_lifecycle";
|
|
483
|
+
payload: SubagentLifecyclePayload;
|
|
484
|
+
}
|
|
485
|
+
export interface RpcSubagentProgressFrame {
|
|
486
|
+
type: "subagent_progress";
|
|
487
|
+
payload: SubagentProgressPayload;
|
|
488
|
+
}
|
|
489
|
+
export interface RpcSubagentEventFrame {
|
|
490
|
+
type: "subagent_event";
|
|
491
|
+
payload: SubagentEventPayload;
|
|
492
|
+
}
|
|
493
|
+
export type RpcSubagentFrame = RpcSubagentLifecycleFrame | RpcSubagentProgressFrame | RpcSubagentEventFrame;
|
|
494
|
+
export type RpcSessionEventFrame = AgentSessionEvent | RpcSubagentFrame;
|
|
421
495
|
/** Emitted when an extension needs user input */
|
|
422
496
|
export type RpcExtensionUIRequest = {
|
|
423
497
|
type: "extension_ui_request";
|
|
@@ -14,4 +14,8 @@ export interface SetupSceneSelectionOptions {
|
|
|
14
14
|
}
|
|
15
15
|
export declare function selectSetupScenes(storedVersion: number, scenes: readonly SetupScene[], ctx?: InteractiveModeContext, options?: SetupSceneSelectionOptions): Promise<SetupScene[]>;
|
|
16
16
|
export declare function markSetupWizardComplete(settings: Settings, version?: number): Promise<void>;
|
|
17
|
-
export
|
|
17
|
+
export interface RunSetupWizardOptions {
|
|
18
|
+
markComplete?: boolean;
|
|
19
|
+
playWelcomeIntro?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare function runSetupWizard(ctx: InteractiveModeContext, scenes?: readonly SetupScene[], options?: RunSetupWizardOptions): Promise<void>;
|
|
@@ -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" | "status.done" | "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" | "tool.write" | "tool.edit" | "tool.bash" | "tool.ssh" | "tool.lsp" | "tool.gh" | "tool.webSearch" | "tool.exa" | "tool.browser" | "tool.eval" | "tool.debug" | "tool.mcp" | "tool.job" | "tool.task" | "tool.todo" | "tool.memory" | "tool.ask" | "tool.resolve" | "tool.review" | "tool.inspectImage" | "tool.goal";
|
|
9
|
+
export type SymbolKey = "status.success" | "status.error" | "status.warning" | "status.info" | "status.pending" | "status.disabled" | "status.enabled" | "status.running" | "status.shadowed" | "status.aborted" | "status.done" | "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" | "icon.camera" | "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" | "tool.write" | "tool.edit" | "tool.bash" | "tool.ssh" | "tool.lsp" | "tool.gh" | "tool.webSearch" | "tool.exa" | "tool.browser" | "tool.eval" | "tool.debug" | "tool.mcp" | "tool.job" | "tool.task" | "tool.todo" | "tool.memory" | "tool.ask" | "tool.resolve" | "tool.review" | "tool.inspectImage" | "tool.goal" | "tool.irc";
|
|
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 */
|
|
@@ -170,6 +170,7 @@ export declare class Theme {
|
|
|
170
170
|
extensionContextFile: string;
|
|
171
171
|
extensionInstruction: string;
|
|
172
172
|
mic: string;
|
|
173
|
+
camera: string;
|
|
173
174
|
};
|
|
174
175
|
get thinking(): {
|
|
175
176
|
minimal: string;
|
|
@@ -82,6 +82,7 @@ export interface InteractiveModeContext {
|
|
|
82
82
|
historyStorage?: HistoryStorage;
|
|
83
83
|
mcpManager?: MCPManager;
|
|
84
84
|
lspServers?: LspStartupServerInfo[];
|
|
85
|
+
titleSystemPrompt?: string;
|
|
85
86
|
isInitialized: boolean;
|
|
86
87
|
isBashMode: boolean;
|
|
87
88
|
toolOutputExpanded: boolean;
|
|
@@ -116,6 +117,7 @@ export interface InteractiveModeContext {
|
|
|
116
117
|
locallySubmittedUserSignatures: Set<string>;
|
|
117
118
|
lastSigintTime: number;
|
|
118
119
|
lastEscapeTime: number;
|
|
120
|
+
lastLeftTapTime: number;
|
|
119
121
|
shutdownRequested: boolean;
|
|
120
122
|
hookSelector: HookSelectorComponent | undefined;
|
|
121
123
|
hookInput: HookInputComponent | undefined;
|
|
@@ -203,7 +205,7 @@ export interface InteractiveModeContext {
|
|
|
203
205
|
updateFooter?: boolean;
|
|
204
206
|
populateHistory?: boolean;
|
|
205
207
|
}): void;
|
|
206
|
-
renderInitialMessages(
|
|
208
|
+
renderInitialMessages(options?: {
|
|
207
209
|
preserveExistingChat?: boolean;
|
|
208
210
|
clearTerminalHistory?: boolean;
|
|
209
211
|
}): void;
|
|
@@ -262,9 +264,10 @@ export interface InteractiveModeContext {
|
|
|
262
264
|
handleResumeSession(sessionPath: string): Promise<void>;
|
|
263
265
|
handleSessionDeleteCommand(): Promise<void>;
|
|
264
266
|
showOAuthSelector(mode: "login" | "logout", providerId?: string): Promise<void>;
|
|
267
|
+
showProviderSetup(): Promise<void>;
|
|
265
268
|
showHookConfirm(title: string, message: string): Promise<boolean>;
|
|
266
269
|
showDebugSelector(): Promise<void>;
|
|
267
|
-
|
|
270
|
+
showAgentHub(): void;
|
|
268
271
|
resetObserverRegistry(): void;
|
|
269
272
|
handleCtrlC(): void;
|
|
270
273
|
handleCtrlD(): void;
|
|
@@ -36,7 +36,7 @@ export declare class UiHelpers {
|
|
|
36
36
|
updateFooter?: boolean;
|
|
37
37
|
populateHistory?: boolean;
|
|
38
38
|
}): void;
|
|
39
|
-
renderInitialMessages(
|
|
39
|
+
renderInitialMessages(options?: RenderInitialMessagesOptions): void;
|
|
40
40
|
clearEditor(): void;
|
|
41
41
|
showError(errorMessage: string): void;
|
|
42
42
|
showWarning(warningMessage: string): void;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentLifecycleManager - Owns the idle → parked → revived lifecycle of
|
|
3
|
+
* adopted subagents.
|
|
4
|
+
*
|
|
5
|
+
* The task executor hands a finished agent over via {@link AgentLifecycleManager.adopt};
|
|
6
|
+
* from then on the manager arms a TTL timer whenever the agent goes `idle`,
|
|
7
|
+
* parks it on expiry (disposes the live session, keeps the AgentRef +
|
|
8
|
+
* sessionFile), and revives it on demand through
|
|
9
|
+
* {@link AgentLifecycleManager.ensureLive}. Only this manager flips
|
|
10
|
+
* `parked` ↔ `idle`.
|
|
11
|
+
*/
|
|
12
|
+
import type { AgentSession } from "../session/agent-session";
|
|
13
|
+
import { AgentRegistry } from "./agent-registry";
|
|
14
|
+
export type AgentReviver = () => Promise<AgentSession>;
|
|
15
|
+
export interface AdoptOptions {
|
|
16
|
+
/** TTL before an idle agent is parked. <= 0 disables parking. */
|
|
17
|
+
idleTtlMs: number;
|
|
18
|
+
/** Recreates a live AgentSession from the ref's sessionFile. Absent => not resumable after park (e.g. isolated runs). */
|
|
19
|
+
revive?: AgentReviver;
|
|
20
|
+
}
|
|
21
|
+
export declare class AgentLifecycleManager {
|
|
22
|
+
#private;
|
|
23
|
+
static global(): AgentLifecycleManager;
|
|
24
|
+
/** Reset the global manager. Test-only. */
|
|
25
|
+
static resetGlobalForTests(): void;
|
|
26
|
+
constructor(registry?: AgentRegistry);
|
|
27
|
+
/**
|
|
28
|
+
* Take ownership of a finished subagent. Caller has already set registry
|
|
29
|
+
* status to "idle". Arms the TTL timer (idleTtlMs <= 0 adopts without one).
|
|
30
|
+
*/
|
|
31
|
+
adopt(id: string, opts: AdoptOptions): void;
|
|
32
|
+
/** True if the id is adopted (parked or live). */
|
|
33
|
+
has(id: string): boolean;
|
|
34
|
+
/** True while {@link park} is disposing this agent's session (lets dispose hooks distinguish park from teardown). */
|
|
35
|
+
isParking(id: string): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Dispose the live session, detach it from the registry, and mark the
|
|
38
|
+
* agent `parked`. No-op unless the id is adopted and live.
|
|
39
|
+
*/
|
|
40
|
+
park(id: string): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Return the live session, reviving from the sessionFile if parked.
|
|
43
|
+
* Throws a plain Error if the id is unknown or parked without a reviver.
|
|
44
|
+
* Concurrent calls share one in-flight revive.
|
|
45
|
+
*/
|
|
46
|
+
ensureLive(id: string): Promise<AgentSession>;
|
|
47
|
+
/** Hard removal: dispose if live, unregister from registry, drop timers. */
|
|
48
|
+
release(id: string): Promise<void>;
|
|
49
|
+
/** Teardown everything (process exit / main session dispose). */
|
|
50
|
+
dispose(): Promise<void>;
|
|
51
|
+
}
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* AgentRegistry - Process-global registry of
|
|
2
|
+
* AgentRegistry - Process-global registry of agents (the main session plus
|
|
3
|
+
* every subagent), keyed by stable id.
|
|
3
4
|
*
|
|
4
|
-
* Tracks
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Tracks each agent's status and (when live) its AgentSession so peers can be
|
|
6
|
+
* addressed by id (`irc`, `task resume`, `history://`). Sessions are
|
|
7
|
+
* registered explicitly at creation; finished agents stay registered as
|
|
8
|
+
* `idle` (live) or `parked` (session disposed, ref + sessionFile retained for
|
|
9
|
+
* revival) and are only removed on explicit release/teardown.
|
|
7
10
|
*/
|
|
8
11
|
import type { AgentSession } from "../session/agent-session";
|
|
9
12
|
export declare const MAIN_AGENT_ID = "Main";
|
|
10
|
-
|
|
13
|
+
/**
|
|
14
|
+
* - `running`: a turn is in flight.
|
|
15
|
+
* - `idle`: live AgentSession in memory, awaiting work. Finished agents are
|
|
16
|
+
* `idle`, not removed.
|
|
17
|
+
* - `parked`: session disposed; AgentRef + sessionFile retained, revivable.
|
|
18
|
+
* - `aborted`: hard-killed, terminal.
|
|
19
|
+
*/
|
|
20
|
+
export type AgentStatus = "running" | "idle" | "parked" | "aborted";
|
|
11
21
|
export type AgentKind = "main" | "sub";
|
|
12
22
|
export interface AgentRef {
|
|
13
23
|
id: string;
|
|
@@ -15,6 +25,7 @@ export interface AgentRef {
|
|
|
15
25
|
kind: AgentKind;
|
|
16
26
|
parentId?: string;
|
|
17
27
|
status: AgentStatus;
|
|
28
|
+
/** Null exactly when parked/aborted. */
|
|
18
29
|
session: AgentSession | null;
|
|
19
30
|
sessionFile: string | null;
|
|
20
31
|
createdAt: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SecretEntry } from "./obfuscator";
|
|
2
|
-
export { deobfuscateSessionContext, obfuscateMessages, type SecretEntry, SecretObfuscator } from "./obfuscator";
|
|
2
|
+
export { deobfuscateSessionContext, obfuscateMessages, obfuscateProviderContext, obfuscateProviderTools, type SecretEntry, SecretObfuscator, } from "./obfuscator";
|
|
3
3
|
/**
|
|
4
4
|
* Load secrets from project-local and global secrets.yml files.
|
|
5
5
|
* Project-local entries override global entries with matching content.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Message } from "@oh-my-pi/pi-ai";
|
|
1
|
+
import type { Context, Message, Tool } from "@oh-my-pi/pi-ai";
|
|
2
2
|
import type { SessionContext } from "../session/session-manager";
|
|
3
3
|
export interface SecretEntry {
|
|
4
4
|
type: "plain" | "regex";
|
|
@@ -17,7 +17,13 @@ export declare class SecretObfuscator {
|
|
|
17
17
|
deobfuscate(text: string): string;
|
|
18
18
|
/** Deep-walk an object, deobfuscating all string values. */
|
|
19
19
|
deobfuscateObject<T>(obj: T): T;
|
|
20
|
+
/** Deep-walk an object, obfuscating all string values. */
|
|
21
|
+
obfuscateObject<T>(obj: T): T;
|
|
20
22
|
}
|
|
21
23
|
export declare function deobfuscateSessionContext(sessionContext: SessionContext, obfuscator: SecretObfuscator | undefined): SessionContext;
|
|
22
|
-
/** Obfuscate all
|
|
24
|
+
/** Obfuscate all string content in LLM messages (for outbound interception). */
|
|
23
25
|
export declare function obfuscateMessages(obfuscator: SecretObfuscator, messages: Message[]): Message[];
|
|
26
|
+
/** Obfuscate provider request context without walking live tool schema instances. */
|
|
27
|
+
export declare function obfuscateProviderContext(obfuscator: SecretObfuscator | undefined, context: Context): Context;
|
|
28
|
+
/** Convert tool schemas to wire JSON Schema before obfuscating provider-visible strings. */
|
|
29
|
+
export declare function obfuscateProviderTools(obfuscator: SecretObfuscator | undefined, tools: Tool[] | undefined): Tool[] | undefined;
|
|
@@ -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;
|
|
@@ -127,6 +127,8 @@ export interface AgentSessionConfig {
|
|
|
127
127
|
agent: Agent;
|
|
128
128
|
sessionManager: SessionManager;
|
|
129
129
|
settings: Settings;
|
|
130
|
+
/** Whether the caller explicitly requested yolo/auto-approve behavior for this session. */
|
|
131
|
+
autoApprove?: boolean;
|
|
130
132
|
/** Models to cycle through with Ctrl+P (from --models flag) */
|
|
131
133
|
scopedModels?: Array<{
|
|
132
134
|
model: Model;
|
|
@@ -212,8 +214,6 @@ export interface AgentSessionConfig {
|
|
|
212
214
|
asyncJobManager?: AsyncJobManager;
|
|
213
215
|
/** Agent identity (registry id like "Main" or "Alice") used for IRC routing. */
|
|
214
216
|
agentId?: string;
|
|
215
|
-
/** Shared agent registry (for forwarding IRC observations to the main session UI). */
|
|
216
|
-
agentRegistry?: AgentRegistry;
|
|
217
217
|
/**
|
|
218
218
|
* Override the provider-facing session ID for all API requests from this session.
|
|
219
219
|
* When absent, `sessionManager.getSessionId()` is used. Needed when benchmark or
|
|
@@ -378,6 +378,16 @@ export declare class AgentSession {
|
|
|
378
378
|
* Multiple listeners can be added. Returns unsubscribe function for this listener.
|
|
379
379
|
*/
|
|
380
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;
|
|
381
391
|
/**
|
|
382
392
|
* Remove all listeners, flush pending writes, and disconnect from agent.
|
|
383
393
|
* Call this when completely done with the session.
|
|
@@ -481,6 +491,13 @@ export declare class AgentSession {
|
|
|
481
491
|
/** All messages including custom types like BashExecutionMessage */
|
|
482
492
|
get messages(): AgentMessage[];
|
|
483
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;
|
|
484
501
|
/** Convert session messages using the same pre-LLM pipeline as the active session. */
|
|
485
502
|
convertMessagesToLlm(messages: AgentMessage[], signal?: AbortSignal): Promise<Message[]>;
|
|
486
503
|
/** Apply session-level stream hooks to a direct side request. */
|
|
@@ -548,7 +565,14 @@ export declare class AgentSession {
|
|
|
548
565
|
* @throws Error if streaming and no streamingBehavior specified
|
|
549
566
|
* @throws Error if no model selected or no API key available (when not streaming)
|
|
550
567
|
*/
|
|
551
|
-
|
|
568
|
+
/**
|
|
569
|
+
* Returns `false` when the command was fully handled locally (extension or
|
|
570
|
+
* custom-TS command consumed without calling the LLM). Returns `true` when
|
|
571
|
+
* the prompt was forwarded to the agent — either directly or queued as a
|
|
572
|
+
* steer/follow-up. Callers that render a UI or manage turn lifecycle (e.g.
|
|
573
|
+
* the ACP agent) use this to know whether to expect an `agent_end` event.
|
|
574
|
+
*/
|
|
575
|
+
prompt(text: string, options?: PromptOptions): Promise<boolean>;
|
|
552
576
|
promptCustomMessage<T = unknown>(message: Pick<CustomMessage<T>, "customType" | "content" | "display" | "details" | "attribution">, options?: Pick<PromptOptions, "streamingBehavior" | "toolChoice">): Promise<void>;
|
|
553
577
|
/**
|
|
554
578
|
* Queue a steering message to interrupt the agent mid-run.
|
|
@@ -700,7 +724,8 @@ export declare class AgentSession {
|
|
|
700
724
|
*/
|
|
701
725
|
cycleRoleModels(roleOrder: readonly string[], direction?: "forward" | "backward"): Promise<RoleModelCycleResult | undefined>;
|
|
702
726
|
/**
|
|
703
|
-
* Get all available models with valid API keys.
|
|
727
|
+
* Get all available models with valid API keys, filtered by `enabledModels` when configured.
|
|
728
|
+
* See {@link filterAvailableModelsByEnabledPatterns} for supported pattern forms and limitations.
|
|
704
729
|
*/
|
|
705
730
|
getAvailableModels(): Model[];
|
|
706
731
|
/**
|
|
@@ -849,9 +874,11 @@ export declare class AgentSession {
|
|
|
849
874
|
* @param command The bash command to execute
|
|
850
875
|
* @param onChunk Optional streaming callback for output
|
|
851
876
|
* @param options.excludeFromContext If true, command output won't be sent to LLM (!! prefix)
|
|
877
|
+
* @param options.useUserShell If true, allow caller to request configured user-shell routing
|
|
852
878
|
*/
|
|
853
879
|
executeBash(command: string, onChunk?: (chunk: string) => void, options?: {
|
|
854
880
|
excludeFromContext?: boolean;
|
|
881
|
+
useUserShell?: boolean;
|
|
855
882
|
}): Promise<BashResult>;
|
|
856
883
|
/**
|
|
857
884
|
* Record a bash execution result in session history.
|
|
@@ -898,27 +925,23 @@ export declare class AgentSession {
|
|
|
898
925
|
/** Whether there are pending Python messages waiting to be flushed */
|
|
899
926
|
get hasPendingPythonMessages(): boolean;
|
|
900
927
|
/**
|
|
901
|
-
*
|
|
902
|
-
*
|
|
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:
|
|
903
932
|
*
|
|
904
|
-
*
|
|
905
|
-
*
|
|
906
|
-
*
|
|
907
|
-
*
|
|
908
|
-
*
|
|
909
|
-
*
|
|
910
|
-
*/
|
|
911
|
-
|
|
912
|
-
from: string;
|
|
913
|
-
message: string;
|
|
914
|
-
awaitReply?: boolean;
|
|
915
|
-
signal?: AbortSignal;
|
|
916
|
-
}): Promise<{
|
|
917
|
-
replyText: string | null;
|
|
918
|
-
}>;
|
|
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">;
|
|
919
941
|
/**
|
|
920
942
|
* Emit an IRC relay observation event on this session for UI rendering only.
|
|
921
|
-
* 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.
|
|
922
945
|
*/
|
|
923
946
|
emitIrcRelayObservation(record: CustomMessage): void;
|
|
924
947
|
/**
|
|
@@ -927,7 +950,7 @@ export declare class AgentSession {
|
|
|
927
950
|
* does not block on, or interfere with, any in-flight main turn. The
|
|
928
951
|
* session's history and persisted state are NOT modified by this call.
|
|
929
952
|
*
|
|
930
|
-
* Used by `
|
|
953
|
+
* Used by `BtwController` (`/btw`) and `OmfgController` (`/omfg`) to share
|
|
931
954
|
* the snapshot + stream pipeline. The snapshot includes any in-flight
|
|
932
955
|
* streaming assistant text so the model sees the half-finished response
|
|
933
956
|
* rather than missing context.
|
|
@@ -1033,12 +1056,6 @@ export declare class AgentSession {
|
|
|
1033
1056
|
* Includes user messages, assistant text, thinking blocks, tool calls, and tool results.
|
|
1034
1057
|
*/
|
|
1035
1058
|
formatSessionAsText(): string;
|
|
1036
|
-
/**
|
|
1037
|
-
* Format the conversation as compact context for subagents.
|
|
1038
|
-
* Includes only user messages and assistant text responses.
|
|
1039
|
-
* Excludes: system prompt, tool definitions, tool calls/results, thinking blocks.
|
|
1040
|
-
*/
|
|
1041
|
-
formatCompactContext(): string;
|
|
1042
1059
|
/**
|
|
1043
1060
|
* Check if extensions have handlers for a specific event type.
|
|
1044
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
|
/**
|