@daniel156161/prism 0.2.78 → 0.2.82

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 (204) hide show
  1. package/dist/pi/pi-env.d.ts +1 -1
  2. package/dist/pi/pi-env.js +1 -1
  3. package/dist/pi/pi-patch-interactive.js +8 -5
  4. package/dist/pi/pi-patch-interactive.js.map +1 -1
  5. package/dist/prism-extensions/integrations/ai-memory-errors.d.ts +29 -0
  6. package/dist/prism-extensions/integrations/ai-memory-errors.js +106 -0
  7. package/dist/prism-extensions/integrations/ai-memory-errors.js.map +1 -0
  8. package/dist/prism-extensions/integrations/ai-memory-http.d.ts +28 -0
  9. package/dist/prism-extensions/integrations/ai-memory-http.js +92 -0
  10. package/dist/prism-extensions/integrations/ai-memory-http.js.map +1 -0
  11. package/dist/prism-extensions/integrations/ai-memory-system.d.ts +5 -0
  12. package/dist/prism-extensions/integrations/ai-memory-system.js +205 -123
  13. package/dist/prism-extensions/integrations/ai-memory-system.js.map +1 -1
  14. package/dist/prism-extensions/integrations/ai-memory-write-preview.d.ts +36 -0
  15. package/dist/prism-extensions/integrations/ai-memory-write-preview.js +67 -0
  16. package/dist/prism-extensions/integrations/ai-memory-write-preview.js.map +1 -0
  17. package/dist/prism-extensions/integrations/research-tools.js +3 -3
  18. package/dist/prism-extensions/integrations/research-tools.js.map +1 -1
  19. package/dist/prism-extensions/integrations/youtube.d.ts +2 -2
  20. package/dist/prism-extensions/integrations/youtube.js +6 -7
  21. package/dist/prism-extensions/integrations/youtube.js.map +1 -1
  22. package/dist/prism-extensions/ui/collapsed-text-rendering.d.ts +4 -2
  23. package/dist/prism-extensions/ui/collapsed-text-rendering.js +12 -7
  24. package/dist/prism-extensions/ui/collapsed-text-rendering.js.map +1 -1
  25. package/node_modules/@earendil-works/pi-agent-core/README.md +4 -4
  26. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
  27. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +5 -1
  28. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -1
  29. package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts.map +1 -1
  30. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js +3 -0
  31. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js.map +1 -1
  32. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +6 -0
  33. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts.map +1 -1
  34. package/node_modules/@earendil-works/pi-agent-core/dist/types.js.map +1 -1
  35. package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
  36. package/node_modules/@earendil-works/pi-ai/README.md +8 -1
  37. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.d.ts.map +1 -1
  38. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js +1 -0
  39. package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js.map +1 -1
  40. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +2 -0
  41. package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -1
  42. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +2 -0
  43. package/node_modules/@earendil-works/pi-ai/dist/models.generated.js.map +1 -1
  44. package/node_modules/@earendil-works/pi-ai/dist/providers/all.d.ts.map +1 -1
  45. package/node_modules/@earendil-works/pi-ai/dist/providers/all.js +2 -0
  46. package/node_modules/@earendil-works/pi-ai/dist/providers/all.js.map +1 -1
  47. package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  48. package/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
  49. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
  50. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  51. package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-individual.json +1 -0
  52. package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  53. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual.d.ts +3 -0
  54. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual.d.ts.map +1 -0
  55. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual.js +15 -0
  56. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual.js.map +1 -0
  57. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual.models.d.ts +4 -0
  58. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual.models.d.ts.map +1 -0
  59. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual.models.js +6 -0
  60. package/node_modules/@earendil-works/pi-ai/dist/providers/qwen-token-plan-individual.models.js.map +1 -0
  61. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +1 -1
  62. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
  63. package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
  64. package/node_modules/@earendil-works/pi-ai/package.json +2 -2
  65. package/node_modules/@earendil-works/pi-client/CHANGELOG.md +1 -1
  66. package/node_modules/@earendil-works/pi-client/package.json +2 -2
  67. package/node_modules/@earendil-works/pi-coding-agent/CHANGELOG.md +31 -2
  68. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.d.ts.map +1 -1
  69. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.js +3 -3
  70. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.js.map +1 -1
  71. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/auth-check.d.ts +19 -0
  72. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/auth-check.d.ts.map +1 -0
  73. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/auth-check.js +50 -0
  74. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/auth-check.js.map +1 -0
  75. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/auth-command.d.ts +24 -0
  76. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/auth-command.d.ts.map +1 -0
  77. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/auth-command.js +102 -0
  78. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/auth-command.js.map +1 -0
  79. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/credential-print.d.ts +4 -14
  80. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/credential-print.d.ts.map +1 -1
  81. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/credential-print.js +38 -79
  82. package/node_modules/@earendil-works/pi-coding-agent/dist/cli/credential-print.js.map +1 -1
  83. package/node_modules/@earendil-works/pi-coding-agent/dist/cli.js +1 -1
  84. package/node_modules/@earendil-works/pi-coding-agent/dist/config.js +11 -6
  85. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-services.js +1 -1
  86. package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.js +0 -5
  87. package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.d.ts +10 -0
  88. package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.d.ts.map +1 -1
  89. package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.js +79 -2
  90. package/node_modules/@earendil-works/pi-coding-agent/dist/core/auth-storage.js.map +1 -1
  91. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/loader.js +1 -3
  92. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.d.ts +5 -0
  93. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
  94. package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
  95. package/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings.d.ts +8 -0
  96. package/node_modules/@earendil-works/pi-coding-agent/dist/core/keybindings.d.ts.map +1 -1
  97. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-resolver.d.ts.map +1 -1
  98. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-resolver.js +1 -0
  99. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-resolver.js.map +1 -1
  100. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-runtime.d.ts +2 -0
  101. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-runtime.d.ts.map +1 -1
  102. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-runtime.js +3 -1
  103. package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-runtime.js.map +1 -1
  104. package/node_modules/@earendil-works/pi-coding-agent/dist/core/project-trust.js +1 -1
  105. package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.js +1 -1
  106. package/node_modules/@earendil-works/pi-coding-agent/dist/core/session-manager.js +37 -39
  107. package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.js +16 -20
  108. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.d.ts +4 -0
  109. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.d.ts.map +1 -1
  110. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.js +6 -4
  111. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/bash.js.map +1 -1
  112. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit.d.ts +4 -0
  113. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit.d.ts.map +1 -1
  114. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit.js +11 -7
  115. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit.js.map +1 -1
  116. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/find.d.ts +4 -0
  117. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/find.d.ts.map +1 -1
  118. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/find.js +5 -1
  119. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/find.js.map +1 -1
  120. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/grep.d.ts +4 -0
  121. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/grep.d.ts.map +1 -1
  122. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/grep.js +5 -1
  123. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/grep.js.map +1 -1
  124. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/ls.d.ts +4 -0
  125. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/ls.d.ts.map +1 -1
  126. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/ls.js +5 -1
  127. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/ls.js.map +1 -1
  128. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.d.ts +4 -0
  129. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.d.ts.map +1 -1
  130. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.js +6 -2
  131. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.js.map +1 -1
  132. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/write.d.ts +4 -0
  133. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/write.d.ts.map +1 -1
  134. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/write.js +6 -2
  135. package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/write.js.map +1 -1
  136. package/node_modules/@earendil-works/pi-coding-agent/dist/main.d.ts.map +1 -1
  137. package/node_modules/@earendil-works/pi-coding-agent/dist/main.js +57 -21
  138. package/node_modules/@earendil-works/pi-coding-agent/dist/main.js.map +1 -1
  139. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/session-selector.js +0 -4
  140. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +3 -0
  141. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  142. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js +48 -233
  143. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
  144. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  145. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.js +11 -3
  146. package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.js.map +1 -1
  147. package/node_modules/@earendil-works/pi-coding-agent/dist/server/create-harness.d.ts +26 -0
  148. package/node_modules/@earendil-works/pi-coding-agent/dist/server/create-harness.d.ts.map +1 -0
  149. package/node_modules/@earendil-works/pi-coding-agent/dist/server/create-harness.js +104 -0
  150. package/node_modules/@earendil-works/pi-coding-agent/dist/server/create-harness.js.map +1 -0
  151. package/node_modules/@earendil-works/pi-coding-agent/docs/extensions.md +3 -2
  152. package/node_modules/@earendil-works/pi-coding-agent/docs/keybindings.md +9 -5
  153. package/node_modules/@earendil-works/pi-coding-agent/docs/providers.md +8 -1
  154. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  155. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-anthropic/package.json +1 -1
  156. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  157. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/gondolin/package-lock.json +2 -2
  158. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/gondolin/package.json +1 -1
  159. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/sandbox/package-lock.json +2 -2
  160. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/sandbox/package.json +1 -1
  161. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/with-deps/package-lock.json +2 -2
  162. package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/with-deps/package.json +1 -1
  163. package/node_modules/@earendil-works/pi-coding-agent/package.json +7 -7
  164. package/node_modules/@earendil-works/pi-protocol/package.json +1 -1
  165. package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  166. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js +1 -1
  167. package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts +10 -0
  168. package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts.map +1 -1
  169. package/node_modules/@earendil-works/pi-tui/dist/keybindings.js +8 -0
  170. package/node_modules/@earendil-works/pi-tui/dist/keybindings.js.map +1 -1
  171. package/node_modules/@earendil-works/pi-tui/dist/latex.d.ts.map +1 -1
  172. package/node_modules/@earendil-works/pi-tui/dist/latex.js +188 -48
  173. package/node_modules/@earendil-works/pi-tui/dist/latex.js.map +1 -1
  174. package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts +12 -0
  175. package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts.map +1 -1
  176. package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js +146 -12
  177. package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js.map +1 -1
  178. package/node_modules/@earendil-works/pi-tui/package.json +1 -1
  179. package/node_modules/@types/node/README.md +1 -1
  180. package/node_modules/@types/node/child_process.d.ts +0 -1
  181. package/node_modules/@types/node/crypto.d.ts +6 -6
  182. package/node_modules/@types/node/dns/promises.d.ts +5 -5
  183. package/node_modules/@types/node/dns.d.ts +5 -5
  184. package/node_modules/@types/node/fs.d.ts +7 -0
  185. package/node_modules/@types/node/http.d.ts +30 -0
  186. package/node_modules/@types/node/http2.d.ts +4 -4
  187. package/node_modules/@types/node/os.d.ts +30 -30
  188. package/node_modules/@types/node/package.json +2 -2
  189. package/node_modules/@types/node/perf_hooks.d.ts +2 -1
  190. package/node_modules/@types/node/process.d.ts +42 -43
  191. package/node_modules/@types/node/quic.d.ts +1049 -84
  192. package/node_modules/@types/node/sqlite.d.ts +14 -1
  193. package/node_modules/@types/node/stream/iter.d.ts +3 -2
  194. package/node_modules/@types/node/test.d.ts +61 -0
  195. package/node_modules/@types/node/v8.d.ts +20 -23
  196. package/package.json +6 -6
  197. package/src/prism-extensions/integrations/ai-memory-errors.ts +112 -0
  198. package/src/prism-extensions/integrations/ai-memory-http.ts +114 -0
  199. package/src/prism-extensions/integrations/ai-memory-system.ts +221 -132
  200. package/src/prism-extensions/integrations/ai-memory-write-preview.ts +83 -0
  201. package/src/prism-extensions/integrations/research-tools.ts +3 -3
  202. package/src/prism-extensions/integrations/youtube.ts +6 -6
  203. package/src/prism-extensions/ui/collapsed-text-rendering.ts +14 -8
  204. package/node_modules/@earendil-works/pi-coding-agent/dist/core/prism-session-db.js +0 -128
@@ -1,5 +1,5 @@
1
1
  export declare function repoRoot(): string;
2
- export declare const SUPPORTED_PI_CODING_AGENT_VERSION = "0.84.0";
2
+ export declare const SUPPORTED_PI_CODING_AGENT_VERSION = "0.84.1";
3
3
  export declare function stripPiNativeFlag(args: string[]): string[];
4
4
  export declare function resolvePiCliPath(_cwd?: string, env?: NodeJS.ProcessEnv): string;
5
5
  export declare function assertSupportedPiPackageVersion(version: string | undefined): void;
package/dist/pi/pi-env.js CHANGED
@@ -5,7 +5,7 @@ import { fileURLToPath } from "node:url";
5
5
  export function repoRoot() {
6
6
  return path.resolve(path.dirname(new URL(import.meta.url).pathname), "../..");
7
7
  }
8
- export const SUPPORTED_PI_CODING_AGENT_VERSION = "0.84.0";
8
+ export const SUPPORTED_PI_CODING_AGENT_VERSION = "0.84.1";
9
9
  export function stripPiNativeFlag(args) {
10
10
  return args.filter((arg) => arg !== "--pi-native" && arg !== "--pi");
11
11
  }
@@ -76,6 +76,9 @@ export function patchPrismBranding(runtimeDir, piHarnessVersion) {
76
76
  .replaceAll("this.settingsManager.setLastChangelogVersion(VERSION);", `this.settingsManager.setLastChangelogVersion(${changelogVersion});`)
77
77
  .replaceAll("this.reportInstallTelemetry(VERSION);", `this.reportInstallTelemetry(${changelogVersion});`);
78
78
  patched = refreshPrismLogo(patched, brandedLogo);
79
+ if (!patched.includes("errorMessage = this.humanizeUsageLimitError(errorMessage);")) {
80
+ patched = patched.replaceAll("this.showError(errorMessage);", "errorMessage = this.humanizeUsageLimitError(errorMessage);\n this.showError(errorMessage);");
81
+ }
79
82
  patched = replaceRequired(patched, "const newEntries = getNewEntries(entries, lastVersion);\n if (newEntries.length > 0) {", "const newEntries = getNewEntries(entries, lastVersion);\n if (entries.length > 0 && newEntries.length === entries.length) {\n this.settingsManager.setLastChangelogVersion(" + changelogVersion + ");\n this.reportInstallTelemetry(" + changelogVersion + ");\n return normalizeChangelogLinks(entries[0].content, entries[0]);\n }\n if (newEntries.length > 0) {", "changelog-latest-entry-fallback");
80
83
  patched = replaceRequired(patched, "const extensions = options?.extensions ??", "let extensions = options?.extensions ??", "extensions-let");
81
84
  const prismInternalExtensionsFilter = prismInternalExtensionsFilterCode();
@@ -92,9 +95,8 @@ export function patchPrismBranding(runtimeDir, piHarnessVersion) {
92
95
  patched = refreshPrismInternalExtensionSets(patched);
93
96
  patched = replaceRequired(patched, "if (text === \"/reload\") {", "if (text === \"/plan\" || text.startsWith(\"/plan \")) {\n const task = text.startsWith(\"/plan \") ? text.slice(6).trim() : \"\";\n this.editor.setText(\"\");\n await this.startPrismPlanMode(task);\n return;\n }\n if (text === \"/plan:approve\") {\n this.editor.setText(\"\");\n await this.approvePrismPlan();\n return;\n }\n if (text === \"/plan:reject\") {\n this.editor.setText(\"\");\n this.rejectPrismPlan();\n return;\n }\n if (text === \"/plan:cancel\") {\n this.editor.setText(\"\");\n this.cancelPrismPlan();\n return;\n }\n if (text === \"/reload\") {", "plan-commands");
94
97
  patched = replaceRequired(patched, "text.startsWith(\"/plan \") ? text.slice(6).trim() :", "text.startsWith(\"/plan \") ? text.slice(6).trim() :", "plan-search-noop");
95
- patched = replaceRequired(patched, "await this.checkShutdownRequested();\n this.ui.requestRender();", "await this.checkShutdownRequested();\n void this.maybeShowUsageLimitRecoveryMenu(event);\n void this.maybeShowPrismPlanApprovalMenu(event);\n this.ui.requestRender();", "usage-limit-check");
96
- patched = replaceRequired(patched, " showError(errorMessage) {\n this.chatContainer.addChild(new Spacer(1));", " showError(errorMessage) {\n errorMessage = this.humanizeUsageLimitError(errorMessage);\n this.chatContainer.addChild(new Spacer(1));", "show-error");
97
- patched = replaceRequired(patched, " showModelSelector(initialSearchInput) {", ` formatUsageLimitDuration(ms) {
98
+ patched = replaceRequired(patched, " case \"agent_settled\":\n await this.checkShutdownRequested();\n break;", " case \"agent_settled\":\n await this.checkShutdownRequested();\n void this.maybeShowUsageLimitRecoveryMenu(event);\n void this.maybeShowPrismPlanApprovalMenu(event);\n break;", "usage-limit-check");
99
+ patched = replaceRequired(patched, " /** Extract text content from a user message */", ` formatUsageLimitDuration(ms) {
98
100
  const totalMinutes = Math.ceil(ms / 60000);
99
101
  const hours = Math.floor(totalMinutes / 60);
100
102
  const minutes = totalMinutes % 60;
@@ -127,8 +129,9 @@ export function patchPrismBranding(runtimeDir, piHarnessVersion) {
127
129
  }
128
130
  getUsageLimitError(event) {
129
131
  const last = event?.messages?.[event.messages.length - 1];
130
- const errorMessage = last?.errorMessage || last?.content?.find?.((block) => block?.type === "text")?.text || "";
132
+ let errorMessage = last?.errorMessage || last?.content?.find?.((block) => block?.type === "text")?.text || "";
131
133
  if (last?.role !== "assistant" || last?.stopReason !== "error") return undefined;
134
+ errorMessage = this.humanizeUsageLimitError(errorMessage);
132
135
  return /usage limit|try again in/i.test(errorMessage) ? String(errorMessage) : undefined;
133
136
  }
134
137
  removeLastAssistantErrorFromState() {
@@ -276,7 +279,7 @@ export function patchPrismBranding(runtimeDir, piHarnessVersion) {
276
279
  this.showStatus("Plan cancelled");
277
280
  this.ui.requestRender();
278
281
  }
279
- showModelSelector(initialSearchInput) {`, "usage-limit-methods");
282
+ /** Extract text content from a user message */`, "usage-limit-methods");
280
283
  if (patched !== source)
281
284
  fs.writeFileSync(interactiveFile, patched, "utf-8");
282
285
  }
@@ -1 +1 @@
1
- {"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 +1,29 @@
1
+ /**
2
+ * Error and diagnostics formatting for the AI Memory System integration.
3
+ *
4
+ * The API returns a structured error body (`{"error": {...}, "request_id": ...}`).
5
+ * Collapsing that into "HTTP 500 <raw json>" made intermittent failures
6
+ * impossible to trace, so the request id, the failing route and the query are
7
+ * kept in the message the model and the user actually see.
8
+ */
9
+ export type AiMemoryRequestContext = {
10
+ method: string;
11
+ path: string;
12
+ query?: string;
13
+ filters?: Record<string, unknown>;
14
+ };
15
+ export type AiMemoryTransportContext = AiMemoryRequestContext & {
16
+ baseUrl: string;
17
+ timeoutMs: number;
18
+ };
19
+ export declare function formatApiFailure(status: number, text: string, context: AiMemoryRequestContext): string;
20
+ /**
21
+ * A request that never reached the API (timeout, refused connection, DNS) must
22
+ * still explain itself. `fetch` alone only reports "fetch failed" or "The
23
+ * operation was aborted due to timeout", which is useless while debugging why a
24
+ * memory write did not land.
25
+ */
26
+ export declare function formatTransportFailure(error: unknown, context: AiMemoryTransportContext): string;
27
+ /** A 2xx response with a body that is not JSON, e.g. an HTML proxy page. */
28
+ export declare function formatInvalidJsonFailure(error: unknown, text: string, context: AiMemoryTransportContext): string;
29
+ export declare function formatDegradedNotice(degraded: any): string;
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Error and diagnostics formatting for the AI Memory System integration.
3
+ *
4
+ * The API returns a structured error body (`{"error": {...}, "request_id": ...}`).
5
+ * Collapsing that into "HTTP 500 <raw json>" made intermittent failures
6
+ * impossible to trace, so the request id, the failing route and the query are
7
+ * kept in the message the model and the user actually see.
8
+ */
9
+ function parseBody(text) {
10
+ try {
11
+ return JSON.parse(text);
12
+ }
13
+ catch {
14
+ return undefined;
15
+ }
16
+ }
17
+ function errorDetail(body, fallback) {
18
+ if (!body || typeof body !== "object")
19
+ return fallback.slice(0, 500);
20
+ const error = body.error ?? body;
21
+ const detail = error?.message ?? error?.detail ?? body?.detail;
22
+ if (typeof detail === "string" && detail.trim())
23
+ return detail.trim();
24
+ if (Array.isArray(detail))
25
+ return detail.map((item) => item?.msg ?? JSON.stringify(item)).join("; ");
26
+ return fallback.slice(0, 500);
27
+ }
28
+ export function formatApiFailure(status, text, context) {
29
+ const body = parseBody(text);
30
+ const requestId = body?.request_id ?? body?.error?.request_id;
31
+ const code = body?.error?.code ?? body?.code;
32
+ const parts = [`AI Memory ${context.method} ${context.path} failed: HTTP ${status}`];
33
+ parts.push(errorDetail(body, text));
34
+ if (code)
35
+ parts.push(`code=${code}`);
36
+ if (requestId)
37
+ parts.push(`request_id=${requestId}`);
38
+ if (context.query)
39
+ parts.push(`query=${JSON.stringify(context.query)}`);
40
+ if (context.filters && Object.keys(context.filters).length > 0)
41
+ parts.push(`filters=${JSON.stringify(context.filters)}`);
42
+ return parts.join(" | ");
43
+ }
44
+ function errorCode(error) {
45
+ const candidates = [error, error?.cause];
46
+ for (const candidate of candidates) {
47
+ const code = candidate?.code ?? candidate?.errno;
48
+ if (typeof code === "string" && code.trim())
49
+ return code.trim();
50
+ }
51
+ return undefined;
52
+ }
53
+ function errorMessage(error) {
54
+ if (error instanceof Error) {
55
+ const cause = error.cause;
56
+ const causeMessage = cause instanceof Error ? cause.message : typeof cause === "string" ? cause : "";
57
+ return causeMessage && causeMessage !== error.message ? `${error.message}: ${causeMessage}` : error.message;
58
+ }
59
+ return String(error);
60
+ }
61
+ /**
62
+ * A request that never reached the API (timeout, refused connection, DNS) must
63
+ * still explain itself. `fetch` alone only reports "fetch failed" or "The
64
+ * operation was aborted due to timeout", which is useless while debugging why a
65
+ * memory write did not land.
66
+ */
67
+ export function formatTransportFailure(error, context) {
68
+ const name = error?.name;
69
+ const code = errorCode(error);
70
+ const timedOut = name === "TimeoutError" || name === "AbortError";
71
+ const reason = timedOut
72
+ ? `request timed out after ${context.timeoutMs}ms`
73
+ : `request failed before a response arrived: ${errorMessage(error)}`;
74
+ const parts = [`AI Memory ${context.method} ${context.path} failed: ${reason}`];
75
+ if (code)
76
+ parts.push(`code=${code}`);
77
+ parts.push(`base_url=${context.baseUrl}`);
78
+ if (code === "ECONNREFUSED" || code === "ENOTFOUND" || code === "EAI_AGAIN") {
79
+ parts.push(`hint=Is the AI Memory System API running and reachable at ${context.baseUrl}?`);
80
+ }
81
+ else if (timedOut) {
82
+ parts.push("hint=Raise PRISM_AI_MEMORY_TIMEOUT_MS or check the API load; nothing was confirmed as written.");
83
+ }
84
+ if (context.query)
85
+ parts.push(`query=${JSON.stringify(context.query)}`);
86
+ if (context.filters && Object.keys(context.filters).length > 0)
87
+ parts.push(`filters=${JSON.stringify(context.filters)}`);
88
+ return parts.join(" | ");
89
+ }
90
+ /** A 2xx response with a body that is not JSON, e.g. an HTML proxy page. */
91
+ export function formatInvalidJsonFailure(error, text, context) {
92
+ const snippet = String(text ?? "").replace(/\s+/g, " ").trim().slice(0, 300);
93
+ const parts = [`AI Memory ${context.method} ${context.path} failed: response was not valid JSON: ${errorMessage(error)}`];
94
+ parts.push(`base_url=${context.baseUrl}`);
95
+ parts.push(`body=${snippet || "(empty)"}`);
96
+ return parts.join(" | ");
97
+ }
98
+ export function formatDegradedNotice(degraded) {
99
+ const stages = Array.isArray(degraded?.stages) ? degraded.stages : [];
100
+ if (stages.length === 0)
101
+ return "";
102
+ const errors = degraded?.errors ?? {};
103
+ const details = stages.map((stage) => (errors?.[stage] ? `${stage} (${errors[stage]})` : stage)).join(", ");
104
+ return `Warnung: Teilausfall im Retrieval — degradierte Stufen: ${details}. Ergebnisse können unvollständig sein.`;
105
+ }
106
+ //# sourceMappingURL=ai-memory-errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-memory-errors.js","sourceRoot":"","sources":["../../../src/prism-extensions/integrations/ai-memory-errors.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAcH,SAAS,SAAS,CAAC,IAAY;IAC7B,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IACzB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAA;IAClB,CAAC;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OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,KAAK,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC3G,OAAO,2DAA2D,OAAO,yCAAyC,CAAA;AACpH,CAAC"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * HTTP transport for the AI Memory System integration.
3
+ *
4
+ * Every request funnels through `requestJson` so that transport failures
5
+ * (timeout, refused connection, unreadable or non-JSON body) end up as
6
+ * descriptive errors instead of a bare "fetch failed" / "The operation was
7
+ * aborted". The tool call is still reported as an error to the model, but the
8
+ * message now explains *why* it failed and which route/base URL was involved.
9
+ */
10
+ export declare function aiMemoryBaseUrl(env?: NodeJS.ProcessEnv): string;
11
+ export declare function aiMemoryRequestTimeoutMs(env?: NodeJS.ProcessEnv): number;
12
+ export declare function aiMemoryStatusTimeoutMs(env?: NodeJS.ProcessEnv): number;
13
+ export declare function aiMemoryInjectTimeoutMs(env?: NodeJS.ProcessEnv): number;
14
+ export declare function aiMemoryInjectCacheTtlMs(env?: NodeJS.ProcessEnv): number;
15
+ export type AiMemoryRequest = {
16
+ method: string;
17
+ path: string;
18
+ body?: unknown;
19
+ timeoutMs?: number;
20
+ query?: string;
21
+ filters?: Record<string, unknown>;
22
+ };
23
+ export declare function requestJson<T>(request: AiMemoryRequest): Promise<T>;
24
+ export declare function postJson<T>(path: string, body: unknown, timeoutMs?: number): Promise<T>;
25
+ export declare function putJson<T>(path: string, body: unknown, timeoutMs?: number): Promise<T>;
26
+ export declare function deleteJson<T>(path: string, body: unknown, timeoutMs?: number): Promise<T>;
27
+ export declare function methodJson<T>(method: string, path: string, timeoutMs?: number, body?: unknown): Promise<T>;
28
+ export declare function getJson<T>(path: string, timeoutMs?: number): Promise<T>;
@@ -0,0 +1,92 @@
1
+ /**
2
+ * HTTP transport for the AI Memory System integration.
3
+ *
4
+ * Every request funnels through `requestJson` so that transport failures
5
+ * (timeout, refused connection, unreadable or non-JSON body) end up as
6
+ * descriptive errors instead of a bare "fetch failed" / "The operation was
7
+ * aborted". The tool call is still reported as an error to the model, but the
8
+ * message now explains *why* it failed and which route/base URL was involved.
9
+ */
10
+ import { formatApiFailure, formatInvalidJsonFailure, formatTransportFailure } from "./ai-memory-errors.js";
11
+ const DEFAULT_BASE_URL = "http://127.0.0.1:8765";
12
+ const DEFAULT_REQUEST_TIMEOUT_MS = 30_000;
13
+ const DEFAULT_STATUS_TIMEOUT_MS = 1_500;
14
+ const DEFAULT_INJECT_TIMEOUT_MS = 1_200;
15
+ const DEFAULT_INJECT_CACHE_TTL_MS = 60_000;
16
+ export function aiMemoryBaseUrl(env = process.env) {
17
+ return (env.PRISM_AI_MEMORY_BASE_URL || env.AI_MEMORY_BASE_URL || DEFAULT_BASE_URL).replace(/\/+$/, "");
18
+ }
19
+ function positiveIntegerSetting(value, fallback) {
20
+ const parsed = Number(value);
21
+ if (!Number.isFinite(parsed))
22
+ return fallback;
23
+ return Math.max(1, Math.trunc(parsed));
24
+ }
25
+ export function aiMemoryRequestTimeoutMs(env = process.env) {
26
+ return positiveIntegerSetting(env.PRISM_AI_MEMORY_TIMEOUT_MS ?? env.PI_AI_MEMORY_TIMEOUT_MS, DEFAULT_REQUEST_TIMEOUT_MS);
27
+ }
28
+ export function aiMemoryStatusTimeoutMs(env = process.env) {
29
+ return positiveIntegerSetting(env.PRISM_AI_MEMORY_STATUS_TIMEOUT_MS ?? env.PI_AI_MEMORY_STATUS_TIMEOUT_MS, DEFAULT_STATUS_TIMEOUT_MS);
30
+ }
31
+ export function aiMemoryInjectTimeoutMs(env = process.env) {
32
+ return positiveIntegerSetting(env.PRISM_AI_MEMORY_INJECT_TIMEOUT_MS ?? env.PI_AI_MEMORY_INJECT_TIMEOUT_MS, DEFAULT_INJECT_TIMEOUT_MS);
33
+ }
34
+ export function aiMemoryInjectCacheTtlMs(env = process.env) {
35
+ return positiveIntegerSetting(env.PRISM_AI_MEMORY_INJECT_CACHE_TTL_MS ?? env.PI_AI_MEMORY_INJECT_CACHE_TTL_MS, DEFAULT_INJECT_CACHE_TTL_MS);
36
+ }
37
+ function requestContext(request) {
38
+ const payload = request.body;
39
+ return {
40
+ method: request.method,
41
+ path: request.path,
42
+ query: request.query ?? (typeof payload?.query === "string" ? payload.query : undefined),
43
+ filters: request.filters ?? payload?.filters,
44
+ };
45
+ }
46
+ export async function requestJson(request) {
47
+ const baseUrl = aiMemoryBaseUrl();
48
+ const timeoutMs = request.timeoutMs ?? aiMemoryRequestTimeoutMs();
49
+ const context = requestContext(request);
50
+ const transport = { ...context, baseUrl, timeoutMs };
51
+ let response;
52
+ let text;
53
+ try {
54
+ response = await fetch(`${baseUrl}${request.path}`, {
55
+ method: request.method,
56
+ headers: {
57
+ accept: "application/json",
58
+ ...(request.body === undefined ? {} : { "content-type": "application/json; charset=utf-8" }),
59
+ },
60
+ body: request.body === undefined ? undefined : JSON.stringify(request.body),
61
+ signal: AbortSignal.timeout(timeoutMs),
62
+ });
63
+ text = await response.text();
64
+ }
65
+ catch (error) {
66
+ throw new Error(formatTransportFailure(error, transport));
67
+ }
68
+ if (!response.ok)
69
+ throw new Error(formatApiFailure(response.status, text, context));
70
+ try {
71
+ return JSON.parse(text);
72
+ }
73
+ catch (error) {
74
+ throw new Error(formatInvalidJsonFailure(error, text, transport));
75
+ }
76
+ }
77
+ export function postJson(path, body, timeoutMs) {
78
+ return requestJson({ method: "POST", path, body, timeoutMs });
79
+ }
80
+ export function putJson(path, body, timeoutMs) {
81
+ return requestJson({ method: "PUT", path, body, timeoutMs });
82
+ }
83
+ export function deleteJson(path, body, timeoutMs) {
84
+ return requestJson({ method: "DELETE", path, body, timeoutMs });
85
+ }
86
+ export function methodJson(method, path, timeoutMs, body) {
87
+ return requestJson({ method, path, body, timeoutMs });
88
+ }
89
+ export function getJson(path, timeoutMs = aiMemoryStatusTimeoutMs()) {
90
+ return requestJson({ method: "GET", path, timeoutMs });
91
+ }
92
+ //# sourceMappingURL=ai-memory-http.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-memory-http.js","sourceRoot":"","sources":["../../../src/prism-extensions/integrations/ai-memory-http.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,sBAAsB,EAA+B,MAAM,uBAAuB,CAAA;AAEvI,MAAM,gBAAgB,GAAG,uBAAuB,CAAA;AAChD,MAAM,0BAA0B,GAAG,MAAM,CAAA;AACzC,MAAM,yBAAyB,GAAG,KAAK,CAAA;AACvC,MAAM,yBAAyB,GAAG,KAAK,CAAA;AACvC,MAAM,2BAA2B,GAAG,MAAM,CAAA;AAE1C,MAAM,UAAU,eAAe,CAAC,GAAG,GAAsB,OAAO,CAAC,GAAG;IAClE,OAAO,CAAC,GAAG,CAAC,wBAAwB,IAAI,GAAG,CAAC,kBAAkB,IAAI,gBAAgB,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;AACzG,CAAC;AAED,SAAS,sBAAsB,CAAC,KAAc,EAAE,QAAgB;IAC9D,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IAC5B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;QAAE,OAAO,QAAQ,CAAA;IAC7C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAA;AACxC,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,GAAG,GAAsB,OAAO,CAAC,GAAG;IAC3E,OAAO,sBAAsB,CAAC,GAAG,CAAC,0BAA0B,IAAI,GAAG,CAAC,uBAAuB,EAAE,0BAA0B,CAAC,CAAA;AAC1H,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,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I,EAAE,SAAS,EAAE,CAAC,CAAA;AAClE,CAAC;AAED,MAAM,UAAU,OAAO,CAAI,IAAY,EAAE,IAAa,EAAE,SAAkB;IACxE,OAAO,WAAW,CAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA;AACjE,CAAC;AAED,MAAM,UAAU,UAAU,CAAI,IAAY,EAAE,IAAa,EAAE,SAAkB;IAC3E,OAAO,WAAW,CAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA;AACpE,CAAC;AAED,MAAM,UAAU,UAAU,CAAI,MAAc,EAAE,IAAY,EAAE,SAAkB,EAAE,IAAc;IAC5F,OAAO,WAAW,CAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA;AAC1D,CAAC;AAED,MAAM,UAAU,OAAO,CAAI,IAAY,EAAE,SAAS,GAAW,uBAAuB,EAAE;IACpF,OAAO,WAAW,CAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAA;AAC3D,CAAC"}
@@ -1,7 +1,12 @@
1
1
  type ExtensionAPI = any;
2
+ import { type ThemeLike } from "../ui/tool-call-rendering.js";
3
+ /** Test hook: drop injection caches and one-shot failure notices. */
4
+ export declare function resetAiMemoryCaches(): void;
2
5
  export declare function shouldEnableAiMemory(env?: NodeJS.ProcessEnv): boolean;
3
6
  export declare function shouldInjectAiMemoryCandidates(env?: NodeJS.ProcessEnv): boolean;
7
+ export declare function formatSearchResponse(data: any): string;
4
8
  export declare function formatAiMemoryCandidate(row: any): string;
5
9
  export declare function buildAiMemoryContextMessage(results: any[]): any | undefined;
10
+ export declare function formatAiMemoryToolCall(toolName: string, args: any, theme: ThemeLike): string;
6
11
  export default function aiMemorySystemExtension(pi: ExtensionAPI): void;
7
12
  export {};