[hAIk]: Holy fucking shit the agent finally works in the frontend: align frontend/backend naming: rename AgentSession.id→session_id across agentsTypes, agentsReducers, agentsExtraReducers, AgentCard, BrowserAgentOverlay, DashboardCanvas, useAgentChat, useToolbarActions, useDashboardKeyboard, MessageActions, and backend-bridge agents/dashboards; rename CardPosition.zOrder→z_order in dashboardLayoutTypes, dashboardLayoutReducers, dashboardLayoutSlice, and DashboardCanvas; fix circular import between dashboards.py and agents.py by deferring imports; add NINE_ROUTER_MODEL_MAP for sonnet/opus/haiku alias resolution in launch_agent; make build_agent_toolkit async and pass load_dashboard/save_dashboard into browser delegation toolkit; fix PromptMsgDict to use TypedDict, fix zip type hint bug, and fix browser agent model reference (parent.model→parent.config.model); add p_on_task_done callback with traceback logging on Agent, capture stderr and full tracebacks in run_agent_loop; add unwrages helper in agentsExtraReducers to normalize nested message payloads; pipe frontend console-message events to Electron stdout; enable ws:true on Vite proxy; add diagnostic console.logs across WS handlers, session lifecycle, and dashboard updates

This commit is contained in:
haikdc
2026-04-18 10:26:51 -07:00
parent 563af6ff80
commit f98c56ab7e
30 changed files with 281 additions and 141 deletions
@@ -1,6 +1,6 @@
# Message.py
from typing import List, Literal, Dict, Annotated, Union
from typing import List, Literal, Annotated, Union, TypedDict
from pydantic import BaseModel, Field
from datetime import datetime
from uuid import uuid4
@@ -23,13 +23,13 @@ class Message(BaseModel):
hidden: bool = False
PromptMsgDict = Dict[
Literal["type", "message"],
Dict[
Literal["role", "content"],
List[PromptBlock]
]
]
class PromptMessageContent(TypedDict):
role: str
content: List[PromptBlock]
class PromptMsgDict(TypedDict):
type: str
message: PromptMessageContent
class UserMessage(Message):
role: Literal["user"] = "user"
@@ -51,7 +51,7 @@ class UserMessage(Message):
full_text: str = "\n\n".join(p for p in parts if p)
blocks: List[PromptBlock] = [TextPromptBlock(type="text", text=full_text)]
for data, media_type in zip[tuple[str, str]](self.images, self.image_media_types):
for data, media_type in zip(self.images, self.image_media_types):
blocks.append(ImagePromptBlock(
type="image",
source=ImageSource(type="base64", media_type=media_type, data=data),