@bevel-software/platform-shared 0.36.1 → 0.38.0

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.
@@ -0,0 +1,11 @@
1
+ /**
2
+ * SHA-256 (FIPS 180-4) of a string's UTF-8 bytes, as lowercase hex.
3
+ *
4
+ * Synchronous and dependency-free, so the same digest is derivable in any
5
+ * browser context and on the server. `crypto.subtle` is not that: a browser
6
+ * offers it only in a secure context, so a deployment reached over plain
7
+ * HTTP would have no digest at all.
8
+ */
9
+ /** The digest of `text` exactly as given, nothing trimmed or normalised (a lone surrogate is U+FFFD, as `TextEncoder` writes it). */
10
+ export declare function sha256Hex(text: string): string;
11
+ //# sourceMappingURL=sha256.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sha256.d.ts","sourceRoot":"","sources":["../../src/hash/sha256.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAeH,qIAAqI;AACrI,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA4C9C"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * SHA-256 (FIPS 180-4) of a string's UTF-8 bytes, as lowercase hex.
3
+ *
4
+ * Synchronous and dependency-free, so the same digest is derivable in any
5
+ * browser context and on the server. `crypto.subtle` is not that: a browser
6
+ * offers it only in a secure context, so a deployment reached over plain
7
+ * HTTP would have no digest at all.
8
+ */
9
+ const K = new Uint32Array([
10
+ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
11
+ 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
12
+ 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
13
+ 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
14
+ 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
15
+ 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
16
+ 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
17
+ 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
18
+ ]);
19
+ const utf8 = new TextEncoder();
20
+ /** The digest of `text` exactly as given, nothing trimmed or normalised (a lone surrogate is U+FFFD, as `TextEncoder` writes it). */
21
+ export function sha256Hex(text) {
22
+ const bytes = utf8.encode(text);
23
+ const bitLength = bytes.length * 8;
24
+ // The message, a 1 bit, zeros, and the 64-bit length: a whole number of 64-byte blocks.
25
+ const padded = new Uint8Array((((bytes.length + 8) >> 6) + 1) << 6);
26
+ padded.set(bytes);
27
+ padded[bytes.length] = 0x80;
28
+ const view = new DataView(padded.buffer);
29
+ view.setUint32(padded.length - 8, Math.floor(bitLength / 0x1_0000_0000));
30
+ view.setUint32(padded.length - 4, bitLength >>> 0);
31
+ const h = new Uint32Array([0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19]);
32
+ const w = new Uint32Array(64);
33
+ const rotr = (x, n) => (x >>> n) | (x << (32 - n));
34
+ for (let offset = 0; offset < padded.length; offset += 64) {
35
+ for (let i = 0; i < 16; i++)
36
+ w[i] = view.getUint32(offset + i * 4);
37
+ for (let i = 16; i < 64; i++) {
38
+ const s0 = rotr(w[i - 15], 7) ^ rotr(w[i - 15], 18) ^ (w[i - 15] >>> 3);
39
+ const s1 = rotr(w[i - 2], 17) ^ rotr(w[i - 2], 19) ^ (w[i - 2] >>> 10);
40
+ w[i] = w[i - 16] + s0 + w[i - 7] + s1;
41
+ }
42
+ let [a, b, c, d, e, f, g, hh] = h;
43
+ for (let i = 0; i < 64; i++) {
44
+ const S1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
45
+ const ch = (e & f) ^ (~e & g);
46
+ const t1 = (hh + S1 + ch + K[i] + w[i]) >>> 0;
47
+ const S0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22);
48
+ const maj = (a & b) ^ (a & c) ^ (b & c);
49
+ const t2 = (S0 + maj) >>> 0;
50
+ hh = g;
51
+ g = f;
52
+ f = e;
53
+ e = (d + t1) >>> 0;
54
+ d = c;
55
+ c = b;
56
+ b = a;
57
+ a = (t1 + t2) >>> 0;
58
+ }
59
+ // A Uint32Array keeps each sum modulo 2^32.
60
+ [a, b, c, d, e, f, g, hh].forEach((x, i) => {
61
+ h[i] = h[i] + x;
62
+ });
63
+ }
64
+ return Array.from(h, (x) => x.toString(16).padStart(8, '0')).join('');
65
+ }
66
+ //# sourceMappingURL=sha256.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sha256.js","sourceRoot":"","sources":["../../src/hash/sha256.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,CAAC,GAAG,IAAI,WAAW,CAAC;IACxB,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9F,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9F,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU;IAC9F,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAA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AAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;YACnB,CAAC,GAAG,CAAC,CAAC;YACN,CAAC,GAAG,CAAC,CAAC;YACN,CAAC,GAAG,CAAC,CAAC;YACN,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;QACD,4CAA4C;QAC5C,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YACzC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,GAAG,CAAC,CAAC;QACnB,CAAC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACxE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -13,6 +13,7 @@ export * from './workspace/placeholder.js';
13
13
  export * from './workspace/frontmatter-carriers.js';
14
14
  export * from './workspace/platform-files.js';
15
15
  export * from './workspace/access-verbs.js';
16
+ export * from './hash/sha256.js';
16
17
  export * from './git/types.js';
17
18
  export * from './git/pr.types.js';
18
19
  export * from './git/protected.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAG1C,cAAc,iBAAiB,CAAC;AAGhC,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc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 export * from './workspace/placeholder.js';
16
16
  export * from './workspace/frontmatter-carriers.js';
17
17
  export * from './workspace/platform-files.js';
18
18
  export * from './workspace/access-verbs.js';
19
+ // Hashing
20
+ export * from './hash/sha256.js';
19
21
  // Git
20
22
  export * from './git/types.js';
21
23
  export * from './git/pr.types.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO;AACP,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAE1C,OAAO;AACP,cAAc,iBAAiB,CAAC;AAEhC,YAAY;AACZ,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qCAAqC,CAAC;AACpD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAE5C,MAAM;AACN,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qCAAqC,CAAC;AAEpD,sFAAsF;AACtF,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO;AACP,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAE1C,OAAO;AACP,cAAc,iBAAiB,CAAC;AAEhC,YAAY;AACZ,cAAc,sBAAsB,CAAC;AACrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qCAAqC,CAAC;AACpD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAE5C,UAAU;AACV,cAAc,kBAAkB,CAAC;AAEjC,MAAM;AACN,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qCAAqC,CAAC;AAEpD,sFAAsF;AACtF,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC"}
@@ -13,6 +13,7 @@
13
13
  * New types that have no git counterpart (file locks, change-request open
14
14
  * inputs, conflict-resolution payloads) live here directly.
15
15
  */
16
+ import type { AuthUser } from '../auth/types.js';
16
17
  import type { BranchInfo, CommitAttribution, MergeIntoBranchOutcome, ShareChangesRequest, WorkingTreeStatus } from '../git/types.js';
17
18
  import type { AccessRequestLevel, CancelPrResult, FileApprovalState, MergePrResult, PullRequestDetail, PullRequestState, PullRequestSummary, PullRequestFile } from '../git/pr.types.js';
18
19
  /** A variation of the ontology. Protected or not. */
@@ -40,6 +41,39 @@ export type Change = CommitAttribution;
40
41
  * forced single-path scope).
41
42
  */
42
43
  export type ChangeInput = ShareChangesRequest;
44
+ /**
45
+ * A set of files committed as one change — pushed, or landed locally with its
46
+ * push still owed to the pending-commits worker — as the git service reports
47
+ * it (`VersionControlHooks.onCommitLanded`) and the file-change notifier hands
48
+ * it to the in-process reactors (catalog invalidation, id-repair, a
49
+ * deployment's own listeners) when it lands. A reactor reads the working
50
+ * tree, which carries the commit either way; the later push makes no new
51
+ * commit and is not announced again. One announcement per commit: a
52
+ * single-file save names its one path, a batch every path it committed, a
53
+ * merge every path it brought in — so a reactor that does expensive work per
54
+ * announcement does it once per batch.
55
+ */
56
+ export interface FilesChange {
57
+ workspaceId: string;
58
+ branch: string;
59
+ /**
60
+ * Workspace-relative paths the commit touched (≥1; sorted, no path twice —
61
+ * the notifier shapes them so). A reactor that writes one acquires its lock
62
+ * like any writer: a batch's committer releases its locks once the commit's
63
+ * push has gone through or been handed off to the recovery worker (the
64
+ * lock-aware filesystem's acquire retries cover the usual push; a slower one
65
+ * leaves the writer to skip); an autosave
66
+ * checkpoint is announced under the editor's lock, held while the person
67
+ * edits. Either way a writer that could not lock treats it as "not now" and
68
+ * catches up on the path's next announcement — the release commit when it
69
+ * carries new bytes, the file's next change. A reactor re-reads what it is
70
+ * told of, so a path named without a change costs it one read, never a
71
+ * wrong answer.
72
+ */
73
+ paths: string[];
74
+ /** Who the change was committed as — a reacting write (id-repair) acts as the same user. */
75
+ byUser: AuthUser;
76
+ }
43
77
  /**
44
78
  * A live edit lock on one (branch, path). Per the version-control spec:
45
79
  * - acquired on first edit in edit mode, or on agent write
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/version-control/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACV,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,eAAe,EAChB,MAAM,oBAAoB,CAAC;AAI5B,qDAAqD;AACrD,MAAM,MAAM,MAAM,GAAG,UAAU,CAAC;AAEhC;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAItD;;;;;;GAMG;AACH,MAAM,MAAM,M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;IACnB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,iBAAiB,GACzB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GACvE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,YAAY,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,GACrD;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,YAAY,CAAA;CAAE,GACzC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,aAAa,CAAA;CAAE,GAC1C;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,UAAU,CAAC;IAAC,eAAe,EAAE,MAAM,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACjF;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bevel-software/platform-shared",
3
- "version": "0.36.1",
3
+ "version": "0.38.0",
4
4
  "description": "Shared types and pure domain utilities of the Bevel core platform (auth, workspace, git/version-control contracts, branch registry).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -0,0 +1,68 @@
1
+ /**
2
+ * SHA-256 (FIPS 180-4) of a string's UTF-8 bytes, as lowercase hex.
3
+ *
4
+ * Synchronous and dependency-free, so the same digest is derivable in any
5
+ * browser context and on the server. `crypto.subtle` is not that: a browser
6
+ * offers it only in a secure context, so a deployment reached over plain
7
+ * HTTP would have no digest at all.
8
+ */
9
+
10
+ const K = new Uint32Array([
11
+ 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
12
+ 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
13
+ 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
14
+ 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
15
+ 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
16
+ 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
17
+ 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
18
+ 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
19
+ ]);
20
+
21
+ const utf8 = new TextEncoder();
22
+
23
+ /** The digest of `text` exactly as given, nothing trimmed or normalised (a lone surrogate is U+FFFD, as `TextEncoder` writes it). */
24
+ export function sha256Hex(text: string): string {
25
+ const bytes = utf8.encode(text);
26
+ const bitLength = bytes.length * 8;
27
+ // The message, a 1 bit, zeros, and the 64-bit length: a whole number of 64-byte blocks.
28
+ const padded = new Uint8Array((((bytes.length + 8) >> 6) + 1) << 6);
29
+ padded.set(bytes);
30
+ padded[bytes.length] = 0x80;
31
+ const view = new DataView(padded.buffer);
32
+ view.setUint32(padded.length - 8, Math.floor(bitLength / 0x1_0000_0000));
33
+ view.setUint32(padded.length - 4, bitLength >>> 0);
34
+
35
+ const h = new Uint32Array([0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19]);
36
+ const w = new Uint32Array(64);
37
+ const rotr = (x: number, n: number) => (x >>> n) | (x << (32 - n));
38
+ for (let offset = 0; offset < padded.length; offset += 64) {
39
+ for (let i = 0; i < 16; i++) w[i] = view.getUint32(offset + i * 4);
40
+ for (let i = 16; i < 64; i++) {
41
+ const s0 = rotr(w[i - 15]!, 7) ^ rotr(w[i - 15]!, 18) ^ (w[i - 15]! >>> 3);
42
+ const s1 = rotr(w[i - 2]!, 17) ^ rotr(w[i - 2]!, 19) ^ (w[i - 2]! >>> 10);
43
+ w[i] = w[i - 16]! + s0 + w[i - 7]! + s1;
44
+ }
45
+ let [a, b, c, d, e, f, g, hh] = h;
46
+ for (let i = 0; i < 64; i++) {
47
+ const S1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
48
+ const ch = (e & f) ^ (~e & g);
49
+ const t1 = (hh + S1 + ch + K[i]! + w[i]!) >>> 0;
50
+ const S0 = rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22);
51
+ const maj = (a & b) ^ (a & c) ^ (b & c);
52
+ const t2 = (S0 + maj) >>> 0;
53
+ hh = g;
54
+ g = f;
55
+ f = e;
56
+ e = (d + t1) >>> 0;
57
+ d = c;
58
+ c = b;
59
+ b = a;
60
+ a = (t1 + t2) >>> 0;
61
+ }
62
+ // A Uint32Array keeps each sum modulo 2^32.
63
+ [a, b, c, d, e, f, g, hh].forEach((x, i) => {
64
+ h[i] = h[i]! + x;
65
+ });
66
+ }
67
+ return Array.from(h, (x) => x.toString(16).padStart(8, '0')).join('');
68
+ }
package/src/index.ts CHANGED
@@ -19,6 +19,9 @@ export * from './workspace/frontmatter-carriers.js';
19
19
  export * from './workspace/platform-files.js';
20
20
  export * from './workspace/access-verbs.js';
21
21
 
22
+ // Hashing
23
+ export * from './hash/sha256.js';
24
+
22
25
  // Git
23
26
  export * from './git/types.js';
24
27
  export * from './git/pr.types.js';
@@ -14,6 +14,7 @@
14
14
  * inputs, conflict-resolution payloads) live here directly.
15
15
  */
16
16
 
17
+ import type { AuthUser } from '../auth/types.js';
17
18
  import type {
18
19
  BranchInfo,
19
20
  CommitAttribution,
@@ -65,6 +66,40 @@ export type Change = CommitAttribution;
65
66
  */
66
67
  export type ChangeInput = ShareChangesRequest;
67
68
 
69
+ /**
70
+ * A set of files committed as one change — pushed, or landed locally with its
71
+ * push still owed to the pending-commits worker — as the git service reports
72
+ * it (`VersionControlHooks.onCommitLanded`) and the file-change notifier hands
73
+ * it to the in-process reactors (catalog invalidation, id-repair, a
74
+ * deployment's own listeners) when it lands. A reactor reads the working
75
+ * tree, which carries the commit either way; the later push makes no new
76
+ * commit and is not announced again. One announcement per commit: a
77
+ * single-file save names its one path, a batch every path it committed, a
78
+ * merge every path it brought in — so a reactor that does expensive work per
79
+ * announcement does it once per batch.
80
+ */
81
+ export interface FilesChange {
82
+ workspaceId: string;
83
+ branch: string;
84
+ /**
85
+ * Workspace-relative paths the commit touched (≥1; sorted, no path twice —
86
+ * the notifier shapes them so). A reactor that writes one acquires its lock
87
+ * like any writer: a batch's committer releases its locks once the commit's
88
+ * push has gone through or been handed off to the recovery worker (the
89
+ * lock-aware filesystem's acquire retries cover the usual push; a slower one
90
+ * leaves the writer to skip); an autosave
91
+ * checkpoint is announced under the editor's lock, held while the person
92
+ * edits. Either way a writer that could not lock treats it as "not now" and
93
+ * catches up on the path's next announcement — the release commit when it
94
+ * carries new bytes, the file's next change. A reactor re-reads what it is
95
+ * told of, so a path named without a change costs it one read, never a
96
+ * wrong answer.
97
+ */
98
+ paths: string[];
99
+ /** Who the change was committed as — a reacting write (id-repair) acts as the same user. */
100
+ byUser: AuthUser;
101
+ }
102
+
68
103
  // ── File locks (new — no git counterpart) ────────────────────────────────────
69
104
 
70
105
  /**