@pouchy_ai/companion-sdk 0.29.1 → 0.32.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.
Files changed (58) hide show
  1. package/CHANGELOG.md +117 -1
  2. package/README.md +65 -4
  3. package/dist/adapter-core.d.ts +58 -0
  4. package/dist/adapter-core.d.ts.map +1 -0
  5. package/dist/adapter-core.js +126 -0
  6. package/dist/adapter-core.js.map +1 -0
  7. package/dist/call.d.ts +1 -0
  8. package/dist/call.d.ts.map +1 -0
  9. package/dist/call.js +1 -0
  10. package/dist/call.js.map +1 -0
  11. package/dist/client.d.ts +91 -5
  12. package/dist/client.d.ts.map +1 -0
  13. package/dist/client.js +138 -14
  14. package/dist/client.js.map +1 -0
  15. package/dist/errors.d.ts +15 -1
  16. package/dist/errors.d.ts.map +1 -0
  17. package/dist/errors.js +8 -0
  18. package/dist/errors.js.map +1 -0
  19. package/dist/index.d.ts +9 -5
  20. package/dist/index.d.ts.map +1 -0
  21. package/dist/index.js +8 -1
  22. package/dist/index.js.map +1 -0
  23. package/dist/protocol.d.ts +58 -0
  24. package/dist/protocol.d.ts.map +1 -0
  25. package/dist/protocol.js +12 -0
  26. package/dist/protocol.js.map +1 -0
  27. package/dist/scopes.d.ts +1 -0
  28. package/dist/scopes.d.ts.map +1 -0
  29. package/dist/scopes.js +1 -0
  30. package/dist/scopes.js.map +1 -0
  31. package/dist/sse.d.ts +1 -0
  32. package/dist/sse.d.ts.map +1 -0
  33. package/dist/sse.js +1 -0
  34. package/dist/sse.js.map +1 -0
  35. package/dist/svelte.d.ts +16 -0
  36. package/dist/svelte.d.ts.map +1 -0
  37. package/dist/svelte.js +25 -0
  38. package/dist/svelte.js.map +1 -0
  39. package/dist/vue.d.ts +15 -0
  40. package/dist/vue.d.ts.map +1 -0
  41. package/dist/vue.js +27 -0
  42. package/dist/vue.js.map +1 -0
  43. package/dist/ws-transport.d.ts +1 -0
  44. package/dist/ws-transport.d.ts.map +1 -0
  45. package/dist/ws-transport.js +1 -0
  46. package/dist/ws-transport.js.map +1 -0
  47. package/package.json +24 -6
  48. package/src/adapter-core.ts +193 -0
  49. package/src/call.ts +699 -0
  50. package/src/client.ts +1959 -0
  51. package/src/errors.ts +77 -0
  52. package/src/index.ts +104 -0
  53. package/src/protocol.ts +316 -0
  54. package/src/scopes.ts +94 -0
  55. package/src/sse.ts +41 -0
  56. package/src/svelte.ts +47 -0
  57. package/src/vue.ts +46 -0
  58. package/src/ws-transport.ts +70 -0
package/CHANGELOG.md CHANGED
@@ -12,6 +12,119 @@ a protocol bump is always called out explicitly here.
12
12
 
13
13
  ## [Unreleased]
14
14
 
15
+ ## [0.32.0] - 2026-07-14
16
+
17
+ No breaking changes — additive surface + docs infrastructure. No protocol
18
+ change (`PROTOCOL_VERSION` stays `1`).
19
+
20
+ ### Added
21
+
22
+ - **`debug` instrumentation option.** `createCompanion({ debug: true })` logs
23
+ structured events via `console.debug('[pouchy-sdk]', …)`; passing a function
24
+ receives every `CompanionDebugEvent` (new exported type) for your own
25
+ logger / devtools / test recorder:
26
+ - `request` / `response` — every authed HTTP call with method, path,
27
+ status, and wall-clock `ms` (including the post-401-refresh retry leg);
28
+ - `envelope` — each DELIVERED stream envelope (type + id), post-dedup, so
29
+ replay collapses are visible by omission;
30
+ - `stream` — receive-stream lifecycle transitions (state + prev);
31
+ - `error` — synthesized transport failures (message, code, status).
32
+ Events never carry the token, headers, or bodies — safe to pipe anywhere.
33
+ A throwing sink is isolated (it can never break the request it observes).
34
+ Zero cost when unset.
35
+
36
+ ### Docs
37
+
38
+ - **README example code is now compiled in CI.** Every ```` ```ts ```` block
39
+ in both READMEs typechecks against the real SDK source
40
+ (docs-snippets.test.ts) — a renamed method or changed option shape in
41
+ example prose now fails the build instead of shipping as broken copy-paste.
42
+ - **Generated full API reference.** TypeDoc renders the complete per-symbol
43
+ reference from source JSDoc to `pouchy.ai/sdk-api/` at build time (never
44
+ committed, can't drift); the /sdk page header links to it.
45
+
46
+ ## [0.31.0] - 2026-07-14
47
+
48
+ No breaking changes — additive surface + packaging/distribution engineering.
49
+ No protocol change (`PROTOCOL_VERSION` stays `1`).
50
+
51
+ ### Added
52
+
53
+ - **Framework adapters** as subpath exports — thin bindings over one shared,
54
+ fully-tested view controller (`createCompanionView`, also exported from the
55
+ root for hosts on other frameworks). React already has its own richer
56
+ package (`@pouchy_ai/react` — Provider-owned lifecycle + voice-call hook);
57
+ these bring Svelte and Vue to parity with it:
58
+ - `@pouchy_ai/companion-sdk/svelte` — `companionStore(client)`, a
59
+ hand-rolled Svelte store contract (no `svelte` import — works Svelte 3→5).
60
+ - `@pouchy_ai/companion-sdk/vue` — `useCompanion(client)` returning a
61
+ `shallowRef` snapshot; auto-disposes with the effect scope.
62
+ The view tracks `{ streamState, transcript, draft, typing, pendingConfirms }`
63
+ with immutable snapshots, wraps `sendText`/`confirmAction` (optimistic user
64
+ turn; confirm-card bookkeeping incl. the retryable exec_failed re-approve
65
+ semantic), and can restore recent history on creation (`restore: N`, the
66
+ `useMessages` semantic). The HOST owns the client lifecycle — adapters only
67
+ observe. New peer dep `vue` is optional; core stays dependency-free.
68
+ - **Version-pinned CDN with SRI.** `npm run build:cdn` now also emits
69
+ `cdn/companion-sdk.min.js` (~10KB gzip vs ~22KB), a version archive under
70
+ `cdn/versions/<version>/` served immutable at
71
+ `https://pouchy.ai/sdk/v<version>/companion-sdk{,.min}.js`, and
72
+ `cdn/integrity.json` (sha384 SRI hashes, published on the /sdk page) — so
73
+ an integrator can pin an exact release + integrity hash instead of riding
74
+ silent upgrades of the floating URL.
75
+ - **Go-to-definition into real source.** The published package now ships
76
+ `src/` plus `declarationMap`/`sourceMap` (rewritten to resolve in-package),
77
+ so editors jump from `useCompanion(...)` to the commented TypeScript, not a
78
+ bare `.d.ts`.
79
+
80
+ ### Changed
81
+
82
+ - **CDN bundle size is now a CI budget** (gzip: min ≤ 14KB, full ≤ 29KB, ~30%
83
+ headroom over current). A legitimate feature that exceeds it must raise the
84
+ budget consciously in the same PR and say so here.
85
+
86
+ ## [0.30.0] - 2026-07-12
87
+
88
+ No breaking changes despite the minor bump — everything here is additive
89
+ surface (which this repo's house policy ships as `0.x.0`).
90
+
91
+ ### Added
92
+
93
+ - **Typed `control.error` code vocabulary.** New runtime export
94
+ `CONTROL_ERROR_CODES` — the server-emitted stream-plane codes
95
+ (`agent_error`, `call_mint_failed`) — plus the types `ControlErrorCode`,
96
+ `ControlErrorPayload`, and the open union `ControlErrorCodeValue` (server
97
+ codes + the SDK-synthesized `stream_unauthorized` + a forward-compat string
98
+ arm, same doctrine as `CompanionErrorCodeValue`). `onError`'s handler now
99
+ sees `code: ControlErrorCodeValue` instead of a bare `string`, so a `switch`
100
+ on it autocompletes. Drift-tested two ways: the SDK list must equal the
101
+ server list, AND every `control.error` emit site's code literal (server and
102
+ SDK) must be declared — a new site inventing a code fails CI.
103
+ - **`on()` narrows the envelope payload per event name.** New
104
+ `OutboundPayloadMap` + a generic overload:
105
+ `on('companion.typing', (env) => env.payload.active)` type-checks without a
106
+ cast; `on('*')` keeps the untyped envelope. Type-only — zero runtime change.
107
+ New wire-payload types exported along the way: `HelloAckPayload`,
108
+ `CallReadyPayload`, `ControlErrorPayload`.
109
+ - **Stream-state observability.** `client.streamState` +
110
+ `onStreamStateChange((state, prev) => …)` with
111
+ `'idle' | 'connecting' | 'connected' | 'reconnecting' | 'degraded_sse' |
112
+ 'stopped'` (`CompanionStreamState`) — including the previously invisible
113
+ WebSocket→SSE degrade (`degraded_sse`) and the permanent-401/403 stop. Hosts
114
+ no longer hand-roll a connection enum around `onMessage` traffic.
115
+
116
+ ### Fixed
117
+
118
+ - **Reconnect backoff now carries jitter (additive, 0–25%)** in both the SSE
119
+ and WebSocket receive loops, so a fleet of embeds doesn't reconnect in
120
+ lockstep after a server deploy/restart (thundering herd).
121
+ - **`Retry-After` HTTP-date form is parsed.** RFC 9110 allows a date form
122
+ (proxies/CDNs emit it); it used to read as `undefined`. Delta-seconds still
123
+ win; a date converts to a non-negative seconds delta.
124
+ - **The streaming `sendText` leg keeps the 429 body `hint`.** The non-SSE
125
+ error fallback dropped the actionable hint (e.g. "provision a project …")
126
+ that the buffered path has surfaced since 0.27.0.
127
+
15
128
  ## [0.29.1] - 2026-07-12
16
129
 
17
130
  ### Fixed
@@ -647,7 +760,10 @@ self-hosted/CDN build; this entry captures the surface that ships publicly.
647
760
  - **Versioned wire protocol.** `PROTOCOL_VERSION = 1`, kept in lockstep with the
648
761
  server by `protocol.drift.test.ts` (fails CI on divergence).
649
762
 
650
- [Unreleased]: https://github.com/oviswang/Pouchy/compare/companion-sdk-v0.29.1...HEAD
763
+ [Unreleased]: https://github.com/oviswang/Pouchy/compare/companion-sdk-v0.32.0...HEAD
764
+ [0.32.0]: https://github.com/oviswang/Pouchy/compare/companion-sdk-v0.31.0...companion-sdk-v0.32.0
765
+ [0.31.0]: https://github.com/oviswang/Pouchy/compare/companion-sdk-v0.30.0...companion-sdk-v0.31.0
766
+ [0.30.0]: https://github.com/oviswang/Pouchy/compare/companion-sdk-v0.29.1...companion-sdk-v0.30.0
651
767
  [0.29.1]: https://github.com/oviswang/Pouchy/compare/companion-sdk-v0.29.0...companion-sdk-v0.29.1
652
768
  [0.29.0]: https://github.com/oviswang/Pouchy/compare/companion-sdk-v0.28.1...companion-sdk-v0.29.0
653
769
  [0.28.1]: https://github.com/oviswang/Pouchy/compare/companion-sdk-v0.28.0...companion-sdk-v0.28.1
package/README.md CHANGED
@@ -26,6 +26,10 @@ Changes per release are tracked in [`CHANGELOG.md`](./CHANGELOG.md).
26
26
  `<CompanionProvider>` + `useCompanion` / `useMessages` / `useTyping` / `useCall`
27
27
  hooks so you don't wire the handshake, stream, or teardown yourself.
28
28
 
29
+ **Svelte / Vue?** This package ships thin adapters as subpath exports —
30
+ [`@pouchy_ai/companion-sdk/svelte`](#framework-adapters-svelte--vue) and
31
+ [`@pouchy_ai/companion-sdk/vue`](#framework-adapters-svelte--vue) (0.31.0).
32
+
29
33
  ## Quickstart
30
34
 
31
35
  Two steps. **1)** Your backend exchanges the project **Secret Key** (create one
@@ -63,9 +67,57 @@ Token as `token` instead — same API. See the docs' authentication section.)
63
67
  - **Capabilities map:** [`docs/companion-capabilities.md`](../../docs/companion-capabilities.md)
64
68
  - **Instant UI renderer contract:** [`docs/companion-instant-ui.md`](../../docs/companion-instant-ui.md)
65
69
 
70
+ ### Framework adapters (Svelte / Vue)
71
+
72
+ Thin, logic-free bindings over one shared view controller
73
+ (`createCompanionView`, also exported from the root for any other framework).
74
+ The view tracks `{ streamState, transcript, draft, typing, pendingConfirms }`
75
+ as immutable snapshots, wraps `sendText` (optimistic user turn) and
76
+ `confirmAction` (confirm-card bookkeeping), and can restore recent history
77
+ with `{ restore: N }`. **You own the client lifecycle** — create/connect/start
78
+ it once, hand it to the adapter, close it when done. React hosts: use the
79
+ richer [`@pouchy_ai/react`](../react-sdk/README.md) package instead.
80
+
81
+ ```svelte
82
+ <script>
83
+ import { companionStore } from '@pouchy_ai/companion-sdk/svelte';
84
+ const companion = companionStore(client, { restore: 20 });
85
+ </script>
86
+ {#each $companion.transcript as turn}<p>{turn.role}: {turn.text}</p>{/each}
87
+ {#if $companion.typing}<p>…</p>{/if}
88
+ <button onclick={() => companion.sendText('hey')}>send</button>
89
+ ```
90
+
91
+ ```ts
92
+ // Vue 3
93
+ import { useCompanion } from '@pouchy_ai/companion-sdk/vue';
94
+ const { snapshot, sendText } = useCompanion(client, { restore: 20 });
95
+ // snapshot.value.transcript / .draft / .streamState — auto-disposes with scope
96
+ ```
97
+
98
+ ### Constructor options (beyond `baseUrl` + `token`)
99
+
100
+ `createCompanion({ … })` also takes: `surface` (one resumable session per
101
+ surface), `modalities` / `handles` / `contextKinds` / `tools` /
102
+ `appContext` (the capability handshake), `visitor` (representative mode,
103
+ below), `onAuthError` (401 → return a fresh token and the client retries
104
+ transparently), `stream: 'sse' | 'websocket'` (receive transport —
105
+ `'websocket'` opts into the lower-latency WS plane when the deployment serves
106
+ one and **falls back to SSE automatically**, observable as
107
+ `streamState === 'degraded_sse'`), `debug` (0.32.0 — `true` logs structured
108
+ instrumentation events via `console.debug`; a function receives every
109
+ `CompanionDebugEvent`: HTTP request/response with method/path/status/ms, each
110
+ delivered envelope post-dedup, stream-state transitions, synthesized errors —
111
+ never the token, headers, or bodies), and two injection points for Node/tests:
112
+ `fetch` (custom fetch implementation) and `webSocketImpl` (WebSocket
113
+ constructor when `globalThis.WebSocket` is absent).
114
+
66
115
  ## Events
67
116
 
68
- Subscribe with `on(type, fn)` (or `'*'`), or these typed convenience helpers:
117
+ Subscribe with `on(type, fn)` (or `'*'`), or these typed convenience helpers.
118
+ Since 0.30.0 `on()` narrows the envelope payload per event name
119
+ (`OutboundPayloadMap`) — e.g. `on('companion.typing', (env) => env.payload.active)`
120
+ type-checks without a cast; `'*'` keeps the untyped envelope:
69
121
 
70
122
  | Helper | Event | Use |
71
123
  | --- | --- | --- |
@@ -82,7 +134,7 @@ Subscribe with `on(type, fn)` (or `'*'`), or these typed convenience helpers:
82
134
  | `onTyping(fn)` | `companion.typing` | activity indicator — `fn({active})` fires `true` when a turn starts working and `false` when it finishes / pauses, spanning the tool-loop / thinking phase before the first text delta. Drive a "typing…" state |
83
135
  | `on('control.call_ready', fn)` | `control.call_ready` | a voice call is ready — the stream echo of `startCall`'s accept. Deliberately **secret-free** (`{ provider, agentId/model, voice, … }` — the actual WebRTC credentials only ride the `startCall` HTTP response); useful for UI state on surfaces that didn't initiate the call |
84
136
  | `onUsage(fn)` | `control.usage` | per-token metering echo. _(reserved — not emitted yet)_ |
85
- | `onError(fn)` | `control.error` | agent / stream errors — `agent_error` (server-side turn failed after accept; safe to re-send), `call_mint_failed` (voice-credential mint failed — retry later or fall back to text) or the SDK-synthesized `stream_unauthorized` (stream 401 exhausted reconnects — refresh the token, `start()` again) |
137
+ | `onError(fn)` | `control.error` | agent / stream errors — `agent_error` (server-side turn failed after accept; safe to re-send), `call_mint_failed` (voice-credential mint failed — retry later or fall back to text) or the SDK-synthesized `stream_unauthorized` (stream 401 exhausted reconnects — refresh the token, `start()` again). Since 0.30.0 the vocabulary is EXPORTED TYPED: `CONTROL_ERROR_CODES` (runtime list, drift-tested against the server) + the `ControlErrorCodeValue` union `fn`'s `err.code` now carries — `switch` on it with autocomplete |
86
138
 
87
139
  ### Instant UI
88
140
 
@@ -112,7 +164,8 @@ local/device skills).
112
164
  | `endSession()` | Distill the session into durable memory now; returns `{ skipped?: 'no_session' \| 'no_content' \| 'throttled' }`. |
113
165
  | `close()` | One-call teardown: `stop()` + `endSession()` — the text-session mirror of the call handle's `close()`. |
114
166
  | `startCall(opts)` / `connectCall(opts)` | Voice plane: raw credentials / fully-wired call handle (`call.close()` ends + folds the transcript into memory). |
115
- | `getAvatar()` / `brandIconUrl(size?)` | The user's avatar (VRM/portrait) and the Pouchy brand icon for your UI. |
167
+ | `streamState` / `onStreamStateChange(fn)` | Receive-stream lifecycle (0.30.0): `'idle' \| 'connecting' \| 'connected' \| 'reconnecting' \| 'degraded_sse' \| 'stopped'` (`CompanionStreamState`). `fn(state, prev)` fires on change only — drive a connection indicator; `degraded_sse` = the WS transport errored and delivery continues on the SSE fallback; `stopped` = `stop()`/`close()` or a permanent `stream_unauthorized` failure. |
168
+ | `getAvatar()` / `brandIconUrl(size?)` | The user's avatar (VRM/portrait) and the Pouchy brand icon for your UI. Standalone (no client/token): `pouchyBrandIconUrl(baseUrl, size?)` derives the same URL before/without connecting. |
116
169
  | `getWallet()` | Read the instance's own wallet — `{ balances: [{ currency, amount }], totalUsd, currency }`. Read-only + receive-only; needs the `wallet.read` scope. |
117
170
 
118
171
  Tool calling beyond your own declared tools: `HOST_CONTROL_TOOLS` (universal
@@ -257,10 +310,18 @@ any `$lib` import, so this package builds with plain `tsc`:
257
310
 
258
311
  ```sh
259
312
  cd packages/companion-sdk
260
- npm run build # tsc → dist/ (ESM + .d.ts)
313
+ npm run build # tsc → dist/ (ESM + .d.ts + source/declaration maps) + src/ (shipped sources)
314
+ npm run build:cdn # cdn/companion-sdk{,.min}.js + versions/<v>/ + integrity.json (SRI)
261
315
  npm publish # public scope (publishConfig.access: "public"); runs build via prepublishOnly
262
316
  ```
263
317
 
318
+ The CDN artifacts are committed and served from pouchy.ai:
319
+ `/sdk/companion-sdk{,.min}.js` (floating, 1h cache) and
320
+ `/sdk/v<version>/companion-sdk{,.min}.js` (pinned, immutable) — pin the
321
+ versioned URL together with the sha384 hash from `cdn/integrity.json` (also
322
+ published at [pouchy.ai/sdk](https://pouchy.ai/sdk)) to opt out of silent
323
+ upgrades.
324
+
264
325
  The wire contract (`protocol.ts`) is a self-contained mirror of the server's;
265
326
  `protocol.drift.test.ts` (run by the app's vitest) fails CI if they diverge.
266
327
 
@@ -0,0 +1,58 @@
1
+ import type { CompanionClient } from './client.js';
2
+ import type { CompanionStreamState } from './client.js';
3
+ import type { ConfirmRequestPayload } from './protocol.js';
4
+ /** One rendered line of the conversation, in arrival order. */
5
+ export interface CompanionTranscriptEntry {
6
+ role: 'user' | 'companion';
7
+ text: string;
8
+ /** Client wall-clock ms when the entry was appended. */
9
+ at: number;
10
+ }
11
+ /** Immutable view snapshot. A new object per change — safe to hand to
12
+ * useSyncExternalStore / $state / shallowRef without defensive copies. */
13
+ export interface CompanionViewSnapshot {
14
+ streamState: CompanionStreamState;
15
+ /** Rolling transcript, oldest first, capped at `transcriptCap`. */
16
+ transcript: readonly CompanionTranscriptEntry[];
17
+ /** The in-flight streamed reply (token deltas), '' when none. */
18
+ draft: string;
19
+ typing: boolean;
20
+ /** Confirm requests that arrived on the stream and haven't been resolved
21
+ * through this view yet. Rebuild after a reload via client.pendingConfirms()
22
+ * — confirm_request events are not replayed. */
23
+ pendingConfirms: readonly ConfirmRequestPayload[];
24
+ }
25
+ export interface CompanionViewOptions {
26
+ /** Max transcript entries kept (oldest dropped). Default 200. */
27
+ transcriptCap?: number;
28
+ /** Restore up to this many recent turns from `client.history()` on
29
+ * creation, so a reloaded tab isn't blank (same semantic as
30
+ * `@pouchy_ai/react`'s useMessages). Requires a connected client (a
31
+ * session must exist). Restored turns land ONLY while the live transcript
32
+ * is still empty — they never clobber messages that arrived first.
33
+ * Default 0 (off). */
34
+ restore?: number;
35
+ }
36
+ export interface CompanionView {
37
+ /** Stable-reference snapshot (useSyncExternalStore contract). */
38
+ getSnapshot(): CompanionViewSnapshot;
39
+ /** Subscribe to snapshot changes. Returns unsubscribe. */
40
+ subscribe(listener: () => void): () => void;
41
+ /** sendText that also appends the user turn to the transcript. */
42
+ sendText(text: string, opts?: Parameters<CompanionClient['sendText']>[1]): ReturnType<CompanionClient['sendText']>;
43
+ /** confirmAction that also removes the confirm from `pendingConfirms`
44
+ * (on approve AND deny — both resolve the card server-side). */
45
+ confirmAction(confirmId: string, approve: boolean, opts?: {
46
+ signal?: AbortSignal;
47
+ }): ReturnType<CompanionClient['confirmAction']>;
48
+ /** Detach every client subscription. The view goes inert (snapshot frozen,
49
+ * listeners dropped); the client itself is NOT closed — it belongs to the
50
+ * host. Idempotent. */
51
+ dispose(): void;
52
+ /** The underlying client, for everything the view doesn't wrap. */
53
+ readonly client: CompanionClient;
54
+ }
55
+ /** Wire a client into an immutable-snapshot view. Adapters bind this to their
56
+ * framework; hosts using none of the adapters can consume it directly. */
57
+ export declare function createCompanionView(client: CompanionClient, opts?: CompanionViewOptions): CompanionView;
58
+ //# sourceMappingURL=adapter-core.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter-core.d.ts","sourceRoot":"","sources":["../src/adapter-core.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,KAAK,EAAE,qBAAqB,EAAiB,MAAM,YAAY,CAAC;AAEvE,+DAA+D;AAC/D,MAAM,WAAW,wBAAwB;IACxC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;I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 +1,126 @@
1
+ // Framework-agnostic view controller behind the /svelte and /vue adapters
2
+ // (0.31.0). One place owns the subscription wiring + snapshot bookkeeping the
3
+ // adapters share, so each adapter stays a logic-free ~40-line binding to its
4
+ // framework's reactivity primitive — and THIS file is where the behavior gets
5
+ // unit-tested once instead of per-framework. (React hosts use the richer
6
+ // standalone `@pouchy_ai/react` package — Provider-owned lifecycle, voice-call
7
+ // hook — which predates this controller and keeps its own state wiring.)
8
+ //
9
+ // Contract (deliberately useSyncExternalStore-shaped, the strictest of the
10
+ // three): `getSnapshot()` returns the SAME object reference until something
11
+ // changes, and every change produces a new frozen snapshot + one listener
12
+ // sweep. Svelte's store contract and Vue's shallowRef both accept that shape
13
+ // as-is.
14
+ const DEFAULT_TRANSCRIPT_CAP = 200;
15
+ /** Wire a client into an immutable-snapshot view. Adapters bind this to their
16
+ * framework; hosts using none of the adapters can consume it directly. */
17
+ export function createCompanionView(client, opts) {
18
+ const cap = Math.max(1, opts?.transcriptCap ?? DEFAULT_TRANSCRIPT_CAP);
19
+ const listeners = new Set();
20
+ let disposed = false;
21
+ let snapshot = Object.freeze({
22
+ streamState: client.streamState,
23
+ transcript: Object.freeze([]),
24
+ draft: '',
25
+ typing: false,
26
+ pendingConfirms: Object.freeze([])
27
+ });
28
+ function commit(patch) {
29
+ if (disposed)
30
+ return;
31
+ snapshot = Object.freeze({ ...snapshot, ...patch });
32
+ // Snapshot-first, then notify: a listener that re-reads getSnapshot()
33
+ // synchronously must see the new value. Handler isolation matches the
34
+ // client's emit() doctrine — one throwing listener must not starve the rest.
35
+ for (const l of [...listeners]) {
36
+ try {
37
+ l();
38
+ }
39
+ catch {
40
+ /* listener errors are the listener's problem */
41
+ }
42
+ }
43
+ }
44
+ function appendTranscript(entry) {
45
+ const next = [...snapshot.transcript, entry];
46
+ commit({ transcript: Object.freeze(next.slice(-cap)) });
47
+ }
48
+ const restore = opts?.restore ?? 0;
49
+ if (restore > 0) {
50
+ void client
51
+ .history({ limit: restore })
52
+ .then((turns) => {
53
+ // Only fill a still-empty transcript — live traffic wins.
54
+ if (disposed || snapshot.transcript.length)
55
+ return;
56
+ const restored = [];
57
+ for (const t of turns) {
58
+ if (t.user)
59
+ restored.push({ role: 'user', text: t.user, at: t.ts });
60
+ if (t.assistant)
61
+ restored.push({ role: 'companion', text: t.assistant, at: t.ts });
62
+ }
63
+ if (restored.length)
64
+ commit({ transcript: Object.freeze(restored.slice(-cap)) });
65
+ })
66
+ .catch(() => {
67
+ /* a brand-new session has no history — fine */
68
+ });
69
+ }
70
+ const unsubs = [
71
+ client.onStreamStateChange((next) => commit({ streamState: next })),
72
+ client.onMessage((text) => {
73
+ // The authoritative full reply replaces any streamed draft; typing is
74
+ // definitionally over once the reply lands.
75
+ const next = [...snapshot.transcript, { role: 'companion', text, at: Date.now() }];
76
+ commit({
77
+ transcript: Object.freeze(next.slice(-cap)),
78
+ draft: '',
79
+ typing: false
80
+ });
81
+ }),
82
+ client.onDelta((chunk, meta) => {
83
+ commit({ draft: meta.reset ? chunk : snapshot.draft + chunk });
84
+ }),
85
+ client.onTyping((payload) => commit({ typing: !!payload.active })),
86
+ client.onConfirmRequest((payload) => {
87
+ // The stream can redeliver on reconnect replay — dedupe by confirmId.
88
+ if (snapshot.pendingConfirms.some((c) => c.confirmId === payload.confirmId))
89
+ return;
90
+ commit({ pendingConfirms: Object.freeze([...snapshot.pendingConfirms, payload]) });
91
+ })
92
+ ];
93
+ return {
94
+ client,
95
+ getSnapshot: () => snapshot,
96
+ subscribe(listener) {
97
+ listeners.add(listener);
98
+ return () => listeners.delete(listener);
99
+ },
100
+ async sendText(text, sendOpts) {
101
+ appendTranscript({ role: 'user', text, at: Date.now() });
102
+ return client.sendText(text, sendOpts);
103
+ },
104
+ async confirmAction(confirmId, approve, confirmOpts) {
105
+ const res = await client.confirmAction(confirmId, approve, confirmOpts);
106
+ // Remove on any settled resolution; exec_failed with retryable keeps the
107
+ // card — the host may re-approve the SAME confirmId (documented server
108
+ // semantic), so dropping it would strand the retry affordance.
109
+ if (!(res.status === 'exec_failed' && res.retryable)) {
110
+ commit({
111
+ pendingConfirms: Object.freeze(snapshot.pendingConfirms.filter((c) => c.confirmId !== confirmId))
112
+ });
113
+ }
114
+ return res;
115
+ },
116
+ dispose() {
117
+ if (disposed)
118
+ return;
119
+ for (const u of unsubs)
120
+ u();
121
+ listeners.clear();
122
+ disposed = true;
123
+ }
124
+ };
125
+ }
126
+ //# sourceMappingURL=adapter-core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapter-core.js","sourceRoot":"","sources":["../src/adapter-core.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,8EAA8E;AAC9E,6EAA6E;AAC7E,8EAA8E;AAC9E,yEAAyE;AACzE,+EAA+E;AAC/E,yEAAyE;AACzE,EAAE;AACF,2EAA2E;AAC3E,4EAA4E;AAC5E,0EAA0E;AAC1E,6EAA6E;AAC7E,SAAS;AAkET,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAEnC;2EAC2E;AAC3E,MAAM,UAAU,mBAAmB,CAClC,MAAuB,EACvB,IAA2B;IAE3B,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,aAAa,IAAI,sBAAsB,CAAC,CAAC;IACvE,MAAM,SAAS,GAAG,IAAI,GAAG,EAAc,CAAC;IACxC,IAAI,QAAQ,GAAG,KAAK,CAAC;IAErB,IAAI,QAAQ,GAA0B,MAAM,CAAC,MAAM,CAAC;QACnD,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAwC;QACpE,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,KAAK;QACb,eAAe,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAqC;KACtE,CAAC,CAAC;IAEH,SAAS,MAAM,CAAC,KAAqC;QACpD,IAAI,QAAQ;YAAE,OAAO;QACrB,QAAQ,GAAG,MAAM,CAAC,MAA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CAAC,MAAM,CAC7B,QAAQ,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC,CACjE;iBACD,CAAC,CAAC;YACJ,CAAC;YACD,OAAO,GAAG,CAAC;QACZ,CAAC;QACD,OAAO;YACN,IAAI,QAAQ;gBAAE,OAAO;YACrB,KAAK,MAAM,CAAC,IAAI,MAAM;gBAAE,CAAC,EAAE,CAAC;YAC5B,SAAS,CAAC,KAAK,EAAE,CAAC;YAClB,QAAQ,GAAG,IAAI,CAAC;QACjB,CAAC;KACD,CAAC;AACH,CAAC"}
package/dist/call.d.ts CHANGED
@@ -65,3 +65,4 @@ export interface CompanionCall {
65
65
  }
66
66
  /** Open a live call from pre-minted credentials. */
67
67
  export declare function openCompanionCall(creds: CallCredentials, opts?: CompanionCallOptions, bridge?: VoiceToolBridge): Promise<CompanionCall>;
68
+ //# sourceMappingURL=call.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call.d.ts","sourceRoot":"","sources":["../src/call.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAGhD;;;gFAGgF;AAChF,MAAM,WAAW,eAAe;IAC/B,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,EAAE,CAAC;IACtF,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CAC5D;AAED;;;;;;6EAM6E;AAC7E,eAAO,MAAM,kBAAkB,EAAE,eAAe,CAAC,OAAO,CAuDvD,CAAC;AAEF,qDAAqD;AACrD,eAAO,MAAM,uBAAuB,EAAE,SAAS,MAAM,EAA0C,CAAC;AAEhG;;;;;;;;;;;;uBAYuB;AACvB,eAAO,MAAM,mBAAmB,EAAE,eAAe,CAAC,OAAO,CAyDxD,CAAC;AAEF,2EAA2E;AAC3E,eAAO,MAAM,wBAAwB,EAAE,SAAS,MAAM,EAA2C,CAAC;AAElG,MAAM,WAAW,oBAAoB;IACpC,mEAAmE;IACnE,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAChC,YAAY,CAAC,EAAE,CAAC,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IACzE,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAC;IAC/B;;;;;;6DAMyD;IACzD,OAAO,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC7B,2BAA2B;IAC3B,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB;kDAC8C;IAC9C,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACrD,QAAQ,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;CACtC;AAID,oDAAoD;AACpD,wBAAsB,iBAAiB,CACtC,KAAK,EAAE,eAAe,EACtB,IAAI,GAAE,oBAAyB,EAC/B,MAAM,CAAC,EAAE,eAAe,GACtB,OAAO,CAAC,aAAa,CAAC,CAWxB"}
package/dist/call.js CHANGED
@@ -627,3 +627,4 @@ async function openConvaiCall(creds, opts, bridge) {
627
627
  }
628
628
  };
629
629
  }
630
+ //# sourceMappingURL=call.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"call.js","sourceRoot":"","sources":["../src/call.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,kFAAkF;AAClF,kFAAkF;AAClF,kDAAkD;AAClD,EAAE;A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