|
1 | 1 | # API reference — streamlit-coco |
2 | 2 |
|
3 | 3 | Public surface exported from `import streamlit_coco as st_coco`. |
4 | | -Alpha `0.1.0` — signatures may still move; prefer this page over the PRD sketch. |
| 4 | +Alpha `0.1.6` — signatures may still move; prefer this page over the PRD sketch. |
5 | 5 |
|
6 | 6 | **Related:** [README quickstart](../README.md) · [Local deployment](deployment/local.md) · [Feature docs](features/README.md) · [SDK docs](https://docs.snowflake.com/en/user-guide/cortex-code-agent-sdk/cortex-code-agent-sdk) |
7 | 7 |
|
@@ -158,11 +158,38 @@ Native transcript / field output + approvals + Stop. App owns input. |
158 | 158 | | `text_renderer` | `None` | `"markdown"` (default) / `"write"` / `"text"` / … or callable. Default markdown highlights fenced code blocks via `st.code` | |
159 | 159 | | `show_copy` | `True` | Clipboard controls on assistant messages and tool cards | |
160 | 160 | | `max_messages` | `None` | Transcript window size; **Load earlier** reveals older items | |
| 161 | +| `preview_chars` | `None` | Cap user/assistant text to the first N characters | |
161 | 162 | | `on_structured_output` | `None` | `Callable[[dict, CocoChatResult], None]` | |
162 | 163 | | `structured_output_container` | `None` | Container for structured render | |
163 | 164 |
|
164 | 165 | Feature doc: [`features/panel/panel.md`](features/panel/panel.md). |
165 | 166 |
|
| 167 | +### `copilot_rail(session, *, title="Copilot", …) -> None` |
| 168 | + |
| 169 | +Right-rail Copilot: connection popover with transcript pills beside it, queued job, |
| 170 | +`panel()`, chat input. App-agnostic — callers own session lifecycle and job dicts. |
| 171 | +While CoCo is busy, **Working · thinking…** is a badge on the pills row (not a |
| 172 | +tall status card). |
| 173 | + |
| 174 | +| Param | Default | Notes | |
| 175 | +| --- | --- | --- | |
| 176 | +| `session` | — | `CocoSession` or `None` until connected | |
| 177 | +| `connected` | `True` | Whether Connect has been confirmed | |
| 178 | +| `connections` | `None` | Snowflake connection names for the popover | |
| 179 | +| `on_connect` / `on_disconnect` | `None` | Callbacks; omit to hide the popover | |
| 180 | +| `job` | `None` | `{prompt, label, status, expect_structured, …}` | |
| 181 | +| `on_job_sent` | `None` | Called after a queued prompt is `session.send`'d | |
| 182 | +| `on_job_finished` | `None` | Called when that turn ends (`COMPLETED` / `ERROR` / `CANCELLED`, or `READY` after a run) so the app can drop the job | |
| 183 | +| `show_copy` | `False` | Clipboard controls off for demo rails | |
| 184 | +| `show_transcript_filters` | `True` | Pills: **Last messages** · **First 200 characters** | |
| 185 | + |
| 186 | +### `transcript_view_pills(*, key=…, last_n=8, preview_chars=200) -> tuple[int \| None, int \| None]` |
| 187 | + |
| 188 | +Standalone pills for apps that call `panel()` directly. Returns `(max_messages, preview_chars)`. |
| 189 | +Label is collapsed by default (no **Transcript** heading). |
| 190 | + |
| 191 | +Feature doc: [`features/copilot-rail/copilot-rail.md`](features/copilot-rail/copilot-rail.md). |
| 192 | + |
166 | 193 | ### `chat_input_bar(session, *, placeholder=…, connecting_placeholder=…, key=None, accept_file=False, …) -> str | None` |
167 | 194 |
|
168 | 195 | `st.chat_input` wired to connect/run state; sends via `send_prompt` on submit. Disabled only after a failed boot (`ERROR` and not ready). |
@@ -340,7 +367,7 @@ Tool card UX: [`features/tools-display/SPEC.md`](features/tools-display/SPEC.md) |
340 | 367 | ## Package metadata |
341 | 368 |
|
342 | 369 | ```python |
343 | | -st_coco.__version__ # e.g. "0.1.0" |
| 370 | +st_coco.__version__ # e.g. "0.1.6" |
344 | 371 | ``` |
345 | 372 |
|
346 | 373 | Private modules (`bridge`, `tool_cards`, `tool_extract`, …) are implementation details and are not part of the stable public surface. |
0 commit comments