@opencode/server 0.0.0-dev-904 → 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.
Files changed (120) hide show
  1. package/dist/api.js +5 -5
  2. package/dist/auth.js +1 -1
  3. package/dist/chunks/{api-059rbh9c.js → auth-059rbh9c.js} +1 -1
  4. package/dist/chunks/{api-0e4fm4yw.js → auth-0e4fm4yw.js} +1 -1
  5. package/dist/chunks/{api-2835150m.js → auth-2835150m.js} +2 -2
  6. package/dist/chunks/{api-n8pb21j2.js → auth-2ad4fepm.js} +35 -35
  7. package/dist/chunks/{api-370cpmna.js → auth-370cpmna.js} +2 -2
  8. package/dist/chunks/{api-39nnfjx1.js → auth-39nnfjx1.js} +1 -1
  9. package/dist/chunks/{api-50xc6x42.js → auth-50xc6x42.js} +3 -3
  10. package/dist/chunks/{api-57m9rtnr.js → auth-57m9rtnr.js} +2 -2
  11. package/dist/chunks/{api-5afgx201.js → auth-5afgx201.js} +2 -2
  12. package/dist/chunks/{api-7dtbad8d.js → auth-5pdfedjd.js} +7 -7
  13. package/dist/chunks/{api-5z5anmwp.js → auth-5z5anmwp.js} +2 -2
  14. package/dist/chunks/{api-5553qfcy.js → auth-6jff1f2v.js} +3 -3
  15. package/dist/chunks/{api-74kxthdf.js → auth-74kxthdf.js} +1 -1
  16. package/dist/chunks/{api-78rcgzsr.js → auth-78rcgzsr.js} +1 -1
  17. package/dist/chunks/{api-7b9xm1qg.js → auth-7b9xm1qg.js} +1 -1
  18. package/dist/chunks/{api-7cd61xtm.js → auth-7cd61xtm.js} +2 -2
  19. package/dist/chunks/{api-z9kgby92.js → auth-7nzhhyke.js} +4 -4
  20. package/dist/chunks/{api-7tewdwsb.js → auth-7tewdwsb.js} +2 -2
  21. package/dist/chunks/{api-7x1re4zg.js → auth-7x1re4zg.js} +2 -2
  22. package/dist/chunks/{api-y99wfvnx.js → auth-bwn6e46q.js} +13 -13
  23. package/dist/chunks/{api-n321d8vm.js → auth-djr0jy89.js} +8 -6
  24. package/dist/chunks/{api-p94f9pb0.js → auth-dyx8exgj.js} +8 -5
  25. package/dist/chunks/{api-f4exzdsf.js → auth-f4exzdsf.js} +2 -2
  26. package/dist/chunks/{api-4z8yg1dv.js → auth-fbdv47za.js} +4 -4
  27. package/dist/chunks/{api-k8y9dxyq.js → auth-fszbw5sk.js} +4 -4
  28. package/dist/chunks/{api-gk0yxcp6.js → auth-gk0yxcp6.js} +1 -1
  29. package/dist/chunks/{api-gqq6kfhc.js → auth-gqq6kfhc.js} +1 -1
  30. package/dist/chunks/{api-6sada178.js → auth-gzcpr2d6.js} +8 -8
  31. package/dist/chunks/{api-j4at0y5c.js → auth-j4at0y5c.js} +1 -1
  32. package/dist/chunks/{api-jc2vwkyw.js → auth-jc2vwkyw.js} +2 -2
  33. package/dist/chunks/{api-2j32qzdw.js → auth-keyqp3tn.js} +7 -7
  34. package/dist/chunks/{api-w9jcwh65.js → auth-kqr36gas.js} +7 -7
  35. package/dist/chunks/auth-myqk22k5.js +39 -0
  36. package/dist/chunks/{api-r2veymj8.js → auth-qpzkqgwj.js} +4 -4
  37. package/dist/chunks/{api-r5696se6.js → auth-r5696se6.js} +3 -3
  38. package/dist/chunks/{api-rxyx8sa0.js → auth-rxyx8sa0.js} +2 -2
  39. package/dist/chunks/{api-skcryrty.js → auth-skcryrty.js} +2 -2
  40. package/dist/chunks/{api-sqxx1p54.js → auth-sqxx1p54.js} +2 -2
  41. package/dist/chunks/auth-t32e1bbt.js +32 -0
  42. package/dist/chunks/{api-vtfzy3at.js → auth-vtfzy3at.js} +2 -2
  43. package/dist/chunks/{api-vvp99hc9.js → auth-vvp99hc9.js} +1 -1
  44. package/dist/chunks/{api-w83vdpy9.js → auth-w83vdpy9.js} +2 -2
  45. package/dist/chunks/{api-fvpjvjpp.js → auth-wecgp61r.js} +7 -7
  46. package/dist/chunks/{api-wqv43pj9.js → auth-wqv43pj9.js} +2 -2
  47. package/dist/chunks/{api-xbqm7mpj.js → auth-xbqm7mpj.js} +2 -2
  48. package/dist/chunks/{api-xpg37vzc.js → auth-xpg37vzc.js} +2 -2
  49. package/dist/chunks/{api-yet0vexm.js → auth-yet0vexm.js} +1 -1
  50. package/dist/chunks/{api-zds85vps.js → auth-zds85vps.js} +1 -1
  51. package/dist/chunks/{api-0pbbhyf6.js → auth-zgvwy66h.js} +9 -6
  52. package/dist/chunks/{api-zmgfywqd.js → auth-zmgfywqd.js} +1 -1
  53. package/dist/chunks/{api-zyntahe8.js → auth-zyntahe8.js} +1 -1
  54. package/dist/content-headers.d.ts +13 -0
  55. package/dist/content-headers.js +12 -0
  56. package/dist/cors.js +1 -1
  57. package/dist/event-feed.js +5 -5
  58. package/dist/fetch.js +56 -54
  59. package/dist/handlers/agent.js +6 -6
  60. package/dist/handlers/artifact.js +3 -3
  61. package/dist/handlers/command.js +6 -6
  62. package/dist/handlers/config.js +6 -6
  63. package/dist/handlers/credential.js +7 -7
  64. package/dist/handlers/debug.js +6 -6
  65. package/dist/handlers/event.js +7 -7
  66. package/dist/handlers/form.js +6 -6
  67. package/dist/handlers/fs.js +7 -6
  68. package/dist/handlers/generate.js +6 -6
  69. package/dist/handlers/integration.js +6 -6
  70. package/dist/handlers/job.js +2 -2
  71. package/dist/handlers/location.js +6 -6
  72. package/dist/handlers/mcp.js +8 -8
  73. package/dist/handlers/media.js +2 -1
  74. package/dist/handlers/message.js +7 -7
  75. package/dist/handlers/migration.js +6 -6
  76. package/dist/handlers/model.js +6 -6
  77. package/dist/handlers/permission.js +6 -6
  78. package/dist/handlers/persistent-pty.js +13 -12
  79. package/dist/handlers/plugin.js +6 -6
  80. package/dist/handlers/project.js +6 -6
  81. package/dist/handlers/provider.js +6 -6
  82. package/dist/handlers/pty-socket.js +1 -1
  83. package/dist/handlers/pty.js +8 -8
  84. package/dist/handlers/reference.js +6 -6
  85. package/dist/handlers/rpc.js +6 -6
  86. package/dist/handlers/schedule.js +2 -2
  87. package/dist/handlers/server.js +9 -9
  88. package/dist/handlers/session-error.js +1 -1
  89. package/dist/handlers/session.js +7 -7
  90. package/dist/handlers/shell.js +6 -6
  91. package/dist/handlers/skill.js +6 -6
  92. package/dist/handlers/usage.js +6 -6
  93. package/dist/handlers/vcs.js +6 -6
  94. package/dist/handlers/voice.js +6 -6
  95. package/dist/handlers/websearch.js +6 -6
  96. package/dist/handlers/worktree.js +6 -6
  97. package/dist/handlers.js +50 -49
  98. package/dist/location.js +2 -2
  99. package/dist/media-uri.js +1 -1
  100. package/dist/middleware/authorization.js +2 -2
  101. package/dist/middleware/form-location.js +3 -3
  102. package/dist/middleware/schema-error.js +1 -1
  103. package/dist/middleware/session-location.js +3 -3
  104. package/dist/pairing.js +3 -3
  105. package/dist/process.js +60 -56
  106. package/dist/request-site.d.ts +11 -0
  107. package/dist/request-site.js +11 -0
  108. package/dist/request-tracing.js +1 -1
  109. package/dist/routes.js +53 -52
  110. package/dist/server-info.js +5 -5
  111. package/dist/service-status.js +1 -1
  112. package/dist/workerd.js +57 -55
  113. package/package.json +8 -8
  114. /package/dist/chunks/{api-9rqn6x4v.js → auth-9rqn6x4v.js} +0 -0
  115. /package/dist/chunks/{api-bd8755ek.js → auth-bd8755ek.js} +0 -0
  116. /package/dist/chunks/{api-q187pxxd.js → auth-q187pxxd.js} +0 -0
  117. /package/dist/chunks/{api-q4bn6dy8.js → auth-q4bn6dy8.js} +0 -0
  118. /package/dist/chunks/{api-smaf4a18.js → auth-smaf4a18.js} +0 -0
  119. /package/dist/chunks/{api-xthc02cw.js → auth-xthc02cw.js} +0 -0
  120. /package/dist/chunks/{api-yc7nft6q.js → auth-yc7nft6q.js} +0 -0
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  Api2
3
- } from "./api-r5696se6.js";
3
+ } from "./auth-r5696se6.js";
4
4
  import {
5
5
  SESSION_TTL_SECONDS2,
6
6
  Config2,
7
7
  issueSession2,
8
8
  sessionCookieName2
9
- } from "./api-j4at0y5c.js";
10
- import {
11
- Service4
12
- } from "./api-7dtbad8d.js";
9
+ } from "./auth-j4at0y5c.js";
13
10
  import {
14
11
  Service3
15
- } from "./api-w9jcwh65.js";
12
+ } from "./auth-5pdfedjd.js";
13
+ import {
14
+ Service2
15
+ } from "./auth-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* Service3;
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* Service4;
28
+ const info = yield* Service3;
29
29
  return {
30
30
  version: info.app.version ?? "unknown",
31
31
  pid: process.pid ?? 0,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __export
3
- } from "./api-9rqn6x4v.js";
3
+ } from "./auth-9rqn6x4v.js";
4
4
 
5
5
  // src/auth.ts
6
6
  var exports_auth = {};
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  requestRef2
3
- } from "./api-gqq6kfhc.js";
3
+ } from "./auth-gqq6kfhc.js";
4
4
  import {
5
5
  Api2
6
- } from "./api-r5696se6.js";
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 "./api-r5696se6.js";
3
+ } from "./auth-r5696se6.js";
4
4
  import {
5
5
  CorsConfig2,
6
6
  isAllowedRequestOrigin2
7
- } from "./api-q4bn6dy8.js";
7
+ } from "./auth-q4bn6dy8.js";
8
8
  import {
9
9
  makeArtifact2
10
- } from "./api-57m9rtnr.js";
10
+ } from "./auth-57m9rtnr.js";
11
11
  import {
12
12
  makeJob2
13
- } from "./api-78rcgzsr.js";
13
+ } from "./auth-78rcgzsr.js";
14
14
  import {
15
15
  makeMediaGet2
16
- } from "./api-n321d8vm.js";
16
+ } from "./auth-djr0jy89.js";
17
17
  import {
18
18
  runPtySocket2
19
- } from "./api-q187pxxd.js";
19
+ } from "./auth-q187pxxd.js";
20
20
  import {
21
21
  makeSchedule2
22
- } from "./api-059rbh9c.js";
22
+ } from "./auth-059rbh9c.js";
23
23
 
24
24
  // src/handlers/persistent-pty.ts
25
25
  import { PersistentPty } from "@opencode/core/persistent-pty";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  __export
3
- } from "./api-9rqn6x4v.js";
3
+ } from "./auth-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: () => Service3,
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 Service3 extends Context.Service()("@opencode/ServerPairing") {
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(Service3, Effect.gen(function* () {
20
+ var layer = Layer.effect(Service2, Effect.gen(function* () {
21
21
  const cache = yield* Cache.make({ capacity: 1000, lookup: noLookup, timeToLive: TTL });
22
- return Service3.of({
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: Service3, layer, deps: [] });
33
+ var node2 = makeGlobalNode({ service: Service2, layer, deps: [] });
34
34
 
35
- export { Service3, node2, exports_pairing };
35
+ export { Service2, node2, exports_pairing };
@@ -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 "./api-gqq6kfhc.js";
5
+ } from "./auth-gqq6kfhc.js";
6
6
  import {
7
7
  Api2
8
- } from "./api-r5696se6.js";
8
+ } from "./auth-r5696se6.js";
9
9
  import {
10
10
  CorsConfig2,
11
11
  isAllowedRequestOrigin2
12
- } from "./api-q4bn6dy8.js";
12
+ } from "./auth-q4bn6dy8.js";
13
13
  import {
14
14
  runPtySocket2,
15
15
  holdLocation2
16
- } from "./api-q187pxxd.js";
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 "./api-gqq6kfhc.js";
3
+ } from "./auth-gqq6kfhc.js";
4
4
  import {
5
5
  FormLocationMiddleware2
6
- } from "./api-gk0yxcp6.js";
6
+ } from "./auth-gk0yxcp6.js";
7
7
  import {
8
8
  SessionLocationMiddleware2
9
- } from "./api-yet0vexm.js";
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 "./api-gqq6kfhc.js";
3
+ } from "./auth-gqq6kfhc.js";
4
4
  import {
5
5
  Api2
6
- } from "./api-r5696se6.js";
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 "./api-gqq6kfhc.js";
3
+ } from "./auth-gqq6kfhc.js";
4
4
  import {
5
5
  Api2
6
- } from "./api-r5696se6.js";
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 "./api-gqq6kfhc.js";
3
+ } from "./auth-gqq6kfhc.js";
4
4
  import {
5
5
  Api2
6
- } from "./api-r5696se6.js";
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 "./api-gqq6kfhc.js";
4
+ } from "./auth-gqq6kfhc.js";
5
5
  import {
6
6
  Api2
7
- } from "./api-r5696se6.js";
7
+ } from "./auth-r5696se6.js";
8
8
 
9
9
  // src/handlers/provider.ts
10
10
  import { Provider } from "@opencode/core/provider";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Api2
3
- } from "./api-r5696se6.js";
3
+ } from "./auth-r5696se6.js";
4
4
 
5
5
  // src/handlers/migration.ts
6
6
  import { V1Migration } from "@opencode/core/database/v1-migration";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  Api2
3
- } from "./api-r5696se6.js";
3
+ } from "./auth-r5696se6.js";
4
4
  import {
5
5
  requireConnectable2
6
- } from "./api-5afgx201.js";
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 "./api-9rqn6x4v.js";
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: () => Service2,
10
+ Service: () => Service4,
11
11
  SubscriberCapacity: () => SubscriberCapacity2,
12
12
  SubscriberOverflowError: () => SubscriberOverflowError2,
13
13
  frame: () => frame2,
14
- layer: () => layer2,
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 Service2 extends Context.Service()("@opencode/server/EventFeed") {
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 Service2.of({
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 layer2 = Layer.effect(Service2, Effect.gen(function* () {
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, Service2, frame2, make4, layer2, exports_event_feed };
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 "./api-gqq6kfhc.js";
4
+ } from "./auth-gqq6kfhc.js";
5
5
  import {
6
6
  Api2
7
- } from "./api-r5696se6.js";
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 "./api-gqq6kfhc.js";
3
+ } from "./auth-gqq6kfhc.js";
4
4
  import {
5
5
  Api2
6
- } from "./api-r5696se6.js";
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 "./api-gqq6kfhc.js";
3
+ } from "./auth-gqq6kfhc.js";
4
4
  import {
5
5
  Api2
6
- } from "./api-r5696se6.js";
6
+ } from "./auth-r5696se6.js";
7
7
 
8
8
  // src/handlers/command.ts
9
9
  import { Command } from "@opencode/core/command";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  locationErrors2,
3
3
  sessionInfo2
4
- } from "./api-gqq6kfhc.js";
4
+ } from "./auth-gqq6kfhc.js";
5
5
 
6
6
  // src/middleware/session-location.ts
7
7
  import { Instance } from "@opencode/core/instance/service";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Api2
3
- } from "./api-r5696se6.js";
3
+ } from "./auth-r5696se6.js";
4
4
 
5
5
  // src/handlers/worktree.ts
6
6
  import { Git } from "@opencode/core/git";
@@ -1,9 +1,12 @@
1
1
  import {
2
2
  response2
3
- } from "./api-gqq6kfhc.js";
3
+ } from "./auth-gqq6kfhc.js";
4
4
  import {
5
5
  Api2
6
- } from "./api-r5696se6.js";
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
  });
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Api2
3
- } from "./api-r5696se6.js";
3
+ } from "./auth-r5696se6.js";
4
4
 
5
5
  // src/handlers/project.ts
6
6
  import { Project } from "@opencode/core/project";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Api2
3
- } from "./api-r5696se6.js";
3
+ } from "./auth-r5696se6.js";
4
4
 
5
5
  // src/handlers/rpc.ts
6
6
  import { Rpc } from "@opencode/core/rpc";
@@ -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
@@ -2,7 +2,7 @@ import {
2
2
  CorsConfig2,
3
3
  isAllowedCorsOrigin2,
4
4
  isAllowedRequestOrigin2
5
- } from "./chunks/api-q4bn6dy8.js";
5
+ } from "./chunks/auth-q4bn6dy8.js";
6
6
  export {
7
7
  CorsConfig2 as CorsConfig,
8
8
  isAllowedCorsOrigin2 as isAllowedCorsOrigin,
@@ -2,19 +2,19 @@ import {
2
2
  SubscriberCapacity2,
3
3
  SubscriberOverflowError2,
4
4
  EncodingError2,
5
- Service2,
5
+ Service4,
6
6
  frame2,
7
7
  make4,
8
- layer2,
8
+ layer4,
9
9
  exports_event_feed
10
- } from "./chunks/api-fvpjvjpp.js";
10
+ } from "./chunks/auth-wecgp61r.js";
11
11
  export {
12
12
  EncodingError2 as EncodingError,
13
13
  exports_event_feed as EventFeed,
14
- Service2 as Service,
14
+ Service4 as Service,
15
15
  SubscriberCapacity2 as SubscriberCapacity,
16
16
  SubscriberOverflowError2 as SubscriberOverflowError,
17
17
  frame2 as frame,
18
- layer2 as layer,
18
+ layer4 as layer,
19
19
  make4 as make
20
20
  };