@yaks/git 0.0.0-stage → 0.2.36

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 (183) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +754 -2
  3. package/_dist/address.d.ts +6 -0
  4. package/_dist/address.d.ts.map +1 -0
  5. package/_dist/checkout_vocab.d.ts +3 -0
  6. package/_dist/checkout_vocab.d.ts.map +1 -0
  7. package/_dist/cites.d.ts +48 -0
  8. package/_dist/cites.d.ts.map +1 -0
  9. package/_dist/commit.d.ts +36 -0
  10. package/_dist/commit.d.ts.map +1 -0
  11. package/_dist/comp.d.ts +29 -0
  12. package/_dist/comp.d.ts.map +1 -0
  13. package/_dist/door.d.ts +29 -0
  14. package/_dist/door.d.ts.map +1 -0
  15. package/_dist/format.d.ts +2 -0
  16. package/_dist/format.d.ts.map +1 -0
  17. package/_dist/hold.d.ts +6 -0
  18. package/_dist/hold.d.ts.map +1 -0
  19. package/_dist/host.d.ts +126 -0
  20. package/_dist/host.d.ts.map +1 -0
  21. package/_dist/http.d.ts +33 -0
  22. package/_dist/http.d.ts.map +1 -0
  23. package/_dist/import.d.ts +13 -0
  24. package/_dist/import.d.ts.map +1 -0
  25. package/_dist/index.d.ts +80 -0
  26. package/_dist/index.d.ts.map +1 -0
  27. package/_dist/land.d.ts +77 -0
  28. package/_dist/land.d.ts.map +1 -0
  29. package/_dist/mod.d.ts +73 -0
  30. package/_dist/mod.d.ts.map +1 -0
  31. package/_dist/objects.d.ts +40 -0
  32. package/_dist/objects.d.ts.map +1 -0
  33. package/_dist/oid.d.ts +24 -0
  34. package/_dist/oid.d.ts.map +1 -0
  35. package/_dist/pack-store.d.ts +9 -0
  36. package/_dist/pack-store.d.ts.map +1 -0
  37. package/_dist/pack.d.ts +26 -0
  38. package/_dist/pack.d.ts.map +1 -0
  39. package/_dist/pkt.d.ts +14 -0
  40. package/_dist/pkt.d.ts.map +1 -0
  41. package/_dist/placement.d.ts +4 -0
  42. package/_dist/placement.d.ts.map +1 -0
  43. package/_dist/plugin.d.ts +43 -0
  44. package/_dist/plugin.d.ts.map +1 -0
  45. package/_dist/project.d.ts +20 -0
  46. package/_dist/project.d.ts.map +1 -0
  47. package/_dist/push.d.ts +42 -0
  48. package/_dist/push.d.ts.map +1 -0
  49. package/_dist/refs.d.ts +81 -0
  50. package/_dist/refs.d.ts.map +1 -0
  51. package/_dist/rewrite.d.ts +35 -0
  52. package/_dist/rewrite.d.ts.map +1 -0
  53. package/_dist/service.d.ts +35 -0
  54. package/_dist/service.d.ts.map +1 -0
  55. package/_dist/sha1.d.ts +11 -0
  56. package/_dist/sha1.d.ts.map +1 -0
  57. package/_dist/source.d.ts +12 -0
  58. package/_dist/source.d.ts.map +1 -0
  59. package/_dist/tools.d.ts +11 -0
  60. package/_dist/tools.d.ts.map +1 -0
  61. package/_dist/tree.d.ts +28 -0
  62. package/_dist/tree.d.ts.map +1 -0
  63. package/_dist/unpack.d.ts +5 -0
  64. package/_dist/unpack.d.ts.map +1 -0
  65. package/_dist/vocab.d.ts +8 -0
  66. package/_dist/vocab.d.ts.map +1 -0
  67. package/_dist/workspace.d.ts +17 -0
  68. package/_dist/workspace.d.ts.map +1 -0
  69. package/address.js +9 -0
  70. package/address.js.map +1 -0
  71. package/address.ts +15 -0
  72. package/cache.js +9 -0
  73. package/cache.js.map +1 -0
  74. package/cache.ts +6 -0
  75. package/checkout.js +18 -0
  76. package/checkout.js.map +1 -0
  77. package/checkout.ts +24 -0
  78. package/checkout_vocab.js +14 -0
  79. package/checkout_vocab.js.map +1 -0
  80. package/checkout_vocab.ts +11 -0
  81. package/cites.js +189 -0
  82. package/cites.js.map +1 -0
  83. package/cites.ts +206 -0
  84. package/commit.js +128 -0
  85. package/commit.js.map +1 -0
  86. package/commit.ts +183 -0
  87. package/comp.js +94 -0
  88. package/comp.js.map +1 -0
  89. package/comp.ts +111 -0
  90. package/deno.json +1 -0
  91. package/door.js +88 -0
  92. package/door.js.map +1 -0
  93. package/door.ts +142 -0
  94. package/format.js +43 -0
  95. package/format.js.map +1 -0
  96. package/format.ts +49 -0
  97. package/hold.js +17 -0
  98. package/hold.js.map +1 -0
  99. package/hold.ts +21 -0
  100. package/host.js +1024 -0
  101. package/host.js.map +1 -0
  102. package/host.ts +1140 -0
  103. package/http.js +268 -0
  104. package/http.js.map +1 -0
  105. package/http.ts +329 -0
  106. package/import.js +141 -0
  107. package/import.js.map +1 -0
  108. package/import.ts +128 -0
  109. package/index.js +496 -0
  110. package/index.js.map +1 -0
  111. package/index.ts +634 -0
  112. package/land.js +788 -0
  113. package/land.js.map +1 -0
  114. package/land.ts +871 -0
  115. package/mod.js +73 -0
  116. package/mod.js.map +1 -0
  117. package/mod.ts +74 -0
  118. package/objects.js +331 -0
  119. package/objects.js.map +1 -0
  120. package/objects.ts +390 -0
  121. package/oid.js +50 -0
  122. package/oid.js.map +1 -0
  123. package/oid.ts +83 -0
  124. package/pack-index.js +103 -0
  125. package/pack-index.js.map +1 -0
  126. package/pack-index.ts +104 -0
  127. package/pack-store.js +216 -0
  128. package/pack-store.js.map +1 -0
  129. package/pack-store.ts +292 -0
  130. package/pack.js +121 -0
  131. package/pack.js.map +1 -0
  132. package/pack.ts +146 -0
  133. package/package.json +78 -4
  134. package/pkt.js +73 -0
  135. package/pkt.js.map +1 -0
  136. package/pkt.ts +93 -0
  137. package/placement.js +44 -0
  138. package/placement.js.map +1 -0
  139. package/placement.ts +38 -0
  140. package/plugin.js +66 -0
  141. package/plugin.js.map +1 -0
  142. package/plugin.ts +88 -0
  143. package/process-cwd.py +57 -0
  144. package/project.js +142 -0
  145. package/project.js.map +1 -0
  146. package/project.ts +151 -0
  147. package/push.js +401 -0
  148. package/push.js.map +1 -0
  149. package/push.ts +451 -0
  150. package/refs.js +176 -0
  151. package/refs.js.map +1 -0
  152. package/refs.ts +285 -0
  153. package/rewrite.js +176 -0
  154. package/rewrite.js.map +1 -0
  155. package/rewrite.ts +173 -0
  156. package/service.js +104 -0
  157. package/service.js.map +1 -0
  158. package/service.ts +194 -0
  159. package/sha1.js +115 -0
  160. package/sha1.js.map +1 -0
  161. package/sha1.ts +146 -0
  162. package/source.js +100 -0
  163. package/source.js.map +1 -0
  164. package/source.ts +116 -0
  165. package/spare.js +108 -0
  166. package/spare.js.map +1 -0
  167. package/spare.ts +94 -0
  168. package/tools.js +278 -0
  169. package/tools.js.map +1 -0
  170. package/tools.ts +310 -0
  171. package/tree.js +105 -0
  172. package/tree.js.map +1 -0
  173. package/tree.ts +132 -0
  174. package/unpack.js +207 -0
  175. package/unpack.js.map +1 -0
  176. package/unpack.ts +210 -0
  177. package/vocab.js +20 -0
  178. package/vocab.js.map +1 -0
  179. package/vocab.json +386 -0
  180. package/vocab.ts +22 -0
  181. package/workspace.js +449 -0
  182. package/workspace.js.map +1 -0
  183. package/workspace.ts +445 -0
package/_dist/mod.d.ts ADDED
@@ -0,0 +1,73 @@
1
+ /**
2
+ * @yaks/git — Git objects stored as graph entities, so a deploy history is a
3
+ * repository anyone can clone.
4
+ *
5
+ * A yaks.app version is a file manifest — `path → sha256`, over bytes already
6
+ * in a @yaks/blob store. This package turns one into the objects Git asks for
7
+ * and keeps them in a graph:
8
+ *
9
+ * ```ts
10
+ * import { index } from '@yaks/git'
11
+ *
12
+ * // let git = index(g, store)
13
+ * // let tree = await git.files({ 'index.html': sha, 'lib/app.js': other })
14
+ * // let head = await git.commit({
15
+ * // tree,
16
+ * // author: { name: 'ada', email: 'ada@users.yaks.app', at: deployedAt },
17
+ * // committer: { name: 'yaks.app', email: 'git@yaks.app', at: deployedAt },
18
+ * // message: 'deploy 7',
19
+ * // })
20
+ * ```
21
+ *
22
+ * What it is made of:
23
+ *
24
+ * - **An object's entity id is its Git object id.** {@link oid} computes Git's
25
+ * SHA-1 id over `"<type> <size>\0<body>"`, so the same object written by two
26
+ * apps is one row, and a `want` line in a fetch request is a lookup by id.
27
+ * - **Every object also has a SHA-256 object id**, from the first write:
28
+ * {@link oid256} over the same object with its children's ids translated,
29
+ * stored as an @yaks/key of kind `compat`. A client that asks for
30
+ * `object-format=sha256` is answered from that key rather than by converting
31
+ * the repository.
32
+ * - **Bodies carry tree children; rows carry object addresses.**
33
+ * {@link treeBody} and {@link commitBody} write Git's own bytes; the graph
34
+ * keeps `gitobj{type, size}`, `blob{sha}` and `parent` edges;
35
+ * a pack reads tree children from the immutable body.
36
+ * - **A Git blob is the blob you already have.** The bytes an app deployed are
37
+ * already stored under their SHA-256 address; the Git object is those bytes
38
+ * with a header hashed over them, and nothing is re-encoded or copied.
39
+ * - **A clone is those walks, packed.** {@link objects} lists every object
40
+ * reachable from a set of wants, minus what the client already has, and
41
+ * {@link pack} streams them as a version 2 packfile — whole objects, no
42
+ * deltas.
43
+ * - **A branch is a row.** {@link refEid} derives its entity id,
44
+ * {@link refAt} reads where it points, and {@link commitOnto} lands one
45
+ * manifest on it: objects written, then the branch moved, in an order that
46
+ * makes running it twice cost reads and no writes. {@link commits} is that
47
+ * same step packaged as a plugin hooked on the `effect` phase.
48
+ * - **And a clone is HTTP.** {@link advertise} and {@link uploadPack}
49
+ * implement Git's smart HTTP protocol, version 2, read-only: a `Request` in,
50
+ * a `Response` out, over a {@link Refs} and an {@link Objects} that the
51
+ * caller mounting them supplies.
52
+ *
53
+ * Object storage and clone use `crypto.subtle`, `CompressionStream` and
54
+ * `Request`/`Response`, so the same code runs on a server, in a worker and in
55
+ * a browser tab. Receive-pack uses `node:zlib` to unpack pushes. Its door (`@yaks/git/door`) answers a repository's addresses;
56
+ * which repository a name is, and who may read it, are its host's.
57
+ *
58
+ * @module
59
+ */ export * from "./comp.js";
60
+ export * from "./oid.js";
61
+ export * from "./tree.js";
62
+ export * from "./commit.js";
63
+ export * from "./index.js";
64
+ export * from "./sha1.js";
65
+ export * from "./pack.js";
66
+ export * from "./pack-store.js";
67
+ export * from "./rewrite.js";
68
+ export * from "./objects.js";
69
+ export * from "./pkt.js";
70
+ export * from "./http.js";
71
+ export * from "./refs.js";
72
+ export * from "./plugin.js";
73
+ //# sourceMappingURL=mod.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mod.d.ts","sources":["../mod.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0DC,GAED,0BAAyB;AACzB,yBAAwB;AACxB,0BAAyB;AACzB,4BAA2B;AAC3B,2BAA0B;AAC1B,0BAAyB;AACzB,0BAAyB;AACzB,gCAA+B;AAC/B,6BAA4B;AAC5B,6BAA4B;AAC5B,yBAAwB;AACxB,0BAAyB;AACzB,0BAAyB;AACzB,4BAA2B"}
@@ -0,0 +1,40 @@
1
+ import { type Blobs } from "@yaks/blob";
2
+ import type { Graph } from "@yaks/graph";
3
+ import type { Kind } from "./oid.js";
4
+ import { type Obj, pack } from "./pack.js";
5
+ /**
6
+ * What reading objects needs from a graph: a read, and nothing else — the read
7
+ * half of {@link Writes}, for the same reason (./index.ts). A packfile is
8
+ * served wherever the request arrived, which may be nowhere near the graph.
9
+ */ export type Reads = Pick<Graph, 'read'>;
10
+ /** Reading a graph's Git objects out, in the order a packfile lists them. */ export type Objects = {
11
+ /** every object these commits need, each once: commits, then trees, then
12
+ * blobs — minus whatever the client already has */ reach: (wants: string[], haves?: string[]) => Promise<string[]>;
13
+ /** objects in the ref tips' snapshots, without walking prior commits */ snapshots?: (tips: string[]) => Promise<string[]>;
14
+ /** Common commits offered by the client during fetch negotiation. */ common?: (wants: string[], haves: string[]) => Promise<string[]>;
15
+ /** those objects' bytes, one at a time, in the order given */ read: (oids: string[]) => AsyncIterable<Obj>;
16
+ /** both at once: the packfile that a clone of these commits consists of */ pack: (wants: string[], haves?: string[]) => Promise<ReadableStream<Uint8Array>>;
17
+ };
18
+ /** The outgoing links of every object reachable from a commit. */ export type Catalog = Map<string, string[]>;
19
+ export declare let reachable: (from: Catalog, roots: string[]) => Set<string>;
20
+ export type Membership = (oids: string[]) => Promise<Set<string>>;
21
+ export type History = Objects & {
22
+ additions?: (tip: string, held: Membership) => Promise<{
23
+ links: Catalog;
24
+ met: Set<string>;
25
+ }>;
26
+ catalog: (tip: string, prior?: Catalog) => Promise<Catalog>;
27
+ packObjects: (oids: string[], prior?: Parameters<typeof pack>[2]) => ReadableStream<Uint8Array>;
28
+ };
29
+ type IndexedHistory = History & {
30
+ /** The bodies of a tip and its ancestors, except those `held` names. */ commits: (tip: string, held?: {
31
+ has: (oid: string) => boolean;
32
+ }) => Promise<Map<string, Uint8Array>>;
33
+ };
34
+ /** An object reader over a graph that carries this package's components and
35
+ * the @yaks/blob store that holds the bytes — the same pair the index writes
36
+ * to. */ export declare let objects: (g: Reads, store: {
37
+ get: (sha: string, kind: Kind) => ReturnType<Blobs['get']>;
38
+ open?: (sha: string, kind: Kind) => ReturnType<NonNullable<Blobs['open']>>;
39
+ }) => IndexedHistory;
40
+ //# sourceMappingURL=objects.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"objects.d.ts","sources":["../objects.ts"],"names":[],"mappings":"AAsBA,SAAS,KAAK,KAAK,0BAAyC;AAC5D,cAA4B,KAAK,2BAAgC;AAKjE,cAAc,IAAI,mBAAkB;AACpC,SAAS,KAAK,GAAG,EAAE,IAAI,oBAAmB;AAG1C;;;;CAIC,GACD,YAAY,QAAQ,KAAK,OAAO;AAEhC,2EAA2E,GAC3E,YAAY;EACV;mDACiD,GACjD,QAAQ,OAAO,MAAM,IAAI,QAAQ,MAAM,OAAO,QAAQ,MAAM;EAC5D,sEAAsE,GACtE,aAAa,MAAM,MAAM,OAAO,QAAQ,MAAM;EAC9C,mEAAmE,GACnE,UAAU,OAAO,MAAM,IAAI,OAAO,MAAM,OAAO,QAAQ,MAAM;EAC7D,4DAA4D,GAC5D,OAAO,MAAM,MAAM,OAAO,cAAc;EACxC,yEAAyE,GACzE,OACE,OAAO,MAAM,IACb,QAAQ,MAAM,OACX,QAAQ,eAAe;;AAG9B,gEAAgE,GAChE,YAAY,UAAU,IAAI,MAAM,EAAE,MAAM;AAExC,OAAO,YAAI,YAAa,MAAM,SAAS,OAAO,MAAM,OAAK,IAAI,MAAM,EAWlE;AAED,YAAY,cAAc,MAAM,MAAM,OAAO,QAAQ,IAAI,MAAM;AAE/D,YAAY,UAAU;EACpB,aAAa,KAAK,MAAM,EAAE,MAAM,eAAe;IAC7C,OAAO;IACP,KAAK,IAAI,MAAM;;EAEjB,UAAU,KAAK,MAAM,EAAE,QAAQ,YAAY,QAAQ;EACnD,cACE,MAAM,MAAM,IACZ,QAAQ,kBAAkB,MAAM,OAC7B,eAAe;;KAGjB,iBAAiB;EACpB,sEAAsE,GACtE,UACE,KAAK,MAAM,EACX;IAAS,MAAM,KAAK,MAAM,KAAK,OAAO;QACnC,QAAQ,IAAI,MAAM,EAAE;;AAW3B;;OAEO,GACP,OAAO,YAAI,UACT,GAAG,OACH;EACE,MAAM,KAAK,MAAM,EAAE,MAAM,SAAS,WAAW,MAAM;EACnD,QAAQ,KAAK,MAAM,EAAE,MAAM,SAAS,WAAW,YAAY,MAAM;MAElE,eAqRF"}
package/_dist/oid.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ /** The four types a Git object can have. */ export type Kind = 'blob' | 'tree' | 'commit' | 'tag';
2
+ /** One object's two ids: Git's SHA-1 id, and the SHA-256 id of the same
3
+ * object with its children's ids translated. */ export type Oids = {
4
+ oid: string;
5
+ oid256: string;
6
+ };
7
+ /** The bytes Git prefixes a body with before hashing it: `tree 42\0`. */ export declare let header: (type: Kind, size: number) => Uint8Array;
8
+ /** Joins byte runs end to end — how every body in this package is assembled.
9
+ *
10
+ * The return type is `Uint8Array<ArrayBuffer>` because `crypto.subtle` refuses
11
+ * a view that might be over shared memory, and every body here ends up in a
12
+ * digest. A freshly allocated array never is. */ export declare let concat: (parts: Uint8Array[]) => Uint8Array<ArrayBuffer>;
13
+ /** A body as it is hashed: the header, then the body. */ export declare let framed: (type: Kind, body: Uint8Array) => Uint8Array<ArrayBuffer>;
14
+ /** Bytes as lowercase hex. Every id in this package is a hex string. */ export declare let hex: (bytes: Uint8Array) => string;
15
+ /** A hex id back as the raw bytes a tree body writes it with. */ export declare let bin: (id: string) => Uint8Array;
16
+ /** Computing an object id under one hash algorithm: the signature both
17
+ * {@link oid} and {@link oid256} have. */ export type Namer = (type: Kind, body: Uint8Array) => Promise<string>;
18
+ /** The object id under one algorithm: `digest(algo, "<type> <size>\0<body>")`.
19
+ * {@link oid} and {@link oid256} are the two callers use. */ export declare let objectId: (algo: 'SHA-1' | 'SHA-256') => Namer;
20
+ /** Git's object id: the SHA-1 of the header and the body. */ export declare let oid: Namer;
21
+ /** The same object's SHA-256 object id. Pass it the SHA-256 body — the one
22
+ * whose children are named by their own `oid256` — or the result is the digest
23
+ * of an object nobody can ask for. */ export declare let oid256: Namer;
24
+ //# sourceMappingURL=oid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oid.d.ts","sources":["../oid.ts"],"names":[],"mappings":"AAqBA,0CAA0C,GAC1C,YAAY,OAAO,SAAS,SAAS,WAAW;AAEhD;8CAC8C,GAC9C,YAAY;EAAS,KAAK,MAAM;EAAE,QAAQ,MAAM;;AAIhD,uEAAuE,GACvE,OAAO,YAAI,SAAU,MAAM,MAAM,MAAM,MAAM,KAAG,WACd;AAElC;;;;+CAI+C,GAC/C,OAAO,YAAI,SAAU,OAAO,iBAAe,WAAW,aAQrD;AAED,uDAAuD,GACvD,OAAO,YAAI,SACT,MAAM,MACN,MAAM,eACL,WAAW,aAAyD;AAEvE,sEAAsE,GACtE,OAAO,YAAI,MAAO,OAAO,eAAa,MAAM,CACwB;AAEpE,+DAA+D,GAC/D,OAAO,YAAI,MAAO,IAAI,MAAM,KAAG,WAI5B;AAEH;wCACwC,GACxC,YAAY,SAAS,MAAM,MAAM,MAAM,eAAe,QAAQ,MAAM;AAEpE;2DAC2D,GAC3D,OAAO,YAAI,WACR,MAAM,UAAU,cAAY,MAC8C;AAE7E,2DAA2D,GAC3D,OAAO,YAAI,KAAK,MAAyB;AAEzC;;oCAEoC,GACpC,OAAO,YAAI,QAAQ,MAA2B"}
@@ -0,0 +1,9 @@
1
+ import { type Objects as Bucket } from "@yaks/blob";
2
+ import { type History, type Objects } from "./objects.js";
3
+ export type StoredPacks = {
4
+ refresh: (tip: string) => Promise<void>;
5
+ /** Drop the stored pack, and rebuild it for `tip` while the ref is there. */ repack: (tip: string | null) => Promise<void>;
6
+ objects: (failed?: (error: unknown) => void) => Objects;
7
+ };
8
+ /** A chain of immutable packs and a sharded reachability index for main. */ export declare let storedPacks: (from: History, bucket: Bucket, key: string, current: () => Promise<string | null>) => StoredPacks;
9
+ //# sourceMappingURL=pack-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pack-store.d.ts","sources":["../pack-store.ts"],"names":[],"mappings":"AAAA,SAIE,KAAK,WAAW,MAAM,0BACM;AAG9B,SAEE,KAAK,OAAO,EACZ,KAAK,OAAO,uBAEO;AAsErB,YAAY;EACV,UAAU,KAAK,MAAM,KAAK,QAAQ,IAAI;EACtC,2EAA2E,GAC3E,SAAS,KAAK,MAAM,GAAG,IAAI,KAAK,QAAQ,IAAI;EAC5C,UAAU,UAAU,OAAO,OAAO,KAAK,IAAI,KAAK;;AAGlD,0EAA0E,GAC1E,OAAO,YAAI,cACT,MAAM,SACN,QAAQ,QACR,KAAK,MAAM,EACX,eAAe,QAAQ,MAAM,GAAG,IAAI,MACnC,YAmMF"}
@@ -0,0 +1,26 @@
1
+ import { type Kind } from "./oid.js";
2
+ /** One object to pack: its type, and the bytes its id was taken over. */ export type Obj = {
3
+ type: Kind;
4
+ bytes: Uint8Array;
5
+ };
6
+ type PackedObject = Obj | {
7
+ type: Kind;
8
+ size: number;
9
+ body: () => Promise<ReadableStream<Uint8Array>>;
10
+ };
11
+ /** The twelve bytes a packfile opens with. */ export declare let head: (count: number) => Uint8Array<ArrayBuffer>;
12
+ /** One object's header: its type, and its unpacked size as Git's varint. */ export declare let entry: (type: Kind, size: number) => Uint8Array;
13
+ /** A body as a packfile stores it: zlib, which is `deflate`, not
14
+ * `deflate-raw`. */ export declare let deflate: (bytes: Uint8Array) => Promise<Uint8Array<ArrayBuffer>>;
15
+ /**
16
+ * A version 2 packfile over these objects, in this order.
17
+ *
18
+ * ```ts
19
+ * // let bytes = pack(2, [{ type: 'blob', bytes: hello }, commitObj])
20
+ * // await new Response(bytes).arrayBuffer()
21
+ * ```
22
+ */ export declare let pack: (count: number, objects: AsyncIterable<PackedObject> | Iterable<PackedObject>, prior?: {
23
+ count: number;
24
+ entries: ReadableStream<Uint8Array>;
25
+ }) => ReadableStream<Uint8Array>;
26
+ //# sourceMappingURL=pack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pack.d.ts","sources":["../pack.ts"],"names":[],"mappings":"AAgCA,SAAiB,KAAK,IAAI,mBAAkB;AAG5C,uEAAuE,GACvE,YAAY;EAAQ,MAAM;EAAM,OAAO;;KAElC,eAAe;EAClB,MAAM;EACN,MAAM,MAAM;EACZ,YAAY,QAAQ,eAAe;;AASrC,4CAA4C,GAC5C,OAAO,YAAI,OAAQ,OAAO,MAAM,KAAG,WAAW,aAO7C;AAED,0EAA0E,GAC1E,OAAO,YAAI,QAAS,MAAM,MAAM,MAAM,MAAM,KAAG,WAS9C;AAED;kBACkB,GAClB,OAAO,YAAI,UAAW,OAAO,eAAa,QAAQ,WAAW,cACS;AA0DtE;;;;;;;CAOC,GACD,OAAO,YAAI,OACT,OAAO,MAAM,EACb,SAAS,cAAc,gBAAgB,SAAS,eAChD;EAAU,OAAO,MAAM;EAAE,SAAS,eAAe;MAChD,eAAe,YAAwD"}
package/_dist/pkt.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ /** The end of a message. */ export declare let FLUSH: number;
2
+ /** The end of a command's capabilities, before its arguments. */ export declare let DELIM: number;
3
+ /** The end of one response inside a multiplexed stream. */ export declare let END: number;
4
+ /** A packet as it is read back: a line's text, or a marker's own number. */ export type Pkt = string | number;
5
+ /** The most one packet can carry. */ export declare let MAX: number;
6
+ /** The most one side-band packet can carry: a packet, less the band byte. */ export declare let BAND: any;
7
+ /** One of the markers, as the four bytes it is sent as. */ export declare let mark: (which: number) => Uint8Array<ArrayBuffer>;
8
+ /** One pkt-line over this payload. Give a line its own trailing newline: Git
9
+ * writes one and this does not add it, because a packet is just bytes. */ export declare let pkt: (data: string | Uint8Array) => Uint8Array<ArrayBuffer>;
10
+ /** One side-band packet: which band these bytes belong to (1 pack data, 2
11
+ * progress, 3 error), then the bytes. */ export declare let band: (which: number, data: Uint8Array) => Uint8Array<ArrayBuffer>;
12
+ /** Every packet in these bytes, in order: lines as text without their trailing
13
+ * newline, markers as their number. */ export declare let read: (bytes: Uint8Array) => Pkt[];
14
+ //# sourceMappingURL=pkt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pkt.d.ts","sources":["../pkt.ts"],"names":[],"mappings":"AA+BA,0BAA0B,GAC1B,OAAO,YAAI,cAAS;AAEpB,+DAA+D,GAC/D,OAAO,YAAI,cAAS;AAEpB,yDAAyD,GACzD,OAAO,YAAI,YAAO;AAElB,0EAA0E,GAC1E,YAAY,MAAM,MAAM,GAAG,MAAM;AAEjC,mCAAmC,GACnC,OAAO,YAAI,YAAW;AAEtB,2EAA2E,GAC3E,OAAO,YAAI,UAAc;AAIzB,yDAAyD,GACzD,OAAO,YAAI,OAAQ,OAAO,MAAM,KAAG,WAAW,aACpB;AAE1B;wEACwE,GACxE,OAAO,YAAI,MAAO,MAAM,MAAM,GAAG,eAAa,WAAW,aAMxD;AAED;uCACuC,GACvC,OAAO,YAAI,OAAQ,OAAO,MAAM,EAAE,MAAM,eAAa,WAAW,aACrB;AAI3C;qCACqC,GACrC,OAAO,YAAI,OAAQ,OAAO,eAAa,MAkBtC"}
@@ -0,0 +1,4 @@
1
+ import type { Bundle, Graph } from "@yaks/graph";
2
+ /** One canonical root workspace per computer filesystem. */ export declare let filesystemEid: (machine: string) => string;
3
+ export declare let localFilesystem: (g: Graph) => Promise<Bundle>;
4
+ //# sourceMappingURL=placement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"placement.d.ts","sources":["../placement.ts"],"names":[],"mappings":"AAEA,cAAc,MAAM,EAAQ,KAAK,2BAAgC;AAIjE,0DAA0D,GAC1D,OAAO,YAAI,gBAAiB,SAAS,MAAM,KAAG,MAAM,CACN;AAuB9C,OAAO,YAAI,kBAAmB,GAAG,UAAQ,QAAQ,QAMhD"}
@@ -0,0 +1,43 @@
1
+ import type { Bundle, Plugin, ReadTx } from "@yaks/graph";
2
+ import { type Landing, type Repo } from "./refs.js";
3
+ /** A release, read in full: what to commit, and the repository to commit it
4
+ * in. */ export type Released = Landing & {
5
+ repo: Repo;
6
+ };
7
+ /** How an application's releases become Git commits. */ export type Releases = {
8
+ /** the component that marks a bundle as a release — `deploy`, say */ comp: string;
9
+ /**
10
+ * Turns one committed bundle into a release to land, or returns `null` when
11
+ * there is nothing to commit: a bundle that is not a release, one whose
12
+ * manifest will not parse, or one this graph already holds a commit for.
13
+ * Everything the application knows and this package cannot — the manifest,
14
+ * the author, the clock, the stores — is read here.
15
+ */ of: (b: Bundle, tx: ReadTx) => Promise<Released | null> | Released | null;
16
+ };
17
+ /**
18
+ * The step itself: land every release in a committed transaction. An
19
+ * application with its own post-commit hook registry calls this directly;
20
+ * {@link commits} is the same step wrapped as a graph plugin.
21
+ */ export declare let minting: (r: Releases) => any;
22
+ /**
23
+ * The Git plugin: the `ref` component, and an `effect` hook that writes a Git
24
+ * commit for every release the transaction committed.
25
+ *
26
+ * ```ts
27
+ * import { loadVocab } from '@yaks/vocab'
28
+ * import { graph } from '@yaks/graph'
29
+ * import { ram } from '@yaks/ram'
30
+ * import { commits, refDoc } from '@yaks/git'
31
+ *
32
+ * let deploy = { $defs: { deploy: { component: true, type: 'object' } } }
33
+ * let vocab = loadVocab([refDoc, deploy])
34
+ * // `of` says where each deploy lands, or null for one already committed.
35
+ * let plugin = commits({ comp: 'deploy', of: async () => null })
36
+ * let g = graph({ storage: ram(vocab), vocab, plugins: [plugin] })
37
+ * ```
38
+ *
39
+ * The Git object components are not part of this plugin's vocabulary: an
40
+ * application that keeps them in a store of their own loads {@link gitDoc}
41
+ * there, and this plugin's graph is wherever the branches are.
42
+ */ export declare let commits: (r: Releases) => Plugin;
43
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sources":["../plugin.ts"],"names":[],"mappings":"AAkBA,cAAc,MAAM,EAAE,MAAM,EAAE,MAAM,2BAAgC;AAEpE,SAAqB,KAAK,OAAO,EAAE,KAAK,IAAI,oBAAmB;AAE/D;OACO,GACP,YAAY,WAAW;EAAY,MAAM;;AAEzC,sDAAsD,GACtD,YAAY;EACV,mEAAmE,GACnE,MAAM,MAAM;EACZ;;;;;;GAMC,GACD,KAAK,GAAG,QAAQ,IAAI,WAAW,QAAQ,WAAW,IAAI,IAAI,WAAW,IAAI;;AAG3E;;;;CAIC,GACD,OAAO,YAAI,UACR,GAAG,iBAMH;AAEH;;;;;;;;;;;;;;;;;;;;CAoBC,GACD,OAAO,YAAI,UAAW,GAAG,aAAW,OAYnC"}
@@ -0,0 +1,20 @@
1
+ import { commitParts } from "./commit.js";
2
+ import type { Oids } from "./oid.js";
3
+ import { type Repo } from "./refs.js";
4
+ import { type ReadObject } from "./unpack.js";
5
+ type Revision = {
6
+ oid: string;
7
+ bytes: Uint8Array;
8
+ } & ReturnType<typeof commitParts>;
9
+ type Change = {
10
+ tree: string | null;
11
+ commit: Revision;
12
+ };
13
+ /** Follow the branch through the first parent that reaches its former tip. */ export declare let pushedCommits: (before: string | null, tip: string, read: ReadObject) => Promise<Revision[]>;
14
+ /** The names a commit's snapshot holds in one root directory. */ export declare let namesAt: (commit: string, read: ReadObject, folder: string) => Promise<string[]>;
15
+ /** Give a space commit an app root and app parents for the split history. */ export declare let projectCommit: (repo: Pick<Repo, 'objects' | 'bytes'>, bytes: Uint8Array, tree: string, parent: string | null, repository: string) => Promise<Oids>;
16
+ /** Group changed subtrees by directory in branch order. */ export declare let pushChanges: (before: string | null, tip: string, read: ReadObject, folder: string) => Promise<{
17
+ commits: Revision[];
18
+ changes: Map<string, Change[]>;
19
+ }>;
20
+ //# sourceMappingURL=project.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project.d.ts","sources":["../project.ts"],"names":[],"mappings":"AAAA,SAAS,WAAW,sBAAsC;AAE1D,cAAc,IAAI,mBAAkB;AACpC,SAAoB,KAAK,IAAI,oBAAmB;AAChD,SAAkB,KAAK,UAAU,sBAAqB;KAGjD;EACC,KAAK,MAAM;EAAE,OAAO;IACtB,kBAAkB;KACjB;EAAW,MAAM,MAAM,GAAG,IAAI;EAAE,QAAQ;;AAE7C,4EAA4E,GAC5E,OAAO,YAAI,gBACT,QAAQ,MAAM,GAAG,IAAI,EACrB,KAAK,MAAM,EACX,MAAM,eACL,QAAQ,YAoCV;AAsBD,+DAA+D,GAC/D,OAAO,YAAI,UACT,QAAQ,MAAM,EACd,MAAM,YACN,QAAQ,MAAM,KACb,QAAQ,MAAM,IAKhB;AAmBD,2EAA2E,GAC3E,OAAO,YAAI,gBACT,MAAM,KAAK,MAAM,YAAY,UAC7B,OAAO,YACP,MAAM,MAAM,EACZ,QAAQ,MAAM,GAAG,IAAI,EACrB,YAAY,MAAM,KACjB,QAAQ,MAeV;AAED,yDAAyD,GACzD,OAAO,YAAI,cACT,QAAQ,MAAM,GAAG,IAAI,EACrB,KAAK,MAAM,EACX,MAAM,YACN,QAAQ,MAAM,KACb;EAAU,SAAS;EAAY,SAAS,IAAI,MAAM,EAAE;GAgBtD"}
@@ -0,0 +1,42 @@
1
+ import { type Clock } from "@yaks/fp";
2
+ import type { Kind } from "./oid.js";
3
+ import type { Obj } from "./pack.js";
4
+ import type { Objects } from "./objects.js";
5
+ import { type Ref, type Refs } from "./http.js";
6
+ import { type ReadObject } from "./unpack.js";
7
+ export declare let ZERO: string;
8
+ export type Update = {
9
+ name: string;
10
+ before: string | null;
11
+ after: string;
12
+ };
13
+ export type Push = {
14
+ update: Update;
15
+ objects: Map<string, Obj>;
16
+ read: ReadObject;
17
+ /** what an object is, answered without reading it where a pushed or
18
+ * replaced tree names it */ kind: (id: string) => Promise<Kind | undefined>;
19
+ };
20
+ export type Receiver = {
21
+ branch: string;
22
+ base?: string;
23
+ accept: (push: Push) => Promise<void>;
24
+ /** a stage of receiving, on the host's clock */ time?: <T>(stage: string, work: () => Promise<T>) => Promise<T>;
25
+ /** How long the host can wait for the final report before sending the
26
+ * unpack status and streaming the rest. Called after pack validation. */ streamAfter?: () => {
27
+ ms: number;
28
+ clock?: Clock;
29
+ } | undefined;
30
+ };
31
+ /** The answer to `GET <repo>/info/refs?service=git-receive-pack`. `listed`
32
+ * hears the refs it advertised, as a host warms what the push will read. */ export declare let advertiseReceive: (refs: Refs, listed?: (refs: Ref[]) => void) => Promise<Response>;
33
+ /** Reads into this isolate's memory what a push onto `refs` reads first, a
34
+ * level at a time: each tip's commit, its root tree, and the trees directly
35
+ * in that (a space's `apps`). The client builds its pack between the
36
+ * advertisement and its push, which a host spends on these. */ export declare let warm: (refs: Ref[], objects: Objects) => Promise<void>;
37
+ /** Receive one ref update over smart HTTP. The host advances its guarded ref
38
+ * only after the associated write succeeds. */ export declare let receivePack: (req: Request, refs: Refs, objects: Objects, receiver: Receiver) => Promise<Response>;
39
+ export { BadPush } from "./unpack.js";
40
+ export { carriedOf, importPush } from "./import.js";
41
+ export { namesAt, projectCommit, pushChanges, pushedCommits } from "./project.js";
42
+ //# sourceMappingURL=push.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"push.d.ts","sources":["../push.ts"],"names":[],"mappings":"AACA,SAAS,KAAK,KAAK,wBAAqC;AAGxD,cAAc,IAAI,mBAAkB;AACpC,cAAc,GAAG,oBAAmB;AAEpC,cAAc,OAAO,uBAAsB;AAC3C,SAAkB,KAAK,GAAG,EAAE,KAAK,IAAI,oBAAmB;AAExD,SAA8B,KAAK,UAAU,sBAA6B;AAE1E,OAAO,YAAI,MAAM,MAAM,CAAiB;AAExC,YAAY;EAAW,MAAM,MAAM;EAAE,QAAQ,MAAM,GAAG,IAAI;EAAE,OAAO,MAAM;;AACzE,YAAY;EACV,QAAQ;EACR,SAAS,IAAI,MAAM,EAAE;EACrB,MAAM;EACN;4BAC0B,GAC1B,OAAO,IAAI,MAAM,KAAK,QAAQ,OAAO,SAAS;;AAEhD,YAAY;EACV,QAAQ,MAAM;EACd,OAAO,MAAM;EACb,SAAS,MAAM,SAAS,QAAQ,IAAI;EACpC,8CAA8C,GAC9C,QAAQ,GAAG,OAAO,MAAM,EAAE,YAAY,QAAQ,OAAO,QAAQ;EAC7D;yEACuE,GACvE;IAAsB,IAAI,MAAM;IAAE,QAAQ;MAAU,SAAS;;AAY/D;0EAC0E,GAC1E,OAAO,YAAI,mBACT,MAAM,MACN,UAAS,MAAM,UAAU,IAAI,KAC5B,QAAQ,UAIV;AAoHD;;;6DAG6D,GAC7D,OAAO,YAAI,OAAc,MAAM,OAAO,SAAS,YAAU,QAAQ,IAAI,EAuBpE;AAiKD;6CAC6C,GAC7C,OAAO,YAAI,cACT,KAAK,SACL,MAAM,MACN,SAAS,SACT,UAAU,aACT,QAAQ,UA8EV;AAED,SAAS,OAAO,sBAAqB;AACrC,SAAS,SAAS,EAAE,UAAU,sBAAqB;AACnD,SACE,OAAO,EACP,aAAa,EACb,WAAW,EACX,aAAa,uBACM"}
@@ -0,0 +1,81 @@
1
+ import { type Blobs } from "@yaks/blob";
2
+ import type { Bundle, Eid } from "@yaks/graph";
3
+ import { type Who } from "./commit.js";
4
+ import { MAIN } from "./http.js";
5
+ import { index, type Writes } from "./index.js";
6
+ import type { Oids } from "./oid.js";
7
+ import type { Files } from "./tree.js";
8
+ /**
9
+ * The two graphs and the byte store a repository is kept in.
10
+ *
11
+ * `refs` and `objects` may be the same graph — nothing here needs them
12
+ * separate — but they are two arguments because a server that decides read
13
+ * access per repository keeps its branches where that decision is made, and
14
+ * its objects, which are global, in a store of their own.
15
+ */ export type Repo = {
16
+ /** the graph the `ref` row lives in */ refs: Writes;
17
+ /** the graph the objects live in */ objects: Writes;
18
+ /** the bytes: a tree's and a commit's, and the file a blob names */ bytes: Blobs;
19
+ };
20
+ /** One release, as landing it on a branch needs it. */ export type Landing = {
21
+ /** the entity the repository belongs to */ app: Eid;
22
+ /** the branch; defaults to `refs/heads/main` */ branch?: string;
23
+ /** the manifest: path → the SHA-256 the byte store holds that file under */ files: Files;
24
+ /** who made the change */ author: Who;
25
+ /** who recorded it — the platform writing the commit */ committer: Who;
26
+ /** the commit message */ message: string;
27
+ headers?: Record<string, string>;
28
+ /**
29
+ * The manifest a commit on this branch was made from, where the caller
30
+ * knows it. The new manifest is folded against the branch's last commit
31
+ * (./index.ts `Base`), so a release reads and writes only what it changed;
32
+ * without it, every file is named again.
33
+ */ was?: (commit: string) => Files | null | Promise<Files | null>;
34
+ /**
35
+ * Rows the caller wants recorded about this commit, written in the same
36
+ * transaction as the moved ref. This package writes no row joining a commit
37
+ * to whatever it was built from: those rows belong to whoever builds it.
38
+ */ beside?: (oids: Oids) => Bundle[];
39
+ };
40
+ /**
41
+ * Where a branch points: the commit its ref names, or `null` before the first
42
+ * commit. This is all of `ls-refs` on the server's side, so whatever mounts
43
+ * the HTTP handlers reads a branch through this rather than by querying the
44
+ * row itself.
45
+ */ export declare let refAt: (refs: Pick<Writes, 'read'>, app: Eid) => Promise<string | null>;
46
+ /** The row that points a branch at a commit. */ export declare let moved: (app: Eid, name: string, commit: string) => Bundle;
47
+ /** Advance a ref only from the tip its writer read. */ export declare let advancing: (repo: Eid, name: string, before: string | null, after: string) => Bundle;
48
+ /** A ref held at the tip its writer read, moving nothing: the write it rides
49
+ * in is refused once another writer has moved the ref. */ export declare let unmoved: (repo: Eid, name: string, at: string | null) => Bundle;
50
+ /** Whether a guarded ref write lost to another writer. */ export declare let refMoved: (error: unknown, ref: Eid) => boolean;
51
+ /**
52
+ * One manifest as a commit on a branch: every object it needs written, the
53
+ * branch pointed at it, and whatever the caller passes in `beside` written in
54
+ * that same transaction. Returns the commit's two ids.
55
+ *
56
+ * The parent is wherever the branch points now, read here rather than passed
57
+ * in by the caller, so the chain follows the order the releases actually
58
+ * happened in.
59
+ */ export declare let commitOnto: (repo: Repo, l: Landing) => Promise<Oids>;
60
+ /** Bytes a batch's caller already has ({@link preparing}): `held` by their
61
+ * SHA-256, and `kept` once the caller's own puts of them have landed. */ export type InHand = {
62
+ held?: ReadonlyMap<string, Uint8Array>;
63
+ kept?: Promise<unknown>;
64
+ };
65
+ /** Build several objects with batched graph writes. Their bodies are kept
66
+ * before a batch can publish pointers to them. A blob named over `held` bytes
67
+ * is hashed from them, never read back from the store, and nothing is
68
+ * published before `kept` has landed, so the caller's puts and the batch's
69
+ * work go on at once. */ export declare let preparing: <T>(repo: Pick<Repo, 'objects' | 'bytes'>, build: (git: ReturnType<typeof index>) => Promise<T>, _dts_1: never) => Promise<T>;
70
+ /** A published commit and its root tree, both addressed by content. */ export type CommitTree = {
71
+ commit: Oids;
72
+ tree: Oids;
73
+ };
74
+ /** Build a commit with the object writer the caller is already using. A
75
+ * caller holding the published parent can supply its commit and tree IDs,
76
+ * and one still reading who made the change hands its author as a promise:
77
+ * the tree is made meanwhile, and only the commit waits for it. */ export declare let buildCommit: (repo: Pick<Repo, 'objects' | 'bytes'>, l: Pick<Landing, 'files' | 'committer' | 'message' | 'headers' | 'was'> & {
78
+ author: Landing['author'] | Promise<Landing['author']>;
79
+ }, at: string | CommitTree | null) => (git: ReturnType<typeof index>) => Promise<CommitTree>;
80
+ /** Write immutable objects before the caller's transaction moves its refs. */ export declare let prepareCommit: (repo: Parameters<typeof buildCommit>[0], l: Parameters<typeof buildCommit>[1], at: Parameters<typeof buildCommit>[2], had?: InHand) => Promise<CommitTree>;
81
+ //# sourceMappingURL=refs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refs.d.ts","sources":["../refs.ts"],"names":[],"mappings":"AAuBA,SAAS,KAAK,KAAK,0BAAyC;AAC5D,cAAc,MAAM,EAAQ,GAAG,2BAAgC;AAI/D,SAAiB,KAAK,GAAG,sBAAqB;AAE9C,SAAS,IAAI,oBAAmB;AAChC,SAAoB,KAAK,EAAS,KAAK,MAAM,qBAAoB;AACjE,cAAc,IAAI,mBAAkB;AACpC,cAAc,KAAK,oBAAmB;AAUtC;;;;;;;CAOC,GACD,YAAY;EACV,qCAAqC,GACrC,MAAM;EACN,kCAAkC,GAClC,SAAS;EACT,kEAAkE,GAClE,OAAO;;AAGT,qDAAqD,GACrD,YAAY;EACV,yCAAyC,GACzC,KAAK;EACL,8CAA8C,GAC9C,SAAS,MAAM;EACf,0EAA0E,GAC1E,OAAO;EACP,wBAAwB,GACxB,QAAQ;EACR,sDAAsD,GACtD,WAAW;EACX,uBAAuB,GACvB,SAAS,MAAM;EACf,UAAU,OAAO,MAAM,EAAE,MAAM;EAC/B;;;;;GAKC,GACD,OAAO,QAAQ,MAAM,KAAK,QAAQ,IAAI,GAAG,QAAQ,QAAQ,IAAI;EAC7D;;;;GAIC,GACD,UAAU,MAAM,SAAS;;AAG3B;;;;;CAKC,GACD,OAAO,YAAI,QACT,MAAM,KAAK,QAAQ,SACnB,KAAK,QAEJ,QAAQ,MAAM,GAAG,IAAI,EAIvB;AA8BD,8CAA8C,GAC9C,OAAO,YAAI,QAAS,KAAK,KAAK,MAAM,MAAM,EAAE,QAAQ,MAAM,KAAG,OAG3D;AAEF,qDAAqD,GACrD,OAAO,YAAI,YACT,MAAM,KACN,MAAM,MAAM,EACZ,QAAQ,MAAM,GAAG,IAAI,EACrB,OAAO,MAAM,KACZ,OAGD;AAEF;wDACwD,GACxD,OAAO,YAAI,UACT,MAAM,KACN,MAAM,MAAM,EACZ,IAAI,MAAM,GAAG,IAAI,KAChB,OAGD;AAEF,wDAAwD,GACxD,OAAO,YAAI,WAAY,OAAO,OAAO,EAAE,KAAK,QAAM,OAAO,CAEjC;AAExB;;;;;;;;CAQC,GACD,OAAO,YAAI,aACT,MAAM,MACN,GAAG,YACF,QAAQ,MASV;AAED;uEACuE,GACvE,YAAY;EACV,OAAO,YAAY,MAAM,EAAE;EAC3B,OAAO,QAAQ,OAAO;;AAGxB;;;;uBAIuB,GACvB,OAAO,YAAI,YAAmB,GAC5B,MAAM,KAAK,MAAM,YAAY,UAC7B,QAAQ,KAAK,kBAAkB,WAAW,QAAQ,IAClD,kBACC,QAAQ,GAeV;AAkBD,qEAAqE,GACrE,YAAY;EAAe,QAAQ;EAAM,MAAM;;AAE/C;;;iEAGiE,GACjE,OAAO,YAAI,cACT,MAAM,KAAK,MAAM,YAAY,UAC7B,GACI,KAAK,SAAS,UAAU,cAAc,YAAY,YAAY;EAC5D,QAAQ,QAAQ,YAAY,QAAQ,QAAQ;GAClD,IAAI,MAAM,GAAG,aAAa,IAAI,MAC5B,KAAK,kBAAkB,WAAW,QAAQ,YAwB7C;AAED,4EAA4E,GAC5E,OAAO,YAAI,gBACT,MAAM,kBAAkB,aAAa,IACrC,GAAG,kBAAkB,aAAa,IAClC,IAAI,kBAAkB,aAAa,IACnC,MAAM,WACL,QAAQ,YAA6D"}
@@ -0,0 +1,35 @@
1
+ import { commitParts } from "./commit.js";
2
+ import type { Oids } from "./oid.js";
3
+ import { type Repo } from "./refs.js";
4
+ import { type Entry } from "./tree.js";
5
+ export type Snapshot = {
6
+ oid: string;
7
+ parents: string[];
8
+ entries: Entry[];
9
+ };
10
+ export type Revision = ReturnType<typeof commitParts> & {
11
+ bytes: Uint8Array;
12
+ };
13
+ type Rewritten = ReturnType<typeof commitParts> & {
14
+ before: string;
15
+ oid: string;
16
+ };
17
+ /** What rewrites of one branch have read and written. Passed to a rewrite of
18
+ * a later tip, it reads and writes only the commits that landed since, so a
19
+ * rewrite that lost its ref to a push can be made again onto the new tip at
20
+ * the cost of what the push brought. What a rewrite wrote is read back from
21
+ * here only by a tip that reaches it, which only a stored object can be. */ export type Rewrites = {
22
+ history: Map<string, Revision>;
23
+ trees: Map<string, Entry[]>;
24
+ named: Map<string, Oids>;
25
+ rooted: Map<string, string>;
26
+ made: Map<string, string>;
27
+ };
28
+ export declare let rewrites: () => Rewrites;
29
+ /** Remove selected entries from one root directory throughout a branch.
30
+ * The selector sees the original snapshots in parent order. Commits whose
31
+ * tree and parents stand keep their exact object IDs. */ export declare let rewriteDirectory: (repo: Pick<Repo, 'objects' | 'bytes'>, tip: string, folder: string, remove: (snapshot: Snapshot) => Set<string>, memo?: Rewrites) => Promise<{
32
+ tip: string;
33
+ rewritten: Rewritten[];
34
+ }>;
35
+ //# sourceMappingURL=rewrite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rewrite.d.ts","sources":["../rewrite.ts"],"names":[],"mappings":"AAAA,SAAS,WAAW,sBAAsC;AAG1D,cAAc,IAAI,mBAAkB;AACpC,SAAoB,KAAK,IAAI,oBAAmB;AAChD,SAAc,KAAK,KAAK,oBAAgC;AAExD,YAAY;EACV,KAAK,MAAM;EACX,SAAS,MAAM;EACf,SAAS;;AAGX,YAAY,WAAW,kBAAkB;EAAiB,OAAO;;KAC5D,YAAY,kBAAkB;EACjC,QAAQ,MAAM;EACd,KAAK,MAAM;;AAsBb;;;;0EAI0E,GAC1E,YAAY;EACV,SAAS,IAAI,MAAM,EAAE;EACrB,OAAO,IAAI,MAAM,EAAE;EACnB,OAAO,IAAI,MAAM,EAAE;EACnB,QAAQ,IAAI,MAAM,EAAE,MAAM;EAC1B,MAAM,IAAI,MAAM,EAAE,MAAM;;AAG1B,OAAO,YAAI,gBAAe,SAMxB;AAEF;;uDAEuD,GACvD,OAAO,YAAI,mBACT,MAAM,KAAK,MAAM,YAAY,UAC7B,KAAK,MAAM,EACX,QAAQ,MAAM,EACd,SAAS,UAAU,aAAa,IAAI,MAAM,GAC1C,OAAM,aACL;EAAU,KAAK,MAAM;EAAE,WAAW;GAwGpC"}
@@ -0,0 +1,35 @@
1
+ import type { Graph } from "@yaks/graph";
2
+ import { type Held } from "./host.js";
3
+ declare let HOUR: number;
4
+ /** How long Git must have left a worktree alone before it is taken back. */ export declare let IDLE: any;
5
+ /** How long a worktree that still holds work must be left alone before it is
6
+ * shelved (./host.ts `shelve`): its work committed onto its branch and the
7
+ * checkout removed. Three days, past any agent's run. */ export declare let STALE: any;
8
+ /** How long the service waits between passes. */ export declare let EVERY: any;
9
+ /** Where agents cut checkouts of their own: Claude Code's, inside the primary
10
+ * checkout. */ export declare let ROOTS: readonly [string];
11
+ export type Options = {
12
+ /** milliseconds without Git touching a worktree (default {@link IDLE}) */ idle?: number;
13
+ /** milliseconds without Git touching a worktree that still holds work
14
+ * before it is shelved (default {@link STALE}) */ stale?: number;
15
+ /** milliseconds between passes (default {@link EVERY}) */ every?: number;
16
+ /** directories whose checkouts are agents' own, taken back like managed
17
+ * ones; a relative one is inside the repository's primary checkout
18
+ * (default {@link ROOTS}) */ roots?: string[];
19
+ };
20
+ /** Whether a checkout lies under one of these directories. */ export declare let within: (path: string, roots: string[]) => boolean;
21
+ /** Take back every idle worktree of the repository at `common` that holds
22
+ * nothing, managed or under one of `roots`, shelve each one `stale` that
23
+ * still holds work, and return the idle ones kept, with why. A `signal` that
24
+ * aborts ends the pass before the next worktree. */ export declare let collect: (g: Graph, common: string, idle?: number, now?: number, processes?: () => Promise<Set<string>>, signal?: AbortSignal, roots?: string[], stale?: number) => Promise<Record<string, Held>>;
25
+ /** Collect every repository the graph knows that is on this machine, for as
26
+ * long as `signal` lets it: one pass when it has already aborted, the way a
27
+ * one-shot command runs a service. A removal Git refused is reported; a
28
+ * worktree kept for what it holds is not, since that is an agent's work in
29
+ * progress. */ export declare let service: (host: {
30
+ graph: Graph;
31
+ report?: (error: unknown, context: {
32
+ tags: Record<string, string>;
33
+ }) => void | Promise<void>;
34
+ }, options?: Options, signal?: AbortSignal, processes?: () => Promise<Set<string>>) => Promise<void>;
35
+ //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.d.ts","sources":["../service.ts"],"names":[],"mappings":"AAOA,cAAoB,KAAK,2BAAgC;AAGzD,SAEE,KAAK,IAAI,oBAWO;AAElB,YAAI;AAEJ,0EAA0E,GAC1E,OAAO,YAAI,UAAkB;AAC7B;;uDAEuD,GACvD,OAAO,YAAI,WAAiB;AAC5B,+CAA+C,GAC/C,OAAO,YAAI,WAAY;AACvB;aACa,GACb,OAAO,YAAI,yBAA6B;AAExC,YAAY;EACV,wEAAwE,GACxE,OAAO,MAAM;EACb;kDACgD,GAChD,QAAQ,MAAM;EACd,wDAAwD,GACxD,QAAQ,MAAM;EACd;;6BAE2B,GAC3B,QAAQ,MAAM;;AAMhB,4DAA4D,GAC5D,OAAO,YAAI,SAAU,MAAM,MAAM,EAAE,OAAO,MAAM,OAAK,OAAO,CACW;AAcvE;;;kDAGkD,GAClD,OAAO,YAAI,UACT,GAAG,OACH,QAAQ,MAAM,EACd,OAAM,MAAM,EACZ,MAAK,MAAM,EACX,kBAAiB,QAAQ,IAAI,MAAM,IACnC,SAAS,aACT,QAAO,MAAM,IACb,QAAO,MAAM,KACZ,QAAQ,OAAO,MAAM,EAAE,OAuCzB;AAED;;;;aAIa,GACb,OAAO,YAAI,UACT;EACE,OAAO;EACP,UACE,OAAO,OAAO,EACd;IAAW,MAAM,OAAO,MAAM,EAAE,MAAM;QACnC,IAAI,GAAG,QAAQ,IAAI;GAE1B,UAAS,SACT,SAAQ,aACR,kBAAiB,QAAQ,IAAI,MAAM,OAClC,QAAQ,IAAI,EAmDd"}
@@ -0,0 +1,11 @@
1
+ /** A digest in progress: bytes in, the twenty bytes that name them out. */ export type Sha1 = {
2
+ /** fold another run of bytes in */ update: (bytes: Uint8Array) => void;
3
+ /** pad, finish, and return the twenty bytes — once */ digest: () => Uint8Array<ArrayBuffer>;
4
+ };
5
+ /** Start a SHA-1: the runtime's own where it has one, else
6
+ * {@link portableSha1}. */ export declare let sha1: () => Sha1;
7
+ /** Start a SHA-1 in script, for a runtime without `node:crypto`. The
8
+ * algorithm is FIPS 180-4 section 6.1.2 verbatim, in 32-bit integer
9
+ * arithmetic: the `| 0` after every addition is what keeps a JavaScript number
10
+ * a machine word. */ export declare let portableSha1: () => Sha1;
11
+ //# sourceMappingURL=sha1.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sha1.d.ts","sources":["../sha1.ts"],"names":[],"mappings":"AAqBA,yEAAyE,GACzE,YAAY;EACV,iCAAiC,GACjC,SAAS,OAAO,eAAe,IAAI;EACnC,oDAAoD,GACpD,cAAc,WAAW;;AAwB3B;yBACyB,GACzB,OAAO,YAAI,YAAW,KAAkD;AAIxE;;;mBAGmB,GACnB,OAAO,YAAI,oBAAmB,KAqF7B"}
@@ -0,0 +1,12 @@
1
+ import { type Run } from "./land.js";
2
+ export declare let repoPath: (path: string) => boolean;
3
+ /** A commit's regular-file blobs: `(commit, paths)` maps each path the commit
4
+ * holds as a regular file to its blob id. A commit never changes, so each path
5
+ * is asked of Git once while its commit is among the `keep` read most
6
+ * recently, however many callers ask at once; a read Git refused is asked
7
+ * again next time. */ export declare let trees: (cwd: string, _dts_1: never) => (commit: string, paths: string[]) => Promise<Map<string, string>>;
8
+ /** Every commit an abbreviated or full sha names in the repository at `cwd`,
9
+ * by its full sha, as Git reads one: the one it names, none, or each of
10
+ * several that start that way, which Git refuses to choose between. */ export declare let commitsOf: (cwd: string, sha: string, ask?: Run) => Promise<string[]>;
11
+ /** All checkout roots, including the primary; observation never prunes Git. */ export declare let rootsOf: (common: string, ask?: Run) => Promise<string[]>;
12
+ //# sourceMappingURL=source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source.d.ts","sources":["../source.ts"],"names":[],"mappings":"AAGA,SAAS,KAAK,GAAG,oBAAwB;AAKzC,OAAO,YAAI,WAAY,MAAM,MAAM,KAAG,OAAO,CAE2B;AA0BxE;;;;oBAIoB,GACpB,OAAO,YAAI,QACT,KAAK,MAAM,EACX,mBACE,QAAQ,MAAM,EAAE,OAAO,MAAM,OAAO,QAAQ,IAAI,MAAM,EAAE,MAAM,GA+BjE;AAGD;;qEAEqE,GACrE,OAAO,YAAI,YACT,KAAK,MAAM,EACX,KAAK,MAAM,EACX,MAAK,QACJ,QAAQ,MAAM,IAchB;AAED,6EAA6E,GAC7E,OAAO,YAAI,UACT,QAAQ,MAAM,EACd,MAAK,QACJ,QAAQ,MAAM,IAUhB"}
@@ -0,0 +1,11 @@
1
+ import type { Bundle, Graph } from "@yaks/graph";
2
+ import type { Runs } from "@yaks/graph/tools";
3
+ import { land, type LandOps } from "./land.js";
4
+ /** Landing with Git supplied at the effect boundary. Each commit that landed
5
+ * is recorded as `commit{target, message}`, its eid the sha, created through
6
+ * the caller's session; its target is the task its first line names. */ export declare let landing: (run: typeof land, report?: LandOps['report']) => any;
7
+ /** The implementations of the tools ./vocab.json declares. The host's
8
+ * `report` hears a failure land catches and carries on past. */ export declare let runs: (host?: {
9
+ report?: LandOps['report'];
10
+ }) => Runs;
11
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sources":["../tools.ts"],"names":[],"mappings":"AAwBA,cAAc,MAAM,EAAQ,KAAK,2BAAgC;AAGjE,cAAc,IAAI,iCAAsC;AAQxD,SAAS,IAAI,EAAE,KAAK,OAAO,oBAA+B;AAoG1D;;sEAEsE,GACtE,OAAO,YAAI,UACR,YAAY,MAAM,SAAS,QAAQ,kBA2CnC;AAEH;8DAC8D,GAC9D,OAAO,YAAI,OAAQ;EAAS,SAAS,QAAQ;MAAc,KA2HzD"}
@@ -0,0 +1,28 @@
1
+ /** A regular file's mode, as a tree body writes it. */ export declare let FILE: string;
2
+ /** A directory's mode — no leading zero, unlike `git ls-tree`'s printing. */ export declare let DIR: string;
3
+ /** One child of a tree: its name here, its mode, and its id. The id is
4
+ * whichever of the two ids is being written — a SHA-256 body names its
5
+ * children by their `oid256` (see ./oid.ts). */ export type Entry = {
6
+ name: string;
7
+ mode: string;
8
+ oid: string;
9
+ };
10
+ /** A version's files, in the shape a yaks.app deploy manifest already has:
11
+ * the path the app serves the file at, and the SHA-256 of its bytes. */ export type Files = Record<string, string>;
12
+ /** A directory of a manifest: files by name, and the directories under it. */ export type Dir = {
13
+ files: Map<string, string>;
14
+ dirs: Map<string, Dir>;
15
+ };
16
+ /** The entries in the order a tree stores them. */ export declare let sorted: (entries: Entry[]) => Entry[];
17
+ /** A tree object's body: every child, in git's order. */ export declare let treeBody: (entries: Entry[]) => Uint8Array<ArrayBuffer>;
18
+ /** A tree body's children, in their stored order. `width` is the number of
19
+ * bytes in each raw object id: 20 for SHA-1, 32 for SHA-256. */ export declare let treeEntries: (body: Uint8Array, width?: number) => Entry[];
20
+ /**
21
+ * A flat manifest folded into directories: `{'lib/a.js': sha}` becomes a root
22
+ * holding one directory `lib` holding one file `a.js`.
23
+ *
24
+ * Leading and doubled slashes are ignored, `.` means this directory, and `..`
25
+ * is refused: a manifest that points out of its own root has no tree it could
26
+ * become.
27
+ */ export declare let nest: (files: Files) => Dir;
28
+ //# sourceMappingURL=tree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree.d.ts","sources":["../tree.ts"],"names":[],"mappings":"AAqBA,qDAAqD,GACrD,OAAO,YAAI,aAAe;AAE1B,2EAA2E,GAC3E,OAAO,YAAI,YAAa;AAExB;;8CAE8C,GAC9C,YAAY;EAAU,MAAM,MAAM;EAAE,MAAM,MAAM;EAAE,KAAK,MAAM;;AAE7D;sEACsE,GACtE,YAAY,QAAQ,OAAO,MAAM,EAAE,MAAM;AAEzC,4EAA4E,GAC5E,YAAY;EAAQ,OAAO,IAAI,MAAM,EAAE,MAAM;EAAG,MAAM,IAAI,MAAM,EAAE;;AAgBlE,iDAAiD,GACjD,OAAO,YAAI,SAAU,SAAS,YAAU,QACY;AAEpD,uDAAuD,GACvD,OAAO,YAAI,WAAY,SAAS,YAAU,WAAW,aAKlD;AAEH;8DAC8D,GAC9D,OAAO,YAAI,cAAe,MAAM,YAAY,mBAAa,QA2BxD;AASD;;;;;;;CAOC,GACD,OAAO,YAAI,OAAQ,OAAO,UAAQ,IAoBjC"}
@@ -0,0 +1,5 @@
1
+ import type { Obj } from "./pack.js";
2
+ export declare class BadPush extends Error {
3
+ }
4
+ export type ReadObject = (id: string) => Promise<Obj | undefined>;
5
+ //# sourceMappingURL=unpack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unpack.d.ts","sources":["../unpack.ts"],"names":[],"mappings":"AAEA,cAAc,GAAG,oBAAmB;AAOpC,OAAO,cAAM,gBAAgB;AAAO;AAkJpC,YAAY,cAAc,IAAI,MAAM,KAAK,QAAQ,MAAM,SAAS"}