@anchrd/intel-contract 0.12.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contract/bundle.d.ts +85 -0
- package/dist/contract/bundle.js +63 -0
- package/dist/contract/contract.d.ts +3 -3372
- package/dist/contract/contract.js +24 -1797
- package/dist/contract/flow-run.d.ts +346 -0
- package/dist/contract/flow-run.js +181 -0
- package/dist/contract/flow.d.ts +995 -0
- package/dist/contract/flow.js +417 -0
- package/dist/contract/node.d.ts +402 -0
- package/dist/contract/node.js +286 -0
- package/dist/contract/share.d.ts +142 -0
- package/dist/contract/share.js +67 -0
- package/dist/contract/table.d.ts +162 -0
- package/dist/contract/table.js +117 -0
- package/dist/contract/tool.d.ts +122 -0
- package/dist/contract/tool.js +172 -0
- package/package.json +29 -1
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const NodeKind: z.ZodEnum<{
|
|
3
|
+
folder: "folder";
|
|
4
|
+
document: "document";
|
|
5
|
+
table: "table";
|
|
6
|
+
attachment: "attachment";
|
|
7
|
+
}>;
|
|
8
|
+
export type NodeKind = z.infer<typeof NodeKind>;
|
|
9
|
+
export declare const Node: z.ZodObject<{
|
|
10
|
+
id: z.ZodString;
|
|
11
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
12
|
+
kind: z.ZodEnum<{
|
|
13
|
+
folder: "folder";
|
|
14
|
+
document: "document";
|
|
15
|
+
table: "table";
|
|
16
|
+
attachment: "attachment";
|
|
17
|
+
}>;
|
|
18
|
+
title: z.ZodString;
|
|
19
|
+
description: z.ZodNullable<z.ZodString>;
|
|
20
|
+
ownerId: z.ZodString;
|
|
21
|
+
currentVersionId: z.ZodNullable<z.ZodString>;
|
|
22
|
+
createdAt: z.ZodISODateTime;
|
|
23
|
+
updatedAt: z.ZodISODateTime;
|
|
24
|
+
archivedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
25
|
+
}, z.core.$strict>;
|
|
26
|
+
export type Node = z.infer<typeof Node>;
|
|
27
|
+
export declare const NodeVersionSegment: z.ZodEnum<{
|
|
28
|
+
append: "append";
|
|
29
|
+
snapshot: "snapshot";
|
|
30
|
+
}>;
|
|
31
|
+
export type NodeVersionSegment = z.infer<typeof NodeVersionSegment>;
|
|
32
|
+
export declare const NodeVersion: z.ZodObject<{
|
|
33
|
+
id: z.ZodString;
|
|
34
|
+
nodeId: z.ZodString;
|
|
35
|
+
sequence: z.ZodNumber;
|
|
36
|
+
contentKey: z.ZodString;
|
|
37
|
+
mediaType: z.ZodString;
|
|
38
|
+
contentHash: z.ZodString;
|
|
39
|
+
size: z.ZodNumber;
|
|
40
|
+
segment: z.ZodNullable<z.ZodEnum<{
|
|
41
|
+
append: "append";
|
|
42
|
+
snapshot: "snapshot";
|
|
43
|
+
}>>;
|
|
44
|
+
createdBy: z.ZodString;
|
|
45
|
+
createdAt: z.ZodISODateTime;
|
|
46
|
+
}, z.core.$strict>;
|
|
47
|
+
export type NodeVersion = z.infer<typeof NodeVersion>;
|
|
48
|
+
export declare const ListNodesInput: z.ZodObject<{
|
|
49
|
+
parentId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
50
|
+
includeArchived: z.ZodDefault<z.ZodBoolean>;
|
|
51
|
+
archivedOnly: z.ZodOptional<z.ZodBoolean>;
|
|
52
|
+
}, z.core.$strict>;
|
|
53
|
+
export type ListNodesInput = z.infer<typeof ListNodesInput>;
|
|
54
|
+
export declare const GetNodeInput: z.ZodObject<{
|
|
55
|
+
nodeId: z.ZodString;
|
|
56
|
+
}, z.core.$strict>;
|
|
57
|
+
export type GetNodeInput = z.infer<typeof GetNodeInput>;
|
|
58
|
+
export declare const GetNodeVersionInput: z.ZodObject<{
|
|
59
|
+
nodeId: z.ZodString;
|
|
60
|
+
versionId: z.ZodString;
|
|
61
|
+
}, z.core.$strict>;
|
|
62
|
+
export type GetNodeVersionInput = z.infer<typeof GetNodeVersionInput>;
|
|
63
|
+
export declare const CreateNodeInput: z.ZodObject<{
|
|
64
|
+
parentId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
65
|
+
kind: z.ZodEnum<{
|
|
66
|
+
folder: "folder";
|
|
67
|
+
document: "document";
|
|
68
|
+
table: "table";
|
|
69
|
+
attachment: "attachment";
|
|
70
|
+
}>;
|
|
71
|
+
title: z.ZodString;
|
|
72
|
+
description: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
73
|
+
idempotencyKey: z.ZodString;
|
|
74
|
+
}, z.core.$strict>;
|
|
75
|
+
export type CreateNodeInput = z.infer<typeof CreateNodeInput>;
|
|
76
|
+
export declare const SaveNodeVersionInput: z.ZodObject<{
|
|
77
|
+
nodeId: z.ZodString;
|
|
78
|
+
baseVersionId: z.ZodNullable<z.ZodString>;
|
|
79
|
+
content: z.ZodString;
|
|
80
|
+
mediaType: z.ZodDefault<z.ZodString>;
|
|
81
|
+
idempotencyKey: z.ZodString;
|
|
82
|
+
}, z.core.$strict>;
|
|
83
|
+
export type SaveNodeVersionInput = z.infer<typeof SaveNodeVersionInput>;
|
|
84
|
+
export declare const SaveAttachmentInput: z.ZodObject<{
|
|
85
|
+
nodeId: z.ZodString;
|
|
86
|
+
baseVersionId: z.ZodNullable<z.ZodString>;
|
|
87
|
+
contentBase64: z.ZodString;
|
|
88
|
+
mediaType: z.ZodString;
|
|
89
|
+
idempotencyKey: z.ZodString;
|
|
90
|
+
}, z.core.$strict>;
|
|
91
|
+
export type SaveAttachmentInput = z.infer<typeof SaveAttachmentInput>;
|
|
92
|
+
export declare const UpdateNodeInput: z.ZodObject<{
|
|
93
|
+
nodeId: z.ZodString;
|
|
94
|
+
baseUpdatedAt: z.ZodISODateTime;
|
|
95
|
+
title: z.ZodOptional<z.ZodString>;
|
|
96
|
+
description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
97
|
+
parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
98
|
+
idempotencyKey: z.ZodString;
|
|
99
|
+
}, z.core.$strict>;
|
|
100
|
+
export type UpdateNodeInput = z.infer<typeof UpdateNodeInput>;
|
|
101
|
+
export declare const ArchiveNodeInput: z.ZodObject<{
|
|
102
|
+
nodeId: z.ZodString;
|
|
103
|
+
baseUpdatedAt: z.ZodISODateTime;
|
|
104
|
+
archived: z.ZodBoolean;
|
|
105
|
+
idempotencyKey: z.ZodString;
|
|
106
|
+
}, z.core.$strict>;
|
|
107
|
+
export type ArchiveNodeInput = z.infer<typeof ArchiveNodeInput>;
|
|
108
|
+
export declare const NodeList: z.ZodObject<{
|
|
109
|
+
items: z.ZodArray<z.ZodObject<{
|
|
110
|
+
id: z.ZodString;
|
|
111
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
112
|
+
kind: z.ZodEnum<{
|
|
113
|
+
folder: "folder";
|
|
114
|
+
document: "document";
|
|
115
|
+
table: "table";
|
|
116
|
+
attachment: "attachment";
|
|
117
|
+
}>;
|
|
118
|
+
title: z.ZodString;
|
|
119
|
+
description: z.ZodNullable<z.ZodString>;
|
|
120
|
+
ownerId: z.ZodString;
|
|
121
|
+
currentVersionId: z.ZodNullable<z.ZodString>;
|
|
122
|
+
createdAt: z.ZodISODateTime;
|
|
123
|
+
updatedAt: z.ZodISODateTime;
|
|
124
|
+
archivedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
125
|
+
}, z.core.$strict>>;
|
|
126
|
+
withChildren: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
127
|
+
}, z.core.$strict>;
|
|
128
|
+
export type NodeList = z.infer<typeof NodeList>;
|
|
129
|
+
export declare const NodeVersionList: z.ZodObject<{
|
|
130
|
+
items: z.ZodArray<z.ZodObject<{
|
|
131
|
+
id: z.ZodString;
|
|
132
|
+
nodeId: z.ZodString;
|
|
133
|
+
sequence: z.ZodNumber;
|
|
134
|
+
contentKey: z.ZodString;
|
|
135
|
+
mediaType: z.ZodString;
|
|
136
|
+
contentHash: z.ZodString;
|
|
137
|
+
size: z.ZodNumber;
|
|
138
|
+
segment: z.ZodNullable<z.ZodEnum<{
|
|
139
|
+
append: "append";
|
|
140
|
+
snapshot: "snapshot";
|
|
141
|
+
}>>;
|
|
142
|
+
createdBy: z.ZodString;
|
|
143
|
+
createdAt: z.ZodISODateTime;
|
|
144
|
+
}, z.core.$strict>>;
|
|
145
|
+
}, z.core.$strict>;
|
|
146
|
+
export type NodeVersionList = z.infer<typeof NodeVersionList>;
|
|
147
|
+
export declare const NodeDocument: z.ZodObject<{
|
|
148
|
+
node: z.ZodObject<{
|
|
149
|
+
id: z.ZodString;
|
|
150
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
151
|
+
kind: z.ZodEnum<{
|
|
152
|
+
folder: "folder";
|
|
153
|
+
document: "document";
|
|
154
|
+
table: "table";
|
|
155
|
+
attachment: "attachment";
|
|
156
|
+
}>;
|
|
157
|
+
title: z.ZodString;
|
|
158
|
+
description: z.ZodNullable<z.ZodString>;
|
|
159
|
+
ownerId: z.ZodString;
|
|
160
|
+
currentVersionId: z.ZodNullable<z.ZodString>;
|
|
161
|
+
createdAt: z.ZodISODateTime;
|
|
162
|
+
updatedAt: z.ZodISODateTime;
|
|
163
|
+
archivedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
164
|
+
}, z.core.$strict>;
|
|
165
|
+
version: z.ZodNullable<z.ZodObject<{
|
|
166
|
+
id: z.ZodString;
|
|
167
|
+
nodeId: z.ZodString;
|
|
168
|
+
sequence: z.ZodNumber;
|
|
169
|
+
contentKey: z.ZodString;
|
|
170
|
+
mediaType: z.ZodString;
|
|
171
|
+
contentHash: z.ZodString;
|
|
172
|
+
size: z.ZodNumber;
|
|
173
|
+
segment: z.ZodNullable<z.ZodEnum<{
|
|
174
|
+
append: "append";
|
|
175
|
+
snapshot: "snapshot";
|
|
176
|
+
}>>;
|
|
177
|
+
createdBy: z.ZodString;
|
|
178
|
+
createdAt: z.ZodISODateTime;
|
|
179
|
+
}, z.core.$strict>>;
|
|
180
|
+
content: z.ZodNullable<z.ZodString>;
|
|
181
|
+
}, z.core.$strict>;
|
|
182
|
+
export type NodeDocument = z.infer<typeof NodeDocument>;
|
|
183
|
+
export declare const NodeAttachment: z.ZodObject<{
|
|
184
|
+
node: z.ZodObject<{
|
|
185
|
+
id: z.ZodString;
|
|
186
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
187
|
+
kind: z.ZodEnum<{
|
|
188
|
+
folder: "folder";
|
|
189
|
+
document: "document";
|
|
190
|
+
table: "table";
|
|
191
|
+
attachment: "attachment";
|
|
192
|
+
}>;
|
|
193
|
+
title: z.ZodString;
|
|
194
|
+
description: z.ZodNullable<z.ZodString>;
|
|
195
|
+
ownerId: z.ZodString;
|
|
196
|
+
currentVersionId: z.ZodNullable<z.ZodString>;
|
|
197
|
+
createdAt: z.ZodISODateTime;
|
|
198
|
+
updatedAt: z.ZodISODateTime;
|
|
199
|
+
archivedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
200
|
+
}, z.core.$strict>;
|
|
201
|
+
version: z.ZodObject<{
|
|
202
|
+
id: z.ZodString;
|
|
203
|
+
nodeId: z.ZodString;
|
|
204
|
+
sequence: z.ZodNumber;
|
|
205
|
+
contentKey: z.ZodString;
|
|
206
|
+
mediaType: z.ZodString;
|
|
207
|
+
contentHash: z.ZodString;
|
|
208
|
+
size: z.ZodNumber;
|
|
209
|
+
segment: z.ZodNullable<z.ZodEnum<{
|
|
210
|
+
append: "append";
|
|
211
|
+
snapshot: "snapshot";
|
|
212
|
+
}>>;
|
|
213
|
+
createdBy: z.ZodString;
|
|
214
|
+
createdAt: z.ZodISODateTime;
|
|
215
|
+
}, z.core.$strict>;
|
|
216
|
+
resourceUri: z.ZodString;
|
|
217
|
+
}, z.core.$strict>;
|
|
218
|
+
export type NodeAttachment = z.infer<typeof NodeAttachment>;
|
|
219
|
+
export declare const NodeTable: z.ZodObject<{
|
|
220
|
+
node: z.ZodObject<{
|
|
221
|
+
id: z.ZodString;
|
|
222
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
223
|
+
kind: z.ZodEnum<{
|
|
224
|
+
folder: "folder";
|
|
225
|
+
document: "document";
|
|
226
|
+
table: "table";
|
|
227
|
+
attachment: "attachment";
|
|
228
|
+
}>;
|
|
229
|
+
title: z.ZodString;
|
|
230
|
+
description: z.ZodNullable<z.ZodString>;
|
|
231
|
+
ownerId: z.ZodString;
|
|
232
|
+
currentVersionId: z.ZodNullable<z.ZodString>;
|
|
233
|
+
createdAt: z.ZodISODateTime;
|
|
234
|
+
updatedAt: z.ZodISODateTime;
|
|
235
|
+
archivedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
236
|
+
}, z.core.$strict>;
|
|
237
|
+
columns: z.ZodArray<z.ZodString>;
|
|
238
|
+
rows: z.ZodArray<z.ZodArray<z.ZodString>>;
|
|
239
|
+
versionId: z.ZodNullable<z.ZodString>;
|
|
240
|
+
}, z.core.$strict>;
|
|
241
|
+
export type NodeTable = z.infer<typeof NodeTable>;
|
|
242
|
+
export declare const NodeLinkRelation: z.ZodEnum<{
|
|
243
|
+
references: "references";
|
|
244
|
+
related: "related";
|
|
245
|
+
depends_on: "depends_on";
|
|
246
|
+
implements: "implements";
|
|
247
|
+
}>;
|
|
248
|
+
export type NodeLinkRelation = z.infer<typeof NodeLinkRelation>;
|
|
249
|
+
export declare const NodeLinkOrigin: z.ZodEnum<{
|
|
250
|
+
manual: "manual";
|
|
251
|
+
text: "text";
|
|
252
|
+
}>;
|
|
253
|
+
export type NodeLinkOrigin = z.infer<typeof NodeLinkOrigin>;
|
|
254
|
+
export declare const NodeLink: z.ZodObject<{
|
|
255
|
+
id: z.ZodString;
|
|
256
|
+
sourceNodeId: z.ZodString;
|
|
257
|
+
targetNodeId: z.ZodString;
|
|
258
|
+
relation: z.ZodEnum<{
|
|
259
|
+
references: "references";
|
|
260
|
+
related: "related";
|
|
261
|
+
depends_on: "depends_on";
|
|
262
|
+
implements: "implements";
|
|
263
|
+
}>;
|
|
264
|
+
origin: z.ZodEnum<{
|
|
265
|
+
manual: "manual";
|
|
266
|
+
text: "text";
|
|
267
|
+
}>;
|
|
268
|
+
label: z.ZodNullable<z.ZodString>;
|
|
269
|
+
createdBy: z.ZodString;
|
|
270
|
+
createdAt: z.ZodISODateTime;
|
|
271
|
+
}, z.core.$strict>;
|
|
272
|
+
export type NodeLink = z.infer<typeof NodeLink>;
|
|
273
|
+
export declare const NodeLinkList: z.ZodObject<{
|
|
274
|
+
items: z.ZodArray<z.ZodObject<{
|
|
275
|
+
id: z.ZodString;
|
|
276
|
+
sourceNodeId: z.ZodString;
|
|
277
|
+
targetNodeId: z.ZodString;
|
|
278
|
+
relation: z.ZodEnum<{
|
|
279
|
+
references: "references";
|
|
280
|
+
related: "related";
|
|
281
|
+
depends_on: "depends_on";
|
|
282
|
+
implements: "implements";
|
|
283
|
+
}>;
|
|
284
|
+
origin: z.ZodEnum<{
|
|
285
|
+
manual: "manual";
|
|
286
|
+
text: "text";
|
|
287
|
+
}>;
|
|
288
|
+
label: z.ZodNullable<z.ZodString>;
|
|
289
|
+
createdBy: z.ZodString;
|
|
290
|
+
createdAt: z.ZodISODateTime;
|
|
291
|
+
}, z.core.$strict>>;
|
|
292
|
+
}, z.core.$strict>;
|
|
293
|
+
export type NodeLinkList = z.infer<typeof NodeLinkList>;
|
|
294
|
+
export declare const DocumentLinkInlineType = "documentLink";
|
|
295
|
+
export declare const ResolveNodeLinksInput: z.ZodObject<{
|
|
296
|
+
nodeIds: z.ZodArray<z.ZodString>;
|
|
297
|
+
}, z.core.$strict>;
|
|
298
|
+
export type ResolveNodeLinksInput = z.infer<typeof ResolveNodeLinksInput>;
|
|
299
|
+
export declare const ResolvedNodeLink: z.ZodObject<{
|
|
300
|
+
nodeId: z.ZodString;
|
|
301
|
+
title: z.ZodString;
|
|
302
|
+
}, z.core.$strict>;
|
|
303
|
+
export type ResolvedNodeLink = z.infer<typeof ResolvedNodeLink>;
|
|
304
|
+
export declare const ResolveNodeLinksResult: z.ZodObject<{
|
|
305
|
+
items: z.ZodArray<z.ZodObject<{
|
|
306
|
+
nodeId: z.ZodString;
|
|
307
|
+
title: z.ZodString;
|
|
308
|
+
}, z.core.$strict>>;
|
|
309
|
+
}, z.core.$strict>;
|
|
310
|
+
export type ResolveNodeLinksResult = z.infer<typeof ResolveNodeLinksResult>;
|
|
311
|
+
export declare const NodeGraphInput: z.ZodObject<{
|
|
312
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
313
|
+
}, z.core.$strict>;
|
|
314
|
+
export type NodeGraphInput = z.infer<typeof NodeGraphInput>;
|
|
315
|
+
export declare const NodeGraph: z.ZodObject<{
|
|
316
|
+
nodes: z.ZodArray<z.ZodObject<{
|
|
317
|
+
id: z.ZodString;
|
|
318
|
+
parentId: z.ZodNullable<z.ZodString>;
|
|
319
|
+
kind: z.ZodEnum<{
|
|
320
|
+
folder: "folder";
|
|
321
|
+
document: "document";
|
|
322
|
+
table: "table";
|
|
323
|
+
attachment: "attachment";
|
|
324
|
+
}>;
|
|
325
|
+
title: z.ZodString;
|
|
326
|
+
description: z.ZodNullable<z.ZodString>;
|
|
327
|
+
ownerId: z.ZodString;
|
|
328
|
+
currentVersionId: z.ZodNullable<z.ZodString>;
|
|
329
|
+
createdAt: z.ZodISODateTime;
|
|
330
|
+
updatedAt: z.ZodISODateTime;
|
|
331
|
+
archivedAt: z.ZodNullable<z.ZodISODateTime>;
|
|
332
|
+
}, z.core.$strict>>;
|
|
333
|
+
links: z.ZodArray<z.ZodObject<{
|
|
334
|
+
id: z.ZodString;
|
|
335
|
+
sourceNodeId: z.ZodString;
|
|
336
|
+
targetNodeId: z.ZodString;
|
|
337
|
+
relation: z.ZodEnum<{
|
|
338
|
+
references: "references";
|
|
339
|
+
related: "related";
|
|
340
|
+
depends_on: "depends_on";
|
|
341
|
+
implements: "implements";
|
|
342
|
+
}>;
|
|
343
|
+
origin: z.ZodEnum<{
|
|
344
|
+
manual: "manual";
|
|
345
|
+
text: "text";
|
|
346
|
+
}>;
|
|
347
|
+
label: z.ZodNullable<z.ZodString>;
|
|
348
|
+
createdBy: z.ZodString;
|
|
349
|
+
createdAt: z.ZodISODateTime;
|
|
350
|
+
}, z.core.$strict>>;
|
|
351
|
+
}, z.core.$strict>;
|
|
352
|
+
export type NodeGraph = z.infer<typeof NodeGraph>;
|
|
353
|
+
export declare const BlockNoteMediaType = "application/vnd.anchrd.intel.blocknote+json";
|
|
354
|
+
export declare const BlockNoteDocument: z.ZodObject<{
|
|
355
|
+
format: z.ZodLiteral<"blocknote">;
|
|
356
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
357
|
+
blocks: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
358
|
+
markdown: z.ZodString;
|
|
359
|
+
}, z.core.$strict>;
|
|
360
|
+
export type BlockNoteDocument = z.infer<typeof BlockNoteDocument>;
|
|
361
|
+
export declare const SearchInput: z.ZodObject<{
|
|
362
|
+
query: z.ZodString;
|
|
363
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
364
|
+
scopeId: z.ZodOptional<z.ZodString>;
|
|
365
|
+
}, z.core.$strict>;
|
|
366
|
+
export type SearchInput = z.infer<typeof SearchInput>;
|
|
367
|
+
export declare const NodeCitation: z.ZodObject<{
|
|
368
|
+
nodeId: z.ZodString;
|
|
369
|
+
versionId: z.ZodString;
|
|
370
|
+
title: z.ZodString;
|
|
371
|
+
passage: z.ZodString;
|
|
372
|
+
source: z.ZodString;
|
|
373
|
+
freshness: z.ZodISODateTime;
|
|
374
|
+
score: z.ZodNumber;
|
|
375
|
+
match: z.ZodEnum<{
|
|
376
|
+
semantic: "semantic";
|
|
377
|
+
lexical: "lexical";
|
|
378
|
+
hybrid: "hybrid";
|
|
379
|
+
}>;
|
|
380
|
+
}, z.core.$strict>;
|
|
381
|
+
export type NodeCitation = z.infer<typeof NodeCitation>;
|
|
382
|
+
export declare const SearchResult: z.ZodObject<{
|
|
383
|
+
items: z.ZodArray<z.ZodObject<{
|
|
384
|
+
nodeId: z.ZodString;
|
|
385
|
+
versionId: z.ZodString;
|
|
386
|
+
title: z.ZodString;
|
|
387
|
+
passage: z.ZodString;
|
|
388
|
+
source: z.ZodString;
|
|
389
|
+
freshness: z.ZodISODateTime;
|
|
390
|
+
score: z.ZodNumber;
|
|
391
|
+
match: z.ZodEnum<{
|
|
392
|
+
semantic: "semantic";
|
|
393
|
+
lexical: "lexical";
|
|
394
|
+
hybrid: "hybrid";
|
|
395
|
+
}>;
|
|
396
|
+
}, z.core.$strict>>;
|
|
397
|
+
}, z.core.$strict>;
|
|
398
|
+
export type SearchResult = z.infer<typeof SearchResult>;
|
|
399
|
+
export declare const ReindexResult: z.ZodObject<{
|
|
400
|
+
queued: z.ZodNumber;
|
|
401
|
+
}, z.core.$strict>;
|
|
402
|
+
export type ReindexResult = z.infer<typeof ReindexResult>;
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { IdempotencyKey, IntelId, IsoDateTime } from "./contract.js";
|
|
3
|
+
// What this installation is equipped to do — deployment facts, never the caller's permissions
|
|
4
|
+
// (those stay behind each door, where `/session` deliberately does not carry them). `agentRuntime`
|
|
5
|
+
// says whether an agent Worker is bound at all (#190): without it the UI offers no "New agent" and
|
|
6
|
+
// an agent node explains itself instead of rendering views that could only end in a 503.
|
|
7
|
+
// The fourth kind is `table` (#40), the fifth is `agent` (#139) and the sixth is `board` (#285).
|
|
8
|
+
// Each is a kind of node, not a kind of thing: it hangs in the same folder tree, inherits the same
|
|
9
|
+
// folder grants, carries the same immutable versions and the same R2 body as a document
|
|
10
|
+
// (ADR-0004 §1, ADR-0005 §1). Only the media type and the operations below differ.
|
|
11
|
+
//
|
|
12
|
+
// ⚠️ `agent` being optional is load-bearing (ADR-0005 §1): an installation without a single agent
|
|
13
|
+
// node is complete, not unfinished, and nothing here asks anyone to classify a document as a skill
|
|
14
|
+
// or a policy in order to file it. The same holds for `board`: it is a file somebody may make, not
|
|
15
|
+
// a place the tree grows a special corner for — which is exactly why a board is one node carrying
|
|
16
|
+
// its tasks and not a folder that only tasks may live in (#285).
|
|
17
|
+
export const NodeKind = z.enum(["folder", "document", "attachment", "table"]);
|
|
18
|
+
export const Node = z.strictObject({
|
|
19
|
+
id: IntelId,
|
|
20
|
+
parentId: IntelId.nullable(),
|
|
21
|
+
kind: NodeKind,
|
|
22
|
+
title: z.string().min(1).max(240),
|
|
23
|
+
description: z.string().max(2_000).nullable(),
|
|
24
|
+
ownerId: IntelId,
|
|
25
|
+
currentVersionId: IntelId.nullable(),
|
|
26
|
+
createdAt: IsoDateTime,
|
|
27
|
+
updatedAt: IsoDateTime,
|
|
28
|
+
archivedAt: IsoDateTime.nullable(),
|
|
29
|
+
});
|
|
30
|
+
// What one table version carries (#135). An `append` holds only the rows one write added; a
|
|
31
|
+
// `snapshot` holds the complete table — header and every row — so reading starts at the newest
|
|
32
|
+
// snapshot and everything before it is history rather than content. Defining a table writes the
|
|
33
|
+
// first snapshot; updating, deleting, and redefining write the later ones. Documents and
|
|
34
|
+
// attachments carry `null`: each of their versions is complete by construction, and the word would
|
|
35
|
+
// say nothing about them.
|
|
36
|
+
export const NodeVersionSegment = z.enum(["append", "snapshot"]);
|
|
37
|
+
export const NodeVersion = z.strictObject({
|
|
38
|
+
id: IntelId,
|
|
39
|
+
nodeId: IntelId,
|
|
40
|
+
sequence: z.number().int().positive(),
|
|
41
|
+
contentKey: z.string().min(1),
|
|
42
|
+
mediaType: z.string().min(1).max(160),
|
|
43
|
+
contentHash: z.string().regex(/^[a-f0-9]{64}$/),
|
|
44
|
+
size: z.number().int().nonnegative(),
|
|
45
|
+
segment: NodeVersionSegment.nullable(),
|
|
46
|
+
createdBy: IntelId,
|
|
47
|
+
createdAt: IsoDateTime,
|
|
48
|
+
});
|
|
49
|
+
export const ListNodesInput = z.strictObject({
|
|
50
|
+
parentId: IntelId.nullable()
|
|
51
|
+
.default(null)
|
|
52
|
+
.describe("Folder to list the direct children of. `null` lists the top level."),
|
|
53
|
+
includeArchived: z
|
|
54
|
+
.boolean()
|
|
55
|
+
.default(false)
|
|
56
|
+
.describe("Include archived nodes beside the live ones instead of hiding them."),
|
|
57
|
+
// ⚠️ Overrides `parentId` rather than narrowing beside it: what is archived is asked for across
|
|
58
|
+
// the whole tree, because that is the only useful question. Somebody looking for what they threw
|
|
59
|
+
// away does not know which folder it was in — if they did, they would not be looking (#113).
|
|
60
|
+
// A separate flag rather than a third state on `includeArchived`, so no existing caller changes
|
|
61
|
+
// meaning — and `.optional()` rather than `.default(false)` for the same reason `ListFlowsInput`
|
|
62
|
+
// carries it that way: a default makes the field required in the PARSED type, and every existing
|
|
63
|
+
// caller would have to answer a question it is not asking.
|
|
64
|
+
archivedOnly: z
|
|
65
|
+
.boolean()
|
|
66
|
+
.optional()
|
|
67
|
+
.describe("List only archived nodes, across the whole tree. Overrides parentId rather than narrowing it: somebody looking for what they threw away does not know which folder it was in."),
|
|
68
|
+
});
|
|
69
|
+
export const GetNodeInput = z.strictObject({
|
|
70
|
+
nodeId: IntelId.describe("Node to read, from node_list or search."),
|
|
71
|
+
});
|
|
72
|
+
// One pinned version of one node (#147). Both IDs, always: a version ID alone would let anyone
|
|
73
|
+
// holding an ID read content whose node-level ACL they never passed, and a citation names both.
|
|
74
|
+
export const GetNodeVersionInput = z.strictObject({
|
|
75
|
+
nodeId: IntelId.describe("Node the version belongs to. Required even though the version id is unique: access is decided on the node."),
|
|
76
|
+
versionId: IntelId.describe("Version to read, from node_version_list or a search citation."),
|
|
77
|
+
});
|
|
78
|
+
export const CreateNodeInput = z.strictObject({
|
|
79
|
+
parentId: IntelId.nullable()
|
|
80
|
+
.default(null)
|
|
81
|
+
.describe("Folder to file the new node in. `null` puts it at the top level."),
|
|
82
|
+
kind: NodeKind.describe("What the node is. A folder holds others and has no content; document, attachment and table each carry their own body, written afterwards by node_version_create, node_attachment_create or node_table_create."),
|
|
83
|
+
title: z
|
|
84
|
+
.string()
|
|
85
|
+
.trim()
|
|
86
|
+
.min(1)
|
|
87
|
+
.max(240)
|
|
88
|
+
.describe("What the node is called. Shown in the tree and searched."),
|
|
89
|
+
description: z
|
|
90
|
+
.string()
|
|
91
|
+
.trim()
|
|
92
|
+
.max(2_000)
|
|
93
|
+
.nullable()
|
|
94
|
+
.default(null)
|
|
95
|
+
.describe("Optional sentence about the node, for readers rather than for search ranking."),
|
|
96
|
+
idempotencyKey: IdempotencyKey,
|
|
97
|
+
});
|
|
98
|
+
export const SaveNodeVersionInput = z.strictObject({
|
|
99
|
+
nodeId: IntelId.describe("Document node to append a version to."),
|
|
100
|
+
baseVersionId: IntelId.nullable().describe("The version this edit was made against — `currentVersionId` from node_get. If the node has moved on since, the call is refused rather than overwriting the newer version; pass `null` only for a node that has no version yet."),
|
|
101
|
+
content: z
|
|
102
|
+
.string()
|
|
103
|
+
.max(10_000_000)
|
|
104
|
+
.describe("The complete new content. Versions are whole documents, not patches."),
|
|
105
|
+
mediaType: z
|
|
106
|
+
.string()
|
|
107
|
+
.min(1)
|
|
108
|
+
.max(160)
|
|
109
|
+
.default("text/markdown")
|
|
110
|
+
.describe("Media type of `content`. Leave at text/markdown unless writing another format."),
|
|
111
|
+
idempotencyKey: IdempotencyKey,
|
|
112
|
+
});
|
|
113
|
+
export const SaveAttachmentInput = z.strictObject({
|
|
114
|
+
nodeId: IntelId.describe("Attachment node to append bytes to."),
|
|
115
|
+
baseVersionId: IntelId.nullable().describe("The version these bytes replace — `currentVersionId` from node_get, or `null` for the first upload. A stale value is refused rather than overwriting."),
|
|
116
|
+
contentBase64: z
|
|
117
|
+
.string()
|
|
118
|
+
.min(1)
|
|
119
|
+
.max(20_000_000)
|
|
120
|
+
.describe("The file, base64-encoded. Around 15 MB of bytes; larger files take the HTTP door, which streams."),
|
|
121
|
+
mediaType: z
|
|
122
|
+
.string()
|
|
123
|
+
.min(1)
|
|
124
|
+
.max(160)
|
|
125
|
+
.describe("Media type of the decoded bytes, e.g. application/pdf."),
|
|
126
|
+
idempotencyKey: IdempotencyKey,
|
|
127
|
+
});
|
|
128
|
+
export const UpdateNodeInput = z
|
|
129
|
+
.strictObject({
|
|
130
|
+
nodeId: IntelId.describe("Node to change."),
|
|
131
|
+
baseUpdatedAt: IsoDateTime.describe("`updatedAt` as node_get last reported it. A newer value on the server means somebody else changed the node first and the call is refused."),
|
|
132
|
+
title: z
|
|
133
|
+
.string()
|
|
134
|
+
.trim()
|
|
135
|
+
.min(1)
|
|
136
|
+
.max(240)
|
|
137
|
+
.optional()
|
|
138
|
+
.describe("New title. Omit to leave it as it is."),
|
|
139
|
+
description: z
|
|
140
|
+
.string()
|
|
141
|
+
.trim()
|
|
142
|
+
.max(2_000)
|
|
143
|
+
.nullable()
|
|
144
|
+
.optional()
|
|
145
|
+
.describe("New description, or `null` to clear it. Omit to leave it as it is."),
|
|
146
|
+
parentId: IntelId.nullable()
|
|
147
|
+
.optional()
|
|
148
|
+
.describe("Folder to move the node into, or `null` for the top level. Omit to leave it where it is."),
|
|
149
|
+
idempotencyKey: IdempotencyKey,
|
|
150
|
+
})
|
|
151
|
+
.refine((input) => input.title !== undefined || input.description !== undefined || input.parentId !== undefined, { message: "At least one change is required" });
|
|
152
|
+
export const ArchiveNodeInput = z.strictObject({
|
|
153
|
+
nodeId: IntelId.describe("Node to archive or restore."),
|
|
154
|
+
baseUpdatedAt: IsoDateTime.describe("`updatedAt` as node_get last reported it. A newer value on the server means somebody else changed the node first and the call is refused."),
|
|
155
|
+
archived: z
|
|
156
|
+
.boolean()
|
|
157
|
+
.describe("`true` archives the node, `false` restores it. Archiving hides a node from listings and search; nothing is deleted and every version stays readable."),
|
|
158
|
+
idempotencyKey: IdempotencyKey,
|
|
159
|
+
});
|
|
160
|
+
// ⚠️ `withChildren` belongs to the LEVEL, not to the node (#59). Whether something has children
|
|
161
|
+
// THIS reader may see is not a property of the thing — two readers get different answers. As a
|
|
162
|
+
// field on the node, every other place that returns a node would have to compute it as well or
|
|
163
|
+
// lie; as a list beside the entries it costs only the one answer that needs it.
|
|
164
|
+
export const NodeList = z.strictObject({
|
|
165
|
+
items: z.array(Node),
|
|
166
|
+
withChildren: z.array(IntelId).default([]),
|
|
167
|
+
});
|
|
168
|
+
export const NodeVersionList = z.strictObject({ items: z.array(NodeVersion) });
|
|
169
|
+
export const NodeDocument = z.strictObject({
|
|
170
|
+
node: Node,
|
|
171
|
+
version: NodeVersion.nullable(),
|
|
172
|
+
content: z.string().nullable(),
|
|
173
|
+
});
|
|
174
|
+
export const NodeAttachment = z.strictObject({
|
|
175
|
+
node: Node,
|
|
176
|
+
version: NodeVersion,
|
|
177
|
+
resourceUri: z.string().regex(/^intel:\/\/nodes\/[^/]+\/attachment$/),
|
|
178
|
+
});
|
|
179
|
+
// The table as a grid rather than as text: the server owns the one CSV reader, so no surface has to
|
|
180
|
+
// grow a second one that would disagree with it about quoting.
|
|
181
|
+
export const NodeTable = z.strictObject({
|
|
182
|
+
node: Node,
|
|
183
|
+
columns: z.array(z.string()),
|
|
184
|
+
rows: z.array(z.array(z.string())),
|
|
185
|
+
// The newest append, or `null` while the table has no header yet.
|
|
186
|
+
versionId: IntelId.nullable(),
|
|
187
|
+
});
|
|
188
|
+
export const NodeLinkRelation = z.enum(["references", "related", "depends_on", "implements"]);
|
|
189
|
+
// Where the link came from. `text` links are derived from a document's content and are rewritten
|
|
190
|
+
// whenever it is saved; `manual` links were made in the dialog #41 removed and are now history.
|
|
191
|
+
//
|
|
192
|
+
// ⚠️ This is provenance, never a second sort of relationship. Nothing offers the reader a choice
|
|
193
|
+
// between them, and nothing may start writing `manual` again — that would be the two ways of saying
|
|
194
|
+
// one thing that #41 exists to end. It exists so that saving a document cannot delete a link
|
|
195
|
+
// somebody made before there was another way to make one.
|
|
196
|
+
export const NodeLinkOrigin = z.enum(["text", "manual"]);
|
|
197
|
+
export const NodeLink = z.strictObject({
|
|
198
|
+
id: IntelId,
|
|
199
|
+
sourceNodeId: IntelId,
|
|
200
|
+
targetNodeId: IntelId,
|
|
201
|
+
relation: NodeLinkRelation,
|
|
202
|
+
origin: NodeLinkOrigin,
|
|
203
|
+
label: z.string().trim().min(1).max(120).nullable(),
|
|
204
|
+
createdBy: IntelId,
|
|
205
|
+
createdAt: IsoDateTime,
|
|
206
|
+
});
|
|
207
|
+
export const NodeLinkList = z.strictObject({ items: z.array(NodeLink) });
|
|
208
|
+
// The inline element a document link is, inside a BlockNote document (#41).
|
|
209
|
+
//
|
|
210
|
+
// ⚠️ The ID and nothing else. No title and no path travel with it: a stored title would go stale
|
|
211
|
+
// the moment the target is renamed, a stored path the moment it is moved — and either one would
|
|
212
|
+
// put a name the reader may not see into a document they may.
|
|
213
|
+
export const DocumentLinkInlineType = "documentLink";
|
|
214
|
+
export const ResolveNodeLinksInput = z.strictObject({
|
|
215
|
+
nodeIds: z
|
|
216
|
+
.array(IntelId)
|
|
217
|
+
.min(1)
|
|
218
|
+
.max(200)
|
|
219
|
+
.describe("The link targets to name, as found in a document's documentLink elements. Unreachable and deleted targets are simply absent from the answer, so a shorter list than asked for is normal."),
|
|
220
|
+
});
|
|
221
|
+
export const ResolvedNodeLink = z.strictObject({
|
|
222
|
+
nodeId: IntelId,
|
|
223
|
+
title: z.string().min(1).max(240),
|
|
224
|
+
});
|
|
225
|
+
// ⚠️ Only what the asking reader may see is in here, and an unreachable target is simply absent —
|
|
226
|
+
// never a row with an empty title, never a count, never a "restricted" marker. The list is what one
|
|
227
|
+
// side of a document link is drawn from, and an entry that says "something is here" is exactly the
|
|
228
|
+
// leak this schema has to make impossible to write by accident. Deleted and unreadable therefore
|
|
229
|
+
// look identical from the outside, which is the point.
|
|
230
|
+
export const ResolveNodeLinksResult = z.strictObject({
|
|
231
|
+
items: z.array(ResolvedNodeLink),
|
|
232
|
+
});
|
|
233
|
+
export const NodeGraphInput = z.strictObject({
|
|
234
|
+
limit: z
|
|
235
|
+
.number()
|
|
236
|
+
.int()
|
|
237
|
+
.min(1)
|
|
238
|
+
.max(500)
|
|
239
|
+
.default(250)
|
|
240
|
+
.describe("How many nodes the graph may carry. The links returned are the ones between them."),
|
|
241
|
+
});
|
|
242
|
+
export const NodeGraph = z.strictObject({
|
|
243
|
+
nodes: z.array(Node),
|
|
244
|
+
links: z.array(NodeLink),
|
|
245
|
+
});
|
|
246
|
+
export const BlockNoteMediaType = "application/vnd.anchrd.intel.blocknote+json";
|
|
247
|
+
export const BlockNoteDocument = z.strictObject({
|
|
248
|
+
format: z.literal("blocknote"),
|
|
249
|
+
schemaVersion: z.literal(1),
|
|
250
|
+
blocks: z.array(z.record(z.string(), z.unknown())),
|
|
251
|
+
markdown: z.string(),
|
|
252
|
+
});
|
|
253
|
+
// `scopeId` is a cut, never a grant (#126): it narrows an answer the actor is already entitled to
|
|
254
|
+
// and can only ever remove rows. Without it the search stays global over everything visible, which
|
|
255
|
+
// is why it is optional rather than nullable — an absent field and `null` would otherwise be two
|
|
256
|
+
// spellings of the same request.
|
|
257
|
+
export const SearchInput = z.strictObject({
|
|
258
|
+
query: z
|
|
259
|
+
.string()
|
|
260
|
+
.trim()
|
|
261
|
+
.min(1)
|
|
262
|
+
.max(500)
|
|
263
|
+
.describe("What to look for, in the reader's own words. Matched both lexically and semantically, so a question works as well as keywords."),
|
|
264
|
+
limit: z
|
|
265
|
+
.number()
|
|
266
|
+
.int()
|
|
267
|
+
.min(1)
|
|
268
|
+
.max(50)
|
|
269
|
+
.default(10)
|
|
270
|
+
.describe("How many citations to return, best first."),
|
|
271
|
+
scopeId: IntelId.optional().describe("Optional folder node id. When given, only nodes filed in that folder or beneath it are searched."),
|
|
272
|
+
});
|
|
273
|
+
export const NodeCitation = z.strictObject({
|
|
274
|
+
nodeId: IntelId,
|
|
275
|
+
versionId: IntelId,
|
|
276
|
+
title: z.string(),
|
|
277
|
+
passage: z.string(),
|
|
278
|
+
source: z.string(),
|
|
279
|
+
freshness: IsoDateTime,
|
|
280
|
+
score: z.number().min(0).max(1),
|
|
281
|
+
match: z.enum(["lexical", "semantic", "hybrid"]),
|
|
282
|
+
});
|
|
283
|
+
export const SearchResult = z.strictObject({
|
|
284
|
+
items: z.array(NodeCitation),
|
|
285
|
+
});
|
|
286
|
+
export const ReindexResult = z.strictObject({ queued: z.number().int().nonnegative() });
|