@genesislcap/ai-assistant 15.33.1 → 15.34.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai-assistant.api.json +1021 -6
- package/dist/ai-assistant.d.ts +209 -5
- package/dist/chat-driver.cjs +90 -0
- package/dist/chat-driver.cjs.map +3 -3
- package/dist/chat-driver.mjs +86 -0
- package/dist/chat-driver.mjs.map +3 -3
- package/dist/custom-elements.json +329 -3
- package/dist/dts/chat-driver-node.d.ts +2 -2
- package/dist/dts/chat-driver-node.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.map +1 -1
- package/dist/dts/index.d.ts +2 -0
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/main/budget-controller.d.ts +38 -6
- package/dist/dts/main/budget-controller.d.ts.map +1 -1
- package/dist/dts/main/main.d.ts +22 -4
- package/dist/dts/main/main.d.ts.map +1 -1
- package/dist/dts/main/main.types.d.ts +25 -0
- package/dist/dts/main/main.types.d.ts.map +1 -1
- package/dist/dts/provider/tiered-provider-switcher.d.ts +123 -0
- package/dist/dts/provider/tiered-provider-switcher.d.ts.map +1 -0
- package/dist/dts/state/ai-assistant-slice.d.ts +34 -0
- package/dist/dts/state/ai-assistant-slice.d.ts.map +1 -1
- package/dist/dts/state/session-store.d.ts.map +1 -1
- package/dist/esm/chat-driver-node.js +11 -1
- package/dist/esm/components/settings-modal/settings-modal.styles.js +75 -0
- package/dist/esm/components/settings-modal/settings-modal.template.js +56 -4
- package/dist/esm/index.js +1 -0
- package/dist/esm/main/budget-controller.js +178 -6
- package/dist/esm/main/main.js +20 -0
- package/dist/esm/provider/tiered-provider-switcher.js +142 -0
- package/dist/esm/state/ai-assistant-slice.js +17 -3
- package/docs/styling.md +24 -0
- package/package.json +18 -17
- package/sandbox/sandbox.ts +52 -0
- package/scripts/smoke-chat-driver-node.mjs +86 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loads the built `./chat-driver` bundles the way a server actually loads them — bare Node,
|
|
3
|
+
* no jsdom, no bundler — and checks the exports a Node host depends on are really there.
|
|
4
|
+
*
|
|
5
|
+
* Why this exists (GENC-1610): nothing in this repo used to load that entry. The de facto
|
|
6
|
+
* smoke test was genesis-create's ai-service, which `require`s it at runtime in ANOTHER repo,
|
|
7
|
+
* so a DOM import pulled into the bundle's closure — an `export *` here, or a new
|
|
8
|
+
* `foundation-ai` module that reaches `ai-provider-di` — surfaced as a crash at require time
|
|
9
|
+
* over there, after release. Both failure modes are silent at build time: esbuild bundles the
|
|
10
|
+
* DOM module happily, and `@microsoft/fast-element` only touches `document` when evaluated.
|
|
11
|
+
*
|
|
12
|
+
* Runs as part of `npm run build`, right after the bundles are written.
|
|
13
|
+
*/
|
|
14
|
+
import { createRequire } from 'node:module';
|
|
15
|
+
import { dirname, resolve } from 'node:path';
|
|
16
|
+
import { fileURLToPath } from 'node:url';
|
|
17
|
+
|
|
18
|
+
const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
19
|
+
const require = createRequire(import.meta.url);
|
|
20
|
+
|
|
21
|
+
const failures = [];
|
|
22
|
+
const check = (condition, message) => {
|
|
23
|
+
if (!condition) failures.push(message);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// The point of the whole exercise: this process has no DOM. If something in the closure
|
|
27
|
+
// evaluates `document`, the require below throws here rather than in a customer's server.
|
|
28
|
+
check(
|
|
29
|
+
typeof globalThis.document === 'undefined' && typeof globalThis.window === 'undefined',
|
|
30
|
+
'this smoke test is only meaningful without a DOM, but one is present — has a setup file leaked in?',
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const cjs = require(resolve(packageRoot, 'dist/chat-driver.cjs'));
|
|
34
|
+
const esm = await import(resolve(packageRoot, 'dist/chat-driver.mjs'));
|
|
35
|
+
|
|
36
|
+
/** Exports a Node host builds its driver stack from, and would notice the loss of. */
|
|
37
|
+
const required = [
|
|
38
|
+
'ChatDriver',
|
|
39
|
+
'AnthropicProvider',
|
|
40
|
+
'AnthropicTransport',
|
|
41
|
+
'GeminiProvider',
|
|
42
|
+
'GeminiTransport',
|
|
43
|
+
'MutableAIProviderRegistry',
|
|
44
|
+
'SUPPORTED_ANTHROPIC_MODEL_IDS',
|
|
45
|
+
'SUPPORTED_GEMINI_MODEL_IDS',
|
|
46
|
+
'vendorOfModel',
|
|
47
|
+
'anthropicTokenCost',
|
|
48
|
+
'geminiTokenCost',
|
|
49
|
+
// The tier table (GENC-1610).
|
|
50
|
+
'AI_TIER_IDS',
|
|
51
|
+
'AI_TIER_VENDORS',
|
|
52
|
+
'DEFAULT_AI_TIERS',
|
|
53
|
+
'resolveAITiers',
|
|
54
|
+
];
|
|
55
|
+
|
|
56
|
+
for (const name of required) {
|
|
57
|
+
check(cjs[name] !== undefined, `dist/chat-driver.cjs does not export ${name}`);
|
|
58
|
+
check(esm[name] !== undefined, `dist/chat-driver.mjs does not export ${name}`);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Deliberately absent, and this is the assertion that keeps it that way: `buildTierProviders`
|
|
62
|
+
// calls `createAIProvider`, which reads the AI feature flag off `window.location`. Exporting it
|
|
63
|
+
// here would compile, bundle and load — and then throw the first time a server called it.
|
|
64
|
+
check(
|
|
65
|
+
cjs.buildTierProviders === undefined,
|
|
66
|
+
'dist/chat-driver.cjs exports buildTierProviders — it is browser-only (window.location). ' +
|
|
67
|
+
'Did chat-driver-node.ts gain an `export *`?',
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
// A table that loads but is empty would satisfy every check above.
|
|
71
|
+
const tiers = cjs.DEFAULT_AI_TIERS ?? {};
|
|
72
|
+
for (const tier of cjs.AI_TIER_IDS ?? []) {
|
|
73
|
+
check(!!tiers.anthropic?.[tier]?.model, `DEFAULT_AI_TIERS.anthropic.${tier} has no model`);
|
|
74
|
+
check(!!tiers.gemini?.[tier]?.model, `DEFAULT_AI_TIERS.gemini.${tier} has no model`);
|
|
75
|
+
check(
|
|
76
|
+
typeof tiers.anthropic?.[tier]?.maxTokens === 'number',
|
|
77
|
+
`DEFAULT_AI_TIERS.anthropic.${tier} has no maxTokens`,
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (failures.length > 0) {
|
|
82
|
+
console.error(`✖ chat-driver Node smoke test failed:\n - ${failures.join('\n - ')}`);
|
|
83
|
+
process.exit(1);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
console.log(`✔ chat-driver loads in bare Node (${required.length} exports checked)`);
|