bridge.services.protocols package#

Public Interface#

This section documents user-facing interface of the bridge.services.protocols package (as defined in its __init__.py file).

Classes#

Ingestor(*args, **kwargs)

Protocol for classes that fetch raw metadata from an external source.

RepoProvider(*args, **kwargs)

Protocol for repository operations.

ForkInfo(full_name, owner, repo)

Generic metadata for a forked repository.

LLMProvider(*args, **kwargs)

Protocol for LLM providers that generate chat-based responses.

ChatMessage(**data)

A message in a chat conversation.

Protocols and base classes for services.

class bridge.services.protocols.ChatMessage(**data)[source]#

Bases: BaseModel

A message in a chat conversation.

Parameters:
  • role (Literal['system', 'user', 'assistant'])

  • content (str)

role#

The role of the message sender. One of: - “system”: Instructions or global context for the LLM assistant. - “user”: A message from the user. - “assistant”: A message from the LLM assistant.

Type:

Literal[“system”, “user”, “assistant”]

content#

The content of the message.

Type:

str

content: str#
role: Literal['system', 'user', 'assistant']#
class bridge.services.protocols.ForkInfo(full_name, owner, repo)[source]#

Bases: object

Generic metadata for a forked repository.

Parameters:
  • full_name (str)

  • owner (str)

  • repo (str)

full_name: str = <dataclasses._MISSING_TYPE object>#
owner: str = <dataclasses._MISSING_TYPE object>#
repo: str = <dataclasses._MISSING_TYPE object>#
class bridge.services.protocols.Ingestor(*args, **kwargs)[source]#

Bases: Protocol

Protocol for classes that fetch raw metadata from an external source.

async fetch()[source]#

Fetch raw metadata from an external source.

Return type:

dict[str, Any]

class bridge.services.protocols.LLMProvider(*args, **kwargs)[source]#

Bases: Protocol

Protocol for LLM providers that generate chat-based responses.

async generate(messages)[source]#

Generate a chat-based response from the model.

Return type:

ChatMessage

Parameters:

messages (list[ChatMessage])

class bridge.services.protocols.RepoProvider(*args, **kwargs)[source]#

Bases: Protocol

Protocol for repository operations.

apply_changes_and_push(repo_path, branch_name, file_changes)[source]#

Apply file changes and push to a branch.

Parameters:
  • repo_path (str)

  • branch_name (str)

  • file_changes (dict)

clone_context(repo_full_name)[source]#

Use context manager to clone a repository.

Return type:

AbstractContextManager[str]

Parameters:

repo_full_name (str)

async create_issue(owner, repo, title, body='', labels=None, assignees=None)[source]#

Create a new issue on a repository.

Return type:

dict

Parameters:
  • owner (str)

  • repo (str)

  • title (str)

  • body (str)

  • labels (list[str] | None)

  • assignees (list[str] | None)

async create_pull_request(owner, repo, title, body, head_branch, base_branch)[source]#

Create a pull request.

Return type:

dict

Parameters:
  • owner (str)

  • repo (str)

  • title (str)

  • body (str)

  • head_branch (str)

  • base_branch (str)

async fork(owner, repo)[source]#

Fork a repository.

Return type:

ForkInfo

Parameters:
  • owner (str)

  • repo (str)

Submodules#

ingestor

Service protocol for fetching raw external data.

llm_provider

Typed chat message model and an LLMProvider protocol.

repo_provider

Protocol for repository operations and a minimal ForkInfo dataclass.

Dependencies diagram#

Each architecture diagram below visualizes the internal dependency structure of the bridge.services.protocols package. It shows how modules and subpackages within the package depend on each other, based on direct Python imports.

  • Packages are shown as purple rectangles

  • Modules are shown as pink rectangles

  • Arrows (A → B) indicate that A directly imports B

Each subpackage’s diagram focuses only on its own internal structure, it does not include imports to or from higher-level packages (those appear in the parent package’s diagram).

bridge package dependencies