@oh-my-pi/pi-coding-agent 17.2.13 → 17.2.15

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 (239) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/{CHANGELOG-d8xh7keh.md → CHANGELOG-fk29zh06.md} +30 -0
  3. package/dist/cli.js +5114 -5417
  4. package/dist/types/cleanse/agent.d.ts +3 -0
  5. package/dist/types/cleanse/checkers.d.ts +21 -1
  6. package/dist/types/cleanse/index.d.ts +4 -0
  7. package/dist/types/cleanse/parsers.d.ts +3 -1
  8. package/dist/types/cli/args.d.ts +1 -0
  9. package/dist/types/cli/cleanse-picker.d.ts +17 -0
  10. package/dist/types/cli/command-help.d.ts +3 -0
  11. package/dist/types/cli/progress-reporter.d.ts +19 -0
  12. package/dist/types/commands/cleanse.d.ts +11 -0
  13. package/dist/types/commands/compress.d.ts +37 -0
  14. package/dist/types/commands/launch-help.d.ts +3 -0
  15. package/dist/types/commands/launch.d.ts +3 -0
  16. package/dist/types/compress/index.d.ts +27 -0
  17. package/dist/types/compress/protocol.d.ts +49 -0
  18. package/dist/types/compress/session.d.ts +15 -0
  19. package/dist/types/compress/types.d.ts +54 -0
  20. package/dist/types/config/settings-schema.d.ts +10 -0
  21. package/dist/types/internal-urls/local-protocol.d.ts +8 -0
  22. package/dist/types/mcp/transports/header-policy.d.ts +8 -0
  23. package/dist/types/mcp/transports/http.d.ts +2 -0
  24. package/dist/types/mcp/types.d.ts +19 -0
  25. package/dist/types/modes/components/late-diagnostics-message.d.ts +2 -0
  26. package/dist/types/modes/components/todo-reminder.d.ts +2 -0
  27. package/dist/types/modes/components/tool-activity.d.ts +17 -0
  28. package/dist/types/modes/components/transcript-container.d.ts +2 -0
  29. package/dist/types/modes/components/ttsr-notification.d.ts +2 -0
  30. package/dist/types/modes/interactive-mode.d.ts +3 -1
  31. package/dist/types/modes/types.d.ts +3 -1
  32. package/dist/types/modes/utils/transcript-render-helpers.d.ts +2 -1
  33. package/dist/types/modes/utils/ui-helpers.d.ts +3 -1
  34. package/dist/types/session/agent-session-types.d.ts +2 -0
  35. package/dist/types/session/agent-session.d.ts +2 -0
  36. package/dist/types/session/session-tools.d.ts +13 -0
  37. package/dist/types/tools/builtin-names.d.ts +1 -2
  38. package/dist/types/tools/index.d.ts +1 -0
  39. package/dist/types/tools/think.d.ts +41 -0
  40. package/dist/types/utils/zip.d.ts +19 -9
  41. package/package.json +13 -13
  42. package/src/cleanse/agent.ts +67 -2
  43. package/src/cleanse/checkers.ts +252 -21
  44. package/src/cleanse/index.ts +90 -36
  45. package/src/cleanse/parsers.ts +243 -20
  46. package/src/cleanse/prompts/discovery.md +74 -0
  47. package/src/cli/args.ts +3 -0
  48. package/src/cli/cleanse-picker.ts +86 -0
  49. package/src/cli/command-help.ts +4 -0
  50. package/src/cli/flag-tables.ts +1 -0
  51. package/src/cli/gallery-fixtures/agentic.ts +16 -0
  52. package/src/{cleanse/progress.ts → cli/progress-reporter.ts} +12 -7
  53. package/src/cli-commands.ts +5 -0
  54. package/src/commands/cleanse.ts +19 -4
  55. package/src/commands/compress.ts +45 -0
  56. package/src/commands/launch-help.ts +3 -0
  57. package/src/commit/agentic/prompts/analyze-file.md +6 -6
  58. package/src/commit/agentic/prompts/session-user.md +4 -4
  59. package/src/compress/index.ts +318 -0
  60. package/src/compress/prompts/request.md +11 -0
  61. package/src/compress/prompts/review.md +17 -0
  62. package/src/compress/prompts/system.md +81 -0
  63. package/src/compress/protocol.ts +210 -0
  64. package/src/compress/session.ts +72 -0
  65. package/src/compress/types.ts +59 -0
  66. package/src/config/settings-schema.ts +11 -0
  67. package/src/discovery/builtin-rules/go-add-cleanup.md +8 -8
  68. package/src/discovery/builtin-rules/go-exp-promoted.md +8 -8
  69. package/src/discovery/builtin-rules/go-ioutil.md +12 -12
  70. package/src/discovery/builtin-rules/go-new-expr.md +8 -8
  71. package/src/discovery/builtin-rules/go-range-int.md +5 -5
  72. package/src/discovery/builtin-rules/rs-box-leak.md +7 -7
  73. package/src/discovery/builtin-rules/rs-future-prelude.md +4 -4
  74. package/src/discovery/builtin-rules/rs-parking-lot.md +6 -6
  75. package/src/discovery/builtin-rules/ts-no-any.md +5 -5
  76. package/src/discovery/builtin-rules/ts-no-deprecated-leftovers.md +8 -8
  77. package/src/discovery/builtin-rules/ts-no-inline-cast-access.md +13 -14
  78. package/src/discovery/builtin-rules/ts-no-local-is-record.md +7 -7
  79. package/src/discovery/builtin-rules/ts-no-test-timers.md +3 -9
  80. package/src/discovery/builtin-rules/ts-no-tiny-functions.md +7 -7
  81. package/src/discovery/builtin-rules/ts-promise-with-resolvers.md +2 -2
  82. package/src/discovery/builtin-rules/ts-redundant-clear-guard.md +3 -9
  83. package/src/discovery/builtin-rules/ts-set-map.md +2 -4
  84. package/src/internal-urls/local-protocol.ts +42 -0
  85. package/src/live/prompts/live-instructions.md +10 -10
  86. package/src/main.ts +4 -0
  87. package/src/mcp/client.ts +7 -3
  88. package/src/mcp/transports/header-policy.ts +28 -0
  89. package/src/mcp/transports/http.ts +200 -35
  90. package/src/mcp/types.ts +21 -0
  91. package/src/modes/components/chat-transcript-builder.ts +17 -5
  92. package/src/modes/components/late-diagnostics-message.ts +12 -1
  93. package/src/modes/components/todo-reminder.ts +12 -0
  94. package/src/modes/components/tool-activity.ts +45 -0
  95. package/src/modes/components/transcript-container.ts +16 -0
  96. package/src/modes/components/ttsr-notification.ts +12 -0
  97. package/src/modes/controllers/event-controller.ts +3 -6
  98. package/src/modes/controllers/input-controller.ts +6 -6
  99. package/src/modes/controllers/selector-controller.ts +8 -6
  100. package/src/modes/interactive-mode.ts +5 -40
  101. package/src/modes/print-mode.ts +13 -54
  102. package/src/modes/types.ts +1 -1
  103. package/src/modes/utils/transcript-render-helpers.ts +3 -2
  104. package/src/modes/utils/ui-helpers.ts +17 -7
  105. package/src/prompts/advisor/active-repo-watchdog.md +3 -4
  106. package/src/prompts/advisor/advise-tool.md +3 -3
  107. package/src/prompts/advisor/context-files.md +1 -1
  108. package/src/prompts/advisor/system.md +45 -65
  109. package/src/prompts/agents/designer.md +44 -44
  110. package/src/prompts/agents/init.md +18 -18
  111. package/src/prompts/agents/librarian.md +31 -31
  112. package/src/prompts/agents/reviewer.md +34 -39
  113. package/src/prompts/agents/security-reviewer.md +3 -5
  114. package/src/prompts/agents/task.md +11 -12
  115. package/src/prompts/bench.md +2 -5
  116. package/src/prompts/ci-green-request.md +13 -15
  117. package/src/prompts/dry-balance-bench.md +5 -5
  118. package/src/prompts/goals/goal-budget-limit.md +4 -5
  119. package/src/prompts/goals/goal-continuation.md +11 -11
  120. package/src/prompts/goals/goal-mode-active.md +7 -7
  121. package/src/prompts/goals/goal-todo-context.md +2 -2
  122. package/src/prompts/goals/guided-goal-interview.md +18 -24
  123. package/src/prompts/memories/read-path.md +9 -9
  124. package/src/prompts/memories/stage_one_system.md +9 -11
  125. package/src/prompts/review-custom-request.md +8 -11
  126. package/src/prompts/review-headless-request.md +3 -10
  127. package/src/prompts/security/scan-coordinator.md +6 -5
  128. package/src/prompts/security/validate-request.md +4 -7
  129. package/src/prompts/skills/user-invocation.md +2 -2
  130. package/src/prompts/steering/parent-irc.md +1 -1
  131. package/src/prompts/steering/user-interjection.md +1 -3
  132. package/src/prompts/system/active-repo-context.md +4 -2
  133. package/src/prompts/system/agent-creation-architect.md +22 -37
  134. package/src/prompts/system/agent-creation-user.md +3 -3
  135. package/src/prompts/system/auto-continue.md +1 -1
  136. package/src/prompts/system/auto-thinking-difficulty-local.md +5 -7
  137. package/src/prompts/system/auto-thinking-difficulty.md +8 -10
  138. package/src/prompts/system/autolearn-guidance-learn.md +2 -1
  139. package/src/prompts/system/autolearn-guidance.md +5 -4
  140. package/src/prompts/system/autolearn-nudge-autocontinue.md +3 -3
  141. package/src/prompts/system/background-tan-dispatch.md +3 -3
  142. package/src/prompts/system/btw-user.md +2 -2
  143. package/src/prompts/system/commit-message-system.md +8 -6
  144. package/src/prompts/system/eager-task.md +3 -3
  145. package/src/prompts/system/empty-stop-retry.md +1 -1
  146. package/src/prompts/system/gemini-tool-call-reminder.md +5 -5
  147. package/src/prompts/system/interrupted-thinking.md +3 -3
  148. package/src/prompts/system/irc-autoreply.md +1 -1
  149. package/src/prompts/system/irc-incoming.md +3 -3
  150. package/src/prompts/system/manual-continue.md +3 -3
  151. package/src/prompts/system/mcp-xdev-guidance.md +2 -2
  152. package/src/prompts/system/memory-consolidation-system.md +2 -2
  153. package/src/prompts/system/mid-run-todo-nudge.md +1 -1
  154. package/src/prompts/system/orchestrate-notice.md +25 -25
  155. package/src/prompts/system/personalities/default.md +9 -9
  156. package/src/prompts/system/personalities/friendly.md +11 -11
  157. package/src/prompts/system/personalities/pragmatic.md +8 -8
  158. package/src/prompts/system/plan-mode-active.md +61 -64
  159. package/src/prompts/system/plan-mode-approved.md +10 -11
  160. package/src/prompts/system/plan-mode-compact-instructions.md +11 -11
  161. package/src/prompts/system/plan-mode-reference.md +5 -5
  162. package/src/prompts/system/plan-yolo-handoff.md +2 -2
  163. package/src/prompts/system/prewalk-checklist.md +5 -5
  164. package/src/prompts/system/prewalk-continue.md +1 -1
  165. package/src/prompts/system/prewalk-plan.md +8 -9
  166. package/src/prompts/system/project-prompt.md +11 -12
  167. package/src/prompts/system/recap-user.md +1 -1
  168. package/src/prompts/system/resolve-device-reminder.md +1 -1
  169. package/src/prompts/system/rewind-report.md +3 -3
  170. package/src/prompts/system/side-channel-no-tools.md +3 -1
  171. package/src/prompts/system/snapcompact-context-stub.md +1 -1
  172. package/src/prompts/system/snapcompact-system-frames-note.md +1 -1
  173. package/src/prompts/system/snapcompact-system-stub.md +1 -1
  174. package/src/prompts/system/snapcompact-toolresult-note.md +1 -1
  175. package/src/prompts/system/speech-rewrite.md +11 -13
  176. package/src/prompts/system/subagent-async-pending.md +5 -5
  177. package/src/prompts/system/subagent-system-prompt.md +5 -15
  178. package/src/prompts/system/subagent-user-prompt.md +1 -1
  179. package/src/prompts/system/subagent-yield-reminder.md +12 -12
  180. package/src/prompts/system/system-prompt.md +110 -136
  181. package/src/prompts/system/tan-context-switch.md +8 -14
  182. package/src/prompts/system/task-label.md +3 -3
  183. package/src/prompts/system/thinking-loop-redirect.md +6 -6
  184. package/src/prompts/system/title-marker-instruction.md +2 -1
  185. package/src/prompts/system/title-system.md +3 -5
  186. package/src/prompts/system/ttsr-interrupt.md +3 -3
  187. package/src/prompts/system/ttsr-tool-reminder.md +1 -1
  188. package/src/prompts/system/ultrathink-notice.md +1 -1
  189. package/src/prompts/system/unexpected-stop-classifier.md +3 -3
  190. package/src/prompts/system/vibe-mode-active.md +15 -15
  191. package/src/prompts/system/web-search.md +16 -16
  192. package/src/prompts/system/workflow-notice.md +35 -33
  193. package/src/prompts/system/xdev-mount-notice.md +4 -4
  194. package/src/prompts/tools/apply-patch.md +22 -23
  195. package/src/prompts/tools/approve.md +5 -0
  196. package/src/prompts/tools/ask.md +10 -10
  197. package/src/prompts/tools/checkpoint.md +7 -7
  198. package/src/prompts/tools/computer.md +16 -16
  199. package/src/prompts/tools/github.md +12 -12
  200. package/src/prompts/tools/goal.md +8 -9
  201. package/src/prompts/tools/grep.md +5 -5
  202. package/src/prompts/tools/image-attachment-describe-system.md +6 -6
  203. package/src/prompts/tools/image-attachment-describe.md +3 -8
  204. package/src/prompts/tools/image-gen.md +4 -4
  205. package/src/prompts/tools/inspect-image-system.md +10 -10
  206. package/src/prompts/tools/inspect-image.md +10 -13
  207. package/src/prompts/tools/learn.md +4 -4
  208. package/src/prompts/tools/manage-skill.md +9 -6
  209. package/src/prompts/tools/memory-edit.md +8 -8
  210. package/src/prompts/tools/recall.md +4 -4
  211. package/src/prompts/tools/reflect.md +2 -2
  212. package/src/prompts/tools/replace.md +13 -11
  213. package/src/prompts/tools/retain.md +3 -4
  214. package/src/prompts/tools/rewind.md +7 -8
  215. package/src/prompts/tools/rewrite.md +12 -0
  216. package/src/prompts/tools/security-publish.md +5 -1
  217. package/src/prompts/tools/security-scan.md +10 -1
  218. package/src/prompts/tools/task-async-contract.md +7 -1
  219. package/src/prompts/tools/todo.md +27 -25
  220. package/src/prompts/tools/vibe-kill.md +2 -2
  221. package/src/prompts/tools/vibe-list.md +2 -2
  222. package/src/prompts/tools/vibe-send.md +6 -7
  223. package/src/prompts/tools/vibe-spawn.md +8 -6
  224. package/src/prompts/tools/web-search.md +5 -5
  225. package/src/sdk.ts +10 -1
  226. package/src/session/agent-session-types.ts +2 -0
  227. package/src/session/agent-session.ts +28 -0
  228. package/src/session/session-handoff.ts +21 -0
  229. package/src/session/session-tools.ts +47 -0
  230. package/src/tools/builtin-names.ts +1 -2
  231. package/src/tools/index.ts +10 -0
  232. package/src/tools/read-format.ts +8 -3
  233. package/src/tools/read.ts +18 -7
  234. package/src/tools/renderers.ts +2 -0
  235. package/src/tools/think.ts +84 -0
  236. package/src/tools/write.ts +1 -1
  237. package/src/utils/file-mentions.ts +8 -2
  238. package/src/utils/zip.ts +858 -94
  239. package/dist/types/cleanse/progress.d.ts +0 -14
@@ -1,3 +1,4 @@
1
+ import type { CustomCleanseCheckerSpec } from "./checkers.js";
1
2
  import type { CleanseAgentOutcome, CleanseAssignment, CleanseDiagnosticReport, CleanseLoopResult } from "./types.js";
2
3
  /** Hooks used by the standalone command to render subagent lifecycle progress. */
3
4
  export interface CleanseAgentHooks {
@@ -8,6 +9,8 @@ export interface CleanseAgentHooks {
8
9
  export interface CleanseAgentRuntime {
9
10
  readonly model: string;
10
11
  readonly sessionFile: string;
12
+ /** Run one discovery subagent that translates a user request into runnable checker specs. */
13
+ discoverCheckers(request: string, signal?: AbortSignal): Promise<CustomCleanseCheckerSpec[]>;
11
14
  dispatch(assignments: CleanseAssignment[], wave: number, report: CleanseDiagnosticReport, signal?: AbortSignal): Promise<CleanseAgentOutcome[]>;
12
15
  close(result?: CleanseLoopResult): Promise<void>;
13
16
  }
@@ -3,11 +3,31 @@ import type { CleanseDiagnosticReport, SkippedCleanseCheck } from "./types.js";
3
3
  export interface CleanseDiagnosticSuiteOptions {
4
4
  includeTests?: boolean;
5
5
  }
6
+ /** Identity and display metadata for one runnable checker. */
7
+ export interface CleanseCheckerDescriptor {
8
+ id: string;
9
+ label: string;
10
+ language: string;
11
+ command: string;
12
+ }
6
13
  /** Re-runnable checker set discovered from one project snapshot. */
7
14
  export interface CleanseDiagnosticSuite {
8
- readonly checkCount: number;
15
+ /** Every discovered checker; unaffected by {@link CleanseDiagnosticSuite.select}. */
16
+ readonly checkers: readonly CleanseCheckerDescriptor[];
9
17
  readonly skipped: readonly SkippedCleanseCheck[];
18
+ /** Narrow subsequent {@link CleanseDiagnosticSuite.run} calls to the named checker ids. */
19
+ select(ids: readonly string[]): void;
10
20
  run(signal?: AbortSignal): Promise<CleanseDiagnosticReport>;
11
21
  }
12
22
  /** Discover configured language checkers without installing missing tools. */
13
23
  export declare function discoverCleanseDiagnosticSuite(projectCwd: string, options?: CleanseDiagnosticSuiteOptions): Promise<CleanseDiagnosticSuite>;
24
+ /** One checker proposed by the prompted discovery agent. */
25
+ export interface CustomCleanseCheckerSpec {
26
+ label: string;
27
+ language?: string;
28
+ cwd?: string;
29
+ command: string[];
30
+ parser?: string;
31
+ }
32
+ /** Build a runnable suite from discovery-agent checker specs, dropping unrunnable entries into `skipped`. */
33
+ export declare function buildCustomCleanseSuite(projectCwd: string, specs: readonly CustomCleanseCheckerSpec[]): Promise<CleanseDiagnosticSuite>;
@@ -4,6 +4,10 @@ export interface CleanseCommandOptions {
4
4
  maxAgents?: number;
5
5
  model?: string;
6
6
  includeTests?: boolean;
7
+ /** Free-form description handed to a discovery agent instead of built-in checker discovery. */
8
+ request?: string;
9
+ /** Run every discovered checker without the interactive picker. */
10
+ all?: boolean;
7
11
  }
8
12
  /** Observable completion state returned to the CLI adapter. */
9
13
  export interface CleanseCommandResult {
@@ -1,6 +1,8 @@
1
1
  import type { CleanseDiagnostic } from "./types.js";
2
2
  /** Machine and fallback output formats understood by cleanse. */
3
- export type CleanseParserKind = "rust" | "rust-test" | "go" | "go-test" | "ruff" | "pyright" | "eslint" | "biome" | "rubocop" | "phpstan" | "psalm" | "swiftlint" | "dart" | "credo" | "shellcheck" | "hlint" | "terraform" | "tflint" | "generic";
3
+ export declare const CLEANSE_PARSER_KINDS: readonly ["rust", "rust-test", "go", "go-test", "staticcheck", "golangci", "ruff", "pyright", "mypy", "pylint", "flake8", "ty", "eslint", "biome", "oxlint", "deno-lint", "stylelint", "rubocop", "phpstan", "psalm", "swiftlint", "dart", "credo", "shellcheck", "hlint", "terraform", "tflint", "actionlint", "generic"];
4
+ /** One machine or fallback output format understood by cleanse. */
5
+ export type CleanseParserKind = (typeof CLEANSE_PARSER_KINDS)[number];
4
6
  /** Captured checker process output passed to a format parser. */
5
7
  export interface CleanseParserInput {
6
8
  checker: string;
@@ -29,6 +29,7 @@ export interface Args {
29
29
  serviceTier?: ServiceTierOpenAISettingValue;
30
30
  hideThinking?: boolean;
31
31
  advisor?: boolean;
32
+ externalThinking?: boolean;
32
33
  continue?: boolean;
33
34
  resume?: string | true;
34
35
  fromClaude?: boolean;
@@ -0,0 +1,17 @@
1
+ import type { CleanseCheckerDescriptor } from "../cleanse/checkers.js";
2
+ /** Outcome of the interactive cleanse target picker. */
3
+ export type CleanseTargetChoice = {
4
+ kind: "all";
5
+ } | {
6
+ kind: "checker";
7
+ id: string;
8
+ } | {
9
+ kind: "request";
10
+ request: string;
11
+ } | {
12
+ kind: "cancel";
13
+ };
14
+ /** Pick between running every discovered checker, one specific checker, or a free-form request. */
15
+ export declare function pickCleanseTarget(checkers: readonly CleanseCheckerDescriptor[]): Promise<CleanseTargetChoice>;
16
+ /** One-shot text prompt for a free-form cleanse request; `null` when cancelled or left empty. */
17
+ export declare function promptCleanseRequest(): Promise<string | null>;
@@ -28,6 +28,9 @@ export declare const completionsHelp: {
28
28
  export declare const completeHelp: {
29
29
  hidden: true;
30
30
  };
31
+ export declare const compressHelp: {
32
+ description: string;
33
+ };
31
34
  export declare const configHelp: {
32
35
  description: string;
33
36
  };
@@ -0,0 +1,19 @@
1
+ /** Minimal output contract used by the interactive progress reporter. */
2
+ export interface ProgressOutput {
3
+ isTTY?: boolean;
4
+ write(text: string): boolean;
5
+ }
6
+ /** Renders completed units of work on one transient terminal line. */
7
+ export interface ProgressReporter {
8
+ readonly interactive: boolean;
9
+ start(total: number): void;
10
+ complete(): void;
11
+ finish(): void;
12
+ }
13
+ /**
14
+ * Create a TTY-only completion bar labelled `label`, e.g. `Repairing [████░░░░] 4/8`.
15
+ *
16
+ * Non-interactive output disables rendering entirely, so callers can print plain
17
+ * per-item lines instead by checking {@link ProgressReporter.interactive}.
18
+ */
19
+ export declare function createProgressReporter(label: string, output?: ProgressOutput): ProgressReporter;
@@ -1,6 +1,12 @@
1
1
  import { Command } from "@oh-my-pi/pi-utils/cli";
2
2
  export default class Cleanse extends Command {
3
3
  static description: string;
4
+ static args: {
5
+ request: import("@oh-my-pi/pi-utils/cli").ArgDescriptor & {
6
+ description: string;
7
+ required: false;
8
+ };
9
+ };
4
10
  static flags: {
5
11
  agents: import("@oh-my-pi/pi-utils/cli").FlagDescriptor<"integer"> & {
6
12
  char: string;
@@ -17,6 +23,11 @@ export default class Cleanse extends Command {
17
23
  description: string;
18
24
  default: boolean;
19
25
  };
26
+ all: import("@oh-my-pi/pi-utils/cli").FlagDescriptor<"boolean"> & {
27
+ char: string;
28
+ description: string;
29
+ default: boolean;
30
+ };
20
31
  };
21
32
  static examples: string[];
22
33
  run(): Promise<void>;
@@ -0,0 +1,37 @@
1
+ import { Command } from "@oh-my-pi/pi-utils/cli";
2
+ export default class Compress extends Command {
3
+ static description: string;
4
+ static args: {
5
+ files: import("@oh-my-pi/pi-utils/cli").ArgDescriptor & {
6
+ description: string;
7
+ required: true;
8
+ multiple: true;
9
+ };
10
+ };
11
+ static flags: {
12
+ out: import("@oh-my-pi/pi-utils/cli").FlagDescriptor<"string"> & {
13
+ char: string;
14
+ description: string;
15
+ };
16
+ inPlace: import("@oh-my-pi/pi-utils/cli").FlagDescriptor<"boolean"> & {
17
+ char: string;
18
+ description: string;
19
+ };
20
+ rounds: import("@oh-my-pi/pi-utils/cli").FlagDescriptor<"integer"> & {
21
+ char: string;
22
+ description: string;
23
+ default: number;
24
+ };
25
+ agents: import("@oh-my-pi/pi-utils/cli").FlagDescriptor<"integer"> & {
26
+ char: string;
27
+ description: string;
28
+ default: number;
29
+ };
30
+ model: import("@oh-my-pi/pi-utils/cli").FlagDescriptor<"string"> & {
31
+ char: string;
32
+ description: string;
33
+ };
34
+ };
35
+ static examples: string[];
36
+ run(): Promise<void>;
37
+ }
@@ -125,6 +125,9 @@ export declare const launchHelp: {
125
125
  advisor: import("@oh-my-pi/pi-utils/cli").FlagDescriptor<"boolean"> & {
126
126
  description: string;
127
127
  };
128
+ "external-thinking": import("@oh-my-pi/pi-utils/cli").FlagDescriptor<"boolean"> & {
129
+ description: string;
130
+ };
128
131
  hook: import("@oh-my-pi/pi-utils/cli").FlagDescriptor<"string"> & {
129
132
  description: string;
130
133
  multiple: true;
@@ -129,6 +129,9 @@ export default class Index extends Command {
129
129
  advisor: import("@oh-my-pi/pi-utils/cli").FlagDescriptor<"boolean"> & {
130
130
  description: string;
131
131
  };
132
+ "external-thinking": import("@oh-my-pi/pi-utils/cli").FlagDescriptor<"boolean"> & {
133
+ description: string;
134
+ };
132
135
  hook: import("@oh-my-pi/pi-utils/cli").FlagDescriptor<"string"> & {
133
136
  description: string;
134
137
  multiple: true;
@@ -0,0 +1,27 @@
1
+ import type { CompressResult } from "./types.js";
2
+ /** User-facing options for `omp compress`. */
3
+ export interface CompressCommandOptions {
4
+ /** Files and glob patterns to compress. */
5
+ files: string[];
6
+ /** Model selector; defaults to the configured session model. */
7
+ model?: string;
8
+ /** Maximum drafts per file before that file gives up unapproved. Default 3. */
9
+ maxRounds?: number;
10
+ /** Concurrent files. Default 4. */
11
+ concurrency?: number;
12
+ /** Write the approved text here instead of stdout. Single file only. */
13
+ output?: string;
14
+ /** Overwrite each source file with its approved text. */
15
+ inPlace?: boolean;
16
+ }
17
+ /**
18
+ * Expand `patterns` into a deduplicated, sorted list of absolute file paths.
19
+ *
20
+ * Entries containing glob metacharacters are matched against `cwd`; everything else is
21
+ * treated as a literal path so filenames containing brackets still resolve. Throws when
22
+ * a literal path is missing or a pattern matches nothing, since silently compressing
23
+ * fewer files than asked is worse than failing.
24
+ */
25
+ export declare function resolveCompressTargets(patterns: readonly string[], cwd: string): Promise<string[]>;
26
+ /** Compress every requested file through the rewrite/approve loop. */
27
+ export declare function runCompressCommand(options: CompressCommandOptions): Promise<CompressResult>;
@@ -0,0 +1,49 @@
1
+ import type { ToolDefinition } from "../extensibility/extensions/index.js";
2
+ import type { CompressDraft, CompressLoss, CompressMetrics } from "./types.js";
3
+ /** Transcript details for one `rewrite` call. */
4
+ export interface RewriteDetails {
5
+ round: number;
6
+ draftTokens: number;
7
+ losses: number;
8
+ }
9
+ /** Transcript details for one `approve` call. */
10
+ export interface ApproveDetails {
11
+ round: number;
12
+ }
13
+ /** Draft ledger shared by the protocol tools and the command loop. */
14
+ export declare class CompressProtocol {
15
+ #private;
16
+ constructor(source: string);
17
+ /** Newest submitted draft, or undefined before the first `rewrite`. */
18
+ get latest(): CompressDraft | undefined;
19
+ /** True once `approve` accepted the newest draft. */
20
+ get approved(): boolean;
21
+ /** The agent's stated reason for accepting the final draft. */
22
+ get verdict(): string | undefined;
23
+ /** Number of drafts submitted so far. */
24
+ get rounds(): number;
25
+ /** Words in the source text. */
26
+ get sourceWords(): number;
27
+ /** Tokens in the source text. */
28
+ get sourceTokens(): number;
29
+ /** Size of `draft` against the source. */
30
+ metrics(draft: CompressDraft): CompressMetrics;
31
+ /** Record that the command has shown `round` back to the agent for a verdict. */
32
+ markReviewed(round: number): void;
33
+ /**
34
+ * Record a draft and return it. Supersedes any prior approval, so an accepted
35
+ * draft cannot be silently replaced by a later one.
36
+ */
37
+ submit(text: string, losses: readonly CompressLoss[]): CompressDraft;
38
+ /**
39
+ * Accept the newest draft and return it.
40
+ *
41
+ * Throws when no draft exists, or when the newest draft has not been shown back
42
+ * to the agent for a verdict — approval is only meaningful after that review.
43
+ */
44
+ accept(verdict: string): CompressDraft;
45
+ /** Tool that records a draft. Thin adapter over {@link submit}. */
46
+ rewriteTool(): ToolDefinition;
47
+ /** Tool that accepts the newest reviewed draft. Thin adapter over {@link accept}. */
48
+ approveTool(): ToolDefinition;
49
+ }
@@ -0,0 +1,15 @@
1
+ import type { AgentSession } from "../session/agent-session.js";
2
+ import type { CompressProtocol } from "./protocol.js";
3
+ /** A live compress session plus the resolved model label used in reporting. */
4
+ export interface CompressSession {
5
+ session: AgentSession;
6
+ model: string;
7
+ }
8
+ /** Resolve the requested model and open a session restricted to the two protocol tools. */
9
+ export declare function createCompressSession(options: {
10
+ cwd?: string;
11
+ model?: string;
12
+ protocol: CompressProtocol;
13
+ /** Distinct per concurrent session; agent ids must be unique within a process. */
14
+ agentId?: string;
15
+ }): Promise<CompressSession>;
@@ -0,0 +1,54 @@
1
+ /** One piece of source content a draft knowingly does not carry over. */
2
+ export interface CompressLoss {
3
+ /** The dropped content, quoted from the source or described precisely. */
4
+ content: string;
5
+ /** Why the draft is still correct without it. */
6
+ reason: string;
7
+ }
8
+ /** One submitted compression attempt. */
9
+ export interface CompressDraft {
10
+ /** 1-based submission counter. */
11
+ round: number;
12
+ /** Complete compressed text, ready to ship as-is. */
13
+ text: string;
14
+ /** Everything the agent declared it dropped, possibly empty. */
15
+ losses: CompressLoss[];
16
+ }
17
+ /** Measured size of a draft against its source. */
18
+ export interface CompressMetrics {
19
+ sourceWords: number;
20
+ draftWords: number;
21
+ sourceTokens: number;
22
+ draftTokens: number;
23
+ /** Token reduction as a fraction of the source; negative when a draft grew. */
24
+ ratio: number;
25
+ }
26
+ /** Why a run ended. `stalled` means the agent neither resubmitted nor approved. */
27
+ export type CompressStatus = "approved" | "unapproved" | "stalled" | "cancelled";
28
+ /** Observable completion state for one compressed file. */
29
+ export interface CompressFileResult {
30
+ /** Absolute path of the source file. */
31
+ path: string;
32
+ status: CompressStatus;
33
+ /** Newest draft, present whenever `rewrite` was called at least once. */
34
+ draft?: CompressDraft;
35
+ metrics?: CompressMetrics;
36
+ /** The agent's stated reason for accepting the final draft. */
37
+ verdict?: string;
38
+ /** Number of drafts submitted. */
39
+ rounds: number;
40
+ /** Where the approved text was written; absent when it went to stdout. */
41
+ outputPath?: string;
42
+ sessionFile?: string;
43
+ /** Set when the file could not be processed at all (unreadable, session failure). */
44
+ error?: string;
45
+ }
46
+ /** Aggregate result returned to the CLI adapter. */
47
+ export interface CompressResult {
48
+ exitCode: number;
49
+ files: CompressFileResult[];
50
+ /** Source tokens across every file that produced a draft. */
51
+ sourceTokens: number;
52
+ /** Draft tokens across every file that produced a draft. */
53
+ draftTokens: number;
54
+ }
@@ -1026,6 +1026,16 @@ export declare const SETTINGS_SCHEMA: {
1026
1026
  readonly description: "Instruct upstream providers to completely omit thinking summaries from responses (where supported)";
1027
1027
  };
1028
1028
  };
1029
+ readonly externalThinking: {
1030
+ readonly type: "boolean";
1031
+ readonly default: false;
1032
+ readonly ui: {
1033
+ readonly tab: "model";
1034
+ readonly group: "Thinking";
1035
+ readonly label: "External Thinking";
1036
+ readonly description: "Private scratchpad; not shown to user. Disables supported GPT, Claude, and Gemini reasoning";
1037
+ };
1038
+ };
1029
1039
  readonly "model.loopGuard.enabled": {
1030
1040
  readonly type: "boolean";
1031
1041
  readonly default: true;
@@ -5,6 +5,14 @@ export interface LocalProtocolOptions {
5
5
  }
6
6
  /** Resolve the session-scoped local:// root, shortening long Windows artifact paths before writes hit MAX_PATH. */
7
7
  export declare function resolveLocalRoot(options: LocalProtocolOptions, platform?: NodeJS.Platform): string;
8
+ /**
9
+ * Recursively copy every local:// artifact from one session-scoped root to
10
+ * another. Used when a session transition mints a fresh local root (plan
11
+ * approve-and-execute, handoff) so plans, scratch files, and research notes the
12
+ * carried-forward context references stay readable in the replacement session.
13
+ * No-op when the roots match or the source root is absent.
14
+ */
15
+ export declare function copyLocalArtifacts(sourceRoot: string, destinationRoot: string): Promise<void>;
8
16
  /** Resolve a local:// URL to an on-disk path under the active session's local root. */
9
17
  export declare function resolveLocalUrlToPath(input: string | InternalUrl, options: LocalProtocolOptions, platform?: NodeJS.Platform): string;
10
18
  /**
@@ -29,6 +29,14 @@ export declare function mergeMCPHeaders({ generated, configured }: MCPHeaderSour
29
29
  * case-insensitive name so the generated value is the only one sent.
30
30
  */
31
31
  export declare function setGeneratedHeader(headers: Record<string, string>, name: string, value: string): void;
32
+ /**
33
+ * Return `headers` without any entry whose name case-insensitively matches
34
+ * `name`. Used to keep transport-reserved protocol headers (e.g.
35
+ * `MCP-Protocol-Version`) out of user-configured headers so config can never
36
+ * inject them. Returns the original reference when there is nothing to strip,
37
+ * so the common (no-match) path allocates nothing.
38
+ */
39
+ export declare function withoutHeader(headers: Record<string, string> | undefined, name: string): Record<string, string> | undefined;
32
40
  export interface MCPFetchInit {
33
41
  method: "GET" | "POST" | "DELETE";
34
42
  body?: string;
@@ -22,6 +22,8 @@ export declare class HttpTransport implements MCPTransport {
22
22
  /** Called on 401/403 to attempt token refresh. Returns updated headers or null. */
23
23
  onAuthError?: () => Promise<Record<string, string> | null>;
24
24
  constructor(config: MCPHttpServerConfig | MCPSseServerConfig);
25
+ /** Record the protocol version negotiated during `initialize`. */
26
+ setProtocolVersion(version: string): void;
25
27
  get connected(): boolean;
26
28
  get url(): string;
27
29
  /**
@@ -122,6 +122,18 @@ export interface MCPConfigFile {
122
122
  /** Names to force-enable when a non-writable source reports `enabled: false`. */
123
123
  enabledServers?: string[];
124
124
  }
125
+ /**
126
+ * Latest MCP protocol revision this client negotiates.
127
+ *
128
+ * Sent as `protocolVersion` in the `initialize` request and, for Streamable
129
+ * HTTP, echoed back to the server in the `MCP-Protocol-Version` header on every
130
+ * subsequent request (per the MCP HTTP transport spec). Must track the current
131
+ * stable revision: AWS Bedrock AgentCore Gateway refuses tool calls on an
132
+ * outbound per-user OAuth (`AUTHORIZATION_CODE`) target below `2025-11-25`, and
133
+ * it checks the version *before* consulting its token vault, so an older client
134
+ * is refused even for a caller whose consent is already stored.
135
+ */
136
+ export declare const MCP_PROTOCOL_VERSION = "2025-11-25";
125
137
  /** MCP implementation info */
126
138
  export interface MCPImplementation {
127
139
  name: string;
@@ -227,6 +239,13 @@ export interface MCPTransport {
227
239
  notify(method: string, params?: Record<string, unknown>): Promise<void>;
228
240
  /** Close the transport */
229
241
  close(): Promise<void>;
242
+ /**
243
+ * Record the protocol version negotiated in the `initialize` response.
244
+ * Streamable HTTP transports echo it in the `MCP-Protocol-Version` header on
245
+ * every subsequent request; transports that need no per-request version
246
+ * (stdio) omit this.
247
+ */
248
+ setProtocolVersion?(version: string): void;
230
249
  /** Whether the transport is connected */
231
250
  readonly connected: boolean;
232
251
  /** Event handlers */
@@ -16,5 +16,7 @@ export declare class LateDiagnosticsMessageComponent extends Container {
16
16
  private readonly files;
17
17
  constructor(files: LateDiagnosticsFile[]);
18
18
  setExpanded(expanded: boolean): void;
19
+ setToolActivityVisible(visible: boolean): void;
20
+ render(width: number): readonly string[];
19
21
  invalidate(): void;
20
22
  }
@@ -12,4 +12,6 @@ export declare class TodoReminderComponent extends Container {
12
12
  private readonly attempt;
13
13
  private readonly maxAttempts;
14
14
  constructor(todos: TodoItem[], attempt: number, maxAttempts: number);
15
+ setToolActivityVisible(visible: boolean): void;
16
+ render(width: number): readonly string[];
15
17
  }
@@ -0,0 +1,17 @@
1
+ import { type Component, Container } from "@oh-my-pi/pi-tui";
2
+ export interface ToolActivityComponent {
3
+ setToolActivityVisible(visible: boolean): void;
4
+ }
5
+ export declare function isToolActivityComponent(component: Component): component is Component & ToolActivityComponent;
6
+ export declare class ToolActivityContainer extends Container implements ToolActivityComponent {
7
+ #private;
8
+ constructor(component: Component | Component[]);
9
+ setToolActivityVisible(visible: boolean): void;
10
+ /**
11
+ * Forward Ctrl+O expansion to wrapped children. The transcript's expansion
12
+ * traversal only visits top-level children, so the wrapper must proxy or
13
+ * wrapped renderers would freeze at their insertion-time expansion state.
14
+ */
15
+ setExpanded(expanded: boolean): void;
16
+ render(width: number): readonly string[];
17
+ }
@@ -26,6 +26,8 @@ import { type Component, Container, type NativeScrollbackCommittedRows, type Nat
26
26
  */
27
27
  export declare class TranscriptContainer extends Container implements NativeScrollbackLiveRegion, NativeScrollbackCommittedRows, RenderStablePrefix, ViewportTailProvider {
28
28
  #private;
29
+ addChild(component: Component): void;
30
+ setToolActivityVisible(visible: boolean): void;
29
31
  invalidate(): void;
30
32
  clear(): void;
31
33
  setNativeScrollbackCommittedRows(rows: number): void;
@@ -10,6 +10,8 @@ import type { Rule } from "../../capability/rule.js";
10
10
  export declare class TtsrNotificationComponent extends Container {
11
11
  #private;
12
12
  constructor(rules: Rule[]);
13
+ setToolActivityVisible(visible: boolean): void;
14
+ render(width: number): readonly string[];
13
15
  /** Merge additional rules into this block (deduped by rule name). */
14
16
  addRules(rules: Rule[]): void;
15
17
  setExpanded(expanded: boolean): void;
@@ -313,7 +313,9 @@ export declare class InteractiveMode implements InteractiveModeContext {
313
313
  showError(message: string): void;
314
314
  showPinnedError(message: string): void;
315
315
  clearPinnedError(): void;
316
- showWarning(message: string): void;
316
+ showWarning(message: string, options?: {
317
+ hideWithToolActivity?: boolean;
318
+ }): void;
317
319
  ensureLoadingAnimation(): void;
318
320
  setWorkingMessage(message?: string): void;
319
321
  applyPendingWorkingMessage(): void;
@@ -243,7 +243,9 @@ export interface InteractiveModeContext {
243
243
  showError(message: string): void;
244
244
  showPinnedError(message: string): void;
245
245
  clearPinnedError(): void;
246
- showWarning(message: string): void;
246
+ showWarning(message: string, options?: {
247
+ hideWithToolActivity?: boolean;
248
+ }): void;
247
249
  showNewVersionNotification(newVersion: string): void;
248
250
  clearEditor(): void;
249
251
  updatePendingMessagesDisplay(): void;
@@ -7,6 +7,7 @@
7
7
  import type { AgentMessage } from "@oh-my-pi/pi-agent-core";
8
8
  import { type Component } from "@oh-my-pi/pi-tui";
9
9
  import { type FileMentionMessage } from "../../session/messages.js";
10
+ import { ToolActivityContainer } from "../components/tool-activity.js";
10
11
  import { TranscriptBlock } from "../components/transcript-container.js";
11
12
  type CustomOrHookMessage = Extract<AgentMessage, {
12
13
  role: "custom" | "hookMessage";
@@ -19,7 +20,7 @@ type AssistantAgentMessage = Extract<AgentMessage, {
19
20
  * or a batch of them) as a transcript block of one "Background job completed"
20
21
  * row per job.
21
22
  */
22
- export declare function buildAsyncResultBlock(message: CustomOrHookMessage): TranscriptBlock;
23
+ export declare function buildAsyncResultBlock(message: CustomOrHookMessage): ToolActivityContainer;
23
24
  /**
24
25
  * Render a live IRC traffic custom message (`irc:incoming` / `irc:autoreply` /
25
26
  * `irc:relay`) as a transcript card. `getExpanded` supplies the live
@@ -38,7 +38,9 @@ export declare class UiHelpers {
38
38
  renderInitialMessages(options?: RenderInitialMessagesOptions): void;
39
39
  clearEditor(): void;
40
40
  showError(errorMessage: string): void;
41
- showWarning(warningMessage: string): void;
41
+ showWarning(warningMessage: string, options?: {
42
+ hideWithToolActivity?: boolean;
43
+ }): void;
42
44
  showNewVersionNotification(newVersion: string): void;
43
45
  updatePendingMessagesDisplay(): void;
44
46
  queueCompactionMessage(text: string, mode: "steer" | "followUp", images?: ImageContent[]): void;
@@ -138,6 +138,8 @@ export interface AgentSessionConfig {
138
138
  createMemoryTools?: () => Promise<AgentTool[]>;
139
139
  /** Creates the built-in `computer` tool for session-scoped runtime enablement (see {@link AgentSession.setComputerToolEnabled}). */
140
140
  createComputerTool?: () => Promise<AgentTool | null>;
141
+ /** Creates the private `think` scratchpad tool for runtime setting changes. */
142
+ createThinkTool?: () => Promise<AgentTool | null>;
141
143
  /** Creates the built-in `inspect_image` tool for session-scoped runtime enablement (see {@link AgentSession.setInspectImageMode}). */
142
144
  createInspectImageTool?: () => Promise<AgentTool | null>;
143
145
  /** Model registry for API key resolution and model discovery. */
@@ -331,6 +331,8 @@ export declare class AgentSession {
331
331
  * tool (e.g. restricted child sessions have no factory).
332
332
  */
333
333
  setComputerToolEnabled(enabled: boolean): Promise<boolean>;
334
+ /** Applies the external-thinking setting to the private scratchpad tool immediately. */
335
+ setThinkToolEnabled(enabled: boolean): Promise<boolean>;
334
336
  /**
335
337
  * Session-scoped inspect_image mode (`/vision`). `auto` clears the override
336
338
  * and returns to the persisted `inspect_image.mode` setting; `on`/`off`
@@ -43,6 +43,8 @@ interface SessionToolsOptions {
43
43
  toolRegistry?: Map<string, AgentTool>;
44
44
  createVibeTools?: () => AgentTool[];
45
45
  createComputerTool?: () => Promise<AgentTool | null>;
46
+ /** Creates the private `think` scratchpad tool for runtime setting changes. */
47
+ createThinkTool?: () => Promise<AgentTool | null>;
46
48
  /** Creates the built-in `inspect_image` tool for session-scoped runtime enablement (see {@link SessionTools.setInspectImageMode}). */
47
49
  createInspectImageTool?: () => Promise<AgentTool | null>;
48
50
  builtInToolNames?: Iterable<string>;
@@ -232,6 +234,17 @@ export declare class SessionTools {
232
234
  * tool (e.g. restricted child sessions have no factory).
233
235
  */
234
236
  setComputerToolEnabled(enabled: boolean): Promise<boolean>;
237
+ /**
238
+ * Session-scoped enable/disable for the private `think` scratchpad tool.
239
+ *
240
+ * Enabling constructs the tool once and refreshes the model's tool contract;
241
+ * disabling removes it from the active set while preserving its registry entry.
242
+ *
243
+ * @returns false when enabling was requested but this session cannot build the tool.
244
+ */
245
+ setThinkToolEnabled(enabled: boolean): Promise<boolean>;
246
+ /** Reconciles the external scratchpad after the active model changes. */
247
+ reconcileThinkTool(): Promise<boolean>;
235
248
  /** Current effective inspect_image state for `/vision status`. */
236
249
  inspectImageState(): {
237
250
  mode: InspectImageMode;
@@ -1,7 +1,6 @@
1
1
  export declare const BUILTIN_TOOL_NAMES: readonly ["read", "bash", "edit", "ast_grep", "ast_edit", "ask", "debug", "eval", "github", "glob", "grep", "lsp", "inspect_image", "browser", "computer", "checkpoint", "rewind", "security_scan", "task", "hub", "todo", "web_search", "write", "memory_edit", "retain", "recall", "reflect", "learn", "manage_skill"];
2
2
  export type BuiltinToolName = (typeof BUILTIN_TOOL_NAMES)[number];
3
- /** Hidden built-ins: constructible and `--tools`-addressable, but never part of the default active set. */
4
- export declare const HIDDEN_TOOL_NAMES: readonly ["yield", "goal"];
3
+ export declare const HIDDEN_TOOL_NAMES: readonly ["yield", "goal", "think"];
5
4
  export type HiddenToolName = (typeof HIDDEN_TOOL_NAMES)[number];
6
5
  /** Return the canonical tool name for current and legacy built-in tool IDs. */
7
6
  export declare function normalizeToolName(name: string): string;
@@ -67,6 +67,7 @@ export * from "./report-tool-issue.js";
67
67
  export * from "./resolve.js";
68
68
  export * from "./review.js";
69
69
  export * from "./security-scan.js";
70
+ export * from "./think.js";
70
71
  export * from "./todo.js";
71
72
  export * from "./tts.js";
72
73
  export * from "./vibe.js";