@opencode/server 2.0.26 → 2.0.27
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 +17 -14
- package/dist/api.js +5 -5
- package/dist/auth.js +1 -1
- package/dist/chunks/{fetch-eekrj6qv.js → pty-environment-08x9tjee.js} +2 -2
- package/dist/chunks/{fetch-0chp8crd.js → pty-environment-0chp8crd.js} +1 -1
- package/dist/chunks/pty-environment-0d864bga.js +15 -0
- package/dist/chunks/{fetch-m4fq9qce.js → pty-environment-1k1cts14.js} +4 -4
- package/dist/chunks/{fetch-n1svm92q.js → pty-environment-383t61pr.js} +5 -5
- package/dist/chunks/{fetch-agftk6b6.js → pty-environment-43r48nqn.js} +3 -3
- package/dist/chunks/{fetch-wb43dd8f.js → pty-environment-4d1eemzq.js} +6 -4
- package/dist/chunks/{fetch-zhympcbw.js → pty-environment-4dv9a668.js} +3 -3
- package/dist/chunks/{fetch-d00srfh1.js → pty-environment-4hhhes7w.js} +3 -3
- package/dist/chunks/{fetch-b44t4qeg.js → pty-environment-4yg61rns.js} +30 -29
- package/dist/chunks/{fetch-gtkdacvk.js → pty-environment-5ytyqf1q.js} +5 -4
- package/dist/chunks/{fetch-r5bb0n1s.js → pty-environment-5zsr2h86.js} +2 -2
- package/dist/chunks/{fetch-rwwc81rq.js → pty-environment-7vd5668a.js} +2 -2
- package/dist/chunks/{fetch-w1fepcwh.js → pty-environment-8137b89p.js} +3 -3
- package/dist/chunks/{fetch-053p7hbt.js → pty-environment-8ad8dwnf.js} +4 -4
- package/dist/chunks/{fetch-4qyjttng.js → pty-environment-97eb2r3v.js} +3 -3
- package/dist/chunks/{fetch-jxc39wgw.js → pty-environment-9snwnvf8.js} +3 -3
- package/dist/chunks/{fetch-t1n0m4wb.js → pty-environment-aey6dvfz.js} +30 -34
- package/dist/chunks/{fetch-anm12x33.js → pty-environment-anm12x33.js} +1 -1
- package/dist/chunks/{fetch-acgs9zzk.js → pty-environment-b56hqv74.js} +14 -6
- package/dist/chunks/{fetch-cm271yqe.js → pty-environment-bx47k33v.js} +3 -3
- package/dist/chunks/{fetch-c6kb7fmf.js → pty-environment-c6kb7fmf.js} +1 -1
- package/dist/chunks/{fetch-t8yzmczr.js → pty-environment-erzfdgke.js} +1 -1
- package/dist/chunks/{fetch-gj6tv0s4.js → pty-environment-ewe1fzkk.js} +6 -3
- package/dist/chunks/{fetch-hajt4q09.js → pty-environment-ftaz8n62.js} +3 -3
- package/dist/chunks/pty-environment-h6rt5k9s.js +24 -0
- package/dist/chunks/{fetch-mjepr257.js → pty-environment-h8ws5ssa.js} +2 -2
- package/dist/chunks/{fetch-kzj5eept.js → pty-environment-hkm2snxm.js} +33 -33
- package/dist/chunks/{fetch-nxdx74sv.js → pty-environment-j4zqsxgy.js} +3 -3
- package/dist/chunks/{fetch-80mhd8t7.js → pty-environment-nn6dbt3f.js} +3 -3
- package/dist/chunks/{fetch-6fr0a7bp.js → pty-environment-pfs7tp5t.js} +17 -16
- package/dist/chunks/{fetch-0y03q8mn.js → pty-environment-ptey1p5v.js} +3 -3
- package/dist/chunks/{fetch-g9rgg5ys.js → pty-environment-qbh90c1d.js} +3 -3
- package/dist/chunks/{fetch-rhnwnf76.js → pty-environment-rf01ee6q.js} +2 -2
- package/dist/chunks/{fetch-1w9kp1gg.js → pty-environment-rntbwr87.js} +3 -3
- package/dist/chunks/{fetch-q9rkrfm7.js → pty-environment-ssyxw8nc.js} +5 -5
- package/dist/chunks/{fetch-78n975k2.js → pty-environment-sxyyq1rb.js} +6 -6
- package/dist/chunks/{fetch-cy7y42ks.js → pty-environment-tqspcwns.js} +4 -4
- package/dist/chunks/{fetch-bvp1r88z.js → pty-environment-vb5yx5r0.js} +3 -3
- package/dist/chunks/{fetch-m6xk774d.js → pty-environment-vbzm2jgm.js} +3 -3
- package/dist/chunks/{fetch-54sczv30.js → pty-environment-vghchchj.js} +7 -7
- package/dist/chunks/{fetch-5w24ch67.js → pty-environment-vpz7f20y.js} +4 -4
- package/dist/chunks/{fetch-1kbkbftd.js → pty-environment-y1gfy88d.js} +4 -4
- package/dist/chunks/{fetch-t70dy8sr.js → pty-environment-yehasrps.js} +3 -3
- package/dist/chunks/{fetch-8c9kbrtm.js → pty-environment-z6sxg6td.js} +2 -2
- package/dist/chunks/{fetch-j3pdvhe2.js → pty-environment-zessacar.js} +3 -3
- package/dist/cors.js +1 -1
- package/dist/event-feed.js +5 -5
- package/dist/fetch.d.ts +1 -1
- 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 +5 -3
- package/dist/location.js +6 -4
- package/dist/middleware/authorization.d.ts +1 -1
- package/dist/middleware/authorization.js +2 -2
- package/dist/middleware/form-location.d.ts +2 -2
- 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 +1 -1
- package/dist/process.d.ts +5 -4
- package/dist/process.js +52 -52
- package/dist/pty-environment.js +3 -3
- 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 +1 -1
- package/dist/service-status.js +3 -3
- package/dist/workerd.js +48 -48
- package/package.json +14 -12
- package/dist/chunks/fetch-dy0yben3.js +0 -15
- package/dist/chunks/fetch-hezj1jdf.js +0 -7
- /package/dist/chunks/{fetch-9rqn6x4v.js → pty-environment-9rqn6x4v.js} +0 -0
- /package/dist/chunks/{fetch-q4bn6dy8.js → pty-environment-q4bn6dy8.js} +0 -0
- /package/dist/chunks/{fetch-smaf4a18.js → pty-environment-smaf4a18.js} +0 -0
- /package/dist/chunks/{fetch-yc7nft6q.js → pty-environment-yc7nft6q.js} +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./pty-environment-9snwnvf8.js";
|
|
4
4
|
import {
|
|
5
5
|
CorsConfig2,
|
|
6
6
|
isAllowedRequestOrigin2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./pty-environment-q4bn6dy8.js";
|
|
8
8
|
import {
|
|
9
9
|
runPtySocket2
|
|
10
|
-
} from "./
|
|
10
|
+
} from "./pty-environment-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,17 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
missingSession2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./pty-environment-smaf4a18.js";
|
|
4
4
|
|
|
5
5
|
// src/location.ts
|
|
6
6
|
import { FileSystem } from "@opencode/core/filesystem";
|
|
7
7
|
import { Location } from "@opencode/core/location";
|
|
8
|
+
import { Plugin } from "@opencode/core/plugin";
|
|
8
9
|
import { LocationServiceMap } from "@opencode/core/location-services";
|
|
9
10
|
import { AbsolutePath } from "@opencode/core/schema";
|
|
10
11
|
import { Session } from "@opencode/core/session";
|
|
11
|
-
import { LocationNotFoundError, InvalidRequestError } from "@opencode/protocol/errors";
|
|
12
|
+
import { LocationNotFoundError, InvalidRequestError, ServiceUnavailableError } from "@opencode/protocol/errors";
|
|
12
13
|
import { Effect, Layer, Schema } from "effect";
|
|
13
|
-
import { HttpServerRequest } from "effect/
|
|
14
|
-
import { HttpApiMiddleware } from "effect/
|
|
14
|
+
import { HttpServerRequest } from "effect/http";
|
|
15
|
+
import { HttpApiMiddleware } from "effect/http-api";
|
|
15
16
|
class LocationMiddleware2 extends HttpApiMiddleware.Service()("@opencode/HttpApiLocation", { error: [LocationNotFoundError] }) {
|
|
16
17
|
}
|
|
17
18
|
function locationErrors2(effect) {
|
|
@@ -20,6 +21,13 @@ function locationErrors2(effect) {
|
|
|
20
21
|
message: `Location not found: ${error.directory}`
|
|
21
22
|
}))));
|
|
22
23
|
}
|
|
24
|
+
var awaitPlugins2 = Plugin.awaitActivation.pipe(Effect.timeoutOrElse({
|
|
25
|
+
duration: "5 seconds",
|
|
26
|
+
orElse: () => Effect.fail(new ServiceUnavailableError({
|
|
27
|
+
message: "Location plugins did not finish activating",
|
|
28
|
+
service: "plugin"
|
|
29
|
+
}))
|
|
30
|
+
}));
|
|
23
31
|
function response2(data) {
|
|
24
32
|
return Effect.gen(function* () {
|
|
25
33
|
const location = yield* Location.Service;
|
|
@@ -51,7 +59,7 @@ function decode(input) {
|
|
|
51
59
|
return input;
|
|
52
60
|
}
|
|
53
61
|
}
|
|
54
|
-
var
|
|
62
|
+
var layer5 = Layer.effect(LocationMiddleware2, Effect.gen(function* () {
|
|
55
63
|
const locations = yield* LocationServiceMap.Service;
|
|
56
64
|
return LocationMiddleware2.of((effect) => Effect.gen(function* () {
|
|
57
65
|
const request = yield* HttpServerRequest.HttpServerRequest;
|
|
@@ -59,4 +67,4 @@ var layer3 = Layer.effect(LocationMiddleware2, Effect.gen(function* () {
|
|
|
59
67
|
}));
|
|
60
68
|
}));
|
|
61
69
|
|
|
62
|
-
export { LocationMiddleware2, locationErrors2, response2, sessionInfo2, requestRef2,
|
|
70
|
+
export { LocationMiddleware2, locationErrors2, awaitPlugins2, response2, sessionInfo2, requestRef2, layer5 };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./pty-environment-b56hqv74.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./pty-environment-9snwnvf8.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,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,19 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
|
+
awaitPlugins2,
|
|
2
3
|
response2
|
|
3
|
-
} from "./
|
|
4
|
+
} from "./pty-environment-b56hqv74.js";
|
|
4
5
|
import {
|
|
5
6
|
Api2
|
|
6
|
-
} from "./
|
|
7
|
+
} from "./pty-environment-9snwnvf8.js";
|
|
7
8
|
|
|
8
9
|
// src/handlers/model.ts
|
|
9
10
|
import { Model } from "@opencode/core/model";
|
|
10
11
|
import { Effect } from "effect";
|
|
11
|
-
import { HttpApiBuilder } from "effect/
|
|
12
|
+
import { HttpApiBuilder } from "effect/http-api";
|
|
12
13
|
var ModelHandler2 = HttpApiBuilder.group(Api2, "server.model", (handlers) => Effect.gen(function* () {
|
|
13
14
|
return handlers.handle("model.list", Effect.fn(function* () {
|
|
15
|
+
yield* awaitPlugins2;
|
|
14
16
|
const models = yield* Model.Service;
|
|
15
17
|
return yield* response2(models.available());
|
|
16
18
|
})).handle("model.default", Effect.fn(function* () {
|
|
19
|
+
yield* awaitPlugins2;
|
|
17
20
|
const models = yield* Model.Service;
|
|
18
21
|
return yield* response2(models.default());
|
|
19
22
|
}));
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./pty-environment-b56hqv74.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./pty-environment-9snwnvf8.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/integration.ts
|
|
9
9
|
import { Integration } from "@opencode/core/integration";
|
|
10
10
|
import { Plugin } from "@opencode/core/plugin";
|
|
11
11
|
import { Effect } from "effect";
|
|
12
|
-
import { HttpApiBuilder, HttpApiSchema } from "effect/
|
|
12
|
+
import { HttpApiBuilder, HttpApiSchema } from "effect/http-api";
|
|
13
13
|
import {
|
|
14
14
|
IntegrationAttemptNotFoundError,
|
|
15
15
|
IntegrationMethodNotFoundError,
|
|
@@ -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
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./pty-environment-9snwnvf8.js";
|
|
4
4
|
|
|
5
5
|
// src/handlers/location.ts
|
|
6
6
|
import { Location } from "@opencode/core/location";
|
|
7
7
|
import { LocationServiceMap } from "@opencode/core/location-service-map";
|
|
8
8
|
import { ServiceUnavailableError } from "@opencode/protocol/errors";
|
|
9
9
|
import { Cause, Effect } from "effect";
|
|
10
|
-
import { HttpApiBuilder } from "effect/
|
|
10
|
+
import { HttpApiBuilder } from "effect/http-api";
|
|
11
11
|
var LocationHandler2 = HttpApiBuilder.group(Api2, "server.location", (handlers) => Effect.gen(function* () {
|
|
12
12
|
const locations = yield* LocationServiceMap.Service;
|
|
13
13
|
return handlers.handle("location.get", Effect.fn(function* () {
|
|
@@ -1,99 +1,99 @@
|
|
|
1
1
|
import {
|
|
2
2
|
GenerateHandler2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./pty-environment-4d1eemzq.js";
|
|
4
4
|
import {
|
|
5
5
|
MessageHandler2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./pty-environment-vb5yx5r0.js";
|
|
7
7
|
import {
|
|
8
8
|
ModelHandler2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./pty-environment-ewe1fzkk.js";
|
|
10
10
|
import {
|
|
11
11
|
ProviderHandler2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./pty-environment-97eb2r3v.js";
|
|
13
13
|
import {
|
|
14
14
|
SessionHandler2
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./pty-environment-tqspcwns.js";
|
|
16
16
|
import {
|
|
17
17
|
PermissionHandler2
|
|
18
|
-
} from "./
|
|
18
|
+
} from "./pty-environment-y1gfy88d.js";
|
|
19
19
|
import {
|
|
20
20
|
FileSystemHandler2
|
|
21
|
-
} from "./
|
|
21
|
+
} from "./pty-environment-ssyxw8nc.js";
|
|
22
22
|
import {
|
|
23
23
|
FormHandler2
|
|
24
|
-
} from "./
|
|
24
|
+
} from "./pty-environment-43r48nqn.js";
|
|
25
25
|
import {
|
|
26
26
|
CommandHandler2
|
|
27
|
-
} from "./
|
|
27
|
+
} from "./pty-environment-ptey1p5v.js";
|
|
28
28
|
import {
|
|
29
29
|
SkillHandler2
|
|
30
|
-
} from "./
|
|
30
|
+
} from "./pty-environment-bx47k33v.js";
|
|
31
31
|
import {
|
|
32
32
|
RpcHandler2
|
|
33
|
-
} from "./
|
|
33
|
+
} from "./pty-environment-z6sxg6td.js";
|
|
34
34
|
import {
|
|
35
|
-
|
|
36
|
-
} from "./
|
|
35
|
+
layer4
|
|
36
|
+
} from "./pty-environment-vghchchj.js";
|
|
37
37
|
import {
|
|
38
38
|
EventHandler2
|
|
39
|
-
} from "./
|
|
39
|
+
} from "./pty-environment-1k1cts14.js";
|
|
40
40
|
import {
|
|
41
41
|
AgentHandler2
|
|
42
|
-
} from "./
|
|
42
|
+
} from "./pty-environment-rntbwr87.js";
|
|
43
43
|
import {
|
|
44
44
|
PluginHandler2
|
|
45
|
-
} from "./
|
|
45
|
+
} from "./pty-environment-8137b89p.js";
|
|
46
46
|
import {
|
|
47
47
|
ServerHandler2
|
|
48
|
-
} from "./
|
|
48
|
+
} from "./pty-environment-sxyyq1rb.js";
|
|
49
49
|
import {
|
|
50
50
|
DebugHandler2
|
|
51
|
-
} from "./
|
|
51
|
+
} from "./pty-environment-vbzm2jgm.js";
|
|
52
52
|
import {
|
|
53
53
|
PtyHandler2
|
|
54
|
-
} from "./
|
|
54
|
+
} from "./pty-environment-4yg61rns.js";
|
|
55
55
|
import {
|
|
56
56
|
PersistentPtyHandler2
|
|
57
|
-
} from "./
|
|
57
|
+
} from "./pty-environment-aey6dvfz.js";
|
|
58
58
|
import {
|
|
59
59
|
ShellHandler2
|
|
60
|
-
} from "./
|
|
60
|
+
} from "./pty-environment-4dv9a668.js";
|
|
61
61
|
import {
|
|
62
62
|
ReferenceHandler2
|
|
63
|
-
} from "./
|
|
63
|
+
} from "./pty-environment-yehasrps.js";
|
|
64
64
|
import {
|
|
65
65
|
LocationHandler2
|
|
66
|
-
} from "./
|
|
66
|
+
} from "./pty-environment-h8ws5ssa.js";
|
|
67
67
|
import {
|
|
68
68
|
IntegrationHandler2
|
|
69
|
-
} from "./
|
|
69
|
+
} from "./pty-environment-ftaz8n62.js";
|
|
70
70
|
import {
|
|
71
71
|
WebSearchHandler2
|
|
72
|
-
} from "./
|
|
72
|
+
} from "./pty-environment-nn6dbt3f.js";
|
|
73
73
|
import {
|
|
74
74
|
McpHandler2
|
|
75
|
-
} from "./
|
|
75
|
+
} from "./pty-environment-zessacar.js";
|
|
76
76
|
import {
|
|
77
77
|
CredentialHandler2
|
|
78
|
-
} from "./
|
|
78
|
+
} from "./pty-environment-08x9tjee.js";
|
|
79
79
|
import {
|
|
80
80
|
ProjectHandler2
|
|
81
|
-
} from "./
|
|
81
|
+
} from "./pty-environment-0d864bga.js";
|
|
82
82
|
import {
|
|
83
83
|
WorktreeHandler2
|
|
84
|
-
} from "./
|
|
84
|
+
} from "./pty-environment-7vd5668a.js";
|
|
85
85
|
import {
|
|
86
86
|
VcsHandler2
|
|
87
|
-
} from "./
|
|
87
|
+
} from "./pty-environment-qbh90c1d.js";
|
|
88
88
|
import {
|
|
89
89
|
MigrationHandler2
|
|
90
|
-
} from "./
|
|
90
|
+
} from "./pty-environment-rf01ee6q.js";
|
|
91
91
|
import {
|
|
92
92
|
ConfigHandler2
|
|
93
|
-
} from "./
|
|
93
|
+
} from "./pty-environment-5zsr2h86.js";
|
|
94
94
|
|
|
95
95
|
// src/handlers.ts
|
|
96
96
|
import { Layer } from "effect";
|
|
97
|
-
var handlers2 = Layer.mergeAll(ServerHandler2, DebugHandler2, MigrationHandler2, LocationHandler2, AgentHandler2, PluginHandler2, SessionHandler2, MessageHandler2, ModelHandler2, GenerateHandler2, ProviderHandler2, IntegrationHandler2, WebSearchHandler2, McpHandler2, CredentialHandler2, ProjectHandler2, FormHandler2, PermissionHandler2, FileSystemHandler2, CommandHandler2, SkillHandler2, RpcHandler2, EventHandler2.pipe(Layer.provide(
|
|
97
|
+
var handlers2 = Layer.mergeAll(ServerHandler2, DebugHandler2, MigrationHandler2, LocationHandler2, AgentHandler2, PluginHandler2, SessionHandler2, MessageHandler2, ModelHandler2, GenerateHandler2, ProviderHandler2, IntegrationHandler2, WebSearchHandler2, McpHandler2, CredentialHandler2, ProjectHandler2, FormHandler2, PermissionHandler2, FileSystemHandler2, CommandHandler2, SkillHandler2, RpcHandler2, EventHandler2.pipe(Layer.provide(layer4)), PtyHandler2, PersistentPtyHandler2, ShellHandler2, ReferenceHandler2, WorktreeHandler2, VcsHandler2, ConfigHandler2);
|
|
98
98
|
|
|
99
99
|
export { handlers2 };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
locationErrors2,
|
|
3
3
|
sessionInfo2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./pty-environment-b56hqv74.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 "./pty-environment-b56hqv74.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./pty-environment-9snwnvf8.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/websearch.ts
|
|
9
9
|
import { WebSearch } from "@opencode/core/websearch";
|
|
10
10
|
import { InvalidRequestError, ServiceUnavailableError } 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 WebSearchHandler2 = HttpApiBuilder.group(Api2, "server.websearch", (handlers) => Effect.gen(function* () {
|
|
14
14
|
return handlers.handle("websearch.providers", Effect.fn("server.websearch.providers")(function* () {
|
|
15
15
|
const websearch = yield* WebSearch.Service;
|
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./
|
|
2
|
+
layer5
|
|
3
|
+
} from "./pty-environment-b56hqv74.js";
|
|
4
4
|
import {
|
|
5
5
|
formLocationLayer2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./pty-environment-4hhhes7w.js";
|
|
7
7
|
import {
|
|
8
8
|
sessionLocationLayer2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./pty-environment-j4zqsxgy.js";
|
|
10
10
|
import {
|
|
11
11
|
Api2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./pty-environment-9snwnvf8.js";
|
|
13
13
|
import {
|
|
14
14
|
Config2
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./pty-environment-anm12x33.js";
|
|
16
16
|
import {
|
|
17
17
|
CorsConfig2
|
|
18
|
-
} from "./
|
|
18
|
+
} from "./pty-environment-q4bn6dy8.js";
|
|
19
19
|
import {
|
|
20
20
|
layer2
|
|
21
|
-
} from "./
|
|
21
|
+
} from "./pty-environment-c6kb7fmf.js";
|
|
22
22
|
import {
|
|
23
23
|
node2
|
|
24
|
-
} from "./
|
|
24
|
+
} from "./pty-environment-0chp8crd.js";
|
|
25
25
|
import {
|
|
26
26
|
node3
|
|
27
|
-
} from "./
|
|
27
|
+
} from "./pty-environment-383t61pr.js";
|
|
28
28
|
import {
|
|
29
29
|
handlers2
|
|
30
|
-
} from "./
|
|
30
|
+
} from "./pty-environment-hkm2snxm.js";
|
|
31
31
|
import {
|
|
32
32
|
authorizationLayer2
|
|
33
|
-
} from "./
|
|
33
|
+
} from "./pty-environment-5ytyqf1q.js";
|
|
34
34
|
import {
|
|
35
35
|
schemaErrorLayer2
|
|
36
|
-
} from "./
|
|
36
|
+
} from "./pty-environment-erzfdgke.js";
|
|
37
37
|
|
|
38
38
|
// src/routes.ts
|
|
39
39
|
import { Database } from "@opencode/core/database/database";
|
|
@@ -69,8 +69,8 @@ import { SdkPlugins } from "@opencode/core/plugin/sdk";
|
|
|
69
69
|
import { WellKnown } from "@opencode/core/wellknown";
|
|
70
70
|
import { Workspace } from "@opencode/core/workspace";
|
|
71
71
|
import { Watcher } from "@opencode/core/filesystem/watcher";
|
|
72
|
-
import { HttpRouter } from "effect/
|
|
73
|
-
import { HttpApiBuilder } from "effect/
|
|
72
|
+
import { HttpRouter } from "effect/http";
|
|
73
|
+
import { HttpApiBuilder } from "effect/http-api";
|
|
74
74
|
import { Context, Effect, Layer, Option } from "effect";
|
|
75
75
|
var applicationServiceNodes = [
|
|
76
76
|
Global.node,
|
|
@@ -80,6 +80,7 @@ var applicationServiceNodes = [
|
|
|
80
80
|
httpClient,
|
|
81
81
|
Job.node,
|
|
82
82
|
Project.node,
|
|
83
|
+
Project.sweepNode,
|
|
83
84
|
Worktree.node,
|
|
84
85
|
Session.node,
|
|
85
86
|
Instance.node,
|
|
@@ -145,7 +146,7 @@ function makeRoutes(auth, options, serviceURLs, overrides, instances) {
|
|
|
145
146
|
return serviceLayer.pipe(Layer.flatMap((context) => {
|
|
146
147
|
const services = Layer.succeedContext(context);
|
|
147
148
|
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));
|
|
148
|
-
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(
|
|
149
|
+
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(layer5), Layer.provide(authorizationLayer2), Layer.provide(schemaErrorLayer2), Layer.provide(auth), HttpRouter.provideRequest(requestServices), Layer.provideMerge(services), Layer.provideMerge(HttpRouter.layer));
|
|
149
150
|
return Layer.merge(api, V1Migration.layer.pipe(Layer.provide(services)));
|
|
150
151
|
}));
|
|
151
152
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./pty-environment-b56hqv74.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./pty-environment-9snwnvf8.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/command.ts
|
|
9
9
|
import { Command } from "@opencode/core/command";
|
|
10
|
-
import { HttpApiBuilder } from "effect/
|
|
10
|
+
import { HttpApiBuilder } from "effect/http-api";
|
|
11
11
|
var CommandHandler2 = HttpApiBuilder.group(Api2, "server.command", (handlers) => handlers.handle("command.list", () => response2(Command.Service.use((command) => command.list()))));
|
|
12
12
|
|
|
13
13
|
export { CommandHandler2 };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./pty-environment-b56hqv74.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./pty-environment-9snwnvf8.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,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./pty-environment-9snwnvf8.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();
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./pty-environment-b56hqv74.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./pty-environment-9snwnvf8.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,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./pty-environment-b56hqv74.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./pty-environment-9snwnvf8.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/fs.ts
|
|
9
9
|
import { FileSystem } from "@opencode/core/filesystem";
|
|
10
10
|
import { RelativePath } from "@opencode/core/schema";
|
|
11
11
|
import { FileNotFoundError } from "@opencode/protocol/errors";
|
|
12
12
|
import { Effect, Option, Stream } from "effect";
|
|
13
|
-
import { HttpServerResponse } from "effect/
|
|
14
|
-
import { HttpApiBuilder } from "effect/
|
|
13
|
+
import { HttpServerResponse } from "effect/http";
|
|
14
|
+
import { HttpApiBuilder } from "effect/http-api";
|
|
15
15
|
var FileSystemHandler2 = HttpApiBuilder.group(Api2, "server.fs", (handlers) => Effect.gen(function* () {
|
|
16
16
|
return handlers.handleRaw("fs.read", (ctx) => Effect.gen(function* () {
|
|
17
17
|
const path = yield* decodeRequestPath(ctx.request.url);
|
|
@@ -20,7 +20,7 @@ var FileSystemHandler2 = HttpApiBuilder.group(Api2, "server.fs", (handlers) => E
|
|
|
20
20
|
return serveFile(ctx.request, file);
|
|
21
21
|
})).handle("fs.list", (ctx) => response2(Effect.gen(function* () {
|
|
22
22
|
const fs = yield* FileSystem.Service;
|
|
23
|
-
return yield* fs.list(ctx.query);
|
|
23
|
+
return yield* fs.list(ctx.query).pipe(Effect.mapError((error) => new FileNotFoundError({ path: error.path, message: `Directory not found: ${error.path}` })));
|
|
24
24
|
}))).handle("fs.find", (ctx) => response2(Effect.gen(function* () {
|
|
25
25
|
const fs = yield* FileSystem.Service;
|
|
26
26
|
return yield* fs.find(ctx.query);
|