|
1 | 1 | # API reference — streamlit-coco |
2 | 2 |
|
3 | 3 | Public surface exported from `import streamlit_coco as st_coco`. |
4 | | -Alpha `0.1.8.1` — signatures may still move; prefer this page over the PRD sketch. |
| 4 | +Alpha `0.1.9` — 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 |
|
@@ -176,7 +176,8 @@ status card). |
176 | 176 | | --- | --- | --- | |
177 | 177 | | `session` | — | `CocoSession` or `None` until connected | |
178 | 178 | | `connected` | `True` | Whether Connect has been confirmed | |
179 | | -| `connections` | `None` | Snowflake connection names for the popover | |
| 179 | +| `connections` | `None` | Extra connection names prepended on the popover (e.g. from `st.secrets`). Profiles from the selected TOML always appear | |
| 180 | +| `toml_file` | `None` | Default for the **Config file** selectbox (beside **Connection** on one row). A bare name is looked up under `~/.snowflake/`; a path is used as given | |
180 | 181 | | `on_connect` / `on_disconnect` | `None` | Callbacks; omit to hide the popover | |
181 | 182 | | `job` | `None` | `{prompt, label, status, expect_structured, …}` | |
182 | 183 | | `on_job_sent` | `None` | Called after a queued prompt is `session.send`'d | |
@@ -288,7 +289,7 @@ Low-level resolve for custom approval UIs. |
288 | 289 |
|
289 | 290 | | Function | Role | |
290 | 291 | | --- | --- | |
291 | | -| `render_environment_status(env=None, *, connection=None, stacked=False, show_title=True)` | SDK / CLI / Snowflake probe UI | |
| 292 | +| `render_environment_status(env=None, *, connection=None, toml_file=None, stacked=False, show_title=True)` | SDK / CLI / Snowflake probe UI | |
292 | 293 | | `render_start_gate(options, *, session_key=…, gate_key=…, warm_up=True, env=None) -> bool` | Landing screen; `False` → call `st.stop()` | |
293 | 294 |
|
294 | 295 | --- |
@@ -358,14 +359,26 @@ Flatten events for audit views (requires pandas). |
358 | 359 |
|
359 | 360 | ## Environment & errors |
360 | 361 |
|
361 | | -### `check_environment(*, connection=None, cli_path=None) -> CocoEnvironment` |
| 362 | +### `check_environment(*, connection=None, cli_path=None, toml_file=None) -> CocoEnvironment` |
362 | 363 |
|
363 | 364 | Probe without starting an agent. Does not raise. |
364 | 365 |
|
365 | | -`CocoEnvironment` fields: `sdk_installed`, `sdk_version`, `cli_path`, `cli_version`, `snowflake_config_file`, `connection_hint`. |
366 | | -Properties: `ready`, `cli_ok`, `snowflake_config_found`, `snowflake_config_display`. |
| 366 | +`CocoEnvironment` fields: `sdk_installed`, `sdk_version`, `cli_path`, `cli_version`, `snowflake_config_file`, `connection_hint`, `toml_file`. |
| 367 | +Properties: `ready`, `cli_ok`, `snowflake_config_found`, `snowflake_config_display`, `snowflake_config_missing_label`. |
367 | 368 |
|
368 | | -### `require_environment(*, connection=None, cli_path=None, require_snowflake_config=False) -> CocoEnvironment` |
| 369 | +`toml_file` is a Snowflake connections TOML filename under `~/.snowflake/` or a path. When omitted, the only `*.toml` in that directory is used whatever its name; if several exist, `connections.toml` is preferred, then `config.toml`. |
| 370 | + |
| 371 | +### `list_snowflake_toml_files() -> list[Path]` |
| 372 | + |
| 373 | +`*.toml` files under `~/.snowflake/`, with `connections.toml` then `config.toml` first, then the rest alphabetically. |
| 374 | + |
| 375 | +### `list_snowflake_connections(toml_file=None) -> list[str]` |
| 376 | + |
| 377 | +Connection profile names from that TOML. Bare names resolve under `~/.snowflake/`. Legacy `config.toml` is read from the `[connections]` table; other files use top-level tables. |
| 378 | + |
| 379 | +Helpers: `resolve_snowflake_config_path(toml_file=None, *, must_exist=True)`, `default_snowflake_connection_name(toml_file=None)`. |
| 380 | + |
| 381 | +### `require_environment(*, connection=None, cli_path=None, toml_file=None, require_snowflake_config=False) -> CocoEnvironment` |
369 | 382 |
|
370 | 383 | Like `check_environment`, but raises typed errors when SDK/CLI (and optionally Snowflake config) are missing. |
371 | 384 |
|
@@ -406,7 +419,7 @@ Tool card UX: [`features/tools-display/SPEC.md`](features/tools-display/SPEC.md) |
406 | 419 | ## Package metadata |
407 | 420 |
|
408 | 421 | ```python |
409 | | -st_coco.__version__ # e.g. "0.1.8.1" |
| 422 | +st_coco.__version__ # e.g. "0.1.9" |
410 | 423 | ``` |
411 | 424 |
|
412 | 425 | Private modules (`bridge`, `tool_cards`, `tool_extract`, …) are implementation details and are not part of the stable public surface. |
0 commit comments