@bastani/atomic 0.9.38-alpha.6 → 0.9.38-alpha.7
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 +31 -0
- package/dist/builtin/intercom/package.json +2 -2
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +6 -0
- package/dist/builtin/subagents/package.json +3 -3
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +120 -121
- package/dist/builtin/web-access/package.json +2 -2
- package/dist/builtin/workflows/CHANGELOG.md +19 -0
- package/dist/builtin/workflows/builtin/{chunk-q7dx7kh7.js → chunk-85mx6wcf.js} +6 -6
- package/dist/builtin/workflows/builtin/{chunk-neszcj53.js → chunk-8kkv04hz.js} +15 -15
- package/dist/builtin/workflows/builtin/{chunk-g1a4hw0s.js → chunk-8x61e0s7.js} +13 -25
- package/dist/builtin/workflows/builtin/{chunk-2qgfyvzs.js → chunk-y45tkftg.js} +7 -7
- package/dist/builtin/workflows/builtin/goal.js +2 -2
- package/dist/builtin/workflows/builtin/index.js +4 -4
- package/dist/builtin/workflows/builtin/open-claude-design.js +1 -1
- package/dist/builtin/workflows/builtin/ralph.js +2 -2
- package/dist/builtin/workflows/package.json +2 -2
- package/dist/builtin/workflows/src/durable/journal/internal.d.ts +0 -19
- package/dist/builtin/workflows/src/durable/journal/memory-run-journal.d.ts +3 -11
- package/dist/builtin/workflows/src/durable/journal/resolution.d.ts +15 -9
- package/dist/builtin/workflows/src/durable/journal/types.d.ts +3 -93
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +992 -756
- package/dist/builtin/workflows/src/index.js +547 -394
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +1 -1
- package/dist/cli/args.d.ts +2 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +29 -3
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/session-picker.d.ts +1 -1
- package/dist/cli/session-picker.d.ts.map +1 -1
- package/dist/cli/session-picker.js +2 -2
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/core/agent-session-events.d.ts.map +1 -1
- package/dist/core/agent-session-events.js +6 -1
- package/dist/core/agent-session-events.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +4 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +44 -4
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +2 -2
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +1 -4
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +0 -4
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/pi-summary-fallback.d.ts.map +1 -1
- package/dist/core/compaction/pi-summary-fallback.js +1 -3
- package/dist/core/compaction/pi-summary-fallback.js.map +1 -1
- package/dist/core/extensions/loader-api.js +1 -1
- package/dist/core/extensions/loader-api.js.map +1 -1
- package/dist/core/extensions/runner-context.d.ts.map +1 -1
- package/dist/core/extensions/runner-context.js +7 -1
- package/dist/core/extensions/runner-context.js.map +1 -1
- package/dist/core/fast-model-routing.js +1 -1
- package/dist/core/fast-model-routing.js.map +1 -1
- package/dist/core/model-config.d.ts +765 -0
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +46 -24
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-resolver-defaults.js +1 -1
- package/dist/core/model-resolver-defaults.js.map +1 -1
- package/dist/core/resource-loader-reload.js +1 -1
- package/dist/core/resource-loader-reload.js.map +1 -1
- package/dist/core/resource-loader-types.d.ts +1 -1
- package/dist/core/resource-loader-types.d.ts.map +1 -1
- package/dist/core/resource-loader-types.js.map +1 -1
- package/dist/core/sdk-types.d.ts +4 -0
- package/dist/core/sdk-types.d.ts.map +1 -1
- package/dist/core/sdk-types.js.map +1 -1
- package/dist/core/sdk.d.ts +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +48 -19
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-lifecycle-work.d.ts +3 -0
- package/dist/core/session-lifecycle-work.d.ts.map +1 -1
- package/dist/core/session-lifecycle-work.js +2 -0
- package/dist/core/session-lifecycle-work.js.map +1 -1
- package/dist/core/session-manager-core.d.ts +7 -4
- package/dist/core/session-manager-core.d.ts.map +1 -1
- package/dist/core/session-manager-core.js +149 -41
- package/dist/core/session-manager-core.js.map +1 -1
- package/dist/core/session-manager-list.d.ts.map +1 -1
- package/dist/core/session-manager-list.js +7 -7
- package/dist/core/session-manager-list.js.map +1 -1
- package/dist/core/session-manager-storage.d.ts +3 -2
- package/dist/core/session-manager-storage.d.ts.map +1 -1
- package/dist/core/session-manager-storage.js +25 -9
- package/dist/core/session-manager-storage.js.map +1 -1
- package/dist/core/session-manager-types.d.ts +1 -1
- package/dist/core/session-manager-types.d.ts.map +1 -1
- package/dist/core/session-manager-types.js.map +1 -1
- package/dist/core/session-manager.d.ts +1 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +1 -1
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/session-resume-args.d.ts +4 -0
- package/dist/core/session-resume-args.d.ts.map +1 -0
- package/dist/core/session-resume-args.js +9 -0
- package/dist/core/session-resume-args.js.map +1 -0
- package/dist/core/session-storage.d.ts +26 -0
- package/dist/core/session-storage.d.ts.map +1 -0
- package/dist/core/session-storage.js +155 -0
- package/dist/core/session-storage.js.map +1 -0
- package/dist/core/session-store-list.d.ts +4 -0
- package/dist/core/session-store-list.d.ts.map +1 -0
- package/dist/core/session-store-list.js +28 -0
- package/dist/core/session-store-list.js.map +1 -0
- package/dist/core/settings-manager-basic-accessors.d.ts +0 -1
- package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
- package/dist/core/settings-manager-basic-accessors.js +0 -5
- package/dist/core/settings-manager-basic-accessors.js.map +1 -1
- package/dist/core/settings-merge.d.ts.map +1 -1
- package/dist/core/settings-merge.js +5 -0
- package/dist/core/settings-merge.js.map +1 -1
- package/dist/core/settings-schema.d.ts +74 -3
- package/dist/core/settings-schema.d.ts.map +1 -1
- package/dist/core/settings-schema.js +28 -14
- package/dist/core/settings-schema.js.map +1 -1
- package/dist/core/storage/errors.d.ts +1 -0
- package/dist/core/storage/errors.d.ts.map +1 -1
- package/dist/core/storage/errors.js.map +1 -1
- package/dist/core/storage/index.d.ts +4 -0
- package/dist/core/storage/index.d.ts.map +1 -1
- package/dist/core/storage/index.js +3 -0
- package/dist/core/storage/index.js.map +1 -1
- package/dist/core/storage/provider.d.ts +58 -0
- package/dist/core/storage/provider.d.ts.map +1 -0
- package/dist/core/storage/provider.js +243 -0
- package/dist/core/storage/provider.js.map +1 -0
- package/dist/core/storage/run-journal.d.ts +93 -0
- package/dist/core/storage/run-journal.d.ts.map +1 -0
- package/dist/core/storage/run-journal.js +15 -0
- package/dist/core/storage/run-journal.js.map +1 -0
- package/dist/core/storage/selection.d.ts +16 -0
- package/dist/core/storage/selection.d.ts.map +1 -0
- package/dist/core/storage/selection.js +87 -0
- package/dist/core/storage/selection.js.map +1 -0
- package/dist/core/storage/session/jsonl-session-store.d.ts +2 -0
- package/dist/core/storage/session/jsonl-session-store.d.ts.map +1 -1
- package/dist/core/storage/session/jsonl-session-store.js +58 -29
- package/dist/core/storage/session/jsonl-session-store.js.map +1 -1
- package/dist/core/storage/session/legacy-format.d.ts +18 -0
- package/dist/core/storage/session/legacy-format.d.ts.map +1 -0
- package/dist/core/storage/session/legacy-format.js +63 -0
- package/dist/core/storage/session/legacy-format.js.map +1 -0
- package/dist/core/storage/session/memory-session-store.d.ts +3 -1
- package/dist/core/storage/session/memory-session-store.d.ts.map +1 -1
- package/dist/core/storage/session/memory-session-store.js +9 -2
- package/dist/core/storage/session/memory-session-store.js.map +1 -1
- package/dist/core/storage/session/sql-session-store.d.ts +4 -1
- package/dist/core/storage/session/sql-session-store.d.ts.map +1 -1
- package/dist/core/storage/session/sql-session-store.js +25 -6
- package/dist/core/storage/session/sql-session-store.js.map +1 -1
- package/dist/core/storage/session/types.d.ts +4 -0
- package/dist/core/storage/session/types.d.ts.map +1 -1
- package/dist/core/storage/session/types.js.map +1 -1
- package/dist/core/tools/read-url.d.ts.map +1 -1
- package/dist/core/tools/read-url.js +6 -1
- package/dist/core/tools/read-url.js.map +1 -1
- package/dist/extensions/codemode/execute.d.ts.map +1 -1
- package/dist/extensions/codemode/execute.js +13 -0
- package/dist/extensions/codemode/execute.js.map +1 -1
- package/dist/extensions/herdr/index.d.ts.map +1 -1
- package/dist/extensions/herdr/index.js +5 -3
- package/dist/extensions/herdr/index.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/main-session.d.ts +5 -1
- package/dist/main-session.d.ts.map +1 -1
- package/dist/main-session.js +106 -45
- package/dist/main-session.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +49 -15
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts +3 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.js +15 -7
- package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-delete.d.ts +1 -1
- package/dist/modes/interactive/components/session-selector-delete.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-delete.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-list.d.ts +4 -4
- package/dist/modes/interactive/components/session-selector-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-list.js +13 -12
- package/dist/modes/interactive/components/session-selector-list.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts +1 -0
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +16 -5
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-helpers.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-helpers.js +6 -2
- package/dist/modes/interactive/interactive-mode-helpers.js.map +1 -1
- package/dist/modes/interactive/interactive-session-routing.js +19 -7
- package/dist/modes/interactive/interactive-session-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-slash-commands.js +3 -1
- package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
- package/dist/modes/interactive-engine/create-isolated-runtime.d.ts.map +1 -1
- package/dist/modes/interactive-engine/create-isolated-runtime.js +8 -1
- package/dist/modes/interactive-engine/create-isolated-runtime.js.map +1 -1
- package/dist/modes/interactive-engine/engine-args.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-args.js +5 -1
- package/dist/modes/interactive-engine/engine-args.js.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.js +21 -15
- package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
- package/dist/modes/rpc/rpc-client-process.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client-process.js +3 -1
- package/dist/modes/rpc/rpc-client-process.js.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.js +1 -1
- package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
- package/dist/modes/rpc/rpc-terminal-drain.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-terminal-drain.js +11 -2
- package/dist/modes/rpc/rpc-terminal-drain.js.map +1 -1
- package/dist/utils/canonical-path.d.ts +5 -0
- package/dist/utils/canonical-path.d.ts.map +1 -0
- package/dist/utils/canonical-path.js +26 -0
- package/dist/utils/canonical-path.js.map +1 -0
- package/dist/utils/paths.d.ts +1 -7
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +1 -15
- package/dist/utils/paths.js.map +1 -1
- package/docs/codemode.md +2 -0
- package/docs/compaction.md +2 -2
- package/docs/docs.json +1 -0
- package/docs/environment-variables.md +6 -2
- package/docs/getting-started/installation.md +1 -1
- package/docs/models/reference.md +2 -0
- package/docs/models-configuration.md +206 -0
- package/docs/models.md +11 -1
- package/docs/providers.md +2 -2
- package/docs/reference/cli.md +4 -0
- package/docs/sdk/web-server.md +3 -3
- package/docs/sdk.md +40 -3
- package/docs/session-format.md +30 -25
- package/docs/sessions.md +41 -17
- package/docs/settings.md +31 -9
- package/docs/storage.md +85 -2
- package/docs/workflows/api-reference.md +23 -15
- package/docs/workflows/operations.md +3 -3
- package/docs/workflows/reliable-design.md +16 -16
- package/npm-shrinkwrap.json +53 -53
- package/package.json +7 -6
- package/schemas/models.schema.json +62 -29
- package/schemas/settings.schema.json +136 -31
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/web-access",
|
|
3
|
-
"version": "0.9.38-alpha.
|
|
3
|
+
"version": "0.9.38-alpha.7",
|
|
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.
|
|
34
|
+
"@earendil-works/pi-tui": "^1.3.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependenciesMeta": {
|
|
37
37
|
"@bastani/atomic": {
|
|
@@ -6,6 +6,25 @@ 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.38-alpha.7] - 2026-10-17
|
|
10
|
+
|
|
11
|
+
### Breaking Changes
|
|
12
|
+
|
|
13
|
+
- Construct `JournalDurableBackend` with asynchronous `open()`; direct construction and internal synchronous journal methods have been removed.
|
|
14
|
+
- `RunOpts.journal.database` requires the async SQLite facade; wrap an existing native connection with `wrapNodeSqliteDatabase`. Journal selection errors now use `StorageConfigError` and its `source`, `field`, and `reason` fields instead of `JournalConfigurationError`.
|
|
15
|
+
- Replaced `forkFromSessionFile` with `forkFromSessionId`. Use the prior task's `sessionId` in the selected session store. `recordStageSession` now accepts `{ sessionId }` only. Retained chat validation and completed inspection are asynchronous, and transcript paths are display metadata, not resume or fork identities.
|
|
16
|
+
- Durable backend registration, status, reset, and checkpoint writes now use awaited `commit*` methods. Replace `registerWorkflow` with `commitWorkflowRegistration`, `setWorkflowStatus` with `commitWorkflowStatus`, `transitionWorkflowStatus` with `commitWorkflowStatusTransition`, `adjustPendingPrompts` with `commitPendingPromptAdjustment`, and `reset` with `commitReset`. Use `commitCheckpoint` instead of either checkpoint writer and `commitAdditiveCheckpointBestEffort` for additive writes. Cached `ctx.stage()` declarations remain synchronous; their replay metadata is committed before the next async execution boundary.
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- Added journal adapter module selection with environment/file secret references and shared `storage` settings. SDK options override environment, journal settings, shared storage, and persistent defaults; nearer settings replace complete selections. Caller-owned database selections accept the async SQLite facade and remain open after journal close.
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
|
|
24
|
+
- Workflow journal shutdown waits for queued writes before releasing ownership. Status claims and checkpoints on the same run remain ordered with asynchronous journals.
|
|
25
|
+
- Completed standalone SDK runs now release their stage sessions when no caller registry owns them. Workflow forks and completed-history inspection release temporary session-store connections while preserving caller-owned stores.
|
|
26
|
+
- Starting a workflow after a workflow's completed, failed, or blocked notice no longer fails with `Workflow execution for <runId> is retired`. Notices and late stage messages now reach the chat outside the finished run's execution context.
|
|
27
|
+
|
|
9
28
|
## [0.9.38-alpha.6] - 2026-10-16
|
|
10
29
|
|
|
11
30
|
### Breaking Changes
|
|
@@ -582,8 +582,8 @@ function isUiUnavailableRejection(error) {
|
|
|
582
582
|
|
|
583
583
|
// dist/builtin/workflows/builtin/open-claude-design-phases.ts
|
|
584
584
|
var GROUNDED_REPORTING2 = "Before reporting progress, audit each claim against a tool result from this session. Report only work you can point to evidence for; say so explicitly when something is unverified.";
|
|
585
|
-
function forkContinuationOptions(
|
|
586
|
-
return
|
|
585
|
+
function forkContinuationOptions(sessionId) {
|
|
586
|
+
return sessionId === undefined ? {} : { context: "fork", forkFromSessionId: sessionId };
|
|
587
587
|
}
|
|
588
588
|
async function refineOpenClaudeDesign(options) {
|
|
589
589
|
const { designContext, prompt, outputType, previewPath, previewFileUrl, browserBootstrapRules, designContextFile, referencesFile, designModelConfig, workflowCwd } = options;
|
|
@@ -621,12 +621,12 @@ async function refineOpenClaudeDesign(options) {
|
|
|
621
621
|
}
|
|
622
622
|
async function runLiveReviewSession(options) {
|
|
623
623
|
const { designContext, round, reviewStageName, previewPath, previewFileUrl, browserBootstrapRules, designModelConfig, workflowCwd } = options;
|
|
624
|
-
let
|
|
624
|
+
let sessionId;
|
|
625
625
|
const start = await designContext.task(`${reviewStageName}-start`, {
|
|
626
626
|
prompt: buildLiveSessionStartPrompt({ previewPath, previewFileUrl, browserBootstrapRules, round }),
|
|
627
627
|
...designModelConfig
|
|
628
628
|
});
|
|
629
|
-
|
|
629
|
+
sessionId = start.sessionId;
|
|
630
630
|
for (let index = 1;; index += 1) {
|
|
631
631
|
const event = await designContext.tool(`live-poll-${round}-${index}`, { round, index }, async ({ signal }) => pollLiveEvent({ workflowCwd, signal }));
|
|
632
632
|
if (event.type === "exit")
|
|
@@ -639,9 +639,9 @@ async function runLiveReviewSession(options) {
|
|
|
639
639
|
const response = await designContext.task(`live-${event.type}-${round}-${index}`, {
|
|
640
640
|
prompt: buildLiveEventPrompt({ event, previewPath }),
|
|
641
641
|
...designModelConfig,
|
|
642
|
-
...forkContinuationOptions(
|
|
642
|
+
...forkContinuationOptions(sessionId)
|
|
643
643
|
});
|
|
644
|
-
|
|
644
|
+
sessionId = response.sessionId ?? sessionId;
|
|
645
645
|
const status = replyTokenFor(event);
|
|
646
646
|
await designContext.tool(`live-reply-${round}-${index}`, { round, index, eventId: event.id, status }, async ({ signal }) => replyLiveEvent({ workflowCwd, event, status, signal }));
|
|
647
647
|
}
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
reviewerFailureText,
|
|
40
40
|
summarizeReviewConvergence,
|
|
41
41
|
reverify_consolidated_batch
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-8x61e0s7.js";
|
|
43
43
|
import {
|
|
44
44
|
fold_usage
|
|
45
45
|
} from "./chunk-tgt0s5e5.js";
|
|
@@ -257,8 +257,8 @@ async function writeJsonArtifact(path, content) {
|
|
|
257
257
|
function compactReviewReport(path) {
|
|
258
258
|
return path === undefined ? "No reviewer artifact was produced." : `Latest review round artifact: ${path}`;
|
|
259
259
|
}
|
|
260
|
-
function forkContinuationOptions(
|
|
261
|
-
return
|
|
260
|
+
function forkContinuationOptions(sessionId) {
|
|
261
|
+
return sessionId === undefined ? {} : { context: "fork", forkFromSessionId: sessionId };
|
|
262
262
|
}
|
|
263
263
|
function renderResearchPromptRefinementPrompt(args) {
|
|
264
264
|
return taggedPrompt([
|
|
@@ -530,15 +530,15 @@ async function runRalphWorkflow(ctx, options) {
|
|
|
530
530
|
const artifactDir = await createWorkflowArtifactDirectory(runId);
|
|
531
531
|
let approved = false;
|
|
532
532
|
let iterationsCompleted = 0;
|
|
533
|
-
let
|
|
533
|
+
let previousResearchPromptRefinementSessionId;
|
|
534
534
|
const convergenceEntries = [];
|
|
535
|
-
let
|
|
536
|
-
let
|
|
535
|
+
let previousResearchSessionId;
|
|
536
|
+
let previousOrchestratorSessionId;
|
|
537
537
|
for (let iteration = 1;iteration <= maxLoops; iteration += 1) {
|
|
538
538
|
iterationsCompleted = iteration;
|
|
539
|
-
const researchPromptRefinementForkOptions = forkContinuationOptions(
|
|
539
|
+
const researchPromptRefinementForkOptions = forkContinuationOptions(previousResearchPromptRefinementSessionId);
|
|
540
540
|
const researchPromptRefinement = await ctx.task(`research-prompt-refinement-${iteration}`, {
|
|
541
|
-
prompt: researchPromptRefinementForkOptions.
|
|
541
|
+
prompt: researchPromptRefinementForkOptions.forkFromSessionId === undefined ? renderResearchPromptRefinementPrompt({
|
|
542
542
|
request: workflowPrompt,
|
|
543
543
|
acceptanceCriteria,
|
|
544
544
|
workflowCwdContext,
|
|
@@ -548,11 +548,11 @@ async function runRalphWorkflow(ctx, options) {
|
|
|
548
548
|
...promptEngineerModelConfig,
|
|
549
549
|
...researchPromptRefinementForkOptions
|
|
550
550
|
});
|
|
551
|
-
|
|
551
|
+
previousResearchPromptRefinementSessionId = researchPromptRefinement.sessionId;
|
|
552
552
|
finalPlan = researchPromptRefinement.text;
|
|
553
|
-
const researchForkOptions = forkContinuationOptions(
|
|
553
|
+
const researchForkOptions = forkContinuationOptions(previousResearchSessionId);
|
|
554
554
|
const research = await ctx.task(`research-${iteration}`, {
|
|
555
|
-
prompt: researchForkOptions.
|
|
555
|
+
prompt: researchForkOptions.forkFromSessionId === undefined ? renderResearchPrompt({
|
|
556
556
|
transformedResearchQuestion: researchPromptRefinement.text,
|
|
557
557
|
prompt: workflowPrompt,
|
|
558
558
|
acceptanceCriteria,
|
|
@@ -568,14 +568,14 @@ async function runRalphWorkflow(ctx, options) {
|
|
|
568
568
|
...researchModelConfig,
|
|
569
569
|
...researchForkOptions
|
|
570
570
|
});
|
|
571
|
-
|
|
571
|
+
previousResearchSessionId = research.sessionId;
|
|
572
572
|
finalResearch = research.text || `Research artifact: ${workflowResearchPath}`;
|
|
573
573
|
const researchPath = workflowResearchPath;
|
|
574
574
|
finalResearchPath = researchPath;
|
|
575
575
|
finalPlanPath = researchPath;
|
|
576
576
|
const orchestratorReportPath = join2(artifactDir, "orchestrator-report.md");
|
|
577
|
-
const orchestratorForkOptions = forkContinuationOptions(
|
|
578
|
-
const orchestratorPrompt = orchestratorForkOptions.
|
|
577
|
+
const orchestratorForkOptions = forkContinuationOptions(previousOrchestratorSessionId);
|
|
578
|
+
const orchestratorPrompt = orchestratorForkOptions.forkFromSessionId === undefined ? taggedPrompt([
|
|
579
579
|
["acceptance_criteria", keepContext(acceptanceCriteria)],
|
|
580
580
|
["literal_contract", LITERAL_OBJECTIVE_CONTRACT],
|
|
581
581
|
["acceptance_matrix", ACCEPTANCE_MATRIX_CONTRACT],
|
|
@@ -654,7 +654,7 @@ Read it before implementation or delegation because it is the primary current im
|
|
|
654
654
|
...orchestratorModelConfig,
|
|
655
655
|
...orchestratorForkOptions
|
|
656
656
|
});
|
|
657
|
-
|
|
657
|
+
previousOrchestratorSessionId = orchestrator.sessionId;
|
|
658
658
|
finalResult = orchestrator.text || `Orchestrator report artifact: ${orchestratorReportPath}`;
|
|
659
659
|
const reviewPrompt = renderRalphReviewerPrompt({
|
|
660
660
|
workflowPrompt,
|
|
@@ -134,18 +134,15 @@ class ScopedDurableBackend {
|
|
|
134
134
|
async hasPendingStageDeliveryReceipt(workflowId, messageId, delivery, logicalRunId = workflowId) {
|
|
135
135
|
return await this.inner.hasPendingStageDeliveryReceipt?.(this.scope.rootWorkflowId, messageId, delivery, logicalRunId) ?? false;
|
|
136
136
|
}
|
|
137
|
-
|
|
137
|
+
async commitWorkflowRegistration(_handle) {}
|
|
138
138
|
persistPendingStageMessages(workflowId, messages, logicalRunId = workflowId) {
|
|
139
139
|
return this.inner.persistPendingStageMessages(this.scope.rootWorkflowId, messages, logicalRunId);
|
|
140
140
|
}
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
async commitCheckpoint(checkpoint, options) {
|
|
142
|
+
await this.inner.commitCheckpoint(this.remap(checkpoint), options);
|
|
143
143
|
}
|
|
144
|
-
async
|
|
145
|
-
await this.inner.
|
|
146
|
-
}
|
|
147
|
-
async recordAdditiveCheckpointBestEffort(checkpoint) {
|
|
148
|
-
return await this.inner.recordAdditiveCheckpointBestEffort(this.remap(checkpoint));
|
|
144
|
+
async commitAdditiveCheckpointBestEffort(checkpoint) {
|
|
145
|
+
return await this.inner.commitAdditiveCheckpointBestEffort(this.remap(checkpoint));
|
|
149
146
|
}
|
|
150
147
|
workflowOwnership(_workflowId) {
|
|
151
148
|
return this.inner.workflowOwnership(this.scope.rootWorkflowId);
|
|
@@ -175,12 +172,12 @@ class ScopedDurableBackend {
|
|
|
175
172
|
getLoadableWorkflow(_workflowId) {
|
|
176
173
|
return;
|
|
177
174
|
}
|
|
178
|
-
|
|
179
|
-
async
|
|
175
|
+
async commitWorkflowStatus(_workflowId, _status, _pendingPrompts, _resumable) {}
|
|
176
|
+
async commitWorkflowStatusTransition(_workflowId, _expectedStatuses, _status, _pendingPrompts, _resumable) {
|
|
180
177
|
return false;
|
|
181
178
|
}
|
|
182
|
-
|
|
183
|
-
return this.inner.
|
|
179
|
+
commitPendingPromptAdjustment(_workflowId, delta) {
|
|
180
|
+
return this.inner.commitPendingPromptAdjustment(this.scope.rootWorkflowId, delta);
|
|
184
181
|
}
|
|
185
182
|
promptReservationScope(_workflowId) {
|
|
186
183
|
return this.effectivePromptScope();
|
|
@@ -213,7 +210,7 @@ class ScopedDurableBackend {
|
|
|
213
210
|
isWorkflowLoadable(_workflowId) {
|
|
214
211
|
return false;
|
|
215
212
|
}
|
|
216
|
-
|
|
213
|
+
async commitReset() {}
|
|
217
214
|
hydrateWorkflow(_workflowId) {
|
|
218
215
|
return Promise.resolve();
|
|
219
216
|
}
|
|
@@ -343,6 +340,7 @@ function durableBackendForRun(backend, runs, runId) {
|
|
|
343
340
|
// dist/builtin/workflows/src/durable/journal/types.ts
|
|
344
341
|
import { StorageSchemaVersionError } from "@bastani/atomic/storage";
|
|
345
342
|
import { StorageUnavailableError } from "@bastani/atomic/storage";
|
|
343
|
+
import { RUN_EVENT_TYPES } from "@bastani/atomic/storage";
|
|
346
344
|
class JournalError extends Error {
|
|
347
345
|
}
|
|
348
346
|
|
|
@@ -2437,19 +2435,9 @@ function createStageStoreMethods(context) {
|
|
|
2437
2435
|
if (!run)
|
|
2438
2436
|
return false;
|
|
2439
2437
|
const stage = context.findStage(run, stageId);
|
|
2440
|
-
if (!stage)
|
|
2441
|
-
return false;
|
|
2442
|
-
let changed = false;
|
|
2443
|
-
if (session.sessionId !== undefined && stage.sessionId !== session.sessionId) {
|
|
2444
|
-
stage.sessionId = session.sessionId;
|
|
2445
|
-
changed = true;
|
|
2446
|
-
}
|
|
2447
|
-
if (session.sessionFile !== undefined && stage.sessionFile !== session.sessionFile) {
|
|
2448
|
-
stage.sessionFile = session.sessionFile;
|
|
2449
|
-
changed = true;
|
|
2450
|
-
}
|
|
2451
|
-
if (!changed)
|
|
2438
|
+
if (!stage || stage.sessionId === session.sessionId)
|
|
2452
2439
|
return false;
|
|
2440
|
+
stage.sessionId = session.sessionId;
|
|
2453
2441
|
context.bumpAndNotify();
|
|
2454
2442
|
return true;
|
|
2455
2443
|
},
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
parseFailureDiagnostics,
|
|
38
38
|
summarizeReviewConvergence,
|
|
39
39
|
reverify_consolidated_batch
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-8x61e0s7.js";
|
|
41
41
|
import {
|
|
42
42
|
VERIFICATION_SCALE
|
|
43
43
|
} from "./chunk-n1910xc4.js";
|
|
@@ -822,8 +822,8 @@ function positiveInteger(value, fallback) {
|
|
|
822
822
|
const floored = Math.floor(value);
|
|
823
823
|
return floored >= 1 ? floored : fallback;
|
|
824
824
|
}
|
|
825
|
-
function forkContinuationOptions(
|
|
826
|
-
return
|
|
825
|
+
function forkContinuationOptions(sessionId) {
|
|
826
|
+
return sessionId === undefined ? {} : { context: "fork", forkFromSessionId: sessionId };
|
|
827
827
|
}
|
|
828
828
|
function normalizeBranchInput(value, fallback) {
|
|
829
829
|
const trimmed = value?.trim();
|
|
@@ -855,7 +855,7 @@ async function runGoalWorkflow(ctx, options) {
|
|
|
855
855
|
let latestReviews = [];
|
|
856
856
|
let latestReviewArtifactPaths = [];
|
|
857
857
|
let latestReviewReportPath;
|
|
858
|
-
let
|
|
858
|
+
let previousOrchestratorSessionId;
|
|
859
859
|
const recordedTurns = new Set(ledger.decisions.map((decision) => decision.turn));
|
|
860
860
|
const lastRecordedTurn = Math.max(0, ...recordedTurns);
|
|
861
861
|
for (let turn = 1;turn <= maxTurns && (ledger.status === "active" || turn <= lastRecordedTurn); turn += 1) {
|
|
@@ -866,8 +866,8 @@ async function runGoalWorkflow(ctx, options) {
|
|
|
866
866
|
await writeGoalLedger(ledgerPath, ledger);
|
|
867
867
|
}
|
|
868
868
|
const orchestratorReceiptPath = join3(artifactDir, "orchestrator-receipt.md");
|
|
869
|
-
const orchestratorForkOptions = forkContinuationOptions(
|
|
870
|
-
const orchestratorPrompt = orchestratorForkOptions.
|
|
869
|
+
const orchestratorForkOptions = forkContinuationOptions(previousOrchestratorSessionId);
|
|
870
|
+
const orchestratorPrompt = orchestratorForkOptions.forkFromSessionId === undefined ? renderGoalOrchestratorPrompt({
|
|
871
871
|
ledger,
|
|
872
872
|
ledgerPath,
|
|
873
873
|
blockerThreshold,
|
|
@@ -882,7 +882,7 @@ async function runGoalWorkflow(ctx, options) {
|
|
|
882
882
|
...orchestratorModelConfig,
|
|
883
883
|
...orchestratorForkOptions
|
|
884
884
|
});
|
|
885
|
-
|
|
885
|
+
previousOrchestratorSessionId = orchestrator.sessionId;
|
|
886
886
|
if (!replayingRecordedTurn) {
|
|
887
887
|
ledger.turns = turn;
|
|
888
888
|
const receiptAlreadyRecorded = ledger.receipts.some((receipt) => receipt.turn === turn && receipt.artifact_path === orchestratorReceiptPath);
|
|
@@ -16,18 +16,18 @@ import {
|
|
|
16
16
|
} from "./chunk-5eh0brtd.js";
|
|
17
17
|
import {
|
|
18
18
|
goal_default
|
|
19
|
-
} from "./chunk-
|
|
20
|
-
import"./chunk-
|
|
19
|
+
} from "./chunk-y45tkftg.js";
|
|
20
|
+
import"./chunk-8x61e0s7.js";
|
|
21
21
|
import"./chunk-z0d03ktm.js";
|
|
22
22
|
import {
|
|
23
23
|
open_claude_design_default
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-85mx6wcf.js";
|
|
25
25
|
import {
|
|
26
26
|
loop_until_done_default
|
|
27
27
|
} from "./chunk-454hz1qt.js";
|
|
28
28
|
import {
|
|
29
29
|
ralph_default
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-8kkv04hz.js";
|
|
31
31
|
import {
|
|
32
32
|
tournament_default
|
|
33
33
|
} from "./chunk-4bwtzyjq.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/workflows",
|
|
3
|
-
"version": "0.9.38-alpha.
|
|
3
|
+
"version": "0.9.38-alpha.7",
|
|
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.
|
|
88
|
+
"@earendil-works/pi-tui": "^1.3.0",
|
|
89
89
|
"typebox": "*"
|
|
90
90
|
},
|
|
91
91
|
"peerDependenciesMeta": {
|
|
@@ -1,20 +1 @@
|
|
|
1
|
-
import type { AppendOutcome, JournalEntry, Lease, LeaseOutcome, LeaseState, RunEvent, RunHeader, RunJournal, RunSummary } from "./types.js";
|
|
2
1
|
export declare const JOURNAL_READ_PAGE_SIZE = 256;
|
|
3
|
-
export interface SynchronousRunJournal {
|
|
4
|
-
createRunSync(header: RunHeader): "created" | "exists";
|
|
5
|
-
listRunsSync(filter?: {
|
|
6
|
-
cwd?: string;
|
|
7
|
-
}): readonly RunSummary[];
|
|
8
|
-
takeoverExpiredSync(runId: string, holderId: string, staleAfterMs: number): LeaseOutcome;
|
|
9
|
-
leaseStateSync(runId: string): LeaseState | undefined;
|
|
10
|
-
renewSync(lease: Lease): void;
|
|
11
|
-
releaseSync(lease: Lease): void;
|
|
12
|
-
appendSync(lease: Lease, event: RunEvent, options?: {
|
|
13
|
-
key?: string;
|
|
14
|
-
expectSeq?: number;
|
|
15
|
-
}): AppendOutcome;
|
|
16
|
-
readEntries(runId: string, fromSeq?: number): readonly JournalEntry[];
|
|
17
|
-
deleteRunSync(runId: string): void;
|
|
18
|
-
}
|
|
19
|
-
export declare function registerSynchronousJournal(journal: RunJournal, synchronous: SynchronousRunJournal): void;
|
|
20
|
-
export declare function synchronousJournal(journal: RunJournal): SynchronousRunJournal | undefined;
|
|
@@ -1,43 +1,35 @@
|
|
|
1
|
+
import type { StorageDescriptor } from "@bastani/atomic/storage";
|
|
1
2
|
import { type AppendOutcome, type JournalEntry, type Lease, type LeaseOutcome, type LeaseState, type RunEvent, type RunHeader, type RunJournal, type RunSummary } from "./types.js";
|
|
2
3
|
export declare class MemoryRunJournal implements RunJournal {
|
|
3
4
|
private readonly runs;
|
|
4
5
|
private readonly leases;
|
|
5
6
|
private closed;
|
|
6
|
-
|
|
7
|
+
private readonly storage?;
|
|
8
|
+
constructor(storage?: StorageDescriptor);
|
|
7
9
|
private ensureOpen;
|
|
8
10
|
createRun(header: RunHeader): Promise<"created" | "exists">;
|
|
9
|
-
private createRunSync;
|
|
10
11
|
getRun(runId: string): Promise<RunSummary | undefined>;
|
|
11
12
|
listRuns(filter?: {
|
|
12
13
|
cwd?: string;
|
|
13
14
|
}): Promise<readonly RunSummary[]>;
|
|
14
|
-
private listRunsSync;
|
|
15
15
|
private requireRun;
|
|
16
16
|
private grant;
|
|
17
17
|
acquire(runId: string, holderId: string): Promise<LeaseOutcome>;
|
|
18
|
-
private acquireSync;
|
|
19
18
|
takeover(runId: string, holderId: string, expectedHolder: string): Promise<LeaseOutcome>;
|
|
20
19
|
takeoverExpired(runId: string, holderId: string, staleAfterMs: number): Promise<LeaseOutcome>;
|
|
21
|
-
private takeoverExpiredSync;
|
|
22
20
|
leaseState(runId: string): Promise<LeaseState | undefined>;
|
|
23
|
-
private leaseStateSync;
|
|
24
21
|
private checkLease;
|
|
25
22
|
renew(lease: Lease): Promise<void>;
|
|
26
|
-
private renewSync;
|
|
27
23
|
release(lease: Lease): Promise<void>;
|
|
28
|
-
private releaseSync;
|
|
29
24
|
append(lease: Lease, event: RunEvent, options?: {
|
|
30
25
|
key?: string;
|
|
31
26
|
expectSeq?: number;
|
|
32
27
|
}): Promise<AppendOutcome>;
|
|
33
|
-
private appendSync;
|
|
34
28
|
private copyEntry;
|
|
35
29
|
read(runId: string, fromSeq?: number): AsyncIterable<JournalEntry>;
|
|
36
30
|
private readPage;
|
|
37
|
-
private readEntries;
|
|
38
31
|
readKey(runId: string, key: string): Promise<JournalEntry | undefined>;
|
|
39
32
|
deleteRun(runId: string): Promise<void>;
|
|
40
|
-
private deleteRunSync;
|
|
41
33
|
deleteOwnedRun(lease: Lease, expectSeq?: number): Promise<void>;
|
|
42
34
|
close(): Promise<void>;
|
|
43
35
|
}
|
|
@@ -1,26 +1,32 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import {
|
|
1
|
+
import { type AdapterOptions, type SecretRef, type SqliteDatabase, type StorageSelection, type StorageSettingsSelection } from "@bastani/atomic/storage";
|
|
2
|
+
import type { RunJournal } from "./types.js";
|
|
3
3
|
export type RunJournalOption = {
|
|
4
4
|
path: string;
|
|
5
|
+
prefix?: string;
|
|
5
6
|
} | {
|
|
6
|
-
database:
|
|
7
|
+
database: SqliteDatabase;
|
|
8
|
+
prefix?: string;
|
|
7
9
|
} | {
|
|
8
10
|
memory: true;
|
|
11
|
+
} | {
|
|
12
|
+
adapter: string;
|
|
13
|
+
options?: AdapterOptions;
|
|
14
|
+
secrets?: Readonly<Record<string, SecretRef>>;
|
|
15
|
+
prefix?: string;
|
|
9
16
|
} | RunJournal;
|
|
10
17
|
export interface RunJournalSettings {
|
|
11
18
|
workflows?: string[] | {
|
|
12
|
-
journal?:
|
|
13
|
-
path?: string;
|
|
14
|
-
memory?: boolean;
|
|
15
|
-
};
|
|
19
|
+
journal?: StorageSettingsSelection;
|
|
16
20
|
};
|
|
21
|
+
storage?: StorageSettingsSelection;
|
|
17
22
|
}
|
|
18
|
-
/** Resolve configuration without opening storage, so callers can reuse an existing selection. */
|
|
19
23
|
export declare function selectRunJournal(options?: {
|
|
20
24
|
journal?: RunJournalOption;
|
|
21
25
|
settings?: RunJournalSettings;
|
|
22
|
-
}):
|
|
26
|
+
}): StorageSelection | RunJournal;
|
|
23
27
|
export declare function resolveRunJournal(options?: {
|
|
24
28
|
journal?: RunJournalOption;
|
|
25
29
|
settings?: RunJournalSettings;
|
|
26
30
|
}): Promise<RunJournal>;
|
|
31
|
+
export declare function openSelectedRunJournal(selection: StorageSelection | RunJournal): Promise<RunJournal>;
|
|
32
|
+
export declare function withRunJournalConfigSource<T>(selection: StorageSelection | RunJournal, open: () => Promise<T>): Promise<T>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { RunEventType } from "@bastani/atomic/storage";
|
|
1
2
|
import { StorageSchemaVersionError } from "@bastani/atomic/storage";
|
|
2
|
-
import type { WorkflowSerializableValue } from "../../shared/authoring-contract-stage.js";
|
|
3
3
|
export { StorageUnavailableError } from "@bastani/atomic/storage";
|
|
4
4
|
export declare const JOURNAL_SCHEMA_VERSION = 1;
|
|
5
5
|
export type JournalSchemaVersion = typeof JOURNAL_SCHEMA_VERSION;
|
|
@@ -37,66 +37,8 @@ export declare const JOURNAL_LEASE: {
|
|
|
37
37
|
readonly absentEpoch: 0;
|
|
38
38
|
};
|
|
39
39
|
export type JournalLeaseSemantics = typeof JOURNAL_LEASE;
|
|
40
|
-
export
|
|
41
|
-
|
|
42
|
-
readonly runFinished: "RunFinished";
|
|
43
|
-
readonly statusChanged: "StatusChanged";
|
|
44
|
-
readonly checkpointRecorded: "CheckpointRecorded";
|
|
45
|
-
readonly promptAsked: "PromptAsked";
|
|
46
|
-
readonly promptReleased: "PromptReleased";
|
|
47
|
-
readonly controlRequested: "ControlRequested";
|
|
48
|
-
readonly messageQueued: "MessageQueued";
|
|
49
|
-
readonly messageDelivered: "MessageDelivered";
|
|
50
|
-
readonly messageSettled: "MessageSettled";
|
|
51
|
-
readonly timerScheduled: "TimerScheduled";
|
|
52
|
-
readonly summaryRecorded: "SummaryRecorded";
|
|
53
|
-
};
|
|
54
|
-
export type RunEventType = (typeof RUN_EVENT_TYPES)[keyof typeof RUN_EVENT_TYPES];
|
|
55
|
-
export interface RunHeader {
|
|
56
|
-
readonly runId: string;
|
|
57
|
-
readonly name: string;
|
|
58
|
-
readonly cwd: string;
|
|
59
|
-
readonly createdAt: number;
|
|
60
|
-
readonly status: string;
|
|
61
|
-
readonly inputs?: WorkflowSerializableValue;
|
|
62
|
-
}
|
|
63
|
-
export type RunSummary = RunHeader;
|
|
64
|
-
type EventOf<Type extends string, Payload = WorkflowSerializableValue> = {
|
|
65
|
-
readonly type: Type;
|
|
66
|
-
readonly payload: Payload;
|
|
67
|
-
};
|
|
68
|
-
export type RunEvent = EventOf<typeof RUN_EVENT_TYPES.runStarted | typeof RUN_EVENT_TYPES.runFinished> | EventOf<typeof RUN_EVENT_TYPES.statusChanged, {
|
|
69
|
-
readonly status: string;
|
|
70
|
-
readonly [key: string]: WorkflowSerializableValue;
|
|
71
|
-
}> | EventOf<typeof RUN_EVENT_TYPES.checkpointRecorded, {
|
|
72
|
-
readonly kind: "tool" | "ui" | "stage" | "task" | "boundary";
|
|
73
|
-
readonly [key: string]: WorkflowSerializableValue;
|
|
74
|
-
}> | EventOf<typeof RUN_EVENT_TYPES.promptAsked | typeof RUN_EVENT_TYPES.promptReleased | typeof RUN_EVENT_TYPES.controlRequested> | EventOf<typeof RUN_EVENT_TYPES.messageQueued | typeof RUN_EVENT_TYPES.messageDelivered | typeof RUN_EVENT_TYPES.messageSettled | typeof RUN_EVENT_TYPES.timerScheduled | typeof RUN_EVENT_TYPES.summaryRecorded>;
|
|
75
|
-
export interface Lease {
|
|
76
|
-
readonly runId: string;
|
|
77
|
-
readonly holderId: string;
|
|
78
|
-
readonly epoch: number;
|
|
79
|
-
}
|
|
80
|
-
export type LeaseState = Lease & {
|
|
81
|
-
readonly renewedAt: number;
|
|
82
|
-
readonly ageMs: number;
|
|
83
|
-
};
|
|
84
|
-
export type LeaseOutcome = {
|
|
85
|
-
readonly status: "acquired";
|
|
86
|
-
readonly lease: Lease;
|
|
87
|
-
} | {
|
|
88
|
-
readonly status: "held";
|
|
89
|
-
readonly holderId: string | null;
|
|
90
|
-
readonly epoch: number;
|
|
91
|
-
};
|
|
92
|
-
export interface JournalEntry {
|
|
93
|
-
readonly runId: string;
|
|
94
|
-
readonly seq: number;
|
|
95
|
-
readonly epoch: number;
|
|
96
|
-
readonly key?: string;
|
|
97
|
-
readonly event: RunEvent;
|
|
98
|
-
readonly at: number;
|
|
99
|
-
}
|
|
40
|
+
export type { AppendOutcome, JournalEntry, Lease, LeaseOutcome, LeaseState, RunEvent, RunEventType, RunHeader, RunJournal, RunSummary, } from "@bastani/atomic/storage";
|
|
41
|
+
export { RUN_EVENT_TYPES } from "@bastani/atomic/storage";
|
|
100
42
|
export interface JournalLeaseRow {
|
|
101
43
|
[JOURNAL_COLUMNS.holderId]: string | null;
|
|
102
44
|
[JOURNAL_COLUMNS.epoch]: number;
|
|
@@ -110,43 +52,11 @@ export interface JournalEventRow {
|
|
|
110
52
|
[JOURNAL_COLUMNS.payload]: string;
|
|
111
53
|
[JOURNAL_COLUMNS.at]: number;
|
|
112
54
|
}
|
|
113
|
-
export type AppendOutcome = {
|
|
114
|
-
readonly status: "appended" | "exists";
|
|
115
|
-
readonly entry: JournalEntry;
|
|
116
|
-
};
|
|
117
|
-
export interface RunJournal {
|
|
118
|
-
createRun(header: RunHeader): Promise<"created" | "exists">;
|
|
119
|
-
getRun(runId: string): Promise<RunSummary | undefined>;
|
|
120
|
-
listRuns(filter?: {
|
|
121
|
-
cwd?: string;
|
|
122
|
-
}): Promise<readonly RunSummary[]>;
|
|
123
|
-
acquire(runId: string, holderId: string): Promise<LeaseOutcome>;
|
|
124
|
-
takeover(runId: string, holderId: string, expectedHolder: string): Promise<LeaseOutcome>;
|
|
125
|
-
takeoverExpired(runId: string, holderId: string, staleAfterMs: number): Promise<LeaseOutcome>;
|
|
126
|
-
leaseState(runId: string): Promise<LeaseState | undefined>;
|
|
127
|
-
renew(lease: Lease): Promise<void>;
|
|
128
|
-
release(lease: Lease): Promise<void>;
|
|
129
|
-
append(lease: Lease, event: RunEvent, options?: {
|
|
130
|
-
key?: string;
|
|
131
|
-
expectSeq?: number;
|
|
132
|
-
}): Promise<AppendOutcome>;
|
|
133
|
-
read(runId: string, fromSeq?: number): AsyncIterable<JournalEntry>;
|
|
134
|
-
readKey(runId: string, key: string): Promise<JournalEntry | undefined>;
|
|
135
|
-
deleteOwnedRun(lease: Lease, expectSeq?: number): Promise<void>;
|
|
136
|
-
deleteRun(runId: string): Promise<void>;
|
|
137
|
-
close(): Promise<void>;
|
|
138
|
-
}
|
|
139
55
|
export declare class JournalError extends Error {
|
|
140
56
|
}
|
|
141
57
|
export declare class JournalClosedError extends JournalError {
|
|
142
58
|
constructor();
|
|
143
59
|
}
|
|
144
|
-
export declare class JournalConfigurationError extends JournalError {
|
|
145
|
-
readonly source: "settings";
|
|
146
|
-
readonly setting: "workflows.journal";
|
|
147
|
-
readonly reason: "path-and-memory";
|
|
148
|
-
constructor(source: "settings", setting: "workflows.journal", reason: "path-and-memory");
|
|
149
|
-
}
|
|
150
60
|
export declare class JournalInvalidTextError extends JournalError {
|
|
151
61
|
readonly field: "runId" | "holderId" | "expectedHolder" | "key" | "status" | "name" | "cwd";
|
|
152
62
|
readonly reason: "nul-character" | "ill-formed-unicode";
|