@canvas-components/print-design-plugin 0.1.8 → 0.1.9

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/react.css CHANGED
@@ -310,9 +310,12 @@
310
310
  }
311
311
  .cc-print-design-column-toolbar {
312
312
  display: grid;
313
+ grid-template-columns: repeat(3, minmax(0, 1fr));
313
314
  gap: 6px;
315
+ margin-top: 8px;
314
316
  }
315
- .cc-print-design-column-toolbar > .canvas-react-button {
317
+ .cc-print-design-column-toolbar > * {
318
+ min-width: 0;
316
319
  width: 100%;
317
320
  }
318
321
  .cc-print-design-data-merge,
@@ -485,11 +488,6 @@
485
488
  height: 32px;
486
489
  padding: 0;
487
490
  }
488
- .cc-print-design-border-side-controls .canvas-react-button[aria-pressed=true] {
489
- color: var(--pd-primary, #2563eb);
490
- border-color: var(--pd-primary, #2563eb);
491
- background: var(--pd-selected);
492
- }
493
491
  .cc-print-design-border-side-top {
494
492
  grid-area: 1 / 2;
495
493
  }
@@ -797,6 +795,32 @@
797
795
  .cc-print-design-ai-message-user p {
798
796
  background: var(--pd-selected, #edf4ff);
799
797
  }
798
+ .cc-print-design-ai-artifact {
799
+ display: flex;
800
+ flex-direction: column;
801
+ gap: 3px;
802
+ max-width: min(85%, 680px);
803
+ margin-top: 7px;
804
+ padding: 10px 12px;
805
+ border: 1px solid var(--pd-border, #e4e8ef);
806
+ border-radius: 10px;
807
+ color: inherit;
808
+ text-decoration: none;
809
+ background: var(--pd-hover, #f5f7fa);
810
+ cursor: pointer;
811
+ text-align: left;
812
+ font: inherit;
813
+ }
814
+ .cc-print-design-ai-artifact:hover {
815
+ border-color: #5b8def;
816
+ }
817
+ .cc-print-design-ai-artifact small {
818
+ color: var(--pd-muted, #64748b);
819
+ line-height: 1.4;
820
+ }
821
+ .cc-print-design-ai-artifact span:last-child {
822
+ color: #2563eb;
823
+ }
800
824
  .cc-print-design-ai-reasoning {
801
825
  box-sizing: border-box;
802
826
  width: min(85%, 680px);
@@ -806,12 +830,30 @@
806
830
  border-radius: 8px;
807
831
  background: var(--pd-hover, #f5f7fa);
808
832
  }
809
- .cc-print-design-ai-reasoning summary {
833
+ .cc-print-design-ai-reasoning-trigger {
834
+ display: flex;
835
+ align-items: center;
836
+ gap: 6px;
837
+ width: 100%;
810
838
  padding: 7px 10px;
839
+ border: 0;
840
+ background: transparent;
811
841
  color: var(--pd-muted, #8993a2);
842
+ text-align: left;
812
843
  cursor: pointer;
813
844
  }
814
- .cc-print-design-ai-reasoning > div {
845
+ .cc-print-design-ai-reasoning-trigger > svg {
846
+ flex: 0 0 auto;
847
+ transition: transform 180ms ease;
848
+ }
849
+ .cc-print-design-ai-reasoning-trigger[aria-expanded=true] > svg {
850
+ transform: rotate(90deg);
851
+ }
852
+ .cc-print-design-ai-reasoning-trigger:focus-visible {
853
+ outline: 2px solid var(--pd-primary, #1677ff);
854
+ outline-offset: -2px;
855
+ }
856
+ .cc-print-design-ai-reasoning-content {
815
857
  max-height: 180px;
816
858
  overflow: auto;
817
859
  padding: 0 10px 10px;
@@ -820,6 +862,11 @@
820
862
  white-space: pre-wrap;
821
863
  overflow-wrap: anywhere;
822
864
  }
865
+ @media (prefers-reduced-motion: reduce) {
866
+ .cc-print-design-ai-reasoning-trigger > svg {
867
+ transition: none;
868
+ }
869
+ }
823
870
  .cc-print-design-ai-message-thinking .cc-print-design-ai-thinking-indicator {
824
871
  display: inline-flex;
825
872
  align-items: center;
@@ -844,6 +891,9 @@
844
891
  .cc-print-design-ai-thinking-dots i:nth-child(3) {
845
892
  animation-delay: 0.32s;
846
893
  }
894
+ .cc-print-design-ai-message-thinking.is-paused .cc-print-design-ai-thinking-dots i {
895
+ animation-play-state: paused;
896
+ }
847
897
  @keyframes cc-print-design-ai-thinking {
848
898
  0%, 60%, 100% {
849
899
  opacity: 0.35;
@@ -1004,6 +1054,107 @@
1004
1054
  padding: 10px;
1005
1055
  border-top: 1px solid var(--pd-border, #e4e8ef);
1006
1056
  }
1057
+ .cc-print-design-ai-attachments,
1058
+ .cc-print-design-ai-message-attachments {
1059
+ display: flex;
1060
+ flex-wrap: wrap;
1061
+ gap: 6px;
1062
+ min-width: 0;
1063
+ }
1064
+ .cc-print-design-ai-attachments {
1065
+ max-height: 116px;
1066
+ margin-bottom: 8px;
1067
+ overflow: auto;
1068
+ }
1069
+ .cc-print-design-ai-attachment {
1070
+ display: flex;
1071
+ align-items: center;
1072
+ gap: 5px;
1073
+ max-width: 100%;
1074
+ padding: 4px 6px;
1075
+ border: 1px solid var(--pd-border, #e4e8ef);
1076
+ border-radius: 6px;
1077
+ font-size: 11px;
1078
+ }
1079
+ .cc-print-design-ai-attachment .cc-print-design-ai-image-trigger img {
1080
+ width: 28px;
1081
+ height: 28px;
1082
+ object-fit: cover;
1083
+ }
1084
+ .cc-print-design-ai-panel .cc-print-design-ai-image-trigger {
1085
+ display: block;
1086
+ padding: 0;
1087
+ border: 0;
1088
+ border-radius: 5px;
1089
+ background: transparent;
1090
+ cursor: zoom-in;
1091
+ }
1092
+ .cc-print-design-ai-image-trigger:focus-visible {
1093
+ outline: 2px solid var(--pd-primary, #1677ff);
1094
+ outline-offset: 2px;
1095
+ }
1096
+ .cc-print-design-ai-attachment > span:nth-last-child(2) {
1097
+ overflow: hidden;
1098
+ max-width: 145px;
1099
+ text-overflow: ellipsis;
1100
+ white-space: nowrap;
1101
+ }
1102
+ .cc-print-design-ai-attachment > button {
1103
+ border: 0;
1104
+ background: transparent;
1105
+ cursor: pointer;
1106
+ }
1107
+ .cc-print-design-ai-message-attachments {
1108
+ margin-top: 7px;
1109
+ }
1110
+ .cc-print-design-ai-message-user .cc-print-design-ai-message-attachments {
1111
+ align-self: flex-end;
1112
+ justify-content: flex-end;
1113
+ max-width: min(85%, 680px);
1114
+ margin-left: auto;
1115
+ }
1116
+ .cc-print-design-ai-message-attachments figure {
1117
+ display: flex;
1118
+ flex-direction: column;
1119
+ align-items: flex-end;
1120
+ max-width: 100%;
1121
+ margin: 0;
1122
+ }
1123
+ .cc-print-design-ai-message-attachments .cc-print-design-ai-image-trigger {
1124
+ max-width: min(100%, 240px);
1125
+ }
1126
+ .cc-print-design-ai-message-attachments img {
1127
+ display: block;
1128
+ max-width: min(100%, 240px);
1129
+ max-height: 180px;
1130
+ border-radius: 5px;
1131
+ object-fit: contain;
1132
+ }
1133
+ .cc-print-design-ai-message-attachments figcaption,
1134
+ .cc-print-design-ai-message-attachments > span {
1135
+ overflow: hidden;
1136
+ max-width: 100%;
1137
+ color: var(--pd-muted, #8993a2);
1138
+ font-size: 11px;
1139
+ text-overflow: ellipsis;
1140
+ text-align: right;
1141
+ white-space: nowrap;
1142
+ }
1143
+ .cc-print-design-ai-composer-attach {
1144
+ display: grid;
1145
+ flex: 0 0 30px;
1146
+ width: 30px;
1147
+ height: 30px;
1148
+ place-items: center;
1149
+ border: 0;
1150
+ border-radius: 5px;
1151
+ background: transparent;
1152
+ color: inherit;
1153
+ cursor: pointer;
1154
+ }
1155
+ .cc-print-design-ai-composer-attach:hover {
1156
+ background: var(--pd-hover, #f5f7fa);
1157
+ }
1007
1158
  .cc-print-design-ai-selection {
1008
1159
  min-width: 0;
1009
1160
  margin-bottom: 8px;
@@ -1046,11 +1197,25 @@
1046
1197
  gap: 8px;
1047
1198
  margin-top: 6px;
1048
1199
  }
1049
- .cc-print-design-ai-composer-tools .canvas-react-select-wrap:first-of-type {
1050
- flex: 1;
1200
+ .cc-print-design-ai-composer-options {
1201
+ display: flex;
1202
+ flex: 1 1 auto;
1203
+ align-items: center;
1204
+ gap: 8px;
1205
+ min-width: 0;
1206
+ }
1207
+ .cc-print-design-ai-composer-options .canvas-react-select-wrap:first-child {
1208
+ flex: 1 1 auto;
1051
1209
  min-width: 0;
1052
1210
  }
1053
- .cc-print-design-ai-composer-tools .canvas-react-select-wrap:last-child {
1211
+ .cc-print-design-ai-composer-options .canvas-react-select-wrap:last-child {
1054
1212
  flex: 0 0 94px;
1055
1213
  min-width: 0;
1056
1214
  }
1215
+ .cc-print-design-ai-composer-actions {
1216
+ display: flex;
1217
+ flex: 0 0 auto;
1218
+ align-items: center;
1219
+ gap: 4px;
1220
+ margin-left: auto;
1221
+ }
package/dist/react.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _canvas_components_print_design from '@canvas-components/print-design';
2
2
  import { PrintDesignAgentApi } from '@canvas-components/print-design';
3
- import { P as PrintDesignNativePlugin } from './model-BwhSanYM.cjs';
3
+ import { P as PrintDesignNativePlugin } from './model-DIvOoRX8.cjs';
4
4
  import * as _canvas_components_react_print_design from '@canvas-components/react-print-design';
5
5
  import { PrintDesignComponentFactory, PrintDesignComponentMenuItem, PrintDesignPropertySection, PrintDesignComponentContextMenu, PrintDesignToolRegistry, PrintDesignComponentFactoryRegistry, PrintDesignPropertySectionRegistry } from '@canvas-components/react-print-design';
6
6
  import * as react from 'react';
@@ -73,15 +73,23 @@ interface PrintDesignAiChatPanelWidths {
73
73
  }
74
74
  /** 宿主可替换模型请求实现,以接入其他浏览器端模型。 */
75
75
  interface PrintDesignAiChatProvider {
76
+ /** 实现暂停控制后显示暂停与继续按钮。 */
77
+ supportsPause?: boolean;
76
78
  listModels(config: Pick<PrintDesignAiChatConfig, "baseUrl" | "key">, signal?: AbortSignal): Promise<string[]>;
77
- complete(config: PrintDesignAiChatConfig, messages: readonly PrintDesignAiChatMessage[], signal?: AbortSignal, agentApi?: PrintDesignAgentApi): Promise<string>;
79
+ complete(config: PrintDesignAiChatConfig, messages: readonly PrintDesignAiChatMessage[], signal?: AbortSignal, agentApi?: PrintDesignAgentApi, pause?: PrintDesignAiChatPauseControl): Promise<string>;
78
80
  /** 可选的增量回复;未实现时仍使用 complete。 */
79
- stream?(config: PrintDesignAiChatConfig, messages: readonly PrintDesignAiChatMessage[], onDelta: (delta: PrintDesignAiChatDelta) => void, signal?: AbortSignal, agentApi?: PrintDesignAgentApi): Promise<PrintDesignAiChatResult>;
81
+ stream?(config: PrintDesignAiChatConfig, messages: readonly PrintDesignAiChatMessage[], onDelta: (delta: PrintDesignAiChatDelta) => void, signal?: AbortSignal, agentApi?: PrintDesignAgentApi, pause?: PrintDesignAiChatPauseControl): Promise<PrintDesignAiChatResult>;
82
+ }
83
+ /** 暂停流读取及后续工具调用的协作式检查点。 */
84
+ interface PrintDesignAiChatPauseControl {
85
+ waitIfPaused(signal?: AbortSignal): Promise<void>;
80
86
  }
81
87
  /** 一段增量文本;思考与最终回复分别更新。 */
82
88
  interface PrintDesignAiChatDelta {
83
89
  content?: string;
84
90
  reasoning?: string;
91
+ /** 当前工具操作的简短说明;空字符串表示操作结束。 */
92
+ activity?: string;
85
93
  }
86
94
  /** 一次流式回复完成后的文本。 */
87
95
  interface PrintDesignAiChatResult {
@@ -89,9 +97,24 @@ interface PrintDesignAiChatResult {
89
97
  reasoning?: string;
90
98
  }
91
99
  /** 发送给模型的对话消息。 */
100
+ type PrintDesignAiChatAttachment = {
101
+ kind: "image";
102
+ name: string;
103
+ mimeType: "image/png" | "image/jpeg" | "image/webp";
104
+ size: number;
105
+ dataUrl: string;
106
+ } | {
107
+ kind: "text";
108
+ name: string;
109
+ mimeType: string;
110
+ size: number;
111
+ text: string;
112
+ };
113
+ /** 对话消息保留附件内容,历史会话可继续发送给模型。 */
92
114
  interface PrintDesignAiChatMessage {
93
115
  role: "user" | "assistant";
94
116
  content: string;
117
+ attachments?: readonly PrintDesignAiChatAttachment[];
95
118
  /** 模型返回的思考内容;使用工具时可回传给兼容提供方。 */
96
119
  reasoning?: string;
97
120
  }
@@ -102,6 +125,43 @@ interface PrintDesignAiChatOptions {
102
125
  provider?: PrintDesignAiChatProvider;
103
126
  /** 初次打开时的宽度配置,单位为 CSS 像素。 */
104
127
  panelWidths?: Partial<PrintDesignAiChatPanelWidths>;
128
+ /** 宿主提供插件草稿构建服务时,Agent 才能生成可下载的 ZIP。 */
129
+ pluginAuthoring?: PrintDesignAiPluginAuthoring;
130
+ }
131
+ /** Agent 只提交固定目录下的源码;包清单及构建产物由宿主生成。 */
132
+ interface PrintDesignAiPluginDraft {
133
+ packageId: string;
134
+ version: string;
135
+ componentType: string;
136
+ name: string;
137
+ description: string;
138
+ files: Array<{
139
+ path: string;
140
+ content: string;
141
+ }>;
142
+ }
143
+ /** 一份已校验、可由当前用户下载的插件归档。 */
144
+ interface PrintDesignAiPluginArtifact {
145
+ id: string;
146
+ packageId: string;
147
+ version: string;
148
+ name: string;
149
+ sha256: string;
150
+ }
151
+ /** 插件源码的构建、保存和下载由当前浏览器负责。 */
152
+ interface PrintDesignAiPluginAuthoring {
153
+ create(draft: PrintDesignAiPluginDraft): Promise<PrintDesignAiPluginArtifact>;
154
+ getArchive(id: string): Promise<Uint8Array>;
155
+ listSources?(): Promise<readonly {
156
+ packageId: string;
157
+ version: string;
158
+ componentType: string;
159
+ name: string;
160
+ }[]>;
161
+ getSource?(query: {
162
+ packageId: string;
163
+ version?: string;
164
+ }): Promise<PrintDesignAiPluginDraft>;
105
165
  }
106
166
  /** 编辑器向右侧面板传递的运行时能力。 */
107
167
  interface PrintDesignAiChatPanelContext {
@@ -112,6 +172,21 @@ interface PrintDesignAiChatPanelContext {
112
172
  selection?: PrintDesignAiChatSelection;
113
173
  }
114
174
 
175
+ interface StoredPluginArtifact {
176
+ artifact: PrintDesignAiPluginArtifact;
177
+ draft: PrintDesignAiPluginDraft;
178
+ bytes: Uint8Array;
179
+ createdAt: number;
180
+ }
181
+ /** 浏览器归档存储,可由宿主替换为自己的本地持久实现。 */
182
+ interface BrowserPluginArtifactStorage {
183
+ save(value: StoredPluginArtifact): Promise<void>;
184
+ list(): Promise<StoredPluginArtifact[]>;
185
+ read(id: string): Promise<StoredPluginArtifact | null>;
186
+ }
187
+ /** 完全在浏览器中编译、打包并持久保存 Agent 插件。 */
188
+ declare function createBrowserPluginAuthoring(storage?: BrowserPluginArtifactStorage): PrintDesignAiPluginAuthoring;
189
+
115
190
  /** 浏览器端 AI 对话插件,由宿主独立装配到设计器右侧。 */
116
191
  declare function createPrintDesignAiChatPlugin(options?: PrintDesignAiChatOptions): {
117
192
  initialPanelWidths: PrintDesignAiChatPanelWidths;
@@ -137,7 +212,7 @@ declare const builtinPrintDesignPlugins: Readonly<{
137
212
  minVersion: string;
138
213
  }[];
139
214
  description: string;
140
- componentTypes: ("text" | "list" | "dateTime" | "moneyUpper" | "pageNumber" | "watermark" | "shape" | "brush" | "connector" | "divider" | "ruler" | "grid" | "coordinate" | "progress" | "flow" | "clock" | "image" | "barcode" | "qrcode" | "chart" | "table" | "pivotTable" | "gantt" | "generic")[];
215
+ componentTypes: ("text" | "richText" | "list" | "dateTime" | "moneyUpper" | "pageNumber" | "watermark" | "shape" | "brush" | "connector" | "divider" | "ruler" | "grid" | "coordinate" | "progress" | "flow" | "clock" | "image" | "barcode" | "qrcode" | "chart" | "table" | "pivotTable" | "gantt" | "generic")[];
141
216
  toolIds: never[];
142
217
  compatibility: string;
143
218
  permissions: string;
@@ -174,4 +249,4 @@ declare const builtinPrintDesignPlugins: Readonly<{
174
249
  componentRegistry: _canvas_components_print_design.PrintDesignComponentRegistry;
175
250
  }>;
176
251
 
177
- export { type PrintDesignAiChatConfig, type PrintDesignAiChatMessage, type PrintDesignAiChatOptions, type PrintDesignAiChatPanelWidths, type PrintDesignAiChatProfile, type PrintDesignAiChatProvider, type PrintDesignAiChatReasoningEffort, type PrintDesignAiChatSelection, type PrintDesignAiChatSettings, builtinPrintDesignPlugins, builtinReactComponentPlugins, createPrintDesignAiChatPlugin };
252
+ export { type PrintDesignAiChatConfig, type PrintDesignAiChatMessage, type PrintDesignAiChatOptions, type PrintDesignAiChatPanelWidths, type PrintDesignAiChatProfile, type PrintDesignAiChatProvider, type PrintDesignAiChatReasoningEffort, type PrintDesignAiChatSelection, type PrintDesignAiChatSettings, builtinPrintDesignPlugins, builtinReactComponentPlugins, createBrowserPluginAuthoring, createPrintDesignAiChatPlugin };
package/dist/react.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _canvas_components_print_design from '@canvas-components/print-design';
2
2
  import { PrintDesignAgentApi } from '@canvas-components/print-design';
3
- import { P as PrintDesignNativePlugin } from './model-BwhSanYM.js';
3
+ import { P as PrintDesignNativePlugin } from './model-DIvOoRX8.js';
4
4
  import * as _canvas_components_react_print_design from '@canvas-components/react-print-design';
5
5
  import { PrintDesignComponentFactory, PrintDesignComponentMenuItem, PrintDesignPropertySection, PrintDesignComponentContextMenu, PrintDesignToolRegistry, PrintDesignComponentFactoryRegistry, PrintDesignPropertySectionRegistry } from '@canvas-components/react-print-design';
6
6
  import * as react from 'react';
@@ -73,15 +73,23 @@ interface PrintDesignAiChatPanelWidths {
73
73
  }
74
74
  /** 宿主可替换模型请求实现,以接入其他浏览器端模型。 */
75
75
  interface PrintDesignAiChatProvider {
76
+ /** 实现暂停控制后显示暂停与继续按钮。 */
77
+ supportsPause?: boolean;
76
78
  listModels(config: Pick<PrintDesignAiChatConfig, "baseUrl" | "key">, signal?: AbortSignal): Promise<string[]>;
77
- complete(config: PrintDesignAiChatConfig, messages: readonly PrintDesignAiChatMessage[], signal?: AbortSignal, agentApi?: PrintDesignAgentApi): Promise<string>;
79
+ complete(config: PrintDesignAiChatConfig, messages: readonly PrintDesignAiChatMessage[], signal?: AbortSignal, agentApi?: PrintDesignAgentApi, pause?: PrintDesignAiChatPauseControl): Promise<string>;
78
80
  /** 可选的增量回复;未实现时仍使用 complete。 */
79
- stream?(config: PrintDesignAiChatConfig, messages: readonly PrintDesignAiChatMessage[], onDelta: (delta: PrintDesignAiChatDelta) => void, signal?: AbortSignal, agentApi?: PrintDesignAgentApi): Promise<PrintDesignAiChatResult>;
81
+ stream?(config: PrintDesignAiChatConfig, messages: readonly PrintDesignAiChatMessage[], onDelta: (delta: PrintDesignAiChatDelta) => void, signal?: AbortSignal, agentApi?: PrintDesignAgentApi, pause?: PrintDesignAiChatPauseControl): Promise<PrintDesignAiChatResult>;
82
+ }
83
+ /** 暂停流读取及后续工具调用的协作式检查点。 */
84
+ interface PrintDesignAiChatPauseControl {
85
+ waitIfPaused(signal?: AbortSignal): Promise<void>;
80
86
  }
81
87
  /** 一段增量文本;思考与最终回复分别更新。 */
82
88
  interface PrintDesignAiChatDelta {
83
89
  content?: string;
84
90
  reasoning?: string;
91
+ /** 当前工具操作的简短说明;空字符串表示操作结束。 */
92
+ activity?: string;
85
93
  }
86
94
  /** 一次流式回复完成后的文本。 */
87
95
  interface PrintDesignAiChatResult {
@@ -89,9 +97,24 @@ interface PrintDesignAiChatResult {
89
97
  reasoning?: string;
90
98
  }
91
99
  /** 发送给模型的对话消息。 */
100
+ type PrintDesignAiChatAttachment = {
101
+ kind: "image";
102
+ name: string;
103
+ mimeType: "image/png" | "image/jpeg" | "image/webp";
104
+ size: number;
105
+ dataUrl: string;
106
+ } | {
107
+ kind: "text";
108
+ name: string;
109
+ mimeType: string;
110
+ size: number;
111
+ text: string;
112
+ };
113
+ /** 对话消息保留附件内容,历史会话可继续发送给模型。 */
92
114
  interface PrintDesignAiChatMessage {
93
115
  role: "user" | "assistant";
94
116
  content: string;
117
+ attachments?: readonly PrintDesignAiChatAttachment[];
95
118
  /** 模型返回的思考内容;使用工具时可回传给兼容提供方。 */
96
119
  reasoning?: string;
97
120
  }
@@ -102,6 +125,43 @@ interface PrintDesignAiChatOptions {
102
125
  provider?: PrintDesignAiChatProvider;
103
126
  /** 初次打开时的宽度配置,单位为 CSS 像素。 */
104
127
  panelWidths?: Partial<PrintDesignAiChatPanelWidths>;
128
+ /** 宿主提供插件草稿构建服务时,Agent 才能生成可下载的 ZIP。 */
129
+ pluginAuthoring?: PrintDesignAiPluginAuthoring;
130
+ }
131
+ /** Agent 只提交固定目录下的源码;包清单及构建产物由宿主生成。 */
132
+ interface PrintDesignAiPluginDraft {
133
+ packageId: string;
134
+ version: string;
135
+ componentType: string;
136
+ name: string;
137
+ description: string;
138
+ files: Array<{
139
+ path: string;
140
+ content: string;
141
+ }>;
142
+ }
143
+ /** 一份已校验、可由当前用户下载的插件归档。 */
144
+ interface PrintDesignAiPluginArtifact {
145
+ id: string;
146
+ packageId: string;
147
+ version: string;
148
+ name: string;
149
+ sha256: string;
150
+ }
151
+ /** 插件源码的构建、保存和下载由当前浏览器负责。 */
152
+ interface PrintDesignAiPluginAuthoring {
153
+ create(draft: PrintDesignAiPluginDraft): Promise<PrintDesignAiPluginArtifact>;
154
+ getArchive(id: string): Promise<Uint8Array>;
155
+ listSources?(): Promise<readonly {
156
+ packageId: string;
157
+ version: string;
158
+ componentType: string;
159
+ name: string;
160
+ }[]>;
161
+ getSource?(query: {
162
+ packageId: string;
163
+ version?: string;
164
+ }): Promise<PrintDesignAiPluginDraft>;
105
165
  }
106
166
  /** 编辑器向右侧面板传递的运行时能力。 */
107
167
  interface PrintDesignAiChatPanelContext {
@@ -112,6 +172,21 @@ interface PrintDesignAiChatPanelContext {
112
172
  selection?: PrintDesignAiChatSelection;
113
173
  }
114
174
 
175
+ interface StoredPluginArtifact {
176
+ artifact: PrintDesignAiPluginArtifact;
177
+ draft: PrintDesignAiPluginDraft;
178
+ bytes: Uint8Array;
179
+ createdAt: number;
180
+ }
181
+ /** 浏览器归档存储,可由宿主替换为自己的本地持久实现。 */
182
+ interface BrowserPluginArtifactStorage {
183
+ save(value: StoredPluginArtifact): Promise<void>;
184
+ list(): Promise<StoredPluginArtifact[]>;
185
+ read(id: string): Promise<StoredPluginArtifact | null>;
186
+ }
187
+ /** 完全在浏览器中编译、打包并持久保存 Agent 插件。 */
188
+ declare function createBrowserPluginAuthoring(storage?: BrowserPluginArtifactStorage): PrintDesignAiPluginAuthoring;
189
+
115
190
  /** 浏览器端 AI 对话插件,由宿主独立装配到设计器右侧。 */
116
191
  declare function createPrintDesignAiChatPlugin(options?: PrintDesignAiChatOptions): {
117
192
  initialPanelWidths: PrintDesignAiChatPanelWidths;
@@ -137,7 +212,7 @@ declare const builtinPrintDesignPlugins: Readonly<{
137
212
  minVersion: string;
138
213
  }[];
139
214
  description: string;
140
- componentTypes: ("text" | "list" | "dateTime" | "moneyUpper" | "pageNumber" | "watermark" | "shape" | "brush" | "connector" | "divider" | "ruler" | "grid" | "coordinate" | "progress" | "flow" | "clock" | "image" | "barcode" | "qrcode" | "chart" | "table" | "pivotTable" | "gantt" | "generic")[];
215
+ componentTypes: ("text" | "richText" | "list" | "dateTime" | "moneyUpper" | "pageNumber" | "watermark" | "shape" | "brush" | "connector" | "divider" | "ruler" | "grid" | "coordinate" | "progress" | "flow" | "clock" | "image" | "barcode" | "qrcode" | "chart" | "table" | "pivotTable" | "gantt" | "generic")[];
141
216
  toolIds: never[];
142
217
  compatibility: string;
143
218
  permissions: string;
@@ -174,4 +249,4 @@ declare const builtinPrintDesignPlugins: Readonly<{
174
249
  componentRegistry: _canvas_components_print_design.PrintDesignComponentRegistry;
175
250
  }>;
176
251
 
177
- export { type PrintDesignAiChatConfig, type PrintDesignAiChatMessage, type PrintDesignAiChatOptions, type PrintDesignAiChatPanelWidths, type PrintDesignAiChatProfile, type PrintDesignAiChatProvider, type PrintDesignAiChatReasoningEffort, type PrintDesignAiChatSelection, type PrintDesignAiChatSettings, builtinPrintDesignPlugins, builtinReactComponentPlugins, createPrintDesignAiChatPlugin };
252
+ export { type PrintDesignAiChatConfig, type PrintDesignAiChatMessage, type PrintDesignAiChatOptions, type PrintDesignAiChatPanelWidths, type PrintDesignAiChatProfile, type PrintDesignAiChatProvider, type PrintDesignAiChatReasoningEffort, type PrintDesignAiChatSelection, type PrintDesignAiChatSettings, builtinPrintDesignPlugins, builtinReactComponentPlugins, createBrowserPluginAuthoring, createPrintDesignAiChatPlugin };