@rotorsoft/act 1.16.1 → 1.18.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 (51) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/@types/act.d.ts +0 -9
  3. package/dist/@types/act.d.ts.map +1 -1
  4. package/dist/@types/adapters/in-memory-store.d.ts +10 -0
  5. package/dist/@types/adapters/in-memory-store.d.ts.map +1 -1
  6. package/dist/@types/builders/act-builder.d.ts +3 -6
  7. package/dist/@types/builders/act-builder.d.ts.map +1 -1
  8. package/dist/@types/builders/slice-builder.d.ts +16 -8
  9. package/dist/@types/builders/slice-builder.d.ts.map +1 -1
  10. package/dist/@types/builders/state-builder.d.ts +19 -26
  11. package/dist/@types/builders/state-builder.d.ts.map +1 -1
  12. package/dist/@types/index.d.ts +1 -0
  13. package/dist/@types/index.d.ts.map +1 -1
  14. package/dist/@types/internal/autoclose-policy.d.ts +16 -0
  15. package/dist/@types/internal/autoclose-policy.d.ts.map +1 -1
  16. package/dist/@types/internal/builder-utils.d.ts +65 -0
  17. package/dist/@types/internal/builder-utils.d.ts.map +1 -0
  18. package/dist/@types/internal/close-signal.d.ts +51 -0
  19. package/dist/@types/internal/close-signal.d.ts.map +1 -0
  20. package/dist/@types/internal/defer-config.d.ts +64 -0
  21. package/dist/@types/internal/defer-config.d.ts.map +1 -0
  22. package/dist/@types/internal/defer-signal.d.ts +35 -0
  23. package/dist/@types/internal/defer-signal.d.ts.map +1 -0
  24. package/dist/@types/internal/defer-timer.d.ts +67 -0
  25. package/dist/@types/internal/defer-timer.d.ts.map +1 -0
  26. package/dist/@types/internal/drain-cycle.d.ts +39 -17
  27. package/dist/@types/internal/drain-cycle.d.ts.map +1 -1
  28. package/dist/@types/internal/drain.d.ts +3 -1
  29. package/dist/@types/internal/drain.d.ts.map +1 -1
  30. package/dist/@types/internal/index.d.ts +7 -5
  31. package/dist/@types/internal/index.d.ts.map +1 -1
  32. package/dist/@types/internal/reactions.d.ts.map +1 -1
  33. package/dist/@types/internal/tracing.d.ts.map +1 -1
  34. package/dist/@types/types/action.d.ts +36 -0
  35. package/dist/@types/types/action.d.ts.map +1 -1
  36. package/dist/@types/types/ports.d.ts +31 -0
  37. package/dist/@types/types/ports.d.ts.map +1 -1
  38. package/dist/{chunk-46OCUAVF.js → chunk-7XME4ZLK.js} +52 -2
  39. package/dist/chunk-7XME4ZLK.js.map +1 -0
  40. package/dist/index.cjs +852 -754
  41. package/dist/index.cjs.map +1 -1
  42. package/dist/index.js +728 -681
  43. package/dist/index.js.map +1 -1
  44. package/dist/test/index.cjs +55 -5
  45. package/dist/test/index.cjs.map +1 -1
  46. package/dist/test/index.js +5 -5
  47. package/dist/test/index.js.map +1 -1
  48. package/package.json +2 -2
  49. package/dist/@types/internal/autoclose-cycle.d.ts +0 -185
  50. package/dist/@types/internal/autoclose-cycle.d.ts.map +0 -1
  51. package/dist/chunk-46OCUAVF.js.map +0 -1
@@ -3835,7 +3835,7 @@ function manageArtifactAttachment(attachment) {
3835
3835
  }
3836
3836
  }
3837
3837
 
3838
- // ../../node_modules/.pnpm/vite@8.0.16_@types+node@25.9.4_esbuild@0.28.1_jiti@2.6.1_terser@5.46.1_tsx@4.22.4_yaml@2.9.0/node_modules/vite/dist/node/module-runner.js
3838
+ // ../../node_modules/.pnpm/vite@8.1.0_@types+node@25.9.4_esbuild@0.28.1_jiti@2.7.0_terser@5.46.1_tsx@4.22.4_yaml@2.9.0/node_modules/vite/dist/node/module-runner.js
3839
3839
  var SOURCEMAPPING_URL = "sourceMa";
3840
3840
  SOURCEMAPPING_URL += "ppingURL";
3841
3841
  var isWindows = typeof process < "u" && process.platform === "win32";
@@ -3844,8 +3844,8 @@ var AsyncFunction = async function() {
3844
3844
  var textDecoder = new TextDecoder();
3845
3845
  var decodeBase64 = typeof Buffer == "function" && typeof Buffer.from == "function" ? (base64) => Buffer.from(base64, "base64").toString("utf-8") : (base64) => textDecoder.decode(Uint8Array.from(atob(base64), (c) => c.charCodeAt(0)));
3846
3846
  var chars2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
3847
- var intToChar2 = new Uint8Array(64);
3848
- var charToInt2 = new Uint8Array(128);
3847
+ var intToChar2 = /* @__PURE__ */ new Uint8Array(64);
3848
+ var charToInt2 = /* @__PURE__ */ new Uint8Array(128);
3849
3849
  for (let i2 = 0; i2 < chars2.length; i2++) {
3850
3850
  let c = chars2.charCodeAt(i2);
3851
3851
  intToChar2[i2] = c, charToInt2[c] = i2;
@@ -3881,7 +3881,7 @@ var envProxy = new Proxy({}, { get(_, p) {
3881
3881
  throw Error(`[module runner] Dynamic access of "import.meta.env" is not supported. Please, use "import.meta.env.${String(p)}" instead.`);
3882
3882
  } });
3883
3883
 
3884
- // ../../node_modules/.pnpm/vitest@4.1.9_@types+node@25.9.4_@vitest+coverage-v8@4.1.9_vite@8.0.16_@types+node@25.9._33d2c52a77bafe82fe3d3570a113de8b/node_modules/vitest/dist/index.js
3884
+ // ../../node_modules/.pnpm/vitest@4.1.9_@types+node@25.9.4_@vitest+coverage-v8@4.1.9_vite@8.1.0_@types+node@25.9.4_4c1febd687429ee725e54d984bfb3460/node_modules/vitest/dist/index.js
3885
3885
  var import_expect_type = __toESM(require_dist(), 1);
3886
3886
 
3887
3887
  // src/internal/lru-map.ts
@@ -4316,6 +4316,11 @@ var InMemoryStream = class {
4316
4316
  _leased_until = void 0;
4317
4317
  _priority = 0;
4318
4318
  _lane = DEFAULT_LANE;
4319
+ // Persisted next-visit time (#1090). When set and still in the future, the
4320
+ // stream is held out of `claim` entirely — so a deferred reaction is not
4321
+ // re-claimed (and `retry` is never bumped) until its due-time passes. Unlike
4322
+ // in-process backoff, this is durable store state shared across workers.
4323
+ _deferred_at = void 0;
4319
4324
  constructor(stream, source, priority = 0, lane = DEFAULT_LANE) {
4320
4325
  this.stream = stream;
4321
4326
  this.source = source;
@@ -4347,7 +4352,17 @@ var InMemoryStream = class {
4347
4352
  this._priority = priority;
4348
4353
  }
4349
4354
  get is_available() {
4350
- return !this._blocked && (!this._leased_until || this._leased_until <= /* @__PURE__ */ new Date());
4355
+ return !this._blocked && (!this._leased_until || this._leased_until <= /* @__PURE__ */ new Date()) && // A stream deferred to a future time is not claimable until due (#1090).
4356
+ (!this._deferred_at || this._deferred_at <= Date.now());
4357
+ }
4358
+ /**
4359
+ * Hold this stream out of `claim` until `deferred_at` (ms since epoch).
4360
+ * Set by a deliberate `defer` outcome — not a failure, so retry/blocked
4361
+ * state is untouched. Cleared by ack/block/reset/unblock.
4362
+ */
4363
+ defer(deferred_at) {
4364
+ this._deferred_at = deferred_at;
4365
+ this._retry = -1;
4351
4366
  }
4352
4367
  get at() {
4353
4368
  return this._at;
@@ -4399,6 +4414,7 @@ var InMemoryStream = class {
4399
4414
  this._leased_until = void 0;
4400
4415
  this._at = lease.at;
4401
4416
  this._retry = -1;
4417
+ this._deferred_at = void 0;
4402
4418
  return {
4403
4419
  stream: this.stream,
4404
4420
  source: this.source,
@@ -4419,6 +4435,7 @@ var InMemoryStream = class {
4419
4435
  if (this._leased_by === lease.by) {
4420
4436
  this._blocked = true;
4421
4437
  this._error = error;
4438
+ this._deferred_at = void 0;
4422
4439
  return {
4423
4440
  stream: this.stream,
4424
4441
  source: this.source,
@@ -4443,6 +4460,7 @@ var InMemoryStream = class {
4443
4460
  this._error = "";
4444
4461
  this._leased_by = void 0;
4445
4462
  this._leased_until = void 0;
4463
+ this._deferred_at = void 0;
4446
4464
  }
4447
4465
  /**
4448
4466
  * Clear the blocked flag and lease bookkeeping without touching the
@@ -4456,6 +4474,7 @@ var InMemoryStream = class {
4456
4474
  this._error = "";
4457
4475
  this._leased_by = void 0;
4458
4476
  this._leased_until = void 0;
4477
+ this._deferred_at = void 0;
4459
4478
  return true;
4460
4479
  }
4461
4480
  };
@@ -4735,6 +4754,37 @@ var InMemoryStore = class {
4735
4754
  await sleep();
4736
4755
  return leases.map((l) => this._streams.get(l.stream)?.block(l, l.error)).filter((l) => !!l);
4737
4756
  }
4757
+ /**
4758
+ * Hold the matched streams out of {@link claim} until `deferred_at`
4759
+ * (ms since epoch) — see {@link Store.defer}. Accepts an explicit list
4760
+ * of names or a {@link StreamFilter}, mirroring {@link reset}/{@link unblock}.
4761
+ * Persisted store state (unlike in-process backoff), so the skip is honored
4762
+ * by every competing worker. Unknown names are silently skipped.
4763
+ *
4764
+ * @returns Count of streams whose `deferred_at` was set.
4765
+ */
4766
+ async defer(input, deferred_at) {
4767
+ await sleep();
4768
+ let count = 0;
4769
+ if (Array.isArray(input)) {
4770
+ for (const name of input) {
4771
+ const s = this._streams.get(name);
4772
+ if (s) {
4773
+ s.defer(deferred_at);
4774
+ count++;
4775
+ }
4776
+ }
4777
+ } else {
4778
+ const matches = this._filter_predicate(input);
4779
+ for (const s of this._streams.values()) {
4780
+ if (matches(s)) {
4781
+ s.defer(deferred_at);
4782
+ count++;
4783
+ }
4784
+ }
4785
+ }
4786
+ return count;
4787
+ }
4738
4788
  /**
4739
4789
  * Build a predicate from a {@link StreamFilter}. Compiled regexes are
4740
4790
  * cached in the closure so callers can apply it across the streams