@genesislcap/ai-assistant 15.107.0 → 15.109.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/ai-assistant.api.json +410 -4
- package/dist/ai-assistant.d.ts +121 -2
- package/dist/chat-driver.cjs +69 -18
- package/dist/chat-driver.cjs.map +2 -2
- package/dist/chat-driver.mjs +69 -18
- package/dist/chat-driver.mjs.map +2 -2
- package/dist/custom-elements.json +787 -578
- package/dist/dts/chat-driver-node.d.ts +1 -1
- package/dist/dts/chat-driver-node.d.ts.map +1 -1
- package/dist/dts/components/chat-driver/chat-driver.d.ts +9 -0
- package/dist/dts/components/chat-driver/chat-driver.d.ts.map +1 -1
- package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts +2 -0
- package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts.map +1 -1
- package/dist/dts/components/settings-modal/settings-modal.d.ts +2 -0
- package/dist/dts/components/settings-modal/settings-modal.d.ts.map +1 -1
- package/dist/dts/components/settings-modal/settings-modal.styles.d.ts.map +1 -1
- package/dist/dts/components/settings-modal/settings-modal.template.d.ts +1 -0
- package/dist/dts/components/settings-modal/settings-modal.template.d.ts.map +1 -1
- package/dist/dts/genesis/config.d.ts.map +1 -1
- package/dist/dts/genesis/register-genesis-assistant.d.ts +24 -0
- package/dist/dts/genesis/register-genesis-assistant.d.ts.map +1 -1
- package/dist/dts/genesis/types.d.ts +8 -2
- package/dist/dts/genesis/types.d.ts.map +1 -1
- package/dist/dts/genesis/vendor-follower.d.ts +86 -0
- package/dist/dts/genesis/vendor-follower.d.ts.map +1 -0
- package/dist/dts/genesis/vendor-pick.d.ts +36 -0
- package/dist/dts/genesis/vendor-pick.d.ts.map +1 -0
- package/dist/dts/index.d.ts +1 -0
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/main/budget-controller.d.ts +6 -0
- package/dist/dts/main/budget-controller.d.ts.map +1 -1
- package/dist/dts/main/main.d.ts +30 -0
- package/dist/dts/main/main.d.ts.map +1 -1
- package/dist/dts/main/vendor-picker-controller.d.ts +89 -0
- package/dist/dts/main/vendor-picker-controller.d.ts.map +1 -0
- package/dist/dts/provider/ai-provider-switcher.d.ts +22 -1
- package/dist/dts/provider/ai-provider-switcher.d.ts.map +1 -1
- package/dist/dts/provider/tiered-provider-switcher.d.ts +39 -2
- package/dist/dts/provider/tiered-provider-switcher.d.ts.map +1 -1
- package/dist/esm/chat-driver-node.js +1 -1
- package/dist/esm/components/chat-driver/chat-driver.js +3 -2
- package/dist/esm/components/orchestrating-driver/orchestrating-driver.js +1 -0
- package/dist/esm/components/settings-modal/settings-modal.js +4 -1
- package/dist/esm/components/settings-modal/settings-modal.styles.js +59 -0
- package/dist/esm/components/settings-modal/settings-modal.template.js +54 -1
- package/dist/esm/genesis/config.js +1 -1
- package/dist/esm/genesis/consumes.js +1 -1
- package/dist/esm/genesis/register-genesis-assistant.js +72 -7
- package/dist/esm/genesis/vendor-follower.js +149 -0
- package/dist/esm/genesis/vendor-pick.js +67 -0
- package/dist/esm/main/budget-controller.js +11 -9
- package/dist/esm/main/main.js +57 -0
- package/dist/esm/main/vendor-picker-controller.js +141 -0
- package/dist/esm/provider/tiered-provider-switcher.js +54 -1
- package/dist/genesis-consumes.cjs +1 -1
- package/dist/genesis-consumes.cjs.map +2 -2
- package/dist/genesis-consumes.mjs +1 -1
- package/dist/genesis-consumes.mjs.map +2 -2
- package/docs/genesis.md +37 -3
- package/package.json +17 -17
- package/scripts/smoke-genesis-consumes-node.mjs +1 -1
|
@@ -29,7 +29,9 @@ export class TieredAIProviderSwitcher {
|
|
|
29
29
|
"vendor's requests to one vendor's proxy.");
|
|
30
30
|
}
|
|
31
31
|
this.options = options;
|
|
32
|
-
this.
|
|
32
|
+
this.vendorChoice = options.vendorChoice;
|
|
33
|
+
this.builtVendors = (_a = options.vendors) !== null && _a !== void 0 ? _a : AI_TIER_VENDORS;
|
|
34
|
+
this._vendors = this.builtVendors;
|
|
33
35
|
// Same reasoning as the endpoint check: fail here, not a turn at a time later. Booting on a
|
|
34
36
|
// vendor outside `vendors` serves one the app has just declared it cannot reach, and is a
|
|
35
37
|
// one-way door — `switchTo` refuses to go back to it once anything switches away. An empty
|
|
@@ -52,6 +54,57 @@ export class TieredAIProviderSwitcher {
|
|
|
52
54
|
get vendor() {
|
|
53
55
|
return this._vendor;
|
|
54
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* The vendors it can switch between now: `vendors` as constructed, unless
|
|
59
|
+
* {@link TieredAIProviderSwitcher.setAvailableVendors} has narrowed them since.
|
|
60
|
+
*/
|
|
61
|
+
get vendors() {
|
|
62
|
+
return this._vendors;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Change which vendors are available, within the ones it was constructed with, and optionally
|
|
66
|
+
* which one is active — in one registry rebuild.
|
|
67
|
+
*
|
|
68
|
+
* @remarks
|
|
69
|
+
* For a host that learns at runtime which vendors its proxy can serve. Genesis Create's preview
|
|
70
|
+
* is the one today: the app is built before the user picks a vendor there, so it registers every
|
|
71
|
+
* vendor and narrows to the ones Create offers once it has asked. The standby entries follow
|
|
72
|
+
* the list, so the assistant's budget-wall banner offers a switch only to a vendor that can
|
|
73
|
+
* answer.
|
|
74
|
+
*
|
|
75
|
+
* `active` is adopted the way {@link TieredAIProviderSwitcher.adoptPersistedVendor} adopts a
|
|
76
|
+
* vendor: subscribers hear of a change, `onSwitch` does not fire. Left out, the active vendor
|
|
77
|
+
* stays when the new list keeps it and becomes the list's first when it does not.
|
|
78
|
+
*
|
|
79
|
+
* Ignored as a whole — nothing changes — when no listed vendor is one it was constructed with,
|
|
80
|
+
* or when `active` is not in the list. A call that changes neither the list nor the vendor
|
|
81
|
+
* leaves the registry alone, so a host may repeat it as often as it asks.
|
|
82
|
+
*/
|
|
83
|
+
setAvailableVendors(vendors, active) {
|
|
84
|
+
const next = this.builtVendors.filter((v) => vendors.includes(v));
|
|
85
|
+
if (!next.length)
|
|
86
|
+
return;
|
|
87
|
+
let target;
|
|
88
|
+
if (active === undefined) {
|
|
89
|
+
target = next.includes(this._vendor) ? this._vendor : next[0];
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
const named = next.find((v) => v === active);
|
|
93
|
+
if (!named)
|
|
94
|
+
return;
|
|
95
|
+
target = named;
|
|
96
|
+
}
|
|
97
|
+
const sameList = next.length === this._vendors.length && next.every((v) => this._vendors.includes(v));
|
|
98
|
+
if (sameList && target === this._vendor)
|
|
99
|
+
return;
|
|
100
|
+
this._vendors = next;
|
|
101
|
+
this.registry.update(this.build(target), { default: this.defaultTier });
|
|
102
|
+
const changed = target !== this._vendor;
|
|
103
|
+
this._vendor = target;
|
|
104
|
+
if (changed)
|
|
105
|
+
for (const listener of Array.from(this.listeners))
|
|
106
|
+
listener(target);
|
|
107
|
+
}
|
|
55
108
|
/**
|
|
56
109
|
* A user-driven switch: move the registry, then tell the app so it can persist the choice.
|
|
57
110
|
* An unknown vendor is ignored.
|
|
@@ -38,7 +38,7 @@ var GENESIS_AI_CONSUMES = Object.freeze({
|
|
|
38
38
|
"inputs",
|
|
39
39
|
"effects"
|
|
40
40
|
]),
|
|
41
|
-
vendors: Object.freeze(["anthropic", "gemini"]),
|
|
41
|
+
vendors: Object.freeze(["anthropic", "gemini", "openai"]),
|
|
42
42
|
tiers: Object.freeze(["low", "high", "reasoning"]),
|
|
43
43
|
shapes: Object.freeze(["row", "key-row"])
|
|
44
44
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/genesis/consumes.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * What this version of the assistant reads from a generated AI config\n * (`@genesislcap/ai-assistant/genesis/consumes`).\n *\n * @remarks\n * Its own entry point, loadable in bare Node, because the seed's CI reads it in a Node step and\n * `./genesis` cannot be: that entry is bundler-target ESM, and its closure registers custom\n * elements, which need a DOM. So this module imports nothing at run time. A type from `./types`\n * is all it may take, and a test holds it to that. The Node build bundles it to\n * `dist/genesis-consumes.mjs` and `.cjs`, and a smoke test loads both without a DOM.\n *\n * @packageDocumentation\n * @beta\n */\nimport type { GenesisAiConsumes } from './types';\n\nexport type { GenesisAiConsumes } from './types';\n\n/**\n * What this version of the assistant reads from a generated AI config: the resource kinds it\n * accepts, the resource fields its validator or a tool reads, the `vendor` and `tier` values it\n * accepts, and the row-action shapes it runs.\n *\n * @remarks\n * The generator must not emit what the installed assistant does not read, or a new kind is left out\n * and a new field ignored \u2014 and an older assistant used to block entirely on a kind it did not know.\n * Nothing in the generator can say which version will run its output. So the app's seed declares\n * what it expects, and the seed's CI checks that declaration against this constant, exported from\n * the version it installs. That makes this the single statement of what an assistant consumes, and\n * it carries no version number because it needs none.\n *\n * A test holds it to the code: its kinds are the ones validation accepts, and its fields are the\n * ones read. A change that teaches the validator a kind, or a tool a field, updates it in the same\n * commit.\n *\n * A resource this version does not read is only left out, but an unknown `vendor` or `tier` still\n * blocks the whole assistant, so those are here too. They are written out rather than imported\n * from foundation-ai, which this entry must not load; a test holds them equal to its\n * `AI_TIER_VENDORS` and `AI_TIER_IDS`, which the validator checks against.\n *\n * @beta\n */\nexport const GENESIS_AI_CONSUMES: GenesisAiConsumes = Object.freeze({\n kinds: Object.freeze(['request', 'event', 'query'] as const),\n resourceFields: Object.freeze([\n 'name',\n 'kind',\n 'op',\n 'context',\n 'maxRows',\n 'customCode',\n 'references',\n 'shape',\n 'entity',\n 'key',\n 'inputs',\n 'effects',\n ] as const),\n vendors: Object.freeze(['anthropic', 'gemini'] as const),\n tiers: Object.freeze(['low', 'high', 'reasoning'] as const),\n shapes: Object.freeze(['row', 'key-row'] as const),\n});\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA0CO,IAAM,sBAAyC,OAAO,OAAO;AAAA,EAClE,OAAO,OAAO,OAAO,CAAC,WAAW,SAAS,OAAO,CAAU;AAAA,EAC3D,gBAAgB,OAAO,OAAO;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAU;AAAA,EACV,SAAS,OAAO,OAAO,CAAC,aAAa,QAAQ,CAAU;AAAA,
|
|
4
|
+
"sourcesContent": ["/**\n * What this version of the assistant reads from a generated AI config\n * (`@genesislcap/ai-assistant/genesis/consumes`).\n *\n * @remarks\n * Its own entry point, loadable in bare Node, because the seed's CI reads it in a Node step and\n * `./genesis` cannot be: that entry is bundler-target ESM, and its closure registers custom\n * elements, which need a DOM. So this module imports nothing at run time. A type from `./types`\n * is all it may take, and a test holds it to that. The Node build bundles it to\n * `dist/genesis-consumes.mjs` and `.cjs`, and a smoke test loads both without a DOM.\n *\n * @packageDocumentation\n * @beta\n */\nimport type { GenesisAiConsumes } from './types';\n\nexport type { GenesisAiConsumes } from './types';\n\n/**\n * What this version of the assistant reads from a generated AI config: the resource kinds it\n * accepts, the resource fields its validator or a tool reads, the `vendor` and `tier` values it\n * accepts, and the row-action shapes it runs.\n *\n * @remarks\n * The generator must not emit what the installed assistant does not read, or a new kind is left out\n * and a new field ignored \u2014 and an older assistant used to block entirely on a kind it did not know.\n * Nothing in the generator can say which version will run its output. So the app's seed declares\n * what it expects, and the seed's CI checks that declaration against this constant, exported from\n * the version it installs. That makes this the single statement of what an assistant consumes, and\n * it carries no version number because it needs none.\n *\n * A test holds it to the code: its kinds are the ones validation accepts, and its fields are the\n * ones read. A change that teaches the validator a kind, or a tool a field, updates it in the same\n * commit.\n *\n * A resource this version does not read is only left out, but an unknown `vendor` or `tier` still\n * blocks the whole assistant, so those are here too. They are written out rather than imported\n * from foundation-ai, which this entry must not load; a test holds them equal to its\n * `AI_TIER_VENDORS` and `AI_TIER_IDS`, which the validator checks against.\n *\n * @beta\n */\nexport const GENESIS_AI_CONSUMES: GenesisAiConsumes = Object.freeze({\n kinds: Object.freeze(['request', 'event', 'query'] as const),\n resourceFields: Object.freeze([\n 'name',\n 'kind',\n 'op',\n 'context',\n 'maxRows',\n 'customCode',\n 'references',\n 'shape',\n 'entity',\n 'key',\n 'inputs',\n 'effects',\n ] as const),\n vendors: Object.freeze(['anthropic', 'gemini', 'openai'] as const),\n tiers: Object.freeze(['low', 'high', 'reasoning'] as const),\n shapes: Object.freeze(['row', 'key-row'] as const),\n});\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA0CO,IAAM,sBAAyC,OAAO,OAAO;AAAA,EAClE,OAAO,OAAO,OAAO,CAAC,WAAW,SAAS,OAAO,CAAU;AAAA,EAC3D,gBAAgB,OAAO,OAAO;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAU;AAAA,EACV,SAAS,OAAO,OAAO,CAAC,aAAa,UAAU,QAAQ,CAAU;AAAA,EACjE,OAAO,OAAO,OAAO,CAAC,OAAO,QAAQ,WAAW,CAAU;AAAA,EAC1D,QAAQ,OAAO,OAAO,CAAC,OAAO,SAAS,CAAU;AACnD,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -15,7 +15,7 @@ var GENESIS_AI_CONSUMES = Object.freeze({
|
|
|
15
15
|
"inputs",
|
|
16
16
|
"effects"
|
|
17
17
|
]),
|
|
18
|
-
vendors: Object.freeze(["anthropic", "gemini"]),
|
|
18
|
+
vendors: Object.freeze(["anthropic", "gemini", "openai"]),
|
|
19
19
|
tiers: Object.freeze(["low", "high", "reasoning"]),
|
|
20
20
|
shapes: Object.freeze(["row", "key-row"])
|
|
21
21
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/genesis/consumes.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * What this version of the assistant reads from a generated AI config\n * (`@genesislcap/ai-assistant/genesis/consumes`).\n *\n * @remarks\n * Its own entry point, loadable in bare Node, because the seed's CI reads it in a Node step and\n * `./genesis` cannot be: that entry is bundler-target ESM, and its closure registers custom\n * elements, which need a DOM. So this module imports nothing at run time. A type from `./types`\n * is all it may take, and a test holds it to that. The Node build bundles it to\n * `dist/genesis-consumes.mjs` and `.cjs`, and a smoke test loads both without a DOM.\n *\n * @packageDocumentation\n * @beta\n */\nimport type { GenesisAiConsumes } from './types';\n\nexport type { GenesisAiConsumes } from './types';\n\n/**\n * What this version of the assistant reads from a generated AI config: the resource kinds it\n * accepts, the resource fields its validator or a tool reads, the `vendor` and `tier` values it\n * accepts, and the row-action shapes it runs.\n *\n * @remarks\n * The generator must not emit what the installed assistant does not read, or a new kind is left out\n * and a new field ignored \u2014 and an older assistant used to block entirely on a kind it did not know.\n * Nothing in the generator can say which version will run its output. So the app's seed declares\n * what it expects, and the seed's CI checks that declaration against this constant, exported from\n * the version it installs. That makes this the single statement of what an assistant consumes, and\n * it carries no version number because it needs none.\n *\n * A test holds it to the code: its kinds are the ones validation accepts, and its fields are the\n * ones read. A change that teaches the validator a kind, or a tool a field, updates it in the same\n * commit.\n *\n * A resource this version does not read is only left out, but an unknown `vendor` or `tier` still\n * blocks the whole assistant, so those are here too. They are written out rather than imported\n * from foundation-ai, which this entry must not load; a test holds them equal to its\n * `AI_TIER_VENDORS` and `AI_TIER_IDS`, which the validator checks against.\n *\n * @beta\n */\nexport const GENESIS_AI_CONSUMES: GenesisAiConsumes = Object.freeze({\n kinds: Object.freeze(['request', 'event', 'query'] as const),\n resourceFields: Object.freeze([\n 'name',\n 'kind',\n 'op',\n 'context',\n 'maxRows',\n 'customCode',\n 'references',\n 'shape',\n 'entity',\n 'key',\n 'inputs',\n 'effects',\n ] as const),\n vendors: Object.freeze(['anthropic', 'gemini'] as const),\n tiers: Object.freeze(['low', 'high', 'reasoning'] as const),\n shapes: Object.freeze(['row', 'key-row'] as const),\n});\n"],
|
|
5
|
-
"mappings": ";AA0CO,IAAM,sBAAyC,OAAO,OAAO;AAAA,EAClE,OAAO,OAAO,OAAO,CAAC,WAAW,SAAS,OAAO,CAAU;AAAA,EAC3D,gBAAgB,OAAO,OAAO;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAU;AAAA,EACV,SAAS,OAAO,OAAO,CAAC,aAAa,QAAQ,CAAU;AAAA,
|
|
4
|
+
"sourcesContent": ["/**\n * What this version of the assistant reads from a generated AI config\n * (`@genesislcap/ai-assistant/genesis/consumes`).\n *\n * @remarks\n * Its own entry point, loadable in bare Node, because the seed's CI reads it in a Node step and\n * `./genesis` cannot be: that entry is bundler-target ESM, and its closure registers custom\n * elements, which need a DOM. So this module imports nothing at run time. A type from `./types`\n * is all it may take, and a test holds it to that. The Node build bundles it to\n * `dist/genesis-consumes.mjs` and `.cjs`, and a smoke test loads both without a DOM.\n *\n * @packageDocumentation\n * @beta\n */\nimport type { GenesisAiConsumes } from './types';\n\nexport type { GenesisAiConsumes } from './types';\n\n/**\n * What this version of the assistant reads from a generated AI config: the resource kinds it\n * accepts, the resource fields its validator or a tool reads, the `vendor` and `tier` values it\n * accepts, and the row-action shapes it runs.\n *\n * @remarks\n * The generator must not emit what the installed assistant does not read, or a new kind is left out\n * and a new field ignored \u2014 and an older assistant used to block entirely on a kind it did not know.\n * Nothing in the generator can say which version will run its output. So the app's seed declares\n * what it expects, and the seed's CI checks that declaration against this constant, exported from\n * the version it installs. That makes this the single statement of what an assistant consumes, and\n * it carries no version number because it needs none.\n *\n * A test holds it to the code: its kinds are the ones validation accepts, and its fields are the\n * ones read. A change that teaches the validator a kind, or a tool a field, updates it in the same\n * commit.\n *\n * A resource this version does not read is only left out, but an unknown `vendor` or `tier` still\n * blocks the whole assistant, so those are here too. They are written out rather than imported\n * from foundation-ai, which this entry must not load; a test holds them equal to its\n * `AI_TIER_VENDORS` and `AI_TIER_IDS`, which the validator checks against.\n *\n * @beta\n */\nexport const GENESIS_AI_CONSUMES: GenesisAiConsumes = Object.freeze({\n kinds: Object.freeze(['request', 'event', 'query'] as const),\n resourceFields: Object.freeze([\n 'name',\n 'kind',\n 'op',\n 'context',\n 'maxRows',\n 'customCode',\n 'references',\n 'shape',\n 'entity',\n 'key',\n 'inputs',\n 'effects',\n ] as const),\n vendors: Object.freeze(['anthropic', 'gemini', 'openai'] as const),\n tiers: Object.freeze(['low', 'high', 'reasoning'] as const),\n shapes: Object.freeze(['row', 'key-row'] as const),\n});\n"],
|
|
5
|
+
"mappings": ";AA0CO,IAAM,sBAAyC,OAAO,OAAO;AAAA,EAClE,OAAO,OAAO,OAAO,CAAC,WAAW,SAAS,OAAO,CAAU;AAAA,EAC3D,gBAAgB,OAAO,OAAO;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAU;AAAA,EACV,SAAS,OAAO,OAAO,CAAC,aAAa,UAAU,QAAQ,CAAU;AAAA,EACjE,OAAO,OAAO,OAAO,CAAC,OAAO,QAAQ,WAAW,CAAU;AAAA,EAC1D,QAAQ,OAAO,OAAO,CAAC,OAAO,SAAS,CAAU;AACnD,CAAC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/docs/genesis.md
CHANGED
|
@@ -67,11 +67,45 @@ could only ever answer for a generated tool whose description the model still se
|
|
|
67
67
|
| `config` | — | The app's `GenesisAiConfig`. |
|
|
68
68
|
| `container` | the DOM DI container | Where the tier providers are registered. |
|
|
69
69
|
| `endpointBase` | `<PUBLIC_PATH>/gwf/ai-service` | `/<vendor>/chat` is appended. Unset, the build env's `GENX_AI_CHAT_BASE` wins (Create's preview; never an app file). |
|
|
70
|
-
| `vendors` | `[config.vendor]` | Vendors the
|
|
70
|
+
| `vendors` | `[config.vendor]` | Vendors the chat starts with. One by default: a proxy holding one key cannot answer for another vendor. The proxy's answer replaces them (see below). |
|
|
71
71
|
| `connect` | the app's `Connect`, from DI | Resolved when a tool first runs, not at registration. |
|
|
72
72
|
| `extensions` | none | `{ toolDefinitions, toolHandlers, systemPrompt }` — the app's hand-written tools, added after the generated ones. |
|
|
73
73
|
| `rowSources` | the `REQ_` for the same table | **Deprecated.** Only the table's own `REQ_` is accepted, which is the default. See [Write tools](#write-tools). |
|
|
74
74
|
|
|
75
|
+
#### Which vendors the chat uses
|
|
76
|
+
|
|
77
|
+
The chat asks its AI proxy which vendors it can serve: `GET <base>/vendor`, at the same base it
|
|
78
|
+
posts `/<vendor>/chat` to (`endpointBase`, else `GENX_AI_CHAT_BASE`, else
|
|
79
|
+
`<PUBLIC_PATH>/gwf/ai-service`), with credentials and `cache: 'no-store'`. The proxy answers
|
|
80
|
+
`{ "vendor": "anthropic", "offeredVendors": ["gemini", "anthropic"] }`.
|
|
81
|
+
|
|
82
|
+
- **An exported app's own proxy** offers the vendors whose `AI_<VENDOR>_API_KEY` is set on the
|
|
83
|
+
app's server, and needs the `AI_CHAT` right, like the chat routes.
|
|
84
|
+
- **Genesis Create's preview** names the vendor the user has selected in Create, and the vendors
|
|
85
|
+
Create can serve. The chat follows a change made in Create without a reload.
|
|
86
|
+
|
|
87
|
+
The chat starts on `config.vendor` (or the app's `vendors`), then takes the proxy's `vendor` and
|
|
88
|
+
offers a switch only among `offeredVendors` that the tier table knows, so a budget wall names only
|
|
89
|
+
a vendor that can answer. It asks at registration, when the window regains focus or the tab becomes
|
|
90
|
+
visible, and after each turn, and applies an answer only while no turn is running.
|
|
91
|
+
|
|
92
|
+
**Picking a vendor.** In an exported app, the assistant's Settings show a card per vendor in the AI
|
|
93
|
+
model section once the proxy offers two or more. The cards are the `settings-model` slot's fallback
|
|
94
|
+
content, so an app that slots its own control there keeps only its own. A pick is remembered per signed-in user and app in
|
|
95
|
+
`localStorage` (guarded, and kept in memory when storage is unavailable), and the chat keeps it
|
|
96
|
+
across refreshes and reloads for as long as the proxy still offers it; when it no longer does, the
|
|
97
|
+
proxy's `vendor` takes over. The cards are disabled while a turn is computing. In Create's preview
|
|
98
|
+
the user picks in Create, so Settings show the active vendor read-only ("AI vendor: Anthropic,
|
|
99
|
+
selected in Genesis Create.") and the chat keeps following the proxy. A budget wall's banner names
|
|
100
|
+
the place to switch: "in Settings", or "in Genesis Create".
|
|
101
|
+
|
|
102
|
+
An empty `offeredVendors` (no key is set) puts the chat back on what it started on, so its
|
|
103
|
+
requests reach the proxy's `NO_API_KEY` refusal and the user reads why. Anything else leaves the
|
|
104
|
+
chat where it is, which before the first good answer is exactly what it
|
|
105
|
+
was before this request existed: the configured vendor alone. That covers a 404 (a proxy too old to
|
|
106
|
+
answer), a 403 (a user without `AI_CHAT`), a network error, another shape, or a `vendor` that is
|
|
107
|
+
not offered. These are logged at debug level only.
|
|
108
|
+
|
|
75
109
|
The agent runs on the registry's default provider, which is the configured tier. Its system prompt
|
|
76
110
|
is the configured prompt, then a fixed rule that tool results are app data and never
|
|
77
111
|
instructions, then its one exception (a change request the user typed into a write review, see
|
|
@@ -99,7 +133,7 @@ that table, unless asked), then the extensions' prompt.
|
|
|
99
133
|
|
|
100
134
|
| Field | Rule |
|
|
101
135
|
| -------------- | ------------------------------------------------------------------------------------------- |
|
|
102
|
-
| `vendor` |
|
|
136
|
+
| `vendor` | `anthropic`, `gemini` or `openai`. Defaults to `gemini`. |
|
|
103
137
|
| `tier` | `low`, `high` or `reasoning`. Defaults to `high`. |
|
|
104
138
|
| `name` | Unique; the tool name is the lowercased name (≤ 64 chars). `REQ_<NAME>` for a request, `EVENT_<NAME>` for an event, and for a query the dataserver query's own name in upper-case letters, digits and underscores. |
|
|
105
139
|
| `kind` | `request`, `event` or `query`. The kind decides which name rule applies, never the name: a query named `REQ_…` is still a query. |
|
|
@@ -137,7 +171,7 @@ GENESIS_AI_CONSUMES;
|
|
|
137
171
|
// kinds: ['request', 'event', 'query'],
|
|
138
172
|
// resourceFields: ['name', 'kind', 'op', 'context', 'maxRows', 'customCode', 'references',
|
|
139
173
|
// 'shape', 'entity', 'key', 'inputs', 'effects'],
|
|
140
|
-
// vendors: ['anthropic', 'gemini'],
|
|
174
|
+
// vendors: ['anthropic', 'gemini', 'openai'],
|
|
141
175
|
// tiers: ['low', 'high', 'reasoning'],
|
|
142
176
|
// shapes: ['row', 'key-row'],
|
|
143
177
|
// }
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/ai-assistant",
|
|
3
3
|
"description": "Genesis AI Assistant micro-frontend",
|
|
4
|
-
"version": "15.
|
|
4
|
+
"version": "15.109.0",
|
|
5
5
|
"license": "SEE LICENSE IN license.txt",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/dts/index.d.ts",
|
|
@@ -102,31 +102,31 @@
|
|
|
102
102
|
}
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
|
-
"@genesislcap/foundation-comms": "15.
|
|
106
|
-
"@genesislcap/foundation-testing": "15.
|
|
107
|
-
"@genesislcap/genx": "15.
|
|
108
|
-
"@genesislcap/ts-builder": "15.
|
|
109
|
-
"@genesislcap/uvu-playwright-builder": "15.
|
|
110
|
-
"@genesislcap/vite-builder": "15.
|
|
111
|
-
"@genesislcap/webpack-builder": "15.
|
|
105
|
+
"@genesislcap/foundation-comms": "15.109.0",
|
|
106
|
+
"@genesislcap/foundation-testing": "15.109.0",
|
|
107
|
+
"@genesislcap/genx": "15.109.0",
|
|
108
|
+
"@genesislcap/ts-builder": "15.109.0",
|
|
109
|
+
"@genesislcap/uvu-playwright-builder": "15.109.0",
|
|
110
|
+
"@genesislcap/vite-builder": "15.109.0",
|
|
111
|
+
"@genesislcap/webpack-builder": "15.109.0",
|
|
112
112
|
"@types/dompurify": "^3.0.5",
|
|
113
113
|
"@types/marked": "^5.0.2",
|
|
114
114
|
"esbuild": "0.25.12"
|
|
115
115
|
},
|
|
116
116
|
"dependencies": {
|
|
117
|
-
"@genesislcap/foundation-ai": "15.
|
|
118
|
-
"@genesislcap/foundation-logger": "15.
|
|
119
|
-
"@genesislcap/foundation-notifications": "15.
|
|
120
|
-
"@genesislcap/foundation-redux": "15.
|
|
121
|
-
"@genesislcap/foundation-ui": "15.
|
|
122
|
-
"@genesislcap/foundation-utils": "15.
|
|
123
|
-
"@genesislcap/rapid-design-system": "15.
|
|
124
|
-
"@genesislcap/web-core": "15.
|
|
117
|
+
"@genesislcap/foundation-ai": "15.109.0",
|
|
118
|
+
"@genesislcap/foundation-logger": "15.109.0",
|
|
119
|
+
"@genesislcap/foundation-notifications": "15.109.0",
|
|
120
|
+
"@genesislcap/foundation-redux": "15.109.0",
|
|
121
|
+
"@genesislcap/foundation-ui": "15.109.0",
|
|
122
|
+
"@genesislcap/foundation-utils": "15.109.0",
|
|
123
|
+
"@genesislcap/rapid-design-system": "15.109.0",
|
|
124
|
+
"@genesislcap/web-core": "15.109.0",
|
|
125
125
|
"dompurify": "^3.3.1",
|
|
126
126
|
"marked": "^17.0.3"
|
|
127
127
|
},
|
|
128
128
|
"peerDependencies": {
|
|
129
|
-
"@genesislcap/foundation-comms": "15.
|
|
129
|
+
"@genesislcap/foundation-comms": "15.109.0"
|
|
130
130
|
},
|
|
131
131
|
"peerDependenciesMeta": {
|
|
132
132
|
"@genesislcap/foundation-comms": {
|