mixdog 0.9.36 → 0.9.38

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 (115) 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/dispatch-persist-recovery-test.mjs +141 -0
  5. package/scripts/explore-bench-tmp.mjs +19 -0
  6. package/scripts/explore-bench.mjs +101 -14
  7. package/scripts/explore-prompt-policy-test.mjs +31 -0
  8. package/scripts/ingest-pure-conversation-smoke.mjs +11 -11
  9. package/scripts/notify-completion-mirror-test.mjs +73 -0
  10. package/scripts/openai-ws-early-settle-test.mjs +176 -0
  11. package/scripts/output-style-smoke.mjs +17 -17
  12. package/scripts/provider-toolcall-test.mjs +333 -14
  13. package/scripts/recall-bench-cases.json +3 -3
  14. package/scripts/recall-bench.mjs +1 -1
  15. package/scripts/recall-quality-cases.json +4 -4
  16. package/scripts/recall-usecase-cases.json +2 -2
  17. package/scripts/session-bench.mjs +13 -13
  18. package/scripts/session-sweep.mjs +266 -0
  19. package/scripts/steering-drain-buckets-test.mjs +72 -11
  20. package/scripts/submit-commandbusy-race-test.mjs +114 -0
  21. package/scripts/tool-smoke.mjs +83 -10
  22. package/src/app.mjs +2 -1
  23. package/src/defaults/cycle3-review-prompt.md +9 -0
  24. package/src/defaults/skills/setup/SKILL.md +93 -293
  25. package/src/lib/rules-builder.cjs +3 -2
  26. package/src/output-styles/default.md +2 -2
  27. package/src/output-styles/extreme-minimal.md +1 -1
  28. package/src/output-styles/minimal.md +1 -1
  29. package/src/output-styles/simple.md +2 -3
  30. package/src/rules/agent/30-explorer.md +40 -14
  31. package/src/rules/lead/01-general.md +4 -0
  32. package/src/rules/shared/01-tool.md +7 -3
  33. package/src/runtime/agent/orchestrator/agent-trace-format.mjs +15 -3
  34. package/src/runtime/agent/orchestrator/config.mjs +1 -1
  35. package/src/runtime/agent/orchestrator/dispatch-persist.mjs +31 -8
  36. package/src/runtime/agent/orchestrator/providers/anthropic-oauth-credentials.mjs +13 -7
  37. package/src/runtime/agent/orchestrator/providers/anthropic-oauth.mjs +6 -6
  38. package/src/runtime/agent/orchestrator/providers/anthropic.mjs +6 -6
  39. package/src/runtime/agent/orchestrator/providers/oauth-credential-probes.mjs +35 -5
  40. package/src/runtime/agent/orchestrator/providers/openai-compat-stream.mjs +27 -0
  41. package/src/runtime/agent/orchestrator/providers/openai-compat-wire.mjs +36 -37
  42. package/src/runtime/agent/orchestrator/providers/openai-compat.mjs +2 -2
  43. package/src/runtime/agent/orchestrator/providers/openai-oauth-http-sse.mjs +72 -1
  44. package/src/runtime/agent/orchestrator/providers/openai-oauth-ws.mjs +26 -3
  45. package/src/runtime/agent/orchestrator/providers/openai-oauth.mjs +12 -28
  46. package/src/runtime/agent/orchestrator/providers/openai-transport-policy.mjs +18 -15
  47. package/src/runtime/agent/orchestrator/providers/openai-ws-delta.mjs +5 -2
  48. package/src/runtime/agent/orchestrator/providers/openai-ws-pool.mjs +119 -3
  49. package/src/runtime/agent/orchestrator/providers/openai-ws-stream.mjs +113 -2
  50. package/src/runtime/agent/orchestrator/providers/registry.mjs +44 -5
  51. package/src/runtime/agent/orchestrator/providers/tool-stream-state.mjs +78 -0
  52. package/src/runtime/agent/orchestrator/session/agent-loop.mjs +57 -31
  53. package/src/runtime/agent/orchestrator/session/cache/scoped-cache.mjs +8 -6
  54. package/src/runtime/agent/orchestrator/session/eager-dispatch.mjs +28 -2
  55. package/src/runtime/agent/orchestrator/session/loop/tool-classify.mjs +1 -3
  56. package/src/runtime/agent/orchestrator/session/loop/tool-helpers.mjs +15 -2
  57. package/src/runtime/agent/orchestrator/session/manager/ask-session.mjs +30 -55
  58. package/src/runtime/agent/orchestrator/session/manager/prompt-utils.mjs +2 -2
  59. package/src/runtime/agent/orchestrator/session/manager/session-lifecycle.mjs +24 -16
  60. package/src/runtime/agent/orchestrator/session/result-classification.mjs +2 -0
  61. package/src/runtime/agent/orchestrator/session/store.mjs +116 -21
  62. package/src/runtime/agent/orchestrator/session/tool-batch.mjs +5 -2
  63. package/src/runtime/agent/orchestrator/stall-policy.mjs +55 -0
  64. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool.mjs +35 -20
  65. package/src/runtime/agent/orchestrator/tools/builtin/builtin-tools.mjs +9 -9
  66. package/src/runtime/agent/orchestrator/tools/builtin/list-tool.mjs +77 -31
  67. package/src/runtime/agent/orchestrator/tools/builtin/read-tool.mjs +25 -3
  68. package/src/runtime/agent/orchestrator/tools/builtin/search-builders.mjs +9 -2
  69. package/src/runtime/agent/orchestrator/tools/builtin/search-tool.mjs +73 -25
  70. package/src/runtime/agent/orchestrator/tools/builtin.mjs +2 -1
  71. package/src/runtime/agent/orchestrator/tools/code-graph/build.mjs +17 -7
  72. package/src/runtime/agent/orchestrator/tools/code-graph/dispatch.mjs +14 -12
  73. package/src/runtime/agent/orchestrator/tools/code-graph/graph-model.mjs +5 -0
  74. package/src/runtime/agent/orchestrator/tools/code-graph/search.mjs +56 -6
  75. package/src/runtime/agent/orchestrator/tools/code-graph-tool-defs.mjs +1 -1
  76. package/src/runtime/agent/orchestrator/tools/shell-command.mjs +9 -0
  77. package/src/runtime/channels/lib/worker-main.mjs +5 -0
  78. package/src/runtime/memory/lib/core-memory-store.mjs +104 -0
  79. package/src/runtime/memory/lib/ko-morph.mjs +1 -1
  80. package/src/runtime/memory/lib/memory-cycle3.mjs +64 -4
  81. package/src/runtime/memory/lib/memory-text-utils.mjs +4 -4
  82. package/src/runtime/memory/lib/recall-format.mjs +3 -3
  83. package/src/runtime/shared/child-spawn-gate.mjs +15 -0
  84. package/src/runtime/shared/config.mjs +98 -12
  85. package/src/runtime/shared/process-listener-headroom.mjs +12 -0
  86. package/src/session-runtime/cwd-plugins.mjs +6 -3
  87. package/src/session-runtime/model-route-api.mjs +50 -2
  88. package/src/session-runtime/provider-auth-api.mjs +8 -1
  89. package/src/session-runtime/provider-models.mjs +3 -3
  90. package/src/session-runtime/resource-api.mjs +22 -0
  91. package/src/session-runtime/runtime-core.mjs +56 -10
  92. package/src/session-runtime/settings-api.mjs +11 -2
  93. package/src/session-runtime/warmup-schedulers.mjs +7 -1
  94. package/src/standalone/agent-tool.mjs +15 -9
  95. package/src/standalone/explore-tool.mjs +4 -1
  96. package/src/tui/App.jsx +6 -5
  97. package/src/tui/app/transcript-window.mjs +60 -10
  98. package/src/tui/app/use-transcript-window.mjs +2 -1
  99. package/src/tui/components/ContextPanel.jsx +4 -1
  100. package/src/tui/components/ToolExecution.jsx +15 -12
  101. package/src/tui/components/TranscriptItem.jsx +1 -1
  102. package/src/tui/components/tool-execution/surface-detail.mjs +8 -8
  103. package/src/tui/dist/index.mjs +482 -151
  104. package/src/tui/engine/agent-job-feed.mjs +36 -6
  105. package/src/tui/engine/notification-plan.mjs +3 -3
  106. package/src/tui/engine/queue-helpers.mjs +8 -0
  107. package/src/tui/engine/render-timing.mjs +104 -8
  108. package/src/tui/engine/session-api.mjs +58 -3
  109. package/src/tui/engine/session-flow.mjs +93 -29
  110. package/src/tui/engine/tool-card-results.mjs +28 -13
  111. package/src/tui/engine/turn.mjs +238 -157
  112. package/src/tui/engine.mjs +17 -8
  113. package/src/tui/index.jsx +10 -1
  114. package/src/workflows/default/WORKFLOW.md +8 -4
  115. package/src/workflows/solo/WORKFLOW.md +8 -4
@@ -14,7 +14,7 @@ import { summarizeToolResult, aggregateDoneCategories, classifyToolCategory } fr
14
14
  import { toolResultText, toolErrorDisplay, toolGroupedDisplayFallback } from './tool-result-text.mjs';
15
15
  import { toolResultCallId } from './tool-call-fields.mjs';
16
16
  import { memoryCoreResultErrorText } from '../app/input-parsers.mjs';
17
- import { parseAgentJob, agentArgsWithResultMetadata, toolResultStatus, isErrorToolStatus } from './agent-envelope.mjs';
17
+ import { parseAgentJob, toolResultStatus, isErrorToolStatus } from './agent-envelope.mjs';
18
18
  import {
19
19
  withCancelledResultMarker,
20
20
  groupedToolResultText,
@@ -31,6 +31,7 @@ export function createToolCardResults({
31
31
  patchItem,
32
32
  markToolCallDone,
33
33
  updateAgentJobCard,
34
+ buildAgentJobCardPatch,
34
35
  agentStatusState,
35
36
  }) {
36
37
  function patchToolItem(id, patch) {
@@ -65,7 +66,16 @@ export function createToolCardResults({
65
66
  // calls: the text-matcher's ^(error|failed) catch-all would otherwise
66
67
  // misflag legitimate non-memory success output.
67
68
  const isMemoryCall = classifyToolCategory(callRec?.name || card?.name || '', callRec?.args || {}) === 'Memory';
68
- const isError = message?.isError === true || message?.toolKind === 'error' || /^\s*\[?error/i.test(rawText) || isErrorToolStatus(toolResultStatus(rawText)) || (isMemoryCall && memoryCoreResultErrorText(rawText) != null);
69
+ // Split the failure signal into two:
70
+ // isCallError — a REAL tool-call failure (backend isError / error
71
+ // toolKind). ONLY this paints the ● dot red.
72
+ // isResultError — a command/result failure (shell exit code, [error…]
73
+ // text, failed status text, flattened core memory-op
74
+ // failure). These still mark the card Failed in the L2
75
+ // detail but must NOT turn the dot red.
76
+ const isCallError = message?.isError === true || message?.toolKind === 'error';
77
+ const isResultError = /^\s*\[?error/i.test(rawText) || isErrorToolStatus(toolResultStatus(rawText)) || (isMemoryCall && memoryCoreResultErrorText(rawText) != null);
78
+ const isError = isCallError || isResultError;
69
79
  const text = isError ? toolErrorDisplay(rawText, card?.name || 'tool') : rawText;
70
80
 
71
81
  if (aggregate && card.itemId === aggregate.itemId) {
@@ -78,11 +88,13 @@ export function createToolCardResults({
78
88
  callRec.summary = !isError ? summarizeToolResult(callRec.name, callRec.args, rawText, isError) : null;
79
89
  assignAggregateSummaryOrder(aggregate, callRec);
80
90
  callRec.isError = isError;
91
+ callRec.isCallError = isCallError;
81
92
  callRec.resultText = text;
82
93
  callRec.resolved = true;
83
94
  const allCalls = [...aggregate.calls.values()];
84
95
  const completed = allCalls.filter((r) => r.resolved).length;
85
96
  const errors = allCalls.filter((r) => r.isError).length;
97
+ const callErrors = allCalls.filter((r) => r.isCallError).length;
86
98
  // Collapsed detail carries the merged per-call count summary
87
99
  // ("512 lines, 6 matches, 3 files") so the finished card answers "how
88
100
  // much" without ctrl+o. Failures keep a bare 'N Ok · N Failed' status so
@@ -103,6 +115,7 @@ export function createToolCardResults({
103
115
  rawResult: rawResult || null,
104
116
  isError: errors > 0,
105
117
  errorCount: errors,
118
+ callErrorCount: callErrors,
106
119
  count: allCalls.length,
107
120
  completedCount: visualCompleted,
108
121
  doneCategories: aggregateDoneCategories(allCalls),
@@ -114,9 +127,10 @@ export function createToolCardResults({
114
127
  }
115
128
 
116
129
  // Non-aggregate (legacy agent-job cards, etc.)
117
- const group = toolGroups.get(card.itemId) || { count: 1, completed: 0, errors: 0, results: [] };
130
+ const group = toolGroups.get(card.itemId) || { count: 1, completed: 0, errors: 0, callErrors: 0, results: [] };
118
131
  group.completed = Math.min(group.count, group.completed + 1);
119
132
  group.errors += isError ? 1 : 0;
133
+ group.callErrors = (group.callErrors || 0) + (isCallError ? 1 : 0);
120
134
  group.results.push({ text, isError });
121
135
  toolGroups.set(card.itemId, group);
122
136
  const resultText = groupedToolResultText(group);
@@ -126,6 +140,7 @@ export function createToolCardResults({
126
140
  text: displayResult,
127
141
  isError: group.errors > 0,
128
142
  errorCount: group.errors,
143
+ callErrorCount: group.callErrors || 0,
129
144
  count: group.count,
130
145
  completedCount: group.completed,
131
146
  completedAt: Date.now(),
@@ -135,19 +150,17 @@ export function createToolCardResults({
135
150
  if (body) patch.rawResult = text || rawText;
136
151
  const parsedAgent = parseAgentJob(rawText);
137
152
  if (parsedAgent) {
138
- patch.args = agentArgsWithResultMetadata(getState().items.find((it) => it.id === card.itemId)?.args, parsedAgent);
139
153
  set(agentStatusState({ force: true }));
140
154
  }
155
+ // Coalesce the agent-job card refresh (result/text/isError/errorCount/
156
+ // args) into THIS patch instead of a second updateAgentJobCard() call.
157
+ // The two calls previously wrote the same card back-to-back with
158
+ // different result/text strings, producing the visible L1/L2 flash.
159
+ // The agent fields win (final display) while patch keeps the completion
160
+ // metadata (count/completedCount/completedAt/rawResult) for expand.
161
+ Object.assign(patch, buildAgentJobCardPatch(card.itemId, rawText, isError));
141
162
  }
142
163
  patchToolItem(card.itemId, patch);
143
- if (group.count <= 1) {
144
- const beforeAgent = getState().items.find((it) => it.id === card.itemId);
145
- updateAgentJobCard(card.itemId, rawText, isError);
146
- const afterAgent = getState().items.find((it) => it.id === card.itemId);
147
- if (afterAgent && beforeAgent && afterAgent !== beforeAgent) {
148
- carryTranscriptMeasuredRowsCache(beforeAgent, afterAgent);
149
- }
150
- }
151
164
  card.done = true;
152
165
  if (callId) done.add(callId);
153
166
  return true;
@@ -209,6 +222,7 @@ export function createToolCardResults({
209
222
  const completed = allCalls.filter((r) => r.resolved).length;
210
223
  const totalCompleted = completed;
211
224
  const errors = allCalls.filter((r) => r.isError).length;
225
+ const callErrors = allCalls.filter((r) => r.isCallError).length;
212
226
  const succeeded = completed - errors;
213
227
  const rawResult = aggregateRawResult(allCalls);
214
228
  // Collapsed detail carries the merged per-call count summary; failures
@@ -229,6 +243,7 @@ export function createToolCardResults({
229
243
  rawResult: rawResult || null,
230
244
  isError: errors > 0,
231
245
  errorCount: errors,
246
+ callErrorCount: callErrors,
232
247
  count: allCalls.length,
233
248
  completedCount: totalCompleted,
234
249
  doneCategories: aggregateDoneCategories(allCalls),
@@ -250,7 +265,7 @@ export function createToolCardResults({
250
265
  const currentItem = getState().items.find((it) => it.id === card.itemId);
251
266
  resultText = withCancelledResultMarker(resultText, currentItem);
252
267
  }
253
- patchToolItem(card.itemId, { result: resultText, text: resultText, isError: group.errors > 0, errorCount: group.errors, count: group.count, completedCount: group.completed, completedAt: Date.now() });
268
+ patchToolItem(card.itemId, { result: resultText, text: resultText, isError: group.errors > 0, errorCount: group.errors, callErrorCount: group.callErrors || 0, count: group.count, completedCount: group.completed, completedAt: Date.now() });
254
269
  card.done = true;
255
270
  if (card.callId) done.add(card.callId);
256
271
  }