@wix/himalaya-cli 0.1265.0 → 0.1267.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.
@@ -78,6 +78,14 @@ export interface MediaPlaybackStatus {
78
78
  bufferedMs: number;
79
79
  queue: MediaQueueItem[];
80
80
  error?: string;
81
+ /** Set when `persistPosition` resumed the current item from a natively saved position
82
+ * (no explicit `startPositionMs` was passed). Absent otherwise. */
83
+ resumedFromMs?: number;
84
+ }
85
+ /** Lock-screen / notification skip-by-seconds controls. Either side may be omitted. */
86
+ export interface MediaSkipIntervals {
87
+ forwardSec?: number;
88
+ backwardSec?: number;
81
89
  }
82
90
  export interface MediaDownloadResult {
83
91
  id: string;
@@ -102,7 +110,41 @@ export declare function setQueue(items: MediaQueueItem[], options?: {
102
110
  * RFC 0040's StreamDirective `onEvent`, for the same reason.
103
111
  */
104
112
  onStatus?: string;
113
+ /**
114
+ * Skip-by-seconds on the lock screen / Now Playing (iOS `skipForwardCommand` /
115
+ * `skipBackwardCommand`), the Android media notification + session, and on web the
116
+ * browser Media Session (`seekbackward` / `seekforward`). Unset keeps today's controls
117
+ * (iOS next/previous track; Android rewind 15 s / forward 30 s). Capped at 3600 s.
118
+ */
119
+ skipIntervals?: MediaSkipIntervals;
120
+ /** Rates offered to iOS `changePlaybackRateCommand` and the Android session's speed
121
+ * button (which shows the current rate and cycles through these). Defaults to 0.5x–2x;
122
+ * each is clamped to the capability's 0.5–3 range. Web has no lock-screen speed control. */
123
+ playbackRates?: number[];
124
+ /**
125
+ * Save the position natively per item id (every ~5 s, and on pause/stop; cleared once
126
+ * the item is >95% played), so a process kill mid-episode resumes where it stopped.
127
+ * When set and `startPositionMs` is NOT passed, loading an item resumes from the saved
128
+ * position and `status.resumedFromMs` reports it. An explicit `startPositionMs` wins.
129
+ */
130
+ persistPosition?: boolean;
131
+ /**
132
+ * With `persistPosition`: treat `startPositionMs` as a FALLBACK — the host's own saved
133
+ * position wins when it has one (it is saved natively every few seconds, so it is never
134
+ * older than a worker's last progress row). A host that predates this flag ignores it and
135
+ * starts at `startPositionMs`, as before.
136
+ */
137
+ startPositionIsFallback?: boolean;
105
138
  }): Promise<MediaPlaybackStatus>;
139
+ /** The lock-screen/persistence half of `setQueue`'s options, as wire params. Every key is
140
+ * emitted only when its option is set, so a caller that sets none sends today's payload. */
141
+ export declare function encodeSessionOptions(options: {
142
+ skipIntervals?: MediaSkipIntervals;
143
+ playbackRates?: number[];
144
+ persistPosition?: boolean;
145
+ startPositionIsFallback?: boolean;
146
+ startPositionMs?: number;
147
+ }): Record<string, string>;
106
148
  /**
107
149
  * Subscribe THIS screen's worker to live playback status.
108
150
  *
@@ -28,7 +28,8 @@ function decodeStatus(raw) {
28
28
  rate: typeof raw?.rate === "number" ? raw.rate : 1,
29
29
  bufferedMs: typeof raw?.bufferedMs === "number" ? raw.bufferedMs : 0,
30
30
  queue: Array.isArray(raw?.queue) ? raw.queue : [],
31
- error: raw?.error
31
+ error: raw?.error,
32
+ ...typeof raw?.resumedFromMs === "number" ? { resumedFromMs: raw.resumedFromMs } : {}
32
33
  };
33
34
  }
34
35
  function isSessionRef(value) {
@@ -36,15 +37,36 @@ function isSessionRef(value) {
36
37
  }
37
38
  async function setQueue(items, options = {}) {
38
39
  if (!Array.isArray(items)) throw new Error("media-playback.setQueue: items must be an array");
40
+ const persist = options.persistPosition === true;
39
41
  const r = await dispatch("capability.media_playback.setQueue", {
40
42
  items: JSON.stringify(items),
41
43
  startIndex: String(options.startIndex ?? 0),
42
- startPositionMs: String(options.startPositionMs ?? 0),
44
+ // With persistPosition, an ABSENT start position is how the host knows to resume from
45
+ // the saved one — so it is only omitted then. Every other caller sends what it always did.
46
+ ...persist && options.startPositionMs === void 0 ? {} : { startPositionMs: String(options.startPositionMs ?? 0) },
43
47
  autoplay: String(options.autoplay === true),
44
- ...options.onStatus ? { onStatus: options.onStatus } : {}
48
+ ...options.onStatus ? { onStatus: options.onStatus } : {},
49
+ ...encodeSessionOptions(options)
45
50
  });
46
51
  return decodeStatus(r);
47
52
  }
53
+ function positiveSeconds(value) {
54
+ return typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.round(value) : void 0;
55
+ }
56
+ function encodeSessionOptions(options) {
57
+ const out = {};
58
+ const forward = positiveSeconds(options.skipIntervals?.forwardSec);
59
+ const backward = positiveSeconds(options.skipIntervals?.backwardSec);
60
+ if (forward !== void 0) out.skipForwardSec = String(forward);
61
+ if (backward !== void 0) out.skipBackwardSec = String(backward);
62
+ const rates = (options.playbackRates ?? []).filter((r) => typeof r === "number" && Number.isFinite(r)).map((r) => Math.min(3, Math.max(0.5, r)));
63
+ if (rates.length) out.playbackRates = [...new Set(rates)].sort((a, b) => a - b).join(",");
64
+ if (options.persistPosition === true) out.persistPosition = "true";
65
+ if (options.persistPosition === true && options.startPositionIsFallback === true && options.startPositionMs !== void 0) {
66
+ out.startPositionFallback = "true";
67
+ }
68
+ return out;
69
+ }
48
70
  async function subscribeStatus(handler) {
49
71
  if (!handler.includes(".")) {
50
72
  throw new Error('media-playback.subscribeStatus: handler must be "<service>.<action>"');
@@ -150,6 +172,7 @@ async function removeDownload(id) {
150
172
  var version = 1;
151
173
  export {
152
174
  download,
175
+ encodeSessionOptions,
153
176
  getCapabilities,
154
177
  getState,
155
178
  next,
package/dist/cli.mjs CHANGED
@@ -6893,6 +6893,7 @@ function buttonVariant(style) {
6893
6893
  var SYSTEM_FONT_FAMILY, TONAL_ELEVATION_ALPHA, BUTTON_MIN_HIT_TARGET, nonNegative, nonEmpty, own, COLOR_TOKEN_PROPS, TYPOGRAPHY_TOKEN_PROPS, BUTTON_VARIANTS;
6894
6894
  var init_tokens = __esm({
6895
6895
  "../../core/ts/src/tokens.ts"() {
6896
+ "use strict";
6896
6897
  SYSTEM_FONT_FAMILY = "$system";
6897
6898
  TONAL_ELEVATION_ALPHA = [0, 0.05, 0.08, 0.11, 0.12, 0.14];
6898
6899
  BUTTON_MIN_HIT_TARGET = 44;
@@ -13591,6 +13592,7 @@ function resolveIdiom(tokens2, ctx = {}) {
13591
13592
  var IDIOM_CONTEXTS, UNSAFE_KEYS;
13592
13593
  var init_idiom = __esm({
13593
13594
  "../../core/ts/src/idiom.ts"() {
13595
+ "use strict";
13594
13596
  IDIOM_CONTEXTS = {
13595
13597
  ios: { native: ["ios"] },
13596
13598
  android: { native: ["material"] },
@@ -144648,23 +144650,23 @@ var init_preview_assets_generated = __esm({
144648
144650
  "../../packages/serve/src/preview-assets.generated.ts"() {
144649
144651
  init_preview_assets_format();
144650
144652
  PREVIEW_ASSET_MANIFEST = [
144651
- { key: "assets/index-Cp9s6iew.js", contentType: "application/javascript; charset=utf-8", offset: 8, length: 1215608, sha256: "d8146f84ef505b37316197ed7df5e1dc03254ac000b05ad1fb7c99af4a0f75b1" },
144652
- { key: "assets/pdf.worker.min-BmVo14Nb.mjs", contentType: "application/octet-stream", offset: 1215616, length: 1317034, sha256: "a33cfe728c584fdba4fcc1fd54bcdc2f9f2f13889ddbb5b2bd1d0f8cbe49b84e" },
144653
- { key: "assets/pdfDocument-DI7C0g9C.js", contentType: "application/javascript; charset=utf-8", offset: 2532650, length: 489166, sha256: "f5e341a8e5dd7dcc319b059321b9fab3d65aa41aa8fec7abbdc5251541d01946" },
144654
- { key: "fonts/Roboto-LICENSE.txt", contentType: "application/octet-stream", offset: 3021816, length: 4610, sha256: "994062dd7af4186a739de55dd9e151c63b6301f8e2cbafc608d35c2e87da0cd2" },
144655
- { key: "fonts/Roboto-Variable.ttf", contentType: "font/ttf", offset: 3026426, length: 488584, sha256: "d7598e12c5dbef095ff8272cfc55da0250bd07fbdecbac8a530b9b277872a134" },
144656
- { key: "fonts/WixMadeforDisplay-Bold.ttf", contentType: "font/ttf", offset: 3515010, length: 90924, sha256: "ec4c7d63772d980d6e147b2df6215fd2737e4b04cebe0cf7e11dc695fb63cdcf" },
144657
- { key: "fonts/WixMadeforDisplay-ExtraBold.ttf", contentType: "font/ttf", offset: 3605934, length: 90984, sha256: "bf4c16a2774edd38a921edf3099469866cd74c094fd596f3fa4e81f54a04dfaa" },
144658
- { key: "fonts/WixMadeforDisplay-Medium.ttf", contentType: "font/ttf", offset: 3696918, length: 90980, sha256: "368faca44fb9f7207e4af784e94750b1ee59c1098b8689e0f4a918926f244fb5" },
144659
- { key: "fonts/WixMadeforDisplay-Regular.ttf", contentType: "font/ttf", offset: 3787898, length: 90872, sha256: "97ed8f1a6772abe26e3d8af5cecfc4b02faa94497d585b0398b5053b739a70c1" },
144660
- { key: "fonts/WixMadeforDisplay-SemiBold.ttf", contentType: "font/ttf", offset: 3878770, length: 90980, sha256: "642feab8a48ddf6c7a89d7c2a7c0edfa0e6e773f671287e460e222703563191e" },
144661
- { key: "fonts/WixMadeforText-Bold.ttf", contentType: "font/ttf", offset: 3969750, length: 108636, sha256: "37c179b4fefb63ea9637322b84583a2df53aa226c150294eea1675c14b1b8e29" },
144662
- { key: "fonts/WixMadeforText-ExtraBold.ttf", contentType: "font/ttf", offset: 4078386, length: 109084, sha256: "62e2fe4718129f36ecdb0ae4de385bd6b81ecc876146447167c6c140fad699a9" },
144663
- { key: "fonts/WixMadeforText-Medium.ttf", contentType: "font/ttf", offset: 4187470, length: 109048, sha256: "4ecf270136af928612c76fe4ebade91d8156975e5ea4c0cf9225501dd1788e02" },
144664
- { key: "fonts/WixMadeforText-Regular.ttf", contentType: "font/ttf", offset: 4296518, length: 107700, sha256: "dee56f09fd3efc127c1ea95557edc74110c1460a46287da36e0af25efd341ef5" },
144665
- { key: "fonts/WixMadeforText-SemiBold.ttf", contentType: "font/ttf", offset: 4404218, length: 88108, sha256: "dced97a77624bc5f8b1ae65850360908297f4588e09feb6f22792d29dc7e765b" },
144666
- { key: "index.html", contentType: "text/html; charset=utf-8", offset: 4492326, length: 4947, sha256: "52f0f78045659e6cfa7d3db671275f28cb8a71f08f7ab96b423d5670f693a2ec" },
144667
- { key: "t5-frame.html", contentType: "text/html; charset=utf-8", offset: 4497273, length: 17344, sha256: "d057298d75e7373e5e2c4d11b7d1bcbea88e03af555ba63d97641c78509c58e4" }
144653
+ { key: "assets/index-6QYFsdBr.js", contentType: "application/javascript; charset=utf-8", offset: 8, length: 1221516, sha256: "87df05780a31d531d42f703e1da7801d6ab7869bd69245956259b62184242b5a" },
144654
+ { key: "assets/pdf.worker.min-BmVo14Nb.mjs", contentType: "application/octet-stream", offset: 1221524, length: 1317034, sha256: "a33cfe728c584fdba4fcc1fd54bcdc2f9f2f13889ddbb5b2bd1d0f8cbe49b84e" },
144655
+ { key: "assets/pdfDocument-hYjVMwI5.js", contentType: "application/javascript; charset=utf-8", offset: 2538558, length: 489166, sha256: "6ec7133d47c316a2b175ae38ce8c4a6d0fa3c3eade37532bf019cd709794902f" },
144656
+ { key: "fonts/Roboto-LICENSE.txt", contentType: "application/octet-stream", offset: 3027724, length: 4610, sha256: "994062dd7af4186a739de55dd9e151c63b6301f8e2cbafc608d35c2e87da0cd2" },
144657
+ { key: "fonts/Roboto-Variable.ttf", contentType: "font/ttf", offset: 3032334, length: 488584, sha256: "d7598e12c5dbef095ff8272cfc55da0250bd07fbdecbac8a530b9b277872a134" },
144658
+ { key: "fonts/WixMadeforDisplay-Bold.ttf", contentType: "font/ttf", offset: 3520918, length: 90924, sha256: "ec4c7d63772d980d6e147b2df6215fd2737e4b04cebe0cf7e11dc695fb63cdcf" },
144659
+ { key: "fonts/WixMadeforDisplay-ExtraBold.ttf", contentType: "font/ttf", offset: 3611842, length: 90984, sha256: "bf4c16a2774edd38a921edf3099469866cd74c094fd596f3fa4e81f54a04dfaa" },
144660
+ { key: "fonts/WixMadeforDisplay-Medium.ttf", contentType: "font/ttf", offset: 3702826, length: 90980, sha256: "368faca44fb9f7207e4af784e94750b1ee59c1098b8689e0f4a918926f244fb5" },
144661
+ { key: "fonts/WixMadeforDisplay-Regular.ttf", contentType: "font/ttf", offset: 3793806, length: 90872, sha256: "97ed8f1a6772abe26e3d8af5cecfc4b02faa94497d585b0398b5053b739a70c1" },
144662
+ { key: "fonts/WixMadeforDisplay-SemiBold.ttf", contentType: "font/ttf", offset: 3884678, length: 90980, sha256: "642feab8a48ddf6c7a89d7c2a7c0edfa0e6e773f671287e460e222703563191e" },
144663
+ { key: "fonts/WixMadeforText-Bold.ttf", contentType: "font/ttf", offset: 3975658, length: 108636, sha256: "37c179b4fefb63ea9637322b84583a2df53aa226c150294eea1675c14b1b8e29" },
144664
+ { key: "fonts/WixMadeforText-ExtraBold.ttf", contentType: "font/ttf", offset: 4084294, length: 109084, sha256: "62e2fe4718129f36ecdb0ae4de385bd6b81ecc876146447167c6c140fad699a9" },
144665
+ { key: "fonts/WixMadeforText-Medium.ttf", contentType: "font/ttf", offset: 4193378, length: 109048, sha256: "4ecf270136af928612c76fe4ebade91d8156975e5ea4c0cf9225501dd1788e02" },
144666
+ { key: "fonts/WixMadeforText-Regular.ttf", contentType: "font/ttf", offset: 4302426, length: 107700, sha256: "dee56f09fd3efc127c1ea95557edc74110c1460a46287da36e0af25efd341ef5" },
144667
+ { key: "fonts/WixMadeforText-SemiBold.ttf", contentType: "font/ttf", offset: 4410126, length: 88108, sha256: "dced97a77624bc5f8b1ae65850360908297f4588e09feb6f22792d29dc7e765b" },
144668
+ { key: "index.html", contentType: "text/html; charset=utf-8", offset: 4498234, length: 4947, sha256: "304cce8116234dea09801f4db916f899dd1d634efeacd208723e9c2d5bcd7ed5" },
144669
+ { key: "t5-frame.html", contentType: "text/html; charset=utf-8", offset: 4503181, length: 17344, sha256: "d057298d75e7373e5e2c4d11b7d1bcbea88e03af555ba63d97641c78509c58e4" }
144668
144670
  ];
144669
144671
  }
144670
144672
  });
Binary file
@@ -2630,7 +2630,13 @@
2630
2630
  "name": "MediaPlaybackStatus",
2631
2631
  "kind": "interface",
2632
2632
  "jsdoc": "",
2633
- "decl": "export interface MediaPlaybackStatus {\n state: PlaybackState;\n currentItem?: MediaQueueItem | null;\n currentIndex: number;\n positionMs: number;\n durationMs: number;\n rate: number;\n bufferedMs: number;\n queue: MediaQueueItem[];\n error?: string;\n}"
2633
+ "decl": "export interface MediaPlaybackStatus {\n state: PlaybackState;\n currentItem?: MediaQueueItem | null;\n currentIndex: number;\n positionMs: number;\n durationMs: number;\n rate: number;\n bufferedMs: number;\n queue: MediaQueueItem[];\n error?: string;\n /** Set when `persistPosition` resumed the current item from a natively saved position\n * (no explicit `startPositionMs` was passed). Absent otherwise. */\n resumedFromMs?: number;\n}"
2634
+ },
2635
+ {
2636
+ "name": "MediaSkipIntervals",
2637
+ "kind": "interface",
2638
+ "jsdoc": "/** Lock-screen / notification skip-by-seconds controls. Either side may be omitted. */",
2639
+ "decl": "export interface MediaSkipIntervals {\n forwardSec?: number;\n backwardSec?: number;\n}"
2634
2640
  },
2635
2641
  {
2636
2642
  "name": "MediaDownloadResult",
@@ -2642,7 +2648,13 @@
2642
2648
  "name": "setQueue",
2643
2649
  "kind": "function",
2644
2650
  "jsdoc": "",
2645
- "decl": "export async function setQueue(\n items: MediaQueueItem[],\n options: {\n startIndex?: number;\n startPositionMs?: number;\n autoplay?: boolean;\n /**\n * PUSH channel for live playback state — `\"<service>.<action>\"` (e.g.\n * `\"podcast.mediaStatus\"`). The host invokes that reducer with a\n * `MediaPlaybackStatus` whenever the real player's state, rate or position\n * changes materially (throttled natively).\n *\n * Why it exists: a worker has NO TIMERS, so it cannot poll `status()`. Without\n * a push the UI reads playback state once at screen open and then drifts — the\n * play/pause icon and progress bar stop matching the audio. Same shape as\n * RFC 0040's StreamDirective `onEvent`, for the same reason.\n */\n onStatus?: string;\n } = {},\n): Promise<MediaPlaybackStatus>;"
2651
+ "decl": "export async function setQueue(\n items: MediaQueueItem[],\n options: {\n startIndex?: number;\n startPositionMs?: number;\n autoplay?: boolean;\n /**\n * PUSH channel for live playback state — `\"<service>.<action>\"` (e.g.\n * `\"podcast.mediaStatus\"`). The host invokes that reducer with a\n * `MediaPlaybackStatus` whenever the real player's state, rate or position\n * changes materially (throttled natively).\n *\n * Why it exists: a worker has NO TIMERS, so it cannot poll `status()`. Without\n * a push the UI reads playback state once at screen open and then drifts — the\n * play/pause icon and progress bar stop matching the audio. Same shape as\n * RFC 0040's StreamDirective `onEvent`, for the same reason.\n */\n onStatus?: string;\n /**\n * Skip-by-seconds on the lock screen / Now Playing (iOS `skipForwardCommand` /\n * `skipBackwardCommand`), the Android media notification + session, and on web the\n * browser Media Session (`seekbackward` / `seekforward`). Unset keeps today's controls\n * (iOS next/previous track; Android rewind 15 s / forward 30 s). Capped at 3600 s.\n */\n skipIntervals?: MediaSkipIntervals;\n /** Rates offered to iOS `changePlaybackRateCommand` and the Android session's speed\n * button (which shows the current rate and cycles through these). Defaults to 0.5x–2x;\n * each is clamped to the capability's 0.5–3 range. Web has no lock-screen speed control. */\n playbackRates?: number[];\n /**\n * Save the position natively per item id (every ~5 s, and on pause/stop; cleared once\n/* … */"
2652
+ },
2653
+ {
2654
+ "name": "encodeSessionOptions",
2655
+ "kind": "function",
2656
+ "jsdoc": "/** The lock-screen/persistence half of `setQueue`'s options, as wire params. Every key is\n * emitted only when its option is set, so a caller that sets none sends today's payload. */",
2657
+ "decl": "export function encodeSessionOptions(options: {\n skipIntervals?: MediaSkipIntervals;\n playbackRates?: number[];\n persistPosition?: boolean;\n startPositionIsFallback?: boolean;\n startPositionMs?: number;\n}): Record<string, string>;"
2646
2658
  },
2647
2659
  {
2648
2660
  "name": "subscribeStatus",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.1265.0",
3
+ "version": "0.1267.0",
4
4
  "type": "module",
5
5
  "description": "himi — the Himalaya authoring CLI. Build a Tier-5 content package on your own machine, push it to the production serve as a draft, preview it on web + Himi Player, and read worker logs back — the remote dev loop. Wraps @himalaya/serve-cli for transport.",
6
6
  "keywords": [
@@ -67,5 +67,5 @@
67
67
  "artifactId": "himalaya-cli"
68
68
  }
69
69
  },
70
- "falconPackageHash": "6529df3a98d5e1b19af7c9ec4915aad9ef742dd0e92f3bef6cbbe67b"
70
+ "falconPackageHash": "7272323ac031fcdf8b4e99371f184dddc3dc299bb72c5d61c568d704"
71
71
  }