@webskill/sdk 0.2.8 → 0.4.0
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 +42 -0
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +4 -9
- package/dist/{catalogComponents-C_V39rbF-BOHveMWa.js → catalogComponents-KsujmL4b-Clx1kCnU.js} +278 -122
- package/dist/client-BCM6Z3yq-qUQNkKrK.js +7787 -0
- package/dist/{dist-BQzncxXg.js → dist-8oQRa8Xz.js} +212 -13
- package/dist/{dist-B9VLwOME.js → dist-C-Sh0MDU.js} +1019 -317
- package/dist/{dist-CtBLBbEz.js → dist-D9Lcn5Pp.js} +528 -838
- package/dist/governance.d.ts +46 -11
- package/dist/governance.js +152 -25
- package/dist/{index-7DVaZJU7.d.ts → index-CHXxDccV.d.ts} +62 -144
- package/dist/{index-QrHtAudz.d.ts → index-DLfR2Y6I.d.ts} +412 -21
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -3
- package/dist/mcp.d.ts +2 -2
- package/dist/mcp.js +2 -2
- package/dist/memoryArtifactStore-BtOeB_hm-tj3fC5ip.js +78 -0
- package/dist/node.d.ts +297 -4
- package/dist/node.js +281 -7
- package/dist/{openUiLibrary-B8-Cvou9-D3RsU2EB.js → openUiLibrary-YLS-cxyT-C96jWDQq.js} +6 -5
- package/dist/skillVersionStore-uyefLPR1-DXOzbksv.d.ts +158 -0
- package/dist/stdio-CFMoANJJ-BxrTeXh7.js +31 -0
- package/dist/{testing-BUoXvm1u.js → testing-DDCJWvgA.js} +8 -6
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +2 -2
- package/dist/{types-AmKCKJn_-BogJPQHU.d.ts → types-7Wcg--Vh-1YlQ4jF9.d.ts} +219 -70
- package/dist/types-WovEf4ED-CZSDiiBU.js +6215 -0
- package/dist/ui-react.d.ts +329 -18
- package/dist/ui-react.js +3715 -3464
- package/dist/ui-vue.d.ts +1 -1
- package/dist/ui-vue.js +1 -1
- package/dist/ui.d.ts +4 -3
- package/dist/ui.js +3 -3
- package/dist/{webskillLitCatalog-CNaUpasU-CfSRvqCZ.js → webskillLitCatalog-CSTbhBe_-CYIs5BX8.js} +312 -122
- package/package.json +4 -7
- package/dist/jsonRenderRegistry-9GrWP_hE-CQY8bT9w.js +0 -2468
- package/dist/memoryArtifactStore-C9lFVqPF-yFz6yJj0.js +0 -48
- package/dist/skillVersionStore-B7rGjtMi-BgnQho9v.d.ts +0 -365
package/dist/ui-react.d.ts
CHANGED
|
@@ -1,15 +1,258 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { E as UiSurfaceActionResponse, S as UiSpecEvent, T as UiSurfaceActionRequest, b as UiSpecActionCapability, o as InteractionRequest, pt as UiSpecNode, s as InteractionResponse, v as RenderResultRequest, w as UiSpecSnapshot, x as UiSpecDrafts, y as UiBridge } from "./types-7Wcg--Vh-1YlQ4jF9.js";
|
|
2
|
+
import { y as InteractionSpecLabels } from "./index-CHXxDccV.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { ComponentType, ReactNode } from "react";
|
|
5
|
+
import "react/jsx-runtime";
|
|
6
|
+
//#region ../../node_modules/.pnpm/@json-render+core@0.19.0_zod@4.4.3/node_modules/@json-render/core/dist/store-utils-D98Czbil.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Confirmation dialog configuration
|
|
9
|
+
*/
|
|
10
|
+
interface ActionConfirm {
|
|
11
|
+
title: string;
|
|
12
|
+
message: string;
|
|
13
|
+
confirmLabel?: string;
|
|
14
|
+
cancelLabel?: string;
|
|
15
|
+
variant?: "default" | "danger";
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Action success handler
|
|
19
|
+
*/
|
|
20
|
+
type ActionOnSuccess = {
|
|
21
|
+
navigate: string;
|
|
22
|
+
} | {
|
|
23
|
+
set: Record<string, unknown>;
|
|
24
|
+
} | {
|
|
25
|
+
action: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Action error handler
|
|
29
|
+
*/
|
|
30
|
+
type ActionOnError = {
|
|
31
|
+
set: Record<string, unknown>;
|
|
32
|
+
} | {
|
|
33
|
+
action: string;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Action binding — maps an event to an action invocation.
|
|
37
|
+
*
|
|
38
|
+
* Used inside the `on` field of a UIElement:
|
|
39
|
+
* ```json
|
|
40
|
+
* { "on": { "press": { "action": "setState", "params": { "statePath": "/x", "value": 1 } } } }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
interface ActionBinding {
|
|
44
|
+
/** Action name (must be in catalog) */
|
|
45
|
+
action: string;
|
|
46
|
+
/** Parameters to pass to the action handler */
|
|
47
|
+
params?: Record<string, DynamicValue>;
|
|
48
|
+
/** Confirmation dialog before execution */
|
|
49
|
+
confirm?: ActionConfirm;
|
|
50
|
+
/** Handler after successful execution */
|
|
51
|
+
onSuccess?: ActionOnSuccess;
|
|
52
|
+
/** Handler after failed execution */
|
|
53
|
+
onError?: ActionOnError;
|
|
54
|
+
/** Whether to prevent default browser behavior (e.g. navigation on links) */
|
|
55
|
+
preventDefault?: boolean;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Dynamic value - can be a literal or a `{ $state }` reference to the state model.
|
|
59
|
+
*
|
|
60
|
+
* Used in action params and validation args where values can either be
|
|
61
|
+
* hardcoded or resolved from state at runtime.
|
|
62
|
+
*/
|
|
63
|
+
type DynamicValue<T = unknown> = T | {
|
|
64
|
+
$state: string;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Base UI element structure for v2
|
|
68
|
+
*/
|
|
69
|
+
interface UIElement<T extends string = string, P = Record<string, unknown>> {
|
|
70
|
+
/** Component type from the catalog */
|
|
71
|
+
type: T;
|
|
72
|
+
/** Component props */
|
|
73
|
+
props: P;
|
|
74
|
+
/** Child element keys (flat structure) */
|
|
75
|
+
children?: string[];
|
|
76
|
+
/** Visibility condition */
|
|
77
|
+
visible?: VisibilityCondition;
|
|
78
|
+
/** Event bindings — maps event names to action bindings */
|
|
79
|
+
on?: Record<string, ActionBinding | ActionBinding[]>;
|
|
80
|
+
/** Repeat children once per item in a state array */
|
|
81
|
+
repeat?: {
|
|
82
|
+
statePath: string;
|
|
83
|
+
key?: string;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* State watchers — maps JSON Pointer state paths to action bindings.
|
|
87
|
+
* When the value at a watched path changes, the bound actions fire.
|
|
88
|
+
* Useful for cascading dependencies (e.g. country → city option loading).
|
|
89
|
+
*/
|
|
90
|
+
watch?: Record<string, ActionBinding | ActionBinding[]>;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Shared comparison operators for visibility conditions.
|
|
94
|
+
*
|
|
95
|
+
* Use at most ONE comparison operator per condition. If multiple are
|
|
96
|
+
* provided, only the first matching one is evaluated (precedence:
|
|
97
|
+
* eq > neq > gt > gte > lt > lte). With no operator, truthiness is checked.
|
|
98
|
+
*
|
|
99
|
+
* `not` inverts the final result of whichever operator (or truthiness
|
|
100
|
+
* check) is used.
|
|
101
|
+
*/
|
|
102
|
+
type ComparisonOperators = {
|
|
103
|
+
eq?: unknown;
|
|
104
|
+
neq?: unknown;
|
|
105
|
+
gt?: number | {
|
|
106
|
+
$state: string;
|
|
107
|
+
};
|
|
108
|
+
gte?: number | {
|
|
109
|
+
$state: string;
|
|
110
|
+
};
|
|
111
|
+
lt?: number | {
|
|
112
|
+
$state: string;
|
|
113
|
+
};
|
|
114
|
+
lte?: number | {
|
|
115
|
+
$state: string;
|
|
116
|
+
};
|
|
117
|
+
not?: true;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* A single state-based condition.
|
|
121
|
+
* Resolves `$state` to a value from the state model, then applies the operator.
|
|
122
|
+
* Without an operator, checks truthiness.
|
|
123
|
+
*
|
|
124
|
+
* When `not` is `true`, the result of the entire condition is inverted.
|
|
125
|
+
* For example `{ $state: "/count", gt: 5, not: true }` means "NOT greater than 5".
|
|
126
|
+
*/
|
|
127
|
+
type StateCondition = {
|
|
128
|
+
$state: string;
|
|
129
|
+
} & ComparisonOperators;
|
|
130
|
+
/**
|
|
131
|
+
* A condition that resolves `$item` to a field on the current repeat item.
|
|
132
|
+
* Only meaningful inside a `repeat` scope.
|
|
133
|
+
*
|
|
134
|
+
* Use `""` to reference the whole item, or `"field"` for a specific field.
|
|
135
|
+
*/
|
|
136
|
+
type ItemCondition = {
|
|
137
|
+
$item: string;
|
|
138
|
+
} & ComparisonOperators;
|
|
139
|
+
/**
|
|
140
|
+
* A condition that resolves `$index` to the current repeat array index.
|
|
141
|
+
* Only meaningful inside a `repeat` scope.
|
|
142
|
+
*/
|
|
143
|
+
type IndexCondition = {
|
|
144
|
+
$index: true;
|
|
145
|
+
} & ComparisonOperators;
|
|
146
|
+
/** A single visibility condition (state, item, or index). */
|
|
147
|
+
type SingleCondition = StateCondition | ItemCondition | IndexCondition;
|
|
148
|
+
/**
|
|
149
|
+
* AND wrapper — all child conditions must be true.
|
|
150
|
+
* This is the explicit form of the implicit array AND (`SingleCondition[]`).
|
|
151
|
+
* Unlike the implicit form, `$and` supports nested `$or` and `$and` conditions.
|
|
152
|
+
*/
|
|
153
|
+
type AndCondition = {
|
|
154
|
+
$and: VisibilityCondition[];
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* OR wrapper — at least one child condition must be true.
|
|
158
|
+
*/
|
|
159
|
+
type OrCondition = {
|
|
160
|
+
$or: VisibilityCondition[];
|
|
161
|
+
};
|
|
162
|
+
/**
|
|
163
|
+
* Visibility condition types.
|
|
164
|
+
* - `boolean` — always/never
|
|
165
|
+
* - `SingleCondition` — single condition (`$state`, `$item`, or `$index`)
|
|
166
|
+
* - `SingleCondition[]` — implicit AND (all must be true)
|
|
167
|
+
* - `AndCondition` — `{ $and: [...] }`, explicit AND (all must be true)
|
|
168
|
+
* - `OrCondition` — `{ $or: [...] }`, at least one must be true
|
|
169
|
+
*/
|
|
170
|
+
type VisibilityCondition = boolean | SingleCondition | SingleCondition[] | AndCondition | OrCondition;
|
|
171
|
+
/**
|
|
172
|
+
* State model type
|
|
173
|
+
*/
|
|
174
|
+
type StateModel = Record<string, unknown>;
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region ../../node_modules/.pnpm/@json-render+react@0.19.0_react@19.2.8_zod@4.4.3/node_modules/@json-render/react/dist/index.d.ts
|
|
177
|
+
/**
|
|
178
|
+
* State setter function for updating application state
|
|
179
|
+
*/
|
|
180
|
+
type SetState = (updater: (prev: Record<string, unknown>) => Record<string, unknown>) => void;
|
|
181
|
+
/**
|
|
182
|
+
* Handle returned by the `on()` function for a specific event.
|
|
183
|
+
* Provides metadata about the event binding and a method to fire it.
|
|
184
|
+
*
|
|
185
|
+
* @example
|
|
186
|
+
* ```ts
|
|
187
|
+
* const press = on("press");
|
|
188
|
+
* if (press.shouldPreventDefault) e.preventDefault();
|
|
189
|
+
* press.emit();
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
interface EventHandle {
|
|
193
|
+
/** Fire the event (resolve action bindings) */
|
|
194
|
+
emit: () => void;
|
|
195
|
+
/** Whether any binding requested preventDefault */
|
|
196
|
+
shouldPreventDefault: boolean;
|
|
197
|
+
/** Whether any handler is bound to this event */
|
|
198
|
+
bound: boolean;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Props passed to component renderers
|
|
202
|
+
*/
|
|
203
|
+
interface ComponentRenderProps<P = Record<string, unknown>> {
|
|
204
|
+
/** The element being rendered */
|
|
205
|
+
element: UIElement<string, P>;
|
|
206
|
+
/** Rendered children */
|
|
207
|
+
children?: ReactNode;
|
|
208
|
+
/** Emit a named event. The renderer resolves the event to action binding(s) from the element's `on` field. Always provided by the renderer. */
|
|
209
|
+
emit: (event: string) => void;
|
|
210
|
+
/** Get an event handle with metadata (shouldPreventDefault, bound). Use when you need to inspect event bindings. */
|
|
211
|
+
on: (event: string) => EventHandle;
|
|
212
|
+
/**
|
|
213
|
+
* Two-way binding paths resolved from `$bindState` / `$bindItem` expressions.
|
|
214
|
+
* Maps prop name → absolute state path for write-back.
|
|
215
|
+
* Only present when at least one prop uses `{ $bindState: "..." }` or `{ $bindItem: "..." }`.
|
|
216
|
+
*/
|
|
217
|
+
bindings?: Record<string, string>;
|
|
218
|
+
/** Whether the parent is loading */
|
|
219
|
+
loading?: boolean;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Component renderer type
|
|
223
|
+
*/
|
|
224
|
+
type ComponentRenderer<P = Record<string, unknown>> = ComponentType<ComponentRenderProps<P>>;
|
|
225
|
+
/**
|
|
226
|
+
* Registry of component renderers
|
|
227
|
+
*/
|
|
228
|
+
type ComponentRegistry = Record<string, ComponentRenderer<any>>;
|
|
229
|
+
/**
|
|
230
|
+
* Result returned by defineRegistry
|
|
231
|
+
*/
|
|
232
|
+
interface DefineRegistryResult {
|
|
233
|
+
/** Component registry for `<Renderer registry={...} />` */
|
|
234
|
+
registry: ComponentRegistry;
|
|
235
|
+
/**
|
|
236
|
+
* Create ActionProvider-compatible handlers.
|
|
237
|
+
* Accepts getter functions so handlers always read the latest state/setState
|
|
238
|
+
* (e.g. from React refs).
|
|
239
|
+
*/
|
|
240
|
+
handlers: (getSetState: () => SetState | undefined, getState: () => StateModel) => Record<string, (params: Record<string, unknown>) => Promise<void>>;
|
|
241
|
+
/**
|
|
242
|
+
* Execute an action by name imperatively
|
|
243
|
+
* (for use outside the React tree, e.g. initial state loading).
|
|
244
|
+
*/
|
|
245
|
+
executeAction: (actionName: string, params: Record<string, unknown> | undefined, setState: SetState, state?: StateModel) => Promise<void>;
|
|
246
|
+
}
|
|
247
|
+
//#endregion
|
|
5
248
|
//#region ../ui-react/dist/index.d.ts
|
|
6
249
|
//#region src/surfaceStore.d.ts
|
|
7
250
|
/** Observable, revision-checked snapshot store for framework-neutral UI surfaces. @experimental */
|
|
8
251
|
declare class UiSurfaceStore {
|
|
9
252
|
#private;
|
|
10
253
|
subscribe: (listener: () => void) => (() => void);
|
|
11
|
-
get snapshots(): readonly
|
|
12
|
-
apply(event:
|
|
254
|
+
get snapshots(): readonly UiSpecSnapshot[];
|
|
255
|
+
apply(event: UiSpecEvent): void;
|
|
13
256
|
}
|
|
14
257
|
//#endregion
|
|
15
258
|
//#region src/bridgeState.d.ts
|
|
@@ -30,9 +273,9 @@ declare class ReactBridgeState implements UiBridge {
|
|
|
30
273
|
streamingRunId: string | null;
|
|
31
274
|
streamingText: string;
|
|
32
275
|
constructor(options?: ReactBridgeStateOptions);
|
|
33
|
-
get surfaceSnapshots(): readonly
|
|
34
|
-
surfaceDrafts(runId: string):
|
|
35
|
-
restoreSurfaceDrafts(runId: string, drafts:
|
|
276
|
+
get surfaceSnapshots(): readonly UiSpecSnapshot[];
|
|
277
|
+
surfaceDrafts(runId: string): UiSpecDrafts;
|
|
278
|
+
restoreSurfaceDrafts(runId: string, drafts: UiSpecDrafts | undefined): void;
|
|
36
279
|
setSurfaceDraft(runId: string, surfaceId: string, value: Record<string, unknown>): void;
|
|
37
280
|
/** React useSyncExternalStore 兼容订阅 */
|
|
38
281
|
subscribe: (listener: () => void) => (() => void);
|
|
@@ -42,7 +285,7 @@ declare class ReactBridgeState implements UiBridge {
|
|
|
42
285
|
/** runtime 交互超时/取消:卸载表单并以 cancelled resolve pending Promise(防悬挂 + 残留) */
|
|
43
286
|
cancel(id: string): void;
|
|
44
287
|
renderResult(input: RenderResultRequest): Promise<void>;
|
|
45
|
-
renderSurface(event:
|
|
288
|
+
renderSurface(event: UiSpecEvent): Promise<void>;
|
|
46
289
|
requestSurfaceAction(input: UiSurfaceActionRequest): Promise<UiSurfaceActionResponse>;
|
|
47
290
|
/** Resolves exactly one pending action capability; stale or duplicate nonces are ignored. */
|
|
48
291
|
resolveSurfaceAction(response: UiSurfaceActionResponse): boolean;
|
|
@@ -72,14 +315,14 @@ declare function StreamingText({ bridge }: {
|
|
|
72
315
|
interface CustomSurfaceActionEvent {
|
|
73
316
|
surfaceId: string;
|
|
74
317
|
actionId: string;
|
|
75
|
-
intent:
|
|
318
|
+
intent: UiSpecActionCapability['intent'];
|
|
76
319
|
nonce?: string;
|
|
77
320
|
value?: Record<string, unknown>;
|
|
78
321
|
}
|
|
79
322
|
interface RegisteredSurfaceProps<Props> {
|
|
80
323
|
surfaceId: string;
|
|
81
324
|
props: Props;
|
|
82
|
-
actions: readonly
|
|
325
|
+
actions: readonly UiSpecActionCapability[];
|
|
83
326
|
onAction?(event: CustomSurfaceActionEvent): void;
|
|
84
327
|
}
|
|
85
328
|
interface SurfaceRegistration<Props> {
|
|
@@ -102,7 +345,7 @@ interface UiSurfaceActionEvent {
|
|
|
102
345
|
runId?: string;
|
|
103
346
|
surfaceId: string;
|
|
104
347
|
actionId: string;
|
|
105
|
-
intent:
|
|
348
|
+
intent: UiSpecActionCapability['intent'];
|
|
106
349
|
nonce?: string;
|
|
107
350
|
value?: Record<string, unknown>;
|
|
108
351
|
}
|
|
@@ -114,10 +357,10 @@ interface UiSurfaceListProps {
|
|
|
114
357
|
onAction?(event: UiSurfaceActionEvent): void;
|
|
115
358
|
}
|
|
116
359
|
interface UiSurfaceSnapshotListProps {
|
|
117
|
-
snapshots: readonly
|
|
360
|
+
snapshots: readonly UiSpecSnapshot[];
|
|
118
361
|
registry?: SurfaceRegistry;
|
|
119
362
|
onAction?(event: UiSurfaceActionEvent): void;
|
|
120
|
-
drafts?:
|
|
363
|
+
drafts?: UiSpecDrafts;
|
|
121
364
|
onDraftChange?(event: {
|
|
122
365
|
runId: string;
|
|
123
366
|
surfaceId: string;
|
|
@@ -135,35 +378,103 @@ declare const NATIVE_SPEC_COMPONENTS: readonly string[];
|
|
|
135
378
|
interface NativeSpecSurfaceProps {
|
|
136
379
|
surfaceId: string;
|
|
137
380
|
spec: UiSpecNode;
|
|
138
|
-
actions: readonly
|
|
381
|
+
actions: readonly UiSpecActionCapability[];
|
|
139
382
|
registry?: SurfaceRegistry;
|
|
383
|
+
/** 草稿归属的运行;缺省表示不持久化(历史回放) */
|
|
384
|
+
runId?: string;
|
|
385
|
+
draft?: Record<string, unknown>;
|
|
140
386
|
onAction?(event: CustomSurfaceActionEvent): void;
|
|
387
|
+
onDraftChange?(event: {
|
|
388
|
+
runId: string;
|
|
389
|
+
surfaceId: string;
|
|
390
|
+
value: Record<string, unknown>;
|
|
391
|
+
}): void;
|
|
141
392
|
}
|
|
142
393
|
/**
|
|
143
394
|
* Native 档的 catalog registry:把声明树渲染成 ui-kit 组件。
|
|
144
395
|
* 越界组件名不静默降级,渲染成英文错误行(21 号文档 §8 第 5 条)。
|
|
396
|
+
*
|
|
397
|
+
* 表单行为(草稿跨刷新、必填拦截、默认值)由本组件承接——
|
|
398
|
+
* 节点树取代六类 surface 后,这里是 native 档唯一的渲染实现。
|
|
145
399
|
*/
|
|
146
|
-
declare function NativeSpecSurface({ surfaceId, spec, actions, registry, onAction }: NativeSpecSurfaceProps): import("react").JSX.Element;
|
|
400
|
+
declare function NativeSpecSurface({ surfaceId, spec, actions, registry, runId, draft, onAction, onDraftChange }: NativeSpecSurfaceProps): import("react").JSX.Element;
|
|
147
401
|
//#endregion
|
|
148
402
|
//#region src/catalog/JsonRenderSpecSurface.d.ts
|
|
149
403
|
interface JsonRenderSpecSurfaceProps {
|
|
150
404
|
spec: UiSpecNode;
|
|
405
|
+
surfaceId: string;
|
|
406
|
+
actions?: readonly UiSpecActionCapability[];
|
|
407
|
+
onAction?: (event: CustomSurfaceActionEvent) => void;
|
|
151
408
|
}
|
|
152
409
|
/**
|
|
153
410
|
* `vercel` 档:同一份 catalog 声明树交给 json-render 的 Registry 渲染。
|
|
154
411
|
* `@json-render/*` 是 optional peer,未安装时给出英文说明而不是空白。
|
|
155
412
|
*/
|
|
156
|
-
declare function JsonRenderSpecSurface({ spec }: JsonRenderSpecSurfaceProps): import("react").JSX.Element | null;
|
|
413
|
+
declare function JsonRenderSpecSurface({ spec, surfaceId, actions, onAction }: JsonRenderSpecSurfaceProps): import("react").JSX.Element | null;
|
|
414
|
+
//#endregion
|
|
415
|
+
//#region src/catalog/jsonRenderRegistry.d.ts
|
|
416
|
+
/** catalog 的 action 名与 `UiSpecActionCapability['intent']` 一一对应 */
|
|
417
|
+
type JsonRenderActionDispatch = (intent: string, params: Record<string, unknown>) => void;
|
|
418
|
+
/**
|
|
419
|
+
* registry 是白名单:catalog 之外的组件名在 Renderer 里直接落到 fallback。
|
|
420
|
+
*
|
|
421
|
+
* 工厂而非模块级单例:action 的派发出口要绑定到具体 surface 的回传通道,
|
|
422
|
+
* 模块级单例会让同屏两个 surface 互相串台。
|
|
423
|
+
*/
|
|
424
|
+
declare function createJsonRenderRegistry(dispatch: JsonRenderActionDispatch): DefineRegistryResult;
|
|
425
|
+
//#endregion
|
|
426
|
+
//#region src/interaction/specInteractionChannel.d.ts
|
|
427
|
+
/** 一次待决交互(节点树由 react 层交给本档的 spec surface 渲染) */
|
|
428
|
+
interface SpecInteractionSession {
|
|
429
|
+
request: InteractionRequest;
|
|
430
|
+
spec: UiSpecNode;
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* 探测 json-render 渲染器是否可用(@json-render/* 为 optional peer)。
|
|
434
|
+
* 交互视图据此在缺包时调 SpecInteractionChannel.fail,让复合桥粘性降级 native 而不是悬挂请求。
|
|
435
|
+
*/
|
|
436
|
+
declare function probeJsonRenderAvailability(): Promise<boolean>;
|
|
437
|
+
/**
|
|
438
|
+
* 非 native 档的交互通道(路径 A,三档共用):
|
|
439
|
+
* - request() 把 InteractionRequest 经 interactionToUiSpec 转成 catalog 节点树并挂起,
|
|
440
|
+
* react 层订阅 current 后用本档已有的 spec 渲染路径(*SpecSurface)渲染;
|
|
441
|
+
* - 表单提交/取消经 handleAction 回传(submit → shapeInteractionValue;cancel → cancelled);
|
|
442
|
+
* - react 层初始化失败调 fail():挂起请求 reject(桥据此粘性降级 native)并记录原因;
|
|
443
|
+
* - attach/detach 标记渲染视图是否挂载(未挂载时桥直接降级 native,不悬挂请求)。
|
|
444
|
+
*/
|
|
445
|
+
declare class SpecInteractionChannel {
|
|
446
|
+
#private;
|
|
447
|
+
/** 宿主注入的界面文案(本地化);未设时用 FormModel 的英文默认值 */
|
|
448
|
+
labelsFor: (request: InteractionRequest) => InteractionSpecLabels;
|
|
449
|
+
/** React useSyncExternalStore 兼容订阅 */
|
|
450
|
+
subscribe: (listener: () => void) => (() => void);
|
|
451
|
+
get current(): SpecInteractionSession | undefined;
|
|
452
|
+
get isAttached(): boolean;
|
|
453
|
+
/** react 层初始化失败原因(optional peer 未安装等);记录后粘性生效 */
|
|
454
|
+
get failure(): string | undefined;
|
|
455
|
+
attach(): void;
|
|
456
|
+
detach(): void;
|
|
457
|
+
request(input: InteractionRequest): Promise<InteractionResponse>;
|
|
458
|
+
/** runtime 交互超时/取消:以 cancelled resolve 挂起的 request(防悬挂 + 残留) */
|
|
459
|
+
cancel(id: string): void;
|
|
460
|
+
/** react 层动作回传:submit 归形提交值,其余意图(cancel)按取消收尾 */
|
|
461
|
+
handleAction(event: CustomSurfaceActionEvent): void;
|
|
462
|
+
/** react 层初始化失败:挂起请求 reject 并记录原因(桥读取后降级 native) */
|
|
463
|
+
fail(message: string): void;
|
|
464
|
+
}
|
|
157
465
|
//#endregion
|
|
158
466
|
//#region src/catalog/OpenUiSpecSurface.d.ts
|
|
159
467
|
interface OpenUiSpecSurfaceProps {
|
|
160
468
|
spec: UiSpecNode;
|
|
469
|
+
surfaceId: string;
|
|
470
|
+
actions?: readonly UiSpecActionCapability[];
|
|
471
|
+
onAction?: (event: CustomSurfaceActionEvent) => void;
|
|
161
472
|
}
|
|
162
473
|
/**
|
|
163
474
|
* `openui` 档:同一份 catalog 声明树经 openui-lang 交给 OpenUI 的 Renderer。
|
|
164
475
|
* `@openuidev/react-lang` 是 optional peer,未安装时给出英文说明而不是空白。
|
|
165
476
|
*/
|
|
166
|
-
declare function OpenUiSpecSurface({ spec }: OpenUiSpecSurfaceProps): import("react").JSX.Element | null;
|
|
477
|
+
declare function OpenUiSpecSurface({ spec, surfaceId, actions, onAction }: OpenUiSpecSurfaceProps): import("react").JSX.Element | null;
|
|
167
478
|
//#endregion
|
|
168
479
|
//#region src/catalog/catalogComponents.d.ts
|
|
169
480
|
type CatalogNodeProps = {
|
|
@@ -177,4 +488,4 @@ type CatalogNodeProps = {
|
|
|
177
488
|
*/
|
|
178
489
|
declare const catalogComponentImpls: Record<string, (input: CatalogNodeProps) => ReactNode>;
|
|
179
490
|
//#endregion
|
|
180
|
-
export { type CatalogNodeProps, type CustomSurfaceActionEvent, InteractionForm, JsonRenderSpecSurface, type JsonRenderSpecSurfaceProps, NATIVE_SPEC_COMPONENTS, NativeSpecSurface, type NativeSpecSurfaceProps, OpenUiSpecSurface, type OpenUiSpecSurfaceProps, ReactBridgeState, type RegisteredSurfaceProps, ResultBlocks, StreamingText, type SurfaceRegistration, SurfaceRegistry, type UiSurfaceActionEvent, UiSurfaceList, type UiSurfaceListProps, UiSurfaceSnapshotList, type UiSurfaceSnapshotListProps, UiSurfaceStore, catalogComponentImpls };
|
|
491
|
+
export { type CatalogNodeProps, type CustomSurfaceActionEvent, InteractionForm, type JsonRenderActionDispatch, JsonRenderSpecSurface, type JsonRenderSpecSurfaceProps, NATIVE_SPEC_COMPONENTS, NativeSpecSurface, type NativeSpecSurfaceProps, OpenUiSpecSurface, type OpenUiSpecSurfaceProps, ReactBridgeState, type RegisteredSurfaceProps, ResultBlocks, SpecInteractionChannel, type SpecInteractionSession, StreamingText, type SurfaceRegistration, SurfaceRegistry, type UiSurfaceActionEvent, UiSurfaceList, type UiSurfaceListProps, UiSurfaceSnapshotList, type UiSurfaceSnapshotListProps, UiSurfaceStore, catalogComponentImpls, createJsonRenderRegistry, probeJsonRenderAvailability };
|