@pi-outpost/embed 0.17.1 → 0.18.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/README.md CHANGED
@@ -30,6 +30,7 @@ const widget = mount(document.getElementById("assistant"), {
30
30
  serverUrl: "https://your-pi-outpost-server", // omit for same-origin
31
31
  theme: "dark", // optional; falls back to the server's branding.defaultTheme, then "system"
32
32
  token: "…", // only for servers with `server.token` set
33
+ workspace: "/srv/projects/example", // optional resolved root of an already-open project
33
34
  });
34
35
 
35
36
  widget.setTheme("light"); // change the theme at runtime
@@ -38,6 +39,10 @@ widget.unmount(); // tear down the React tree
38
39
 
39
40
  `mount(container, options?)` returns `{ unmount(), setTheme(theme) }`. The container itself stays in the DOM after `unmount()`, with an empty shadow root.
40
41
 
42
+ When `workspace` is set, the host binds that widget to the named open project and the widget
43
+ offers no project switcher. If the root is not open, the server falls back to its default
44
+ project rather than leaving the widget disconnected.
45
+
41
46
  ### Which theme wins
42
47
 
43
48
  Strongest first:
@@ -67,6 +72,10 @@ In Next.js, the component doing this must be a client component (`"use client"`)
67
72
  Configure this on the pi-outpost server, whatever the deployment topology:
68
73
 
69
74
  - **`server.allowedOrigins`** — the widget carries the *host page's* origin (e.g. `https://your-app.example.com`), not pi-outpost's own. Add it explicitly; even same-domain deployments need this (only `localhost`/`127.0.0.1` are trusted automatically). Listing it is all a cross-origin mount needs: the server answers those origins with the CORS headers the browser requires on every HTTP route, and applies the same allowlist to the WebSocket handshake. It grants no authority of its own — a token-protected route still wants its token.
75
+ - **`embed.workspaceControls`** — when the host does not pass `workspace`, choose what the
76
+ widget exposes: `"settings"` (the one-project default), `"root"` (a compact root chooser)
77
+ or `"projects"` (open/switch/close controls). `workspaceLock` still overrides this and
78
+ pins the deployment to one project.
70
79
 
71
80
  ## License
72
81