@tanzerfe/page-use 0.0.11 → 0.0.13
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/README.md +2 -0
- package/dist/flow.d.mts +1 -1
- package/dist/flow.mjs +1 -1
- package/dist/{index-CbMIEplo.d.mts → index-CzWLOKue.d.mts} +6 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +2 -2
- package/dist/{options-BdQiIL9a.d.mts → options-CS8LsaB8.d.mts} +16 -1
- package/dist/{src-DWoN4zgw.mjs → src-BgrtN4uP.mjs} +77 -23
- package/dist/{tool-CcgpA1W5.mjs → tool-B-3dgswr.mjs} +386 -40
- package/dist/vue.d.mts +3 -3
- package/dist/vue.mjs +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/flow.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as FlowCheckBinding, $t as FlowStatus, A as PageUseManagerPresentation, At as FlowPermissions, B as validateFlowInputs, Bt as FlowRepository, C as getPageUseFlowCatalog, Ct as FlowKnowledgeRecord, D as mountPageUseManager, Dt as FlowOutputReference, E as definePageUseManagerElement, Et as FlowMode, F as parseFlowRegion, Ft as FlowRegionContext, G as FlowActionBinding, Gt as FlowRunner, H as FLOW_BUNDLE_VERSION, Ht as FlowResolvedTarget, I as parseFlowScene, It as FlowRegionFailure, J as FlowApiSyncOptions, Jt as FlowScope, K as FlowApiRequest, Kt as FlowScene, L as parseFlowSceneDraft, Lt as FlowRegionHost, M as newRevision, Mt as FlowRegion, N as parseFlowBundle, Nt as FlowRegionAnchor, O as PAGE_USE_MANAGER_TAG, Ot as FlowParameter, P as parseFlowKnowledge, Pt as FlowRegionCandidate, Q as FlowCheck, Qt as FlowSnapshot, R as sceneKey, Rt as FlowRegionPage, S as PAGE_USE_FLOW_TOOL, St as FlowKnowledge, T as MountPageUseManagerOptions, Tt as FlowManagerState, U as FLOW_SCHEMA_VERSION, Ut as FlowRunOptions, V as validateSceneBindings, Vt as FlowRepositorySnapshot, W as FlowAction, Wt as FlowRunResult, X as FlowBoundCheck, Xt as FlowSegmentLog, Y as FlowBindings, Yt as FlowSegment, Z as FlowBundle, Zt as FlowSessionContext, _t as FlowGenerator, an as PageUseFlowOptions, at as FlowCloudState, bt as FlowImportStrategy, ct as FlowConfigResponse, dt as FlowDescriptionCheck, en as FlowStep, et as FlowClient, ft as FlowError, gt as FlowExportOptions, ht as FlowExecutionPorts, in as PageUseFlowHandle, it as FlowCloudRelease, j as FLOW_SEGMENT_MAX_CHARS, jt as FlowPresenter, k as PageUseManagerElement, kt as FlowParameterDefinition, lt as FlowContext, mt as FlowEvent, nn as JsonObject, nt as FlowCloudCache, o as NormalizedLLMOptions, ot as FlowCompletionDecision, pt as FlowErrorCode, q as FlowApiResponse, qt as FlowSceneRecord, rn as JsonValue, rt as FlowCloudController, st as FlowCompletionEvaluator, tn as FlowTombstone, tt as FlowCloudAdapter, ut as FlowContextBinding, vt as FlowIdentity, w as runPageUseFlowTool, wt as FlowManager, xt as FlowInputDefinition, yt as FlowImportPreview, z as scopeKey, zt as FlowRegionSelector } from "./options-CS8LsaB8.mjs";
|
|
2
2
|
import { z } from "zod/v4";
|
|
3
3
|
//#region src/flow/schema.d.ts
|
|
4
4
|
export declare const FLOW_SCENE_JSON_SCHEMA: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
|
package/dist/flow.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as parseFlowBundle, C as createIndexedDbFlowRepository, D as flowSceneDraftSchema, E as flowBundleSchema, F as sceneKey, I as scopeKey, L as validateFlowInputs,
|
|
1
|
+
import { A as parseFlowBundle, Bt as FLOW_SCHEMA_VERSION, C as createIndexedDbFlowRepository, D as flowSceneDraftSchema, E as flowBundleSchema, F as sceneKey, I as scopeKey, L as validateFlowInputs, M as parseFlowRegion, N as parseFlowScene, O as flowSceneSchema, P as parseFlowSceneDraft, S as previewFlowImport, Vt as FlowError, _ as createFlowApiAdapter, a as mountPageUseManager, b as exportFlowBundle, c as createFlowRegionPicker, d as evaluateFlowCompletion, g as validateRegionPages, i as definePageUseManagerElement, j as parseFlowKnowledge, k as newRevision, l as createFlowRunner, m as locateFlowRegion, n as getPageUseFlowCatalog, o as PAGE_USE_MANAGER_TAG, r as runPageUseFlowTool, s as PageUseManagerElement, t as PAGE_USE_FLOW_TOOL, u as createCompletionEvaluator, w as FLOW_SEGMENT_MAX_CHARS, x as importFlowBundle, y as createFlowCloud, z as validateSceneBindings, zt as FLOW_BUNDLE_VERSION } from "./tool-B-3dgswr.mjs";
|
|
2
2
|
import { z } from "zod/v4";
|
|
3
3
|
|
|
4
4
|
//#region src/flow/schema.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { cn as
|
|
1
|
+
import { cn as PageUsePreset, dn as PageUseSnapshot, fn as PageUseStepLog, h as PageUseTtsEngine, in as PageUseFlowHandle, ln as PageUseProgressEvent, mn as PageUseTaskSource, pn as PageUseTaskResult, s as NormalizedPageUseOptions, sn as PageUseMenuNode, u as PageUseOptions, un as PageUseRunOptions } from "./options-CS8LsaB8.mjs";
|
|
2
2
|
import { AgentStatus } from "page-agent";
|
|
3
3
|
import { LitElement, PropertyValues, nothing } from "lit";
|
|
4
4
|
//#region src/capability/api.d.ts
|
|
@@ -83,6 +83,8 @@ declare class PageUseLauncherElement extends LitElement {
|
|
|
83
83
|
private flowPresentation;
|
|
84
84
|
/** 大窗口仅在当前浏览期间移动,不能反推或持久化原面板的入口位置。 */
|
|
85
85
|
private flowPanelPosition?;
|
|
86
|
+
/** 仅当前场景工作区保留最大化状态;原位置独立保存,供还原时使用。 */
|
|
87
|
+
private flowPanelMaximized;
|
|
86
88
|
private panelResizeFrom?;
|
|
87
89
|
private panelResizeAnimation?;
|
|
88
90
|
private observedFlow?;
|
|
@@ -146,6 +148,7 @@ declare class PageUseLauncherElement extends LitElement {
|
|
|
146
148
|
/** 生效的面板布局:未声明或取值非法时按桌面端处理,既有接入方的行为不变 */
|
|
147
149
|
private get isMobileLayout();
|
|
148
150
|
private get isFlowView();
|
|
151
|
+
private get isFlowPanelMaximized();
|
|
149
152
|
/**
|
|
150
153
|
* 下达指令后是否自动收起面板:仅移动端布局生效,默认开启,可在设置页关闭。
|
|
151
154
|
* 桌面端不提供该行为,也不显示设置项,存储中被改过的值在桌面端不生效。
|
|
@@ -216,6 +219,8 @@ declare class PageUseLauncherElement extends LitElement {
|
|
|
216
219
|
private onTitleTap;
|
|
217
220
|
/** 切换面板视图:离开设置页时中止音色试听,离开快捷指令编辑时丢弃未保存的草稿 */
|
|
218
221
|
private switchView;
|
|
222
|
+
private toggleFlowPanelMaximized;
|
|
223
|
+
private preparePanelResize;
|
|
219
224
|
private cancelPanelResize;
|
|
220
225
|
private animatePanelResize;
|
|
221
226
|
private onPanelPointerDown;
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { A as PageUseGlobal, B as MountPageUseUIOptions, C as getElapsedSeconds, D as pageUseStore, E as isRunning, F as PAGE_USE_TOOL_NAME, G as PageUseLauncherElement, H as mountPageUseUI, I as PageUseCommand, J as createPageUse, K as PageUseLauncherLayout, L as formatPageUseResultForModel, M as showPageUseLauncher, N as PAGE_USE_COMMAND_TYPE, O as ReadonlyStore, P as PAGE_USE_TOOL, R as isPageUseCommand, S as clearPageUseLog, T as isPageUseConfigured, U as PAGE_USE_LAUNCHER_TAG, V as definePageUseElements, W as PageUseLauncherConfig, X as PageUseCapability, Y as getPageUseFlow, Z as pageUseCapability, _ as pageUseSettings, a as PAGE_USE_ROBOT_ICON_SVG, b as PageUseQuestion, c as PageUseCustomPreset, d as pageUsePresets, f as PageUseHistoryEntry, g as PageUseSettings, h as PageUsePoint, i as PageUseGlowElement, j as hidePageUseLauncher, k as PAGE_USE_GLOBAL_KEY, l as PageUsePresetSaveResult, m as DEFAULT_PAGE_USE_SETTINGS, n as SIMULATOR_MASK_ID, o as PAGE_USE_STATIC_PRESETS, p as pageUseHistory, q as PageUseHandle, r as PAGE_USE_GLOW_TAG, s as buildMenuPresets, t as PAGE_USE_MASK_COLORS, u as PageUsePresetState, v as BROWSER_ENGINE_ID, w as getPageUseConfig, x as PageUseState, y as browserTtsEngine, z as runPageUseTool } from "./index-
|
|
3
|
-
export { BROWSER_ENGINE_ID, DEFAULT_MAX_STEPS, DEFAULT_MODEL, DEFAULT_PAGE_USE_SETTINGS, DEFAULT_SESSION_HEADER, DEFAULT_STORAGE_KEY_PREFIX, DEFAULT_TOUR_MAX_TAB_SWITCHES, DEFAULT_TOUR_STYLES, FLOW_BUNDLE_VERSION, FLOW_SCHEMA_VERSION, FlowAction, FlowActionBinding, FlowApiRequest, FlowApiResponse, FlowApiSyncOptions, FlowBindings, FlowBoundCheck, FlowBundle, FlowCheck, FlowCheckBinding, FlowClient, FlowCloudAdapter, FlowCloudCache, FlowCloudController, FlowCloudRelease, FlowCloudState, FlowCompletionDecision, FlowCompletionEvaluator, FlowConfigResponse, FlowContext, FlowContextBinding, FlowDescriptionCheck, FlowError, FlowErrorCode, FlowEvent, FlowExecutionPorts, FlowExportOptions, FlowGenerator, FlowIdentity, FlowImportPreview, FlowImportStrategy, FlowInputDefinition, FlowKnowledge, FlowKnowledgeRecord, FlowManager, FlowManagerState, FlowMode, FlowOutputReference, FlowParameter, FlowParameterDefinition, FlowPermissions, FlowPresenter, FlowRegion, FlowRegionAnchor, FlowRegionCandidate, FlowRegionContext, FlowRegionFailure, FlowRegionHost, FlowRegionPage, FlowRegionSelector, FlowRepository, FlowRepositorySnapshot, FlowResolvedTarget, FlowRunOptions, FlowRunResult, FlowRunner, FlowScene, FlowSceneRecord, FlowScope, FlowSegment, FlowSegmentLog, FlowSessionContext, FlowSnapshot, FlowStatus, FlowStep, FlowTombstone, JsonObject, JsonValue, type MountPageUseManagerOptions, type MountPageUseUIOptions, type NormalizedPageUseOptions, PAGE_USE_COMMAND_TYPE, PAGE_USE_FLOW_TOOL, PAGE_USE_GLOBAL_KEY, PAGE_USE_GLOW_TAG, PAGE_USE_LAUNCHER_TAG, PAGE_USE_MASK_COLORS, PAGE_USE_ROBOT_ICON_SVG, PAGE_USE_STATIC_PRESETS, PAGE_USE_TOOL, PAGE_USE_TOOL_NAME, type PageUseCapability, type PageUseCommand, type PageUseCustomPreset, type PageUseErrorCode, PageUseFlowHandle, PageUseFlowOptions, type PageUseGlobal, PageUseGlowElement, type PageUseHandle, type PageUseHistoryEntry, type PageUseLLMOptions, type PageUseLauncherConfig, PageUseLauncherElement, type PageUseLauncherLayout, type PageUseMenuNode, type PageUseOptions, type PageUsePoint, type PageUsePreset, type PageUsePresetSaveResult, type PageUsePresetState, type PageUseProgressEvent, type PageUseQuestion, type PageUseRouterMode, type PageUseRunOptions, type PageUseSettings, type PageUseSnapshot, type PageUseState, type PageUseStepLog, type PageUseTaskResult, type PageUseTaskSource, type PageUseTaskStatus, type PageUseTourOptions, type PageUseTourStyle, type PageUseTtsEngine, type PageUseTtsSpeakOptions, type PageUseTtsVoice, type ReadonlyStore, SIMULATOR_MASK_ID, TOUR_STYLE_TRAINER, TOUR_STYLE_USER, browserTtsEngine, buildMenuPresets, clearPageUseLog, createPageUse, definePageUseElements, definePageUseManagerElement, formatPageUseResultForModel, getElapsedSeconds, getPageUseConfig, getPageUseFlow, getPageUseFlowCatalog, hidePageUseLauncher, isPageUseCommand, isPageUseConfigured, isRunning, mountPageUseManager, mountPageUseUI, newRevision, normalizeOptions, pageUseCapability, pageUseHistory, pageUsePresets, pageUseSettings, pageUseStore, parseFlowKnowledge, parseFlowScene, parseFlowSceneDraft, readLauncherSwitch, runPageUseFlowTool, runPageUseTool, sceneKey, showPageUseLauncher };
|
|
1
|
+
import { $ as FlowCheckBinding, $t as FlowStatus, At as FlowPermissions, Bt as FlowRepository, C as getPageUseFlowCatalog, Ct as FlowKnowledgeRecord, D as mountPageUseManager, Dt as FlowOutputReference, E as definePageUseManagerElement, Et as FlowMode, Ft as FlowRegionContext, G as FlowActionBinding, Gt as FlowRunner, H as FLOW_BUNDLE_VERSION, Ht as FlowResolvedTarget, I as parseFlowScene, It as FlowRegionFailure, J as FlowApiSyncOptions, Jt as FlowScope, K as FlowApiRequest, Kt as FlowScene, L as parseFlowSceneDraft, Lt as FlowRegionHost, M as newRevision, Mt as FlowRegion, Nt as FlowRegionAnchor, Ot as FlowParameter, P as parseFlowKnowledge, Pt as FlowRegionCandidate, Q as FlowCheck, Qt as FlowSnapshot, R as sceneKey, Rt as FlowRegionPage, S as PAGE_USE_FLOW_TOOL, St as FlowKnowledge, T as MountPageUseManagerOptions, Tt as FlowManagerState, U as FLOW_SCHEMA_VERSION, Ut as FlowRunOptions, Vt as FlowRepositorySnapshot, W as FlowAction, Wt as FlowRunResult, X as FlowBoundCheck, Xt as FlowSegmentLog, Y as FlowBindings, Yt as FlowSegment, Z as FlowBundle, Zt as FlowSessionContext, _ as PageUseTtsVoice, _t as FlowGenerator, a as DEFAULT_TOUR_MAX_TAB_SWITCHES, an as PageUseFlowOptions, at as FlowCloudState, b as TOUR_STYLE_TRAINER, bt as FlowImportStrategy, c as PageUseLLMOptions, cn as PageUsePreset, ct as FlowConfigResponse, d as PageUseRouterMode, dn as PageUseSnapshot, dt as FlowDescriptionCheck, en as FlowStep, et as FlowClient, f as PageUseTourOptions, fn as PageUseStepLog, ft as FlowError, g as PageUseTtsSpeakOptions, gt as FlowExportOptions, h as PageUseTtsEngine, hn as PageUseTaskStatus, ht as FlowExecutionPorts, i as DEFAULT_STORAGE_KEY_PREFIX, in as PageUseFlowHandle, it as FlowCloudRelease, jt as FlowPresenter, kt as FlowParameterDefinition, l as PageUseLLMStreamOptions, ln as PageUseProgressEvent, lt as FlowContext, m as readLauncherSwitch, mn as PageUseTaskSource, mt as FlowEvent, n as DEFAULT_MODEL, nn as JsonObject, nt as FlowCloudCache, on as PageUseErrorCode, ot as FlowCompletionDecision, p as normalizeOptions, pn as PageUseTaskResult, pt as FlowErrorCode, q as FlowApiResponse, qt as FlowSceneRecord, r as DEFAULT_SESSION_HEADER, rn as JsonValue, rt as FlowCloudController, s as NormalizedPageUseOptions, sn as PageUseMenuNode, st as FlowCompletionEvaluator, t as DEFAULT_MAX_STEPS, tn as FlowTombstone, tt as FlowCloudAdapter, u as PageUseOptions, un as PageUseRunOptions, ut as FlowContextBinding, v as DEFAULT_TOUR_STYLES, vt as FlowIdentity, w as runPageUseFlowTool, wt as FlowManager, x as TOUR_STYLE_USER, xt as FlowInputDefinition, y as PageUseTourStyle, yt as FlowImportPreview, zt as FlowRegionSelector } from "./options-CS8LsaB8.mjs";
|
|
2
|
+
import { A as PageUseGlobal, B as MountPageUseUIOptions, C as getElapsedSeconds, D as pageUseStore, E as isRunning, F as PAGE_USE_TOOL_NAME, G as PageUseLauncherElement, H as mountPageUseUI, I as PageUseCommand, J as createPageUse, K as PageUseLauncherLayout, L as formatPageUseResultForModel, M as showPageUseLauncher, N as PAGE_USE_COMMAND_TYPE, O as ReadonlyStore, P as PAGE_USE_TOOL, R as isPageUseCommand, S as clearPageUseLog, T as isPageUseConfigured, U as PAGE_USE_LAUNCHER_TAG, V as definePageUseElements, W as PageUseLauncherConfig, X as PageUseCapability, Y as getPageUseFlow, Z as pageUseCapability, _ as pageUseSettings, a as PAGE_USE_ROBOT_ICON_SVG, b as PageUseQuestion, c as PageUseCustomPreset, d as pageUsePresets, f as PageUseHistoryEntry, g as PageUseSettings, h as PageUsePoint, i as PageUseGlowElement, j as hidePageUseLauncher, k as PAGE_USE_GLOBAL_KEY, l as PageUsePresetSaveResult, m as DEFAULT_PAGE_USE_SETTINGS, n as SIMULATOR_MASK_ID, o as PAGE_USE_STATIC_PRESETS, p as pageUseHistory, q as PageUseHandle, r as PAGE_USE_GLOW_TAG, s as buildMenuPresets, t as PAGE_USE_MASK_COLORS, u as PageUsePresetState, v as BROWSER_ENGINE_ID, w as getPageUseConfig, x as PageUseState, y as browserTtsEngine, z as runPageUseTool } from "./index-CzWLOKue.mjs";
|
|
3
|
+
export { BROWSER_ENGINE_ID, DEFAULT_MAX_STEPS, DEFAULT_MODEL, DEFAULT_PAGE_USE_SETTINGS, DEFAULT_SESSION_HEADER, DEFAULT_STORAGE_KEY_PREFIX, DEFAULT_TOUR_MAX_TAB_SWITCHES, DEFAULT_TOUR_STYLES, FLOW_BUNDLE_VERSION, FLOW_SCHEMA_VERSION, FlowAction, FlowActionBinding, FlowApiRequest, FlowApiResponse, FlowApiSyncOptions, FlowBindings, FlowBoundCheck, FlowBundle, FlowCheck, FlowCheckBinding, FlowClient, FlowCloudAdapter, FlowCloudCache, FlowCloudController, FlowCloudRelease, FlowCloudState, FlowCompletionDecision, FlowCompletionEvaluator, FlowConfigResponse, FlowContext, FlowContextBinding, FlowDescriptionCheck, FlowError, FlowErrorCode, FlowEvent, FlowExecutionPorts, FlowExportOptions, FlowGenerator, FlowIdentity, FlowImportPreview, FlowImportStrategy, FlowInputDefinition, FlowKnowledge, FlowKnowledgeRecord, FlowManager, FlowManagerState, FlowMode, FlowOutputReference, FlowParameter, FlowParameterDefinition, FlowPermissions, FlowPresenter, FlowRegion, FlowRegionAnchor, FlowRegionCandidate, FlowRegionContext, FlowRegionFailure, FlowRegionHost, FlowRegionPage, FlowRegionSelector, FlowRepository, FlowRepositorySnapshot, FlowResolvedTarget, FlowRunOptions, FlowRunResult, FlowRunner, FlowScene, FlowSceneRecord, FlowScope, FlowSegment, FlowSegmentLog, FlowSessionContext, FlowSnapshot, FlowStatus, FlowStep, FlowTombstone, JsonObject, JsonValue, type MountPageUseManagerOptions, type MountPageUseUIOptions, type NormalizedPageUseOptions, PAGE_USE_COMMAND_TYPE, PAGE_USE_FLOW_TOOL, PAGE_USE_GLOBAL_KEY, PAGE_USE_GLOW_TAG, PAGE_USE_LAUNCHER_TAG, PAGE_USE_MASK_COLORS, PAGE_USE_ROBOT_ICON_SVG, PAGE_USE_STATIC_PRESETS, PAGE_USE_TOOL, PAGE_USE_TOOL_NAME, type PageUseCapability, type PageUseCommand, type PageUseCustomPreset, type PageUseErrorCode, PageUseFlowHandle, PageUseFlowOptions, type PageUseGlobal, PageUseGlowElement, type PageUseHandle, type PageUseHistoryEntry, type PageUseLLMOptions, type PageUseLLMStreamOptions, type PageUseLauncherConfig, PageUseLauncherElement, type PageUseLauncherLayout, type PageUseMenuNode, type PageUseOptions, type PageUsePoint, type PageUsePreset, type PageUsePresetSaveResult, type PageUsePresetState, type PageUseProgressEvent, type PageUseQuestion, type PageUseRouterMode, type PageUseRunOptions, type PageUseSettings, type PageUseSnapshot, type PageUseState, type PageUseStepLog, type PageUseTaskResult, type PageUseTaskSource, type PageUseTaskStatus, type PageUseTourOptions, type PageUseTourStyle, type PageUseTtsEngine, type PageUseTtsSpeakOptions, type PageUseTtsVoice, type ReadonlyStore, SIMULATOR_MASK_ID, TOUR_STYLE_TRAINER, TOUR_STYLE_USER, browserTtsEngine, buildMenuPresets, clearPageUseLog, createPageUse, definePageUseElements, definePageUseManagerElement, formatPageUseResultForModel, getElapsedSeconds, getPageUseConfig, getPageUseFlow, getPageUseFlowCatalog, hidePageUseLauncher, isPageUseCommand, isPageUseConfigured, isRunning, mountPageUseManager, mountPageUseUI, newRevision, normalizeOptions, pageUseCapability, pageUseHistory, pageUsePresets, pageUseSettings, pageUseStore, parseFlowKnowledge, parseFlowScene, parseFlowSceneDraft, readLauncherSwitch, runPageUseFlowTool, runPageUseTool, sceneKey, showPageUseLauncher };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { At as
|
|
2
|
-
import { _ as isPageUseCommand, a as PAGE_USE_STATIC_PRESETS, b as showPageUseLauncher, c as PAGE_USE_GLOW_TAG, d as getPageUseFlow, f as PAGE_USE_GLOBAL_KEY, g as formatPageUseResultForModel, h as PAGE_USE_TOOL_NAME, i as PageUseLauncherElement, l as PageUseGlowElement, m as PAGE_USE_TOOL, n as mountPageUseUI, o as buildMenuPresets, p as PAGE_USE_COMMAND_TYPE, r as PAGE_USE_LAUNCHER_TAG, s as PAGE_USE_ROBOT_ICON_SVG, t as definePageUseElements, u as createPageUse, v as runPageUseTool, x as pageUseCapability, y as hidePageUseLauncher } from "./src-
|
|
1
|
+
import { At as SIMULATOR_MASK_ID, Bt as FLOW_SCHEMA_VERSION, Ct as DEFAULT_TOUR_MAX_TAB_SWITCHES, Et as readLauncherSwitch, F as sceneKey, Ft as TOUR_STYLE_TRAINER, It as TOUR_STYLE_USER, J as isRunning, Mt as browserTtsEngine, N as parseFlowScene, P as parseFlowSceneDraft, Pt as DEFAULT_TOUR_STYLES, St as DEFAULT_STORAGE_KEY_PREFIX, U as getElapsedSeconds, V as clearPageUseLog, Vt as FlowError, W as getPageUseConfig, Y as pageUseStore, _t as pageUseSettings, a as mountPageUseManager, at as pageUseHistory, bt as DEFAULT_MODEL, gt as DEFAULT_PAGE_USE_SETTINGS, i as definePageUseManagerElement, it as pageUsePresets, j as parseFlowKnowledge, jt as BROWSER_ENGINE_ID, k as newRevision, kt as PAGE_USE_MASK_COLORS, n as getPageUseFlowCatalog, q as isPageUseConfigured, r as runPageUseFlowTool, t as PAGE_USE_FLOW_TOOL, wt as normalizeOptions, xt as DEFAULT_SESSION_HEADER, yt as DEFAULT_MAX_STEPS, zt as FLOW_BUNDLE_VERSION } from "./tool-B-3dgswr.mjs";
|
|
2
|
+
import { _ as isPageUseCommand, a as PAGE_USE_STATIC_PRESETS, b as showPageUseLauncher, c as PAGE_USE_GLOW_TAG, d as getPageUseFlow, f as PAGE_USE_GLOBAL_KEY, g as formatPageUseResultForModel, h as PAGE_USE_TOOL_NAME, i as PageUseLauncherElement, l as PageUseGlowElement, m as PAGE_USE_TOOL, n as mountPageUseUI, o as buildMenuPresets, p as PAGE_USE_COMMAND_TYPE, r as PAGE_USE_LAUNCHER_TAG, s as PAGE_USE_ROBOT_ICON_SVG, t as definePageUseElements, u as createPageUse, v as runPageUseTool, x as pageUseCapability, y as hidePageUseLauncher } from "./src-BgrtN4uP.mjs";
|
|
3
3
|
|
|
4
4
|
export { BROWSER_ENGINE_ID, DEFAULT_MAX_STEPS, DEFAULT_MODEL, DEFAULT_PAGE_USE_SETTINGS, DEFAULT_SESSION_HEADER, DEFAULT_STORAGE_KEY_PREFIX, DEFAULT_TOUR_MAX_TAB_SWITCHES, DEFAULT_TOUR_STYLES, FLOW_BUNDLE_VERSION, FLOW_SCHEMA_VERSION, FlowError, PAGE_USE_COMMAND_TYPE, PAGE_USE_FLOW_TOOL, PAGE_USE_GLOBAL_KEY, PAGE_USE_GLOW_TAG, PAGE_USE_LAUNCHER_TAG, PAGE_USE_MASK_COLORS, PAGE_USE_ROBOT_ICON_SVG, PAGE_USE_STATIC_PRESETS, PAGE_USE_TOOL, PAGE_USE_TOOL_NAME, PageUseGlowElement, PageUseLauncherElement, SIMULATOR_MASK_ID, TOUR_STYLE_TRAINER, TOUR_STYLE_USER, browserTtsEngine, buildMenuPresets, clearPageUseLog, createPageUse, definePageUseElements, definePageUseManagerElement, formatPageUseResultForModel, getElapsedSeconds, getPageUseConfig, getPageUseFlow, getPageUseFlowCatalog, hidePageUseLauncher, isPageUseCommand, isPageUseConfigured, isRunning, mountPageUseManager, mountPageUseUI, newRevision, normalizeOptions, pageUseCapability, pageUseHistory, pageUsePresets, pageUseSettings, pageUseStore, parseFlowKnowledge, parseFlowScene, parseFlowSceneDraft, readLauncherSwitch, runPageUseFlowTool, runPageUseTool, sceneKey, showPageUseLauncher };
|
|
@@ -829,6 +829,8 @@ declare class PageUseManagerElement extends LitElement {
|
|
|
829
829
|
private record?;
|
|
830
830
|
/** -1 表示所有步骤收起,展开状态不写入场景配置。 */
|
|
831
831
|
private selectedStep;
|
|
832
|
+
/** 折叠仅影响当前表单;按条目对象记录,重排后仍跟随原操作或段落。 */
|
|
833
|
+
private collapsedStepItems;
|
|
832
834
|
private knowledgeDraft?;
|
|
833
835
|
private knowledgeRecord?;
|
|
834
836
|
private dirty;
|
|
@@ -914,6 +916,9 @@ declare class PageUseManagerElement extends LitElement {
|
|
|
914
916
|
private moveStep;
|
|
915
917
|
private addAction;
|
|
916
918
|
private addCheck;
|
|
919
|
+
private addSegment;
|
|
920
|
+
private revealAddedStepItem;
|
|
921
|
+
private toggleStepItem;
|
|
917
922
|
private renderAction;
|
|
918
923
|
private renderCheck;
|
|
919
924
|
private renderParameters;
|
|
@@ -1086,6 +1091,10 @@ interface PageUseLLMOptions {
|
|
|
1086
1091
|
maxSteps?: number;
|
|
1087
1092
|
/** 部分模型拒绝对象形式 tool_choice("Invalid tool_choice type")时打开 */
|
|
1088
1093
|
disableNamedToolChoice?: boolean;
|
|
1094
|
+
/** 使用 SSE 传输,完整聚合并校验后才执行工具;默认 false,不改变面板或语音时序。 */
|
|
1095
|
+
stream?: boolean;
|
|
1096
|
+
/** 仅 stream=true 时生效;由网关决定是否返回 usage。 */
|
|
1097
|
+
streamOptions?: PageUseLLMStreamOptions;
|
|
1089
1098
|
/** 额外合并进请求体的字段,例:DeepSeek 关闭思考模式 { thinking: { type: 'disabled' } } */
|
|
1090
1099
|
extraBody?: Record<string, unknown>;
|
|
1091
1100
|
/**
|
|
@@ -1094,6 +1103,10 @@ interface PageUseLLMOptions {
|
|
|
1094
1103
|
*/
|
|
1095
1104
|
sessionHeader?: string | false;
|
|
1096
1105
|
}
|
|
1106
|
+
interface PageUseLLMStreamOptions {
|
|
1107
|
+
/** 请求末尾的 usage 统计;默认不发送 stream_options,兼容未支持此参数的网关。 */
|
|
1108
|
+
includeUsage?: boolean;
|
|
1109
|
+
}
|
|
1097
1110
|
/**
|
|
1098
1111
|
* 路由模式,决定站点地图中路径的写法与默认的当前路径读取方式:
|
|
1099
1112
|
* - hash:页面 URL 形如 `/#/a/b`
|
|
@@ -1171,6 +1184,8 @@ interface NormalizedLLMOptions {
|
|
|
1171
1184
|
model: string;
|
|
1172
1185
|
maxSteps: number;
|
|
1173
1186
|
disableNamedToolChoice: boolean;
|
|
1187
|
+
stream: boolean;
|
|
1188
|
+
streamOptions: PageUseLLMStreamOptions;
|
|
1174
1189
|
extraBody: Record<string, unknown>;
|
|
1175
1190
|
/** 空串表示不发送会话头 */
|
|
1176
1191
|
sessionHeader: string;
|
|
@@ -1203,4 +1218,4 @@ declare function normalizeOptions(options: PageUseOptions): NormalizedPageUseOpt
|
|
|
1203
1218
|
*/
|
|
1204
1219
|
declare function readLauncherSwitch(fallback: boolean, storageKeyPrefix?: string): boolean;
|
|
1205
1220
|
//#endregion
|
|
1206
|
-
export {
|
|
1221
|
+
export { FlowCheckBinding as $, FlowStatus as $t, PageUseManagerPresentation as A, FlowPermissions as At, validateFlowInputs as B, FlowRepository as Bt, getPageUseFlowCatalog as C, FlowKnowledgeRecord as Ct, mountPageUseManager as D, FlowOutputReference as Dt, definePageUseManagerElement as E, FlowMode as Et, parseFlowRegion as F, FlowRegionContext as Ft, FlowActionBinding as G, FlowRunner as Gt, FLOW_BUNDLE_VERSION as H, FlowResolvedTarget as Ht, parseFlowScene as I, FlowRegionFailure as It, FlowApiSyncOptions as J, FlowScope as Jt, FlowApiRequest as K, FlowScene as Kt, parseFlowSceneDraft as L, FlowRegionHost as Lt, newRevision as M, FlowRegion as Mt, parseFlowBundle as N, FlowRegionAnchor as Nt, PAGE_USE_MANAGER_TAG as O, FlowParameter as Ot, parseFlowKnowledge as P, FlowRegionCandidate as Pt, FlowCheck as Q, FlowSnapshot as Qt, sceneKey as R, FlowRegionPage as Rt, PAGE_USE_FLOW_TOOL as S, FlowKnowledge as St, MountPageUseManagerOptions as T, FlowManagerState as Tt, FLOW_SCHEMA_VERSION as U, FlowRunOptions as Ut, validateSceneBindings as V, FlowRepositorySnapshot as Vt, FlowAction as W, FlowRunResult as Wt, FlowBoundCheck as X, FlowSegmentLog as Xt, FlowBindings as Y, FlowSegment as Yt, FlowBundle as Z, FlowSessionContext as Zt, PageUseTtsVoice as _, FlowGenerator as _t, DEFAULT_TOUR_MAX_TAB_SWITCHES as a, PageUseFlowOptions as an, FlowCloudState as at, TOUR_STYLE_TRAINER as b, FlowImportStrategy as bt, PageUseLLMOptions as c, PageUsePreset as cn, FlowConfigResponse as ct, PageUseRouterMode as d, PageUseSnapshot as dn, FlowDescriptionCheck as dt, FlowStep as en, FlowClient as et, PageUseTourOptions as f, PageUseStepLog as fn, FlowError as ft, PageUseTtsSpeakOptions as g, FlowExportOptions as gt, PageUseTtsEngine as h, PageUseTaskStatus as hn, FlowExecutionPorts as ht, DEFAULT_STORAGE_KEY_PREFIX as i, PageUseFlowHandle as in, FlowCloudRelease as it, FLOW_SEGMENT_MAX_CHARS as j, FlowPresenter as jt, PageUseManagerElement as k, FlowParameterDefinition as kt, PageUseLLMStreamOptions as l, PageUseProgressEvent as ln, FlowContext as lt, readLauncherSwitch as m, PageUseTaskSource as mn, FlowEvent as mt, DEFAULT_MODEL as n, JsonObject as nn, FlowCloudCache as nt, NormalizedLLMOptions as o, PageUseErrorCode as on, FlowCompletionDecision as ot, normalizeOptions as p, PageUseTaskResult as pn, FlowErrorCode as pt, FlowApiResponse as q, FlowSceneRecord as qt, DEFAULT_SESSION_HEADER as r, JsonValue as rn, FlowCloudController as rt, NormalizedPageUseOptions as s, PageUseMenuNode as sn, FlowCompletionEvaluator as st, DEFAULT_MAX_STEPS as t, FlowTombstone as tn, FlowCloudAdapter as tt, PageUseOptions as u, PageUseRunOptions as un, FlowContextBinding as ut, DEFAULT_TOUR_STYLES as v, FlowIdentity as vt, runPageUseFlowTool as w, FlowManager as wt, TOUR_STYLE_USER as x, FlowInputDefinition as xt, PageUseTourStyle as y, FlowImportPreview as yt, scopeKey as z, FlowRegionSelector as zt };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as showFlowMask,
|
|
1
|
+
import { $ as showFlowMask, At as SIMULATOR_MASK_ID, B as acquireFlowExecution, C as createIndexedDbFlowRepository, Dt as listTtsEngines, F as sceneKey, G as getPageUseSnapshot, H as configurePageUse, I as scopeKey, J as isRunning, K as hideFlowMask, Lt as cancelRegionPicker, M as parseFlowRegion, N as parseFlowScene, Nt as isSpeechSupported, Ot as resolveTtsEngine, P as parseFlowSceneDraft, Q as runTaskForFlow, R as validateRegionPreviewInputs, Rt as hasRegionPicker, S as previewFlowImport, T as cloneJson, Tt as readLauncherQuery, U as getElapsedSeconds, V as clearPageUseLog, Vt as FlowError, W as getPageUseConfig, X as registerQuestionUi, Y as pageUseStore, Z as runTask, _ as createFlowApiAdapter, _t as pageUseSettings, at as pageUseHistory, b as exportFlowBundle, ct as hideTourHighlight, dt as narrationMute, et as stopTask, f as composedParent, ft as registerNarrationPanelName, g as validateRegionPages, h as regionAbortable, ht as stopPreview, i as definePageUseManagerElement, it as pageUsePresets, j as parseFlowKnowledge, jt as BROWSER_ENGINE_ID, k as newRevision, l as createFlowRunner, lt as showTourHighlight, m as locateFlowRegion, mt as startPreview, nt as subscribePageUse, ot as completionRequestBody, p as createRegionSelector, pt as previewStore, rt as updateFlowExecution, st as readCompletionResponse, tt as stopTaskForFlow, u as createCompletionEvaluator, ut as narrate, v as validateFlowApiOptions, vt as createStore, w as FLOW_SEGMENT_MAX_CHARS, wt as normalizeOptions, x as importFlowBundle, y as createFlowCloud, z as validateSceneBindings } from "./tool-B-3dgswr.mjs";
|
|
2
2
|
import { LitElement, css, html, nothing, svg } from "lit";
|
|
3
3
|
import { keyed } from "lit/directives/keyed.js";
|
|
4
4
|
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
@@ -282,14 +282,14 @@ function createFlowGenerator(llm) {
|
|
|
282
282
|
const headers = new Headers({ "Content-Type": "application/json" });
|
|
283
283
|
if (llm.apiKey) headers.set("Authorization", `Bearer ${llm.apiKey}`);
|
|
284
284
|
if (llm.sessionHeader) headers.set(llm.sessionHeader, context.sessionId);
|
|
285
|
+
const { tools: _tools, tool_choice: _choice, functions: _functions, function_call: _call, ...extra } = llm.extraBody;
|
|
285
286
|
const response = await fetch(`${llm.baseURL}/chat/completions`, {
|
|
286
287
|
method: "POST",
|
|
287
288
|
headers,
|
|
288
289
|
signal,
|
|
289
|
-
body: JSON.stringify({
|
|
290
|
-
...
|
|
290
|
+
body: JSON.stringify(completionRequestBody({
|
|
291
|
+
...extra,
|
|
291
292
|
model: llm.model,
|
|
292
|
-
stream: false,
|
|
293
293
|
temperature: .2,
|
|
294
294
|
messages: [{
|
|
295
295
|
role: "system",
|
|
@@ -310,10 +310,12 @@ function createFlowGenerator(llm) {
|
|
|
310
310
|
outputs: context.outputs
|
|
311
311
|
})
|
|
312
312
|
}]
|
|
313
|
-
})
|
|
313
|
+
}, llm))
|
|
314
314
|
});
|
|
315
315
|
if (!response.ok) throw new Error(`讲解模型请求失败(HTTP ${response.status})`);
|
|
316
|
-
const
|
|
316
|
+
const body = await readCompletionResponse(response, signal);
|
|
317
|
+
if (body.choices?.[0]?.message?.tool_calls?.length || body.choices?.[0]?.message?.function_call) throw new Error("讲解模型返回了工具调用");
|
|
318
|
+
const content = body.choices?.[0]?.message?.content;
|
|
317
319
|
if (typeof content !== "string") throw new Error("讲解模型未返回文本");
|
|
318
320
|
return content;
|
|
319
321
|
};
|
|
@@ -1266,7 +1268,7 @@ var PageUseGlowElement = class extends LitElement {
|
|
|
1266
1268
|
|
|
1267
1269
|
//#endregion
|
|
1268
1270
|
//#region package.json
|
|
1269
|
-
var version = "0.0.
|
|
1271
|
+
var version = "0.0.13";
|
|
1270
1272
|
|
|
1271
1273
|
//#endregion
|
|
1272
1274
|
//#region src/ui/drag.ts
|
|
@@ -1413,7 +1415,7 @@ function formatTokens(n) {
|
|
|
1413
1415
|
//#region src/ui/icons.ts
|
|
1414
1416
|
/**
|
|
1415
1417
|
* 调试面板标题栏图标:24×24 线条图标,颜色跟随 currentColor,尺寸由 .icon-btn svg 控制。
|
|
1416
|
-
* 路径取自 Lucide(ISC 许可):settings、arrow-left、minimize-2、x、volume-2、volume-x;
|
|
1418
|
+
* 路径取自 Lucide(ISC 许可):settings、arrow-left、minimize-2、maximize、copy、x、volume-2、volume-x;
|
|
1417
1419
|
* robotIcon 为本包自绘的页面智能体形象,其 SVG 字符串以 PAGE_USE_ROBOT_ICON_SVG 对外导出。
|
|
1418
1420
|
*/
|
|
1419
1421
|
/** 外层 <svg> 须在 html 模板中创建(lit 的 svg 模板只用于 <svg> 内部的片段) */
|
|
@@ -1438,6 +1440,15 @@ const backIcon = icon(svg`<path d="M19 12H5" /><path d="m12 19-7-7 7-7" />`);
|
|
|
1438
1440
|
const collapseIcon = icon(svg`
|
|
1439
1441
|
<path d="M4 14h6v6" /><path d="M20 10h-6V4" /><path d="m14 10 7-7" /><path d="m3 21 7-7" />
|
|
1440
1442
|
`);
|
|
1443
|
+
/** 铺满网页视口 */
|
|
1444
|
+
const maximizeIcon = icon(svg`
|
|
1445
|
+
<path d="M8 3H5a2 2 0 0 0-2 2v3m13-5h3a2 2 0 0 1 2 2v3m0 8v3a2 2 0 0 1-2 2h-3M8 21H5a2 2 0 0 1-2-2v-3" />
|
|
1446
|
+
`);
|
|
1447
|
+
/** 还原为浮动窗口 */
|
|
1448
|
+
const restoreIcon = icon(svg`
|
|
1449
|
+
<rect x="9" y="9" width="13" height="13" rx="2" />
|
|
1450
|
+
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" />
|
|
1451
|
+
`);
|
|
1441
1452
|
/** 关闭调试入口 */
|
|
1442
1453
|
const closeIcon = icon(svg`<path d="M18 6 6 18" /><path d="m6 6 12 12" />`);
|
|
1443
1454
|
/** 播报中(点击静音) */
|
|
@@ -1879,6 +1890,15 @@ const launcherStyles = css`
|
|
|
1879
1890
|
.head:active {
|
|
1880
1891
|
cursor: grabbing;
|
|
1881
1892
|
}
|
|
1893
|
+
/* 视口最大化时贴合四边,标题栏不再作为拖动手柄。 */
|
|
1894
|
+
.panel.maximized,
|
|
1895
|
+
.panel.maximized .head {
|
|
1896
|
+
border-radius: 0;
|
|
1897
|
+
}
|
|
1898
|
+
.panel.maximized .head,
|
|
1899
|
+
.panel.maximized .head:active {
|
|
1900
|
+
cursor: default;
|
|
1901
|
+
}
|
|
1882
1902
|
.dot {
|
|
1883
1903
|
flex: none;
|
|
1884
1904
|
width: 8px;
|
|
@@ -2549,7 +2569,7 @@ const PANEL_HEIGHT = 560;
|
|
|
2549
2569
|
/** 场景目录和双栏编辑需要更宽的工作区,实际尺寸仍受视口和入口锚点约束。 */
|
|
2550
2570
|
const FLOW_PANEL_WIDTH = 960;
|
|
2551
2571
|
const FLOW_PANEL_HEIGHT = 720;
|
|
2552
|
-
/**
|
|
2572
|
+
/** 面板视图与最大化的尺寸切换时长(ms),不用于拖动跟手。 */
|
|
2553
2573
|
const PANEL_RESIZE_MS = 220;
|
|
2554
2574
|
/** 日志区距底部小于该值(px)视为贴底 */
|
|
2555
2575
|
const STICK_THRESHOLD = 24;
|
|
@@ -2646,6 +2666,8 @@ var PageUseLauncherElement = class extends LitElement {
|
|
|
2646
2666
|
flowPresentation = "scenarios";
|
|
2647
2667
|
/** 大窗口仅在当前浏览期间移动,不能反推或持久化原面板的入口位置。 */
|
|
2648
2668
|
flowPanelPosition;
|
|
2669
|
+
/** 仅当前场景工作区保留最大化状态;原位置独立保存,供还原时使用。 */
|
|
2670
|
+
flowPanelMaximized = false;
|
|
2649
2671
|
panelResizeFrom;
|
|
2650
2672
|
panelResizeAnimation;
|
|
2651
2673
|
observedFlow;
|
|
@@ -2725,6 +2747,9 @@ var PageUseLauncherElement = class extends LitElement {
|
|
|
2725
2747
|
get isFlowView() {
|
|
2726
2748
|
return this.view === "flows" || this.view === "manager";
|
|
2727
2749
|
}
|
|
2750
|
+
get isFlowPanelMaximized() {
|
|
2751
|
+
return !this.isMobileLayout && this.isFlowView && this.flowPanelMaximized;
|
|
2752
|
+
}
|
|
2728
2753
|
/**
|
|
2729
2754
|
* 下达指令后是否自动收起面板:仅移动端布局生效,默认开启,可在设置页关闭。
|
|
2730
2755
|
* 桌面端不提供该行为,也不显示设置项,存储中被改过的值在桌面端不生效。
|
|
@@ -2764,7 +2789,7 @@ var PageUseLauncherElement = class extends LitElement {
|
|
|
2764
2789
|
onMove: (dx, dy) => this.onSheetDragMove(dx, dy),
|
|
2765
2790
|
onEnd: ({ cancelled }) => this.onSheetDragEnd(cancelled),
|
|
2766
2791
|
setPos: ({ x, y }) => {
|
|
2767
|
-
if (this.isMobileLayout) return;
|
|
2792
|
+
if (this.isMobileLayout || this.isFlowPanelMaximized) return;
|
|
2768
2793
|
const el = this.panelEl;
|
|
2769
2794
|
if (!el) return;
|
|
2770
2795
|
if (this.isFlowView) {
|
|
@@ -2797,6 +2822,7 @@ var PageUseLauncherElement = class extends LitElement {
|
|
|
2797
2822
|
if (!flow) {
|
|
2798
2823
|
if (this.isFlowView) this.view = "main";
|
|
2799
2824
|
this.flowPanelVisited = false;
|
|
2825
|
+
this.flowPanelMaximized = false;
|
|
2800
2826
|
}
|
|
2801
2827
|
this.requestUpdate();
|
|
2802
2828
|
}),
|
|
@@ -3016,6 +3042,12 @@ var PageUseLauncherElement = class extends LitElement {
|
|
|
3016
3042
|
if (this.isMobileLayout) return "";
|
|
3017
3043
|
const rect = this.fabRect(settings);
|
|
3018
3044
|
const { width: vw, height: vh } = this.viewport;
|
|
3045
|
+
if (this.isFlowPanelMaximized) return toStyle({
|
|
3046
|
+
left: "0px",
|
|
3047
|
+
top: "0px",
|
|
3048
|
+
width: `${vw}px`,
|
|
3049
|
+
height: `${vh}px`
|
|
3050
|
+
});
|
|
3019
3051
|
const { alignRight, alignBottom } = this.panelAnchor;
|
|
3020
3052
|
const width = Math.min(this.isFlowView ? FLOW_PANEL_WIDTH : PANEL_WIDTH, Math.max(0, vw - 2 * 8));
|
|
3021
3053
|
const maxOffsetX = Math.max(8, vw - width - 8);
|
|
@@ -3090,6 +3122,8 @@ var PageUseLauncherElement = class extends LitElement {
|
|
|
3090
3122
|
stopPreview();
|
|
3091
3123
|
this.open = false;
|
|
3092
3124
|
this.view = "main";
|
|
3125
|
+
this.flowPanelMaximized = false;
|
|
3126
|
+
this.flowPanelPosition = void 0;
|
|
3093
3127
|
this.presetDraft = null;
|
|
3094
3128
|
hidePageUseLauncher();
|
|
3095
3129
|
}
|
|
@@ -3100,23 +3134,16 @@ var PageUseLauncherElement = class extends LitElement {
|
|
|
3100
3134
|
this.titleTaps.push(now);
|
|
3101
3135
|
if (this.titleTaps.length < META_UNLOCK_CLICKS) return;
|
|
3102
3136
|
this.titleTaps = [];
|
|
3103
|
-
this.
|
|
3104
|
-
this.requestUpdate();
|
|
3137
|
+
this.switchView("meta");
|
|
3105
3138
|
}
|
|
3106
3139
|
/** 切换面板视图:离开设置页时中止音色试听,离开快捷指令编辑时丢弃未保存的草稿 */
|
|
3107
3140
|
switchView(next) {
|
|
3108
3141
|
const nextIsFlow = next === "flows" || next === "manager";
|
|
3109
|
-
if (this.open && !this.isMobileLayout && this.isFlowView !== nextIsFlow)
|
|
3110
|
-
|
|
3111
|
-
this.
|
|
3112
|
-
|
|
3113
|
-
left: rect.left,
|
|
3114
|
-
top: rect.top,
|
|
3115
|
-
width: rect.width,
|
|
3116
|
-
height: rect.height
|
|
3117
|
-
};
|
|
3142
|
+
if (this.open && !this.isMobileLayout && this.isFlowView !== nextIsFlow) this.preparePanelResize();
|
|
3143
|
+
if (!nextIsFlow) {
|
|
3144
|
+
this.flowPanelMaximized = false;
|
|
3145
|
+
this.flowPanelPosition = void 0;
|
|
3118
3146
|
}
|
|
3119
|
-
if (this.isFlowView && next !== "flows" && next !== "manager") this.flowPanelPosition = void 0;
|
|
3120
3147
|
if (this.view === "settings" && next !== "settings") stopPreview();
|
|
3121
3148
|
if (this.view === "presets" && next !== "presets") this.presetDraft = null;
|
|
3122
3149
|
if (next === "flows" || next === "manager") {
|
|
@@ -3127,6 +3154,22 @@ var PageUseLauncherElement = class extends LitElement {
|
|
|
3127
3154
|
this.view = next;
|
|
3128
3155
|
this.requestUpdate();
|
|
3129
3156
|
}
|
|
3157
|
+
toggleFlowPanelMaximized() {
|
|
3158
|
+
if (this.isMobileLayout || !this.isFlowView) return;
|
|
3159
|
+
this.preparePanelResize();
|
|
3160
|
+
this.flowPanelMaximized = !this.flowPanelMaximized;
|
|
3161
|
+
this.requestUpdate();
|
|
3162
|
+
}
|
|
3163
|
+
preparePanelResize() {
|
|
3164
|
+
const rect = this.panelEl?.getBoundingClientRect();
|
|
3165
|
+
this.cancelPanelResize();
|
|
3166
|
+
if (rect?.width && rect.height) this.panelResizeFrom = {
|
|
3167
|
+
left: rect.left,
|
|
3168
|
+
top: rect.top,
|
|
3169
|
+
width: rect.width,
|
|
3170
|
+
height: rect.height
|
|
3171
|
+
};
|
|
3172
|
+
}
|
|
3130
3173
|
cancelPanelResize() {
|
|
3131
3174
|
this.panelResizeFrom = void 0;
|
|
3132
3175
|
this.panelResizeAnimation?.cancel();
|
|
@@ -3158,6 +3201,7 @@ var PageUseLauncherElement = class extends LitElement {
|
|
|
3158
3201
|
}
|
|
3159
3202
|
onPanelPointerDown = (event) => {
|
|
3160
3203
|
this.cancelPanelResize();
|
|
3204
|
+
if (this.isFlowPanelMaximized) return;
|
|
3161
3205
|
this.panelDrag.onPointerDown(event);
|
|
3162
3206
|
};
|
|
3163
3207
|
/** 在面板内显示轻提示,TOAST_DURATION_MS 后自动消失;连续触发时以最后一次为准并重新计时 */
|
|
@@ -4028,7 +4072,7 @@ var PageUseLauncherElement = class extends LitElement {
|
|
|
4028
4072
|
</button>
|
|
4029
4073
|
|
|
4030
4074
|
<section
|
|
4031
|
-
class="panel ${running ? "running" : ""} ${this.isMobileLayout ? "mobile" : ""}"
|
|
4075
|
+
class="panel ${running ? "running" : ""} ${this.isMobileLayout ? "mobile" : ""} ${this.isFlowPanelMaximized ? "maximized" : ""}"
|
|
4032
4076
|
?hidden=${!this.open}
|
|
4033
4077
|
style=${this.open ? this.panelStyle(settings) : ""}
|
|
4034
4078
|
>
|
|
@@ -4059,6 +4103,16 @@ var PageUseLauncherElement = class extends LitElement {
|
|
|
4059
4103
|
<button type="button" class="icon-btn" title="收起" @click=${() => void this.collapse()}>
|
|
4060
4104
|
${collapseIcon}
|
|
4061
4105
|
</button>
|
|
4106
|
+
${!this.isMobileLayout && this.isFlowView ? html`
|
|
4107
|
+
<button
|
|
4108
|
+
type="button"
|
|
4109
|
+
class="icon-btn maximize-toggle"
|
|
4110
|
+
title=${this.isFlowPanelMaximized ? "还原" : "最大化"}
|
|
4111
|
+
aria-label=${this.isFlowPanelMaximized ? "还原" : "最大化"}
|
|
4112
|
+
@click=${() => this.toggleFlowPanelMaximized()}
|
|
4113
|
+
>
|
|
4114
|
+
${this.isFlowPanelMaximized ? restoreIcon : maximizeIcon}
|
|
4115
|
+
</button>` : nothing}
|
|
4062
4116
|
<button
|
|
4063
4117
|
type="button"
|
|
4064
4118
|
class="icon-btn close"
|
|
@@ -355,6 +355,8 @@ function normalizeOptions(options) {
|
|
|
355
355
|
model: (llm.model || "").trim() || "deepseek-chat",
|
|
356
356
|
maxSteps: llm.maxSteps && llm.maxSteps > 0 ? llm.maxSteps : 20,
|
|
357
357
|
disableNamedToolChoice: Boolean(llm.disableNamedToolChoice),
|
|
358
|
+
stream: llm.stream === true,
|
|
359
|
+
streamOptions: typeof llm.streamOptions?.includeUsage === "boolean" ? { includeUsage: llm.streamOptions.includeUsage } : {},
|
|
358
360
|
extraBody: llm.extraBody && typeof llm.extraBody === "object" ? llm.extraBody : {},
|
|
359
361
|
sessionHeader: resolveSessionHeader(llm.sessionHeader)
|
|
360
362
|
},
|
|
@@ -1874,6 +1876,281 @@ function buildPageInstruction(options, outlineText = "", openedUrls = []) {
|
|
|
1874
1876
|
return parts.length ? parts.join("\n") : null;
|
|
1875
1877
|
}
|
|
1876
1878
|
|
|
1879
|
+
//#endregion
|
|
1880
|
+
//#region src/core/llmTransport.ts
|
|
1881
|
+
const MAX_STREAM_BYTES = 8388608;
|
|
1882
|
+
const MAX_STREAM_ITEMS = 32;
|
|
1883
|
+
function record(value) {
|
|
1884
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1885
|
+
}
|
|
1886
|
+
function invalid(message) {
|
|
1887
|
+
return /* @__PURE__ */ new Error(`[PageUse SSE] ${message}`);
|
|
1888
|
+
}
|
|
1889
|
+
/** 正式流式配置最后写入,extraBody/宿主变换不能单独开启无解析器的 SSE。 */
|
|
1890
|
+
function completionRequestBody(body, llm) {
|
|
1891
|
+
const { stream: _stream, stream_options: _options, ...rest } = body;
|
|
1892
|
+
return {
|
|
1893
|
+
...rest,
|
|
1894
|
+
stream: llm.stream,
|
|
1895
|
+
...llm.stream && typeof llm.streamOptions.includeUsage === "boolean" ? { stream_options: { include_usage: llm.streamOptions.includeUsage } } : {}
|
|
1896
|
+
};
|
|
1897
|
+
}
|
|
1898
|
+
function index(value) {
|
|
1899
|
+
if (!Number.isSafeInteger(value) || value < 0 || value >= MAX_STREAM_ITEMS) throw invalid("无效的 choice/tool_calls index");
|
|
1900
|
+
return value;
|
|
1901
|
+
}
|
|
1902
|
+
function appendFunction(target, delta) {
|
|
1903
|
+
if (!record(delta)) throw invalid("无效的工具 function");
|
|
1904
|
+
for (const field of ["name", "arguments"]) {
|
|
1905
|
+
const part = delta[field];
|
|
1906
|
+
if (part !== void 0) {
|
|
1907
|
+
if (typeof part !== "string") throw invalid(`工具 ${field} 不是字符串`);
|
|
1908
|
+
target[field] += part;
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
function validateFunction(call) {
|
|
1913
|
+
if (!call.name || !call.arguments) throw invalid("工具名称或参数不完整");
|
|
1914
|
+
try {
|
|
1915
|
+
JSON.parse(call.arguments);
|
|
1916
|
+
} catch {
|
|
1917
|
+
throw invalid("工具参数不是完整 JSON");
|
|
1918
|
+
}
|
|
1919
|
+
}
|
|
1920
|
+
/** 只有 [DONE] 与各 choice 的正常 finish_reason 均已收到,才交付完整响应。 */
|
|
1921
|
+
async function readEventStream(response, signal) {
|
|
1922
|
+
signal?.throwIfAborted();
|
|
1923
|
+
if (!response.body) throw invalid("响应没有可读流");
|
|
1924
|
+
const reader = response.body.getReader();
|
|
1925
|
+
const decoder = new TextDecoder("utf-8", { fatal: true });
|
|
1926
|
+
const choices = /* @__PURE__ */ new Map();
|
|
1927
|
+
const metadata = { object: "chat.completion" };
|
|
1928
|
+
let usage;
|
|
1929
|
+
let buffer = "";
|
|
1930
|
+
let data = [];
|
|
1931
|
+
let eventName = "";
|
|
1932
|
+
let ended = false;
|
|
1933
|
+
let bytes = 0;
|
|
1934
|
+
const cancel = () => {
|
|
1935
|
+
reader.cancel().catch(() => {});
|
|
1936
|
+
};
|
|
1937
|
+
signal?.addEventListener("abort", cancel, { once: true });
|
|
1938
|
+
function acceptChunk(chunk) {
|
|
1939
|
+
if (!record(chunk)) throw invalid("事件不是 JSON 对象");
|
|
1940
|
+
if (chunk.error) throw invalid(record(chunk.error) && typeof chunk.error.message === "string" ? chunk.error.message.slice(0, 500) : "网关返回错误事件");
|
|
1941
|
+
for (const key of [
|
|
1942
|
+
"id",
|
|
1943
|
+
"model",
|
|
1944
|
+
"created",
|
|
1945
|
+
"system_fingerprint",
|
|
1946
|
+
"service_tier"
|
|
1947
|
+
]) if (chunk[key] !== void 0) metadata[key] = chunk[key];
|
|
1948
|
+
if (chunk.usage != null) {
|
|
1949
|
+
if (!record(chunk.usage)) throw invalid("无效的 usage");
|
|
1950
|
+
usage = chunk.usage;
|
|
1951
|
+
}
|
|
1952
|
+
if (!Array.isArray(chunk.choices)) throw invalid("事件缺少 choices");
|
|
1953
|
+
for (const item of chunk.choices) {
|
|
1954
|
+
if (!record(item)) throw invalid("无效的 choice");
|
|
1955
|
+
const id = index(item.index);
|
|
1956
|
+
let pending = choices.get(id);
|
|
1957
|
+
if (!pending) {
|
|
1958
|
+
pending = {
|
|
1959
|
+
choice: {
|
|
1960
|
+
index: id,
|
|
1961
|
+
message: {
|
|
1962
|
+
role: "assistant",
|
|
1963
|
+
content: null
|
|
1964
|
+
},
|
|
1965
|
+
finish_reason: null
|
|
1966
|
+
},
|
|
1967
|
+
tools: /* @__PURE__ */ new Map()
|
|
1968
|
+
};
|
|
1969
|
+
choices.set(id, pending);
|
|
1970
|
+
}
|
|
1971
|
+
if (pending.choice.finish_reason !== null) throw invalid("choice 结束后仍收到增量");
|
|
1972
|
+
const delta = item.delta;
|
|
1973
|
+
if (!record(delta)) throw invalid("choice 缺少 delta");
|
|
1974
|
+
const message = pending.choice.message;
|
|
1975
|
+
if (delta.role != null && delta.role !== "assistant") throw invalid("无效的响应 role");
|
|
1976
|
+
if (delta.content != null) {
|
|
1977
|
+
if (typeof delta.content !== "string") throw invalid("content 不是字符串");
|
|
1978
|
+
message.content = (message.content ?? "") + delta.content;
|
|
1979
|
+
}
|
|
1980
|
+
if (delta.refusal) throw invalid("模型拒绝了请求");
|
|
1981
|
+
if (delta.function_call != null) {
|
|
1982
|
+
message.function_call ??= {
|
|
1983
|
+
name: "",
|
|
1984
|
+
arguments: ""
|
|
1985
|
+
};
|
|
1986
|
+
appendFunction(message.function_call, delta.function_call);
|
|
1987
|
+
}
|
|
1988
|
+
if (delta.tool_calls != null) {
|
|
1989
|
+
if (!Array.isArray(delta.tool_calls)) throw invalid("无效的 tool_calls");
|
|
1990
|
+
for (const tool of delta.tool_calls) {
|
|
1991
|
+
if (!record(tool)) throw invalid("无效的工具增量");
|
|
1992
|
+
const toolIndex = index(tool.index);
|
|
1993
|
+
let call = pending.tools.get(toolIndex);
|
|
1994
|
+
if (!call) {
|
|
1995
|
+
call = { function: {
|
|
1996
|
+
name: "",
|
|
1997
|
+
arguments: ""
|
|
1998
|
+
} };
|
|
1999
|
+
pending.tools.set(toolIndex, call);
|
|
2000
|
+
}
|
|
2001
|
+
for (const field of ["id", "type"]) if (tool[field] !== void 0) {
|
|
2002
|
+
if (typeof tool[field] !== "string" || call[field] !== void 0 && call[field] !== tool[field]) throw invalid(`工具 ${field} 不一致`);
|
|
2003
|
+
call[field] = tool[field];
|
|
2004
|
+
}
|
|
2005
|
+
if (tool.function !== void 0) appendFunction(call.function, tool.function);
|
|
2006
|
+
}
|
|
2007
|
+
}
|
|
2008
|
+
if (item.finish_reason != null) {
|
|
2009
|
+
if (![
|
|
2010
|
+
"stop",
|
|
2011
|
+
"tool_calls",
|
|
2012
|
+
"function_call",
|
|
2013
|
+
"length",
|
|
2014
|
+
"content_filter"
|
|
2015
|
+
].includes(String(item.finish_reason))) throw invalid(`异常结束:${item.finish_reason}`);
|
|
2016
|
+
pending.choice.finish_reason = String(item.finish_reason);
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
function line(text) {
|
|
2021
|
+
if (text === "") {
|
|
2022
|
+
if (eventName === "error") throw invalid("网关返回 error 事件");
|
|
2023
|
+
if (data.length) {
|
|
2024
|
+
const payload = data.join("\n");
|
|
2025
|
+
if (payload.trim() === "[DONE]") ended = true;
|
|
2026
|
+
else {
|
|
2027
|
+
let chunk;
|
|
2028
|
+
try {
|
|
2029
|
+
chunk = JSON.parse(payload);
|
|
2030
|
+
} catch {
|
|
2031
|
+
throw invalid("事件不是完整 JSON");
|
|
2032
|
+
}
|
|
2033
|
+
acceptChunk(chunk);
|
|
2034
|
+
}
|
|
2035
|
+
}
|
|
2036
|
+
data = [];
|
|
2037
|
+
eventName = "";
|
|
2038
|
+
return;
|
|
2039
|
+
}
|
|
2040
|
+
if (text.startsWith(":")) return;
|
|
2041
|
+
const colon = text.indexOf(":");
|
|
2042
|
+
const field = colon < 0 ? text : text.slice(0, colon);
|
|
2043
|
+
const value = colon < 0 ? "" : text.slice(colon + 1).replace(/^ /, "");
|
|
2044
|
+
if (field === "data") data.push(value);
|
|
2045
|
+
if (field === "event") eventName = value;
|
|
2046
|
+
}
|
|
2047
|
+
function consume(text, final = false) {
|
|
2048
|
+
buffer += text;
|
|
2049
|
+
while (!ended) {
|
|
2050
|
+
const end = buffer.search(/[\r\n]/);
|
|
2051
|
+
if (end < 0 || !final && buffer[end] === "\r" && end === buffer.length - 1) break;
|
|
2052
|
+
const size = buffer[end] === "\r" && buffer[end + 1] === "\n" ? 2 : 1;
|
|
2053
|
+
const current = buffer.slice(0, end);
|
|
2054
|
+
buffer = buffer.slice(end + size);
|
|
2055
|
+
line(current);
|
|
2056
|
+
}
|
|
2057
|
+
}
|
|
2058
|
+
try {
|
|
2059
|
+
while (!ended) {
|
|
2060
|
+
signal?.throwIfAborted();
|
|
2061
|
+
const next = await reader.read();
|
|
2062
|
+
signal?.throwIfAborted();
|
|
2063
|
+
if (next.done) {
|
|
2064
|
+
consume(decoder.decode(), true);
|
|
2065
|
+
break;
|
|
2066
|
+
}
|
|
2067
|
+
bytes += next.value.byteLength;
|
|
2068
|
+
if (bytes > MAX_STREAM_BYTES) throw invalid("响应超过 8 MiB 限制");
|
|
2069
|
+
consume(decoder.decode(next.value, { stream: true }));
|
|
2070
|
+
}
|
|
2071
|
+
signal?.throwIfAborted();
|
|
2072
|
+
if (!ended || !choices.size || !choices.has(0)) throw invalid("流在完整结束标记前中断");
|
|
2073
|
+
const result = [];
|
|
2074
|
+
for (const [id, pending] of [...choices].sort(([a], [b]) => a - b)) {
|
|
2075
|
+
if (id !== result.length || !pending.choice.finish_reason) throw invalid("choice 不完整");
|
|
2076
|
+
const failed = ["length", "content_filter"].includes(pending.choice.finish_reason);
|
|
2077
|
+
if (pending.tools.size) pending.choice.message.tool_calls = [...pending.tools].sort(([a], [b]) => a - b).map(([id, call], position) => {
|
|
2078
|
+
if (id !== position || !call.id || call.type !== "function") throw invalid("工具调用不完整");
|
|
2079
|
+
if (!failed) validateFunction(call.function);
|
|
2080
|
+
return call;
|
|
2081
|
+
});
|
|
2082
|
+
if (!failed && pending.choice.message.function_call) validateFunction(pending.choice.message.function_call);
|
|
2083
|
+
result.push(pending.choice);
|
|
2084
|
+
}
|
|
2085
|
+
return {
|
|
2086
|
+
...metadata,
|
|
2087
|
+
choices: result,
|
|
2088
|
+
...usage ? { usage } : {}
|
|
2089
|
+
};
|
|
2090
|
+
} finally {
|
|
2091
|
+
signal?.removeEventListener("abort", cancel);
|
|
2092
|
+
cancel();
|
|
2093
|
+
reader.releaseLock();
|
|
2094
|
+
}
|
|
2095
|
+
}
|
|
2096
|
+
/** JSON 回退保持兼容;SSE 必须完整读取,取消后绝不返回聚合结果。 */
|
|
2097
|
+
async function readCompletionResponse(response, signal, forAgent = false) {
|
|
2098
|
+
if (signal?.aborted) {
|
|
2099
|
+
response.body?.cancel().catch(() => {});
|
|
2100
|
+
signal.throwIfAborted();
|
|
2101
|
+
}
|
|
2102
|
+
const result = response.headers?.get("content-type")?.split(";")[0].trim().toLowerCase() === "text/event-stream" ? await readEventStream(response, signal) : await response.json();
|
|
2103
|
+
signal?.throwIfAborted();
|
|
2104
|
+
if (record(result) && Array.isArray(result.choices)) {
|
|
2105
|
+
for (const choice of result.choices) if (!forAgent && record(choice) && choice.finish_reason != null && ![
|
|
2106
|
+
"stop",
|
|
2107
|
+
"tool_calls",
|
|
2108
|
+
"function_call"
|
|
2109
|
+
].includes(String(choice.finish_reason))) throw invalid(`异常结束:${choice.finish_reason}`);
|
|
2110
|
+
}
|
|
2111
|
+
return result;
|
|
2112
|
+
}
|
|
2113
|
+
/** 仅包装当前 agent 的 Response;不修改全局 fetch,也不改上游依赖。 */
|
|
2114
|
+
function agentCompletionResponse(response, signal) {
|
|
2115
|
+
if (!response.ok) return response;
|
|
2116
|
+
const headers = new Headers(response.headers);
|
|
2117
|
+
headers.set("content-type", "application/json");
|
|
2118
|
+
headers.delete("content-length");
|
|
2119
|
+
headers.delete("content-encoding");
|
|
2120
|
+
const aggregation = new AbortController();
|
|
2121
|
+
const abort = () => aggregation.abort(signal?.reason);
|
|
2122
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
2123
|
+
if (signal?.aborted) abort();
|
|
2124
|
+
const body = new ReadableStream({
|
|
2125
|
+
async start(controller) {
|
|
2126
|
+
try {
|
|
2127
|
+
const completion = await readCompletionResponse(response, aggregation.signal, true);
|
|
2128
|
+
const message = completion.choices[0]?.message;
|
|
2129
|
+
if (completion.choices.length !== 1 || (message?.tool_calls?.length ?? 0) > 1 || message?.function_call && message.tool_calls?.length) throw invalid("agent 每轮只允许一个 choice 和一个工具调用");
|
|
2130
|
+
if (!["length", "content_filter"].includes(completion.choices[0]?.finish_reason ?? "")) {
|
|
2131
|
+
for (const call of message?.tool_calls ?? []) validateFunction(call.function);
|
|
2132
|
+
if (message?.function_call) validateFunction(message.function_call);
|
|
2133
|
+
}
|
|
2134
|
+
aggregation.signal.throwIfAborted();
|
|
2135
|
+
controller.enqueue(new TextEncoder().encode(JSON.stringify(completion)));
|
|
2136
|
+
controller.close();
|
|
2137
|
+
} catch (error) {
|
|
2138
|
+
controller.error(error);
|
|
2139
|
+
} finally {
|
|
2140
|
+
signal?.removeEventListener("abort", abort);
|
|
2141
|
+
}
|
|
2142
|
+
},
|
|
2143
|
+
cancel() {
|
|
2144
|
+
aggregation.abort(new DOMException("响应读取已取消", "AbortError"));
|
|
2145
|
+
}
|
|
2146
|
+
});
|
|
2147
|
+
return new Response(body, {
|
|
2148
|
+
status: response.status,
|
|
2149
|
+
statusText: response.statusText,
|
|
2150
|
+
headers
|
|
2151
|
+
});
|
|
2152
|
+
}
|
|
2153
|
+
|
|
1877
2154
|
//#endregion
|
|
1878
2155
|
//#region src/core/createPageUseAgent.ts
|
|
1879
2156
|
/**
|
|
@@ -1914,21 +2191,19 @@ function createPageUseAgent({ options, enableMask, narration = false, shouldRunB
|
|
|
1914
2191
|
const { llm } = options;
|
|
1915
2192
|
if (!llm.baseURL) throw new Error("[PageUse] 未配置 llm.baseURL");
|
|
1916
2193
|
let sessionId = newSessionId();
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
*/
|
|
1921
|
-
const customFetch =
|
|
2194
|
+
const extraBody = llm.extraBody;
|
|
2195
|
+
const hostBeforeTask = options.beforeTask;
|
|
2196
|
+
const hostPageAgent = options.pageAgentOptions;
|
|
2197
|
+
/** 注入任务会话头;浏览器禁止修改 User-Agent,需要时仍由代理补充。 */
|
|
2198
|
+
const customFetch = async (input, init) => {
|
|
1922
2199
|
const headers = new Headers(init?.headers);
|
|
1923
|
-
headers.set(llm.sessionHeader, sessionId);
|
|
1924
|
-
|
|
2200
|
+
if (llm.sessionHeader) headers.set(llm.sessionHeader, sessionId);
|
|
2201
|
+
const response = await (hostPageAgent.customFetch ?? fetch)(input, {
|
|
1925
2202
|
...init,
|
|
1926
2203
|
headers
|
|
1927
2204
|
});
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
const hostBeforeTask = options.beforeTask;
|
|
1931
|
-
const hostPageAgent = options.pageAgentOptions;
|
|
2205
|
+
return llm.stream ? agentCompletionResponse(response, init?.signal) : response;
|
|
2206
|
+
};
|
|
1932
2207
|
const tour = options.pageTour.enabled ? createPageTour({
|
|
1933
2208
|
getContentRoot: options.getContentRoot,
|
|
1934
2209
|
maxTabSwitches: options.pageTour.maxTabSwitches,
|
|
@@ -1944,11 +2219,6 @@ function createPageUseAgent({ options, enableMask, narration = false, shouldRunB
|
|
|
1944
2219
|
language: "zh-CN",
|
|
1945
2220
|
maxSteps: llm.maxSteps,
|
|
1946
2221
|
disableNamedToolChoice: llm.disableNamedToolChoice,
|
|
1947
|
-
customFetch,
|
|
1948
|
-
transformRequestBody: Object.keys(extraBody).length ? (body) => ({
|
|
1949
|
-
...body,
|
|
1950
|
-
...extraBody
|
|
1951
|
-
}) : void 0,
|
|
1952
2222
|
stepDelay: STEP_DELAY_SECONDS,
|
|
1953
2223
|
promptForNextTask: false,
|
|
1954
2224
|
enableMask,
|
|
@@ -1962,6 +2232,15 @@ function createPageUseAgent({ options, enableMask, narration = false, shouldRunB
|
|
|
1962
2232
|
return `${content.slice(0, PAGE_CONTENT_MAX_CHARS)}\n...(页面内容过长已截断,可滚动后再观察)`;
|
|
1963
2233
|
},
|
|
1964
2234
|
...hostPageAgent,
|
|
2235
|
+
customFetch,
|
|
2236
|
+
transformRequestBody: (body) => {
|
|
2237
|
+
const merged = {
|
|
2238
|
+
...body,
|
|
2239
|
+
...extraBody
|
|
2240
|
+
};
|
|
2241
|
+
const transformed = hostPageAgent.transformRequestBody?.(merged) ?? merged;
|
|
2242
|
+
return completionRequestBody(transformed, llm);
|
|
2243
|
+
},
|
|
1965
2244
|
customTools: {
|
|
1966
2245
|
[CLICK_TOOL_NAME]: createClickTool(newWindows),
|
|
1967
2246
|
...tour ? { [PRESENT_PAGE_TOOL_NAME]: tour.tool } : {},
|
|
@@ -4933,10 +5212,9 @@ function createRegionSelector(llm) {
|
|
|
4933
5212
|
method: "POST",
|
|
4934
5213
|
headers,
|
|
4935
5214
|
signal,
|
|
4936
|
-
body: JSON.stringify({
|
|
5215
|
+
body: JSON.stringify(completionRequestBody({
|
|
4937
5216
|
...extra,
|
|
4938
5217
|
model: llm.model,
|
|
4939
|
-
stream: false,
|
|
4940
5218
|
temperature: 0,
|
|
4941
5219
|
messages: [{
|
|
4942
5220
|
role: "system",
|
|
@@ -4950,10 +5228,10 @@ function createRegionSelector(llm) {
|
|
|
4950
5228
|
}],
|
|
4951
5229
|
tools: [],
|
|
4952
5230
|
tool_choice: "none"
|
|
4953
|
-
})
|
|
5231
|
+
}, llm))
|
|
4954
5232
|
});
|
|
4955
5233
|
if (!response.ok) throw new FlowError("REGION_SELECTION_INVALID", `区域模型请求失败(HTTP ${response.status})`);
|
|
4956
|
-
const message = (await response
|
|
5234
|
+
const message = (await readCompletionResponse(response, signal)).choices?.[0]?.message;
|
|
4957
5235
|
if (message?.tool_calls?.length || message?.function_call) throw new FlowError("REGION_SELECTION_INVALID", "区域模型返回了工具调用");
|
|
4958
5236
|
try {
|
|
4959
5237
|
const value = JSON.parse(message?.content ?? "");
|
|
@@ -5017,10 +5295,9 @@ function createCompletionEvaluator(llm) {
|
|
|
5017
5295
|
method: "POST",
|
|
5018
5296
|
headers,
|
|
5019
5297
|
signal,
|
|
5020
|
-
body: JSON.stringify({
|
|
5298
|
+
body: JSON.stringify(completionRequestBody({
|
|
5021
5299
|
...extra,
|
|
5022
5300
|
model: llm.model,
|
|
5023
|
-
stream: false,
|
|
5024
5301
|
temperature: 0,
|
|
5025
5302
|
tools: [],
|
|
5026
5303
|
tool_choice: "none",
|
|
@@ -5036,10 +5313,10 @@ function createCompletionEvaluator(llm) {
|
|
|
5036
5313
|
record: request.record
|
|
5037
5314
|
})
|
|
5038
5315
|
}]
|
|
5039
|
-
})
|
|
5316
|
+
}, llm))
|
|
5040
5317
|
});
|
|
5041
5318
|
if (!response.ok) throw new FlowError("CHECK_UNCERTAIN", `完成检查模型请求失败(HTTP ${response.status})`);
|
|
5042
|
-
const message = (await response
|
|
5319
|
+
const message = (await readCompletionResponse(response, signal)).choices?.[0]?.message;
|
|
5043
5320
|
if (message?.tool_calls?.length || message?.function_call) throw new FlowError("CHECK_UNCERTAIN", "完成检查模型返回了工具调用");
|
|
5044
5321
|
try {
|
|
5045
5322
|
const value = JSON.parse(message?.content ?? "");
|
|
@@ -5875,6 +6152,21 @@ const managerStyles = css`
|
|
|
5875
6152
|
.step-row .step-select[aria-current='step'] { border-color: var(--primary-solid); color: var(--primary-solid); background: #edf5ff; }
|
|
5876
6153
|
.ordered-item { padding: 14px 0; border-bottom: 1px solid var(--border); }
|
|
5877
6154
|
.ordered-item > * + * { margin-top: 10px; }
|
|
6155
|
+
/* 操作和段落共用边框与标题带,区分条目之间和内部字段的层级。 */
|
|
6156
|
+
.editor-item { padding: 16px; border: 1px solid var(--border); border-radius: 8px; background: #fff; scroll-margin-block: 16px; }
|
|
6157
|
+
.editor-item + .editor-item { margin-top: 20px; }
|
|
6158
|
+
.editor-item > * + * { margin-top: 14px; }
|
|
6159
|
+
.editor-item > .section-head:first-child { margin: -16px -16px 16px; padding: 10px 16px; border-bottom: 1px solid var(--border); border-radius: 7px 7px 0 0; background: var(--soft); }
|
|
6160
|
+
.editor-item-heading { margin: 0; color: var(--primary-solid); font-size: 15px; font-weight: 600; }
|
|
6161
|
+
.editor-item:focus-within { border-color: var(--primary-solid); }
|
|
6162
|
+
.collapsible-item .editor-item-heading { flex: 1; min-width: 0; }
|
|
6163
|
+
.editor-item-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; }
|
|
6164
|
+
.editor-item-toggle .step-toggle { color: var(--muted); font-weight: 400; }
|
|
6165
|
+
.editor-item > .editor-item-body { margin-top: 0; }
|
|
6166
|
+
.editor-item-body > * + * { margin-top: 14px; }
|
|
6167
|
+
/* 隐藏表单而不卸载输入控件,保留未保存内容及内部选项的展开状态。 */
|
|
6168
|
+
.editor-item-body[hidden] { display: none; }
|
|
6169
|
+
.editor-item.is-collapsed > .section-head:first-child { margin-bottom: -16px; border-bottom: 0; border-radius: 7px; }
|
|
5878
6170
|
.parameter { display: grid; grid-template-columns: minmax(90px, 1fr) 145px minmax(120px, 2fr); gap: 8px; align-items: start; padding: 8px 0; }
|
|
5879
6171
|
.parameter-label { padding-top: 7px; overflow-wrap: anywhere; }
|
|
5880
6172
|
.parameter-value { display: flex; flex-direction: column; gap: 6px; }
|
|
@@ -5901,7 +6193,8 @@ const managerStyles = css`
|
|
|
5901
6193
|
.module-alert-stack > .notice > p { flex: 1; min-width: 160px; }
|
|
5902
6194
|
.module-alert-stack > .notice.success { border-bottom-color: #bad8c6; }
|
|
5903
6195
|
.module-alert-stack .actions { margin-top: 0; }
|
|
5904
|
-
|
|
6196
|
+
/* 空状态使用所在区域的可用宽度,避免中文说明在宽屏下提前换行。 */
|
|
6197
|
+
.empty { padding: 40px 12px; }
|
|
5905
6198
|
.empty > * + * { margin-top: 10px; }
|
|
5906
6199
|
.skeleton { height: 48px; margin: 10px 0; border-radius: 5px; background: #eaf0f6; }
|
|
5907
6200
|
/* 与列表条目的标题、终端和状态三行对齐,复用场景页的侧栏宽度。 */
|
|
@@ -5928,6 +6221,14 @@ const managerStyles = css`
|
|
|
5928
6221
|
.speech { white-space: pre-wrap; max-width: 75ch; }
|
|
5929
6222
|
.advanced textarea { font-family: ui-monospace, SFMono-Regular, monospace; font-size: 12px; }
|
|
5930
6223
|
.advanced summary { cursor: pointer; color: var(--muted); }
|
|
6224
|
+
/* 只缩进展开内容,保留原生折叠箭头与标题的间距。 */
|
|
6225
|
+
.action-options { font-size: 13px; }
|
|
6226
|
+
.action-options-fields { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding-top: 12px; padding-inline-start: 18px; }
|
|
6227
|
+
.action-options-fields > .field { flex-direction: row; align-items: center; gap: 8px; max-width: 100%; white-space: nowrap; }
|
|
6228
|
+
.action-options-fields > .field select { width: 160px; }
|
|
6229
|
+
.action-options-fields > .check { min-height: 36px; gap: 8px; line-height: 1.5; }
|
|
6230
|
+
.action-options-fields input[type='checkbox'] { flex: 0 0 16px; height: 16px; padding: 0; margin: 0; }
|
|
6231
|
+
.action-options > .notice { margin-top: 12px; margin-inline-start: 18px; }
|
|
5931
6232
|
button.json-toggle { color: var(--text); font-weight: 600; }
|
|
5932
6233
|
.json-toggle::before { content: '▸'; margin-right: 6px; }
|
|
5933
6234
|
.json-toggle[aria-expanded='true']::before { content: '▾'; }
|
|
@@ -5945,6 +6246,7 @@ const managerStyles = css`
|
|
|
5945
6246
|
:host([data-layout='mobile']) button, :host([data-layout='mobile']) input, :host([data-layout='mobile']) select { min-height: 44px; }
|
|
5946
6247
|
:host([data-layout='mobile']) .exchange-skeleton .skeleton-control, :host([data-layout='mobile']) .exchange-skeleton .skeleton-button { height: 44px; }
|
|
5947
6248
|
:host([data-layout='mobile']) input[type='checkbox'] { min-height: 16px; }
|
|
6249
|
+
:host([data-layout='mobile']) .action-options-fields > .check { min-height: 44px; }
|
|
5948
6250
|
:host([data-layout='mobile']) .parameter { grid-template-columns: 1fr; gap: 5px; }
|
|
5949
6251
|
:host([data-layout='mobile']) .parameter-label { padding: 0; }
|
|
5950
6252
|
@media (max-width: 680px) {
|
|
@@ -6629,6 +6931,8 @@ var PageUseManagerElement = class extends LitElement {
|
|
|
6629
6931
|
record;
|
|
6630
6932
|
/** -1 表示所有步骤收起,展开状态不写入场景配置。 */
|
|
6631
6933
|
selectedStep = 0;
|
|
6934
|
+
/** 折叠仅影响当前表单;按条目对象记录,重排后仍跟随原操作或段落。 */
|
|
6935
|
+
collapsedStepItems = /* @__PURE__ */ new WeakSet();
|
|
6632
6936
|
knowledgeDraft;
|
|
6633
6937
|
knowledgeRecord;
|
|
6634
6938
|
dirty = false;
|
|
@@ -7585,11 +7889,7 @@ var PageUseManagerElement = class extends LitElement {
|
|
|
7585
7889
|
${step.actions.map((action, index) => this.renderAction(step, action, index))}
|
|
7586
7890
|
</section>
|
|
7587
7891
|
<section class="block"><div class="section-head"><h3>完成检查(可选)</h3><button ?disabled=${this.disabled} @click=${() => this.addCheck(step)}>添加检查</button></div><p class="hint">默认不配置,页面操作成功后开始讲解。需要额外核验时描述只读完成条件;检查不能执行页面操作,所有条件满足后才讲解。</p>${step.ready.map((check, index) => this.renderCheck(step, check, index))}</section>
|
|
7588
|
-
<section class="block"><div class="section-head"><h3>讲解段落</h3><button ?disabled=${this.disabled} data-testid="add-segment" @click=${() => this.
|
|
7589
|
-
id: id("segment"),
|
|
7590
|
-
baseText: "",
|
|
7591
|
-
allowPolish: true
|
|
7592
|
-
}))}>添加段落</button></div>${step.segments.map((segment, index) => this.renderSegment(step, segment, index))}</section>` : scene.steps.length ? nothing : html`<div class="empty"><p>先添加第一个业务步骤。</p><p class="muted">每一步可以包含页面操作、就绪检查和多段讲解。</p></div>`}</div>`;
|
|
7892
|
+
<section class="block"><div class="section-head"><h3>讲解段落</h3><button ?disabled=${this.disabled} data-testid="add-segment" @click=${() => void this.addSegment(step)}>添加段落</button></div>${step.segments.map((segment, index) => this.renderSegment(step, segment, index))}</section>` : scene.steps.length ? nothing : html`<div class="empty"><p>先添加第一个业务步骤。</p><p class="muted">每一步可以包含页面操作、就绪检查和多段讲解。</p></div>`}</div>`;
|
|
7593
7893
|
}
|
|
7594
7894
|
addStep() {
|
|
7595
7895
|
this.flushTextFields();
|
|
@@ -7617,11 +7917,14 @@ var PageUseManagerElement = class extends LitElement {
|
|
|
7617
7917
|
});
|
|
7618
7918
|
}
|
|
7619
7919
|
addAction(step) {
|
|
7920
|
+
if (this.disabled) return;
|
|
7620
7921
|
this.flushTextFields();
|
|
7621
|
-
|
|
7922
|
+
const action = {
|
|
7622
7923
|
id: id("action"),
|
|
7623
7924
|
task: ""
|
|
7624
|
-
}
|
|
7925
|
+
};
|
|
7926
|
+
this.edit(() => step.actions.push(action));
|
|
7927
|
+
this.revealAddedStepItem(step, action, "action");
|
|
7625
7928
|
}
|
|
7626
7929
|
addCheck(step) {
|
|
7627
7930
|
this.flushTextFields();
|
|
@@ -7633,15 +7936,48 @@ var PageUseManagerElement = class extends LitElement {
|
|
|
7633
7936
|
pollIntervalMs: 200
|
|
7634
7937
|
}));
|
|
7635
7938
|
}
|
|
7939
|
+
addSegment(step) {
|
|
7940
|
+
if (this.disabled) return;
|
|
7941
|
+
this.flushTextFields();
|
|
7942
|
+
const segment = {
|
|
7943
|
+
id: id("segment"),
|
|
7944
|
+
baseText: "",
|
|
7945
|
+
allowPolish: true
|
|
7946
|
+
};
|
|
7947
|
+
this.edit(() => step.segments.push(segment));
|
|
7948
|
+
this.revealAddedStepItem(step, segment, "segment");
|
|
7949
|
+
}
|
|
7950
|
+
async revealAddedStepItem(step, item, kind) {
|
|
7951
|
+
await this.updateComplete;
|
|
7952
|
+
const items = kind === "action" ? step.actions : step.segments;
|
|
7953
|
+
if (!this.isConnected || this.presentation !== "manager" || this.page !== "steps" || this.scene?.steps[this.selectedStep] !== step || items.at(-1) !== item) return;
|
|
7954
|
+
const attribute = `data-${kind}-id`;
|
|
7955
|
+
const target = [...this.shadowRoot.querySelectorAll(`[${attribute}]`)].find((element) => element.getAttribute(attribute) === item.id);
|
|
7956
|
+
target?.querySelector(`[data-testid="${kind === "action" ? "action-task" : "segment-text"}"]`)?.focus({ preventScroll: true });
|
|
7957
|
+
target?.scrollIntoView?.({
|
|
7958
|
+
block: "start",
|
|
7959
|
+
inline: "nearest",
|
|
7960
|
+
behavior: window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ? "instant" : "smooth"
|
|
7961
|
+
});
|
|
7962
|
+
}
|
|
7963
|
+
toggleStepItem(item) {
|
|
7964
|
+
this.flushTextFields();
|
|
7965
|
+
if (this.collapsedStepItems.has(item)) this.collapsedStepItems.delete(item);
|
|
7966
|
+
else this.collapsedStepItems.add(item);
|
|
7967
|
+
this.requestUpdate();
|
|
7968
|
+
}
|
|
7636
7969
|
renderAction(step, action, index) {
|
|
7637
7970
|
const binding = action.ref ? this.editingBindings?.actions[action.ref] : void 0;
|
|
7638
7971
|
const effect = action.effect || binding?.effect || "query";
|
|
7639
|
-
|
|
7972
|
+
const collapsed = this.collapsedStepItems.has(action);
|
|
7973
|
+
const writeWarning = effect === "write" ? html`<p class="notice warning">此操作会修改业务数据。试讲也会执行操作,运行时须取得宿主允许和使用者确认。</p>` : nothing;
|
|
7974
|
+
return html`<section class="ordered-item editor-item collapsible-item ${collapsed ? "is-collapsed" : ""}" data-action-id=${action.id} aria-label=${`页面操作 ${index + 1}`}><div class="section-head"><h4 class="editor-item-heading"><button type="button" class="editor-item-toggle" aria-expanded=${!collapsed} aria-controls=${`action-body-${action.id}`} @click=${() => this.toggleStepItem(action)}><span>操作 ${index + 1}</span><span class="step-toggle" aria-hidden="true">${collapsed ? "展开" : "收起"}</span></button></h4><div class="actions"><button class="link" ?disabled=${this.disabled || index === 0} @click=${() => {
|
|
7640
7975
|
this.flushTextFields();
|
|
7641
7976
|
this.edit(() => {
|
|
7642
7977
|
step.actions.splice(index - 1, 0, step.actions.splice(index, 1)[0]);
|
|
7643
7978
|
});
|
|
7644
|
-
}}>上移</button><button class="danger link" ?disabled=${this.disabled} @click=${() => this.edit(() => step.actions.splice(index, 1))}>删除</button></div>
|
|
7979
|
+
}}>上移</button><button class="danger link" ?disabled=${this.disabled} @click=${() => this.edit(() => step.actions.splice(index, 1))}>删除</button></div></div>
|
|
7980
|
+
<div class="editor-item-body" id=${`action-body-${action.id}`} ?hidden=${collapsed}>
|
|
7645
7981
|
${action.task !== void 0 ? html`
|
|
7646
7982
|
${this.field("操作指令", action.task, (value) => action.task = value, {
|
|
7647
7983
|
multiline: true,
|
|
@@ -7650,16 +7986,23 @@ var PageUseManagerElement = class extends LitElement {
|
|
|
7650
7986
|
hint: "例如:打开监测事件列表,搜索 {{recordId}},进入对应事件的详情页。"
|
|
7651
7987
|
})}
|
|
7652
7988
|
${Object.keys(this.scene.inputs || {}).length ? html`<p class="hint">可引用参数:${Object.entries(this.scene.inputs || {}).map(([key, input]) => html`<span>${input.label || key} <code>${`{{${key}}}`}</code> </span>`)}</p>` : nothing}
|
|
7653
|
-
<details class="advanced"><summary>操作选项</summary
|
|
7989
|
+
<details class="advanced action-options"><summary>操作选项</summary>
|
|
7990
|
+
<div class="action-options-fields">
|
|
7991
|
+
<label class="field">操作影响<select .value=${effect} ?disabled=${this.disabled} @change=${(event) => this.edit(() => action.effect = inputValue(event))}>${Object.entries(EFFECT_LABEL).map(([value, label]) => html`<option value=${value}>${label}</option>`)}</select></label>
|
|
7992
|
+
<label class="check"><input type="checkbox" .checked=${!!action.repeatable} ?disabled=${this.disabled} @change=${(event) => this.edit(() => action.repeatable = checked(event))}><span>失败后允许重试此操作</span></label>
|
|
7993
|
+
</div>
|
|
7994
|
+
${writeWarning}
|
|
7995
|
+
</details>
|
|
7654
7996
|
` : html`<p>${binding?.label || action.ref}</p><p class="hint">此操作来自已有场景,可继续使用,或重新填写操作指令。</p><button ?disabled=${this.disabled} @click=${() => this.edit(() => {
|
|
7655
7997
|
action.task = "";
|
|
7656
7998
|
action.effect = effect;
|
|
7657
7999
|
action.repeatable = binding?.repeatable;
|
|
7658
8000
|
delete action.ref;
|
|
7659
8001
|
})}>重写操作指令</button>`}
|
|
7660
|
-
${
|
|
8002
|
+
${action.task === void 0 ? writeWarning : nothing}
|
|
7661
8003
|
${action.params || binding?.params ? this.renderParameters(step, action, binding?.params || {}) : nothing}
|
|
7662
|
-
|
|
8004
|
+
</div>
|
|
8005
|
+
</section>`;
|
|
7663
8006
|
}
|
|
7664
8007
|
renderCheck(step, check, index) {
|
|
7665
8008
|
return html`<div class="ordered-item"><div class="section-head"><strong>检查 ${index + 1}</strong><button class="danger link" ?disabled=${this.disabled} @click=${() => this.edit(() => step.ready.splice(index, 1))}>删除</button></div>
|
|
@@ -7768,7 +8111,9 @@ var PageUseManagerElement = class extends LitElement {
|
|
|
7768
8111
|
}
|
|
7769
8112
|
renderSegment(step, segment, index) {
|
|
7770
8113
|
const pickDisabledReason = this.regionPickDisabledReason;
|
|
7771
|
-
|
|
8114
|
+
const collapsed = this.collapsedStepItems.has(segment);
|
|
8115
|
+
return html`<section class="ordered-item editor-item collapsible-item ${collapsed ? "is-collapsed" : ""}" data-segment-id=${segment.id} aria-label=${`讲解段落 ${index + 1}`}><div class="section-head"><h4 class="editor-item-heading"><button type="button" class="editor-item-toggle" aria-expanded=${!collapsed} aria-controls=${`segment-body-${segment.id}`} @click=${() => this.toggleStepItem(segment)}><span>讲解 ${index + 1}</span><span class="step-toggle" aria-hidden="true">${collapsed ? "展开" : "收起"}</span></button></h4><div class="actions"><button class="link" ?disabled=${this.disabled || index === 0} @click=${() => this.edit(() => step.segments.splice(index - 1, 0, step.segments.splice(index, 1)[0]))}>上移</button><button class="danger link" ?disabled=${this.disabled} @click=${() => this.edit(() => step.segments.splice(index, 1))}>删除</button></div></div>
|
|
8116
|
+
<div class="editor-item-body" id=${`segment-body-${segment.id}`} ?hidden=${collapsed}>
|
|
7772
8117
|
${this.flow?.client === "desktop" && this.scene?.client === "desktop" ? html`
|
|
7773
8118
|
<div class="section-head"><strong>展示区域(可选)</strong></div>
|
|
7774
8119
|
<div class="actions"><button title=${pickDisabledReason || "点击当前页面元素即可选定"} ?disabled=${!!pickDisabledReason} @click=${() => this.pickRegion(segment)}>${segment.region ? "重新点选" : "点选区域"}</button>
|
|
@@ -7795,7 +8140,8 @@ var PageUseManagerElement = class extends LitElement {
|
|
|
7795
8140
|
segment.knowledgeRefs = [...refs];
|
|
7796
8141
|
})}>${record.draft.name}<span class="muted">${record.publishedRevision ? "已发布" : "未发布"}</span></label>`) : html`<p class="hint">可在「知识」中维护资料,再关联到当前段。</p>`}
|
|
7797
8142
|
</div>
|
|
7798
|
-
|
|
8143
|
+
</div>
|
|
8144
|
+
</section>`;
|
|
7799
8145
|
}
|
|
7800
8146
|
pickRegion(segment) {
|
|
7801
8147
|
const flow = this.flow;
|
|
@@ -8324,4 +8670,4 @@ async function runPageUseFlowTool(flow, args, options = {}) {
|
|
|
8324
8670
|
}
|
|
8325
8671
|
|
|
8326
8672
|
//#endregion
|
|
8327
|
-
export { showFlowMask as $, parseFlowBundle as A,
|
|
8673
|
+
export { showFlowMask as $, parseFlowBundle as A, SIMULATOR_MASK_ID as At, acquireFlowExecution as B, FLOW_SCHEMA_VERSION as Bt, createIndexedDbFlowRepository as C, DEFAULT_TOUR_MAX_TAB_SWITCHES as Ct, flowSceneDraftSchema as D, listTtsEngines as Dt, flowBundleSchema as E, readLauncherSwitch as Et, sceneKey as F, TOUR_STYLE_TRAINER as Ft, getPageUseSnapshot as G, configurePageUse as H, scopeKey as I, TOUR_STYLE_USER as It, isRunning as J, hideFlowMask as K, validateFlowInputs as L, cancelRegionPicker as Lt, parseFlowRegion as M, browserTtsEngine as Mt, parseFlowScene as N, isSpeechSupported as Nt, flowSceneSchema as O, resolveTtsEngine as Ot, parseFlowSceneDraft as P, DEFAULT_TOUR_STYLES as Pt, runTaskForFlow as Q, validateRegionPreviewInputs as R, hasRegionPicker as Rt, previewFlowImport as S, DEFAULT_STORAGE_KEY_PREFIX as St, cloneJson as T, readLauncherQuery as Tt, getElapsedSeconds as U, clearPageUseLog as V, FlowError as Vt, getPageUseConfig as W, registerQuestionUi as X, pageUseStore as Y, runTask as Z, createFlowApiAdapter as _, pageUseSettings as _t, mountPageUseManager as a, pageUseHistory as at, exportFlowBundle as b, DEFAULT_MODEL as bt, createFlowRegionPicker as c, hideTourHighlight as ct, evaluateFlowCompletion as d, narrationMute as dt, stopTask as et, composedParent as f, registerNarrationPanelName as ft, validateRegionPages as g, DEFAULT_PAGE_USE_SETTINGS as gt, regionAbortable as h, stopPreview as ht, definePageUseManagerElement as i, pageUsePresets as it, parseFlowKnowledge as j, BROWSER_ENGINE_ID as jt, newRevision as k, PAGE_USE_MASK_COLORS as kt, createFlowRunner as l, showTourHighlight as lt, locateFlowRegion as m, startPreview as mt, getPageUseFlowCatalog as n, subscribePageUse as nt, PAGE_USE_MANAGER_TAG as o, completionRequestBody as ot, createRegionSelector as p, previewStore as pt, isPageUseConfigured as q, runPageUseFlowTool as r, updateFlowExecution as rt, PageUseManagerElement as s, readCompletionResponse as st, PAGE_USE_FLOW_TOOL as t, stopTaskForFlow as tt, createCompletionEvaluator as u, narrate as ut, validateFlowApiOptions as v, createStore as vt, FLOW_SEGMENT_MAX_CHARS as w, normalizeOptions as wt, importFlowBundle as x, DEFAULT_SESSION_HEADER as xt, createFlowCloud as y, DEFAULT_MAX_STEPS as yt, validateSceneBindings as z, FLOW_BUNDLE_VERSION as zt };
|
package/dist/vue.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import { A as PageUseGlobal, B as MountPageUseUIOptions, C as getElapsedSeconds, D as pageUseStore, E as isRunning, F as PAGE_USE_TOOL_NAME, G as PageUseLauncherElement, H as mountPageUseUI, I as PageUseCommand, J as createPageUse, K as PageUseLauncherLayout, L as formatPageUseResultForModel, M as showPageUseLauncher, N as PAGE_USE_COMMAND_TYPE, O as ReadonlyStore, P as PAGE_USE_TOOL, R as isPageUseCommand, S as clearPageUseLog, T as isPageUseConfigured, U as PAGE_USE_LAUNCHER_TAG, V as definePageUseElements, W as PageUseLauncherConfig, X as PageUseCapability, Y as getPageUseFlow, Z as pageUseCapability, _ as pageUseSettings, a as PAGE_USE_ROBOT_ICON_SVG, b as PageUseQuestion, c as PageUseCustomPreset, d as pageUsePresets, f as PageUseHistoryEntry, g as PageUseSettings, h as PageUsePoint, i as PageUseGlowElement, j as hidePageUseLauncher, k as PAGE_USE_GLOBAL_KEY, l as PageUsePresetSaveResult, m as DEFAULT_PAGE_USE_SETTINGS, n as SIMULATOR_MASK_ID, o as PAGE_USE_STATIC_PRESETS, p as pageUseHistory, q as PageUseHandle, r as PAGE_USE_GLOW_TAG, s as buildMenuPresets, t as PAGE_USE_MASK_COLORS, u as PageUsePresetState, v as BROWSER_ENGINE_ID, w as getPageUseConfig, x as PageUseState, y as browserTtsEngine, z as runPageUseTool } from "./index-
|
|
1
|
+
import { $ as FlowCheckBinding, $t as FlowStatus, At as FlowPermissions, Bt as FlowRepository, C as getPageUseFlowCatalog, Ct as FlowKnowledgeRecord, D as mountPageUseManager, Dt as FlowOutputReference, E as definePageUseManagerElement, Et as FlowMode, Ft as FlowRegionContext, G as FlowActionBinding, Gt as FlowRunner, H as FLOW_BUNDLE_VERSION, Ht as FlowResolvedTarget, I as parseFlowScene, It as FlowRegionFailure, J as FlowApiSyncOptions, Jt as FlowScope, K as FlowApiRequest, Kt as FlowScene, L as parseFlowSceneDraft, Lt as FlowRegionHost, M as newRevision, Mt as FlowRegion, Nt as FlowRegionAnchor, Ot as FlowParameter, P as parseFlowKnowledge, Pt as FlowRegionCandidate, Q as FlowCheck, Qt as FlowSnapshot, R as sceneKey, Rt as FlowRegionPage, S as PAGE_USE_FLOW_TOOL, St as FlowKnowledge, T as MountPageUseManagerOptions, Tt as FlowManagerState, U as FLOW_SCHEMA_VERSION, Ut as FlowRunOptions, Vt as FlowRepositorySnapshot, W as FlowAction, Wt as FlowRunResult, X as FlowBoundCheck, Xt as FlowSegmentLog, Y as FlowBindings, Yt as FlowSegment, Z as FlowBundle, Zt as FlowSessionContext, _ as PageUseTtsVoice, _t as FlowGenerator, a as DEFAULT_TOUR_MAX_TAB_SWITCHES, an as PageUseFlowOptions, at as FlowCloudState, b as TOUR_STYLE_TRAINER, bt as FlowImportStrategy, c as PageUseLLMOptions, cn as PageUsePreset, ct as FlowConfigResponse, d as PageUseRouterMode, dn as PageUseSnapshot, dt as FlowDescriptionCheck, en as FlowStep, et as FlowClient, f as PageUseTourOptions, fn as PageUseStepLog, ft as FlowError, g as PageUseTtsSpeakOptions, gt as FlowExportOptions, h as PageUseTtsEngine, hn as PageUseTaskStatus, ht as FlowExecutionPorts, i as DEFAULT_STORAGE_KEY_PREFIX, in as PageUseFlowHandle, it as FlowCloudRelease, jt as FlowPresenter, kt as FlowParameterDefinition, l as PageUseLLMStreamOptions, ln as PageUseProgressEvent, lt as FlowContext, m as readLauncherSwitch, mn as PageUseTaskSource, mt as FlowEvent, n as DEFAULT_MODEL, nn as JsonObject, nt as FlowCloudCache, on as PageUseErrorCode, ot as FlowCompletionDecision, p as normalizeOptions, pn as PageUseTaskResult, pt as FlowErrorCode, q as FlowApiResponse, qt as FlowSceneRecord, r as DEFAULT_SESSION_HEADER, rn as JsonValue, rt as FlowCloudController, s as NormalizedPageUseOptions, sn as PageUseMenuNode, st as FlowCompletionEvaluator, t as DEFAULT_MAX_STEPS, tn as FlowTombstone, tt as FlowCloudAdapter, u as PageUseOptions, un as PageUseRunOptions, ut as FlowContextBinding, v as DEFAULT_TOUR_STYLES, vt as FlowIdentity, w as runPageUseFlowTool, wt as FlowManager, x as TOUR_STYLE_USER, xt as FlowInputDefinition, y as PageUseTourStyle, yt as FlowImportPreview, zt as FlowRegionSelector } from "./options-CS8LsaB8.mjs";
|
|
2
|
+
import { A as PageUseGlobal, B as MountPageUseUIOptions, C as getElapsedSeconds, D as pageUseStore, E as isRunning, F as PAGE_USE_TOOL_NAME, G as PageUseLauncherElement, H as mountPageUseUI, I as PageUseCommand, J as createPageUse, K as PageUseLauncherLayout, L as formatPageUseResultForModel, M as showPageUseLauncher, N as PAGE_USE_COMMAND_TYPE, O as ReadonlyStore, P as PAGE_USE_TOOL, R as isPageUseCommand, S as clearPageUseLog, T as isPageUseConfigured, U as PAGE_USE_LAUNCHER_TAG, V as definePageUseElements, W as PageUseLauncherConfig, X as PageUseCapability, Y as getPageUseFlow, Z as pageUseCapability, _ as pageUseSettings, a as PAGE_USE_ROBOT_ICON_SVG, b as PageUseQuestion, c as PageUseCustomPreset, d as pageUsePresets, f as PageUseHistoryEntry, g as PageUseSettings, h as PageUsePoint, i as PageUseGlowElement, j as hidePageUseLauncher, k as PAGE_USE_GLOBAL_KEY, l as PageUsePresetSaveResult, m as DEFAULT_PAGE_USE_SETTINGS, n as SIMULATOR_MASK_ID, o as PAGE_USE_STATIC_PRESETS, p as pageUseHistory, q as PageUseHandle, r as PAGE_USE_GLOW_TAG, s as buildMenuPresets, t as PAGE_USE_MASK_COLORS, u as PageUsePresetState, v as BROWSER_ENGINE_ID, w as getPageUseConfig, x as PageUseState, y as browserTtsEngine, z as runPageUseTool } from "./index-CzWLOKue.mjs";
|
|
3
3
|
import { PropType, ShallowRef } from "vue";
|
|
4
4
|
import { Router } from "vue-router";
|
|
5
5
|
//#region src/vue.d.ts
|
|
@@ -51,4 +51,4 @@ export declare function usePageUseState(): Readonly<ShallowRef<PageUseState>>;
|
|
|
51
51
|
/** 本地设置的 Vue 响应式引用;修改请调用 pageUseSettings.update */
|
|
52
52
|
export declare function usePageUseSettings(): Readonly<ShallowRef<PageUseSettings>>;
|
|
53
53
|
//#endregion
|
|
54
|
-
export { BROWSER_ENGINE_ID, DEFAULT_MAX_STEPS, DEFAULT_MODEL, DEFAULT_PAGE_USE_SETTINGS, DEFAULT_SESSION_HEADER, DEFAULT_STORAGE_KEY_PREFIX, DEFAULT_TOUR_MAX_TAB_SWITCHES, DEFAULT_TOUR_STYLES, FLOW_BUNDLE_VERSION, FLOW_SCHEMA_VERSION, FlowAction, FlowActionBinding, FlowApiRequest, FlowApiResponse, FlowApiSyncOptions, FlowBindings, FlowBoundCheck, FlowBundle, FlowCheck, FlowCheckBinding, FlowClient, FlowCloudAdapter, FlowCloudCache, FlowCloudController, FlowCloudRelease, FlowCloudState, FlowCompletionDecision, FlowCompletionEvaluator, FlowConfigResponse, FlowContext, FlowContextBinding, FlowDescriptionCheck, FlowError, FlowErrorCode, FlowEvent, FlowExecutionPorts, FlowExportOptions, FlowGenerator, FlowIdentity, FlowImportPreview, FlowImportStrategy, FlowInputDefinition, FlowKnowledge, FlowKnowledgeRecord, FlowManager, FlowManagerState, FlowMode, FlowOutputReference, FlowParameter, FlowParameterDefinition, FlowPermissions, FlowPresenter, FlowRegion, FlowRegionAnchor, FlowRegionCandidate, FlowRegionContext, FlowRegionFailure, FlowRegionHost, FlowRegionPage, FlowRegionSelector, FlowRepository, FlowRepositorySnapshot, FlowResolvedTarget, FlowRunOptions, FlowRunResult, FlowRunner, FlowScene, FlowSceneRecord, FlowScope, FlowSegment, FlowSegmentLog, FlowSessionContext, FlowSnapshot, FlowStatus, FlowStep, FlowTombstone, JsonObject, JsonValue, type MountPageUseManagerOptions, type MountPageUseUIOptions, type NormalizedPageUseOptions, PAGE_USE_COMMAND_TYPE, PAGE_USE_FLOW_TOOL, PAGE_USE_GLOBAL_KEY, PAGE_USE_GLOW_TAG, PAGE_USE_LAUNCHER_TAG, PAGE_USE_MASK_COLORS, PAGE_USE_ROBOT_ICON_SVG, PAGE_USE_STATIC_PRESETS, PAGE_USE_TOOL, PAGE_USE_TOOL_NAME, type PageUseCapability, type PageUseCommand, type PageUseCustomPreset, type PageUseErrorCode, PageUseFlowHandle, PageUseFlowOptions, type PageUseGlobal, PageUseGlowElement, type PageUseHandle, type PageUseHistoryEntry, type PageUseLLMOptions, type PageUseLauncherConfig, PageUseLauncherElement, type PageUseLauncherLayout, type PageUseMenuNode, type PageUseOptions, type PageUsePoint, type PageUsePreset, type PageUsePresetSaveResult, type PageUsePresetState, type PageUseProgressEvent, type PageUseQuestion, type PageUseRouterMode, type PageUseRunOptions, type PageUseSettings, type PageUseSnapshot, type PageUseState, type PageUseStepLog, type PageUseTaskResult, type PageUseTaskSource, type PageUseTaskStatus, type PageUseTourOptions, type PageUseTourStyle, type PageUseTtsEngine, type PageUseTtsSpeakOptions, type PageUseTtsVoice, type ReadonlyStore, SIMULATOR_MASK_ID, TOUR_STYLE_TRAINER, TOUR_STYLE_USER, browserTtsEngine, buildMenuPresets, clearPageUseLog, createPageUse, definePageUseElements, definePageUseManagerElement, formatPageUseResultForModel, getElapsedSeconds, getPageUseConfig, getPageUseFlow, getPageUseFlowCatalog, hidePageUseLauncher, isPageUseCommand, isPageUseConfigured, isRunning, mountPageUseManager, mountPageUseUI, newRevision, normalizeOptions, pageUseCapability, pageUseHistory, pageUsePresets, pageUseSettings, pageUseStore, parseFlowKnowledge, parseFlowScene, parseFlowSceneDraft, readLauncherSwitch, runPageUseFlowTool, runPageUseTool, sceneKey, showPageUseLauncher };
|
|
54
|
+
export { BROWSER_ENGINE_ID, DEFAULT_MAX_STEPS, DEFAULT_MODEL, DEFAULT_PAGE_USE_SETTINGS, DEFAULT_SESSION_HEADER, DEFAULT_STORAGE_KEY_PREFIX, DEFAULT_TOUR_MAX_TAB_SWITCHES, DEFAULT_TOUR_STYLES, FLOW_BUNDLE_VERSION, FLOW_SCHEMA_VERSION, FlowAction, FlowActionBinding, FlowApiRequest, FlowApiResponse, FlowApiSyncOptions, FlowBindings, FlowBoundCheck, FlowBundle, FlowCheck, FlowCheckBinding, FlowClient, FlowCloudAdapter, FlowCloudCache, FlowCloudController, FlowCloudRelease, FlowCloudState, FlowCompletionDecision, FlowCompletionEvaluator, FlowConfigResponse, FlowContext, FlowContextBinding, FlowDescriptionCheck, FlowError, FlowErrorCode, FlowEvent, FlowExecutionPorts, FlowExportOptions, FlowGenerator, FlowIdentity, FlowImportPreview, FlowImportStrategy, FlowInputDefinition, FlowKnowledge, FlowKnowledgeRecord, FlowManager, FlowManagerState, FlowMode, FlowOutputReference, FlowParameter, FlowParameterDefinition, FlowPermissions, FlowPresenter, FlowRegion, FlowRegionAnchor, FlowRegionCandidate, FlowRegionContext, FlowRegionFailure, FlowRegionHost, FlowRegionPage, FlowRegionSelector, FlowRepository, FlowRepositorySnapshot, FlowResolvedTarget, FlowRunOptions, FlowRunResult, FlowRunner, FlowScene, FlowSceneRecord, FlowScope, FlowSegment, FlowSegmentLog, FlowSessionContext, FlowSnapshot, FlowStatus, FlowStep, FlowTombstone, JsonObject, JsonValue, type MountPageUseManagerOptions, type MountPageUseUIOptions, type NormalizedPageUseOptions, PAGE_USE_COMMAND_TYPE, PAGE_USE_FLOW_TOOL, PAGE_USE_GLOBAL_KEY, PAGE_USE_GLOW_TAG, PAGE_USE_LAUNCHER_TAG, PAGE_USE_MASK_COLORS, PAGE_USE_ROBOT_ICON_SVG, PAGE_USE_STATIC_PRESETS, PAGE_USE_TOOL, PAGE_USE_TOOL_NAME, type PageUseCapability, type PageUseCommand, type PageUseCustomPreset, type PageUseErrorCode, PageUseFlowHandle, PageUseFlowOptions, type PageUseGlobal, PageUseGlowElement, type PageUseHandle, type PageUseHistoryEntry, type PageUseLLMOptions, type PageUseLLMStreamOptions, type PageUseLauncherConfig, PageUseLauncherElement, type PageUseLauncherLayout, type PageUseMenuNode, type PageUseOptions, type PageUsePoint, type PageUsePreset, type PageUsePresetSaveResult, type PageUsePresetState, type PageUseProgressEvent, type PageUseQuestion, type PageUseRouterMode, type PageUseRunOptions, type PageUseSettings, type PageUseSnapshot, type PageUseState, type PageUseStepLog, type PageUseTaskResult, type PageUseTaskSource, type PageUseTaskStatus, type PageUseTourOptions, type PageUseTourStyle, type PageUseTtsEngine, type PageUseTtsSpeakOptions, type PageUseTtsVoice, type ReadonlyStore, SIMULATOR_MASK_ID, TOUR_STYLE_TRAINER, TOUR_STYLE_USER, browserTtsEngine, buildMenuPresets, clearPageUseLog, createPageUse, definePageUseElements, definePageUseManagerElement, formatPageUseResultForModel, getElapsedSeconds, getPageUseConfig, getPageUseFlow, getPageUseFlowCatalog, hidePageUseLauncher, isPageUseCommand, isPageUseConfigured, isRunning, mountPageUseManager, mountPageUseUI, newRevision, normalizeOptions, pageUseCapability, pageUseHistory, pageUsePresets, pageUseSettings, pageUseStore, parseFlowKnowledge, parseFlowScene, parseFlowSceneDraft, readLauncherSwitch, runPageUseFlowTool, runPageUseTool, sceneKey, showPageUseLauncher };
|
package/dist/vue.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { At as
|
|
2
|
-
import { _ as isPageUseCommand, a as PAGE_USE_STATIC_PRESETS, b as showPageUseLauncher, c as PAGE_USE_GLOW_TAG, d as getPageUseFlow, f as PAGE_USE_GLOBAL_KEY, g as formatPageUseResultForModel, h as PAGE_USE_TOOL_NAME, i as PageUseLauncherElement, l as PageUseGlowElement, m as PAGE_USE_TOOL, n as mountPageUseUI, o as buildMenuPresets, p as PAGE_USE_COMMAND_TYPE, r as PAGE_USE_LAUNCHER_TAG, s as PAGE_USE_ROBOT_ICON_SVG, t as definePageUseElements, u as createPageUse, v as runPageUseTool, x as pageUseCapability, y as hidePageUseLauncher } from "./src-
|
|
1
|
+
import { At as SIMULATOR_MASK_ID, Bt as FLOW_SCHEMA_VERSION, Ct as DEFAULT_TOUR_MAX_TAB_SWITCHES, Et as readLauncherSwitch, F as sceneKey, Ft as TOUR_STYLE_TRAINER, It as TOUR_STYLE_USER, J as isRunning, Mt as browserTtsEngine, N as parseFlowScene, P as parseFlowSceneDraft, Pt as DEFAULT_TOUR_STYLES, St as DEFAULT_STORAGE_KEY_PREFIX, U as getElapsedSeconds, V as clearPageUseLog, Vt as FlowError, W as getPageUseConfig, Y as pageUseStore, _t as pageUseSettings, a as mountPageUseManager, at as pageUseHistory, bt as DEFAULT_MODEL, gt as DEFAULT_PAGE_USE_SETTINGS, i as definePageUseManagerElement, it as pageUsePresets, j as parseFlowKnowledge, jt as BROWSER_ENGINE_ID, k as newRevision, kt as PAGE_USE_MASK_COLORS, n as getPageUseFlowCatalog, q as isPageUseConfigured, r as runPageUseFlowTool, t as PAGE_USE_FLOW_TOOL, wt as normalizeOptions, xt as DEFAULT_SESSION_HEADER, yt as DEFAULT_MAX_STEPS, zt as FLOW_BUNDLE_VERSION } from "./tool-B-3dgswr.mjs";
|
|
2
|
+
import { _ as isPageUseCommand, a as PAGE_USE_STATIC_PRESETS, b as showPageUseLauncher, c as PAGE_USE_GLOW_TAG, d as getPageUseFlow, f as PAGE_USE_GLOBAL_KEY, g as formatPageUseResultForModel, h as PAGE_USE_TOOL_NAME, i as PageUseLauncherElement, l as PageUseGlowElement, m as PAGE_USE_TOOL, n as mountPageUseUI, o as buildMenuPresets, p as PAGE_USE_COMMAND_TYPE, r as PAGE_USE_LAUNCHER_TAG, s as PAGE_USE_ROBOT_ICON_SVG, t as definePageUseElements, u as createPageUse, v as runPageUseTool, x as pageUseCapability, y as hidePageUseLauncher } from "./src-BgrtN4uP.mjs";
|
|
3
3
|
import { defineComponent, inject, onBeforeUnmount, onScopeDispose, shallowRef } from "vue";
|
|
4
4
|
import { routerKey } from "vue-router";
|
|
5
5
|
|
package/package.json
CHANGED