@bastani/atomic 0.9.8 → 0.9.9-alpha.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.
- package/CHANGELOG.md +28 -0
- package/dist/builtin/cursor/CHANGELOG.md +6 -0
- package/dist/builtin/cursor/package.json +2 -2
- package/dist/builtin/intercom/CHANGELOG.md +6 -0
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/CHANGELOG.md +6 -0
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +6 -0
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/src/runs/background/async-execution-chain.ts +2 -0
- package/dist/builtin/subagents/src/runs/background/async-execution-common.ts +7 -1
- package/dist/builtin/subagents/src/runs/background/async-execution-single.ts +2 -0
- package/dist/builtin/subagents/src/runs/background/async-execution-types.ts +8 -2
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-parallel-runner.ts +2 -0
- package/dist/builtin/subagents/src/runs/foreground/chain-execution-sequential-step.ts +2 -0
- package/dist/builtin/subagents/src/runs/foreground/execution-attempt.ts +2 -1
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-async.ts +2 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-parallel-task.ts +2 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-resume.ts +2 -0
- package/dist/builtin/subagents/src/runs/foreground/subagent-executor-single.ts +2 -0
- package/dist/builtin/subagents/src/runs/shared/pi-args.ts +6 -0
- package/dist/builtin/subagents/src/shared/types-config.ts +4 -0
- package/dist/builtin/subagents/src/shared/types-depth.ts +29 -2
- package/dist/builtin/web-access/CHANGELOG.md +6 -0
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +22 -0
- package/dist/builtin/workflows/README.md +17 -8
- package/dist/builtin/workflows/builtin/goal-prompts.ts +8 -2
- package/dist/builtin/workflows/builtin/open-claude-design-utils.ts +26 -9
- package/dist/builtin/workflows/builtin/ralph-forked-prompts.ts +1 -1
- package/dist/builtin/workflows/builtin/ralph-reviewer-prompt.ts +8 -3
- package/dist/builtin/workflows/builtin/ralph-runner.ts +2 -0
- package/dist/builtin/workflows/builtin/shared-prompts.ts +24 -1
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/src/durable/backend.ts +53 -15
- package/dist/builtin/workflows/src/durable/completed-catalog.ts +245 -0
- package/dist/builtin/workflows/src/durable/completed-inspection.ts +213 -0
- package/dist/builtin/workflows/src/durable/dbos-backend.ts +120 -170
- package/dist/builtin/workflows/src/durable/dbos-envelope.ts +84 -8
- package/dist/builtin/workflows/src/durable/dbos-metadata.ts +98 -0
- package/dist/builtin/workflows/src/durable/dbos-tombstone.ts +27 -0
- package/dist/builtin/workflows/src/durable/factory.ts +1 -1
- package/dist/builtin/workflows/src/durable/file-backend.ts +247 -241
- package/dist/builtin/workflows/src/durable/file-lock.ts +153 -0
- package/dist/builtin/workflows/src/durable/file-state.ts +104 -0
- package/dist/builtin/workflows/src/durable/format-version.ts +12 -0
- package/dist/builtin/workflows/src/durable/index.ts +12 -0
- package/dist/builtin/workflows/src/durable/resume-catalog.ts +16 -27
- package/dist/builtin/workflows/src/durable/resume-eligibility.ts +20 -0
- package/dist/builtin/workflows/src/durable/resume-runtime.ts +29 -29
- package/dist/builtin/workflows/src/durable/scoped-backend.ts +20 -3
- package/dist/builtin/workflows/src/durable/stage-primitive.ts +29 -8
- package/dist/builtin/workflows/src/durable/types.ts +3 -0
- package/dist/builtin/workflows/src/engine/primitives/task.ts +1 -0
- package/dist/builtin/workflows/src/engine/run.ts +14 -14
- package/dist/builtin/workflows/src/extension/extension-lifecycle.ts +39 -9
- package/dist/builtin/workflows/src/extension/extension-runtime-state.ts +10 -0
- package/dist/builtin/workflows/src/extension/runtime-durable-resume.ts +133 -0
- package/dist/builtin/workflows/src/extension/runtime.ts +15 -40
- package/dist/builtin/workflows/src/extension/wiring.ts +9 -6
- package/dist/builtin/workflows/src/extension/workflow-durable-resume-command.ts +226 -0
- package/dist/builtin/workflows/src/extension/workflow-prompts.ts +1 -0
- package/dist/builtin/workflows/src/extension/workflow-run-control-command.ts +66 -112
- package/dist/builtin/workflows/src/extension/workflow-schema.ts +5 -5
- package/dist/builtin/workflows/src/extension/workflow-tool-control.ts +16 -1
- package/dist/builtin/workflows/src/runs/foreground/executor-direct-helpers.ts +50 -43
- package/dist/builtin/workflows/src/runs/foreground/executor-direct-output.ts +91 -0
- package/dist/builtin/workflows/src/runs/foreground/executor-direct.ts +95 -46
- package/dist/builtin/workflows/src/runs/foreground/executor-stage-call.ts +3 -1
- package/dist/builtin/workflows/src/runs/foreground/executor-task-prompts.ts +1 -1
- package/dist/builtin/workflows/src/runs/foreground/executor-types.ts +3 -0
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-controller.ts +1 -1
- package/dist/builtin/workflows/src/runs/foreground/stage-runner-options.ts +36 -7
- package/dist/builtin/workflows/src/runs/shared/worktree-cache-lifecycle.ts +25 -0
- package/dist/builtin/workflows/src/runs/shared/worktree-cwd.ts +103 -0
- package/dist/builtin/workflows/src/runs/shared/worktree-generation.ts +57 -0
- package/dist/builtin/workflows/src/runs/shared/worktree-git.ts +134 -8
- package/dist/builtin/workflows/src/runs/shared/worktree.ts +2 -0
- package/dist/builtin/workflows/src/shared/resumable-workflow-notices.ts +43 -0
- package/dist/builtin/workflows/src/shared/timing.ts +4 -0
- package/dist/builtin/workflows/src/shared/types.ts +5 -3
- package/dist/builtin/workflows/src/tui/graph-view-constants.ts +1 -0
- package/dist/builtin/workflows/src/tui/graph-view-input.ts +24 -14
- package/dist/builtin/workflows/src/tui/workflow-resume-selector.ts +43 -13
- package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-auto-compaction.js +5 -7
- package/dist/core/agent-session-auto-compaction.js.map +1 -1
- package/dist/core/agent-session-compaction.d.ts +6 -34
- package/dist/core/agent-session-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-compaction.js +95 -233
- package/dist/core/agent-session-compaction.js.map +1 -1
- package/dist/core/agent-session-message-queue.d.ts +0 -4
- package/dist/core/agent-session-message-queue.d.ts.map +1 -1
- package/dist/core/agent-session-message-queue.js +1 -5
- package/dist/core/agent-session-message-queue.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +5 -6
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-types.d.ts +2 -12
- package/dist/core/agent-session-types.d.ts.map +1 -1
- package/dist/core/agent-session-types.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +1 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +1 -2
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction-boundary.d.ts +9 -0
- package/dist/core/compaction/compaction-boundary.d.ts.map +1 -0
- package/dist/core/compaction/compaction-boundary.js +115 -0
- package/dist/core/compaction/compaction-boundary.js.map +1 -0
- package/dist/core/compaction/compaction-parameters.d.ts +5 -0
- package/dist/core/compaction/compaction-parameters.d.ts.map +1 -0
- package/dist/core/compaction/compaction-parameters.js +27 -0
- package/dist/core/compaction/compaction-parameters.js.map +1 -0
- package/dist/core/compaction/compaction-runner.d.ts +14 -0
- package/dist/core/compaction/compaction-runner.d.ts.map +1 -0
- package/dist/core/compaction/compaction-runner.js +29 -0
- package/dist/core/compaction/compaction-runner.js.map +1 -0
- package/dist/core/compaction/compaction-types.d.ts +79 -0
- package/dist/core/compaction/compaction-types.d.ts.map +1 -0
- package/dist/core/compaction/compaction-types.js +6 -0
- package/dist/core/compaction/compaction-types.js.map +1 -0
- package/dist/core/compaction/deleted-ranges.d.ts +6 -0
- package/dist/core/compaction/deleted-ranges.d.ts.map +1 -0
- package/dist/core/compaction/deleted-ranges.js +134 -0
- package/dist/core/compaction/deleted-ranges.js.map +1 -0
- package/dist/core/compaction/index.d.ts +7 -1
- package/dist/core/compaction/index.d.ts.map +1 -1
- package/dist/core/compaction/index.js +7 -1
- package/dist/core/compaction/index.js.map +1 -1
- package/dist/core/compaction/range-planner.d.ts +21 -0
- package/dist/core/compaction/range-planner.d.ts.map +1 -0
- package/dist/core/compaction/range-planner.js +145 -0
- package/dist/core/compaction/range-planner.js.map +1 -0
- package/dist/core/compaction/transcript-serialization.d.ts +11 -0
- package/dist/core/compaction/transcript-serialization.d.ts.map +1 -0
- package/dist/core/compaction/transcript-serialization.js +104 -0
- package/dist/core/compaction/transcript-serialization.js.map +1 -0
- package/dist/core/extensions/context-types.d.ts +2 -2
- package/dist/core/extensions/context-types.d.ts.map +1 -1
- package/dist/core/extensions/context-types.js.map +1 -1
- package/dist/core/extensions/event-results.d.ts +2 -2
- package/dist/core/extensions/event-results.d.ts.map +1 -1
- package/dist/core/extensions/event-results.js.map +1 -1
- package/dist/core/extensions/session-events.d.ts +7 -7
- package/dist/core/extensions/session-events.d.ts.map +1 -1
- package/dist/core/extensions/session-events.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/messages.d.ts +4 -0
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +11 -0
- package/dist/core/messages.js.map +1 -1
- package/dist/core/provider-context-usage.d.ts.map +1 -1
- package/dist/core/provider-context-usage.js +1 -2
- package/dist/core/provider-context-usage.js.map +1 -1
- package/dist/core/session-manager-archive.d.ts +2 -1
- package/dist/core/session-manager-archive.d.ts.map +1 -1
- package/dist/core/session-manager-archive.js +2 -2
- package/dist/core/session-manager-archive.js.map +1 -1
- package/dist/core/session-manager-classification.d.ts +9 -0
- package/dist/core/session-manager-classification.d.ts.map +1 -0
- package/dist/core/session-manager-classification.js +37 -0
- package/dist/core/session-manager-classification.js.map +1 -0
- package/dist/core/session-manager-core.d.ts +4 -4
- package/dist/core/session-manager-core.d.ts.map +1 -1
- package/dist/core/session-manager-core.js +13 -8
- package/dist/core/session-manager-core.js.map +1 -1
- package/dist/core/session-manager-entries.d.ts +4 -3
- package/dist/core/session-manager-entries.d.ts.map +1 -1
- package/dist/core/session-manager-entries.js +12 -10
- package/dist/core/session-manager-entries.js.map +1 -1
- package/dist/core/session-manager-history.d.ts +6 -23
- package/dist/core/session-manager-history.d.ts.map +1 -1
- package/dist/core/session-manager-history.js +23 -256
- package/dist/core/session-manager-history.js.map +1 -1
- package/dist/core/session-manager-list.d.ts.map +1 -1
- package/dist/core/session-manager-list.js +3 -3
- package/dist/core/session-manager-list.js.map +1 -1
- package/dist/core/session-manager-storage.d.ts +1 -1
- package/dist/core/session-manager-storage.d.ts.map +1 -1
- package/dist/core/session-manager-storage.js +3 -2
- package/dist/core/session-manager-storage.js.map +1 -1
- package/dist/core/session-manager-types.d.ts +14 -15
- 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 +3 -2
- 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/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -1
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/main-session.d.ts +1 -0
- package/dist/main-session.d.ts.map +1 -1
- package/dist/main-session.js +7 -0
- package/dist/main-session.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +2 -2
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/chat-message-renderer.d.ts +4 -1
- package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-message-renderer.js +12 -22
- package/dist/modes/interactive/components/chat-message-renderer.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-events.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-events.js +5 -11
- package/dist/modes/interactive/components/chat-session-host-events.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.js +3 -0
- package/dist/modes/interactive/components/chat-session-host-rendering.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-state.d.ts +1 -0
- package/dist/modes/interactive/components/chat-session-host-state.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-state.js +1 -0
- package/dist/modes/interactive/components/chat-session-host-state.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-utils.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-utils.js +1 -1
- package/dist/modes/interactive/components/chat-session-host-utils.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.js +1 -0
- package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
- package/dist/modes/interactive/components/compaction-boundary-message.d.ts +20 -0
- package/dist/modes/interactive/components/compaction-boundary-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/compaction-boundary-message.js +48 -0
- package/dist/modes/interactive/components/compaction-boundary-message.js.map +1 -0
- package/dist/modes/interactive/components/index.d.ts +1 -1
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js +1 -1
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-list.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-list.js +3 -0
- package/dist/modes/interactive/components/session-selector-list.js.map +1 -1
- package/dist/modes/interactive/interactive-agent-events.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-agent-events.js +3 -47
- package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.d.ts +2 -2
- package/dist/modes/interactive/interactive-mode-deps.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.js +1 -1
- package/dist/modes/interactive/interactive-mode-deps.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts +5 -3
- package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.js +21 -12
- package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +3 -5
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +1 -6
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-command-handler.js +0 -4
- package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +2 -11
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/docs/compaction.md +97 -772
- package/docs/extensions.md +25 -29
- package/docs/json.md +2 -2
- package/docs/rpc.md +32 -24
- package/docs/sdk.md +3 -3
- package/docs/session-format.md +49 -30
- package/docs/sessions.md +5 -3
- package/docs/settings.md +14 -4
- package/docs/usage.md +1 -1
- package/docs/workflows.md +30 -15
- package/examples/extensions/custom-compaction.ts +14 -58
- package/examples/extensions/handoff.ts +2 -3
- package/npm-shrinkwrap.json +23 -23
- package/package.json +2 -2
- package/dist/core/compaction/context-assistant-turns.d.ts +0 -42
- package/dist/core/compaction/context-assistant-turns.d.ts.map +0 -1
- package/dist/core/compaction/context-assistant-turns.js +0 -87
- package/dist/core/compaction/context-assistant-turns.js.map +0 -1
- package/dist/core/compaction/context-compaction-critical.d.ts +0 -15
- package/dist/core/compaction/context-compaction-critical.d.ts.map +0 -1
- package/dist/core/compaction/context-compaction-critical.js +0 -57
- package/dist/core/compaction/context-compaction-critical.js.map +0 -1
- package/dist/core/compaction/context-compaction-eviction-alternates.d.ts +0 -18
- package/dist/core/compaction/context-compaction-eviction-alternates.d.ts.map +0 -1
- package/dist/core/compaction/context-compaction-eviction-alternates.js +0 -186
- package/dist/core/compaction/context-compaction-eviction-alternates.js.map +0 -1
- package/dist/core/compaction/context-compaction-eviction.d.ts +0 -12
- package/dist/core/compaction/context-compaction-eviction.d.ts.map +0 -1
- package/dist/core/compaction/context-compaction-eviction.js +0 -222
- package/dist/core/compaction/context-compaction-eviction.js.map +0 -1
- package/dist/core/compaction/context-compaction-metrics.d.ts +0 -28
- package/dist/core/compaction/context-compaction-metrics.d.ts.map +0 -1
- package/dist/core/compaction/context-compaction-metrics.js +0 -107
- package/dist/core/compaction/context-compaction-metrics.js.map +0 -1
- package/dist/core/compaction/context-compaction-prompt.d.ts +0 -9
- package/dist/core/compaction/context-compaction-prompt.d.ts.map +0 -1
- package/dist/core/compaction/context-compaction-prompt.js +0 -163
- package/dist/core/compaction/context-compaction-prompt.js.map +0 -1
- package/dist/core/compaction/context-compaction-runner.d.ts +0 -11
- package/dist/core/compaction/context-compaction-runner.d.ts.map +0 -1
- package/dist/core/compaction/context-compaction-runner.js +0 -273
- package/dist/core/compaction/context-compaction-runner.js.map +0 -1
- package/dist/core/compaction/context-compaction-strategy.d.ts +0 -5
- package/dist/core/compaction/context-compaction-strategy.d.ts.map +0 -1
- package/dist/core/compaction/context-compaction-strategy.js +0 -27
- package/dist/core/compaction/context-compaction-strategy.js.map +0 -1
- package/dist/core/compaction/context-compaction-types.d.ts +0 -75
- package/dist/core/compaction/context-compaction-types.d.ts.map +0 -1
- package/dist/core/compaction/context-compaction-types.js +0 -6
- package/dist/core/compaction/context-compaction-types.js.map +0 -1
- package/dist/core/compaction/context-compaction.d.ts +0 -10
- package/dist/core/compaction/context-compaction.d.ts.map +0 -1
- package/dist/core/compaction/context-compaction.js +0 -8
- package/dist/core/compaction/context-compaction.js.map +0 -1
- package/dist/core/compaction/context-deletion-application.d.ts +0 -14
- package/dist/core/compaction/context-deletion-application.d.ts.map +0 -1
- package/dist/core/compaction/context-deletion-application.js +0 -261
- package/dist/core/compaction/context-deletion-application.js.map +0 -1
- package/dist/core/compaction/context-deletion-store.d.ts +0 -78
- package/dist/core/compaction/context-deletion-store.d.ts.map +0 -1
- package/dist/core/compaction/context-deletion-store.js +0 -162
- package/dist/core/compaction/context-deletion-store.js.map +0 -1
- package/dist/core/compaction/context-deletion-targets.d.ts +0 -43
- package/dist/core/compaction/context-deletion-targets.d.ts.map +0 -1
- package/dist/core/compaction/context-deletion-targets.js +0 -292
- package/dist/core/compaction/context-deletion-targets.js.map +0 -1
- package/dist/core/compaction/context-deletion-tool-definitions.d.ts +0 -193
- package/dist/core/compaction/context-deletion-tool-definitions.d.ts.map +0 -1
- package/dist/core/compaction/context-deletion-tool-definitions.js +0 -98
- package/dist/core/compaction/context-deletion-tool-definitions.js.map +0 -1
- package/dist/core/compaction/context-deletion-tool-helpers.d.ts +0 -19
- package/dist/core/compaction/context-deletion-tool-helpers.d.ts.map +0 -1
- package/dist/core/compaction/context-deletion-tool-helpers.js +0 -210
- package/dist/core/compaction/context-deletion-tool-helpers.js.map +0 -1
- package/dist/core/compaction/context-deletion-tools.d.ts +0 -4
- package/dist/core/compaction/context-deletion-tools.d.ts.map +0 -1
- package/dist/core/compaction/context-deletion-tools.js +0 -403
- package/dist/core/compaction/context-deletion-tools.js.map +0 -1
- package/dist/core/compaction/context-transcript-analysis.d.ts +0 -11
- package/dist/core/compaction/context-transcript-analysis.d.ts.map +0 -1
- package/dist/core/compaction/context-transcript-analysis.js +0 -228
- package/dist/core/compaction/context-transcript-analysis.js.map +0 -1
- package/dist/core/session-manager-tool-dependencies.d.ts +0 -10
- package/dist/core/session-manager-tool-dependencies.d.ts.map +0 -1
- package/dist/core/session-manager-tool-dependencies.js +0 -133
- package/dist/core/session-manager-tool-dependencies.js.map +0 -1
- package/dist/modes/interactive/components/context-compaction-summary-message.d.ts +0 -17
- package/dist/modes/interactive/components/context-compaction-summary-message.d.ts.map +0 -1
- package/dist/modes/interactive/components/context-compaction-summary-message.js +0 -83
- package/dist/modes/interactive/components/context-compaction-summary-message.js.map +0 -1
|
@@ -23,9 +23,10 @@ import type {
|
|
|
23
23
|
DurableUiCheckpoint,
|
|
24
24
|
UiPromptKind,
|
|
25
25
|
} from "./types.js";
|
|
26
|
+
import { classifyDurableFormatVersion, DURABLE_FORMAT_VERSION } from "./format-version.js";
|
|
26
27
|
|
|
27
28
|
/** Envelope schema version. */
|
|
28
|
-
export const DBOS_ENVELOPE_VERSION =
|
|
29
|
+
export const DBOS_ENVELOPE_VERSION = DURABLE_FORMAT_VERSION;
|
|
29
30
|
|
|
30
31
|
/** Marker key present on every envelope payload. */
|
|
31
32
|
const ENVELOPE_MARKER = "__dbos_checkpoint__";
|
|
@@ -105,9 +106,35 @@ export function encodeCheckpoint(cp: DurableCheckpoint): DbosCheckpointEnvelope
|
|
|
105
106
|
* Type guard: is this value a checkpoint envelope?
|
|
106
107
|
*/
|
|
107
108
|
export function isCheckpointEnvelope(value: WorkflowSerializableValue | undefined): value is DbosCheckpointEnvelope {
|
|
109
|
+
if (!hasCheckpointEnvelopeMarker(value)) return false;
|
|
110
|
+
return value.v === DBOS_ENVELOPE_VERSION;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function hasCheckpointEnvelopeMarker(value: WorkflowSerializableValue | undefined): value is Record<string, WorkflowSerializableValue> {
|
|
108
114
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
109
|
-
|
|
110
|
-
|
|
115
|
+
return (value as Record<string, WorkflowSerializableValue>)[ENVELOPE_MARKER] === ENVELOPE_MARKER;
|
|
116
|
+
}
|
|
117
|
+
export type DbosCheckpointCompatibility =
|
|
118
|
+
| { readonly kind: "current"; readonly checkpoint: DurableCheckpoint }
|
|
119
|
+
| { readonly kind: "legacy" }
|
|
120
|
+
| { readonly kind: "unknown" };
|
|
121
|
+
|
|
122
|
+
/** Classify and decode one DBOS checkpoint payload without reinterpreting marked formats. */
|
|
123
|
+
export function classifyCheckpointPayload(
|
|
124
|
+
workflowId: string,
|
|
125
|
+
stepName: string,
|
|
126
|
+
value: WorkflowSerializableValue,
|
|
127
|
+
): DbosCheckpointCompatibility {
|
|
128
|
+
if (!hasCheckpointEnvelopeMarker(value)) return { kind: "current", checkpoint: decodeLegacy(workflowId, stepName, value) };
|
|
129
|
+
const compatibility = classifyDurableFormatVersion(value.v);
|
|
130
|
+
if (compatibility !== "current") return { kind: compatibility };
|
|
131
|
+
const hasOutput = value["hasOutput"];
|
|
132
|
+
const containsOutput = value["output"] !== undefined;
|
|
133
|
+
if (value["checkpointId"] !== stepName || typeof hasOutput !== "boolean" || hasOutput !== containsOutput) {
|
|
134
|
+
return { kind: "unknown" };
|
|
135
|
+
}
|
|
136
|
+
const checkpoint = decodeEnvelope(workflowId, value as DbosCheckpointEnvelope);
|
|
137
|
+
return checkpoint === undefined ? { kind: "unknown" } : { kind: "current", checkpoint };
|
|
111
138
|
}
|
|
112
139
|
|
|
113
140
|
/**
|
|
@@ -124,15 +151,18 @@ export function decodeToCheckpoint(
|
|
|
124
151
|
stepName: string,
|
|
125
152
|
value: WorkflowSerializableValue,
|
|
126
153
|
): DurableCheckpoint | undefined {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
return decodeLegacy(workflowId, stepName, value);
|
|
154
|
+
const classified = classifyCheckpointPayload(workflowId, stepName, value);
|
|
155
|
+
return classified.kind === "current" ? classified.checkpoint : undefined;
|
|
130
156
|
}
|
|
131
157
|
|
|
132
158
|
function decodeEnvelope(workflowId: string, env: DbosCheckpointEnvelope): DurableCheckpoint | undefined {
|
|
159
|
+
if (typeof env.checkpointId !== "string" || env.checkpointId.length === 0
|
|
160
|
+
|| typeof env.completedAt !== "number" || !Number.isFinite(env.completedAt)
|
|
161
|
+
|| (env.name !== undefined && typeof env.name !== "string")
|
|
162
|
+
|| (env.hasOutput !== undefined && typeof env.hasOutput !== "boolean")) return undefined;
|
|
133
163
|
const common = { workflowId, checkpointId: env.checkpointId, completedAt: env.completedAt };
|
|
134
164
|
if (env.kind === "tool") {
|
|
135
|
-
if (env.argsHash
|
|
165
|
+
if (typeof env.argsHash !== "string" || env.output === undefined) return undefined;
|
|
136
166
|
return {
|
|
137
167
|
kind: "tool",
|
|
138
168
|
...common,
|
|
@@ -142,7 +172,8 @@ function decodeEnvelope(workflowId: string, env: DbosCheckpointEnvelope): Durabl
|
|
|
142
172
|
} as DurableToolCheckpoint;
|
|
143
173
|
}
|
|
144
174
|
if (env.kind === "ui") {
|
|
145
|
-
if (env.promptHash
|
|
175
|
+
if (typeof env.promptHash !== "string" || !isUiPromptKind(env.promptKind) || env.output === undefined
|
|
176
|
+
|| (env.message !== undefined && typeof env.message !== "string")) return undefined;
|
|
146
177
|
return {
|
|
147
178
|
kind: "ui",
|
|
148
179
|
...common,
|
|
@@ -152,6 +183,18 @@ function decodeEnvelope(workflowId: string, env: DbosCheckpointEnvelope): Durabl
|
|
|
152
183
|
response: env.output,
|
|
153
184
|
} as DurableUiCheckpoint;
|
|
154
185
|
}
|
|
186
|
+
if (env.kind !== "stage"
|
|
187
|
+
|| (env.replayKey !== undefined && typeof env.replayKey !== "string")
|
|
188
|
+
|| (env.sessionId !== undefined && typeof env.sessionId !== "string")
|
|
189
|
+
|| (env.sessionFile !== undefined && typeof env.sessionFile !== "string")
|
|
190
|
+
|| !isOptionalFiniteNumber(env.startedAt)
|
|
191
|
+
|| !isOptionalFiniteNumber(env.endedAt)
|
|
192
|
+
|| !isOptionalFiniteNumber(env.durationMs)
|
|
193
|
+
|| (env.result !== undefined && typeof env.result !== "string")
|
|
194
|
+
|| (env.model !== undefined && typeof env.model !== "string")
|
|
195
|
+
|| (env.fastMode !== undefined && typeof env.fastMode !== "boolean")
|
|
196
|
+
|| (env.attemptedModels !== undefined && !isStringArray(env.attemptedModels))
|
|
197
|
+
|| (env.modelAttempts !== undefined && !isModelAttempts(env.modelAttempts))) return undefined;
|
|
155
198
|
return {
|
|
156
199
|
kind: "stage",
|
|
157
200
|
...common,
|
|
@@ -172,6 +215,39 @@ function decodeEnvelope(workflowId: string, env: DbosCheckpointEnvelope): Durabl
|
|
|
172
215
|
}
|
|
173
216
|
|
|
174
217
|
|
|
218
|
+
function isModelAttempts(value: WorkflowSerializableValue | undefined): boolean {
|
|
219
|
+
return Array.isArray(value) && value.every((attempt) => {
|
|
220
|
+
if (typeof attempt !== "object" || attempt === null || Array.isArray(attempt)) return false;
|
|
221
|
+
const record = attempt as Record<string, WorkflowSerializableValue>;
|
|
222
|
+
return typeof record["model"] === "string"
|
|
223
|
+
&& typeof record["success"] === "boolean"
|
|
224
|
+
&& (record["reasoningLevel"] === undefined || isReasoningLevel(record["reasoningLevel"]))
|
|
225
|
+
&& (record["error"] === undefined || typeof record["error"] === "string")
|
|
226
|
+
&& (record["usage"] === undefined || isModelUsage(record["usage"]));
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
function isReasoningLevel(value: WorkflowSerializableValue): boolean {
|
|
231
|
+
return value === "off" || value === "minimal" || value === "low" || value === "medium"
|
|
232
|
+
|| value === "high" || value === "xhigh" || value === "max";
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function isModelUsage(value: WorkflowSerializableValue): boolean {
|
|
236
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
237
|
+
const usage = value as Record<string, WorkflowSerializableValue>;
|
|
238
|
+
return ["input", "output", "cacheRead", "cacheWrite", "cost", "turns"]
|
|
239
|
+
.every((key) => usage[key] === undefined || (typeof usage[key] === "number" && Number.isFinite(usage[key])));
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function isUiPromptKind(value: WorkflowSerializableValue | undefined): value is UiPromptKind {
|
|
243
|
+
return value === "input" || value === "confirm" || value === "select"
|
|
244
|
+
|| value === "editor" || value === "custom";
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
function isOptionalFiniteNumber(value: WorkflowSerializableValue | undefined): boolean {
|
|
248
|
+
return value === undefined || (typeof value === "number" && Number.isFinite(value));
|
|
249
|
+
}
|
|
250
|
+
|
|
175
251
|
function isStringArray(value: WorkflowSerializableValue | undefined): value is readonly string[] {
|
|
176
252
|
return Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
177
253
|
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import type { WorkflowSerializableValue } from "../shared/types.js";
|
|
2
|
+
import type { DbosStepRecord } from "./dbos-backend.js";
|
|
3
|
+
import { classifyDurableFormatVersion, DURABLE_FORMAT_VERSION } from "./format-version.js";
|
|
4
|
+
import type { DurableCheckpointEntry, DurableWorkflowStatus } from "./types.js";
|
|
5
|
+
|
|
6
|
+
const METADATA_STEP_PREFIX = "__atomic_metadata";
|
|
7
|
+
|
|
8
|
+
export type DbosMetadataCompatibility =
|
|
9
|
+
| { readonly kind: "current"; readonly entry: DurableCheckpointEntry }
|
|
10
|
+
| { readonly kind: "legacy" }
|
|
11
|
+
| { readonly kind: "unknown" }
|
|
12
|
+
| { readonly kind: "unavailable" };
|
|
13
|
+
|
|
14
|
+
export function metadataStepName(ts: number): string {
|
|
15
|
+
return `${METADATA_STEP_PREFIX}:${ts}:${crypto.randomUUID()}`;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function isMetadataStep(stepName: string): boolean {
|
|
19
|
+
return stepName === METADATA_STEP_PREFIX || stepName.startsWith(`${METADATA_STEP_PREFIX}:`);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function encodeMetadata(entry: DurableCheckpointEntry): WorkflowSerializableValue {
|
|
23
|
+
return {
|
|
24
|
+
__atomicDurableMetadata: true,
|
|
25
|
+
version: DURABLE_FORMAT_VERSION,
|
|
26
|
+
entry: {
|
|
27
|
+
formatVersion: entry.formatVersion,
|
|
28
|
+
type: entry.type,
|
|
29
|
+
workflowId: entry.workflowId,
|
|
30
|
+
name: entry.name,
|
|
31
|
+
inputs: entry.inputs,
|
|
32
|
+
status: entry.status,
|
|
33
|
+
completedCheckpoints: entry.completedCheckpoints,
|
|
34
|
+
pendingPrompts: entry.pendingPrompts,
|
|
35
|
+
...(entry.label !== undefined ? { label: entry.label } : {}),
|
|
36
|
+
...(entry.rootWorkflowId !== undefined ? { rootWorkflowId: entry.rootWorkflowId } : {}),
|
|
37
|
+
...(entry.resumable !== undefined ? { resumable: entry.resumable } : {}),
|
|
38
|
+
...(entry.invocationCwd !== undefined ? { invocationCwd: entry.invocationCwd } : {}),
|
|
39
|
+
...(entry.workflowCwd !== undefined ? { workflowCwd: entry.workflowCwd } : {}),
|
|
40
|
+
...(entry.repositoryRoot !== undefined ? { repositoryRoot: entry.repositoryRoot } : {}),
|
|
41
|
+
...(entry.gitWorktreeRoot !== undefined ? { gitWorktreeRoot: entry.gitWorktreeRoot } : {}),
|
|
42
|
+
ts: entry.ts,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function classifyLatestMetadata(records: readonly DbosStepRecord[], workflowId: string): DbosMetadataCompatibility {
|
|
48
|
+
const metadata = records.filter((record) => isMetadataStep(record.stepName));
|
|
49
|
+
if (metadata.length === 0) return { kind: "unavailable" };
|
|
50
|
+
const latest = metadata.reduce((selected, record) => metadataTimestamp(record) >= metadataTimestamp(selected) ? record : selected);
|
|
51
|
+
if (typeof latest.output !== "object" || latest.output === null || Array.isArray(latest.output)) return { kind: "unknown" };
|
|
52
|
+
const raw = latest.output as Record<string, WorkflowSerializableValue>;
|
|
53
|
+
if (raw["__atomicDurableMetadata"] !== true) return { kind: "unknown" };
|
|
54
|
+
const compatibility = classifyDurableFormatVersion(raw["version"]);
|
|
55
|
+
if (compatibility !== "current") return { kind: compatibility };
|
|
56
|
+
const entry = parseDurableCheckpointEntry(raw["entry"], workflowId);
|
|
57
|
+
return entry === undefined ? { kind: "unknown" } : { kind: "current", entry };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function metadataTimestamp(record: DbosStepRecord): number {
|
|
61
|
+
const segment = record.stepName.split(":")[1];
|
|
62
|
+
const fromName = segment === undefined ? Number.NaN : Number(segment);
|
|
63
|
+
return Number.isFinite(fromName) ? fromName : (record.completedAt ?? 0);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function parseDurableCheckpointEntry(
|
|
67
|
+
value: WorkflowSerializableValue | undefined,
|
|
68
|
+
workflowId: string,
|
|
69
|
+
): DurableCheckpointEntry | undefined {
|
|
70
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return undefined;
|
|
71
|
+
const entry = value as Partial<DurableCheckpointEntry>;
|
|
72
|
+
if (entry.workflowId !== workflowId
|
|
73
|
+
|| entry.formatVersion !== DURABLE_FORMAT_VERSION
|
|
74
|
+
|| entry.type !== "workflow.durable.checkpoint"
|
|
75
|
+
|| typeof entry.workflowId !== "string"
|
|
76
|
+
|| typeof entry.name !== "string"
|
|
77
|
+
|| typeof entry.inputs !== "object"
|
|
78
|
+
|| entry.inputs === null
|
|
79
|
+
|| Array.isArray(entry.inputs)
|
|
80
|
+
|| typeof entry.status !== "string"
|
|
81
|
+
|| !isDurableWorkflowStatus(entry.status)
|
|
82
|
+
|| typeof entry.completedCheckpoints !== "number"
|
|
83
|
+
|| typeof entry.pendingPrompts !== "number"
|
|
84
|
+
|| typeof entry.ts !== "number"
|
|
85
|
+
|| (entry.label !== undefined && typeof entry.label !== "string")
|
|
86
|
+
|| (entry.rootWorkflowId !== undefined && typeof entry.rootWorkflowId !== "string")
|
|
87
|
+
|| (entry.resumable !== undefined && typeof entry.resumable !== "boolean")
|
|
88
|
+
|| (entry.invocationCwd !== undefined && typeof entry.invocationCwd !== "string")
|
|
89
|
+
|| (entry.workflowCwd !== undefined && typeof entry.workflowCwd !== "string")
|
|
90
|
+
|| (entry.repositoryRoot !== undefined && typeof entry.repositoryRoot !== "string")
|
|
91
|
+
|| (entry.gitWorktreeRoot !== undefined && typeof entry.gitWorktreeRoot !== "string")) return undefined;
|
|
92
|
+
return entry as DurableCheckpointEntry;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function isDurableWorkflowStatus(value: string): value is DurableWorkflowStatus {
|
|
96
|
+
return value === "running" || value === "paused" || value === "completed"
|
|
97
|
+
|| value === "failed" || value === "cancelled" || value === "blocked";
|
|
98
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { WorkflowSerializableValue } from "../shared/types.js";
|
|
2
|
+
import type { DbosStepRecord } from "./dbos-backend.js";
|
|
3
|
+
import { classifyDurableFormatVersion, DURABLE_FORMAT_VERSION } from "./format-version.js";
|
|
4
|
+
|
|
5
|
+
export const DBOS_DELETION_STEP = "__atomic_deleted";
|
|
6
|
+
|
|
7
|
+
export type DbosDeletionCompatibility = "current" | "unknown" | "absent";
|
|
8
|
+
|
|
9
|
+
export function encodeDbosDeletionTombstone(workflowId: string): WorkflowSerializableValue {
|
|
10
|
+
return {
|
|
11
|
+
__atomicDurableDeleted: true,
|
|
12
|
+
version: DURABLE_FORMAT_VERSION,
|
|
13
|
+
workflowId,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function classifyDbosDeletionTombstone(
|
|
18
|
+
records: readonly DbosStepRecord[],
|
|
19
|
+
workflowId: string,
|
|
20
|
+
): DbosDeletionCompatibility {
|
|
21
|
+
const record = records.find((candidate) => candidate.stepName === DBOS_DELETION_STEP);
|
|
22
|
+
if (record === undefined) return "absent";
|
|
23
|
+
if (typeof record.output !== "object" || record.output === null || Array.isArray(record.output)) return "unknown";
|
|
24
|
+
const raw = record.output as Record<string, WorkflowSerializableValue>;
|
|
25
|
+
if (raw["__atomicDurableDeleted"] !== true || raw["workflowId"] !== workflowId) return "unknown";
|
|
26
|
+
return classifyDurableFormatVersion(raw["version"]) === "current" ? "current" : "unknown";
|
|
27
|
+
}
|
|
@@ -87,7 +87,7 @@ export function createDefaultFileBackend(): DurableWorkflowBackend {
|
|
|
87
87
|
export function createWorkflowFileBackend(workflowId: string): DurableWorkflowBackend {
|
|
88
88
|
const dir = defaultDurableStateDir();
|
|
89
89
|
if (dir === undefined) return createInMemoryBackend();
|
|
90
|
-
return new FileDurableBackend(durableStateFileFor(dir, workflowId));
|
|
90
|
+
return new FileDurableBackend(durableStateFileFor(dir, workflowId), workflowId);
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
function isDurabilityOptedOut(): boolean {
|