@oh-my-pi/pi-coding-agent 14.9.8 → 15.0.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 +101 -0
- package/package.json +7 -7
- package/scripts/build-binary.ts +11 -0
- package/scripts/format-prompts.ts +1 -1
- package/src/cli/args.ts +2 -2
- package/src/cli/stats-cli.ts +2 -0
- package/src/cli.ts +24 -1
- package/src/commands/acp.ts +24 -0
- package/src/commands/launch.ts +6 -4
- package/src/commit/agentic/prompts/system.md +1 -1
- package/src/config/model-resolver.ts +30 -0
- package/src/config/settings-schema.ts +61 -9
- package/src/config/settings.ts +18 -1
- package/src/edit/index.ts +22 -1
- package/src/edit/modes/patch.ts +10 -0
- package/src/edit/modes/replace.ts +3 -0
- package/src/edit/renderer.ts +10 -0
- package/src/edit/streaming.ts +1 -1
- package/src/eval/js/context-manager.ts +10 -9
- package/src/eval/js/shared/rewrite-imports.ts +120 -48
- package/src/eval/js/shared/runtime.ts +31 -4
- package/src/eval/js/tool-bridge.ts +43 -21
- package/src/extensibility/extensions/runner.ts +54 -1
- package/src/extensibility/extensions/types.ts +11 -0
- package/src/extensibility/skills.ts +33 -1
- package/src/hashline/grammar.lark +1 -1
- package/src/hashline/input.ts +11 -5
- package/src/internal-urls/docs-index.generated.ts +7 -7
- package/src/internal-urls/index.ts +1 -0
- package/src/internal-urls/issue-pr-protocol.ts +577 -0
- package/src/internal-urls/router.ts +6 -3
- package/src/internal-urls/types.ts +22 -1
- package/src/main.ts +13 -9
- package/src/modes/acp/acp-agent.ts +361 -54
- package/src/modes/acp/acp-client-bridge.ts +152 -0
- package/src/modes/acp/acp-event-mapper.ts +180 -15
- package/src/modes/acp/terminal-auth.ts +37 -0
- package/src/modes/components/read-tool-group.ts +29 -1
- package/src/modes/controllers/command-controller.ts +14 -6
- package/src/modes/controllers/event-controller.ts +24 -11
- package/src/modes/controllers/extension-ui-controller.ts +8 -2
- package/src/modes/controllers/input-controller.ts +72 -39
- package/src/modes/interactive-mode.ts +71 -7
- package/src/modes/rpc/rpc-mode.ts +17 -2
- package/src/modes/types.ts +6 -2
- package/src/modes/utils/ui-helpers.ts +15 -3
- package/src/prompts/agents/designer.md +5 -5
- package/src/prompts/agents/explore.md +7 -7
- package/src/prompts/agents/init.md +9 -9
- package/src/prompts/agents/librarian.md +14 -14
- package/src/prompts/agents/plan.md +4 -4
- package/src/prompts/agents/reviewer.md +5 -5
- package/src/prompts/agents/task.md +10 -10
- package/src/prompts/commands/orchestrate.md +2 -2
- package/src/prompts/compaction/branch-summary.md +3 -3
- package/src/prompts/compaction/compaction-short-summary.md +7 -7
- package/src/prompts/compaction/compaction-summary-context.md +1 -1
- package/src/prompts/compaction/compaction-summary.md +5 -5
- package/src/prompts/compaction/compaction-turn-prefix.md +3 -3
- package/src/prompts/compaction/compaction-update-summary.md +11 -11
- package/src/prompts/memories/consolidation.md +2 -2
- package/src/prompts/memories/read-path.md +1 -1
- package/src/prompts/memories/stage_one_input.md +1 -1
- package/src/prompts/memories/stage_one_system.md +5 -5
- package/src/prompts/review-request.md +4 -4
- package/src/prompts/system/agent-creation-architect.md +17 -17
- package/src/prompts/system/agent-creation-user.md +2 -2
- package/src/prompts/system/commit-message-system.md +2 -2
- package/src/prompts/system/custom-system-prompt.md +2 -2
- package/src/prompts/system/eager-todo.md +6 -6
- package/src/prompts/system/handoff-document.md +1 -1
- package/src/prompts/system/plan-mode-active.md +22 -21
- package/src/prompts/system/plan-mode-approved.md +4 -4
- package/src/prompts/system/plan-mode-compact-instructions.md +16 -0
- package/src/prompts/system/plan-mode-reference.md +2 -2
- package/src/prompts/system/plan-mode-subagent.md +8 -8
- package/src/prompts/system/plan-mode-tool-decision-reminder.md +2 -2
- package/src/prompts/system/project-prompt.md +4 -4
- package/src/prompts/system/subagent-system-prompt.md +7 -7
- package/src/prompts/system/subagent-yield-reminder.md +4 -4
- package/src/prompts/system/system-prompt.md +72 -71
- package/src/prompts/system/ttsr-interrupt.md +1 -1
- package/src/prompts/tools/apply-patch.md +1 -1
- package/src/prompts/tools/ast-edit.md +3 -3
- package/src/prompts/tools/ast-grep.md +3 -3
- package/src/prompts/tools/browser.md +3 -3
- package/src/prompts/tools/checkpoint.md +3 -3
- package/src/prompts/tools/exit-plan-mode.md +2 -2
- package/src/prompts/tools/find.md +3 -3
- package/src/prompts/tools/github.md +2 -5
- package/src/prompts/tools/hashline.md +20 -20
- package/src/prompts/tools/image-gen.md +3 -3
- package/src/prompts/tools/irc.md +1 -1
- package/src/prompts/tools/lsp.md +2 -2
- package/src/prompts/tools/patch.md +6 -6
- package/src/prompts/tools/read.md +7 -7
- package/src/prompts/tools/replace.md +5 -5
- package/src/prompts/tools/retain.md +1 -1
- package/src/prompts/tools/rewind.md +2 -2
- package/src/prompts/tools/search.md +2 -2
- package/src/prompts/tools/ssh.md +2 -2
- package/src/prompts/tools/task.md +12 -6
- package/src/prompts/tools/web-search.md +2 -2
- package/src/prompts/tools/write.md +3 -3
- package/src/sdk.ts +69 -12
- package/src/session/agent-session.ts +231 -22
- package/src/session/client-bridge.ts +81 -0
- package/src/session/compaction/errors.ts +31 -0
- package/src/session/compaction/index.ts +1 -0
- package/src/slash-commands/acp-builtins.ts +46 -0
- package/src/slash-commands/builtin-registry.ts +699 -116
- package/src/slash-commands/helpers/context-report.ts +39 -0
- package/src/slash-commands/helpers/format.ts +23 -0
- package/src/slash-commands/helpers/marketplace-manager.ts +25 -0
- package/src/slash-commands/helpers/mcp.ts +532 -0
- package/src/slash-commands/helpers/parse.ts +85 -0
- package/src/slash-commands/helpers/ssh.ts +193 -0
- package/src/slash-commands/helpers/todo.ts +279 -0
- package/src/slash-commands/helpers/usage-report.ts +91 -0
- package/src/slash-commands/types.ts +126 -0
- package/src/task/executor.ts +10 -3
- package/src/task/index.ts +29 -51
- package/src/task/render.ts +6 -3
- package/src/task/worktree.ts +170 -239
- package/src/tools/bash.ts +176 -2
- package/src/tools/browser/tab-supervisor.ts +13 -13
- package/src/tools/conflict-detect.ts +6 -6
- package/src/tools/fetch.ts +15 -4
- package/src/tools/find.ts +19 -1
- package/src/tools/gh-renderer.ts +0 -12
- package/src/tools/gh.ts +682 -176
- package/src/tools/github-cache.ts +548 -0
- package/src/tools/index.ts +3 -0
- package/src/tools/read.ts +110 -27
- package/src/tools/write.ts +23 -1
- package/src/tui/code-cell.ts +70 -2
- package/src/utils/git.ts +5 -0
- package/src/task/isolation-backend.ts +0 -94
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ClientBridge — abstraction over capabilities provided by an external client
|
|
3
|
+
* (e.g. ACP editor host) that the agent can route through instead of operating
|
|
4
|
+
* directly on the local filesystem / spawning local subprocesses.
|
|
5
|
+
*
|
|
6
|
+
* When `undefined`, tools fall back to local IO. When populated (currently
|
|
7
|
+
* only by `AcpAgent`), tools route requests through the client so it can
|
|
8
|
+
* surface unsaved buffer state, render terminals in the IDE, or gate
|
|
9
|
+
* destructive operations behind user permission prompts.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export interface ClientBridgeCapabilities {
|
|
13
|
+
/** Client implements `fs/read_text_file`. */
|
|
14
|
+
readTextFile?: boolean;
|
|
15
|
+
/** Client implements `fs/write_text_file`. */
|
|
16
|
+
writeTextFile?: boolean;
|
|
17
|
+
/** Client implements the `terminal/*` family. */
|
|
18
|
+
terminal?: boolean;
|
|
19
|
+
/** Client implements `session/request_permission`. */
|
|
20
|
+
requestPermission?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface ClientBridgePermissionToolCall {
|
|
24
|
+
toolCallId: string;
|
|
25
|
+
toolName: string;
|
|
26
|
+
title: string;
|
|
27
|
+
kind?: string;
|
|
28
|
+
rawInput?: unknown;
|
|
29
|
+
locations?: { path: string; line?: number }[];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export type ClientBridgePermissionOptionKind = "allow_once" | "allow_always" | "reject_once" | "reject_always";
|
|
33
|
+
|
|
34
|
+
export interface ClientBridgePermissionOption {
|
|
35
|
+
optionId: string;
|
|
36
|
+
name: string;
|
|
37
|
+
kind: ClientBridgePermissionOptionKind;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type ClientBridgePermissionOutcome =
|
|
41
|
+
| { outcome: "cancelled" }
|
|
42
|
+
| { outcome: "selected"; optionId: string; kind?: ClientBridgePermissionOptionKind };
|
|
43
|
+
|
|
44
|
+
export interface ClientBridgeTerminalExitStatus {
|
|
45
|
+
exitCode?: number | null;
|
|
46
|
+
signal?: string | null;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface ClientBridgeTerminalOutput {
|
|
50
|
+
output: string;
|
|
51
|
+
truncated: boolean;
|
|
52
|
+
exitStatus?: ClientBridgeTerminalExitStatus | null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface ClientBridgeTerminalHandle {
|
|
56
|
+
terminalId: string;
|
|
57
|
+
waitForExit(): Promise<ClientBridgeTerminalExitStatus>;
|
|
58
|
+
currentOutput(): Promise<ClientBridgeTerminalOutput>;
|
|
59
|
+
kill(): Promise<void>;
|
|
60
|
+
release(): Promise<void>;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface ClientBridgeCreateTerminalParams {
|
|
64
|
+
command: string;
|
|
65
|
+
args?: string[];
|
|
66
|
+
env?: Array<{ name: string; value: string }>;
|
|
67
|
+
cwd?: string;
|
|
68
|
+
outputByteLimit?: number;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface ClientBridge {
|
|
72
|
+
readonly capabilities: ClientBridgeCapabilities;
|
|
73
|
+
readTextFile?(params: { path: string; line?: number; limit?: number }): Promise<string>;
|
|
74
|
+
writeTextFile?(params: { path: string; content: string }): Promise<void>;
|
|
75
|
+
createTerminal?(params: ClientBridgeCreateTerminalParams): Promise<ClientBridgeTerminalHandle>;
|
|
76
|
+
requestPermission?(
|
|
77
|
+
toolCall: ClientBridgePermissionToolCall,
|
|
78
|
+
options: ClientBridgePermissionOption[],
|
|
79
|
+
signal?: AbortSignal,
|
|
80
|
+
): Promise<ClientBridgePermissionOutcome>;
|
|
81
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compaction error types.
|
|
3
|
+
*
|
|
4
|
+
* `CompactionCancelledError` is the canonical signal raised when a compaction
|
|
5
|
+
* is explicitly aborted — operator Esc, extension hook returning `cancel`,
|
|
6
|
+
* programmatic `session.abortCompaction()` call, or any other deliberate
|
|
7
|
+
* abort source. Downstream callers (e.g. `executeCompaction`) discriminate
|
|
8
|
+
* cancellation from other failures via `instanceof CompactionCancelledError`
|
|
9
|
+
* rather than introspecting error messages or `name` fields — the typed
|
|
10
|
+
* sentinel makes classification source-agnostic and refactor-stable.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export class CompactionCancelledError extends Error {
|
|
14
|
+
readonly name = "CompactionCancelledError" as const;
|
|
15
|
+
|
|
16
|
+
constructor(message = "Compaction cancelled") {
|
|
17
|
+
super(message);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Outcome of a compaction attempt, surfaced by `CommandController.executeCompaction`
|
|
23
|
+
* so callers (e.g. the plan-mode approval flow) can distinguish a deliberate abort
|
|
24
|
+
* from an unrelated failure.
|
|
25
|
+
*
|
|
26
|
+
* "ok" — compaction completed; transcript was summarized.
|
|
27
|
+
* "cancelled" — `CompactionCancelledError` was raised. Operator Esc, extension
|
|
28
|
+
* hook, programmatic abort — all source-agnostic.
|
|
29
|
+
* "failed" — any other rejection from `session.compact()`.
|
|
30
|
+
*/
|
|
31
|
+
export type CompactionOutcome = "ok" | "cancelled" | "failed";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { AvailableCommand } from "@agentclientprotocol/sdk";
|
|
2
|
+
import { BUILTIN_SLASH_COMMANDS_INTERNAL, lookupBuiltinSlashCommand } from "./builtin-registry";
|
|
3
|
+
import { parseSlashCommand } from "./helpers/parse";
|
|
4
|
+
import type { AcpBuiltinCommandRuntime, AcpBuiltinSlashCommandResult } from "./types";
|
|
5
|
+
|
|
6
|
+
export type { AcpBuiltinCommandRuntime, AcpBuiltinSlashCommandResult } from "./types";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Commands advertised to ACP clients. Entries without a text-mode `handle`
|
|
10
|
+
* (e.g. `/quit`, `/login`, dashboards) are filtered out so the client doesn't
|
|
11
|
+
* see commands it cannot drive.
|
|
12
|
+
*/
|
|
13
|
+
export const ACP_BUILTIN_SLASH_COMMANDS: AvailableCommand[] = BUILTIN_SLASH_COMMANDS_INTERNAL.filter(
|
|
14
|
+
command => command.handle !== undefined,
|
|
15
|
+
).map(command => {
|
|
16
|
+
// Honor mode-specific copy: ACP clients receive concise text-mode
|
|
17
|
+
// descriptions/hints when the spec sets `acpDescription` / `acpInputHint`,
|
|
18
|
+
// otherwise fall back to the unified `description` / `inlineHint`.
|
|
19
|
+
const hint = command.acpInputHint ?? command.inlineHint;
|
|
20
|
+
return {
|
|
21
|
+
name: command.name,
|
|
22
|
+
description: command.acpDescription ?? command.description,
|
|
23
|
+
input: hint ? { hint } : undefined,
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Dispatch a slash command in ACP/text mode. Returns:
|
|
29
|
+
* - `false` when no builtin matched (or matched a TUI-only entry); the caller
|
|
30
|
+
* should forward the input as a prompt.
|
|
31
|
+
* - `{ consumed: true }` when the command handled the input entirely.
|
|
32
|
+
* - `{ prompt }` when the command was handled but a residual prompt should be
|
|
33
|
+
* sent to the model.
|
|
34
|
+
*/
|
|
35
|
+
export async function executeAcpBuiltinSlashCommand(
|
|
36
|
+
text: string,
|
|
37
|
+
runtime: AcpBuiltinCommandRuntime,
|
|
38
|
+
): Promise<AcpBuiltinSlashCommandResult> {
|
|
39
|
+
const parsed = parseSlashCommand(text);
|
|
40
|
+
if (!parsed) return false;
|
|
41
|
+
const command = lookupBuiltinSlashCommand(parsed.name);
|
|
42
|
+
if (!command?.handle) return false;
|
|
43
|
+
const result = await command.handle(parsed, runtime);
|
|
44
|
+
if (result === undefined) return { consumed: true };
|
|
45
|
+
return result;
|
|
46
|
+
}
|