@opencode/server 2.3.2 → 2.4.1

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 (136) 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/workerd-0rzj25w4.js +194 -0
  5. package/dist/chunks/{media-uri-2eaky32g.js → workerd-20wvj9q6.js} +2 -2
  6. package/dist/chunks/{media-uri-39nnfjx1.js → workerd-39nnfjx1.js} +1 -1
  7. package/dist/chunks/{media-uri-tbqv89f6.js → workerd-3rn5pzng.js} +5 -5
  8. package/dist/chunks/{media-uri-ny1j968n.js → workerd-4apj6a8e.js} +2 -2
  9. package/dist/chunks/{media-uri-09kw3a77.js → workerd-4gbck4qg.js} +2 -2
  10. package/dist/chunks/{media-uri-91858wp1.js → workerd-4r2ye500.js} +2 -2
  11. package/dist/chunks/{media-uri-sssj0qa5.js → workerd-5dgtfnrn.js} +47 -20
  12. package/dist/chunks/{media-uri-az0609r6.js → workerd-6t6fd9bq.js} +2 -4
  13. package/dist/chunks/{media-uri-wmep189j.js → workerd-73tyf2qy.js} +8 -8
  14. package/dist/chunks/{media-uri-cmnrxx36.js → workerd-77gnb026.js} +4 -4
  15. package/dist/chunks/{media-uri-z3e7v67k.js → workerd-7dtbad8d.js} +7 -7
  16. package/dist/chunks/{media-uri-kkdkqt8j.js → workerd-7x6cg3xs.js} +2 -4
  17. package/dist/chunks/{media-uri-78rcgzsr.js → workerd-7ydfwv45.js} +4 -1
  18. package/dist/chunks/{media-uri-yk755swr.js → workerd-86dz2n4m.js} +5 -4
  19. package/dist/chunks/{media-uri-1h6b4sc5.js → workerd-8mfdzabk.js} +6 -18
  20. package/dist/chunks/{media-uri-btahnm2b.js → workerd-8n1ypg70.js} +3 -3
  21. package/dist/chunks/{media-uri-8sb6qqpn.js → workerd-8sb6qqpn.js} +1 -1
  22. package/dist/chunks/{media-uri-qd0r787n.js → workerd-b1x3j2e8.js} +2 -2
  23. package/dist/chunks/{media-uri-qcg3sqtb.js → workerd-b7yt2ykh.js} +2 -2
  24. package/dist/chunks/{media-uri-4q6e7fh8.js → workerd-b87bs0cf.js} +2 -2
  25. package/dist/chunks/{media-uri-z9zyd4qg.js → workerd-bvm82fhd.js} +4 -4
  26. package/dist/chunks/{media-uri-rha2aq18.js → workerd-d0advawr.js} +2 -5
  27. package/dist/chunks/{media-uri-djr0jy89.js → workerd-djr0jy89.js} +1 -1
  28. package/dist/chunks/{media-uri-ssxxka7j.js → workerd-dqfyxmp4.js} +4 -4
  29. package/dist/chunks/{media-uri-a8jcac9a.js → workerd-edwk6ehd.js} +1 -1
  30. package/dist/chunks/{media-uri-qfyg9gb7.js → workerd-fvpjvjpp.js} +7 -7
  31. package/dist/chunks/{media-uri-cr5sd8bz.js → workerd-g23ffrnz.js} +3 -3
  32. package/dist/chunks/{media-uri-rs3v36hp.js → workerd-g80pvn6e.js} +2 -2
  33. package/dist/chunks/{media-uri-cezwbsk5.js → workerd-g97h7k0s.js} +1 -1
  34. package/dist/chunks/workerd-hgrkvk6s.js +48 -0
  35. package/dist/chunks/{media-uri-j4at0y5c.js → workerd-j4at0y5c.js} +1 -1
  36. package/dist/chunks/{media-uri-50bbk3b2.js → workerd-j80tzjj3.js} +4 -12
  37. package/dist/chunks/{media-uri-3pb3n73h.js → workerd-jpqse2v9.js} +35 -35
  38. package/dist/chunks/{media-uri-8mj7kvhm.js → workerd-k26h7zjg.js} +2 -2
  39. package/dist/chunks/{media-uri-b4rhnd07.js → workerd-kffke7z4.js} +15 -9
  40. package/dist/chunks/{media-uri-myqk22k5.js → workerd-myqk22k5.js} +2 -2
  41. package/dist/chunks/{media-uri-htyf2qs7.js → workerd-n6ypjnhz.js} +1 -1
  42. package/dist/chunks/{media-uri-6kawhtwy.js → workerd-nkfbbfe7.js} +4 -4
  43. package/dist/chunks/{media-uri-5cpb32hf.js → workerd-p4zkxzv7.js} +1 -1
  44. package/dist/chunks/{media-uri-enp1bp7r.js → workerd-p9wp66hf.js} +1 -1
  45. package/dist/chunks/{media-uri-6z9pvq7p.js → workerd-pv4dnzzq.js} +1 -1
  46. package/dist/chunks/{media-uri-b3bmdkga.js → workerd-qahj7606.js} +1 -1
  47. package/dist/chunks/{media-uri-7b9xm1qg.js → workerd-rktygpea.js} +4 -1
  48. package/dist/chunks/{media-uri-j87xz9bt.js → workerd-s8t5gq7c.js} +3 -3
  49. package/dist/chunks/{media-uri-t32e1bbt.js → workerd-t32e1bbt.js} +1 -1
  50. package/dist/chunks/{media-uri-p86kew8c.js → workerd-t62b1gmw.js} +2 -2
  51. package/dist/chunks/{media-uri-te8jwba1.js → workerd-t8azv5ge.js} +2 -2
  52. package/dist/chunks/{media-uri-d0edqfxx.js → workerd-v0z8pce5.js} +3 -6
  53. package/dist/chunks/{media-uri-n0chxnkn.js → workerd-vxy32kc1.js} +4 -4
  54. package/dist/chunks/{media-uri-1gwc8nvb.js → workerd-w13ad1dk.js} +3 -3
  55. package/dist/chunks/{media-uri-mzs0n5xz.js → workerd-w9jcwh65.js} +7 -7
  56. package/dist/chunks/{media-uri-zcvan105.js → workerd-wh07bcjv.js} +1 -1
  57. package/dist/chunks/{media-uri-f559fakr.js → workerd-zrptb2x8.js} +2 -2
  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 +2 -4
  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 +4 -6
  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 +3 -3
  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/media-uri-9cd3a4b8.js +0 -69
  129. /package/dist/chunks/{media-uri-9rqn6x4v.js → workerd-9rqn6x4v.js} +0 -0
  130. /package/dist/chunks/{media-uri-bd8755ek.js → workerd-bd8755ek.js} +0 -0
  131. /package/dist/chunks/{media-uri-n26yr6pw.js → workerd-n26yr6pw.js} +0 -0
  132. /package/dist/chunks/{media-uri-q187pxxd.js → workerd-q187pxxd.js} +0 -0
  133. /package/dist/chunks/{media-uri-q4bn6dy8.js → workerd-q4bn6dy8.js} +0 -0
  134. /package/dist/chunks/{media-uri-smaf4a18.js → workerd-smaf4a18.js} +0 -0
  135. /package/dist/chunks/{media-uri-xthc02cw.js → workerd-xthc02cw.js} +0 -0
  136. /package/dist/chunks/{media-uri-yc7nft6q.js → workerd-yc7nft6q.js} +0 -0
@@ -0,0 +1,48 @@
1
+ import {
2
+ missingSession2
3
+ } from "./workerd-smaf4a18.js";
4
+
5
+ // src/handlers/automation.ts
6
+ import { Automation } from "@opencode/core/automation";
7
+ import { Permission } from "@opencode/core/permission";
8
+ import { AutomationNotFoundError, ForbiddenError, InvalidRequestError } from "@opencode/protocol/errors";
9
+ import { Effect } from "effect";
10
+ import { HttpApiSchema } from "effect/http-api";
11
+ var makeAutomation2 = Effect.gen(function* () {
12
+ const automations = yield* Automation.Service;
13
+ return {
14
+ create: (payload) => automations.create(payload).pipe(Effect.provideService(Permission.Unattended, []), Effect.map((data) => ({ data })), Effect.catchTags({
15
+ "Automation.InvalidError": (error) => Effect.fail(new InvalidRequestError({ message: error.message, kind: "automation" })),
16
+ "Automation.DisabledError": () => Effect.fail(disabled()),
17
+ "Permission.BlockedError": (error) => Effect.fail(new ForbiddenError({ message: error.message })),
18
+ "Permission.CorrectedError": (error) => Effect.fail(new ForbiddenError({ message: error.feedback })),
19
+ "Session.NotFoundError": (error) => Effect.fail(missingSession2(error))
20
+ })),
21
+ list: (query) => automations.list(query).pipe(Effect.map((data) => ({ data })), Effect.catchTags({
22
+ "Automation.InvalidError": (error) => Effect.fail(new InvalidRequestError({ message: error.message, kind: "automation" })),
23
+ "Automation.DisabledError": () => Effect.fail(disabled()),
24
+ "Session.NotFoundError": (error) => Effect.fail(missingSession2(error))
25
+ })),
26
+ get: (id) => managed(automations.get(id).pipe(Effect.map((data) => ({ data })))),
27
+ pause: (id) => managed(automations.pause(id).pipe(Effect.map((data) => ({ data })))),
28
+ resume: (id) => managed(automations.resume(id).pipe(Effect.map((data) => ({ data })))),
29
+ remove: (id) => managed(automations.remove(id).pipe(Effect.as(HttpApiSchema.NoContent.make())))
30
+ };
31
+ });
32
+ function managed(effect) {
33
+ return effect.pipe(Effect.catchTags({
34
+ "Automation.NotFoundError": (error) => Effect.fail(missingAutomation(error)),
35
+ "Automation.DisabledError": () => Effect.fail(disabled())
36
+ }));
37
+ }
38
+ function missingAutomation(error) {
39
+ return new AutomationNotFoundError({
40
+ automationID: error.automationID,
41
+ message: `Automation not found: ${error.automationID}`
42
+ });
43
+ }
44
+ function disabled() {
45
+ return new ForbiddenError({ message: new Automation.DisabledError().message });
46
+ }
47
+
48
+ export { makeAutomation2 };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __export
3
- } from "./media-uri-9rqn6x4v.js";
3
+ } from "./workerd-9rqn6x4v.js";
4
4
 
5
5
  // src/auth.ts
6
6
  var exports_auth = {};
@@ -1,15 +1,14 @@
1
1
  import {
2
2
  missingSession2
3
- } from "./media-uri-smaf4a18.js";
3
+ } from "./workerd-smaf4a18.js";
4
4
 
5
5
  // src/location.ts
6
6
  import { FileSystem } from "@opencode/core/filesystem";
7
7
  import { Location } from "@opencode/core/location";
8
- import { Plugin } from "@opencode/core/plugin";
9
8
  import { LocationServiceMap } from "@opencode/core/location-services";
10
9
  import { AbsolutePath } from "@opencode/core/schema";
11
10
  import { Session } from "@opencode/core/session";
12
- import { LocationNotFoundError, InvalidRequestError, ServiceUnavailableError } from "@opencode/protocol/errors";
11
+ import { LocationNotFoundError, InvalidRequestError } from "@opencode/protocol/errors";
13
12
  import { Effect, Layer, Schema } from "effect";
14
13
  import { HttpServerRequest } from "effect/http";
15
14
  import { HttpApiMiddleware } from "effect/http-api";
@@ -21,13 +20,6 @@ function locationErrors2(effect) {
21
20
  message: `Location not found: ${error.directory}`
22
21
  }))));
23
22
  }
24
- var awaitPlugins2 = Plugin.awaitActivation.pipe(Effect.timeoutOrElse({
25
- duration: "5 seconds",
26
- orElse: () => Effect.fail(new ServiceUnavailableError({
27
- message: "Location plugins did not finish activating",
28
- service: "plugin"
29
- }))
30
- }));
31
23
  function response2(data) {
32
24
  return Effect.gen(function* () {
33
25
  const location = yield* Location.Service;
@@ -59,7 +51,7 @@ function decode(input) {
59
51
  return input;
60
52
  }
61
53
  }
62
- var layer4 = Layer.effect(LocationMiddleware2, Effect.gen(function* () {
54
+ var layer3 = Layer.effect(LocationMiddleware2, Effect.gen(function* () {
63
55
  const locations = yield* LocationServiceMap.Service;
64
56
  return LocationMiddleware2.of((effect) => Effect.gen(function* () {
65
57
  const request = yield* HttpServerRequest.HttpServerRequest;
@@ -67,4 +59,4 @@ var layer4 = Layer.effect(LocationMiddleware2, Effect.gen(function* () {
67
59
  }));
68
60
  }));
69
61
 
70
- export { LocationMiddleware2, locationErrors2, awaitPlugins2, response2, sessionInfo2, requestRef2, layer4 };
62
+ export { LocationMiddleware2, locationErrors2, response2, sessionInfo2, requestRef2, layer3 };
@@ -1,105 +1,105 @@
1
1
  import {
2
2
  GenerateHandler2
3
- } from "./media-uri-1h6b4sc5.js";
3
+ } from "./workerd-8mfdzabk.js";
4
4
  import {
5
5
  VoiceHandler2
6
- } from "./media-uri-d0edqfxx.js";
6
+ } from "./workerd-v0z8pce5.js";
7
7
  import {
8
8
  MessageHandler2
9
- } from "./media-uri-1gwc8nvb.js";
9
+ } from "./workerd-w13ad1dk.js";
10
10
  import {
11
11
  ModelHandler2
12
- } from "./media-uri-rha2aq18.js";
12
+ } from "./workerd-d0advawr.js";
13
13
  import {
14
14
  ProviderHandler2
15
- } from "./media-uri-az0609r6.js";
15
+ } from "./workerd-6t6fd9bq.js";
16
16
  import {
17
17
  SessionHandler2
18
- } from "./media-uri-ssxxka7j.js";
18
+ } from "./workerd-dqfyxmp4.js";
19
19
  import {
20
20
  PermissionHandler2
21
- } from "./media-uri-btahnm2b.js";
21
+ } from "./workerd-8n1ypg70.js";
22
22
  import {
23
23
  FileSystemHandler2
24
- } from "./media-uri-n0chxnkn.js";
24
+ } from "./workerd-vxy32kc1.js";
25
25
  import {
26
26
  FormHandler2
27
- } from "./media-uri-f559fakr.js";
27
+ } from "./workerd-zrptb2x8.js";
28
28
  import {
29
29
  CommandHandler2
30
- } from "./media-uri-4q6e7fh8.js";
30
+ } from "./workerd-b87bs0cf.js";
31
31
  import {
32
32
  SkillHandler2
33
- } from "./media-uri-ny1j968n.js";
33
+ } from "./workerd-4apj6a8e.js";
34
34
  import {
35
35
  RpcHandler2
36
- } from "./media-uri-5cpb32hf.js";
36
+ } from "./workerd-p4zkxzv7.js";
37
37
  import {
38
- layer3
39
- } from "./media-uri-qfyg9gb7.js";
38
+ layer2
39
+ } from "./workerd-fvpjvjpp.js";
40
40
  import {
41
41
  EventHandler2
42
- } from "./media-uri-cmnrxx36.js";
42
+ } from "./workerd-77gnb026.js";
43
43
  import {
44
44
  AgentHandler2
45
- } from "./media-uri-8mj7kvhm.js";
45
+ } from "./workerd-k26h7zjg.js";
46
46
  import {
47
47
  PluginHandler2
48
- } from "./media-uri-2eaky32g.js";
48
+ } from "./workerd-20wvj9q6.js";
49
49
  import {
50
50
  ServerHandler2
51
- } from "./media-uri-wmep189j.js";
51
+ } from "./workerd-73tyf2qy.js";
52
52
  import {
53
53
  DebugHandler2
54
- } from "./media-uri-qcg3sqtb.js";
54
+ } from "./workerd-b7yt2ykh.js";
55
55
  import {
56
56
  PtyHandler2
57
- } from "./media-uri-6kawhtwy.js";
57
+ } from "./workerd-nkfbbfe7.js";
58
58
  import {
59
59
  PersistentPtyHandler2
60
- } from "./media-uri-b4rhnd07.js";
60
+ } from "./workerd-kffke7z4.js";
61
61
  import {
62
62
  ShellHandler2
63
- } from "./media-uri-qd0r787n.js";
63
+ } from "./workerd-b1x3j2e8.js";
64
64
  import {
65
65
  ReferenceHandler2
66
- } from "./media-uri-te8jwba1.js";
66
+ } from "./workerd-t8azv5ge.js";
67
67
  import {
68
68
  LocationHandler2
69
- } from "./media-uri-zcvan105.js";
69
+ } from "./workerd-wh07bcjv.js";
70
70
  import {
71
71
  IntegrationHandler2
72
- } from "./media-uri-91858wp1.js";
72
+ } from "./workerd-4r2ye500.js";
73
73
  import {
74
74
  WebSearchHandler2
75
- } from "./media-uri-kkdkqt8j.js";
75
+ } from "./workerd-7x6cg3xs.js";
76
76
  import {
77
77
  UsageHandler2
78
- } from "./media-uri-09kw3a77.js";
78
+ } from "./workerd-4gbck4qg.js";
79
79
  import {
80
80
  McpHandler2
81
- } from "./media-uri-z9zyd4qg.js";
81
+ } from "./workerd-bvm82fhd.js";
82
82
  import {
83
83
  CredentialHandler2
84
- } from "./media-uri-yk755swr.js";
84
+ } from "./workerd-86dz2n4m.js";
85
85
  import {
86
86
  ProjectHandler2
87
- } from "./media-uri-a8jcac9a.js";
87
+ } from "./workerd-edwk6ehd.js";
88
88
  import {
89
89
  WorktreeHandler2
90
- } from "./media-uri-enp1bp7r.js";
90
+ } from "./workerd-p9wp66hf.js";
91
91
  import {
92
92
  VcsHandler2
93
- } from "./media-uri-rs3v36hp.js";
93
+ } from "./workerd-g80pvn6e.js";
94
94
  import {
95
95
  MigrationHandler2
96
- } from "./media-uri-6z9pvq7p.js";
96
+ } from "./workerd-pv4dnzzq.js";
97
97
  import {
98
98
  ConfigHandler2
99
- } from "./media-uri-cezwbsk5.js";
99
+ } from "./workerd-g97h7k0s.js";
100
100
 
101
101
  // src/handlers.ts
102
102
  import { Layer } from "effect";
103
- var handlers2 = Layer.mergeAll(ServerHandler2, DebugHandler2, MigrationHandler2, LocationHandler2, AgentHandler2, PluginHandler2, SessionHandler2, MessageHandler2, ModelHandler2, GenerateHandler2, VoiceHandler2, ProviderHandler2, IntegrationHandler2, WebSearchHandler2, UsageHandler2, McpHandler2, CredentialHandler2, ProjectHandler2, FormHandler2, PermissionHandler2, FileSystemHandler2, CommandHandler2, SkillHandler2, RpcHandler2, EventHandler2.pipe(Layer.provide(layer3)), PtyHandler2, PersistentPtyHandler2, ShellHandler2, ReferenceHandler2, WorktreeHandler2, VcsHandler2, ConfigHandler2);
103
+ var handlers2 = Layer.mergeAll(ServerHandler2, DebugHandler2, MigrationHandler2, LocationHandler2, AgentHandler2, PluginHandler2, SessionHandler2, MessageHandler2, ModelHandler2, GenerateHandler2, VoiceHandler2, ProviderHandler2, IntegrationHandler2, WebSearchHandler2, UsageHandler2, McpHandler2, CredentialHandler2, ProjectHandler2, FormHandler2, PermissionHandler2, FileSystemHandler2, CommandHandler2, SkillHandler2, RpcHandler2, EventHandler2.pipe(Layer.provide(layer2)), PtyHandler2, PersistentPtyHandler2, ShellHandler2, ReferenceHandler2, WorktreeHandler2, VcsHandler2, ConfigHandler2);
104
104
 
105
105
  export { handlers2 };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  response2
3
- } from "./media-uri-50bbk3b2.js";
3
+ } from "./workerd-j80tzjj3.js";
4
4
  import {
5
5
  Api2
6
- } from "./media-uri-j87xz9bt.js";
6
+ } from "./workerd-s8t5gq7c.js";
7
7
 
8
8
  // src/handlers/agent.ts
9
9
  import { Agent } from "@opencode/core/agent";
@@ -1,28 +1,32 @@
1
1
  import {
2
2
  Api2
3
- } from "./media-uri-j87xz9bt.js";
3
+ } from "./workerd-s8t5gq7c.js";
4
4
  import {
5
5
  CorsConfig2,
6
6
  isAllowedRequestOrigin2
7
- } from "./media-uri-q4bn6dy8.js";
7
+ } from "./workerd-q4bn6dy8.js";
8
8
  import {
9
9
  makeArtifact2
10
- } from "./media-uri-p86kew8c.js";
10
+ } from "./workerd-t62b1gmw.js";
11
11
  import {
12
12
  makeBlobGet2
13
- } from "./media-uri-cr5sd8bz.js";
13
+ } from "./workerd-g23ffrnz.js";
14
14
  import {
15
15
  makeAutomation2
16
- } from "./media-uri-9cd3a4b8.js";
16
+ } from "./workerd-hgrkvk6s.js";
17
17
  import {
18
18
  makeJob2
19
- } from "./media-uri-78rcgzsr.js";
19
+ } from "./workerd-7ydfwv45.js";
20
+ import {
21
+ makeMachineLink2,
22
+ makeMachine2
23
+ } from "./workerd-0rzj25w4.js";
20
24
  import {
21
25
  makeMediaGet2
22
- } from "./media-uri-djr0jy89.js";
26
+ } from "./workerd-djr0jy89.js";
23
27
  import {
24
28
  runPtySocket2
25
- } from "./media-uri-q187pxxd.js";
29
+ } from "./workerd-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,9 +1,9 @@
1
1
  import {
2
2
  isAllowedRequestOrigin2
3
- } from "./media-uri-q4bn6dy8.js";
3
+ } from "./workerd-q4bn6dy8.js";
4
4
  import {
5
5
  __export
6
- } from "./media-uri-9rqn6x4v.js";
6
+ } from "./workerd-9rqn6x4v.js";
7
7
 
8
8
  // src/request-site.ts
9
9
  var exports_request_site = {};
@@ -2,7 +2,7 @@ import {
2
2
  locationErrors2,
3
3
  sessionInfo2,
4
4
  requestRef2
5
- } from "./media-uri-50bbk3b2.js";
5
+ } from "./workerd-j80tzjj3.js";
6
6
 
7
7
  // src/middleware/form-location.ts
8
8
  import { Instance } from "@opencode/core/instance/service";
@@ -2,18 +2,18 @@ import {
2
2
  locationErrors2,
3
3
  response2,
4
4
  requestRef2
5
- } from "./media-uri-50bbk3b2.js";
5
+ } from "./workerd-j80tzjj3.js";
6
6
  import {
7
7
  Api2
8
- } from "./media-uri-j87xz9bt.js";
8
+ } from "./workerd-s8t5gq7c.js";
9
9
  import {
10
10
  CorsConfig2,
11
11
  isAllowedRequestOrigin2
12
- } from "./media-uri-q4bn6dy8.js";
12
+ } from "./workerd-q4bn6dy8.js";
13
13
  import {
14
14
  runPtySocket2,
15
15
  holdLocation2
16
- } from "./media-uri-q187pxxd.js";
16
+ } from "./workerd-q187pxxd.js";
17
17
 
18
18
  // src/handlers/pty.ts
19
19
  import { Pty } from "@opencode/core/pty";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Api2
3
- } from "./media-uri-j87xz9bt.js";
3
+ } from "./workerd-s8t5gq7c.js";
4
4
 
5
5
  // src/handlers/rpc.ts
6
6
  import { Rpc } from "@opencode/core/rpc";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Api2
3
- } from "./media-uri-j87xz9bt.js";
3
+ } from "./workerd-s8t5gq7c.js";
4
4
 
5
5
  // src/handlers/worktree.ts
6
6
  import { Git } from "@opencode/core/git";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Api2
3
- } from "./media-uri-j87xz9bt.js";
3
+ } from "./workerd-s8t5gq7c.js";
4
4
 
5
5
  // src/handlers/migration.ts
6
6
  import { V1Migration } from "@opencode/core/database/v1-migration";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  locationErrors2,
3
3
  sessionInfo2
4
- } from "./media-uri-50bbk3b2.js";
4
+ } from "./workerd-j80tzjj3.js";
5
5
 
6
6
  // src/middleware/session-location.ts
7
7
  import { Instance } from "@opencode/core/instance/service";
@@ -4,7 +4,7 @@ import {
4
4
  authorized2,
5
5
  verifySession2,
6
6
  sessionCookieName2
7
- } from "./media-uri-j4at0y5c.js";
7
+ } from "./workerd-j4at0y5c.js";
8
8
 
9
9
  // src/middleware/authorization.ts
10
10
  import { UnauthorizedError } from "@opencode/protocol/errors";
@@ -13,6 +13,7 @@ import { Authorization as Authorization2 } from "@opencode/protocol/middleware/a
13
13
  import { PTY_CONNECT_PATH, PTY_CONNECT_TICKET_QUERY } from "@opencode/protocol/groups/pty";
14
14
  import { PERSISTENT_PTY_CONNECT_PATH } from "@opencode/protocol/groups/persistent-pty";
15
15
  import { MCP_CLIENT_PATH } from "@opencode/protocol/groups/mcp";
16
+ import { isWebSocketUpgrade, MACHINE_LINK_PATH } from "@opencode/protocol/groups/machine";
16
17
  import { PAIRING_CONNECT_PATH } from "@opencode/protocol/groups/server";
17
18
  import { Effect, Layer, Redacted } from "effect";
18
19
  import { Base64 } from "effect/encoding";
@@ -73,6 +74,8 @@ var authorizationLayer2 = Layer.effect(Authorization, Effect.gen(function* () {
73
74
  const url = new URL(request.url, "http://localhost");
74
75
  if ((route.route.path === PTY_CONNECT_PATH || route.route.path === PERSISTENT_PTY_CONNECT_PATH || route.route.path === MCP_CLIENT_PATH) && !!url.searchParams.get(PTY_CONNECT_TICKET_QUERY) || route.route.path === PAIRING_CONNECT_PATH)
75
76
  return yield* effect;
77
+ if (route.route.path === MACHINE_LINK_PATH && isWebSocketUpgrade(request))
78
+ return yield* effect;
76
79
  if (yield* authorizedRequest2(request, config))
77
80
  return yield* effect;
78
81
  if (challengeRequest(request))
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  LocationMiddleware2
3
- } from "./media-uri-50bbk3b2.js";
3
+ } from "./workerd-j80tzjj3.js";
4
4
  import {
5
5
  FormLocationMiddleware2
6
- } from "./media-uri-htyf2qs7.js";
6
+ } from "./workerd-n6ypjnhz.js";
7
7
  import {
8
8
  SessionLocationMiddleware2
9
- } from "./media-uri-b3bmdkga.js";
9
+ } from "./workerd-qahj7606.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
  __export
3
- } from "./media-uri-9rqn6x4v.js";
3
+ } from "./workerd-9rqn6x4v.js";
4
4
 
5
5
  // src/content-headers.ts
6
6
  var exports_content_headers = {};
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  missingSession2
3
- } from "./media-uri-smaf4a18.js";
3
+ } from "./workerd-smaf4a18.js";
4
4
  import {
5
5
  locationErrors2,
6
6
  response2,
7
7
  requestRef2
8
- } from "./media-uri-50bbk3b2.js";
8
+ } from "./workerd-j80tzjj3.js";
9
9
 
10
10
  // src/handlers/artifact.ts
11
11
  import { Artifact } from "@opencode/core/artifact";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  response2
3
- } from "./media-uri-50bbk3b2.js";
3
+ } from "./workerd-j80tzjj3.js";
4
4
  import {
5
5
  Api2
6
- } from "./media-uri-j87xz9bt.js";
6
+ } from "./workerd-s8t5gq7c.js";
7
7
 
8
8
  // src/handlers/reference.ts
9
9
  import { Reference } from "@opencode/core/reference";
@@ -1,10 +1,9 @@
1
1
  import {
2
- locationErrors2,
3
- awaitPlugins2
4
- } from "./media-uri-50bbk3b2.js";
2
+ locationErrors2
3
+ } from "./workerd-j80tzjj3.js";
5
4
  import {
6
5
  Api2
7
- } from "./media-uri-j87xz9bt.js";
6
+ } from "./workerd-s8t5gq7c.js";
8
7
 
9
8
  // src/handlers/voice.ts
10
9
  import { Location } from "@opencode/core/location";
@@ -20,11 +19,9 @@ var VoiceHandler2 = HttpApiBuilder.group(Api2, "server.voice", (handlers) => Eff
20
19
  const locations = yield* LocationServiceMap.Service;
21
20
  const services = locations.get(Location.Ref.make({ directory: AbsolutePath.make(global.config) }));
22
21
  return handlers.handle("voice.models", Effect.fn("server.voice.models")(function* () {
23
- yield* awaitPlugins2;
24
22
  const voice = yield* Voice.Service;
25
23
  return { data: yield* voice.models() };
26
24
  }, Effect.provide(services), locationErrors2)).handle("voice.session", Effect.fn("server.voice.session")(function* (request) {
27
- yield* awaitPlugins2;
28
25
  const voice = yield* Voice.Service;
29
26
  const transport = yield* voice.session(request.payload).pipe(Effect.mapError((error) => error._tag === "Voice.InvalidRequestError" ? new InvalidRequestError({ message: error.message }) : new ServiceUnavailableError({ message: error.message, service: error.service })));
30
27
  return { data: { transport } };
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  response2
3
- } from "./media-uri-50bbk3b2.js";
3
+ } from "./workerd-j80tzjj3.js";
4
4
  import {
5
5
  Api2
6
- } from "./media-uri-j87xz9bt.js";
6
+ } from "./workerd-s8t5gq7c.js";
7
7
  import {
8
8
  download2
9
- } from "./media-uri-t32e1bbt.js";
9
+ } from "./workerd-t32e1bbt.js";
10
10
  import {
11
11
  parse2
12
- } from "./media-uri-8sb6qqpn.js";
12
+ } from "./workerd-8sb6qqpn.js";
13
13
 
14
14
  // src/handlers/fs.ts
15
15
  import { FileSystem } from "@opencode/core/filesystem";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  missingSession2,
3
3
  failedMessageDecode2
4
- } from "./media-uri-smaf4a18.js";
4
+ } from "./workerd-smaf4a18.js";
5
5
  import {
6
6
  Api2
7
- } from "./media-uri-j87xz9bt.js";
7
+ } from "./workerd-s8t5gq7c.js";
8
8
  import {
9
9
  wantsMediaRefs2
10
- } from "./media-uri-xthc02cw.js";
10
+ } from "./workerd-xthc02cw.js";
11
11
 
12
12
  // src/handlers/message.ts
13
13
  import { SessionMessage } from "@opencode/core/session/message";
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  __export
3
- } from "./media-uri-9rqn6x4v.js";
3
+ } from "./workerd-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: () => Service4,
9
+ Service: () => Service3,
10
10
  node: () => node2
11
11
  });
12
12
  import { Cache, Context, Duration, Effect, Layer } from "effect";
@@ -14,12 +14,12 @@ import { makeGlobalNode } from "@opencode/util/effect/app-node";
14
14
  import { randomBytes } from "node:crypto";
15
15
  var TTL = Duration.minutes(5);
16
16
 
17
- class Service4 extends Context.Service()("@opencode/ServerPairing") {
17
+ class Service3 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(Service4, Effect.gen(function* () {
20
+ var layer = Layer.effect(Service3, Effect.gen(function* () {
21
21
  const cache = yield* Cache.make({ capacity: 1000, lookup: noLookup, timeToLive: TTL });
22
- return Service4.of({
22
+ return Service3.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(Service4, Effect.gen(function* () {
30
30
  })
31
31
  });
32
32
  }));
33
- var node2 = makeGlobalNode({ service: Service4, layer, deps: [] });
33
+ var node2 = makeGlobalNode({ service: Service3, layer, deps: [] });
34
34
 
35
- export { Service4, node2, exports_pairing };
35
+ export { Service3, node2, exports_pairing };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Api2
3
- } from "./media-uri-j87xz9bt.js";
3
+ } from "./workerd-s8t5gq7c.js";
4
4
 
5
5
  // src/handlers/location.ts
6
6
  import { Location } from "@opencode/core/location";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  response2
3
- } from "./media-uri-50bbk3b2.js";
3
+ } from "./workerd-j80tzjj3.js";
4
4
  import {
5
5
  Api2
6
- } from "./media-uri-j87xz9bt.js";
6
+ } from "./workerd-s8t5gq7c.js";
7
7
 
8
8
  // src/handlers/form.ts
9
9
  import { Form } from "@opencode/core/form";
@@ -3,7 +3,7 @@ import {
3
3
  download2,
4
4
  disposition2,
5
5
  exports_content_headers
6
- } from "./chunks/media-uri-t32e1bbt.js";
6
+ } from "./chunks/workerd-t32e1bbt.js";
7
7
  export {
8
8
  CONTENT_SECURITY_POLICY2 as CONTENT_SECURITY_POLICY,
9
9
  exports_content_headers as ContentHeaders,
package/dist/cors.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  CorsConfig2,
3
3
  isAllowedCorsOrigin2,
4
4
  isAllowedRequestOrigin2
5
- } from "./chunks/media-uri-q4bn6dy8.js";
5
+ } from "./chunks/workerd-q4bn6dy8.js";
6
6
  export {
7
7
  CorsConfig2 as CorsConfig,
8
8
  isAllowedCorsOrigin2 as isAllowedCorsOrigin,