mixdog 0.8.0 → 0.9.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 (285) hide show
  1. package/README.md +47 -23
  2. package/package.json +33 -27
  3. package/scripts/_test-folder-dialog.mjs +30 -0
  4. package/scripts/agent-parallel-smoke.mjs +388 -0
  5. package/scripts/agent-tag-reuse-smoke.mjs +183 -0
  6. package/scripts/background-task-meta-smoke.mjs +38 -0
  7. package/scripts/boot-smoke.mjs +52 -9
  8. package/scripts/build-runtime-linux.sh +348 -0
  9. package/scripts/build-runtime-macos.sh +217 -0
  10. package/scripts/build-runtime-windows.ps1 +242 -0
  11. package/scripts/compact-active-turn-test.mjs +68 -0
  12. package/scripts/compact-smoke.mjs +859 -129
  13. package/scripts/compact-trigger-migration-smoke.mjs +187 -0
  14. package/scripts/fix-brief-fn.mjs +35 -0
  15. package/scripts/fix-format-tool-surface.mjs +24 -0
  16. package/scripts/fix-tool-exec-visible.mjs +42 -0
  17. package/scripts/generate-runtime-manifest.mjs +166 -0
  18. package/scripts/hook-bus-test.mjs +330 -0
  19. package/scripts/lead-workflow-smoke.mjs +33 -39
  20. package/scripts/live-worker-smoke.mjs +43 -37
  21. package/scripts/llm-trace-summary.mjs +315 -0
  22. package/scripts/memory-meta-concurrency-test.mjs +20 -0
  23. package/scripts/output-style-smoke.mjs +56 -15
  24. package/scripts/parent-abort-link-test.mjs +44 -0
  25. package/scripts/patch-agent-brief.mjs +48 -0
  26. package/scripts/patch-app.mjs +21 -0
  27. package/scripts/patch-app2.mjs +18 -0
  28. package/scripts/patch-dist-brief.mjs +96 -0
  29. package/scripts/patch-tool-exec.mjs +70 -0
  30. package/scripts/pretool-ask-runtime-test.mjs +54 -0
  31. package/scripts/provider-toolcall-test.mjs +376 -0
  32. package/scripts/reactive-compact-persist-smoke.mjs +124 -0
  33. package/scripts/sanitize-tool-pairs-test.mjs +260 -0
  34. package/scripts/session-context-bench.mjs +344 -0
  35. package/scripts/session-ingest-smoke.mjs +177 -0
  36. package/scripts/set-effort-config-test.mjs +41 -0
  37. package/scripts/smoke-runtime-negative.ps1 +106 -0
  38. package/scripts/smoke-runtime-negative.sh +97 -0
  39. package/scripts/smoke.mjs +25 -0
  40. package/scripts/tool-result-hook-test.mjs +48 -0
  41. package/scripts/tool-smoke.mjs +1223 -95
  42. package/scripts/toolcall-args-test.mjs +150 -0
  43. package/scripts/tui-background-failure-smoke.mjs +73 -0
  44. package/scripts/usage-metrics-epoch-smoke.mjs +114 -0
  45. package/src/agents/debugger/AGENT.md +8 -0
  46. package/src/agents/explore/AGENT.md +4 -0
  47. package/src/agents/heavy-worker/AGENT.md +9 -3
  48. package/src/agents/maintainer/AGENT.md +4 -0
  49. package/src/agents/reviewer/AGENT.md +8 -0
  50. package/src/agents/scheduler-task/AGENT.md +12 -0
  51. package/src/agents/scheduler-task/agent.json +6 -0
  52. package/src/agents/webhook-handler/AGENT.md +12 -0
  53. package/src/agents/webhook-handler/agent.json +6 -0
  54. package/src/agents/worker/AGENT.md +9 -3
  55. package/src/app.mjs +77 -3
  56. package/src/defaults/hidden-roles.json +17 -12
  57. package/src/headless-role.mjs +117 -0
  58. package/src/help.mjs +30 -0
  59. package/src/hooks/lib/permission-evaluator.cjs +11 -475
  60. package/src/lib/keychain-cjs.cjs +9 -1
  61. package/src/lib/mixdog-debug.cjs +0 -7
  62. package/src/lib/rules-builder.cjs +240 -96
  63. package/src/lib/text-utils.cjs +1 -1
  64. package/src/mixdog-session-runtime.mjs +2325 -450
  65. package/src/output-styles/default.md +12 -28
  66. package/src/output-styles/extreme-simple.md +9 -6
  67. package/src/output-styles/simple.md +22 -9
  68. package/src/repl.mjs +118 -59
  69. package/src/rules/agent/00-common.md +15 -0
  70. package/src/rules/{bridge → agent}/20-skip-protocol.md +1 -2
  71. package/src/rules/agent/30-explorer.md +22 -0
  72. package/src/rules/{bridge → agent}/40-cycle1-agent.md +7 -0
  73. package/src/rules/{bridge → agent}/41-cycle2-agent.md +7 -0
  74. package/src/rules/{bridge → agent}/42-cycle3-agent.md +7 -0
  75. package/src/rules/lead/01-general.md +9 -5
  76. package/src/rules/lead/04-workflow.md +51 -12
  77. package/src/rules/lead/lead-tool.md +6 -0
  78. package/src/rules/shared/01-tool.md +12 -1
  79. package/src/runtime/agent/orchestrator/activity-bus.mjs +7 -18
  80. package/src/runtime/agent/orchestrator/agent-owner.mjs +11 -0
  81. package/src/runtime/agent/orchestrator/{smart-bridge/bridge-llm.mjs → agent-runtime/agent-dispatch.mjs} +138 -111
  82. package/src/runtime/agent/orchestrator/agent-runtime/agent-progress-watchdog.mjs +94 -0
  83. package/src/runtime/agent/orchestrator/{smart-bridge → agent-runtime}/cache-strategy.mjs +32 -23
  84. package/src/runtime/agent/orchestrator/{smart-bridge → agent-runtime}/session-builder.mjs +33 -27
  85. package/src/runtime/agent/orchestrator/{bridge-trace.mjs → agent-trace.mjs} +132 -81
  86. package/src/runtime/agent/orchestrator/cache-mtime.mjs +0 -21
  87. package/src/runtime/agent/orchestrator/config.mjs +174 -55
  88. package/src/runtime/agent/orchestrator/context/collect.mjs +195 -487
  89. package/src/runtime/agent/orchestrator/dispatch-persist.mjs +1 -1
  90. package/src/runtime/agent/orchestrator/internal-roles.mjs +77 -29
  91. package/src/runtime/agent/orchestrator/internal-tools.mjs +5 -6
  92. package/src/runtime/agent/orchestrator/mcp/client.mjs +15 -9
  93. package/src/runtime/agent/orchestrator/providers/anthropic-betas.mjs +7 -1
  94. package/src/runtime/agent/orchestrator/providers/anthropic-oauth.mjs +377 -243
  95. package/src/runtime/agent/orchestrator/providers/anthropic.mjs +146 -93
  96. package/src/runtime/agent/orchestrator/providers/api-usage.mjs +236 -4
  97. package/src/runtime/agent/orchestrator/providers/custom-tool-wire.mjs +49 -0
  98. package/src/runtime/agent/orchestrator/providers/gemini.mjs +58 -13
  99. package/src/runtime/agent/orchestrator/providers/grok-oauth.mjs +67 -149
  100. package/src/runtime/agent/orchestrator/providers/media-normalization.mjs +132 -2
  101. package/src/runtime/agent/orchestrator/providers/model-catalog.mjs +4 -1
  102. package/src/runtime/agent/orchestrator/providers/oauth-credential-probes.mjs +45 -0
  103. package/src/runtime/agent/orchestrator/providers/oauth-usage.mjs +61 -116
  104. package/src/runtime/agent/orchestrator/providers/openai-compat-presets.mjs +25 -0
  105. package/src/runtime/agent/orchestrator/providers/openai-compat-stream.mjs +79 -255
  106. package/src/runtime/agent/orchestrator/providers/openai-compat.mjs +221 -70
  107. package/src/runtime/agent/orchestrator/providers/openai-oauth-ws.mjs +477 -147
  108. package/src/runtime/agent/orchestrator/providers/openai-oauth.mjs +343 -496
  109. package/src/runtime/agent/orchestrator/providers/openai-ws.mjs +6 -6
  110. package/src/runtime/agent/orchestrator/providers/registry.mjs +88 -51
  111. package/src/runtime/agent/orchestrator/providers/retry-classifier.mjs +31 -11
  112. package/src/runtime/agent/orchestrator/providers/statusline-route-meta.mjs +41 -8
  113. package/src/runtime/agent/orchestrator/session/cache/post-edit-marks.mjs +4 -4
  114. package/src/runtime/agent/orchestrator/session/cache/read-cache.mjs +1 -1
  115. package/src/runtime/agent/orchestrator/session/compact.mjs +1173 -267
  116. package/src/runtime/agent/orchestrator/session/context-utils.mjs +199 -36
  117. package/src/runtime/agent/orchestrator/session/loop.mjs +851 -674
  118. package/src/runtime/agent/orchestrator/session/manager.mjs +1593 -466
  119. package/src/runtime/agent/orchestrator/session/manager.reactive-persist.test.mjs +107 -0
  120. package/src/runtime/agent/orchestrator/session/store.mjs +291 -46
  121. package/src/runtime/agent/orchestrator/session/tool-result-offload.mjs +2 -2
  122. package/src/runtime/agent/orchestrator/stall-policy.mjs +31 -16
  123. package/src/runtime/agent/orchestrator/tool-loop-guard.mjs +3 -219
  124. package/src/runtime/agent/orchestrator/tools/bash-session.mjs +34 -7
  125. package/src/runtime/agent/orchestrator/tools/builtin/advisory-lock.mjs +1 -1
  126. package/src/runtime/agent/orchestrator/tools/builtin/arg-guard.mjs +19 -0
  127. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool.mjs +9 -9
  128. package/src/runtime/agent/orchestrator/tools/builtin/builtin-tools.mjs +60 -37
  129. package/src/runtime/agent/orchestrator/tools/builtin/cache-layers.mjs +21 -2
  130. package/src/runtime/agent/orchestrator/tools/builtin/device-paths.mjs +1 -1
  131. package/src/runtime/agent/orchestrator/tools/builtin/diagnostics-tool.mjs +0 -7
  132. package/src/runtime/agent/orchestrator/tools/builtin/glob-walk.mjs +1 -3
  133. package/src/runtime/agent/orchestrator/tools/builtin/list-tool.mjs +36 -12
  134. package/src/runtime/agent/orchestrator/tools/builtin/read-args.mjs +2 -0
  135. package/src/runtime/agent/orchestrator/tools/builtin/read-constants.mjs +2 -2
  136. package/src/runtime/agent/orchestrator/tools/builtin/read-formatting.mjs +5 -12
  137. package/src/runtime/agent/orchestrator/tools/builtin/read-image-resize.mjs +1 -1
  138. package/src/runtime/agent/orchestrator/tools/builtin/read-single-tool.mjs +4 -36
  139. package/src/runtime/agent/orchestrator/tools/builtin/read-tool.mjs +2 -40
  140. package/src/runtime/agent/orchestrator/tools/builtin/rg-runner.mjs +148 -27
  141. package/src/runtime/agent/orchestrator/tools/builtin/search-builders.mjs +2 -2
  142. package/src/runtime/agent/orchestrator/tools/builtin/search-tool.mjs +43 -75
  143. package/src/runtime/agent/orchestrator/tools/builtin/shell-jobs.mjs +90 -20
  144. package/src/runtime/agent/orchestrator/tools/builtin/snapshot-store.mjs +1 -1
  145. package/src/runtime/agent/orchestrator/tools/builtin.mjs +59 -5
  146. package/src/runtime/agent/orchestrator/tools/code-graph-state.mjs +86 -0
  147. package/src/runtime/agent/orchestrator/tools/code-graph-tool-defs.mjs +11 -11
  148. package/src/runtime/agent/orchestrator/tools/code-graph.mjs +4106 -4019
  149. package/src/runtime/agent/orchestrator/tools/patch-tool-defs.mjs +33 -4
  150. package/src/runtime/agent/orchestrator/tools/patch.mjs +90 -6
  151. package/src/runtime/agent/orchestrator/tools/progress-message.mjs +6 -4
  152. package/src/runtime/agent/orchestrator/tools/result-compression.mjs +4 -4
  153. package/src/runtime/agent/orchestrator/tools/shell-command.mjs +8 -1
  154. package/src/runtime/agent/orchestrator/tools/shell-snapshot.mjs +4 -4
  155. package/src/runtime/channels/index.mjs +152 -24
  156. package/src/runtime/channels/lib/scheduler.mjs +18 -14
  157. package/src/runtime/channels/lib/session-discovery.mjs +3 -2
  158. package/src/runtime/channels/lib/tool-format.mjs +0 -2
  159. package/src/runtime/channels/lib/transcript-discovery.mjs +3 -2
  160. package/src/runtime/channels/lib/webhook.mjs +1 -1
  161. package/src/runtime/channels/tool-defs.mjs +29 -29
  162. package/src/runtime/memory/index.mjs +635 -107
  163. package/src/runtime/memory/lib/agent-ipc.mjs +29 -12
  164. package/src/runtime/memory/lib/core-memory-store.mjs +2 -2
  165. package/src/runtime/memory/lib/embedding-model-config.mjs +55 -0
  166. package/src/runtime/memory/lib/embedding-provider.mjs +31 -4
  167. package/src/runtime/memory/lib/embedding-worker.mjs +19 -10
  168. package/src/runtime/memory/lib/memory-cycle1.mjs +38 -17
  169. package/src/runtime/memory/lib/memory-cycle2.mjs +6 -7
  170. package/src/runtime/memory/lib/memory-cycle3.mjs +4 -4
  171. package/src/runtime/memory/lib/memory-ops-policy.mjs +2 -1
  172. package/src/runtime/memory/lib/memory-session-merge.mjs +38 -0
  173. package/src/runtime/memory/lib/memory.mjs +88 -9
  174. package/src/runtime/memory/lib/model-profile.mjs +1 -1
  175. package/src/runtime/memory/lib/pg/adapter.mjs +15 -1
  176. package/src/runtime/memory/lib/pg/supervisor.mjs +12 -0
  177. package/src/runtime/memory/lib/runtime-fetcher.mjs +37 -3
  178. package/src/runtime/memory/lib/session-ingest.mjs +194 -0
  179. package/src/runtime/memory/lib/trace-store.mjs +96 -51
  180. package/src/runtime/memory/tool-defs.mjs +46 -37
  181. package/src/runtime/search/index.mjs +102 -466
  182. package/src/runtime/search/lib/web-tools.mjs +45 -25
  183. package/src/runtime/search/tool-defs.mjs +16 -23
  184. package/src/runtime/shared/abort-controller.mjs +1 -1
  185. package/src/runtime/shared/atomic-file.mjs +4 -3
  186. package/src/runtime/shared/background-tasks.mjs +122 -11
  187. package/src/runtime/shared/child-spawn-gate.mjs +145 -0
  188. package/src/runtime/shared/config.mjs +7 -4
  189. package/src/runtime/shared/err-text.mjs +131 -4
  190. package/src/runtime/shared/llm/cost.mjs +2 -2
  191. package/src/runtime/shared/llm/http-agent.mjs +23 -7
  192. package/src/runtime/shared/llm/index.mjs +34 -11
  193. package/src/runtime/shared/llm/usage-log.mjs +4 -4
  194. package/src/runtime/shared/markdown-frontmatter.mjs +56 -0
  195. package/src/runtime/shared/singleton-owner.mjs +104 -0
  196. package/src/runtime/shared/tool-execution-contract.mjs +199 -20
  197. package/src/runtime/shared/tool-execution-contract.test.mjs +183 -0
  198. package/src/runtime/shared/tool-surface.mjs +624 -98
  199. package/src/runtime/shared/user-data-guard.mjs +0 -2
  200. package/src/standalone/agent-task-status.mjs +203 -0
  201. package/src/standalone/agent-task-status.test.mjs +76 -0
  202. package/src/standalone/agent-tool.mjs +1913 -0
  203. package/src/standalone/channel-worker.mjs +370 -14
  204. package/src/standalone/explore-tool.mjs +165 -70
  205. package/src/standalone/folder-dialog.mjs +314 -0
  206. package/src/standalone/hook-bus.mjs +898 -22
  207. package/src/standalone/memory-runtime-proxy.mjs +320 -0
  208. package/src/standalone/projects.mjs +226 -0
  209. package/src/standalone/provider-admin.mjs +41 -24
  210. package/src/standalone/seeds.mjs +2 -69
  211. package/src/standalone/usage-dashboard.mjs +96 -8
  212. package/src/tui/App.jsx +4798 -2153
  213. package/src/tui/components/AnsiText.jsx +39 -28
  214. package/src/tui/components/ContextPanel.jsx +87 -29
  215. package/src/tui/components/Markdown.jsx +43 -77
  216. package/src/tui/components/MarkdownTable.jsx +9 -184
  217. package/src/tui/components/Message.jsx +28 -11
  218. package/src/tui/components/Picker.jsx +95 -56
  219. package/src/tui/components/PromptInput.jsx +367 -239
  220. package/src/tui/components/QueuedCommands.jsx +1 -1
  221. package/src/tui/components/SlashCommandPalette.jsx +27 -21
  222. package/src/tui/components/Spinner.jsx +67 -38
  223. package/src/tui/components/StatusLine.jsx +606 -38
  224. package/src/tui/components/TextEntryPanel.jsx +128 -9
  225. package/src/tui/components/ToolExecution.jsx +617 -368
  226. package/src/tui/components/TurnDone.jsx +3 -3
  227. package/src/tui/components/UsagePanel.jsx +3 -5
  228. package/src/tui/components/tool-output-format.mjs +365 -0
  229. package/src/tui/components/tool-output-format.test.mjs +220 -0
  230. package/src/tui/dist/index.mjs +8915 -2418
  231. package/src/tui/engine-runtime-notification.test.mjs +115 -0
  232. package/src/tui/engine-tool-result-text.test.mjs +75 -0
  233. package/src/tui/engine.mjs +1455 -279
  234. package/src/tui/figures.mjs +21 -40
  235. package/src/tui/index.jsx +75 -31
  236. package/src/tui/input-editing.mjs +25 -0
  237. package/src/tui/markdown/format-token.mjs +511 -68
  238. package/src/tui/markdown/format-token.test.mjs +216 -0
  239. package/src/tui/markdown/render-ansi.mjs +94 -0
  240. package/src/tui/markdown/render-ansi.test.mjs +108 -0
  241. package/src/tui/markdown/stream-fence.mjs +34 -0
  242. package/src/tui/markdown/stream-fence.test.mjs +26 -0
  243. package/src/tui/markdown/table-layout.mjs +250 -0
  244. package/src/tui/paste-attachments.mjs +0 -7
  245. package/src/tui/spinner-verbs.mjs +1 -2
  246. package/src/tui/statusline-ansi-bridge.mjs +172 -0
  247. package/src/tui/statusline-ansi-bridge.test.mjs +159 -0
  248. package/src/tui/theme.mjs +746 -24
  249. package/src/tui/time-format.mjs +1 -1
  250. package/src/tui/transcript-tool-failures.mjs +67 -0
  251. package/src/tui/transcript-tool-failures.test.mjs +111 -0
  252. package/src/ui/ansi.mjs +1 -2
  253. package/src/ui/markdown.mjs +85 -26
  254. package/src/ui/markdown.test.mjs +70 -0
  255. package/src/ui/model-display.mjs +121 -0
  256. package/src/ui/session-stats.mjs +44 -0
  257. package/src/ui/statusline-context-label.test.mjs +15 -0
  258. package/src/ui/statusline.mjs +386 -178
  259. package/src/ui/tool-card.mjs +3 -16
  260. package/src/vendor/statusline/bin/statusline-lib.mjs +8 -4
  261. package/src/vendor/statusline/bin/statusline-route.mjs +169 -37
  262. package/src/vendor/statusline/bin/statusline-route.test.mjs +80 -0
  263. package/src/vendor/statusline/scripts/lib/gateway-settings.mjs +3 -3
  264. package/src/vendor/statusline/src/gateway/claude-current.mjs +1 -1
  265. package/src/vendor/statusline/src/gateway/route-meta.mjs +44 -6
  266. package/src/vendor/statusline/src/gateway/session-routes.mjs +1 -1
  267. package/src/workflows/default/WORKFLOW.md +12 -5
  268. package/src/workflows/default/workflow.json +0 -1
  269. package/src/workflows/solo/WORKFLOW.md +15 -0
  270. package/src/workflows/solo/workflow.json +7 -0
  271. package/vendor/ink/build/output.js +6 -1
  272. package/src/agents/scheduler-task.md +0 -3
  273. package/src/agents/web-researcher/AGENT.md +0 -3
  274. package/src/agents/web-researcher/agent.json +0 -6
  275. package/src/agents/webhook-handler.md +0 -3
  276. package/src/rules/bridge/00-common.md +0 -5
  277. package/src/rules/bridge/30-explorer.md +0 -4
  278. package/src/rules/lead/00-tool-lead.md +0 -5
  279. package/src/rules/shared/00-language.md +0 -3
  280. package/src/runtime/agent/orchestrator/tools/builtin/native-edit-runner.mjs +0 -110
  281. package/src/runtime/agent/orchestrator/tools/mutation-content-cache.mjs +0 -67
  282. package/src/runtime/memory/lib/bridge-trace-queries.mjs +0 -120
  283. package/src/runtime/shared/llm/pid-cleanup.mjs +0 -27
  284. package/src/standalone/bridge-tool.mjs +0 -1414
  285. package/src/tui/runtime/shared/process-shutdown.mjs +0 -1
@@ -6,9 +6,9 @@ import { randomUUID } from "crypto";
6
6
  import { DATA_DIR, DEFAULT_HOLIDAY_COUNTRY, isInQuietWindow } from "./config.mjs";
7
7
  import { runScript as execScript, ensureNopluginDir } from "./executor.mjs";
8
8
  import { withFileLockSync } from "../../shared/atomic-file.mjs";
9
- import { makeBridgeLlm } from '../../agent/orchestrator/smart-bridge/bridge-llm.mjs';
9
+ import { makeAgentDispatch } from '../../agent/orchestrator/agent-runtime/agent-dispatch.mjs';
10
10
 
11
- const schedulerLlm = makeBridgeLlm({ taskType: 'scheduler-task', role: 'scheduler-task', sourceType: 'scheduler' });
11
+ const schedulerLlm = makeAgentDispatch({ taskType: 'scheduler-task', role: 'scheduler-task', sourceType: 'scheduler' });
12
12
  const SCHEDULE_LOG = join(DATA_DIR, "schedule.log");
13
13
  // Buffered async logger — coalesces per-line appends into batched writes.
14
14
  let _schedLogBuf = [];
@@ -265,6 +265,7 @@ ${prompt}`;
265
265
  }
266
266
  static SCHEDULER_LOCK = join(tmpdir(), "mixdog-scheduler.lock");
267
267
  static INSTANCE_UUID = randomUUID();
268
+ static _exitHookInstalled = false;
268
269
  start() {
269
270
  if (this.tickTimer) return;
270
271
  const total = this.nonInteractive.length + this.interactive.length;
@@ -328,18 +329,21 @@ ${Scheduler.INSTANCE_UUID}`;
328
329
  }
329
330
  }, { timeoutMs: 60000, staleMs: 30000 });
330
331
  if (!acquiredSchedulerLock) return;
331
- process.on("exit", () => {
332
- // Verify ownership before unlink: an exiting process whose lock
333
- // was already reclaimed by a newer owner (PID-reuse / restart race)
334
- // must NOT delete the new owner's lock file. Read-verify-then-unlink
335
- // mirrors memory/index.mjs releaseLock().
336
- try {
337
- const content = readFileSync(Scheduler.SCHEDULER_LOCK, "utf8");
338
- const lockedPid = parseInt(content.split("\n")[0]);
339
- if (lockedPid === process.pid) unlinkSync(Scheduler.SCHEDULER_LOCK);
340
- } catch {
341
- }
342
- });
332
+ if (!Scheduler._exitHookInstalled) {
333
+ Scheduler._exitHookInstalled = true;
334
+ process.on("exit", () => {
335
+ // Verify ownership before unlink: an exiting process whose lock
336
+ // was already reclaimed by a newer owner (PID-reuse / restart race)
337
+ // must NOT delete the new owner's lock file. Read-verify-then-unlink
338
+ // mirrors memory/index.mjs releaseLock().
339
+ try {
340
+ const content = readFileSync(Scheduler.SCHEDULER_LOCK, "utf8");
341
+ const lockedPid = parseInt(content.split("\n")[0]);
342
+ if (lockedPid === process.pid) unlinkSync(Scheduler.SCHEDULER_LOCK);
343
+ } catch {
344
+ }
345
+ });
346
+ }
343
347
  logSchedule(`${this.nonInteractive.length} non-interactive, ${this.interactive.length} interactive
344
348
  `);
345
349
  this.registerCronJobs();
@@ -2,6 +2,7 @@ import { readFileSync, readdirSync, statSync } from "fs";
2
2
  import { execFileSync } from "child_process";
3
3
  import { basename, join, resolve } from "path";
4
4
  import { homedir } from "os";
5
+ import { mixdogHome } from "../../shared/plugin-paths.mjs";
5
6
 
6
7
  function cwdToProjectSlug(cwd) {
7
8
  return resolve(cwd).replace(/\\/g, "/").replace(/^([A-Za-z]):/, "$1-").replace(/\//g, "-");
@@ -41,7 +42,7 @@ function getParentPid(pid) {
41
42
  }
42
43
  }
43
44
  function readSessionRecord(pid) {
44
- const sessionFile = join(homedir(), ".mixdog", "sessions", `${pid}.json`);
45
+ const sessionFile = join(mixdogHome(), "sessions", `${pid}.json`);
45
46
  try {
46
47
  const sessionFileStat = statSync(sessionFile);
47
48
  const session = JSON.parse(readFileSync(sessionFile, "utf8"));
@@ -77,7 +78,7 @@ function discoverCurrentClaudeSession() {
77
78
  return null;
78
79
  }
79
80
  function listInteractiveClaudeSessions() {
80
- const sessionsDir = join(homedir(), ".mixdog", "sessions");
81
+ const sessionsDir = join(mixdogHome(), "sessions");
81
82
  try {
82
83
  return readdirSync(sessionsDir).filter((file) => file.endsWith(".json")).map((file) => parseInt(basename(file, ".json"), 10)).filter((pid) => Number.isFinite(pid)).map((pid) => readSessionRecord(pid)).filter(isInteractiveSession).sort((a, b) => {
83
84
  if (b.startedAt !== a.startedAt) return b.startedAt - a.startedAt;
@@ -80,8 +80,6 @@ function buildToolLine(name, input, hiddenCheck = isHidden) {
80
80
  detail = (input?.command || input?.cmd || desc || "").substring(0, 500);
81
81
  break;
82
82
  }
83
- case "edit":
84
- case "write":
85
83
  case "apply_patch":
86
84
  detail = input?.file_path || "";
87
85
  break;
@@ -6,9 +6,10 @@ import {
6
6
  discoverCurrentClaudeSession,
7
7
  listInteractiveClaudeSessions
8
8
  } from "./session-discovery.mjs";
9
+ import { mixdogHome } from "../../shared/plugin-paths.mjs";
9
10
 
10
11
  function resolveTranscriptForSession(session) {
11
- const projectsDir = join(homedir(), ".mixdog", "projects");
12
+ const projectsDir = join(mixdogHome(), "projects");
12
13
  const projectSlug = cwdToProjectSlug(process.cwd());
13
14
  const directTranscript = session.transcriptPath ? resolve(session.transcriptPath) : "";
14
15
  if (directTranscript && existsSync(directTranscript)) {
@@ -49,7 +50,7 @@ function resolveTranscriptForSession(session) {
49
50
  };
50
51
  }
51
52
  function findLatestTranscriptByMtime(cwd) {
52
- const projectsDir = join(homedir(), ".mixdog", "projects");
53
+ const projectsDir = join(mixdogHome(), "projects");
53
54
  const slug = cwdToProjectSlug(cwd ?? process.cwd());
54
55
  const projectDir = join(projectsDir, slug);
55
56
  try {
@@ -410,7 +410,7 @@ function resolveNgrokBin() {
410
410
  // are candidate sources. process.env is the shell-start snapshot; registry
411
411
  // is the live user definition. Each candidate is tried in order and the
412
412
  // first that resolves to an existing file wins. This recovers two distinct
413
- // post-setx cases without a Claude Code restart:
413
+ // post-setx cases without a host-agent restart:
414
414
  // (a) env unset, registry set — fresh install + setx after process start
415
415
  // (b) env set to stale old path, registry set to new — user moved or
416
416
  // re-installed ngrok and setx'd the new path; the old env value would
@@ -3,27 +3,27 @@ export const TOOL_DEFS = [
3
3
  name: "reply",
4
4
  title: "Discord Reply",
5
5
  annotations: { title: "Discord Reply", readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: true },
6
- description: "Send a reply/message to a configured channel. Requires chat_id and text; files are local paths to attach.",
6
+ description: "Send message to configured channel. files are local paths.",
7
7
  inputSchema: {
8
8
  type: "object",
9
9
  properties: {
10
- chat_id: { type: "string", description: "Target channel/chat id from the channel context." },
11
- text: { type: "string", description: "Message text to send." },
12
- reply_to: { type: "string", description: "Optional message id to reply to." },
10
+ chat_id: { type: "string", description: "Target channel/chat id." },
11
+ text: { type: "string", description: "Message text." },
12
+ reply_to: { type: "string", description: "Reply message id." },
13
13
  files: {
14
14
  type: "array",
15
15
  items: { type: "string" },
16
- description: "Local file paths to attach."
16
+ description: "Local file paths."
17
17
  },
18
18
  embeds: {
19
19
  type: "array",
20
20
  items: { type: "object", additionalProperties: true },
21
- description: "Discord embed payloads."
21
+ description: "Discord embeds."
22
22
  },
23
23
  components: {
24
24
  type: "array",
25
25
  items: { type: "object", additionalProperties: true },
26
- description: "Discord component payloads."
26
+ description: "Discord components."
27
27
  }
28
28
  },
29
29
  required: ["chat_id", "text"]
@@ -33,13 +33,13 @@ export const TOOL_DEFS = [
33
33
  name: "react",
34
34
  title: "Reaction",
35
35
  annotations: { title: "Reaction", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
36
- description: "Add an emoji reaction to an existing channel message.",
36
+ description: "React to channel message.",
37
37
  inputSchema: {
38
38
  type: "object",
39
39
  properties: {
40
40
  chat_id: { type: "string", description: "Target channel/chat id." },
41
- message_id: { type: "string", description: "Message id to react to." },
42
- emoji: { type: "string", description: "Emoji name or Unicode emoji." }
41
+ message_id: { type: "string", description: "Message id." },
42
+ emoji: { type: "string", description: "Emoji." }
43
43
  },
44
44
  required: ["chat_id", "message_id", "emoji"]
45
45
  }
@@ -48,22 +48,22 @@ export const TOOL_DEFS = [
48
48
  name: "edit_message",
49
49
  title: "Edit Message",
50
50
  annotations: { title: "Edit Message", readOnlyHint: false, destructiveHint: true, idempotentHint: true, openWorldHint: true },
51
- description: "Edit a bot-authored channel message. Requires chat_id, message_id, and replacement text.",
51
+ description: "Edit bot-authored channel message.",
52
52
  inputSchema: {
53
53
  type: "object",
54
54
  properties: {
55
55
  chat_id: { type: "string", description: "Target channel/chat id." },
56
- message_id: { type: "string", description: "Bot message id to edit." },
57
- text: { type: "string", description: "Replacement message text." },
56
+ message_id: { type: "string", description: "Bot message id." },
57
+ text: { type: "string", description: "Replacement text." },
58
58
  embeds: {
59
59
  type: "array",
60
60
  items: { type: "object", additionalProperties: true },
61
- description: "Replacement Discord embed payloads."
61
+ description: "Replacement embeds."
62
62
  },
63
63
  components: {
64
64
  type: "array",
65
65
  items: { type: "object", additionalProperties: true },
66
- description: "Replacement Discord component payloads."
66
+ description: "Replacement components."
67
67
  }
68
68
  },
69
69
  required: ["chat_id", "message_id", "text"]
@@ -73,12 +73,12 @@ export const TOOL_DEFS = [
73
73
  name: "download_attachment",
74
74
  title: "Download Attachment",
75
75
  annotations: { title: "Download Attachment", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
76
- description: "Download attachments from a channel message. Requires chat_id and message_id.",
76
+ description: "Download message attachments.",
77
77
  inputSchema: {
78
78
  type: "object",
79
79
  properties: {
80
80
  chat_id: { type: "string", description: "Source channel/chat id." },
81
- message_id: { type: "string", description: "Message id containing attachments." }
81
+ message_id: { type: "string", description: "Message id." }
82
82
  },
83
83
  required: ["chat_id", "message_id"]
84
84
  }
@@ -87,12 +87,12 @@ export const TOOL_DEFS = [
87
87
  name: "fetch",
88
88
  title: "Fetch",
89
89
  annotations: { title: "Fetch", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
90
- description: "Discord-only: fetch recent messages from a Discord channel. Requires channel (id); optional limit (count). NOT for URLs or web pages — use web_fetch for those.",
90
+ description: "Discord-only recent messages. NOT for URLs; use web_fetch.",
91
91
  inputSchema: {
92
92
  type: "object",
93
93
  properties: {
94
94
  channel: { type: "string", description: "Discord channel id." },
95
- limit: { type: "number", description: "Maximum recent messages to return." }
95
+ limit: { type: "number", description: "Max messages." }
96
96
  },
97
97
  required: ["channel"]
98
98
  }
@@ -101,7 +101,7 @@ export const TOOL_DEFS = [
101
101
  name: "schedule_status",
102
102
  title: "Schedule Status",
103
103
  annotations: { title: "Schedule Status", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false },
104
- description: "Show configured schedules and their current status.",
104
+ description: "Show schedule status.",
105
105
  inputSchema: {
106
106
  type: "object",
107
107
  properties: {},
@@ -112,7 +112,7 @@ export const TOOL_DEFS = [
112
112
  name: "trigger_schedule",
113
113
  title: "Trigger Schedule",
114
114
  annotations: { title: "Trigger Schedule", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
115
- description: "Run a configured scheduled task immediately by name. Requires name.",
115
+ description: "Run schedule now.",
116
116
  inputSchema: {
117
117
  type: "object",
118
118
  properties: {
@@ -125,13 +125,13 @@ export const TOOL_DEFS = [
125
125
  name: "schedule_control",
126
126
  title: "Schedule Control",
127
127
  annotations: { title: "Schedule Control", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
128
- description: 'Defer or skip a schedule without running it now: action=defer pushes by minutes; action=skip_today skips the next run today. Requires name and action.',
128
+ description: 'Defer or skip a schedule.',
129
129
  inputSchema: {
130
130
  type: "object",
131
131
  properties: {
132
132
  name: { type: "string", description: "Schedule name." },
133
- action: { type: "string", enum: ["defer", "skip_today"], description: "Schedule control action." },
134
- minutes: { type: "number", description: "Minutes to defer when action=defer." }
133
+ action: { type: "string", enum: ["defer", "skip_today"], description: "Control action." },
134
+ minutes: { type: "number", description: "Defer minutes." }
135
135
  },
136
136
  required: ["name", "action"]
137
137
  }
@@ -140,11 +140,11 @@ export const TOOL_DEFS = [
140
140
  name: "activate_channel_bridge",
141
141
  title: "Activate Channel Bridge",
142
142
  annotations: { title: "Activate Channel Bridge", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
143
- description: "Enable or disable channel bridge forwarding.",
143
+ description: "Toggle channel bridge.",
144
144
  inputSchema: {
145
145
  type: "object",
146
146
  properties: {
147
- active: { type: "boolean", description: "true to activate forwarding, false to deactivate." }
147
+ active: { type: "boolean", description: "Activate forwarding." }
148
148
  },
149
149
  required: ["active"]
150
150
  }
@@ -154,21 +154,21 @@ export const TOOL_DEFS = [
154
154
  name: "reload_config",
155
155
  title: "Reload Config",
156
156
  annotations: { title: "Reload Config", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
157
- description: "Reload channel/runtime configuration from disk.",
157
+ description: "Reload channel/runtime config.",
158
158
  inputSchema: { type: "object", properties: {}, additionalProperties: false }
159
159
  },
160
160
  {
161
161
  name: "inject_command",
162
162
  title: "Inject Mixdog Slash Command",
163
163
  annotations: { title: "Inject Mixdog Slash Command", readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true },
164
- description: "Inject a supported Mixdog slash command into the active channel/session.",
164
+ description: "Inject supported Mixdog slash command.",
165
165
  inputSchema: {
166
166
  type: "object",
167
167
  properties: {
168
168
  command: {
169
169
  type: "string",
170
170
  enum: ["reload-plugins", "clear"],
171
- description: "Slash command to inject."
171
+ description: "Slash command."
172
172
  }
173
173
  },
174
174
  required: ["command"]