@opencode/server 2.3.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.js +5 -5
- package/dist/auth.js +1 -1
- package/dist/chunks/{auth-a8jcac9a.js → request-tracing-05c5061t.js} +1 -1
- package/dist/chunks/{auth-j87xz9bt.js → request-tracing-0e81et3m.js} +3 -3
- package/dist/chunks/{auth-6jfbq4sw.js → request-tracing-0gf4dfn8.js} +33 -33
- package/dist/chunks/{auth-91858wp1.js → request-tracing-2pbbrzpp.js} +2 -2
- package/dist/chunks/{auth-e6e4kz0w.js → request-tracing-39nnfjx1.js} +4 -4
- package/dist/chunks/{auth-yjbzmfhm.js → request-tracing-3te71694.js} +5 -5
- package/dist/chunks/{auth-09kw3a77.js → request-tracing-4ed680xg.js} +2 -2
- package/dist/chunks/{auth-rha2aq18.js → request-tracing-4p2y0qs3.js} +2 -2
- package/dist/chunks/{auth-50bbk3b2.js → request-tracing-50bbk3b2.js} +1 -1
- package/dist/chunks/{auth-78rcgzsr.js → request-tracing-78rcgzsr.js} +1 -1
- package/dist/chunks/{auth-7b9xm1qg.js → request-tracing-7b9xm1qg.js} +1 -1
- package/dist/chunks/{auth-n1423xpw.js → request-tracing-7nb2rv11.js} +4 -4
- package/dist/chunks/{auth-enp1bp7r.js → request-tracing-861wfsmy.js} +1 -1
- package/dist/chunks/request-tracing-8sb6qqpn.js +28 -0
- package/dist/chunks/request-tracing-9cd3a4b8.js +69 -0
- package/dist/chunks/{auth-az0609r6.js → request-tracing-9grnt8dc.js} +2 -2
- package/dist/chunks/{auth-5s0wnsg4.js → request-tracing-ap1t95t8.js} +3 -3
- package/dist/chunks/{auth-yqhefp4s.js → request-tracing-ayveq98d.js} +23 -3
- package/dist/chunks/{auth-b3bmdkga.js → request-tracing-b3bmdkga.js} +1 -1
- package/dist/chunks/{auth-4q6e7fh8.js → request-tracing-b4mqtccx.js} +2 -2
- package/dist/chunks/{auth-z9zyd4qg.js → request-tracing-d4534456.js} +4 -4
- package/dist/chunks/{auth-5cpb32hf.js → request-tracing-d8b9pm2q.js} +1 -1
- package/dist/chunks/{auth-8mj7kvhm.js → request-tracing-dezpcckc.js} +2 -2
- package/dist/chunks/{auth-djr0jy89.js → request-tracing-djr0jy89.js} +1 -1
- package/dist/chunks/{auth-kkdkqt8j.js → request-tracing-dx89xydc.js} +2 -2
- package/dist/chunks/{auth-d0edqfxx.js → request-tracing-et00mhwf.js} +2 -2
- package/dist/chunks/{auth-qd0r787n.js → request-tracing-f8r9p2vr.js} +2 -2
- package/dist/chunks/{auth-3p9jwgak.js → request-tracing-fvpjvjpp.js} +6 -6
- package/dist/chunks/{auth-a4mwssda.js → request-tracing-g6yhb3a8.js} +15 -11
- package/dist/chunks/{auth-qcg3sqtb.js → request-tracing-h1thjy6x.js} +2 -2
- package/dist/chunks/{auth-rs3v36hp.js → request-tracing-h286a6py.js} +2 -2
- package/dist/chunks/{auth-htyf2qs7.js → request-tracing-htyf2qs7.js} +1 -1
- package/dist/chunks/{auth-cezwbsk5.js → request-tracing-hx8bsq9d.js} +1 -1
- package/dist/chunks/{auth-j4at0y5c.js → request-tracing-j4at0y5c.js} +1 -1
- package/dist/chunks/{auth-6kawhtwy.js → request-tracing-jjvpqmx6.js} +4 -4
- package/dist/chunks/{auth-btahnm2b.js → request-tracing-kg0ybx4v.js} +3 -3
- package/dist/chunks/{auth-myqk22k5.js → request-tracing-myqk22k5.js} +2 -2
- package/dist/chunks/{auth-kqr36gas.js → request-tracing-mzs0n5xz.js} +7 -7
- package/dist/chunks/request-tracing-n26yr6pw.js +21 -0
- package/dist/chunks/{auth-pab2cyby.js → request-tracing-n5et0xgm.js} +8 -8
- package/dist/chunks/{auth-p86kew8c.js → request-tracing-p86kew8c.js} +2 -2
- package/dist/chunks/{auth-ny1j968n.js → request-tracing-q44yktpv.js} +2 -2
- package/dist/chunks/{auth-bm3bken1.js → request-tracing-r7knxm63.js} +7 -20
- package/dist/chunks/{auth-gyryr0mf.js → request-tracing-rd9e3qfx.js} +4 -4
- package/dist/chunks/{auth-te8jwba1.js → request-tracing-s9tkswmw.js} +2 -2
- package/dist/chunks/request-tracing-sy2e93cn.js +46 -0
- package/dist/chunks/{auth-t32e1bbt.js → request-tracing-t32e1bbt.js} +1 -1
- package/dist/chunks/{auth-yk755swr.js → request-tracing-tk56ffsq.js} +2 -2
- package/dist/chunks/{auth-etdgpyr8.js → request-tracing-v0r38a4t.js} +25 -15
- package/dist/chunks/{auth-f559fakr.js → request-tracing-v8aqacn3.js} +2 -2
- package/dist/chunks/{auth-2eaky32g.js → request-tracing-vbgqk0mr.js} +2 -2
- package/dist/chunks/{auth-6z9pvq7p.js → request-tracing-x4b2rtcb.js} +1 -1
- package/dist/chunks/{auth-zkya65ny.js → request-tracing-z2ndp6vh.js} +8 -8
- package/dist/chunks/{auth-zcvan105.js → request-tracing-zbe9jfhy.js} +1 -1
- package/dist/content-headers.js +1 -1
- package/dist/cors.js +1 -1
- package/dist/event-feed.js +3 -3
- package/dist/fetch.d.ts +3 -0
- package/dist/fetch.js +61 -58
- package/dist/handlers/agent.js +6 -6
- package/dist/handlers/artifact.js +3 -3
- package/dist/handlers/automation.d.ts +25 -0
- package/dist/handlers/automation.js +7 -0
- package/dist/handlers/blob.d.ts +7 -0
- package/dist/handlers/blob.js +8 -0
- package/dist/handlers/command.js +6 -6
- package/dist/handlers/config.js +6 -6
- package/dist/handlers/credential.js +7 -7
- package/dist/handlers/debug.js +6 -6
- package/dist/handlers/event.js +7 -7
- package/dist/handlers/form.js +6 -6
- package/dist/handlers/fs.js +8 -7
- package/dist/handlers/generate.d.ts +2 -1
- package/dist/handlers/generate.js +6 -6
- package/dist/handlers/integration.js +6 -6
- package/dist/handlers/job.d.ts +11 -1
- package/dist/handlers/job.js +2 -2
- package/dist/handlers/location.js +6 -6
- package/dist/handlers/mcp.js +8 -8
- package/dist/handlers/media.js +2 -2
- package/dist/handlers/message.js +7 -7
- package/dist/handlers/migration.js +6 -6
- package/dist/handlers/model.js +6 -6
- package/dist/handlers/permission.js +6 -6
- package/dist/handlers/persistent-pty.d.ts +1 -1
- package/dist/handlers/persistent-pty.js +15 -13
- package/dist/handlers/plugin.js +6 -6
- package/dist/handlers/project.js +6 -6
- package/dist/handlers/provider.js +6 -6
- package/dist/handlers/pty-socket.js +1 -1
- package/dist/handlers/pty.js +8 -8
- package/dist/handlers/reference.js +6 -6
- package/dist/handlers/rpc.js +6 -6
- package/dist/handlers/server.js +9 -9
- package/dist/handlers/session-error.js +1 -1
- package/dist/handlers/session.js +7 -7
- package/dist/handlers/shell.js +6 -6
- package/dist/handlers/skill.js +6 -6
- package/dist/handlers/usage.js +6 -6
- package/dist/handlers/vcs.js +6 -6
- package/dist/handlers/voice.js +6 -6
- package/dist/handlers/websearch.js +6 -6
- package/dist/handlers/worktree.js +6 -6
- package/dist/handlers.d.ts +1 -1
- package/dist/handlers.js +52 -50
- package/dist/location.js +2 -2
- package/dist/media-uri.js +1 -1
- package/dist/middleware/authorization.js +2 -2
- package/dist/middleware/defect-response.d.ts +2 -0
- package/dist/middleware/defect-response.js +6 -0
- package/dist/middleware/form-location.js +3 -3
- package/dist/middleware/schema-error.js +1 -1
- package/dist/middleware/session-location.js +3 -3
- package/dist/options.d.ts +3 -0
- package/dist/options.js +3 -0
- package/dist/pairing.js +3 -3
- package/dist/process.d.ts +3 -0
- package/dist/process.js +64 -61
- package/dist/range.d.ts +6 -0
- package/dist/range.js +8 -0
- package/dist/request-site.js +2 -2
- package/dist/request-tracing.js +1 -1
- package/dist/routes.d.ts +5 -3
- package/dist/routes.js +56 -53
- package/dist/server-info.js +3 -3
- package/dist/service-status.js +3 -3
- package/dist/workerd.d.ts +1 -0
- package/dist/workerd.js +66 -59
- package/package.json +9 -9
- package/dist/chunks/auth-059rbh9c.js +0 -43
- package/dist/handlers/schedule.d.ts +0 -314
- package/dist/handlers/schedule.js +0 -7
- /package/dist/chunks/{auth-9rqn6x4v.js → request-tracing-9rqn6x4v.js} +0 -0
- /package/dist/chunks/{auth-bd8755ek.js → request-tracing-bd8755ek.js} +0 -0
- /package/dist/chunks/{auth-q187pxxd.js → request-tracing-q187pxxd.js} +0 -0
- /package/dist/chunks/{auth-q4bn6dy8.js → request-tracing-q4bn6dy8.js} +0 -0
- /package/dist/chunks/{auth-smaf4a18.js → request-tracing-smaf4a18.js} +0 -0
- /package/dist/chunks/{auth-xthc02cw.js → request-tracing-xthc02cw.js} +0 -0
- /package/dist/chunks/{auth-yc7nft6q.js → request-tracing-yc7nft6q.js} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-tracing-50bbk3b2.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./request-tracing-0e81et3m.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/shell.ts
|
|
9
9
|
import { Shell } from "@opencode/core/shell";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__export
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-tracing-9rqn6x4v.js";
|
|
4
4
|
|
|
5
5
|
// src/event-feed.ts
|
|
6
6
|
var exports_event_feed = {};
|
|
7
7
|
__export(exports_event_feed, {
|
|
8
8
|
EncodingError: () => EncodingError2,
|
|
9
9
|
EventFeed: () => exports_event_feed,
|
|
10
|
-
Service: () =>
|
|
10
|
+
Service: () => Service2,
|
|
11
11
|
SubscriberCapacity: () => SubscriberCapacity2,
|
|
12
12
|
SubscriberOverflowError: () => SubscriberOverflowError2,
|
|
13
13
|
frame: () => frame2,
|
|
@@ -30,7 +30,7 @@ class EncodingError2 extends Schema.TaggedError()("EventFeed.EncodingError", {
|
|
|
30
30
|
}) {
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
class
|
|
33
|
+
class Service2 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 Service2.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 layer2 = Layer.effect(
|
|
79
|
+
var layer2 = Layer.effect(Service2, 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, Service2, frame2, make4, layer2, exports_event_feed };
|
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-tracing-0e81et3m.js";
|
|
4
4
|
import {
|
|
5
5
|
CorsConfig2,
|
|
6
6
|
isAllowedRequestOrigin2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./request-tracing-q4bn6dy8.js";
|
|
8
8
|
import {
|
|
9
9
|
makeArtifact2
|
|
10
|
-
} from "./
|
|
10
|
+
} from "./request-tracing-p86kew8c.js";
|
|
11
|
+
import {
|
|
12
|
+
makeBlobGet2
|
|
13
|
+
} from "./request-tracing-sy2e93cn.js";
|
|
14
|
+
import {
|
|
15
|
+
makeAutomation2
|
|
16
|
+
} from "./request-tracing-9cd3a4b8.js";
|
|
11
17
|
import {
|
|
12
18
|
makeJob2
|
|
13
|
-
} from "./
|
|
19
|
+
} from "./request-tracing-78rcgzsr.js";
|
|
14
20
|
import {
|
|
15
21
|
makeMediaGet2
|
|
16
|
-
} from "./
|
|
22
|
+
} from "./request-tracing-djr0jy89.js";
|
|
17
23
|
import {
|
|
18
24
|
runPtySocket2
|
|
19
|
-
} from "./
|
|
20
|
-
import {
|
|
21
|
-
makeSchedule2
|
|
22
|
-
} from "./auth-059rbh9c.js";
|
|
25
|
+
} from "./request-tracing-q187pxxd.js";
|
|
23
26
|
|
|
24
27
|
// src/handlers/persistent-pty.ts
|
|
25
28
|
import { PersistentPty } from "@opencode/core/persistent-pty";
|
|
@@ -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;
|
|
49
|
-
const
|
|
50
|
-
|
|
52
|
+
const blobGet = yield* makeBlobGet2;
|
|
53
|
+
const automation = yield* makeAutomation2;
|
|
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("automation.create", (ctx) => automation.create(ctx.payload)).handle("automation.list", (ctx) => automation.list(ctx.query)).handle("automation.get", (ctx) => automation.get(ctx.params.automationID)).handle("automation.pause", (ctx) => automation.pause(ctx.params.automationID)).handle("automation.resume", (ctx) => automation.resume(ctx.params.automationID)).handle("automation.delete", (ctx) => automation.remove(ctx.params.automationID)).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,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
requestRef2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-tracing-50bbk3b2.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./request-tracing-0e81et3m.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/debug.ts
|
|
9
9
|
import { LocationServiceMap } from "@opencode/core/location-service-map";
|
|
@@ -2,18 +2,18 @@ import {
|
|
|
2
2
|
locationErrors2,
|
|
3
3
|
response2,
|
|
4
4
|
requestRef2
|
|
5
|
-
} from "./
|
|
5
|
+
} from "./request-tracing-50bbk3b2.js";
|
|
6
6
|
import {
|
|
7
7
|
Api2
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./request-tracing-0e81et3m.js";
|
|
9
9
|
import {
|
|
10
10
|
CorsConfig2,
|
|
11
11
|
isAllowedRequestOrigin2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./request-tracing-q4bn6dy8.js";
|
|
13
13
|
import {
|
|
14
14
|
runPtySocket2,
|
|
15
15
|
holdLocation2
|
|
16
|
-
} from "./
|
|
16
|
+
} from "./request-tracing-q187pxxd.js";
|
|
17
17
|
|
|
18
18
|
// src/handlers/pty.ts
|
|
19
19
|
import { Pty } from "@opencode/core/pty";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
missingSession2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-tracing-smaf4a18.js";
|
|
4
4
|
import {
|
|
5
5
|
locationErrors2,
|
|
6
6
|
response2,
|
|
7
7
|
sessionInfo2
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./request-tracing-50bbk3b2.js";
|
|
9
9
|
import {
|
|
10
10
|
Api2
|
|
11
|
-
} from "./
|
|
11
|
+
} from "./request-tracing-0e81et3m.js";
|
|
12
12
|
|
|
13
13
|
// src/handlers/permission.ts
|
|
14
14
|
import { Instance } from "@opencode/core/instance/service";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isAllowedRequestOrigin2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-tracing-q4bn6dy8.js";
|
|
4
4
|
import {
|
|
5
5
|
__export
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./request-tracing-9rqn6x4v.js";
|
|
7
7
|
|
|
8
8
|
// src/request-site.ts
|
|
9
9
|
var exports_request_site = {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__export
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-tracing-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: () => 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(Service2, 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 };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// src/middleware/defect-response.ts
|
|
2
|
+
import { StorageFailure } from "@opencode/core/database/storage-failure";
|
|
3
|
+
import { UnknownError } from "@opencode/protocol/errors";
|
|
4
|
+
import { Cause, Effect } from "effect";
|
|
5
|
+
import { HttpRouter, HttpServerError, HttpServerRequest, HttpServerResponse } from "effect/http";
|
|
6
|
+
var respond = HttpServerResponse.schemaJson(UnknownError);
|
|
7
|
+
var defectResponseLayer2 = HttpRouter.middleware((effect) => effect.pipe(Effect.catchCause((cause) => Effect.gen(function* () {
|
|
8
|
+
const [response] = yield* HttpServerError.causeResponse(cause);
|
|
9
|
+
if (response.status !== 500 || response.body._tag !== "Empty")
|
|
10
|
+
return yield* Effect.failCause(cause);
|
|
11
|
+
const request = yield* HttpServerRequest.HttpServerRequest;
|
|
12
|
+
const ref = `err_${crypto.randomUUID().slice(0, 8)}`;
|
|
13
|
+
yield* Effect.logError("request failed", cause).pipe(Effect.annotateLogs({ ref, route: `${request.method} ${request.url}` }));
|
|
14
|
+
const body = yield* respond(new UnknownError({
|
|
15
|
+
message: StorageFailure.message(cause) ?? "Server failed to handle the request. Check server logs for details.",
|
|
16
|
+
ref
|
|
17
|
+
}), { status: 500 }).pipe(Effect.orDie);
|
|
18
|
+
return yield* Effect.failCause(Cause.combine(cause, Cause.die(body)));
|
|
19
|
+
}))), { global: true });
|
|
20
|
+
|
|
21
|
+
export { defectResponseLayer2 };
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isAllowedCorsOrigin2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-tracing-q4bn6dy8.js";
|
|
4
4
|
import {
|
|
5
5
|
middleware2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./request-tracing-myqk22k5.js";
|
|
7
7
|
import {
|
|
8
8
|
withoutParentSpan2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./request-tracing-yc7nft6q.js";
|
|
10
10
|
import {
|
|
11
11
|
createRoutes2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./request-tracing-v0r38a4t.js";
|
|
13
13
|
import {
|
|
14
14
|
__export
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./request-tracing-9rqn6x4v.js";
|
|
16
16
|
|
|
17
17
|
// src/fetch.ts
|
|
18
18
|
var exports_fetch = {};
|
|
19
19
|
__export(exports_fetch, {
|
|
20
20
|
ServerFetch: () => exports_fetch,
|
|
21
|
-
make: () =>
|
|
21
|
+
make: () => make3
|
|
22
22
|
});
|
|
23
23
|
import { Context, Effect, Layer } from "effect";
|
|
24
24
|
import { HttpEffect, HttpMiddleware, HttpRouter, HttpServer } from "effect/http";
|
|
25
25
|
import { SessionRestart } from "@opencode/core/session/execution/restart";
|
|
26
|
-
var
|
|
26
|
+
var make3 = Effect.fn("ServerFetch.make")(function* (options = {}, boot = {}) {
|
|
27
27
|
const context = yield* Layer.build(createRoutes2(options, () => [], boot.overrides ?? []).pipe(Layer.provide(HttpServer.layerServices))).pipe(withoutParentSpan2);
|
|
28
28
|
yield* Effect.forkDetach(Context.get(context, SessionRestart.Service).resumeSuspendedSessions);
|
|
29
29
|
return Context.get(context, HttpRouter.HttpRouter).asHttpEffect().pipe(middleware2(options), HttpMiddleware.cors({ allowedOrigins: (origin) => isAllowedCorsOrigin2(origin, options), maxAge: 86400 }), HttpEffect.toWebHandlerWith(context));
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
-
export {
|
|
32
|
+
export { make3, exports_fetch };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
missingSession2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-tracing-smaf4a18.js";
|
|
4
4
|
import {
|
|
5
5
|
locationErrors2,
|
|
6
6
|
response2,
|
|
7
7
|
requestRef2
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./request-tracing-50bbk3b2.js";
|
|
9
9
|
|
|
10
10
|
// src/handlers/artifact.ts
|
|
11
11
|
import { Artifact } from "@opencode/core/artifact";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-tracing-50bbk3b2.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./request-tracing-0e81et3m.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/skill.ts
|
|
9
9
|
import { Skill } from "@opencode/core/skill";
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-tracing-50bbk3b2.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./request-tracing-0e81et3m.js";
|
|
7
7
|
import {
|
|
8
8
|
download2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./request-tracing-t32e1bbt.js";
|
|
10
|
+
import {
|
|
11
|
+
parse2
|
|
12
|
+
} from "./request-tracing-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 };
|
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
missingMessage2,
|
|
4
4
|
failedMessageDecode2,
|
|
5
5
|
failedSnapshot2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./request-tracing-smaf4a18.js";
|
|
7
7
|
import {
|
|
8
8
|
locationErrors2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./request-tracing-50bbk3b2.js";
|
|
10
10
|
import {
|
|
11
11
|
Api2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./request-tracing-0e81et3m.js";
|
|
13
13
|
import {
|
|
14
14
|
wantsMediaRefs2
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./request-tracing-xthc02cw.js";
|
|
16
16
|
|
|
17
17
|
// src/handlers/session.ts
|
|
18
18
|
import { Instance } from "@opencode/core/instance/service";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-tracing-50bbk3b2.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./request-tracing-0e81et3m.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/reference.ts
|
|
9
9
|
import { Reference } from "@opencode/core/reference";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import {
|
|
2
|
+
download2
|
|
3
|
+
} from "./request-tracing-t32e1bbt.js";
|
|
4
|
+
import {
|
|
5
|
+
parse2
|
|
6
|
+
} from "./request-tracing-8sb6qqpn.js";
|
|
7
|
+
|
|
8
|
+
// src/handlers/blob.ts
|
|
9
|
+
import { BlobStore } from "@opencode/core/blob-store";
|
|
10
|
+
import { BlobNotFoundError } from "@opencode/protocol/errors";
|
|
11
|
+
import { FSUtil } from "@opencode/util/fs-util";
|
|
12
|
+
import { Effect } from "effect";
|
|
13
|
+
import { HttpServerResponse } from "effect/http";
|
|
14
|
+
var makeBlobGet2 = Effect.gen(function* () {
|
|
15
|
+
const blobs = yield* BlobStore.Service;
|
|
16
|
+
const fs = yield* FSUtil.Service;
|
|
17
|
+
return (id, request) => Effect.gen(function* () {
|
|
18
|
+
const blob = yield* blobs.read(id).pipe(Effect.mapError((error) => new BlobNotFoundError({ blobID: error.id, message: error.message })));
|
|
19
|
+
const etag = `"${id}"`;
|
|
20
|
+
const headers = {
|
|
21
|
+
...download2({ mime: blob.mime }),
|
|
22
|
+
"cache-control": "private, max-age=604800, immutable",
|
|
23
|
+
etag,
|
|
24
|
+
"accept-ranges": "bytes"
|
|
25
|
+
};
|
|
26
|
+
if (request.headers["if-none-match"]?.split(",").some((tag) => tag.trim() === "*" || tag.trim().replace(/^w\//i, "") === etag))
|
|
27
|
+
return HttpServerResponse.empty({ status: 304, headers });
|
|
28
|
+
const ifRange = request.headers["if-range"];
|
|
29
|
+
const range = ifRange === undefined || ifRange.trim() === etag ? parse2(request.headers["range"], blob.bytes) : undefined;
|
|
30
|
+
if (range === "unsatisfiable")
|
|
31
|
+
return HttpServerResponse.empty({
|
|
32
|
+
status: 416,
|
|
33
|
+
headers: { ...headers, "content-range": `bytes */${blob.bytes}` }
|
|
34
|
+
});
|
|
35
|
+
const offset = range?.start ?? 0;
|
|
36
|
+
const length = range === undefined ? blob.bytes : range.end - range.start + 1;
|
|
37
|
+
return HttpServerResponse.stream(fs.stream(blob.path, { offset, bytesToRead: length }), {
|
|
38
|
+
status: range === undefined ? 200 : 206,
|
|
39
|
+
contentType: headers["content-type"],
|
|
40
|
+
contentLength: length,
|
|
41
|
+
headers: range === undefined ? headers : { ...headers, "content-range": `bytes ${range.start}-${range.end}/${blob.bytes}` }
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export { makeBlobGet2 };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-tracing-0e81et3m.js";
|
|
4
4
|
import {
|
|
5
5
|
requireConnectable2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./request-tracing-2pbbrzpp.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/credential.ts
|
|
9
9
|
import { Credential } from "@opencode/core/credential";
|
|
@@ -1,36 +1,39 @@
|
|
|
1
1
|
import {
|
|
2
2
|
layer4
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-tracing-50bbk3b2.js";
|
|
4
4
|
import {
|
|
5
5
|
formLocationLayer2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./request-tracing-htyf2qs7.js";
|
|
7
7
|
import {
|
|
8
8
|
sessionLocationLayer2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./request-tracing-b3bmdkga.js";
|
|
10
10
|
import {
|
|
11
11
|
Api2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./request-tracing-0e81et3m.js";
|
|
13
13
|
import {
|
|
14
14
|
Config2
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./request-tracing-j4at0y5c.js";
|
|
16
16
|
import {
|
|
17
17
|
CorsConfig2
|
|
18
|
-
} from "./
|
|
18
|
+
} from "./request-tracing-q4bn6dy8.js";
|
|
19
19
|
import {
|
|
20
20
|
layer3
|
|
21
|
-
} from "./
|
|
21
|
+
} from "./request-tracing-3te71694.js";
|
|
22
22
|
import {
|
|
23
23
|
node2
|
|
24
|
-
} from "./
|
|
24
|
+
} from "./request-tracing-mzs0n5xz.js";
|
|
25
25
|
import {
|
|
26
26
|
handlers2
|
|
27
|
-
} from "./
|
|
27
|
+
} from "./request-tracing-0gf4dfn8.js";
|
|
28
28
|
import {
|
|
29
29
|
authorizationLayer2
|
|
30
|
-
} from "./
|
|
30
|
+
} from "./request-tracing-7b9xm1qg.js";
|
|
31
31
|
import {
|
|
32
32
|
schemaErrorLayer2
|
|
33
|
-
} from "./
|
|
33
|
+
} from "./request-tracing-bd8755ek.js";
|
|
34
|
+
import {
|
|
35
|
+
defectResponseLayer2
|
|
36
|
+
} from "./request-tracing-n26yr6pw.js";
|
|
34
37
|
|
|
35
38
|
// src/routes.ts
|
|
36
39
|
import { Database } from "@opencode/core/database/database";
|
|
@@ -48,6 +51,8 @@ import { PermissionSaved } from "@opencode/core/permission/saved";
|
|
|
48
51
|
import { PtyTicket } from "@opencode/core/pty/ticket";
|
|
49
52
|
import { PersistentPty } from "@opencode/core/persistent-pty";
|
|
50
53
|
import { Project } from "@opencode/core/project";
|
|
54
|
+
import { BlobStore } from "@opencode/core/blob-store";
|
|
55
|
+
import { VideoGeneration } from "@opencode/core/video-generation";
|
|
51
56
|
import { Worktree } from "@opencode/core/worktree";
|
|
52
57
|
import { Session } from "@opencode/core/session";
|
|
53
58
|
import { Instance } from "@opencode/core/instance/service";
|
|
@@ -65,7 +70,7 @@ import { LocationServiceMap } from "@opencode/core/location-service-map";
|
|
|
65
70
|
import { LocationActivity } from "@opencode/core/location-activity";
|
|
66
71
|
import { ModelsDev } from "@opencode/core/models-dev";
|
|
67
72
|
import { SessionRestart } from "@opencode/core/session/execution/restart";
|
|
68
|
-
import {
|
|
73
|
+
import { Automation } from "@opencode/core/automation";
|
|
69
74
|
import { PluginUpdate } from "@opencode/core/plugin/update";
|
|
70
75
|
import { SdkPlugins } from "@opencode/core/plugin/sdk";
|
|
71
76
|
import { WellKnown } from "@opencode/core/wellknown";
|
|
@@ -104,7 +109,9 @@ var applicationServiceNodes = [
|
|
|
104
109
|
LocationServiceMap.node,
|
|
105
110
|
LocationActivity.node,
|
|
106
111
|
SessionRestart.node,
|
|
107
|
-
|
|
112
|
+
Automation.node,
|
|
113
|
+
BlobStore.node,
|
|
114
|
+
VideoGeneration.node,
|
|
108
115
|
Workspace.node,
|
|
109
116
|
FileWatch.node
|
|
110
117
|
];
|
|
@@ -133,7 +140,10 @@ function makeRoutes(auth, options, serviceURLs, overrides, instances) {
|
|
|
133
140
|
file: options.config?.file,
|
|
134
141
|
content: options.config?.content
|
|
135
142
|
})),
|
|
136
|
-
InstructionDiscovery.node.replace(InstructionDiscovery.configured({
|
|
143
|
+
InstructionDiscovery.node.replace(InstructionDiscovery.configured({
|
|
144
|
+
project: options.config?.project,
|
|
145
|
+
claude: options.instructions?.claude
|
|
146
|
+
})),
|
|
137
147
|
ShellSelect.node.replace(ShellSelect.configured({ gitbash: options.windows?.gitbash })),
|
|
138
148
|
Mcp.node.replace(Mcp.configured({
|
|
139
149
|
clientInfo: {
|
|
@@ -158,7 +168,7 @@ function makeRoutes(auth, options, serviceURLs, overrides, instances) {
|
|
|
158
168
|
return serviceLayer.pipe(Layer.flatMap((context) => {
|
|
159
169
|
const services = Layer.succeedContext(context);
|
|
160
170
|
const requestServices = Layer.merge(Layer.succeedContext(Context.pick(Database.Service, Credential.Service, PermissionSaved.Service, PluginUpdate.Service, Project.Service, WellKnown.Service)(context)), layer3(serviceURLs, Context.get(context, Global.Service).tmp, options.app));
|
|
161
|
-
const api = HttpApiBuilder.layer(Api2, { openapiPath: "/openapi.json" }).pipe(Layer.provide(handlers2.pipe(Layer.provide(services), Layer.provide(Layer.succeed(CorsConfig2, options)))), Layer.provide(formLocationLayer2), Layer.provide(sessionLocationLayer2), Layer.provide(layer4), Layer.provide(authorizationLayer2), Layer.provide(schemaErrorLayer2), Layer.provide(auth), HttpRouter.provideRequest(requestServices), Layer.provideMerge(services), Layer.provideMerge(HttpRouter.layer));
|
|
171
|
+
const api = HttpApiBuilder.layer(Api2, { openapiPath: "/openapi.json" }).pipe(Layer.provide(handlers2.pipe(Layer.provide(services), Layer.provide(Layer.succeed(CorsConfig2, options)))), Layer.provide(formLocationLayer2), Layer.provide(sessionLocationLayer2), Layer.provide(layer4), Layer.provide(authorizationLayer2), Layer.provide(schemaErrorLayer2), Layer.provide(auth), HttpRouter.provideRequest(requestServices), Layer.merge(defectResponseLayer2), Layer.provideMerge(services), Layer.provideMerge(HttpRouter.layer));
|
|
162
172
|
return Layer.merge(api, V1Migration.layer.pipe(Layer.provide(services)));
|
|
163
173
|
}));
|
|
164
174
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-tracing-50bbk3b2.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./request-tracing-0e81et3m.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/plugin.ts
|
|
9
9
|
import { Plugin } from "@opencode/core/plugin";
|