@bastani/atomic 0.10.11-alpha.3 → 0.10.11-alpha.4
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 +51 -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 +4 -4
- package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +4 -4
- package/dist/_shared/mode-shared-2QJSCUM6.js +4 -4
- package/dist/_shared/p1a-prewarm-XIU57JHF.js +3 -3
- package/dist/_shared/p1b-elig-TVB5CBLL.js +22 -6
- package/dist/_shared/p1b-elig-TVB5CBLL.js.map +1 -1
- package/dist/_shared/p2-shell-main-B2WIALFD.js +6 -3
- package/dist/_shared/p2-shell-main-B2WIALFD.js.map +1 -1
- package/dist/_shared/runtime-O4KCSG4C.js +2 -2
- package/dist/_shared/sdk-B5LEWGGI.js +899 -515
- 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-EZUKEP4Q.js → startup-0-0-XJJDOIEC.js} +6 -12
- package/dist/_shared/{startup-0-0-EZUKEP4Q.js.map → startup-0-0-XJJDOIEC.js.map} +1 -1
- package/dist/_shared/{startup-0-1-RTOHJFDJ.js → startup-0-1-M6OWAYHH.js} +354 -103
- package/dist/_shared/startup-0-1-M6OWAYHH.js.map +1 -0
- package/dist/_shared/startup-0-2-5QHPCEON.js +18 -9
- package/dist/_shared/startup-0-2-5QHPCEON.js.map +1 -1
- package/dist/_shared/startup-0-3-4ZYBYQNM.js +4 -4
- package/dist/_shared/startup-0-4-ZMJV547D.js +4 -4
- package/dist/_shared/startup-0-5-YDW47QX6.js +4 -4
- package/dist/_shared/startup-10-0-TDQNBDDL.js +4 -4
- package/dist/_shared/startup-12-0-55AAXBJZ.js +1 -1
- package/dist/_shared/startup-14-0-MLX36RBG.js +2 -2
- package/dist/_shared/startup-15-0-YUKGAC63.js +2 -2
- package/dist/_shared/startup-15-1-4S7FLMNG.js +4 -4
- package/dist/_shared/startup-8-0-34CBHPZH.js +2114 -235
- package/dist/_shared/startup-8-0-34CBHPZH.js.map +1 -1
- package/dist/_shared/startup-8-1-LZFXSD3Z.js +12 -12
- package/dist/_shared/storage-command-7MGXLJGZ.js +6 -6
- package/dist/_shared/storage-command-7MGXLJGZ.js.map +1 -1
- 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/CHANGELOG.md +19 -0
- package/dist/builtin/intercom/broker/broker.bundle.mjs +1020 -108
- package/dist/builtin/intercom/broker/client.ts +8 -0
- package/dist/builtin/intercom/broker/database-wake-up-bus.ts +91 -14
- package/dist/builtin/intercom/broker/multinode-router.ts +102 -17
- package/dist/builtin/intercom/broker/multinode-state-store.ts +41 -2
- package/dist/builtin/intercom/broker/send-order-gate.ts +5 -2
- package/dist/builtin/intercom/broker/sql-add-column.ts +22 -1
- package/dist/builtin/intercom/broker/sql-lease-store.ts +304 -48
- package/dist/builtin/intercom/broker/sql-outbox-store.ts +541 -50
- package/dist/builtin/intercom/broker/sql-restoring-reservation-store.ts +239 -8
- package/dist/builtin/intercom/broker/sql-retention.ts +11 -2
- package/dist/builtin/intercom/broker/sql-schema.ts +42 -8
- package/dist/builtin/intercom/index.bundle.mjs +13 -2
- 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/CHANGELOG.md +6 -0
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/skills/skill-creator/eval-viewer/generate_review.py +8 -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 +2 -2
- package/dist/cli/auth-cli.code.js +2 -2
- package/dist/cli/auth-cli.impl.js +3 -3
- package/dist/cli/auth-cli.js +3 -3
- package/dist/cli/blueprint-command.code.js +1 -1
- 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 +2 -2
- 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/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 +4 -4
- package/dist/core/export-html/index.code.js.map +1 -1
- 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.code.js +1 -1
- package/dist/core/extensions/loader-host-modules.impl.js +3 -3
- package/dist/core/extensions/loader-host-modules.js +3 -3
- package/dist/core/extensions/loader-virtual-modules.js +1 -1
- package/dist/core/extensions/runner-context.js +1 -1
- 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/process-start-token.d.ts +5 -4
- package/dist/core/sdk.code.js +2 -2
- package/dist/core/sdk.impl.js +3 -3
- package/dist/core/sdk.js +3 -3
- package/dist/core/session-manager-core.js +4 -4
- 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/database.d.ts +6 -0
- package/dist/core/storage/database.js.map +1 -1
- package/dist/core/storage/fenced-paths.d.ts +7 -6
- package/dist/core/storage/fenced-paths.js +7 -6
- package/dist/core/storage/fenced-paths.js.map +1 -1
- package/dist/core/storage/index.js +2 -2
- package/dist/core/storage/node-sqlite-thread.js +209 -19
- package/dist/core/storage/node-sqlite-thread.js.map +1 -1
- package/dist/core/storage/node-sqlite.js +435 -71
- package/dist/core/storage/node-sqlite.js.map +1 -1
- 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/schema-catalog.d.ts +69 -7
- package/dist/core/storage/schema-catalog.js +352 -61
- package/dist/core/storage/schema-catalog.js.map +1 -1
- 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 +3 -3
- 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-detach.d.ts +11 -1
- 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-sweep.js +31 -7
- package/dist/core/storage/session/fork-sweep.js.map +1 -1
- package/dist/core/storage/session/fork-window.code.js +3 -3
- 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-lock.d.ts +100 -0
- package/dist/core/storage/session/jsonl-session-store.d.ts +41 -23
- 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 +8 -8
- package/dist/core/storage/session/released-history-files.code.js.map +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/session-search-index.d.ts +9 -1
- 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 +3 -3
- 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.d.ts +51 -7
- 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/sqlite-facade.d.ts +6 -0
- package/dist/core/storage/sqlite-facade.js +309 -33
- package/dist/core/storage/sqlite-facade.js.map +1 -1
- package/dist/core/storage/sqlite-open-batch.js +10 -0
- package/dist/core/storage/sqlite-open-batch.js.map +1 -0
- 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 +2 -2
- 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.d.ts +5 -3
- package/dist/core/worktree-snapshot/blob-store.js +151 -21
- package/dist/core/worktree-snapshot/blob-store.js.map +1 -1
- package/dist/core/worktree-snapshot/errors.code.js +2 -2
- package/dist/core/worktree-snapshot/errors.impl.js +3 -3
- package/dist/core/worktree-snapshot/errors.js +3 -3
- package/dist/core/worktree-snapshot/fork-snapshot-index.js +158 -41
- package/dist/core/worktree-snapshot/fork-snapshot-index.js.map +1 -1
- 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 +2 -2
- 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 +4 -4
- package/dist/package-manager-cli.impl.js +3 -3
- package/dist/package-manager-cli.js +3 -3
- package/dist/rpc-entry.js +1 -1
- package/dist/startup-files.json +1 -1
- package/dist/startup-stages/3.js +1 -1
- package/dist/startup-stages/5.js +1 -1
- package/dist/utils/startup-database-spare.code.js +2 -2
- package/dist/utils/startup-database-spare.impl.js +3 -3
- package/dist/utils/startup-database-spare.js +3 -3
- package/dist/utils/tools-manager.code.js +1 -1
- package/dist/utils/tools-manager.impl.js +3 -3
- package/dist/utils/tools-manager.js +3 -3
- package/docs/changelog.mdx +49 -0
- package/docs/storage/jsonl.md +3 -3
- package/package.json +8 -8
- package/dist/_shared/startup-0-1-RTOHJFDJ.js.map +0 -1
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
type StorageSchemaCatalog,
|
|
5
5
|
type SqliteExecutor,
|
|
6
6
|
type SqliteRow,
|
|
7
|
+
type SqliteStatement,
|
|
7
8
|
validateStoragePrefix,
|
|
8
9
|
} from "@bastani/atomic/storage";
|
|
9
10
|
import type {
|
|
@@ -32,6 +33,7 @@ import {
|
|
|
32
33
|
ensureBrokerSchema,
|
|
33
34
|
foundInCatalogAgain,
|
|
34
35
|
openCatalogOf,
|
|
36
|
+
queueBrokerSqliteSetup,
|
|
35
37
|
RETRY_UNAPPLIED,
|
|
36
38
|
setUpBrokerSchemaOnce,
|
|
37
39
|
withBrokerSchemaCatalog,
|
|
@@ -57,6 +59,27 @@ type ReservationRow = SqliteRow & {
|
|
|
57
59
|
|
|
58
60
|
type Counter = "order" | "token";
|
|
59
61
|
|
|
62
|
+
type RenewedReservationRow = SqliteRow & {
|
|
63
|
+
reservation_key: string | null;
|
|
64
|
+
owner_session_id: string | null;
|
|
65
|
+
fencing_token: number | bigint | null;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
type MissedReservationRow = SqliteRow & {
|
|
69
|
+
reservation_key: string;
|
|
70
|
+
end_json: string | null;
|
|
71
|
+
fencing_token: number | bigint;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/** The setting a PostgreSQL batched reservation renewal sets when any reservation missed, so its follow-up read runs. */
|
|
75
|
+
const RESERVATION_RENEW_MISSES = "atomic.intercom_reservation_renew_misses";
|
|
76
|
+
|
|
77
|
+
const compare = (a: string, b: string) => (a < b ? -1 : a > b ? 1 : 0);
|
|
78
|
+
|
|
79
|
+
function wellFormed(_key: string, value: unknown): unknown {
|
|
80
|
+
return typeof value === "string" ? value.toWellFormed() : value;
|
|
81
|
+
}
|
|
82
|
+
|
|
60
83
|
const invalid = (reason: StateStoreInvalidReason): InvalidStateInput => ({ status: "invalid", reason });
|
|
61
84
|
|
|
62
85
|
function reservationOf(row: ReservationRow): RestoringReservation {
|
|
@@ -145,7 +168,7 @@ async function openRestoringReservationStoreInCatalog({
|
|
|
145
168
|
const table = `${validPrefix}intercom_restoring_reservations`;
|
|
146
169
|
const counters = `${validPrefix}intercom_restoring_reservation_counters`;
|
|
147
170
|
const wakeClaims = `${validPrefix}intercom_restoring_wake_claims`;
|
|
148
|
-
const { types, nowMs, greatest } = dialectOf(database);
|
|
171
|
+
const { types, nowMs, greatest, jsonValues, name: dialect } = dialectOf(database);
|
|
149
172
|
/**
|
|
150
173
|
* Its transactions read and write this table, its counters and its wake claims alone, which no other store
|
|
151
174
|
* touches, so they exclude one another, not every writer of the database (#6560).
|
|
@@ -198,13 +221,27 @@ async function openRestoringReservationStoreInCatalog({
|
|
|
198
221
|
!catalog.hasObject(`${table}_wake_requested`.slice(0, dialectOf(database).name === "postgres" ? 63 : undefined));
|
|
199
222
|
const catalog = await openCatalogOf(database);
|
|
200
223
|
// Brokers that open a new database at once create it once; the others wait for it without its lock (#6560).
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
(
|
|
207
|
-
|
|
224
|
+
// On SQLite inside an open scope, queue the wake index update into the open's single write transaction (#6709).
|
|
225
|
+
if (catalog === undefined || !wakeIndexCurrent(catalog)) {
|
|
226
|
+
const index = `${table}_wake`;
|
|
227
|
+
const earlier = `${table}_wake_requested`;
|
|
228
|
+
if (
|
|
229
|
+
!queueBrokerSqliteSetup(database, prefix ?? "", {
|
|
230
|
+
verify: wakeIndexCurrent,
|
|
231
|
+
run(ctx) {
|
|
232
|
+
if (ctx.catalog?.hasObject(earlier) === true) ctx.enqueue(`DROP INDEX IF EXISTS ${earlier}`);
|
|
233
|
+
if (ctx.catalog?.hasObject(index) !== true)
|
|
234
|
+
ctx.enqueue(`CREATE INDEX IF NOT EXISTS ${index} ON ${table}(owner_broker_id) WHERE wake_requested = 1`);
|
|
235
|
+
},
|
|
236
|
+
})
|
|
237
|
+
)
|
|
238
|
+
await setUpBrokerSchemaOnce(
|
|
239
|
+
database,
|
|
240
|
+
`${table}:wake-index`,
|
|
241
|
+
() => foundInCatalogAgain(database, wakeIndexCurrent),
|
|
242
|
+
(tx) => renameWakeIndex(tx, dialectOf(database), table),
|
|
243
|
+
);
|
|
244
|
+
}
|
|
208
245
|
const columns = `reservation_key, owner_session_id, owner_broker_id, child_name AS child_name_json, child_target,
|
|
209
246
|
targets_json, "group" AS reservation_group, dormant, wake, wake_generation, fencing_token, "order" AS reservation_order,
|
|
210
247
|
gone AS gone_json, end_json,
|
|
@@ -422,6 +459,200 @@ async function openRestoringReservationStoreInCatalog({
|
|
|
422
459
|
return { status: "renewed" };
|
|
423
460
|
}, { ...serial, relaxedDurability: true });
|
|
424
461
|
},
|
|
462
|
+
async renewMany(leases): Promise<RestoringReservationRenewResult[]> {
|
|
463
|
+
if (leases.length === 0) return [];
|
|
464
|
+
const invalidResults: Array<InvalidStateInput | undefined> = new Array(leases.length);
|
|
465
|
+
let validCount = 0;
|
|
466
|
+
for (let i = 0; i < leases.length; i++) {
|
|
467
|
+
const bad = invalidLease(leases[i]!);
|
|
468
|
+
if (bad !== undefined) invalidResults[i] = bad;
|
|
469
|
+
else validCount++;
|
|
470
|
+
}
|
|
471
|
+
if (validCount === 0) return invalidResults as RestoringReservationRenewResult[];
|
|
472
|
+
const tupleKey = (reservationKey: string, ownerSessionId: string, fencingToken: number) =>
|
|
473
|
+
JSON.stringify([reservationKey.toWellFormed(), ownerSessionId.toWellFormed(), fencingToken]);
|
|
474
|
+
const byTuple = new Map<string, RestoringReservationLease>();
|
|
475
|
+
const validKeys = new Set<string>();
|
|
476
|
+
let hasNonSafeIntToken = false;
|
|
477
|
+
for (let i = 0; i < leases.length; i++) {
|
|
478
|
+
if (invalidResults[i] !== undefined) continue;
|
|
479
|
+
const lease = leases[i]!;
|
|
480
|
+
validKeys.add(lease.reservationKey.toWellFormed());
|
|
481
|
+
if (!Number.isSafeInteger(lease.fencingToken)) {
|
|
482
|
+
hasNonSafeIntToken = true;
|
|
483
|
+
continue;
|
|
484
|
+
}
|
|
485
|
+
const tKey = tupleKey(lease.reservationKey, lease.ownerSessionId, lease.fencingToken);
|
|
486
|
+
if (!byTuple.has(tKey)) byTuple.set(tKey, lease);
|
|
487
|
+
}
|
|
488
|
+
const entries = [...byTuple.values()].sort((a, b) => compare(a.reservationKey, b.reservationKey));
|
|
489
|
+
const answer = (
|
|
490
|
+
renewed: ReadonlySet<string>,
|
|
491
|
+
found: ReadonlyMap<string, MissedReservationRow>,
|
|
492
|
+
): RestoringReservationRenewResult[] =>
|
|
493
|
+
leases.map((lease, index): RestoringReservationRenewResult => {
|
|
494
|
+
const bad = invalidResults[index];
|
|
495
|
+
if (bad !== undefined) return bad;
|
|
496
|
+
if (
|
|
497
|
+
Number.isSafeInteger(lease.fencingToken) &&
|
|
498
|
+
renewed.has(tupleKey(lease.reservationKey, lease.ownerSessionId, lease.fencingToken))
|
|
499
|
+
)
|
|
500
|
+
return { status: "renewed" };
|
|
501
|
+
const row = found.get(lease.reservationKey.toWellFormed());
|
|
502
|
+
if (row === undefined || row.end_json !== null) return { status: "stale" };
|
|
503
|
+
return { status: "stale", currentFencingToken: Number(row.fencing_token) };
|
|
504
|
+
});
|
|
505
|
+
if (dialect === "postgres") {
|
|
506
|
+
const keysParam = JSON.stringify([...validKeys], wellFormed);
|
|
507
|
+
if (entries.length === 0) {
|
|
508
|
+
const readAll: SqliteStatement = {
|
|
509
|
+
sql: `SELECT reservation_key, end_json, fencing_token FROM ${table}
|
|
510
|
+
WHERE reservation_key = ANY(ARRAY(SELECT value FROM ${jsonValues("?")}))`,
|
|
511
|
+
params: [keysParam],
|
|
512
|
+
};
|
|
513
|
+
return database.transaction(
|
|
514
|
+
async (tx) => {
|
|
515
|
+
const found = new Map<string, MissedReservationRow>();
|
|
516
|
+
for (const row of await tx.all<MissedReservationRow>(readAll.sql, ...readAll.params))
|
|
517
|
+
found.set(row.reservation_key, row);
|
|
518
|
+
return answer(new Set(), found);
|
|
519
|
+
},
|
|
520
|
+
{ ...serial, leading: [readAll], leadingOnly: true, relaxedDurability: true },
|
|
521
|
+
);
|
|
522
|
+
}
|
|
523
|
+
const write: SqliteStatement = {
|
|
524
|
+
sql: `WITH requested AS MATERIALIZED (
|
|
525
|
+
SELECT
|
|
526
|
+
entry ->> 0 AS reservation_key,
|
|
527
|
+
entry ->> 1 AS owner_session_id,
|
|
528
|
+
(entry ->> 2)::bigint AS fencing_token
|
|
529
|
+
FROM jsonb_array_elements((?)::jsonb) AS entry
|
|
530
|
+
),
|
|
531
|
+
locked AS MATERIALIZED (
|
|
532
|
+
SELECT t.reservation_key, requested.owner_session_id, requested.fencing_token
|
|
533
|
+
FROM ${table} AS t
|
|
534
|
+
JOIN requested
|
|
535
|
+
ON t.reservation_key = requested.reservation_key
|
|
536
|
+
AND t.owner_session_id = requested.owner_session_id
|
|
537
|
+
AND t.fencing_token = requested.fencing_token
|
|
538
|
+
WHERE t.reservation_key = ANY(ARRAY(SELECT DISTINCT reservation_key FROM requested))
|
|
539
|
+
AND t.end_json IS NULL
|
|
540
|
+
ORDER BY t.reservation_key
|
|
541
|
+
FOR UPDATE OF t
|
|
542
|
+
),
|
|
543
|
+
renewed AS (
|
|
544
|
+
UPDATE ${table} AS t
|
|
545
|
+
SET renewed_at = ${nowMs}
|
|
546
|
+
FROM locked
|
|
547
|
+
WHERE t.reservation_key = locked.reservation_key
|
|
548
|
+
AND t.owner_session_id = locked.owner_session_id
|
|
549
|
+
AND t.fencing_token = locked.fencing_token
|
|
550
|
+
AND t.end_json IS NULL
|
|
551
|
+
RETURNING t.reservation_key, t.owner_session_id, t.fencing_token
|
|
552
|
+
),
|
|
553
|
+
gate AS MATERIALIZED (
|
|
554
|
+
SELECT set_config('${RESERVATION_RENEW_MISSES}',
|
|
555
|
+
CASE WHEN (SELECT COUNT(*) FROM renewed) < CAST(? AS ${types.int}) THEN '1' ELSE '' END,
|
|
556
|
+
true) AS misses
|
|
557
|
+
)
|
|
558
|
+
SELECT renewed.reservation_key, renewed.owner_session_id, renewed.fencing_token
|
|
559
|
+
FROM gate LEFT JOIN renewed ON TRUE`,
|
|
560
|
+
params: [
|
|
561
|
+
JSON.stringify(
|
|
562
|
+
entries.map((lease) => [lease.reservationKey, lease.ownerSessionId, lease.fencingToken]),
|
|
563
|
+
wellFormed,
|
|
564
|
+
),
|
|
565
|
+
entries.length + (hasNonSafeIntToken ? 1 : 0),
|
|
566
|
+
],
|
|
567
|
+
};
|
|
568
|
+
const readMisses: SqliteStatement = {
|
|
569
|
+
sql: `SELECT reservation_key, end_json, fencing_token FROM ${table}
|
|
570
|
+
WHERE current_setting('${RESERVATION_RENEW_MISSES}', true) = '1'
|
|
571
|
+
AND reservation_key = ANY(ARRAY(SELECT value FROM ${jsonValues("?")}))`,
|
|
572
|
+
params: [keysParam],
|
|
573
|
+
};
|
|
574
|
+
return database.transaction(
|
|
575
|
+
async (tx) => {
|
|
576
|
+
const renewed = new Set<string>();
|
|
577
|
+
for (const row of await tx.all<RenewedReservationRow>(write.sql, ...write.params))
|
|
578
|
+
if (
|
|
579
|
+
row.reservation_key !== null &&
|
|
580
|
+
row.owner_session_id !== null &&
|
|
581
|
+
row.fencing_token !== null
|
|
582
|
+
)
|
|
583
|
+
renewed.add(tupleKey(row.reservation_key, row.owner_session_id, Number(row.fencing_token)));
|
|
584
|
+
const found = new Map<string, MissedReservationRow>();
|
|
585
|
+
for (const row of await tx.all<MissedReservationRow>(readMisses.sql, ...readMisses.params))
|
|
586
|
+
found.set(row.reservation_key, row);
|
|
587
|
+
return answer(renewed, found);
|
|
588
|
+
},
|
|
589
|
+
{ ...serial, leading: [write, readMisses], leadingOnly: true, relaxedDurability: true },
|
|
590
|
+
);
|
|
591
|
+
}
|
|
592
|
+
const write: SqliteStatement | undefined =
|
|
593
|
+
entries.length === 0
|
|
594
|
+
? undefined
|
|
595
|
+
: {
|
|
596
|
+
sql: `WITH requested AS (
|
|
597
|
+
SELECT
|
|
598
|
+
json_extract(value, '$[0]') AS req_reservation_key,
|
|
599
|
+
json_extract(value, '$[1]') AS req_owner_session_id,
|
|
600
|
+
json_extract(value, '$[2]') AS req_fencing_token
|
|
601
|
+
FROM json_each(?)
|
|
602
|
+
)
|
|
603
|
+
UPDATE ${table}
|
|
604
|
+
SET renewed_at = ${nowMs}
|
|
605
|
+
FROM requested
|
|
606
|
+
WHERE ${table}.reservation_key = requested.req_reservation_key
|
|
607
|
+
AND ${table}.owner_session_id = requested.req_owner_session_id
|
|
608
|
+
AND ${table}.fencing_token = requested.req_fencing_token
|
|
609
|
+
AND ${table}.end_json IS NULL
|
|
610
|
+
RETURNING reservation_key, owner_session_id, fencing_token`,
|
|
611
|
+
params: [
|
|
612
|
+
JSON.stringify(
|
|
613
|
+
entries.map((lease) => [lease.reservationKey, lease.ownerSessionId, lease.fencingToken]),
|
|
614
|
+
wellFormed,
|
|
615
|
+
),
|
|
616
|
+
],
|
|
617
|
+
};
|
|
618
|
+
const readMissedSql = `SELECT reservation_key, end_json, fencing_token FROM ${table}
|
|
619
|
+
WHERE reservation_key IN (SELECT value FROM ${jsonValues("?")})`;
|
|
620
|
+
return database.transaction(
|
|
621
|
+
async (tx) => {
|
|
622
|
+
const renewed = new Set<string>();
|
|
623
|
+
if (write !== undefined) {
|
|
624
|
+
for (const row of await tx.all<RenewedReservationRow>(write.sql, ...write.params))
|
|
625
|
+
if (
|
|
626
|
+
row.reservation_key !== null &&
|
|
627
|
+
row.owner_session_id !== null &&
|
|
628
|
+
row.fencing_token !== null
|
|
629
|
+
)
|
|
630
|
+
renewed.add(tupleKey(row.reservation_key, row.owner_session_id, Number(row.fencing_token)));
|
|
631
|
+
}
|
|
632
|
+
const missedKeys = new Set<string>();
|
|
633
|
+
for (let i = 0; i < leases.length; i++) {
|
|
634
|
+
if (invalidResults[i] !== undefined) continue;
|
|
635
|
+
const lease = leases[i]!;
|
|
636
|
+
if (
|
|
637
|
+
Number.isSafeInteger(lease.fencingToken) &&
|
|
638
|
+
renewed.has(tupleKey(lease.reservationKey, lease.ownerSessionId, lease.fencingToken))
|
|
639
|
+
)
|
|
640
|
+
continue;
|
|
641
|
+
missedKeys.add(lease.reservationKey.toWellFormed());
|
|
642
|
+
}
|
|
643
|
+
const found = new Map<string, MissedReservationRow>();
|
|
644
|
+
if (missedKeys.size > 0) {
|
|
645
|
+
const rows = await tx.all<MissedReservationRow>(
|
|
646
|
+
readMissedSql,
|
|
647
|
+
JSON.stringify([...missedKeys], wellFormed),
|
|
648
|
+
);
|
|
649
|
+
for (const row of rows) found.set(row.reservation_key, row);
|
|
650
|
+
}
|
|
651
|
+
return answer(renewed, found);
|
|
652
|
+
},
|
|
653
|
+
{ ...serial, relaxedDurability: true },
|
|
654
|
+
);
|
|
655
|
+
},
|
|
425
656
|
async release(lease, outcome): Promise<RestoringReservationReleaseResult> {
|
|
426
657
|
const bad = invalidLease(lease);
|
|
427
658
|
if (bad !== undefined) return bad;
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
validateStoragePrefix,
|
|
8
8
|
} from "@bastani/atomic/storage";
|
|
9
9
|
import { isMissingPrivilege } from "./sql-add-column.js";
|
|
10
|
-
import { brokerSchemaCurrent, ensureBrokerSchema, openCatalogOf } from "./sql-schema.js";
|
|
10
|
+
import { brokerSchemaCurrent, ensureBrokerSchema, openCatalogOf, queueBrokerSqliteSetup } from "./sql-schema.js";
|
|
11
11
|
|
|
12
12
|
/** The most rows one retention statement deletes, as River's job cleaner and Oban's pruner bound theirs. */
|
|
13
13
|
export const RETENTION_DELETE_BATCH = 1_000;
|
|
@@ -137,5 +137,14 @@ export async function ensureRetentionIndexes(database: SqliteDatabase, prefix: s
|
|
|
137
137
|
? (await database.all("SELECT name FROM sqlite_master WHERE type = 'index' AND name IN (?, ?)", ...retired))
|
|
138
138
|
.length > 0
|
|
139
139
|
: retired.some((index) => catalog.sqliteObjectType?.(index) === "index");
|
|
140
|
-
if (present)
|
|
140
|
+
if (present) {
|
|
141
|
+
const queued = queueBrokerSqliteSetup(database, prefix ?? "", {
|
|
142
|
+
verify: (found) => !retired.some((index) => found.sqliteObjectType?.(index) === "index"),
|
|
143
|
+
run(ctx) {
|
|
144
|
+
if (ctx.catalog === undefined || retired.some((index) => ctx.catalog?.sqliteObjectType?.(index) === "index"))
|
|
145
|
+
ctx.enqueue(drops.join(";\n"));
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
if (!queued) await database.transaction((tx) => tx.exec(drops.join(";\n")));
|
|
149
|
+
}
|
|
141
150
|
}
|
|
@@ -23,6 +23,7 @@ const catalogApi: Partial<
|
|
|
23
23
|
| "refreshStorageSchemaCatalog"
|
|
24
24
|
| "setUpStorageOnce"
|
|
25
25
|
| "ensureStorageSchemaOnce"
|
|
26
|
+
| "queueSqliteSchemaSetup"
|
|
26
27
|
>
|
|
27
28
|
> = storage;
|
|
28
29
|
|
|
@@ -51,16 +52,28 @@ export async function withBrokerSchemaCatalog<T>(
|
|
|
51
52
|
return withCatalog === undefined ? open() : withCatalog(database, storageMigrationTable(prefix), open, views);
|
|
52
53
|
}
|
|
53
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Queues a SQLite schema setup into the broker open's active schema catalog scope so every needed store setup commits
|
|
57
|
+
* in one write transaction before the open returns (#6709). Returns false on PostgreSQL, outside an open scope, or on
|
|
58
|
+
* an Atomic installation older than #6709.
|
|
59
|
+
*/
|
|
60
|
+
export function queueBrokerSqliteSetup(
|
|
61
|
+
database: SqliteDatabase,
|
|
62
|
+
prefix: string | undefined,
|
|
63
|
+
setup: storage.SqliteSchemaBatchSetup,
|
|
64
|
+
): boolean {
|
|
65
|
+
const queue = catalogApi.queueSqliteSchemaSetup;
|
|
66
|
+
if (queue === undefined || dialectOf(database).versionedMigrations) return false;
|
|
67
|
+
return queue(database, prefix === undefined ? undefined : storageMigrationTable(prefix), setup);
|
|
68
|
+
}
|
|
69
|
+
|
|
54
70
|
/**
|
|
55
71
|
* Runs `setup`, a broker store's idempotent schema statements, in a transaction of its own, unless the prefix's ledger
|
|
56
72
|
* records `revision` for `store` already (#5218): on PostgreSQL a current schema runs no DDL, so a role with only DML
|
|
57
73
|
* privileges opens the store. Raise `revision` whenever `setup` creates or alters anything new. Inside an open that read
|
|
58
|
-
* the catalog (`withStorageSchemaCatalog`), a revision it found recorded skips the transaction too (#6560). On SQLite
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* store in the catalog instead; there a setup whose objects the catalog holds is checked again, and a counter it seeds
|
|
62
|
-
* seeded, in the one transaction the open's end stamps every such store in, so later opens of a current schema take no
|
|
63
|
-
* write lock and answer every store from its stamp.
|
|
74
|
+
* the catalog (`withStorageSchemaCatalog`), a revision it found recorded skips the transaction too (#6560). On SQLite,
|
|
75
|
+
* setups needed within one open scope are queued and committed together in one write transaction with their stamps
|
|
76
|
+
* (#6709), so subsequent opens answer every store from its stamp with no write lock.
|
|
64
77
|
*/
|
|
65
78
|
export async function ensureBrokerSchema(
|
|
66
79
|
database: SqliteDatabase,
|
|
@@ -72,8 +85,26 @@ export async function ensureBrokerSchema(
|
|
|
72
85
|
const schema = { ledger: storageMigrationTable(prefix), domain: `intercom-${store}`, revision };
|
|
73
86
|
if (await catalogApi.storageSchemaCurrent?.(database, schema)) return;
|
|
74
87
|
const found = await foundInCatalog(database, setup);
|
|
75
|
-
if (foundSetUp(database, schema, setup, found)) return;
|
|
76
88
|
const dialect = dialectOf(database);
|
|
89
|
+
if (
|
|
90
|
+
!dialect.versionedMigrations &&
|
|
91
|
+
queueBrokerSqliteSetup(database, prefix ?? "", {
|
|
92
|
+
stamp: schema,
|
|
93
|
+
verify: found?.verify,
|
|
94
|
+
run: async (ctx) => {
|
|
95
|
+
if (found !== undefined) {
|
|
96
|
+
if (ctx.catalog !== undefined && found.verify(ctx.catalog) && !found.seeds) return;
|
|
97
|
+
for (const script of found.scripts) ctx.enqueue(script);
|
|
98
|
+
for (const table of found.tables) ctx.noteTableCreated(table);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
await ctx.flushWrites();
|
|
102
|
+
await setup(ctx.tx);
|
|
103
|
+
},
|
|
104
|
+
})
|
|
105
|
+
)
|
|
106
|
+
return;
|
|
107
|
+
if (foundSetUp(database, schema, setup, found)) return;
|
|
77
108
|
// Idempotent, and run again when a busy database ended it before it wrote anything. Brokers that open a new
|
|
78
109
|
// database at once set each store up once: the others wait for it without its lock, and find
|
|
79
110
|
// it set up in the catalog they read again (#6560).
|
|
@@ -224,6 +255,8 @@ async function foundInCatalog(
|
|
|
224
255
|
readonly verify: (catalog: storage.StorageSchemaCatalog) => boolean;
|
|
225
256
|
readonly seeds: boolean;
|
|
226
257
|
readonly present: boolean;
|
|
258
|
+
readonly scripts: readonly string[];
|
|
259
|
+
readonly tables: readonly string[];
|
|
227
260
|
}
|
|
228
261
|
| undefined
|
|
229
262
|
> {
|
|
@@ -265,7 +298,8 @@ async function foundInCatalog(
|
|
|
265
298
|
}
|
|
266
299
|
const verify = (found: storage.StorageSchemaCatalog) =>
|
|
267
300
|
created.every(({ name, type }) => found.sqliteObjectType?.(name) === type);
|
|
268
|
-
|
|
301
|
+
const tables = created.filter(({ type }) => type === "table").map(({ name }) => name);
|
|
302
|
+
return { verify, seeds, present: verify(catalog), scripts, tables };
|
|
269
303
|
}
|
|
270
304
|
|
|
271
305
|
/** `INSERT INTO … ON CONFLICT … DO NOTHING`: rows a setup seeds once, which writing again leaves as they are. */
|
|
@@ -7,7 +7,7 @@ import * as __atomicHostImport1 from "@bastani/atomic-ai";
|
|
|
7
7
|
if (!(name in namespace)) missing.push(`The requested module '${specifier}' does not provide an export named '${name}'`);
|
|
8
8
|
if (missing.length > 0) {
|
|
9
9
|
const application = typeof __atomicHostImport0.APP_NAME === "string" ? __atomicHostImport0.APP_NAME : "atomic";
|
|
10
|
-
if (__atomicHostImport0.VERSION !== "0.10.11-alpha.
|
|
10
|
+
if (__atomicHostImport0.VERSION !== "0.10.11-alpha.4") missing.unshift(application + " was updated to 0.10.11-alpha.4 while this session was running; restart it to keep using the intercom extension.");
|
|
11
11
|
throw new Error(missing.join("\n"));
|
|
12
12
|
}
|
|
13
13
|
}
|
|
@@ -10511,6 +10511,10 @@ var init_client = __esm(() => {
|
|
|
10511
10511
|
this.heardOutcomes.set(messageId, "saved");
|
|
10512
10512
|
writeMessage(this.requireActiveSocket(), { type: "received", messageId, ...paused ? { paused: true } : {} });
|
|
10513
10513
|
}
|
|
10514
|
+
forgetUnsavedOutcome(messageId) {
|
|
10515
|
+
if (this.heardOutcomes.get(messageId) === "heard")
|
|
10516
|
+
this.heardOutcomes.delete(messageId);
|
|
10517
|
+
}
|
|
10514
10518
|
heardOutcomeAgain(message) {
|
|
10515
10519
|
if (message.replyTo === undefined)
|
|
10516
10520
|
return false;
|
|
@@ -17268,6 +17272,8 @@ function piIntercomExtension(atomic, testOverrides = {}) {
|
|
|
17268
17272
|
saved.finally(() => clearInterval(saving)).catch(() => {});
|
|
17269
17273
|
saved.then(async (arrival) => {
|
|
17270
17274
|
if (arrival !== "fresh") {
|
|
17275
|
+
if (arrival === "unsaved")
|
|
17276
|
+
receiver.forgetUnsavedOutcome(message.id);
|
|
17271
17277
|
place.cancel();
|
|
17272
17278
|
return;
|
|
17273
17279
|
}
|
|
@@ -17276,9 +17282,13 @@ function piIntercomExtension(atomic, testOverrides = {}) {
|
|
|
17276
17282
|
await handleIncomingMessage(liveContext, from, bounded, channel, place);
|
|
17277
17283
|
else
|
|
17278
17284
|
place.cancel();
|
|
17279
|
-
}).catch(() =>
|
|
17285
|
+
}).catch(() => {
|
|
17286
|
+
receiver.forgetUnsavedOutcome(message.id);
|
|
17287
|
+
place.cancel();
|
|
17288
|
+
}).finally(() => arrived.resolve());
|
|
17280
17289
|
}, () => {
|
|
17281
17290
|
clearInterval(saving);
|
|
17291
|
+
receiver.forgetUnsavedOutcome(message.id);
|
|
17282
17292
|
place.cancel();
|
|
17283
17293
|
arrived.resolve();
|
|
17284
17294
|
});
|
|
@@ -17515,6 +17525,7 @@ function piIntercomExtension(atomic, testOverrides = {}) {
|
|
|
17515
17525
|
function attachClientHandlers(nextClient) {
|
|
17516
17526
|
nextClient.on("message", (from, message, channel) => {
|
|
17517
17527
|
if (client !== nextClient || !getLiveContext()) {
|
|
17528
|
+
nextClient.forgetUnsavedOutcome(message.id);
|
|
17518
17529
|
return;
|
|
17519
17530
|
}
|
|
17520
17531
|
receiveIncomingMessage(nextClient, from, message, channel);
|
|
@@ -6,7 +6,7 @@ import * as __atomicHostImport0 from "@bastani/atomic";
|
|
|
6
6
|
if (!(name in namespace)) missing.push(`The requested module '${specifier}' does not provide an export named '${name}'`);
|
|
7
7
|
if (missing.length > 0) {
|
|
8
8
|
const application = typeof __atomicHostImport0.APP_NAME === "string" ? __atomicHostImport0.APP_NAME : "atomic";
|
|
9
|
-
if (__atomicHostImport0.VERSION !== "0.10.11-alpha.
|
|
9
|
+
if (__atomicHostImport0.VERSION !== "0.10.11-alpha.4") missing.unshift(application + " was updated to 0.10.11-alpha.4 while this session was running; restart it to keep using the mcp extension.");
|
|
10
10
|
throw new Error(missing.join("\n"));
|
|
11
11
|
}
|
|
12
12
|
}
|
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.10.11-alpha.4] - 2026-11-27
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- The skill-creator's review viewer now prints its URL and opens the browser as soon as it serves. Before, it first looked up the name of 127.0.0.1, which could take many seconds when the resolver was slow to answer, as on some Macs ([#6691](https://github.com/bastani-inc/atomic/issues/6691)).
|
|
10
|
+
|
|
5
11
|
## [0.10.11-alpha.2] - 2026-11-26
|
|
6
12
|
|
|
7
13
|
### Changed
|
|
@@ -26,6 +26,7 @@ import os
|
|
|
26
26
|
import re
|
|
27
27
|
import secrets
|
|
28
28
|
import socket
|
|
29
|
+
import socketserver
|
|
29
30
|
import stat
|
|
30
31
|
import sys
|
|
31
32
|
import time
|
|
@@ -573,6 +574,10 @@ class ReviewServer(HTTPServer):
|
|
|
573
574
|
|
|
574
575
|
On Windows, SO_REUSEADDR would let it bind a port that is already in use,
|
|
575
576
|
so it asks for the port exclusively there instead.
|
|
577
|
+
|
|
578
|
+
It binds without HTTPServer's lookup of its address's name (socket.getfqdn),
|
|
579
|
+
a reverse DNS query that can wait many seconds for a resolver before the URL
|
|
580
|
+
is printed. It serves only 127.0.0.1, so its name is localhost.
|
|
576
581
|
"""
|
|
577
582
|
|
|
578
583
|
allow_reuse_address = os.name != "nt"
|
|
@@ -580,7 +585,9 @@ class ReviewServer(HTTPServer):
|
|
|
580
585
|
def server_bind(self) -> None:
|
|
581
586
|
if os.name == "nt":
|
|
582
587
|
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_EXCLUSIVEADDRUSE, 1)
|
|
583
|
-
|
|
588
|
+
socketserver.TCPServer.server_bind(self)
|
|
589
|
+
self.server_name = "localhost"
|
|
590
|
+
self.server_port = self.server_address[1]
|
|
584
591
|
|
|
585
592
|
|
|
586
593
|
def start_server(port: int, handler) -> HTTPServer:
|
|
@@ -10,7 +10,7 @@ import * as __atomicHostImport4 from "@bastani/atomic-ai";
|
|
|
10
10
|
if (!(name in namespace)) missing.push(`The requested module '${specifier}' does not provide an export named '${name}'`);
|
|
11
11
|
if (missing.length > 0) {
|
|
12
12
|
const application = typeof __atomicHostImport0.APP_NAME === "string" ? __atomicHostImport0.APP_NAME : "atomic";
|
|
13
|
-
if (__atomicHostImport0.VERSION !== "0.10.11-alpha.
|
|
13
|
+
if (__atomicHostImport0.VERSION !== "0.10.11-alpha.4") missing.unshift(application + " was updated to 0.10.11-alpha.4 while this session was running; restart it to keep using the subagents extension.");
|
|
14
14
|
throw new Error(missing.join("\n"));
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -8,7 +8,7 @@ import * as __atomicHostImport2 from "@bastani/atomic-ai/compat";
|
|
|
8
8
|
if (!(name in namespace)) missing.push(`The requested module '${specifier}' does not provide an export named '${name}'`);
|
|
9
9
|
if (missing.length > 0) {
|
|
10
10
|
const application = typeof __atomicHostImport0.APP_NAME === "string" ? __atomicHostImport0.APP_NAME : "atomic";
|
|
11
|
-
if (__atomicHostImport0.VERSION !== "0.10.11-alpha.
|
|
11
|
+
if (__atomicHostImport0.VERSION !== "0.10.11-alpha.4") missing.unshift(application + " was updated to 0.10.11-alpha.4 while this session was running; restart it to keep using the web-access extension.");
|
|
12
12
|
throw new Error(missing.join("\n"));
|
|
13
13
|
}
|
|
14
14
|
}
|
package/dist/cli/args.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "../_shared/rolldown-runtime-BGM3D5V3.js";
|
|
2
|
-
import { isValidThinkingLevel } from "../_shared/startup-0-0-
|
|
3
|
-
import { insertForcedOptionsBeforeTerminator, parseArgs, printHelp } from "../_shared/startup-0-1-
|
|
2
|
+
import { isValidThinkingLevel } from "../_shared/startup-0-0-XJJDOIEC.js";
|
|
3
|
+
import { insertForcedOptionsBeforeTerminator, parseArgs, printHelp } from "../_shared/startup-0-1-M6OWAYHH.js";
|
|
4
4
|
export { insertForcedOptionsBeforeTerminator, isValidThinkingLevel, parseArgs, printHelp };
|
|
5
5
|
//# sourceMappingURL=args.js.map
|
|
@@ -3,10 +3,10 @@ import chalk from "chalk";
|
|
|
3
3
|
import { APP_NAME, ENV_DEBUG, getAgentDir, getAuthPath, setEnvValue } from "../_shared/p0-cli-BB45ZQY6.js";
|
|
4
4
|
import { AuthStorage, ReadOnlyAuthStorage } from "../_shared/startup-0-4-ZMJV547D.js";
|
|
5
5
|
import { CredentialSynchronizationError, ModelRuntime, isOAuthLoginCancelled } from "../_shared/startup-0-5-YDW47QX6.js";
|
|
6
|
-
import { RawStdoutWriteError, flushRawStdout, restoreStdout, takeOverStdout, writeRawStdout, writeRawStdoutOnce } from "../_shared/startup-0-0-
|
|
6
|
+
import { RawStdoutWriteError, flushRawStdout, restoreStdout, takeOverStdout, writeRawStdout, writeRawStdoutOnce } from "../_shared/startup-0-0-XJJDOIEC.js";
|
|
7
7
|
import { findExactModelReferenceMatch, resolveModelReference } from "../_shared/startup-0-2-5QHPCEON.js";
|
|
8
8
|
import { SettingsManager } from "../_shared/startup-8-1-LZFXSD3Z.js";
|
|
9
|
-
import { parseArgs } from "../_shared/startup-0-1-
|
|
9
|
+
import { parseArgs } from "../_shared/startup-0-1-M6OWAYHH.js";
|
|
10
10
|
import { ModelsError } from "@bastani/atomic-ai";
|
|
11
11
|
import { InMemoryCodingAgentModelsStore, resolveCliModel } from "../_shared/startup-0-3-4ZYBYQNM.js";
|
|
12
12
|
import { extractBearerToken, redactCredentialShapes } from "../_shared/p1b-elig-TVB5CBLL.js";
|
|
@@ -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.11-alpha.
|
|
9
|
+
const key = `${root.href}#0.10.11-alpha.4`;
|
|
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.11-alpha.
|
|
31
|
-
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.
|
|
30
|
+
if (running === undefined || running.version === "0.10.11-alpha.4") throw error;
|
|
31
|
+
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.4 while this session was running; restart it to keep using this feature.", {
|
|
32
32
|
cause: error,
|
|
33
33
|
});
|
|
34
34
|
}
|
package/dist/cli/auth-cli.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.11-alpha.
|
|
9
|
+
const key = `${root.href}#0.10.11-alpha.4`;
|
|
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.11-alpha.
|
|
31
|
-
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.
|
|
30
|
+
if (running === undefined || running.version === "0.10.11-alpha.4") throw error;
|
|
31
|
+
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.11-alpha.4 while this session was running; restart it to keep using this feature.", {
|
|
32
32
|
cause: error,
|
|
33
33
|
});
|
|
34
34
|
}
|
|
@@ -10,7 +10,7 @@ import { computeEnvironmentHash, sha256Hex } from "../_shared/startup-0-3-4ZYBYQ
|
|
|
10
10
|
import { canonicalizeWorktreePath, repositoryIdOf, sharedRepositoryIdOf } from "../_shared/startup-0-4-ZMJV547D.js";
|
|
11
11
|
import { ProjectTrustStore, renameWithRetry } from "../_shared/p1b-elig-TVB5CBLL.js";
|
|
12
12
|
import { MemorySnapshotBlobStore } from "../core/worktree-snapshot/blob-store.js";
|
|
13
|
-
import { ResumeTimingsRecorder, formatResumeTimings, timeCheckoutRestore } from "../_shared/startup-0-1-
|
|
13
|
+
import { ResumeTimingsRecorder, formatResumeTimings, timeCheckoutRestore } from "../_shared/startup-0-1-M6OWAYHH.js";
|
|
14
14
|
// dist/core/resume/blueprint/cache-stores.js
|
|
15
15
|
/**
|
|
16
16
|
* The package-manager stores `atomic blueprint cache-key` detects (#4748): which lockfiles at the repository root name a
|