Skip to content

[Next] Refactor: migrate any-llm-sdk to republic and extract bub core - #357

Open
frostming wants to merge 12 commits into
mainfrom
dev
Open

frostming wants to merge 12 commits into
mainfrom
dev

Conversation

@frostming

Copy link
Copy Markdown
Collaborator

No description provided.

PsiACE and others added 10 commits October 13, 2026 08:59
- Introduced `republic` module to manage media types and user content.
- Updated tests to validate new prompt structure and legacy content conversion.
- Modified `build_prompt` to return a list of `UserContent` instead of legacy formats.
- Enhanced documentation to reflect changes in prompt handling and hook signatures.
- Adjusted various tests to ensure compatibility with new prompt formats and legacy support.

Signed-off-by: Frost Ming <me@frostming.com>
Older Bub versions recorded tool calls as
{"id", "type": "function", "function": {"name", "arguments"}}, which
republic.Message.from_dict rejects with KeyError: 'name', so sessions
with such tapes could not build their context. Convert them to
Republic's form in to_message, next to the other legacy conversions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Send User-Agent: bub/{version} instead of Republic's default through
AgentSettings.model_client_kwargs, used by the model runner, code mode
and onboarding. A User-Agent in client_args.headers still wins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Add a stdlib `republic` module to run_code: media classes, messages,
  get_model() (chat and stream), get_embedding_model() and
  get_decision_model(). Model calls are proxied to Bub, which uses its
  provider settings and credentials; they never reach the code.
- Add code-only tools attach_image/attach_audio/attach_video that accept
  republic media or a path/URL/data URL and attach it to the run_code
  result, sent to the model as a multimodal tool message.
- Add content results (bub.tools.content_result) for tool results with
  media; spilling bounds only their text.
- Add Environment.read_bytes with a default that runs the environment's
  python.
- Document the republic module in the code mode stub and prompt.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
bub 48a4b7c Commit Preview URL

Branch Preview URL
Oct 14 2026, 02:40 AM

Signed-off-by: Frost Ming <me@frostming.com>
* refactor: use Republic for builtin models and authentication

* refactor: consume native model outputs

* refactor: delegate request extras to Republic

* refactor: simplify builtin options and naming

* chore: use Republic 0.6 preview

* Refactor prompt handling and improve compatibility with legacy content

- Introduced `republic` module to manage media types and user content.
- Updated tests to validate new prompt structure and legacy content conversion.
- Modified `build_prompt` to return a list of `UserContent` instead of legacy formats.
- Enhanced documentation to reflect changes in prompt handling and hook signatures.
- Adjusted various tests to ensure compatibility with new prompt formats and legacy support.

Signed-off-by: Frost Ming <me@frostming.com>

* fix: replay Chat Completions tool calls from older tapes

Older Bub versions recorded tool calls as
{"id", "type": "function", "function": {"name", "arguments"}}, which
republic.Message.from_dict rejects with KeyError: 'name', so sessions
with such tapes could not build their context. Convert them to
Republic's form in to_message, next to the other legacy conversions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat: identify Republic model clients as bub/{version}

Send User-Agent: bub/{version} instead of Republic's default through
AgentSettings.model_client_kwargs, used by the model runner, code mode
and onboarding. A User-Agent in client_args.headers still wins.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat: expose republic models and media attachments in code mode (#351)

- Add a stdlib `republic` module to run_code: media classes, messages,
  get_model() (chat and stream), get_embedding_model() and
  get_decision_model(). Model calls are proxied to Bub, which uses its
  provider settings and credentials; they never reach the code.
- Add code-only tools attach_image/attach_audio/attach_video that accept
  republic media or a path/URL/data URL and attach it to the run_code
  result, sent to the model as a multimodal tool message.
- Add content results (bub.tools.content_result) for tool results with
  media; spilling bounds only their text.
- Add Environment.read_bytes with a default that runs the environment's
  python.
- Document the republic module in the code mode stub and prompt.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* refactor!: extract an event-driven core agent into bub.core (#356)

* docs: update README to improve clarity and organization of content

Signed-off-by: Frost Ming <me@frostming.com>

* feat: accept republic built-in tools in core Agent

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was successfully deployed

1 active (outdated) deployment
pypi — bf284ec6 Deployed Oct 14, 2026 by frostming via publish #28
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.

2 participants