@nyte-ai/host 0.0.0-stage → 0.0.19

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 (250) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +6 -2
  3. package/THIRD-PARTY-NOTICES.md +866 -0
  4. package/dist/chunks/canvas-preview-0cmbkp2j.js +65 -0
  5. package/dist/chunks/canvas-preview-0nq75h9k.js +7 -0
  6. package/dist/chunks/canvas-preview-11nadadc.js +241 -0
  7. package/dist/chunks/canvas-preview-1sq7z9jq.js +17 -0
  8. package/dist/chunks/canvas-preview-2jwbe14k.js +130 -0
  9. package/dist/chunks/canvas-preview-2zdyh9ny.js +26 -0
  10. package/dist/chunks/canvas-preview-31w7xm8z.js +34 -0
  11. package/dist/chunks/canvas-preview-4b6sayhg.js +295 -0
  12. package/dist/chunks/canvas-preview-4e0pxa32.js +63 -0
  13. package/dist/chunks/canvas-preview-518dh8by.js +169 -0
  14. package/dist/chunks/canvas-preview-55s0y68g.js +387 -0
  15. package/dist/chunks/canvas-preview-5ekjx6sw.js +613 -0
  16. package/dist/chunks/canvas-preview-5mex725c.js +14 -0
  17. package/dist/chunks/canvas-preview-5z63am63.js +295 -0
  18. package/dist/chunks/canvas-preview-65xqjw7f.js +20 -0
  19. package/dist/chunks/canvas-preview-69fkk9yn.js +95 -0
  20. package/dist/chunks/canvas-preview-8xc0vn7v.js +458 -0
  21. package/dist/chunks/canvas-preview-9aqczacs.js +73 -0
  22. package/dist/chunks/canvas-preview-af86jz8t.js +141 -0
  23. package/dist/chunks/canvas-preview-aq5j4p25.js +240 -0
  24. package/dist/chunks/canvas-preview-b2v8wfnz.js +36 -0
  25. package/dist/chunks/canvas-preview-befkjea2.js +60 -0
  26. package/dist/chunks/canvas-preview-bxnqt8cd.js +103 -0
  27. package/dist/chunks/canvas-preview-cawy6vbz.js +352 -0
  28. package/dist/chunks/canvas-preview-crmzxxt8.js +518 -0
  29. package/dist/chunks/canvas-preview-drctegz4.js +591 -0
  30. package/dist/chunks/canvas-preview-e3vnkkc5.js +134 -0
  31. package/dist/chunks/canvas-preview-ec2mt7es.js +108 -0
  32. package/dist/chunks/canvas-preview-fxa0rfb0.js +61 -0
  33. package/dist/chunks/canvas-preview-g5fkjs34.js +598 -0
  34. package/dist/chunks/canvas-preview-jeddjex8.js +166 -0
  35. package/dist/chunks/canvas-preview-k1yg4fgp.js +571 -0
  36. package/dist/chunks/canvas-preview-kdqgrstc.js +194 -0
  37. package/dist/chunks/canvas-preview-kn7kvbfj.js +12 -0
  38. package/dist/chunks/canvas-preview-kp75gb63.js +141 -0
  39. package/dist/chunks/canvas-preview-mgcx2b2p.js +271 -0
  40. package/dist/chunks/canvas-preview-n2a35zv5.js +81 -0
  41. package/dist/chunks/canvas-preview-pkzqg96v.js +63 -0
  42. package/dist/chunks/canvas-preview-rp4x6y1h.js +144 -0
  43. package/dist/chunks/canvas-preview-s94ebwf5.js +112 -0
  44. package/dist/chunks/canvas-preview-skzwvw4d.js +23 -0
  45. package/dist/chunks/canvas-preview-srgfpdmf.js +60 -0
  46. package/dist/chunks/canvas-preview-tjhabynd.js +252 -0
  47. package/dist/chunks/canvas-preview-tnqe7k0b.js +374 -0
  48. package/dist/chunks/canvas-preview-vaatfznm.js +189 -0
  49. package/dist/chunks/canvas-preview-vm9zdp2t.js +398 -0
  50. package/dist/chunks/canvas-preview-w54ymtb3.js +272 -0
  51. package/dist/chunks/canvas-preview-wg80rbc2.js +46 -0
  52. package/dist/chunks/canvas-preview-y5y6ghaw.js +125 -0
  53. package/dist/chunks/canvas-preview-ycepb05s.js +176 -0
  54. package/dist/chunks/canvas-preview-yjz0f7n4.js +50 -0
  55. package/dist/chunks/canvas-preview-zaaj99wd.js +244 -0
  56. package/dist/src/canvas-preview.d.ts +29 -0
  57. package/dist/src/canvas-preview.js +271 -0
  58. package/dist/src/credentials.d.ts +44 -0
  59. package/dist/src/credentials.js +10 -0
  60. package/dist/src/deploy/cloudflare/worker.d.ts +50 -0
  61. package/dist/src/deploy/cloudflare/worker.js +196 -0
  62. package/dist/src/deploy/vercel/nitro.config.d.ts +2 -0
  63. package/dist/src/deploy/vercel/nitro.config.js +30 -0
  64. package/dist/src/deploy/vercel/server/routes/[...].d.ts +2 -0
  65. package/dist/src/deploy/vercel/server/routes/[...].js +18 -0
  66. package/dist/src/deploy/vercel/server/utils/host.d.ts +13 -0
  67. package/dist/src/deploy/vercel/server/utils/host.js +7 -0
  68. package/dist/src/deploy/vercel/server/utils/repair.d.ts +1 -0
  69. package/dist/src/deploy/vercel/server/utils/repair.js +6 -0
  70. package/dist/src/deploy/vercel/server/utils/step.d.ts +10 -0
  71. package/dist/src/deploy/vercel/server/utils/step.js +6 -0
  72. package/dist/src/deploy/vercel/server/workflows/drive.d.ts +14 -0
  73. package/dist/src/deploy/vercel/server/workflows/drive.js +13 -0
  74. package/dist/src/durable-object.d.ts +14 -0
  75. package/dist/src/durable-object.js +231 -0
  76. package/dist/src/hash.d.ts +1 -0
  77. package/dist/src/hash.js +6 -0
  78. package/dist/src/identity-key.d.ts +11 -0
  79. package/dist/src/identity-key.js +9 -0
  80. package/dist/src/identity.d.ts +12 -0
  81. package/dist/src/identity.js +6 -0
  82. package/dist/src/images/exif.d.ts +1 -0
  83. package/dist/src/images/exif.js +6 -0
  84. package/dist/src/images/node.d.ts +37 -0
  85. package/dist/src/images/node.js +12 -0
  86. package/dist/src/images/photon.d.ts +3 -0
  87. package/dist/src/images/photon.js +7 -0
  88. package/dist/src/images/worker.d.ts +1 -0
  89. package/dist/src/images/worker.js +23 -0
  90. package/dist/src/index.d.ts +20 -0
  91. package/dist/src/index.js +121 -0
  92. package/dist/src/key-file.d.ts +1 -0
  93. package/dist/src/key-file.js +7 -0
  94. package/dist/src/listen-fetch.d.ts +8 -0
  95. package/dist/src/listen-fetch.js +9 -0
  96. package/dist/src/listen.d.ts +4 -0
  97. package/dist/src/listen.js +10 -0
  98. package/dist/src/local/command.d.ts +20 -0
  99. package/dist/src/local/command.js +12 -0
  100. package/dist/src/local/feed.d.ts +7 -0
  101. package/dist/src/local/feed.js +6 -0
  102. package/dist/src/local/files.d.ts +18 -0
  103. package/dist/src/local/files.js +13 -0
  104. package/dist/src/local/git-watch.d.ts +15 -0
  105. package/dist/src/local/git-watch.js +7 -0
  106. package/dist/src/local/git.d.ts +5 -0
  107. package/dist/src/local/git.js +13 -0
  108. package/dist/src/local/github.d.ts +30 -0
  109. package/dist/src/local/github.js +9 -0
  110. package/dist/src/local/identity.d.ts +3 -0
  111. package/dist/src/local/identity.js +7 -0
  112. package/dist/src/local/jobs.d.ts +7 -0
  113. package/dist/src/local/jobs.js +7 -0
  114. package/dist/src/local/legacy-trust.d.ts +10 -0
  115. package/dist/src/local/legacy-trust.js +6 -0
  116. package/dist/src/local/patch.d.ts +16 -0
  117. package/dist/src/local/patch.js +17 -0
  118. package/dist/src/local/provider.d.ts +11 -0
  119. package/dist/src/local/provider.js +20 -0
  120. package/dist/src/local/snapshots.d.ts +7 -0
  121. package/dist/src/local/snapshots.js +11 -0
  122. package/dist/src/local/text.d.ts +1 -0
  123. package/dist/src/local/text.js +6 -0
  124. package/dist/src/local/tree.d.ts +50 -0
  125. package/dist/src/local/tree.js +16 -0
  126. package/dist/src/local/workspace-migration.d.ts +2 -0
  127. package/dist/src/local/workspace-migration.js +7 -0
  128. package/dist/src/local/worktrees.d.ts +46 -0
  129. package/dist/src/local/worktrees.js +14 -0
  130. package/dist/src/mcp/config.d.ts +75 -0
  131. package/dist/src/mcp/config.js +12 -0
  132. package/dist/src/mcp/connect.d.ts +15 -0
  133. package/dist/src/mcp/connect.js +9 -0
  134. package/dist/src/mcp/hub.d.ts +19 -0
  135. package/dist/src/mcp/hub.js +11 -0
  136. package/dist/src/mcp/oauth.d.ts +46 -0
  137. package/dist/src/mcp/oauth.js +12 -0
  138. package/dist/src/mcp/tools.d.ts +29 -0
  139. package/dist/src/mcp/tools.js +12 -0
  140. package/dist/src/open.d.ts +14 -0
  141. package/dist/src/open.js +46 -0
  142. package/dist/src/plugins/loader.d.ts +21 -0
  143. package/dist/src/plugins/loader.js +11 -0
  144. package/dist/src/postgres.d.ts +19 -0
  145. package/dist/src/postgres.js +8 -0
  146. package/dist/src/providers.d.ts +16 -0
  147. package/dist/src/providers.js +112 -0
  148. package/dist/src/secrets.d.ts +12 -0
  149. package/dist/src/secrets.js +8 -0
  150. package/dist/src/serve/binding.d.ts +39 -0
  151. package/dist/src/serve/binding.js +6 -0
  152. package/dist/src/serve/handler.d.ts +15 -0
  153. package/dist/src/serve/handler.js +8 -0
  154. package/dist/src/serve/stream-server.d.ts +6 -0
  155. package/dist/src/serve/stream-server.js +6 -0
  156. package/dist/src/session-index.d.ts +11 -0
  157. package/dist/src/session-index.js +11 -0
  158. package/dist/src/shell-env.d.ts +14 -0
  159. package/dist/src/shell-env.js +108 -0
  160. package/dist/src/sqlite-workers.d.ts +6 -0
  161. package/dist/src/sqlite-workers.js +6 -0
  162. package/dist/src/sqlite.d.ts +8 -0
  163. package/dist/src/sqlite.js +11 -0
  164. package/dist/src/store-rows.d.ts +13 -0
  165. package/dist/src/store-rows.js +26 -0
  166. package/dist/src/store-usage.d.ts +25 -0
  167. package/dist/src/store-usage.js +19 -0
  168. package/dist/src/usage-history.d.ts +54 -0
  169. package/dist/src/usage-history.js +14 -0
  170. package/dist/src/usage-scan.d.ts +24 -0
  171. package/dist/src/usage-scan.js +65 -0
  172. package/dist/src/usage-service.d.ts +23 -0
  173. package/dist/src/usage-service.js +16 -0
  174. package/dist/src/usage-summary.d.ts +9 -0
  175. package/dist/src/usage-summary.js +16 -0
  176. package/dist/src/usage-types.d.ts +86 -0
  177. package/dist/src/usage-types.js +0 -0
  178. package/dist/src/usage-worker.d.ts +1 -0
  179. package/dist/src/usage-worker.js +29 -0
  180. package/dist/src/usage.d.ts +195 -0
  181. package/dist/src/usage.js +23 -0
  182. package/package.json +140 -3
  183. package/src/canvas-preview.ts +403 -0
  184. package/src/credentials.ts +294 -0
  185. package/src/deploy/cloudflare/README.md +3 -0
  186. package/src/deploy/cloudflare/worker.ts +306 -0
  187. package/src/deploy/cloudflare/wrangler.jsonc +12 -0
  188. package/src/deploy/vercel/README.md +3 -0
  189. package/src/deploy/vercel/nitro.config.ts +29 -0
  190. package/src/deploy/vercel/server/routes/[...].ts +10 -0
  191. package/src/deploy/vercel/server/utils/host.ts +104 -0
  192. package/src/deploy/vercel/server/utils/repair.ts +35 -0
  193. package/src/deploy/vercel/server/utils/step.ts +25 -0
  194. package/src/deploy/vercel/server/workflows/drive.ts +46 -0
  195. package/src/deploy/vercel/tsconfig.json +9 -0
  196. package/src/deploy/vercel/types/bun.d.ts +2 -0
  197. package/src/durable-object.ts +386 -0
  198. package/src/hash.ts +5 -0
  199. package/src/identity-key.ts +20 -0
  200. package/src/identity.ts +66 -0
  201. package/src/images/exif.ts +69 -0
  202. package/src/images/node.ts +163 -0
  203. package/src/images/photon.ts +141 -0
  204. package/src/images/worker.ts +29 -0
  205. package/src/index.ts +39 -0
  206. package/src/key-file.ts +53 -0
  207. package/src/listen-fetch.ts +409 -0
  208. package/src/listen.ts +228 -0
  209. package/src/local/command.ts +161 -0
  210. package/src/local/feed.ts +70 -0
  211. package/src/local/files.ts +817 -0
  212. package/src/local/git-watch.ts +199 -0
  213. package/src/local/git.ts +919 -0
  214. package/src/local/github.ts +691 -0
  215. package/src/local/identity.ts +21 -0
  216. package/src/local/jobs.ts +573 -0
  217. package/src/local/legacy-trust.ts +105 -0
  218. package/src/local/patch.ts +334 -0
  219. package/src/local/provider.ts +184 -0
  220. package/src/local/snapshots.ts +778 -0
  221. package/src/local/text.ts +9 -0
  222. package/src/local/tree.ts +398 -0
  223. package/src/local/workspace-migration.ts +95 -0
  224. package/src/local/worktrees.ts +239 -0
  225. package/src/mcp/config.ts +330 -0
  226. package/src/mcp/connect.ts +92 -0
  227. package/src/mcp/hub.ts +836 -0
  228. package/src/mcp/oauth.ts +436 -0
  229. package/src/mcp/tools.ts +333 -0
  230. package/src/open.ts +449 -0
  231. package/src/plugins/loader.ts +186 -0
  232. package/src/postgres.ts +492 -0
  233. package/src/providers.ts +135 -0
  234. package/src/secrets.ts +31 -0
  235. package/src/serve/binding.ts +629 -0
  236. package/src/serve/handler.ts +362 -0
  237. package/src/serve/stream-server.ts +176 -0
  238. package/src/session-index.ts +99 -0
  239. package/src/shell-env.ts +153 -0
  240. package/src/sqlite-workers.ts +283 -0
  241. package/src/sqlite.ts +553 -0
  242. package/src/store-rows.ts +110 -0
  243. package/src/store-usage.ts +347 -0
  244. package/src/usage-history.ts +219 -0
  245. package/src/usage-scan.ts +81 -0
  246. package/src/usage-service.ts +82 -0
  247. package/src/usage-summary.ts +79 -0
  248. package/src/usage-types.ts +87 -0
  249. package/src/usage-worker.ts +24 -0
  250. package/src/usage.ts +776 -0
@@ -0,0 +1,20 @@
1
+ import type { ChildProcess, SpawnOptions } from "node:child_process";
2
+ export type Ran = {
3
+ readonly code: number | null;
4
+ readonly stdout: Buffer;
5
+ readonly stderr: string;
6
+ readonly truncated: boolean;
7
+ };
8
+ export declare function run(file: string, args: readonly string[], options: {
9
+ readonly cwd: string;
10
+ readonly env?: Readonly<Record<string, string>>;
11
+ readonly input?: string | Uint8Array;
12
+ readonly limit?: number;
13
+ /** Kills the command after this long; it then ends with a null code. */
14
+ readonly timeoutMs?: number;
15
+ }): Promise<Ran>;
16
+ /** Spawns `file` as `spawn` does, except that on Windows a `.cmd` or `.bat` file runs through `cmd.exe` with its arguments escaped, as Node no longer starts batch files without a shell. */
17
+ export declare function spawnCommand(file: string, args: readonly string[], options: SpawnOptions): ChildProcess;
18
+ /** Ends `child` with `signal`; on Windows, which has no signals, it ends the child's whole process tree with `taskkill /T /F`, as `kill` alone would leave what a batch file or a shell started running. */
19
+ export declare function killTree(child: ChildProcess, signal: NodeJS.Signals): void;
20
+ export declare function findExecutable(name: string, directories?: readonly string[]): Promise<string | null>;
@@ -0,0 +1,12 @@
1
+ import {
2
+ run2,
3
+ spawnCommand2,
4
+ killTree2,
5
+ findExecutable2
6
+ } from "../../chunks/canvas-preview-bxnqt8cd.js";
7
+ export {
8
+ findExecutable2 as findExecutable,
9
+ killTree2 as killTree,
10
+ run2 as run,
11
+ spawnCommand2 as spawnCommand
12
+ };
@@ -0,0 +1,7 @@
1
+ import type { Disposer } from "@nyte-ai/schema";
2
+ export type FeedSink<T> = {
3
+ push(value: T): void;
4
+ fail(error: unknown): void;
5
+ end(): void;
6
+ };
7
+ export declare function feed<T>(start: (sink: FeedSink<T>) => Disposer, merge?: (waiting: T, next: T) => T): AsyncIterable<T>;
@@ -0,0 +1,6 @@
1
+ import {
2
+ feed2
3
+ } from "../../chunks/canvas-preview-yjz0f7n4.js";
4
+ export {
5
+ feed2 as feed
6
+ };
@@ -0,0 +1,18 @@
1
+ import type { ByteReader, FileVersion } from "@nyte-ai/schema";
2
+ import type { FilesApi } from "@nyte-ai/core";
3
+ /** Returns a byte reader that carries the version of the file it read, which the server answers as `X-Nyte-Version` (§40h, §40p). */
4
+ export type VersionedReader = ByteReader & {
5
+ readonly version: FileVersion;
6
+ };
7
+ /** Returns the local `FilesApi`, its `bytes` typed with the version it read. */
8
+ export type LocalFiles = Omit<FilesApi, "bytes"> & {
9
+ bytes(path: string): Promise<VersionedReader>;
10
+ };
11
+ /** The size past which `read` answers `large`: 1 MiB. */
12
+ export declare const TEXT_LIMIT: number;
13
+ /** Returns a folder's files over `node:fs`: a relative path resolves against `root`, an absolute one is taken as given (the ancestor context files are read through it, §37g). A version is the SHA-256 of what is there, never an mtime: a file's contents (through a symlink, its target's), a directory's sorted entry names, and, for `stat` of a symlink itself, its target path. `read` answers `text` for UTF-8 without NUL up to 1 MiB, `large` above, `binary` otherwise, `missing` when absent (`SdkError("invalid")` for a directory); `bytes` streams the file with its size, a null mime and its version (`SdkError("unknown")` when absent); `stat` uses `lstat` (a symlink with its `target`), null when absent. `write` compares `expect` with the current version first (`stale { current }`, `absent` needing no file), answers `missing-parent` unless `parents`, and writes through a temporary file renamed into place (through a symlink, at its target), keeping an existing file's mode; `remove` compares `expect` the same way (`stale { current: null }` when nothing is there) and answers `saved` with the version it removed. `batch()` returns a plan whose `apply` and `upload()` reject with `SdkError("unavailable")`: core lays its own over them (`wrapFiles`). `format` runs `formatter`, else the first of `oxfmt`, `prettier` and `biome` under `<root>/node_modules/.bin`, then on the `PATH`, with the contents on stdin and the path for its config, answering `unchanged` when equal and `unavailable { reason }` when there is none or it fails. `scan` walks `directory` (default the root; an absolute one is walked as its own root and answered with absolute paths) breadth-first in pages of 500 entries, skipping `.git` and, unless `ignored: "include"` or the directory is itself ignored, what `.gitignore` files and `.git/info/exclude` ignore (`ignore`), then `complete`, or `incomplete` with `limit` after 50,000 entries or `permission` after an unreadable directory; entries carry no version. `find` matches the query against the scanned file paths, case-insensitively: exact name, name prefix, name substring, path substring, then a fuzzy subsequence, shorter first, at most `limit` (default 20, capped at 50), the scan reused for 5 s. `search` runs `ripgrep` (else `rg` on the PATH; with neither, a scan of the text files up to 1 MiB with a JavaScript regex) for the query, literal unless `regex`, with smart case unless `caseSensitive` is given, whole words alone when `wholeWord`, over the files the `include` globs pick (all when none) less the `exclude` globs; a file with a draft is searched in its draft's contents instead of on disk. It yields a `match` per matching line (1-based line and column and the first match's length, the line cut at 500 characters), drafts first, then `complete`, or `truncated` at `limit` (default 200); a regex or glob `rg` cannot read throws `SdkError("invalid")`. `watch` uses a recursive `fs.watch` on the root (a 1 s poll where there is none) or, given `paths`, a watch on each of them alone that waits for a missing one to appear and never polls, without ignored paths or directories, coalescing changes over 100 ms into `created`, `modified` and `removed` events with the version after (null when removed), a path's last change winning while the reader is behind. `signal` ends every open `watch`. */
14
+ export declare function localFiles(root: string, options?: {
15
+ readonly ripgrep?: string;
16
+ readonly formatter?: string;
17
+ readonly signal?: AbortSignal;
18
+ }): LocalFiles;
@@ -0,0 +1,13 @@
1
+ import {
2
+ TEXT_LIMIT2,
3
+ localFiles2
4
+ } from "../../chunks/canvas-preview-drctegz4.js";
5
+ import"../../chunks/canvas-preview-kn7kvbfj.js";
6
+ import"../../chunks/canvas-preview-yjz0f7n4.js";
7
+ import"../../chunks/canvas-preview-bxnqt8cd.js";
8
+ import"../../chunks/canvas-preview-0nq75h9k.js";
9
+ import"../../chunks/canvas-preview-mgcx2b2p.js";
10
+ export {
11
+ TEXT_LIMIT2 as TEXT_LIMIT,
12
+ localFiles2 as localFiles
13
+ };
@@ -0,0 +1,15 @@
1
+ import type { Disposer, GitStatus } from "@nyte-ai/schema";
2
+ import type { FeedSink } from "./feed.ts";
3
+ /** Where `localGit` found the repository holding its workspace: the worktree root, its git directory, the common directory linked worktrees share (the git directory otherwise), and the workspace's path below the root (`""` or ending in `/`). */
4
+ export type Repository = {
5
+ readonly root: string;
6
+ readonly gitDir: string;
7
+ readonly commonDir: string;
8
+ readonly prefix: string;
9
+ };
10
+ /** One status watch shared by `localGit`'s feeds. */
11
+ export type GitWatcher = {
12
+ subscribe(listener: (status: GitStatus) => void, fail: FeedSink<GitStatus>["fail"]): Disposer;
13
+ };
14
+ /** Returns the status watch `localGit` shares among its watchers: the first subscriber starts it and the last one stops it, and each gets the status at once, then again whenever a change could move it. A recursive `fs.watch` on the workspace hears worktree paths that `.gitignore` and `.git/info/exclude` do not ignore, and, in the git directory and the common directory, only HEAD, the index, branch and remote refs, `packed-refs`, `config` and the merge, cherry-pick, revert and rebase state, so object writes, logs and Nyte's snapshot refs read nothing; the `.git` entry itself appearing or going (not a change inside it, which Windows also reports on the folder) drops the remembered repository and starts over. Only where `fs.watch` is unavailable does it poll, every 2 s. */
15
+ export declare function createWatcher(cwd: string, read: () => Promise<GitStatus>, repository: () => Promise<Repository | null>, forget: () => void): GitWatcher;
@@ -0,0 +1,7 @@
1
+ import {
2
+ createWatcher2
3
+ } from "../../chunks/canvas-preview-af86jz8t.js";
4
+ import"../../chunks/canvas-preview-mgcx2b2p.js";
5
+ export {
6
+ createWatcher2 as createWatcher
7
+ };
@@ -0,0 +1,5 @@
1
+ import type { ExecutionEnv, GitApi } from "@nyte-ai/core";
2
+ /** Returns git over the CLI (`git`, default `git` on the PATH) for the repository holding `env.cwd`; every path it takes and answers is relative to the workspace (`env.cwd`), as `FilesApi`'s and the snapshots' are (§41j): the commands run at the repository root, and where the workspace is a subdirectory of the repository its prefix is added to every path going into git (`stage`, `unstage`, `discard` and `commit` files, `patches`, `contents` and `blame` paths) and stripped from every path coming out (`status`, `changes`, `patches`), the listings limited to it by pathspec (a rename source outside it reads `../…`); `root` stays the repository root, and `log`, `refs`, `branch`, `push` and `commit` of `staged` or `all` are repository-wide. `status` reads `git status --porcelain=v2 --branch -z --untracked-files=all` (`none` outside a repository, `head` null when unborn) with the staged and unstaged line stats (`git diff --numstat`), its `revision` the SHA-256 of those outputs with HEAD and each dirty worktree file's size and modification time, so an edit to an already-modified file moves it; `watch` yields the status whenever that revision moves, re-reading only on fs events that can move it (`createWatcher`: worktree paths git does not ignore and the git directory's HEAD, index and refs, coalesced over 250 ms; a 2 s poll only where `fs.watch` is unavailable). The repository (`git rev-parse`) is looked up once and kept while its git directory holds a HEAD. `changes(scope)` reads statuses with `git diff --name-status -z -M` and line stats with `--numstat` (`--ignore-all-space` under `ignoreWhitespace`, for the stats and patches only, so a whitespace-only change stays listed; `worktree` HEAD to the worktree, `staged` HEAD to the index, `unstaged` the index to the worktree, `commit` its parent (or the empty tree) to it, `branch` the merge base with HEAD to HEAD; HEAD of an unborn repository is the empty tree), untracked files joining `worktree` and `unstaged` with status `untracked` and their line count as added; its `revision` the status revision; `watchChanges` re-reads it as that revision moves. `patches` reads `git diff -U3` for the requested paths the scope reports (paths it does not report are left out), at most 32 per command, one `PatchEntry` per path, a text one carrying the path's section of the unified text as its `patch` (`binary`; `empty` when the scope reports the path but the diff shows no text, as under `ignoreWhitespace`; `too-large` past 1 MiB; `failed` alone when one path's read fails), `digest` the SHA-256 of the path's section; an untracked file is diffed against nothing on the host (its digest that of its patch), `failed` when it is gone or cannot be read. It yields one full `PatchSet` per revision as it moves. `contents` reads both sides (`git cat-file blob <rev>:<path>`, the index, the worktree file, or absent; a rename's old side at its old path; text, `truncated { head }` past 1 MiB, or binary). `log` pages `git log` with the cursor holding the next skip (default 50 a page); `refs` reads `git symbolic-ref`, `git for-each-ref refs/heads` and `git remote`; `blame` reads `git blame --porcelain` of the worktree file. Every write answers `busy { runs: [] }` while `index.lock` exists for the writes that take it (all but `push` and `branch` without checkout; the run-based busy is core's), then compares `expect` with the current status revision (`stale { revision }`): `stage` (`git add -A`), `unstage` (`git restore --staged`, `git rm --cached` when unborn), `discard` (`git restore --worktree`, untracked paths removed with `git clean -f`), `commit` (`staged`, `all` as `-a`, or the listed paths added and committed alone), `branch` (`git switch -c` when `checkout`, else `git branch`), `push` (`--porcelain`, `--set-upstream origin <branch>` when asked; a detached HEAD cannot set one); each answers `applied { revision }`, `unchanged` (`stage`, `unstage`, `discard` and `commit` when the revision did not move or git had nothing to commit, `push` when every ref was already up to date; `branch` always applies), or `rejected { reason }` with git's message. Reads outside a repository throw `SdkError("unavailable")`. */
3
+ export declare function localGit(env: ExecutionEnv, options?: {
4
+ readonly git?: string;
5
+ }): GitApi;
@@ -0,0 +1,13 @@
1
+ import {
2
+ localGit2
3
+ } from "../../chunks/canvas-preview-5ekjx6sw.js";
4
+ import"../../chunks/canvas-preview-tjhabynd.js";
5
+ import"../../chunks/canvas-preview-kn7kvbfj.js";
6
+ import"../../chunks/canvas-preview-yjz0f7n4.js";
7
+ import"../../chunks/canvas-preview-af86jz8t.js";
8
+ import"../../chunks/canvas-preview-bxnqt8cd.js";
9
+ import"../../chunks/canvas-preview-0nq75h9k.js";
10
+ import"../../chunks/canvas-preview-mgcx2b2p.js";
11
+ export {
12
+ localGit2 as localGit
13
+ };
@@ -0,0 +1,30 @@
1
+ import type { ExecutionEnv, GitHubAccountApi, GitHubApi } from "@nyte-ai/core";
2
+ /**
3
+ * Returns the machine's GitHub CLI login through `gh` (`gh`, default `gh` on
4
+ * the PATH), run in `home` (default `os.homedir()`). Nothing runs until it is
5
+ * asked for. `account` reads the github.com account (`gh auth status`, then
6
+ * `gh api user`); while a sign-in runs, it answers its code until it ends,
7
+ * then what the login became. `signIn` starts at most one `gh auth login`
8
+ * for the whole machine and `signOut` cancels it or runs `gh auth logout`.
9
+ */
10
+ export declare function localGitHubAccount(options?: {
11
+ readonly gh?: string;
12
+ readonly home?: string;
13
+ }): GitHubAccountApi;
14
+ /**
15
+ * Returns GitHub for each local workspace through the machine's `gh` (`gh`,
16
+ * default `gh` on the PATH) and `git`. Nothing runs until a state is asked
17
+ * for. `state` reads the repository from the remotes in gh's
18
+ * base-repository order (`upstream`, `github`, `origin`, then the rest; only
19
+ * github.com remotes) and, while gh has a login, the checked-out branch's
20
+ * pull request with its check rollup (`gh pr view <branch> --json`, the
21
+ * branch as `<owner>:<branch>` when it tracks a fork); without one the pull
22
+ * request is `unavailable`. `createPullRequest` answers each precondition, an
23
+ * open pull request as `exists`, and otherwise runs
24
+ * `gh pr create --head <branch>` with the title as an argument, the body on
25
+ * stdin, and `--fill` for whichever of the two is missing.
26
+ */
27
+ export declare function localGitHub(options?: {
28
+ readonly gh?: string;
29
+ readonly git?: string;
30
+ }): (env: ExecutionEnv) => GitHubApi;
@@ -0,0 +1,9 @@
1
+ import {
2
+ localGitHubAccount2,
3
+ localGitHub2
4
+ } from "../../chunks/canvas-preview-8xc0vn7v.js";
5
+ import"../../chunks/canvas-preview-bxnqt8cd.js";
6
+ export {
7
+ localGitHub2 as localGitHub,
8
+ localGitHubAccount2 as localGitHubAccount
9
+ };
@@ -0,0 +1,3 @@
1
+ import type { EnvironmentIdentity } from "@nyte-ai/schema";
2
+ /** Returns a folder's identity from its inode and nanosecond creation time, independent of boot-assigned device numbers and its path. A rename keeps it; a replacement folder gets another identity. Without an inode or creation time, hashes the real path. An unresolved path hashes its absolute form so inspection can report it unavailable. */
3
+ export declare function folderIdentity(path: string): Promise<EnvironmentIdentity>;
@@ -0,0 +1,7 @@
1
+ import {
2
+ folderIdentity2
3
+ } from "../../chunks/canvas-preview-1sq7z9jq.js";
4
+ import"../../chunks/canvas-preview-0nq75h9k.js";
5
+ export {
6
+ folderIdentity2 as folderIdentity
7
+ };
@@ -0,0 +1,7 @@
1
+ import type { ExecutionEnv } from "@nyte-ai/core";
2
+ /** Returns `exec` for a folder: each call starts one process as a `Job` (a fresh id; `key` null, core keys pty jobs) in `cwd` resolved against `root` (default `root`), with `env` laid over `process.env`. A string command runs through the platform shell (`/bin/sh -c`, `cmd.exe /d /s /c` on Windows) and an argv directly; `[]` with `pty` runs the login shell (`shell()` read at each start, else `$SHELL`, else `/bin/sh`, as a login shell; §37h), a pty's environment carrying `TERM=xterm-256color`, `COLORTERM=truecolor` and `TERM_PROGRAM=Nyte` without Electron's `ELECTRON_RUN_AS_NODE` and `NODE_OPTIONS`, and `[]` without one throws `SdkError("invalid")`. A program that cannot start throws `SdkError("unavailable")`. Without `pty` the process is piped through `node:child_process` in its own process group, stdout and stderr interleaved in `output` (with `stdio: "protocol"`, stderr's frames tagged `stream: "stderr"` and the pipe paced like a pty, so a reader open from the start misses nothing) and stdin fed by `write`; with `pty` it runs under `@lydell/node-pty`, loaded on first use through `createRequire` (§41a; `loadPty`, given, loads it instead, on every pty start), at the given size, and a platform where it does not load throws `SdkError("unavailable")`. `output()` opens a reader over the last 1 MiB of output that yields `bytes`, a `gap` where the reader fell behind or opened after output was dropped, and `exit { code }` last; a merged pipe never stalls, and a pty or a protocol pipe pauses while its slowest open reader is 256 KiB behind, resuming once it is within 64 KiB. `resize` resizes a pty (`not-pty` for a pipe, `missing` once it ended); `idle` checks the OS process table for a login shell with no live children (false for a pipe or explicit command, true once it ended); `stop` sends SIGTERM to a pipe's process group (SIGHUP to a pty), SIGKILL after 2 s (on Windows, which has no signals, it ends a pipe's process tree at once with `taskkill /T /F`), and answers `settled { outcome }` (also once it ended); `settled` resolves `exited { code, reason }` (`code` null after a signal), `reason` `exited` when the process ended on its own and `terminated` after `stop` or an aborted `signal`, and an aborted `settled` signal rejects with `SdkError("unavailable")`; `close` detaches this handle's readers. An aborted `signal` stops the process. `signal` on the options ends every reader of every job started here, leaving the processes running (what the provider's `close` does). */
3
+ export declare function localExec(root: string, options?: {
4
+ readonly shell?: () => string | null;
5
+ readonly signal?: AbortSignal;
6
+ readonly loadPty?: () => unknown;
7
+ }): ExecutionEnv["exec"];
@@ -0,0 +1,7 @@
1
+ import {
2
+ localExec2
3
+ } from "../../chunks/canvas-preview-vm9zdp2t.js";
4
+ import"../../chunks/canvas-preview-bxnqt8cd.js";
5
+ export {
6
+ localExec2 as localExec
7
+ };
@@ -0,0 +1,10 @@
1
+ import type { StoreConnection } from "@nyte-ai/core";
2
+ /**
3
+ * Carries the folders an older Nyte, or uji before it, was told to trust into
4
+ * the store, once per store: the grants in `~/.nyte/workspaces.json`,
5
+ * `~/.nyte/trust.json` and `~/.uji/trust.json` become folder trust decisions
6
+ * where the store saved none. A folder that is gone, the home folder and the
7
+ * folders above it are skipped: home holds the user's own files, and a grant
8
+ * there trusted every project under it. The files are left as they are.
9
+ */
10
+ export declare function importLegacyTrust(connection: StoreConnection, home: string): Promise<void>;
@@ -0,0 +1,6 @@
1
+ import {
2
+ importLegacyTrust2
3
+ } from "../../chunks/canvas-preview-9aqczacs.js";
4
+ export {
5
+ importLegacyTrust2 as importLegacyTrust
6
+ };
@@ -0,0 +1,16 @@
1
+ import type { FileStatus, LineStat, PatchEntry } from "@nyte-ai/schema";
2
+ import type { Ran } from "./command.ts";
3
+ export declare const PATCH_LIMIT: number;
4
+ export type Changed = {
5
+ readonly path: string;
6
+ readonly status: FileStatus;
7
+ readonly from?: string;
8
+ };
9
+ /** The entry for two texts diffed on the host: a text entry's digest is its patch's, so it moves with the whitespace mode; an empty one digests both sides and the mode. */
10
+ export declare function textEntry(path: string, status: FileStatus, before: string | null, after: string | null, options?: {
11
+ readonly ignoreWhitespace?: boolean;
12
+ }): PatchEntry;
13
+ export declare function readPatches(files: readonly Changed[], read: (files: readonly Changed[], limit: number) => Promise<Ran>, emptyDigest: (file: Changed) => string): Promise<readonly PatchEntry[]>;
14
+ export declare function lineStat(before: string, after: string): LineStat;
15
+ export declare function parseNumstat(output: string): ReadonlyMap<string, LineStat>;
16
+ export declare function parseNameStatus(output: string): readonly Changed[];
@@ -0,0 +1,17 @@
1
+ import {
2
+ PATCH_LIMIT2,
3
+ textEntry2,
4
+ readPatches2,
5
+ lineStat2,
6
+ parseNumstat2,
7
+ parseNameStatus2
8
+ } from "../../chunks/canvas-preview-tjhabynd.js";
9
+ import"../../chunks/canvas-preview-0nq75h9k.js";
10
+ export {
11
+ PATCH_LIMIT2 as PATCH_LIMIT,
12
+ lineStat2 as lineStat,
13
+ parseNameStatus2 as parseNameStatus,
14
+ parseNumstat2 as parseNumstat,
15
+ readPatches2 as readPatches,
16
+ textEntry2 as textEntry
17
+ };
@@ -0,0 +1,11 @@
1
+ import type { EnvironmentProvider } from "@nyte-ai/core";
2
+ /** Returns the local environment provider (`kind: "local"`): a folder on this machine. `inspect` answers a `{ kind: "local", path }` target's `folderIdentity` (§41d), `available` when the path is a readable directory (else `unavailable { unreachable }`; a target without a path `unavailable { unsupported }`, identified by the hash of its locator), and the project sources present under it, relative to it, in this order: the plugin files `.nyte/plugins/<name>.{ts,mts,js,mjs}` and `.nyte/plugins/<name>/index.<ext>`, the skills `.nyte/skills/<name>/SKILL.md` and `.agents/skills/<name>/SKILL.md`, the prompts `.nyte/prompts/<name>.md`, then `.nyte/SYSTEM.md`, `.nyte/APPEND_SYSTEM.md` and `.nyte/mcp.json`: the files project trust gates. Context files such as `AGENTS.md` load without trust and are not listed. `attach` resolves the real path (a target that is not a directory throws `SdkError("unavailable")`) and returns an `ExecutionEnv` with that identity, `cwd` the real path, `files` from `localFiles` (with `ripgrep` and `formatter`), `exec` from `localExec`, and a `close` that ends its file watches and the jobs' readers, leaving running jobs alone. `git` is `localGit` (with `git`), `github` is `localGitHub` (with `gh` and `git`; the login is the machine's, `localGitHubAccount`), `snapshots` is `localSnapshots` storing tree walks under `<home>/.nyte/snapshots` (`home` default `os.homedir()`), and absent for a folder that contains `<home>/.nyte` or lies inside it outside `<home>/.nyte/worktrees` (the home folder itself, its ancestors, Nyte's own state): there a snapshot would walk or stage everything under home, the store and secrets included, to report changes in the store it just wrote; `worktrees` is `localWorktrees` (with `home` and `git`); no `browser` (the desktop wraps one in); `destroy` rejects with `SdkError("unavailable")`: a local folder is never torn down. */
3
+ export declare function localProvider(options?: {
4
+ readonly home?: string;
5
+ readonly git?: string;
6
+ readonly gh?: string;
7
+ readonly ripgrep?: string;
8
+ readonly formatter?: string;
9
+ /** The login shell a pty job without a command runs, read at each start; null or absent is `$SHELL`. */
10
+ readonly shell?: () => string | null;
11
+ }): EnvironmentProvider;
@@ -0,0 +1,20 @@
1
+ import {
2
+ localProvider2
3
+ } from "../../chunks/canvas-preview-e3vnkkc5.js";
4
+ import"../../chunks/canvas-preview-2jwbe14k.js";
5
+ import"../../chunks/canvas-preview-5ekjx6sw.js";
6
+ import"../../chunks/canvas-preview-8xc0vn7v.js";
7
+ import"../../chunks/canvas-preview-1sq7z9jq.js";
8
+ import"../../chunks/canvas-preview-vm9zdp2t.js";
9
+ import"../../chunks/canvas-preview-crmzxxt8.js";
10
+ import"../../chunks/canvas-preview-tjhabynd.js";
11
+ import"../../chunks/canvas-preview-drctegz4.js";
12
+ import"../../chunks/canvas-preview-kn7kvbfj.js";
13
+ import"../../chunks/canvas-preview-yjz0f7n4.js";
14
+ import"../../chunks/canvas-preview-af86jz8t.js";
15
+ import"../../chunks/canvas-preview-bxnqt8cd.js";
16
+ import"../../chunks/canvas-preview-0nq75h9k.js";
17
+ import"../../chunks/canvas-preview-mgcx2b2p.js";
18
+ export {
19
+ localProvider2 as localProvider
20
+ };
@@ -0,0 +1,7 @@
1
+ import type { ExecutionEnv, SnapshotsApi } from "@nyte-ai/core";
2
+ /** Returns content-addressed snapshots of an environment's tree, so equal trees are equal ids whichever run took them. `before(run)` is taken once per run in this process and answered again after; `after(run)` is taken on every call. In a repository (`git`, default `git` on the PATH), a snapshot writes the environment's part of the worktree, tracked and untracked files that are not ignored, into a temporary index seeded from the real one (`GIT_INDEX_FILE`, `git add -A`, `git write-tree --prefix` for a workspace below the root; the real index is never touched) and keeps the tree reachable for good from the hidden ref `refs/nyte/kept`, a tree of generation trees `g000000`, `g000001`, ... that each hold up to 1,000 snapshot trees named by their hash (only the newest generation and the root are rewritten, in the background after a snapshot of a tree this process has not kept, so a snapshot costs two git spawns: `add` and `write-tree`; the per-tree refs `refs/nyte/snapshots/<tree>` of earlier versions all fold into it and go); the id is `git:<tree>`. The repository is looked up once. Without a repository it walks the tree as `localFiles.scan` does (up to `limit` entries, default 50 000), stores each file's bytes up to 1 MiB once under `<store>/objects/<sha256>` (a larger file is hashed, not stored; a file whose size, mtime and inode did not move is not re-read) and the tree, `{ incomplete, files }` (whether the walk stopped short, at its limit or at an unreadable directory, and the manifest of paths to content hashes), under `<store>/trees/<sha256 of it>.json`; the id is `tree:<hash>`. `diff(from, to)` answers the `ChangeSet` between two snapshots of one kind (empty, without running git, when they are equal; `git diff-tree -r -M --name-status`/`--numstat`, or the two manifests compared, an exact-content move a rename; the empty id `""` is the empty tree), its `revision` `to`; a path only an incomplete side lacks is neither added nor deleted but `modified` with an `unknown` stat; `patches(from, to, paths, options)` answers one `PatchEntry` per path the comparison reports, a text one carrying its unified diff as `localGit`'s do (`git diff` between the trees, read as `localGit.patches` reads: a path past 1 MiB `too-large`, one whose read fails `failed`, the others fine), or, between manifests, from the stored contents with the line diff, a text entry's digest its patch's so it moves with `ignoreWhitespace` (`too-large` for a file not stored, `binary` for one not text, `failed { reason: "incomplete" }` for a path only an incomplete side lacks). Snapshots of two kinds do not compare: `SdkError("invalid")`. */
3
+ export declare function localSnapshots(env: ExecutionEnv, options: {
4
+ readonly store: string;
5
+ readonly git?: string;
6
+ readonly limit?: number;
7
+ }): SnapshotsApi;
@@ -0,0 +1,11 @@
1
+ import {
2
+ localSnapshots2
3
+ } from "../../chunks/canvas-preview-crmzxxt8.js";
4
+ import"../../chunks/canvas-preview-tjhabynd.js";
5
+ import"../../chunks/canvas-preview-kn7kvbfj.js";
6
+ import"../../chunks/canvas-preview-bxnqt8cd.js";
7
+ import"../../chunks/canvas-preview-0nq75h9k.js";
8
+ import"../../chunks/canvas-preview-mgcx2b2p.js";
9
+ export {
10
+ localSnapshots2 as localSnapshots
11
+ };
@@ -0,0 +1 @@
1
+ export declare function decodeText(bytes: Uint8Array): string | null;
@@ -0,0 +1,6 @@
1
+ import {
2
+ decodeText2
3
+ } from "../../chunks/canvas-preview-kn7kvbfj.js";
4
+ export {
5
+ decodeText2 as decodeText
6
+ };
@@ -0,0 +1,50 @@
1
+ import type { Disposer } from "@nyte-ai/schema";
2
+ type TreeEntry = {
3
+ readonly path: string;
4
+ readonly kind: "file" | "directory" | "symlink";
5
+ readonly size: number | null;
6
+ };
7
+ export type WalkFrame = {
8
+ readonly kind: "entries";
9
+ readonly entries: readonly TreeEntry[];
10
+ } | {
11
+ readonly kind: "complete";
12
+ } | {
13
+ readonly kind: "incomplete";
14
+ readonly reason: "limit" | "permission";
15
+ };
16
+ export type Ignores = {
17
+ matches(path: string, directory: boolean): Promise<boolean>;
18
+ ignored(path: string, directory: boolean): Promise<boolean>;
19
+ forget(directory: string): void;
20
+ };
21
+ export declare const WALK_LIMIT = 50000;
22
+ export declare function createIgnores(root: string): Ignores;
23
+ export declare function walkTree(root: string, options: {
24
+ readonly directory?: string;
25
+ readonly ignored: "exclude" | "include";
26
+ readonly ignores?: Ignores;
27
+ readonly limit?: number;
28
+ readonly page?: number;
29
+ }): AsyncGenerator<WalkFrame>;
30
+ /** Calls `changed` with the paths below `root` that moved, coalesced over `delay`, from a recursive `fs.watch`; where that is unavailable it walks the tree every `poll` ms when one is given, and calls `unwatched` once either way. */
31
+ export declare function watchTree(root: string, options: {
32
+ readonly delay: number;
33
+ readonly poll: number | null;
34
+ readonly unwatched?: () => void;
35
+ }, changed: (paths: ReadonlySet<string>) => void): Disposer;
36
+ /**
37
+ * Calls `changed` when what is at the absolute `target` moves, coalesced over
38
+ * `delay`: with `""` for the target itself (created, removed, replaced or, for
39
+ * a file, written) and the path below it for a change inside a directory,
40
+ * which is watched recursively. A file is watched itself and re-watched when
41
+ * it is replaced, a directory beside a watch on its parent for its own name;
42
+ * while the target is missing, the nearest directory above it that exists is
43
+ * watched for the next missing name, and the watch moves down as they appear.
44
+ * Nothing polls.
45
+ */
46
+ export declare function watchPath(target: string, options: {
47
+ readonly delay: number;
48
+ }, changed: (paths: ReadonlySet<string>) => void): Disposer;
49
+ export declare function readErrorCode(error: unknown): string | null;
50
+ export {};
@@ -0,0 +1,16 @@
1
+ import {
2
+ WALK_LIMIT2,
3
+ createIgnores2,
4
+ walkTree2,
5
+ watchTree2,
6
+ watchPath2,
7
+ readErrorCode2
8
+ } from "../../chunks/canvas-preview-mgcx2b2p.js";
9
+ export {
10
+ WALK_LIMIT2 as WALK_LIMIT,
11
+ createIgnores2 as createIgnores,
12
+ readErrorCode2 as readErrorCode,
13
+ walkTree2 as walkTree,
14
+ watchPath2 as watchPath,
15
+ watchTree2 as watchTree
16
+ };
@@ -0,0 +1,2 @@
1
+ import type { StoreConnection } from "@nyte-ai/core";
2
+ export declare function migrateLocalWorkspaceIdentities(connection: StoreConnection): Promise<void>;
@@ -0,0 +1,7 @@
1
+ import {
2
+ migrateLocalWorkspaceIdentities2
3
+ } from "../../chunks/canvas-preview-4e0pxa32.js";
4
+ import"../../chunks/canvas-preview-0nq75h9k.js";
5
+ export {
6
+ migrateLocalWorkspaceIdentities2 as migrateLocalWorkspaceIdentities
7
+ };
@@ -0,0 +1,46 @@
1
+ import type { WorktreeProvider } from "@nyte-ai/core";
2
+ /** One checkout of a repository: its folder and the branch it has out, null when HEAD is detached. */
3
+ export interface ListedWorktree {
4
+ readonly path: string;
5
+ readonly branch: string | null;
6
+ }
7
+ /** Lists every worktree of the repository holding `cwd` (`git worktree list --porcelain -z`), the main checkout first. */
8
+ export declare function listWorktrees(cwd: string, options?: {
9
+ readonly git?: string;
10
+ }): Promise<readonly ListedWorktree[]>;
11
+ /** Checks `branch` out in a new worktree at `path` (`git worktree add`), creating the branch at `from` when given. */
12
+ export declare function addWorktree(cwd: string, input: {
13
+ readonly path: string;
14
+ readonly branch: string;
15
+ readonly from?: string;
16
+ }, options?: {
17
+ readonly git?: string;
18
+ }): Promise<void>;
19
+ /** Whether `name` is a local branch of the repository holding `cwd`. */
20
+ export declare function hasBranch(cwd: string, name: string, options?: {
21
+ readonly git?: string;
22
+ }): Promise<boolean>;
23
+ /**
24
+ * Returns git worktrees for local workspaces (`git`, default `git` on the
25
+ * PATH), each under `<home>/.nyte/worktrees/<repository>/<slug>` on the branch
26
+ * `nyte/<slug>`, the slug the title's words and a hash of the name.
27
+ *
28
+ * `create` refuses a folder outside a repository or one without a commit, then
29
+ * answers the worktree already on that branch, or adds one from HEAD and
30
+ * copies the workspace's uncommitted changes in: the worktree's tracked and
31
+ * untracked files, ignored ones aside, are written to a tree through a
32
+ * temporary index seeded from the real one (which is never touched), and the
33
+ * new checkout moves to that tree with its index left at HEAD, so the changes
34
+ * show as uncommitted there too. A workspace below the repository's root gets
35
+ * the same folder below the worktree's.
36
+ *
37
+ * `remove` keeps a worktree, folder and branch, while it holds uncommitted
38
+ * changes or ignored files, since none were copied in and one may be a
39
+ * `.env` or a local database (a wholly ignored folder such as `node_modules`
40
+ * or a build's output aside); otherwise it removes the folder
41
+ * (`git worktree remove`) and deletes the branch unless it moved past `base`.
42
+ */
43
+ export declare function localWorktrees(options?: {
44
+ readonly home?: string;
45
+ readonly git?: string;
46
+ }): WorktreeProvider;
@@ -0,0 +1,14 @@
1
+ import {
2
+ listWorktrees2,
3
+ addWorktree2,
4
+ hasBranch2,
5
+ localWorktrees2
6
+ } from "../../chunks/canvas-preview-2jwbe14k.js";
7
+ import"../../chunks/canvas-preview-bxnqt8cd.js";
8
+ import"../../chunks/canvas-preview-0nq75h9k.js";
9
+ export {
10
+ addWorktree2 as addWorktree,
11
+ hasBranch2 as hasBranch,
12
+ listWorktrees2 as listWorktrees,
13
+ localWorktrees2 as localWorktrees
14
+ };
@@ -0,0 +1,75 @@
1
+ import type { Json, McpChange, McpExposure, McpOAuthConfig, McpScope, ValidationIssue } from "@nyte-ai/schema";
2
+ type McpTransportConfig = {
3
+ readonly kind: "stdio";
4
+ readonly command: string;
5
+ readonly args: readonly string[];
6
+ readonly env: Readonly<Record<string, string>>;
7
+ readonly cwd: string | null;
8
+ } | {
9
+ readonly kind: "http";
10
+ readonly url: string;
11
+ readonly headers: Readonly<Record<string, string>>;
12
+ readonly oauth: McpOAuthConfig;
13
+ };
14
+ export type McpServerEntry = {
15
+ readonly name: string;
16
+ readonly scope: McpScope;
17
+ readonly path: string;
18
+ readonly override: string | null;
19
+ readonly transport: McpTransportConfig;
20
+ readonly enabled: boolean;
21
+ readonly timeoutMs: number;
22
+ readonly description: string | null;
23
+ readonly exposure: McpExposure;
24
+ /** Patterns in file order; `*` matches any characters. */
25
+ readonly toolExposure: readonly (readonly [pattern: string, exposure: McpExposure])[];
26
+ };
27
+ export type McpFileContents = {
28
+ readonly kind: "missing";
29
+ } | {
30
+ readonly kind: "text";
31
+ readonly text: string;
32
+ } | {
33
+ readonly kind: "unreadable";
34
+ readonly message: string;
35
+ };
36
+ export type McpFile = {
37
+ readonly path: string;
38
+ readonly scope: McpScope;
39
+ readonly contents: McpFileContents;
40
+ };
41
+ export type McpConfig = {
42
+ readonly servers: ReadonlyMap<string, McpServerEntry>;
43
+ readonly issues: readonly ValidationIssue[];
44
+ };
45
+ /** Reads one `mcp.json`; a file that cannot be read is `unreadable`, not missing. */
46
+ export declare function readMcpFile(path: string): Promise<McpFileContents>;
47
+ /**
48
+ * Merges the user file and then the project file into one server list. A
49
+ * project entry replaces the user entry of the same name; one with only
50
+ * `enabled`, `exposure` or `toolExposure` overrides those fields instead.
51
+ * An invalid entry becomes an issue and is left out.
52
+ */
53
+ export declare function parseMcpConfig(files: readonly McpFile[]): McpConfig;
54
+ /**
55
+ * Plans a change to the `mcpServers` of one `mcp.json`, keeping the rest of
56
+ * the file: `change` returns the new servers, or `null` when it has nothing
57
+ * to change. A missing file starts empty; one that is not a JSON object is
58
+ * refused. Nothing is written; pass the text to {@link writeMcpFile}.
59
+ */
60
+ export declare function planMcpEdit(path: string, change: (servers: {
61
+ readonly [name: string]: Json;
62
+ }) => {
63
+ readonly [name: string]: Json;
64
+ } | null): Promise<{
65
+ readonly kind: "planned";
66
+ readonly text: string;
67
+ } | Exclude<McpChange, {
68
+ kind: "updated";
69
+ }>>;
70
+ /**
71
+ * Replaces one `mcp.json` whole, readable only by the user as it may hold
72
+ * secrets. A symlinked file is written through the link.
73
+ */
74
+ export declare function writeMcpFile(path: string, text: string): Promise<void>;
75
+ export {};
@@ -0,0 +1,12 @@
1
+ import {
2
+ readMcpFile2,
3
+ parseMcpConfig2,
4
+ planMcpEdit2,
5
+ writeMcpFile2
6
+ } from "../../chunks/canvas-preview-kdqgrstc.js";
7
+ export {
8
+ parseMcpConfig2 as parseMcpConfig,
9
+ planMcpEdit2 as planMcpEdit,
10
+ readMcpFile2 as readMcpFile,
11
+ writeMcpFile2 as writeMcpFile
12
+ };
@@ -0,0 +1,15 @@
1
+ import type { McpTransport } from "@earendil-works/pi-mcp";
2
+ import type { OAuthChallenge } from "@earendil-works/pi-mcp/oauth";
3
+ import type { PluginStorage } from "@nyte-ai/core";
4
+ import type { McpWorkspace } from "@nyte-ai/core/server";
5
+ import type { McpOAuthConfig } from "@nyte-ai/schema";
6
+ import type { McpServerEntry } from "./config.ts";
7
+ import type { McpOAuthSettings } from "./oauth.ts";
8
+ export type McpConnector = (entry: McpServerEntry, context: {
9
+ readonly workspace: McpWorkspace;
10
+ readonly home: string;
11
+ readonly secrets: PluginStorage["secrets"];
12
+ readonly challenged: (challenge: OAuthChallenge) => void;
13
+ }) => McpTransport;
14
+ export declare const connectServer: McpConnector;
15
+ export declare function oauthSettings(config: McpOAuthConfig, server: string): McpOAuthSettings;
@@ -0,0 +1,9 @@
1
+ import {
2
+ connectServer2,
3
+ oauthSettings2
4
+ } from "../../chunks/canvas-preview-pkzqg96v.js";
5
+ import"../../chunks/canvas-preview-5z63am63.js";
6
+ export {
7
+ connectServer2 as connectServer,
8
+ oauthSettings2 as oauthSettings
9
+ };