@dudousxd/nestjs-agent 1.32.4 → 1.34.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/index.cjs CHANGED
@@ -48,11 +48,14 @@ __export(kit_exports, {
48
48
  NEST_SANDBOX_KIT_MANIFEST: () => NEST_SANDBOX_KIT_MANIFEST,
49
49
  nestSandboxKitDiscovery: () => nestSandboxKitDiscovery
50
50
  });
51
- function nestSandboxKitDiscovery(options = {}) {
51
+ function nestSandboxKitDiscovery(options = {}, name) {
52
52
  const manifest = options.manifest ?? NEST_SANDBOX_KIT_MANIFEST;
53
53
  return (0, import_kit2.sandboxKitDiscovery)({
54
54
  root: (0, import_node_path.resolve)(options.root ?? process.cwd()),
55
- descriptor: options.descriptor ?? NEST_SANDBOX_KIT_DESCRIPTOR,
55
+ ...name !== void 0 ? {
56
+ name
57
+ } : {},
58
+ descriptor: (0, import_kit2.sandboxKitDescriptorPath)(options.descriptor ?? NEST_SANDBOX_KIT_DESCRIPTOR, name),
56
59
  ...manifest !== false ? {
57
60
  manifest: {
58
61
  file: manifest.file,
@@ -62,6 +65,12 @@ function nestSandboxKitDiscovery(options = {}) {
62
65
  ...options.kitUrl !== void 0 ? {
63
66
  kitUrl: options.kitUrl
64
67
  } : {},
68
+ ...options.cssUrl !== void 0 ? {
69
+ cssUrl: options.cssUrl
70
+ } : {},
71
+ ...options.tailwindUrl !== void 0 ? {
72
+ tailwindUrl: options.tailwindUrl
73
+ } : {},
65
74
  ...options.production !== void 0 ? {
66
75
  production: options.production
67
76
  } : {}
@@ -269,6 +278,7 @@ function mergeSandboxClients(clients) {
269
278
  for (const client of clients) {
270
279
  const one = client();
271
280
  merged.theme ||= one.theme;
281
+ if (one.name !== void 0 && merged.kit === void 0 && one.kit !== void 0) merged.name = one.name;
272
282
  if (one.kit !== void 0) merged.kit ??= one.kit;
273
283
  if (one.css !== void 0) merged.css ??= one.css;
274
284
  if (one.tailwind !== void 0) merged.tailwind ??= one.tailwind;
@@ -280,14 +290,19 @@ async function resolveGenui(options) {
280
290
  const { sandbox: asked, channels: askedChannels } = options;
281
291
  (0, import_genui.assertGenuiChannels)(askedChannels);
282
292
  const clients = [];
283
- let discovery;
293
+ const discoveries = /* @__PURE__ */ new Map();
284
294
  const resolveSandbox = /* @__PURE__ */ __name(async (value) => {
285
295
  if (value === void 0 || value === false) return value;
286
296
  const [{ nestSandboxKitDiscovery: nestSandboxKitDiscovery2 }, { resolveSandboxServer }] = await Promise.all([
287
297
  Promise.resolve().then(() => (init_kit(), kit_exports)),
288
298
  import("@dudousxd/nestjs-agent-core/genui/kit")
289
299
  ]);
290
- discovery ??= nestSandboxKitDiscovery2(options.sandboxKit);
300
+ const kitName = value === true ? void 0 : value.kitName;
301
+ let discovery = discoveries.get(kitName ?? "");
302
+ if (discovery === void 0) {
303
+ discovery = nestSandboxKitDiscovery2(options.sandboxKit, kitName);
304
+ discoveries.set(kitName ?? "", discovery);
305
+ }
291
306
  const resolved = resolveSandboxServer(value, discovery);
292
307
  clients.push(resolved.client);
293
308
  return resolved.define;