@vcp-dev/contracts 0.10.1 → 0.10.3

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.
@@ -0,0 +1,62 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Workspace 聊天图片附件合同。附件是独立边界(不进 input-context 资料轨):
4
+ * 消息 `parts` 里只放 AI SDK `file` part 引用,`url` 是附件读图路径;字节只存 S3。
5
+ * 设计见 docs/superpowers/specs/2026-09-09-workspace-chat-image-attachments-design.md。
6
+ */
7
+ export declare const MAX_WORKSPACE_ATTACHMENTS_PER_MESSAGE = 4;
8
+ /** 每站 24h 内未绑定(尚未随消息发送)的附件上限,超过则上传 409。 */
9
+ export declare const MAX_UNBOUND_WORKSPACE_ATTACHMENTS_PER_SITE = 20;
10
+ export declare const WORKSPACE_ATTACHMENT_UNBOUND_TTL_MS: number;
11
+ /** 压缩收敛目标(base64 长度)。比首轮参考图的 5MiB 紧:迭代循环每步都重发内联图。 */
12
+ export declare const WORKSPACE_ATTACHMENT_TARGET_BASE64_BYTES = 1000000;
13
+ export declare const WORKSPACE_ATTACHMENT_MEDIA_TYPES: readonly ["image/png", "image/jpeg", "image/webp"];
14
+ export declare const WorkspaceAttachmentMediaTypeSchema: z.ZodEnum<{
15
+ "image/png": "image/png";
16
+ "image/jpeg": "image/jpeg";
17
+ "image/webp": "image/webp";
18
+ }>;
19
+ export type WorkspaceAttachmentMediaType = z.infer<typeof WorkspaceAttachmentMediaTypeSchema>;
20
+ export declare const WORKSPACE_ATTACHMENT_UNSUPPORTED_FORMAT_ERROR_CODE: "WORKSPACE_ATTACHMENT_UNSUPPORTED_FORMAT";
21
+ export declare const WORKSPACE_ATTACHMENT_TOO_LARGE_ERROR_CODE: "WORKSPACE_ATTACHMENT_TOO_LARGE";
22
+ export declare const WORKSPACE_ATTACHMENT_LIMIT_ERROR_CODE: "WORKSPACE_ATTACHMENT_LIMIT";
23
+ export declare const WORKSPACE_ATTACHMENT_BOUND_ERROR_CODE: "WORKSPACE_ATTACHMENT_BOUND";
24
+ export declare const WorkspaceAttachmentSchema: z.ZodObject<{
25
+ attachment_id: z.ZodString;
26
+ media_type: z.ZodEnum<{
27
+ "image/png": "image/png";
28
+ "image/jpeg": "image/jpeg";
29
+ "image/webp": "image/webp";
30
+ }>;
31
+ width: z.ZodNumber;
32
+ height: z.ZodNumber;
33
+ size_bytes: z.ZodNumber;
34
+ filename: z.ZodString;
35
+ image_url: z.ZodString;
36
+ created_at: z.ZodString;
37
+ }, z.core.$strict>;
38
+ export type WorkspaceAttachment = z.infer<typeof WorkspaceAttachmentSchema>;
39
+ /** 附件读图路径的唯一事实源;web / api / agent 三方都只认这个形状。 */
40
+ export declare function workspaceAttachmentImagePath(site_id: string, attachment_id: string): string;
41
+ export declare function parseWorkspaceAttachmentImagePath(url: string): {
42
+ site_id: string;
43
+ attachment_id: string;
44
+ } | null;
45
+ export interface WorkspaceAttachmentReference {
46
+ attachment_id: string;
47
+ site_id: string;
48
+ media_type: string;
49
+ filename: string;
50
+ url: string;
51
+ }
52
+ /**
53
+ * 从 UIMessage parts 读出附件引用:只认 `file` part 且 `url` 能解析成附件路径。
54
+ * 结构化入参而非 `AiSdkUiMessagePart`,避免与 index.ts 循环依赖。
55
+ */
56
+ export declare function readWorkspaceAttachmentReferences(parts: readonly {
57
+ type: string;
58
+ mediaType?: unknown;
59
+ filename?: unknown;
60
+ url?: unknown;
61
+ [key: string]: unknown;
62
+ }[]): WorkspaceAttachmentReference[];
@@ -45,6 +45,7 @@ export declare const WorkspaceResourceOperationTransientInputSchema: z.ZodObject
45
45
  "update-text": "update-text";
46
46
  "update-array-item": "update-array-item";
47
47
  "remove-node": "remove-node";
48
+ "replace-node": "replace-node";
48
49
  "move-node": "move-node";
49
50
  "set-class-name-source": "set-class-name-source";
50
51
  "apply-style-draft": "apply-style-draft";
@@ -173,6 +174,31 @@ export declare const WorkspaceResourceOperationTransientInputSchema: z.ZodObject
173
174
  templateId: z.ZodOptional<z.ZodString>;
174
175
  }, z.core.$strict>;
175
176
  }, z.core.$strict>]>;
177
+ }, z.core.$strip>, z.ZodObject<{
178
+ kind: z.ZodLiteral<"replace-node">;
179
+ node: z.ZodObject<{
180
+ kind: z.ZodLiteral<"component-call">;
181
+ component: z.ZodOptional<z.ZodNever>;
182
+ materialization: z.ZodObject<{
183
+ instanceBaseName: z.ZodString;
184
+ files: z.ZodArray<z.ZodObject<{
185
+ pathTemplate: z.ZodString;
186
+ content: z.ZodString;
187
+ role: z.ZodOptional<z.ZodString>;
188
+ }, z.core.$strict>>;
189
+ entry: z.ZodObject<{
190
+ pathTemplate: z.ZodString;
191
+ export: z.ZodUnion<readonly [z.ZodObject<{
192
+ kind: z.ZodLiteral<"default">;
193
+ }, z.core.$strict>, z.ZodObject<{
194
+ kind: z.ZodLiteral<"named">;
195
+ name: z.ZodString;
196
+ }, z.core.$strict>]>;
197
+ }, z.core.$strict>;
198
+ dataRequirements: z.ZodOptional<z.ZodArray<z.ZodNever>>;
199
+ }, z.core.$strict>;
200
+ props: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNever>>;
201
+ }, z.core.$strict>;
176
202
  }, z.core.$strip>, z.ZodObject<{
177
203
  kind: z.ZodLiteral<"move-node">;
178
204
  target: z.ZodUnion<readonly [z.ZodObject<{
@@ -422,6 +448,7 @@ export declare const WorkspaceResourceOperationClientMessageSchema: z.ZodObject<
422
448
  "update-text": "update-text";
423
449
  "update-array-item": "update-array-item";
424
450
  "remove-node": "remove-node";
451
+ "replace-node": "replace-node";
425
452
  "move-node": "move-node";
426
453
  "set-class-name-source": "set-class-name-source";
427
454
  "apply-style-draft": "apply-style-draft";
@@ -550,6 +577,31 @@ export declare const WorkspaceResourceOperationClientMessageSchema: z.ZodObject<
550
577
  templateId: z.ZodOptional<z.ZodString>;
551
578
  }, z.core.$strict>;
552
579
  }, z.core.$strict>]>;
580
+ }, z.core.$strip>, z.ZodObject<{
581
+ kind: z.ZodLiteral<"replace-node">;
582
+ node: z.ZodObject<{
583
+ kind: z.ZodLiteral<"component-call">;
584
+ component: z.ZodOptional<z.ZodNever>;
585
+ materialization: z.ZodObject<{
586
+ instanceBaseName: z.ZodString;
587
+ files: z.ZodArray<z.ZodObject<{
588
+ pathTemplate: z.ZodString;
589
+ content: z.ZodString;
590
+ role: z.ZodOptional<z.ZodString>;
591
+ }, z.core.$strict>>;
592
+ entry: z.ZodObject<{
593
+ pathTemplate: z.ZodString;
594
+ export: z.ZodUnion<readonly [z.ZodObject<{
595
+ kind: z.ZodLiteral<"default">;
596
+ }, z.core.$strict>, z.ZodObject<{
597
+ kind: z.ZodLiteral<"named">;
598
+ name: z.ZodString;
599
+ }, z.core.$strict>]>;
600
+ }, z.core.$strict>;
601
+ dataRequirements: z.ZodOptional<z.ZodArray<z.ZodNever>>;
602
+ }, z.core.$strict>;
603
+ props: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNever>>;
604
+ }, z.core.$strict>;
553
605
  }, z.core.$strip>, z.ZodObject<{
554
606
  kind: z.ZodLiteral<"move-node">;
555
607
  target: z.ZodUnion<readonly [z.ZodObject<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vcp-dev/contracts",
3
- "version": "0.10.1",
3
+ "version": "0.10.3",
4
4
  "type": "module",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {