@opencode/server 2.3.1 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/dist/api.d.ts +249 -1
  2. package/dist/api.js +5 -5
  3. package/dist/auth.js +1 -1
  4. package/dist/chunks/{request-tracing-n5et0xgm.js → content-headers-0r476wkb.js} +5 -5
  5. package/dist/chunks/content-headers-0rzj25w4.js +194 -0
  6. package/dist/chunks/{request-tracing-4p2y0qs3.js → content-headers-100nc7c0.js} +2 -5
  7. package/dist/chunks/{request-tracing-z2ndp6vh.js → content-headers-1r438we2.js} +6 -6
  8. package/dist/chunks/{request-tracing-v8aqacn3.js → content-headers-2cm4dfcc.js} +2 -2
  9. package/dist/chunks/{request-tracing-x4b2rtcb.js → content-headers-2dzr03as.js} +1 -1
  10. package/dist/chunks/{request-tracing-ap1t95t8.js → content-headers-2rb1ee6g.js} +3 -3
  11. package/dist/chunks/{request-tracing-39nnfjx1.js → content-headers-39nnfjx1.js} +1 -1
  12. package/dist/chunks/{request-tracing-dezpcckc.js → content-headers-4fc68szf.js} +2 -2
  13. package/dist/chunks/{request-tracing-05c5061t.js → content-headers-4zkx9wb3.js} +1 -1
  14. package/dist/chunks/{request-tracing-b4mqtccx.js → content-headers-5jm9kajg.js} +2 -2
  15. package/dist/chunks/{request-tracing-7nb2rv11.js → content-headers-7jm4dc4a.js} +4 -4
  16. package/dist/chunks/{request-tracing-p86kew8c.js → content-headers-7qpea5x7.js} +2 -2
  17. package/dist/chunks/{request-tracing-78rcgzsr.js → content-headers-7ydfwv45.js} +4 -1
  18. package/dist/chunks/{request-tracing-f8r9p2vr.js → content-headers-801prsqk.js} +2 -2
  19. package/dist/chunks/{request-tracing-dx89xydc.js → content-headers-8ja97vv6.js} +2 -4
  20. package/dist/chunks/{request-tracing-8sb6qqpn.js → content-headers-8sb6qqpn.js} +1 -1
  21. package/dist/chunks/{request-tracing-9cd3a4b8.js → content-headers-9cd3a4b8.js} +1 -1
  22. package/dist/chunks/{request-tracing-tk56ffsq.js → content-headers-9t07vtvz.js} +5 -4
  23. package/dist/chunks/{request-tracing-htyf2qs7.js → content-headers-ah2sj2pr.js} +1 -1
  24. package/dist/chunks/{request-tracing-ayveq98d.js → content-headers-b03d5rht.js} +6 -18
  25. package/dist/chunks/{request-tracing-hx8bsq9d.js → content-headers-d20xfnpc.js} +1 -1
  26. package/dist/chunks/{request-tracing-r7knxm63.js → content-headers-ddrpmftb.js} +4 -4
  27. package/dist/chunks/{request-tracing-djr0jy89.js → content-headers-djr0jy89.js} +1 -1
  28. package/dist/chunks/{request-tracing-v0r38a4t.js → content-headers-fjcqsaaz.js} +46 -19
  29. package/dist/chunks/{request-tracing-sy2e93cn.js → content-headers-g23ffrnz.js} +3 -3
  30. package/dist/chunks/{request-tracing-kg0ybx4v.js → content-headers-gq4jwh93.js} +3 -3
  31. package/dist/chunks/{request-tracing-d4534456.js → content-headers-hf3kgjhr.js} +4 -4
  32. package/dist/chunks/{request-tracing-2pbbrzpp.js → content-headers-hk9crnsa.js} +2 -2
  33. package/dist/chunks/{request-tracing-myqk22k5.js → content-headers-hmwn16zp.js} +2 -2
  34. package/dist/chunks/{request-tracing-g6yhb3a8.js → content-headers-hnbeyfax.js} +15 -9
  35. package/dist/chunks/{request-tracing-j4at0y5c.js → content-headers-j4at0y5c.js} +1 -1
  36. package/dist/chunks/{request-tracing-jjvpqmx6.js → content-headers-jhbndf2d.js} +4 -4
  37. package/dist/chunks/{request-tracing-q44yktpv.js → content-headers-jmmhprac.js} +2 -2
  38. package/dist/chunks/{request-tracing-rd9e3qfx.js → content-headers-ky9xhfwk.js} +4 -4
  39. package/dist/chunks/{request-tracing-0gf4dfn8.js → content-headers-mvp6540g.js} +35 -35
  40. package/dist/chunks/{request-tracing-mzs0n5xz.js → content-headers-mzs0n5xz.js} +1 -1
  41. package/dist/chunks/{request-tracing-9grnt8dc.js → content-headers-p83m65n5.js} +2 -4
  42. package/dist/chunks/{request-tracing-zbe9jfhy.js → content-headers-prn0chz2.js} +1 -1
  43. package/dist/chunks/{request-tracing-fvpjvjpp.js → content-headers-qfyg9gb7.js} +7 -7
  44. package/dist/chunks/{request-tracing-vbgqk0mr.js → content-headers-r40v995e.js} +2 -2
  45. package/dist/chunks/{request-tracing-7b9xm1qg.js → content-headers-rktygpea.js} +4 -1
  46. package/dist/chunks/{request-tracing-d8b9pm2q.js → content-headers-rmfb1myj.js} +1 -1
  47. package/dist/chunks/{request-tracing-et00mhwf.js → content-headers-s3zgwc17.js} +3 -6
  48. package/dist/chunks/{request-tracing-t32e1bbt.js → content-headers-t32e1bbt.js} +1 -1
  49. package/dist/chunks/{request-tracing-b3bmdkga.js → content-headers-vw0q3knq.js} +1 -1
  50. package/dist/chunks/{request-tracing-h286a6py.js → content-headers-w3xmknp7.js} +2 -2
  51. package/dist/chunks/{request-tracing-s9tkswmw.js → content-headers-wka57cdm.js} +2 -2
  52. package/dist/chunks/{request-tracing-h1thjy6x.js → content-headers-y60jfeab.js} +2 -2
  53. package/dist/chunks/{request-tracing-4ed680xg.js → content-headers-ykk3p1r3.js} +2 -2
  54. package/dist/chunks/{request-tracing-861wfsmy.js → content-headers-yty6dk04.js} +1 -1
  55. package/dist/chunks/{request-tracing-50bbk3b2.js → content-headers-ywn523ee.js} +3 -11
  56. package/dist/chunks/{request-tracing-3te71694.js → content-headers-z3e7v67k.js} +7 -7
  57. package/dist/chunks/{request-tracing-0e81et3m.js → content-headers-zjmacp9c.js} +3 -3
  58. package/dist/content-headers.js +1 -1
  59. package/dist/cors.js +1 -1
  60. package/dist/event-feed.js +5 -5
  61. package/dist/fetch.js +60 -59
  62. package/dist/handlers/agent.js +6 -6
  63. package/dist/handlers/artifact.js +3 -3
  64. package/dist/handlers/automation.d.ts +1 -1
  65. package/dist/handlers/automation.js +2 -2
  66. package/dist/handlers/blob.js +3 -3
  67. package/dist/handlers/command.js +6 -6
  68. package/dist/handlers/config.js +6 -6
  69. package/dist/handlers/credential.d.ts +1 -1
  70. package/dist/handlers/credential.js +7 -7
  71. package/dist/handlers/debug.js +6 -6
  72. package/dist/handlers/event.js +7 -7
  73. package/dist/handlers/form.js +6 -6
  74. package/dist/handlers/fs.js +8 -8
  75. package/dist/handlers/generate.js +6 -6
  76. package/dist/handlers/integration.js +6 -6
  77. package/dist/handlers/job.d.ts +13 -1
  78. package/dist/handlers/job.js +2 -2
  79. package/dist/handlers/location.js +6 -6
  80. package/dist/handlers/machine.d.ts +95 -0
  81. package/dist/handlers/machine.js +18 -0
  82. package/dist/handlers/mcp.js +8 -8
  83. package/dist/handlers/media.js +2 -2
  84. package/dist/handlers/message.js +7 -7
  85. package/dist/handlers/migration.js +6 -6
  86. package/dist/handlers/model.js +6 -6
  87. package/dist/handlers/permission.js +6 -6
  88. package/dist/handlers/persistent-pty.d.ts +1 -1
  89. package/dist/handlers/persistent-pty.js +16 -15
  90. package/dist/handlers/plugin.js +6 -6
  91. package/dist/handlers/project.js +6 -6
  92. package/dist/handlers/provider.js +6 -6
  93. package/dist/handlers/pty-socket.js +1 -1
  94. package/dist/handlers/pty.js +8 -8
  95. package/dist/handlers/reference.js +6 -6
  96. package/dist/handlers/rpc.js +6 -6
  97. package/dist/handlers/server.js +9 -9
  98. package/dist/handlers/session-error.js +1 -1
  99. package/dist/handlers/session.js +7 -7
  100. package/dist/handlers/shell.js +6 -6
  101. package/dist/handlers/skill.js +6 -6
  102. package/dist/handlers/usage.js +6 -6
  103. package/dist/handlers/vcs.js +6 -6
  104. package/dist/handlers/voice.js +6 -6
  105. package/dist/handlers/websearch.js +6 -6
  106. package/dist/handlers/worktree.js +6 -6
  107. package/dist/handlers.d.ts +1 -1
  108. package/dist/handlers.js +53 -52
  109. package/dist/location.d.ts +1 -3
  110. package/dist/location.js +2 -4
  111. package/dist/media-uri.js +1 -1
  112. package/dist/middleware/authorization.js +2 -2
  113. package/dist/middleware/defect-response.js +1 -1
  114. package/dist/middleware/form-location.js +3 -3
  115. package/dist/middleware/schema-error.js +1 -1
  116. package/dist/middleware/session-location.js +3 -3
  117. package/dist/pairing.js +1 -1
  118. package/dist/process.js +72 -63
  119. package/dist/range.js +1 -1
  120. package/dist/request-site.js +2 -2
  121. package/dist/request-tracing.js +1 -1
  122. package/dist/routes.d.ts +6 -2
  123. package/dist/routes.js +57 -56
  124. package/dist/server-info.js +5 -5
  125. package/dist/service-status.js +1 -1
  126. package/dist/workerd.js +63 -60
  127. package/package.json +8 -8
  128. /package/dist/chunks/{request-tracing-9rqn6x4v.js → content-headers-9rqn6x4v.js} +0 -0
  129. /package/dist/chunks/{request-tracing-bd8755ek.js → content-headers-bd8755ek.js} +0 -0
  130. /package/dist/chunks/{request-tracing-n26yr6pw.js → content-headers-n26yr6pw.js} +0 -0
  131. /package/dist/chunks/{request-tracing-q187pxxd.js → content-headers-q187pxxd.js} +0 -0
  132. /package/dist/chunks/{request-tracing-q4bn6dy8.js → content-headers-q4bn6dy8.js} +0 -0
  133. /package/dist/chunks/{request-tracing-smaf4a18.js → content-headers-smaf4a18.js} +0 -0
  134. /package/dist/chunks/{request-tracing-xthc02cw.js → content-headers-xthc02cw.js} +0 -0
  135. /package/dist/chunks/{request-tracing-yc7nft6q.js → content-headers-yc7nft6q.js} +0 -0
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  missingSession2,
3
3
  failedMessageDecode2
4
- } from "./request-tracing-smaf4a18.js";
4
+ } from "./content-headers-smaf4a18.js";
5
5
  import {
6
6
  Api2
7
- } from "./request-tracing-0e81et3m.js";
7
+ } from "./content-headers-zjmacp9c.js";
8
8
  import {
9
9
  wantsMediaRefs2
10
- } from "./request-tracing-xthc02cw.js";
10
+ } from "./content-headers-xthc02cw.js";
11
11
 
12
12
  // src/handlers/message.ts
13
13
  import { SessionMessage } from "@opencode/core/session/message";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __export
3
- } from "./request-tracing-9rqn6x4v.js";
3
+ } from "./content-headers-9rqn6x4v.js";
4
4
 
5
5
  // src/service-status.ts
6
6
  var exports_service_status = {};
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  response2
3
- } from "./request-tracing-50bbk3b2.js";
3
+ } from "./content-headers-ywn523ee.js";
4
4
  import {
5
5
  Api2
6
- } from "./request-tracing-0e81et3m.js";
6
+ } from "./content-headers-zjmacp9c.js";
7
7
 
8
8
  // src/handlers/agent.ts
9
9
  import { Agent } from "@opencode/core/agent";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Api2
3
- } from "./request-tracing-0e81et3m.js";
3
+ } from "./content-headers-zjmacp9c.js";
4
4
 
5
5
  // src/handlers/project.ts
6
6
  import { Project } from "@opencode/core/project";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  response2
3
- } from "./request-tracing-50bbk3b2.js";
3
+ } from "./content-headers-ywn523ee.js";
4
4
  import {
5
5
  Api2
6
- } from "./request-tracing-0e81et3m.js";
6
+ } from "./content-headers-zjmacp9c.js";
7
7
 
8
8
  // src/handlers/command.ts
9
9
  import { Command } from "@opencode/core/command";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  Api2
3
- } from "./request-tracing-0e81et3m.js";
3
+ } from "./content-headers-zjmacp9c.js";
4
4
  import {
5
- Service2,
5
+ Service3,
6
6
  frame2
7
- } from "./request-tracing-fvpjvjpp.js";
7
+ } from "./content-headers-qfyg9gb7.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* Service2;
15
+ const feed = yield* Service3;
16
16
  return handlers.handleRaw("event.subscribe", (ctx) => Effect.gen(function* () {
17
17
  const connected = {
18
18
  id: Event.ID.create(),
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  missingSession2
3
- } from "./request-tracing-smaf4a18.js";
3
+ } from "./content-headers-smaf4a18.js";
4
4
  import {
5
5
  locationErrors2,
6
6
  response2,
7
7
  requestRef2
8
- } from "./request-tracing-50bbk3b2.js";
8
+ } from "./content-headers-ywn523ee.js";
9
9
 
10
10
  // src/handlers/artifact.ts
11
11
  import { Artifact } from "@opencode/core/artifact";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  missingSession2
3
- } from "./request-tracing-smaf4a18.js";
3
+ } from "./content-headers-smaf4a18.js";
4
4
 
5
5
  // src/handlers/job.ts
6
6
  import { Job } from "@opencode/core/job";
@@ -21,6 +21,9 @@ var makeJob2 = Effect.gen(function* () {
21
21
  return {
22
22
  data: yield* SessionBackground.list(jobs, lookup, query)
23
23
  };
24
+ }),
25
+ cancel: Effect.fn("JobHandler.cancel")(function* (id) {
26
+ yield* jobs.cancel(id);
24
27
  })
25
28
  };
26
29
  });
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  response2
3
- } from "./request-tracing-50bbk3b2.js";
3
+ } from "./content-headers-ywn523ee.js";
4
4
  import {
5
5
  Api2
6
- } from "./request-tracing-0e81et3m.js";
6
+ } from "./content-headers-zjmacp9c.js";
7
7
 
8
8
  // src/handlers/shell.ts
9
9
  import { Shell } from "@opencode/core/shell";
@@ -1,10 +1,9 @@
1
1
  import {
2
- awaitPlugins2,
3
2
  response2
4
- } from "./request-tracing-50bbk3b2.js";
3
+ } from "./content-headers-ywn523ee.js";
5
4
  import {
6
5
  Api2
7
- } from "./request-tracing-0e81et3m.js";
6
+ } from "./content-headers-zjmacp9c.js";
8
7
 
9
8
  // src/handlers/websearch.ts
10
9
  import { WebSearch } from "@opencode/core/websearch";
@@ -16,7 +15,6 @@ var WebSearchHandler2 = HttpApiBuilder.group(Api2, "server.websearch", (handlers
16
15
  const websearch = yield* WebSearch.Service;
17
16
  return yield* response2(websearch.providers());
18
17
  })).handle("websearch.query", Effect.fn("server.websearch.query")(function* (request) {
19
- yield* awaitPlugins2;
20
18
  const websearch = yield* WebSearch.Service;
21
19
  return yield* response2(websearch.query(request.payload).pipe(Effect.catchTags({
22
20
  "WebSearch.ProviderRequired": () => new InvalidRequestError({
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __export
3
- } from "./request-tracing-9rqn6x4v.js";
3
+ } from "./content-headers-9rqn6x4v.js";
4
4
 
5
5
  // src/range.ts
6
6
  var exports_range = {};
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  missingSession2
3
- } from "./request-tracing-smaf4a18.js";
3
+ } from "./content-headers-smaf4a18.js";
4
4
 
5
5
  // src/handlers/automation.ts
6
6
  import { Automation } from "@opencode/core/automation";
@@ -1,13 +1,14 @@
1
1
  import {
2
2
  Api2
3
- } from "./request-tracing-0e81et3m.js";
3
+ } from "./content-headers-zjmacp9c.js";
4
4
  import {
5
5
  requireConnectable2
6
- } from "./request-tracing-2pbbrzpp.js";
6
+ } from "./content-headers-hk9crnsa.js";
7
7
 
8
8
  // src/handlers/credential.ts
9
9
  import { Credential } from "@opencode/core/credential";
10
10
  import { FileSystem } from "@opencode/core/filesystem";
11
+ import { Integration } from "@opencode/core/integration";
11
12
  import { Location } from "@opencode/core/location";
12
13
  import { LocationServiceMap } from "@opencode/core/location-services";
13
14
  import { AbsolutePath } from "@opencode/core/schema";
@@ -42,8 +43,8 @@ var CredentialHandler2 = HttpApiBuilder.group(Api2, "server.credential", (handle
42
43
  yield* credential.activate(ctx.params.credentialID);
43
44
  return HttpApiSchema.NoContent.make();
44
45
  })).handle("credential.remove", Effect.fn(function* (ctx) {
45
- const credential = yield* Credential.Service;
46
- yield* credential.remove(ctx.params.credentialID);
46
+ const integrations = yield* Integration.Service.pipe(Effect.provide(services), Effect.orDie);
47
+ yield* integrations.connection.remove(ctx.params.credentialID);
47
48
  return HttpApiSchema.NoContent.make();
48
49
  }));
49
50
  }));
@@ -2,7 +2,7 @@ import {
2
2
  locationErrors2,
3
3
  sessionInfo2,
4
4
  requestRef2
5
- } from "./request-tracing-50bbk3b2.js";
5
+ } from "./content-headers-ywn523ee.js";
6
6
 
7
7
  // src/middleware/form-location.ts
8
8
  import { Instance } from "@opencode/core/instance/service";
@@ -1,20 +1,17 @@
1
1
  import {
2
- locationErrors2,
3
- awaitPlugins2
4
- } from "./request-tracing-50bbk3b2.js";
2
+ locationErrors2
3
+ } from "./content-headers-ywn523ee.js";
5
4
  import {
6
5
  Api2
7
- } from "./request-tracing-0e81et3m.js";
6
+ } from "./content-headers-zjmacp9c.js";
8
7
 
9
8
  // src/handlers/generate.ts
10
- import { Flag } from "@opencode/core/flag";
11
9
  import { Generate } from "@opencode/core/generate";
12
10
  import { VideoGeneration } from "@opencode/core/video-generation";
13
11
  import { Location } from "@opencode/core/location";
14
12
  import { LocationServiceMap } from "@opencode/core/location-services";
15
13
  import { AbsolutePath } from "@opencode/core/schema";
16
14
  import {
17
- ForbiddenError,
18
15
  VideoNotFoundError,
19
16
  InvalidRequestError,
20
17
  ModelNotFoundError,
@@ -31,12 +28,10 @@ var GenerateHandler2 = HttpApiBuilder.group(Api2, "server.generate", (handlers)
31
28
  const videos = yield* VideoGeneration.Service;
32
29
  const services = locations.get(Location.Ref.make({ directory: AbsolutePath.make(global.config) }));
33
30
  const text = Effect.fn("server.generate.text")(function* (request) {
34
- yield* awaitPlugins2;
35
31
  const generate = yield* Generate.Service;
36
32
  return { data: { text: yield* generate.text(request.payload).pipe(Effect.mapError(generateError)) } };
37
33
  }, Effect.provide(services), locationErrors2);
38
34
  const image = Effect.fn("server.generate.image")(function* (request) {
39
- yield* awaitPlugins2;
40
35
  const generate = yield* Generate.Service;
41
36
  return { data: yield* generate.image(request.payload).pipe(Effect.mapError(generateError)) };
42
37
  }, Effect.provide(services), locationErrors2);
@@ -47,22 +42,15 @@ var GenerateHandler2 = HttpApiBuilder.group(Api2, "server.generate", (handlers)
47
42
  message: "Decision question names must be unique",
48
43
  field: "questions"
49
44
  });
50
- yield* awaitPlugins2;
51
45
  const generate = yield* Generate.Service;
52
46
  return { data: yield* generate.decisions(request.payload).pipe(Effect.mapError(generateError)) };
53
47
  }, Effect.provide(services), locationErrors2);
54
- const videoEnabled = Effect.gen(function* () {
55
- if (yield* Flag.enabled("video_generate"))
56
- return;
57
- return yield* new ForbiddenError({ message: "Video generation is disabled; enable experimental.video_generate" });
58
- });
59
48
  const videoCreate = Effect.fn("server.generate.video.create")(function* (request) {
60
- yield* videoEnabled;
61
- yield* awaitPlugins2;
62
- return { data: yield* videos.start(request.payload).pipe(Effect.mapError(generateError)) };
49
+ return {
50
+ data: yield* videos.start(Generate.videoInput(request.payload)).pipe(Effect.mapError(generateError))
51
+ };
63
52
  }, Effect.provide(services), locationErrors2);
64
53
  const videoGet = Effect.fn("server.generate.video.get")(function* (request) {
65
- yield* videoEnabled;
66
54
  const job = yield* videos.get(request.params.id).pipe(Effect.mapError((error) => new VideoNotFoundError({ videoID: error.id, message: error.message })));
67
55
  return { data: job };
68
56
  }, Effect.provide(services), locationErrors2);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Api2
3
- } from "./request-tracing-0e81et3m.js";
3
+ } from "./content-headers-zjmacp9c.js";
4
4
 
5
5
  // src/handlers/config.ts
6
6
  import { Config } from "@opencode/core/config";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  response2
3
- } from "./request-tracing-50bbk3b2.js";
3
+ } from "./content-headers-ywn523ee.js";
4
4
  import {
5
5
  Api2
6
- } from "./request-tracing-0e81et3m.js";
6
+ } from "./content-headers-zjmacp9c.js";
7
7
  import {
8
8
  download2
9
- } from "./request-tracing-t32e1bbt.js";
9
+ } from "./content-headers-t32e1bbt.js";
10
10
  import {
11
11
  parse2
12
- } from "./request-tracing-8sb6qqpn.js";
12
+ } from "./content-headers-8sb6qqpn.js";
13
13
 
14
14
  // src/handlers/fs.ts
15
15
  import { FileSystem } from "@opencode/core/filesystem";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  CONTENT_SECURITY_POLICY2,
3
3
  disposition2
4
- } from "./request-tracing-t32e1bbt.js";
4
+ } from "./content-headers-t32e1bbt.js";
5
5
 
6
6
  // src/handlers/media.ts
7
7
  import { Database } from "@opencode/core/database/database";
@@ -1,44 +1,45 @@
1
1
  import {
2
2
  layer4
3
- } from "./request-tracing-50bbk3b2.js";
3
+ } from "./content-headers-ywn523ee.js";
4
4
  import {
5
5
  formLocationLayer2
6
- } from "./request-tracing-htyf2qs7.js";
6
+ } from "./content-headers-ah2sj2pr.js";
7
7
  import {
8
8
  sessionLocationLayer2
9
- } from "./request-tracing-b3bmdkga.js";
9
+ } from "./content-headers-vw0q3knq.js";
10
10
  import {
11
11
  Api2
12
- } from "./request-tracing-0e81et3m.js";
12
+ } from "./content-headers-zjmacp9c.js";
13
13
  import {
14
14
  Config2
15
- } from "./request-tracing-j4at0y5c.js";
15
+ } from "./content-headers-j4at0y5c.js";
16
16
  import {
17
17
  CorsConfig2
18
- } from "./request-tracing-q4bn6dy8.js";
18
+ } from "./content-headers-q4bn6dy8.js";
19
19
  import {
20
- layer3
21
- } from "./request-tracing-3te71694.js";
20
+ layer2
21
+ } from "./content-headers-z3e7v67k.js";
22
22
  import {
23
23
  node2
24
- } from "./request-tracing-mzs0n5xz.js";
24
+ } from "./content-headers-mzs0n5xz.js";
25
25
  import {
26
26
  handlers2
27
- } from "./request-tracing-0gf4dfn8.js";
27
+ } from "./content-headers-mvp6540g.js";
28
28
  import {
29
29
  authorizationLayer2
30
- } from "./request-tracing-7b9xm1qg.js";
30
+ } from "./content-headers-rktygpea.js";
31
31
  import {
32
32
  schemaErrorLayer2
33
- } from "./request-tracing-bd8755ek.js";
33
+ } from "./content-headers-bd8755ek.js";
34
34
  import {
35
35
  defectResponseLayer2
36
- } from "./request-tracing-n26yr6pw.js";
36
+ } from "./content-headers-n26yr6pw.js";
37
37
 
38
38
  // src/routes.ts
39
39
  import { Database } from "@opencode/core/database/database";
40
40
  import { V1Migration } from "@opencode/core/database/v1-migration";
41
41
  import { App } from "@opencode/core/app";
42
+ import { CodeModeApi } from "@opencode/core/codemode/api";
42
43
  import { LayerNode } from "@opencode/util/effect/layer-node";
43
44
  import { fetchLayer, httpClient, httpFetch } from "@opencode/util/effect/app-node-platform";
44
45
  import { AppNodeBuilder } from "@opencode/core/effect/app-node-builder";
@@ -68,6 +69,9 @@ import { FSUtil } from "@opencode/util/fs-util";
68
69
  import { InstructionDiscovery } from "@opencode/core/instruction-discovery";
69
70
  import { LocationServiceMap } from "@opencode/core/location-service-map";
70
71
  import { LocationActivity } from "@opencode/core/location-activity";
72
+ import { Identity } from "@opencode/core/machine/identity";
73
+ import { Machines } from "@opencode/core/machine/machines";
74
+ import { SessionSearchBuild } from "@opencode/core/session/search-build";
71
75
  import { ModelsDev } from "@opencode/core/models-dev";
72
76
  import { SessionRestart } from "@opencode/core/session/execution/restart";
73
77
  import { Automation } from "@opencode/core/automation";
@@ -77,11 +81,13 @@ import { WellKnown } from "@opencode/core/wellknown";
77
81
  import { Workspace } from "@opencode/core/workspace";
78
82
  import { Watcher } from "@opencode/core/filesystem/watcher";
79
83
  import { FileWatch } from "@opencode/core/filesystem/file-watch";
80
- import { HttpRouter } from "effect/http";
84
+ import { HttpEffect, HttpRouter } from "effect/http";
81
85
  import { HttpApiBuilder } from "effect/http-api";
82
86
  import { Context, Effect, Layer, Option } from "effect";
87
+ import { Base64 } from "effect/encoding";
83
88
  var applicationServiceNodes = [
84
89
  App.node,
90
+ CodeModeApi.node,
85
91
  Global.node,
86
92
  FSUtil.node,
87
93
  Database.node,
@@ -112,18 +118,37 @@ var applicationServiceNodes = [
112
118
  Automation.node,
113
119
  BlobStore.node,
114
120
  VideoGeneration.node,
121
+ SessionSearchBuild.node,
115
122
  Workspace.node,
123
+ Machines.node,
124
+ Identity.node,
116
125
  FileWatch.node
117
126
  ];
118
127
  var applicationServices = LayerNode.group(applicationServiceNodes);
119
128
  function createRoutes2(options = {}, serviceURLs = () => [], overrides = []) {
120
- return makeRoutes(options.password ? Config2.configLayer({ password: Option.some(options.password) }) : Config2.layer, options, serviceURLs, overrides);
129
+ return makeRoutes(options.password ? Option.some(options.password) : Option.none(), options, serviceURLs, overrides);
121
130
  }
122
131
  function createEmbeddedRoutes2(options = {}, overrides = [], instances) {
123
- return makeRoutes(Config2.configLayer({ password: Option.none() }), options, () => [], overrides, instances);
132
+ return makeRoutes(Option.none(), options, () => [], overrides, instances);
124
133
  }
125
- function makeRoutes(auth, options, serviceURLs, overrides, instances) {
134
+ function makeRoutes(password, options, serviceURLs, overrides, instances) {
135
+ const auth = Config2.configLayer({ password });
136
+ const credential = Option.map(password, (value) => `Basic ${Base64.encode(`opencode:${value}`)}`);
137
+ let internal;
126
138
  const standard = [
139
+ CodeModeApi.node.replace(Layer.succeed(CodeModeApi.Service, CodeModeApi.Service.of({
140
+ fetch: (request) => Effect.suspend(() => {
141
+ const handle = internal;
142
+ if (!handle)
143
+ return Effect.fail(new Error("The OpenCode API is not ready yet."));
144
+ if (Option.isSome(credential))
145
+ request.headers.set("authorization", credential.value);
146
+ return Effect.tryPromise({
147
+ try: () => handle(request),
148
+ catch: (error) => error instanceof Error ? error : new Error(String(error))
149
+ });
150
+ })
151
+ }))),
127
152
  Database.node.replace(Database.configured(options.database)),
128
153
  PersistentPty.node.replace(PersistentPty.configured(options.pty)),
129
154
  Bus.node.replace(Bus.configured({ persist: options.events?.persist })),
@@ -167,8 +192,10 @@ function makeRoutes(auth, options, serviceURLs, overrides, instances) {
167
192
  })) : build(overrides);
168
193
  return serviceLayer.pipe(Layer.flatMap((context) => {
169
194
  const services = Layer.succeedContext(context);
170
- const requestServices = Layer.merge(Layer.succeedContext(Context.pick(Database.Service, Credential.Service, PermissionSaved.Service, PluginUpdate.Service, Project.Service, WellKnown.Service)(context)), layer3(serviceURLs, Context.get(context, Global.Service).tmp, options.app));
171
- const api = HttpApiBuilder.layer(Api2, { openapiPath: "/openapi.json" }).pipe(Layer.provide(handlers2.pipe(Layer.provide(services), Layer.provide(Layer.succeed(CorsConfig2, options)))), Layer.provide(formLocationLayer2), Layer.provide(sessionLocationLayer2), Layer.provide(layer4), Layer.provide(authorizationLayer2), Layer.provide(schemaErrorLayer2), Layer.provide(auth), HttpRouter.provideRequest(requestServices), Layer.merge(defectResponseLayer2), Layer.provideMerge(services), Layer.provideMerge(HttpRouter.layer));
195
+ 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));
196
+ const api = HttpApiBuilder.layer(Api2, { openapiPath: "/openapi.json" }).pipe(Layer.provide(handlers2.pipe(Layer.provide(services), Layer.provide(Layer.succeed(CorsConfig2, options)))), Layer.provide(formLocationLayer2), Layer.provide(sessionLocationLayer2), Layer.provide(layer4), Layer.provide(authorizationLayer2), Layer.provide(schemaErrorLayer2), Layer.provide(auth), HttpRouter.provideRequest(requestServices), Layer.merge(defectResponseLayer2), Layer.provideMerge(services), Layer.provideMerge(HttpRouter.layer), Layer.tap((context) => Effect.sync(() => {
197
+ internal = Context.get(context, HttpRouter.HttpRouter).asHttpEffect().pipe(HttpEffect.toWebHandlerWith(context));
198
+ })));
172
199
  return Layer.merge(api, V1Migration.layer.pipe(Layer.provide(services)));
173
200
  }));
174
201
  }
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  download2
3
- } from "./request-tracing-t32e1bbt.js";
3
+ } from "./content-headers-t32e1bbt.js";
4
4
  import {
5
5
  parse2
6
- } from "./request-tracing-8sb6qqpn.js";
6
+ } from "./content-headers-8sb6qqpn.js";
7
7
 
8
8
  // src/handlers/blob.ts
9
9
  import { BlobStore } from "@opencode/core/blob-store";
@@ -19,7 +19,7 @@ var makeBlobGet2 = Effect.gen(function* () {
19
19
  const etag = `"${id}"`;
20
20
  const headers = {
21
21
  ...download2({ mime: blob.mime }),
22
- "cache-control": "private, max-age=604800, immutable",
22
+ "cache-control": "private, max-age=31536000, immutable",
23
23
  etag,
24
24
  "accept-ranges": "bytes"
25
25
  };
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  missingSession2
3
- } from "./request-tracing-smaf4a18.js";
3
+ } from "./content-headers-smaf4a18.js";
4
4
  import {
5
5
  locationErrors2,
6
6
  response2,
7
7
  sessionInfo2
8
- } from "./request-tracing-50bbk3b2.js";
8
+ } from "./content-headers-ywn523ee.js";
9
9
  import {
10
10
  Api2
11
- } from "./request-tracing-0e81et3m.js";
11
+ } from "./content-headers-zjmacp9c.js";
12
12
 
13
13
  // src/handlers/permission.ts
14
14
  import { Instance } from "@opencode/core/instance/service";
@@ -2,18 +2,18 @@ import {
2
2
  locationErrors2,
3
3
  response2,
4
4
  requestRef2
5
- } from "./request-tracing-50bbk3b2.js";
5
+ } from "./content-headers-ywn523ee.js";
6
6
  import {
7
7
  Api2
8
- } from "./request-tracing-0e81et3m.js";
8
+ } from "./content-headers-zjmacp9c.js";
9
9
  import {
10
10
  CorsConfig2,
11
11
  isAllowedRequestOrigin2
12
- } from "./request-tracing-q4bn6dy8.js";
12
+ } from "./content-headers-q4bn6dy8.js";
13
13
  import {
14
14
  runPtySocket2,
15
15
  holdLocation2
16
- } from "./request-tracing-q187pxxd.js";
16
+ } from "./content-headers-q187pxxd.js";
17
17
 
18
18
  // src/handlers/mcp.ts
19
19
  import { Location } from "@opencode/core/location";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  response2
3
- } from "./request-tracing-50bbk3b2.js";
3
+ } from "./content-headers-ywn523ee.js";
4
4
  import {
5
5
  Api2
6
- } from "./request-tracing-0e81et3m.js";
6
+ } from "./content-headers-zjmacp9c.js";
7
7
 
8
8
  // src/handlers/integration.ts
9
9
  import { Integration } from "@opencode/core/integration";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  isAllowedRequestOrigin2
3
- } from "./request-tracing-q4bn6dy8.js";
3
+ } from "./content-headers-q4bn6dy8.js";
4
4
  import {
5
5
  __export
6
- } from "./request-tracing-9rqn6x4v.js";
6
+ } from "./content-headers-9rqn6x4v.js";
7
7
 
8
8
  // src/request-site.ts
9
9
  var exports_request_site = {};
@@ -1,28 +1,32 @@
1
1
  import {
2
2
  Api2
3
- } from "./request-tracing-0e81et3m.js";
3
+ } from "./content-headers-zjmacp9c.js";
4
4
  import {
5
5
  CorsConfig2,
6
6
  isAllowedRequestOrigin2
7
- } from "./request-tracing-q4bn6dy8.js";
7
+ } from "./content-headers-q4bn6dy8.js";
8
8
  import {
9
9
  makeArtifact2
10
- } from "./request-tracing-p86kew8c.js";
10
+ } from "./content-headers-7qpea5x7.js";
11
11
  import {
12
12
  makeBlobGet2
13
- } from "./request-tracing-sy2e93cn.js";
13
+ } from "./content-headers-g23ffrnz.js";
14
14
  import {
15
15
  makeAutomation2
16
- } from "./request-tracing-9cd3a4b8.js";
16
+ } from "./content-headers-9cd3a4b8.js";
17
17
  import {
18
18
  makeJob2
19
- } from "./request-tracing-78rcgzsr.js";
19
+ } from "./content-headers-7ydfwv45.js";
20
+ import {
21
+ makeMachineLink2,
22
+ makeMachine2
23
+ } from "./content-headers-0rzj25w4.js";
20
24
  import {
21
25
  makeMediaGet2
22
- } from "./request-tracing-djr0jy89.js";
26
+ } from "./content-headers-djr0jy89.js";
23
27
  import {
24
28
  runPtySocket2
25
- } from "./request-tracing-q187pxxd.js";
29
+ } from "./content-headers-q187pxxd.js";
26
30
 
27
31
  // src/handlers/persistent-pty.ts
28
32
  import { PersistentPty } from "@opencode/core/persistent-pty";
@@ -51,7 +55,9 @@ var PersistentPtyHandler2 = HttpApiBuilder.group(Api2, "server.experimental", (h
51
55
  const mediaGet = yield* makeMediaGet2;
52
56
  const blobGet = yield* makeBlobGet2;
53
57
  const automation = yield* makeAutomation2;
54
- return handlers.handleRaw("media.get", (ctx) => mediaGet(ctx.params.hash, ctx.request)).handleRaw("blob.get", (ctx) => blobGet(ctx.params.id, ctx.request)).handle("job.list", (ctx) => job.list(ctx.query)).handle("artifacts.providers", (ctx) => artifact.providers(ctx.query, ctx.request)).handle("artifacts.list", (ctx) => artifact.list(ctx.query, ctx.request)).handle("artifacts.create", (ctx) => artifact.create(ctx.query, ctx.payload, ctx.request)).handle("artifacts.get", (ctx) => artifact.get(ctx.params.artifactID, ctx.query, ctx.request)).handle("artifacts.update", (ctx) => artifact.update(ctx.params.artifactID, ctx.query, ctx.payload, ctx.request)).handle("artifacts.delete", (ctx) => artifact.remove(ctx.params.artifactID, ctx.query, ctx.request)).handleRaw("artifacts.view", (ctx) => artifact.view(ctx.params.artifactID, ctx.query, ctx.request)).handle("automation.create", (ctx) => automation.create(ctx.payload)).handle("automation.list", (ctx) => automation.list(ctx.query)).handle("automation.get", (ctx) => automation.get(ctx.params.automationID)).handle("automation.pause", (ctx) => automation.pause(ctx.params.automationID)).handle("automation.resume", (ctx) => automation.resume(ctx.params.automationID)).handle("automation.delete", (ctx) => automation.remove(ctx.params.automationID)).handle("persistentPty.read", Effect.fn(function* (ctx) {
58
+ const machine = yield* makeMachine2;
59
+ const machineLink = yield* makeMachineLink2;
60
+ return handlers.handleRaw("media.get", (ctx) => mediaGet(ctx.params.hash, ctx.request)).handleRaw("blob.get", (ctx) => blobGet(ctx.params.id, ctx.request)).handle("job.list", (ctx) => job.list(ctx.query)).handle("job.cancel", (ctx) => job.cancel(ctx.params.id)).handleRaw("machine.link", (ctx) => machineLink(ctx.request)).handle("machine.list", () => machine.list()).handle("machine.add", (ctx) => machine.add(ctx.payload)).handle("machine.remove", (ctx) => machine.remove(ctx.params.name)).handle("artifacts.providers", (ctx) => artifact.providers(ctx.query, ctx.request)).handle("artifacts.list", (ctx) => artifact.list(ctx.query, ctx.request)).handle("artifacts.create", (ctx) => artifact.create(ctx.query, ctx.payload, ctx.request)).handle("artifacts.get", (ctx) => artifact.get(ctx.params.artifactID, ctx.query, ctx.request)).handle("artifacts.update", (ctx) => artifact.update(ctx.params.artifactID, ctx.query, ctx.payload, ctx.request)).handle("artifacts.delete", (ctx) => artifact.remove(ctx.params.artifactID, ctx.query, ctx.request)).handleRaw("artifacts.view", (ctx) => artifact.view(ctx.params.artifactID, ctx.query, ctx.request)).handle("automation.create", (ctx) => automation.create(ctx.payload)).handle("automation.list", (ctx) => automation.list(ctx.query)).handle("automation.get", (ctx) => automation.get(ctx.params.automationID)).handle("automation.pause", (ctx) => automation.pause(ctx.params.automationID)).handle("automation.resume", (ctx) => automation.resume(ctx.params.automationID)).handle("automation.delete", (ctx) => automation.remove(ctx.params.automationID)).handle("persistentPty.read", Effect.fn(function* (ctx) {
55
61
  return { data: yield* pty.read(ctx.params.sessionID, ctx.query.lines).pipe(mapUnavailable) };
56
62
  })).handle("persistentPty.list", Effect.fn(function* (ctx) {
57
63
  return { data: yield* pty.list(ctx.params.sessionID).pipe(mapUnavailable) };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __export
3
- } from "./request-tracing-9rqn6x4v.js";
3
+ } from "./content-headers-9rqn6x4v.js";
4
4
 
5
5
  // src/auth.ts
6
6
  var exports_auth = {};
@@ -2,18 +2,18 @@ import {
2
2
  locationErrors2,
3
3
  response2,
4
4
  requestRef2
5
- } from "./request-tracing-50bbk3b2.js";
5
+ } from "./content-headers-ywn523ee.js";
6
6
  import {
7
7
  Api2
8
- } from "./request-tracing-0e81et3m.js";
8
+ } from "./content-headers-zjmacp9c.js";
9
9
  import {
10
10
  CorsConfig2,
11
11
  isAllowedRequestOrigin2
12
- } from "./request-tracing-q4bn6dy8.js";
12
+ } from "./content-headers-q4bn6dy8.js";
13
13
  import {
14
14
  runPtySocket2,
15
15
  holdLocation2
16
- } from "./request-tracing-q187pxxd.js";
16
+ } from "./content-headers-q187pxxd.js";
17
17
 
18
18
  // src/handlers/pty.ts
19
19
  import { Pty } from "@opencode/core/pty";