Skip to content

refactor(client): typed helpers + from_url to kill ~40 casts#304

Draft
tildesrc wants to merge 2 commits into
mainfrom
panopticon/client-typed-helpers
Draft

refactor(client): typed helpers + from_url to kill ~40 casts#304
tildesrc wants to merge 2 commits into
mainfrom
panopticon/client-typed-helpers

Conversation

@tildesrc

Copy link
Copy Markdown
Contributor

Summary

  • Adds nine private typed helpers (_get_obj, _get_list, _get_str_list, _get_str_field, _put_obj, _post_obj, _post_list, _delete_obj, _patch_obj) to TaskServiceClient so all cast() calls are consolidated inside helpers; every public method becomes a single clean line.
  • list_tasks() delegates to list_tasks_versioned()[0], removing the duplicate GET /tasks call.
  • TaskServiceClient.from_url(url) classmethod collapses seven httpx.Client(base_url=...) construction sites across container/, sessionservice/, and terminal/, and removes the now-redundant _make_client / _default_client private factories.

The two intentional cast() holdouts outside the helpers: list_tasks_versioned (hand-parses the X-Tasks-Version header) and get_runner (404 branch).

Plan: panopticon://tasks/bcd956ad89954e4eb7b6043c6ea4af78/artifacts/plan.md

🤖 Generated with Claude Code

Panopticon Agent and others added 2 commits July 13, 2026 03:58
Add nine private typed helpers (_get_obj, _get_list, _get_str_list,
_get_str_field, _put_obj, _post_obj, _post_list, _delete_obj,
_patch_obj) so every cast lives inside a helper. Public methods become
single clean lines with no cast. The two intentional exceptions are
list_tasks_versioned (hand-parses the version header) and get_runner
(404 branch).

Also:
- list_tasks() delegates to list_tasks_versioned()[0] to remove the
  duplicate GET /tasks call.
- TaskServiceClient.from_url(url) classmethod collapses the seven
  httpx.Client(base_url=...) construction sites across container/,
  sessionservice/, and terminal/ — and removes the now-redundant
  _make_client / _default_client private factories.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@tildesrc
tildesrc force-pushed the panopticon/client-typed-helpers branch from addd624 to 0e6c2c1 Compare July 13, 2026 04:00
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