@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.
- package/dist/api.d.ts +9383 -0
- package/dist/api.js +10 -0
- package/dist/auth.d.ts +21 -0
- package/dist/auth.js +20 -0
- package/dist/chunks/api-0q8mvh3b.js +62 -0
- package/dist/chunks/api-11hx8jza.js +39 -0
- package/dist/chunks/api-1jnx79t4.js +31 -0
- package/dist/chunks/api-1mn3274c.js +57 -0
- package/dist/chunks/api-238wcyzf.js +252 -0
- package/dist/chunks/api-280h8k1v.js +198 -0
- package/dist/chunks/api-31hzmefh.js +73 -0
- package/dist/chunks/api-34msk99p.js +208 -0
- package/dist/chunks/api-40z6h0fq.js +20 -0
- package/dist/chunks/api-5fr63cjn.js +27 -0
- package/dist/chunks/api-5ggmn0t6.js +348 -0
- package/dist/chunks/api-61ndsq4a.js +45 -0
- package/dist/chunks/api-7tqjsq7b.js +101 -0
- package/dist/chunks/api-8cw69z4p.js +15 -0
- package/dist/chunks/api-8sb6qqpn.js +28 -0
- package/dist/chunks/api-8tn84h85.js +39 -0
- package/dist/chunks/api-9bxtygz0.js +48 -0
- package/dist/chunks/api-9qr3r2v1.js +66 -0
- package/dist/chunks/api-9rqn6x4v.js +16 -0
- package/dist/chunks/api-azwdvyh3.js +4 -0
- package/dist/chunks/api-b3j0kcev.js +30 -0
- package/dist/chunks/api-bctzdhd7.js +21 -0
- package/dist/chunks/api-bnpt5zxx.js +36 -0
- package/dist/chunks/api-bxwfazps.js +90 -0
- package/dist/chunks/api-d4cyxj7e.js +80 -0
- package/dist/chunks/api-d8rk8yaw.js +20 -0
- package/dist/chunks/api-djs9m6v0.js +42 -0
- package/dist/chunks/api-e2746nhp.js +17 -0
- package/dist/chunks/api-e4v11dgy.js +58 -0
- package/dist/chunks/api-e6e4kz0w.js +23 -0
- package/dist/chunks/api-f6955nmc.js +19 -0
- package/dist/chunks/api-fhp54bwg.js +39 -0
- package/dist/chunks/api-fpzegjvk.js +35 -0
- package/dist/chunks/api-fq7f3wrn.js +13 -0
- package/dist/chunks/api-gg2tbqc5.js +270 -0
- package/dist/chunks/api-gghkbyq2.js +189 -0
- package/dist/chunks/api-ghyd9ren.js +32 -0
- package/dist/chunks/api-h8v4dbra.js +49 -0
- package/dist/chunks/api-hpgyxnbj.js +92 -0
- package/dist/chunks/api-jb6q2eqf.js +70 -0
- package/dist/chunks/api-k0fc7y6c.js +219 -0
- package/dist/chunks/api-kb0k6qg1.js +35 -0
- package/dist/chunks/api-kb431qm0.js +31 -0
- package/dist/chunks/api-kvefct3s.js +215 -0
- package/dist/chunks/api-mzafcgd5.js +23 -0
- package/dist/chunks/api-n0gqhwq7.js +109 -0
- package/dist/chunks/api-njzqh2v3.js +22 -0
- package/dist/chunks/api-nqw28mmv.js +62 -0
- package/dist/chunks/api-ns3kfwpq.js +48 -0
- package/dist/chunks/api-ph6j0w88.js +29 -0
- package/dist/chunks/api-q8azxbmk.js +38 -0
- package/dist/chunks/api-qft4mah5.js +33 -0
- package/dist/chunks/api-qz4nw4cc.js +130 -0
- package/dist/chunks/api-rrsy7az3.js +69 -0
- package/dist/chunks/api-t2s5ghf4.js +91 -0
- package/dist/chunks/api-t32e1bbt.js +32 -0
- package/dist/chunks/api-t7f8xf56.js +22 -0
- package/dist/chunks/api-trzj52xd.js +13 -0
- package/dist/chunks/api-v2h85c6p.js +143 -0
- package/dist/chunks/api-vtj5wyks.js +13 -0
- package/dist/chunks/api-wrj46kzw.js +41 -0
- package/dist/chunks/api-wrma0ern.js +36 -0
- package/dist/chunks/api-x180v472.js +22 -0
- package/dist/chunks/api-xcn5yyhy.js +134 -0
- package/dist/chunks/api-xthc02cw.js +6 -0
- package/dist/chunks/api-ygxfyj7m.js +111 -0
- package/dist/chunks/api-z3ybfekq.js +20 -0
- package/dist/chunks/api-zvb9sh2w.js +30 -0
- package/dist/content-headers.d.ts +13 -0
- package/dist/content-headers.js +12 -0
- package/dist/cors.d.ts +7 -0
- package/dist/cors.js +10 -0
- package/dist/event-feed.d.ts +44 -0
- package/dist/event-feed.js +20 -0
- package/dist/fetch.d.ts +164 -0
- package/dist/fetch.js +80 -0
- package/dist/handlers/agent.d.ts +1 -0
- package/dist/handlers/agent.js +11 -0
- package/dist/handlers/artifact.d.ts +62 -0
- package/dist/handlers/artifact.js +8 -0
- package/dist/handlers/automation.d.ts +23 -0
- package/dist/handlers/automation.js +7 -0
- package/dist/handlers/blob.d.ts +168 -0
- package/dist/handlers/blob.js +9 -0
- package/dist/handlers/command.d.ts +1 -0
- package/dist/handlers/command.js +11 -0
- package/dist/handlers/config.d.ts +1 -0
- package/dist/handlers/config.js +11 -0
- package/dist/handlers/credential.d.ts +4 -0
- package/dist/handlers/credential.js +12 -0
- package/dist/handlers/debug.d.ts +2 -0
- package/dist/handlers/debug.js +11 -0
- package/dist/handlers/event.d.ts +2 -0
- package/dist/handlers/event.js +12 -0
- package/dist/handlers/experimental/browser-tunnel.d.ts +11 -0
- package/dist/handlers/experimental/browser-tunnel.js +9 -0
- package/dist/handlers/flag.d.ts +1 -0
- package/dist/handlers/flag.js +11 -0
- package/dist/handlers/form.d.ts +1 -0
- package/dist/handlers/form.js +11 -0
- package/dist/handlers/fs.d.ts +2 -0
- package/dist/handlers/fs.js +13 -0
- package/dist/handlers/generate.d.ts +4 -0
- package/dist/handlers/generate.js +11 -0
- package/dist/handlers/integration.d.ts +7 -0
- package/dist/handlers/integration.js +13 -0
- package/dist/handlers/job.d.ts +73 -0
- package/dist/handlers/job.js +7 -0
- package/dist/handlers/location.d.ts +2 -0
- package/dist/handlers/location.js +11 -0
- package/dist/handlers/machine.d.ts +164 -0
- package/dist/handlers/machine.js +28 -0
- package/dist/handlers/mcp.d.ts +3 -0
- package/dist/handlers/mcp.js +13 -0
- package/dist/handlers/media.d.ts +6 -0
- package/dist/handlers/media.js +7 -0
- package/dist/handlers/message.d.ts +2 -0
- package/dist/handlers/message.js +12 -0
- package/dist/handlers/migration.d.ts +1 -0
- package/dist/handlers/migration.js +11 -0
- package/dist/handlers/model.d.ts +1 -0
- package/dist/handlers/model.js +11 -0
- package/dist/handlers/permission.d.ts +4 -0
- package/dist/handlers/permission.js +11 -0
- package/dist/handlers/persistent-pty.d.ts +3 -0
- package/dist/handlers/persistent-pty.js +25 -0
- package/dist/handlers/plugin.d.ts +2 -0
- package/dist/handlers/plugin.js +11 -0
- package/dist/handlers/project.d.ts +2 -0
- package/dist/handlers/project.js +11 -0
- package/dist/handlers/provider.d.ts +1 -0
- package/dist/handlers/provider.js +11 -0
- package/dist/handlers/pty-socket.d.ts +12 -0
- package/dist/handlers/pty-socket.js +8 -0
- package/dist/handlers/pty.d.ts +3 -0
- package/dist/handlers/pty.js +13 -0
- package/dist/handlers/push.d.ts +28 -0
- package/dist/handlers/push.js +6 -0
- package/dist/handlers/reference.d.ts +1 -0
- package/dist/handlers/reference.js +11 -0
- package/dist/handlers/rpc.d.ts +1 -0
- package/dist/handlers/rpc.js +11 -0
- package/dist/handlers/server.d.ts +4 -0
- package/dist/handlers/server.js +14 -0
- package/dist/handlers/session-error.d.ts +11 -0
- package/dist/handlers/session-error.js +14 -0
- package/dist/handlers/session.d.ts +5 -0
- package/dist/handlers/session.js +12 -0
- package/dist/handlers/shell.d.ts +1 -0
- package/dist/handlers/shell.js +11 -0
- package/dist/handlers/skill.d.ts +1 -0
- package/dist/handlers/skill.js +11 -0
- package/dist/handlers/space.d.ts +54 -0
- package/dist/handlers/space.js +7 -0
- package/dist/handlers/usage.d.ts +1 -0
- package/dist/handlers/usage.js +11 -0
- package/dist/handlers/vcs.d.ts +4 -0
- package/dist/handlers/vcs.js +11 -0
- package/dist/handlers/voice.d.ts +3 -0
- package/dist/handlers/voice.js +11 -0
- package/dist/handlers/websearch.d.ts +1 -0
- package/dist/handlers/websearch.js +11 -0
- package/dist/handlers/worktree.d.ts +2 -0
- package/dist/handlers/worktree.js +11 -0
- package/dist/handlers.d.ts +3 -0
- package/dist/handlers.js +63 -0
- package/dist/location.d.ts +28 -0
- package/dist/location.js +17 -0
- package/dist/media-uri.d.ts +6 -0
- package/dist/media-uri.js +6 -0
- package/dist/middleware/authorization.d.ts +8 -0
- package/dist/middleware/authorization.js +13 -0
- package/dist/middleware/defect-response.d.ts +2 -0
- package/dist/middleware/defect-response.js +6 -0
- package/dist/middleware/form-location.d.ts +18 -0
- package/dist/middleware/form-location.js +10 -0
- package/dist/middleware/schema-error.d.ts +3 -0
- package/dist/middleware/schema-error.js +8 -0
- package/dist/middleware/session-location.d.ts +17 -0
- package/dist/middleware/session-location.js +10 -0
- package/dist/options.d.ts +130 -0
- package/dist/options.js +55 -0
- package/dist/pairing.d.ts +13 -0
- package/dist/pairing.js +10 -0
- package/dist/process.d.ts +70 -0
- package/dist/process.js +241 -0
- package/dist/range.d.ts +6 -0
- package/dist/range.js +8 -0
- package/dist/request-site.d.ts +11 -0
- package/dist/request-site.js +11 -0
- package/dist/request-tracing.d.ts +1 -0
- package/dist/request-tracing.js +6 -0
- package/dist/routes.d.ts +54 -0
- package/dist/routes.js +69 -0
- package/dist/server-info.d.ts +14 -0
- package/dist/server-info.js +12 -0
- package/dist/service-status.d.ts +25 -0
- package/dist/service-status.js +8 -0
- package/dist/space-store.d.ts +62 -0
- package/dist/space-store.js +16 -0
- package/dist/workerd-machine-link.d.ts +107 -0
- package/dist/workerd-machine-link.js +19 -0
- package/dist/workerd.d.ts +113 -0
- package/dist/workerd.js +168 -0
- package/package.json +50 -4
- package/README.md +0 -3
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Instance } from "@radheim/core/instance/service";
|
|
2
|
+
import { Session } from "@radheim/core/session";
|
|
3
|
+
import { Layer } from "effect";
|
|
4
|
+
import { HttpApiMiddleware } from "effect/http-api";
|
|
5
|
+
import { LocationNotFoundError, InvalidRequestError, SessionNotFoundError } from "@radheim/protocol/errors";
|
|
6
|
+
declare const SessionLocationMiddleware_base: HttpApiMiddleware.ServiceClass<SessionLocationMiddleware, "@radheim/HttpApiSessionLocation", {
|
|
7
|
+
requires: never;
|
|
8
|
+
provides: Instance.Services;
|
|
9
|
+
error: readonly [typeof InvalidRequestError, typeof SessionNotFoundError, typeof LocationNotFoundError];
|
|
10
|
+
clientError: never;
|
|
11
|
+
requiredForClient: false;
|
|
12
|
+
security: never;
|
|
13
|
+
}, HttpApiMiddleware.HttpApiMiddleware<Instance.Services, readonly [typeof InvalidRequestError, typeof SessionNotFoundError, typeof LocationNotFoundError], never>>;
|
|
14
|
+
export declare class SessionLocationMiddleware extends SessionLocationMiddleware_base {
|
|
15
|
+
}
|
|
16
|
+
export declare const sessionLocationLayer: Layer.Layer<SessionLocationMiddleware, never, Session.Service | Instance.Service>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SessionLocationMiddleware2,
|
|
3
|
+
sessionLocationLayer2
|
|
4
|
+
} from "../chunks/api-5fr63cjn.js";
|
|
5
|
+
import"../chunks/api-0q8mvh3b.js";
|
|
6
|
+
import"../chunks/api-ghyd9ren.js";
|
|
7
|
+
export {
|
|
8
|
+
SessionLocationMiddleware2 as SessionLocationMiddleware,
|
|
9
|
+
sessionLocationLayer2 as sessionLocationLayer
|
|
10
|
+
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
import type { LayerNodePlatform } from "@radheim/util/effect/app-node-platform";
|
|
3
|
+
/** The application runtime: everything the service graph reads, with or without an HTTP listener in front. */
|
|
4
|
+
export declare const AppOptions: Schema.Struct<{
|
|
5
|
+
readonly app: Schema.optional<Schema.Struct<{
|
|
6
|
+
readonly name: Schema.optional<Schema.String>;
|
|
7
|
+
readonly version: Schema.optional<Schema.String>;
|
|
8
|
+
readonly channel: Schema.optional<Schema.String>;
|
|
9
|
+
}>>;
|
|
10
|
+
readonly database: Schema.optional<Schema.Struct<{
|
|
11
|
+
readonly path: Schema.optional<Schema.String>;
|
|
12
|
+
}>>;
|
|
13
|
+
readonly pty: Schema.optional<Schema.Struct<{
|
|
14
|
+
readonly handoff: Schema.optional<Schema.Struct<{
|
|
15
|
+
readonly directory: Schema.String;
|
|
16
|
+
readonly instanceID: Schema.String;
|
|
17
|
+
readonly ticket: Schema.String;
|
|
18
|
+
readonly expiresAt: Schema.Number;
|
|
19
|
+
}>>;
|
|
20
|
+
readonly root: Schema.optional<Schema.String>;
|
|
21
|
+
}>>;
|
|
22
|
+
readonly events: Schema.optional<Schema.Struct<{
|
|
23
|
+
readonly persist: Schema.optional<Schema.Boolean>;
|
|
24
|
+
}>>;
|
|
25
|
+
readonly models: Schema.optional<Schema.Struct<{
|
|
26
|
+
readonly url: Schema.optional<Schema.String>;
|
|
27
|
+
readonly file: Schema.optional<Schema.String>;
|
|
28
|
+
readonly fetch: Schema.optional<Schema.Boolean>;
|
|
29
|
+
readonly snapshot: Schema.optional<Schema.Boolean>;
|
|
30
|
+
}>>;
|
|
31
|
+
/**
|
|
32
|
+
* Replaces `globalThis.fetch` for OpenCode's own HTTP requests: OpenCode Console config, model requests, web fetch
|
|
33
|
+
* and search, well-known config, and remote MCP servers. Agent code in Code Mode keeps `globalThis.fetch`. For
|
|
34
|
+
* example, a Cloudflare Worker can route requests through a Service Binding.
|
|
35
|
+
*/
|
|
36
|
+
readonly fetch: Schema.optional<Schema.declare<LayerNodePlatform.Fetch, LayerNodePlatform.Fetch>>;
|
|
37
|
+
readonly config: Schema.optional<Schema.Struct<{
|
|
38
|
+
readonly directory: Schema.optional<Schema.String>;
|
|
39
|
+
readonly project: Schema.optional<Schema.Boolean>;
|
|
40
|
+
readonly claude: Schema.optional<Schema.Boolean>;
|
|
41
|
+
readonly file: Schema.optional<Schema.String>;
|
|
42
|
+
readonly content: Schema.optional<Schema.String>;
|
|
43
|
+
}>>;
|
|
44
|
+
readonly instructions: Schema.optional<Schema.Struct<{
|
|
45
|
+
readonly claude: Schema.optional<Schema.Boolean>;
|
|
46
|
+
}>>;
|
|
47
|
+
readonly windows: Schema.optional<Schema.Struct<{
|
|
48
|
+
readonly gitbash: Schema.optional<Schema.String>;
|
|
49
|
+
}>>;
|
|
50
|
+
readonly fs: Schema.optional<Schema.Struct<{
|
|
51
|
+
readonly filewatcher: Schema.optional<Schema.Boolean>;
|
|
52
|
+
readonly fff: Schema.optional<Schema.Boolean>;
|
|
53
|
+
}>>;
|
|
54
|
+
/** Experimental: may change without compatibility guarantees. */
|
|
55
|
+
readonly experimental: Schema.optional<Schema.Struct<{
|
|
56
|
+
readonly push: Schema.optional<Schema.Struct<{
|
|
57
|
+
readonly relays: Schema.optional<Schema.$Array<Schema.String>>;
|
|
58
|
+
}>>;
|
|
59
|
+
}>>;
|
|
60
|
+
}>;
|
|
61
|
+
export type AppOptions = typeof AppOptions.Type;
|
|
62
|
+
export declare const ServerOptions: Schema.Struct<{
|
|
63
|
+
readonly app: Schema.optional<Schema.Struct<{
|
|
64
|
+
readonly name: Schema.optional<Schema.String>;
|
|
65
|
+
readonly version: Schema.optional<Schema.String>;
|
|
66
|
+
readonly channel: Schema.optional<Schema.String>;
|
|
67
|
+
}>>;
|
|
68
|
+
readonly database: Schema.optional<Schema.Struct<{
|
|
69
|
+
readonly path: Schema.optional<Schema.String>;
|
|
70
|
+
}>>;
|
|
71
|
+
readonly pty: Schema.optional<Schema.Struct<{
|
|
72
|
+
readonly handoff: Schema.optional<Schema.Struct<{
|
|
73
|
+
readonly directory: Schema.String;
|
|
74
|
+
readonly instanceID: Schema.String;
|
|
75
|
+
readonly ticket: Schema.String;
|
|
76
|
+
readonly expiresAt: Schema.Number;
|
|
77
|
+
}>>;
|
|
78
|
+
readonly root: Schema.optional<Schema.String>;
|
|
79
|
+
}>>;
|
|
80
|
+
readonly events: Schema.optional<Schema.Struct<{
|
|
81
|
+
readonly persist: Schema.optional<Schema.Boolean>;
|
|
82
|
+
}>>;
|
|
83
|
+
readonly models: Schema.optional<Schema.Struct<{
|
|
84
|
+
readonly url: Schema.optional<Schema.String>;
|
|
85
|
+
readonly file: Schema.optional<Schema.String>;
|
|
86
|
+
readonly fetch: Schema.optional<Schema.Boolean>;
|
|
87
|
+
readonly snapshot: Schema.optional<Schema.Boolean>;
|
|
88
|
+
}>>;
|
|
89
|
+
/**
|
|
90
|
+
* Replaces `globalThis.fetch` for OpenCode's own HTTP requests: OpenCode Console config, model requests, web fetch
|
|
91
|
+
* and search, well-known config, and remote MCP servers. Agent code in Code Mode keeps `globalThis.fetch`. For
|
|
92
|
+
* example, a Cloudflare Worker can route requests through a Service Binding.
|
|
93
|
+
*/
|
|
94
|
+
readonly fetch: Schema.optional<Schema.declare<LayerNodePlatform.Fetch, LayerNodePlatform.Fetch>>;
|
|
95
|
+
readonly config: Schema.optional<Schema.Struct<{
|
|
96
|
+
readonly directory: Schema.optional<Schema.String>;
|
|
97
|
+
readonly project: Schema.optional<Schema.Boolean>;
|
|
98
|
+
readonly claude: Schema.optional<Schema.Boolean>;
|
|
99
|
+
readonly file: Schema.optional<Schema.String>;
|
|
100
|
+
readonly content: Schema.optional<Schema.String>;
|
|
101
|
+
}>>;
|
|
102
|
+
readonly instructions: Schema.optional<Schema.Struct<{
|
|
103
|
+
readonly claude: Schema.optional<Schema.Boolean>;
|
|
104
|
+
}>>;
|
|
105
|
+
readonly windows: Schema.optional<Schema.Struct<{
|
|
106
|
+
readonly gitbash: Schema.optional<Schema.String>;
|
|
107
|
+
}>>;
|
|
108
|
+
readonly fs: Schema.optional<Schema.Struct<{
|
|
109
|
+
readonly filewatcher: Schema.optional<Schema.Boolean>;
|
|
110
|
+
readonly fff: Schema.optional<Schema.Boolean>;
|
|
111
|
+
}>>;
|
|
112
|
+
/** Experimental: may change without compatibility guarantees. */
|
|
113
|
+
readonly experimental: Schema.optional<Schema.Struct<{
|
|
114
|
+
readonly push: Schema.optional<Schema.Struct<{
|
|
115
|
+
readonly relays: Schema.optional<Schema.$Array<Schema.String>>;
|
|
116
|
+
}>>;
|
|
117
|
+
}>>;
|
|
118
|
+
readonly hostname: Schema.optional<Schema.String>;
|
|
119
|
+
readonly port: Schema.optional<Schema.Int>;
|
|
120
|
+
readonly password: Schema.optional<Schema.String>;
|
|
121
|
+
readonly cors: Schema.optional<Schema.$Array<Schema.String>>;
|
|
122
|
+
readonly simulation: Schema.optional<Schema.Boolean>;
|
|
123
|
+
}>;
|
|
124
|
+
export type ServerOptions = typeof ServerOptions.Type;
|
|
125
|
+
/**
|
|
126
|
+
* What routes served without a listener honor: the application, plus the origin allowlist the WebSocket handlers
|
|
127
|
+
* check and the simulation switch. There is no `hostname`, `port` or `password`: nothing binds, and the embedder
|
|
128
|
+
* owns access control.
|
|
129
|
+
*/
|
|
130
|
+
export type EmbeddedRoutesOptions = AppOptions & Pick<ServerOptions, "cors" | "simulation">;
|
package/dist/options.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// src/options.ts
|
|
2
|
+
import { Database } from "@radheim/core/database/database";
|
|
3
|
+
import { ModelsDev } from "@radheim/core/models-dev";
|
|
4
|
+
import { PersistentPty } from "@radheim/core/persistent-pty";
|
|
5
|
+
import { PushList } from "@radheim/core/push/list";
|
|
6
|
+
import { Schema } from "effect";
|
|
7
|
+
var AppOptions = Schema.Struct({
|
|
8
|
+
app: Schema.optional(Schema.Struct({
|
|
9
|
+
name: Schema.optional(Schema.String),
|
|
10
|
+
version: Schema.optional(Schema.String),
|
|
11
|
+
channel: Schema.optional(Schema.String)
|
|
12
|
+
})),
|
|
13
|
+
database: Schema.optional(Database.Options),
|
|
14
|
+
pty: Schema.optional(PersistentPty.Options),
|
|
15
|
+
events: Schema.optional(Schema.Struct({
|
|
16
|
+
persist: Schema.optional(Schema.Boolean)
|
|
17
|
+
})),
|
|
18
|
+
models: Schema.optional(ModelsDev.Options),
|
|
19
|
+
fetch: Schema.optional(Schema.declare((input) => typeof input === "function")),
|
|
20
|
+
config: Schema.optional(Schema.Struct({
|
|
21
|
+
directory: Schema.optional(Schema.String),
|
|
22
|
+
project: Schema.optional(Schema.Boolean),
|
|
23
|
+
claude: Schema.optional(Schema.Boolean),
|
|
24
|
+
file: Schema.optional(Schema.String),
|
|
25
|
+
content: Schema.optional(Schema.String)
|
|
26
|
+
})),
|
|
27
|
+
instructions: Schema.optional(Schema.Struct({
|
|
28
|
+
claude: Schema.optional(Schema.Boolean)
|
|
29
|
+
})),
|
|
30
|
+
windows: Schema.optional(Schema.Struct({
|
|
31
|
+
gitbash: Schema.optional(Schema.String)
|
|
32
|
+
})),
|
|
33
|
+
fs: Schema.optional(Schema.Struct({
|
|
34
|
+
filewatcher: Schema.optional(Schema.Boolean),
|
|
35
|
+
fff: Schema.optional(Schema.Boolean)
|
|
36
|
+
})),
|
|
37
|
+
experimental: Schema.optional(Schema.Struct({
|
|
38
|
+
push: Schema.optional(PushList.Options)
|
|
39
|
+
}))
|
|
40
|
+
});
|
|
41
|
+
var HttpListenerOptions = Schema.Struct({
|
|
42
|
+
hostname: Schema.optional(Schema.String),
|
|
43
|
+
port: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(0), Schema.isLessThanOrEqualTo(65535))),
|
|
44
|
+
password: Schema.optional(Schema.String),
|
|
45
|
+
cors: Schema.optional(Schema.Array(Schema.String))
|
|
46
|
+
});
|
|
47
|
+
var ServerOptions = Schema.Struct({
|
|
48
|
+
...AppOptions.fields,
|
|
49
|
+
...HttpListenerOptions.fields,
|
|
50
|
+
simulation: Schema.optional(Schema.Boolean)
|
|
51
|
+
});
|
|
52
|
+
export {
|
|
53
|
+
AppOptions,
|
|
54
|
+
ServerOptions
|
|
55
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * as ServerPairing from "./pairing";
|
|
2
|
+
import { Context, Effect } from "effect";
|
|
3
|
+
export interface Interface {
|
|
4
|
+
readonly issue: () => Effect.Effect<{
|
|
5
|
+
readonly code: string;
|
|
6
|
+
readonly expires_in: number;
|
|
7
|
+
}>;
|
|
8
|
+
readonly consume: (code: string) => Effect.Effect<boolean>;
|
|
9
|
+
}
|
|
10
|
+
declare const Service_base: Context.ServiceClass<Service, "@radheim/ServerPairing", Interface>;
|
|
11
|
+
export declare class Service extends Service_base {
|
|
12
|
+
}
|
|
13
|
+
export declare const node: import("@radheim/util/effect/layer-node").Provider<Service, never, import("@radheim/util/effect/layer-node").Tag<"global">, true>;
|
package/dist/pairing.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export * as ServerProcess from "./process";
|
|
2
|
+
import { Effect, Scope } from "effect";
|
|
3
|
+
import { HttpServerRequest, HttpServerResponse } from "effect/http";
|
|
4
|
+
import { NetAddress } from "effect/net";
|
|
5
|
+
export interface Lifecycle<E = never, R = never> {
|
|
6
|
+
readonly onListen: (address: NetAddress.SocketAddress, shutdown: Effect.Effect<void>) => Effect.Effect<Effect.Effect<void>, E, R>;
|
|
7
|
+
}
|
|
8
|
+
type App = Effect.Effect<HttpServerResponse.HttpServerResponse, unknown, HttpServerRequest.HttpServerRequest | Scope.Scope>;
|
|
9
|
+
export type Transform = (app: App) => App;
|
|
10
|
+
export declare const start: <E, R>(options: {
|
|
11
|
+
readonly app?: {
|
|
12
|
+
readonly name?: string | undefined;
|
|
13
|
+
readonly version?: string | undefined;
|
|
14
|
+
readonly channel?: string | undefined;
|
|
15
|
+
} | undefined;
|
|
16
|
+
readonly database?: {
|
|
17
|
+
readonly path?: string | undefined;
|
|
18
|
+
} | undefined;
|
|
19
|
+
readonly pty?: {
|
|
20
|
+
readonly handoff?: {
|
|
21
|
+
readonly directory: string;
|
|
22
|
+
readonly instanceID: string;
|
|
23
|
+
readonly ticket: string;
|
|
24
|
+
readonly expiresAt: number;
|
|
25
|
+
} | undefined;
|
|
26
|
+
readonly root?: string | undefined;
|
|
27
|
+
} | undefined;
|
|
28
|
+
readonly events?: {
|
|
29
|
+
readonly persist?: boolean | undefined;
|
|
30
|
+
} | undefined;
|
|
31
|
+
readonly models?: {
|
|
32
|
+
readonly url?: string | undefined;
|
|
33
|
+
readonly file?: string | undefined;
|
|
34
|
+
readonly fetch?: boolean | undefined;
|
|
35
|
+
readonly snapshot?: boolean | undefined;
|
|
36
|
+
} | undefined;
|
|
37
|
+
readonly fetch?: import("@radheim/util/effect/app-node-platform").Fetch | undefined;
|
|
38
|
+
readonly config?: {
|
|
39
|
+
readonly directory?: string | undefined;
|
|
40
|
+
readonly project?: boolean | undefined;
|
|
41
|
+
readonly claude?: boolean | undefined;
|
|
42
|
+
readonly file?: string | undefined;
|
|
43
|
+
readonly content?: string | undefined;
|
|
44
|
+
} | undefined;
|
|
45
|
+
readonly instructions?: {
|
|
46
|
+
readonly claude?: boolean | undefined;
|
|
47
|
+
} | undefined;
|
|
48
|
+
readonly windows?: {
|
|
49
|
+
readonly gitbash?: string | undefined;
|
|
50
|
+
} | undefined;
|
|
51
|
+
readonly fs?: {
|
|
52
|
+
readonly filewatcher?: boolean | undefined;
|
|
53
|
+
readonly fff?: boolean | undefined;
|
|
54
|
+
} | undefined;
|
|
55
|
+
readonly experimental?: {
|
|
56
|
+
readonly push?: {
|
|
57
|
+
readonly relays?: readonly string[] | undefined;
|
|
58
|
+
} | undefined;
|
|
59
|
+
} | undefined;
|
|
60
|
+
readonly hostname?: string | undefined;
|
|
61
|
+
readonly port?: number | undefined;
|
|
62
|
+
readonly password?: string | undefined;
|
|
63
|
+
readonly cors?: readonly string[] | undefined;
|
|
64
|
+
readonly simulation?: boolean | undefined;
|
|
65
|
+
}, lifecycle?: Lifecycle<E, R> | undefined, transform?: Transform | undefined, remoteURLs?: (() => ReadonlyArray<string>) | undefined) => Effect.Effect<{
|
|
66
|
+
address: NetAddress.SocketAddress;
|
|
67
|
+
shutdown: Effect.Effect<void, never, never>;
|
|
68
|
+
updateAvailable: (version: string) => Effect.Effect<void, never, never>;
|
|
69
|
+
updated: (version: string) => Effect.Effect<void, never, never>;
|
|
70
|
+
}, E | Error, R | Scope.Scope>;
|
package/dist/process.js
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Config2
|
|
3
|
+
} from "./chunks/api-9qr3r2v1.js";
|
|
4
|
+
import {
|
|
5
|
+
isAllowedCorsOrigin2
|
|
6
|
+
} from "./chunks/api-11hx8jza.js";
|
|
7
|
+
import {
|
|
8
|
+
machinesEnabled2
|
|
9
|
+
} from "./chunks/api-238wcyzf.js";
|
|
10
|
+
import {
|
|
11
|
+
unauthorizedResponse2,
|
|
12
|
+
authorizedRequest2
|
|
13
|
+
} from "./chunks/api-bxwfazps.js";
|
|
14
|
+
import {
|
|
15
|
+
withoutParentSpan2
|
|
16
|
+
} from "./chunks/api-azwdvyh3.js";
|
|
17
|
+
import {
|
|
18
|
+
middleware3
|
|
19
|
+
} from "./chunks/api-8tn84h85.js";
|
|
20
|
+
import"./chunks/api-ghyd9ren.js";
|
|
21
|
+
import"./chunks/api-0q8mvh3b.js";
|
|
22
|
+
import"./chunks/api-bnpt5zxx.js";
|
|
23
|
+
import"./chunks/api-5fr63cjn.js";
|
|
24
|
+
import"./chunks/api-f6955nmc.js";
|
|
25
|
+
import"./chunks/api-k0fc7y6c.js";
|
|
26
|
+
import"./chunks/api-t2s5ghf4.js";
|
|
27
|
+
import"./chunks/api-kb431qm0.js";
|
|
28
|
+
import"./chunks/api-xthc02cw.js";
|
|
29
|
+
import"./chunks/api-rrsy7az3.js";
|
|
30
|
+
import"./chunks/api-t7f8xf56.js";
|
|
31
|
+
import"./chunks/api-ph6j0w88.js";
|
|
32
|
+
import"./chunks/api-5ggmn0t6.js";
|
|
33
|
+
import"./chunks/api-hpgyxnbj.js";
|
|
34
|
+
import"./chunks/api-t32e1bbt.js";
|
|
35
|
+
import"./chunks/api-8sb6qqpn.js";
|
|
36
|
+
import"./chunks/api-xcn5yyhy.js";
|
|
37
|
+
import"./chunks/api-e2746nhp.js";
|
|
38
|
+
import"./chunks/api-trzj52xd.js";
|
|
39
|
+
import"./chunks/api-b3j0kcev.js";
|
|
40
|
+
import"./chunks/api-d8rk8yaw.js";
|
|
41
|
+
import"./chunks/api-7tqjsq7b.js";
|
|
42
|
+
import"./chunks/api-wrma0ern.js";
|
|
43
|
+
import"./chunks/api-mzafcgd5.js";
|
|
44
|
+
import"./chunks/api-jb6q2eqf.js";
|
|
45
|
+
import {
|
|
46
|
+
connectionURLs2
|
|
47
|
+
} from "./chunks/api-wrj46kzw.js";
|
|
48
|
+
import"./chunks/api-fpzegjvk.js";
|
|
49
|
+
import"./chunks/api-1mn3274c.js";
|
|
50
|
+
import"./chunks/api-q8azxbmk.js";
|
|
51
|
+
import"./chunks/api-zvb9sh2w.js";
|
|
52
|
+
import"./chunks/api-qz4nw4cc.js";
|
|
53
|
+
import"./chunks/api-v2h85c6p.js";
|
|
54
|
+
import"./chunks/api-d4cyxj7e.js";
|
|
55
|
+
import"./chunks/api-gghkbyq2.js";
|
|
56
|
+
import"./chunks/api-9bxtygz0.js";
|
|
57
|
+
import"./chunks/api-1jnx79t4.js";
|
|
58
|
+
import"./chunks/api-ns3kfwpq.js";
|
|
59
|
+
import"./chunks/api-e4v11dgy.js";
|
|
60
|
+
import"./chunks/api-h8v4dbra.js";
|
|
61
|
+
import"./chunks/api-34msk99p.js";
|
|
62
|
+
import"./chunks/api-kb0k6qg1.js";
|
|
63
|
+
import"./chunks/api-fq7f3wrn.js";
|
|
64
|
+
import"./chunks/api-njzqh2v3.js";
|
|
65
|
+
import"./chunks/api-280h8k1v.js";
|
|
66
|
+
import"./chunks/api-fhp54bwg.js";
|
|
67
|
+
import"./chunks/api-z3ybfekq.js";
|
|
68
|
+
import"./chunks/api-40z6h0fq.js";
|
|
69
|
+
import"./chunks/api-n0gqhwq7.js";
|
|
70
|
+
import"./chunks/api-nqw28mmv.js";
|
|
71
|
+
import"./chunks/api-8cw69z4p.js";
|
|
72
|
+
import"./chunks/api-djs9m6v0.js";
|
|
73
|
+
import"./chunks/api-31hzmefh.js";
|
|
74
|
+
import"./chunks/api-vtj5wyks.js";
|
|
75
|
+
import"./chunks/api-x180v472.js";
|
|
76
|
+
import"./chunks/api-ygxfyj7m.js";
|
|
77
|
+
import"./chunks/api-qft4mah5.js";
|
|
78
|
+
import"./chunks/api-bctzdhd7.js";
|
|
79
|
+
import {
|
|
80
|
+
createRoutes2
|
|
81
|
+
} from "./chunks/api-kvefct3s.js";
|
|
82
|
+
import {
|
|
83
|
+
make3
|
|
84
|
+
} from "./chunks/api-e6e4kz0w.js";
|
|
85
|
+
import {
|
|
86
|
+
__export
|
|
87
|
+
} from "./chunks/api-9rqn6x4v.js";
|
|
88
|
+
|
|
89
|
+
// src/process.ts
|
|
90
|
+
var exports_process = {};
|
|
91
|
+
__export(exports_process, {
|
|
92
|
+
ServerProcess: () => exports_process,
|
|
93
|
+
start: () => start
|
|
94
|
+
});
|
|
95
|
+
import { NodeHttpServer } from "@effect/platform-node";
|
|
96
|
+
import { BrowserTunnelGateway } from "@radheim/core/experimental/browser-tunnel";
|
|
97
|
+
import { Bus } from "@radheim/core/bus";
|
|
98
|
+
import { SessionRestart } from "@radheim/core/session/execution/restart";
|
|
99
|
+
import { Automation } from "@radheim/core/automation";
|
|
100
|
+
import { SessionSearchBuild } from "@radheim/core/session/search-build";
|
|
101
|
+
import { InstallationEvent } from "@radheim/schema/installation-event";
|
|
102
|
+
import { hasPtyConnectTicketURL } from "@radheim/protocol/groups/pty";
|
|
103
|
+
import { hasPersistentPtyConnectTicketURL } from "@radheim/protocol/groups/persistent-pty";
|
|
104
|
+
import { hasBrowserTunnelUpgrade } from "@radheim/protocol/groups/experimental/browser-tunnel";
|
|
105
|
+
import { hasMcpClientTicketURL } from "@radheim/protocol/groups/mcp";
|
|
106
|
+
import { isMachineLinkUpgrade } from "@radheim/protocol/groups/machine";
|
|
107
|
+
import { isPairingConnectURL } from "@radheim/protocol/groups/server";
|
|
108
|
+
import { Global } from "@radheim/util/global";
|
|
109
|
+
import { Cause, Context, Effect, Exit, Latch, Layer, Option, Ref, Scope } from "effect";
|
|
110
|
+
import { HttpMiddleware, HttpRouter, HttpServerRequest, HttpServerResponse } from "effect/http";
|
|
111
|
+
import { createServer } from "node:http";
|
|
112
|
+
var errorResponseLogger = HttpMiddleware.make((app) => HttpMiddleware.logger(Effect.tap(app, (response) => response.status < 400 ? HttpMiddleware.withLoggerDisabled(Effect.void) : Effect.void)));
|
|
113
|
+
var start = Effect.fn("ServerProcess.start")(function* (options, lifecycle, transform, remoteURLs) {
|
|
114
|
+
const password = options.password;
|
|
115
|
+
if (!password)
|
|
116
|
+
return yield* Effect.fail(new Error("Missing server password"));
|
|
117
|
+
const hostname = options.hostname ?? "127.0.0.1";
|
|
118
|
+
const port = Option.fromNullishOr(options.port);
|
|
119
|
+
const shutdown = yield* Latch.make();
|
|
120
|
+
const status = yield* make3();
|
|
121
|
+
const bound = yield* listen({ hostname, port });
|
|
122
|
+
const localURLs = () => {
|
|
123
|
+
const address = bound.server.address();
|
|
124
|
+
if (address === null || typeof address === "string")
|
|
125
|
+
return [];
|
|
126
|
+
const host = address.family === "IPv6" ? `[${address.address}]` : address.address;
|
|
127
|
+
return connectionURLs2(`http://${host}:${address.port}`, hostname);
|
|
128
|
+
};
|
|
129
|
+
const urls = () => [...localURLs(), ...remoteURLs?.() ?? []];
|
|
130
|
+
const application = yield* Ref.make(Option.none());
|
|
131
|
+
const machinesFlag = yield* Ref.make(Effect.succeed(false));
|
|
132
|
+
const app = dispatch(password, status, application, machinesFlag, options.app?.version ?? "unknown", urls, Global.Path.tmp);
|
|
133
|
+
yield* bound.http.serve((transform ? transform(app) : app).pipe(middleware3(options), HttpMiddleware.compression(), HttpMiddleware.cors({ allowedOrigins: (origin) => isAllowedCorsOrigin2(origin, options), maxAge: 86400 })), errorResponseLogger).pipe(Effect.provide(NodeHttpServer.layerHttpServices), withoutParentSpan2);
|
|
134
|
+
if (lifecycle)
|
|
135
|
+
yield* lifecycle.onListen(bound.http.address, shutdown.open.pipe(Effect.asVoid)).pipe(Effect.flatMap((cleanup) => Effect.addFinalizer(() => Scope.close(bound.scope, Exit.void).pipe(Effect.andThen(cleanup)))), Effect.uninterruptible);
|
|
136
|
+
const parentScope = yield* Scope.Scope;
|
|
137
|
+
const applicationScope = yield* Scope.fork(parentScope);
|
|
138
|
+
yield* Effect.addFinalizer(() => status.beginStopping.pipe(Effect.andThen(Ref.set(application, Option.none())), Effect.andThen(Effect.sync(() => bound.server.closeAllConnections()))));
|
|
139
|
+
const boot = Effect.gen(function* () {
|
|
140
|
+
const context = yield* Layer.buildWithScope(createRoutes2({
|
|
141
|
+
...options,
|
|
142
|
+
password
|
|
143
|
+
}, urls).pipe(Layer.provideMerge(NodeHttpServer.layerHttpServices)), applicationScope);
|
|
144
|
+
if (lifecycle) {
|
|
145
|
+
yield* installRestartContinuity(Context.get(context, SessionRestart.Service)).pipe(Effect.provideService(Scope.Scope, applicationScope));
|
|
146
|
+
}
|
|
147
|
+
yield* Effect.forkIn(Context.get(context, Automation.Service).run, applicationScope);
|
|
148
|
+
yield* Effect.forkIn(Context.get(context, SessionSearchBuild.Service).run, applicationScope);
|
|
149
|
+
const boundAddress = bound.server.address();
|
|
150
|
+
if (boundAddress && typeof boundAddress !== "string") {
|
|
151
|
+
const gateway = Context.get(context, BrowserTunnelGateway.Service);
|
|
152
|
+
yield* gateway.addReservedLocalPort(boundAddress.port);
|
|
153
|
+
yield* Scope.addFinalizer(applicationScope, gateway.removeReservedLocalPort(boundAddress.port));
|
|
154
|
+
}
|
|
155
|
+
yield* Ref.set(machinesFlag, yield* machinesEnabled2.pipe(Effect.provide(context)));
|
|
156
|
+
yield* Ref.set(application, Option.some(Context.get(context, HttpRouter.HttpRouter).asHttpEffect()));
|
|
157
|
+
yield* status.ready;
|
|
158
|
+
const bus = Context.get(context, Bus.Service);
|
|
159
|
+
return {
|
|
160
|
+
address: bound.http.address,
|
|
161
|
+
shutdown: shutdown.await,
|
|
162
|
+
updateAvailable: (version) => bus.publish(InstallationEvent.UpdateAvailable, { version }).pipe(Effect.asVoid),
|
|
163
|
+
updated: (version) => bus.publish(InstallationEvent.Updated, { version }).pipe(Effect.asVoid)
|
|
164
|
+
};
|
|
165
|
+
}).pipe(withoutParentSpan2, Effect.catchCause((cause) => {
|
|
166
|
+
if (!lifecycle || Cause.hasInterruptsOnly(cause))
|
|
167
|
+
return Effect.failCause(cause);
|
|
168
|
+
return status.fail.pipe(Effect.andThen(Scope.close(applicationScope, Exit.failCause(cause)).pipe(Effect.catchCause((cleanupCause) => Effect.logError("failed to clean up background service boot", { cause: cleanupCause })))), Effect.andThen(Effect.logError("background service boot failed", { cause })), Effect.andThen(Effect.never));
|
|
169
|
+
}));
|
|
170
|
+
if (!lifecycle)
|
|
171
|
+
return yield* boot;
|
|
172
|
+
return yield* Effect.raceFirst(boot, shutdown.await.pipe(Effect.andThen(Effect.interrupt)));
|
|
173
|
+
});
|
|
174
|
+
function listen(options) {
|
|
175
|
+
if (Option.isSome(options.port))
|
|
176
|
+
return bind(options.hostname, options.port.value);
|
|
177
|
+
const next = (port) => bind(options.hostname, port).pipe(Effect.catch((error) => port < 65535 && addressInUse(error) ? next(port + 1) : Effect.fail(error)));
|
|
178
|
+
return next(4096);
|
|
179
|
+
}
|
|
180
|
+
function bind(hostname, port) {
|
|
181
|
+
return Effect.gen(function* () {
|
|
182
|
+
const parentScope = yield* Scope.Scope;
|
|
183
|
+
const serverScope = yield* Scope.fork(parentScope);
|
|
184
|
+
const server = createServer();
|
|
185
|
+
return yield* Effect.gen(function* () {
|
|
186
|
+
const http = yield* NodeHttpServer.make(() => server, { port, host: hostname });
|
|
187
|
+
yield* Effect.addFinalizer(() => Effect.sync(() => server.closeAllConnections()));
|
|
188
|
+
return { http, server, scope: serverScope };
|
|
189
|
+
}).pipe(Effect.provideService(Scope.Scope, serverScope), Effect.onError((cause) => Scope.close(serverScope, Exit.failCause(cause))));
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
function addressInUse(error) {
|
|
193
|
+
if (typeof error !== "object" || error === null || !("cause" in error))
|
|
194
|
+
return false;
|
|
195
|
+
const cause = error.cause;
|
|
196
|
+
return typeof cause === "object" && cause !== null && "code" in cause && cause.code === "EADDRINUSE";
|
|
197
|
+
}
|
|
198
|
+
function dispatch(password, status, application, machinesFlag, version, urls, tmp) {
|
|
199
|
+
const auth = Config2.of({ password: Option.some(password), username: "opencode" });
|
|
200
|
+
return Effect.gen(function* () {
|
|
201
|
+
const request = yield* HttpServerRequest.HttpServerRequest;
|
|
202
|
+
const url = new URL(request.url, "http://localhost");
|
|
203
|
+
const state = yield* status.current;
|
|
204
|
+
const app = yield* Ref.get(application);
|
|
205
|
+
const machines = yield* Ref.get(machinesFlag);
|
|
206
|
+
const ready = state.type === "ready" && Option.isSome(app);
|
|
207
|
+
if (request.method === "GET" && url.pathname === "/api/info" && !ready) {
|
|
208
|
+
if (!(yield* authorizedRequest2(request, auth)))
|
|
209
|
+
return unauthorizedResponse2(request);
|
|
210
|
+
return yield* infoResponse(status, version, urls, tmp);
|
|
211
|
+
}
|
|
212
|
+
if (!isPairingConnectURL(url) && (!ready || !hasPtyConnectTicketURL(url) && !hasPersistentPtyConnectTicketURL(url) && !hasMcpClientTicketURL(url) && !hasBrowserTunnelUpgrade(request) && !(isMachineLinkUpgrade(request) && (yield* machines))) && !(yield* authorizedRequest2(request, auth)))
|
|
213
|
+
return unauthorizedResponse2(request);
|
|
214
|
+
if (ready)
|
|
215
|
+
return yield* app.value;
|
|
216
|
+
return unavailable(state);
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
var infoResponse = Effect.fnUntraced(function* (status, version, urls, tmp) {
|
|
220
|
+
const state = yield* status.current;
|
|
221
|
+
return HttpServerResponse.jsonUnsafe({ version, pid: process.pid, urls: urls(), paths: { tmp } }, {
|
|
222
|
+
status: state.type === "ready" ? 200 : state.type === "failed" ? 500 : 503,
|
|
223
|
+
headers: state.type === "starting" || state.type === "stopping" ? { "retry-after": "1" } : undefined
|
|
224
|
+
});
|
|
225
|
+
});
|
|
226
|
+
function unavailable(status) {
|
|
227
|
+
if (status.type === "failed")
|
|
228
|
+
return HttpServerResponse.jsonUnsafe({
|
|
229
|
+
code: "service_failed",
|
|
230
|
+
message: "The background service could not start.",
|
|
231
|
+
action: "Run `opencode service restart` after checking the service logs."
|
|
232
|
+
}, { status: 503 });
|
|
233
|
+
return HttpServerResponse.jsonUnsafe({ code: status.type === "stopping" ? "service_stopping" : "service_starting" }, { status: 503, headers: { "retry-after": "1" } });
|
|
234
|
+
}
|
|
235
|
+
var installRestartContinuity = Effect.fnUntraced(function* (restart) {
|
|
236
|
+
yield* Effect.forkScoped(restart.resumeSuspendedSessions);
|
|
237
|
+
});
|
|
238
|
+
export {
|
|
239
|
+
exports_process as ServerProcess,
|
|
240
|
+
start
|
|
241
|
+
};
|
package/dist/range.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export * as ByteRange from "./range";
|
|
2
|
+
/** A single `bytes=` range of a `size`-byte body, inclusive. Undefined serves the whole body. */
|
|
3
|
+
export declare function parse(header: string | undefined, size: number): "unsatisfiable" | {
|
|
4
|
+
start: number;
|
|
5
|
+
end: number;
|
|
6
|
+
} | undefined;
|
package/dist/range.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * as RequestSite from "./request-site";
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
import { HttpServerRequest, HttpServerResponse } from "effect/http";
|
|
4
|
+
import { type CorsOptions } from "./cors";
|
|
5
|
+
/**
|
|
6
|
+
* API routes are called by scripts and native clients, not opened as pages from other sites. Browsers label requests
|
|
7
|
+
* with Sec-Fetch-Site and Sec-Fetch-Mode; another site may navigate to the API or call it only from an allowed CORS
|
|
8
|
+
* origin. Clients that send no Sec-Fetch headers (CLI, TUI, SDK, mobile) and same-origin or typed-in requests pass.
|
|
9
|
+
*/
|
|
10
|
+
export declare function rejected(request: HttpServerRequest.HttpServerRequest, options?: CorsOptions): boolean;
|
|
11
|
+
export declare const middleware: (options?: CorsOptions) => <E, R>(app: Effect.Effect<HttpServerResponse.HttpServerResponse, E, R | HttpServerRequest.HttpServerRequest>) => Effect.Effect<HttpServerResponse.HttpServerResponse, E, R | HttpServerRequest.HttpServerRequest>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { withoutParentSpan } from "@radheim/util/observability/tracing";
|