@oh-my-pi/pi-coding-agent 16.3.0 → 16.3.3

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 (163) hide show
  1. package/CHANGELOG.md +91 -0
  2. package/dist/cli.js +3855 -3798
  3. package/dist/types/cli/update-cli.d.ts +1 -0
  4. package/dist/types/cli/update-cli.test.d.ts +1 -0
  5. package/dist/types/commands/update.d.ts +5 -0
  6. package/dist/types/config/config-file.d.ts +1 -1
  7. package/dist/types/config/settings-schema.d.ts +20 -0
  8. package/dist/types/dap/client.d.ts +9 -1
  9. package/dist/types/discovery/helpers.d.ts +2 -0
  10. package/dist/types/edit/file-snapshot-store.d.ts +9 -1
  11. package/dist/types/edit/hashline/execute.d.ts +1 -1
  12. package/dist/types/edit/hashline/params.d.ts +3 -6
  13. package/dist/types/edit/renderer.d.ts +1 -0
  14. package/dist/types/extensibility/plugins/parser.d.ts +2 -1
  15. package/dist/types/hindsight/client.d.ts +15 -11
  16. package/dist/types/hindsight/client.test.d.ts +1 -0
  17. package/dist/types/irc/bus.d.ts +5 -4
  18. package/dist/types/mcp/smithery-registry.d.ts +1 -0
  19. package/dist/types/mcp/smithery-registry.test.d.ts +1 -0
  20. package/dist/types/modes/components/advisor-message.d.ts +4 -2
  21. package/dist/types/modes/components/tool-execution.d.ts +9 -6
  22. package/dist/types/modes/components/transcript-container.d.ts +1 -0
  23. package/dist/types/modes/theme/theme.d.ts +1 -1
  24. package/dist/types/session/agent-session.d.ts +13 -13
  25. package/dist/types/session/indexed-session-storage.d.ts +2 -2
  26. package/dist/types/session/session-storage.d.ts +31 -3
  27. package/dist/types/ssh/__tests__/connection-manager-timeout.test.d.ts +1 -0
  28. package/dist/types/ssh/__tests__/sshfs-mount.test.d.ts +1 -0
  29. package/dist/types/ssh/connection-manager.d.ts +19 -0
  30. package/dist/types/ssh/sshfs-mount.d.ts +10 -1
  31. package/dist/types/subprocess/worker-client.d.ts +20 -6
  32. package/dist/types/task/discovery.d.ts +5 -2
  33. package/dist/types/task/renderer.d.ts +1 -0
  34. package/dist/types/tools/ast-grep.d.ts +4 -2
  35. package/dist/types/tools/bash.d.ts +27 -0
  36. package/dist/types/tools/browser/render.d.ts +2 -0
  37. package/dist/types/tools/debug.d.ts +1 -0
  38. package/dist/types/tools/eval-render.d.ts +2 -0
  39. package/dist/types/tools/glob.d.ts +4 -2
  40. package/dist/types/tools/grep.d.ts +4 -3
  41. package/dist/types/tools/path-utils.d.ts +7 -0
  42. package/dist/types/tools/renderers.d.ts +24 -0
  43. package/dist/types/tools/ssh.d.ts +4 -1
  44. package/dist/types/tts/index.d.ts +2 -0
  45. package/dist/types/tts/speakable.d.ts +47 -0
  46. package/dist/types/tts/speech-enhancer.d.ts +46 -0
  47. package/dist/types/tts/streaming-player.d.ts +1 -2
  48. package/dist/types/tts/tts-client.d.ts +11 -10
  49. package/dist/types/tts/tts-protocol.d.ts +7 -0
  50. package/dist/types/tts/vocalizer.d.ts +15 -8
  51. package/dist/types/utils/fetch-timeout.d.ts +4 -0
  52. package/dist/types/utils/git.d.ts +2 -0
  53. package/dist/types/web/search/providers/base.d.ts +1 -0
  54. package/dist/types/web/search/providers/gemini.d.ts +1 -0
  55. package/package.json +12 -12
  56. package/scripts/generate-legacy-pi-bundled-registry.ts +8 -2
  57. package/src/advisor/__tests__/advisor.test.ts +1 -1
  58. package/src/cli/gallery-fixtures/fs.ts +2 -2
  59. package/src/cli/gallery-fixtures/search.ts +2 -2
  60. package/src/cli/models-cli.ts +19 -0
  61. package/src/cli/update-cli.test.ts +28 -0
  62. package/src/cli/update-cli.ts +35 -8
  63. package/src/cli.ts +27 -5
  64. package/src/commands/update.ts +8 -2
  65. package/src/config/config-file.ts +6 -6
  66. package/src/config/model-resolver.ts +31 -10
  67. package/src/config/settings-schema.ts +21 -0
  68. package/src/cursor.ts +1 -1
  69. package/src/dap/client.ts +134 -36
  70. package/src/discovery/helpers.ts +8 -0
  71. package/src/edit/file-snapshot-store.ts +12 -1
  72. package/src/edit/hashline/diff.ts +4 -13
  73. package/src/edit/hashline/execute.ts +1 -1
  74. package/src/edit/hashline/params.ts +5 -12
  75. package/src/edit/renderer.ts +4 -2
  76. package/src/edit/streaming.ts +15 -5
  77. package/src/export/html/tool-views.generated.js +34 -34
  78. package/src/extensibility/custom-tools/loader.ts +3 -3
  79. package/src/extensibility/extensions/loader.ts +10 -3
  80. package/src/extensibility/legacy-pi-coding-agent-shim.ts +2 -2
  81. package/src/extensibility/plugins/installer.ts +12 -3
  82. package/src/extensibility/plugins/legacy-pi-compat.ts +87 -11
  83. package/src/extensibility/plugins/loader.ts +30 -1
  84. package/src/extensibility/plugins/manager.ts +32 -8
  85. package/src/extensibility/plugins/parser.ts +7 -5
  86. package/src/extensibility/tool-event-input.ts +1 -1
  87. package/src/hindsight/client.test.ts +33 -0
  88. package/src/hindsight/client.ts +42 -22
  89. package/src/internal-urls/docs-index.generated.txt +1 -1
  90. package/src/irc/bus.ts +5 -4
  91. package/src/main.ts +7 -1
  92. package/src/mcp/oauth-flow.ts +93 -4
  93. package/src/mcp/smithery-auth.ts +3 -0
  94. package/src/mcp/smithery-connect.ts +9 -0
  95. package/src/mcp/smithery-registry.test.ts +51 -0
  96. package/src/mcp/smithery-registry.ts +27 -4
  97. package/src/modes/components/__tests__/move-overlay.test.ts +72 -1
  98. package/src/modes/components/advisor-message.ts +13 -10
  99. package/src/modes/components/assistant-message.ts +1 -1
  100. package/src/modes/components/move-overlay.ts +35 -23
  101. package/src/modes/components/status-line/component.ts +11 -4
  102. package/src/modes/components/tool-execution.ts +119 -20
  103. package/src/modes/components/transcript-container.ts +26 -0
  104. package/src/modes/components/tree-selector.ts +10 -3
  105. package/src/modes/controllers/event-controller.ts +23 -3
  106. package/src/modes/controllers/tool-args-reveal.ts +1 -1
  107. package/src/modes/interactive-mode.ts +1 -0
  108. package/src/modes/rpc/rpc-client.ts +29 -16
  109. package/src/modes/theme/shimmer.ts +49 -15
  110. package/src/modes/theme/theme.ts +7 -0
  111. package/src/prompts/goals/goal-mode-context.md +4 -0
  112. package/src/prompts/goals/goal-todo-context.md +10 -2
  113. package/src/prompts/system/speech-rewrite.md +15 -0
  114. package/src/prompts/system/tiny-title-system.md +1 -1
  115. package/src/prompts/system/title-system-marker.md +2 -1
  116. package/src/prompts/system/title-system.md +2 -1
  117. package/src/prompts/tools/ast-grep.md +3 -3
  118. package/src/prompts/tools/glob.md +1 -1
  119. package/src/prompts/tools/grep.md +1 -1
  120. package/src/sdk.ts +8 -5
  121. package/src/session/agent-session.ts +329 -79
  122. package/src/session/indexed-session-storage.ts +40 -3
  123. package/src/session/session-history-format.ts +6 -2
  124. package/src/session/session-manager.ts +83 -14
  125. package/src/session/session-storage.ts +112 -26
  126. package/src/slash-commands/helpers/usage-report.ts +6 -1
  127. package/src/ssh/__tests__/connection-manager-timeout.test.ts +61 -0
  128. package/src/ssh/__tests__/sshfs-mount.test.ts +13 -0
  129. package/src/ssh/connection-manager.ts +44 -11
  130. package/src/ssh/sshfs-mount.ts +27 -4
  131. package/src/subprocess/worker-client.ts +161 -10
  132. package/src/task/discovery.ts +25 -2
  133. package/src/task/executor.ts +24 -4
  134. package/src/task/render.ts +26 -12
  135. package/src/task/renderer.ts +1 -0
  136. package/src/task/worktree.ts +144 -16
  137. package/src/tiny/text.ts +109 -17
  138. package/src/tools/ast-grep.ts +20 -17
  139. package/src/tools/bash.ts +46 -9
  140. package/src/tools/browser/render.ts +2 -0
  141. package/src/tools/debug.ts +1 -0
  142. package/src/tools/eval-render.ts +5 -2
  143. package/src/tools/gh-renderer.ts +3 -0
  144. package/src/tools/glob.ts +24 -20
  145. package/src/tools/grep.ts +39 -37
  146. package/src/tools/path-utils.ts +55 -10
  147. package/src/tools/read.ts +23 -6
  148. package/src/tools/renderers.ts +24 -0
  149. package/src/tools/ssh.ts +25 -7
  150. package/src/tts/index.ts +2 -0
  151. package/src/tts/speakable.ts +382 -0
  152. package/src/tts/speech-enhancer.ts +204 -0
  153. package/src/tts/streaming-player.ts +71 -16
  154. package/src/tts/tts-client.ts +11 -10
  155. package/src/tts/tts-protocol.ts +14 -5
  156. package/src/tts/tts-worker.ts +52 -49
  157. package/src/tts/vocalizer.ts +277 -46
  158. package/src/utils/clipboard.ts +49 -12
  159. package/src/utils/fetch-timeout.ts +10 -0
  160. package/src/utils/git.ts +8 -0
  161. package/src/web/search/index.ts +8 -0
  162. package/src/web/search/providers/base.ts +1 -0
  163. package/src/web/search/providers/gemini.ts +23 -6
@@ -180,8 +180,7 @@ function resolvePreviewEdits(args: {
180
180
  }): readonly Edit[] {
181
181
  const { section, absolutePath, normalized, snapshots, expected, liveMatches, edits } = args;
182
182
  if (!hasBlockEdit(edits)) return edits;
183
- const baseText =
184
- expected === undefined || liveMatches ? normalized : snapshots.byHashExact(absolutePath, expected)?.text;
183
+ const baseText = expected === undefined || liveMatches ? normalized : snapshots.byHash(absolutePath, expected)?.text;
185
184
  if (baseText === undefined) {
186
185
  throw createMismatchError(section, absolutePath, normalized, snapshots, expected ?? "");
187
186
  }
@@ -200,17 +199,9 @@ function applyPreviewEdits(args: {
200
199
  if (!options.skipHashValidation && expected === undefined) {
201
200
  throw new Error(missingSnapshotTagMessage(section.path));
202
201
  }
203
- // A 16-bit tag can collide across two different file states, so hash
204
- // equality alone does not prove the live text IS the snapshot the model's
205
- // anchors were minted against (mirrors Patcher's apply-time guard). When
206
- // the store retains text for the tag, require it to be unambiguous and
207
- // byte-identical to live; otherwise fall through to recovery/reject below
208
- // exactly as if the hash had not matched.
209
- const liveMatches =
210
- expected !== undefined &&
211
- computeFileHash(normalized) === expected &&
212
- (snapshots.byHash(absolutePath, expected) === null ||
213
- snapshots.byHashExact(absolutePath, expected)?.text === normalized);
202
+ // The 4-hex tag is content-derived: when the live text hashes to it, trust
203
+ // the match and preview directly (mirrors Patcher's apply-time behavior).
204
+ const liveMatches = expected !== undefined && computeFileHash(normalized) === expected;
214
205
  const edits = parsePreviewEdits(section, options.streaming);
215
206
  const resolved = resolvePreviewEdits({ section, absolutePath, normalized, snapshots, expected, liveMatches, edits });
216
207
  if (options.skipHashValidation || expected === undefined || liveMatches) return applyEdits(normalized, resolved);
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Coding-agent runner that drives the hashline {@link Patcher} on behalf of
3
- * the `edit` tool. Converts a `{input}` tool-call payload into a
3
+ * the `edit` tool. Converts an `{input}` tool-call payload into a
4
4
  * fully-applied patch, wraps the result in the agent's
5
5
  * {@link AgentToolResult} shape, and attaches LSP diagnostics + `outputMeta`
6
6
  * for the renderer.
@@ -1,19 +1,12 @@
1
1
  /**
2
2
  * Arktype schema for the `edit` tool's hashline mode payload. The schema is
3
3
  * deliberately permissive (allows extra keys) so providers can attach extra
4
- * keys without rejection; only `input` is required. `_input` is accepted as a
5
- * provider-emitted alias for `input`.
4
+ * keys without rejection; only `input` is required.
6
5
  */
7
6
  import { type } from "arktype";
8
7
 
9
- const requiredInputSchema = type({ input: "string" });
10
- const inputAliasSchema = type({ "input?": "string", "_input?": "string" });
8
+ export const hashlineEditParamsSchema = type({
9
+ input: "string",
10
+ });
11
11
 
12
- export const hashlineEditParamsSchema = inputAliasSchema
13
- .pipe(raw => {
14
- if (raw.input !== undefined || raw._input === undefined) return raw;
15
- return { ...raw, input: raw._input };
16
- })
17
- .pipe(requiredInputSchema);
18
-
19
- export type HashlineParams = Parameters<typeof hashlineEditParamsSchema.assert>[0];
12
+ export type HashlineParams = typeof hashlineEditParamsSchema.infer;
@@ -114,6 +114,7 @@ interface EditRenderArgs {
114
114
  newText?: string;
115
115
  patch?: string;
116
116
  input?: string;
117
+ _input?: string;
117
118
  all?: boolean;
118
119
  // Patch mode fields
119
120
  op?: Operation;
@@ -600,10 +601,11 @@ function getHashlineInputRenderSummary(
600
601
  args: EditRenderArgs,
601
602
  editMode: EditMode | undefined,
602
603
  ): HashlineInputRenderSummary | undefined {
603
- if (editMode !== "hashline" || typeof args.input !== "string") {
604
+ const input = args.input ?? args._input;
605
+ if (editMode !== "hashline" || typeof input !== "string") {
604
606
  return undefined;
605
607
  }
606
- return { entries: getHashlineInputSections(args.input) };
608
+ return { entries: getHashlineInputSections(input) };
607
609
  }
608
610
 
609
611
  function getApplyPatchRenderSummary(
@@ -429,9 +429,19 @@ const patchStrategy: EditStreamingStrategy<PatchArgs> = {
429
429
 
430
430
  interface HashlineArgs {
431
431
  input?: string;
432
+ _input?: string;
432
433
  __partialJson?: string;
433
434
  }
434
435
 
436
+ /**
437
+ * Text payload of a hashline edit call. The public schema declares `input`, but
438
+ * streaming sees the raw model output before validation coerces aliases, so a
439
+ * provider that emits the legacy `_input` key still previews correctly.
440
+ */
441
+ function hashlineEditText(args: HashlineArgs | undefined): string | undefined {
442
+ return args?.input ?? args?._input;
443
+ }
444
+
435
445
  /**
436
446
  * While streaming a free-form text payload (apply_patch envelope, hashline
437
447
  * input), trim the trailing partial line so per-character growth of an
@@ -513,7 +523,8 @@ const hashlineStrategy: EditStreamingStrategy<HashlineArgs> = {
513
523
  return args;
514
524
  },
515
525
  async computeDiffPreview(args, ctx) {
516
- if (typeof args.input !== "string" || args.input.length === 0) return null;
526
+ const input = hashlineEditText(args);
527
+ if (typeof input !== "string" || input.length === 0) return null;
517
528
  // Unlike apply_patch, hashline previews flow through `applyPartialTo`,
518
529
  // whose streaming-tolerant parser (`parsePatchStreaming` → `endStreaming`)
519
530
  // drops a payload-less trailing op and projects a partially-typed payload
@@ -521,7 +532,6 @@ const hashlineStrategy: EditStreamingStrategy<HashlineArgs> = {
521
532
  // would instead strip the sole payload of a single-op `replace`/`insert`
522
533
  // for almost the entire stream, collapsing the preview to "No changes" and
523
534
  // rendering a blank box. Feed the raw in-flight text straight through.
524
- const input = args.input;
525
535
  ctx.signal.throwIfAborted();
526
536
 
527
537
  let sections: readonly HashlineInputSection[];
@@ -579,19 +589,19 @@ const hashlineStrategy: EditStreamingStrategy<HashlineArgs> = {
579
589
  return "";
580
590
  },
581
591
  matcherDigest(args) {
582
- const input = args?.input;
592
+ const input = hashlineEditText(args);
583
593
  if (typeof input !== "string") return undefined;
584
594
  // Body rows are `+TEXT`; headers and op lines are grammar, never content.
585
595
  return extractAddedLines(input, false);
586
596
  },
587
597
  matcherPaths(args) {
588
- const input = args?.input;
598
+ const input = hashlineEditText(args);
589
599
  if (typeof input !== "string" || input.length === 0) return undefined;
590
600
  const paths = extractHashlineHeaderPaths(input);
591
601
  return paths.length > 0 ? paths : undefined;
592
602
  },
593
603
  matcherEntries(args) {
594
- const input = args?.input;
604
+ const input = hashlineEditText(args);
595
605
  if (typeof input !== "string" || input.length === 0) return undefined;
596
606
  const entries = splitHashlinePerFile(input);
597
607
  return entries.length > 0 ? entries : undefined;