@opencode/server 2.0.16 → 2.0.18

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 (111) hide show
  1. package/dist/api.d.ts +9 -0
  2. package/dist/api.js +5 -5
  3. package/dist/auth.d.ts +4 -0
  4. package/dist/auth.js +10 -2
  5. package/dist/chunks/{auth-43k13dmj.js → service-status-0ar9gf7q.js} +3 -3
  6. package/dist/chunks/{auth-v84hnbsb.js → service-status-0qzy9yxk.js} +3 -3
  7. package/dist/chunks/{auth-50jg7xmc.js → service-status-1wj0ectp.js} +1 -1
  8. package/dist/chunks/{auth-d65y46ag.js → service-status-23w8t84j.js} +1 -1
  9. package/dist/chunks/{auth-83rfx0sp.js → service-status-34e6wr3b.js} +2 -2
  10. package/dist/chunks/{auth-y4j2wswm.js → service-status-3582t7j8.js} +7 -7
  11. package/dist/chunks/{auth-pqe05x32.js → service-status-40g8rvw4.js} +2 -2
  12. package/dist/chunks/{auth-h1w0a8ky.js → service-status-6aya8ky6.js} +2 -2
  13. package/dist/chunks/{auth-mcn2wrk8.js → service-status-74x861p1.js} +19 -15
  14. package/dist/chunks/{auth-b6gan3yw.js → service-status-760vtqy2.js} +2 -2
  15. package/dist/chunks/{auth-eptkag0m.js → service-status-7qtja2kq.js} +1 -1
  16. package/dist/chunks/{auth-e3vgmqs2.js → service-status-8e21y1bd.js} +2 -2
  17. package/dist/chunks/{auth-vsmvcx85.js → service-status-8nbs1vvt.js} +2 -2
  18. package/dist/chunks/{auth-epwv4y6g.js → service-status-8ygjd1s8.js} +2 -2
  19. package/dist/chunks/service-status-anm12x33.js +66 -0
  20. package/dist/chunks/{auth-vnsgjb6m.js → service-status-b85xjfat.js} +6 -6
  21. package/dist/chunks/{auth-h91pzmtp.js → service-status-bgzrbsek.js} +2 -2
  22. package/dist/chunks/{auth-jefcrg4z.js → service-status-bkb1xk38.js} +1 -1
  23. package/dist/chunks/{auth-s1rvn990.js → service-status-bkk2wfbz.js} +7 -7
  24. package/dist/chunks/{auth-jd22znxy.js → service-status-cm8xmqjn.js} +2 -2
  25. package/dist/chunks/{auth-9vrrrs57.js → service-status-d2g7egyw.js} +1 -1
  26. package/dist/chunks/{auth-n0k9wajg.js → service-status-e09mshwt.js} +1 -1
  27. package/dist/chunks/{auth-0xemx5a5.js → service-status-e6vbr4xb.js} +33 -33
  28. package/dist/chunks/{auth-bp2kj98m.js → service-status-erwrh284.js} +2 -2
  29. package/dist/chunks/{auth-ahxdh0dq.js → service-status-f78xgav9.js} +2 -2
  30. package/dist/chunks/{auth-hrfm0p6n.js → service-status-frv6gfy7.js} +1 -1
  31. package/dist/chunks/{auth-ybmm73jc.js → service-status-fyjxk8m3.js} +2 -2
  32. package/dist/chunks/{auth-m6wvgbfq.js → service-status-gtkdacvk.js} +28 -7
  33. package/dist/chunks/{auth-p0qxanbk.js → service-status-kv6ycdgm.js} +3 -3
  34. package/dist/chunks/{auth-s4aja1df.js → service-status-mzr9gftb.js} +7 -7
  35. package/dist/chunks/{auth-99sfd1j8.js → service-status-n9y13hgv.js} +4 -4
  36. package/dist/chunks/service-status-nvqjvwgj.js +53 -0
  37. package/dist/chunks/{auth-1aa7fc0d.js → service-status-pd1pbg0v.js} +2 -2
  38. package/dist/chunks/service-status-sstsrjtg.js +35 -0
  39. package/dist/chunks/{auth-y07r8paj.js → service-status-tk6nqkmh.js} +1 -1
  40. package/dist/chunks/{auth-5frajas6.js → service-status-txhx6f1m.js} +1 -1
  41. package/dist/chunks/{auth-qmx5gmxb.js → service-status-vgxn80m1.js} +2 -2
  42. package/dist/chunks/{auth-kb2gw6wm.js → service-status-xaw29g0h.js} +2 -2
  43. package/dist/chunks/{auth-fdfc8k8f.js → service-status-xpxp1sqb.js} +1 -1
  44. package/dist/chunks/{auth-5w24ch67.js → service-status-xsrtpxyd.js} +4 -4
  45. package/dist/chunks/{auth-tsyxj4xh.js → service-status-z3nth2hg.js} +2 -2
  46. package/dist/chunks/{auth-2v3qky60.js → service-status-z6kg9h7e.js} +3 -3
  47. package/dist/chunks/{auth-7zxr3tkk.js → service-status-zw9j8b8g.js} +2 -2
  48. package/dist/chunks/{auth-f2ryx3d8.js → service-status-zxvt7wd3.js} +2 -2
  49. package/dist/cors.js +1 -1
  50. package/dist/event-feed.js +3 -3
  51. package/dist/fetch.js +49 -48
  52. package/dist/handlers/agent.js +6 -6
  53. package/dist/handlers/command.js +6 -6
  54. package/dist/handlers/config.js +6 -6
  55. package/dist/handlers/credential.js +6 -6
  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.js +6 -6
  64. package/dist/handlers/message.js +6 -6
  65. package/dist/handlers/migration.js +6 -6
  66. package/dist/handlers/model.js +6 -6
  67. package/dist/handlers/permission.js +6 -6
  68. package/dist/handlers/persistent-pty.js +8 -8
  69. package/dist/handlers/plugin.js +6 -6
  70. package/dist/handlers/project.js +6 -6
  71. package/dist/handlers/provider.js +6 -6
  72. package/dist/handlers/pty-socket.js +1 -1
  73. package/dist/handlers/pty.js +9 -9
  74. package/dist/handlers/reference.js +6 -6
  75. package/dist/handlers/rpc.js +6 -6
  76. package/dist/handlers/server.d.ts +3 -1
  77. package/dist/handlers/server.js +9 -7
  78. package/dist/handlers/session-error.js +1 -1
  79. package/dist/handlers/session.js +6 -6
  80. package/dist/handlers/shell.js +6 -6
  81. package/dist/handlers/skill.js +6 -6
  82. package/dist/handlers/vcs.js +6 -6
  83. package/dist/handlers/websearch.js +6 -6
  84. package/dist/handlers/worktree.js +6 -6
  85. package/dist/handlers.d.ts +1 -1
  86. package/dist/handlers.js +43 -41
  87. package/dist/location.js +4 -4
  88. package/dist/middleware/authorization.d.ts +2 -1
  89. package/dist/middleware/authorization.js +5 -3
  90. package/dist/middleware/form-location.js +3 -3
  91. package/dist/middleware/schema-error.js +1 -1
  92. package/dist/middleware/session-location.js +3 -3
  93. package/dist/pairing.d.ts +13 -0
  94. package/dist/pairing.js +10 -0
  95. package/dist/process.js +56 -59
  96. package/dist/pty-environment.js +5 -5
  97. package/dist/request-tracing.js +1 -1
  98. package/dist/routes.d.ts +3 -2
  99. package/dist/routes.js +46 -45
  100. package/dist/server-info.js +5 -5
  101. package/dist/service-status.js +3 -3
  102. package/dist/workerd.js +50 -49
  103. package/package.json +8 -8
  104. package/dist/chunks/auth-qh9c2857.js +0 -21
  105. package/dist/chunks/auth-zyv89x5n.js +0 -30
  106. /package/dist/chunks/{auth-9rqn6x4v.js → service-status-9rqn6x4v.js} +0 -0
  107. /package/dist/chunks/{auth-hezj1jdf.js → service-status-hezj1jdf.js} +0 -0
  108. /package/dist/chunks/{auth-q4bn6dy8.js → service-status-q4bn6dy8.js} +0 -0
  109. /package/dist/chunks/{auth-smaf4a18.js → service-status-smaf4a18.js} +0 -0
  110. /package/dist/chunks/{auth-t8yzmczr.js → service-status-t8yzmczr.js} +0 -0
  111. /package/dist/chunks/{auth-yc7nft6q.js → service-status-yc7nft6q.js} +0 -0
package/dist/api.d.ts CHANGED
@@ -2219,6 +2219,7 @@ export declare const Api: import("@opencode/protocol/api").Api<LocationMiddlewar
2219
2219
  readonly file: import("effect/Schema").String;
2220
2220
  readonly pid: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Int>>, import("effect/Schema").optionalKey<import("effect/Schema").Int>, never, never>;
2221
2221
  readonly exit: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Finite>>, import("effect/Schema").optionalKey<import("effect/Schema").Finite>, never, never>;
2222
+ readonly signal: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").String>>, import("effect/Schema").optionalKey<import("effect/Schema").String>, never, never>;
2222
2223
  readonly metadata: import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>;
2223
2224
  readonly time: import("effect/Schema").Struct<{
2224
2225
  readonly started: import("effect/Schema").Finite;
@@ -2250,6 +2251,7 @@ export declare const Api: import("@opencode/protocol/api").Api<LocationMiddlewar
2250
2251
  readonly file: import("effect/Schema").String;
2251
2252
  readonly pid: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Int>>, import("effect/Schema").optionalKey<import("effect/Schema").Int>, never, never>;
2252
2253
  readonly exit: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Finite>>, import("effect/Schema").optionalKey<import("effect/Schema").Finite>, never, never>;
2254
+ readonly signal: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").String>>, import("effect/Schema").optionalKey<import("effect/Schema").String>, never, never>;
2253
2255
  readonly metadata: import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>;
2254
2256
  readonly time: import("effect/Schema").Struct<{
2255
2257
  readonly started: import("effect/Schema").Finite;
@@ -2305,6 +2307,7 @@ export declare const Api: import("@opencode/protocol/api").Api<LocationMiddlewar
2305
2307
  readonly file: import("effect/Schema").String;
2306
2308
  readonly pid: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Int>>, import("effect/Schema").optionalKey<import("effect/Schema").Int>, never, never>;
2307
2309
  readonly exit: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Finite>>, import("effect/Schema").optionalKey<import("effect/Schema").Finite>, never, never>;
2310
+ readonly signal: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").String>>, import("effect/Schema").optionalKey<import("effect/Schema").String>, never, never>;
2308
2311
  readonly metadata: import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>;
2309
2312
  readonly time: import("effect/Schema").Struct<{
2310
2313
  readonly started: import("effect/Schema").Finite;
@@ -2342,6 +2345,7 @@ export declare const Api: import("@opencode/protocol/api").Api<LocationMiddlewar
2342
2345
  readonly file: import("effect/Schema").String;
2343
2346
  readonly pid: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Int>>, import("effect/Schema").optionalKey<import("effect/Schema").Int>, never, never>;
2344
2347
  readonly exit: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Finite>>, import("effect/Schema").optionalKey<import("effect/Schema").Finite>, never, never>;
2348
+ readonly signal: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").String>>, import("effect/Schema").optionalKey<import("effect/Schema").String>, never, never>;
2345
2349
  readonly metadata: import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>;
2346
2350
  readonly time: import("effect/Schema").Struct<{
2347
2351
  readonly started: import("effect/Schema").Finite;
@@ -5286,6 +5290,7 @@ export declare const Api: import("@opencode/protocol/api").Api<LocationMiddlewar
5286
5290
  readonly file: import("effect/Schema").String;
5287
5291
  readonly pid: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Int>>, import("effect/Schema").optionalKey<import("effect/Schema").Int>, never, never>;
5288
5292
  readonly exit: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Finite>>, import("effect/Schema").optionalKey<import("effect/Schema").Finite>, never, never>;
5293
+ readonly signal: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").String>>, import("effect/Schema").optionalKey<import("effect/Schema").String>, never, never>;
5289
5294
  readonly metadata: import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>;
5290
5295
  readonly time: import("effect/Schema").Struct<{
5291
5296
  readonly started: import("effect/Schema").Finite;
@@ -5310,6 +5315,7 @@ export declare const Api: import("@opencode/protocol/api").Api<LocationMiddlewar
5310
5315
  readonly file: import("effect/Schema").String;
5311
5316
  readonly pid: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Int>>, import("effect/Schema").optionalKey<import("effect/Schema").Int>, never, never>;
5312
5317
  readonly exit: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Finite>>, import("effect/Schema").optionalKey<import("effect/Schema").Finite>, never, never>;
5318
+ readonly signal: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").String>>, import("effect/Schema").optionalKey<import("effect/Schema").String>, never, never>;
5313
5319
  readonly metadata: import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>;
5314
5320
  readonly time: import("effect/Schema").Struct<{
5315
5321
  readonly started: import("effect/Schema").Finite;
@@ -6719,6 +6725,7 @@ export declare const Api: import("@opencode/protocol/api").Api<LocationMiddlewar
6719
6725
  readonly file: string;
6720
6726
  readonly pid?: number | undefined;
6721
6727
  readonly exit?: number | undefined;
6728
+ readonly signal?: string | undefined;
6722
6729
  };
6723
6730
  };
6724
6731
  readonly type: "shell.created";
@@ -7363,6 +7370,7 @@ export declare const Api: import("@opencode/protocol/api").Api<LocationMiddlewar
7363
7370
  readonly file: string;
7364
7371
  readonly pid?: number | undefined;
7365
7372
  readonly exit?: number | undefined;
7373
+ readonly signal?: string | undefined;
7366
7374
  };
7367
7375
  readonly sessionID: string & import("effect/Brand").Brand<"SessionID">;
7368
7376
  };
@@ -7399,6 +7407,7 @@ export declare const Api: import("@opencode/protocol/api").Api<LocationMiddlewar
7399
7407
  readonly file: string;
7400
7408
  readonly pid?: number | undefined;
7401
7409
  readonly exit?: number | undefined;
7410
+ readonly signal?: string | undefined;
7402
7411
  };
7403
7412
  readonly output: {
7404
7413
  readonly output: string;
package/dist/api.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  Api2
3
- } from "./chunks/auth-2v3qky60.js";
4
- import"./chunks/auth-d65y46ag.js";
5
- import"./chunks/auth-hrfm0p6n.js";
6
- import"./chunks/auth-43k13dmj.js";
7
- import"./chunks/auth-smaf4a18.js";
3
+ } from "./chunks/service-status-z6kg9h7e.js";
4
+ import"./chunks/service-status-23w8t84j.js";
5
+ import"./chunks/service-status-frv6gfy7.js";
6
+ import"./chunks/service-status-0ar9gf7q.js";
7
+ import"./chunks/service-status-smaf4a18.js";
8
8
  export {
9
9
  Api2 as Api
10
10
  };
package/dist/auth.d.ts CHANGED
@@ -8,6 +8,7 @@ export type Info = {
8
8
  readonly password: Option.Option<string>;
9
9
  readonly username: string;
10
10
  };
11
+ export declare const SESSION_TTL_SECONDS: number;
11
12
  declare const Config_base: Context.ServiceClass<Config, "@opencode/ServerAuthConfig", Info>;
12
13
  export declare class Config extends Config_base {
13
14
  static configLayer(input: Pick<Info, "password">): Layer.Layer<Config, never, never>;
@@ -15,3 +16,6 @@ export declare class Config extends Config_base {
15
16
  }
16
17
  export declare function required(config: Info): boolean;
17
18
  export declare function authorized(credentials: DecodedCredentials, config: Info): boolean;
19
+ export declare function issueSession(config: Info, now?: number): string | undefined;
20
+ export declare function verifySession(token: string, config: Info, now?: number): boolean;
21
+ export declare function sessionCookieName(host: string | undefined): string;
package/dist/auth.js CHANGED
@@ -1,12 +1,20 @@
1
1
  import {
2
+ SESSION_TTL_SECONDS2,
2
3
  Config2,
3
4
  required2,
4
5
  authorized2,
6
+ issueSession2,
7
+ verifySession2,
8
+ sessionCookieName2,
5
9
  exports_auth
6
- } from "./chunks/auth-zyv89x5n.js";
10
+ } from "./chunks/service-status-anm12x33.js";
7
11
  export {
8
12
  Config2 as Config,
13
+ SESSION_TTL_SECONDS2 as SESSION_TTL_SECONDS,
9
14
  exports_auth as ServerAuth,
10
15
  authorized2 as authorized,
11
- required2 as required
16
+ issueSession2 as issueSession,
17
+ required2 as required,
18
+ sessionCookieName2 as sessionCookieName,
19
+ verifySession2 as verifySession
12
20
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  missingSession2
3
- } from "./auth-smaf4a18.js";
3
+ } from "./service-status-smaf4a18.js";
4
4
 
5
5
  // src/location.ts
6
6
  import { Location } from "@opencode/core/location";
@@ -44,7 +44,7 @@ function decode(input) {
44
44
  return input;
45
45
  }
46
46
  }
47
- var layer3 = Layer.effect(LocationMiddleware2, Effect.gen(function* () {
47
+ var layer5 = Layer.effect(LocationMiddleware2, Effect.gen(function* () {
48
48
  const locations = yield* LocationServiceMap.Service;
49
49
  return LocationMiddleware2.of((effect) => Effect.gen(function* () {
50
50
  const request = yield* HttpServerRequest.HttpServerRequest;
@@ -52,4 +52,4 @@ var layer3 = Layer.effect(LocationMiddleware2, Effect.gen(function* () {
52
52
  }));
53
53
  }));
54
54
 
55
- export { LocationMiddleware2, response2, sessionInfo2, requestRef2, layer3 };
55
+ export { LocationMiddleware2, response2, sessionInfo2, requestRef2, layer5 };
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  Api2
3
- } from "./auth-2v3qky60.js";
3
+ } from "./service-status-z6kg9h7e.js";
4
4
  import {
5
5
  CorsConfig2,
6
6
  isAllowedRequestOrigin2
7
- } from "./auth-q4bn6dy8.js";
7
+ } from "./service-status-q4bn6dy8.js";
8
8
  import {
9
9
  runPtySocket2
10
- } from "./auth-hezj1jdf.js";
10
+ } from "./service-status-hezj1jdf.js";
11
11
 
12
12
  // src/handlers/persistent-pty.ts
13
13
  import { PersistentPty } from "@opencode/core/persistent-pty";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Api2
3
- } from "./auth-2v3qky60.js";
3
+ } from "./service-status-z6kg9h7e.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
  sessionInfo2
3
- } from "./auth-43k13dmj.js";
3
+ } from "./service-status-0ar9gf7q.js";
4
4
 
5
5
  // src/middleware/session-location.ts
6
6
  import { Instance } from "@opencode/core/instance/service";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  response2
3
- } from "./auth-43k13dmj.js";
3
+ } from "./service-status-0ar9gf7q.js";
4
4
  import {
5
5
  Api2
6
- } from "./auth-2v3qky60.js";
6
+ } from "./service-status-z6kg9h7e.js";
7
7
 
8
8
  // src/handlers/skill.ts
9
9
  import { Skill } from "@opencode/core/skill";
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  response2
3
- } from "./auth-43k13dmj.js";
3
+ } from "./service-status-0ar9gf7q.js";
4
4
  import {
5
5
  Api2
6
- } from "./auth-2v3qky60.js";
6
+ } from "./service-status-z6kg9h7e.js";
7
7
  import {
8
8
  CorsConfig2,
9
9
  isAllowedRequestOrigin2
10
- } from "./auth-q4bn6dy8.js";
10
+ } from "./service-status-q4bn6dy8.js";
11
11
  import {
12
- Service3
13
- } from "./auth-s1rvn990.js";
12
+ Service2
13
+ } from "./service-status-bkk2wfbz.js";
14
14
  import {
15
15
  runPtySocket2
16
- } from "./auth-hezj1jdf.js";
16
+ } from "./service-status-hezj1jdf.js";
17
17
 
18
18
  // src/handlers/pty.ts
19
19
  import { Pty } from "@opencode/core/pty";
@@ -37,7 +37,7 @@ var ticketScope = Effect.gen(function* () {
37
37
  var PtyHandler2 = HttpApiBuilder.group(Api2, "server.pty", (handlers) => Effect.gen(function* () {
38
38
  const tickets = yield* PtyTicket.Service;
39
39
  const cors = yield* CorsConfig2;
40
- const environment = yield* Service3;
40
+ const environment = yield* Service2;
41
41
  return handlers.handle("pty.list", Effect.fn(function* () {
42
42
  const pty = yield* Pty.Service;
43
43
  return yield* response2(pty.list());
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  missingSession2,
3
3
  failedMessageDecode2
4
- } from "./auth-smaf4a18.js";
4
+ } from "./service-status-smaf4a18.js";
5
5
  import {
6
6
  Api2
7
- } from "./auth-2v3qky60.js";
7
+ } from "./service-status-z6kg9h7e.js";
8
8
 
9
9
  // src/handlers/message.ts
10
10
  import { SessionMessage } from "@opencode/core/session/message";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  response2
3
- } from "./auth-43k13dmj.js";
3
+ } from "./service-status-0ar9gf7q.js";
4
4
  import {
5
5
  Api2
6
- } from "./auth-2v3qky60.js";
6
+ } from "./service-status-z6kg9h7e.js";
7
7
 
8
8
  // src/handlers/websearch.ts
9
9
  import { WebSearch } from "@opencode/core/websearch";
@@ -1,36 +1,39 @@
1
1
  import {
2
- layer3
3
- } from "./auth-43k13dmj.js";
2
+ layer5
3
+ } from "./service-status-0ar9gf7q.js";
4
4
  import {
5
5
  formLocationLayer2
6
- } from "./auth-hrfm0p6n.js";
6
+ } from "./service-status-frv6gfy7.js";
7
7
  import {
8
8
  sessionLocationLayer2
9
- } from "./auth-d65y46ag.js";
9
+ } from "./service-status-23w8t84j.js";
10
10
  import {
11
11
  Api2
12
- } from "./auth-2v3qky60.js";
12
+ } from "./service-status-z6kg9h7e.js";
13
13
  import {
14
14
  Config2
15
- } from "./auth-zyv89x5n.js";
15
+ } from "./service-status-anm12x33.js";
16
16
  import {
17
17
  CorsConfig2
18
- } from "./auth-q4bn6dy8.js";
18
+ } from "./service-status-q4bn6dy8.js";
19
+ import {
20
+ layer3
21
+ } from "./service-status-mzr9gftb.js";
19
22
  import {
20
- layer2
21
- } from "./auth-s4aja1df.js";
23
+ node3
24
+ } from "./service-status-sstsrjtg.js";
22
25
  import {
23
26
  node2
24
- } from "./auth-s1rvn990.js";
27
+ } from "./service-status-bkk2wfbz.js";
25
28
  import {
26
29
  handlers2
27
- } from "./auth-0xemx5a5.js";
30
+ } from "./service-status-e6vbr4xb.js";
28
31
  import {
29
32
  authorizationLayer2
30
- } from "./auth-m6wvgbfq.js";
33
+ } from "./service-status-gtkdacvk.js";
31
34
  import {
32
35
  schemaErrorLayer2
33
- } from "./auth-t8yzmczr.js";
36
+ } from "./service-status-t8yzmczr.js";
34
37
 
35
38
  // src/routes.ts
36
39
  import { Database } from "@opencode/core/database/database";
@@ -89,6 +92,7 @@ var applicationServiceNodes = [
89
92
  Credential.node,
90
93
  WellKnown.node,
91
94
  node2,
95
+ node3,
92
96
  LocationServiceMap.node,
93
97
  LocationActivity.node,
94
98
  SessionRestart.node,
@@ -140,8 +144,8 @@ function makeRoutes(auth, options, serviceURLs, overrides, instances) {
140
144
  })) : build(overrides);
141
145
  return serviceLayer.pipe(Layer.flatMap((context) => {
142
146
  const services = Layer.succeedContext(context);
143
- const requestServices = Layer.merge(Layer.succeedContext(Context.pick(Database.Service, Credential.Service, PermissionSaved.Service, PluginUpdate.Service, Project.Service, WellKnown.Service)(context)), layer2(serviceURLs, Context.get(context, Global.Service).tmp, options.app));
144
- 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(layer3), 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(layer5), Layer.provide(authorizationLayer2), Layer.provide(schemaErrorLayer2), Layer.provide(auth), HttpRouter.provideRequest(requestServices), Layer.provideMerge(services), Layer.provideMerge(HttpRouter.layer));
145
149
  return Layer.merge(api, V1Migration.layer.pipe(Layer.provide(services)));
146
150
  }));
147
151
  }
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  response2
3
- } from "./auth-43k13dmj.js";
3
+ } from "./service-status-0ar9gf7q.js";
4
4
  import {
5
5
  Api2
6
- } from "./auth-2v3qky60.js";
6
+ } from "./service-status-z6kg9h7e.js";
7
7
 
8
8
  // src/handlers/provider.ts
9
9
  import { Provider } from "@opencode/core/provider";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Api2
3
- } from "./auth-2v3qky60.js";
3
+ } from "./service-status-z6kg9h7e.js";
4
4
 
5
5
  // src/handlers/project.ts
6
6
  import { Project } from "@opencode/core/project";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  requestRef2
3
- } from "./auth-43k13dmj.js";
3
+ } from "./service-status-0ar9gf7q.js";
4
4
  import {
5
5
  Api2
6
- } from "./auth-2v3qky60.js";
6
+ } from "./service-status-z6kg9h7e.js";
7
7
 
8
8
  // src/handlers/debug.ts
9
9
  import { LocationServiceMap } from "@opencode/core/location-service-map";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  response2
3
- } from "./auth-43k13dmj.js";
3
+ } from "./service-status-0ar9gf7q.js";
4
4
  import {
5
5
  Api2
6
- } from "./auth-2v3qky60.js";
6
+ } from "./service-status-z6kg9h7e.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 "./auth-43k13dmj.js";
3
+ } from "./service-status-0ar9gf7q.js";
4
4
  import {
5
5
  Api2
6
- } from "./auth-2v3qky60.js";
6
+ } from "./service-status-z6kg9h7e.js";
7
7
 
8
8
  // src/handlers/mcp.ts
9
9
  import { Mcp } from "@opencode/core/mcp/index";
@@ -0,0 +1,66 @@
1
+ import {
2
+ __export
3
+ } from "./service-status-9rqn6x4v.js";
4
+
5
+ // src/auth.ts
6
+ var exports_auth = {};
7
+ __export(exports_auth, {
8
+ Config: () => Config2,
9
+ SESSION_TTL_SECONDS: () => SESSION_TTL_SECONDS2,
10
+ ServerAuth: () => exports_auth,
11
+ authorized: () => authorized2,
12
+ issueSession: () => issueSession2,
13
+ required: () => required2,
14
+ sessionCookieName: () => sessionCookieName2,
15
+ verifySession: () => verifySession2
16
+ });
17
+ import { Context, Layer, Option, Redacted } from "effect";
18
+ import { createHmac, timingSafeEqual } from "node:crypto";
19
+ var SESSION_TTL_SECONDS2 = 30 * 24 * 60 * 60;
20
+
21
+ class Config2 extends Context.Service()("@opencode/ServerAuthConfig") {
22
+ static configLayer(input) {
23
+ return Layer.succeed(this, this.of({ ...input, username: "opencode" }));
24
+ }
25
+ static get layer() {
26
+ return this.configLayer({ password: Option.none() });
27
+ }
28
+ }
29
+ function required2(config) {
30
+ return Option.isSome(config.password) && config.password.value !== "";
31
+ }
32
+ function authorized2(credentials, config) {
33
+ if (Option.isNone(config.password) || credentials.username !== config.username)
34
+ return false;
35
+ const password = Redacted.value(credentials.password);
36
+ return password === config.password.value || verifySession2(password, config);
37
+ }
38
+ function issueSession2(config, now = Date.now()) {
39
+ if (Option.isNone(config.password))
40
+ return;
41
+ const expires = String(Math.floor(now / 1000) + SESSION_TTL_SECONDS2);
42
+ return `${expires}.${sign(config.password.value, expires)}`;
43
+ }
44
+ function verifySession2(token, config, now = Date.now()) {
45
+ if (Option.isNone(config.password))
46
+ return false;
47
+ const parts = token.split(".");
48
+ if (parts.length !== 2)
49
+ return false;
50
+ const expires = Number(parts[0]);
51
+ if (!Number.isSafeInteger(expires) || expires * 1000 <= now)
52
+ return false;
53
+ const expected = Buffer.from(sign(config.password.value, parts[0]));
54
+ const actual = Buffer.from(parts[1]);
55
+ return actual.length === expected.length && timingSafeEqual(actual, expected);
56
+ }
57
+ function sessionCookieName2(host) {
58
+ const port = URL.parse(`http://${host ?? ""}`)?.port;
59
+ return port ? `opencode_session_${port}` : "opencode_session";
60
+ }
61
+ function sign(password, payload) {
62
+ const key = createHmac("sha256", password).update("opencode-session-v1").digest();
63
+ return createHmac("sha256", key).update(payload).digest("base64url");
64
+ }
65
+
66
+ export { SESSION_TTL_SECONDS2, Config2, required2, authorized2, issueSession2, verifySession2, sessionCookieName2, exports_auth };
@@ -1,26 +1,26 @@
1
1
  import {
2
2
  isAllowedCorsOrigin2
3
- } from "./auth-q4bn6dy8.js";
3
+ } from "./service-status-q4bn6dy8.js";
4
4
  import {
5
5
  createRoutes2
6
- } from "./auth-mcn2wrk8.js";
6
+ } from "./service-status-74x861p1.js";
7
7
  import {
8
8
  __export
9
- } from "./auth-9rqn6x4v.js";
9
+ } from "./service-status-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/unstable/http";
19
19
  import { SessionRestart } from "@opencode/core/session/execution/restart";
20
- var make2 = Effect.fn("ServerFetch.make")(function* (options = {}, boot = {}) {
20
+ var make3 = Effect.fn("ServerFetch.make")(function* (options = {}, boot = {}) {
21
21
  const context = yield* Layer.build(createRoutes2(options, () => [], boot.overrides ?? []).pipe(Layer.provide(HttpServer.layerServices)));
22
22
  yield* Effect.forkDetach(Context.get(context, SessionRestart.Service).resumeSuspendedSessions);
23
23
  return Context.get(context, HttpRouter.HttpRouter).asHttpEffect().pipe(HttpMiddleware.cors({ allowedOrigins: (origin) => isAllowedCorsOrigin2(origin, options), maxAge: 86400 }), HttpEffect.toWebHandlerWith(context));
24
24
  });
25
25
 
26
- export { make2, exports_fetch };
26
+ export { make3, exports_fetch };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  response2
3
- } from "./auth-43k13dmj.js";
3
+ } from "./service-status-0ar9gf7q.js";
4
4
  import {
5
5
  Api2
6
- } from "./auth-2v3qky60.js";
6
+ } from "./service-status-z6kg9h7e.js";
7
7
 
8
8
  // src/handlers/command.ts
9
9
  import { Command } from "@opencode/core/command";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Api2
3
- } from "./auth-2v3qky60.js";
3
+ } from "./service-status-z6kg9h7e.js";
4
4
 
5
5
  // src/handlers/worktree.ts
6
6
  import { Git } from "@opencode/core/git";
@@ -1,23 +1,23 @@
1
1
  import {
2
2
  __export
3
- } from "./auth-9rqn6x4v.js";
3
+ } from "./service-status-9rqn6x4v.js";
4
4
 
5
5
  // src/pty-environment.ts
6
6
  var exports_pty_environment = {};
7
7
  __export(exports_pty_environment, {
8
8
  PtyEnvironment: () => exports_pty_environment,
9
- Service: () => Service3,
10
- layer: () => layer4,
9
+ Service: () => Service2,
10
+ layer: () => layer2,
11
11
  node: () => node2
12
12
  });
13
13
  import { Context, Effect, Layer } from "effect";
14
14
  import { makeGlobalNode } from "@opencode/util/effect/app-node";
15
15
 
16
- class Service3 extends Context.Service()("@opencode/ServerPtyEnvironment") {
16
+ class Service2 extends Context.Service()("@opencode/ServerPtyEnvironment") {
17
17
  }
18
- var layer4 = Layer.succeed(Service3, Service3.of({
18
+ var layer2 = Layer.succeed(Service2, Service2.of({
19
19
  get: () => Effect.succeed({})
20
20
  }));
21
- var node2 = makeGlobalNode({ service: Service3, layer: layer4, deps: [] });
21
+ var node2 = makeGlobalNode({ service: Service2, layer: layer2, deps: [] });
22
22
 
23
- export { Service3, layer4, node2, exports_pty_environment };
23
+ export { Service2, layer2, node2, exports_pty_environment };
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  response2
3
- } from "./auth-43k13dmj.js";
3
+ } from "./service-status-0ar9gf7q.js";
4
4
  import {
5
5
  Api2
6
- } from "./auth-2v3qky60.js";
6
+ } from "./service-status-z6kg9h7e.js";
7
7
 
8
8
  // src/handlers/reference.ts
9
9
  import { Reference } from "@opencode/core/reference";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Api2
3
- } from "./auth-2v3qky60.js";
3
+ } from "./service-status-z6kg9h7e.js";
4
4
 
5
5
  // src/handlers/generate.ts
6
6
  import { Generate } from "@opencode/core/generate";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Api2
3
- } from "./auth-2v3qky60.js";
3
+ } from "./service-status-z6kg9h7e.js";
4
4
 
5
5
  // src/handlers/credential.ts
6
6
  import { Credential } from "@opencode/core/credential";