@opencode/server 0.0.0-dev-20783 → 0.0.0-dev-20786
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 +13 -13
- package/dist/api.js +5 -5
- package/dist/auth.js +1 -1
- package/dist/chunks/{service-status-j87rfkvt.js → cors-00mapsdc.js} +4 -4
- package/dist/chunks/{service-status-jskw5q1g.js → cors-0b39h07j.js} +2 -2
- package/dist/chunks/{service-status-da5stqtt.js → cors-0q1fp77w.js} +2 -2
- package/dist/chunks/{service-status-zhqf1t9m.js → cors-10bq7mg4.js} +2 -2
- package/dist/chunks/{service-status-0b1t2b2s.js → cors-13tvbs17.js} +3 -3
- package/dist/chunks/{service-status-j54drd5e.js → cors-19taf7de.js} +2 -2
- package/dist/chunks/{service-status-np6fwbmz.js → cors-1tk2rec1.js} +30 -29
- package/dist/chunks/{service-status-mhyatxpf.js → cors-1x5dvcb3.js} +18 -18
- package/dist/chunks/{service-status-5fmydwgy.js → cors-360ay1ws.js} +2 -2
- package/dist/chunks/{service-status-pg3sqc69.js → cors-44qh4kfc.js} +4 -4
- package/dist/chunks/{service-status-2vy10eeh.js → cors-4r8g7rwq.js} +3 -3
- package/dist/chunks/{service-status-gtkdacvk.js → cors-5ytyqf1q.js} +5 -4
- package/dist/chunks/{service-status-9m28rhbj.js → cors-72xpy55t.js} +6 -6
- package/dist/chunks/{service-status-62qjgyra.js → cors-735x1s0d.js} +3 -3
- package/dist/chunks/{service-status-30gqa6y8.js → cors-73mn2n3x.js} +4 -4
- package/dist/chunks/{service-status-q4y3mw2d.js → cors-8cnxq26y.js} +3 -3
- package/dist/chunks/{service-status-j8182e46.js → cors-8d0mn004.js} +3 -3
- package/dist/chunks/{service-status-bptmkrac.js → cors-9e4rhycp.js} +3 -3
- package/dist/chunks/{service-status-anm12x33.js → cors-anm12x33.js} +1 -1
- package/dist/chunks/{service-status-bkk2wfbz.js → cors-bkk2wfbz.js} +1 -1
- package/dist/chunks/{service-status-fsrvj92d.js → cors-bwz286mg.js} +3 -3
- package/dist/chunks/{service-status-sstsrjtg.js → cors-byt4hbw9.js} +7 -7
- package/dist/chunks/{service-status-jy5syrnz.js → cors-drahxf95.js} +30 -34
- package/dist/chunks/{service-status-t8yzmczr.js → cors-erzfdgke.js} +1 -1
- package/dist/chunks/{service-status-w8db1rkr.js → cors-f3xezvck.js} +3 -3
- package/dist/chunks/{service-status-s07e4y6n.js → cors-g0rzwe5g.js} +7 -7
- package/dist/chunks/{service-status-ep84ha6r.js → cors-h2a6nn7k.js} +3 -3
- package/dist/chunks/cors-h6rt5k9s.js +24 -0
- package/dist/chunks/{service-status-m9wzfeff.js → cors-j03v2rh9.js} +3 -3
- package/dist/chunks/{service-status-qcy0p5fz.js → cors-jphw74cq.js} +3 -3
- package/dist/chunks/{service-status-nvmdgpqv.js → cors-nqswsw3h.js} +3 -3
- package/dist/chunks/{service-status-swb5yrqf.js → cors-p177e0cw.js} +3 -3
- package/dist/chunks/{service-status-srcrrwjk.js → cors-qggsn6y0.js} +3 -3
- package/dist/chunks/{service-status-zytx35xb.js → cors-r5pmcrqb.js} +10 -10
- package/dist/chunks/{service-status-99sfd1j8.js → cors-rjpqaa8h.js} +7 -7
- package/dist/chunks/{service-status-mpbfcr4e.js → cors-s1824482.js} +3 -3
- package/dist/chunks/{service-status-ccfecbt4.js → cors-tr76qvg4.js} +2 -2
- package/dist/chunks/{service-status-d00srfh1.js → cors-ty73jqxf.js} +3 -3
- package/dist/chunks/{service-status-nxdx74sv.js → cors-vw0q3knq.js} +3 -3
- package/dist/chunks/{service-status-3c937re8.js → cors-x5jn5rep.js} +3 -3
- package/dist/chunks/{service-status-xsrtpxyd.js → cors-xsrtpxyd.js} +1 -1
- package/dist/chunks/{service-status-k27f8enw.js → cors-y1vwtgfh.js} +4 -4
- package/dist/chunks/{service-status-387sf4vs.js → cors-ybxyv6z5.js} +2 -2
- package/dist/chunks/{service-status-ym5ktahd.js → cors-yk6p4dkd.js} +33 -33
- package/dist/chunks/{service-status-n7kafg5g.js → cors-ysb51p4r.js} +3 -3
- package/dist/chunks/{service-status-acgs9zzk.js → cors-ywn523ee.js} +5 -5
- package/dist/cors.js +1 -1
- package/dist/event-feed.js +5 -5
- package/dist/fetch.js +47 -47
- package/dist/handlers/agent.d.ts +1 -1
- package/dist/handlers/agent.js +6 -6
- package/dist/handlers/command.d.ts +1 -1
- package/dist/handlers/command.js +6 -6
- package/dist/handlers/config.d.ts +1 -1
- package/dist/handlers/config.js +6 -6
- package/dist/handlers/credential.d.ts +1 -1
- package/dist/handlers/credential.js +6 -6
- package/dist/handlers/debug.d.ts +1 -1
- package/dist/handlers/debug.js +6 -6
- package/dist/handlers/event.d.ts +1 -1
- package/dist/handlers/event.js +7 -7
- package/dist/handlers/form.d.ts +1 -1
- package/dist/handlers/form.js +6 -6
- package/dist/handlers/fs.d.ts +1 -1
- package/dist/handlers/fs.js +6 -6
- package/dist/handlers/generate.d.ts +1 -1
- package/dist/handlers/generate.js +6 -6
- package/dist/handlers/integration.d.ts +1 -1
- package/dist/handlers/integration.js +6 -6
- package/dist/handlers/location.d.ts +1 -1
- package/dist/handlers/location.js +6 -6
- package/dist/handlers/mcp.d.ts +1 -1
- package/dist/handlers/mcp.js +6 -6
- package/dist/handlers/message.d.ts +1 -1
- package/dist/handlers/message.js +6 -6
- package/dist/handlers/migration.d.ts +1 -1
- package/dist/handlers/migration.js +6 -6
- package/dist/handlers/model.d.ts +1 -1
- package/dist/handlers/model.js +6 -6
- package/dist/handlers/permission.d.ts +1 -1
- package/dist/handlers/permission.js +6 -6
- package/dist/handlers/persistent-pty.d.ts +1 -1
- package/dist/handlers/persistent-pty.js +8 -8
- package/dist/handlers/plugin.d.ts +1 -1
- package/dist/handlers/plugin.js +6 -6
- package/dist/handlers/project.d.ts +1 -1
- package/dist/handlers/project.js +6 -6
- package/dist/handlers/provider.d.ts +1 -1
- package/dist/handlers/provider.js +6 -6
- package/dist/handlers/pty-socket.d.ts +10 -2
- package/dist/handlers/pty-socket.js +1 -1
- package/dist/handlers/pty.d.ts +1 -1
- package/dist/handlers/pty.js +9 -9
- package/dist/handlers/reference.d.ts +1 -1
- package/dist/handlers/reference.js +6 -6
- package/dist/handlers/rpc.d.ts +1 -1
- package/dist/handlers/rpc.js +6 -6
- package/dist/handlers/server.d.ts +1 -1
- package/dist/handlers/server.js +9 -9
- package/dist/handlers/session-error.js +1 -1
- package/dist/handlers/session.d.ts +1 -1
- package/dist/handlers/session.js +6 -6
- package/dist/handlers/shell.d.ts +1 -1
- package/dist/handlers/shell.js +6 -6
- package/dist/handlers/skill.d.ts +1 -1
- package/dist/handlers/skill.js +6 -6
- package/dist/handlers/vcs.d.ts +1 -1
- package/dist/handlers/vcs.js +6 -6
- package/dist/handlers/websearch.d.ts +1 -1
- package/dist/handlers/websearch.js +6 -6
- package/dist/handlers/worktree.d.ts +1 -1
- package/dist/handlers/worktree.js +6 -6
- package/dist/handlers.d.ts +1 -1
- package/dist/handlers.js +43 -43
- package/dist/location.d.ts +2 -2
- package/dist/location.js +4 -4
- package/dist/middleware/authorization.d.ts +1 -1
- package/dist/middleware/authorization.js +2 -2
- package/dist/middleware/form-location.d.ts +1 -1
- package/dist/middleware/form-location.js +3 -3
- package/dist/middleware/schema-error.js +1 -1
- package/dist/middleware/session-location.d.ts +1 -1
- package/dist/middleware/session-location.js +3 -3
- package/dist/pairing.js +3 -3
- package/dist/process.d.ts +4 -3
- package/dist/process.js +50 -50
- package/dist/pty-environment.js +1 -1
- package/dist/request-tracing.js +1 -1
- package/dist/routes.d.ts +3 -3
- package/dist/routes.js +46 -46
- package/dist/server-info.js +5 -5
- package/dist/service-status.js +1 -1
- package/dist/workerd.js +48 -48
- package/package.json +14 -12
- package/dist/chunks/service-status-hezj1jdf.js +0 -7
- /package/dist/chunks/{service-status-9rqn6x4v.js → cors-9rqn6x4v.js} +0 -0
- /package/dist/chunks/{service-status-q4bn6dy8.js → cors-q4bn6dy8.js} +0 -0
- /package/dist/chunks/{service-status-smaf4a18.js → cors-smaf4a18.js} +0 -0
- /package/dist/chunks/{service-status-yc7nft6q.js → cors-yc7nft6q.js} +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./cors-ywn523ee.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./cors-h2a6nn7k.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/model.ts
|
|
9
9
|
import { Model } from "@opencode/core/model";
|
|
10
10
|
import { Effect } from "effect";
|
|
11
|
-
import { HttpApiBuilder } from "effect/
|
|
11
|
+
import { HttpApiBuilder } from "effect/http-api";
|
|
12
12
|
var ModelHandler2 = HttpApiBuilder.group(Api2, "server.model", (handlers) => Effect.gen(function* () {
|
|
13
13
|
return handlers.handle("model.list", Effect.fn(function* () {
|
|
14
14
|
const models = yield* Model.Service;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__export
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./cors-9rqn6x4v.js";
|
|
4
4
|
|
|
5
5
|
// src/pairing.ts
|
|
6
6
|
var exports_pairing = {};
|
|
7
7
|
__export(exports_pairing, {
|
|
8
8
|
ServerPairing: () => exports_pairing,
|
|
9
|
-
Service: () =>
|
|
9
|
+
Service: () => Service4,
|
|
10
10
|
node: () => node3
|
|
11
11
|
});
|
|
12
12
|
import { Cache, Context, Duration, Effect, Layer } from "effect";
|
|
@@ -14,12 +14,12 @@ import { makeGlobalNode } from "@opencode/util/effect/app-node";
|
|
|
14
14
|
import { randomBytes } from "node:crypto";
|
|
15
15
|
var TTL = Duration.minutes(5);
|
|
16
16
|
|
|
17
|
-
class
|
|
17
|
+
class Service4 extends Context.Service()("@opencode/ServerPairing") {
|
|
18
18
|
}
|
|
19
19
|
var noLookup = () => Effect.die(new Error("ServerPairing cache must be used via set/invalidateWhen, never get"));
|
|
20
|
-
var layer = Layer.effect(
|
|
20
|
+
var layer = Layer.effect(Service4, Effect.gen(function* () {
|
|
21
21
|
const cache = yield* Cache.make({ capacity: 1000, lookup: noLookup, timeToLive: TTL });
|
|
22
|
-
return
|
|
22
|
+
return Service4.of({
|
|
23
23
|
issue: Effect.fn("ServerPairing.issue")(function* () {
|
|
24
24
|
const code = randomBytes(16).toString("base64url");
|
|
25
25
|
yield* Cache.set(cache, code, true);
|
|
@@ -30,6 +30,6 @@ var layer = Layer.effect(Service5, Effect.gen(function* () {
|
|
|
30
30
|
})
|
|
31
31
|
});
|
|
32
32
|
}));
|
|
33
|
-
var node3 = makeGlobalNode({ service:
|
|
33
|
+
var node3 = makeGlobalNode({ service: Service4, layer, deps: [] });
|
|
34
34
|
|
|
35
|
-
export {
|
|
35
|
+
export { Service4, node3, exports_pairing };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./cors-h2a6nn7k.js";
|
|
4
4
|
import {
|
|
5
5
|
CorsConfig2,
|
|
6
6
|
isAllowedRequestOrigin2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./cors-q4bn6dy8.js";
|
|
8
8
|
import {
|
|
9
9
|
runPtySocket2
|
|
10
|
-
} from "./
|
|
10
|
+
} from "./cors-h6rt5k9s.js";
|
|
11
11
|
|
|
12
12
|
// src/handlers/persistent-pty.ts
|
|
13
13
|
import { PersistentPty } from "@opencode/core/persistent-pty";
|
|
@@ -18,10 +18,10 @@ import {
|
|
|
18
18
|
PTY_CONNECT_TOKEN_HEADER,
|
|
19
19
|
PTY_CONNECT_TOKEN_HEADER_VALUE
|
|
20
20
|
} from "@opencode/protocol/groups/persistent-pty";
|
|
21
|
-
import { Effect, Queue
|
|
22
|
-
import { HttpServerRequest, HttpServerResponse } from "effect/
|
|
23
|
-
import { HttpApiBuilder, HttpApiSchema } from "effect/
|
|
24
|
-
import { Socket } from "effect/
|
|
21
|
+
import { Effect, Queue } from "effect";
|
|
22
|
+
import { HttpServerRequest, HttpServerResponse } from "effect/http";
|
|
23
|
+
import { HttpApiBuilder, HttpApiSchema } from "effect/http-api";
|
|
24
|
+
import { Socket } from "effect/socket";
|
|
25
25
|
var PersistentPtyHandler2 = HttpApiBuilder.group(Api2, "server.experimental", (handlers) => Effect.gen(function* () {
|
|
26
26
|
const tickets = yield* PtyTicket.Service;
|
|
27
27
|
const cors = yield* CorsConfig2;
|
|
@@ -77,9 +77,7 @@ var PersistentPtyHandler2 = HttpApiBuilder.group(Api2, "server.experimental", (h
|
|
|
77
77
|
if (!Number.isSafeInteger(cursor) || cursor < 0)
|
|
78
78
|
return HttpServerResponse.empty({ status: 400 });
|
|
79
79
|
const socket = yield* Effect.orDie(ctx.request.upgrade);
|
|
80
|
-
const write = yield* socket.writer;
|
|
81
80
|
const outbox = yield* Queue.unbounded();
|
|
82
|
-
const input = yield* Semaphore.make(1);
|
|
83
81
|
let attachment;
|
|
84
82
|
const onOpen = Effect.gen(function* () {
|
|
85
83
|
attachment = yield* pty.attach(ctx.params.ptyID, {
|
|
@@ -123,32 +121,30 @@ var PersistentPtyHandler2 = HttpApiBuilder.group(Api2, "server.experimental", (h
|
|
|
123
121
|
Queue.offerUnsafe(outbox, JSON.stringify({ type: "replay_complete", endOffset: attachment.replay.endOffset }));
|
|
124
122
|
attachment.activate();
|
|
125
123
|
});
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
124
|
+
yield* runPtySocket2({
|
|
125
|
+
socket,
|
|
126
|
+
outbox,
|
|
127
|
+
onOpen,
|
|
128
|
+
onMessage: (message) => {
|
|
129
|
+
if (!attachment)
|
|
130
|
+
return Effect.void;
|
|
131
|
+
const data = typeof message === "string" ? Buffer.from(message) : message;
|
|
132
|
+
if (!framedInput)
|
|
133
|
+
return pty.input(ctx.params.ptyID, attachmentID, attachment.info.size.cols, attachment.info.size.rows, data).pipe(Effect.ignore);
|
|
134
|
+
if (data.byteLength < 5)
|
|
135
|
+
return Effect.void;
|
|
136
|
+
const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
137
|
+
const type = data[0];
|
|
138
|
+
const cols = view.getUint16(1);
|
|
139
|
+
const rows = view.getUint16(3);
|
|
140
|
+
if (type !== 0 && type !== 1 || cols === 0 || rows === 0)
|
|
141
|
+
return Effect.void;
|
|
142
|
+
if (type === 0)
|
|
143
|
+
return pty.control(ctx.params.ptyID, attachmentID, cols, rows).pipe(Effect.ignore);
|
|
144
|
+
return pty.input(ctx.params.ptyID, attachmentID, cols, rows, data.subarray(5)).pipe(Effect.ignore);
|
|
145
|
+
},
|
|
146
|
+
detach: () => attachment?.detach()
|
|
133
147
|
});
|
|
134
|
-
yield* runPtySocket2(drain, socket.runRaw((message) => input.withPermit(Effect.suspend(() => {
|
|
135
|
-
if (!attachment)
|
|
136
|
-
return Effect.void;
|
|
137
|
-
const data = typeof message === "string" ? Buffer.from(message) : message;
|
|
138
|
-
if (!framedInput)
|
|
139
|
-
return pty.input(ctx.params.ptyID, attachmentID, attachment.info.size.cols, attachment.info.size.rows, data).pipe(Effect.ignore);
|
|
140
|
-
if (data.byteLength < 5)
|
|
141
|
-
return Effect.void;
|
|
142
|
-
const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
|
|
143
|
-
const type = data[0];
|
|
144
|
-
const cols = view.getUint16(1);
|
|
145
|
-
const rows = view.getUint16(3);
|
|
146
|
-
if (type !== 0 && type !== 1 || cols === 0 || rows === 0)
|
|
147
|
-
return Effect.void;
|
|
148
|
-
if (type === 0)
|
|
149
|
-
return pty.control(ctx.params.ptyID, attachmentID, cols, rows).pipe(Effect.ignore);
|
|
150
|
-
return pty.input(ctx.params.ptyID, attachmentID, cols, rows, data.subarray(5)).pipe(Effect.ignore);
|
|
151
|
-
})), { onOpen }), () => attachment?.detach()).pipe(Effect.catchReason("SocketError", "SocketCloseError", () => Effect.void), Effect.orDie);
|
|
152
148
|
return HttpServerResponse.empty();
|
|
153
149
|
}));
|
|
154
150
|
}));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/middleware/schema-error.ts
|
|
2
2
|
import { Effect } from "effect";
|
|
3
|
-
import { HttpApiMiddleware } from "effect/
|
|
3
|
+
import { HttpApiMiddleware } from "effect/http-api";
|
|
4
4
|
import { InvalidRequestError } from "@opencode/protocol/errors";
|
|
5
5
|
import { SchemaErrorMiddleware } from "@opencode/protocol/middleware/schema-error";
|
|
6
6
|
import { SchemaErrorMiddleware as SchemaErrorMiddleware2 } from "@opencode/protocol/middleware/schema-error";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
requestRef2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./cors-ywn523ee.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./cors-h2a6nn7k.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/debug.ts
|
|
9
9
|
import { LocationServiceMap } from "@opencode/core/location-service-map";
|
|
10
10
|
import { Effect, Option, RcMap } from "effect";
|
|
11
|
-
import { HttpApiBuilder } from "effect/
|
|
11
|
+
import { HttpApiBuilder } from "effect/http-api";
|
|
12
12
|
var DebugHandler2 = HttpApiBuilder.group(Api2, "server.debug", (handlers) => handlers.handle("debug.location", Effect.fn(function* () {
|
|
13
13
|
const locations = Option.getOrThrow(yield* Effect.serviceOption(LocationServiceMap.Service));
|
|
14
14
|
return Array.from(yield* RcMap.keys(locations.rcMap));
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__export
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./cors-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: () => Service5,
|
|
10
10
|
connectionURLs: () => connectionURLs2,
|
|
11
|
-
layer: () =>
|
|
11
|
+
layer: () => layer5
|
|
12
12
|
});
|
|
13
13
|
import { Context, Layer } from "effect";
|
|
14
14
|
import { networkInterfaces } from "node:os";
|
|
15
15
|
|
|
16
|
-
class
|
|
16
|
+
class Service5 extends Context.Service()("@opencode/server/ServerInfo") {
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
return Layer.succeed(
|
|
18
|
+
function layer5(urls, tmp, app = {}) {
|
|
19
|
+
return Layer.succeed(Service5, Service5.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 { Service5, layer5, connectionURLs2, exports_server_info };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LocationMiddleware2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./cors-ywn523ee.js";
|
|
4
4
|
import {
|
|
5
5
|
FormLocationMiddleware2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./cors-ty73jqxf.js";
|
|
7
7
|
import {
|
|
8
8
|
SessionLocationMiddleware2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./cors-vw0q3knq.js";
|
|
10
10
|
|
|
11
11
|
// src/api.ts
|
|
12
12
|
import { makeDefaultApi } from "@opencode/protocol/api";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// src/handlers/pty-socket.ts
|
|
2
|
+
import { Effect, Queue } from "effect";
|
|
3
|
+
import { Socket } from "effect/socket";
|
|
4
|
+
function runPtySocket2(input) {
|
|
5
|
+
const drain = Effect.gen(function* () {
|
|
6
|
+
const writer = yield* input.socket.writer;
|
|
7
|
+
while (true) {
|
|
8
|
+
const item = yield* Queue.take(input.outbox);
|
|
9
|
+
yield* writer.write(item);
|
|
10
|
+
if (item instanceof Socket.CloseEvent)
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
const read = Effect.gen(function* () {
|
|
15
|
+
const reader = yield* input.socket.reader;
|
|
16
|
+
if (input.onOpen)
|
|
17
|
+
yield* input.onOpen;
|
|
18
|
+
while (true)
|
|
19
|
+
yield* Effect.forEach(yield* reader.pull, input.onMessage, { discard: true });
|
|
20
|
+
});
|
|
21
|
+
return Effect.raceFirst(drain, read).pipe(Effect.ensuring(Effect.sync(input.detach)), Effect.catchReason("SocketError", "SocketCloseError", () => Effect.void), Effect.orDie);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { runPtySocket2 };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./cors-ywn523ee.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./cors-h2a6nn7k.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/skill.ts
|
|
9
9
|
import { Skill } from "@opencode/core/skill";
|
|
10
|
-
import { HttpApiBuilder } from "effect/
|
|
10
|
+
import { HttpApiBuilder } from "effect/http-api";
|
|
11
11
|
var SkillHandler2 = HttpApiBuilder.group(Api2, "server.skill", (handlers) => handlers.handle("skill.list", () => response2(Skill.Service.use((skill) => skill.list()))));
|
|
12
12
|
|
|
13
13
|
export { SkillHandler2 };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./cors-ywn523ee.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./cors-h2a6nn7k.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/agent.ts
|
|
9
9
|
import { Agent } from "@opencode/core/agent";
|
|
10
10
|
import { Effect } from "effect";
|
|
11
|
-
import { HttpApiBuilder } from "effect/
|
|
11
|
+
import { HttpApiBuilder } from "effect/http-api";
|
|
12
12
|
import { AgentNotFoundError } from "@opencode/protocol/errors";
|
|
13
13
|
var AgentHandler2 = HttpApiBuilder.group(Api2, "server.agent", (handlers) => handlers.handle("agent.list", () => Effect.gen(function* () {
|
|
14
14
|
return yield* response2(Agent.Service.use((agent) => agent.list()));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./cors-ywn523ee.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./cors-h2a6nn7k.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/vcs.ts
|
|
9
9
|
import { Vcs } from "@opencode/core/vcs";
|
|
@@ -16,7 +16,7 @@ import { LocationServiceMap } from "@opencode/core/location-services";
|
|
|
16
16
|
import { ConflictError, InvalidRequestError, ServiceUnavailableError } from "@opencode/protocol/errors";
|
|
17
17
|
import { VcsInitNotSupportedError } from "@opencode/protocol/groups/vcs";
|
|
18
18
|
import { Effect } from "effect";
|
|
19
|
-
import { HttpApiBuilder, HttpApiSchema } from "effect/
|
|
19
|
+
import { HttpApiBuilder, HttpApiSchema } from "effect/http-api";
|
|
20
20
|
var VcsHandler2 = HttpApiBuilder.group(Api2, "server.vcs", (handlers) => Effect.gen(function* () {
|
|
21
21
|
const project = yield* Project.Service;
|
|
22
22
|
const bus = yield* Bus.Service;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./cors-ywn523ee.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./cors-h2a6nn7k.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/provider.ts
|
|
9
9
|
import { Provider } from "@opencode/core/provider";
|
|
10
10
|
import { ProviderNotFoundError } from "@opencode/protocol/errors";
|
|
11
11
|
import { Effect } from "effect";
|
|
12
|
-
import { HttpApiBuilder } from "effect/
|
|
12
|
+
import { HttpApiBuilder } from "effect/http-api";
|
|
13
13
|
var ProviderHandler2 = HttpApiBuilder.group(Api2, "server.provider", (handlers) => Effect.gen(function* () {
|
|
14
14
|
return handlers.handle("provider.list", Effect.fn(function* () {
|
|
15
15
|
const providers = yield* Provider.Service;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./cors-ywn523ee.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./cors-h2a6nn7k.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/shell.ts
|
|
9
9
|
import { Shell } from "@opencode/core/shell";
|
|
10
10
|
import { Location } from "@opencode/core/location";
|
|
11
11
|
import { Effect } from "effect";
|
|
12
|
-
import { HttpApiBuilder, HttpApiSchema } from "effect/
|
|
12
|
+
import { HttpApiBuilder, HttpApiSchema } from "effect/http-api";
|
|
13
13
|
import { ShellNotFoundError } from "@opencode/protocol/errors";
|
|
14
14
|
var ShellHandler2 = HttpApiBuilder.group(Api2, "server.shell", (handlers) => Effect.gen(function* () {
|
|
15
15
|
return handlers.handle("shell.list", Effect.fn(function* () {
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./cors-h2a6nn7k.js";
|
|
4
4
|
import {
|
|
5
5
|
SESSION_TTL_SECONDS2,
|
|
6
6
|
Config2,
|
|
7
7
|
issueSession2,
|
|
8
8
|
sessionCookieName2
|
|
9
|
-
} from "./
|
|
10
|
-
import {
|
|
11
|
-
Service3
|
|
12
|
-
} from "./service-status-s07e4y6n.js";
|
|
9
|
+
} from "./cors-anm12x33.js";
|
|
13
10
|
import {
|
|
14
11
|
Service5
|
|
15
|
-
} from "./
|
|
12
|
+
} from "./cors-g0rzwe5g.js";
|
|
13
|
+
import {
|
|
14
|
+
Service4
|
|
15
|
+
} from "./cors-byt4hbw9.js";
|
|
16
16
|
|
|
17
17
|
// src/handlers/server.ts
|
|
18
18
|
import { Duration, Effect } from "effect";
|
|
19
|
-
import { HttpServerRequest, HttpServerResponse } from "effect/
|
|
20
|
-
import { HttpApiBuilder } from "effect/
|
|
19
|
+
import { HttpServerRequest, HttpServerResponse } from "effect/http";
|
|
20
|
+
import { HttpApiBuilder } from "effect/http-api";
|
|
21
21
|
import { PersistentPty } from "@opencode/core/persistent-pty";
|
|
22
22
|
import { UnauthorizedError } from "@opencode/protocol/errors";
|
|
23
23
|
var ServerHandler2 = HttpApiBuilder.group(Api2, "server.server", (handlers) => Effect.gen(function* () {
|
|
24
|
-
const pairing = yield*
|
|
24
|
+
const pairing = yield* Service4;
|
|
25
25
|
const auth = yield* Config2;
|
|
26
26
|
return handlers.handle("server.info", () => Effect.gen(function* () {
|
|
27
|
-
const info = yield*
|
|
27
|
+
const info = yield* Service5;
|
|
28
28
|
return {
|
|
29
29
|
version: info.app.version ?? "unknown",
|
|
30
30
|
pid: process.pid ?? 0,
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__export
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./cors-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: () => Service3,
|
|
11
11
|
SubscriberCapacity: () => SubscriberCapacity2,
|
|
12
12
|
SubscriberOverflowError: () => SubscriberOverflowError2,
|
|
13
13
|
frame: () => frame2,
|
|
14
|
-
layer: () =>
|
|
14
|
+
layer: () => layer3,
|
|
15
15
|
make: () => make4
|
|
16
16
|
});
|
|
17
17
|
import { Bus } from "@opencode/core/bus";
|
|
@@ -30,7 +30,7 @@ class EncodingError2 extends Schema.TaggedError()("EventFeed.EncodingError", {
|
|
|
30
30
|
}) {
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
class
|
|
33
|
+
class Service3 extends Context.Service()("@opencode/server/EventFeed") {
|
|
34
34
|
}
|
|
35
35
|
function frame2(event) {
|
|
36
36
|
return `data: ${JSON.stringify(event)}
|
|
@@ -71,13 +71,13 @@ var make4 = Effect.fn("EventFeed.make")(function* (observe, options) {
|
|
|
71
71
|
});
|
|
72
72
|
const unsubscribe = yield* observe(publish);
|
|
73
73
|
yield* Effect.addFinalizer(() => unsubscribe);
|
|
74
|
-
return
|
|
74
|
+
return Service3.of({
|
|
75
75
|
subscribe: Effect.acquireRelease(Queue.dropping(capacity).pipe(Effect.tap((queue) => Effect.sync(() => subscribers.add(queue)))), (queue) => Effect.sync(() => subscribers.delete(queue)).pipe(Effect.andThen(Queue.shutdown(queue)), Effect.asVoid)).pipe(Effect.map(Stream.fromQueue))
|
|
76
76
|
});
|
|
77
77
|
});
|
|
78
|
-
var
|
|
78
|
+
var layer3 = Layer.effect(Service3, Effect.gen(function* () {
|
|
79
79
|
const bus = yield* Bus.Service;
|
|
80
80
|
return yield* make4(bus.listen);
|
|
81
81
|
}));
|
|
82
82
|
|
|
83
|
-
export { SubscriberCapacity2, SubscriberOverflowError2, EncodingError2,
|
|
83
|
+
export { SubscriberCapacity2, SubscriberOverflowError2, EncodingError2, Service3, frame2, make4, layer3, exports_event_feed };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
locationErrors2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./cors-ywn523ee.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./cors-h2a6nn7k.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/generate.ts
|
|
9
9
|
import { Generate } from "@opencode/core/generate";
|
|
@@ -13,7 +13,7 @@ import { AbsolutePath } from "@opencode/core/schema";
|
|
|
13
13
|
import { InvalidRequestError, ServiceUnavailableError } from "@opencode/protocol/errors";
|
|
14
14
|
import { Global } from "@opencode/util/global";
|
|
15
15
|
import { Effect } from "effect";
|
|
16
|
-
import { HttpApiBuilder } from "effect/
|
|
16
|
+
import { HttpApiBuilder } from "effect/http-api";
|
|
17
17
|
var GenerateHandler2 = HttpApiBuilder.group(Api2, "server.generate", (handlers) => Effect.gen(function* () {
|
|
18
18
|
const global = yield* Global.Service;
|
|
19
19
|
const locations = yield* LocationServiceMap.Service;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./cors-h2a6nn7k.js";
|
|
4
4
|
|
|
5
5
|
// src/handlers/worktree.ts
|
|
6
6
|
import { Git } from "@opencode/core/git";
|
|
@@ -8,7 +8,7 @@ import { Worktree } from "@opencode/core/worktree";
|
|
|
8
8
|
import { ProjectNotFoundError } from "@opencode/protocol/errors";
|
|
9
9
|
import { WorktreeError } from "@opencode/protocol/groups/worktree";
|
|
10
10
|
import { Effect } from "effect";
|
|
11
|
-
import { HttpApiBuilder, HttpApiSchema } from "effect/
|
|
11
|
+
import { HttpApiBuilder, HttpApiSchema } from "effect/http-api";
|
|
12
12
|
var WorktreeHandler2 = HttpApiBuilder.group(Api2, "server.worktree", (handlers) => Effect.gen(function* () {
|
|
13
13
|
const worktrees = yield* Worktree.Service;
|
|
14
14
|
return handlers.handle("worktree.list", (ctx) => worktrees.list(ctx.query).pipe(Effect.catchTag("Project.NotFoundError", missingProject))).handle("worktree.create", (ctx) => worktrees.create(ctx.payload).pipe(badRequest)).handle("worktree.remove", (ctx) => worktrees.remove(ctx.payload).pipe(badRequest, Effect.as(HttpApiSchema.NoContent.make()))).handle("worktree.refresh", (ctx) => worktrees.refresh(ctx.payload).pipe(badRequest, Effect.as(HttpApiSchema.NoContent.make())));
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
locationErrors2,
|
|
3
3
|
sessionInfo2,
|
|
4
4
|
requestRef2
|
|
5
|
-
} from "./
|
|
5
|
+
} from "./cors-ywn523ee.js";
|
|
6
6
|
|
|
7
7
|
// src/middleware/form-location.ts
|
|
8
8
|
import { Instance } from "@opencode/core/instance/service";
|
|
@@ -10,8 +10,8 @@ import { LocationServiceMap } from "@opencode/core/location-services";
|
|
|
10
10
|
import { Session } from "@opencode/core/session";
|
|
11
11
|
import { LocationNotFoundError, InvalidRequestError, SessionNotFoundError } from "@opencode/protocol/errors";
|
|
12
12
|
import { Effect, Layer } from "effect";
|
|
13
|
-
import { HttpRouter, HttpServerRequest } from "effect/
|
|
14
|
-
import { HttpApiMiddleware } from "effect/
|
|
13
|
+
import { HttpRouter, HttpServerRequest } from "effect/http";
|
|
14
|
+
import { HttpApiMiddleware } from "effect/http-api";
|
|
15
15
|
class FormLocationMiddleware2 extends HttpApiMiddleware.Service()("@opencode/HttpApiFormLocation", {
|
|
16
16
|
error: [InvalidRequestError, SessionNotFoundError, LocationNotFoundError]
|
|
17
17
|
}) {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
locationErrors2,
|
|
3
3
|
sessionInfo2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./cors-ywn523ee.js";
|
|
5
5
|
|
|
6
6
|
// src/middleware/session-location.ts
|
|
7
7
|
import { Instance } from "@opencode/core/instance/service";
|
|
8
8
|
import { Session } from "@opencode/core/session";
|
|
9
9
|
import { Effect, Layer } from "effect";
|
|
10
|
-
import { HttpRouter } from "effect/
|
|
11
|
-
import { HttpApiMiddleware } from "effect/
|
|
10
|
+
import { HttpRouter } from "effect/http";
|
|
11
|
+
import { HttpApiMiddleware } from "effect/http-api";
|
|
12
12
|
import { LocationNotFoundError, InvalidRequestError, SessionNotFoundError } from "@opencode/protocol/errors";
|
|
13
13
|
class SessionLocationMiddleware2 extends HttpApiMiddleware.Service()("@opencode/HttpApiSessionLocation", {
|
|
14
14
|
error: [InvalidRequestError, SessionNotFoundError, LocationNotFoundError]
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./cors-ywn523ee.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./cors-h2a6nn7k.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/mcp.ts
|
|
9
9
|
import { Mcp } from "@opencode/core/mcp/index";
|
|
10
10
|
import { McpServerNotFoundError } from "@opencode/protocol/errors";
|
|
11
11
|
import { Effect } from "effect";
|
|
12
|
-
import { HttpApiBuilder, HttpApiSchema } from "effect/
|
|
12
|
+
import { HttpApiBuilder, HttpApiSchema } from "effect/http-api";
|
|
13
13
|
var notFound = (effect) => effect.pipe(Effect.mapError((error) => new McpServerNotFoundError({ server: error.server, message: error.message })));
|
|
14
14
|
var McpHandler2 = HttpApiBuilder.group(Api2, "server.mcp", (handlers) => Effect.gen(function* () {
|
|
15
15
|
return handlers.handle("mcp.list", Effect.fn(function* () {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isAllowedCorsOrigin2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./cors-q4bn6dy8.js";
|
|
4
4
|
import {
|
|
5
5
|
createRoutes2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./cors-1x5dvcb3.js";
|
|
7
7
|
import {
|
|
8
8
|
__export
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./cors-9rqn6x4v.js";
|
|
10
10
|
|
|
11
11
|
// src/fetch.ts
|
|
12
12
|
var exports_fetch = {};
|
|
@@ -15,7 +15,7 @@ __export(exports_fetch, {
|
|
|
15
15
|
make: () => make3
|
|
16
16
|
});
|
|
17
17
|
import { Context, Effect, Layer } from "effect";
|
|
18
|
-
import { HttpEffect, HttpMiddleware, HttpRouter, HttpServer } from "effect/
|
|
18
|
+
import { HttpEffect, HttpMiddleware, HttpRouter, HttpServer } from "effect/http";
|
|
19
19
|
import { SessionRestart } from "@opencode/core/session/execution/restart";
|
|
20
20
|
var make3 = Effect.fn("ServerFetch.make")(function* (options = {}, boot = {}) {
|
|
21
21
|
const context = yield* Layer.build(createRoutes2(options, () => [], boot.overrides ?? []).pipe(Layer.provide(HttpServer.layerServices)));
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./cors-h2a6nn7k.js";
|
|
4
4
|
|
|
5
5
|
// src/handlers/migration.ts
|
|
6
6
|
import { V1Migration } from "@opencode/core/database/v1-migration";
|
|
7
|
-
import { HttpApiBuilder } from "effect/
|
|
7
|
+
import { HttpApiBuilder } from "effect/http-api";
|
|
8
8
|
import { Effect } from "effect";
|
|
9
9
|
var MigrationHandler2 = HttpApiBuilder.group(Api2, "server.migration", (handlers) => handlers.handle("migration.v1.status", Effect.fn(function* () {
|
|
10
10
|
return yield* V1Migration.status();
|