@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
|
@@ -88,10 +88,10 @@ export type CustomToolSessionEvent = {
|
|
|
88
88
|
} | {
|
|
89
89
|
reason: "auto_compaction_start";
|
|
90
90
|
trigger: "threshold" | "overflow" | "idle" | "incomplete";
|
|
91
|
-
action: "context-full" | "handoff" | "shake";
|
|
91
|
+
action: "context-full" | "handoff" | "shake" | "snapcompact";
|
|
92
92
|
} | {
|
|
93
93
|
reason: "auto_compaction_end";
|
|
94
|
-
action: "context-full" | "handoff" | "shake";
|
|
94
|
+
action: "context-full" | "handoff" | "shake" | "snapcompact";
|
|
95
95
|
result: CompactionResult | undefined;
|
|
96
96
|
aborted: boolean;
|
|
97
97
|
willRetry: boolean;
|
|
@@ -5,6 +5,7 @@ import type { AgentMessage } from "@oh-my-pi/pi-agent-core";
|
|
|
5
5
|
import type { CredentialDisabledEvent, ImageContent, Model, ProviderResponseMetadata } from "@oh-my-pi/pi-ai";
|
|
6
6
|
import type { KeyId } from "@oh-my-pi/pi-tui";
|
|
7
7
|
import type { ModelRegistry } from "../../config/model-registry";
|
|
8
|
+
import type { MemoryRuntimeContext } from "../../memory-backend";
|
|
8
9
|
import type { SessionManager } from "../../session/session-manager";
|
|
9
10
|
import type { AfterProviderResponseEvent, AssistantThinkingRenderer, BeforeAgentStartEvent, BeforeAgentStartEventResult, BeforeProviderRequestEvent, BeforeProviderRequestEventResult, ContextEvent, Extension, ExtensionActions, ExtensionCommandContext, ExtensionCommandContextActions, ExtensionContext, ExtensionContextActions, ExtensionError, ExtensionEvent, ExtensionFlag, ExtensionRuntime, ExtensionShortcut, ExtensionUIContext, InputEvent, InputEventResult, MessageRenderer, RegisteredCommand, RegisteredTool, ResourcesDiscoverEvent, SessionBeforeBranchResult, SessionBeforeCompactResult, SessionBeforeSwitchResult, SessionBeforeTreeResult, SessionCompactingResult, ToolCallEvent, ToolCallEventResult, ToolResultEvent, ToolResultEventResult, UserBashEvent, UserBashEventResult, UserPythonEvent, UserPythonEventResult } from "./types";
|
|
10
11
|
/** Combined result from all before_agent_start handlers */
|
|
@@ -61,7 +62,7 @@ export declare class ExtensionRunner {
|
|
|
61
62
|
private readonly cwd;
|
|
62
63
|
private readonly sessionManager;
|
|
63
64
|
private readonly modelRegistry;
|
|
64
|
-
constructor(extensions: Extension[], runtime: ExtensionRuntime, cwd: string, sessionManager: SessionManager, modelRegistry: ModelRegistry);
|
|
65
|
+
constructor(extensions: Extension[], runtime: ExtensionRuntime, cwd: string, sessionManager: SessionManager, modelRegistry: ModelRegistry, getMemory?: () => MemoryRuntimeContext | undefined);
|
|
65
66
|
initialize(actions: ExtensionActions, contextActions: ExtensionContextActions, commandContextActions?: ExtensionCommandContextActions, uiContext?: ExtensionUIContext): void;
|
|
66
67
|
/**
|
|
67
68
|
* Forward a `credential_disabled` event from `AuthStorage` to extension handlers.
|
|
@@ -99,7 +100,7 @@ export declare class ExtensionRunner {
|
|
|
99
100
|
hasHandlers(eventType: string): boolean;
|
|
100
101
|
getMessageRenderer(customType: string): MessageRenderer | undefined;
|
|
101
102
|
getAssistantThinkingRenderers(): AssistantThinkingRenderer[];
|
|
102
|
-
getRegisteredCommands(reserved?:
|
|
103
|
+
getRegisteredCommands(reserved?: ReadonlySet<string>): RegisteredCommand[];
|
|
103
104
|
getCommandDiagnostics(): Array<{
|
|
104
105
|
type: string;
|
|
105
106
|
message: string;
|
|
@@ -21,6 +21,7 @@ import type { EditToolDetails } from "../../edit";
|
|
|
21
21
|
import type { PythonResult } from "../../eval/py/executor";
|
|
22
22
|
import type { BashResult } from "../../exec/bash-executor";
|
|
23
23
|
import type { ExecOptions, ExecResult } from "../../exec/exec";
|
|
24
|
+
import type { MemoryRuntimeContext } from "../../memory-backend";
|
|
24
25
|
import type { CustomEditor } from "../../modes/components/custom-editor";
|
|
25
26
|
import type { Theme } from "../../modes/theme/theme";
|
|
26
27
|
import type { CustomMessage } from "../../session/messages";
|
|
@@ -199,6 +200,8 @@ export interface ExtensionContext {
|
|
|
199
200
|
shutdown(): void;
|
|
200
201
|
/** Get the current effective system prompt. */
|
|
201
202
|
getSystemPrompt(): string[];
|
|
203
|
+
/** Structured memory runtime for status/search/save across the configured backend. */
|
|
204
|
+
memory?: MemoryRuntimeContext;
|
|
202
205
|
}
|
|
203
206
|
/**
|
|
204
207
|
* Extended context for command handlers.
|
|
@@ -160,12 +160,12 @@ export interface TurnEndEvent {
|
|
|
160
160
|
export interface AutoCompactionStartEvent {
|
|
161
161
|
type: "auto_compaction_start";
|
|
162
162
|
reason: "threshold" | "overflow" | "idle" | "incomplete";
|
|
163
|
-
action: "context-full" | "handoff" | "shake";
|
|
163
|
+
action: "context-full" | "handoff" | "shake" | "snapcompact";
|
|
164
164
|
}
|
|
165
165
|
/** Fired when auto-compaction ends */
|
|
166
166
|
export interface AutoCompactionEndEvent {
|
|
167
167
|
type: "auto_compaction_end";
|
|
168
|
-
action: "context-full" | "handoff" | "shake";
|
|
168
|
+
action: "context-full" | "handoff" | "shake" | "snapcompact";
|
|
169
169
|
result: CompactionResult | undefined;
|
|
170
170
|
aborted: boolean;
|
|
171
171
|
willRetry: boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { InternalResource, InternalUrl, ProtocolHandler, UrlCompletion } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Handler for history:// URLs.
|
|
4
|
+
*
|
|
5
|
+
* Resolves agent ids against the global AgentRegistry, serving transcripts
|
|
6
|
+
* for both live and parked agents.
|
|
7
|
+
*/
|
|
8
|
+
export declare class HistoryProtocolHandler implements ProtocolHandler {
|
|
9
|
+
#private;
|
|
10
|
+
readonly scheme = "history";
|
|
11
|
+
readonly immutable = false;
|
|
12
|
+
resolve(url: InternalUrl): Promise<InternalResource>;
|
|
13
|
+
complete(): Promise<UrlCompletion[]>;
|
|
14
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Types for the internal URL routing system.
|
|
3
3
|
*
|
|
4
|
-
* Internal URLs (`agent://`, `artifact://`, `issue://`, `local://`, `mcp://`, `memory://`, `omp://`, `pr://`, `rule://`, `skill://`, and `vault://`) are resolved by tools like read,
|
|
4
|
+
* Internal URLs (`agent://`, `artifact://`, `history://`, `issue://`, `local://`, `mcp://`, `memory://`, `omp://`, `pr://`, `rule://`, `skill://`, and `vault://`) are resolved by tools like read,
|
|
5
5
|
* providing access to agent outputs and server resources without exposing filesystem paths.
|
|
6
6
|
*/
|
|
7
7
|
import type { LocalProtocolOptions } from "./local-protocol";
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IrcBus - Process-global mailbox bus for agent-to-agent messaging.
|
|
3
|
+
*
|
|
4
|
+
* Replaces the old auto-reply model: a `send` never blocks on the recipient
|
|
5
|
+
* generating anything. Delivery resolves the recipient via the global
|
|
6
|
+
* AgentRegistry — parked agents are revived through the
|
|
7
|
+
* AgentLifecycleManager, idle agents are woken with a real turn, and busy
|
|
8
|
+
* agents receive the message as a non-interrupting aside at the next step
|
|
9
|
+
* boundary (see AgentSession.deliverIrcMessage). Replies are real turns by
|
|
10
|
+
* the recipient, observed via `wait`.
|
|
11
|
+
*/
|
|
12
|
+
import { AgentLifecycleManager } from "../registry/agent-lifecycle";
|
|
13
|
+
import { AgentRegistry } from "../registry/agent-registry";
|
|
14
|
+
export interface IrcMessage {
|
|
15
|
+
id: string;
|
|
16
|
+
/** Sender agent id. */
|
|
17
|
+
from: string;
|
|
18
|
+
/** Recipient agent id (resolved; "all" is expanded by the tool, not stored). */
|
|
19
|
+
to: string;
|
|
20
|
+
body: string;
|
|
21
|
+
ts: number;
|
|
22
|
+
/** Message id being answered. */
|
|
23
|
+
replyTo?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface IrcDeliveryReceipt {
|
|
26
|
+
to: string;
|
|
27
|
+
outcome: "injected" | "woken" | "revived" | "failed";
|
|
28
|
+
error?: string;
|
|
29
|
+
}
|
|
30
|
+
export declare class IrcBus {
|
|
31
|
+
#private;
|
|
32
|
+
static global(): IrcBus;
|
|
33
|
+
/** Reset the global bus. Test-only. */
|
|
34
|
+
static resetGlobalForTests(): void;
|
|
35
|
+
constructor(registry?: AgentRegistry, lifecycle?: AgentLifecycleManager);
|
|
36
|
+
/**
|
|
37
|
+
* Fire-and-forget delivery. Never blocks on the recipient generating
|
|
38
|
+
* anything: the receipt reports how the message reached the recipient
|
|
39
|
+
* (waiter/aside = "injected", idle wake = "woken", park revival =
|
|
40
|
+
* "revived"), not what they did with it.
|
|
41
|
+
*
|
|
42
|
+
* Mailbox semantics: a successfully delivered message never lingers in
|
|
43
|
+
* the recipient's mailbox — injection/wake puts the full body into their
|
|
44
|
+
* context, so buffering it too would double-deliver via a later
|
|
45
|
+
* `wait`/`inbox` and inflate unread counts. Only a failed live hand-off
|
|
46
|
+
* is buffered for the recipient to drain later.
|
|
47
|
+
*/
|
|
48
|
+
send(msg: Omit<IrcMessage, "id" | "ts">): Promise<IrcDeliveryReceipt>;
|
|
49
|
+
/**
|
|
50
|
+
* Block until a message for `agentId` (optionally from `filter.from`)
|
|
51
|
+
* arrives; consume + return it. Null on timeout (`timeoutMs <= 0` waits
|
|
52
|
+
* forever). Rejects when `signal` aborts. By default, already-buffered
|
|
53
|
+
* mail satisfies the wait before parking a future waiter; callers that
|
|
54
|
+
* need a strictly future reply can disable that drain.
|
|
55
|
+
*/
|
|
56
|
+
wait(agentId: string, filter: {
|
|
57
|
+
from?: string;
|
|
58
|
+
}, timeoutMs: number, signal?: AbortSignal, options?: {
|
|
59
|
+
drainPending?: boolean;
|
|
60
|
+
}): Promise<IrcMessage | null>;
|
|
61
|
+
/** Drain (or peek) pending messages for `agentId`. */
|
|
62
|
+
inbox(agentId: string, opts?: {
|
|
63
|
+
peek?: boolean;
|
|
64
|
+
}): IrcMessage[];
|
|
65
|
+
unreadCount(agentId: string): number;
|
|
66
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AgentSession } from "../session/agent-session";
|
|
2
|
+
import type { MemoryBackendOperationContext, MemoryRuntimeContext } from "./types";
|
|
3
|
+
export declare function createMemoryRuntimeContext(context: MemoryBackendOperationContext): MemoryRuntimeContext;
|
|
4
|
+
export declare function createSessionMemoryRuntimeContext(session: AgentSession, agentDir: string, cwd: string): MemoryRuntimeContext;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Memory backend abstraction.
|
|
3
3
|
*
|
|
4
|
-
* Backends are mutually exclusive — `await resolveMemoryBackend(settings)`
|
|
4
|
+
* Backends are mutually exclusive — `await resolveMemoryBackend(settings)` returns
|
|
5
5
|
* exactly one. Implementations MUST be self-contained: they own the per-session
|
|
6
6
|
* state they create in `start()` and tear it down on `clear()`.
|
|
7
7
|
*/
|
|
@@ -12,6 +12,65 @@ import type { HindsightSessionState } from "../hindsight/state";
|
|
|
12
12
|
import type { MnemopiSessionState } from "../mnemopi/state";
|
|
13
13
|
import type { AgentSession } from "../session/agent-session";
|
|
14
14
|
export type MemoryBackendId = "off" | "local" | "hindsight" | "mnemopi";
|
|
15
|
+
export interface MemoryBackendStatus {
|
|
16
|
+
backend: MemoryBackendId;
|
|
17
|
+
active: boolean;
|
|
18
|
+
writable: boolean;
|
|
19
|
+
searchable: boolean;
|
|
20
|
+
scope?: string;
|
|
21
|
+
retainBank?: string;
|
|
22
|
+
recallBanks?: string[];
|
|
23
|
+
workingCount?: number;
|
|
24
|
+
episodicCount?: number;
|
|
25
|
+
tripleCount?: number;
|
|
26
|
+
lastMemory?: string;
|
|
27
|
+
lastRecall?: boolean;
|
|
28
|
+
database?: string;
|
|
29
|
+
message?: string;
|
|
30
|
+
error?: string;
|
|
31
|
+
}
|
|
32
|
+
export interface MemoryBackendSearchOptions {
|
|
33
|
+
limit?: number;
|
|
34
|
+
/** Best-effort abort signal. Backends may only observe it before/after an underlying recall call. */
|
|
35
|
+
signal?: AbortSignal;
|
|
36
|
+
}
|
|
37
|
+
export interface MemoryBackendSearchItem {
|
|
38
|
+
id?: string;
|
|
39
|
+
content: string;
|
|
40
|
+
source?: string;
|
|
41
|
+
timestamp?: string;
|
|
42
|
+
score?: number;
|
|
43
|
+
}
|
|
44
|
+
export interface MemoryBackendSearchResult {
|
|
45
|
+
backend: MemoryBackendId;
|
|
46
|
+
query: string;
|
|
47
|
+
count: number;
|
|
48
|
+
items: MemoryBackendSearchItem[];
|
|
49
|
+
message?: string;
|
|
50
|
+
}
|
|
51
|
+
export interface MemoryBackendSaveInput {
|
|
52
|
+
content: string;
|
|
53
|
+
context?: string;
|
|
54
|
+
source?: string;
|
|
55
|
+
importance?: number;
|
|
56
|
+
}
|
|
57
|
+
export interface MemoryBackendSaveResult {
|
|
58
|
+
backend: MemoryBackendId;
|
|
59
|
+
stored: number;
|
|
60
|
+
ids?: string[];
|
|
61
|
+
queued?: boolean;
|
|
62
|
+
message?: string;
|
|
63
|
+
}
|
|
64
|
+
export interface MemoryBackendOperationContext {
|
|
65
|
+
agentDir: string;
|
|
66
|
+
cwd: string;
|
|
67
|
+
session?: AgentSession;
|
|
68
|
+
}
|
|
69
|
+
export interface MemoryRuntimeContext {
|
|
70
|
+
status(): Promise<MemoryBackendStatus>;
|
|
71
|
+
search(query: string, options?: MemoryBackendSearchOptions): Promise<MemoryBackendSearchResult>;
|
|
72
|
+
save(input: string | MemoryBackendSaveInput): Promise<MemoryBackendSaveResult>;
|
|
73
|
+
}
|
|
15
74
|
export interface MemoryBackendStartOptions {
|
|
16
75
|
session: AgentSession;
|
|
17
76
|
settings: Settings;
|
|
@@ -40,6 +99,12 @@ export interface MemoryBackend {
|
|
|
40
99
|
clear(agentDir: string, cwd: string, session?: AgentSession): Promise<void>;
|
|
41
100
|
/** Force consolidation/retain to happen now (slash `/memory enqueue`). */
|
|
42
101
|
enqueue(agentDir: string, cwd: string, session?: AgentSession): Promise<void>;
|
|
102
|
+
/** Structured state for UI, slash commands, and extensions. */
|
|
103
|
+
status?(context: MemoryBackendOperationContext): Promise<MemoryBackendStatus>;
|
|
104
|
+
/** Explicit user-facing semantic/lexical search. */
|
|
105
|
+
search?(context: MemoryBackendOperationContext, query: string, options?: MemoryBackendSearchOptions): Promise<MemoryBackendSearchResult>;
|
|
106
|
+
/** Explicit user-facing save operation. */
|
|
107
|
+
save?(context: MemoryBackendOperationContext, input: MemoryBackendSaveInput): Promise<MemoryBackendSaveResult>;
|
|
43
108
|
/** Render backend-specific memory statistics as markdown (`/memory stats`). */
|
|
44
109
|
stats?(agentDir: string, cwd: string, session?: AgentSession): Promise<string | undefined>;
|
|
45
110
|
/** Render backend-specific memory diagnostics as markdown (`/memory diagnose`). */
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Container } from "@oh-my-pi/pi-tui";
|
|
2
|
+
import type { KeyId } from "../../config/keybindings";
|
|
3
|
+
import { IrcBus } from "../../irc/bus";
|
|
4
|
+
import { AgentLifecycleManager } from "../../registry/agent-lifecycle";
|
|
5
|
+
import { AgentRegistry } from "../../registry/agent-registry";
|
|
6
|
+
import type { SessionObserverRegistry } from "../session-observer-registry";
|
|
7
|
+
export interface AgentHubDeps {
|
|
8
|
+
/** Progress/status snapshot source (task lifecycle + progress channels). */
|
|
9
|
+
observers: SessionObserverRegistry;
|
|
10
|
+
/** Keys that toggle the hub closed from inside (app.agents.hub + app.session.observe). */
|
|
11
|
+
hubKeys: KeyId[];
|
|
12
|
+
onDone: () => void;
|
|
13
|
+
requestRender: () => void;
|
|
14
|
+
/** Injectable for tests; defaults to the process-global registry. */
|
|
15
|
+
registry?: AgentRegistry;
|
|
16
|
+
/** Injectable for tests; defaults to the process-global lifecycle manager. */
|
|
17
|
+
lifecycle?: AgentLifecycleManager;
|
|
18
|
+
/** Injectable for tests; defaults to the process-global bus. */
|
|
19
|
+
irc?: IrcBus;
|
|
20
|
+
}
|
|
21
|
+
export declare class AgentHubOverlayComponent extends Container {
|
|
22
|
+
#private;
|
|
23
|
+
constructor(deps: AgentHubDeps);
|
|
24
|
+
/** Tear down every subscription and timer. Called by the overlay owner on close. */
|
|
25
|
+
dispose(): void;
|
|
26
|
+
render(width: number): readonly string[];
|
|
27
|
+
handleInput(keyData: string): void;
|
|
28
|
+
/** Open the chat view for an agent id (public for table Enter and tests). */
|
|
29
|
+
openChat(id: string): void;
|
|
30
|
+
}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type Component } from "@oh-my-pi/pi-tui";
|
|
2
2
|
import type { CompactionSummaryMessage } from "../../session/messages";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Compaction point in the transcript, rendered as a slim horizontal divider:
|
|
5
|
+
*
|
|
6
|
+
* ──────── 📷 compacted · ctrl+o ────────
|
|
7
|
+
*
|
|
8
|
+
* The conversation above the divider stays visible (display transcript keeps
|
|
9
|
+
* full history); only the LLM context was reset. Expanding (ctrl+o) reveals
|
|
10
|
+
* the compaction summary below the divider.
|
|
6
11
|
*/
|
|
7
|
-
export declare class CompactionSummaryMessageComponent
|
|
12
|
+
export declare class CompactionSummaryMessageComponent implements Component {
|
|
8
13
|
#private;
|
|
9
14
|
private readonly message;
|
|
10
15
|
constructor(message: CompactionSummaryMessage);
|
|
11
16
|
setExpanded(expanded: boolean): void;
|
|
12
17
|
invalidate(): void;
|
|
18
|
+
render(width: number): readonly string[];
|
|
13
19
|
}
|
|
@@ -42,6 +42,8 @@ export declare class CustomEditor extends Editor {
|
|
|
42
42
|
onDequeue?: () => void;
|
|
43
43
|
/** Called when Caps Lock is pressed. */
|
|
44
44
|
onCapsLock?: () => void;
|
|
45
|
+
/** Called when left-arrow is pressed while the editor is empty (cursor necessarily at start). */
|
|
46
|
+
onLeftAtStart?: () => void;
|
|
45
47
|
setActionKeys(action: ConfigurableEditorAction, keys: KeyId[]): void;
|
|
46
48
|
/**
|
|
47
49
|
* Register a custom key handler. Extensions use this for shortcuts.
|
|
@@ -67,6 +67,14 @@ export declare class ToolExecutionComponent extends Container {
|
|
|
67
67
|
* transcript live region.
|
|
68
68
|
*/
|
|
69
69
|
seal(): void;
|
|
70
|
+
/**
|
|
71
|
+
* Whether this block is a waiting `job` poll (every watched job still
|
|
72
|
+
* running) that has not been sealed. Such a block never finalized, so none
|
|
73
|
+
* of its rows entered native scrollback (the ticking spinner keeps the
|
|
74
|
+
* stable-prefix ratchet at zero) and the whole block can be removed when a
|
|
75
|
+
* follow-up `job` call supersedes it.
|
|
76
|
+
*/
|
|
77
|
+
isDisplaceableBlock(): boolean;
|
|
70
78
|
/**
|
|
71
79
|
* Stop spinner animation and cleanup resources.
|
|
72
80
|
*/
|
|
@@ -3,11 +3,15 @@ import type { Rule } from "../../capability/rule";
|
|
|
3
3
|
/**
|
|
4
4
|
* Component that renders a TTSR (Time Traveling Stream Rules) notification.
|
|
5
5
|
* Shows when a rule violation is detected and the stream is being rewound.
|
|
6
|
+
* One block can carry several rules: a single event may match multiple rules,
|
|
7
|
+
* and consecutive notifications merge into the previous block via
|
|
8
|
+
* {@link addRules} while it is still the live transcript tail.
|
|
6
9
|
*/
|
|
7
10
|
export declare class TtsrNotificationComponent extends Container {
|
|
8
11
|
#private;
|
|
9
|
-
private readonly rules;
|
|
10
12
|
constructor(rules: Rule[]);
|
|
13
|
+
/** Merge additional rules into this block (deduped by rule name). */
|
|
14
|
+
addRules(rules: Rule[]): void;
|
|
11
15
|
setExpanded(expanded: boolean): void;
|
|
12
16
|
isExpanded(): boolean;
|
|
13
17
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Component } from "@oh-my-pi/pi-tui";
|
|
2
2
|
/**
|
|
3
|
-
* Fixed number of session rows in the welcome box so its height
|
|
4
|
-
*
|
|
3
|
+
* Fixed number of session rows in the welcome box so its height stays stable
|
|
4
|
+
* across recent-session updates.
|
|
5
5
|
*/
|
|
6
6
|
export declare const WELCOME_SESSION_SLOTS = 4;
|
|
7
7
|
/**
|
|
@@ -29,14 +29,8 @@ export declare class WelcomeComponent implements Component {
|
|
|
29
29
|
private providerName;
|
|
30
30
|
private recentSessions;
|
|
31
31
|
private lspServers;
|
|
32
|
-
constructor(version: string, modelName: string, providerName: string, recentSessions?: RecentSession[]
|
|
32
|
+
constructor(version: string, modelName: string, providerName: string, recentSessions?: RecentSession[], lspServers?: LspServerInfo[]);
|
|
33
33
|
invalidate(): void;
|
|
34
|
-
/**
|
|
35
|
-
* Freeze the logo on the intro animation's first frame. The pre-TUI startup
|
|
36
|
-
* splash uses this so the in-TUI intro — which starts at that exact frame —
|
|
37
|
-
* picks up seamlessly from the splash's static box.
|
|
38
|
-
*/
|
|
39
|
-
holdIntroFirstFrame(): void;
|
|
40
34
|
/**
|
|
41
35
|
* Play a one-shot intro that sweeps the gradient through every phase
|
|
42
36
|
* before settling on the resting frame. Safe to call multiple times —
|
|
@@ -42,5 +42,5 @@ export declare class SelectorController {
|
|
|
42
42
|
handleSessionDeleteCommand(): Promise<void>;
|
|
43
43
|
showOAuthSelector(mode: "login" | "logout", providerId?: string): Promise<void>;
|
|
44
44
|
showDebugSelector(): Promise<void>;
|
|
45
|
-
|
|
45
|
+
showAgentHub(observers: SessionObserverRegistry): void;
|
|
46
46
|
}
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
* barrel does not pull print, RPC server, or ACP server mode into the normal
|
|
6
6
|
* TUI graph.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
8
|
+
export * from "./interactive-mode";
|
|
9
|
+
export * from "./rpc/rpc-client";
|
|
10
|
+
export * from "./rpc/rpc-types";
|
|
@@ -7,6 +7,7 @@ import { KeybindingsManager } from "../config/keybindings";
|
|
|
7
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
|
+
import type { MCPManager } from "../mcp";
|
|
10
11
|
import { type PlanApprovalDetails } from "../plan-mode/approved-plan";
|
|
11
12
|
import type { AgentSession } from "../session/agent-session";
|
|
12
13
|
import { HistoryStorage } from "../session/history-storage";
|
|
@@ -49,6 +50,7 @@ export declare class InteractiveMode implements InteractiveModeContext {
|
|
|
49
50
|
keybindings: KeybindingsManager;
|
|
50
51
|
agent: Agent;
|
|
51
52
|
historyStorage?: HistoryStorage;
|
|
53
|
+
titleSystemPrompt?: string;
|
|
52
54
|
ui: TUI;
|
|
53
55
|
chatContainer: TranscriptContainer;
|
|
54
56
|
pendingMessagesContainer: Container;
|
|
@@ -98,6 +100,7 @@ export declare class InteractiveMode implements InteractiveModeContext {
|
|
|
98
100
|
locallySubmittedUserSignatures: Set<string>;
|
|
99
101
|
lastSigintTime: number;
|
|
100
102
|
lastEscapeTime: number;
|
|
103
|
+
lastLeftTapTime: number;
|
|
101
104
|
shutdownRequested: boolean;
|
|
102
105
|
hookSelector: HookSelectorComponent | undefined;
|
|
103
106
|
hookInput: HookInputComponent | undefined;
|
|
@@ -108,10 +111,12 @@ export declare class InteractiveMode implements InteractiveModeContext {
|
|
|
108
111
|
skillCommands: Map<string, string>;
|
|
109
112
|
oauthManualInput: OAuthManualInputManager;
|
|
110
113
|
readonly lspServers: LspStartupServerInfo[] | undefined;
|
|
111
|
-
mcpManager?:
|
|
112
|
-
constructor(session: AgentSession, version: string, changelogMarkdown?: string | undefined, setToolUIContext?: (uiContext: ExtensionUIContext, hasUI: boolean) => void, lspServers?: LspStartupServerInfo[] | undefined, mcpManager?:
|
|
114
|
+
mcpManager?: MCPManager;
|
|
115
|
+
constructor(session: AgentSession, version: string, changelogMarkdown?: string | undefined, setToolUIContext?: (uiContext: ExtensionUIContext, hasUI: boolean) => void, lspServers?: LspStartupServerInfo[] | undefined, mcpManager?: MCPManager, eventBus?: EventBus, titleSystemPrompt?: string);
|
|
113
116
|
playWelcomeIntro(): void;
|
|
114
117
|
init(options?: InteractiveModeInitOptions): Promise<void>;
|
|
118
|
+
/** Reload the title-generation system prompt override for the provided working directory. */
|
|
119
|
+
refreshTitleSystemPrompt(cwd?: string): Promise<void>;
|
|
115
120
|
/** Reload slash commands and autocomplete for the provided working directory. */
|
|
116
121
|
refreshSlashCommandState(cwd?: string): Promise<void>;
|
|
117
122
|
/**
|
|
@@ -206,7 +211,7 @@ export declare class InteractiveMode implements InteractiveModeContext {
|
|
|
206
211
|
updateFooter?: boolean;
|
|
207
212
|
populateHistory?: boolean;
|
|
208
213
|
}): void;
|
|
209
|
-
renderInitialMessages(
|
|
214
|
+
renderInitialMessages(options?: {
|
|
210
215
|
preserveExistingChat?: boolean;
|
|
211
216
|
clearTerminalHistory?: boolean;
|
|
212
217
|
}): void;
|
|
@@ -234,7 +239,7 @@ export declare class InteractiveMode implements InteractiveModeContext {
|
|
|
234
239
|
handleMemoryCommand(text: string): Promise<void>;
|
|
235
240
|
handleSTTToggle(): Promise<void>;
|
|
236
241
|
showDebugSelector(): Promise<void>;
|
|
237
|
-
|
|
242
|
+
showAgentHub(): void;
|
|
238
243
|
resetObserverRegistry(): void;
|
|
239
244
|
handleBashCommand(command: string, excludeFromContext?: boolean): Promise<void>;
|
|
240
245
|
handlePythonCommand(code: string, excludeFromContext?: boolean): Promise<void>;
|
|
@@ -260,6 +265,7 @@ export declare class InteractiveMode implements InteractiveModeContext {
|
|
|
260
265
|
handleResumeSession(sessionPath: string): Promise<void>;
|
|
261
266
|
handleSessionDeleteCommand(): Promise<void>;
|
|
262
267
|
showOAuthSelector(mode: "login" | "logout", providerId?: string): Promise<void>;
|
|
268
|
+
showProviderSetup(): Promise<void>;
|
|
263
269
|
showHookConfirm(title: string, message: string): Promise<boolean>;
|
|
264
270
|
handleCtrlC(): void;
|
|
265
271
|
handleCtrlD(): void;
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
type ClaimedInput = {
|
|
2
|
+
promise: Promise<string>;
|
|
3
|
+
clear: (reason?: string) => void;
|
|
4
|
+
};
|
|
1
5
|
export declare class OAuthManualInputManager {
|
|
2
6
|
#private;
|
|
3
7
|
waitForInput(providerId: string): Promise<string>;
|
|
8
|
+
tryWaitForInput(providerId: string): Promise<string> | undefined;
|
|
9
|
+
tryClaimInput(providerId: string): ClaimedInput | undefined;
|
|
4
10
|
submit(input: string): boolean;
|
|
5
11
|
clear(reason?: string): void;
|
|
6
12
|
hasPending(): boolean;
|
|
7
13
|
get pendingProviderId(): string | undefined;
|
|
8
14
|
}
|
|
15
|
+
export {};
|
|
@@ -7,8 +7,8 @@ import type { AgentEvent, AgentMessage, AgentToolResult, ThinkingLevel } from "@
|
|
|
7
7
|
import type { CompactionResult } from "@oh-my-pi/pi-agent-core/compaction";
|
|
8
8
|
import type { ImageContent, Model } from "@oh-my-pi/pi-ai";
|
|
9
9
|
import type { BashResult } from "../../exec/bash-executor";
|
|
10
|
-
import type { SessionStats } from "../../session/agent-session";
|
|
11
|
-
import type { RpcHandoffResult, RpcHostToolDefinition, RpcSessionState } from "./rpc-types";
|
|
10
|
+
import type { AgentSessionEvent, SessionStats } from "../../session/agent-session";
|
|
11
|
+
import type { RpcHandoffResult, RpcHostToolDefinition, RpcSessionState, RpcSubagentEventFrame, RpcSubagentLifecycleFrame, RpcSubagentMessagesResult, RpcSubagentProgressFrame, RpcSubagentSnapshot, RpcSubagentSubscriptionLevel } from "./rpc-types";
|
|
12
12
|
export interface RpcClientOptions {
|
|
13
13
|
/** Path to the CLI entry point (default: searches for dist/cli.js) */
|
|
14
14
|
cliPath?: string;
|
|
@@ -29,6 +29,10 @@ export interface RpcClientOptions {
|
|
|
29
29
|
}
|
|
30
30
|
export type ModelInfo = Pick<Model, "provider" | "id" | "contextWindow" | "reasoning" | "thinking">;
|
|
31
31
|
export type RpcEventListener = (event: AgentEvent) => void;
|
|
32
|
+
export type RpcSessionEventListener = (event: AgentSessionEvent) => void;
|
|
33
|
+
export type RpcSubagentLifecycleListener = (payload: RpcSubagentLifecycleFrame["payload"]) => void;
|
|
34
|
+
export type RpcSubagentProgressListener = (payload: RpcSubagentProgressFrame["payload"]) => void;
|
|
35
|
+
export type RpcSubagentEventListener = (payload: RpcSubagentEventFrame["payload"]) => void;
|
|
32
36
|
export interface RpcClientToolContext<TDetails = unknown> {
|
|
33
37
|
toolCallId: string;
|
|
34
38
|
signal: AbortSignal;
|
|
@@ -60,6 +64,22 @@ export declare class RpcClient {
|
|
|
60
64
|
* Subscribe to agent events.
|
|
61
65
|
*/
|
|
62
66
|
onEvent(listener: RpcEventListener): () => void;
|
|
67
|
+
/**
|
|
68
|
+
* Subscribe to all top-level session events, including non-core session state events.
|
|
69
|
+
*/
|
|
70
|
+
onSessionEvent(listener: RpcSessionEventListener): () => void;
|
|
71
|
+
/**
|
|
72
|
+
* Subscribe to subagent lifecycle frames after setSubagentSubscription("progress" | "events").
|
|
73
|
+
*/
|
|
74
|
+
onSubagentLifecycle(listener: RpcSubagentLifecycleListener): () => void;
|
|
75
|
+
/**
|
|
76
|
+
* Subscribe to aggregated subagent progress frames after setSubagentSubscription("progress" | "events").
|
|
77
|
+
*/
|
|
78
|
+
onSubagentProgress(listener: RpcSubagentProgressListener): () => void;
|
|
79
|
+
/**
|
|
80
|
+
* Subscribe to raw subagent session events. Call setSubagentSubscription(\"events\") to enable them server-side.
|
|
81
|
+
*/
|
|
82
|
+
onSubagentEvent(listener: RpcSubagentEventListener): () => void;
|
|
63
83
|
/**
|
|
64
84
|
* Get collected stderr output (useful for debugging).
|
|
65
85
|
*/
|
|
@@ -98,6 +118,23 @@ export declare class RpcClient {
|
|
|
98
118
|
* Get current session state.
|
|
99
119
|
*/
|
|
100
120
|
getState(): Promise<RpcSessionState>;
|
|
121
|
+
/**
|
|
122
|
+
* Configure subagent frames emitted by the RPC server. Servers default to "off".
|
|
123
|
+
* "progress" emits lifecycle/progress frames; "events" additionally emits raw subagent session events.
|
|
124
|
+
*/
|
|
125
|
+
setSubagentSubscription(level: RpcSubagentSubscriptionLevel): Promise<RpcSubagentSubscriptionLevel>;
|
|
126
|
+
/**
|
|
127
|
+
* Return the RPC server's current subagent snapshot.
|
|
128
|
+
*/
|
|
129
|
+
getSubagents(): Promise<RpcSubagentSnapshot[]>;
|
|
130
|
+
/**
|
|
131
|
+
* Read persisted transcript entries for a tracked subagent session.
|
|
132
|
+
*/
|
|
133
|
+
getSubagentMessages(selector: {
|
|
134
|
+
subagentId?: string;
|
|
135
|
+
sessionFile?: string;
|
|
136
|
+
fromByte?: number;
|
|
137
|
+
}): Promise<RpcSubagentMessagesResult>;
|
|
101
138
|
/**
|
|
102
139
|
* Set model by provider and ID.
|
|
103
140
|
*/
|
|
@@ -1,12 +1,41 @@
|
|
|
1
1
|
import { type ExtensionUIContext, type ExtensionUIDialogOptions } from "../../extensibility/extensions";
|
|
2
2
|
import type { AgentSession } from "../../session/agent-session";
|
|
3
|
-
import type {
|
|
3
|
+
import type { EventBus } from "../../utils/event-bus";
|
|
4
|
+
import { RpcSubagentRegistry } from "./rpc-subagents";
|
|
5
|
+
import type { RpcCommand, RpcExtensionUIRequest, RpcExtensionUIResponse, RpcHostToolCallRequest, RpcHostToolCancelRequest, RpcHostUriCancelRequest, RpcHostUriRequest, RpcResponse } from "./rpc-types";
|
|
4
6
|
export type * from "./rpc-types";
|
|
5
7
|
export type PendingExtensionRequest = {
|
|
6
8
|
resolve: (response: RpcExtensionUIResponse) => void;
|
|
7
9
|
reject: (error: Error) => void;
|
|
8
10
|
};
|
|
9
11
|
type RpcOutput = (obj: RpcResponse | RpcExtensionUIRequest | RpcHostToolCallRequest | RpcHostToolCancelRequest | RpcHostUriRequest | RpcHostUriCancelRequest | object) => void;
|
|
12
|
+
export type RpcSessionChangeCommand = Extract<RpcCommand, {
|
|
13
|
+
type: "new_session";
|
|
14
|
+
} | {
|
|
15
|
+
type: "switch_session";
|
|
16
|
+
} | {
|
|
17
|
+
type: "branch";
|
|
18
|
+
}>;
|
|
19
|
+
export type RpcSessionChangeResult = {
|
|
20
|
+
type: "new_session";
|
|
21
|
+
data: {
|
|
22
|
+
cancelled: boolean;
|
|
23
|
+
};
|
|
24
|
+
} | {
|
|
25
|
+
type: "switch_session";
|
|
26
|
+
data: {
|
|
27
|
+
cancelled: boolean;
|
|
28
|
+
};
|
|
29
|
+
} | {
|
|
30
|
+
type: "branch";
|
|
31
|
+
data: {
|
|
32
|
+
text: string;
|
|
33
|
+
cancelled: boolean;
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export type RpcSessionChangeSession = Pick<AgentSession, "newSession" | "switchSession" | "branch">;
|
|
37
|
+
export type RpcSubagentResetRegistry = Pick<RpcSubagentRegistry, "clear">;
|
|
38
|
+
export declare function handleRpcSessionChange(session: RpcSessionChangeSession, command: RpcSessionChangeCommand, subagentRegistry?: RpcSubagentResetRegistry): Promise<RpcSessionChangeResult>;
|
|
10
39
|
export declare function requestRpcEditor(pendingRequests: Map<string, PendingExtensionRequest>, output: RpcOutput, title: string, prefill?: string, dialogOptions?: ExtensionUIDialogOptions, editorOptions?: {
|
|
11
40
|
promptStyle?: boolean;
|
|
12
41
|
}): Promise<string | undefined>;
|
|
@@ -14,4 +43,4 @@ export declare function requestRpcEditor(pendingRequests: Map<string, PendingExt
|
|
|
14
43
|
* Run in RPC mode.
|
|
15
44
|
* Listens for JSON commands on stdin, outputs events and responses on stdout.
|
|
16
45
|
*/
|
|
17
|
-
export declare function runRpcMode(session: AgentSession, setToolUIContext?: (uiContext: ExtensionUIContext, hasUI: boolean) => void): Promise<never>;
|
|
46
|
+
export declare function runRpcMode(session: AgentSession, setToolUIContext?: (uiContext: ExtensionUIContext, hasUI: boolean) => void, eventBus?: EventBus): Promise<never>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type SubagentEventPayload, type SubagentLifecyclePayload, type SubagentProgressPayload } from "../../task";
|
|
2
|
+
import type { EventBus } from "../../utils/event-bus";
|
|
3
|
+
import type { RpcSubagentFrame, RpcSubagentMessagesResult, RpcSubagentSnapshot, RpcSubagentSubscriptionLevel } from "./rpc-types";
|
|
4
|
+
export interface RpcSubagentTranscriptSelector {
|
|
5
|
+
subagentId?: string;
|
|
6
|
+
sessionFile?: string;
|
|
7
|
+
fromByte?: number;
|
|
8
|
+
}
|
|
9
|
+
type RpcSubagentOutput = (frame: RpcSubagentFrame) => void;
|
|
10
|
+
export declare function readRpcSubagentTranscript(sessionFile: string, fromByte?: number): Promise<RpcSubagentMessagesResult>;
|
|
11
|
+
export declare class RpcSubagentRegistry {
|
|
12
|
+
#private;
|
|
13
|
+
constructor(eventBus: EventBus, output: RpcSubagentOutput);
|
|
14
|
+
dispose(): void;
|
|
15
|
+
clear(): void;
|
|
16
|
+
setSubscriptionLevel(level: RpcSubagentSubscriptionLevel): void;
|
|
17
|
+
getSubscriptionLevel(): RpcSubagentSubscriptionLevel;
|
|
18
|
+
getSubagents(): RpcSubagentSnapshot[];
|
|
19
|
+
handleLifecycle(payload: SubagentLifecyclePayload): void;
|
|
20
|
+
handleProgress(payload: SubagentProgressPayload): void;
|
|
21
|
+
handleEvent(payload: SubagentEventPayload): void;
|
|
22
|
+
resolveSessionFile(selector: RpcSubagentTranscriptSelector): string;
|
|
23
|
+
}
|
|
24
|
+
export {};
|