@batalabs/virlow-mcp-core 3.19.0 → 3.68.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/LICENSE +8 -18
- package/README.md +1 -1
- package/dist/api.d.ts +14 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +6 -0
- package/dist/api.js.map +1 -1
- package/dist/attrs-extract.d.ts +48 -0
- package/dist/attrs-extract.d.ts.map +1 -0
- package/dist/attrs-extract.js +153 -0
- package/dist/attrs-extract.js.map +1 -0
- package/dist/attrs.d.ts +445 -0
- package/dist/attrs.d.ts.map +1 -0
- package/dist/attrs.js +604 -0
- package/dist/attrs.js.map +1 -0
- package/dist/cjs/api.d.ts +14 -0
- package/dist/cjs/api.js +6 -0
- package/dist/cjs/attrs-extract.d.ts +47 -0
- package/dist/cjs/attrs-extract.js +159 -0
- package/dist/cjs/attrs.d.ts +444 -0
- package/dist/cjs/attrs.js +635 -0
- package/dist/cjs/index.d.ts +4 -0
- package/dist/cjs/index.js +22 -1
- package/dist/cjs/memories.d.ts +79 -1
- package/dist/cjs/memories.js +249 -15
- package/dist/cjs/memory-graph.d.ts +105 -0
- package/dist/cjs/memory-graph.js +270 -0
- package/dist/cjs/memory-note.d.ts +57 -0
- package/dist/cjs/memory-note.js +174 -10
- package/dist/cjs/memory-secrets.d.ts +19 -0
- package/dist/cjs/memory-secrets.js +108 -0
- package/dist/cjs/notes.d.ts +208 -2
- package/dist/cjs/notes.js +721 -12
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/memories.d.ts +79 -1
- package/dist/memories.d.ts.map +1 -1
- package/dist/memories.js +249 -15
- package/dist/memories.js.map +1 -1
- package/dist/memory-graph.d.ts +106 -0
- package/dist/memory-graph.d.ts.map +1 -0
- package/dist/memory-graph.js +258 -0
- package/dist/memory-graph.js.map +1 -0
- package/dist/memory-note.d.ts +57 -0
- package/dist/memory-note.d.ts.map +1 -1
- package/dist/memory-note.js +170 -10
- package/dist/memory-note.js.map +1 -1
- package/dist/memory-secrets.d.ts +20 -0
- package/dist/memory-secrets.d.ts.map +1 -0
- package/dist/memory-secrets.js +103 -0
- package/dist/memory-secrets.js.map +1 -0
- package/dist/notes.d.ts +208 -2
- package/dist/notes.d.ts.map +1 -1
- package/dist/notes.js +722 -13
- package/dist/notes.js.map +1 -1
- package/dist/tools.d.ts +2 -2
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +464 -9
- package/dist/tools.js.map +1 -1
- package/package.json +15 -5
package/dist/attrs.d.ts
ADDED
|
@@ -0,0 +1,445 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The structured record every note carries next to its body, and the
|
|
3
|
+
* definitions record every folder carries. Both are encrypted on the device
|
|
4
|
+
* as v2 string blobs with their own IV, so a folder's properties and links can
|
|
5
|
+
* be read without decrypting a single body. Versioned; readers keep fields they
|
|
6
|
+
* do not know so a newer client's data survives an older one's round trip.
|
|
7
|
+
* A decoded version number is preserved as-is (falling back to 1 only when it
|
|
8
|
+
* is missing or not a finite number), so re-encoding never downgrades a blob
|
|
9
|
+
* written by a newer client.
|
|
10
|
+
*/
|
|
11
|
+
export type TagsValue = {
|
|
12
|
+
t: 'multiSelect';
|
|
13
|
+
v: string[];
|
|
14
|
+
};
|
|
15
|
+
export type PropValue = TagsValue | {
|
|
16
|
+
t: 'text';
|
|
17
|
+
v: string;
|
|
18
|
+
} | {
|
|
19
|
+
t: 'number';
|
|
20
|
+
v: number;
|
|
21
|
+
} | {
|
|
22
|
+
t: 'select';
|
|
23
|
+
v: string;
|
|
24
|
+
} | {
|
|
25
|
+
t: 'date';
|
|
26
|
+
v: string;
|
|
27
|
+
end?: string;
|
|
28
|
+
} | {
|
|
29
|
+
t: 'checkbox';
|
|
30
|
+
v: boolean;
|
|
31
|
+
} | {
|
|
32
|
+
t: 'url';
|
|
33
|
+
v: string;
|
|
34
|
+
} | {
|
|
35
|
+
t: 'relation';
|
|
36
|
+
v: string[];
|
|
37
|
+
};
|
|
38
|
+
export interface NoteAttrsV1 {
|
|
39
|
+
v: 1;
|
|
40
|
+
/** property id -> value. Definitions live in the folder schema (epic 3). */
|
|
41
|
+
props: Record<string, PropValue>;
|
|
42
|
+
/** outgoing note ids from links in the body */
|
|
43
|
+
links: string[];
|
|
44
|
+
/** note ids whose title appears in the body without a link */
|
|
45
|
+
mentions: string[];
|
|
46
|
+
/** alternative titles this note answers to */
|
|
47
|
+
aliases?: string[];
|
|
48
|
+
/** ISO time attrs were last recomputed */
|
|
49
|
+
updated: string;
|
|
50
|
+
}
|
|
51
|
+
/** The kinds of property a folder schema can define. `tags` is the reserved
|
|
52
|
+
* `multiSelect` property already named `TAGS_PROP` below. */
|
|
53
|
+
export type PropType = 'text' | 'number' | 'select' | 'multiSelect' | 'date' | 'checkbox' | 'url' | 'relation';
|
|
54
|
+
/** One choice in a `select` or `multiSelect` property's option list. */
|
|
55
|
+
export interface PropOption {
|
|
56
|
+
id: string;
|
|
57
|
+
name: string;
|
|
58
|
+
color?: string;
|
|
59
|
+
}
|
|
60
|
+
export interface PropDefinition {
|
|
61
|
+
/** stable random id; renames do not change it */
|
|
62
|
+
id: string;
|
|
63
|
+
name: string;
|
|
64
|
+
type: PropType;
|
|
65
|
+
/** select and multiSelect only */
|
|
66
|
+
options?: PropOption[];
|
|
67
|
+
order: number;
|
|
68
|
+
showInList?: boolean;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* One block on a workspace's home surface.
|
|
72
|
+
*
|
|
73
|
+
* A home is not a note and holds no authored document. Every widget here
|
|
74
|
+
* reads the workspace's own notes and shows what is true right now, which is
|
|
75
|
+
* the whole difference: a note goes stale and a home cannot. The one
|
|
76
|
+
* exception is `text`, a short line of context the owner writes, capped so a
|
|
77
|
+
* home can never become a document by the back door.
|
|
78
|
+
*
|
|
79
|
+
* `breakdown` and `upcoming` name a property by id. The property may have
|
|
80
|
+
* been deleted since, so a reader must tolerate one that resolves to nothing
|
|
81
|
+
* rather than assume it is there.
|
|
82
|
+
*/
|
|
83
|
+
/**
|
|
84
|
+
* How much of the home's two-column grid a block takes.
|
|
85
|
+
*
|
|
86
|
+
* Blocks flow in order and a `half` pairs with the next `half` beside it, so
|
|
87
|
+
* the arrangement is a list with widths rather than two independent columns.
|
|
88
|
+
* That keeps reordering a single sequence, which is what a drag can express;
|
|
89
|
+
* real columns would need a drag to carry both a position and a column.
|
|
90
|
+
*/
|
|
91
|
+
/**
|
|
92
|
+
* A filter on one property.
|
|
93
|
+
*
|
|
94
|
+
* Deliberately a short closed set rather than a query builder. Every operator
|
|
95
|
+
* here answers a question people actually ask of a folder ("which specs are in
|
|
96
|
+
* review", "what has no owner yet", "what is still unshipped"), and each is one
|
|
97
|
+
* click from a menu. A general builder would need an expression tree, a
|
|
98
|
+
* parser and a UI to edit one, and none of the views need that to be useful.
|
|
99
|
+
*
|
|
100
|
+
* `op` is keyed to what the property type can mean, not to a generic
|
|
101
|
+
* comparison: `is` for a select's single choice, `has` for one of a
|
|
102
|
+
* multiSelect's several, `checked` for the only two states a checkbox has.
|
|
103
|
+
*
|
|
104
|
+
* Shared with the dashboard's table and tasks blocks, so an assistant writing
|
|
105
|
+
* a dashboard and a person picking from the notes pane's menu produce the same
|
|
106
|
+
* thing.
|
|
107
|
+
*/
|
|
108
|
+
export type PropertyFilter =
|
|
109
|
+
/** select: the value is exactly this option. */
|
|
110
|
+
{
|
|
111
|
+
propId: string;
|
|
112
|
+
op: 'is';
|
|
113
|
+
value: string;
|
|
114
|
+
}
|
|
115
|
+
/** multiSelect: this option is among the values. */
|
|
116
|
+
| {
|
|
117
|
+
propId: string;
|
|
118
|
+
op: 'has';
|
|
119
|
+
value: string;
|
|
120
|
+
} | {
|
|
121
|
+
propId: string;
|
|
122
|
+
op: 'checked';
|
|
123
|
+
} | {
|
|
124
|
+
propId: string;
|
|
125
|
+
op: 'unchecked';
|
|
126
|
+
}
|
|
127
|
+
/** No value at all, which includes an empty string and an empty list. */
|
|
128
|
+
| {
|
|
129
|
+
propId: string;
|
|
130
|
+
op: 'empty';
|
|
131
|
+
} | {
|
|
132
|
+
propId: string;
|
|
133
|
+
op: 'notEmpty';
|
|
134
|
+
};
|
|
135
|
+
export declare function isPropertyFilter(value: unknown): value is PropertyFilter;
|
|
136
|
+
export declare function matchesFilter(attrs: NoteAttrsV1 | null | undefined, filter: PropertyFilter): boolean;
|
|
137
|
+
/** Every filter passes. Filters across different properties are an AND: each
|
|
138
|
+
* one narrows what the last one left, which is what picking two of them from
|
|
139
|
+
* a menu looks like it should do. */
|
|
140
|
+
export declare function matchesAll(attrs: NoteAttrsV1 | null | undefined, filters: PropertyFilter[] | undefined): boolean;
|
|
141
|
+
/**
|
|
142
|
+
* How a table block orders its rows.
|
|
143
|
+
*
|
|
144
|
+
* `by` is a property id, `'title'`, or one of the two note dates
|
|
145
|
+
* (LAST_CHANGED, CREATED). Absent means last changed, newest first, which is
|
|
146
|
+
* what every listing in the app opens on.
|
|
147
|
+
*/
|
|
148
|
+
export interface HomeSort {
|
|
149
|
+
by: string;
|
|
150
|
+
dir: 'asc' | 'desc';
|
|
151
|
+
}
|
|
152
|
+
export declare function isHomeSort(value: unknown): value is HomeSort;
|
|
153
|
+
export type PinnedLook = 'list' | 'notes';
|
|
154
|
+
/** The most notes one pinned block holds. Past this it is a listing, and a
|
|
155
|
+
* table with a filter is the block for a listing. */
|
|
156
|
+
export declare const PINNED_MAX = 50;
|
|
157
|
+
/** The longest a table block's title may be: a heading, not a description. */
|
|
158
|
+
export declare const HOME_TITLE_MAX = 60;
|
|
159
|
+
export type WidgetSpan = 'half' | 'full';
|
|
160
|
+
export type HomeWidget = {
|
|
161
|
+
id: string;
|
|
162
|
+
span?: WidgetSpan;
|
|
163
|
+
} & ({
|
|
164
|
+
kind: 'counts';
|
|
165
|
+
} | {
|
|
166
|
+
kind: 'recent';
|
|
167
|
+
limit?: number;
|
|
168
|
+
} | {
|
|
169
|
+
kind: 'starred';
|
|
170
|
+
limit?: number;
|
|
171
|
+
}
|
|
172
|
+
/** How many notes hold each option of a select property. */
|
|
173
|
+
| {
|
|
174
|
+
kind: 'breakdown';
|
|
175
|
+
propId: string;
|
|
176
|
+
}
|
|
177
|
+
/** Notes whose date property falls within the next `days`. */
|
|
178
|
+
| {
|
|
179
|
+
kind: 'upcoming';
|
|
180
|
+
propId: string;
|
|
181
|
+
days?: number;
|
|
182
|
+
} | {
|
|
183
|
+
kind: 'text';
|
|
184
|
+
body: string;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Written prose, longer than `text`, that says who wrote it and when.
|
|
188
|
+
*
|
|
189
|
+
* The rest of this page is computed on every render, which is what lets it
|
|
190
|
+
* claim it cannot disagree with the workspace it describes. A summary
|
|
191
|
+
* cannot make that claim: it is a snapshot, and it is wrong the moment the
|
|
192
|
+
* work moves past it. So it carries the date it was written and the page
|
|
193
|
+
* shows it, because a stale sentence that looks like a live figure is worse
|
|
194
|
+
* than no sentence.
|
|
195
|
+
*
|
|
196
|
+
* The date, and not who wrote it. Staleness is the thing a reader has to
|
|
197
|
+
* judge; an author's name is branding on somebody else's workspace, and it
|
|
198
|
+
* would put an assistant's name on a page the person thinks of as theirs.
|
|
199
|
+
* `at` is an ISO timestamp.
|
|
200
|
+
*/
|
|
201
|
+
| {
|
|
202
|
+
kind: 'summary';
|
|
203
|
+
body: string;
|
|
204
|
+
at?: string;
|
|
205
|
+
}
|
|
206
|
+
/** The workspace's notes as rows, with the workspace's properties as
|
|
207
|
+
* columns. Capped by `limit`: a home is a summary, and a block that runs to
|
|
208
|
+
* two thousand rows has stopped being one. */
|
|
209
|
+
/** A table of the workspace's notes.
|
|
210
|
+
* `filters` narrow it (every one must pass), `sort` orders it, and `title`
|
|
211
|
+
* names it; a filtered table with no title is named after its filters.
|
|
212
|
+
* Together they turn one block into a saved view ("Open proposals", "Due
|
|
213
|
+
* this week"), which is what makes a dashboard worth arranging. */
|
|
214
|
+
| {
|
|
215
|
+
kind: 'table';
|
|
216
|
+
limit?: number;
|
|
217
|
+
title?: string;
|
|
218
|
+
filters?: PropertyFilter[];
|
|
219
|
+
sort?: HomeSort;
|
|
220
|
+
}
|
|
221
|
+
/** The unticked checklist items across the workspace's notes, grouped by
|
|
222
|
+
* note and tickable in place. Read from note bodies, the one block that
|
|
223
|
+
* is; a task lives in the note it was written in and nowhere else. */
|
|
224
|
+
| {
|
|
225
|
+
kind: 'tasks';
|
|
226
|
+
limit?: number;
|
|
227
|
+
filters?: PropertyFilter[];
|
|
228
|
+
}
|
|
229
|
+
/** A capture line and a New note button: the dashboard as a place to
|
|
230
|
+
* start something, not only to look. What is jotted becomes a note in
|
|
231
|
+
* the workspace (unfiled on the account-wide home). No settings. */
|
|
232
|
+
| {
|
|
233
|
+
kind: 'quick';
|
|
234
|
+
}
|
|
235
|
+
/** Notes chosen by hand, in the order given. Distinct from Starred, which
|
|
236
|
+
* is a property of the note and follows it everywhere; a pin is a property
|
|
237
|
+
* of this dashboard. Ids of notes no longer in the workspace are skipped on
|
|
238
|
+
* read and kept in the list, so a note moved back comes back. */
|
|
239
|
+
| {
|
|
240
|
+
kind: 'pinned';
|
|
241
|
+
noteIds: string[];
|
|
242
|
+
/** How the pins are drawn: a list of titles, or sticky notes with a
|
|
243
|
+
* tinted card each. Absent means list. */
|
|
244
|
+
look?: PinnedLook;
|
|
245
|
+
/** Sticky-note colour per note id, by palette name ("Amber", "Rose").
|
|
246
|
+
* A note without one takes the next colour in rotation, so a board
|
|
247
|
+
* of pins reads as a spread rather than a stack. */
|
|
248
|
+
colors?: Record<string, string>;
|
|
249
|
+
}
|
|
250
|
+
/** A calendar. `propId` names a date property, or LAST_CHANGED for the
|
|
251
|
+
* notes' own edit times, which need no property to exist. `range` is the
|
|
252
|
+
* span it opens on, a week unless somebody chose otherwise. */
|
|
253
|
+
| {
|
|
254
|
+
kind: 'calendar';
|
|
255
|
+
propId: string;
|
|
256
|
+
range?: 'week' | 'month';
|
|
257
|
+
}
|
|
258
|
+
/** Columns from the options of a select property, notes dragged between
|
|
259
|
+
* them. Only `select` can group one: see BoardView for why. */
|
|
260
|
+
| {
|
|
261
|
+
kind: 'board';
|
|
262
|
+
propId: string;
|
|
263
|
+
}
|
|
264
|
+
/** How many notes changed in each of the last `weeks` weeks. Answers
|
|
265
|
+
* whether a workspace is moving, which no count of its size can. */
|
|
266
|
+
| {
|
|
267
|
+
kind: 'activity';
|
|
268
|
+
weeks?: number;
|
|
269
|
+
}
|
|
270
|
+
/** Notes nothing has touched in `days`. The useful opposite of Recently
|
|
271
|
+
* changed: what a workspace has quietly stopped working on. */
|
|
272
|
+
| {
|
|
273
|
+
kind: 'stale';
|
|
274
|
+
days?: number;
|
|
275
|
+
limit?: number;
|
|
276
|
+
});
|
|
277
|
+
export interface FolderHomeV1 {
|
|
278
|
+
widgets: HomeWidget[];
|
|
279
|
+
/**
|
|
280
|
+
* The arrangement this one replaced, so a change can be put back.
|
|
281
|
+
*
|
|
282
|
+
* One level, deliberately: this is an undo, not a history, and the schema
|
|
283
|
+
* travels inside every read of the folder. It matters most for a change an
|
|
284
|
+
* assistant made, because a dashboard edit can remove a block and leave
|
|
285
|
+
* nothing behind to say what was there.
|
|
286
|
+
*/
|
|
287
|
+
previous?: HomeWidget[];
|
|
288
|
+
}
|
|
289
|
+
export interface FolderSchemaV1 {
|
|
290
|
+
v: 1;
|
|
291
|
+
/** property definitions, in the order they were added; use sortedProps to read them in display order */
|
|
292
|
+
properties: PropDefinition[];
|
|
293
|
+
views: {
|
|
294
|
+
default: 'list' | 'table' | 'board' | 'calendar';
|
|
295
|
+
};
|
|
296
|
+
/** The home surface's composition. Absent means the workspace has never
|
|
297
|
+
* been configured, and readers fall back to DEFAULT_HOME_WIDGETS. */
|
|
298
|
+
home?: FolderHomeV1;
|
|
299
|
+
templateId?: string;
|
|
300
|
+
}
|
|
301
|
+
/** The longest a `text` widget may be. A home is a surface, not a document;
|
|
302
|
+
* anything longer belongs in a note. */
|
|
303
|
+
export declare const HOME_TEXT_MAX = 280;
|
|
304
|
+
/** The longest a `summary` may be. Room for a paragraph or two of context,
|
|
305
|
+
* and short of the point where the dashboard becomes a document. */
|
|
306
|
+
export declare const HOME_SUMMARY_MAX = 2000;
|
|
307
|
+
export declare function spanOf(widget: HomeWidget): WidgetSpan;
|
|
308
|
+
/** True for a block this build can draw. Exported so the MCP layer can refuse
|
|
309
|
+
* one at the tool boundary rather than writing it and skipping it on read. */
|
|
310
|
+
export declare function isHomeWidget(value: unknown): value is HomeWidget;
|
|
311
|
+
/**
|
|
312
|
+
* What a workspace shows when nobody has arranged its home.
|
|
313
|
+
*
|
|
314
|
+
* A default rather than an empty screen: a workspace should be worth opening
|
|
315
|
+
* the first time, and these three need no configuration to mean something.
|
|
316
|
+
*/
|
|
317
|
+
export declare const DEFAULT_HOME_WIDGETS: HomeWidget[];
|
|
318
|
+
/**
|
|
319
|
+
* The widgets to draw, dropping any this build cannot read.
|
|
320
|
+
*
|
|
321
|
+
* Mirrors sortedProps: a newer client may write a kind this one does not
|
|
322
|
+
* know, and the right answer is to skip it rather than to throw away the
|
|
323
|
+
* whole home or crash rendering it.
|
|
324
|
+
*/
|
|
325
|
+
/**
|
|
326
|
+
* A home with `widgets` written out in full.
|
|
327
|
+
*
|
|
328
|
+
* The first edit to a workspace that has never been arranged has to write the
|
|
329
|
+
* defaults down alongside the change. Otherwise removing a default block does
|
|
330
|
+
* nothing: homeWidgets would see an empty list, fall back, and put it
|
|
331
|
+
* straight back. Materialising turns "no opinion" into "this arrangement",
|
|
332
|
+
* which is what an edit means.
|
|
333
|
+
*/
|
|
334
|
+
export declare function withHomeWidgets(schema: FolderSchemaV1, widgets: HomeWidget[]): FolderSchemaV1;
|
|
335
|
+
/** A widget id that will not collide with another in the same home. */
|
|
336
|
+
export declare function newWidgetId(): string;
|
|
337
|
+
export declare function homeWidgets(schema: FolderSchemaV1 | null | undefined,
|
|
338
|
+
/** The workspace's properties. Given them, an unarranged home leads with a
|
|
339
|
+
* calendar when there is a date property to place notes on. Omitted, the
|
|
340
|
+
* default is the plain three, which is what a caller with no schema to
|
|
341
|
+
* hand should get. */
|
|
342
|
+
defs?: PropDefinition[]): HomeWidget[];
|
|
343
|
+
/**
|
|
344
|
+
* Starting arrangements.
|
|
345
|
+
*
|
|
346
|
+
* An empty page is where most people stall: every block exists, and none of
|
|
347
|
+
* them says which six to put together for a project. A preset is that
|
|
348
|
+
* answer written down, built from the workspace's own properties where it
|
|
349
|
+
* has them (a board wants a select, a calendar wants a date) and from the
|
|
350
|
+
* notes' own dates where it does not, so every preset draws something on
|
|
351
|
+
* the workspace it is applied to. Applying one replaces the arrangement,
|
|
352
|
+
* and the one it replaced is kept for undo like any other change.
|
|
353
|
+
*/
|
|
354
|
+
export declare const HOME_PRESETS: readonly ["project", "research", "journal"];
|
|
355
|
+
export type HomePreset = (typeof HOME_PRESETS)[number];
|
|
356
|
+
export declare const HOME_PRESET_LABELS: Record<HomePreset, {
|
|
357
|
+
name: string;
|
|
358
|
+
blurb: string;
|
|
359
|
+
}>;
|
|
360
|
+
export declare function isHomePreset(value: unknown): value is HomePreset;
|
|
361
|
+
export declare function presetWidgets(preset: HomePreset, defs?: PropDefinition[], id?: () => string): HomeWidget[];
|
|
362
|
+
/** True when a note is on one of this home's Pinned blocks. */
|
|
363
|
+
export declare function isPinned(schema: FolderSchemaV1 | null | undefined, noteId: string): boolean;
|
|
364
|
+
/**
|
|
365
|
+
* Pins a note to a workspace's home, or unpins it: what "Pin to dashboard" in
|
|
366
|
+
* a note's menu writes.
|
|
367
|
+
*
|
|
368
|
+
* Unpinning takes the note off every Pinned block it is on. Pinning puts it
|
|
369
|
+
* on the first block with room, and when the home has no Pinned block yet it
|
|
370
|
+
* adds one, as sticky notes, at the top: pinning from a note is a request to
|
|
371
|
+
* see it on the dashboard, and a pin into a block nobody can see is not that.
|
|
372
|
+
* An unarranged home is written out as its defaults plus the new block, so
|
|
373
|
+
* nothing already on it disappears.
|
|
374
|
+
*
|
|
375
|
+
* Null when every Pinned block is full, which the caller has to say.
|
|
376
|
+
*/
|
|
377
|
+
export declare function withPinToggled(schema: FolderSchemaV1, defs: PropDefinition[], noteId: string): FolderSchemaV1 | null;
|
|
378
|
+
/**
|
|
379
|
+
* The reserved property id meaning "place notes by when they last changed".
|
|
380
|
+
*
|
|
381
|
+
* Not a property: it is a fact every note already carries. A calendar could
|
|
382
|
+
* previously only be drawn by a workspace that had defined a date property,
|
|
383
|
+
* which made "calendar by default" false for exactly the workspaces that had
|
|
384
|
+
* never set anything up, which is most of them at the point somebody first
|
|
385
|
+
* opens a dashboard. A calendar of when you last touched things needs no
|
|
386
|
+
* setup and answers a real question.
|
|
387
|
+
*
|
|
388
|
+
* A calendar in this mode is read only: you cannot decide when a note was
|
|
389
|
+
* last edited.
|
|
390
|
+
*/
|
|
391
|
+
export declare const LAST_CHANGED = "@lastChanged";
|
|
392
|
+
/**
|
|
393
|
+
* The reserved property id meaning "place notes by when they were created".
|
|
394
|
+
*
|
|
395
|
+
* The other half of the same idea as LAST_CHANGED. They answer different
|
|
396
|
+
* questions and people want both: what have I touched lately, and what did I
|
|
397
|
+
* start when. Neither needs a workspace to have defined anything, and neither
|
|
398
|
+
* can be dragged, because you cannot decide when a note came into existence.
|
|
399
|
+
*/
|
|
400
|
+
export declare const CREATED = "@created";
|
|
401
|
+
/** True for the built-in date sources, which come from the note itself rather
|
|
402
|
+
* than from a property somebody defined. */
|
|
403
|
+
export declare function isNoteDate(propId: string): boolean;
|
|
404
|
+
/** The reserved property id that carries what used to be the plaintext tags column. */
|
|
405
|
+
export declare const TAGS_PROP = "tags";
|
|
406
|
+
/** Matches the server's cap on the encrypted attrs blob (HTTP 413
|
|
407
|
+
* `ATTRS_TOO_LARGE`), measured as UTF-8 bytes of the ciphertext string. The
|
|
408
|
+
* single source of truth for both mcp-core (notes.ts) and the web app
|
|
409
|
+
* (src/lib/attrs/next.ts), so the two never drift apart. */
|
|
410
|
+
export declare const ATTRS_MAX_BYTES = 16384;
|
|
411
|
+
/** Matches the server's cap on the encrypted folder schema blob (HTTP 413
|
|
412
|
+
* `SCHEMA_TOO_LARGE`), measured as UTF-8 bytes of the ciphertext string. Lives
|
|
413
|
+
* beside ATTRS_MAX_BYTES for the same reason: mcp-core (notes.ts) and the web
|
|
414
|
+
* app (src/hooks/useFolderSchema.ts) both refuse an oversize blob before
|
|
415
|
+
* sending it, and two copies of the number would eventually disagree. */
|
|
416
|
+
export declare const SCHEMA_MAX_BYTES = 32768;
|
|
417
|
+
export declare function formatProp(def: PropDefinition, value: PropValue | undefined): string;
|
|
418
|
+
export declare function emptyAttrs(now?: string): NoteAttrsV1;
|
|
419
|
+
export declare function emptySchema(): FolderSchemaV1;
|
|
420
|
+
/** 12 hex characters, enough entropy that two properties never collide. */
|
|
421
|
+
export declare function newPropId(): string;
|
|
422
|
+
/** Definitions in display order. Unknown shapes are dropped rather than
|
|
423
|
+
* thrown on: a newer client may write a type this one does not know. */
|
|
424
|
+
export declare function sortedProps(schema: FolderSchemaV1 | null | undefined): PropDefinition[];
|
|
425
|
+
/** Appends a new property definition, assigning it a fresh id (unless one is
|
|
426
|
+
* given) and an order past the current last property. Never mutates schema. */
|
|
427
|
+
export declare function defineProp(schema: FolderSchemaV1, def: Omit<PropDefinition, 'id' | 'order'> & {
|
|
428
|
+
id?: string;
|
|
429
|
+
}): FolderSchemaV1;
|
|
430
|
+
/** Patches a property definition by id, keeping its id fixed regardless of
|
|
431
|
+
* what the patch contains. Never mutates schema. */
|
|
432
|
+
export declare function updateProp(schema: FolderSchemaV1, id: string, patch: Partial<Omit<PropDefinition, 'id'>>): FolderSchemaV1;
|
|
433
|
+
/** Removes a property definition by id. Never mutates schema. */
|
|
434
|
+
export declare function removeProp(schema: FolderSchemaV1, id: string): FolderSchemaV1;
|
|
435
|
+
/** Reassigns order so the definitions match orderedIds; any definition whose
|
|
436
|
+
* id is not in the list keeps its relative position after the known ones.
|
|
437
|
+
* Never mutates schema. */
|
|
438
|
+
export declare function reorderProps(schema: FolderSchemaV1, orderedIds: string[]): FolderSchemaV1;
|
|
439
|
+
export declare function encodeAttrs(key: CryptoKey, attrs: NoteAttrsV1): Promise<string>;
|
|
440
|
+
export declare function decodeAttrs(key: CryptoKey, blob: string | null | undefined): Promise<NoteAttrsV1 | null>;
|
|
441
|
+
export declare function encodeSchema(key: CryptoKey, schema: FolderSchemaV1): Promise<string>;
|
|
442
|
+
export declare function decodeSchema(key: CryptoKey, blob: string | null | undefined): Promise<FolderSchemaV1 | null>;
|
|
443
|
+
export declare function tagsFromAttrs(attrs: NoteAttrsV1 | null | undefined): string[];
|
|
444
|
+
export declare function withTags(attrs: NoteAttrsV1, tags: string[], now?: string): NoteAttrsV1;
|
|
445
|
+
//# sourceMappingURL=attrs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attrs.d.ts","sourceRoot":"","sources":["../src/attrs.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,MAAM,MAAM,SAAS,GAAG;IAAE,CAAC,EAAE,aAAa,CAAC;IAAC,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAE1D,MAAM,MAAM,SAAS,GACjB,SAAS,GACT;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GACxB;IAAE,CAAC,EAAE,QAAQ,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1B;IAAE,CAAC,EAAE,QAAQ,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAC1B;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GACtC;IAAE,CAAC,EAAE,UAAU,CAAC;IAAC,CAAC,EAAE,OAAO,CAAA;CAAE,GAC7B;IAAE,CAAC,EAAE,KAAK,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GACv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