@genesislcap/ai-assistant 15.46.5 → 15.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/custom-elements.json +426 -214
  2. package/dist/dts/genesis/config.d.ts +30 -6
  3. package/dist/dts/genesis/config.d.ts.map +1 -1
  4. package/dist/dts/genesis/consumes.d.ts.map +1 -1
  5. package/dist/dts/genesis/event-fields.d.ts.map +1 -1
  6. package/dist/dts/genesis/filter-fields.d.ts +31 -0
  7. package/dist/dts/genesis/filter-fields.d.ts.map +1 -1
  8. package/dist/dts/genesis/index.d.ts +3 -1
  9. package/dist/dts/genesis/index.d.ts.map +1 -1
  10. package/dist/dts/genesis/reference-check.d.ts +83 -0
  11. package/dist/dts/genesis/reference-check.d.ts.map +1 -0
  12. package/dist/dts/genesis/reference-existence.d.ts +110 -0
  13. package/dist/dts/genesis/reference-existence.d.ts.map +1 -0
  14. package/dist/dts/genesis/resource-tools.d.ts +4 -4
  15. package/dist/dts/genesis/resource-tools.d.ts.map +1 -1
  16. package/dist/dts/genesis/review-model.d.ts +2 -2
  17. package/dist/dts/genesis/review-model.d.ts.map +1 -1
  18. package/dist/dts/genesis/row-source.d.ts +32 -0
  19. package/dist/dts/genesis/row-source.d.ts.map +1 -1
  20. package/dist/dts/genesis/server-text.d.ts +29 -0
  21. package/dist/dts/genesis/server-text.d.ts.map +1 -1
  22. package/dist/dts/genesis/types.d.ts +32 -5
  23. package/dist/dts/genesis/types.d.ts.map +1 -1
  24. package/dist/dts/genesis/write-payload.d.ts +14 -1
  25. package/dist/dts/genesis/write-payload.d.ts.map +1 -1
  26. package/dist/dts/genesis/write-plan.d.ts +8 -2
  27. package/dist/dts/genesis/write-plan.d.ts.map +1 -1
  28. package/dist/dts/genesis/write-tools.d.ts +5 -3
  29. package/dist/dts/genesis/write-tools.d.ts.map +1 -1
  30. package/dist/dts/genesis/write-turn.d.ts +4 -1
  31. package/dist/dts/genesis/write-turn.d.ts.map +1 -1
  32. package/dist/esm/genesis/config.js +152 -20
  33. package/dist/esm/genesis/consumes.js +2 -1
  34. package/dist/esm/genesis/event-fields.js +5 -8
  35. package/dist/esm/genesis/filter-fields.js +159 -78
  36. package/dist/esm/genesis/index.js +1 -0
  37. package/dist/esm/genesis/reference-check.js +132 -0
  38. package/dist/esm/genesis/reference-existence.js +283 -0
  39. package/dist/esm/genesis/resource-tools.js +135 -18
  40. package/dist/esm/genesis/review-model.js +3 -1
  41. package/dist/esm/genesis/row-source.js +107 -16
  42. package/dist/esm/genesis/server-text.js +52 -0
  43. package/dist/esm/genesis/write-payload.js +32 -4
  44. package/dist/esm/genesis/write-plan.js +3 -2
  45. package/dist/esm/genesis/write-tools.js +248 -44
  46. package/dist/genesis-consumes.cjs +3 -2
  47. package/dist/genesis-consumes.cjs.map +2 -2
  48. package/dist/genesis-consumes.mjs +3 -2
  49. package/dist/genesis-consumes.mjs.map +2 -2
  50. package/docs/genesis.md +131 -21
  51. package/package.json +17 -17
  52. package/scripts/smoke-genesis-consumes-node.mjs +2 -2
@@ -3,11 +3,11 @@ import { type GenesisAiResource, type GenesisCustomCodeCheck, type GenesisEventO
3
3
  export declare const DEFAULT_MAX_ROWS = 50;
4
4
  export declare const MAX_ROWS_CEILING = 1000;
5
5
  /**
6
- * Whether a request's `maxRows` can be read as a cap: absent, so the default applies, or a finite
7
- * number, which is clamped into range.
6
+ * Whether a request's or a query's `maxRows` can be read as a cap: absent, so the default applies,
7
+ * or a finite number, which is clamped into range.
8
8
  *
9
9
  * @remarks
10
- * Anything else declares SOME cap, and none can be read from it, so the request gets no read tool.
10
+ * Anything else declares SOME cap, and none can be read from it, so the resource gets no read tool.
11
11
  * Having none, it is no row source for a write either: a modify reading through it would answer
12
12
  * "no row matches that key" about a table the model cannot read. One test for both factories, so
13
13
  * they cannot disagree about which requests the assistant reads. The validator is stricter (a
@@ -22,6 +22,17 @@ export declare const capIsReadable: (resource: GenesisAiResource) => boolean;
22
22
  * reaches the model through its description, not its name.
23
23
  */
24
24
  export declare const toolNameOf: (resourceName: string) => string;
25
+ /**
26
+ * The resources whose tool name no earlier one in the list already has.
27
+ *
28
+ * @remarks
29
+ * The tool factories are exported and skip the config validator, and they key handlers by tool
30
+ * name, so two resources that lowercase to one name used to overwrite each other there without a
31
+ * word. The first is kept, and each later one is left out with a warning naming both.
32
+ *
33
+ * @internal
34
+ */
35
+ export declare function firstPerToolName(resources: readonly GenesisAiResource[]): GenesisAiResource[];
25
36
  /**
26
37
  * The op a resource's NAME declares, when it declares one.
27
38
  *
@@ -38,10 +49,20 @@ export declare const toolNameOf: (resourceName: string) => string;
38
49
  */
39
50
  export declare const opFromName: (resourceName: string) => GenesisEventOp | undefined;
40
51
  /**
41
- * A resource the validator left out, and why.
52
+ * What is wrong with a resource's declared `references`, if anything. The validator and the write
53
+ * tools' own rules both use it, because the write tools are exported and a direct call never
54
+ * reaches the validator.
42
55
  *
56
+ * @param op - the op the write is judged by: the declared one for the validator, the decided one
57
+ * for the write tools, which take an op from the name as well.
43
58
  * @internal
44
59
  */
60
+ export declare function referencesProblems(resource: Partial<GenesisAiResource> | null, op?: unknown): string[];
61
+ /**
62
+ * A resource the validator left out, and why.
63
+ *
64
+ * @beta
65
+ */
45
66
  export interface DroppedResource {
46
67
  /** Where it was in the list: `resources[3]`. */
47
68
  at: string;
@@ -52,7 +73,7 @@ export interface DroppedResource {
52
73
  /**
53
74
  * What {@link validateGenesisAiConfig} found.
54
75
  *
55
- * @internal
76
+ * @beta
56
77
  */
57
78
  export interface GenesisAiConfigCheck {
58
79
  /** Problems with the config as a whole. Any one of them blocks the assistant. */
@@ -85,7 +106,10 @@ export interface GenesisAiConfigCheck {
85
106
  *
86
107
  * Leaving out a kind it does not know is survival, not support: the resource does nothing here.
87
108
  *
88
- * @internal
109
+ * Exported so a generator's tests, or an app's seed, can check a config against the rules of the
110
+ * assistant version it installs.
111
+ *
112
+ * @beta
89
113
  */
90
114
  export declare function validateGenesisAiConfig(config: unknown): GenesisAiConfigCheck;
91
115
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/genesis/config.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,iBAAiB,EAEtB,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACpB,MAAM,SAAS,CAAC;AAEjB,wEAAwE;AACxE,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,eAAO,MAAM,gBAAgB,OAAO,CAAC;AAErC;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa,GAAI,UAAU,iBAAiB,KAAG,OAG3D,CAAC;AAMF;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAI,cAAc,MAAM,KAAG,MAAoC,CAAC;AAEvF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,UAAU,GAAI,cAAc,MAAM,KAAG,cAAc,GAAG,SAGlE,CAAC;AAKF;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,gDAAgD;IAChD,EAAE,EAAE,MAAM,CAAC;IACX,yCAAyC;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,iFAAiF;IACjF,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,qEAAqE;IACrE,SAAS,EAAE,iBAAiB,EAAE,CAAC;IAC/B,0DAA0D;IAC1D,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B;;;OAGG;IACH,QAAQ,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACpD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,OAAO,GAAG,oBAAoB,CAoE7E;AASD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,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,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACpD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,OAAO,GAAG,oBAAoB,CAoE7E;AASD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,YAAY,CAAC,QAAQ,EAAE,iBAAiB,GAAG,sBAAsB,CA6ChF"}
@@ -1 +1 @@
1
- {"version":3,"file":"consumes.d.ts","sourceRoot":"","sources":["../../../src/genesis/consumes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,mBAAmB,EAAE,iBAYhC,CAAC"}
1
+ {"version":3,"file":"consumes.d.ts","sourceRoot":"","sources":["../../../src/genesis/consumes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,eAAO,MAAM,mBAAmB,EAAE,iBAahC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"event-fields.d.ts","sourceRoot":"","sources":["../../../src/genesis/event-fields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAkB,MAAM,+BAA+B,CAAC;AAMvF;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,QA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IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,6FAA6F;IAC7F,QAAQ,EAAE,OAAO,CAAC;IAClB,uEAAuE;IACvE,QAAQ,EAAE,OAAO,CAAC;IAClB,gFAAgF;IAChF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,gBAAgB;AAChB,MAAM,MAAM,iBAAiB,GACzB;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,iBAAiB,EAAE,CAAA;CAAE,GAC7C;IACE,MAAM,EAAE,QAAQ,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,OAAO,CAAC;IACnB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAoEN;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,iBAAiB,EAAE,CAAC;IAC5B,+FAA+F;IAC/F,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB;;;OAGG;IACH,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED,gBAAgB;AAChB,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,eAAe,CA8BnE;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,MAAM,EACpB,SAAS,GAAE,MAA4B,GACtC,OAAO,CAAC,iBAAiB,CAAC,CAiE5B"}
@@ -110,8 +110,28 @@ export interface FilterFieldsFrom {
110
110
  */
111
111
  undescribed: string[];
112
112
  }
113
+ /**
114
+ * A metadata field list, or none when the reply holds something else there. A malformed list
115
+ * describes nothing rather than throwing out of the whole tool list.
116
+ *
117
+ * @internal
118
+ */
119
+ export declare const listOf: (value: unknown) => MetadataDetail[];
113
120
  /** @internal */
114
121
  export declare function filterFieldsFrom(metadata: Metadata): FilterFieldsFrom;
122
+ /**
123
+ * A dataserver query's filterable fields, from its own metadata.
124
+ *
125
+ * @remarks
126
+ * A dataserver publishes `TYPE: DATASERVER` and one top-level `FIELD` list: what the query returns,
127
+ * and what a criteria on it may name. That is a different shape from a request's, where a top-level
128
+ * `FIELD` is the INPUT class (see {@link filterFieldsFrom}), so the two are never read by one parser.
129
+ * Every typed field of a filterable type with readable values is offered, enriched ones too: the
130
+ * metadata does not mark them, and the server refuses a filter on one in its own words.
131
+ *
132
+ * @internal
133
+ */
134
+ export declare function queryFieldsFrom(metadata: Metadata): FilterFieldsFrom;
115
135
  /**
116
136
  * Fetches a resource's filterable fields. Never throws.
117
137
  *
@@ -123,4 +143,15 @@ export declare function filterFieldsFrom(metadata: Metadata): FilterFieldsFrom;
123
143
  * @internal
124
144
  */
125
145
  export declare function loadFilterFields(connect: Connect, resourceName: string, timeoutMs?: number): Promise<FilterFieldsResult>;
146
+ /**
147
+ * Fetches a dataserver query's filterable fields. Never throws.
148
+ *
149
+ * @remarks
150
+ * Asked for under the query's name exactly as configured: a query's metadata is published under its
151
+ * own name, and {@link metadataNameOf}'s `REQ_` rule is a request's, so a query that happens to be
152
+ * named `REQ_…` must not lose its prefix.
153
+ *
154
+ * @internal
155
+ */
156
+ export declare function loadQueryFields(connect: Connect, queryName: string, timeoutMs?: number): Promise<FilterFieldsResult>;
126
157
  //# sourceMappingURL=filter-fields.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"filter-fields.d.ts","sourceRoot":"","sources":["../../../src/genesis/filter-fields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAGvF,OAAO,EAAe,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAWlE;;;;;;;;;;;;;;GAcG;AACH,MAAM,MAAM,kBAAkB,GAC1B;IACE,MAAM,EAAE,IAAI,CAAC;IACb,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAAC,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;;;GAKG;AACH,eAAO,MAAM,MAAM,GAAI,OAAO,OAAO,KAAG,cAAc,EAAyC,CAAC;AAEhG,gBAAgB;AAChB,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,GAAG,gBAAgB,CA0CrE;AAkDD;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,gBAAgB,CAUpE;AAED;;;;;;;;;GASG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,MAAM,EACpB,SAAS,GAAE,MAA4B,GACtC,OAAO,CAAC,kBAAkB,CAAC,CAsB7B;AAED;;;;;;;;;GASG;AACH,wBAAsB,eAAe,CACnC,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,MAAM,EACjB,SAAS,GAAE,MAA4B,GACtC,OAAO,CAAC,kBAAkB,CAAC,CAW7B"}
@@ -13,6 +13,8 @@
13
13
  export { GENESIS_AGENT_NAME, registerGenesisAssistant } from './register-genesis-assistant';
14
14
  export { customCodeOf } from './config';
15
15
  export { GENESIS_AI_CONSUMES } from './consumes';
16
+ export { validateGenesisAiConfig } from './config';
17
+ export type { DroppedResource, GenesisAiConfigCheck } from './config';
16
18
  export type { GenesisFilter, GenesisFilterField, GenesisFilterOp } from './criteria';
17
19
  export { createGenesisResourceTools, GENESIS_DATA_SOURCE } from './resource-tools';
18
20
  export { createGenesisWriteTools } from './write-tools';
@@ -21,5 +23,5 @@ export { GENESIS_WRITE_REVIEW, GenesisWriteReview } from './write-review/write-r
21
23
  export type { GenesisChangeRequest, GenesisReviewPayload, GenesisWriteReviewCompletedEventDetail, } from './review-payload';
22
24
  export type { GenesisReadResult, GenesisResourceTools, GenesisResourceToolsOptions, GenesisToolError, } from './resource-tools';
23
25
  export { GENESIS_EVENT_OPS } from './types';
24
- export type { GenesisAiConfig, GenesisAiConsumes, GenesisAiResource, GenesisAssistantExtensions, GenesisAssistantRegistration, GenesisCustomCode, GenesisCustomCodeCheck, GenesisEventOp, GenesisResourceKind, RegisterGenesisAssistantOptions, } from './types';
26
+ export type { GenesisAiConfig, GenesisAiConsumes, GenesisAiResource, GenesisAssistantExtensions, GenesisAssistantRegistration, GenesisCustomCode, GenesisCustomCodeCheck, GenesisEventOp, GenesisReference, GenesisResourceKind, RegisterGenesisAssistantOptions, } from './types';
25
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/genesis/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAC5F,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,YAAY,EAAE,aAAa,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AACrF,OAAO,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,YAAY,EACV,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACvF,YAAY,EACV,oBAAoB,EACpB,oBAAoB,EACpB,sCAAsC,GACvC,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,iBAAiB,EACjB,oBAAoB,EACpB,2BAA2B,EAC3B,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,0BAA0B,EAC1B,4BAA4B,EAC5B,iBAAiB,EACjB,sBAAsB,EACtB,cAA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type { Connect } from '@genesislcap/foundation-comms';
2
+ import { type GenesisFilterField } from './criteria';
3
+ import type { GenesisEventField } from './event-fields';
4
+ import { type GenesisRowSource, type RequestRowSourceOptions } from './row-source';
5
+ import type { GenesisAiResource, GenesisEventOp, GenesisReference } from './types';
6
+ /** One declared reference, and whether it can be checked. */
7
+ export type ReferenceGate = {
8
+ status: 'checkable';
9
+ reference: GenesisReference;
10
+ /** The target read the check goes through. */
11
+ source: GenesisRowSource;
12
+ /** The target fields the check composes its criteria with, by name. */
13
+ targetFields: ReadonlyMap<string, GenesisFilterField>;
14
+ }
15
+ /** It cannot be checked, for a reason asking again will not change. */
16
+ | {
17
+ status: 'unchecked';
18
+ reference: GenesisReference;
19
+ reason: string;
20
+ }
21
+ /** Its target could not be described this time. Asked again next turn. */
22
+ | {
23
+ status: 'transient';
24
+ reference: GenesisReference;
25
+ reason: string;
26
+ };
27
+ /** @internal */
28
+ export interface ReferenceGateDeps {
29
+ /** The request resources the assistant can read: a reference is checked only through one. */
30
+ requestNames: ReadonlySet<string>;
31
+ /** The row source for a target read, one per `REQ_` name. */
32
+ sourceFor: (resource: string) => GenesisRowSource;
33
+ }
34
+ /** The table a `REQ_<T>` reads. */
35
+ export declare const tableOf: (resource: string) => string;
36
+ /**
37
+ * Decides, per declared reference, whether it can be checked. A reference is checkable only when
38
+ * every one of its fields is.
39
+ *
40
+ * @internal
41
+ */
42
+ export declare function gateReferences(references: readonly GenesisReference[], fields: readonly GenesisEventField[], deps: ReferenceGateDeps): Promise<ReferenceGate[]>;
43
+ /** A field whose reference cannot be checked: the read it names, and why not. */
44
+ export interface UncheckedField {
45
+ resource: string;
46
+ reason: string;
47
+ }
48
+ /**
49
+ * What the gates mean for one write tool.
50
+ *
51
+ * @internal
52
+ */
53
+ export interface ReferenceOutcome {
54
+ /** Why an insert gets no tool: a required value it must send cannot be checked. */
55
+ noTool?: string;
56
+ /** Why the tool waits: a target could not be described this time. */
57
+ transient?: string;
58
+ /** Fields left out of the schema: an insert refuses one if sent, a modify keeps the row's. */
59
+ unchecked: ReadonlyMap<string, UncheckedField>;
60
+ /** The references the check reads. */
61
+ checkable: readonly Extract<ReferenceGate, {
62
+ status: 'checkable';
63
+ }>[];
64
+ }
65
+ /**
66
+ * Turns the gates into what the tool does.
67
+ *
68
+ * @internal
69
+ */
70
+ export declare function referenceOutcome(op: GenesisEventOp, fields: readonly GenesisEventField[], gates: readonly ReferenceGate[]): ReferenceOutcome;
71
+ /**
72
+ * The reference gate for one set of write tools: whether each of a write's declared references can
73
+ * be checked, and what that means for its tool. A target read is described once, however many
74
+ * events reference it.
75
+ *
76
+ * @internal
77
+ */
78
+ export declare function createReferenceGate(requestNames: ReadonlySet<string>, timeouts?: RequestRowSourceOptions['timeouts']): (resource: GenesisAiResource, op: GenesisEventOp, fields: readonly GenesisEventField[], connect: Connect) => Promise<ReferenceOutcome>;
79
+ /** What an insert says about a value it cannot check. */
80
+ export declare const notAcceptedHere: (field: string, { resource, reason }: UncheckedField) => string;
81
+ /** What a modify says about a new value it cannot check. */
82
+ export declare const cannotBeChanged: (field: string, { resource, reason }: UncheckedField) => string;
83
+ //# sourceMappingURL=reference-check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reference-check.d.ts","sourceRoot":"","sources":["../../../src/genesis/reference-check.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAe,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,EAC7B,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAQnF,6DAA6D;AAC7D,MAAM,MAAM,aAAa,GACrB;IACE,MAAM,EAAE,WAAW,CAA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AAC,aAAa,EAAE;QAAE,MAAM,EAAE,WAAW,CAAA;KAAE,CAAC,EAAE,CAAC;CACvE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,EAAE,EAAE,cAAc,EAClB,MAAM,EAAE,SAAS,iBAAiB,EAAE,EACpC,KAAK,EAAE,SAAS,aAAa,EAAE,GAC9B,gBAAgB,CA4BlB;AAQD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,EACjC,QAAQ,CAAC,EAAE,uBAAuB,CAAC,UAAU,CAAC,IAY5C,UAAU,iBAAiB,EAC3B,IAAI,cAAc,EAClB,QAAQ,SAAS,iBAAiB,EAAE,EACpC,SAAS,OAAO,KACf,OAAO,CAAC,gBAAgB,CAAC,CAQ7B;AAED,yDAAyD;AACzD,eAAO,MAAM,eAAe,GAAI,OAAO,MAAM,EAAE,sBAAsB,cAAc,KAAG,MAEpB,CAAC;AAEnE,4DAA4D;AAC5D,eAAO,MAAM,eAAe,GAAI,OAAO,MAAM,EAAE,sBAAsB,cAAc,KAAG,MAEpB,CAAC"}
@@ -0,0 +1,110 @@
1
+ import type { Connect } from '@genesislcap/foundation-comms';
2
+ import type { GenesisEventField } from './event-fields';
3
+ import { type ReferenceGate } from './reference-check';
4
+ import type { GenesisKeyCheck } from './row-source';
5
+ import type { GenesisEventOp } from './types';
6
+ /** The most distinct values one call may check. */
7
+ export declare const MAX_REFERENCE_CHECKS = 50;
8
+ type Checkable = Extract<ReferenceGate, {
9
+ status: 'checkable';
10
+ }>;
11
+ /**
12
+ * What the model is told about each field whose reference is checked (contracts C-17.16), by
13
+ * field. Only a checkable group has a sentence: one that cannot be checked is not offered at all.
14
+ *
15
+ * @internal
16
+ */
17
+ export declare function checkedSentences(checkable: readonly Checkable[]): Map<string, string>;
18
+ /**
19
+ * The tool description's line for the references it checks, cap included, or nothing when it
20
+ * checks none.
21
+ *
22
+ * @internal
23
+ */
24
+ export declare function checkedLine(checkable: readonly Checkable[]): string | undefined;
25
+ /** A row on its way to the review, as far as this check needs it. */
26
+ export interface RowForCheck {
27
+ index: number;
28
+ details?: Record<string, unknown>;
29
+ preImage?: Record<string, unknown>;
30
+ problems?: string[];
31
+ }
32
+ /** One group a row sets, and the read that answers for it. */
33
+ export interface ReferenceAsk {
34
+ gate: Checkable;
35
+ /** The write's own fields and the values it sends, in member order. */
36
+ sent: Array<[field: string, value: unknown]>;
37
+ /** What the target's row must hold, by target field. */
38
+ values: Record<string, string>;
39
+ /** Shared by every row that sends the same values to the same read. */
40
+ lookup: string;
41
+ }
42
+ /**
43
+ * The groups one row has to check, and why it is refused before any read. On a modify only a
44
+ * group with a member the write changes: a row that already holds a dangling reference stays
45
+ * editable while the model leaves it alone.
46
+ *
47
+ * @internal
48
+ */
49
+ export declare function asksOf(row: RowForCheck, op: GenesisEventOp, fields: readonly GenesisEventField[], checkable: readonly Checkable[]): {
50
+ asks: ReferenceAsk[];
51
+ problems: string[];
52
+ };
53
+ /**
54
+ * Why a row is refused for what a read said about one of its groups, or nothing when the row it
55
+ * names exists.
56
+ *
57
+ * @internal
58
+ */
59
+ export declare function problemOf(ask: ReferenceAsk, answer: GenesisKeyCheck | undefined): string | undefined;
60
+ /** What the check says about a batch. */
61
+ export type ReferenceCheck = {
62
+ status: 'checked';
63
+ problems: ReadonlyMap<number, string[]>;
64
+ } | {
65
+ status: 'refused';
66
+ reason: string;
67
+ } | {
68
+ status: 'stopped';
69
+ } | {
70
+ status: 'not_connected';
71
+ };
72
+ /**
73
+ * Checks before the review that every reference the batch sets names a row the user can see.
74
+ *
75
+ * @remarks
76
+ * A Stop wins over everything this adds: it is checked before any of it, and again once the
77
+ * reads are back, so a stopped call is never answered as refused, disconnected or unchanged.
78
+ *
79
+ * @internal
80
+ */
81
+ export declare function checkReferences(rows: readonly RowForCheck[], options: {
82
+ op: GenesisEventOp;
83
+ fields: readonly GenesisEventField[];
84
+ checkable: readonly Checkable[];
85
+ connect: Connect;
86
+ signal?: AbortSignal;
87
+ deadlineMs?: number;
88
+ }): Promise<ReferenceCheck>;
89
+ /** A row's references read again as it is written. */
90
+ export type ReferencesNow = {
91
+ status: 'there';
92
+ } | {
93
+ status: 'gone';
94
+ message: string;
95
+ } | {
96
+ status: 'unreadable';
97
+ reason: string;
98
+ };
99
+ /**
100
+ * Reads a row's references again just before it is written (contracts C-17.12), beside its own
101
+ * staleness read. Not memoised across rows, and nothing read before the review is reused: the
102
+ * review can stay open for minutes.
103
+ *
104
+ * @internal
105
+ */
106
+ export declare function referencesNow(asks: readonly ReferenceAsk[]): Promise<ReferencesNow>;
107
+ /** The rows with what the check found added to their problems. */
108
+ export declare const withReferenceProblems: <T extends RowForCheck>(rows: readonly T[], problems: ReadonlyMap<number, string[]>) => T[];
109
+ export {};
110
+ //# sourceMappingURL=reference-existence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reference-existence.d.ts","sourceRoot":"","sources":["../../../src/genesis/reference-existence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,KAAK,aAAa,EAAW,MAAM,mBAAmB,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAQ9C,mDAAmD;AACnD,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAMvC,KAAK,SAAS,GAAG,OAAO,CAAC,aAAa,EAAE;IAAE,MAAM,EAAE,WAAW,CAAA;CAAE,CAAC,CAAC;AAEjE;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,SAAS,SAAS,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAcrF;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,SAAS,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,MAAM,EAAE,SAAS,CAAA;CAAE,GACrB;IAAE,MAAM,EAAE,eAAe,CAAA;CAAE,CAAC;AAEhC;;;;;;;;GAQG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,SAAS,WAAW,EAAE,EAC5B,OAAO,EAAE;IACP,EAAE,EAAE,cAAc,CAAC;IACnB,MAAM,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACrC,SAAS,EAAE,SAAS,SAAS,EAAE,CAAC;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GACA,OAAO,CAAC,cAAc,CAAC,CAsCzB;AAED,sDAAsD;AACtD,MAAM,MAAM,aAAa,GACrB;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,GACnB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACnC;IAAE,MAAM,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7C;;;;;;GAMG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,SAAS,YAAY,EAAE,GAAG,OAAO,CAAC,aAAa,CAAC,CAiCzF;AAED,kEAAkE;AAClE,eAAO,MAAM,qBAAqB,GAAI,CAAC,SAAS,WAAW,EACzD,MAAM,SAAS,CAAC,EAAE,EAClB,UAAU,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,KACtC,CAAC,EAIA,CAAC"}
@@ -19,9 +19,9 @@ export interface GenesisReadResult {
19
19
  untrusted: true;
20
20
  resource: string;
21
21
  rows: unknown[];
22
- /** True when more rows match than this call returned. */
22
+ /** True when these rows may not be the full set. */
23
23
  truncated: boolean;
24
- /** When `truncated`: that these rows are not the full set, and how to narrow the read. */
24
+ /** When `truncated`: that these rows may not be the full set, and how to narrow the read. */
25
25
  note?: string;
26
26
  }
27
27
  /**
@@ -34,7 +34,7 @@ export interface GenesisToolError {
34
34
  source: typeof GENESIS_DATA_SOURCE;
35
35
  untrusted: true;
36
36
  resource: string;
37
- error: 'not_connected' | 'invalid_filter' | 'rejected' | 'request_failed';
37
+ error: 'not_connected' | 'invalid_filter' | 'rejected' | 'request_failed' | 'unexpected_shape';
38
38
  message: string;
39
39
  }
40
40
  /**
@@ -75,7 +75,7 @@ export interface GenesisResourceTools {
75
75
  * Builds the assistant's tools from an app's resources.
76
76
  *
77
77
  * @remarks
78
- * Each request resource becomes a read tool: filters from the resource's own schema, a row cap
78
+ * Each request or query resource becomes a read tool: filters from the resource's own schema, a row cap
79
79
  * (ADR P10: 50 by default, never more than the resource's `maxRows` whatever the model asks),
80
80
  * no paging (see `truncationNote`), and every result stamped as untrusted app data (P9). Event resources are not turned
81
81
  * into tools yet; the write path, with its review table, comes separately.
@@ -1 +1 @@
1
- {"version":3,"file":"resource-tools.d.ts","sourceRoot":"","sources":["../../../src/genesis/resource-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AACvF,OAAO,EAAc,KAAK,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAQzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,iBAAiB,CAAC;AAalD;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,OAAO,mBAAmB,CAAC;IACnC,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,OAAO,EAAE,CAAC;IAChB,yDAAyD;IACzD,SAAS,EAAE,OAAO,CAAC;IACnB,0FAA0F;IAC1F,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,OAAO,mBAAmB,CAAC;IACnC,SAAS,EAA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;IAC7F,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,OAAO,mBAAmB,CAAC;IACnC,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,eAAe,GAAG,gBAAgB,GAAG,UAAU,GAAG,gBAAgB,GAAG,kBAAkB,CAAC;IAC/F,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C,gGAAgG;IAChG,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACrD;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,eAAe,EAAE,MAAM,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACrD,YAAY,EAAE,gBAAgB,CAAC;CAChC;AA0GD;;;;;;;;;;GAUG;AACH,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,SAAS,iBAAiB,EAAE,EACvC,OAAO,GAAE,2BAAgC,GACxC,oBAAoB,CAgHtB"}
@@ -92,8 +92,8 @@ export interface ReviewModel {
92
92
  * The table's columns, and the order every row's cells are in.
93
93
  *
94
94
  * @remarks
95
- * Built here rather than from one row's keys, because rows legitimately differ: a refused row
96
- * carries no payload at all, an insert may name a different subset of fields, and a field that
95
+ * Built here rather than from one row's keys, because rows legitimately differ: a refused row may
96
+ * carry no payload at all, an insert may name a different subset of fields, and a field that
97
97
  * is null in one row and set in another appears in only one of them. A header taken from the
98
98
  * first row put those rows' values under the wrong headings — and a refused row at position
99
99
  * one gave the table NO headings while every other row still rendered its values.
@@ -1 +1 @@
1
- {"version":3,"file":"review-model.d.ts","sourceRoot":"","sources":["../../../src/genesis/review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AC5B,4EAA4E;IAC5E,OAAO,EAAE,OAAO,CAAC;IACjB,8FAA8F;IAC9F,IAAI,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,qBAAqB,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAChF;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,GAAG,SAAS,CAgB3E;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAQ7D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,GAAG,MAAM,CA2BnE"}
@@ -1,5 +1,6 @@
1
1
  import type { Connect } from '@genesislcap/foundation-comms';
2
2
  import { type GenesisFilterField } from './criteria';
3
+ import { type FilterFieldsResult } from './filter-fields';
3
4
  /**
4
5
  * Reading the row a write is based on.
5
6
  *
@@ -42,6 +43,26 @@ export type GenesisRowRead = {
42
43
  status: 'failed';
43
44
  reason: string;
44
45
  };
46
+ /**
47
+ * Whether a row with the given values exists, for a reference check. Carries no row: the rows it
48
+ * reads are used to decide, never shown or returned.
49
+ *
50
+ * @internal
51
+ */
52
+ export type GenesisKeyCheck = {
53
+ status: 'exists';
54
+ } | {
55
+ status: 'missing';
56
+ }
57
+ /**
58
+ * Unknown. `cause: 'unsearchable'` is a value the resource cannot be searched for, and its
59
+ * `reason` then never contains the value: the caller words it.
60
+ */
61
+ | {
62
+ status: 'failed';
63
+ reason: string;
64
+ cause?: 'unsearchable';
65
+ };
45
66
  /**
46
67
  * Where a write's rows are read from. One per event resource, held for the life of the tools.
47
68
  *
@@ -76,6 +97,17 @@ export interface GenesisRowSource {
76
97
  * with every row red.
77
98
  */
78
99
  filterableBy(): Promise<ReadonlyMap<string, GenesisFilterField> | undefined>;
100
+ /**
101
+ * This resource's metadata as the loader gave it, so a caller can tell a failure that asking
102
+ * again may fix (`transient`) from one it will not.
103
+ */
104
+ metadata(): Promise<FilterFieldsResult>;
105
+ /**
106
+ * Whether a row this user can see carries every one of these values. A row the server returns
107
+ * counts only if its values really match: a request that ignores the criteria and sends any row
108
+ * must not pass an invented value.
109
+ */
110
+ exists(values: Record<string, unknown>): Promise<GenesisKeyCheck>;
79
111
  }
80
112
  /** @internal */
81
113
  export interface RequestRowSourceOptions {
@@ -1 +1 @@
1
- {"version":3,"file":"row-source.d.ts","sourceRoot":"","sources":["../../../src/genesis/row-source.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAE7D,OAAO,EAAmB,KAAK,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAKtE;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,cAAc,GACtB;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE;AAChD,gGAAgG;GAC9F;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE;AACvB;;;;;;;;GAQG;GACD;IAAE,MAAM,EAAE,WAAW,CAAA;CAAE,GACvB;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEzC;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,qFAAqF;IACrF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAC5D;;;;;;;;;;;OAWG;IACH,SAAS,IAAI,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC;IAC9D;;;;;;;;;;OAUG;IACH,YAAY,IAAI,O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IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,cAAc,CAAA;CAAE,CAAC;AAEjE;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,qFAAqF;IACrF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAC5D;;;;;;;;;;;OAWG;IACH,SAAS,IAAI,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAAC,CAAC;IAC9D;;;;;;;;;;OAUG;IACH,YAAY,IAAI,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,kBAAkB,CAAC,GAAG,SAAS,CAAC,CAAC;IAC7E;;;OAGG;IACH,QAAQ,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACxC;;;;OAIG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CACnE;AA0BD,gBAAgB;AAChB,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,OAAO,CAAC;IACjB,wFAAwF;IACxF,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACrD;AAKD;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,OAAO,EACP,QAAQ,EACR,QAAQ,GACT,EAAE,uBAAuB,GAAG,gBAAgB,CAqN5C"}
@@ -60,4 +60,33 @@ export declare function plainFailure(error: unknown, context: string, wording: {
60
60
  timeout: string;
61
61
  failed: string;
62
62
  }): string;
63
+ /**
64
+ * The app's refusal off an `ERROR` list: every `TEXT` joined, and the codes for the console.
65
+ *
66
+ * @internal
67
+ */
68
+ export declare const refusalOf: (errors: unknown[]) => {
69
+ text: string;
70
+ codes: string;
71
+ };
72
+ /**
73
+ * The `ERROR` list of the NACK a request was rejected with, or `undefined` when the rejection is
74
+ * not a NACK. On the socket path comms rejects a router MSG_NACK or LOGON_NACK with
75
+ * `{ receivedMessage, sentMessage }`, and that message is the app's answer.
76
+ *
77
+ * @internal
78
+ */
79
+ export declare const nackErrorsOf: (error: unknown) => unknown[] | undefined;
80
+ /**
81
+ * Why a metadata request failed, in words that are safe to show.
82
+ *
83
+ * @remarks
84
+ * The app's refusal is read off the router's MSG_NACK only when comms keeps it: the socket rejects
85
+ * with `{ receivedMessage, sentMessage }`, but `DefaultConnect.getMetadata` rewraps that as
86
+ * `Error('[object Object]')` today, which reads as the transport failing and gets the generic text.
87
+ * Nothing leaks either way: both go through the allow-list, with the raw text logged.
88
+ *
89
+ * @internal
90
+ */
91
+ export declare function metadataFailureOf(error: unknown, resourceName: string): string;
63
92
  //# sourceMappingURL=server-text.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server-text.d.ts","sourceRoot":"","sources":["../../../src/genesis/server-text.ts"],"names":[],"mappings":"AA2DA,gBAAgB;AAChB,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,KAAG,OAQrB,CAAC;AAyB1B,oFAAoF;AACpF,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,KAAG,OAAgC,CAAC;AAEnF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,KAAG,OAC8C,CAAC;AAEhG,gBAAgB;AAChB,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAY7F;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,MAAM,CAKR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Q,OAAO,EAAE,KAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CASzE,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,OAAO,KAAG,OAAO,EAAE,GAAG,SAIzD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAW9E"}
@@ -4,12 +4,12 @@ import type { Container } from '@genesislcap/web-core';
4
4
  import type { AgentConfig } from '../config/config';
5
5
  import type { TieredAIProviderSwitcher } from '../provider/tiered-provider-switcher';
6
6
  /**
7
- * What a Genesis resource is to the assistant: a request/reply it can read, or an event it
8
- * can propose a write to.
7
+ * What a Genesis resource is to the assistant: a request/reply or a dataserver query it can read,
8
+ * or an event it can propose a write to.
9
9
  *
10
10
  * @beta
11
11
  */
12
- export type GenesisResourceKind = 'request' | 'event';
12
+ export type GenesisResourceKind = 'request' | 'event' | 'query';
13
13
  /**
14
14
  * The wire vocabulary for an event resource's operation. Custom handlers keep their own name.
15
15
  *
@@ -29,20 +29,29 @@ export type GenesisEventOp = (typeof GENESIS_EVENT_OPS)[number];
29
29
  * @beta
30
30
  */
31
31
  export interface GenesisAiResource {
32
- /** `REQ_<NAME>` for a request, `EVENT_<NAME>` for an event. Unique within the config. */
32
+ /**
33
+ * `REQ_<NAME>` for a request, `EVENT_<NAME>` for an event, and the query's own name for a
34
+ * dataserver query. Unique within the config.
35
+ */
33
36
  name: string;
34
37
  kind: GenesisResourceKind;
35
38
  /** Events only. */
36
39
  op?: GenesisEventOp;
37
40
  /** What the resource is for, in plain words. Becomes the tool's description. */
38
41
  context: string;
39
- /** Requests only: the most rows one read may return (1–1000). Defaults to 50. */
42
+ /** Requests and queries: the most rows one read may return (1–1000). Defaults to 50. */
40
43
  maxRows?: number;
41
44
  /**
42
45
  * Insert, modify and delete events only: the event's handler runs custom code, which can write
43
46
  * more than the row a review shows. See {@link GenesisCustomCode}.
44
47
  */
45
48
  customCode?: GenesisCustomCode;
49
+ /**
50
+ * Inserts and modifies only: the values of this write that must match a row of another table,
51
+ * checked before the review. Absent on a config older than this version, or when the generator
52
+ * had no fields for the table, and then nothing is checked. `[]` declares none.
53
+ */
54
+ references?: GenesisReference[];
46
55
  }
47
56
  /**
48
57
  * What the app generator found an event's custom code can write to, beyond the row it saves.
@@ -60,6 +69,24 @@ export interface GenesisCustomCode {
60
69
  /** True only when the generator could prove those are ALL the other tables it writes to. */
61
70
  listComplete: boolean;
62
71
  }
72
+ /**
73
+ * One reference a write declares: fields whose values must match one row of another table, read
74
+ * through that table's own request resource.
75
+ *
76
+ * @beta
77
+ */
78
+ export interface GenesisReference {
79
+ /**
80
+ * The target table's own read, `REQ_<T>`. It may name a read the config does not have, and the
81
+ * reference then cannot be checked.
82
+ */
83
+ resource: string;
84
+ /** Each field of the write and the target field it must equal, in the write's field order. */
85
+ fields: {
86
+ field: string;
87
+ targetField: string;
88
+ }[];
89
+ }
63
90
  /**
64
91
  * What an assistant version reads from a generated AI config. See `GENESIS_AI_CONSUMES`.
65
92
  *