@ricsam/r5d-worker 0.0.162 → 0.0.164

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,105 @@
1
+ import { WorkspaceError } from "./contracts";
2
+ /** The outer repository synchronizes the files of the whole workspace root. Each
3
+ * project checkout beneath it remains an independent inner repository with its
4
+ * own GitHub origin; the outer repository never touches inner history. Its Git
5
+ * directory is authority-owned and lives outside the workspace, so no shell can
6
+ * edit its configuration or see it as a repository. */
7
+ export declare const OUTER_BRANCH = "main";
8
+ export declare const OUTER_REF = "refs/heads/main";
9
+ export declare const OUTER_SNAPSHOT_LIMIT_BYTES: number;
10
+ /** A whole-workspace walk hashes every changed file; the default 30 s Git budget
11
+ * is sized for one project. */
12
+ export declare const OUTER_GIT_TIMEOUT_MS: number;
13
+ export declare const OUTER_CONFLICT_CODE = "sync_conflict";
14
+ /** The bootstrap tree a legacy account repository carries. It is never
15
+ * materialized: the workspace root is the user's, not a README's. */
16
+ export declare const LEGACY_ACCOUNT_README = "# Account workspace\n";
17
+ /** Written to the authority-owned info/exclude. Session artifacts and their
18
+ * upload staging are blob-synced, secret material never leaves the host, and the
19
+ * platform's own state directories are not source. Everything else, including a
20
+ * project's dependency tree, is governed by that project's own ignore files. */
21
+ export declare const OUTER_EXCLUDES: string[];
22
+ export type InnerCheckout = {
23
+ /** Work-tree-relative POSIX path of the checkout, without a trailing slash. */
24
+ root: string;
25
+ /** Paths, relative to the checkout, that its HEAD tracks. Resolved lazily
26
+ * because only a checkout with new unexplained content needs it. */
27
+ tracked: () => Promise<ReadonlySet<string>>;
28
+ };
29
+ export type OuterSnapshot = {
30
+ tree: string;
31
+ /** Bytes of content that no inner repository explains. */
32
+ unexplainedBytes: number;
33
+ unexplainedPaths: string[];
34
+ };
35
+ export type OuterMerge = {
36
+ tree: string;
37
+ conflicts: string[];
38
+ };
39
+ export type OuterTreeEntry = {
40
+ file: string;
41
+ mode: string;
42
+ oid: string;
43
+ };
44
+ /** A refusal that names the paths responsible, for the incident evidence. */
45
+ export declare class OuterSnapshotRefusal extends WorkspaceError {
46
+ readonly paths: string[];
47
+ constructor(code: string, message: string, paths: string[]);
48
+ }
49
+ export declare class OuterRepository {
50
+ readonly gitDir: string;
51
+ readonly workTree: string;
52
+ private constructor();
53
+ static open(gitDir: string, workTree: string): Promise<OuterRepository>;
54
+ private run;
55
+ private result;
56
+ head(): Promise<string | null>;
57
+ setHead(commit: string): Promise<void>;
58
+ has(object: string): Promise<boolean>;
59
+ treeOf(commit: string): Promise<string>;
60
+ emptyTree(): Promise<string>;
61
+ isAncestor(ancestor: string, descendant: string): Promise<boolean>;
62
+ listTree(tree: string): Promise<OuterTreeEntry[]>;
63
+ /** Git refuses to walk into a nested repository until the outer index holds
64
+ * at least one path beneath it. That entry is written directly, bypassing the
65
+ * walk; afterwards the checkout is an ordinary directory to every command. A
66
+ * checkout whose tracked count drops to zero silently disappears again, so
67
+ * this runs before every snapshot rather than once. */
68
+ seed(inners: readonly InnerCheckout[]): Promise<void>;
69
+ private seedCandidate;
70
+ /** Stage the whole workspace and measure what no inner repository explains.
71
+ * Inside a checkout, a path its HEAD tracks was asked for by whoever imported
72
+ * or committed it and costs nothing; a path it ignores never reaches the walk.
73
+ * Everything else, and everything outside every checkout, counts in full. */
74
+ snapshot(inners: readonly InnerCheckout[], options?: {
75
+ allowLargeDiff?: boolean;
76
+ limitBytes?: number;
77
+ }): Promise<OuterSnapshot>;
78
+ /** Staging records a symlink as a link entry, and a nested repository that
79
+ * appeared between the walk and the add as a gitlink. Neither can be
80
+ * materialized on another host; both are dropped from the index without
81
+ * touching the working tree. */
82
+ private stripUnsupported;
83
+ commit(tree: string, parents: readonly string[], message: string): Promise<string>;
84
+ /** A three-way merge computed entirely in the object store. The result tree
85
+ * of a conflicted merge carries ordinary conflict markers in the files named. */
86
+ merge(ours: string, theirs: string): Promise<OuterMerge>;
87
+ /** Move the working tree from one tree to another without clobbering anything
88
+ * edited since the index last saw it. Git refuses the whole update when any
89
+ * path it would change is locally modified, so a refusal is transient by
90
+ * construction: the next snapshot picks that edit up and the merge recurs. */
91
+ apply(fromTree: string, toTree: string): Promise<void>;
92
+ /** Materialize a commit into a working tree that holds none of its paths yet. */
93
+ checkout(commit: string): Promise<void>;
94
+ /** Reset index and working tree to a commit, deleting tracked paths it lacks.
95
+ * Never `clean`: the second `-f` that would reach nested repositories is the
96
+ * one switch this repository must never pass. */
97
+ reset(commit: string): Promise<void>;
98
+ diffPaths(fromTree: string, toTree: string): Promise<string[]>;
99
+ /** Objects reachable from the head that the mirror lacks. The bundle names the
100
+ * branch, which the storage side verifies before it accepts the head. */
101
+ bundle(exclude: string | null): Promise<Buffer>;
102
+ unbundle(bytes: Buffer): Promise<void>;
103
+ /** Whether a commit's tree is exactly the legacy account bootstrap. */
104
+ isLegacyBootstrap(commit: string): Promise<boolean>;
105
+ }
@@ -6,7 +6,7 @@ export declare const STORAGE_LIMITS: {
6
6
  readonly chunkBytes: number;
7
7
  readonly blobBytes: number;
8
8
  readonly requestBytes: number;
9
- readonly treeEntries: 10000;
9
+ readonly treeEntries: 200000;
10
10
  };
11
11
  export declare const StorageId: z.ZodString;
12
12
  export declare const GitOid: z.ZodString;
@@ -88,6 +88,7 @@ export declare const StorageRequest: z.ZodDiscriminatedUnion<[z.ZodObject<{
88
88
  expectedHead: z.ZodNullable<z.ZodString>;
89
89
  commit: z.ZodString;
90
90
  bundleId: z.ZodString;
91
+ force: z.ZodOptional<z.ZodBoolean>;
91
92
  operationId: z.ZodString;
92
93
  fence: z.ZodObject<{
93
94
  installationId: z.ZodString;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ricsam/r5d-worker",
3
- "version": "0.0.162",
3
+ "version": "0.0.164",
4
4
  "type": "module",
5
5
  "main": "./dist/mjs/main.mjs",
6
6
  "module": "./dist/mjs/main.mjs",
@@ -21,7 +21,7 @@
21
21
  "r5d-worker": "dist/mjs/main.mjs"
22
22
  },
23
23
  "dependencies": {
24
- "@ricsam/r5d-api": "^0.0.162",
24
+ "@ricsam/r5d-api": "^0.0.164",
25
25
  "node-pty": "1.1.0",
26
26
  "zod": "^4.1.13",
27
27
  "picomatch": "^4.0.3"