@bastani/atomic 0.10.12 → 0.10.13
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 +20 -0
- package/dist/_shared/dist-KOELCESV.js +2 -2
- package/dist/_shared/fork-row-index-UAUAQRD5.js +2 -2
- package/dist/_shared/lib-4PES5P4V.js +2 -2
- package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js +9 -3
- package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js.map +1 -1
- package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +3 -3
- package/dist/_shared/mode-shared-2QJSCUM6.js +3 -3
- package/dist/_shared/p1a-prewarm-XIU57JHF.js +3 -3
- package/dist/_shared/runtime-O4KCSG4C.js +1 -1
- package/dist/_shared/sdk-B5LEWGGI.js +13 -4
- package/dist/_shared/sdk-B5LEWGGI.js.map +1 -1
- package/dist/_shared/session-data-AHTU7IS6.js +2 -2
- package/dist/_shared/session-manager-list-2BLEEZVG.js +1 -1
- package/dist/_shared/{startup-0-0-XJJDOIEC.js → startup-0-0-DZAYBBTI.js} +88 -5
- package/dist/_shared/startup-0-0-DZAYBBTI.js.map +1 -0
- package/dist/_shared/startup-0-1-M6OWAYHH.js +3 -3
- package/dist/_shared/startup-0-2-5QHPCEON.js +3 -3
- package/dist/_shared/startup-0-3-4ZYBYQNM.js +3 -3
- package/dist/_shared/startup-0-4-ZMJV547D.js +3 -3
- package/dist/_shared/startup-0-5-YDW47QX6.js +3 -3
- package/dist/_shared/startup-10-0-TDQNBDDL.js +3 -3
- package/dist/_shared/startup-12-0-55AAXBJZ.js +1 -1
- package/dist/_shared/startup-14-0-MLX36RBG.js +1 -1
- package/dist/_shared/startup-15-0-YUKGAC63.js +3 -1
- package/dist/_shared/startup-15-0-YUKGAC63.js.map +1 -1
- package/dist/_shared/startup-15-1-4S7FLMNG.js +11 -3
- package/dist/_shared/startup-15-1-4S7FLMNG.js.map +1 -1
- package/dist/_shared/startup-8-0-34CBHPZH.js +7 -6
- package/dist/_shared/startup-8-0-34CBHPZH.js.map +1 -1
- package/dist/_shared/startup-8-1-LZFXSD3Z.js +3 -3
- package/dist/_shared/storage-command-7MGXLJGZ.js +3 -3
- package/dist/_shared/storage-status-K7PX2RXA.js +2 -2
- package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
- package/dist/_shared/team-DOQKICG2.js +1 -1
- package/dist/_shared/tree-outline-MUEPK5B7.js +2 -2
- package/dist/builtin/intercom/index.bundle.mjs +1 -1
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/index.bundle.mjs +1 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +1 -1
- package/dist/builtin/web-access/index.bundle.mjs +1 -1
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/cli/args.js +1 -1
- package/dist/cli/auth-cli.code.js +1 -1
- package/dist/cli/auth-cli.impl.js +3 -3
- package/dist/cli/auth-cli.js +3 -3
- package/dist/cli/blueprint-command.impl.js +3 -3
- package/dist/cli/blueprint-command.js +3 -3
- package/dist/cli/intercom-command.code.js +2 -2
- package/dist/cli/intercom-command.impl.js +3 -3
- package/dist/cli/intercom-command.js +3 -3
- package/dist/cli/list-models.code.js +1 -1
- package/dist/cli/list-models.impl.js +3 -3
- package/dist/cli/list-models.js +3 -3
- package/dist/cli/session-picker.code.js +1 -1
- package/dist/cli/session-picker.impl.js +3 -3
- package/dist/cli/session-picker.js +3 -3
- package/dist/cli/startup-ui.code.js +1 -1
- package/dist/cli/startup-ui.impl.js +3 -3
- package/dist/cli/startup-ui.js +3 -3
- package/dist/cli/storage-command.impl.js +3 -3
- package/dist/cli/storage-command.js +3 -3
- package/dist/cli/storage-search-session.code.js +1 -1
- package/dist/cli/storage-search-session.impl.js +3 -3
- package/dist/cli/storage-search-session.js +3 -3
- package/dist/cli/team-command.code.js +1 -1
- package/dist/cli/team-command.impl.js +3 -3
- package/dist/cli/team-command.js +3 -3
- package/dist/cli.js +2 -2
- package/dist/core/agent-session-types.d.ts +5 -1
- package/dist/core/debug.impl.js +3 -3
- package/dist/core/debug.js +3 -3
- package/dist/core/export-html/card-projection.impl.js +3 -3
- package/dist/core/export-html/card-projection.js +3 -3
- package/dist/core/export-html/index.code.js +2 -2
- package/dist/core/export-html/index.impl.js +3 -3
- package/dist/core/export-html/index.js +3 -3
- package/dist/core/export-html/json-spans.impl.js +3 -3
- package/dist/core/export-html/json-spans.js +3 -3
- package/dist/core/export-html/oversized-render-inputs.impl.js +3 -3
- package/dist/core/export-html/oversized-render-inputs.js +3 -3
- package/dist/core/export-html/tool-renderer.impl.js +3 -3
- package/dist/core/export-html/tool-renderer.js +3 -3
- package/dist/core/extensions/jiti-loader.impl.js +3 -3
- package/dist/core/extensions/jiti-loader.js +3 -3
- package/dist/core/extensions/jiti-static-loader.impl.js +3 -3
- package/dist/core/extensions/jiti-static-loader.js +3 -3
- package/dist/core/extensions/loader-host-modules.impl.js +3 -3
- package/dist/core/extensions/loader-host-modules.js +3 -3
- package/dist/core/intercom-broker-control-host.impl.js +3 -3
- package/dist/core/intercom-broker-control-host.js +3 -3
- package/dist/core/intercom-broker-control.code.js +3 -3
- package/dist/core/intercom-broker-control.impl.js +3 -3
- package/dist/core/intercom-broker-control.js +3 -3
- package/dist/core/package-manager-storage-adapters.impl.js +3 -3
- package/dist/core/package-manager-storage-adapters.js +3 -3
- package/dist/core/sdk.code.js +1 -1
- package/dist/core/sdk.impl.js +3 -3
- package/dist/core/sdk.js +3 -3
- package/dist/core/session-append-recovery.d.ts +34 -0
- package/dist/core/session-manager-core.d.ts +7 -0
- package/dist/core/session-manager-core.js +72 -28
- package/dist/core/session-manager-core.js.map +1 -1
- package/dist/core/session-manager-list.impl.js +3 -3
- package/dist/core/session-manager-list.js +3 -3
- package/dist/core/session-manager.code.js +1 -1
- package/dist/core/session-manager.impl.js +3 -3
- package/dist/core/session-manager.js +3 -3
- package/dist/core/session-storage.impl.js +3 -3
- package/dist/core/session-storage.js +3 -3
- package/dist/core/storage/index.js +2 -2
- package/dist/core/storage/node-sqlite-thread.js +2 -2
- package/dist/core/storage/node-sqlite.js +2 -2
- package/dist/core/storage/offline-snapshot-file.impl.js +3 -3
- package/dist/core/storage/offline-snapshot-file.js +3 -3
- package/dist/core/storage/provider.js +2 -2
- package/dist/core/storage/selection.js +2 -2
- package/dist/core/storage/session/branch-fork-source.code.js +2 -2
- package/dist/core/storage/session/branch-fork-source.impl.js +3 -3
- package/dist/core/storage/session/branch-fork-source.js +3 -3
- package/dist/core/storage/session/card-view.impl.js +3 -3
- package/dist/core/storage/session/card-view.js +3 -3
- package/dist/core/storage/session/child-reader.code.js +2 -2
- package/dist/core/storage/session/child-reader.impl.js +3 -3
- package/dist/core/storage/session/child-reader.js +3 -3
- package/dist/core/storage/session/chunked-resume-projection.impl.js +3 -3
- package/dist/core/storage/session/chunked-resume-projection.js +3 -3
- package/dist/core/storage/session/expanded-child-details.code.js +2 -2
- package/dist/core/storage/session/expanded-child-details.impl.js +3 -3
- package/dist/core/storage/session/expanded-child-details.js +3 -3
- package/dist/core/storage/session/fork-row-bytes.impl.js +3 -3
- package/dist/core/storage/session/fork-row-bytes.js +3 -3
- package/dist/core/storage/session/fork-row-index.impl.js +3 -3
- package/dist/core/storage/session/fork-row-index.js +3 -3
- package/dist/core/storage/session/fork-staging.code.js +1 -1
- package/dist/core/storage/session/fork-staging.impl.js +3 -3
- package/dist/core/storage/session/fork-staging.js +3 -3
- package/dist/core/storage/session/fork-window.code.js +2 -2
- package/dist/core/storage/session/fork-window.impl.js +3 -3
- package/dist/core/storage/session/fork-window.js +3 -3
- package/dist/core/storage/session/history-pages.impl.js +3 -3
- package/dist/core/storage/session/history-pages.js +3 -3
- package/dist/core/storage/session/jsonl-entry-projection.impl.js +3 -3
- package/dist/core/storage/session/jsonl-entry-projection.js +3 -3
- package/dist/core/storage/session/jsonl-session-store.impl.js +3 -3
- package/dist/core/storage/session/jsonl-session-store.js +3 -3
- package/dist/core/storage/session/memory-session-store.impl.js +3 -3
- package/dist/core/storage/session/memory-session-store.js +3 -3
- package/dist/core/storage/session/pinned-branch-resume.code.js +3 -3
- package/dist/core/storage/session/pinned-branch-resume.impl.js +3 -3
- package/dist/core/storage/session/pinned-branch-resume.js +3 -3
- package/dist/core/storage/session/released-history-files.code.js +1 -1
- package/dist/core/storage/session/released-history-files.impl.js +3 -3
- package/dist/core/storage/session/released-history-files.js +3 -3
- package/dist/core/storage/session/resident-fork-rows.impl.js +3 -3
- package/dist/core/storage/session/resident-fork-rows.js +3 -3
- package/dist/core/storage/session/session-resume.impl.js +3 -3
- package/dist/core/storage/session/session-resume.js +3 -3
- package/dist/core/storage/session/snapshot-cut.impl.js +3 -3
- package/dist/core/storage/session/snapshot-cut.js +3 -3
- package/dist/core/storage/session/snapshot-history.code.js +2 -2
- package/dist/core/storage/session/snapshot-history.impl.js +3 -3
- package/dist/core/storage/session/snapshot-history.js +3 -3
- package/dist/core/storage/session/sql-session-store.impl.js +3 -3
- package/dist/core/storage/session/sql-session-store.js +3 -3
- package/dist/core/storage/session/tree-outline.impl.js +3 -3
- package/dist/core/storage/session/tree-outline.js +3 -3
- package/dist/core/storage/session/tree-presentation.impl.js +3 -3
- package/dist/core/storage/session/tree-presentation.js +3 -3
- package/dist/core/storage/storage-status.impl.js +3 -3
- package/dist/core/storage/storage-status.js +3 -3
- package/dist/core/storage/team.impl.js +3 -3
- package/dist/core/storage/team.js +3 -3
- package/dist/core/structured-output/index.impl.js +3 -3
- package/dist/core/structured-output/index.js +3 -3
- package/dist/core/tasks/task-completion-entry.impl.js +3 -3
- package/dist/core/tasks/task-completion-entry.js +3 -3
- package/dist/core/tasks/task-file-history.code.js +3 -3
- package/dist/core/tasks/task-file-history.impl.js +3 -3
- package/dist/core/tasks/task-file-history.js +3 -3
- package/dist/core/tasks/task-reference-archive.code.js +3 -3
- package/dist/core/tasks/task-reference-archive.js +3 -3
- package/dist/core/tasks/task-reference-identity.js +3 -3
- package/dist/core/tasks/task-reference-stream.impl.js +3 -3
- package/dist/core/tasks/task-reference-stream.js +3 -3
- package/dist/core/tasks/task-unsaved-answer.impl.js +3 -3
- package/dist/core/tasks/task-unsaved-answer.js +3 -3
- package/dist/core/tasks/task-view-source.impl.js +3 -3
- package/dist/core/tasks/task-view-source.js +3 -3
- package/dist/core/tools/read-url.code.js +1 -1
- package/dist/core/tools/read-url.impl.js +3 -3
- package/dist/core/tools/read-url.js +3 -3
- package/dist/core/worktree-snapshot/blob-store.js +2 -2
- package/dist/core/worktree-snapshot/errors.code.js +1 -1
- package/dist/core/worktree-snapshot/errors.impl.js +3 -3
- package/dist/core/worktree-snapshot/errors.js +3 -3
- package/dist/core/worktree-snapshot/session-index-reset.impl.js +3 -3
- package/dist/core/worktree-snapshot/session-index-reset.js +3 -3
- package/dist/extensions/codemode/execute.code.js +1 -1
- package/dist/extensions/codemode/execute.impl.js +3 -3
- package/dist/extensions/codemode/execute.js +3 -3
- package/dist/extensions/codemode/renderer.code.js +1 -1
- package/dist/extensions/codemode/renderer.impl.js +3 -3
- package/dist/extensions/codemode/renderer.js +3 -3
- package/dist/extensions/mcp/cli.code.js +1 -1
- package/dist/extensions/mcp/cli.impl.js +3 -3
- package/dist/extensions/mcp/cli.js +3 -3
- package/dist/extensions/mcp/cli.lazy.code.js +2 -2
- package/dist/extensions/mcp/cli.lazy.impl.js +3 -3
- package/dist/extensions/mcp/cli.lazy.js +3 -3
- package/dist/extensions/mcp/runtime.impl.js +3 -3
- package/dist/extensions/mcp/runtime.js +3 -3
- package/dist/index.js +1 -1
- package/dist/main-first-time-setup.code.js +1 -1
- package/dist/main-first-time-setup.impl.js +3 -3
- package/dist/main-first-time-setup.js +3 -3
- package/dist/modes/interactive/components/stored-tree-view.code.js +2 -2
- package/dist/modes/interactive/components/stored-tree-view.impl.js +3 -3
- package/dist/modes/interactive/components/stored-tree-view.js +3 -3
- package/dist/modes/interactive/components/user-message-selector-archive.impl.js +3 -3
- package/dist/modes/interactive/components/user-message-selector-archive.js +3 -3
- package/dist/package-manager-cli.code.js +3 -3
- package/dist/package-manager-cli.impl.js +3 -3
- package/dist/package-manager-cli.js +3 -3
- package/dist/startup-files.json +1 -1
- package/dist/startup-stages/3.js +1 -1
- package/dist/utils/startup-database-spare.code.js +1 -1
- package/dist/utils/startup-database-spare.impl.js +3 -3
- package/dist/utils/startup-database-spare.js +3 -3
- package/dist/utils/tools-manager.impl.js +3 -3
- package/dist/utils/tools-manager.js +3 -3
- package/docs/changelog.mdx +9 -1
- package/package.json +8 -8
- package/dist/_shared/startup-0-0-XJJDOIEC.js.map +0 -1
|
@@ -6,7 +6,7 @@ try {
|
|
|
6
6
|
} catch (error) {
|
|
7
7
|
const root = new URL("../", import.meta.url);
|
|
8
8
|
const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
|
|
9
|
-
const key = `${root.href}#0.10.
|
|
9
|
+
const key = `${root.href}#0.10.13`;
|
|
10
10
|
let release = releases.get(key);
|
|
11
11
|
if (release === undefined) {
|
|
12
12
|
const current = (async () => {
|
|
@@ -27,8 +27,8 @@ try {
|
|
|
27
27
|
release = current;
|
|
28
28
|
}
|
|
29
29
|
const running = await release;
|
|
30
|
-
if (running === undefined || running.version === "0.10.
|
|
31
|
-
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.
|
|
30
|
+
if (running === undefined || running.version === "0.10.13") throw error;
|
|
31
|
+
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.13 while this session was running; restart it to keep using this feature.", {
|
|
32
32
|
cause: error,
|
|
33
33
|
});
|
|
34
34
|
}
|
package/dist/core/sdk.code.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../_shared/rolldown-runtime-BGM3D5V3.js";
|
|
2
|
-
import { withFileMutationQueue } from "../_shared/startup-0-0-
|
|
2
|
+
import { withFileMutationQueue } from "../_shared/startup-0-0-DZAYBBTI.js";
|
|
3
3
|
import { isPowerShellToolResult, withResourceAdmission } from "../_shared/startup-0-1-M6OWAYHH.js";
|
|
4
4
|
import { STRUCTURED_OUTPUT_TOOL_NAME, createStructuredOutputCapture, createStructuredOutputTool, getPowerShellConfig } from "../_shared/startup-0-2-5QHPCEON.js";
|
|
5
5
|
import { BASH_SHELL_PRESENTATION, createBashTool, createCodingTools, createEditTool, createFindTool, createKillTool, createLocalPowerShellOperations, createLsTool, createPowerShellTool, createPowerShellToolDefinition, createReadOnlyTools, createReadTool, createSearchTool, createWriteTool } from "../_shared/startup-8-1-LZFXSD3Z.js";
|
package/dist/core/sdk.impl.js
CHANGED
|
@@ -6,7 +6,7 @@ try {
|
|
|
6
6
|
} catch (error) {
|
|
7
7
|
const root = new URL("../", import.meta.url);
|
|
8
8
|
const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
|
|
9
|
-
const key = `${root.href}#0.10.
|
|
9
|
+
const key = `${root.href}#0.10.13`;
|
|
10
10
|
let release = releases.get(key);
|
|
11
11
|
if (release === undefined) {
|
|
12
12
|
const current = (async () => {
|
|
@@ -27,8 +27,8 @@ try {
|
|
|
27
27
|
release = current;
|
|
28
28
|
}
|
|
29
29
|
const running = await release;
|
|
30
|
-
if (running === undefined || running.version === "0.10.
|
|
31
|
-
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.
|
|
30
|
+
if (running === undefined || running.version === "0.10.13") throw error;
|
|
31
|
+
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.13 while this session was running; restart it to keep using this feature.", {
|
|
32
32
|
cause: error,
|
|
33
33
|
});
|
|
34
34
|
}
|
package/dist/core/sdk.js
CHANGED
|
@@ -6,7 +6,7 @@ try {
|
|
|
6
6
|
} catch (error) {
|
|
7
7
|
const root = new URL("../", import.meta.url);
|
|
8
8
|
const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
|
|
9
|
-
const key = `${root.href}#0.10.
|
|
9
|
+
const key = `${root.href}#0.10.13`;
|
|
10
10
|
let release = releases.get(key);
|
|
11
11
|
if (release === undefined) {
|
|
12
12
|
const current = (async () => {
|
|
@@ -27,8 +27,8 @@ try {
|
|
|
27
27
|
release = current;
|
|
28
28
|
}
|
|
29
29
|
const running = await release;
|
|
30
|
-
if (running === undefined || running.version === "0.10.
|
|
31
|
-
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.
|
|
30
|
+
if (running === undefined || running.version === "0.10.13") throw error;
|
|
31
|
+
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.13 while this session was running; restart it to keep using this feature.", {
|
|
32
32
|
cause: error,
|
|
33
33
|
});
|
|
34
34
|
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type StorageTransientError } from "./storage/errors.js";
|
|
2
|
+
export interface AppendRecoveryNotice {
|
|
3
|
+
readonly state: "waiting" | "recovered";
|
|
4
|
+
readonly elapsedMs: number;
|
|
5
|
+
readonly reconnecting: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface LiveAppendRecovery {
|
|
8
|
+
readonly lifetime: AbortSignal;
|
|
9
|
+
readonly signal: () => AbortSignal | undefined;
|
|
10
|
+
readonly notify: (notice: AppendRecoveryNotice) => void;
|
|
11
|
+
}
|
|
12
|
+
/** Only a dropped or refused PostgreSQL connection is an outage, not a busy lock or a refused write. */
|
|
13
|
+
export declare function postgresAppendConnectionFailure(error: unknown): StorageTransientError | undefined;
|
|
14
|
+
/** Holds one mutation's place in the session queue while it waits for PostgreSQL. Never replays a write itself. */
|
|
15
|
+
export declare class SessionAppendRecovery {
|
|
16
|
+
private readonly started;
|
|
17
|
+
private readonly abort;
|
|
18
|
+
private readonly signal;
|
|
19
|
+
private readonly live;
|
|
20
|
+
private timer;
|
|
21
|
+
private announced;
|
|
22
|
+
private disconnected;
|
|
23
|
+
constructor(live?: LiveAppendRecovery);
|
|
24
|
+
cancel(): void;
|
|
25
|
+
private get remainingMs();
|
|
26
|
+
private notify;
|
|
27
|
+
private scheduleNotice;
|
|
28
|
+
get reconnecting(): boolean;
|
|
29
|
+
markDisconnected(): void;
|
|
30
|
+
wait(): Promise<boolean>;
|
|
31
|
+
finish(saved: boolean): void;
|
|
32
|
+
}
|
|
33
|
+
export declare function formatAppendRecoveryNotice({ state, elapsedMs, reconnecting }: AppendRecoveryNotice): string;
|
|
34
|
+
//# sourceMappingURL=session-append-recovery.d.ts.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ImageContent, Message, TextContent, Usage } from "@bastani/atomic-ai/compat";
|
|
2
2
|
import type { VerbatimCompactionDetails } from "./compaction/compaction-types.js";
|
|
3
3
|
import type { BashExecutionMessage, CustomMessage } from "./messages.ts";
|
|
4
|
+
import { type LiveAppendRecovery } from "./session-append-recovery.js";
|
|
4
5
|
import type { ContextEditEntry, FileEntry, LatestBranchSettings, ModelChangeEntry, ModelFallbackRecord, NewSessionOptions, SessionContext, SessionEntry, SessionHeader, SessionInfo, SessionListProgress, SessionNameState, SessionOpenOptions, SessionProjection, SessionTreeNode, ThinkingLevelChangeEntry, UsageEntry, WorktreeRestoreHostWarning } from "./session-manager-types.ts";
|
|
5
6
|
import { type ChatRecordOwner, type SessionChatRecords } from "./storage/session/chat-records.js";
|
|
6
7
|
import { SessionConflictError, type SessionJsonValue } from "./storage/session/errors.js";
|
|
@@ -39,6 +40,8 @@ export declare class SessionManager {
|
|
|
39
40
|
/** Another writer's entries stopped an append while `appendHaltPolicy` held: appends reject with it (#5135). */
|
|
40
41
|
private appendHalt;
|
|
41
42
|
private appendHaltPolicy;
|
|
43
|
+
private liveAppendRecovery;
|
|
44
|
+
private pendingAppendRecovery;
|
|
42
45
|
/** How many live sessions run on this manager; while any do, its session is marked open (#4971). */
|
|
43
46
|
private openHolds;
|
|
44
47
|
private openMarker;
|
|
@@ -79,6 +82,10 @@ export declare class SessionManager {
|
|
|
79
82
|
* then writes nothing more after the other writer's entries, inside that writer's turn.
|
|
80
83
|
*/
|
|
81
84
|
haltAppendsOnConflictWhile(policy: () => boolean): void;
|
|
85
|
+
/** @internal Allow a live session to wait for its database until the run or session is stopped. */
|
|
86
|
+
bindAppendRecovery(live: LiveAppendRecovery): void;
|
|
87
|
+
/** @internal Stop waiting for the database, including a write started before the agent run. */
|
|
88
|
+
cancelAppendRecovery(): void;
|
|
82
89
|
/** The conflict that halted appends, if one did (#5135). */
|
|
83
90
|
getAppendHalt(): SessionConflictError | undefined;
|
|
84
91
|
/** Lets appends go on after the other writer's entries again (#5135). */
|
|
@@ -5,7 +5,7 @@ import { isProxy } from "node:util/types";
|
|
|
5
5
|
import { getCurrentSystemMessage } from "@bastani/atomic-ai";
|
|
6
6
|
import { recordsStrictToolLimits } from "@bastani/atomic-ai/api/strict-tool-limits";
|
|
7
7
|
import { createSessionCwdMatcherAsync, getAgentDir, normalizePath, pathsEqual, resolvePath } from "../_shared/p0-cli-BB45ZQY6.js";
|
|
8
|
-
import { TOOL_DEACTIVATION_ENTRY_TYPE, chatEpoch, classifiedWorkflowMetadata, forkScope, forkStoreRelation, getDefaultSessionDirPath, storedRows, yieldToEventLoop } from "../_shared/startup-0-0-
|
|
8
|
+
import { SessionAppendRecovery, TOOL_DEACTIVATION_ENTRY_TYPE, chatEpoch, classifiedWorkflowMetadata, forkScope, forkStoreRelation, getDefaultSessionDirPath, postgresAppendConnectionFailure, storedRows, yieldToEventLoop } from "../_shared/startup-0-0-DZAYBBTI.js";
|
|
9
9
|
import { ChildCatalog, SessionKeyDigests, TOOL_OUTPUT_ENTRY_TYPE, WorkspaceConfigError, assertSessionBlobStore, carriedTransformedPrompt, carryCompletionEvidence, convertToLlm, copySessionBlobs, sessionBlobHashes, shareCompletionEvidence, storeInlineToolOutputs, storeSessionBlobs, takeInlineToolOutput, takeInlineToolOutputEntry, writeChunksAtomically } from "../_shared/startup-0-1-M6OWAYHH.js";
|
|
10
10
|
import { LEAF_MOVE_ENTRY_TYPE, applyContextEdit, assertSessionNotOpenElsewhere, buildContextEntries, buildSessionIndex, buildSessionProjection, buildSessionTree, collectContextEdits, getBranchPath, getLatestCompactionBoundaryEntry, holdSessionOpenMarker, isLeafMoveEntry } from "../_shared/startup-0-3-4ZYBYQNM.js";
|
|
11
11
|
import { SessionConflictError, SessionFormatVersionError, SessionIdMismatchError, SessionNotFoundError, StorageUnavailableError } from "./storage/session/errors.js";
|
|
@@ -715,6 +715,8 @@ var SessionManager = class SessionManager {
|
|
|
715
715
|
/** Another writer's entries stopped an append while `appendHaltPolicy` held: appends reject with it (#5135). */
|
|
716
716
|
appendHalt;
|
|
717
717
|
appendHaltPolicy;
|
|
718
|
+
liveAppendRecovery;
|
|
719
|
+
pendingAppendRecovery;
|
|
718
720
|
/** How many live sessions run on this manager; while any do, its session is marked open (#4971). */
|
|
719
721
|
openHolds = 0;
|
|
720
722
|
openMarker;
|
|
@@ -769,6 +771,14 @@ var SessionManager = class SessionManager {
|
|
|
769
771
|
this.appendHalt = void 0;
|
|
770
772
|
this.appendHaltPolicy = policy;
|
|
771
773
|
}
|
|
774
|
+
/** @internal Allow a live session to wait for its database until the run or session is stopped. */
|
|
775
|
+
bindAppendRecovery(live) {
|
|
776
|
+
this.liveAppendRecovery = live;
|
|
777
|
+
}
|
|
778
|
+
/** @internal Stop waiting for the database, including a write started before the agent run. */
|
|
779
|
+
cancelAppendRecovery() {
|
|
780
|
+
this.pendingAppendRecovery?.cancel();
|
|
781
|
+
}
|
|
772
782
|
/** The conflict that halted appends, if one did (#5135). */
|
|
773
783
|
getAppendHalt() {
|
|
774
784
|
return this.appendHalt;
|
|
@@ -1472,27 +1482,47 @@ var SessionManager = class SessionManager {
|
|
|
1472
1482
|
if (target) this.restoreOpened({ resume: target }, this.sessionFile);
|
|
1473
1483
|
return this.applyAppended(entries);
|
|
1474
1484
|
}
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1485
|
+
const recovery = this.store.descriptor.adapter === "postgres" ? new SessionAppendRecovery(this.liveAppendRecovery) : void 0;
|
|
1486
|
+
this.pendingAppendRecovery = recovery;
|
|
1487
|
+
let saved = false;
|
|
1488
|
+
let reconciles = 0;
|
|
1489
|
+
try {
|
|
1490
|
+
for (;;) {
|
|
1491
|
+
const expectSeq = this.lastSeq;
|
|
1492
|
+
try {
|
|
1493
|
+
const written = await this.store.append(this.sessionId, entries, {
|
|
1494
|
+
expectSeq,
|
|
1495
|
+
...this.archiveOnlyEpoch || this.historyEpoch === void 0 ? {} : { epoch: this.historyEpoch }
|
|
1496
|
+
});
|
|
1497
|
+
if (target) this.restoreOpened({ resume: target }, this.sessionFile);
|
|
1498
|
+
this.lastSeq = written.lastSeq;
|
|
1499
|
+
} catch (error) {
|
|
1500
|
+
if (error instanceof SessionNotFoundError) {
|
|
1501
|
+
this.deletedFromStore = true;
|
|
1502
|
+
throw new SessionDeletedError(this.sessionId, { cause: error });
|
|
1503
|
+
}
|
|
1504
|
+
const disconnected = recovery && postgresAppendConnectionFailure(error);
|
|
1505
|
+
if (recovery && disconnected?.outcome === "not-applied") {
|
|
1506
|
+
if (await recovery.wait()) continue;
|
|
1507
|
+
throw error;
|
|
1508
|
+
}
|
|
1509
|
+
if (!disconnected && (appendFailureWroteNothing(error) || ++reconciles > MAX_APPEND_RECONCILES)) throw error;
|
|
1510
|
+
if (disconnected) recovery?.markDisconnected();
|
|
1511
|
+
const unknown = disconnected?.outcome === "unknown" || isStorageTransientError(error) && error.outcome === "unknown";
|
|
1512
|
+
if (await this.reconcileAppend(entries, error, unknown, expectSeq, target, recovery)) {
|
|
1513
|
+
saved = true;
|
|
1514
|
+
return;
|
|
1515
|
+
}
|
|
1516
|
+
if (recovery && disconnected && !await recovery.wait()) throw error;
|
|
1517
|
+
continue;
|
|
1488
1518
|
}
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
continue;
|
|
1519
|
+
this.applyAppended(entries);
|
|
1520
|
+
saved = true;
|
|
1521
|
+
return;
|
|
1493
1522
|
}
|
|
1494
|
-
|
|
1495
|
-
|
|
1523
|
+
} finally {
|
|
1524
|
+
this.pendingAppendRecovery = void 0;
|
|
1525
|
+
recovery?.finish(saved);
|
|
1496
1526
|
}
|
|
1497
1527
|
}
|
|
1498
1528
|
applyAppended(entries) {
|
|
@@ -1613,17 +1643,29 @@ var SessionManager = class SessionManager {
|
|
|
1613
1643
|
* read, when its history no longer extends the one this manager holds, or when it shows the failed append wrote
|
|
1614
1644
|
* nothing and the failure is not one that passes.
|
|
1615
1645
|
*/
|
|
1616
|
-
async reconcileAppend(entries, error, unknown, expectSeq, target) {
|
|
1646
|
+
async reconcileAppend(entries, error, unknown, expectSeq, target, recovery) {
|
|
1617
1647
|
for (const entry of entries) this.unconfirmed.add(entry.id);
|
|
1648
|
+
const conflict = error instanceof SessionConflictError;
|
|
1618
1649
|
let read;
|
|
1619
|
-
try {
|
|
1650
|
+
for (;;) try {
|
|
1620
1651
|
read = await readSessionRange(this.store, this.sessionId, Math.max(1, this.lastSeq), Number.MAX_SAFE_INTEGER, this.archiveOnlyEpoch ? this.historyEpoch : void 0);
|
|
1621
|
-
|
|
1652
|
+
break;
|
|
1653
|
+
} catch (readError) {
|
|
1654
|
+
if (recovery && (unknown || conflict) && postgresAppendConnectionFailure(readError) && await recovery.wait()) continue;
|
|
1655
|
+
if (conflict && this.appendHaltPolicy?.() === true) this.appendHalt ??= error;
|
|
1622
1656
|
throw error;
|
|
1623
1657
|
}
|
|
1624
1658
|
const stored = this.lastSeq > 0 ? read.entries : [void 0, ...read.entries];
|
|
1625
1659
|
const lastHeld = this.lastEntryId ?? void 0;
|
|
1626
|
-
if (stored[0]?.id !== lastHeld || this.historyEpoch !== void 0 && "epoch" in read && read.epoch !== this.historyEpoch)
|
|
1660
|
+
if (stored[0]?.id !== lastHeld || this.historyEpoch !== void 0 && "epoch" in read && read.epoch !== this.historyEpoch) {
|
|
1661
|
+
if (recovery?.reconnecting) {
|
|
1662
|
+
const stop = conflict ? error : new SessionConflictError(this.sessionId, expectSeq, read.lastSeq);
|
|
1663
|
+
if (this.appendHaltPolicy?.() === true) this.appendHalt ??= stop;
|
|
1664
|
+
throw stop;
|
|
1665
|
+
}
|
|
1666
|
+
if (conflict && this.appendHaltPolicy?.() === true) this.appendHalt ??= error;
|
|
1667
|
+
throw error;
|
|
1668
|
+
}
|
|
1627
1669
|
const own = new Map(entries.map((entry) => [entry.id, entry]));
|
|
1628
1670
|
const tail = stored.slice(1).map((entry) => own.get(entry.id) ?? entry);
|
|
1629
1671
|
const saved = tail.some((entry) => own.has(entry.id));
|
|
@@ -1640,8 +1682,10 @@ var SessionManager = class SessionManager {
|
|
|
1640
1682
|
this._buildIndex();
|
|
1641
1683
|
this.leafId = leafId;
|
|
1642
1684
|
this.lastSeq = read.lastSeq;
|
|
1643
|
-
if (saved)
|
|
1644
|
-
|
|
1685
|
+
if (saved) {
|
|
1686
|
+
if (recovery?.reconnecting && foreign && this.appendHaltPolicy?.() === true) this.appendHalt ??= new SessionConflictError(this.sessionId, expectSeq + entries.length, this.lastSeq);
|
|
1687
|
+
return true;
|
|
1688
|
+
}
|
|
1645
1689
|
if (target && tail.length > 0 || foreign || conflict && tail.length === 0) {
|
|
1646
1690
|
const stop = conflict ? error : new SessionConflictError(this.sessionId, expectSeq, this.lastSeq);
|
|
1647
1691
|
if (this.appendHaltPolicy?.() === true) this.appendHalt ??= stop;
|
|
@@ -2833,7 +2877,7 @@ function __atomicOnDemandFailed(error, feature) {
|
|
|
2833
2877
|
return (async () => {
|
|
2834
2878
|
const root = new URL("../", import.meta.url);
|
|
2835
2879
|
const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
|
|
2836
|
-
const key = `${root.href}#0.10.
|
|
2880
|
+
const key = `${root.href}#0.10.13`;
|
|
2837
2881
|
let release = releases.get(key);
|
|
2838
2882
|
if (release === undefined) {
|
|
2839
2883
|
const current = (async () => {
|
|
@@ -2861,7 +2905,7 @@ function __atomicOnDemandFailed(error, feature) {
|
|
|
2861
2905
|
} catch {
|
|
2862
2906
|
// No installation to read, as in a bundle of the package: the release the process runs decides.
|
|
2863
2907
|
}
|
|
2864
|
-
const updatedTo = typeof installed === "string" && installed !== "0.10.
|
|
2908
|
+
const updatedTo = typeof installed === "string" && installed !== "0.10.13" ? installed : running !== undefined && running.version !== "0.10.13" ? "0.10.13" : undefined;
|
|
2865
2909
|
if (updatedTo === undefined) throw error;
|
|
2866
2910
|
const application = typeof running?.name === "string" ? running.name : "atomic";
|
|
2867
2911
|
const restart = new Error(`${application} was updated to ${updatedTo} while this session was running; restart it to keep using ${feature}.`, {
|