@duct-sdk/sdk 0.4.2 → 0.4.4

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/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  Public release notes for the Duct SDK. Versioning follows [semver](https://semver.org).
4
4
 
5
+ ## [0.4.4] — 2026-07-04
6
+
7
+ ### Changed
8
+ - **`product.logoUrl`** — logo URL belongs under `product` in `duct.config.ts` (removed from `widget`). `duct init` auto-detects `public/logo.*` and resolves against `baseUrl`.
9
+
10
+ ## [0.4.3] — 2026-07-03
11
+
12
+ ### Fixed
13
+ - **`DuctShell` launcher icon when the shell host is unreachable** — bubble icon tries the host app's `/duct-text-no-bg.png` before the shell host URL; removed the nonexistent `duct-logo.png` candidate; final fallback is the `duↄt` wordmark instead of a broken orange SVG.
14
+
5
15
  ## [0.4.2] — 2026-07-03
6
16
 
7
17
  ### Fixed
@@ -97,7 +97,7 @@ export interface DuctShellProps {
97
97
  className?: string;
98
98
  /**
99
99
  * Optional launcher icon source.
100
- * When omitted, the SDK tries cloud-hosted icon first, then local /assets/logo.png.
100
+ * When omitted, the SDK tries the host app's /duct-text-no-bg.png, then the shell host URL, then /assets/logo.png.
101
101
  */
102
102
  launcherIconSrc?: string;
103
103
  /**
@@ -270,7 +270,11 @@ export function DuctShell({ shellId, userContext, onTokenRequest, onNavigate, on
270
270
  })();
271
271
  const iconCandidates = launcherIconSrc
272
272
  ? [launcherIconSrc]
273
- : [`${shellOrigin}/duct-text-no-bg.png`, `${shellOrigin}/duct-logo.png`, DUCT_LAUNCHER_ICON_LOCAL_FALLBACK];
273
+ : [
274
+ "/duct-text-no-bg.png",
275
+ `${shellOrigin}/duct-text-no-bg.png`,
276
+ DUCT_LAUNCHER_ICON_LOCAL_FALLBACK,
277
+ ];
274
278
  const currentIconSrc = iconCandidates[Math.min(iconCandidateIndex, iconCandidates.length - 1)];
275
279
  // Send a message to the iframe
276
280
  const postToShell = useCallback((message) => {
@@ -662,7 +666,15 @@ export function DuctShell({ shellId, userContext, onTokenRequest, onNavigate, on
662
666
  padding: 0,
663
667
  transition: isDragging ? "none" : "transform 150ms ease, box-shadow 150ms ease",
664
668
  };
665
- const bubbleIcon = !iconLoadFailed ? (_jsx("img", { src: currentIconSrc, alt: "Duct", width: 30, height: 30, draggable: false, onError: handleIconError, style: { width: "30px", height: "30px", objectFit: "contain", pointerEvents: "none" } })) : (_jsx("svg", { width: "28", height: "28", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: _jsx("path", { d: "M18 12c0-3.3-2.2-5.5-5.5-5.5C9 6.5 7 8.7 7 12s2 5.5 5.5 5.5c2 0 3.6-.8 4.6-2.2l-2.2-1.6c-.6.8-1.4 1.3-2.4 1.3-1.6 0-2.8-1.2-2.8-3s1.2-3 2.8-3c1 0 1.8.5 2.3 1.3L18 12z", fill: "#E8622A" }) }));
669
+ const bubbleIcon = !iconLoadFailed ? (_jsx("img", { src: currentIconSrc, alt: "Duct", width: 30, height: 30, draggable: false, onError: handleIconError, style: { width: "30px", height: "30px", objectFit: "contain", pointerEvents: "none" } })) : (_jsx("span", { "aria-hidden": "true", style: {
670
+ color: "#E8622A",
671
+ fontSize: 11,
672
+ fontWeight: 600,
673
+ letterSpacing: "-0.02em",
674
+ lineHeight: 1,
675
+ pointerEvents: "none",
676
+ userSelect: "none",
677
+ }, children: "du\u2184t" }));
666
678
  return (_jsxs(_Fragment, { children: [!panelOpen && (_jsx("button", { type: "button", style: {
667
679
  ...bubbleStyle,
668
680
  ...bubbleLauncherStyle,
@@ -200,8 +200,6 @@ function generateWidget(widget, indentSpaces) {
200
200
  lines.push(`${pad} primaryColor: ${JSON.stringify(widget.primaryColor)},`);
201
201
  if (widget.position)
202
202
  lines.push(`${pad} position: ${JSON.stringify(widget.position)},`);
203
- if (widget.logoUrl)
204
- lines.push(`${pad} logoUrl: ${JSON.stringify(widget.logoUrl)},`);
205
203
  if (widget.defaultOpen !== undefined)
206
204
  lines.push(`${pad} defaultOpen: ${widget.defaultOpen},`);
207
205
  if (widget.launcherText)
@@ -254,7 +252,8 @@ export default defineDuctConfig({
254
252
  product: {
255
253
  name: ${JSON.stringify(productName)},
256
254
  description: ${JSON.stringify(`${productName} — AI-powered interaction shell`)},
257
- baseUrl: ${JSON.stringify(baseUrl)},
255
+ baseUrl: ${JSON.stringify(baseUrl)},${logoUrl ? `
256
+ logoUrl: ${JSON.stringify(logoUrl)},` : ''}
258
257
  // apiBaseUrl: optional separate origin for action HTTP proxy (defaults to baseUrl)
259
258
  },
260
259
 
@@ -359,8 +358,7 @@ export default defineDuctConfig({
359
358
 
360
359
  // Shell widget appearance
361
360
  widget: {
362
- position: "bottom-right",${logoUrl ? `
363
- logoUrl: ${JSON.stringify(logoUrl)},` : ""}
361
+ position: "bottom-right",
364
362
  },
365
363
  });
366
364
  `;
@@ -397,6 +395,9 @@ export function generateConfigFile(config) {
397
395
  ...(normalized.product.industry
398
396
  ? [`${i} industry: ${JSON.stringify(normalized.product.industry)},`]
399
397
  : []),
398
+ ...(normalized.product.logoUrl
399
+ ? [`${i} logoUrl: ${JSON.stringify(normalized.product.logoUrl)},`]
400
+ : []),
400
401
  `${i}},`,
401
402
  "",
402
403
  `${i}// Authentication configuration`,
@@ -13,6 +13,7 @@ function sampleConfig(overrides = {}) {
13
13
  description: "Acme test application",
14
14
  baseUrl: BASE_URL,
15
15
  apiBaseUrl: "https://api.acme.com",
16
+ logoUrl: "https://app.acme.com/logo.png",
16
17
  },
17
18
  auth: {
18
19
  strategy: "nextauth",
@@ -56,7 +57,6 @@ function sampleConfig(overrides = {}) {
56
57
  },
57
58
  widget: {
58
59
  position: "bottom-right",
59
- logoUrl: "https://app.acme.com/logo.png",
60
60
  },
61
61
  intershell_enabled: true,
62
62
  registry_visibility: "public",
@@ -97,7 +97,7 @@ describe("validateDuctConfigStrict", () => {
97
97
  });
98
98
  });
99
99
  describe("generateConfigFile", () => {
100
- it("emits apiBaseUrl, normalized tokenEndpoint, intershell flags, and widget logoUrl", () => {
100
+ it("emits apiBaseUrl, normalized tokenEndpoint, intershell flags, and product logoUrl", () => {
101
101
  const output = generateConfigFile(sampleConfig());
102
102
  assert.match(output, /apiBaseUrl: "https:\/\/api\.acme\.com"/);
103
103
  assert.match(output, /tokenEndpoint: "https:\/\/app\.acme\.com\/api\/duct\/token"/);
package/dist/cli/init.js CHANGED
@@ -246,6 +246,16 @@ function detectIndustryFromDeps(deps) {
246
246
  return "analytics";
247
247
  return undefined;
248
248
  }
249
+ function resolveProductLogoUrl(baseUrl, logoUrl) {
250
+ if (!logoUrl?.trim())
251
+ return undefined;
252
+ const trimmed = logoUrl.trim();
253
+ if (/^https?:\/\//i.test(trimmed))
254
+ return trimmed;
255
+ const base = baseUrl.replace(/\/$/, '');
256
+ const path = trimmed.startsWith('/') ? trimmed : `/${trimmed}`;
257
+ return `${base}${path}`;
258
+ }
249
259
  function buildDuctConfigFromPipeline(result, shellId, productName, baseUrl, logoUrl, apiBaseUrl, industry, dataModel) {
250
260
  return normalizeDuctConfigForCodegen({
251
261
  shellId,
@@ -255,6 +265,7 @@ function buildDuctConfigFromPipeline(result, shellId, productName, baseUrl, logo
255
265
  baseUrl,
256
266
  ...(apiBaseUrl ? { apiBaseUrl } : {}),
257
267
  ...(industry ? { industry } : {}),
268
+ ...(logoUrl ? { logoUrl: resolveProductLogoUrl(baseUrl, logoUrl) } : {}),
258
269
  },
259
270
  auth: result.auth,
260
271
  routes: result.routes,
@@ -266,7 +277,6 @@ function buildDuctConfigFromPipeline(result, shellId, productName, baseUrl, logo
266
277
  },
267
278
  widget: {
268
279
  position: "bottom-right",
269
- ...(logoUrl ? { logoUrl } : {}),
270
280
  },
271
281
  ...(result.intershell_enabled !== undefined ||
272
282
  result.registry_visibility !== undefined
@@ -1106,7 +1116,7 @@ export async function runInit(opts = {}) {
1106
1116
  baseUrl,
1107
1117
  authStrategy: authDetection.system,
1108
1118
  framework: topo.framework,
1109
- logoUrl,
1119
+ logoUrl: logoUrl ? resolveProductLogoUrl(baseUrl, logoUrl) : undefined,
1110
1120
  })
1111
1121
  : generateConfigFile(config);
1112
1122
  const receiverContent = generateReceiver(config, framework);
@@ -9,6 +9,7 @@ export declare const DuctConfigSchema: z.ZodObject<{
9
9
  apiBaseUrl: z.ZodOptional<z.ZodString>;
10
10
  locale: z.ZodOptional<z.ZodString>;
11
11
  industry: z.ZodOptional<z.ZodString>;
12
+ logoUrl: z.ZodOptional<z.ZodString>;
12
13
  }, "strip", z.ZodTypeAny, {
13
14
  name: string;
14
15
  description: string;
@@ -16,6 +17,7 @@ export declare const DuctConfigSchema: z.ZodObject<{
16
17
  apiBaseUrl?: string | undefined;
17
18
  locale?: string | undefined;
18
19
  industry?: string | undefined;
20
+ logoUrl?: string | undefined;
19
21
  }, {
20
22
  name: string;
21
23
  description: string;
@@ -23,6 +25,7 @@ export declare const DuctConfigSchema: z.ZodObject<{
23
25
  apiBaseUrl?: string | undefined;
24
26
  locale?: string | undefined;
25
27
  industry?: string | undefined;
28
+ logoUrl?: string | undefined;
26
29
  }>;
27
30
  auth: z.ZodObject<{
28
31
  strategy: z.ZodEnum<["nextauth", "clerk", "auth0", "custom-jwt", "session-cookie", "none", "unknown"]>;
@@ -326,7 +329,6 @@ export declare const DuctConfigSchema: z.ZodObject<{
326
329
  theme: z.ZodOptional<z.ZodEnum<["light", "dark", "system"]>>;
327
330
  width: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
328
331
  height: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodString]>>;
329
- logoUrl: z.ZodOptional<z.ZodString>;
330
332
  customCSS: z.ZodOptional<z.ZodString>;
331
333
  }, "strip", z.ZodTypeAny, {
332
334
  primaryColor?: string | undefined;
@@ -340,7 +342,6 @@ export declare const DuctConfigSchema: z.ZodObject<{
340
342
  theme?: "light" | "dark" | "system" | undefined;
341
343
  width?: string | number | undefined;
342
344
  height?: string | number | undefined;
343
- logoUrl?: string | undefined;
344
345
  customCSS?: string | undefined;
345
346
  }, {
346
347
  primaryColor?: string | undefined;
@@ -354,7 +355,6 @@ export declare const DuctConfigSchema: z.ZodObject<{
354
355
  theme?: "light" | "dark" | "system" | undefined;
355
356
  width?: string | number | undefined;
356
357
  height?: string | number | undefined;
357
- logoUrl?: string | undefined;
358
358
  customCSS?: string | undefined;
359
359
  }>>;
360
360
  registry_visibility: z.ZodDefault<z.ZodOptional<z.ZodEnum<["public", "private"]>>>;
@@ -378,6 +378,7 @@ export declare const DuctConfigSchema: z.ZodObject<{
378
378
  apiBaseUrl?: string | undefined;
379
379
  locale?: string | undefined;
380
380
  industry?: string | undefined;
381
+ logoUrl?: string | undefined;
381
382
  };
382
383
  routes: {
383
384
  name: string;
@@ -465,7 +466,6 @@ export declare const DuctConfigSchema: z.ZodObject<{
465
466
  theme?: "light" | "dark" | "system" | undefined;
466
467
  width?: string | number | undefined;
467
468
  height?: string | number | undefined;
468
- logoUrl?: string | undefined;
469
469
  customCSS?: string | undefined;
470
470
  } | undefined;
471
471
  }, {
@@ -487,6 +487,7 @@ export declare const DuctConfigSchema: z.ZodObject<{
487
487
  apiBaseUrl?: string | undefined;
488
488
  locale?: string | undefined;
489
489
  industry?: string | undefined;
490
+ logoUrl?: string | undefined;
490
491
  };
491
492
  agentPermissions: {
492
493
  defaultLevel: "none" | "read" | "write" | "admin";
@@ -572,7 +573,6 @@ export declare const DuctConfigSchema: z.ZodObject<{
572
573
  theme?: "light" | "dark" | "system" | undefined;
573
574
  width?: string | number | undefined;
574
575
  height?: string | number | undefined;
575
- logoUrl?: string | undefined;
576
576
  customCSS?: string | undefined;
577
577
  } | undefined;
578
578
  registry_visibility?: "public" | "private" | undefined;
@@ -152,7 +152,6 @@ const WidgetConfigSchema = z.object({
152
152
  theme: z.enum(["light", "dark", "system"]).optional(),
153
153
  width: z.union([z.number(), z.string()]).optional(),
154
154
  height: z.union([z.number(), z.string()]).optional(),
155
- logoUrl: z.string().optional(),
156
155
  customCSS: z.string().optional(),
157
156
  });
158
157
  const ProductConfigSchema = z.object({
@@ -162,6 +161,7 @@ const ProductConfigSchema = z.object({
162
161
  apiBaseUrl: z.string().url().optional(),
163
162
  locale: z.string().optional(),
164
163
  industry: z.string().optional(),
164
+ logoUrl: z.string().url().optional(),
165
165
  });
166
166
  export const DuctConfigSchema = z.object({
167
167
  shellId: z
@@ -295,8 +295,6 @@ export interface WidgetConfig {
295
295
  width?: number | string;
296
296
  /** iframe height — default: 620. Ignored when `preset` is set. */
297
297
  height?: number | string;
298
- /** URL to your product logo (shown in empty state) */
299
- logoUrl?: string;
300
298
  /**
301
299
  * Number of conversation turns after which context is compacted into a summary.
302
300
  * Lower = cheaper (less history sent to LLM). Default: 8.
@@ -328,6 +326,8 @@ export interface ProductConfig {
328
326
  locale?: string;
329
327
  /** Industry/category for the product */
330
328
  industry?: string;
329
+ /** HTTPS URL to your product logo (shown in the open shell header) */
330
+ logoUrl?: string;
331
331
  }
332
332
  /**
333
333
  * Structured data describing what the user is currently viewing on the page.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duct-sdk/sdk",
3
- "version": "0.4.2",
3
+ "version": "0.4.4",
4
4
  "type": "module",
5
5
  "description": "Duct SDK — A shell (like terminal) that knows when to talk, when to show, and when to hand off.",
6
6
  "main": "dist/index.js",