Skip to content

feat(core,cli): M3c — compaction + statusLine + CLI flag wiring#11

Merged
oratis merged 1 commit into
mainfrom
feat/m3c-compaction-statusline-flags
May 28, 2026
Merged

feat(core,cli): M3c — compaction + statusLine + CLI flag wiring#11
oratis merged 1 commit into
mainfrom
feat/m3c-compaction-statusline-flags

Conversation

@oratis
Copy link
Copy Markdown
Owner

@oratis oratis commented May 28, 2026

Summary

  • compact(history, ...) — folds middle messages into summary while keeping anchor + tail
  • StatusLineRunner — periodic exec with JSON-on-stdin contract, 200-char cap, env-var debounce
  • CLI flag wiring: --system-prompt / --append-system-prompt / --allowedTools / --disallowedTools / --max-turns now actually take effect
  • 16 new tests · 281 total · 0 failed

Release notes

  • release-notes:feature

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

What ships
----------
- packages/core/src/compaction/index.ts
  compact(history, {provider, keepFirstPairs, keepLastMessages, summarizerModel,
  summaryMaxTokens}) → CompactionResult{history, messagesRemoved, usage,
  summaryText}. Strategy: anchor head + summarized middle + recent tail.
  shouldCompact({inputTokens, outputTokens, contextWindow, threshold}) helper.

- packages/core/src/harness/statusline.ts
  StatusLineRunner — periodic exec with JSON-on-stdin payload (session_id,
  model, cwd, mode, effort, transcript_path, cost, version, output_style).
  Respects DEEPCODE_STATUS_LINE_DEBOUNCE_MS env override. 200-char output cap.
  2s command timeout. Suppress EPIPE for scripts that don't read stdin.
  Only fires onUpdate when stdout actually changes.
  runStatusLineCommand standalone helper for one-shot use.

- apps/cli/src/repl.ts — wire CLI args into agent loop:
  · systemPromptOverride / appendSystemPrompt / appendSystemPromptFile
  · allowedTools / disallowedTools (filter BUILTIN_TOOLS before ToolRegistry)
  · maxTurns

- apps/cli/src/cli.ts — pass parsed flags into startRepl

Tests (16 new, 281 total)
-------------------------
- compaction/index.test.ts (8): short-history-unchanged, compact-middle,
  preserve-anchor + tail, summarizerModel override, usage reporting,
  tool_use/tool_result rendering in summary prompt, shouldCompact threshold
- harness/statusline.test.ts (8): trimmed stdout, stdin payload, 200-char cap,
  timeout → empty, exit-nonzero → empty, empty config → empty, Runner only
  fires onUpdate when text changes, env-var debounce override

Verified
--------
  pnpm typecheck   → green
  pnpm test        → 240 + 41 = 281 passed / 0 failed
  pnpm format:check → conformant

Deferred to next M3c PR
-----------------------
- Auto compaction trigger inside agent loop (wire shouldCompact post-turn)
- StatusLine actual REPL rendering
- /init multi-phase, auto classifier, remaining 4 hook handler types

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@oratis oratis merged commit 5b19b15 into main May 28, 2026
@oratis oratis deleted the feat/m3c-compaction-statusline-flags branch May 28, 2026 04:30
oratis added a commit that referenced this pull request Jun 1, 2026
…esize (#11) (#145)

* feat(desktop): right-side file panel — Source/Diff/History + tabs + resize (#11)

Implements the §3.11 file panel (Mac client). Inserts a 4th grid column between
the chat stream and the 48px inspector rail (the inspector stays a rail while a
file is open).

- FilePanel.tsx — pure presentational component: multi-file tab bar (close ×,
  unsaved yellow dot), Source/Diff/History view switcher, Source (line-numbered
  read-only), Diff (inline +/- and side-by-side split, ⌘\ toggles), History
  (session version timeline), and a left-edge resize grip.
- file-panel-reducer.ts (+ 9 unit tests) — pure tab/view/width state machine.
- use-file-panel.ts — wraps the reducer with file reads (tool_read), width
  persistence (localStorage, 320–800px), and the ⌘O / ⌘[ / ⌘] keybindings.
- App.tsx — renders the panel + the .file-open grid track, the resize drag, and
  makes ⌘\ context-sensitive (diff split/inline when a diff is showing, else the
  inspector toggle). Inspector "Recent files" rows now open into the panel.
- tauri-api.ts — toolRead() wrapper over the unscoped tool_read command.

Verified visually via a dev-only vite preview harness (src/preview.html, not in
the prod bundle) screenshotted across all three views. Diff/History render from
data the parent supplies; the snapshot-backed wiring (so Edit/Write populate
them) + the click-a-file-in-chat trigger land in a follow-up — honest empty
states meanwhile.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* fix(desktop): file panel must not flex-shrink below its dragged width

flex-shrink: 0 so the panel keeps its set width (320–800px) in any flex
context; the real app's grid `auto` track already sizes to it, this also
makes the standalone preview harness respect the width.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant