@opencode/server 0.0.0-dev-900 → 0.0.0-dev-913
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/{request-tracing-059rbh9c.js → auth-059rbh9c.js} +1 -1
- package/dist/chunks/{request-tracing-g3qjtfrt.js → auth-0e4fm4yw.js} +1 -1
- package/dist/chunks/{request-tracing-07m4906f.js → auth-2835150m.js} +2 -2
- package/dist/chunks/{request-tracing-4xgnntbq.js → auth-2ad4fepm.js} +35 -35
- package/dist/chunks/{request-tracing-w3zqyffx.js → auth-370cpmna.js} +2 -2
- package/dist/chunks/{request-tracing-e6e4kz0w.js → auth-39nnfjx1.js} +4 -4
- package/dist/chunks/{request-tracing-wrt9gvm9.js → auth-50xc6x42.js} +3 -3
- package/dist/chunks/{request-tracing-02a60aws.js → auth-57m9rtnr.js} +2 -2
- package/dist/chunks/{request-tracing-znp586sh.js → auth-5afgx201.js} +2 -2
- package/dist/chunks/{request-tracing-7dtbad8d.js → auth-5pdfedjd.js} +7 -7
- package/dist/chunks/{request-tracing-wxp1se1k.js → auth-5z5anmwp.js} +2 -2
- package/dist/chunks/{request-tracing-w841zcb3.js → auth-6jff1f2v.js} +3 -3
- package/dist/chunks/{request-tracing-dpm5c7yf.js → auth-74kxthdf.js} +1 -1
- package/dist/chunks/{request-tracing-78rcgzsr.js → auth-78rcgzsr.js} +1 -1
- package/dist/chunks/{request-tracing-7b9xm1qg.js → auth-7b9xm1qg.js} +1 -1
- package/dist/chunks/{request-tracing-4jn53ynt.js → auth-7cd61xtm.js} +2 -2
- package/dist/chunks/{request-tracing-pqe2eqpc.js → auth-7nzhhyke.js} +4 -4
- package/dist/chunks/{request-tracing-y91dtbe4.js → auth-7tewdwsb.js} +2 -2
- package/dist/chunks/{request-tracing-jyk0ayfs.js → auth-7x1re4zg.js} +2 -2
- package/dist/chunks/{request-tracing-zh4ec038.js → auth-bwn6e46q.js} +15 -15
- package/dist/chunks/{request-tracing-n321d8vm.js → auth-djr0jy89.js} +8 -6
- package/dist/chunks/{request-tracing-7ajcfseb.js → auth-dyx8exgj.js} +11 -8
- package/dist/chunks/{request-tracing-pj735m3z.js → auth-f4exzdsf.js} +2 -2
- package/dist/chunks/{request-tracing-mw4drtrt.js → auth-fbdv47za.js} +4 -4
- package/dist/chunks/{request-tracing-tvjfnp7w.js → auth-fszbw5sk.js} +4 -4
- package/dist/chunks/{request-tracing-ddnay6e1.js → auth-gk0yxcp6.js} +1 -1
- package/dist/chunks/{request-tracing-gymtz25n.js → auth-gqq6kfhc.js} +3 -3
- package/dist/chunks/{request-tracing-h57sp4g8.js → auth-gzcpr2d6.js} +6 -6
- package/dist/chunks/{request-tracing-j4at0y5c.js → auth-j4at0y5c.js} +1 -1
- package/dist/chunks/{request-tracing-txb93cxt.js → auth-jc2vwkyw.js} +2 -2
- package/dist/chunks/{request-tracing-pgmnkfc6.js → auth-keyqp3tn.js} +7 -7
- package/dist/chunks/{request-tracing-kqr36gas.js → auth-kqr36gas.js} +1 -1
- package/dist/chunks/auth-myqk22k5.js +39 -0
- package/dist/chunks/{request-tracing-yzr5n1t3.js → auth-qpzkqgwj.js} +4 -4
- package/dist/chunks/{request-tracing-3j7dhvn1.js → auth-r5696se6.js} +3 -3
- package/dist/chunks/{request-tracing-5rj5qfk5.js → auth-rxyx8sa0.js} +2 -2
- package/dist/chunks/{request-tracing-6h0nmx1z.js → auth-skcryrty.js} +2 -2
- package/dist/chunks/{request-tracing-8jrvh9sp.js → auth-sqxx1p54.js} +2 -2
- package/dist/chunks/auth-t32e1bbt.js +32 -0
- package/dist/chunks/{request-tracing-rhyt0p0x.js → auth-vtfzy3at.js} +2 -2
- package/dist/chunks/{request-tracing-9w99npj6.js → auth-vvp99hc9.js} +1 -1
- package/dist/chunks/{request-tracing-egtk7es2.js → auth-w83vdpy9.js} +2 -2
- package/dist/chunks/{request-tracing-qfyg9gb7.js → auth-wecgp61r.js} +7 -7
- package/dist/chunks/{request-tracing-y088ynta.js → auth-wqv43pj9.js} +2 -2
- package/dist/chunks/{request-tracing-bstqs6fb.js → auth-xbqm7mpj.js} +2 -2
- package/dist/chunks/{request-tracing-yqy45vey.js → auth-xpg37vzc.js} +2 -2
- package/dist/chunks/{request-tracing-x74w7e1f.js → auth-yet0vexm.js} +1 -1
- package/dist/chunks/{request-tracing-dewwmefa.js → auth-zds85vps.js} +1 -1
- package/dist/chunks/{request-tracing-9grgz57j.js → auth-zgvwy66h.js} +9 -6
- package/dist/chunks/{request-tracing-0tg0yqad.js → auth-zmgfywqd.js} +1 -1
- package/dist/chunks/{request-tracing-4k36hr0g.js → auth-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 +58 -56
- 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 +4 -4
- 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 +1 -1
- package/dist/process.js +62 -58
- 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 +3 -3
- package/dist/workerd.js +59 -57
- package/package.json +8 -8
- /package/dist/chunks/{request-tracing-9rqn6x4v.js → auth-9rqn6x4v.js} +0 -0
- /package/dist/chunks/{request-tracing-bd8755ek.js → auth-bd8755ek.js} +0 -0
- /package/dist/chunks/{request-tracing-q187pxxd.js → auth-q187pxxd.js} +0 -0
- /package/dist/chunks/{request-tracing-q4bn6dy8.js → auth-q4bn6dy8.js} +0 -0
- /package/dist/chunks/{request-tracing-smaf4a18.js → auth-smaf4a18.js} +0 -0
- /package/dist/chunks/{request-tracing-xthc02cw.js → auth-xthc02cw.js} +0 -0
- /package/dist/chunks/{request-tracing-yc7nft6q.js → auth-yc7nft6q.js} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
missingSession2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./auth-smaf4a18.js";
|
|
4
4
|
|
|
5
5
|
// src/location.ts
|
|
6
6
|
import { FileSystem } from "@opencode/core/filesystem";
|
|
@@ -59,7 +59,7 @@ function decode(input) {
|
|
|
59
59
|
return input;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
var
|
|
62
|
+
var layer3 = 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 layer2 = 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, layer3 };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./auth-r5696se6.js";
|
|
4
4
|
import {
|
|
5
5
|
SESSION_TTL_SECONDS2,
|
|
6
6
|
Config2,
|
|
7
7
|
issueSession2,
|
|
8
8
|
sessionCookieName2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./auth-j4at0y5c.js";
|
|
10
10
|
import {
|
|
11
|
-
|
|
12
|
-
} from "./
|
|
11
|
+
Service3
|
|
12
|
+
} from "./auth-5pdfedjd.js";
|
|
13
13
|
import {
|
|
14
14
|
Service2
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./auth-kqr36gas.js";
|
|
16
16
|
|
|
17
17
|
// src/handlers/server.ts
|
|
18
18
|
import { hostname } from "node:os";
|
|
@@ -25,7 +25,7 @@ var ServerHandler2 = HttpApiBuilder.group(Api2, "server.server", (handlers) => E
|
|
|
25
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,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
requestRef2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./auth-gqq6kfhc.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./auth-r5696se6.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/debug.ts
|
|
9
9
|
import { LocationServiceMap } from "@opencode/core/location-service-map";
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./auth-r5696se6.js";
|
|
4
4
|
import {
|
|
5
5
|
CorsConfig2,
|
|
6
6
|
isAllowedRequestOrigin2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./auth-q4bn6dy8.js";
|
|
8
8
|
import {
|
|
9
9
|
makeArtifact2
|
|
10
|
-
} from "./
|
|
10
|
+
} from "./auth-57m9rtnr.js";
|
|
11
11
|
import {
|
|
12
12
|
makeJob2
|
|
13
|
-
} from "./
|
|
13
|
+
} from "./auth-78rcgzsr.js";
|
|
14
14
|
import {
|
|
15
15
|
makeMediaGet2
|
|
16
|
-
} from "./
|
|
16
|
+
} from "./auth-djr0jy89.js";
|
|
17
17
|
import {
|
|
18
18
|
runPtySocket2
|
|
19
|
-
} from "./
|
|
19
|
+
} from "./auth-q187pxxd.js";
|
|
20
20
|
import {
|
|
21
21
|
makeSchedule2
|
|
22
|
-
} from "./
|
|
22
|
+
} from "./auth-059rbh9c.js";
|
|
23
23
|
|
|
24
24
|
// src/handlers/persistent-pty.ts
|
|
25
25
|
import { PersistentPty } from "@opencode/core/persistent-pty";
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isAllowedRequestOrigin2
|
|
3
|
+
} from "./auth-q4bn6dy8.js";
|
|
4
|
+
import {
|
|
5
|
+
__export
|
|
6
|
+
} from "./auth-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 };
|
|
@@ -2,18 +2,18 @@ import {
|
|
|
2
2
|
locationErrors2,
|
|
3
3
|
response2,
|
|
4
4
|
requestRef2
|
|
5
|
-
} from "./
|
|
5
|
+
} from "./auth-gqq6kfhc.js";
|
|
6
6
|
import {
|
|
7
7
|
Api2
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./auth-r5696se6.js";
|
|
9
9
|
import {
|
|
10
10
|
CorsConfig2,
|
|
11
11
|
isAllowedRequestOrigin2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./auth-q4bn6dy8.js";
|
|
13
13
|
import {
|
|
14
14
|
runPtySocket2,
|
|
15
15
|
holdLocation2
|
|
16
|
-
} from "./
|
|
16
|
+
} from "./auth-q187pxxd.js";
|
|
17
17
|
|
|
18
18
|
// src/handlers/pty.ts
|
|
19
19
|
import { Pty } from "@opencode/core/pty";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LocationMiddleware2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./auth-gqq6kfhc.js";
|
|
4
4
|
import {
|
|
5
5
|
FormLocationMiddleware2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./auth-gk0yxcp6.js";
|
|
7
7
|
import {
|
|
8
8
|
SessionLocationMiddleware2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./auth-yet0vexm.js";
|
|
10
10
|
|
|
11
11
|
// src/api.ts
|
|
12
12
|
import { makeDefaultApi } from "@opencode/protocol/api";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./auth-gqq6kfhc.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./auth-r5696se6.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/shell.ts
|
|
9
9
|
import { Shell } from "@opencode/core/shell";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./auth-gqq6kfhc.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./auth-r5696se6.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/reference.ts
|
|
9
9
|
import { Reference } from "@opencode/core/reference";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./auth-gqq6kfhc.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./auth-r5696se6.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/plugin.ts
|
|
9
9
|
import { Plugin } from "@opencode/core/plugin";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__export
|
|
3
|
+
} from "./auth-9rqn6x4v.js";
|
|
4
|
+
|
|
5
|
+
// src/content-headers.ts
|
|
6
|
+
var exports_content_headers = {};
|
|
7
|
+
__export(exports_content_headers, {
|
|
8
|
+
CONTENT_SECURITY_POLICY: () => CONTENT_SECURITY_POLICY2,
|
|
9
|
+
ContentHeaders: () => exports_content_headers,
|
|
10
|
+
disposition: () => disposition2,
|
|
11
|
+
download: () => download2
|
|
12
|
+
});
|
|
13
|
+
import path from "path";
|
|
14
|
+
var CONTENT_SECURITY_POLICY2 = "default-src 'none'; img-src 'self'; media-src 'self'; sandbox";
|
|
15
|
+
var TEXT_TYPE = "text/plain; charset=utf-8";
|
|
16
|
+
function download2(input) {
|
|
17
|
+
return {
|
|
18
|
+
"content-type": /^(text\/html|text\/javascript|application\/(x-)?javascript)\b|[/+]xml\b/i.test(input.mime) ? TEXT_TYPE : input.mime,
|
|
19
|
+
"content-disposition": disposition2(input.path === undefined ? "" : path.basename(input.path)),
|
|
20
|
+
"content-security-policy": CONTENT_SECURITY_POLICY2,
|
|
21
|
+
"x-content-type-options": "nosniff"
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function disposition2(name) {
|
|
25
|
+
if (name === "")
|
|
26
|
+
return "attachment";
|
|
27
|
+
const fallback = name.replace(/[^\x20-\x7e]|["\\%]/g, "_");
|
|
28
|
+
const encoded = encodeURIComponent(name).replace(/['()*]/g, (char) => `%${char.charCodeAt(0).toString(16).toUpperCase()}`);
|
|
29
|
+
return `attachment; filename="${fallback}"; filename*=UTF-8''${encoded}`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { CONTENT_SECURITY_POLICY2, download2, disposition2, exports_content_headers };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
awaitPlugins2,
|
|
3
3
|
response2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./auth-gqq6kfhc.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./auth-r5696se6.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/provider.ts
|
|
10
10
|
import { Provider } from "@opencode/core/provider";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./auth-r5696se6.js";
|
|
4
4
|
import {
|
|
5
5
|
requireConnectable2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./auth-5afgx201.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/credential.ts
|
|
9
9
|
import { Credential } from "@opencode/core/credential";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__export
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./auth-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: () => Service4,
|
|
11
11
|
SubscriberCapacity: () => SubscriberCapacity2,
|
|
12
12
|
SubscriberOverflowError: () => SubscriberOverflowError2,
|
|
13
13
|
frame: () => frame2,
|
|
14
|
-
layer: () =>
|
|
14
|
+
layer: () => layer4,
|
|
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 Service4 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 Service4.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 layer4 = Layer.effect(Service4, 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, Service4, frame2, make4, layer4, exports_event_feed };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
locationErrors2,
|
|
3
3
|
awaitPlugins2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./auth-gqq6kfhc.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./auth-r5696se6.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/generate.ts
|
|
10
10
|
import { Generate } from "@opencode/core/generate";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./auth-gqq6kfhc.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./auth-r5696se6.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/skill.ts
|
|
9
9
|
import { Skill } from "@opencode/core/skill";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./auth-gqq6kfhc.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./auth-r5696se6.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/command.ts
|
|
9
9
|
import { Command } from "@opencode/core/command";
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./auth-gqq6kfhc.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./auth-r5696se6.js";
|
|
7
|
+
import {
|
|
8
|
+
download2
|
|
9
|
+
} from "./auth-t32e1bbt.js";
|
|
7
10
|
|
|
8
11
|
// src/handlers/fs.ts
|
|
9
12
|
import { FileSystem } from "@opencode/core/filesystem";
|
|
@@ -21,7 +24,7 @@ var FileSystemHandler2 = HttpApiBuilder.group(Api2, "server.fs", (handlers) => E
|
|
|
21
24
|
const path2 = yield* decodeRequestPath(ctx.request.url);
|
|
22
25
|
const fs = yield* FileSystem.Service;
|
|
23
26
|
const file = yield* fs.read({ path: path2 }).pipe(Effect.mapError((error) => new FileNotFoundError({ path: error.path, message: `File not found: ${error.path}` })));
|
|
24
|
-
return serveFile(ctx.request, file);
|
|
27
|
+
return serveFile(ctx.request, file, download2({ path: path2, mime: file.mime }));
|
|
25
28
|
})).handle("fs.list", (ctx) => response2(Effect.gen(function* () {
|
|
26
29
|
const fs = yield* FileSystem.Service;
|
|
27
30
|
return yield* fs.list(ctx.query).pipe(Effect.mapError((error) => new FileNotFoundError({ path: error.path, message: `Directory not found: ${error.path}` })));
|
|
@@ -54,7 +57,7 @@ function decodeRequestPath(url) {
|
|
|
54
57
|
catch: () => new FileNotFoundError({ path: raw, message: `File not found: ${raw}` })
|
|
55
58
|
});
|
|
56
59
|
}
|
|
57
|
-
function serveFile(request, file) {
|
|
60
|
+
function serveFile(request, file, content) {
|
|
58
61
|
const etag = `W/"${file.size.toString(16)}-${Option.match(file.mtime, {
|
|
59
62
|
onNone: () => "0",
|
|
60
63
|
onSome: (mtime) => mtime.getTime().toString(16)
|
|
@@ -66,7 +69,7 @@ function serveFile(request, file) {
|
|
|
66
69
|
...lastModified === undefined ? {} : { "last-modified": lastModified }
|
|
67
70
|
};
|
|
68
71
|
if (isNotModified(request, etag, lastModified))
|
|
69
|
-
return HttpServerResponse.empty({ status: 304, headers: validators });
|
|
72
|
+
return HttpServerResponse.empty({ status: 304, headers: { ...validators, ...content } });
|
|
70
73
|
const rangeHeader = request.method === "GET" ? request.headers["range"] : undefined;
|
|
71
74
|
const range = rangeHeader !== undefined && matchesIfRange(request.headers["if-range"], etag, lastModified) ? parseRange(rangeHeader, file.size) : undefined;
|
|
72
75
|
if (range === "unsatisfiable")
|
|
@@ -81,8 +84,8 @@ function serveFile(request, file) {
|
|
|
81
84
|
contentLength: length,
|
|
82
85
|
headers: {
|
|
83
86
|
...validators,
|
|
87
|
+
...content,
|
|
84
88
|
"accept-ranges": "bytes",
|
|
85
|
-
"content-type": file.mime,
|
|
86
89
|
...range === undefined ? {} : { "content-range": `bytes ${range.start}-${range.end}/${file.size}` }
|
|
87
90
|
}
|
|
88
91
|
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * as ContentHeaders from "./content-headers";
|
|
2
|
+
export declare const CONTENT_SECURITY_POLICY = "default-src 'none'; img-src 'self'; media-src 'self'; sandbox";
|
|
3
|
+
/** Headers for raw file bytes: always a download, never rendered as a page on the server's origin. */
|
|
4
|
+
export declare function download(input: {
|
|
5
|
+
readonly path?: string;
|
|
6
|
+
readonly mime: string;
|
|
7
|
+
}): {
|
|
8
|
+
"content-type": string;
|
|
9
|
+
"content-disposition": string;
|
|
10
|
+
"content-security-policy": string;
|
|
11
|
+
"x-content-type-options": string;
|
|
12
|
+
};
|
|
13
|
+
export declare function disposition(name: string): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CONTENT_SECURITY_POLICY2,
|
|
3
|
+
download2,
|
|
4
|
+
disposition2,
|
|
5
|
+
exports_content_headers
|
|
6
|
+
} from "./chunks/auth-t32e1bbt.js";
|
|
7
|
+
export {
|
|
8
|
+
CONTENT_SECURITY_POLICY2 as CONTENT_SECURITY_POLICY,
|
|
9
|
+
exports_content_headers as ContentHeaders,
|
|
10
|
+
disposition2 as disposition,
|
|
11
|
+
download2 as download
|
|
12
|
+
};
|
package/dist/cors.js
CHANGED
package/dist/event-feed.js
CHANGED
|
@@ -2,19 +2,19 @@ import {
|
|
|
2
2
|
SubscriberCapacity2,
|
|
3
3
|
SubscriberOverflowError2,
|
|
4
4
|
EncodingError2,
|
|
5
|
-
|
|
5
|
+
Service4,
|
|
6
6
|
frame2,
|
|
7
7
|
make4,
|
|
8
|
-
|
|
8
|
+
layer4,
|
|
9
9
|
exports_event_feed
|
|
10
|
-
} from "./chunks/
|
|
10
|
+
} from "./chunks/auth-wecgp61r.js";
|
|
11
11
|
export {
|
|
12
12
|
EncodingError2 as EncodingError,
|
|
13
13
|
exports_event_feed as EventFeed,
|
|
14
|
-
|
|
14
|
+
Service4 as Service,
|
|
15
15
|
SubscriberCapacity2 as SubscriberCapacity,
|
|
16
16
|
SubscriberOverflowError2 as SubscriberOverflowError,
|
|
17
17
|
frame2 as frame,
|
|
18
|
-
|
|
18
|
+
layer4 as layer,
|
|
19
19
|
make4 as make
|
|
20
20
|
};
|