@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
package/docs/extensions.md
CHANGED
|
@@ -338,9 +338,9 @@ user sends another prompt ◄─────────────────
|
|
|
338
338
|
└─► resources_discover { reason: "startup" }
|
|
339
339
|
|
|
340
340
|
/compact or auto-compaction
|
|
341
|
-
├─► compaction_start / compaction_end (
|
|
342
|
-
├─► session_before_compact (can cancel or provide
|
|
343
|
-
└─► session_compact (after the
|
|
341
|
+
├─► compaction_start / compaction_end (verbatim line-compaction status)
|
|
342
|
+
├─► session_before_compact (can cancel or provide compactedText)
|
|
343
|
+
└─► session_compact (after the compaction boundary is persisted)
|
|
344
344
|
|
|
345
345
|
/tree navigation
|
|
346
346
|
├─► session_before_tree (can cancel or customize)
|
|
@@ -460,40 +460,36 @@ Do cleanup work in `session_shutdown`, then reestablish any in-memory state in `
|
|
|
460
460
|
|
|
461
461
|
#### session_before_compact / session_compact
|
|
462
462
|
|
|
463
|
-
Fired by `/compact` and auto-compaction.
|
|
463
|
+
Fired by `/compact` and auto-compaction. Atomic prepares a protected recent tail and a numbered compactable region. Extensions may cancel or provide a complete, non-empty `compactedText` replacement for that region; they cannot move `firstKeptEntryId`. The override is persisted verbatim and works without provider credentials.
|
|
464
464
|
|
|
465
465
|
```typescript
|
|
466
|
-
pi.on("session_before_compact", async (event
|
|
467
|
-
const { preparation, branchEntries, reason, signal } = event;
|
|
468
|
-
const { transcript } = preparation;
|
|
466
|
+
pi.on("session_before_compact", async (event) => {
|
|
467
|
+
const { preparation, branchEntries, parameters, reason, signal } = event;
|
|
469
468
|
|
|
470
|
-
//
|
|
471
|
-
//
|
|
472
|
-
//
|
|
473
|
-
//
|
|
469
|
+
// preparation.region.lines - unnumbered compactable transcript lines
|
|
470
|
+
// preparation.firstKeptEntryId - fixed start of the verbatim tail
|
|
471
|
+
// preparation.tokensBefore - whole-context token estimate
|
|
472
|
+
// parameters - compression_ratio, preserve_recent, query
|
|
473
|
+
// branchEntries - raw entries on the active branch
|
|
474
474
|
// reason - "manual" | "threshold" | "overflow"
|
|
475
|
+
// preparation is a deep-frozen clone
|
|
475
476
|
|
|
476
477
|
if (signal.aborted) return { cancel: true };
|
|
477
478
|
|
|
478
479
|
// Cancel compaction:
|
|
479
480
|
return { cancel: true };
|
|
480
481
|
|
|
481
|
-
// Or
|
|
482
|
-
// tool-call/tool-result pairing, and non-empty remaining context before saving.
|
|
482
|
+
// Or replace only the prepared region. Whitespace-only text is rejected.
|
|
483
483
|
return {
|
|
484
|
-
|
|
485
|
-
deletions: [
|
|
486
|
-
{ kind: "entry", entryId: "abc123", rationale: "Old successful command output" },
|
|
487
|
-
{ kind: "content_block", entryId: "def456", blockIndex: 2, rationale: "Verbose obsolete log" },
|
|
488
|
-
],
|
|
489
|
-
},
|
|
484
|
+
compactedText: preparation.region.lines.slice(0, 40).join("\n"),
|
|
490
485
|
};
|
|
491
486
|
});
|
|
492
487
|
|
|
493
|
-
pi.on("session_compact", async (event
|
|
494
|
-
// event.result -
|
|
495
|
-
// event.
|
|
496
|
-
// event.fromExtension - true
|
|
488
|
+
pi.on("session_compact", async (event) => {
|
|
489
|
+
// event.result - VerbatimCompactionResult (text, boundary, stats, parameters, rung)
|
|
490
|
+
// event.compactionEntry - saved CompactionEntry with strategy "verbatim-lines"
|
|
491
|
+
// event.fromExtension - true when session_before_compact provided compactedText
|
|
492
|
+
// Observe-only: errors are isolated after persistence.
|
|
497
493
|
});
|
|
498
494
|
```
|
|
499
495
|
|
|
@@ -1049,15 +1045,15 @@ if (usage && usage.tokens > 100_000) {
|
|
|
1049
1045
|
|
|
1050
1046
|
### ctx.compact()
|
|
1051
1047
|
|
|
1052
|
-
Trigger Atomic's
|
|
1048
|
+
Trigger Atomic's verbatim line compactor without awaiting completion. The planner emits numbered deleted-line ranges only; Atomic validates them and reconstructs retained text mechanically. Use `compression_ratio` (fraction of compactable lines to keep), client-side `preserve_recent`, and `query` to tune the run, and `onComplete`/`onError` for follow-up actions.
|
|
1053
1049
|
|
|
1054
1050
|
```typescript
|
|
1055
1051
|
ctx.compact({
|
|
1056
|
-
compression_ratio: 0.5, // fraction
|
|
1057
|
-
preserve_recent: 2, // keep
|
|
1052
|
+
compression_ratio: 0.5, // fraction of compactable lines to keep
|
|
1053
|
+
preserve_recent: 2, // keep recent messages and widen to a user-turn start
|
|
1058
1054
|
query: "keep active migration details",
|
|
1059
1055
|
onComplete: (result) => {
|
|
1060
|
-
ctx.ui.notify(`Compaction
|
|
1056
|
+
ctx.ui.notify(`Compaction kept ${result.stats.linesKept}/${result.stats.linesBefore} lines`, "info");
|
|
1061
1057
|
},
|
|
1062
1058
|
onError: (error) => {
|
|
1063
1059
|
ctx.ui.notify(`Compaction failed: ${error.message}`, "error");
|
|
@@ -1065,7 +1061,7 @@ ctx.compact({
|
|
|
1065
1061
|
});
|
|
1066
1062
|
```
|
|
1067
1063
|
|
|
1068
|
-
|
|
1064
|
+
The planner cannot author context text: only validated line ranges enter the mechanical reconstruction path. The `query` parameter guides relevance selection inside the fixed prompt; it is not replacement prose. Extensions that need an offline replacement can return `compactedText` from `session_before_compact`.
|
|
1069
1065
|
|
|
1070
1066
|
### ctx.getSystemPrompt()
|
|
1071
1067
|
|
|
@@ -2657,7 +2653,7 @@ All examples in [examples/extensions/](https://github.com/bastani-inc/atomic/tre
|
|
|
2657
2653
|
| `prompt-customizer.ts` | Add context-aware tool guidance using `systemPromptOptions` | `on("before_agent_start")`, `BuildSystemPromptOptions` |
|
|
2658
2654
|
| `file-trigger.ts` | File watcher triggers messages | `sendMessage` |
|
|
2659
2655
|
| **Compaction & Sessions** |||
|
|
2660
|
-
| `custom-compaction.ts` |
|
|
2656
|
+
| `custom-compaction.ts` | Offline compacted-text override | `on("session_before_compact")` |
|
|
2661
2657
|
| `trigger-compact.ts` | Trigger compaction manually | `compact()` |
|
|
2662
2658
|
| `git-checkpoint.ts` | Git stash on turns | `on("turn_start")`, `on("session_before_fork")`, `exec` |
|
|
2663
2659
|
| `auto-commit-on-exit.ts` | Commit on shutdown | `on("session_shutdown")`, `exec` |
|
package/docs/json.md
CHANGED
|
@@ -19,12 +19,12 @@ type AgentSessionEvent =
|
|
|
19
19
|
| { type: "model_changed"; model: Model<Api>; previousModel: Model<Api> | undefined; source: "set" | "cycle" | "restore" }
|
|
20
20
|
| { type: "thinking_level_changed"; level: ThinkingLevel }
|
|
21
21
|
| { type: "context_window_changed"; contextWindow: number }
|
|
22
|
-
| { type: "compaction_end"; reason: "manual" | "threshold" | "overflow"; result:
|
|
22
|
+
| { type: "compaction_end"; reason: "manual" | "threshold" | "overflow"; result: VerbatimCompactionResult | undefined; aborted: boolean; willRetry: boolean; unresolvedOverflow?: boolean; errorMessage?: string }
|
|
23
23
|
| { type: "auto_retry_start"; attempt: number; maxAttempts: number; delayMs: number; errorMessage: string }
|
|
24
24
|
| { type: "auto_retry_end"; success: boolean; attempt: number; finalError?: string };
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
`queue_update` emits the full pending steering and follow-up queues whenever they change. `session_info_changed`, `model_changed`, `thinking_level_changed`, and `context_window_changed` report interactive session metadata changes. `context_window_changed` carries the active token budget after `AgentSession.setContextWindow()` or branch navigation replay applies a branch-scoped `context_window_change`; branch replay does not add another session journal entry or write settings. `compaction_start` and `compaction_end` cover
|
|
27
|
+
`queue_update` emits the full pending steering and follow-up queues whenever they change. `session_info_changed`, `model_changed`, `thinking_level_changed`, and `context_window_changed` report interactive session metadata changes. `context_window_changed` carries the active token budget after `AgentSession.setContextWindow()` or branch navigation replay applies a branch-scoped `context_window_change`; branch replay does not add another session journal entry or write settings. `compaction_start` and `compaction_end` cover manual and automatic verbatim line compaction: the model emits deleted ranges and Atomic mechanically reconstructs retained text.
|
|
28
28
|
|
|
29
29
|
For automatic compaction, `compaction_end.willRetry === true` means the agent is retrying the interrupted turn after compaction; `AgentSession.prompt()` waits for that continuation before resolving. This includes overflow recovery and live threshold compaction for retry-worthy interrupted work such as output-token truncation or OpenAI Responses output-budget underflow errors. Generic provider `invalid_request_body` failures still compact with `willRetry: false` when threshold compaction is warranted. If the same-model compact-and-retry overflow path is exhausted, `compaction_end` includes `unresolvedOverflow: true` plus an `errorMessage` so orchestration layers can fallback to another model instead of treating the prompt as successful.
|
|
30
30
|
|
package/docs/rpc.md
CHANGED
|
@@ -414,7 +414,7 @@ Response:
|
|
|
414
414
|
|
|
415
415
|
#### compact
|
|
416
416
|
|
|
417
|
-
Run Atomic's
|
|
417
|
+
Run Atomic's verbatim line compactor. The selected session model receives a numbered transcript and returns JSON deleted ranges; Atomic validates them and mechanically reconstructs retained lines with `(filtered N lines)` markers. The command appends a durable `compaction` entry with `details.strategy: "verbatim-lines"`. Recent logical turns remain ordinary messages.
|
|
418
418
|
|
|
419
419
|
```json
|
|
420
420
|
{"type": "compact"}
|
|
@@ -427,16 +427,24 @@ Response:
|
|
|
427
427
|
"command": "compact",
|
|
428
428
|
"success": true,
|
|
429
429
|
"data": {
|
|
430
|
-
"
|
|
431
|
-
"
|
|
432
|
-
"
|
|
430
|
+
"compactedText": "[User]: fix the test\n(filtered 42 lines)\n[Assistant]: Fixed.",
|
|
431
|
+
"firstKeptEntryId": "m7",
|
|
432
|
+
"tokensBefore": 150000,
|
|
433
|
+
"promptVersion": 2,
|
|
434
|
+
"parameters": {
|
|
435
|
+
"compression_ratio": 0.5,
|
|
436
|
+
"preserve_recent": 2,
|
|
437
|
+
"query": "fix the test"
|
|
438
|
+
},
|
|
439
|
+
"rung": "standard",
|
|
433
440
|
"stats": {
|
|
434
|
-
"
|
|
435
|
-
"
|
|
436
|
-
"
|
|
441
|
+
"linesBefore": 812,
|
|
442
|
+
"linesDeleted": 417,
|
|
443
|
+
"linesKept": 395,
|
|
444
|
+
"rangeCount": 63,
|
|
437
445
|
"tokensBefore": 150000,
|
|
438
|
-
"tokensAfter":
|
|
439
|
-
"percentReduction":
|
|
446
|
+
"tokensAfter": 72000,
|
|
447
|
+
"percentReduction": 52
|
|
440
448
|
},
|
|
441
449
|
"backupPath": "/path/to/session.jsonl.2026-06-06T00-00-00-000Z.compact.bak"
|
|
442
450
|
}
|
|
@@ -880,10 +888,8 @@ Events are streamed to stdout as JSON lines during agent operation. Events do NO
|
|
|
880
888
|
| `tool_execution_end` | Tool completes |
|
|
881
889
|
| `queue_update` | Pending steering/follow-up queue changed |
|
|
882
890
|
| `context_window_changed` | Active context-window token budget changed |
|
|
883
|
-
| `compaction_start` |
|
|
884
|
-
| `compaction_end` |
|
|
885
|
-
| `context_compaction_start` | Compatibility `context_compact` RPC begins |
|
|
886
|
-
| `context_compaction_end` | Compatibility `context_compact` RPC completes |
|
|
891
|
+
| `compaction_start` | Verbatim line compaction begins |
|
|
892
|
+
| `compaction_end` | Verbatim line compaction completes |
|
|
887
893
|
| `auto_retry_start` | Auto-retry begins (after transient error) |
|
|
888
894
|
| `auto_retry_end` | Auto-retry completes (success or final failure) |
|
|
889
895
|
| `extension_error` | Extension threw an error |
|
|
@@ -1059,16 +1065,20 @@ The `reason` field is `"manual"`, `"threshold"`, or `"overflow"`.
|
|
|
1059
1065
|
"type": "compaction_end",
|
|
1060
1066
|
"reason": "threshold",
|
|
1061
1067
|
"result": {
|
|
1062
|
-
"
|
|
1063
|
-
"
|
|
1064
|
-
"
|
|
1068
|
+
"compactedText": "[User]: fix the test\n(filtered 42 lines)",
|
|
1069
|
+
"firstKeptEntryId": "m7",
|
|
1070
|
+
"tokensBefore": 150000,
|
|
1071
|
+
"promptVersion": 2,
|
|
1072
|
+
"parameters": {"compression_ratio": 0.5, "preserve_recent": 2, "query": "fix the test"},
|
|
1073
|
+
"rung": "standard",
|
|
1065
1074
|
"stats": {
|
|
1066
|
-
"
|
|
1067
|
-
"
|
|
1068
|
-
"
|
|
1075
|
+
"linesBefore": 812,
|
|
1076
|
+
"linesDeleted": 417,
|
|
1077
|
+
"linesKept": 395,
|
|
1078
|
+
"rangeCount": 63,
|
|
1069
1079
|
"tokensBefore": 150000,
|
|
1070
|
-
"tokensAfter":
|
|
1071
|
-
"percentReduction":
|
|
1080
|
+
"tokensAfter": 72000,
|
|
1081
|
+
"percentReduction": 52
|
|
1072
1082
|
}
|
|
1073
1083
|
},
|
|
1074
1084
|
"aborted": false,
|
|
@@ -1084,9 +1094,7 @@ If compaction failed (e.g., API quota exceeded), `result` is `null`, `aborted` i
|
|
|
1084
1094
|
|
|
1085
1095
|
If overflow recovery exhausts the same-model compact-and-retry attempt, `compaction_end` includes `"unresolvedOverflow": true` and an `errorMessage`. Workflow orchestration treats that signal as a context-length failure that can advance configured model fallback tiers.
|
|
1086
1096
|
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
The compatibility RPC command `context_compact` emits these events. It uses the same deletion-only Verbatim Compaction path as `compact`, but reports the historical context-compaction event names. The result contains `deletedTargets`, `protectedEntryIds`, `stats`, `promptVersion`, and optional `backupPath`.
|
|
1097
|
+
There is no `context_compact` command; Atomic reports it as an unknown command. Use `compact`. Only `compaction_start` and `compaction_end` events are emitted.
|
|
1090
1098
|
|
|
1091
1099
|
### auto_retry_start / auto_retry_end
|
|
1092
1100
|
|
package/docs/sdk.md
CHANGED
|
@@ -126,8 +126,8 @@ interface AgentSession {
|
|
|
126
126
|
// In-place tree navigation within the current session file
|
|
127
127
|
navigateTree(targetId: string, options?: { summarize?: boolean; customInstructions?: string; replaceInstructions?: boolean; label?: string }): Promise<{ editorText?: string; cancelled: boolean; aborted?: boolean; summaryEntry?: BranchSummaryEntry }>;
|
|
128
128
|
|
|
129
|
-
// Verbatim
|
|
130
|
-
compact(): Promise<
|
|
129
|
+
// Verbatim line compaction
|
|
130
|
+
compact(options?: Partial<VerbatimCompactionParameters>): Promise<VerbatimCompactionResult>;
|
|
131
131
|
abortCompaction(): void;
|
|
132
132
|
|
|
133
133
|
// Abort current operation
|
|
@@ -138,7 +138,7 @@ interface AgentSession {
|
|
|
138
138
|
}
|
|
139
139
|
```
|
|
140
140
|
|
|
141
|
-
`compact()`
|
|
141
|
+
`compact()` serializes older context to numbered lines, asks the session model for JSON deleted ranges, validates them, and mechanically reconstructs a durable verbatim transcript string. It appends a `compaction` entry with `details.strategy: "verbatim-lines"`; the recent tail remains ordinary messages. The model never authors replacement context text.
|
|
142
142
|
|
|
143
143
|
Session replacement APIs such as new-session, resume, fork, and import live on `AgentSessionRuntime`, not on `AgentSession`.
|
|
144
144
|
|
package/docs/session-format.md
CHANGED
|
@@ -146,7 +146,7 @@ interface BranchSummaryMessage {
|
|
|
146
146
|
}
|
|
147
147
|
```
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
`compactionSummary` is a historical message role that appears only in older session files; Atomic never produces it and treats historical occurrences as inert. Active verbatim boundaries are synthesized at rebuild time as visible `custom` messages with `customType: "compaction"`; `convertToLlm()` maps them to provider-facing user messages.
|
|
150
150
|
|
|
151
151
|
### AgentMessage Union
|
|
152
152
|
|
|
@@ -158,7 +158,7 @@ type AgentMessage =
|
|
|
158
158
|
| BashExecutionMessage
|
|
159
159
|
| CustomMessage
|
|
160
160
|
| BranchSummaryMessage;
|
|
161
|
-
//
|
|
161
|
+
// compactionSummary appears only in older session files and is not part of the active union.
|
|
162
162
|
```
|
|
163
163
|
|
|
164
164
|
## Entry Base
|
|
@@ -190,12 +190,14 @@ For sessions with a parent (created via `/fork`, `/clone`, or `newSession({ pare
|
|
|
190
190
|
{"type":"session","version":3,"id":"uuid","timestamp":"2024-12-03T14:00:00.000Z","cwd":"/path/to/project","parentSession":"/path/to/original/session.jsonl"}
|
|
191
191
|
```
|
|
192
192
|
|
|
193
|
-
|
|
193
|
+
Workflow-owned sessions carry both `internal: true` and complete `workflow` linkage. Atomic writes this classification before the transcript becomes visible wherever possible, including workflow stage forks and fresh/forked subagents. A session is excluded from normal resume history only when `internal` is the exact boolean `true` and `workflow.runId`, `workflow.stageId`, and `workflow.stageName` are all non-empty strings:
|
|
194
194
|
|
|
195
195
|
```json
|
|
196
196
|
{"type":"session","version":3,"id":"uuid","timestamp":"2024-12-03T14:00:00.000Z","cwd":"/path/to/project","internal":true,"workflow":{"runId":"run-1","stageId":"stage-build","stageName":"build"}}
|
|
197
197
|
```
|
|
198
198
|
|
|
199
|
+
Malformed, incomplete, workflow-only, or truthy non-boolean legacy markers remain visible in normal history. Atomic does not infer workflow ownership from `parentSession`, so ordinary user-created forks are unaffected. Valid workflow classification is inherited when an internal workflow transcript is branched or forked.
|
|
200
|
+
|
|
199
201
|
### SessionMessageEntry
|
|
200
202
|
|
|
201
203
|
A message in the conversation. The `message` field contains an `AgentMessage`.
|
|
@@ -234,25 +236,27 @@ Emitted when the user selects a supported context-window size for the active mod
|
|
|
234
236
|
|
|
235
237
|
### CompactionEntry
|
|
236
238
|
|
|
237
|
-
|
|
239
|
+
Created by `/compact`, RPC `compact`, and automatic compaction. The `summary` field contains the mechanically reconstructed verbatim transcript string, not generated summary prose. `firstKeptEntryId` points to the first ordinary message retained after the boundary.
|
|
240
|
+
|
|
241
|
+
An entry is active only when `details.strategy` is exactly `"verbatim-lines"`:
|
|
238
242
|
|
|
239
243
|
```json
|
|
240
|
-
{"type":"compaction","id":"
|
|
244
|
+
{"type":"compaction","id":"c1","parentId":"m9","timestamp":"2026-07-13T10:00:00.000Z","summary":"[User]: fix the test\n(filtered 42 lines)\n[Assistant]: Fixed.","firstKeptEntryId":"m7","tokensBefore":51234,"details":{"strategy":"verbatim-lines","promptVersion":2,"rung":"standard","parameters":{"compression_ratio":0.5,"preserve_recent":2,"query":"fix the test"},"stats":{"linesBefore":812,"linesDeleted":417,"linesKept":395,"rangeCount":63,"tokensBefore":51234,"tokensAfter":24980,"percentReduction":51.2}}}
|
|
241
245
|
```
|
|
242
246
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
247
|
+
On rebuild, Atomic emits the durable `summary` as a synthesized visible custom message, then emits original entries beginning at `firstKeptEntryId`. This exact string survives resume without rerunning a planner. `details.rung` is `"standard"`, `"critical"`, `"deterministic"`, or `"extension"`; `details.backupPath` is optional.
|
|
248
|
+
|
|
249
|
+
Historical `compaction` records without `details.strategy: "verbatim-lines"` are retired summary-compaction records. They remain parseable and visible to audit/export tools but are inert in active LLM context.
|
|
246
250
|
|
|
247
|
-
### ContextCompactionEntry
|
|
251
|
+
### ContextCompactionEntry (Retired)
|
|
248
252
|
|
|
249
|
-
|
|
253
|
+
Older Atomic versions stored logical entry/content-block deletions in `type:"context_compaction"` records:
|
|
250
254
|
|
|
251
255
|
```json
|
|
252
|
-
{"type":"context_compaction","id":"ctx12345","parentId":"f6g7h8i9","timestamp":"2024-12-03T14:12:00.000Z","promptVersion":1,"deletedTargets":[{"kind":"entry","entryId":"b2c3d4e5"}],"protectedEntryIds":["a1b2c3d4"],"stats":{"objectsBefore":20,"objectsAfter":19,"objectsDeleted":1,"tokensBefore":50000,"tokensAfter":43000,"percentReduction":14}
|
|
256
|
+
{"type":"context_compaction","id":"ctx12345","parentId":"f6g7h8i9","timestamp":"2024-12-03T14:12:00.000Z","promptVersion":1,"deletedTargets":[{"kind":"entry","entryId":"b2c3d4e5"}],"protectedEntryIds":["a1b2c3d4"],"stats":{"objectsBefore":20,"objectsAfter":19,"objectsDeleted":1,"tokensBefore":50000,"tokensAfter":43000,"percentReduction":14}}
|
|
253
257
|
```
|
|
254
258
|
|
|
255
|
-
|
|
259
|
+
These records are archival and never produced or applied by current Atomic. When an old session resumes, previously hidden content may re-enter context until verbatim-line compaction creates an active boundary.
|
|
256
260
|
|
|
257
261
|
### BranchSummaryEntry
|
|
258
262
|
|
|
@@ -325,14 +329,12 @@ Entries form a tree:
|
|
|
325
329
|
|
|
326
330
|
## Context Building
|
|
327
331
|
|
|
328
|
-
`buildSessionContext()` walks from
|
|
329
|
-
|
|
330
|
-
1. Collects all entries on the active branch path
|
|
331
|
-
2. Extracts current model, thinking level, and context-window settings
|
|
332
|
-
3. Applies every `ContextCompactionEntry` logical deletion on that path, filtering targeted entries/content blocks from active context while leaving retained content unchanged
|
|
333
|
-
4. Converts `BranchSummaryEntry` and `CustomMessageEntry` to appropriate message formats
|
|
334
|
-
5. Ignores retired `CompactionEntry` lines for active LLM context; they remain archival JSONL data only
|
|
332
|
+
`buildSessionContext()` walks the active branch from root to leaf and replays model, thinking-level, and context-window changes. It selects the latest `compaction` entry whose `details.strategy` is `"verbatim-lines"`.
|
|
335
333
|
|
|
334
|
+
- With no active boundary, normal message, custom-message, and branch-summary entries are emitted verbatim.
|
|
335
|
+
- With a boundary, Atomic emits its durable string as a custom-role `customType:"compaction"` message, then original messages from `firstKeptEntryId` onward, including messages appended after the boundary.
|
|
336
|
+
- If a corrupt/foreign boundary's `firstKeptEntryId` is absent, Atomic emits the boundary followed by post-boundary messages rather than resurrecting all older content.
|
|
337
|
+
- Legacy `context_compaction` entries and non-verbatim `compaction` entries are skipped as inert archival records.
|
|
336
338
|
## Parsing Example
|
|
337
339
|
|
|
338
340
|
```typescript
|
|
@@ -351,10 +353,14 @@ for (const line of lines) {
|
|
|
351
353
|
console.log(`[${entry.id}] ${entry.message.role}: ${JSON.stringify(entry.message.content)}`);
|
|
352
354
|
break;
|
|
353
355
|
case "compaction":
|
|
354
|
-
|
|
356
|
+
if (entry.details?.strategy === "verbatim-lines") {
|
|
357
|
+
console.log(`[${entry.id}] Verbatim compaction: ${entry.details.stats.linesKept}/${entry.details.stats.linesBefore} lines kept`);
|
|
358
|
+
} else {
|
|
359
|
+
console.log(`[${entry.id}] Retired summary-compaction record`);
|
|
360
|
+
}
|
|
355
361
|
break;
|
|
356
362
|
case "context_compaction":
|
|
357
|
-
console.log(`[${entry.id}]
|
|
363
|
+
console.log(`[${entry.id}] Retired logical-deletion compaction record`);
|
|
358
364
|
break;
|
|
359
365
|
case "branch_summary":
|
|
360
366
|
console.log(`[${entry.id}] Branch from ${entry.fromId}`);
|
|
@@ -386,18 +392,31 @@ for (const line of lines) {
|
|
|
386
392
|
Key methods for working with sessions programmatically.
|
|
387
393
|
|
|
388
394
|
### Static Creation Methods
|
|
389
|
-
|
|
390
|
-
- `SessionManager.
|
|
391
|
-
- `SessionManager.
|
|
392
|
-
- `SessionManager.
|
|
393
|
-
- `SessionManager.
|
|
395
|
+
|
|
396
|
+
- `SessionManager.create(cwd, sessionDir?, options?)` - New session. Workflow-owned sessions require the pair `internal: true` and `workflow: { runId, stageId, stageName }`.
|
|
397
|
+
- `SessionManager.open(path, sessionDir?)` - Open a specific session file directly, including an internal session.
|
|
398
|
+
- `SessionManager.continueRecent(cwd, sessionDir?, options?)` - Continue the most recent regular session or create a new one. Pass `{ includeInternal: true }` only for workflow-specific recovery or diagnostics.
|
|
399
|
+
- `SessionManager.inMemory(cwd?, options?)` - No file persistence
|
|
400
|
+
- `SessionManager.forkFrom(sourcePath, targetCwd, sessionDir?, options?)` - Fork a session from another project. Relevant `NewSessionOptions`, including valid workflow classification, are written in the initial header.
|
|
394
401
|
|
|
395
402
|
### Static Listing Methods
|
|
396
|
-
|
|
397
|
-
- `SessionManager.
|
|
403
|
+
|
|
404
|
+
- `SessionManager.list(cwd, sessionDir?, onProgress?, options?)` - List project sessions. Internal workflow sessions are excluded by default; pass `{ includeInternal: true }` to include them and expose their `SessionInfo.workflow` linkage.
|
|
405
|
+
- `SessionManager.listAll(sessionDir?, onProgress?, options?)` - List sessions across projects, or from a custom session directory. The same `includeInternal` default and opt-in apply.
|
|
406
|
+
|
|
407
|
+
Normal `/resume`, `atomic -r`, and `--continue` callers use the default filtering. Workflow-specific code can opt in without changing user-facing history:
|
|
408
|
+
|
|
409
|
+
```typescript
|
|
410
|
+
const stages = await SessionManager.list(cwd, sessionDir, undefined, { includeInternal: true });
|
|
411
|
+
for (const stage of stages.filter((session) => session.internal)) {
|
|
412
|
+
console.log(stage.workflow?.runId, stage.workflow?.stageId, stage.path);
|
|
413
|
+
}
|
|
414
|
+
```
|
|
398
415
|
|
|
399
416
|
### Instance Methods - Session Management
|
|
400
|
-
|
|
417
|
+
|
|
418
|
+
- `newSession(options?)` - Start a new session. Options include `parentSession`, `internal`, and workflow run/stage linkage; classification requires a complete marker pair.
|
|
419
|
+
- `markSessionInternal(workflow?)` - Apply valid workflow ownership to the current session, repairing malformed markers while preserving an existing valid marker.
|
|
401
420
|
- `setSessionFile(path)` - Switch to a different session file
|
|
402
421
|
- `createBranchedSession(leafId)` - Extract branch to new session file
|
|
403
422
|
|
|
@@ -406,7 +425,7 @@ Key methods for working with sessions programmatically.
|
|
|
406
425
|
- `appendThinkingLevelChange(level)` - Record thinking change
|
|
407
426
|
- `appendContextWindowChange(contextWindow)` - Record context-window selection in tokens
|
|
408
427
|
- `appendModelChange(provider, modelId)` - Record model change
|
|
409
|
-
- `
|
|
428
|
+
- `appendCompaction(compactedText, firstKeptEntryId, tokensBefore, details)` - Add a durable verbatim-line compaction boundary
|
|
410
429
|
- `appendCustomEntry(customType, data?)` - Extension state (not in context)
|
|
411
430
|
- `appendSessionInfo(name)` - Set session display name
|
|
412
431
|
- `appendCustomMessageEntry(customType, content, display, details?)` - Extension message (in context)
|
package/docs/sessions.md
CHANGED
|
@@ -34,7 +34,7 @@ For the JSONL file format and SessionManager API, see [Session Format](/session-
|
|
|
34
34
|
| `/tree` | Navigate the current session tree |
|
|
35
35
|
| `/fork` | Create a new session from a previous user message |
|
|
36
36
|
| `/clone` | Duplicate the current active branch into a new session |
|
|
37
|
-
| `/compact` |
|
|
37
|
+
| `/compact` | Compact older transcript lines verbatim while preserving recent logical turns; see [Compaction](/compaction) |
|
|
38
38
|
| `/export [file]` | Export session to HTML |
|
|
39
39
|
| `/share` | Upload as private GitHub gist with shareable HTML link |
|
|
40
40
|
|
|
@@ -42,6 +42,8 @@ For the JSONL file format and SessionManager API, see [Session Format](/session-
|
|
|
42
42
|
|
|
43
43
|
`/resume` opens an interactive session picker for the current project. `atomic -r` opens the same picker at startup.
|
|
44
44
|
|
|
45
|
+
When Atomic reconstructs a resumed session, the latest active verbatim `compaction` entry supplies a durable compacted transcript string followed by the original kept tail. Resume does not rerun a planner or re-derive omissions. Legacy logical-deletion `context_compaction` entries are inert archival records, so previously hidden content can re-enter context in sessions created by older versions.
|
|
46
|
+
|
|
45
47
|
In the picker you can:
|
|
46
48
|
|
|
47
49
|
- search by typing
|
|
@@ -146,12 +148,12 @@ When prompted, choose one of:
|
|
|
146
148
|
2. summarize with the default prompt
|
|
147
149
|
3. summarize with custom focus instructions
|
|
148
150
|
|
|
149
|
-
Branch summaries are separate from `/compact`: branch navigation can generate summary prose (optionally with focus instructions), while Verbatim Compaction
|
|
151
|
+
Branch summaries are separate from `/compact`: branch navigation can generate summary prose (optionally with focus instructions), while Verbatim Compaction lets a model select numbered line ranges and reconstructs retained text mechanically.
|
|
150
152
|
|
|
151
153
|
See [Compaction](/compaction) for Verbatim Compaction, branch summarization internals, and extension hooks.
|
|
152
154
|
|
|
153
155
|
## Session Format
|
|
154
156
|
|
|
155
|
-
Session files are JSONL and contain message entries, model changes, thinking-level changes, context-window changes, labels,
|
|
157
|
+
Session files are JSONL and contain message entries, model changes, thinking-level changes, context-window changes, labels, active verbatim `compaction` boundaries, branch summaries, and extension entries. Retired `context_compaction` and non-verbatim `compaction` records remain parseable but inert.
|
|
156
158
|
|
|
157
159
|
For parsers, extensions, SDK usage, and the full SessionManager API, see [Session Format](/session-format).
|
package/docs/settings.md
CHANGED
|
@@ -134,18 +134,26 @@ Set `ATOMIC_SKIP_VERSION_CHECK=1` to disable the Atomic version update check. Us
|
|
|
134
134
|
|
|
135
135
|
| Setting | Type | Default | Description |
|
|
136
136
|
|---------|------|---------|-------------|
|
|
137
|
-
| `compaction.enabled` | boolean | `true` | Enable automatic
|
|
138
|
-
| `compaction.reserveTokens` | number | `16384` | Tokens reserved for
|
|
137
|
+
| `compaction.enabled` | boolean | `true` | Enable automatic verbatim line compaction |
|
|
138
|
+
| `compaction.reserveTokens` | number | `16384` | Tokens reserved for the next model response; automatic threshold compaction begins before this reserve is consumed |
|
|
139
|
+
| `compaction.compression_ratio` | number | `0.5` | Fraction of compactable transcript **lines to keep** (`0 < value < 1`) |
|
|
140
|
+
| `compaction.preserve_recent` | number | `2` | Recent context-visible messages kept outside the compactable region; Atomic widens the cut to a user-turn start and always retains the final logical turn |
|
|
141
|
+
| `compaction.query` | string | last user message | Optional relevance focus for selecting older lines to retain |
|
|
139
142
|
|
|
140
143
|
```json
|
|
141
144
|
{
|
|
142
145
|
"compaction": {
|
|
143
146
|
"enabled": true,
|
|
144
|
-
"reserveTokens": 16384
|
|
147
|
+
"reserveTokens": 16384,
|
|
148
|
+
"compression_ratio": 0.5,
|
|
149
|
+
"preserve_recent": 2,
|
|
150
|
+
"query": "optional focus"
|
|
145
151
|
}
|
|
146
152
|
}
|
|
147
153
|
```
|
|
148
154
|
|
|
155
|
+
The model emits numbered line ranges only; Atomic reconstructs retained text mechanically. `preserve_recent` is enforced client-side and is not a provider parameter.
|
|
156
|
+
|
|
149
157
|
### Branch Summary
|
|
150
158
|
|
|
151
159
|
| Setting | Type | Default | Description |
|
|
@@ -350,7 +358,9 @@ See [Atomic packages](/packages) for package management details.
|
|
|
350
358
|
"theme": "dark",
|
|
351
359
|
"compaction": {
|
|
352
360
|
"enabled": true,
|
|
353
|
-
"reserveTokens": 16384
|
|
361
|
+
"reserveTokens": 16384,
|
|
362
|
+
"compression_ratio": 0.5,
|
|
363
|
+
"preserve_recent": 2
|
|
354
364
|
},
|
|
355
365
|
"retry": {
|
|
356
366
|
"enabled": true,
|
package/docs/usage.md
CHANGED
|
@@ -93,7 +93,7 @@ Useful session commands:
|
|
|
93
93
|
- `/tree` navigates the in-file session tree and can summarize abandoned branches.
|
|
94
94
|
- `/fork` creates a new session from an earlier user message.
|
|
95
95
|
- `/clone` duplicates the current active branch into a new session file.
|
|
96
|
-
- `/compact` uses
|
|
96
|
+
- `/compact` uses verbatim line compaction: the model selects one-based numbered ranges to delete, Atomic validates them, and retained text is reconstructed mechanically with `(filtered N lines)` markers. Recent logical turns remain ordinary messages.
|
|
97
97
|
|
|
98
98
|
See [Sessions](/sessions) and [Compaction](/compaction) for details.
|
|
99
99
|
|