@amalgm/live 0.2.18 → 0.2.20

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 (39) hide show
  1. package/PURPOSE.md +23 -17
  2. package/README.md +1 -0
  3. package/dist/detection/classify.d.ts +5 -5
  4. package/dist/detection/classify.d.ts.map +1 -1
  5. package/dist/detection/classify.js +2 -2
  6. package/dist/detection/classify.js.map +1 -1
  7. package/dist/detection/continuity.d.ts +1 -1
  8. package/dist/detection/continuity.d.ts.map +1 -1
  9. package/dist/detection/index.d.ts +2 -5
  10. package/dist/detection/index.d.ts.map +1 -1
  11. package/dist/detection/index.js +2 -5
  12. package/dist/detection/index.js.map +1 -1
  13. package/dist/files/commands.d.ts +9 -1
  14. package/dist/files/commands.d.ts.map +1 -1
  15. package/dist/files/commands.js +12 -2
  16. package/dist/files/commands.js.map +1 -1
  17. package/dist/index.d.ts +1 -0
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +1 -0
  20. package/dist/index.js.map +1 -1
  21. package/dist/watching/coverage.d.ts +33 -0
  22. package/dist/watching/coverage.d.ts.map +1 -0
  23. package/dist/watching/coverage.js +49 -0
  24. package/dist/watching/coverage.js.map +1 -0
  25. package/dist/watching/index.d.ts +8 -0
  26. package/dist/watching/index.d.ts.map +1 -0
  27. package/dist/watching/index.js +8 -0
  28. package/dist/watching/index.js.map +1 -0
  29. package/dist/{detection → watching}/suspicion.d.ts +5 -7
  30. package/dist/watching/suspicion.d.ts.map +1 -0
  31. package/dist/{detection → watching}/suspicion.js +7 -9
  32. package/dist/watching/suspicion.js.map +1 -0
  33. package/package.json +6 -2
  34. package/dist/detection/coverage.d.ts +0 -43
  35. package/dist/detection/coverage.d.ts.map +0 -1
  36. package/dist/detection/coverage.js +0 -60
  37. package/dist/detection/coverage.js.map +0 -1
  38. package/dist/detection/suspicion.d.ts.map +0 -1
  39. 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
@@ -89,17 +90,21 @@ its cutover.
89
90
  the same authenticated private registry. A reference in the core graph
90
91
  points to the external root UUID.
91
92
  20. **Materialization is local and selective.** Login installs the core graph;
92
- `files add <workspace>` installs one owned workspace root. The local SQLite
93
- 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.
93
+ `files add <workspace>` installs one owned workspace root and the exact
94
+ portable reference entity that names it. The local SQLite table contains
95
+ rows only for roots materialized on that machine, while cloud reconciliation
96
+ preserves every unmaterialized root. A newly installed and verified graph
97
+ is the initial Watch baseline for that root; opening coverage must not
98
+ reinterpret the downloader's own writes as user edits.
99
+ 21. **A Git marker classifies its containing directory.** The presence of a
100
+ `.git` directory or file makes its containing directory `repo.git`; its
101
+ removal returns that same UUID to `workspace` or `folder`. Git command
102
+ availability governs Card + Checkpoint capture, never classification, and
103
+ `.git` itself is repository transport metadata that receives no entity
104
+ row. Worktree children retain local UUID rows, while their identities ride
105
+ in the repository state manifest rather than becoming individual cloud
106
+ records. A shallow repository carries its declared Git history boundary,
107
+ so a new machine never invents history beyond it.
103
108
  22. **Transfer moves content; it never discovers state.** `upload` moves one
104
109
  already-registered immutable artifact toward cloud storage and `download`
105
110
  moves that same artifact toward a machine cache. Neither operation scans,
@@ -185,10 +190,11 @@ src/machines/ transport-neutral state machines: sequence ordering + gap
185
190
  src/entities/ the entity model's rule surface: the six-field record,
186
191
  derived versions, lifecycle laws, move planning, the
187
192
  cloud and repo-state codecs — behind injected ports.
188
- src/detection/ the Detect/Watch pure cores: the adapter contract, the
189
- three-channel compare (diff) core, coverage, continuity
190
- verdicts, suspicion scope, classification, refusals,
191
- enrollment policy.
193
+ src/watching/ the Watch pure cores: minimal coverage ownership and
194
+ generation-safe suspicion.
195
+ src/detection/ the Detect pure cores: the adapter contract, three-channel
196
+ compare (diff), continuity verdicts, classification,
197
+ refusals, and enrollment policy.
192
198
  src/registration/ the login-time user-ground convergence operation and its
193
199
  injected local/cloud effect ports.
194
200
  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
 
@@ -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;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAWH,MAAM,UAAU,YAAY,CAAC,EAAE,MAAM,EAAoB;IACvD,OAAO,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,WAAW,CAAC;AAC9C,CAAC;AASD,MAAM,UAAU,iBAAiB,CAAC,EAAE,UAAU,EAAsB;IAClE,OAAO,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC5C,CAAC;AAED;gEACgE;AAChE,MAAM,UAAU,sBAAsB,CAAC,EAAE,UAAU,EAAsB;IACvE,OAAO,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC;AAC/C,CAAC;AAED;;+EAE+E;AAC/E,MAAM,UAAU,yBAAyB,CAAC,UAA8C,EAAE,IAAY;IACpG,OAAO,UAAU,KAAK,UAAU,IAAI,IAAI,KAAK,MAAM,CAAC;AACtD,CAAC"}
1
+ {"version":3,"file":"classify.js","sourceRoot":"","sources":["../../src/detection/classify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAWH,MAAM,UAAU,YAAY,CAAC,EAAE,MAAM,EAAoB;IACvD,OAAO,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,WAAW,CAAC;AAC9C,CAAC;AASD,MAAM,UAAU,iBAAiB,CAAC,EAAE,UAAU,EAAsB;IAClE,OAAO,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC5C,CAAC;AAED;gEACgE;AAChE,MAAM,UAAU,sBAAsB,CAAC,EAAE,UAAU,EAAsB;IACvE,OAAO,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC;AAC/C,CAAC;AAED;;yEAEyE;AACzE,MAAM,UAAU,yBAAyB,CAAC,UAA8C,EAAE,IAAY;IACpG,OAAO,UAAU,KAAK,UAAU,IAAI,IAAI,KAAK,MAAM,CAAC;AACtD,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,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;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,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"}
@@ -41,6 +41,7 @@ export interface FilesAddPorts {
41
41
  lookupRegistry(): Promise<CloudUserGround>;
42
42
  materializeWorkspace(input: {
43
43
  readonly workspace: CloudEntityRecord;
44
+ readonly reference: CloudEntityRecord;
44
45
  readonly records: readonly CloudEntityRecord[];
45
46
  readonly destinationParent: string;
46
47
  readonly cloudHead: string;
@@ -48,9 +49,15 @@ export interface FilesAddPorts {
48
49
  readonly path: string;
49
50
  readonly rows: number;
50
51
  readonly records: readonly CloudEntityRecord[];
52
+ readonly reference: CloudEntityRecord;
51
53
  readonly alreadyMaterialized: boolean;
52
54
  }>;
53
- coverWorkspace(workspaceId: string): Promise<{
55
+ coverWorkspace(input: {
56
+ readonly workspaceId: string;
57
+ /** The host may adopt this exact graph as Watch's initial baseline only
58
+ * when this add invocation just materialized and verified it. */
59
+ readonly baseline: 'authoritative-install' | 'existing';
60
+ }): Promise<{
54
61
  readonly active: boolean;
55
62
  readonly roots: number;
56
63
  }>;
@@ -68,6 +75,7 @@ export interface FilesAddResult {
68
75
  /** Select exactly one root graph. Sibling roots are intentionally absent. */
69
76
  export declare function workspaceGraph(records: readonly CloudEntityRecord[], workspaceId: string): {
70
77
  readonly workspace: CloudEntityRecord;
78
+ readonly reference: CloudEntityRecord;
71
79
  readonly records: readonly CloudEntityRecord[];
72
80
  };
73
81
  /** Materialize one owned workspace root and establish Watch coverage for it. */
@@ -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,CAAC;IAClC,2EAA2E;IAC3E,yBAAyB,CAAC,KAAK,EAAE;QAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;QAC/B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;KAC/B,GAAG,OAAO,CAAC;QACV,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;QAC1B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;QAC/B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;KAChC,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,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51
51
  throw new Error(`entity ${normalizedId} is not a workspace root`);
52
52
  }
53
+ const references = snapshot.records.filter((record) => record.status === 'active'
54
+ && record.type === 'reference' && record.payloadVersion === normalizedId);
55
+ if (references.length !== 1) {
56
+ throw new Error(`workspace ${normalizedId} must have exactly one durable reference`);
57
+ }
53
58
  const included = new Set([normalizedId]);
54
59
  let changed = true;
55
60
  while (changed) {
@@ -63,6 +68,7 @@ export function workspaceGraph(records, workspaceId) {
63
68
  }
64
69
  return {
65
70
  workspace,
71
+ reference: references[0],
66
72
  records: snapshot.records.filter((record) => included.has(record.uuid)),
67
73
  };
68
74
  }
@@ -80,10 +86,14 @@ export async function addFilesWorkspace(workspaceId, destinationParent, ports) {
80
86
  const installedRecords = snapshotFromRecords(installed.records || []).records;
81
87
  if (!Number.isSafeInteger(installed.rows)
82
88
  || installed.rows !== installedRecords.length
83
- || !sameRecords(travelingRecords(installedRecords), selected.records)) {
89
+ || !sameRecords(travelingRecords(installedRecords), selected.records)
90
+ || !sameRecords([installed.reference], [selected.reference])) {
84
91
  throw new Error('workspace materialization did not persist exactly the selected graph');
85
92
  }
86
- const coverage = await ports.coverWorkspace(normalizedId);
93
+ const coverage = await ports.coverWorkspace({
94
+ workspaceId: normalizedId,
95
+ baseline: installed.alreadyMaterialized === true ? 'existing' : 'authoritative-install',
96
+ });
87
97
  if (coverage.active !== true || !Number.isSafeInteger(coverage.roots) || coverage.roots < 1) {
88
98
  throw new Error('workspace watcher coverage is not active');
89
99
  }
@@ -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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C,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
+ //# sourceMappingURL=coverage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coverage.js","sourceRoot":"","sources":["../../src/watching/coverage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAYH,oDAAoD;AACpD,MAAM,WAAW,GAAG,CAAC,IAAY,EAAU,EAAE;IAC3C,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,GAAG,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC;IACxB,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAC9C,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,IAAe;IAC5C,OAAO,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;AACnE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,IAAe,EAAE,KAA2B;IACvE,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,KAAK,GAAqB,IAAI,CAAC;IACnC,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE,CAAC;QAC1B,IAAI,KAAK,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM;YAAE,SAAS;QACpE,IAAI,MAAM,KAAK,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,KAAK,CAAC,IAAI,GAAG,CAAC;YAAE,SAAS;QAC5E,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,MAAM;YAAE,KAAK,GAAG,KAAK,CAAC;IACrE,CAAC;IACD,OAAO,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,QAAkC;IAC5E,IAAI,QAAQ,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACnC,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC;AAClF,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,GAAG,GAAG,GAAG;IAC5C,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;IACnG,MAAM,KAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;IACxC,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,IAAI,aAAa,GAAG,CAAC,CAAC;IAEtB,MAAM,iBAAiB,GAAG,GAAG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AAE,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.18",
3
+ "version": "0.2.20",
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,GAAG,CAAC,IAAY,EAAU,EAAE;IAC3C,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,GAAG,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC;IACxB,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAC9C,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,IAAe;IAC5C,OAAO,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;AACnE,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,IAAe,EAAE,KA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