run402-mcp 4.131.0 → 4.133.0

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 (41) hide show
  1. package/README.md +3 -1
  2. package/dist/docs/llms-sdk.txt +46 -0
  3. package/package.json +3 -3
  4. package/schemas/release-spec.v1.json +40 -1
  5. package/sdk/README.md +2 -1
  6. package/sdk/dist/index.d.ts +11 -0
  7. package/sdk/dist/index.d.ts.map +1 -1
  8. package/sdk/dist/index.js +11 -0
  9. package/sdk/dist/index.js.map +1 -1
  10. package/sdk/dist/namespaces/app-repos.d.ts +69 -0
  11. package/sdk/dist/namespaces/app-repos.d.ts.map +1 -0
  12. package/sdk/dist/namespaces/app-repos.js +312 -0
  13. package/sdk/dist/namespaces/app-repos.js.map +1 -0
  14. package/sdk/dist/namespaces/app-repos.types.d.ts +188 -0
  15. package/sdk/dist/namespaces/app-repos.types.d.ts.map +1 -0
  16. package/sdk/dist/namespaces/app-repos.types.js +12 -0
  17. package/sdk/dist/namespaces/app-repos.types.js.map +1 -0
  18. package/sdk/dist/namespaces/billing.d.ts +131 -0
  19. package/sdk/dist/namespaces/billing.d.ts.map +1 -1
  20. package/sdk/dist/namespaces/billing.js +83 -1
  21. package/sdk/dist/namespaces/billing.js.map +1 -1
  22. package/sdk/dist/namespaces/deploy.d.ts.map +1 -1
  23. package/sdk/dist/namespaces/deploy.js +68 -3
  24. package/sdk/dist/namespaces/deploy.js.map +1 -1
  25. package/sdk/dist/namespaces/deploy.types.d.ts +34 -2
  26. package/sdk/dist/namespaces/deploy.types.d.ts.map +1 -1
  27. package/sdk/dist/namespaces/deploy.types.js.map +1 -1
  28. package/sdk/dist/namespaces/projects.types.d.ts +18 -0
  29. package/sdk/dist/namespaces/projects.types.d.ts.map +1 -1
  30. package/sdk/dist/namespaces/snapshots.types.d.ts +2 -0
  31. package/sdk/dist/namespaces/snapshots.types.d.ts.map +1 -1
  32. package/sdk/dist/namespaces/tier.d.ts +17 -0
  33. package/sdk/dist/namespaces/tier.d.ts.map +1 -1
  34. package/sdk/dist/namespaces/tier.js.map +1 -1
  35. package/sdk/dist/node/deploy-manifest.d.ts.map +1 -1
  36. package/sdk/dist/node/deploy-manifest.js +28 -2
  37. package/sdk/dist/node/deploy-manifest.js.map +1 -1
  38. package/sdk/dist/scoped.d.ts +28 -0
  39. package/sdk/dist/scoped.d.ts.map +1 -1
  40. package/sdk/dist/scoped.js +51 -0
  41. package/sdk/dist/scoped.js.map +1 -1
@@ -0,0 +1,312 @@
1
+ /**
2
+ * `appRepos` namespace — plain git repositories owned by a project and
3
+ * written by its app (`/projects/v1/:project_id/app-repos`).
4
+ *
5
+ * An app repo is NOT a KyGit vault (`r.repos`): it is unencrypted, one linear
6
+ * `main`, stored in the project's content-addressed storage and billed as
7
+ * project storage. Every project has a `default` repo that needs no creation;
8
+ * other repos are created explicitly and never by a read, commit, or push.
9
+ * Functions read and commit through `repo` / `repos` from `@run402/functions`;
10
+ * people and agents also clone and push with plain git (`run402 app-repos
11
+ * clone`). The SDK has no clone method: cloning writes a working tree and
12
+ * hands git a credential, so it is CLI-only.
13
+ *
14
+ * Exposed unscoped (`r.appRepos.list(projectId)`) and project-scoped
15
+ * (`r.project(id).appRepos.list()`). Every call sends your principal (grant
16
+ * key, wallet, or sign-in session) when the credential provider has one,
17
+ * otherwise the project's locally cached service key. Reads need
18
+ * `project.app_repos.read` (viewer); create, delete, commit, and revert need
19
+ * `project.app_repos.write` (developer, or a grant with `deploy`).
20
+ */
21
+ import { ApiError, LocalError, NetworkError, NotAuthorizedError, PaymentRequired, Unauthorized } from "../errors.js";
22
+ function collectionPath(projectId) {
23
+ return `/projects/v1/${encodeURIComponent(projectId)}/app-repos`;
24
+ }
25
+ function repoPath(projectId, repoName) {
26
+ return `${collectionPath(projectId)}/${encodeURIComponent(repoName)}`;
27
+ }
28
+ /** Encode a repo path segment by segment, keeping its `/` separators. */
29
+ function encodeRepoFilePath(path) {
30
+ return path.split("/").filter((s) => s.length > 0).map(encodeURIComponent).join("/");
31
+ }
32
+ function withQuery(path, params) {
33
+ const qs = new URLSearchParams();
34
+ for (const [key, value] of Object.entries(params)) {
35
+ if (value !== undefined && value !== "")
36
+ qs.set(key, String(value));
37
+ }
38
+ const query = qs.toString();
39
+ return query ? `${path}?${query}` : path;
40
+ }
41
+ function requireArg(value, name, context) {
42
+ if (typeof value !== "string" || value.length === 0) {
43
+ throw new LocalError(`appRepos: ${name} is required`, context);
44
+ }
45
+ }
46
+ /** Diagnostic auth metadata. App-repo writes are not a write-approval capability, so none is named. */
47
+ function authMeta(method, projectId) {
48
+ return { method: `appRepos.${method}`, target: { project_id: projectId } };
49
+ }
50
+ function bytesToBase64(bytes) {
51
+ const g = globalThis;
52
+ if (g.Buffer)
53
+ return g.Buffer.from(bytes).toString("base64");
54
+ let s = "";
55
+ for (const b of bytes)
56
+ s += String.fromCharCode(b);
57
+ return g.btoa(s);
58
+ }
59
+ /** Turn the SDK's shorthand (`string`, `Uint8Array`) into the wire shape. */
60
+ function wireFiles(files) {
61
+ const out = {};
62
+ for (const [path, value] of Object.entries(files)) {
63
+ if (value === null)
64
+ out[path] = null;
65
+ else if (typeof value === "string")
66
+ out[path] = { text: value };
67
+ else if (value instanceof Uint8Array)
68
+ out[path] = { base64: bytesToBase64(value) };
69
+ else if (value && typeof value === "object" && ("text" in value || "base64" in value || "json" in value))
70
+ out[path] = value;
71
+ else {
72
+ throw new LocalError(`appRepos.commit: files["${path}"] must be a string, a Uint8Array, null, or one of { text }, { base64 }, { json }`, "committing to app repo");
73
+ }
74
+ }
75
+ return out;
76
+ }
77
+ function decodeUtf8(bytes) {
78
+ try {
79
+ return new TextDecoder("utf-8", { fatal: true }).decode(bytes);
80
+ }
81
+ catch {
82
+ return null;
83
+ }
84
+ }
85
+ function displayMessage(body, fallback) {
86
+ if (body && typeof body === "object" && !Array.isArray(body)) {
87
+ const obj = body;
88
+ if (typeof obj.message === "string" && obj.message.length > 0)
89
+ return obj.message;
90
+ if (typeof obj.error === "string" && obj.error.length > 0)
91
+ return obj.error;
92
+ }
93
+ return fallback;
94
+ }
95
+ function envelopeCode(body) {
96
+ if (!body || typeof body !== "object" || Array.isArray(body))
97
+ return null;
98
+ const code = body.code;
99
+ return typeof code === "string" ? code : null;
100
+ }
101
+ async function readErrorBody(res) {
102
+ const ct = res.headers.get("content-type") ?? "";
103
+ return ct.includes("application/json") ? await res.json().catch(() => null) : await res.text().catch(() => "");
104
+ }
105
+ function throwFileError(status, body, context) {
106
+ const message = displayMessage(body, "Reading app repo file failed");
107
+ if (status === 402)
108
+ throw new PaymentRequired(`${message} while ${context}`, status, body, context);
109
+ if (status === 403 && envelopeCode(body) === "NOT_AUTHORIZED") {
110
+ throw new NotAuthorizedError(`${message} while ${context} (HTTP ${status})`, status, body, context);
111
+ }
112
+ if (status === 401 || status === 403)
113
+ throw new Unauthorized(`${message} while ${context} (HTTP ${status})`, status, body, context);
114
+ throw new ApiError(`${message} while ${context} (HTTP ${status})`, status, body, context);
115
+ }
116
+ export class AppRepos {
117
+ client;
118
+ constructor(client) {
119
+ this.client = client;
120
+ }
121
+ /** Every app repo of the project; `default` is always listed (`GET …/app-repos`). */
122
+ async list(projectId) {
123
+ requireArg(projectId, "projectId", "listing app repos");
124
+ return this.client.request(collectionPath(projectId), {
125
+ authMeta: authMeta("list", projectId),
126
+ projectKeyFallback: projectId,
127
+ context: "listing app repos",
128
+ });
129
+ }
130
+ /**
131
+ * Create a repo, optionally from another repo of the same project (its head
132
+ * and history are copied and its objects shared). A taken name is
133
+ * `409 APP_REPO_EXISTS`.
134
+ */
135
+ async create(projectId, opts) {
136
+ requireArg(projectId, "projectId", "creating app repo");
137
+ requireArg(opts?.repo_name, "repo_name", "creating app repo");
138
+ const body = { repo_name: opts.repo_name };
139
+ if (opts.from !== undefined)
140
+ body.from = opts.from;
141
+ return this.client.request(collectionPath(projectId), {
142
+ method: "POST",
143
+ body,
144
+ authMeta: authMeta("create", projectId),
145
+ projectKeyFallback: projectId,
146
+ context: "creating app repo",
147
+ });
148
+ }
149
+ /** One repo, with its head and `clone_url` (`GET …/app-repos/:repo_name`). */
150
+ async get(projectId, repoName) {
151
+ requireArg(projectId, "projectId", "getting app repo");
152
+ requireArg(repoName, "repoName", "getting app repo");
153
+ return this.client.request(repoPath(projectId, repoName), {
154
+ authMeta: authMeta("get", projectId),
155
+ projectKeyFallback: projectId,
156
+ context: "getting app repo",
157
+ });
158
+ }
159
+ /**
160
+ * Delete a repo. `confirm` must equal the repo name; `default` cannot be
161
+ * deleted (`403 APP_REPO_DEFAULT_UNDELETABLE`). Its objects become
162
+ * collectable once no other repo of the project references them.
163
+ */
164
+ async delete(projectId, repoName, opts) {
165
+ const context = "deleting app repo";
166
+ requireArg(projectId, "projectId", context);
167
+ requireArg(repoName, "repoName", context);
168
+ if (opts?.confirm !== repoName) {
169
+ throw new LocalError(`appRepos.delete: pass { confirm: "${repoName}" } to delete app repo ${repoName}`, context, { code: "CONFIRMATION_REQUIRED", details: { repo_name: repoName } });
170
+ }
171
+ return this.client.request(withQuery(repoPath(projectId, repoName), { confirm: opts.confirm }), {
172
+ method: "DELETE",
173
+ authMeta: authMeta("delete", projectId),
174
+ projectKeyFallback: projectId,
175
+ context,
176
+ });
177
+ }
178
+ /** The commits on `main`, newest first, optionally only those that changed `path`. */
179
+ async log(projectId, repoName, opts = {}) {
180
+ requireArg(projectId, "projectId", "reading app repo log");
181
+ requireArg(repoName, "repoName", "reading app repo log");
182
+ const path = withQuery(`${repoPath(projectId, repoName)}/commits`, { path: opts.path, cursor: opts.cursor, limit: opts.limit });
183
+ return this.client.request(path, {
184
+ authMeta: authMeta("log", projectId),
185
+ projectKeyFallback: projectId,
186
+ context: "reading app repo log",
187
+ });
188
+ }
189
+ /**
190
+ * One file's bytes at the head, or at `opts.at`. Returns `null` when the
191
+ * file is absent (`APP_REPO_PATH_NOT_FOUND`), including in an empty repo;
192
+ * any other failure throws.
193
+ */
194
+ async readFile(projectId, repoName, path, opts = {}) {
195
+ const context = "reading app repo file";
196
+ requireArg(projectId, "projectId", context);
197
+ requireArg(repoName, "repoName", context);
198
+ requireArg(path, "path", context);
199
+ const apiPath = withQuery(`${repoPath(projectId, repoName)}/files/${encodeRepoFilePath(path)}`, { at: opts.at });
200
+ const headers = {};
201
+ const auth = await this.client.credentials.getAuth(apiPath, authMeta("readFile", projectId));
202
+ if (auth)
203
+ Object.assign(headers, auth);
204
+ else {
205
+ const keys = await this.client.getProjectCredentials(projectId);
206
+ if (keys?.service_key)
207
+ headers.Authorization = `Bearer ${keys.service_key}`;
208
+ }
209
+ let res;
210
+ try {
211
+ res = await this.client.fetch(`${this.client.apiBase}${apiPath}`, { headers });
212
+ }
213
+ catch (err) {
214
+ throw new NetworkError(`Network error while ${context}: ${err.message}`, err, context);
215
+ }
216
+ if (!res.ok) {
217
+ const body = await readErrorBody(res);
218
+ if (res.status === 404 && envelopeCode(body) === "APP_REPO_PATH_NOT_FOUND")
219
+ return null;
220
+ throwFileError(res.status, body, context);
221
+ }
222
+ const bytes = new Uint8Array(await res.arrayBuffer());
223
+ const etag = res.headers.get("etag");
224
+ return {
225
+ repo_name: repoName,
226
+ path,
227
+ commit: res.headers.get("x-run402-commit"),
228
+ oid: etag ? etag.replace(/^W\//, "").replace(/^"|"$/g, "") : null,
229
+ content_type: res.headers.get("content-type"),
230
+ size_bytes: bytes.byteLength,
231
+ bytes,
232
+ text: decodeUtf8(bytes),
233
+ };
234
+ }
235
+ /** A directory listing at the head, or at `opts.at`; the repo root when `path` is omitted. */
236
+ async tree(projectId, repoName, path, opts = {}) {
237
+ requireArg(projectId, "projectId", "listing app repo tree");
238
+ requireArg(repoName, "repoName", "listing app repo tree");
239
+ const sub = path ? encodeRepoFilePath(path) : "";
240
+ const apiPath = withQuery(`${repoPath(projectId, repoName)}/tree${sub ? `/${sub}` : ""}`, { at: opts.at });
241
+ return this.client.request(apiPath, {
242
+ authMeta: authMeta("tree", projectId),
243
+ projectKeyFallback: projectId,
244
+ context: "listing app repo tree",
245
+ });
246
+ }
247
+ /** The paths that changed between two commits. */
248
+ async diff(projectId, repoName, from, to) {
249
+ requireArg(projectId, "projectId", "diffing app repo");
250
+ requireArg(repoName, "repoName", "diffing app repo");
251
+ requireArg(from, "from", "diffing app repo");
252
+ requireArg(to, "to", "diffing app repo");
253
+ return this.client.request(withQuery(`${repoPath(projectId, repoName)}/diff`, { from, to }), {
254
+ authMeta: authMeta("diff", projectId),
255
+ projectKeyFallback: projectId,
256
+ context: "diffing app repo",
257
+ });
258
+ }
259
+ /**
260
+ * Commit files to `main`. A `string` is UTF-8 text, a `Uint8Array` bytes,
261
+ * `null` deletes, and `{ json }` is written canonically. Without `parent`,
262
+ * the commit lands on a newer head when none of its paths changed since
263
+ * `base`; otherwise `409 APP_REPO_CONFLICT` names `conflicting_paths`. A
264
+ * commit that changes nothing returns `{ committed: false, head }`.
265
+ */
266
+ async commit(projectId, repoName, opts) {
267
+ const context = "committing to app repo";
268
+ requireArg(projectId, "projectId", context);
269
+ requireArg(repoName, "repoName", context);
270
+ if (!opts || typeof opts.files !== "object" || opts.files === null) {
271
+ throw new LocalError("appRepos.commit: files is required (a map from path to content)", context);
272
+ }
273
+ const body = { files: wireFiles(opts.files) };
274
+ if (opts.message !== undefined)
275
+ body.message = opts.message;
276
+ if (opts.author !== undefined)
277
+ body.author = opts.author;
278
+ if (opts.parent !== undefined)
279
+ body.parent = opts.parent;
280
+ if (opts.base !== undefined)
281
+ body.base = opts.base;
282
+ return this.client.request(`${repoPath(projectId, repoName)}/commits`, {
283
+ method: "POST",
284
+ body,
285
+ authMeta: authMeta("commit", projectId),
286
+ projectKeyFallback: projectId,
287
+ context,
288
+ });
289
+ }
290
+ /**
291
+ * Commit the inverse of `commit`'s changes (undo is a new commit; history is
292
+ * never rewritten). It lands on the head unless a path it restores changed
293
+ * after `commit` (`409 APP_REPO_CONFLICT`).
294
+ */
295
+ async revert(projectId, repoName, commit, opts = {}) {
296
+ const context = "reverting app repo commit";
297
+ requireArg(projectId, "projectId", context);
298
+ requireArg(repoName, "repoName", context);
299
+ requireArg(commit, "commit", context);
300
+ const body = { commit };
301
+ if (opts.message !== undefined)
302
+ body.message = opts.message;
303
+ return this.client.request(`${repoPath(projectId, repoName)}/reverts`, {
304
+ method: "POST",
305
+ body,
306
+ authMeta: authMeta("revert", projectId),
307
+ projectKeyFallback: projectId,
308
+ context,
309
+ });
310
+ }
311
+ }
312
+ //# sourceMappingURL=app-repos.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-repos.js","sourceRoot":"","sources":["../../src/namespaces/app-repos.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAGH,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,kBAAkB,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAoBrH,SAAS,cAAc,CAAC,SAAiB;IACvC,OAAO,gBAAgB,kBAAkB,CAAC,SAAS,CAAC,YAAY,CAAC;AACnE,CAAC;AAED,SAAS,QAAQ,CAAC,SAAiB,EAAE,QAAgB;IACnD,OAAO,GAAG,cAAc,CAAC,SAAS,CAAC,IAAI,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAC;AACxE,CAAC;AAED,yEAAyE;AACzE,SAAS,kBAAkB,CAAC,IAAY;IACtC,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACvF,CAAC;AAED,SAAS,SAAS,CAAC,IAAY,EAAE,MAAmD;IAClF,MAAM,EAAE,GAAG,IAAI,eAAe,EAAE,CAAC;IACjC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,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IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5D,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAsB,GAAG,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,UAAU,EAAE;YAC1F,MAAM,EAAE,MAAM;YACd,IAAI;YACJ,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;YACvC,kBAAkB,EAAE,SAAS;YAC7B,OAAO;SACR,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,188 @@
1
+ /**
2
+ * Types for the `appRepos` namespace: plain git repositories owned by a
3
+ * project and written by its app (`/projects/v1/:project_id/app-repos`).
4
+ *
5
+ * An app repo is NOT a KyGit vault: it is unencrypted, the platform reads its
6
+ * files to serve them, and it has one linear branch, `main`. The encrypted
7
+ * remote for source is `r.repos`. Every project has a `default` app repo that
8
+ * needs no creation; until its first commit it reads as an empty repository
9
+ * (`head: null`, no files, an empty log).
10
+ */
11
+ /** A git identity as the history records it. */
12
+ export interface AppRepoPerson {
13
+ name: string;
14
+ email: string;
15
+ }
16
+ /** One app repo (`GET /projects/v1/:project_id/app-repos/:repo_name`). */
17
+ export interface AppRepo {
18
+ /** `default`, or a name matching `^[a-z0-9][a-z0-9._-]{0,63}$` (never ending in `.git`). */
19
+ repo_name: string;
20
+ /** The commit `main` points at; `null` for an empty repo. */
21
+ head: string | null;
22
+ /** The head commit's per-repo sequence number; `null` for an empty repo. */
23
+ seq: number | null;
24
+ commit_count: number;
25
+ /** Bytes of the objects this repo references (counted toward the organization's pooled storage). */
26
+ size_bytes: number;
27
+ /** `size_bytes` as a decimal label, e.g. `"1.2 MB"`. */
28
+ size: string;
29
+ /** `https://…/projects/v1/:project_id/app-repos/:repo_name.git`; holds no credential. Clone it with `run402 app-repos clone`. */
30
+ clone_url: string;
31
+ /** `null` for the `default` repo before its first commit. */
32
+ created_at: string | null;
33
+ updated_at: string | null;
34
+ }
35
+ /** `GET /projects/v1/:project_id/app-repos`: `default` is always listed. */
36
+ export interface AppRepoList {
37
+ app_repos: AppRepo[];
38
+ }
39
+ /** `POST /projects/v1/:project_id/app-repos`. */
40
+ export interface AppRepoCreateOptions {
41
+ repo_name: string;
42
+ /** Another repo of the same project to start from: its head and history are copied, its objects shared (no bytes copied). */
43
+ from?: string;
44
+ }
45
+ /** `DELETE …/app-repos/:repo_name?confirm=<repo_name>`. */
46
+ export interface AppRepoDeleteOptions {
47
+ /** Must equal the repo name. */
48
+ confirm: string;
49
+ }
50
+ export interface AppRepoDeleteResult {
51
+ deleted: true;
52
+ repo_name: string;
53
+ }
54
+ /** One commit on `main`, as the log records it. */
55
+ export interface AppRepoCommit {
56
+ commit: string;
57
+ /** First parent; `null` for the first commit. */
58
+ parent: string | null;
59
+ seq: number;
60
+ author: AppRepoPerson;
61
+ committer: AppRepoPerson;
62
+ message: string;
63
+ committed_at: string;
64
+ /** Changed paths relative to the first parent, capped at 100. */
65
+ paths: string[];
66
+ /** Exact number of changed paths. */
67
+ paths_total: number;
68
+ /** The end user the gateway verified for an app commit (`Run402-Actor` trailer); `null` otherwise. */
69
+ actor_user_id: string | null;
70
+ }
71
+ export interface AppRepoLogOptions {
72
+ /** Only commits that changed this path (a file, or a directory prefix). */
73
+ path?: string;
74
+ /** `next_cursor` from the previous page. */
75
+ cursor?: string;
76
+ /** 1–100, default 50. */
77
+ limit?: number;
78
+ }
79
+ /** `GET …/:repo_name/commits`: newest first. */
80
+ export interface AppRepoLogPage {
81
+ commits: AppRepoCommit[];
82
+ head: string | null;
83
+ has_more: boolean;
84
+ next_cursor: string | null;
85
+ }
86
+ export interface AppRepoReadOptions {
87
+ /** A commit id; omitted reads the head. */
88
+ at?: string;
89
+ }
90
+ /** A file read with `readFile`. */
91
+ export interface AppRepoFile {
92
+ repo_name: string;
93
+ path: string;
94
+ /** The commit read (`X-Run402-Commit`). */
95
+ commit: string | null;
96
+ /** The blob's git object id (`ETag`). */
97
+ oid: string | null;
98
+ content_type: string | null;
99
+ size_bytes: number;
100
+ bytes: Uint8Array;
101
+ /** `bytes` decoded as UTF-8, or `null` when they are not valid UTF-8. */
102
+ text: string | null;
103
+ }
104
+ export interface AppRepoTreeEntry {
105
+ name: string;
106
+ path: string;
107
+ type: "file" | "dir";
108
+ /** File size in bytes; `null` for a directory. */
109
+ size: number | null;
110
+ oid: string;
111
+ }
112
+ /** `GET …/:repo_name/tree[/<path>]`. */
113
+ export interface AppRepoTree {
114
+ /** `null` for an empty repo (and then `entries` is empty). */
115
+ commit: string | null;
116
+ path: string;
117
+ entries: AppRepoTreeEntry[];
118
+ }
119
+ export interface AppRepoDiffChange {
120
+ path: string;
121
+ status: "added" | "modified" | "deleted";
122
+ old_oid: string | null;
123
+ new_oid: string | null;
124
+ }
125
+ /** `GET …/:repo_name/diff?from=&to=`. */
126
+ export interface AppRepoDiff {
127
+ from: string;
128
+ to: string;
129
+ changes: AppRepoDiffChange[];
130
+ }
131
+ /**
132
+ * One path's new content on the wire: UTF-8 text, base64 bytes, or a JSON
133
+ * value the gateway writes canonically (object keys sorted, two-space
134
+ * indent, a trailing newline).
135
+ */
136
+ export type AppRepoFileContent = {
137
+ text: string;
138
+ } | {
139
+ base64: string;
140
+ } | {
141
+ json: unknown;
142
+ };
143
+ /**
144
+ * Path → content. A `string` is shorthand for `{ text }`, a `Uint8Array` for
145
+ * `{ base64 }`, and `null` deletes the path. Paths have no leading `/`, no
146
+ * `.`, `..` or `.git` segment; at most 1,000 entries; each file at most
147
+ * 4 MiB (`APP_REPO_FILE_TOO_LARGE`: put media in `assets.put` and commit a
148
+ * reference).
149
+ */
150
+ export type AppRepoCommitFiles = Record<string, AppRepoFileContent | string | Uint8Array | null>;
151
+ /** `POST …/:repo_name/commits`. */
152
+ export interface AppRepoCommitOptions {
153
+ files: AppRepoCommitFiles;
154
+ /** Default `Update <path>` for one path, `Update <n> files` otherwise. */
155
+ message?: string;
156
+ /** Who the commit names as author; the committer is always the app. */
157
+ author?: AppRepoPerson;
158
+ /** Land only if this is still the head (`409 APP_REPO_CONFLICT` otherwise). */
159
+ parent?: string;
160
+ /**
161
+ * The commit you read from (default: the head). Without `parent`, the
162
+ * commit lands on a newer head only when none of its paths changed since
163
+ * `base`; otherwise `409 APP_REPO_CONFLICT` with `details.conflicting_paths`.
164
+ */
165
+ base?: string;
166
+ }
167
+ /** `POST …/:repo_name/reverts`. */
168
+ export interface AppRepoRevertOptions {
169
+ /** Default `Revert "<subject>"`, with the trailer `This reverts commit <commit>.` */
170
+ message?: string;
171
+ }
172
+ /** A commit that changed something (`201`). */
173
+ export interface AppRepoCommitted {
174
+ committed: true;
175
+ commit: string;
176
+ parent: string | null;
177
+ head: string;
178
+ seq: number;
179
+ paths: string[];
180
+ author: AppRepoPerson;
181
+ }
182
+ /** A commit that changed nothing (`200`): no commit was created. */
183
+ export interface AppRepoNotCommitted {
184
+ committed: false;
185
+ head: string | null;
186
+ }
187
+ export type AppRepoCommitResult = AppRepoCommitted | AppRepoNotCommitted;
188
+ //# sourceMappingURL=app-repos.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-repos.types.d.ts","sourceRoot":"","sources":["../../src/namespaces/app-repos.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,gDAAgD;AAChD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,0EAA0E;AAC1E,MAAM,WAAW,OAAO;IACtB,4FAA4F;IAC5F,SAAS,EAAE,MAAM,CAAC;IAClB,6DAA6D;IAC7D,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,4EAA4E;IAC5E,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,oGAAoG;IACpG,UAAU,EAAE,MAAM,CAAC;IACnB,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,iIAAiI;IACjI,SAAS,EAAE,MAAM,CAAC;I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ories owned by a
3
+ * project and written by its app (`/projects/v1/:project_id/app-repos`).
4
+ *
5
+ * An app repo is NOT a KyGit vault: it is unencrypted, the platform reads its
6
+ * files to serve them, and it has one linear branch, `main`. The encrypted
7
+ * remote for source is `r.repos`. Every project has a `default` app repo that
8
+ * needs no creation; until its first commit it reads as an empty repository
9
+ * (`head: null`, no files, an empty log).
10
+ */
11
+ export {};
12
+ //# sourceMappingURL=app-repos.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-repos.types.js","sourceRoot":"","sources":["../../src/namespaces/app-repos.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}