feat(ext): expose extension to main-world and auth with token

This commit is contained in:
Simon
2026-01-28 19:47:15 +08:00
parent ff75aebc20
commit ef2d115742
7 changed files with 192 additions and 9 deletions

View File

@@ -5,9 +5,8 @@ import type { AgentActivity, AgentStatus, HistoricalEvent } from '@page-agent/co
import type { LLMConfig } from '@page-agent/llms'
import { useCallback, useEffect, useRef, useState } from 'react'
import { DEMO_API_KEY, DEMO_BASE_URL, DEMO_MODEL } from '@/agent/constants'
import { MultiPageAgent } from './MultiPageAgent'
import { DEMO_CONFIG } from './constants'
export interface UseAgentResult {
status: AgentStatus
@@ -20,12 +19,6 @@ export interface UseAgentResult {
configure: (config: LLMConfig) => Promise<void>
}
const DEMO_CONFIG: LLMConfig = {
apiKey: DEMO_API_KEY,
baseURL: DEMO_BASE_URL,
model: DEMO_MODEL,
}
export function useAgent(): UseAgentResult {
const agentRef = useRef<MultiPageAgent | null>(null)
const [status, setStatus] = useState<AgentStatus>('idle')