CubeLoop — a Pythonic, async-native agent harness core designed for high performance, readability, and production-grade persistence.
Python agent-frameworkagent-harnessagent-runtimeagentic-aiai-agentsai-frameworkanthropicharnessharness-engineeringharness-frameworklanggraphlanggraph-alternativellmmcpopenaipi-agentpi-agent-corepythonpython-agent
fix(website): regenerate API source links against main + render Usage/Example as code
xf gongd2e0e84942f1
diff --git a/website/scripts/build_api_reference.py b/website/scripts/build_api_reference.pyindex 4d7367c..f00fcc2 100644--- a/website/scripts/build_api_reference.py+++ b/website/scripts/build_api_reference.py@@ -5,7 +5,6 @@ import argparseimport importlibimport osimport re-import subprocessimport sysfrom pathlib import Pathfrom typing import Iterable@@ -105,7 +104,19 @@ def render_signature(name: str, parameters: list, returns: str | None) -> str:_GOOGLE_SECTIONS = ("Args", "Arguments", "Returns", "Raises", "Yields",- "Example", "Examples", "Note", "Notes")+ "Example", "Examples", "Note", "Notes", "Usage")+_CODE_SECTIONS = {"Example", "Examples", "Usage"}+++def _escape_mdx_braces(text: str) -> str:+ """Escape `{` and `}` so MDX does not try to parse them as JSX expressions.++ MDX treats unescaped curly braces in prose as inline JS expressions and+ passes them to acorn; Python dict literals in docstrings (e.g. {"k": "v"})+ are NOT valid expressions and crash the build. We escape every `{`/`}` that+ falls outside fenced code blocks (those are handled by the caller).+ """+ return text.replace("{", r"\{").replace("}", r"\}")def render_docstring(text: str | None) -> str:@@ -114,32 +125,66 @@ def render_docstring(text: str | None) -> str:lines = text.strip("\n").splitlines()out: list[str] = []in_section: str | None = None+ code_buffer: list[str] | None = None # active when collecting an Example/Usage block++ def _flush_code() -> None:+ nonlocal code_buffer+ if code_buffer is None:+ return+ if any(s.strip() for s in code_buffer):+ out.append("```python")+ out.extend(code_buffer)+ out.append("```")+ out.append("")+ code_buffer = None+for line in lines:m = re.match(r"^([A-Z][a-zA-Z]+):\s*$", line.strip())if m and m.group(1) in _GOOGLE_SECTIONS:+ _flush_code()in_section = m.group(1)out.append("")out.append(f"**{in_section}**")out.append("")+ if in_section in _CODE_SECTIONS:+ code_buffer = []continue+ if in_section in _CODE_SECTIONS:+ if line.strip() == "" or line.startswith((" ", "\t")):+ # part of the indented code block+ if code_buffer is None:+ code_buffer = []+ # de-indent four-space prefix so the python block reads naturally+ if line.startswith(" "):+ code_buffer.append(line[4:])+ elif line.startswith("\t"):+ code_buffer.append(line[1:])+ else:+ code_buffer.append(line)+ continue+ # non-indented, non-empty line ends the code block+ _flush_code()+ in_section = None+ # fall through to render as proseif in_section in {"Args", "Arguments"} and line.startswith((" ", "\t")):stripped = line.strip()arg_m = re.match(r"^(\w+)\s*(\([^)]+\))?:\s*(.*)$", stripped)if arg_m:arg, _ty, desc = arg_m.groups()- out.append(f"- `{arg}` — {desc}")+ out.append(f"- `{arg}` — {_escape_mdx_braces(desc)}")continueif in_section in {"Returns", "Yields"} and line.startswith((" ", "\t")):- out.append(f"- {line.strip()}")+ out.append(f"- {_escape_mdx_braces(line.strip())}")continueif in_section == "Raises" and line.startswith((" ", "\t")):stripped = line.strip()raise_m = re.match(r"^(\w+):\s*(.*)$", stripped)if raise_m:exc, desc = raise_m.groups()- out.append(f"- `{exc}` — {desc}")+ out.append(f"- `{exc}` — {_escape_mdx_braces(desc)}")continue- out.append(line)+ out.append(_escape_mdx_braces(line))+ _flush_code()return "\n".join(out).strip() + "\n"@@ -185,7 +230,7 @@ def render_symbol(symbol, github_blob_root: str) -> str:def emit_module(out_path: Path, module_name: str, sidebar_position: int,- symbols: Iterable, commit_sha: str) -> None:+ symbols: Iterable, source_ref: str) -> None:out_path.parent.mkdir(parents=True, exist_ok=True)frontmatter = ("---\n"@@ -197,31 +242,38 @@ def emit_module(out_path: Path, module_name: str, sidebar_position: int,)body = [f"# `{module_name}`", ""]for sym in symbols:- body.append(render_symbol(sym, github_blob_root=f"https://github.com/cubeplexai/cubepi/blob/{commit_sha}"))+ body.append(render_symbol(sym, github_blob_root=f"https://github.com/cubeplexai/cubepi/blob/{source_ref}"))body.append("")body.append("")body.append("<!-- GENERATED by build-api-reference.py — DO NOT EDIT -->")out_path.write_text(frontmatter + "\n".join(body), encoding="utf-8")-def current_commit_sha() -> str:- env = os.environ.get("GITHUB_SHA")+def resolve_source_ref(cli_ref: str | None) -> str:+ """Decide which git ref the [source] links should target.++ Priority: --ref CLI flag → CUBEPI_DOCS_SOURCE_REF env → "main".+ Avoids commit SHAs because they get stale (especially after squash-merge)+ and break the link for snapshotted versions.+ """+ if cli_ref:+ return cli_ref+ env = os.environ.get("CUBEPI_DOCS_SOURCE_REF")if env:return env- try:- return subprocess.check_output(["git", "rev-parse", "HEAD"], text=True).strip()- except Exception:- return "main"+ return "main"def main() -> int:parser = argparse.ArgumentParser()parser.add_argument("--out", required=True, type=Path,help="Output directory, typically website/docs/api/")+ parser.add_argument("--ref", default=None,+ help="Git ref for source links (default: main; override per snapshotted version with e.g. v0.3.0).")args = parser.parse_args()args.out.mkdir(parents=True, exist_ok=True)- sha = current_commit_sha()+ source_ref = resolve_source_ref(args.ref)# griffe 2.x: load returns the Module directlytop: griffe.Module = griffe.load("cubepi") # type: ignore[assignment]@@ -238,7 +290,7 @@ def main() -> int:continuesymbols = collect_public_symbols(submod)out_path = args.out / f"{mod_name.replace('.', '-')}.mdx"- emit_module(out_path, mod_name, position, symbols, sha)+ emit_module(out_path, mod_name, position, symbols, source_ref)print(f"[ok] wrote {out_path} ({len(symbols)} symbols)")return 0diff --git a/website/scripts/tests/test_build_api_reference.py b/website/scripts/tests/test_build_api_reference.pyindex 94f0c50..9f16d91 100644--- a/website/scripts/tests/test_build_api_reference.py+++ b/website/scripts/tests/test_build_api_reference.py@@ -51,7 +51,7 @@ def test_emit_module_writes_generated_marker(tmp_path):module_name="cubepi.utils",sidebar_position=6,symbols=[],- commit_sha="abc1234",+ source_ref="main",)body = module_path.read_text(encoding="utf-8")assert body.startswith("---\n")diff --git a/website/versioned_docs/version-0.3/api/cubepi-agent.mdx b/website/versioned_docs/version-0.3/api/cubepi-agent.mdxindex b85d721..5198420 100644--- a/website/versioned_docs/version-0.3/api/cubepi-agent.mdx+++ b/website/versioned_docs/version-0.3/api/cubepi-agent.mdx@@ -16,7 +16,7 @@ Agent(self, provider: Provider, model: Model, system_prompt: str = '', tools: li```-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/agent/agent.py#L105)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/agent/agent.py#L105)### AgentState@@ -28,7 +28,7 @@ AgentState(self, system_prompt: str = '', model: Model = (lambda: Model(id='unkn```-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/agent/agent.py#L66)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/agent/agent.py#L66)### run_agent_loop@@ -40,7 +40,7 @@ run_agent_loop(prompts: list[Message], context: AgentContext, provider: Provider```-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/agent/loop.py#L30)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/agent/loop.py#L30)### run_agent_loop_continue@@ -52,7 +52,7 @@ run_agent_loop_continue(context: AgentContext, provider: Provider, model: Model,```-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/agent/loop.py#L87)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/agent/loop.py#L87)### execute_tool_calls@@ -64,7 +64,7 @@ execute_tool_calls(context: AgentContext, assistant_message: AssistantMessage, t```-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/agent/tools.py#L200)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/agent/tools.py#L200)### AfterToolCallContext@@ -76,7 +76,7 @@ AfterToolCallContext(self, assistant_message: AssistantMessage, tool_call: ToolC```-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/agent/types.py#L79)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/agent/types.py#L79)### AfterToolCallResult@@ -84,7 +84,7 @@ AfterToolCallContext(self, assistant_message: AssistantMessage, tool_call: ToolC_class_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/agent/types.py#L64)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/agent/types.py#L64)### AgentContext@@ -96,7 +96,7 @@ AgentContext(self, system_prompt: str, messages: list[Message], tools: list[Agen```-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/agent/types.py#L48)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/agent/types.py#L48)### AgentEndEvent@@ -104,7 +104,7 @@ AgentContext(self, system_prompt: str, messages: list[Message], tools: list[Agen_class_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/agent/types.py#L104)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/agent/types.py#L104)### AgentEvent@@ -112,7 +112,7 @@ _class__attribute_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/agent/types.py#L158)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/agent/types.py#L158)### AgentListener@@ -120,7 +120,7 @@ _attribute__attribute_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/agent/types.py#L173)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/agent/types.py#L173)### AgentStartEvent@@ -128,7 +128,7 @@ _attribute__class_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/agent/types.py#L100)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/agent/types.py#L100)### AgentTool@@ -140,7 +140,7 @@ AgentTool(self, name: str, description: str, parameters: type[TParams], execute:```-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/agent/types.py#L30)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/agent/types.py#L30)### AgentToolResult@@ -148,7 +148,7 @@ AgentTool(self, name: str, description: str, parameters: type[TParams], execute:_class_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/agent/types.py#L23)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/agent/types.py#L23)### BeforeToolCallContext@@ -160,7 +160,7 @@ BeforeToolCallContext(self, assistant_message: AssistantMessage, tool_call: Tool```-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/agent/types.py#L71)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/agent/types.py#L71)### BeforeToolCallResult@@ -168,7 +168,7 @@ BeforeToolCallContext(self, assistant_message: AssistantMessage, tool_call: Tool_class_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/agent/types.py#L59)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/agent/types.py#L59)### MessageEndEvent@@ -176,7 +176,7 @@ _class__class_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/agent/types.py#L130)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/agent/types.py#L130)### MessageStartEvent@@ -184,7 +184,7 @@ _class__class_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/agent/types.py#L119)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/agent/types.py#L119)### MessageUpdateEvent@@ -192,7 +192,7 @@ _class__class_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/agent/types.py#L124)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/agent/types.py#L124)### ShouldStopAfterTurnContext@@ -204,7 +204,7 @@ ShouldStopAfterTurnContext(self, message: AssistantMessage, tool_results: list[T```-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/agent/types.py#L89)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/agent/types.py#L89)### ToolExecutionEndEvent@@ -212,7 +212,7 @@ ShouldStopAfterTurnContext(self, message: AssistantMessage, tool_results: list[T_class_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/agent/types.py#L150)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/agent/types.py#L150)### ToolExecutionStartEvent@@ -220,7 +220,7 @@ _class__class_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/agent/types.py#L135)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/agent/types.py#L135)### ToolExecutionUpdateEvent@@ -228,7 +228,7 @@ _class__class_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/agent/types.py#L142)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/agent/types.py#L142)### TurnEndEvent@@ -236,7 +236,7 @@ _class__class_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/agent/types.py#L113)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/agent/types.py#L113)### TurnStartEvent@@ -244,7 +244,7 @@ _class__class_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/agent/types.py#L109)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/agent/types.py#L109)### emit_event@@ -256,7 +256,7 @@ emit_event(emit_fn: Callable, event: object) -> None```-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/utils/emit.py#L7)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/utils/emit.py#L7)diff --git a/website/versioned_docs/version-0.3/api/cubepi-checkpointer.mdx b/website/versioned_docs/version-0.3/api/cubepi-checkpointer.mdxindex 8747427..14f6620 100644--- a/website/versioned_docs/version-0.3/api/cubepi-checkpointer.mdx+++ b/website/versioned_docs/version-0.3/api/cubepi-checkpointer.mdx@@ -12,7 +12,7 @@ hide_table_of_contents: false_class_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/checkpointer/base.py#L13)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/checkpointer/base.py#L13)### CheckpointData@@ -24,7 +24,7 @@ CheckpointData(self, messages: list[Any] = list(), extra: dict[str, Any] = dict(```-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/checkpointer/base.py#L7)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/checkpointer/base.py#L7)### MemoryCheckpointer@@ -36,7 +36,47 @@ MemoryCheckpointer(self)```-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/checkpointer/memory.py#L8)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/checkpointer/memory.py#L8)+++### PostgresCheckpointer++_class_++```python+PostgresCheckpointer(self, dsn: str, min_pool_size: int = 1, max_pool_size: int = 10)+```++Checkpointer backed by PostgreSQL.+++**Usage**++```python+cp = PostgresCheckpointer(dsn="postgresql://...")+async with cp:+ await cp.append(thread_id, [msg1, msg2])+ data = await cp.load(thread_id)+ await cp.save_extra(thread_id, {"k": "v"})++```++Raises CubepiSchemaUninitialized / CubepiSchemaMismatch at __aenter__+if the DB schema isn't compatible with this cubepi version.++[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/checkpointer/postgres/checkpointer.py#L46)+++### SQLiteCheckpointer++_class_++```python+SQLiteCheckpointer(self, db_path: str)+```+++[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/checkpointer/sqlite.py#L12)diff --git a/website/versioned_docs/version-0.3/api/cubepi-mcp.mdx b/website/versioned_docs/version-0.3/api/cubepi-mcp.mdxindex 52fd5bb..3a6feb3 100644--- a/website/versioned_docs/version-0.3/api/cubepi-mcp.mdx+++ b/website/versioned_docs/version-0.3/api/cubepi-mcp.mdx@@ -24,7 +24,7 @@ The transport's own timeout bounds the SSE connection; we additionallywrap initialize/list/call awaits in asyncio.wait_for so a server thataccepts the connection but stalls on protocol messages still aborts.-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/mcp/http_loader.py#L12)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/mcp/http_loader.py#L12)### load_mcp_tools_stdio@@ -50,7 +50,7 @@ simplicity, no process pooling).- `timeout` — per-call wall-clock timeout for initialize/list/call awaits.A hung server raises asyncio.TimeoutError instead of blocking forever.-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/mcp/stdio_loader.py#L12)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/mcp/stdio_loader.py#L12)diff --git a/website/versioned_docs/version-0.3/api/cubepi-middleware.mdx b/website/versioned_docs/version-0.3/api/cubepi-middleware.mdxindex a62bd7b..8c6f61e 100644--- a/website/versioned_docs/version-0.3/api/cubepi-middleware.mdx+++ b/website/versioned_docs/version-0.3/api/cubepi-middleware.mdx@@ -12,7 +12,7 @@ hide_table_of_contents: false_class_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/middleware/base.py#L23)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/middleware/base.py#L23)### TurnAction@@ -29,7 +29,7 @@ Composition (chain): each middleware sees previous middleware'sTurnAction. Last middleware's value wins for response and decision.inject_messages concatenates across the chain.-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/middleware/base.py#L9)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/middleware/base.py#L9)### compose_middleware@@ -41,7 +41,7 @@ compose_middleware(middlewares: list[Middleware]) -> dict[str, Callable]```-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/middleware/base.py#L63)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/middleware/base.py#L63)diff --git a/website/versioned_docs/version-0.3/api/cubepi-providers.mdx b/website/versioned_docs/version-0.3/api/cubepi-providers.mdxindex d974a6e..af5c193 100644--- a/website/versioned_docs/version-0.3/api/cubepi-providers.mdx+++ b/website/versioned_docs/version-0.3/api/cubepi-providers.mdx@@ -12,7 +12,7 @@ hide_table_of_contents: false_class_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/providers/base.py#L123)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L123)### Content@@ -20,7 +20,7 @@ _class__attribute_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/providers/base.py#L106)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L106)### ImageContent@@ -28,7 +28,7 @@ _attribute__class_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/providers/base.py#L95)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L95)### Message@@ -36,7 +36,7 @@ _class__attribute_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/providers/base.py#L147)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L147)### MessageStream@@ -48,7 +48,7 @@ MessageStream(self)```-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/providers/base.py#L177)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L177)### Model@@ -56,7 +56,7 @@ MessageStream(self)_class_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/providers/base.py#L78)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L78)### ModelCost@@ -64,7 +64,7 @@ _class__class_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/providers/base.py#L64)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L64)### OnPayloadCallback@@ -74,7 +74,7 @@ _attribute_Optional callback for inspecting/replacing provider payloads before sending.Return a dict to replace the payload, or None to keep unchanged.-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/providers/base.py#L227)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L227)### OnResponseCallback@@ -83,7 +83,7 @@ _attribute_Optional callback invoked after an HTTP response is received.-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/providers/base.py#L231)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L231)### Provider@@ -91,7 +91,7 @@ Optional callback invoked after an HTTP response is received._class_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/providers/base.py#L274)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L274)### ProviderResponse@@ -104,7 +104,7 @@ ProviderResponse(self, status: int, headers: dict[str, str] = dict())HTTP response metadata exposed to on_response callbacks.-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/providers/base.py#L219)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L219)### StreamEvent@@ -112,7 +112,7 @@ HTTP response metadata exposed to on_response callbacks._class_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/providers/base.py#L156)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L156)### StreamOptions@@ -121,7 +121,7 @@ _class_Options bag for Provider.stream(), transparent to the agent loop.-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/providers/base.py#L235)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L235)### TextContent@@ -129,7 +129,7 @@ Options bag for Provider.stream(), transparent to the agent loop._class_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/providers/base.py#L90)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L90)### ThinkingBudgets@@ -138,7 +138,7 @@ _class_Token budgets for each thinking level.-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/providers/base.py#L21)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L21)### ThinkingContent@@ -146,7 +146,7 @@ Token budgets for each thinking level._class_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/providers/base.py#L101)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L101)### ThinkingLevel@@ -154,7 +154,7 @@ _class__attribute_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/providers/base.py#L18)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L18)### ToolCall@@ -162,7 +162,7 @@ _attribute__class_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/providers/base.py#L109)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L109)### ToolDefinition@@ -170,7 +170,7 @@ _class__class_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/providers/base.py#L150)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L150)### ToolResultMessage@@ -178,7 +178,7 @@ _class__class_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/providers/base.py#L136)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L136)### Usage@@ -186,7 +186,7 @@ _class__class_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/providers/base.py#L71)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L71)### UserMessage@@ -194,7 +194,7 @@ _class__class_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/providers/base.py#L116)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L116)### adjust_max_tokens_for_thinking@@ -217,7 +217,7 @@ to leave at least ``min_output_tokens`` (1024) for output.- A ``(max_tokens, thinking_budget)`` tuple.-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/providers/base.py#L30)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/base.py#L30)### FauxProvider@@ -229,7 +229,7 @@ FauxProvider(self, tokens_per_second: float | None = None, token_size_min: int =```-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/providers/faux.py#L151)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/faux.py#L151)### faux_assistant_message@@ -241,7 +241,7 @@ faux_assistant_message(content: str | FauxContentBlock | list[FauxContentBlock],```-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/providers/faux.py#L59)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/faux.py#L59)### faux_text@@ -253,7 +253,7 @@ faux_text(text: str) -> TextContent```-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/providers/faux.py#L42)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/faux.py#L42)### faux_thinking@@ -265,7 +265,7 @@ faux_thinking(thinking: str) -> ThinkingContent```-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/providers/faux.py#L46)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/faux.py#L46)### faux_tool_call@@ -277,7 +277,7 @@ faux_tool_call(name: str, arguments: dict[str, Any], id: str | None = None) -> T```-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/providers/faux.py#L50)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/faux.py#L50)### THINKING_LEVELS@@ -285,7 +285,7 @@ faux_tool_call(name: str, arguments: dict[str, Any], id: str | None = None) -> T_attribute_-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/providers/models.py#L12)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/models.py#L12)### clamp_thinking_level@@ -302,7 +302,7 @@ If *level* is already supported, return it unchanged. Otherwise searchupward first (higher intensity), then downward, through the ordered levellist to find the closest available level.-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/providers/models.py#L54)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/models.py#L54)### get_supported_thinking_levels@@ -321,7 +321,7 @@ Return the thinking levels supported by *model*.``"xhigh"`` is only included when it has an explicit (non-None) mapping.All other levels are included by default when the map omits them.-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/providers/models.py#L22)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/models.py#L22)### models_are_equal@@ -337,7 +337,7 @@ Return ``True`` if *a* and *b* refer to the same model.Comparison is by ``id`` and ``provider``. Returns ``False`` when eitherargument is ``None``.-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/providers/models.py#L87)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/providers/models.py#L87)diff --git a/website/versioned_docs/version-0.3/api/cubepi-utils.mdx b/website/versioned_docs/version-0.3/api/cubepi-utils.mdxindex be0e065..853a787 100644--- a/website/versioned_docs/version-0.3/api/cubepi-utils.mdx+++ b/website/versioned_docs/version-0.3/api/cubepi-utils.mdx@@ -16,7 +16,7 @@ emit_event(emit_fn: Callable, event: object) -> None```-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/utils/emit.py#L7)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/utils/emit.py#L7)### parse_streaming_json@@ -33,12 +33,12 @@ Uses a 3-tier fallback:1. ``json.loads(text)``2. ``json.loads(repair_json(text))``3. Partial-parse: repair + close open braces/brackets/strings- 4. ``{}`` as last resort+ 4. ``\{\}`` as last resort-Always returns a *dict* (or at minimum ``{}``) so callers never need+Always returns a *dict* (or at minimum ``\{\}``) so callers never needto handle parse failures.-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/utils/json_parse.py#L169)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/utils/json_parse.py#L169)### repair_json@@ -60,7 +60,7 @@ JSON string value. Inside strings it:(e.g. ``\x`` becomes ``\\x``), making the output parseable.* Handles truncated backslash at end-of-string.-[source](https://github.com/cubeplexai/cubepi/blob/546375c8c986a00e2d3559a78f219fc426818c24/cubepi/utils/json_parse.py#L39)+[source](https://github.com/cubeplexai/cubepi/blob/main/cubepi/utils/json_parse.py#L39)