Skip to content

Extract provider catalog and truncation utilities into shared threadbear_services package - #7

Open
Josh-writes wants to merge 5 commits into
codex/review-and-fix-threadbear-cli-tool-codefrom
codex/audit-cli-tool-and-flask-chat-app
Open

Extract provider catalog and truncation utilities into shared threadbear_services package#7
Josh-writes wants to merge 5 commits into
codex/review-and-fix-threadbear-cli-tool-codefrom
codex/audit-cli-tool-and-flask-chat-app

Conversation

@Josh-writes

Copy link
Copy Markdown
Owner

Motivation

  • Centralize provider metadata and endpoint-injection logic to eliminate duplicated definitions between the CLI and Flask front-ends.
  • Reuse the same tool-result truncation logic across presentation surfaces so tool outputs are compacted consistently for LLM context.
  • Prepare a shared service surface as a first step toward consolidating orchestration and reducing drift between cli and flask implementations.
  • Add an audit and recovery plan documenting the path to a shared service-layer and CLI/Flask parity work.

Description

  • Add a new threadbear_services package exposing BUILTIN_PROVIDERS, KNOWN_OPENAI_COMPAT_PROVIDERS, inject_endpoint_config, and truncate_tool_result via providers.py, text_utils.py, and __init__.py.
  • Replace in-file provider lists and truncation helpers in cli/app.py and flask_chat_app.py with imports from threadbear_services and switch the code to call inject_endpoint_config(provider, merged_cfg, self.config) and truncate_tool_result(result, max_chars=budget_chars).
  • Update pyproject.toml to include the new threadbear_services package in the package discovery list.
  • Add docs/cli_flask_audit_plan.md containing the CLI + Flask audit and a recommended phased plan to extract shared services and achieve feature parity.

Testing

  • No automated tests were executed as part of this change.
  • Manual review ensured the imported symbols and function signatures match the updated call sites.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant