@nyte-ai/host 0.0.0-stage → 0.0.18

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 (235) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +6 -2
  3. package/THIRD-PARTY-NOTICES.md +800 -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-0nrnbt76.js +497 -0
  7. package/dist/chunks/canvas-preview-1sq7z9jq.js +17 -0
  8. package/dist/chunks/canvas-preview-1ta3avah.js +56 -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-5hxat7hh.js +239 -0
  15. package/dist/chunks/canvas-preview-5mex725c.js +14 -0
  16. package/dist/chunks/canvas-preview-5z63am63.js +295 -0
  17. package/dist/chunks/canvas-preview-65xqjw7f.js +20 -0
  18. package/dist/chunks/canvas-preview-69fkk9yn.js +95 -0
  19. package/dist/chunks/canvas-preview-75db60xy.js +457 -0
  20. package/dist/chunks/canvas-preview-76fwvd6e.js +272 -0
  21. package/dist/chunks/canvas-preview-8xgt67ka.js +598 -0
  22. package/dist/chunks/canvas-preview-98aj5p34.js +176 -0
  23. package/dist/chunks/canvas-preview-9aqczacs.js +73 -0
  24. package/dist/chunks/canvas-preview-a3yw0j70.js +72 -0
  25. package/dist/chunks/canvas-preview-azg56359.js +68 -0
  26. package/dist/chunks/canvas-preview-d9wwhbtz.js +240 -0
  27. package/dist/chunks/canvas-preview-ehf3vp31.js +411 -0
  28. package/dist/chunks/canvas-preview-evh92ywd.js +369 -0
  29. package/dist/chunks/canvas-preview-ewgspmsd.js +81 -0
  30. package/dist/chunks/canvas-preview-g3qj3y3k.js +156 -0
  31. package/dist/chunks/canvas-preview-h8hshnff.js +63 -0
  32. package/dist/chunks/canvas-preview-j1tnf51w.js +36 -0
  33. package/dist/chunks/canvas-preview-kdqgrstc.js +194 -0
  34. package/dist/chunks/canvas-preview-kn7kvbfj.js +12 -0
  35. package/dist/chunks/canvas-preview-m02v4yy6.js +386 -0
  36. package/dist/chunks/canvas-preview-mgcx2b2p.js +271 -0
  37. package/dist/chunks/canvas-preview-rp4x6y1h.js +144 -0
  38. package/dist/chunks/canvas-preview-rp6fz0w5.js +130 -0
  39. package/dist/chunks/canvas-preview-s94ebwf5.js +112 -0
  40. package/dist/chunks/canvas-preview-senpjwep.js +518 -0
  41. package/dist/chunks/canvas-preview-skzwvw4d.js +23 -0
  42. package/dist/chunks/canvas-preview-srgfpdmf.js +60 -0
  43. package/dist/chunks/canvas-preview-tjhabynd.js +252 -0
  44. package/dist/chunks/canvas-preview-vaatfznm.js +189 -0
  45. package/dist/chunks/canvas-preview-vax9ne4e.js +341 -0
  46. package/dist/chunks/canvas-preview-wg80rbc2.js +46 -0
  47. package/dist/chunks/canvas-preview-xn10d4f8.js +608 -0
  48. package/dist/chunks/canvas-preview-yjz0f7n4.js +50 -0
  49. package/dist/chunks/canvas-preview-ymgz0937.js +587 -0
  50. package/dist/chunks/canvas-preview-yrfz2ak6.js +134 -0
  51. package/dist/chunks/canvas-preview-zaaj99wd.js +244 -0
  52. package/dist/chunks/canvas-preview-zn2d0k9d.js +133 -0
  53. package/dist/src/canvas-preview.d.ts +29 -0
  54. package/dist/src/canvas-preview.js +267 -0
  55. package/dist/src/credentials.d.ts +44 -0
  56. package/dist/src/credentials.js +10 -0
  57. package/dist/src/deploy/cloudflare/worker.d.ts +50 -0
  58. package/dist/src/deploy/cloudflare/worker.js +196 -0
  59. package/dist/src/deploy/vercel/nitro.config.d.ts +2 -0
  60. package/dist/src/deploy/vercel/nitro.config.js +30 -0
  61. package/dist/src/deploy/vercel/server/routes/[...].d.ts +2 -0
  62. package/dist/src/deploy/vercel/server/routes/[...].js +18 -0
  63. package/dist/src/deploy/vercel/server/utils/host.d.ts +13 -0
  64. package/dist/src/deploy/vercel/server/utils/host.js +7 -0
  65. package/dist/src/deploy/vercel/server/utils/repair.d.ts +1 -0
  66. package/dist/src/deploy/vercel/server/utils/repair.js +6 -0
  67. package/dist/src/deploy/vercel/server/utils/step.d.ts +10 -0
  68. package/dist/src/deploy/vercel/server/utils/step.js +6 -0
  69. package/dist/src/deploy/vercel/server/workflows/drive.d.ts +14 -0
  70. package/dist/src/deploy/vercel/server/workflows/drive.js +13 -0
  71. package/dist/src/durable-object.d.ts +14 -0
  72. package/dist/src/durable-object.js +231 -0
  73. package/dist/src/hash.d.ts +1 -0
  74. package/dist/src/hash.js +6 -0
  75. package/dist/src/identity-key.d.ts +11 -0
  76. package/dist/src/identity-key.js +9 -0
  77. package/dist/src/identity.d.ts +12 -0
  78. package/dist/src/identity.js +6 -0
  79. package/dist/src/index.d.ts +21 -0
  80. package/dist/src/index.js +120 -0
  81. package/dist/src/key-file.d.ts +1 -0
  82. package/dist/src/key-file.js +7 -0
  83. package/dist/src/listen-fetch.d.ts +8 -0
  84. package/dist/src/listen-fetch.js +9 -0
  85. package/dist/src/listen.d.ts +4 -0
  86. package/dist/src/listen.js +10 -0
  87. package/dist/src/local/command.d.ts +15 -0
  88. package/dist/src/local/command.js +8 -0
  89. package/dist/src/local/feed.d.ts +7 -0
  90. package/dist/src/local/feed.js +6 -0
  91. package/dist/src/local/files.d.ts +18 -0
  92. package/dist/src/local/files.js +13 -0
  93. package/dist/src/local/git-watch.d.ts +15 -0
  94. package/dist/src/local/git-watch.js +7 -0
  95. package/dist/src/local/git.d.ts +5 -0
  96. package/dist/src/local/git.js +13 -0
  97. package/dist/src/local/github.d.ts +30 -0
  98. package/dist/src/local/github.js +9 -0
  99. package/dist/src/local/identity.d.ts +3 -0
  100. package/dist/src/local/identity.js +7 -0
  101. package/dist/src/local/jobs.d.ts +7 -0
  102. package/dist/src/local/jobs.js +6 -0
  103. package/dist/src/local/legacy-trust.d.ts +10 -0
  104. package/dist/src/local/legacy-trust.js +6 -0
  105. package/dist/src/local/patch.d.ts +16 -0
  106. package/dist/src/local/patch.js +17 -0
  107. package/dist/src/local/provider.d.ts +11 -0
  108. package/dist/src/local/provider.js +20 -0
  109. package/dist/src/local/snapshots.d.ts +7 -0
  110. package/dist/src/local/snapshots.js +11 -0
  111. package/dist/src/local/text.d.ts +1 -0
  112. package/dist/src/local/text.js +6 -0
  113. package/dist/src/local/tree.d.ts +50 -0
  114. package/dist/src/local/tree.js +16 -0
  115. package/dist/src/local/workspace-migration.d.ts +2 -0
  116. package/dist/src/local/workspace-migration.js +7 -0
  117. package/dist/src/local/worktrees.d.ts +46 -0
  118. package/dist/src/local/worktrees.js +14 -0
  119. package/dist/src/mcp/config.d.ts +75 -0
  120. package/dist/src/mcp/config.js +12 -0
  121. package/dist/src/mcp/connect.d.ts +28 -0
  122. package/dist/src/mcp/connect.js +9 -0
  123. package/dist/src/mcp/hub.d.ts +19 -0
  124. package/dist/src/mcp/hub.js +11 -0
  125. package/dist/src/mcp/oauth.d.ts +46 -0
  126. package/dist/src/mcp/oauth.js +12 -0
  127. package/dist/src/mcp/tools.d.ts +29 -0
  128. package/dist/src/mcp/tools.js +12 -0
  129. package/dist/src/open.d.ts +42 -0
  130. package/dist/src/open.js +44 -0
  131. package/dist/src/plugins/loader.d.ts +21 -0
  132. package/dist/src/plugins/loader.js +11 -0
  133. package/dist/src/postgres.d.ts +19 -0
  134. package/dist/src/postgres.js +8 -0
  135. package/dist/src/providers.d.ts +16 -0
  136. package/dist/src/providers.js +112 -0
  137. package/dist/src/secrets.d.ts +12 -0
  138. package/dist/src/secrets.js +8 -0
  139. package/dist/src/serve/binding.d.ts +39 -0
  140. package/dist/src/serve/binding.js +6 -0
  141. package/dist/src/serve/handler.d.ts +15 -0
  142. package/dist/src/serve/handler.js +8 -0
  143. package/dist/src/serve/stream-server.d.ts +6 -0
  144. package/dist/src/serve/stream-server.js +6 -0
  145. package/dist/src/session-index.d.ts +11 -0
  146. package/dist/src/session-index.js +11 -0
  147. package/dist/src/shell-env.d.ts +14 -0
  148. package/dist/src/shell-env.js +108 -0
  149. package/dist/src/sqlite-workers.d.ts +6 -0
  150. package/dist/src/sqlite-workers.js +6 -0
  151. package/dist/src/sqlite.d.ts +7 -0
  152. package/dist/src/sqlite.js +10 -0
  153. package/dist/src/store-owner.d.ts +15 -0
  154. package/dist/src/store-owner.js +9 -0
  155. package/dist/src/store-rows.d.ts +13 -0
  156. package/dist/src/store-rows.js +26 -0
  157. package/dist/src/store-usage.d.ts +25 -0
  158. package/dist/src/store-usage.js +16 -0
  159. package/dist/src/usage-scan.d.ts +24 -0
  160. package/dist/src/usage-scan.js +65 -0
  161. package/dist/src/usage-service.d.ts +22 -0
  162. package/dist/src/usage-service.js +12 -0
  163. package/dist/src/usage-summary.d.ts +9 -0
  164. package/dist/src/usage-summary.js +16 -0
  165. package/dist/src/usage-types.d.ts +86 -0
  166. package/dist/src/usage-types.js +0 -0
  167. package/dist/src/usage-worker.d.ts +1 -0
  168. package/dist/src/usage-worker.js +25 -0
  169. package/dist/src/usage.d.ts +72 -0
  170. package/dist/src/usage.js +13 -0
  171. package/package.json +132 -3
  172. package/src/canvas-preview.ts +402 -0
  173. package/src/credentials.ts +294 -0
  174. package/src/deploy/cloudflare/README.md +3 -0
  175. package/src/deploy/cloudflare/worker.ts +306 -0
  176. package/src/deploy/cloudflare/wrangler.jsonc +12 -0
  177. package/src/deploy/vercel/README.md +3 -0
  178. package/src/deploy/vercel/nitro.config.ts +29 -0
  179. package/src/deploy/vercel/server/routes/[...].ts +10 -0
  180. package/src/deploy/vercel/server/utils/host.ts +104 -0
  181. package/src/deploy/vercel/server/utils/repair.ts +35 -0
  182. package/src/deploy/vercel/server/utils/step.ts +25 -0
  183. package/src/deploy/vercel/server/workflows/drive.ts +46 -0
  184. package/src/deploy/vercel/tsconfig.json +9 -0
  185. package/src/deploy/vercel/types/bun.d.ts +2 -0
  186. package/src/durable-object.ts +386 -0
  187. package/src/hash.ts +5 -0
  188. package/src/identity-key.ts +20 -0
  189. package/src/identity.ts +66 -0
  190. package/src/index.ts +21 -0
  191. package/src/key-file.ts +53 -0
  192. package/src/listen-fetch.ts +409 -0
  193. package/src/listen.ts +228 -0
  194. package/src/local/command.ts +109 -0
  195. package/src/local/feed.ts +70 -0
  196. package/src/local/files.ts +812 -0
  197. package/src/local/git-watch.ts +189 -0
  198. package/src/local/git.ts +914 -0
  199. package/src/local/github.ts +692 -0
  200. package/src/local/identity.ts +21 -0
  201. package/src/local/jobs.ts +587 -0
  202. package/src/local/legacy-trust.ts +105 -0
  203. package/src/local/patch.ts +334 -0
  204. package/src/local/provider.ts +184 -0
  205. package/src/local/snapshots.ts +776 -0
  206. package/src/local/text.ts +9 -0
  207. package/src/local/tree.ts +398 -0
  208. package/src/local/workspace-migration.ts +95 -0
  209. package/src/local/worktrees.ts +239 -0
  210. package/src/mcp/config.ts +330 -0
  211. package/src/mcp/connect.ts +105 -0
  212. package/src/mcp/hub.ts +836 -0
  213. package/src/mcp/oauth.ts +436 -0
  214. package/src/mcp/tools.ts +333 -0
  215. package/src/open.ts +469 -0
  216. package/src/plugins/loader.ts +186 -0
  217. package/src/postgres.ts +492 -0
  218. package/src/providers.ts +135 -0
  219. package/src/secrets.ts +31 -0
  220. package/src/serve/binding.ts +628 -0
  221. package/src/serve/handler.ts +362 -0
  222. package/src/serve/stream-server.ts +176 -0
  223. package/src/session-index.ts +99 -0
  224. package/src/shell-env.ts +153 -0
  225. package/src/sqlite-workers.ts +283 -0
  226. package/src/sqlite.ts +528 -0
  227. package/src/store-owner.ts +98 -0
  228. package/src/store-rows.ts +110 -0
  229. package/src/store-usage.ts +344 -0
  230. package/src/usage-scan.ts +81 -0
  231. package/src/usage-service.ts +73 -0
  232. package/src/usage-summary.ts +79 -0
  233. package/src/usage-types.ts +87 -0
  234. package/src/usage-worker.ts +24 -0
  235. package/src/usage.ts +701 -0
@@ -0,0 +1,12 @@
1
+ import {
2
+ toolExposure2,
3
+ checkToolSchemas2,
4
+ TracingMcpClient2,
5
+ bridgeTools2
6
+ } from "../../chunks/canvas-preview-vaatfznm.js";
7
+ export {
8
+ TracingMcpClient2 as TracingMcpClient,
9
+ bridgeTools2 as bridgeTools,
10
+ checkToolSchemas2 as checkToolSchemas,
11
+ toolExposure2 as toolExposure
12
+ };
@@ -0,0 +1,42 @@
1
+ import type { Models } from "@nyte-ai/ai";
2
+ import type { WorkspaceTarget } from "@nyte-ai/schema";
3
+ import type { Host, OpenOptions, Plugin, Store } from "@nyte-ai/core";
4
+ /**
5
+ * Describes what `openHost` takes: `OpenOptions` with `store`, `workspace`,
6
+ * `models` and `plugins` optional, `secrets` defaulting to this machine's key,
7
+ * and the home directory holding `.nyte`. Every `OpenOptions` is one, so the
8
+ * sdk's Node `open` passes its options straight through.
9
+ */
10
+ export type OpenHostOptions = Omit<OpenOptions, "store" | "workspace" | "models" | "plugins"> & {
11
+ /** The host's store; absent, `sqliteStore` at `<home>/.nyte/nyte.db`, which the host then closes with itself (§51c). */
12
+ readonly store?: Store;
13
+ /** Where a root session acts when `create` names none; default the local folder `process.cwd()` (§51c). */
14
+ readonly workspace?: WorkspaceTarget;
15
+ /** The `@nyte-ai/ai` catalog; absent, `nyteModels` over this host's encrypted credential store (§42e). */
16
+ readonly models?: Models;
17
+ /** Core plugins loaded after the first-party built-ins and before the plugin files; default none. One with a built-in's id replaces that built-in, as a bundled client's `codemode` runtime does, and a `local` environment provider among them replaces the default one. */
18
+ readonly plugins?: readonly Plugin<"core">[];
19
+ /** The directory whose `.nyte` holds the store, settings, plugins, secrets key and identity key; default `os.homedir()`. */
20
+ readonly home?: string;
21
+ /** The login shell the default local provider's pty jobs run, read at each start; absent or null is `$SHELL`. */
22
+ readonly shell?: () => string | null;
23
+ };
24
+ /**
25
+ * Opens the Node host the sdk's Node `open` calls: `composeHost` with
26
+ * `home` (default `os.homedir()`), `store` (default `<home>/.nyte/nyte.db`,
27
+ * checked every 500 ms for another process's commits, which are then read so
28
+ * a second process on the file sees the first one's runs live),
29
+ * `workspace` (default the local folder `process.cwd()`), `secrets` (default
30
+ * `defaultSecrets(home)`), `models` (default `nyteModels`), `localProvider`
31
+ * unless a plugin provides the `local` environment, every first-party plugin
32
+ * of `@nyte-ai/plugin` that `plugins` does not replace by id, then `plugins`
33
+ * and `filePlugins`' files, `settingsSeed`'s seed and
34
+ * `hostDescription()`; each file that did not load becomes a
35
+ * `server.report` row. The host's `loadPlugins` is `pluginLoader` over
36
+ * the plugin directories (§47l), which `watchPlugins` watches for hot reload
37
+ * (§49a). `listen` defaults `identity` to `identitySigner(host.hostId, home)`
38
+ * and `describe` to the description; nothing here reads the secrets key, even
39
+ * with a credential stored (§50d, §55). `close()` stops the watch, closes the
40
+ * open listeners, the host, then a store it opened.
41
+ */
42
+ export declare function openHost(options: OpenHostOptions): Promise<Host>;
@@ -0,0 +1,44 @@
1
+ import {
2
+ openHost2
3
+ } from "../chunks/canvas-preview-vax9ne4e.js";
4
+ import"../chunks/canvas-preview-4e0pxa32.js";
5
+ import"../chunks/canvas-preview-9aqczacs.js";
6
+ import"../chunks/canvas-preview-yrfz2ak6.js";
7
+ import"../chunks/canvas-preview-rp6fz0w5.js";
8
+ import"../chunks/canvas-preview-xn10d4f8.js";
9
+ import"../chunks/canvas-preview-75db60xy.js";
10
+ import"../chunks/canvas-preview-1sq7z9jq.js";
11
+ import"../chunks/canvas-preview-ehf3vp31.js";
12
+ import"../chunks/canvas-preview-senpjwep.js";
13
+ import"../chunks/canvas-preview-tjhabynd.js";
14
+ import"../chunks/canvas-preview-8xgt67ka.js";
15
+ import"../chunks/canvas-preview-h8hshnff.js";
16
+ import"../chunks/canvas-preview-5z63am63.js";
17
+ import"../chunks/canvas-preview-vaatfznm.js";
18
+ import"../chunks/canvas-preview-ymgz0937.js";
19
+ import"../chunks/canvas-preview-kn7kvbfj.js";
20
+ import"../chunks/canvas-preview-azg56359.js";
21
+ import"../chunks/canvas-preview-yjz0f7n4.js";
22
+ import"../chunks/canvas-preview-zn2d0k9d.js";
23
+ import"../chunks/canvas-preview-s94ebwf5.js";
24
+ import"../chunks/canvas-preview-kdqgrstc.js";
25
+ import"../chunks/canvas-preview-evh92ywd.js";
26
+ import"../chunks/canvas-preview-zaaj99wd.js";
27
+ import"../chunks/canvas-preview-a3yw0j70.js";
28
+ import"../chunks/canvas-preview-98aj5p34.js";
29
+ import"../chunks/canvas-preview-76fwvd6e.js";
30
+ import"../chunks/canvas-preview-d9wwhbtz.js";
31
+ import"../chunks/canvas-preview-m02v4yy6.js";
32
+ import"../chunks/canvas-preview-rp4x6y1h.js";
33
+ import"../chunks/canvas-preview-skzwvw4d.js";
34
+ import"../chunks/canvas-preview-518dh8by.js";
35
+ import"../chunks/canvas-preview-0cmbkp2j.js";
36
+ import"../chunks/canvas-preview-69fkk9yn.js";
37
+ import"../chunks/canvas-preview-0nq75h9k.js";
38
+ import"../chunks/canvas-preview-5mex725c.js";
39
+ import"../chunks/canvas-preview-31w7xm8z.js";
40
+ import"../chunks/canvas-preview-wg80rbc2.js";
41
+ import"../chunks/canvas-preview-mgcx2b2p.js";
42
+ export {
43
+ openHost2 as openHost
44
+ };
@@ -0,0 +1,21 @@
1
+ import type { ValidationIssue } from "@nyte-ai/schema";
2
+ import type { Plugin } from "@nyte-ai/core";
3
+ import type { ComposeOptions } from "@nyte-ai/core/server";
4
+ /** Returns the core plugins in a plugin directory (`~/.nyte/plugins`, a workspace's `.nyte/plugins`), by file name: each `.ts`, `.mts`, `.js` or `.mjs` file directly in it and each subdirectory's `index` of those, loaded with a dynamic `import()` of its file URL. That `import()` is one of the two dynamic loads the rewrite allows (§41a), host-only, because a plugin file is code the owner placed there and its path is known only at run time; Node strips `.ts` types natively (erasable syntax only). The URL carries the file's modification time and size as a query, so a replaced file loads fresh instead of from the module cache. The default export must be a core plugin (an object with a string `id`, and, where present, `contribute` and `hooks` objects, an `activate` function and an `environment` with a string `kind` and `inspect` and `attach` functions); every file that does not load or export one is reported, together, as `SdkError("invalid")` with an issue per file naming it. A missing directory has none. */
5
+ export declare function loadPluginFiles(dir: string): Promise<readonly {
6
+ readonly plugin: Plugin<"core">;
7
+ readonly path: string;
8
+ }[]>;
9
+ /** Returns a plugin directory's plugins as `loadPluginFiles` finds and imports them, but file by file: every file that loads, with its path, and every file that does not, with its path and one `error` issue (its `path` the file, `source.file` the file, the message `loadPluginFiles` would have put in its `invalid`), never rejecting for a bad file; a missing directory has neither. What `openHost` loads `~/.nyte/plugins` and a local workspace's `.nyte/plugins` through, so one bad file is reported on `HostView.plugins` instead of failing the open (§41j); `loadPluginFiles` becomes this, throwing its one `invalid` when anything failed. */
10
+ export declare function loadPluginDirectory(dir: string): Promise<{
11
+ readonly loaded: readonly {
12
+ readonly plugin: Plugin<"core">;
13
+ readonly path: string;
14
+ }[];
15
+ readonly failed: readonly {
16
+ readonly path: string;
17
+ readonly issue: ValidationIssue;
18
+ }[];
19
+ }>;
20
+ /** Returns the host's `loadPlugins` (`composeHost({ loadPlugins })`), which `plugins.replace` and `plugins.check` load their files through (§40b, §47m): each path, resolved to its real path, must lie inside one of `dirs` (else `SdkError("denied")`) and is imported as `loadPluginFiles` imports a file; the plugins come back in path order. */
21
+ export declare function pluginLoader(dirs: readonly string[]): NonNullable<ComposeOptions["loadPlugins"]>;
@@ -0,0 +1,11 @@
1
+ import {
2
+ loadPluginFiles2,
3
+ loadPluginDirectory2,
4
+ pluginLoader2
5
+ } from "../../chunks/canvas-preview-s94ebwf5.js";
6
+ import"../../chunks/canvas-preview-mgcx2b2p.js";
7
+ export {
8
+ loadPluginDirectory2 as loadPluginDirectory,
9
+ loadPluginFiles2 as loadPluginFiles,
10
+ pluginLoader2 as pluginLoader
11
+ };
@@ -0,0 +1,19 @@
1
+ import type { Store } from "@nyte-ai/core";
2
+ /** Returns one pooled client: what `PostgresPool.connect` lends, a query at a time, released once. */
3
+ export type PostgresClient = {
4
+ query(text: string, values?: readonly unknown[]): Promise<{
5
+ readonly rows: readonly Record<string, unknown>[];
6
+ }>;
7
+ release(): void;
8
+ };
9
+ /** Returns the pool `postgresStore` queries through, structurally, so `pg.Pool` and a pglite adapter both fit (§41c). */
10
+ export type PostgresPool = {
11
+ connect(): Promise<PostgresClient>;
12
+ end(): Promise<void>;
13
+ };
14
+ /** Returns a `Store` over Postgres: a `pg` `Pool` of its own from `connectionString`, ended by `close()`, or the caller's `pool` (any `PostgresPool`, §41c), left open. The first `open()` brings it to core's `STORE_VERSION` with `migrateStore`, the sqlite store's tables with `bytes` as `BYTEA`, `seq`/`at` as `BIGINT` and `refs.name` collated `"C"` so `list` ranges and orders by code point as the other stores do; each commit is one transaction under an exclusive advisory lock, so instances opening at once serialize, and the open rejects with `SdkError("unavailable")` for a store a newer Nyte migrated. There is no backup. Semantics are the sqlite store's (§41f); each `refs.set` is one transaction on one pooled client that shares the migration's advisory lock, rejects with `SdkError("unavailable")` when a newer Nyte has migrated the store, then takes `pg_advisory_xact_lock` on every ref name and session it touches, in sorted order (a row lock cannot hold an absent ref or a session's next seq), then reads those refs and applies `RefStore.set`, rolling back on any error. Every `open()` returns a connection whose reads go through the pool. */
15
+ export declare function postgresStore(input: {
16
+ readonly connectionString: string;
17
+ } | {
18
+ readonly pool: PostgresPool;
19
+ }): Store;
@@ -0,0 +1,8 @@
1
+ import {
2
+ postgresStore2
3
+ } from "../chunks/canvas-preview-4b6sayhg.js";
4
+ import"../chunks/canvas-preview-0cmbkp2j.js";
5
+ import"../chunks/canvas-preview-69fkk9yn.js";
6
+ export {
7
+ postgresStore2 as postgresStore
8
+ };
@@ -0,0 +1,16 @@
1
+ import type { WorkspaceTarget } from "@nyte-ai/schema";
2
+ import type { EnvironmentProvider, ExecutionEnv, GitApi, SnapshotsApi } from "@nyte-ai/core";
3
+ /** Returns one booted or joined sandbox, what `sandboxProvider`'s `boot` answers: its identity (the one the provider's `inspect` answers for its target), its working directory, its files over the remote `FilesApi` contract (paths relative to `cwd`, §41j), its processes as jobs, `destroy`, which tears the sandbox down with its files and processes, and the optional `git` and `snapshots` seams of a sandbox that can serve them (§42c, §42n; paths relative to `cwd` too). */
4
+ export type SandboxHandle = Pick<ExecutionEnv, "identity" | "cwd" | "files" | "exec"> & {
5
+ readonly git?: GitApi;
6
+ readonly snapshots?: SnapshotsApi;
7
+ destroy(): Promise<void>;
8
+ };
9
+ /** Returns the chat-only environment provider (`kind: "chat-only"`), node-free: a workspace with no files and no processes, for a host that only chats (a Durable Object). `inspect` answers any target with identity `"chat-only"`, `available` and no project sources; `attach` answers an `ExecutionEnv` with that identity and `cwd` `/` whose `files` see nothing — `read` answers `missing`, `stat` null, `bytes` throws `SdkError("unknown")`, `scan` and `search` answer `complete` alone, `find` no entries, `watch` yields nothing until its caller returns, `format` answers `unavailable { reason: "unsupported" }` — and refuse every change (`write`, `remove`, `upload` and a batch's `apply` throw `SdkError("unavailable")`), whose `exec` throws `SdkError("unavailable")`, and whose `close` resolves. No `git`, `snapshots`, `browser` or `destroy`. */
10
+ export declare function chatOnlyProvider(): EnvironmentProvider;
11
+ /** Returns an environment provider over remote sandboxes (`kind` default `"sandbox"`), node-free. `inspect` is `options.inspect`, else it answers the content hash of the target (core's `objectId`) as its identity, `available` and no project sources, booting nothing. `attach(target)` joins the sandbox this provider already booted for the target or boots it with `boot(target)` (one boot in flight per target, keyed by that hash; a failed boot is forgotten so the next attach boots again) and answers an `ExecutionEnv` with the handle's `identity`, `cwd`, `files` and `exec`, whose `close` detaches and leaves the sandbox running. `git` and `snapshots` are on the provider, `(env) => handle.git` and `(env) => handle.snapshots` for the handle behind an environment it attached, found by the environment's identity, which core's wraps pass through (§42c, §42o): a handle that has a seam serves it (`git` `available` to the workspace, snapshots taken around each run), and one without answers `undefined`, which the workspace sees as `git` `unsupported` and no snapshots — the baseline's "required for local and sandbox" unmet for that sandbox. `destroy(target)` calls the handle's `destroy` (joining the sandbox through `boot` first when this provider holds none for the target) and forgets it. No `browser`. */
12
+ export declare function sandboxProvider(options: {
13
+ readonly kind?: string;
14
+ boot(target: WorkspaceTarget): Promise<SandboxHandle>;
15
+ readonly inspect?: EnvironmentProvider["inspect"];
16
+ }): EnvironmentProvider;
@@ -0,0 +1,112 @@
1
+ // src/providers.ts
2
+ import { asId, SdkError } from "@nyte-ai/schema";
3
+ import { closable } from "@nyte-ai/core";
4
+ import { objectId } from "@nyte-ai/core/store";
5
+ var CHAT_ONLY = asId("chat-only");
6
+ function chatOnlyProvider() {
7
+ const env = {
8
+ identity: CHAT_ONLY,
9
+ cwd: "/",
10
+ files: chatOnlyFiles(),
11
+ async exec() {
12
+ throw new SdkError("unavailable", "A chat-only workspace runs no processes.");
13
+ },
14
+ close: async () => {
15
+ return;
16
+ }
17
+ };
18
+ return {
19
+ kind: "chat-only",
20
+ inspect: async () => ({
21
+ identity: CHAT_ONLY,
22
+ availability: { kind: "available" },
23
+ projectSources: []
24
+ }),
25
+ attach: async () => env
26
+ };
27
+ }
28
+ function sandboxProvider(options) {
29
+ const booted = new Map;
30
+ const attached = new Map;
31
+ const boot = async (target) => {
32
+ const key = await objectId(target);
33
+ const known = booted.get(key);
34
+ if (known !== undefined)
35
+ return known;
36
+ const booting = options.boot(target);
37
+ booted.set(key, booting);
38
+ booting.catch(() => {
39
+ if (booted.get(key) === booting)
40
+ booted.delete(key);
41
+ });
42
+ return booting;
43
+ };
44
+ return {
45
+ kind: options.kind ?? "sandbox",
46
+ inspect: options.inspect ?? (async (target) => ({
47
+ identity: asId(await objectId(target)),
48
+ availability: { kind: "available" },
49
+ projectSources: []
50
+ })),
51
+ async attach(target) {
52
+ const handle = await boot(target);
53
+ attached.set(handle.identity, handle);
54
+ return {
55
+ identity: handle.identity,
56
+ cwd: handle.cwd,
57
+ files: handle.files,
58
+ exec: (command, run) => handle.exec(command, run),
59
+ close: async () => {
60
+ return;
61
+ }
62
+ };
63
+ },
64
+ git: (env) => attached.get(env.identity)?.git,
65
+ snapshots: (env) => attached.get(env.identity)?.snapshots,
66
+ async destroy(target) {
67
+ const key = await objectId(target);
68
+ const handle = await (booted.get(key) ?? options.boot(target));
69
+ booted.delete(key);
70
+ if (attached.get(handle.identity) === handle)
71
+ attached.delete(handle.identity);
72
+ await handle.destroy();
73
+ }
74
+ };
75
+ }
76
+ function chatOnlyFiles() {
77
+ const refuse = async () => {
78
+ throw new SdkError("unavailable", "A chat-only workspace has no files to change.");
79
+ };
80
+ const plan = { put: () => plan, remove: () => plan, apply: refuse };
81
+ return {
82
+ read: async (path) => ({ kind: "missing", path }),
83
+ async bytes(path) {
84
+ throw new SdkError("unknown", `No file is at ${path}.`);
85
+ },
86
+ stat: async () => null,
87
+ write: refuse,
88
+ remove: refuse,
89
+ batch: () => plan,
90
+ format: async () => ({ kind: "unavailable", reason: "unsupported" }),
91
+ async* scan() {
92
+ yield { kind: "complete" };
93
+ },
94
+ find: async () => [],
95
+ async* search() {
96
+ yield { kind: "complete" };
97
+ },
98
+ watch: () => closable(() => ({
99
+ pull: () => new Promise(() => {
100
+ return;
101
+ }),
102
+ close: () => {
103
+ return;
104
+ }
105
+ })),
106
+ upload: refuse
107
+ };
108
+ }
109
+ export {
110
+ chatOnlyProvider,
111
+ sandboxProvider
112
+ };
@@ -0,0 +1,12 @@
1
+ import type { OpenOptions } from "@nyte-ai/core";
2
+ /** Returns where a host gets the 32-byte key core encrypts secrets with: `OpenOptions.secrets` (decision 10). */
3
+ export type SecretsSource = NonNullable<OpenOptions["secrets"]>;
4
+ /**
5
+ * Returns the Node host's default secrets key: `<home>/.nyte/secret.key`, 32
6
+ * raw bytes read or minted by `readKeyFile` (decision 10; §43d as amended by
7
+ * §43i). The source memoises a resolved answer itself; a rejected one is not
8
+ * kept, so the next call reads again (§43k). The key is for secrets only: the
9
+ * host's identity has its own file (§50a). There is no keychain here, and
10
+ * the desktop uses this file as the tui and cli do (§55).
11
+ */
12
+ export declare function defaultSecrets(home: string): SecretsSource;
@@ -0,0 +1,8 @@
1
+ import {
2
+ defaultSecrets2
3
+ } from "../chunks/canvas-preview-skzwvw4d.js";
4
+ import"../chunks/canvas-preview-wg80rbc2.js";
5
+ import"../chunks/canvas-preview-mgcx2b2p.js";
6
+ export {
7
+ defaultSecrets2 as defaultSecrets
8
+ };
@@ -0,0 +1,39 @@
1
+ import type { ByteReader, OutputFrame } from "@nyte-ai/schema";
2
+ import type { Connection } from "@nyte-ai/core";
3
+ import type { ServerHost } from "@nyte-ai/core/server";
4
+ import type { ByteName, CallName, FrameName, OperationInput, OperationOutput } from "@nyte-ai/protocol";
5
+ /** Returns what a row's binding receives besides its input: the request's body (the bytes of `files.write`, `job.write` and `files.upload`) and the client's abort signal. */
6
+ export type BindingRequest = {
7
+ readonly body: ReadableStream<Uint8Array> | null;
8
+ readonly signal: AbortSignal;
9
+ };
10
+ /** Returns a byte row's answer: the reader and the headers the response adds (`X-Nyte-Version` for `files.bytes`, §40p). */
11
+ type ByteBody = {
12
+ readonly reader: ByteReader;
13
+ readonly headers?: Readonly<Record<string, string>>;
14
+ };
15
+ /** Returns the bindings of the rows answered once. */
16
+ export type CallBinding = {
17
+ readonly [N in CallName]: (input: OperationInput<N>, request: BindingRequest) => Promise<OperationOutput<N>>;
18
+ };
19
+ /** Returns the bindings of the rows answered with JSON frames. */
20
+ export type FrameBinding = {
21
+ readonly [N in FrameName]: (input: OperationInput<N>, request: BindingRequest) => Promise<AsyncIterable<OperationOutput<N>>>;
22
+ };
23
+ /** Returns the bindings of the rows answered with bytes. */
24
+ export type ByteBinding = {
25
+ readonly [N in ByteName]: (input: OperationInput<N>, request: BindingRequest) => Promise<ByteBody>;
26
+ };
27
+ /** Returns the binding of `job.output`, whose frames are framed bytes and control frames (§40h). */
28
+ type OutputBinding = {
29
+ readonly "job.output": (input: OperationInput<"job.output">, request: BindingRequest) => Promise<AsyncIterable<OutputFrame>>;
30
+ };
31
+ /** Returns the server side of the table for one connection: each row takes its decoded input and the request's body and abort signal, and answers its output, its frames, or a byte reader; setup failures (authority, capability, unknown ids) reject before any frame. */
32
+ export type Binding = CallBinding & FrameBinding & ByteBinding & OutputBinding;
33
+ /** Describes what a binding needs beyond the connection: the server port, for the rows that carry a wire-only id (§40o) and `parts.create`. */
34
+ export type BindingOptions = {
35
+ readonly server: ServerHost;
36
+ };
37
+ /** Returns each row bound to the call it names: ids bind handles on the connection, handles returned become ids, `Set`s and `Map`s become their wire forms; `head.move`, `files.batch` and `browser.open` go through the server port's wire operations with their wire id (§40o, §40x). `head.watch` sends the head's view from the host's fold whole, then each later view as its changes (`viewFrames`), the core watch marking the principal's seen tip (§40a, §54a). Authority is the caller's gate: the server checks each row's before binding. */
38
+ export declare function bindConnection(connection: Connection, options: BindingOptions): Binding;
39
+ export {};
@@ -0,0 +1,6 @@
1
+ import {
2
+ bindConnection2
3
+ } from "../../chunks/canvas-preview-m02v4yy6.js";
4
+ export {
5
+ bindConnection2 as bindConnection
6
+ };
@@ -0,0 +1,15 @@
1
+ import type { Authority } from "@nyte-ai/schema";
2
+ import type { Connection } from "@nyte-ai/core";
3
+ import type { BindingOptions } from "./binding.ts";
4
+ /** Describes the handler: how a request authenticates to a connection (with the headers its answer carries, such as a pairing's `X-Nyte-Credential`, §40j), what the binding needs, the body limit and the allowed origins. */
5
+ export type HandlerOptions = BindingOptions & {
6
+ connection(request: Request): Promise<{
7
+ readonly connection: Connection;
8
+ readonly authority: ReadonlySet<Authority>;
9
+ readonly headers?: Readonly<Record<string, string>>;
10
+ }>;
11
+ readonly maxBodyBytes?: number;
12
+ readonly origins?: readonly string[];
13
+ };
14
+ /** Returns the whole protocol as one fetch handler: `POST /<name>` per row (anything else `unknown`), CORS for `origins`, the row's authority over the connection the request authenticates to, and the body limit (413). Calls answer JSON, watches and JSON streams server-sent events, byte rows an octet stream and `job.output` framed octets (§40h, §40w); the request's abort ends every stream. An error answers its encoded `SdkError` at the status `errorStatus` gives its code. */
15
+ export declare function createHandler(options: HandlerOptions): (request: Request) => Promise<Response>;
@@ -0,0 +1,8 @@
1
+ import {
2
+ createHandler2
3
+ } from "../../chunks/canvas-preview-d9wwhbtz.js";
4
+ import"../../chunks/canvas-preview-m02v4yy6.js";
5
+ import"../../chunks/canvas-preview-rp4x6y1h.js";
6
+ export {
7
+ createHandler2 as createHandler
8
+ };
@@ -0,0 +1,6 @@
1
+ import type { Connection } from "@nyte-ai/core";
2
+ export declare function createStreamChannels(): {
3
+ open(connection: Connection, signal: AbortSignal, deflate: boolean): Response;
4
+ start(connection: Connection, channelId: string, streamId: string, request: AbortSignal, serve: (signal: AbortSignal) => Promise<Response>): Promise<Response>;
5
+ cancel(connection: Connection, channelId: string, streamId: string): void;
6
+ };
@@ -0,0 +1,6 @@
1
+ import {
2
+ createStreamChannels2
3
+ } from "../../chunks/canvas-preview-rp4x6y1h.js";
4
+ export {
5
+ createStreamChannels2 as createStreamChannels
6
+ };
@@ -0,0 +1,11 @@
1
+ import type { SessionIndex } from "@nyte-ai/core";
2
+ import type { Json, Revision } from "@nyte-ai/schema";
3
+ type Binding = string | number | null;
4
+ interface Statement {
5
+ readonly text: string;
6
+ readonly values: readonly Binding[];
7
+ }
8
+ export declare function sessionIndexChanges(name: string, object: Json | null, revision: Revision): readonly Statement[];
9
+ export declare function sqlSessionIndex(read: (text: string, values: readonly Binding[]) => Promise<readonly Record<string, unknown>[]>): SessionIndex;
10
+ export declare function postgresSessionIndexQuery(text: string): string;
11
+ export {};
@@ -0,0 +1,11 @@
1
+ import {
2
+ sessionIndexChanges2,
3
+ sqlSessionIndex2,
4
+ postgresSessionIndexQuery2
5
+ } from "../chunks/canvas-preview-0cmbkp2j.js";
6
+ import"../chunks/canvas-preview-69fkk9yn.js";
7
+ export {
8
+ postgresSessionIndexQuery2 as postgresSessionIndexQuery,
9
+ sessionIndexChanges2 as sessionIndexChanges,
10
+ sqlSessionIndex2 as sqlSessionIndex
11
+ };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Starts reading the login shell's environment into `process.env`, once per process, and holds
3
+ * every child spawn and provider auth env read (`processEnvironment()`) until it lands. The
4
+ * process itself goes on: a desktop app opened from the Dock inherits launchd's bare PATH and
5
+ * none of the rc files' API keys, and only what it spawns and what auth reads need the shell's.
6
+ * The read gives up after 10 s and keeps the inherited environment.
7
+ */
8
+ export declare function completeShellEnvironment(): Promise<void>;
9
+ /** Returns a repair that merges the login shell's environment into `env` on its first call; later calls share that attempt. */
10
+ export declare function createShellEnvironmentRepair({ env, platform, timeoutMs, }?: {
11
+ env?: NodeJS.ProcessEnv;
12
+ platform?: NodeJS.Platform;
13
+ timeoutMs?: number;
14
+ }): () => Promise<void>;
@@ -0,0 +1,108 @@
1
+ // src/shell-env.ts
2
+ import { spawn } from "node:child_process";
3
+ import { randomUUID } from "node:crypto";
4
+ import { isAbsolute } from "node:path";
5
+ import { holdProcessEnvironment } from "@nyte-ai/core/server";
6
+ var TIMEOUT_MS = 1e4;
7
+ var OUTPUT_LIMIT = 64 * 1024;
8
+ var SHELL_LOCAL = new Set(["PWD", "OLDPWD", "SHLVL", "_"]);
9
+ var shared;
10
+ function completeShellEnvironment() {
11
+ if (shared === undefined) {
12
+ shared = createShellEnvironmentRepair();
13
+ holdProcessEnvironment(shared());
14
+ }
15
+ return shared();
16
+ }
17
+ function createShellEnvironmentRepair({
18
+ env = process.env,
19
+ platform = process.platform,
20
+ timeoutMs = TIMEOUT_MS
21
+ } = {}) {
22
+ let attempt;
23
+ return () => {
24
+ attempt ??= repairShellEnvironment({ env, platform, timeoutMs });
25
+ return attempt;
26
+ };
27
+ }
28
+ async function repairShellEnvironment({
29
+ env,
30
+ platform,
31
+ timeoutMs
32
+ }) {
33
+ const shell = env.SHELL || "/bin/sh";
34
+ if (platform === "win32" || !isAbsolute(shell))
35
+ return;
36
+ const inheritedPath = env.PATH;
37
+ const loaded = await readLoginShellEnvironment({ shell, env, timeoutMs });
38
+ if (loaded === undefined)
39
+ return;
40
+ for (const [name, value] of loaded) {
41
+ if (name !== "PATH" && !SHELL_LOCAL.has(name))
42
+ env[name] = value;
43
+ }
44
+ const path = loaded.get("PATH");
45
+ if (path === undefined || path === "")
46
+ return;
47
+ env.PATH = inheritedPath ? `${path}:${inheritedPath}` : path;
48
+ }
49
+ function readLoginShellEnvironment({
50
+ shell,
51
+ env,
52
+ timeoutMs
53
+ }) {
54
+ return new Promise((resolve) => {
55
+ const marker = `nyte-env-${randomUUID()}`;
56
+ const fence = `\x00${marker}\x00`;
57
+ const printFence = `printf '\\000${marker}\\000'`;
58
+ const child = spawn(shell, ["-ilc", `${printFence}; /usr/bin/env -0; ${printFence}`], {
59
+ env,
60
+ detached: true,
61
+ stdio: ["ignore", "pipe", "ignore"]
62
+ });
63
+ const chunks = [];
64
+ let bytes = 0;
65
+ let settled = false;
66
+ const finish = (loaded) => {
67
+ if (settled)
68
+ return;
69
+ settled = true;
70
+ clearTimeout(timer);
71
+ child.stdout.destroy();
72
+ child.kill("SIGKILL");
73
+ resolve(loaded);
74
+ };
75
+ const timer = setTimeout(() => finish(undefined), timeoutMs);
76
+ child.on("error", () => finish(undefined));
77
+ child.stdout.on("error", () => finish(undefined));
78
+ child.stdout.on("data", (chunk) => {
79
+ bytes += chunk.byteLength;
80
+ if (bytes > OUTPUT_LIMIT) {
81
+ finish(undefined);
82
+ return;
83
+ }
84
+ chunks.push(chunk);
85
+ });
86
+ child.on("close", (code) => {
87
+ const [, fenced, ...after] = Buffer.concat(chunks).toString("utf8").split(fence);
88
+ if (code !== 0 || fenced === undefined || after.length === 0) {
89
+ finish(undefined);
90
+ return;
91
+ }
92
+ finish(parseEnvironment(fenced));
93
+ });
94
+ });
95
+ }
96
+ function parseEnvironment(output) {
97
+ const loaded = new Map;
98
+ for (const entry of output.split("\x00")) {
99
+ const [name = "", ...value] = entry.split("=");
100
+ if (name !== "" && value.length > 0)
101
+ loaded.set(name, value.join("="));
102
+ }
103
+ return loaded;
104
+ }
105
+ export {
106
+ completeShellEnvironment,
107
+ createShellEnvironmentRepair
108
+ };
@@ -0,0 +1,6 @@
1
+ import type { DatabaseSync, SQLInputValue } from "node:sqlite";
2
+ export declare function sqliteWorkers(database: DatabaseSync, path: string): {
3
+ check: () => void;
4
+ read(sql: string, params: readonly SQLInputValue[]): Promise<readonly Record<string, string | number | bigint | null>[] | undefined>;
5
+ close(): Promise<void>;
6
+ };
@@ -0,0 +1,6 @@
1
+ import {
2
+ sqliteWorkers2
3
+ } from "../chunks/canvas-preview-zaaj99wd.js";
4
+ export {
5
+ sqliteWorkers2 as sqliteWorkers
6
+ };
@@ -0,0 +1,7 @@
1
+ import type { Store } from "@nyte-ai/core";
2
+ /** Returns a `Store` over one `node:sqlite` `DatabaseSync`: a file at `path` (WAL mode, opened only by the process that `claimStore` makes its owner, so a second process rejects with `SdkError("unavailable")` before it reads or migrates the file) or an in-memory database. The first `open()` brings it to core's `STORE_VERSION` with `migrateStore` (core's `objects`, `refs`, `log` and `store_meta` tables; each commit one `BEGIN IMMEDIATE`), a file store whose migration rewrites records first saving those refs' rows (name, target, revision; objects are never deleted, so the rows restore them) to `backups/store-<time>-<pid>-<uuid>-v<from>-v<to>.json` beside it, keeping the newest three backups, and rejects with `SdkError("unavailable")` for a store a newer Nyte migrated; a `migrations` table an older Nyte left is kept and ignored. `put` ids the value with core's `objectId` and stores its JSON once; `putBlob` buffers the stream, ids it with `blobId` and stores the bytes once; an object and a blob that share an id share the row, each column filled once (§41f); `blob` reads the bytes back with their size and a null mime. `refs.set` is one `BEGIN IMMEDIATE` transaction with `RefStore.set`'s semantics, each revision a random UUID, that first rejects with `SdkError("unavailable")` when a newer Nyte has migrated the store since it opened. `list(prefix)` reads the name range from `prefix` in name order (BINARY, by code point); `log` returns the events after `after` in seq order up to `limit`, each validated as a `SessionEvent`; `tail` is the session's last seq, or 0; `commitMark` is the writer connection's `PRAGMA data_version`, which moves only for another connection's commit. `checkpoints` keeps one fold checkpoint per session in `fold_checkpoints`, a write at a lower seq leaving the kept one, and `gap` counts a session's events past a seq and sums their UTF-8 bytes. File stores run `list` and `log` on a read-only worker and WAL checkpoints on a separate worker, checking at 1,000 frames and after 100 ms idle with a 10,000-frame writer backstop; unavailable workers warn and fall back to the main connection. Checkpoints use fullfsync on macOS, WAL reuse retains at most 32 MiB, and opening refreshes planner statistics. Writes binding more than 64 KiB use uncached statements. Every `open()` returns a connection over the one writer; `close()` waits for opening and worker shutdown before closing it, and an open during close waits to reopen. */
3
+ export declare function sqliteStore(input: {
4
+ readonly path: string;
5
+ } | {
6
+ readonly memory: true;
7
+ }): Store;
@@ -0,0 +1,10 @@
1
+ import {
2
+ sqliteStore2
3
+ } from "../chunks/canvas-preview-evh92ywd.js";
4
+ import"../chunks/canvas-preview-zaaj99wd.js";
5
+ import"../chunks/canvas-preview-a3yw0j70.js";
6
+ import"../chunks/canvas-preview-0cmbkp2j.js";
7
+ import"../chunks/canvas-preview-69fkk9yn.js";
8
+ export {
9
+ sqliteStore2 as sqliteStore
10
+ };
@@ -0,0 +1,15 @@
1
+ import { SdkError } from "@nyte-ai/schema";
2
+ /** Another live process owns the store, so this one can't open it; the message names the owner. */
3
+ export declare class StoreOwned extends SdkError {
4
+ constructor(message: string);
5
+ }
6
+ /**
7
+ * Makes this process the one owner of the file store at `path`, which alone opens,
8
+ * migrates and writes it, and returns what gives the claim up. The claim is a write lock
9
+ * this process holds on `<path>.owner`, a SQLite file whose one row names the owner's pid,
10
+ * program and store version; the operating system drops the lock when the process exits,
11
+ * so a crashed owner leaves no claim to clear. Claims of one path in this process share
12
+ * the lock until the last is given up. Throws `StoreOwned`, an `SdkError("unavailable")`
13
+ * naming the owner, when another process holds the claim.
14
+ */
15
+ export declare function claimStore(path: string): () => void;
@@ -0,0 +1,9 @@
1
+ import {
2
+ StoreOwned2,
3
+ claimStore2
4
+ } from "../chunks/canvas-preview-a3yw0j70.js";
5
+ import"../chunks/canvas-preview-69fkk9yn.js";
6
+ export {
7
+ StoreOwned2 as StoreOwned,
8
+ claimStore2 as claimStore
9
+ };