mixdog 0.9.35 → 0.9.37

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 (105) hide show
  1. package/package.json +3 -2
  2. package/scripts/abort-recovery-test.mjs +118 -0
  3. package/scripts/compact-smoke.mjs +7 -7
  4. package/scripts/explore-bench-tmp.mjs +19 -0
  5. package/scripts/explore-bench.mjs +36 -6
  6. package/scripts/explore-prompt-policy-test.mjs +27 -0
  7. package/scripts/ingest-pure-conversation-smoke.mjs +11 -11
  8. package/scripts/openai-ws-early-settle-test.mjs +176 -0
  9. package/scripts/output-style-smoke.mjs +17 -17
  10. package/scripts/provider-toolcall-test.mjs +333 -14
  11. package/scripts/recall-bench-cases.json +3 -3
  12. package/scripts/recall-bench.mjs +1 -1
  13. package/scripts/recall-quality-cases.json +4 -4
  14. package/scripts/recall-usecase-cases.json +2 -2
  15. package/scripts/session-bench.mjs +13 -13
  16. package/scripts/steering-drain-buckets-test.mjs +72 -11
  17. package/scripts/submit-commandbusy-race-test.mjs +114 -0
  18. package/scripts/tool-smoke.mjs +83 -10
  19. package/src/app.mjs +2 -1
  20. package/src/defaults/cycle3-review-prompt.md +9 -0
  21. package/src/defaults/skills/setup/SKILL.md +93 -293
  22. package/src/lib/rules-builder.cjs +3 -2
  23. package/src/output-styles/default.md +2 -2
  24. package/src/output-styles/extreme-minimal.md +1 -1
  25. package/src/output-styles/minimal.md +1 -1
  26. package/src/output-styles/simple.md +2 -3
  27. package/src/rules/agent/30-explorer.md +15 -7
  28. package/src/rules/lead/01-general.md +4 -0
  29. package/src/runtime/agent/orchestrator/agent-trace-format.mjs +15 -3
  30. package/src/runtime/agent/orchestrator/config.mjs +1 -1
  31. package/src/runtime/agent/orchestrator/mcp/client.mjs +7 -7
  32. package/src/runtime/agent/orchestrator/providers/anthropic-oauth.mjs +6 -6
  33. package/src/runtime/agent/orchestrator/providers/anthropic.mjs +6 -6
  34. package/src/runtime/agent/orchestrator/providers/oauth-credential-probes.mjs +35 -5
  35. package/src/runtime/agent/orchestrator/providers/openai-compat-stream.mjs +27 -0
  36. package/src/runtime/agent/orchestrator/providers/openai-compat-wire.mjs +36 -37
  37. package/src/runtime/agent/orchestrator/providers/openai-compat.mjs +2 -2
  38. package/src/runtime/agent/orchestrator/providers/openai-oauth-http-sse.mjs +72 -1
  39. package/src/runtime/agent/orchestrator/providers/openai-oauth-ws.mjs +26 -3
  40. package/src/runtime/agent/orchestrator/providers/openai-oauth.mjs +12 -28
  41. package/src/runtime/agent/orchestrator/providers/openai-transport-policy.mjs +18 -15
  42. package/src/runtime/agent/orchestrator/providers/openai-ws-delta.mjs +4 -2
  43. package/src/runtime/agent/orchestrator/providers/openai-ws-stream.mjs +113 -2
  44. package/src/runtime/agent/orchestrator/providers/registry.mjs +44 -5
  45. package/src/runtime/agent/orchestrator/providers/tool-stream-state.mjs +78 -0
  46. package/src/runtime/agent/orchestrator/session/agent-loop.mjs +57 -31
  47. package/src/runtime/agent/orchestrator/session/cache/scoped-cache.mjs +8 -6
  48. package/src/runtime/agent/orchestrator/session/eager-dispatch.mjs +28 -2
  49. package/src/runtime/agent/orchestrator/session/loop/tool-classify.mjs +1 -3
  50. package/src/runtime/agent/orchestrator/session/loop/tool-helpers.mjs +15 -2
  51. package/src/runtime/agent/orchestrator/session/manager/ask-session.mjs +26 -17
  52. package/src/runtime/agent/orchestrator/session/manager/prompt-utils.mjs +2 -2
  53. package/src/runtime/agent/orchestrator/session/manager/session-lifecycle.mjs +24 -16
  54. package/src/runtime/agent/orchestrator/session/result-classification.mjs +2 -0
  55. package/src/runtime/agent/orchestrator/session/tool-batch.mjs +5 -2
  56. package/src/runtime/agent/orchestrator/stall-policy.mjs +18 -0
  57. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool.mjs +35 -20
  58. package/src/runtime/agent/orchestrator/tools/builtin/builtin-tools.mjs +7 -7
  59. package/src/runtime/agent/orchestrator/tools/builtin/list-tool.mjs +77 -31
  60. package/src/runtime/agent/orchestrator/tools/builtin/read-tool.mjs +25 -3
  61. package/src/runtime/agent/orchestrator/tools/builtin/search-builders.mjs +9 -2
  62. package/src/runtime/agent/orchestrator/tools/builtin/search-tool.mjs +73 -25
  63. package/src/runtime/agent/orchestrator/tools/builtin.mjs +2 -1
  64. package/src/runtime/agent/orchestrator/tools/code-graph/build.mjs +17 -7
  65. package/src/runtime/agent/orchestrator/tools/code-graph/dispatch.mjs +14 -12
  66. package/src/runtime/agent/orchestrator/tools/code-graph/graph-model.mjs +5 -0
  67. package/src/runtime/agent/orchestrator/tools/code-graph/search.mjs +56 -6
  68. package/src/runtime/agent/orchestrator/tools/shell-command.mjs +9 -0
  69. package/src/runtime/channels/lib/worker-main.mjs +5 -0
  70. package/src/runtime/memory/lib/core-memory-store.mjs +104 -0
  71. package/src/runtime/memory/lib/ko-morph.mjs +1 -1
  72. package/src/runtime/memory/lib/memory-cycle3.mjs +64 -4
  73. package/src/runtime/memory/lib/memory-text-utils.mjs +4 -4
  74. package/src/runtime/memory/lib/recall-format.mjs +3 -3
  75. package/src/runtime/shared/child-spawn-gate.mjs +15 -0
  76. package/src/runtime/shared/config.mjs +98 -12
  77. package/src/runtime/shared/process-listener-headroom.mjs +12 -0
  78. package/src/session-runtime/cwd-plugins.mjs +6 -3
  79. package/src/session-runtime/model-route-api.mjs +50 -2
  80. package/src/session-runtime/provider-auth-api.mjs +8 -1
  81. package/src/session-runtime/resource-api.mjs +22 -0
  82. package/src/session-runtime/runtime-core.mjs +13 -2
  83. package/src/session-runtime/settings-api.mjs +11 -2
  84. package/src/standalone/agent-tool.mjs +15 -9
  85. package/src/standalone/explore-tool.mjs +4 -1
  86. package/src/tui/App.jsx +6 -5
  87. package/src/tui/app/transcript-window.mjs +60 -10
  88. package/src/tui/app/use-transcript-window.mjs +2 -1
  89. package/src/tui/components/ContextPanel.jsx +4 -1
  90. package/src/tui/components/ToolExecution.jsx +15 -12
  91. package/src/tui/components/TranscriptItem.jsx +1 -1
  92. package/src/tui/components/tool-execution/surface-detail.mjs +8 -8
  93. package/src/tui/dist/index.mjs +473 -155
  94. package/src/tui/engine/agent-job-feed.mjs +26 -6
  95. package/src/tui/engine/context-state.mjs +13 -4
  96. package/src/tui/engine/notification-plan.mjs +3 -3
  97. package/src/tui/engine/render-timing.mjs +104 -8
  98. package/src/tui/engine/session-api.mjs +58 -3
  99. package/src/tui/engine/session-flow.mjs +78 -28
  100. package/src/tui/engine/tool-card-results.mjs +28 -13
  101. package/src/tui/engine/turn.mjs +232 -156
  102. package/src/tui/engine.mjs +17 -8
  103. package/src/tui/index.jsx +10 -1
  104. package/src/workflows/default/WORKFLOW.md +8 -4
  105. package/src/workflows/solo/WORKFLOW.md +8 -4
@@ -109,14 +109,13 @@ const TOOL_APPROVAL_TIMEOUT_MS = (() => {
109
109
  return Number.isFinite(value) && value > 0 ? Math.max(1000, Math.round(value)) : 120_000;
110
110
  })();
111
111
 
112
- // Wall-clock cap for a single lead TUI turn. A provider call that never
113
- // resolves (e.g. a rate-limit retry loop that spins forever) otherwise leaves
114
- // runTurn holding busy=true with no unwind, so submit() only ever queues and
115
- // the UI is permanently input-dead. On trip we abort the in-flight run through
116
- // the SAME interrupt path Esc uses, force busy=false, and drain the queue.
117
- // Default is intentionally finite (5min): 30min made a stuck provider/worker
118
- // look like the Lead session had frozen mid-turn. Env-overridable for long
119
- // local experiments.
112
+ // Idle cap for a single lead TUI turn: the timer is reset by observable model,
113
+ // tool, usage, stage, compact, or steering progress. A provider call that stops
114
+ // producing progress otherwise leaves runTurn holding busy=true with no unwind,
115
+ // so submit() only ever queues and the UI is permanently input-dead. On trip we
116
+ // abort through the SAME interrupt path Esc uses; if that does not unwind, a
117
+ // short grace path force-releases busy=false and drains the queue. Default is
118
+ // intentionally finite (5min). Env-overridable for long local experiments.
120
119
  const LEAD_TURN_TIMEOUT_MS = (() => {
121
120
  const value = Number(process.env.MIXDOG_LEAD_TURN_TIMEOUT_MS);
122
121
  return Number.isFinite(value) && value > 0 ? Math.max(10_000, Math.round(value)) : 5 * 60_000;
@@ -269,8 +268,16 @@ export async function createEngineSession({
269
268
  }
270
269
  }
271
270
  if (!changed) return false;
271
+ // Detect commandBusy releasing (true -> false). Submits that arrived while a
272
+ // session command was in flight were queued and drain bailed on commandBusy;
273
+ // re-kick drain here — one central point covers every command releaser
274
+ // (setModel/newSession/resume/clear/...) so queued prompts are never stranded.
275
+ const commandBusyReleased = state.commandBusy === true
276
+ && Object.prototype.hasOwnProperty.call(patch, 'commandBusy')
277
+ && patch.commandBusy === false;
272
278
  state = { ...state, ...patch };
273
279
  emit();
280
+ if (commandBusyReleased) queueMicrotask(() => { void bag.drain?.(); });
274
281
  return true;
275
282
  };
276
283
 
@@ -518,6 +525,7 @@ export async function createEngineSession({
518
525
  flushDeferredExecutionPendingResumeKick,
519
526
  scheduleExecutionPendingResumeKick,
520
527
  updateAgentJobCard,
528
+ buildAgentJobCardPatch,
521
529
  subscribeRuntimeNotifications,
522
530
  } = createAgentJobFeed({
523
531
  runtime,
@@ -556,6 +564,7 @@ export async function createEngineSession({
556
564
  patchItem,
557
565
  markToolCallDone,
558
566
  updateAgentJobCard,
567
+ buildAgentJobCardPatch,
559
568
  agentStatusState,
560
569
  });
561
570
 
package/src/tui/index.jsx CHANGED
@@ -13,6 +13,7 @@ import { performance } from 'node:perf_hooks';
13
13
  import { format } from 'node:util';
14
14
  import { App } from './App.jsx';
15
15
  import { createEngineSession } from './engine.mjs';
16
+ import { scheduleRenderFrameAck } from './engine/render-timing.mjs';
16
17
  import { installProcessSignalCleanup } from '../runtime/shared/process-shutdown.mjs';
17
18
  import { emitTerminalBackground, loadThemeSettingFromConfig, theme } from './theme.mjs';
18
19
  import { POP_KITTY, DISABLE_MODIFY_OTHER_KEYS } from './keyboard-protocol.mjs';
@@ -139,7 +140,14 @@ function installTuiPerfProbe() {
139
140
  }
140
141
 
141
142
  function makeRenderProfiler() {
142
- if (!PERF_ENABLED) return undefined;
143
+ // Always resolve pending yieldToRenderer() acks on each painted frame so
144
+ // split transcript commits (preamble frame → tool-card frame) wait for a
145
+ // real render instead of a fixed timeout. Ink calls onRender before its
146
+ // renderInteractiveFrame/stdout write, so defer the ack one macrotask: the
147
+ // split continuation then resumes after the frame has been emitted, not while
148
+ // it can still coalesce with the same write. Profiling stays gated on PERF.
149
+ const ackRenderedFrame = () => { scheduleRenderFrameAck(); };
150
+ if (!PERF_ENABLED) return ackRenderedFrame;
143
151
  let count = 0;
144
152
  let sum = 0;
145
153
  let max = 0;
@@ -147,6 +155,7 @@ function makeRenderProfiler() {
147
155
  let maxGap = 0;
148
156
  let lastFrameAt = 0;
149
157
  return ({ renderTime } = {}) => {
158
+ ackRenderedFrame();
150
159
  const now = performance.now();
151
160
  const ms = Number(renderTime) || 0;
152
161
  const gap = lastFrameAt ? now - lastFrameAt : 0;
@@ -7,9 +7,12 @@ agents: worker, heavy-worker, reviewer, debugger, maintainer
7
7
 
8
8
  # Default Workflow
9
9
 
10
- HARD APPROVAL GATE — before explicit go-ahead ("do it", "proceed", "ㄱㄱ"),
11
- only read-only exploration; no changes, state mutations, or delegation.
12
- Diagnosis agreement/problem-pointing is NOT approval.
10
+ HARD APPROVAL GATE — investigation/planning may proceed only as read-only
11
+ exploration while consulting with the user. After user consultation produces a
12
+ conclusion and plan, execution is still forbidden until explicit go-ahead
13
+ ("do it", "proceed", "go ahead"). Diagnosis agreement, problem-pointing, or plan
14
+ agreement is NOT execution approval. No changes, state mutations, or delegation
15
+ before explicit go-ahead.
13
16
 
14
17
  Lead supervises/delegates/coordinates/judges/decides. After approval route by
15
18
  complexity: Lead directly only one-step single-turn fixes plus coordination,
@@ -19,7 +22,8 @@ implementation verification; Debugger = very high complexity or root-cause
19
22
  after a failed fix.
20
23
 
21
24
  1. Plan — present a draft before ANY implementation; revise/re-present until
22
- explicit go-ahead.
25
+ user consultation is complete and a conclusion/plan is agreed. Then wait for
26
+ explicit go-ahead before executing. If ambiguous, restate the plan and ask.
23
27
  2. Delegate — maximize parallel distribution: split independent implementation
24
28
  scopes to separate worker/heavy-worker agents, all spawned in the SAME turn.
25
29
  Sequential steps only inside one inseparable complex scope, gated
@@ -7,12 +7,16 @@ agents:
7
7
 
8
8
  # Solo Workflow
9
9
 
10
- HARD APPROVAL GATE — before explicit go-ahead ("do it", "proceed", "ㄱㄱ"),
11
- only read-only exploration; no changes or state mutations. Diagnosis
12
- agreement/problem-pointing is NOT approval.
10
+ HARD APPROVAL GATE — investigation/planning may proceed only as read-only
11
+ exploration while consulting with the user. After user consultation produces a
12
+ conclusion and plan, execution is still forbidden until explicit go-ahead
13
+ ("do it", "proceed", "go ahead"). Diagnosis agreement, problem-pointing, or plan
14
+ agreement is NOT execution approval. No changes or state mutations before
15
+ explicit go-ahead.
13
16
 
14
17
  1. Plan — present a draft before ANY implementation; revise/re-present until
15
- explicit go-ahead. If ambiguous, restate the plan and ask.
18
+ user consultation is complete and a conclusion/plan is agreed. Then wait for
19
+ explicit go-ahead before executing. If ambiguous, restate the plan and ask.
16
20
  2. Execute — Lead does all work directly; delegation forbidden. Interim updates
17
21
  are in-progress, never conclusions.
18
22
  3. Verify — check and fix directly until clean or a blocker is reported.