@nimbus-sh/worker 0.10.0 → 0.11.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 (260) hide show
  1. package/NOTICE.md +5 -0
  2. package/README.md +10 -0
  3. package/dist/_shared/session-router.d.ts +7 -0
  4. package/dist/_shared/session-router.d.ts.map +1 -1
  5. package/dist/_shared/session-router.js +7 -0
  6. package/dist/bindings/body.d.ts +6 -0
  7. package/dist/bindings/body.d.ts.map +1 -0
  8. package/dist/bindings/body.js +37 -0
  9. package/dist/bindings/kv.d.ts +0 -2
  10. package/dist/bindings/kv.d.ts.map +1 -1
  11. package/dist/bindings/kv.js +3 -42
  12. package/dist/bindings/r2.d.ts +0 -2
  13. package/dist/bindings/r2.d.ts.map +1 -1
  14. package/dist/bindings/r2.js +4 -44
  15. package/dist/esbuild-cli-artifact.generated.d.ts +18 -0
  16. package/dist/esbuild-cli-artifact.generated.d.ts.map +1 -0
  17. package/dist/esbuild-cli-artifact.generated.js +17 -0
  18. package/dist/facets/cirrus-real.d.ts.map +1 -1
  19. package/dist/facets/cirrus-real.js +9 -4
  20. package/dist/facets/compose.d.ts +11 -7
  21. package/dist/facets/compose.d.ts.map +1 -1
  22. package/dist/facets/compose.js +8 -38
  23. package/dist/facets/data-plan.d.ts +79 -0
  24. package/dist/facets/data-plan.d.ts.map +1 -0
  25. package/dist/facets/data-plan.js +477 -0
  26. package/dist/facets/esbuild-transform.d.ts +36 -10
  27. package/dist/facets/esbuild-transform.d.ts.map +1 -1
  28. package/dist/facets/esbuild-transform.js +216 -20
  29. package/dist/facets/exec-telemetry.d.ts +7 -3
  30. package/dist/facets/exec-telemetry.d.ts.map +1 -1
  31. package/dist/facets/manager.d.ts +179 -78
  32. package/dist/facets/manager.d.ts.map +1 -1
  33. package/dist/facets/manager.js +1221 -649
  34. package/dist/facets/opencode-staging.d.ts +0 -2
  35. package/dist/facets/opencode-staging.d.ts.map +1 -1
  36. package/dist/facets/opencode-staging.js +5 -11
  37. package/dist/facets/process.d.ts +4 -0
  38. package/dist/facets/process.d.ts.map +1 -1
  39. package/dist/facets/process.js +3 -0
  40. package/dist/facets/read-profile.d.ts +149 -0
  41. package/dist/facets/read-profile.d.ts.map +1 -0
  42. package/dist/facets/read-profile.js +483 -0
  43. package/dist/facets/resident-identity.d.ts +0 -1
  44. package/dist/facets/resident-identity.d.ts.map +1 -1
  45. package/dist/facets/resident-identity.js +0 -3
  46. package/dist/facets/wasm-swap-registry.d.ts +34 -25
  47. package/dist/facets/wasm-swap-registry.d.ts.map +1 -1
  48. package/dist/facets/wasm-swap-registry.js +62 -56
  49. package/dist/facets/ws-terminal.d.ts +4 -4
  50. package/dist/facets/ws-terminal.d.ts.map +1 -1
  51. package/dist/facets/ws-terminal.js +4 -5
  52. package/dist/git/commands.d.ts +16 -9
  53. package/dist/git/commands.d.ts.map +1 -1
  54. package/dist/git/commands.js +1818 -188
  55. package/dist/git/network-facet.d.ts +10 -2
  56. package/dist/git/network-facet.d.ts.map +1 -1
  57. package/dist/git/network-facet.js +62 -16
  58. package/dist/git/unified-diff.d.ts +74 -0
  59. package/dist/git/unified-diff.d.ts.map +1 -0
  60. package/dist/git/unified-diff.js +676 -0
  61. package/dist/git-bundle.generated.d.ts +7 -11
  62. package/dist/git-bundle.generated.d.ts.map +1 -1
  63. package/dist/git-bundle.generated.js +7 -11
  64. package/dist/hosted/commands.d.ts.map +1 -1
  65. package/dist/hosted/commands.js +62 -243
  66. package/dist/hosted/runtime.d.ts +19 -13
  67. package/dist/hosted/runtime.d.ts.map +1 -1
  68. package/dist/hosted/runtime.js +71 -14
  69. package/dist/hosted/services.d.ts +6 -7
  70. package/dist/hosted/services.d.ts.map +1 -1
  71. package/dist/hosted/services.js +10 -14
  72. package/dist/hosted/session.d.ts +165 -0
  73. package/dist/hosted/session.d.ts.map +1 -0
  74. package/dist/hosted/session.js +132 -0
  75. package/dist/loaders/generated-workers.d.ts +5 -2
  76. package/dist/loaders/generated-workers.d.ts.map +1 -1
  77. package/dist/loaders/generated-workers.js +6 -3
  78. package/dist/loaders/npm-resolve-preamble.d.ts.map +1 -1
  79. package/dist/loaders/npm-resolve-preamble.js +0 -27
  80. package/dist/node-shims-artifact.generated.d.ts +13 -4
  81. package/dist/node-shims-artifact.generated.d.ts.map +1 -1
  82. package/dist/node-shims-artifact.generated.js +16 -7
  83. package/dist/npm/bin-links.d.ts +3 -1
  84. package/dist/npm/bin-links.d.ts.map +1 -1
  85. package/dist/npm/bin-links.js +32 -8
  86. package/dist/npm/cache.d.ts +5 -0
  87. package/dist/npm/cache.d.ts.map +1 -1
  88. package/dist/npm/cache.js +13 -1
  89. package/dist/npm/install-batch-facet.d.ts +2 -2
  90. package/dist/npm/install-batch-facet.js +3 -3
  91. package/dist/npm/installer.d.ts +17 -1
  92. package/dist/npm/installer.d.ts.map +1 -1
  93. package/dist/npm/installer.js +159 -20
  94. package/dist/npm/package-lock.d.ts +32 -0
  95. package/dist/npm/package-lock.d.ts.map +1 -0
  96. package/dist/npm/package-lock.js +65 -0
  97. package/dist/npm/pre-bundle-facet.d.ts +1 -30
  98. package/dist/npm/pre-bundle-facet.d.ts.map +1 -1
  99. package/dist/npm/pre-bundle-facet.js +3 -5
  100. package/dist/npm/r2-cache.d.ts +2 -0
  101. package/dist/npm/r2-cache.d.ts.map +1 -1
  102. package/dist/npm/r2-cache.js +2 -0
  103. package/dist/npm/resolve-one-facet.d.ts.map +1 -1
  104. package/dist/npm/resolve-one-facet.js +14 -3
  105. package/dist/npm/resolver.d.ts +0 -7
  106. package/dist/npm/resolver.d.ts.map +1 -1
  107. package/dist/npm/resolver.js +0 -22
  108. package/dist/opencode-artifact.generated.js +2 -2
  109. package/dist/replica/routing.d.ts +2 -38
  110. package/dist/replica/routing.d.ts.map +1 -1
  111. package/dist/replica/routing.js +3 -55
  112. package/dist/router/index.d.ts.map +1 -1
  113. package/dist/router/index.js +15 -2
  114. package/dist/router/public-directory.d.ts +18 -0
  115. package/dist/router/public-directory.d.ts.map +1 -1
  116. package/dist/router/public-directory.js +1 -1
  117. package/dist/router/remote-api.d.ts +3 -1
  118. package/dist/router/remote-api.d.ts.map +1 -1
  119. package/dist/router/remote-api.js +42 -79
  120. package/dist/runtime/bash-repl.js +2 -2
  121. package/dist/runtime/bun-repl.d.ts.map +1 -1
  122. package/dist/runtime/bun-repl.js +2 -13
  123. package/dist/runtime/esbuild-wasm-bytes.d.ts +17 -5
  124. package/dist/runtime/esbuild-wasm-bytes.d.ts.map +1 -1
  125. package/dist/runtime/esbuild-wasm-bytes.js +43 -94
  126. package/dist/runtime/git-bundle-artifact.d.ts +17 -0
  127. package/dist/runtime/git-bundle-artifact.d.ts.map +1 -0
  128. package/dist/runtime/git-bundle-artifact.js +25 -0
  129. package/dist/runtime/node-repl.d.ts.map +1 -1
  130. package/dist/runtime/node-repl.js +2 -13
  131. package/dist/runtime/node-shims-artifact.d.ts +22 -23
  132. package/dist/runtime/node-shims-artifact.d.ts.map +1 -1
  133. package/dist/runtime/node-shims-artifact.js +48 -78
  134. package/dist/runtime/node-shims.d.ts.map +1 -1
  135. package/dist/runtime/node-shims.js +1567 -864
  136. package/dist/runtime/opencode-artifact.d.ts.map +1 -1
  137. package/dist/runtime/opencode-artifact.js +17 -53
  138. package/dist/runtime/opencode-facet-runner.d.ts +3 -6
  139. package/dist/runtime/opencode-facet-runner.d.ts.map +1 -1
  140. package/dist/runtime/opencode-facet-runner.js +45 -10
  141. package/dist/runtime/opentui-wasm-bytes.d.ts.map +1 -1
  142. package/dist/runtime/opentui-wasm-bytes.js +16 -49
  143. package/dist/runtime/package-manager.d.ts +0 -2
  144. package/dist/runtime/package-manager.d.ts.map +1 -1
  145. package/dist/runtime/package-manager.js +0 -3
  146. package/dist/runtime/python-repl.d.ts.map +1 -1
  147. package/dist/runtime/python-repl.js +2 -2
  148. package/dist/runtime/repl-session.d.ts +10 -0
  149. package/dist/runtime/repl-session.d.ts.map +1 -1
  150. package/dist/runtime/repl-session.js +7 -0
  151. package/dist/runtime/ruby-repl.d.ts.map +1 -1
  152. package/dist/runtime/ruby-repl.js +2 -2
  153. package/dist/runtime/ruby-resident.d.ts.map +1 -1
  154. package/dist/runtime/ruby-resident.js +36 -35
  155. package/dist/runtime/runtime-catalog.d.ts +10 -3
  156. package/dist/runtime/runtime-catalog.d.ts.map +1 -1
  157. package/dist/runtime/runtime-catalog.js +125 -15
  158. package/dist/runtime/sqlite-wasm-bytes.d.ts +4 -4
  159. package/dist/runtime/sqlite-wasm-bytes.d.ts.map +1 -1
  160. package/dist/runtime/sqlite-wasm-bytes.js +21 -57
  161. package/dist/runtime/staged-source.d.ts +67 -0
  162. package/dist/runtime/staged-source.d.ts.map +1 -0
  163. package/dist/runtime/staged-source.js +113 -0
  164. package/dist/runtime/wasi/preamble.d.ts.map +1 -1
  165. package/dist/runtime/wasi/preamble.js +0 -24
  166. package/dist/runtime-catalog.generated.js +1 -1
  167. package/dist/session/agent.d.ts +14 -2
  168. package/dist/session/agent.d.ts.map +1 -1
  169. package/dist/session/agent.js +57 -19
  170. package/dist/session/ai.d.ts +0 -11
  171. package/dist/session/ai.d.ts.map +1 -1
  172. package/dist/session/ai.js +0 -4
  173. package/dist/session/fs-watch.d.ts +0 -11
  174. package/dist/session/fs-watch.d.ts.map +1 -1
  175. package/dist/session/fs-watch.js +0 -21
  176. package/dist/session/hibernation.d.ts +34 -11
  177. package/dist/session/hibernation.d.ts.map +1 -1
  178. package/dist/session/hibernation.js +46 -29
  179. package/dist/session/init-phases.d.ts +1 -2
  180. package/dist/session/init-phases.d.ts.map +1 -1
  181. package/dist/session/init-phases.js +1 -2
  182. package/dist/session/init.d.ts.map +1 -1
  183. package/dist/session/init.js +7 -20
  184. package/dist/session/keys.d.ts +0 -3
  185. package/dist/session/keys.d.ts.map +1 -1
  186. package/dist/session/keys.js +0 -3
  187. package/dist/session/legacy-reset.d.ts +11 -0
  188. package/dist/session/legacy-reset.d.ts.map +1 -0
  189. package/dist/session/legacy-reset.js +16 -0
  190. package/dist/session/nimbus-session.d.ts +41 -15
  191. package/dist/session/nimbus-session.d.ts.map +1 -1
  192. package/dist/session/nimbus-session.js +64 -70
  193. package/dist/session/npm-install-port.d.ts.map +1 -1
  194. package/dist/session/npm-install-port.js +1 -0
  195. package/dist/session/programmatic.d.ts +13 -18
  196. package/dist/session/programmatic.d.ts.map +1 -1
  197. package/dist/session/programmatic.js +53 -39
  198. package/dist/session/replica-routes.d.ts +2 -3
  199. package/dist/session/replica-routes.d.ts.map +1 -1
  200. package/dist/session/replica-routes.js +3 -10
  201. package/dist/session/routes.d.ts.map +1 -1
  202. package/dist/session/routes.js +7 -10
  203. package/dist/session/rpc.d.ts +104 -20
  204. package/dist/session/rpc.d.ts.map +1 -1
  205. package/dist/session/rpc.js +184 -37
  206. package/dist/session/start-real-vite.js +2 -2
  207. package/dist/session/state-store.d.ts +1 -17
  208. package/dist/session/state-store.d.ts.map +1 -1
  209. package/dist/session/state-store.js +3 -53
  210. package/dist/session/supervisor-op.d.ts +7 -0
  211. package/dist/session/supervisor-op.d.ts.map +1 -1
  212. package/dist/session/supervisor-op.js +6 -1
  213. package/dist/session/supervisor-rpc.d.ts +104 -15
  214. package/dist/session/supervisor-rpc.d.ts.map +1 -1
  215. package/dist/session/supervisor-rpc.js +188 -71
  216. package/dist/session/vite-command.d.ts.map +1 -1
  217. package/dist/session/vite-command.js +17 -14
  218. package/dist/session/ws.d.ts.map +1 -1
  219. package/dist/session/ws.js +20 -8
  220. package/dist/shell/npm-bin-entrypoints.d.ts.map +1 -1
  221. package/dist/shell/npm-bin-entrypoints.js +30 -5
  222. package/dist/vfs/facet-resident-limits.d.ts +33 -0
  223. package/dist/vfs/facet-resident-limits.d.ts.map +1 -0
  224. package/dist/vfs/facet-resident-limits.js +33 -0
  225. package/dist/vfs/facet-resident-store.d.ts +2 -10
  226. package/dist/vfs/facet-resident-store.d.ts.map +1 -1
  227. package/dist/vfs/facet-resident-store.js +1594 -219
  228. package/dist/workspace-host.d.ts +2 -0
  229. package/dist/workspace-host.d.ts.map +1 -1
  230. package/dist/workspace-host.js +2 -0
  231. package/dist/wrangler/nimbus-wrangler.d.ts +0 -2
  232. package/dist/wrangler/nimbus-wrangler.d.ts.map +1 -1
  233. package/dist/wrangler/nimbus-wrangler.js +5 -22
  234. package/package.json +8 -7
  235. package/public/_assets/opencode/1.16.2/index-attach.js +2 -2
  236. package/public/_assets/runtime/esbuild-cli-c4fda380d52befc1.js +6892 -0
  237. package/public/_assets/runtime/git-de3e60c9f3ff006a.js +103 -0
  238. package/public/_assets/runtime/{node-shims-7b4dd7a76d95d21e.js → node-shims-06565b121555c194.js} +2089 -861
  239. package/public/_assets/runtime/resident-store-6ffb1939c53d982f.js +2264 -0
  240. package/public/_assets/runtime/vfs-write-ledger-e501e8fc793bc2c1.js +889 -0
  241. package/scripts/build-opencode-attach-entry.mjs +51 -1
  242. package/scripts/bundle-facet-workers.mjs +114 -3
  243. package/scripts/bundle-git.mjs +88 -27
  244. package/scripts/bundle-node-shims.mjs +72 -46
  245. package/scripts/bundle-runtime.mjs +18 -421
  246. package/scripts/cf-git-patch.mjs +137 -0
  247. package/scripts/patch-install-deps.mjs +49 -96
  248. package/scripts/runtime-specs.mjs +435 -0
  249. package/vendor/git-http.generated.d.ts +82 -0
  250. package/vendor/git-upstream.generated.d.ts +4378 -0
  251. package/vendor/git.LICENSE +7 -0
  252. package/vendor/git.generated.d.mts +21 -0
  253. package/vendor/git.generated.mjs +103 -0
  254. package/dist/replica/suspension.d.ts +0 -36
  255. package/dist/replica/suspension.d.ts.map +0 -1
  256. package/dist/replica/suspension.js +0 -49
  257. package/dist/runtime/static-server.d.ts +0 -3
  258. package/dist/runtime/static-server.d.ts.map +0 -1
  259. package/dist/runtime/static-server.js +0 -133
  260. package/scripts/clean-dist.mjs +0 -7
@@ -1,5 +1,5 @@
1
1
  /**
2
- * git-network-facet.ts — Facet-based git clone/fetch/pull.
2
+ * git/network-facet.ts — Facet-based git clone/fetch/pull.
3
3
  *
4
4
  * Runs isomorphic-git's network operations (clone/fetch/pull) inside a
5
5
  * dynamic worker (LOADER.load) to escape the supervisor DO's CPU budget
@@ -46,10 +46,18 @@ export interface GitNetworkOpts {
46
46
  username: string;
47
47
  password: string;
48
48
  };
49
- /** Author (for pull merges) */
49
+ /** Author and committer (for pull merges), as the supervisor's git resolved them. */
50
50
  author?: {
51
51
  name: string;
52
52
  email: string;
53
+ timestamp?: number;
54
+ timezoneOffset?: number;
55
+ };
56
+ committer?: {
57
+ name: string;
58
+ email: string;
59
+ timestamp?: number;
60
+ timezoneOffset?: number;
53
61
  };
54
62
  /** Total operation budget (ms). Clone default 30 min; other ops default 5 min. */
55
63
  timeout?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"network-facet.d.ts","sourceRoot":"","sources":["../../src/git/network-facet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAcH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAE/D,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,YAAY,CAAC;IACjB,8EAA8E;IAC9E,GAAG,EAAE,MAAM,CAAC;IACZ,kEAAkE;IAClE,GAAG,EAAE,MAAM,CAAC;IACZ,gCAAgC;IAChC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gGAAgG;IAChG,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gCAAgC;IAChC,IAAI,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9C,+BAA+B;IAC/B,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,E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IAAI,CAAC,EAAE,mBAAmB,GACzB,OAAO,CAuDT;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,IAAI,MAAM,CAEtD"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * git-network-facet.ts — Facet-based git clone/fetch/pull.
2
+ * git/network-facet.ts — Facet-based git clone/fetch/pull.
3
3
  *
4
4
  * Runs isomorphic-git's network operations (clone/fetch/pull) inside a
5
5
  * dynamic worker (LOADER.load) to escape the supervisor DO's CPU budget
@@ -24,10 +24,11 @@
24
24
  * See docs/analysis in git-network-facet plan — the canonical write-up lives
25
25
  * in the PR that introduced this file.
26
26
  */
27
- import { getCtxExports, hostRoute } from '@nimbus-sh/fabric/composition.js';
27
+ import { getCtxExports } from '@nimbus-sh/fabric/composition.js';
28
+ import { supervisorBindingProps } from '@nimbus-sh/fabric/supervisor-props.js';
28
29
  import { CF_COMPAT_DATE } from '@nimbus-sh/core/constants.js';
29
30
  import { MAX_RPC_SAFE_PAYLOAD_BYTES } from '@nimbus-sh/platform/limits.js';
30
- import { GIT_BUNDLE_CODE } from '../git-bundle.generated.js';
31
+ import { fetchGitBundleSource } from '../runtime/git-bundle-artifact.js';
31
32
  import { W7_FRAME_PREAMBLE } from '../loaders/generated-workers.js';
32
33
  import { ESBUILD_NAME_GLOBAL_SHIM } from '@nimbus-sh/core/_shared/esbuild-facet-shim.js';
33
34
  import { disposeRpcResource } from '@nimbus-sh/platform/rpc-dispose.js';
@@ -407,7 +408,7 @@ export async function execGitNetwork(ctx, env, opts) {
407
408
  const ctxExports = getCtxExports();
408
409
  const supervisorBinding = ctxExports?.SupervisorRPC
409
410
  ? ctxExports.SupervisorRPC({
410
- props: { doId: ctx.id.toString(), pid: opts.pid, mutationOwner, route: hostRoute() ?? undefined },
411
+ props: { ...supervisorBindingProps(ctx, opts.pid), mutationOwner },
411
412
  })
412
413
  : undefined;
413
414
  if (!supervisorBinding) {
@@ -424,6 +425,7 @@ export async function execGitNetwork(ctx, env, opts) {
424
425
  let worker;
425
426
  let entrypoint;
426
427
  try {
428
+ const gitBundleSource = await fetchGitBundleSource(env);
427
429
  const loadedWorker = env.LOADER.load({
428
430
  compatibilityDate: CF_COMPAT_DATE,
429
431
  compatibilityFlags: ['nodejs_compat'],
@@ -436,10 +438,11 @@ export async function execGitNetwork(ctx, env, opts) {
436
438
  // `preamble` option provides for npm install. This is the
437
439
  // W7 v3 emits one bounded record per pull; the receiver owns
438
440
  // the aggregate 8 MiB payload-credit and transaction limits.
439
- // - the pre-bundled isomorphic-git (git-bundle.js)
441
+ // - the pre-bundled isomorphic-git (git-bundle.js), the staged
442
+ // copy of vendor/git.generated.mjs (runtime/git-bundle-artifact.ts)
440
443
  modules: {
441
444
  'git-network-worker.js': assembleGitNetworkFacetSource(),
442
- 'git-bundle.js': GIT_BUNDLE_CODE,
445
+ 'git-bundle.js': gitBundleSource,
443
446
  },
444
447
  env: { SUPERVISOR: supervisorBinding },
445
448
  });
@@ -1081,6 +1084,18 @@ function enotdir(filepath) {
1081
1084
  return err;
1082
1085
  }
1083
1086
 
1087
+ function eisdir(filepath) {
1088
+ const err = new Error('EISDIR: illegal operation on a directory, ' + filepath);
1089
+ err.code = 'EISDIR'; err.errno = -21;
1090
+ return err;
1091
+ }
1092
+
1093
+ function enotempty(filepath) {
1094
+ const err = new Error('ENOTEMPTY: directory not empty, ' + filepath);
1095
+ err.code = 'ENOTEMPTY'; err.errno = -39;
1096
+ return err;
1097
+ }
1098
+
1084
1099
  function einval(filepath) {
1085
1100
  const err = new Error('EINVAL: invalid argument, ' + filepath);
1086
1101
  err.code = 'EINVAL'; err.errno = -22;
@@ -1136,7 +1151,9 @@ function convertSupervisorStat(st) {
1136
1151
  mtimeMs, mtime: new Date(mtimeMs),
1137
1152
  ctimeMs, ctime: new Date(ctimeMs),
1138
1153
  atimeMs, atime: new Date(atimeMs),
1139
- uid: 1000, gid: 1000, dev: 0, ino: 0, nlink: 1,
1154
+ // The supervisor's git reports these same fields, so an index either side wrote stays warm.
1155
+ uid: Number(st.uid) || 0, gid: Number(st.gid) || 0,
1156
+ dev: Number(st.dev) || 0, ino: Number(st.ino) || 0, nlink: 1,
1140
1157
  };
1141
1158
  }
1142
1159
 
@@ -1175,7 +1192,7 @@ function emptyMetadataOverlayStats() {
1175
1192
  * Files + all their parent directories become inodes; file content is
1176
1193
  * chunked at CHUNK_SIZE boundaries to match sqlite-vfs.
1177
1194
  */
1178
- function buildPayload(writeBuffer, dirBuffer, deleteSet, metadata, authoritativeRoot) {
1195
+ function buildPayload(writeBuffer, dirBuffer, deleteSet, metadata, authoritativeRoot, worktreeRoot) {
1179
1196
  const inodes = [];
1180
1197
  const chunks = [];
1181
1198
  const dirs = new Set();
@@ -1183,12 +1200,12 @@ function buildPayload(writeBuffer, dirBuffer, deleteSet, metadata, authoritative
1183
1200
 
1184
1201
  // Collect all parent directories for files.
1185
1202
  for (const [path] of writeBuffer) {
1186
- collectDirectoryPaths(dirs, parentOf(path), authoritativeRoot);
1203
+ collectDirectoryPaths(dirs, parentOf(path), authoritativeRoot, worktreeRoot);
1187
1204
  }
1188
1205
  // Explicit mkdir entries
1189
1206
  for (const d of dirBuffer) {
1190
1207
  if (!d) continue;
1191
- collectDirectoryPaths(dirs, d, authoritativeRoot);
1208
+ collectDirectoryPaths(dirs, d, authoritativeRoot, worktreeRoot);
1192
1209
  }
1193
1210
 
1194
1211
  const orderedDirs = [...dirs].sort((left, right) => {
@@ -1263,12 +1280,19 @@ function buildPayload(writeBuffer, dirBuffer, deleteSet, metadata, authoritative
1263
1280
  return { inodes, chunks, deletePaths };
1264
1281
  }
1265
1282
 
1266
- function collectDirectoryPaths(paths, path, authoritativeRoot) {
1283
+ // A clone publishes the directories it creates, up to and including its
1284
+ // authoritative root. An operation in an existing worktree (worktreeRoot)
1285
+ // publishes only directories below its top: the top and everything above it
1286
+ // already exist, are followed as git follows them, and are not the worktree's
1287
+ // to rewrite — republishing home is EACCES for the session user, and would
1288
+ // replace a linked ancestor with an empty directory.
1289
+ function collectDirectoryPaths(paths, path, authoritativeRoot, worktreeRoot = null) {
1267
1290
  let current = path;
1268
1291
  while (current) {
1269
1292
  if (authoritativeRoot &&
1270
1293
  current !== authoritativeRoot &&
1271
1294
  !current.startsWith(authoritativeRoot + '/')) break;
1295
+ if (worktreeRoot !== null && !current.startsWith(worktreeRoot + '/')) break;
1272
1296
  paths.add(current);
1273
1297
  if (current === authoritativeRoot) break;
1274
1298
  current = parentOf(current);
@@ -1278,6 +1302,14 @@ function collectDirectoryPaths(paths, path, authoritativeRoot) {
1278
1302
  /**
1279
1303
  * Create the buffered fs adapter isomorphic-git will use.
1280
1304
  * Writes buffer in-memory; reads check buffer then fall back to supervisor.
1305
+ *
1306
+ * With a worktreeRoot (fetch, pull, push in an existing repository) the
1307
+ * adapter writes that worktree the way git's checkout does (entry.c
1308
+ * create_directories, has_symlink_leading_path): below its top, .git
1309
+ * aside, a leading component that is not a real directory (a link, dangling
1310
+ * or not, or a file) is deleted and replaced by a directory rather than
1311
+ * followed, and a file replaces a link at its own path rather than writing
1312
+ * through it.
1281
1313
  */
1282
1314
  function createBufferedFs(
1283
1315
  supervisor,
@@ -1289,6 +1321,7 @@ function createBufferedFs(
1289
1321
  phaseDeadline = null,
1290
1322
  authoritativeFallbackPaths = [],
1291
1323
  authoritativeFallbackRoots = [],
1324
+ worktreeRoot = null,
1292
1325
  ) {
1293
1326
  const writeBuffer = new Map(); // path → Uint8Array (insertion ordered = FIFO)
1294
1327
  const pendingWriteMetadata = new Map();
@@ -1481,16 +1514,16 @@ function createBufferedFs(
1481
1514
  const paths = new Set(deleteBuffer);
1482
1515
  for (const path of dirBuffer) {
1483
1516
  if (!path) continue;
1484
- collectDirectoryPaths(paths, path, authoritativeRoot);
1517
+ collectDirectoryPaths(paths, path, authoritativeRoot, worktreeRoot);
1485
1518
  }
1486
1519
  for (const path of writeBuffer.keys()) {
1487
1520
  paths.add(path);
1488
- collectDirectoryPaths(paths, parentOf(path), authoritativeRoot);
1521
+ collectDirectoryPaths(paths, parentOf(path), authoritativeRoot, worktreeRoot);
1489
1522
  }
1490
1523
  if (extraPath) {
1491
1524
  paths.add(extraPath);
1492
1525
  if (includeParents) {
1493
- collectDirectoryPaths(paths, parentOf(extraPath), authoritativeRoot);
1526
+ collectDirectoryPaths(paths, parentOf(extraPath), authoritativeRoot, worktreeRoot);
1494
1527
  }
1495
1528
  }
1496
1529
  let pathBytes = 0;
@@ -1578,6 +1611,7 @@ function createBufferedFs(
1578
1611
  deleteBuffer,
1579
1612
  waveMetadata,
1580
1613
  authoritativeRoot,
1614
+ worktreeRoot,
1581
1615
  );
1582
1616
  // Snapshot stats counters BEFORE clearing the buffers so the increments
1583
1617
  // below see the wave's true size, not zero.
@@ -1861,9 +1895,14 @@ function createBufferedFs(
1861
1895
  });
1862
1896
  },
1863
1897
 
1898
+ // unlink(2) and rmdir(2): a buffered delete removes the whole subtree at
1899
+ // its path, so neither may take a directory it would not take on disk.
1900
+ // unlink refuses a directory; rmdir refuses a non-directory and a
1901
+ // directory that still holds anything (untracked files a checkout leaves).
1864
1902
  async unlink(filepath) {
1865
1903
  assertFlushHealthy();
1866
1904
  const p = normalizePath(filepath);
1905
+ if ((await fs.promises.lstat(filepath)).isDirectory()) throw eisdir(filepath);
1867
1906
  return bufferMutation(p, 0, false, async () => {
1868
1907
  if (writeBuffer.has(p)) {
1869
1908
  bufferBytes -= writeBuffer.get(p).length;
@@ -1939,9 +1978,13 @@ function createBufferedFs(
1939
1978
  });
1940
1979
  },
1941
1980
 
1942
- async rmdir(filepath) {
1981
+ async rmdir(filepath, options) {
1943
1982
  assertFlushHealthy();
1944
1983
  const p = normalizePath(filepath);
1984
+ if (!(options && options.recursive)) {
1985
+ if (!(await fs.promises.lstat(filepath)).isDirectory()) throw enotdir(filepath);
1986
+ if ((await fs.promises.readdir(filepath)).length > 0) throw enotempty(filepath);
1987
+ }
1945
1988
  return bufferMutation(p, 0, false, async () => {
1946
1989
  dirBuffer.delete(p);
1947
1990
  deleteBuffer.add(p);
@@ -2196,7 +2239,7 @@ export default {
2196
2239
 
2197
2240
  // Import the pre-bundled isomorphic-git + http/web.
2198
2241
  // The bundle is provided via LOADER.load()'s modules record;
2199
- // see scripts/bundle-git.mjs and src/git-bundle.generated.ts.
2242
+ // see scripts/bundle-git.mjs and src/runtime/git-bundle-artifact.ts.
2200
2243
  let git, http;
2201
2244
  try {
2202
2245
  const bundle = await import('./git-bundle.js');
@@ -2380,6 +2423,8 @@ export default {
2380
2423
  phase === 'clone-checkout'
2381
2424
  ? [normalizePath(opts.dir) + '/.git/nimbus-checkout-index']
2382
2425
  : [],
2426
+ // fetch, pull and push work in a repository that already exists.
2427
+ phase === 'operation' ? normalizePath(opts.dir) : null,
2383
2428
  );
2384
2429
  const fs = bufferedFs.fs;
2385
2430
  flushWave = bufferedFs.flushWave;
@@ -2606,6 +2651,7 @@ export default {
2606
2651
  ref: opts.ref,
2607
2652
  singleBranch: true,
2608
2653
  author: opts.author || { name: 'user', email: 'user@nimbus.dev' },
2654
+ committer: opts.committer,
2609
2655
  onProgress,
2610
2656
  onAuth,
2611
2657
  });
@@ -0,0 +1,74 @@
1
+ export declare const DEFAULT_CONTEXT = 3;
2
+ /** One side of a file pair: git's diff_filespec. */
3
+ export interface DiffSpec {
4
+ /** Repo-relative path, or the path as given to --no-index ('/dev/null' for an absent side). */
5
+ path: string;
6
+ /** False on the absent side of an add or a delete. */
7
+ valid: boolean;
8
+ oid: string;
9
+ mode: number;
10
+ data: Uint8Array;
11
+ }
12
+ export interface DiffPair {
13
+ one: DiffSpec;
14
+ two: DiffSpec;
15
+ /** Set when rename detection paired `one` with `two`: similarity out of MAX_SCORE. */
16
+ renameScore?: number;
17
+ }
18
+ export declare function absentSpec(path: string): DiffSpec;
19
+ /** diff_resolve_rename_copy's status letter. */
20
+ export declare function pairStatus(pair: DiffPair): 'A' | 'D' | 'T' | 'R' | 'M';
21
+ export declare function binaryFromBytes(bytes: Uint8Array): string;
22
+ export declare function bytesFromBinary(text: string): Uint8Array;
23
+ /** A path's UTF-8 bytes as a binary string. */
24
+ export declare function binaryPath(path: string): string;
25
+ /** A path as git prints it on a '\n'-ended line: C-quoted if any byte needs it. */
26
+ export declare function quotePath(path: string): string;
27
+ /** One entry of a path list: quoted and '\n'-ended, or raw and NUL-ended under -z. */
28
+ export declare function pathLine(path: string, z: boolean): string;
29
+ /** buffer_is_binary: a NUL in the first 8000 bytes. */
30
+ export declare function isBinary(data: Uint8Array): boolean;
31
+ /** One file's `diff --git` section, exactly as `git diff` prints it without color. */
32
+ export declare function formatPatch(pair: DiffPair, context?: number): string;
33
+ export declare function formatNameOnly(pair: DiffPair, z: boolean): string;
34
+ export declare function formatNameStatus(pair: DiffPair, z: boolean): string;
35
+ export interface StatFile {
36
+ /** Display name: quoted path, or `from => to` when the two sides are named differently. */
37
+ name: string;
38
+ added: number;
39
+ deleted: number;
40
+ binary: boolean;
41
+ }
42
+ export declare function statFile(pair: DiffPair): StatFile;
43
+ /** The --stat block for `columns` terminal columns (git's term_columns: $COLUMNS, else 80). */
44
+ export declare function formatStat(files: readonly StatFile[], columns: number): string;
45
+ export declare const MAX_SCORE = 60000;
46
+ export declare const DEFAULT_RENAME_SCORE = 30000;
47
+ export declare function similarityIndex(score: number): number;
48
+ /** parse_rename_score (`5`, `50%` and `.5` are all 50%), or null when anything follows the number. */
49
+ export declare function parseRenameScore(text: string): number | null;
50
+ export interface RenameSide {
51
+ path: string;
52
+ oid: string;
53
+ mode: number;
54
+ }
55
+ export interface QueuedPair<S extends RenameSide> {
56
+ one: S | null;
57
+ two: S | null;
58
+ renameScore?: number;
59
+ }
60
+ /**
61
+ * git diff's default rename detection over a path-ordered queue: exact
62
+ * renames, then unique basenames at a higher bar, then the similarity
63
+ * matrix, skipped (as git skips it) past `renameLimit` squared pairs. A
64
+ * rename takes its destination's place in the queue. `neededRenameLimit`
65
+ * is non-zero when the matrix was skipped.
66
+ */
67
+ export declare function detectRenames<S extends RenameSide>(queue: readonly QueuedPair<S>[], read: (side: S) => Promise<Uint8Array>, { minimumScore, renameLimit }?: {
68
+ minimumScore?: number | undefined;
69
+ renameLimit?: number | undefined;
70
+ }): Promise<{
71
+ queue: QueuedPair<S>[];
72
+ neededRenameLimit: number;
73
+ }>;
74
+ //# sourceMappingURL=unified-diff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unified-diff.d.ts","sourceRoot":"","sources":["../../src/git/unified-diff.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,eAAe,IAAI,CAAC;AAGjC,oDAAoD;AACpD,MAAM,WAAW,QAAQ;IACvB,+FAA+F;IAC/F,IAAI,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,QAAQ,CAAC;IACd,GAAG,EAAE,QAAQ,CAAC;IACd,sFAAsF;IACtF,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAEjD;AAID,gDAAgD;AAChD,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAMtE;AAMD,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAMzD;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,CAIxD;AAED,+CAA+C;AAC/C,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C;AAwBD,mFAAmF;AACnF,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAI9C;AAED,sFAAsF;AACtF,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,EAAE,OAA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