@amalgm/live 0.2.17 → 0.2.19

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.
Files changed (43) hide show
  1. package/PURPOSE.md +24 -15
  2. package/README.md +1 -0
  3. package/dist/contracts/content.d.ts +9 -4
  4. package/dist/contracts/content.d.ts.map +1 -1
  5. package/dist/contracts/content.js +10 -5
  6. package/dist/contracts/content.js.map +1 -1
  7. package/dist/detection/classify.d.ts +5 -5
  8. package/dist/detection/classify.d.ts.map +1 -1
  9. package/dist/detection/classify.js +2 -2
  10. package/dist/detection/classify.js.map +1 -1
  11. package/dist/detection/continuity.d.ts +1 -1
  12. package/dist/detection/continuity.d.ts.map +1 -1
  13. package/dist/detection/index.d.ts +2 -5
  14. package/dist/detection/index.d.ts.map +1 -1
  15. package/dist/detection/index.js +2 -5
  16. package/dist/detection/index.js.map +1 -1
  17. package/dist/files/commands.d.ts +6 -1
  18. package/dist/files/commands.d.ts.map +1 -1
  19. package/dist/files/commands.js +4 -1
  20. package/dist/files/commands.js.map +1 -1
  21. package/dist/index.d.ts +1 -0
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +1 -0
  24. package/dist/index.js.map +1 -1
  25. package/dist/watching/coverage.d.ts +33 -0
  26. package/dist/watching/coverage.d.ts.map +1 -0
  27. package/dist/watching/coverage.js +49 -0
  28. package/dist/watching/coverage.js.map +1 -0
  29. package/dist/watching/index.d.ts +8 -0
  30. package/dist/watching/index.d.ts.map +1 -0
  31. package/dist/watching/index.js +8 -0
  32. package/dist/watching/index.js.map +1 -0
  33. package/dist/{detection → watching}/suspicion.d.ts +5 -7
  34. package/dist/watching/suspicion.d.ts.map +1 -0
  35. package/dist/{detection → watching}/suspicion.js +7 -9
  36. package/dist/watching/suspicion.js.map +1 -0
  37. package/package.json +6 -2
  38. package/dist/detection/coverage.d.ts +0 -43
  39. package/dist/detection/coverage.d.ts.map +0 -1
  40. package/dist/detection/coverage.js +0 -60
  41. package/dist/detection/coverage.js.map +0 -1
  42. package/dist/detection/suspicion.d.ts.map +0 -1
  43. package/dist/detection/suspicion.js.map +0 -1
package/PURPOSE.md CHANGED
@@ -20,8 +20,9 @@ its cutover.
20
20
 
21
21
  1. **The SDK owns portable live contracts, not a machine.** Entity-record
22
22
  shapes, resource identifiers, content manifests, checksums, frame shapes,
23
- mutation envelopes, and ordering rules belong here; paths, inodes,
24
- watchers, services, and local database files do not.
23
+ mutation envelopes, ordering rules, and portable Watch laws belong here;
24
+ paths, inodes, OS watcher handles, services, and local database files do
25
+ not.
25
26
  2. **A host supplies its own effects.** The SDK receives transport, durable
26
27
  journal, content-store, clock, and cryptography adapters. It never reaches
27
28
  into Node globals, user homes, or a product-specific HTTP server to find
@@ -91,15 +92,18 @@ its cutover.
91
92
  20. **Materialization is local and selective.** Login installs the core graph;
92
93
  `files add <workspace>` installs one owned workspace root. The local SQLite
93
94
  table contains rows only for roots materialized on that machine, while
94
- cloud reconciliation preserves every unmaterialized root.
95
- 21. **A Git marker classifies its containing directory.** An externally
96
- registered root with valid `.git` evidence is `repo.git`, as is any nested
97
- directory with that evidence; the UUID does not change when the type does.
98
- `.git` itself is repository transport metadata and never receives an
99
- entity row. Worktree children retain local UUID rows, while their
100
- identities ride in the repository state manifest rather than becoming
101
- individual cloud records. A shallow repository carries its declared Git
102
- history boundary, so a new machine never invents history beyond it.
95
+ cloud reconciliation preserves every unmaterialized root. A newly installed
96
+ and verified graph is the initial Watch baseline for that root; opening
97
+ coverage must not reinterpret the downloader's own writes as user edits.
98
+ 21. **A Git marker classifies its containing directory.** The presence of a
99
+ `.git` directory or file makes its containing directory `repo.git`; its
100
+ removal returns that same UUID to `workspace` or `folder`. Git command
101
+ availability governs Card + Checkpoint capture, never classification, and
102
+ `.git` itself is repository transport metadata that receives no entity
103
+ row. Worktree children retain local UUID rows, while their identities ride
104
+ in the repository state manifest rather than becoming individual cloud
105
+ records. A shallow repository carries its declared Git history boundary,
106
+ so a new machine never invents history beyond it.
103
107
  22. **Transfer moves content; it never discovers state.** `upload` moves one
104
108
  already-registered immutable artifact toward cloud storage and `download`
105
109
  moves that same artifact toward a machine cache. Neither operation scans,
@@ -154,6 +158,10 @@ its cutover.
154
158
  content-addressed block identities, while cold upload and download move
155
159
  adjacent missing blocks in bounded binary batches. Batching may reduce
156
160
  transport work but can never weaken per-block verification or commit order.
161
+ 32. **A content layout owns a cloud namespace.** A writer change that derives
162
+ different block identities for the same complete bytes advances the
163
+ content contract and storage namespace together. Readers remain additive;
164
+ an immutable manifest is never reinterpreted or overwritten in place.
157
165
 
158
166
  ## Five surfaces, one behavior
159
167
 
@@ -181,10 +189,11 @@ src/machines/ transport-neutral state machines: sequence ordering + gap
181
189
  src/entities/ the entity model's rule surface: the six-field record,
182
190
  derived versions, lifecycle laws, move planning, the
183
191
  cloud and repo-state codecs — behind injected ports.
184
- src/detection/ the Detect/Watch pure cores: the adapter contract, the
185
- three-channel compare (diff) core, coverage, continuity
186
- verdicts, suspicion scope, classification, refusals,
187
- enrollment policy.
192
+ src/watching/ the Watch pure cores: minimal coverage ownership and
193
+ generation-safe suspicion.
194
+ src/detection/ the Detect pure cores: the adapter contract, three-channel
195
+ compare (diff), continuity verdicts, classification,
196
+ refusals, and enrollment policy.
188
197
  src/registration/ the login-time user-ground convergence operation and its
189
198
  injected local/cloud effect ports.
190
199
  src/transfer/ type-aware immutable artifact upload/download operations;
package/README.md CHANGED
@@ -23,6 +23,7 @@ normative specifications live in [docs/](docs/):
23
23
  | [shared-realtime-wave-3.md](docs/shared-realtime-wave-3.md) | the multi-user cloud-authority design |
24
24
  | [extraction-boundary.md](docs/extraction-boundary.md) | what moves here from the engine runtime, and in what order |
25
25
  | [user-ground-login.md](docs/user-ground-login.md) | first-login publication, later-device materialization, and Watch readiness |
26
+ | [watching.md](docs/watching.md) | Watch purpose, axioms, lifecycle matrix, and cross-platform test layers |
26
27
 
27
28
  ## Surfaces
28
29
 
@@ -10,7 +10,12 @@
10
10
  * host effects; this file owns the shape and its laws.
11
11
  */
12
12
  import { type Checked } from './validate.js';
13
- export declare const CONTENT_CONTRACT = "amalgm-entity-content@2";
13
+ /** Version 3 changes only the canonical writer layout: ordinary files begin
14
+ * at Dropbox's stable 4 MiB block size. Version 2 remains readable because
15
+ * immutable cloud heads created by an older writer must still materialize. */
16
+ export declare const LEGACY_CONTENT_CONTRACT = "amalgm-entity-content@2";
17
+ export declare const CONTENT_CONTRACT = "amalgm-entity-content@3";
18
+ export type ContentContract = typeof CONTENT_CONTRACT | typeof LEGACY_CONTENT_CONTRACT;
14
19
  export declare const MIN_CONTENT_BLOCK_BYTES: number;
15
20
  export declare const MAX_CONTENT_BLOCK_BYTES: number;
16
21
  /** Maximum accepted block size. Kept as the public manifest-bound name. */
@@ -21,7 +26,7 @@ export interface ContentChunk {
21
26
  readonly bytes: number;
22
27
  }
23
28
  export interface ContentManifest {
24
- readonly contract: typeof CONTENT_CONTRACT;
29
+ readonly contract: ContentContract;
25
30
  readonly contentHash: string;
26
31
  readonly bytes: number;
27
32
  readonly chunks: readonly ContentChunk[];
@@ -39,8 +44,8 @@ export declare function checkContentManifest(input: unknown, expectedHash?: stri
39
44
  * hand-built manifest cannot drift from the derivation rule.
40
45
  */
41
46
  export declare function manifestFromChunks(contentHash: string, chunks: readonly ContentChunk[]): Checked<ContentManifest>;
42
- /** Syncthing's adaptive fixed-block rule: the smallest power of two that
43
- * keeps the manifest at no more than 2,000 blocks, capped at 16 MiB. */
47
+ /** Dropbox-sized cold blocks, widened by Syncthing's adaptive rule only when
48
+ * needed to keep a manifest below 2,000 blocks, capped at 16 MiB. */
44
49
  export declare function contentBlockSize(totalBytes: number): number;
45
50
  /** Split a byte count into adaptive full blocks, then the remainder. */
46
51
  export declare function chunkSizes(totalBytes: number): number[];
@@ -1 +1 @@
1
- {"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../src/contracts/content.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,KAAK,OA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;AACjE,eAAO,MAAM,gBAAgB,4BAA4B,CAAC;AAC1D,MAAM,MAAM,eAAe,GAAG,OAAO,gBAAgB,GAAG,OAAO,uBAAuB,CAAC;AAEvF,eAAO,MAAM,uBAAuB,QAAkB,CAAC;AACvD,eAAO,MAAM,uBAAuB,QAAmB,CAAC;AACxD,2EAA2E;AAC3E,eAAO,MAAM,WAAW,QAA0B,CAAC;AACnD,eAAO,MAAM,kBAAkB,OAAQ,CAAC;AAIxC,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,SAAS,YAAY,EAAE,CAAC;CAC1C;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,YAAY,GAAE,MAAM,GAAG,IAAW,GAAG,OAAO,CAAC,eAAe,CAAC,CAoCjH;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,SAAS,YAAY,EAAE,GAC9B,OAAO,CAAC,eAAe,CAAC,CAK1B;AAED;qEACqE;AACrE,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAO3D;AAED,wEAAwE;AACxE,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAQvD"}
@@ -10,8 +10,12 @@
10
10
  * host effects; this file owns the shape and its laws.
11
11
  */
12
12
  import { pass, fail, isRecord } from './validate.js';
13
- export const CONTENT_CONTRACT = 'amalgm-entity-content@2';
14
- export const MIN_CONTENT_BLOCK_BYTES = 128 * 1024;
13
+ /** Version 3 changes only the canonical writer layout: ordinary files begin
14
+ * at Dropbox's stable 4 MiB block size. Version 2 remains readable because
15
+ * immutable cloud heads created by an older writer must still materialize. */
16
+ export const LEGACY_CONTENT_CONTRACT = 'amalgm-entity-content@2';
17
+ export const CONTENT_CONTRACT = 'amalgm-entity-content@3';
18
+ export const MIN_CONTENT_BLOCK_BYTES = 4 * 1024 * 1024;
15
19
  export const MAX_CONTENT_BLOCK_BYTES = 16 * 1024 * 1024;
16
20
  /** Maximum accepted block size. Kept as the public manifest-bound name. */
17
21
  export const CHUNK_BYTES = MAX_CONTENT_BLOCK_BYTES;
@@ -25,6 +29,7 @@ const HASH = /^[0-9a-f]{64}$/;
25
29
  */
26
30
  export function checkContentManifest(input, expectedHash = null) {
27
31
  if (!isRecord(input) ||
32
+ (input.contract !== CONTENT_CONTRACT && input.contract !== LEGACY_CONTENT_CONTRACT) ||
28
33
  typeof input.contentHash !== 'string' ||
29
34
  !HASH.test(input.contentHash) ||
30
35
  (expectedHash !== null && input.contentHash !== expectedHash) ||
@@ -48,7 +53,7 @@ export function checkContentManifest(input, expectedHash = null) {
48
53
  return fail('empty entity content must have no chunks');
49
54
  }
50
55
  return pass({
51
- contract: CONTENT_CONTRACT,
56
+ contract: input.contract,
52
57
  contentHash: input.contentHash,
53
58
  bytes,
54
59
  chunks: chunks.map((chunk) => ({ sha256: chunk.sha256, bytes: chunk.bytes })),
@@ -62,8 +67,8 @@ export function checkContentManifest(input, expectedHash = null) {
62
67
  export function manifestFromChunks(contentHash, chunks) {
63
68
  return checkContentManifest({ contract: CONTENT_CONTRACT, contentHash, bytes: chunks.reduce((t, c) => t + c.bytes, 0), chunks }, contentHash);
64
69
  }
65
- /** Syncthing's adaptive fixed-block rule: the smallest power of two that
66
- * keeps the manifest at no more than 2,000 blocks, capped at 16 MiB. */
70
+ /** Dropbox-sized cold blocks, widened by Syncthing's adaptive rule only when
71
+ * needed to keep a manifest below 2,000 blocks, capped at 16 MiB. */
67
72
  export function contentBlockSize(totalBytes) {
68
73
  if (!Number.isSafeInteger(totalBytes) || totalBytes < 0)
69
74
  return MIN_CONTENT_BLOCK_BYTES;
@@ -1 +1 @@
1
- {"version":3,"file":"content.js","sourceRoot":"","sources":["../../src/contracts/content.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAgB,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEnE,MAAM,CAAC,MAAM,gBAAgB,GAAG,yBAAyB,CAAC;AAE1D,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,GAAG,IAAI,CAAC;AAClD,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AACxD,2EAA2E;AAC3E,MAAM,CAAC,MAAM,WAAW,GAAG,uBAAuB,CAAC;AACnD,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC;AAExC,MAAM,IAAI,GAAG,gBAAgB,CAAC;AAc9B;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,KAAc,EAAE,eAA8B,IAAI;IACrF,IACE,CAAC,QAAQ,CAAC,KAAK,CAAC;QAChB,OAAO,KAAK,CAAC,WAAW,KAAK,QAAQ;QACrC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;QAC7B,CAAC,YAAY,KAAK,IAAI,IAAI,KAAK,CAAC,WAAW,KAAK,YAAY,CAAC;QAC7D,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,KAAK,CAAC;QACjC,KAAK,CAAC,KAAgB,GAAG,CAAC;QAC3B,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC;QAC5B,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,kBAAkB;QACxC,KAAK,CAAC,MAAM,CAAC,IAAI,CACf,CAAC,KAAK,EAAE,EAAE,CACR,CAAC,QAAQ,CAAC,KAAK,CAAC;YAChB,C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,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,IAAI,UAAU,GAAG,CAAC;QAAE,OAAO,uBAAuB,CAAC;IACxF,IAAI,KAAK,GAAG,uBAAuB,CAAC;IACpC,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,GAAG,kBAAkB,IAAI,KAAK,GAAG,uBAAuB,EAAE,CAAC;QAC7F,KAAK,IAAI,CAAC,CAAC;IACb,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,UAAU,CAAC,UAAkB;IAC3C,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,IAAI,UAAU,GAAG,CAAC;QAAE,OAAO,EAAE,CAAC;IACnE,MAAM,UAAU,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAAC;IAChD,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,IAAI,SAAS,GAAG,UAAU,EAAE,SAAS,GAAG,CAAC,EAAE,SAAS,IAAI,UAAU,EAAE,CAAC;QACxE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -30,9 +30,9 @@ export interface ClassifyEvidence {
30
30
  readonly binary: boolean;
31
31
  }
32
32
  export declare function classifyFile({ binary }: ClassifyEvidence): FileType;
33
- /** Git truth belongs to the directory that contains it. The host proves the
34
- * marker (including linked-worktree `.git` files); this pure policy names the
35
- * entity type and never opens a path or invokes Git itself. */
33
+ /** Git truth belongs to the directory that contains its marker. The host
34
+ * reports marker presence (including linked-worktree `.git` files); Git
35
+ * command health is transfer evidence, never classification evidence. */
36
36
  export interface RepositoryEvidence {
37
37
  readonly repository: boolean;
38
38
  }
@@ -41,7 +41,7 @@ export declare function classifyDirectory({ repository }: RepositoryEvidence): D
41
41
  * root wears `repo.git`; an ordinary root wears `workspace`. */
42
42
  export declare function classifyRegisteredRoot({ repository }: RepositoryEvidence): RegisteredRootType;
43
43
  /** `.git` is cargo of a repository entity, never one of its worktree
44
- * children. A stale or invalid marker under ordinary folder ground is not
45
- * hidden by this rule; the host's repository evidence decides the boundary. */
44
+ * children. Marker presence makes the parent a repository before this rule is
45
+ * asked, regardless of whether Git can currently consume that marker. */
46
46
  export declare function isRepositoryMetadataEntry(parentType: DirectoryType | RegisteredRootType, name: string): boolean;
47
47
  //# sourceMappingURL=classify.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"classify.d.ts","sourceRoot":"","sources":["../../src/detection/classify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,MAAM,QAAQ,GAAG,aAAa,GAAG,WAAW,CAAC;AACnD,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,UAAU,CAAC;AAClD,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,UAAU,CAAC;AAE1D,iFAAiF;AACjF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,EAAE,gBAAgB,GAAG,QAAQ,CAEnE;AAED;;+DAE+D;AAC/D,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;CAC9B;AAED,wBAAgB,iBAAiB,CAAC,EAAE,UAAU,EAAE,EAAE,kBAAkB,GAAG,aAAa,CAEnF;AAED;gEACgE;AAChE,wBAAgB,sBAAsB,CAAC,EAAE,UAAU,EAAE,EAAE,kBAAkB,GAAG,kBAAkB,CAE7F;AAED;;+EAE+E;AAC/E,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,aAAa,GAAG,kBAAkB,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAE/G"}
1
+ {"version":3,"file":"classify.d.ts","sourceRoot":"","sources":["../../src/detection/classify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,MAAM,QAAQ,GAAG,aAAa,GAAG,WAAW,CAAC;AACnD,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,UAAU,CAAC;AAClD,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,UAAU,CAAC;AAE1D,iFAAiF;AACjF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,EAAE,gBAAgB,GAAG,QAAQ,CAEnE;AAED;;yEAEyE;AACzE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;CAC9B;AAED,wBAAgB,iBAAiB,CAAC,EAAE,UAAU,EAAE,EAAE,kBAAkB,GAAG,aAAa,CAEnF;AAED;gEACgE;AAChE,wBAAgB,sBAAsB,CAAC,EAAE,UAAU,EAAE,EAAE,kBAAkB,GAAG,kBAAkB,CAE7F;AAED;;yEAEyE;AACzE,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,aAAa,GAAG,kBAAkB,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAE/G"}
@@ -34,8 +34,8 @@ export function classifyRegisteredRoot({ repository }) {
34
34
  return repository ? 'repo.git' : 'workspace';
35
35
  }
36
36
  /** `.git` is cargo of a repository entity, never one of its worktree
37
- * children. A stale or invalid marker under ordinary folder ground is not
38
- * hidden by this rule; the host's repository evidence decides the boundary. */
37
+ * children. Marker presence makes the parent a repository before this rule is
38
+ * asked, regardless of whether Git can currently consume that marker. */
39
39
  export function isRepositoryMetadataEntry(parentType, name) {
40
40
  return parentType === 'repo.git' && name === '.git';
41
41
  }
@@ -1 +1 @@
1
- {"version":3,"file":"classify.js","sourceRoot":"","sources":["../../src/detection/classify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;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,CAAC"}
@@ -13,7 +13,7 @@
13
13
  * wiring, because they re-aim watchers and scans.
14
14
  */
15
15
  import type { PhysicalIdentity } from './diff.js';
16
- import type { RootKind } from './coverage.js';
16
+ import type { RootKind } from '../watching/coverage.js';
17
17
  /** What one look at an address found standing there. */
18
18
  export type GroundKind = 'file' | 'dir' | 'link' | 'other';
19
19
  export interface GroundStat extends PhysicalIdentity {
@@ -1 +1 @@
1
- {"version":3,"file":"continuity.d.ts","sourceRoot":"","sources":["../../src/detection/continuity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,wDAAwD;AACxD,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC;AAE3D,MAAM,WAAW,UAAW,SAAQ,gBAAgB;IAClD,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;CAC3B;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,wFAAwF;IACxF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,MAAM,WAAW,eAAe;IAC9B;;;;;;OAMG;IACH,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,UAAU,GAAG,IAAI,CAAC;IACrD;;;;;;OAMG;IACH,QAAQ,CAAC,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,gBAAgB,GAAG,IAAI,CAAC;CACvE;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ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AC,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,gBAAgB,GAAG,IAAI,CAAC;CACvE;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,YAAY,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,gBAAgB,GAAG,IAAI,CAAC;IACzE,QAAQ,CAAC,aAAa,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,SAAS,cAAc,EAAE,KAAK,cAAc,GAAG,IAAI,CAAC;IACtG,QAAQ,CAAC,gBAAgB,EAAE,CAAC,IAAI,EAAE,cAAc,KAAK,OAAO,CAAC;CAC9D;AAED,wBAAgB,gBAAgB,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,EAAE,eAAe,GAAG,kBAAkB,CAmEjG"}
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Detection — the pure cores of the Watch/Detect rails, ported from the
3
- * engine's observer and registration boundary. Normative sources:
2
+ * Detection — the pure cores that turn observed disk evidence into facts.
3
+ * Normative sources:
4
4
  * entity-model.md (identity axioms, the two continuity witnesses) and
5
5
  * entity-implementation.md (the ratified seams).
6
6
  *
@@ -16,15 +16,12 @@
16
16
  * - `refusal` declined-vs-broken, named where it is raised
17
17
  * - `enrollment` the default manual enrollment policy
18
18
  * - `diff` the compare functions: file/dir/link identity
19
- * - `coverage` one OS watcher per outermost tree
20
19
  * - `continuity` root rescue and the undecided address
21
20
  */
22
21
  export * from './adapter-contract.js';
23
22
  export * from './classify.js';
24
23
  export * from './continuity.js';
25
- export * from './coverage.js';
26
24
  export * from './diff.js';
27
25
  export * from './enrollment.js';
28
26
  export * from './refusal.js';
29
- export * from './suspicion.js';
30
27
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/detection/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/detection/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC"}
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Detection — the pure cores of the Watch/Detect rails, ported from the
3
- * engine's observer and registration boundary. Normative sources:
2
+ * Detection — the pure cores that turn observed disk evidence into facts.
3
+ * Normative sources:
4
4
  * entity-model.md (identity axioms, the two continuity witnesses) and
5
5
  * entity-implementation.md (the ratified seams).
6
6
  *
@@ -16,15 +16,12 @@
16
16
  * - `refusal` declined-vs-broken, named where it is raised
17
17
  * - `enrollment` the default manual enrollment policy
18
18
  * - `diff` the compare functions: file/dir/link identity
19
- * - `coverage` one OS watcher per outermost tree
20
19
  * - `continuity` root rescue and the undecided address
21
20
  */
22
21
  export * from './adapter-contract.js';
23
22
  export * from './classify.js';
24
23
  export * from './continuity.js';
25
- export * from './coverage.js';
26
24
  export * from './diff.js';
27
25
  export * from './enrollment.js';
28
26
  export * from './refusal.js';
29
- export * from './suspicion.js';
30
27
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/detection/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/detection/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC"}
@@ -50,7 +50,12 @@ export interface FilesAddPorts {
50
50
  readonly records: readonly CloudEntityRecord[];
51
51
  readonly alreadyMaterialized: boolean;
52
52
  }>;
53
- coverWorkspace(workspaceId: string): Promise<{
53
+ coverWorkspace(input: {
54
+ readonly workspaceId: string;
55
+ /** The host may adopt this exact graph as Watch's initial baseline only
56
+ * when this add invocation just materialized and verified it. */
57
+ readonly baseline: 'authoritative-install' | 'existing';
58
+ }): Promise<{
54
59
  readonly active: boolean;
55
60
  readonly roots: number;
56
61
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/files/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,iBAAiB,EACvB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEtE,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,2EAA2E;IAC3E,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC;AAED,MAAM,WAAW,kBAAkB;IACjC,8EAA8E;IAC9E,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;IAC7E,QAAQ,CAAC,UAAU,EAAE,MAAM,MAAM,CAA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wBAAgB,cAAc,CAC5B,OAAO,EAAE,SAAS,iBAAiB,EAAE,EACrC,WAAW,EAAE,MAAM,GAClB;IAAE,QAAQ,CAAC,SAAS,EAAE,iBAAiB,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,iBAAiB,EAAE,CAAA;CAAE,CAyB3F;AAED,gFAAgF;AAChF,wBAAsB,iBAAiB,CACrC,WAAW,EAAE,MAAM,EACnB,iBAAiB,EAAE,MAAM,EACzB,KAAK,EAAE,aAAa,GACnB,OAAO,CAAC,cAAc,CAAC,CAiCzB"}
@@ -83,7 +83,10 @@ export async function addFilesWorkspace(workspaceId, destinationParent, ports) {
83
83
  || !sameRecords(travelingRecords(installedRecords), selected.records)) {
84
84
  throw new Error('workspace materialization did not persist exactly the selected graph');
85
85
  }
86
- const coverage = await ports.coverWorkspace(normalizedId);
86
+ const coverage = await ports.coverWorkspace({
87
+ workspaceId: normalizedId,
88
+ baseline: installed.alreadyMaterialized === true ? 'existing' : 'authoritative-install',
89
+ });
87
90
  if (coverage.active !== true || !Number.isSafeInteger(coverage.roots) || coverage.roots < 1) {
88
91
  throw new Error('workspace watcher coverage is not active');
89
92
  }
@@ -1 +1 @@
1
- {"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/files/commands.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,gBAAgB,GAEjB,MAAM,sBAAsB,CAAC;AAoC9B,SAAS,IAAI,CAAC,KAAc,EAAE,KAAa;IACzC,MAAM,UAAU,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC/E,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,iBAAiB,CAAC,CAAC;IAC/E,OAAO,UAAU,CAAC;AACpB,C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AAC;IACH,IAAI,QAAQ,CAAC,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC;QAC5F,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IACD,OAAO;QACL,WAAW,EAAE,YAAY;QACzB,aAAa,EAAE,QAAQ,CAAC,SAAS,CAAC,IAAI;QACtC,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,6BAA6B,CAAC;QAC7D,IAAI,EAAE,SAAS,CAAC,IAAI;QACpB,SAAS,EAAE,KAAK,CAAC,QAAQ;QACzB,YAAY,EAAE,IAAI;QAClB,mBAAmB,EAAE,SAAS,CAAC,mBAAmB,KAAK,IAAI;QAC3D,YAAY,EAAE,QAAQ,CAAC,KAAK;KAC7B,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -12,6 +12,7 @@
12
12
  export * from './contracts/index.js';
13
13
  export * from './machines/index.js';
14
14
  export * from './entities/index.js';
15
+ export * from './watching/index.js';
15
16
  export * from './detection/index.js';
16
17
  export * from './registration/index.js';
17
18
  export * from './files/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
package/dist/index.js CHANGED
@@ -12,6 +12,7 @@
12
12
  export * from './contracts/index.js';
13
13
  export * from './machines/index.js';
14
14
  export * from './entities/index.js';
15
+ export * from './watching/index.js';
15
16
  export * from './detection/index.js';
16
17
  export * from './registration/index.js';
17
18
  export * from './files/index.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * The coverage law: one OS watcher per outermost tree.
3
+ *
4
+ * A recursive watcher on a directory hears events beneath it at every depth,
5
+ * so a root enclosed by watched ground already has content coverage. Opening
6
+ * another recursive watcher over enclosed ground adds no information and, on
7
+ * Linux, pays for the same inotify ground again.
8
+ *
9
+ * These are pure decisions over canonical root paths. The host owns opening,
10
+ * sharing, and closing physical handles.
11
+ */
12
+ /** The three root kinds; only a single file moves its doorbell to its parent. */
13
+ export type RootKind = 'file' | 'files' | 'repo';
14
+ export interface WatchRoot {
15
+ readonly rootId: string;
16
+ /** Canonical absolute path using `/` separators and no trailing separator. */
17
+ readonly path: string;
18
+ readonly kind: RootKind;
19
+ }
20
+ /**
21
+ * Directory roots guard themselves. A single-file root rings through its
22
+ * parent because watching a file inode goes deaf when an atomic save replaces
23
+ * that inode.
24
+ */
25
+ export declare function doorbellGround(root: WatchRoot): string;
26
+ /**
27
+ * Return the outermost directory root whose recursive handle covers `root`,
28
+ * or null when `root` owns its physical coverage.
29
+ */
30
+ export declare function watchOwnerOf(root: WatchRoot, roots: readonly WatchRoot[]): WatchRoot | null;
31
+ /** Every logical root routed through an owner's physical handle. */
32
+ export declare function coveredRoots(owner: WatchRoot, roots: readonly WatchRoot[]): WatchRoot[];
33
+ //# sourceMappingURL=coverage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coverage.d.ts","sourceRoot":"","sources":["../../src/watching/coverage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,iFAAiF;AACjF,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAEjD,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,8EAA8E;IAC9E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;CACzB;AASD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAEtD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,SAAS,EAAE,GAAG,SAAS,GAAG,IAAI,CAS3F;AAED,oEAAoE;AACpE,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,SAAS,EAAE,GAAG,SAAS,EAAE,CAGvF"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * The coverage law: one OS watcher per outermost tree.
3
+ *
4
+ * A recursive watcher on a directory hears events beneath it at every depth,
5
+ * so a root enclosed by watched ground already has content coverage. Opening
6
+ * another recursive watcher over enclosed ground adds no information and, on
7
+ * Linux, pays for the same inotify ground again.
8
+ *
9
+ * These are pure decisions over canonical root paths. The host owns opening,
10
+ * sharing, and closing physical handles.
11
+ */
12
+ /** '/a/b' → '/a'; '/a' → '/'; a bare name → '.'. */
13
+ const parentDirOf = (path) => {
14
+ const cut = path.lastIndexOf('/');
15
+ if (cut < 0)
16
+ return '.';
17
+ return cut === 0 ? '/' : path.slice(0, cut);
18
+ };
19
+ /**
20
+ * Directory roots guard themselves. A single-file root rings through its
21
+ * parent because watching a file inode goes deaf when an atomic save replaces
22
+ * that inode.
23
+ */
24
+ export function doorbellGround(root) {
25
+ return root.kind === 'file' ? parentDirOf(root.path) : root.path;
26
+ }
27
+ /**
28
+ * Return the outermost directory root whose recursive handle covers `root`,
29
+ * or null when `root` owns its physical coverage.
30
+ */
31
+ export function watchOwnerOf(root, roots) {
32
+ const ground = doorbellGround(root);
33
+ let owner = null;
34
+ for (const other of roots) {
35
+ if (other.rootId === root.rootId || other.kind === 'file')
36
+ continue;
37
+ if (ground !== other.path && !ground.startsWith(`${other.path}/`))
38
+ continue;
39
+ if (!owner || other.path.length < owner.path.length)
40
+ owner = other;
41
+ }
42
+ return owner;
43
+ }
44
+ /** Every logical root routed through an owner's physical handle. */
45
+ export function coveredRoots(owner, roots) {
46
+ return roots.filter((root) => root.rootId !== owner.rootId
47
+ && watchOwnerOf(root, roots)?.rootId === owner.rootId);
48
+ }
49
+ //# sourceMappingUR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AO,KAAK,CAAC;AACf,CAAC;AAED,oEAAoE;AACpE,MAAM,UAAU,YAAY,CAAC,KAAgB,EAAE,KAA2B;IACxE,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM;WACrD,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,KAAK,CAAC,MAAM,CAAC,CAAC;AAC3D,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Watching — portable laws for minimal filesystem notification coverage and
3
+ * durable suspicion. OS handles belong to the host; Detect begins only after
4
+ * these modules have said where disk truth must be reread.
5
+ */
6
+ export * from './coverage.js';
7
+ export * from './suspicion.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/watching/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Watching — portable laws for minimal filesystem notification coverage and
3
+ * durable suspicion. OS handles belong to the host; Detect begins only after
4
+ * these modules have said where disk truth must be reread.
5
+ */
6
+ export * from './coverage.js';
7
+ export * from './suspicion.js';
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/watching/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
@@ -1,21 +1,19 @@
1
1
  /**
2
- * The portable Watch suspicion scope.
3
- *
4
- * A filesystem event is only a doorbell: its path says where truth must be
5
- * reread, never what happened there. Named suspicion stays live until one
6
- * settled observation proves it. Generation stamps prevent an observation
2
+ * A filesystem notification is only a doorbell: its path says where truth
3
+ * must be reread, never what happened there. Named suspicion stays live until
4
+ * one settled observation proves it. Generation stamps prevent an observation
7
5
  * from consuming a second ring that arrived while it was reading.
8
6
  */
9
7
  export interface SuspicionSnapshot {
10
8
  /** The latest ring this observation is allowed to consume. */
11
9
  readonly generation: number;
12
- /** null means the complete covered root; otherwise these paths and their descendants. */
10
+ /** null means the complete covered root; otherwise these paths and descendants. */
13
11
  readonly paths: readonly string[] | null;
14
12
  }
15
13
  export interface SuspicionScope {
16
14
  /** Add one OS path hint. null means the OS could not name a path. */
17
15
  ring(path: string | null): void;
18
- /** Startup, catch-up, watcher death, and explicit flush cannot trust prior silence. */
16
+ /** Startup, catch-up, watcher death, and explicit flush cannot trust silence. */
19
17
  suspectAll(): void;
20
18
  /** Freeze the suspicion one observation will prove. */
21
19
  snapshot(): SuspicionSnapshot;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suspicion.d.ts","sourceRoot":"","sources":["../../src/watching/suspicion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,iBAAiB;IAChC,8DAA8D;IAC9D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,mFAAmF;IACnF,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAC;CAC1C;AAED,MAAM,WAAW,cAAc;IAC7B,qEAAqE;IACrE,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IAChC,iFAAiF;IACjF,UAAU,IAAI,IAAI,CAAC;IACnB,uDAAuD;IACvD,QAAQ,IAAI,iBAAiB,CAAC;IAC9B,iEAAiE;IACjE,MAAM,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAQD,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,GAAG,OAAO,CAGvF;AAED,wBAAgB,oBAAoB,CAAC,GAAG,SAAM,GAAG,cAAc,CAmD9D"}
@@ -1,17 +1,15 @@
1
1
  /**
2
- * The portable Watch suspicion scope.
3
- *
4
- * A filesystem event is only a doorbell: its path says where truth must be
5
- * reread, never what happened there. Named suspicion stays live until one
6
- * settled observation proves it. Generation stamps prevent an observation
2
+ * A filesystem notification is only a doorbell: its path says where truth
3
+ * must be reread, never what happened there. Named suspicion stays live until
4
+ * one settled observation proves it. Generation stamps prevent an observation
7
5
  * from consuming a second ring that arrived while it was reading.
8
6
  */
9
7
  const normalizeHint = (path) => {
10
- const normalized = path.replaceAll('\\', '/').replace(/^\.\//, '').replace(/\/+$/, '');
11
- if (!normalized || normalized.startsWith('/')
12
- || normalized.split('/').some((segment) => segment === '..'))
8
+ if (!path || path.startsWith('/') || path.includes('\0'))
13
9
  return null;
14
- return normalized;
10
+ if (path.split('/').some((segment) => !segment || segment === '.' || segment === '..'))
11
+ return null;
12
+ return path;
15
13
  };
16
14
  /** A named directory suspects every descendant. Exact files suspect themselves. */
17
15
  export function pathIsSuspect(path, suspects) {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suspicion.js","sourceRoot":"","sources":["../../src/watching/suspicion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAqBH,MAAM,aAAa,GAAG,CAAC,IAAY,EAAiB,EAAE;IACpD,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACtE,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,IAAI,OAAO,KAAK,GAAG,IAAI,OAAO,KAAK,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACpG,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF,mFAAmF;AACnF,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,QAA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ACN,OAAO;gBACL,UAAU;gBACV,KAAK,EAAE,aAAa,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE;aAC3D,CAAC;QACJ,CAAC;QACD,MAAM,CAAC,QAAQ;YACb,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,QAAQ,CAAC,UAAU,CAAC;mBACzC,QAAQ,CAAC,UAAU,GAAG,CAAC,IAAI,QAAQ,CAAC,UAAU,GAAG,UAAU,EAAE,CAAC;gBACjE,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;YAC9D,CAAC;YACD,IAAI,aAAa,GAAG,CAAC,IAAI,aAAa,IAAI,QAAQ,CAAC,UAAU;gBAAE,aAAa,GAAG,CAAC,CAAC;YACjF,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,KAAK,EAAE,CAAC;gBACnC,IAAI,MAAM,IAAI,QAAQ,CAAC,UAAU;oBAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YACxD,CAAC;QACH,CAAC;QACD,IAAI,IAAI;YACN,OAAO,aAAa,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;QACnE,CAAC;KACF,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amalgm/live",
3
- "version": "0.2.17",
3
+ "version": "0.2.19",
4
4
  "description": "Portable realtime SDK for Amalgm — wire contracts, mutation discipline, and delivery state machines behind host-injected adapters.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",
@@ -36,6 +36,10 @@
36
36
  "types": "./dist/registration/index.d.ts",
37
37
  "default": "./dist/registration/index.js"
38
38
  },
39
+ "./watching": {
40
+ "types": "./dist/watching/index.d.ts",
41
+ "default": "./dist/watching/index.js"
42
+ },
39
43
  "./files": {
40
44
  "types": "./dist/files/index.d.ts",
41
45
  "default": "./dist/files/index.js"
@@ -53,7 +57,7 @@
53
57
  "node": ">=18"
54
58
  },
55
59
  "scripts": {
56
- "build": "tsc -p tsconfig.json",
60
+ "build": "node --input-type=module -e \"import { rmSync } from 'node:fs'; rmSync('dist', { recursive: true, force: true })\" && tsc -p tsconfig.json",
57
61
  "test": "npm run build && node --test tests/",
58
62
  "test:parity": "npm run build && node --test tests/parity/",
59
63
  "test:conformance": "npm run build && node --test tests/conformance/"
@@ -1,43 +0,0 @@
1
- /**
2
- * The coverage law: one OS watcher per outermost tree. Ratified by
3
- * entity-model.md (enclosed-ground coverage) and
4
- * entity-implementation.md (the doorbell matrix).
5
- *
6
- * A recursive watcher on a directory hears every event beneath it, at
7
- * any depth — so a root enclosed by watched ground already has its
8
- * content observed, exactly as its ADDRESS is already observed. Opening
9
- * a second watcher over enclosed ground buys nothing on any platform
10
- * and, on Linux — where a recursive watch is silently one inotify slot
11
- * PER DIRECTORY against a small kernel budget — exhausts the kernel.
12
- * Doorbells are shared; what a root DOES with its dings (files
13
- * channels, repo Card+Checkpoint) stays its own type's business.
14
- *
15
- * Pure functions over root rows — no handles, no state. The host owns
16
- * opening and closing; this module only answers "who guards whom".
17
- * Addresses are absolute '/'-separated paths with no trailing
18
- * separator, as the enrollment boundary records them.
19
- */
20
- /** The three root kinds; only 'file' changes a doorbell's ground. */
21
- export type RootKind = 'file' | 'files' | 'repo';
22
- export interface WatchRoot {
23
- readonly rootId: string;
24
- readonly path: string;
25
- readonly kind: RootKind;
26
- }
27
- /**
28
- * The ground a root's doorbell must cover: a directory root guards
29
- * itself; a single-file root's bell lives on its parent directory (the
30
- * file's own inode goes deaf on atomic saves).
31
- */
32
- export declare function doorbellGround(root: WatchRoot): string;
33
- /**
34
- * The root whose OS watcher covers `root`'s doorbell ground, or null
35
- * when `root` guards itself. The OUTERMOST enclosing directory root
36
- * wins: with A ⊃ B ⊃ C only A holds a handle, and every deeper root —
37
- * B, C, nested repos, single files — rides it. A file root can never
38
- * cover anything.
39
- */
40
- export declare function watchOwnerOf(root: WatchRoot, roots: readonly WatchRoot[]): WatchRoot | null;
41
- /** Every live root covered by `owner` (owner excluded). */
42
- export declare function coveredRoots(owner: WatchRoot, roots: readonly WatchRoot[]): WatchRoot[];
43
- //# sourceMappingURL=coverage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"coverage.d.ts","sourceRoot":"","sources":["../../src/detection/coverage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,qEAAqE;AACrE,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAEjD,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;CACzB;AASD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAEtD;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,SAAS,EAAE,GAAG,SAAS,GAAG,IAAI,CAS3F;AAED,2DAA2D;AAC3D,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,SAAS,EAAE,GAAG,SAAS,EAAE,CAGvF"}
@@ -1,60 +0,0 @@
1
- /**
2
- * The coverage law: one OS watcher per outermost tree. Ratified by
3
- * entity-model.md (enclosed-ground coverage) and
4
- * entity-implementation.md (the doorbell matrix).
5
- *
6
- * A recursive watcher on a directory hears every event beneath it, at
7
- * any depth — so a root enclosed by watched ground already has its
8
- * content observed, exactly as its ADDRESS is already observed. Opening
9
- * a second watcher over enclosed ground buys nothing on any platform
10
- * and, on Linux — where a recursive watch is silently one inotify slot
11
- * PER DIRECTORY against a small kernel budget — exhausts the kernel.
12
- * Doorbells are shared; what a root DOES with its dings (files
13
- * channels, repo Card+Checkpoint) stays its own type's business.
14
- *
15
- * Pure functions over root rows — no handles, no state. The host owns
16
- * opening and closing; this module only answers "who guards whom".
17
- * Addresses are absolute '/'-separated paths with no trailing
18
- * separator, as the enrollment boundary records them.
19
- */
20
- /** '/a/b' → '/a'; '/a' → '/'; a bare name → '.'. */
21
- const parentDirOf = (path) => {
22
- const cut = path.lastIndexOf('/');
23
- if (cut < 0)
24
- return '.';
25
- return cut === 0 ? '/' : path.slice(0, cut);
26
- };
27
- /**
28
- * The ground a root's doorbell must cover: a directory root guards
29
- * itself; a single-file root's bell lives on its parent directory (the
30
- * file's own inode goes deaf on atomic saves).
31
- */
32
- export function doorbellGround(root) {
33
- return root.kind === 'file' ? parentDirOf(root.path) : root.path;
34
- }
35
- /**
36
- * The root whose OS watcher covers `root`'s doorbell ground, or null
37
- * when `root` guards itself. The OUTERMOST enclosing directory root
38
- * wins: with A ⊃ B ⊃ C only A holds a handle, and every deeper root —
39
- * B, C, nested repos, single files — rides it. A file root can never
40
- * cover anything.
41
- */
42
- export function watchOwnerOf(root, roots) {
43
- const ground = doorbellGround(root);
44
- let owner = null;
45
- for (const other of roots) {
46
- if (other.rootId === root.rootId || other.kind === 'file')
47
- continue;
48
- if (ground !== other.path && !ground.startsWith(`${other.path}/`))
49
- continue;
50
- if (!owner || other.path.length < owner.path.length)
51
- owner = other;
52
- }
53
- return owner;
54
- }
55
- /** Every live root covered by `owner` (owner excluded). */
56
- export function coveredRoots(owner, roots) {
57
- return roots.filter((root) => root.rootId !== owner.rootId
58
- && watchOwnerOf(root, roots)?.rootId === owner.rootId);
59
- }
60
- //# sourceMappingURL=coverage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"coverage.js","sourceRoot":"","sources":["../../src/detection/coverage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAWH,oDAAoD;AACpD,MAAM,WAAW,GA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AC,IAAI,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM;WACrD,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,KAAK,CAAC,MAAM,CAAC,CAAC;AAC3D,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"suspicion.d.ts","sourceRoot":"","sources":["../../src/detection/suspicion.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,iBAAiB;IAChC,8DAA8D;IAC9D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,yFAAyF;IACzF,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,CAAC;CAC1C;AAED,MAAM,WAAW,cAAc;IAC7B,qEAAqE;IACrE,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IAChC,uFAAuF;IACvF,UAAU,IAAI,IAAI,CAAC;IACnB,uDAAuD;IACvD,QAAQ,IAAI,iBAAiB,CAAC;IAC9B,iEAAiE;IACjE,MAAM,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AASD,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI,GAAG,OAAO,CAGvF;AAED,wBAAgB,oBAAoB,CAAC,GAAG,SAAM,GAAG,cAAc,CAmD9D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"suspicion.js","sourceRoot":"","sources":["../../src/detection/suspicion.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAqBH,MAAM,aAAa,GAAG,CAAC,IAAY,EAAiB,EAAE;IACpD,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAA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