@opencode/server 0.0.0-dev-904 → 0.0.0-dev-918
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/{api-059rbh9c.js → request-site-059rbh9c.js} +1 -1
- package/dist/chunks/{api-0e4fm4yw.js → request-site-0e4fm4yw.js} +1 -1
- package/dist/chunks/{api-2835150m.js → request-site-2835150m.js} +2 -2
- package/dist/chunks/{api-y99wfvnx.js → request-site-2d97cxdz.js} +13 -13
- package/dist/chunks/{api-370cpmna.js → request-site-370cpmna.js} +2 -2
- package/dist/chunks/{api-39nnfjx1.js → request-site-39nnfjx1.js} +1 -1
- package/dist/chunks/{api-50xc6x42.js → request-site-50xc6x42.js} +3 -3
- package/dist/chunks/{api-5553qfcy.js → request-site-5553qfcy.js} +3 -3
- package/dist/chunks/{api-57m9rtnr.js → request-site-57m9rtnr.js} +2 -2
- package/dist/chunks/{api-5afgx201.js → request-site-5afgx201.js} +2 -2
- package/dist/chunks/{api-7dtbad8d.js → request-site-5pdfedjd.js} +7 -7
- package/dist/chunks/{api-5z5anmwp.js → request-site-5z5anmwp.js} +2 -2
- package/dist/chunks/{api-74kxthdf.js → request-site-74kxthdf.js} +1 -1
- package/dist/chunks/{api-78rcgzsr.js → request-site-78rcgzsr.js} +1 -1
- package/dist/chunks/{api-7b9xm1qg.js → request-site-7b9xm1qg.js} +1 -1
- package/dist/chunks/{api-7cd61xtm.js → request-site-7cd61xtm.js} +2 -2
- package/dist/chunks/{api-7tewdwsb.js → request-site-7tewdwsb.js} +2 -2
- package/dist/chunks/{api-7x1re4zg.js → request-site-7x1re4zg.js} +2 -2
- package/dist/chunks/{api-p94f9pb0.js → request-site-8q1gmyrw.js} +8 -5
- package/dist/chunks/{api-2j32qzdw.js → request-site-cxarvqyg.js} +7 -7
- package/dist/chunks/{api-n321d8vm.js → request-site-djr0jy89.js} +8 -6
- package/dist/chunks/{api-f4exzdsf.js → request-site-f4exzdsf.js} +2 -2
- package/dist/chunks/{api-4z8yg1dv.js → request-site-fbdv47za.js} +4 -4
- package/dist/chunks/{api-k8y9dxyq.js → request-site-fszbw5sk.js} +4 -4
- package/dist/chunks/{api-gk0yxcp6.js → request-site-gk0yxcp6.js} +1 -1
- package/dist/chunks/{api-gqq6kfhc.js → request-site-gqq6kfhc.js} +1 -1
- package/dist/chunks/{api-6sada178.js → request-site-gzcpr2d6.js} +8 -8
- package/dist/chunks/request-site-hmwn16zp.js +39 -0
- package/dist/chunks/{api-j4at0y5c.js → request-site-j4at0y5c.js} +1 -1
- package/dist/chunks/{api-jc2vwkyw.js → request-site-jc2vwkyw.js} +2 -2
- package/dist/chunks/{api-w9jcwh65.js → request-site-kqr36gas.js} +7 -7
- package/dist/chunks/{api-r2veymj8.js → request-site-qpzkqgwj.js} +4 -4
- package/dist/chunks/{api-r5696se6.js → request-site-r5696se6.js} +3 -3
- package/dist/chunks/{api-rxyx8sa0.js → request-site-rxyx8sa0.js} +2 -2
- package/dist/chunks/{api-n8pb21j2.js → request-site-s347xjnz.js} +35 -35
- package/dist/chunks/{api-skcryrty.js → request-site-skcryrty.js} +2 -2
- package/dist/chunks/{api-sqxx1p54.js → request-site-sqxx1p54.js} +2 -2
- package/dist/chunks/request-site-t32e1bbt.js +32 -0
- package/dist/chunks/{api-vtfzy3at.js → request-site-vtfzy3at.js} +2 -2
- package/dist/chunks/{api-vvp99hc9.js → request-site-vvp99hc9.js} +1 -1
- package/dist/chunks/{api-w83vdpy9.js → request-site-w83vdpy9.js} +2 -2
- package/dist/chunks/{api-fvpjvjpp.js → request-site-wecgp61r.js} +7 -7
- package/dist/chunks/{api-wqv43pj9.js → request-site-wqv43pj9.js} +2 -2
- package/dist/chunks/{api-xbqm7mpj.js → request-site-xbqm7mpj.js} +2 -2
- package/dist/chunks/{api-xpg37vzc.js → request-site-xpg37vzc.js} +2 -2
- package/dist/chunks/{api-yet0vexm.js → request-site-yet0vexm.js} +1 -1
- package/dist/chunks/{api-z9kgby92.js → request-site-z9kgby92.js} +4 -4
- package/dist/chunks/{api-zds85vps.js → request-site-zds85vps.js} +1 -1
- package/dist/chunks/{api-0pbbhyf6.js → request-site-zgvwy66h.js} +9 -6
- package/dist/chunks/{api-zmgfywqd.js → request-site-zmgfywqd.js} +1 -1
- package/dist/chunks/{api-zyntahe8.js → request-site-zyntahe8.js} +1 -1
- package/dist/content-headers.d.ts +13 -0
- package/dist/content-headers.js +12 -0
- package/dist/cors.js +1 -1
- package/dist/event-feed.js +5 -5
- package/dist/fetch.js +56 -54
- package/dist/handlers/agent.js +6 -6
- package/dist/handlers/artifact.js +3 -3
- 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 +7 -6
- package/dist/handlers/generate.js +6 -6
- package/dist/handlers/integration.js +6 -6
- 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 -1
- 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.js +13 -12
- 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/schedule.js +2 -2
- 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.js +50 -49
- package/dist/location.js +2 -2
- package/dist/media-uri.js +1 -1
- 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 +3 -3
- package/dist/process.js +60 -56
- package/dist/request-site.d.ts +11 -0
- package/dist/request-site.js +11 -0
- package/dist/request-tracing.js +1 -1
- package/dist/routes.js +53 -52
- package/dist/server-info.js +5 -5
- package/dist/service-status.js +1 -1
- package/dist/workerd.js +57 -55
- package/package.json +8 -8
- /package/dist/chunks/{api-9rqn6x4v.js → request-site-9rqn6x4v.js} +0 -0
- /package/dist/chunks/{api-bd8755ek.js → request-site-bd8755ek.js} +0 -0
- /package/dist/chunks/{api-q187pxxd.js → request-site-q187pxxd.js} +0 -0
- /package/dist/chunks/{api-q4bn6dy8.js → request-site-q4bn6dy8.js} +0 -0
- /package/dist/chunks/{api-smaf4a18.js → request-site-smaf4a18.js} +0 -0
- /package/dist/chunks/{api-xthc02cw.js → request-site-xthc02cw.js} +0 -0
- /package/dist/chunks/{api-yc7nft6q.js → request-site-yc7nft6q.js} +0 -0
package/dist/api.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./chunks/
|
|
4
|
-
import"./chunks/
|
|
5
|
-
import"./chunks/
|
|
6
|
-
import"./chunks/
|
|
7
|
-
import"./chunks/
|
|
3
|
+
} from "./chunks/request-site-r5696se6.js";
|
|
4
|
+
import"./chunks/request-site-gk0yxcp6.js";
|
|
5
|
+
import"./chunks/request-site-yet0vexm.js";
|
|
6
|
+
import"./chunks/request-site-gqq6kfhc.js";
|
|
7
|
+
import"./chunks/request-site-smaf4a18.js";
|
|
8
8
|
export {
|
|
9
9
|
Api2 as Api
|
|
10
10
|
};
|
package/dist/auth.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
locationErrors2,
|
|
3
3
|
awaitPlugins2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./request-site-gqq6kfhc.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./request-site-r5696se6.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/voice.ts
|
|
10
10
|
import { Location } from "@opencode/core/location";
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import {
|
|
2
2
|
layer3
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-site-gqq6kfhc.js";
|
|
4
4
|
import {
|
|
5
5
|
formLocationLayer2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./request-site-gk0yxcp6.js";
|
|
7
7
|
import {
|
|
8
8
|
sessionLocationLayer2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./request-site-yet0vexm.js";
|
|
10
10
|
import {
|
|
11
11
|
Api2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./request-site-r5696se6.js";
|
|
13
13
|
import {
|
|
14
14
|
Config2
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./request-site-j4at0y5c.js";
|
|
16
16
|
import {
|
|
17
17
|
CorsConfig2
|
|
18
|
-
} from "./
|
|
18
|
+
} from "./request-site-q4bn6dy8.js";
|
|
19
19
|
import {
|
|
20
|
-
|
|
21
|
-
} from "./
|
|
20
|
+
layer2
|
|
21
|
+
} from "./request-site-5pdfedjd.js";
|
|
22
22
|
import {
|
|
23
23
|
node2
|
|
24
|
-
} from "./
|
|
24
|
+
} from "./request-site-kqr36gas.js";
|
|
25
25
|
import {
|
|
26
26
|
handlers2
|
|
27
|
-
} from "./
|
|
27
|
+
} from "./request-site-s347xjnz.js";
|
|
28
28
|
import {
|
|
29
29
|
authorizationLayer2
|
|
30
|
-
} from "./
|
|
30
|
+
} from "./request-site-7b9xm1qg.js";
|
|
31
31
|
import {
|
|
32
32
|
schemaErrorLayer2
|
|
33
|
-
} from "./
|
|
33
|
+
} from "./request-site-bd8755ek.js";
|
|
34
34
|
|
|
35
35
|
// src/routes.ts
|
|
36
36
|
import { Database } from "@opencode/core/database/database";
|
|
@@ -154,7 +154,7 @@ function makeRoutes(auth, options, serviceURLs, overrides, instances) {
|
|
|
154
154
|
})) : build(overrides);
|
|
155
155
|
return serviceLayer.pipe(Layer.flatMap((context) => {
|
|
156
156
|
const services = Layer.succeedContext(context);
|
|
157
|
-
const requestServices = Layer.merge(Layer.succeedContext(Context.pick(Database.Service, Credential.Service, PermissionSaved.Service, PluginUpdate.Service, Project.Service, WellKnown.Service)(context)),
|
|
157
|
+
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));
|
|
158
158
|
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(layer3), Layer.provide(authorizationLayer2), Layer.provide(schemaErrorLayer2), Layer.provide(auth), HttpRouter.provideRequest(requestServices), Layer.provideMerge(services), Layer.provideMerge(HttpRouter.layer));
|
|
159
159
|
return Layer.merge(api, V1Migration.layer.pipe(Layer.provide(services)));
|
|
160
160
|
}));
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
awaitPlugins2,
|
|
3
3
|
response2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./request-site-gqq6kfhc.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./request-site-r5696se6.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/model.ts
|
|
10
10
|
import { Model } from "@opencode/core/model";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
missingSession2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-site-smaf4a18.js";
|
|
4
4
|
import {
|
|
5
5
|
locationErrors2,
|
|
6
6
|
response2,
|
|
7
7
|
sessionInfo2
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./request-site-gqq6kfhc.js";
|
|
9
9
|
import {
|
|
10
10
|
Api2
|
|
11
|
-
} from "./
|
|
11
|
+
} from "./request-site-r5696se6.js";
|
|
12
12
|
|
|
13
13
|
// src/handlers/permission.ts
|
|
14
14
|
import { Instance } from "@opencode/core/instance/service";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
missingSession2,
|
|
3
3
|
failedMessageDecode2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./request-site-smaf4a18.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./request-site-r5696se6.js";
|
|
8
8
|
import {
|
|
9
9
|
wantsMediaRefs2
|
|
10
|
-
} from "./
|
|
10
|
+
} from "./request-site-xthc02cw.js";
|
|
11
11
|
|
|
12
12
|
// src/handlers/message.ts
|
|
13
13
|
import { SessionMessage } from "@opencode/core/session/message";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
missingSession2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-site-smaf4a18.js";
|
|
4
4
|
import {
|
|
5
5
|
locationErrors2,
|
|
6
6
|
awaitPlugins2,
|
|
7
7
|
response2,
|
|
8
8
|
requestRef2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./request-site-gqq6kfhc.js";
|
|
10
10
|
|
|
11
11
|
// src/handlers/artifact.ts
|
|
12
12
|
import { Artifact } from "@opencode/core/artifact";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-site-gqq6kfhc.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./request-site-r5696se6.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/integration.ts
|
|
9
9
|
import { Integration } from "@opencode/core/integration";
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__export
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-site-9rqn6x4v.js";
|
|
4
4
|
|
|
5
5
|
// src/server-info.ts
|
|
6
6
|
var exports_server_info = {};
|
|
7
7
|
__export(exports_server_info, {
|
|
8
8
|
ServerInfo: () => exports_server_info,
|
|
9
|
-
Service: () =>
|
|
9
|
+
Service: () => Service3,
|
|
10
10
|
connectionURLs: () => connectionURLs2,
|
|
11
|
-
layer: () =>
|
|
11
|
+
layer: () => layer2
|
|
12
12
|
});
|
|
13
13
|
import { Context, Layer } from "effect";
|
|
14
14
|
import { networkInterfaces } from "node:os";
|
|
15
15
|
|
|
16
|
-
class
|
|
16
|
+
class Service3 extends Context.Service()("@opencode/server/ServerInfo") {
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
return Layer.succeed(
|
|
18
|
+
function layer2(urls, tmp, app = {}) {
|
|
19
|
+
return Layer.succeed(Service3, Service3.of({ urls, app, paths: { tmp } }));
|
|
20
20
|
}
|
|
21
21
|
function connectionURLs2(value, requestedHostname) {
|
|
22
22
|
const url = new URL(value);
|
|
@@ -38,4 +38,4 @@ function connectionURLs2(value, requestedHostname) {
|
|
|
38
38
|
];
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
export {
|
|
41
|
+
export { Service3, layer2, connectionURLs2, exports_server_info };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
awaitPlugins2,
|
|
3
3
|
response2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./request-site-gqq6kfhc.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./request-site-r5696se6.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/usage.ts
|
|
10
10
|
import { UsageLimits } from "@opencode/core/usage-limits";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
awaitPlugins2,
|
|
3
3
|
response2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./request-site-gqq6kfhc.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./request-site-r5696se6.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/websearch.ts
|
|
10
10
|
import { WebSearch } from "@opencode/core/websearch";
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isAllowedCorsOrigin2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-site-q4bn6dy8.js";
|
|
4
|
+
import {
|
|
5
|
+
middleware2
|
|
6
|
+
} from "./request-site-hmwn16zp.js";
|
|
4
7
|
import {
|
|
5
8
|
withoutParentSpan2
|
|
6
|
-
} from "./
|
|
9
|
+
} from "./request-site-yc7nft6q.js";
|
|
7
10
|
import {
|
|
8
11
|
createRoutes2
|
|
9
|
-
} from "./
|
|
12
|
+
} from "./request-site-2d97cxdz.js";
|
|
10
13
|
import {
|
|
11
14
|
__export
|
|
12
|
-
} from "./
|
|
15
|
+
} from "./request-site-9rqn6x4v.js";
|
|
13
16
|
|
|
14
17
|
// src/fetch.ts
|
|
15
18
|
var exports_fetch = {};
|
|
@@ -23,7 +26,7 @@ import { SessionRestart } from "@opencode/core/session/execution/restart";
|
|
|
23
26
|
var make3 = Effect.fn("ServerFetch.make")(function* (options = {}, boot = {}) {
|
|
24
27
|
const context = yield* Layer.build(createRoutes2(options, () => [], boot.overrides ?? []).pipe(Layer.provide(HttpServer.layerServices))).pipe(withoutParentSpan2);
|
|
25
28
|
yield* Effect.forkDetach(Context.get(context, SessionRestart.Service).resumeSuspendedSessions);
|
|
26
|
-
return Context.get(context, HttpRouter.HttpRouter).asHttpEffect().pipe(HttpMiddleware.cors({ allowedOrigins: (origin) => isAllowedCorsOrigin2(origin, options), maxAge: 86400 }), HttpEffect.toWebHandlerWith(context));
|
|
29
|
+
return Context.get(context, HttpRouter.HttpRouter).asHttpEffect().pipe(middleware2(options), HttpMiddleware.cors({ allowedOrigins: (origin) => isAllowedCorsOrigin2(origin, options), maxAge: 86400 }), HttpEffect.toWebHandlerWith(context));
|
|
27
30
|
});
|
|
28
31
|
|
|
29
32
|
export { make3, exports_fetch };
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-site-r5696se6.js";
|
|
4
4
|
import {
|
|
5
5
|
CorsConfig2,
|
|
6
6
|
isAllowedRequestOrigin2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./request-site-q4bn6dy8.js";
|
|
8
8
|
import {
|
|
9
9
|
makeArtifact2
|
|
10
|
-
} from "./
|
|
10
|
+
} from "./request-site-57m9rtnr.js";
|
|
11
11
|
import {
|
|
12
12
|
makeJob2
|
|
13
|
-
} from "./
|
|
13
|
+
} from "./request-site-78rcgzsr.js";
|
|
14
14
|
import {
|
|
15
15
|
makeMediaGet2
|
|
16
|
-
} from "./
|
|
16
|
+
} from "./request-site-djr0jy89.js";
|
|
17
17
|
import {
|
|
18
18
|
runPtySocket2
|
|
19
|
-
} from "./
|
|
19
|
+
} from "./request-site-q187pxxd.js";
|
|
20
20
|
import {
|
|
21
21
|
makeSchedule2
|
|
22
|
-
} from "./
|
|
22
|
+
} from "./request-site-059rbh9c.js";
|
|
23
23
|
|
|
24
24
|
// src/handlers/persistent-pty.ts
|
|
25
25
|
import { PersistentPty } from "@opencode/core/persistent-pty";
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CONTENT_SECURITY_POLICY2,
|
|
3
|
+
disposition2
|
|
4
|
+
} from "./request-site-t32e1bbt.js";
|
|
5
|
+
|
|
1
6
|
// src/handlers/media.ts
|
|
2
7
|
import { Database } from "@opencode/core/database/database";
|
|
3
8
|
import { SessionBlob } from "@opencode/core/session/blob";
|
|
@@ -6,10 +11,6 @@ import { Effect } from "effect";
|
|
|
6
11
|
import { HttpServerResponse } from "effect/http";
|
|
7
12
|
var INLINE_IMAGE_MIMES = new Set(["image/png", "image/jpeg", "image/gif", "image/webp"]);
|
|
8
13
|
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
14
|
var makeMediaGet2 = Effect.gen(function* () {
|
|
14
15
|
const { db } = yield* Database.Service;
|
|
15
16
|
return (hash, request) => Effect.gen(function* () {
|
|
@@ -22,8 +23,9 @@ var makeMediaGet2 = Effect.gen(function* () {
|
|
|
22
23
|
const headers = {
|
|
23
24
|
"cache-control": CACHE_CONTROL,
|
|
24
25
|
etag,
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
"content-disposition": disposition2(""),
|
|
27
|
+
"content-security-policy": CONTENT_SECURITY_POLICY2,
|
|
28
|
+
"x-content-type-options": "nosniff"
|
|
27
29
|
};
|
|
28
30
|
if (matchesIfNoneMatch(request.headers["if-none-match"], etag))
|
|
29
31
|
return HttpServerResponse.empty({ status: 304, headers });
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
awaitPlugins2,
|
|
3
3
|
response2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./request-site-gqq6kfhc.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./request-site-r5696se6.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/agent.ts
|
|
10
10
|
import { Agent } from "@opencode/core/agent";
|
|
@@ -2,18 +2,18 @@ import {
|
|
|
2
2
|
locationErrors2,
|
|
3
3
|
response2,
|
|
4
4
|
requestRef2
|
|
5
|
-
} from "./
|
|
5
|
+
} from "./request-site-gqq6kfhc.js";
|
|
6
6
|
import {
|
|
7
7
|
Api2
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./request-site-r5696se6.js";
|
|
9
9
|
import {
|
|
10
10
|
CorsConfig2,
|
|
11
11
|
isAllowedRequestOrigin2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./request-site-q4bn6dy8.js";
|
|
13
13
|
import {
|
|
14
14
|
runPtySocket2,
|
|
15
15
|
holdLocation2
|
|
16
|
-
} from "./
|
|
16
|
+
} from "./request-site-q187pxxd.js";
|
|
17
17
|
|
|
18
18
|
// src/handlers/mcp.ts
|
|
19
19
|
import { Location } from "@opencode/core/location";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-site-r5696se6.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
5
|
+
Service4,
|
|
6
6
|
frame2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./request-site-wecgp61r.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* Service4;
|
|
16
16
|
return handlers.handleRaw("event.subscribe", (ctx) => Effect.gen(function* () {
|
|
17
17
|
const connected = {
|
|
18
18
|
id: Event.ID.create(),
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-site-r5696se6.js";
|
|
4
4
|
import {
|
|
5
5
|
SESSION_TTL_SECONDS2,
|
|
6
6
|
Config2,
|
|
7
7
|
issueSession2,
|
|
8
8
|
sessionCookieName2
|
|
9
|
-
} from "./
|
|
10
|
-
import {
|
|
11
|
-
Service4
|
|
12
|
-
} from "./api-7dtbad8d.js";
|
|
9
|
+
} from "./request-site-j4at0y5c.js";
|
|
13
10
|
import {
|
|
14
11
|
Service3
|
|
15
|
-
} from "./
|
|
12
|
+
} from "./request-site-5pdfedjd.js";
|
|
13
|
+
import {
|
|
14
|
+
Service2
|
|
15
|
+
} from "./request-site-kqr36gas.js";
|
|
16
16
|
|
|
17
17
|
// src/handlers/server.ts
|
|
18
18
|
import { hostname } from "node:os";
|
|
@@ -22,10 +22,10 @@ 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* Service2;
|
|
26
26
|
const auth = yield* Config2;
|
|
27
27
|
return handlers.handle("server.info", () => Effect.gen(function* () {
|
|
28
|
-
const info = yield*
|
|
28
|
+
const info = yield* Service3;
|
|
29
29
|
return {
|
|
30
30
|
version: info.app.version ?? "unknown",
|
|
31
31
|
pid: process.pid ?? 0,
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isAllowedRequestOrigin2
|
|
3
|
+
} from "./request-site-q4bn6dy8.js";
|
|
4
|
+
import {
|
|
5
|
+
__export
|
|
6
|
+
} from "./request-site-9rqn6x4v.js";
|
|
7
|
+
|
|
8
|
+
// src/request-site.ts
|
|
9
|
+
var exports_request_site = {};
|
|
10
|
+
__export(exports_request_site, {
|
|
11
|
+
RequestSite: () => exports_request_site,
|
|
12
|
+
middleware: () => middleware2,
|
|
13
|
+
rejected: () => rejected2
|
|
14
|
+
});
|
|
15
|
+
import { Effect } from "effect";
|
|
16
|
+
import { HttpMiddleware, HttpServerRequest, HttpServerResponse } from "effect/http";
|
|
17
|
+
var ARTIFACT_VIEW = /^\/api\/experimental\/artifacts\/[^/]+\/view(\/|$)/;
|
|
18
|
+
function rejected2(request, options) {
|
|
19
|
+
const site = request.headers["sec-fetch-site"];
|
|
20
|
+
if (site !== "cross-site" && site !== "same-site")
|
|
21
|
+
return false;
|
|
22
|
+
const pathname = new URL(request.url, "http://localhost").pathname;
|
|
23
|
+
if (pathname !== "/api" && !pathname.startsWith("/api/"))
|
|
24
|
+
return false;
|
|
25
|
+
if (ARTIFACT_VIEW.test(pathname))
|
|
26
|
+
return false;
|
|
27
|
+
if (request.headers["sec-fetch-mode"] === "navigate")
|
|
28
|
+
return true;
|
|
29
|
+
const origin = request.headers.origin;
|
|
30
|
+
return origin !== undefined && !isAllowedRequestOrigin2(origin, request.headers.host, options);
|
|
31
|
+
}
|
|
32
|
+
var middleware2 = (options) => HttpMiddleware.make((app) => Effect.gen(function* () {
|
|
33
|
+
const request = yield* HttpServerRequest.HttpServerRequest;
|
|
34
|
+
if (!rejected2(request, options))
|
|
35
|
+
return yield* app;
|
|
36
|
+
return HttpServerResponse.jsonUnsafe({ _tag: "ForbiddenError", message: "Cross-site requests to the API are not allowed" }, { status: 403 });
|
|
37
|
+
}));
|
|
38
|
+
|
|
39
|
+
export { rejected2, middleware2, exports_request_site };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
requestRef2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-site-gqq6kfhc.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./request-site-r5696se6.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/debug.ts
|
|
9
9
|
import { LocationServiceMap } from "@opencode/core/location-service-map";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__export
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./request-site-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: () => Service2,
|
|
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 Service2 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(Service2, Effect.gen(function* () {
|
|
21
21
|
const cache = yield* Cache.make({ capacity: 1000, lookup: noLookup, timeToLive: TTL });
|
|
22
|
-
return
|
|
22
|
+
return Service2.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: Service2, layer, deps: [] });
|
|
34
34
|
|
|
35
|
-
export {
|
|
35
|
+
export { Service2, node2, exports_pairing };
|