mixdog 0.9.91 → 0.9.93

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 (79) hide show
  1. package/README.md +147 -51
  2. package/package.json +6 -5
  3. package/scripts/code-graph-description-contract.mjs +6 -8
  4. package/scripts/tmp-cdp-errors.mjs +41 -0
  5. package/scripts/tmp-cdp-inspect.mjs +41 -0
  6. package/scripts/tool-overhead-microbench.mjs +60 -0
  7. package/scripts/tui-transcript-jitter-harness.mjs +2 -18
  8. package/src/agents/debugger/agent.json +1 -1
  9. package/src/agents/explore/agent.json +1 -1
  10. package/src/agents/heavy-worker/agent.json +1 -1
  11. package/src/agents/maintainer/agent.json +1 -1
  12. package/src/agents/reviewer/agent.json +1 -1
  13. package/src/agents/worker/agent.json +1 -1
  14. package/src/lib/rules-builder.cjs +5 -5
  15. package/src/output-styles/simple.md +1 -1
  16. package/src/rules/agent/00-core.md +1 -2
  17. package/src/rules/lead/01-general.md +1 -0
  18. package/src/rules/shared/01-tool.md +19 -21
  19. package/src/runtime/agent/orchestrator/agent-runtime/cache-strategy.mjs +16 -3
  20. package/src/runtime/agent/orchestrator/agent-trace.mjs +17 -0
  21. package/src/runtime/agent/orchestrator/context/collect.mjs +2 -1
  22. package/src/runtime/agent/orchestrator/providers/anthropic-effort.mjs +9 -1
  23. package/src/runtime/agent/orchestrator/providers/anthropic-oauth.mjs +90 -22
  24. package/src/runtime/agent/orchestrator/providers/anthropic.mjs +54 -19
  25. package/src/runtime/agent/orchestrator/providers/lib/anthropic-request-utils.mjs +18 -1
  26. package/src/runtime/agent/orchestrator/providers/openai-oauth-http-sse.mjs +44 -8
  27. package/src/runtime/agent/orchestrator/providers/openai-oauth-ws.mjs +10 -0
  28. package/src/runtime/agent/orchestrator/providers/openai-ws-events.mjs +3 -0
  29. package/src/runtime/agent/orchestrator/providers/openai-ws-stream.mjs +2 -0
  30. package/src/runtime/agent/orchestrator/providers/retry-classifier.mjs +35 -0
  31. package/src/runtime/agent/orchestrator/session/agent-loop.mjs +34 -5
  32. package/src/runtime/agent/orchestrator/session/eager-dispatch.mjs +35 -29
  33. package/src/runtime/agent/orchestrator/session/loop/stop-hooks.mjs +9 -0
  34. package/src/runtime/agent/orchestrator/session/loop/stored-tool-args.mjs +11 -2
  35. package/src/runtime/agent/orchestrator/session/loop/tool-classify.mjs +5 -6
  36. package/src/runtime/agent/orchestrator/session/loop/tool-exec.mjs +31 -2
  37. package/src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs +60 -0
  38. package/src/runtime/agent/orchestrator/session/manager/pending-messages.mjs +60 -31
  39. package/src/runtime/agent/orchestrator/session/manager.mjs +1 -1
  40. package/src/runtime/agent/orchestrator/session/result-classification.mjs +28 -0
  41. package/src/runtime/agent/orchestrator/session/send-with-recovery.mjs +71 -2
  42. package/src/runtime/agent/orchestrator/session/store/listing.mjs +17 -0
  43. package/src/runtime/agent/orchestrator/session/store-summary-reader.mjs +101 -0
  44. package/src/runtime/agent/orchestrator/session/store.mjs +30 -0
  45. package/src/runtime/agent/orchestrator/session/tool-batch.mjs +19 -23
  46. package/src/runtime/agent/orchestrator/stall-policy.mjs +31 -21
  47. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool.mjs +4 -1
  48. package/src/runtime/agent/orchestrator/tools/builtin/builtin-tools.mjs +12 -6
  49. package/src/runtime/agent/orchestrator/tools/builtin/task-tool.mjs +5 -0
  50. package/src/runtime/agent/orchestrator/tools/code-graph-tool-defs.mjs +4 -3
  51. package/src/runtime/agent/orchestrator/tools/lib/pwsh-standby-pool.mjs +47 -14
  52. package/src/runtime/agent/orchestrator/tools/patch/v4a-convert.mjs +100 -0
  53. package/src/runtime/agent/orchestrator/tools/patch-tool-defs.mjs +6 -5
  54. package/src/runtime/agent/orchestrator/tools/shell-command.mjs +9 -0
  55. package/src/runtime/agent/orchestrator/tools/shell-state.mjs +32 -2
  56. package/src/runtime/channels/backends/discord-gateway.mjs +6 -32
  57. package/src/runtime/channels/lib/inbound-handler.mjs +19 -3
  58. package/src/runtime/channels/lib/scheduler.mjs +51 -3
  59. package/src/runtime/channels/lib/worker-main.mjs +4 -0
  60. package/src/runtime/channels/tool-defs.mjs +4 -2
  61. package/src/runtime/memory/lib/query-handlers.mjs +11 -3
  62. package/src/runtime/memory/tool-defs.mjs +5 -5
  63. package/src/runtime/shared/channel-notification-routing.mjs +8 -2
  64. package/src/runtime/shared/llm/http-agent.mjs +11 -0
  65. package/src/session-runtime/lifecycle-api.mjs +26 -1
  66. package/src/session-runtime/output-styles.mjs +1 -4
  67. package/src/session-runtime/tool-catalog-data.mjs +5 -2
  68. package/src/session-runtime/workflow.mjs +25 -13
  69. package/src/standalone/agent-tool/tag-registry.mjs +5 -1
  70. package/src/standalone/explore-tool.mjs +1 -1
  71. package/src/tui/dist/index.mjs +100 -46
  72. package/src/tui/engine/agent-envelope.mjs +52 -3
  73. package/src/tui/engine/session-api.mjs +17 -0
  74. package/src/tui/engine/tui-steering-persist.mjs +24 -1
  75. package/src/tui/engine/turn.mjs +8 -9
  76. package/src/tui/engine.mjs +18 -41
  77. package/src/workflows/default/WORKFLOW.md +7 -18
  78. package/src/workflows/solo/WORKFLOW.md +0 -6
  79. package/src/workflows/solo-bench/WORKFLOW.md +17 -0
@@ -7,10 +7,12 @@ import { pickVerb, pickDoneVerb, compactEventLabel, compactEventDetail } from '.
7
7
  import { toolResultText, toolErrorDisplay } from './tool-result-text.mjs';
8
8
  import { toolCallId, toolResultCallId, toolCallName, toolCallArgs } from './tool-call-fields.mjs';
9
9
  import { promptDisplayText, STEERING_SUPPRESSED_DISPLAY } from './queue-helpers.mjs';
10
- import { yieldToRenderer } from './render-timing.mjs';
10
+ import { TUI_FRAME_MS, yieldToRenderer } from './render-timing.mjs';
11
11
  import { createTurnWatchdog } from './turn-watchdog.mjs';
12
12
  import { aggregateRawResult, aggregateBucketForCategory, aggregateSummaries, assignAggregateSummaryOrder, failureDetailText, toolCallOutcome } from './tool-result-status.mjs';
13
13
 
14
+ export const STREAM_BATCH_INTERVAL_MS = TUI_FRAME_MS;
15
+
14
16
  export function createRunTurn(bag) {
15
17
  const {
16
18
  runtime, nextId, tuiDebug, LEAD_TURN_TIMEOUT_MS, flags, pending, itemIndexById, getState, set, flushEmit, flushEmitImmediate, pushItem, appendItems, patchItem, replaceItems, updateStreamingTail: updateStreamingTailFromStore, settleStreamingTail: settleStreamingTailFromStore, clearStreamingTail: clearStreamingTailFromStore, pushNotice, pushUserOrSyntheticItem, markToolCallActive, markToolCallDone, clearActiveToolSummary, agentStatusState, routeState, transcriptRouteMetadata, syncContextStats, denyAllToolApprovals, requestToolApproval, patchToolCardResult, flushToolResults, flushDeferredExecutionPendingResumeKick, drain, drainPendingSteering,
@@ -563,15 +565,12 @@ export function createRunTurn(bag) {
563
565
  // --- Streaming-delta batcher ---
564
566
  // onTextDelta and onReasoningDelta fire on every tiny chunk (often <10 chars).
565
567
  // Each call previously called set() → emit() → full React reconcile. We
566
- // batch accumulated text and flush at most once per STREAM_BATCH_INTERVAL_MS
567
- // (≈16ms / 60fps cap). A forced flush happens before any tool call,
568
+ // batch accumulated text and flush at most once per STREAM_BATCH_INTERVAL_MS.
569
+ // A forced flush happens before any tool call,
568
570
  // finalization, or error so those code paths see the correct text getState().
569
- // Flush cadence for streamed text/thinking. 8ms (~120fps) matches the Ink
570
- // render maxFps (index.jsx render({ maxFps: 120 })), so a queued batch is
571
- // never held back waiting for the next Ink frame. 16ms (~60fps) left every
572
- // other Ink frame idle, which made fast provider streams visibly land in
573
- // coarse chunks ("10 chars at a time").
574
- const STREAM_BATCH_INTERVAL_MS = 16;
571
+ // Share Ink's exact 120fps cadence with the frame-batched store. A separate
572
+ // 16ms timer left every other terminal frame idle, so completed script lines
573
+ // accumulated and then climbed into view in coarse two-step chunks.
575
574
  let _batchTimer = null;
576
575
  let _pendingTextFlush = false; // true when a text/spinner update is queued
577
576
  let _pendingThinkFlush = false; // true when a thinking update is queued
@@ -55,6 +55,7 @@ import {
55
55
  toolCallArgs,
56
56
  } from './engine/tool-call-fields.mjs';
57
57
  import {
58
+ buildExecutionResponseToolItem,
58
59
  parseBackgroundTaskEnvelope,
59
60
  parseSyntheticAgentMessage,
60
61
  toolResultStatus,
@@ -179,6 +180,7 @@ const LEAD_TURN_TIMEOUT_MS = (() => {
179
180
  // the alternate-screen render; enable with MIXDOG_TUI_DEBUG=1.
180
181
  import { tuiDebug, nextId, cleanupStaleTranscriptSpillDirs, createTranscriptSpillBuffer, refillTranscriptViewOverlap, replaceEngineItemsState, createEngineItemMutators, TRANSCRIPT_LIVE_ITEM_CAP, TRANSCRIPT_SPILL_CHUNK_ITEMS } from './engine/transcript-spill.mjs';
181
182
  export { cleanupStaleTranscriptSpillDirs, createTranscriptSpillBuffer, refillTranscriptViewOverlap, replaceEngineItemsState, createEngineItemMutators, TRANSCRIPT_LIVE_ITEM_CAP, TRANSCRIPT_SPILL_CHUNK_ITEMS } from './engine/transcript-spill.mjs';
183
+ export { parseBackgroundTaskEnvelope } from './engine/agent-envelope.mjs';
182
184
 
183
185
  export async function createEngineSession({
184
186
  provider: providerName,
@@ -647,16 +649,15 @@ export async function createEngineSession({
647
649
  });
648
650
  };
649
651
  const pushAsyncAgentResponse = (text, id = nextId(), origin = 'injected', metadata = {}) => {
650
- const synthetic = parseSyntheticAgentMessage(text);
651
- const isAgent = synthetic?.name === 'agent';
652
- if (!isAgent) return pushUserOrSyntheticItem(text, id, origin);
653
- const responseHasBody = /\n\s*\n[\s\S]*\S/.test(String(text || ''));
654
- const rawResult = synthetic.rawResult ?? text;
655
- const args = {
656
- ...(synthetic.args && typeof synthetic.args === 'object' ? synthetic.args : {}),
657
- type: 'result',
658
- };
659
- const responseKey = String(metadata.responseKey || metadata.executionId || args.task_id || '').trim();
652
+ const responseItem = buildExecutionResponseToolItem(text, {
653
+ id,
654
+ responseKey: metadata.responseKey || metadata.executionId,
655
+ });
656
+ if (!responseItem) return pushUserOrSyntheticItem(text, id, origin);
657
+ if (responseItem.name !== 'agent') {
658
+ pushItem(responseItem);
659
+ return true;
660
+ }
660
661
  const previous = state.items.at(-1);
661
662
  // Tail-only aggregation prevents a later completion from mutating a card
662
663
  // above any outbound tool, assistant, user, or preview/body boundary.
@@ -665,43 +666,19 @@ export async function createEngineSession({
665
666
  && previous.agentDirection === 'inbound'
666
667
  ) {
667
668
  const patch = appendAgentResponseTail(previous, {
668
- key: responseKey,
669
- args,
670
- result: synthetic.result,
671
- rawResult,
672
- hasBody: responseHasBody,
673
- isError: synthetic.isError === true,
669
+ key: responseItem.agentResponseKey,
670
+ args: responseItem.args,
671
+ result: responseItem.result,
672
+ rawResult: responseItem.rawResult,
673
+ hasBody: responseItem.agentResponseHasBody,
674
+ isError: responseItem.isError,
674
675
  });
675
676
  if (patch) {
676
677
  patchItem(previous.id, patch);
677
678
  return true;
678
679
  }
679
680
  }
680
- pushItem({
681
- kind: 'tool',
682
- id,
683
- name: 'agent',
684
- args,
685
- result: synthetic.result,
686
- rawResult,
687
- isError: synthetic.isError === true,
688
- expanded: false,
689
- count: 1,
690
- completedCount: 1,
691
- startedAt: Date.now(),
692
- completedAt: Date.now(),
693
- agentDirection: 'inbound',
694
- agentResponseKey: responseKey,
695
- agentResponseHasBody: responseHasBody,
696
- agentResponseAggregate: false,
697
- agentResponseEntries: [{
698
- key: responseKey,
699
- raw: String(rawResult ?? '').trim(),
700
- result: synthetic.result,
701
- hasBody: responseHasBody,
702
- isError: synthetic.isError === true,
703
- }],
704
- });
681
+ pushItem(responseItem);
705
682
  return true;
706
683
  };
707
684
  const pushToast = (text, tone = 'info', ttlMs = 3000) => {
@@ -2,7 +2,7 @@
2
2
  id: default
3
3
  name: Cowork
4
4
  description: "Parallel delegation."
5
- agents: worker, heavy-worker, reviewer, debugger, maintainer
5
+ agents: worker, heavy-worker, reviewer, debugger
6
6
  ---
7
7
 
8
8
  # Cowork
@@ -13,23 +13,12 @@ investigation and planning — no edits, no state mutation, no delegation.
13
13
  A new or changed request resets planning; a scope change requires fresh
14
14
  approval.
15
15
 
16
- On approval, fan out at maximum width: one agent per independent scope, all
17
- spawned in one turn; only a scope that depends on another's output waits.
18
- Split the plan into as many scopes as possible: disjoint file/module sets
19
- are independent; merge only on a true output dependency. Prefer parallel
20
- scopes over sequential slices in one agent. Brief each agent per the Lead
21
- Brief contract.
22
-
23
- Route by complexity: simple, well-understood implementation goes to Worker;
24
- complex or investigative implementation goes to Heavy Worker; Lead itself
25
- edits only a local, one-turn configuration/git change. Debugger only on a
26
- defect needing deep root-cause analysis or a bug surviving 2+ review/fix
27
- cycles.
28
-
29
- Every implementation gets its own Reviewer, attached per scope — only the
30
- local Lead-direct edits above are exempt. Keep the same reviewer through the
31
- fix loop and repeat fix -> re-verify until clean; Lead cross-verifies in
32
- parallel with the Reviewer.
16
+ On approval, delegate maximally: one agent per independent scope, fit to the
17
+ situation, all spawned in one turn; only a scope that depends on another's
18
+ output waits. Split the plan into as many scopes as possible: disjoint
19
+ file/module sets are independent; merge only on a true output dependency.
20
+ Prefer parallel scopes over sequential slices in one agent. Brief each agent
21
+ per the Lead Brief contract.
33
22
 
34
23
  Report the verified result against the approved plan. Build, deploy, commit,
35
24
  and push happen only on an explicit user request.
@@ -15,12 +15,6 @@ changed request resets planning; a scope change requires fresh approval.
15
15
  On approval, Lead executes all work itself — never spawn, send, or delegate
16
16
  to agents. Complete in-scope fixes without reapproval.
17
17
 
18
- Verification is single-pass and risk-proportional: exactly one check that
19
- most directly proves the deliverable — a direct result check for trivial or
20
- read-only work, full test/build runs only for risky or behavior-changing
21
- work. A pass is final. Iterate only on a failing check, re-running just that
22
- check after each fix, or report the blocker.
23
-
24
18
  Report the result against the approved plan. Build, deploy, commit, and push
25
19
  happen only on an explicit user request.
26
20
 
@@ -0,0 +1,17 @@
1
+ ---
2
+ id: solo-bench
3
+ name: Solo Bench
4
+ description: "Benchmark-only Solo without the planning approval gate."
5
+ agents:
6
+ hidden: true
7
+ ---
8
+
9
+ # Solo Bench
10
+
11
+ Lead executes all work itself — never spawn, send, or delegate to agents.
12
+ Complete in-scope fixes without reapproval.
13
+
14
+ Report the result. Build, deploy, commit, and push happen only on an explicit
15
+ user request.
16
+
17
+ On direction change, pause and re-consult the user.