@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.js CHANGED
@@ -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
  } : {}
@@ -177,6 +186,7 @@ function mergeSandboxClients(clients) {
177
186
  for (const client of clients) {
178
187
  const one = client();
179
188
  merged.theme ||= one.theme;
189
+ if (one.name !== void 0 && merged.kit === void 0 && one.kit !== void 0) merged.name = one.name;
180
190
  if (one.kit !== void 0) merged.kit ??= one.kit;
181
191
  if (one.css !== void 0) merged.css ??= one.css;
182
192
  if (one.tailwind !== void 0) merged.tailwind ??= one.tailwind;
@@ -188,14 +198,19 @@ async function resolveGenui(options) {
188
198
  const { sandbox: asked, channels: askedChannels } = options;
189
199
  assertGenuiChannels(askedChannels);
190
200
  const clients = [];
191
- let discovery;
201
+ const discoveries = /* @__PURE__ */ new Map();
192
202
  const resolveSandbox = /* @__PURE__ */ __name(async (value) => {
193
203
  if (value === void 0 || value === false) return value;
194
204
  const [{ nestSandboxKitDiscovery: nestSandboxKitDiscovery2 }, { resolveSandboxServer }] = await Promise.all([
195
205
  Promise.resolve().then(() => (init_kit(), kit_exports)),
196
206
  import("@dudousxd/nestjs-agent-core/genui/kit")
197
207
  ]);
198
- discovery ??= nestSandboxKitDiscovery2(options.sandboxKit);
208
+ const kitName = value === true ? void 0 : value.kitName;
209
+ let discovery = discoveries.get(kitName ?? "");
210
+ if (discovery === void 0) {
211
+ discovery = nestSandboxKitDiscovery2(options.sandboxKit, kitName);
212
+ discoveries.set(kitName ?? "", discovery);
213
+ }
199
214
  const resolved = resolveSandboxServer(value, discovery);
200
215
  clients.push(resolved.client);
201
216
  return resolved.define;