@bastani/atomic 0.9.26-alpha.5 → 0.9.26-alpha.6
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.
- package/CHANGELOG.md +11 -0
- package/dist/builtin/intercom/package.json +2 -2
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/package.json +3 -3
- package/dist/builtin/web-access/package.json +2 -2
- package/dist/builtin/workflows/CHANGELOG.md +7 -0
- package/dist/builtin/workflows/builtin/{chunk-613yaa53.js → chunk-9bhs02gm.js} +195 -10
- package/dist/builtin/workflows/builtin/{chunk-6kqrk0pf.js → chunk-gts8wgjr.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-ea6nrbn3.js → chunk-gw7rghda.js} +1 -1
- package/dist/builtin/workflows/builtin/goal.js +2 -2
- package/dist/builtin/workflows/builtin/index.js +3 -3
- package/dist/builtin/workflows/builtin/ralph.js +2 -2
- package/dist/builtin/workflows/package.json +2 -2
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +1082 -220
- package/dist/builtin/workflows/src/index.js +967 -186
- package/dist/core/extensions/workflow-run-control.d.ts +3 -0
- package/dist/core/extensions/workflow-run-control.d.ts.map +1 -1
- package/dist/core/extensions/workflow-run-control.js.map +1 -1
- package/dist/core/fast-model-routing.d.ts.map +1 -1
- package/dist/core/fast-model-routing.js +1 -5
- package/dist/core/fast-model-routing.js.map +1 -1
- package/dist/core/model-config.d.ts +36 -0
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +14 -2
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/provider-composer-internal.d.ts +2 -1
- package/dist/core/provider-composer-internal.d.ts.map +1 -1
- package/dist/core/provider-composer-internal.js +13 -0
- package/dist/core/provider-composer-internal.js.map +1 -1
- package/docs/models/reference.md +28 -1
- package/docs/models.md +4 -0
- package/docs/sdk.md +26 -2
- package/docs/workflows/operations.md +15 -1
- package/npm-shrinkwrap.json +67 -67
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.9.26-alpha.6] - 2026-10-04
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Added `samplingParamsByThinkingLevel` to `models.json` for per-thinking-level sampling parameter overrides on OpenAI-compatible APIs, including native fast routes. See [Sampling by Thinking Level](docs/models/reference.md#sampling-by-thinking-level) ([#9776](https://github.com/earendil-works/pi/pull/9776) by [@mrexodia](https://github.com/mrexodia))
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- Fixed fresh SDK sessions being unable to inspect or resume crashed durable workflow runs from another process. Hosts using `SessionManager.inMemory()` can recover by full run UUID in the original working directory and workflow database without reopening a session file. Database ownership fencing protects healthy connected owners, including across cloned VM identities, and rejects late durable writes after connection loss. Older unfenced runs support explicit controlled enrollment after their workers stop. Completed checkpoints are preserved; interrupted external effects still require idempotency ([#3419](https://github.com/bastani-inc/atomic/issues/3419)).
|
|
14
|
+
- Fixed managed workflow database monitoring timeouts unnecessarily dropping healthy run ownership. A persistent timeout now reports database unavailability without closing existing ownership connections ([#3419](https://github.com/bastani-inc/atomic/issues/3419)).
|
|
15
|
+
|
|
5
16
|
## [0.9.26-alpha.5] - 2026-10-03
|
|
6
17
|
|
|
7
18
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/intercom",
|
|
3
|
-
"version": "0.9.26-alpha.
|
|
3
|
+
"version": "0.9.26-alpha.6",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Atomic extension providing a private coordination channel between parent and child agent sessions. Fork of: https://github.com/nicobailon/pi-intercom",
|
|
6
6
|
"contributors": [
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"@bastani/atomic": "*",
|
|
47
|
-
"@earendil-works/pi-tui": "^1.0.
|
|
47
|
+
"@earendil-works/pi-tui": "^1.0.2",
|
|
48
48
|
"typebox": "*"
|
|
49
49
|
},
|
|
50
50
|
"peerDependenciesMeta": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/subagents",
|
|
3
|
-
"version": "0.9.26-alpha.
|
|
3
|
+
"version": "0.9.26-alpha.6",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Atomic extension for delegating tasks to subagents with parallel execution. Fork of: https://github.com/nicobailon/pi-subagents",
|
|
6
6
|
"contributors": [
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@bastani/atomic": "*",
|
|
37
37
|
"@bastani/pi-ai": "*",
|
|
38
|
-
"@earendil-works/pi-agent-core": "^1.0.
|
|
39
|
-
"@earendil-works/pi-tui": "^1.0.
|
|
38
|
+
"@earendil-works/pi-agent-core": "^1.0.2",
|
|
39
|
+
"@earendil-works/pi-tui": "^1.0.2",
|
|
40
40
|
"typebox": "*"
|
|
41
41
|
},
|
|
42
42
|
"peerDependenciesMeta": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/web-access",
|
|
3
|
-
"version": "0.9.26-alpha.
|
|
3
|
+
"version": "0.9.26-alpha.6",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Atomic extension for web search, URL fetching, GitHub repo cloning, PDF/video extraction. Fork of: https://github.com/nicobailon/pi-web-access",
|
|
6
6
|
"contributors": [
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@bastani/atomic": "*",
|
|
34
|
-
"@earendil-works/pi-tui": "^1.0.
|
|
34
|
+
"@earendil-works/pi-tui": "^1.0.2"
|
|
35
35
|
},
|
|
36
36
|
"peerDependenciesMeta": {
|
|
37
37
|
"@bastani/atomic": {
|
|
@@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.9.26-alpha.6] - 2026-10-04
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- Fixed SDK inspection rejecting earlier-process durable runs and crash recovery retaining the old session owner. Explicit SDK resume atomically adopts an eligible crashed root in the same working directory and workflow database, preserves its UUID and completed checkpoints, and excludes healthy connected owners and competing adopters. Database ownership fencing handles cloned VM identities and rejects disconnected owners' late durable writes. Older unfenced runs support controlled enrollment after their workers stop; unfinished external callbacks may overlap recovery and must use idempotent effects ([#3419](https://github.com/bastani-inc/atomic/issues/3419)).
|
|
14
|
+
- Fixed managed PostgreSQL monitoring connection timeouts unnecessarily closing healthy workflow ownership connections. Monitoring retries once; a persistent timeout reports database unavailability without discarding connected owners or restarting the database ([#3419](https://github.com/bastani-inc/atomic/issues/3419)).
|
|
15
|
+
|
|
9
16
|
## [0.9.26-alpha.5] - 2026-10-03
|
|
10
17
|
|
|
11
18
|
### Added
|
|
@@ -5305,8 +5305,186 @@ var STATUS_RELATED_MESSAGE_REFINEMENT_CODES = new Set([
|
|
|
5305
5305
|
"quota_limited",
|
|
5306
5306
|
"cancelled"
|
|
5307
5307
|
]);
|
|
5308
|
-
// dist/builtin/workflows/src/durable/dbos-
|
|
5309
|
-
|
|
5308
|
+
// dist/builtin/workflows/src/durable/dbos-owner-fence.ts
|
|
5309
|
+
import { AsyncLocalStorage as AsyncLocalStorage2 } from "node:async_hooks";
|
|
5310
|
+
|
|
5311
|
+
// dist/builtin/workflows/src/durable/dbos-admission-pool.ts
|
|
5312
|
+
var connectionErrnos = new Set([
|
|
5313
|
+
"ECONNRESET",
|
|
5314
|
+
"ECONNREFUSED",
|
|
5315
|
+
"ECONNABORTED",
|
|
5316
|
+
"EHOSTUNREACH",
|
|
5317
|
+
"ENETUNREACH",
|
|
5318
|
+
"ETIMEDOUT",
|
|
5319
|
+
"ENOTFOUND",
|
|
5320
|
+
"EAI_AGAIN",
|
|
5321
|
+
"EPIPE"
|
|
5322
|
+
]);
|
|
5323
|
+
var connectionMessages = new Set([
|
|
5324
|
+
"Connection terminated unexpectedly",
|
|
5325
|
+
"Connection terminated due to connection timeout",
|
|
5326
|
+
"Client has encountered a connection error and is not queryable",
|
|
5327
|
+
"timeout exceeded when trying to connect",
|
|
5328
|
+
"Client was closed and is not queryable",
|
|
5329
|
+
"Postgres connection pool changed while acquiring a connection"
|
|
5330
|
+
]);
|
|
5331
|
+
|
|
5332
|
+
// dist/builtin/workflows/src/durable/dbos-row-guard.ts
|
|
5333
|
+
import { createHash } from "node:crypto";
|
|
5334
|
+
var guardSql = `
|
|
5335
|
+
CREATE TABLE IF NOT EXISTS dbos.atomic_owner_generation (
|
|
5336
|
+
root text PRIMARY KEY, owner text, generation bigint,
|
|
5337
|
+
terminal boolean NOT NULL DEFAULT false, claim text, claimant text, protocol integer NOT NULL DEFAULT 1 CHECK(protocol = 1)
|
|
5338
|
+
);
|
|
5339
|
+
CREATE TABLE IF NOT EXISTS dbos.atomic_guard_rows (workflow_uuid text PRIMARY KEY, root text NOT NULL);
|
|
5340
|
+
CREATE OR REPLACE FUNCTION dbos.atomic_metadata(value text) RETURNS jsonb
|
|
5341
|
+
LANGUAGE plpgsql IMMUTABLE SET search_path = pg_catalog AS $$
|
|
5342
|
+
DECLARE decoded jsonb;
|
|
5343
|
+
BEGIN
|
|
5344
|
+
IF value IS NULL THEN RETURN NULL; END IF;
|
|
5345
|
+
BEGIN decoded := value::jsonb; EXCEPTION WHEN invalid_text_representation THEN RETURN NULL; END;
|
|
5346
|
+
IF decoded->>'__dbos_serializer' = 'superjson' THEN decoded := decoded->'json'; END IF;
|
|
5347
|
+
IF decoded->>'__atomicDurableMetadata' IS DISTINCT FROM 'true' OR decoded->>'version' IS DISTINCT FROM '3' THEN RETURN NULL; END IF;
|
|
5348
|
+
RETURN decoded->'metadata';
|
|
5349
|
+
END $$;
|
|
5350
|
+
CREATE OR REPLACE FUNCTION dbos.atomic_guard_row() RETURNS trigger
|
|
5351
|
+
LANGUAGE plpgsql SET search_path = pg_catalog AS $$
|
|
5352
|
+
DECLARE
|
|
5353
|
+
row_value jsonb; id text; root_id text; authority jsonb; state dbos.atomic_owner_generation%ROWTYPE;
|
|
5354
|
+
meta jsonb; prior jsonb; prior_generation bigint; next_generation bigint; absorbing boolean;
|
|
5355
|
+
allowed boolean; cap_owner text; cap_generation bigint; claim_token text;
|
|
5356
|
+
BEGIN
|
|
5357
|
+
row_value := CASE WHEN TG_OP = 'DELETE' THEN to_jsonb(OLD) ELSE to_jsonb(NEW) END;
|
|
5358
|
+
id := row_value->>'workflow_uuid';
|
|
5359
|
+
root_id := split_part(id, ':checkpoint:', 1);
|
|
5360
|
+
IF TG_OP = 'UPDATE' AND to_jsonb(OLD)->>'workflow_uuid' IS DISTINCT FROM id AND (
|
|
5361
|
+
EXISTS(SELECT 1 FROM dbos.atomic_guard_rows WHERE workflow_uuid = to_jsonb(OLD)->>'workflow_uuid') OR
|
|
5362
|
+
(TG_TABLE_NAME = 'workflow_status' AND to_jsonb(OLD)->>'name' IN ('atomicWorkflowHandle','atomicWorkflowCheckpoint')) OR
|
|
5363
|
+
(TG_TABLE_NAME = 'operation_outputs' AND EXISTS(SELECT 1 FROM dbos.workflow_status WHERE workflow_uuid = to_jsonb(OLD)->>'workflow_uuid' AND name IN ('atomicWorkflowHandle','atomicWorkflowCheckpoint')))
|
|
5364
|
+
) THEN
|
|
5365
|
+
IF NULLIF(current_setting('atomic.row_authority',true),'') IS NULL OR current_setting('atomic.row_authority',true) = 'null' THEN RETURN NULL; END IF;
|
|
5366
|
+
RAISE EXCEPTION 'Atomic workflow identities are immutable';
|
|
5367
|
+
END IF;
|
|
5368
|
+
IF TG_TABLE_NAME = 'workflow_status' AND NOT (
|
|
5369
|
+
COALESCE(row_value->>'name' IN ('atomicWorkflowHandle','atomicWorkflowCheckpoint'), false) OR
|
|
5370
|
+
COALESCE(to_jsonb(OLD)->>'name' IN ('atomicWorkflowHandle','atomicWorkflowCheckpoint'), false) OR
|
|
5371
|
+
EXISTS(SELECT 1 FROM dbos.atomic_guard_rows WHERE workflow_uuid = id)
|
|
5372
|
+
) THEN
|
|
5373
|
+
IF TG_OP = 'DELETE' THEN RETURN OLD; ELSE RETURN NEW; END IF;
|
|
5374
|
+
END IF;
|
|
5375
|
+
authority := NULLIF(current_setting('atomic.row_authority', true), '')::jsonb;
|
|
5376
|
+
IF TG_TABLE_NAME = 'operation_outputs' AND NOT EXISTS (
|
|
5377
|
+
SELECT 1 FROM dbos.workflow_status WHERE workflow_uuid = id AND name IN ('atomicWorkflowHandle','atomicWorkflowCheckpoint')
|
|
5378
|
+
) AND NOT EXISTS (SELECT 1 FROM dbos.atomic_guard_rows WHERE workflow_uuid = id) THEN
|
|
5379
|
+
IF TG_OP = 'DELETE' THEN RETURN OLD; ELSE RETURN NEW; END IF;
|
|
5380
|
+
END IF;
|
|
5381
|
+
INSERT INTO dbos.atomic_guard_rows VALUES(id, root_id) ON CONFLICT DO NOTHING;
|
|
5382
|
+
INSERT INTO dbos.atomic_guard_rows SELECT workflow_uuid, root_id FROM dbos.workflow_status
|
|
5383
|
+
WHERE workflow_uuid = root_id AND name = 'atomicWorkflowHandle' ON CONFLICT DO NOTHING;
|
|
5384
|
+
INSERT INTO dbos.atomic_owner_generation(root) VALUES(root_id)
|
|
5385
|
+
ON CONFLICT(root) DO UPDATE SET root = EXCLUDED.root RETURNING * INTO state;
|
|
5386
|
+
IF state.owner IS NULL THEN
|
|
5387
|
+
IF TG_TABLE_NAME <> 'workflow_status' OR TG_OP = 'DELETE' OR row_value->>'status' <> 'SUCCESS'
|
|
5388
|
+
OR id NOT LIKE root_id || ':checkpoint:__atomic_metadata:%'
|
|
5389
|
+
OR authority->>'root' IS DISTINCT FROM root_id OR authority->>'enroll' IS DISTINCT FROM 'true' THEN
|
|
5390
|
+
IF TG_OP = 'DELETE' THEN RETURN OLD; ELSE RETURN NEW; END IF;
|
|
5391
|
+
END IF;
|
|
5392
|
+
meta := dbos.atomic_metadata(row_value->>'output');
|
|
5393
|
+
IF meta IS NULL OR meta->>'workflowId' IS DISTINCT FROM root_id THEN
|
|
5394
|
+
RAISE EXCEPTION 'Atomic metadata encoding is unavailable for enrollment';
|
|
5395
|
+
END IF;
|
|
5396
|
+
SELECT candidate.metadata, candidate.generation INTO prior, prior_generation FROM (
|
|
5397
|
+
SELECT dbos.atomic_metadata(output) AS metadata,
|
|
5398
|
+
split_part(substring(workflow_uuid FROM length(root_id) + 13), ':', 2)::bigint AS generation
|
|
5399
|
+
FROM dbos.workflow_status
|
|
5400
|
+
WHERE workflow_uuid LIKE root_id || ':checkpoint:__atomic_metadata:%' AND status = 'SUCCESS'
|
|
5401
|
+
) candidate WHERE candidate.metadata IS NOT NULL
|
|
5402
|
+
ORDER BY COALESCE(candidate.metadata->>'status' IN ('completed', 'cancelled') OR
|
|
5403
|
+
(candidate.metadata->>'status' IN ('failed','blocked') AND candidate.metadata->>'resumable' = 'false'), false) DESC,
|
|
5404
|
+
candidate.generation DESC LIMIT 1;
|
|
5405
|
+
IF prior_generation IS DISTINCT FROM (authority->>'generation')::bigint
|
|
5406
|
+
OR prior->>'ownerExecutorId' IS DISTINCT FROM authority->>'owner' THEN
|
|
5407
|
+
RAISE EXCEPTION 'Atomic ownership generation changed before enrollment';
|
|
5408
|
+
END IF;
|
|
5409
|
+
ELSE
|
|
5410
|
+
IF authority->>'root' IS DISTINCT FROM root_id THEN RETURN NULL; END IF;
|
|
5411
|
+
cap_owner := authority->>'owner'; cap_generation := (authority->>'generation')::bigint;
|
|
5412
|
+
allowed := cap_owner = state.owner AND cap_generation = state.generation AND (
|
|
5413
|
+
authority->>'actor' = state.owner OR
|
|
5414
|
+
(authority->>'claim' = state.claim AND authority->>'actor' = state.claimant) OR
|
|
5415
|
+
(authority->>'claim' IS NOT NULL AND authority->>'checkpoint' = id));
|
|
5416
|
+
IF NOT COALESCE(allowed, false) THEN RAISE EXCEPTION 'Atomic ownership generation changed; stale database writes are refused'; END IF;
|
|
5417
|
+
END IF;
|
|
5418
|
+
IF TG_TABLE_NAME = 'workflow_status' AND TG_OP = 'UPDATE' THEN
|
|
5419
|
+
IF OLD.status = 'SUCCESS' AND OLD.name = 'atomicWorkflowCheckpoint' THEN
|
|
5420
|
+
IF NEW.output IS DISTINCT FROM OLD.output OR NEW.status <> 'SUCCESS' THEN RAISE EXCEPTION 'Completed Atomic checkpoints are immutable'; END IF;
|
|
5421
|
+
RETURN NEW;
|
|
5422
|
+
END IF;
|
|
5423
|
+
END IF;
|
|
5424
|
+
IF TG_TABLE_NAME = 'workflow_status' AND TG_OP <> 'DELETE' AND row_value->>'status' = 'SUCCESS'
|
|
5425
|
+
AND id LIKE root_id || ':checkpoint:__atomic_metadata:%' THEN
|
|
5426
|
+
meta := dbos.atomic_metadata(row_value->>'output');
|
|
5427
|
+
IF meta IS NULL OR meta->>'workflowId' IS DISTINCT FROM root_id OR meta->>'ownerExecutorId' IS DISTINCT FROM authority->>'actor' THEN RAISE EXCEPTION 'Atomic metadata encoding or owner is unavailable'; END IF;
|
|
5428
|
+
next_generation := split_part(substring(id FROM length(root_id) + 13), ':', 2)::bigint;
|
|
5429
|
+
absorbing := COALESCE(meta->>'status' IN ('completed', 'cancelled') OR
|
|
5430
|
+
(meta->>'status' IN ('failed','blocked') AND meta->>'resumable' = 'false'), false);
|
|
5431
|
+
claim_token := meta->>'transitionClaimId';
|
|
5432
|
+
IF state.root IS NOT NULL AND (next_generation < state.generation OR (state.terminal AND NOT absorbing)) THEN
|
|
5433
|
+
RAISE EXCEPTION 'Atomic terminal or newer generation cannot be overwritten';
|
|
5434
|
+
END IF;
|
|
5435
|
+
IF state.owner IS NOT NULL AND authority->>'actor' <> state.owner THEN
|
|
5436
|
+
IF id NOT LIKE '%:claim' OR next_generation <> state.generation + 1 OR claim_token IS DISTINCT FROM authority->>'claim' OR meta->>'ownerExecutorId' IS DISTINCT FROM authority->>'actor' THEN
|
|
5437
|
+
RAISE EXCEPTION 'Atomic ownership transfer requires an exact generation claim';
|
|
5438
|
+
END IF;
|
|
5439
|
+
END IF;
|
|
5440
|
+
END IF;
|
|
5441
|
+
IF TG_OP = 'DELETE' THEN RETURN OLD; ELSE RETURN NEW; END IF;
|
|
5442
|
+
END $$;
|
|
5443
|
+
CREATE OR REPLACE FUNCTION dbos.atomic_project_metadata() RETURNS trigger
|
|
5444
|
+
LANGUAGE plpgsql SET search_path = pg_catalog AS $$
|
|
5445
|
+
DECLARE root_id text; meta jsonb; authority jsonb; state dbos.atomic_owner_generation%ROWTYPE; projected_generation bigint; absorbing boolean;
|
|
5446
|
+
BEGIN
|
|
5447
|
+
IF NEW.name <> 'atomicWorkflowCheckpoint' OR NEW.status <> 'SUCCESS' THEN RETURN NEW; END IF;
|
|
5448
|
+
root_id := split_part(NEW.workflow_uuid, ':checkpoint:', 1);
|
|
5449
|
+
IF NEW.workflow_uuid NOT LIKE root_id || ':checkpoint:__atomic_metadata:%' THEN RETURN NEW; END IF;
|
|
5450
|
+
IF TG_OP = 'UPDATE' THEN IF OLD.status = 'SUCCESS' THEN RETURN NEW; END IF; END IF;
|
|
5451
|
+
authority := NULLIF(current_setting('atomic.row_authority', true), '')::jsonb;
|
|
5452
|
+
SELECT * INTO state FROM dbos.atomic_owner_generation WHERE root = root_id FOR UPDATE;
|
|
5453
|
+
IF state.owner IS NULL AND authority->>'enroll' IS DISTINCT FROM 'true' THEN RETURN NEW; END IF;
|
|
5454
|
+
meta := dbos.atomic_metadata(NEW.output);
|
|
5455
|
+
projected_generation := split_part(substring(NEW.workflow_uuid FROM length(root_id) + 13), ':', 2)::bigint;
|
|
5456
|
+
absorbing := COALESCE(meta->>'status' IN ('completed','cancelled') OR (meta->>'status' IN ('failed','blocked') AND meta->>'resumable' = 'false'), false);
|
|
5457
|
+
UPDATE dbos.atomic_owner_generation SET owner = meta->>'ownerExecutorId', generation = projected_generation,
|
|
5458
|
+
terminal = absorbing, claim = CASE WHEN NEW.workflow_uuid LIKE '%:claim' THEN meta->>'transitionClaimId' END,
|
|
5459
|
+
claimant = CASE WHEN NEW.workflow_uuid LIKE '%:claim' THEN authority->>'actor' END WHERE root = root_id;
|
|
5460
|
+
RETURN NEW;
|
|
5461
|
+
END $$;
|
|
5462
|
+
DO $$ BEGIN
|
|
5463
|
+
IF NOT EXISTS (SELECT 1 FROM pg_trigger WHERE tgrelid = 'dbos.workflow_status'::regclass AND tgname = 'atomic_generation_guard') THEN
|
|
5464
|
+
CREATE TRIGGER atomic_generation_guard BEFORE INSERT OR UPDATE OR DELETE ON dbos.workflow_status
|
|
5465
|
+
FOR EACH ROW EXECUTE FUNCTION dbos.atomic_guard_row();
|
|
5466
|
+
END IF;
|
|
5467
|
+
IF NOT EXISTS (SELECT 1 FROM pg_trigger WHERE tgrelid = 'dbos.operation_outputs'::regclass AND tgname = 'atomic_generation_guard') THEN
|
|
5468
|
+
CREATE TRIGGER atomic_generation_guard BEFORE INSERT OR UPDATE OR DELETE ON dbos.operation_outputs
|
|
5469
|
+
FOR EACH ROW EXECUTE FUNCTION dbos.atomic_guard_row();
|
|
5470
|
+
END IF;
|
|
5471
|
+
IF NOT EXISTS (SELECT 1 FROM pg_trigger WHERE tgrelid = 'dbos.workflow_status'::regclass AND tgname = 'atomic_generation_projection') THEN
|
|
5472
|
+
CREATE TRIGGER atomic_generation_projection AFTER INSERT OR UPDATE ON dbos.workflow_status
|
|
5473
|
+
FOR EACH ROW EXECUTE FUNCTION dbos.atomic_project_metadata();
|
|
5474
|
+
END IF;
|
|
5475
|
+
END $$;
|
|
5476
|
+
`;
|
|
5477
|
+
var fingerprint = createHash("sha256").update(guardSql).digest("hex");
|
|
5478
|
+
|
|
5479
|
+
// dist/builtin/workflows/src/durable/dbos-owner-fence.ts
|
|
5480
|
+
var contextKey = Symbol.for("atomic-workflows/dbos-owner-write-context@1");
|
|
5481
|
+
var contextBag = globalThis;
|
|
5482
|
+
contextBag[contextKey] ??= new AsyncLocalStorage2;
|
|
5483
|
+
var writeContext = contextBag[contextKey];
|
|
5484
|
+
var rowContextKey = Symbol.for("atomic-workflows/dbos-row-authority@1");
|
|
5485
|
+
var rowContextBag = globalThis;
|
|
5486
|
+
rowContextBag[rowContextKey] ??= new AsyncLocalStorage2;
|
|
5487
|
+
var rowContext = rowContextBag[rowContextKey];
|
|
5310
5488
|
|
|
5311
5489
|
// dist/builtin/workflows/src/durable/dbos-system-database-url.ts
|
|
5312
5490
|
function nonEmptyTrimmed(value) {
|
|
@@ -5378,7 +5556,7 @@ import { tmpdir, uptime } from "node:os";
|
|
|
5378
5556
|
import { basename as basename2, dirname as dirname3, isAbsolute as isAbsolute3, join as join4, relative as relative2, sep as sep2 } from "node:path";
|
|
5379
5557
|
|
|
5380
5558
|
// dist/builtin/workflows/src/durable/dbos-embedded-postgres-root.ts
|
|
5381
|
-
import { createHash } from "node:crypto";
|
|
5559
|
+
import { createHash as createHash2 } from "node:crypto";
|
|
5382
5560
|
import {
|
|
5383
5561
|
chmod,
|
|
5384
5562
|
chown,
|
|
@@ -5861,8 +6039,8 @@ async function snapshotSourceRuntime(root, publisher, progress) {
|
|
|
5861
6039
|
const rootStat = await lstat(root);
|
|
5862
6040
|
assertRuntimeRoot(root, rootStat);
|
|
5863
6041
|
const rootRealPath = await realpath(root);
|
|
5864
|
-
const sourceHash =
|
|
5865
|
-
const sealedHash =
|
|
6042
|
+
const sourceHash = createHash2("sha256");
|
|
6043
|
+
const sealedHash = createHash2("sha256");
|
|
5866
6044
|
await hashSourceEntry(sourceHash, sealedHash, root, ".", rootRealPath, publisher, progress);
|
|
5867
6045
|
return { sourceIdentity: sourceHash.digest("hex"), sealedIdentity: sealedHash.digest("hex") };
|
|
5868
6046
|
}
|
|
@@ -6127,7 +6305,7 @@ async function snapshotSealedManifest(root, progress) {
|
|
|
6127
6305
|
const rootStat = await lstat(root);
|
|
6128
6306
|
assertRuntimeRoot(root, rootStat);
|
|
6129
6307
|
const rootRealPath = await realpath(root);
|
|
6130
|
-
const hash =
|
|
6308
|
+
const hash = createHash2("sha256");
|
|
6131
6309
|
const entries = [];
|
|
6132
6310
|
await hashSealedEntry(hash, root, ".", rootRealPath, progress, entries);
|
|
6133
6311
|
return { version: 1, sealedIdentity: hash.digest("hex"), entries };
|
|
@@ -6360,6 +6538,13 @@ function resolveEmbeddedPostgresTarget(host) {
|
|
|
6360
6538
|
// dist/builtin/workflows/src/durable/dbos-postgres-health.ts
|
|
6361
6539
|
var HEALTH_INTERVAL_MS = 5000;
|
|
6362
6540
|
var RECOVERY_ATTEMPTS = 3;
|
|
6541
|
+
function isMonitoringConnectionTimeout(error) {
|
|
6542
|
+
if (!(error instanceof Error))
|
|
6543
|
+
return false;
|
|
6544
|
+
if ("code" in error)
|
|
6545
|
+
return error.code === "ETIMEDOUT";
|
|
6546
|
+
return error.message === "timeout expired" || error.message === "Connection terminated due to connection timeout";
|
|
6547
|
+
}
|
|
6363
6548
|
function isMonitoringConnectionFailure(error) {
|
|
6364
6549
|
if (!(error instanceof Error))
|
|
6365
6550
|
return false;
|
|
@@ -6470,7 +6655,7 @@ class PostgresHealth {
|
|
|
6470
6655
|
try {
|
|
6471
6656
|
identity = await this.operations.probe();
|
|
6472
6657
|
} catch (retryError) {
|
|
6473
|
-
if (!isMonitoringConnectionFailure(retryError))
|
|
6658
|
+
if (isMonitoringConnectionTimeout(retryError) || !isMonitoringConnectionFailure(retryError))
|
|
6474
6659
|
throw retryError;
|
|
6475
6660
|
this.retainFailure(retryError);
|
|
6476
6661
|
return;
|
|
@@ -6496,7 +6681,7 @@ class PostgresHealth {
|
|
|
6496
6681
|
if (ready !== undefined)
|
|
6497
6682
|
return ready;
|
|
6498
6683
|
} catch (error) {
|
|
6499
|
-
if (isQueryReadTimeout(error)) {
|
|
6684
|
+
if (isQueryReadTimeout(error) || isMonitoringConnectionTimeout(error)) {
|
|
6500
6685
|
this.retainFailure(new Error("Managed PostgreSQL did not answer a health check in time."));
|
|
6501
6686
|
throw this.dependencyFailure("Managed PostgreSQL did not answer a health check in time.");
|
|
6502
6687
|
}
|
|
@@ -6803,7 +6988,7 @@ async function probePostgresIdentity(port) {
|
|
|
6803
6988
|
const result = await client.query(POSTGRES_IDENTITY_SQL);
|
|
6804
6989
|
return result.rows[0];
|
|
6805
6990
|
} catch (error) {
|
|
6806
|
-
if (isQueryReadTimeout(error))
|
|
6991
|
+
if (isQueryReadTimeout(error) || isMonitoringConnectionTimeout(error))
|
|
6807
6992
|
throw error;
|
|
6808
6993
|
const code = error instanceof Error && "code" in error ? error.code : undefined;
|
|
6809
6994
|
if (code === "ECONNREFUSED" || code === "ECONNRESET" || code === "EPIPE" || code === "57P01" || code === "57P02" || code === "57P03" || error instanceof Error && /timeout|timed out|connection terminated/i.test(error.message))
|
|
@@ -6976,7 +7161,7 @@ async function ensureCluster(options = {}) {
|
|
|
6976
7161
|
try {
|
|
6977
7162
|
return await existingServerProbe()(probePort);
|
|
6978
7163
|
} catch (error) {
|
|
6979
|
-
if (isQueryReadTimeout(error))
|
|
7164
|
+
if (isQueryReadTimeout(error) || isMonitoringConnectionTimeout(error))
|
|
6980
7165
|
return;
|
|
6981
7166
|
throw error;
|
|
6982
7167
|
}
|
|
@@ -14,11 +14,11 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
generate_and_filter_default
|
|
16
16
|
} from "./chunk-kb7s3gx2.js";
|
|
17
|
-
import"./chunk-
|
|
17
|
+
import"./chunk-9bhs02gm.js";
|
|
18
18
|
import"./chunk-z0d03ktm.js";
|
|
19
19
|
import {
|
|
20
20
|
goal_default
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-gw7rghda.js";
|
|
22
22
|
import {
|
|
23
23
|
open_claude_design_default
|
|
24
24
|
} from "./chunk-nkj4qhj6.js";
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
} from "./chunk-94f8zfz1.js";
|
|
28
28
|
import {
|
|
29
29
|
ralph_default
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-gts8wgjr.js";
|
|
31
31
|
import {
|
|
32
32
|
tournament_default
|
|
33
33
|
} from "./chunk-wf876n16.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/workflows",
|
|
3
|
-
"version": "0.9.26-alpha.
|
|
3
|
+
"version": "0.9.26-alpha.6",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Atomic extension for multi-stage workflow authoring and execution.",
|
|
6
6
|
"contributors": [
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
"@bastani/atomic": "*",
|
|
88
|
-
"@earendil-works/pi-tui": "^1.0.
|
|
88
|
+
"@earendil-works/pi-tui": "^1.0.2",
|
|
89
89
|
"typebox": "*"
|
|
90
90
|
},
|
|
91
91
|
"peerDependenciesMeta": {
|