hyperframes 0.6.61 → 0.6.62

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 (2) hide show
  1. package/dist/cli.js +20 -6
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -50,7 +50,7 @@ var VERSION;
50
50
  var init_version = __esm({
51
51
  "src/version.ts"() {
52
52
  "use strict";
53
- VERSION = true ? "0.6.61" : "0.0.0-dev";
53
+ VERSION = true ? "0.6.62" : "0.0.0-dev";
54
54
  }
55
55
  });
56
56
 
@@ -73846,8 +73846,15 @@ async function createShaderTransitionWorkerPool(opts) {
73846
73846
  const traceEnabled = process.env.HF_SHADER_POOL_TRACE === "1";
73847
73847
  let nextTaskId = 0;
73848
73848
  const execArgv = buildExecArgv(entryIsTs);
73849
+ const failQueueIfNoLiveSlots = () => {
73850
+ if (slots.some((s2) => !s2.dead)) return;
73851
+ while (queue.length > 0) {
73852
+ const t2 = queue.shift();
73853
+ if (t2) t2.reject(new Error("shader-blend pool has no live workers; task abandoned"));
73854
+ }
73855
+ };
73849
73856
  const dispatchNext = (slot) => {
73850
- if (terminated || slot.busy) return;
73857
+ if (terminated || slot.busy || slot.dead) return;
73851
73858
  const task = queue.shift();
73852
73859
  if (!task) return;
73853
73860
  slot.busy = true;
@@ -73911,24 +73918,28 @@ async function createShaderTransitionWorkerPool(opts) {
73911
73918
  const task = slot.current;
73912
73919
  slot.current = null;
73913
73920
  slot.busy = false;
73921
+ slot.dead = true;
73914
73922
  if (task) {
73915
73923
  task.reject(new Error(`shader-blend worker crashed mid-task: ${err.message}; buffers lost`));
73916
73924
  }
73917
73925
  log2.warn?.("[shaderTransitionWorkerPool] worker errored", { err: err.message });
73926
+ failQueueIfNoLiveSlots();
73918
73927
  };
73919
73928
  const onWorkerExit = (slot, code) => {
73920
73929
  if (terminated) return;
73930
+ slot.dead = true;
73921
73931
  if (slot.current) {
73922
73932
  slot.current.reject(new Error(`shader-blend worker exited (code=${code}) mid-task`));
73923
73933
  slot.current = null;
73924
73934
  slot.busy = false;
73925
73935
  }
73926
73936
  log2.warn?.("[shaderTransitionWorkerPool] worker exited unexpectedly", { code });
73937
+ failQueueIfNoLiveSlots();
73927
73938
  };
73928
73939
  try {
73929
73940
  for (let i2 = 0; i2 < size; i2++) {
73930
73941
  const worker = new Worker(entry, { execArgv });
73931
- const slot = { worker, busy: false, current: null };
73942
+ const slot = { worker, busy: false, current: null, dead: false };
73932
73943
  worker.on("message", (msg) => onWorkerMessage(slot, msg));
73933
73944
  worker.on(
73934
73945
  "error",
@@ -73951,12 +73962,14 @@ async function createShaderTransitionWorkerPool(opts) {
73951
73962
  }
73952
73963
  return new Promise((resolve46, reject) => {
73953
73964
  const task = traceEnabled ? { req, resolve: resolve46, reject, enqueuedAtMs: Date.now(), traceId: ++nextTaskId } : { req, resolve: resolve46, reject };
73954
- const idle = slots.find((s2) => !s2.busy);
73965
+ const idle = slots.find((s2) => !s2.busy && !s2.dead);
73955
73966
  if (idle) {
73956
73967
  queue.unshift(task);
73957
73968
  dispatchNext(idle);
73958
- } else {
73969
+ } else if (slots.some((s2) => !s2.dead)) {
73959
73970
  queue.push(task);
73971
+ } else {
73972
+ reject(new Error("shader-blend pool has no live workers"));
73960
73973
  }
73961
73974
  });
73962
73975
  },
@@ -77020,7 +77033,8 @@ function resolveChunkPlan(totalFrames, configChunkSize, maxParallelChunks) {
77020
77033
  const naiveCount = Math.ceil(totalFrames / resolvedChunkSize);
77021
77034
  const chunkCount = Math.min(maxParallelChunks, Math.max(1, naiveCount));
77022
77035
  const effectiveChunkSize = Math.max(resolvedChunkSize, Math.ceil(totalFrames / chunkCount));
77023
- return { chunkCount, effectiveChunkSize };
77036
+ const tightChunkCount = Math.min(chunkCount, Math.ceil(totalFrames / effectiveChunkSize));
77037
+ return { chunkCount: tightChunkCount, effectiveChunkSize };
77024
77038
  }
77025
77039
  function assertPositiveInteger(name, value) {
77026
77040
  if (!Number.isInteger(value) || value <= 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperframes",
3
- "version": "0.6.61",
3
+ "version": "0.6.62",
4
4
  "description": "HyperFrames CLI — create, preview, and render HTML video compositions",
5
5
  "repository": {
6
6
  "type": "git",