pi-ui-extend 1.0.42 → 1.0.45

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 (233) hide show
  1. package/README.md +41 -12
  2. package/dist/app/app.d.ts +10 -0
  3. package/dist/app/app.js +132 -8
  4. package/dist/app/cli/install.js +2 -2
  5. package/dist/app/commands/command-controller.d.ts +4 -0
  6. package/dist/app/commands/command-controller.js +11 -0
  7. package/dist/app/commands/command-git-actions.d.ts +25 -0
  8. package/dist/app/commands/command-git-actions.js +381 -0
  9. package/dist/app/commands/command-host.d.ts +3 -0
  10. package/dist/app/commands/command-host.js +5 -2
  11. package/dist/app/commands/command-model-actions.d.ts +1 -0
  12. package/dist/app/commands/command-model-actions.js +51 -34
  13. package/dist/app/commands/command-navigation-actions.d.ts +1 -0
  14. package/dist/app/commands/command-navigation-actions.js +16 -3
  15. package/dist/app/commands/command-registry.d.ts +2 -0
  16. package/dist/app/commands/command-registry.js +14 -0
  17. package/dist/app/commands/reload-context-inventory.js +12 -1
  18. package/dist/app/input/autocomplete-controller.js +61 -34
  19. package/dist/app/input/input-action-controller.d.ts +2 -0
  20. package/dist/app/input/input-action-controller.js +8 -1
  21. package/dist/app/input/input-controller.d.ts +2 -1
  22. package/dist/app/input/input-controller.js +7 -2
  23. package/dist/app/input/prompt-enhancer-controller.js +53 -35
  24. package/dist/app/input/voice-controller.d.ts +41 -45
  25. package/dist/app/input/voice-controller.js +351 -419
  26. package/dist/app/model/model-usage-controller.js +17 -7
  27. package/dist/app/model/model-usage-status.d.ts +4 -1
  28. package/dist/app/model/model-usage-status.js +270 -46
  29. package/dist/app/popup/menu-items-controller.d.ts +13 -3
  30. package/dist/app/popup/menu-items-controller.js +37 -21
  31. package/dist/app/popup/popup-action-controller.d.ts +12 -2
  32. package/dist/app/popup/popup-action-controller.js +77 -24
  33. package/dist/app/popup/popup-menu-controller.d.ts +36 -14
  34. package/dist/app/popup/popup-menu-controller.js +239 -69
  35. package/dist/app/rendering/dcp-stats.d.ts +9 -4
  36. package/dist/app/rendering/dcp-stats.js +40 -425
  37. package/dist/app/rendering/popup-menu-renderer.d.ts +3 -5
  38. package/dist/app/rendering/popup-menu-renderer.js +42 -37
  39. package/dist/app/rendering/render-controller.js +23 -2
  40. package/dist/app/rendering/status-line-renderer.d.ts +5 -0
  41. package/dist/app/rendering/status-line-renderer.js +41 -5
  42. package/dist/app/rendering/tab-line-renderer.js +26 -20
  43. package/dist/app/runtime.d.ts +12 -1
  44. package/dist/app/runtime.js +120 -12
  45. package/dist/app/screen/mouse-controller.d.ts +2 -0
  46. package/dist/app/screen/mouse-controller.js +17 -7
  47. package/dist/app/screen/status-controller.d.ts +4 -0
  48. package/dist/app/screen/status-controller.js +5 -0
  49. package/dist/app/session/lazy-session-manager.js +34 -0
  50. package/dist/app/session/session-event-controller.d.ts +1 -0
  51. package/dist/app/session/session-event-controller.js +10 -1
  52. package/dist/app/session/session-history.d.ts +1 -0
  53. package/dist/app/session/session-history.js +12 -1
  54. package/dist/app/session/session-lifecycle-controller.d.ts +6 -1
  55. package/dist/app/session/session-lifecycle-controller.js +10 -1
  56. package/dist/app/session/tabs-controller.d.ts +25 -1
  57. package/dist/app/session/tabs-controller.js +442 -153
  58. package/dist/app/subagents/subagents-widget-controller.d.ts +1 -0
  59. package/dist/app/subagents/subagents-widget-controller.js +6 -0
  60. package/dist/app/types.d.ts +11 -1
  61. package/dist/app/workspace/workspace-actions-controller.js +10 -2
  62. package/dist/app/workspace/workspace-undo.d.ts +1 -0
  63. package/dist/app/workspace/workspace-undo.js +1 -0
  64. package/dist/bundled-extensions/question/index.js +9 -1
  65. package/dist/bundled-extensions/question/remote.d.ts +4 -0
  66. package/dist/bundled-extensions/question/remote.js +33 -0
  67. package/dist/bundled-extensions/telegram-connector/bot.d.ts +43 -0
  68. package/dist/bundled-extensions/telegram-connector/bot.js +166 -0
  69. package/dist/bundled-extensions/telegram-connector/config.d.ts +8 -0
  70. package/dist/bundled-extensions/telegram-connector/config.js +87 -0
  71. package/dist/bundled-extensions/telegram-connector/coordinator.d.ts +66 -0
  72. package/dist/bundled-extensions/telegram-connector/coordinator.js +413 -0
  73. package/dist/bundled-extensions/telegram-connector/index.d.ts +3 -0
  74. package/dist/bundled-extensions/telegram-connector/index.js +195 -0
  75. package/dist/bundled-extensions/terminal-bell/index.d.ts +0 -8
  76. package/dist/bundled-extensions/terminal-bell/index.js +0 -76
  77. package/dist/bundled-extensions/workspace-undo/index.d.ts +26 -0
  78. package/dist/bundled-extensions/workspace-undo/index.js +191 -0
  79. package/dist/config.d.ts +21 -2
  80. package/dist/config.js +159 -32
  81. package/dist/default-pix-config.js +20 -10
  82. package/dist/schemas/pi-tools-suite-schema.d.ts +8 -4
  83. package/dist/schemas/pi-tools-suite-schema.js +11 -5
  84. package/dist/schemas/pix-schema.d.ts +12 -2
  85. package/dist/schemas/pix-schema.js +37 -9
  86. package/dist/schemas/tasks-schema.js +1 -1
  87. package/docs/concurrency.md +3 -1
  88. package/docs/desktop-mvp.md +10 -5
  89. package/docs/desktop-task-manager.md +81 -28
  90. package/docs/release.md +30 -6
  91. package/external/pi-tools-suite/README.md +165 -39
  92. package/external/pi-tools-suite/docs/session-recovery.md +7 -0
  93. package/external/pi-tools-suite/docs/subagent-model-pools.md +12 -5
  94. package/external/pi-tools-suite/docs/ui-qa-subagent.md +440 -0
  95. package/external/pi-tools-suite/package.json +6 -1
  96. package/external/pi-tools-suite/src/antigravity-auth/auth-store.ts +2 -1
  97. package/external/pi-tools-suite/src/antigravity-auth/constants.ts +9 -3
  98. package/external/pi-tools-suite/src/antigravity-auth/headers.ts +41 -3
  99. package/external/pi-tools-suite/src/antigravity-auth/models.ts +94 -21
  100. package/external/pi-tools-suite/src/antigravity-auth/oauth.ts +5 -17
  101. package/external/pi-tools-suite/src/antigravity-auth/payload.ts +72 -7
  102. package/external/pi-tools-suite/src/antigravity-auth/stream.ts +13 -1
  103. package/external/pi-tools-suite/src/async-subagents/agents/implement.md +1 -1
  104. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/backends/browser.mjs +346 -0
  105. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/backends/desktop.mjs +1038 -0
  106. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/backends/tui.mjs +759 -0
  107. package/external/pi-tools-suite/src/async-subagents/agents/{browser-qa → ui-qa/browser}/scripts/browser-qa-runner.mjs +32 -23
  108. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/drivers/chrome-devtools/chrome-devtools-provider.mjs +895 -0
  109. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/drivers/linux/linux-atspi.py +494 -0
  110. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/drivers/macos/macos-accessibility.swift +1085 -0
  111. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/drivers/native-terminal/bridge-client.mjs +50 -0
  112. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/drivers/native-terminal/native-terminal-host.mjs +501 -0
  113. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/drivers/windows/windows-uia.ps1 +454 -0
  114. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/guides/browser-auth.md +114 -0
  115. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/guides/browser-chrome-devtools.md +91 -0
  116. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/guides/browser-playwright.md +145 -0
  117. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/guides/browser.md +82 -0
  118. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/guides/desktop-linux.md +26 -0
  119. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/guides/desktop-macos.md +29 -0
  120. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/guides/desktop-windows.md +23 -0
  121. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/guides/desktop.md +54 -0
  122. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/guides/tui-native-terminal.md +59 -0
  123. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/guides/tui-pty.md +37 -0
  124. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/guides/tui.md +60 -0
  125. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa/scripts/ui-qa-runner.mjs +535 -0
  126. package/external/pi-tools-suite/src/async-subagents/agents/ui-qa.md +75 -0
  127. package/external/pi-tools-suite/src/async-subagents/commands.ts +1 -1
  128. package/external/pi-tools-suite/src/async-subagents/core/agent-strategy.ts +1 -1
  129. package/external/pi-tools-suite/src/async-subagents/core/agents-dir.ts +0 -2
  130. package/external/pi-tools-suite/src/async-subagents/core/browser-qa.ts +16 -2
  131. package/external/pi-tools-suite/src/async-subagents/core/config.ts +40 -17
  132. package/external/pi-tools-suite/src/async-subagents/core/model-selection.ts +2 -1
  133. package/external/pi-tools-suite/src/async-subagents/core/registry.ts +158 -33
  134. package/external/pi-tools-suite/src/async-subagents/core/routing.ts +7 -4
  135. package/external/pi-tools-suite/src/async-subagents/core/spawn.ts +34 -24
  136. package/external/pi-tools-suite/src/async-subagents/core/ultrawork-auto.ts +51 -45
  137. package/external/pi-tools-suite/src/async-subagents/lib.ts +9 -1
  138. package/external/pi-tools-suite/src/async-subagents/tools/spawn.ts +0 -1
  139. package/external/pi-tools-suite/src/async-subagents/tools/subagents.ts +2 -2
  140. package/external/pi-tools-suite/src/coding-discipline/index.ts +90 -59
  141. package/external/pi-tools-suite/src/config.ts +14 -0
  142. package/external/pi-tools-suite/src/context-gateway/accounting-log.ts +282 -0
  143. package/external/pi-tools-suite/src/context-gateway/config.ts +66 -1
  144. package/external/pi-tools-suite/src/context-gateway/efficiency.ts +414 -0
  145. package/external/pi-tools-suite/src/context-gateway/enforcement.ts +123 -3
  146. package/external/pi-tools-suite/src/context-gateway/index.ts +137 -4
  147. package/external/pi-tools-suite/src/context-gateway/storeless-capabilities.ts +5 -5
  148. package/external/pi-tools-suite/src/context-gateway/telemetry.ts +2 -2
  149. package/external/pi-tools-suite/src/context-gateway/types.ts +8 -1
  150. package/external/pi-tools-suite/src/dcp/auto-compress-budget.ts +39 -4
  151. package/external/pi-tools-suite/src/dcp/auto-compress.ts +41 -14
  152. package/external/pi-tools-suite/src/dcp/commands.ts +14 -156
  153. package/external/pi-tools-suite/src/dcp/compress-tool.ts +8 -2
  154. package/external/pi-tools-suite/src/dcp/compression-progress.ts +22 -0
  155. package/external/pi-tools-suite/src/dcp/config.ts +58 -4
  156. package/external/pi-tools-suite/src/dcp/conversation-index.ts +36 -9
  157. package/external/pi-tools-suite/src/dcp/diagnostics.ts +41 -0
  158. package/external/pi-tools-suite/src/dcp/fresh-tool-results.ts +38 -0
  159. package/external/pi-tools-suite/src/dcp/index.ts +338 -66
  160. package/external/pi-tools-suite/src/dcp/journal.ts +126 -4
  161. package/external/pi-tools-suite/src/dcp/progress-controller.ts +2 -1
  162. package/external/pi-tools-suite/src/dcp/pruner-candidates.ts +92 -2
  163. package/external/pi-tools-suite/src/dcp/pruner-nudge.ts +36 -33
  164. package/external/pi-tools-suite/src/dcp/pruner.ts +1 -0
  165. package/external/pi-tools-suite/src/dcp/routine-pressure.ts +86 -0
  166. package/external/pi-tools-suite/src/dcp/state.ts +9 -0
  167. package/external/pi-tools-suite/src/dcp/statistics.d.ts +8 -0
  168. package/external/pi-tools-suite/src/dcp/statistics.js +156 -0
  169. package/external/pi-tools-suite/src/default-pi-tools-suite-config.ts +68 -16
  170. package/external/pi-tools-suite/src/lib/project.ts +36 -1
  171. package/external/pi-tools-suite/src/model-tools/index.ts +10 -7
  172. package/external/pi-tools-suite/src/repo-discovery/index.ts +304 -4
  173. package/external/pi-tools-suite/src/resource-registry/index.ts +282 -21
  174. package/external/pi-tools-suite/src/session-recovery/index.ts +17 -0
  175. package/external/pi-tools-suite/src/todo/index.ts +21 -0
  176. package/external/pi-tools-suite/src/todo/todo.ts +19 -1
  177. package/external/pi-tools-suite/src/tool-descriptions.ts +44 -15
  178. package/package.json +7 -8
  179. package/schemas/pi-tools-suite.json +44 -12
  180. package/schemas/pix.json +109 -15
  181. package/schemas/tasks.json +1 -2
  182. package/skills/simplify/SKILL.md +33 -5
  183. package/external/pi-tools-suite/docs/browser-qa-subagent.md +0 -196
  184. package/external/pi-tools-suite/src/async-subagents/agents/browser-qa.md +0 -598
  185. package/skills/playwright-cli/SKILL.md +0 -420
  186. package/skills/playwright-cli/references/element-attributes.md +0 -23
  187. package/skills/playwright-cli/references/playwright-tests.md +0 -50
  188. package/skills/playwright-cli/references/request-mocking.md +0 -87
  189. package/skills/playwright-cli/references/running-code.md +0 -241
  190. package/skills/playwright-cli/references/session-management.md +0 -273
  191. package/skills/playwright-cli/references/spec-driven-testing.md +0 -311
  192. package/skills/playwright-cli/references/storage-state.md +0 -290
  193. package/skills/playwright-cli/references/test-generation.md +0 -142
  194. package/skills/playwright-cli/references/tracing.md +0 -154
  195. package/skills/playwright-cli/references/video-recording.md +0 -147
  196. package/skills/spec-wiki/SKILL.md +0 -55
  197. package/skills/spec-wiki/evals/evals.json +0 -132
  198. package/skills/spec-wiki/evals/files/bootstrap/architecture/rfc-007.md +0 -14
  199. package/skills/spec-wiki/evals/files/bootstrap/docs/how-to-pay.md +0 -4
  200. package/skills/spec-wiki/evals/files/bootstrap/docs/overview.md +0 -9
  201. package/skills/spec-wiki/evals/files/bootstrap/requirements/payment-behavior.md +0 -17
  202. package/skills/spec-wiki/evals/files/bootstrap/src/payments.ts +0 -12
  203. package/skills/spec-wiki/evals/files/bootstrap/tests/payments.test.ts +0 -11
  204. package/skills/spec-wiki/evals/files/focused/src/session.ts +0 -5
  205. package/skills/spec-wiki/evals/files/focused/tests/session.test.ts +0 -17
  206. package/skills/spec-wiki/evals/files/maintenance/low-signal/incoming/capture.txt +0 -2
  207. package/skills/spec-wiki/evals/files/maintenance/low-signal/src/capture.ts +0 -3
  208. package/skills/spec-wiki/evals/files/maintenance/move/docs/old-job-contract.md +0 -18
  209. package/skills/spec-wiki/evals/files/maintenance/move/src/job.ts +0 -5
  210. package/skills/spec-wiki/evals/files/maintenance/new-relation/docs/session-refresh.md +0 -24
  211. package/skills/spec-wiki/evals/files/maintenance/new-relation/incoming/refresh-worker.ts +0 -7
  212. package/skills/spec-wiki/evals/files/maintenance/new-relation/src/session.ts +0 -7
  213. package/skills/spec-wiki/evals/files/maintenance/no-impact/docs/auth-contract.md +0 -17
  214. package/skills/spec-wiki/evals/files/maintenance/no-impact/incoming/telemetry-format.ts +0 -3
  215. package/skills/spec-wiki/evals/files/maintenance/no-impact/src/auth.ts +0 -3
  216. package/skills/spec-wiki/evals/files/query/docs/how-to-run-jobs.md +0 -4
  217. package/skills/spec-wiki/evals/files/query/docs/spec-overview.md +0 -9
  218. package/skills/spec-wiki/evals/files/query/features/jobs/cancellation-contract.md +0 -15
  219. package/skills/spec-wiki/evals/files/query/features/jobs/retry-spec.md +0 -6
  220. package/skills/spec-wiki/evals/maintenance_regression.py +0 -311
  221. package/skills/spec-wiki/evals/retrieval-eval.md +0 -37
  222. package/skills/spec-wiki/evals/retrieval-evals.json +0 -37
  223. package/skills/spec-wiki/evals/trigger-evals.json +0 -94
  224. package/skills/spec-wiki/references/bootstrap.md +0 -100
  225. package/skills/spec-wiki/references/focused-spec.md +0 -117
  226. package/skills/spec-wiki/references/index-schema.md +0 -330
  227. package/skills/spec-wiki/references/maintenance.md +0 -134
  228. package/skills/spec-wiki/references/query.md +0 -74
  229. package/skills/spec-wiki/scripts/spec_wiki.py +0 -2076
  230. /package/external/pi-tools-suite/src/async-subagents/agents/{browser-qa → ui-qa/browser}/examples/qa-auth.example.jsonc +0 -0
  231. /package/external/pi-tools-suite/src/async-subagents/agents/{browser-qa → ui-qa/browser}/examples/qa-flow.example.jsonc +0 -0
  232. /package/external/pi-tools-suite/src/async-subagents/agents/{browser-qa → ui-qa/browser}/vendor/fflate.LICENSE +0 -0
  233. /package/external/pi-tools-suite/src/async-subagents/agents/{browser-qa → ui-qa/browser}/vendor/fflate.mjs +0 -0
@@ -25,10 +25,6 @@ const DEFAULT_ASK_USER_NOTIFICATION_MESSAGE = "{sessionName}";
25
25
  const DEFAULT_MAC_SOUND = "Glass";
26
26
  const TERMINAL_BELL_CONFIG_KEY = "terminalBell";
27
27
  const SOUND_CONFIG_KEY = "sound";
28
- const TELEGRAM_CONFIG_KEY = "telegram";
29
- const TELEGRAM_BOT_TOKEN_CONFIG_KEY = "botToken";
30
- const TELEGRAM_CHAT_ID_CONFIG_KEY = "chatId";
31
- const TELEGRAM_API_BASE = "https://api.telegram.org";
32
28
  const TERM_PROGRAM_BUNDLE_IDS = {
33
29
  Apple_Terminal: "com.apple.Terminal",
34
30
  iTerm: "com.googlecode.iterm2",
@@ -80,45 +76,6 @@ export function readTerminalBellSoundConfig(configPath = getPiToolsSuiteUserConf
80
76
  return undefined;
81
77
  }
82
78
  }
83
- export function readTerminalBellTelegramConfig(configPath = getPiToolsSuiteUserConfigPath()) {
84
- if (!existsSync(configPath))
85
- return {};
86
- try {
87
- const parsed = parseJsonc(readFileSync(configPath, "utf-8"));
88
- if (!isRecord(parsed))
89
- return {};
90
- const terminalBell = parsed[TERMINAL_BELL_CONFIG_KEY];
91
- if (!isRecord(terminalBell))
92
- return {};
93
- const telegram = terminalBell[TELEGRAM_CONFIG_KEY];
94
- if (!isRecord(telegram))
95
- return {};
96
- const botToken = telegram[TELEGRAM_BOT_TOKEN_CONFIG_KEY];
97
- const chatId = telegram[TELEGRAM_CHAT_ID_CONFIG_KEY];
98
- return buildTelegramConfig(typeof botToken === "string" ? botToken.trim() : undefined, typeof chatId === "string" ? chatId.trim() : undefined);
99
- }
100
- catch {
101
- return {};
102
- }
103
- }
104
- export function resolveTerminalBellTelegramConfig(configPath = getPiToolsSuiteUserConfigPath()) {
105
- const fromConfig = readTerminalBellTelegramConfig(configPath);
106
- return buildTelegramConfig(trimmed(process.env.PI_TERMINAL_BELL_TELEGRAM_BOT_TOKEN) ?? fromConfig.botToken, trimmed(process.env.PI_TERMINAL_BELL_TELEGRAM_CHAT_ID) ?? fromConfig.chatId);
107
- }
108
- function buildTelegramConfig(botToken, chatId) {
109
- const config = {};
110
- if (botToken)
111
- config.botToken = botToken;
112
- if (chatId)
113
- config.chatId = chatId;
114
- return config;
115
- }
116
- export function terminalBellTelegramEnabled(configPath = getPiToolsSuiteUserConfigPath()) {
117
- if (process.env.PI_TERMINAL_BELL_TELEGRAM === "0")
118
- return false;
119
- const { botToken, chatId } = resolveTerminalBellTelegramConfig(configPath);
120
- return Boolean(botToken && chatId);
121
- }
122
79
  export function terminalBellSoundEnabled(ctx, configPath = getPiToolsSuiteUserConfigPath()) {
123
80
  if (process.env.PI_TERMINAL_BELL_SOUND === "0")
124
81
  return false;
@@ -292,43 +249,10 @@ function playAttentionSoundFor(context) {
292
249
  return;
293
250
  spawnDetached("/usr/bin/afplay", [soundPath]);
294
251
  }
295
- function sendTelegramNotification(title, message) {
296
- if (process.env.PI_TERMINAL_BELL_TELEGRAM === "0")
297
- return;
298
- const { botToken, chatId } = resolveTerminalBellTelegramConfig();
299
- if (!botToken || !chatId)
300
- return;
301
- // Telegram is delivered independently of the bundled desktop sound/notification
302
- // gate, so it works even when terminalBell.sound is false. Compose a single text
303
- // body from the already-rendered title/message used by desktop notifications.
304
- const text = message ? `${title}\n${message}` : title;
305
- const url = `${TELEGRAM_API_BASE}/bot${botToken}/sendMessage`;
306
- try {
307
- fetch(url, {
308
- method: "POST",
309
- headers: { "Content-Type": "application/json" },
310
- body: JSON.stringify({
311
- chat_id: chatId,
312
- text,
313
- disable_web_page_preview: true,
314
- }),
315
- }).then(() => {
316
- // Best-effort delivery; ignore the response body.
317
- }, () => {
318
- // Network/API failures must not affect the agent loop or suppress the
319
- // terminal bell / desktop notification.
320
- });
321
- }
322
- catch {
323
- // fetch may be unavailable or throw synchronously; ignore.
324
- }
325
- }
326
252
  function notifySessionStopped(context, macActivationBundleId, options) {
327
253
  const templateValues = context.templateValues;
328
254
  const title = renderNotificationTemplate(notificationTitleTemplate(options.title), templateValues);
329
255
  const renderedMessage = renderNotificationTemplate(options.message ?? process.env.PI_TERMINAL_BELL_NOTIFY_MESSAGE ?? DEFAULT_NOTIFICATION_MESSAGE, templateValues);
330
- // Telegram is independent of the bundled desktop sound/notification gate.
331
- sendTelegramNotification(title, renderedMessage);
332
256
  if (!terminalBellNotificationsEnabled(context))
333
257
  return;
334
258
  if (process.platform === "darwin") {
@@ -0,0 +1,26 @@
1
+ import { type ExtensionAPI } from "@earendil-works/pi-coding-agent";
2
+ import { type WorkspaceMutation } from "../../app/workspace/workspace-undo.js";
3
+ export { WORKSPACE_MUTATION_ENTRY_TYPE } from "../../app/workspace/workspace-undo.js";
4
+ export declare const WORKSPACE_UNDO_RPC_COMMAND = "__pix-workspace-undo";
5
+ export declare const WORKSPACE_UNDO_RESULT_CHANNEL = "pix.workspace-undo-result";
6
+ export declare const WORKSPACE_UNDO_RPC_ENV = "PIX_ACP_WORKSPACE_UNDO_BRIDGE";
7
+ export type WorkspaceUndoBridgeRequest = {
8
+ requestId: string;
9
+ targetEntryId: string;
10
+ };
11
+ export type WorkspaceUndoBridgeResult = {
12
+ requestId: string;
13
+ status: "ok" | "warning" | "cancelled" | "error";
14
+ revertedChanges?: number;
15
+ changedFiles?: number;
16
+ error?: string;
17
+ };
18
+ type SessionBranchEntry = {
19
+ id?: unknown;
20
+ type?: unknown;
21
+ customType?: unknown;
22
+ data?: unknown;
23
+ };
24
+ export default function workspaceUndoBridge(pi: ExtensionAPI): void;
25
+ export declare function workspaceMutationsAfterEntry(branch: readonly SessionBranchEntry[], targetEntryId: string, legacyIndex?: Readonly<Record<string, WorkspaceMutation[]>>): WorkspaceMutation[];
26
+ export declare function parseWorkspaceUndoBridgeRequest(value: string): WorkspaceUndoBridgeRequest | undefined;
@@ -0,0 +1,191 @@
1
+ import { getAgentDir, } from "@earendil-works/pi-coding-agent";
2
+ import { prepareWorkspaceMutation, loadWorkspaceUndoIndex, revertWorkspaceMutations, workspaceMutationFromToolExecution, WORKSPACE_MUTATION_ENTRY_TYPE, } from "../../app/workspace/workspace-undo.js";
3
+ export { WORKSPACE_MUTATION_ENTRY_TYPE } from "../../app/workspace/workspace-undo.js";
4
+ export const WORKSPACE_UNDO_RPC_COMMAND = "__pix-workspace-undo";
5
+ export const WORKSPACE_UNDO_RESULT_CHANNEL = "pix.workspace-undo-result";
6
+ export const WORKSPACE_UNDO_RPC_ENV = "PIX_ACP_WORKSPACE_UNDO_BRIDGE";
7
+ const RPC_SESSION_STATE_WIDGET_KEY = "pix.session-state";
8
+ export default function workspaceUndoBridge(pi) {
9
+ if (process.env[WORKSPACE_UNDO_RPC_ENV] !== "1")
10
+ return;
11
+ const pendingTools = new Map();
12
+ pi.on("tool_execution_start", async (event, ctx) => {
13
+ const userEntryId = latestUserEntryId(ctx.sessionManager.getBranch());
14
+ if (!userEntryId)
15
+ return;
16
+ const preparation = prepareWorkspaceMutation(ctx.cwd, event.toolName, event.args);
17
+ pendingTools.set(event.toolCallId, {
18
+ userEntryId,
19
+ args: event.args,
20
+ ...(preparation ? { preparation } : {}),
21
+ });
22
+ });
23
+ pi.on("tool_execution_end", async (event, ctx) => {
24
+ const pending = pendingTools.get(event.toolCallId);
25
+ pendingTools.delete(event.toolCallId);
26
+ if (!pending)
27
+ return;
28
+ const result = record(event.result);
29
+ const mutation = workspaceMutationFromToolExecution({
30
+ cwd: ctx.cwd,
31
+ toolName: event.toolName,
32
+ args: pending.args,
33
+ details: result?.details,
34
+ isError: event.isError,
35
+ preparation: pending.preparation,
36
+ });
37
+ if (!mutation)
38
+ return;
39
+ // Session custom entries are deliberately used instead of the TUI's
40
+ // process-wide index. They are ignored by LLM context, stay attached to
41
+ // the exact session branch, and cannot be overwritten by another ACP
42
+ // child process working in the same repository.
43
+ pi.appendEntry(WORKSPACE_MUTATION_ENTRY_TYPE, { userEntryId: pending.userEntryId, mutation });
44
+ });
45
+ pi.registerCommand(WORKSPACE_UNDO_RPC_COMMAND, {
46
+ description: "Internal Pix Desktop workspace undo bridge",
47
+ handler: async (args, ctx) => {
48
+ const request = parseWorkspaceUndoBridgeRequest(args);
49
+ if (!request)
50
+ return;
51
+ try {
52
+ const branch = ctx.sessionManager.getBranch();
53
+ const mutations = workspaceMutationsAfterEntry(branch, request.targetEntryId, loadWorkspaceUndoIndex(getAgentDir()).entries);
54
+ const navigation = await ctx.navigateTree(request.targetEntryId);
55
+ if (navigation.cancelled) {
56
+ emitResult(ctx, { requestId: request.requestId, status: "cancelled" });
57
+ return;
58
+ }
59
+ if (mutations.length === 0) {
60
+ emitResult(ctx, {
61
+ requestId: request.requestId,
62
+ status: "ok",
63
+ revertedChanges: 0,
64
+ changedFiles: 0,
65
+ });
66
+ return;
67
+ }
68
+ const reverted = await revertWorkspaceMutations(ctx.cwd, mutations);
69
+ if (!reverted.ok) {
70
+ emitResult(ctx, {
71
+ requestId: request.requestId,
72
+ status: "warning",
73
+ error: reverted.error,
74
+ });
75
+ return;
76
+ }
77
+ emitResult(ctx, {
78
+ requestId: request.requestId,
79
+ status: "ok",
80
+ revertedChanges: reverted.revertedChanges,
81
+ changedFiles: reverted.changedFiles,
82
+ });
83
+ }
84
+ catch (error) {
85
+ emitResult(ctx, {
86
+ requestId: request.requestId,
87
+ status: "error",
88
+ error: error instanceof Error ? error.message : String(error),
89
+ });
90
+ }
91
+ },
92
+ });
93
+ }
94
+ export function workspaceMutationsAfterEntry(branch, targetEntryId, legacyIndex = {}) {
95
+ const targetIndex = branch.findIndex((entry) => entry.id === targetEntryId);
96
+ if (targetIndex < 0)
97
+ throw new Error(`Session entry ${targetEntryId} is not on the active branch`);
98
+ const target = branch[targetIndex];
99
+ if (!isUserMessageEntry(target)) {
100
+ throw new Error(`Session entry ${targetEntryId} is not a user message`);
101
+ }
102
+ const userIds = [];
103
+ const customMutations = new Map();
104
+ let currentUserEntryId = targetEntryId;
105
+ for (const entry of branch.slice(targetIndex + 1)) {
106
+ if (isUserMessageEntry(entry) && typeof entry.id === "string") {
107
+ currentUserEntryId = entry.id;
108
+ userIds.push(entry.id);
109
+ continue;
110
+ }
111
+ if (entry.type !== "custom" || entry.customType !== WORKSPACE_MUTATION_ENTRY_TYPE)
112
+ continue;
113
+ const data = workspaceMutationEntryData(entry.data);
114
+ const owner = data?.userEntryId ?? currentUserEntryId;
115
+ if (!data?.mutation || !owner)
116
+ continue;
117
+ customMutations.set(owner, [...(customMutations.get(owner) ?? []), data.mutation]);
118
+ }
119
+ // The selected user message itself owns mutations from the turn that is
120
+ // being removed, so it must be first in the undo plan.
121
+ userIds.unshift(targetEntryId);
122
+ return userIds.flatMap((userEntryId) => {
123
+ const sessionEntries = customMutations.get(userEntryId);
124
+ return sessionEntries && sessionEntries.length > 0
125
+ ? sessionEntries
126
+ : [...(legacyIndex[userEntryId] ?? [])];
127
+ });
128
+ }
129
+ export function parseWorkspaceUndoBridgeRequest(value) {
130
+ try {
131
+ const parsed = JSON.parse(value);
132
+ const input = record(parsed);
133
+ if (!input
134
+ || typeof input.requestId !== "string"
135
+ || input.requestId.length === 0
136
+ || typeof input.targetEntryId !== "string"
137
+ || input.targetEntryId.length === 0)
138
+ return undefined;
139
+ return { requestId: input.requestId, targetEntryId: input.targetEntryId };
140
+ }
141
+ catch {
142
+ return undefined;
143
+ }
144
+ }
145
+ function emitResult(ctx, result) {
146
+ ctx.ui.setWidget(RPC_SESSION_STATE_WIDGET_KEY, [WORKSPACE_UNDO_RESULT_CHANNEL, JSON.stringify(result)]);
147
+ }
148
+ function workspaceMutationEntryData(value) {
149
+ const data = record(value);
150
+ if (!data)
151
+ return undefined;
152
+ const mutation = isWorkspaceMutation(data.mutation) ? data.mutation : undefined;
153
+ const userEntryId = typeof data.userEntryId === "string" ? data.userEntryId : undefined;
154
+ return {
155
+ ...(userEntryId ? { userEntryId } : {}),
156
+ ...(mutation ? { mutation } : {}),
157
+ };
158
+ }
159
+ function isWorkspaceMutation(value) {
160
+ const mutation = record(value);
161
+ if (!mutation)
162
+ return false;
163
+ if (mutation.type === "patch") {
164
+ return typeof mutation.patch === "string"
165
+ && (mutation.toolName === undefined || typeof mutation.toolName === "string");
166
+ }
167
+ if (mutation.type === "write") {
168
+ return typeof mutation.path === "string"
169
+ && typeof mutation.afterContent === "string"
170
+ && (mutation.beforeContent === undefined || typeof mutation.beforeContent === "string")
171
+ && (mutation.toolName === undefined || typeof mutation.toolName === "string");
172
+ }
173
+ return false;
174
+ }
175
+ function isUserMessageEntry(entry) {
176
+ const message = record(record(entry)?.message);
177
+ return entry?.type === "message" && message?.role === "user";
178
+ }
179
+ function latestUserEntryId(branch) {
180
+ for (let index = branch.length - 1; index >= 0; index -= 1) {
181
+ const entry = branch[index];
182
+ if (isUserMessageEntry(entry) && typeof entry?.id === "string")
183
+ return entry.id;
184
+ }
185
+ return undefined;
186
+ }
187
+ function record(value) {
188
+ return value && typeof value === "object" && !Array.isArray(value)
189
+ ? value
190
+ : undefined;
191
+ }
package/dist/config.d.ts CHANGED
@@ -24,10 +24,13 @@ export type OutputFiltersConfig = {
24
24
  };
25
25
  export type PromptEnhancerConfig = {
26
26
  modelRef: string;
27
+ fallbackModels: string[];
27
28
  };
28
29
  export type AutocompleteConfig = {
29
30
  /** Empty string disables inline LLM autocomplete. */
30
31
  modelRef: string;
32
+ /** Ordered model fallbacks tried after modelRef. */
33
+ fallbackModels: string[];
31
34
  /** Delay after typing before asking the model. */
32
35
  debounceMs: number;
33
36
  /** Hard timeout for a best-effort completion request. */
@@ -41,8 +44,10 @@ export type AutocompleteConfig = {
41
44
  };
42
45
  export type DefaultModelConfig = {
43
46
  modelRef: string;
47
+ fallbackModels: string[];
44
48
  thinking?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
45
49
  };
50
+ export type ModelThinkingPreferences = Record<string, "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max">;
46
51
  export type ModelColorsConfig = {
47
52
  rules: Record<string, string>;
48
53
  };
@@ -50,18 +55,28 @@ export type IconThemeConfig = {
50
55
  name: AppIconThemeName;
51
56
  };
52
57
  export type DictationLanguageModelConfig = {
53
- dirName: string;
54
- url: string;
55
58
  label: string;
59
+ /** Deepgram language code. Defaults to the language map key. */
60
+ deepgramLanguage?: string;
61
+ /** Deprecated Vosk model fields kept only for config compatibility. */
62
+ dirName?: string;
63
+ url?: string;
56
64
  };
57
65
  export type DictationConfig = {
58
66
  languages: Record<string, DictationLanguageModelConfig>;
59
67
  language?: string;
68
+ model?: string;
69
+ /** Long-lived Deepgram API key. Prefer the user config, not project config. */
70
+ apiKey?: string;
60
71
  };
61
72
  export type PixConfig = {
62
73
  toolRenderer: ToolRendererConfig;
63
74
  outputFilters: OutputFiltersConfig;
64
75
  defaultModel?: DefaultModelConfig;
76
+ /** User-level whitelist for model pickers. Undefined means show every available model. */
77
+ visibleModels?: string[];
78
+ /** Last applied thinking level for each model, shared by TUI and Desktop pickers. */
79
+ thinkingByModel?: ModelThinkingPreferences;
65
80
  promptEnhancer: PromptEnhancerConfig;
66
81
  autocomplete: AutocompleteConfig;
67
82
  modelColors: ModelColorsConfig;
@@ -77,8 +92,12 @@ export declare function resolveDefaultModelRef(config: PixConfig): string | unde
77
92
  export declare function savePixDefaultModel(modelRef: string): DefaultModelConfig | undefined;
78
93
  export declare function savePixDefaultThinking(thinking: string, fallbackModelRef?: string): DefaultModelConfig | undefined;
79
94
  export declare function savePixAutocompleteModel(modelRef: string): AutocompleteConfig;
95
+ export declare function savePixVisibleModels(modelRefs: readonly string[]): string[];
96
+ export declare function savePixThinkingLevelForModel(modelRef: string, thinking: string): ModelThinkingPreferences;
80
97
  export declare function saveProjectPixIgnoreContextFiles(cwd: string, ignoreContextFiles: boolean): boolean;
81
98
  export declare function upsertPixIgnoreContextFilesInJsonc(source: string, ignoreContextFiles: boolean): string;
99
+ export declare function upsertPixVisibleModelsInJsonc(source: string, modelRefs: readonly string[]): string;
100
+ export declare function upsertPixThinkingLevelForModelInJsonc(source: string, modelRef: string, thinking: string): string;
82
101
  export declare function upsertPixDefaultModelInJsonc(source: string, modelRef: string): string;
83
102
  export declare function upsertPixDefaultThinkingInJsonc(source: string, thinking: string, fallbackModelRef?: string): string;
84
103
  export declare function upsertPixAutocompleteModelInJsonc(source: string, modelRef: string): string;