@godspeedai/cognate-runtime-bun 0.6.0 → 0.6.1

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/package.json +13 -13
  2. package/src/runtime.ts +13 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@godspeedai/cognate-runtime-bun",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Bun reference runtime: composes kernel, durable store, runs, continuations, commitments, artifacts, and cognition behind RuntimeService.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -22,18 +22,18 @@
22
22
  ".": "./src/index.ts"
23
23
  },
24
24
  "dependencies": {
25
- "@godspeedai/cognate-artifacts": "^0.6.0",
26
- "@godspeedai/cognate-capabilities": "^0.6.0",
27
- "@godspeedai/cognate-cognitive-api": "^0.6.0",
28
- "@godspeedai/cognate-continuations": "^0.6.0",
29
- "@godspeedai/cognate-events": "^0.6.0",
30
- "@godspeedai/cognate-kernel-api": "^0.6.0",
31
- "@godspeedai/cognate-kernel-cordis": "^0.6.0",
32
- "@godspeedai/cognate-projections": "^0.6.0",
33
- "@godspeedai/cognate-runtime-api": "^0.6.0",
34
- "@godspeedai/cognate-store-memory": "^0.6.0",
35
- "@godspeedai/cognate-store-postgres": "^0.6.0",
36
- "@godspeedai/cognate-store-sqlite": "^0.6.0"
25
+ "@godspeedai/cognate-artifacts": "^0.6.1",
26
+ "@godspeedai/cognate-capabilities": "^0.6.1",
27
+ "@godspeedai/cognate-cognitive-api": "^0.6.1",
28
+ "@godspeedai/cognate-continuations": "^0.6.1",
29
+ "@godspeedai/cognate-events": "^0.6.1",
30
+ "@godspeedai/cognate-kernel-api": "^0.6.1",
31
+ "@godspeedai/cognate-kernel-cordis": "^0.6.1",
32
+ "@godspeedai/cognate-projections": "^0.6.1",
33
+ "@godspeedai/cognate-runtime-api": "^0.6.1",
34
+ "@godspeedai/cognate-store-memory": "^0.6.1",
35
+ "@godspeedai/cognate-store-postgres": "^0.6.1",
36
+ "@godspeedai/cognate-store-sqlite": "^0.6.1"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@godspeedai/cognate-cognitive-memory": "workspace:*"
package/src/runtime.ts CHANGED
@@ -181,7 +181,19 @@ export async function startRuntime(options: RuntimeOptions): Promise<Runtime> {
181
181
  renew: () => store.renewRunOwnership!({ runId, ownerId, generation: lease.generation, now: Date.now(), leaseMs }).then((ok) => ok === true),
182
182
  };
183
183
  } catch (error) {
184
- if (error instanceof RunOwnershipHeldError) return;
184
+ if (error instanceof RunOwnershipHeldError) {
185
+ // Another live worker owns this run. Its lease expiry is reclaim eligibility, so
186
+ // re-arm this run for recovery once that lease can have lapsed; the durable
187
+ // intent machinery re-dispatches it on a later pass. Without this, a held-lease
188
+ // back-off would consume the only recovery trigger and strand the run.
189
+ const retryAt = error.lease.expiresAt - Date.now() + 250;
190
+ setTimeout(() => {
191
+ if (closed) return;
192
+ pending.add(runId);
193
+ kick();
194
+ }, Math.max(250, retryAt));
195
+ return;
196
+ }
185
197
  throw error;
186
198
  }
187
199
  }