@oh-my-pi/pi-coding-agent 14.9.9 → 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 +82 -0
- package/package.json +7 -7
- package/scripts/format-prompts.ts +1 -1
- package/src/cli/args.ts +2 -2
- package/src/cli.ts +1 -0
- 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 +31 -0
- 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/eval/js/context-manager.ts +1 -1
- 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/internal-urls/docs-index.generated.ts +6 -6
- 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 +6 -6
- 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 +17 -1
- package/src/task/render.ts +6 -3
- package/src/tools/bash.ts +176 -2
- 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
|
@@ -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
|
+
}
|