@opencode/server 2.4.0 → 2.4.2

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 (140) hide show
  1. package/dist/api.d.ts +45 -1
  2. package/dist/api.js +5 -5
  3. package/dist/auth.js +1 -1
  4. package/dist/chunks/{content-headers-0rzj25w4.js → range-017ycvbx.js} +1 -1
  5. package/dist/chunks/{content-headers-9t07vtvz.js → range-0x6anvwr.js} +2 -2
  6. package/dist/chunks/{content-headers-39nnfjx1.js → range-39nnfjx1.js} +1 -1
  7. package/dist/chunks/{content-headers-801prsqk.js → range-3rtm8r3z.js} +2 -2
  8. package/dist/chunks/{content-headers-z3e7v67k.js → range-3te71694.js} +7 -7
  9. package/dist/chunks/{content-headers-jhbndf2d.js → range-5pef2nys.js} +4 -4
  10. package/dist/chunks/range-6pm6ek88.js +48 -0
  11. package/dist/chunks/{content-headers-r40v995e.js → range-78jk0pbb.js} +2 -2
  12. package/dist/chunks/{content-headers-hnbeyfax.js → range-79t5cra8.js} +14 -10
  13. package/dist/chunks/{content-headers-8ja97vv6.js → range-7zz6jxhb.js} +2 -2
  14. package/dist/chunks/{content-headers-8sb6qqpn.js → range-8sb6qqpn.js} +1 -1
  15. package/dist/chunks/{content-headers-hk9crnsa.js → range-9agv2b4c.js} +2 -2
  16. package/dist/chunks/{content-headers-vw0q3knq.js → range-aexh791j.js} +1 -1
  17. package/dist/chunks/{content-headers-2cm4dfcc.js → range-amxj52x5.js} +2 -2
  18. package/dist/chunks/{content-headers-zjmacp9c.js → range-ay32z58n.js} +3 -3
  19. package/dist/chunks/{content-headers-2dzr03as.js → range-b3sk57wg.js} +1 -1
  20. package/dist/chunks/{content-headers-y60jfeab.js → range-c6kzfg4f.js} +2 -2
  21. package/dist/chunks/{content-headers-2rb1ee6g.js → range-cddawxec.js} +3 -3
  22. package/dist/chunks/{content-headers-djr0jy89.js → range-djr0jy89.js} +1 -1
  23. package/dist/chunks/range-dnyhqccw.js +27 -0
  24. package/dist/chunks/{content-headers-100nc7c0.js → range-f93zkajm.js} +2 -2
  25. package/dist/chunks/{content-headers-g23ffrnz.js → range-g23ffrnz.js} +2 -2
  26. package/dist/chunks/{content-headers-prn0chz2.js → range-gwtm9cga.js} +1 -1
  27. package/dist/chunks/{content-headers-s3zgwc17.js → range-heqw7kpr.js} +2 -2
  28. package/dist/chunks/{content-headers-p83m65n5.js → range-hgd5b6k8.js} +2 -2
  29. package/dist/chunks/{content-headers-j4at0y5c.js → range-j4at0y5c.js} +1 -1
  30. package/dist/chunks/{content-headers-b03d5rht.js → range-jrjpfy36.js} +2 -2
  31. package/dist/chunks/{content-headers-ah2sj2pr.js → range-jy2ammbg.js} +1 -1
  32. package/dist/chunks/{content-headers-d20xfnpc.js → range-k2bx5n4e.js} +1 -1
  33. package/dist/chunks/{content-headers-wka57cdm.js → range-k518ftvz.js} +2 -2
  34. package/dist/chunks/{content-headers-4zkx9wb3.js → range-k58xpxwn.js} +1 -1
  35. package/dist/chunks/{content-headers-mzs0n5xz.js → range-kqr36gas.js} +7 -7
  36. package/dist/chunks/{content-headers-gq4jwh93.js → range-mjhh6jvz.js} +3 -3
  37. package/dist/chunks/{content-headers-hmwn16zp.js → range-myqk22k5.js} +2 -2
  38. package/dist/chunks/{content-headers-7jm4dc4a.js → range-n8nthg9q.js} +4 -4
  39. package/dist/chunks/{content-headers-5jm9kajg.js → range-pa4xtt5h.js} +2 -2
  40. package/dist/chunks/range-qpnw2qd1.js +58 -0
  41. package/dist/chunks/{content-headers-rktygpea.js → range-rktygpea.js} +1 -1
  42. package/dist/chunks/{content-headers-4fc68szf.js → range-rn83nvae.js} +2 -2
  43. package/dist/chunks/{content-headers-smaf4a18.js → range-rqgv9x42.js} +6 -2
  44. package/dist/chunks/{content-headers-fjcqsaaz.js → range-s3d15g1k.js} +23 -17
  45. package/dist/chunks/{content-headers-ddrpmftb.js → range-s557cdqw.js} +14 -4
  46. package/dist/chunks/{content-headers-1r438we2.js → range-s6q3ch5r.js} +8 -8
  47. package/dist/chunks/{content-headers-7qpea5x7.js → range-sqfq92mf.js} +2 -2
  48. package/dist/chunks/{content-headers-ywn523ee.js → range-stx1bw5w.js} +3 -3
  49. package/dist/chunks/{content-headers-t32e1bbt.js → range-t32e1bbt.js} +1 -1
  50. package/dist/chunks/{content-headers-w3xmknp7.js → range-tmb89r25.js} +2 -2
  51. package/dist/chunks/{content-headers-mvp6540g.js → range-tmbyzr8c.js} +35 -35
  52. package/dist/chunks/{content-headers-ykk3p1r3.js → range-vkj8vbyf.js} +2 -2
  53. package/dist/chunks/{content-headers-yty6dk04.js → range-vnpm7f9y.js} +1 -1
  54. package/dist/chunks/{content-headers-0r476wkb.js → range-wa6vk4hf.js} +14 -9
  55. package/dist/chunks/{content-headers-hf3kgjhr.js → range-wazndna9.js} +4 -4
  56. package/dist/chunks/{content-headers-qfyg9gb7.js → range-wecgp61r.js} +7 -7
  57. package/dist/chunks/{content-headers-7ydfwv45.js → range-x2qy7jg1.js} +1 -1
  58. package/dist/chunks/{content-headers-ky9xhfwk.js → range-zs3ssmns.js} +26 -21
  59. package/dist/chunks/{content-headers-rmfb1myj.js → range-zx60pg73.js} +1 -1
  60. package/dist/content-headers.js +1 -1
  61. package/dist/cors.js +1 -1
  62. package/dist/event-feed.js +5 -5
  63. package/dist/fetch.d.ts +57 -0
  64. package/dist/fetch.js +64 -61
  65. package/dist/handlers/agent.js +6 -6
  66. package/dist/handlers/artifact.js +3 -3
  67. package/dist/handlers/automation.d.ts +1 -3
  68. package/dist/handlers/automation.js +2 -2
  69. package/dist/handlers/blob.js +3 -3
  70. package/dist/handlers/command.js +6 -6
  71. package/dist/handlers/config.js +6 -6
  72. package/dist/handlers/credential.js +7 -7
  73. package/dist/handlers/debug.js +6 -6
  74. package/dist/handlers/event.js +7 -7
  75. package/dist/handlers/form.js +6 -6
  76. package/dist/handlers/fs.js +8 -8
  77. package/dist/handlers/generate.js +6 -6
  78. package/dist/handlers/integration.js +6 -6
  79. package/dist/handlers/job.js +2 -2
  80. package/dist/handlers/location.js +6 -6
  81. package/dist/handlers/machine.js +1 -1
  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 +17 -16
  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/push.d.ts +28 -0
  96. package/dist/handlers/push.js +6 -0
  97. package/dist/handlers/reference.js +6 -6
  98. package/dist/handlers/rpc.js +6 -6
  99. package/dist/handlers/server.js +9 -9
  100. package/dist/handlers/session-error.d.ts +3 -1
  101. package/dist/handlers/session-error.js +4 -2
  102. package/dist/handlers/session.js +7 -7
  103. package/dist/handlers/shell.js +6 -6
  104. package/dist/handlers/skill.js +6 -6
  105. package/dist/handlers/usage.js +6 -6
  106. package/dist/handlers/vcs.js +6 -6
  107. package/dist/handlers/voice.js +6 -6
  108. package/dist/handlers/websearch.js +6 -6
  109. package/dist/handlers/worktree.js +6 -6
  110. package/dist/handlers.d.ts +1 -1
  111. package/dist/handlers.js +54 -53
  112. package/dist/location.js +4 -4
  113. package/dist/media-uri.js +1 -1
  114. package/dist/middleware/authorization.js +2 -2
  115. package/dist/middleware/defect-response.js +1 -1
  116. package/dist/middleware/form-location.js +3 -3
  117. package/dist/middleware/schema-error.js +1 -1
  118. package/dist/middleware/session-location.js +3 -3
  119. package/dist/pairing.d.ts +1 -1
  120. package/dist/pairing.js +3 -3
  121. package/dist/process.js +62 -61
  122. package/dist/range.js +1 -1
  123. package/dist/request-site.js +2 -2
  124. package/dist/request-tracing.js +1 -1
  125. package/dist/routes.d.ts +4 -2
  126. package/dist/routes.js +58 -57
  127. package/dist/server-info.js +5 -5
  128. package/dist/service-status.js +1 -1
  129. package/dist/workerd.d.ts +20 -6
  130. package/dist/workerd.js +87 -81
  131. package/package.json +9 -9
  132. package/dist/chunks/content-headers-9cd3a4b8.js +0 -69
  133. package/dist/chunks/content-headers-jmmhprac.js +0 -13
  134. /package/dist/chunks/{content-headers-9rqn6x4v.js → range-9rqn6x4v.js} +0 -0
  135. /package/dist/chunks/{content-headers-bd8755ek.js → range-bd8755ek.js} +0 -0
  136. /package/dist/chunks/{content-headers-n26yr6pw.js → range-n26yr6pw.js} +0 -0
  137. /package/dist/chunks/{content-headers-q187pxxd.js → range-q187pxxd.js} +0 -0
  138. /package/dist/chunks/{content-headers-q4bn6dy8.js → range-q4bn6dy8.js} +0 -0
  139. /package/dist/chunks/{content-headers-xthc02cw.js → range-xthc02cw.js} +0 -0
  140. /package/dist/chunks/{content-headers-yc7nft6q.js → range-yc7nft6q.js} +0 -0
package/dist/routes.js CHANGED
@@ -1,63 +1,64 @@
1
1
  import {
2
2
  createRoutes2,
3
3
  createEmbeddedRoutes2
4
- } from "./chunks/content-headers-fjcqsaaz.js";
5
- import"./chunks/content-headers-mvp6540g.js";
6
- import"./chunks/content-headers-2dzr03as.js";
7
- import"./chunks/content-headers-4fc68szf.js";
8
- import"./chunks/content-headers-w3xmknp7.js";
9
- import"./chunks/content-headers-jhbndf2d.js";
10
- import"./chunks/content-headers-r40v995e.js";
11
- import"./chunks/content-headers-rmfb1myj.js";
12
- import"./chunks/content-headers-yty6dk04.js";
13
- import"./chunks/content-headers-5jm9kajg.js";
14
- import"./chunks/content-headers-d20xfnpc.js";
15
- import"./chunks/content-headers-wka57cdm.js";
16
- import"./chunks/content-headers-jmmhprac.js";
17
- import"./chunks/content-headers-gq4jwh93.js";
18
- import"./chunks/content-headers-ykk3p1r3.js";
19
- import"./chunks/content-headers-hnbeyfax.js";
20
- import"./chunks/content-headers-7qpea5x7.js";
21
- import"./chunks/content-headers-9cd3a4b8.js";
22
- import"./chunks/content-headers-4zkx9wb3.js";
23
- import"./chunks/content-headers-801prsqk.js";
24
- import"./chunks/content-headers-100nc7c0.js";
25
- import"./chunks/content-headers-hf3kgjhr.js";
26
- import"./chunks/content-headers-q187pxxd.js";
27
- import"./chunks/content-headers-9t07vtvz.js";
28
- import"./chunks/content-headers-hk9crnsa.js";
29
- import"./chunks/content-headers-1r438we2.js";
30
- import"./chunks/content-headers-7jm4dc4a.js";
31
- import"./chunks/content-headers-0rzj25w4.js";
32
- import"./chunks/content-headers-prn0chz2.js";
33
- import"./chunks/content-headers-s3zgwc17.js";
34
- import"./chunks/content-headers-y60jfeab.js";
35
- import"./chunks/content-headers-b03d5rht.js";
36
- import"./chunks/content-headers-7ydfwv45.js";
37
- import"./chunks/content-headers-ky9xhfwk.js";
38
- import"./chunks/content-headers-g23ffrnz.js";
39
- import"./chunks/content-headers-djr0jy89.js";
40
- import"./chunks/content-headers-ddrpmftb.js";
41
- import"./chunks/content-headers-p83m65n5.js";
42
- import"./chunks/content-headers-2cm4dfcc.js";
43
- import"./chunks/content-headers-2rb1ee6g.js";
44
- import"./chunks/content-headers-8ja97vv6.js";
45
- import"./chunks/content-headers-n26yr6pw.js";
46
- import"./chunks/content-headers-rktygpea.js";
47
- import"./chunks/content-headers-bd8755ek.js";
48
- import"./chunks/content-headers-8sb6qqpn.js";
49
- import"./chunks/content-headers-xthc02cw.js";
50
- import"./chunks/content-headers-j4at0y5c.js";
51
- import"./chunks/content-headers-z3e7v67k.js";
52
- import"./chunks/content-headers-qfyg9gb7.js";
53
- import"./chunks/content-headers-zjmacp9c.js";
54
- import"./chunks/content-headers-vw0q3knq.js";
55
- import"./chunks/content-headers-ah2sj2pr.js";
56
- import"./chunks/content-headers-t32e1bbt.js";
57
- import"./chunks/content-headers-ywn523ee.js";
58
- import"./chunks/content-headers-smaf4a18.js";
59
- import"./chunks/content-headers-mzs0n5xz.js";
60
- import"./chunks/content-headers-q4bn6dy8.js";
4
+ } from "./chunks/range-s3d15g1k.js";
5
+ import"./chunks/range-tmbyzr8c.js";
6
+ import"./chunks/range-rn83nvae.js";
7
+ import"./chunks/range-wazndna9.js";
8
+ import"./chunks/range-zs3ssmns.js";
9
+ import"./chunks/range-5pef2nys.js";
10
+ import"./chunks/range-mjhh6jvz.js";
11
+ import"./chunks/range-3rtm8r3z.js";
12
+ import"./chunks/range-f93zkajm.js";
13
+ import"./chunks/range-s6q3ch5r.js";
14
+ import"./chunks/range-vnpm7f9y.js";
15
+ import"./chunks/range-b3sk57wg.js";
16
+ import"./chunks/range-0x6anvwr.js";
17
+ import"./chunks/range-heqw7kpr.js";
18
+ import"./chunks/range-gwtm9cga.js";
19
+ import"./chunks/range-k58xpxwn.js";
20
+ import"./chunks/range-tmb89r25.js";
21
+ import"./chunks/range-c6kzfg4f.js";
22
+ import"./chunks/range-dnyhqccw.js";
23
+ import"./chunks/range-zx60pg73.js";
24
+ import"./chunks/range-7zz6jxhb.js";
25
+ import"./chunks/range-n8nthg9q.js";
26
+ import"./chunks/range-k2bx5n4e.js";
27
+ import"./chunks/range-hgd5b6k8.js";
28
+ import"./chunks/range-s557cdqw.js";
29
+ import"./chunks/range-vkj8vbyf.js";
30
+ import"./chunks/range-79t5cra8.js";
31
+ import"./chunks/range-sqfq92mf.js";
32
+ import"./chunks/range-qpnw2qd1.js";
33
+ import"./chunks/range-djr0jy89.js";
34
+ import"./chunks/range-017ycvbx.js";
35
+ import"./chunks/range-6pm6ek88.js";
36
+ import"./chunks/range-q187pxxd.js";
37
+ import"./chunks/range-g23ffrnz.js";
38
+ import"./chunks/range-x2qy7jg1.js";
39
+ import"./chunks/range-pa4xtt5h.js";
40
+ import"./chunks/range-9agv2b4c.js";
41
+ import"./chunks/range-amxj52x5.js";
42
+ import"./chunks/range-k518ftvz.js";
43
+ import"./chunks/range-jrjpfy36.js";
44
+ import"./chunks/range-78jk0pbb.js";
45
+ import"./chunks/range-cddawxec.js";
46
+ import"./chunks/range-kqr36gas.js";
47
+ import"./chunks/range-ay32z58n.js";
48
+ import"./chunks/range-aexh791j.js";
49
+ import"./chunks/range-bd8755ek.js";
50
+ import"./chunks/range-jy2ammbg.js";
51
+ import"./chunks/range-rktygpea.js";
52
+ import"./chunks/range-n26yr6pw.js";
53
+ import"./chunks/range-stx1bw5w.js";
54
+ import"./chunks/range-rqgv9x42.js";
55
+ import"./chunks/range-q4bn6dy8.js";
56
+ import"./chunks/range-8sb6qqpn.js";
57
+ import"./chunks/range-3te71694.js";
58
+ import"./chunks/range-j4at0y5c.js";
59
+ import"./chunks/range-t32e1bbt.js";
60
+ import"./chunks/range-wecgp61r.js";
61
+ import"./chunks/range-xthc02cw.js";
61
62
  export {
62
63
  createEmbeddedRoutes2 as createEmbeddedRoutes,
63
64
  createRoutes2 as createRoutes
@@ -1,12 +1,12 @@
1
1
  import {
2
- Service2,
3
- layer2,
2
+ Service3,
3
+ layer3,
4
4
  connectionURLs2,
5
5
  exports_server_info
6
- } from "./chunks/content-headers-z3e7v67k.js";
6
+ } from "./chunks/range-3te71694.js";
7
7
  export {
8
8
  exports_server_info as ServerInfo,
9
- Service2 as Service,
9
+ Service3 as Service,
10
10
  connectionURLs2 as connectionURLs,
11
- layer2 as layer
11
+ layer3 as layer
12
12
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  make2,
3
3
  exports_service_status
4
- } from "./chunks/content-headers-39nnfjx1.js";
4
+ } from "./chunks/range-39nnfjx1.js";
5
5
  export {
6
6
  exports_service_status as Status,
7
7
  make2 as make
package/dist/workerd.d.ts CHANGED
@@ -9,13 +9,18 @@ import type { ServerOptions } from "./options";
9
9
  * or disabled.
10
10
  *
11
11
  * - Database runs on the injected `DurableObjectStorage` SQLite.
12
+ * - `Workspace` is configured with `keepWarm: 0`, `pollInterval: null`, and
13
+ * `storage.setAlarm` scheduling so the Durable Object can hibernate at zero
14
+ * idle cost. Callers forward the Durable Object's `alarm()` method to
15
+ * `handler.alarm()` (or `opencode.alarm()` via `@opencode/sdk/workerd`).
12
16
  * - Watcher and fff are disabled through their existing option flags; pty, fff,
13
17
  * and photon native modules resolve to inert stubs under the `workerd` bundle
14
18
  * condition.
15
- * - Bare locations use a typed no-execution-plane process spawner; FileSystem,
16
- * FileSystemSearch, and Pty fail with a clear defect until a remote sandbox
17
- * backs them; Npm fails package installs with a typed workerd error; Snapshot
18
- * and Vcs degrade to no-op results.
19
+ * - Bare locations use a typed no-execution-plane process spawner; FileSystem
20
+ * and FileSystemSearch route through Environment (working on attached remote
21
+ * workspaces and failing cleanly on bare locations). Pty fails with a clear
22
+ * defect; Npm fails package installs with a typed workerd error; Snapshot and
23
+ * Vcs degrade to no-op results.
19
24
  * - Blob storage and video generation report themselves unsupported: blobs are files on a local disk.
20
25
  * - Config is injected as a string (no filesystem); plugin discovery is
21
26
  * precompiled-only, and stdio MCP reports the same no-plane failure as Shell.
@@ -38,12 +43,21 @@ export interface Options {
38
43
  /** Replaces `globalThis.fetch` for OpenCode's own HTTP requests, e.g. to route them through a Service Binding. */
39
44
  readonly fetch?: ServerOptions["fetch"];
40
45
  }
46
+ export interface Handler {
47
+ (request: Request): Promise<Response>;
48
+ /** Suspends any workspaces past their idle threshold; call from the Durable Object's `alarm()` method. */
49
+ readonly alarm: () => Promise<void>;
50
+ }
41
51
  /**
42
- * Builds the web-standard fetch handler for a Durable Object's `fetch()`. The
52
+ * Builds the web-standard fetch + alarm handler for a Durable Object. The
43
53
  * application layer builds eagerly in the caller's scope, so hold it in the
44
54
  * Durable Object instance rather than per request.
55
+ *
56
+ * Callers must forward the Durable Object's `alarm()` lifecycle method to
57
+ * `handler.alarm()`: this profile disables background idle polling so the
58
+ * isolate can hibernate at zero idle cost.
45
59
  */
46
- export declare function create(options: Options): Effect.Effect<(request: Request, context?: import("effect/Context").Context<never> | undefined) => Promise<globalThis.Response>, Error, import("effect/Scope").Scope>;
60
+ export declare const create: (options: Options) => Effect.Effect<Handler, Error, import("effect/Scope").Scope>;
47
61
  export declare function serverOptions(options: Options): ServerOptions;
48
62
  /** The workerd replacement graph, applied after the standard server replacements. */
49
63
  export declare function replacements(options: Options): LayerNode.Replacements;
package/dist/workerd.js CHANGED
@@ -1,68 +1,71 @@
1
- import"./chunks/content-headers-q4bn6dy8.js";
2
- import"./chunks/content-headers-hmwn16zp.js";
3
- import"./chunks/content-headers-yc7nft6q.js";
4
- import"./chunks/content-headers-smaf4a18.js";
5
- import"./chunks/content-headers-ywn523ee.js";
6
- import"./chunks/content-headers-ah2sj2pr.js";
7
- import"./chunks/content-headers-vw0q3knq.js";
8
- import"./chunks/content-headers-zjmacp9c.js";
9
- import"./chunks/content-headers-j4at0y5c.js";
10
- import"./chunks/content-headers-b03d5rht.js";
11
- import"./chunks/content-headers-s3zgwc17.js";
12
- import"./chunks/content-headers-xthc02cw.js";
13
- import"./chunks/content-headers-2rb1ee6g.js";
14
- import"./chunks/content-headers-100nc7c0.js";
15
- import"./chunks/content-headers-p83m65n5.js";
16
- import"./chunks/content-headers-ky9xhfwk.js";
17
- import"./chunks/content-headers-gq4jwh93.js";
18
- import"./chunks/content-headers-t32e1bbt.js";
19
- import"./chunks/content-headers-8sb6qqpn.js";
20
- import"./chunks/content-headers-ddrpmftb.js";
21
- import"./chunks/content-headers-2cm4dfcc.js";
22
- import"./chunks/content-headers-5jm9kajg.js";
23
- import"./chunks/content-headers-jmmhprac.js";
24
- import"./chunks/content-headers-rmfb1myj.js";
25
- import"./chunks/content-headers-qfyg9gb7.js";
26
- import"./chunks/content-headers-7jm4dc4a.js";
27
- import"./chunks/content-headers-4fc68szf.js";
28
- import"./chunks/content-headers-r40v995e.js";
29
- import"./chunks/content-headers-z3e7v67k.js";
30
- import"./chunks/content-headers-mzs0n5xz.js";
31
- import"./chunks/content-headers-1r438we2.js";
32
- import"./chunks/content-headers-y60jfeab.js";
33
- import"./chunks/content-headers-q187pxxd.js";
34
- import"./chunks/content-headers-jhbndf2d.js";
35
- import"./chunks/content-headers-7qpea5x7.js";
36
- import"./chunks/content-headers-g23ffrnz.js";
37
- import"./chunks/content-headers-9cd3a4b8.js";
38
- import"./chunks/content-headers-7ydfwv45.js";
39
- import"./chunks/content-headers-0rzj25w4.js";
40
- import"./chunks/content-headers-djr0jy89.js";
41
- import"./chunks/content-headers-hnbeyfax.js";
42
- import"./chunks/content-headers-801prsqk.js";
43
- import"./chunks/content-headers-wka57cdm.js";
44
- import"./chunks/content-headers-prn0chz2.js";
45
- import"./chunks/content-headers-hk9crnsa.js";
46
- import"./chunks/content-headers-8ja97vv6.js";
47
- import"./chunks/content-headers-ykk3p1r3.js";
48
- import"./chunks/content-headers-hf3kgjhr.js";
49
- import"./chunks/content-headers-9t07vtvz.js";
50
- import"./chunks/content-headers-4zkx9wb3.js";
51
- import"./chunks/content-headers-yty6dk04.js";
52
- import"./chunks/content-headers-w3xmknp7.js";
53
- import"./chunks/content-headers-2dzr03as.js";
54
- import"./chunks/content-headers-d20xfnpc.js";
55
- import"./chunks/content-headers-mvp6540g.js";
56
- import"./chunks/content-headers-rktygpea.js";
57
- import"./chunks/content-headers-bd8755ek.js";
58
- import"./chunks/content-headers-n26yr6pw.js";
59
- import"./chunks/content-headers-fjcqsaaz.js";
1
+ import"./chunks/range-q4bn6dy8.js";
2
+ import"./chunks/range-myqk22k5.js";
60
3
  import {
61
- make3
62
- } from "./chunks/content-headers-0r476wkb.js";
4
+ withoutParentSpan2
5
+ } from "./chunks/range-yc7nft6q.js";
6
+ import"./chunks/range-rqgv9x42.js";
7
+ import"./chunks/range-stx1bw5w.js";
8
+ import"./chunks/range-jy2ammbg.js";
9
+ import"./chunks/range-aexh791j.js";
10
+ import"./chunks/range-ay32z58n.js";
11
+ import"./chunks/range-j4at0y5c.js";
12
+ import"./chunks/range-jrjpfy36.js";
13
+ import"./chunks/range-heqw7kpr.js";
14
+ import"./chunks/range-xthc02cw.js";
15
+ import"./chunks/range-cddawxec.js";
16
+ import"./chunks/range-f93zkajm.js";
17
+ import"./chunks/range-hgd5b6k8.js";
18
+ import"./chunks/range-zs3ssmns.js";
19
+ import"./chunks/range-mjhh6jvz.js";
20
+ import"./chunks/range-t32e1bbt.js";
21
+ import"./chunks/range-8sb6qqpn.js";
22
+ import"./chunks/range-s557cdqw.js";
23
+ import"./chunks/range-amxj52x5.js";
24
+ import"./chunks/range-pa4xtt5h.js";
25
+ import"./chunks/range-dnyhqccw.js";
26
+ import"./chunks/range-zx60pg73.js";
27
+ import"./chunks/range-wecgp61r.js";
28
+ import"./chunks/range-n8nthg9q.js";
29
+ import"./chunks/range-rn83nvae.js";
30
+ import"./chunks/range-78jk0pbb.js";
31
+ import"./chunks/range-3te71694.js";
32
+ import"./chunks/range-kqr36gas.js";
33
+ import"./chunks/range-s6q3ch5r.js";
34
+ import"./chunks/range-c6kzfg4f.js";
35
+ import"./chunks/range-q187pxxd.js";
36
+ import"./chunks/range-5pef2nys.js";
37
+ import"./chunks/range-sqfq92mf.js";
38
+ import"./chunks/range-g23ffrnz.js";
39
+ import"./chunks/range-6pm6ek88.js";
40
+ import"./chunks/range-x2qy7jg1.js";
41
+ import"./chunks/range-017ycvbx.js";
42
+ import"./chunks/range-djr0jy89.js";
43
+ import"./chunks/range-qpnw2qd1.js";
44
+ import"./chunks/range-79t5cra8.js";
45
+ import"./chunks/range-3rtm8r3z.js";
46
+ import"./chunks/range-k518ftvz.js";
47
+ import"./chunks/range-gwtm9cga.js";
48
+ import"./chunks/range-9agv2b4c.js";
49
+ import"./chunks/range-7zz6jxhb.js";
50
+ import"./chunks/range-vkj8vbyf.js";
51
+ import"./chunks/range-wazndna9.js";
52
+ import"./chunks/range-0x6anvwr.js";
53
+ import"./chunks/range-k58xpxwn.js";
54
+ import"./chunks/range-vnpm7f9y.js";
55
+ import"./chunks/range-tmb89r25.js";
56
+ import"./chunks/range-b3sk57wg.js";
57
+ import"./chunks/range-k2bx5n4e.js";
58
+ import"./chunks/range-tmbyzr8c.js";
59
+ import"./chunks/range-rktygpea.js";
60
+ import"./chunks/range-bd8755ek.js";
61
+ import"./chunks/range-n26yr6pw.js";
62
+ import"./chunks/range-s3d15g1k.js";
63
+ import {
64
+ makeWithContext2
65
+ } from "./chunks/range-wa6vk4hf.js";
63
66
  import {
64
67
  __export
65
- } from "./chunks/content-headers-9rqn6x4v.js";
68
+ } from "./chunks/range-9rqn6x4v.js";
66
69
 
67
70
  // src/workerd.ts
68
71
  var exports_workerd = {};
@@ -72,23 +75,31 @@ __export(exports_workerd, {
72
75
  replacements: () => replacements,
73
76
  serverOptions: () => serverOptions
74
77
  });
75
- import { Effect, Layer } from "effect";
78
+ import { Context, Effect, Layer } from "effect";
79
+ import { BlobStore } from "@opencode/core/blob-store";
76
80
  import { ConfigPluginSource } from "@opencode/core/config/plugin/source";
77
81
  import { Database } from "@opencode/core/database/database";
78
82
  import { sqliteLayer } from "@opencode/core/database/sqlite.workerd";
79
83
  import { EnvironmentUnavailable } from "@opencode/core/environment/unavailable";
80
- import { FileSystem } from "@opencode/core/filesystem";
81
- import { FileSystemSearch } from "@opencode/core/filesystem/search";
82
- import { BlobStore } from "@opencode/core/blob-store";
83
- import { VideoGeneration } from "@opencode/core/video-generation";
84
+ import { Identity } from "@opencode/core/machine/identity";
84
85
  import { Pty } from "@opencode/core/pty";
85
86
  import { Snapshot } from "@opencode/core/snapshot";
86
87
  import { Vcs } from "@opencode/core/vcs";
88
+ import { VideoGeneration } from "@opencode/core/video-generation";
89
+ import { Workspace } from "@opencode/core/workspace";
87
90
  import { CrossSpawnSpawner } from "@opencode/util/cross-spawn-spawner";
88
91
  import { Npm } from "@opencode/util/npm";
89
- function create(options) {
90
- return make3(serverOptions(options), { overrides: replacements(options) });
91
- }
92
+ var create = Effect.fn("ServerWorkerd.create")(function* (options) {
93
+ const server = yield* makeWithContext2(serverOptions(options), {
94
+ overrides: replacements(options)
95
+ });
96
+ const run = Effect.runPromiseWith(yield* withoutParentSpan2(Effect.context()));
97
+ const workspace = Context.get(server.context, Workspace.Service);
98
+ const handler = Object.assign(server.handler, {
99
+ alarm: () => run(Effect.asVoid(workspace.suspendIdle()))
100
+ });
101
+ return handler;
102
+ });
92
103
  function serverOptions(options) {
93
104
  return {
94
105
  app: options.app,
@@ -103,11 +114,15 @@ function serverOptions(options) {
103
114
  function replacements(options) {
104
115
  return [
105
116
  Database.node.replace(Database.configuredClient(sqliteLayer({ storage: options.storage }))),
117
+ Identity.node.replace(Identity.kvNode),
118
+ Workspace.node.replace(Workspace.configured({
119
+ keepWarm: 0,
120
+ pollInterval: null,
121
+ onIdleScheduled: (atMs) => Effect.tryPromise(() => options.storage.setAlarm(atMs))
122
+ })),
106
123
  CrossSpawnSpawner.node.replace(EnvironmentUnavailable.layer),
107
124
  Snapshot.node.replace(Snapshot.noopLayer),
108
125
  Vcs.node.replace(vcsLayer),
109
- FileSystem.node.replace(fileSystemLayer),
110
- FileSystemSearch.node.replace(fileSystemSearchLayer),
111
126
  Pty.node.replace(ptyLayer),
112
127
  Npm.node.replace(npmLayer),
113
128
  BlobStore.node.replace(BlobStore.unsupportedLayer),
@@ -140,15 +155,6 @@ var vcsLayer = Layer.succeed(Vcs.Service, Vcs.Service.of({
140
155
  status: () => Effect.succeed([]),
141
156
  diff: () => Effect.succeed([])
142
157
  }));
143
- var fileSystemLayer = Layer.succeed(FileSystem.Service, FileSystem.Service.of({
144
- read: () => unavailable("FileSystem.read"),
145
- list: () => unavailable("FileSystem.list"),
146
- find: () => unavailable("FileSystem.find"),
147
- write: () => unavailable("FileSystem.write")
148
- }));
149
- var fileSystemSearchLayer = Layer.succeed(FileSystemSearch.Service, FileSystemSearch.Service.of({
150
- find: () => unavailable("FileSystemSearch.find")
151
- }));
152
158
  var ptyLayer = Layer.succeed(Pty.Service, Pty.Service.of({
153
159
  list: () => Effect.succeed([]),
154
160
  get: (ptyID) => Effect.fail(new Pty.NotFoundError({ ptyID })),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@opencode/server",
4
- "version": "2.4.0",
4
+ "version": "2.4.2",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -24,7 +24,7 @@
24
24
  "scripts": {
25
25
  "build": "bun run script/build.ts",
26
26
  "pack": "bun run script/pack.ts",
27
- "test": "bun test --only-failures",
27
+ "test": "bun run ../core/script/test.ts",
28
28
  "typecheck": "bun check --no-script -b",
29
29
  "typecheck:tsc": "tsc -b",
30
30
  "probe:workerd": "bun run script/workerd-probe.ts"
@@ -32,17 +32,17 @@
32
32
  "dependencies": {
33
33
  "@effect/platform-node": "4.1.0",
34
34
  "@effect/platform-node-shared": "4.1.0",
35
- "@opencode/core": "2.4.0",
36
- "@opencode/protocol": "2.4.0",
37
- "@opencode/schema": "2.4.0",
38
- "@opencode/simulation": "2.4.0",
39
- "@opencode/util": "2.4.0",
35
+ "@opencode/core": "2.4.2",
36
+ "@opencode/protocol": "2.4.2",
37
+ "@opencode/schema": "2.4.2",
38
+ "@opencode/simulation": "2.4.2",
39
+ "@opencode/util": "2.4.2",
40
40
  "effect": "4.1.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@opencode/pty": "0.6.0",
44
- "@opencode/client": "2.4.0",
45
- "@opencode/plugin": "2.4.0",
44
+ "@opencode/client": "2.4.2",
45
+ "@opencode/plugin": "2.4.2",
46
46
  "@tsconfig/bun": "1.0.9",
47
47
  "@types/bun": "1.4.3",
48
48
  "@typescript/native": "npm:typescript@7.1.0-beta",
@@ -1,69 +0,0 @@
1
- import {
2
- missingSession2
3
- } from "./content-headers-smaf4a18.js";
4
-
5
- // src/handlers/automation.ts
6
- import { Automation } from "@opencode/core/automation";
7
- import { Permission } from "@opencode/core/permission";
8
- import { Project } from "@opencode/core/project";
9
- import { Session } from "@opencode/core/session";
10
- import { AbsolutePath } from "@opencode/core/schema";
11
- import { AutomationNotFoundError, ForbiddenError, InvalidRequestError } from "@opencode/protocol/errors";
12
- import { Effect } from "effect";
13
- import path from "node:path";
14
- import { HttpApiSchema } from "effect/http-api";
15
- var makeAutomation2 = Effect.gen(function* () {
16
- const automations = yield* Automation.Service;
17
- const sessions = yield* Session.Service;
18
- const projects = yield* Project.Service;
19
- const enabled = (directory) => automations.enabled(directory).pipe(Effect.catchTag("FileSystem.DirectoryNotFoundError", () => Effect.succeed(true)));
20
- const allowed = (directory) => enabled(directory).pipe(Effect.flatMap((on) => on ? Effect.void : Effect.fail(disabled())));
21
- const find = (id) => Effect.gen(function* () {
22
- const info = yield* automations.get(id).pipe(Effect.mapError(missingAutomation));
23
- yield* allowed(info.directory);
24
- return info;
25
- });
26
- return {
27
- create: (payload) => automations.create(payload).pipe(Effect.provideService(Permission.Unattended, []), Effect.map((data) => ({ data })), Effect.catchTags({
28
- "Automation.InvalidError": (error) => Effect.fail(new InvalidRequestError({ message: error.message, kind: "automation" })),
29
- "Automation.DisabledError": () => Effect.fail(disabled()),
30
- "Permission.BlockedError": (error) => Effect.fail(new ForbiddenError({ message: error.message })),
31
- "Permission.CorrectedError": (error) => Effect.fail(new ForbiddenError({ message: error.feedback })),
32
- "Session.NotFoundError": (error) => Effect.fail(missingSession2(error))
33
- })),
34
- list: (query) => Effect.gen(function* () {
35
- const session = query.sessionID === undefined ? undefined : yield* sessions.get(query.sessionID).pipe(Effect.mapError(missingSession2));
36
- if (session !== undefined)
37
- yield* allowed(session.location.directory);
38
- const directory = query.directory;
39
- if (directory !== undefined && !path.isAbsolute(directory))
40
- return yield* new InvalidRequestError({
41
- message: `Directory must be an absolute path: ${directory}`,
42
- kind: "automation"
43
- });
44
- if (directory !== undefined)
45
- yield* allowed(directory);
46
- const projectID = directory === undefined ? undefined : (yield* projects.resolve(AbsolutePath.make(directory), { persist: false })).id;
47
- const rows = yield* automations.list({ sessionID: query.sessionID });
48
- const matching = rows.filter((row) => directory === undefined || row.projectID === projectID || row.directory === directory);
49
- const directories = new Set(matching.map((row) => row.directory));
50
- const visible = new Set(yield* Effect.filter(directories, enabled));
51
- return { data: matching.filter((row) => visible.has(row.directory)) };
52
- }),
53
- get: (id) => find(id).pipe(Effect.map((data) => ({ data }))),
54
- pause: (id) => find(id).pipe(Effect.andThen(automations.pause(id).pipe(Effect.mapError(missingAutomation))), Effect.map((data) => ({ data }))),
55
- resume: (id) => find(id).pipe(Effect.andThen(automations.resume(id).pipe(Effect.mapError(missingAutomation))), Effect.map((data) => ({ data }))),
56
- remove: (id) => find(id).pipe(Effect.andThen(automations.remove(id).pipe(Effect.mapError(missingAutomation))), Effect.as(HttpApiSchema.NoContent.make()))
57
- };
58
- });
59
- function missingAutomation(error) {
60
- return new AutomationNotFoundError({
61
- automationID: error.automationID,
62
- message: `Automation not found: ${error.automationID}`
63
- });
64
- }
65
- function disabled() {
66
- return new ForbiddenError({ message: new Automation.DisabledError().message });
67
- }
68
-
69
- export { makeAutomation2 };
@@ -1,13 +0,0 @@
1
- import {
2
- response2
3
- } from "./content-headers-ywn523ee.js";
4
- import {
5
- Api2
6
- } from "./content-headers-zjmacp9c.js";
7
-
8
- // src/handlers/skill.ts
9
- import { Skill } from "@opencode/core/skill";
10
- import { HttpApiBuilder } from "effect/http-api";
11
- var SkillHandler2 = HttpApiBuilder.group(Api2, "server.skill", (handlers) => handlers.handle("skill.list", () => response2(Skill.Service.use((skill) => skill.list()))));
12
-
13
- export { SkillHandler2 };