weave-typescript 0.29.0 → 0.30.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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
|
|
2
|
+
import { SourceLocation } from "../../ingestion/v1/ingestion.pb";
|
|
2
3
|
export declare const protobufPackage = "weaveapi.chat.v1";
|
|
3
4
|
export declare enum ChatMessageRole {
|
|
4
5
|
CHAT_MESSAGE_ROLE_UNSPECIFIED = 0,
|
|
@@ -37,6 +38,7 @@ export declare enum ChatArtifactKind {
|
|
|
37
38
|
CHAT_ARTIFACT_KIND_HTML = 2,
|
|
38
39
|
CHAT_ARTIFACT_KIND_PLAINTEXT = 3,
|
|
39
40
|
CHAT_ARTIFACT_KIND_CODE = 4,
|
|
41
|
+
CHAT_ARTIFACT_KIND_DOCUMENT_REFERENCE = 5,
|
|
40
42
|
UNRECOGNIZED = -1
|
|
41
43
|
}
|
|
42
44
|
export declare function chatArtifactKindFromJSON(object: any): ChatArtifactKind;
|
|
@@ -88,6 +90,14 @@ export interface ChatArtifactVersion {
|
|
|
88
90
|
content: string;
|
|
89
91
|
createdByMessageId: string;
|
|
90
92
|
createdAt: Date | undefined;
|
|
93
|
+
documentReferences: ChatDocumentReference[];
|
|
94
|
+
}
|
|
95
|
+
export interface ChatDocumentReference {
|
|
96
|
+
documentId: string;
|
|
97
|
+
documentName: string;
|
|
98
|
+
mimeType: string;
|
|
99
|
+
threadIds: string[];
|
|
100
|
+
sourceLocations: SourceLocation[];
|
|
91
101
|
}
|
|
92
102
|
export interface ChatEphemeralAttachment {
|
|
93
103
|
mimeType: string;
|
|
@@ -168,6 +178,7 @@ export declare const ChatSession: MessageFns<ChatSession>;
|
|
|
168
178
|
export declare const ChatMessage: MessageFns<ChatMessage>;
|
|
169
179
|
export declare const ChatArtifact: MessageFns<ChatArtifact>;
|
|
170
180
|
export declare const ChatArtifactVersion: MessageFns<ChatArtifactVersion>;
|
|
181
|
+
export declare const ChatDocumentReference: MessageFns<ChatDocumentReference>;
|
|
171
182
|
export declare const ChatEphemeralAttachment: MessageFns<ChatEphemeralAttachment>;
|
|
172
183
|
export declare const ChatStreamFrame: MessageFns<ChatStreamFrame>;
|
|
173
184
|
export declare const ChatStreamFrame_MessageStarted: MessageFns<ChatStreamFrame_MessageStarted>;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// protoc unknown
|
|
6
6
|
// source: weaveapi/chat/v1/chat.proto
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.ChatStreamFrame_MessageError = exports.ChatStreamFrame_MessageComplete = exports.ChatStreamFrame_ArtifactUpdated = exports.ChatStreamFrame_ArtifactCreated = exports.ChatStreamFrame_ToolCallRejected = exports.ChatStreamFrame_ToolCallResult = exports.ChatStreamFrame_ToolCallExecuting = exports.ChatStreamFrame_ToolCallProposed = exports.ChatStreamFrame_MessageDelta = exports.ChatStreamFrame_MessageStarted = exports.ChatStreamFrame = exports.ChatEphemeralAttachment = exports.ChatArtifactVersion = exports.ChatArtifact = exports.ChatMessage = exports.ChatSession = exports.ChatArtifactKind = exports.ChatStreamState = exports.ChatToolCallState = exports.ChatMessageRole = exports.protobufPackage = void 0;
|
|
8
|
+
exports.ChatStreamFrame_MessageError = exports.ChatStreamFrame_MessageComplete = exports.ChatStreamFrame_ArtifactUpdated = exports.ChatStreamFrame_ArtifactCreated = exports.ChatStreamFrame_ToolCallRejected = exports.ChatStreamFrame_ToolCallResult = exports.ChatStreamFrame_ToolCallExecuting = exports.ChatStreamFrame_ToolCallProposed = exports.ChatStreamFrame_MessageDelta = exports.ChatStreamFrame_MessageStarted = exports.ChatStreamFrame = exports.ChatEphemeralAttachment = exports.ChatDocumentReference = exports.ChatArtifactVersion = exports.ChatArtifact = exports.ChatMessage = exports.ChatSession = exports.ChatArtifactKind = exports.ChatStreamState = exports.ChatToolCallState = exports.ChatMessageRole = exports.protobufPackage = void 0;
|
|
9
9
|
exports.chatMessageRoleFromJSON = chatMessageRoleFromJSON;
|
|
10
10
|
exports.chatMessageRoleToJSON = chatMessageRoleToJSON;
|
|
11
11
|
exports.chatToolCallStateFromJSON = chatToolCallStateFromJSON;
|
|
@@ -18,6 +18,7 @@ exports.chatArtifactKindToJSON = chatArtifactKindToJSON;
|
|
|
18
18
|
const wire_1 = require("@bufbuild/protobuf/wire");
|
|
19
19
|
const struct_pb_1 = require("../../../google/protobuf/struct.pb");
|
|
20
20
|
const timestamp_pb_1 = require("../../../google/protobuf/timestamp.pb");
|
|
21
|
+
const ingestion_pb_1 = require("../../ingestion/v1/ingestion.pb");
|
|
21
22
|
exports.protobufPackage = "weaveapi.chat.v1";
|
|
22
23
|
var ChatMessageRole;
|
|
23
24
|
(function (ChatMessageRole) {
|
|
@@ -179,6 +180,7 @@ var ChatArtifactKind;
|
|
|
179
180
|
ChatArtifactKind[ChatArtifactKind["CHAT_ARTIFACT_KIND_HTML"] = 2] = "CHAT_ARTIFACT_KIND_HTML";
|
|
180
181
|
ChatArtifactKind[ChatArtifactKind["CHAT_ARTIFACT_KIND_PLAINTEXT"] = 3] = "CHAT_ARTIFACT_KIND_PLAINTEXT";
|
|
181
182
|
ChatArtifactKind[ChatArtifactKind["CHAT_ARTIFACT_KIND_CODE"] = 4] = "CHAT_ARTIFACT_KIND_CODE";
|
|
183
|
+
ChatArtifactKind[ChatArtifactKind["CHAT_ARTIFACT_KIND_DOCUMENT_REFERENCE"] = 5] = "CHAT_ARTIFACT_KIND_DOCUMENT_REFERENCE";
|
|
182
184
|
ChatArtifactKind[ChatArtifactKind["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
|
|
183
185
|
})(ChatArtifactKind || (exports.ChatArtifactKind = ChatArtifactKind = {}));
|
|
184
186
|
function chatArtifactKindFromJSON(object) {
|
|
@@ -198,6 +200,9 @@ function chatArtifactKindFromJSON(object) {
|
|
|
198
200
|
case 4:
|
|
199
201
|
case "CHAT_ARTIFACT_KIND_CODE":
|
|
200
202
|
return ChatArtifactKind.CHAT_ARTIFACT_KIND_CODE;
|
|
203
|
+
case 5:
|
|
204
|
+
case "CHAT_ARTIFACT_KIND_DOCUMENT_REFERENCE":
|
|
205
|
+
return ChatArtifactKind.CHAT_ARTIFACT_KIND_DOCUMENT_REFERENCE;
|
|
201
206
|
case -1:
|
|
202
207
|
case "UNRECOGNIZED":
|
|
203
208
|
default:
|
|
@@ -216,6 +221,8 @@ function chatArtifactKindToJSON(object) {
|
|
|
216
221
|
return "CHAT_ARTIFACT_KIND_PLAINTEXT";
|
|
217
222
|
case ChatArtifactKind.CHAT_ARTIFACT_KIND_CODE:
|
|
218
223
|
return "CHAT_ARTIFACT_KIND_CODE";
|
|
224
|
+
case ChatArtifactKind.CHAT_ARTIFACT_KIND_DOCUMENT_REFERENCE:
|
|
225
|
+
return "CHAT_ARTIFACT_KIND_DOCUMENT_REFERENCE";
|
|
219
226
|
case ChatArtifactKind.UNRECOGNIZED:
|
|
220
227
|
default:
|
|
221
228
|
return "UNRECOGNIZED";
|
|
@@ -950,7 +957,15 @@ exports.ChatArtifact = {
|
|
|
950
957
|
},
|
|
951
958
|
};
|
|
952
959
|
function createBaseChatArtifactVersion() {
|
|
953
|
-
return {
|
|
960
|
+
return {
|
|
961
|
+
id: "",
|
|
962
|
+
artifactId: "",
|
|
963
|
+
version: 0,
|
|
964
|
+
content: "",
|
|
965
|
+
createdByMessageId: "",
|
|
966
|
+
createdAt: undefined,
|
|
967
|
+
documentReferences: [],
|
|
968
|
+
};
|
|
954
969
|
}
|
|
955
970
|
exports.ChatArtifactVersion = {
|
|
956
971
|
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
@@ -972,6 +987,9 @@ exports.ChatArtifactVersion = {
|
|
|
972
987
|
if (message.createdAt !== undefined) {
|
|
973
988
|
timestamp_pb_1.Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(50).fork()).join();
|
|
974
989
|
}
|
|
990
|
+
for (const v of message.documentReferences) {
|
|
991
|
+
exports.ChatDocumentReference.encode(v, writer.uint32(58).fork()).join();
|
|
992
|
+
}
|
|
975
993
|
return writer;
|
|
976
994
|
},
|
|
977
995
|
decode(input, length) {
|
|
@@ -1023,6 +1041,13 @@ exports.ChatArtifactVersion = {
|
|
|
1023
1041
|
message.createdAt = fromTimestamp(timestamp_pb_1.Timestamp.decode(reader, reader.uint32()));
|
|
1024
1042
|
continue;
|
|
1025
1043
|
}
|
|
1044
|
+
case 7: {
|
|
1045
|
+
if (tag !== 58) {
|
|
1046
|
+
break;
|
|
1047
|
+
}
|
|
1048
|
+
message.documentReferences.push(exports.ChatDocumentReference.decode(reader, reader.uint32()));
|
|
1049
|
+
continue;
|
|
1050
|
+
}
|
|
1026
1051
|
}
|
|
1027
1052
|
if ((tag & 7) === 4 || tag === 0) {
|
|
1028
1053
|
break;
|
|
@@ -1051,9 +1076,15 @@ exports.ChatArtifactVersion = {
|
|
|
1051
1076
|
: isSet(object.created_at)
|
|
1052
1077
|
? fromJsonTimestamp(object.created_at)
|
|
1053
1078
|
: undefined,
|
|
1079
|
+
documentReferences: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.documentReferences)
|
|
1080
|
+
? object.documentReferences.map((e) => exports.ChatDocumentReference.fromJSON(e))
|
|
1081
|
+
: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.document_references)
|
|
1082
|
+
? object.document_references.map((e) => exports.ChatDocumentReference.fromJSON(e))
|
|
1083
|
+
: [],
|
|
1054
1084
|
};
|
|
1055
1085
|
},
|
|
1056
1086
|
toJSON(message) {
|
|
1087
|
+
var _a;
|
|
1057
1088
|
const obj = {};
|
|
1058
1089
|
if (message.id !== "") {
|
|
1059
1090
|
obj.id = message.id;
|
|
@@ -1073,20 +1104,161 @@ exports.ChatArtifactVersion = {
|
|
|
1073
1104
|
if (message.createdAt !== undefined) {
|
|
1074
1105
|
obj.createdAt = message.createdAt.toISOString();
|
|
1075
1106
|
}
|
|
1107
|
+
if ((_a = message.documentReferences) === null || _a === void 0 ? void 0 : _a.length) {
|
|
1108
|
+
obj.documentReferences = message.documentReferences.map((e) => exports.ChatDocumentReference.toJSON(e));
|
|
1109
|
+
}
|
|
1076
1110
|
return obj;
|
|
1077
1111
|
},
|
|
1078
1112
|
create(base) {
|
|
1079
1113
|
return exports.ChatArtifactVersion.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
1080
1114
|
},
|
|
1081
1115
|
fromPartial(object) {
|
|
1082
|
-
var _a
|
|
1116
|
+
var _a;
|
|
1117
|
+
var _b, _c, _d, _e, _f, _g;
|
|
1083
1118
|
const message = createBaseChatArtifactVersion();
|
|
1084
|
-
message.id = (
|
|
1085
|
-
message.artifactId = (
|
|
1086
|
-
message.version = (
|
|
1087
|
-
message.content = (
|
|
1088
|
-
message.createdByMessageId = (
|
|
1089
|
-
message.createdAt = (
|
|
1119
|
+
message.id = (_b = object.id) !== null && _b !== void 0 ? _b : "";
|
|
1120
|
+
message.artifactId = (_c = object.artifactId) !== null && _c !== void 0 ? _c : "";
|
|
1121
|
+
message.version = (_d = object.version) !== null && _d !== void 0 ? _d : 0;
|
|
1122
|
+
message.content = (_e = object.content) !== null && _e !== void 0 ? _e : "";
|
|
1123
|
+
message.createdByMessageId = (_f = object.createdByMessageId) !== null && _f !== void 0 ? _f : "";
|
|
1124
|
+
message.createdAt = (_g = object.createdAt) !== null && _g !== void 0 ? _g : undefined;
|
|
1125
|
+
message.documentReferences = ((_a = object.documentReferences) === null || _a === void 0 ? void 0 : _a.map((e) => exports.ChatDocumentReference.fromPartial(e))) || [];
|
|
1126
|
+
return message;
|
|
1127
|
+
},
|
|
1128
|
+
};
|
|
1129
|
+
function createBaseChatDocumentReference() {
|
|
1130
|
+
return { documentId: "", documentName: "", mimeType: "", threadIds: [], sourceLocations: [] };
|
|
1131
|
+
}
|
|
1132
|
+
exports.ChatDocumentReference = {
|
|
1133
|
+
encode(message, writer = new wire_1.BinaryWriter()) {
|
|
1134
|
+
if (message.documentId !== "") {
|
|
1135
|
+
writer.uint32(10).string(message.documentId);
|
|
1136
|
+
}
|
|
1137
|
+
if (message.documentName !== "") {
|
|
1138
|
+
writer.uint32(18).string(message.documentName);
|
|
1139
|
+
}
|
|
1140
|
+
if (message.mimeType !== "") {
|
|
1141
|
+
writer.uint32(26).string(message.mimeType);
|
|
1142
|
+
}
|
|
1143
|
+
for (const v of message.threadIds) {
|
|
1144
|
+
writer.uint32(34).string(v);
|
|
1145
|
+
}
|
|
1146
|
+
for (const v of message.sourceLocations) {
|
|
1147
|
+
ingestion_pb_1.SourceLocation.encode(v, writer.uint32(42).fork()).join();
|
|
1148
|
+
}
|
|
1149
|
+
return writer;
|
|
1150
|
+
},
|
|
1151
|
+
decode(input, length) {
|
|
1152
|
+
const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
|
|
1153
|
+
const end = length === undefined ? reader.len : reader.pos + length;
|
|
1154
|
+
const message = createBaseChatDocumentReference();
|
|
1155
|
+
while (reader.pos < end) {
|
|
1156
|
+
const tag = reader.uint32();
|
|
1157
|
+
switch (tag >>> 3) {
|
|
1158
|
+
case 1: {
|
|
1159
|
+
if (tag !== 10) {
|
|
1160
|
+
break;
|
|
1161
|
+
}
|
|
1162
|
+
message.documentId = reader.string();
|
|
1163
|
+
continue;
|
|
1164
|
+
}
|
|
1165
|
+
case 2: {
|
|
1166
|
+
if (tag !== 18) {
|
|
1167
|
+
break;
|
|
1168
|
+
}
|
|
1169
|
+
message.documentName = reader.string();
|
|
1170
|
+
continue;
|
|
1171
|
+
}
|
|
1172
|
+
case 3: {
|
|
1173
|
+
if (tag !== 26) {
|
|
1174
|
+
break;
|
|
1175
|
+
}
|
|
1176
|
+
message.mimeType = reader.string();
|
|
1177
|
+
continue;
|
|
1178
|
+
}
|
|
1179
|
+
case 4: {
|
|
1180
|
+
if (tag !== 34) {
|
|
1181
|
+
break;
|
|
1182
|
+
}
|
|
1183
|
+
message.threadIds.push(reader.string());
|
|
1184
|
+
continue;
|
|
1185
|
+
}
|
|
1186
|
+
case 5: {
|
|
1187
|
+
if (tag !== 42) {
|
|
1188
|
+
break;
|
|
1189
|
+
}
|
|
1190
|
+
message.sourceLocations.push(ingestion_pb_1.SourceLocation.decode(reader, reader.uint32()));
|
|
1191
|
+
continue;
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
if ((tag & 7) === 4 || tag === 0) {
|
|
1195
|
+
break;
|
|
1196
|
+
}
|
|
1197
|
+
reader.skip(tag & 7);
|
|
1198
|
+
}
|
|
1199
|
+
return message;
|
|
1200
|
+
},
|
|
1201
|
+
fromJSON(object) {
|
|
1202
|
+
return {
|
|
1203
|
+
documentId: isSet(object.documentId)
|
|
1204
|
+
? globalThis.String(object.documentId)
|
|
1205
|
+
: isSet(object.document_id)
|
|
1206
|
+
? globalThis.String(object.document_id)
|
|
1207
|
+
: "",
|
|
1208
|
+
documentName: isSet(object.documentName)
|
|
1209
|
+
? globalThis.String(object.documentName)
|
|
1210
|
+
: isSet(object.document_name)
|
|
1211
|
+
? globalThis.String(object.document_name)
|
|
1212
|
+
: "",
|
|
1213
|
+
mimeType: isSet(object.mimeType)
|
|
1214
|
+
? globalThis.String(object.mimeType)
|
|
1215
|
+
: isSet(object.mime_type)
|
|
1216
|
+
? globalThis.String(object.mime_type)
|
|
1217
|
+
: "",
|
|
1218
|
+
threadIds: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.threadIds)
|
|
1219
|
+
? object.threadIds.map((e) => globalThis.String(e))
|
|
1220
|
+
: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.thread_ids)
|
|
1221
|
+
? object.thread_ids.map((e) => globalThis.String(e))
|
|
1222
|
+
: [],
|
|
1223
|
+
sourceLocations: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.sourceLocations)
|
|
1224
|
+
? object.sourceLocations.map((e) => ingestion_pb_1.SourceLocation.fromJSON(e))
|
|
1225
|
+
: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.source_locations)
|
|
1226
|
+
? object.source_locations.map((e) => ingestion_pb_1.SourceLocation.fromJSON(e))
|
|
1227
|
+
: [],
|
|
1228
|
+
};
|
|
1229
|
+
},
|
|
1230
|
+
toJSON(message) {
|
|
1231
|
+
var _a, _b;
|
|
1232
|
+
const obj = {};
|
|
1233
|
+
if (message.documentId !== "") {
|
|
1234
|
+
obj.documentId = message.documentId;
|
|
1235
|
+
}
|
|
1236
|
+
if (message.documentName !== "") {
|
|
1237
|
+
obj.documentName = message.documentName;
|
|
1238
|
+
}
|
|
1239
|
+
if (message.mimeType !== "") {
|
|
1240
|
+
obj.mimeType = message.mimeType;
|
|
1241
|
+
}
|
|
1242
|
+
if ((_a = message.threadIds) === null || _a === void 0 ? void 0 : _a.length) {
|
|
1243
|
+
obj.threadIds = message.threadIds;
|
|
1244
|
+
}
|
|
1245
|
+
if ((_b = message.sourceLocations) === null || _b === void 0 ? void 0 : _b.length) {
|
|
1246
|
+
obj.sourceLocations = message.sourceLocations.map((e) => ingestion_pb_1.SourceLocation.toJSON(e));
|
|
1247
|
+
}
|
|
1248
|
+
return obj;
|
|
1249
|
+
},
|
|
1250
|
+
create(base) {
|
|
1251
|
+
return exports.ChatDocumentReference.fromPartial(base !== null && base !== void 0 ? base : {});
|
|
1252
|
+
},
|
|
1253
|
+
fromPartial(object) {
|
|
1254
|
+
var _a, _b;
|
|
1255
|
+
var _c, _d, _e;
|
|
1256
|
+
const message = createBaseChatDocumentReference();
|
|
1257
|
+
message.documentId = (_c = object.documentId) !== null && _c !== void 0 ? _c : "";
|
|
1258
|
+
message.documentName = (_d = object.documentName) !== null && _d !== void 0 ? _d : "";
|
|
1259
|
+
message.mimeType = (_e = object.mimeType) !== null && _e !== void 0 ? _e : "";
|
|
1260
|
+
message.threadIds = ((_a = object.threadIds) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || [];
|
|
1261
|
+
message.sourceLocations = ((_b = object.sourceLocations) === null || _b === void 0 ? void 0 : _b.map((e) => ingestion_pb_1.SourceLocation.fromPartial(e))) || [];
|
|
1090
1262
|
return message;
|
|
1091
1263
|
},
|
|
1092
1264
|
};
|
|
@@ -424,7 +424,7 @@ export interface GetChatArtifactRow {
|
|
|
424
424
|
updatedAt: Date;
|
|
425
425
|
}
|
|
426
426
|
export declare function getChatArtifact(client: Client, args: GetChatArtifactArgs): Promise<GetChatArtifactRow | null>;
|
|
427
|
-
export declare const insertChatArtifactVersionQuery = "-- name: InsertChatArtifactVersion :one\nINSERT INTO weave.chat_artifact_versions (\n id, artifact_id, version, content, created_by_message_id\n) VALUES ($1, $2, $3, $4, $5)\nRETURNING id, artifact_id, version, content, created_by_message_id, created_at";
|
|
427
|
+
export declare const insertChatArtifactVersionQuery = "-- name: InsertChatArtifactVersion :one\nINSERT INTO weave.chat_artifact_versions (\n id, artifact_id, version, content, created_by_message_id\n) VALUES ($1, $2, $3, $4, $5)\nRETURNING id, artifact_id, version, content, created_by_message_id, created_at, document_references";
|
|
428
428
|
export interface InsertChatArtifactVersionArgs {
|
|
429
429
|
id: string;
|
|
430
430
|
artifactId: string;
|
|
@@ -439,9 +439,29 @@ export interface InsertChatArtifactVersionRow {
|
|
|
439
439
|
content: string;
|
|
440
440
|
createdByMessageId: string;
|
|
441
441
|
createdAt: Date;
|
|
442
|
+
documentReferences: any;
|
|
442
443
|
}
|
|
443
444
|
export declare function insertChatArtifactVersion(client: Client, args: InsertChatArtifactVersionArgs): Promise<InsertChatArtifactVersionRow | null>;
|
|
444
|
-
export declare const
|
|
445
|
+
export declare const insertChatArtifactVersionWithDocumentReferencesQuery = "-- name: InsertChatArtifactVersionWithDocumentReferences :one\nINSERT INTO weave.chat_artifact_versions (\n id, artifact_id, version, content, created_by_message_id, document_references\n) VALUES ($1, $2, $3, $4, $5, $6)\nRETURNING id, artifact_id, version, content, created_by_message_id, created_at, document_references";
|
|
446
|
+
export interface InsertChatArtifactVersionWithDocumentReferencesArgs {
|
|
447
|
+
id: string;
|
|
448
|
+
artifactId: string;
|
|
449
|
+
version: number;
|
|
450
|
+
content: string;
|
|
451
|
+
createdByMessageId: string;
|
|
452
|
+
documentReferences: any;
|
|
453
|
+
}
|
|
454
|
+
export interface InsertChatArtifactVersionWithDocumentReferencesRow {
|
|
455
|
+
id: string;
|
|
456
|
+
artifactId: string;
|
|
457
|
+
version: number;
|
|
458
|
+
content: string;
|
|
459
|
+
createdByMessageId: string;
|
|
460
|
+
createdAt: Date;
|
|
461
|
+
documentReferences: any;
|
|
462
|
+
}
|
|
463
|
+
export declare function insertChatArtifactVersionWithDocumentReferences(client: Client, args: InsertChatArtifactVersionWithDocumentReferencesArgs): Promise<InsertChatArtifactVersionWithDocumentReferencesRow | null>;
|
|
464
|
+
export declare const getChatArtifactVersionQuery = "-- name: GetChatArtifactVersion :one\nSELECT id, artifact_id, version, content, created_by_message_id, created_at, document_references FROM weave.chat_artifact_versions\nWHERE artifact_id = $1 AND version = $2";
|
|
445
465
|
export interface GetChatArtifactVersionArgs {
|
|
446
466
|
artifactId: string;
|
|
447
467
|
version: number;
|
|
@@ -453,9 +473,10 @@ export interface GetChatArtifactVersionRow {
|
|
|
453
473
|
content: string;
|
|
454
474
|
createdByMessageId: string;
|
|
455
475
|
createdAt: Date;
|
|
476
|
+
documentReferences: any;
|
|
456
477
|
}
|
|
457
478
|
export declare function getChatArtifactVersion(client: Client, args: GetChatArtifactVersionArgs): Promise<GetChatArtifactVersionRow | null>;
|
|
458
|
-
export declare const listChatArtifactVersionsQuery = "-- name: ListChatArtifactVersions :many\nSELECT id, artifact_id, version, content, created_by_message_id, created_at FROM weave.chat_artifact_versions\nWHERE artifact_id = $1\nORDER BY version";
|
|
479
|
+
export declare const listChatArtifactVersionsQuery = "-- name: ListChatArtifactVersions :many\nSELECT id, artifact_id, version, content, created_by_message_id, created_at, document_references FROM weave.chat_artifact_versions\nWHERE artifact_id = $1\nORDER BY version";
|
|
459
480
|
export interface ListChatArtifactVersionsArgs {
|
|
460
481
|
artifactId: string;
|
|
461
482
|
}
|
|
@@ -466,6 +487,7 @@ export interface ListChatArtifactVersionsRow {
|
|
|
466
487
|
content: string;
|
|
467
488
|
createdByMessageId: string;
|
|
468
489
|
createdAt: Date;
|
|
490
|
+
documentReferences: any;
|
|
469
491
|
}
|
|
470
492
|
export declare function listChatArtifactVersions(client: Client, args: ListChatArtifactVersionsArgs): Promise<ListChatArtifactVersionsRow[]>;
|
|
471
493
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.listChatArtifactVersionsQuery = exports.getChatArtifactVersionQuery = exports.insertChatArtifactVersionQuery = exports.getChatArtifactQuery = exports.listChatArtifactsForSessionQuery = exports.bumpChatArtifactVersionQuery = exports.createChatArtifactQuery = exports.clearOrganizationChatSettingsDefaultIfMatchesQuery = exports.getOrganizationChatSettingsQuery = exports.upsertOrganizationChatSettingsQuery = exports.getOrganizationApprovedModelQuery = exports.listOrganizationApprovedModelsQuery = exports.deleteOrganizationApprovedModelQuery = exports.createOrganizationApprovedModelQuery = exports.completeChatMessageQuery = exports.updateChatMessageToolCallStateQuery = exports.listChatMessagesForSessionQuery = exports.getChatMessageQuery = exports.insertChatMessageQuery = exports.listProjectsForChatSessionQuery = exports.detachProjectFromChatSessionQuery = exports.attachProjectToChatSessionQuery = exports.softDeleteChatSessionQuery = exports.touchChatSessionLastMessageQuery = exports.updateChatSessionTitleQuery = exports.updateChatSessionModelQuery = exports.listChatSessionsForUserByProjectQuery = exports.listChatSessionsForUserQuery = exports.getChatSessionQuery = exports.createChatSessionQuery = void 0;
|
|
3
|
+
exports.listChatArtifactVersionsQuery = exports.getChatArtifactVersionQuery = exports.insertChatArtifactVersionWithDocumentReferencesQuery = exports.insertChatArtifactVersionQuery = exports.getChatArtifactQuery = exports.listChatArtifactsForSessionQuery = exports.bumpChatArtifactVersionQuery = exports.createChatArtifactQuery = exports.clearOrganizationChatSettingsDefaultIfMatchesQuery = exports.getOrganizationChatSettingsQuery = exports.upsertOrganizationChatSettingsQuery = exports.getOrganizationApprovedModelQuery = exports.listOrganizationApprovedModelsQuery = exports.deleteOrganizationApprovedModelQuery = exports.createOrganizationApprovedModelQuery = exports.completeChatMessageQuery = exports.updateChatMessageToolCallStateQuery = exports.listChatMessagesForSessionQuery = exports.getChatMessageQuery = exports.insertChatMessageQuery = exports.listProjectsForChatSessionQuery = exports.detachProjectFromChatSessionQuery = exports.attachProjectToChatSessionQuery = exports.softDeleteChatSessionQuery = exports.touchChatSessionLastMessageQuery = exports.updateChatSessionTitleQuery = exports.updateChatSessionModelQuery = exports.listChatSessionsForUserByProjectQuery = exports.listChatSessionsForUserQuery = exports.getChatSessionQuery = exports.createChatSessionQuery = void 0;
|
|
4
4
|
exports.createChatSession = createChatSession;
|
|
5
5
|
exports.getChatSession = getChatSession;
|
|
6
6
|
exports.listChatSessionsForUser = listChatSessionsForUser;
|
|
@@ -29,6 +29,7 @@ exports.bumpChatArtifactVersion = bumpChatArtifactVersion;
|
|
|
29
29
|
exports.listChatArtifactsForSession = listChatArtifactsForSession;
|
|
30
30
|
exports.getChatArtifact = getChatArtifact;
|
|
31
31
|
exports.insertChatArtifactVersion = insertChatArtifactVersion;
|
|
32
|
+
exports.insertChatArtifactVersionWithDocumentReferences = insertChatArtifactVersionWithDocumentReferences;
|
|
32
33
|
exports.getChatArtifactVersion = getChatArtifactVersion;
|
|
33
34
|
exports.listChatArtifactVersions = listChatArtifactVersions;
|
|
34
35
|
exports.createChatSessionQuery = `-- name: CreateChatSession :one
|
|
@@ -677,7 +678,7 @@ exports.insertChatArtifactVersionQuery = `-- name: InsertChatArtifactVersion :on
|
|
|
677
678
|
INSERT INTO weave.chat_artifact_versions (
|
|
678
679
|
id, artifact_id, version, content, created_by_message_id
|
|
679
680
|
) VALUES ($1, $2, $3, $4, $5)
|
|
680
|
-
RETURNING id, artifact_id, version, content, created_by_message_id, created_at`;
|
|
681
|
+
RETURNING id, artifact_id, version, content, created_by_message_id, created_at, document_references`;
|
|
681
682
|
async function insertChatArtifactVersion(client, args) {
|
|
682
683
|
const result = await client.query({
|
|
683
684
|
text: exports.insertChatArtifactVersionQuery,
|
|
@@ -694,11 +695,37 @@ async function insertChatArtifactVersion(client, args) {
|
|
|
694
695
|
version: row[2],
|
|
695
696
|
content: row[3],
|
|
696
697
|
createdByMessageId: row[4],
|
|
697
|
-
createdAt: row[5]
|
|
698
|
+
createdAt: row[5],
|
|
699
|
+
documentReferences: row[6]
|
|
700
|
+
};
|
|
701
|
+
}
|
|
702
|
+
exports.insertChatArtifactVersionWithDocumentReferencesQuery = `-- name: InsertChatArtifactVersionWithDocumentReferences :one
|
|
703
|
+
INSERT INTO weave.chat_artifact_versions (
|
|
704
|
+
id, artifact_id, version, content, created_by_message_id, document_references
|
|
705
|
+
) VALUES ($1, $2, $3, $4, $5, $6)
|
|
706
|
+
RETURNING id, artifact_id, version, content, created_by_message_id, created_at, document_references`;
|
|
707
|
+
async function insertChatArtifactVersionWithDocumentReferences(client, args) {
|
|
708
|
+
const result = await client.query({
|
|
709
|
+
text: exports.insertChatArtifactVersionWithDocumentReferencesQuery,
|
|
710
|
+
values: [args.id, args.artifactId, args.version, args.content, args.createdByMessageId, args.documentReferences],
|
|
711
|
+
rowMode: "array"
|
|
712
|
+
});
|
|
713
|
+
if (result.rows.length !== 1) {
|
|
714
|
+
return null;
|
|
715
|
+
}
|
|
716
|
+
const row = result.rows[0];
|
|
717
|
+
return {
|
|
718
|
+
id: row[0],
|
|
719
|
+
artifactId: row[1],
|
|
720
|
+
version: row[2],
|
|
721
|
+
content: row[3],
|
|
722
|
+
createdByMessageId: row[4],
|
|
723
|
+
createdAt: row[5],
|
|
724
|
+
documentReferences: row[6]
|
|
698
725
|
};
|
|
699
726
|
}
|
|
700
727
|
exports.getChatArtifactVersionQuery = `-- name: GetChatArtifactVersion :one
|
|
701
|
-
SELECT id, artifact_id, version, content, created_by_message_id, created_at FROM weave.chat_artifact_versions
|
|
728
|
+
SELECT id, artifact_id, version, content, created_by_message_id, created_at, document_references FROM weave.chat_artifact_versions
|
|
702
729
|
WHERE artifact_id = $1 AND version = $2`;
|
|
703
730
|
async function getChatArtifactVersion(client, args) {
|
|
704
731
|
const result = await client.query({
|
|
@@ -716,11 +743,12 @@ async function getChatArtifactVersion(client, args) {
|
|
|
716
743
|
version: row[2],
|
|
717
744
|
content: row[3],
|
|
718
745
|
createdByMessageId: row[4],
|
|
719
|
-
createdAt: row[5]
|
|
746
|
+
createdAt: row[5],
|
|
747
|
+
documentReferences: row[6]
|
|
720
748
|
};
|
|
721
749
|
}
|
|
722
750
|
exports.listChatArtifactVersionsQuery = `-- name: ListChatArtifactVersions :many
|
|
723
|
-
SELECT id, artifact_id, version, content, created_by_message_id, created_at FROM weave.chat_artifact_versions
|
|
751
|
+
SELECT id, artifact_id, version, content, created_by_message_id, created_at, document_references FROM weave.chat_artifact_versions
|
|
724
752
|
WHERE artifact_id = $1
|
|
725
753
|
ORDER BY version`;
|
|
726
754
|
async function listChatArtifactVersions(client, args) {
|
|
@@ -736,7 +764,8 @@ async function listChatArtifactVersions(client, args) {
|
|
|
736
764
|
version: row[2],
|
|
737
765
|
content: row[3],
|
|
738
766
|
createdByMessageId: row[4],
|
|
739
|
-
createdAt: row[5]
|
|
767
|
+
createdAt: row[5],
|
|
768
|
+
documentReferences: row[6]
|
|
740
769
|
};
|
|
741
770
|
});
|
|
742
771
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weave-typescript",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "^25.2.0",
|
|
33
33
|
"@types/pg": "^8.15.5",
|
|
34
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
34
|
+
"@typescript/native-preview": "7.0.0-dev.20260426.1"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"test": "node tools/sqlcgen.test.js",
|