@touchcastllc/napster-companion-api-dev 1.6.0-alpha.4 → 1.6.0-alpha.6

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.
@@ -0,0 +1,2 @@
1
+ export type { Transport } from "./types";
2
+ export { createWebRtcTransport } from "./webrtcTransport";
@@ -0,0 +1,25 @@
1
+ import type { DataChannelCommand } from "../../types";
2
+ /**
3
+ * The control plane of a session: the channel that carries client commands.
4
+ *
5
+ * Deliberately narrow. It knows nothing about media and nothing about how a
6
+ * session is established — WebRTC implements it over an RTCDataChannel, and a
7
+ * WebSocket session will implement it over the socket itself, carrying the
8
+ * identical command payloads.
9
+ *
10
+ * Session policy (e.g. `stopInteraction`) lives in `sendCommand`, NOT here, so
11
+ * a future implementation cannot forget to honour it.
12
+ *
13
+ * Ownership: whoever creates a transport owns its lifecycle and is responsible
14
+ * for clearing the store slot (`setTransport(null)`) when the underlying
15
+ * connection closes. An implementation must not register its own close handler
16
+ * to do that — it would compete with the owner's.
17
+ */
18
+ export interface Transport {
19
+ /** Send a command. Returns false when the channel cannot carry it. */
20
+ send(command: DataChannelCommand): boolean;
21
+ /** Whether the control channel is ready to accept commands. */
22
+ isOpen(): boolean;
23
+ /** Close the control channel. */
24
+ close(): void;
25
+ }
@@ -0,0 +1,12 @@
1
+ import type { Transport } from "./types";
2
+ /**
3
+ * Wrap an RTCDataChannel as a {@link Transport}.
4
+ *
5
+ * Framing belongs to the transport, not the caller: a WebSocket session may
6
+ * need a different envelope, and callers should not know which one they are on.
7
+ *
8
+ * The adapter deliberately attaches no event handlers — the WebRTC controller
9
+ * owns the channel's lifecycle and clears the store slot from its own
10
+ * `onclose`. See the spec's "Lifecycle and ownership" section.
11
+ */
12
+ export declare function createWebRtcTransport(dc: RTCDataChannel): Transport;
@@ -2,5 +2,5 @@ export { store } from "./store";
2
2
  export type { RootState } from "./store";
3
3
  export { setOnFeaturesUpdateCallback } from "./middleware/featuresUpdateMiddleware";
4
4
  export * from "./selectors";
5
- export { setSessionId, setDataChannel, setStopInteraction, setMuted, setAutoMicActive, setVolume, setAvatarSpeaking, setScreenSharing, setUserTalking, setConnectionToken, setCloseConnectionHandler, setSessionTerminatedByServer, resetAvatar, } from "./slices/avatarSlice";
5
+ export { setSessionId, setTransport, setStopInteraction, setMuted, setAutoMicActive, setVolume, setAvatarSpeaking, setScreenSharing, setUserTalking, setConnectionToken, setCloseConnectionHandler, setSessionTerminatedByServer, resetAvatar, } from "./slices/avatarSlice";
6
6
  export { setFeatures, resetFeatures, setDebugMode } from "./slices/appSlice";
@@ -1,10 +1,11 @@
1
1
  import { RootState } from "./index";
2
2
  import { FeatureConfig } from "../types";
3
+ import type { Transport } from "../services/transport";
3
4
  /**
4
5
  * Avatar state selectors
5
6
  */
6
7
  export declare const selectSessionId: (state: RootState) => string | undefined;
7
- export declare const selectDataChannel: (state: RootState) => RTCDataChannel | null;
8
+ export declare const selectTransport: (state: RootState) => Transport | null;
8
9
  export declare const selectMuted: (state: RootState) => boolean;
9
10
  export declare const selectAutoMicActive: (state: RootState) => boolean;
10
11
  export declare const selectAvatarSpeaking: (state: RootState) => boolean;
@@ -1,6 +1,7 @@
1
+ import type { Transport } from "../../services/transport";
1
2
  export interface AvatarState {
2
3
  sessionId?: string;
3
- dataChannel: RTCDataChannel | null;
4
+ transport: Transport | null;
4
5
  stopInteraction: boolean;
5
6
  muted: boolean;
6
7
  autoMicActive: boolean;
@@ -12,5 +13,5 @@ export interface AvatarState {
12
13
  closeConnectionHandler?: () => void;
13
14
  sessionTerminatedByServer: boolean;
14
15
  }
15
- export declare const setSessionId: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, "avatar/setSessionId">, setDataChannel: import("@reduxjs/toolkit").ActionCreatorWithPayload<RTCDataChannel | null, "avatar/setDataChannel">, setStopInteraction: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setStopInteraction">, setMuted: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setMuted">, setAutoMicActive: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setAutoMicActive">, setVolume: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, "avatar/setVolume">, setAvatarSpeaking: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setAvatarSpeaking">, setScreenSharing: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setScreenSharing">, setUserTalking: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setUserTalking">, setConnectionToken: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, "avatar/setConnectionToken">, setCloseConnectionHandler: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<(() => void) | undefined, "avatar/setCloseConnectionHandler">, setSessionTerminatedByServer: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setSessionTerminatedByServer">, resetAvatar: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"avatar/resetAvatar">;
16
+ export declare const setSessionId: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, "avatar/setSessionId">, setTransport: import("@reduxjs/toolkit").ActionCreatorWithPayload<Transport | null, "avatar/setTransport">, setStopInteraction: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setStopInteraction">, setMuted: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setMuted">, setAutoMicActive: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setAutoMicActive">, setVolume: import("@reduxjs/toolkit").ActionCreatorWithPayload<number, "avatar/setVolume">, setAvatarSpeaking: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setAvatarSpeaking">, setScreenSharing: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setScreenSharing">, setUserTalking: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setUserTalking">, setConnectionToken: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<string | undefined, "avatar/setConnectionToken">, setCloseConnectionHandler: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<(() => void) | undefined, "avatar/setCloseConnectionHandler">, setSessionTerminatedByServer: import("@reduxjs/toolkit").ActionCreatorWithPayload<boolean, "avatar/setSessionTerminatedByServer">, resetAvatar: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"avatar/resetAvatar">;
16
17
  export declare const avatarReducer: import("redux").Reducer<AvatarState>;
@@ -21,20 +21,20 @@ export declare function cn(...inputs: ClassInput[]): string;
21
21
  */
22
22
  export declare const ControlClasses: {
23
23
  readonly icon: "np_companion-action-btn-container-icon";
24
+ /** Shared control-bar button. Presentation lives in ControlBar.css. */
25
+ readonly controlButton: "np_companion-ctl-btn";
26
+ /** Mic modifier — the one filled, borderless control in the designs. */
27
+ readonly controlButtonMic: "np_companion-ctl-btn--mic";
24
28
  readonly persistFillColor: "np_companion-persist-fill-color";
25
29
  readonly alignMiddle: "np_companion-align-middle";
26
- readonly alignBetween: "np_companion-align-between";
27
30
  readonly darkGreyBg: "np_companion-dark-grey-bg";
28
31
  readonly callEnd: "np_companion-action-btn-container-call-end";
29
32
  readonly container: "np_companion-action-btn-container-container";
30
33
  readonly wrapper: "np_companion-action-btn-container-wrapper";
31
34
  readonly controls: "np_companion-action-btn-container-controls";
32
- readonly left: "np_companion-action-btn-container-left";
33
- readonly right: "np_companion-action-btn-container-right";
34
35
  readonly stop: "np_companion-action-btn-container-stop";
35
36
  readonly questionBar: "np_companion-chat-question-bar-container";
36
- readonly talking: "np_companion-talking";
37
- readonly muted: "muted";
37
+ readonly muted: "np_companion-muted";
38
38
  readonly hidden: "np_companion-hidden";
39
39
  readonly expanded: "np_companion-action-btn-container-expanded";
40
40
  readonly collapse: "np_companion-action-btn-container-collapse";
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Control-bar glyphs, exported from the Web Agent designs.
3
+ *
4
+ * Figma page `Web Agent [Jul 29]` (80:556). A 28x28 stroke set — the SDK's
5
+ * previous glyphs were filled shapes on assorted viewBoxes (16, 17, 21, 640),
6
+ * which is why they read heavier and inconsistent against the designs.
7
+ *
8
+ * Path data is generated from the exported SVGs. Do not hand-edit: regenerate
9
+ * from Figma so the code cannot drift from the source.
10
+ */
11
+ export interface FigmaIcon {
12
+ /** Path `d` attribute, verbatim from the export. */
13
+ d: string;
14
+ /** Stroke width in viewBox units. */
15
+ strokeWidth: string;
16
+ /** Figma node id of the source component. */
17
+ nodeId: string;
18
+ }
19
+ /** Every glyph in the set shares this viewBox. */
20
+ export declare const ICON_VIEW_BOX = "0 0 28 28";
21
+ export declare const FigmaIcons: {
22
+ /** `microphone` — Figma 104:40. */
23
+ readonly microphone: FigmaIcon;
24
+ /** `microphone-off` — Figma 104:42. */
25
+ readonly microphoneOff: FigmaIcon;
26
+ /** `volume-max` — Figma 104:38. */
27
+ readonly volumeMax: FigmaIcon;
28
+ /** `volume-x` — Figma 104:46. */
29
+ readonly volumeX: FigmaIcon;
30
+ /** `phone-x` — Figma 104:44. */
31
+ readonly phoneX: FigmaIcon;
32
+ };
@@ -26,7 +26,12 @@ export declare const ControlIcons: {
26
26
  micUnmuted(): SVGSVGElement;
27
27
  micMuted(): SVGSVGElement;
28
28
  stop(): SVGSVGElement;
29
- volumeHigh(level: number): SVGSVGElement;
29
+ /**
30
+ * The control is a mute toggle — there is no level slider — so the designs
31
+ * provide a single "sound on" glyph. `level` is kept for compatibility and
32
+ * does not change the icon.
33
+ */
34
+ volumeHigh(_level?: number): SVGSVGElement;
30
35
  volumeMuted(): SVGSVGElement;
31
36
  screenShare(): SVGSVGElement;
32
37
  screenShareActive(): SVGSVGElement;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@touchcastllc/napster-companion-api-dev",
3
- "version": "1.6.0-alpha.4",
3
+ "version": "1.6.0-alpha.6",
4
4
  "keywords": [
5
5
  "napster",
6
6
  "companion-api",
@@ -1,2 +0,0 @@
1
- export declare const BASE_BUTTON_STYLE: Partial<CSSStyleDeclaration>;
2
- export declare const TALKING_STYLE: Partial<CSSStyleDeclaration>;