@valbuild/shared 0.94.0 → 0.96.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.
@@ -527,6 +527,8 @@ export declare const Api: {
527
527
  json: z.ZodObject<{
528
528
  nonce: z.ZodNullable<z.ZodString>;
529
529
  baseUrl: z.ZodString;
530
+ contentBaseUrl: z.ZodNullable<z.ZodString>;
531
+ contentAuthNonce: z.ZodNullable<z.ZodString>;
530
532
  }, z.core.$strip>;
531
533
  }, z.core.$strip>]>;
532
534
  };
@@ -573,6 +575,7 @@ export declare const Api: {
573
575
  type: z.ZodLiteral<"patch">;
574
576
  patchId: z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>;
575
577
  }, z.core.$strip>]>;
578
+ sessionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
576
579
  patches: z.ZodArray<z.ZodObject<{
577
580
  path: z.ZodString & z.ZodType<ModuleFilePath, string, z.core.$ZodTypeInternals<ModuleFilePath, string>>;
578
581
  patchId: z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>;
@@ -833,6 +836,11 @@ export declare const Api: {
833
836
  json: z.ZodObject<{
834
837
  message: z.ZodString;
835
838
  }, z.core.$strip>;
839
+ }, z.core.$strip>, z.ZodObject<{
840
+ status: z.ZodLiteral<500>;
841
+ json: z.ZodObject<{
842
+ message: z.ZodString;
843
+ }, z.core.$strip>;
836
844
  }, z.core.$strip>, z.ZodObject<{
837
845
  status: z.ZodLiteral<200>;
838
846
  json: z.ZodObject<{
@@ -953,6 +961,226 @@ export declare const Api: {
953
961
  }, z.core.$strip>]>;
954
962
  };
955
963
  };
964
+ "/ai/initialize": {
965
+ POST: {
966
+ req: {
967
+ cookies: {
968
+ val_session: z.ZodOptional<z.ZodString>;
969
+ };
970
+ };
971
+ res: z.ZodUnion<readonly [z.ZodObject<{
972
+ status: z.ZodLiteral<401>;
973
+ json: z.ZodObject<{
974
+ message: z.ZodString;
975
+ }, z.core.$strip>;
976
+ }, z.core.$strip>, z.ZodObject<{
977
+ status: z.ZodLiteral<200>;
978
+ json: z.ZodObject<{
979
+ nonce: z.ZodString;
980
+ wsUrl: z.ZodString;
981
+ }, z.core.$strip>;
982
+ }, z.core.$strip>, z.ZodObject<{
983
+ status: z.ZodLiteral<500>;
984
+ json: z.ZodObject<{
985
+ message: z.ZodString;
986
+ }, z.core.$strip>;
987
+ }, z.core.$strip>]>;
988
+ };
989
+ };
990
+ "/ai/sessions": {
991
+ GET: {
992
+ req: {
993
+ query: {
994
+ limit: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string, string[]>>>;
995
+ cursor_updatedAt: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string, string[]>>>;
996
+ cursor_id: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string, string[]>>>;
997
+ };
998
+ cookies: {
999
+ val_session: z.ZodOptional<z.ZodString>;
1000
+ };
1001
+ };
1002
+ res: z.ZodUnion<readonly [z.ZodObject<{
1003
+ status: z.ZodLiteral<401>;
1004
+ json: z.ZodObject<{
1005
+ message: z.ZodString;
1006
+ }, z.core.$strip>;
1007
+ }, z.core.$strip>, z.ZodObject<{
1008
+ status: z.ZodLiteral<200>;
1009
+ json: z.ZodObject<{
1010
+ sessions: z.ZodArray<z.ZodObject<{
1011
+ id: z.ZodString;
1012
+ name: z.ZodNullable<z.ZodString>;
1013
+ createdAt: z.ZodString;
1014
+ updatedAt: z.ZodString;
1015
+ }, z.core.$strip>>;
1016
+ nextCursor: z.ZodOptional<z.ZodNullable<z.ZodObject<{
1017
+ updatedAt: z.ZodString;
1018
+ id: z.ZodString;
1019
+ }, z.core.$strip>>>;
1020
+ }, z.core.$strip>;
1021
+ }, z.core.$strip>, z.ZodObject<{
1022
+ status: z.ZodLiteral<500>;
1023
+ json: z.ZodObject<{
1024
+ message: z.ZodString;
1025
+ }, z.core.$strip>;
1026
+ }, z.core.$strip>]>;
1027
+ };
1028
+ PATCH: {
1029
+ req: {
1030
+ path: z.ZodString;
1031
+ body: z.ZodObject<{
1032
+ name: z.ZodString;
1033
+ }, z.core.$strip>;
1034
+ cookies: {
1035
+ val_session: z.ZodOptional<z.ZodString>;
1036
+ };
1037
+ };
1038
+ res: z.ZodUnion<readonly [z.ZodObject<{
1039
+ status: z.ZodLiteral<401>;
1040
+ json: z.ZodObject<{
1041
+ message: z.ZodString;
1042
+ }, z.core.$strip>;
1043
+ }, z.core.$strip>, z.ZodObject<{
1044
+ status: z.ZodLiteral<200>;
1045
+ json: z.ZodObject<{}, z.core.$strip>;
1046
+ }, z.core.$strip>, z.ZodObject<{
1047
+ status: z.ZodLiteral<500>;
1048
+ json: z.ZodObject<{
1049
+ message: z.ZodString;
1050
+ }, z.core.$strip>;
1051
+ }, z.core.$strip>]>;
1052
+ };
1053
+ };
1054
+ "/ai/messages": {
1055
+ GET: {
1056
+ req: {
1057
+ path: z.ZodString;
1058
+ query: {
1059
+ limit: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string, string[]>>>;
1060
+ cursor_updatedAt: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string, string[]>>>;
1061
+ cursor_id: z.ZodOptional<z.ZodPipe<z.ZodArray<z.ZodString>, z.ZodTransform<string, string[]>>>;
1062
+ };
1063
+ cookies: {
1064
+ val_session: z.ZodOptional<z.ZodString>;
1065
+ };
1066
+ };
1067
+ res: z.ZodUnion<readonly [z.ZodObject<{
1068
+ status: z.ZodLiteral<401>;
1069
+ json: z.ZodObject<{
1070
+ message: z.ZodString;
1071
+ }, z.core.$strip>;
1072
+ }, z.core.$strip>, z.ZodObject<{
1073
+ status: z.ZodLiteral<200>;
1074
+ json: z.ZodObject<{
1075
+ messages: z.ZodArray<z.ZodObject<{
1076
+ role: z.ZodString;
1077
+ content: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1078
+ type: z.ZodLiteral<"text">;
1079
+ text: z.ZodString;
1080
+ }, z.core.$strip>, z.ZodObject<{
1081
+ type: z.ZodLiteral<"image_url">;
1082
+ url: z.ZodString;
1083
+ }, z.core.$strip>]>>]>;
1084
+ }, z.core.$strip>>;
1085
+ nextCursor: z.ZodOptional<z.ZodNullable<z.ZodObject<{
1086
+ updatedAt: z.ZodString;
1087
+ id: z.ZodString;
1088
+ }, z.core.$strip>>>;
1089
+ }, z.core.$strip>;
1090
+ }, z.core.$strip>, z.ZodObject<{
1091
+ status: z.ZodLiteral<500>;
1092
+ json: z.ZodObject<{
1093
+ message: z.ZodString;
1094
+ }, z.core.$strip>;
1095
+ }, z.core.$strip>]>;
1096
+ };
1097
+ };
1098
+ "/ai/session-image-to-patch-file": {
1099
+ POST: {
1100
+ req: {
1101
+ body: z.ZodObject<{
1102
+ patchId: z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>;
1103
+ parentRef: z.ZodUnion<readonly [z.ZodObject<{
1104
+ type: z.ZodLiteral<"head">;
1105
+ headBaseSha: z.ZodString;
1106
+ }, z.core.$strip>, z.ZodObject<{
1107
+ type: z.ZodLiteral<"patch">;
1108
+ patchId: z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>;
1109
+ }, z.core.$strip>]>;
1110
+ files: z.ZodArray<z.ZodObject<{
1111
+ filePath: z.ZodString;
1112
+ key: z.ZodString;
1113
+ isRemote: z.ZodOptional<z.ZodBoolean>;
1114
+ }, z.core.$strip>>;
1115
+ }, z.core.$strip>;
1116
+ cookies: {
1117
+ val_session: z.ZodOptional<z.ZodString>;
1118
+ };
1119
+ };
1120
+ res: z.ZodUnion<readonly [z.ZodObject<{
1121
+ status: z.ZodLiteral<401>;
1122
+ json: z.ZodObject<{
1123
+ message: z.ZodString;
1124
+ }, z.core.$strip>;
1125
+ }, z.core.$strip>, z.ZodObject<{
1126
+ status: z.ZodLiteral<200>;
1127
+ json: z.ZodObject<{
1128
+ patchId: z.ZodString & z.ZodType<import("@valbuild/core").PatchId, string, z.core.$ZodTypeInternals<import("@valbuild/core").PatchId, string>>;
1129
+ files: z.ZodArray<z.ZodObject<{
1130
+ filePath: z.ZodString;
1131
+ metadata: z.ZodObject<{
1132
+ width: z.ZodNumber;
1133
+ height: z.ZodNumber;
1134
+ mimeType: z.ZodString;
1135
+ }, z.core.$strip>;
1136
+ }, z.core.$strip>>;
1137
+ }, z.core.$strip>;
1138
+ }, z.core.$strip>, z.ZodObject<{
1139
+ status: z.ZodLiteral<400>;
1140
+ json: z.ZodObject<{
1141
+ message: z.ZodString;
1142
+ details: z.ZodOptional<z.ZodObject<{
1143
+ availableKeys: z.ZodOptional<z.ZodArray<z.ZodString>>;
1144
+ }, z.core.$strip>>;
1145
+ }, z.core.$strip>;
1146
+ }, z.core.$strip>, z.ZodObject<{
1147
+ status: z.ZodLiteral<500>;
1148
+ json: z.ZodObject<{
1149
+ message: z.ZodString;
1150
+ }, z.core.$strip>;
1151
+ }, z.core.$strip>]>;
1152
+ };
1153
+ };
1154
+ "/ai/images": {
1155
+ PATCH: {
1156
+ req: {
1157
+ body: z.ZodObject<{
1158
+ key: z.ZodString;
1159
+ metadata: z.ZodAny;
1160
+ contentType: z.ZodString;
1161
+ }, z.core.$strip>;
1162
+ cookies: {
1163
+ val_session: z.ZodOptional<z.ZodString>;
1164
+ };
1165
+ };
1166
+ res: z.ZodUnion<readonly [z.ZodObject<{
1167
+ status: z.ZodLiteral<401>;
1168
+ json: z.ZodObject<{
1169
+ message: z.ZodString;
1170
+ }, z.core.$strip>;
1171
+ }, z.core.$strip>, z.ZodObject<{
1172
+ status: z.ZodLiteral<200>;
1173
+ json: z.ZodObject<{
1174
+ key: z.ZodString;
1175
+ }, z.core.$strip>;
1176
+ }, z.core.$strip>, z.ZodObject<{
1177
+ status: z.ZodLiteral<500>;
1178
+ json: z.ZodObject<{
1179
+ message: z.ZodString;
1180
+ }, z.core.$strip>;
1181
+ }, z.core.$strip>]>;
1182
+ };
1183
+ };
956
1184
  };
957
1185
  /**
958
1186
  * Extracts the keys of an object where the value is not undefined.
@@ -1002,7 +1230,7 @@ export type ApiEndpoint = {
1002
1230
  redirectTo: string;
1003
1231
  }>;
1004
1232
  };
1005
- type ApiGuard = Record<`/${string}`, Partial<Record<"PUT" | "GET" | "POST" | "DELETE", ApiEndpoint>>>;
1233
+ type ApiGuard = Record<`/${string}`, Partial<Record<"PUT" | "GET" | "POST" | "DELETE" | "PATCH", ApiEndpoint>>>;
1006
1234
  export type ServerOf<Api extends ApiGuard> = {
1007
1235
  [Route in keyof Api]: {
1008
1236
  [Method in keyof Api[Route]]: Api[Route][Method] extends ApiEndpoint ? (req: DefinedObject<{
@@ -13,3 +13,4 @@ export * from "./parseRoutePattern.js";
13
13
  export * from "./getNextAppRouterSourceFolder.js";
14
14
  export * from "./routeValidation.js";
15
15
  export * from "./getErrorMessageFromUnknownJson.js";
16
+ export * from "./zod/SerializedSchema.js";
@@ -14,7 +14,7 @@ export declare const RemirrorLinkMark: z.ZodObject<{
14
14
  export type RemirrorLinkMark = z.infer<typeof RemirrorLinkMark>;
15
15
  export declare const RemirrorText: z.ZodIntersection<z.ZodObject<{
16
16
  type: z.ZodLiteral<"text">;
17
- text: z.ZodString;
17
+ text: z.ZodOptional<z.ZodString>;
18
18
  }, z.core.$strip>, z.ZodObject<{
19
19
  marks: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
20
20
  type: z.ZodUnion<readonly [z.ZodLiteral<"bold">, z.ZodLiteral<"strike">, z.ZodLiteral<"italic">]>;
@@ -60,7 +60,7 @@ export declare const RemirrorHeading: z.ZodIntersection<z.ZodObject<{
60
60
  }, z.core.$strip>>;
61
61
  content: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodIntersection<z.ZodObject<{
62
62
  type: z.ZodLiteral<"text">;
63
- text: z.ZodString;
63
+ text: z.ZodOptional<z.ZodString>;
64
64
  }, z.core.$strip>, z.ZodObject<{
65
65
  marks: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
66
66
  type: z.ZodUnion<readonly [z.ZodLiteral<"bold">, z.ZodLiteral<"strike">, z.ZodLiteral<"italic">]>;
@@ -135,7 +135,7 @@ export declare const RemirrorJSON: z.ZodObject<{
135
135
  }, z.core.$strip>>;
136
136
  content: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodIntersection<z.ZodObject<{
137
137
  type: z.ZodLiteral<"text">;
138
- text: z.ZodString;
138
+ text: z.ZodOptional<z.ZodString>;
139
139
  }, z.core.$strip>, z.ZodObject<{
140
140
  marks: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
141
141
  type: z.ZodUnion<readonly [z.ZodLiteral<"bold">, z.ZodLiteral<"strike">, z.ZodLiteral<"italic">]>;
@@ -0,0 +1,27 @@
1
+ import { z } from "zod";
2
+ import { type SerializedSchema as SerializedSchemaT, type SerializedStringSchema as SerializedStringSchemaT, type SerializedLiteralSchema as SerializedLiteralSchemaT, type SerializedBooleanSchema as SerializedBooleanSchemaT, type SerializedNumberSchema as SerializedNumberSchemaT, type SerializedObjectSchema as SerializedObjectSchemaT, type SerializedArraySchema as SerializedArraySchemaT, type SerializedUnionSchema as SerializedUnionSchemaT, type SerializedRichTextSchema as SerializedRichTextSchemaT, type SerializedRichTextOptions as SerializedRichTextOptionsT, type SerializedRecordSchema as SerializedRecordSchemaT, type SerializedKeyOfSchema as SerializedKeyOfSchemaT, type SerializedRouteSchema as SerializedRouteSchemaT, type SerializedFileSchema as SerializedFileSchemaT, type SerializedDateSchema as SerializedDateSchemaT, type SerializedImageSchema as SerializedImageSchemaT } from "@valbuild/core";
3
+ export declare const SerializedStringSchema: z.ZodType<SerializedStringSchemaT>;
4
+ export declare const SerializedLiteralSchema: z.ZodType<SerializedLiteralSchemaT>;
5
+ export declare const SerializedBooleanSchema: z.ZodType<SerializedBooleanSchemaT>;
6
+ export declare const SerializedNumberSchema: z.ZodType<SerializedNumberSchemaT>;
7
+ export declare const SerializedObjectSchema: z.ZodType<SerializedObjectSchemaT>;
8
+ export declare const SerializedArraySchema: z.ZodType<SerializedArraySchemaT>;
9
+ export declare const SerializedUnionSchema: z.ZodType<SerializedUnionSchemaT>;
10
+ export declare const ImageOptions: z.ZodObject<{
11
+ ext: z.ZodOptional<z.ZodUnion<readonly [z.ZodTuple<[z.ZodLiteral<"jpg">], null>, z.ZodTuple<[z.ZodLiteral<"webp">], null>]>>;
12
+ directory: z.ZodOptional<z.ZodString>;
13
+ prefix: z.ZodOptional<z.ZodString>;
14
+ accept: z.ZodOptional<z.ZodString>;
15
+ }, z.core.$strip>;
16
+ export declare const SerializedImageSchema: z.ZodType<SerializedImageSchemaT>;
17
+ export declare const RichTextOptions: z.ZodType<SerializedRichTextOptionsT>;
18
+ export declare const SerializedRichTextSchema: z.ZodType<SerializedRichTextSchemaT>;
19
+ export declare const SerializedRecordSchema: z.ZodType<SerializedRecordSchemaT>;
20
+ export declare const SerializedKeyOfSchema: z.ZodType<SerializedKeyOfSchemaT>;
21
+ export declare const FileOptions: z.ZodObject<{
22
+ accept: z.ZodOptional<z.ZodString>;
23
+ }, z.core.$strip>;
24
+ export declare const SerializedFileSchema: z.ZodType<SerializedFileSchemaT>;
25
+ export declare const SerializedDateSchema: z.ZodType<SerializedDateSchemaT>;
26
+ export declare const SerializedRouteSchema: z.ZodType<SerializedRouteSchemaT>;
27
+ export declare const SerializedSchema: z.ZodType<SerializedSchemaT>;
@@ -198,7 +198,8 @@ function convertParagraph(path, child, files, configDirectory, remoteOptions) {
198
198
  }
199
199
  function convertTextNode(node) {
200
200
  if (node.type === "text") {
201
- var _node$marks, _node$marks2;
201
+ var _node$text, _node$marks, _node$marks2;
202
+ var text = (_node$text = node.text) !== null && _node$text !== void 0 ? _node$text : "";
202
203
  var styles = ((_node$marks = node.marks) === null || _node$marks === void 0 ? void 0 : _node$marks.flatMap(function (mark) {
203
204
  if (mark.type !== "link") {
204
205
  if (mark.type === "strike") {
@@ -223,7 +224,7 @@ function convertTextNode(node) {
223
224
  children: [{
224
225
  tag: "span",
225
226
  styles: styles,
226
- children: [node.text]
227
+ children: [text]
227
228
  }]
228
229
  };
229
230
  }
@@ -232,17 +233,17 @@ function convertTextNode(node) {
232
233
  href: ((_node$marks$find2 = node.marks.find(function (mark) {
233
234
  return mark.type === "link";
234
235
  })) === null || _node$marks$find2 === void 0 ? void 0 : _node$marks$find2.attrs.href) || "",
235
- children: [node.text]
236
+ children: [text]
236
237
  };
237
238
  }
238
239
  if (styles.length > 0) {
239
240
  return {
240
241
  tag: "span",
241
242
  styles: styles,
242
- children: [node.text]
243
+ children: [text]
243
244
  };
244
245
  }
245
- return node.text;
246
+ return text;
246
247
  } else {
247
248
  var exhaustiveCheck = node.type;
248
249
  throw new Error("Unexpected node type: ".concat(exhaustiveCheck));
@@ -429,7 +430,7 @@ var RemirrorLinkMark = zod.z.object({
429
430
  });
430
431
  var RemirrorText = zod.z.intersection(zod.z.object({
431
432
  type: zod.z.literal("text"),
432
- text: zod.z.string()
433
+ text: zod.z.string().optional()
433
434
  }), zod.z.object({
434
435
  marks: zod.z.array(zod.z.union([RemirrorTextMark, RemirrorLinkMark]))
435
436
  }).partial());
@@ -559,6 +560,11 @@ function convertHeadingToRemirror(level, children) {
559
560
  };
560
561
  }
561
562
  function convertStringToRemirror(child) {
563
+ if (!child) {
564
+ return {
565
+ type: "text"
566
+ };
567
+ }
562
568
  return {
563
569
  type: "text",
564
570
  text: child
@@ -622,6 +628,9 @@ function convertParagraphToRemirror(children) {
622
628
  type: "paragraph",
623
629
  content: children.flatMap(function (child) {
624
630
  if (typeof child === "string") {
631
+ if (!child) {
632
+ return [];
633
+ }
625
634
  return [convertStringToRemirror(child)];
626
635
  }
627
636
  switch (child.tag) {
@@ -1642,7 +1651,9 @@ var Api = {
1642
1651
  status: zod.z.literal(200),
1643
1652
  json: zod.z.object({
1644
1653
  nonce: zod.z.string().nullable(),
1645
- baseUrl: zod.z.string()
1654
+ baseUrl: zod.z.string(),
1655
+ contentBaseUrl: zod.z.string().nullable(),
1656
+ contentAuthNonce: zod.z.string().nullable()
1646
1657
  })
1647
1658
  })])
1648
1659
  }
@@ -1672,6 +1683,7 @@ var Api = {
1672
1683
  req: {
1673
1684
  body: zod.z.object({
1674
1685
  parentRef: ParentRef,
1686
+ sessionId: zod.z.string().nullish(),
1675
1687
  patches: zod.z.array(zod.z.object({
1676
1688
  path: ModuleFilePath,
1677
1689
  patchId: PatchId,
@@ -1838,6 +1850,9 @@ var Api = {
1838
1850
  }
1839
1851
  },
1840
1852
  res: zod.z.union([unauthorizedResponse, zod.z.object({
1853
+ status: zod.z.literal(500),
1854
+ json: GenericError
1855
+ }), zod.z.object({
1841
1856
  status: zod.z.literal(200),
1842
1857
  json: zod.z.object({
1843
1858
  profiles: zod.z.array(zod.z.object({
@@ -1928,6 +1943,166 @@ var Api = {
1928
1943
  body: zod.z["instanceof"](ReadableStream)
1929
1944
  })])
1930
1945
  }
1946
+ },
1947
+ "/ai/initialize": {
1948
+ POST: {
1949
+ req: {
1950
+ cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
1951
+ },
1952
+ res: zod.z.union([unauthorizedResponse, zod.z.object({
1953
+ status: zod.z.literal(200),
1954
+ json: zod.z.object({
1955
+ nonce: zod.z.string(),
1956
+ wsUrl: zod.z.string()
1957
+ })
1958
+ }), zod.z.object({
1959
+ status: zod.z.literal(500),
1960
+ json: GenericError
1961
+ })])
1962
+ }
1963
+ },
1964
+ "/ai/sessions": {
1965
+ GET: {
1966
+ req: {
1967
+ query: {
1968
+ limit: onlyOneStringQueryParam.optional(),
1969
+ cursor_updatedAt: onlyOneStringQueryParam.optional(),
1970
+ cursor_id: onlyOneStringQueryParam.optional()
1971
+ },
1972
+ cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
1973
+ },
1974
+ res: zod.z.union([unauthorizedResponse, zod.z.object({
1975
+ status: zod.z.literal(200),
1976
+ json: zod.z.object({
1977
+ sessions: zod.z.array(zod.z.object({
1978
+ id: zod.z.string(),
1979
+ name: zod.z.string().nullable(),
1980
+ createdAt: zod.z.string(),
1981
+ updatedAt: zod.z.string()
1982
+ })),
1983
+ nextCursor: zod.z.object({
1984
+ updatedAt: zod.z.string(),
1985
+ id: zod.z.string()
1986
+ }).nullable().optional()
1987
+ })
1988
+ }), zod.z.object({
1989
+ status: zod.z.literal(500),
1990
+ json: GenericError
1991
+ })])
1992
+ },
1993
+ PATCH: {
1994
+ req: {
1995
+ path: zod.z.string(),
1996
+ body: zod.z.object({
1997
+ name: zod.z.string()
1998
+ }),
1999
+ cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
2000
+ },
2001
+ res: zod.z.union([unauthorizedResponse, zod.z.object({
2002
+ status: zod.z.literal(200),
2003
+ json: zod.z.object({})
2004
+ }), zod.z.object({
2005
+ status: zod.z.literal(500),
2006
+ json: GenericError
2007
+ })])
2008
+ }
2009
+ },
2010
+ "/ai/messages": {
2011
+ GET: {
2012
+ req: {
2013
+ path: zod.z.string(),
2014
+ query: {
2015
+ limit: onlyOneStringQueryParam.optional(),
2016
+ cursor_updatedAt: onlyOneStringQueryParam.optional(),
2017
+ cursor_id: onlyOneStringQueryParam.optional()
2018
+ },
2019
+ cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
2020
+ },
2021
+ res: zod.z.union([unauthorizedResponse, zod.z.object({
2022
+ status: zod.z.literal(200),
2023
+ json: zod.z.object({
2024
+ messages: zod.z.array(zod.z.object({
2025
+ role: zod.z.string(),
2026
+ content: zod.z.union([zod.z.string(), zod.z.array(zod.z.union([zod.z.object({
2027
+ type: zod.z.literal("text"),
2028
+ text: zod.z.string()
2029
+ }), zod.z.object({
2030
+ type: zod.z.literal("image_url"),
2031
+ url: zod.z.string()
2032
+ })]))])
2033
+ })),
2034
+ nextCursor: zod.z.object({
2035
+ updatedAt: zod.z.string(),
2036
+ id: zod.z.string()
2037
+ }).nullable().optional()
2038
+ })
2039
+ }), zod.z.object({
2040
+ status: zod.z.literal(500),
2041
+ json: GenericError
2042
+ })])
2043
+ }
2044
+ },
2045
+ "/ai/session-image-to-patch-file": {
2046
+ POST: {
2047
+ req: {
2048
+ body: zod.z.object({
2049
+ patchId: PatchId,
2050
+ parentRef: ParentRef,
2051
+ files: zod.z.array(zod.z.object({
2052
+ filePath: zod.z.string(),
2053
+ key: zod.z.string(),
2054
+ isRemote: zod.z["boolean"]().optional()
2055
+ })).min(1)
2056
+ }),
2057
+ cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
2058
+ },
2059
+ res: zod.z.union([unauthorizedResponse, zod.z.object({
2060
+ status: zod.z.literal(200),
2061
+ json: zod.z.object({
2062
+ patchId: PatchId,
2063
+ files: zod.z.array(zod.z.object({
2064
+ filePath: zod.z.string(),
2065
+ metadata: zod.z.object({
2066
+ width: zod.z.number(),
2067
+ height: zod.z.number(),
2068
+ mimeType: zod.z.string()
2069
+ })
2070
+ }))
2071
+ })
2072
+ }), zod.z.object({
2073
+ status: zod.z.literal(400),
2074
+ json: zod.z.object({
2075
+ message: zod.z.string(),
2076
+ details: zod.z.object({
2077
+ availableKeys: zod.z.array(zod.z.string()).optional()
2078
+ }).optional()
2079
+ })
2080
+ }), zod.z.object({
2081
+ status: zod.z.literal(500),
2082
+ json: GenericError
2083
+ })])
2084
+ }
2085
+ },
2086
+ "/ai/images": {
2087
+ PATCH: {
2088
+ req: {
2089
+ body: zod.z.object({
2090
+ key: zod.z.string(),
2091
+ metadata: zod.z.any(),
2092
+ contentType: zod.z.string()
2093
+ }),
2094
+ cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
2095
+ },
2096
+ res: zod.z.union([unauthorizedResponse, zod.z.object({
2097
+ status: zod.z.literal(200),
2098
+ json: zod.z.object({
2099
+ key: zod.z.string()
2100
+ })
2101
+ }), zod.z.object({
2102
+ status: zod.z.literal(500),
2103
+ json: GenericError
2104
+ })])
2105
+ }
1931
2106
  }
1932
2107
  };
1933
2108
 
@@ -2277,6 +2452,14 @@ var SharedValConfig = zod.z.object({
2277
2452
  ai: zod.z.object({
2278
2453
  commitMessages: zod.z.object({
2279
2454
  disabled: zod.z["boolean"]().optional()
2455
+ }).optional(),
2456
+ chat: zod.z.object({
2457
+ experimental: zod.z.object({
2458
+ enable: zod.z["boolean"]().optional()
2459
+ }).optional(),
2460
+ suggestions: zod.z.array(zod.z.string()).optional(),
2461
+ title: zod.z.string().optional(),
2462
+ description: zod.z.string().optional()
2280
2463
  }).optional()
2281
2464
  }).optional()
2282
2465
  });
@@ -2565,6 +2748,8 @@ function createRegExpFromPattern(pattern) {
2565
2748
 
2566
2749
  exports.Api = Api;
2567
2750
  exports.DEFAULT_ERROR_MESSAGE = DEFAULT_ERROR_MESSAGE;
2751
+ exports.FileOptions = FileOptions;
2752
+ exports.ImageOptions = ImageOptions;
2568
2753
  exports.ParentRef = ParentRef$1;
2569
2754
  exports.Patch = Patch;
2570
2755
  exports.PatchBlock = PatchBlock;
@@ -2581,6 +2766,22 @@ exports.RemirrorOrderedList = RemirrorOrderedList;
2581
2766
  exports.RemirrorParagraph = RemirrorParagraph;
2582
2767
  exports.RemirrorText = RemirrorText;
2583
2768
  exports.RemirrorTextMark = RemirrorTextMark;
2769
+ exports.RichTextOptions = RichTextOptions;
2770
+ exports.SerializedArraySchema = SerializedArraySchema;
2771
+ exports.SerializedBooleanSchema = SerializedBooleanSchema;
2772
+ exports.SerializedDateSchema = SerializedDateSchema;
2773
+ exports.SerializedFileSchema = SerializedFileSchema;
2774
+ exports.SerializedImageSchema = SerializedImageSchema;
2775
+ exports.SerializedKeyOfSchema = SerializedKeyOfSchema;
2776
+ exports.SerializedLiteralSchema = SerializedLiteralSchema;
2777
+ exports.SerializedNumberSchema = SerializedNumberSchema;
2778
+ exports.SerializedObjectSchema = SerializedObjectSchema;
2779
+ exports.SerializedRecordSchema = SerializedRecordSchema;
2780
+ exports.SerializedRichTextSchema = SerializedRichTextSchema;
2781
+ exports.SerializedRouteSchema = SerializedRouteSchema;
2782
+ exports.SerializedSchema = SerializedSchema;
2783
+ exports.SerializedStringSchema = SerializedStringSchema;
2784
+ exports.SerializedUnionSchema = SerializedUnionSchema;
2584
2785
  exports.SharedValConfig = SharedValConfig;
2585
2786
  exports.VAL_CONFIG_SESSION_STORAGE_KEY = VAL_CONFIG_SESSION_STORAGE_KEY;
2586
2787
  exports.VAL_ENABLE_COOKIE_NAME = VAL_ENABLE_COOKIE_NAME;
@@ -198,7 +198,8 @@ function convertParagraph(path, child, files, configDirectory, remoteOptions) {
198
198
  }
199
199
  function convertTextNode(node) {
200
200
  if (node.type === "text") {
201
- var _node$marks, _node$marks2;
201
+ var _node$text, _node$marks, _node$marks2;
202
+ var text = (_node$text = node.text) !== null && _node$text !== void 0 ? _node$text : "";
202
203
  var styles = ((_node$marks = node.marks) === null || _node$marks === void 0 ? void 0 : _node$marks.flatMap(function (mark) {
203
204
  if (mark.type !== "link") {
204
205
  if (mark.type === "strike") {
@@ -223,7 +224,7 @@ function convertTextNode(node) {
223
224
  children: [{
224
225
  tag: "span",
225
226
  styles: styles,
226
- children: [node.text]
227
+ children: [text]
227
228
  }]
228
229
  };
229
230
  }
@@ -232,17 +233,17 @@ function convertTextNode(node) {
232
233
  href: ((_node$marks$find2 = node.marks.find(function (mark) {
233
234
  return mark.type === "link";
234
235
  })) === null || _node$marks$find2 === void 0 ? void 0 : _node$marks$find2.attrs.href) || "",
235
- children: [node.text]
236
+ children: [text]
236
237
  };
237
238
  }
238
239
  if (styles.length > 0) {
239
240
  return {
240
241
  tag: "span",
241
242
  styles: styles,
242
- children: [node.text]
243
+ children: [text]
243
244
  };
244
245
  }
245
- return node.text;
246
+ return text;
246
247
  } else {
247
248
  var exhaustiveCheck = node.type;
248
249
  throw new Error("Unexpected node type: ".concat(exhaustiveCheck));
@@ -429,7 +430,7 @@ var RemirrorLinkMark = zod.z.object({
429
430
  });
430
431
  var RemirrorText = zod.z.intersection(zod.z.object({
431
432
  type: zod.z.literal("text"),
432
- text: zod.z.string()
433
+ text: zod.z.string().optional()
433
434
  }), zod.z.object({
434
435
  marks: zod.z.array(zod.z.union([RemirrorTextMark, RemirrorLinkMark]))
435
436
  }).partial());
@@ -559,6 +560,11 @@ function convertHeadingToRemirror(level, children) {
559
560
  };
560
561
  }
561
562
  function convertStringToRemirror(child) {
563
+ if (!child) {
564
+ return {
565
+ type: "text"
566
+ };
567
+ }
562
568
  return {
563
569
  type: "text",
564
570
  text: child
@@ -622,6 +628,9 @@ function convertParagraphToRemirror(children) {
622
628
  type: "paragraph",
623
629
  content: children.flatMap(function (child) {
624
630
  if (typeof child === "string") {
631
+ if (!child) {
632
+ return [];
633
+ }
625
634
  return [convertStringToRemirror(child)];
626
635
  }
627
636
  switch (child.tag) {
@@ -1642,7 +1651,9 @@ var Api = {
1642
1651
  status: zod.z.literal(200),
1643
1652
  json: zod.z.object({
1644
1653
  nonce: zod.z.string().nullable(),
1645
- baseUrl: zod.z.string()
1654
+ baseUrl: zod.z.string(),
1655
+ contentBaseUrl: zod.z.string().nullable(),
1656
+ contentAuthNonce: zod.z.string().nullable()
1646
1657
  })
1647
1658
  })])
1648
1659
  }
@@ -1672,6 +1683,7 @@ var Api = {
1672
1683
  req: {
1673
1684
  body: zod.z.object({
1674
1685
  parentRef: ParentRef,
1686
+ sessionId: zod.z.string().nullish(),
1675
1687
  patches: zod.z.array(zod.z.object({
1676
1688
  path: ModuleFilePath,
1677
1689
  patchId: PatchId,
@@ -1838,6 +1850,9 @@ var Api = {
1838
1850
  }
1839
1851
  },
1840
1852
  res: zod.z.union([unauthorizedResponse, zod.z.object({
1853
+ status: zod.z.literal(500),
1854
+ json: GenericError
1855
+ }), zod.z.object({
1841
1856
  status: zod.z.literal(200),
1842
1857
  json: zod.z.object({
1843
1858
  profiles: zod.z.array(zod.z.object({
@@ -1928,6 +1943,166 @@ var Api = {
1928
1943
  body: zod.z["instanceof"](ReadableStream)
1929
1944
  })])
1930
1945
  }
1946
+ },
1947
+ "/ai/initialize": {
1948
+ POST: {
1949
+ req: {
1950
+ cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
1951
+ },
1952
+ res: zod.z.union([unauthorizedResponse, zod.z.object({
1953
+ status: zod.z.literal(200),
1954
+ json: zod.z.object({
1955
+ nonce: zod.z.string(),
1956
+ wsUrl: zod.z.string()
1957
+ })
1958
+ }), zod.z.object({
1959
+ status: zod.z.literal(500),
1960
+ json: GenericError
1961
+ })])
1962
+ }
1963
+ },
1964
+ "/ai/sessions": {
1965
+ GET: {
1966
+ req: {
1967
+ query: {
1968
+ limit: onlyOneStringQueryParam.optional(),
1969
+ cursor_updatedAt: onlyOneStringQueryParam.optional(),
1970
+ cursor_id: onlyOneStringQueryParam.optional()
1971
+ },
1972
+ cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
1973
+ },
1974
+ res: zod.z.union([unauthorizedResponse, zod.z.object({
1975
+ status: zod.z.literal(200),
1976
+ json: zod.z.object({
1977
+ sessions: zod.z.array(zod.z.object({
1978
+ id: zod.z.string(),
1979
+ name: zod.z.string().nullable(),
1980
+ createdAt: zod.z.string(),
1981
+ updatedAt: zod.z.string()
1982
+ })),
1983
+ nextCursor: zod.z.object({
1984
+ updatedAt: zod.z.string(),
1985
+ id: zod.z.string()
1986
+ }).nullable().optional()
1987
+ })
1988
+ }), zod.z.object({
1989
+ status: zod.z.literal(500),
1990
+ json: GenericError
1991
+ })])
1992
+ },
1993
+ PATCH: {
1994
+ req: {
1995
+ path: zod.z.string(),
1996
+ body: zod.z.object({
1997
+ name: zod.z.string()
1998
+ }),
1999
+ cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
2000
+ },
2001
+ res: zod.z.union([unauthorizedResponse, zod.z.object({
2002
+ status: zod.z.literal(200),
2003
+ json: zod.z.object({})
2004
+ }), zod.z.object({
2005
+ status: zod.z.literal(500),
2006
+ json: GenericError
2007
+ })])
2008
+ }
2009
+ },
2010
+ "/ai/messages": {
2011
+ GET: {
2012
+ req: {
2013
+ path: zod.z.string(),
2014
+ query: {
2015
+ limit: onlyOneStringQueryParam.optional(),
2016
+ cursor_updatedAt: onlyOneStringQueryParam.optional(),
2017
+ cursor_id: onlyOneStringQueryParam.optional()
2018
+ },
2019
+ cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
2020
+ },
2021
+ res: zod.z.union([unauthorizedResponse, zod.z.object({
2022
+ status: zod.z.literal(200),
2023
+ json: zod.z.object({
2024
+ messages: zod.z.array(zod.z.object({
2025
+ role: zod.z.string(),
2026
+ content: zod.z.union([zod.z.string(), zod.z.array(zod.z.union([zod.z.object({
2027
+ type: zod.z.literal("text"),
2028
+ text: zod.z.string()
2029
+ }), zod.z.object({
2030
+ type: zod.z.literal("image_url"),
2031
+ url: zod.z.string()
2032
+ })]))])
2033
+ })),
2034
+ nextCursor: zod.z.object({
2035
+ updatedAt: zod.z.string(),
2036
+ id: zod.z.string()
2037
+ }).nullable().optional()
2038
+ })
2039
+ }), zod.z.object({
2040
+ status: zod.z.literal(500),
2041
+ json: GenericError
2042
+ })])
2043
+ }
2044
+ },
2045
+ "/ai/session-image-to-patch-file": {
2046
+ POST: {
2047
+ req: {
2048
+ body: zod.z.object({
2049
+ patchId: PatchId,
2050
+ parentRef: ParentRef,
2051
+ files: zod.z.array(zod.z.object({
2052
+ filePath: zod.z.string(),
2053
+ key: zod.z.string(),
2054
+ isRemote: zod.z["boolean"]().optional()
2055
+ })).min(1)
2056
+ }),
2057
+ cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
2058
+ },
2059
+ res: zod.z.union([unauthorizedResponse, zod.z.object({
2060
+ status: zod.z.literal(200),
2061
+ json: zod.z.object({
2062
+ patchId: PatchId,
2063
+ files: zod.z.array(zod.z.object({
2064
+ filePath: zod.z.string(),
2065
+ metadata: zod.z.object({
2066
+ width: zod.z.number(),
2067
+ height: zod.z.number(),
2068
+ mimeType: zod.z.string()
2069
+ })
2070
+ }))
2071
+ })
2072
+ }), zod.z.object({
2073
+ status: zod.z.literal(400),
2074
+ json: zod.z.object({
2075
+ message: zod.z.string(),
2076
+ details: zod.z.object({
2077
+ availableKeys: zod.z.array(zod.z.string()).optional()
2078
+ }).optional()
2079
+ })
2080
+ }), zod.z.object({
2081
+ status: zod.z.literal(500),
2082
+ json: GenericError
2083
+ })])
2084
+ }
2085
+ },
2086
+ "/ai/images": {
2087
+ PATCH: {
2088
+ req: {
2089
+ body: zod.z.object({
2090
+ key: zod.z.string(),
2091
+ metadata: zod.z.any(),
2092
+ contentType: zod.z.string()
2093
+ }),
2094
+ cookies: _defineProperty({}, VAL_SESSION_COOKIE, zod.z.string().optional())
2095
+ },
2096
+ res: zod.z.union([unauthorizedResponse, zod.z.object({
2097
+ status: zod.z.literal(200),
2098
+ json: zod.z.object({
2099
+ key: zod.z.string()
2100
+ })
2101
+ }), zod.z.object({
2102
+ status: zod.z.literal(500),
2103
+ json: GenericError
2104
+ })])
2105
+ }
1931
2106
  }
1932
2107
  };
1933
2108
 
@@ -2277,6 +2452,14 @@ var SharedValConfig = zod.z.object({
2277
2452
  ai: zod.z.object({
2278
2453
  commitMessages: zod.z.object({
2279
2454
  disabled: zod.z["boolean"]().optional()
2455
+ }).optional(),
2456
+ chat: zod.z.object({
2457
+ experimental: zod.z.object({
2458
+ enable: zod.z["boolean"]().optional()
2459
+ }).optional(),
2460
+ suggestions: zod.z.array(zod.z.string()).optional(),
2461
+ title: zod.z.string().optional(),
2462
+ description: zod.z.string().optional()
2280
2463
  }).optional()
2281
2464
  }).optional()
2282
2465
  });
@@ -2565,6 +2748,8 @@ function createRegExpFromPattern(pattern) {
2565
2748
 
2566
2749
  exports.Api = Api;
2567
2750
  exports.DEFAULT_ERROR_MESSAGE = DEFAULT_ERROR_MESSAGE;
2751
+ exports.FileOptions = FileOptions;
2752
+ exports.ImageOptions = ImageOptions;
2568
2753
  exports.ParentRef = ParentRef$1;
2569
2754
  exports.Patch = Patch;
2570
2755
  exports.PatchBlock = PatchBlock;
@@ -2581,6 +2766,22 @@ exports.RemirrorOrderedList = RemirrorOrderedList;
2581
2766
  exports.RemirrorParagraph = RemirrorParagraph;
2582
2767
  exports.RemirrorText = RemirrorText;
2583
2768
  exports.RemirrorTextMark = RemirrorTextMark;
2769
+ exports.RichTextOptions = RichTextOptions;
2770
+ exports.SerializedArraySchema = SerializedArraySchema;
2771
+ exports.SerializedBooleanSchema = SerializedBooleanSchema;
2772
+ exports.SerializedDateSchema = SerializedDateSchema;
2773
+ exports.SerializedFileSchema = SerializedFileSchema;
2774
+ exports.SerializedImageSchema = SerializedImageSchema;
2775
+ exports.SerializedKeyOfSchema = SerializedKeyOfSchema;
2776
+ exports.SerializedLiteralSchema = SerializedLiteralSchema;
2777
+ exports.SerializedNumberSchema = SerializedNumberSchema;
2778
+ exports.SerializedObjectSchema = SerializedObjectSchema;
2779
+ exports.SerializedRecordSchema = SerializedRecordSchema;
2780
+ exports.SerializedRichTextSchema = SerializedRichTextSchema;
2781
+ exports.SerializedRouteSchema = SerializedRouteSchema;
2782
+ exports.SerializedSchema = SerializedSchema;
2783
+ exports.SerializedStringSchema = SerializedStringSchema;
2784
+ exports.SerializedUnionSchema = SerializedUnionSchema;
2584
2785
  exports.SharedValConfig = SharedValConfig;
2585
2786
  exports.VAL_CONFIG_SESSION_STORAGE_KEY = VAL_CONFIG_SESSION_STORAGE_KEY;
2586
2787
  exports.VAL_ENABLE_COOKIE_NAME = VAL_ENABLE_COOKIE_NAME;
@@ -194,7 +194,8 @@ function convertParagraph(path, child, files, configDirectory, remoteOptions) {
194
194
  }
195
195
  function convertTextNode(node) {
196
196
  if (node.type === "text") {
197
- var _node$marks, _node$marks2;
197
+ var _node$text, _node$marks, _node$marks2;
198
+ var text = (_node$text = node.text) !== null && _node$text !== void 0 ? _node$text : "";
198
199
  var styles = ((_node$marks = node.marks) === null || _node$marks === void 0 ? void 0 : _node$marks.flatMap(function (mark) {
199
200
  if (mark.type !== "link") {
200
201
  if (mark.type === "strike") {
@@ -219,7 +220,7 @@ function convertTextNode(node) {
219
220
  children: [{
220
221
  tag: "span",
221
222
  styles: styles,
222
- children: [node.text]
223
+ children: [text]
223
224
  }]
224
225
  };
225
226
  }
@@ -228,17 +229,17 @@ function convertTextNode(node) {
228
229
  href: ((_node$marks$find2 = node.marks.find(function (mark) {
229
230
  return mark.type === "link";
230
231
  })) === null || _node$marks$find2 === void 0 ? void 0 : _node$marks$find2.attrs.href) || "",
231
- children: [node.text]
232
+ children: [text]
232
233
  };
233
234
  }
234
235
  if (styles.length > 0) {
235
236
  return {
236
237
  tag: "span",
237
238
  styles: styles,
238
- children: [node.text]
239
+ children: [text]
239
240
  };
240
241
  }
241
- return node.text;
242
+ return text;
242
243
  } else {
243
244
  var exhaustiveCheck = node.type;
244
245
  throw new Error("Unexpected node type: ".concat(exhaustiveCheck));
@@ -425,7 +426,7 @@ var RemirrorLinkMark = z.object({
425
426
  });
426
427
  var RemirrorText = z.intersection(z.object({
427
428
  type: z.literal("text"),
428
- text: z.string()
429
+ text: z.string().optional()
429
430
  }), z.object({
430
431
  marks: z.array(z.union([RemirrorTextMark, RemirrorLinkMark]))
431
432
  }).partial());
@@ -555,6 +556,11 @@ function convertHeadingToRemirror(level, children) {
555
556
  };
556
557
  }
557
558
  function convertStringToRemirror(child) {
559
+ if (!child) {
560
+ return {
561
+ type: "text"
562
+ };
563
+ }
558
564
  return {
559
565
  type: "text",
560
566
  text: child
@@ -618,6 +624,9 @@ function convertParagraphToRemirror(children) {
618
624
  type: "paragraph",
619
625
  content: children.flatMap(function (child) {
620
626
  if (typeof child === "string") {
627
+ if (!child) {
628
+ return [];
629
+ }
621
630
  return [convertStringToRemirror(child)];
622
631
  }
623
632
  switch (child.tag) {
@@ -1638,7 +1647,9 @@ var Api = {
1638
1647
  status: z.literal(200),
1639
1648
  json: z.object({
1640
1649
  nonce: z.string().nullable(),
1641
- baseUrl: z.string()
1650
+ baseUrl: z.string(),
1651
+ contentBaseUrl: z.string().nullable(),
1652
+ contentAuthNonce: z.string().nullable()
1642
1653
  })
1643
1654
  })])
1644
1655
  }
@@ -1668,6 +1679,7 @@ var Api = {
1668
1679
  req: {
1669
1680
  body: z.object({
1670
1681
  parentRef: ParentRef,
1682
+ sessionId: z.string().nullish(),
1671
1683
  patches: z.array(z.object({
1672
1684
  path: ModuleFilePath,
1673
1685
  patchId: PatchId,
@@ -1834,6 +1846,9 @@ var Api = {
1834
1846
  }
1835
1847
  },
1836
1848
  res: z.union([unauthorizedResponse, z.object({
1849
+ status: z.literal(500),
1850
+ json: GenericError
1851
+ }), z.object({
1837
1852
  status: z.literal(200),
1838
1853
  json: z.object({
1839
1854
  profiles: z.array(z.object({
@@ -1924,6 +1939,166 @@ var Api = {
1924
1939
  body: z["instanceof"](ReadableStream)
1925
1940
  })])
1926
1941
  }
1942
+ },
1943
+ "/ai/initialize": {
1944
+ POST: {
1945
+ req: {
1946
+ cookies: _defineProperty({}, VAL_SESSION_COOKIE, z.string().optional())
1947
+ },
1948
+ res: z.union([unauthorizedResponse, z.object({
1949
+ status: z.literal(200),
1950
+ json: z.object({
1951
+ nonce: z.string(),
1952
+ wsUrl: z.string()
1953
+ })
1954
+ }), z.object({
1955
+ status: z.literal(500),
1956
+ json: GenericError
1957
+ })])
1958
+ }
1959
+ },
1960
+ "/ai/sessions": {
1961
+ GET: {
1962
+ req: {
1963
+ query: {
1964
+ limit: onlyOneStringQueryParam.optional(),
1965
+ cursor_updatedAt: onlyOneStringQueryParam.optional(),
1966
+ cursor_id: onlyOneStringQueryParam.optional()
1967
+ },
1968
+ cookies: _defineProperty({}, VAL_SESSION_COOKIE, z.string().optional())
1969
+ },
1970
+ res: z.union([unauthorizedResponse, z.object({
1971
+ status: z.literal(200),
1972
+ json: z.object({
1973
+ sessions: z.array(z.object({
1974
+ id: z.string(),
1975
+ name: z.string().nullable(),
1976
+ createdAt: z.string(),
1977
+ updatedAt: z.string()
1978
+ })),
1979
+ nextCursor: z.object({
1980
+ updatedAt: z.string(),
1981
+ id: z.string()
1982
+ }).nullable().optional()
1983
+ })
1984
+ }), z.object({
1985
+ status: z.literal(500),
1986
+ json: GenericError
1987
+ })])
1988
+ },
1989
+ PATCH: {
1990
+ req: {
1991
+ path: z.string(),
1992
+ body: z.object({
1993
+ name: z.string()
1994
+ }),
1995
+ cookies: _defineProperty({}, VAL_SESSION_COOKIE, z.string().optional())
1996
+ },
1997
+ res: z.union([unauthorizedResponse, z.object({
1998
+ status: z.literal(200),
1999
+ json: z.object({})
2000
+ }), z.object({
2001
+ status: z.literal(500),
2002
+ json: GenericError
2003
+ })])
2004
+ }
2005
+ },
2006
+ "/ai/messages": {
2007
+ GET: {
2008
+ req: {
2009
+ path: z.string(),
2010
+ query: {
2011
+ limit: onlyOneStringQueryParam.optional(),
2012
+ cursor_updatedAt: onlyOneStringQueryParam.optional(),
2013
+ cursor_id: onlyOneStringQueryParam.optional()
2014
+ },
2015
+ cookies: _defineProperty({}, VAL_SESSION_COOKIE, z.string().optional())
2016
+ },
2017
+ res: z.union([unauthorizedResponse, z.object({
2018
+ status: z.literal(200),
2019
+ json: z.object({
2020
+ messages: z.array(z.object({
2021
+ role: z.string(),
2022
+ content: z.union([z.string(), z.array(z.union([z.object({
2023
+ type: z.literal("text"),
2024
+ text: z.string()
2025
+ }), z.object({
2026
+ type: z.literal("image_url"),
2027
+ url: z.string()
2028
+ })]))])
2029
+ })),
2030
+ nextCursor: z.object({
2031
+ updatedAt: z.string(),
2032
+ id: z.string()
2033
+ }).nullable().optional()
2034
+ })
2035
+ }), z.object({
2036
+ status: z.literal(500),
2037
+ json: GenericError
2038
+ })])
2039
+ }
2040
+ },
2041
+ "/ai/session-image-to-patch-file": {
2042
+ POST: {
2043
+ req: {
2044
+ body: z.object({
2045
+ patchId: PatchId,
2046
+ parentRef: ParentRef,
2047
+ files: z.array(z.object({
2048
+ filePath: z.string(),
2049
+ key: z.string(),
2050
+ isRemote: z["boolean"]().optional()
2051
+ })).min(1)
2052
+ }),
2053
+ cookies: _defineProperty({}, VAL_SESSION_COOKIE, z.string().optional())
2054
+ },
2055
+ res: z.union([unauthorizedResponse, z.object({
2056
+ status: z.literal(200),
2057
+ json: z.object({
2058
+ patchId: PatchId,
2059
+ files: z.array(z.object({
2060
+ filePath: z.string(),
2061
+ metadata: z.object({
2062
+ width: z.number(),
2063
+ height: z.number(),
2064
+ mimeType: z.string()
2065
+ })
2066
+ }))
2067
+ })
2068
+ }), z.object({
2069
+ status: z.literal(400),
2070
+ json: z.object({
2071
+ message: z.string(),
2072
+ details: z.object({
2073
+ availableKeys: z.array(z.string()).optional()
2074
+ }).optional()
2075
+ })
2076
+ }), z.object({
2077
+ status: z.literal(500),
2078
+ json: GenericError
2079
+ })])
2080
+ }
2081
+ },
2082
+ "/ai/images": {
2083
+ PATCH: {
2084
+ req: {
2085
+ body: z.object({
2086
+ key: z.string(),
2087
+ metadata: z.any(),
2088
+ contentType: z.string()
2089
+ }),
2090
+ cookies: _defineProperty({}, VAL_SESSION_COOKIE, z.string().optional())
2091
+ },
2092
+ res: z.union([unauthorizedResponse, z.object({
2093
+ status: z.literal(200),
2094
+ json: z.object({
2095
+ key: z.string()
2096
+ })
2097
+ }), z.object({
2098
+ status: z.literal(500),
2099
+ json: GenericError
2100
+ })])
2101
+ }
1927
2102
  }
1928
2103
  };
1929
2104
 
@@ -2273,6 +2448,14 @@ var SharedValConfig = z.object({
2273
2448
  ai: z.object({
2274
2449
  commitMessages: z.object({
2275
2450
  disabled: z["boolean"]().optional()
2451
+ }).optional(),
2452
+ chat: z.object({
2453
+ experimental: z.object({
2454
+ enable: z["boolean"]().optional()
2455
+ }).optional(),
2456
+ suggestions: z.array(z.string()).optional(),
2457
+ title: z.string().optional(),
2458
+ description: z.string().optional()
2276
2459
  }).optional()
2277
2460
  }).optional()
2278
2461
  });
@@ -2559,4 +2742,4 @@ function createRegExpFromPattern(pattern) {
2559
2742
  }
2560
2743
  }
2561
2744
 
2562
- export { Api, DEFAULT_ERROR_MESSAGE, ParentRef$1 as ParentRef, Patch, PatchBlock, PatchId, PatchJSON, RemirrorBr, RemirrorBulletList, RemirrorHeading, RemirrorImage, RemirrorJSON, RemirrorLinkMark, RemirrorListItem, RemirrorOrderedList, RemirrorParagraph, RemirrorText, RemirrorTextMark, SharedValConfig, VAL_CONFIG_SESSION_STORAGE_KEY, VAL_ENABLE_COOKIE_NAME, VAL_SESSION_COOKIE, VAL_STATE_COOKIE, VAL_THEME_SESSION_STORAGE_KEY, ValCommit, ValDeployment, createRegExpFromPattern, createValClient, filterRoutesByPatterns, getErrorMessageFromUnknownJson, getNextAppRouterSitemapTree, getNextAppRouterSourceFolder, getPatternFromModuleFilePath, parseRoutePattern, remirrorToRichTextSource, richTextToRemirror, urlOf, validateRoutePatterns };
2745
+ export { Api, DEFAULT_ERROR_MESSAGE, FileOptions, ImageOptions, ParentRef$1 as ParentRef, Patch, PatchBlock, PatchId, PatchJSON, RemirrorBr, RemirrorBulletList, RemirrorHeading, RemirrorImage, RemirrorJSON, RemirrorLinkMark, RemirrorListItem, RemirrorOrderedList, RemirrorParagraph, RemirrorText, RemirrorTextMark, RichTextOptions, SerializedArraySchema, SerializedBooleanSchema, SerializedDateSchema, SerializedFileSchema, SerializedImageSchema, SerializedKeyOfSchema, SerializedLiteralSchema, SerializedNumberSchema, SerializedObjectSchema, SerializedRecordSchema, SerializedRichTextSchema, SerializedRouteSchema, SerializedSchema, SerializedStringSchema, SerializedUnionSchema, SharedValConfig, VAL_CONFIG_SESSION_STORAGE_KEY, VAL_ENABLE_COOKIE_NAME, VAL_SESSION_COOKIE, VAL_STATE_COOKIE, VAL_THEME_SESSION_STORAGE_KEY, ValCommit, ValDeployment, createRegExpFromPattern, createValClient, filterRoutesByPatterns, getErrorMessageFromUnknownJson, getNextAppRouterSitemapTree, getNextAppRouterSourceFolder, getPatternFromModuleFilePath, parseRoutePattern, remirrorToRichTextSource, richTextToRemirror, urlOf, validateRoutePatterns };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valbuild/shared",
3
- "version": "0.94.0",
3
+ "version": "0.96.0",
4
4
  "private": false,
5
5
  "description": "Val shared types and utilities",
6
6
  "repository": {
@@ -31,7 +31,7 @@
31
31
  "dependencies": {
32
32
  "zod": "^4.3.5",
33
33
  "zod-validation-error": "^5.0.0",
34
- "@valbuild/core": "0.94.0"
34
+ "@valbuild/core": "0.96.0"
35
35
  },
36
36
  "files": [
37
37
  "dist",