From b0f84670f2b4b582063600a0bbfc49e942e805f6 Mon Sep 17 00:00:00 2001 From: Christian Gick Date: Mon, 2 Mar 2026 13:30:48 +0200 Subject: [PATCH] fix: video track kind detection and Confluence page creation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Video track kind is 2 (not 0) in LiveKit Python SDK — camera was never captured - Replace broken confluence_collab.create_page import with direct REST API call Co-Authored-By: Claude Opus 4.6 --- voice.py | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/voice.py b/voice.py index a3d77f9..8ca2a15 100644 --- a/voice.py +++ b/voice.py @@ -373,18 +373,32 @@ async def _confluence_update_section(page_id: str, section_heading: str, new_htm async def _confluence_create_page(space_key: str, title: str, body_html: str, parent_id: str | None = None) -> dict: - """Create a new Confluence page. Returns {id, title, url}.""" + """Create a new Confluence page via REST API. Returns {id, title, url}.""" if not CONFLUENCE_URL or not CONFLUENCE_USER or not CONFLUENCE_TOKEN: raise RuntimeError("Confluence credentials not configured") - from confluence_collab.client import Auth, create_page - auth = Auth(base_url=CONFLUENCE_URL, username=CONFLUENCE_USER, api_token=CONFLUENCE_TOKEN) - page = await create_page(space_key, title, body_html, auth, parent_id=parent_id) - return { - "id": page.page_id, - "title": page.title, - "url": f"{CONFLUENCE_URL}/pages/viewpage.action?pageId={page.page_id}", + payload: dict = { + "type": "page", + "title": title, + "space": {"key": space_key}, + "body": {"storage": {"value": body_html, "representation": "storage"}}, } + if parent_id: + payload["ancestors"] = [{"id": parent_id}] + + async with httpx.AsyncClient(timeout=15.0) as client: + resp = await client.post( + f"{CONFLUENCE_URL}/rest/api/content", + json=payload, + auth=(CONFLUENCE_USER, CONFLUENCE_TOKEN), + ) + resp.raise_for_status() + data = resp.json() + return { + "id": data["id"], + "title": data["title"], + "url": f"{CONFLUENCE_URL}/pages/viewpage.action?pageId={data['id']}", + } async def _confluence_recent_pages(limit: int = 5) -> list[dict]: @@ -649,7 +663,7 @@ class VoiceSession: # skips HKDF derivation → raw key stored → DEC_FAILED. # Solution: set caller key HERE, after frame cryptor is initialized. # Store video track for on-demand vision (look_at_screen tool) - if int(t.kind) == 0: # video track + if int(t.kind) == 2: # video track (LiveKit: 1=audio, 2=video) self._video_track = t logger.info("Video track stored from %s for on-demand vision", p.identity) if int(t.kind) == 1 and e2ee_opts is not None: # audio track only