export const state = {
  token: "",
  tokenTtlS: 300,
  tokenIssuedAt: 0,
  tokenRefreshPath: "/webui/refresh-token",
  tokenRefreshTimer: null,
  tokenRefreshPromise: null,
  wsPath: "/ws",
  sessionsPath: "/api/sessions",
  workspaceFilesPath: "/api/workspace/files",
  skillsApiPath: "/api/skills",
  knowledgeApiPath: "/v1/knowledge",
  coworkApiPath: "/api/cowork",
  socket: null,
  activeChatId: "",
  activeSessionKey: "",
  messages: new Map(),
  sessionItems: [],
  respondingSessionKeys: new Set(),
  sessionFiles: new Map(),
  streamBuffers: new Map(),
  editableFiles: [],
  activeFilePath: "",
  activeFileUpdatedAt: null,
  fileDraftDirty: false,
  tools: [],
  skills: [],
  knowledgeDocs: [],
  knowledgeStats: null,
  knowledgeGraph: null,
  knowledgeGraphView: { scale: 1, x: 0, y: 0 },
  knowledgeGraphRuntime: null,
  knowledgeGraphLevel: 0,
  knowledgeGraphFilterDocId: "",
  knowledgeGraphFilterDocName: "",
  knowledgeGraphHighlight: null,
  knowledgeGraphSelection: null,
  configBaseline: null,
  activeKnowledgeTab: "overview",
  knowledgeWorkbenchReady: false,
  knowledgeIndexing: false,
  knowledgeRebuilding: false,
  activeKnowledgeJobId: "",
  knowledgeJobPollTimer: null,
  config: null,
  helpOverlay: null,
  activeTourIndex: 0,
  pendingMessage: null,  // 待发送的消息（创建新会话后发送）
  activeSkill: null,  // 当前编辑的 skill
  skillMode: "view",  // view, edit, create
  activeDoc: null,  // 当前查看的文档
  theme: "light",  // 当前主题
  contextWindowTokens: 65536,  // 默认上下文窗口大小
  lastUsage: null,  // 最后一次的usage数据
  browserFrame: null,
  agentUi: null,
  browserPanelCollapsed: false,
  inspectionOpen: false,
  selectedChainItemKey: "",
  selectedChainItem: null,
  selectedMemoryReferenceKey: "",
  selectedMemoryReference: null,
  expandedRunChains: new Set(),
  sidebarCollapsed: localStorage.getItem("tinybot-sidebar-collapsed") === "true",
  uiMode: localStorage.getItem("tinybot-ui-mode") || "basic",
  modelDiscoveryTimer: null,
  pendingApprovals: [],
  approvalsLoading: false,
  coworkSessions: [],
  activeCoworkSession: null,
  activeCoworkSessionId: "",
  activeCoworkThreadId: "",
  activeCoworkGraphNode: "",
  activeCoworkSelection: { type: "", id: "" },
  coworkTraceFilter: "all",
  coworkTraceMode: "key",
  coworkSecondaryTab: "tasks",
  coworkConsoleFilter: "",
  coworkWorkUnitSearch: "",
  coworkGraphCollapsed: false,
  coworkPendingAction: "",
  coworkGraphSuppressClick: "",
  coworkGraphIgnoreStageClick: false,
  coworkGraphNodePositions: new Map(),
  coworkGraphView: { scale: 1, x: 0, y: 0 },
  coworkGraphDrag: null,
  coworkLoading: false,
  coworkRefreshTimer: null,
};
