Skip to content

Wire RuntimeRunner through SessionManager - #7

Merged
likun666661 merged 1 commit into
runtime-v2-architecture-docfrom
runtime-v2-agentrun-wiring-followup
Jun 14, 2026
Merged

Wire RuntimeRunner through SessionManager#7
likun666661 merged 1 commit into
runtime-v2-architecture-docfrom
runtime-v2-agentrun-wiring-followup

Conversation

@likun666661

Copy link
Copy Markdown
Member

Summary

  • rebase the AgentRun RuntimeRunner wiring on top of runtime-v2-architecture-doc after contract fixes
  • route SessionManager.sendMessage through RuntimeRunner while preserving the existing SessionEvent stream
  • pass AgentRun.runId into the runtime invocation spine and collect mapped RuntimeEvents for diagnostics

Verification

  • npm run typecheck
  • npm run build
  • npm run test --workspaces --if-present
  • git diff --check upstream/runtime-v2-architecture-doc..HEAD

Notes

This is the hot-path follow-up to the previously merged Runtime v2 skeleton. AgentRun remains the persistence/ledger owner; RuntimeRunner wraps the single production AgentRun stream rather than running the model twice.

@likun666661
likun666661 merged commit e2bce5e into runtime-v2-architecture-doc Jun 14, 2026
@likun666661
likun666661 deleted the runtime-v2-agentrun-wiring-followup branch June 14, 2026 15:13
jackwener pushed a commit that referenced this pull request Jun 21, 2026
jackwener added a commit that referenced this pull request Jun 21, 2026
…inese-first labels, stub views for non-implemented modules

Implements the IA refactor WAWQAQ locked in msg `b86b47d1`: the
sidebar's second part is now a top-level 5-module nav (会话 / 搜索 /
计划 / 技能 / 每日回顾) rather than session filter tabs. Pinned /
Archived / Chats become internal Sessions filters. Settings stays at
the bottom; a placeholder 版本更新 button sits above it.

Per xuan `47e204f2` priorities applied directly:
  - #2 IA: top-level modules; filters moved into Sessions.
  - #4 visual hierarchy: nav rows reuse `.maka-nav-row` (transparent
    bg, accent-tinted selected state, no card stacking).
  - #5 Chinese-first naming throughout the surface; English stays
    as accessible keywords in the command palette.
  - #7 Search nav item placeholder for Phase 4 modal; clicking now
    switches the section to `'search'` and renders an empty-state
    stub. Phase 4 will swap the section switch for an
    `onOpenSearchModal()` callback (already plumbed through props).
  - #8 disabled / hover / focus states pinned for the Update
    placeholder (aria-disabled + data-disabled + CSS dim).

== Type-level changes ==

`packages/ui/src/components.tsx`:

  export type NavSelection =
    | { section: 'sessions'; filter: SessionFilter }
    | { section: 'search' }
    | { section: 'automations' }
    | { section: 'skills' }
    | { section: 'daily-review' };

  // New module label map (Chinese-first):
  const MODULE_NAV_LABEL: Record<NavSelection['section'], string> = {
    sessions: '会话', search: '搜索', automations: '计划',
    skills: '技能', 'daily-review': '每日回顾',
  };

== SessionListPanel JSX shape ==

  <aside>
    <header>新建对话 button</header>
    <nav.maka-sidebar-modules>          5 module nav rows  (NEW)
    <div.maka-session-filter hidden={!sessions}>      Pinned/Chats/Archived
    <div.maka-session-search hidden={!sessions}>      session-name search
    <section.maka-session-list>
      ├ skills view (existing, reused for `selection.section==='skills'`)
      ├ sessions view (existing, when 'sessions')
      └ STUB_VIEWS[section] (search / automations / daily-review)
    <footer.maka-session-panel-footer>
      ├ 版本更新 button (NEW; UI placeholder, aria-disabled by default)
      └ 设置 button (existing; renamed from "Settings")
  </aside>

Skills no longer appears in the footer — it lives in the top-level
module nav alongside the other 4. The chat surface (`ChatPanel`)
shows a neutral "从 会话 选择对话" message when the active section
is `search` / `automations` / `daily-review`.

== Persistence ==

`apps/desktop/src/renderer/main.tsx readNavSelection`: recognizes
`search` / `automations` / `daily-review` as valid section variants
when restoring from localStorage. Corrupted entries fall back to
`{ section: 'sessions', filter: 'chats' }`.

== CSS ==

`apps/desktop/src/renderer/styles.css`:

  .maka-session-panel grid-template-rows:
    auto auto auto auto minmax(0, 1fr) auto;

  /* Row 2 is the new module nav. Phase 1's `.maka-session-list` grid
   * fix (auto + minmax(0, 1fr)) and `.maka-list-stack` overflow:auto
   * are preserved verbatim. */

  .maka-sidebar-modules { display: grid; gap: 2px; padding: 4px 8px; }

  /* Disabled nav-row dimming (used by 版本更新 placeholder). */
  .maka-nav-row[aria-disabled="true"],
  .maka-nav-row[data-disabled="true"] { cursor: not-allowed; opacity: 0.55; }
  .maka-nav-row[aria-disabled="true"]:hover,
  .maka-nav-row[data-disabled="true"]:hover { background: transparent; }

== Tests ==

  core 392 / storage 50 / runtime 103 / desktop 645 = 1190 pass.
  Typecheck + build green across all workspaces.
  Phase 1's CSS contract test still passes (grid + min-height + overflow
  pins survive the IA refactor).

== Out of scope (Phase 3 / 4) ==

  - Session row slimming (~85px → ~32px). Phase 3.
  - Search modal implementation. Phase 4 (resurrects `useThreadSearch`
    from `yuejing/pr-search-2.6`; swaps current Search stub for modal
    trigger).
  - Real auto-update wiring (Electron updater). Future PR-AUTOUPDATE-0.
  - Automations / Daily Review feature implementation. Future
    PR-TIME-* / PR-DAILY-*.

Anchors:
  WAWQAQ msg `b86b47d1` + `f5f6f834` (IA + Skills inclusion + Update button).
  xuan msg `47e204f2` (8-point priority list); `dc790a54` (Phase 1 scope refinement);
  `adcf0c95` (per-phase gate workflow).
  kenji msg `fcd9c54f` (consolidated packet design); `0f7bb872` (scroll P0 architecture).

Branch base: `655a09f` (Phase 1 + fixup, on top of main `809875a`).
jackwener pushed a commit that referenced this pull request Jun 21, 2026
jackwener pushed a commit that referenced this pull request Jun 21, 2026
jackwener added a commit that referenced this pull request Jun 27, 2026
…tract

Scanned all of apps/desktop/src/renderer/styles for selectors that
declare the same property twice in the same block. Found 3 blocks
with 6 dupes total — last-wins means the earlier declaration is dead.

Fixed:
- settings/bot.css:389-392 — `.settingsRow` first did `display: flex` +
  3 flex props (align/justify/gap=10), then `display: grid` + grid props
  (align/gap=16). The flex setup is leftover from before the grid
  rewrite. Deleted 4 lines.
- onboarding.css:83-84 — `.maka-onboarding-ready header` first set
  justify-items:start + text-align:left, then center for both. Deleted
  the 2 dead lines.
- onboarding.css:542 — `.maka-onboarding-quickchat-submit` had
  `min-width: auto` then later `min-width: 40px`. Deleted the dead one.

Locked the rule with `renderer-css-duplicate-decl-contract.test.ts`:
parses every .css under styles/, tracks brace depth + selector context,
flags any block that declares the same non-custom property twice. Skips
at-rule wrappers (`@media` / `@layer` / `@supports`) since their
redeclarations are intentional. Skips CSS custom properties (`--*`).

Companion to PR-UI-DEAD-EXPORT-SWEEP-0 — both are the "清理" (cleanup)
lane: delete dead code that survived a refactor, lock the rule so it
doesn't recur. Surfaced by @maka-审美专家's punch-list-organize.md
finding #7 + grep generalization suggestion.

Tests: contract passes (0 dupes remaining). Full desktop suite unaffected.
jackwener added a commit that referenced this pull request Jun 27, 2026
…tract (#326)

Scanned all of apps/desktop/src/renderer/styles for selectors that
declare the same property twice in the same block. Found 3 blocks
with 6 dupes total — last-wins means the earlier declaration is dead.

Fixed:
- settings/bot.css:389-392 — `.settingsRow` first did `display: flex` +
  3 flex props (align/justify/gap=10), then `display: grid` + grid props
  (align/gap=16). The flex setup is leftover from before the grid
  rewrite. Deleted 4 lines.
- onboarding.css:83-84 — `.maka-onboarding-ready header` first set
  justify-items:start + text-align:left, then center for both. Deleted
  the 2 dead lines.
- onboarding.css:542 — `.maka-onboarding-quickchat-submit` had
  `min-width: auto` then later `min-width: 40px`. Deleted the dead one.

Locked the rule with `renderer-css-duplicate-decl-contract.test.ts`:
parses every .css under styles/, tracks brace depth + selector context,
flags any block that declares the same non-custom property twice. Skips
at-rule wrappers (`@media` / `@layer` / `@supports`) since their
redeclarations are intentional. Skips CSS custom properties (`--*`).

Companion to PR-UI-DEAD-EXPORT-SWEEP-0 — both are the "清理" (cleanup)
lane: delete dead code that survived a refactor, lock the rule so it
doesn't recur. Surfaced by @maka-审美专家's punch-list-organize.md
finding #7 + grep generalization suggestion.

Tests: contract passes (0 dupes remaining). Full desktop suite unaffected.
jackwener pushed a commit that referenced this pull request Jul 6, 2026
…ete (#520 PR8) (#562)

* feat(ui): migrate SearchModal result list to Base UI Autocomplete (#520 PR8)

SearchModal's hand-rolled roving-focus result list (activeResultIndex /
moveActiveResult / jumpActiveResult / keyboardSelectionHandledRef /
handleResultKeyDown / data-active) is replaced by Base UI Autocomplete in
activedescendant mode:

- Autocomplete.Root inline + mode="none" + autoHighlight="always" +
  filter={null}: the list renders inline in the modal body (no floating
  popup), Autocomplete does not re-filter the server-side IPC results, and
  the first result is always highlighted so Enter works without an extra
  ArrowDown.
- Autocomplete.Input renders the input via the shared InputGroupInput
  primitive (render prop); ArrowUp/Down/Enter/Escape keyboard nav is owned
  by Autocomplete (floating-ui useListNavigation).
- Autocomplete.List + Autocomplete.Item replace the hand-rolled
  <ul role=listbox> + <li><button role=option>; item onClick fires
  selectResult for both pointer click and Enter on the highlighted item.
- aria-activedescendant on the input is now managed by Autocomplete.

selectResult navigation (sessionId + turnId, restoreFocus: false), the
debounced IPC search, the inflight ticket guard, the unmount invalidation,
the clear button, the snippet rendering, and all copy/states are unchanged.

The roving-focus kbd-nav interaction (ArrowDown moved focus to the result
button) becomes activedescendant (input keeps focus, active item reflected
via aria-activedescendant). a11y is more standard; the interaction habit
shifts. Home/End now move the input cursor (Base UI ComboboxInput default);
jump-to-first/last result is not bound for now (to be confirmed by manual
testing per PR8 plan).

search-modal-lifecycle-contract: the kbd-nav it-block is rewritten to lock
the Autocomplete shape (Root props + Item onClick + selectResult navigation)
instead of the roving-focus implementation; the focus-policy it-block drops
the activeResultIndex/moveActiveResult assertions; the empty-query it-block
repoints onChange -> onValueChange. CSS .maka-search-modal-result[data-active]
-> [data-highlighted] (Autocomplete item highlighted state).

Verification: typecheck clean, @maka/desktop 2076/2076, @maka/ui 43/43,
sidebar-search-modal-open screenshot AE=2655 (fuzz 5%, RMSE 0.0006) vs main.

* feat(ui): migrate CommandPalette to Base UI Autocomplete (#520 PR8)

CommandPalette's hand-rolled activedescendant result list (highlight
state + onInputKeyDown + reset useEffect + <div role=listbox> +
<Button role=option data-active>) is replaced by Base UI Autocomplete:

- Autocomplete.Root inline + mode="none" + autoHighlight="always" +
  filter={null}: the list renders inline in the modal body, Autocomplete
  does not re-filter the palette's own fuzzy + content-search combined
  list, and the first command is always highlighted so Enter works
  without an extra ArrowDown.
- Autocomplete.Input renders the input via the shared InputGroupInput
  primitive (render prop); ArrowUp/Down/Enter/Escape keyboard nav is
  owned by Autocomplete. aria-controls + aria-activedescendant are
  managed by Autocomplete — no manual wiring.
- Autocomplete.List + Autocomplete.Group + Autocomplete.GroupLabel +
  Autocomplete.Item replace the hand-rolled <div role=listbox> +
  <div group> + <Button role=option>. Autocomplete.Item fires onClick
  for both pointer click and Enter on the highlighted item, so commit()
  covers both paths.
- The CornerDownLeft cursor hint is now CSS-driven
  (.maka-palette-cursor visibility via [data-highlighted]) instead of
  the JS `!cmd.hint \&\& active` conditional, since the hand-rolled
  highlight state is gone.

commit() (commitPendingRef + committedCommandId + await run + finally
close), the fuzzy filter, useThreadSearch content-search, grouped
rendering, and all copy/states are unchanged.

The kbd-nav interaction stays activedescendant (input keeps focus,
active item reflected via aria-activedescendant) — same mode as before,
now owned by Autocomplete. Home/End now move the input cursor (Base UI
ComboboxInput default); jump-to-first/last command is not bound for now
(to be confirmed by manual testing per PR8 plan).

Contracts: command-palette-a11y-copy-contract #1 (listbox) rewritten to
lock the Autocomplete shape; #2 import regex drops Button (no longer
used); #3 CSS data-active -> data-highlighted; #6 commit-gate block
boundary is commit() (onInputKeyDown gone); #7 highlight reset is now
autoHighlight="always" (no hand-rolled state). renderer-utility-primitives
row assert repoints <Button role=option> -> <Autocomplete.Item>. CSS
.maka-palette-item[data-active] -> [data-highlighted] + .maka-palette-cursor.

Verification: typecheck clean, @maka/desktop 2076/2076, @maka/ui 43/43,
command-palette-open screenshot AE=7250 (fuzz 5%, RMSE 0.0017) vs main.

* fix(ui): Autocomplete inline open + item-press guard (#562 review)

P1 (blocker): both Autocomplete.Root used `inline` without `open`. Per
Base UI docs, `inline` requires `open` so the list is treated as visible:
"Specify open unconditionally in conjunction with this prop so the list is
considered visible: <Autocomplete.Root inline open>". Without `open`,
defaultOpen=false -> the input is not data-popup-open and keyboard nav /
activedescendant do not work. Add `open` to SearchModal + CommandPalette.

P2-a: object items (<Autocomplete.Item value={result/cmd}>) had no
itemToStringValue, and onValueChange did not filter item-press. Add
itemToStringValue (result.title / cmd.label) so item-press never writes
[object Object] into the query, and skip onValueChange when
details.reason === 'item-press'. In inline mode selectionMode='none' + no
Popup means shouldFillInput is currently false (popupRef.current null), so
this is defensive — but correct regardless of future Popup changes.

P2-b: contract tests now lock open + itemToStringValue + onValueChange
item-press-filter on Autocomplete.Root (catches P1/P2-a regressions), plus
the existing inline/mode/autoHighlight/List/Item shape.

Verified via CDP probe (command-palette-open fixture): input has
data-popup-open + aria-controls + aria-activedescendant; first item
data-highlighted (autoHighlight); ArrowDown 0->1->2, ArrowUp 2->1.
typecheck clean, @maka/ui 43/43, @maka/desktop 2076/2076.
command-palette-open AE=48000 (RMSE 0.011) vs main — larger than pre-fix
AE=7250 because open now correctly renders the first-item highlight bg +
input data-popup-open state (the bug state hid these). search-modal-open
AE=2655 (RMSE 0.0006, unchanged).

* test(ui): lock Home/End input-cursor decision (#562 P2-c)

P2-c decision: accept Base UI ComboboxInput's default — Home/End move the
input cursor, not the highlight. The old roving-focus jumpActiveResult
(SearchModal) / hand-rolled onInputKeyDown highlight jump (CommandPalette)
must not return. Lock via doesNotMatch on jumpActive( / onInputKeyDown.

* fix(ui): keepHighlight + empty-state inside Autocomplete.List (#562 review P2)

P2-1 (keepHighlight): both Roots had autoHighlight="always" but no
keepHighlight. keepHighlight=false (default) sets resetOnPointerLeave=true
(AriaCombobox.js:855), so pointer leave clears activeIndex, then the
autoHighlight="always" effect (line 678-682) re-highlights the first item
-> hover item[2] -> leave -> Enter ran the first item, not the hovered one.
Add keepHighlight so pointer leave preserves the hovered item.

P2-2 (empty-state): CommandPalette rendered a standalone <div> for empty
and <Autocomplete.List> only when non-empty, so the input lost its listbox
reference with no matches. Unify on Autocomplete.List always, with the Empty
primitive inside. Autocomplete.Empty is not used: filter={null} + mode="none"
keeps filteredItems non-empty (the palette's fuzzy filter is external), so
Autocomplete.Empty would never trigger.

Contracts lock keepHighlight on both Roots + empty-state-must-not-use-
standalone-div.

keepHighlight verified by source (resetOnPointerLeave = !keepHighlight) +
Base UI docs. CDP hover-leave probe could not reliably trigger floating-ui
useListNavigation's hover highlight (synthesized pointermove does not fire
its hover detection), so pointer-leave preservation is source-guaranteed,
not probe-verified. typecheck clean, 2076/2076, screenshots unchanged
(command-palette-open AE=48000, search-modal-open AE=2655 vs main — same as
prior commit, keepHighlight/empty-state don't affect non-empty visuals).
anaconda110 added a commit to anaconda110/maka-agent that referenced this pull request Aug 3, 2026
…pache#7)

app/build.gradle used the deprecated packagingOptions { exclude "META-INF/..." }
DSL. AGP 8.x migrated this to packaging { resources { excludes += [...] } }; the
old DSL is still tolerated in AGP 8.7 but is slated for removal in AGP 9. Switched
to the new form with the same exclude set, eliminating the deprecation and
forward-compatible with AGP 9.

Aligns with .hive/android-code-review.md P1 apache#7.
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