@tanzerfe/page-use 0.0.10 → 0.0.11

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 CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  用自然语言操作当前页面:输入一句指令,智能体在页面中自动点击、输入并返回结论。基于 [page-agent](https://github.com/alibaba/page-agent),框架无关,附带操作面板与 Vue 组件。
4
4
 
5
+ 可选的业务流程能力提供场景与知识维护、IndexedDB、导入导出和中台授权同步,支持 Web 与手机 H5。
6
+
5
7
  ## 安装
6
8
 
7
9
  ```bash
@@ -74,6 +76,7 @@ console.log(result.status, result.summary)
74
76
  - 用户关闭后,可在 URL 上加 `?pageUseDebug=1` 重新显示,或由业务系统调用 `showPageUseLauncher()` 调出。
75
77
  - 希望默认隐藏、按需调出时,传入 `launcher: { defaultHidden: true }`。
76
78
  - 面板支持快捷指令、历史记录与语音播报。
79
+ - `flow: true` 开启桌面端本地场景功能,`false` 或不传则关闭;也可传对象定制终端、账号隔离和云端能力。开启后,面板的「设置」页 显示 场景「自定义」入口。
77
80
 
78
81
  ## 页面讲解
79
82
 
@@ -0,0 +1,556 @@
1
+ import { $ as FlowClient, $t as FlowStep, A as FLOW_SEGMENT_MAX_CHARS, At as FlowPresenter, B as validateSceneBindings, Bt as FlowRepositorySnapshot, C as runPageUseFlowTool, Ct as FlowManager, D as PAGE_USE_MANAGER_TAG, Dt as FlowParameter, E as mountPageUseManager, Et as FlowOutputReference, F as parseFlowScene, Ft as FlowRegionFailure, G as FlowApiRequest, Gt as FlowScene, H as FLOW_SCHEMA_VERSION, Ht as FlowRunOptions, I as parseFlowSceneDraft, It as FlowRegionHost, J as FlowBindings, Jt as FlowSegment, K as FlowApiResponse, Kt as FlowSceneRecord, L as sceneKey, Lt as FlowRegionPage, M as parseFlowBundle, Mt as FlowRegionAnchor, N as parseFlowKnowledge, Nt as FlowRegionCandidate, O as PageUseManagerElement, Ot as FlowParameterDefinition, P as parseFlowRegion, Pt as FlowRegionContext, Q as FlowCheckBinding, Qt as FlowStatus, R as scopeKey, Rt as FlowRegionSelector, S as getPageUseFlowCatalog, St as FlowKnowledgeRecord, T as definePageUseManagerElement, Tt as FlowMode, U as FlowAction, Ut as FlowRunResult, V as FLOW_BUNDLE_VERSION, Vt as FlowResolvedTarget, W as FlowActionBinding, Wt as FlowRunner, X as FlowBundle, Xt as FlowSessionContext, Y as FlowBoundCheck, Yt as FlowSegmentLog, Z as FlowCheck, Zt as FlowSnapshot, _t as FlowIdentity, at as FlowCompletionDecision, bt as FlowInputDefinition, ct as FlowContext, dt as FlowError, en as FlowTombstone, et as FlowCloudAdapter, ft as FlowErrorCode, gt as FlowGenerator, ht as FlowExportOptions, in as PageUseFlowOptions, it as FlowCloudState, j as newRevision, jt as FlowRegion, k as PageUseManagerPresentation, kt as FlowPermissions, lt as FlowContextBinding, mt as FlowExecutionPorts, nn as JsonValue, nt as FlowCloudController, o as NormalizedLLMOptions, ot as FlowCompletionEvaluator, pt as FlowEvent, q as FlowApiSyncOptions, qt as FlowScope, rn as PageUseFlowHandle, rt as FlowCloudRelease, st as FlowConfigResponse, tn as JsonObject, tt as FlowCloudCache, ut as FlowDescriptionCheck, vt as FlowImportPreview, w as MountPageUseManagerOptions, wt as FlowManagerState, x as PAGE_USE_FLOW_TOOL, xt as FlowKnowledge, yt as FlowImportStrategy, z as validateFlowInputs, zt as FlowRepository } from "./options-BdQiIL9a.mjs";
2
+ import { z } from "zod/v4";
3
+ //#region src/flow/schema.d.ts
4
+ export declare const FLOW_SCENE_JSON_SCHEMA: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
5
+ schemaVersion: z.ZodLiteral<"1">;
6
+ id: z.ZodString;
7
+ name: z.ZodString;
8
+ revision: z.ZodString;
9
+ client: z.ZodEnum<{
10
+ mobile: "mobile";
11
+ desktop: "desktop";
12
+ }>;
13
+ variantId: z.ZodString;
14
+ bindingSet: z.ZodString;
15
+ description: z.ZodOptional<z.ZodString>;
16
+ inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
17
+ type: z.ZodEnum<{
18
+ string: "string";
19
+ number: "number";
20
+ boolean: "boolean";
21
+ }>;
22
+ label: z.ZodOptional<z.ZodString>;
23
+ required: z.ZodOptional<z.ZodBoolean>;
24
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
25
+ }, z.core.$strict>>>;
26
+ knowledgeVersions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
27
+ completion: z.ZodOptional<z.ZodEnum<{
28
+ "keep-current": "keep-current";
29
+ restore: "restore";
30
+ }>>;
31
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
32
+ steps: z.ZodArray<z.ZodObject<{
33
+ id: z.ZodString;
34
+ name: z.ZodString;
35
+ required: z.ZodOptional<z.ZodBoolean>;
36
+ advance: z.ZodOptional<z.ZodEnum<{
37
+ auto: "auto";
38
+ manual: "manual";
39
+ }>>;
40
+ actions: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
41
+ id: z.ZodString;
42
+ task: z.ZodString;
43
+ effect: z.ZodOptional<z.ZodEnum<{
44
+ view: "view";
45
+ query: "query";
46
+ write: "write";
47
+ }>>;
48
+ repeatable: z.ZodOptional<z.ZodBoolean>;
49
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
50
+ }, z.core.$strict>, z.ZodObject<{
51
+ id: z.ZodString;
52
+ ref: z.ZodString;
53
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
54
+ }, z.core.$strict>]>>;
55
+ ready: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
56
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
57
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
58
+ pollIntervalMs: z.ZodOptional<z.ZodNumber>;
59
+ ref: z.ZodString;
60
+ }, z.core.$strict>, z.ZodObject<{
61
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
62
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
63
+ pollIntervalMs: z.ZodOptional<z.ZodNumber>;
64
+ pageId: z.ZodString;
65
+ description: z.ZodString;
66
+ }, z.core.$strict>]>>;
67
+ segments: z.ZodArray<z.ZodObject<{
68
+ id: z.ZodString;
69
+ region: z.ZodOptional<z.ZodObject<{
70
+ name: z.ZodString;
71
+ pageId: z.ZodString;
72
+ description: z.ZodString;
73
+ anchor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
74
+ kind: z.ZodLiteral<"attribute">;
75
+ attribute: z.ZodEnum<{
76
+ id: "id";
77
+ "data-page-use-region": "data-page-use-region";
78
+ "data-flow-target": "data-flow-target";
79
+ }>;
80
+ value: z.ZodString;
81
+ }, z.core.$strict>, z.ZodObject<{
82
+ kind: z.ZodLiteral<"semantic">;
83
+ role: z.ZodString;
84
+ name: z.ZodString;
85
+ containerName: z.ZodOptional<z.ZodString>;
86
+ }, z.core.$strict>, z.ZodObject<{
87
+ kind: z.ZodLiteral<"dom">;
88
+ path: z.ZodArray<z.ZodObject<{
89
+ tag: z.ZodString;
90
+ index: z.ZodNumber;
91
+ shadow: z.ZodOptional<z.ZodBoolean>;
92
+ }, z.core.$strict>>;
93
+ }, z.core.$strict>], "kind">>;
94
+ contextMatch: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
95
+ }, z.core.$strict>>;
96
+ baseText: z.ZodString;
97
+ requiredPoints: z.ZodOptional<z.ZodArray<z.ZodString>>;
98
+ lockedPhrases: z.ZodOptional<z.ZodArray<z.ZodString>>;
99
+ knowledgeRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
100
+ contextRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
101
+ allowPolish: z.ZodOptional<z.ZodBoolean>;
102
+ }, z.core.$strict>>;
103
+ }, z.core.$strict>>;
104
+ }, z.core.$strict>>;
105
+ export declare const FLOW_SCENE_DRAFT_JSON_SCHEMA: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
106
+ schemaVersion: z.ZodLiteral<"1">;
107
+ id: z.ZodString;
108
+ name: z.ZodString;
109
+ revision: z.ZodString;
110
+ client: z.ZodEnum<{
111
+ mobile: "mobile";
112
+ desktop: "desktop";
113
+ }>;
114
+ variantId: z.ZodString;
115
+ bindingSet: z.ZodString;
116
+ description: z.ZodOptional<z.ZodString>;
117
+ inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
118
+ type: z.ZodEnum<{
119
+ string: "string";
120
+ number: "number";
121
+ boolean: "boolean";
122
+ }>;
123
+ label: z.ZodOptional<z.ZodString>;
124
+ required: z.ZodOptional<z.ZodBoolean>;
125
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
126
+ }, z.core.$strict>>>;
127
+ knowledgeVersions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
128
+ completion: z.ZodOptional<z.ZodEnum<{
129
+ "keep-current": "keep-current";
130
+ restore: "restore";
131
+ }>>;
132
+ steps: z.ZodArray<z.ZodObject<{
133
+ id: z.ZodString;
134
+ name: z.ZodString;
135
+ required: z.ZodOptional<z.ZodBoolean>;
136
+ advance: z.ZodOptional<z.ZodEnum<{
137
+ auto: "auto";
138
+ manual: "manual";
139
+ }>>;
140
+ actions: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
141
+ id: z.ZodString;
142
+ task: z.ZodString;
143
+ effect: z.ZodOptional<z.ZodEnum<{
144
+ view: "view";
145
+ query: "query";
146
+ write: "write";
147
+ }>>;
148
+ repeatable: z.ZodOptional<z.ZodBoolean>;
149
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
150
+ }, z.core.$strict>, z.ZodObject<{
151
+ id: z.ZodString;
152
+ ref: z.ZodString;
153
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
154
+ }, z.core.$strict>]>>;
155
+ ready: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
156
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
157
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
158
+ pollIntervalMs: z.ZodOptional<z.ZodNumber>;
159
+ ref: z.ZodString;
160
+ }, z.core.$strict>, z.ZodObject<{
161
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
162
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
163
+ pollIntervalMs: z.ZodOptional<z.ZodNumber>;
164
+ pageId: z.ZodString;
165
+ description: z.ZodString;
166
+ }, z.core.$strict>]>>;
167
+ segments: z.ZodArray<z.ZodObject<{
168
+ id: z.ZodString;
169
+ region: z.ZodOptional<z.ZodObject<{
170
+ name: z.ZodString;
171
+ pageId: z.ZodString;
172
+ description: z.ZodString;
173
+ anchor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
174
+ kind: z.ZodLiteral<"attribute">;
175
+ attribute: z.ZodEnum<{
176
+ id: "id";
177
+ "data-page-use-region": "data-page-use-region";
178
+ "data-flow-target": "data-flow-target";
179
+ }>;
180
+ value: z.ZodString;
181
+ }, z.core.$strict>, z.ZodObject<{
182
+ kind: z.ZodLiteral<"semantic">;
183
+ role: z.ZodString;
184
+ name: z.ZodString;
185
+ containerName: z.ZodOptional<z.ZodString>;
186
+ }, z.core.$strict>, z.ZodObject<{
187
+ kind: z.ZodLiteral<"dom">;
188
+ path: z.ZodArray<z.ZodObject<{
189
+ tag: z.ZodString;
190
+ index: z.ZodNumber;
191
+ shadow: z.ZodOptional<z.ZodBoolean>;
192
+ }, z.core.$strict>>;
193
+ }, z.core.$strict>], "kind">>;
194
+ contextMatch: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
195
+ }, z.core.$strict>>;
196
+ baseText: z.ZodString;
197
+ requiredPoints: z.ZodOptional<z.ZodArray<z.ZodString>>;
198
+ lockedPhrases: z.ZodOptional<z.ZodArray<z.ZodString>>;
199
+ knowledgeRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
200
+ contextRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
201
+ allowPolish: z.ZodOptional<z.ZodBoolean>;
202
+ }, z.core.$strict>>;
203
+ }, z.core.$strict>>;
204
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
205
+ }, z.core.$strict>>;
206
+ export declare const FLOW_BUNDLE_JSON_SCHEMA: z.core.ZodStandardJSONSchemaPayload<z.ZodObject<{
207
+ bundleVersion: z.ZodLiteral<"1">;
208
+ exportedAt: z.ZodString;
209
+ appId: z.ZodString;
210
+ scenes: z.ZodArray<z.ZodObject<{
211
+ key: z.ZodString;
212
+ draft: z.ZodObject<{
213
+ schemaVersion: z.ZodLiteral<"1">;
214
+ id: z.ZodString;
215
+ name: z.ZodString;
216
+ revision: z.ZodString;
217
+ client: z.ZodEnum<{
218
+ mobile: "mobile";
219
+ desktop: "desktop";
220
+ }>;
221
+ variantId: z.ZodString;
222
+ bindingSet: z.ZodString;
223
+ description: z.ZodOptional<z.ZodString>;
224
+ inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
225
+ type: z.ZodEnum<{
226
+ string: "string";
227
+ number: "number";
228
+ boolean: "boolean";
229
+ }>;
230
+ label: z.ZodOptional<z.ZodString>;
231
+ required: z.ZodOptional<z.ZodBoolean>;
232
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
233
+ }, z.core.$strict>>>;
234
+ knowledgeVersions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
235
+ completion: z.ZodOptional<z.ZodEnum<{
236
+ "keep-current": "keep-current";
237
+ restore: "restore";
238
+ }>>;
239
+ steps: z.ZodArray<z.ZodObject<{
240
+ id: z.ZodString;
241
+ name: z.ZodString;
242
+ required: z.ZodOptional<z.ZodBoolean>;
243
+ advance: z.ZodOptional<z.ZodEnum<{
244
+ auto: "auto";
245
+ manual: "manual";
246
+ }>>;
247
+ actions: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
248
+ id: z.ZodString;
249
+ task: z.ZodString;
250
+ effect: z.ZodOptional<z.ZodEnum<{
251
+ view: "view";
252
+ query: "query";
253
+ write: "write";
254
+ }>>;
255
+ repeatable: z.ZodOptional<z.ZodBoolean>;
256
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
257
+ }, z.core.$strict>, z.ZodObject<{
258
+ id: z.ZodString;
259
+ ref: z.ZodString;
260
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
261
+ }, z.core.$strict>]>>;
262
+ ready: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
263
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
264
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
265
+ pollIntervalMs: z.ZodOptional<z.ZodNumber>;
266
+ ref: z.ZodString;
267
+ }, z.core.$strict>, z.ZodObject<{
268
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
269
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
270
+ pollIntervalMs: z.ZodOptional<z.ZodNumber>;
271
+ pageId: z.ZodString;
272
+ description: z.ZodString;
273
+ }, z.core.$strict>]>>;
274
+ segments: z.ZodArray<z.ZodObject<{
275
+ id: z.ZodString;
276
+ region: z.ZodOptional<z.ZodObject<{
277
+ name: z.ZodString;
278
+ pageId: z.ZodString;
279
+ description: z.ZodString;
280
+ anchor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
281
+ kind: z.ZodLiteral<"attribute">;
282
+ attribute: z.ZodEnum<{
283
+ id: "id";
284
+ "data-page-use-region": "data-page-use-region";
285
+ "data-flow-target": "data-flow-target";
286
+ }>;
287
+ value: z.ZodString;
288
+ }, z.core.$strict>, z.ZodObject<{
289
+ kind: z.ZodLiteral<"semantic">;
290
+ role: z.ZodString;
291
+ name: z.ZodString;
292
+ containerName: z.ZodOptional<z.ZodString>;
293
+ }, z.core.$strict>, z.ZodObject<{
294
+ kind: z.ZodLiteral<"dom">;
295
+ path: z.ZodArray<z.ZodObject<{
296
+ tag: z.ZodString;
297
+ index: z.ZodNumber;
298
+ shadow: z.ZodOptional<z.ZodBoolean>;
299
+ }, z.core.$strict>>;
300
+ }, z.core.$strict>], "kind">>;
301
+ contextMatch: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
302
+ }, z.core.$strict>>;
303
+ baseText: z.ZodString;
304
+ requiredPoints: z.ZodOptional<z.ZodArray<z.ZodString>>;
305
+ lockedPhrases: z.ZodOptional<z.ZodArray<z.ZodString>>;
306
+ knowledgeRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
307
+ contextRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
308
+ allowPolish: z.ZodOptional<z.ZodBoolean>;
309
+ }, z.core.$strict>>;
310
+ }, z.core.$strict>>;
311
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
312
+ }, z.core.$strict>;
313
+ version: z.ZodNumber;
314
+ source: z.ZodEnum<{
315
+ local: "local";
316
+ cloud: "cloud";
317
+ }>;
318
+ revisions: z.ZodArray<z.ZodObject<{
319
+ schemaVersion: z.ZodLiteral<"1">;
320
+ id: z.ZodString;
321
+ name: z.ZodString;
322
+ revision: z.ZodString;
323
+ client: z.ZodEnum<{
324
+ mobile: "mobile";
325
+ desktop: "desktop";
326
+ }>;
327
+ variantId: z.ZodString;
328
+ bindingSet: z.ZodString;
329
+ description: z.ZodOptional<z.ZodString>;
330
+ inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
331
+ type: z.ZodEnum<{
332
+ string: "string";
333
+ number: "number";
334
+ boolean: "boolean";
335
+ }>;
336
+ label: z.ZodOptional<z.ZodString>;
337
+ required: z.ZodOptional<z.ZodBoolean>;
338
+ default: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
339
+ }, z.core.$strict>>>;
340
+ knowledgeVersions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
341
+ completion: z.ZodOptional<z.ZodEnum<{
342
+ "keep-current": "keep-current";
343
+ restore: "restore";
344
+ }>>;
345
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
346
+ steps: z.ZodArray<z.ZodObject<{
347
+ id: z.ZodString;
348
+ name: z.ZodString;
349
+ required: z.ZodOptional<z.ZodBoolean>;
350
+ advance: z.ZodOptional<z.ZodEnum<{
351
+ auto: "auto";
352
+ manual: "manual";
353
+ }>>;
354
+ actions: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
355
+ id: z.ZodString;
356
+ task: z.ZodString;
357
+ effect: z.ZodOptional<z.ZodEnum<{
358
+ view: "view";
359
+ query: "query";
360
+ write: "write";
361
+ }>>;
362
+ repeatable: z.ZodOptional<z.ZodBoolean>;
363
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
364
+ }, z.core.$strict>, z.ZodObject<{
365
+ id: z.ZodString;
366
+ ref: z.ZodString;
367
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
368
+ }, z.core.$strict>]>>;
369
+ ready: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
370
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
371
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
372
+ pollIntervalMs: z.ZodOptional<z.ZodNumber>;
373
+ ref: z.ZodString;
374
+ }, z.core.$strict>, z.ZodObject<{
375
+ params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
376
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
377
+ pollIntervalMs: z.ZodOptional<z.ZodNumber>;
378
+ pageId: z.ZodString;
379
+ description: z.ZodString;
380
+ }, z.core.$strict>]>>;
381
+ segments: z.ZodArray<z.ZodObject<{
382
+ id: z.ZodString;
383
+ region: z.ZodOptional<z.ZodObject<{
384
+ name: z.ZodString;
385
+ pageId: z.ZodString;
386
+ description: z.ZodString;
387
+ anchor: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
388
+ kind: z.ZodLiteral<"attribute">;
389
+ attribute: z.ZodEnum<{
390
+ id: "id";
391
+ "data-page-use-region": "data-page-use-region";
392
+ "data-flow-target": "data-flow-target";
393
+ }>;
394
+ value: z.ZodString;
395
+ }, z.core.$strict>, z.ZodObject<{
396
+ kind: z.ZodLiteral<"semantic">;
397
+ role: z.ZodString;
398
+ name: z.ZodString;
399
+ containerName: z.ZodOptional<z.ZodString>;
400
+ }, z.core.$strict>, z.ZodObject<{
401
+ kind: z.ZodLiteral<"dom">;
402
+ path: z.ZodArray<z.ZodObject<{
403
+ tag: z.ZodString;
404
+ index: z.ZodNumber;
405
+ shadow: z.ZodOptional<z.ZodBoolean>;
406
+ }, z.core.$strict>>;
407
+ }, z.core.$strict>], "kind">>;
408
+ contextMatch: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JsonValue, unknown, z.core.$ZodTypeInternals<JsonValue, unknown>>>>;
409
+ }, z.core.$strict>>;
410
+ baseText: z.ZodString;
411
+ requiredPoints: z.ZodOptional<z.ZodArray<z.ZodString>>;
412
+ lockedPhrases: z.ZodOptional<z.ZodArray<z.ZodString>>;
413
+ knowledgeRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
414
+ contextRefs: z.ZodOptional<z.ZodArray<z.ZodString>>;
415
+ allowPolish: z.ZodOptional<z.ZodBoolean>;
416
+ }, z.core.$strict>>;
417
+ }, z.core.$strict>>;
418
+ }, z.core.$strict>>;
419
+ publishedRevision: z.ZodOptional<z.ZodString>;
420
+ cloudRevision: z.ZodOptional<z.ZodString>;
421
+ updatedAt: z.ZodNumber;
422
+ }, z.core.$strict>>;
423
+ knowledge: z.ZodArray<z.ZodObject<{
424
+ draft: z.ZodObject<{
425
+ id: z.ZodString;
426
+ name: z.ZodString;
427
+ text: z.ZodString;
428
+ revision: z.ZodString;
429
+ source: z.ZodOptional<z.ZodString>;
430
+ }, z.core.$strict>;
431
+ version: z.ZodNumber;
432
+ revisions: z.ZodArray<z.ZodObject<{
433
+ id: z.ZodString;
434
+ name: z.ZodString;
435
+ text: z.ZodString;
436
+ revision: z.ZodString;
437
+ source: z.ZodOptional<z.ZodString>;
438
+ }, z.core.$strict>>;
439
+ publishedRevision: z.ZodOptional<z.ZodString>;
440
+ source: z.ZodOptional<z.ZodEnum<{
441
+ local: "local";
442
+ cloud: "cloud";
443
+ }>>;
444
+ cloudRevision: z.ZodOptional<z.ZodString>;
445
+ updatedAt: z.ZodNumber;
446
+ }, z.core.$strict>>;
447
+ }, z.core.$strict>>;
448
+ //#endregion
449
+ //#region src/flow/repository.d.ts
450
+ interface IndexedDbFlowRepositoryOptions {
451
+ factory?: IDBFactory;
452
+ namePrefix?: string;
453
+ }
454
+ export declare function createIndexedDbFlowRepository(scope: FlowScope, options?: IndexedDbFlowRepositoryOptions): FlowRepository;
455
+ //#endregion
456
+ //#region src/flow/bundle.d.ts
457
+ /** 额外实现仅用于当前账号/空间的管理交换,不能扩展当前终端的执行授权。 */
458
+ interface FlowBundleCompatibility {
459
+ additionalScopes: Array<{
460
+ client: FlowClient;
461
+ bindingSet: string;
462
+ }>;
463
+ }
464
+ export declare function exportFlowBundle(repository: FlowRepository, options?: FlowExportOptions): Promise<FlowBundle>;
465
+ export declare function previewFlowImport(repository: FlowRepository, raw: unknown, compatibility?: FlowBundleCompatibility): Promise<FlowImportPreview>;
466
+ export declare function importFlowBundle(repository: FlowRepository, preview: FlowImportPreview, strategy: FlowImportStrategy, compatibility?: FlowBundleCompatibility,
467
+ /** 本地管理界面确认导入后,连同依赖一起保存为可执行内容。 */
468
+ activate?: boolean): Promise<void>;
469
+ //#endregion
470
+ //#region src/flow/runner.d.ts
471
+ interface FlowRunnerOptions {
472
+ client: FlowClient;
473
+ bindings: FlowBindings;
474
+ execution: FlowExecutionPorts;
475
+ present: FlowPresenter;
476
+ generate?: FlowGenerator;
477
+ resolveKnowledge?: (ref: string, revision: string, context: FlowContext) => Promise<FlowKnowledge>;
478
+ allowedEffects?: Array<FlowActionBinding['effect']>;
479
+ confirmAction?: (action: FlowAction, context: FlowContext) => Promise<boolean>;
480
+ generationTimeoutMs?: number;
481
+ regionHost?: FlowRegionHost;
482
+ selectRegionCandidate?: FlowRegionSelector;
483
+ evaluateCompletionCheck?: FlowCompletionEvaluator;
484
+ }
485
+ export declare function createFlowRunner(deps: FlowRunnerOptions): FlowRunner;
486
+ //#endregion
487
+ //#region src/flow/cloud.d.ts
488
+ interface FlowCloudOptions {
489
+ adapter: FlowCloudAdapter;
490
+ client: FlowClient;
491
+ bindings: FlowBindings;
492
+ /** 管理可开放另一端的能力目录;执行仍仅使用当前终端绑定。 */
493
+ managementBindings?: Partial<Record<FlowClient, FlowBindings>>;
494
+ getSessionContext: () => FlowSessionContext | Promise<FlowSessionContext>;
495
+ repositoryFactory: (scope: FlowScope) => FlowRepository | Promise<FlowRepository>;
496
+ onIdentityChange?: () => void | Promise<void>;
497
+ onRevoke?: (keys: string[], revisions: Array<{
498
+ key: string;
499
+ revision: string;
500
+ }>) => void | Promise<void>;
501
+ }
502
+ export declare function createFlowCloud(deps: FlowCloudOptions): FlowCloudController;
503
+ //#endregion
504
+ //#region src/flow/apiAdapter.d.ts
505
+ export declare function createFlowApiAdapter(options: FlowApiSyncOptions, context: {
506
+ client: FlowClient;
507
+ bindings: FlowBindings;
508
+ }): FlowCloudAdapter;
509
+ //#endregion
510
+ //#region src/tour/sections.d.ts
511
+ type VisibilityCheck = (el: Element) => boolean;
512
+ //#endregion
513
+ //#region src/flow/regions.d.ts
514
+ export declare function validateRegionPages(scene: FlowScene, host: FlowRegionHost | undefined, signal: AbortSignal): Promise<void>;
515
+ interface LocateRegionOptions {
516
+ host?: FlowRegionHost;
517
+ bindings: FlowBindings;
518
+ select?: FlowRegionSelector;
519
+ timeoutMs?: number;
520
+ visible?: VisibilityCheck;
521
+ }
522
+ export declare function locateFlowRegion(definition: FlowRegion, context: FlowContext, options: LocateRegionOptions): Promise<FlowResolvedTarget>;
523
+ //#endregion
524
+ //#region src/flow/picker.d.ts
525
+ type FlowRegionPickerState = 'preparing' | 'browsing' | 'picking' | 'confirming' | 'idle';
526
+ interface FlowRegionPickerOptions {
527
+ host: FlowRegionHost;
528
+ client: FlowClient;
529
+ pageId?: string;
530
+ signal?: AbortSignal;
531
+ /** 恢复 token、身份、终端、执行互斥由调用方核验。 */
532
+ isValid?: () => boolean;
533
+ visible?: VisibilityCheck;
534
+ onConfirm(region: FlowRegion): void;
535
+ onClose?(): void;
536
+ }
537
+ interface FlowRegionPicker {
538
+ startPicking(): Promise<void>;
539
+ confirm(): Promise<void>;
540
+ reselect(): void;
541
+ cancel(): void;
542
+ getState(): FlowRegionPickerState;
543
+ }
544
+ export declare function createFlowRegionPicker(options: FlowRegionPickerOptions): FlowRegionPicker;
545
+ //#endregion
546
+ //#region src/flow/checks.d.ts
547
+ export declare function evaluateFlowCompletion(check: FlowDescriptionCheck, description: string, options: {
548
+ host?: FlowRegionHost;
549
+ client: FlowClient;
550
+ sessionId: string;
551
+ signal: AbortSignal;
552
+ evaluate?: FlowCompletionEvaluator;
553
+ }): Promise<FlowCompletionDecision>;
554
+ export declare function createCompletionEvaluator(llm: NormalizedLLMOptions): FlowCompletionEvaluator;
555
+ //#endregion
556
+ export { FLOW_BUNDLE_VERSION, FLOW_SCHEMA_VERSION, FLOW_SEGMENT_MAX_CHARS, FlowAction, FlowActionBinding, FlowApiRequest, FlowApiResponse, FlowApiSyncOptions, FlowBindings, FlowBoundCheck, FlowBundle, type FlowBundleCompatibility, FlowCheck, FlowCheckBinding, FlowClient, FlowCloudAdapter, FlowCloudCache, FlowCloudController, type FlowCloudOptions, 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, type FlowRegionPicker, type FlowRegionPickerOptions, type FlowRegionPickerState, FlowRegionSelector, FlowRepository, FlowRepositorySnapshot, FlowResolvedTarget, FlowRunOptions, FlowRunResult, FlowRunner, type FlowRunnerOptions, FlowScene, FlowSceneRecord, FlowScope, FlowSegment, FlowSegmentLog, FlowSessionContext, FlowSnapshot, FlowStatus, FlowStep, FlowTombstone, type IndexedDbFlowRepositoryOptions, JsonObject, JsonValue, type MountPageUseManagerOptions, PAGE_USE_FLOW_TOOL, PAGE_USE_MANAGER_TAG, PageUseFlowHandle, PageUseFlowOptions, PageUseManagerElement, type PageUseManagerPresentation, definePageUseManagerElement, getPageUseFlowCatalog, mountPageUseManager, newRevision, parseFlowBundle, parseFlowKnowledge, parseFlowRegion, parseFlowScene, parseFlowSceneDraft, runPageUseFlowTool, sceneKey, scopeKey, validateFlowInputs, validateSceneBindings };
package/dist/flow.mjs ADDED
@@ -0,0 +1,11 @@
1
+ import { A as parseFlowBundle, C as createIndexedDbFlowRepository, D as flowSceneDraftSchema, E as flowBundleSchema, F as sceneKey, I as scopeKey, L as validateFlowInputs, Lt as FLOW_BUNDLE_VERSION, M as parseFlowRegion, N as parseFlowScene, O as flowSceneSchema, P as parseFlowSceneDraft, Rt as FLOW_SCHEMA_VERSION, S as previewFlowImport, _ 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 FlowError } from "./tool-CcgpA1W5.mjs";
2
+ import { z } from "zod/v4";
3
+
4
+ //#region src/flow/schema.ts
5
+ /** 中台可直接消费的 JSON Schema;语义引用/业务绑定在运行时另行验证。 */
6
+ const FLOW_SCENE_JSON_SCHEMA = z.toJSONSchema(flowSceneSchema, { target: "draft-07" });
7
+ const FLOW_SCENE_DRAFT_JSON_SCHEMA = z.toJSONSchema(flowSceneDraftSchema, { target: "draft-07" });
8
+ const FLOW_BUNDLE_JSON_SCHEMA = z.toJSONSchema(flowBundleSchema, { target: "draft-07" });
9
+
10
+ //#endregion
11
+ export { FLOW_BUNDLE_JSON_SCHEMA, FLOW_BUNDLE_VERSION, FLOW_SCENE_DRAFT_JSON_SCHEMA, FLOW_SCENE_JSON_SCHEMA, FLOW_SCHEMA_VERSION, FLOW_SEGMENT_MAX_CHARS, FlowError, PAGE_USE_FLOW_TOOL, PAGE_USE_MANAGER_TAG, PageUseManagerElement, createCompletionEvaluator, createFlowApiAdapter, createFlowCloud, createFlowRegionPicker, createFlowRunner, createIndexedDbFlowRepository, definePageUseManagerElement, evaluateFlowCompletion, exportFlowBundle, getPageUseFlowCatalog, importFlowBundle, locateFlowRegion, mountPageUseManager, newRevision, parseFlowBundle, parseFlowKnowledge, parseFlowRegion, parseFlowScene, parseFlowSceneDraft, previewFlowImport, runPageUseFlowTool, sceneKey, scopeKey, validateFlowInputs, validateRegionPages, validateSceneBindings };