@xiongtao.xt/tau-plugins 0.45.0 → 0.46.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/publish-client.js CHANGED
@@ -1,4 +1,4 @@
1
- import "./client/chunk-CEWYJJKJ.js";
1
+ import "./client/chunk-UTVEXGFI.js";
2
2
 
3
3
  // packages/plugins/src/publish-client.ts
4
4
  var DataError = class extends Error {
@@ -224,7 +224,7 @@ function createClient({ manifestUrl }) {
224
224
  if (!normalized) return [];
225
225
  assert(Number.isInteger(limit) && limit > 0, "INVALID_DATA", "limit \u5FC5\u987B\u662F\u6B63\u6574\u6570");
226
226
  const [{ documents }, { default: Fuse }] = await waitFor(
227
- Promise.all([index(), import("./client/fuse-OHBNZPDB.js")]),
227
+ Promise.all([index(), import("./client/fuse-KWYBABFA.js")]),
228
228
  signal
229
229
  );
230
230
  cancelled(signal);
@@ -1 +1 @@
1
- export type { WhiteboardTransfer, TransferElement, WhiteboardPresentation } from "./src/whiteboard-types";
1
+ export type { WhiteboardTransfer, TransferElement, WhiteboardPresentation, } from "./src/whiteboard-types";
@@ -65,7 +65,7 @@ export { panAroundAnchor, pointFromCenter, type Point as ZoomPanPoint } from "..
65
65
  export { FloatingToolbar, ToolbarDivider, ToolbarIconButton } from "../components/FloatingToolbar/index";
66
66
  export { IElementEditingPolicy, type ElementEditingPolicy } from "../services/elementEditingPolicy";
67
67
  export { IUnknownElementNotice, type UnknownElementNotice } from "../services/unknownElementNotice";
68
- export type { EditorTextField } from "../../../source-contracts";
68
+ export type { EditorTextField, TextFieldDelta, TextFieldSnapshot } from "../../../source-contracts";
69
69
  export { useTextFieldBinding } from "./useTextFieldBinding";
70
70
  export { bindTextFieldTextarea, rebaseTextFieldInput } from "./textFieldInput";
71
71
  export { IEditorTextFields } from "../../../source-contracts";
@@ -9,10 +9,11 @@ export type * from "./images";
9
9
  export type * from "./video";
10
10
  export type * from "./publish";
11
11
  export type { JsonValue, Disposable, PluginStorage, PluginCommand, PluginContext, PluginInstance, PluginDefinition, } from "./contract";
12
- export type { PluginSettings, PluginSettingsDefinition, PluginSettingsProps, PluginSettingsHandle, } from "./settings";
12
+ export type { PluginSettings, PluginSettingsDefinition, PluginProviderSettingsDefinition, PluginComponentSettingsDefinition, PluginSettingsProps, PluginSettingsHandle, } from "./settings";
13
+ export * from "./provider-form";
13
14
  export * from "./editor";
14
15
  export { SourceBlockEditor, useSourceBlock, useTextField, useReportPreviewError, insertSourceBlock, sourceBlockParagraphBehavior, } from "./source-editor";
15
- export type { SourceBlockEditorProps, PluginRuntimeStyleCompiler, TextFieldEditor } from "./source-editor";
16
+ export type { SourceBlockEditorProps, PluginRuntimeStyleCompiler, TextFieldEditor, } from "./source-editor";
16
17
  export { useInlineSource, insertInlineSource, InlineSourceBoundary } from "./inline-source";
17
18
  export { ContentEditor, ContentPreview, EntityRef } from "./components";
18
19
  export { useElement, useMediaViewer, BlockToolbar, BlockToolbarButton, BlockToolbarGap, } from "./element";
@@ -0,0 +1,57 @@
1
+ import type { JsonValue } from "./json";
2
+ /** 存储提供方配置表单:插件只声明字段,桌面与移动宿主各自渲染、保存与校验。 */
3
+ export type ProviderFormValues = Readonly<Record<string, string>>;
4
+ interface ProviderFieldBase {
5
+ key: string;
6
+ label: string;
7
+ description?: string;
8
+ placeholder?: string;
9
+ /** 未标注的字段为必填,空值时宿主拒绝保存 */
10
+ optional?: boolean;
11
+ /** 按声明顺序拼成服务列表里的配置摘要;secret 字段不能作摘要 */
12
+ summary?: boolean;
13
+ }
14
+ export interface ProviderTextField extends ProviderFieldBase {
15
+ type: "text" | "secret" | "url";
16
+ }
17
+ export interface ProviderChoiceOption {
18
+ value: string;
19
+ label?: string;
20
+ description?: string;
21
+ }
22
+ export interface ProviderChoiceField extends ProviderFieldBase {
23
+ type: "choice";
24
+ options: readonly ProviderChoiceOption[];
25
+ default?: string;
26
+ }
27
+ export interface ProviderRemoteChoiceField extends ProviderFieldBase {
28
+ type: "remote-choice";
29
+ /** 按当前填写的值加载可选项;失败时抛出可读的错误 */
30
+ load(values: ProviderFormValues, signal: AbortSignal): Promise<readonly ProviderChoiceOption[]>;
31
+ /** 其中任一字段变化时清空本字段 */
32
+ dependsOn?: readonly string[];
33
+ }
34
+ export type ProviderField = ProviderTextField | ProviderChoiceField | ProviderRemoteChoiceField;
35
+ export interface ProviderFieldGroup {
36
+ title: string;
37
+ description?: string;
38
+ fields: readonly ProviderField[];
39
+ }
40
+ export interface ProviderForm {
41
+ groups: readonly ProviderFieldGroup[];
42
+ /** 保存前调用:可补全字段(如按令牌取用户名)或抛错拒绝保存 */
43
+ beforeSave?(values: ProviderFormValues, signal: AbortSignal): Promise<ProviderFormValues>;
44
+ }
45
+ export declare function providerFormFields(form: ProviderForm): readonly ProviderField[];
46
+ export declare function assertProviderForm(form: ProviderForm): void;
47
+ /** 从已存配置读出表单初值:只取声明字段的字符串值,choice 缺省时取 default。 */
48
+ export declare function readProviderFormValues(form: ProviderForm, stored: JsonValue | undefined): Record<string, string>;
49
+ /** 改一个字段并清空依赖它的远程选择字段。 */
50
+ export declare function patchProviderFormValues(form: ProviderForm, values: ProviderFormValues, key: string, value: string): Record<string, string>;
51
+ /** 必填字段空值时返回 key → 错误文案;为空对象表示可保存。 */
52
+ export declare function validateProviderFormValues(form: ProviderForm, values: ProviderFormValues): Record<string, string>;
53
+ export declare function isProviderFormComplete(form: ProviderForm, stored: JsonValue | undefined): boolean;
54
+ export declare function providerFormSummary(form: ProviderForm, stored: JsonValue | undefined): string;
55
+ /** 写回配置:字段值覆盖已存配置的同名键,未声明的键原样保留。 */
56
+ export declare function mergeProviderFormValues(stored: JsonValue | undefined, values: ProviderFormValues): JsonValue;
57
+ export {};
@@ -1,6 +1,7 @@
1
1
  import type { ComponentType } from "react";
2
2
  import type { Disposable, PluginContext } from "./index";
3
3
  import type { JsonValue } from "./json";
4
+ import type { ProviderForm } from "./provider-form";
4
5
  export interface PluginSettingsProps {
5
6
  readonly context: PluginContext;
6
7
  readonly publishConfig?: {
@@ -30,27 +31,29 @@ export interface PluginSettingsProps {
30
31
  label?: string;
31
32
  }[]): Promise<void>;
32
33
  };
33
- readonly uploadConfig?: {
34
- readonly value: JsonValue;
35
- save(value: JsonValue): Promise<void>;
36
- };
37
34
  readonly videoConfig?: {
38
35
  readonly value: JsonValue;
39
36
  save(value: JsonValue): Promise<void>;
40
37
  };
41
- readonly syncConfig?: {
42
- readonly value: JsonValue;
43
- save(value: JsonValue): Promise<void>;
44
- };
45
38
  }
46
- export interface PluginSettingsDefinition {
39
+ interface PluginSettingsBase {
47
40
  id: string;
48
41
  title: string;
49
42
  description?: string;
43
+ }
44
+ /** 存储提供方的连接配置:只声明字段,由宿主在插件设置页按平台渲染与保存。 */
45
+ export interface PluginProviderSettingsDefinition extends PluginSettingsBase {
46
+ target: "sync" | "upload";
47
+ form: ProviderForm;
48
+ component?: never;
49
+ }
50
+ export interface PluginComponentSettingsDefinition extends PluginSettingsBase {
50
51
  /** 提供方配置表单挂载到对应宿主设置;普通插件设置省略。 */
51
- target?: "sync" | "upload" | "tts" | "asr" | "images" | "video" | "publish";
52
+ target?: "tts" | "asr" | "images" | "video" | "publish";
52
53
  component: ComponentType<PluginSettingsProps>;
54
+ form?: never;
53
55
  }
56
+ export type PluginSettingsDefinition = PluginProviderSettingsDefinition | PluginComponentSettingsDefinition;
54
57
  export interface PluginSettingsHandle extends Disposable {
55
58
  readonly id: string;
56
59
  open(): Promise<void>;
@@ -59,3 +62,4 @@ export interface PluginSettings {
59
62
  /** 分区随本次激活回收;提供方保存使用配置属性,普通设置使用 context.storage。 */
60
63
  register(definition: PluginSettingsDefinition): PluginSettingsHandle;
61
64
  }
65
+ export {};
@@ -0,0 +1,54 @@
1
+ /** ask-question 提问工具的载荷、作答与结果(纯数据,主进程、渲染端与浏览器扩展共用) */
2
+ export declare const ASK_QUESTION_TOOL_NAME: "ask-question";
3
+ export type AskQuestionType = "single" | "multiple";
4
+ export interface AskQuestionOption {
5
+ label: string;
6
+ value: string;
7
+ description?: string;
8
+ }
9
+ export interface AskQuestionItem {
10
+ id: string;
11
+ question: string;
12
+ type: AskQuestionType;
13
+ options: AskQuestionOption[];
14
+ required: boolean;
15
+ }
16
+ export interface AskQuestionPayload {
17
+ title?: string;
18
+ description?: string;
19
+ submitLabel?: string;
20
+ questions: AskQuestionItem[];
21
+ }
22
+ export interface AskQuestionAnswerItem {
23
+ questionId: string;
24
+ selectedValues: string[];
25
+ otherText: string;
26
+ }
27
+ export interface AskQuestionSubmission {
28
+ answers: AskQuestionAnswerItem[];
29
+ submittedAt: number;
30
+ }
31
+ export interface AskQuestionResolvedAnswer {
32
+ questionId: string;
33
+ question: string;
34
+ type: AskQuestionType;
35
+ required: boolean;
36
+ selectedOptions: Array<{
37
+ value: string;
38
+ label: string;
39
+ }>;
40
+ otherText: string;
41
+ }
42
+ export interface AskQuestionToolResult {
43
+ type: "ask-question-result";
44
+ submittedAt: number;
45
+ answers: AskQuestionResolvedAnswer[];
46
+ }
47
+ export interface AskQuestionNormalizationResult {
48
+ payload?: AskQuestionPayload;
49
+ error?: string;
50
+ }
51
+ export declare const normalizeAskQuestionPayload: (input: unknown) => AskQuestionNormalizationResult;
52
+ /** 第一个未作答的必答题(既没选项也没填「其他」);全部答完返回 undefined */
53
+ export declare const findUnansweredQuestion: (payload: AskQuestionPayload, answers: AskQuestionAnswerItem[]) => AskQuestionItem | undefined;
54
+ export declare const buildAskQuestionToolResult: (payload: AskQuestionPayload, submission: AskQuestionSubmission) => AskQuestionToolResult;
@@ -4,3 +4,4 @@ export * from "./messageSchema";
4
4
  export * from "./assistantBlocks";
5
5
  export * from "./streamEvents";
6
6
  export * from "./aiRunProtocol";
7
+ export * from "./askQuestion";
@@ -25,6 +25,8 @@ export interface WhiteBoardProps {
25
25
  showToolbar?: boolean;
26
26
  showAttributeSetter?: boolean;
27
27
  showStatusBar?: boolean;
28
+ /** 宿主追加在右下状态栏末尾的控件(如协作入口),演示模式下随状态栏隐藏 */
29
+ statusBarEnd?: React.ReactNode;
28
30
  /** 进出演示模式(宿主页面据此收起画布外的浮动件,如页签条) */
29
31
  onPresentationModeChange?: (presenting: boolean) => void;
30
32
  /** 扩展被禁用时回调(命名空间违规、冲突、创建失败等),画布继续运行 */
@@ -3,11 +3,11 @@
3
3
  */
4
4
  import type { BoardElement } from "../types/index";
5
5
  import type { WhiteboardElementDefinition } from "../extensions/api";
6
- export declare const PageSchematic: import("react").NamedExoticComponent<{
6
+ export declare const PageSchematic: import("react").MemoExoticComponent<({ elements, aspect, className, definitions, resolveDefinition, isBuiltin, }: {
7
7
  elements: BoardElement[] | undefined;
8
8
  aspect: number;
9
9
  className?: string;
10
10
  definitions?: readonly WhiteboardElementDefinition[];
11
11
  resolveDefinition?: (element: BoardElement) => WhiteboardElementDefinition | undefined;
12
12
  isBuiltin?: (element: BoardElement) => boolean;
13
- }>;
13
+ }) => import("react/jsx-runtime").JSX.Element | null>;