@orkestrel/tool 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/core/index.cjs +195 -87
- package/dist/src/core/index.cjs.map +1 -1
- package/dist/src/core/index.d.cts +84 -24
- package/dist/src/core/index.d.ts +84 -24
- package/dist/src/core/index.js +195 -88
- package/dist/src/core/index.js.map +1 -1
- package/dist/src/server/index.cjs +225 -160
- package/dist/src/server/index.cjs.map +1 -1
- package/dist/src/server/index.d.cts +68 -26
- package/dist/src/server/index.d.ts +68 -26
- package/dist/src/server/index.js +225 -162
- package/dist/src/server/index.js.map +1 -1
- package/package.json +20 -20
|
@@ -296,12 +296,12 @@ export declare interface AnswerToolOptions {
|
|
|
296
296
|
* union directly, so `value` is typed as the full `string | boolean | readonly string[]` union
|
|
297
297
|
* here (no lossy string-only fallback needed).
|
|
298
298
|
*/
|
|
299
|
-
export declare const answerToolShape: UnionShape<[ ObjectShape<{
|
|
299
|
+
export declare const answerToolShape: UnionShape<readonly [ ObjectShape<{
|
|
300
300
|
operation: LiteralShape<readonly ["pending"]>;
|
|
301
301
|
}, false>, ObjectShape<{
|
|
302
302
|
operation: LiteralShape<readonly ["answer"]>;
|
|
303
303
|
id: StringShape;
|
|
304
|
-
value: UnionShape<[ StringShape, BooleanShape, ArrayShape<StringShape>]>;
|
|
304
|
+
value: UnionShape<readonly [ StringShape, BooleanShape, ArrayShape<StringShape>]>;
|
|
305
305
|
}, false>]>;
|
|
306
306
|
|
|
307
307
|
/**
|
|
@@ -379,7 +379,7 @@ export declare type ColumnSpec = ColumnKind | Readonly<{
|
|
|
379
379
|
}>;
|
|
380
380
|
|
|
381
381
|
/** A {@link import('./types.js').ColumnSpec} — a bare {@link columnKindShape}, or `{ type, optional }`. */
|
|
382
|
-
export declare const columnSpecShape: UnionShape<[ LiteralShape<readonly ["string", "integer", "number", "boolean"]>, ObjectShape<{
|
|
382
|
+
export declare const columnSpecShape: UnionShape<readonly [ LiteralShape<readonly ["string", "integer", "number", "boolean"]>, ObjectShape<{
|
|
383
383
|
type: LiteralShape<readonly ["string", "integer", "number", "boolean"]>;
|
|
384
384
|
optional: OptionalShape<BooleanShape>;
|
|
385
385
|
}, false>]>;
|
|
@@ -1258,6 +1258,66 @@ export declare class DatabaseDefinitionStore implements DefinitionStoreInterface
|
|
|
1258
1258
|
delete(id: string): Promise<void>;
|
|
1259
1259
|
}
|
|
1260
1260
|
|
|
1261
|
+
/**
|
|
1262
|
+
* Resolve database definitions into cached live handles for database tools.
|
|
1263
|
+
*
|
|
1264
|
+
* @example
|
|
1265
|
+
* ```ts
|
|
1266
|
+
* import { DatabaseResolver } from '@orkestrel/tool'
|
|
1267
|
+
*
|
|
1268
|
+
* const resolver = new DatabaseResolver(handles, drivers, key, store)
|
|
1269
|
+
* const database = await resolver.resolve('shop')
|
|
1270
|
+
* ```
|
|
1271
|
+
*/
|
|
1272
|
+
export declare class DatabaseResolver {
|
|
1273
|
+
#private;
|
|
1274
|
+
/**
|
|
1275
|
+
* Create a database resolver over the tool's live state and optional definition store.
|
|
1276
|
+
*
|
|
1277
|
+
* @param handles - Initial live database handles cached by id
|
|
1278
|
+
* @param drivers - Driver factories keyed by definition driver name
|
|
1279
|
+
* @param key - Key generator supplied to newly created databases
|
|
1280
|
+
* @param store - Optional persistent definition store
|
|
1281
|
+
*/
|
|
1282
|
+
constructor(handles: ReadonlyMap<string, DatabaseInterface>, drivers: Readonly<Record<string, () => DriverInterface>>, key: KeyFunction, store?: DefinitionStoreInterface);
|
|
1283
|
+
/**
|
|
1284
|
+
* Determine whether a live database is cached by id.
|
|
1285
|
+
*
|
|
1286
|
+
* @param id - Database id
|
|
1287
|
+
* @returns Whether a live handle is cached
|
|
1288
|
+
*/
|
|
1289
|
+
has(id: string): boolean;
|
|
1290
|
+
/**
|
|
1291
|
+
* Read a cached database without consulting the definition store.
|
|
1292
|
+
*
|
|
1293
|
+
* @param id - Database id
|
|
1294
|
+
* @returns The cached live database, or `undefined`
|
|
1295
|
+
*/
|
|
1296
|
+
get(id: string): DatabaseInterface | undefined;
|
|
1297
|
+
/**
|
|
1298
|
+
* Cache a live database by id.
|
|
1299
|
+
*
|
|
1300
|
+
* @param id - Database id
|
|
1301
|
+
* @param database - Live database handle
|
|
1302
|
+
* @returns Nothing
|
|
1303
|
+
*/
|
|
1304
|
+
set(id: string, database: DatabaseInterface): void;
|
|
1305
|
+
/**
|
|
1306
|
+
* Remove a cached live database by id.
|
|
1307
|
+
*
|
|
1308
|
+
* @param id - Database id
|
|
1309
|
+
* @returns Nothing
|
|
1310
|
+
*/
|
|
1311
|
+
delete(id: string): void;
|
|
1312
|
+
/**
|
|
1313
|
+
* Resolve a cached or stored database by id.
|
|
1314
|
+
*
|
|
1315
|
+
* @param id - Database definition id
|
|
1316
|
+
* @returns The cached or newly constructed live database
|
|
1317
|
+
*/
|
|
1318
|
+
resolve(id: string): Promise<DatabaseInterface>;
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1261
1321
|
/**
|
|
1262
1322
|
* Map a caught error to the {@link AgentToolErrorCode} the upcoming database tool should throw
|
|
1263
1323
|
* with — the pure classification step of that factory's error handling, mirroring
|
|
@@ -1324,11 +1384,11 @@ export declare interface DatabaseToolOptions {
|
|
|
1324
1384
|
* `'aggregate'` carry an optional `criteria` (the SERIALIZED form — `values` is ALWAYS an array,
|
|
1325
1385
|
* even for a single-value operator, so a caller never chains method calls or guesses arity).
|
|
1326
1386
|
*/
|
|
1327
|
-
export declare const databaseToolShape: UnionShape<[ ObjectShape<{
|
|
1387
|
+
export declare const databaseToolShape: UnionShape<readonly [ ObjectShape<{
|
|
1328
1388
|
operation: LiteralShape<readonly ["create"]>;
|
|
1329
1389
|
id: StringShape;
|
|
1330
1390
|
tables: ObjectShape<Record<never, never>, ObjectShape<{
|
|
1331
|
-
columns: ObjectShape<Record<never, never>, UnionShape<[ LiteralShape<readonly ["string", "integer", "number", "boolean"]>, ObjectShape<{
|
|
1391
|
+
columns: ObjectShape<Record<never, never>, UnionShape<readonly [ LiteralShape<readonly ["string", "integer", "number", "boolean"]>, ObjectShape<{
|
|
1332
1392
|
type: LiteralShape<readonly ["string", "integer", "number", "boolean"]>;
|
|
1333
1393
|
optional: OptionalShape<BooleanShape>;
|
|
1334
1394
|
}, false>]>>;
|
|
@@ -1342,7 +1402,7 @@ export declare const databaseToolShape: UnionShape<[ ObjectShape<{
|
|
|
1342
1402
|
operation: LiteralShape<readonly ["get"]>;
|
|
1343
1403
|
id: StringShape;
|
|
1344
1404
|
table: StringShape;
|
|
1345
|
-
key: UnionShape<[ ArrayShape<UnionShape<[ StringShape, NumberShape]>>, StringShape, NumberShape]>;
|
|
1405
|
+
key: UnionShape<readonly [ ArrayShape<UnionShape<readonly [ StringShape, NumberShape]>>, StringShape, NumberShape]>;
|
|
1346
1406
|
}, false>, ObjectShape<{
|
|
1347
1407
|
operation: LiteralShape<readonly ["records"]>;
|
|
1348
1408
|
id: StringShape;
|
|
@@ -1403,28 +1463,28 @@ export declare const databaseToolShape: UnionShape<[ ObjectShape<{
|
|
|
1403
1463
|
operation: LiteralShape<readonly ["add"]>;
|
|
1404
1464
|
id: StringShape;
|
|
1405
1465
|
table: StringShape;
|
|
1406
|
-
row: UnionShape<[ ArrayShape<ObjectShape<Record<never, never>, JSONShape>>, ObjectShape<Record<never, never>, JSONShape>]>;
|
|
1466
|
+
row: UnionShape<readonly [ ArrayShape<ObjectShape<Record<never, never>, JSONShape>>, ObjectShape<Record<never, never>, JSONShape>]>;
|
|
1407
1467
|
}, false>, ObjectShape<{
|
|
1408
1468
|
operation: LiteralShape<readonly ["set"]>;
|
|
1409
1469
|
id: StringShape;
|
|
1410
1470
|
table: StringShape;
|
|
1411
|
-
row: UnionShape<[ ArrayShape<ObjectShape<Record<never, never>, JSONShape>>, ObjectShape<Record<never, never>, JSONShape>]>;
|
|
1471
|
+
row: UnionShape<readonly [ ArrayShape<ObjectShape<Record<never, never>, JSONShape>>, ObjectShape<Record<never, never>, JSONShape>]>;
|
|
1412
1472
|
}, false>, ObjectShape<{
|
|
1413
1473
|
operation: LiteralShape<readonly ["update"]>;
|
|
1414
1474
|
id: StringShape;
|
|
1415
1475
|
table: StringShape;
|
|
1416
|
-
key: UnionShape<[ ArrayShape<UnionShape<[ StringShape, NumberShape]>>, StringShape, NumberShape]>;
|
|
1476
|
+
key: UnionShape<readonly [ ArrayShape<UnionShape<readonly [ StringShape, NumberShape]>>, StringShape, NumberShape]>;
|
|
1417
1477
|
changes: ObjectShape<Record<never, never>, JSONShape>;
|
|
1418
1478
|
}, false>, ObjectShape<{
|
|
1419
1479
|
operation: LiteralShape<readonly ["remove"]>;
|
|
1420
1480
|
id: StringShape;
|
|
1421
1481
|
table: StringShape;
|
|
1422
|
-
key: UnionShape<[ ArrayShape<UnionShape<[ StringShape, NumberShape]>>, StringShape, NumberShape]>;
|
|
1482
|
+
key: UnionShape<readonly [ ArrayShape<UnionShape<readonly [ StringShape, NumberShape]>>, StringShape, NumberShape]>;
|
|
1423
1483
|
}, false>, ObjectShape<{
|
|
1424
1484
|
operation: LiteralShape<readonly ["migrate"]>;
|
|
1425
1485
|
id: StringShape;
|
|
1426
1486
|
tables: ObjectShape<Record<never, never>, ObjectShape<{
|
|
1427
|
-
columns: ObjectShape<Record<never, never>, UnionShape<[ LiteralShape<readonly ["string", "integer", "number", "boolean"]>, ObjectShape<{
|
|
1487
|
+
columns: ObjectShape<Record<never, never>, UnionShape<readonly [ LiteralShape<readonly ["string", "integer", "number", "boolean"]>, ObjectShape<{
|
|
1428
1488
|
type: LiteralShape<readonly ["string", "integer", "number", "boolean"]>;
|
|
1429
1489
|
optional: OptionalShape<BooleanShape>;
|
|
1430
1490
|
}, false>]>>;
|
|
@@ -1707,7 +1767,7 @@ export declare function isColumnSpec(value: unknown): value is ColumnSpec;
|
|
|
1707
1767
|
export declare function isDatabaseDefinition(value: unknown): value is DatabaseDefinition;
|
|
1708
1768
|
|
|
1709
1769
|
/** One key value — a string or number; the array form (multiple keys, positional) resolves FIRST per AGENTS §9.2. */
|
|
1710
|
-
export declare const keyShape: UnionShape<[ ArrayShape<UnionShape<[ StringShape, NumberShape]>>, StringShape, NumberShape]>;
|
|
1770
|
+
export declare const keyShape: UnionShape<readonly [ ArrayShape<UnionShape<readonly [ StringShape, NumberShape]>>, StringShape, NumberShape]>;
|
|
1711
1771
|
|
|
1712
1772
|
/** Map one {@link import('./types.js').ColumnKind} to its primitive `@orkestrel/database` shape — the leaf {@link columnShape} wraps. */
|
|
1713
1773
|
export declare function kindShape(kind: ColumnKind): ContractShape;
|
|
@@ -1918,7 +1978,7 @@ export declare const RELATION_TOOL_NAME = "relation";
|
|
|
1918
1978
|
export declare const RELATION_TOOL_SUMMARY = "Traverse and edit relationships between database rows \u2014 one operation per call (load, find, link, unlink, links), chosen by the 'operation' field. Call describe('relation') for the include-path syntax.";
|
|
1919
1979
|
|
|
1920
1980
|
/** One key value — a string or number; the array form (multiple keys, positional) resolves FIRST per AGENTS §9.2. */
|
|
1921
|
-
export declare const relationKeyShape: UnionShape<[ ArrayShape<UnionShape<[ StringShape, NumberShape]>>, StringShape, NumberShape]>;
|
|
1981
|
+
export declare const relationKeyShape: UnionShape<readonly [ ArrayShape<UnionShape<readonly [ StringShape, NumberShape]>>, StringShape, NumberShape]>;
|
|
1922
1982
|
|
|
1923
1983
|
/**
|
|
1924
1984
|
* Resolve which registered {@link RelationManagerInterface} a relation-tool call addresses — the
|
|
@@ -1994,11 +2054,11 @@ export declare interface RelationToolOptions {
|
|
|
1994
2054
|
* fetches rows (pagination / sort only) with `include` attached. `'link'` / `'unlink'` write /
|
|
1995
2055
|
* remove a `through` junction row; `'links'` lists a `through` relation's linked keys.
|
|
1996
2056
|
*/
|
|
1997
|
-
export declare const relationToolShape: UnionShape<[ ObjectShape<{
|
|
2057
|
+
export declare const relationToolShape: UnionShape<readonly [ ObjectShape<{
|
|
1998
2058
|
operation: LiteralShape<readonly ["load"]>;
|
|
1999
2059
|
manager: OptionalShape<StringShape>;
|
|
2000
2060
|
model: StringShape;
|
|
2001
|
-
key: UnionShape<[ ArrayShape<UnionShape<[ StringShape, NumberShape]>>, StringShape, NumberShape]>;
|
|
2061
|
+
key: UnionShape<readonly [ ArrayShape<UnionShape<readonly [ StringShape, NumberShape]>>, StringShape, NumberShape]>;
|
|
2002
2062
|
include: OptionalShape<ArrayShape<StringShape>>;
|
|
2003
2063
|
}, false>, ObjectShape<{
|
|
2004
2064
|
operation: LiteralShape<readonly ["find"]>;
|
|
@@ -2013,21 +2073,21 @@ export declare const relationToolShape: UnionShape<[ ObjectShape<{
|
|
|
2013
2073
|
operation: LiteralShape<readonly ["link"]>;
|
|
2014
2074
|
manager: OptionalShape<StringShape>;
|
|
2015
2075
|
model: StringShape;
|
|
2016
|
-
key: UnionShape<[ StringShape, NumberShape]>;
|
|
2076
|
+
key: UnionShape<readonly [ StringShape, NumberShape]>;
|
|
2017
2077
|
relation: StringShape;
|
|
2018
|
-
target: UnionShape<[ StringShape, NumberShape]>;
|
|
2078
|
+
target: UnionShape<readonly [ StringShape, NumberShape]>;
|
|
2019
2079
|
}, false>, ObjectShape<{
|
|
2020
2080
|
operation: LiteralShape<readonly ["unlink"]>;
|
|
2021
2081
|
manager: OptionalShape<StringShape>;
|
|
2022
2082
|
model: StringShape;
|
|
2023
|
-
key: UnionShape<[ StringShape, NumberShape]>;
|
|
2083
|
+
key: UnionShape<readonly [ StringShape, NumberShape]>;
|
|
2024
2084
|
relation: StringShape;
|
|
2025
|
-
target: UnionShape<[ StringShape, NumberShape]>;
|
|
2085
|
+
target: UnionShape<readonly [ StringShape, NumberShape]>;
|
|
2026
2086
|
}, false>, ObjectShape<{
|
|
2027
2087
|
operation: LiteralShape<readonly ["links"]>;
|
|
2028
2088
|
manager: OptionalShape<StringShape>;
|
|
2029
2089
|
model: StringShape;
|
|
2030
|
-
key: UnionShape<[ StringShape, NumberShape]>;
|
|
2090
|
+
key: UnionShape<readonly [ StringShape, NumberShape]>;
|
|
2031
2091
|
relation: StringShape;
|
|
2032
2092
|
}, false>]>;
|
|
2033
2093
|
|
|
@@ -2035,10 +2095,10 @@ export declare const relationToolShape: UnionShape<[ ObjectShape<{
|
|
|
2035
2095
|
export declare const rowShape: ObjectShape<Record<never, never>, JSONShape>;
|
|
2036
2096
|
|
|
2037
2097
|
/** One or many loose rows — the array form resolves FIRST per AGENTS §9.2. */
|
|
2038
|
-
export declare const rowsShape: UnionShape<[ ArrayShape<ObjectShape<Record<never, never>, JSONShape>>, ObjectShape<Record<never, never>, JSONShape>]>;
|
|
2098
|
+
export declare const rowsShape: UnionShape<readonly [ ArrayShape<ObjectShape<Record<never, never>, JSONShape>>, ObjectShape<Record<never, never>, JSONShape>]>;
|
|
2039
2099
|
|
|
2040
2100
|
/** A single row key (not an array) — used by `'link'` / `'unlink'` / `'links'`, which address exactly one owning row. */
|
|
2041
|
-
export declare const singleKeyShape: UnionShape<[ StringShape, NumberShape]>;
|
|
2101
|
+
export declare const singleKeyShape: UnionShape<readonly [ StringShape, NumberShape]>;
|
|
2042
2102
|
|
|
2043
2103
|
/**
|
|
2044
2104
|
* The shape of ONE flat step — `{ name }` — the building block of {@link workflowStepsShape}.
|
|
@@ -2077,7 +2137,7 @@ export declare type TableSpec = Readonly<Record<string, Readonly<{
|
|
|
2077
2137
|
|
|
2078
2138
|
/** A {@link import('./types.js').TableSpec} — table name to `{ columns }`, each column a {@link columnSpecShape}. */
|
|
2079
2139
|
export declare const tableSpecShape: ObjectShape<Record<never, never>, ObjectShape<{
|
|
2080
|
-
columns: ObjectShape<Record<never, never>, UnionShape<[ LiteralShape<readonly ["string", "integer", "number", "boolean"]>, ObjectShape<{
|
|
2140
|
+
columns: ObjectShape<Record<never, never>, UnionShape<readonly [ LiteralShape<readonly ["string", "integer", "number", "boolean"]>, ObjectShape<{
|
|
2081
2141
|
type: LiteralShape<readonly ["string", "integer", "number", "boolean"]>;
|
|
2082
2142
|
optional: OptionalShape<BooleanShape>;
|
|
2083
2143
|
}, false>]>>;
|
|
@@ -2531,7 +2591,7 @@ export declare interface WorkspaceToolOptions {
|
|
|
2531
2591
|
* the model can move between) and `switch` (re-point the active one by `id`) — let a model
|
|
2532
2592
|
* DISCOVER then CHOOSE which workspace the edit / read arms target.
|
|
2533
2593
|
*/
|
|
2534
|
-
export declare const workspaceToolShape: UnionShape<[ ObjectShape<{
|
|
2594
|
+
export declare const workspaceToolShape: UnionShape<readonly [ ObjectShape<{
|
|
2535
2595
|
operation: LiteralShape<readonly ["read"]>;
|
|
2536
2596
|
path: StringShape;
|
|
2537
2597
|
}, false>, ObjectShape<{
|
package/dist/src/core/index.d.ts
CHANGED
|
@@ -296,12 +296,12 @@ export declare interface AnswerToolOptions {
|
|
|
296
296
|
* union directly, so `value` is typed as the full `string | boolean | readonly string[]` union
|
|
297
297
|
* here (no lossy string-only fallback needed).
|
|
298
298
|
*/
|
|
299
|
-
export declare const answerToolShape: UnionShape<[ ObjectShape<{
|
|
299
|
+
export declare const answerToolShape: UnionShape<readonly [ ObjectShape<{
|
|
300
300
|
operation: LiteralShape<readonly ["pending"]>;
|
|
301
301
|
}, false>, ObjectShape<{
|
|
302
302
|
operation: LiteralShape<readonly ["answer"]>;
|
|
303
303
|
id: StringShape;
|
|
304
|
-
value: UnionShape<[ StringShape, BooleanShape, ArrayShape<StringShape>]>;
|
|
304
|
+
value: UnionShape<readonly [ StringShape, BooleanShape, ArrayShape<StringShape>]>;
|
|
305
305
|
}, false>]>;
|
|
306
306
|
|
|
307
307
|
/**
|
|
@@ -379,7 +379,7 @@ export declare type ColumnSpec = ColumnKind | Readonly<{
|
|
|
379
379
|
}>;
|
|
380
380
|
|
|
381
381
|
/** A {@link import('./types.js').ColumnSpec} — a bare {@link columnKindShape}, or `{ type, optional }`. */
|
|
382
|
-
export declare const columnSpecShape: UnionShape<[ LiteralShape<readonly ["string", "integer", "number", "boolean"]>, ObjectShape<{
|
|
382
|
+
export declare const columnSpecShape: UnionShape<readonly [ LiteralShape<readonly ["string", "integer", "number", "boolean"]>, ObjectShape<{
|
|
383
383
|
type: LiteralShape<readonly ["string", "integer", "number", "boolean"]>;
|
|
384
384
|
optional: OptionalShape<BooleanShape>;
|
|
385
385
|
}, false>]>;
|
|
@@ -1258,6 +1258,66 @@ export declare class DatabaseDefinitionStore implements DefinitionStoreInterface
|
|
|
1258
1258
|
delete(id: string): Promise<void>;
|
|
1259
1259
|
}
|
|
1260
1260
|
|
|
1261
|
+
/**
|
|
1262
|
+
* Resolve database definitions into cached live handles for database tools.
|
|
1263
|
+
*
|
|
1264
|
+
* @example
|
|
1265
|
+
* ```ts
|
|
1266
|
+
* import { DatabaseResolver } from '@orkestrel/tool'
|
|
1267
|
+
*
|
|
1268
|
+
* const resolver = new DatabaseResolver(handles, drivers, key, store)
|
|
1269
|
+
* const database = await resolver.resolve('shop')
|
|
1270
|
+
* ```
|
|
1271
|
+
*/
|
|
1272
|
+
export declare class DatabaseResolver {
|
|
1273
|
+
#private;
|
|
1274
|
+
/**
|
|
1275
|
+
* Create a database resolver over the tool's live state and optional definition store.
|
|
1276
|
+
*
|
|
1277
|
+
* @param handles - Initial live database handles cached by id
|
|
1278
|
+
* @param drivers - Driver factories keyed by definition driver name
|
|
1279
|
+
* @param key - Key generator supplied to newly created databases
|
|
1280
|
+
* @param store - Optional persistent definition store
|
|
1281
|
+
*/
|
|
1282
|
+
constructor(handles: ReadonlyMap<string, DatabaseInterface>, drivers: Readonly<Record<string, () => DriverInterface>>, key: KeyFunction, store?: DefinitionStoreInterface);
|
|
1283
|
+
/**
|
|
1284
|
+
* Determine whether a live database is cached by id.
|
|
1285
|
+
*
|
|
1286
|
+
* @param id - Database id
|
|
1287
|
+
* @returns Whether a live handle is cached
|
|
1288
|
+
*/
|
|
1289
|
+
has(id: string): boolean;
|
|
1290
|
+
/**
|
|
1291
|
+
* Read a cached database without consulting the definition store.
|
|
1292
|
+
*
|
|
1293
|
+
* @param id - Database id
|
|
1294
|
+
* @returns The cached live database, or `undefined`
|
|
1295
|
+
*/
|
|
1296
|
+
get(id: string): DatabaseInterface | undefined;
|
|
1297
|
+
/**
|
|
1298
|
+
* Cache a live database by id.
|
|
1299
|
+
*
|
|
1300
|
+
* @param id - Database id
|
|
1301
|
+
* @param database - Live database handle
|
|
1302
|
+
* @returns Nothing
|
|
1303
|
+
*/
|
|
1304
|
+
set(id: string, database: DatabaseInterface): void;
|
|
1305
|
+
/**
|
|
1306
|
+
* Remove a cached live database by id.
|
|
1307
|
+
*
|
|
1308
|
+
* @param id - Database id
|
|
1309
|
+
* @returns Nothing
|
|
1310
|
+
*/
|
|
1311
|
+
delete(id: string): void;
|
|
1312
|
+
/**
|
|
1313
|
+
* Resolve a cached or stored database by id.
|
|
1314
|
+
*
|
|
1315
|
+
* @param id - Database definition id
|
|
1316
|
+
* @returns The cached or newly constructed live database
|
|
1317
|
+
*/
|
|
1318
|
+
resolve(id: string): Promise<DatabaseInterface>;
|
|
1319
|
+
}
|
|
1320
|
+
|
|
1261
1321
|
/**
|
|
1262
1322
|
* Map a caught error to the {@link AgentToolErrorCode} the upcoming database tool should throw
|
|
1263
1323
|
* with — the pure classification step of that factory's error handling, mirroring
|
|
@@ -1324,11 +1384,11 @@ export declare interface DatabaseToolOptions {
|
|
|
1324
1384
|
* `'aggregate'` carry an optional `criteria` (the SERIALIZED form — `values` is ALWAYS an array,
|
|
1325
1385
|
* even for a single-value operator, so a caller never chains method calls or guesses arity).
|
|
1326
1386
|
*/
|
|
1327
|
-
export declare const databaseToolShape: UnionShape<[ ObjectShape<{
|
|
1387
|
+
export declare const databaseToolShape: UnionShape<readonly [ ObjectShape<{
|
|
1328
1388
|
operation: LiteralShape<readonly ["create"]>;
|
|
1329
1389
|
id: StringShape;
|
|
1330
1390
|
tables: ObjectShape<Record<never, never>, ObjectShape<{
|
|
1331
|
-
columns: ObjectShape<Record<never, never>, UnionShape<[ LiteralShape<readonly ["string", "integer", "number", "boolean"]>, ObjectShape<{
|
|
1391
|
+
columns: ObjectShape<Record<never, never>, UnionShape<readonly [ LiteralShape<readonly ["string", "integer", "number", "boolean"]>, ObjectShape<{
|
|
1332
1392
|
type: LiteralShape<readonly ["string", "integer", "number", "boolean"]>;
|
|
1333
1393
|
optional: OptionalShape<BooleanShape>;
|
|
1334
1394
|
}, false>]>>;
|
|
@@ -1342,7 +1402,7 @@ export declare const databaseToolShape: UnionShape<[ ObjectShape<{
|
|
|
1342
1402
|
operation: LiteralShape<readonly ["get"]>;
|
|
1343
1403
|
id: StringShape;
|
|
1344
1404
|
table: StringShape;
|
|
1345
|
-
key: UnionShape<[ ArrayShape<UnionShape<[ StringShape, NumberShape]>>, StringShape, NumberShape]>;
|
|
1405
|
+
key: UnionShape<readonly [ ArrayShape<UnionShape<readonly [ StringShape, NumberShape]>>, StringShape, NumberShape]>;
|
|
1346
1406
|
}, false>, ObjectShape<{
|
|
1347
1407
|
operation: LiteralShape<readonly ["records"]>;
|
|
1348
1408
|
id: StringShape;
|
|
@@ -1403,28 +1463,28 @@ export declare const databaseToolShape: UnionShape<[ ObjectShape<{
|
|
|
1403
1463
|
operation: LiteralShape<readonly ["add"]>;
|
|
1404
1464
|
id: StringShape;
|
|
1405
1465
|
table: StringShape;
|
|
1406
|
-
row: UnionShape<[ ArrayShape<ObjectShape<Record<never, never>, JSONShape>>, ObjectShape<Record<never, never>, JSONShape>]>;
|
|
1466
|
+
row: UnionShape<readonly [ ArrayShape<ObjectShape<Record<never, never>, JSONShape>>, ObjectShape<Record<never, never>, JSONShape>]>;
|
|
1407
1467
|
}, false>, ObjectShape<{
|
|
1408
1468
|
operation: LiteralShape<readonly ["set"]>;
|
|
1409
1469
|
id: StringShape;
|
|
1410
1470
|
table: StringShape;
|
|
1411
|
-
row: UnionShape<[ ArrayShape<ObjectShape<Record<never, never>, JSONShape>>, ObjectShape<Record<never, never>, JSONShape>]>;
|
|
1471
|
+
row: UnionShape<readonly [ ArrayShape<ObjectShape<Record<never, never>, JSONShape>>, ObjectShape<Record<never, never>, JSONShape>]>;
|
|
1412
1472
|
}, false>, ObjectShape<{
|
|
1413
1473
|
operation: LiteralShape<readonly ["update"]>;
|
|
1414
1474
|
id: StringShape;
|
|
1415
1475
|
table: StringShape;
|
|
1416
|
-
key: UnionShape<[ ArrayShape<UnionShape<[ StringShape, NumberShape]>>, StringShape, NumberShape]>;
|
|
1476
|
+
key: UnionShape<readonly [ ArrayShape<UnionShape<readonly [ StringShape, NumberShape]>>, StringShape, NumberShape]>;
|
|
1417
1477
|
changes: ObjectShape<Record<never, never>, JSONShape>;
|
|
1418
1478
|
}, false>, ObjectShape<{
|
|
1419
1479
|
operation: LiteralShape<readonly ["remove"]>;
|
|
1420
1480
|
id: StringShape;
|
|
1421
1481
|
table: StringShape;
|
|
1422
|
-
key: UnionShape<[ ArrayShape<UnionShape<[ StringShape, NumberShape]>>, StringShape, NumberShape]>;
|
|
1482
|
+
key: UnionShape<readonly [ ArrayShape<UnionShape<readonly [ StringShape, NumberShape]>>, StringShape, NumberShape]>;
|
|
1423
1483
|
}, false>, ObjectShape<{
|
|
1424
1484
|
operation: LiteralShape<readonly ["migrate"]>;
|
|
1425
1485
|
id: StringShape;
|
|
1426
1486
|
tables: ObjectShape<Record<never, never>, ObjectShape<{
|
|
1427
|
-
columns: ObjectShape<Record<never, never>, UnionShape<[ LiteralShape<readonly ["string", "integer", "number", "boolean"]>, ObjectShape<{
|
|
1487
|
+
columns: ObjectShape<Record<never, never>, UnionShape<readonly [ LiteralShape<readonly ["string", "integer", "number", "boolean"]>, ObjectShape<{
|
|
1428
1488
|
type: LiteralShape<readonly ["string", "integer", "number", "boolean"]>;
|
|
1429
1489
|
optional: OptionalShape<BooleanShape>;
|
|
1430
1490
|
}, false>]>>;
|
|
@@ -1707,7 +1767,7 @@ export declare function isColumnSpec(value: unknown): value is ColumnSpec;
|
|
|
1707
1767
|
export declare function isDatabaseDefinition(value: unknown): value is DatabaseDefinition;
|
|
1708
1768
|
|
|
1709
1769
|
/** One key value — a string or number; the array form (multiple keys, positional) resolves FIRST per AGENTS §9.2. */
|
|
1710
|
-
export declare const keyShape: UnionShape<[ ArrayShape<UnionShape<[ StringShape, NumberShape]>>, StringShape, NumberShape]>;
|
|
1770
|
+
export declare const keyShape: UnionShape<readonly [ ArrayShape<UnionShape<readonly [ StringShape, NumberShape]>>, StringShape, NumberShape]>;
|
|
1711
1771
|
|
|
1712
1772
|
/** Map one {@link import('./types.js').ColumnKind} to its primitive `@orkestrel/database` shape — the leaf {@link columnShape} wraps. */
|
|
1713
1773
|
export declare function kindShape(kind: ColumnKind): ContractShape;
|
|
@@ -1918,7 +1978,7 @@ export declare const RELATION_TOOL_NAME = "relation";
|
|
|
1918
1978
|
export declare const RELATION_TOOL_SUMMARY = "Traverse and edit relationships between database rows \u2014 one operation per call (load, find, link, unlink, links), chosen by the 'operation' field. Call describe('relation') for the include-path syntax.";
|
|
1919
1979
|
|
|
1920
1980
|
/** One key value — a string or number; the array form (multiple keys, positional) resolves FIRST per AGENTS §9.2. */
|
|
1921
|
-
export declare const relationKeyShape: UnionShape<[ ArrayShape<UnionShape<[ StringShape, NumberShape]>>, StringShape, NumberShape]>;
|
|
1981
|
+
export declare const relationKeyShape: UnionShape<readonly [ ArrayShape<UnionShape<readonly [ StringShape, NumberShape]>>, StringShape, NumberShape]>;
|
|
1922
1982
|
|
|
1923
1983
|
/**
|
|
1924
1984
|
* Resolve which registered {@link RelationManagerInterface} a relation-tool call addresses — the
|
|
@@ -1994,11 +2054,11 @@ export declare interface RelationToolOptions {
|
|
|
1994
2054
|
* fetches rows (pagination / sort only) with `include` attached. `'link'` / `'unlink'` write /
|
|
1995
2055
|
* remove a `through` junction row; `'links'` lists a `through` relation's linked keys.
|
|
1996
2056
|
*/
|
|
1997
|
-
export declare const relationToolShape: UnionShape<[ ObjectShape<{
|
|
2057
|
+
export declare const relationToolShape: UnionShape<readonly [ ObjectShape<{
|
|
1998
2058
|
operation: LiteralShape<readonly ["load"]>;
|
|
1999
2059
|
manager: OptionalShape<StringShape>;
|
|
2000
2060
|
model: StringShape;
|
|
2001
|
-
key: UnionShape<[ ArrayShape<UnionShape<[ StringShape, NumberShape]>>, StringShape, NumberShape]>;
|
|
2061
|
+
key: UnionShape<readonly [ ArrayShape<UnionShape<readonly [ StringShape, NumberShape]>>, StringShape, NumberShape]>;
|
|
2002
2062
|
include: OptionalShape<ArrayShape<StringShape>>;
|
|
2003
2063
|
}, false>, ObjectShape<{
|
|
2004
2064
|
operation: LiteralShape<readonly ["find"]>;
|
|
@@ -2013,21 +2073,21 @@ export declare const relationToolShape: UnionShape<[ ObjectShape<{
|
|
|
2013
2073
|
operation: LiteralShape<readonly ["link"]>;
|
|
2014
2074
|
manager: OptionalShape<StringShape>;
|
|
2015
2075
|
model: StringShape;
|
|
2016
|
-
key: UnionShape<[ StringShape, NumberShape]>;
|
|
2076
|
+
key: UnionShape<readonly [ StringShape, NumberShape]>;
|
|
2017
2077
|
relation: StringShape;
|
|
2018
|
-
target: UnionShape<[ StringShape, NumberShape]>;
|
|
2078
|
+
target: UnionShape<readonly [ StringShape, NumberShape]>;
|
|
2019
2079
|
}, false>, ObjectShape<{
|
|
2020
2080
|
operation: LiteralShape<readonly ["unlink"]>;
|
|
2021
2081
|
manager: OptionalShape<StringShape>;
|
|
2022
2082
|
model: StringShape;
|
|
2023
|
-
key: UnionShape<[ StringShape, NumberShape]>;
|
|
2083
|
+
key: UnionShape<readonly [ StringShape, NumberShape]>;
|
|
2024
2084
|
relation: StringShape;
|
|
2025
|
-
target: UnionShape<[ StringShape, NumberShape]>;
|
|
2085
|
+
target: UnionShape<readonly [ StringShape, NumberShape]>;
|
|
2026
2086
|
}, false>, ObjectShape<{
|
|
2027
2087
|
operation: LiteralShape<readonly ["links"]>;
|
|
2028
2088
|
manager: OptionalShape<StringShape>;
|
|
2029
2089
|
model: StringShape;
|
|
2030
|
-
key: UnionShape<[ StringShape, NumberShape]>;
|
|
2090
|
+
key: UnionShape<readonly [ StringShape, NumberShape]>;
|
|
2031
2091
|
relation: StringShape;
|
|
2032
2092
|
}, false>]>;
|
|
2033
2093
|
|
|
@@ -2035,10 +2095,10 @@ export declare const relationToolShape: UnionShape<[ ObjectShape<{
|
|
|
2035
2095
|
export declare const rowShape: ObjectShape<Record<never, never>, JSONShape>;
|
|
2036
2096
|
|
|
2037
2097
|
/** One or many loose rows — the array form resolves FIRST per AGENTS §9.2. */
|
|
2038
|
-
export declare const rowsShape: UnionShape<[ ArrayShape<ObjectShape<Record<never, never>, JSONShape>>, ObjectShape<Record<never, never>, JSONShape>]>;
|
|
2098
|
+
export declare const rowsShape: UnionShape<readonly [ ArrayShape<ObjectShape<Record<never, never>, JSONShape>>, ObjectShape<Record<never, never>, JSONShape>]>;
|
|
2039
2099
|
|
|
2040
2100
|
/** A single row key (not an array) — used by `'link'` / `'unlink'` / `'links'`, which address exactly one owning row. */
|
|
2041
|
-
export declare const singleKeyShape: UnionShape<[ StringShape, NumberShape]>;
|
|
2101
|
+
export declare const singleKeyShape: UnionShape<readonly [ StringShape, NumberShape]>;
|
|
2042
2102
|
|
|
2043
2103
|
/**
|
|
2044
2104
|
* The shape of ONE flat step — `{ name }` — the building block of {@link workflowStepsShape}.
|
|
@@ -2077,7 +2137,7 @@ export declare type TableSpec = Readonly<Record<string, Readonly<{
|
|
|
2077
2137
|
|
|
2078
2138
|
/** A {@link import('./types.js').TableSpec} — table name to `{ columns }`, each column a {@link columnSpecShape}. */
|
|
2079
2139
|
export declare const tableSpecShape: ObjectShape<Record<never, never>, ObjectShape<{
|
|
2080
|
-
columns: ObjectShape<Record<never, never>, UnionShape<[ LiteralShape<readonly ["string", "integer", "number", "boolean"]>, ObjectShape<{
|
|
2140
|
+
columns: ObjectShape<Record<never, never>, UnionShape<readonly [ LiteralShape<readonly ["string", "integer", "number", "boolean"]>, ObjectShape<{
|
|
2081
2141
|
type: LiteralShape<readonly ["string", "integer", "number", "boolean"]>;
|
|
2082
2142
|
optional: OptionalShape<BooleanShape>;
|
|
2083
2143
|
}, false>]>>;
|
|
@@ -2531,7 +2591,7 @@ export declare interface WorkspaceToolOptions {
|
|
|
2531
2591
|
* the model can move between) and `switch` (re-point the active one by `id`) — let a model
|
|
2532
2592
|
* DISCOVER then CHOOSE which workspace the edit / read arms target.
|
|
2533
2593
|
*/
|
|
2534
|
-
export declare const workspaceToolShape: UnionShape<[ ObjectShape<{
|
|
2594
|
+
export declare const workspaceToolShape: UnionShape<readonly [ ObjectShape<{
|
|
2535
2595
|
operation: LiteralShape<readonly ["read"]>;
|
|
2536
2596
|
path: StringShape;
|
|
2537
2597
|
}, false>, ObjectShape<{
|