@dudousxd/nestjs-agent 1.32.4 → 1.33.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.
@@ -26,12 +26,15 @@ __export(kit_exports, {
26
26
  nestSandboxKitDiscovery: () => nestSandboxKitDiscovery
27
27
  });
28
28
  import { resolve } from "path";
29
- import { sandboxKitDiscovery } from "@dudousxd/nestjs-agent-core/genui/kit";
30
- function nestSandboxKitDiscovery(options = {}) {
29
+ import { sandboxKitDescriptorPath, sandboxKitDiscovery } from "@dudousxd/nestjs-agent-core/genui/kit";
30
+ function nestSandboxKitDiscovery(options = {}, name) {
31
31
  const manifest = options.manifest ?? NEST_SANDBOX_KIT_MANIFEST;
32
32
  return sandboxKitDiscovery({
33
33
  root: resolve(options.root ?? process.cwd()),
34
- descriptor: options.descriptor ?? NEST_SANDBOX_KIT_DESCRIPTOR,
34
+ ...name !== void 0 ? {
35
+ name
36
+ } : {},
37
+ descriptor: sandboxKitDescriptorPath(options.descriptor ?? NEST_SANDBOX_KIT_DESCRIPTOR, name),
35
38
  ...manifest !== false ? {
36
39
  manifest: {
37
40
  file: manifest.file,
@@ -41,6 +44,12 @@ function nestSandboxKitDiscovery(options = {}) {
41
44
  ...options.kitUrl !== void 0 ? {
42
45
  kitUrl: options.kitUrl
43
46
  } : {},
47
+ ...options.cssUrl !== void 0 ? {
48
+ cssUrl: options.cssUrl
49
+ } : {},
50
+ ...options.tailwindUrl !== void 0 ? {
51
+ tailwindUrl: options.tailwindUrl
52
+ } : {},
44
53
  ...options.production !== void 0 ? {
45
54
  production: options.production
46
55
  } : {}
@@ -1351,6 +1360,7 @@ function mergeSandboxClients(clients) {
1351
1360
  for (const client of clients) {
1352
1361
  const one = client();
1353
1362
  merged.theme ||= one.theme;
1363
+ if (one.name !== void 0 && merged.kit === void 0 && one.kit !== void 0) merged.name = one.name;
1354
1364
  if (one.kit !== void 0) merged.kit ??= one.kit;
1355
1365
  if (one.css !== void 0) merged.css ??= one.css;
1356
1366
  if (one.tailwind !== void 0) merged.tailwind ??= one.tailwind;
@@ -1362,14 +1372,19 @@ async function resolveGenui(options) {
1362
1372
  const { sandbox: asked, channels: askedChannels } = options;
1363
1373
  assertGenuiChannels(askedChannels);
1364
1374
  const clients = [];
1365
- let discovery;
1375
+ const discoveries = /* @__PURE__ */ new Map();
1366
1376
  const resolveSandbox = /* @__PURE__ */ __name(async (value) => {
1367
1377
  if (value === void 0 || value === false) return value;
1368
1378
  const [{ nestSandboxKitDiscovery: nestSandboxKitDiscovery2 }, { resolveSandboxServer }] = await Promise.all([
1369
1379
  Promise.resolve().then(() => (init_kit(), kit_exports)),
1370
1380
  import("@dudousxd/nestjs-agent-core/genui/kit")
1371
1381
  ]);
1372
- discovery ??= nestSandboxKitDiscovery2(options.sandboxKit);
1382
+ const kitName = value === true ? void 0 : value.kitName;
1383
+ let discovery = discoveries.get(kitName ?? "");
1384
+ if (discovery === void 0) {
1385
+ discovery = nestSandboxKitDiscovery2(options.sandboxKit, kitName);
1386
+ discoveries.set(kitName ?? "", discovery);
1387
+ }
1373
1388
  const resolved = resolveSandboxServer(value, discovery);
1374
1389
  clients.push(resolved.client);
1375
1390
  return resolved.define;