@duct-sdk/sdk 0.5.3 → 0.5.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
@@ -1,5 +1,10 @@
1
1
  # Changelog — @duct-sdk/sdk
2
2
 
3
+ ## [0.5.4] — 2026-07-17
4
+
5
+ ### Added
6
+ - **Host panel close (loading)** — `DuctShell` renders a close control on the panel chrome until the iframe posts `DUCT_READY`, so users can dismiss the panel while the shell is still connecting. After the shell is live, close stays inside the embedded shell UI (`DUCT_CLOSE`).
7
+
3
8
  ## [0.5.3] — 2026-07-17
4
9
 
5
10
  ### Security
package/README.md CHANGED
@@ -1,13 +1,17 @@
1
- <p align="center">
2
- <img src="./assets/duct-wordmark.svg" alt="DUCT" width="420" />
3
- </p>
1
+ ```
2
+ ██████╗ ██╗ ██╗ ╔██████ ████████╗
3
+ ██╔══██╗ ██║ ██║ ╚════╗██ ╚══██╔══╝
4
+ ██║ ██║ ██║ ██║ ║██ ██║
5
+ ██║ ██║ ██║ ██║ ║██ ██║
6
+ ██████╔╝ ╚██████╔╝ ╔██████╝ ██║
7
+ ╚═════╝ ╚═════╝ ╚═════╝ ╚═╝
8
+ ```
4
9
 
5
10
  # @duct-sdk/sdk
6
11
 
7
12
  **Let agents use your product safely.**
8
13
 
9
- [npm version](https://www.npmjs.com/package/@duct-sdk/sdk)
10
- [Node](https://www.npmjs.com/package/@duct-sdk/sdk)
14
+ [npm version](https://www.npmjs.com/package/@duct-sdk/sdk) | [Node 20+](https://nodejs.org/)
11
15
 
12
16
  The official Duct SDK and CLI. Scan your codebase, declare a manifest, push it to Duct, and embed a permissioned chat shell — so humans and AI agents call your **existing APIs** through one audited surface.
13
17
 
@@ -21,8 +25,6 @@ The official Duct SDK and CLI. Scan your codebase, declare a manifest, push it t
21
25
 
22
26
  ---
23
27
 
24
-
25
-
26
28
  ## Documentation
27
29
 
28
30
 
@@ -31,13 +33,11 @@ The official Duct SDK and CLI. Scan your codebase, declare a manifest, push it t
31
33
  | [Developer docs](https://ductai.vercel.app/docs) | Quickstart, CLI, frameworks, agents, threat model |
32
34
  | [AI integration prompt](https://ductai.vercel.app/docs/integration-prompt) | Full `DUCT_CONFIG_PROMPT.md` — copy into Cursor, Claude Code, Codex, or any agentic IDE |
33
35
  | [TOKEN_SPEC.md](./TOKEN_SPEC.md) | Token prefixes, claims, TTLs, and cross-language verify snippets |
34
- | [CHANGELOG.md](./CHANGELOG.md) | Release notes |
36
+ | [Changelog](https://ductai.vercel.app/changelog) | Platform release notes (includes SDK) |
35
37
 
36
38
 
37
39
  ---
38
40
 
39
-
40
-
41
41
  ## AI-assisted integration
42
42
 
43
43
  Duct ships a single integration prompt (`DUCT_CONFIG_PROMPT.md`) for greenfield setup or auditing an existing `duct.config.ts`. Paste it into your coding assistant with the product repo open; the agent generates or reviews manifest fields, the four wiring points, env vars, and a ship checklist.
@@ -52,8 +52,6 @@ Typical flow:
52
52
 
53
53
  ---
54
54
 
55
-
56
-
57
55
  ## Install
58
56
 
59
57
  ```bash
@@ -69,8 +67,6 @@ Global CLI (optional): `npm i -g @duct-sdk/sdk` → `duct <command>`.
69
67
 
70
68
  ---
71
69
 
72
-
73
-
74
70
  ## Quickstart
75
71
 
76
72
  **1. Create a shell** in the Duct dashboard and copy your API key.
@@ -125,8 +121,6 @@ export default function RootLayout({ children }) {
125
121
  }
126
122
  ```
127
123
 
128
-
129
-
130
124
  ### Four wiring points
131
125
 
132
126
  Duct does not replace your API. You add four integration points in **your** codebase:
@@ -144,8 +138,6 @@ Duct does not replace your API. You add four integration points in **your** code
144
138
 
145
139
  ---
146
140
 
147
-
148
-
149
141
  ## Import guide
150
142
 
151
143
  Use the **subpath** that matches your runtime. The root export pulls React adapters and will crash plain Node servers.
@@ -169,8 +161,6 @@ import { generateDuctToken, verifyDuctToken } from '@duct-sdk/sdk/server';
169
161
 
170
162
  ---
171
163
 
172
-
173
-
174
164
  ## CLI
175
165
 
176
166
 
@@ -190,8 +180,6 @@ import { generateDuctToken, verifyDuctToken } from '@duct-sdk/sdk/server';
190
180
 
191
181
  ---
192
182
 
193
-
194
-
195
183
  ## Frameworks
196
184
 
197
185
 
@@ -205,8 +193,6 @@ import { generateDuctToken, verifyDuctToken } from '@duct-sdk/sdk/server';
205
193
  | Express / Fastify / Node | `@duct-sdk/sdk/server` | — (server only) |
206
194
 
207
195
 
208
-
209
-
210
196
  ### Vite + Express
211
197
 
212
198
  ```ts
@@ -229,8 +215,6 @@ Keep secrets in server `.env` only (`DUCT_SECRET_KEY`, `DUCT_SHELL_ID`). Client
229
215
 
230
216
  ---
231
217
 
232
-
233
-
234
218
  ## Deeplinks & replay protection
235
219
 
236
220
  Declare deeplinks only for routes you have inventoried in `routes[]`. The receiver must verify signed tokens server-side — never trust raw query params.
@@ -258,16 +242,12 @@ Details: [TOKEN_SPEC.md](./TOKEN_SPEC.md).
258
242
 
259
243
  ---
260
244
 
261
-
262
-
263
245
  ## Webhooks
264
246
 
265
247
  Webhook URLs and signing secrets are configured in the **dashboard → Shell → Settings → Webhooks**, not in `duct.config.ts`. Your endpoint verifies `X-Duct-Signature` (HMAC-SHA256). Webhooks are optional for chat and actions.
266
248
 
267
249
  ---
268
250
 
269
-
270
-
271
251
  ## Security
272
252
 
273
253
  - Keep `DUCT_SECRET_KEY` server-side — never in `NEXT_PUBLIC_*`, `VITE_*`, or client bundles
@@ -277,8 +257,6 @@ Webhook URLs and signing secrets are configured in the **dashboard → Shell →
277
257
 
278
258
  ---
279
259
 
280
-
281
-
282
260
  ## Support
283
261
 
284
262
  - Docs: [ductai.vercel.app/docs](https://ductai.vercel.app/docs)
@@ -1,16 +1,16 @@
1
1
  <svg xmlns="http://www.w3.org/2000/svg" role="img" aria-label="DUCT" viewBox="0 0 380 98">
2
2
  <text
3
- fill="#B84A22"
3
+ fill="#E8622A"
4
4
  font-family="ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace"
5
5
  font-size="13"
6
6
  font-weight="700"
7
7
  xml:space="preserve"
8
8
  >
9
- <tspan x="0" y="14">██████╗ ██╗ ██╗ ╔██████ ████████╗</tspan>
10
- <tspan x="0" dy="14">██╔══██╗ ██║ ██║ ╚════╗██ ╚══██╔══╝</tspan>
11
- <tspan x="0" dy="14">██║ ██║ ██║ ██║ ║██ ██║</tspan>
12
- <tspan x="0" dy="14">██║ ██║ ██║ ██║ ║██ ██║</tspan>
13
- <tspan x="0" dy="14">██████╔╝ ╚██████╔╝ ╔██████╝ ██║</tspan>
14
- <tspan x="0" dy="14">╚═════╝ ╚═════╝ ╚═════╝ ╚═╝</tspan>
9
+ <tspan x="0" y="14">??????? ??? ??? ??????? ?????????</tspan>
10
+ <tspan x="0" dy="14">???????? ??? ??? ???????? ?????????</tspan>
11
+ <tspan x="0" dy="14">??? ??? ??? ??? ??? ???</tspan>
12
+ <tspan x="0" dy="14">??? ??? ??? ??? ??? ???</tspan>
13
+ <tspan x="0" dy="14">???????? ????????? ???????? ???</tspan>
14
+ <tspan x="0" dy="14">??????? ??????? ??????? ???</tspan>
15
15
  </text>
16
16
  </svg>
@@ -116,6 +116,34 @@ function ShellDragHandle({ onPointerDown, isDragging, isDark, label = "Drag to m
116
116
  : "0 8px 24px rgba(12,11,9,0.12)",
117
117
  }, children: label }))] }));
118
118
  }
119
+ /** Close control on the host panel chrome — visible until the iframe posts DUCT_READY. */
120
+ function ShellPanelCloseButton({ onClick, isDark, }) {
121
+ const [hovered, setHovered] = useState(false);
122
+ const color = isDark ? (hovered ? "#C4BFB8" : "#9C9790") : (hovered ? "#524E48" : "#635F59");
123
+ const bg = hovered ? (isDark ? "rgba(255,255,255,0.06)" : "rgba(12,11,9,0.06)") : "transparent";
124
+ return (_jsx("button", { type: "button", "aria-label": "Close shell", onClick: onClick, onMouseEnter: () => setHovered(true), onMouseLeave: () => setHovered(false), style: {
125
+ position: "absolute",
126
+ top: 8,
127
+ right: 8,
128
+ zIndex: 3,
129
+ width: 28,
130
+ height: 28,
131
+ padding: 0,
132
+ margin: 0,
133
+ border: "none",
134
+ borderRadius: 8,
135
+ cursor: "pointer",
136
+ display: "flex",
137
+ alignItems: "center",
138
+ justifyContent: "center",
139
+ fontSize: 18,
140
+ lineHeight: 1,
141
+ color,
142
+ background: bg,
143
+ boxShadow: "none",
144
+ transition: "color 150ms ease, background-color 150ms ease",
145
+ }, children: "\u00D7" }));
146
+ }
119
147
  function shellLayoutStorageKey(shellId) {
120
148
  return `duct-shell-pos:${shellId}`;
121
149
  }
@@ -291,6 +319,10 @@ export function DuctShell({ shellId, userContext, onTokenRequest, onNavigate, on
291
319
  // userContext is delivered via postMessage on DUCT_READY — embedding it in the
292
320
  // URL would reload the iframe whenever the host page context changes.
293
321
  const shellUrl = useMemo(() => buildShellUrl(shellHost, shellId), [shellHost, shellId]);
322
+ // Reset liveness when the embedded shell identity or URL changes.
323
+ useEffect(() => {
324
+ setIsReady(false);
325
+ }, [shellId, shellUrl]);
294
326
  const shellOrigin = (() => {
295
327
  try {
296
328
  return new URL(shellHost).origin;
@@ -778,7 +810,7 @@ export function DuctShell({ shellId, userContext, onTokenRequest, onNavigate, on
778
810
  e.currentTarget.style.transform = "scale(1.07)";
779
811
  }, onMouseLeave: (e) => {
780
812
  e.currentTarget.style.transform = "scale(1)";
781
- }, children: bubbleIcon })), _jsxs("div", { ref: panelRef, style: panelStyle, "data-duct-shell": shellId, children: [draggable && panelOpen && (_jsx(ShellDragHandle, { onPointerDown: onPanelPointerDown, isDragging: isPanelDragging, isDark: isDarkChrome, label: "Drag to move" })), _jsx("iframe", { ref: iframeRef, src: shellUrl, title: "Duct Shell", sandbox: "allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox", allow: "clipboard-write", referrerPolicy: "no-referrer-when-downgrade", style: {
813
+ }, children: bubbleIcon })), _jsxs("div", { ref: panelRef, style: panelStyle, "data-duct-shell": shellId, children: [draggable && panelOpen && (_jsx(ShellDragHandle, { onPointerDown: onPanelPointerDown, isDragging: isPanelDragging, isDark: isDarkChrome, label: "Drag to move" })), panelOpen && !isReady && (_jsx(ShellPanelCloseButton, { onClick: closePanel, isDark: isDarkChrome })), _jsx("iframe", { ref: iframeRef, src: shellUrl, title: "Duct Shell", sandbox: "allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox", allow: "clipboard-write", referrerPolicy: "no-referrer-when-downgrade", style: {
782
814
  width: "100%",
783
815
  height: "100%",
784
816
  border: "none",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@duct-sdk/sdk",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "type": "module",
5
5
  "description": "Duct SDK — manifest, CLI, and embed components for permissioned human and agent access to your product APIs.",
6
6
  "homepage": "https://ductai.vercel.app/docs",