@oh-my-pi/pi-coding-agent 15.0.0 → 15.0.1

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 (140) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/examples/extensions/plan-mode.ts +0 -1
  3. package/package.json +9 -9
  4. package/scripts/build-binary.ts +5 -0
  5. package/src/autoresearch/helpers.ts +17 -0
  6. package/src/autoresearch/tools/log-experiment.ts +9 -17
  7. package/src/autoresearch/tools/run-experiment.ts +2 -17
  8. package/src/capability/skill.ts +7 -0
  9. package/src/cli/list-models.ts +1 -1
  10. package/src/cli/shell-cli.ts +3 -13
  11. package/src/cli/update-cli.ts +1 -1
  12. package/src/cli.ts +10 -29
  13. package/src/commit/agentic/tools/propose-changelog.ts +8 -1
  14. package/src/commit/analysis/conventional.ts +8 -66
  15. package/src/commit/map-reduce/reduce-phase.ts +6 -65
  16. package/src/commit/pipeline.ts +2 -2
  17. package/src/commit/shared-llm.ts +89 -0
  18. package/src/config/config-file.ts +210 -0
  19. package/src/config/model-equivalence.ts +8 -11
  20. package/src/config/model-registry.ts +13 -2
  21. package/src/config/model-resolver.ts +1 -4
  22. package/src/config/settings-schema.ts +71 -1
  23. package/src/config/settings.ts +1 -1
  24. package/src/config.ts +3 -219
  25. package/src/edit/renderer.ts +7 -1
  26. package/src/eval/js/executor.ts +3 -0
  27. package/src/eval/js/shared/rewrite-imports.ts +2 -2
  28. package/src/eval/py/executor.ts +5 -0
  29. package/src/exa/factory.ts +2 -2
  30. package/src/exa/mcp-client.ts +74 -1
  31. package/src/exec/bash-executor.ts +5 -1
  32. package/src/export/html/template.generated.ts +1 -1
  33. package/src/export/html/template.js +0 -11
  34. package/src/extensibility/extensions/runner.ts +1 -1
  35. package/src/extensibility/extensions/types.ts +89 -223
  36. package/src/extensibility/hooks/types.ts +89 -314
  37. package/src/extensibility/shared-events.ts +343 -0
  38. package/src/extensibility/skills.ts +9 -0
  39. package/src/goals/index.ts +3 -0
  40. package/src/goals/runtime.ts +500 -0
  41. package/src/goals/state.ts +37 -0
  42. package/src/goals/tools/goal-tool.ts +237 -0
  43. package/src/hashline/anchors.ts +2 -2
  44. package/src/hindsight/mental-models.ts +1 -1
  45. package/src/internal-urls/agent-protocol.ts +1 -20
  46. package/src/internal-urls/artifact-protocol.ts +1 -19
  47. package/src/internal-urls/docs-index.generated.ts +5 -6
  48. package/src/internal-urls/registry-helpers.ts +25 -0
  49. package/src/main.ts +11 -2
  50. package/src/mcp/oauth-flow.ts +20 -0
  51. package/src/modes/acp/acp-agent.ts +79 -45
  52. package/src/modes/components/assistant-message.ts +14 -8
  53. package/src/modes/components/bash-execution.ts +24 -63
  54. package/src/modes/components/custom-message.ts +14 -40
  55. package/src/modes/components/eval-execution.ts +27 -57
  56. package/src/modes/components/execution-shared.ts +102 -0
  57. package/src/modes/components/hook-message.ts +17 -49
  58. package/src/modes/components/mcp-add-wizard.ts +26 -5
  59. package/src/modes/components/message-frame.ts +88 -0
  60. package/src/modes/components/model-selector.ts +1 -1
  61. package/src/modes/components/session-observer-overlay.ts +6 -2
  62. package/src/modes/components/session-selector.ts +1 -1
  63. package/src/modes/components/status-line/segments.ts +55 -4
  64. package/src/modes/components/status-line/types.ts +4 -0
  65. package/src/modes/components/status-line.ts +28 -10
  66. package/src/modes/components/tool-execution.ts +7 -8
  67. package/src/modes/controllers/command-controller-shared.ts +108 -0
  68. package/src/modes/controllers/command-controller.ts +13 -4
  69. package/src/modes/controllers/event-controller.ts +36 -7
  70. package/src/modes/controllers/input-controller.ts +13 -0
  71. package/src/modes/controllers/mcp-command-controller.ts +56 -61
  72. package/src/modes/controllers/ssh-command-controller.ts +18 -57
  73. package/src/modes/interactive-mode.ts +624 -52
  74. package/src/modes/print-mode.ts +16 -86
  75. package/src/modes/rpc/rpc-mode.ts +14 -87
  76. package/src/modes/runtime-init.ts +115 -0
  77. package/src/modes/theme/defaults/dark-poimandres.json +2 -0
  78. package/src/modes/theme/defaults/light-poimandres.json +2 -0
  79. package/src/modes/theme/theme.ts +18 -6
  80. package/src/modes/types.ts +14 -3
  81. package/src/modes/utils/context-usage.ts +13 -13
  82. package/src/modes/utils/ui-helpers.ts +10 -3
  83. package/src/plan-mode/approved-plan.ts +35 -1
  84. package/src/prompts/goals/goal-budget-limit.md +16 -0
  85. package/src/prompts/goals/goal-continuation.md +28 -0
  86. package/src/prompts/goals/goal-mode-active.md +23 -0
  87. package/src/prompts/system/plan-mode-active.md +5 -5
  88. package/src/prompts/system/plan-mode-tool-decision-reminder.md +1 -1
  89. package/src/prompts/tools/bash.md +6 -0
  90. package/src/prompts/tools/goal.md +13 -0
  91. package/src/prompts/tools/hashline.md +102 -114
  92. package/src/prompts/tools/read.md +1 -0
  93. package/src/prompts/tools/resolve.md +6 -5
  94. package/src/sdk.ts +12 -5
  95. package/src/session/agent-session.ts +428 -106
  96. package/src/session/blob-store.ts +36 -3
  97. package/src/session/messages.ts +67 -2
  98. package/src/session/session-manager.ts +131 -12
  99. package/src/session/session-storage.ts +33 -15
  100. package/src/session/streaming-output.ts +309 -13
  101. package/src/slash-commands/builtin-registry.ts +18 -0
  102. package/src/ssh/ssh-executor.ts +5 -0
  103. package/src/system-prompt.ts +4 -2
  104. package/src/task/executor.ts +17 -7
  105. package/src/task/index.ts +3 -0
  106. package/src/task/render.ts +21 -15
  107. package/src/task/types.ts +4 -0
  108. package/src/tools/ast-edit.ts +21 -120
  109. package/src/tools/ast-grep.ts +21 -119
  110. package/src/tools/bash-interactive.ts +9 -1
  111. package/src/tools/bash.ts +27 -4
  112. package/src/tools/browser/attach.ts +3 -3
  113. package/src/tools/browser/launch.ts +81 -18
  114. package/src/tools/browser/registry.ts +1 -5
  115. package/src/tools/browser/tab-supervisor.ts +51 -14
  116. package/src/tools/conflict-detect.ts +15 -4
  117. package/src/tools/eval.ts +3 -1
  118. package/src/tools/find.ts +20 -38
  119. package/src/tools/gh.ts +7 -6
  120. package/src/tools/index.ts +22 -11
  121. package/src/tools/inspect-image.ts +3 -10
  122. package/src/tools/output-meta.ts +176 -37
  123. package/src/tools/path-utils.ts +125 -2
  124. package/src/tools/read.ts +516 -233
  125. package/src/tools/render-utils.ts +92 -0
  126. package/src/tools/renderers.ts +2 -0
  127. package/src/tools/resolve.ts +72 -44
  128. package/src/tools/search.ts +120 -186
  129. package/src/tools/write.ts +44 -9
  130. package/src/utils/file-mentions.ts +1 -1
  131. package/src/utils/image-loading.ts +7 -3
  132. package/src/utils/image-resize.ts +32 -43
  133. package/src/vim/parser.ts +0 -17
  134. package/src/vim/render.ts +1 -1
  135. package/src/vim/types.ts +1 -1
  136. package/src/web/search/providers/gemini.ts +35 -95
  137. package/src/prompts/tools/exit-plan-mode.md +0 -6
  138. package/src/tools/exit-plan-mode.ts +0 -97
  139. package/src/utils/fuzzy.ts +0 -108
  140. package/src/utils/image-convert.ts +0 -27
@@ -3,18 +3,20 @@
3
3
  *
4
4
  * Handles /ssh subcommands for managing SSH host configurations.
5
5
  */
6
- import { Spacer, Text } from "@oh-my-pi/pi-tui";
7
6
  import { getProjectDir, getSSHConfigPath } from "@oh-my-pi/pi-utils";
8
7
  import { type SSHHost, sshCapability } from "../../capability/ssh";
9
8
  import { loadCapability } from "../../discovery";
10
9
  import { addSSHHost, readSSHConfigFile, removeSSHHost, type SSHHostConfig } from "../../ssh/config-writer";
11
- import { shortenPath } from "../../tools/render-utils";
12
- import { DynamicBorder } from "../components/dynamic-border";
13
10
  import { parseCommandArgs } from "../shared";
14
11
  import { theme } from "../theme/theme";
15
12
  import type { InteractiveModeContext } from "../types";
16
-
17
- type SSHAddScope = "user" | "project";
13
+ import {
14
+ groupBySource,
15
+ parseRemoveArgs,
16
+ readScopeFlag,
17
+ type ScopeValue,
18
+ showCommandMessage,
19
+ } from "./command-controller-shared";
18
20
 
19
21
  export class SSHCommandController {
20
22
  constructor(private ctx: InteractiveModeContext) {}
@@ -90,7 +92,7 @@ export class SSHCommandController {
90
92
  }
91
93
 
92
94
  let name: string | undefined;
93
- let scope: SSHAddScope = "project";
95
+ let scope: ScopeValue = "project";
94
96
  let host: string | undefined;
95
97
  let username: string | undefined;
96
98
  let port: number | undefined;
@@ -167,12 +169,12 @@ export class SSHCommandController {
167
169
  continue;
168
170
  }
169
171
  if (argToken === "--scope") {
170
- const value = tokens[i + 1];
171
- if (!value || (value !== "project" && value !== "user")) {
172
- this.ctx.showError("Invalid --scope value. Use project or user.");
172
+ const r = readScopeFlag(tokens[i + 1]);
173
+ if (!r.ok) {
174
+ this.ctx.showError(r.error);
173
175
  return;
174
176
  }
175
- scope = value;
177
+ scope = r.scope;
176
178
  i += 2;
177
179
  continue;
178
180
  }
@@ -300,23 +302,7 @@ export class SSHCommandController {
300
302
 
301
303
  // Show discovered hosts (from ssh.json, .ssh.json in project root, etc.)
302
304
  if (discoveredHosts.length > 0) {
303
- // Group by source
304
- const bySource = new Map<string, SSHHost[]>();
305
- for (const host of discoveredHosts) {
306
- const key = `${host._source.providerName}|${host._source.path}`;
307
- let group = bySource.get(key);
308
- if (!group) {
309
- group = [];
310
- bySource.set(key, group);
311
- }
312
- group.push(host);
313
- }
314
-
315
- for (const [key, hosts] of bySource) {
316
- const sepIdx = key.indexOf("|");
317
- const providerName = key.slice(0, sepIdx);
318
- const sourcePath = key.slice(sepIdx + 1);
319
- const shortPath = shortenPath(sourcePath);
305
+ for (const { providerName, shortPath, items: hosts } of groupBySource(discoveredHosts, h => h._source)) {
320
306
  lines.push(
321
307
  theme.fg("accent", "Discovered") +
322
308
  theme.fg("muted", ` (${providerName}: ${shortPath}):`) +
@@ -357,33 +343,12 @@ export class SSHCommandController {
357
343
  async #handleRemove(text: string): Promise<void> {
358
344
  const match = text.match(/^\/ssh\s+(?:remove|rm)\b\s*(.*)$/i);
359
345
  const rest = match?.[1]?.trim() ?? "";
360
- const tokens = parseCommandArgs(rest);
361
-
362
- let name: string | undefined;
363
- let scope: "project" | "user" = "project";
364
- let i = 0;
365
-
366
- if (tokens.length > 0 && !tokens[0].startsWith("-")) {
367
- name = tokens[0];
368
- i = 1;
369
- }
370
-
371
- while (i < tokens.length) {
372
- const token = tokens[i];
373
- if (token === "--scope") {
374
- const value = tokens[i + 1];
375
- if (!value || (value !== "project" && value !== "user")) {
376
- this.ctx.showError("Invalid --scope value. Use project or user.");
377
- return;
378
- }
379
- scope = value;
380
- i += 2;
381
- continue;
382
- }
383
- this.ctx.showError(`Unknown option: ${token}`);
346
+ const parsed = parseRemoveArgs(rest);
347
+ if (!parsed.ok) {
348
+ this.ctx.showError(parsed.error);
384
349
  return;
385
350
  }
386
-
351
+ const { name, scope } = parsed.value;
387
352
  if (!name) {
388
353
  this.ctx.showError("Host name required. Usage: /ssh remove <name> [--scope project|user]");
389
354
  return;
@@ -412,10 +377,6 @@ export class SSHCommandController {
412
377
  * Show a message in the chat
413
378
  */
414
379
  #showMessage(text: string): void {
415
- this.ctx.chatContainer.addChild(new Spacer(1));
416
- this.ctx.chatContainer.addChild(new DynamicBorder());
417
- this.ctx.chatContainer.addChild(new Text(text, 1, 1));
418
- this.ctx.chatContainer.addChild(new DynamicBorder());
419
- this.ctx.ui.requestRender();
380
+ showCommandMessage(this.ctx, text);
420
381
  }
421
382
  }