@doubao-dev/framework 0.0.41 → 0.0.42
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/dist/api.d.ts +716 -114
- package/dist/components.d.ts +391 -82
- package/dist/config.d.ts +53 -1
- package/dist/index.d.ts +46 -386
- package/package.json +1 -1
package/dist/config.d.ts
CHANGED
|
@@ -31,6 +31,10 @@ declare interface AIAppMetadata {
|
|
|
31
31
|
* 是否声明小程序已适配深色模式
|
|
32
32
|
*/
|
|
33
33
|
darkMode?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* 应用级对话框能力配置
|
|
36
|
+
*/
|
|
37
|
+
chat?: AppletChatConfig;
|
|
34
38
|
}
|
|
35
39
|
|
|
36
40
|
declare type AIPageMetadata = Omit<PageDefinition, 'entry' | 'renderType' | 'digest' | 'web'>;
|
|
@@ -77,6 +81,38 @@ declare type AIWidgetMetadata = {
|
|
|
77
81
|
titleType?: 'none' | 'normal' | 'float';
|
|
78
82
|
};
|
|
79
83
|
|
|
84
|
+
declare interface AppletChatConfig {
|
|
85
|
+
/**
|
|
86
|
+
* App-level chat feature overrides.
|
|
87
|
+
*/
|
|
88
|
+
features?: AppletChatFeaturesConfig;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
declare interface AppletChatFeatureConfig {
|
|
92
|
+
/**
|
|
93
|
+
* Whether the chat feature is enabled.
|
|
94
|
+
*/
|
|
95
|
+
enabled: boolean;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
declare interface AppletChatFeaturesConfig {
|
|
99
|
+
/**
|
|
100
|
+
* Camera entry configuration.
|
|
101
|
+
*/
|
|
102
|
+
camera?: AppletChatFeatureConfig;
|
|
103
|
+
/**
|
|
104
|
+
* Extra actions entry configuration.
|
|
105
|
+
*/
|
|
106
|
+
extraActions?: AppletChatFeatureConfig;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
declare interface AppletPageChatConfig {
|
|
110
|
+
/**
|
|
111
|
+
* Whether the chat panel is enabled on this page.
|
|
112
|
+
*/
|
|
113
|
+
enabled: boolean;
|
|
114
|
+
}
|
|
115
|
+
|
|
80
116
|
declare interface BaseDefinition {
|
|
81
117
|
/**
|
|
82
118
|
* Unique identifier
|
|
@@ -173,6 +209,10 @@ export declare interface DoubaoAppsMetaConfig extends AIAppMetadata {
|
|
|
173
209
|
* Widget entries and widget metadata.
|
|
174
210
|
*/
|
|
175
211
|
widgets?: DoubaoAppsWidgetConfig;
|
|
212
|
+
/**
|
|
213
|
+
* Client Tool entries relative to `src/`.
|
|
214
|
+
*/
|
|
215
|
+
tools?: DoubaoAppsToolConfig;
|
|
176
216
|
}
|
|
177
217
|
|
|
178
218
|
export declare type DoubaoAppsObject = Record<string, unknown>;
|
|
@@ -213,6 +253,8 @@ export declare interface DoubaoAppsPlugin {
|
|
|
213
253
|
setup: (api: any) => void | Promise<void>;
|
|
214
254
|
}
|
|
215
255
|
|
|
256
|
+
export declare type DoubaoAppsToolConfig = string[];
|
|
257
|
+
|
|
216
258
|
export declare type DoubaoAppsWidgetConfig = DoubaoAppsWidgetEntryConfig[] | DoubaoAppsLegacyEntryConfig<DoubaoAppsWidgetMetaConfig>;
|
|
217
259
|
|
|
218
260
|
export declare type DoubaoAppsWidgetEntryConfig = string | ({
|
|
@@ -221,7 +263,7 @@ export declare type DoubaoAppsWidgetEntryConfig = string | ({
|
|
|
221
263
|
|
|
222
264
|
export declare type DoubaoAppsWidgetMetaConfig = Omit<AIWidgetMetadata, 'id'> & {
|
|
223
265
|
/**
|
|
224
|
-
* Widget ID. Defaults to the entry directory name.
|
|
266
|
+
* Globally unique Widget ID. Defaults to the entry directory name.
|
|
225
267
|
*/
|
|
226
268
|
id?: string;
|
|
227
269
|
name?: string;
|
|
@@ -241,6 +283,12 @@ export declare type DoubaoAppsWidgetMetaConfig = Omit<AIWidgetMetadata, 'id'> &
|
|
|
241
283
|
export declare type Icons = string | Record<'1x' | '2x' | '3x', string>;
|
|
242
284
|
|
|
243
285
|
declare interface PageDefinition extends UIModuleDefinition {
|
|
286
|
+
/**
|
|
287
|
+
* The legacy page identifier.
|
|
288
|
+
*
|
|
289
|
+
* @deprecated Use `path` as the Page identity.
|
|
290
|
+
*/
|
|
291
|
+
id: string;
|
|
244
292
|
/**
|
|
245
293
|
* The page navbar title
|
|
246
294
|
*/
|
|
@@ -249,6 +297,10 @@ declare interface PageDefinition extends UIModuleDefinition {
|
|
|
249
297
|
* The page path
|
|
250
298
|
*/
|
|
251
299
|
path: string;
|
|
300
|
+
/**
|
|
301
|
+
* Page-level chat panel configuration.
|
|
302
|
+
*/
|
|
303
|
+
chat?: AppletPageChatConfig;
|
|
252
304
|
}
|
|
253
305
|
|
|
254
306
|
export declare interface TaroPluginOptions {
|
package/dist/index.d.ts
CHANGED
|
@@ -101,56 +101,9 @@ import { useSyncExternalStore } from 'react';
|
|
|
101
101
|
import { VFC } from 'react';
|
|
102
102
|
import { VoidFunctionComponent } from 'react';
|
|
103
103
|
|
|
104
|
-
declare
|
|
105
|
-
/** Whether the save was successful */
|
|
106
|
-
result: boolean;
|
|
107
|
-
}
|
|
104
|
+
export declare type AgentEventCallback = (payload: AgentEventPayload) => void;
|
|
108
105
|
|
|
109
|
-
declare
|
|
110
|
-
/**
|
|
111
|
-
*
|
|
112
|
-
* 豆包应用 ID
|
|
113
|
-
*
|
|
114
|
-
*/
|
|
115
|
-
appId: string;
|
|
116
|
-
/**
|
|
117
|
-
* 应用名称
|
|
118
|
-
*/
|
|
119
|
-
name?: string;
|
|
120
|
-
/**
|
|
121
|
-
* 应用描述
|
|
122
|
-
*/
|
|
123
|
-
description?: string;
|
|
124
|
-
/**
|
|
125
|
-
* 应用图标
|
|
126
|
-
*
|
|
127
|
-
* 1x, 2x, 3x 分别对应 1x, 2x, 3x 倍的图标
|
|
128
|
-
*/
|
|
129
|
-
icons?: Icons;
|
|
130
|
-
/**
|
|
131
|
-
* 应用关键词
|
|
132
|
-
*/
|
|
133
|
-
keywords?: string[];
|
|
134
|
-
/**
|
|
135
|
-
* 应用版本
|
|
136
|
-
*/
|
|
137
|
-
version?: string;
|
|
138
|
-
/**
|
|
139
|
-
* 是否声明小程序已适配深色模式
|
|
140
|
-
*/
|
|
141
|
-
darkMode?: boolean;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export declare type AIToolContext = MessageMeta & {
|
|
145
|
-
/**
|
|
146
|
-
* callback Id
|
|
147
|
-
*/
|
|
148
|
-
callbackId: string;
|
|
149
|
-
/**
|
|
150
|
-
* feature map
|
|
151
|
-
*/
|
|
152
|
-
featureMap: Record<string, string> | undefined;
|
|
153
|
-
};
|
|
106
|
+
declare type AgentEventPayload = Record<string, unknown>;
|
|
154
107
|
|
|
155
108
|
export declare type AIViewContext = MessageMeta & {
|
|
156
109
|
/**
|
|
@@ -188,18 +141,6 @@ export declare type AIViewContext = MessageMeta & {
|
|
|
188
141
|
};
|
|
189
142
|
};
|
|
190
143
|
|
|
191
|
-
export declare type AnyObject = Record<string, any>;
|
|
192
|
-
|
|
193
|
-
export declare type App<T extends DefineAppOptions = DefineAppOptions> = T & {
|
|
194
|
-
__APP__: boolean;
|
|
195
|
-
__UI__: boolean;
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
declare type AppAIMeta = Omit<AIAppMetadata, 'appId'> & {
|
|
199
|
-
appId?: string;
|
|
200
|
-
package?: string;
|
|
201
|
-
};
|
|
202
|
-
|
|
203
144
|
export { Attributes }
|
|
204
145
|
|
|
205
146
|
export { CElement }
|
|
@@ -266,195 +207,6 @@ export declare interface CurrentPage {
|
|
|
266
207
|
|
|
267
208
|
export { CustomComponentPropsWithRef }
|
|
268
209
|
|
|
269
|
-
export declare function defineApp<T extends DefineAppOptions>(options: T & ThisType<T & {
|
|
270
|
-
readonly aiMeta: AppAIMeta;
|
|
271
|
-
}>): App<T>;
|
|
272
|
-
|
|
273
|
-
export declare interface DefineAppOptions {
|
|
274
|
-
[key: string]: any;
|
|
275
|
-
/**
|
|
276
|
-
* @deprecated Configure app metadata in src/app.config.ts instead.
|
|
277
|
-
*
|
|
278
|
-
* @example
|
|
279
|
-
* ```ts
|
|
280
|
-
* // src/app.config.ts
|
|
281
|
-
* import { defineAppConfig } from '@doubao-dev/framework/config';
|
|
282
|
-
*
|
|
283
|
-
* export default defineAppConfig({
|
|
284
|
-
* appId: 'your-app-id',
|
|
285
|
-
* name: 'Demo App',
|
|
286
|
-
* description: 'Describe what this app can do',
|
|
287
|
-
* icons: 'https://example.com/icon.png',
|
|
288
|
-
* keywords: ['demo', 'doubao']
|
|
289
|
-
* });
|
|
290
|
-
* ```
|
|
291
|
-
*/
|
|
292
|
-
aiMeta?: AppAIMeta;
|
|
293
|
-
/**
|
|
294
|
-
* App launched
|
|
295
|
-
*/
|
|
296
|
-
onLaunch?: () => void;
|
|
297
|
-
/**
|
|
298
|
-
* On page opened
|
|
299
|
-
*/
|
|
300
|
-
onPageOpened?: (params: {
|
|
301
|
-
viewId: string;
|
|
302
|
-
}) => void;
|
|
303
|
-
/**
|
|
304
|
-
* On foreground
|
|
305
|
-
*/
|
|
306
|
-
onForeground?: () => void;
|
|
307
|
-
/**
|
|
308
|
-
* On background
|
|
309
|
-
*/
|
|
310
|
-
onBackground?: () => void;
|
|
311
|
-
/**
|
|
312
|
-
* On destroy
|
|
313
|
-
*/
|
|
314
|
-
onDestroy?: () => void;
|
|
315
|
-
/**
|
|
316
|
-
* Handle errors from other lifecycle hooks in this class or from tools in same Applet
|
|
317
|
-
*/
|
|
318
|
-
onError?: (e: Error) => void;
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
export declare interface DefineFunctionalToolOptions extends Tool {
|
|
322
|
-
onApply: (input: string, context: AIToolContext) => string | object | Promise<string | object>;
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
export declare function defineLoginApi(api: LoginApi): LoginApi;
|
|
326
|
-
|
|
327
|
-
/**
|
|
328
|
-
* 定义 MCP 登录页面
|
|
329
|
-
* @param options 定义 MCP 登录页面的选项
|
|
330
|
-
* @returns 智能服务 MCP 登录页面
|
|
331
|
-
*/
|
|
332
|
-
export declare function defineLoginPage<Data extends AnyObject>(options: Omit<DefinePageToolOptions<Data>, 'aiMeta'> & ThisType<Readonly<PageInstanceMethods<Data>>>): Page<Data>;
|
|
333
|
-
|
|
334
|
-
export declare function definePage<Data extends AnyObject>(options: DefinePageToolOptions<Data> & ThisType<Readonly<PageInstanceMethods<Data>>>): Page<Data>;
|
|
335
|
-
|
|
336
|
-
export declare interface DefinePageToolOptions<Data extends AnyObject> extends DefineUIToolOptions<Data, PageToolExtraMetadata> {
|
|
337
|
-
/**
|
|
338
|
-
* @deprecated Configure page metadata in src/app.config.ts instead.
|
|
339
|
-
*
|
|
340
|
-
* Use `pages` entries in `src/app.config.ts`. For example,
|
|
341
|
-
* `pages/home/index` maps to `src/pages/home/index.tsx`, and
|
|
342
|
-
* `pages/account/demo/index` maps to `src/pages/account/demo/index.tsx`.
|
|
343
|
-
*
|
|
344
|
-
* @example
|
|
345
|
-
* ```ts
|
|
346
|
-
* // src/app.config.ts
|
|
347
|
-
* import { defineAppConfig } from '@doubao-dev/framework/config';
|
|
348
|
-
*
|
|
349
|
-
* export default defineAppConfig({
|
|
350
|
-
* appId: 'your-app-id',
|
|
351
|
-
* pages: ['pages/home/index']
|
|
352
|
-
* });
|
|
353
|
-
* ```
|
|
354
|
-
*/
|
|
355
|
-
aiMeta?: PageToolMetadata;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
export declare function definePrivacyApi(api: PrivacyApi): PrivacyApi;
|
|
359
|
-
|
|
360
|
-
/**
|
|
361
|
-
* 定义 MCP 同意登录和隐私协议卡片组件
|
|
362
|
-
* @param options 定义 MCP 同意登录和隐私协议卡片组件的选项
|
|
363
|
-
* @returns MCP 同意登录和隐私协议卡片组件
|
|
364
|
-
*/
|
|
365
|
-
export declare function definePrivacyLoginWidget<Data extends AnyObject>(options: Omit<DefineWidgetToolOptions<Data>, 'aiMeta'> & ThisType<Readonly<WidgetInstanceMethods<Data>>>): Widget<Data>;
|
|
366
|
-
|
|
367
|
-
export declare function defineTool(options: DefineFunctionalToolOptions & ThisType<Readonly<FunctionalToolInstanceMethods>>): FunctionalTool;
|
|
368
|
-
|
|
369
|
-
export declare interface DefineUIToolOptions<Data extends AnyObject, Extra extends AnyObject = AnyObject> extends Tool<Extra> {
|
|
370
|
-
/**
|
|
371
|
-
* Initial data
|
|
372
|
-
*/
|
|
373
|
-
data?: Data;
|
|
374
|
-
/**
|
|
375
|
-
* Trigger on view created
|
|
376
|
-
* @returns
|
|
377
|
-
*/
|
|
378
|
-
onCreated?: () => void;
|
|
379
|
-
/**
|
|
380
|
-
* It is triggered after the view is rendered and will only be called once in the view's life cycle.
|
|
381
|
-
* @returns
|
|
382
|
-
*/
|
|
383
|
-
onMounted?: () => void;
|
|
384
|
-
/**
|
|
385
|
-
* 1. It is triggered when the view is first displayed.
|
|
386
|
-
* 2. It is triggered when the view is displayed again after being hidden.
|
|
387
|
-
* @returns
|
|
388
|
-
*/
|
|
389
|
-
onShow?: () => void;
|
|
390
|
-
/**
|
|
391
|
-
* It is triggered when the view is hidden.
|
|
392
|
-
* @returns
|
|
393
|
-
*/
|
|
394
|
-
onHide?: () => void;
|
|
395
|
-
/**
|
|
396
|
-
* It is triggered when the view is destroyed.
|
|
397
|
-
* @returns
|
|
398
|
-
*/
|
|
399
|
-
onDestroy?: () => void;
|
|
400
|
-
/**
|
|
401
|
-
* It is triggered when an error occurs.
|
|
402
|
-
* @param e
|
|
403
|
-
* @returns
|
|
404
|
-
*/
|
|
405
|
-
onError?: (e: Error) => void;
|
|
406
|
-
/**
|
|
407
|
-
* Render function
|
|
408
|
-
* Use getViewData() and getViewContext() to access data and context
|
|
409
|
-
* @returns
|
|
410
|
-
*/
|
|
411
|
-
render: () => ReactNode;
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
export declare function defineWidget<Data extends AnyObject>(options: DefineWidgetToolOptions<Data> & ThisType<Readonly<WidgetInstanceMethods<Data>>>): Widget<Data>;
|
|
415
|
-
|
|
416
|
-
export declare interface DefineWidgetToolOptions<Data extends AnyObject> extends DefineUIToolOptions<Data, WidgetToolExtraMetadata> {
|
|
417
|
-
/**
|
|
418
|
-
* @deprecated Configure widget metadata in src/app.config.ts instead.
|
|
419
|
-
*
|
|
420
|
-
* Use `widgets` entries in `src/app.config.ts`. For example,
|
|
421
|
-
* `widgets/card/index` maps to `src/widgets/card/index.tsx`, and
|
|
422
|
-
* `widgets/api/demo/index` maps to `src/widgets/api/demo/index.tsx`.
|
|
423
|
-
*
|
|
424
|
-
* @example
|
|
425
|
-
* ```ts
|
|
426
|
-
* // src/app.config.ts
|
|
427
|
-
* import { defineAppConfig } from '@doubao-dev/framework/config';
|
|
428
|
-
*
|
|
429
|
-
* export default defineAppConfig({
|
|
430
|
-
* appId: 'your-app-id',
|
|
431
|
-
* widgets: [
|
|
432
|
-
* {
|
|
433
|
-
* entry: 'widgets/card/index',
|
|
434
|
-
* id: 'card-widget',
|
|
435
|
-
* name: 'Card Widget',
|
|
436
|
-
* description: 'Show card content',
|
|
437
|
-
* border: true
|
|
438
|
-
* }
|
|
439
|
-
* ]
|
|
440
|
-
* });
|
|
441
|
-
* ```
|
|
442
|
-
*/
|
|
443
|
-
aiMeta?: WidgetToolMetadata;
|
|
444
|
-
/**
|
|
445
|
-
* 1. It is triggered when the app returns to the foreground from the background.
|
|
446
|
-
* 2. It is triggered when phone is unlocked.
|
|
447
|
-
* @returns
|
|
448
|
-
*/
|
|
449
|
-
onForeground?: () => void;
|
|
450
|
-
/**
|
|
451
|
-
* 1. It is triggered when the app is moved to the background.
|
|
452
|
-
* 2. It is triggered when phone is locked.
|
|
453
|
-
* @returns
|
|
454
|
-
*/
|
|
455
|
-
onBackground?: () => void;
|
|
456
|
-
}
|
|
457
|
-
|
|
458
210
|
export { DependencyList }
|
|
459
211
|
|
|
460
212
|
export { DeprecatedLifecycle }
|
|
@@ -489,46 +241,24 @@ export { ForwardRefRenderFunction }
|
|
|
489
241
|
|
|
490
242
|
export { Fragment }
|
|
491
243
|
|
|
492
|
-
export declare interface FunctionalTool extends DefineFunctionalToolOptions {
|
|
493
|
-
__FUNCTIONAL__: boolean;
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
declare type FunctionalToolInstanceMethods = Tool<ToolMetadata>;
|
|
497
|
-
|
|
498
244
|
export { FunctionComponent }
|
|
499
245
|
|
|
500
246
|
export { FunctionComponentElement }
|
|
501
247
|
|
|
502
248
|
export { FunctionComponentFactory }
|
|
503
249
|
|
|
504
|
-
declare function getApp_2<T extends App = App>(): T;
|
|
505
|
-
export { getApp_2 as getApp }
|
|
506
|
-
|
|
507
250
|
export declare function getCurrentPages(): CurrentPage[];
|
|
508
251
|
|
|
509
252
|
export { GetDerivedStateFromError }
|
|
510
253
|
|
|
511
254
|
export { GetDerivedStateFromProps }
|
|
512
255
|
|
|
513
|
-
declare interface GetPhoneNumberResult {
|
|
514
|
-
/**
|
|
515
|
-
* 获取手机号结果码。
|
|
516
|
-
*/
|
|
517
|
-
code?: string;
|
|
518
|
-
/**
|
|
519
|
-
* 获取手机号结果信息。
|
|
520
|
-
*/
|
|
521
|
-
message?: string;
|
|
522
|
-
}
|
|
523
|
-
|
|
524
256
|
export declare function getViewContext(): any;
|
|
525
257
|
|
|
526
258
|
export declare function getViewData<T extends Record<string, any>>(): T;
|
|
527
259
|
|
|
528
260
|
export declare function getWidgetInstanceId(): string | undefined;
|
|
529
261
|
|
|
530
|
-
declare type Icons = string | Record<'1x' | '2x' | '3x', string>;
|
|
531
|
-
|
|
532
262
|
export { isValidElement }
|
|
533
263
|
|
|
534
264
|
export { JSXElementConstructor }
|
|
@@ -545,13 +275,6 @@ declare type LifecycleCallback = () => void;
|
|
|
545
275
|
|
|
546
276
|
declare type LifecycleErrorCallback = (error: Error) => void;
|
|
547
277
|
|
|
548
|
-
export declare interface LoginApi {
|
|
549
|
-
onLogin: (res: LoginResult) => Promise<void> | void;
|
|
550
|
-
onRefuseLogin: () => Promise<void> | void;
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
export declare type LoginResult = GetPhoneNumberResult;
|
|
554
|
-
|
|
555
278
|
export { memo }
|
|
556
279
|
|
|
557
280
|
export { MemoExoticComponent }
|
|
@@ -581,41 +304,23 @@ export declare interface MessageMeta {
|
|
|
581
304
|
|
|
582
305
|
export { Mixin }
|
|
583
306
|
|
|
584
|
-
export { MutableRefObject }
|
|
585
|
-
|
|
586
|
-
export { NamedExoticComponent }
|
|
587
|
-
|
|
588
|
-
export { NewLifecycle }
|
|
589
|
-
|
|
590
307
|
/**
|
|
591
|
-
*
|
|
592
|
-
*
|
|
593
|
-
* Calling this again replaces the previously registered handler.
|
|
308
|
+
* 页面模型上下文控制器。
|
|
594
309
|
*/
|
|
595
|
-
export declare
|
|
596
|
-
|
|
597
|
-
export declare interface Page<Data extends AnyObject = AnyObject> extends DefineUIToolOptions<Data> {
|
|
598
|
-
__UI__: boolean;
|
|
599
|
-
__PAGE__: boolean;
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
declare type PageInstanceMethods<Data extends AnyObject> = UIInstanceMethods<Data, PageToolExtraMetadata>;
|
|
603
|
-
|
|
604
|
-
declare type PageToolExtraMetadata = {
|
|
310
|
+
export declare interface ModelContext {
|
|
605
311
|
/**
|
|
606
|
-
*
|
|
312
|
+
* 设置当前页面的完整上下文。
|
|
313
|
+
*
|
|
314
|
+
* 同一页面内重复调用会更新已有上下文,请传入当前页面的完整信息。
|
|
607
315
|
*/
|
|
608
|
-
|
|
609
|
-
}
|
|
316
|
+
setPageContext: (params: SetPageContextParams) => ReturnType<typeof setPageModelContext>;
|
|
317
|
+
}
|
|
610
318
|
|
|
611
|
-
export
|
|
319
|
+
export { MutableRefObject }
|
|
612
320
|
|
|
613
|
-
export
|
|
321
|
+
export { NamedExoticComponent }
|
|
614
322
|
|
|
615
|
-
export
|
|
616
|
-
onAgreePrivacy: (res: PrivacyAgreeResult) => Promise<void> | void;
|
|
617
|
-
onRefusePrivacy: () => Promise<void> | void;
|
|
618
|
-
}
|
|
323
|
+
export { NewLifecycle }
|
|
619
324
|
|
|
620
325
|
export { PropsWithChildren }
|
|
621
326
|
|
|
@@ -657,6 +362,16 @@ export { RefCallback }
|
|
|
657
362
|
|
|
658
363
|
export { RefObject }
|
|
659
364
|
|
|
365
|
+
/**
|
|
366
|
+
* 设置页面模型上下文的参数。
|
|
367
|
+
*/
|
|
368
|
+
export declare interface SetPageContextParams {
|
|
369
|
+
taskId: string;
|
|
370
|
+
pageInfo: Record<string, unknown>;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
declare const setPageModelContext: (params: SetPageContextParams) => Promise<object>;
|
|
374
|
+
|
|
660
375
|
export { SetStateAction }
|
|
661
376
|
|
|
662
377
|
export { SFCFactory }
|
|
@@ -667,56 +382,11 @@ export { Suspense }
|
|
|
667
382
|
|
|
668
383
|
export { SVGFactory }
|
|
669
384
|
|
|
670
|
-
export declare interface Tool<Extra extends AnyObject = AnyObject> {
|
|
671
|
-
aiMeta?: ToolMeta & Extra;
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
export declare interface ToolMeta {
|
|
675
|
-
/**
|
|
676
|
-
* unique identifier
|
|
677
|
-
*/
|
|
678
|
-
id: string;
|
|
679
|
-
/**
|
|
680
|
-
* name of the tool
|
|
681
|
-
*/
|
|
682
|
-
name?: string;
|
|
683
|
-
/**
|
|
684
|
-
* description of the tool
|
|
685
|
-
*/
|
|
686
|
-
description?: string;
|
|
687
|
-
/**
|
|
688
|
-
* Widget title type
|
|
689
|
-
* - none: 默认,无标题
|
|
690
|
-
* - normal: 常规标题
|
|
691
|
-
* - float: 浮动标题
|
|
692
|
-
*/
|
|
693
|
-
titleType?: 'none' | 'normal' | 'float';
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
export declare type ToolMetadata = {
|
|
697
|
-
/**
|
|
698
|
-
* specifies when a call to a tool will time out, in ms.
|
|
699
|
-
*/
|
|
700
|
-
timeout?: number;
|
|
701
|
-
};
|
|
702
|
-
|
|
703
385
|
export { TransitionFunction }
|
|
704
386
|
|
|
705
387
|
export { TransitionStartFunction }
|
|
706
388
|
|
|
707
|
-
export declare
|
|
708
|
-
/**
|
|
709
|
-
* Instance data
|
|
710
|
-
*/
|
|
711
|
-
data: Data;
|
|
712
|
-
/**
|
|
713
|
-
* Set data asynchronously and trigger view re-rendering
|
|
714
|
-
* @param data
|
|
715
|
-
* @param callback
|
|
716
|
-
* @returns
|
|
717
|
-
*/
|
|
718
|
-
setData: (data: Partial<Data> & AnyObject, callback?: () => void) => Promise<void>;
|
|
719
|
-
}
|
|
389
|
+
export declare function useAgentEvent(eventName: string, callback: AgentEventCallback): void;
|
|
720
390
|
|
|
721
391
|
export declare function useBackground(callback: LifecycleCallback): void;
|
|
722
392
|
|
|
@@ -742,6 +412,29 @@ export { useImperativeHandle }
|
|
|
742
412
|
|
|
743
413
|
export { useMemo }
|
|
744
414
|
|
|
415
|
+
/**
|
|
416
|
+
* 获取页面模型上下文控制器。
|
|
417
|
+
*
|
|
418
|
+
* @example
|
|
419
|
+
* ```typescript
|
|
420
|
+
* import { useEffect, useModelContext } from '@doubao-dev/framework';
|
|
421
|
+
*
|
|
422
|
+
* function Page() {
|
|
423
|
+
* const modelContext = useModelContext();
|
|
424
|
+
*
|
|
425
|
+
* useEffect(() => {
|
|
426
|
+
* modelContext.setPageContext({
|
|
427
|
+
* taskId: 'page-session-001',
|
|
428
|
+
* pageInfo: { route: ['route-1'] }
|
|
429
|
+
* });
|
|
430
|
+
* }, [modelContext]);
|
|
431
|
+
*
|
|
432
|
+
* return <view />;
|
|
433
|
+
* }
|
|
434
|
+
* ```
|
|
435
|
+
*/
|
|
436
|
+
export declare function useModelContext(): ModelContext;
|
|
437
|
+
|
|
745
438
|
export declare function useMounted(callback: LifecycleCallback): void;
|
|
746
439
|
|
|
747
440
|
export { useReducer }
|
|
@@ -760,37 +453,4 @@ export { VFC }
|
|
|
760
453
|
|
|
761
454
|
export { VoidFunctionComponent }
|
|
762
455
|
|
|
763
|
-
export declare interface Widget<Data extends AnyObject = AnyObject> extends DefineWidgetToolOptions<Data> {
|
|
764
|
-
__UI__: boolean;
|
|
765
|
-
__WIDGET__: boolean;
|
|
766
|
-
setData: (data: Partial<Data>, callback?: () => void) => void;
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
declare type WidgetInstanceMethods<Data extends AnyObject> = UIInstanceMethods<Data, WidgetToolExtraMetadata>;
|
|
770
|
-
|
|
771
|
-
declare type WidgetToolExtraMetadata = {
|
|
772
|
-
/**
|
|
773
|
-
* Widget box type in Chat UI
|
|
774
|
-
*/
|
|
775
|
-
boxType?: 'inbox' | 'full_box';
|
|
776
|
-
/**
|
|
777
|
-
* Whether add widget border
|
|
778
|
-
*/
|
|
779
|
-
border?: boolean;
|
|
780
|
-
/**
|
|
781
|
-
* Keywords of things
|
|
782
|
-
*/
|
|
783
|
-
keywords?: string[];
|
|
784
|
-
/**
|
|
785
|
-
* Icons
|
|
786
|
-
*/
|
|
787
|
-
icons?: Icons;
|
|
788
|
-
/**
|
|
789
|
-
* Set extra widget properties
|
|
790
|
-
*/
|
|
791
|
-
prop?: string;
|
|
792
|
-
};
|
|
793
|
-
|
|
794
|
-
export declare type WidgetToolMetadata = ToolMeta & WidgetToolExtraMetadata;
|
|
795
|
-
|
|
796
456
|
export { }
|