@opencode/server 0.0.0-dev-1352 → 0.0.0-dev-1358
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.js +5 -5
- package/dist/auth.js +1 -1
- package/dist/chunks/{workerd-fdy3gtcd.js → request-tracing-1nsytpdt.js} +4 -4
- package/dist/chunks/{workerd-g7jcf7zq.js → request-tracing-294h7qkd.js} +6 -6
- package/dist/chunks/{workerd-rktygpea.js → request-tracing-29nx48hm.js} +4 -1
- package/dist/chunks/{workerd-j605n900.js → request-tracing-3w2mqh28.js} +2 -2
- package/dist/chunks/{workerd-ws2ckpmb.js → request-tracing-5ky8bme5.js} +3 -3
- package/dist/chunks/{workerd-k12h8tw9.js → request-tracing-6anyjjh1.js} +1 -1
- package/dist/chunks/request-tracing-6hw64pe6.js +108 -0
- package/dist/chunks/{workerd-6pm6ek88.js → request-tracing-6pm6ek88.js} +1 -1
- package/dist/chunks/{workerd-yvy5qft7.js → request-tracing-7r996r31.js} +2 -2
- package/dist/chunks/{workerd-raj3p8q0.js → request-tracing-8gbtt6ty.js} +3 -3
- package/dist/chunks/{workerd-8sb6qqpn.js → request-tracing-8sb6qqpn.js} +1 -1
- package/dist/chunks/{workerd-341zm3rs.js → request-tracing-8y9zssdg.js} +2 -2
- package/dist/chunks/{workerd-ggw25rqf.js → request-tracing-ar950k47.js} +1 -1
- package/dist/chunks/{workerd-72bf7qt9.js → request-tracing-br4x4prt.js} +3 -3
- package/dist/chunks/{workerd-0dfmev2z.js → request-tracing-ca564221.js} +1 -1
- package/dist/chunks/{workerd-qgjb3f4w.js → request-tracing-cj97w75w.js} +2 -2
- package/dist/chunks/{workerd-89vcfemc.js → request-tracing-daegfhsz.js} +15 -11
- package/dist/chunks/{workerd-844nmnmk.js → request-tracing-ddhjwr2w.js} +2 -2
- package/dist/chunks/{workerd-kc553r92.js → request-tracing-df03ef4a.js} +2 -2
- package/dist/chunks/{workerd-djr0jy89.js → request-tracing-djr0jy89.js} +1 -1
- package/dist/chunks/{workerd-0q7s66m2.js → request-tracing-e6e4kz0w.js} +4 -4
- package/dist/chunks/{workerd-2h3x7256.js → request-tracing-eacgzt6w.js} +1 -1
- package/dist/chunks/{workerd-fsvp99pe.js → request-tracing-ehyp3zqd.js} +1 -1
- package/dist/chunks/{workerd-qcnb494j.js → request-tracing-esvnag9e.js} +2 -2
- package/dist/chunks/{workerd-tktas153.js → request-tracing-f412ctvv.js} +2 -2
- package/dist/chunks/{workerd-50kbksvb.js → request-tracing-g23ffrnz.js} +2 -2
- package/dist/chunks/{workerd-n9xnk9z3.js → request-tracing-g354sg86.js} +2 -2
- package/dist/chunks/{workerd-ntf3tw9k.js → request-tracing-hbrnhmez.js} +1 -1
- package/dist/chunks/{workerd-zs3a96ke.js → request-tracing-htk4x1jk.js} +2 -2
- package/dist/chunks/{workerd-j4at0y5c.js → request-tracing-j4at0y5c.js} +1 -1
- package/dist/chunks/{workerd-j6y32kmq.js → request-tracing-javgytnb.js} +2 -2
- package/dist/chunks/{workerd-8y4d9f30.js → request-tracing-jhs8rzvk.js} +3 -3
- package/dist/chunks/request-tracing-ka2mtp6f.js +189 -0
- package/dist/chunks/{workerd-zs1mkg1y.js → request-tracing-khe9dd99.js} +2 -2
- package/dist/chunks/{workerd-pertn7qr.js → request-tracing-mq10h3bj.js} +4 -4
- package/dist/chunks/{workerd-myqk22k5.js → request-tracing-myqk22k5.js} +2 -2
- package/dist/chunks/{workerd-cgcw2b0e.js → request-tracing-phgds112.js} +2 -2
- package/dist/chunks/{workerd-zmrq0y42.js → request-tracing-r682v2h3.js} +2 -2
- package/dist/chunks/request-tracing-r6qsbz4y.js +20 -0
- package/dist/chunks/{workerd-fcw485c9.js → request-tracing-rg932pab.js} +2 -2
- package/dist/chunks/{workerd-e0ppd0jy.js → request-tracing-s802fzg1.js} +10 -10
- package/dist/chunks/{workerd-t32e1bbt.js → request-tracing-t32e1bbt.js} +1 -1
- package/dist/chunks/{workerd-8vb7b9fr.js → request-tracing-tttb6mvj.js} +4 -4
- package/dist/chunks/{workerd-7wqhvmdw.js → request-tracing-v5qprkre.js} +4 -4
- package/dist/chunks/{workerd-w9jcwh65.js → request-tracing-w9jcwh65.js} +1 -1
- package/dist/chunks/{workerd-fegnxd42.js → request-tracing-wjh98yw2.js} +1 -1
- package/dist/chunks/{workerd-nessw55r.js → request-tracing-wjhv2a2x.js} +20 -16
- package/dist/chunks/{workerd-chs3pn0j.js → request-tracing-ww68cgwg.js} +5 -5
- package/dist/chunks/{workerd-dyvstyyh.js → request-tracing-x1nd0396.js} +4 -4
- package/dist/chunks/{workerd-x2qy7jg1.js → request-tracing-x2qy7jg1.js} +1 -1
- package/dist/chunks/{workerd-sn8sqewc.js → request-tracing-y8sa9sbe.js} +2 -2
- package/dist/chunks/{workerd-7tv8nec1.js → request-tracing-ykr4m3zx.js} +1 -1
- package/dist/chunks/{workerd-gqstb6bx.js → request-tracing-z0v7xmc8.js} +2 -2
- package/dist/chunks/{workerd-7dtbad8d.js → request-tracing-z3e7v67k.js} +7 -7
- package/dist/chunks/{workerd-bcs2rr9e.js → request-tracing-zhgmk0fm.js} +2 -2
- package/dist/content-headers.js +1 -1
- package/dist/cors.js +1 -1
- package/dist/event-feed.js +7 -7
- package/dist/fetch.d.ts +1 -1
- package/dist/fetch.js +63 -61
- package/dist/handlers/agent.js +6 -6
- package/dist/handlers/artifact.js +3 -3
- package/dist/handlers/automation.js +2 -2
- package/dist/handlers/blob.js +3 -3
- package/dist/handlers/command.js +6 -6
- package/dist/handlers/config.js +6 -6
- package/dist/handlers/credential.js +7 -7
- package/dist/handlers/debug.js +6 -6
- package/dist/handlers/event.js +7 -7
- 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.js +6 -6
- package/dist/handlers/fs.js +8 -8
- package/dist/handlers/generate.js +6 -6
- package/dist/handlers/integration.js +6 -6
- package/dist/handlers/job.js +2 -2
- package/dist/handlers/location.js +6 -6
- package/dist/handlers/machine.js +1 -1
- package/dist/handlers/mcp.js +8 -8
- package/dist/handlers/media.js +2 -2
- package/dist/handlers/message.js +7 -7
- package/dist/handlers/migration.js +6 -6
- package/dist/handlers/model.js +6 -6
- package/dist/handlers/permission.js +6 -6
- package/dist/handlers/persistent-pty.d.ts +1 -1
- package/dist/handlers/persistent-pty.js +18 -17
- package/dist/handlers/plugin.js +6 -6
- package/dist/handlers/project.js +6 -6
- package/dist/handlers/provider.js +6 -6
- package/dist/handlers/pty-socket.js +1 -1
- package/dist/handlers/pty.js +8 -8
- package/dist/handlers/push.js +1 -1
- package/dist/handlers/reference.js +6 -6
- package/dist/handlers/rpc.js +6 -6
- package/dist/handlers/server.js +9 -9
- package/dist/handlers/session-error.js +1 -1
- package/dist/handlers/session.js +7 -7
- package/dist/handlers/shell.js +6 -6
- package/dist/handlers/skill.js +6 -6
- package/dist/handlers/usage.js +6 -6
- package/dist/handlers/vcs.js +6 -6
- package/dist/handlers/voice.js +6 -6
- package/dist/handlers/websearch.js +6 -6
- package/dist/handlers/worktree.js +6 -6
- package/dist/handlers.d.ts +1 -1
- package/dist/handlers.js +56 -54
- package/dist/location.js +4 -4
- package/dist/media-uri.js +1 -1
- package/dist/middleware/authorization.js +2 -2
- package/dist/middleware/defect-response.js +1 -1
- package/dist/middleware/form-location.js +3 -3
- package/dist/middleware/schema-error.js +1 -1
- package/dist/middleware/session-location.js +3 -3
- package/dist/pairing.d.ts +1 -1
- package/dist/pairing.js +1 -1
- package/dist/process.js +75 -65
- package/dist/range.js +1 -1
- package/dist/request-site.js +2 -2
- package/dist/request-tracing.js +1 -1
- package/dist/routes.d.ts +3 -2
- package/dist/routes.js +60 -58
- package/dist/server-info.js +5 -5
- package/dist/service-status.js +3 -3
- package/dist/workerd.js +66 -62
- package/package.json +9 -9
- package/dist/chunks/workerd-wq8p9yvz.js +0 -105
- /package/dist/chunks/{workerd-017ycvbx.js → request-tracing-017ycvbx.js} +0 -0
- /package/dist/chunks/{workerd-9rqn6x4v.js → request-tracing-9rqn6x4v.js} +0 -0
- /package/dist/chunks/{workerd-bd8755ek.js → request-tracing-bd8755ek.js} +0 -0
- /package/dist/chunks/{workerd-n26yr6pw.js → request-tracing-n26yr6pw.js} +0 -0
- /package/dist/chunks/{workerd-q187pxxd.js → request-tracing-q187pxxd.js} +0 -0
- /package/dist/chunks/{workerd-q4bn6dy8.js → request-tracing-q4bn6dy8.js} +0 -0
- /package/dist/chunks/{workerd-qpnw2qd1.js → request-tracing-qpnw2qd1.js} +0 -0
- /package/dist/chunks/{workerd-rqgv9x42.js → request-tracing-rqgv9x42.js} +0 -0
- /package/dist/chunks/{workerd-xthc02cw.js → request-tracing-xthc02cw.js} +0 -0
- /package/dist/chunks/{workerd-yc7nft6q.js → request-tracing-yc7nft6q.js} +0 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CorsConfig2,
|
|
3
|
+
isAllowedRequestOrigin2
|
|
4
|
+
} from "./request-tracing-q4bn6dy8.js";
|
|
5
|
+
import {
|
|
6
|
+
locationErrors2,
|
|
7
|
+
requestRef2
|
|
8
|
+
} from "./request-tracing-br4x4prt.js";
|
|
9
|
+
|
|
10
|
+
// src/handlers/experimental/browser-tunnel.ts
|
|
11
|
+
import { NodeHttpServerRequest } from "@effect/platform-node";
|
|
12
|
+
import { WebSocketServer } from "@effect/platform-node-shared/NodeWS";
|
|
13
|
+
import { BrowserTunnelGateway } from "@opencode/core/experimental/browser-tunnel";
|
|
14
|
+
import { LocationLifecycle } from "@opencode/core/location-lifecycle";
|
|
15
|
+
import { LocationServiceMap } from "@opencode/core/location-service-map";
|
|
16
|
+
import {
|
|
17
|
+
BROWSER_TUNNEL_CONNECTION_HEADER,
|
|
18
|
+
BROWSER_TUNNEL_PROTOCOL_HEADER,
|
|
19
|
+
BROWSER_TUNNEL_PROTOCOL_VERSION,
|
|
20
|
+
BROWSER_TUNNEL_SESSION_HEADER,
|
|
21
|
+
BROWSER_TUNNEL_TICKET_HEADER
|
|
22
|
+
} from "@opencode/protocol/groups/experimental/browser-tunnel";
|
|
23
|
+
import { isWebSocketUpgrade } from "@opencode/protocol/groups/machine";
|
|
24
|
+
import { Session } from "@opencode/schema/session";
|
|
25
|
+
import { Effect, Option, Schema, Scope } from "effect";
|
|
26
|
+
import { HttpMiddleware, HttpServerResponse } from "effect/http";
|
|
27
|
+
import { IncomingMessage } from "node:http";
|
|
28
|
+
var STOPPING = "1 second";
|
|
29
|
+
var CLOSING = "5 seconds";
|
|
30
|
+
function toUint8Array(data) {
|
|
31
|
+
if (data instanceof Uint8Array)
|
|
32
|
+
return data;
|
|
33
|
+
if (data instanceof ArrayBuffer)
|
|
34
|
+
return new Uint8Array(data);
|
|
35
|
+
if (Array.isArray(data)) {
|
|
36
|
+
const buffers = data.map((part) => part instanceof Uint8Array ? part : new Uint8Array(part));
|
|
37
|
+
return Buffer.concat(buffers);
|
|
38
|
+
}
|
|
39
|
+
return new Uint8Array;
|
|
40
|
+
}
|
|
41
|
+
function adaptWebSocket(ws) {
|
|
42
|
+
return {
|
|
43
|
+
get readyState() {
|
|
44
|
+
return ws.readyState;
|
|
45
|
+
},
|
|
46
|
+
get bufferedAmount() {
|
|
47
|
+
return ws.bufferedAmount;
|
|
48
|
+
},
|
|
49
|
+
send(data, onWritten) {
|
|
50
|
+
ws.send(data, { binary: true, compress: false }, (error) => onWritten?.(error ?? undefined));
|
|
51
|
+
},
|
|
52
|
+
ping() {
|
|
53
|
+
if (ws.readyState === ws.OPEN)
|
|
54
|
+
ws.ping();
|
|
55
|
+
},
|
|
56
|
+
close(code, reason) {
|
|
57
|
+
if (ws.readyState === ws.OPEN || ws.readyState === ws.CONNECTING) {
|
|
58
|
+
ws.close(code, reason);
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
terminate() {
|
|
62
|
+
ws.terminate();
|
|
63
|
+
},
|
|
64
|
+
onMessage(listener) {
|
|
65
|
+
const handler = (raw, isBinary) => {
|
|
66
|
+
if (!isBinary) {
|
|
67
|
+
listener(String(raw));
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
listener(toUint8Array(raw));
|
|
71
|
+
};
|
|
72
|
+
ws.on("message", handler);
|
|
73
|
+
ws.resume();
|
|
74
|
+
return () => {
|
|
75
|
+
ws.off("message", handler);
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
onClose(listener) {
|
|
79
|
+
const handler = (code, reason) => listener(code, reason.toString("utf8"));
|
|
80
|
+
ws.on("close", handler);
|
|
81
|
+
return () => {
|
|
82
|
+
ws.off("close", handler);
|
|
83
|
+
};
|
|
84
|
+
},
|
|
85
|
+
onError(listener) {
|
|
86
|
+
ws.on("error", listener);
|
|
87
|
+
return () => {
|
|
88
|
+
ws.off("error", listener);
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
onPong(listener) {
|
|
92
|
+
ws.on("pong", listener);
|
|
93
|
+
return () => {
|
|
94
|
+
ws.off("pong", listener);
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
var upgradeSocket = (sockets, incoming) => Effect.acquireRelease(Effect.callback((resume) => {
|
|
100
|
+
const refused = () => resume(Effect.fail(new Error("WebSocket upgrade closed before completion.")));
|
|
101
|
+
if (incoming.socket.destroyed)
|
|
102
|
+
return refused();
|
|
103
|
+
incoming.socket.once("close", refused);
|
|
104
|
+
sockets.handleUpgrade(incoming, incoming.socket, Buffer.alloc(0), (ws) => {
|
|
105
|
+
incoming.socket.off("close", refused);
|
|
106
|
+
incoming.socket.setNoDelay(true);
|
|
107
|
+
ws.pause();
|
|
108
|
+
resume(Effect.succeed(ws));
|
|
109
|
+
});
|
|
110
|
+
}), (ws) => Effect.gen(function* () {
|
|
111
|
+
if (ws.readyState === ws.CLOSED)
|
|
112
|
+
return;
|
|
113
|
+
const gone = Effect.callback((resume) => {
|
|
114
|
+
if (ws.readyState === ws.CLOSED)
|
|
115
|
+
return resume(Effect.void);
|
|
116
|
+
ws.once("close", () => resume(Effect.void));
|
|
117
|
+
});
|
|
118
|
+
ws.close(1001, "server closing");
|
|
119
|
+
if (Option.isNone(yield* Effect.timeoutOption(gone, CLOSING)))
|
|
120
|
+
ws.terminate();
|
|
121
|
+
}));
|
|
122
|
+
var makeBrowserTunnel2 = Effect.gen(function* () {
|
|
123
|
+
const gateway = yield* BrowserTunnelGateway.Service;
|
|
124
|
+
const locations = yield* LocationServiceMap.Service;
|
|
125
|
+
const cors = yield* CorsConfig2;
|
|
126
|
+
const scope = yield* Effect.scope;
|
|
127
|
+
const server = yield* Effect.cached(Effect.acquireRelease(Effect.sync(() => new WebSocketServer({
|
|
128
|
+
noServer: true,
|
|
129
|
+
perMessageDeflate: false,
|
|
130
|
+
maxPayload: BrowserTunnelGateway.MAX_WS_FRAME_BYTES
|
|
131
|
+
})), (sockets) => Effect.gen(function* () {
|
|
132
|
+
sockets.clients.forEach((ws) => ws.close(1012, "server stopping"));
|
|
133
|
+
const empty = Effect.callback((resume) => sockets.close(() => resume(Effect.void)));
|
|
134
|
+
if (Option.isNone(yield* Effect.timeoutOption(empty, STOPPING))) {
|
|
135
|
+
sockets.clients.forEach((ws) => ws.terminate());
|
|
136
|
+
}
|
|
137
|
+
})).pipe(Scope.provide(scope)));
|
|
138
|
+
return Effect.fn("BrowserTunnelHandler.connect")(function* (request) {
|
|
139
|
+
if (!isAllowedRequestOrigin2(request.headers.origin, request.headers.host, cors)) {
|
|
140
|
+
return HttpServerResponse.empty({ status: 403 });
|
|
141
|
+
}
|
|
142
|
+
const incoming = NodeHttpServerRequest.toIncomingMessage(request);
|
|
143
|
+
if (!(incoming instanceof IncomingMessage) || !isWebSocketUpgrade(request)) {
|
|
144
|
+
return HttpServerResponse.empty({ status: 400 });
|
|
145
|
+
}
|
|
146
|
+
const url = new URL(request.url, "http://localhost");
|
|
147
|
+
if (url.searchParams.has("ticket")) {
|
|
148
|
+
return HttpServerResponse.empty({ status: 403 });
|
|
149
|
+
}
|
|
150
|
+
const ticket = request.headers[BROWSER_TUNNEL_TICKET_HEADER]?.trim();
|
|
151
|
+
if (!ticket) {
|
|
152
|
+
return HttpServerResponse.empty({ status: 403 });
|
|
153
|
+
}
|
|
154
|
+
const rawSession = request.headers[BROWSER_TUNNEL_SESSION_HEADER]?.trim() ?? url.searchParams.get("sessionID")?.trim();
|
|
155
|
+
const connectionID = request.headers[BROWSER_TUNNEL_CONNECTION_HEADER]?.trim() ?? url.searchParams.get("connectionID")?.trim();
|
|
156
|
+
const rawProtocol = request.headers[BROWSER_TUNNEL_PROTOCOL_HEADER]?.trim() ?? url.searchParams.get("protocol")?.trim();
|
|
157
|
+
const protocol = rawProtocol ? Number(rawProtocol) : NaN;
|
|
158
|
+
const sessionID = rawSession ? Option.getOrUndefined(Schema.decodeUnknownOption(Session.ID)(rawSession)) : undefined;
|
|
159
|
+
if (!sessionID || !connectionID || protocol !== BROWSER_TUNNEL_PROTOCOL_VERSION) {
|
|
160
|
+
return HttpServerResponse.empty({ status: 403 });
|
|
161
|
+
}
|
|
162
|
+
const ref = LocationServiceMap.canonical(requestRef2(request));
|
|
163
|
+
const binding = yield* gateway.consumeTicket({
|
|
164
|
+
ticket,
|
|
165
|
+
location: ref,
|
|
166
|
+
sessionID,
|
|
167
|
+
connectionID,
|
|
168
|
+
protocol
|
|
169
|
+
});
|
|
170
|
+
if (!binding) {
|
|
171
|
+
return HttpServerResponse.empty({ status: 403 });
|
|
172
|
+
}
|
|
173
|
+
if (Option.isNone(yield* Effect.option(request.upgrade))) {
|
|
174
|
+
return HttpServerResponse.empty({ status: 400 });
|
|
175
|
+
}
|
|
176
|
+
return yield* Effect.gen(function* () {
|
|
177
|
+
const sockets = yield* server;
|
|
178
|
+
const ws = yield* upgradeSocket(sockets, incoming);
|
|
179
|
+
yield* HttpMiddleware.withLoggerDisabled(Effect.void);
|
|
180
|
+
const lifecycle = yield* LocationLifecycle.Service;
|
|
181
|
+
yield* lifecycle.retain;
|
|
182
|
+
yield* lifecycle.awaitShutdown.pipe(Effect.andThen(Effect.sync(() => ws.close(1012, "location shut down"))), Effect.forkChild);
|
|
183
|
+
yield* binding.onUpgrade(adaptWebSocket(ws));
|
|
184
|
+
return HttpServerResponse.empty();
|
|
185
|
+
}).pipe(Effect.scoped, Effect.provide(locations.get(ref)), locationErrors2, Effect.orElseSucceed(() => HttpServerResponse.empty()));
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
export { makeBrowserTunnel2 };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-tracing-br4x4prt.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./request-tracing-jhs8rzvk.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/vcs.ts
|
|
9
9
|
import { Vcs } from "@opencode/core/vcs";
|
|
@@ -2,18 +2,18 @@ import {
|
|
|
2
2
|
locationErrors2,
|
|
3
3
|
response2,
|
|
4
4
|
requestRef2
|
|
5
|
-
} from "./
|
|
5
|
+
} from "./request-tracing-br4x4prt.js";
|
|
6
6
|
import {
|
|
7
7
|
Api2
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./request-tracing-jhs8rzvk.js";
|
|
9
9
|
import {
|
|
10
10
|
CorsConfig2,
|
|
11
11
|
isAllowedRequestOrigin2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./request-tracing-q4bn6dy8.js";
|
|
13
13
|
import {
|
|
14
14
|
runPtySocket2,
|
|
15
15
|
holdLocation2
|
|
16
|
-
} from "./
|
|
16
|
+
} from "./request-tracing-q187pxxd.js";
|
|
17
17
|
|
|
18
18
|
// src/handlers/pty.ts
|
|
19
19
|
import { Pty } from "@opencode/core/pty";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isAllowedRequestOrigin2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-tracing-q4bn6dy8.js";
|
|
4
4
|
import {
|
|
5
5
|
__export
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./request-tracing-9rqn6x4v.js";
|
|
7
7
|
|
|
8
8
|
// src/request-site.ts
|
|
9
9
|
var exports_request_site = {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
locationErrors2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-tracing-br4x4prt.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./request-tracing-jhs8rzvk.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/voice.ts
|
|
9
9
|
import { Location } from "@opencode/core/location";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
locationErrors2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-tracing-br4x4prt.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./request-tracing-jhs8rzvk.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/generate.ts
|
|
9
9
|
import { Generate } from "@opencode/core/generate";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
response2
|
|
3
|
+
} from "./request-tracing-br4x4prt.js";
|
|
4
|
+
import {
|
|
5
|
+
Api2
|
|
6
|
+
} from "./request-tracing-jhs8rzvk.js";
|
|
7
|
+
|
|
8
|
+
// src/handlers/flag.ts
|
|
9
|
+
import { Flag } from "@opencode/core/flag";
|
|
10
|
+
import { ConfigFlag } from "@opencode/schema/config/flag";
|
|
11
|
+
import { Effect } from "effect";
|
|
12
|
+
import { HttpApiBuilder } from "effect/http-api";
|
|
13
|
+
var FlagHandler2 = HttpApiBuilder.group(Api2, "server.flag", (handlers) => Effect.gen(function* () {
|
|
14
|
+
return handlers.handle("experimental.flag.get", Effect.fn("server.flag.get")(function* () {
|
|
15
|
+
const flags = yield* Flag.Service;
|
|
16
|
+
return yield* response2(flags.all.pipe(Effect.map((all) => Object.fromEntries(ConfigFlag.ui.map((key) => [key, all[key].enabled])))));
|
|
17
|
+
}));
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
export { FlagHandler2 };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-tracing-br4x4prt.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./request-tracing-jhs8rzvk.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/reference.ts
|
|
9
9
|
import { Reference } from "@opencode/core/reference";
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__export
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-tracing-9rqn6x4v.js";
|
|
4
4
|
|
|
5
5
|
// src/event-feed.ts
|
|
6
6
|
var exports_event_feed = {};
|
|
7
7
|
__export(exports_event_feed, {
|
|
8
8
|
EncodingError: () => EncodingError2,
|
|
9
9
|
EventFeed: () => exports_event_feed,
|
|
10
|
-
Service: () =>
|
|
10
|
+
Service: () => Service4,
|
|
11
11
|
SubscriberCapacity: () => SubscriberCapacity2,
|
|
12
12
|
SubscriberOverflowError: () => SubscriberOverflowError2,
|
|
13
13
|
frame: () => frame2,
|
|
14
|
-
layer: () =>
|
|
15
|
-
make: () =>
|
|
14
|
+
layer: () => layer3,
|
|
15
|
+
make: () => make4
|
|
16
16
|
});
|
|
17
17
|
import { Bus } from "@opencode/core/bus";
|
|
18
18
|
import { Event } from "@opencode/schema/event";
|
|
@@ -30,14 +30,14 @@ class EncodingError2 extends Schema.TaggedError()("EventFeed.EncodingError", {
|
|
|
30
30
|
}) {
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
class
|
|
33
|
+
class Service4 extends Context.Service()("@opencode/server/EventFeed") {
|
|
34
34
|
}
|
|
35
35
|
function frame2(event) {
|
|
36
36
|
return `data: ${JSON.stringify(event)}
|
|
37
37
|
|
|
38
38
|
`;
|
|
39
39
|
}
|
|
40
|
-
var
|
|
40
|
+
var make4 = Effect.fn("EventFeed.make")(function* (observe, options) {
|
|
41
41
|
const capacity = options?.capacity ?? SubscriberCapacity2;
|
|
42
42
|
const render = options?.encode ?? frame2;
|
|
43
43
|
const subscribers = new Map;
|
|
@@ -72,13 +72,13 @@ var make3 = Effect.fn("EventFeed.make")(function* (observe, options) {
|
|
|
72
72
|
});
|
|
73
73
|
const unsubscribe = yield* observe(publish);
|
|
74
74
|
yield* Effect.addFinalizer(() => unsubscribe);
|
|
75
|
-
return
|
|
75
|
+
return Service4.of({
|
|
76
76
|
subscribe: (types) => Effect.acquireRelease(Queue.dropping(capacity).pipe(Effect.tap((queue) => Effect.sync(() => subscribers.set(queue, types?.length ? new Set(types) : undefined)))), (queue) => Effect.sync(() => subscribers.delete(queue)).pipe(Effect.andThen(Queue.shutdown(queue)), Effect.asVoid)).pipe(Effect.map(Stream.fromQueue))
|
|
77
77
|
});
|
|
78
78
|
});
|
|
79
|
-
var
|
|
79
|
+
var layer3 = Layer.effect(Service4, Effect.gen(function* () {
|
|
80
80
|
const bus = yield* Bus.Service;
|
|
81
|
-
return yield*
|
|
81
|
+
return yield* make4(bus.listen);
|
|
82
82
|
}));
|
|
83
83
|
|
|
84
|
-
export { SubscriberCapacity2, SubscriberOverflowError2, EncodingError2,
|
|
84
|
+
export { SubscriberCapacity2, SubscriberOverflowError2, EncodingError2, Service4, frame2, make4, layer3, exports_event_feed };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-tracing-jhs8rzvk.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
5
|
+
Service4,
|
|
6
6
|
frame2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./request-tracing-s802fzg1.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/event.ts
|
|
10
10
|
import { Event } from "@opencode/schema/event";
|
|
@@ -12,7 +12,7 @@ import { Effect, Stream } from "effect";
|
|
|
12
12
|
import { HttpServerResponse } from "effect/http";
|
|
13
13
|
import { HttpApiBuilder } from "effect/http-api";
|
|
14
14
|
var EventHandler2 = HttpApiBuilder.group(Api2, "server.event", (handlers) => Effect.gen(function* () {
|
|
15
|
-
const feed = yield*
|
|
15
|
+
const feed = yield* Service4;
|
|
16
16
|
return handlers.handleRaw("event.subscribe", (ctx) => Effect.gen(function* () {
|
|
17
17
|
const connected = {
|
|
18
18
|
id: Event.ID.create(),
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-tracing-br4x4prt.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./request-tracing-jhs8rzvk.js";
|
|
7
7
|
import {
|
|
8
8
|
download2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./request-tracing-t32e1bbt.js";
|
|
10
10
|
import {
|
|
11
11
|
parse2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./request-tracing-8sb6qqpn.js";
|
|
13
13
|
|
|
14
14
|
// src/handlers/fs.ts
|
|
15
15
|
import { Environment } from "@opencode/core/environment/index";
|
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./
|
|
2
|
+
layer4
|
|
3
|
+
} from "./request-tracing-br4x4prt.js";
|
|
4
4
|
import {
|
|
5
5
|
formLocationLayer2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./request-tracing-ca564221.js";
|
|
7
7
|
import {
|
|
8
8
|
sessionLocationLayer2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./request-tracing-ehyp3zqd.js";
|
|
10
10
|
import {
|
|
11
11
|
Api2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./request-tracing-jhs8rzvk.js";
|
|
13
13
|
import {
|
|
14
14
|
Config2
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./request-tracing-j4at0y5c.js";
|
|
16
16
|
import {
|
|
17
17
|
CorsConfig2
|
|
18
|
-
} from "./
|
|
18
|
+
} from "./request-tracing-q4bn6dy8.js";
|
|
19
19
|
import {
|
|
20
|
-
|
|
21
|
-
} from "./
|
|
20
|
+
layer2
|
|
21
|
+
} from "./request-tracing-z3e7v67k.js";
|
|
22
22
|
import {
|
|
23
23
|
node2
|
|
24
|
-
} from "./
|
|
24
|
+
} from "./request-tracing-w9jcwh65.js";
|
|
25
25
|
import {
|
|
26
26
|
handlers2
|
|
27
|
-
} from "./
|
|
27
|
+
} from "./request-tracing-6hw64pe6.js";
|
|
28
28
|
import {
|
|
29
29
|
authorizationLayer2
|
|
30
|
-
} from "./
|
|
30
|
+
} from "./request-tracing-29nx48hm.js";
|
|
31
31
|
import {
|
|
32
32
|
schemaErrorLayer2
|
|
33
|
-
} from "./
|
|
33
|
+
} from "./request-tracing-bd8755ek.js";
|
|
34
34
|
import {
|
|
35
35
|
defectResponseLayer2
|
|
36
|
-
} from "./
|
|
36
|
+
} from "./request-tracing-n26yr6pw.js";
|
|
37
37
|
|
|
38
38
|
// src/routes.ts
|
|
39
39
|
import { Database } from "@opencode/core/database/database";
|
|
@@ -49,6 +49,7 @@ import { FileSystemSearch } from "@opencode/core/filesystem/search";
|
|
|
49
49
|
import { Credential } from "@opencode/core/credential";
|
|
50
50
|
import { Config } from "@opencode/core/config";
|
|
51
51
|
import { PermissionSaved } from "@opencode/core/permission/saved";
|
|
52
|
+
import { BrowserTunnelGateway } from "@opencode/core/experimental/browser-tunnel";
|
|
52
53
|
import { PtyTicket } from "@opencode/core/pty/ticket";
|
|
53
54
|
import { PersistentPty } from "@opencode/core/persistent-pty";
|
|
54
55
|
import { Project } from "@opencode/core/project";
|
|
@@ -82,6 +83,7 @@ import { PushList } from "@opencode/core/push/list";
|
|
|
82
83
|
import { PushSender } from "@opencode/core/push/sender";
|
|
83
84
|
import { PushWatcher } from "@opencode/core/push/watcher";
|
|
84
85
|
import { Workspace } from "@opencode/core/workspace";
|
|
86
|
+
import { WorkspaceConnector } from "@opencode/core/environment/workspace-connector";
|
|
85
87
|
import { Watcher } from "@opencode/core/filesystem/watcher";
|
|
86
88
|
import { FileWatch } from "@opencode/core/filesystem/file-watch";
|
|
87
89
|
import { HttpEffect, HttpRouter } from "effect/http";
|
|
@@ -112,6 +114,7 @@ var applicationServiceNodes = [
|
|
|
112
114
|
PluginUpdate.node,
|
|
113
115
|
PermissionSaved.node,
|
|
114
116
|
PtyTicket.node,
|
|
117
|
+
BrowserTunnelGateway.node,
|
|
115
118
|
Credential.node,
|
|
116
119
|
WellKnown.node,
|
|
117
120
|
node2,
|
|
@@ -156,6 +159,7 @@ function makeRoutes(password, options, serviceURLs, overrides, instances) {
|
|
|
156
159
|
})
|
|
157
160
|
}))),
|
|
158
161
|
Database.node.replace(Database.configured(options.database)),
|
|
162
|
+
WorkspaceConnector.node.replace(Workspace.connectorNode),
|
|
159
163
|
PersistentPty.node.replace(PersistentPty.configured(options.pty)),
|
|
160
164
|
Bus.node.replace(Bus.configured({ persist: options.events?.persist })),
|
|
161
165
|
App.node.replace(App.configured(options.app)),
|
|
@@ -198,8 +202,8 @@ function makeRoutes(password, options, serviceURLs, overrides, instances) {
|
|
|
198
202
|
})) : build(overrides);
|
|
199
203
|
return serviceLayer.pipe(Layer.flatMap((context) => {
|
|
200
204
|
const services = Layer.succeedContext(context);
|
|
201
|
-
const requestServices = Layer.merge(Layer.succeedContext(Context.pick(Database.Service, Credential.Service, PermissionSaved.Service, PluginUpdate.Service, Project.Service, WellKnown.Service)(context)),
|
|
202
|
-
const api = HttpApiBuilder.layer(Api2, { openapiPath: "/openapi.json" }).pipe(Layer.provide(handlers2.pipe(Layer.provide(services), Layer.provide(Layer.succeed(CorsConfig2, options)))), Layer.provide(formLocationLayer2), Layer.provide(sessionLocationLayer2), Layer.provide(
|
|
205
|
+
const requestServices = Layer.merge(Layer.succeedContext(Context.pick(Database.Service, Credential.Service, PermissionSaved.Service, PluginUpdate.Service, Project.Service, WellKnown.Service)(context)), layer2(serviceURLs, Context.get(context, Global.Service).tmp, options.app));
|
|
206
|
+
const api = HttpApiBuilder.layer(Api2, { openapiPath: "/openapi.json" }).pipe(Layer.provide(handlers2.pipe(Layer.provide(services), Layer.provide(Layer.succeed(CorsConfig2, options)))), Layer.provide(formLocationLayer2), Layer.provide(sessionLocationLayer2), Layer.provide(layer4), Layer.provide(authorizationLayer2), Layer.provide(schemaErrorLayer2), Layer.provide(auth), HttpRouter.provideRequest(requestServices), Layer.merge(defectResponseLayer2), Layer.provideMerge(services), Layer.provideMerge(HttpRouter.layer), Layer.tap((context) => Effect.sync(() => {
|
|
203
207
|
internal = Context.get(context, HttpRouter.HttpRouter).asHttpEffect().pipe(HttpEffect.toWebHandlerWith(context));
|
|
204
208
|
})));
|
|
205
209
|
return Layer.merge(api, V1Migration.layer.pipe(Layer.provide(services)));
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isAllowedCorsOrigin2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-tracing-q4bn6dy8.js";
|
|
4
4
|
import {
|
|
5
5
|
middleware2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./request-tracing-myqk22k5.js";
|
|
7
7
|
import {
|
|
8
8
|
withoutParentSpan2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./request-tracing-yc7nft6q.js";
|
|
10
10
|
import {
|
|
11
11
|
createRoutes2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./request-tracing-wjhv2a2x.js";
|
|
13
13
|
import {
|
|
14
14
|
__export
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./request-tracing-9rqn6x4v.js";
|
|
16
16
|
|
|
17
17
|
// src/fetch.ts
|
|
18
18
|
var exports_fetch = {};
|
|
@@ -4,16 +4,16 @@ import {
|
|
|
4
4
|
missingMessage2,
|
|
5
5
|
failedMessageDecode2,
|
|
6
6
|
failedSnapshot2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./request-tracing-rqgv9x42.js";
|
|
8
8
|
import {
|
|
9
9
|
locationErrors2
|
|
10
|
-
} from "./
|
|
10
|
+
} from "./request-tracing-br4x4prt.js";
|
|
11
11
|
import {
|
|
12
12
|
Api2
|
|
13
|
-
} from "./
|
|
13
|
+
} from "./request-tracing-jhs8rzvk.js";
|
|
14
14
|
import {
|
|
15
15
|
wantsMediaRefs2
|
|
16
|
-
} from "./
|
|
16
|
+
} from "./request-tracing-xthc02cw.js";
|
|
17
17
|
|
|
18
18
|
// src/handlers/session.ts
|
|
19
19
|
import { Instance } from "@opencode/core/instance/service";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-tracing-br4x4prt.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./request-tracing-jhs8rzvk.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/model.ts
|
|
9
9
|
import { Model } from "@opencode/core/model";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-tracing-br4x4prt.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./request-tracing-jhs8rzvk.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/plugin.ts
|
|
9
9
|
import { Plugin } from "@opencode/core/plugin";
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__export
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-tracing-9rqn6x4v.js";
|
|
4
4
|
|
|
5
5
|
// src/server-info.ts
|
|
6
6
|
var exports_server_info = {};
|
|
7
7
|
__export(exports_server_info, {
|
|
8
8
|
ServerInfo: () => exports_server_info,
|
|
9
|
-
Service: () =>
|
|
9
|
+
Service: () => Service2,
|
|
10
10
|
connectionURLs: () => connectionURLs2,
|
|
11
|
-
layer: () =>
|
|
11
|
+
layer: () => layer2
|
|
12
12
|
});
|
|
13
13
|
import { Context, Layer } from "effect";
|
|
14
14
|
import { networkInterfaces } from "node:os";
|
|
15
15
|
|
|
16
|
-
class
|
|
16
|
+
class Service2 extends Context.Service()("@opencode/server/ServerInfo") {
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
return Layer.succeed(
|
|
18
|
+
function layer2(urls, tmp, app = {}) {
|
|
19
|
+
return Layer.succeed(Service2, Service2.of({ urls, app, paths: { tmp } }));
|
|
20
20
|
}
|
|
21
21
|
function connectionURLs2(value, requestedHostname) {
|
|
22
22
|
const url = new URL(value);
|
|
@@ -38,4 +38,4 @@ function connectionURLs2(value, requestedHostname) {
|
|
|
38
38
|
];
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
export {
|
|
41
|
+
export { Service2, layer2, connectionURLs2, exports_server_info };
|