@alexkroman1/aai 0.8.0 → 0.8.2
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 +145 -328
- package/dist/sdk/_render_check.d.ts +3 -0
- package/dist/sdk/_render_check.d.ts.map +1 -1
- package/dist/sdk/_render_check.js +6 -2
- package/dist/sdk/_render_check.js.map +1 -1
- package/dist/ui/_components/app.d.ts.map +1 -1
- package/dist/ui/_components/app.js +3 -4
- package/dist/ui/_components/app.js.map +1 -1
- package/dist/ui/_components/chat_view.d.ts.map +1 -1
- package/dist/ui/_components/chat_view.js +1 -2
- package/dist/ui/_components/chat_view.js.map +1 -1
- package/dist/ui/_components/start_screen.js +1 -1
- package/dist/ui/_components/start_screen.js.map +1 -1
- package/dist/ui/components_mod.d.ts +2 -2
- package/dist/ui/components_mod.d.ts.map +1 -1
- package/dist/ui/components_mod.js.map +1 -1
- package/dist/ui/mod.d.ts +2 -2
- package/dist/ui/mod.d.ts.map +1 -1
- package/dist/ui/mount.d.ts +1 -13
- package/dist/ui/mount.d.ts.map +1 -1
- package/dist/ui/mount.js.map +1 -1
- package/dist/ui/mount_context.d.ts +13 -1
- package/dist/ui/mount_context.d.ts.map +1 -1
- package/dist/ui/mount_context.js.map +1 -1
- package/package.json +1 -1
- package/templates/night-owl/client.tsx +1 -1
package/dist/cli.js
CHANGED
|
@@ -133,111 +133,6 @@ var init_help = __esm({
|
|
|
133
133
|
}
|
|
134
134
|
});
|
|
135
135
|
|
|
136
|
-
// cli/_bundler.ts
|
|
137
|
-
import fs from "node:fs/promises";
|
|
138
|
-
import path from "node:path";
|
|
139
|
-
import preact from "@preact/preset-vite";
|
|
140
|
-
import tailwindcss from "@tailwindcss/vite";
|
|
141
|
-
import { build } from "vite";
|
|
142
|
-
async function readDirRecursive(dir, base = dir) {
|
|
143
|
-
const files = {};
|
|
144
|
-
let names;
|
|
145
|
-
try {
|
|
146
|
-
names = await fs.readdir(dir);
|
|
147
|
-
} catch {
|
|
148
|
-
return files;
|
|
149
|
-
}
|
|
150
|
-
for (const name of names) {
|
|
151
|
-
const full = path.join(dir, name);
|
|
152
|
-
const stat = await fs.stat(full);
|
|
153
|
-
const entry = { name, isDirectory: () => stat.isDirectory() };
|
|
154
|
-
if (entry.isDirectory()) {
|
|
155
|
-
Object.assign(files, await readDirRecursive(full, base));
|
|
156
|
-
} else {
|
|
157
|
-
const rel = path.relative(base, full);
|
|
158
|
-
files[rel] = await fs.readFile(full, "utf-8");
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
return files;
|
|
162
|
-
}
|
|
163
|
-
async function bundleAgent(agent, opts) {
|
|
164
|
-
const aaiDir = path.join(agent.dir, ".aai");
|
|
165
|
-
const buildDir = path.join(aaiDir, "build");
|
|
166
|
-
const clientDir = path.join(aaiDir, "client");
|
|
167
|
-
await fs.mkdir(aaiDir, { recursive: true });
|
|
168
|
-
const workerEntry = path.join(aaiDir, "_worker_entry.ts");
|
|
169
|
-
await fs.writeFile(
|
|
170
|
-
workerEntry,
|
|
171
|
-
[
|
|
172
|
-
`import agent from "../agent.ts";`,
|
|
173
|
-
`import { initWorker } from "@alexkroman1/aai/worker-shim";`,
|
|
174
|
-
`initWorker(agent);`
|
|
175
|
-
].join("\n")
|
|
176
|
-
);
|
|
177
|
-
try {
|
|
178
|
-
await build({
|
|
179
|
-
configFile: false,
|
|
180
|
-
root: agent.dir,
|
|
181
|
-
logLevel: "warn",
|
|
182
|
-
build: {
|
|
183
|
-
outDir: buildDir,
|
|
184
|
-
emptyOutDir: true,
|
|
185
|
-
minify: true,
|
|
186
|
-
target: "es2022",
|
|
187
|
-
rollupOptions: {
|
|
188
|
-
input: workerEntry,
|
|
189
|
-
output: {
|
|
190
|
-
format: "es",
|
|
191
|
-
entryFileNames: "worker.js",
|
|
192
|
-
inlineDynamicImports: true
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
} catch (err) {
|
|
198
|
-
throw new BundleError(err instanceof Error ? err.message : String(err));
|
|
199
|
-
}
|
|
200
|
-
const skipClient = opts?.skipClient || !agent.clientEntry;
|
|
201
|
-
if (!skipClient) {
|
|
202
|
-
try {
|
|
203
|
-
await build({
|
|
204
|
-
root: agent.dir,
|
|
205
|
-
base: "./",
|
|
206
|
-
logLevel: "warn",
|
|
207
|
-
plugins: [preact(), tailwindcss()],
|
|
208
|
-
build: {
|
|
209
|
-
outDir: clientDir,
|
|
210
|
-
emptyOutDir: true,
|
|
211
|
-
minify: true,
|
|
212
|
-
target: "es2022"
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
} catch (err) {
|
|
216
|
-
throw new BundleError(err instanceof Error ? err.message : String(err));
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
const worker = await fs.readFile(path.join(buildDir, "worker.js"), "utf-8");
|
|
220
|
-
const clientFiles = await readDirRecursive(clientDir);
|
|
221
|
-
return {
|
|
222
|
-
worker,
|
|
223
|
-
clientFiles,
|
|
224
|
-
clientDir,
|
|
225
|
-
workerBytes: Buffer.byteLength(worker)
|
|
226
|
-
};
|
|
227
|
-
}
|
|
228
|
-
var BundleError;
|
|
229
|
-
var init_bundler = __esm({
|
|
230
|
-
"cli/_bundler.ts"() {
|
|
231
|
-
"use strict";
|
|
232
|
-
BundleError = class extends Error {
|
|
233
|
-
constructor(message) {
|
|
234
|
-
super(message);
|
|
235
|
-
this.name = "BundleError";
|
|
236
|
-
}
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
|
-
|
|
241
136
|
// cli/_prompts.tsx
|
|
242
137
|
import { ConfirmInput, PasswordInput, Select, TextInput } from "@inkjs/ui";
|
|
243
138
|
import { Box, render, Text } from "ink";
|
|
@@ -325,17 +220,17 @@ __export(discover_exports, {
|
|
|
325
220
|
writeProjectConfig: () => writeProjectConfig
|
|
326
221
|
});
|
|
327
222
|
import { accessSync } from "node:fs";
|
|
328
|
-
import
|
|
329
|
-
import
|
|
223
|
+
import fs from "node:fs/promises";
|
|
224
|
+
import path from "node:path";
|
|
330
225
|
import { humanId } from "human-id";
|
|
331
226
|
function isDevMode() {
|
|
332
227
|
const script = process.argv[1] ?? "";
|
|
333
228
|
if (script.endsWith(".ts") || script.endsWith(".tsx")) return true;
|
|
334
229
|
if (script.includes("/dist/") && !script.includes("node_modules")) {
|
|
335
|
-
const dir =
|
|
230
|
+
const dir = path.dirname(path.dirname(script));
|
|
336
231
|
try {
|
|
337
|
-
accessSync(
|
|
338
|
-
accessSync(
|
|
232
|
+
accessSync(path.join(dir, "sdk"));
|
|
233
|
+
accessSync(path.join(dir, "cli"));
|
|
339
234
|
return true;
|
|
340
235
|
} catch {
|
|
341
236
|
return false;
|
|
@@ -348,17 +243,17 @@ function generateSlug() {
|
|
|
348
243
|
}
|
|
349
244
|
async function readAuthConfig() {
|
|
350
245
|
try {
|
|
351
|
-
return JSON.parse(await
|
|
246
|
+
return JSON.parse(await fs.readFile(CONFIG_FILE, "utf-8"));
|
|
352
247
|
} catch {
|
|
353
248
|
return {};
|
|
354
249
|
}
|
|
355
250
|
}
|
|
356
251
|
async function writeAuthConfig(config) {
|
|
357
|
-
await
|
|
358
|
-
await
|
|
252
|
+
await fs.mkdir(CONFIG_DIR, { recursive: true });
|
|
253
|
+
await fs.writeFile(CONFIG_FILE, `${JSON.stringify(config, null, 2)}
|
|
359
254
|
`);
|
|
360
255
|
if (process.platform !== "win32") {
|
|
361
|
-
await
|
|
256
|
+
await fs.chmod(CONFIG_FILE, 384);
|
|
362
257
|
}
|
|
363
258
|
}
|
|
364
259
|
async function getApiKey() {
|
|
@@ -378,35 +273,35 @@ async function getApiKey() {
|
|
|
378
273
|
}
|
|
379
274
|
async function readProjectConfig(agentDir) {
|
|
380
275
|
try {
|
|
381
|
-
return JSON.parse(await
|
|
276
|
+
return JSON.parse(await fs.readFile(path.join(agentDir, ".aai", "project.json"), "utf-8"));
|
|
382
277
|
} catch {
|
|
383
278
|
return null;
|
|
384
279
|
}
|
|
385
280
|
}
|
|
386
281
|
async function writeProjectConfig(agentDir, data) {
|
|
387
|
-
const aaiDir =
|
|
388
|
-
await
|
|
389
|
-
await
|
|
282
|
+
const aaiDir = path.join(agentDir, ".aai");
|
|
283
|
+
await fs.mkdir(aaiDir, { recursive: true });
|
|
284
|
+
await fs.writeFile(path.join(aaiDir, "project.json"), `${JSON.stringify(data, null, 2)}
|
|
390
285
|
`);
|
|
391
286
|
}
|
|
392
287
|
async function fileExists(p) {
|
|
393
288
|
try {
|
|
394
|
-
await
|
|
289
|
+
await fs.access(p);
|
|
395
290
|
return true;
|
|
396
291
|
} catch {
|
|
397
292
|
return false;
|
|
398
293
|
}
|
|
399
294
|
}
|
|
400
295
|
async function loadAgent(dir) {
|
|
401
|
-
const hasAgentTs = await fileExists(
|
|
296
|
+
const hasAgentTs = await fileExists(path.join(dir, "agent.ts"));
|
|
402
297
|
if (!hasAgentTs) return null;
|
|
403
298
|
const config = await readProjectConfig(dir);
|
|
404
299
|
const slug = config?.slug ?? generateSlug();
|
|
405
|
-
const clientEntry = await fileExists(
|
|
300
|
+
const clientEntry = await fileExists(path.join(dir, "client.tsx")) ? path.join(dir, "client.tsx") : "";
|
|
406
301
|
return {
|
|
407
302
|
slug,
|
|
408
303
|
dir,
|
|
409
|
-
entryPoint:
|
|
304
|
+
entryPoint: path.join(dir, "agent.ts"),
|
|
410
305
|
clientEntry
|
|
411
306
|
};
|
|
412
307
|
}
|
|
@@ -415,12 +310,126 @@ var init_discover = __esm({
|
|
|
415
310
|
"cli/_discover.ts"() {
|
|
416
311
|
"use strict";
|
|
417
312
|
init_prompts();
|
|
418
|
-
CONFIG_DIR =
|
|
419
|
-
CONFIG_FILE =
|
|
313
|
+
CONFIG_DIR = path.join(process.env.HOME ?? process.env.USERPROFILE ?? ".", ".config", "aai");
|
|
314
|
+
CONFIG_FILE = path.join(CONFIG_DIR, "config.json");
|
|
420
315
|
DEFAULT_SERVER = "https://aai-agent.fly.dev";
|
|
421
316
|
}
|
|
422
317
|
});
|
|
423
318
|
|
|
319
|
+
// cli/_bundler.ts
|
|
320
|
+
import fs2 from "node:fs/promises";
|
|
321
|
+
import path2 from "node:path";
|
|
322
|
+
import preact from "@preact/preset-vite";
|
|
323
|
+
import tailwindcss from "@tailwindcss/vite";
|
|
324
|
+
import { build } from "vite";
|
|
325
|
+
async function readDirRecursive(dir, base = dir) {
|
|
326
|
+
const files = {};
|
|
327
|
+
let names;
|
|
328
|
+
try {
|
|
329
|
+
names = await fs2.readdir(dir);
|
|
330
|
+
} catch {
|
|
331
|
+
return files;
|
|
332
|
+
}
|
|
333
|
+
for (const name of names) {
|
|
334
|
+
const full = path2.join(dir, name);
|
|
335
|
+
const stat = await fs2.stat(full);
|
|
336
|
+
const entry = { name, isDirectory: () => stat.isDirectory() };
|
|
337
|
+
if (entry.isDirectory()) {
|
|
338
|
+
Object.assign(files, await readDirRecursive(full, base));
|
|
339
|
+
} else {
|
|
340
|
+
const rel = path2.relative(base, full);
|
|
341
|
+
files[rel] = await fs2.readFile(full, "utf-8");
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
return files;
|
|
345
|
+
}
|
|
346
|
+
async function bundleAgent(agent, opts) {
|
|
347
|
+
const aaiDir = path2.join(agent.dir, ".aai");
|
|
348
|
+
const buildDir = path2.join(aaiDir, "build");
|
|
349
|
+
const clientDir = path2.join(aaiDir, "client");
|
|
350
|
+
await fs2.mkdir(aaiDir, { recursive: true });
|
|
351
|
+
const workerEntry = path2.join(aaiDir, "_worker_entry.ts");
|
|
352
|
+
await fs2.writeFile(
|
|
353
|
+
workerEntry,
|
|
354
|
+
[
|
|
355
|
+
`import agent from "../agent.ts";`,
|
|
356
|
+
`import { initWorker } from "@alexkroman1/aai/worker-shim";`,
|
|
357
|
+
`initWorker(agent);`
|
|
358
|
+
].join("\n")
|
|
359
|
+
);
|
|
360
|
+
try {
|
|
361
|
+
await build({
|
|
362
|
+
configFile: false,
|
|
363
|
+
root: agent.dir,
|
|
364
|
+
logLevel: "warn",
|
|
365
|
+
build: {
|
|
366
|
+
outDir: buildDir,
|
|
367
|
+
emptyOutDir: true,
|
|
368
|
+
minify: true,
|
|
369
|
+
target: "es2022",
|
|
370
|
+
rollupOptions: {
|
|
371
|
+
input: workerEntry,
|
|
372
|
+
output: {
|
|
373
|
+
format: "es",
|
|
374
|
+
entryFileNames: "worker.js",
|
|
375
|
+
inlineDynamicImports: true
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
} catch (err) {
|
|
381
|
+
throw new BundleError(err instanceof Error ? err.message : String(err));
|
|
382
|
+
}
|
|
383
|
+
const skipClient = opts?.skipClient || !agent.clientEntry;
|
|
384
|
+
if (!skipClient) {
|
|
385
|
+
const devAlias = {};
|
|
386
|
+
if (isDevMode()) {
|
|
387
|
+
const monorepoRoot = path2.resolve(import.meta.dirname ?? __dirname, "..");
|
|
388
|
+
devAlias["@alexkroman1/aai/ui/styles.css"] = path2.join(monorepoRoot, "ui/styles.css");
|
|
389
|
+
devAlias["@alexkroman1/aai/ui"] = path2.join(monorepoRoot, "ui/mod.ts");
|
|
390
|
+
devAlias["@alexkroman1/aai"] = path2.join(monorepoRoot, "sdk/mod.ts");
|
|
391
|
+
}
|
|
392
|
+
try {
|
|
393
|
+
await build({
|
|
394
|
+
root: agent.dir,
|
|
395
|
+
base: "./",
|
|
396
|
+
logLevel: "warn",
|
|
397
|
+
plugins: [preact(), tailwindcss()],
|
|
398
|
+
...Object.keys(devAlias).length > 0 && { resolve: { alias: devAlias } },
|
|
399
|
+
build: {
|
|
400
|
+
outDir: clientDir,
|
|
401
|
+
emptyOutDir: true,
|
|
402
|
+
minify: true,
|
|
403
|
+
target: "es2022"
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
} catch (err) {
|
|
407
|
+
throw new BundleError(err instanceof Error ? err.message : String(err));
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
const worker = await fs2.readFile(path2.join(buildDir, "worker.js"), "utf-8");
|
|
411
|
+
const clientFiles = await readDirRecursive(clientDir);
|
|
412
|
+
return {
|
|
413
|
+
worker,
|
|
414
|
+
clientFiles,
|
|
415
|
+
clientDir,
|
|
416
|
+
workerBytes: Buffer.byteLength(worker)
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
var BundleError;
|
|
420
|
+
var init_bundler = __esm({
|
|
421
|
+
"cli/_bundler.ts"() {
|
|
422
|
+
"use strict";
|
|
423
|
+
init_discover();
|
|
424
|
+
BundleError = class extends Error {
|
|
425
|
+
constructor(message) {
|
|
426
|
+
super(message);
|
|
427
|
+
this.name = "BundleError";
|
|
428
|
+
}
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
|
|
424
433
|
// cli/_ink.tsx
|
|
425
434
|
import { Spinner } from "@inkjs/ui";
|
|
426
435
|
import { Box as Box2, render as render2, Static, Text as Text2, useApp } from "ink";
|
|
@@ -557,204 +566,6 @@ var init_ink = __esm({
|
|
|
557
566
|
}
|
|
558
567
|
});
|
|
559
568
|
|
|
560
|
-
// ui/_dom_shim.ts
|
|
561
|
-
import { DOMParser } from "linkedom";
|
|
562
|
-
function installDomShim() {
|
|
563
|
-
if (installed) return;
|
|
564
|
-
installed = true;
|
|
565
|
-
const doc = new DOMParser().parseFromString(
|
|
566
|
-
"<!DOCTYPE html><html><head></head><body></body></html>",
|
|
567
|
-
"text/html"
|
|
568
|
-
);
|
|
569
|
-
const g2 = globalThis;
|
|
570
|
-
g2.document = doc;
|
|
571
|
-
g2.HTMLElement = doc.documentElement.constructor;
|
|
572
|
-
if (!Object.getOwnPropertyDescriptor(
|
|
573
|
-
g2.HTMLElement.prototype,
|
|
574
|
-
"scrollIntoView"
|
|
575
|
-
)) {
|
|
576
|
-
g2.HTMLElement.prototype.scrollIntoView = () => {
|
|
577
|
-
};
|
|
578
|
-
}
|
|
579
|
-
}
|
|
580
|
-
var installed;
|
|
581
|
-
var init_dom_shim = __esm({
|
|
582
|
-
"ui/_dom_shim.ts"() {
|
|
583
|
-
"use strict";
|
|
584
|
-
installed = false;
|
|
585
|
-
}
|
|
586
|
-
});
|
|
587
|
-
|
|
588
|
-
// sdk/_mock_ws.ts
|
|
589
|
-
function installMockWebSocket() {
|
|
590
|
-
const saved = globalThis.WebSocket;
|
|
591
|
-
const created = [];
|
|
592
|
-
g.WebSocket = class extends MockWebSocket {
|
|
593
|
-
constructor(url, protocols) {
|
|
594
|
-
super(url, protocols);
|
|
595
|
-
created.push(this);
|
|
596
|
-
}
|
|
597
|
-
};
|
|
598
|
-
return {
|
|
599
|
-
created,
|
|
600
|
-
get lastWs() {
|
|
601
|
-
return created.at(-1) ?? null;
|
|
602
|
-
},
|
|
603
|
-
restore() {
|
|
604
|
-
globalThis.WebSocket = saved;
|
|
605
|
-
},
|
|
606
|
-
[Symbol.dispose]() {
|
|
607
|
-
globalThis.WebSocket = saved;
|
|
608
|
-
}
|
|
609
|
-
};
|
|
610
|
-
}
|
|
611
|
-
var MockWebSocket, g;
|
|
612
|
-
var init_mock_ws = __esm({
|
|
613
|
-
"sdk/_mock_ws.ts"() {
|
|
614
|
-
"use strict";
|
|
615
|
-
MockWebSocket = class _MockWebSocket extends EventTarget {
|
|
616
|
-
// mirrors the WebSocket API
|
|
617
|
-
static CONNECTING = 0;
|
|
618
|
-
// mirrors the WebSocket API
|
|
619
|
-
static OPEN = 1;
|
|
620
|
-
// mirrors the WebSocket API
|
|
621
|
-
static CLOSING = 2;
|
|
622
|
-
// mirrors the WebSocket API
|
|
623
|
-
static CLOSED = 3;
|
|
624
|
-
readyState = _MockWebSocket.CONNECTING;
|
|
625
|
-
binaryType = "arraybuffer";
|
|
626
|
-
/** All messages passed to {@linkcode send}, in order. */
|
|
627
|
-
sent = [];
|
|
628
|
-
url;
|
|
629
|
-
/**
|
|
630
|
-
* Create a new MockWebSocket.
|
|
631
|
-
*
|
|
632
|
-
* Automatically transitions to `OPEN` state on the next microtask,
|
|
633
|
-
* dispatching an `"open"` event.
|
|
634
|
-
*
|
|
635
|
-
* @param url - The WebSocket URL.
|
|
636
|
-
* @param _protocols - Ignored; accepted for API compatibility.
|
|
637
|
-
*/
|
|
638
|
-
constructor(url, _protocols) {
|
|
639
|
-
super();
|
|
640
|
-
this.url = typeof url === "string" ? url : url.toString();
|
|
641
|
-
queueMicrotask(() => {
|
|
642
|
-
if (this.readyState === _MockWebSocket.CONNECTING) {
|
|
643
|
-
this.readyState = _MockWebSocket.OPEN;
|
|
644
|
-
this.dispatchEvent(new Event("open"));
|
|
645
|
-
}
|
|
646
|
-
});
|
|
647
|
-
}
|
|
648
|
-
/**
|
|
649
|
-
* Record a sent message without transmitting it.
|
|
650
|
-
*
|
|
651
|
-
* @param data - The message data to record.
|
|
652
|
-
*/
|
|
653
|
-
send(data) {
|
|
654
|
-
this.sent.push(data);
|
|
655
|
-
}
|
|
656
|
-
/**
|
|
657
|
-
* Transition to `CLOSED` state and dispatch a `"close"` event.
|
|
658
|
-
*
|
|
659
|
-
* @param code - The close code (defaults to 1000).
|
|
660
|
-
* @param _reason - Ignored; accepted for API compatibility.
|
|
661
|
-
*/
|
|
662
|
-
close(code, _reason) {
|
|
663
|
-
this.readyState = _MockWebSocket.CLOSED;
|
|
664
|
-
this.dispatchEvent(new CloseEvent("close", { code: code ?? 1e3 }));
|
|
665
|
-
}
|
|
666
|
-
/**
|
|
667
|
-
* Simulate receiving a message from the server.
|
|
668
|
-
*
|
|
669
|
-
* @param data - The message data (string or binary).
|
|
670
|
-
*/
|
|
671
|
-
simulateMessage(data) {
|
|
672
|
-
this.dispatchEvent(new MessageEvent("message", { data }));
|
|
673
|
-
}
|
|
674
|
-
/** Transition to `OPEN` state and dispatch an `"open"` event. */
|
|
675
|
-
open() {
|
|
676
|
-
this.readyState = _MockWebSocket.OPEN;
|
|
677
|
-
this.dispatchEvent(new Event("open"));
|
|
678
|
-
}
|
|
679
|
-
/**
|
|
680
|
-
* Shorthand for {@linkcode simulateMessage}.
|
|
681
|
-
*
|
|
682
|
-
* @param data - The message data to dispatch.
|
|
683
|
-
*/
|
|
684
|
-
msg(data) {
|
|
685
|
-
this.dispatchEvent(new MessageEvent("message", { data }));
|
|
686
|
-
}
|
|
687
|
-
/**
|
|
688
|
-
* Simulate a connection close from the server.
|
|
689
|
-
*
|
|
690
|
-
* @param code - The close code (defaults to 1000).
|
|
691
|
-
*/
|
|
692
|
-
disconnect(code = 1e3) {
|
|
693
|
-
this.dispatchEvent(new CloseEvent("close", { code }));
|
|
694
|
-
}
|
|
695
|
-
/** Dispatch an `"error"` event on this socket. */
|
|
696
|
-
error() {
|
|
697
|
-
this.dispatchEvent(new Event("error"));
|
|
698
|
-
}
|
|
699
|
-
/**
|
|
700
|
-
* Return all sent string messages parsed as JSON objects.
|
|
701
|
-
*
|
|
702
|
-
* Binary messages are filtered out.
|
|
703
|
-
*
|
|
704
|
-
* @returns An array of parsed JSON objects from sent string messages.
|
|
705
|
-
*/
|
|
706
|
-
sentJson() {
|
|
707
|
-
return this.sent.filter((d) => typeof d === "string").map((s) => JSON.parse(s));
|
|
708
|
-
}
|
|
709
|
-
};
|
|
710
|
-
g = globalThis;
|
|
711
|
-
}
|
|
712
|
-
});
|
|
713
|
-
|
|
714
|
-
// sdk/_render_check.ts
|
|
715
|
-
var render_check_exports = {};
|
|
716
|
-
__export(render_check_exports, {
|
|
717
|
-
renderCheck: () => renderCheck
|
|
718
|
-
});
|
|
719
|
-
import { createServer as createViteServer } from "vite";
|
|
720
|
-
async function renderCheck(clientEntry, cwd) {
|
|
721
|
-
installDomShim();
|
|
722
|
-
const g2 = globalThis;
|
|
723
|
-
const doc = new DOMParser().parseFromString(
|
|
724
|
-
'<!DOCTYPE html><html><head></head><body><main id="app"></main></body></html>',
|
|
725
|
-
"text/html"
|
|
726
|
-
);
|
|
727
|
-
const prevDoc = g2.document;
|
|
728
|
-
const prevLocation = g2.location;
|
|
729
|
-
g2.document = doc;
|
|
730
|
-
g2.location = { origin: "http://localhost:3000", pathname: "/", href: "http://localhost:3000/" };
|
|
731
|
-
const mock = installMockWebSocket();
|
|
732
|
-
const vite = await createViteServer({
|
|
733
|
-
root: cwd,
|
|
734
|
-
logLevel: "silent",
|
|
735
|
-
server: { middlewareMode: true }
|
|
736
|
-
});
|
|
737
|
-
try {
|
|
738
|
-
await vite.ssrLoadModule(clientEntry);
|
|
739
|
-
const app = doc.querySelector("#app");
|
|
740
|
-
if (!app?.innerHTML) {
|
|
741
|
-
throw new Error("client.tsx render check failed: #app is empty after mount()");
|
|
742
|
-
}
|
|
743
|
-
} finally {
|
|
744
|
-
await vite.close();
|
|
745
|
-
mock.restore();
|
|
746
|
-
g2.document = prevDoc;
|
|
747
|
-
g2.location = prevLocation;
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
var init_render_check = __esm({
|
|
751
|
-
"sdk/_render_check.ts"() {
|
|
752
|
-
"use strict";
|
|
753
|
-
init_dom_shim();
|
|
754
|
-
init_mock_ws();
|
|
755
|
-
}
|
|
756
|
-
});
|
|
757
|
-
|
|
758
569
|
// cli/_build.ts
|
|
759
570
|
import React2 from "react";
|
|
760
571
|
async function buildAgentBundle(cwd, log) {
|
|
@@ -776,12 +587,18 @@ async function buildAgentBundle(cwd, log) {
|
|
|
776
587
|
const clientCount = Object.keys(bundle.clientFiles).length;
|
|
777
588
|
log(React2.createElement(Info, { msg: `worker: ${kb} KB, client: ${clientCount} file(s)` }));
|
|
778
589
|
if (agent.clientEntry) {
|
|
779
|
-
log(React2.createElement(Step, { action: "Render", msg: "check" }));
|
|
780
590
|
try {
|
|
781
|
-
const
|
|
782
|
-
await
|
|
591
|
+
const renderCheckPath = "../sdk/_render_check.ts";
|
|
592
|
+
const { renderCheck } = await import(
|
|
593
|
+
/* @vite-ignore */
|
|
594
|
+
renderCheckPath
|
|
595
|
+
);
|
|
596
|
+
log(React2.createElement(Step, { action: "Render", msg: "check" }));
|
|
597
|
+
await renderCheck(agent.clientEntry, cwd);
|
|
783
598
|
} catch (err) {
|
|
784
|
-
|
|
599
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
600
|
+
if (msg.includes("linkedom") || msg.includes("_render_check")) return bundle;
|
|
601
|
+
throw new Error(`Render check failed: ${msg}`);
|
|
785
602
|
}
|
|
786
603
|
}
|
|
787
604
|
return bundle;
|
|
@@ -2966,10 +2783,10 @@ import React3 from "react";
|
|
|
2966
2783
|
init_discover();
|
|
2967
2784
|
import fs5 from "node:fs/promises";
|
|
2968
2785
|
import path7 from "node:path";
|
|
2969
|
-
import { createServer as
|
|
2786
|
+
import { createServer as createViteServer } from "vite";
|
|
2970
2787
|
async function loadAgentDef(cwd) {
|
|
2971
2788
|
const agentPath = path7.resolve(cwd, "agent.ts");
|
|
2972
|
-
const vite = await
|
|
2789
|
+
const vite = await createViteServer({
|
|
2973
2790
|
root: cwd,
|
|
2974
2791
|
logLevel: "silent",
|
|
2975
2792
|
server: { middlewareMode: true }
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
* Smoke-test a client.tsx by loading it via Vite SSR in a DOM-shimmed
|
|
3
3
|
* environment. The module's top-level `mount()` call executes as a side
|
|
4
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).
|
|
5
8
|
*/
|
|
6
9
|
export declare function renderCheck(clientEntry: string, cwd: string): Promise<void>;
|
|
7
10
|
//# sourceMappingURL=_render_check.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_render_check.d.ts","sourceRoot":"","sources":["../../sdk/_render_check.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"_render_check.d.ts","sourceRoot":"","sources":["../../sdk/_render_check.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,wBAAsB,WAAW,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAoCjF"}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
// Copyright 2025 the AAI authors. MIT license.
|
|
2
2
|
import { createServer as createViteServer } from "vite";
|
|
3
|
-
import { DOMParser, installDomShim } from "../ui/_dom_shim.js";
|
|
4
|
-
import { installMockWebSocket } from "./_mock_ws.js";
|
|
5
3
|
/**
|
|
6
4
|
* Smoke-test a client.tsx by loading it via Vite SSR in a DOM-shimmed
|
|
7
5
|
* environment. The module's top-level `mount()` call executes as a side
|
|
8
6
|
* effect; if it throws, the client code has a render-time bug.
|
|
7
|
+
*
|
|
8
|
+
* Imports linkedom dynamically so this module can be loaded even when
|
|
9
|
+
* linkedom is not installed (the caller catches and skips).
|
|
9
10
|
*/
|
|
10
11
|
export async function renderCheck(clientEntry, cwd) {
|
|
12
|
+
// Dynamic imports so esbuild doesn't bundle linkedom into the CLI dist.
|
|
13
|
+
const { DOMParser, installDomShim } = await import("../ui/_dom_shim.js");
|
|
14
|
+
const { installMockWebSocket } = await import("./_mock_ws.js");
|
|
11
15
|
installDomShim();
|
|
12
16
|
const g = globalThis;
|
|
13
17
|
const doc = new DOMParser().parseFromString('<!DOCTYPE html><html><head></head><body><main id="app"></main></body></html>', "text/html");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_render_check.js","sourceRoot":"","sources":["../../sdk/_render_check.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAE/C,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"_render_check.js","sourceRoot":"","sources":["../../sdk/_render_check.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAE/C,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,MAAM,CAAC;AAExD;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,WAAmB,EAAE,GAAW;IAChE,wEAAwE;IACxE,MAAM,EAAE,SAAS,EAAE,cAAc,EAAE,GAAG,MAAM,MAAM,CAAC,oBAAoB,CAAC,CAAC;IACzE,MAAM,EAAE,oBAAoB,EAAE,GAAG,MAAM,MAAM,CAAC,eAAe,CAAC,CAAC;IAE/D,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,QAAQ,CAAC;IAC3B,MAAM,YAAY,GAAG,CAAC,CAAC,QAAQ,CAAC;IAChC,CAAC,CAAC,QAAQ,GAAG,GAAG,CAAC;IACjB,CAAC,CAAC,QAAQ,GAAG,EAAE,MAAM,EAAE,uBAAuB,EAAE,QAAQ,EAAE,GAAG,EAAE,IAAI,EAAE,wBAAwB,EAAE,CAAC;IAEhG,MAAM,IAAI,GAAG,oBAAoB,EAAE,CAAC;IACpC,MAAM,IAAI,GAAG,MAAM,gBAAgB,CAAC;QAClC,IAAI,EAAE,GAAG;QACT,QAAQ,EAAE,QAAQ;QAClB,MAAM,EAAE,EAAE,cAAc,EAAE,IAAI,EAAE;KACjC,CAAC,CAAC;IAEH,IAAI,CAAC;QACH,MAAM,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;QACtC,MAAM,GAAG,GAAI,GAA2B,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAC/D,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;QACjF,CAAC;IACH,CAAC;YAAS,CAAC;QACT,MAAM,IAAI,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../ui/_components/app.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../ui/_components/app.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,MAAM,QAAQ,CAAC;AAatC,wBAAgB,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,OAAO,CAQxC"}
|
|
@@ -2,12 +2,11 @@ import { jsx as _jsx } from "preact/jsx-runtime";
|
|
|
2
2
|
import { useMountConfig } from "../mount_context.js";
|
|
3
3
|
import { ChatView } from "./chat_view.js";
|
|
4
4
|
import { StartScreen } from "./start_screen.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return (_jsx("span", { class: "font-aai-mono text-lg leading-[1.1] font-bold text-aai-primary whitespace-pre", children: AAI_LOGO }));
|
|
5
|
+
function AnsiLogo() {
|
|
6
|
+
return (_jsx("pre", { class: "font-aai-mono text-lg leading-[1.1] font-bold text-aai-primary m-0", children: "▄▀█ ▄▀█ █\n█▀█ █▀█ █" }));
|
|
8
7
|
}
|
|
9
8
|
export function App() {
|
|
10
9
|
const { title } = useMountConfig();
|
|
11
|
-
return (_jsx(StartScreen, { icon: title ? undefined : _jsx(
|
|
10
|
+
return (_jsx(StartScreen, { icon: title ? undefined : _jsx(AnsiLogo, {}), title: title, children: _jsx(ChatView, {}) }));
|
|
12
11
|
}
|
|
13
12
|
//# sourceMappingURL=app.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../ui/_components/app.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAiB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAoB,CAAC;AAEjD,
|
|
1
|
+
{"version":3,"file":"app.js","sourceRoot":"","sources":["../../../ui/_components/app.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAiB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAoB,CAAC;AAEjD,SAAS,QAAQ;IACf,OAAO,CACL,cAAK,KAAK,EAAC,oEAAoE,YAC5E,sBAAsB,GACnB,CACP,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,GAAG;IACjB,MAAM,EAAE,KAAK,EAAE,GAAG,cAAc,EAAE,CAAC;IAEnC,OAAO,CACL,KAAC,WAAW,IAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAC,QAAQ,KAAG,EAAE,KAAK,EAAE,KAAK,YAC/D,KAAC,QAAQ,KAAG,GACA,CACf,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat_view.d.ts","sourceRoot":"","sources":["../../../ui/_components/chat_view.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"chat_view.d.ts","sourceRoot":"","sources":["../../../ui/_components/chat_view.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,MAAM,QAAQ,CAAC;AAQtC,wBAAgB,QAAQ,IAAI,MAAM,CAAC,GAAG,CAAC,OAAO,CAwB7C"}
|
|
@@ -5,10 +5,9 @@ import { Controls } from "./controls.js";
|
|
|
5
5
|
import { ErrorBanner } from "./error_banner.js";
|
|
6
6
|
import { MessageList } from "./message_list.js";
|
|
7
7
|
import { StateIndicator } from "./state_indicator.js";
|
|
8
|
-
const AAI_LOGO = `▄▀█ ▄▀█ █\n█▀█ █▀█ █`;
|
|
9
8
|
export function ChatView() {
|
|
10
9
|
const { session } = useSession();
|
|
11
10
|
const { title } = useMountConfig();
|
|
12
|
-
return (_jsxs("div", { class: "flex flex-col h-screen max-w-130 mx-auto bg-aai-bg text-aai-text font-aai text-sm", children: [_jsxs("div", { class: "flex items-center gap-3 px-4 py-3 border-b border-aai-border shrink-0", children: [title ? (_jsx("span", { class: "text-sm font-semibold text-aai-primary", children: title })) : (_jsx("
|
|
11
|
+
return (_jsxs("div", { class: "flex flex-col h-screen max-w-130 mx-auto bg-aai-bg text-aai-text font-aai text-sm", children: [_jsxs("div", { class: "flex items-center gap-3 px-4 py-3 border-b border-aai-border shrink-0", children: [title ? (_jsx("span", { class: "text-sm font-semibold text-aai-primary", children: title })) : (_jsx("pre", { class: "font-aai-mono text-[10px] leading-[1.1] font-bold text-aai-primary m-0", children: "▄▀█ ▄▀█ █\n█▀█ █▀█ █" })), _jsx("div", { class: "ml-auto", children: _jsx(StateIndicator, { state: session.state }) })] }), _jsx(ErrorBanner, { error: session.error }), _jsx(MessageList, {}), _jsx(Controls, {})] }));
|
|
13
12
|
}
|
|
14
13
|
//# sourceMappingURL=chat_view.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat_view.js","sourceRoot":"","sources":["../../../ui/_components/chat_view.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAgB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAuB,CAAC;AAEvD,MAAM,
|
|
1
|
+
{"version":3,"file":"chat_view.js","sourceRoot":"","sources":["../../../ui/_components/chat_view.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAgB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAuB,CAAC;AAEvD,MAAM,UAAU,QAAQ;IACtB,MAAM,EAAE,OAAO,EAAE,GAAG,UAAU,EAAE,CAAC;IACjC,MAAM,EAAE,KAAK,EAAE,GAAG,cAAc,EAAE,CAAC;IAEnC,OAAO,CACL,eAAK,KAAK,EAAC,mFAAmF,aAE5F,eAAK,KAAK,EAAC,uEAAuE,aAC/E,KAAK,CAAC,CAAC,CAAC,CACP,eAAM,KAAK,EAAC,wCAAwC,YAAE,KAAK,GAAQ,CACpE,CAAC,CAAC,CAAC,CACF,cAAK,KAAK,EAAC,wEAAwE,YAChF,sBAAsB,GACnB,CACP,EACD,cAAK,KAAK,EAAC,SAAS,YAClB,KAAC,cAAc,IAAC,KAAK,EAAE,OAAO,CAAC,KAAK,GAAI,GACpC,IACF,EACN,KAAC,WAAW,IAAC,KAAK,EAAE,OAAO,CAAC,KAAK,GAAI,EACrC,KAAC,WAAW,KAAG,EACf,KAAC,QAAQ,KAAG,IACR,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -20,6 +20,6 @@ export function StartScreen({ children, icon, title, subtitle, buttonText = "Sta
|
|
|
20
20
|
if (started.value) {
|
|
21
21
|
return _jsx(_Fragment, { children: children });
|
|
22
22
|
}
|
|
23
|
-
return (_jsx("div", { class: "flex items-center justify-center h-screen bg-aai-bg font-aai", children: _jsxs("div", { class: "flex flex-col items-center gap-
|
|
23
|
+
return (_jsx("div", { class: "flex items-center justify-center h-screen bg-aai-bg font-aai", children: _jsxs("div", { class: "flex flex-col items-center gap-4 bg-aai-surface border border-aai-border rounded-lg px-12 py-10 max-w-sm text-center", children: [icon, title && _jsx("h1", { class: "font-semibold text-aai-primary m-0", children: title }), subtitle && _jsx("p", { class: "text-sm text-aai-text-muted m-0", children: subtitle }), _jsx("button", { type: "button", class: "mt-2 px-8 py-3 rounded-aai text-sm font-medium cursor-pointer bg-aai-primary text-white border-none", onClick: start, children: buttonText })] }) }));
|
|
24
24
|
}
|
|
25
25
|
//# sourceMappingURL=start_screen.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start_screen.js","sourceRoot":"","sources":["../../../ui/_components/start_screen.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,WAAW,CAAC,EAC1B,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,UAAU,GAAG,OAAO,GAOrB;IACC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,UAAU,EAAE,CAAC;IAExC,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,OAAO,4BAAG,QAAQ,GAAI,CAAC;IACzB,CAAC;IAED,OAAO,CACL,cAAK,KAAK,EAAC,8DAA8D,YACvE,eAAK,KAAK,EAAC,
|
|
1
|
+
{"version":3,"file":"start_screen.js","sourceRoot":"","sources":["../../../ui/_components/start_screen.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,WAAW,CAAC,EAC1B,QAAQ,EACR,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,UAAU,GAAG,OAAO,GAOrB;IACC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,UAAU,EAAE,CAAC;IAExC,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,OAAO,4BAAG,QAAQ,GAAI,CAAC;IACzB,CAAC;IAED,OAAO,CACL,cAAK,KAAK,EAAC,8DAA8D,YACvE,eAAK,KAAK,EAAC,sHAAsH,aAC9H,IAAI,EACJ,KAAK,IAAI,aAAI,KAAK,EAAC,oCAAoC,YAAE,KAAK,GAAM,EACpE,QAAQ,IAAI,YAAG,KAAK,EAAC,iCAAiC,YAAE,QAAQ,GAAK,EACtE,iBACE,IAAI,EAAC,QAAQ,EACb,KAAK,EAAC,qGAAqG,EAC3G,OAAO,EAAE,KAAK,YAEb,UAAU,GACJ,IACL,GACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
*/
|
|
15
15
|
export { useAutoScroll } from "./_hooks.ts";
|
|
16
16
|
export { App, ChatView, Controls, ErrorBanner, MessageBubble, MessageList, SidebarLayout, StartScreen, StateIndicator, ThinkingIndicator, ToolCallBlock, Transcript, } from "./components.ts";
|
|
17
|
-
export type { MountHandle, MountOptions
|
|
17
|
+
export type { MountHandle, MountOptions } from "./mount.tsx";
|
|
18
18
|
export { mount } from "./mount.tsx";
|
|
19
|
-
export type { MountConfig } from "./mount_context.ts";
|
|
19
|
+
export type { MountConfig, MountTheme } from "./mount_context.ts";
|
|
20
20
|
export { useMountConfig } from "./mount_context.ts";
|
|
21
21
|
export type { SessionSignals } from "./signals.ts";
|
|
22
22
|
export { createSessionControls, SessionProvider, useSession, useToolResult, } from "./signals.ts";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components_mod.d.ts","sourceRoot":"","sources":["../../ui/components_mod.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EACL,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,aAAa,EACb,WAAW,EACX,aAAa,EACb,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,UAAU,GACX,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"components_mod.d.ts","sourceRoot":"","sources":["../../ui/components_mod.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EACL,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,aAAa,EACb,WAAW,EACX,aAAa,EACb,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,UAAU,GACX,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,UAAU,EACV,aAAa,GACd,MAAM,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components_mod.js","sourceRoot":"","sources":["../../ui/components_mod.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EACL,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,aAAa,EACb,WAAW,EACX,aAAa,EACb,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,UAAU,GACX,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"components_mod.js","sourceRoot":"","sources":["../../ui/components_mod.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EACL,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,aAAa,EACb,WAAW,EACX,aAAa,EACb,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,UAAU,GACX,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,KAAK,EAAE,MAAM,YAAa,CAAC;AAEpC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,UAAU,EACV,aAAa,GACd,MAAM,cAAc,CAAC"}
|
package/dist/ui/mod.d.ts
CHANGED
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
*/
|
|
19
19
|
export { useAutoScroll } from "./_hooks.ts";
|
|
20
20
|
export { App, ChatView, Controls, ErrorBanner, MessageBubble, MessageList, SidebarLayout, StartScreen, StateIndicator, ThinkingIndicator, ToolCallBlock, Transcript, } from "./components.ts";
|
|
21
|
-
export type { MountHandle, MountOptions
|
|
21
|
+
export type { MountHandle, MountOptions } from "./mount.tsx";
|
|
22
22
|
export { mount } from "./mount.tsx";
|
|
23
|
-
export type { MountConfig } from "./mount_context.ts";
|
|
23
|
+
export type { MountConfig, MountTheme } from "./mount_context.ts";
|
|
24
24
|
export { useMountConfig } from "./mount_context.ts";
|
|
25
25
|
export type { VoiceSession } from "./session.ts";
|
|
26
26
|
export { createVoiceSession } from "./session.ts";
|
package/dist/ui/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../ui/mod.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EACL,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,aAAa,EACb,WAAW,EACX,aAAa,EACb,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,UAAU,GACX,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../ui/mod.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EACL,GAAG,EACH,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,aAAa,EACb,WAAW,EACX,aAAa,EACb,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,UAAU,GACX,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,YAAY,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,UAAU,EACV,aAAa,GACd,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,UAAU,EACV,OAAO,EACP,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,YAAY,GACb,MAAM,YAAY,CAAC"}
|
package/dist/ui/mount.d.ts
CHANGED
|
@@ -1,19 +1,7 @@
|
|
|
1
1
|
import type { ComponentType } from "preact";
|
|
2
|
+
import { type MountTheme } from "./mount_context.ts";
|
|
2
3
|
import { type VoiceSession } from "./session.ts";
|
|
3
4
|
import { type SessionSignals } from "./signals.ts";
|
|
4
|
-
/** Theme overrides for the default UI. Applied as CSS custom properties. */
|
|
5
|
-
export type MountTheme = {
|
|
6
|
-
/** Background color. Default: `#101010`. */
|
|
7
|
-
bg?: string;
|
|
8
|
-
/** Primary accent color. Default: `#fab283`. */
|
|
9
|
-
primary?: string;
|
|
10
|
-
/** Main text color. */
|
|
11
|
-
text?: string;
|
|
12
|
-
/** Surface/card color. */
|
|
13
|
-
surface?: string;
|
|
14
|
-
/** Border color. */
|
|
15
|
-
border?: string;
|
|
16
|
-
};
|
|
17
5
|
/** Options for {@linkcode mount}. */
|
|
18
6
|
export type MountOptions = {
|
|
19
7
|
/** CSS selector or DOM element to render into. Defaults to `"#app"`. */
|
package/dist/ui/mount.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../ui/mount.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"mount.d.ts","sourceRoot":"","sources":["../../ui/mount.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAE5C,OAAO,EAAuB,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAA0C,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAE3F,qCAAqC;AACrC,MAAM,MAAM,YAAY,GAAG;IACzB,wEAAwE;IACxE,MAAM,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IAC9B,oFAAoF;IACpF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6BAA6B;IAC7B,KAAK,CAAC,EAAE,UAAU,CAAC;CACpB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,oCAAoC;IACpC,OAAO,EAAE,YAAY,CAAC;IACtB,oDAAoD;IACpD,OAAO,EAAE,cAAc,CAAC;IACxB,0EAA0E;IAC1E,OAAO,IAAI,IAAI,CAAC;IAChB,0DAA0D;IAC1D,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC;CAC1B,CAAC;AAQF;;;;;;;;;;;GAWG;AACH,wBAAgB,KAAK,CAAC,SAAS,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,WAAW,CA2CnF"}
|
package/dist/ui/mount.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount.js","sourceRoot":"","sources":["../../ui/mount.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,mBAAmB,
|
|
1
|
+
{"version":3,"file":"mount.js","sourceRoot":"","sources":["../../ui/mount.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,mBAAmB,EAAmB,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAqB,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAuB,MAAM,cAAc,CAAC;AA8B3F,SAAS,gBAAgB,CAAC,SAA+B,MAAM;IAC7D,MAAM,EAAE,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAChF,IAAI,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,MAAM,EAAE,CAAC,CAAC;IACzD,OAAO,EAAiB,CAAC;AAC3B,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,KAAK,CAAC,SAAwB,EAAE,OAAsB;IACpE,MAAM,SAAS,GAAG,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAEpD,MAAM,WAAW,GACf,OAAO,EAAE,WAAW,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC;IACpF,MAAM,OAAO,GAAG,kBAAkB,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC;IACpD,MAAM,OAAO,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;IAE/C,MAAM,WAAW,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;IAErE,mEAAmE;IACnE,IAAI,OAAO,EAAE,KAAK,EAAE,CAAC;QACnB,MAAM,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC;QACxB,MAAM,EAAE,GAAG,SAAwB,CAAC;QACpC,IAAI,CAAC,CAAC,EAAE;YAAE,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,gBAAgB,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QACvD,IAAI,CAAC,CAAC,OAAO;YAAE,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,qBAAqB,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;QACtE,IAAI,CAAC,CAAC,IAAI;YAAE,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,kBAAkB,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;QAC7D,IAAI,CAAC,CAAC,OAAO;YAAE,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,qBAAqB,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC;QACtE,IAAI,CAAC,CAAC,MAAM;YAAE,EAAE,CAAC,KAAK,CAAC,WAAW,CAAC,oBAAoB,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;IACrE,CAAC;IAED,MAAM,CACJ,KAAC,mBAAmB,IAAC,KAAK,EAAE,WAAW,YACrC,KAAC,eAAe,IAAC,KAAK,EAAE,OAAO,YAC7B,KAAC,SAAS,KAAG,GACG,GACE,EACtB,SAAS,CACV,CAAC;IAEF,MAAM,MAAM,GAAgB;QAC1B,OAAO;QACP,OAAO;QACP,OAAO;YACL,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;YACxB,OAAO,CAAC,OAAO,EAAE,CAAC;YAClB,OAAO,CAAC,UAAU,EAAE,CAAC;QACvB,CAAC;QACD,CAAC,MAAM,CAAC,OAAO,CAAC;YACd,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,CAAC;KACF,CAAC;IACF,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
/** Theme overrides for the default UI. Applied as CSS custom properties. */
|
|
2
|
+
export type MountTheme = {
|
|
3
|
+
/** Background color. Default: `#101010`. */
|
|
4
|
+
bg?: string;
|
|
5
|
+
/** Primary accent color. Default: `#fab283`. */
|
|
6
|
+
primary?: string;
|
|
7
|
+
/** Main text color. */
|
|
8
|
+
text?: string;
|
|
9
|
+
/** Surface/card color. */
|
|
10
|
+
surface?: string;
|
|
11
|
+
/** Border color. */
|
|
12
|
+
border?: string;
|
|
13
|
+
};
|
|
2
14
|
/** Resolved mount-level configuration available to default UI components. */
|
|
3
15
|
export type MountConfig = {
|
|
4
16
|
title?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount_context.d.ts","sourceRoot":"","sources":["../../ui/mount_context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mount_context.d.ts","sourceRoot":"","sources":["../../ui/mount_context.ts"],"names":[],"mappings":"AAIA,4EAA4E;AAC5E,MAAM,MAAM,UAAU,GAAG;IACvB,4CAA4C;IAC5C,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uBAAuB;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0BAA0B;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oBAAoB;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,6EAA6E;AAC7E,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,KAAK,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;CAChC,CAAC;AAIF,eAAO,MAAM,mBAAmB,wCAAe,CAAC;AAEhD,kEAAkE;AAClE,wBAAgB,cAAc,IAAI,WAAW,CAE5C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mount_context.js","sourceRoot":"","sources":["../../ui/mount_context.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"mount_context.js","sourceRoot":"","sources":["../../ui/mount_context.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAsB1C,MAAM,GAAG,GAAG,aAAa,CAAc,EAAE,CAAC,CAAC;AAE3C,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAC,QAAQ,CAAC;AAEhD,kEAAkE;AAClE,MAAM,UAAU,cAAc;IAC5B,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC"}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@ import { ChatView, StartScreen, mount } from "@alexkroman1/aai/ui";
|
|
|
3
3
|
|
|
4
4
|
function NightOwl() {
|
|
5
5
|
return (
|
|
6
|
-
<StartScreen icon={<span>🦉</span>} title="Night Owl" subtitle="your evening companion" buttonText="Start Conversation">
|
|
6
|
+
<StartScreen icon={<span class="text-5xl">🦉</span>} title="Night Owl" subtitle="your evening companion" buttonText="Start Conversation">
|
|
7
7
|
<ChatView />
|
|
8
8
|
</StartScreen>
|
|
9
9
|
);
|