@ai-matrx/records 0.96.14 → 0.97.1

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/{client-D7bvxEZW.d.ts → client-MVuEbxKl.d.ts} +6 -0
  3. package/dist/{client-DKgbZUNt.d.cts → client-pFV_8AhM.d.cts} +6 -0
  4. package/dist/core/index.cjs +637 -3
  5. package/dist/core/index.cjs.map +1 -1
  6. package/dist/core/index.d.cts +3 -2
  7. package/dist/core/index.d.ts +3 -2
  8. package/dist/core/index.js +637 -3
  9. package/dist/core/index.js.map +1 -1
  10. package/dist/data/index.cjs +634 -0
  11. package/dist/data/index.cjs.map +1 -1
  12. package/dist/data/index.d.cts +2 -1
  13. package/dist/data/index.d.ts +2 -1
  14. package/dist/data/index.js +634 -0
  15. package/dist/data/index.js.map +1 -1
  16. package/dist/{declareTable-VoNRi_j_.d.cts → declareTable-Bekj6UwK.d.cts} +1 -1
  17. package/dist/{declareTable-D_CiMnXM.d.ts → declareTable-C7zVyyLA.d.ts} +1 -1
  18. package/dist/doors-C43_5HjC.d.ts +487 -0
  19. package/dist/doors-CJPHsohF.d.cts +487 -0
  20. package/dist/questions/index.d.cts +2 -1
  21. package/dist/questions/index.d.ts +2 -1
  22. package/dist/react/index.cjs +637 -3
  23. package/dist/react/index.cjs.map +1 -1
  24. package/dist/react/index.d.cts +338 -5
  25. package/dist/react/index.d.ts +338 -5
  26. package/dist/react/index.js +637 -3
  27. package/dist/react/index.js.map +1 -1
  28. package/dist/scopes/index.cjs +729 -0
  29. package/dist/scopes/index.cjs.map +1 -0
  30. package/dist/scopes/index.d.cts +33 -0
  31. package/dist/scopes/index.d.ts +33 -0
  32. package/dist/scopes/index.js +706 -0
  33. package/dist/scopes/index.js.map +1 -0
  34. package/dist/setup/index.cjs +634 -0
  35. package/dist/setup/index.cjs.map +1 -1
  36. package/dist/setup/index.d.cts +2 -1
  37. package/dist/setup/index.d.ts +2 -1
  38. package/dist/setup/index.js +634 -0
  39. package/dist/setup/index.js.map +1 -1
  40. package/dist/typed-table/index.cjs +634 -0
  41. package/dist/typed-table/index.cjs.map +1 -1
  42. package/dist/typed-table/index.d.cts +3 -2
  43. package/dist/typed-table/index.d.ts +3 -2
  44. package/dist/typed-table/index.js +634 -0
  45. package/dist/typed-table/index.js.map +1 -1
  46. package/dist/views/index.d.cts +2 -1
  47. package/dist/views/index.d.ts +2 -1
  48. package/package.json +13 -3
@@ -1,4 +1,4 @@
1
- import { R as RecordsClient } from './client-DKgbZUNt.cjs';
1
+ import { R as RecordsClient } from './client-pFV_8AhM.cjs';
2
2
  import { a as FieldTypeWord, N as NewFieldDeclaration } from './field-DjS7iId2.cjs';
3
3
  import { U as Uuid, a as RecordsError } from './record-zwSBU5PQ.cjs';
4
4
  import { F as FieldDrift } from './table-kind-CMXvN5Kb.cjs';
@@ -1,4 +1,4 @@
1
- import { R as RecordsClient } from './client-D7bvxEZW.js';
1
+ import { R as RecordsClient } from './client-MVuEbxKl.js';
2
2
  import { a as FieldTypeWord, N as NewFieldDeclaration } from './field-D-1OKy5r.js';
3
3
  import { U as Uuid, a as RecordsError } from './record-zwSBU5PQ.js';
4
4
  import { F as FieldDrift } from './table-kind-CjTL6PyT.js';
@@ -0,0 +1,487 @@
1
+ import { U as Uuid, R as RecordsResult } from './record-zwSBU5PQ.js';
2
+
3
+ /**
4
+ * What a context field holds, as a person thinks of it — derived from the Field's behaviour, `multi`,
5
+ * `format`, display format and `config.kind` (`contextFieldKind`). The value is always `value`; the
6
+ * kind says how to read and edit it.
7
+ */
8
+ type ContextFieldKind = "string" | "markdown" | "email" | "url" | "phone" | "color" | "number" | "percent" | "currency" | "boolean" | "date" | "datetime" | "time" | "object" | "array" | "reference" | "document";
9
+ declare const CONTEXT_FIELD_KINDS: readonly ContextFieldKind[];
10
+ /** The store's context policy on a Field: whether an agent receives it every turn, on request, or never. */
11
+ type ContextPolicy = "include" | "on_request" | "exclude";
12
+ /** The store's sensitivity words on a Field. */
13
+ type ContextSensitivity = "public" | "internal" | "confidential" | "restricted";
14
+ /** A scope type: a Table kept for context. */
15
+ interface ScopeType {
16
+ id: Uuid;
17
+ organization_id: Uuid;
18
+ label_singular: string;
19
+ label_plural: string;
20
+ icon: string;
21
+ color: string;
22
+ /** The Table's slug in the store's grammar (`practice_areas`). */
23
+ slug: string | null;
24
+ description: string;
25
+ sort_order: number;
26
+ max_assignments_per_entity: number | null;
27
+ default_variable_keys: string[];
28
+ /** Who made the type: with the organization's owners and admins, they shape it (`canShapeScopeType`). */
29
+ created_by: Uuid | null;
30
+ created_at: string;
31
+ updated_at: string;
32
+ }
33
+ /** A scope type with its live scopes, as the tree doors answer it. */
34
+ interface ScopeTypeWithScopes extends ScopeType {
35
+ scopes: Scope[];
36
+ }
37
+ /** A scope: a Record of its type's Table. */
38
+ interface Scope {
39
+ id: Uuid;
40
+ scope_type_id: Uuid;
41
+ organization_id: Uuid;
42
+ name: string;
43
+ description: string;
44
+ slug: string | null;
45
+ sort_order: number;
46
+ parent_scope_id: Uuid | null;
47
+ /** Free settings keys of the scope (each a Field of its Table the scope door derived). */
48
+ settings: Record<string, unknown>;
49
+ created_by: Uuid | null;
50
+ created_at: string;
51
+ updated_at: string;
52
+ }
53
+ /** A scope with its type's presentation (`custom.context_scopes`). */
54
+ interface ScopeWithType extends Scope {
55
+ scope_type: ScopeTypeLabel | null;
56
+ }
57
+ /** The presentation of a scope type: what a chip or a breadcrumb shows. */
58
+ interface ScopeTypeLabel {
59
+ id: Uuid;
60
+ label_singular: string;
61
+ label_plural: string;
62
+ icon: string | null;
63
+ color: string | null;
64
+ }
65
+ /** A scope type that was archived, with how many scopes went with it. */
66
+ interface ArchivedScopeType {
67
+ id: Uuid;
68
+ organization_id: Uuid;
69
+ label_singular: string;
70
+ label_plural: string;
71
+ icon: string;
72
+ color: string;
73
+ archived_at: string;
74
+ created_by: Uuid | null;
75
+ archived_scope_count: number;
76
+ }
77
+ /** A scope that was archived (a Record in the archive of its type's Table). */
78
+ interface ArchivedScope {
79
+ id: Uuid;
80
+ name: string | null;
81
+ slug: string | null;
82
+ archived_at: string | null;
83
+ }
84
+ /** A context field: a Field (column) of a scope type's Table. */
85
+ interface ContextField {
86
+ id: Uuid;
87
+ scope_type_id: Uuid;
88
+ organization_id: Uuid;
89
+ key: string;
90
+ label: string;
91
+ description: string;
92
+ kind: ContextFieldKind;
93
+ /** The Field's own words, for a caller that needs them (`type` is the store's behaviour word). */
94
+ type: string;
95
+ multi: boolean;
96
+ format: string | null;
97
+ config: Record<string, unknown>;
98
+ relation_target: Uuid | null;
99
+ /** Its place among the type's context fields, from 0. */
100
+ sort: number;
101
+ context_policy: ContextPolicy;
102
+ sensitivity: ContextSensitivity;
103
+ source: string;
104
+ status: string;
105
+ status_note: string | null;
106
+ category: string | null;
107
+ tags: string[];
108
+ max_items: number;
109
+ custom_component: unknown;
110
+ reference_source: unknown;
111
+ allowed_scope_type_ids: Uuid[] | null;
112
+ allowed_reference_types: string[] | null;
113
+ review_interval_days: number | null;
114
+ depends_on: string[];
115
+ /** The store's clock on this Field. */
116
+ version: number;
117
+ created_by: Uuid | null;
118
+ created_at: string;
119
+ updated_at: string;
120
+ }
121
+ /** One thing a reference cell points at. */
122
+ interface ContextReference {
123
+ /** The record id (for a file: the File record's id). */
124
+ id: Uuid;
125
+ /** What it is: `scope`, `file`, `table`, or another entity token. */
126
+ type: string;
127
+ /** Its name, where the door named it to this caller. */
128
+ label?: string;
129
+ /** For a file: the `files.files` id a viewer opens. */
130
+ file_id?: Uuid;
131
+ }
132
+ /** The cell holds only the first words of a text kept as a file, and the whole could not be read. */
133
+ interface IncompleteValue {
134
+ /** The cell's own first words. */
135
+ head: string;
136
+ /** The whole text's length in characters, when known. */
137
+ chars: number | null;
138
+ /** The file holding the whole text, when it has one yet. */
139
+ file_id: Uuid | null;
140
+ /** Why the whole text is not here, in one sentence. */
141
+ why: string;
142
+ }
143
+ /** A context value: one cell of a scope's Record. */
144
+ interface ContextValue {
145
+ scope_id: Uuid;
146
+ field_id: Uuid;
147
+ key: string;
148
+ kind: ContextFieldKind;
149
+ /**
150
+ * THE CELL, as the store holds it (a text, a number, a boolean, an ISO date, a list, an object).
151
+ * A reference or document cell is its `references` (ids here). A text kept as a file is its whole
152
+ * text when the read could open the file (`completeWholeValues`), else the first words and `incomplete`.
153
+ */
154
+ value: unknown;
155
+ /** A reference / document cell, decoded: what it points at, with names the caller may see. */
156
+ references: ContextReference[];
157
+ /** The version a PERSON made (system rewrites never move it). */
158
+ version: number;
159
+ set_at: string | null;
160
+ source_type: string | null;
161
+ authored_by: Uuid | null;
162
+ /** The pointer to the file holding a text too big for one cell, when the cell holds only its start. */
163
+ whole_value: StoreWholeValue | null;
164
+ /** Present only when `value` is not the whole text — never save it back as the value. */
165
+ incomplete: IncompleteValue | null;
166
+ }
167
+ /** The file fields of a whole-value pointer, as `custom.context_values` answers them. */
168
+ interface StoreWholeValue {
169
+ kind: string;
170
+ file_id?: Uuid | null;
171
+ file_record?: Uuid | null;
172
+ bytes?: number | null;
173
+ chars?: number | null;
174
+ sha256?: string | null;
175
+ shown_chars?: number | null;
176
+ mime?: string | null;
177
+ pending?: boolean | null;
178
+ in_value?: boolean | null;
179
+ }
180
+ /** The scope types of some organizations, without their scopes, and how many each holds. */
181
+ interface ScopeTypeSkeleton {
182
+ types: ScopeType[];
183
+ /** type id → how many scopes the caller sees in it; null when asked without counts. */
184
+ counts: Record<Uuid, number> | null;
185
+ }
186
+ /** One page of one type's scopes. */
187
+ interface ScopePage {
188
+ scopes: Scope[];
189
+ total: number;
190
+ next_offset: number | null;
191
+ }
192
+ /** A System Context item (`context.system_context_item`), as `custom.context_system_items` answers it. */
193
+ interface SystemContextItem {
194
+ [key: string]: unknown;
195
+ }
196
+ /** One scope template of the gallery, as `custom.context_templates` answers it. */
197
+ interface ScopeTemplate {
198
+ [key: string]: unknown;
199
+ }
200
+ /** A new scope type, or the parts of one to change (`undefined` = leave as it is). */
201
+ interface ScopeTypeSpec {
202
+ label_singular?: string;
203
+ label_plural?: string;
204
+ icon?: string;
205
+ color?: string;
206
+ description?: string;
207
+ sort_order?: number;
208
+ max_assignments_per_entity?: number | null;
209
+ default_variable_keys?: string[];
210
+ /** Any spelling; the package writes it in the store's grammar. Absent on create = from the label. */
211
+ slug?: string;
212
+ }
213
+ /** A new scope, or the parts of one to change. */
214
+ interface ScopeSpec {
215
+ name?: string;
216
+ description?: string;
217
+ settings?: Record<string, unknown>;
218
+ parent_scope_id?: Uuid | null;
219
+ slug?: string;
220
+ sort_order?: number;
221
+ }
222
+ /** A new context field, or the parts of one to change (`null` clears). */
223
+ interface ContextFieldSpec {
224
+ key?: string;
225
+ label?: string;
226
+ kind?: ContextFieldKind;
227
+ description?: string;
228
+ category?: string | null;
229
+ context_policy?: ContextPolicy;
230
+ sensitivity?: ContextSensitivity;
231
+ tags?: string[];
232
+ sort?: number;
233
+ status?: string;
234
+ status_note?: string | null;
235
+ custom_component?: unknown;
236
+ review_interval_days?: number | null;
237
+ allowed_reference_types?: string[] | null;
238
+ max_items?: number | null;
239
+ allowed_scope_type_ids?: Uuid[] | null;
240
+ reference_source?: unknown;
241
+ }
242
+ /** One cell to write. `value` is the cell as `ContextValue.value` reads it; a reference cell takes `references`. */
243
+ interface ContextValueWrite {
244
+ scope_id: Uuid;
245
+ field_id: Uuid;
246
+ kind: ContextFieldKind;
247
+ value?: unknown;
248
+ /** A reference / document cell: the things it points at (replaces the cell). */
249
+ references?: ContextReference[];
250
+ /** Who wrote it: `manual` from a person's own edit (the store's default is `ai_enriched`). */
251
+ source_type?: string;
252
+ change_summary?: string;
253
+ }
254
+ /** What a written cell answers. */
255
+ interface ContextValueWritten {
256
+ scope_id: Uuid;
257
+ field_id: Uuid;
258
+ version: number;
259
+ source_type: string;
260
+ }
261
+
262
+ /** A scope type as the tree doors answer it. */
263
+ interface StoreTypeRow {
264
+ id: string;
265
+ organization_id: string;
266
+ label_singular?: string | null;
267
+ label_plural?: string | null;
268
+ name?: string | null;
269
+ icon?: string | null;
270
+ color?: string | null;
271
+ slug?: string | null;
272
+ description?: string | null;
273
+ sort_order?: number | null;
274
+ max_assignments_per_entity?: number | null;
275
+ default_variable_keys?: string[] | null;
276
+ created_by?: string | null;
277
+ created_at?: string | null;
278
+ updated_at?: string | null;
279
+ scope_count?: number | null;
280
+ }
281
+ /** A scope as the tree and scope doors answer it. */
282
+ interface StoreScopeRow {
283
+ id: string;
284
+ scope_type_id: string;
285
+ organization_id: string;
286
+ name?: string | null;
287
+ description?: string | null;
288
+ slug?: string | null;
289
+ sort_order?: number | string | null;
290
+ parent_scope_id?: string | null;
291
+ settings?: Record<string, unknown> | null;
292
+ created_by?: string | null;
293
+ created_at?: string | null;
294
+ updated_at?: string | null;
295
+ scope_type?: (Partial<StoreTypeRow> & {
296
+ id: string;
297
+ }) | null;
298
+ }
299
+ /** A Field document, as `custom.context_items` / `custom.context_values` answer it. */
300
+ interface StoreFieldDoc {
301
+ key?: string;
302
+ label?: string;
303
+ type?: string;
304
+ multi?: boolean | null;
305
+ format?: string | null;
306
+ display_format?: {
307
+ id?: string;
308
+ } | null;
309
+ config?: ({
310
+ kind?: string;
311
+ } & Record<string, unknown>) | null;
312
+ relation_target?: string | null;
313
+ sort?: number | string | null;
314
+ description?: string | null;
315
+ sensitivity?: string | null;
316
+ context_policy?: string | null;
317
+ source?: string | null;
318
+ status?: string | null;
319
+ status_note?: string | null;
320
+ category?: string | null;
321
+ tags?: string[] | null;
322
+ max_items?: number | null;
323
+ custom_component?: unknown;
324
+ reference_source?: unknown;
325
+ allowed_scope_type_ids?: string[] | null;
326
+ allowed_reference_types?: string[] | null;
327
+ review_interval_days?: number | null;
328
+ depends_on?: string[] | null;
329
+ [extra: string]: unknown;
330
+ }
331
+ /** What the store remembers about a field it moved from the old tables and could not type. */
332
+ interface StoreCarried {
333
+ value_type?: string;
334
+ as_text?: boolean;
335
+ is_active?: boolean;
336
+ }
337
+ /** A context field as `custom.context_items` answers it. */
338
+ interface StoreItemRow {
339
+ id: string;
340
+ scope_type_id: string;
341
+ organization_id: string;
342
+ data: StoreFieldDoc;
343
+ carried?: StoreCarried | null;
344
+ created_by?: string | null;
345
+ created_at?: string | null;
346
+ updated_at?: string | null;
347
+ version?: number | null;
348
+ }
349
+ /** A cell as `custom.context_values` answers it. */
350
+ interface StoreValueRow {
351
+ scope_id: string;
352
+ context_item_id: string;
353
+ key: string;
354
+ value: unknown;
355
+ field?: (Pick<StoreFieldDoc, "type" | "multi" | "format" | "display_format" | "config" | "relation_target"> & {
356
+ carried?: StoreCarried | null;
357
+ }) | null;
358
+ version?: number | null;
359
+ store_version?: number | null;
360
+ set_at?: string | null;
361
+ source_type?: string | null;
362
+ value_id?: string | null;
363
+ authored_by?: string | null;
364
+ labels?: Record<string, string> | null;
365
+ files?: Record<string, string> | null;
366
+ whole_value?: StoreWholeValue | null;
367
+ }
368
+ declare function scopeTypeFromStore(row: StoreTypeRow): ScopeType;
369
+ /**
370
+ * A settings value as it was written. The scope door keeps a list-of-objects setting (a class's exam
371
+ * dates) as a list of their JSON texts (`custom._ctx_words`); read back, each is the object again.
372
+ */
373
+ declare function settingFromStore(value: unknown): unknown;
374
+ declare function scopeFromStore(row: StoreScopeRow): Scope;
375
+ declare function scopeWithTypeFromStore(row: StoreScopeRow): ScopeWithType;
376
+ /** The file kernel: a relation at it is a document (a file), never a reference to a row. */
377
+ declare const FILE_KERNEL_ID = "11111111-0000-4000-8000-000000000006";
378
+ /** What a Field holds, as a person thinks of it. */
379
+ declare function contextFieldKind(doc: Pick<StoreFieldDoc, "type" | "multi" | "format" | "display_format" | "config" | "relation_target">, carried?: StoreCarried | null): ContextFieldKind;
380
+ declare function contextFieldFromStore(row: StoreItemRow): ContextField;
381
+ /** A reference / document cell's targets, with the names and files the door gave this caller. */
382
+ declare function referencesOf(row: Pick<StoreValueRow, "value" | "field" | "labels" | "files">): ContextReference[];
383
+ /** One cell, as a `ContextValue` (its whole text not yet read — see `completeWholeValues`). */
384
+ declare function contextValueFromStore(row: StoreValueRow): ContextValue;
385
+ /** Reads a file's whole text as the person (the host's one file reader). */
386
+ type ReadContextFileText = (fileId: Uuid) => Promise<string>;
387
+ /**
388
+ * A CELL THAT HOLDS ONLY THE FIRST WORDS OF A TEXT KEPT AS A FILE GETS ITS WHOLE TEXT.
389
+ *
390
+ * The store keeps a value over its one-cell ceiling as a file and the cell holds its first words;
391
+ * `custom.context_values` names the file (`whole_value`). Each such value is given the file's whole
392
+ * text — read once per file through the host's reader, checked against the size and SHA-256 the
393
+ * pointer names. A file that cannot be read, or does not match, leaves the first words AND sets
394
+ * `incomplete` (with why) — never the first words passed off as the value. Mutates `values`.
395
+ */
396
+ declare function completeWholeValues(values: ContextValue[], read: ReadContextFileText | null): Promise<void>;
397
+ /** The refusal a person sees when saving would cut a value that was not read whole. */
398
+ declare const INCOMPLETE_SAVE_REFUSAL = "Only the start of this value loaded. Paste the whole text to replace it.";
399
+ /**
400
+ * The refusal sentence when saving `draft` over a cell that was not read whole would cut the real
401
+ * value — else `null`. Refused: the first words unchanged, and a draft built on them that is shorter
402
+ * than the whole. Allowed: a draft that replaces the text, an explicit clear.
403
+ */
404
+ declare function incompleteSaveRefusal(cell: Pick<ContextValue, "incomplete"> | undefined, draft: unknown): string | null;
405
+ /** The canonical reference fence (the same grammar `@ai-matrx/agents/envelope` builds). */
406
+ declare function referenceFence(references: readonly ContextReference[]): string;
407
+
408
+ /** The client's one door call (`callDoor` in core/client.ts). */
409
+ type ScopeDoorCall = <T>(door: string, args: Record<string, unknown>, where: string) => Promise<RecordsResult<T>>;
410
+ /** How many ids one call of each batched door takes. */
411
+ declare const SCOPES_PER_CALL = 500;
412
+ declare const SCOPE_TYPES_PER_FIELDS_CALL = 100;
413
+ /** `custom.context_values` refuses more than this many scopes in one call. */
414
+ declare const SCOPES_PER_VALUES_CALL = 200;
415
+ /** One page of a type's scopes (the door's default; it answers at most 1000). */
416
+ declare const TYPE_SCOPES_PAGE = 200;
417
+ /** The archive answers at most this many rows a call (`custom.page_size` ceiling). */
418
+ declare const ARCHIVED_SCOPES_PAGE = 200;
419
+ interface ScopeDoors {
420
+ /** Every live scope type of these organizations, each with its live scopes. */
421
+ tree(organizationIds: readonly Uuid[]): Promise<RecordsResult<ScopeTypeWithScopes[]>>;
422
+ /** The scope types of these organizations without their scopes (the first paint), with or without counts. */
423
+ types(organizationIds: readonly Uuid[], options?: {
424
+ withCounts?: boolean;
425
+ }): Promise<RecordsResult<ScopeTypeSkeleton>>;
426
+ /** One page of one type's scopes, in the tree's order. */
427
+ typeScopesPage(scopeTypeId: Uuid, offset?: number, limit?: number): Promise<RecordsResult<ScopePage>>;
428
+ /** The scopes whose name holds `query` (case-insensitive), across these organizations. */
429
+ search(organizationIds: readonly Uuid[], query: string, limit?: number): Promise<RecordsResult<{
430
+ scopes: Scope[];
431
+ total: number;
432
+ }>>;
433
+ /** Scopes by id, each with its type's label, in whichever organization each lives. */
434
+ scopes(ids: readonly Uuid[]): Promise<RecordsResult<ScopeWithType[]>>;
435
+ /** The context fields (columns) of these scope types. */
436
+ fields(scopeTypeIds: readonly Uuid[]): Promise<RecordsResult<ContextField[]>>;
437
+ /**
438
+ * The cells of these scopes. A text kept as a file is read whole through `readFileText`; without
439
+ * one (or when the file cannot be read) the cell keeps its first words and says so (`incomplete`).
440
+ */
441
+ values(scopeIds: readonly Uuid[], options?: {
442
+ readFileText?: ReadContextFileText | null;
443
+ }): Promise<RecordsResult<ContextValue[]>>;
444
+ /** The archived scope types of one organization. */
445
+ archivedTypes(organizationId: Uuid): Promise<RecordsResult<ArchivedScopeType[]>>;
446
+ /** Of these scope ids, the ones that are ARCHIVED scopes of this type. */
447
+ archivedScopesOfType(organizationId: Uuid, scopeTypeId: Uuid, wanted: ReadonlySet<Uuid>): Promise<RecordsResult<ArchivedScope[]>>;
448
+ /** The System Context items (not scopes: the platform's own ambient context). */
449
+ systemItems(): Promise<RecordsResult<SystemContextItem[]>>;
450
+ /** The scope templates of the gallery. */
451
+ templates(): Promise<RecordsResult<ScopeTemplate[]>>;
452
+ /** A new scope type in `organizationId`. */
453
+ createType(organizationId: Uuid, spec: ScopeTypeSpec): Promise<RecordsResult<ScopeType>>;
454
+ /** Change a scope type (only the keys given). */
455
+ updateType(typeId: Uuid, spec: ScopeTypeSpec): Promise<RecordsResult<ScopeType>>;
456
+ /** Archive a scope type; its scopes and fields come back with a restore. */
457
+ archiveType(typeId: Uuid): Promise<RecordsResult<{
458
+ id: Uuid;
459
+ }>>;
460
+ restoreType(typeId: Uuid): Promise<RecordsResult<{
461
+ id: Uuid;
462
+ }>>;
463
+ /** A new scope of `typeId` in `organizationId`. */
464
+ createScope(organizationId: Uuid, typeId: Uuid, spec: ScopeSpec): Promise<RecordsResult<Scope>>;
465
+ updateScope(scopeId: Uuid, spec: ScopeSpec): Promise<RecordsResult<Scope>>;
466
+ archiveScope(scopeId: Uuid): Promise<RecordsResult<{
467
+ id: Uuid;
468
+ }>>;
469
+ restoreScope(scopeId: Uuid): Promise<RecordsResult<{
470
+ id: Uuid;
471
+ }>>;
472
+ /** A new context field (column) on a scope type. Answers the field as the read door does. */
473
+ createField(scopeTypeId: Uuid, spec: ContextFieldSpec): Promise<RecordsResult<ContextField>>;
474
+ /** Change a context field (`null` clears a key). Answers the field as the read door does. */
475
+ updateField(fieldId: Uuid, scopeTypeId: Uuid, spec: ContextFieldSpec): Promise<RecordsResult<ContextField>>;
476
+ archiveField(fieldId: Uuid): Promise<RecordsResult<{
477
+ id: Uuid;
478
+ }>>;
479
+ restoreField(fieldId: Uuid): Promise<RecordsResult<{
480
+ id: Uuid;
481
+ }>>;
482
+ /** Write one cell. */
483
+ writeValue(write: ContextValueWrite): Promise<RecordsResult<ContextValueWritten>>;
484
+ }
485
+ declare function createScopeDoors(call: ScopeDoorCall): ScopeDoors;
486
+
487
+ export { ARCHIVED_SCOPES_PAGE as A, type StoreWholeValue as B, CONTEXT_FIELD_KINDS as C, type SystemContextItem as D, completeWholeValues as E, FILE_KERNEL_ID as F, contextFieldFromStore as G, contextFieldKind as H, INCOMPLETE_SAVE_REFUSAL as I, contextValueFromStore as J, createScopeDoors as K, incompleteSaveRefusal as L, referenceFence as M, referencesOf as N, scopeFromStore as O, scopeTypeFromStore as P, scopeWithTypeFromStore as Q, type ReadContextFileText as R, SCOPES_PER_CALL as S, TYPE_SCOPES_PAGE as T, settingFromStore as U, type ArchivedScope as a, type ArchivedScopeType as b, type ContextField as c, type ContextFieldKind as d, type ContextFieldSpec as e, type ContextPolicy as f, type ContextReference as g, type ContextSensitivity as h, type ContextValue as i, type ContextValueWrite as j, type ContextValueWritten as k, type IncompleteValue as l, SCOPES_PER_VALUES_CALL as m, SCOPE_TYPES_PER_FIELDS_CALL as n, type Scope as o, type ScopeDoorCall as p, type ScopeDoors as q, type ScopePage as r, type ScopeSpec as s, type ScopeTemplate as t, type ScopeType as u, type ScopeTypeLabel as v, type ScopeTypeSkeleton as w, type ScopeTypeSpec as x, type ScopeTypeWithScopes as y, type ScopeWithType as z };