@tanzerfe/page-use 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +182 -0
- package/dist/index-DtJ3mvL2.d.mts +583 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +3 -0
- package/dist/src-C8EWDZVz.mjs +2693 -0
- package/dist/vue.d.mts +53 -0
- package/dist/vue.mjs +86 -0
- package/package.json +72 -0
package/dist/vue.d.mts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { $ as PageUsePreset, A as runPageUseTool, B as DEFAULT_MODEL, C as PageUseGlobal, D as PageUseCommand, E as PAGE_USE_TOOL_NAME, F as PageUseLauncherConfig, G as PageUseOptions, H as DEFAULT_STORAGE_KEY_PREFIX, I as PageUseLauncherElement, J as readLauncherSwitch, K as PageUseRouterMode, L as PageUseHandle, M as definePageUseElements, N as mountPageUseUI, O as formatPageUseResultForModel, P as PAGE_USE_LAUNCHER_TAG, Q as PageUseMenuNode, R as createPageUse, S as PAGE_USE_GLOBAL_KEY, T as PAGE_USE_TOOL, U as NormalizedPageUseOptions, V as DEFAULT_SESSION_HEADER, W as PageUseLLMOptions, X as pageUseCapability, Y as PageUseCapability, Z as PageUseErrorCode, _ as getPageUseConfig, a as PAGE_USE_STATIC_PRESETS, at as PageUseTaskSource, b as pageUseStore, c as pageUseHistory, d as PageUseSettings, et as PageUseProgressEvent, f as pageUseSettings, g as getElapsedSeconds, h as clearPageUseLog, i as PageUseGlowElement, it as PageUseTaskResult, j as MountPageUseUIOptions, k as isPageUseCommand, l as DEFAULT_PAGE_USE_SETTINGS, m as PageUseState, n as SIMULATOR_MASK_ID, nt as PageUseSnapshot, o as buildMenuPresets, ot as PageUseTaskStatus, p as PageUseQuestion, q as normalizeOptions, r as PAGE_USE_GLOW_TAG, rt as PageUseStepLog, s as PageUseHistoryEntry, t as PAGE_USE_MASK_COLORS, tt as PageUseRunOptions, u as PageUsePoint, v as isPageUseConfigured, w as PAGE_USE_COMMAND_TYPE, x as ReadonlyStore, y as isRunning, z as DEFAULT_MAX_STEPS } from "./index-DtJ3mvL2.mjs";
|
|
2
|
+
import { PropType, ShallowRef } from "vue";
|
|
3
|
+
import { Router } from "vue-router";
|
|
4
|
+
//#region src/vue.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* 由 vue-router 实例补齐路由相关选项(宿主显式传入的优先):
|
|
7
|
+
* - routerMode:createWebHashHistory 的 base 必含 '#'
|
|
8
|
+
* - getCurrentPath:取 currentRoute.fullPath,与路由模式无关
|
|
9
|
+
* - resolveRouteName:router.resolve(path).name
|
|
10
|
+
*/
|
|
11
|
+
export declare function withVueRouter(options: PageUseOptions, router: Router): PageUseOptions;
|
|
12
|
+
export declare const PageUseHost: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
13
|
+
/** 初始化选项;仅在挂载时读取一次,变更需重新挂载组件 */
|
|
14
|
+
options: {
|
|
15
|
+
type: PropType<PageUseOptions>;
|
|
16
|
+
required: true;
|
|
17
|
+
};
|
|
18
|
+
/** 调试面板:false 不挂载;true 或配置对象挂载 */
|
|
19
|
+
launcher: {
|
|
20
|
+
type: PropType<boolean | PageUseLauncherConfig>;
|
|
21
|
+
default: boolean;
|
|
22
|
+
};
|
|
23
|
+
/** 运行期定制光晕 */
|
|
24
|
+
glow: {
|
|
25
|
+
type: BooleanConstructor;
|
|
26
|
+
default: boolean;
|
|
27
|
+
};
|
|
28
|
+
}>, () => null, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
29
|
+
/** 初始化选项;仅在挂载时读取一次,变更需重新挂载组件 */
|
|
30
|
+
options: {
|
|
31
|
+
type: PropType<PageUseOptions>;
|
|
32
|
+
required: true;
|
|
33
|
+
};
|
|
34
|
+
/** 调试面板:false 不挂载;true 或配置对象挂载 */
|
|
35
|
+
launcher: {
|
|
36
|
+
type: PropType<boolean | PageUseLauncherConfig>;
|
|
37
|
+
default: boolean;
|
|
38
|
+
};
|
|
39
|
+
/** 运行期定制光晕 */
|
|
40
|
+
glow: {
|
|
41
|
+
type: BooleanConstructor;
|
|
42
|
+
default: boolean;
|
|
43
|
+
};
|
|
44
|
+
}>> & Readonly<{}>, {
|
|
45
|
+
launcher: boolean | PageUseLauncherConfig;
|
|
46
|
+
glow: boolean;
|
|
47
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
48
|
+
/** 执行状态的 Vue 响应式引用(整体替换,适合只读展示) */
|
|
49
|
+
export declare function usePageUseState(): Readonly<ShallowRef<PageUseState>>;
|
|
50
|
+
/** 本地设置的 Vue 响应式引用;修改请调用 pageUseSettings.update */
|
|
51
|
+
export declare function usePageUseSettings(): Readonly<ShallowRef<PageUseSettings>>;
|
|
52
|
+
//#endregion
|
|
53
|
+
export { DEFAULT_MAX_STEPS, DEFAULT_MODEL, DEFAULT_PAGE_USE_SETTINGS, DEFAULT_SESSION_HEADER, DEFAULT_STORAGE_KEY_PREFIX, type MountPageUseUIOptions, type NormalizedPageUseOptions, PAGE_USE_COMMAND_TYPE, PAGE_USE_GLOBAL_KEY, PAGE_USE_GLOW_TAG, PAGE_USE_LAUNCHER_TAG, PAGE_USE_MASK_COLORS, PAGE_USE_STATIC_PRESETS, PAGE_USE_TOOL, PAGE_USE_TOOL_NAME, type PageUseCapability, type PageUseCommand, type PageUseErrorCode, type PageUseGlobal, PageUseGlowElement, type PageUseHandle, type PageUseHistoryEntry, type PageUseLLMOptions, type PageUseLauncherConfig, PageUseLauncherElement, type PageUseMenuNode, type PageUseOptions, type PageUsePoint, type PageUsePreset, type PageUseProgressEvent, type PageUseQuestion, type PageUseRouterMode, type PageUseRunOptions, type PageUseSettings, type PageUseSnapshot, type PageUseState, type PageUseStepLog, type PageUseTaskResult, type PageUseTaskSource, type PageUseTaskStatus, type ReadonlyStore, SIMULATOR_MASK_ID, buildMenuPresets, clearPageUseLog, createPageUse, definePageUseElements, formatPageUseResultForModel, getElapsedSeconds, getPageUseConfig, isPageUseCommand, isPageUseConfigured, isRunning, mountPageUseUI, normalizeOptions, pageUseCapability, pageUseHistory, pageUseSettings, pageUseStore, readLauncherSwitch, runPageUseTool };
|
package/dist/vue.mjs
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { A as DEFAULT_MODEL, C as pageUseStore, D as SIMULATOR_MASK_ID, E as PAGE_USE_MASK_COLORS, M as DEFAULT_STORAGE_KEY_PREFIX, N as normalizeOptions, O as pageUseHistory, P as readLauncherSwitch, S as isRunning, T as pageUseSettings, _ as pageUseCapability, a as PAGE_USE_STATIC_PRESETS, b as getPageUseConfig, c as PageUseGlowElement, d as PAGE_USE_COMMAND_TYPE, f as PAGE_USE_TOOL, g as runPageUseTool, h as isPageUseCommand, i as PageUseLauncherElement, j as DEFAULT_SESSION_HEADER, k as DEFAULT_MAX_STEPS, l as createPageUse, m as formatPageUseResultForModel, n as mountPageUseUI, o as buildMenuPresets, p as PAGE_USE_TOOL_NAME, r as PAGE_USE_LAUNCHER_TAG, s as PAGE_USE_GLOW_TAG, t as definePageUseElements, u as PAGE_USE_GLOBAL_KEY, v as clearPageUseLog, w as DEFAULT_PAGE_USE_SETTINGS, x as isPageUseConfigured, y as getElapsedSeconds } from "./src-C8EWDZVz.mjs";
|
|
2
|
+
import { defineComponent, inject, onBeforeUnmount, onScopeDispose, shallowRef } from "vue";
|
|
3
|
+
import { routerKey } from "vue-router";
|
|
4
|
+
|
|
5
|
+
//#region src/vue.ts
|
|
6
|
+
/**
|
|
7
|
+
* @tanzerfe/page-use/vue:Vue 3 适配层。
|
|
8
|
+
* - PageUseHost:在组件生命周期内完成 createPageUse + mountPageUseUI,并从 vue-router 推导路由读取方式
|
|
9
|
+
* - usePageUseState:把框架无关的状态容器转为 Vue 响应式引用
|
|
10
|
+
* 本文件不使用 SFC,构建无需 Vue 插件;vue / vue-router 为可选 peer 依赖。
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* 由 vue-router 实例补齐路由相关选项(宿主显式传入的优先):
|
|
14
|
+
* - routerMode:createWebHashHistory 的 base 必含 '#'
|
|
15
|
+
* - getCurrentPath:取 currentRoute.fullPath,与路由模式无关
|
|
16
|
+
* - resolveRouteName:router.resolve(path).name
|
|
17
|
+
*/
|
|
18
|
+
function withVueRouter(options, router) {
|
|
19
|
+
return {
|
|
20
|
+
routerMode: router.options.history.base.includes("#") ? "hash" : "history",
|
|
21
|
+
getCurrentPath: () => router.currentRoute.value.fullPath,
|
|
22
|
+
resolveRouteName: (path) => {
|
|
23
|
+
try {
|
|
24
|
+
const name = router.resolve(path).name;
|
|
25
|
+
return name ? String(name) : void 0;
|
|
26
|
+
} catch {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
...options
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const PageUseHost = defineComponent({
|
|
34
|
+
name: "PageUseHost",
|
|
35
|
+
props: {
|
|
36
|
+
/** 初始化选项;仅在挂载时读取一次,变更需重新挂载组件 */
|
|
37
|
+
options: {
|
|
38
|
+
type: Object,
|
|
39
|
+
required: true
|
|
40
|
+
},
|
|
41
|
+
/** 调试面板:false 不挂载;true 或配置对象挂载 */
|
|
42
|
+
launcher: {
|
|
43
|
+
type: [Boolean, Object],
|
|
44
|
+
default: false
|
|
45
|
+
},
|
|
46
|
+
/** 运行期定制光晕 */
|
|
47
|
+
glow: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: true
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
setup(props) {
|
|
53
|
+
const router = inject(routerKey, null);
|
|
54
|
+
const handle = createPageUse(router ? withVueRouter(props.options, router) : props.options);
|
|
55
|
+
const unmountUI = mountPageUseUI({
|
|
56
|
+
launcher: props.launcher,
|
|
57
|
+
glow: props.glow
|
|
58
|
+
});
|
|
59
|
+
onBeforeUnmount(() => {
|
|
60
|
+
unmountUI();
|
|
61
|
+
handle.destroy();
|
|
62
|
+
});
|
|
63
|
+
return () => null;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
/** 执行状态的 Vue 响应式引用(整体替换,适合只读展示) */
|
|
67
|
+
function usePageUseState() {
|
|
68
|
+
const state = shallowRef(pageUseStore.get());
|
|
69
|
+
const off = pageUseStore.subscribe((next) => {
|
|
70
|
+
state.value = next;
|
|
71
|
+
});
|
|
72
|
+
onScopeDispose(off);
|
|
73
|
+
return state;
|
|
74
|
+
}
|
|
75
|
+
/** 本地设置的 Vue 响应式引用;修改请调用 pageUseSettings.update */
|
|
76
|
+
function usePageUseSettings() {
|
|
77
|
+
const state = shallowRef(pageUseSettings.get());
|
|
78
|
+
const off = pageUseSettings.store.subscribe((next) => {
|
|
79
|
+
state.value = next;
|
|
80
|
+
});
|
|
81
|
+
onScopeDispose(off);
|
|
82
|
+
return state;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
//#endregion
|
|
86
|
+
export { DEFAULT_MAX_STEPS, DEFAULT_MODEL, DEFAULT_PAGE_USE_SETTINGS, DEFAULT_SESSION_HEADER, DEFAULT_STORAGE_KEY_PREFIX, PAGE_USE_COMMAND_TYPE, PAGE_USE_GLOBAL_KEY, PAGE_USE_GLOW_TAG, PAGE_USE_LAUNCHER_TAG, PAGE_USE_MASK_COLORS, PAGE_USE_STATIC_PRESETS, PAGE_USE_TOOL, PAGE_USE_TOOL_NAME, PageUseGlowElement, PageUseHost, PageUseLauncherElement, SIMULATOR_MASK_ID, buildMenuPresets, clearPageUseLog, createPageUse, definePageUseElements, formatPageUseResultForModel, getElapsedSeconds, getPageUseConfig, isPageUseCommand, isPageUseConfigured, isRunning, mountPageUseUI, normalizeOptions, pageUseCapability, pageUseHistory, pageUseSettings, pageUseStore, readLauncherSwitch, runPageUseTool, usePageUseSettings, usePageUseState, withVueRouter };
|
package/package.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tanzerfe/page-use",
|
|
3
|
+
"private": false,
|
|
4
|
+
"version": "0.0.2",
|
|
5
|
+
"description": "基于 page-agent 的页面操作智能体:自然语言指令驱动页面点击与输入,框架无关,附 Web Component 调试面板与 Vue 适配层",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.mjs",
|
|
8
|
+
"module": "./dist/index.mjs",
|
|
9
|
+
"types": "./dist/index.d.mts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/index.d.mts",
|
|
13
|
+
"import": "./dist/index.mjs"
|
|
14
|
+
},
|
|
15
|
+
"./vue": {
|
|
16
|
+
"types": "./dist/vue.d.mts",
|
|
17
|
+
"import": "./dist/vue.mjs"
|
|
18
|
+
},
|
|
19
|
+
"./package.json": "./package.json"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
24
|
+
"sideEffects": false,
|
|
25
|
+
"keywords": [
|
|
26
|
+
"page-agent",
|
|
27
|
+
"ai",
|
|
28
|
+
"agent",
|
|
29
|
+
"web-component",
|
|
30
|
+
"lit",
|
|
31
|
+
"vue"
|
|
32
|
+
],
|
|
33
|
+
"author": "TanzerFE Team",
|
|
34
|
+
"license": "MIT",
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"access": "public",
|
|
37
|
+
"registry": "https://registry.npmjs.org/"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"vue": "^3.3.0",
|
|
41
|
+
"vue-router": "^4.0.0",
|
|
42
|
+
"zod": "^3.25.0 || ^4.0.0"
|
|
43
|
+
},
|
|
44
|
+
"peerDependenciesMeta": {
|
|
45
|
+
"vue": {
|
|
46
|
+
"optional": true
|
|
47
|
+
},
|
|
48
|
+
"vue-router": {
|
|
49
|
+
"optional": true
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"dependencies": {
|
|
53
|
+
"lit": "^3.3.3",
|
|
54
|
+
"page-agent": "1.12.4"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"jsdom": "^30.1.1",
|
|
58
|
+
"tsdown": "^0.23.0",
|
|
59
|
+
"typescript": "^5.9.3",
|
|
60
|
+
"vite": "^8.3.0",
|
|
61
|
+
"vitest": "^5.0.1",
|
|
62
|
+
"vue": "^3.5.43",
|
|
63
|
+
"vue-router": "^4.6.4",
|
|
64
|
+
"zod": "^4.6.5"
|
|
65
|
+
},
|
|
66
|
+
"scripts": {
|
|
67
|
+
"build": "tsdown",
|
|
68
|
+
"dev": "tsdown --watch",
|
|
69
|
+
"test": "vitest run",
|
|
70
|
+
"typecheck": "tsc --noEmit"
|
|
71
|
+
}
|
|
72
|
+
}
|