@opencode/server 2.0.8 → 2.0.10
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 +4 -4
- package/dist/api.js +10 -9
- package/dist/auth.js +12 -17
- package/dist/chunks/auth-0ar9gf7q.js +55 -0
- package/dist/chunks/auth-0qzy9yxk.js +163 -0
- package/dist/chunks/auth-1wj0ectp.js +22 -0
- package/dist/chunks/auth-23w8t84j.js +26 -0
- package/dist/chunks/auth-34e6wr3b.js +13 -0
- package/dist/chunks/auth-3582t7j8.js +139 -0
- package/dist/chunks/auth-40g8rvw4.js +59 -0
- package/dist/chunks/auth-5p62ed52.js +36 -0
- package/dist/chunks/auth-6aya8ky6.js +39 -0
- package/dist/chunks/auth-760vtqy2.js +29 -0
- package/dist/chunks/auth-7bj707s9.js +99 -0
- package/dist/chunks/auth-7qtja2kq.js +15 -0
- package/dist/chunks/auth-8e21y1bd.js +20 -0
- package/dist/chunks/auth-8nbs1vvt.js +34 -0
- package/dist/chunks/auth-8ygjd1s8.js +40 -0
- package/dist/chunks/auth-9rqn6x4v.js +16 -0
- package/dist/chunks/auth-b4atwt7w.js +37 -0
- package/dist/chunks/auth-bgzrbsek.js +13 -0
- package/dist/chunks/auth-bkb1xk38.js +42 -0
- package/dist/chunks/auth-bkk2wfbz.js +23 -0
- package/dist/chunks/auth-byzd2nk7.js +21 -0
- package/dist/chunks/auth-cm8xmqjn.js +13 -0
- package/dist/chunks/auth-d2g7egyw.js +25 -0
- package/dist/chunks/auth-e09mshwt.js +23 -0
- package/dist/chunks/auth-erwrh284.js +156 -0
- package/dist/chunks/auth-frv6gfy7.js +33 -0
- package/dist/chunks/auth-fyjxk8m3.js +22 -0
- package/dist/chunks/auth-gsks0nj8.js +149 -0
- package/dist/chunks/auth-hezj1jdf.js +7 -0
- package/dist/chunks/auth-kv6ycdgm.js +77 -0
- package/dist/chunks/auth-m6wvgbfq.js +60 -0
- package/dist/chunks/auth-p5hgn93y.js +26 -0
- package/dist/chunks/auth-pd1pbg0v.js +17 -0
- package/dist/chunks/auth-q4bn6dy8.js +39 -0
- package/dist/chunks/auth-r4dhhtgz.js +346 -0
- package/dist/chunks/auth-rjpqaa8h.js +83 -0
- package/dist/chunks/auth-smaf4a18.js +28 -0
- package/dist/chunks/auth-t8yzmczr.js +18 -0
- package/dist/chunks/auth-tk6nqkmh.js +22 -0
- package/dist/chunks/auth-txhx6f1m.js +13 -0
- package/dist/chunks/auth-vgxn80m1.js +61 -0
- package/dist/chunks/auth-xpxp1sqb.js +22 -0
- package/dist/chunks/auth-xsrtpxyd.js +23 -0
- package/dist/chunks/auth-yc7nft6q.js +5 -0
- package/dist/chunks/auth-z3nth2hg.js +35 -0
- package/dist/chunks/auth-z6kg9h7e.js +19 -0
- package/dist/chunks/auth-zw9j8b8g.js +32 -0
- package/dist/chunks/auth-zxvt7wd3.js +25 -0
- package/dist/chunks/auth-zyv89x5n.js +30 -0
- package/dist/cors.js +10 -36
- package/dist/event-feed.js +20 -60
- package/dist/fetch.js +53 -11
- package/dist/handlers/agent.js +11 -17
- package/dist/handlers/command.js +11 -5
- package/dist/handlers/config.js +11 -16
- package/dist/handlers/credential.js +11 -14
- package/dist/handlers/debug.js +11 -11
- package/dist/handlers/event.js +12 -27
- package/dist/handlers/form.js +11 -9
- package/dist/handlers/fs.js +11 -22
- package/dist/handlers/generate.js +11 -15
- package/dist/handlers/integration.js +10 -142
- package/dist/handlers/location.js +11 -16
- package/dist/handlers/mcp.js +11 -31
- package/dist/handlers/message.js +10 -42
- package/dist/handlers/migration.js +11 -7
- package/dist/handlers/model.js +11 -14
- package/dist/handlers/permission.js +11 -57
- package/dist/handlers/persistent-pty.js +12 -135
- package/dist/handlers/plugin.js +11 -47
- package/dist/handlers/project.js +11 -9
- package/dist/handlers/provider.js +11 -20
- package/dist/handlers/pty-socket.js +6 -4
- package/dist/handlers/pty.js +13 -107
- package/dist/handlers/reference.js +11 -5
- package/dist/handlers/rpc.js +11 -15
- package/dist/handlers/server.js +12 -13
- package/dist/handlers/session-error.js +12 -26
- package/dist/handlers/session.js +10 -311
- package/dist/handlers/shell.js +11 -25
- package/dist/handlers/skill.js +11 -5
- package/dist/handlers/vcs.js +11 -19
- package/dist/handlers/websearch.js +11 -31
- package/dist/handlers/worktree.js +11 -37
- package/dist/handlers.d.ts +1 -1
- package/dist/handlers.js +46 -33
- package/dist/location.js +15 -49
- package/dist/middleware/authorization.js +11 -49
- package/dist/middleware/form-location.js +10 -25
- package/dist/middleware/schema-error.js +8 -15
- package/dist/middleware/session-location.js +10 -19
- package/dist/options.js +5 -1
- package/dist/process.js +108 -28
- package/dist/pty-environment.js +12 -9
- package/dist/request-tracing.js +6 -2
- package/dist/routes.d.ts +2 -2
- package/dist/routes.js +52 -118
- package/dist/server-info.js +12 -22
- package/dist/service-status.js +8 -11
- package/dist/workerd.js +80 -12
- package/package.json +8 -8
package/dist/process.js
CHANGED
|
@@ -1,4 +1,74 @@
|
|
|
1
|
-
|
|
1
|
+
import {
|
|
2
|
+
Config2
|
|
3
|
+
} from "./chunks/auth-zyv89x5n.js";
|
|
4
|
+
import {
|
|
5
|
+
isAllowedCorsOrigin2
|
|
6
|
+
} from "./chunks/auth-q4bn6dy8.js";
|
|
7
|
+
import {
|
|
8
|
+
authorizedRequest2
|
|
9
|
+
} from "./chunks/auth-m6wvgbfq.js";
|
|
10
|
+
import {
|
|
11
|
+
withoutParentSpan2
|
|
12
|
+
} from "./chunks/auth-yc7nft6q.js";
|
|
13
|
+
import"./chunks/auth-smaf4a18.js";
|
|
14
|
+
import"./chunks/auth-0ar9gf7q.js";
|
|
15
|
+
import"./chunks/auth-frv6gfy7.js";
|
|
16
|
+
import"./chunks/auth-23w8t84j.js";
|
|
17
|
+
import"./chunks/auth-z6kg9h7e.js";
|
|
18
|
+
import"./chunks/auth-d2g7egyw.js";
|
|
19
|
+
import"./chunks/auth-40g8rvw4.js";
|
|
20
|
+
import"./chunks/auth-fyjxk8m3.js";
|
|
21
|
+
import"./chunks/auth-760vtqy2.js";
|
|
22
|
+
import"./chunks/auth-r4dhhtgz.js";
|
|
23
|
+
import"./chunks/auth-kv6ycdgm.js";
|
|
24
|
+
import"./chunks/auth-8nbs1vvt.js";
|
|
25
|
+
import"./chunks/auth-pd1pbg0v.js";
|
|
26
|
+
import"./chunks/auth-bgzrbsek.js";
|
|
27
|
+
import"./chunks/auth-34e6wr3b.js";
|
|
28
|
+
import"./chunks/auth-1wj0ectp.js";
|
|
29
|
+
import"./chunks/auth-rjpqaa8h.js";
|
|
30
|
+
import"./chunks/auth-b4atwt7w.js";
|
|
31
|
+
import"./chunks/auth-zxvt7wd3.js";
|
|
32
|
+
import"./chunks/auth-vgxn80m1.js";
|
|
33
|
+
import {
|
|
34
|
+
connectionURLs2
|
|
35
|
+
} from "./chunks/auth-5p62ed52.js";
|
|
36
|
+
import"./chunks/auth-byzd2nk7.js";
|
|
37
|
+
import"./chunks/auth-8e21y1bd.js";
|
|
38
|
+
import"./chunks/auth-bkk2wfbz.js";
|
|
39
|
+
import"./chunks/auth-hezj1jdf.js";
|
|
40
|
+
import"./chunks/auth-3582t7j8.js";
|
|
41
|
+
import"./chunks/auth-0qzy9yxk.js";
|
|
42
|
+
import"./chunks/auth-z3nth2hg.js";
|
|
43
|
+
import"./chunks/auth-cm8xmqjn.js";
|
|
44
|
+
import"./chunks/auth-tk6nqkmh.js";
|
|
45
|
+
import"./chunks/auth-erwrh284.js";
|
|
46
|
+
import"./chunks/auth-6aya8ky6.js";
|
|
47
|
+
import"./chunks/auth-8ygjd1s8.js";
|
|
48
|
+
import"./chunks/auth-e09mshwt.js";
|
|
49
|
+
import"./chunks/auth-7qtja2kq.js";
|
|
50
|
+
import"./chunks/auth-bkb1xk38.js";
|
|
51
|
+
import"./chunks/auth-zw9j8b8g.js";
|
|
52
|
+
import"./chunks/auth-txhx6f1m.js";
|
|
53
|
+
import"./chunks/auth-xpxp1sqb.js";
|
|
54
|
+
import"./chunks/auth-7bj707s9.js";
|
|
55
|
+
import"./chunks/auth-t8yzmczr.js";
|
|
56
|
+
import {
|
|
57
|
+
createRoutes2
|
|
58
|
+
} from "./chunks/auth-gsks0nj8.js";
|
|
59
|
+
import {
|
|
60
|
+
make2
|
|
61
|
+
} from "./chunks/auth-xsrtpxyd.js";
|
|
62
|
+
import {
|
|
63
|
+
__export
|
|
64
|
+
} from "./chunks/auth-9rqn6x4v.js";
|
|
65
|
+
|
|
66
|
+
// src/process.ts
|
|
67
|
+
var exports_process = {};
|
|
68
|
+
__export(exports_process, {
|
|
69
|
+
ServerProcess: () => exports_process,
|
|
70
|
+
start: () => start
|
|
71
|
+
});
|
|
2
72
|
import { NodeHttpServer } from "@effect/platform-node";
|
|
3
73
|
import { Bus } from "@opencode/core/bus";
|
|
4
74
|
import { SessionRestart } from "@opencode/core/session/execution/restart";
|
|
@@ -11,42 +81,42 @@ import {
|
|
|
11
81
|
HttpMiddleware,
|
|
12
82
|
HttpPlatform,
|
|
13
83
|
HttpRouter,
|
|
14
|
-
HttpServer,
|
|
15
84
|
HttpServerRequest,
|
|
16
85
|
HttpServerResponse
|
|
17
86
|
} from "effect/unstable/http";
|
|
18
87
|
import { createServer } from "node:http";
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
import { authorizedRequest } from "./middleware/authorization";
|
|
22
|
-
import { withoutParentSpan } from "./request-tracing";
|
|
23
|
-
import { createRoutes } from "./routes";
|
|
24
|
-
import { ServerInfo } from "./server-info";
|
|
25
|
-
import { Status } from "./service-status";
|
|
26
|
-
const errorResponseLogger = HttpMiddleware.make((app) => HttpMiddleware.logger(Effect.tap(app, (response) => response.status < 400 ? HttpMiddleware.withLoggerDisabled(Effect.void) : Effect.void)));
|
|
27
|
-
export const start = Effect.fn("ServerProcess.start")(function* (options, lifecycle, transform) {
|
|
88
|
+
var errorResponseLogger = HttpMiddleware.make((app) => HttpMiddleware.logger(Effect.tap(app, (response) => response.status < 400 ? HttpMiddleware.withLoggerDisabled(Effect.void) : Effect.void)));
|
|
89
|
+
var start = Effect.fn("ServerProcess.start")(function* (options, lifecycle, transform) {
|
|
28
90
|
const password = options.password;
|
|
29
91
|
if (!password)
|
|
30
|
-
return yield* Effect.fail(Error("Missing server password"));
|
|
31
|
-
const hostname = options.hostname ?? "127.0.0.1"
|
|
92
|
+
return yield* Effect.fail(new Error("Missing server password"));
|
|
93
|
+
const hostname = options.hostname ?? "127.0.0.1";
|
|
94
|
+
const port = Option.fromNullishOr(options.port);
|
|
95
|
+
const shutdown = yield* Latch.make();
|
|
96
|
+
const status = yield* make2();
|
|
97
|
+
const bound = yield* listen({ hostname, port });
|
|
98
|
+
const urls = () => {
|
|
32
99
|
const address = bound.server.address();
|
|
33
100
|
if (address === null || typeof address === "string")
|
|
34
101
|
return [];
|
|
35
102
|
const host = address.family === "IPv6" ? `[${address.address}]` : address.address;
|
|
36
|
-
return
|
|
37
|
-
}
|
|
38
|
-
|
|
103
|
+
return connectionURLs2(`http://${host}:${address.port}`, hostname);
|
|
104
|
+
};
|
|
105
|
+
const application = yield* Ref.make(Option.none());
|
|
106
|
+
yield* bound.http.serve(dispatch(password, status, application, options.app?.version ?? "unknown", urls, Global.Path.tmp).pipe(HttpMiddleware.cors({ allowedOrigins: (origin) => isAllowedCorsOrigin2(origin, options), maxAge: 86400 })), errorResponseLogger).pipe(withoutParentSpan2);
|
|
39
107
|
if (lifecycle)
|
|
40
108
|
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);
|
|
41
|
-
const parentScope = yield* Scope.Scope
|
|
109
|
+
const parentScope = yield* Scope.Scope;
|
|
110
|
+
const applicationScope = yield* Scope.fork(parentScope);
|
|
42
111
|
yield* Effect.addFinalizer(() => status.beginStopping.pipe(Effect.andThen(Ref.set(application, Option.none())), Effect.andThen(Effect.sync(() => bound.server.closeAllConnections()))));
|
|
43
112
|
const boot = Effect.gen(function* () {
|
|
44
|
-
const context = yield* Layer.buildWithScope(
|
|
113
|
+
const context = yield* Layer.buildWithScope(createRoutes2({
|
|
45
114
|
...options,
|
|
46
115
|
password
|
|
47
116
|
}, urls).pipe(Layer.provideMerge(NodeHttpServer.layerHttpServices)), applicationScope);
|
|
48
|
-
if (lifecycle)
|
|
117
|
+
if (lifecycle) {
|
|
49
118
|
yield* installRestartContinuity(Context.get(context, SessionRestart.Service)).pipe(Effect.provideService(Scope.Scope, applicationScope));
|
|
119
|
+
}
|
|
50
120
|
const app = Context.get(context, HttpRouter.HttpRouter).asHttpEffect().pipe(HttpMiddleware.compression(), Effect.provideService(HttpPlatform.HttpPlatform, Context.get(context, HttpPlatform.HttpPlatform)));
|
|
51
121
|
yield* Ref.set(application, Option.some(transform ? transform(app) : app));
|
|
52
122
|
yield* status.ready;
|
|
@@ -74,7 +144,9 @@ function listen(options) {
|
|
|
74
144
|
}
|
|
75
145
|
function bind(hostname, port) {
|
|
76
146
|
return Effect.gen(function* () {
|
|
77
|
-
const parentScope = yield* Scope.Scope
|
|
147
|
+
const parentScope = yield* Scope.Scope;
|
|
148
|
+
const serverScope = yield* Scope.fork(parentScope);
|
|
149
|
+
const server = createServer();
|
|
78
150
|
return yield* Effect.gen(function* () {
|
|
79
151
|
const http = yield* NodeHttpServer.make(() => server, { port, host: hostname });
|
|
80
152
|
yield* Effect.addFinalizer(() => Effect.sync(() => server.closeAllConnections()));
|
|
@@ -84,20 +156,24 @@ function bind(hostname, port) {
|
|
|
84
156
|
}
|
|
85
157
|
function addressInUse(error) {
|
|
86
158
|
if (typeof error !== "object" || error === null || !("cause" in error))
|
|
87
|
-
return
|
|
159
|
+
return false;
|
|
88
160
|
const cause = error.cause;
|
|
89
161
|
return typeof cause === "object" && cause !== null && "code" in cause && cause.code === "EADDRINUSE";
|
|
90
162
|
}
|
|
91
163
|
function dispatch(password, status, application, version, urls, tmp) {
|
|
92
|
-
const auth =
|
|
164
|
+
const auth = Config2.of({ password: Option.some(password), username: "opencode" });
|
|
93
165
|
return Effect.gen(function* () {
|
|
94
|
-
const request = yield* HttpServerRequest.HttpServerRequest
|
|
166
|
+
const request = yield* HttpServerRequest.HttpServerRequest;
|
|
167
|
+
const url = new URL(request.url, "http://localhost");
|
|
168
|
+
const state = yield* status.current;
|
|
169
|
+
const app = yield* Ref.get(application);
|
|
170
|
+
const ready = state.type === "ready" && Option.isSome(app);
|
|
95
171
|
if (request.method === "GET" && url.pathname === "/api/info" && !ready) {
|
|
96
|
-
if (!(yield*
|
|
172
|
+
if (!(yield* authorizedRequest2(request, auth)))
|
|
97
173
|
return unauthorized();
|
|
98
174
|
return yield* infoResponse(status, version, urls, tmp);
|
|
99
175
|
}
|
|
100
|
-
if ((!ready || !hasPtyConnectTicketURL(url) && !hasPersistentPtyConnectTicketURL(url)) && !(yield*
|
|
176
|
+
if ((!ready || !hasPtyConnectTicketURL(url) && !hasPersistentPtyConnectTicketURL(url)) && !(yield* authorizedRequest2(request, auth)))
|
|
101
177
|
return unauthorized();
|
|
102
178
|
if (ready)
|
|
103
179
|
return yield* app.value;
|
|
@@ -110,11 +186,11 @@ function unauthorized() {
|
|
|
110
186
|
headers: { "www-authenticate": 'Basic realm="Secure Area"' }
|
|
111
187
|
});
|
|
112
188
|
}
|
|
113
|
-
|
|
189
|
+
var infoResponse = Effect.fnUntraced(function* (status, version, urls, tmp) {
|
|
114
190
|
const state = yield* status.current;
|
|
115
191
|
return HttpServerResponse.jsonUnsafe({ version, pid: process.pid, urls: urls(), paths: { tmp } }, {
|
|
116
192
|
status: state.type === "ready" ? 200 : state.type === "failed" ? 500 : 503,
|
|
117
|
-
headers: state.type === "starting" || state.type === "stopping" ? { "retry-after": "1" } :
|
|
193
|
+
headers: state.type === "starting" || state.type === "stopping" ? { "retry-after": "1" } : undefined
|
|
118
194
|
});
|
|
119
195
|
});
|
|
120
196
|
function unavailable(status) {
|
|
@@ -126,6 +202,10 @@ function unavailable(status) {
|
|
|
126
202
|
}, { status: 503 });
|
|
127
203
|
return HttpServerResponse.jsonUnsafe({ code: status.type === "stopping" ? "service_stopping" : "service_starting" }, { status: 503, headers: { "retry-after": "1" } });
|
|
128
204
|
}
|
|
129
|
-
|
|
205
|
+
var installRestartContinuity = Effect.fnUntraced(function* (restart) {
|
|
130
206
|
yield* Effect.forkScoped(restart.resumeSuspendedSessions);
|
|
131
207
|
});
|
|
208
|
+
export {
|
|
209
|
+
exports_process as ServerProcess,
|
|
210
|
+
start
|
|
211
|
+
};
|
package/dist/pty-environment.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import {
|
|
2
|
+
Service2,
|
|
3
|
+
layer2,
|
|
4
|
+
node2,
|
|
5
|
+
exports_pty_environment
|
|
6
|
+
} from "./chunks/auth-bkk2wfbz.js";
|
|
7
|
+
export {
|
|
8
|
+
exports_pty_environment as PtyEnvironment,
|
|
9
|
+
Service2 as Service,
|
|
10
|
+
layer2 as layer,
|
|
11
|
+
node2 as node
|
|
12
|
+
};
|
package/dist/request-tracing.js
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
withoutParentSpan2
|
|
3
|
+
} from "./chunks/auth-yc7nft6q.js";
|
|
4
|
+
export {
|
|
5
|
+
withoutParentSpan2 as withoutParentSpan
|
|
6
|
+
};
|
package/dist/routes.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ import { HttpRouter } from "effect/unstable/http";
|
|
|
24
24
|
import { Layer } from "effect";
|
|
25
25
|
import { PtyEnvironment } from "./pty-environment";
|
|
26
26
|
import type { ServerOptions } from "./options";
|
|
27
|
-
export declare function createRoutes(options?: ServerOptions, serviceURLs?: () => ReadonlyArray<string>, overrides?: LayerNode.Replacements): Layer.Layer<Global.Service | Database.Service | Bus.Service | import("effect/unstable/http/HttpClient").HttpClient | Project.Service | Credential.Service | WellKnown.Service | Workspace.Service | PermissionSaved.Service | PersistentPty.Service | LocationServiceMap.Service | SdkPlugins.Service | PluginUpdate.Service |
|
|
27
|
+
export declare function createRoutes(options?: ServerOptions, serviceURLs?: () => ReadonlyArray<string>, overrides?: LayerNode.Replacements): Layer.Layer<Global.Service | Database.Service | Bus.Service | import("effect/unstable/http/HttpClient").HttpClient | Project.Service | Credential.Service | WellKnown.Service | Workspace.Service | PermissionSaved.Service | PersistentPty.Service | LocationServiceMap.Service | SdkPlugins.Service | PluginUpdate.Service | Job.Service | Session.Service | Worktree.Service | Instance.Service | SessionRestart.Service | PtyTicket.Service | SessionTransfer.Service | LocationActivity.Service | PtyEnvironment.Service | HttpRouter.HttpRouter, Error | PersistentPty.UnavailableError, import("effect/FileSystem").FileSystem | import("effect/Path").Path | import("effect/unstable/http/Etag").Generator | import("effect/unstable/http/HttpPlatform").HttpPlatform>;
|
|
28
28
|
type InstanceNode = (replacements: () => LayerNode.Replacements) => LayerNode.Provider<Instance.Service, never, typeof Node.tags.values.global>;
|
|
29
|
-
export declare function createEmbeddedRoutes(options?: ServerOptions, overrides?: LayerNode.Replacements, instances?: InstanceNode): Layer.Layer<Global.Service | Database.Service | Bus.Service | import("effect/unstable/http/HttpClient").HttpClient | Project.Service | Credential.Service | WellKnown.Service | Workspace.Service | PermissionSaved.Service | PersistentPty.Service | LocationServiceMap.Service | SdkPlugins.Service | PluginUpdate.Service |
|
|
29
|
+
export declare function createEmbeddedRoutes(options?: ServerOptions, overrides?: LayerNode.Replacements, instances?: InstanceNode): Layer.Layer<Global.Service | Database.Service | Bus.Service | import("effect/unstable/http/HttpClient").HttpClient | Project.Service | Credential.Service | WellKnown.Service | Workspace.Service | PermissionSaved.Service | PersistentPty.Service | LocationServiceMap.Service | SdkPlugins.Service | PluginUpdate.Service | Job.Service | Session.Service | Worktree.Service | Instance.Service | SessionRestart.Service | PtyTicket.Service | SessionTransfer.Service | LocationActivity.Service | PtyEnvironment.Service | HttpRouter.HttpRouter, Error | PersistentPty.UnavailableError, import("effect/FileSystem").FileSystem | import("effect/Path").Path | import("effect/unstable/http/Etag").Generator | import("effect/unstable/http/HttpPlatform").HttpPlatform>;
|
|
30
30
|
export {};
|
package/dist/routes.js
CHANGED
|
@@ -1,118 +1,52 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import
|
|
40
|
-
import
|
|
41
|
-
import
|
|
42
|
-
import
|
|
43
|
-
import
|
|
44
|
-
import
|
|
45
|
-
import
|
|
46
|
-
import
|
|
47
|
-
import
|
|
48
|
-
import
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
EventLogger.node,
|
|
54
|
-
httpClient,
|
|
55
|
-
Job.node,
|
|
56
|
-
Project.node,
|
|
57
|
-
Worktree.node,
|
|
58
|
-
Session.node,
|
|
59
|
-
Instance.node,
|
|
60
|
-
SessionTransfer.node,
|
|
61
|
-
SdkPlugins.node,
|
|
62
|
-
PluginUpdate.node,
|
|
63
|
-
PermissionSaved.node,
|
|
64
|
-
PtyTicket.node,
|
|
65
|
-
PersistentPty.node,
|
|
66
|
-
Credential.node,
|
|
67
|
-
WellKnown.node,
|
|
68
|
-
PtyEnvironment.node,
|
|
69
|
-
LocationServiceMap.node,
|
|
70
|
-
LocationActivity.node,
|
|
71
|
-
SessionRestart.node,
|
|
72
|
-
Workspace.node
|
|
73
|
-
], applicationServices = LayerNode.group(applicationServiceNodes);
|
|
74
|
-
export function createRoutes(options = {}, serviceURLs = () => [], overrides = []) {
|
|
75
|
-
return makeRoutes(options.password ? ServerAuth.Config.configLayer({ password: Option.some(options.password) }) : ServerAuth.Config.layer, options, serviceURLs, overrides);
|
|
76
|
-
}
|
|
77
|
-
export function createEmbeddedRoutes(options = {}, overrides = [], instances) {
|
|
78
|
-
return makeRoutes(ServerAuth.Config.configLayer({ password: Option.none() }), options, () => [], overrides, instances);
|
|
79
|
-
}
|
|
80
|
-
function makeRoutes(auth, options, serviceURLs, overrides, instances) {
|
|
81
|
-
const standard = [
|
|
82
|
-
Database.node.replace(Database.configured(options.database)),
|
|
83
|
-
PersistentPty.node.replace(PersistentPty.configured(options.pty)),
|
|
84
|
-
Bus.node.replace(Bus.configured({ persist: options.events?.persist })),
|
|
85
|
-
App.node.replace(App.configured(options.app)),
|
|
86
|
-
ModelsDev.node.replace(ModelsDev.configured(options.models)),
|
|
87
|
-
Watcher.node.replace(Watcher.configured({ enabled: options.fs?.filewatcher })),
|
|
88
|
-
FileSystemSearch.node.replace(FileSystemSearch.configured({ fff: options.fs?.fff })),
|
|
89
|
-
Global.node.replace(Global.layerWith(options.config?.directory ? { config: options.config.directory } : {})),
|
|
90
|
-
Config.node.replace(Config.configured({
|
|
91
|
-
project: options.config?.project,
|
|
92
|
-
file: options.config?.file,
|
|
93
|
-
content: options.config?.content
|
|
94
|
-
})),
|
|
95
|
-
InstructionDiscovery.node.replace(InstructionDiscovery.configured({ project: options.config?.project })),
|
|
96
|
-
ShellSelect.node.replace(ShellSelect.configured({ gitbash: options.windows?.gitbash })),
|
|
97
|
-
Mcp.node.replace(Mcp.configured({
|
|
98
|
-
clientInfo: {
|
|
99
|
-
name: options.app?.name ?? "opencode",
|
|
100
|
-
version: options.app?.version ?? "unknown"
|
|
101
|
-
}
|
|
102
|
-
}))
|
|
103
|
-
], build = (overrides) => {
|
|
104
|
-
const replacements = [
|
|
105
|
-
...standard,
|
|
106
|
-
...instances ? [Instance.node.replace(instances(() => replacements))] : [],
|
|
107
|
-
...overrides
|
|
108
|
-
];
|
|
109
|
-
return AppNodeBuilder.build(applicationServices, replacements);
|
|
110
|
-
};
|
|
111
|
-
return (options.simulation ? Layer.unwrap(Effect.gen(function* () {
|
|
112
|
-
const { simulationReplacements } = yield* Effect.promise(() => import("@opencode/simulation/backend")), simulation = yield* simulationReplacements({ version: App.make(options.app).version });
|
|
113
|
-
return build([...overrides, ...simulation]);
|
|
114
|
-
})) : build(overrides)).pipe(Layer.flatMap((context) => {
|
|
115
|
-
const services = Layer.succeedContext(context), requestServices = Layer.merge(Layer.succeedContext(Context.pick(Database.Service, Credential.Service, PermissionSaved.Service, PluginUpdate.Service, Project.Service, WellKnown.Service)(context)), ServerInfo.layer(serviceURLs, Context.get(context, Global.Service).tmp, options.app)), api = HttpApiBuilder.layer(Api, { openapiPath: "/openapi.json" }).pipe(Layer.provide(handlers.pipe(Layer.provide(services), Layer.provide(Layer.succeed(CorsConfig, options)))), Layer.provide(formLocationLayer), Layer.provide(sessionLocationLayer), Layer.provide(layer), Layer.provide(authorizationLayer), Layer.provide(schemaErrorLayer), Layer.provide(auth), HttpRouter.provideRequest(requestServices), Layer.provideMerge(services), Layer.provideMerge(HttpRouter.layer));
|
|
116
|
-
return Layer.merge(api, V1Migration.layer.pipe(Layer.provide(services)));
|
|
117
|
-
}));
|
|
118
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
createRoutes2,
|
|
3
|
+
createEmbeddedRoutes2
|
|
4
|
+
} from "./chunks/auth-gsks0nj8.js";
|
|
5
|
+
import"./chunks/auth-t8yzmczr.js";
|
|
6
|
+
import"./chunks/auth-m6wvgbfq.js";
|
|
7
|
+
import"./chunks/auth-7bj707s9.js";
|
|
8
|
+
import"./chunks/auth-pd1pbg0v.js";
|
|
9
|
+
import"./chunks/auth-tk6nqkmh.js";
|
|
10
|
+
import"./chunks/auth-8nbs1vvt.js";
|
|
11
|
+
import"./chunks/auth-cm8xmqjn.js";
|
|
12
|
+
import"./chunks/auth-1wj0ectp.js";
|
|
13
|
+
import"./chunks/auth-bkb1xk38.js";
|
|
14
|
+
import"./chunks/auth-z3nth2hg.js";
|
|
15
|
+
import"./chunks/auth-6aya8ky6.js";
|
|
16
|
+
import"./chunks/auth-d2g7egyw.js";
|
|
17
|
+
import"./chunks/auth-b4atwt7w.js";
|
|
18
|
+
import"./chunks/auth-0qzy9yxk.js";
|
|
19
|
+
import"./chunks/auth-zw9j8b8g.js";
|
|
20
|
+
import"./chunks/auth-byzd2nk7.js";
|
|
21
|
+
import"./chunks/auth-zxvt7wd3.js";
|
|
22
|
+
import"./chunks/auth-fyjxk8m3.js";
|
|
23
|
+
import"./chunks/auth-bgzrbsek.js";
|
|
24
|
+
import"./chunks/auth-8e21y1bd.js";
|
|
25
|
+
import"./chunks/auth-3582t7j8.js";
|
|
26
|
+
import"./chunks/auth-34e6wr3b.js";
|
|
27
|
+
import"./chunks/auth-erwrh284.js";
|
|
28
|
+
import"./chunks/auth-40g8rvw4.js";
|
|
29
|
+
import"./chunks/auth-e09mshwt.js";
|
|
30
|
+
import"./chunks/auth-txhx6f1m.js";
|
|
31
|
+
import"./chunks/auth-xpxp1sqb.js";
|
|
32
|
+
import"./chunks/auth-7qtja2kq.js";
|
|
33
|
+
import"./chunks/auth-vgxn80m1.js";
|
|
34
|
+
import"./chunks/auth-hezj1jdf.js";
|
|
35
|
+
import"./chunks/auth-760vtqy2.js";
|
|
36
|
+
import"./chunks/auth-r4dhhtgz.js";
|
|
37
|
+
import"./chunks/auth-8ygjd1s8.js";
|
|
38
|
+
import"./chunks/auth-kv6ycdgm.js";
|
|
39
|
+
import"./chunks/auth-zyv89x5n.js";
|
|
40
|
+
import"./chunks/auth-bkk2wfbz.js";
|
|
41
|
+
import"./chunks/auth-q4bn6dy8.js";
|
|
42
|
+
import"./chunks/auth-rjpqaa8h.js";
|
|
43
|
+
import"./chunks/auth-5p62ed52.js";
|
|
44
|
+
import"./chunks/auth-z6kg9h7e.js";
|
|
45
|
+
import"./chunks/auth-23w8t84j.js";
|
|
46
|
+
import"./chunks/auth-frv6gfy7.js";
|
|
47
|
+
import"./chunks/auth-0ar9gf7q.js";
|
|
48
|
+
import"./chunks/auth-smaf4a18.js";
|
|
49
|
+
export {
|
|
50
|
+
createEmbeddedRoutes2 as createEmbeddedRoutes,
|
|
51
|
+
createRoutes2 as createRoutes
|
|
52
|
+
};
|
package/dist/server-info.js
CHANGED
|
@@ -1,22 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return [
|
|
14
|
-
...new Set(Object.values(networkInterfaces()).flatMap((entries) => entries ?? []).filter((entry) => !entry.internal && entry.family === family).map((entry) => {
|
|
15
|
-
const result = new URL(value);
|
|
16
|
-
result.hostname = family === "IPv6" ? `[${entry.address}]` : entry.address;
|
|
17
|
-
return result.toString().replace(/\/$/, "");
|
|
18
|
-
}))
|
|
19
|
-
];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export * as ServerInfo from "./server-info";
|
|
1
|
+
import {
|
|
2
|
+
Service4,
|
|
3
|
+
layer4,
|
|
4
|
+
connectionURLs2,
|
|
5
|
+
exports_server_info
|
|
6
|
+
} from "./chunks/auth-5p62ed52.js";
|
|
7
|
+
export {
|
|
8
|
+
exports_server_info as ServerInfo,
|
|
9
|
+
Service4 as Service,
|
|
10
|
+
connectionURLs2 as connectionURLs,
|
|
11
|
+
layer4 as layer
|
|
12
|
+
};
|
package/dist/service-status.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
beginStopping
|
|
10
|
-
};
|
|
11
|
-
});
|
|
1
|
+
import {
|
|
2
|
+
make2,
|
|
3
|
+
exports_service_status
|
|
4
|
+
} from "./chunks/auth-xsrtpxyd.js";
|
|
5
|
+
export {
|
|
6
|
+
exports_service_status as Status,
|
|
7
|
+
make2 as make
|
|
8
|
+
};
|
package/dist/workerd.js
CHANGED
|
@@ -1,4 +1,63 @@
|
|
|
1
|
-
|
|
1
|
+
import"./chunks/auth-q4bn6dy8.js";
|
|
2
|
+
import"./chunks/auth-smaf4a18.js";
|
|
3
|
+
import"./chunks/auth-0ar9gf7q.js";
|
|
4
|
+
import"./chunks/auth-frv6gfy7.js";
|
|
5
|
+
import"./chunks/auth-23w8t84j.js";
|
|
6
|
+
import"./chunks/auth-z6kg9h7e.js";
|
|
7
|
+
import"./chunks/auth-zyv89x5n.js";
|
|
8
|
+
import"./chunks/auth-d2g7egyw.js";
|
|
9
|
+
import"./chunks/auth-40g8rvw4.js";
|
|
10
|
+
import"./chunks/auth-fyjxk8m3.js";
|
|
11
|
+
import"./chunks/auth-760vtqy2.js";
|
|
12
|
+
import"./chunks/auth-r4dhhtgz.js";
|
|
13
|
+
import"./chunks/auth-kv6ycdgm.js";
|
|
14
|
+
import"./chunks/auth-8nbs1vvt.js";
|
|
15
|
+
import"./chunks/auth-pd1pbg0v.js";
|
|
16
|
+
import"./chunks/auth-bgzrbsek.js";
|
|
17
|
+
import"./chunks/auth-34e6wr3b.js";
|
|
18
|
+
import"./chunks/auth-1wj0ectp.js";
|
|
19
|
+
import"./chunks/auth-rjpqaa8h.js";
|
|
20
|
+
import"./chunks/auth-b4atwt7w.js";
|
|
21
|
+
import"./chunks/auth-zxvt7wd3.js";
|
|
22
|
+
import"./chunks/auth-vgxn80m1.js";
|
|
23
|
+
import"./chunks/auth-5p62ed52.js";
|
|
24
|
+
import"./chunks/auth-byzd2nk7.js";
|
|
25
|
+
import"./chunks/auth-8e21y1bd.js";
|
|
26
|
+
import"./chunks/auth-bkk2wfbz.js";
|
|
27
|
+
import"./chunks/auth-hezj1jdf.js";
|
|
28
|
+
import"./chunks/auth-3582t7j8.js";
|
|
29
|
+
import"./chunks/auth-0qzy9yxk.js";
|
|
30
|
+
import"./chunks/auth-z3nth2hg.js";
|
|
31
|
+
import"./chunks/auth-cm8xmqjn.js";
|
|
32
|
+
import"./chunks/auth-tk6nqkmh.js";
|
|
33
|
+
import"./chunks/auth-erwrh284.js";
|
|
34
|
+
import"./chunks/auth-6aya8ky6.js";
|
|
35
|
+
import"./chunks/auth-8ygjd1s8.js";
|
|
36
|
+
import"./chunks/auth-e09mshwt.js";
|
|
37
|
+
import"./chunks/auth-7qtja2kq.js";
|
|
38
|
+
import"./chunks/auth-bkb1xk38.js";
|
|
39
|
+
import"./chunks/auth-zw9j8b8g.js";
|
|
40
|
+
import"./chunks/auth-txhx6f1m.js";
|
|
41
|
+
import"./chunks/auth-xpxp1sqb.js";
|
|
42
|
+
import"./chunks/auth-7bj707s9.js";
|
|
43
|
+
import"./chunks/auth-m6wvgbfq.js";
|
|
44
|
+
import"./chunks/auth-t8yzmczr.js";
|
|
45
|
+
import"./chunks/auth-gsks0nj8.js";
|
|
46
|
+
import {
|
|
47
|
+
make3
|
|
48
|
+
} from "./chunks/auth-p5hgn93y.js";
|
|
49
|
+
import {
|
|
50
|
+
__export
|
|
51
|
+
} from "./chunks/auth-9rqn6x4v.js";
|
|
52
|
+
|
|
53
|
+
// src/workerd.ts
|
|
54
|
+
var exports_workerd = {};
|
|
55
|
+
__export(exports_workerd, {
|
|
56
|
+
ServerWorkerd: () => exports_workerd,
|
|
57
|
+
create: () => create,
|
|
58
|
+
replacements: () => replacements,
|
|
59
|
+
serverOptions: () => serverOptions
|
|
60
|
+
});
|
|
2
61
|
import { Effect, Layer } from "effect";
|
|
3
62
|
import { ConfigPluginSource } from "@opencode/core/config/plugin/source";
|
|
4
63
|
import { Database } from "@opencode/core/database/database";
|
|
@@ -10,21 +69,20 @@ import { Pty } from "@opencode/core/pty";
|
|
|
10
69
|
import { Snapshot } from "@opencode/core/snapshot";
|
|
11
70
|
import { Vcs } from "@opencode/core/vcs";
|
|
12
71
|
import { CrossSpawnSpawner } from "@opencode/util/cross-spawn-spawner";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return ServerFetch.make(serverOptions(options), { overrides: replacements(options) });
|
|
72
|
+
function create(options) {
|
|
73
|
+
return make3(serverOptions(options), { overrides: replacements(options) });
|
|
16
74
|
}
|
|
17
|
-
|
|
75
|
+
function serverOptions(options) {
|
|
18
76
|
return {
|
|
19
77
|
app: options.app,
|
|
20
78
|
password: options.password,
|
|
21
|
-
fs: { filewatcher:
|
|
22
|
-
events: { persist:
|
|
79
|
+
fs: { filewatcher: false, fff: false },
|
|
80
|
+
events: { persist: true },
|
|
23
81
|
config: { content: options.config?.content },
|
|
24
82
|
models: options.models
|
|
25
83
|
};
|
|
26
84
|
}
|
|
27
|
-
|
|
85
|
+
function replacements(options) {
|
|
28
86
|
return [
|
|
29
87
|
Database.node.replace(Database.configuredClient(sqliteLayer({ storage: options.storage }))),
|
|
30
88
|
CrossSpawnSpawner.node.replace(EnvironmentUnavailable.layer),
|
|
@@ -36,7 +94,8 @@ export function replacements(options) {
|
|
|
36
94
|
ConfigPluginSource.node.replace(ConfigPluginSource.empty)
|
|
37
95
|
];
|
|
38
96
|
}
|
|
39
|
-
|
|
97
|
+
var unavailable = (what) => Effect.die(new Error(`${what} is unavailable in the workerd profile`));
|
|
98
|
+
var vcsLayer = Layer.succeed(Vcs.Service, Vcs.Service.of({
|
|
40
99
|
base: () => Effect.succeed(null),
|
|
41
100
|
transform: () => Effect.succeed({ dispose: Effect.void }),
|
|
42
101
|
reload: () => Effect.void,
|
|
@@ -44,14 +103,17 @@ const unavailable = (what) => Effect.die(Error(`${what} is unavailable in the wo
|
|
|
44
103
|
branches: () => Effect.succeed([]),
|
|
45
104
|
status: () => Effect.succeed([]),
|
|
46
105
|
diff: () => Effect.succeed([])
|
|
47
|
-
}))
|
|
106
|
+
}));
|
|
107
|
+
var fileSystemLayer = Layer.succeed(FileSystem.Service, FileSystem.Service.of({
|
|
48
108
|
read: () => unavailable("FileSystem.read"),
|
|
49
109
|
list: () => unavailable("FileSystem.list"),
|
|
50
110
|
find: () => unavailable("FileSystem.find"),
|
|
51
111
|
write: () => unavailable("FileSystem.write")
|
|
52
|
-
}))
|
|
112
|
+
}));
|
|
113
|
+
var fileSystemSearchLayer = Layer.succeed(FileSystemSearch.Service, FileSystemSearch.Service.of({
|
|
53
114
|
find: () => unavailable("FileSystemSearch.find")
|
|
54
|
-
}))
|
|
115
|
+
}));
|
|
116
|
+
var ptyLayer = Layer.succeed(Pty.Service, Pty.Service.of({
|
|
55
117
|
list: () => Effect.succeed([]),
|
|
56
118
|
get: (ptyID) => Effect.fail(new Pty.NotFoundError({ ptyID })),
|
|
57
119
|
create: () => unavailable("Pty.create"),
|
|
@@ -60,3 +122,9 @@ const unavailable = (what) => Effect.die(Error(`${what} is unavailable in the wo
|
|
|
60
122
|
write: (ptyID) => Effect.fail(new Pty.NotFoundError({ ptyID })),
|
|
61
123
|
attach: (ptyID) => Effect.fail(new Pty.NotFoundError({ ptyID }))
|
|
62
124
|
}));
|
|
125
|
+
export {
|
|
126
|
+
exports_workerd as ServerWorkerd,
|
|
127
|
+
create,
|
|
128
|
+
replacements,
|
|
129
|
+
serverOptions
|
|
130
|
+
};
|