@opencode/server 2.1.4 → 2.2.0
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 +8 -1
- package/dist/api.js +5 -5
- package/dist/auth.js +1 -1
- package/dist/chunks/{pairing-0dncng21.js → server-info-1gwc8nvb.js} +25 -12
- package/dist/chunks/{pairing-ga3m49sz.js → server-info-1v577ncx.js} +4 -2
- package/dist/chunks/{pairing-mte34432.js → server-info-1wd9c1m3.js} +6 -6
- package/dist/chunks/{pairing-49c878v9.js → server-info-2eaky32g.js} +12 -3
- package/dist/chunks/{pairing-x9vr2ttf.js → server-info-2h6qktqa.js} +24 -6
- package/dist/chunks/{pairing-2b2wekgg.js → server-info-4fy84009.js} +1 -1
- package/dist/chunks/{pairing-xmwystkq.js → server-info-4q6e7fh8.js} +2 -2
- package/dist/chunks/{pairing-gymtz25n.js → server-info-50bbk3b2.js} +3 -3
- package/dist/chunks/{pairing-f4b2q3tn.js → server-info-5b42hxrf.js} +1 -1
- package/dist/chunks/{pairing-3te71694.js → server-info-5pdfedjd.js} +4 -4
- package/dist/chunks/{pairing-31acg4hb.js → server-info-5s6gh8sx.js} +7 -3
- package/dist/chunks/{pairing-x0608mvx.js → server-info-6z9pvq7p.js} +1 -1
- package/dist/chunks/{pairing-7b9xm1qg.js → server-info-7b9xm1qg.js} +1 -1
- package/dist/chunks/{pairing-j5aeaa16.js → server-info-a8jcac9a.js} +1 -1
- package/dist/chunks/{pairing-swdgbzpj.js → server-info-az0609r6.js} +4 -2
- package/dist/chunks/server-info-b0f38s3n.js +105 -0
- package/dist/chunks/server-info-b105zy65.js +22 -0
- package/dist/chunks/{pairing-x74w7e1f.js → server-info-b3bmdkga.js} +1 -1
- package/dist/chunks/{pairing-erzfdgke.js → server-info-bd8755ek.js} +16 -1
- package/dist/chunks/{pairing-9me4q8wt.js → server-info-bhbc7551.js} +4 -4
- package/dist/chunks/{pairing-6xea6nhh.js → server-info-btahnm2b.js} +3 -3
- package/dist/chunks/{pairing-e7pctymn.js → server-info-cezwbsk5.js} +1 -1
- package/dist/chunks/{pairing-kaqtndqt.js → server-info-d0edqfxx.js} +4 -11
- package/dist/chunks/{pairing-39nnfjx1.js → server-info-e6e4kz0w.js} +4 -4
- package/dist/chunks/{pairing-91mt6ewz.js → server-info-f559fakr.js} +2 -2
- package/dist/chunks/{pairing-72ygafj3.js → server-info-h29xjj1e.js} +2 -2
- package/dist/chunks/{pairing-3154e7fk.js → server-info-htyf2qs7.js} +5 -3
- package/dist/chunks/{pairing-x2dckmx1.js → server-info-j2d131x1.js} +21 -16
- package/dist/chunks/{pairing-j4at0y5c.js → server-info-j4at0y5c.js} +1 -1
- package/dist/chunks/{pairing-t3j5ftv1.js → server-info-j87xz9bt.js} +3 -3
- package/dist/chunks/{pairing-kcjd09wg.js → server-info-kkdkqt8j.js} +2 -2
- package/dist/chunks/{pairing-kqr36gas.js → server-info-kqr36gas.js} +1 -1
- package/dist/chunks/server-info-n321d8vm.js +46 -0
- package/dist/chunks/{pairing-qvy2s3nb.js → server-info-nx6f5k7a.js} +4 -4
- package/dist/chunks/{pairing-4b0899hb.js → server-info-ny1j968n.js} +2 -2
- package/dist/chunks/{pairing-q69f22pd.js → server-info-qcg3sqtb.js} +2 -2
- package/dist/chunks/{pairing-2yr2dq97.js → server-info-qd0r787n.js} +2 -2
- package/dist/chunks/{pairing-e4x9285j.js → server-info-rha2aq18.js} +4 -4
- package/dist/chunks/{pairing-a6kxe6a7.js → server-info-rw1dfckh.js} +8 -4
- package/dist/chunks/{pairing-5w10ccet.js → server-info-s282vggx.js} +1 -1
- package/dist/chunks/{pairing-k6dz4enc.js → server-info-s802fzg1.js} +21 -20
- package/dist/chunks/{pairing-kd6vzpgq.js → server-info-te8jwba1.js} +2 -2
- package/dist/chunks/{pairing-nv8hzzrz.js → server-info-tjtyxt9h.js} +32 -12
- package/dist/chunks/server-info-xthc02cw.js +6 -0
- package/dist/chunks/server-info-yqhefp4s.js +83 -0
- package/dist/chunks/{pairing-aj1jc7g7.js → server-info-yxw63vq5.js} +6 -4
- package/dist/chunks/{pairing-cfhthk6z.js → server-info-zcvan105.js} +1 -1
- package/dist/chunks/{pairing-4qjw9nya.js → server-info-zpr61asr.js} +4 -4
- package/dist/cors.js +1 -1
- package/dist/event-feed.d.ts +1 -1
- package/dist/event-feed.js +3 -3
- package/dist/fetch.js +52 -49
- package/dist/handlers/agent.js +6 -6
- package/dist/handlers/command.js +6 -6
- package/dist/handlers/config.js +6 -6
- package/dist/handlers/credential.js +6 -6
- 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.d.ts +2 -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.js +6 -6
- package/dist/handlers/location.js +6 -6
- package/dist/handlers/mcp.js +8 -8
- package/dist/handlers/media.d.ts +6 -0
- package/dist/handlers/media.js +6 -0
- package/dist/handlers/message.js +7 -6
- 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 +9 -8
- 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.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.d.ts +3 -1
- package/dist/handlers/session.js +7 -6
- package/dist/handlers/shell.js +6 -6
- package/dist/handlers/skill.js +6 -6
- package/dist/handlers/usage.d.ts +1 -0
- package/dist/handlers/usage.js +11 -0
- package/dist/handlers/vcs.js +6 -6
- package/dist/handlers/voice.d.ts +1 -1
- 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 +46 -43
- package/dist/location.js +4 -4
- package/dist/media-uri.d.ts +6 -0
- package/dist/media-uri.js +6 -0
- package/dist/middleware/authorization.js +2 -2
- package/dist/middleware/form-location.js +3 -3
- package/dist/middleware/schema-error.js +1 -1
- package/dist/middleware/session-location.js +3 -3
- package/dist/pairing.js +1 -1
- package/dist/process.js +54 -51
- package/dist/request-tracing.js +1 -1
- package/dist/routes.d.ts +4 -2
- package/dist/routes.js +49 -46
- package/dist/server-info.js +3 -3
- package/dist/service-status.js +3 -3
- package/dist/workerd.js +53 -50
- package/package.json +9 -8
- package/dist/chunks/pairing-kyxm98pg.js +0 -102
- package/dist/chunks/pairing-pmjbkszz.js +0 -30
- /package/dist/chunks/{pairing-9rqn6x4v.js → server-info-9rqn6x4v.js} +0 -0
- /package/dist/chunks/{pairing-h6rt5k9s.js → server-info-h6rt5k9s.js} +0 -0
- /package/dist/chunks/{pairing-q4bn6dy8.js → server-info-q4bn6dy8.js} +0 -0
- /package/dist/chunks/{pairing-smaf4a18.js → server-info-smaf4a18.js} +0 -0
- /package/dist/chunks/{pairing-yc7nft6q.js → server-info-yc7nft6q.js} +0 -0
|
@@ -2,17 +2,17 @@ import {
|
|
|
2
2
|
locationErrors2,
|
|
3
3
|
response2,
|
|
4
4
|
requestRef2
|
|
5
|
-
} from "./
|
|
5
|
+
} from "./server-info-50bbk3b2.js";
|
|
6
6
|
import {
|
|
7
7
|
Api2
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./server-info-j87xz9bt.js";
|
|
9
9
|
import {
|
|
10
10
|
CorsConfig2,
|
|
11
11
|
isAllowedRequestOrigin2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./server-info-q4bn6dy8.js";
|
|
13
13
|
import {
|
|
14
14
|
runPtySocket2
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./server-info-h6rt5k9s.js";
|
|
16
16
|
|
|
17
17
|
// src/handlers/mcp.ts
|
|
18
18
|
import { Location } from "@opencode/core/location";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
missingSession2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./server-info-smaf4a18.js";
|
|
4
4
|
import {
|
|
5
5
|
locationErrors2,
|
|
6
6
|
response2,
|
|
7
7
|
sessionInfo2
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./server-info-50bbk3b2.js";
|
|
9
9
|
import {
|
|
10
10
|
Api2
|
|
11
|
-
} from "./
|
|
11
|
+
} from "./server-info-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 "./
|
|
4
|
+
} from "./server-info-50bbk3b2.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./server-info-j87xz9bt.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/voice.ts
|
|
10
10
|
import { Location } from "@opencode/core/location";
|
|
@@ -15,7 +15,6 @@ import { InvalidRequestError, ServiceUnavailableError } from "@opencode/protocol
|
|
|
15
15
|
import { Global } from "@opencode/util/global";
|
|
16
16
|
import { Effect } from "effect";
|
|
17
17
|
import { HttpApiBuilder } from "effect/http-api";
|
|
18
|
-
var voiceErrors = (error) => error._tag === "Voice.InvalidRequestError" ? new InvalidRequestError({ message: error.message }) : new ServiceUnavailableError({ message: error.message, service: error.service });
|
|
19
18
|
var VoiceHandler2 = HttpApiBuilder.group(Api2, "server.voice", (handlers) => Effect.gen(function* () {
|
|
20
19
|
const global = yield* Global.Service;
|
|
21
20
|
const locations = yield* LocationServiceMap.Service;
|
|
@@ -27,14 +26,8 @@ var VoiceHandler2 = HttpApiBuilder.group(Api2, "server.voice", (handlers) => Eff
|
|
|
27
26
|
}, Effect.provide(services), locationErrors2)).handle("voice.session", Effect.fn("server.voice.session")(function* (request) {
|
|
28
27
|
yield* awaitPlugins2;
|
|
29
28
|
const voice = yield* Voice.Service;
|
|
30
|
-
const
|
|
31
|
-
return {
|
|
32
|
-
data: { transport: session.transport, ...session.id === undefined ? {} : { session: { id: session.id } } }
|
|
33
|
-
};
|
|
34
|
-
}, Effect.provide(services), locationErrors2)).handle("voice.instructions", Effect.fn("server.voice.instructions")(function* (request) {
|
|
35
|
-
yield* awaitPlugins2;
|
|
36
|
-
const voice = yield* Voice.Service;
|
|
37
|
-
yield* voice.instruct({ id: request.params.sessionID, instructions: request.payload.instructions }).pipe(Effect.mapError(voiceErrors));
|
|
29
|
+
const transport = yield* voice.session(request.payload).pipe(Effect.mapError((error) => error._tag === "Voice.InvalidRequestError" ? new InvalidRequestError({ message: error.message }) : new ServiceUnavailableError({ message: error.message, service: error.service })));
|
|
30
|
+
return { data: { transport } };
|
|
38
31
|
}, Effect.provide(services), locationErrors2));
|
|
39
32
|
}));
|
|
40
33
|
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__export
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./server-info-9rqn6x4v.js";
|
|
4
4
|
|
|
5
5
|
// src/service-status.ts
|
|
6
6
|
var exports_service_status = {};
|
|
7
7
|
__export(exports_service_status, {
|
|
8
8
|
Status: () => exports_service_status,
|
|
9
|
-
make: () =>
|
|
9
|
+
make: () => make3
|
|
10
10
|
});
|
|
11
11
|
import { Effect, Ref } from "effect";
|
|
12
|
-
var
|
|
12
|
+
var make3 = Effect.fnUntraced(function* (options = {}) {
|
|
13
13
|
const current = yield* Ref.make(options.initial ?? { type: "starting" });
|
|
14
14
|
const beginStopping = Ref.update(current, (status) => status.type === "stopping" ? status : { type: "stopping" });
|
|
15
15
|
return {
|
|
@@ -20,4 +20,4 @@ var make2 = Effect.fnUntraced(function* (options = {}) {
|
|
|
20
20
|
};
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
export {
|
|
23
|
+
export { make3, exports_service_status };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./server-info-50bbk3b2.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./server-info-j87xz9bt.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/integration.ts
|
|
9
9
|
import { Integration } from "@opencode/core/integration";
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
locationErrors2,
|
|
3
3
|
sessionInfo2,
|
|
4
4
|
requestRef2
|
|
5
|
-
} from "./
|
|
5
|
+
} from "./server-info-50bbk3b2.js";
|
|
6
6
|
|
|
7
7
|
// src/middleware/form-location.ts
|
|
8
8
|
import { Instance } from "@opencode/core/instance/service";
|
|
@@ -10,7 +10,7 @@ import { LocationServiceMap } from "@opencode/core/location-services";
|
|
|
10
10
|
import { Session } from "@opencode/core/session";
|
|
11
11
|
import { LocationNotFoundError, InvalidRequestError, SessionNotFoundError } from "@opencode/protocol/errors";
|
|
12
12
|
import { Effect, Layer } from "effect";
|
|
13
|
-
import { HttpRouter, HttpServerRequest } from "effect/http";
|
|
13
|
+
import { HttpRouter, HttpServerRequest, HttpServerResponse } from "effect/http";
|
|
14
14
|
import { HttpApiMiddleware } from "effect/http-api";
|
|
15
15
|
class FormLocationMiddleware2 extends HttpApiMiddleware.Service()("@opencode/HttpApiFormLocation", {
|
|
16
16
|
error: [InvalidRequestError, SessionNotFoundError, LocationNotFoundError]
|
|
@@ -20,13 +20,15 @@ var formLocationLayer2 = Layer.effect(FormLocationMiddleware2, Effect.gen(functi
|
|
|
20
20
|
const sessions = yield* Session.Service;
|
|
21
21
|
const instances = yield* Instance.Service;
|
|
22
22
|
const locations = yield* LocationServiceMap.Service;
|
|
23
|
-
return FormLocationMiddleware2.of((effect) => Effect.gen(function* () {
|
|
23
|
+
return FormLocationMiddleware2.of((effect, options) => Effect.gen(function* () {
|
|
24
24
|
const route = yield* HttpRouter.RouteContext;
|
|
25
25
|
if (route.params.sessionID === "global") {
|
|
26
26
|
const request = yield* HttpServerRequest.HttpServerRequest;
|
|
27
27
|
return yield* effect.pipe(Effect.provide(locations.get(requestRef2(request))), locationErrors2);
|
|
28
28
|
}
|
|
29
29
|
const session = yield* sessionInfo2(sessions, route.params.sessionID);
|
|
30
|
+
if (options.endpoint.identifier === "session.form.list" && instances.live && !(yield* instances.live(session)))
|
|
31
|
+
return HttpServerResponse.jsonUnsafe({ data: [] });
|
|
30
32
|
return yield* effect.pipe(instances.provide(session), locationErrors2);
|
|
31
33
|
}));
|
|
32
34
|
}));
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./
|
|
2
|
+
layer4
|
|
3
|
+
} from "./server-info-50bbk3b2.js";
|
|
4
4
|
import {
|
|
5
5
|
formLocationLayer2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./server-info-htyf2qs7.js";
|
|
7
7
|
import {
|
|
8
8
|
sessionLocationLayer2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./server-info-b3bmdkga.js";
|
|
10
10
|
import {
|
|
11
11
|
Api2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./server-info-j87xz9bt.js";
|
|
13
13
|
import {
|
|
14
14
|
Config2
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./server-info-j4at0y5c.js";
|
|
16
16
|
import {
|
|
17
17
|
CorsConfig2
|
|
18
|
-
} from "./
|
|
18
|
+
} from "./server-info-q4bn6dy8.js";
|
|
19
19
|
import {
|
|
20
|
-
|
|
21
|
-
} from "./
|
|
20
|
+
layer2
|
|
21
|
+
} from "./server-info-5pdfedjd.js";
|
|
22
22
|
import {
|
|
23
23
|
node2
|
|
24
|
-
} from "./
|
|
24
|
+
} from "./server-info-kqr36gas.js";
|
|
25
25
|
import {
|
|
26
26
|
handlers2
|
|
27
|
-
} from "./
|
|
27
|
+
} from "./server-info-b0f38s3n.js";
|
|
28
28
|
import {
|
|
29
29
|
authorizationLayer2
|
|
30
|
-
} from "./
|
|
30
|
+
} from "./server-info-7b9xm1qg.js";
|
|
31
31
|
import {
|
|
32
32
|
schemaErrorLayer2
|
|
33
|
-
} from "./
|
|
33
|
+
} from "./server-info-bd8755ek.js";
|
|
34
34
|
|
|
35
35
|
// src/routes.ts
|
|
36
36
|
import { Database } from "@opencode/core/database/database";
|
|
@@ -52,6 +52,7 @@ import { Worktree } from "@opencode/core/worktree";
|
|
|
52
52
|
import { Session } from "@opencode/core/session";
|
|
53
53
|
import { Instance } from "@opencode/core/instance/service";
|
|
54
54
|
import { SessionTransfer } from "@opencode/core/session/transfer";
|
|
55
|
+
import { InstructionEntry } from "@opencode/core/session/instruction-entry";
|
|
55
56
|
import { ShellSelect } from "@opencode/core/shell/select";
|
|
56
57
|
import { Job } from "@opencode/core/job";
|
|
57
58
|
import { Mcp } from "@opencode/core/mcp/index";
|
|
@@ -67,6 +68,7 @@ import { SdkPlugins } from "@opencode/core/plugin/sdk";
|
|
|
67
68
|
import { WellKnown } from "@opencode/core/wellknown";
|
|
68
69
|
import { Workspace } from "@opencode/core/workspace";
|
|
69
70
|
import { Watcher } from "@opencode/core/filesystem/watcher";
|
|
71
|
+
import { FileWatch } from "@opencode/core/filesystem/file-watch";
|
|
70
72
|
import { HttpRouter } from "effect/http";
|
|
71
73
|
import { HttpApiBuilder } from "effect/http-api";
|
|
72
74
|
import { Context, Effect, Layer, Option } from "effect";
|
|
@@ -84,6 +86,7 @@ var applicationServiceNodes = [
|
|
|
84
86
|
Session.node,
|
|
85
87
|
Instance.node,
|
|
86
88
|
SessionTransfer.node,
|
|
89
|
+
InstructionEntry.node,
|
|
87
90
|
SdkPlugins.node,
|
|
88
91
|
PluginUpdate.node,
|
|
89
92
|
PermissionSaved.node,
|
|
@@ -95,7 +98,8 @@ var applicationServiceNodes = [
|
|
|
95
98
|
LocationServiceMap.node,
|
|
96
99
|
LocationActivity.node,
|
|
97
100
|
SessionRestart.node,
|
|
98
|
-
Workspace.node
|
|
101
|
+
Workspace.node,
|
|
102
|
+
FileWatch.node
|
|
99
103
|
];
|
|
100
104
|
var applicationServices = LayerNode.group(applicationServiceNodes);
|
|
101
105
|
function createRoutes2(options = {}, serviceURLs = () => [], overrides = []) {
|
|
@@ -112,6 +116,7 @@ function makeRoutes(auth, options, serviceURLs, overrides, instances) {
|
|
|
112
116
|
App.node.replace(App.configured(options.app)),
|
|
113
117
|
ModelsDev.node.replace(ModelsDev.configured(options.models)),
|
|
114
118
|
Watcher.node.replace(Watcher.configured({ enabled: options.fs?.filewatcher })),
|
|
119
|
+
FileWatch.node.replace(FileWatch.configured({ enabled: options.fs?.filewatcher })),
|
|
115
120
|
FileSystemSearch.node.replace(FileSystemSearch.configured({ fff: options.fs?.fff })),
|
|
116
121
|
Global.node.replace(Global.layerWith(options.config?.directory ? { config: options.config.directory } : {})),
|
|
117
122
|
Config.node.replace(Config.configured({
|
|
@@ -144,8 +149,8 @@ function makeRoutes(auth, options, serviceURLs, overrides, instances) {
|
|
|
144
149
|
})) : build(overrides);
|
|
145
150
|
return serviceLayer.pipe(Layer.flatMap((context) => {
|
|
146
151
|
const services = Layer.succeedContext(context);
|
|
147
|
-
const requestServices = Layer.merge(Layer.succeedContext(Context.pick(Database.Service, Credential.Service, PermissionSaved.Service, PluginUpdate.Service, Project.Service, WellKnown.Service)(context)),
|
|
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(
|
|
152
|
+
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));
|
|
153
|
+
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));
|
|
149
154
|
return Layer.merge(api, V1Migration.layer.pipe(Layer.provide(services)));
|
|
150
155
|
}));
|
|
151
156
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LocationMiddleware2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./server-info-50bbk3b2.js";
|
|
4
4
|
import {
|
|
5
5
|
FormLocationMiddleware2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./server-info-htyf2qs7.js";
|
|
7
7
|
import {
|
|
8
8
|
SessionLocationMiddleware2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./server-info-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 "./
|
|
4
|
+
} from "./server-info-50bbk3b2.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./server-info-j87xz9bt.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/websearch.ts
|
|
10
10
|
import { WebSearch } from "@opencode/core/websearch";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// src/handlers/media.ts
|
|
2
|
+
import { Database } from "@opencode/core/database/database";
|
|
3
|
+
import { SessionBlob } from "@opencode/core/session/blob";
|
|
4
|
+
import { FileNotFoundError } from "@opencode/protocol/errors";
|
|
5
|
+
import { Effect } from "effect";
|
|
6
|
+
import { HttpServerResponse } from "effect/http";
|
|
7
|
+
var INLINE_IMAGE_MIMES = new Set(["image/png", "image/jpeg", "image/gif", "image/webp"]);
|
|
8
|
+
var CACHE_CONTROL = "private, max-age=31536000, immutable";
|
|
9
|
+
var SECURITY_HEADERS = {
|
|
10
|
+
"x-content-type-options": "nosniff",
|
|
11
|
+
"content-security-policy": "default-src 'none'; sandbox"
|
|
12
|
+
};
|
|
13
|
+
var makeMediaGet2 = Effect.gen(function* () {
|
|
14
|
+
const { db } = yield* Database.Service;
|
|
15
|
+
return (hash, request) => Effect.gen(function* () {
|
|
16
|
+
const path = `/api/experimental/media/${hash}`;
|
|
17
|
+
const blob = yield* SessionBlob.read(db, hash);
|
|
18
|
+
if (!blob)
|
|
19
|
+
return yield* new FileNotFoundError({ path, message: `Media blob not found: ${hash}` });
|
|
20
|
+
const etag = `"${hash}"`;
|
|
21
|
+
const inline = INLINE_IMAGE_MIMES.has(blob.mime);
|
|
22
|
+
const headers = {
|
|
23
|
+
"cache-control": CACHE_CONTROL,
|
|
24
|
+
etag,
|
|
25
|
+
...SECURITY_HEADERS,
|
|
26
|
+
...inline ? {} : { "content-disposition": "attachment" }
|
|
27
|
+
};
|
|
28
|
+
if (matchesIfNoneMatch(request.headers["if-none-match"], etag))
|
|
29
|
+
return HttpServerResponse.empty({ status: 304, headers });
|
|
30
|
+
return HttpServerResponse.uint8Array(blob.data, {
|
|
31
|
+
status: 200,
|
|
32
|
+
contentType: inline ? blob.mime : "application/octet-stream",
|
|
33
|
+
headers
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
function matchesIfNoneMatch(ifNoneMatch, etag) {
|
|
38
|
+
if (ifNoneMatch === undefined)
|
|
39
|
+
return false;
|
|
40
|
+
return ifNoneMatch.split(",").some((tag) => {
|
|
41
|
+
const trimmed = tag.trim();
|
|
42
|
+
return trimmed === "*" || trimmed.replace(/^w\//i, "") === etag;
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export { makeMediaGet2 };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./server-info-j87xz9bt.js";
|
|
4
4
|
import {
|
|
5
5
|
Service4,
|
|
6
6
|
frame2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./server-info-s802fzg1.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/event.ts
|
|
10
10
|
import { Event } from "@opencode/schema/event";
|
|
@@ -13,13 +13,13 @@ 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
15
|
const feed = yield* Service4;
|
|
16
|
-
return handlers.handleRaw("event.subscribe", () => Effect.gen(function* () {
|
|
16
|
+
return handlers.handleRaw("event.subscribe", (ctx) => Effect.gen(function* () {
|
|
17
17
|
const connected = {
|
|
18
18
|
id: Event.ID.create(),
|
|
19
19
|
type: "server.connected",
|
|
20
20
|
data: {}
|
|
21
21
|
};
|
|
22
|
-
const output = Stream.unwrap(feed.subscribe.pipe(Effect.map((live) => Stream.make(frame2(connected)).pipe(Stream.concat(live)))));
|
|
22
|
+
const output = Stream.unwrap(feed.subscribe(ctx.query.types).pipe(Effect.map((live) => Stream.make(frame2(connected)).pipe(Stream.concat(live)))));
|
|
23
23
|
const heartbeat = Stream.tick("15 seconds").pipe(Stream.map(() => `: heartbeat
|
|
24
24
|
|
|
25
25
|
`));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
requestRef2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./server-info-50bbk3b2.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./server-info-j87xz9bt.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/debug.ts
|
|
9
9
|
import { LocationServiceMap } from "@opencode/core/location-service-map";
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
awaitPlugins2,
|
|
3
3
|
response2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./server-info-50bbk3b2.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./server-info-j87xz9bt.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/model.ts
|
|
10
10
|
import { Model } from "@opencode/core/model";
|
|
11
11
|
import { Effect } from "effect";
|
|
12
12
|
import { HttpApiBuilder } from "effect/http-api";
|
|
13
13
|
var ModelHandler2 = HttpApiBuilder.group(Api2, "server.model", (handlers) => Effect.gen(function* () {
|
|
14
|
-
return handlers.handle("model.list", Effect.fn(function* () {
|
|
14
|
+
return handlers.handle("model.list", Effect.fn(function* (ctx) {
|
|
15
15
|
yield* awaitPlugins2;
|
|
16
16
|
const models = yield* Model.Service;
|
|
17
|
-
return yield* response2(models.available());
|
|
17
|
+
return yield* response2(models.available(ctx.query.types));
|
|
18
18
|
})).handle("model.default", Effect.fn(function* () {
|
|
19
19
|
yield* awaitPlugins2;
|
|
20
20
|
const models = yield* Model.Service;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./server-info-j87xz9bt.js";
|
|
4
4
|
import {
|
|
5
5
|
CorsConfig2,
|
|
6
6
|
isAllowedRequestOrigin2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./server-info-q4bn6dy8.js";
|
|
8
|
+
import {
|
|
9
|
+
makeMediaGet2
|
|
10
|
+
} from "./server-info-n321d8vm.js";
|
|
8
11
|
import {
|
|
9
12
|
runPtySocket2
|
|
10
|
-
} from "./
|
|
13
|
+
} from "./server-info-h6rt5k9s.js";
|
|
11
14
|
|
|
12
15
|
// src/handlers/persistent-pty.ts
|
|
13
16
|
import { PersistentPty } from "@opencode/core/persistent-pty";
|
|
@@ -26,7 +29,8 @@ var PersistentPtyHandler2 = HttpApiBuilder.group(Api2, "server.experimental", (h
|
|
|
26
29
|
const tickets = yield* PtyTicket.Service;
|
|
27
30
|
const cors = yield* CorsConfig2;
|
|
28
31
|
const pty = yield* PersistentPty.Service;
|
|
29
|
-
|
|
32
|
+
const mediaGet = yield* makeMediaGet2;
|
|
33
|
+
return handlers.handleRaw("media.get", (ctx) => mediaGet(ctx.params.hash, ctx.request)).handle("persistentPty.read", Effect.fn(function* (ctx) {
|
|
30
34
|
return { data: yield* pty.read(ctx.params.sessionID, ctx.query.lines).pipe(mapUnavailable) };
|
|
31
35
|
})).handle("persistentPty.list", Effect.fn(function* (ctx) {
|
|
32
36
|
return { data: yield* pty.list(ctx.params.sessionID).pipe(mapUnavailable) };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__export
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./server-info-9rqn6x4v.js";
|
|
4
4
|
|
|
5
5
|
// src/event-feed.ts
|
|
6
6
|
var exports_event_feed = {};
|
|
@@ -11,7 +11,7 @@ __export(exports_event_feed, {
|
|
|
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";
|
|
@@ -40,9 +40,9 @@ function frame2(event) {
|
|
|
40
40
|
var make4 = Effect.fn("EventFeed.make")(function* (observe, options) {
|
|
41
41
|
const capacity = options?.capacity ?? SubscriberCapacity2;
|
|
42
42
|
const render = options?.encode ?? frame2;
|
|
43
|
-
const subscribers = new
|
|
43
|
+
const subscribers = new Map;
|
|
44
44
|
const fail = (error) => Effect.sync(() => {
|
|
45
|
-
const current = Array.from(subscribers);
|
|
45
|
+
const current = Array.from(subscribers.keys());
|
|
46
46
|
subscribers.clear();
|
|
47
47
|
for (const subscriber of current)
|
|
48
48
|
Queue.failCauseUnsafe(subscriber, Cause.fail(error));
|
|
@@ -50,19 +50,20 @@ var make4 = Effect.fn("EventFeed.make")(function* (observe, options) {
|
|
|
50
50
|
const publish = Effect.fnUntraced(function* (event) {
|
|
51
51
|
if (!isOpenCodeEvent(event))
|
|
52
52
|
return;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
53
|
+
let encoded;
|
|
54
|
+
for (const [subscriber, types] of subscribers) {
|
|
55
|
+
if (types && !types.has(event.type))
|
|
56
|
+
continue;
|
|
57
|
+
encoded ??= yield* Effect.try({
|
|
58
|
+
try: () => render(event),
|
|
59
|
+
catch: (cause) => new EncodingError2({ eventID: event.id, eventType: event.type, cause })
|
|
60
|
+
}).pipe(Effect.catch((error) => Effect.logError("Failed to encode public event", {
|
|
61
|
+
eventID: error.eventID,
|
|
62
|
+
eventType: error.eventType,
|
|
63
|
+
cause: error.cause
|
|
64
|
+
}).pipe(Effect.andThen(fail(error)), Effect.as(undefined))));
|
|
65
|
+
if (encoded === undefined)
|
|
66
|
+
return;
|
|
66
67
|
if (Queue.offerUnsafe(subscriber, encoded))
|
|
67
68
|
continue;
|
|
68
69
|
subscribers.delete(subscriber);
|
|
@@ -72,12 +73,12 @@ var make4 = Effect.fn("EventFeed.make")(function* (observe, options) {
|
|
|
72
73
|
const unsubscribe = yield* observe(publish);
|
|
73
74
|
yield* Effect.addFinalizer(() => unsubscribe);
|
|
74
75
|
return Service4.of({
|
|
75
|
-
subscribe: Effect.acquireRelease(Queue.dropping(capacity).pipe(Effect.tap((queue) => Effect.sync(() => subscribers.
|
|
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))
|
|
76
77
|
});
|
|
77
78
|
});
|
|
78
|
-
var
|
|
79
|
+
var layer3 = Layer.effect(Service4, Effect.gen(function* () {
|
|
79
80
|
const bus = yield* Bus.Service;
|
|
80
81
|
return yield* make4(bus.listen);
|
|
81
82
|
}));
|
|
82
83
|
|
|
83
|
-
export { SubscriberCapacity2, SubscriberOverflowError2, EncodingError2, Service4, frame2, make4,
|
|
84
|
+
export { SubscriberCapacity2, SubscriberOverflowError2, EncodingError2, Service4, frame2, make4, layer3, exports_event_feed };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./server-info-50bbk3b2.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./server-info-j87xz9bt.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/reference.ts
|
|
9
9
|
import { Reference } from "@opencode/core/reference";
|