priiisk 0.1.19 → 0.1.21

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.
@@ -2,7 +2,7 @@ import { createRequire as __priiiskCreateRequire } from "node:module";
2
2
  const require = __priiiskCreateRequire(import.meta.url);
3
3
 
4
4
  // packages/cli/src/domain/cliVersion.ts
5
- var PRIIISK_CLI_VERSION = "0.1.19";
5
+ var PRIIISK_CLI_VERSION = "0.1.21";
6
6
 
7
7
  export {
8
8
  PRIIISK_CLI_VERSION
@@ -2,7 +2,7 @@ import { createRequire as __priiiskCreateRequire } from "node:module";
2
2
  const require = __priiiskCreateRequire(import.meta.url);
3
3
  import {
4
4
  Boolean$,
5
- Class2 as Class,
5
+ Class,
6
6
  DescriptionAnnotationId,
7
7
  IntSchemaId,
8
8
  Number$,
@@ -22,10 +22,10 @@ import {
22
22
  acquireRelease,
23
23
  addFinalizer2 as addFinalizer,
24
24
  all,
25
- as2 as as,
25
+ as,
26
26
  asVoid2 as asVoid,
27
27
  booleanKeyword,
28
- catchAllCause2 as catchAllCause,
28
+ catchAllCause,
29
29
  close,
30
30
  concat,
31
31
  currentTimeMillis,
@@ -33,9 +33,9 @@ import {
33
33
  dual,
34
34
  effect,
35
35
  either,
36
- ensuring2 as ensuring,
36
+ ensuring,
37
37
  equals,
38
- exit2 as exit,
38
+ exit,
39
39
  extend,
40
40
  fail3 as fail,
41
41
  fail4 as fail2,
@@ -44,11 +44,11 @@ import {
44
44
  fiberId,
45
45
  filter,
46
46
  filterMap,
47
- flatMap4 as flatMap,
47
+ flatMap3 as flatMap,
48
48
  flip,
49
49
  forEach,
50
50
  fork,
51
- forkIn2 as forkIn,
51
+ forkIn,
52
52
  forkScoped,
53
53
  fromPubSub,
54
54
  gen,
@@ -77,8 +77,8 @@ import {
77
77
  identity,
78
78
  ignore,
79
79
  int,
80
- interrupt3 as interrupt,
81
- interruptible2 as interruptible,
80
+ interrupt2 as interrupt,
81
+ interruptible,
82
82
  isBoolean,
83
83
  isDeclaration,
84
84
  isEither,
@@ -101,8 +101,8 @@ import {
101
101
  make7 as make2,
102
102
  makeSemaphore,
103
103
  makeSynchronized,
104
- map6 as map,
105
- map7 as map2,
104
+ map3 as map,
105
+ map4 as map2,
106
106
  millis,
107
107
  minLength,
108
108
  modify,
@@ -111,7 +111,7 @@ import {
111
111
  nominal,
112
112
  none,
113
113
  numberKeyword,
114
- onInterrupt2 as onInterrupt,
114
+ onInterrupt,
115
115
  optional,
116
116
  orDie,
117
117
  pipe,
@@ -129,19 +129,19 @@ import {
129
129
  set2 as set,
130
130
  sleep,
131
131
  stringKeyword,
132
- succeed2 as succeed,
133
- succeed3 as succeed2,
134
- succeed4 as succeed3,
132
+ succeed,
133
+ succeed2,
134
+ succeed3,
135
135
  synchronizedVariance,
136
- unbounded2 as unbounded,
137
- uninterruptible2 as uninterruptible,
138
- uninterruptibleMask2 as uninterruptibleMask,
139
- unwrapScoped2 as unwrapScoped,
136
+ unbounded,
137
+ uninterruptible,
138
+ uninterruptibleMask,
139
+ unwrapScoped,
140
140
  update,
141
141
  updateEffect,
142
- zipLeft2 as zipLeft,
143
- zipRight2 as zipRight
144
- } from "./chunk-26WAMIP2.js";
142
+ zipLeft,
143
+ zipRight
144
+ } from "./chunk-DPNPQG2D.js";
145
145
 
146
146
  // node_modules/.pnpm/effect@3.21.4/node_modules/effect/dist/esm/internal/matcher.js
147
147
  var TypeId2 = /* @__PURE__ */ Symbol.for("@effect/matcher/Matcher");
@@ -320,6 +320,7 @@ var CampAskState = {
320
320
  expired: "expired",
321
321
  interrupted: "interrupted"
322
322
  };
323
+ var CampAskRelease = { interrupt: "interrupt", drop: "drop" };
323
324
  var CampAskRouter = class extends Tag("priiisk/CampKernel/CampAskRouter")() {
324
325
  };
325
326
 
@@ -742,6 +743,33 @@ var removeRegistration = (state, askId, registration) => modify(
742
743
  (reply) => reply === void 0 ? _void : fail(reply, askError("ask.close", "cancelled", askId)).pipe(asVoid)
743
744
  )
744
745
  );
746
+ var releaseWorkerRegistrations = (state, workerId, drop) => currentTimeMillis.pipe(
747
+ flatMap(
748
+ (now) => modify(state, (current) => {
749
+ const entries = new Map(current.entries);
750
+ const cancelled = [];
751
+ for (const [askId, entry] of current.entries) {
752
+ if (entry.request.workerId !== workerId) continue;
753
+ const open = entry.state.kind === "pending" || entry.state.kind === "claimed";
754
+ if (open) cancelled.push({ askId, reply: entry.reply });
755
+ if (drop) entries.delete(askId);
756
+ else if (open) {
757
+ entries.set(askId, { ...entry, state: { kind: "interrupted", interruptedAt: now } });
758
+ }
759
+ }
760
+ return [cancelled, { ...current, entries }];
761
+ })
762
+ ),
763
+ flatMap(
764
+ (cancelled) => forEach(
765
+ cancelled,
766
+ (item) => fail(item.reply, askError("ask.close", "cancelled", item.askId)).pipe(
767
+ asVoid
768
+ ),
769
+ { discard: true }
770
+ )
771
+ )
772
+ );
745
773
  var rollbackClaim = (state, askId, claim, terminalPerWorker) => currentTimeMillis.pipe(
746
774
  flatMap(
747
775
  (now) => modify(
@@ -947,6 +975,7 @@ var makeInMemoryCampAskRouterWithOptions = (options = {}) => gen(function* () {
947
975
  )
948
976
  ),
949
977
  restore: (snapshots) => restoreAskSnapshots(state, snapshots, terminalPerWorker),
978
+ releaseWorker: (workerId, release) => releaseWorkerRegistrations(state, workerId, release === CampAskRelease.drop),
950
979
  open: (request) => gen(function* () {
951
980
  if (request.totalTimeoutMs !== void 0 && (!Number.isSafeInteger(request.totalTimeoutMs) || request.totalTimeoutMs <= 0)) {
952
981
  return yield* fail2(askError("ask.open", "invalid_timeout", request.askId));
@@ -1392,6 +1421,7 @@ var finalizeWorkerLifecycle = (runtime, id2, resource, finalization, command = v
1392
1421
  })
1393
1422
  )
1394
1423
  );
1424
+ yield* runtime.asks.releaseWorker(id2, CampAskRelease.interrupt);
1395
1425
  if (isFailure(finalizationExit)) {
1396
1426
  return yield* failCause(finalizationExit.cause);
1397
1427
  }
@@ -2298,6 +2328,7 @@ var makeCampKernel = gen(function* () {
2298
2328
  close: close2,
2299
2329
  forget: (command, identity2) => gen(function* () {
2300
2330
  const forgotten = yield* runtime.registry.forget(identity2);
2331
+ yield* runtime.asks.releaseWorker(forgotten.id, CampAskRelease.drop);
2301
2332
  yield* publishKernelEvent(runtime, {
2302
2333
  kind: "forgotten",
2303
2334
  worker: forgotten,
@@ -3217,6 +3248,7 @@ export {
3217
3248
  CampSessionErrorCode,
3218
3249
  CampSessionError,
3219
3250
  CampTurnStopReason,
3251
+ CampWorkerState,
3220
3252
  CampAskState,
3221
3253
  get5 as get2,
3222
3254
  make6 as make2,