@alexkroman1/aai 0.8.6 → 0.8.8
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/cli.js
CHANGED
|
@@ -537,7 +537,7 @@ async function buildAgentBundle(cwd, log, opts) {
|
|
|
537
537
|
const clientCount = Object.keys(bundle.clientFiles).length;
|
|
538
538
|
log(/* @__PURE__ */ jsx3(Info, { msg: `worker: ${kb} KB, client: ${clientCount} file(s)` }));
|
|
539
539
|
if (agent.clientEntry && !opts?.skipRenderCheck) {
|
|
540
|
-
const renderCheckPath = "../
|
|
540
|
+
const renderCheckPath = "../ui/_render_check.ts";
|
|
541
541
|
const mod = await import(
|
|
542
542
|
/* @vite-ignore */
|
|
543
543
|
renderCheckPath
|
package/dist/sdk/protocol.d.ts
CHANGED
|
@@ -79,12 +79,12 @@ export declare const TOOL_EXECUTION_TIMEOUT_MS = 30000;
|
|
|
79
79
|
/** Zod schema for session error codes. */
|
|
80
80
|
export declare const SessionErrorCodeSchema: z.ZodEnum<{
|
|
81
81
|
tool: "tool";
|
|
82
|
-
audio: "audio";
|
|
83
82
|
stt: "stt";
|
|
84
83
|
llm: "llm";
|
|
85
84
|
tts: "tts";
|
|
86
85
|
protocol: "protocol";
|
|
87
86
|
connection: "connection";
|
|
87
|
+
audio: "audio";
|
|
88
88
|
internal: "internal";
|
|
89
89
|
}>;
|
|
90
90
|
/** Error codes for categorizing session errors on the wire. */
|
|
@@ -128,12 +128,12 @@ export declare const ClientEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
128
128
|
type: z.ZodLiteral<"error">;
|
|
129
129
|
code: z.ZodEnum<{
|
|
130
130
|
tool: "tool";
|
|
131
|
-
audio: "audio";
|
|
132
131
|
stt: "stt";
|
|
133
132
|
llm: "llm";
|
|
134
133
|
tts: "tts";
|
|
135
134
|
protocol: "protocol";
|
|
136
135
|
connection: "connection";
|
|
136
|
+
audio: "audio";
|
|
137
137
|
internal: "internal";
|
|
138
138
|
}>;
|
|
139
139
|
message: z.ZodString;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Smoke-test a client.tsx by loading it via Vite SSR in a DOM-shimmed
|
|
3
|
+
* environment. The module's top-level `mount()` call executes as a side
|
|
4
|
+
* effect; if it throws, the client code has a render-time bug.
|
|
5
|
+
*
|
|
6
|
+
* Imports linkedom dynamically so this module can be loaded even when
|
|
7
|
+
* linkedom is not installed (the caller catches and skips).
|
|
8
|
+
*/
|
|
9
|
+
export declare function renderCheck(clientEntry: string, cwd: string): Promise<void>;
|
|
10
|
+
//# sourceMappingURL=_render_check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_render_check.d.ts","sourceRoot":"","sources":["../../ui/_render_check.ts"],"names":[],"mappings":"AAMA;;;;;;;GAOG;AACH,wBAAsB,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkEjF"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// Copyright 2025 the AAI authors. MIT license.
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import preact from "@preact/preset-vite";
|
|
4
|
+
import { createServer as createViteServer } from "vite";
|
|
5
|
+
/**
|
|
6
|
+
* Smoke-test a client.tsx by loading it via Vite SSR in a DOM-shimmed
|
|
7
|
+
* environment. The module's top-level `mount()` call executes as a side
|
|
8
|
+
* effect; if it throws, the client code has a render-time bug.
|
|
9
|
+
*
|
|
10
|
+
* Imports linkedom dynamically so this module can be loaded even when
|
|
11
|
+
* linkedom is not installed (the caller catches and skips).
|
|
12
|
+
*/
|
|
13
|
+
export async function renderCheck(clientEntry, cwd) {
|
|
14
|
+
// Dynamic imports so esbuild doesn't bundle linkedom into the CLI dist.
|
|
15
|
+
const { DOMParser, installDomShim } = await import("./_dom_shim.js");
|
|
16
|
+
const { installMockWebSocket } = await import("../sdk/_mock_ws.js");
|
|
17
|
+
installDomShim();
|
|
18
|
+
const g = globalThis;
|
|
19
|
+
const doc = new DOMParser().parseFromString('<!DOCTYPE html><html><head></head><body><main id="app"></main></body></html>', "text/html");
|
|
20
|
+
const prevDoc = g.document;
|
|
21
|
+
const prevLocation = g.location;
|
|
22
|
+
g.document = doc;
|
|
23
|
+
g.location = { origin: "http://localhost:3000", pathname: "/", href: "http://localhost:3000/" };
|
|
24
|
+
// Build resolve.alias from package.json exports so templates can
|
|
25
|
+
// self-reference `@pkg/name/ui` and resolve to local .ts source.
|
|
26
|
+
// Vite's SSR loader doesn't support self-referencing exports (vitejs#9731),
|
|
27
|
+
// so resolve.alias is the standard workaround for monorepo-style setups.
|
|
28
|
+
const pkgRoot = path.resolve(import.meta.dirname ?? __dirname, "..");
|
|
29
|
+
const fs = await import("node:fs/promises");
|
|
30
|
+
const pkg = JSON.parse(await fs.readFile(path.join(pkgRoot, "package.json"), "utf-8"));
|
|
31
|
+
const alias = [];
|
|
32
|
+
for (const [key, val] of Object.entries(pkg.exports ?? {})) {
|
|
33
|
+
const source = typeof val === "object" && val !== null && "source" in val ? val.source : null;
|
|
34
|
+
if (typeof source === "string") {
|
|
35
|
+
alias.push({
|
|
36
|
+
find: `${pkg.name}${key.slice(1)}`,
|
|
37
|
+
replacement: path.resolve(pkgRoot, source),
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// Sort longest-first so `@pkg/name/ui` matches before `@pkg/name`.
|
|
42
|
+
alias.sort((a, b) => b.find.length - a.find.length);
|
|
43
|
+
const cssNoop = {
|
|
44
|
+
name: "ssr-css-noop",
|
|
45
|
+
enforce: "pre",
|
|
46
|
+
resolveId: (id) => (id.endsWith(".css") ? "\0css-noop" : undefined),
|
|
47
|
+
load: (id) => (id === "\0css-noop" ? "" : undefined),
|
|
48
|
+
};
|
|
49
|
+
const mock = installMockWebSocket();
|
|
50
|
+
const vite = await createViteServer({
|
|
51
|
+
root: cwd,
|
|
52
|
+
logLevel: "silent",
|
|
53
|
+
plugins: [preact(), cssNoop],
|
|
54
|
+
resolve: { alias, dedupe: ["preact", "@preact/signals"] },
|
|
55
|
+
ssr: { noExternal: [pkg.name] },
|
|
56
|
+
server: { middlewareMode: true },
|
|
57
|
+
});
|
|
58
|
+
try {
|
|
59
|
+
await vite.ssrLoadModule(clientEntry);
|
|
60
|
+
const app = doc.querySelector("#app");
|
|
61
|
+
if (!app?.innerHTML) {
|
|
62
|
+
throw new Error("client.tsx render check failed: #app is empty after mount()");
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
finally {
|
|
66
|
+
await vite.close();
|
|
67
|
+
mock.restore();
|
|
68
|
+
g.document = prevDoc;
|
|
69
|
+
g.location = prevLocation;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=_render_check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_render_check.js","sourceRoot":"","sources":["../../ui/_render_check.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAE/C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,MAAM,MAAM,qBAAqB,CAAC;AACzC,OAAO,EAAc,YAAY,IAAI,gBAAgB,EAAe,MAAM,MAAM,CAAC;AAEjF;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,WAAmB,EAAE,GAAW;IAChE,wEAAwE;IACxE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,CAAC;IACrE,MAAM,EAAE,oBAAoB,EAAE,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAC;IAEpE,cAAc,EAAE,CAAC;IAEjB,MAAM,CAAC,GAAG,UAAgD,CAAC;IAC3D,MAAM,GAAG,GAAG,IAAI,SAAS,EAAE,CAAC,eAAe,CACzC,8EAA8E,EAC9E,WAAW,CACZ,CAAC;IACF,MAAM,OAAO,GAAG,CAAC,CAAC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,CAAC,KAAK,EAAE,CAAC;QACnB,IAAI,CAAC,OAAO,EAAE,CAAC;QACf,CAAC,CAAC,QAAQ,GAAG,OAAO,CAAC;QACrB,CAAC,CAAC,QAAQ,GAAG,YAAY,CAAC;IAC5B,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alexkroman1/aai",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"aai": "dist/aai.js"
|
|
@@ -189,7 +189,7 @@
|
|
|
189
189
|
"lint:fix": "biome check --write sdk/ ui/ cli/",
|
|
190
190
|
"exports": "node scripts/gen-exports.mjs --write",
|
|
191
191
|
"exports:check": "node scripts/gen-exports.mjs",
|
|
192
|
-
"check": "concurrently -g -n tsc,tsc:cli,tsc:build,tsc:tpl,biome,mdlint,exports,test \"tsc --noEmit\" \"tsc -p cli/tsconfig.json --noEmit\" \"tsc -p tsconfig.build.json --noEmit\" \"tsc -p tsconfig.templates.json\" \"biome check sdk/ ui/ cli/\" \"markdownlint-cli2 '**/*.md' '
|
|
192
|
+
"check": "concurrently -g -n tsc,tsc:cli,tsc:build,tsc:tpl,biome,mdlint,exports,test \"tsc --noEmit\" \"tsc -p cli/tsconfig.json --noEmit\" \"tsc -p tsconfig.build.json --noEmit\" \"tsc -p tsconfig.templates.json\" \"biome check sdk/ ui/ cli/\" \"markdownlint-cli2 '**/*.md' '#**/node_modules' '#.aai'\" \"node scripts/gen-exports.mjs\" \"vitest run\"",
|
|
193
193
|
"link:global": "node scripts/write-dev-shim.mjs && pnpm link --global"
|
|
194
194
|
}
|
|
195
195
|
}
|