agent-zero/plugins/_time_travel/api/history_workspaces.py
frdel 77f7aa0274 Time Travel workspace selector + LiteLLM globals
Add selectable workspace support to the Time Travel plugin and introduce normalized global LiteLLM configuration handling.

models.py: add DEFAULT_LITELLM_GLOBAL_KWARGS and helpers to normalize, load, apply, and merge LiteLLM global kwargs; call configure_litellm/set per-call merges in LiteLLM wrappers so framework defaults, configured globals, and per-call overrides combine correctly. Add tests to assert merging and runtime application.

plugins/_time_travel: update docs and plugin metadata to describe workdir/project selection. API handlers now accept workspace_id and a new history_workspaces endpoint lists selectable workspaces. helpers/time_travel: implement workspace listing, selection, and resolution logic (workdir/project options, availability/locking, default selection). UI: add workspace picker to time-travel panel, wire selection/load into time-travel store, pass workspace_id to API calls, and add click hook to open the panel. Update styles and refresh/load behavior accordingly.

Tests: extend tests for LiteLLM global kwargs merging and adapt stream test to expect merged params; add tests for selectable workspaces, default selection, and locked external workdir handling.
2026-06-09 17:16:41 +02:00

11 lines
475 B
Python

from __future__ import annotations
from helpers.api import ApiHandler, Request, Response
from plugins._time_travel.helpers.time_travel import list_selectable_workspaces
class HistoryWorkspaces(ApiHandler):
async def process(self, input: dict, request: Request) -> dict | Response:
context_id = str(input.get("context_id") or "").strip()
data = list_selectable_workspaces(context_id, context_loader=self.use_context)
return {"ok": True, **data}