mixdog 0.9.33 → 0.9.34

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 (44) hide show
  1. package/package.json +4 -2
  2. package/scripts/compact-trigger-migration-smoke.mjs +37 -31
  3. package/scripts/provider-toolcall-test.mjs +535 -36
  4. package/src/agents/heavy-worker/AGENT.md +3 -4
  5. package/src/agents/worker/AGENT.md +2 -3
  6. package/src/repl.mjs +9 -1
  7. package/src/rules/shared/01-tool.md +4 -2
  8. package/src/runtime/agent/orchestrator/providers/codex-client-meta.mjs +22 -0
  9. package/src/runtime/agent/orchestrator/providers/gemini-cache.mjs +21 -2
  10. package/src/runtime/agent/orchestrator/providers/gemini.mjs +2 -1
  11. package/src/runtime/agent/orchestrator/providers/grok-oauth.mjs +15 -9
  12. package/src/runtime/agent/orchestrator/providers/openai-compat.mjs +35 -4
  13. package/src/runtime/agent/orchestrator/providers/openai-oauth-ws.mjs +130 -18
  14. package/src/runtime/agent/orchestrator/providers/openai-oauth.mjs +22 -12
  15. package/src/runtime/agent/orchestrator/providers/openai-transport-policy.mjs +131 -0
  16. package/src/runtime/agent/orchestrator/providers/openai-ws-delta.mjs +102 -26
  17. package/src/runtime/agent/orchestrator/providers/openai-ws-pool.mjs +194 -9
  18. package/src/runtime/agent/orchestrator/providers/openai-ws-stream.mjs +13 -2
  19. package/src/runtime/agent/orchestrator/providers/openai-ws.mjs +18 -1
  20. package/src/runtime/agent/orchestrator/session/compact/constants.mjs +3 -0
  21. package/src/runtime/agent/orchestrator/session/compact.mjs +3 -0
  22. package/src/runtime/agent/orchestrator/session/context-utils.mjs +39 -6
  23. package/src/runtime/agent/orchestrator/session/loop/compact-policy.mjs +15 -23
  24. package/src/runtime/agent/orchestrator/session/loop/context-overflow.mjs +28 -0
  25. package/src/runtime/agent/orchestrator/session/loop/recall-fasttrack.mjs +5 -0
  26. package/src/runtime/agent/orchestrator/session/loop/tool-classify.mjs +25 -0
  27. package/src/runtime/agent/orchestrator/session/manager/context-meta.mjs +16 -8
  28. package/src/runtime/agent/orchestrator/session/pre-send-compact.mjs +50 -4
  29. package/src/runtime/agent/orchestrator/session/tool-batch.mjs +53 -1
  30. package/src/runtime/agent/orchestrator/tools/builtin/bash-tool.mjs +12 -2
  31. package/src/runtime/agent/orchestrator/tools/patch/orchestrator.mjs +270 -47
  32. package/src/runtime/agent/orchestrator/tools/patch-tool-defs.mjs +4 -2
  33. package/src/runtime/channels/lib/output-forwarder.mjs +7 -1
  34. package/src/runtime/channels/lib/owned-runtime.mjs +5 -2
  35. package/src/runtime/memory/lib/embedding-worker.mjs +18 -3
  36. package/src/runtime/memory/lib/memory-embed.mjs +89 -8
  37. package/src/session-runtime/context-status.mjs +7 -6
  38. package/src/session-runtime/runtime-core.mjs +0 -10
  39. package/src/tui/app/use-transcript-window.mjs +13 -1
  40. package/src/tui/components/StatusLine.jsx +5 -5
  41. package/src/tui/dist/index.mjs +5 -3
  42. package/src/ui/statusline.mjs +4 -10
  43. package/src/vendor/statusline/bin/statusline-route.mjs +4 -5
  44. package/src/vendor/statusline/src/gateway/route-meta.mjs +3 -2
@@ -595,7 +595,19 @@ export function useTranscriptWindow({
595
595
  toolExpanded: toolExpandedFlag,
596
596
  variantKey,
597
597
  });
598
- if (!isStreamingAssistant) changed = true;
598
+ if (!isStreamingAssistant) {
599
+ // First mount (no prior entry): this frame's row index already used the
600
+ // ESTIMATE for this item (measuredTranscriptRows returned null). If Yoga
601
+ // measured exactly what the estimate predicted, the geometry is already
602
+ // correct — bumping measuredRowsVersion would re-run the row-index/window
603
+ // memos for a no-op and repaint the card one frame later (the "settle"
604
+ // jump). Only bump when the measurement actually corrects the estimate.
605
+ // A CHANGED height (prev existed but differs) always bumps.
606
+ const estimateRows = prev
607
+ ? -1
608
+ : estimateTranscriptItemRowsCached(item, frameColumns, toolOutputExpanded);
609
+ if (prev || measured !== estimateRows) changed = true;
610
+ }
599
611
  }
600
612
  if (changed) {
601
613
  // `changed` only flips true when a height actually differs from the
@@ -158,11 +158,11 @@ function localContextPct({
158
158
  : (localNum(contextWindow) > 0
159
159
  ? localNum(contextWindow)
160
160
  : (localNum(rawContextWindow) > 0 ? localNum(rawContextWindow) : 200_000)));
161
- // Trigger-as-denominator (mirrors ui/statusline.mjs resolveContextUsedPct):
162
- // a sub-boundary compaction trigger is the display denominator so the gauge
163
- // reads 100% exactly when auto-compact fires, instead of stalling at ~90%.
164
- const trigger = localNum(autoCompactTokenLimit);
165
- const window = trigger > 0 && trigger < baseWindow ? trigger : baseWindow;
161
+ // Boundary-only denominator (mirrors ui/statusline.mjs resolveContextUsedPct):
162
+ // context % is always measured against the single compaction boundary value,
163
+ // never a separate auto-compact trigger statusline and gateway stay on the
164
+ // same denominator with no before/after trigger semantics.
165
+ const window = baseWindow;
166
166
  const s = stats && typeof stats === 'object' ? stats : {};
167
167
  const source = String(s.currentContextSource || '').toLowerCase();
168
168
  const estimated = localNum(s.currentEstimatedContextTokens);
@@ -3910,8 +3910,7 @@ function localContextPct({
3910
3910
  autoCompactTokenLimit = 0
3911
3911
  } = {}) {
3912
3912
  const baseWindow = localNum(compactBoundaryTokens) > 0 ? localNum(compactBoundaryTokens) : localNum(displayContextWindow) > 0 ? localNum(displayContextWindow) : localNum(contextWindow) > 0 ? localNum(contextWindow) : localNum(rawContextWindow) > 0 ? localNum(rawContextWindow) : 2e5;
3913
- const trigger = localNum(autoCompactTokenLimit);
3914
- const window = trigger > 0 && trigger < baseWindow ? trigger : baseWindow;
3913
+ const window = baseWindow;
3915
3914
  const s = stats && typeof stats === "object" ? stats : {};
3916
3915
  const source = String(s.currentContextSource || "").toLowerCase();
3917
3916
  const estimated = localNum(s.currentEstimatedContextTokens);
@@ -11944,7 +11943,10 @@ function useTranscriptWindow({
11944
11943
  toolExpanded: toolExpandedFlag,
11945
11944
  variantKey
11946
11945
  });
11947
- if (!isStreamingAssistant) changed = true;
11946
+ if (!isStreamingAssistant) {
11947
+ const estimateRows = prev ? -1 : estimateTranscriptItemRowsCached(item, frameColumns, toolOutputExpanded);
11948
+ if (prev || measured !== estimateRows) changed = true;
11949
+ }
11948
11950
  }
11949
11951
  if (changed) {
11950
11952
  setMeasuredRowsVersion((v) => (v + 1) % 1e6);
@@ -210,16 +210,10 @@ function resolveContextUsedPct({
210
210
  autoCompactTokenLimit,
211
211
  compact,
212
212
  });
213
- // Trigger-as-denominator: when a sub-boundary compaction trigger
214
- // (boundary - buffer) is known, context % is measured against IT so the
215
- // gauge reads 100% exactly when auto-compact fires instead of stalling at
216
- // ~90% of the boundary window. The gateway's own pct is computed against
217
- // the boundary denominator, so it is bypassed in that case.
218
- const trigger = num(autoCompactTokenLimit);
219
- const triggerDenominator = trigger > 0 && (!(boundary > 0) || trigger < boundary);
220
- if (triggerDenominator && numerator > 0) {
221
- return (numerator / trigger) * 100;
222
- }
213
+ // Boundary-only denominator: context % is always measured against the single
214
+ // compaction boundary value (shared with the gateway), never against a
215
+ // separate auto-compact trigger. This keeps the statusline and gateway
216
+ // display on the same denominator with no before/after trigger semantics.
223
217
  const gatewayRawPct = gatewayStatus?.contextUsedPct;
224
218
  if (
225
219
  gatewayStatus
@@ -11,7 +11,10 @@ import {
11
11
  readLatestGatewayHostRoute,
12
12
  readGatewaySessionRoute,
13
13
  } from '../src/gateway/session-routes.mjs';
14
- import { compactBoundaryDenominator } from '../src/gateway/route-meta.mjs';
14
+ import {
15
+ compactBoundaryDenominator,
16
+ defaultEffectiveContextWindowPercent,
17
+ } from '../src/gateway/route-meta.mjs';
15
18
 
16
19
  function positiveInt(value) {
17
20
  const n = parseInt(String(value || ''), 10);
@@ -189,10 +192,6 @@ function boundedPercent(value, fallback = null) {
189
192
  return fallback;
190
193
  }
191
194
 
192
- function defaultEffectiveContextWindowPercent(_provider) {
193
- return 90;
194
- }
195
-
196
195
  function routeContextMeta(provider, info = {}, inherited = {}) {
197
196
  const rawContextWindow = firstPositiveWindow(
198
197
  inherited.rawContextWindow,
@@ -9,6 +9,7 @@ import {
9
9
  estimateMessagesTokens,
10
10
  estimateRequestReserveTokens,
11
11
  } from '../../../../runtime/agent/orchestrator/session/context-utils.mjs';
12
+ import { DEFAULT_EFFECTIVE_CONTEXT_WINDOW_PERCENT } from '../../../../runtime/agent/orchestrator/session/compact/constants.mjs';
12
13
  import { CLAUDE_CURRENT_MODE } from './claude-current.mjs';
13
14
 
14
15
  const GATEWAY_USAGE_FILE = 'gateway-usage.local.json';
@@ -98,12 +99,12 @@ function boundedPercent(value, fallback = null) {
98
99
  return fallback;
99
100
  }
100
101
 
101
- function defaultEffectiveContextWindowPercent(_provider) {
102
+ export function defaultEffectiveContextWindowPercent(_provider) {
102
103
  // Gateway-routed models use catalog/provider context metadata (LiteLLM,
103
104
  // models.dev, or native provider catalogs). Reserve a small universal
104
105
  // headroom for output/tool/system tokens while keeping the raw model window
105
106
  // visible separately.
106
- return 90;
107
+ return DEFAULT_EFFECTIVE_CONTEXT_WINDOW_PERCENT;
107
108
  }
108
109
 
109
110
  function effectiveContextWindowPercent(provider, info = {}, seed = {}) {