@bastani/atomic 0.10.18-alpha.1 → 0.10.18
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 +41 -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 +2 -2
- package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +2 -2
- package/dist/_shared/mode-shared-2QJSCUM6.js +2 -2
- package/dist/_shared/p1a-prewarm-XIU57JHF.js +3 -3
- package/dist/_shared/sdk-OHKMDJ74.js +9 -10
- package/dist/_shared/sdk-OHKMDJ74.js.map +1 -1
- package/dist/_shared/session-data-AHTU7IS6.js +2 -2
- package/dist/_shared/startup-0-0-OV6RAEAP.js +2 -2
- package/dist/_shared/startup-0-1-EZAJI6RE.js +2 -2
- package/dist/_shared/startup-0-2-YZZOC22D.js +2 -2
- package/dist/_shared/startup-0-3-DE2NCS6A.js +2 -2
- package/dist/_shared/startup-0-4-ZMJV547D.js +4 -3
- package/dist/_shared/startup-0-4-ZMJV547D.js.map +1 -1
- package/dist/_shared/startup-0-5-HZX3ZPTP.js +3 -5
- package/dist/_shared/startup-0-5-HZX3ZPTP.js.map +1 -1
- package/dist/_shared/startup-10-0-TDQNBDDL.js +2 -2
- package/dist/_shared/startup-15-1-4S7FLMNG.js +2 -2
- package/dist/_shared/startup-8-0-34CBHPZH.js +2 -2
- package/dist/_shared/startup-8-1-LZFXSD3Z.js +2 -2
- package/dist/_shared/storage-command-7MGXLJGZ.js +72 -8
- 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/tree-outline-MUEPK5B7.js +2 -2
- package/dist/builtin/intercom/broker/broker.bundle.mjs +158 -78
- package/dist/builtin/intercom/broker/multinode-router.ts +41 -8
- package/dist/builtin/intercom/broker/multinode-state-store.ts +6 -1
- package/dist/builtin/intercom/broker/sql-lease-store.ts +89 -80
- package/dist/builtin/intercom/broker/sql-pending-ask-store.ts +65 -6
- 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/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.impl.js +3 -3
- package/dist/cli/list-models.js +3 -3
- package/dist/cli/session-picker.impl.js +3 -3
- package/dist/cli/session-picker.js +3 -3
- 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.impl.js +3 -3
- package/dist/cli/storage-search-session.js +3 -3
- 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 +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 +2 -2
- 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.impl.js +3 -3
- package/dist/core/sdk.js +3 -3
- package/dist/core/session-manager-core.js +2 -2
- package/dist/core/session-manager-list.impl.js +3 -3
- package/dist/core/session-manager-list.js +3 -3
- 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 -2
- package/dist/core/storage/database.js.map +1 -1
- package/dist/core/storage/fenced-paths.d.ts +15 -0
- package/dist/core/storage/fenced-paths.js +25 -0
- package/dist/core/storage/fenced-paths.js.map +1 -1
- package/dist/core/storage/index.js +2 -2
- package/dist/core/storage/migrations.d.ts +2 -11
- package/dist/core/storage/migrations.js +2 -9
- package/dist/core/storage/migrations.js.map +1 -1
- 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/postgres-locks.d.ts +11 -0
- package/dist/core/storage/postgres-locks.js +9 -0
- package/dist/core/storage/postgres-locks.js.map +1 -0
- 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.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 +2 -2
- 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.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.d.ts +1 -1
- 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.js +6 -4
- package/dist/core/storage/sqlite-facade.js.map +1 -1
- 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/heartbeat-notice.d.ts +0 -1
- 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 +2 -2
- 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 +2 -2
- 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.impl.js +3 -3
- package/dist/core/tools/read-url.js +3 -3
- package/dist/core/worktree-snapshot/blob-store.d.ts +14 -16
- package/dist/core/worktree-snapshot/blob-store.js +194 -81
- package/dist/core/worktree-snapshot/blob-store.js.map +1 -1
- package/dist/core/worktree-snapshot/collection-claim.js +8 -0
- package/dist/core/worktree-snapshot/collection-claim.js.map +1 -0
- 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/core/worktree-snapshot/snapshot-epoch-migration.js +209 -0
- package/dist/core/worktree-snapshot/snapshot-epoch-migration.js.map +1 -0
- package/dist/core/worktree-snapshot/snapshot-epoch.js +100 -0
- package/dist/core/worktree-snapshot/snapshot-epoch.js.map +1 -0
- package/dist/extensions/codemode/execute.impl.js +3 -3
- package/dist/extensions/codemode/execute.js +3 -3
- package/dist/extensions/codemode/renderer.impl.js +3 -3
- package/dist/extensions/codemode/renderer.js +3 -3
- 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/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 +2 -2
- 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/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/background-tasks/reference.md +1 -1
- package/docs/background-tasks.md +1 -1
- package/docs/changelog.mdx +17 -0
- package/docs/reference/cli.md +3 -2
- package/docs/storage/postgres/tuning.md +2 -0
- package/docs/storage/postgres.md +17 -0
- package/docs/worktree-snapshots/reference.md +1 -1
- package/package.json +8 -8
|
@@ -58,8 +58,6 @@ const LEASE_LOCK_WAIT_MS = 2_000;
|
|
|
58
58
|
|
|
59
59
|
/** The statement of a presence acquisition's wait for the sends to its recipient under way: it only takes the lock. */
|
|
60
60
|
const SENDS_PASSED = { sql: "SELECT 1 AS passed", params: [] };
|
|
61
|
-
/** The setting a PostgreSQL batched lease renewal sets when any lease missed, so its follow-up read runs. */
|
|
62
|
-
const LEASE_RENEW_MISSES = "atomic.intercom_lease_renew_misses";
|
|
63
61
|
|
|
64
62
|
/**
|
|
65
63
|
* The kind of the row whose `last_token` counts acquisitions on PostgreSQL where the order sequence is missing: see
|
|
@@ -474,6 +472,26 @@ async function openBrokerLeaseStoreInCatalog(options: IntercomBrokerStateOptions
|
|
|
474
472
|
* spares the server a log flush per broker and per session every interval. Acquisitions and releases stay durable.
|
|
475
473
|
*/
|
|
476
474
|
const renewal = { ...fenced, relaxedDurability: true } as const;
|
|
475
|
+
const renewPostgresRow = async (
|
|
476
|
+
kind: LeaseKind,
|
|
477
|
+
id: string,
|
|
478
|
+
holderId: string,
|
|
479
|
+
fencingToken: number,
|
|
480
|
+
subject: string | null,
|
|
481
|
+
): Promise<boolean> => {
|
|
482
|
+
const guarded = [kind, id, holderId, fencingToken];
|
|
483
|
+
const write =
|
|
484
|
+
subject === null
|
|
485
|
+
? { sql: `UPDATE ${table} SET renewed_at = ${nowMs} WHERE ${owned}`, params: guarded }
|
|
486
|
+
: { sql: `UPDATE ${table} SET renewed_at = ${nowMs}, subject_json = ? WHERE ${owned}`, params: [subject, ...guarded] };
|
|
487
|
+
// The UPDATE and COMMIT leave together. A paused client can delay reporting the result, not releasing its row.
|
|
488
|
+
const { changes } = await database.transaction((tx) => tx.run(write.sql, ...write.params), {
|
|
489
|
+
...renewal,
|
|
490
|
+
leading: [write],
|
|
491
|
+
leadingOnly: true,
|
|
492
|
+
});
|
|
493
|
+
return changes === 1;
|
|
494
|
+
};
|
|
477
495
|
/**
|
|
478
496
|
* The order of a key acquired for the first time. A serial database runs one acquisition at a time, so the
|
|
479
497
|
* largest order so far, plus one, is unique. PostgreSQL runs acquisitions beside one another, so each takes the
|
|
@@ -598,6 +616,16 @@ async function openBrokerLeaseStoreInCatalog(options: IntercomBrokerStateOptions
|
|
|
598
616
|
if (subject !== undefined && (subject.kind !== lease.key.kind || keyId(keyOf(subject)) !== keyId(lease.key))) {
|
|
599
617
|
return invalid("subject-key-mismatch");
|
|
600
618
|
}
|
|
619
|
+
if (dialect.name === "postgres") {
|
|
620
|
+
const renewed = await renewPostgresRow(
|
|
621
|
+
lease.key.kind,
|
|
622
|
+
keyId(lease.key),
|
|
623
|
+
lease.holderId,
|
|
624
|
+
lease.fencingToken,
|
|
625
|
+
subject === undefined ? null : subjectJson(subject),
|
|
626
|
+
);
|
|
627
|
+
return renewed ? { status: "renewed" } : stale(await holderOf(reader, lease.key));
|
|
628
|
+
}
|
|
601
629
|
return database.transaction(async (tx) => {
|
|
602
630
|
const { changes } =
|
|
603
631
|
subject === undefined
|
|
@@ -645,17 +673,13 @@ async function openBrokerLeaseStoreInCatalog(options: IntercomBrokerStateOptions
|
|
|
645
673
|
}
|
|
646
674
|
>();
|
|
647
675
|
const validPairs = new Map<string, readonly [LeaseKind, string]>();
|
|
648
|
-
let hasNonSafeIntToken = false;
|
|
649
676
|
for (let i = 0; i < requests.length; i++) {
|
|
650
677
|
if (invalidResults[i] !== undefined) continue;
|
|
651
678
|
const { lease, subject } = requests[i]!;
|
|
652
679
|
const id = keyId(lease.key);
|
|
653
680
|
const pKey = pairKey(lease.key.kind, id);
|
|
654
681
|
if (!validPairs.has(pKey)) validPairs.set(pKey, [lease.key.kind, id]);
|
|
655
|
-
if (!Number.isSafeInteger(lease.fencingToken))
|
|
656
|
-
hasNonSafeIntToken = true;
|
|
657
|
-
continue;
|
|
658
|
-
}
|
|
682
|
+
if (!Number.isSafeInteger(lease.fencingToken)) continue;
|
|
659
683
|
const tKey = tupleKey(lease.key.kind, id, lease.holderId, lease.fencingToken);
|
|
660
684
|
const nextSubject = subject === undefined ? undefined : subjectJson(subject);
|
|
661
685
|
const existing = byTuple.get(tKey);
|
|
@@ -688,30 +712,21 @@ async function openBrokerLeaseStoreInCatalog(options: IntercomBrokerStateOptions
|
|
|
688
712
|
return stale(found.get(pairKey(lease.key.kind, id)));
|
|
689
713
|
});
|
|
690
714
|
if (dialect.name === "postgres") {
|
|
691
|
-
const
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
AND t.key = ANY(ARRAY(SELECT DISTINCT key FROM missed))`,
|
|
703
|
-
params: [pairsParam],
|
|
704
|
-
};
|
|
705
|
-
return database.transaction(
|
|
706
|
-
async (tx) => {
|
|
707
|
-
const found = new Map<string, MissedHolderRow>();
|
|
708
|
-
for (const row of await tx.all<MissedHolderRow>(readAll.sql, ...readAll.params))
|
|
709
|
-
found.set(pairKey(row.kind, row.key), row);
|
|
710
|
-
return answer(new Set(), found);
|
|
711
|
-
},
|
|
712
|
-
{ ...renewal, leading: [readAll], leadingOnly: true },
|
|
715
|
+
const readHolders = async (pairs: ReadonlyMap<string, readonly [LeaseKind, string]>) => {
|
|
716
|
+
const rows = await reader.all<MissedHolderRow>(
|
|
717
|
+
`WITH missed AS MATERIALIZED (
|
|
718
|
+
SELECT entry ->> 0 AS kind, entry ->> 1 AS key
|
|
719
|
+
FROM jsonb_array_elements((?)::jsonb) AS entry
|
|
720
|
+
)
|
|
721
|
+
SELECT t.kind, t.key, t.holder_id, t.fencing_token
|
|
722
|
+
FROM ${table} AS t JOIN missed ON t.kind = missed.kind AND t.key = missed.key
|
|
723
|
+
WHERE t.kind = ANY(ARRAY(SELECT DISTINCT kind FROM missed))
|
|
724
|
+
AND t.key = ANY(ARRAY(SELECT DISTINCT key FROM missed))`,
|
|
725
|
+
JSON.stringify([...pairs.values()], wellFormed),
|
|
713
726
|
);
|
|
714
|
-
|
|
727
|
+
return new Map(rows.map((row) => [pairKey(row.kind, row.key), row]));
|
|
728
|
+
};
|
|
729
|
+
if (entries.length === 0) return answer(new Set(), await readHolders(validPairs));
|
|
715
730
|
const write: SqliteStatement = {
|
|
716
731
|
sql: `WITH requested AS MATERIALIZED (
|
|
717
732
|
SELECT
|
|
@@ -733,25 +748,14 @@ async function openBrokerLeaseStoreInCatalog(options: IntercomBrokerStateOptions
|
|
|
733
748
|
WHERE t.kind = ANY(ARRAY(SELECT DISTINCT kind FROM requested))
|
|
734
749
|
AND t.key = ANY(ARRAY(SELECT DISTINCT key FROM requested))
|
|
735
750
|
ORDER BY t.kind, t.key
|
|
736
|
-
FOR UPDATE OF t
|
|
737
|
-
),
|
|
738
|
-
renewed AS (
|
|
739
|
-
UPDATE ${table} AS t
|
|
740
|
-
SET renewed_at = ${nowMs}, subject_json = COALESCE(locked.subject_json, t.subject_json)
|
|
741
|
-
FROM locked
|
|
742
|
-
WHERE t.kind = locked.kind
|
|
743
|
-
AND t.key = locked.key
|
|
744
|
-
AND t.holder_id = locked.holder_id
|
|
745
|
-
AND t.fencing_token = locked.fencing_token
|
|
746
|
-
RETURNING t.kind, t.key, t.holder_id, t.fencing_token
|
|
747
|
-
),
|
|
748
|
-
gate AS MATERIALIZED (
|
|
749
|
-
SELECT set_config('${LEASE_RENEW_MISSES}',
|
|
750
|
-
CASE WHEN (SELECT COUNT(*) FROM renewed) < CAST(? AS ${types.int}) THEN '1' ELSE '' END,
|
|
751
|
-
true) AS misses
|
|
751
|
+
FOR NO KEY UPDATE OF t SKIP LOCKED
|
|
752
752
|
)
|
|
753
|
-
|
|
754
|
-
|
|
753
|
+
UPDATE ${table} AS t
|
|
754
|
+
SET renewed_at = ${nowMs}, subject_json = COALESCE(locked.subject_json, t.subject_json)
|
|
755
|
+
FROM locked
|
|
756
|
+
WHERE t.kind = locked.kind AND t.key = locked.key
|
|
757
|
+
AND t.holder_id = locked.holder_id AND t.fencing_token = locked.fencing_token
|
|
758
|
+
RETURNING t.kind, t.key, t.holder_id, t.fencing_token`,
|
|
755
759
|
params: [
|
|
756
760
|
JSON.stringify(
|
|
757
761
|
entries.map((entry) => [
|
|
@@ -763,41 +767,46 @@ async function openBrokerLeaseStoreInCatalog(options: IntercomBrokerStateOptions
|
|
|
763
767
|
]),
|
|
764
768
|
wellFormed,
|
|
765
769
|
),
|
|
766
|
-
entries.length + (hasNonSafeIntToken ? 1 : 0),
|
|
767
770
|
],
|
|
768
771
|
};
|
|
769
|
-
const
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
FROM ${table} AS t
|
|
777
|
-
JOIN missed ON t.kind = missed.kind AND t.key = missed.key
|
|
778
|
-
WHERE current_setting('${LEASE_RENEW_MISSES}', true) = '1'
|
|
779
|
-
AND t.kind = ANY(ARRAY(SELECT DISTINCT kind FROM missed))
|
|
780
|
-
AND t.key = ANY(ARRAY(SELECT DISTINCT key FROM missed))`,
|
|
781
|
-
params: [pairsParam],
|
|
782
|
-
};
|
|
783
|
-
return database.transaction(
|
|
784
|
-
async (tx) => {
|
|
785
|
-
const renewed = new Set<string>();
|
|
786
|
-
for (const row of await tx.all<RenewedLeaseRow>(write.sql, ...write.params))
|
|
787
|
-
if (
|
|
788
|
-
row.kind !== null &&
|
|
789
|
-
row.key !== null &&
|
|
790
|
-
row.holder_id !== null &&
|
|
791
|
-
row.fencing_token !== null
|
|
792
|
-
)
|
|
793
|
-
renewed.add(tupleKey(row.kind, row.key, row.holder_id, Number(row.fencing_token)));
|
|
794
|
-
const found = new Map<string, MissedHolderRow>();
|
|
795
|
-
for (const row of await tx.all<MissedHolderRow>(readMisses.sql, ...readMisses.params))
|
|
796
|
-
found.set(pairKey(row.kind, row.key), row);
|
|
797
|
-
return answer(renewed, found);
|
|
798
|
-
},
|
|
799
|
-
{ ...renewal, leading: [write, readMisses], leadingOnly: true },
|
|
772
|
+
const rows = await database.transaction((tx) => tx.all<MissedHolderRow>(write.sql, ...write.params), {
|
|
773
|
+
...renewal,
|
|
774
|
+
leading: [write],
|
|
775
|
+
leadingOnly: true,
|
|
776
|
+
});
|
|
777
|
+
const renewed = new Set(
|
|
778
|
+
rows.map((row) => tupleKey(row.kind, row.key, row.holder_id!, Number(row.fencing_token))),
|
|
800
779
|
);
|
|
780
|
+
const missed = new Map<string, readonly [LeaseKind, string]>();
|
|
781
|
+
for (const [i, { lease }] of requests.entries()) {
|
|
782
|
+
if (invalidResults[i] !== undefined) continue;
|
|
783
|
+
const id = keyId(lease.key);
|
|
784
|
+
if (
|
|
785
|
+
!Number.isSafeInteger(lease.fencingToken) ||
|
|
786
|
+
!renewed.has(tupleKey(lease.key.kind, id, lease.holderId, lease.fencingToken))
|
|
787
|
+
) missed.set(pairKey(lease.key.kind, id), [lease.key.kind, id]);
|
|
788
|
+
}
|
|
789
|
+
if (missed.size === 0) return answer(renewed, new Map());
|
|
790
|
+
// Commit the batch before looking up misses. A row that still has the exact holder and token was busy:
|
|
791
|
+
// wait for it in its own short transaction, without holding the already-renewed rows locked.
|
|
792
|
+
const found = await readHolders(missed);
|
|
793
|
+
const changed = new Map<string, readonly [LeaseKind, string]>();
|
|
794
|
+
await Promise.all(
|
|
795
|
+
entries.map(async ({ kind, id, holderId, fencingToken, subjectJson }) => {
|
|
796
|
+
const tuple = tupleKey(kind, id, holderId, fencingToken);
|
|
797
|
+
if (renewed.has(tuple)) return;
|
|
798
|
+
const pair = pairKey(kind, id);
|
|
799
|
+
const holder = found.get(pair);
|
|
800
|
+
if (holder?.holder_id !== holderId.toWellFormed() || Number(holder.fencing_token) !== fencingToken) return;
|
|
801
|
+
if (await renewPostgresRow(kind, id, holderId, fencingToken, subjectJson)) renewed.add(tuple);
|
|
802
|
+
else changed.set(pair, [kind, id]);
|
|
803
|
+
}),
|
|
804
|
+
);
|
|
805
|
+
if (changed.size > 0) {
|
|
806
|
+
for (const pair of changed.keys()) found.delete(pair);
|
|
807
|
+
for (const [pair, holder] of await readHolders(changed)) found.set(pair, holder);
|
|
808
|
+
}
|
|
809
|
+
return answer(renewed, found);
|
|
801
810
|
}
|
|
802
811
|
const write: SqliteStatement | undefined =
|
|
803
812
|
entries.length === 0
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { dialectOf, type SqliteRow, validateStoragePrefix } from "@bastani/atomic/storage";
|
|
1
|
+
import { dialectOf, fencedPath, type SqliteRow, validateStoragePrefix } from "@bastani/atomic/storage";
|
|
2
2
|
import type {
|
|
3
3
|
IntercomBrokerStateOptions,
|
|
4
4
|
InvalidStateInput,
|
|
@@ -17,10 +17,15 @@ import type {
|
|
|
17
17
|
ReplyRoute,
|
|
18
18
|
StateStoreInvalidReason,
|
|
19
19
|
} from "./multinode-state-store.js";
|
|
20
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
BROKER_LEASE_STALE_AFTER_MS,
|
|
22
|
+
LOST_SWEEP_MAINTENANCE,
|
|
23
|
+
LOST_SWEEP_STALE_AFTER_MS,
|
|
24
|
+
SETTLED_ASK_RETENTION_MS,
|
|
25
|
+
} from "./multinode-state-store.js";
|
|
21
26
|
import { addMissingColumns } from "./sql-add-column.js";
|
|
22
27
|
import { storeNow } from "./sql-retention.js";
|
|
23
|
-
import { ensureBrokerSchema, RETRY_UNAPPLIED, withBrokerSchemaCatalog } from "./sql-schema.js";
|
|
28
|
+
import { brokerSchemaCurrent, ensureBrokerSchema, RETRY_UNAPPLIED, withBrokerSchemaCatalog } from "./sql-schema.js";
|
|
24
29
|
|
|
25
30
|
type AskRow = SqliteRow & { sender_session_id: string; target_session_id: string; message_id: string };
|
|
26
31
|
|
|
@@ -60,8 +65,9 @@ async function openPendingAskStoreInCatalog({
|
|
|
60
65
|
database,
|
|
61
66
|
prefix,
|
|
62
67
|
}: IntercomBrokerStateOptions): Promise<PendingAskStore> {
|
|
63
|
-
const
|
|
64
|
-
const
|
|
68
|
+
const { name, types, nowMs } = dialectOf(database);
|
|
69
|
+
const storagePrefix = validateStoragePrefix(prefix, name);
|
|
70
|
+
const table = `${storagePrefix}intercom_pending_asks`;
|
|
65
71
|
/**
|
|
66
72
|
* Its transactions read and write this table and the settled asks alone, which no other store touches, so they
|
|
67
73
|
* exclude one another, not every writer of the database (#6560).
|
|
@@ -111,8 +117,11 @@ async function openPendingAskStoreInCatalog({
|
|
|
111
117
|
const reverseRoute = "sender_session_id = ? AND target_session_id = ? AND message_id = ?";
|
|
112
118
|
const reverseParams = (route: ReplyRoute) =>
|
|
113
119
|
[route.replyTargetSessionId, route.replySenderSessionId, route.replyTo] as const;
|
|
120
|
+
const leases = `${storagePrefix}intercom_leases`;
|
|
121
|
+
let addressColumns: Promise<boolean> | undefined;
|
|
114
122
|
|
|
115
123
|
return {
|
|
124
|
+
...(name === "postgres" ? { coordinatesLostSweep: true as const } : {}),
|
|
116
125
|
async record(ask): Promise<PendingAskRecordResult> {
|
|
117
126
|
const bad = invalidAsk(ask);
|
|
118
127
|
if (bad !== undefined) return bad;
|
|
@@ -288,8 +297,58 @@ async function openPendingAskStoreInCatalog({
|
|
|
288
297
|
);
|
|
289
298
|
return { status: "listed", asks: rows.map(toAsk) };
|
|
290
299
|
},
|
|
291
|
-
async endLost(targetSessionId): Promise<PendingAskListResult> {
|
|
300
|
+
async endLost(targetSessionId, guard): Promise<PendingAskListResult> {
|
|
292
301
|
if (targetSessionId.length === 0) return invalid("empty-session-id");
|
|
302
|
+
if (name === "postgres") {
|
|
303
|
+
if (
|
|
304
|
+
guard !== undefined &&
|
|
305
|
+
(guard.sweeper.key.kind !== "maintenance" || guard.sweeper.key.task !== LOST_SWEEP_MAINTENANCE.task)
|
|
306
|
+
) return { status: "listed", asks: [] };
|
|
307
|
+
// The scan is only a hint. Recheck the leader's fence and the recipient in this write's snapshot.
|
|
308
|
+
// Lock existing presence rows too, so an in-flight renewal or takeover causes a retry rather than a
|
|
309
|
+
// decision from the previous version of the row. Do not wait in a queue for any of these locks.
|
|
310
|
+
let fences = "";
|
|
311
|
+
let canMark = "";
|
|
312
|
+
const params: Array<string | number> = [];
|
|
313
|
+
if (guard !== undefined) {
|
|
314
|
+
const indexed = await (addressColumns ??= brokerSchemaCurrent(database, prefix, "lease-addresses"));
|
|
315
|
+
const presenceId = indexed
|
|
316
|
+
? "presence_id"
|
|
317
|
+
: `CASE WHEN subject_json !~ (chr(92) || chr(92) || 'u(0000|[dD][89a-fA-F])')
|
|
318
|
+
THEN subject_json::json #>> '{session,id}' END`;
|
|
319
|
+
fences = `sweeper AS MATERIALIZED (
|
|
320
|
+
SELECT 1 FROM ${leases} WHERE kind = 'maintenance' AND key = ? AND holder_id = ?
|
|
321
|
+
AND fencing_token = ? AND renewed_at >= ${nowMs} - ? FOR SHARE NOWAIT
|
|
322
|
+
), recipient AS MATERIALIZED (
|
|
323
|
+
SELECT holder_id, renewed_at FROM ${leases} WHERE kind = 'presence'
|
|
324
|
+
AND (key IN (?, ?) OR ${presenceId} IN (?, ?)) ORDER BY key FOR SHARE NOWAIT
|
|
325
|
+
), `;
|
|
326
|
+
canMark = `AND EXISTS (SELECT 1 FROM sweeper) AND NOT EXISTS (
|
|
327
|
+
SELECT 1 FROM recipient WHERE holder_id IS NOT NULL AND renewed_at >= ${nowMs} - ?
|
|
328
|
+
)`;
|
|
329
|
+
params.push(
|
|
330
|
+
LOST_SWEEP_MAINTENANCE.task, guard.sweeper.holderId, guard.sweeper.fencingToken, LOST_SWEEP_STALE_AFTER_MS,
|
|
331
|
+
guard.targetIdentity, targetSessionId, targetSessionId, guard.targetIdentity,
|
|
332
|
+
);
|
|
333
|
+
}
|
|
334
|
+
const open = "target_session_id = ? AND park_owner IS NULL AND replied IS NULL AND ended_at IS NULL";
|
|
335
|
+
const mark = {
|
|
336
|
+
sql: `WITH ${fences} open_asks AS MATERIALIZED (
|
|
337
|
+
SELECT "order" FROM ${table} WHERE ${open} ${canMark} ORDER BY "order" FOR UPDATE SKIP LOCKED
|
|
338
|
+
), marked AS (
|
|
339
|
+
UPDATE ${table} SET ended_at = ${nowMs} WHERE "order" IN (SELECT "order" FROM open_asks)
|
|
340
|
+
RETURNING "order", sender_session_id, target_session_id, message_id
|
|
341
|
+
) SELECT sender_session_id, target_session_id, message_id FROM marked ORDER BY "order"`,
|
|
342
|
+
params: [...params, targetSessionId, ...(guard === undefined ? [] : [BROKER_LEASE_STALE_AFTER_MS])],
|
|
343
|
+
};
|
|
344
|
+
const rows = await database.transaction((tx) => tx.all<AskRow>(mark.sql, ...mark.params), {
|
|
345
|
+
...RETRY_UNAPPLIED,
|
|
346
|
+
concurrency: { kind: "fenced", audit: fencedPath("intercom-lost-ask") },
|
|
347
|
+
leading: [mark],
|
|
348
|
+
leadingOnly: true,
|
|
349
|
+
});
|
|
350
|
+
return { status: "listed", asks: rows.map(toAsk) };
|
|
351
|
+
}
|
|
293
352
|
const rows = await database.transaction(async (tx) => {
|
|
294
353
|
const open = await tx.all<AskRow & { order: number | bigint }>(
|
|
295
354
|
`SELECT "order", sender_session_id, target_session_id, message_id FROM ${table}
|
|
@@ -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.18
|
|
10
|
+
if (__atomicHostImport0.VERSION !== "0.10.18") missing.unshift(application + " was updated to 0.10.18 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
|
}
|
|
@@ -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.18
|
|
9
|
+
if (__atomicHostImport0.VERSION !== "0.10.18") missing.unshift(application + " was updated to 0.10.18 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
|
}
|
|
@@ -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.18
|
|
13
|
+
if (__atomicHostImport0.VERSION !== "0.10.18") missing.unshift(application + " was updated to 0.10.18 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.18
|
|
11
|
+
if (__atomicHostImport0.VERSION !== "0.10.18") missing.unshift(application + " was updated to 0.10.18 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
|
}
|
|
@@ -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.18
|
|
9
|
+
const key = `${root.href}#0.10.18`;
|
|
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.18
|
|
31
|
-
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.18
|
|
30
|
+
if (running === undefined || running.version === "0.10.18") throw error;
|
|
31
|
+
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.18 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.18
|
|
9
|
+
const key = `${root.href}#0.10.18`;
|
|
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.18
|
|
31
|
-
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.18
|
|
30
|
+
if (running === undefined || running.version === "0.10.18") throw error;
|
|
31
|
+
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.18 while this session was running; restart it to keep using this feature.", {
|
|
32
32
|
cause: error,
|
|
33
33
|
});
|
|
34
34
|
}
|
|
@@ -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.18
|
|
9
|
+
const key = `${root.href}#0.10.18`;
|
|
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.18
|
|
31
|
-
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.18
|
|
30
|
+
if (running === undefined || running.version === "0.10.18") throw error;
|
|
31
|
+
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.18 while this session was running; restart it to keep using this feature.", {
|
|
32
32
|
cause: error,
|
|
33
33
|
});
|
|
34
34
|
}
|
|
@@ -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.18
|
|
9
|
+
const key = `${root.href}#0.10.18`;
|
|
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.18
|
|
31
|
-
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.18
|
|
30
|
+
if (running === undefined || running.version === "0.10.18") throw error;
|
|
31
|
+
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.18 while this session was running; restart it to keep using this feature.", {
|
|
32
32
|
cause: error,
|
|
33
33
|
});
|
|
34
34
|
}
|
|
@@ -112,7 +112,7 @@ function __atomicOnDemandFailed(error, feature) {
|
|
|
112
112
|
return (async () => {
|
|
113
113
|
const root = new URL("../", import.meta.url);
|
|
114
114
|
const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
|
|
115
|
-
const key = `${root.href}#0.10.18
|
|
115
|
+
const key = `${root.href}#0.10.18`;
|
|
116
116
|
let release = releases.get(key);
|
|
117
117
|
if (release === undefined) {
|
|
118
118
|
const current = (async () => {
|
|
@@ -140,7 +140,7 @@ function __atomicOnDemandFailed(error, feature) {
|
|
|
140
140
|
} catch {
|
|
141
141
|
// No installation to read, as in a bundle of the package: the release the process runs decides.
|
|
142
142
|
}
|
|
143
|
-
const updatedTo = typeof installed === "string" && installed !== "0.10.18
|
|
143
|
+
const updatedTo = typeof installed === "string" && installed !== "0.10.18" ? installed : running !== undefined && running.version !== "0.10.18" ? "0.10.18" : undefined;
|
|
144
144
|
if (updatedTo === undefined) throw error;
|
|
145
145
|
const application = typeof running?.name === "string" ? running.name : "atomic";
|
|
146
146
|
const restart = new Error(`${application} was updated to ${updatedTo} while this session was running; restart it to keep using ${feature}.`, {
|
|
@@ -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.18
|
|
9
|
+
const key = `${root.href}#0.10.18`;
|
|
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.18
|
|
31
|
-
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.18
|
|
30
|
+
if (running === undefined || running.version === "0.10.18") throw error;
|
|
31
|
+
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.18 while this session was running; restart it to keep using intercom.", {
|
|
32
32
|
cause: error,
|
|
33
33
|
});
|
|
34
34
|
}
|
|
@@ -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.18
|
|
9
|
+
const key = `${root.href}#0.10.18`;
|
|
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.18
|
|
31
|
-
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.18
|
|
30
|
+
if (running === undefined || running.version === "0.10.18") throw error;
|
|
31
|
+
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.18 while this session was running; restart it to keep using intercom.", {
|
|
32
32
|
cause: error,
|
|
33
33
|
});
|
|
34
34
|
}
|
|
@@ -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.18
|
|
9
|
+
const key = `${root.href}#0.10.18`;
|
|
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.18
|
|
31
|
-
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.18
|
|
30
|
+
if (running === undefined || running.version === "0.10.18") throw error;
|
|
31
|
+
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.18 while this session was running; restart it to keep using this feature.", {
|
|
32
32
|
cause: error,
|
|
33
33
|
});
|
|
34
34
|
}
|
package/dist/cli/list-models.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.18
|
|
9
|
+
const key = `${root.href}#0.10.18`;
|
|
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.18
|
|
31
|
-
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.18
|
|
30
|
+
if (running === undefined || running.version === "0.10.18") throw error;
|
|
31
|
+
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.18 while this session was running; restart it to keep using this feature.", {
|
|
32
32
|
cause: error,
|
|
33
33
|
});
|
|
34
34
|
}
|
|
@@ -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.18
|
|
9
|
+
const key = `${root.href}#0.10.18`;
|
|
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.18
|
|
31
|
-
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.18
|
|
30
|
+
if (running === undefined || running.version === "0.10.18") throw error;
|
|
31
|
+
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.18 while this session was running; restart it to keep using this feature.", {
|
|
32
32
|
cause: error,
|
|
33
33
|
});
|
|
34
34
|
}
|
|
@@ -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.18
|
|
9
|
+
const key = `${root.href}#0.10.18`;
|
|
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.18
|
|
31
|
-
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.18
|
|
30
|
+
if (running === undefined || running.version === "0.10.18") throw error;
|
|
31
|
+
throw new Error((typeof running.name === "string" ? running.name : "atomic") + " was updated to 0.10.18 while this session was running; restart it to keep using this feature.", {
|
|
32
32
|
cause: error,
|
|
33
33
|
});
|
|
34
34
|
}
|