@sable-ai/sdk-core 0.1.3 → 0.1.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/README.md CHANGED
@@ -1,26 +1,57 @@
1
1
  # @sable-ai/sdk-core
2
2
 
3
- v0 browser runtime for Sable: joins a LiveKit room and lets the user talk to an
4
- agent worker. Voice-only. No DOM tools, no UI overlay, no events API.
3
+ Browser runtime for Sable: joins a LiveKit room and lets users talk to an
4
+ agent worker with optional vision + browser-bridge tools. Ships as a
5
+ Stripe.js-style split bundle:
6
+
7
+ | File | Size (gzipped) | When it loads |
8
+ | --- | --- | --- |
9
+ | `sable.js` (loader) | **~530 B** | Page load |
10
+ | `sable-core.mjs` (full SDK, livekit inlined) | ~150 KB | First `Sable.start()` call |
11
+
12
+ Pages that never open a session pay only the loader cost.
5
13
 
6
14
  ## Install
7
15
 
16
+ ### Script tag (recommended for no-build sites + extensions)
17
+
18
+ ```html
19
+ <script src="https://sdk.withsable.com/v0.1.4/sable.js"></script>
20
+ ```
21
+
22
+ The loader installs `window.Sable` synchronously. On the first
23
+ `Sable.start()` call it lazy-imports `sable-core.mjs` from the same CDN
24
+ path and forwards the call.
25
+
26
+ Available CDN pins:
27
+
28
+ | Path | Cache | Use case |
29
+ | --- | --- | --- |
30
+ | `https://sdk.withsable.com/v0.1.4/sable.js` | 1 year, immutable | **Recommended for production** — exact version pin |
31
+ | `https://sdk.withsable.com/v1/sable.js` | 1 hour | Latest 0.x (accepts patch releases automatically) |
32
+ | `https://sdk.withsable.com/latest/sable.js` | 5 minutes | Demos and smoke tests only |
33
+
34
+ ### npm (ESM)
35
+
8
36
  ```bash
9
37
  bun add @sable-ai/sdk-core
10
38
  ```
11
39
 
12
- Or include the IIFE bundle directly:
13
-
14
- ```html
15
- <script src="./sable.iife.js"></script>
40
+ ```js
41
+ import Sable from "@sable-ai/sdk-core";
42
+ // Importing also installs window.Sable (first-write-wins), so mixed
43
+ // script-tag + npm usage on the same page stays coherent.
16
44
  ```
17
45
 
46
+ The npm build keeps `livekit-client` as an external peer so your bundler
47
+ can dedupe it.
48
+
18
49
  ## Usage
19
50
 
20
51
  ```js
21
52
  await window.Sable.start({
22
53
  agentPublicId: "agt_...",
23
- apiUrl: "https://sable-api-gateway-9dfmhij9.wl.gateway.dev", // optional, this is the default
54
+ apiUrl: "https://sable-api-gateway-9dfmhij9.wl.gateway.dev", // optional, default
24
55
  nickelRegion: "us-east1", // optional
25
56
  });
26
57
 
@@ -29,7 +60,25 @@ await window.Sable.start({
29
60
  await window.Sable.stop();
30
61
  ```
31
62
 
32
- ## Local test
63
+ `Sable.on(event, handler)` subscriptions registered before `start()`
64
+ resolves are buffered by the loader and flushed onto the real session
65
+ once `sable-core.mjs` finishes loading.
66
+
67
+ ## Architecture
68
+
69
+ The loader is a tiny IIFE proxy (`src/loader.ts`) that:
70
+
71
+ 1. Captures `document.currentScript.src` synchronously at top-level
72
+ (the only time `currentScript` is defined).
73
+ 2. Installs `window.Sable` with stub `start/stop/on` methods.
74
+ 3. On first `start()`, resolves `new URL("./sable-core.mjs", scriptSrc)`
75
+ and dynamically imports it — so `/v0.1.4/sable.js` always pulls
76
+ `/v0.1.4/sable-core.mjs`. Version cohesion is automatic.
77
+ 4. Memoises the import and flushes any queued `on()` subscriptions.
78
+
79
+ See `docs/superpowers/specs/` and `infra/cdn/README.md` for more.
80
+
81
+ ## Local development
33
82
 
34
83
  ```bash
35
84
  bun install
@@ -37,19 +86,20 @@ bun run --filter @sable-ai/sdk-core build
37
86
  python3 -m http.server 5173 --directory packages/sdk-core
38
87
  ```
39
88
 
40
- Open `http://localhost:5173/examples/test.html`, paste an agent public ID, click Start.
41
- Grant mic permission when prompted. Observe the console for LiveKit session
42
- events.
89
+ Open `http://localhost:5173/examples/test.html`, paste an agent public
90
+ ID, click Start. Grant mic permission when prompted.
91
+
92
+ **Only `http://localhost:*` origins work against the hosted API** —
93
+ `sable-api`'s CORS policy does not yet allow arbitrary origins.
43
94
 
44
- **Only `http://localhost:*` origins work in v0** — `sable-api`'s CORS policy
45
- does not yet allow arbitrary origins. See the v0 spec at
46
- `docs/superpowers/specs/2026-04-07-sdk-voice-integration-design.md` for the
47
- deferred per-org allowed-origins work.
95
+ ## Releasing
48
96
 
49
- ## Known limitations (v0)
97
+ Tagging `sdk-core-v<x.y.z>` triggers `.github/workflows/release-sdk-core.yml`
98
+ which:
50
99
 
51
- - Voice only. No DOM tools, no actions, no wireframe.
52
- - Bundle is ~1 MB unminified because `livekit-client` is inlined into the IIFE.
53
- - No session persistence across navigations.
54
- - No push-to-talk; the mic stays open for the whole session.
55
- - Errors from `start()` propagate; callers must catch and display them.
100
+ 1. Runs typecheck + tests + build.
101
+ 2. Publishes to npm with OIDC trusted-publisher provenance.
102
+ 3. Stages `dist/sable.iife.js` + `dist/sable-core.mjs` under
103
+ `/v<version>/`, `/v1/`, and `/latest/` via `infra/cdn/stage.sh`.
104
+ 4. Deploys the staged directory to Cloudflare Pages
105
+ (`sable-sdk-cdn` project, custom domain `sdk.withsable.com`).
package/dist/esm/index.js CHANGED
@@ -2027,7 +2027,7 @@ async function startVision(args) {
2027
2027
  }
2028
2028
 
2029
2029
  // src/version.ts
2030
- var VERSION = "0.1.3";
2030
+ var VERSION = "0.1.4";
2031
2031
 
2032
2032
  // src/session/debug-panel.ts
2033
2033
  var DEBUG_PANEL_STATE_KEY = "sable:debug:panel";