← Về thư mục
openai4s/server/gateway.py
- _webui_legacy_enabled · function · L260-L266 — def _webui_legacy_enabled() -> bool
- _load_share_assets · function · L284-L301 — def _load_share_assets() -> dict[str, bytes]
- _share_expires_at · function · L304-L321 — def _share_expires_at(body: dict) -> tuple[bool, int | None]
- _strip_token_from_url · function · L336-L353 — def _strip_token_from_url(path: str, query: str) -> str
- _encode_frame_cursor · function · L367-L372 — def _encode_frame_cursor(created_at: int, frame_id: str) -> str
- _decode_frame_cursor · function · L375-L389 — def _decode_frame_cursor(value: str | None) -> tuple[int, str] | None
- _wants_html · function · L404-L413 — def _wants_html(headers) -> bool
- _unauthorized_page · function · L416-L438 — def _unauthorized_page() -> bytes
- queue_preview · function · L459-L465 — def queue_preview(text: str) -> str
- _skill_result_status · function · L468-L486 — def _skill_result_status(payload: object) -> int
- _is_bootstrap_path · function · L579-L589 — def _is_bootstrap_path(path: str) -> bool
- _presented_token · function · L592-L608 — def _presented_token(headers: Any) -> str | None
- _iso · function · L614-L625 — def _iso(ms: int | float | None) -> str | None
- _guess_ctype · function · L628-L644 — def _guess_ctype(name: str) -> str
- _sanitize_header_value · function · L647-L650 — def _sanitize_header_value(value: str) -> str
- _is_fingerprinted_name · function · L677-L678 — def _is_fingerprinted_name(name: str) -> bool
- _gzip_eligible · function · L681-L685 — def _gzip_eligible(name: str, size: int) -> bool
- _weak_etag · function · L688-L692 — def _weak_etag(mtime_ns: int, size: int, *, gzip_body: bool) -> str
- _etag_key · function · L695-L699 — def _etag_key(value: str) -> str
- _if_none_match · function · L702-L712 — def _if_none_match(headers: Any, etag: str) -> bool
- _accepts_gzip · function · L715-L736 — def _accepts_gzip(headers: Any) -> bool
- _gzip_cached_bytes · function · L739-L766 — def _gzip_cached_bytes(path: Path, st: os.stat_result) -> bytes
- _resolve_static_file · function · L769-L802 — def _resolve_static_file(rel: str) -> tuple[Path | None, int | None]
- _sha256 · function · L805-L810 — def _sha256(path: Path) -> str
- _ws_read_frame · function · L830-L833 — def _ws_read_frame(rfile) -> tuple[int, bytes] | None
- WSConnection · class · L843-L1000 — class WSConnection
- init · method · L860-L875 — def init(self, wfile) -> None
- _enqueue · method · L877-L894 — def _enqueue(self, frame: bytes) -> None
- send_json · method · L896-L897 — def send_json(self, obj: dict) -> None
- send_raw · method · L899-L900 — def send_raw(self, payload: bytes, opcode: int) -> None
- _drop · method · L902-L916 — def _drop(self) -> None
- close · method · L918-L919 — def close(self) -> None
- may_receive · method · L921-L941 — def may_receive(self, root_frame_id: str) -> bool
- refresh_visibility · method · L943-L962 — def refresh_visibility(self, root_frame_id: str) -> bool
- commit_visibility · method · L964-L980 — def commit_visibility(self, root_frame_id: str, *, allowed: bool) -> int | None
- note_delivered · method · L982-L984 — def note_delivered(self, root_frame_id: str, sequence: int) -> None
- _drain · method · L986-L1000 — def _drain(self) -> None
- WSHub · class · L1003-L1892 — class WSHub
- init · method · L1015-L1039 — def init(self) -> None
- _next_seq_locked · method · L1041-L1044 — def _next_seq_locked(self, root_frame_id: str) -> int
- add · method · L1046-L1048 — def add(self, c: WSConnection) -> None
- remove · method · L1050-L1052 — def remove(self, c: WSConnection) -> None
- epoch · method · L1055-L1057 — def epoch(self) -> str
- subscribe · method · L1059-L1104 — def subscribe( self, root_frame_id: str, conn: "WSConnection", since_seq: int = 0, epoch: str | None = None, ) -> None
- _cursor_is_stale_locked · method · L1106-L1145 — def _cursor_is_stale_locked( self, root_frame_id: str, since_seq: int, epoch: str | None ) -> bool
- unsubscribe · method · L1147-L1149 — def unsubscribe(self, root_frame_id: str, conn: "WSConnection") -> None
- _evict_live · method · L1153-L1169 — def _evict_live(self) -> None
- _install_live_buffer · method · L1171-L1177 — def _install_live_buffer(self, rid: str, buf: dict) -> dict: # Replacing an older turn for the same frame makes it newest for hard # eviction order; assigning an existing dict key alone would not.
- drop_frame · method · L1179-L1182 — def drop_frame(self, rid: str) -> None
- _event_wire_size · method · L1185-L1189 — def _event_wire_size(obj: dict) -> int
- _prepare_live_event · method · L1191-L1230 — def _prepare_live_event(self, obj: dict) -> tuple[dict, int]
- _new_live_buffer · method · L1232-L1258 — def _new_live_buffer( self, events: list[dict], *, scope: str, execution_id: str = "", ) -> dict
- _ensure_live_accounting · method · L1260-L1269 — def _ensure_live_accounting(self, buf: dict) -> None
- _append_live_event · method · L1271-L1277 — def _append_live_event(self, buf: dict, obj: dict) -> tuple[dict, int]
- _replace_live_event · method · L1279-L1288 — def _replace_live_event(self, buf: dict, index: int, obj: dict) -> tuple[dict, int]
- _remove_live_events · method · L1290-L1301 — def _remove_live_events(self, buf: dict, predicate) -> None
- _refuses_event_locked · method · L1323-L1341 — def _refuses_event_locked(self, rid: str, obj: dict) -> bool
- _is_stale_for_buffer · method · L1344-L1355 — def _is_stale_for_buffer(buf: dict | None, event_execution: str) -> bool
- _record · method · L1357-L1601 — def _record(self, rid: str, obj: dict) -> None
- _cell_event_id · method · L1604-L1606 — def _cell_event_id(obj: dict) -> str | None
- _is_cell_tool_echo · method · L1609-L1617 — def _is_cell_tool_echo(cls, obj: dict | None, cell_id: str | None) -> bool
- _merge_resume_chunk · method · L1620-L1624 — def _merge_resume_chunk(cls, previous: str, chunk: str) -> str
- _trim_live_events · method · L1626-L1700 — def _trim_live_events(self, buf: dict) -> None
- broadcast · method · L1702-L1789 — def broadcast(self, root_frame_id: str | None, obj: dict) -> None
- is_running · method · L1791-L1793 — def is_running(self, root_frame_id: str) -> bool
- has_subscriber · method · L1795-L1800 — def has_subscriber(self, root_frame_id: str) -> bool
- replay · method · L1802-L1809 — def replay(self, root_frame_id: str, conn: "WSConnection") -> None
- _enqueue_replay_locked · method · L1811-L1885 — def _enqueue_replay_locked( self, root_frame_id: str, conn: "WSConnection", events: list[dict], since_seq: int = 0, *, forced_gap: bool = False, require_complete: bool = False, ) -> None
- emitter · method · L1887-L1892 — def emitter(self, root_frame_id: str)
- emit · function · L1888-L1890 — def emit(event: dict) -> None
- SessionState · class · L1898-L2072 — class SessionState
- init · method · L1899-L2013 — def init( self, root_frame_id: str, project_id: str, workspace: Path, *, branch_id: str | None = None, kernel_generations=None, owner_instance_id: str | None = None, clock_ms=None, trusted_capture_enabled: bool = False, )
- kernel · method · L2016-L2018 — def kernel(self) -> Kernel | None
- dispatcher · method · L2021-L2023 — def dispatcher(self)
- dispatcher · method · L2026-L2027 — def dispatcher(self, value) -> None
- r_kernel · method · L2030-L2032 — def r_kernel(self) -> Kernel | None
- kernel_manual_stop · method · L2035-L2036 — def kernel_manual_stop(self) -> bool
- execution_barrier · method · L2039-L2072 — def execution_barrier(self, *, deadline: float | None = None)
- remaining · function · L2042-L2045 — def remaining() -> float | None
- MessageJob · class · L2075-L2189 — class MessageJob
- init · method · L2076-L2129 — def init(self, job_id: str, root_frame_id: str) -> None
- finish · method · L2131-L2135 — def finish(self, result: dict | None = None, error: str | None = None) -> None
- project · method · L2137-L2164 — def project(self, exc: BaseException, surface: str) -> str
- wait_result · method · L2166-L2189 — def wait_result(self) -> dict
- _maybe_call · function · L2192-L2198 — def _maybe_call(v)
- _local_accelerator_snapshot · function · L2220-L2244 — def _local_accelerator_snapshot() -> dict
- _remote_gpu_runtime_context · function · L2247-L2389 — def _remote_gpu_runtime_context(user_text: str | None = None) -> str
- _submit_nudge_for · function · L2650-L2661 — def _submit_nudge_for(llm_cfg) -> str
- SessionRunner · class · L2664-L12701 — class SessionRunner
- init · method · L2670-L3010 — def init( self, cfg: Config, hub: WSHub, *, clock=None, start_idle_sweeper: bool = True, ) -> None
- _approvals_reviewer_for · function · L2790-L2803 — def _approvals_reviewer_for(store, root_frame_id, project_id)
- _recover_stranded_admissions · method · L3012-L3032 — def _recover_stranded_admissions(self) -> int
- _live_delegation_child · method · L3034-L3086 — def _live_delegation_child(self, root_frame_id: str, child_id: str)
- stop_delegation_subtree · method · L3088-L3102 — def stop_delegation_subtree(self, root_frame_id: str, child_id: str) -> dict
- steer_delegation_child · method · L3104-L3133 — def steer_delegation_child( self, root_frame_id: str, child_id: str, message: str ) -> dict
- continue_delegation_child · method · L3135-L3172 — def continue_delegation_child(self, root_frame_id: str, child_id: str) -> dict
- refresh_compute_task · method · L3174-L3313 — def refresh_compute_task(self, root_frame_id: str, job_id: str) -> dict
- cancel_compute_task · method · L3315-L3407 — def cancel_compute_task( self, root_frame_id: str, job_id: str, body: dict | None = None ) -> dict
- workspace_for · method · L3409-L3412 — def workspace_for(self, root_frame_id: str) -> Path
- workspace_for_branch · method · L3414-L3423 — def workspace_for_branch(self, root_frame_id: str, branch_id: str) -> Path
- active_workspace_for · method · L3425-L3432 — def active_workspace_for(self, root_frame_id: str) -> Path
- _kernel_read_isolation · method · L3434-L3596 — def _kernel_read_isolation( self, st: SessionState, *, workspace: Path | None = None, include_skill_sidecars: bool = False, ) -> KernelReadIsolation | None
- _existing_state · method · L3598-L3600 — def _existing_state(self, root_frame_id: str) -> SessionState | None
- _pending_permissions · method · L3602-L3608 — def _pending_permissions(self, root_frame_id: str) -> list[dict]
- _session_snapshot · method · L3610-L3612 — def _session_snapshot(self) -> list[SessionState]
- _execution_active · method · L3614-L3643 — def _execution_active(self, root_frame_id: str) -> bool
- _permission_pending · method · L3646-L3652 — def _permission_pending(root_frame_id: str) -> bool
- _background_jobs · method · L3655-L3663 — def _background_jobs(st: SessionState) -> list[dict]
- _background_active · method · L3665-L3669 — def _background_active(self, st: SessionState) -> bool
- _background_last_activity_ms · method · L3671-L3678 — def _background_last_activity_ms(self, st: SessionState) -> int | None
- _interrupt_background · method · L3680-L3698 — def _interrupt_background(self, st: SessionState) -> None
- _release_idle_session · method · L3700-L3776 — def _release_idle_session(self, st: SessionState, reason: str) -> bool
- drop_session · method · L3778-L3821 — def drop_session( self, root_frame_id: str, *, reason: str = "session_closed" ) -> bool
- delete_session · method · L3823-L3836 — def delete_session(self, root_frame_id: str) -> dict[str, Any]
- _may_create_session_in · method · L3838-L3875 — def _may_create_session_in(self, project_id: str, user_id: str) -> bool
- create_session · method · L3877-L3947 — def create_session( self, project_id: str, *, model: str | None = None, owner_user_id: str | None = None, ) -> str
- delete_project · method · L3949-L3976 — def delete_project(self, project_id: str) -> dict[str, Any]
- _init_orchestration · method · L3978-L4136 — def _init_orchestration(self) -> None
- session_credentials_isolated · function · L4073-L4077 — def session_credentials_isolated( backend_name: str, _backends=self.orchestration_backends, ) -> bool
- on_state_lost · function · L4100-L4101 — def on_state_lost(workload, allocation, _m=manager)
- ensure_reconciler · method · L4138-L4157 — def ensure_reconciler(self) -> None
- _on_orchestration_event · method · L4159-L4191 — def _on_orchestration_event(self, kind: str, payload: dict) -> None
- _schedule_orchestration_cleanup · method · L4193-L4238 — def _schedule_orchestration_cleanup( self, session_id: str, workload_id: str, reason: Any ) -> bool
- _orchestration_cleanup_worker · method · L4240-L4314 — def _orchestration_cleanup_worker(self) -> None
- _restore_orchestration_cleanups · method · L4316-L4336 — def _restore_orchestration_cleanups(self) -> None
- _stop_orchestration_cleanup · method · L4338-L4344 — def _stop_orchestration_cleanup(self) -> None
- close · method · L4346-L4409 — def close(self) -> None
- _versions_dir · method · L4412-L4413 — def _versions_dir(self) -> Path
- live_artifact_path · method · L4415-L4416 — def live_artifact_path(self, a: dict) -> Path
- _write_version_snapshot · method · L4418-L4428 — def _write_version_snapshot( self, version_id: str, filename: str, *, src_path: Path | None = None, data: bytes | None = None, ) -> None
- _protect_latest_version_snapshots · method · L4430-L4431 — def _protect_latest_version_snapshots(self, st: SessionState) -> None
- _external_project_artifact_mutation · method · L4434-L4448 — def _external_project_artifact_mutation(self, project_id: str)
- _external_artifact_mutation · method · L4451-L4547 — def _external_artifact_mutation( self, *, frame_id: str | None = None, project_id: str | None = None, artifact_id: str | None = None, )
- upload_artifact · method · L4549-L4554 — def upload_artifact(self, payload: dict, *, broadcast=None) -> dict
- save_datapro_search_result · method · L4556-L4654 — def save_datapro_search_result( self, *, query: str, result: dict, frame_id: str | None, secrets: tuple[str, ...], source_result: dict, ) -> tuple[dict | None, dict | None]
- collect_event · function · L4578-L4579 — def collect_event(root_frame_id: str, event: dict) -> None
- edit_artifact · method · L4656-L4668 — def edit_artifact( self, artifact_id: str, content: str, *, broadcast=None, ) -> dict
- save_artifact_structure · method · L4670-L4684 — def save_artifact_structure( self, artifact_id: str, *, content: str, fmt: str = "mol", ) -> dict
- rename_artifact · method · L4686-L4698 — def rename_artifact( self, artifact_id: str, filename: str | None, *, broadcast=None, ) -> dict
- delete_artifact · method · L4700-L4702 — def delete_artifact(self, artifact_id: str, *, broadcast=None) -> dict
- promote_cell_artifact · method · L4704-L4714 — def promote_cell_artifact( self, target: PromotionTarget, cell: dict, emit, ) -> dict | None
- restore_version · method · L4716-L4722 — def restore_version(self, artifact_id: str, version_id: str) -> dict
- mutate_session_domain · method · L4724-L4768 — def mutate_session_domain( self, root_frame_id: str, project_id: str, *, operation: str, mutate, invalidate_kernel: bool = False, ) -> dict
- export_session_package · method · L4770-L4784 — def export_session_package( self, root_frame_id: str, project_id: str, ) -> dict[str, Any]
- _prepare_revert_unlock · method · L4786-L4800 — def _prepare_revert_unlock( self, root_frame_id: str, branch_id: str, checkpoint: Mapping[str, Any], ) -> None
- _invalidate_reverted_session · method · L4802-L4844 — def _invalidate_reverted_session( self, st: SessionState, checkpoint: Mapping[str, Any] ) -> None
- activate_session_branch · method · L4846-L5052 — def activate_session_branch( self, root_frame_id: str, project_id: str, branch_id: str, ) -> dict[str, Any]
- execute_recovery_action · method · L5054-L5155 — def execute_recovery_action( self, root_frame_id: str, project_id: str, action_id: str, *, branch_id: str | None = None, confirmed: bool = False, ) -> dict
- _recovery_runtime · method · L5157-L5200 — def _recovery_runtime(self, st: SessionState, emit) -> SessionRecoveryRuntime
- python_runtime · function · L5160-L5166 — def python_runtime()
- python_published · function · L5168-L5174 — def python_published(name, factory, bin_dir) -> None
- _share_enabled · method · L5203-L5204 — def _share_enabled(self) -> bool
- _share_run_in_ticket · method · L5206-L5219 — def _share_run_in_ticket(self, root_frame_id: str, branch_id: str, fn)
- _session_is_metered · method · L5221-L5231 — def _session_is_metered(self, root_frame_id: str) -> bool
- enforce_llm_quota · method · L5233-L5267 — def enforce_llm_quota(self, root_frame_id: str) -> None
- session_replay_view · method · L5269-L5286 — def session_replay_view(self, root_frame_id: str) -> bytes
- ensure_share_tunnel · method · L5288-L5304 — def ensure_share_tunnel(self)
- share_status · method · L5306-L5327 — def share_status(self) -> dict[str, Any]
- set_sharing_enabled · method · L5329-L5350 — def set_sharing_enabled(self, enabled: bool) -> dict[str, Any]
- _share_boot_restore · method · L5352-L5365 — def _share_boot_restore(self) -> None
- import_quarantine · method · L5367-L5379 — def import_quarantine(self, root_frame_id: str) -> dict[str, Any] | None
- require_session_writable · method · L5381-L5433 — def require_session_writable(self, root_frame_id: str, operation: str) -> None
- _state · method · L5435-L5484 — def _state( self, root_frame_id: str, project_id: str, *, allow_quarantined: bool = False, ) -> SessionState
- _queue_execution · method · L5486-L5552 — def _queue_execution( self, st: SessionState, *, owner: str, owner_id: str, execution_id: str | None = None, language: str | None = None, reason: str, metadata: Mapping[str, Any] | None = None, admission_deadline: float | None = None, )
- remaining · function · L5507-L5510 — def remaining() -> float | None
- _session_execution · method · L5555-L5628 — def _session_execution( self, st: SessionState, *, owner: str, owner_id: str, execution_id: str | None = None, language: str | None = None, reason: str, ticket=None, admission_timeout_s: float | None = None, )
- turn_barrier · function · L5594-L5611 — def turn_barrier()
- _seed_messages · method · L5630-L5773 — def _seed_messages(self, st: SessionState) -> None
- _skills_for · method · L5775-L5793 — def _skills_for(self, st: SessionState)
- _placement_workspace · method · L5795-L5813 — def _placement_workspace(self, st: SessionState) -> Path | None
- _sync_placement_workspace · method · L5815-L5841 — def _sync_placement_workspace(self, st: SessionState, placed: Path | None) -> None
- _configure_background_kernel_factory · method · L5843-L5887 — def _configure_background_kernel_factory( self, st: SessionState, dispatcher ) -> None
- refuse_cluster_background · function · L5856-L5864 — def refuse_cluster_background() -> Kernel
- spawn_local_background · function · L5869-L5885 — def spawn_local_background() -> Kernel
- _ensure_runtime · method · L5889-L5965 — def _ensure_runtime(self, st: SessionState)
- factory · function · L5892-L5933 — def factory()
- _block_guardian_run · method · L5967-L6003 — def _block_guardian_run(self, st: SessionState, message: str) -> None
- _finalize_turn_auto_run · method · L6005-L6091 — def _finalize_turn_auto_run( self, st: SessionState, *, turn_id: str, execution_id: str, status: str, gate_requested: bool, ) -> None
- _auto_budget · method · L6093-L6094 — def _auto_budget(self) -> AutoBudgetAdmission
- _auto_budget_extra_phase · method · L6096-L6099 — def _auto_budget_extra_phase(self, st: SessionState) -> bool
- _auto_budget_call_context · method · L6101-L6116 — def _auto_budget_call_context(self, st: SessionState) -> dict[str, Any]
- _admit_auto_budget · method · L6118-L6149 — def _admit_auto_budget( self, st: SessionState, *, consumer: str, action_group_id: str, action_sha256: str | None = None, amount: int = 1, enforce_field_limit: bool = True, token_upper_bound: int | None = None, run_id: str | None = None, ) -> dict | None: #
run_id pins the run this reservation belongs to. Reading it live # is right on the owner thread, but the model path now runs on the # detached provider thread after Stop released the turn: a queued # follow-up can install a new run before that thread reserves, and the # abandoned call would then charge -- and on denial trip -- the run # belonging to a turn that never asked to stop.
- _settle_auto_budget · method · L6151-L6174 — def _settle_auto_budget( self, admission: Mapping[str, Any] | None, *, started: bool, unknown: bool = False, committed_amount: int = 1, ) -> None
- _invoke_model_with_auto_budget · method · L6176-L6284 — def _invoke_model_with_auto_budget( self, st: SessionState, messages: Any, cfg: Any, provider_call: Callable[..., Any], , run_id: str | None = None, action_group_id: str | None = None, extra: bool | None = None, *kwargs: Any, ) -> Any
- _note_auto_budget_trip · method · L6286-L6331 — def _note_auto_budget_trip( self, st: SessionState, denied: AutoBudgetDenied, *, run_id: str | None = None, cancel: bool = True, ) -> None
- _freeze_auto_budget_tokens · method · L6333-L6344 — def _freeze_auto_budget_tokens(self, st: SessionState) -> None
- _note_auto_budget_delta · method · L6346-L6355 — def _note_auto_budget_delta( self, st: SessionState, *, kind: str, cursor: str ) -> None
- _invoke_control_with_auto_budget · method · L6357-L6399 — def _invoke_control_with_auto_budget(self, st, call, emit, invoke): # auto_budget sink: native tool admission before invoke.
- _release_bound_compute_in_execution · method · L6401-L6433 — def _release_bound_compute_in_execution( self, st: SessionState, *, reason, expected_workload_id: str | None = None, ) -> bool
- release_session_compute · method · L6435-L6491 — def release_session_compute( self, root_frame_id: str, *, reason, expected_workload_id: str | None = None, admission_timeout_s: float | None = None, ) -> bool
- request_session_compute · method · L6493-L6562 — def request_session_compute( self, root_frame_id: str, *, owner_user_id: str, project_id: str, profile, backend: str, recovery, )
- _release_session_compute · method · L6564-L6578 — def _release_session_compute(self, root_frame_id: str) -> None
- _touch_compute_lease · method · L6580-L6591 — def _touch_compute_lease(self, st: "SessionState") -> None
- _remote_kernel_factory · method · L6593-L6725 — def _remote_kernel_factory(self, st: "SessionState", disp)
- build · function · L6711-L6720 — def build() -> Kernel
- _spawn_kernel · method · L6727-L6966 — def _spawn_kernel(self, st: SessionState) -> KernelLease
- factory · function · L6771-L6772 — def factory() -> Kernel
- factory · function · L6776-L6777 — def factory() -> Kernel
- _refuse_background · function · L6935-L6943 — def _refuse_background() -> Kernel
- _refuse_delegation · function · L6947-L6953 — def _refuse_delegation(_spec: dict) -> None
- _wire_delegation · method · L6968-L7152 — def _wire_delegation(self, st: SessionState, dispatcher=None) -> None
- build_child_cell_hooks · function · L7043-L7048 — def build_child_cell_hooks(producer_frame_id)
- trusted_capture_admission · function · L7054-L7060 — def trusted_capture_admission()
- trusted_capture_lease · function · L7067-L7076 — def trusted_capture_lease()
- child_event_sink · function · L7091-L7095 — def child_event_sink(payload)
- _resolve_env · method · L7154-L7178 — def _resolve_env(self, st: SessionState)
- _selected_env_name · method · L7180-L7191 — def _selected_env_name(self, st: SessionState) -> str
- _persisted_env · method · L7193-L7200 — def _persisted_env(self, root_frame_id: str) -> "str | None"
- _persist_env · method · L7202-L7209 — def _persist_env(self, root_frame_id: str, name: str) -> None
- _make_env_switch_sink · method · L7211-L7225 — def _make_env_switch_sink(self, st: SessionState)
- sink · function · L7216-L7223 — def sink(name: str) -> None
- _ensure_kernel · method · L7227-L7236 — def _ensure_kernel(self, st: SessionState) -> None: # A live local fallback is not the final answer while a cluster # workload remains bound. Re-enter
_spawn_kernel on each Cell so a # worker that arrived since the previous attempt can be selected; the # supervisor cheaply reuses the local lease when it still has not.
- _prepare_language · method · L7238-L7258 — def _prepare_language(self, st: SessionState, language: str) -> str | None
- _cell_cancelled · method · L7260-L7271 — def _cell_cancelled(self, st: SessionState) -> bool
- _make_step_sink · method · L7273-L7323 — def _make_step_sink(self, st: SessionState)
- sink · function · L7280-L7321 — def sink(ev: dict) -> None
- _make_plan_sink · method · L7325-L7347 — def _make_plan_sink(self, st: SessionState)
- sink · function · L7332-L7345 — def sink(ev: dict) -> None
- cancel · method · L7349-L7381 — def cancel( self, root_frame_id: str, execution_id: str | None = None, *, owner: dict | str | None = None, owner_id: str | None = None, reason: str = "cancelled by user", ) -> dict
- _cancel_current_for_lifecycle · method · L7383-L7392 — def _cancel_current_for_lifecycle( self, root_frame_id: str, *, reason: str, ) -> dict
- cancel_review · method · L7394-L7406 — def cancel_review(self, root_frame_id: str) -> dict
- _after_execution_cancel · method · L7408-L7446 — def _after_execution_cancel( self, root_frame_id: str, result: dict, ) -> dict: # A queued cancellation must not release the active Agent's approval or # reviewer. Those session-global compatibility paths are touched only # after the coordinator proved the exact running owner.
- interrupt_kernel · method · L7448-L7479 — def interrupt_kernel( self, root_frame_id: str, execution_id: str | None = None, *, owner: dict | str | None = None, owner_id: str | None = None, ) -> dict
- _run_bootstrap · method · L7481-L7503 — def _run_bootstrap( self, st: SessionState, kernel: Kernel | None = None, *, workspace: Path | None = None, ) -> dict
- restart_kernel · method · L7505-L7576 — def restart_kernel(self, root_frame_id: str, project_id: str) -> dict
- install_packages · method · L7578-L7663 — def install_packages( self, packages: list[str], root_frame_id: str | None = None, project_id: str | None = None, restart: bool = True, _coordinated: bool = False, ) -> dict
- running_frames · method · L7666-L7671 — def running_frames(self) -> set
- is_running · method · L7673-L7679 — def is_running(self, root_frame_id: str) -> bool
- kernel_alive · method · L7681-L7685 — def kernel_alive(self, root_frame_id: str) -> bool
- kernel_status · method · L7687-L7750 — def kernel_status(self, root_frame_id: str) -> dict
- _env_summary · method · L7752-L7770 — def _env_summary(self, st: SessionState | None) -> dict
- _env_label · method · L7773-L7781 — def _env_label(name: "str | None") -> str
- _kernel_id · method · L7783-L7785 — def _kernel_id(self, st: "SessionState | None") -> str
- _kernel_language · method · L7787-L7789 — def _kernel_language(self, st: "SessionState | None") -> str
- _r_kernel_id · method · L7791-L7797 — def _r_kernel_id(self, st: "SessionState | None") -> str
- _ensure_r_kernel · method · L7799-L7844 — def _ensure_r_kernel(self, st: SessionState) -> str | None
- stop_kernel · method · L7846-L7958 — def stop_kernel(self, root_frame_id: str, project_id: str = "default") -> dict
- start_kernel · method · L7960-L7992 — def start_kernel(self, root_frame_id: str, project_id: str = "default") -> dict
- list_environments · method · L7995-L8010 — def list_environments(self, root_frame_id: str | None = None) -> dict
- set_env · method · L8012-L8094 — def set_env( self, root_frame_id: str, env_name: str, project_id: str = "default" ) -> dict
- _apply_pending_env · method · L8096-L8145 — def _apply_pending_env(self, st: SessionState, emit) -> None
- standard_profile_readiness · method · L8147-L8152 — def standard_profile_readiness(self) -> dict[str, object]
- _readiness_failure_message · method · L8155-L8158 — def _readiness_failure_message(readiness: dict[str, object]) -> str
- require_standard_profile_readiness · method · L8160-L8175 — def require_standard_profile_readiness(self) -> dict[str, object]
- submit_message · method · L8177-L8471 — def submit_message( self, root_frame_id: str, project_id: str, user_text: str, model: str | None = None, plan: bool = False, annos: list | None = None, explore: bool = False, task_mode: str | None = None, on_admitted: Callable[[MessageJob], None] | None = None, ) -> MessageJob
- _target · function · L8278-L8442 — def _target() -> None: # The scope wraps the handlers as well as the call: the note exists # so the
except below can amend the row run_message already # wrote, and a context manager closing as the exception unwinds # would take it away a moment before that handler runs.
- reconcile_admission · method · L8473-L8534 — def reconcile_admission( self, root_frame_id: str, reservation_id: str ) -> dict | None
- submit_review · method · L8536-L8537 — def submit_review(self, root_frame_id: str, project_id: str) -> MessageJob
- _snapshot · method · L8540-L8541 — def _snapshot(self, ws: Path) -> WorkspaceSnapshot
- _register_file · method · L8543-L8557 — def _register_file( self, st: SessionState, path: Path, cell_id: str, emit, env_snapshot_id: str | None = None, ) -> dict | None
- _bind_notebook_lineage · method · L8559-L8581 — def _bind_notebook_lineage( self, st: SessionState, request: CellRequest, before: WorkspaceSnapshot, capture: CaptureResult, cell_id: str, ) -> list[str]
- _capture · method · L8583-L8600 — def _capture( self, st: SessionState, cell_index: int, cell_id: str, before: WorkspaceSnapshot, emit, language: str = "python", ) -> tuple[list, list, list]
- _capture_artifacts · method · L8602-L8628 — def _capture_artifacts( self, st: SessionState, cell_index: int, cell_id: str, before: WorkspaceSnapshot, emit, language: str, artifact_receipts: list[dict[str, Any]] | None = None, ) -> CaptureResult
- _invoke_control_with_artifacts · method · L8630-L8653 — def _invoke_control_with_artifacts(self, st, call, emit, invoke)
- _invoke_control_with_artifacts_bound · method · L8655-L8681 — def _invoke_control_with_artifacts_bound(self, st, call, emit, invoke)
- _invoke_writing_control_with_artifacts_bound · method · L8683-L8806 — def _invoke_writing_control_with_artifacts_bound( self, st, emit, invoke, *, tool_name: str )
- capture_written_files · function · L8694-L8721 — def capture_written_files( receipts: tuple[Mapping[str, Any], ...] = (), ) -> CaptureResult
- commit_artifacts · function · L8723-L8753 — def commit_artifacts( receipts: tuple[dict[str, Any], ...], ) -> list[dict[str, Any]]
- _capture_env_snapshot · method · L8808-L8809 — def _capture_env_snapshot(self, st=None) -> str | None
- _remote_provenance_drain · method · L8812-L8816 — def _remote_provenance_drain(st)
- effective_api_key · method · L8819-L8832 — def effective_api_key(self) -> str
- _llm_cfg · method · L8834-L8871 — def _llm_cfg(self, st: "SessionState | None" = None)
- _apply_user_llm_key · method · L8873-L8930 — def _apply_user_llm_key(self, cfg, st: "SessionState | None")
- _pinned_llm_config · method · L8932-L9030 — def _pinned_llm_config(self, st: "SessionState | None")
- _friendly_error · method · L9033-L9134 — def _friendly_error( exc: Exception, safe: dict | None = None, *, language: str = "zh" ) -> str
- _auto_review_enabled · method · L9136-L9137 — def _auto_review_enabled(self, root_frame_id: str) -> bool
- _review_llm_cfg · method · L9139-L9140 — def _review_llm_cfg(self, st: SessionState)
- _branch_head_checkpoint · method · L9142-L9155 — def _branch_head_checkpoint(self, st: SessionState) -> str | None
- _review_artifact_excerpt · method · L9158-L9159 — def _review_artifact_excerpt(artifact: dict) -> str | None
- _run_reviewer · method · L9161-L9182 — def _run_reviewer( self, st: SessionState, emit, *, user_text: str, assistant_text: str, artifact_versions_before: dict[str, str | None], cell_count_before: int, step_count_before: int = 0, mode: str = "auto", ) -> dict | None
- review_call_inflight · method · L9184-L9185 — def review_call_inflight(self, root_frame_id: str) -> bool
- _summarize_title · method · L9187-L9188 — def _summarize_title(self, user_text: str, llm_cfg) -> str | None
- _spawn_title_summary · method · L9190-L9193 — def _spawn_title_summary( self, root_frame_id: str, user_text: str, llm_cfg, placeholder: str ) -> None
- _build_annotated_content · method · L9195-L9311 — def _build_annotated_content(self, st, text: str, annos: list)
- bind_model_revision · method · L9313-L9421 — def bind_model_revision(self, root_frame_id: str) -> dict
- _legacy_model_matches · method · L9423-L9443 — def _legacy_model_matches( self, root_frame_id: str, frame: dict, profiles: list[dict] ) -> tuple[str, list[dict]] | None
- rebind_model_revision · method · L9445-L9501 — def rebind_model_revision(self, root_frame_id: str) -> dict
- _active_profile · method · L9503-L9507 — def _active_profile(self, profiles: list[dict]) -> dict | None
- _bind_active_profile · method · L9509-L9546 — def _bind_active_profile(self, root_frame_id: str, profiles: list[dict]) -> dict
- _seal · function · L9528-L9534 — def _seal(items)
- _unusable_pin_error · method · L9549-L9570 — def _unusable_pin_error(source: str) -> GatewayError
- _profile_credential · method · L9572-L9575 — def _profile_credential(self, profile: dict, configuration: dict | None = None)
- _require_profile_credential · method · L9577-L9615 — def _require_profile_credential( self, profile: dict, *, follows_active: bool = True ) -> None
- freeze_model_binding · method · L9617-L9629 — def freeze_model_binding(self, root_frame_id: str) -> dict
- _deliver_final_answer · method · L9631-L9799 — def _deliver_final_answer( self, *, st: Any, emit: Callable[[dict], None], root_frame_id: str, project_id: str, execution_id: str, produced_artifacts: list, assistant_visible: list, final_text: str, delivered_at: int, language: str, already_streamed: bool = False, message_metadata: Mapping[str, Any] | None = None, publish: bool = True, ) -> dict
- run_message · method · L9801-L10921 — def run_message( self, root_frame_id: str, project_id: str, user_text: str, model: str | None = None, plan: bool = False, annos: list | None = None, explore: bool = False, frozen_binding: tuple[str, int] | None = None, task_mode: str | None = None, ) -> dict
- turn_emit · function · L10061-L10074 — def turn_emit(event: dict) -> None
- _close_cancelled_turn · method · L10923-L10966 — def _close_cancelled_turn( self, st: SessionState, emit: Callable[[dict], None], turn_identity: Mapping[str, object], user_text: str, ) -> dict[str, object]
- _resolve_mentions · method · L10968-L11007 — def _resolve_mentions(self, st: SessionState, text: str) -> tuple[str, list[dict]]
- _materialise_for_message · method · L11009-L11027 — def _materialise_for_message( self, st: SessionState, version_id: str, name: str ) -> dict
- _context_archive_metadata · method · L11029-L11084 — def _context_archive_metadata( self, st: SessionState, action_ledger: RuntimeActionLedger | None ) -> dict[str, Any]
- _archive_context_output · method · L11086-L11166 — def _archive_context_output( self, st: SessionState, content: Any, message: dict[str, Any], archive: dict[str, Any], ) -> dict[str, Any]
- _archive_compaction_record · method · L11168-L11230 — def _archive_compaction_record( self, st: SessionState, payload: dict[str, Any], action_ledger: RuntimeActionLedger | None = None, ) -> str
- _loop · method · L11232-L11491 — def _loop( self, st: SessionState, emit, assistant_visible: list[dict], *, action_ledger: RuntimeActionLedger | None = None, llm_cfg=None, ) -> str
- add_usage · function · L11249-L11258 — def add_usage(usage: dict) -> None
- account_abandoned_reply · function · L11260-L11267 — def account_abandoned_reply(reply: Mapping[str, Any]) -> None
- apply_pending · function · L11288-L11290 — def apply_pending() -> None
- execute_cell · function · L11292-L11339 — def execute_cell(action) -> dict
- finalize_plan · function · L11341-L11345 — def finalize_plan(reply, prose: str) -> None
- _llm_quota_gate · function · L11364-L11365 — def _llm_quota_gate() -> None
- _auto_budget_chat · function · L11367-L11382 — def _auto_budget_chat(messages, cfg, **kwargs): # auto_budget sink: model inference admission before provider call. # The identity was pinned by ChatModel on the owning thread; this # runs on the detached provider thread, where the live one may # already be the next turn's.
- _telemetry_turn · method · L11493-L11514 — def _telemetry_turn(self, st: SessionState, result: Any) -> None
- _execute_with_watchdog · method · L11516-L11607 — def _execute_with_watchdog( self, st: SessionState, code: str, origin: str, on_chunk, language: str = "python", lease: KernelLease | None = None, cell_id: str | None = None, action_group_id: str | None = None, ) -> dict
- permission_pending · function · L11538-L11541 — def permission_pending() -> bool
- run_cell · function · L11564-L11587 — def run_cell(kernel)
- _safety_refusal · method · L11609-L11665 — def _safety_refusal(self, st: Any, code: str, origin: str) -> str | None
- _capture_cursor_checkpoint_best_effort · method · L11667-L11701 — def _capture_cursor_checkpoint_best_effort( self, root_frame_id: str, *, source_kind: str, source_id: str, branch_id: str | None = None, ) -> dict | None
- _record_cell_with_cursor_checkpoint · method · L11703-L11737 — def _record_cell_with_cursor_checkpoint(self, **record: Any) -> str
- _allocate_cell_attempt · method · L11739-L11781 — def _allocate_cell_attempt( self, st: SessionState, request: CellRequest, cell_id: str, action_group_id: str | None, ) -> str
- _bind_cell_attempt_generation · method · L11783-L11791 — def _bind_cell_attempt_generation( self, attempt_id: str, st: SessionState, language: str ) -> None
- _execute_and_log · method · L11793-L11836 — def _execute_and_log( self, st: SessionState, code: str, origin: str, emit, stream: bool = True, language: str = "python", action_group_id: str | None = None, ) -> dict
- _emit_artifact_step · method · L11838-L11905 — def _emit_artifact_step( self, st: SessionState, title: str, saved: list[dict], emit, environment: str | None = None, language: str | None = None, ) -> None
- _finalize_plan · method · L11908-L11917 — def _finalize_plan(self, st: SessionState, reply: str, prose: str, emit) -> None
- _write_plan_artifact · method · L11919-L11922 — def _write_plan_artifact( self, st: SessionState, plan: dict, artifact_id: str | None, emit ) -> dict | None
- _emit_plan_ready · method · L11924-L11925 — def _emit_plan_ready(self, emit, rid: str, plan: dict | None) -> None
- get_plan_state · method · L11927-L11928 — def get_plan_state(self, root_frame_id: str) -> dict
- discard_plan · method · L11930-L11931 — def discard_plan(self, root_frame_id: str) -> dict
- _plan_exec_seed · method · L11933-L11934 — def _plan_exec_seed(self, plan: dict) -> str
- run_plan_execution · method · L11936-L11951 — def run_plan_execution( self, root_frame_id: str, project_id: str, model: str | None = None, *, claimed_plan_id: str | None = None, ) -> dict: # Executable plans are the scientific workflow surface: unlike an # ordinary turn, their contract requires Cells, deliverables and a # structured submission. Refuse before a draft can be stranded in the # executing state.
- run_plan_revision · method · L11953-L11960 — def run_plan_revision( self, root_frame_id: str, project_id: str, changes: str, model: str | None = None, ) -> dict
- submit_plan_approval · method · L11962-L11990 — def submit_plan_approval( self, root_frame_id: str, project_id: str, model: str | None = None, *, claimed_plan_id: str | None = None, ) -> "MessageJob"
- claim_plan_approval · method · L11992-L11994 — def claim_plan_approval(self, root_frame_id: str) -> dict
- claim_plan_resume · method · L11996-L11998 — def claim_plan_resume(self, root_frame_id: str) -> dict
- run_plan_resume · method · L12000-L12011 — def run_plan_resume( self, root_frame_id: str, project_id: str, model: str | None = None, *, claimed_plan_id: str | None = None, ) -> dict
- submit_plan_resume · method · L12013-L12032 — def submit_plan_resume( self, root_frame_id: str, project_id: str, model: str | None = None, *, claimed_plan_id: str | None = None, ) -> "MessageJob"
- submit_plan_revision · method · L12034-L12048 — def submit_plan_revision( self, root_frame_id: str, project_id: str, changes: str, model: str | None = None, ) -> "MessageJob"
- _settle_claimed_plan · method · L12050-L12093 — def _settle_claimed_plan( self, root_frame_id: str, plan_id: str | None, status: str ) -> None
- _best_effort · method · L12096-L12109 — def _best_effort(step: str, action) -> None
- _terminal_failure_event · method · L12111-L12129 — def _terminal_failure_event(self, root_frame_id: str, job: "MessageJob") -> dict
- _remember_terminal_failure · method · L12131-L12148 — def _remember_terminal_failure( self, request_id: str, branch_id: str, message_id: str | None, identity: dict, ) -> None
- _take_terminal_failure · method · L12150-L12169 — def _take_terminal_failure(self, job_id: str, request_id: str) -> dict | None
- _bind_execution_to_turn · method · L12171-L12186 — def _bind_execution_to_turn(self, execution_id: str) -> None
- _enter_turn_scope · method · L12188-L12190 — def _enter_turn_scope(self, job_id: str) -> None
- _exit_turn_scope · method · L12192-L12203 — def _exit_turn_scope(self, job_id: str) -> None
- _persist_outer_failure · method · L12205-L12233 — def _persist_outer_failure( self, root_frame_id: str, job: "MessageJob", message: str ) -> None
- _persist_outer_failure_inner · method · L12235-L12272 — def _persist_outer_failure_inner( self, root_frame_id: str, job: "MessageJob", message: str ) -> None
- _abort_unstarted_job · method · L12280-L12322 — def _abort_unstarted_job( self, job, ticket, error, *, claimed_plan_id=None, rollback_status=None ) -> None
- _spawn_job · method · L12324-L12511 — def _spawn_job( self, root_frame_id: str, fn, *, project_id: str = "default", reason: str = "plan turn", claimed_plan_id: str | None = None, cancelled_plan_status: str = "paused", claimed_from_status: str | None = None, ) -> "MessageJob"
- _target · function · L12378-L12486 — def _target() -> None
- run_repl · method · L12513-L12620 — def run_repl( self, root_frame_id: str, project_id: str, code: str, language: str = "python", execution_id: str | None = None, ) -> dict
- emit_notebook · function · L12541-L12543 — def emit_notebook(event: dict) -> None
- submit_repl · method · L12622-L12701 — def submit_repl( self, root_frame_id: str, project_id: str, code: str, *, language: str = "python", execution_id: str | None = None, ) -> MessageJob
- target · function · L12659-L12688 — def target() -> None
- _memory_enabled · function · L12793-L12794 — def _memory_enabled(store) -> bool
- _memory_scope · function · L12797-L12827 — def _memory_scope(store, raw: Any) -> str
- _skill_slug · function · L12831-L12832 — def _skill_slug(name: str) -> str
- _parse_skill_md · function · L12835-L12836 — def _parse_skill_md(content: str) -> tuple[dict, str]
- _write_user_skill · function · L12839-L12847 — def _write_user_skill( loader, name: str, description: str, body: str, existing: bool = False ) -> dict
- _read_user_skill · function · L12850-L12851 — def _read_user_skill(loader, name: str) -> dict
- _delete_user_skill · function · L12854-L12855 — def _delete_user_skill(loader, name: str) -> dict
- _connector_launch_config · function · L12858-L12878 — def _connector_launch_config(cfg: Config, store, connector: dict) -> dict
- _detect_gpu · function · L12881-L12888 — def _detect_gpu() -> dict
- _ssh_config_aliases · function · L12894-L12911 — def _ssh_config_aliases() -> list[str]
- _probe_remote_gpu · function · L12914-L12942 — def _probe_remote_gpu(alias: str) -> dict
- _remote_compute_info · function · L12945-L12986 — def _remote_compute_info() -> dict
- _host_info · function · L12989-L13010 — def _host_info() -> dict
- _environment_snapshot · function · L13013-L13039 — def _environment_snapshot() -> dict
- make_handler · function · L13074-L19512 — def make_handler(cfg: Config, hub: WSHub, runner: SessionRunner)
- _disconnect_managed_datapro_session · function · L13111-L13119 — def _disconnect_managed_datapro_session() -> None
- _disconnect_datapro_if_credential_changed · function · L13121-L13125 — def _disconnect_datapro_if_credential_changed(previous: str) -> None
- _disconnect_datapro_if_auth_context_changed · function · L13127-L13141 — def _disconnect_datapro_if_auth_context_changed( previous_credential: str, previous_provider: str ) -> None
- _save_shared_agent_plan_key · function · L13143-L13193 — def _save_shared_agent_plan_key(value: Any) -> None
- _project_skill_customization · function · L13195-L13203 — def _project_skill_customization(project_id: str) -> SkillCustomizationService
- _datapro_config_payload · function · L13205-L13213 — def _datapro_config_payload() -> dict[str, Any]
- _doubao_search_config_payload · function · L13215-L13226 — def _doubao_search_config_payload() -> dict[str, Any]: # Lazy by design: the direct stdlib client is an owning service, while # this compatibility facade only projects its public configuration.
- _volcengine_connection_payload · function · L13228-L13266 — def _volcengine_connection_payload(*, force: bool = False) -> dict[str, Any]
- _raise_volcengine_error · function · L13268-L13293 — def _raise_volcengine_error(error: ArkCliError) -> None
- _configure_volcengine · function · L13295-L13301 — def _configure_volcengine( plan_key: Any = None, key_choice: Any = None, endpoint_choice: Any = None, ) -> dict[str, Any]
- _configure_volcengine_locked · function · L13303-L13363 — def _configure_volcengine_locked( plan_key: Any = None, key_choice: Any = None, endpoint_choice: Any = None, ) -> dict[str, Any]
- _skill_history_payload · function · L13365-L13374 — def _skill_history_payload( service: SkillCustomizationService, name: str, *, limit: int, ) -> dict
- _require_canonical_session_root · function · L13376-L13400 — def _require_canonical_session_root(frame_id: str) -> dict
- _require_session_writable · function · L13402-L13420 — def _require_session_writable(root_frame_id: str, operation: str) -> None
- _app_origins · function · L13541-L13554 — def _app_origins() -> tuple[str, ...]
- _default_security · function · L13556-L13565 — def _default_security() -> dict[str, str]
- Handler · class · L13572-L19503 — class Handler(BaseHTTPRequestHandler)
- log_message · method · L13576-L13577 — def log_message(self, *a): # quiet
- _send · method · L13580-L13615 — def _send( self, code: int, body: bytes, ctype: str, extra: dict | None = None, security: dict[str, str] | None = None, ) -> None
- _is_authenticated · method · L13617-L13634 — def _is_authenticated(self) -> bool
- _peer_is_loopback · method · L13637-L13641 — def _peer_is_loopback(self) -> bool
- _team_identity_from_request · method · L13643-L13676 — def _team_identity_from_request(self)
- _team_visibility_filter · method · L13678-L13684 — def _team_visibility_filter(self) -> str | None
- _team_owner_user_id · method · L13686-L13691 — def _team_owner_user_id(self) -> str | None
- _team_require_session_control · method · L13693-L13704 — def _team_require_session_control(self, root_frame_id: str) -> None
- _team_identity_dict · method · L13706-L13714 — def _team_identity_dict(self) -> dict | None
- _team_claim_imported · method · L13716-L13723 — def _team_claim_imported(self, imported: dict) -> None
- _team_audit_admin_private_read · method · L13725-L13746 — def _team_audit_admin_private_read(self, root: str) -> None
- _team_root_of_artifact_meta · method · L13748-L13780 — def _team_root_of_artifact_meta(self, meta: dict | None) -> str | None
- _team_guard_served_artifact · method · L13782-L13804 — def _team_guard_served_artifact(self, meta: dict | None) -> None
- _team_filter_artifacts · method · L13806-L13825 — def _team_filter_artifacts(self, artifacts: list[dict]) -> list[dict]
- _team_guard_memory_scope · method · L13827-L13843 — def _team_guard_memory_scope(self, scope: str | None) -> None
- _team_guard_share · method · L13845-L13881 — def _team_guard_share(self, method: str, sub: str) -> None
- _team_guard_instance_config · method · L13883-L13911 — def _team_guard_instance_config(self, method: str, sub: str) -> None
- _team_guard_project · method · L13913-L13936 — def _team_guard_project(self, method: str, sub: str) -> None
- _team_scope_guard · method · L13938-L14019 — def _team_scope_guard(self, method: str, sub: str) -> None
- _team_guard_owned_resource · method · L14021-L14080 — def _team_guard_owned_resource(self, method: str, sub: str) -> None
- _team_admit · method · L14082-L14114 — def _team_admit(self, method: str, path: str) -> bool
- _json · method · L14116-L14128 — def _json(self, obj, code: int = 200) -> None: # Every error response carries a stable
code and the request's # correlation id, enriched at this one chokepoint rather than at # ~29 call sites so a new route cannot forget. The rule itself # lives in errors.py so the contract capture can apply the same # one: enriching only here is what let the frozen artifacts record # a body the server does not send.
- _content_length · method · L14130-L14151 — def _content_length(self) -> int
- _read_request_body · method · L14153-L14188 — def _read_request_body( self, *, limit: int, required: bool = False, required_message: str = "request body is required", too_large_message: str = "request body is too large", ) -> bytes
- _prepare_request_body · method · L14190-L14209 — def _prepare_request_body(self, path: str, method: str) -> None
- _body · method · L14211-L14243 — def _body(self) -> dict
- _body_bytes · method · L14245-L14251 — def _body_bytes(self, *, limit: int) -> bytes
- _close_on_unread_request_body · method · L14253-L14270 — def _close_on_unread_request_body(self) -> None
- _query · method · L14272-L14273 — def _query(self) -> dict
- do_GET · method · L14276-L14277 — def do_GET(self)
- do_POST · method · L14279-L14280 — def do_POST(self)
- do_PUT · method · L14282-L14283 — def do_PUT(self)
- do_PATCH · method · L14285-L14286 — def do_PATCH(self)
- do_DELETE · method · L14288-L14289 — def do_DELETE(self)
- _split_host_header · method · L14292-L14327 — def _split_host_header(raw: str)
- _host_header_allowed · method · L14329-L14350 — def _host_header_allowed(self) -> bool: # Wildcard bind (0.0.0.0/::): the set of valid external Host names is # unknowable, so the token gate — always required on a non-loopback # bind — is the authoritative control and we don't second-guess Host.
- _route · method · L14352-L14679 — def _route(self, method: str) -> None
- _serve_index · method · L14682-L14692 — def _serve_index(self) -> None
- _serve_static · method · L14694-L14720 — def _serve_static(self, path: str) -> bool
- _send_static_bytes · method · L14722-L14759 — def _send_static_bytes( self, code: int, body: bytes, ctype: str, extra: dict | None, security: dict[str, str] | None, ) -> None
- _serve_ui_file · method · L14761-L14815 — def _serve_ui_file( self, path: Path, ctype: str, extra: dict | None = None, security: dict[str, str] | None = None, ) -> None
- _serve_file · method · L14817-L14829 — def _serve_file( self, path: Path, ctype: str, extra: dict | None = None, security: dict[str, str] | None = None, ) -> None
- _stream_file · method · L14831-L14900 — def _stream_file( self, path: Path, ctype: str, extra: dict | None = None, security: dict[str, str] | None = None, ) -> None
- _serve_sandbox_grant · method · L14903-L14989 — def _serve_sandbox_grant(self, path: str) -> None
- _presents_session_cookie · method · L14991-L15009 — def _presents_session_cookie(self) -> bool
- _referring_preview_frame · method · L15011-L15047 — def _referring_preview_frame(self) -> str | None
- _serve_artifact · method · L15049-L15169 — def _serve_artifact(self, ident: str, force_html: bool = False) -> None: # Artifact bytes are user/agent-authored and may be navigated to as # a top-level document, outside the Workbench iframe's sandbox. # Use an embeddable but inactive response profile instead of the UI # shell's frame denial. The policy sandbox gives the document an # opaque origin even when someone navigates to it directly. Built # only on the two paths that actually send bytes; the 404 exits # below have no use for it. # Canonical trusted-delivery URLs live below the reserved #
versions/ sub-path. They must resolve one exact version or # 404; the compatible Artifact-id/filename fallbacks below are # deliberately unreachable from this branch.
- _serve_artifact_bundle · method · L15171-L15220 — def _serve_artifact_bundle(self, artifacts: list[dict], filename: str) -> None
- _api · method · L15223-L19069 — def _api(self, method: str, sub: str) -> None
- _persist_correlation · function · L16510-L16533 — def _persist_correlation(started_job) -> None
- _models_payload · method · L19072-L19073 — def _models_payload(self) -> dict
- _mask_profile · method · L19075-L19076 — def _mask_profile(self, p: dict) -> dict
- _model_profiles_payload · method · L19078-L19085 — def _model_profiles_payload(self) -> dict: #
profiles_payload returns (payload, None) unconditionally, so # the branch that used to live here never ran. It was the intended # repair for the drift above, which is now fixed where the drift # started -- at the seed -- rather than by a later route happening # to be visited. Keeping a dead correction reads as coverage.
- _skills_catalog · method · L19087-L19088 — def _skills_catalog(self, disabled: set[str]) -> list[dict]
- _agents_payload · method · L19090-L19127 — def _agents_payload(self) -> list[dict]
- _connectors_payload · method · L19129-L19154 — def _connectors_payload(self, store) -> list[dict]: # Cheap: return stored connectors (no probe — probing spawns a # process; the UI probes on demand). Mark the argv for display. # # Projected, never spread: a connector's
env holds the credentials # its MCP server is launched with, and {**c} handed every one of # them to the browser.
- _compute_providers · method · L19156-L19172 — def _compute_providers(self) -> list[dict]
- _environments_status · method · L19174-L19196 — def _environments_status(self) -> dict
- _exec_log · method · L19198-L19202 — def _exec_log(self, root_frame_id: str) -> dict
- _lineage · method · L19204-L19205 — def _lineage(self, artifact_id: str, version_id: str | None = None) -> dict
- _edit_artifact · method · L19207-L19222 — def _edit_artifact(self, artifact_id: str, content: str) -> dict
- _restore_version · method · L19224-L19230 — def _restore_version(self, artifact_id: str, version_id: str) -> dict
- _rename_artifact · method · L19232-L19247 — def _rename_artifact(self, artifact_id: str, filename: str | None) -> dict
- _upload · method · L19249-L19285 — def _upload(self, b: dict) -> dict
- _delete_artifact · method · L19287-L19301 — def _delete_artifact(self, artifact_id: str) -> dict
- _handle_ws · method · L19304-L19503 — def _handle_ws(self) -> None
- _ws_user_now · function · L19332-L19337 — def _ws_user_now() -> dict | None
- _ws_session_visible · function · L19339-L19355 — def _ws_session_visible(rid: str) -> bool
- _frame_json · function · L19518-L19538 — def _frame_json(f: dict | None, store: Store) -> dict
- _project_json · function · L19541-L19555 — def _project_json(p: dict) -> dict
- _completion_separator · function · L19558-L19568 — def _completion_separator(assistant_visible: list) -> str
- _message_failure · function · L19571-L19605 — def _message_failure(message: dict) -> dict | None
- _message_cancelled · function · L19608-L19634 — def _message_cancelled(message: dict) -> dict | None
- _message_review_gate · function · L19637-L19660 — def _message_review_gate(message: dict) -> dict | None
- _message_candidate_identity · function · L19663-L19681 — def _message_candidate_identity(message: dict) -> dict
- _message_artifact_refs · function · L19684-L19727 — def _message_artifact_refs(message: dict) -> list[dict]
- _artifact_json · function · L19730-L19746 — def _artifact_json(a: dict) -> dict
- _note_json · function · L19749-L19756 — def _note_json(n: dict) -> dict
- _annotation_json · function · L19759-L19784 — def _annotation_json(a: dict | None) -> dict | None
- _sniff_image_mime · function · L19800-L19812 — def _sniff_image_mime(raw: bytes) -> str | None
- _pinned_image_bytes · function · L19815-L19865 — def _pinned_image_bytes(store, pins: list) -> tuple[bytes | None, dict | None]
- _figure_with_pins · function · L19868-L19896 — def _figure_with_pins(raw: bytes, pins: list) -> tuple[str | None, str]
- _format_annotations_block · function · L19899-L19953 — def _format_annotations_block(annos: list) -> str
- _zone · function · L19918-L19921 — def _zone(x: float, y: float) -> str
- _GatewayHTTPServer · class · L19959-L20003 — class _GatewayHTTPServer(ThreadingHTTPServer)
- init · method · L19972-L19974 — def init(self, args, runner: SessionRunner, *kwargs) -> None
- handle_error · method · L19976-L19979 — def handle_error(self, request, client_address) -> None
- server_close · method · L19981-L20003 — def server_close(self) -> None
- build_app_server · function · L20006-L20191 — def build_app_server(cfg: Config | None = None) -> ThreadingHTTPServer
- _demo_seed_enabled · function · L20194-L20215 — def _demo_seed_enabled() -> bool
- _ExampleSeedState · class · L20218-L20268 — class _ExampleSeedState
- init · method · L20228-L20231 — def init(self) -> None
- running · method · L20233-L20235 — def running(self) -> bool
- last_error · method · L20237-L20239 — def last_error(self) -> str | None
- start · method · L20241-L20268 — def start(self, cfg: Config, runner: "SessionRunner") -> bool
- _run · function · L20254-L20260 — def _run() -> None
- _example_session_frame · function · L20271-L20283 — def _example_session_frame(cfg: Config) -> dict[str, Any] | None
- run_server · function · L20286-L20322 — def run_server(httpd: ThreadingHTTPServer) -> None
- serve_app · function · L20325-L20332 — def serve_app(cfg: Config | None = None, *, block: bool = True) -> ThreadingHTTPServer
- _migrate_legacy_provider · function · L20335-L20345 — def _migrate_legacy_provider(cfg: Config) -> None
- _seed_example_project · function · L20348-L20357 — def _seed_example_project(cfg: Config) -> None
- _seed_example_connector · function · L20360-L20380 — def _seed_example_connector(cfg: Config) -> None
- _migrate_builtin_connector_commands · function · L20383-L20424 — def _migrate_builtin_connector_commands(cfg: Config) -> None
- _seed_datapro_connector · function · L20427-L20447 — def _seed_datapro_connector(cfg: Config) -> None
- _retire_demo_frame · function · L20705-L20710 — def _retire_demo_frame(runner: "SessionRunner", frame_id: str) -> None
- _seed_demo_session · function · L20713-L20916 — def _seed_demo_session(cfg: Config, runner: "SessionRunner") -> None