@oh-my-pi/pi-coding-agent 15.5.15 → 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 (167) hide show
  1. package/CHANGELOG.md +46 -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/settings-schema.d.ts +232 -7
  14. package/dist/types/discovery/helpers.d.ts +1 -1
  15. package/dist/types/discovery/substitute-plugin-root.d.ts +0 -4
  16. package/dist/types/eval/js/shared/rewrite-imports.d.ts +16 -1
  17. package/dist/types/internal-urls/agent-protocol.d.ts +2 -1
  18. package/dist/types/internal-urls/artifact-protocol.d.ts +2 -1
  19. package/dist/types/internal-urls/local-protocol.d.ts +2 -1
  20. package/dist/types/internal-urls/memory-protocol.d.ts +2 -1
  21. package/dist/types/internal-urls/omp-protocol.d.ts +2 -1
  22. package/dist/types/internal-urls/router.d.ts +8 -1
  23. package/dist/types/internal-urls/rule-protocol.d.ts +2 -1
  24. package/dist/types/internal-urls/skill-protocol.d.ts +2 -1
  25. package/dist/types/internal-urls/types.d.ts +26 -0
  26. package/dist/types/memory-backend/index.d.ts +1 -0
  27. package/dist/types/memory-backend/resolve.d.ts +2 -1
  28. package/dist/types/memory-backend/types.d.ts +7 -1
  29. package/dist/types/mnemosyne/backend.d.ts +4 -0
  30. package/dist/types/mnemosyne/config.d.ts +29 -0
  31. package/dist/types/mnemosyne/index.d.ts +3 -0
  32. package/dist/types/mnemosyne/state.d.ts +72 -0
  33. package/dist/types/modes/components/custom-editor.d.ts +2 -3
  34. package/dist/types/modes/components/hook-selector.d.ts +27 -0
  35. package/dist/types/modes/components/index.d.ts +1 -0
  36. package/dist/types/modes/components/status-line/context-thresholds.d.ts +6 -0
  37. package/dist/types/modes/components/tiny-title-download-progress.d.ts +11 -0
  38. package/dist/types/modes/components/welcome.d.ts +1 -0
  39. package/dist/types/modes/controllers/extension-ui-controller.d.ts +4 -1
  40. package/dist/types/modes/gradient-highlight.d.ts +23 -0
  41. package/dist/types/modes/interactive-mode.d.ts +4 -2
  42. package/dist/types/modes/internal-url-autocomplete.d.ts +43 -0
  43. package/dist/types/modes/orchestrate.d.ts +10 -0
  44. package/dist/types/modes/theme/defaults/index.d.ts +8406 -8406
  45. package/dist/types/modes/ultrathink.d.ts +3 -3
  46. package/dist/types/modes/utils/keybinding-matchers.d.ts +5 -0
  47. package/dist/types/sdk.d.ts +3 -0
  48. package/dist/types/session/agent-session.d.ts +33 -0
  49. package/dist/types/system-prompt.d.ts +2 -0
  50. package/dist/types/task/executor.d.ts +2 -0
  51. package/dist/types/task/render.d.ts +5 -1
  52. package/dist/types/tiny/models.d.ts +185 -0
  53. package/dist/types/tiny/text.d.ts +4 -0
  54. package/dist/types/tiny/title-client.d.ts +24 -0
  55. package/dist/types/tiny/title-protocol.d.ts +74 -0
  56. package/dist/types/tiny/worker.d.ts +2 -0
  57. package/dist/types/tools/bash.d.ts +3 -1
  58. package/dist/types/tools/index.d.ts +7 -3
  59. package/dist/types/tools/memory-edit.d.ts +40 -0
  60. package/dist/types/tools/{hindsight-recall.d.ts → memory-recall.d.ts} +6 -6
  61. package/dist/types/tools/{hindsight-reflect.d.ts → memory-reflect.d.ts} +6 -6
  62. package/dist/types/tools/memory-render.d.ts +60 -0
  63. package/dist/types/tools/{hindsight-retain.d.ts → memory-retain.d.ts} +6 -6
  64. package/dist/types/tools/todo-write.d.ts +8 -0
  65. package/dist/types/tools/tool-result.d.ts +2 -0
  66. package/dist/types/utils/title-generator.d.ts +3 -0
  67. package/package.json +18 -14
  68. package/scripts/build-binary.ts +1 -0
  69. package/src/cli/tiny-models-cli.ts +127 -0
  70. package/src/cli-commands.ts +1 -0
  71. package/src/cli.ts +8 -8
  72. package/src/commands/tiny-models.ts +36 -0
  73. package/src/config/model-equivalence.ts +43 -2
  74. package/src/config/model-id-affixes.ts +64 -0
  75. package/src/config/model-registry.ts +84 -10
  76. package/src/config/settings-schema.ts +205 -4
  77. package/src/edit/hashline/diff.ts +5 -7
  78. package/src/eval/__tests__/shared-executors.test.ts +36 -0
  79. package/src/eval/js/shared/local-module-loader.ts +13 -1
  80. package/src/eval/js/shared/rewrite-imports.ts +31 -26
  81. package/src/internal-urls/agent-protocol.ts +18 -1
  82. package/src/internal-urls/artifact-protocol.ts +19 -1
  83. package/src/internal-urls/docs-index.generated.ts +3 -1
  84. package/src/internal-urls/local-protocol.ts +14 -1
  85. package/src/internal-urls/memory-protocol.ts +6 -1
  86. package/src/internal-urls/omp-protocol.ts +5 -1
  87. package/src/internal-urls/router.ts +20 -1
  88. package/src/internal-urls/rule-protocol.ts +8 -1
  89. package/src/internal-urls/skill-protocol.ts +8 -1
  90. package/src/internal-urls/types.ts +27 -0
  91. package/src/lsp/render.ts +1 -1
  92. package/src/mcp/oauth-flow.ts +2 -2
  93. package/src/memory-backend/index.ts +1 -0
  94. package/src/memory-backend/resolve.ts +4 -1
  95. package/src/memory-backend/types.ts +8 -1
  96. package/src/mnemosyne/backend.ts +374 -0
  97. package/src/mnemosyne/config.ts +160 -0
  98. package/src/mnemosyne/index.ts +3 -0
  99. package/src/mnemosyne/state.ts +548 -0
  100. package/src/modes/acp/acp-agent.ts +11 -6
  101. package/src/modes/components/agent-dashboard.ts +4 -4
  102. package/src/modes/components/custom-editor.ts +3 -2
  103. package/src/modes/components/diff.ts +2 -2
  104. package/src/modes/components/extensions/extension-list.ts +3 -2
  105. package/src/modes/components/footer.ts +5 -6
  106. package/src/modes/components/history-search.ts +3 -3
  107. package/src/modes/components/hook-selector.ts +94 -8
  108. package/src/modes/components/index.ts +1 -0
  109. package/src/modes/components/mcp-add-wizard.ts +3 -3
  110. package/src/modes/components/model-selector.ts +5 -4
  111. package/src/modes/components/oauth-selector.ts +3 -3
  112. package/src/modes/components/session-observer-overlay.ts +19 -13
  113. package/src/modes/components/session-selector.ts +3 -3
  114. package/src/modes/components/settings-defs.ts +7 -0
  115. package/src/modes/components/status-line/context-thresholds.ts +11 -0
  116. package/src/modes/components/status-line/segments.ts +2 -2
  117. package/src/modes/components/tiny-title-download-progress.ts +90 -0
  118. package/src/modes/components/tips.txt +12 -0
  119. package/src/modes/components/tool-execution.ts +67 -3
  120. package/src/modes/components/tree-selector.ts +3 -3
  121. package/src/modes/components/user-message-selector.ts +3 -3
  122. package/src/modes/components/welcome.ts +55 -1
  123. package/src/modes/controllers/command-controller.ts +16 -1
  124. package/src/modes/controllers/extension-ui-controller.ts +3 -1
  125. package/src/modes/controllers/input-controller.ts +57 -0
  126. package/src/modes/gradient-highlight.ts +70 -0
  127. package/src/modes/interactive-mode.ts +58 -109
  128. package/src/modes/internal-url-autocomplete.ts +143 -0
  129. package/src/modes/orchestrate.ts +36 -0
  130. package/src/modes/prompt-action-autocomplete.ts +12 -0
  131. package/src/modes/ultrathink.ts +9 -53
  132. package/src/modes/utils/keybinding-matchers.ts +11 -0
  133. package/src/prompts/system/memory-consolidation-system.md +8 -0
  134. package/src/prompts/system/memory-extraction-system.md +26 -0
  135. package/src/prompts/{commands/orchestrate.md → system/orchestrate-notice.md} +5 -16
  136. package/src/prompts/system/system-prompt.md +2 -0
  137. package/src/prompts/system/tiny-title-system.md +8 -0
  138. package/src/prompts/tools/memory-edit.md +8 -0
  139. package/src/prompts/tools/task.md +4 -7
  140. package/src/sdk.ts +8 -6
  141. package/src/session/agent-session.ts +128 -44
  142. package/src/slash-commands/builtin-registry.ts +10 -1
  143. package/src/system-prompt.ts +4 -0
  144. package/src/task/commands.ts +1 -5
  145. package/src/task/executor.ts +8 -0
  146. package/src/task/index.ts +2 -0
  147. package/src/task/render.ts +69 -26
  148. package/src/tiny/models.ts +217 -0
  149. package/src/tiny/text.ts +19 -0
  150. package/src/tiny/title-client.ts +340 -0
  151. package/src/tiny/title-protocol.ts +51 -0
  152. package/src/tiny/worker.ts +523 -0
  153. package/src/tools/bash.ts +58 -16
  154. package/src/tools/browser/tab-worker.ts +1 -1
  155. package/src/tools/index.ts +17 -11
  156. package/src/tools/memory-edit.ts +59 -0
  157. package/src/tools/memory-recall.ts +100 -0
  158. package/src/tools/memory-reflect.ts +88 -0
  159. package/src/tools/memory-render.ts +185 -0
  160. package/src/tools/memory-retain.ts +91 -0
  161. package/src/tools/renderers.ts +4 -0
  162. package/src/tools/todo-write.ts +128 -29
  163. package/src/tools/tool-result.ts +8 -0
  164. package/src/utils/title-generator.ts +115 -13
  165. package/src/tools/hindsight-recall.ts +0 -69
  166. package/src/tools/hindsight-reflect.ts +0 -58
  167. package/src/tools/hindsight-retain.ts +0 -57
@@ -4,7 +4,7 @@ export declare const ULTRATHINK_NOTICE: string;
4
4
  export declare function containsUltrathink(text: string): boolean;
5
5
  /**
6
6
  * Rainbow-highlight every standalone "ultrathink" in `text` for editor display.
7
- * Adds only zero-width SGR escapes the visible width is unchanged and returns
8
- * the input untouched when the keyword is absent.
7
+ * Sweeps red→violet (hue 0..330), stopping short of the wrap back to red so the
8
+ * gradient resolves smoothly regardless of casing or match length.
9
9
  */
10
- export declare function highlightUltrathink(text: string): string;
10
+ export declare const highlightUltrathink: (text: string) => string;
@@ -6,5 +6,10 @@
6
6
  * keybindings registered. In that case, fall back to raw Escape matching.
7
7
  */
8
8
  export declare function matchesAppInterrupt(data: string): boolean;
9
+ /** Match the generic selector cancel keybinding. */
9
10
  export declare function matchesSelectCancel(data: string): boolean;
11
+ /** Match the generic selector up-navigation keybinding. */
12
+ export declare function matchesSelectUp(data: string): boolean;
13
+ /** Match the generic selector down-navigation keybinding. */
14
+ export declare function matchesSelectDown(data: string): boolean;
10
15
  export declare function matchesAppExternalEditor(data: string): boolean;
@@ -13,6 +13,7 @@ import { type FileSlashCommand } from "./extensibility/slash-commands";
13
13
  import type { HindsightSessionState } from "./hindsight/state";
14
14
  import { type LocalProtocolOptions } from "./internal-urls";
15
15
  import { MCPManager, type MCPToolsLoadResult } from "./mcp";
16
+ import { type MnemosyneSessionState } from "./mnemosyne/state";
16
17
  import { AgentRegistry } from "./registry/agent-registry";
17
18
  import { AgentSession } from "./session/agent-session";
18
19
  import { AuthStorage } from "./session/auth-storage";
@@ -97,6 +98,8 @@ export interface CreateAgentSessionOptions {
97
98
  taskDepth?: number;
98
99
  /** Parent Hindsight state to alias for subagent memory tools. */
99
100
  parentHindsightSessionState?: HindsightSessionState;
101
+ /** Parent Mnemosyne state to alias for subagent memory tools. */
102
+ parentMnemosyneSessionState?: MnemosyneSessionState;
100
103
  /** Pre-allocated agent identity for IRC routing. Default: "0-Main" for top-level, parentTaskPrefix-derived for sub. */
101
104
  agentId?: string;
102
105
  /** Display name for the agent in IRC. Default: "main" or "sub". */
@@ -35,6 +35,7 @@ import { type FileSlashCommand } from "../extensibility/slash-commands";
35
35
  import { GoalRuntime } from "../goals/runtime";
36
36
  import type { Goal, GoalModeState } from "../goals/state";
37
37
  import type { HindsightSessionState } from "../hindsight/state";
38
+ import { type MnemosyneSessionState } from "../mnemosyne/state";
38
39
  import type { PlanModeState } from "../plan-mode/state";
39
40
  import { type AgentRegistry } from "../registry/agent-registry";
40
41
  import { type SecretObfuscator } from "../secrets/obfuscator";
@@ -243,6 +244,20 @@ export interface RoleModelCycleResult {
243
244
  thinkingLevel: ThinkingLevel | undefined;
244
245
  role: string;
245
246
  }
247
+ /** A configured role resolved to a concrete model, used by role cycling and
248
+ * the plan-approval model slider. */
249
+ export interface ResolvedRoleModel {
250
+ role: string;
251
+ model: Model;
252
+ thinkingLevel?: ThinkingLevel;
253
+ explicitThinkingLevel: boolean;
254
+ }
255
+ /** The set of resolvable role models plus the index of the currently active
256
+ * one within {@link ResolvedRoleModel.role} order. */
257
+ export interface RoleModelCycle {
258
+ models: ResolvedRoleModel[];
259
+ currentIndex: number;
260
+ }
246
261
  /** Session statistics for /session command */
247
262
  export interface SessionStats {
248
263
  sessionFile: string | undefined;
@@ -294,6 +309,7 @@ export declare class AgentSession {
294
309
  get providerSessionState(): Map<string, ProviderSessionState>;
295
310
  getHindsightSessionState(): HindsightSessionState | undefined;
296
311
  setHindsightSessionState(state: HindsightSessionState | undefined): HindsightSessionState | undefined;
312
+ getMnemosyneSessionState(): MnemosyneSessionState | undefined;
297
313
  /** TTSR manager for time-traveling stream rules */
298
314
  get ttsrManager(): TtsrManager | undefined;
299
315
  /** Whether a TTSR abort is pending (stream was aborted to inject rules) */
@@ -607,6 +623,23 @@ export declare class AgentSession {
607
623
  * @returns The new model info, or undefined if only one model available
608
624
  */
609
625
  cycleModel(direction?: "forward" | "backward"): Promise<ModelCycleResult | undefined>;
626
+ /**
627
+ * Resolve the configured role models in the given order plus the index of
628
+ * the currently active one. Roles that have no configured model, or whose
629
+ * configured model is not currently available, are skipped. The `default`
630
+ * role falls back to the active model when no explicit assignment exists.
631
+ *
632
+ * Returns `undefined` only when there is no current model or no available
633
+ * models at all; an empty `models` array is never returned (callers should
634
+ * still guard on `models.length`).
635
+ */
636
+ getRoleModelCycle(roleOrder: readonly string[]): RoleModelCycle | undefined;
637
+ /**
638
+ * Apply a resolved role model as the active model, persisting the choice to
639
+ * settings under its role. Mirrors the non-temporary branch of
640
+ * {@link cycleRoleModels} and is shared with the plan-approval model slider.
641
+ */
642
+ applyRoleModel(entry: ResolvedRoleModel): Promise<void>;
610
643
  /**
611
644
  * Cycle through configured role models in a fixed order.
612
645
  * Skips missing roles.
@@ -82,6 +82,8 @@ export interface BuildSystemPromptOptions {
82
82
  secretsEnabled?: boolean;
83
83
  /** Pre-loaded workspace tree (skips discovery if provided). May be a Promise to allow early kick-off. */
84
84
  workspaceTree?: WorkspaceTree | Promise<WorkspaceTree>;
85
+ /** Whether the local memory://root summary is active. */
86
+ memoryRootEnabled?: boolean;
85
87
  }
86
88
  /** Result of building provider-facing system prompt messages. */
87
89
  export interface BuildSystemPromptResult {
@@ -11,6 +11,7 @@ import { type Skill } from "../extensibility/skills";
11
11
  import type { HindsightSessionState } from "../hindsight/state";
12
12
  import type { LocalProtocolOptions } from "../internal-urls";
13
13
  import type { MCPManager } from "../mcp/manager";
14
+ import type { MnemosyneSessionState } from "../mnemosyne/state";
14
15
  import type { ArtifactManager } from "../session/artifacts";
15
16
  import type { AuthStorage } from "../session/auth-storage";
16
17
  import type { ContextFileEntry } from "../tools";
@@ -64,6 +65,7 @@ export interface ExecutorOptions {
64
65
  */
65
66
  parentArtifactManager?: ArtifactManager;
66
67
  parentHindsightSessionState?: HindsightSessionState;
68
+ parentMnemosyneSessionState?: MnemosyneSessionState;
67
69
  /** Parent agent's eval executor session id. Subagents reuse it so eval state is shared. */
68
70
  parentEvalSessionId?: string;
69
71
  /**
@@ -5,7 +5,11 @@ import type { TaskParams, TaskToolDetails } from "./types";
5
5
  /**
6
6
  * Render the tool call arguments.
7
7
  */
8
- export declare function renderCall(args: TaskParams, _options: RenderResultOptions, theme: Theme): Component;
8
+ export declare function renderCall(args: TaskParams, options: RenderResultOptions & {
9
+ renderContext?: {
10
+ hasResult?: boolean;
11
+ };
12
+ }, theme: Theme): Component;
9
13
  /**
10
14
  * Render the tool result.
11
15
  */
@@ -0,0 +1,185 @@
1
+ /** Default session-title model: the online pi/smol path (no local download / CPU inference). */
2
+ export declare const ONLINE_TINY_TITLE_MODEL_KEY = "online";
3
+ /** Local model the `tiny-models` CLI downloads when none is named. Not the session-title default — that is {@link ONLINE_TINY_TITLE_MODEL_KEY}. */
4
+ export declare const DEFAULT_TINY_TITLE_LOCAL_MODEL_KEY = "lfm2-700m";
5
+ export interface TinyTitleLocalModelSpec {
6
+ key: string;
7
+ repo: string;
8
+ dtype: "q4";
9
+ label: string;
10
+ description: string;
11
+ contextNote: string;
12
+ }
13
+ export declare const TINY_TITLE_LOCAL_MODELS: readonly [{
14
+ readonly key: "lfm2-350m";
15
+ readonly repo: "onnx-community/LFM2-350M-ONNX";
16
+ readonly dtype: "q4";
17
+ readonly label: "LFM2 350M";
18
+ readonly description: "Recommended local model; best speed/quality balance, about 212 MB cached.";
19
+ readonly contextNote: "Best local default from the CPU title-generation spike.";
20
+ }, {
21
+ readonly key: "qwen3-0.6b";
22
+ readonly repo: "onnx-community/Qwen3-0.6B-ONNX";
23
+ readonly dtype: "q4";
24
+ readonly label: "Qwen3 0.6B";
25
+ readonly description: "Most robust local option; slower first load, about 500 MB cached.";
26
+ readonly contextNote: "Use when title quality matters more than local startup cost.";
27
+ }, {
28
+ readonly key: "gemma-270m";
29
+ readonly repo: "onnx-community/gemma-3-270m-it-ONNX";
30
+ readonly dtype: "q4";
31
+ readonly label: "Gemma 270M";
32
+ readonly description: "Smallest viable local option; lower quality, lowest cache footprint.";
33
+ readonly contextNote: "Use on constrained machines that still need local titles.";
34
+ }, {
35
+ readonly key: "qwen2.5-0.5b";
36
+ readonly repo: "onnx-community/Qwen2.5-0.5B-Instruct";
37
+ readonly dtype: "q4";
38
+ readonly label: "Qwen2.5 0.5B";
39
+ readonly description: "Balanced local fallback; moderate quality and cache footprint.";
40
+ readonly contextNote: "Useful when Qwen3 is too heavy but Gemma quality is insufficient.";
41
+ }, {
42
+ readonly key: "lfm2-700m";
43
+ readonly repo: "onnx-community/LFM2-700M-ONNX";
44
+ readonly dtype: "q4";
45
+ readonly label: "LFM2 700M";
46
+ readonly description: "Highest-quality local option; larger and slower than LFM2 350M.";
47
+ readonly contextNote: "Use when local title quality is preferred over startup cost.";
48
+ }];
49
+ export declare const TINY_TITLE_MODEL_VALUES: readonly ["online", "lfm2-350m", "qwen3-0.6b", "gemma-270m", "qwen2.5-0.5b", "lfm2-700m"];
50
+ export type TinyTitleModelKey = (typeof TINY_TITLE_MODEL_VALUES)[number];
51
+ export type TinyTitleLocalModelKey = (typeof TINY_TITLE_LOCAL_MODELS)[number]["key"];
52
+ export declare const TINY_TITLE_MODEL_OPTIONS: ({
53
+ value: "online";
54
+ label: string;
55
+ description: string;
56
+ } | {
57
+ value: "gemma-270m" | "lfm2-350m" | "lfm2-700m" | "qwen2.5-0.5b" | "qwen3-0.6b";
58
+ label: "Gemma 270M" | "LFM2 350M" | "LFM2 700M" | "Qwen2.5 0.5B" | "Qwen3 0.6B";
59
+ description: "Balanced local fallback; moderate quality and cache footprint." | "Highest-quality local option; larger and slower than LFM2 350M." | "Most robust local option; slower first load, about 500 MB cached." | "Recommended local model; best speed/quality balance, about 212 MB cached." | "Smallest viable local option; lower quality, lowest cache footprint.";
60
+ })[];
61
+ export declare function isTinyTitleLocalModelKey(value: string): value is TinyTitleLocalModelKey;
62
+ export declare function getTinyTitleModelSpec(key: TinyTitleLocalModelKey): (typeof TINY_TITLE_LOCAL_MODELS)[number];
63
+ /** Default memory model: the online path (the configured smol / remote LLM; no local download). */
64
+ export declare const ONLINE_MEMORY_MODEL_KEY = "online";
65
+ /** Recommended local model for memory tasks when none is named. */
66
+ export declare const DEFAULT_MEMORY_LOCAL_MODEL_KEY = "qwen3-1.7b";
67
+ /**
68
+ * Local models for Mnemosyne memory tasks (fact extraction + consolidation).
69
+ * These are larger (1B-1.7B) than the title models: structured extraction and
70
+ * faithful summarization need more capacity than 3-6 word titles. All q4, CPU.
71
+ * Ranking/recipe rationale lives in docs/local-models.md.
72
+ */
73
+ export declare const TINY_MEMORY_LOCAL_MODELS: readonly [{
74
+ readonly key: "qwen3-1.7b";
75
+ readonly repo: "onnx-community/Qwen3-1.7B-ONNX";
76
+ readonly dtype: "q4";
77
+ readonly label: "Qwen3 1.7B";
78
+ readonly description: "Recommended; most disciplined extraction (ignores chit-chat), good consolidation, about 1.1 GB cached.";
79
+ readonly contextNote: "Best single-model pick for memory from the CPU experiment.";
80
+ }, {
81
+ readonly key: "gemma-3-1b";
82
+ readonly repo: "onnx-community/gemma-3-1b-it-ONNX";
83
+ readonly dtype: "q4";
84
+ readonly label: "Gemma 3 1B";
85
+ readonly description: "Best consolidation/dedup; lighter footprint, but leaks small talk during extraction.";
86
+ readonly contextNote: "Use when consolidation quality and size matter most.";
87
+ }, {
88
+ readonly key: "qwen2.5-1.5b";
89
+ readonly repo: "onnx-community/Qwen2.5-1.5B-Instruct";
90
+ readonly dtype: "q4";
91
+ readonly label: "Qwen2.5 1.5B";
92
+ readonly description: "Best extraction granularity (atomic facts); weaker consolidation.";
93
+ readonly contextNote: "Use when fine-grained, deduplicatable facts matter more than summaries.";
94
+ }, {
95
+ readonly key: "lfm2-1.2b";
96
+ readonly repo: "onnx-community/LFM2-1.2B-ONNX";
97
+ readonly dtype: "q4";
98
+ readonly label: "LFM2 1.2B";
99
+ readonly description: "Fastest load; solid all-rounder, slightly noisier extraction labels.";
100
+ readonly contextNote: "Use when local startup cost is the priority.";
101
+ }];
102
+ export declare const TINY_MEMORY_MODEL_VALUES: readonly ["online", "qwen3-1.7b", "gemma-3-1b", "qwen2.5-1.5b", "lfm2-1.2b"];
103
+ export type TinyMemoryModelKey = (typeof TINY_MEMORY_MODEL_VALUES)[number];
104
+ export type TinyMemoryLocalModelKey = (typeof TINY_MEMORY_LOCAL_MODELS)[number]["key"];
105
+ export declare const TINY_MEMORY_MODEL_OPTIONS: ({
106
+ value: "online";
107
+ label: string;
108
+ description: string;
109
+ } | {
110
+ value: "gemma-3-1b" | "lfm2-1.2b" | "qwen2.5-1.5b" | "qwen3-1.7b";
111
+ label: "Gemma 3 1B" | "LFM2 1.2B" | "Qwen2.5 1.5B" | "Qwen3 1.7B";
112
+ description: "Best consolidation/dedup; lighter footprint, but leaks small talk during extraction." | "Best extraction granularity (atomic facts); weaker consolidation." | "Fastest load; solid all-rounder, slightly noisier extraction labels." | "Recommended; most disciplined extraction (ignores chit-chat), good consolidation, about 1.1 GB cached.";
113
+ })[];
114
+ export declare function isTinyMemoryLocalModelKey(value: string): value is TinyMemoryLocalModelKey;
115
+ export declare function getTinyMemoryModelSpec(key: TinyMemoryLocalModelKey): (typeof TINY_MEMORY_LOCAL_MODELS)[number];
116
+ /** Any local model key (title or memory), used by the shared inference worker. */
117
+ export type TinyLocalModelKey = TinyTitleLocalModelKey | TinyMemoryLocalModelKey;
118
+ /** Resolve a local model spec by key across both the title and memory registries. */
119
+ export declare function getTinyLocalModelSpec(key: string): TinyTitleLocalModelSpec | undefined;
120
+ export declare function isTinyLocalModelKey(value: string): value is TinyLocalModelKey;
121
+ /** Combined local model registry (title + memory) for the shared tiny-models CLI. */
122
+ export declare const TINY_LOCAL_MODELS: readonly [{
123
+ readonly key: "lfm2-350m";
124
+ readonly repo: "onnx-community/LFM2-350M-ONNX";
125
+ readonly dtype: "q4";
126
+ readonly label: "LFM2 350M";
127
+ readonly description: "Recommended local model; best speed/quality balance, about 212 MB cached.";
128
+ readonly contextNote: "Best local default from the CPU title-generation spike.";
129
+ }, {
130
+ readonly key: "qwen3-0.6b";
131
+ readonly repo: "onnx-community/Qwen3-0.6B-ONNX";
132
+ readonly dtype: "q4";
133
+ readonly label: "Qwen3 0.6B";
134
+ readonly description: "Most robust local option; slower first load, about 500 MB cached.";
135
+ readonly contextNote: "Use when title quality matters more than local startup cost.";
136
+ }, {
137
+ readonly key: "gemma-270m";
138
+ readonly repo: "onnx-community/gemma-3-270m-it-ONNX";
139
+ readonly dtype: "q4";
140
+ readonly label: "Gemma 270M";
141
+ readonly description: "Smallest viable local option; lower quality, lowest cache footprint.";
142
+ readonly contextNote: "Use on constrained machines that still need local titles.";
143
+ }, {
144
+ readonly key: "qwen2.5-0.5b";
145
+ readonly repo: "onnx-community/Qwen2.5-0.5B-Instruct";
146
+ readonly dtype: "q4";
147
+ readonly label: "Qwen2.5 0.5B";
148
+ readonly description: "Balanced local fallback; moderate quality and cache footprint.";
149
+ readonly contextNote: "Useful when Qwen3 is too heavy but Gemma quality is insufficient.";
150
+ }, {
151
+ readonly key: "lfm2-700m";
152
+ readonly repo: "onnx-community/LFM2-700M-ONNX";
153
+ readonly dtype: "q4";
154
+ readonly label: "LFM2 700M";
155
+ readonly description: "Highest-quality local option; larger and slower than LFM2 350M.";
156
+ readonly contextNote: "Use when local title quality is preferred over startup cost.";
157
+ }, {
158
+ readonly key: "qwen3-1.7b";
159
+ readonly repo: "onnx-community/Qwen3-1.7B-ONNX";
160
+ readonly dtype: "q4";
161
+ readonly label: "Qwen3 1.7B";
162
+ readonly description: "Recommended; most disciplined extraction (ignores chit-chat), good consolidation, about 1.1 GB cached.";
163
+ readonly contextNote: "Best single-model pick for memory from the CPU experiment.";
164
+ }, {
165
+ readonly key: "gemma-3-1b";
166
+ readonly repo: "onnx-community/gemma-3-1b-it-ONNX";
167
+ readonly dtype: "q4";
168
+ readonly label: "Gemma 3 1B";
169
+ readonly description: "Best consolidation/dedup; lighter footprint, but leaks small talk during extraction.";
170
+ readonly contextNote: "Use when consolidation quality and size matter most.";
171
+ }, {
172
+ readonly key: "qwen2.5-1.5b";
173
+ readonly repo: "onnx-community/Qwen2.5-1.5B-Instruct";
174
+ readonly dtype: "q4";
175
+ readonly label: "Qwen2.5 1.5B";
176
+ readonly description: "Best extraction granularity (atomic facts); weaker consolidation.";
177
+ readonly contextNote: "Use when fine-grained, deduplicatable facts matter more than summaries.";
178
+ }, {
179
+ readonly key: "lfm2-1.2b";
180
+ readonly repo: "onnx-community/LFM2-1.2B-ONNX";
181
+ readonly dtype: "q4";
182
+ readonly label: "LFM2 1.2B";
183
+ readonly description: "Fastest load; solid all-rounder, slightly noisier extraction labels.";
184
+ readonly contextNote: "Use when local startup cost is the priority.";
185
+ }];
@@ -0,0 +1,4 @@
1
+ export declare const MAX_TITLE_INPUT_CHARS = 2000;
2
+ export declare function truncateTitleInput(message: string): string;
3
+ export declare function formatTitleUserMessage(message: string): string;
4
+ export declare function normalizeGeneratedTitle(value: string | null | undefined): string | null;
@@ -0,0 +1,24 @@
1
+ import type { TinyTitleProgressEvent } from "./title-protocol";
2
+ export interface TinyTitleDownloadOptions {
3
+ signal?: AbortSignal;
4
+ onProgress?: (event: TinyTitleProgressEvent) => void;
5
+ }
6
+ export declare function createTinyTitleWorker(): Worker;
7
+ export declare class TinyTitleClient {
8
+ #private;
9
+ onProgress(listener: (event: TinyTitleProgressEvent) => void): () => void;
10
+ generate(modelKey: string, message: string, signal?: AbortSignal): Promise<string | null>;
11
+ complete(modelKey: string, prompt: string, options?: {
12
+ maxTokens?: number;
13
+ signal?: AbortSignal;
14
+ }): Promise<string | null>;
15
+ downloadModel(modelKey: string, options?: TinyTitleDownloadOptions): Promise<boolean>;
16
+ terminate(): Promise<void>;
17
+ }
18
+ export declare const tinyTitleClient: TinyTitleClient;
19
+ /** Alias for the shared tiny-model worker client (titles + memory completions). */
20
+ export declare const tinyModelClient: TinyTitleClient;
21
+ export declare function shutdownTinyTitleClient(): Promise<void>;
22
+ export declare function smokeTestTinyTitleWorker({ timeoutMs, }?: {
23
+ timeoutMs?: number;
24
+ }): Promise<void>;
@@ -0,0 +1,74 @@
1
+ import type { TinyLocalModelKey, TinyTitleLocalModelKey } from "./models";
2
+ export type TinyTitleProgressStatus = "initiate" | "download" | "progress" | "progress_total" | "done" | "ready" | "error";
3
+ export interface TinyTitleProgressFileState {
4
+ loaded: number;
5
+ total: number;
6
+ }
7
+ export interface TinyTitleProgressEvent {
8
+ modelKey: TinyLocalModelKey;
9
+ status: TinyTitleProgressStatus;
10
+ name?: string;
11
+ file?: string;
12
+ progress?: number;
13
+ loaded?: number;
14
+ total?: number;
15
+ files?: Record<string, TinyTitleProgressFileState>;
16
+ task?: string;
17
+ model?: string;
18
+ }
19
+ export type TinyTitleWorkerInbound = {
20
+ type: "ping";
21
+ id: string;
22
+ } | {
23
+ type: "generate";
24
+ id: string;
25
+ modelKey: TinyTitleLocalModelKey;
26
+ message: string;
27
+ } | {
28
+ type: "complete";
29
+ id: string;
30
+ modelKey: TinyLocalModelKey;
31
+ prompt: string;
32
+ maxTokens?: number;
33
+ } | {
34
+ type: "download";
35
+ id: string;
36
+ modelKey: TinyLocalModelKey;
37
+ } | {
38
+ type: "close";
39
+ };
40
+ export type TinyTitleWorkerOutbound = {
41
+ type: "pong";
42
+ id: string;
43
+ } | {
44
+ type: "title";
45
+ id: string;
46
+ title: string | null;
47
+ } | {
48
+ type: "completion";
49
+ id: string;
50
+ text: string | null;
51
+ } | {
52
+ type: "downloaded";
53
+ id: string;
54
+ } | {
55
+ type: "error";
56
+ id: string;
57
+ error: string;
58
+ } | {
59
+ type: "progress";
60
+ id: string;
61
+ event: TinyTitleProgressEvent;
62
+ } | {
63
+ type: "log";
64
+ level: "debug" | "warn" | "error";
65
+ msg: string;
66
+ meta?: Record<string, unknown>;
67
+ } | {
68
+ type: "closed";
69
+ };
70
+ export interface TinyTitleTransport {
71
+ send(message: TinyTitleWorkerOutbound): void;
72
+ onMessage(handler: (message: TinyTitleWorkerInbound) => void): () => void;
73
+ close(): void;
74
+ }
@@ -0,0 +1,2 @@
1
+ import type { TinyTitleTransport } from "./title-protocol";
2
+ export declare function startTinyTitleWorker(transport: TinyTitleTransport): void;
@@ -43,6 +43,8 @@ export interface BashToolDetails {
43
43
  timeoutSeconds?: number;
44
44
  requestedTimeoutSeconds?: number;
45
45
  wallTimeMs?: number;
46
+ /** Exit code of a command that ran to completion but failed (non-zero). */
47
+ exitCode?: number;
46
48
  terminalId?: string;
47
49
  async?: {
48
50
  state: "running" | "completed" | "failed";
@@ -70,7 +72,7 @@ export declare class BashTool implements AgentTool<BashToolSchema, BashToolDetai
70
72
  readonly concurrency = "exclusive";
71
73
  readonly strict = true;
72
74
  constructor(session: ToolSession);
73
- execute(_toolCallId: string, { command: rawCommand, env: rawEnv, timeout: rawTimeout, cwd, async: asyncRequested, pty }: BashToolInput, signal?: AbortSignal, onUpdate?: AgentToolUpdateCallback<BashToolDetails>, ctx?: AgentToolContext): Promise<AgentToolResult<BashToolDetails>>;
75
+ execute(_toolCallId: string, { command: rawCommand, env: rawEnv, timeout: rawTimeout, cwd, async: asyncRequested, pty, }: BashToolInput, signal?: AbortSignal, onUpdate?: AgentToolUpdateCallback<BashToolDetails>, ctx?: AgentToolContext): Promise<AgentToolResult<BashToolDetails>>;
74
76
  }
75
77
  export interface BashRenderArgs {
76
78
  command?: string;
@@ -6,6 +6,7 @@ import type { Settings } from "../config/settings";
6
6
  import type { Skill } from "../extensibility/skills";
7
7
  import type { GoalModeState, GoalRuntime } from "../goals";
8
8
  import type { HindsightSessionState } from "../hindsight/state";
9
+ import type { MnemosyneSessionState } from "../mnemosyne/state";
9
10
  import type { PlanModeState } from "../plan-mode/state";
10
11
  import { type AgentRegistry } from "../registry/agent-registry";
11
12
  import type { ArtifactManager } from "../session/artifacts";
@@ -36,13 +37,14 @@ export * from "./debug";
36
37
  export * from "./eval";
37
38
  export * from "./find";
38
39
  export * from "./gh";
39
- export * from "./hindsight-recall";
40
- export * from "./hindsight-reflect";
41
- export * from "./hindsight-retain";
42
40
  export * from "./image-gen";
43
41
  export * from "./inspect-image";
44
42
  export * from "./irc";
45
43
  export * from "./job";
44
+ export * from "./memory-edit";
45
+ export * from "./memory-recall";
46
+ export * from "./memory-reflect";
47
+ export * from "./memory-retain";
46
48
  export * from "./read";
47
49
  export * from "./recipe";
48
50
  export * from "./render-mermaid";
@@ -106,6 +108,8 @@ export interface ToolSession {
106
108
  getSessionId?: () => string | null;
107
109
  /** Get Hindsight runtime state for this agent session. */
108
110
  getHindsightSessionState?: () => HindsightSessionState | undefined;
111
+ /** Get Mnemosyne runtime state for this agent session. */
112
+ getMnemosyneSessionState?: () => MnemosyneSessionState | undefined;
109
113
  /** Agent identity used for IRC routing. Returns the registry id (e.g. "0-Main", "0-AuthLoader"). */
110
114
  getAgentId?: () => string | null;
111
115
  /** Look up a registered tool by name (used by the eval js backend's tool bridge). */
@@ -0,0 +1,40 @@
1
+ import type { AgentTool, AgentToolResult } from "@oh-my-pi/pi-agent-core";
2
+ import * as z from "zod/v4";
3
+ import type { ToolSession } from ".";
4
+ declare const memoryEditSchema: z.ZodObject<{
5
+ op: z.ZodEnum<{
6
+ forget: "forget";
7
+ invalidate: "invalidate";
8
+ update: "update";
9
+ }>;
10
+ id: z.ZodString;
11
+ content: z.ZodOptional<z.ZodString>;
12
+ importance: z.ZodOptional<z.ZodNumber>;
13
+ replacement_id: z.ZodOptional<z.ZodString>;
14
+ }, z.core.$strip>;
15
+ export type MemoryEditParams = z.infer<typeof memoryEditSchema>;
16
+ export declare class MemoryEditTool implements AgentTool<typeof memoryEditSchema> {
17
+ private readonly session;
18
+ readonly name = "memory_edit";
19
+ readonly approval: "read";
20
+ readonly label = "Memory Edit";
21
+ readonly description: string;
22
+ readonly parameters: z.ZodObject<{
23
+ op: z.ZodEnum<{
24
+ forget: "forget";
25
+ invalidate: "invalidate";
26
+ update: "update";
27
+ }>;
28
+ id: z.ZodString;
29
+ content: z.ZodOptional<z.ZodString>;
30
+ importance: z.ZodOptional<z.ZodNumber>;
31
+ replacement_id: z.ZodOptional<z.ZodString>;
32
+ }, z.core.$strip>;
33
+ readonly strict = true;
34
+ readonly loadMode = "discoverable";
35
+ readonly summary = "Update, forget, or invalidate Mnemosyne memories";
36
+ constructor(session: ToolSession);
37
+ static createIf(session: ToolSession): MemoryEditTool | null;
38
+ execute(_id: string, params: MemoryEditParams): Promise<AgentToolResult>;
39
+ }
40
+ export {};
@@ -1,11 +1,11 @@
1
1
  import type { AgentTool, AgentToolResult } from "@oh-my-pi/pi-agent-core";
2
2
  import * as z from "zod/v4";
3
3
  import type { ToolSession } from ".";
4
- declare const hindsightRecallSchema: z.ZodObject<{
4
+ declare const memoryRecallSchema: z.ZodObject<{
5
5
  query: z.ZodString;
6
6
  }, z.core.$strip>;
7
- export type HindsightRecallParams = z.infer<typeof hindsightRecallSchema>;
8
- export declare class HindsightRecallTool implements AgentTool<typeof hindsightRecallSchema> {
7
+ export type MemoryRecallParams = z.infer<typeof memoryRecallSchema>;
8
+ export declare class MemoryRecallTool implements AgentTool<typeof memoryRecallSchema> {
9
9
  private readonly session;
10
10
  readonly name = "recall";
11
11
  readonly approval: "read";
@@ -16,9 +16,9 @@ export declare class HindsightRecallTool implements AgentTool<typeof hindsightRe
16
16
  }, z.core.$strip>;
17
17
  readonly strict = true;
18
18
  readonly loadMode = "discoverable";
19
- readonly summary = "Search hindsight memory for relevant prior context";
19
+ readonly summary = "Search memory for relevant prior context";
20
20
  constructor(session: ToolSession);
21
- static createIf(session: ToolSession): HindsightRecallTool | null;
22
- execute(_id: string, params: HindsightRecallParams, signal?: AbortSignal): Promise<AgentToolResult>;
21
+ static createIf(session: ToolSession): MemoryRecallTool | null;
22
+ execute(_id: string, params: MemoryRecallParams, signal?: AbortSignal): Promise<AgentToolResult>;
23
23
  }
24
24
  export {};
@@ -1,12 +1,12 @@
1
1
  import type { AgentTool, AgentToolResult } from "@oh-my-pi/pi-agent-core";
2
2
  import * as z from "zod/v4";
3
3
  import type { ToolSession } from ".";
4
- declare const hindsightReflectSchema: z.ZodObject<{
4
+ declare const memoryReflectSchema: z.ZodObject<{
5
5
  query: z.ZodString;
6
6
  context: z.ZodOptional<z.ZodString>;
7
7
  }, z.core.$strip>;
8
- export type HindsightReflectParams = z.infer<typeof hindsightReflectSchema>;
9
- export declare class HindsightReflectTool implements AgentTool<typeof hindsightReflectSchema> {
8
+ export type MemoryReflectParams = z.infer<typeof memoryReflectSchema>;
9
+ export declare class MemoryReflectTool implements AgentTool<typeof memoryReflectSchema> {
10
10
  private readonly session;
11
11
  readonly name = "reflect";
12
12
  readonly approval: "read";
@@ -18,9 +18,9 @@ export declare class HindsightReflectTool implements AgentTool<typeof hindsightR
18
18
  }, z.core.$strip>;
19
19
  readonly strict = true;
20
20
  readonly loadMode = "discoverable";
21
- readonly summary = "Reflect on recent work and write hindsight memory";
21
+ readonly summary = "Synthesize an answer from long-term memory";
22
22
  constructor(session: ToolSession);
23
- static createIf(session: ToolSession): HindsightReflectTool | null;
24
- execute(_id: string, params: HindsightReflectParams, signal?: AbortSignal): Promise<AgentToolResult>;
23
+ static createIf(session: ToolSession): MemoryReflectTool | null;
24
+ execute(_id: string, params: MemoryReflectParams, signal?: AbortSignal): Promise<AgentToolResult>;
25
25
  }
26
26
  export {};
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Inline TUI renderers for the long-term memory tools (`retain`, `recall`,
3
+ * `reflect`).
4
+ *
5
+ * These keep the transcript terse — one status line plus, for `retain`, one
6
+ * `Remember: …` line per stored item — instead of the generic JSON arg tree,
7
+ * which exploded multi-line memory blobs into an unreadable wall.
8
+ */
9
+ import type { Component } from "@oh-my-pi/pi-tui";
10
+ import type { RenderResultOptions } from "../extensibility/custom-tools/types";
11
+ import type { Theme } from "../modes/theme/theme";
12
+ interface RetainRenderArgs {
13
+ items?: Array<{
14
+ content?: string;
15
+ context?: string;
16
+ }>;
17
+ }
18
+ interface QueryRenderArgs {
19
+ query?: string;
20
+ }
21
+ export declare const retainToolRenderer: {
22
+ inline: boolean;
23
+ mergeCallAndResult: boolean;
24
+ renderCall(args: RetainRenderArgs, options: RenderResultOptions, theme: Theme): Component;
25
+ renderResult(result: {
26
+ content: Array<{
27
+ type: string;
28
+ text?: string;
29
+ }>;
30
+ details?: {
31
+ count?: number;
32
+ };
33
+ isError?: boolean;
34
+ }, options: RenderResultOptions, theme: Theme, args?: RetainRenderArgs): Component;
35
+ };
36
+ export declare const recallToolRenderer: {
37
+ inline: boolean;
38
+ mergeCallAndResult: boolean;
39
+ renderCall(args: QueryRenderArgs, _options: RenderResultOptions, theme: Theme): Component;
40
+ renderResult(result: {
41
+ content: Array<{
42
+ type: string;
43
+ text?: string;
44
+ }>;
45
+ isError?: boolean;
46
+ }, options: RenderResultOptions, theme: Theme, args?: QueryRenderArgs): Component;
47
+ };
48
+ export declare const reflectToolRenderer: {
49
+ inline: boolean;
50
+ mergeCallAndResult: boolean;
51
+ renderCall(args: QueryRenderArgs, _options: RenderResultOptions, theme: Theme): Component;
52
+ renderResult(result: {
53
+ content: Array<{
54
+ type: string;
55
+ text?: string;
56
+ }>;
57
+ isError?: boolean;
58
+ }, options: RenderResultOptions, theme: Theme, args?: QueryRenderArgs): Component;
59
+ };
60
+ export {};