ref0-git 0.20.0 → 0.25.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.
@@ -960,7 +960,7 @@ export interface components {
960
960
  message: string;
961
961
  hint?: string;
962
962
  context?: {
963
- reason?: ("too-large" | "rate-limited" | "walk-limit" | "diff-limit" | "object-too-large" | "repo-too-large" | "delta-too-large" | "response-too-large" | "too-many-pointers" | "fetch-plan-too-large" | "too-many-store-calls" | "call-budget" | "events-undelivered" | "events-waiting" | "name-churn" | "queue-full" | "queue-targets-full" | "too-many-gitmodules-and-gitattributes" | "prune-walk-too-large" | "job-step-calls" | "job-step-yielded" | "fork-chunks-past-budget") | string;
963
+ reason?: ("too-large" | "rate-limited" | "walk-limit" | "diff-limit" | "object-too-large" | "repo-too-large" | "delta-too-large" | "response-too-large" | "too-many-pointers" | "fetch-plan-too-large" | "too-many-store-calls" | "call-budget" | "events-undelivered" | "events-waiting" | "name-churn" | "queue-full" | "queue-targets-full" | "too-many-gitmodules-and-gitattributes" | "prune-walk-too-large" | "job-step-calls" | "job-step-yielded" | "fork-chunks-past-budget" | "delta-chain-too-deep") | string;
964
964
  indexBytes?: number | ("Infinity" | "-Infinity" | "NaN");
965
965
  pushBytes?: number | ("Infinity" | "-Infinity" | "NaN");
966
966
  most?: number | ("Infinity" | "-Infinity" | "NaN");
@@ -271,11 +271,6 @@ const tokenEndedRefusal = {
271
271
  message: "This token's person no longer holds the org or the shared repo it's over",
272
272
  };
273
273
 
274
- /** At most `most` of an owner's private repos the caller may read, as the owner index asks. */
275
- export type ReadableRepos = (
276
- input: GitHubReadableReposInput,
277
- ) => Effect.Effect<Awaited<ReturnType<GitHubReadableRepos>>, GitError>;
278
-
279
274
  /**
280
275
  * The host's policy and directory, the drop-in's and Git's, over its people and orgs: Git's
281
276
  * `Policy`'s decision, the drop-in's `authorize` and `People`, and the owner index's hook.
@@ -284,7 +279,7 @@ export interface HostPolicy {
284
279
  readonly authorize: Policy.PolicyService['authorize'];
285
280
  readonly authorizeGitHub: GitHubAuthorize;
286
281
  readonly people: PeopleFor;
287
- readonly readableRepos: ReadableRepos;
282
+ readonly readableRepos: GitHubReadableRepos;
288
283
  }
289
284
 
290
285
  /** The host's policy over its repos' grants, with the drop-in's `RepoGrants` over the same rows. */
@@ -781,7 +776,7 @@ export function hostPolicy(orgs: Orgs, options: HostPolicyOptions = {}): HostPol
781
776
  * `authorize` holds as any name. Git lists them newest made first, since it keeps no time a repo
782
777
  * was updated.
783
778
  */
784
- const readableRepos: ReadableRepos = Effect.fnUntraced(function* (input) {
779
+ const readableRepos: GitHubReadableRepos = Effect.fnUntraced(function* (input) {
785
780
  const { actor, owner, most, token } = input;
786
781
  const none = { names: [], more: false };
787
782
  if (actor.anonymous === true || !(yield* tokenHolds(input))) return none;
@@ -1,4 +1,4 @@
1
- import { signInPaths } from '@ref0/git/auth';
1
+ import { signInPaths } from '@ref0/git';
2
2
  import { Records } from '@ref0/infra';
3
3
  import * as Clock from 'effect/Clock';
4
4
  import * as Effect from 'effect/Effect';
@@ -1,6 +1,5 @@
1
1
  import type { DeviceApproval, GrantScope } from '@ref0/git';
2
- import { ghClientId, ghWriteScope } from '@ref0/git/auth';
3
- import { grantScopes } from '@ref0/git';
2
+ import { ghClientId, ghWriteScope, grantScopes } from '@ref0/git';
4
3
  import * as Option from 'effect/Option';
5
4
  import * as Schema from 'effect/Schema';
6
5
 
@@ -67,7 +67,7 @@ catalog:
67
67
  # The app's Markdown renderer: words, a WebAssembly parser, with hooks for GitHub's alerts,
68
68
  # anchors, references and URLs (Q213). Apache-2.0.
69
69
  '@pierre/words': 0.3.0
70
- '@ref0/workspace': 0.13.0
70
+ '@ref0/workspace': 0.17.0
71
71
  '@tailwindcss/vite': 4.3.5
72
72
  # The app's stack: TanStack Start, its router and Query, and React, as spike F ran them, at the
73
73
  # newest releases past pnpm's minimum release age.
@@ -221,4 +221,4 @@ allowBuilds:
221
221
  workerd: true
222
222
 
223
223
  minimumReleaseAgeExclude:
224
- - '@ref0/workspace@0.13.0'
224
+ - '@ref0/workspace@0.17.0'
@@ -14,13 +14,12 @@ import * as Schema from "effect/Schema";
14
14
  import * as Duration from "effect/Duration";
15
15
  import * as DateTime from "effect/DateTime";
16
16
  import * as Flag from "effect/cli/Flag";
17
- import { RestClient } from "@ref0/git";
17
+ import { RestClient, deviceGrant, ghClientId, ghWriteScope, readAccessTokenAnswer, readDeviceCodeAnswer, signInPaths } from "@ref0/git";
18
18
  import * as Argument from "effect/cli/Argument";
19
19
  import * as Clock from "effect/Clock";
20
20
  import * as HttpClient from "effect/http/HttpClient";
21
21
  import * as HttpClientRequest from "effect/http/HttpClientRequest";
22
22
  import * as Result from "effect/Result";
23
- import { deviceGrant, ghClientId, ghWriteScope, readAccessTokenAnswer, readDeviceCodeAnswer, signInPaths } from "@ref0/git/auth";
24
23
  // src/cli/sign-in.ts
25
24
  /**
26
25
  * `login`, `logout` and `whoami`. A token reaches Git's helpers through `git credential approve`
@@ -42,7 +41,7 @@ const pollMissesMost = 5;
42
41
  const tooManyRequests = 429;
43
42
  /**
44
43
  * A form POST to the host's sign-in, at its origin's root whatever its base path, as GitHub's is,
45
- * with its status and its JSON read by `read`, as `@ref0/git/auth` reads the server's answer, or
44
+ * with its status and its JSON read by `read`, as `@ref0/git` reads the server's answer, or
46
45
  * `undefined`, within `within` ms. It follows no redirect, which could send the device code, and
47
46
  * the token, elsewhere.
48
47
  */
package/dist/init/app.mjs CHANGED
@@ -2,7 +2,7 @@ import { bucketLine, bucketName, devVars, limitsLine, looseInfraImport, mergePac
2
2
  import { ignoring, importLine, lines, listed, withCli } from "./files.mjs";
3
3
  import { bucketLines, firstImports, infraImports, partsOf, storeLines } from "./node.mjs";
4
4
  import { specOf } from "./versions.mjs";
5
- import { lfsLines, looseSays, writtenCpu } from "./git-module.mjs";
5
+ import { lfsLines, looseSays, workerStoreLines, writtenCpu } from "./git-module.mjs";
6
6
  import { jsonString, manifestText } from "./jsonc.mjs";
7
7
  import { filled, platforms, templates, unless } from "./template.mjs";
8
8
  import { blockOf, catalogOf } from "./workspace.mjs";
@@ -135,7 +135,7 @@ const cloudflareGit = (choices) => {
135
135
  effectImport: unless(packs, ""),
136
136
  safety: unless(packs, "binds the objects, and D1"),
137
137
  bucket: unless(packs, ""),
138
- adapter: unless(packs, "/** The records and job objects. */\nconst adapter = layer({ records: env.RECORDS, jobs: env.JOBS });"),
138
+ adapter: unless(packs, `/** The records and job objects. */\n${workerStoreLines(writtenCpu)}\n\nconst adapter = store;`),
139
139
  uploads: unless(packs, ""),
140
140
  lfs: packs ? `${lfsLines(" ", writtenCpu)}\n` : "",
141
141
  ...bodySlots(choices)
@@ -1,5 +1,5 @@
1
1
  import { fitted, ignoring, lines, withCli, withDependencies, withLines } from "./files.mjs";
2
- import { effectImports, featuresLines, gitDependencies, gitImports, gitPackages, header, runtimeLines, writtenCpu } from "./git-module.mjs";
2
+ import { effectImports, featuresLines, gitDependencies, gitImports, gitPackages, header, runtimeLines, workerStoreLines, writtenCpu } from "./git-module.mjs";
3
3
  import { itemsAt, jsonString, manifestText, nodeAt, parseJsonc, stringAt, withEntries, withValue } from "./jsonc.mjs";
4
4
  import { filled, templates, unless } from "./template.mjs";
5
5
  import { catalog } from "./metadata.mjs";
@@ -31,8 +31,6 @@ const gitClasses = [{
31
31
  }];
32
32
  /** The infra import of a `src/git.ts` with no bucket. */
33
33
  const looseInfraImport = "import { layer, toJobObject, toRecordsObject } from '@ref0/infra/cloudflare';";
34
- /** The adapter of a `src/git.ts` with no bucket: the records and jobs' Layer alone. */
35
- const looseAdapter = lines("/** The records and job objects. */", "const adapter = layer({ records: env.RECORDS, jobs: env.JOBS });", "", "");
36
34
  /** A push's pack upload, once the bucket signs parts: `signed` only with R2's S3 credentials. */
37
35
  const uploads = lines(" // A push past 64 MiB may upload its pack, once the bucket signs parts.", " signed === undefined", " ? Layer.empty", " : Layer.provide(Git.layerUploads({ above: 64 * 1024 * 1024 }), signed),");
38
36
  /** `src/git.ts`: `examples/git-worker`'s own, with what it serves, the store and the queue as chosen. */
@@ -45,7 +43,10 @@ const gitModule = (choices, envFile, cpu) => {
45
43
  effectImports: `${effectImports(choices, true)}\n`,
46
44
  envFile: `'${envFile}'`,
47
45
  safety: unless(packs, "binds the objects"),
48
- bucket: unless(packs, looseAdapter),
46
+ bucket: unless(packs, ""),
47
+ storeAbout: unless(packs, "/** The records and job objects. */\n"),
48
+ store: workerStoreLines(cpu),
49
+ adapter: unless(packs, "const adapter = store;\n\n"),
49
50
  merge: unless(choices.queue === "on", ""),
50
51
  features: `${featuresLines(choices, {
51
52
  admins: true,
@@ -378,4 +379,4 @@ const cloudflareOutput = (choices, project, secret, vendor) => {
378
379
  next: "Check it, then deploy it"
379
380
  };
380
381
  };
381
- export { adminsVar, bucketLine, bucketName, cloudflareOutput, configCpu, configParts, devVars, gitClasses, gitModule, gitSecrets, limitsLine, looseAdapter, looseInfraImport, mergePackage, mergeWrangler, secretFiles };
382
+ export { adminsVar, bucketLine, bucketName, cloudflareOutput, configCpu, configParts, devVars, gitClasses, gitModule, gitSecrets, limitsLine, looseInfraImport, mergePackage, mergeWrangler, secretFiles };
@@ -8,7 +8,7 @@ import * as Schema from "effect/Schema";
8
8
  // src/init/create.ts
9
9
  /** The create commands' packages, at the versions each was run at on 20 Nov, as `init.md` lists. */
10
10
  const creators = {
11
- next: "create-next-app@16.4.6",
11
+ next: "create-next-app@16.5.0",
12
12
  sveltekit: "sv@1.7.1",
13
13
  nuxt: "create-nuxt@4.1.1"
14
14
  };
@@ -94,11 +94,19 @@ const writtenCpu = {
94
94
  ms: workerCpuMs,
95
95
  file: "wrangler.jsonc"
96
96
  };
97
+ /** `cpu`'s milliseconds as a TypeScript literal, `300_000`. */
98
+ const cpuMsText = (cpu) => cpu.ms.toLocaleString("en-US").replaceAll(",", "_");
97
99
  /**
98
100
  * `Lfs.layer`'s line at `indent`, with its comment: on a Worker whose config sets `limits.cpu_ms`,
99
101
  * its uploads held to that `cpu`, and elsewhere to what the adapter says its platform gives.
100
102
  */
101
- const lfsLines = (indent, cpu) => cpu === void 0 ? `${indent}// Git LFS, its objects in the bucket beside the packs.\n${indent}Lfs.layer(),` : lines(`${indent}// Git LFS, its objects in the bucket beside the packs. An upload through the Worker may use`, `${indent}// \`limits.cpu_ms\` from ${cpu.file}: raise both together.`, `${indent}Lfs.layer({ cpuMs: ${cpu.ms.toLocaleString("en-US").replaceAll(",", "_")} }),`);
103
+ const lfsLines = (indent, cpu) => cpu === void 0 ? `${indent}// Git LFS, its objects in the bucket beside the packs.\n${indent}Lfs.layer(),` : lines(`${indent}// Git LFS, its objects in the bucket beside the packs. An upload through the Worker may use`, `${indent}// \`limits.cpu_ms\` from ${cpu.file}: raise both together.`, `${indent}Lfs.layer({ cpuMs: ${cpuMsText(cpu)} }),`);
104
+ /**
105
+ * A Worker's records and job objects, its `store`: on a Worker whose config sets `limits.cpu_ms`,
106
+ * a job object chains its tries within one alarm up to that `cpu`, and elsewhere within Workers'
107
+ * default.
108
+ */
109
+ const workerStoreLines = (cpu) => cpu === void 0 ? "const store = layer({ records: env.RECORDS, jobs: env.JOBS });" : lines("const store = layer({", " records: env.RECORDS,", " jobs: env.JOBS,", ` // \`limits.cpu_ms\` from ${cpu.file}, so a job object chains its tries within one alarm:`, " // raise both together.", ` requestLimits: { cpuMs: ${cpuMsText(cpu)} },`, "});");
102
110
  /**
103
111
  * The queue's line: under the drop-in, a pull request's key merges once, so a push to it after its
104
112
  * merge isn't queued again before the drop-in sees the merge.
@@ -138,4 +146,4 @@ const gitOptions = (choices, maxDuration) => {
138
146
  * adapter, one runtime that every entry, object and job runner takes.
139
147
  */
140
148
  const runtimeLines = (choices, parts) => lines(parts.bootstrap === true ? lines("/** The bootstrap's sign-in, while `ADMIN_TOKEN` holds one: a Bearer token, or Basic's password. */", "const auth =", ` ${parts.token} === undefined || ${parts.token} === ''`, " ? Layer.empty", ` : Auth.layer(Auth.bearer({ token: Redacted.make(${parts.token}), actor: bootstrap }));`) : lines("/** The admin's sign-in: `ADMIN_TOKEN`, as a Bearer token or as Basic's password. */", `const auth = Auth.bearer({ token: Redacted.make(${parts.token}), actor: admin });`), "", "/**", " * The whole host, one runtime that every request and job shares: Git and its features over the", ` * adapter, deciding with \`policy\`, and the ${parts.bootstrap === true ? "bootstrap" : "admin"} signing in with \`auth\`.`, parts.jobs !== void 0 && ` * ${parts.jobs}`, " */", "export const runtime = Git.runtime(", parts.maxDuration !== void 0 && lines(" // The functions' `maxDuration`, from `vercel.json`: a clone that would outrun it ends first,", " // with Git's own message."), ` Git.layer(${gitOptions(choices, parts.maxDuration)}, ${choices.serve === "github" ? "github" : "features"}).pipe(`, " Layer.provide(Policy.layer(policy)),", parts.bootstrap === true ? " Layer.provide(auth)," : " Layer.provide(Auth.layer(auth)),", choices.objects === "packs" ? " Layer.provide(Objects.layer())," : ` // Each object a row in its push's commit: no bucket, ${looseSays}.\n Layer.provide(Objects.layerRecords()),`, ` Layer.provideMerge(${parts.adapter}),`, " ),", ");", "");
141
- export { adminLines, effectImports, featuresLines, gitDependencies, gitImports, gitPackages, header, lfsLines, looseSays, mergeLines, policyLines, queueLine, repoHint, runtimeLines, writtenCpu };
149
+ export { adminLines, effectImports, featuresLines, gitDependencies, gitImports, gitPackages, header, lfsLines, looseSays, mergeLines, policyLines, queueLine, repoHint, runtimeLines, workerStoreLines, writtenCpu };
@@ -1,6 +1,6 @@
1
1
  // src/init/metadata.ts
2
2
  /** The version `ref0-git`, `create-ref0-git` and Git's packages release at, all at once (Q738). */
3
- const release = "0.20.0";
3
+ const release = "0.25.0";
4
4
  /** The packages the app depends on, by their folder in a checkout's `packages/`. */
5
5
  const appPackages = [
6
6
  "infra",
@@ -5,7 +5,7 @@ import { storePackages } from "./metadata.mjs";
5
5
  const recordsPart = (records) => records === "postgres" ? {
6
6
  external: ["import pg from 'pg';"],
7
7
  infra: "import * as Postgres from '@ref0/infra/postgres';",
8
- code: lines("const store = Postgres.layer({", " pool: new pg.Pool({ connectionString: need('DATABASE_URL') }),", " wake,", "});"),
8
+ code: lines("const store = Postgres.layer({", " // A call waits at most 10 s for one of the pool's connections, then fails, never hangs.", " pool: new pg.Pool({ connectionString: need('DATABASE_URL'), connectionTimeoutMillis: 10_000 }),", " wake,", "});"),
9
9
  variables: ["DATABASE_URL"],
10
10
  dependencies: [["pg", storePackages.pg]],
11
11
  devDependencies: [["@types/pg", storePackages["@types/pg"]]]
@@ -64,6 +64,9 @@ const workerGitSlots = [
64
64
  "envFile",
65
65
  "safety",
66
66
  "bucket",
67
+ "storeAbout",
68
+ "store",
69
+ "adapter",
67
70
  "merge",
68
71
  "features",
69
72
  "runtime"
@@ -41,7 +41,7 @@ var templates_default = {
41
41
  "/** The key sessions and host sessions are sealed under, derived once an isolate from its secret. */\nexport const sessionKey = sealKey(env.SESSION_SECRET);\n\n/**\n * Who owns what, and the drop-in's people and orgs, over Better Auth's tables, which `auth` makes\n * at the first request that reads them.\n */\nexport const directory = orgsOver(async () => readyAdapter(await auth()));\n\n/** People's, orgs' and repos' pictures, in Better Auth's database, as `directory` reads it. */\nexport const pictures = avatars(async () => readyAdapter(await auth()));\n\n/** Each repo's grants to people, its collaborators, in Better Auth's database, as `directory` reads it. */\nexport const grants = grantsOver(async () => readyAdapter(await auth()));\n\n/**\n * Git's services on the runtime below, in the caller's fiber: the policy reads its repos' records\n * through it within the request it decides, its store calls counted on that request's.\n */\nexport const host: OnHost = onHost(() => runtime);\n\nconst { repoName, repoId } = repoRecordsOn(host);\n\nexport const policy: GrantsPolicy = hostPolicy(directory, {\n origin: env.APP_ORIGIN,\n avatars: pictures,\n privateRepos: privateReposOf(host),\n repoName,\n // Who else may do what on a repo, by its grants, and which repo a token over one names now.\n grants,\n repoId,\n});\n\n",
42
42
  {
43
43
  "slot": "adapter",
44
- "text": "/** The records and job objects, and the bucket. */\nconst adapter = Layer.merge(layer({ records: env.RECORDS, jobs: env.JOBS }), bucket);"
44
+ "text": "/** The records and job objects, and the bucket. */\nconst store = layer({\n records: env.RECORDS,\n jobs: env.JOBS,\n // `limits.cpu_ms` from wrangler.jsonc, so a job object chains its tries within one alarm:\n // raise both together.\n requestLimits: { cpuMs: 300_000 },\n});\n\nconst adapter = Layer.merge(store, bucket);"
45
45
  },
46
46
  "\n\n",
47
47
  {
@@ -66,7 +66,7 @@ var templates_default = {
66
66
  "slot": "queue",
67
67
  "text": " // Each repo's `main` has a merge queue, beside the merge button: its protection still takes\n // a direct merge, as GitHub's does on a branch whose rules don't ask for the queue.\n MergeQueue.layer({ target: 'refs/heads/main', keys: 'once', merge: queueMerge }),\n"
68
68
  },
69
- " // The device flow's sign-in for `gh` and `ref0-git login`, which the page decides in the\n // person's session, from the Better Auth below and Git's own `identify`.\n SignIn.layer({\n approvalPage: approvalPage({\n auth: () => auth(),\n sealKey: sessionKey,\n identify: (request): ReturnType<Identify> => host(Git.identify(request)),\n origin: env.APP_ORIGIN,\n }),\n }),\n ),\n ),\n Layer.provideMerge(Tokens.layer()),\n Layer.provideMerge(Merges.layer({ xdiff })),\n);\n\n/**\n * The whole host, one runtime a process: Git and its features over the records, the jobs and the\n * bucket, as the policy decides, with `hostRules` its push rules.\n */\nexport const runtime = Git.runtime(\n hostLayer(adapter, objects, features, {\n authorize: policy.authorize,\n auth: appAuth({ adminToken: env.ADMIN_TOKEN, admin, key: sessionKey }),\n authorizeGitHub: policy.authorizeGitHub,\n rules: hostRules.map((each) => each.rule),\n }),\n);\n\n/**\n * Better Auth, made at a request that needs it, not the isolate's start: who signs up and in, in\n * `AUTH_DB`, each session with a Git token of its own. It's kept once a request's check settles.\n */\nexport const auth = readyAuth(() =>\n starterAuth({\n database: env.AUTH_DB,\n secret: env.SESSION_SECRET,\n origin: env.APP_ORIGIN,\n signUp: env.SIGN_UP !== 'closed',\n key: sessionKey,\n tokens: tokensOn(host),\n // Cloudflare's own, which it sets on every request in place of any the caller sent.\n ipHeader: 'cf-connecting-ip',\n ownsRepos: (login) =>\n Effect.match(host(Repos.list({ actor: admin, prefix: `${login}/`, page: { limit: 1 } })), {\n onFailure: () => true,\n onSuccess: (listed) => listed.items.length > 0,\n }),\n }),\n);\n\n/** The records objects, one per scope, as `wrangler.jsonc`'s `class_name`s name them. */\nexport const Records = toRecordsObject(runtime);\n\n/** The job objects, one per scope and job, which a records object's alarm rings. */\nexport const Jobs = toJobObject(runtime);\n"
69
+ " // The device flow's sign-in for `gh` and `ref0-git login`, which the page decides in the\n // person's session, from the Better Auth below and Git's own `identify`.\n SignIn.layer({\n approvalPage: approvalPage({\n auth: () => auth(),\n sealKey: sessionKey,\n identify: (request): ReturnType<Identify> => host(Git.identify(request)),\n origin: env.APP_ORIGIN,\n }),\n }),\n ),\n ),\n Layer.provideMerge(Tokens.layer()),\n Layer.provideMerge(Merges.layer({ xdiff })),\n);\n\n/**\n * The whole host, one runtime a process: Git and its features over the records, the jobs and the\n * bucket, as the policy decides, with `hostRules` its push rules.\n */\nexport const runtime = Git.runtime(\n hostLayer(adapter, objects, features, {\n authorize: policy.authorize,\n auth: appAuth({ adminToken: env.ADMIN_TOKEN, admin, key: sessionKey }),\n authorizeGitHub: policy.authorizeGitHub,\n rules: hostRules.map((each) => each.rule),\n }),\n);\n\n/**\n * Better Auth, made at a request that needs it, not the isolate's start: who signs up and in, in\n * `AUTH_DB`, each session with a Git token of its own. It's kept once a request's check settles.\n */\nexport const auth = readyAuth(() =>\n starterAuth({\n database: env.AUTH_DB,\n secret: env.SESSION_SECRET,\n origin: env.APP_ORIGIN,\n signUp: env.SIGN_UP !== 'closed',\n key: sessionKey,\n tokens: tokensOn(host),\n // Cloudflare's own, which it sets on every request in place of any the caller sent.\n ipHeader: 'cf-connecting-ip',\n ownsRepos: (login) =>\n Effect.match(host(Repos.list({ actor: admin, prefix: `${login}/`, page: { limit: 1 } })), {\n onFailure: () => true,\n onSuccess: (listed) => listed.items.length > 0,\n }),\n }),\n);\n\n/** The records objects, one per scope, as `wrangler.jsonc`'s `class_name`s name them. */\nexport const Records = toRecordsObject(store);\n\n/** The job objects, one per scope and job, which a records object's alarm rings. */\nexport const Jobs = toJobObject(runtime);\n"
70
70
  ],
71
71
  appGitNode: [
72
72
  {
@@ -80,7 +80,7 @@ var templates_default = {
80
80
  "/** The key sessions and host sessions are sealed under, derived once an isolate from its secret. */\nexport const sessionKey = sealKey(env.SESSION_SECRET);\n\n/**\n * Who owns what, and the drop-in's people and orgs, over Better Auth's tables, which `auth` makes\n * at the first request that reads them.\n */\nexport const directory = orgsOver(async () => readyAdapter(await auth()));\n\n/** People's, orgs' and repos' pictures, in Better Auth's database, as `directory` reads it. */\nexport const pictures = avatars(async () => readyAdapter(await auth()));\n\n/** Each repo's grants to people, its collaborators, in Better Auth's database, as `directory` reads it. */\nexport const grants = grantsOver(async () => readyAdapter(await auth()));\n\n/**\n * Git's services on the runtime below, in the caller's fiber: the policy reads its repos' records\n * through it within the request it decides, its store calls counted on that request's.\n */\nexport const host: OnHost = onHost(() => runtime);\n\nconst { repoName, repoId } = repoRecordsOn(host);\n\nexport const policy: GrantsPolicy = hostPolicy(directory, {\n origin: env.APP_ORIGIN,\n avatars: pictures,\n privateRepos: privateReposOf(host),\n repoName,\n // Who else may do what on a repo, by its grants, and which repo a token over one names now.\n grants,\n repoId,\n});\n\n",
81
81
  {
82
82
  "slot": "adapter",
83
- "text": "/** The records and job objects, and the bucket. */\nconst adapter = Layer.merge(layer({ records: env.RECORDS, jobs: env.JOBS }), bucket);"
83
+ "text": "/** The records and job objects, and the bucket. */\nconst store = layer({\n records: env.RECORDS,\n jobs: env.JOBS,\n // `limits.cpu_ms` from wrangler.jsonc, so a job object chains its tries within one alarm:\n // raise both together.\n requestLimits: { cpuMs: 300_000 },\n});\n\nconst adapter = Layer.merge(store, bucket);"
84
84
  },
85
85
  "\n\n",
86
86
  {
@@ -123,7 +123,7 @@ var templates_default = {
123
123
  " ownsRepos: (login) =>\n Effect.match(host(Repos.list({ actor: admin, prefix: `${login}/`, page: { limit: 1 } })), {\n onFailure: () => true,\n onSuccess: (listed) => listed.items.length > 0,\n }),\n }),\n);\n",
124
124
  {
125
125
  "slot": "classes",
126
- "text": "\n/** The records objects, one per scope, as `wrangler.jsonc`'s `class_name`s name them. */\nexport const Records = toRecordsObject(runtime);\n\n/** The job objects, one per scope and job, which a records object's alarm rings. */\nexport const Jobs = toJobObject(runtime);\n"
126
+ "text": "\n/** The records objects, one per scope, as `wrangler.jsonc`'s `class_name`s name them. */\nexport const Records = toRecordsObject(store);\n\n/** The job objects, one per scope and job, which a records object's alarm rings. */\nexport const Jobs = toJobObject(runtime);\n"
127
127
  }
128
128
  ],
129
129
  appEnv: [
@@ -220,7 +220,20 @@ var templates_default = {
220
220
  ", and sets `ADMINS`.\nconst env = bindings as Env;\n\n/**\n * Who `ADMIN_TOKEN` signs in as, while it's set: it mints a listed admin's first `admin` token, and\n * nothing else. No login can be it.\n */\nconst bootstrap = { id: '_admin' };\n\n/**\n * The host's admins: `ADMINS`, from `wrangler.jsonc`'s vars, logins between commas. Each signs in\n * as themselves with an `admin` token, and makes repos, mints tokens and pushes. Adding one is a\n * vars edit and a deploy. A login that can't be one stops the Worker's start, so a deploy that\n * names it fails.\n */\nconst admins = new Set(\n (env.ADMINS ?? '')\n .split(',')\n .map((login) => login.trim())\n .filter((login) => login !== ''),\n);\n\nfor (const login of admins) {\n if (login === bootstrap.id || new TextEncoder().encode(login).length > maxActorIdLength) {\n throw new Error(`ADMINS names '${login}', which can't be a login`);\n }\n}\n\n",
221
221
  {
222
222
  "slot": "bucket",
223
- "text": "const {\n R2_ACCOUNT_ID: accountId,\n R2_ACCESS_KEY_ID: accessKeyId,\n R2_SECRET_ACCESS_KEY: secretAccessKey,\n} = env;\n\n// With R2's S3 credentials, the bucket signs parts, and a push's pack past 64 MiB may upload to\n// it in parts, past Workers' 100 MB body.\nconst signed =\n accountId === undefined || accessKeyId === undefined || secretAccessKey === undefined\n ? undefined\n : layerR2Signed(env.PACKS, {\n accountId,\n bucket: env.PACKS_BUCKET,\n accessKeyId,\n secretAccessKey,\n });\n\n// With none, Git LFS's bytes go through the Worker, under its CPU and body limits: a warning\n// says so once an isolate, as the runtime builds the bucket.\nconst unsigned = Layer.effectDiscard(\n Effect.logWarning(\n \"LFS: through the Worker (no signing key). Run `ref0-git keys` in the Worker's folder to sign its links straight to R2\",\n ),\n);\n\n/** The records and job objects, and the packs' bucket. */\nconst adapter = Layer.merge(\n layer({ records: env.RECORDS, jobs: env.JOBS }),\n signed ?? Layer.merge(layerR2(env.PACKS), unsigned),\n);\n\n"
223
+ "text": "const {\n R2_ACCOUNT_ID: accountId,\n R2_ACCESS_KEY_ID: accessKeyId,\n R2_SECRET_ACCESS_KEY: secretAccessKey,\n} = env;\n\n// With R2's S3 credentials, the bucket signs parts, and a push's pack past 64 MiB may upload to\n// it in parts, past Workers' 100 MB body.\nconst signed =\n accountId === undefined || accessKeyId === undefined || secretAccessKey === undefined\n ? undefined\n : layerR2Signed(env.PACKS, {\n accountId,\n bucket: env.PACKS_BUCKET,\n accessKeyId,\n secretAccessKey,\n });\n\n// With none, Git LFS's bytes go through the Worker, under its CPU and body limits: a warning\n// says so once an isolate, as the runtime builds the bucket.\nconst unsigned = Layer.effectDiscard(\n Effect.logWarning(\n \"LFS: through the Worker (no signing key). Run `ref0-git keys` in the Worker's folder to sign its links straight to R2\",\n ),\n);\n\n"
224
+ },
225
+ {
226
+ "slot": "storeAbout",
227
+ "text": "/** The records and job objects, and the packs' bucket. */\n"
228
+ },
229
+ {
230
+ "slot": "store",
231
+ "text": "const store = layer({\n records: env.RECORDS,\n jobs: env.JOBS,\n // `limits.cpu_ms` from wrangler.jsonc, so a job object chains its tries within one alarm:\n // raise both together.\n requestLimits: { cpuMs: 300_000 },\n});"
232
+ },
233
+ "\n\n",
234
+ {
235
+ "slot": "adapter",
236
+ "text": "const adapter = Layer.merge(store, signed ?? Layer.merge(layerR2(env.PACKS), unsigned));\n\n"
224
237
  },
225
238
  {
226
239
  "slot": "merge",
@@ -235,7 +248,7 @@ var templates_default = {
235
248
  "slot": "runtime",
236
249
  "text": "/** The bootstrap's sign-in, while `ADMIN_TOKEN` holds one: a Bearer token, or Basic's password. */\nconst auth =\n env.ADMIN_TOKEN === undefined || env.ADMIN_TOKEN === ''\n ? Layer.empty\n : Auth.layer(Auth.bearer({ token: Redacted.make(env.ADMIN_TOKEN), actor: bootstrap }));\n\n/**\n * The whole host, one runtime that every request and job shares: Git and its features over the\n * adapter, deciding with `policy`, and the bootstrap signing in with `auth`.\n */\nexport const runtime = Git.runtime(\n Git.layer({}, features).pipe(\n Layer.provide(Policy.layer(policy)),\n Layer.provide(auth),\n Layer.provide(Objects.layer()),\n Layer.provideMerge(adapter),\n ),\n);\n\n"
237
250
  },
238
- "/** The records objects, one per scope, as `wrangler.jsonc`'s `class_name`s name them. */\nexport const Records = toRecordsObject(runtime);\n\n/** The job objects, one per scope and job, which a records object's alarm rings. */\nexport const Jobs = toJobObject(runtime);\n"
251
+ "/** The records objects, one per scope, as `wrangler.jsonc`'s `class_name`s name them. */\nexport const Records = toRecordsObject(store);\n\n/** The job objects, one per scope and job, which a records object's alarm rings. */\nexport const Jobs = toJobObject(runtime);\n"
239
252
  ],
240
253
  workerEntry: [
241
254
  "import { Git } from '@ref0/git';\n\n",
@@ -56,5 +56,5 @@ const initPacked = (name, at) => {
56
56
  * the release, or the tarball `--from-checkout` names for that package. One it wrote moves to this
57
57
  * run's spec; any other is the person's, a tarball of their own in `vendor/` too, and stays.
58
58
  */
59
- const initWrote = (name, spec) => spec === "0.20.0" || spec !== void 0 && packedPath(name).test(spec);
59
+ const initWrote = (name, spec) => spec === "0.25.0" || spec !== void 0 && packedPath(name).test(spec);
60
60
  export { catalog, contentNamed, frameworkPackages, initPacked, initWrote, nodeAppPackages, nodePackages, peerPackages, published, release, specOf, storePackages, unpacked, vercelPackages };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ref0-git",
3
- "version": "0.20.0",
3
+ "version": "0.25.0",
4
4
  "private": false,
5
5
  "description": "ref0-git, the CLI for a Git host built on @ref0/git, and git-remote-ref0, its remote helper",
6
6
  "license": "Apache-2.0",
@@ -24,8 +24,8 @@
24
24
  },
25
25
  "dependencies": {
26
26
  "@effect/platform-node-shared": "4.1.7",
27
- "@ref0/git": "0.20.0",
28
- "@ref0/infra": "0.20.0",
27
+ "@ref0/git": "0.25.0",
28
+ "@ref0/infra": "0.25.0",
29
29
  "diff": "9.0.0",
30
30
  "effect": "^4.1.7"
31
31
  },
@@ -34,8 +34,8 @@
34
34
  "@effect/vitest": "4.1.7",
35
35
  "@libsql/client": "0.18.0",
36
36
  "@libsql/kysely-libsql": "0.4.1",
37
- "@ref0/github": "0.20.0",
38
- "@ref0/xdiff-wasm": "0.20.0",
37
+ "@ref0/github": "0.25.0",
38
+ "@ref0/xdiff-wasm": "0.25.0",
39
39
  "@tanstack/react-start": "1.169.7",
40
40
  "@types/node": "24.19.4",
41
41
  "@types/pg": "8.23.1",