@oh-my-pi/pi-coding-agent 15.5.13 → 15.6.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.
Files changed (192) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/dist/types/cli/classify-install-target.d.ts +0 -10
  3. package/dist/types/cli/initial-message.d.ts +1 -1
  4. package/dist/types/cli/tiny-models-cli.d.ts +9 -0
  5. package/dist/types/commands/tiny-models.d.ts +22 -0
  6. package/dist/types/commit/analysis/conventional.d.ts +1 -1
  7. package/dist/types/commit/analysis/summary.d.ts +1 -1
  8. package/dist/types/commit/changelog/generate.d.ts +1 -1
  9. package/dist/types/commit/changelog/index.d.ts +2 -2
  10. package/dist/types/commit/map-reduce/map-phase.d.ts +1 -1
  11. package/dist/types/commit/map-reduce/reduce-phase.d.ts +1 -1
  12. package/dist/types/config/model-id-affixes.d.ts +10 -0
  13. package/dist/types/config/model-registry.d.ts +1 -1
  14. package/dist/types/config/models-config-schema.d.ts +2 -0
  15. package/dist/types/config/settings-schema.d.ts +233 -17
  16. package/dist/types/discovery/helpers.d.ts +1 -1
  17. package/dist/types/discovery/substitute-plugin-root.d.ts +0 -4
  18. package/dist/types/eval/__tests__/llm-bridge.test.d.ts +1 -0
  19. package/dist/types/eval/js/shared/rewrite-imports.d.ts +16 -1
  20. package/dist/types/eval/llm-bridge.d.ts +25 -0
  21. package/dist/types/export/html/template.generated.d.ts +1 -1
  22. package/dist/types/extensibility/plugins/legacy-pi-compat.d.ts +15 -0
  23. package/dist/types/internal-urls/agent-protocol.d.ts +2 -1
  24. package/dist/types/internal-urls/artifact-protocol.d.ts +2 -1
  25. package/dist/types/internal-urls/local-protocol.d.ts +2 -1
  26. package/dist/types/internal-urls/memory-protocol.d.ts +2 -1
  27. package/dist/types/internal-urls/omp-protocol.d.ts +2 -1
  28. package/dist/types/internal-urls/router.d.ts +8 -1
  29. package/dist/types/internal-urls/rule-protocol.d.ts +2 -1
  30. package/dist/types/internal-urls/skill-protocol.d.ts +2 -1
  31. package/dist/types/internal-urls/types.d.ts +26 -0
  32. package/dist/types/memory-backend/index.d.ts +1 -0
  33. package/dist/types/memory-backend/resolve.d.ts +2 -1
  34. package/dist/types/memory-backend/types.d.ts +7 -1
  35. package/dist/types/mnemosyne/backend.d.ts +4 -0
  36. package/dist/types/mnemosyne/config.d.ts +29 -0
  37. package/dist/types/mnemosyne/index.d.ts +3 -0
  38. package/dist/types/mnemosyne/state.d.ts +72 -0
  39. package/dist/types/modes/components/custom-editor.d.ts +2 -3
  40. package/dist/types/modes/components/hook-selector.d.ts +27 -0
  41. package/dist/types/modes/components/index.d.ts +1 -0
  42. package/dist/types/modes/components/status-line/context-thresholds.d.ts +6 -0
  43. package/dist/types/modes/components/tiny-title-download-progress.d.ts +11 -0
  44. package/dist/types/modes/components/welcome.d.ts +1 -0
  45. package/dist/types/modes/controllers/extension-ui-controller.d.ts +4 -1
  46. package/dist/types/modes/gradient-highlight.d.ts +23 -0
  47. package/dist/types/modes/interactive-mode.d.ts +4 -2
  48. package/dist/types/modes/internal-url-autocomplete.d.ts +43 -0
  49. package/dist/types/modes/orchestrate.d.ts +10 -0
  50. package/dist/types/modes/theme/defaults/index.d.ts +8406 -8406
  51. package/dist/types/modes/theme/theme.d.ts +2 -1
  52. package/dist/types/modes/ultrathink.d.ts +3 -3
  53. package/dist/types/modes/utils/keybinding-matchers.d.ts +5 -0
  54. package/dist/types/sdk.d.ts +3 -0
  55. package/dist/types/session/agent-session.d.ts +35 -0
  56. package/dist/types/system-prompt.d.ts +2 -0
  57. package/dist/types/task/executor.d.ts +2 -0
  58. package/dist/types/task/render.d.ts +5 -1
  59. package/dist/types/tiny/models.d.ts +185 -0
  60. package/dist/types/tiny/text.d.ts +4 -0
  61. package/dist/types/tiny/title-client.d.ts +24 -0
  62. package/dist/types/tiny/title-protocol.d.ts +74 -0
  63. package/dist/types/tiny/worker.d.ts +2 -0
  64. package/dist/types/tools/bash.d.ts +3 -1
  65. package/dist/types/tools/index.d.ts +7 -4
  66. package/dist/types/tools/memory-edit.d.ts +40 -0
  67. package/dist/types/tools/{hindsight-recall.d.ts → memory-recall.d.ts} +6 -6
  68. package/dist/types/tools/{hindsight-reflect.d.ts → memory-reflect.d.ts} +6 -6
  69. package/dist/types/tools/memory-render.d.ts +60 -0
  70. package/dist/types/tools/{hindsight-retain.d.ts → memory-retain.d.ts} +6 -6
  71. package/dist/types/tools/todo-write.d.ts +8 -0
  72. package/dist/types/tools/tool-result.d.ts +2 -0
  73. package/dist/types/utils/title-generator.d.ts +3 -0
  74. package/package.json +18 -14
  75. package/scripts/build-binary.ts +1 -0
  76. package/src/cli/tiny-models-cli.ts +127 -0
  77. package/src/cli-commands.ts +1 -0
  78. package/src/cli.ts +8 -8
  79. package/src/commands/tiny-models.ts +36 -0
  80. package/src/config/model-equivalence.ts +43 -2
  81. package/src/config/model-id-affixes.ts +64 -0
  82. package/src/config/model-registry.ts +166 -8
  83. package/src/config/models-config-schema.ts +1 -1
  84. package/src/config/settings-schema.ts +206 -14
  85. package/src/edit/hashline/diff.ts +5 -7
  86. package/src/eval/__tests__/llm-bridge.test.ts +297 -0
  87. package/src/eval/__tests__/shared-executors.test.ts +36 -0
  88. package/src/eval/js/shared/local-module-loader.ts +13 -1
  89. package/src/eval/js/shared/prelude.txt +8 -0
  90. package/src/eval/js/shared/rewrite-imports.ts +31 -26
  91. package/src/eval/js/tool-bridge.ts +4 -0
  92. package/src/eval/llm-bridge.ts +181 -0
  93. package/src/eval/py/prelude.py +52 -31
  94. package/src/export/html/template.generated.ts +1 -1
  95. package/src/export/html/template.js +0 -13
  96. package/src/extensibility/plugins/legacy-pi-compat.ts +60 -23
  97. package/src/internal-urls/agent-protocol.ts +18 -1
  98. package/src/internal-urls/artifact-protocol.ts +19 -1
  99. package/src/internal-urls/docs-index.generated.ts +5 -4
  100. package/src/internal-urls/local-protocol.ts +14 -1
  101. package/src/internal-urls/memory-protocol.ts +6 -1
  102. package/src/internal-urls/omp-protocol.ts +5 -1
  103. package/src/internal-urls/router.ts +20 -1
  104. package/src/internal-urls/rule-protocol.ts +8 -1
  105. package/src/internal-urls/skill-protocol.ts +8 -1
  106. package/src/internal-urls/types.ts +27 -0
  107. package/src/lsp/render.ts +1 -1
  108. package/src/main.ts +4 -0
  109. package/src/mcp/oauth-flow.ts +2 -2
  110. package/src/memory-backend/index.ts +1 -0
  111. package/src/memory-backend/resolve.ts +4 -1
  112. package/src/memory-backend/types.ts +8 -1
  113. package/src/mnemosyne/backend.ts +374 -0
  114. package/src/mnemosyne/config.ts +160 -0
  115. package/src/mnemosyne/index.ts +3 -0
  116. package/src/mnemosyne/state.ts +548 -0
  117. package/src/modes/acp/acp-agent.ts +11 -6
  118. package/src/modes/components/agent-dashboard.ts +4 -4
  119. package/src/modes/components/custom-editor.ts +3 -2
  120. package/src/modes/components/diff.ts +2 -2
  121. package/src/modes/components/extensions/extension-list.ts +3 -2
  122. package/src/modes/components/footer.ts +5 -6
  123. package/src/modes/components/history-search.ts +3 -3
  124. package/src/modes/components/hook-selector.ts +94 -8
  125. package/src/modes/components/index.ts +1 -0
  126. package/src/modes/components/mcp-add-wizard.ts +3 -3
  127. package/src/modes/components/model-selector.ts +124 -26
  128. package/src/modes/components/oauth-selector.ts +3 -3
  129. package/src/modes/components/session-observer-overlay.ts +19 -13
  130. package/src/modes/components/session-selector.ts +3 -3
  131. package/src/modes/components/settings-defs.ts +7 -0
  132. package/src/modes/components/status-line/context-thresholds.ts +11 -0
  133. package/src/modes/components/status-line/presets.ts +1 -0
  134. package/src/modes/components/status-line/segments.ts +25 -2
  135. package/src/modes/components/tiny-title-download-progress.ts +90 -0
  136. package/src/modes/components/tips.txt +12 -0
  137. package/src/modes/components/tool-execution.ts +67 -3
  138. package/src/modes/components/tree-selector.ts +3 -3
  139. package/src/modes/components/user-message-selector.ts +3 -3
  140. package/src/modes/components/welcome.ts +55 -1
  141. package/src/modes/controllers/command-controller.ts +16 -1
  142. package/src/modes/controllers/extension-ui-controller.ts +3 -1
  143. package/src/modes/controllers/input-controller.ts +57 -0
  144. package/src/modes/gradient-highlight.ts +70 -0
  145. package/src/modes/interactive-mode.ts +80 -196
  146. package/src/modes/internal-url-autocomplete.ts +143 -0
  147. package/src/modes/orchestrate.ts +36 -0
  148. package/src/modes/prompt-action-autocomplete.ts +12 -0
  149. package/src/modes/theme/theme.ts +7 -0
  150. package/src/modes/ultrathink.ts +9 -53
  151. package/src/modes/utils/keybinding-matchers.ts +11 -0
  152. package/src/prompts/system/memory-consolidation-system.md +8 -0
  153. package/src/prompts/system/memory-extraction-system.md +26 -0
  154. package/src/prompts/{commands/orchestrate.md → system/orchestrate-notice.md} +5 -16
  155. package/src/prompts/system/system-prompt.md +2 -0
  156. package/src/prompts/system/tiny-title-system.md +8 -0
  157. package/src/prompts/tools/eval.md +2 -0
  158. package/src/prompts/tools/memory-edit.md +8 -0
  159. package/src/prompts/tools/task.md +4 -7
  160. package/src/sdk.ts +8 -6
  161. package/src/session/agent-session.ts +147 -44
  162. package/src/session/session-manager.ts +47 -0
  163. package/src/slash-commands/builtin-registry.ts +10 -1
  164. package/src/system-prompt.ts +4 -0
  165. package/src/task/commands.ts +1 -5
  166. package/src/task/executor.ts +8 -0
  167. package/src/task/index.ts +2 -0
  168. package/src/task/render.ts +69 -26
  169. package/src/tiny/models.ts +217 -0
  170. package/src/tiny/text.ts +19 -0
  171. package/src/tiny/title-client.ts +340 -0
  172. package/src/tiny/title-protocol.ts +51 -0
  173. package/src/tiny/worker.ts +523 -0
  174. package/src/tools/bash.ts +58 -16
  175. package/src/tools/browser/tab-worker.ts +1 -1
  176. package/src/tools/eval.ts +24 -48
  177. package/src/tools/index.ts +17 -15
  178. package/src/tools/memory-edit.ts +59 -0
  179. package/src/tools/memory-recall.ts +100 -0
  180. package/src/tools/memory-reflect.ts +88 -0
  181. package/src/tools/memory-render.ts +185 -0
  182. package/src/tools/memory-retain.ts +91 -0
  183. package/src/tools/renderers.ts +4 -2
  184. package/src/tools/todo-write.ts +128 -29
  185. package/src/tools/tool-result.ts +8 -0
  186. package/src/utils/title-generator.ts +115 -13
  187. package/dist/types/tools/calculator.d.ts +0 -77
  188. package/src/prompts/tools/calculator.md +0 -10
  189. package/src/tools/calculator.ts +0 -541
  190. package/src/tools/hindsight-recall.ts +0 -69
  191. package/src/tools/hindsight-reflect.ts +0 -58
  192. package/src/tools/hindsight-retain.ts +0 -57
@@ -1,3 +1,18 @@
1
+ import * as path from "node:path";
2
+ /**
3
+ * Compute the bunfs package root from the compiled binary's `import.meta.dir`
4
+ * (or any stand-in supplied by tests). Bun 1.3 reports the bunfs mount root
5
+ * (`/$bunfs/root` or `<drive>:\~BUN\root`) for imported modules as well as the
6
+ * entrypoint, so the normal path is `<root>/packages`.
7
+ *
8
+ * The suffix branch preserves correctness if a future Bun release switches to
9
+ * module-specific `import.meta.dir` values inside compiled binaries, matching
10
+ * the source layout:
11
+ * `<bunfs>/packages/coding-agent/src/extensibility/plugins`.
12
+ *
13
+ * Exported for tests; production callers use `BUNFS_PACKAGE_ROOT` below.
14
+ */
15
+ export declare function __computeBunfsPackageRoot(metaDir: string, pathImpl?: typeof path): string;
1
16
  export declare function loadLegacyPiModule(resolvedPath: string): Promise<unknown>;
2
17
  export declare function installLegacyPiSpecifierShim(): void;
3
18
  /** Test seam: clears the memoized canonical specifier resolutions. */
@@ -1,4 +1,4 @@
1
- import type { InternalResource, InternalUrl, ProtocolHandler } from "./types";
1
+ import type { InternalResource, InternalUrl, ProtocolHandler, UrlCompletion } from "./types";
2
2
  /**
3
3
  * Handler for agent:// URLs.
4
4
  *
@@ -9,4 +9,5 @@ export declare class AgentProtocolHandler implements ProtocolHandler {
9
9
  readonly scheme = "agent";
10
10
  readonly immutable = true;
11
11
  resolve(url: InternalUrl): Promise<InternalResource>;
12
+ complete(): Promise<UrlCompletion[]>;
12
13
  }
@@ -1,6 +1,7 @@
1
- import type { InternalResource, InternalUrl, ProtocolHandler } from "./types";
1
+ import type { InternalResource, InternalUrl, ProtocolHandler, UrlCompletion } from "./types";
2
2
  export declare class ArtifactProtocolHandler implements ProtocolHandler {
3
3
  readonly scheme = "artifact";
4
4
  readonly immutable = true;
5
5
  resolve(url: InternalUrl): Promise<InternalResource>;
6
+ complete(): Promise<UrlCompletion[]>;
6
7
  }
@@ -1,4 +1,4 @@
1
- import type { InternalResource, InternalUrl, ProtocolHandler } from "./types";
1
+ import type { InternalResource, InternalUrl, ProtocolHandler, UrlCompletion } from "./types";
2
2
  export interface LocalProtocolOptions {
3
3
  getArtifactsDir?: () => string | null;
4
4
  getSessionId?: () => string | null;
@@ -36,4 +36,5 @@ export declare class LocalProtocolHandler implements ProtocolHandler {
36
36
  */
37
37
  static resolveOptions(): LocalProtocolOptions | undefined;
38
38
  resolve(url: InternalUrl): Promise<InternalResource>;
39
+ complete(): Promise<UrlCompletion[]>;
39
40
  }
@@ -1,4 +1,4 @@
1
- import type { InternalResource, InternalUrl, ProtocolHandler } from "./types";
1
+ import type { InternalResource, InternalUrl, ProtocolHandler, UrlCompletion } from "./types";
2
2
  /**
3
3
  * Snapshot of memory roots for every registered session, deduped.
4
4
  * Each session has its own cwd (possibly a worktree), so subagents and main
@@ -20,4 +20,5 @@ export declare class MemoryProtocolHandler implements ProtocolHandler {
20
20
  readonly scheme = "memory";
21
21
  readonly immutable = true;
22
22
  resolve(url: InternalUrl): Promise<InternalResource>;
23
+ complete(): Promise<UrlCompletion[]>;
23
24
  }
@@ -1,4 +1,4 @@
1
- import type { InternalResource, InternalUrl, ProtocolHandler } from "./types";
1
+ import type { InternalResource, InternalUrl, ProtocolHandler, UrlCompletion } from "./types";
2
2
  /**
3
3
  * Handler for omp:// URLs.
4
4
  *
@@ -9,4 +9,5 @@ export declare class OmpProtocolHandler implements ProtocolHandler {
9
9
  readonly scheme = "omp";
10
10
  readonly immutable = true;
11
11
  resolve(url: InternalUrl): Promise<InternalResource>;
12
+ complete(): Promise<UrlCompletion[]>;
12
13
  }
@@ -1,4 +1,4 @@
1
- import type { InternalResource, ProtocolHandler, ResolveContext } from "./types";
1
+ import type { InternalResource, ProtocolHandler, ResolveContext, UrlCompletion } from "./types";
2
2
  export declare class InternalUrlRouter {
3
3
  #private;
4
4
  constructor();
@@ -10,5 +10,12 @@ export declare class InternalUrlRouter {
10
10
  unregister(scheme: string): boolean;
11
11
  getHandler(scheme: string): ProtocolHandler | undefined;
12
12
  canHandle(input: string): boolean;
13
+ /** Schemes whose handler supports host/path autocomplete. */
14
+ completionSchemes(): string[];
15
+ /**
16
+ * Candidate completions for the host/path portion of `scheme://<query>`.
17
+ * Returns `null` when the scheme is unknown or does not support completion.
18
+ */
19
+ complete(scheme: string, query: string): Promise<UrlCompletion[] | null>;
13
20
  resolve(input: string, context?: ResolveContext): Promise<InternalResource>;
14
21
  }
@@ -1,6 +1,7 @@
1
- import type { InternalResource, InternalUrl, ProtocolHandler } from "./types";
1
+ import type { InternalResource, InternalUrl, ProtocolHandler, UrlCompletion } from "./types";
2
2
  export declare class RuleProtocolHandler implements ProtocolHandler {
3
3
  readonly scheme = "rule";
4
4
  readonly immutable = true;
5
5
  resolve(url: InternalUrl): Promise<InternalResource>;
6
+ complete(): Promise<UrlCompletion[]>;
6
7
  }
@@ -1,4 +1,4 @@
1
- import type { InternalResource, InternalUrl, ProtocolHandler } from "./types";
1
+ import type { InternalResource, InternalUrl, ProtocolHandler, UrlCompletion } from "./types";
2
2
  /**
3
3
  * Validate that a path is safe (no traversal, no absolute paths).
4
4
  */
@@ -10,4 +10,5 @@ export declare class SkillProtocolHandler implements ProtocolHandler {
10
10
  readonly scheme = "skill";
11
11
  readonly immutable = true;
12
12
  resolve(url: InternalUrl): Promise<InternalResource>;
13
+ complete(): Promise<UrlCompletion[]>;
13
14
  }
@@ -30,6 +30,21 @@ export interface InternalResource {
30
30
  */
31
31
  immutable?: boolean;
32
32
  }
33
+ /**
34
+ * A single autocomplete candidate for the host/path portion of a `scheme://`
35
+ * URL, produced by {@link ProtocolHandler.complete}.
36
+ */
37
+ export interface UrlCompletion {
38
+ /**
39
+ * The text that follows `scheme://` for this candidate (e.g. `humanizer`,
40
+ * `subdir/data.json`, `root`). The caller renders it as `scheme://<value>`.
41
+ */
42
+ value: string;
43
+ /** Human-facing label for the dropdown. Defaults to {@link value}. */
44
+ label?: string;
45
+ /** Optional one-line description shown beside the candidate. */
46
+ description?: string;
47
+ }
33
48
  /**
34
49
  * Parsed internal URL with preserved host casing.
35
50
  */
@@ -102,4 +117,15 @@ export interface ProtocolHandler {
102
117
  * surfaces a clear "not writable" error when invoked against them.
103
118
  */
104
119
  write?(url: InternalUrl, content: string, context?: WriteContext): Promise<void>;
120
+ /**
121
+ * Optional autocomplete hook. Returns candidate completions for the
122
+ * host/path portion of a `scheme://` URL while the user composes a prompt.
123
+ *
124
+ * Implementations **MUST** be fast and local — this runs on every keystroke.
125
+ * Schemes backed by network or external CLIs (issue://, pr://, vault://,
126
+ * mcp://) omit it. The caller fuzzy-filters the returned set against the
127
+ * partially typed `query`, so handlers return their full (bounded) candidate
128
+ * list; `query` is provided only so handlers can scope expensive enumeration.
129
+ */
130
+ complete?(query: string): Promise<UrlCompletion[]>;
105
131
  }
@@ -1,3 +1,4 @@
1
+ export * from "../mnemosyne";
1
2
  export * from "./local-backend";
2
3
  export * from "./off-backend";
3
4
  export * from "./resolve";
@@ -6,7 +6,8 @@ import type { MemoryBackend } from "./types";
6
6
  * Selection rules (single source of truth — every memory consumer routes
7
7
  * through this):
8
8
  * - `memory.backend === "hindsight"` → Hindsight remote memory
9
- * - `memory.backend === "local"` → local pipeline
9
+ * - `memory.backend === "mnemosyne"` → local Mnemosyne SQLite memory
10
+ * - `memory.backend === "local"` → local rollout summary pipeline
10
11
  * - everything else → no-op
11
12
  *
12
13
  * `memories.enabled` remains accepted only as a legacy migration input. Once
@@ -9,8 +9,9 @@ import type { AgentMessage } from "@oh-my-pi/pi-agent-core";
9
9
  import type { ModelRegistry } from "../config/model-registry";
10
10
  import type { Settings } from "../config/settings";
11
11
  import type { HindsightSessionState } from "../hindsight/state";
12
+ import type { MnemosyneSessionState } from "../mnemosyne/state";
12
13
  import type { AgentSession } from "../session/agent-session";
13
- export type MemoryBackendId = "off" | "local" | "hindsight";
14
+ export type MemoryBackendId = "off" | "local" | "hindsight" | "mnemosyne";
14
15
  export interface MemoryBackendStartOptions {
15
16
  session: AgentSession;
16
17
  settings: Settings;
@@ -18,6 +19,7 @@ export interface MemoryBackendStartOptions {
18
19
  agentDir: string;
19
20
  taskDepth: number;
20
21
  parentHindsightSessionState?: HindsightSessionState;
22
+ parentMnemosyneSessionState?: MnemosyneSessionState;
21
23
  }
22
24
  export interface MemoryBackend {
23
25
  readonly id: MemoryBackendId;
@@ -38,6 +40,10 @@ export interface MemoryBackend {
38
40
  clear(agentDir: string, cwd: string, session?: AgentSession): Promise<void>;
39
41
  /** Force consolidation/retain to happen now (slash `/memory enqueue`). */
40
42
  enqueue(agentDir: string, cwd: string, session?: AgentSession): Promise<void>;
43
+ /** Render backend-specific memory statistics as markdown (`/memory stats`). */
44
+ stats?(agentDir: string, cwd: string, session?: AgentSession): Promise<string | undefined>;
45
+ /** Render backend-specific memory diagnostics as markdown (`/memory diagnose`). */
46
+ diagnose?(agentDir: string, cwd: string, session?: AgentSession): Promise<string | undefined>;
41
47
  /**
42
48
  * Optional hook to inject a backend-specific block into the current turn's
43
49
  * system prompt before the agent starts generating.
@@ -0,0 +1,4 @@
1
+ import type { MemoryBackend } from "../memory-backend/types";
2
+ import type { AgentSession } from "../session/agent-session";
3
+ export declare const mnemosyneBackend: MemoryBackend;
4
+ export declare function getMnemosyneDbDirForTests(session: AgentSession): string | undefined;
@@ -0,0 +1,29 @@
1
+ import type { MnemosyneOptions } from "@oh-my-pi/pi-mnemosyne";
2
+ import type { Settings } from "../config/settings";
3
+ export type MnemosyneLlmMode = "none" | "smol" | "remote";
4
+ export type MnemosyneScoping = "global" | "per-project" | "per-project-tagged";
5
+ export type MnemosyneProviderOptions = Pick<MnemosyneOptions, "noEmbeddings" | "embeddingModel" | "embeddingApiUrl" | "embeddingApiKey" | "llm">;
6
+ export interface MnemosyneBackendConfig {
7
+ dbPath: string;
8
+ baseBank?: string;
9
+ bank: string;
10
+ globalBank?: string;
11
+ retainBank?: string;
12
+ recallBanks?: readonly string[];
13
+ scoping?: MnemosyneScoping;
14
+ autoRecall: boolean;
15
+ autoRetain: boolean;
16
+ retainEveryNTurns: number;
17
+ recallLimit: number;
18
+ recallContextTurns: number;
19
+ recallMaxQueryChars: number;
20
+ injectionTokenLimit: number;
21
+ debug: boolean;
22
+ providerOptions: MnemosyneProviderOptions;
23
+ llmMode: MnemosyneLlmMode;
24
+ llmBaseUrl?: string;
25
+ llmApiKey?: string;
26
+ llmModel?: string;
27
+ }
28
+ export declare function loadMnemosyneConfig(settings: Settings, agentDir: string): MnemosyneBackendConfig;
29
+ export declare function truncateApproxTokens(text: string, tokenLimit: number): string;
@@ -0,0 +1,3 @@
1
+ export * from "./backend";
2
+ export * from "./config";
3
+ export * from "./state";
@@ -0,0 +1,72 @@
1
+ import type { AgentMessage } from "@oh-my-pi/pi-agent-core";
2
+ import { Mnemosyne, type RecallResult } from "@oh-my-pi/pi-mnemosyne";
3
+ import type { AgentSession } from "../session/agent-session";
4
+ import type { MnemosyneBackendConfig } from "./config";
5
+ interface MnemosyneScopedMemory {
6
+ bank: string;
7
+ memory: Mnemosyne;
8
+ }
9
+ type MnemosyneRememberInput = Parameters<Mnemosyne["remember"]>[0];
10
+ type MnemosyneRememberOptions = Parameters<Mnemosyne["remember"]>[1];
11
+ export type MnemosyneMemoryEditOperation = "update" | "forget" | "invalidate";
12
+ export interface MnemosyneMemoryEditOptions {
13
+ content?: string;
14
+ importance?: number;
15
+ replacementId?: string;
16
+ }
17
+ export interface MnemosyneMemoryEditResult {
18
+ status: "updated" | "deleted" | "invalidated" | "not_found";
19
+ bank?: string;
20
+ store?: "working" | "episodic";
21
+ }
22
+ export declare function getMnemosyneSessionState(session: AgentSession | undefined): MnemosyneSessionState | undefined;
23
+ export declare function setMnemosyneSessionState(session: AgentSession, state: MnemosyneSessionState | undefined): MnemosyneSessionState | undefined;
24
+ export interface MnemosyneSessionStateOptions {
25
+ sessionId: string;
26
+ config: MnemosyneBackendConfig;
27
+ session: AgentSession;
28
+ aliasOf?: MnemosyneSessionState;
29
+ lastRetainedTurn?: number;
30
+ hasRecalledForFirstTurn?: boolean;
31
+ }
32
+ export declare class MnemosyneSessionState {
33
+ sessionId: string;
34
+ readonly config: MnemosyneBackendConfig;
35
+ readonly session: AgentSession;
36
+ readonly memory: Mnemosyne;
37
+ readonly globalMemory?: Mnemosyne;
38
+ readonly aliasOf?: MnemosyneSessionState;
39
+ private readonly scoped;
40
+ lastRetainedTurn: number;
41
+ hasRecalledForFirstTurn: boolean;
42
+ lastRecallSnippet?: string;
43
+ unsubscribe?: () => void;
44
+ constructor(options: MnemosyneSessionStateOptions);
45
+ setSessionId(sessionId: string): void;
46
+ resetConversationTracking(): void;
47
+ getScopedRecallTargets(): readonly MnemosyneScopedMemory[];
48
+ getScopedRetainTarget(): MnemosyneScopedMemory;
49
+ editScopedMemory(op: MnemosyneMemoryEditOperation, id: string, options?: MnemosyneMemoryEditOptions): MnemosyneMemoryEditResult;
50
+ formatScopedRecallWithIds(results: readonly RecallResult[]): string;
51
+ collectScopedRecallResults(query: string): RecallResult[];
52
+ recallResultsScoped(query: string): RecallResult[];
53
+ formatScopedRecallContext(results: readonly RecallResult[], format?: "bullet" | "json"): string | undefined;
54
+ formatContextScoped(results: readonly RecallResult[], format?: "bullet" | "json"): string;
55
+ rememberInScope(memory: MnemosyneRememberInput, options?: MnemosyneRememberOptions): string | undefined;
56
+ rememberScoped(memory: MnemosyneRememberInput, options?: MnemosyneRememberOptions): string | undefined;
57
+ recallForContext(query: string): Promise<string | undefined>;
58
+ beforeAgentStartPrompt(promptText: string): Promise<string | undefined>;
59
+ recallForCompaction(messages: AgentMessage[]): Promise<string | undefined>;
60
+ maybeRetainOnAgentEnd(_messages: AgentMessage[]): Promise<void>;
61
+ forceRetainCurrentSession(): Promise<void>;
62
+ retainMessages(messages: Array<{
63
+ role: string;
64
+ content: string;
65
+ }>, sourceId: string): Promise<void>;
66
+ attachSessionListeners(): void;
67
+ maybeRecallOnAgentStart(): Promise<void>;
68
+ dispose(): void;
69
+ }
70
+ export declare function getMnemosyneScopedDbPaths(config: MnemosyneBackendConfig): readonly string[];
71
+ export declare function getMnemosyneScopedBanks(config: MnemosyneBackendConfig): readonly string[];
72
+ export {};
@@ -1,14 +1,13 @@
1
1
  import { Editor, type KeyId } from "@oh-my-pi/pi-tui";
2
2
  import type { AppKeybinding } from "../../config/keybindings";
3
- import { highlightUltrathink } from "../ultrathink";
4
3
  type ConfigurableEditorAction = Extract<AppKeybinding, "app.interrupt" | "app.clear" | "app.exit" | "app.suspend" | "app.thinking.cycle" | "app.model.cycleForward" | "app.model.cycleBackward" | "app.model.select" | "app.model.selectTemporary" | "app.tools.expand" | "app.thinking.toggle" | "app.editor.external" | "app.history.search" | "app.message.dequeue" | "app.clipboard.pasteImage" | "app.clipboard.copyPrompt">;
5
4
  /**
6
5
  * Custom editor that handles configurable app-level shortcuts for coding-agent.
7
6
  */
8
7
  export declare class CustomEditor extends Editor {
9
8
  #private;
10
- /** Rainbow-highlight the "ultrathink" keyword as the user types it. */
11
- decorateText: typeof highlightUltrathink;
9
+ /** Gradient-highlight the "ultrathink" / "orchestrate" keywords as the user types them. */
10
+ decorateText: (text: string) => string;
12
11
  onEscape?: () => void;
13
12
  shouldBypassAutocompleteOnEscape?: () => boolean;
14
13
  onClear?: () => void;
@@ -3,6 +3,32 @@
3
3
  * Displays a list of string options with keyboard navigation.
4
4
  */
5
5
  import { Container, type TUI } from "@oh-my-pi/pi-tui";
6
+ import { type ThemeColor } from "../../modes/theme/theme";
7
+ /** One segment of a {@link HookSelectorSlider} — a label, its accent color, and
8
+ * an optional detail line (e.g. the resolved model name) shown beneath the
9
+ * track while the segment is active. */
10
+ export interface HookSelectorSliderSegment {
11
+ label: string;
12
+ /** Theme color for the segment label; defaults to `accent`. */
13
+ color?: ThemeColor;
14
+ /** Secondary line rendered under the track when this segment is selected. */
15
+ detail?: string;
16
+ }
17
+ /**
18
+ * A horizontal left/right selector rendered above the option list. Unlike the
19
+ * up/down option cursor, the slider is moved with the left/right arrows from
20
+ * any list position, letting the caller capture an orthogonal choice (e.g. the
21
+ * model tier to continue execution with) alongside the selected option.
22
+ */
23
+ export interface HookSelectorSlider {
24
+ /** Dim caption rendered before the slider track (e.g. "continue with"). */
25
+ caption?: string;
26
+ segments: HookSelectorSliderSegment[];
27
+ /** Initially highlighted segment index. */
28
+ index: number;
29
+ /** Invoked with the new index whenever the slider moves. */
30
+ onChange?: (index: number) => void;
31
+ }
6
32
  export interface HookSelectorOptions {
7
33
  tui?: TUI;
8
34
  timeout?: number;
@@ -14,6 +40,7 @@ export interface HookSelectorOptions {
14
40
  onRight?: () => void;
15
41
  onExternalEditor?: () => void;
16
42
  helpText?: string;
43
+ slider?: HookSelectorSlider;
17
44
  }
18
45
  export declare class HookSelectorComponent extends Container {
19
46
  #private;
@@ -25,6 +25,7 @@ export * from "./show-images-selector";
25
25
  export * from "./status-line";
26
26
  export * from "./theme-selector";
27
27
  export * from "./thinking-selector";
28
+ export * from "./tiny-title-download-progress";
28
29
  export * from "./todo-reminder";
29
30
  export * from "./tool-execution";
30
31
  export * from "./tree-selector";
@@ -1,4 +1,10 @@
1
1
  import type { ThemeColor } from "../../../modes/theme/theme";
2
2
  export type ContextUsageLevel = "normal" | "warning" | "purple" | "error";
3
3
  export declare function getContextUsageLevel(contextPercent: number, contextWindow: number): ContextUsageLevel;
4
+ /**
5
+ * Format context usage as `<percent>%/<window>` (e.g. `5.1%/1M`), matching the
6
+ * status line's context gauge so subagent and footer renderers stay in sync.
7
+ * A `null`/`undefined` percent (unknown, e.g. right after compaction) renders as `?`.
8
+ */
9
+ export declare function formatContextUsage(contextPercent: number | null | undefined, contextWindow: number): string;
4
10
  export declare function getContextUsageThemeColor(level: ContextUsageLevel): ThemeColor;
@@ -0,0 +1,11 @@
1
+ import { type Component } from "@oh-my-pi/pi-tui";
2
+ import { type TinyTitleLocalModelKey } from "../../tiny/models";
3
+ import type { TinyTitleProgressEvent } from "../../tiny/title-protocol";
4
+ export declare class TinyTitleDownloadProgressComponent implements Component {
5
+ #private;
6
+ constructor(modelKey: TinyTitleLocalModelKey);
7
+ update(event: TinyTitleProgressEvent): void;
8
+ isComplete(): boolean;
9
+ invalidate(): void;
10
+ render(width: number): string[];
11
+ }
@@ -1,4 +1,5 @@
1
1
  import { type Component } from "@oh-my-pi/pi-tui";
2
+ export declare function renderWelcomeTip(tip: string, boxWidth: number): string[];
2
3
  export interface RecentSession {
3
4
  name: string;
4
5
  timeAgo: string;
@@ -1,6 +1,7 @@
1
1
  import type { Component, TUI } from "@oh-my-pi/pi-tui";
2
2
  import { KeybindingsManager } from "../../config/keybindings";
3
3
  import type { ExtensionUIContext, ExtensionUIDialogOptions, ExtensionWidgetContent, ExtensionWidgetOptions, TerminalInputHandler } from "../../extensibility/extensions";
4
+ import { type HookSelectorSlider } from "../../modes/components/hook-selector";
4
5
  import { type Theme } from "../../modes/theme/theme";
5
6
  import type { InteractiveModeContext } from "../../modes/types";
6
7
  export declare class ExtensionUiController {
@@ -29,7 +30,9 @@ export declare class ExtensionUiController {
29
30
  /**
30
31
  * Show a selector for hooks.
31
32
  */
32
- showHookSelector(title: string, options: string[], dialogOptions?: ExtensionUIDialogOptions): Promise<string | undefined>;
33
+ showHookSelector(title: string, options: string[], dialogOptions?: ExtensionUIDialogOptions, extra?: {
34
+ slider?: HookSelectorSlider;
35
+ }): Promise<string | undefined>;
33
36
  /**
34
37
  * Hide the hook selector.
35
38
  */
@@ -0,0 +1,23 @@
1
+ /** Declarative spec for {@link createGradientHighlighter}. */
2
+ export interface GradientHighlightSpec {
3
+ /** Cheap, stateless presence probe used to skip the boundary regex on most lines. Must be non-global. */
4
+ probe: RegExp;
5
+ /** Global, word-bounded match regex walked by `.replace`. */
6
+ highlight: RegExp;
7
+ /** Number of color stops swept across the gradient. */
8
+ stops: number;
9
+ /** Maps a normalized position `t` in [0, 1) to an HSL hue in degrees. */
10
+ hue: (t: number) => number;
11
+ /** HSL saturation percentage. Default 90. */
12
+ saturation?: number;
13
+ /** HSL lightness percentage. Default 62. */
14
+ lightness?: number;
15
+ }
16
+ /**
17
+ * Build a stateless highlighter that paints each standalone match of `highlight`
18
+ * with a smooth HSL gradient for editor display. The returned function adds only
19
+ * zero-width SGR escapes — the visible width is unchanged — and returns the input
20
+ * untouched when `probe` does not match. The palette is compiled lazily and
21
+ * memoized per active color mode.
22
+ */
23
+ export declare function createGradientHighlighter(spec: GradientHighlightSpec): (text: string) => string;
@@ -19,7 +19,7 @@ import { CustomEditor } from "./components/custom-editor";
19
19
  import type { EvalExecutionComponent } from "./components/eval-execution";
20
20
  import type { HookEditorComponent } from "./components/hook-editor";
21
21
  import type { HookInputComponent } from "./components/hook-input";
22
- import type { HookSelectorComponent } from "./components/hook-selector";
22
+ import type { HookSelectorComponent, HookSelectorSlider } from "./components/hook-selector";
23
23
  import { StatusLineComponent } from "./components/status-line";
24
24
  import type { ToolExecutionHandle } from "./components/tool-execution";
25
25
  import { type LoopLimitRuntime } from "./loop-limit";
@@ -248,7 +248,9 @@ export declare class InteractiveMode implements InteractiveModeContext {
248
248
  emitCustomToolSessionEvent(reason: "start" | "switch" | "branch" | "tree" | "shutdown", previousSessionFile?: string): Promise<void>;
249
249
  setHookWidget(key: string, content: ExtensionWidgetContent, options?: ExtensionWidgetOptions): void;
250
250
  setHookStatus(key: string, text: string | undefined): void;
251
- showHookSelector(title: string, options: string[], dialogOptions?: ExtensionUIDialogOptions): Promise<string | undefined>;
251
+ showHookSelector(title: string, options: string[], dialogOptions?: ExtensionUIDialogOptions, extra?: {
252
+ slider?: HookSelectorSlider;
253
+ }): Promise<string | undefined>;
252
254
  hideHookSelector(): void;
253
255
  showHookInput(title: string, placeholder?: string): Promise<string | undefined>;
254
256
  hideHookInput(): void;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Autocomplete for internal-url schemes (skill://, rule://, omp://, local://,
3
+ * memory://, agent://, artifact://) while composing a prompt.
4
+ *
5
+ * Detection here MUST stay in sync with the generic URL-scheme trigger in the
6
+ * TUI editor (`packages/tui/src/components/editor.ts`); the editor fires the
7
+ * popup, this module decides whether there are candidates to show.
8
+ */
9
+ import type { AutocompleteItem } from "@oh-my-pi/pi-tui";
10
+ export interface InternalUrlContext {
11
+ /** Lowercased scheme (e.g. `local`). */
12
+ scheme: string;
13
+ /** Text typed after the slashes so far (host + path); may be empty. */
14
+ query: string;
15
+ /** Exact buffer token from its boundary to the cursor (the completion prefix). */
16
+ token: string;
17
+ }
18
+ /**
19
+ * Detect a completable internal-url token immediately before the cursor.
20
+ * Returns `null` when the text is not a `scheme://` token whose scheme is
21
+ * registered with a completion-capable handler.
22
+ */
23
+ export declare function extractInternalUrlContext(textBeforeCursor: string): InternalUrlContext | null;
24
+ /**
25
+ * Suggestions for the internal-url token ending at the cursor, or `null` when
26
+ * the text is not such a token or no candidate matches the typed query.
27
+ */
28
+ export declare function getInternalUrlSuggestions(textBeforeCursor: string): Promise<{
29
+ items: AutocompleteItem[];
30
+ prefix: string;
31
+ } | null>;
32
+ /** Whether `prefix` (the token a completion was offered for) is an internal-url token. */
33
+ export declare function isInternalUrlPrefix(prefix: string): boolean;
34
+ /**
35
+ * Replace the internal-url token with the selected candidate, appending a
36
+ * trailing space (matching `@` file-reference behavior) so the user can keep
37
+ * typing.
38
+ */
39
+ export declare function applyInternalUrlCompletion(lines: string[], cursorLine: number, cursorCol: number, item: AutocompleteItem, prefix: string): {
40
+ lines: string[];
41
+ cursorLine: number;
42
+ cursorCol: number;
43
+ };
@@ -0,0 +1,10 @@
1
+ /** Hidden system notice appended after a user message that mentions "orchestrate". */
2
+ export declare const ORCHESTRATE_NOTICE: string;
3
+ /** Whether `text` contains the standalone keyword "orchestrate" (any case). */
4
+ export declare function containsOrchestrate(text: string): boolean;
5
+ /**
6
+ * Highlight every standalone "orchestrate" in `text` for editor display with a
7
+ * cool teal→violet gradient (hue 150..280), visually distinct from ultrathink's
8
+ * full-spectrum rainbow.
9
+ */
10
+ export declare const highlightOrchestrate: (text: string) => string;