@radheim/server 0.0.0-stage → 2.4.3

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 (210) hide show
  1. package/dist/api.d.ts +9383 -0
  2. package/dist/api.js +10 -0
  3. package/dist/auth.d.ts +21 -0
  4. package/dist/auth.js +20 -0
  5. package/dist/chunks/api-0q8mvh3b.js +62 -0
  6. package/dist/chunks/api-11hx8jza.js +39 -0
  7. package/dist/chunks/api-1jnx79t4.js +31 -0
  8. package/dist/chunks/api-1mn3274c.js +57 -0
  9. package/dist/chunks/api-238wcyzf.js +252 -0
  10. package/dist/chunks/api-280h8k1v.js +198 -0
  11. package/dist/chunks/api-31hzmefh.js +73 -0
  12. package/dist/chunks/api-34msk99p.js +208 -0
  13. package/dist/chunks/api-40z6h0fq.js +20 -0
  14. package/dist/chunks/api-5fr63cjn.js +27 -0
  15. package/dist/chunks/api-5ggmn0t6.js +348 -0
  16. package/dist/chunks/api-61ndsq4a.js +45 -0
  17. package/dist/chunks/api-7tqjsq7b.js +101 -0
  18. package/dist/chunks/api-8cw69z4p.js +15 -0
  19. package/dist/chunks/api-8sb6qqpn.js +28 -0
  20. package/dist/chunks/api-8tn84h85.js +39 -0
  21. package/dist/chunks/api-9bxtygz0.js +48 -0
  22. package/dist/chunks/api-9qr3r2v1.js +66 -0
  23. package/dist/chunks/api-9rqn6x4v.js +16 -0
  24. package/dist/chunks/api-azwdvyh3.js +4 -0
  25. package/dist/chunks/api-b3j0kcev.js +30 -0
  26. package/dist/chunks/api-bctzdhd7.js +21 -0
  27. package/dist/chunks/api-bnpt5zxx.js +36 -0
  28. package/dist/chunks/api-bxwfazps.js +90 -0
  29. package/dist/chunks/api-d4cyxj7e.js +80 -0
  30. package/dist/chunks/api-d8rk8yaw.js +20 -0
  31. package/dist/chunks/api-djs9m6v0.js +42 -0
  32. package/dist/chunks/api-e2746nhp.js +17 -0
  33. package/dist/chunks/api-e4v11dgy.js +58 -0
  34. package/dist/chunks/api-e6e4kz0w.js +23 -0
  35. package/dist/chunks/api-f6955nmc.js +19 -0
  36. package/dist/chunks/api-fhp54bwg.js +39 -0
  37. package/dist/chunks/api-fpzegjvk.js +35 -0
  38. package/dist/chunks/api-fq7f3wrn.js +13 -0
  39. package/dist/chunks/api-gg2tbqc5.js +270 -0
  40. package/dist/chunks/api-gghkbyq2.js +189 -0
  41. package/dist/chunks/api-ghyd9ren.js +32 -0
  42. package/dist/chunks/api-h8v4dbra.js +49 -0
  43. package/dist/chunks/api-hpgyxnbj.js +92 -0
  44. package/dist/chunks/api-jb6q2eqf.js +70 -0
  45. package/dist/chunks/api-k0fc7y6c.js +219 -0
  46. package/dist/chunks/api-kb0k6qg1.js +35 -0
  47. package/dist/chunks/api-kb431qm0.js +31 -0
  48. package/dist/chunks/api-kvefct3s.js +215 -0
  49. package/dist/chunks/api-mzafcgd5.js +23 -0
  50. package/dist/chunks/api-n0gqhwq7.js +109 -0
  51. package/dist/chunks/api-njzqh2v3.js +22 -0
  52. package/dist/chunks/api-nqw28mmv.js +62 -0
  53. package/dist/chunks/api-ns3kfwpq.js +48 -0
  54. package/dist/chunks/api-ph6j0w88.js +29 -0
  55. package/dist/chunks/api-q8azxbmk.js +38 -0
  56. package/dist/chunks/api-qft4mah5.js +33 -0
  57. package/dist/chunks/api-qz4nw4cc.js +130 -0
  58. package/dist/chunks/api-rrsy7az3.js +69 -0
  59. package/dist/chunks/api-t2s5ghf4.js +91 -0
  60. package/dist/chunks/api-t32e1bbt.js +32 -0
  61. package/dist/chunks/api-t7f8xf56.js +22 -0
  62. package/dist/chunks/api-trzj52xd.js +13 -0
  63. package/dist/chunks/api-v2h85c6p.js +143 -0
  64. package/dist/chunks/api-vtj5wyks.js +13 -0
  65. package/dist/chunks/api-wrj46kzw.js +41 -0
  66. package/dist/chunks/api-wrma0ern.js +36 -0
  67. package/dist/chunks/api-x180v472.js +22 -0
  68. package/dist/chunks/api-xcn5yyhy.js +134 -0
  69. package/dist/chunks/api-xthc02cw.js +6 -0
  70. package/dist/chunks/api-ygxfyj7m.js +111 -0
  71. package/dist/chunks/api-z3ybfekq.js +20 -0
  72. package/dist/chunks/api-zvb9sh2w.js +30 -0
  73. package/dist/content-headers.d.ts +13 -0
  74. package/dist/content-headers.js +12 -0
  75. package/dist/cors.d.ts +7 -0
  76. package/dist/cors.js +10 -0
  77. package/dist/event-feed.d.ts +44 -0
  78. package/dist/event-feed.js +20 -0
  79. package/dist/fetch.d.ts +164 -0
  80. package/dist/fetch.js +80 -0
  81. package/dist/handlers/agent.d.ts +1 -0
  82. package/dist/handlers/agent.js +11 -0
  83. package/dist/handlers/artifact.d.ts +62 -0
  84. package/dist/handlers/artifact.js +8 -0
  85. package/dist/handlers/automation.d.ts +23 -0
  86. package/dist/handlers/automation.js +7 -0
  87. package/dist/handlers/blob.d.ts +168 -0
  88. package/dist/handlers/blob.js +9 -0
  89. package/dist/handlers/command.d.ts +1 -0
  90. package/dist/handlers/command.js +11 -0
  91. package/dist/handlers/config.d.ts +1 -0
  92. package/dist/handlers/config.js +11 -0
  93. package/dist/handlers/credential.d.ts +4 -0
  94. package/dist/handlers/credential.js +12 -0
  95. package/dist/handlers/debug.d.ts +2 -0
  96. package/dist/handlers/debug.js +11 -0
  97. package/dist/handlers/event.d.ts +2 -0
  98. package/dist/handlers/event.js +12 -0
  99. package/dist/handlers/experimental/browser-tunnel.d.ts +11 -0
  100. package/dist/handlers/experimental/browser-tunnel.js +9 -0
  101. package/dist/handlers/flag.d.ts +1 -0
  102. package/dist/handlers/flag.js +11 -0
  103. package/dist/handlers/form.d.ts +1 -0
  104. package/dist/handlers/form.js +11 -0
  105. package/dist/handlers/fs.d.ts +2 -0
  106. package/dist/handlers/fs.js +13 -0
  107. package/dist/handlers/generate.d.ts +4 -0
  108. package/dist/handlers/generate.js +11 -0
  109. package/dist/handlers/integration.d.ts +7 -0
  110. package/dist/handlers/integration.js +13 -0
  111. package/dist/handlers/job.d.ts +73 -0
  112. package/dist/handlers/job.js +7 -0
  113. package/dist/handlers/location.d.ts +2 -0
  114. package/dist/handlers/location.js +11 -0
  115. package/dist/handlers/machine.d.ts +164 -0
  116. package/dist/handlers/machine.js +28 -0
  117. package/dist/handlers/mcp.d.ts +3 -0
  118. package/dist/handlers/mcp.js +13 -0
  119. package/dist/handlers/media.d.ts +6 -0
  120. package/dist/handlers/media.js +7 -0
  121. package/dist/handlers/message.d.ts +2 -0
  122. package/dist/handlers/message.js +12 -0
  123. package/dist/handlers/migration.d.ts +1 -0
  124. package/dist/handlers/migration.js +11 -0
  125. package/dist/handlers/model.d.ts +1 -0
  126. package/dist/handlers/model.js +11 -0
  127. package/dist/handlers/permission.d.ts +4 -0
  128. package/dist/handlers/permission.js +11 -0
  129. package/dist/handlers/persistent-pty.d.ts +3 -0
  130. package/dist/handlers/persistent-pty.js +25 -0
  131. package/dist/handlers/plugin.d.ts +2 -0
  132. package/dist/handlers/plugin.js +11 -0
  133. package/dist/handlers/project.d.ts +2 -0
  134. package/dist/handlers/project.js +11 -0
  135. package/dist/handlers/provider.d.ts +1 -0
  136. package/dist/handlers/provider.js +11 -0
  137. package/dist/handlers/pty-socket.d.ts +12 -0
  138. package/dist/handlers/pty-socket.js +8 -0
  139. package/dist/handlers/pty.d.ts +3 -0
  140. package/dist/handlers/pty.js +13 -0
  141. package/dist/handlers/push.d.ts +28 -0
  142. package/dist/handlers/push.js +6 -0
  143. package/dist/handlers/reference.d.ts +1 -0
  144. package/dist/handlers/reference.js +11 -0
  145. package/dist/handlers/rpc.d.ts +1 -0
  146. package/dist/handlers/rpc.js +11 -0
  147. package/dist/handlers/server.d.ts +4 -0
  148. package/dist/handlers/server.js +14 -0
  149. package/dist/handlers/session-error.d.ts +11 -0
  150. package/dist/handlers/session-error.js +14 -0
  151. package/dist/handlers/session.d.ts +5 -0
  152. package/dist/handlers/session.js +12 -0
  153. package/dist/handlers/shell.d.ts +1 -0
  154. package/dist/handlers/shell.js +11 -0
  155. package/dist/handlers/skill.d.ts +1 -0
  156. package/dist/handlers/skill.js +11 -0
  157. package/dist/handlers/space.d.ts +54 -0
  158. package/dist/handlers/space.js +7 -0
  159. package/dist/handlers/usage.d.ts +1 -0
  160. package/dist/handlers/usage.js +11 -0
  161. package/dist/handlers/vcs.d.ts +4 -0
  162. package/dist/handlers/vcs.js +11 -0
  163. package/dist/handlers/voice.d.ts +3 -0
  164. package/dist/handlers/voice.js +11 -0
  165. package/dist/handlers/websearch.d.ts +1 -0
  166. package/dist/handlers/websearch.js +11 -0
  167. package/dist/handlers/worktree.d.ts +2 -0
  168. package/dist/handlers/worktree.js +11 -0
  169. package/dist/handlers.d.ts +3 -0
  170. package/dist/handlers.js +63 -0
  171. package/dist/location.d.ts +28 -0
  172. package/dist/location.js +17 -0
  173. package/dist/media-uri.d.ts +6 -0
  174. package/dist/media-uri.js +6 -0
  175. package/dist/middleware/authorization.d.ts +8 -0
  176. package/dist/middleware/authorization.js +13 -0
  177. package/dist/middleware/defect-response.d.ts +2 -0
  178. package/dist/middleware/defect-response.js +6 -0
  179. package/dist/middleware/form-location.d.ts +18 -0
  180. package/dist/middleware/form-location.js +10 -0
  181. package/dist/middleware/schema-error.d.ts +3 -0
  182. package/dist/middleware/schema-error.js +8 -0
  183. package/dist/middleware/session-location.d.ts +17 -0
  184. package/dist/middleware/session-location.js +10 -0
  185. package/dist/options.d.ts +130 -0
  186. package/dist/options.js +55 -0
  187. package/dist/pairing.d.ts +13 -0
  188. package/dist/pairing.js +10 -0
  189. package/dist/process.d.ts +70 -0
  190. package/dist/process.js +241 -0
  191. package/dist/range.d.ts +6 -0
  192. package/dist/range.js +8 -0
  193. package/dist/request-site.d.ts +11 -0
  194. package/dist/request-site.js +11 -0
  195. package/dist/request-tracing.d.ts +1 -0
  196. package/dist/request-tracing.js +6 -0
  197. package/dist/routes.d.ts +54 -0
  198. package/dist/routes.js +69 -0
  199. package/dist/server-info.d.ts +14 -0
  200. package/dist/server-info.js +12 -0
  201. package/dist/service-status.d.ts +25 -0
  202. package/dist/service-status.js +8 -0
  203. package/dist/space-store.d.ts +62 -0
  204. package/dist/space-store.js +16 -0
  205. package/dist/workerd-machine-link.d.ts +107 -0
  206. package/dist/workerd-machine-link.js +19 -0
  207. package/dist/workerd.d.ts +113 -0
  208. package/dist/workerd.js +168 -0
  209. package/package.json +50 -4
  210. package/README.md +0 -3
@@ -0,0 +1,54 @@
1
+ import { Database } from "@radheim/core/database/database";
2
+ import { App } from "@radheim/core/app";
3
+ import { CodeModeApi } from "@radheim/core/codemode/api";
4
+ import { LayerNode } from "@radheim/util/effect/layer-node";
5
+ import { Node } from "@radheim/util/effect/app-node";
6
+ import { Bus } from "@radheim/core/bus";
7
+ import { Credential } from "@radheim/core/credential";
8
+ import { PermissionSaved } from "@radheim/core/permission/saved";
9
+ import { BrowserTunnelGateway } from "@radheim/core/experimental/browser-tunnel";
10
+ import { PtyTicket } from "@radheim/core/pty/ticket";
11
+ import { PersistentPty } from "@radheim/core/persistent-pty";
12
+ import { Project } from "@radheim/core/project";
13
+ import { BlobStore } from "@radheim/core/blob-store";
14
+ import { VideoGeneration } from "@radheim/core/video-generation";
15
+ import { Worktree } from "@radheim/core/worktree";
16
+ import { Session } from "@radheim/core/session";
17
+ import { Instance } from "@radheim/core/instance/service";
18
+ import { SessionTransfer } from "@radheim/core/session/transfer";
19
+ import { InstructionEntry } from "@radheim/core/session/instruction-entry";
20
+ import { Shell } from "@radheim/core/shell";
21
+ import { Job } from "@radheim/core/job";
22
+ import { KV } from "@radheim/core/kv";
23
+ import { Global } from "@radheim/util/global";
24
+ import { FSUtil } from "@radheim/util/fs-util";
25
+ import { LocationServiceMap } from "@radheim/core/location-service-map";
26
+ import { LocationActivity } from "@radheim/core/location-activity";
27
+ import { Identity } from "@radheim/core/machine/identity";
28
+ import { Machines } from "@radheim/core/machine/machines";
29
+ import { SessionSearchBuild } from "@radheim/core/session/search-build";
30
+ import { SessionRestart } from "@radheim/core/session/execution/restart";
31
+ import { Automation } from "@radheim/core/automation";
32
+ import { PluginUpdate } from "@radheim/core/plugin/update";
33
+ import { SdkPlugins } from "@radheim/core/plugin/sdk";
34
+ import { WellKnown } from "@radheim/core/wellknown";
35
+ import { PushList } from "@radheim/core/push/list";
36
+ import { PushSender } from "@radheim/core/push/sender";
37
+ import { Workspace } from "@radheim/core/workspace";
38
+ import { FileWatch } from "@radheim/core/filesystem/file-watch";
39
+ import { HttpRouter } from "effect/http";
40
+ import { Layer } from "effect";
41
+ import { SpaceStore } from "./space-store";
42
+ import { MachinesFlag } from "./handlers/machine";
43
+ import { ServerPairing } from "./pairing";
44
+ import type { EmbeddedRoutesOptions, ServerOptions } from "./options";
45
+ export declare function createRoutes(options?: ServerOptions, serviceURLs?: () => ReadonlyArray<string>, overrides?: LayerNode.Replacements): Layer.Layer<Shell.Daemon | import("effect/http/HttpClient").HttpClient | HttpRouter.HttpRouter | FSUtil.Service | Global.Service | Database.Service | App.Service | Credential.Service | KV.Service | WellKnown.Service | InstructionEntry.Service | Job.Service | Identity.Service | Machines.Service | Workspace.Service | CodeModeApi.Service | PermissionSaved.Service | LocationServiceMap.Service | PersistentPty.Service | Session.Service | Automation.Service | PushList.Service | PushSender.Service | Worktree.Service | BlobStore.Service | SessionSearchBuild.Service | VideoGeneration.Service | BrowserTunnelGateway.Service | SdkPlugins.Service | PluginUpdate.Service | Instance.Service | Bus.Service | Project.Service | SessionRestart.Service | PtyTicket.Service | SessionTransfer.Service | LocationActivity.Service | FileWatch.Service | SpaceStore.Service | ServerPairing.Service | MachinesFlag.Service, Error | PersistentPty.UnavailableError, import("effect/FileSystem").FileSystem | import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/Path").Path>;
46
+ type InstanceNode = LayerNode.Provider<Instance.Service, never, typeof Node.tags.values.global>;
47
+ /**
48
+ * The routes without a listener: no Basic auth, so the embedder owns access control. A per-Session `Instance`
49
+ * provider goes in `overrides` as `Instance.node.replace(...)`.
50
+ */
51
+ export declare function createEmbeddedRoutes(options?: EmbeddedRoutesOptions, overrides?: LayerNode.Replacements,
52
+ /** @deprecated Pass `Instance.node.replace(instances)` first in `overrides`. Removed in the next minor. */
53
+ instances?: InstanceNode): Layer.Layer<Shell.Daemon | import("effect/http/HttpClient").HttpClient | HttpRouter.HttpRouter | FSUtil.Service | Global.Service | Database.Service | App.Service | Credential.Service | KV.Service | WellKnown.Service | InstructionEntry.Service | Job.Service | Identity.Service | Machines.Service | Workspace.Service | CodeModeApi.Service | PermissionSaved.Service | LocationServiceMap.Service | PersistentPty.Service | Session.Service | Automation.Service | PushList.Service | PushSender.Service | Worktree.Service | BlobStore.Service | SessionSearchBuild.Service | VideoGeneration.Service | BrowserTunnelGateway.Service | SdkPlugins.Service | PluginUpdate.Service | Instance.Service | Bus.Service | Project.Service | SessionRestart.Service | PtyTicket.Service | SessionTransfer.Service | LocationActivity.Service | FileWatch.Service | SpaceStore.Service | ServerPairing.Service | MachinesFlag.Service, Error | PersistentPty.UnavailableError, import("effect/FileSystem").FileSystem | import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/Path").Path>;
54
+ export {};
package/dist/routes.js ADDED
@@ -0,0 +1,69 @@
1
+ import {
2
+ createRoutes2,
3
+ createEmbeddedRoutes2
4
+ } from "./chunks/api-kvefct3s.js";
5
+ import"./chunks/api-qft4mah5.js";
6
+ import"./chunks/api-bxwfazps.js";
7
+ import"./chunks/api-bctzdhd7.js";
8
+ import"./chunks/api-ygxfyj7m.js";
9
+ import"./chunks/api-z3ybfekq.js";
10
+ import"./chunks/api-31hzmefh.js";
11
+ import"./chunks/api-kb431qm0.js";
12
+ import"./chunks/api-fhp54bwg.js";
13
+ import"./chunks/api-djs9m6v0.js";
14
+ import"./chunks/api-fq7f3wrn.js";
15
+ import"./chunks/api-d8rk8yaw.js";
16
+ import"./chunks/api-1mn3274c.js";
17
+ import"./chunks/api-5ggmn0t6.js";
18
+ import"./chunks/api-kb0k6qg1.js";
19
+ import"./chunks/api-b3j0kcev.js";
20
+ import"./chunks/api-hpgyxnbj.js";
21
+ import"./chunks/api-34msk99p.js";
22
+ import"./chunks/api-gghkbyq2.js";
23
+ import"./chunks/api-h8v4dbra.js";
24
+ import"./chunks/api-jb6q2eqf.js";
25
+ import"./chunks/api-8cw69z4p.js";
26
+ import"./chunks/api-ph6j0w88.js";
27
+ import"./chunks/api-qz4nw4cc.js";
28
+ import"./chunks/api-e4v11dgy.js";
29
+ import"./chunks/api-1jnx79t4.js";
30
+ import"./chunks/api-njzqh2v3.js";
31
+ import"./chunks/api-n0gqhwq7.js";
32
+ import"./chunks/api-zvb9sh2w.js";
33
+ import"./chunks/api-ns3kfwpq.js";
34
+ import"./chunks/api-rrsy7az3.js";
35
+ import"./chunks/api-vtj5wyks.js";
36
+ import"./chunks/api-t7f8xf56.js";
37
+ import"./chunks/api-nqw28mmv.js";
38
+ import"./chunks/api-q8azxbmk.js";
39
+ import"./chunks/api-wrma0ern.js";
40
+ import"./chunks/api-40z6h0fq.js";
41
+ import"./chunks/api-e2746nhp.js";
42
+ import"./chunks/api-xcn5yyhy.js";
43
+ import"./chunks/api-t2s5ghf4.js";
44
+ import"./chunks/api-280h8k1v.js";
45
+ import"./chunks/api-mzafcgd5.js";
46
+ import"./chunks/api-v2h85c6p.js";
47
+ import"./chunks/api-9bxtygz0.js";
48
+ import"./chunks/api-d4cyxj7e.js";
49
+ import"./chunks/api-trzj52xd.js";
50
+ import"./chunks/api-x180v472.js";
51
+ import"./chunks/api-wrj46kzw.js";
52
+ import"./chunks/api-k0fc7y6c.js";
53
+ import"./chunks/api-238wcyzf.js";
54
+ import"./chunks/api-xthc02cw.js";
55
+ import"./chunks/api-fpzegjvk.js";
56
+ import"./chunks/api-8sb6qqpn.js";
57
+ import"./chunks/api-f6955nmc.js";
58
+ import"./chunks/api-5fr63cjn.js";
59
+ import"./chunks/api-bnpt5zxx.js";
60
+ import"./chunks/api-9qr3r2v1.js";
61
+ import"./chunks/api-t32e1bbt.js";
62
+ import"./chunks/api-11hx8jza.js";
63
+ import"./chunks/api-7tqjsq7b.js";
64
+ import"./chunks/api-0q8mvh3b.js";
65
+ import"./chunks/api-ghyd9ren.js";
66
+ export {
67
+ createEmbeddedRoutes2 as createEmbeddedRoutes,
68
+ createRoutes2 as createRoutes
69
+ };
@@ -0,0 +1,14 @@
1
+ import { Context, Layer } from "effect";
2
+ import type { ServerOptions } from "./options";
3
+ declare const Service_base: Context.ServiceClass<Service, "@radheim/server/ServerInfo", {
4
+ readonly urls: () => ReadonlyArray<string>;
5
+ readonly app: NonNullable<ServerOptions["app"]>;
6
+ readonly paths: {
7
+ readonly tmp: string;
8
+ };
9
+ }>;
10
+ export declare class Service extends Service_base {
11
+ }
12
+ export declare function layer(urls: () => ReadonlyArray<string>, tmp: string, app?: ServerOptions["app"]): Layer.Layer<Service, never, never>;
13
+ export declare function connectionURLs(value: string, requestedHostname?: string): string[];
14
+ export * as ServerInfo from "./server-info";
@@ -0,0 +1,12 @@
1
+ import {
2
+ Service2,
3
+ layer2,
4
+ connectionURLs2,
5
+ exports_server_info
6
+ } from "./chunks/api-wrj46kzw.js";
7
+ export {
8
+ exports_server_info as ServerInfo,
9
+ Service2 as Service,
10
+ connectionURLs2 as connectionURLs,
11
+ layer2 as layer
12
+ };
@@ -0,0 +1,25 @@
1
+ export * as Status from "./service-status";
2
+ import { Effect } from "effect";
3
+ export type State = {
4
+ readonly type: "starting";
5
+ } | {
6
+ readonly type: "ready";
7
+ } | {
8
+ readonly type: "stopping";
9
+ } | {
10
+ readonly type: "failed";
11
+ };
12
+ export interface Interface {
13
+ readonly current: Effect.Effect<State>;
14
+ readonly ready: Effect.Effect<void>;
15
+ readonly fail: Effect.Effect<void>;
16
+ readonly beginStopping: Effect.Effect<void>;
17
+ }
18
+ export declare const make: (options?: {
19
+ readonly initial?: State;
20
+ } | undefined) => Effect.Effect<{
21
+ current: Effect.Effect<State, never, never>;
22
+ ready: Effect.Effect<void, never, never>;
23
+ fail: Effect.Effect<void, never, never>;
24
+ beginStopping: Effect.Effect<void, never, never>;
25
+ }, never, never>;
@@ -0,0 +1,8 @@
1
+ import {
2
+ make3,
3
+ exports_service_status
4
+ } from "./chunks/api-e6e4kz0w.js";
5
+ export {
6
+ exports_service_status as Status,
7
+ make3 as make
8
+ };
@@ -0,0 +1,62 @@
1
+ export * as SpaceStore from "./space-store";
2
+ import { Space } from "@radheim/schema/space";
3
+ import { Context, Effect, Scope } from "effect";
4
+ /** Rows one sync, or one subscribe's catch-up, reads at most across all its spaces. */
5
+ export declare const BatchSize = 500;
6
+ /** Tombstone-creating deletes in a space between two checks of its tombstones against `SpaceRows.TombstoneLimit`. */
7
+ export declare const PurgeInterval = 64;
8
+ export type Change = typeof Space.Event.Updated.Type | typeof Space.Event.Deleted.Type;
9
+ export type Listener = (change: Change) => Effect.Effect<void>;
10
+ type Send = (event: typeof Space.Event.Resync.Type | Change) => Effect.Effect<void>;
11
+ export interface Interface {
12
+ /**
13
+ * Commits the changes in one transaction, as `SpaceRows.write` applies them, then sends each one that changed a row
14
+ * in revision order. Returns each space's head after them, with its cursor, in the order the spaces first appear.
15
+ */
16
+ readonly write: (changes: ReadonlyArray<Space.Change>) => Effect.Effect<ReadonlyArray<{
17
+ readonly space: Space.Name;
18
+ readonly revision: Space.Revision;
19
+ readonly cursor: string;
20
+ }>>;
21
+ /** This database's epoch, created once and kept, so revisions from another server or database are never used. */
22
+ readonly epoch: string;
23
+ /** Replaces the epoch: every client's next sync starts from a snapshot, e.g. after a database restore. */
24
+ readonly resetEpoch: Effect.Effect<void>;
25
+ /**
26
+ * One page per space after its cursor, in order, of `BatchSize` rows in total: a delta when this database issued the
27
+ * cursor and still holds every deletion after it, else a snapshot; `next` continues it. Once the rows are used up,
28
+ * the remaining spaces are not read and get no page.
29
+ */
30
+ readonly sync: (spaces: ReadonlyArray<{
31
+ readonly space: Space.Name;
32
+ readonly cursor?: string;
33
+ }>) => Effect.Effect<ReadonlyArray<Space.Page>>;
34
+ /** Lets `subscribe` address an event stream by its ID while `send` reaches it, until the scope closes. */
35
+ readonly attach: (stream: string, send: Send) => Effect.Effect<void, never, Scope.Scope>;
36
+ /**
37
+ * Sends each space's changes since its cursor to the stream as single updated and deleted events, then its live
38
+ * changes, none missed or repeated. The spaces' catch-ups read `BatchSize` rows in total, in order: a space whose
39
+ * changes do not fit what is left, every space after the rows are used up, and one with an unusable cursor get
40
+ * `resync` instead. Replaces earlier subscriptions of those spaces on the stream; false when no such stream is
41
+ * attached.
42
+ */
43
+ readonly subscribe: (stream: string, spaces: ReadonlyArray<{
44
+ readonly space: Space.Name;
45
+ readonly cursor: string;
46
+ }>) => Effect.Effect<boolean>;
47
+ /** Stops sending those spaces to the stream, also mid catch-up; false when no such stream is attached. */
48
+ readonly unsubscribe: (stream: string, spaces: ReadonlyArray<Space.Name>) => Effect.Effect<boolean>;
49
+ /**
50
+ * Runs `listener` with every change before its write returns and before subscribed streams get it, in revision
51
+ * order within a space. Changes never go through the bus, so plugins do not see them.
52
+ */
53
+ readonly listen: (listener: Listener) => Effect.Effect<Effect.Effect<void>>;
54
+ }
55
+ declare const Service_base: Context.ServiceClass<Service, "@radheim/server/SpaceStore", Interface>;
56
+ export declare class Service extends Service_base {
57
+ }
58
+ export declare const node: import("@radheim/util/effect/layer-node").Provider<Service, never, import("@radheim/util/effect/layer-node").Tag<"global">, true>;
59
+ /** Attaches every event stream to the store, so `subscribe` can send space changes to it. */
60
+ export declare const extension: Effect.Effect<{
61
+ open: (stream: string, send: (event: import("@radheim/protocol/groups/event").RadheEvent) => Effect.Effect<void>) => Effect.Effect<void, never, Scope.Scope>;
62
+ }, never, Service>;
@@ -0,0 +1,16 @@
1
+ import {
2
+ BatchSize2,
3
+ PurgeInterval2,
4
+ Service3,
5
+ node2,
6
+ extension2,
7
+ exports_space_store
8
+ } from "./chunks/api-k0fc7y6c.js";
9
+ export {
10
+ BatchSize2 as BatchSize,
11
+ PurgeInterval2 as PurgeInterval,
12
+ Service3 as Service,
13
+ exports_space_store as SpaceStore,
14
+ extension2 as extension,
15
+ node2 as node
16
+ };
@@ -0,0 +1,107 @@
1
+ export * as WorkerdMachineLink from "./workerd-machine-link";
2
+ import type { Identity } from "@radheim/core/machine/identity";
3
+ import { Link } from "@radheim/core/machine/link";
4
+ import { Machines } from "@radheim/core/machine/machines";
5
+ import { Effect } from "effect";
6
+ import type { CorsOptions } from "./cors";
7
+ /** The Durable Object WebSocket tag every hibernatable machine link is accepted with. */
8
+ export declare const TAG = "opencode-machine-link";
9
+ /** What every carrier uses of the server half of a workerd `WebSocketPair`. */
10
+ export interface Sender {
11
+ readonly readyState: number;
12
+ send(message: Uint8Array): void;
13
+ close(code: number): void;
14
+ }
15
+ /** The server half once `accept()`ed: workerd hands its messages to its listeners. */
16
+ export interface Socket extends Sender {
17
+ binaryType: string;
18
+ addEventListener(type: "message", listener: (event: {
19
+ readonly data: unknown;
20
+ }) => void): void;
21
+ addEventListener(type: "close" | "error", listener: () => void): void;
22
+ }
23
+ /**
24
+ * The server half once a Durable Object's `ctx.acceptWebSocket` took it: workerd hands its messages to the Durable
25
+ * Object's `webSocketMessage`, `webSocketClose` and `webSocketError`, and keeps its attachment while the object
26
+ * hibernates.
27
+ */
28
+ export interface HibernatableSocket extends Sender {
29
+ serializeAttachment(value: unknown): void;
30
+ deserializeAttachment(): unknown;
31
+ }
32
+ export interface PairSocket extends Socket, HibernatableSocket {
33
+ accept(): void;
34
+ }
35
+ /**
36
+ * What hibernation uses of a Durable Object's `ctx` (`DurableObjectState`). With it, a machine link is accepted with
37
+ * `ctx.acceptWebSocket`, so an idle link no longer keeps the object awake, and a wake carries on every link that was
38
+ * past its hello, with no reconnect and nothing on the wire.
39
+ */
40
+ export interface State {
41
+ acceptWebSocket(socket: HibernatableSocket, tags?: string[]): void;
42
+ getWebSockets(tag?: string): HibernatableSocket[];
43
+ }
44
+ export interface Options extends CorsOptions {
45
+ /** At most one live `make` per `state`: see `claimed`. */
46
+ readonly state?: State;
47
+ }
48
+ /**
49
+ * The Durable Object's WebSocket methods, which the object forwards to: with `State`, a machine link's messages arrive
50
+ * only here. A socket no link holds is closed with 1008.
51
+ */
52
+ export interface Hibernation {
53
+ readonly webSocketMessage: (socket: HibernatableSocket, message: ArrayBuffer | string) => void;
54
+ readonly webSocketClose: (socket: HibernatableSocket, code: number, reason: string, wasClean: boolean) => void;
55
+ readonly webSocketError: (socket: HibernatableSocket, error: unknown) => void;
56
+ }
57
+ export type PairConstructor = new () => {
58
+ readonly 0: PairSocket;
59
+ readonly 1: PairSocket;
60
+ };
61
+ /**
62
+ * `machine.link` on workerd, where a request becomes a WebSocket only by being answered with a 101 response that holds
63
+ * the client half of a `WebSocketPair`. Effect's web handler would rebuild that response without it, so the Durable
64
+ * Object's handler asks this before the routes, without running anything: a GET upgrade to exactly the link's path gets
65
+ * the effect that answers it, and anything else `undefined`, for the routes to answer as they do on Node. Cross-site
66
+ * browser upgrades from origins `options.cors` does not allow also return `undefined` so `RequestSite.middleware`
67
+ * answers them with 403, matching Node. As on
68
+ * Node, the upgrade takes no password, since the socket carries nothing until the link's handshake has proved a paired
69
+ * key or a valid join secret, and with machines off it gets the 404 of an unknown route.
70
+ *
71
+ * A place is taken before the upgrade and held until the handshake ends; with none free (or once the server's scope has
72
+ * closed) the request is answered 503, as on Node. The request is over once its 101 is returned, so each connection is
73
+ * served on a fiber of the caller's scope, and closing that scope closes every link.
74
+ *
75
+ * Unlike `ws`, workerd's socket can neither ping nor say what waits unsent, so a link here has no idle limit and no limit
76
+ * on what waits behind a slow peer: a peer that is gone is noticed when workerd closes its socket.
77
+ */
78
+ export declare const make: (options?: Options, fixed?: Link.Fixed) => Effect.Effect<((request: Request, pair?: PairConstructor) => Effect.Effect<Response, never, never> | undefined) & Hibernation & {
79
+ /** Whether a link with work in flight is holding the object awake. */
80
+ keepingAwake: () => boolean;
81
+ }, never, import("effect/Scope").Scope | import("@radheim/util/global").Service | Identity.Service | Machines.Service | import("@radheim/core/location-service-map").Service>;
82
+ /**
83
+ * Serves one accepted socket in a scope of its own: the handshake, then `release` however it ends, then the machine it
84
+ * proved until the link ends. Every end, a refused handshake and a removed machine among them, closes the scope and with
85
+ * it the socket, the same quiet way.
86
+ */
87
+ export declare const serve: (socket: Socket, release: Effect.Effect<unknown>, fixed?: Link.Fixed) => Effect.Effect<void, never, Identity.Service | Machines.Service>;
88
+ /**
89
+ * An accepted workerd socket as the link's carrier, for the scope: closing the scope closes the socket with `CLOSE`.
90
+ * Binary messages are handed over in order. The carrier ends and closes the socket when the peer closes it or it fails,
91
+ * and on what no link sends: a text message, one too short to be a frame or, with 1009 as `ws` gives, too long to be
92
+ * one, and more than `MAX_WAITING` unread. Messages that came before the end are still handed over, as they are on Node.
93
+ */
94
+ export declare const carrier: (socket: Socket) => Effect.Effect<{
95
+ describe: () => {
96
+ type: "websocket";
97
+ };
98
+ send: (bytes: Uint8Array<ArrayBufferLike>) => Effect.Effect<void, never, never>;
99
+ receive: Effect.Effect<Uint8Array<ArrayBufferLike>, Link.Closed, never>;
100
+ }, never, import("effect/Scope").Scope>;
101
+ /**
102
+ * A same-site GET with `Upgrade: websocket` to the path the router matches. `Upgrade` alone, as Cloudflare's examples
103
+ * check: `Connection` is hop-by-hop, and a Worker forwarding the request to its Durable Object need not keep it.
104
+ * Cross-site browser upgrades from origins `options.cors` does not allow return `false` so the router's `RequestSite`
105
+ * middleware rejects them with 403.
106
+ */
107
+ export declare const isUpgrade: (request: Request, options?: CorsOptions) => boolean;
@@ -0,0 +1,19 @@
1
+ import {
2
+ TAG2,
3
+ make2,
4
+ serve2,
5
+ carrier2,
6
+ isUpgrade2,
7
+ exports_workerd_machine_link
8
+ } from "./chunks/api-gg2tbqc5.js";
9
+ import"./chunks/api-8tn84h85.js";
10
+ import"./chunks/api-238wcyzf.js";
11
+ import"./chunks/api-11hx8jza.js";
12
+ export {
13
+ TAG2 as TAG,
14
+ exports_workerd_machine_link as WorkerdMachineLink,
15
+ carrier2 as carrier,
16
+ isUpgrade2 as isUpgrade,
17
+ make2 as make,
18
+ serve2 as serve
19
+ };
@@ -0,0 +1,113 @@
1
+ export * as ServerWorkerd from "./workerd";
2
+ import { Context, Effect } from "effect";
3
+ import type { Layer } from "effect";
4
+ import { BlobStore } from "@radheim/core/blob-store";
5
+ import { Database } from "@radheim/core/database/database";
6
+ import type { DurableObjectStorage } from "@radheim/core/database/sqlite.workerd";
7
+ import { Image } from "@radheim/core/image";
8
+ import { Identity } from "@radheim/core/machine/identity";
9
+ import { VideoGeneration } from "@radheim/core/video-generation";
10
+ import { Workspace } from "@radheim/core/workspace";
11
+ import type { LayerNode } from "@radheim/util/effect/layer-node";
12
+ import { MachinesFlag } from "./handlers/machine";
13
+ import type { ServerOptions } from "./options";
14
+ import { WorkerdMachineLink } from "./workerd-machine-link";
15
+ /**
16
+ * The workerd runtime profile: boots opencode core and server inside a
17
+ * Cloudflare Durable Object, with every intentionally-local service replaced
18
+ * or disabled.
19
+ *
20
+ * - Database runs on the injected `DurableObjectStorage` SQLite.
21
+ * - `Workspace` is configured with `keepWarm: 0`, `pollInterval: null`, and
22
+ * `storage.setAlarm` scheduling so the Durable Object can hibernate at zero
23
+ * idle cost. Callers forward the Durable Object's `alarm()` method to
24
+ * `handler.alarm()` (or `opencode.alarm()` via `@radheim/sdk/workerd`).
25
+ * - Watcher is disabled through its option flag; pty, fff, and photon native
26
+ * modules resolve to inert stubs under the `workerd` bundle condition (pass
27
+ * `options.image` to supply a host image resizer).
28
+ * - Bare locations use a typed no-execution-plane process spawner; FileSystem,
29
+ * FileSystemSearch, Snapshot, Vcs, Worktree, and Pty route or gate through
30
+ * Environment and EnvironmentHost (working on attached remote workspaces
31
+ * where supported and degrading or failing cleanly on bare locations). Npm
32
+ * fails package installs with a typed unsupported error.
33
+ * - Blob storage and video generation report themselves unsupported: blobs are files on a local disk.
34
+ * - Config is injected as a string (no filesystem); plugin discovery is
35
+ * precompiled-only, and stdio MCP reports the same no-plane failure as Shell.
36
+ * - With the `machines` flag on, workers dial in to `machine.link` as on Node,
37
+ * upgraded through a `WebSocketPair` (see `WorkerdMachineLink`). Given the
38
+ * Durable Object's `state`, links use WebSocket Hibernation: an idle link
39
+ * leaves the object free to hibernate, and a wake carries it on unchanged.
40
+ *
41
+ * Bundle with the `workerd` condition, e.g.
42
+ * `bun build src/workerd.ts --conditions=workerd --target=node`
43
+ * (see `script/workerd-probe.ts`).
44
+ */
45
+ export type ImageLimits = Image.Limits;
46
+ export type ImageResizerInput = Image.ResizerInput;
47
+ export type ImageResizerOutput = Image.ResizerOutput;
48
+ export type ImageResizer = Image.Resizer;
49
+ export interface Options {
50
+ /** Durable Object storage whose SQLite database backs the opencode database. */
51
+ readonly storage: DurableObjectStorage;
52
+ /**
53
+ * The Durable Object's `ctx`, to accept machine links with WebSocket Hibernation. Forward the object's
54
+ * `webSocketMessage`, `webSocketClose` and `webSocketError` to the handler's methods of the same name. Omit it and
55
+ * links are `accept()`ed, keeping the object awake while any is open.
56
+ *
57
+ * Build at most one live handler per `ctx`, for example once inside `ctx.blockConcurrencyWhile` in the Durable
58
+ * Object's constructor: a second leaves the links the first holds alone, and receives none of their messages.
59
+ */
60
+ readonly state?: WorkerdMachineLink.State;
61
+ readonly app?: ServerOptions["app"];
62
+ /** Enforces HTTP Basic auth (user `opencode`) on every route but the machine link; omit to serve unauthenticated. */
63
+ readonly password?: string;
64
+ /** Extra browser origins allowed to call the API across sites, on top of localhost and opencode.ai. */
65
+ readonly cors?: ServerOptions["cors"];
66
+ /** Inline opencode config content (JSON), same as `ServerOptions.config.content`. */
67
+ readonly config?: {
68
+ readonly content?: string;
69
+ };
70
+ /** models.dev catalog options. Fetching is off by default, so a wake serves the bundled snapshot with no network. */
71
+ readonly models?: ServerOptions["models"];
72
+ /** Replaces `globalThis.fetch` for OpenCode's own HTTP requests, e.g. to route them through a Service Binding. */
73
+ readonly fetch?: ServerOptions["fetch"];
74
+ /**
75
+ * Host-supplied image resizer for runtimes without the bundled Photon WASM
76
+ * module, e.g. backed by Cloudflare's Images binding. The resizer should
77
+ * enforce `limits.maxWidth` / `limits.maxHeight`, output `image/png`,
78
+ * `image/jpeg`, `image/gif`, or `image/webp`, and return `undefined` when
79
+ * an image already fits. When omitted, image normalization reports
80
+ * `ResizerUnavailableError` and images pass through unchanged.
81
+ */
82
+ readonly image?: ImageResizer;
83
+ }
84
+ export interface Handler extends WorkerdMachineLink.Hibernation {
85
+ (request: Request): Promise<Response>;
86
+ /** Suspends any workspaces past their idle threshold; call from the Durable Object's `alarm()` method. */
87
+ readonly alarm: () => Promise<void>;
88
+ }
89
+ /**
90
+ * Builds the web-standard fetch + alarm handler for a Durable Object. The
91
+ * application layer builds eagerly in the caller's scope, so hold it in the
92
+ * Durable Object instance rather than per request.
93
+ *
94
+ * Callers must forward the Durable Object's `alarm()` lifecycle method to
95
+ * `handler.alarm()`: this profile disables background idle polling so the
96
+ * isolate can hibernate at zero idle cost.
97
+ */
98
+ export declare const create: (options: Options) => Effect.Effect<Handler, Error, import("effect/Scope").Scope>;
99
+ /**
100
+ * The workerd profile's route layer, unbuilt: `createRoutes` over `serverOptions` with `replacements` applied, then
101
+ * `overrides` after them so they win. For embedders (the SDK) that build the context, register plugins and only then
102
+ * `serve` it, so recovery never runs without them.
103
+ */
104
+ export declare function routes(options: Options, overrides?: LayerNode.Replacements): Layer.Layer<import("@radheim/core/shell").Daemon | import("effect/http/HttpClient").HttpClient | import("effect/http/HttpRouter").HttpRouter | import("@radheim/util/fs-util").FSUtil.Service | import("@radheim/util/global").Service | Database.Service | import("@radheim/core/app").Service | import("@radheim/core/credential").Service | import("@radheim/core/kv").Service | import("@radheim/core/wellknown").Service | import("@radheim/core/session/instruction-entry").Service | import("@radheim/core/job").Service | Identity.Service | import("@radheim/core/machine/machines").Service | Workspace.Service | import("@radheim/core/codemode/api").Service | import("@radheim/core/permission/saved").Service | import("@radheim/core/location-service-map").Service | import("@radheim/core/persistent-pty/index").Service | import("@radheim/core/session").Service | import("@radheim/core/automation").Service | import("@radheim/core/push/list").Service | import("@radheim/core/push/sender").Service | import("@radheim/core/worktree").Service | BlobStore.Service | import("@radheim/core/session/search-build").Service | VideoGeneration.Service | import("@radheim/core/experimental/browser-tunnel").Service | import("@radheim/core/plugin/sdk").Service | import("@radheim/core/plugin/update").Service | import("@radheim/core/instance").Service | import("@radheim/core/bus").Service | import("@radheim/core/project").Service | import("@radheim/core/session/execution/restart").Service | import("@radheim/core/pty/ticket").Service | import("@radheim/core/session/transfer").Service | import("@radheim/core/location-activity").Service | import("@radheim/core/filesystem/file-watch").Service | import("./space-store").Service | import("./pairing").Service | MachinesFlag.Service, Error | import("@radheim/core/persistent-pty/index").UnavailableError, import("effect/FileSystem").FileSystem | import("effect/http/Etag").Generator | import("effect/http/HttpPlatform").HttpPlatform | import("effect/Path").Path>;
105
+ /**
106
+ * Serves a context built from `routes`: with `state`, carries on the machine links the Durable Object hibernated with,
107
+ * then resumes suspended Sessions, which may reach those machines, and answers machine-link upgrades through a
108
+ * `WebSocketPair` and every other request through the routes behind the `RequestSite` and CORS middleware.
109
+ */
110
+ export declare const serve: (context: Context.Context<import("@radheim/core/shell").Daemon | import("effect/http/HttpClient").HttpClient | import("effect/http/HttpRouter").HttpRouter | import("@radheim/util/fs-util").FSUtil.Service | import("@radheim/util/global").Service | Database.Service | import("@radheim/core/app").Service | import("@radheim/core/credential").Service | import("@radheim/core/kv").Service | import("@radheim/core/wellknown").Service | import("@radheim/core/session/instruction-entry").Service | import("@radheim/core/job").Service | Identity.Service | import("@radheim/core/machine/machines").Service | Workspace.Service | import("@radheim/core/codemode/api").Service | import("@radheim/core/permission/saved").Service | import("@radheim/core/location-service-map").Service | import("@radheim/core/persistent-pty/index").Service | import("@radheim/core/session").Service | import("@radheim/core/automation").Service | import("@radheim/core/push/list").Service | import("@radheim/core/push/sender").Service | import("@radheim/core/worktree").Service | BlobStore.Service | import("@radheim/core/session/search-build").Service | VideoGeneration.Service | import("@radheim/core/experimental/browser-tunnel").Service | import("@radheim/core/plugin/sdk").Service | import("@radheim/core/plugin/update").Service | import("@radheim/core/instance").Service | import("@radheim/core/bus").Service | import("@radheim/core/project").Service | import("@radheim/core/session/execution/restart").Service | import("@radheim/core/pty/ticket").Service | import("@radheim/core/session/transfer").Service | import("@radheim/core/location-activity").Service | import("@radheim/core/filesystem/file-watch").Service | import("./space-store").Service | import("./pairing").Service | MachinesFlag.Service>, options: Pick<Options, "cors" | "state">) => Effect.Effect<Handler, never, import("effect/Scope").Scope>;
111
+ export declare function serverOptions(options: Options): ServerOptions;
112
+ /** The workerd replacement graph, applied after the standard server replacements. */
113
+ export declare function replacements(options: Options): LayerNode.Replacements;