@fungi.computer/agar 0.0.0-stage → 0.0.1

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 (159) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +766 -2
  3. package/dist/agent-message-meta.d.ts +74 -0
  4. package/dist/agent-message-meta.js +63 -0
  5. package/dist/agents.d.ts +170 -0
  6. package/dist/agents.js +218 -0
  7. package/dist/app-build-contract.d.ts +43 -0
  8. package/dist/app-build-contract.js +24 -0
  9. package/dist/apps.d.ts +66 -0
  10. package/dist/apps.js +47 -0
  11. package/dist/backend-declaration.d.ts +6 -0
  12. package/dist/backend-declaration.js +65 -0
  13. package/dist/backend-definition.d.ts +88 -0
  14. package/dist/backend-definition.js +158 -0
  15. package/dist/backend-refusal.d.ts +10 -0
  16. package/dist/backend-refusal.js +10 -0
  17. package/dist/backend.d.ts +30 -0
  18. package/dist/backend.js +28 -0
  19. package/dist/capabilities.d.ts +30 -0
  20. package/dist/capabilities.js +50 -0
  21. package/dist/channels.d.ts +142 -0
  22. package/dist/channels.js +97 -0
  23. package/dist/commands.d.ts +33 -0
  24. package/dist/commands.js +46 -0
  25. package/dist/computer-contracts.d.ts +73 -0
  26. package/dist/computer-contracts.js +57 -0
  27. package/dist/computer.d.ts +294 -0
  28. package/dist/computer.js +319 -0
  29. package/dist/connect.d.ts +11 -0
  30. package/dist/connect.js +211 -0
  31. package/dist/errors.d.ts +34 -0
  32. package/dist/errors.js +106 -0
  33. package/dist/failure.d.ts +2 -0
  34. package/dist/failure.js +9 -0
  35. package/dist/files.d.ts +25 -0
  36. package/dist/files.js +84 -0
  37. package/dist/game-servers.d.ts +530 -0
  38. package/dist/game-servers.js +244 -0
  39. package/dist/gills.d.ts +43 -0
  40. package/dist/gills.js +174 -0
  41. package/dist/git-commit.d.ts +143 -0
  42. package/dist/git-commit.js +251 -0
  43. package/dist/git-rpc.d.ts +310 -0
  44. package/dist/git-rpc.js +166 -0
  45. package/dist/git-steps.d.ts +579 -0
  46. package/dist/git-steps.js +804 -0
  47. package/dist/git-wire.d.ts +33 -0
  48. package/dist/git-wire.js +240 -0
  49. package/dist/git.d.ts +322 -0
  50. package/dist/git.js +98 -0
  51. package/dist/host.d.ts +97 -0
  52. package/dist/host.js +732 -0
  53. package/dist/inbox.d.ts +99 -0
  54. package/dist/inbox.js +184 -0
  55. package/dist/index.d.ts +31 -0
  56. package/dist/index.js +15 -0
  57. package/dist/inference.d.ts +17 -0
  58. package/dist/inference.js +115 -0
  59. package/dist/internal/app-error.d.ts +8 -0
  60. package/dist/internal/app-error.js +36 -0
  61. package/dist/internal/app-session.d.ts +8 -0
  62. package/dist/internal/app-session.js +551 -0
  63. package/dist/internal/back-inputs.d.ts +22 -0
  64. package/dist/internal/back-inputs.js +93 -0
  65. package/dist/internal/browser-bridge.d.ts +30 -0
  66. package/dist/internal/browser-bridge.js +203 -0
  67. package/dist/internal/capabilities.d.ts +13 -0
  68. package/dist/internal/capabilities.js +138 -0
  69. package/dist/internal/commands.d.ts +9 -0
  70. package/dist/internal/commands.js +257 -0
  71. package/dist/internal/disconnect-host.d.ts +7 -0
  72. package/dist/internal/disconnect-host.js +19 -0
  73. package/dist/internal/git-edit-tree.d.ts +6 -0
  74. package/dist/internal/git-edit-tree.js +46 -0
  75. package/dist/internal/memory-fs.d.ts +39 -0
  76. package/dist/internal/memory-fs.js +154 -0
  77. package/dist/internal/protocol.d.ts +116 -0
  78. package/dist/internal/protocol.js +6 -0
  79. package/dist/internal/query-feed.d.ts +23 -0
  80. package/dist/internal/query-feed.js +111 -0
  81. package/dist/internal/result.d.ts +22 -0
  82. package/dist/internal/result.js +61 -0
  83. package/dist/internal/rpc-contract.d.ts +24 -0
  84. package/dist/internal/rpc-contract.js +78 -0
  85. package/dist/internal/schemas.d.ts +307 -0
  86. package/dist/internal/schemas.js +524 -0
  87. package/dist/internal/store.d.ts +8 -0
  88. package/dist/internal/store.js +30 -0
  89. package/dist/internal/terminal-gate.d.ts +17 -0
  90. package/dist/internal/terminal-gate.js +94 -0
  91. package/dist/lifecycle.d.ts +44 -0
  92. package/dist/lifecycle.js +1 -0
  93. package/dist/marketplace.d.ts +159 -0
  94. package/dist/marketplace.js +102 -0
  95. package/dist/media-json.d.ts +181 -0
  96. package/dist/media-json.js +204 -0
  97. package/dist/media-library.d.ts +11 -0
  98. package/dist/media-library.js +15 -0
  99. package/dist/media-request-id.d.ts +7 -0
  100. package/dist/media-request-id.js +16 -0
  101. package/dist/media.d.ts +354 -0
  102. package/dist/media.js +654 -0
  103. package/dist/method-refusal.d.ts +64 -0
  104. package/dist/method-refusal.js +48 -0
  105. package/dist/pending.d.ts +10 -0
  106. package/dist/pending.js +10 -0
  107. package/dist/query.d.ts +76 -0
  108. package/dist/query.js +195 -0
  109. package/dist/react-mount.d.ts +23 -0
  110. package/dist/react-mount.js +108 -0
  111. package/dist/react.d.ts +41 -0
  112. package/dist/react.js +111 -0
  113. package/dist/read-copy.d.ts +103 -0
  114. package/dist/read-copy.js +195 -0
  115. package/dist/roles/files.d.ts +295 -0
  116. package/dist/roles/files.js +184 -0
  117. package/dist/root.d.ts +21 -0
  118. package/dist/root.js +1 -0
  119. package/dist/rpc.d.ts +1 -0
  120. package/dist/rpc.js +1 -0
  121. package/dist/status.d.ts +17 -0
  122. package/dist/status.js +50 -0
  123. package/dist/storage-wire.d.ts +167 -0
  124. package/dist/storage-wire.js +115 -0
  125. package/dist/storage.d.ts +72 -0
  126. package/dist/storage.js +143 -0
  127. package/dist/store.d.ts +11 -0
  128. package/dist/store.js +1 -0
  129. package/dist/test-kit/git.d.ts +31 -0
  130. package/dist/test-kit/git.js +174 -0
  131. package/dist/ui.d.ts +169 -0
  132. package/dist/ui.js +10 -0
  133. package/dist/window.d.ts +41 -0
  134. package/dist/window.js +15 -0
  135. package/dist/world.d.ts +16 -0
  136. package/dist/world.js +17 -0
  137. package/docs/api/README.md +28 -0
  138. package/docs/api/app-build-contract.md +113 -0
  139. package/docs/api/backend-declaration.md +62 -0
  140. package/docs/api/backend-definition.md +215 -0
  141. package/docs/api/backend.md +269 -0
  142. package/docs/api/errors.md +169 -0
  143. package/docs/api/files.md +91 -0
  144. package/docs/api/gills.md +164 -0
  145. package/docs/api/git-commit.md +279 -0
  146. package/docs/api/git-rpc.md +243 -0
  147. package/docs/api/git-steps.md +1010 -0
  148. package/docs/api/git-wire.md +197 -0
  149. package/docs/api/git.md +579 -0
  150. package/docs/api/index.md +2880 -0
  151. package/docs/api/media-json.md +507 -0
  152. package/docs/api/media-request-id.md +32 -0
  153. package/docs/api/modules.md +32 -0
  154. package/docs/api/query.md +253 -0
  155. package/docs/api/react.md +216 -0
  156. package/docs/api/read-copy.md +204 -0
  157. package/docs/api/rpc.md +128 -0
  158. package/docs/api/storage.md +620 -0
  159. package/package.json +197 -3
@@ -0,0 +1,251 @@
1
+ /**
2
+ * Write to an installation's repository through its GIT binding: commit files
3
+ * to a branch, point a ref at an existing commit, or merge one repository's
4
+ * branch into another's. All run isomorphic-git over the binding's byte-RPC smart-HTTP exchange in memory, so an App never
5
+ * holds a remote or a credential. Every write is compare-and-swap on the ref:
6
+ * the caller names the head it built on, and a ref that moved is reported
7
+ * stale instead of overwritten.
8
+ */
9
+ import { Buffer } from "buffer";
10
+ import * as git from "isomorphic-git";
11
+ import { advertisedRefs } from "./git-wire.js";
12
+ import { memoryFs } from "./internal/memory-fs.js";
13
+ import { begin, runStep, memoryGitStepMaterial, } from "./git-steps.js";
14
+ const DIR = "/repository";
15
+ const ORIGIN = "https://git.binding.invalid/";
16
+ const ADVERTISE = /^https:\/\/git\.binding\.invalid\/[^/]+\.git\/info\/refs\?service=git-(upload|receive)-pack$/u;
17
+ const EXCHANGE = /^https:\/\/git\.binding\.invalid\/[^/]+\.git\/git-(upload|receive)-pack$/u;
18
+ // isomorphic-git expects a global Buffer; App backends run without Node's.
19
+ if (!("Buffer" in globalThis))
20
+ Reflect.set(globalThis, "Buffer", Buffer);
21
+ class StaleRef extends Error {
22
+ head;
23
+ constructor(head) {
24
+ super("Ref moved");
25
+ this.head = head;
26
+ }
27
+ }
28
+ async function collect(body) {
29
+ if (body === undefined)
30
+ return null;
31
+ const parts = [];
32
+ for await (const part of body)
33
+ parts.push(part);
34
+ return Buffer.concat(parts);
35
+ }
36
+ async function* once(chunk) {
37
+ await Promise.resolve();
38
+ yield chunk;
39
+ }
40
+ /**
41
+ * isomorphic-git's HTTP client over the binding. A guard checks the expected
42
+ * head in the fetch advertisement and again in the push advertisement; the
43
+ * server's ref update is compare-and-swap on that advertised head.
44
+ */
45
+ function exchangeClient(store, repository, guard) {
46
+ return {
47
+ async request(input) {
48
+ const advertise = ADVERTISE.exec(input.url);
49
+ const exchange = advertise === null ? EXCHANGE.exec(input.url) : null;
50
+ const match = advertise ?? exchange;
51
+ if (match === null)
52
+ throw new Error("Unexpected Git URL");
53
+ const service = match[1] === "receive" ? "receive-pack" : "upload-pack";
54
+ const request = {
55
+ service,
56
+ phase: advertise === null ? "exchange" : "advertise",
57
+ headers: input.headers ?? {},
58
+ body: await collect(input.body),
59
+ };
60
+ const response = await store.exchange(repository, request);
61
+ if (guard !== null && request.phase === "advertise") {
62
+ const head = advertisedRefs(response.body).get(guard.ref) ?? null;
63
+ if (head !== guard.expected)
64
+ throw new StaleRef(head);
65
+ }
66
+ return {
67
+ url: input.url,
68
+ method: input.method ?? "GET",
69
+ statusCode: response.status,
70
+ statusMessage: "",
71
+ headers: { ...response.headers },
72
+ body: once(response.body),
73
+ };
74
+ },
75
+ };
76
+ }
77
+ async function heads(store, repository) {
78
+ const response = await store.exchange(repository, {
79
+ service: "upload-pack",
80
+ phase: "advertise",
81
+ headers: {},
82
+ body: null,
83
+ });
84
+ if (response.status !== 200)
85
+ throw new Error("Repository advertisement unavailable");
86
+ return advertisedRefs(response.body);
87
+ }
88
+ /**
89
+ * The server refused the ref update (another push landed between our
90
+ * advertisement and our pack: non-fast-forward, "fetch first", a lost ref
91
+ * lock). Nothing was written; report the branch's fresh head.
92
+ */
93
+ function rejectedPush(cause) {
94
+ return (cause instanceof git.Errors.PushRejectedError ||
95
+ cause instanceof git.Errors.GitPushError);
96
+ }
97
+ async function staleAfterRejection(store, repository, ref) {
98
+ return {
99
+ kind: "stale",
100
+ head: (await heads(store, repository)).get(ref) ?? null,
101
+ };
102
+ }
103
+ async function open(store, repository) {
104
+ const fs = memoryFs();
105
+ await fs.promises.mkdir(DIR);
106
+ await git.init({ fs, dir: DIR });
107
+ await git.addRemote({
108
+ fs,
109
+ dir: DIR,
110
+ remote: "origin",
111
+ url: `${ORIGIN}${repository}.git`,
112
+ });
113
+ /** Fetch one branch's head (depth 1) and return its commit. */
114
+ const fetchHead = async (branch, guard = null) => {
115
+ await git.fetch({
116
+ fs,
117
+ http: exchangeClient(store, repository, guard),
118
+ dir: DIR,
119
+ remote: "origin",
120
+ ref: branch,
121
+ singleBranch: true,
122
+ depth: 1,
123
+ tags: false,
124
+ });
125
+ return git.resolveRef({
126
+ fs,
127
+ dir: DIR,
128
+ ref: `refs/remotes/origin/${branch}`,
129
+ });
130
+ };
131
+ return { fs, fetchHead };
132
+ }
133
+ /** Foreground driver over the same resumable engine used by background owners. */
134
+ async function driveSteps(store, operation, beforeWrite) {
135
+ // This key is local to a new volatile store per call, not a minted identity.
136
+ const material = memoryGitStepMaterial();
137
+ let checkpoint = await begin(operation, material);
138
+ const ports = { git: store, material };
139
+ const signal = new AbortController().signal;
140
+ const [started, checked] = await Promise.allSettled([
141
+ runStep(checkpoint, ports, signal),
142
+ Promise.resolve().then(() => beforeWrite?.()),
143
+ ]);
144
+ // Preserve validation precedence and settle the fetch before the first push.
145
+ if (checked.status === "rejected")
146
+ throw checked.reason;
147
+ if (started.status === "rejected")
148
+ throw started.reason;
149
+ let reply = started.value;
150
+ for (;;) {
151
+ if ("done" in reply) {
152
+ if (reply.done.kind === "too_large")
153
+ throw new RangeError("Git material exceeds resumable write bound");
154
+ return reply.done;
155
+ }
156
+ if ("yield" in reply)
157
+ throw new Error("Foreground Git write yielded");
158
+ checkpoint = reply.next;
159
+ reply = await runStep(checkpoint, ports, signal);
160
+ }
161
+ }
162
+ /** Commit files using independently resumable, CAS-guarded Git steps. */
163
+ export async function commitFiles(store, request, beforeWrite) {
164
+ const result = await driveSteps(store, { kind: "commit", requestKey: "foreground", request }, beforeWrite);
165
+ if (result.kind === "committed" ||
166
+ result.kind === "unchanged" ||
167
+ result.kind === "updated" ||
168
+ result.kind === "stale")
169
+ return result;
170
+ throw new Error("Invalid commit step outcome");
171
+ }
172
+ /** Point a ref at the head commit of `source`, compare-and-swap on the ref. */
173
+ export async function moveRef(store, request) {
174
+ const result = await moveRefs(store, {
175
+ repository: request.repository,
176
+ source: request.source,
177
+ commit: request.commit,
178
+ updates: [{ ref: request.ref, expected: request.expected }],
179
+ });
180
+ return result.kind === "stale"
181
+ ? { kind: "stale", head: result.head }
182
+ : result;
183
+ }
184
+ /** Fetch a source once, then move refs in order with separate guarded pushes. */
185
+ export async function moveRefs(store, request) {
186
+ const first = request.updates.at(0);
187
+ if (first === undefined)
188
+ return { kind: "updated" };
189
+ const { fs, fetchHead } = await open(store, request.repository);
190
+ try {
191
+ if ((await fetchHead(request.source, first)) !== request.commit)
192
+ throw new RangeError("Commit is not the head of its source branch");
193
+ }
194
+ catch (cause) {
195
+ if (cause instanceof StaleRef)
196
+ return { kind: "stale", ref: first.ref, head: cause.head };
197
+ throw cause;
198
+ }
199
+ for (const update of request.updates) {
200
+ await git.writeRef({
201
+ fs,
202
+ dir: DIR,
203
+ ref: update.ref,
204
+ value: request.commit,
205
+ force: true,
206
+ });
207
+ try {
208
+ const pushed = await git.push({
209
+ fs,
210
+ http: exchangeClient(store, request.repository, update),
211
+ dir: DIR,
212
+ remote: "origin",
213
+ ref: update.ref,
214
+ remoteRef: update.ref,
215
+ // Each push's advertisement checks that ref's expected head.
216
+ force: true,
217
+ });
218
+ if (!pushed.ok)
219
+ return {
220
+ ...(await staleAfterRejection(store, request.repository, update.ref)),
221
+ ref: update.ref,
222
+ };
223
+ }
224
+ catch (cause) {
225
+ if (cause instanceof StaleRef)
226
+ return { kind: "stale", ref: update.ref, head: cause.head };
227
+ if (rejectedPush(cause))
228
+ return {
229
+ ...(await staleAfterRejection(store, request.repository, update.ref)),
230
+ ref: update.ref,
231
+ };
232
+ throw cause;
233
+ }
234
+ }
235
+ return { kind: "updated" };
236
+ }
237
+ /** Merge branches through the same one-exchange step engine as background owners. */
238
+ export async function mergeBranch(store, request) {
239
+ const result = await driveSteps(store, {
240
+ kind: "merge",
241
+ requestKey: "foreground",
242
+ request,
243
+ });
244
+ if (result.kind === "merged" ||
245
+ result.kind === "up-to-date" ||
246
+ result.kind === "conflict" ||
247
+ result.kind === "stale" ||
248
+ result.kind === "source-moved")
249
+ return result;
250
+ throw new Error("Invalid merge step outcome");
251
+ }
@@ -0,0 +1,310 @@
1
+ import * as z from "zod";
2
+ import { type GitBinding } from "./git.js";
3
+ /** The native tuple and result grammar shared by the handle and frame entrypoint. */
4
+ export declare const nativeGitCodecs: {
5
+ create: {
6
+ args: z.ZodTuple<[z.ZodString, z.ZodOptional<z.ZodObject<{
7
+ description: z.ZodOptional<z.ZodString>;
8
+ defaultBranch: z.ZodOptional<z.ZodString>;
9
+ }, z.core.$strict>>], null>;
10
+ result: z.ZodObject<{
11
+ name: z.ZodString;
12
+ defaultBranch: z.ZodString;
13
+ lastPushAt: z.ZodNullable<z.ZodString>;
14
+ source: z.ZodNullable<z.ZodString>;
15
+ }, z.core.$strict>;
16
+ };
17
+ fork: {
18
+ args: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodOptional<z.ZodObject<{
19
+ description: z.ZodOptional<z.ZodString>;
20
+ }, z.core.$strict>>], null>;
21
+ result: z.ZodObject<{
22
+ name: z.ZodString;
23
+ defaultBranch: z.ZodString;
24
+ lastPushAt: z.ZodNullable<z.ZodString>;
25
+ source: z.ZodNullable<z.ZodString>;
26
+ }, z.core.$strict>;
27
+ };
28
+ cloneUrl: {
29
+ args: z.ZodTuple<[z.ZodString], null>;
30
+ result: z.ZodURL;
31
+ };
32
+ info: {
33
+ args: z.ZodTuple<[z.ZodString], null>;
34
+ result: z.ZodNullable<z.ZodObject<{
35
+ name: z.ZodString;
36
+ defaultBranch: z.ZodString;
37
+ lastPushAt: z.ZodNullable<z.ZodString>;
38
+ source: z.ZodNullable<z.ZodString>;
39
+ }, z.core.$strict>>;
40
+ };
41
+ delete: {
42
+ args: z.ZodTuple<[z.ZodString], null>;
43
+ result: z.ZodBoolean;
44
+ };
45
+ log: {
46
+ args: z.ZodTuple<[z.ZodString, z.ZodObject<{
47
+ ref: z.ZodString;
48
+ limit: z.ZodOptional<z.ZodNumber>;
49
+ offset: z.ZodOptional<z.ZodNumber>;
50
+ }, z.core.$strict>], null>;
51
+ result: z.ZodArray<z.ZodObject<{
52
+ hash: z.ZodString;
53
+ treeHash: z.ZodString;
54
+ message: z.ZodString;
55
+ author: z.ZodObject<{
56
+ name: z.ZodString;
57
+ email: z.ZodString;
58
+ }, z.core.$strict>;
59
+ committer: z.ZodObject<{
60
+ name: z.ZodString;
61
+ email: z.ZodString;
62
+ }, z.core.$strict>;
63
+ parents: z.ZodArray<z.ZodString>;
64
+ authoredAt: z.ZodNumber;
65
+ committedAt: z.ZodNumber;
66
+ }, z.core.$strict>>;
67
+ };
68
+ readCommit: {
69
+ args: z.ZodTuple<[z.ZodString, z.ZodString], null>;
70
+ result: z.ZodNullable<z.ZodObject<{
71
+ hash: z.ZodString;
72
+ treeHash: z.ZodString;
73
+ message: z.ZodString;
74
+ author: z.ZodObject<{
75
+ name: z.ZodString;
76
+ email: z.ZodString;
77
+ }, z.core.$strict>;
78
+ committer: z.ZodObject<{
79
+ name: z.ZodString;
80
+ email: z.ZodString;
81
+ }, z.core.$strict>;
82
+ parents: z.ZodArray<z.ZodString>;
83
+ authoredAt: z.ZodNumber;
84
+ committedAt: z.ZodNumber;
85
+ }, z.core.$strict>>;
86
+ };
87
+ readTree: {
88
+ args: z.ZodTuple<[z.ZodString, z.ZodString], null>;
89
+ result: z.ZodNullable<z.ZodArray<z.ZodObject<{
90
+ name: z.ZodString;
91
+ mode: z.ZodString;
92
+ hash: z.ZodString;
93
+ type: z.ZodEnum<{
94
+ blob: "blob";
95
+ tree: "tree";
96
+ commit: "commit";
97
+ }>;
98
+ }, z.core.$strict>>>;
99
+ };
100
+ readBlob: {
101
+ args: z.ZodTuple<[z.ZodString, z.ZodString], null>;
102
+ result: z.ZodNullable<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>>;
103
+ };
104
+ refs: {
105
+ args: z.ZodTuple<[z.ZodString], null>;
106
+ result: z.ZodArray<z.ZodObject<{
107
+ name: z.ZodString;
108
+ hash: z.ZodString;
109
+ }, z.core.$strict>>;
110
+ };
111
+ exchange: {
112
+ args: z.ZodTuple<[z.ZodString, z.ZodObject<{
113
+ service: z.ZodEnum<{
114
+ "upload-pack": "upload-pack";
115
+ "receive-pack": "receive-pack";
116
+ }>;
117
+ phase: z.ZodEnum<{
118
+ advertise: "advertise";
119
+ exchange: "exchange";
120
+ }>;
121
+ body: z.ZodNullable<z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>>;
122
+ headers: z.ZodRecord<z.ZodString, z.ZodString>;
123
+ }, z.core.$strict>], null>;
124
+ result: z.ZodObject<{
125
+ status: z.ZodNumber;
126
+ headers: z.ZodRecord<z.ZodString, z.ZodString>;
127
+ body: z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
128
+ }, z.core.$strict>;
129
+ };
130
+ };
131
+ /** Host operation required before a native Git effect. */
132
+ export type NativeGitOperation = "create" | "fork" | "read" | "write" | "exchange";
133
+ /** Native Git preserves tuples and binary values through the shared frame factory. */
134
+ export declare const nativeGitFrameMethods: {
135
+ create: {
136
+ /** Decode the native positional arguments with the method's tuple codec. */
137
+ decodeArgs: (raw: readonly unknown[]) => [string, ({
138
+ description?: string | undefined;
139
+ defaultBranch?: string | undefined;
140
+ } | undefined)?];
141
+ /** Validate the native result, preserving binary values. */
142
+ decodeResult: (raw: unknown) => {
143
+ name: string;
144
+ defaultBranch: string;
145
+ lastPushAt: string | null;
146
+ source: string | null;
147
+ };
148
+ /** Operations the host must grant for these decoded arguments. */
149
+ requiredOperations: (args: readonly unknown[]) => readonly string[];
150
+ };
151
+ fork: {
152
+ /** Decode the native positional arguments with the method's tuple codec. */
153
+ decodeArgs: (raw: readonly unknown[]) => [string, string, ({
154
+ description?: string | undefined;
155
+ } | undefined)?];
156
+ /** Validate the native result, preserving binary values. */
157
+ decodeResult: (raw: unknown) => {
158
+ name: string;
159
+ defaultBranch: string;
160
+ lastPushAt: string | null;
161
+ source: string | null;
162
+ };
163
+ /** Operations the host must grant for these decoded arguments. */
164
+ requiredOperations: (args: readonly unknown[]) => readonly string[];
165
+ };
166
+ cloneUrl: {
167
+ /** Decode the native positional arguments with the method's tuple codec. */
168
+ decodeArgs: (raw: readonly unknown[]) => [string];
169
+ /** Validate the native result, preserving binary values. */
170
+ decodeResult: (raw: unknown) => string;
171
+ /** Operations the host must grant for these decoded arguments. */
172
+ requiredOperations: (args: readonly unknown[]) => readonly string[];
173
+ };
174
+ info: {
175
+ /** Decode the native positional arguments with the method's tuple codec. */
176
+ decodeArgs: (raw: readonly unknown[]) => [string];
177
+ /** Validate the native result, preserving binary values. */
178
+ decodeResult: (raw: unknown) => {
179
+ name: string;
180
+ defaultBranch: string;
181
+ lastPushAt: string | null;
182
+ source: string | null;
183
+ } | null;
184
+ /** Operations the host must grant for these decoded arguments. */
185
+ requiredOperations: (args: readonly unknown[]) => readonly string[];
186
+ };
187
+ delete: {
188
+ /** Decode the native positional arguments with the method's tuple codec. */
189
+ decodeArgs: (raw: readonly unknown[]) => [string];
190
+ /** Validate the native result, preserving binary values. */
191
+ decodeResult: (raw: unknown) => boolean;
192
+ /** Operations the host must grant for these decoded arguments. */
193
+ requiredOperations: (args: readonly unknown[]) => readonly string[];
194
+ };
195
+ log: {
196
+ /** Decode the native positional arguments with the method's tuple codec. */
197
+ decodeArgs: (raw: readonly unknown[]) => [string, {
198
+ ref: string;
199
+ limit?: number | undefined;
200
+ offset?: number | undefined;
201
+ }];
202
+ /** Validate the native result, preserving binary values. */
203
+ decodeResult: (raw: unknown) => {
204
+ hash: string;
205
+ treeHash: string;
206
+ message: string;
207
+ author: {
208
+ name: string;
209
+ email: string;
210
+ };
211
+ committer: {
212
+ name: string;
213
+ email: string;
214
+ };
215
+ parents: string[];
216
+ authoredAt: number;
217
+ committedAt: number;
218
+ }[];
219
+ /** Operations the host must grant for these decoded arguments. */
220
+ requiredOperations: (args: readonly unknown[]) => readonly string[];
221
+ };
222
+ readCommit: {
223
+ /** Decode the native positional arguments with the method's tuple codec. */
224
+ decodeArgs: (raw: readonly unknown[]) => [string, string];
225
+ /** Validate the native result, preserving binary values. */
226
+ decodeResult: (raw: unknown) => {
227
+ hash: string;
228
+ treeHash: string;
229
+ message: string;
230
+ author: {
231
+ name: string;
232
+ email: string;
233
+ };
234
+ committer: {
235
+ name: string;
236
+ email: string;
237
+ };
238
+ parents: string[];
239
+ authoredAt: number;
240
+ committedAt: number;
241
+ } | null;
242
+ /** Operations the host must grant for these decoded arguments. */
243
+ requiredOperations: (args: readonly unknown[]) => readonly string[];
244
+ };
245
+ readTree: {
246
+ /** Decode the native positional arguments with the method's tuple codec. */
247
+ decodeArgs: (raw: readonly unknown[]) => [string, string];
248
+ /** Validate the native result, preserving binary values. */
249
+ decodeResult: (raw: unknown) => {
250
+ name: string;
251
+ mode: string;
252
+ hash: string;
253
+ type: "blob" | "tree" | "commit";
254
+ }[] | null;
255
+ /** Operations the host must grant for these decoded arguments. */
256
+ requiredOperations: (args: readonly unknown[]) => readonly string[];
257
+ };
258
+ readBlob: {
259
+ /** Decode the native positional arguments with the method's tuple codec. */
260
+ decodeArgs: (raw: readonly unknown[]) => [string, string];
261
+ /** Validate the native result, preserving binary values. */
262
+ decodeResult: (raw: unknown) => Uint8Array<ArrayBuffer> | null;
263
+ /** Operations the host must grant for these decoded arguments. */
264
+ requiredOperations: (args: readonly unknown[]) => readonly string[];
265
+ };
266
+ refs: {
267
+ /** Decode the native positional arguments with the method's tuple codec. */
268
+ decodeArgs: (raw: readonly unknown[]) => [string];
269
+ /** Validate the native result, preserving binary values. */
270
+ decodeResult: (raw: unknown) => {
271
+ name: string;
272
+ hash: string;
273
+ }[];
274
+ /** Operations the host must grant for these decoded arguments. */
275
+ requiredOperations: (args: readonly unknown[]) => readonly string[];
276
+ };
277
+ exchange: {
278
+ /** Decode the native positional arguments with the method's tuple codec. */
279
+ decodeArgs: (raw: readonly unknown[]) => [string, {
280
+ service: "upload-pack" | "receive-pack";
281
+ phase: "advertise" | "exchange";
282
+ body: Uint8Array<ArrayBuffer> | null;
283
+ headers: Record<string, string>;
284
+ }];
285
+ /** Validate the native result, preserving binary values. */
286
+ decodeResult: (raw: unknown) => {
287
+ status: number;
288
+ headers: Record<string, string>;
289
+ body: Uint8Array<ArrayBuffer>;
290
+ };
291
+ /** Operations the host must grant for these decoded arguments. */
292
+ requiredOperations: (args: readonly unknown[]) => readonly string[];
293
+ };
294
+ };
295
+ /** Native method identity is a source-owned refinement, not a transport parser. */
296
+ export declare const nativeGitMethodNameSchema: z.ZodEnum<{
297
+ info: "info";
298
+ create: "create";
299
+ delete: "delete";
300
+ exchange: "exchange";
301
+ fork: "fork";
302
+ cloneUrl: "cloneUrl";
303
+ log: "log";
304
+ readCommit: "readCommit";
305
+ readTree: "readTree";
306
+ readBlob: "readBlob";
307
+ refs: "refs";
308
+ }>;
309
+ /** Dispatch owned tuples through the retained native handle without a JSON conversion. */
310
+ export declare function invokeNativeGit(git: GitBinding, method: string, raw: readonly unknown[]): Promise<Awaited<ReturnType<GitBinding[keyof GitBinding]>>>;