@oh-my-pi/pi-coding-agent 15.11.1 → 15.11.2
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 +27 -1
- package/dist/cli.js +629 -614
- package/dist/types/config/settings-schema.d.ts +36 -0
- package/dist/types/extensibility/custom-commands/types.d.ts +6 -3
- package/dist/types/extensibility/custom-tools/loader.d.ts +2 -1
- package/dist/types/extensibility/custom-tools/types.d.ts +8 -4
- package/dist/types/extensibility/extensions/types.d.ts +2 -2
- package/dist/types/extensibility/hooks/types.d.ts +8 -4
- package/dist/types/irc/bus.d.ts +15 -2
- package/dist/types/modes/components/plan-review-overlay.d.ts +2 -0
- package/dist/types/modes/rpc/rpc-client.d.ts +10 -1
- package/dist/types/modes/rpc/rpc-mode.d.ts +2 -0
- package/dist/types/modes/rpc/rpc-types.d.ts +30 -0
- package/dist/types/modes/theme/theme.d.ts +1 -1
- package/dist/types/session/agent-session.d.ts +17 -3
- package/dist/types/slash-commands/available-commands.d.ts +34 -0
- package/dist/types/tools/bash.d.ts +1 -1
- package/dist/types/tools/browser/attach.d.ts +4 -4
- package/dist/types/tools/browser/registry.d.ts +1 -0
- package/dist/types/tools/irc.d.ts +3 -2
- package/dist/types/tools/path-utils.d.ts +0 -4
- package/package.json +11 -11
- package/src/config/settings-schema.ts +40 -0
- package/src/exec/bash-executor.ts +21 -6
- package/src/extensibility/custom-commands/loader.ts +3 -1
- package/src/extensibility/custom-commands/types.ts +6 -3
- package/src/extensibility/custom-tools/loader.ts +4 -7
- package/src/extensibility/custom-tools/types.ts +8 -4
- package/src/extensibility/extensions/loader.ts +2 -1
- package/src/extensibility/extensions/types.ts +2 -2
- package/src/extensibility/hooks/loader.ts +3 -1
- package/src/extensibility/hooks/types.ts +8 -4
- package/src/internal-urls/docs-index.generated.ts +4 -4
- package/src/irc/bus.ts +14 -3
- package/src/lsp/defaults.json +6 -0
- package/src/lsp/render.ts +2 -28
- package/src/memories/index.ts +2 -0
- package/src/modes/acp/acp-agent.ts +4 -67
- package/src/modes/components/plan-review-overlay.ts +32 -3
- package/src/modes/controllers/streaming-reveal.ts +16 -8
- package/src/modes/interactive-mode.ts +32 -0
- package/src/modes/rpc/rpc-client.ts +32 -0
- package/src/modes/rpc/rpc-mode.ts +82 -7
- package/src/modes/rpc/rpc-types.ts +23 -0
- package/src/modes/theme/theme.ts +7 -7
- package/src/modes/utils/ui-helpers.ts +13 -4
- package/src/prompts/memories/consolidation_system.md +4 -0
- package/src/prompts/system/irc-autoreply.md +6 -0
- package/src/prompts/system/irc-incoming.md +1 -1
- package/src/prompts/tools/bash.md +1 -0
- package/src/prompts/tools/irc.md +1 -1
- package/src/session/agent-session.ts +95 -6
- package/src/slash-commands/available-commands.ts +105 -0
- package/src/tools/bash.ts +5 -1
- package/src/tools/browser/attach.ts +26 -7
- package/src/tools/browser/registry.ts +11 -1
- package/src/tools/irc.ts +16 -4
- package/src/tools/job.ts +7 -3
- package/src/tools/path-utils.ts +22 -15
|
@@ -1210,6 +1210,42 @@ export declare const SETTINGS_SCHEMA: {
|
|
|
1210
1210
|
readonly description: "Show condensed changelog after updates";
|
|
1211
1211
|
};
|
|
1212
1212
|
};
|
|
1213
|
+
readonly "magicKeywords.enabled": {
|
|
1214
|
+
readonly type: "boolean";
|
|
1215
|
+
readonly default: true;
|
|
1216
|
+
readonly ui: {
|
|
1217
|
+
readonly tab: "interaction";
|
|
1218
|
+
readonly label: "Magic Keywords";
|
|
1219
|
+
readonly description: "Enable hidden notices for standalone ultrathink, orchestrate, and workflowz keywords";
|
|
1220
|
+
};
|
|
1221
|
+
};
|
|
1222
|
+
readonly "magicKeywords.ultrathink": {
|
|
1223
|
+
readonly type: "boolean";
|
|
1224
|
+
readonly default: true;
|
|
1225
|
+
readonly ui: {
|
|
1226
|
+
readonly tab: "interaction";
|
|
1227
|
+
readonly label: "Ultrathink Keyword";
|
|
1228
|
+
readonly description: "Let standalone ultrathink request maximum automatic thinking and append its hidden notice";
|
|
1229
|
+
};
|
|
1230
|
+
};
|
|
1231
|
+
readonly "magicKeywords.orchestrate": {
|
|
1232
|
+
readonly type: "boolean";
|
|
1233
|
+
readonly default: true;
|
|
1234
|
+
readonly ui: {
|
|
1235
|
+
readonly tab: "interaction";
|
|
1236
|
+
readonly label: "Orchestrate Keyword";
|
|
1237
|
+
readonly description: "Let standalone orchestrate append its hidden multi-agent orchestration notice";
|
|
1238
|
+
};
|
|
1239
|
+
};
|
|
1240
|
+
readonly "magicKeywords.workflow": {
|
|
1241
|
+
readonly type: "boolean";
|
|
1242
|
+
readonly default: true;
|
|
1243
|
+
readonly ui: {
|
|
1244
|
+
readonly tab: "interaction";
|
|
1245
|
+
readonly label: "Workflow Keyword";
|
|
1246
|
+
readonly description: "Let standalone workflowz append its hidden eval workflow notice";
|
|
1247
|
+
};
|
|
1248
|
+
};
|
|
1213
1249
|
readonly "completion.notify": {
|
|
1214
1250
|
readonly type: "enum";
|
|
1215
1251
|
readonly values: readonly ["on", "off"];
|
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
* Unlike markdown commands which expand to prompts, custom commands can execute
|
|
6
6
|
* arbitrary logic with full access to the hook context.
|
|
7
7
|
*/
|
|
8
|
+
import type * as Zod from "zod/v4";
|
|
8
9
|
import type { ExecOptions, ExecResult, HookCommandContext } from "../../extensibility/hooks/types";
|
|
10
|
+
import type * as PiCodingAgent from "../../index";
|
|
11
|
+
import type * as TypeBox from "../typebox";
|
|
9
12
|
export type { ExecOptions, ExecResult, HookCommandContext };
|
|
10
13
|
/**
|
|
11
14
|
* API passed to custom command factory.
|
|
@@ -17,11 +20,11 @@ export interface CustomCommandAPI {
|
|
|
17
20
|
/** Execute a shell command */
|
|
18
21
|
exec(command: string, args: string[], options?: ExecOptions): Promise<ExecResult>;
|
|
19
22
|
/** Injected zod-backed typebox shim (legacy/compat). */
|
|
20
|
-
typebox: typeof
|
|
23
|
+
typebox: typeof TypeBox;
|
|
21
24
|
/** Injected zod module for Zod-authored custom commands. */
|
|
22
|
-
zod: typeof
|
|
25
|
+
zod: typeof Zod;
|
|
23
26
|
/** Injected pi-coding-agent exports */
|
|
24
|
-
pi: typeof
|
|
27
|
+
pi: typeof PiCodingAgent;
|
|
25
28
|
}
|
|
26
29
|
/**
|
|
27
30
|
* Custom command definition.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AgentToolResult } from "@oh-my-pi/pi-agent-core";
|
|
2
2
|
import type { HookUIContext } from "../../extensibility/hooks/types";
|
|
3
|
+
import * as PiCodingAgent from "../../index";
|
|
3
4
|
import type { LoadedCustomTool, ToolLoadError } from "./types";
|
|
4
5
|
/** Tool path with optional source metadata, suitable for forwarding from a
|
|
5
6
|
* parent session to a subagent so the subagent can re-bind tools to its own
|
|
@@ -23,7 +24,7 @@ export declare class CustomToolLoader {
|
|
|
23
24
|
#private;
|
|
24
25
|
tools: LoadedCustomTool[];
|
|
25
26
|
errors: ToolLoadError[];
|
|
26
|
-
constructor(pi: typeof
|
|
27
|
+
constructor(pi: typeof PiCodingAgent, cwd: string, builtInToolNames: string[], pushPendingAction?: (action: {
|
|
27
28
|
label: string;
|
|
28
29
|
sourceToolName: string;
|
|
29
30
|
apply(reason: string): Promise<AgentToolResult<unknown>>;
|
|
@@ -8,14 +8,18 @@ import type { AgentToolResult, AgentToolUpdateCallback, ToolApproval, ToolApprov
|
|
|
8
8
|
import type { CompactionResult } from "@oh-my-pi/pi-agent-core/compaction";
|
|
9
9
|
import type { FetchImpl, Model, Static, TSchema } from "@oh-my-pi/pi-ai";
|
|
10
10
|
import type { Component } from "@oh-my-pi/pi-tui";
|
|
11
|
+
import type { logger as PiLogger } from "@oh-my-pi/pi-utils";
|
|
12
|
+
import type * as Zod from "zod/v4";
|
|
11
13
|
import type { Rule } from "../../capability/rule";
|
|
12
14
|
import type { ModelRegistry } from "../../config/model-registry";
|
|
13
15
|
import type { Settings } from "../../config/settings";
|
|
14
16
|
import type { ExecOptions, ExecResult } from "../../exec/exec";
|
|
15
17
|
import type { HookUIContext } from "../../extensibility/hooks/types";
|
|
18
|
+
import type * as PiCodingAgent from "../../index";
|
|
16
19
|
import type { Theme } from "../../modes/theme/theme";
|
|
17
20
|
import type { ReadonlySessionManager } from "../../session/session-manager";
|
|
18
21
|
import type { TodoItem } from "../../tools/todo";
|
|
22
|
+
import type * as TypeBox from "../typebox";
|
|
19
23
|
/** Alias for clarity */
|
|
20
24
|
export type CustomToolUIContext = HookUIContext;
|
|
21
25
|
export type { ExecOptions, ExecResult } from "../../exec/exec";
|
|
@@ -45,13 +49,13 @@ export interface CustomToolAPI {
|
|
|
45
49
|
/** Whether UI is available (false in print/RPC mode) */
|
|
46
50
|
hasUI: boolean;
|
|
47
51
|
/** File logger for error/warning/debug messages */
|
|
48
|
-
logger: typeof
|
|
52
|
+
logger: typeof PiLogger;
|
|
49
53
|
/** Injected zod-backed typebox shim (legacy/compat — Zod-authored tools are preferred). */
|
|
50
|
-
typebox: typeof
|
|
54
|
+
typebox: typeof TypeBox;
|
|
51
55
|
/** Injected zod module for Zod-authored custom tools. */
|
|
52
|
-
zod: typeof
|
|
56
|
+
zod: typeof Zod;
|
|
53
57
|
/** Injected pi-coding-agent exports */
|
|
54
|
-
pi: typeof
|
|
58
|
+
pi: typeof PiCodingAgent;
|
|
55
59
|
/** Push a preview action that can later be resolved with the hidden resolve tool */
|
|
56
60
|
pushPendingAction(action: CustomToolPendingAction): void;
|
|
57
61
|
}
|
|
@@ -11,7 +11,6 @@ import type { AgentMessage, AgentToolResult, AgentToolUpdateCallback, ThinkingLe
|
|
|
11
11
|
import type { CompactionResult } from "@oh-my-pi/pi-agent-core/compaction";
|
|
12
12
|
import type { Api, AssistantMessageEvent, AssistantMessageEventStream, Context, ImageContent, Model, ModelSpec, ProviderResponseMetadata, SimpleStreamOptions, Static, TextContent, TSchema } from "@oh-my-pi/pi-ai";
|
|
13
13
|
import type { OAuthCredentials, OAuthLoginCallbacks } from "@oh-my-pi/pi-ai/oauth/types";
|
|
14
|
-
import type * as piCodingAgent from "@oh-my-pi/pi-coding-agent";
|
|
15
14
|
import type { AutocompleteItem, Component, EditorTheme, KeyId, TUI } from "@oh-my-pi/pi-tui";
|
|
16
15
|
import type { logger as PiLogger } from "@oh-my-pi/pi-utils";
|
|
17
16
|
import type * as Zod from "zod/v4";
|
|
@@ -21,6 +20,7 @@ import type { EditToolDetails } from "../../edit";
|
|
|
21
20
|
import type { PythonResult } from "../../eval/py/executor";
|
|
22
21
|
import type { BashResult } from "../../exec/bash-executor";
|
|
23
22
|
import type { ExecOptions, ExecResult } from "../../exec/exec";
|
|
23
|
+
import type * as PiCodingAgent from "../../index";
|
|
24
24
|
import type { MemoryRuntimeContext } from "../../memory-backend";
|
|
25
25
|
import type { CustomEditor } from "../../modes/components/custom-editor";
|
|
26
26
|
import type { Theme } from "../../modes/theme/theme";
|
|
@@ -560,7 +560,7 @@ export interface ExtensionAPI {
|
|
|
560
560
|
/** Injected zod module for Zod-authored extension tools (canonical going forward). */
|
|
561
561
|
zod: typeof Zod;
|
|
562
562
|
/** Injected pi-coding-agent exports for accessing SDK utilities */
|
|
563
|
-
pi: typeof
|
|
563
|
+
pi: typeof PiCodingAgent;
|
|
564
564
|
on(event: "resources_discover", handler: ExtensionHandler<ResourcesDiscoverEvent, ResourcesDiscoverResult>): void;
|
|
565
565
|
on(event: "session_start", handler: ExtensionHandler<SessionStartEvent>): void;
|
|
566
566
|
on(event: "session_before_switch", handler: ExtensionHandler<SessionBeforeSwitchEvent, SessionBeforeSwitchResult>): void;
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
import type { ImageContent, Message, Model, TextContent } from "@oh-my-pi/pi-ai";
|
|
2
2
|
import type { Component, TUI } from "@oh-my-pi/pi-tui";
|
|
3
|
+
import type { logger as PiLogger } from "@oh-my-pi/pi-utils";
|
|
4
|
+
import type * as Zod from "zod/v4";
|
|
3
5
|
import type { ModelRegistry } from "../../config/model-registry";
|
|
4
6
|
import type { EditToolDetails } from "../../edit";
|
|
5
7
|
import type { ExecOptions, ExecResult } from "../../exec/exec";
|
|
8
|
+
import type * as PiCodingAgent from "../../index";
|
|
6
9
|
import type { Theme } from "../../modes/theme/theme";
|
|
7
10
|
import type { HookMessage } from "../../session/messages";
|
|
8
11
|
import type { ReadonlySessionManager, SessionManager } from "../../session/session-manager";
|
|
9
12
|
import type { BashToolDetails, FindToolDetails, ReadToolDetails, SearchToolDetails } from "../../tools";
|
|
10
13
|
import type { AgentEndEvent, AgentStartEvent, AutoCompactionEndEvent, AutoCompactionStartEvent, AutoRetryEndEvent, AutoRetryStartEvent, ContextEvent, SessionBeforeBranchEvent, SessionBeforeBranchResult, SessionBeforeCompactEvent, SessionBeforeCompactResult, SessionBeforeSwitchEvent, SessionBeforeSwitchResult, SessionBeforeTreeEvent, SessionBeforeTreeResult, SessionBranchEvent, SessionCompactEvent, SessionCompactingEvent, SessionCompactingResult, SessionEvent, SessionShutdownEvent, SessionStartEvent, SessionSwitchEvent, SessionTreeEvent, TodoReminderEvent, ToolCallEventResult, ToolResultEventResult, TtsrTriggeredEvent, TurnEndEvent, TurnStartEvent } from "../shared-events";
|
|
14
|
+
import type * as TypeBox from "../typebox";
|
|
11
15
|
export type { ExecOptions, ExecResult } from "../../exec/exec";
|
|
12
16
|
/**
|
|
13
17
|
* UI context for hooks to request interactive UI from the harness.
|
|
@@ -412,13 +416,13 @@ export interface HookAPI {
|
|
|
412
416
|
*/
|
|
413
417
|
exec(command: string, args: string[], options?: ExecOptions): Promise<ExecResult>;
|
|
414
418
|
/** File logger for error/warning/debug messages */
|
|
415
|
-
logger: typeof
|
|
419
|
+
logger: typeof PiLogger;
|
|
416
420
|
/** Injected zod-backed typebox shim (legacy/compat — prefer `zod`). */
|
|
417
|
-
typebox: typeof
|
|
421
|
+
typebox: typeof TypeBox;
|
|
418
422
|
/** Injected zod module for Zod-authored hooks. */
|
|
419
|
-
zod: typeof
|
|
423
|
+
zod: typeof Zod;
|
|
420
424
|
/** Injected pi-coding-agent exports */
|
|
421
|
-
pi: typeof
|
|
425
|
+
pi: typeof PiCodingAgent;
|
|
422
426
|
}
|
|
423
427
|
/**
|
|
424
428
|
* Hook factory function type.
|
package/dist/types/irc/bus.d.ts
CHANGED
|
@@ -7,7 +7,11 @@
|
|
|
7
7
|
* AgentLifecycleManager, idle agents are woken with a real turn, and busy
|
|
8
8
|
* agents receive the message as a non-interrupting aside at the next step
|
|
9
9
|
* boundary (see AgentSession.deliverIrcMessage). Replies are real turns by
|
|
10
|
-
* the recipient, observed via `wait
|
|
10
|
+
* the recipient, observed via `wait` — with one exception: when the sender
|
|
11
|
+
* awaits a reply and the recipient is mid-turn with async execution
|
|
12
|
+
* disabled, the recipient session generates an ephemeral side-channel
|
|
13
|
+
* auto-reply (it may be blocked in a synchronous task spawn whose batch
|
|
14
|
+
* includes the sender, so a real turn could never happen in time).
|
|
11
15
|
*/
|
|
12
16
|
import { AgentLifecycleManager } from "../registry/agent-lifecycle";
|
|
13
17
|
import { AgentRegistry } from "../registry/agent-registry";
|
|
@@ -44,8 +48,17 @@ export declare class IrcBus {
|
|
|
44
48
|
* context, so buffering it too would double-deliver via a later
|
|
45
49
|
* `wait`/`inbox` and inflate unread counts. Only a failed live hand-off
|
|
46
50
|
* is buffered for the recipient to drain later.
|
|
51
|
+
*
|
|
52
|
+
* `opts.expectsReply` marks sends whose caller is blocked on an answer
|
|
53
|
+
* (`send await:true`). It is forwarded to the recipient session so a
|
|
54
|
+
* mid-turn recipient that cannot reach a step boundary (async execution
|
|
55
|
+
* disabled — e.g. blocked in a synchronous task spawn awaiting the
|
|
56
|
+
* sender's own batch) can generate an ephemeral side-channel auto-reply
|
|
57
|
+
* instead of stranding the sender until timeout.
|
|
47
58
|
*/
|
|
48
|
-
send(msg: Omit<IrcMessage, "id" | "ts"
|
|
59
|
+
send(msg: Omit<IrcMessage, "id" | "ts">, opts?: {
|
|
60
|
+
expectsReply?: boolean;
|
|
61
|
+
}): Promise<IrcDeliveryReceipt>;
|
|
49
62
|
/**
|
|
50
63
|
* Block until a message for `agentId` (optionally from `filter.from`)
|
|
51
64
|
* arrives; consume + return it. Null on timeout (`timeoutMs <= 0` waits
|
|
@@ -25,6 +25,8 @@ export interface PlanReviewOverlayCallbacks {
|
|
|
25
25
|
onCancel: () => void;
|
|
26
26
|
/** Invoked when the external-editor key is pressed (overlay stays open). */
|
|
27
27
|
onExternalEditor?: () => void;
|
|
28
|
+
/** Invoked when the external-editor key edits the active annotation draft. */
|
|
29
|
+
onAnnotationExternalEditor?: (draft: string, commit: (text: string | null) => void) => void;
|
|
28
30
|
/** Invoked with the new full plan text after an in-overlay delete/undo. */
|
|
29
31
|
onPlanEdited?: (content: string) => void;
|
|
30
32
|
/** Invoked with the Refine feedback markdown whenever annotations change. */
|
|
@@ -8,7 +8,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
10
|
import type { AgentSessionEvent, SessionStats } from "../../session/agent-session";
|
|
11
|
-
import type { RpcHandoffResult, RpcHostToolDefinition, RpcSessionState, RpcSubagentEventFrame, RpcSubagentLifecycleFrame, RpcSubagentMessagesResult, RpcSubagentProgressFrame, RpcSubagentSnapshot, RpcSubagentSubscriptionLevel } from "./rpc-types";
|
|
11
|
+
import type { RpcAvailableSlashCommand, 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;
|
|
@@ -33,6 +33,7 @@ export type RpcSessionEventListener = (event: AgentSessionEvent) => void;
|
|
|
33
33
|
export type RpcSubagentLifecycleListener = (payload: RpcSubagentLifecycleFrame["payload"]) => void;
|
|
34
34
|
export type RpcSubagentProgressListener = (payload: RpcSubagentProgressFrame["payload"]) => void;
|
|
35
35
|
export type RpcSubagentEventListener = (payload: RpcSubagentEventFrame["payload"]) => void;
|
|
36
|
+
export type RpcAvailableCommandsUpdateListener = (commands: RpcAvailableSlashCommand[]) => void;
|
|
36
37
|
export interface RpcClientToolContext<TDetails = unknown> {
|
|
37
38
|
toolCallId: string;
|
|
38
39
|
signal: AbortSignal;
|
|
@@ -80,6 +81,10 @@ export declare class RpcClient {
|
|
|
80
81
|
* Subscribe to raw subagent session events. Call setSubagentSubscription(\"events\") to enable them server-side.
|
|
81
82
|
*/
|
|
82
83
|
onSubagentEvent(listener: RpcSubagentEventListener): () => void;
|
|
84
|
+
/**
|
|
85
|
+
* Subscribe to slash-command availability updates emitted by the RPC server.
|
|
86
|
+
*/
|
|
87
|
+
onAvailableCommandsUpdate(listener: RpcAvailableCommandsUpdateListener): () => void;
|
|
83
88
|
/**
|
|
84
89
|
* Get collected stderr output (useful for debugging).
|
|
85
90
|
*/
|
|
@@ -157,6 +162,10 @@ export declare class RpcClient {
|
|
|
157
162
|
* Get list of available models.
|
|
158
163
|
*/
|
|
159
164
|
getAvailableModels(): Promise<ModelInfo[]>;
|
|
165
|
+
/**
|
|
166
|
+
* Get list of available slash commands.
|
|
167
|
+
*/
|
|
168
|
+
getAvailableCommands(): Promise<RpcAvailableSlashCommand[]>;
|
|
160
169
|
/**
|
|
161
170
|
* Set thinking level.
|
|
162
171
|
*/
|
|
@@ -34,6 +34,8 @@ export type RpcSessionChangeResult = {
|
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
36
|
export type RpcSessionChangeSession = Pick<AgentSession, "newSession" | "switchSession" | "branch">;
|
|
37
|
+
export type RpcSkillCommandSession = Pick<AgentSession, "promptCustomMessage" | "skills" | "skillsSettings">;
|
|
38
|
+
export declare function tryRunRpcSkillCommand(session: RpcSkillCommandSession, text: string): Promise<boolean>;
|
|
37
39
|
export type RpcSubagentResetRegistry = Pick<RpcSubagentRegistry, "clear">;
|
|
38
40
|
export declare function handleRpcSessionChange(session: RpcSessionChangeSession, command: RpcSessionChangeCommand, subagentRegistry?: RpcSubagentResetRegistry): Promise<RpcSessionChangeResult>;
|
|
39
41
|
export declare function requestRpcEditor(pendingRequests: Map<string, PendingExtensionRequest>, output: RpcOutput, title: string, prefill?: string, dialogOptions?: ExtensionUIDialogOptions, editorOptions?: {
|
|
@@ -11,6 +11,7 @@ import type { BashResult } from "../../exec/bash-executor";
|
|
|
11
11
|
import type { ContextUsage } from "../../extensibility/extensions/types";
|
|
12
12
|
import type { AgentSessionEvent, SessionStats } from "../../session/agent-session";
|
|
13
13
|
import type { FileEntry } from "../../session/session-manager";
|
|
14
|
+
import type { AvailableSlashCommandSource } from "../../slash-commands/available-commands";
|
|
14
15
|
import type { AgentProgress, SubagentEventPayload, SubagentLifecyclePayload, SubagentProgressPayload } from "../../task";
|
|
15
16
|
import type { TodoPhase } from "../../tools/todo";
|
|
16
17
|
export type RpcCommand = {
|
|
@@ -44,6 +45,9 @@ export type RpcCommand = {
|
|
|
44
45
|
} | {
|
|
45
46
|
id?: string;
|
|
46
47
|
type: "get_state";
|
|
48
|
+
} | {
|
|
49
|
+
id?: string;
|
|
50
|
+
type: "get_available_commands";
|
|
47
51
|
} | {
|
|
48
52
|
id?: string;
|
|
49
53
|
type: "set_todos";
|
|
@@ -186,6 +190,24 @@ export interface RpcSessionState {
|
|
|
186
190
|
/** Current context window usage. Null tokens/percent when unknown (e.g. right after compaction). */
|
|
187
191
|
contextUsage?: ContextUsage;
|
|
188
192
|
}
|
|
193
|
+
export interface RpcAvailableSlashCommand {
|
|
194
|
+
name: string;
|
|
195
|
+
aliases?: string[];
|
|
196
|
+
description?: string;
|
|
197
|
+
input?: {
|
|
198
|
+
hint?: string;
|
|
199
|
+
};
|
|
200
|
+
subcommands?: Array<{
|
|
201
|
+
name: string;
|
|
202
|
+
description?: string;
|
|
203
|
+
usage?: string;
|
|
204
|
+
}>;
|
|
205
|
+
source: AvailableSlashCommandSource;
|
|
206
|
+
}
|
|
207
|
+
export interface RpcAvailableCommandsUpdateFrame {
|
|
208
|
+
type: "available_commands_update";
|
|
209
|
+
commands: RpcAvailableSlashCommand[];
|
|
210
|
+
}
|
|
189
211
|
export interface RpcHandoffResult {
|
|
190
212
|
savedPath?: string;
|
|
191
213
|
}
|
|
@@ -251,6 +273,14 @@ export type RpcResponse = {
|
|
|
251
273
|
command: "get_state";
|
|
252
274
|
success: true;
|
|
253
275
|
data: RpcSessionState;
|
|
276
|
+
} | {
|
|
277
|
+
id?: string;
|
|
278
|
+
type: "response";
|
|
279
|
+
command: "get_available_commands";
|
|
280
|
+
success: true;
|
|
281
|
+
data: {
|
|
282
|
+
commands: RpcAvailableSlashCommand[];
|
|
283
|
+
};
|
|
254
284
|
} | {
|
|
255
285
|
id?: string;
|
|
256
286
|
type: "response";
|
|
@@ -300,7 +300,7 @@ export declare function getThemeExportColors(themeName?: string): Promise<{
|
|
|
300
300
|
* Highlight code with syntax coloring based on file extension or language.
|
|
301
301
|
* Returns array of highlighted lines.
|
|
302
302
|
*/
|
|
303
|
-
export declare function highlightCode(code: string, lang?: string): string[];
|
|
303
|
+
export declare function highlightCode(code: string, lang?: string, highlightTheme?: Theme): string[];
|
|
304
304
|
export declare function getSymbolTheme(): SymbolTheme;
|
|
305
305
|
export declare function getMarkdownTheme(): MarkdownTheme;
|
|
306
306
|
export declare function getSelectListTheme(): SelectListTheme;
|
|
@@ -36,7 +36,7 @@ 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
|
|
39
|
+
import { type IrcMessage } from "../irc/bus";
|
|
40
40
|
import { type MnemopiSessionState } from "../mnemopi/state";
|
|
41
41
|
import type { PlanModeState } from "../plan-mode/state";
|
|
42
42
|
import { type SecretObfuscator } from "../secrets/obfuscator";
|
|
@@ -116,6 +116,7 @@ export type AgentSessionEvent = AgentEvent | {
|
|
|
116
116
|
};
|
|
117
117
|
/** Listener function for agent session events */
|
|
118
118
|
export type AgentSessionEventListener = (event: AgentSessionEvent) => void;
|
|
119
|
+
export type CommandMetadataChangedListener = () => void | Promise<void>;
|
|
119
120
|
export type AsyncJobSnapshotItem = Pick<AsyncJob, "id" | "type" | "status" | "label" | "startTime">;
|
|
120
121
|
export interface AsyncJobSnapshot {
|
|
121
122
|
running: AsyncJobSnapshotItem[];
|
|
@@ -378,6 +379,7 @@ export declare class AgentSession {
|
|
|
378
379
|
* Multiple listeners can be added. Returns unsubscribe function for this listener.
|
|
379
380
|
*/
|
|
380
381
|
subscribe(listener: AgentSessionEventListener): () => void;
|
|
382
|
+
subscribeCommandMetadataChanged(listener: CommandMetadataChangedListener): () => void;
|
|
381
383
|
/**
|
|
382
384
|
* Synchronously mark the session as disposing so new work is rejected
|
|
383
385
|
* immediately: Python/eval starts throw, queued asides are dropped, and the
|
|
@@ -554,6 +556,8 @@ export declare class AgentSession {
|
|
|
554
556
|
setSlashCommands(slashCommands: FileSlashCommand[]): void;
|
|
555
557
|
/** Custom commands (TypeScript slash commands and MCP prompts) */
|
|
556
558
|
get customCommands(): ReadonlyArray<LoadedCustomCommand>;
|
|
559
|
+
/** MCP prompt commands only, for command-list metadata. */
|
|
560
|
+
get mcpPromptCommands(): ReadonlyArray<LoadedCustomCommand>;
|
|
557
561
|
/** Update the MCP prompt commands list. Called when server prompts are (re)loaded. */
|
|
558
562
|
setMCPPromptCommands(commands: LoadedCustomCommand[]): void;
|
|
559
563
|
/**
|
|
@@ -936,8 +940,18 @@ export declare class AgentSession {
|
|
|
936
940
|
* → "woken".
|
|
937
941
|
*
|
|
938
942
|
* Never blocks on the recipient's turn: the wake turn is fire-and-forget.
|
|
939
|
-
|
|
940
|
-
|
|
943
|
+
*
|
|
944
|
+
* When the sender expects a reply (`send await:true`) and this session is
|
|
945
|
+
* mid-turn with async execution disabled, the next step boundary may be
|
|
946
|
+
* gated on the sender's own batch finishing (blocking task spawns), so a
|
|
947
|
+
* real reply turn can never happen in time. In that case an ephemeral
|
|
948
|
+
* side-channel auto-reply is generated from the current context (the old
|
|
949
|
+
* `respondAsBackground` path) and sent back over the bus on this agent's
|
|
950
|
+
* behalf.
|
|
951
|
+
*/
|
|
952
|
+
deliverIrcMessage(msg: IrcMessage, opts?: {
|
|
953
|
+
expectsReply?: boolean;
|
|
954
|
+
}): Promise<"injected" | "woken">;
|
|
941
955
|
/**
|
|
942
956
|
* Emit an IRC relay observation event on this session for UI rendering only.
|
|
943
957
|
* Does not persist the record to history. Called by the IrcBus to surface
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { AvailableCommand } from "@agentclientprotocol/sdk";
|
|
2
|
+
import type { SkillsSettings } from "../config/settings";
|
|
3
|
+
import type { LoadedCustomCommand } from "../extensibility/custom-commands";
|
|
4
|
+
import type { ExtensionRunner } from "../extensibility/extensions";
|
|
5
|
+
import { type Skill } from "../extensibility/skills";
|
|
6
|
+
import { type FileSlashCommand } from "../extensibility/slash-commands";
|
|
7
|
+
export type AvailableSlashCommandSource = "builtin" | "skill" | "extension" | "custom" | "mcp_prompt" | "file";
|
|
8
|
+
export interface InternalAvailableSlashCommand {
|
|
9
|
+
name: string;
|
|
10
|
+
aliases?: string[];
|
|
11
|
+
description?: string;
|
|
12
|
+
input?: {
|
|
13
|
+
hint: string;
|
|
14
|
+
};
|
|
15
|
+
subcommands?: Array<{
|
|
16
|
+
name: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
usage?: string;
|
|
19
|
+
}>;
|
|
20
|
+
source: AvailableSlashCommandSource;
|
|
21
|
+
}
|
|
22
|
+
export interface AvailableCommandsSession {
|
|
23
|
+
readonly extensionRunner?: ExtensionRunner;
|
|
24
|
+
readonly customCommands: ReadonlyArray<LoadedCustomCommand>;
|
|
25
|
+
readonly mcpPromptCommands?: ReadonlyArray<LoadedCustomCommand>;
|
|
26
|
+
readonly skills: ReadonlyArray<Skill>;
|
|
27
|
+
readonly skillsSettings?: SkillsSettings;
|
|
28
|
+
setSlashCommands(slashCommands: FileSlashCommand[]): void;
|
|
29
|
+
sessionManager: {
|
|
30
|
+
getCwd(): string;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export declare function buildAvailableSlashCommands(session: AvailableCommandsSession, loadFileCommands?: (cwd: string) => Promise<FileSlashCommand[]>): Promise<InternalAvailableSlashCommand[]>;
|
|
34
|
+
export declare function toAcpAvailableCommands(commands: readonly InternalAvailableSlashCommand[]): AvailableCommand[];
|
|
@@ -69,7 +69,7 @@ export declare class BashTool implements AgentTool<BashToolSchema, BashToolDetai
|
|
|
69
69
|
readonly loadMode = "essential";
|
|
70
70
|
readonly description: string;
|
|
71
71
|
readonly parameters: BashToolSchema;
|
|
72
|
-
readonly concurrency
|
|
72
|
+
readonly concurrency: (args: Partial<BashToolInput>) => "shared" | "exclusive";
|
|
73
73
|
readonly strict = true;
|
|
74
74
|
constructor(session: ToolSession);
|
|
75
75
|
execute(_toolCallId: string, { command: rawCommand, env: rawEnv, timeout: rawTimeout, cwd, async: asyncRequested, pty, }: BashToolInput, signal?: AbortSignal, onUpdate?: AgentToolUpdateCallback<BashToolDetails>, ctx?: AgentToolContext): Promise<AgentToolResult<BashToolDetails>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Browser, type Page } from "puppeteer-core";
|
|
2
2
|
/**
|
|
3
3
|
* Allocate an unused TCP port on 127.0.0.1 by binding to port 0 and reading
|
|
4
4
|
* back the kernel-assigned port. There's a small race between close and the
|
|
@@ -17,9 +17,9 @@ export declare function findReusableCdp(exe: string, signal?: AbortSignal): Prom
|
|
|
17
17
|
pid: number;
|
|
18
18
|
} | null>;
|
|
19
19
|
/**
|
|
20
|
-
* Pick the best page target on an attached browser.
|
|
21
|
-
*
|
|
22
|
-
*
|
|
20
|
+
* Pick the best page target on an attached browser. Prefer discoverable page
|
|
21
|
+
* targets first so Chromium/Edge attach flows that hide pages from
|
|
22
|
+
* `browser.pages()` can still return a usable tab.
|
|
23
23
|
*/
|
|
24
24
|
export declare function pickElectronTarget(browser: Browser, matcher?: string): Promise<Page>;
|
|
25
25
|
/**
|
|
@@ -36,6 +36,7 @@ export interface AcquireBrowserOptions {
|
|
|
36
36
|
signal?: AbortSignal;
|
|
37
37
|
}
|
|
38
38
|
export declare function acquireBrowser(kind: BrowserKind, opts: AcquireBrowserOptions): Promise<BrowserHandle>;
|
|
39
|
+
export declare function normalizeConnectedCdpUrl(rawCdpUrl: string): string;
|
|
39
40
|
export declare function holdBrowser(handle: BrowserHandle): void;
|
|
40
41
|
export declare function releaseBrowser(handle: BrowserHandle, opts: {
|
|
41
42
|
kill: boolean;
|
|
@@ -90,12 +90,13 @@ export declare class IrcTool implements AgentTool<typeof ircSchema, IrcDetails>
|
|
|
90
90
|
type IrcRenderArgs = Partial<IrcParams>;
|
|
91
91
|
/**
|
|
92
92
|
* Display-only transcript card for live IRC traffic: `irc:incoming` DMs
|
|
93
|
-
* delivered to this session
|
|
93
|
+
* delivered to this session, `irc:autoreply` side-channel replies sent on
|
|
94
|
+
* this session's behalf, and `irc:relay` observations of agent↔agent
|
|
94
95
|
* traffic. Shares the tool renderer's glyph + quote-border conventions so
|
|
95
96
|
* cards and `irc` tool output look identical in the transcript.
|
|
96
97
|
*/
|
|
97
98
|
export declare function createIrcMessageCard(card: {
|
|
98
|
-
kind: "incoming" | "relay";
|
|
99
|
+
kind: "incoming" | "autoreply" | "relay";
|
|
99
100
|
from?: string;
|
|
100
101
|
to?: string;
|
|
101
102
|
body?: string;
|
|
@@ -124,10 +124,6 @@ export interface ResolvedMultiFindPattern {
|
|
|
124
124
|
targets: ResolvedFindTarget[];
|
|
125
125
|
scopePath: string;
|
|
126
126
|
}
|
|
127
|
-
/**
|
|
128
|
-
* Split a user path into a base path + glob pattern for tools that delegate to
|
|
129
|
-
* APIs accepting separate `path` and `glob` arguments.
|
|
130
|
-
*/
|
|
131
127
|
export declare function parseSearchPath(filePath: string): ParsedSearchPath;
|
|
132
128
|
/**
|
|
133
129
|
* Async sibling of {@link parseSearchPath} that prefers literal interpretation
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@oh-my-pi/pi-coding-agent",
|
|
4
|
-
"version": "15.11.
|
|
4
|
+
"version": "15.11.2",
|
|
5
5
|
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
|
|
6
6
|
"homepage": "https://omp.sh",
|
|
7
7
|
"author": "Can Boluk",
|
|
@@ -47,16 +47,16 @@
|
|
|
47
47
|
"@agentclientprotocol/sdk": "0.22.1",
|
|
48
48
|
"@babel/parser": "^7.29.7",
|
|
49
49
|
"@mozilla/readability": "^0.6.0",
|
|
50
|
-
"@oh-my-pi/hashline": "15.11.
|
|
51
|
-
"@oh-my-pi/omp-stats": "15.11.
|
|
52
|
-
"@oh-my-pi/pi-agent-core": "15.11.
|
|
53
|
-
"@oh-my-pi/pi-ai": "15.11.
|
|
54
|
-
"@oh-my-pi/pi-catalog": "15.11.
|
|
55
|
-
"@oh-my-pi/pi-mnemopi": "15.11.
|
|
56
|
-
"@oh-my-pi/pi-natives": "15.11.
|
|
57
|
-
"@oh-my-pi/pi-tui": "15.11.
|
|
58
|
-
"@oh-my-pi/pi-utils": "15.11.
|
|
59
|
-
"@oh-my-pi/snapcompact": "15.11.
|
|
50
|
+
"@oh-my-pi/hashline": "15.11.2",
|
|
51
|
+
"@oh-my-pi/omp-stats": "15.11.2",
|
|
52
|
+
"@oh-my-pi/pi-agent-core": "15.11.2",
|
|
53
|
+
"@oh-my-pi/pi-ai": "15.11.2",
|
|
54
|
+
"@oh-my-pi/pi-catalog": "15.11.2",
|
|
55
|
+
"@oh-my-pi/pi-mnemopi": "15.11.2",
|
|
56
|
+
"@oh-my-pi/pi-natives": "15.11.2",
|
|
57
|
+
"@oh-my-pi/pi-tui": "15.11.2",
|
|
58
|
+
"@oh-my-pi/pi-utils": "15.11.2",
|
|
59
|
+
"@oh-my-pi/snapcompact": "15.11.2",
|
|
60
60
|
"@opentelemetry/api": "^1.9.1",
|
|
61
61
|
"@opentelemetry/context-async-hooks": "^2.7.1",
|
|
62
62
|
"@opentelemetry/exporter-trace-otlp-proto": "^0.218.0",
|
|
@@ -1093,6 +1093,46 @@ export const SETTINGS_SCHEMA = {
|
|
|
1093
1093
|
ui: { tab: "interaction", label: "Collapse Changelog", description: "Show condensed changelog after updates" },
|
|
1094
1094
|
},
|
|
1095
1095
|
|
|
1096
|
+
"magicKeywords.enabled": {
|
|
1097
|
+
type: "boolean",
|
|
1098
|
+
default: true,
|
|
1099
|
+
ui: {
|
|
1100
|
+
tab: "interaction",
|
|
1101
|
+
label: "Magic Keywords",
|
|
1102
|
+
description: "Enable hidden notices for standalone ultrathink, orchestrate, and workflowz keywords",
|
|
1103
|
+
},
|
|
1104
|
+
},
|
|
1105
|
+
|
|
1106
|
+
"magicKeywords.ultrathink": {
|
|
1107
|
+
type: "boolean",
|
|
1108
|
+
default: true,
|
|
1109
|
+
ui: {
|
|
1110
|
+
tab: "interaction",
|
|
1111
|
+
label: "Ultrathink Keyword",
|
|
1112
|
+
description: "Let standalone ultrathink request maximum automatic thinking and append its hidden notice",
|
|
1113
|
+
},
|
|
1114
|
+
},
|
|
1115
|
+
|
|
1116
|
+
"magicKeywords.orchestrate": {
|
|
1117
|
+
type: "boolean",
|
|
1118
|
+
default: true,
|
|
1119
|
+
ui: {
|
|
1120
|
+
tab: "interaction",
|
|
1121
|
+
label: "Orchestrate Keyword",
|
|
1122
|
+
description: "Let standalone orchestrate append its hidden multi-agent orchestration notice",
|
|
1123
|
+
},
|
|
1124
|
+
},
|
|
1125
|
+
|
|
1126
|
+
"magicKeywords.workflow": {
|
|
1127
|
+
type: "boolean",
|
|
1128
|
+
default: true,
|
|
1129
|
+
ui: {
|
|
1130
|
+
tab: "interaction",
|
|
1131
|
+
label: "Workflow Keyword",
|
|
1132
|
+
description: "Let standalone workflowz append its hidden eval workflow notice",
|
|
1133
|
+
},
|
|
1134
|
+
},
|
|
1135
|
+
|
|
1096
1136
|
// Notifications
|
|
1097
1137
|
"completion.notify": {
|
|
1098
1138
|
type: "enum",
|
|
@@ -56,6 +56,8 @@ export interface BashResult {
|
|
|
56
56
|
const shellSessions = new Map<string, Shell>();
|
|
57
57
|
const brokenShellSessions = new Set<string>();
|
|
58
58
|
const shellSessionQuarantines = new Map<string, Promise<unknown>>();
|
|
59
|
+
/** Session keys with a command currently in flight on the persistent Shell. */
|
|
60
|
+
const shellSessionsInUse = new Set<string>();
|
|
59
61
|
|
|
60
62
|
function quarantineShellSession(
|
|
61
63
|
sessionKey: string,
|
|
@@ -223,8 +225,14 @@ export async function executeBash(command: string, options?: BashExecutorOptions
|
|
|
223
225
|
shellSessions.delete(sessionKey);
|
|
224
226
|
}
|
|
225
227
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
+
// A persistent Shell runs one command at a time (the native session is a
|
|
229
|
+
// mutex-guarded queue and `abort()` kills every in-flight run on it). When
|
|
230
|
+
// parallel bash calls overlap on the same key, the first one owns the
|
|
231
|
+
// persistent session; the rest degrade to isolated one-shot shells — the
|
|
232
|
+
// same path quarantined sessions take.
|
|
233
|
+
const sessionBusy = shellSessionsInUse.has(sessionKey);
|
|
234
|
+
let shellSession = persistentSessionBroken || sessionBusy ? undefined : shellSessions.get(sessionKey);
|
|
235
|
+
if (!shellSession && !persistentSessionBroken && !sessionBusy) {
|
|
228
236
|
shellSession = new Shell({
|
|
229
237
|
sessionEnv: shellEnv,
|
|
230
238
|
snapshotPath: snapshotPath ?? undefined,
|
|
@@ -232,6 +240,10 @@ export async function executeBash(command: string, options?: BashExecutorOptions
|
|
|
232
240
|
});
|
|
233
241
|
shellSessions.set(sessionKey, shellSession);
|
|
234
242
|
}
|
|
243
|
+
const ownsPersistentSession = shellSession !== undefined;
|
|
244
|
+
if (ownsPersistentSession) {
|
|
245
|
+
shellSessionsInUse.add(sessionKey);
|
|
246
|
+
}
|
|
235
247
|
const userSignal = options?.signal;
|
|
236
248
|
const runAbortController = new AbortController();
|
|
237
249
|
let abortCleanupPromise: Promise<void> | undefined;
|
|
@@ -393,10 +405,13 @@ export async function executeBash(command: string, options?: BashExecutorOptions
|
|
|
393
405
|
if (userSignal) {
|
|
394
406
|
userSignal.removeEventListener("abort", abortHandler);
|
|
395
407
|
}
|
|
396
|
-
if (
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
408
|
+
if (ownsPersistentSession) {
|
|
409
|
+
shellSessionsInUse.delete(sessionKey);
|
|
410
|
+
if (resetSession || options?.sessionKey?.includes(":async:")) {
|
|
411
|
+
// `:async:` keys are per-job (jobId is unique), so the Shell would
|
|
412
|
+
// otherwise stay in the process-global map forever after completion.
|
|
413
|
+
shellSessions.delete(sessionKey);
|
|
414
|
+
}
|
|
400
415
|
}
|
|
401
416
|
}
|
|
402
417
|
}
|