@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.
- package/dist/api.d.ts +249 -1
- package/dist/api.js +5 -5
- package/dist/auth.js +1 -1
- package/dist/chunks/workerd-0rzj25w4.js +194 -0
- package/dist/chunks/{media-uri-2eaky32g.js → workerd-20wvj9q6.js} +2 -2
- package/dist/chunks/{media-uri-39nnfjx1.js → workerd-39nnfjx1.js} +1 -1
- package/dist/chunks/{media-uri-tbqv89f6.js → workerd-3rn5pzng.js} +5 -5
- package/dist/chunks/{media-uri-ny1j968n.js → workerd-4apj6a8e.js} +2 -2
- package/dist/chunks/{media-uri-09kw3a77.js → workerd-4gbck4qg.js} +2 -2
- package/dist/chunks/{media-uri-91858wp1.js → workerd-4r2ye500.js} +2 -2
- package/dist/chunks/{media-uri-sssj0qa5.js → workerd-5dgtfnrn.js} +47 -20
- package/dist/chunks/{media-uri-az0609r6.js → workerd-6t6fd9bq.js} +2 -4
- package/dist/chunks/{media-uri-wmep189j.js → workerd-73tyf2qy.js} +8 -8
- package/dist/chunks/{media-uri-cmnrxx36.js → workerd-77gnb026.js} +4 -4
- package/dist/chunks/{media-uri-z3e7v67k.js → workerd-7dtbad8d.js} +7 -7
- package/dist/chunks/{media-uri-kkdkqt8j.js → workerd-7x6cg3xs.js} +2 -4
- package/dist/chunks/{media-uri-78rcgzsr.js → workerd-7ydfwv45.js} +4 -1
- package/dist/chunks/{media-uri-yk755swr.js → workerd-86dz2n4m.js} +5 -4
- package/dist/chunks/{media-uri-1h6b4sc5.js → workerd-8mfdzabk.js} +6 -18
- package/dist/chunks/{media-uri-btahnm2b.js → workerd-8n1ypg70.js} +3 -3
- package/dist/chunks/{media-uri-8sb6qqpn.js → workerd-8sb6qqpn.js} +1 -1
- package/dist/chunks/{media-uri-qd0r787n.js → workerd-b1x3j2e8.js} +2 -2
- package/dist/chunks/{media-uri-qcg3sqtb.js → workerd-b7yt2ykh.js} +2 -2
- package/dist/chunks/{media-uri-4q6e7fh8.js → workerd-b87bs0cf.js} +2 -2
- package/dist/chunks/{media-uri-z9zyd4qg.js → workerd-bvm82fhd.js} +4 -4
- package/dist/chunks/{media-uri-rha2aq18.js → workerd-d0advawr.js} +2 -5
- package/dist/chunks/{media-uri-djr0jy89.js → workerd-djr0jy89.js} +1 -1
- package/dist/chunks/{media-uri-ssxxka7j.js → workerd-dqfyxmp4.js} +4 -4
- package/dist/chunks/{media-uri-a8jcac9a.js → workerd-edwk6ehd.js} +1 -1
- package/dist/chunks/{media-uri-qfyg9gb7.js → workerd-fvpjvjpp.js} +7 -7
- package/dist/chunks/{media-uri-cr5sd8bz.js → workerd-g23ffrnz.js} +3 -3
- package/dist/chunks/{media-uri-rs3v36hp.js → workerd-g80pvn6e.js} +2 -2
- package/dist/chunks/{media-uri-cezwbsk5.js → workerd-g97h7k0s.js} +1 -1
- package/dist/chunks/workerd-hgrkvk6s.js +48 -0
- package/dist/chunks/{media-uri-j4at0y5c.js → workerd-j4at0y5c.js} +1 -1
- package/dist/chunks/{media-uri-50bbk3b2.js → workerd-j80tzjj3.js} +4 -12
- package/dist/chunks/{media-uri-3pb3n73h.js → workerd-jpqse2v9.js} +35 -35
- package/dist/chunks/{media-uri-8mj7kvhm.js → workerd-k26h7zjg.js} +2 -2
- package/dist/chunks/{media-uri-b4rhnd07.js → workerd-kffke7z4.js} +15 -9
- package/dist/chunks/{media-uri-myqk22k5.js → workerd-myqk22k5.js} +2 -2
- package/dist/chunks/{media-uri-htyf2qs7.js → workerd-n6ypjnhz.js} +1 -1
- package/dist/chunks/{media-uri-6kawhtwy.js → workerd-nkfbbfe7.js} +4 -4
- package/dist/chunks/{media-uri-5cpb32hf.js → workerd-p4zkxzv7.js} +1 -1
- package/dist/chunks/{media-uri-enp1bp7r.js → workerd-p9wp66hf.js} +1 -1
- package/dist/chunks/{media-uri-6z9pvq7p.js → workerd-pv4dnzzq.js} +1 -1
- package/dist/chunks/{media-uri-b3bmdkga.js → workerd-qahj7606.js} +1 -1
- package/dist/chunks/{media-uri-7b9xm1qg.js → workerd-rktygpea.js} +4 -1
- package/dist/chunks/{media-uri-j87xz9bt.js → workerd-s8t5gq7c.js} +3 -3
- package/dist/chunks/{media-uri-t32e1bbt.js → workerd-t32e1bbt.js} +1 -1
- package/dist/chunks/{media-uri-p86kew8c.js → workerd-t62b1gmw.js} +2 -2
- package/dist/chunks/{media-uri-te8jwba1.js → workerd-t8azv5ge.js} +2 -2
- package/dist/chunks/{media-uri-d0edqfxx.js → workerd-v0z8pce5.js} +3 -6
- package/dist/chunks/{media-uri-n0chxnkn.js → workerd-vxy32kc1.js} +4 -4
- package/dist/chunks/{media-uri-1gwc8nvb.js → workerd-w13ad1dk.js} +3 -3
- package/dist/chunks/{media-uri-mzs0n5xz.js → workerd-w9jcwh65.js} +7 -7
- package/dist/chunks/{media-uri-zcvan105.js → workerd-wh07bcjv.js} +1 -1
- package/dist/chunks/{media-uri-f559fakr.js → workerd-zrptb2x8.js} +2 -2
- package/dist/content-headers.js +1 -1
- package/dist/cors.js +1 -1
- package/dist/event-feed.js +5 -5
- package/dist/fetch.js +60 -59
- package/dist/handlers/agent.js +6 -6
- package/dist/handlers/artifact.js +3 -3
- package/dist/handlers/automation.d.ts +2 -4
- package/dist/handlers/automation.js +2 -2
- package/dist/handlers/blob.js +3 -3
- package/dist/handlers/command.js +6 -6
- package/dist/handlers/config.js +6 -6
- package/dist/handlers/credential.d.ts +1 -1
- package/dist/handlers/credential.js +7 -7
- package/dist/handlers/debug.js +6 -6
- package/dist/handlers/event.js +7 -7
- package/dist/handlers/form.js +6 -6
- package/dist/handlers/fs.js +8 -8
- package/dist/handlers/generate.js +6 -6
- package/dist/handlers/integration.js +6 -6
- package/dist/handlers/job.d.ts +13 -1
- package/dist/handlers/job.js +2 -2
- package/dist/handlers/location.js +6 -6
- package/dist/handlers/machine.d.ts +95 -0
- package/dist/handlers/machine.js +18 -0
- package/dist/handlers/mcp.js +8 -8
- package/dist/handlers/media.js +2 -2
- package/dist/handlers/message.js +7 -7
- package/dist/handlers/migration.js +6 -6
- package/dist/handlers/model.js +6 -6
- package/dist/handlers/permission.js +6 -6
- package/dist/handlers/persistent-pty.d.ts +1 -1
- package/dist/handlers/persistent-pty.js +16 -15
- package/dist/handlers/plugin.js +6 -6
- package/dist/handlers/project.js +6 -6
- package/dist/handlers/provider.js +6 -6
- package/dist/handlers/pty-socket.js +1 -1
- package/dist/handlers/pty.js +8 -8
- package/dist/handlers/reference.js +6 -6
- package/dist/handlers/rpc.js +6 -6
- package/dist/handlers/server.js +9 -9
- package/dist/handlers/session-error.js +1 -1
- package/dist/handlers/session.js +7 -7
- package/dist/handlers/shell.js +6 -6
- package/dist/handlers/skill.js +6 -6
- package/dist/handlers/usage.js +6 -6
- package/dist/handlers/vcs.js +6 -6
- package/dist/handlers/voice.js +6 -6
- package/dist/handlers/websearch.js +6 -6
- package/dist/handlers/worktree.js +6 -6
- package/dist/handlers.d.ts +1 -1
- package/dist/handlers.js +53 -52
- package/dist/location.d.ts +1 -3
- package/dist/location.js +4 -6
- package/dist/media-uri.js +1 -1
- package/dist/middleware/authorization.js +2 -2
- package/dist/middleware/defect-response.js +1 -1
- package/dist/middleware/form-location.js +3 -3
- package/dist/middleware/schema-error.js +1 -1
- package/dist/middleware/session-location.js +3 -3
- package/dist/pairing.js +3 -3
- package/dist/process.js +72 -63
- package/dist/range.js +1 -1
- package/dist/request-site.js +2 -2
- package/dist/request-tracing.js +1 -1
- package/dist/routes.d.ts +6 -2
- package/dist/routes.js +57 -56
- package/dist/server-info.js +5 -5
- package/dist/service-status.js +1 -1
- package/dist/workerd.js +63 -60
- package/package.json +8 -8
- package/dist/chunks/media-uri-9cd3a4b8.js +0 -69
- /package/dist/chunks/{media-uri-9rqn6x4v.js → workerd-9rqn6x4v.js} +0 -0
- /package/dist/chunks/{media-uri-bd8755ek.js → workerd-bd8755ek.js} +0 -0
- /package/dist/chunks/{media-uri-n26yr6pw.js → workerd-n26yr6pw.js} +0 -0
- /package/dist/chunks/{media-uri-q187pxxd.js → workerd-q187pxxd.js} +0 -0
- /package/dist/chunks/{media-uri-q4bn6dy8.js → workerd-q4bn6dy8.js} +0 -0
- /package/dist/chunks/{media-uri-smaf4a18.js → workerd-smaf4a18.js} +0 -0
- /package/dist/chunks/{media-uri-xthc02cw.js → workerd-xthc02cw.js} +0 -0
- /package/dist/chunks/{media-uri-yc7nft6q.js → workerd-yc7nft6q.js} +0 -0
|
@@ -1,44 +1,45 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./
|
|
2
|
+
layer3
|
|
3
|
+
} from "./workerd-j80tzjj3.js";
|
|
4
4
|
import {
|
|
5
5
|
formLocationLayer2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./workerd-n6ypjnhz.js";
|
|
7
7
|
import {
|
|
8
8
|
sessionLocationLayer2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./workerd-qahj7606.js";
|
|
10
10
|
import {
|
|
11
11
|
Api2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./workerd-s8t5gq7c.js";
|
|
13
13
|
import {
|
|
14
14
|
Config2
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./workerd-j4at0y5c.js";
|
|
16
16
|
import {
|
|
17
17
|
CorsConfig2
|
|
18
|
-
} from "./
|
|
18
|
+
} from "./workerd-q4bn6dy8.js";
|
|
19
19
|
import {
|
|
20
|
-
|
|
21
|
-
} from "./
|
|
20
|
+
layer4
|
|
21
|
+
} from "./workerd-7dtbad8d.js";
|
|
22
22
|
import {
|
|
23
23
|
node2
|
|
24
|
-
} from "./
|
|
24
|
+
} from "./workerd-w9jcwh65.js";
|
|
25
25
|
import {
|
|
26
26
|
handlers2
|
|
27
|
-
} from "./
|
|
27
|
+
} from "./workerd-jpqse2v9.js";
|
|
28
28
|
import {
|
|
29
29
|
authorizationLayer2
|
|
30
|
-
} from "./
|
|
30
|
+
} from "./workerd-rktygpea.js";
|
|
31
31
|
import {
|
|
32
32
|
schemaErrorLayer2
|
|
33
|
-
} from "./
|
|
33
|
+
} from "./workerd-bd8755ek.js";
|
|
34
34
|
import {
|
|
35
35
|
defectResponseLayer2
|
|
36
|
-
} from "./
|
|
36
|
+
} from "./workerd-n26yr6pw.js";
|
|
37
37
|
|
|
38
38
|
// src/routes.ts
|
|
39
39
|
import { Database } from "@opencode/core/database/database";
|
|
40
40
|
import { V1Migration } from "@opencode/core/database/v1-migration";
|
|
41
41
|
import { App } from "@opencode/core/app";
|
|
42
|
+
import { CodeModeApi } from "@opencode/core/codemode/api";
|
|
42
43
|
import { LayerNode } from "@opencode/util/effect/layer-node";
|
|
43
44
|
import { fetchLayer, httpClient, httpFetch } from "@opencode/util/effect/app-node-platform";
|
|
44
45
|
import { AppNodeBuilder } from "@opencode/core/effect/app-node-builder";
|
|
@@ -68,6 +69,9 @@ import { FSUtil } from "@opencode/util/fs-util";
|
|
|
68
69
|
import { InstructionDiscovery } from "@opencode/core/instruction-discovery";
|
|
69
70
|
import { LocationServiceMap } from "@opencode/core/location-service-map";
|
|
70
71
|
import { LocationActivity } from "@opencode/core/location-activity";
|
|
72
|
+
import { Identity } from "@opencode/core/machine/identity";
|
|
73
|
+
import { Machines } from "@opencode/core/machine/machines";
|
|
74
|
+
import { SessionSearchBuild } from "@opencode/core/session/search-build";
|
|
71
75
|
import { ModelsDev } from "@opencode/core/models-dev";
|
|
72
76
|
import { SessionRestart } from "@opencode/core/session/execution/restart";
|
|
73
77
|
import { Automation } from "@opencode/core/automation";
|
|
@@ -77,11 +81,13 @@ import { WellKnown } from "@opencode/core/wellknown";
|
|
|
77
81
|
import { Workspace } from "@opencode/core/workspace";
|
|
78
82
|
import { Watcher } from "@opencode/core/filesystem/watcher";
|
|
79
83
|
import { FileWatch } from "@opencode/core/filesystem/file-watch";
|
|
80
|
-
import { HttpRouter } from "effect/http";
|
|
84
|
+
import { HttpEffect, HttpRouter } from "effect/http";
|
|
81
85
|
import { HttpApiBuilder } from "effect/http-api";
|
|
82
86
|
import { Context, Effect, Layer, Option } from "effect";
|
|
87
|
+
import { Base64 } from "effect/encoding";
|
|
83
88
|
var applicationServiceNodes = [
|
|
84
89
|
App.node,
|
|
90
|
+
CodeModeApi.node,
|
|
85
91
|
Global.node,
|
|
86
92
|
FSUtil.node,
|
|
87
93
|
Database.node,
|
|
@@ -112,18 +118,37 @@ var applicationServiceNodes = [
|
|
|
112
118
|
Automation.node,
|
|
113
119
|
BlobStore.node,
|
|
114
120
|
VideoGeneration.node,
|
|
121
|
+
SessionSearchBuild.node,
|
|
115
122
|
Workspace.node,
|
|
123
|
+
Machines.node,
|
|
124
|
+
Identity.node,
|
|
116
125
|
FileWatch.node
|
|
117
126
|
];
|
|
118
127
|
var applicationServices = LayerNode.group(applicationServiceNodes);
|
|
119
128
|
function createRoutes2(options = {}, serviceURLs = () => [], overrides = []) {
|
|
120
|
-
return makeRoutes(options.password ?
|
|
129
|
+
return makeRoutes(options.password ? Option.some(options.password) : Option.none(), options, serviceURLs, overrides);
|
|
121
130
|
}
|
|
122
131
|
function createEmbeddedRoutes2(options = {}, overrides = [], instances) {
|
|
123
|
-
return makeRoutes(
|
|
132
|
+
return makeRoutes(Option.none(), options, () => [], overrides, instances);
|
|
124
133
|
}
|
|
125
|
-
function makeRoutes(
|
|
134
|
+
function makeRoutes(password, options, serviceURLs, overrides, instances) {
|
|
135
|
+
const auth = Config2.configLayer({ password });
|
|
136
|
+
const credential = Option.map(password, (value) => `Basic ${Base64.encode(`opencode:${value}`)}`);
|
|
137
|
+
let internal;
|
|
126
138
|
const standard = [
|
|
139
|
+
CodeModeApi.node.replace(Layer.succeed(CodeModeApi.Service, CodeModeApi.Service.of({
|
|
140
|
+
fetch: (request) => Effect.suspend(() => {
|
|
141
|
+
const handle = internal;
|
|
142
|
+
if (!handle)
|
|
143
|
+
return Effect.fail(new Error("The OpenCode API is not ready yet."));
|
|
144
|
+
if (Option.isSome(credential))
|
|
145
|
+
request.headers.set("authorization", credential.value);
|
|
146
|
+
return Effect.tryPromise({
|
|
147
|
+
try: () => handle(request),
|
|
148
|
+
catch: (error) => error instanceof Error ? error : new Error(String(error))
|
|
149
|
+
});
|
|
150
|
+
})
|
|
151
|
+
}))),
|
|
127
152
|
Database.node.replace(Database.configured(options.database)),
|
|
128
153
|
PersistentPty.node.replace(PersistentPty.configured(options.pty)),
|
|
129
154
|
Bus.node.replace(Bus.configured({ persist: options.events?.persist })),
|
|
@@ -167,8 +192,10 @@ function makeRoutes(auth, options, serviceURLs, overrides, instances) {
|
|
|
167
192
|
})) : build(overrides);
|
|
168
193
|
return serviceLayer.pipe(Layer.flatMap((context) => {
|
|
169
194
|
const services = Layer.succeedContext(context);
|
|
170
|
-
const requestServices = Layer.merge(Layer.succeedContext(Context.pick(Database.Service, Credential.Service, PermissionSaved.Service, PluginUpdate.Service, Project.Service, WellKnown.Service)(context)),
|
|
171
|
-
const api = HttpApiBuilder.layer(Api2, { openapiPath: "/openapi.json" }).pipe(Layer.provide(handlers2.pipe(Layer.provide(services), Layer.provide(Layer.succeed(CorsConfig2, options)))), Layer.provide(formLocationLayer2), Layer.provide(sessionLocationLayer2), Layer.provide(
|
|
195
|
+
const requestServices = Layer.merge(Layer.succeedContext(Context.pick(Database.Service, Credential.Service, PermissionSaved.Service, PluginUpdate.Service, Project.Service, WellKnown.Service)(context)), layer4(serviceURLs, Context.get(context, Global.Service).tmp, options.app));
|
|
196
|
+
const api = HttpApiBuilder.layer(Api2, { openapiPath: "/openapi.json" }).pipe(Layer.provide(handlers2.pipe(Layer.provide(services), Layer.provide(Layer.succeed(CorsConfig2, options)))), Layer.provide(formLocationLayer2), Layer.provide(sessionLocationLayer2), Layer.provide(layer3), Layer.provide(authorizationLayer2), Layer.provide(schemaErrorLayer2), Layer.provide(auth), HttpRouter.provideRequest(requestServices), Layer.merge(defectResponseLayer2), Layer.provideMerge(services), Layer.provideMerge(HttpRouter.layer), Layer.tap((context) => Effect.sync(() => {
|
|
197
|
+
internal = Context.get(context, HttpRouter.HttpRouter).asHttpEffect().pipe(HttpEffect.toWebHandlerWith(context));
|
|
198
|
+
})));
|
|
172
199
|
return Layer.merge(api, V1Migration.layer.pipe(Layer.provide(services)));
|
|
173
200
|
}));
|
|
174
201
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
awaitPlugins2,
|
|
3
2
|
response2
|
|
4
|
-
} from "./
|
|
3
|
+
} from "./workerd-j80tzjj3.js";
|
|
5
4
|
import {
|
|
6
5
|
Api2
|
|
7
|
-
} from "./
|
|
6
|
+
} from "./workerd-s8t5gq7c.js";
|
|
8
7
|
|
|
9
8
|
// src/handlers/provider.ts
|
|
10
9
|
import { Provider } from "@opencode/core/provider";
|
|
@@ -13,7 +12,6 @@ import { Effect } from "effect";
|
|
|
13
12
|
import { HttpApiBuilder } from "effect/http-api";
|
|
14
13
|
var ProviderHandler2 = HttpApiBuilder.group(Api2, "server.provider", (handlers) => Effect.gen(function* () {
|
|
15
14
|
return handlers.handle("provider.list", Effect.fn(function* () {
|
|
16
|
-
yield* awaitPlugins2;
|
|
17
15
|
const providers = yield* Provider.Service;
|
|
18
16
|
return yield* response2(providers.available());
|
|
19
17
|
})).handle("provider.get", Effect.fn(function* (ctx) {
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./workerd-s8t5gq7c.js";
|
|
4
4
|
import {
|
|
5
5
|
SESSION_TTL_SECONDS2,
|
|
6
6
|
Config2,
|
|
7
7
|
issueSession2,
|
|
8
8
|
sessionCookieName2
|
|
9
|
-
} from "./
|
|
10
|
-
import {
|
|
11
|
-
Service2
|
|
12
|
-
} from "./media-uri-z3e7v67k.js";
|
|
9
|
+
} from "./workerd-j4at0y5c.js";
|
|
13
10
|
import {
|
|
14
11
|
Service4
|
|
15
|
-
} from "./
|
|
12
|
+
} from "./workerd-7dtbad8d.js";
|
|
13
|
+
import {
|
|
14
|
+
Service3
|
|
15
|
+
} from "./workerd-w9jcwh65.js";
|
|
16
16
|
|
|
17
17
|
// src/handlers/server.ts
|
|
18
18
|
import { hostname } from "node:os";
|
|
@@ -22,10 +22,10 @@ import { HttpApiBuilder } from "effect/http-api";
|
|
|
22
22
|
import { PersistentPty } from "@opencode/core/persistent-pty";
|
|
23
23
|
import { UnauthorizedError } from "@opencode/protocol/errors";
|
|
24
24
|
var ServerHandler2 = HttpApiBuilder.group(Api2, "server.server", (handlers) => Effect.gen(function* () {
|
|
25
|
-
const pairing = yield*
|
|
25
|
+
const pairing = yield* Service3;
|
|
26
26
|
const auth = yield* Config2;
|
|
27
27
|
return handlers.handle("server.info", () => Effect.gen(function* () {
|
|
28
|
-
const info = yield*
|
|
28
|
+
const info = yield* Service4;
|
|
29
29
|
return {
|
|
30
30
|
version: info.app.version ?? "unknown",
|
|
31
31
|
pid: process.pid ?? 0,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./workerd-s8t5gq7c.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
5
|
+
Service2,
|
|
6
6
|
frame2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./workerd-fvpjvjpp.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/event.ts
|
|
10
10
|
import { Event } from "@opencode/schema/event";
|
|
@@ -12,7 +12,7 @@ import { Effect, Stream } from "effect";
|
|
|
12
12
|
import { HttpServerResponse } from "effect/http";
|
|
13
13
|
import { HttpApiBuilder } from "effect/http-api";
|
|
14
14
|
var EventHandler2 = HttpApiBuilder.group(Api2, "server.event", (handlers) => Effect.gen(function* () {
|
|
15
|
-
const feed = yield*
|
|
15
|
+
const feed = yield* Service2;
|
|
16
16
|
return handlers.handleRaw("event.subscribe", (ctx) => Effect.gen(function* () {
|
|
17
17
|
const connected = {
|
|
18
18
|
id: Event.ID.create(),
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__export
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./workerd-9rqn6x4v.js";
|
|
4
4
|
|
|
5
5
|
// src/server-info.ts
|
|
6
6
|
var exports_server_info = {};
|
|
7
7
|
__export(exports_server_info, {
|
|
8
8
|
ServerInfo: () => exports_server_info,
|
|
9
|
-
Service: () =>
|
|
9
|
+
Service: () => Service4,
|
|
10
10
|
connectionURLs: () => connectionURLs2,
|
|
11
|
-
layer: () =>
|
|
11
|
+
layer: () => layer4
|
|
12
12
|
});
|
|
13
13
|
import { Context, Layer } from "effect";
|
|
14
14
|
import { networkInterfaces } from "node:os";
|
|
15
15
|
|
|
16
|
-
class
|
|
16
|
+
class Service4 extends Context.Service()("@opencode/server/ServerInfo") {
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
return Layer.succeed(
|
|
18
|
+
function layer4(urls, tmp, app = {}) {
|
|
19
|
+
return Layer.succeed(Service4, Service4.of({ urls, app, paths: { tmp } }));
|
|
20
20
|
}
|
|
21
21
|
function connectionURLs2(value, requestedHostname) {
|
|
22
22
|
const url = new URL(value);
|
|
@@ -38,4 +38,4 @@ function connectionURLs2(value, requestedHostname) {
|
|
|
38
38
|
];
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
export {
|
|
41
|
+
export { Service4, layer4, connectionURLs2, exports_server_info };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
awaitPlugins2,
|
|
3
2
|
response2
|
|
4
|
-
} from "./
|
|
3
|
+
} from "./workerd-j80tzjj3.js";
|
|
5
4
|
import {
|
|
6
5
|
Api2
|
|
7
|
-
} from "./
|
|
6
|
+
} from "./workerd-s8t5gq7c.js";
|
|
8
7
|
|
|
9
8
|
// src/handlers/websearch.ts
|
|
10
9
|
import { WebSearch } from "@opencode/core/websearch";
|
|
@@ -16,7 +15,6 @@ var WebSearchHandler2 = HttpApiBuilder.group(Api2, "server.websearch", (handlers
|
|
|
16
15
|
const websearch = yield* WebSearch.Service;
|
|
17
16
|
return yield* response2(websearch.providers());
|
|
18
17
|
})).handle("websearch.query", Effect.fn("server.websearch.query")(function* (request) {
|
|
19
|
-
yield* awaitPlugins2;
|
|
20
18
|
const websearch = yield* WebSearch.Service;
|
|
21
19
|
return yield* response2(websearch.query(request.payload).pipe(Effect.catchTags({
|
|
22
20
|
"WebSearch.ProviderRequired": () => new InvalidRequestError({
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
missingSession2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./workerd-smaf4a18.js";
|
|
4
4
|
|
|
5
5
|
// src/handlers/job.ts
|
|
6
6
|
import { Job } from "@opencode/core/job";
|
|
@@ -21,6 +21,9 @@ var makeJob2 = Effect.gen(function* () {
|
|
|
21
21
|
return {
|
|
22
22
|
data: yield* SessionBackground.list(jobs, lookup, query)
|
|
23
23
|
};
|
|
24
|
+
}),
|
|
25
|
+
cancel: Effect.fn("JobHandler.cancel")(function* (id) {
|
|
26
|
+
yield* jobs.cancel(id);
|
|
24
27
|
})
|
|
25
28
|
};
|
|
26
29
|
});
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./workerd-s8t5gq7c.js";
|
|
4
4
|
import {
|
|
5
5
|
requireConnectable2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./workerd-4r2ye500.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/credential.ts
|
|
9
9
|
import { Credential } from "@opencode/core/credential";
|
|
10
10
|
import { FileSystem } from "@opencode/core/filesystem";
|
|
11
|
+
import { Integration } from "@opencode/core/integration";
|
|
11
12
|
import { Location } from "@opencode/core/location";
|
|
12
13
|
import { LocationServiceMap } from "@opencode/core/location-services";
|
|
13
14
|
import { AbsolutePath } from "@opencode/core/schema";
|
|
@@ -42,8 +43,8 @@ var CredentialHandler2 = HttpApiBuilder.group(Api2, "server.credential", (handle
|
|
|
42
43
|
yield* credential.activate(ctx.params.credentialID);
|
|
43
44
|
return HttpApiSchema.NoContent.make();
|
|
44
45
|
})).handle("credential.remove", Effect.fn(function* (ctx) {
|
|
45
|
-
const
|
|
46
|
-
yield*
|
|
46
|
+
const integrations = yield* Integration.Service.pipe(Effect.provide(services), Effect.orDie);
|
|
47
|
+
yield* integrations.connection.remove(ctx.params.credentialID);
|
|
47
48
|
return HttpApiSchema.NoContent.make();
|
|
48
49
|
}));
|
|
49
50
|
}));
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
|
-
locationErrors2
|
|
3
|
-
|
|
4
|
-
} from "./media-uri-50bbk3b2.js";
|
|
2
|
+
locationErrors2
|
|
3
|
+
} from "./workerd-j80tzjj3.js";
|
|
5
4
|
import {
|
|
6
5
|
Api2
|
|
7
|
-
} from "./
|
|
6
|
+
} from "./workerd-s8t5gq7c.js";
|
|
8
7
|
|
|
9
8
|
// src/handlers/generate.ts
|
|
10
|
-
import { Flag } from "@opencode/core/flag";
|
|
11
9
|
import { Generate } from "@opencode/core/generate";
|
|
12
10
|
import { VideoGeneration } from "@opencode/core/video-generation";
|
|
13
11
|
import { Location } from "@opencode/core/location";
|
|
14
12
|
import { LocationServiceMap } from "@opencode/core/location-services";
|
|
15
13
|
import { AbsolutePath } from "@opencode/core/schema";
|
|
16
14
|
import {
|
|
17
|
-
ForbiddenError,
|
|
18
15
|
VideoNotFoundError,
|
|
19
16
|
InvalidRequestError,
|
|
20
17
|
ModelNotFoundError,
|
|
@@ -31,12 +28,10 @@ var GenerateHandler2 = HttpApiBuilder.group(Api2, "server.generate", (handlers)
|
|
|
31
28
|
const videos = yield* VideoGeneration.Service;
|
|
32
29
|
const services = locations.get(Location.Ref.make({ directory: AbsolutePath.make(global.config) }));
|
|
33
30
|
const text = Effect.fn("server.generate.text")(function* (request) {
|
|
34
|
-
yield* awaitPlugins2;
|
|
35
31
|
const generate = yield* Generate.Service;
|
|
36
32
|
return { data: { text: yield* generate.text(request.payload).pipe(Effect.mapError(generateError)) } };
|
|
37
33
|
}, Effect.provide(services), locationErrors2);
|
|
38
34
|
const image = Effect.fn("server.generate.image")(function* (request) {
|
|
39
|
-
yield* awaitPlugins2;
|
|
40
35
|
const generate = yield* Generate.Service;
|
|
41
36
|
return { data: yield* generate.image(request.payload).pipe(Effect.mapError(generateError)) };
|
|
42
37
|
}, Effect.provide(services), locationErrors2);
|
|
@@ -47,22 +42,15 @@ var GenerateHandler2 = HttpApiBuilder.group(Api2, "server.generate", (handlers)
|
|
|
47
42
|
message: "Decision question names must be unique",
|
|
48
43
|
field: "questions"
|
|
49
44
|
});
|
|
50
|
-
yield* awaitPlugins2;
|
|
51
45
|
const generate = yield* Generate.Service;
|
|
52
46
|
return { data: yield* generate.decisions(request.payload).pipe(Effect.mapError(generateError)) };
|
|
53
47
|
}, Effect.provide(services), locationErrors2);
|
|
54
|
-
const videoEnabled = Effect.gen(function* () {
|
|
55
|
-
if (yield* Flag.enabled("video_generate"))
|
|
56
|
-
return;
|
|
57
|
-
return yield* new ForbiddenError({ message: "Video generation is disabled; enable experimental.video_generate" });
|
|
58
|
-
});
|
|
59
48
|
const videoCreate = Effect.fn("server.generate.video.create")(function* (request) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
49
|
+
return {
|
|
50
|
+
data: yield* videos.start(Generate.videoInput(request.payload)).pipe(Effect.mapError(generateError))
|
|
51
|
+
};
|
|
63
52
|
}, Effect.provide(services), locationErrors2);
|
|
64
53
|
const videoGet = Effect.fn("server.generate.video.get")(function* (request) {
|
|
65
|
-
yield* videoEnabled;
|
|
66
54
|
const job = yield* videos.get(request.params.id).pipe(Effect.mapError((error) => new VideoNotFoundError({ videoID: error.id, message: error.message })));
|
|
67
55
|
return { data: job };
|
|
68
56
|
}, Effect.provide(services), locationErrors2);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
missingSession2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./workerd-smaf4a18.js";
|
|
4
4
|
import {
|
|
5
5
|
locationErrors2,
|
|
6
6
|
response2,
|
|
7
7
|
sessionInfo2
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./workerd-j80tzjj3.js";
|
|
9
9
|
import {
|
|
10
10
|
Api2
|
|
11
|
-
} from "./
|
|
11
|
+
} from "./workerd-s8t5gq7c.js";
|
|
12
12
|
|
|
13
13
|
// src/handlers/permission.ts
|
|
14
14
|
import { Instance } from "@opencode/core/instance/service";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
requestRef2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./workerd-j80tzjj3.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./workerd-s8t5gq7c.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 "./
|
|
3
|
+
} from "./workerd-j80tzjj3.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./workerd-s8t5gq7c.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/command.ts
|
|
9
9
|
import { Command } from "@opencode/core/command";
|
|
@@ -2,18 +2,18 @@ import {
|
|
|
2
2
|
locationErrors2,
|
|
3
3
|
response2,
|
|
4
4
|
requestRef2
|
|
5
|
-
} from "./
|
|
5
|
+
} from "./workerd-j80tzjj3.js";
|
|
6
6
|
import {
|
|
7
7
|
Api2
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./workerd-s8t5gq7c.js";
|
|
9
9
|
import {
|
|
10
10
|
CorsConfig2,
|
|
11
11
|
isAllowedRequestOrigin2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./workerd-q4bn6dy8.js";
|
|
13
13
|
import {
|
|
14
14
|
runPtySocket2,
|
|
15
15
|
holdLocation2
|
|
16
|
-
} from "./
|
|
16
|
+
} from "./workerd-q187pxxd.js";
|
|
17
17
|
|
|
18
18
|
// src/handlers/mcp.ts
|
|
19
19
|
import { Location } from "@opencode/core/location";
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
awaitPlugins2,
|
|
3
2
|
response2
|
|
4
|
-
} from "./
|
|
3
|
+
} from "./workerd-j80tzjj3.js";
|
|
5
4
|
import {
|
|
6
5
|
Api2
|
|
7
|
-
} from "./
|
|
6
|
+
} from "./workerd-s8t5gq7c.js";
|
|
8
7
|
|
|
9
8
|
// src/handlers/model.ts
|
|
10
9
|
import { Model } from "@opencode/core/model";
|
|
@@ -12,11 +11,9 @@ import { Effect } from "effect";
|
|
|
12
11
|
import { HttpApiBuilder } from "effect/http-api";
|
|
13
12
|
var ModelHandler2 = HttpApiBuilder.group(Api2, "server.model", (handlers) => Effect.gen(function* () {
|
|
14
13
|
return handlers.handle("model.list", Effect.fn(function* (ctx) {
|
|
15
|
-
yield* awaitPlugins2;
|
|
16
14
|
const models = yield* Model.Service;
|
|
17
15
|
return yield* response2(models.available(ctx.query.types));
|
|
18
16
|
})).handle("model.default", Effect.fn(function* () {
|
|
19
|
-
yield* awaitPlugins2;
|
|
20
17
|
const models = yield* Model.Service;
|
|
21
18
|
return yield* response2(models.default());
|
|
22
19
|
}));
|
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
missingMessage2,
|
|
4
4
|
failedMessageDecode2,
|
|
5
5
|
failedSnapshot2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./workerd-smaf4a18.js";
|
|
7
7
|
import {
|
|
8
8
|
locationErrors2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./workerd-j80tzjj3.js";
|
|
10
10
|
import {
|
|
11
11
|
Api2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./workerd-s8t5gq7c.js";
|
|
13
13
|
import {
|
|
14
14
|
wantsMediaRefs2
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./workerd-xthc02cw.js";
|
|
16
16
|
|
|
17
17
|
// src/handlers/session.ts
|
|
18
18
|
import { Instance } from "@opencode/core/instance/service";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__export
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./workerd-9rqn6x4v.js";
|
|
4
4
|
|
|
5
5
|
// src/event-feed.ts
|
|
6
6
|
var exports_event_feed = {};
|
|
7
7
|
__export(exports_event_feed, {
|
|
8
8
|
EncodingError: () => EncodingError2,
|
|
9
9
|
EventFeed: () => exports_event_feed,
|
|
10
|
-
Service: () =>
|
|
10
|
+
Service: () => Service2,
|
|
11
11
|
SubscriberCapacity: () => SubscriberCapacity2,
|
|
12
12
|
SubscriberOverflowError: () => SubscriberOverflowError2,
|
|
13
13
|
frame: () => frame2,
|
|
14
|
-
layer: () =>
|
|
14
|
+
layer: () => layer2,
|
|
15
15
|
make: () => make4
|
|
16
16
|
});
|
|
17
17
|
import { Bus } from "@opencode/core/bus";
|
|
@@ -30,7 +30,7 @@ class EncodingError2 extends Schema.TaggedError()("EventFeed.EncodingError", {
|
|
|
30
30
|
}) {
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
class
|
|
33
|
+
class Service2 extends Context.Service()("@opencode/server/EventFeed") {
|
|
34
34
|
}
|
|
35
35
|
function frame2(event) {
|
|
36
36
|
return `data: ${JSON.stringify(event)}
|
|
@@ -72,13 +72,13 @@ var make4 = Effect.fn("EventFeed.make")(function* (observe, options) {
|
|
|
72
72
|
});
|
|
73
73
|
const unsubscribe = yield* observe(publish);
|
|
74
74
|
yield* Effect.addFinalizer(() => unsubscribe);
|
|
75
|
-
return
|
|
75
|
+
return Service2.of({
|
|
76
76
|
subscribe: (types) => Effect.acquireRelease(Queue.dropping(capacity).pipe(Effect.tap((queue) => Effect.sync(() => subscribers.set(queue, types?.length ? new Set(types) : undefined)))), (queue) => Effect.sync(() => subscribers.delete(queue)).pipe(Effect.andThen(Queue.shutdown(queue)), Effect.asVoid)).pipe(Effect.map(Stream.fromQueue))
|
|
77
77
|
});
|
|
78
78
|
});
|
|
79
|
-
var
|
|
79
|
+
var layer2 = Layer.effect(Service2, Effect.gen(function* () {
|
|
80
80
|
const bus = yield* Bus.Service;
|
|
81
81
|
return yield* make4(bus.listen);
|
|
82
82
|
}));
|
|
83
83
|
|
|
84
|
-
export { SubscriberCapacity2, SubscriberOverflowError2, EncodingError2,
|
|
84
|
+
export { SubscriberCapacity2, SubscriberOverflowError2, EncodingError2, Service2, frame2, make4, layer2, exports_event_feed };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
download2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./workerd-t32e1bbt.js";
|
|
4
4
|
import {
|
|
5
5
|
parse2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./workerd-8sb6qqpn.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/blob.ts
|
|
9
9
|
import { BlobStore } from "@opencode/core/blob-store";
|
|
@@ -19,7 +19,7 @@ var makeBlobGet2 = Effect.gen(function* () {
|
|
|
19
19
|
const etag = `"${id}"`;
|
|
20
20
|
const headers = {
|
|
21
21
|
...download2({ mime: blob.mime }),
|
|
22
|
-
"cache-control": "private, max-age=
|
|
22
|
+
"cache-control": "private, max-age=31536000, immutable",
|
|
23
23
|
etag,
|
|
24
24
|
"accept-ranges": "bytes"
|
|
25
25
|
};
|