@oh-my-pi/pi-coding-agent 14.5.7 → 14.5.9

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/package.json +7 -7
  3. package/src/config/model-registry.ts +23 -1
  4. package/src/config/settings-schema.ts +23 -0
  5. package/src/edit/modes/atom.lark +7 -5
  6. package/src/edit/modes/atom.ts +462 -56
  7. package/src/edit/modes/hashline.ts +21 -1
  8. package/src/lsp/index.ts +2 -4
  9. package/src/lsp/render.ts +0 -3
  10. package/src/lsp/types.ts +1 -4
  11. package/src/lsp/utils.ts +18 -14
  12. package/src/modes/components/settings-defs.ts +10 -0
  13. package/src/modes/controllers/command-controller.ts +17 -0
  14. package/src/modes/controllers/event-controller.ts +14 -9
  15. package/src/modes/controllers/input-controller.ts +13 -1
  16. package/src/modes/interactive-mode.ts +44 -23
  17. package/src/modes/types.ts +5 -2
  18. package/src/modes/utils/context-usage.ts +294 -0
  19. package/src/prompts/tools/atom.md +99 -44
  20. package/src/prompts/tools/exit-plan-mode.md +5 -39
  21. package/src/prompts/tools/lsp.md +2 -3
  22. package/src/prompts/tools/recipe.md +16 -0
  23. package/src/prompts/tools/task.md +34 -147
  24. package/src/prompts/tools/todo-write.md +22 -64
  25. package/src/session/compaction/compaction.ts +35 -22
  26. package/src/session/session-dump-format.ts +1 -0
  27. package/src/slash-commands/builtin-registry.ts +12 -5
  28. package/src/tools/bash.ts +149 -115
  29. package/src/tools/debug.ts +57 -70
  30. package/src/tools/index.ts +11 -0
  31. package/src/tools/recipe/index.ts +80 -0
  32. package/src/tools/recipe/render.ts +19 -0
  33. package/src/tools/recipe/runner.ts +219 -0
  34. package/src/tools/recipe/runners/cargo.ts +131 -0
  35. package/src/tools/recipe/runners/index.ts +8 -0
  36. package/src/tools/recipe/runners/just.ts +73 -0
  37. package/src/tools/recipe/runners/make.ts +101 -0
  38. package/src/tools/recipe/runners/pkg.ts +165 -0
  39. package/src/tools/recipe/runners/task.ts +72 -0
  40. package/src/tools/renderers.ts +2 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,49 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [14.5.9] - 2026-04-30
6
+
7
+ ### Added
8
+
9
+ - Added the `/context` slash command to display an estimated context-usage breakdown panel for the current session
10
+ - Added `-LidA..LidB` syntax to delete inclusive line ranges in a single atom operation
11
+ - Added `LidA..LidB=TEXT` range-replace syntax with `\TEXT` and `\` continuation lines for multi-line replacement blocks
12
+ - Added shorthand cursor+insert operations in atom edits, including `^Lid` (insert before anchor), `^+TEXT`, `$+TEXT`, and `Lid+TEXT`/`@Lid+TEXT`
13
+ - Added standalone file-op fallback so `!rm` and `!mv DEST` inputs can be normalized into sections when using split input parsing
14
+
15
+ ### Changed
16
+
17
+ - Changed token counting to use tokenizer-based estimates instead of a character-per-4 heuristic for context and compaction calculations
18
+ - Changed hashline anchor auto-rebase tolerance from ±2 lines to ±5 lines for stale Lid recovery
19
+ - Changed atom input handling so `#`-prefixed lines are treated as comments and ignored
20
+ - Changed execution when all edits are no-op `Lid=TEXT` replacements to return success with a no-change explanation instead of throwing
21
+
22
+ ### Fixed
23
+
24
+ - Fixed malformed range and unified-diff-like atom syntax by rejecting reversed ranges, mismatched range endpoint hashes, and forms like `+Lid|TEXT`, `+Lid=TEXT`, and `-LidA..LidB|TEXT` with explicit actionable errors
25
+ - Fixed hash mismatch errors to include likely-shifted anchor hints when a unique matching line is found elsewhere in the file
26
+
27
+ ## [14.5.8] - 2026-04-29
28
+ ### Breaking Changes
29
+
30
+ - Changed the task runner toggle from `just.enabled` to `runCommand.enabled`, so existing configurations using `just.enabled` must be migrated
31
+ - Removed the legacy `just` tool and replaced it with `run_command`
32
+ - Renamed the built-in tool API from `just` to `run_command`, so clients requesting/handling the old tool name must update
33
+
34
+ ### Added
35
+
36
+ - Added a new `run_command` tool that runs project tasks via a single `op` argument, auto-detecting and supporting recipes from justfiles, `package.json` scripts (including workspace packages), Cargo bin/example/test targets, Makefiles, and Taskfiles
37
+ - Added support for explicit runner-qualified tasks via `run_command` with `runnerId:task` syntax in the prompt guidance
38
+
39
+ ### Changed
40
+
41
+ - Changed automatic tool availability so requesting `bash` can now auto-include `run_command` when a supported task runner manifest is detected in the working directory
42
+ - Changed task resolution to disambiguate identical task names across multiple runners and show runner-aware command execution errors
43
+
44
+ ### Fixed
45
+
46
+ - Fixed editor draft being erased when a user message queued during streaming was eventually submitted; the queue/steer path now preserves any new prompt the user has typed since queuing, matching the existing optimistic-send protection.
47
+
5
48
  ## [14.5.7] - 2026-04-29
6
49
 
7
50
  ### Fixed
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": "14.5.7",
4
+ "version": "14.5.9",
5
5
  "description": "Coding agent CLI with read, bash, edit, write tools and session management",
6
6
  "homepage": "https://github.com/can1357/oh-my-pi",
7
7
  "author": "Can Boluk",
@@ -46,12 +46,12 @@
46
46
  "dependencies": {
47
47
  "@agentclientprotocol/sdk": "0.20.0",
48
48
  "@mozilla/readability": "^0.6.0",
49
- "@oh-my-pi/omp-stats": "14.5.7",
50
- "@oh-my-pi/pi-agent-core": "14.5.7",
51
- "@oh-my-pi/pi-ai": "14.5.7",
52
- "@oh-my-pi/pi-natives": "14.5.7",
53
- "@oh-my-pi/pi-tui": "14.5.7",
54
- "@oh-my-pi/pi-utils": "14.5.7",
49
+ "@oh-my-pi/omp-stats": "14.5.9",
50
+ "@oh-my-pi/pi-agent-core": "14.5.9",
51
+ "@oh-my-pi/pi-ai": "14.5.9",
52
+ "@oh-my-pi/pi-natives": "14.5.9",
53
+ "@oh-my-pi/pi-tui": "14.5.9",
54
+ "@oh-my-pi/pi-utils": "14.5.9",
55
55
  "@puppeteer/browsers": "^2.13.0",
56
56
  "@sinclair/typebox": "^0.34.49",
57
57
  "@xterm/headless": "^6.0.0",
@@ -249,7 +249,7 @@ const ProviderDiscoverySchema = Type.Object({
249
249
  type: Type.Union([Type.Literal("ollama"), Type.Literal("llama.cpp"), Type.Literal("lm-studio")]),
250
250
  });
251
251
 
252
- const ProviderAuthSchema = Type.Union([Type.Literal("apiKey"), Type.Literal("none")]);
252
+ const ProviderAuthSchema = Type.Union([Type.Literal("apiKey"), Type.Literal("none"), Type.Literal("oauth")]);
253
253
 
254
254
  const ProviderConfigSchema = Type.Object({
255
255
  baseUrl: Type.Optional(Type.String({ minLength: 1 })),
@@ -643,6 +643,7 @@ type CustomModelOverlay = {
643
643
  compat?: Model<Api>["compat"];
644
644
  contextPromotionTarget?: string;
645
645
  premiumMultiplier?: number;
646
+ isOAuth?: boolean;
646
647
  };
647
648
 
648
649
  function mergeCustomModelHeaders(
@@ -661,6 +662,22 @@ function mergeCustomModelHeaders(
661
662
  return headers;
662
663
  }
663
664
 
665
+ /**
666
+ * Decide whether a custom-yaml model should force OAuth-style request shaping.
667
+ * - Explicit `auth: oauth` → force on.
668
+ * - Explicit `auth: apiKey` / `auth: none` → leave unset (auto-detect by key prefix).
669
+ * - No `auth` specified and `api: anthropic-messages` → default on. Custom Anthropic
670
+ * endpoints are typically Claude-Code-style proxies (e.g. CLIProxyAPI) that expect
671
+ * the cloaked request shape regardless of how the proxy itself is authenticated.
672
+ * - Otherwise → unset.
673
+ */
674
+ function resolveCustomModelIsOAuth(api: Api, providerAuth: ProviderAuthMode | undefined): boolean | undefined {
675
+ if (providerAuth === "oauth") return true;
676
+ if (providerAuth !== undefined) return undefined;
677
+ if (api === "anthropic-messages") return true;
678
+ return undefined;
679
+ }
680
+
664
681
  function buildCustomModelOverlay(
665
682
  providerName: string,
666
683
  providerBaseUrl: string,
@@ -669,6 +686,7 @@ function buildCustomModelOverlay(
669
686
  providerApiKey: string | undefined,
670
687
  authHeader: boolean | undefined,
671
688
  providerCompat: Model<Api>["compat"] | undefined,
689
+ providerAuth: ProviderAuthMode | undefined,
672
690
  modelDef: CustomModelDefinitionLike,
673
691
  ): CustomModelOverlay | undefined {
674
692
  const api = modelDef.api ?? providerApi;
@@ -689,6 +707,7 @@ function buildCustomModelOverlay(
689
707
  compat: mergeCompat(providerCompat, modelDef.compat),
690
708
  contextPromotionTarget: modelDef.contextPromotionTarget,
691
709
  premiumMultiplier: modelDef.premiumMultiplier,
710
+ isOAuth: resolveCustomModelIsOAuth(api, providerAuth),
692
711
  };
693
712
  }
694
713
 
@@ -720,6 +739,7 @@ function finalizeCustomModel(model: CustomModelOverlay, options: CustomModelBuil
720
739
  compat: resolvedModel.compat,
721
740
  contextPromotionTarget: resolvedModel.contextPromotionTarget,
722
741
  premiumMultiplier: resolvedModel.premiumMultiplier,
742
+ isOAuth: resolvedModel.isOAuth,
723
743
  } as Model<Api>);
724
744
  }
725
745
 
@@ -1735,6 +1755,7 @@ export class ModelRegistry {
1735
1755
  providerConfig.apiKey,
1736
1756
  providerConfig.authHeader,
1737
1757
  providerConfig.compat,
1758
+ (providerConfig.auth as ProviderAuthMode | undefined) ?? undefined,
1738
1759
  modelDef as CustomModelDefinitionLike,
1739
1760
  );
1740
1761
  if (!model) continue;
@@ -2069,6 +2090,7 @@ export class ModelRegistry {
2069
2090
  config.apiKey,
2070
2091
  config.authHeader,
2071
2092
  config.compat,
2093
+ undefined,
2072
2094
  modelDef as CustomModelDefinitionLike,
2073
2095
  );
2074
2096
  if (!overlay) {
@@ -608,6 +608,18 @@ export const SETTINGS_SCHEMA = {
608
608
  },
609
609
  },
610
610
 
611
+ "loop.mode": {
612
+ type: "enum",
613
+ values: ["prompt", "compact", "reset"] as const,
614
+ default: "prompt",
615
+ ui: {
616
+ tab: "interaction",
617
+ label: "Loop Mode",
618
+ description: "What happens between /loop iterations before re-submitting the prompt",
619
+ submenu: true,
620
+ },
621
+ },
622
+
611
623
  // Input and startup
612
624
  doubleEscapeAction: {
613
625
  type: "enum",
@@ -1294,6 +1306,17 @@ export const SETTINGS_SCHEMA = {
1294
1306
  },
1295
1307
  },
1296
1308
 
1309
+ "recipe.enabled": {
1310
+ type: "boolean",
1311
+ default: true,
1312
+ ui: {
1313
+ tab: "tools",
1314
+ label: "Recipe",
1315
+ description:
1316
+ "Enable the recipe tool when a justfile / package.json / Cargo.toml / Makefile / Taskfile is present",
1317
+ },
1318
+ },
1319
+
1297
1320
  "inspect_image.enabled": {
1298
1321
  type: "boolean",
1299
1322
  default: false,
@@ -8,8 +8,8 @@ file_header: "---" filename LF
8
8
  filename: /(.+)/
9
9
 
10
10
  line_change: line* mutation_line line*
11
- line: insert_line | delete_line | set_line | move_line | blank
12
- mutation_line: insert_line | delete_line | set_line
11
+ line: insert_line | delete_line | set_block | move_line | blank
12
+ mutation_line: insert_line | delete_line | set_block
13
13
 
14
14
  whole_file_change: blank* whole_file_line blank*
15
15
  whole_file_line: remove_file | move_file
@@ -18,9 +18,11 @@ move_file: "!mv" WS destination LF
18
18
  destination: /(?:[^ \t\r\n]+|"[^"\r\n]+"|'[^'\r\n]+')/
19
19
 
20
20
  insert_line: "+" /(.*)/ LF
21
- delete_line: "-" LID LF
22
- set_line: LID "=" /(.*)/ LF
23
- move_line: ("@" LID | "$" | "^") LF
21
+ delete_line: "-" (LID ".." LID | LID) LF
22
+ set_line: (LID ".." LID | LID) WS? "=" /(.*)/ LF
23
+ set_block: set_line continuation_line*
24
+ continuation_line: "\\" /(.*)/ LF
25
+ move_line: ("@" LID | "^" LID | "^" | "$") LF
24
26
 
25
27
  LID: /[1-9][0-9]*[a-z]{2}/
26
28
  WS: /[ \t]+/