feat(assistant): port sessionHistory + AssistantSessionChooser stub from TS - #180
Merged
Merged
Conversation
…rom TS Closes the parity gap for typescript/src/assistant/ (88 LOC + 11-line stub). Adds: - src/assistant/session_history.py — paginated session-events client mirroring TS sessionHistory.ts (HistoryPage, HistoryAuthCtx, create_history_auth_ctx, fetch_latest_events, fetch_older_events). Preserves the TS four-case body-coercion contract and per-call-site debug labels; bool query params serialize lowercase to match axios. - src/assistant/session_chooser.py — PascalCase stub mirror of AssistantSessionChooser.tsx so a future dialogLaunchers port can import the real name without an alias. - src/assistant/__init__.py — re-exports new names; existing placeholder fields (ARCHIVE_NAME, MODULE_COUNT, SAMPLE_FILES, PORTING_NOTE) preserved. Tests: 30 cases at 100% line coverage. Wire shape (URL path, all five pinned headers, anchor_to_latest=true vs before_id, limit default, 15 s timeout), error policy (4xx/5xx/network/timeout/non-JSON/non-dict all return None; malformed data preserves first_id + has_more), and has_more JS-mirror default are pinned. Signature deviation from TS: create_history_auth_ctx takes access_token + org_uuid explicitly (no prepare_api_request global yet in Python). Matches bridge/code_session_api.py + remote convention. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
singlaamitesh
pushed a commit
to singlaamitesh/clawcodex
that referenced
this pull request
Jul 7, 2026
…ing-folder-assistant feat(assistant): port sessionHistory + AssistantSessionChooser stub from TS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
typescript/src/assistant/sessionHistory.ts(88 LOC) tosrc/assistant/session_history.py— paginated session-events client (HistoryPage,HistoryAuthCtx,create_history_auth_ctx,fetch_latest_events,fetch_older_events).AssistantSessionChooser.tsxstub assrc/assistant/session_chooser.pywith PascalCase name so a futuredialogLaunchersport can import without renaming.src/assistant/__init__.pyto re-export the new names; existing placeholder fields preserved.Parity notes
/v1/sessions/{id}/events, all five pinned headers (Authorization,Content-Type,anthropic-version,anthropic-beta: ccr-byoc-2025-07-29,x-organization-uuid), 15s timeout, lowercaseanchor_to_latest=truequery param.None; malformeddata→events=[]withfirst_idandhas_morepass-through.has_moredefaults toFalsewhen missing — mirrors TS JS-coercion ofundefinedto falsy.create_history_auth_ctxtakesaccess_tokenandorg_uuidexplicitly (noprepare_api_requestglobal yet in Python). Matchesbridge/code_session_api.py+remote/remote_session_manager.pyconvention.Planning docs (in
my-docs/get-parity-by-folder/, gitignored):assistant-gap-analysis.mdassistant-refactoring-plan.mdBoth were iterated through 4 rounds of critic review before implementation.
Test plan
pytest tests/assistant/ -q→ 30 passed, 0 skippedpytest tests/assistant/ --cov=src.assistant→ 100% line coverage (71/71 stmts)pytest tests/bridge/ tests/remote/ tests/assistant/ -q→ 232 passed🤖 Generated with Claude Code