@opencode/server 0.0.0-dev-1301 → 0.0.0-dev-1302
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 +4 -4
- package/dist/chunks/{api-b0sezs8j.js → api-09kw3a77.js} +2 -2
- package/dist/chunks/{api-c6sjpm0r.js → api-1h6b4sc5.js} +23 -3
- package/dist/chunks/{api-34xzc0ha.js → api-1ndv3m9h.js} +2 -2
- package/dist/chunks/{api-qn8kkfq6.js → api-2eaky32g.js} +2 -2
- package/dist/chunks/{api-e9906t2e.js → api-3rjhh738.js} +4 -4
- package/dist/chunks/{api-z59gyc0x.js → api-4q6e7fh8.js} +2 -2
- package/dist/chunks/{api-gqq6kfhc.js → api-50bbk3b2.js} +2 -2
- package/dist/chunks/{api-0n1e9dnh.js → api-58psf7ej.js} +1 -1
- package/dist/chunks/{api-z7gkfgax.js → api-5cpb32hf.js} +1 -1
- package/dist/chunks/{api-1je14sn4.js → api-6z9pvq7p.js} +1 -1
- package/dist/chunks/{api-np3ws677.js → api-8mj7kvhm.js} +2 -2
- package/dist/chunks/api-8sb6qqpn.js +28 -0
- package/dist/chunks/{api-r3h1014p.js → api-91858wp1.js} +2 -2
- package/dist/chunks/{api-dk68ymtv.js → api-a8jcac9a.js} +1 -1
- package/dist/chunks/{api-hax1v4bv.js → api-az0609r6.js} +2 -2
- package/dist/chunks/{api-yet0vexm.js → api-b3bmdkga.js} +1 -1
- package/dist/chunks/{api-qs427q2r.js → api-b6k4wrac.js} +4 -4
- package/dist/chunks/{api-ppma8fcc.js → api-btahnm2b.js} +2 -2
- package/dist/chunks/{api-595kch50.js → api-cdd9f8n8.js} +1 -1
- package/dist/chunks/{api-b2k9041j.js → api-cezwbsk5.js} +1 -1
- package/dist/chunks/{api-wxj3d9av.js → api-d0edqfxx.js} +2 -2
- package/dist/chunks/{api-q93ntzen.js → api-dq1g6k8x.js} +7 -3
- package/dist/chunks/{api-41yet3w7.js → api-enp1bp7r.js} +1 -1
- package/dist/chunks/{api-27hs38qv.js → api-ewme8tzg.js} +6 -19
- package/dist/chunks/{api-m5rae7m4.js → api-f559fakr.js} +2 -2
- package/dist/chunks/{api-gk0yxcp6.js → api-htyf2qs7.js} +1 -1
- package/dist/chunks/{api-9c4eyh8m.js → api-j87xz9bt.js} +3 -3
- package/dist/chunks/{api-e46y0tfd.js → api-kkdkqt8j.js} +2 -2
- package/dist/chunks/{api-w9jcwh65.js → api-mzs0n5xz.js} +6 -6
- package/dist/chunks/{api-6vs5sqy6.js → api-ny1j968n.js} +2 -2
- package/dist/chunks/{api-w5yp0ga8.js → api-p86kew8c.js} +1 -1
- package/dist/chunks/{api-84dqjc6j.js → api-psw29prz.js} +2 -2
- package/dist/chunks/{api-x8dgc261.js → api-qcg3sqtb.js} +2 -2
- package/dist/chunks/{api-22wspztn.js → api-qd0r787n.js} +2 -2
- package/dist/chunks/{api-wecgp61r.js → api-qfyg9gb7.js} +6 -6
- package/dist/chunks/{api-0a5jm2na.js → api-rha2aq18.js} +2 -2
- package/dist/chunks/{api-4vqvqsgg.js → api-rs3v36hp.js} +2 -2
- package/dist/chunks/api-sy2e93cn.js +46 -0
- package/dist/chunks/{api-yr4wsvrw.js → api-te8jwba1.js} +2 -2
- package/dist/chunks/{api-vhwcrt1z.js → api-v8013z1z.js} +12 -8
- package/dist/chunks/{api-mmvhrf5s.js → api-vdvwckee.js} +2 -2
- package/dist/chunks/{api-ppqp5pr2.js → api-wnren0wn.js} +35 -35
- package/dist/chunks/{api-452na7zm.js → api-yk755swr.js} +2 -2
- package/dist/chunks/{api-h072q2hm.js → api-zcvan105.js} +1 -1
- package/dist/event-feed.js +5 -5
- package/dist/fetch.js +51 -49
- package/dist/handlers/agent.js +5 -5
- package/dist/handlers/artifact.js +2 -2
- package/dist/handlers/blob.d.ts +7 -0
- package/dist/handlers/blob.js +8 -0
- package/dist/handlers/command.js +5 -5
- package/dist/handlers/config.js +5 -5
- package/dist/handlers/credential.js +6 -6
- package/dist/handlers/debug.js +5 -5
- package/dist/handlers/event.js +6 -6
- package/dist/handlers/form.js +5 -5
- package/dist/handlers/fs.js +7 -6
- package/dist/handlers/generate.d.ts +2 -1
- package/dist/handlers/generate.js +5 -5
- package/dist/handlers/integration.js +5 -5
- package/dist/handlers/location.js +5 -5
- package/dist/handlers/mcp.js +6 -6
- package/dist/handlers/message.js +5 -5
- package/dist/handlers/migration.js +5 -5
- package/dist/handlers/model.js +5 -5
- package/dist/handlers/permission.js +5 -5
- package/dist/handlers/persistent-pty.d.ts +1 -1
- package/dist/handlers/persistent-pty.js +12 -10
- package/dist/handlers/plugin.js +5 -5
- package/dist/handlers/project.js +5 -5
- package/dist/handlers/provider.js +5 -5
- package/dist/handlers/pty.js +6 -6
- package/dist/handlers/reference.js +5 -5
- package/dist/handlers/rpc.js +5 -5
- package/dist/handlers/server.js +7 -7
- package/dist/handlers/session.js +5 -5
- package/dist/handlers/shell.js +5 -5
- package/dist/handlers/skill.js +5 -5
- package/dist/handlers/usage.js +5 -5
- package/dist/handlers/vcs.js +5 -5
- package/dist/handlers/voice.js +5 -5
- package/dist/handlers/websearch.js +5 -5
- package/dist/handlers/worktree.js +5 -5
- package/dist/handlers.d.ts +1 -1
- package/dist/handlers.js +48 -46
- package/dist/location.js +3 -3
- package/dist/middleware/form-location.js +2 -2
- package/dist/middleware/session-location.js +2 -2
- package/dist/pairing.js +3 -3
- package/dist/process.js +43 -41
- package/dist/range.d.ts +6 -0
- package/dist/range.js +8 -0
- package/dist/routes.d.ts +4 -2
- package/dist/routes.js +49 -47
- package/dist/workerd.d.ts +1 -0
- package/dist/workerd.js +48 -42
- package/package.json +8 -8
package/dist/api.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./chunks/api-
|
|
4
|
-
import"./chunks/api-
|
|
5
|
-
import"./chunks/api-
|
|
6
|
-
import"./chunks/api-
|
|
3
|
+
} from "./chunks/api-j87xz9bt.js";
|
|
4
|
+
import"./chunks/api-htyf2qs7.js";
|
|
5
|
+
import"./chunks/api-b3bmdkga.js";
|
|
6
|
+
import"./chunks/api-50bbk3b2.js";
|
|
7
7
|
import"./chunks/api-smaf4a18.js";
|
|
8
8
|
export {
|
|
9
9
|
Api2 as Api
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
locationErrors2,
|
|
3
3
|
awaitPlugins2
|
|
4
|
-
} from "./api-
|
|
4
|
+
} from "./api-50bbk3b2.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./api-
|
|
7
|
+
} from "./api-j87xz9bt.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/generate.ts
|
|
10
|
+
import { Flag } from "@opencode/core/flag";
|
|
10
11
|
import { Generate } from "@opencode/core/generate";
|
|
12
|
+
import { VideoGeneration } from "@opencode/core/video-generation";
|
|
11
13
|
import { Location } from "@opencode/core/location";
|
|
12
14
|
import { LocationServiceMap } from "@opencode/core/location-services";
|
|
13
15
|
import { AbsolutePath } from "@opencode/core/schema";
|
|
14
16
|
import {
|
|
17
|
+
ForbiddenError,
|
|
18
|
+
VideoNotFoundError,
|
|
15
19
|
InvalidRequestError,
|
|
16
20
|
ModelNotFoundError,
|
|
17
21
|
ProviderRequestError,
|
|
@@ -24,6 +28,7 @@ import { HttpApiBuilder } from "effect/http-api";
|
|
|
24
28
|
var GenerateHandler2 = HttpApiBuilder.group(Api2, "server.generate", (handlers) => Effect.gen(function* () {
|
|
25
29
|
const global = yield* Global.Service;
|
|
26
30
|
const locations = yield* LocationServiceMap.Service;
|
|
31
|
+
const videos = yield* VideoGeneration.Service;
|
|
27
32
|
const services = locations.get(Location.Ref.make({ directory: AbsolutePath.make(global.config) }));
|
|
28
33
|
const text = Effect.fn("server.generate.text")(function* (request) {
|
|
29
34
|
yield* awaitPlugins2;
|
|
@@ -46,7 +51,22 @@ var GenerateHandler2 = HttpApiBuilder.group(Api2, "server.generate", (handlers)
|
|
|
46
51
|
const generate = yield* Generate.Service;
|
|
47
52
|
return { data: yield* generate.decisions(request.payload).pipe(Effect.mapError(generateError)) };
|
|
48
53
|
}, Effect.provide(services), locationErrors2);
|
|
49
|
-
|
|
54
|
+
const videoEnabled = Effect.gen(function* () {
|
|
55
|
+
if (yield* Flag.enabled("video_generate"))
|
|
56
|
+
return;
|
|
57
|
+
return yield* new ForbiddenError({ message: "Video generation is disabled; enable experimental.video_generate" });
|
|
58
|
+
});
|
|
59
|
+
const videoCreate = Effect.fn("server.generate.video.create")(function* (request) {
|
|
60
|
+
yield* videoEnabled;
|
|
61
|
+
yield* awaitPlugins2;
|
|
62
|
+
return { data: yield* videos.start(request.payload).pipe(Effect.mapError(generateError)) };
|
|
63
|
+
}, Effect.provide(services), locationErrors2);
|
|
64
|
+
const videoGet = Effect.fn("server.generate.video.get")(function* (request) {
|
|
65
|
+
yield* videoEnabled;
|
|
66
|
+
const job = yield* videos.get(request.params.id).pipe(Effect.mapError((error) => new VideoNotFoundError({ videoID: error.id, message: error.message })));
|
|
67
|
+
return { data: job };
|
|
68
|
+
}, Effect.provide(services), locationErrors2);
|
|
69
|
+
return handlers.handle("generate.text", text).handle("generate.textLegacy", text).handle("generate.image", image).handle("generate.decisions", decisions).handle("generate.video.create", videoCreate).handle("generate.video.get", videoGet);
|
|
50
70
|
}));
|
|
51
71
|
function generateError(error) {
|
|
52
72
|
switch (error._tag) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./api-
|
|
3
|
+
} from "./api-j87xz9bt.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
5
|
+
Service3,
|
|
6
6
|
frame2
|
|
7
|
-
} from "./api-
|
|
7
|
+
} from "./api-qfyg9gb7.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* Service3;
|
|
16
16
|
return handlers.handleRaw("event.subscribe", (ctx) => Effect.gen(function* () {
|
|
17
17
|
const connected = {
|
|
18
18
|
id: Event.ID.create(),
|
|
@@ -59,7 +59,7 @@ function decode(input) {
|
|
|
59
59
|
return input;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
var
|
|
62
|
+
var layer4 = Layer.effect(LocationMiddleware2, Effect.gen(function* () {
|
|
63
63
|
const locations = yield* LocationServiceMap.Service;
|
|
64
64
|
return LocationMiddleware2.of((effect) => Effect.gen(function* () {
|
|
65
65
|
const request = yield* HttpServerRequest.HttpServerRequest;
|
|
@@ -67,4 +67,4 @@ var layer3 = Layer.effect(LocationMiddleware2, Effect.gen(function* () {
|
|
|
67
67
|
}));
|
|
68
68
|
}));
|
|
69
69
|
|
|
70
|
-
export { LocationMiddleware2, locationErrors2, awaitPlugins2, response2, sessionInfo2, requestRef2,
|
|
70
|
+
export { LocationMiddleware2, locationErrors2, awaitPlugins2, response2, sessionInfo2, requestRef2, layer4 };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__export
|
|
3
|
+
} from "./api-9rqn6x4v.js";
|
|
4
|
+
|
|
5
|
+
// src/range.ts
|
|
6
|
+
var exports_range = {};
|
|
7
|
+
__export(exports_range, {
|
|
8
|
+
ByteRange: () => exports_range,
|
|
9
|
+
parse: () => parse2
|
|
10
|
+
});
|
|
11
|
+
function parse2(header, size) {
|
|
12
|
+
const match = header === undefined ? null : /^bytes=\s*(\d*)\s*-\s*(\d*)\s*$/i.exec(header.trim());
|
|
13
|
+
if (match === null || match[1] === "" && match[2] === "")
|
|
14
|
+
return;
|
|
15
|
+
if (match[1] === "") {
|
|
16
|
+
const suffix = Number(match[2]);
|
|
17
|
+
if (suffix === 0 || size === 0)
|
|
18
|
+
return "unsatisfiable";
|
|
19
|
+
return { start: Math.max(size - suffix, 0), end: size - 1 };
|
|
20
|
+
}
|
|
21
|
+
const start = Number(match[1]);
|
|
22
|
+
const end = match[2] === "" ? size - 1 : Number(match[2]);
|
|
23
|
+
if (start > end || start >= size)
|
|
24
|
+
return "unsatisfiable";
|
|
25
|
+
return { start, end: Math.min(end, size - 1) };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { parse2, exports_range };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
awaitPlugins2,
|
|
3
3
|
response2
|
|
4
|
-
} from "./api-
|
|
4
|
+
} from "./api-50bbk3b2.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./api-
|
|
7
|
+
} from "./api-j87xz9bt.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/provider.ts
|
|
10
10
|
import { Provider } from "@opencode/core/provider";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./api-
|
|
3
|
+
} from "./api-j87xz9bt.js";
|
|
4
4
|
import {
|
|
5
5
|
SESSION_TTL_SECONDS2,
|
|
6
6
|
Config2,
|
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
Service2
|
|
12
12
|
} from "./api-z3e7v67k.js";
|
|
13
13
|
import {
|
|
14
|
-
|
|
15
|
-
} from "./api-
|
|
14
|
+
Service4
|
|
15
|
+
} from "./api-mzs0n5xz.js";
|
|
16
16
|
|
|
17
17
|
// src/handlers/server.ts
|
|
18
18
|
import { hostname } from "node:os";
|
|
@@ -22,7 +22,7 @@ import { HttpApiBuilder } from "effect/http-api";
|
|
|
22
22
|
import { PersistentPty } from "@opencode/core/persistent-pty";
|
|
23
23
|
import { UnauthorizedError } from "@opencode/protocol/errors";
|
|
24
24
|
var ServerHandler2 = HttpApiBuilder.group(Api2, "server.server", (handlers) => Effect.gen(function* () {
|
|
25
|
-
const pairing = yield*
|
|
25
|
+
const pairing = yield* Service4;
|
|
26
26
|
const auth = yield* Config2;
|
|
27
27
|
return handlers.handle("server.info", () => Effect.gen(function* () {
|
|
28
28
|
const info = yield* Service2;
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
locationErrors2,
|
|
6
6
|
response2,
|
|
7
7
|
sessionInfo2
|
|
8
|
-
} from "./api-
|
|
8
|
+
} from "./api-50bbk3b2.js";
|
|
9
9
|
import {
|
|
10
10
|
Api2
|
|
11
|
-
} from "./api-
|
|
11
|
+
} from "./api-j87xz9bt.js";
|
|
12
12
|
|
|
13
13
|
// src/handlers/permission.ts
|
|
14
14
|
import { Instance } from "@opencode/core/instance/service";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
locationErrors2,
|
|
3
3
|
awaitPlugins2
|
|
4
|
-
} from "./api-
|
|
4
|
+
} from "./api-50bbk3b2.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./api-
|
|
7
|
+
} from "./api-j87xz9bt.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/voice.ts
|
|
10
10
|
import { Location } from "@opencode/core/location";
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./api-
|
|
3
|
+
} from "./api-j87xz9bt.js";
|
|
4
4
|
import {
|
|
5
5
|
CorsConfig2,
|
|
6
6
|
isAllowedRequestOrigin2
|
|
7
7
|
} from "./api-q4bn6dy8.js";
|
|
8
8
|
import {
|
|
9
9
|
makeArtifact2
|
|
10
|
-
} from "./api-
|
|
10
|
+
} from "./api-p86kew8c.js";
|
|
11
|
+
import {
|
|
12
|
+
makeBlobGet2
|
|
13
|
+
} from "./api-sy2e93cn.js";
|
|
11
14
|
import {
|
|
12
15
|
makeJob2
|
|
13
16
|
} from "./api-78rcgzsr.js";
|
|
@@ -46,8 +49,9 @@ var PersistentPtyHandler2 = HttpApiBuilder.group(Api2, "server.experimental", (h
|
|
|
46
49
|
const artifact = yield* makeArtifact2;
|
|
47
50
|
const job = yield* makeJob2;
|
|
48
51
|
const mediaGet = yield* makeMediaGet2;
|
|
52
|
+
const blobGet = yield* makeBlobGet2;
|
|
49
53
|
const schedule = yield* makeSchedule2;
|
|
50
|
-
return handlers.handleRaw("media.get", (ctx) => mediaGet(ctx.params.hash, ctx.request)).handle("job.list", (ctx) => job.list(ctx.query)).handle("artifacts.providers", (ctx) => artifact.providers(ctx.query, ctx.request)).handle("artifacts.list", (ctx) => artifact.list(ctx.query, ctx.request)).handle("artifacts.create", (ctx) => artifact.create(ctx.query, ctx.payload, ctx.request)).handle("artifacts.get", (ctx) => artifact.get(ctx.params.artifactID, ctx.query, ctx.request)).handle("artifacts.update", (ctx) => artifact.update(ctx.params.artifactID, ctx.query, ctx.payload, ctx.request)).handle("artifacts.delete", (ctx) => artifact.remove(ctx.params.artifactID, ctx.query, ctx.request)).handleRaw("artifacts.view", (ctx) => artifact.view(ctx.params.artifactID, ctx.query, ctx.request)).handle("schedule.create", (ctx) => schedule.create(ctx.payload)).handle("schedule.list", (ctx) => schedule.list(ctx.query.sessionID)).handle("schedule.get", (ctx) => schedule.get(ctx.params.scheduleID)).handle("schedule.pause", (ctx) => schedule.pause(ctx.params.scheduleID)).handle("schedule.resume", (ctx) => schedule.resume(ctx.params.scheduleID)).handle("schedule.delete", (ctx) => schedule.remove(ctx.params.scheduleID)).handle("persistentPty.read", Effect.fn(function* (ctx) {
|
|
54
|
+
return handlers.handleRaw("media.get", (ctx) => mediaGet(ctx.params.hash, ctx.request)).handleRaw("blob.get", (ctx) => blobGet(ctx.params.id, ctx.request)).handle("job.list", (ctx) => job.list(ctx.query)).handle("artifacts.providers", (ctx) => artifact.providers(ctx.query, ctx.request)).handle("artifacts.list", (ctx) => artifact.list(ctx.query, ctx.request)).handle("artifacts.create", (ctx) => artifact.create(ctx.query, ctx.payload, ctx.request)).handle("artifacts.get", (ctx) => artifact.get(ctx.params.artifactID, ctx.query, ctx.request)).handle("artifacts.update", (ctx) => artifact.update(ctx.params.artifactID, ctx.query, ctx.payload, ctx.request)).handle("artifacts.delete", (ctx) => artifact.remove(ctx.params.artifactID, ctx.query, ctx.request)).handleRaw("artifacts.view", (ctx) => artifact.view(ctx.params.artifactID, ctx.query, ctx.request)).handle("schedule.create", (ctx) => schedule.create(ctx.payload)).handle("schedule.list", (ctx) => schedule.list(ctx.query.sessionID)).handle("schedule.get", (ctx) => schedule.get(ctx.params.scheduleID)).handle("schedule.pause", (ctx) => schedule.pause(ctx.params.scheduleID)).handle("schedule.resume", (ctx) => schedule.resume(ctx.params.scheduleID)).handle("schedule.delete", (ctx) => schedule.remove(ctx.params.scheduleID)).handle("persistentPty.read", Effect.fn(function* (ctx) {
|
|
51
55
|
return { data: yield* pty.read(ctx.params.sessionID, ctx.query.lines).pipe(mapUnavailable) };
|
|
52
56
|
})).handle("persistentPty.list", Effect.fn(function* (ctx) {
|
|
53
57
|
return { data: yield* pty.list(ctx.params.sessionID).pipe(mapUnavailable) };
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./api-
|
|
3
|
+
} from "./api-50bbk3b2.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./api-
|
|
6
|
+
} from "./api-j87xz9bt.js";
|
|
7
7
|
import {
|
|
8
8
|
download2
|
|
9
9
|
} from "./api-t32e1bbt.js";
|
|
10
|
+
import {
|
|
11
|
+
parse2
|
|
12
|
+
} from "./api-8sb6qqpn.js";
|
|
10
13
|
|
|
11
14
|
// src/handlers/fs.ts
|
|
12
15
|
import { FileSystem } from "@opencode/core/filesystem";
|
|
@@ -71,7 +74,7 @@ function serveFile(request, file, content) {
|
|
|
71
74
|
if (isNotModified(request, etag, lastModified))
|
|
72
75
|
return HttpServerResponse.empty({ status: 304, headers: { ...validators, ...content } });
|
|
73
76
|
const rangeHeader = request.method === "GET" ? request.headers["range"] : undefined;
|
|
74
|
-
const range = rangeHeader !== undefined && matchesIfRange(request.headers["if-range"], etag, lastModified) ?
|
|
77
|
+
const range = rangeHeader !== undefined && matchesIfRange(request.headers["if-range"], etag, lastModified) ? parse2(rangeHeader, file.size) : undefined;
|
|
75
78
|
if (range === "unsatisfiable")
|
|
76
79
|
return HttpServerResponse.empty({
|
|
77
80
|
status: 416,
|
|
@@ -107,21 +110,5 @@ function matchesIfRange(ifRange, etag, lastModified) {
|
|
|
107
110
|
function stripWeak(etag) {
|
|
108
111
|
return etag.trim().replace(/^w\//i, "");
|
|
109
112
|
}
|
|
110
|
-
function parseRange(header, size) {
|
|
111
|
-
const match = /^bytes=\s*(\d*)\s*-\s*(\d*)\s*$/i.exec(header.trim());
|
|
112
|
-
if (match === null || match[1] === "" && match[2] === "")
|
|
113
|
-
return;
|
|
114
|
-
if (match[1] === "") {
|
|
115
|
-
const suffix = Number(match[2]);
|
|
116
|
-
if (suffix === 0 || size === 0)
|
|
117
|
-
return "unsatisfiable";
|
|
118
|
-
return { start: Math.max(size - suffix, 0), end: size - 1 };
|
|
119
|
-
}
|
|
120
|
-
const start = Number(match[1]);
|
|
121
|
-
const end = match[2] === "" ? size - 1 : Number(match[2]);
|
|
122
|
-
if (start > end || start >= size)
|
|
123
|
-
return "unsatisfiable";
|
|
124
|
-
return { start, end: Math.min(end, size - 1) };
|
|
125
|
-
}
|
|
126
113
|
|
|
127
114
|
export { FileSystemHandler2 };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LocationMiddleware2
|
|
3
|
-
} from "./api-
|
|
3
|
+
} from "./api-50bbk3b2.js";
|
|
4
4
|
import {
|
|
5
5
|
FormLocationMiddleware2
|
|
6
|
-
} from "./api-
|
|
6
|
+
} from "./api-htyf2qs7.js";
|
|
7
7
|
import {
|
|
8
8
|
SessionLocationMiddleware2
|
|
9
|
-
} from "./api-
|
|
9
|
+
} from "./api-b3bmdkga.js";
|
|
10
10
|
|
|
11
11
|
// src/api.ts
|
|
12
12
|
import { makeDefaultApi } from "@opencode/protocol/api";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
awaitPlugins2,
|
|
3
3
|
response2
|
|
4
|
-
} from "./api-
|
|
4
|
+
} from "./api-50bbk3b2.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./api-
|
|
7
|
+
} from "./api-j87xz9bt.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/websearch.ts
|
|
10
10
|
import { WebSearch } from "@opencode/core/websearch";
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
var exports_pairing = {};
|
|
7
7
|
__export(exports_pairing, {
|
|
8
8
|
ServerPairing: () => exports_pairing,
|
|
9
|
-
Service: () =>
|
|
9
|
+
Service: () => Service4,
|
|
10
10
|
node: () => node2
|
|
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(Service3, Effect.gen(function* () {
|
|
|
30
30
|
})
|
|
31
31
|
});
|
|
32
32
|
}));
|
|
33
|
-
var node2 = makeGlobalNode({ service:
|
|
33
|
+
var node2 = makeGlobalNode({ service: Service4, layer, deps: [] });
|
|
34
34
|
|
|
35
|
-
export {
|
|
35
|
+
export { Service4, node2, exports_pairing };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
requestRef2
|
|
3
|
-
} from "./api-
|
|
3
|
+
} from "./api-50bbk3b2.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./api-
|
|
6
|
+
} from "./api-j87xz9bt.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/debug.ts
|
|
9
9
|
import { LocationServiceMap } from "@opencode/core/location-service-map";
|
|
@@ -7,11 +7,11 @@ 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)}
|
|
@@ -72,13 +72,13 @@ var make4 = 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 Service3.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(Service3, Effect.gen(function* () {
|
|
80
80
|
const bus = yield* Bus.Service;
|
|
81
81
|
return yield* make4(bus.listen);
|
|
82
82
|
}));
|
|
83
83
|
|
|
84
|
-
export { SubscriberCapacity2, SubscriberOverflowError2, EncodingError2,
|
|
84
|
+
export { SubscriberCapacity2, SubscriberOverflowError2, EncodingError2, Service3, frame2, make4, layer3, exports_event_feed };
|