@opencode/server 2.1.2 → 2.1.4

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 (114) hide show
  1. package/dist/api.d.ts +535 -657
  2. package/dist/api.js +5 -5
  3. package/dist/auth.js +1 -1
  4. package/dist/chunks/{request-tracing-8t0ckx4f.js → pairing-0dncng21.js} +6 -9
  5. package/dist/chunks/{request-tracing-zfbzqd0e.js → pairing-2b2wekgg.js} +3 -3
  6. package/dist/chunks/{request-tracing-t4c683g8.js → pairing-2yr2dq97.js} +2 -2
  7. package/dist/chunks/{request-tracing-4gnb9897.js → pairing-3154e7fk.js} +1 -1
  8. package/dist/chunks/{request-tracing-gw6rc7x0.js → pairing-31acg4hb.js} +2 -2
  9. package/dist/chunks/{request-tracing-5w24ch67.js → pairing-39nnfjx1.js} +4 -4
  10. package/dist/chunks/{request-tracing-g0rzwe5g.js → pairing-3te71694.js} +7 -7
  11. package/dist/chunks/{request-tracing-jd2d9483.js → pairing-49c878v9.js} +2 -2
  12. package/dist/chunks/{request-tracing-547pgmmc.js → pairing-4b0899hb.js} +2 -2
  13. package/dist/chunks/{request-tracing-bs0wtx09.js → pairing-4qjw9nya.js} +15 -38
  14. package/dist/chunks/{request-tracing-w4e9jgda.js → pairing-5w10ccet.js} +1 -1
  15. package/dist/chunks/{request-tracing-emkxpff3.js → pairing-6xea6nhh.js} +3 -3
  16. package/dist/chunks/{request-tracing-jk5edc6h.js → pairing-72ygafj3.js} +2 -2
  17. package/dist/chunks/{request-tracing-yfz2nrjq.js → pairing-7b9xm1qg.js} +3 -2
  18. package/dist/chunks/{request-tracing-s0qm098c.js → pairing-91mt6ewz.js} +2 -2
  19. package/dist/chunks/pairing-9me4q8wt.js +107 -0
  20. package/dist/chunks/{request-tracing-sc3gatcy.js → pairing-a6kxe6a7.js} +3 -3
  21. package/dist/chunks/{request-tracing-5qadbb61.js → pairing-aj1jc7g7.js} +8 -8
  22. package/dist/chunks/{request-tracing-7xe5pzvy.js → pairing-cfhthk6z.js} +1 -1
  23. package/dist/chunks/{request-tracing-cpp0zjdy.js → pairing-e4x9285j.js} +2 -2
  24. package/dist/chunks/{request-tracing-hwqxzcvy.js → pairing-e7pctymn.js} +1 -1
  25. package/dist/chunks/{request-tracing-qx5ydgm0.js → pairing-f4b2q3tn.js} +1 -1
  26. package/dist/chunks/{request-tracing-g7sdbt1s.js → pairing-ga3m49sz.js} +2 -2
  27. package/dist/chunks/{request-tracing-50bbk3b2.js → pairing-gymtz25n.js} +3 -3
  28. package/dist/chunks/{request-tracing-anm12x33.js → pairing-j4at0y5c.js} +1 -1
  29. package/dist/chunks/{request-tracing-3d7qdbre.js → pairing-j5aeaa16.js} +1 -1
  30. package/dist/chunks/{request-tracing-5ybpxcad.js → pairing-k6dz4enc.js} +4 -4
  31. package/dist/chunks/pairing-kaqtndqt.js +41 -0
  32. package/dist/chunks/{request-tracing-wexwfee0.js → pairing-kcjd09wg.js} +2 -2
  33. package/dist/chunks/{request-tracing-z6z134jc.js → pairing-kd6vzpgq.js} +2 -2
  34. package/dist/chunks/{request-tracing-kr61w04k.js → pairing-kqr36gas.js} +8 -8
  35. package/dist/chunks/{request-tracing-xgbwf6ck.js → pairing-kyxm98pg.js} +34 -34
  36. package/dist/chunks/{request-tracing-rw96z9cx.js → pairing-mte34432.js} +6 -6
  37. package/dist/chunks/{request-tracing-nnsgc8by.js → pairing-nv8hzzrz.js} +3 -3
  38. package/dist/chunks/{request-tracing-gq8jw616.js → pairing-pmjbkszz.js} +2 -2
  39. package/dist/chunks/pairing-q69f22pd.js +38 -0
  40. package/dist/chunks/{request-tracing-1ya81ktr.js → pairing-qvy2s3nb.js} +2 -2
  41. package/dist/chunks/{request-tracing-fazm2c7b.js → pairing-swdgbzpj.js} +2 -2
  42. package/dist/chunks/{request-tracing-4nbah0zs.js → pairing-t3j5ftv1.js} +3 -3
  43. package/dist/chunks/{request-tracing-tp6qcw6t.js → pairing-x0608mvx.js} +1 -1
  44. package/dist/chunks/{request-tracing-eyzmgmqx.js → pairing-x2dckmx1.js} +17 -19
  45. package/dist/chunks/{request-tracing-b3bmdkga.js → pairing-x74w7e1f.js} +1 -1
  46. package/dist/chunks/{request-tracing-qcfps8nc.js → pairing-x9vr2ttf.js} +2 -2
  47. package/dist/chunks/{request-tracing-fysmzcya.js → pairing-xmwystkq.js} +2 -2
  48. package/dist/cors.js +1 -1
  49. package/dist/event-feed.js +3 -3
  50. package/dist/fetch.js +49 -50
  51. package/dist/handlers/agent.js +6 -6
  52. package/dist/handlers/command.js +6 -6
  53. package/dist/handlers/config.js +6 -6
  54. package/dist/handlers/credential.js +6 -6
  55. package/dist/handlers/debug.d.ts +2 -1
  56. package/dist/handlers/debug.js +6 -6
  57. package/dist/handlers/event.js +7 -7
  58. package/dist/handlers/form.js +6 -6
  59. package/dist/handlers/fs.js +6 -6
  60. package/dist/handlers/generate.js +6 -6
  61. package/dist/handlers/integration.js +6 -6
  62. package/dist/handlers/location.js +6 -6
  63. package/dist/handlers/mcp.d.ts +3 -1
  64. package/dist/handlers/mcp.js +8 -6
  65. package/dist/handlers/message.js +6 -6
  66. package/dist/handlers/migration.js +6 -6
  67. package/dist/handlers/model.js +6 -6
  68. package/dist/handlers/permission.js +6 -6
  69. package/dist/handlers/persistent-pty.js +8 -8
  70. package/dist/handlers/plugin.js +6 -6
  71. package/dist/handlers/project.js +6 -6
  72. package/dist/handlers/provider.js +6 -6
  73. package/dist/handlers/pty-socket.js +1 -1
  74. package/dist/handlers/pty.d.ts +1 -2
  75. package/dist/handlers/pty.js +8 -9
  76. package/dist/handlers/reference.js +6 -6
  77. package/dist/handlers/rpc.js +6 -6
  78. package/dist/handlers/server.js +9 -9
  79. package/dist/handlers/session-error.js +1 -1
  80. package/dist/handlers/session.js +6 -6
  81. package/dist/handlers/shell.js +6 -6
  82. package/dist/handlers/skill.js +6 -6
  83. package/dist/handlers/vcs.js +6 -6
  84. package/dist/handlers/voice.js +6 -6
  85. package/dist/handlers/websearch.js +6 -6
  86. package/dist/handlers/worktree.js +6 -6
  87. package/dist/handlers.d.ts +1 -1
  88. package/dist/handlers.js +43 -44
  89. package/dist/location.js +4 -4
  90. package/dist/middleware/authorization.js +2 -2
  91. package/dist/middleware/form-location.js +3 -3
  92. package/dist/middleware/schema-error.js +1 -1
  93. package/dist/middleware/session-location.js +3 -3
  94. package/dist/pairing.js +5 -5
  95. package/dist/process.js +53 -53
  96. package/dist/request-tracing.js +1 -1
  97. package/dist/routes.d.ts +3 -3
  98. package/dist/routes.js +46 -47
  99. package/dist/server-info.js +5 -5
  100. package/dist/service-status.js +3 -3
  101. package/dist/workerd.js +50 -51
  102. package/package.json +12 -11
  103. package/dist/chunks/request-tracing-bkk2wfbz.js +0 -23
  104. package/dist/chunks/request-tracing-rhdada90.js +0 -20
  105. package/dist/chunks/request-tracing-xwnn9gpm.js +0 -30
  106. package/dist/chunks/request-tracing-yeebkdj0.js +0 -40
  107. package/dist/pty-environment.d.ts +0 -13
  108. package/dist/pty-environment.js +0 -12
  109. /package/dist/chunks/{request-tracing-9rqn6x4v.js → pairing-9rqn6x4v.js} +0 -0
  110. /package/dist/chunks/{request-tracing-erzfdgke.js → pairing-erzfdgke.js} +0 -0
  111. /package/dist/chunks/{request-tracing-h6rt5k9s.js → pairing-h6rt5k9s.js} +0 -0
  112. /package/dist/chunks/{request-tracing-q4bn6dy8.js → pairing-q4bn6dy8.js} +0 -0
  113. /package/dist/chunks/{request-tracing-smaf4a18.js → pairing-smaf4a18.js} +0 -0
  114. /package/dist/chunks/{request-tracing-yc7nft6q.js → pairing-yc7nft6q.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __export
3
- } from "./request-tracing-9rqn6x4v.js";
3
+ } from "./pairing-9rqn6x4v.js";
4
4
 
5
5
  // src/auth.ts
6
6
  var exports_auth = {};
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Api2
3
- } from "./request-tracing-4nbah0zs.js";
3
+ } from "./pairing-t3j5ftv1.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
  __export
3
- } from "./request-tracing-9rqn6x4v.js";
3
+ } from "./pairing-9rqn6x4v.js";
4
4
 
5
5
  // src/event-feed.ts
6
6
  var exports_event_feed = {};
@@ -11,7 +11,7 @@ __export(exports_event_feed, {
11
11
  SubscriberCapacity: () => SubscriberCapacity2,
12
12
  SubscriberOverflowError: () => SubscriberOverflowError2,
13
13
  frame: () => frame2,
14
- layer: () => layer3,
14
+ layer: () => layer4,
15
15
  make: () => make4
16
16
  });
17
17
  import { Bus } from "@opencode/core/bus";
@@ -75,9 +75,9 @@ var make4 = Effect.fn("EventFeed.make")(function* (observe, options) {
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 layer3 = Layer.effect(Service4, Effect.gen(function* () {
78
+ var layer4 = Layer.effect(Service4, Effect.gen(function* () {
79
79
  const bus = yield* Bus.Service;
80
80
  return yield* make4(bus.listen);
81
81
  }));
82
82
 
83
- export { SubscriberCapacity2, SubscriberOverflowError2, EncodingError2, Service4, frame2, make4, layer3, exports_event_feed };
83
+ export { SubscriberCapacity2, SubscriberOverflowError2, EncodingError2, Service4, frame2, make4, layer4, exports_event_feed };
@@ -0,0 +1,41 @@
1
+ import {
2
+ locationErrors2,
3
+ awaitPlugins2
4
+ } from "./pairing-gymtz25n.js";
5
+ import {
6
+ Api2
7
+ } from "./pairing-t3j5ftv1.js";
8
+
9
+ // src/handlers/voice.ts
10
+ import { Location } from "@opencode/core/location";
11
+ import { LocationServiceMap } from "@opencode/core/location-services";
12
+ import { AbsolutePath } from "@opencode/core/schema";
13
+ import { Voice } from "@opencode/core/voice";
14
+ import { InvalidRequestError, ServiceUnavailableError } from "@opencode/protocol/errors";
15
+ import { Global } from "@opencode/util/global";
16
+ import { Effect } from "effect";
17
+ import { HttpApiBuilder } from "effect/http-api";
18
+ var voiceErrors = (error) => error._tag === "Voice.InvalidRequestError" ? new InvalidRequestError({ message: error.message }) : new ServiceUnavailableError({ message: error.message, service: error.service });
19
+ var VoiceHandler2 = HttpApiBuilder.group(Api2, "server.voice", (handlers) => Effect.gen(function* () {
20
+ const global = yield* Global.Service;
21
+ const locations = yield* LocationServiceMap.Service;
22
+ const services = locations.get(Location.Ref.make({ directory: AbsolutePath.make(global.config) }));
23
+ return handlers.handle("voice.models", Effect.fn("server.voice.models")(function* () {
24
+ yield* awaitPlugins2;
25
+ const voice = yield* Voice.Service;
26
+ return { data: yield* voice.models() };
27
+ }, Effect.provide(services), locationErrors2)).handle("voice.session", Effect.fn("server.voice.session")(function* (request) {
28
+ yield* awaitPlugins2;
29
+ const voice = yield* Voice.Service;
30
+ const session = yield* voice.session(request.payload).pipe(Effect.mapError(voiceErrors));
31
+ return {
32
+ data: { transport: session.transport, ...session.id === undefined ? {} : { session: { id: session.id } } }
33
+ };
34
+ }, Effect.provide(services), locationErrors2)).handle("voice.instructions", Effect.fn("server.voice.instructions")(function* (request) {
35
+ yield* awaitPlugins2;
36
+ const voice = yield* Voice.Service;
37
+ yield* voice.instruct({ id: request.params.sessionID, instructions: request.payload.instructions }).pipe(Effect.mapError(voiceErrors));
38
+ }, Effect.provide(services), locationErrors2));
39
+ }));
40
+
41
+ export { VoiceHandler2 };
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  awaitPlugins2,
3
3
  response2
4
- } from "./request-tracing-50bbk3b2.js";
4
+ } from "./pairing-gymtz25n.js";
5
5
  import {
6
6
  Api2
7
- } from "./request-tracing-4nbah0zs.js";
7
+ } from "./pairing-t3j5ftv1.js";
8
8
 
9
9
  // src/handlers/websearch.ts
10
10
  import { WebSearch } from "@opencode/core/websearch";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  response2
3
- } from "./request-tracing-50bbk3b2.js";
3
+ } from "./pairing-gymtz25n.js";
4
4
  import {
5
5
  Api2
6
- } from "./request-tracing-4nbah0zs.js";
6
+ } from "./pairing-t3j5ftv1.js";
7
7
 
8
8
  // src/handlers/reference.ts
9
9
  import { Reference } from "@opencode/core/reference";
@@ -1,25 +1,25 @@
1
1
  import {
2
2
  __export
3
- } from "./request-tracing-9rqn6x4v.js";
3
+ } from "./pairing-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,
10
- node: () => node3
9
+ Service: () => Service2,
10
+ node: () => node2
11
11
  });
12
12
  import { Cache, Context, Duration, Effect, Layer } from "effect";
13
13
  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 node3 = makeGlobalNode({ service: Service3, layer, deps: [] });
33
+ var node2 = makeGlobalNode({ service: Service2, layer, deps: [] });
34
34
 
35
- export { Service3, node3, exports_pairing };
35
+ export { Service2, node2, exports_pairing };
@@ -1,102 +1,102 @@
1
1
  import {
2
2
  GenerateHandler2
3
- } from "./request-tracing-gq8jw616.js";
3
+ } from "./pairing-pmjbkszz.js";
4
4
  import {
5
5
  VoiceHandler2
6
- } from "./request-tracing-xwnn9gpm.js";
6
+ } from "./pairing-kaqtndqt.js";
7
7
  import {
8
8
  MessageHandler2
9
- } from "./request-tracing-8t0ckx4f.js";
9
+ } from "./pairing-0dncng21.js";
10
10
  import {
11
11
  ModelHandler2
12
- } from "./request-tracing-cpp0zjdy.js";
12
+ } from "./pairing-e4x9285j.js";
13
13
  import {
14
14
  ProviderHandler2
15
- } from "./request-tracing-fazm2c7b.js";
15
+ } from "./pairing-swdgbzpj.js";
16
16
  import {
17
17
  SessionHandler2
18
- } from "./request-tracing-nnsgc8by.js";
18
+ } from "./pairing-nv8hzzrz.js";
19
19
  import {
20
20
  PermissionHandler2
21
- } from "./request-tracing-emkxpff3.js";
21
+ } from "./pairing-6xea6nhh.js";
22
22
  import {
23
23
  FileSystemHandler2
24
- } from "./request-tracing-qcfps8nc.js";
24
+ } from "./pairing-x9vr2ttf.js";
25
25
  import {
26
26
  FormHandler2
27
- } from "./request-tracing-s0qm098c.js";
27
+ } from "./pairing-91mt6ewz.js";
28
28
  import {
29
29
  CommandHandler2
30
- } from "./request-tracing-fysmzcya.js";
30
+ } from "./pairing-xmwystkq.js";
31
31
  import {
32
32
  SkillHandler2
33
- } from "./request-tracing-547pgmmc.js";
33
+ } from "./pairing-4b0899hb.js";
34
34
  import {
35
35
  RpcHandler2
36
- } from "./request-tracing-w4e9jgda.js";
36
+ } from "./pairing-5w10ccet.js";
37
37
  import {
38
- layer3
39
- } from "./request-tracing-5ybpxcad.js";
38
+ layer4
39
+ } from "./pairing-k6dz4enc.js";
40
40
  import {
41
41
  EventHandler2
42
- } from "./request-tracing-1ya81ktr.js";
42
+ } from "./pairing-qvy2s3nb.js";
43
43
  import {
44
44
  AgentHandler2
45
- } from "./request-tracing-g7sdbt1s.js";
45
+ } from "./pairing-ga3m49sz.js";
46
46
  import {
47
47
  PluginHandler2
48
- } from "./request-tracing-jd2d9483.js";
48
+ } from "./pairing-49c878v9.js";
49
49
  import {
50
50
  ServerHandler2
51
- } from "./request-tracing-5qadbb61.js";
51
+ } from "./pairing-aj1jc7g7.js";
52
52
  import {
53
53
  DebugHandler2
54
- } from "./request-tracing-rhdada90.js";
54
+ } from "./pairing-q69f22pd.js";
55
55
  import {
56
56
  PtyHandler2
57
- } from "./request-tracing-bs0wtx09.js";
57
+ } from "./pairing-4qjw9nya.js";
58
58
  import {
59
59
  PersistentPtyHandler2
60
- } from "./request-tracing-sc3gatcy.js";
60
+ } from "./pairing-a6kxe6a7.js";
61
61
  import {
62
62
  ShellHandler2
63
- } from "./request-tracing-t4c683g8.js";
63
+ } from "./pairing-2yr2dq97.js";
64
64
  import {
65
65
  ReferenceHandler2
66
- } from "./request-tracing-z6z134jc.js";
66
+ } from "./pairing-kd6vzpgq.js";
67
67
  import {
68
68
  LocationHandler2
69
- } from "./request-tracing-7xe5pzvy.js";
69
+ } from "./pairing-cfhthk6z.js";
70
70
  import {
71
71
  IntegrationHandler2
72
- } from "./request-tracing-jk5edc6h.js";
72
+ } from "./pairing-72ygafj3.js";
73
73
  import {
74
74
  WebSearchHandler2
75
- } from "./request-tracing-wexwfee0.js";
75
+ } from "./pairing-kcjd09wg.js";
76
76
  import {
77
77
  McpHandler2
78
- } from "./request-tracing-yeebkdj0.js";
78
+ } from "./pairing-9me4q8wt.js";
79
79
  import {
80
80
  CredentialHandler2
81
- } from "./request-tracing-qx5ydgm0.js";
81
+ } from "./pairing-f4b2q3tn.js";
82
82
  import {
83
83
  ProjectHandler2
84
- } from "./request-tracing-3d7qdbre.js";
84
+ } from "./pairing-j5aeaa16.js";
85
85
  import {
86
86
  WorktreeHandler2
87
- } from "./request-tracing-zfbzqd0e.js";
87
+ } from "./pairing-2b2wekgg.js";
88
88
  import {
89
89
  VcsHandler2
90
- } from "./request-tracing-gw6rc7x0.js";
90
+ } from "./pairing-31acg4hb.js";
91
91
  import {
92
92
  MigrationHandler2
93
- } from "./request-tracing-tp6qcw6t.js";
93
+ } from "./pairing-x0608mvx.js";
94
94
  import {
95
95
  ConfigHandler2
96
- } from "./request-tracing-hwqxzcvy.js";
96
+ } from "./pairing-e7pctymn.js";
97
97
 
98
98
  // src/handlers.ts
99
99
  import { Layer } from "effect";
100
- var handlers2 = Layer.mergeAll(ServerHandler2, DebugHandler2, MigrationHandler2, LocationHandler2, AgentHandler2, PluginHandler2, SessionHandler2, MessageHandler2, ModelHandler2, GenerateHandler2, VoiceHandler2, ProviderHandler2, IntegrationHandler2, WebSearchHandler2, McpHandler2, CredentialHandler2, ProjectHandler2, FormHandler2, PermissionHandler2, FileSystemHandler2, CommandHandler2, SkillHandler2, RpcHandler2, EventHandler2.pipe(Layer.provide(layer3)), PtyHandler2, PersistentPtyHandler2, ShellHandler2, ReferenceHandler2, WorktreeHandler2, VcsHandler2, ConfigHandler2);
100
+ var handlers2 = Layer.mergeAll(ServerHandler2, DebugHandler2, MigrationHandler2, LocationHandler2, AgentHandler2, PluginHandler2, SessionHandler2, MessageHandler2, ModelHandler2, GenerateHandler2, VoiceHandler2, ProviderHandler2, IntegrationHandler2, WebSearchHandler2, McpHandler2, CredentialHandler2, ProjectHandler2, FormHandler2, PermissionHandler2, FileSystemHandler2, CommandHandler2, SkillHandler2, RpcHandler2, EventHandler2.pipe(Layer.provide(layer4)), PtyHandler2, PersistentPtyHandler2, ShellHandler2, ReferenceHandler2, WorktreeHandler2, VcsHandler2, ConfigHandler2);
101
101
 
102
102
  export { handlers2 };
@@ -1,26 +1,26 @@
1
1
  import {
2
2
  isAllowedCorsOrigin2
3
- } from "./request-tracing-q4bn6dy8.js";
3
+ } from "./pairing-q4bn6dy8.js";
4
4
  import {
5
5
  createRoutes2
6
- } from "./request-tracing-eyzmgmqx.js";
6
+ } from "./pairing-x2dckmx1.js";
7
7
  import {
8
8
  __export
9
- } from "./request-tracing-9rqn6x4v.js";
9
+ } from "./pairing-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 };
@@ -3,13 +3,13 @@ import {
3
3
  missingMessage2,
4
4
  failedMessageDecode2,
5
5
  failedSnapshot2
6
- } from "./request-tracing-smaf4a18.js";
6
+ } from "./pairing-smaf4a18.js";
7
7
  import {
8
8
  locationErrors2
9
- } from "./request-tracing-50bbk3b2.js";
9
+ } from "./pairing-gymtz25n.js";
10
10
  import {
11
11
  Api2
12
- } from "./request-tracing-4nbah0zs.js";
12
+ } from "./pairing-t3j5ftv1.js";
13
13
 
14
14
  // src/handlers/session.ts
15
15
  import { Session } from "@opencode/core/session";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  locationErrors2,
3
3
  awaitPlugins2
4
- } from "./request-tracing-50bbk3b2.js";
4
+ } from "./pairing-gymtz25n.js";
5
5
  import {
6
6
  Api2
7
- } from "./request-tracing-4nbah0zs.js";
7
+ } from "./pairing-t3j5ftv1.js";
8
8
 
9
9
  // src/handlers/generate.ts
10
10
  import { Generate } from "@opencode/core/generate";
@@ -0,0 +1,38 @@
1
+ import {
2
+ requestRef2
3
+ } from "./pairing-gymtz25n.js";
4
+ import {
5
+ Api2
6
+ } from "./pairing-t3j5ftv1.js";
7
+
8
+ // src/handlers/debug.ts
9
+ import { LocationServiceMap } from "@opencode/core/location-service-map";
10
+ import { InvalidRequestError, UnknownError } from "@opencode/protocol/errors";
11
+ import { Global } from "@opencode/util/global";
12
+ import { HeapSnapshot } from "@opencode/util/heap-snapshot";
13
+ import { Effect, Option, RcMap } from "effect";
14
+ import { HttpApiBuilder } from "effect/http-api";
15
+ import path from "node:path";
16
+ var DebugHandler2 = HttpApiBuilder.group(Api2, "server.debug", (handlers) => Effect.gen(function* () {
17
+ const global = yield* Global.Service;
18
+ return handlers.handle("debug.heapDump", Effect.fn("server.debug.heapDump")(function* (ctx) {
19
+ const directory = ctx.query.directory;
20
+ if (directory !== undefined && !path.isAbsolute(directory))
21
+ return yield* new InvalidRequestError({ message: "directory must be an absolute path", field: "directory" });
22
+ return yield* HeapSnapshot.write(directory ?? global.log).pipe(Effect.catch((cause) => {
23
+ const ref = `err_${crypto.randomUUID().slice(0, 8)}`;
24
+ return Effect.logError("failed to write heap snapshot", { cause }).pipe(Effect.annotateLogs({ ref }), Effect.andThen(Effect.fail(new UnknownError({
25
+ message: `Failed to write heap snapshot: ${cause.cause instanceof Error ? cause.cause.message : cause.message}`,
26
+ ref
27
+ }))));
28
+ }));
29
+ })).handle("debug.location", Effect.fn(function* () {
30
+ const locations = Option.getOrThrow(yield* Effect.serviceOption(LocationServiceMap.Service));
31
+ return Array.from(yield* RcMap.keys(locations.rcMap));
32
+ })).handle("debug.location.evict", Effect.fn(function* (ctx) {
33
+ const locations = Option.getOrThrow(yield* Effect.serviceOption(LocationServiceMap.Service));
34
+ yield* locations.invalidate(requestRef2(ctx.request));
35
+ }));
36
+ }));
37
+
38
+ export { DebugHandler2 };
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  Api2
3
- } from "./request-tracing-4nbah0zs.js";
3
+ } from "./pairing-t3j5ftv1.js";
4
4
  import {
5
5
  Service4,
6
6
  frame2
7
- } from "./request-tracing-5ybpxcad.js";
7
+ } from "./pairing-k6dz4enc.js";
8
8
 
9
9
  // src/handlers/event.ts
10
10
  import { Event } from "@opencode/schema/event";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  response2
3
- } from "./request-tracing-50bbk3b2.js";
3
+ } from "./pairing-gymtz25n.js";
4
4
  import {
5
5
  Api2
6
- } from "./request-tracing-4nbah0zs.js";
6
+ } from "./pairing-t3j5ftv1.js";
7
7
 
8
8
  // src/handlers/provider.ts
9
9
  import { Provider } from "@opencode/core/provider";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  LocationMiddleware2
3
- } from "./request-tracing-50bbk3b2.js";
3
+ } from "./pairing-gymtz25n.js";
4
4
  import {
5
5
  FormLocationMiddleware2
6
- } from "./request-tracing-4gnb9897.js";
6
+ } from "./pairing-3154e7fk.js";
7
7
  import {
8
8
  SessionLocationMiddleware2
9
- } from "./request-tracing-b3bmdkga.js";
9
+ } from "./pairing-x74w7e1f.js";
10
10
 
11
11
  // src/api.ts
12
12
  import { makeDefaultApi } from "@opencode/protocol/api";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Api2
3
- } from "./request-tracing-4nbah0zs.js";
3
+ } from "./pairing-t3j5ftv1.js";
4
4
 
5
5
  // src/handlers/migration.ts
6
6
  import { V1Migration } from "@opencode/core/database/v1-migration";
@@ -1,39 +1,36 @@
1
1
  import {
2
- layer4
3
- } from "./request-tracing-50bbk3b2.js";
2
+ layer2
3
+ } from "./pairing-gymtz25n.js";
4
4
  import {
5
5
  formLocationLayer2
6
- } from "./request-tracing-4gnb9897.js";
6
+ } from "./pairing-3154e7fk.js";
7
7
  import {
8
8
  sessionLocationLayer2
9
- } from "./request-tracing-b3bmdkga.js";
9
+ } from "./pairing-x74w7e1f.js";
10
10
  import {
11
11
  Api2
12
- } from "./request-tracing-4nbah0zs.js";
12
+ } from "./pairing-t3j5ftv1.js";
13
13
  import {
14
14
  Config2
15
- } from "./request-tracing-anm12x33.js";
15
+ } from "./pairing-j4at0y5c.js";
16
16
  import {
17
17
  CorsConfig2
18
- } from "./request-tracing-q4bn6dy8.js";
18
+ } from "./pairing-q4bn6dy8.js";
19
19
  import {
20
- layer5
21
- } from "./request-tracing-g0rzwe5g.js";
22
- import {
23
- node3
24
- } from "./request-tracing-kr61w04k.js";
20
+ layer3
21
+ } from "./pairing-3te71694.js";
25
22
  import {
26
23
  node2
27
- } from "./request-tracing-bkk2wfbz.js";
24
+ } from "./pairing-kqr36gas.js";
28
25
  import {
29
26
  handlers2
30
- } from "./request-tracing-xgbwf6ck.js";
27
+ } from "./pairing-kyxm98pg.js";
31
28
  import {
32
29
  authorizationLayer2
33
- } from "./request-tracing-yfz2nrjq.js";
30
+ } from "./pairing-7b9xm1qg.js";
34
31
  import {
35
32
  schemaErrorLayer2
36
- } from "./request-tracing-erzfdgke.js";
33
+ } from "./pairing-erzfdgke.js";
37
34
 
38
35
  // src/routes.ts
39
36
  import { Database } from "@opencode/core/database/database";
@@ -59,6 +56,7 @@ import { ShellSelect } from "@opencode/core/shell/select";
59
56
  import { Job } from "@opencode/core/job";
60
57
  import { Mcp } from "@opencode/core/mcp/index";
61
58
  import { Global } from "@opencode/util/global";
59
+ import { FSUtil } from "@opencode/util/fs-util";
62
60
  import { InstructionDiscovery } from "@opencode/core/instruction-discovery";
63
61
  import { LocationServiceMap } from "@opencode/core/location-service-map";
64
62
  import { LocationActivity } from "@opencode/core/location-activity";
@@ -74,6 +72,7 @@ import { HttpApiBuilder } from "effect/http-api";
74
72
  import { Context, Effect, Layer, Option } from "effect";
75
73
  var applicationServiceNodes = [
76
74
  Global.node,
75
+ FSUtil.node,
77
76
  Database.node,
78
77
  Bus.node,
79
78
  EventLogger.node,
@@ -93,7 +92,6 @@ var applicationServiceNodes = [
93
92
  Credential.node,
94
93
  WellKnown.node,
95
94
  node2,
96
- node3,
97
95
  LocationServiceMap.node,
98
96
  LocationActivity.node,
99
97
  SessionRestart.node,
@@ -146,8 +144,8 @@ function makeRoutes(auth, options, serviceURLs, overrides, instances) {
146
144
  })) : build(overrides);
147
145
  return serviceLayer.pipe(Layer.flatMap((context) => {
148
146
  const services = Layer.succeedContext(context);
149
- const requestServices = Layer.merge(Layer.succeedContext(Context.pick(Database.Service, Credential.Service, PermissionSaved.Service, PluginUpdate.Service, Project.Service, WellKnown.Service)(context)), layer5(serviceURLs, Context.get(context, Global.Service).tmp, options.app));
150
- 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.provideMerge(services), Layer.provideMerge(HttpRouter.layer));
147
+ 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));
148
+ 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(layer2), Layer.provide(authorizationLayer2), Layer.provide(schemaErrorLayer2), Layer.provide(auth), HttpRouter.provideRequest(requestServices), Layer.provideMerge(services), Layer.provideMerge(HttpRouter.layer));
151
149
  return Layer.merge(api, V1Migration.layer.pipe(Layer.provide(services)));
152
150
  }));
153
151
  }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  locationErrors2,
3
3
  sessionInfo2
4
- } from "./request-tracing-50bbk3b2.js";
4
+ } from "./pairing-gymtz25n.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 "./request-tracing-50bbk3b2.js";
3
+ } from "./pairing-gymtz25n.js";
4
4
  import {
5
5
  Api2
6
- } from "./request-tracing-4nbah0zs.js";
6
+ } from "./pairing-t3j5ftv1.js";
7
7
 
8
8
  // src/handlers/fs.ts
9
9
  import { FileSystem } from "@opencode/core/filesystem";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  response2
3
- } from "./request-tracing-50bbk3b2.js";
3
+ } from "./pairing-gymtz25n.js";
4
4
  import {
5
5
  Api2
6
- } from "./request-tracing-4nbah0zs.js";
6
+ } from "./pairing-t3j5ftv1.js";
7
7
 
8
8
  // src/handlers/command.ts
9
9
  import { Command } from "@opencode/core/command";
package/dist/cors.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  CorsConfig2,
3
3
  isAllowedCorsOrigin2,
4
4
  isAllowedRequestOrigin2
5
- } from "./chunks/request-tracing-q4bn6dy8.js";
5
+ } from "./chunks/pairing-q4bn6dy8.js";
6
6
  export {
7
7
  CorsConfig2 as CorsConfig,
8
8
  isAllowedCorsOrigin2 as isAllowedCorsOrigin,
@@ -5,9 +5,9 @@ import {
5
5
  Service4,
6
6
  frame2,
7
7
  make4,
8
- layer3,
8
+ layer4,
9
9
  exports_event_feed
10
- } from "./chunks/request-tracing-5ybpxcad.js";
10
+ } from "./chunks/pairing-k6dz4enc.js";
11
11
  export {
12
12
  EncodingError2 as EncodingError,
13
13
  exports_event_feed as EventFeed,
@@ -15,6 +15,6 @@ export {
15
15
  SubscriberCapacity2 as SubscriberCapacity,
16
16
  SubscriberOverflowError2 as SubscriberOverflowError,
17
17
  frame2 as frame,
18
- layer3 as layer,
18
+ layer4 as layer,
19
19
  make4 as make
20
20
  };