mixdog 0.9.149 → 0.9.151

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 (113) hide show
  1. package/README.md +28 -12
  2. package/package.json +1 -1
  3. package/src/headless-exec.mjs +40 -4
  4. package/src/headless-exec.test.mjs +116 -1
  5. package/src/rules/lead/01-general.md +3 -2
  6. package/src/rules/shared/00-general.md +1 -0
  7. package/src/rules/shared/10-tool-workflow.md +11 -12
  8. package/src/rules/shared/30-exploration.md +4 -3
  9. package/src/rules/shared/60-verification.md +4 -3
  10. package/src/runtime/agent/orchestrator/providers/openai-codex-identity.test.mjs +0 -2
  11. package/src/runtime/agent/orchestrator/providers/openai-codex-metadata.mjs +1 -4
  12. package/src/runtime/agent/orchestrator/providers/openai-codex-model.mjs +0 -18
  13. package/src/runtime/agent/orchestrator/providers/openai-oauth-http-sse.mjs +0 -3
  14. package/src/runtime/agent/orchestrator/providers/openai-oauth-ws.mjs +0 -1
  15. package/src/runtime/agent/orchestrator/providers/openai-responses-payload.mjs +4 -72
  16. package/src/runtime/agent/orchestrator/session/approval-mode.mjs +0 -8
  17. package/src/runtime/agent/orchestrator/session/compact/handoff.mjs +2 -4
  18. package/src/runtime/agent/orchestrator/session/compact/runner.mjs +18 -33
  19. package/src/runtime/agent/orchestrator/session/loop/recall-fasttrack.mjs +21 -42
  20. package/src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs +20 -125
  21. package/src/runtime/agent/orchestrator/session/manager/session-lifecycle.mjs +50 -8
  22. package/src/runtime/agent/orchestrator/session/manager/session-lifecycle.test.mjs +31 -1
  23. package/src/runtime/agent/orchestrator/session/store/serialize.mjs +27 -4
  24. package/src/runtime/agent/orchestrator/session/store/serialize.test.mjs +60 -0
  25. package/src/runtime/agent/orchestrator/session/task-wait-control.mjs +78 -0
  26. package/src/runtime/agent/orchestrator/session/task-wait-control.test.mjs +78 -0
  27. package/src/runtime/agent/orchestrator/tools/builtin/absence-absorption.test.mjs +43 -0
  28. package/src/runtime/agent/orchestrator/tools/builtin/absolute-glob-expand.test.mjs +63 -0
  29. package/src/runtime/agent/orchestrator/tools/builtin/arg-guard.mjs +8 -0
  30. package/src/runtime/agent/orchestrator/tools/builtin/atomic-write.mjs +29 -10
  31. package/src/runtime/agent/orchestrator/tools/builtin/builtin-tools.mjs +7 -7
  32. package/src/runtime/agent/orchestrator/tools/builtin/enoent-outside-project.test.mjs +56 -0
  33. package/src/runtime/agent/orchestrator/tools/builtin/external-tool-adapters.mjs +6 -2
  34. package/src/runtime/agent/orchestrator/tools/builtin/git-command-tool.mjs +50 -23
  35. package/src/runtime/agent/orchestrator/tools/builtin/git-command-tool.test.mjs +50 -1
  36. package/src/runtime/agent/orchestrator/tools/builtin/grep-output-budget.test.mjs +31 -0
  37. package/src/runtime/agent/orchestrator/tools/builtin/grep-single-file-rescue.test.mjs +106 -0
  38. package/src/runtime/agent/orchestrator/tools/builtin/lib/absolute-glob-expand.mjs +129 -0
  39. package/src/runtime/agent/orchestrator/tools/builtin/lib/grep-context-expander.mjs +2 -1
  40. package/src/runtime/agent/orchestrator/tools/builtin/lib/grep-single-file-rescue.mjs +218 -0
  41. package/src/runtime/agent/orchestrator/tools/builtin/lib/list-helpers.mjs +9 -2
  42. package/src/runtime/agent/orchestrator/tools/builtin/list-tool-integrity.test.mjs +6 -0
  43. package/src/runtime/agent/orchestrator/tools/builtin/list-tool.mjs +50 -2
  44. package/src/runtime/agent/orchestrator/tools/builtin/native-search-client.mjs +7 -1
  45. package/src/runtime/agent/orchestrator/tools/builtin/noise-dir-visibility.test.mjs +69 -0
  46. package/src/runtime/agent/orchestrator/tools/builtin/path-diagnostics.mjs +33 -6
  47. package/src/runtime/agent/orchestrator/tools/builtin/read-glob-survey.test.mjs +71 -0
  48. package/src/runtime/agent/orchestrator/tools/builtin/read-image-resize.mjs +6 -1
  49. package/src/runtime/agent/orchestrator/tools/builtin/read-single-tool.mjs +7 -0
  50. package/src/runtime/agent/orchestrator/tools/builtin/read-tool.mjs +54 -8
  51. package/src/runtime/agent/orchestrator/tools/builtin/runtime-capabilities.mjs +90 -51
  52. package/src/runtime/agent/orchestrator/tools/builtin/runtime-capabilities.test.mjs +56 -0
  53. package/src/runtime/agent/orchestrator/tools/builtin/search-builders.mjs +25 -0
  54. package/src/runtime/agent/orchestrator/tools/builtin/search-builders.test.mjs +16 -0
  55. package/src/runtime/agent/orchestrator/tools/builtin/search-glob-tool.mjs +30 -1
  56. package/src/runtime/agent/orchestrator/tools/builtin/search-grep-tool.mjs +60 -5
  57. package/src/runtime/agent/orchestrator/tools/builtin/search-path-diagnostics.mjs +54 -1
  58. package/src/runtime/agent/orchestrator/tools/builtin/task-tool.mjs +49 -24
  59. package/src/runtime/agent/orchestrator/tools/builtin/tool-output-limit.mjs +1 -0
  60. package/src/runtime/agent/orchestrator/tools/builtin/write-symlink.test.mjs +153 -0
  61. package/src/runtime/agent/orchestrator/tools/builtin.mjs +11 -1
  62. package/src/runtime/agent/orchestrator/tools/code-graph/aggregate-anchor-relocation.test.mjs +55 -0
  63. package/src/runtime/agent/orchestrator/tools/code-graph/dispatch.mjs +54 -3
  64. package/src/runtime/agent/orchestrator/tools/env-scrub.mjs +16 -0
  65. package/src/runtime/agent/orchestrator/tools/env-scrub.test.mjs +33 -1
  66. package/src/runtime/agent/orchestrator/tools/graph-manifest.json +11 -11
  67. package/src/runtime/agent/orchestrator/tools/lib/native-spawn-client.mjs +9 -1
  68. package/src/runtime/agent/orchestrator/tools/patch/dispatch.mjs +44 -10
  69. package/src/runtime/agent/orchestrator/tools/patch/orchestrator.mjs +57 -5
  70. package/src/runtime/agent/orchestrator/tools/patch/patch-symlink.test.mjs +141 -0
  71. package/src/runtime/agent/orchestrator/tools/patch/v4a-convert.mjs +7 -3
  72. package/src/runtime/agent/orchestrator/tools/patch/v4a-pure-move.test.mjs +57 -0
  73. package/src/runtime/agent/orchestrator/tools/patch/v4a-section-coalesce.test.mjs +81 -0
  74. package/src/runtime/agent/orchestrator/tools/shell-command.mjs +42 -23
  75. package/src/runtime/media/renditions.mjs +7 -1
  76. package/src/runtime/memory/index.mjs +2 -4
  77. package/src/runtime/memory/lib/pg/process.mjs +29 -2
  78. package/src/runtime/memory/lib/pg/process.test.mjs +36 -0
  79. package/src/runtime/memory/lib/pg/supervisor.mjs +5 -1
  80. package/src/runtime/memory/lib/query-handlers.mjs +13 -19
  81. package/src/runtime/memory/lib/recall-format.mjs +13 -31
  82. package/src/runtime/memory/tool-defs.mjs +2 -2
  83. package/src/runtime/shared/memory-snapshot.mjs +57 -4
  84. package/src/runtime/shared/pristine-execution-contract.json +3 -0
  85. package/src/runtime/shared/pristine-execution.mjs +6 -3
  86. package/src/runtime/shared/tool-surface.mjs +6 -0
  87. package/src/runtime/shared/tool-surface.test.mjs +8 -0
  88. package/src/session-runtime/lifecycle-api.mjs +1 -0
  89. package/src/session-runtime/session-turn-api.mjs +5 -0
  90. package/src/standalone/agent-dispatch-broker.mjs +25 -80
  91. package/src/standalone/channel-worker-heartbeat.test.mjs +30 -0
  92. package/src/standalone/channel-worker.mjs +31 -1
  93. package/src/standalone/daemon.mjs +9 -9
  94. package/src/standalone/memory-runtime-proxy.mjs +5 -2
  95. package/src/standalone/session-client.mjs +23 -3
  96. package/src/standalone/session-runtime-host-health.test.mjs +36 -0
  97. package/src/standalone/session-runtime-host.mjs +26 -76
  98. package/src/standalone/session-runtime-worker.mjs +97 -0
  99. package/src/tui/App.jsx +3 -2
  100. package/src/tui/app/use-global-key-input.mjs +9 -0
  101. package/src/tui/app/use-mouse-input.mjs +77 -14
  102. package/src/tui/components/Spinner.jsx +1 -1
  103. package/src/tui/dist/index.mjs +83 -23
  104. package/src/tui/lib/voice-setup.mjs +3 -2
  105. package/src/tui/session/completion-card-restore.test.mjs +18 -0
  106. package/src/tui/session/session-api-ext.mjs +2 -1
  107. package/src/tui/session/session-api.mjs +8 -1
  108. package/src/tui/session/task-wait-submit.test.mjs +80 -0
  109. package/src/tui/session/turn.mjs +58 -6
  110. package/src/tui/spinner-verbs.mjs +1 -0
  111. package/src/workflows/default/WORKFLOW.md +12 -19
  112. package/src/workflows/headless/WORKFLOW.md +11 -0
  113. package/src/workflows/solo/WORKFLOW.md +6 -11
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * src/tui/session/turn.mjs - lead TUI turn session runtime (createRunTurn). Extracted from session-local.mjs.
3
3
  */
4
- import { aggregateToolCategoryEntries, aggregateDoneCategories, classifyToolCategory, formatAggregateDetail, summarizeToolResult, toolLoadingTargets } from '../../runtime/shared/tool-surface.mjs';
4
+ import { aggregateToolCategoryEntries, aggregateDoneCategories, classifyToolCategory, formatAggregateDetail, isTaskWaitToolCall, summarizeToolResult, toolLoadingTargets } from '../../runtime/shared/tool-surface.mjs';
5
5
  import { applyUsageDelta } from './session-stats.mjs';
6
6
  import { pickVerb, pickDoneVerb, compactEventLabel, compactEventDetail } from './labels.mjs';
7
7
  import { toolResultText, toolErrorDisplay, stripShellExitHeader } from './tool-result-text.mjs';
@@ -109,6 +109,19 @@ export function createRunTurn(bag) {
109
109
  const toolCards = [];
110
110
  const toolGroups = new Map();
111
111
  const resultsDone = new Set();
112
+ // `task wait` is passive control flow, not user-visible work. Keep its call
113
+ // ids only long enough to suppress live/result cards and drive the spinner.
114
+ const suppressedTaskWaitCallIds = new Set();
115
+ const activeTaskWaitCallIds = new Set();
116
+ const refreshTaskWaitSpinner = () => {
117
+ if (!getState().spinner) return;
118
+ set({
119
+ spinner: {
120
+ ...getState().spinner,
121
+ mode: activeTaskWaitCallIds.size > 0 ? 'task-wait' : 'tool-use',
122
+ },
123
+ });
124
+ };
112
125
  // ── Live shell-output tail → running tool card ─────────────────────────
113
126
  // 1 s poll of orchestrator liveness while this turn runs. When exactly one
114
127
  // standalone (non-aggregate) card is unresolved and the runtime reports a
@@ -728,6 +741,12 @@ export function createRunTurn(bag) {
728
741
  };
729
742
 
730
743
  const deliverToolResultMessage = (message) => {
744
+ const suppressedCallId = toolResultCallId(message);
745
+ if (suppressedCallId && suppressedTaskWaitCallIds.has(suppressedCallId)) {
746
+ activeTaskWaitCallIds.delete(suppressedCallId);
747
+ refreshTaskWaitSpinner();
748
+ return;
749
+ }
731
750
  if (message?.__earlyNotify === true) {
732
751
  const earlyCallId = toolResultCallId(message);
733
752
  if (earlyCallId) {
@@ -794,16 +813,32 @@ export function createRunTurn(bag) {
794
813
  // spinner is active the buffered text was dropped by the following
795
814
  // closeAssistantSegment(), so the message above the tool card vanished.
796
815
  flushStreamBatch();
816
+ const batchCalls = (calls || []).filter(Boolean);
817
+ if (batchCalls.length === 0) return;
818
+ const displayCalls = [];
819
+ for (const call of batchCalls) {
820
+ if (!isTaskWaitToolCall(toolCallName(call), toolCallArgs(call))) {
821
+ displayCalls.push(call);
822
+ continue;
823
+ }
824
+ const callId = toolCallId(call);
825
+ // Tool protocol calls normally always carry ids. If a malformed
826
+ // provider omits one, keep the ordinary card so its result cannot
827
+ // strand an unaddressable hidden spinner.
828
+ if (!callId) {
829
+ displayCalls.push(call);
830
+ continue;
831
+ }
832
+ suppressedTaskWaitCallIds.add(callId);
833
+ activeTaskWaitCallIds.add(callId);
834
+ }
797
835
  if (thinkingText && getState().thinking) {
798
836
  const thinkingLastEndedAt = closeThinkingSegment();
799
- set({ thinking: null, spinner: getState().spinner ? { ...getState().spinner, thinking: false, thinkingAccumulatedMs: accumulatedThinkingMs, thinkingLastEndedAt, mode: 'tool-use' } : getState().spinner });
837
+ set({ thinking: null, spinner: getState().spinner ? { ...getState().spinner, thinking: false, thinkingAccumulatedMs: accumulatedThinkingMs, thinkingLastEndedAt, mode: activeTaskWaitCallIds.size > 0 ? 'task-wait' : 'tool-use' } : getState().spinner });
800
838
  _publishedThinkingActive = false;
801
839
  } else if (getState().spinner) {
802
- set({ spinner: { ...getState().spinner, mode: 'tool-use' } });
840
+ refreshTaskWaitSpinner();
803
841
  }
804
- const batchCalls = (calls || []).filter(Boolean);
805
- if (batchCalls.length === 0) return;
806
- const displayCalls = batchCalls;
807
842
  const agentBatch = ++providerToolBatch;
808
843
  commitAssistantSegment({ sealToolBlock: true });
809
844
 
@@ -914,6 +949,11 @@ export function createRunTurn(bag) {
914
949
  const lastTouchedAggregate = [...touchedAggregates].at(-1) || null;
915
950
  lastTouchedAggregate?.ensureVisible?.();
916
951
  for (const [bufferedCallId, bufferedMessage] of earlyResultBuffer) {
952
+ if (suppressedTaskWaitCallIds.has(bufferedCallId)) {
953
+ deliverToolResultMessage(bufferedMessage);
954
+ earlyResultBuffer.delete(bufferedCallId);
955
+ continue;
956
+ }
917
957
  if (!cardByCallId.has(bufferedCallId)) continue;
918
958
  deliverToolResultMessage(bufferedMessage);
919
959
  earlyResultBuffer.delete(bufferedCallId);
@@ -993,6 +1033,14 @@ export function createRunTurn(bag) {
993
1033
  invalidateExact: compactChanged,
994
1034
  compactedEstimateTokens: compactChanged ? event?.afterTokens : null,
995
1035
  });
1036
+ // syncContextStats only STAGES its patch on the draft (context-state
1037
+ // mjs stages through updateState); publication is the caller's, and
1038
+ // every other compact path already follows with this exact set. The
1039
+ // auto path did not, so the post-compact gauge reached React only if
1040
+ // some later mutation happened to carry it — the manual path
1041
+ // repainted immediately while auto looked stuck on the pre-compact
1042
+ // number (user: 오토 컴팩트 이후에 컨텍스트 원형바가 동기화가 안됨).
1043
+ set({ ...routeState(), stats: { ...getState().stats } });
996
1044
  },
997
1045
  onStageChange: async (stage, detail = null) => {
998
1046
  if (!markTurnProgress(`stage:${String(stage || '')}`)) return;
@@ -1160,6 +1208,10 @@ export function createRunTurn(bag) {
1160
1208
  finalizeToolHeaders();
1161
1209
  flushStreamBatch(); // force-flush any batched streaming text before finalization writes
1162
1210
  syncContextStats({ allowEstimated: true });
1211
+ // Terminal reading for the turn. Without its own publication the last
1212
+ // gauge number React ever saw is the one the previous usage delta
1213
+ // carried, so an idle session sat on a stale count until the next turn.
1214
+ set({ stats: { ...getState().stats } });
1163
1215
 
1164
1216
  const finalText = result?.content != null ? String(result.content) : '';
1165
1217
  // Strip text already sealed as its own item(s) this turn (a tool
@@ -93,6 +93,7 @@ export const SPINNER_MODE_OVERRIDE_VERBS = {
93
93
  compacting: 'Compacting conversation',
94
94
  'auto-clear': 'Auto-clearing conversation',
95
95
  resuming: 'Resuming conversation',
96
+ 'task-wait': '작업 대기 중',
96
97
  };
97
98
 
98
99
  /**
@@ -6,24 +6,17 @@ description: "Parallel delegation."
6
6
 
7
7
  # Cowork
8
8
 
9
- Consult the user and build the plan together. Before the user explicitly
10
- approves the latest plan, work is read-only investigation and planning — no
11
- edits, state mutation, or delegation. A new or changed request resets
12
- planning; a scope change requires fresh approval. Explicit read-only requests
13
- proceed immediately; approval precedes edits, state mutation, and delegation,
14
- and on approval all in-scope work completes without reapproval. Ask the user
15
- only for decisions.
9
+ Consult the user and build the work plan together. Explicit read-only requests
10
+ proceed immediately. When file edits, state mutation, or delegation are
11
+ required, investigate and plan only until the user approves the latest plan.
16
12
 
17
- Lead delegates maximally: one suitable agent per independent scope,
18
- all spawned in one turn;
19
- only a scope that depends on another's output waits. Split the plan into as
20
- many scopes as possible: disjoint file/module sets are independent; merge only
21
- on a true output dependency. Prefer parallel scopes over sequential slices in
22
- one agent. Brief each agent per the Lead Brief contract. A plan that yields
23
- only one scope buys no parallelism: Lead executes it itself instead of
24
- wrapping a single agent.
13
+ After approval, complete every in-scope step before reporting the result. If
14
+ the request or scope changes during execution, pause and obtain approval for
15
+ the revised plan.
25
16
 
26
- Report the result against the approved plan. Build happens only on an explicit
27
- user request.
28
-
29
- On direction change, pause and re-consult the user.
17
+ Delegate maximally: assign one suitable agent to each independent scope and
18
+ spawn them in one turn. Only a scope that depends on another's output waits.
19
+ Treat disjoint file or module sets as independent and merge scopes only on a
20
+ true output dependency. Prefer parallel scopes over sequential slices in one
21
+ agent, and brief each agent using the Lead Brief contract. If the plan has only
22
+ one scope, Lead executes it directly.
@@ -0,0 +1,11 @@
1
+ ---
2
+ id: headless
3
+ name: Headless
4
+ description: "Complete before reporting."
5
+ delegation: none
6
+ hidden: true
7
+ ---
8
+
9
+ # Headless
10
+
11
+ Complete everything requested before reporting the result.
@@ -7,15 +7,10 @@ delegation: none
7
7
 
8
8
  # Solo
9
9
 
10
- Consult the user and build the plan together. Before the user explicitly
11
- approves the latest plan, work is read-only investigation and planning — no
12
- edits, state mutation, or delegation. A new or changed request resets
13
- planning; a scope change requires fresh approval. Explicit read-only requests
14
- proceed immediately; approval precedes edits and state mutation, and on
15
- approval all in-scope work completes without reapproval. Ask the user only for
16
- decisions. Lead executes every scope itself.
10
+ Consult the user and build the work plan together. Explicit read-only requests
11
+ proceed immediately. When file edits or state mutation are required,
12
+ investigate and plan only until the user approves the latest plan.
17
13
 
18
- Report the result against the approved plan. Build happens only on an explicit
19
- user request.
20
-
21
- On direction change, pause and re-consult the user.
14
+ After approval, complete every in-scope step before reporting the result. If
15
+ the request or scope changes during execution, pause and obtain approval for
16
+ the revised plan.