feat(ext): expose ext meta data to main world

This commit is contained in:
Simon
2026-02-03 16:39:24 +08:00
parent 1a0422f99d
commit 648a0c1bda
5 changed files with 8 additions and 5 deletions

2
package-lock.json generated
View File

@@ -11060,7 +11060,7 @@
},
"packages/extension": {
"name": "@page-agent/ext",
"version": "0.1.0",
"version": "0.1.1",
"hasInstallScript": true,
"dependencies": {
"@page-agent/core": "1.1.0",

View File

@@ -1,7 +1,7 @@
{
"name": "@page-agent/ext",
"private": true,
"version": "0.1.0",
"version": "0.1.1",
"type": "module",
"scripts": {
"dev": "wxt",

View File

@@ -23,6 +23,10 @@ export default defineUnlistedScript(() => {
return _lastId
}
w.PAGE_AGENT_EXT_INSTALLED = true
w.PAGE_AGENT_EXT_VERSION = __EXT_VERSION__
w.PAGE_AGENT_EXT_CORE_VERSION = __CORE_VERSION__
w.execute = async (task: string, llmConfig: LLMConfig, hooks?: ExecuteHooks) => {
if (typeof task !== 'string') throw new Error('Task must be a string')
if (task.trim().length === 0) throw new Error('Task cannot be empty')

View File

@@ -7,9 +7,6 @@ import { DEMO_API_KEY, DEMO_BASE_URL, DEMO_MODEL } from '@/agent/constants'
import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input'
declare const __EXT_VERSION__: string
declare const __CORE_VERSION__: string
interface ConfigPanelProps {
config: LLMConfig | null
onSave: (config: LLMConfig) => Promise<void>

View File

@@ -0,0 +1,2 @@
declare const __EXT_VERSION__: string
declare const __CORE_VERSION__: string