MCPcopy Create free account
hub / github.com/lsdefine/GenericAgent / commit

Method commit

frontends/tui_v3.py:3633–3656  ·  view source on GitHub ↗

Append finalized history. Accepts either a Block (preferred — keeps the source so resize can re-render at the new width) or a pre-rendered list[str] (legacy: wrapped as a 'plain' block, which can reflow only through _fit_rows — no un-rendering of width-baked structures). For

(self, content)

Source from the content-addressed store, hash-verified

3631 self._invalidate_ptk()
3632
3633 def commit(self, content) -> None:
3634 """Append finalized history. Accepts either a Block (preferred — keeps
3635 the source so resize can re-render at the new width) or a pre-rendered
3636 list[str] (legacy: wrapped as a 'plain' block, which can reflow only
3637 through _fit_rows — no un-rendering of width-baked structures). For
3638 assistant blocks, _tool_base is anchored to the cumulative tool count
3639 of prior blocks so chip tids continue the global sequence and stay
3640 stable across resize repaints."""
3641 w = _term()[0]
3642 if isinstance(content, Block):
3643 blk = content
3644 if blk.kind == 'assistant':
3645 self._tool_base = sum(b.tool_n for b in self._blocks)
3646 self._blocks.append(blk)
3647 self._cap_blocks()
3648 lines = self._render_block(blk, w)
3649 if blk.kind == 'assistant':
3650 self._tool_base += blk.tool_n # advance for next message
3651 else:
3652 blk = Block('plain', '\n'.join(content))
3653 self._blocks.append(blk)
3654 self._cap_blocks()
3655 lines = list(content)
3656 self._emit_lines(lines, w)
3657
3658 def _cap_blocks(self) -> None:
3659 if len(self._blocks) > 4000:

Callers 15

_menu_submitMethod · 0.95
_esc_backMethod · 0.95
_run_shellMethod · 0.95
_cmd_workspaceMethod · 0.95
_pickMethod · 0.95
_freeMethod · 0.95
_cmdMethod · 0.95
_rc_finishMethod · 0.95
_pick_rewindMethod · 0.95
_pick_servicesMethod · 0.95
_confirmMethod · 0.95
_confirm_cancelMethod · 0.95

Calls 5

_cap_blocksMethod · 0.95
_render_blockMethod · 0.95
_emit_linesMethod · 0.95
_termFunction · 0.85
BlockClass · 0.85

Tested by

no test coverage detected