@opencode/server 0.0.0-dev-21908 → 0.0.0-dev-21915

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 (112) hide show
  1. package/dist/api.js +5 -5
  2. package/dist/auth.js +1 -1
  3. package/dist/chunks/{cors-dk68ymtv.js → auth-05c5061t.js} +1 -1
  4. package/dist/chunks/{cors-9c4eyh8m.js → auth-0e81et3m.js} +3 -3
  5. package/dist/chunks/{cors-r6vmgwff.js → auth-0ey2b45p.js} +2 -2
  6. package/dist/chunks/{cors-2xcc0x05.js → auth-0n4tjm17.js} +1 -1
  7. package/dist/chunks/{cors-zjy4sw3d.js → auth-28ztppy1.js} +2 -2
  8. package/dist/chunks/{cors-0q7s66m2.js → auth-39nnfjx1.js} +4 -4
  9. package/dist/chunks/{cors-hyhbf37e.js → auth-3cea0hzg.js} +6 -6
  10. package/dist/chunks/{cors-wyzgdy3p.js → auth-4953j2kd.js} +8 -4
  11. package/dist/chunks/{cors-gqq6kfhc.js → auth-50bbk3b2.js} +3 -3
  12. package/dist/chunks/{cors-7b9xm1qg.js → auth-7b9xm1qg.js} +1 -1
  13. package/dist/chunks/{cors-j9gxd9me.js → auth-89egwzf3.js} +2 -2
  14. package/dist/chunks/{cors-ckkpcd9y.js → auth-8wqj6mpn.js} +4 -4
  15. package/dist/chunks/{cors-hax1v4bv.js → auth-9grnt8dc.js} +2 -2
  16. package/dist/chunks/{cors-yet0vexm.js → auth-b3bmdkga.js} +1 -1
  17. package/dist/chunks/{cors-z59gyc0x.js → auth-b4mqtccx.js} +2 -2
  18. package/dist/chunks/{cors-be53s2qz.js → auth-djj5asqw.js} +1 -1
  19. package/dist/chunks/{cors-p2b2w3c7.js → auth-dnwg64ce.js} +10 -10
  20. package/dist/chunks/{cors-e46y0tfd.js → auth-dx89xydc.js} +2 -2
  21. package/dist/chunks/{cors-wxj3d9av.js → auth-et00mhwf.js} +2 -2
  22. package/dist/chunks/{cors-22wspztn.js → auth-f8r9p2vr.js} +2 -2
  23. package/dist/chunks/{cors-x8dgc261.js → auth-h1thjy6x.js} +2 -2
  24. package/dist/chunks/{cors-xg8gbd2j.js → auth-hjes926v.js} +6 -6
  25. package/dist/chunks/{cors-gk0yxcp6.js → auth-htyf2qs7.js} +1 -1
  26. package/dist/chunks/{cors-b2k9041j.js → auth-hx8bsq9d.js} +1 -1
  27. package/dist/chunks/{cors-j4at0y5c.js → auth-j4at0y5c.js} +1 -1
  28. package/dist/chunks/{cors-awjv4jq4.js → auth-kafd488q.js} +2 -2
  29. package/dist/chunks/{cors-ppma8fcc.js → auth-kg0ybx4v.js} +3 -3
  30. package/dist/chunks/{cors-31rtm1s3.js → auth-m119esdv.js} +25 -12
  31. package/dist/chunks/{cors-rztv1fyf.js → auth-mzqcpmk1.js} +4 -4
  32. package/dist/chunks/auth-n321d8vm.js +46 -0
  33. package/dist/chunks/{cors-xe9t9xr4.js → auth-nz17qv97.js} +2 -2
  34. package/dist/chunks/{cors-zez59srt.js → auth-pg3y39tj.js} +4 -4
  35. package/dist/chunks/{cors-a5yawcck.js → auth-q1mbf0ed.js} +2 -2
  36. package/dist/chunks/{cors-6vs5sqy6.js → auth-q44yktpv.js} +2 -2
  37. package/dist/chunks/{cors-h9rcwvg0.js → auth-r6xkfcdx.js} +1 -1
  38. package/dist/chunks/{cors-17ecnfcg.js → auth-rfdwk27n.js} +2 -2
  39. package/dist/chunks/{cors-vpfg86w3.js → auth-rjz2az0g.js} +15 -15
  40. package/dist/chunks/{cors-hnheq3hv.js → auth-s62wjkvx.js} +2 -2
  41. package/dist/chunks/{cors-yr4wsvrw.js → auth-s9tkswmw.js} +2 -2
  42. package/dist/chunks/{cors-stmn2fz7.js → auth-sxtrrcma.js} +35 -35
  43. package/dist/chunks/{cors-m5rae7m4.js → auth-v8aqacn3.js} +2 -2
  44. package/dist/chunks/{cors-w9jcwh65.js → auth-w9jcwh65.js} +1 -1
  45. package/dist/chunks/{cors-1je14sn4.js → auth-x4b2rtcb.js} +1 -1
  46. package/dist/chunks/auth-xthc02cw.js +6 -0
  47. package/dist/chunks/{cors-z3e7v67k.js → auth-yjbzmfhm.js} +7 -7
  48. package/dist/chunks/{cors-h072q2hm.js → auth-zbe9jfhy.js} +1 -1
  49. package/dist/chunks/{cors-ahexmkv8.js → auth-zvbhqxt5.js} +22 -6
  50. package/dist/cors.js +1 -1
  51. package/dist/event-feed.js +7 -7
  52. package/dist/fetch.js +52 -50
  53. package/dist/handlers/agent.js +6 -6
  54. package/dist/handlers/command.js +6 -6
  55. package/dist/handlers/config.js +6 -6
  56. package/dist/handlers/credential.js +6 -6
  57. package/dist/handlers/debug.js +6 -6
  58. package/dist/handlers/event.js +7 -7
  59. package/dist/handlers/form.js +6 -6
  60. package/dist/handlers/fs.js +6 -6
  61. package/dist/handlers/generate.js +6 -6
  62. package/dist/handlers/integration.js +6 -6
  63. package/dist/handlers/location.js +6 -6
  64. package/dist/handlers/mcp.js +8 -8
  65. package/dist/handlers/media.d.ts +6 -0
  66. package/dist/handlers/media.js +6 -0
  67. package/dist/handlers/message.js +7 -6
  68. package/dist/handlers/migration.js +6 -6
  69. package/dist/handlers/model.js +6 -6
  70. package/dist/handlers/permission.js +6 -6
  71. package/dist/handlers/persistent-pty.d.ts +1 -1
  72. package/dist/handlers/persistent-pty.js +9 -8
  73. package/dist/handlers/plugin.js +6 -6
  74. package/dist/handlers/project.js +6 -6
  75. package/dist/handlers/provider.js +6 -6
  76. package/dist/handlers/pty-socket.js +1 -1
  77. package/dist/handlers/pty.js +8 -8
  78. package/dist/handlers/reference.js +6 -6
  79. package/dist/handlers/rpc.js +6 -6
  80. package/dist/handlers/server.js +9 -9
  81. package/dist/handlers/session-error.js +1 -1
  82. package/dist/handlers/session.js +7 -6
  83. package/dist/handlers/shell.js +6 -6
  84. package/dist/handlers/skill.js +6 -6
  85. package/dist/handlers/usage.js +6 -6
  86. package/dist/handlers/vcs.js +6 -6
  87. package/dist/handlers/voice.js +6 -6
  88. package/dist/handlers/websearch.js +6 -6
  89. package/dist/handlers/worktree.js +6 -6
  90. package/dist/handlers.d.ts +1 -1
  91. package/dist/handlers.js +46 -44
  92. package/dist/location.js +4 -4
  93. package/dist/media-uri.d.ts +6 -0
  94. package/dist/media-uri.js +6 -0
  95. package/dist/middleware/authorization.js +2 -2
  96. package/dist/middleware/form-location.js +3 -3
  97. package/dist/middleware/schema-error.js +1 -1
  98. package/dist/middleware/session-location.js +3 -3
  99. package/dist/pairing.js +1 -1
  100. package/dist/process.js +54 -52
  101. package/dist/request-tracing.js +1 -1
  102. package/dist/routes.js +49 -47
  103. package/dist/server-info.js +5 -5
  104. package/dist/service-status.js +3 -3
  105. package/dist/workerd.js +53 -51
  106. package/package.json +8 -8
  107. /package/dist/chunks/{cors-9rqn6x4v.js → auth-9rqn6x4v.js} +0 -0
  108. /package/dist/chunks/{cors-erzfdgke.js → auth-erzfdgke.js} +0 -0
  109. /package/dist/chunks/{cors-h6rt5k9s.js → auth-h6rt5k9s.js} +0 -0
  110. /package/dist/chunks/{cors-q4bn6dy8.js → auth-q4bn6dy8.js} +0 -0
  111. /package/dist/chunks/{cors-smaf4a18.js → auth-smaf4a18.js} +0 -0
  112. /package/dist/chunks/{cors-yc7nft6q.js → auth-yc7nft6q.js} +0 -0
package/dist/api.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  Api2
3
- } from "./chunks/cors-9c4eyh8m.js";
4
- import"./chunks/cors-yet0vexm.js";
5
- import"./chunks/cors-gk0yxcp6.js";
6
- import"./chunks/cors-gqq6kfhc.js";
7
- import"./chunks/cors-smaf4a18.js";
3
+ } from "./chunks/auth-0e81et3m.js";
4
+ import"./chunks/auth-b3bmdkga.js";
5
+ import"./chunks/auth-htyf2qs7.js";
6
+ import"./chunks/auth-50bbk3b2.js";
7
+ import"./chunks/auth-smaf4a18.js";
8
8
  export {
9
9
  Api2 as Api
10
10
  };
package/dist/auth.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  verifySession2,
8
8
  sessionCookieName2,
9
9
  exports_auth
10
- } from "./chunks/cors-j4at0y5c.js";
10
+ } from "./chunks/auth-j4at0y5c.js";
11
11
  export {
12
12
  Config2 as Config,
13
13
  SESSION_TTL_SECONDS2 as SESSION_TTL_SECONDS,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Api2
3
- } from "./cors-9c4eyh8m.js";
3
+ } from "./auth-0e81et3m.js";
4
4
 
5
5
  // src/handlers/project.ts
6
6
  import { Project } from "@opencode/core/project";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  LocationMiddleware2
3
- } from "./cors-gqq6kfhc.js";
3
+ } from "./auth-50bbk3b2.js";
4
4
  import {
5
5
  FormLocationMiddleware2
6
- } from "./cors-gk0yxcp6.js";
6
+ } from "./auth-htyf2qs7.js";
7
7
  import {
8
8
  SessionLocationMiddleware2
9
- } from "./cors-yet0vexm.js";
9
+ } from "./auth-b3bmdkga.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 "./cors-gqq6kfhc.js";
3
+ } from "./auth-50bbk3b2.js";
4
4
  import {
5
5
  Api2
6
- } from "./cors-9c4eyh8m.js";
6
+ } from "./auth-0e81et3m.js";
7
7
 
8
8
  // src/handlers/fs.ts
9
9
  import { FileSystem } from "@opencode/core/filesystem";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Api2
3
- } from "./cors-9c4eyh8m.js";
3
+ } from "./auth-0e81et3m.js";
4
4
 
5
5
  // src/handlers/rpc.ts
6
6
  import { Rpc } from "@opencode/core/rpc";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  response2
3
- } from "./cors-gqq6kfhc.js";
3
+ } from "./auth-50bbk3b2.js";
4
4
  import {
5
5
  Api2
6
- } from "./cors-9c4eyh8m.js";
6
+ } from "./auth-0e81et3m.js";
7
7
 
8
8
  // src/handlers/integration.ts
9
9
  import { Integration } from "@opencode/core/integration";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  __export
3
- } from "./cors-9rqn6x4v.js";
3
+ } from "./auth-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: () => make4
9
+ make: () => make2
10
10
  });
11
11
  import { Effect, Ref } from "effect";
12
- var make4 = Effect.fnUntraced(function* (options = {}) {
12
+ var make2 = 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 make4 = Effect.fnUntraced(function* (options = {}) {
20
20
  };
21
21
  });
22
22
 
23
- export { make4, exports_service_status };
23
+ export { make2, exports_service_status };
@@ -1,26 +1,26 @@
1
1
  import {
2
2
  isAllowedCorsOrigin2
3
- } from "./cors-q4bn6dy8.js";
3
+ } from "./auth-q4bn6dy8.js";
4
4
  import {
5
5
  createRoutes2
6
- } from "./cors-vpfg86w3.js";
6
+ } from "./auth-rjz2az0g.js";
7
7
  import {
8
8
  __export
9
- } from "./cors-9rqn6x4v.js";
9
+ } from "./auth-9rqn6x4v.js";
10
10
 
11
11
  // src/fetch.ts
12
12
  var exports_fetch = {};
13
13
  __export(exports_fetch, {
14
14
  ServerFetch: () => exports_fetch,
15
- make: () => make2
15
+ make: () => make3
16
16
  });
17
17
  import { Context, Effect, Layer } from "effect";
18
18
  import { HttpEffect, HttpMiddleware, HttpRouter, HttpServer } from "effect/http";
19
19
  import { SessionRestart } from "@opencode/core/session/execution/restart";
20
- var make2 = Effect.fn("ServerFetch.make")(function* (options = {}, boot = {}) {
20
+ var make3 = Effect.fn("ServerFetch.make")(function* (options = {}, boot = {}) {
21
21
  const context = yield* Layer.build(createRoutes2(options, () => [], boot.overrides ?? []).pipe(Layer.provide(HttpServer.layerServices)));
22
22
  yield* Effect.forkDetach(Context.get(context, SessionRestart.Service).resumeSuspendedSessions);
23
23
  return Context.get(context, HttpRouter.HttpRouter).asHttpEffect().pipe(HttpMiddleware.cors({ allowedOrigins: (origin) => isAllowedCorsOrigin2(origin, options), maxAge: 86400 }), HttpEffect.toWebHandlerWith(context));
24
24
  });
25
25
 
26
- export { make2, exports_fetch };
26
+ export { make3, exports_fetch };
@@ -1,13 +1,16 @@
1
1
  import {
2
2
  Api2
3
- } from "./cors-9c4eyh8m.js";
3
+ } from "./auth-0e81et3m.js";
4
4
  import {
5
5
  CorsConfig2,
6
6
  isAllowedRequestOrigin2
7
- } from "./cors-q4bn6dy8.js";
7
+ } from "./auth-q4bn6dy8.js";
8
+ import {
9
+ makeMediaGet2
10
+ } from "./auth-n321d8vm.js";
8
11
  import {
9
12
  runPtySocket2
10
- } from "./cors-h6rt5k9s.js";
13
+ } from "./auth-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
- return handlers.handle("persistentPty.read", Effect.fn(function* (ctx) {
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
  missingSession2
3
- } from "./cors-smaf4a18.js";
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 layer3 = Layer.effect(LocationMiddleware2, Effect.gen(function* () {
62
+ var layer4 = 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 layer3 = Layer.effect(LocationMiddleware2, Effect.gen(function* () {
67
67
  }));
68
68
  }));
69
69
 
70
- export { LocationMiddleware2, locationErrors2, awaitPlugins2, response2, sessionInfo2, requestRef2, layer3 };
70
+ export { LocationMiddleware2, locationErrors2, awaitPlugins2, response2, sessionInfo2, requestRef2, layer4 };
@@ -4,7 +4,7 @@ import {
4
4
  authorized2,
5
5
  verifySession2,
6
6
  sessionCookieName2
7
- } from "./cors-j4at0y5c.js";
7
+ } from "./auth-j4at0y5c.js";
8
8
 
9
9
  // src/middleware/authorization.ts
10
10
  import { UnauthorizedError } from "@opencode/protocol/errors";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  awaitPlugins2,
3
3
  response2
4
- } from "./cors-gqq6kfhc.js";
4
+ } from "./auth-50bbk3b2.js";
5
5
  import {
6
6
  Api2
7
- } from "./cors-9c4eyh8m.js";
7
+ } from "./auth-0e81et3m.js";
8
8
 
9
9
  // src/handlers/usage.ts
10
10
  import { UsageLimits } from "@opencode/core/usage-limits";
@@ -2,17 +2,17 @@ import {
2
2
  locationErrors2,
3
3
  response2,
4
4
  requestRef2
5
- } from "./cors-gqq6kfhc.js";
5
+ } from "./auth-50bbk3b2.js";
6
6
  import {
7
7
  Api2
8
- } from "./cors-9c4eyh8m.js";
8
+ } from "./auth-0e81et3m.js";
9
9
  import {
10
10
  CorsConfig2,
11
11
  isAllowedRequestOrigin2
12
- } from "./cors-q4bn6dy8.js";
12
+ } from "./auth-q4bn6dy8.js";
13
13
  import {
14
14
  runPtySocket2
15
- } from "./cors-h6rt5k9s.js";
15
+ } from "./auth-h6rt5k9s.js";
16
16
 
17
17
  // src/handlers/pty.ts
18
18
  import { Pty } from "@opencode/core/pty";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  awaitPlugins2,
3
3
  response2
4
- } from "./cors-gqq6kfhc.js";
4
+ } from "./auth-50bbk3b2.js";
5
5
  import {
6
6
  Api2
7
- } from "./cors-9c4eyh8m.js";
7
+ } from "./auth-0e81et3m.js";
8
8
 
9
9
  // src/handlers/provider.ts
10
10
  import { Provider } from "@opencode/core/provider";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  locationErrors2,
3
3
  sessionInfo2
4
- } from "./cors-gqq6kfhc.js";
4
+ } from "./auth-50bbk3b2.js";
5
5
 
6
6
  // src/middleware/session-location.ts
7
7
  import { Instance } from "@opencode/core/instance/service";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  response2
3
- } from "./cors-gqq6kfhc.js";
3
+ } from "./auth-50bbk3b2.js";
4
4
  import {
5
5
  Api2
6
- } from "./cors-9c4eyh8m.js";
6
+ } from "./auth-0e81et3m.js";
7
7
 
8
8
  // src/handlers/command.ts
9
9
  import { Command } from "@opencode/core/command";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Api2
3
- } from "./cors-9c4eyh8m.js";
3
+ } from "./auth-0e81et3m.js";
4
4
 
5
5
  // src/handlers/credential.ts
6
6
  import { Credential } from "@opencode/core/credential";
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  __export
3
- } from "./cors-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: () => Service4,
10
+ Service: () => Service2,
11
11
  SubscriberCapacity: () => SubscriberCapacity2,
12
12
  SubscriberOverflowError: () => SubscriberOverflowError2,
13
13
  frame: () => frame2,
14
- layer: () => layer4,
15
- make: () => make3
14
+ layer: () => layer2,
15
+ make: () => make4
16
16
  });
17
17
  import { Bus } from "@opencode/core/bus";
18
18
  import { Event } from "@opencode/schema/event";
@@ -30,14 +30,14 @@ class EncodingError2 extends Schema.TaggedError()("EventFeed.EncodingError", {
30
30
  }) {
31
31
  }
32
32
 
33
- class Service4 extends Context.Service()("@opencode/server/EventFeed") {
33
+ class Service2 extends Context.Service()("@opencode/server/EventFeed") {
34
34
  }
35
35
  function frame2(event) {
36
36
  return `data: ${JSON.stringify(event)}
37
37
 
38
38
  `;
39
39
  }
40
- var make3 = Effect.fn("EventFeed.make")(function* (observe, options) {
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
43
  const subscribers = new Set;
@@ -71,13 +71,13 @@ var make3 = Effect.fn("EventFeed.make")(function* (observe, options) {
71
71
  });
72
72
  const unsubscribe = yield* observe(publish);
73
73
  yield* Effect.addFinalizer(() => unsubscribe);
74
- return Service4.of({
74
+ return Service2.of({
75
75
  subscribe: Effect.acquireRelease(Queue.dropping(capacity).pipe(Effect.tap((queue) => Effect.sync(() => subscribers.add(queue)))), (queue) => Effect.sync(() => subscribers.delete(queue)).pipe(Effect.andThen(Queue.shutdown(queue)), Effect.asVoid)).pipe(Effect.map(Stream.fromQueue))
76
76
  });
77
77
  });
78
- var layer4 = Layer.effect(Service4, Effect.gen(function* () {
78
+ var layer2 = Layer.effect(Service2, Effect.gen(function* () {
79
79
  const bus = yield* Bus.Service;
80
- return yield* make3(bus.listen);
80
+ return yield* make4(bus.listen);
81
81
  }));
82
82
 
83
- export { SubscriberCapacity2, SubscriberOverflowError2, EncodingError2, Service4, frame2, make3, layer4, exports_event_feed };
83
+ export { SubscriberCapacity2, SubscriberOverflowError2, EncodingError2, Service2, frame2, make4, layer2, exports_event_feed };
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  awaitPlugins2,
3
3
  response2
4
- } from "./cors-gqq6kfhc.js";
4
+ } from "./auth-50bbk3b2.js";
5
5
  import {
6
6
  Api2
7
- } from "./cors-9c4eyh8m.js";
7
+ } from "./auth-0e81et3m.js";
8
8
 
9
9
  // src/handlers/websearch.ts
10
10
  import { WebSearch } from "@opencode/core/websearch";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  locationErrors2,
3
3
  awaitPlugins2
4
- } from "./cors-gqq6kfhc.js";
4
+ } from "./auth-50bbk3b2.js";
5
5
  import {
6
6
  Api2
7
- } from "./cors-9c4eyh8m.js";
7
+ } from "./auth-0e81et3m.js";
8
8
 
9
9
  // src/handlers/voice.ts
10
10
  import { Location } from "@opencode/core/location";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  response2
3
- } from "./cors-gqq6kfhc.js";
3
+ } from "./auth-50bbk3b2.js";
4
4
  import {
5
5
  Api2
6
- } from "./cors-9c4eyh8m.js";
6
+ } from "./auth-0e81et3m.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
  requestRef2
3
- } from "./cors-gqq6kfhc.js";
3
+ } from "./auth-50bbk3b2.js";
4
4
  import {
5
5
  Api2
6
- } from "./cors-9c4eyh8m.js";
6
+ } from "./auth-0e81et3m.js";
7
7
 
8
8
  // src/handlers/debug.ts
9
9
  import { LocationServiceMap } from "@opencode/core/location-service-map";
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  Api2
3
- } from "./cors-9c4eyh8m.js";
3
+ } from "./auth-0e81et3m.js";
4
4
  import {
5
5
  SESSION_TTL_SECONDS2,
6
6
  Config2,
7
7
  issueSession2,
8
8
  sessionCookieName2
9
- } from "./cors-j4at0y5c.js";
9
+ } from "./auth-j4at0y5c.js";
10
10
  import {
11
- Service2
12
- } from "./cors-z3e7v67k.js";
11
+ Service4
12
+ } from "./auth-yjbzmfhm.js";
13
13
  import {
14
14
  Service3
15
- } from "./cors-w9jcwh65.js";
15
+ } from "./auth-w9jcwh65.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* Service3;
26
26
  const auth = yield* Config2;
27
27
  return handlers.handle("server.info", () => Effect.gen(function* () {
28
- const info = yield* Service2;
28
+ const info = yield* Service4;
29
29
  return {
30
30
  version: info.app.version ?? "unknown",
31
31
  pid: process.pid ?? 0,
@@ -2,7 +2,7 @@ import {
2
2
  locationErrors2,
3
3
  sessionInfo2,
4
4
  requestRef2
5
- } from "./cors-gqq6kfhc.js";
5
+ } from "./auth-50bbk3b2.js";
6
6
 
7
7
  // src/middleware/form-location.ts
8
8
  import { Instance } from "@opencode/core/instance/service";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Api2
3
- } from "./cors-9c4eyh8m.js";
3
+ } from "./auth-0e81et3m.js";
4
4
 
5
5
  // src/handlers/config.ts
6
6
  import { Config } from "@opencode/core/config";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __export
3
- } from "./cors-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
  response2
3
- } from "./cors-gqq6kfhc.js";
3
+ } from "./auth-50bbk3b2.js";
4
4
  import {
5
5
  Api2
6
- } from "./cors-9c4eyh8m.js";
6
+ } from "./auth-0e81et3m.js";
7
7
 
8
8
  // src/handlers/plugin.ts
9
9
  import { Plugin } from "@opencode/core/plugin";
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  missingSession2
3
- } from "./cors-smaf4a18.js";
3
+ } from "./auth-smaf4a18.js";
4
4
  import {
5
5
  locationErrors2,
6
6
  response2,
7
7
  sessionInfo2
8
- } from "./cors-gqq6kfhc.js";
8
+ } from "./auth-50bbk3b2.js";
9
9
  import {
10
10
  Api2
11
- } from "./cors-9c4eyh8m.js";
11
+ } from "./auth-0e81et3m.js";
12
12
 
13
13
  // src/handlers/permission.ts
14
14
  import { Instance } from "@opencode/core/instance/service";
@@ -1,17 +1,22 @@
1
1
  import {
2
2
  missingSession2,
3
3
  failedMessageDecode2
4
- } from "./cors-smaf4a18.js";
4
+ } from "./auth-smaf4a18.js";
5
5
  import {
6
6
  Api2
7
- } from "./cors-9c4eyh8m.js";
7
+ } from "./auth-0e81et3m.js";
8
+ import {
9
+ wantsMediaRefs2
10
+ } from "./auth-xthc02cw.js";
8
11
 
9
12
  // src/handlers/message.ts
10
13
  import { SessionMessage } from "@opencode/core/session/message";
11
14
  import { Session } from "@opencode/core/session";
12
15
  import { Effect, Option, Schema } from "effect";
16
+ import { HttpServerResponse } from "effect/http";
13
17
  import { HttpApiBuilder } from "effect/http-api";
14
18
  import { InvalidCursorError } from "@opencode/protocol/errors";
19
+ import { SessionMediaMessagesResponse } from "@opencode/protocol/groups/message";
15
20
  var DefaultMessagesLimit = 50;
16
21
  var Cursor = Schema.Struct({
17
22
  id: SessionMessage.ID,
@@ -34,22 +39,30 @@ var MessageHandler2 = HttpApiBuilder.group(Api2, "server.message", (handlers) =>
34
39
  return yield* new InvalidCursorError({ message: "Cursor cannot be combined with order" });
35
40
  const decoded = ctx.query.cursor ? Option.getOrUndefined(cursor.decode(ctx.query.cursor)) ?? (yield* new InvalidCursorError({ message: "Invalid cursor" })) : undefined;
36
41
  const order = decoded?.order ?? ctx.query.order ?? "desc";
37
- const messages = yield* session.messages({
42
+ const input = {
38
43
  sessionID: ctx.params.sessionID,
39
44
  limit: ctx.query.limit ?? DefaultMessagesLimit,
40
45
  order,
41
46
  type: ctx.query.type,
42
47
  cursor: decoded ? { id: decoded.id, direction: decoded.direction } : undefined
43
- }).pipe(Effect.catchTag("Session.NotFoundError", missingSession2), Effect.catchTag("Session.MessageDecodeError", failedMessageDecode2));
44
- const first = messages[0];
45
- const last = messages.at(-1);
46
- return {
47
- data: messages,
48
- cursor: {
49
- previous: first ? cursor.encode(first, order, "previous") : undefined,
50
- next: last ? cursor.encode(last, order, "next") : undefined
51
- }
52
48
  };
49
+ const page = (messages) => {
50
+ const first = messages[0];
51
+ const last = messages.at(-1);
52
+ return {
53
+ data: messages,
54
+ cursor: {
55
+ previous: first ? cursor.encode(first, order, "previous") : undefined,
56
+ next: last ? cursor.encode(last, order, "next") : undefined
57
+ }
58
+ };
59
+ };
60
+ if (wantsMediaRefs2(ctx.request)) {
61
+ const messages = yield* session.messagesWithRefs(input).pipe(Effect.catchTag("Session.NotFoundError", missingSession2), Effect.catchTag("Session.MessageDecodeError", failedMessageDecode2));
62
+ return yield* HttpServerResponse.schemaJson(SessionMediaMessagesResponse)(page(messages)).pipe(Effect.orDie);
63
+ }
64
+ const messages = yield* session.messages(input).pipe(Effect.catchTag("Session.NotFoundError", missingSession2), Effect.catchTag("Session.MessageDecodeError", failedMessageDecode2));
65
+ return page(messages);
53
66
  }));
54
67
  }));
55
68
 
@@ -2,17 +2,17 @@ import {
2
2
  locationErrors2,
3
3
  response2,
4
4
  requestRef2
5
- } from "./cors-gqq6kfhc.js";
5
+ } from "./auth-50bbk3b2.js";
6
6
  import {
7
7
  Api2
8
- } from "./cors-9c4eyh8m.js";
8
+ } from "./auth-0e81et3m.js";
9
9
  import {
10
10
  CorsConfig2,
11
11
  isAllowedRequestOrigin2
12
- } from "./cors-q4bn6dy8.js";
12
+ } from "./auth-q4bn6dy8.js";
13
13
  import {
14
14
  runPtySocket2
15
- } from "./cors-h6rt5k9s.js";
15
+ } from "./auth-h6rt5k9s.js";
16
16
 
17
17
  // src/handlers/mcp.ts
18
18
  import { Location } from "@opencode/core/location";
@@ -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,9 +1,9 @@
1
1
  import {
2
2
  response2
3
- } from "./cors-gqq6kfhc.js";
3
+ } from "./auth-50bbk3b2.js";
4
4
  import {
5
5
  Api2
6
- } from "./cors-9c4eyh8m.js";
6
+ } from "./auth-0e81et3m.js";
7
7
 
8
8
  // src/handlers/vcs.ts
9
9
  import { Vcs } from "@opencode/core/vcs";