@genesislcap/ai-assistant 15.41.0 → 15.43.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chat-driver.cjs +115 -6
- package/dist/chat-driver.cjs.map +3 -3
- package/dist/chat-driver.mjs +115 -6
- package/dist/chat-driver.mjs.map +3 -3
- package/dist/custom-elements.json +761 -713
- package/dist/dts/genesis/config.d.ts +51 -6
- package/dist/dts/genesis/config.d.ts.map +1 -1
- package/dist/dts/genesis/consumes.d.ts +42 -0
- package/dist/dts/genesis/consumes.d.ts.map +1 -0
- package/dist/dts/genesis/criteria.d.ts.map +1 -1
- package/dist/dts/genesis/event-fields.d.ts +4 -1
- package/dist/dts/genesis/event-fields.d.ts.map +1 -1
- package/dist/dts/genesis/index.d.ts +2 -1
- package/dist/dts/genesis/index.d.ts.map +1 -1
- package/dist/dts/genesis/register-genesis-assistant.d.ts +29 -4
- package/dist/dts/genesis/register-genesis-assistant.d.ts.map +1 -1
- package/dist/dts/genesis/resource-tools.d.ts.map +1 -1
- package/dist/dts/genesis/review-model.d.ts.map +1 -1
- package/dist/dts/genesis/types.d.ts +37 -5
- package/dist/dts/genesis/types.d.ts.map +1 -1
- package/dist/dts/genesis/write-payload.d.ts.map +1 -1
- package/dist/dts/genesis/write-tools.d.ts +26 -5
- package/dist/dts/genesis/write-tools.d.ts.map +1 -1
- package/dist/esm/genesis/config.js +105 -50
- package/dist/esm/genesis/consumes.js +30 -0
- package/dist/esm/genesis/criteria.js +28 -0
- package/dist/esm/genesis/event-fields.js +20 -3
- package/dist/esm/genesis/index.js +1 -0
- package/dist/esm/genesis/register-genesis-assistant.js +146 -63
- package/dist/esm/genesis/resource-tools.js +20 -12
- package/dist/esm/genesis/review-model.js +16 -3
- package/dist/esm/genesis/write-payload.js +47 -4
- package/dist/esm/genesis/write-tools.js +199 -45
- package/dist/genesis-consumes.cjs +35 -0
- package/dist/genesis-consumes.cjs.map +7 -0
- package/dist/genesis-consumes.mjs +11 -0
- package/dist/genesis-consumes.mjs.map +7 -0
- package/docs/genesis.md +156 -28
- package/package.json +29 -19
- package/scripts/build-genesis-consumes-node.mjs +50 -0
- package/scripts/smoke-genesis-consumes-node.mjs +70 -0
|
@@ -1,7 +1,21 @@
|
|
|
1
|
-
import { type GenesisEventOp } from './types';
|
|
1
|
+
import { type GenesisAiResource, type GenesisEventOp } from './types';
|
|
2
2
|
/** The default read cap, and the ceiling the config may raise it to. */
|
|
3
3
|
export declare const DEFAULT_MAX_ROWS = 50;
|
|
4
4
|
export declare const MAX_ROWS_CEILING = 1000;
|
|
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.
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* Anything else declares SOME cap, and none can be read from it, so the request gets no read tool.
|
|
11
|
+
* Having none, it is no row source for a write either: a modify reading through it would answer
|
|
12
|
+
* "no row matches that key" about a table the model cannot read. One test for both factories, so
|
|
13
|
+
* they cannot disagree about which requests the assistant reads. The validator is stricter (a
|
|
14
|
+
* whole number from 1 to 1000) and leaves such a request out before either factory sees it.
|
|
15
|
+
*
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export declare const capIsReadable: (resource: GenesisAiResource) => boolean;
|
|
5
19
|
/**
|
|
6
20
|
* The model-facing tool name for a resource. Deterministic and collision-free (resource names
|
|
7
21
|
* are unique), and trivially mapped back to the resource in a debug log. What the tool is FOR
|
|
@@ -24,15 +38,46 @@ export declare const toolNameOf: (resourceName: string) => string;
|
|
|
24
38
|
*/
|
|
25
39
|
export declare const opFromName: (resourceName: string) => GenesisEventOp | undefined;
|
|
26
40
|
/**
|
|
27
|
-
*
|
|
41
|
+
* A resource the validator left out, and why.
|
|
42
|
+
*
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
export interface DroppedResource {
|
|
46
|
+
/** Where it was in the list: `resources[3]`. */
|
|
47
|
+
at: string;
|
|
48
|
+
/** Its name, when it had one to give. */
|
|
49
|
+
name?: string;
|
|
50
|
+
problems: string[];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* What {@link validateGenesisAiConfig} found.
|
|
54
|
+
*
|
|
55
|
+
* @internal
|
|
56
|
+
*/
|
|
57
|
+
export interface GenesisAiConfigCheck {
|
|
58
|
+
/** Problems with the config as a whole. Any one of them blocks the assistant. */
|
|
59
|
+
problems: string[];
|
|
60
|
+
/** The resources that passed, in the order the config lists them. */
|
|
61
|
+
resources: GenesisAiResource[];
|
|
62
|
+
/** The ones that did not. Each is left out on its own. */
|
|
63
|
+
dropped: DroppedResource[];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Checks a generated AI config before anything is registered, and says what can be kept.
|
|
28
67
|
*
|
|
29
68
|
* @remarks
|
|
30
69
|
* The config is machine-generated and schema-checked upstream, so a violation here is a bug in
|
|
31
|
-
* that pipeline, not something to work around
|
|
32
|
-
*
|
|
33
|
-
*
|
|
70
|
+
* that pipeline, not something to work around — nothing in a resource that breaks a rule is used.
|
|
71
|
+
* But the refusal is scoped to what is wrong. A problem with the config as a whole (it is not
|
|
72
|
+
* switched on, names an unknown vendor or tier, has a `resources` that is not a list) blocks the
|
|
73
|
+
* assistant. No `resources` at all is accepted, with a warning at registration. A
|
|
74
|
+
* problem with one resource leaves that resource out and keeps the rest: one malformed entry used
|
|
75
|
+
* to switch off every tool, reads included, and a config written by a newer generator — a kind this
|
|
76
|
+
* version does not know — would have switched off the whole assistant in every app that met it.
|
|
77
|
+
*
|
|
78
|
+
* Leaving out a kind it does not know is survival, not support: the resource does nothing here.
|
|
34
79
|
*
|
|
35
80
|
* @internal
|
|
36
81
|
*/
|
|
37
|
-
export declare function validateGenesisAiConfig(config: unknown):
|
|
82
|
+
export declare function validateGenesisAiConfig(config: unknown): GenesisAiConfigCheck;
|
|
38
83
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/genesis/config.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/genesis/config.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,iBAAiB,EACtB,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;CAC5B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,OAAO,GAAG,oBAAoB,CAoD7E"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What this version of the assistant reads from a generated AI config
|
|
3
|
+
* (`@genesislcap/ai-assistant/genesis/consumes`).
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Its own entry point, loadable in bare Node, because the seed's CI reads it in a Node step and
|
|
7
|
+
* `./genesis` cannot be: that entry is bundler-target ESM, and its closure registers custom
|
|
8
|
+
* elements, which need a DOM. So this module imports nothing at run time. A type from `./types`
|
|
9
|
+
* is all it may take, and a test holds it to that. The Node build bundles it to
|
|
10
|
+
* `dist/genesis-consumes.mjs` and `.cjs`, and a smoke test loads both without a DOM.
|
|
11
|
+
*
|
|
12
|
+
* @packageDocumentation
|
|
13
|
+
* @beta
|
|
14
|
+
*/
|
|
15
|
+
import type { GenesisAiConsumes } from './types';
|
|
16
|
+
export type { GenesisAiConsumes } from './types';
|
|
17
|
+
/**
|
|
18
|
+
* What this version of the assistant reads from a generated AI config: the resource kinds it
|
|
19
|
+
* accepts, the resource fields its validator or a tool reads, and the `vendor` and `tier` values
|
|
20
|
+
* it accepts.
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* The generator must not emit what the installed assistant does not read, or a new kind is left out
|
|
24
|
+
* and a new field ignored — and an older assistant used to block entirely on a kind it did not know.
|
|
25
|
+
* Nothing in the generator can say which version will run its output. So the app's seed declares
|
|
26
|
+
* what it expects, and the seed's CI checks that declaration against this constant, exported from
|
|
27
|
+
* the version it installs. That makes this the single statement of what an assistant consumes, and
|
|
28
|
+
* it carries no version number because it needs none.
|
|
29
|
+
*
|
|
30
|
+
* A test holds it to the code: its kinds are the ones validation accepts, and its fields are the
|
|
31
|
+
* ones read. A change that teaches the validator a kind, or a tool a field, updates it in the same
|
|
32
|
+
* commit.
|
|
33
|
+
*
|
|
34
|
+
* A resource this version does not read is only left out, but an unknown `vendor` or `tier` still
|
|
35
|
+
* blocks the whole assistant, so those are here too. They are written out rather than imported
|
|
36
|
+
* from foundation-ai, which this entry must not load; a test holds them equal to its
|
|
37
|
+
* `AI_TIER_VENDORS` and `AI_TIER_IDS`, which the validator checks against.
|
|
38
|
+
*
|
|
39
|
+
* @beta
|
|
40
|
+
*/
|
|
41
|
+
export declare const GENESIS_AI_CONSUMES: GenesisAiConsumes;
|
|
42
|
+
//# sourceMappingURL=consumes.d.ts.map
|
|
@@ -0,0 +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,iBAKhC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"criteria.d.ts","sourceRoot":"","sources":["../../../src/genesis/criteria.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AAEH,mGAAmG;AACnG,MAAM,MAAM,eAAe,GACvB,QAAQ,GACR,YAAY,GACZ,UAAU,GACV,cAAc,GACd,kBAAkB,GAClB,WAAW,GACX,eAAe,GACf,UAAU,GACV,cAAc,CAAC;AAEnB,uDAAuD;AACvD,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,eAAe,CAAC;IACpB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,6EAA6E;AAC7E,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,wFAAwF;IACxF,IAAI,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED,kEAAkE;AAClE,MAAM,MAAM,cAAc,GACtB;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GACnC;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3C,KA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KAAK,EAAE,MAAM,EACb,EAAE,EAAE,eAAe,EACnB,KAAK,EAAE,OAAO,GACb,MAAM,GAAG,SAAS,CAWpB;AAcD,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAejG;AAED;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,EAAE,EAAE,eAAe,EACnB,KAAK,EAAE,MAAM,GACZ,MAAM,GAAG,SAAS,CAGpB;AAuLD;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,kBAAkB,CAAC,GAC9C,cAAc,CAmChB"}
|
|
@@ -16,7 +16,10 @@ import type { Connect, Metadata } from '@genesislcap/foundation-comms';
|
|
|
16
16
|
*/
|
|
17
17
|
export interface GenesisEventField {
|
|
18
18
|
name: string;
|
|
19
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* The platform field type, e.g. STRING, ENUM, INT, DOUBLE, BIGDECIMAL, BOOLEAN, DATE, DATETIME:
|
|
21
|
+
* the metadata's `GENESIS_TYPE` when it has one, else its `TYPE` (see `typeOf`).
|
|
22
|
+
*/
|
|
20
23
|
type: string;
|
|
21
24
|
/**
|
|
22
25
|
* How the value travels on the wire, which is NOT always what a JavaScript developer expects:
|
|
@@ -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
|
|
1
|
+
{"version":3,"file":"event-fields.d.ts","sourceRoot":"","sources":["../../../src/genesis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|
12
12
|
*/
|
|
13
13
|
export { GENESIS_AGENT_NAME, registerGenesisAssistant } from './register-genesis-assistant';
|
|
14
|
+
export { GENESIS_AI_CONSUMES } from './consumes';
|
|
14
15
|
export type { GenesisFilter, GenesisFilterField, GenesisFilterOp } from './criteria';
|
|
15
16
|
export { createGenesisResourceTools, GENESIS_DATA_SOURCE } from './resource-tools';
|
|
16
17
|
export { createGenesisWriteTools } from './write-tools';
|
|
@@ -19,5 +20,5 @@ export { GENESIS_WRITE_REVIEW, GenesisWriteReview } from './write-review/write-r
|
|
|
19
20
|
export type { GenesisChangeRequest, GenesisReviewPayload, GenesisWriteReviewCompletedEventDetail, } from './review-payload';
|
|
20
21
|
export type { GenesisReadResult, GenesisResourceTools, GenesisResourceToolsOptions, GenesisToolError, } from './resource-tools';
|
|
21
22
|
export { GENESIS_EVENT_OPS } from './types';
|
|
22
|
-
export type { GenesisAiConfig, GenesisAiResource, GenesisAssistantExtensions, GenesisAssistantRegistration, GenesisEventOp, GenesisResourceKind, RegisterGenesisAssistantOptions, } from './types';
|
|
23
|
+
export type { GenesisAiConfig, GenesisAiConsumes, GenesisAiResource, GenesisAssistantExtensions, GenesisAssistantRegistration, GenesisEventOp, GenesisResourceKind, RegisterGenesisAssistantOptions, } from './types';
|
|
23
24
|
//# 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,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,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AAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC5C,YAAY,EACV,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,0BAA0B,EAC1B,4BAA4B,EAC5B,cAAc,EACd,mBAAmB,EACnB,+BAA+B,GAChC,MAAM,SAAS,CAAC"}
|
|
@@ -47,6 +47,25 @@ export declare const userFeedbackPrompt: (key: string) => string;
|
|
|
47
47
|
* @internal
|
|
48
48
|
*/
|
|
49
49
|
export declare const WRITE_OUTCOME_PROMPT: string;
|
|
50
|
+
/**
|
|
51
|
+
* What the user reads when AI is switched off for the app, in its build or in its config. A
|
|
52
|
+
* choice, not a fault.
|
|
53
|
+
*
|
|
54
|
+
* @internal
|
|
55
|
+
*/
|
|
56
|
+
export declare const ASSISTANT_OFF_REASON = "The assistant is switched off for this app.";
|
|
57
|
+
/**
|
|
58
|
+
* What the user reads when the assistant cannot run because of how it is set up.
|
|
59
|
+
*
|
|
60
|
+
* @remarks
|
|
61
|
+
* One sentence for every fault, on purpose. The detail names resources, tools and settings, which
|
|
62
|
+
* mean nothing to the person using the app and are the app's internals besides; it goes to the
|
|
63
|
+
* console and to `blockedDetail`, for whoever maintains the app. It used to be the banner itself:
|
|
64
|
+
* "The AI configuration is invalid: resources[3]: op must be …".
|
|
65
|
+
*
|
|
66
|
+
* @internal
|
|
67
|
+
*/
|
|
68
|
+
export declare const ASSISTANT_FAULT_REASON: string;
|
|
50
69
|
/**
|
|
51
70
|
* The exported app's own AI proxy: `<PUBLIC_PATH>/gwf/ai-service`.
|
|
52
71
|
* Unless the build names another base: a build-time `GENX_AI_CHAT_BASE` comes first.
|
|
@@ -83,10 +102,16 @@ export declare function genesisProviderOptions(config: GenesisAiConfig, options?
|
|
|
83
102
|
* connects before they are registered keeps the empty fallback for the whole page load.
|
|
84
103
|
*
|
|
85
104
|
* It never throws. Anything that stops the assistant working — AI switched off for the build,
|
|
86
|
-
* an invalid config, an extension tool
|
|
87
|
-
*
|
|
88
|
-
* `
|
|
89
|
-
*
|
|
105
|
+
* an invalid config, an extension tool defined twice or with no handler, an extension handler with
|
|
106
|
+
* no tool definition — comes back as a
|
|
107
|
+
* `blockedReason` for the user and a `blockedDetail` for a developer, with no agents. The mount
|
|
108
|
+
* code applies the reason with the element's `setBlocked(true, blockedReason)`. The app keeps
|
|
109
|
+
* working: a problem with its assistant must never take it down at start-up.
|
|
110
|
+
*
|
|
111
|
+
* A problem with one resource does not block: that resource is left out, and the console says why.
|
|
112
|
+
* Nor does every resource being left out, while the app has extension tools of its own; with none,
|
|
113
|
+
* it blocks, as nothing would be left to reach. Nor does an extension tool with the name a generated tool would have: the extension is
|
|
114
|
+
* kept and the generated resource left out, with a warning naming both.
|
|
90
115
|
*
|
|
91
116
|
* @beta
|
|
92
117
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-genesis-assistant.d.ts","sourceRoot":"","sources":["../../../src/genesis/register-genesis-assistant.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,+BAA+B,EACrC,MAAM,sCAAsC,CAAC;AAI9C,OAAO,KAAK,EACV,eAAe,
|
|
1
|
+
{"version":3,"file":"register-genesis-assistant.d.ts","sourceRoot":"","sources":["../../../src/genesis/register-genesis-assistant.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,+BAA+B,EACrC,MAAM,sCAAsC,CAAC;AAI9C,OAAO,KAAK,EACV,eAAe,EAEf,4BAA4B,EAC5B,+BAA+B,EAChC,MAAM,SAAS,CAAC;AAGjB;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,sBAAsB,CAAC;AAEtD;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,QAGN,CAAC;AAE7B;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,kBAAkB,GAAI,KAAK,MAAM,KAAG,MAOgB,CAAC;AAElE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oBAAoB,QAKqD,CA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AE,QAAQ,EAAE,WAAW,CAAA;CAAE,CAAC;AAE9B;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,iBAAiB,CAAC,OAAO,CAAC,GAAG,SAAS,EAC9C,KAAK,CAAC,EAAE,WAAW,GAClB,cAAc,CAuBhB;AAED;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GACvB,OAAO,WAAW,EAClB,WAAW,WAAW,CAAC,MAAM,CAAC,KAC7B,KAAK,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,CAGG,CAAC"}
|
|
@@ -39,6 +39,21 @@ export interface GenesisAiResource {
|
|
|
39
39
|
/** Requests only: the most rows one read may return (1–1000). Defaults to 50. */
|
|
40
40
|
maxRows?: number;
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* What an assistant version reads from a generated AI config. See `GENESIS_AI_CONSUMES`.
|
|
44
|
+
*
|
|
45
|
+
* @beta
|
|
46
|
+
*/
|
|
47
|
+
export interface GenesisAiConsumes {
|
|
48
|
+
/** The resource kinds it accepts. A resource of any other kind is left out. */
|
|
49
|
+
readonly kinds: readonly GenesisResourceKind[];
|
|
50
|
+
/** The fields of a resource that its validator or a tool reads. Any other field does nothing. */
|
|
51
|
+
readonly resourceFields: readonly (keyof GenesisAiResource)[];
|
|
52
|
+
/** The `vendor` values it accepts. Any other blocks the assistant. */
|
|
53
|
+
readonly vendors: readonly AITierVendor[];
|
|
54
|
+
/** The `tier` values it accepts. Any other blocks the assistant. */
|
|
55
|
+
readonly tiers: readonly AITierId[];
|
|
56
|
+
}
|
|
42
57
|
/**
|
|
43
58
|
* The AI block of a generated app's configuration (`client/src/ai/generated/ai-config.json`).
|
|
44
59
|
*
|
|
@@ -91,10 +106,15 @@ export interface RegisterGenesisAssistantOptions {
|
|
|
91
106
|
connect?: Connect;
|
|
92
107
|
extensions?: GenesisAssistantExtensions;
|
|
93
108
|
/**
|
|
94
|
-
* Which request resource a modify or delete reads its rows from, by event name.
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
109
|
+
* Which request resource a modify or delete reads its rows from, by event name.
|
|
110
|
+
*
|
|
111
|
+
* @deprecated A write reads its rows only through its table's own request resource —
|
|
112
|
+
* `EVENT_TRADE_MODIFY` through `REQ_TRADE` — which is the default, so there is nothing left to
|
|
113
|
+
* set here. An entry naming anything else leaves that event without a write tool, with a
|
|
114
|
+
* console warning: a view can return a joined table's column under the root record's name, and
|
|
115
|
+
* a dataserver query's cache can lag the change a write checks for. An event with no source
|
|
116
|
+
* gets no tool: a modify that cannot read its row cannot be built, because the fields nobody
|
|
117
|
+
* named would be written as null. Kept so that code which sets it still compiles.
|
|
98
118
|
*/
|
|
99
119
|
rowSources?: Record<string, string>;
|
|
100
120
|
/**
|
|
@@ -114,10 +134,22 @@ export interface GenesisAssistantRegistration {
|
|
|
114
134
|
/** The vendor switcher, when providers were registered. */
|
|
115
135
|
switcher?: TieredAIProviderSwitcher;
|
|
116
136
|
/**
|
|
117
|
-
* Set when the assistant cannot run — AI switched off, an invalid config,
|
|
137
|
+
* Set when the assistant cannot run — AI switched off, an invalid config, an extension tool
|
|
138
|
+
* defined twice or with no handler, an extension handler with no tool definition. Not for an extension that shares a generated tool's name:
|
|
139
|
+
* the extension is kept and the generated resource left out, with a warning.
|
|
118
140
|
* Apply it with the element's `setBlocked(true, blockedReason)`. The app itself keeps working:
|
|
119
141
|
* a problem with one chat tool must never take the whole app down at start-up.
|
|
142
|
+
*
|
|
143
|
+
* Written for the person using the app, so it is one of two sentences: that the assistant is
|
|
144
|
+
* switched off for this app, or that it isn't set up correctly. What went wrong is in
|
|
145
|
+
* `blockedDetail`.
|
|
120
146
|
*/
|
|
121
147
|
blockedReason?: string;
|
|
148
|
+
/**
|
|
149
|
+
* Set with `blockedReason`: what stopped the assistant, for whoever maintains the app — the
|
|
150
|
+
* setting, resource or tool at fault. It is logged to the console as well. Not for the
|
|
151
|
+
* assistant's banner: it names the app's internals.
|
|
152
|
+
*/
|
|
153
|
+
blockedDetail?: string;
|
|
122
154
|
}
|
|
123
155
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/genesis/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAErF;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,OAAO,CAAC;AAEtD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,mDAAoD,CAAC;AAEnF;;;;;GAKG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhE;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,yFAAyF;IACzF,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,mBAAmB,CAAC;IAC1B,mBAAmB;IACnB,EAAE,CAAC,EAAE,cAAc,CAAC;IACpB,gFAAgF;IAChF,OAAO,EAAE,MAAM,CAAC;IAChB,iFAAiF;IACjF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,8BAA8B;IAC9B,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,4BAA4B;IAC5B,IAAI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EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,0BAA0B,CAAC;IACxC;;;;;;;;;;OAUG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,YAAY,EAAE,CAAC;CACnC;AAED;;;;GAIG;AACH,MAAM,WAAW,4BAA4B;IAC3C,6EAA6E;IAC7E,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,2DAA2D;IAC3D,QAAQ,CAAC,EAAE,wBAAwB,CAAC;IACpC;;;;;;;;;;OAUG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-payload.d.ts","sourceRoot":"","sources":["../../../src/genesis/write-payload.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAG9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,MAAM,aAAa,GACrB;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GAClD;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAa/C;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,WAAW,GAAI,OAAO,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC,KAAG,OACnB,CAAC;
|
|
1
|
+
{"version":3,"file":"write-payload.d.ts","sourceRoot":"","sources":["../../../src/genesis/write-payload.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAExD,OAA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a,CAkLf"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ChatToolDefinition, ChatToolHandlers } from '@genesislcap/foundation-ai';
|
|
2
2
|
import { type Connect } from '@genesislcap/foundation-comms';
|
|
3
3
|
import { GENESIS_DATA_SOURCE } from './resource-tools';
|
|
4
|
-
import type
|
|
4
|
+
import { type GenesisAiResource } from './types';
|
|
5
5
|
import type { GenesisWriteStatus } from './write-outcome';
|
|
6
6
|
/**
|
|
7
7
|
* The write tools: build a payload, show it to the user, and commit only what they selected.
|
|
@@ -108,10 +108,13 @@ export interface GenesisWriteToolsOptions {
|
|
|
108
108
|
/** The connection to write through. Defaults to the app's own, resolved from DI on first use. */
|
|
109
109
|
connect?: Connect;
|
|
110
110
|
/**
|
|
111
|
-
* Which request resource a modify or delete reads its rows from, by event name.
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
111
|
+
* Which request resource a modify or delete reads its rows from, by event name.
|
|
112
|
+
*
|
|
113
|
+
* @deprecated A write reads its rows only through its table's own request resource —
|
|
114
|
+
* `EVENT_TRADE_MODIFY` through `REQ_TRADE` — which is the default, so there is nothing left to
|
|
115
|
+
* set here. An entry naming anything else leaves that event without a write tool: a view can
|
|
116
|
+
* return a joined table's column under the root record's name, and a dataserver query's cache
|
|
117
|
+
* can lag the change a write checks for. Kept so that code which sets it still compiles.
|
|
115
118
|
*/
|
|
116
119
|
rowSources?: Record<string, string>;
|
|
117
120
|
/**
|
|
@@ -122,6 +125,18 @@ export interface GenesisWriteToolsOptions {
|
|
|
122
125
|
* prompt. Minted here when not given, so a result never carries a key someone could predict.
|
|
123
126
|
*/
|
|
124
127
|
feedbackKey?: string;
|
|
128
|
+
/**
|
|
129
|
+
* Resources that are in the AI config but were left out before these tools were built: by the
|
|
130
|
+
* validator, or because an app extension has the name their tool would have.
|
|
131
|
+
* `registerGenesisAssistant` passes them. A modify or delete whose table's request resource is
|
|
132
|
+
* among them is told it was left out, rather than told to add it: a second copy would be a
|
|
133
|
+
* duplicate, and a duplicate leaves out every copy. So is a rowSources entry for an event among
|
|
134
|
+
* them, rather than told the config offers no such event: it does.
|
|
135
|
+
*
|
|
136
|
+
* The console warning then refers to "the warning that names it", so whoever passes a name here
|
|
137
|
+
* is expected to have warned about it already, saying why it was left out, as registration does.
|
|
138
|
+
*/
|
|
139
|
+
leftOut?: readonly string[];
|
|
125
140
|
/** @internal Tests shorten these; the defaults suit a real app. */
|
|
126
141
|
timeouts?: {
|
|
127
142
|
metadataMs?: number;
|
|
@@ -144,5 +159,11 @@ export declare const mintFeedbackKey: () => string;
|
|
|
144
159
|
export declare function createGenesisWriteTools(resources: readonly GenesisAiResource[], options?: GenesisWriteToolsOptions): {
|
|
145
160
|
toolDefinitions: () => Promise<ChatToolDefinition[]>;
|
|
146
161
|
toolHandlers: ChatToolHandlers;
|
|
162
|
+
/**
|
|
163
|
+
* The events that can get a write tool, as far as the config can tell: an event refused for its
|
|
164
|
+
* op or its rowSources entry, or a modify or delete with no row source, is not among them. Their
|
|
165
|
+
* metadata, read when the tools are first listed, can still withhold one.
|
|
166
|
+
*/
|
|
167
|
+
writableEvents: readonly string[];
|
|
147
168
|
};
|
|
148
169
|
//# sourceMappingURL=write-tools.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-tools.d.ts","sourceRoot":"","sources":["../../../src/genesis/write-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAEjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAc,KAAK,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAKzE,OAAO,EAAE,mBAAmB,EAAyB,MAAM,kBAAkB,CAAC;AAY9E,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"write-tools.d.ts","sourceRoot":"","sources":["../../../src/genesis/write-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,gBAAgB,EAEjB,MAAM,4BAA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';
|
|
|
3
3
|
/** The default read cap, and the ceiling the config may raise it to. */
|
|
4
4
|
export const DEFAULT_MAX_ROWS = 50;
|
|
5
5
|
export const MAX_ROWS_CEILING = 1000;
|
|
6
|
+
/**
|
|
7
|
+
* Whether a request's `maxRows` can be read as a cap: absent, so the default applies, or a finite
|
|
8
|
+
* number, which is clamped into range.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* Anything else declares SOME cap, and none can be read from it, so the request gets no read tool.
|
|
12
|
+
* Having none, it is no row source for a write either: a modify reading through it would answer
|
|
13
|
+
* "no row matches that key" about a table the model cannot read. One test for both factories, so
|
|
14
|
+
* they cannot disagree about which requests the assistant reads. The validator is stricter (a
|
|
15
|
+
* whole number from 1 to 1000) and leaves such a request out before either factory sees it.
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export const capIsReadable = (resource) => {
|
|
20
|
+
const asked = resource.maxRows;
|
|
21
|
+
return asked === undefined || (typeof asked === 'number' && Number.isFinite(asked));
|
|
22
|
+
};
|
|
6
23
|
/** Tool names are the lowercased resource name; vendors reject names over 64 characters. */
|
|
7
24
|
const MAX_TOOL_NAME_LENGTH = 64;
|
|
8
25
|
const RESOURCE_NAME = /^(REQ|EVENT)_[A-Z0-9_]+$/;
|
|
@@ -31,20 +48,30 @@ export const opFromName = (resourceName) => {
|
|
|
31
48
|
const suffix = (_a = /_(INSERT|MODIFY|DELETE)$/.exec(resourceName)) === null || _a === void 0 ? void 0 : _a[1];
|
|
32
49
|
return suffix ? suffix.toLowerCase() : undefined;
|
|
33
50
|
};
|
|
51
|
+
/** The kinds of resource the validator accepts. Kept apart from GENESIS_AI_CONSUMES on purpose. */
|
|
52
|
+
const KNOWN_KINDS = ['request', 'event'];
|
|
34
53
|
/**
|
|
35
|
-
* Checks a generated AI config before anything is registered,
|
|
54
|
+
* Checks a generated AI config before anything is registered, and says what can be kept.
|
|
36
55
|
*
|
|
37
56
|
* @remarks
|
|
38
57
|
* The config is machine-generated and schema-checked upstream, so a violation here is a bug in
|
|
39
|
-
* that pipeline, not something to work around
|
|
40
|
-
*
|
|
41
|
-
*
|
|
58
|
+
* that pipeline, not something to work around — nothing in a resource that breaks a rule is used.
|
|
59
|
+
* But the refusal is scoped to what is wrong. A problem with the config as a whole (it is not
|
|
60
|
+
* switched on, names an unknown vendor or tier, has a `resources` that is not a list) blocks the
|
|
61
|
+
* assistant. No `resources` at all is accepted, with a warning at registration. A
|
|
62
|
+
* problem with one resource leaves that resource out and keeps the rest: one malformed entry used
|
|
63
|
+
* to switch off every tool, reads included, and a config written by a newer generator — a kind this
|
|
64
|
+
* version does not know — would have switched off the whole assistant in every app that met it.
|
|
65
|
+
*
|
|
66
|
+
* Leaving out a kind it does not know is survival, not support: the resource does nothing here.
|
|
42
67
|
*
|
|
43
68
|
* @internal
|
|
44
69
|
*/
|
|
45
70
|
export function validateGenesisAiConfig(config) {
|
|
46
|
-
|
|
47
|
-
|
|
71
|
+
var _a;
|
|
72
|
+
if (!config || typeof config !== 'object') {
|
|
73
|
+
return { problems: ['the AI config is missing or not an object'], resources: [], dropped: [] };
|
|
74
|
+
}
|
|
48
75
|
const c = config;
|
|
49
76
|
const problems = [];
|
|
50
77
|
if (c.enabled !== true)
|
|
@@ -69,53 +96,81 @@ export function validateGenesisAiConfig(config) {
|
|
|
69
96
|
// registration logs a warning naming both causes. What that case needs is a signal, not a
|
|
70
97
|
// block.
|
|
71
98
|
if (c.resources === undefined)
|
|
72
|
-
return problems;
|
|
73
|
-
if (!Array.isArray(c.resources))
|
|
74
|
-
return [...problems, 'resources must be an array'];
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
99
|
+
return { problems, resources: [], dropped: [] };
|
|
100
|
+
if (!Array.isArray(c.resources)) {
|
|
101
|
+
return { problems: [...problems, 'resources must be an array'], resources: [], dropped: [] };
|
|
102
|
+
}
|
|
103
|
+
// Counted over every entry before any is judged: a duplicate leaves out EVERY copy. Which one
|
|
104
|
+
// the generator meant is unknown, and keeping the first would be a guess at it. Two tools with
|
|
105
|
+
// one name are rejected by the vendor, and the same list feeds the generated MCP script, which
|
|
106
|
+
// refuses a repeated name at load.
|
|
107
|
+
const copies = new Map();
|
|
108
|
+
for (const resource of c.resources) {
|
|
78
109
|
const name = resource === null || resource === void 0 ? void 0 : resource.name;
|
|
79
|
-
if (typeof name
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
if (
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
110
|
+
if (typeof name === 'string')
|
|
111
|
+
copies.set(name, ((_a = copies.get(name)) !== null && _a !== void 0 ? _a : 0) + 1);
|
|
112
|
+
}
|
|
113
|
+
const resources = [];
|
|
114
|
+
const dropped = [];
|
|
115
|
+
c.resources.forEach((resource, i) => {
|
|
116
|
+
var _a;
|
|
117
|
+
const name = typeof (resource === null || resource === void 0 ? void 0 : resource.name) === 'string' ? resource.name : undefined;
|
|
118
|
+
const wrong = resourceProblems(resource, (_a = copies.get(name !== null && name !== void 0 ? name : '')) !== null && _a !== void 0 ? _a : 0);
|
|
119
|
+
if (wrong.length)
|
|
120
|
+
dropped.push({ at: `resources[${i}]`, name, problems: wrong });
|
|
121
|
+
else
|
|
122
|
+
resources.push(resource);
|
|
123
|
+
});
|
|
124
|
+
return { problems, resources, dropped };
|
|
125
|
+
}
|
|
126
|
+
/** What is wrong with one resource, if anything. `copies` is how many entries share its name. */
|
|
127
|
+
function resourceProblems(resource, copies) {
|
|
128
|
+
// A kind this version does not know is judged on nothing else: its name need not look like
|
|
129
|
+
// anything here (a dataserver query's name is free-form), and it is left out either way.
|
|
130
|
+
const kind = resource === null || resource === void 0 ? void 0 : resource.kind;
|
|
131
|
+
if (typeof kind === 'string' && !KNOWN_KINDS.includes(kind)) {
|
|
132
|
+
return [
|
|
133
|
+
`kind '${kind}' is not one this version of the assistant reads (${KNOWN_KINDS.join(' or ')})`,
|
|
134
|
+
];
|
|
135
|
+
}
|
|
136
|
+
const name = resource === null || resource === void 0 ? void 0 : resource.name;
|
|
137
|
+
if (typeof name !== 'string' || !RESOURCE_NAME.test(name)) {
|
|
138
|
+
return [`name must look like REQ_<NAME> or EVENT_<NAME> (got ${String(name)})`];
|
|
139
|
+
}
|
|
140
|
+
const problems = [];
|
|
141
|
+
if (toolNameOf(name).length > MAX_TOOL_NAME_LENGTH) {
|
|
142
|
+
problems.push(`longer than the ${MAX_TOOL_NAME_LENGTH} characters a tool name allows`);
|
|
143
|
+
}
|
|
144
|
+
if (copies > 1) {
|
|
145
|
+
problems.push(`appears ${copies} times, and which one is meant is unknown`);
|
|
146
|
+
}
|
|
147
|
+
const expectedKind = name.startsWith('REQ_') ? 'request' : 'event';
|
|
148
|
+
if (kind !== expectedKind) {
|
|
149
|
+
problems.push(`kind must be '${expectedKind}' (got ${String(kind)})`);
|
|
150
|
+
}
|
|
151
|
+
if (typeof resource.context !== 'string')
|
|
152
|
+
problems.push('context must be a string');
|
|
153
|
+
if (expectedKind === 'event') {
|
|
154
|
+
if (!GENESIS_EVENT_OPS.includes(resource.op)) {
|
|
155
|
+
problems.push(`op must be one of ${GENESIS_EVENT_OPS.join(', ')}`);
|
|
94
156
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
// The same cross-check `kind` gets, for the same reason: a name and a declaration that
|
|
102
|
-
// disagree are a generator bug, and this one is not cosmetic — see opFromName.
|
|
103
|
-
const declared = opFromName(name);
|
|
104
|
-
if (declared && resource.op !== declared) {
|
|
105
|
-
problems.push(`${name}: op must be '${declared}' to match its name (got ${String(resource.op)})`);
|
|
106
|
-
}
|
|
107
|
-
if (resource.maxRows !== undefined)
|
|
108
|
-
problems.push(`${name}: maxRows applies to requests only`);
|
|
157
|
+
// The same cross-check `kind` gets, for the same reason: a name and a declaration that
|
|
158
|
+
// disagree are a generator bug, and this one is not cosmetic — see opFromName.
|
|
159
|
+
const declared = opFromName(name);
|
|
160
|
+
if (declared && resource.op !== declared) {
|
|
161
|
+
problems.push(`op must be '${declared}' to match its name (got ${String(resource.op)})`);
|
|
109
162
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
163
|
+
if (resource.maxRows !== undefined)
|
|
164
|
+
problems.push('maxRows applies to requests only');
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
if (resource.op !== undefined)
|
|
168
|
+
problems.push('op applies to events only');
|
|
169
|
+
const { maxRows } = resource;
|
|
170
|
+
if (maxRows !== undefined &&
|
|
171
|
+
!(Number.isInteger(maxRows) && maxRows >= 1 && maxRows <= MAX_ROWS_CEILING)) {
|
|
172
|
+
problems.push(`maxRows must be a whole number from 1 to ${MAX_ROWS_CEILING}`);
|
|
118
173
|
}
|
|
119
|
-
}
|
|
174
|
+
}
|
|
120
175
|
return problems;
|
|
121
176
|
}
|