simetra 0.1.0 → 0.3.0-next.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.
- package/README.md +1 -0
- package/dist/channel-grant-BATD6oQu.js +15 -0
- package/dist/compiler/index.d.ts +1470 -227
- package/dist/compiler/index.js +39407 -14041
- package/dist/data/centrifugo/index.d.ts +24 -0
- package/dist/data/centrifugo/index.js +173 -0
- package/dist/data/index.d.ts +27 -0
- package/dist/data/index.js +9779 -0
- package/dist/data/react/index.d.ts +103 -0
- package/dist/data/react/index.js +214 -0
- package/dist/grant-Zg0hmqK7.d.ts +11 -0
- package/dist/handle-C6PFsnUX.js +44 -0
- package/dist/holder-CkR-qRYU.d.ts +585 -0
- package/dist/model/index.d.ts +5240 -276
- package/dist/model/index.js +5030 -276
- package/dist/schema/index.d.ts +1812 -660
- package/dist/schema/index.js +12649 -6849
- package/dist/server/index.d.ts +747 -0
- package/dist/server/index.js +5356 -0
- package/dist/server/signals/index.d.ts +92 -0
- package/dist/server/signals/index.js +140 -0
- package/dist/shell/index.d.ts +100 -0
- package/dist/shell/index.js +148 -0
- package/dist/ui/index.d.ts +213 -0
- package/dist/ui/index.js +1075 -0
- package/package.json +87 -10
- package/schemas/accumulation-registers.schema.json +46 -5
- package/schemas/catalogs.schema.json +114 -7
- package/schemas/constants.schema.json +31 -5
- package/schemas/custom-tables.schema.json +77 -2
- package/schemas/documents.schema.json +83 -5
- package/schemas/functions.schema.json +129 -0
- package/schemas/information-registers.schema.json +47 -5
- package/schemas/project.schema.json +266 -4
- package/schemas/rights-sets.schema.json +3 -1
- package/schemas/roles.schema.json +6 -2
|
@@ -0,0 +1,747 @@
|
|
|
1
|
+
import { t as ChannelGrant } from "../grant-Zg0hmqK7.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { Batch, CommandError, CommandFailure, CommandResult, DataResponse, DatabaseProvider, IdentitySource, LocalizedString, MetadataRef, ObjectModule, ObjectOperation, Operation, ProviderApiRoles, ReadPart, ReadPartValue, ReadQuery, ReadResult, ReadResultOf, RequestRolePurpose, RightsSnapshot, RuntimeCatalog, RuntimeObject, SessionClaims } from "simetra/model";
|
|
4
|
+
/** Object key of the database binding marker (platform spec §8.2). */
|
|
5
|
+
export declare const INSTANCE_MARKER_KEY = "simetra-instance";
|
|
6
|
+
/** The file store port of the server tier (platform spec §8.4). */
|
|
7
|
+
interface FileStore {
|
|
8
|
+
/**
|
|
9
|
+
* Reads the body, counts the bytes itself and aborts past `maxBytes`
|
|
10
|
+
* (nothing is written then). `instance` is the database binding string
|
|
11
|
+
* (`parseBinding`): the bucket must carry the same marker. `put` never
|
|
12
|
+
* writes the marker: an unbound empty bucket is `no-binding`, a bucket with
|
|
13
|
+
* objects but no marker or another database's marker is `foreign-bucket`.
|
|
14
|
+
*/
|
|
15
|
+
put(key: string, body: ReadableStream<Uint8Array>, options: {
|
|
16
|
+
contentType: string;
|
|
17
|
+
maxBytes: number;
|
|
18
|
+
instance: string;
|
|
19
|
+
}): Promise<{
|
|
20
|
+
size: number;
|
|
21
|
+
}>;
|
|
22
|
+
/** `null` when the key has no object. */
|
|
23
|
+
get(key: string): Promise<{
|
|
24
|
+
body: ReadableStream<Uint8Array>;
|
|
25
|
+
size: number;
|
|
26
|
+
contentType: string;
|
|
27
|
+
} | null>;
|
|
28
|
+
delete(key: string): Promise<void>;
|
|
29
|
+
/** Objects under `prefix` in key order, after the key `after` when given. */
|
|
30
|
+
list(prefix: string, after?: string): AsyncIterable<{
|
|
31
|
+
key: string;
|
|
32
|
+
lastModified: Date;
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* The object prefixes `o/<uuid>/` present in the bucket, in key order.
|
|
36
|
+
* Lets the reconciliation name a prefix of an object the catalog does not
|
|
37
|
+
* know, which it only logs.
|
|
38
|
+
*/
|
|
39
|
+
listPrefixes(): AsyncIterable<string>;
|
|
40
|
+
/**
|
|
41
|
+
* Refuses (throws {@link FileStoreError}) a bucket that is not this
|
|
42
|
+
* database's: a different marker (`foreign-bucket`), the same marker
|
|
43
|
+
* written for another cluster, database or timeline (`binding-changed`: a
|
|
44
|
+
* copy or a restore), or objects without a marker. An empty unbound bucket
|
|
45
|
+
* passes (nothing to delete).
|
|
46
|
+
* Used by the reconciliation before any deletion.
|
|
47
|
+
*/
|
|
48
|
+
checkInstance(instance: string): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* The first binding of a bucket, an explicit operator step (the S3 servers
|
|
51
|
+
* of the profiles have no conditional write, so `put` cannot bind safely).
|
|
52
|
+
* Writes the marker only into a completely empty bucket and reads it back;
|
|
53
|
+
* the same marker already there is a no-op. Objects without a marker or
|
|
54
|
+
* another database's marker are `foreign-bucket`, the same uuid with another
|
|
55
|
+
* cluster state is `binding-changed` (use `rebind`).
|
|
56
|
+
*/
|
|
57
|
+
bind(instance: string): Promise<void>;
|
|
58
|
+
/**
|
|
59
|
+
* Rewrites the marker with `instance` after a legitimate restore. Only a
|
|
60
|
+
* marker of the same `storage_instance` uuid is rewritten; anything else
|
|
61
|
+
* (no marker, another uuid) is `foreign-bucket`.
|
|
62
|
+
*/
|
|
63
|
+
rebind(instance: string): Promise<void>;
|
|
64
|
+
}
|
|
65
|
+
/** Refusal of the store itself; `reason` is a closed list. */
|
|
66
|
+
export declare class FileStoreError extends Error {
|
|
67
|
+
readonly reason: "too-large" | "foreign-bucket" | "binding-changed" | "no-binding" | "in-recovery" | "bad-limit" | "bad-key" | "bad-listing";
|
|
68
|
+
constructor(reason: "too-large" | "foreign-bucket" | "binding-changed" | "no-binding" | "in-recovery" | "bad-limit" | "bad-key" | "bad-listing", message: string);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* The slice of the aggregate AWS SDK `S3` client the adapter uses. Структурний
|
|
72
|
+
* тип замість імпорту SDK: серверний ярус не тягне його в бандл, host
|
|
73
|
+
* передає будь-який клієнт з такою формою (як `PgPoolLike`).
|
|
74
|
+
*/
|
|
75
|
+
interface S3ClientLike {
|
|
76
|
+
putObject(input: {
|
|
77
|
+
Bucket: string;
|
|
78
|
+
Key: string;
|
|
79
|
+
Body: Uint8Array;
|
|
80
|
+
ContentLength: number;
|
|
81
|
+
ContentType?: string;
|
|
82
|
+
}): Promise<unknown>;
|
|
83
|
+
getObject(input: {
|
|
84
|
+
Bucket: string;
|
|
85
|
+
Key: string;
|
|
86
|
+
}): Promise<{
|
|
87
|
+
Body?: {
|
|
88
|
+
transformToWebStream(): ReadableStream<Uint8Array>;
|
|
89
|
+
};
|
|
90
|
+
ContentLength?: number;
|
|
91
|
+
ContentType?: string;
|
|
92
|
+
}>;
|
|
93
|
+
deleteObject(input: {
|
|
94
|
+
Bucket: string;
|
|
95
|
+
Key: string;
|
|
96
|
+
}): Promise<unknown>;
|
|
97
|
+
listObjectsV2(input: {
|
|
98
|
+
Bucket: string;
|
|
99
|
+
Prefix?: string;
|
|
100
|
+
Delimiter?: string;
|
|
101
|
+
StartAfter?: string;
|
|
102
|
+
ContinuationToken?: string;
|
|
103
|
+
MaxKeys?: number;
|
|
104
|
+
}): Promise<{
|
|
105
|
+
Contents?: {
|
|
106
|
+
Key?: string;
|
|
107
|
+
LastModified?: Date;
|
|
108
|
+
}[];
|
|
109
|
+
CommonPrefixes?: {
|
|
110
|
+
Prefix?: string;
|
|
111
|
+
}[];
|
|
112
|
+
IsTruncated?: boolean;
|
|
113
|
+
NextContinuationToken?: string;
|
|
114
|
+
}>;
|
|
115
|
+
}
|
|
116
|
+
/** Adapts an S3 client to the port; the bucket is fixed by the server. */
|
|
117
|
+
export declare function fromS3Client(client: S3ClientLike, bucket: string): FileStore;
|
|
118
|
+
/** Age after which an object without a row may be deleted (platform spec §8.2). */
|
|
119
|
+
export declare const RECONCILE_GRACE_MS: number;
|
|
120
|
+
/**
|
|
121
|
+
* Why a run deleted nothing on purpose: a bucket of another database
|
|
122
|
+
* (`instance`), the marker of a copied or restored database (`binding`), a
|
|
123
|
+
* standby (`recovery`) or the deletion guard (`guard`).
|
|
124
|
+
*/
|
|
125
|
+
type ReconcileRefusal = "instance" | "binding" | "recovery" | "guard";
|
|
126
|
+
/** What the reconciliation reports to its `log` option. */
|
|
127
|
+
type ReconcileLogEntry = {
|
|
128
|
+
kind: "refused";
|
|
129
|
+
reason: ReconcileRefusal;
|
|
130
|
+
message: string;
|
|
131
|
+
} | {
|
|
132
|
+
kind: "unknown-prefix";
|
|
133
|
+
prefix: string;
|
|
134
|
+
} | {
|
|
135
|
+
kind: "row-without-bytes";
|
|
136
|
+
object: string;
|
|
137
|
+
id: string;
|
|
138
|
+
};
|
|
139
|
+
/** Options of `CommandRuntime.reconcileFiles`. */
|
|
140
|
+
interface ReconcileOptions {
|
|
141
|
+
log: (entry: ReconcileLogEntry) => void;
|
|
142
|
+
}
|
|
143
|
+
/** The outcome of one reconciliation run. */
|
|
144
|
+
interface ReconcileReport {
|
|
145
|
+
/** File objects found under the prefixes of objects with `storage`. */
|
|
146
|
+
listed: number;
|
|
147
|
+
deleted: number;
|
|
148
|
+
/** Why the run deleted nothing on purpose; `null` — it did not refuse. */
|
|
149
|
+
refused: ReconcileRefusal | null;
|
|
150
|
+
/** Object prefixes in the bucket the catalog does not know (only logged). */
|
|
151
|
+
unknownPrefixes: string[];
|
|
152
|
+
/** Rows of objects with `storage` that have no bytes in the bucket. */
|
|
153
|
+
rowsWithoutBytes: number;
|
|
154
|
+
/** Attach records of finished transactions removed from the database. */
|
|
155
|
+
pendingSwept: number;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* One connection taken from a pool: bound text parameters only, unnamed
|
|
159
|
+
* statements (P4 spec Рт19).
|
|
160
|
+
*/
|
|
161
|
+
interface DatabaseClient {
|
|
162
|
+
/** Column values are the Postgres text form (or `null`), whatever the pool parses. */
|
|
163
|
+
query(text: string, params?: readonly (string | null)[]): Promise<{
|
|
164
|
+
rows: Record<string, unknown>[];
|
|
165
|
+
command: string;
|
|
166
|
+
}>;
|
|
167
|
+
/** Returns the connection; `true` destroys it instead. */
|
|
168
|
+
release(destroy?: boolean): void;
|
|
169
|
+
}
|
|
170
|
+
/** The database port of the command runtime (P4 spec §6.4). */
|
|
171
|
+
interface CommandDatabase {
|
|
172
|
+
connect(): Promise<DatabaseClient>;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* The shape of `pg.Pool` the runtime uses. Структурний тип замість імпорту
|
|
176
|
+
* `pg`: серверний ярус не тягне драйвер у свій бандл (Рт17), host передає
|
|
177
|
+
* будь-який пул з такою формою.
|
|
178
|
+
*/
|
|
179
|
+
interface PgPoolLike {
|
|
180
|
+
connect(): Promise<{
|
|
181
|
+
query(config: {
|
|
182
|
+
text: string;
|
|
183
|
+
values: readonly (string | null)[];
|
|
184
|
+
types: typeof RAW_TYPES;
|
|
185
|
+
}): Promise<{
|
|
186
|
+
rows: Record<string, unknown>[];
|
|
187
|
+
command: string;
|
|
188
|
+
}>;
|
|
189
|
+
release(destroy?: boolean): void;
|
|
190
|
+
on(event: "error", listener: (error: Error) => void): unknown;
|
|
191
|
+
on(event: "end", listener: () => void): unknown;
|
|
192
|
+
removeListener(event: "error", listener: (error: Error) => void): unknown;
|
|
193
|
+
removeListener(event: "end", listener: () => void): unknown;
|
|
194
|
+
}>;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Парсери типів на рівні запиту: текст Postgres без перетворень. Інакше
|
|
198
|
+
* парсери, які host поставив на пул (`types` у `pg.Pool`), змінили б рядок
|
|
199
|
+
* ядра ще до `decodeRow` — і значення залежали б від налаштувань host-а.
|
|
200
|
+
*/
|
|
201
|
+
declare const RAW_TYPES: {
|
|
202
|
+
getTypeParser: () => (value: string) => string;
|
|
203
|
+
};
|
|
204
|
+
/** Adapts a `pg` pool to the runtime port. */
|
|
205
|
+
export declare function fromPgPool(pool: PgPoolLike): CommandDatabase;
|
|
206
|
+
/** A runtime log entry: the full error stays inside the process. */
|
|
207
|
+
type LogEntry = {
|
|
208
|
+
kind: "afterCommit" | "hook" | "defer" | "database";
|
|
209
|
+
error: unknown;
|
|
210
|
+
};
|
|
211
|
+
/** The rejection of `attachFile`: a `CommandFailure` with the commit flag. */
|
|
212
|
+
export declare class FileAttachFailure extends CommandFailure {
|
|
213
|
+
/**
|
|
214
|
+
* `true` when `COMMIT` was sent and the session closed: the row may exist,
|
|
215
|
+
* so the caller must keep the bytes. `false` — a known rollback or a
|
|
216
|
+
* refusal before the database.
|
|
217
|
+
*/
|
|
218
|
+
readonly commitUnknown: boolean;
|
|
219
|
+
constructor(error: CommandError,
|
|
220
|
+
/**
|
|
221
|
+
* `true` when `COMMIT` was sent and the session closed: the row may exist,
|
|
222
|
+
* so the caller must keep the bytes. `false` — a known rollback or a
|
|
223
|
+
* refusal before the database.
|
|
224
|
+
*/
|
|
225
|
+
commitUnknown: boolean);
|
|
226
|
+
}
|
|
227
|
+
/** The input of {@link CommandRuntime.checkUpload}. */
|
|
228
|
+
interface CheckUploadInput {
|
|
229
|
+
object: MetadataRef;
|
|
230
|
+
/** The scope the file row would be created in; `null`/absent for an unscoped object. */
|
|
231
|
+
scope?: string | null;
|
|
232
|
+
}
|
|
233
|
+
/** What a user may upload to an object: the limits of its `storage`. */
|
|
234
|
+
interface UploadLimits {
|
|
235
|
+
maxBytes: number;
|
|
236
|
+
mediaTypes: string[];
|
|
237
|
+
/**
|
|
238
|
+
* The database binding string read in the same transaction as the check
|
|
239
|
+
* (`FileStore.put` option `instance`, see `parseBinding`).
|
|
240
|
+
*/
|
|
241
|
+
instance: string;
|
|
242
|
+
}
|
|
243
|
+
/** The input of {@link CommandRuntime.attachFile}. */
|
|
244
|
+
interface AttachFileInput {
|
|
245
|
+
object: MetadataRef;
|
|
246
|
+
/** The scope of the row; required for a scoped object, absent otherwise. */
|
|
247
|
+
scope?: string | null;
|
|
248
|
+
/** The row id the server generated and wrote the bytes under (`fileObjectKey`). */
|
|
249
|
+
id: string;
|
|
250
|
+
/** The file name; stored in the `file_name` attribute. */
|
|
251
|
+
name: string;
|
|
252
|
+
/** Other attributes of the row, by logical names. */
|
|
253
|
+
fields?: Record<string, unknown>;
|
|
254
|
+
/** The byte count `FileStore.put` counted itself. */
|
|
255
|
+
size: number;
|
|
256
|
+
/** The content type of the bytes. */
|
|
257
|
+
contentType: string;
|
|
258
|
+
}
|
|
259
|
+
/** Options of {@link createCommandRuntime}. */
|
|
260
|
+
interface CommandRuntimeOptions {
|
|
261
|
+
/**
|
|
262
|
+
* The database port. Its connections log in as the runtime login role
|
|
263
|
+
* directly: the runtime judges `session_user`, which must reach neither
|
|
264
|
+
* the owner nor a privileged role (`command.privileged-login`). A pool that
|
|
265
|
+
* logs in as a superuser and switches with `SET SESSION AUTHORIZATION` is
|
|
266
|
+
* outside this trust model — such a host already holds a superuser DSN.
|
|
267
|
+
*/
|
|
268
|
+
database: CommandDatabase;
|
|
269
|
+
/** The runtime catalog object (`runtime-catalog.json`); validated here. */
|
|
270
|
+
catalog: unknown;
|
|
271
|
+
/** Object modules keyed `"<kind>.<name>"`, e.g. `"Catalog.Client"`. */
|
|
272
|
+
objectModules?: Readonly<Record<string, ObjectModule<object>>>;
|
|
273
|
+
/** Hands `afterCommit` work to the platform (`waitUntil`); without it `run` awaits that work. */
|
|
274
|
+
defer?: (work: Promise<unknown>) => void;
|
|
275
|
+
/**
|
|
276
|
+
* Reads through the fallback path when the login role lacks the user
|
|
277
|
+
* request role. Membership in the anonymous request role of the profile is
|
|
278
|
+
* always required.
|
|
279
|
+
*/
|
|
280
|
+
readFallback?: boolean;
|
|
281
|
+
/** Attempts in total on serialization failure or deadlock; default 3. */
|
|
282
|
+
maxAttempts?: number;
|
|
283
|
+
/** Depth limit of phases started by hooks; default 8. */
|
|
284
|
+
maxDepth?: number;
|
|
285
|
+
/**
|
|
286
|
+
* `statement_timeout` ceiling of a server read statement in milliseconds
|
|
287
|
+
* (integer ≥ 1); default 15 000. A statement past it fails its part with
|
|
288
|
+
* `command.timeout`.
|
|
289
|
+
*/
|
|
290
|
+
readStatementTimeoutMs?: number;
|
|
291
|
+
/**
|
|
292
|
+
* Time budget of one server read transaction, all its parts, in
|
|
293
|
+
* milliseconds (integer ≥ 1000); default 15 000. A part not started
|
|
294
|
+
* before it fails with `command.timeout`.
|
|
295
|
+
*/
|
|
296
|
+
readBudgetMs?: number;
|
|
297
|
+
/**
|
|
298
|
+
* Time budget of one `run` call, retries and their pauses included, in
|
|
299
|
+
* milliseconds (integer ≥ 1000); default 60 000. A command past it rejects
|
|
300
|
+
* with `command.timeout`.
|
|
301
|
+
*/
|
|
302
|
+
commandBudgetMs?: number;
|
|
303
|
+
/**
|
|
304
|
+
* Operations of one `run` batch (integer 1…`BATCH_MAX`); default
|
|
305
|
+
* `BATCH_MAX`. A longer batch rejects with `command.invalid`
|
|
306
|
+
* `reason: "batch-too-large"`. Phases started by `ctx.run` are not counted:
|
|
307
|
+
* they stay bound by `BATCH_MAX`.
|
|
308
|
+
*/
|
|
309
|
+
maxBatch?: number;
|
|
310
|
+
/**
|
|
311
|
+
* Rows of one tabular section of an operation, of `run` and of every
|
|
312
|
+
* `ctx.run` phase (integer 1…`TABULAR_LINES_MAX`); default
|
|
313
|
+
* `TABULAR_LINES_MAX`. More rows reject with `command.invalid`
|
|
314
|
+
* `reason: "tabular-too-large"`. Reads keep the `TABULAR_LINES_MAX` ceiling.
|
|
315
|
+
*/
|
|
316
|
+
maxTabularLines?: number;
|
|
317
|
+
/**
|
|
318
|
+
* `lock_timeout` of a command transaction in milliseconds (integer ≥ 1);
|
|
319
|
+
* default 5 000. A lock wait past it rejects with `command.busy`.
|
|
320
|
+
*/
|
|
321
|
+
lockTimeoutMs?: number;
|
|
322
|
+
/**
|
|
323
|
+
* Signal phases of one command transaction, `ctx.run` phases included,
|
|
324
|
+
* that each send a row signal (integer ≥ 1); default 90. The phases
|
|
325
|
+
* after it run in signal merge mode: one `invalidate` per (scope, object)
|
|
326
|
+
* pair instead of a signal per phase (P4-B spec §8.2). Keep it below the
|
|
327
|
+
* channel history size, so the signals of one pair fit the history and a
|
|
328
|
+
* short gap still recovers.
|
|
329
|
+
*/
|
|
330
|
+
signalMergeThreshold?: number;
|
|
331
|
+
/** Receives errors that never leave the runtime; default `console.error`. */
|
|
332
|
+
log?: (entry: LogEntry) => void;
|
|
333
|
+
}
|
|
334
|
+
/** Options of one {@link CommandRuntime.run} call. */
|
|
335
|
+
interface CommandRunOptions {
|
|
336
|
+
/**
|
|
337
|
+
* A tabular section array of `update` replaces the section as given:
|
|
338
|
+
* existing rows it leaves out are deleted. Without it (the default) such
|
|
339
|
+
* rows must be named in `deleteIds`, or the phase fails with
|
|
340
|
+
* `command.invalid` `reason: "tabular-rows-missing"`. `ctx.run` is always
|
|
341
|
+
* strict. An operation with `deleteIds` under this option is
|
|
342
|
+
* `command.invalid` with `path` `deleteIds`.
|
|
343
|
+
*/
|
|
344
|
+
fullTabularArrays?: true;
|
|
345
|
+
}
|
|
346
|
+
/** The snapshot and its fingerprint, see {@link CommandRuntime.rightsSnapshot}. */
|
|
347
|
+
interface RightsSnapshotValue {
|
|
348
|
+
rightsVersion: string;
|
|
349
|
+
snapshot: RightsSnapshot;
|
|
350
|
+
}
|
|
351
|
+
/** The outcome of one part of {@link CommandRuntime.readParts}. */
|
|
352
|
+
type ReadPartOutcome = {
|
|
353
|
+
ok: true;
|
|
354
|
+
value: ReadPartValue;
|
|
355
|
+
} | {
|
|
356
|
+
ok: false;
|
|
357
|
+
error: CommandError;
|
|
358
|
+
};
|
|
359
|
+
/**
|
|
360
|
+
* The result of {@link CommandRuntime.readParts}: the row version epoch of
|
|
361
|
+
* its transaction (`null` without an epoch or without a transaction) and an
|
|
362
|
+
* outcome per part, in request order.
|
|
363
|
+
*/
|
|
364
|
+
interface ReadPartsResult {
|
|
365
|
+
epoch: string | null;
|
|
366
|
+
items: ReadPartOutcome[];
|
|
367
|
+
}
|
|
368
|
+
/** Options of one {@link CommandRuntime.readParts} call. */
|
|
369
|
+
interface ReadPartsOptions {
|
|
370
|
+
/**
|
|
371
|
+
* Called after each part that read its value, before the next part runs;
|
|
372
|
+
* `"overflow"` stops the transaction there: the parts after it fail with
|
|
373
|
+
* `command.unavailable` `reason: "batch-budget"` without running, and the
|
|
374
|
+
* part keeps its value for the caller to cut or drop.
|
|
375
|
+
*/
|
|
376
|
+
fit?: (index: number, value: ReadPartValue) => "accept" | "overflow";
|
|
377
|
+
}
|
|
378
|
+
/** The command runtime of one catalog and database. */
|
|
379
|
+
interface CommandRuntime {
|
|
380
|
+
/**
|
|
381
|
+
* The runtime catalog the runtime was created with: parsed by
|
|
382
|
+
* `runtimeCatalogSchema`, the runtime's own deep-frozen copy.
|
|
383
|
+
*/
|
|
384
|
+
readonly catalog: RuntimeCatalog;
|
|
385
|
+
/** Runs an operation or a batch in one transaction; rejects with `CommandFailure`. */
|
|
386
|
+
run(session: SessionClaims, input: Operation | readonly Operation[], options?: CommandRunOptions): Promise<CommandResult>;
|
|
387
|
+
/**
|
|
388
|
+
* Reads rows under the request role of the profile, or through the
|
|
389
|
+
* fallback path (P4 spec §6.11); rejects with `CommandFailure`.
|
|
390
|
+
*/
|
|
391
|
+
read<Q extends ReadQuery>(session: SessionClaims, query: Q): Promise<ReadResultOf<Q>>;
|
|
392
|
+
/**
|
|
393
|
+
* Reads the parts in one `REPEATABLE READ READ ONLY` transaction (P4-B spec
|
|
394
|
+
* §4.2): every part sees the same snapshot. An invalid part fails alone,
|
|
395
|
+
* before the database; past the deadline a part and those after it fail
|
|
396
|
+
* with `command.timeout`; a database error fails its part, and those after
|
|
397
|
+
* it fail with `command.unavailable` `reason: "batch-aborted"` (or without
|
|
398
|
+
* a reason on a lost connection). Rejects with `CommandFailure` for the
|
|
399
|
+
* whole request: `command.unauthenticated`, `command.invalid`
|
|
400
|
+
* `reason: "batch-too-large"` over `READ_BATCH_MAX` parts or
|
|
401
|
+
* `READ_BATCH_STATEMENTS_MAX` statements.
|
|
402
|
+
*/
|
|
403
|
+
readParts(session: SessionClaims, parts: readonly ReadPart[], options?: ReadPartsOptions): Promise<ReadPartsResult>;
|
|
404
|
+
/**
|
|
405
|
+
* The rights snapshot of the session's user and its `rightsVersion` (P4-B
|
|
406
|
+
* spec §9.1), read as a one-part batch: one `REPEATABLE READ READ ONLY`
|
|
407
|
+
* transaction, one statement under the request role. An anonymous session
|
|
408
|
+
* with the profile's anonymous read role gets the empty snapshot without a
|
|
409
|
+
* database call. Rejects with `CommandFailure`: `command.unauthenticated`
|
|
410
|
+
* for an invalid session, or an anonymous one in a project without an
|
|
411
|
+
* anonymous read role; `command.invalid` when the
|
|
412
|
+
* catalog has no rights functions; `command.internal` when the function's
|
|
413
|
+
* output fails `rightsSnapshotSchema`.
|
|
414
|
+
*/
|
|
415
|
+
rightsSnapshot(session: SessionClaims): Promise<RightsSnapshotValue>;
|
|
416
|
+
/**
|
|
417
|
+
* The signal channels the session may subscribe to (P4-B spec §8.3), as
|
|
418
|
+
* the `ChannelGrant` the token port of `simetra/server/signals` signs. One
|
|
419
|
+
* `READ ONLY` transaction under the request role asks `current_user_id()`
|
|
420
|
+
* and `signal_topic_allowed(<channel>, false)` for every channel.
|
|
421
|
+
* `subject` is that user id, not the raw `sub`; `null` — an anonymous
|
|
422
|
+
* session (no database call) or no valid user, and then no channels.
|
|
423
|
+
* `channels` — the allowed ones, sorted, without duplicates. Rejects with
|
|
424
|
+
* `CommandFailure`: `command.unauthenticated`; `command.invalid` before the
|
|
425
|
+
* database — over 256 channels (`reason:
|
|
426
|
+
* "batch-too-large"`) or a channel over `CENTRIFUGO_CHANNEL_MAX` UTF-8
|
|
427
|
+
* bytes (`reason: "too-large"`, `path` — its index).
|
|
428
|
+
*/
|
|
429
|
+
authorizeChannels(session: SessionClaims, channels: readonly string[]): Promise<ChannelGrant>;
|
|
430
|
+
/**
|
|
431
|
+
* The pre-check of an upload (platform spec §8.2 step 2): one `READ ONLY`
|
|
432
|
+
* transaction under the request role asks `storage_headroom`, then, under
|
|
433
|
+
* the storage role, reads the database binding string (`instance`: the
|
|
434
|
+
* `storage_instance` uuid with the cluster `system_identifier`, the
|
|
435
|
+
* database oid and the WAL timeline; never cached, so a promotion or a
|
|
436
|
+
* restore of a live process is seen by the next upload). The caller passes
|
|
437
|
+
* it to `FileStore.put` as option `instance`. Returns the limits of the
|
|
438
|
+
* object's `storage` with the binding, or `null` — for a guest (no database
|
|
439
|
+
* call), an unknown object or one without `storage`, a scope that does not
|
|
440
|
+
* fit, and a refusal of the right or of the quota alike. The check is
|
|
441
|
+
* necessary, not sufficient: `attachFile` judges the row. Rejects with
|
|
442
|
+
* `CommandFailure`: `command.unauthenticated` for an invalid session; with
|
|
443
|
+
* `FileStoreError` `no-binding` when the runtime has not created the
|
|
444
|
+
* `storage_instance` row (it does so at start).
|
|
445
|
+
*/
|
|
446
|
+
checkUpload(session: SessionClaims, input: CheckUploadInput): Promise<UploadLimits | null>;
|
|
447
|
+
/**
|
|
448
|
+
* Creates the row of an uploaded file (platform spec §8.2 step 4): one
|
|
449
|
+
* transaction — `file_attach` with the size and type under the storage
|
|
450
|
+
* role, then the `create` phase under the command role — with the retries
|
|
451
|
+
* and the budget of `run`. Rejects with `FileAttachFailure`:
|
|
452
|
+
* `commitUnknown` is `true` when `COMMIT` was sent and the session closed
|
|
453
|
+
* (the row may exist, the bytes must stay); otherwise the transaction is
|
|
454
|
+
* known to have rolled back and the caller deletes the bytes. The error
|
|
455
|
+
* `command.rejected` with `reason` `storage.<reason>` is a storage refusal.
|
|
456
|
+
*/
|
|
457
|
+
attachFile(session: SessionClaims, input: AttachFileInput): Promise<CommandResult>;
|
|
458
|
+
/**
|
|
459
|
+
* The reconciliation of the byte store with the database (platform spec
|
|
460
|
+
* §8.2): the only place bytes are physically deleted. Refuses (deletes
|
|
461
|
+
* nothing, `report.refused`) for a bucket of another database, a marker of a
|
|
462
|
+
* copied or restored database, a database in recovery, or when the guard
|
|
463
|
+
* trips. Rejects with `command.nested` from inside a hook.
|
|
464
|
+
*/
|
|
465
|
+
reconcileFiles(store: FileStore, options: ReconcileOptions): Promise<ReconcileReport>;
|
|
466
|
+
/**
|
|
467
|
+
* The operator command that makes the first binding of a bucket to this
|
|
468
|
+
* database: writes the marker only into a completely empty bucket and reads
|
|
469
|
+
* it back; the same marker is a no-op, another database's marker or objects
|
|
470
|
+
* without a marker are `FileStoreError` `foreign-bucket`. Uploads never bind
|
|
471
|
+
* (`no-binding` on an unbound bucket). Refused with `in-recovery` on a
|
|
472
|
+
* standby. Rejects with `command.nested` from inside a hook.
|
|
473
|
+
*/
|
|
474
|
+
bindFileStore(store: FileStore): Promise<void>;
|
|
475
|
+
/**
|
|
476
|
+
* The operator command after a legitimate restore (dump/restore, PITR, a
|
|
477
|
+
* promoted replica): rewrites the bucket marker with the current binding of
|
|
478
|
+
* this database. Only a marker of the same `storage_instance` uuid is
|
|
479
|
+
* rewritten (`FileStoreError` `foreign-bucket` otherwise); refused with
|
|
480
|
+
* `in-recovery` on a standby. Reads the binding fresh from the database.
|
|
481
|
+
* Rejects with `command.nested` from inside a hook.
|
|
482
|
+
*/
|
|
483
|
+
rebindFileStore(store: FileStore): Promise<void>;
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* The request role of `purpose` the server reads under for a provider
|
|
487
|
+
* profile; `undefined` — the profile names none (P4 spec Рт18). Таблиці —
|
|
488
|
+
* параметри, щоб правило перевірялося на підставлених профілях.
|
|
489
|
+
*/
|
|
490
|
+
export declare function readRoleOf(provider: DatabaseProvider, purposes?: Readonly<Record<DatabaseProvider, readonly RequestRolePurpose[]>>, roles?: Readonly<Record<DatabaseProvider, ProviderApiRoles>>, purpose?: RequestRolePurpose): string | undefined;
|
|
491
|
+
/**
|
|
492
|
+
* The kind of a session by the anonymous claim of the provider
|
|
493
|
+
* (`PROVIDER_IDENTITY_SOURCES[provider].anonymousClaim`): `true` or `"true"`
|
|
494
|
+
* — `"anonymous"`, `false` or `"false"` — `"user"`, any other value or none —
|
|
495
|
+
* `"invalid"`. A provider without anonymous sessions reads every session as
|
|
496
|
+
* `"user"`. `sources` is a parameter so the rule is testable on a substituted
|
|
497
|
+
* profile.
|
|
498
|
+
*/
|
|
499
|
+
export declare function sessionKind(provider: DatabaseProvider, claims: SessionClaims, sources?: Readonly<Record<DatabaseProvider, IdentitySource>>): "user" | "anonymous" | "invalid";
|
|
500
|
+
/**
|
|
501
|
+
* Creates the command runtime (P4 spec §6.5): validates the catalog and the
|
|
502
|
+
* object modules, checks the facts of the login role, the request-role
|
|
503
|
+
* membership and the applied snapshot hash in one read-only transaction.
|
|
504
|
+
* Rejects with `CommandFailure` (`command.privileged-login`,
|
|
505
|
+
* `command.model-mismatch`, `command.read-role-missing`, …); an invalid
|
|
506
|
+
* catalog or module map throws before any database call.
|
|
507
|
+
*/
|
|
508
|
+
export declare function createCommandRuntime(options: CommandRuntimeOptions): Promise<CommandRuntime>;
|
|
509
|
+
/**
|
|
510
|
+
* Facts about the request origin that the host passes to the data handler.
|
|
511
|
+
* An HTTP call carries the `Sec-Fetch-Site` and `Origin` header values (absent
|
|
512
|
+
* header = absent field) and the origin the host serves from; a call inside
|
|
513
|
+
* the server process (SSR) is `{ inProcess: true }`.
|
|
514
|
+
*/
|
|
515
|
+
type RequestOrigin = {
|
|
516
|
+
secFetchSite?: string;
|
|
517
|
+
origin?: string;
|
|
518
|
+
expectedOrigin: string;
|
|
519
|
+
} | {
|
|
520
|
+
inProcess: true;
|
|
521
|
+
};
|
|
522
|
+
/**
|
|
523
|
+
* Step 0 of the data handler: refuses a request that could be forged by
|
|
524
|
+
* another site. Runs before the envelope is parsed, so it touches nothing but
|
|
525
|
+
* the origin facts (and, for `inProcess`, the raw request type).
|
|
526
|
+
*
|
|
527
|
+
* @returns the refusal, or `undefined` when the request may proceed.
|
|
528
|
+
*/
|
|
529
|
+
export declare function checkRequestOrigin(origin: RequestOrigin, rawRequest: unknown): CommandError | undefined;
|
|
530
|
+
/**
|
|
531
|
+
* Creates the data handler of the transport (P4-B spec §4.5): checks the
|
|
532
|
+
* request origin, the envelope, the session and the compatibility with the
|
|
533
|
+
* runtime catalog, maps the wire form to the logical one, calls the runtime
|
|
534
|
+
* and fits the encoded value into the response budget. Every response
|
|
535
|
+
* carries `serverHash` — the catalog's `snapshotHash`. A `CommandFailure`
|
|
536
|
+
* becomes an error value in wire form; any other exception is
|
|
537
|
+
* `command.internal` with no text and goes to `log` (default
|
|
538
|
+
* `console.error`). The handler keeps no state between calls.
|
|
539
|
+
*/
|
|
540
|
+
export declare function createDataHandler(runtime: CommandRuntime, options?: {
|
|
541
|
+
log?: (error: unknown) => void;
|
|
542
|
+
}): (session: SessionClaims, request: unknown, origin: RequestOrigin) => Promise<DataResponse>;
|
|
543
|
+
/** The verb of an agent write tool. */
|
|
544
|
+
type AgentVerb = "write" | "remove";
|
|
545
|
+
/** The verb of every runtime operation. */
|
|
546
|
+
export declare const OPERATION_VERBS: Readonly<Record<ObjectOperation, AgentVerb>>;
|
|
547
|
+
/** An attribute in a description: what an agent needs to build a query and values. */
|
|
548
|
+
interface AgentAttributeDescription {
|
|
549
|
+
name: string;
|
|
550
|
+
type: string;
|
|
551
|
+
array?: true;
|
|
552
|
+
required: boolean;
|
|
553
|
+
maxLength?: number;
|
|
554
|
+
/** May be set on create / on update. */
|
|
555
|
+
insert: boolean;
|
|
556
|
+
update: boolean;
|
|
557
|
+
generated?: true;
|
|
558
|
+
enumValues?: {
|
|
559
|
+
name: string;
|
|
560
|
+
label: string;
|
|
561
|
+
}[];
|
|
562
|
+
/** The target of a single-target `Ref`. */
|
|
563
|
+
ref?: MetadataRef;
|
|
564
|
+
/** The targets of a polymorphic `Ref` (`allowedTypes`). */
|
|
565
|
+
allowedTypes?: MetadataRef[];
|
|
566
|
+
title?: LocalizedString;
|
|
567
|
+
description?: LocalizedString;
|
|
568
|
+
}
|
|
569
|
+
interface AgentObjectDescription {
|
|
570
|
+
object: MetadataRef;
|
|
571
|
+
kindLabel: string;
|
|
572
|
+
title?: LocalizedString;
|
|
573
|
+
description?: LocalizedString;
|
|
574
|
+
/** The logical name of the row key and the presentation attribute. */
|
|
575
|
+
key: string;
|
|
576
|
+
presentation?: string;
|
|
577
|
+
attributes: AgentAttributeDescription[];
|
|
578
|
+
tabularSections: {
|
|
579
|
+
name: string;
|
|
580
|
+
title?: LocalizedString;
|
|
581
|
+
attributes: AgentAttributeDescription[];
|
|
582
|
+
}[];
|
|
583
|
+
verbs: AgentVerb[];
|
|
584
|
+
operations: ObjectOperation[];
|
|
585
|
+
}
|
|
586
|
+
/** A list entry: an object without its fields. */
|
|
587
|
+
interface AgentObjectSummary {
|
|
588
|
+
object: MetadataRef;
|
|
589
|
+
title?: LocalizedString;
|
|
590
|
+
description?: LocalizedString;
|
|
591
|
+
verbs: AgentVerb[];
|
|
592
|
+
operations: ObjectOperation[];
|
|
593
|
+
}
|
|
594
|
+
/** A named object is not in the runtime catalog (`catalog.unknown-object`). */
|
|
595
|
+
export declare class AgentUnknownObject extends Error {
|
|
596
|
+
readonly object: MetadataRef;
|
|
597
|
+
constructor(object: MetadataRef);
|
|
598
|
+
}
|
|
599
|
+
interface AgentCorePermissions {
|
|
600
|
+
/** Permission to write rights: rights catalogs and a scope root with a creator. */
|
|
601
|
+
rightsWrite?: boolean;
|
|
602
|
+
}
|
|
603
|
+
/** What the catalog needs from a command runtime. */
|
|
604
|
+
interface AgentRuntime {
|
|
605
|
+
readonly catalog: RuntimeCatalog;
|
|
606
|
+
run(session: SessionClaims, input: readonly Batch[number][]): Promise<CommandResult>;
|
|
607
|
+
read(session: SessionClaims, query: ReadQuery): Promise<ReadResult>;
|
|
608
|
+
}
|
|
609
|
+
interface AgentCoreOptions {
|
|
610
|
+
runtime: AgentRuntime;
|
|
611
|
+
permissions?: AgentCorePermissions;
|
|
612
|
+
}
|
|
613
|
+
/**
|
|
614
|
+
* The core of the agent tool catalog: data in JSON form, with no presentation
|
|
615
|
+
* limits. It calls only the command runtime methods; there is no other path to
|
|
616
|
+
* the database. A refusal is the runtime's `CommandFailure`, the guard's
|
|
617
|
+
* `AgentWriteRefused` or `AgentUnknownObject`.
|
|
618
|
+
*/
|
|
619
|
+
interface AgentCore {
|
|
620
|
+
/** Without a name: every catalog object; with a name: that object's description. */
|
|
621
|
+
describe(): {
|
|
622
|
+
objects: AgentObjectSummary[];
|
|
623
|
+
};
|
|
624
|
+
describe(object: MetadataRef): AgentObjectDescription;
|
|
625
|
+
describe(object?: MetadataRef): {
|
|
626
|
+
objects: AgentObjectSummary[];
|
|
627
|
+
} | AgentObjectDescription;
|
|
628
|
+
read(session: SessionClaims, query: ReadQuery): Promise<unknown>;
|
|
629
|
+
/** Runs a batch of one or more objects; every verb goes through this one point. */
|
|
630
|
+
execute(session: SessionClaims, batch: Batch): Promise<unknown>;
|
|
631
|
+
}
|
|
632
|
+
export declare function createAgentCore(options: AgentCoreOptions): AgentCore;
|
|
633
|
+
/** The closed set of codes an agent tool result may carry. */
|
|
634
|
+
export declare const AGENT_ERROR_CODES: readonly ["command.forbidden", "command.conflict", "command.invalid", "command.constraint", "command.context", "command.unauthenticated", "command.rejected", "command.nested", "command.depth", "command.retry-exhausted", "command.model-mismatch", "command.read-role-missing", "command.privileged-login", "command.unavailable", "command.timeout", "command.busy", "command.stale-client", "command.internal", "catalog.invalid-input", "catalog.unknown-tool", "catalog.unknown-object", "catalog.rights-write-refused", "catalog.result-too-large"];
|
|
635
|
+
type AgentErrorCode = (typeof AGENT_ERROR_CODES)[number];
|
|
636
|
+
/**
|
|
637
|
+
* The next step for an agent: `retry` — the same call may work later;
|
|
638
|
+
* `ask_user` — a human has to decide or fix something; `fix_input` — change
|
|
639
|
+
* the call and send it again.
|
|
640
|
+
*/
|
|
641
|
+
type AgentOutcome = "retry" | "ask_user" | "fix_input";
|
|
642
|
+
/** The outcome of every error code. */
|
|
643
|
+
export declare const AGENT_OUTCOMES: Readonly<Record<AgentErrorCode, AgentOutcome>>;
|
|
644
|
+
/** An error result of a tool: always with `hint` and `outcome`. */
|
|
645
|
+
interface AgentToolError {
|
|
646
|
+
code: AgentErrorCode;
|
|
647
|
+
message: string;
|
|
648
|
+
hint: string;
|
|
649
|
+
outcome: AgentOutcome;
|
|
650
|
+
/** Logical path of the offending input (`catalog.invalid-input`). */
|
|
651
|
+
path?: string;
|
|
652
|
+
/** The runtime's error, intact (`command.*` codes). */
|
|
653
|
+
error?: CommandError;
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* `awaiting_confirmation` is reserved for a two-step write confirmed by a
|
|
657
|
+
* human (ADR-0104); the first release never returns it.
|
|
658
|
+
*/
|
|
659
|
+
type AgentToolState = "done" | "awaiting_confirmation";
|
|
660
|
+
/** A successful tool result. */
|
|
661
|
+
interface AgentToolSuccess {
|
|
662
|
+
state: AgentToolState;
|
|
663
|
+
data?: unknown;
|
|
664
|
+
/** The result was cut to fit the size limit. */
|
|
665
|
+
truncated?: true;
|
|
666
|
+
/** Where the next page of a cut `read` starts. */
|
|
667
|
+
continuation?: {
|
|
668
|
+
offset: number;
|
|
669
|
+
};
|
|
670
|
+
/** How to get the rest of a cut result. */
|
|
671
|
+
hint?: string;
|
|
672
|
+
}
|
|
673
|
+
type AgentToolResult = AgentToolSuccess | AgentToolError;
|
|
674
|
+
/** A tool result in the shape of an MCP `CallToolResult`. */
|
|
675
|
+
interface AgentMcpResult {
|
|
676
|
+
structuredContent?: AgentToolSuccess;
|
|
677
|
+
content: [{
|
|
678
|
+
type: "text";
|
|
679
|
+
text: string;
|
|
680
|
+
}];
|
|
681
|
+
isError?: true;
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* Presents a result for MCP without the SDK. Clients show the model different
|
|
685
|
+
* parts, so both are self-contained: `structuredContent` is the result object
|
|
686
|
+
* and `content` its full JSON text. An error carries only `content`: clients
|
|
687
|
+
* show nothing else when `isError` is set.
|
|
688
|
+
*/
|
|
689
|
+
export declare function agentResultToMcp(result: AgentToolResult): AgentMcpResult;
|
|
690
|
+
/** MCP tool annotations; every one is explicit, the MCP defaults are unsafe. */
|
|
691
|
+
interface AgentToolAnnotations {
|
|
692
|
+
readOnlyHint: boolean;
|
|
693
|
+
destructiveHint: boolean;
|
|
694
|
+
idempotentHint: boolean;
|
|
695
|
+
openWorldHint: false;
|
|
696
|
+
}
|
|
697
|
+
/** A tool of the catalog: what an adapter lists in `tools/list`. */
|
|
698
|
+
interface AgentTool {
|
|
699
|
+
/** Matches `^[a-z][a-z0-9_]{0,47}$`. */
|
|
700
|
+
name: string;
|
|
701
|
+
title: string;
|
|
702
|
+
/** At most 4096 characters. */
|
|
703
|
+
description: string;
|
|
704
|
+
/** The input schema; the adapter derives the JSON Schema from it. */
|
|
705
|
+
input: z.ZodType;
|
|
706
|
+
annotations: AgentToolAnnotations;
|
|
707
|
+
}
|
|
708
|
+
/**
|
|
709
|
+
* Converts runtime values to JSON: `bigint` becomes a decimal string, which
|
|
710
|
+
* the `BigInt` input of T0 accepts back. The single place of this conversion.
|
|
711
|
+
*/
|
|
712
|
+
export declare function toJson(value: unknown): unknown;
|
|
713
|
+
/** The guard refused a batch that writes rights without permission; carries the object. */
|
|
714
|
+
export declare class AgentWriteRefused extends Error {
|
|
715
|
+
readonly object: MetadataRef;
|
|
716
|
+
constructor(object: MetadataRef);
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* The rights-write guard: a pure function over the runtime catalog and a batch,
|
|
720
|
+
* so an adapter can call it before opening a pool. It refuses when any
|
|
721
|
+
* operation of the batch (not only the first) touches a rights system catalog
|
|
722
|
+
* (its operations have the `administerRights` context) or creates a scope root
|
|
723
|
+
* with a creator. An object outside the catalog is skipped: the runtime schema
|
|
724
|
+
* rejects it. Without `rightsWrite` the refusal comes before the database.
|
|
725
|
+
*/
|
|
726
|
+
export declare function agentWriteRefusal(catalog: RuntimeCatalog, batch: Batch, permissions: {
|
|
727
|
+
rightsWrite: boolean;
|
|
728
|
+
}): {
|
|
729
|
+
object: MetadataRef;
|
|
730
|
+
} | undefined;
|
|
731
|
+
interface AgentToolCatalogOptions {
|
|
732
|
+
runtime: CommandRuntime;
|
|
733
|
+
/** Given at creation, not per call: no write path goes around the guard. */
|
|
734
|
+
permissions?: AgentCorePermissions;
|
|
735
|
+
/** Size limit of a result text in characters; default 44 000. */
|
|
736
|
+
maxResultChars?: number;
|
|
737
|
+
}
|
|
738
|
+
/**
|
|
739
|
+
* The agent tool catalog: the tool layer (`tools`, `call`) over the core
|
|
740
|
+
* (`describe`, `read`, `execute`, data in JSON form).
|
|
741
|
+
*/
|
|
742
|
+
interface AgentToolCatalog extends AgentCore {
|
|
743
|
+
readonly tools: readonly AgentTool[];
|
|
744
|
+
call(session: SessionClaims, name: string, input: unknown): Promise<AgentToolResult>;
|
|
745
|
+
}
|
|
746
|
+
export declare function createAgentToolCatalog(options: AgentToolCatalogOptions): AgentToolCatalog;
|
|
747
|
+
export type { AgentAttributeDescription, AgentCore, AgentCoreOptions, AgentCorePermissions, AgentErrorCode, AgentMcpResult, AgentObjectDescription, AgentObjectSummary, AgentOutcome, AgentTool, AgentToolAnnotations, AgentToolCatalog, AgentToolCatalogOptions, AgentToolError, AgentToolResult, AgentToolState, AgentToolSuccess, AgentVerb, AttachFileInput, CheckUploadInput, CommandDatabase, CommandRunOptions, CommandRuntime, CommandRuntimeOptions, DatabaseClient, FileStore, LogEntry, PgPoolLike, ReadPartOutcome, ReadPartsOptions, ReadPartsResult, ReconcileLogEntry, ReconcileOptions, ReconcileRefusal, ReconcileReport, RequestOrigin, S3ClientLike, UploadLimits };
|