@git-stunts/git-cas 6.5.0 → 6.5.2

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/ARCHITECTURE.md CHANGED
@@ -147,6 +147,8 @@ The public entrypoint is [index.js](./index.js).
147
147
  - exposes `retention`, `publications`, `caches`, and `expiringSets` for explicit
148
148
  reachability and lifecycle policy
149
149
  - exposes read-only repository evidence through `diagnostics.doctor()`
150
+ - owns explicit local resource closure without coupling closure to object or ref
151
+ mutation
150
152
 
151
153
  The facade is orchestration glue. It is not the storage engine itself.
152
154
 
@@ -329,7 +331,10 @@ Crypto:
329
331
 
330
332
  Git:
331
333
  - **`GitPersistenceAdapter`** — `GitPersistencePort` implementation using
332
- `@git-stunts/plumbing` to shell out to the `git` CLI.
334
+ `@git-stunts/plumbing` to shell out to the `git` CLI. It reuses typed
335
+ cat-file and mktree sessions, keeps parsed immutable trees count-and-byte
336
+ bounded, uses scoped fast-import only for explicit page batches, preserves
337
+ streaming payload reads, and owns deterministic child-process closure.
333
338
  - **`GitRefAdapter`** — `GitRefPort` implementation using
334
339
  `@git-stunts/plumbing`.
335
340
  - **`GitRepositoryInspectionAdapter`** — `RepositoryInspectionPort`
@@ -354,6 +359,8 @@ File I/O:
354
359
 
355
360
  - **`JsonCodec`** — `CodecPort` using JSON serialization (default).
356
361
  - **`CborCodec`** — `CodecPort` using CBOR serialization.
362
+ - **`GitTreeObjectCodec`** — boundary decoder for canonical SHA-1 and SHA-256
363
+ Git tree bytes plus typed mktree session entries.
357
364
 
358
365
  #### Chunkers (`src/infrastructure/chunkers/`)
359
366
 
package/CHANGELOG.md CHANGED
@@ -7,6 +7,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [6.5.2] — 2026-07-19
11
+
12
+ ### Added
13
+
14
+ - **Bounded page batches and explicit resource closure** -
15
+ `pages.putBatch()` stores an explicitly count-and-byte-bounded page group in
16
+ input order, while `ContentAddressableStore.close()` and async disposal drain
17
+ started operations and release local adapter resources without mutating
18
+ objects, refs, retention, or publication state.
19
+
20
+ ### Performance
21
+
22
+ - **Persistent Git object sessions** - immutable metadata and bounded tree
23
+ reads reuse one typed `cat-file` process, tree writes reuse typed `mktree`,
24
+ and page batches use one scoped `fast-import` process. Parsed tree reuse is
25
+ bounded by entry count and estimated bytes; payload streams remain streaming.
26
+ Individual blob writes deliberately remain one-shot so an object pruned by
27
+ an external process is recreated correctly on the next write.
28
+
29
+ ## [6.5.1] — 2026-07-18
30
+
31
+ ### Performance
32
+
33
+ - **Bounded immutable page payload reuse** - repeated `pages.get()` calls now
34
+ share successful in-flight and completed payload reads through an LRU bounded
35
+ by both entry count and aggregate bytes. Callers receive copies, failures
36
+ remain retryable, oversized values do not displace unrelated residents, and
37
+ `pages.open()` remains uncached and streaming.
38
+
10
39
  ## [6.5.0] — 2026-07-18
11
40
 
12
41
  ### Added
package/GUIDE.md CHANGED
@@ -99,10 +99,13 @@ for await (const chunk of cas.assets.open({ handle: staged.handle })) {
99
99
  }
100
100
 
101
101
  console.log(retained.witness.root.generation);
102
+ await cas.close();
102
103
  ```
103
104
 
104
105
  Node's file stream is an `AsyncIterable<Uint8Array>`; Bun and Deno callers can
105
- supply their native async byte streams through the same contract.
106
+ supply their native async byte streams through the same contract. In production
107
+ code, call `close()` from `finally` or use async disposal. Closure releases
108
+ local resources only and does not change stored objects or retention.
106
109
 
107
110
  ## Application Storage Lifecycle
108
111
 
@@ -139,8 +142,9 @@ that is already sorted by canonical member path, so construction does not need
139
142
  to collect the complete member set.
140
143
 
141
144
  ```js
142
- const nodes = await cas.pages.put({ source: encodedNodePage });
143
- const edges = await cas.pages.put({ source: encodedEdgePage });
145
+ const [nodes, edges] = await cas.pages.putBatch({
146
+ pages: [{ source: encodedNodePage }, { source: encodedEdgePage }],
147
+ });
144
148
  const materialization = await cas.bundles.putOrdered({
145
149
  members: (async function* members() {
146
150
  yield ['edges/root', edges.handle];
@@ -163,6 +167,18 @@ lookup reads only the descriptor path and selected payload; retention and
163
167
  publication perform full bounded graph validation. Identical page bytes and
164
168
  identically constructed bundles produce identical handles.
165
169
 
170
+ `pages.putBatch()` collects and validates the complete explicit batch before
171
+ persistence. It accepts at most 256 pages and 32 MiB by default, preserves input
172
+ order, and uses one scoped Git write session when the plumbing adapter supports
173
+ it. Use individual `pages.put()` calls when inputs should not share one bounded
174
+ memory envelope.
175
+
176
+ Repeated `pages.get()` calls reuse immutable payload reads within the store's
177
+ bounded page cache. The defaults retain at most 128 payloads and 8 MiB; use
178
+ `pageCacheEntries` and `pageCacheBytes` to tune that ceiling. Every result is a
179
+ caller-owned copy. `pages.open()` remains uncached and streaming, and neither
180
+ form of access establishes retention.
181
+
166
182
  ### Generic Application Publication
167
183
 
168
184
  Publication is disabled until the facade receives an explicit application-ref
package/README.md CHANGED
@@ -36,6 +36,11 @@ Unlike traditional LFS which moves files to external servers, `git-cas` treats t
36
36
  and deterministic structured bundles through validated handles, then retain
37
37
  or publish them with generation-scoped evidence instead of managing Git
38
38
  objects, trees, or payload OIDs directly.
39
+ - **Bounded Git Process Reuse**: Immutable object metadata and tree reads reuse
40
+ typed Git sessions behind the adapter, while explicitly bounded page batches
41
+ amortize writes without changing content identity. Read and payload streams
42
+ remain streaming; complete page-batch inputs are collected and validated only
43
+ within the explicit count-and-byte envelope.
39
44
  - **Key Lifecycle**: Envelope encryption separates DEKs from KEKs. Rotate passphrases across an entire vault without re-encrypting data blobs. Privacy mode HMAC-hashes slug names to prevent metadata discovery.
40
45
  - **Runtime-Adaptive**: A single core supports Node.js 22+, Bun, and Deno through a strict hexagonal port architecture with runtime-specific crypto adapters.
41
46
 
@@ -44,7 +49,7 @@ Unlike traditional LFS which moves files to external servers, `git-cas` treats t
44
49
  Existing v5 users should read [UPGRADING.md](./UPGRADING.md) and run
45
50
  `npm run upgrade` in dry-run mode before restoring old encrypted vault entries.
46
51
  For the release overview, see the
47
- [v6.5.0 Release Notes](./docs/releases/v6.5.0.md).
52
+ [v6.5.2 Release Notes](./docs/releases/v6.5.2.md).
48
53
 
49
54
  ### 1. CLI Usage
50
55
 
@@ -84,11 +89,13 @@ const retained = await cas.retention.retain({
84
89
  root: { ref: 'refs/cas/rootsets/my-app', name: 'app/asset' },
85
90
  policy: 'pinned',
86
91
  });
92
+ await cas.close();
87
93
  ```
88
94
 
89
95
  `staged.handle` is a content locator, not a durability promise. The returned
90
96
  retention witness identifies the exact Git generation and tree edge that made
91
- the asset reachable.
97
+ the asset reachable. `close()` releases local resources only; it never deletes
98
+ objects, updates refs, or changes retention.
92
99
 
93
100
  ## Capability Map
94
101
 
@@ -138,8 +145,9 @@ Core capabilities:
138
145
  read-only, and `sweep()` can release only markers whose expiry has passed.
139
146
  - **Application storage**: `assets`, `pages`, `bundles`, `retention`, and
140
147
  `publications` compose streaming CAS writes, bounded structured
141
- materializations, direct-reference or complete-validation member reads,
142
- reachability roots, compare-and-swap refs, and immutable lifecycle evidence.
148
+ materializations, explicitly bounded page batches, direct-reference or
149
+ complete-validation member reads, reachability roots, compare-and-swap refs,
150
+ and immutable lifecycle evidence.
143
151
  - **Scoped staging workspaces**: `workspaces.open()` mirrors application writes
144
152
  behind one renewable temporary RootSet, returns only after each handle is
145
153
  anchored, promotes destination-first, and exposes bounded age, expiry,
@@ -204,6 +212,10 @@ All three runtimes are tested in CI on every push. The hexagonal architecture is
204
212
  workspaces for temporary multi-object reachability, promotion, and cleanup.
205
213
  - **[v6.5.0 Release Notes](./docs/releases/v6.5.0.md)**: Bounded direct bundle
206
214
  references, immutable metadata reuse, and corrected concurrency settlement.
215
+ - **[v6.5.1 Release Notes](./docs/releases/v6.5.1.md)**: Bounded immutable page
216
+ payload reuse with zero-command warm reads.
217
+ - **[v6.5.2 Release Notes](./docs/releases/v6.5.2.md)**: Persistent bounded Git
218
+ object sessions, scoped page batches, and deterministic resource closure.
207
219
  - **[Upgrading](./UPGRADING.md)**: Migration guide for v5 → v6.
208
220
  - **[Changelog](./CHANGELOG.md)**: Version history and migration notes.
209
221
 
package/UPGRADING.md CHANGED
@@ -2,6 +2,51 @@
2
2
 
3
3
  v6.0.0 is a major release that simplifies the encryption model, hardens security defaults, and cleans up the architecture. This guide covers every breaking change and what you need to do.
4
4
 
5
+ ## v6.5.1 To v6.5.2
6
+
7
+ v6.5.2 is API-additive and does not require stored-data migration. Immutable
8
+ metadata and tree reads automatically reuse bounded typed Git sessions when the
9
+ injected plumbing supports them. Existing structural adapters remain compatible
10
+ and continue through the command-per-operation fallback.
11
+
12
+ Use `pages.putBatch()` when an application already has an explicit bounded page
13
+ group. The default envelope accepts at most 256 pages and 32 MiB, supports a
14
+ lower `maxBytes` on each page, preserves input order, and performs no writes
15
+ until the complete bounded batch is valid. Individual `pages.put()` calls remain
16
+ one-shot so an externally pruned unreachable blob can be recreated correctly.
17
+
18
+ Call `await cas.close()` when the store is no longer needed, especially when an
19
+ operation may still be active or a stream may remain unconsumed. Closing drains
20
+ or terminates local Git processes and releases bounded cache residency only; it
21
+ does not delete stored objects, move refs, or change retention or publication
22
+ state.
23
+
24
+ See [v6.5.2 Release Notes](./docs/releases/v6.5.2.md) and
25
+ [Application Storage](./docs/API.md#application-storage) for the complete batch,
26
+ streaming, and lifecycle contracts.
27
+
28
+ ## v6.5.0 To v6.5.1
29
+
30
+ v6.5.1 is API-additive and does not require stored-data migration. Repeated
31
+ `pages.get()` calls now reuse immutable payload bytes through a process-local
32
+ LRU bounded by entry count and aggregate bytes. Applications may tune the
33
+ defaults with `pageCacheEntries` and `pageCacheBytes` when constructing the
34
+ store.
35
+
36
+ Every caller still receives an independent `Uint8Array`, and each call's
37
+ `maxBytes` limit remains authoritative on cold, resident, and shared in-flight
38
+ reads. Rejected work remains retryable, and an individually oversized payload
39
+ does not displace unrelated residents.
40
+
41
+ `pages.open()` remains the streaming API and never enters the payload cache.
42
+ Cache residence is an optimization, not retention evidence; keep each handle
43
+ reachable through a workspace, RootSet, cache acquisition, publication, or
44
+ other documented lifetime while consuming it.
45
+
46
+ See [v6.5.1 Release Notes](./docs/releases/v6.5.1.md) and
47
+ [Application Storage](./docs/API.md#application-storage) for the complete
48
+ residency and lifetime contract.
49
+
5
50
  ## v6.4.0 To v6.5.0
6
51
 
7
52
  v6.5.0 is API-additive and does not require stored-data migration. It adds
package/build-info.json CHANGED
@@ -1,4 +1,4 @@
1
1
  {
2
- "sha": "f464b92",
3
- "timestamp": "2026-07-18T18:14:48.391Z"
2
+ "sha": "c2d41f6",
3
+ "timestamp": "2026-07-19T14:30:05.597Z"
4
4
  }
package/docs/API.md CHANGED
@@ -80,6 +80,8 @@ new ContentAddressableStore(options);
80
80
  - `options.maxRestoreBufferSize` (optional): Max bytes for buffered encrypted/compressed restore (default: 536870912 / 512 MiB)
81
81
  - `options.maxBlobSize` (optional): Max bytes for metadata blob reads (default: 10485760 / 10 MiB)
82
82
  - `options.maxPageSize` (optional): Maximum immutable page bytes (default: 16777216 / 16 MiB)
83
+ - `options.pageCacheEntries` (optional): Maximum immutable page payloads retained in memory (default: 128)
84
+ - `options.pageCacheBytes` (optional): Maximum immutable page payload bytes retained in memory (default: 8388608 / 8 MiB)
83
85
  - `options.bundleLimits` (optional): Repository maximums for bundle members, path bytes, descriptor bytes, fanout entries, and fanout depth
84
86
  - `options.maxBundleNestingDepth` (optional): Maximum nested bundle depth (default: 32)
85
87
  - `options.compressionAdapter` (optional): CompressionPort implementation (default: NodeCompressionAdapter)
@@ -180,6 +182,21 @@ Lazily initializes and returns the underlying VaultService instance.
180
182
  const vaultService = await cas.getVaultService();
181
183
  ```
182
184
 
185
+ #### close
186
+
187
+ ```javascript
188
+ await cas.close();
189
+ ```
190
+
191
+ Blocks new facade operations, drains started persistence operations, and
192
+ releases adapter-owned Git sessions and streams. The method is idempotent and
193
+ is also available as `Symbol.asyncDispose`.
194
+
195
+ Closure affects local resources only. It does not delete Git objects, update
196
+ refs, run garbage collection, expire retained content, or mutate publication
197
+ state. Production code should call `close()` from `finally` when async disposal
198
+ syntax is unavailable.
199
+
183
200
  #### store
184
201
 
185
202
  ```javascript
@@ -1002,11 +1019,20 @@ Validates an existing git-cas manifest tree and wraps it in the same staged
1002
1019
  result returned by `assets.put()`. This is a migration bridge for callers that
1003
1020
  already persisted raw tree OIDs; new application code should exchange handles.
1004
1021
 
1005
- ### `pages.put()`, `pages.open()`, and `pages.get()`
1022
+ ### `pages.put()`, `pages.putBatch()`, `pages.open()`, and `pages.get()`
1006
1023
 
1007
1024
  ```javascript
1008
1025
  const staged = await cas.pages.put({ source, maxBytes });
1009
1026
 
1027
+ const stagedBatch = await cas.pages.putBatch({
1028
+ pages: [
1029
+ { source: firstPage, maxBytes: 4096 },
1030
+ { source: secondPage, maxBytes: 4096 },
1031
+ ],
1032
+ maxBatchPages: 16,
1033
+ maxBatchBytes: 65536,
1034
+ });
1035
+
1010
1036
  for await (const chunk of cas.pages.open({ handle: staged.handle })) {
1011
1037
  consume(chunk);
1012
1038
  }
@@ -1025,6 +1051,27 @@ metadata before streaming it. `get()` additionally collects the page under its
1025
1051
  effective byte bound. An imported handle above the configured maximum fails
1026
1052
  with `PAGE_TOO_LARGE` without materializing the blob.
1027
1053
 
1054
+ `putBatch()` returns an immutable ordered array of `StagedPage` results. It
1055
+ validates and collects every page before persistence begins, defaults to at
1056
+ most 256 pages and 32 MiB across the batch, and rejects count or aggregate-byte
1057
+ overflow with `PAGE_BATCH_LIMIT`. A session-capable Git adapter writes the
1058
+ batch through one scoped fast-import process that checkpoints and closes before
1059
+ the method returns. Individual `put()` calls remain one-shot so an externally
1060
+ pruned object is recreated correctly on a later identical write.
1061
+
1062
+ Successful `get()` payloads share in-flight and completed immutable reads inside
1063
+ one store instance. The default LRU retains at most 128 payloads and 8 MiB of
1064
+ payload bytes; `pageCacheEntries` and `pageCacheBytes` may lower or raise those
1065
+ bounds. Every result is copied for its caller, failed reads remain retryable,
1066
+ and a payload larger than the byte budget is returned without remaining
1067
+ resident. Cold misses validate object type and size before reading. Resident or
1068
+ in-flight hits reuse that immutable OID validation and still enforce the current
1069
+ caller's `maxBytes`. In-flight work is coalesced separately from completed LRU
1070
+ residence, so its transient memory follows caller concurrency and the per-page
1071
+ size bound. `open()` remains streaming and does not enter the payload cache.
1072
+ This reuse is not retention evidence; callers must keep the page reachable for
1073
+ the duration of use.
1074
+
1028
1075
  The canonical page token is:
1029
1076
 
1030
1077
  ```text
@@ -3327,12 +3374,14 @@ new CasError({ message, code, meta, documentationUrl });
3327
3374
  | `GIT_ERROR` | Underlying Git plumbing command failed | `readManifest()`, `inspectAsset()`, `collectReferencedChunks()` |
3328
3375
  | `GIT_REF_NOT_FOUND` | Git ref lookup found no ref; vault reads normalize this to empty state | `GitRefAdapter`, `VaultPersistence` |
3329
3376
  | `INVALID_OPTIONS` | Mutually exclusive options provided or unsupported option value | `store()`, `restore()` |
3377
+ | `RESOURCE_CLOSED` | A facade or persistence adapter operation began while or after closure was in progress | `ContentAddressableStore`, `GitPersistenceAdapter` |
3330
3378
  | `HANDLE_INVALID` | Handle object, canonical token, or staged result is malformed or unsupported | Application handles and staged results |
3331
3379
  | `HANDLE_KIND_MISMATCH` | A handle has a valid envelope but the wrong content kind | Handle parsing and application storage |
3332
3380
  | `HANDLE_CODEC_MISMATCH` | Handle manifest codec differs from the active CAS codec | `assets.open()`, `assets.adopt()`, retention, publication |
3333
3381
  | `HANDLE_TARGET_MISSING` | The repository does not contain the complete object graph referenced by a handle | `assets.open()`, `assets.adopt()`, retention, publication |
3334
3382
  | `HANDLE_TARGET_TYPE_MISMATCH` | A handle root or referenced object has the wrong Git object type | Application storage validation |
3335
3383
  | `PAGE_TOO_LARGE` | Page input or imported page blob exceeds the effective byte bound | `pages.put()`, `pages.get()`, `pages.open()` |
3384
+ | `PAGE_BATCH_LIMIT` | Page batch count or aggregate bytes exceed the explicit batch policy | `pages.putBatch()` |
3336
3385
  | `BUNDLE_CORRUPT` | Persisted bundle descriptors, edges, ranges, or target summaries disagree | Bundle reads, retention, publication |
3337
3386
  | `BUNDLE_DESCRIPTOR_LIMIT` | Bundle descriptor bytes exceed admission or repository read policy | Bundle construction and validation |
3338
3387
  | `BUNDLE_DUPLICATE_PATH` | Two ordered bundle members use the same canonical path | `bundles.putOrdered()` |
@@ -0,0 +1,44 @@
1
+ # git-cas v6.5.1 Release Notes
2
+
3
+ v6.5.1 completes the bounded immutable read path introduced in v6.5.0 by
4
+ coalescing repeated `pages.get()` payload reads. Exact application reads no
5
+ longer start another Git blob process when the same retained page is already
6
+ resident in the store's bounded payload cache.
7
+
8
+ ## Bounded Payload Reuse
9
+
10
+ The page cache defaults to at most 128 entries and 8 MiB of payload bytes. It
11
+ allocates no fixed arena. Applications can configure the limits with
12
+ `pageCacheEntries` and `pageCacheBytes` when constructing the store.
13
+
14
+ Every `get()` result is a caller-owned copy. Concurrent reads share in-flight
15
+ work, rejected reads are immediately retryable, and values larger than the byte
16
+ budget are returned to the current caller without remaining resident or
17
+ evicting unrelated entries. In-flight work is tracked separately from completed
18
+ LRU residence, so capacity pressure cannot break coalescing; transient memory
19
+ still follows caller concurrency and the configured per-page size bound.
20
+
21
+ `pages.open()` is unchanged: it remains a streaming operation and never enters
22
+ the payload cache. Cache residence is not a retention witness, so applications
23
+ must continue to keep handles reachable through the documented lifecycle APIs.
24
+
25
+ ## Performance Evidence
26
+
27
+ The real-Git command-count integration contract proves that an identical warm
28
+ `pages.get()` performs zero additional Git commands. git-warp will publish its
29
+ end-to-end CPU, wall-clock, Git-command, and bounded-memory deltas after adopting
30
+ this release.
31
+
32
+ ## Verification
33
+
34
+ The versioned candidate passed all 14 release-verifier steps with 6,676 observed
35
+ tests: 2,036 Node unit tests, 2,035 Bun unit tests, 2,026 Deno unit tests, and
36
+ 193 real-Git integration tests on each runtime. Lint, examples, public type
37
+ compatibility, build stamping, npm packaging dry-run, and JSR publication
38
+ dry-run also passed.
39
+
40
+ ## Compatibility
41
+
42
+ This release does not require stored-data migration. It changes no persisted
43
+ formats, handles, refs, witnesses, or existing method signatures. The two
44
+ constructor options are additive and optional.
@@ -0,0 +1,63 @@
1
+ # git-cas v6.5.2 Release Notes
2
+
3
+ v6.5.2 removes repeated Git process startup from immutable object metadata and
4
+ tree reads, adds an explicitly bounded page-batch write path, and gives store
5
+ owners deterministic local resource cleanup.
6
+
7
+ ## Persistent Git Object Sessions
8
+
9
+ `GitPersistenceAdapter` now reuses one lazily opened typed `cat-file` session
10
+ for immutable metadata and tree reads. Tree creation uses typed `mktree`, while
11
+ each explicit page batch uses one scoped `fast-import` process. Existing
12
+ injected plumbing without typed session capabilities remains source-compatible
13
+ and uses the command-per-operation fallback.
14
+
15
+ Parsed tree residency is bounded by entry count and estimated bytes. Payload
16
+ reads and streams preserve their existing bounds; streams are not buffered.
17
+ Individual blob writes deliberately remain one-shot so a blob pruned by an
18
+ external process is recreated on the next write rather than trusted through
19
+ stale process state.
20
+
21
+ ## Bounded Page Batches
22
+
23
+ `pages.putBatch()` accepts a complete explicit page group, defaults to at most
24
+ 256 pages and 32 MiB, and permits lower per-page and aggregate bounds. It
25
+ collects and validates the bounded inputs before persistence, preserves input
26
+ order, and returns immutable staged-page results with the same content identity
27
+ as individual writes.
28
+
29
+ ## Resource Lifecycle
30
+
31
+ `ContentAddressableStore.close()` and async disposal block new operations,
32
+ drain work that already started, terminate abandoned streams and Git children,
33
+ close typed sessions, and release bounded cache residency. Closing is local
34
+ resource cleanup only. It never removes objects, moves refs, or changes
35
+ retention and publication state.
36
+
37
+ ## Performance Evidence
38
+
39
+ The controlled real-Git diagnostic reduced selected bundle-reference reads from
40
+ 225 Git processes to one and observed wall time from 288.647 ms to 50.366 ms.
41
+ Bounded page writes fell from 32 processes to one and from 68.658 ms to
42
+ 33.490 ms. Semantic digests were identical in both comparisons. Timing is
43
+ environment-specific; process counts and semantic equality are stable
44
+ regression contracts.
45
+
46
+ These measurements exclude Git child CPU and RSS. git-warp still owes its own
47
+ process-tree CPU, end-to-end latency, and larger-than-memory streaming evidence
48
+ after adopting this release.
49
+
50
+ ## Verification
51
+
52
+ The versioned candidate passed all 14 release-verifier steps with 6,817 observed
53
+ tests: 2,080 Node unit tests, 2,079 Bun unit tests, 2,070 Deno unit tests, and
54
+ 196 real-Git integration tests on each runtime. Lint, examples, public type
55
+ compatibility, build stamping, npm packaging dry-run, and JSR publication
56
+ dry-run also passed.
57
+
58
+ ## Compatibility
59
+
60
+ This release does not require stored-data migration. Existing persisted formats,
61
+ handles, refs, witnesses, and method signatures remain compatible. The batch and
62
+ lifecycle methods are additive, and low-level persistence adapters may continue
63
+ to omit the optional session, batch-write, and close capabilities.
package/index.d.ts CHANGED
@@ -513,6 +513,7 @@ export declare class CryptoPortBase {
513
513
  /** Abstract port for persisting data to Git's object database. */
514
514
  export declare class GitPersistencePortBase {
515
515
  writeBlob(content: Uint8Array): Promise<string>;
516
+ writeBlobs?(contents: Iterable<Uint8Array>): Promise<string[]>;
516
517
  writeTree(entries: string[]): Promise<string>;
517
518
  readBlob(oid: string, maxBytes?: number): Promise<Uint8Array>;
518
519
  readBlobStream(oid: string): Promise<AsyncIterable<Uint8Array>>;
@@ -529,6 +530,8 @@ export declare class GitPersistencePortBase {
529
530
  readObjectType(oid: string): Promise<string>;
530
531
  readObjectSize(oid: string): Promise<number>;
531
532
  setMaxBlobSize?(maxBlobSize: number): void;
533
+ close?(): Promise<void>;
534
+ [Symbol.asyncDispose]?(): Promise<void>;
532
535
  }
533
536
 
534
537
  /** Abstract port for Git ref and commit operations. */
@@ -568,8 +571,14 @@ export declare class GitPersistenceAdapter extends GitPersistencePortBase {
568
571
  plumbing: unknown;
569
572
  policy?: unknown;
570
573
  metadataCacheEntries?: number;
574
+ sessionIdleTimeoutMs?: number;
575
+ treeCacheEntries?: number;
576
+ treeCacheBytes?: number;
571
577
  });
578
+ writeBlobs(contents: Iterable<Uint8Array>): Promise<string[]>;
572
579
  setMaxBlobSize(maxBlobSize: number): void;
580
+ close(): Promise<void>;
581
+ [Symbol.asyncDispose](): Promise<void>;
573
582
  }
574
583
 
575
584
  /** Git-backed implementation of the ref port. */
@@ -706,6 +715,10 @@ export interface ContentAddressableStoreOptions {
706
715
  maxBlobSize?: number;
707
716
  /** Maximum immutable page size in bytes. @default 16777216 (16 MiB) */
708
717
  maxPageSize?: number;
718
+ /** Maximum immutable page payloads retained in memory. @default 128 */
719
+ pageCacheEntries?: number;
720
+ /** Maximum immutable page payload bytes retained in memory. @default 8388608 (8 MiB) */
721
+ pageCacheBytes?: number;
709
722
  /** Repository-wide maximum bundle admission limits. */
710
723
  bundleLimits?: Partial<BundleLimits>;
711
724
  /** Maximum nested bundle depth. @default 32 */
@@ -1451,6 +1464,11 @@ export type PageSource =
1451
1464
 
1452
1465
  export interface PageCapability {
1453
1466
  put(options: { source: PageSource; maxBytes?: number }): Promise<StagedPage>;
1467
+ putBatch(options: {
1468
+ pages: Array<{ source: PageSource; maxBytes?: number }>;
1469
+ maxBatchBytes?: number;
1470
+ maxBatchPages?: number;
1471
+ }): Promise<ReadonlyArray<StagedPage>>;
1454
1472
  get(options: { handle: PageHandleInput; maxBytes?: number }): Promise<Uint8Array>;
1455
1473
  open(options: { handle: PageHandleInput }): AsyncIterable<Uint8Array>;
1456
1474
  }
@@ -1719,6 +1737,9 @@ export default class ContentAddressableStore {
1719
1737
  getService(): Promise<CasService>;
1720
1738
  getVaultService(): Promise<VaultService>;
1721
1739
  getRootSetRegistry(): Promise<RootSetRegistry>;
1740
+ /** Releases local resources only. Stored objects and refs are unchanged. */
1741
+ close(): Promise<void>;
1742
+ [Symbol.asyncDispose](): Promise<void>;
1722
1743
 
1723
1744
  static open(options?: ContentAddressableStoreOpenOptions): Promise<ContentAddressableStore>;
1724
1745
 
package/index.js CHANGED
@@ -133,6 +133,8 @@ export default class ContentAddressableStore {
133
133
  * @param {number} [options.maxRestoreBufferSize=536870912] - Max buffered restore size in bytes for encrypted/compressed restores (default 512 MiB).
134
134
  * @param {number} [options.maxBlobSize=10485760] - Safety limit for readBlob metadata in bytes (default 10 MiB).
135
135
  * @param {number} [options.maxPageSize=16777216] - Maximum immutable page size in bytes (default 16 MiB).
136
+ * @param {number} [options.pageCacheEntries=128] - Maximum immutable page payloads retained in memory.
137
+ * @param {number} [options.pageCacheBytes=8388608] - Maximum immutable page payload bytes retained in memory.
136
138
  * @param {object} [options.bundleLimits] - Repository-wide maximum bundle admission limits.
137
139
  * @param {number} [options.maxBundleNestingDepth=32] - Maximum nested bundle depth.
138
140
  * @param {import('./src/ports/CompressionPort.js').default} [options.compressionAdapter] - Compression adapter (default NodeCompressionAdapter).
@@ -153,6 +155,8 @@ export default class ContentAddressableStore {
153
155
  maxRestoreBufferSize,
154
156
  maxBlobSize,
155
157
  maxPageSize,
158
+ pageCacheEntries,
159
+ pageCacheBytes,
156
160
  bundleLimits,
157
161
  maxBundleNestingDepth,
158
162
  compressionAdapter,
@@ -173,6 +177,8 @@ export default class ContentAddressableStore {
173
177
  maxRestoreBufferSize,
174
178
  maxBlobSize,
175
179
  maxPageSize,
180
+ pageCacheEntries,
181
+ pageCacheBytes,
176
182
  bundleLimits,
177
183
  maxBundleNestingDepth,
178
184
  compressionAdapter,
@@ -209,6 +215,7 @@ export default class ContentAddressableStore {
209
215
  });
210
216
  this.pages = Object.freeze({
211
217
  put: async (options) => (await this.#getPageService()).put(options),
218
+ putBatch: async (options) => (await this.#getPageService()).putBatch(options),
212
219
  get: async (options) => (await this.#getPageService()).get(options),
213
220
  open: (options) => this.#openPage(options),
214
221
  });
@@ -231,7 +238,7 @@ export default class ContentAddressableStore {
231
238
  });
232
239
  }
233
240
 
234
- /** @type {{ plumbing: *, chunkSize?: number, codec?: *, policy?: *, crypto?: *, observability?: *, merkleThreshold?: number, concurrency?: number, chunking?: *, chunker?: *, maxRestoreBufferSize?: number, maxBlobSize?: number, maxPageSize?: number, bundleLimits?: object, maxBundleNestingDepth?: number, compressionAdapter?: *, applicationRefPrefixes?: string[], clock?: { now(): Date } }} */
241
+ /** @type {{ plumbing: *, chunkSize?: number, codec?: *, policy?: *, crypto?: *, observability?: *, merkleThreshold?: number, concurrency?: number, chunking?: *, chunker?: *, maxRestoreBufferSize?: number, maxBlobSize?: number, maxPageSize?: number, pageCacheEntries?: number, pageCacheBytes?: number, bundleLimits?: object, maxBundleNestingDepth?: number, compressionAdapter?: *, applicationRefPrefixes?: string[], clock?: { now(): Date } }} */
235
242
  #config;
236
243
  /** @type {AssetService|null} */
237
244
  #assetService = null;
@@ -255,6 +262,8 @@ export default class ContentAddressableStore {
255
262
  #stagingWorkspaceRegistry = null;
256
263
  /** @type {RepositoryDoctor|null} */
257
264
  #repositoryDoctor = null;
265
+ #closePromise = null;
266
+ #closed = false;
258
267
  #servicePromise = null;
259
268
 
260
269
  /**
@@ -263,6 +272,7 @@ export default class ContentAddressableStore {
263
272
  * @returns {Promise<CasService>}
264
273
  */
265
274
  async #getService() {
275
+ this.#assertOpen();
266
276
  if (!this.#servicePromise) {
267
277
  this.#servicePromise = this.#initService();
268
278
  }
@@ -369,6 +379,8 @@ export default class ContentAddressableStore {
369
379
  this.#pageService = new PageService({
370
380
  persistence: this.service.persistence,
371
381
  maxPageSize: cfg.maxPageSize,
382
+ pageCacheEntries: cfg.pageCacheEntries,
383
+ pageCacheBytes: cfg.pageCacheBytes,
372
384
  clock: cfg.clock,
373
385
  });
374
386
  this.#bundleService = new BundleService({
@@ -600,6 +612,37 @@ export default class ContentAddressableStore {
600
612
  return await this.#getRootSetRegistry();
601
613
  }
602
614
 
615
+ /**
616
+ * Releases local adapter resources. This does not mutate stored objects,
617
+ * refs, retention, or publication state.
618
+ * @returns {Promise<void>}
619
+ */
620
+ async close() {
621
+ if (this.#closePromise !== null) {
622
+ return await this.#closePromise;
623
+ }
624
+ this.#closed = true;
625
+ this.#closePromise = (async () => {
626
+ if (this.#servicePromise === null) {
627
+ return;
628
+ }
629
+ const service = await this.#servicePromise;
630
+ await service.persistence.close();
631
+ })();
632
+ return await this.#closePromise;
633
+ }
634
+
635
+ /** @returns {Promise<void>} */
636
+ async [Symbol.asyncDispose]() {
637
+ await this.close();
638
+ }
639
+
640
+ #assertOpen() {
641
+ if (this.#closed) {
642
+ throw createCasError('Content-addressable store is closed', ErrorCodes.RESOURCE_CLOSED);
643
+ }
644
+ }
645
+
603
646
  /**
604
647
  * Factory to create a default JSON CAS from a Git working directory.
605
648
  *
@@ -620,6 +663,9 @@ export default class ContentAddressableStore {
620
663
  * @param {import('./src/ports/ChunkingPort.js').default} [options.chunker] - Pre-built ChunkingPort instance.
621
664
  * @param {number} [options.maxRestoreBufferSize=536870912] - Max buffered restore size in bytes.
622
665
  * @param {number} [options.maxBlobSize=10485760] - Safety limit for readBlob metadata in bytes.
666
+ * @param {number} [options.maxPageSize=16777216] - Maximum immutable page size in bytes.
667
+ * @param {number} [options.pageCacheEntries=128] - Maximum immutable page payloads retained in memory.
668
+ * @param {number} [options.pageCacheBytes=8388608] - Maximum immutable page payload bytes retained in memory.
623
669
  * @param {import('./src/ports/CompressionPort.js').default} [options.compressionAdapter] - Compression adapter.
624
670
  * @returns {Promise<ContentAddressableStore>}
625
671
  */
@@ -644,6 +690,9 @@ export default class ContentAddressableStore {
644
690
  * @param {import('./src/ports/ChunkingPort.js').default} [options.chunker] - Pre-built ChunkingPort instance.
645
691
  * @param {number} [options.maxRestoreBufferSize=536870912] - Max buffered restore size in bytes.
646
692
  * @param {number} [options.maxBlobSize=10485760] - Safety limit for readBlob metadata in bytes.
693
+ * @param {number} [options.maxPageSize=16777216] - Maximum immutable page size in bytes.
694
+ * @param {number} [options.pageCacheEntries=128] - Maximum immutable page payloads retained in memory.
695
+ * @param {number} [options.pageCacheBytes=8388608] - Maximum immutable page payload bytes retained in memory.
647
696
  * @param {import('./src/ports/CompressionPort.js').default} [options.compressionAdapter] - Compression adapter.
648
697
  * @returns {ContentAddressableStore}
649
698
  */
@@ -665,6 +714,9 @@ export default class ContentAddressableStore {
665
714
  * @param {import('./src/ports/ChunkingPort.js').default} [options.chunker] - Pre-built ChunkingPort instance.
666
715
  * @param {number} [options.maxRestoreBufferSize=536870912] - Max buffered restore size in bytes.
667
716
  * @param {number} [options.maxBlobSize=10485760] - Safety limit for readBlob metadata in bytes.
717
+ * @param {number} [options.maxPageSize=16777216] - Maximum immutable page size in bytes.
718
+ * @param {number} [options.pageCacheEntries=128] - Maximum immutable page payloads retained in memory.
719
+ * @param {number} [options.pageCacheBytes=8388608] - Maximum immutable page payload bytes retained in memory.
668
720
  * @param {import('./src/ports/CompressionPort.js').default} [options.compressionAdapter] - Compression adapter.
669
721
  * @returns {ContentAddressableStore}
670
722
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@git-stunts/git-cas",
3
- "version": "6.5.0",
3
+ "version": "6.5.2",
4
4
  "description": "Content-addressed storage backed by Git's object database, with optional encryption and pluggable codecs",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -37,6 +37,8 @@
37
37
  "docs/releases/v6.3.0.md",
38
38
  "docs/releases/v6.4.0.md",
39
39
  "docs/releases/v6.5.0.md",
40
+ "docs/releases/v6.5.1.md",
41
+ "docs/releases/v6.5.2.md",
40
42
  "docs/THREAT_MODEL.md",
41
43
  "docs/VAULT_INTERNALS.md",
42
44
  "docs/WALKTHROUGH.md",
@@ -102,7 +104,7 @@
102
104
  "@flyingrobots/bijou-tui": "^5.0.0",
103
105
  "@flyingrobots/bijou-tui-app": "^5.0.0",
104
106
  "@git-stunts/alfred": "^0.10.0",
105
- "@git-stunts/plumbing": "^3.1.0",
107
+ "@git-stunts/plumbing": "^3.2.0",
106
108
  "@git-stunts/vault": "^1.0.1",
107
109
  "cbor-x": "^1.6.0",
108
110
  "commander": "14.0.3",