@opencode/server 2.2.4 → 2.2.6
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.js +5 -5
- package/dist/auth.js +1 -1
- package/dist/chunks/{event-feed-0fv515j7.js → options-02a60aws.js} +2 -2
- package/dist/chunks/{event-feed-059rbh9c.js → options-059rbh9c.js} +1 -1
- package/dist/chunks/{event-feed-vbgqk0mr.js → options-0r9ve3h3.js} +2 -2
- package/dist/chunks/{event-feed-5dbnrgeg.js → options-32zxn73z.js} +4 -4
- package/dist/chunks/{event-feed-04phqjtk.js → options-3k93sd3m.js} +17 -16
- package/dist/chunks/{event-feed-z3e7v67k.js → options-3te71694.js} +7 -7
- package/dist/chunks/{event-feed-f8r9p2vr.js → options-4xzps9pr.js} +2 -2
- package/dist/chunks/{event-feed-8wqj6mpn.js → options-5km4ra1j.js} +8 -6
- package/dist/chunks/{event-feed-9grnt8dc.js → options-62bfwtjc.js} +2 -2
- package/dist/chunks/options-78rcgzsr.js +28 -0
- package/dist/chunks/{event-feed-7b9xm1qg.js → options-7b9xm1qg.js} +1 -1
- package/dist/chunks/{event-feed-axe8xgk8.js → options-7jx462hf.js} +11 -7
- package/dist/chunks/{event-feed-mzqcpmk1.js → options-82vbxjqd.js} +7 -5
- package/dist/chunks/{event-feed-nz17qv97.js → options-85kbrn7y.js} +2 -2
- package/dist/chunks/{event-feed-g2961dtz.js → options-9f2aybte.js} +8 -8
- package/dist/chunks/{event-feed-q44yktpv.js → options-9q55v56g.js} +2 -2
- package/dist/chunks/{event-feed-dx89xydc.js → options-axx4wwen.js} +2 -2
- package/dist/chunks/{event-feed-m119esdv.js → options-b5crh3ce.js} +3 -3
- package/dist/chunks/{event-feed-0j6zxxn8.js → options-dczgzh3x.js} +2 -2
- package/dist/chunks/{event-feed-htyf2qs7.js → options-ddnay6e1.js} +1 -1
- package/dist/chunks/{event-feed-n321d8vm.js → options-djr0jy89.js} +8 -6
- package/dist/chunks/{event-feed-0ey2b45p.js → options-dx07zb36.js} +9 -6
- package/dist/chunks/{event-feed-hx8bsq9d.js → options-e0z6mnzj.js} +1 -1
- package/dist/chunks/{event-feed-39nnfjx1.js → options-e6e4kz0w.js} +4 -4
- package/dist/chunks/{event-feed-zbe9jfhy.js → options-f0kpaq89.js} +1 -1
- package/dist/chunks/{event-feed-s9tkswmw.js → options-f96zeczf.js} +2 -2
- package/dist/chunks/{event-feed-50bbk3b2.js → options-gymtz25n.js} +3 -3
- package/dist/chunks/options-hmwn16zp.js +39 -0
- package/dist/chunks/{event-feed-0n4tjm17.js → options-hr24310e.js} +1 -1
- package/dist/chunks/{event-feed-2wexxjwf.js → options-j1bh82b8.js} +2 -2
- package/dist/chunks/{event-feed-j4at0y5c.js → options-j4at0y5c.js} +1 -1
- package/dist/chunks/{event-feed-h1thjy6x.js → options-j6d0mxrp.js} +2 -2
- package/dist/chunks/{event-feed-n1zdbfv7.js → options-j77vxdbh.js} +9 -4
- package/dist/chunks/{event-feed-m9ezm2eq.js → options-kgr24bct.js} +14 -8
- package/dist/chunks/{event-feed-mzs0n5xz.js → options-kqr36gas.js} +7 -7
- package/dist/chunks/{event-feed-05c5061t.js → options-mam5ppd3.js} +1 -1
- package/dist/chunks/{event-feed-h6rt5k9s.js → options-q187pxxd.js} +7 -1
- package/dist/chunks/{event-feed-ndcq61v8.js → options-q59gseq4.js} +35 -35
- package/dist/chunks/{event-feed-kg0ybx4v.js → options-q7gnt7ra.js} +3 -3
- package/dist/chunks/{event-feed-r6xkfcdx.js → options-rbck9dgd.js} +2 -2
- package/dist/chunks/{event-feed-zvbhqxt5.js → options-s9jd931e.js} +4 -4
- package/dist/chunks/options-t32e1bbt.js +32 -0
- package/dist/chunks/{event-feed-0e81et3m.js → options-v7p1kzzd.js} +3 -3
- package/dist/chunks/{event-feed-89egwzf3.js → options-va7wgp70.js} +2 -2
- package/dist/chunks/{event-feed-v8aqacn3.js → options-vyzvby0b.js} +2 -2
- package/dist/chunks/{event-feed-qfyg9gb7.js → options-wecgp61r.js} +7 -7
- package/dist/chunks/{event-feed-b3bmdkga.js → options-x74w7e1f.js} +1 -1
- package/dist/chunks/{event-feed-s62wjkvx.js → options-xad49dn3.js} +2 -2
- package/dist/chunks/{event-feed-et00mhwf.js → options-xfynz25m.js} +2 -2
- package/dist/chunks/{event-feed-x4b2rtcb.js → options-xwy6frfd.js} +1 -1
- package/dist/chunks/{event-feed-4p2y0qs3.js → options-y56ann6c.js} +2 -2
- package/dist/chunks/{event-feed-b4mqtccx.js → options-zzxz7279.js} +2 -2
- package/dist/content-headers.d.ts +13 -0
- package/dist/content-headers.js +12 -0
- package/dist/cors.js +1 -1
- package/dist/event-feed.js +5 -5
- package/dist/fetch.d.ts +1 -0
- package/dist/fetch.js +58 -54
- package/dist/handlers/agent.js +6 -6
- package/dist/handlers/artifact.js +3 -3
- package/dist/handlers/command.js +6 -6
- package/dist/handlers/config.js +6 -6
- 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 +7 -6
- package/dist/handlers/generate.js +6 -6
- package/dist/handlers/integration.js +6 -6
- package/dist/handlers/job.d.ts +51 -0
- package/dist/handlers/job.js +7 -0
- package/dist/handlers/location.js +6 -6
- package/dist/handlers/mcp.js +8 -8
- package/dist/handlers/media.js +2 -1
- 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 +13 -11
- 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.d.ts +2 -0
- package/dist/handlers/pty-socket.js +4 -2
- package/dist/handlers/pty.js +8 -8
- package/dist/handlers/reference.js +6 -6
- package/dist/handlers/rpc.js +6 -6
- package/dist/handlers/schedule.js +2 -2
- 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 +50 -48
- package/dist/location.js +4 -4
- package/dist/media-uri.js +1 -1
- package/dist/middleware/authorization.js +2 -2
- 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/options.d.ts +7 -0
- package/dist/options.js +1 -0
- package/dist/pairing.js +3 -3
- package/dist/process.d.ts +1 -0
- package/dist/process.js +63 -58
- package/dist/request-site.d.ts +11 -0
- package/dist/request-site.js +11 -0
- package/dist/request-tracing.d.ts +2 -2
- package/dist/request-tracing.js +1 -1
- package/dist/routes.js +53 -51
- package/dist/server-info.js +5 -5
- package/dist/service-status.js +3 -3
- package/dist/workerd.d.ts +2 -0
- package/dist/workerd.js +61 -56
- package/package.json +11 -11
- /package/dist/chunks/{event-feed-9rqn6x4v.js → options-9rqn6x4v.js} +0 -0
- /package/dist/chunks/{event-feed-bd8755ek.js → options-bd8755ek.js} +0 -0
- /package/dist/chunks/{event-feed-q4bn6dy8.js → options-q4bn6dy8.js} +0 -0
- /package/dist/chunks/{event-feed-smaf4a18.js → options-smaf4a18.js} +0 -0
- /package/dist/chunks/{event-feed-xthc02cw.js → options-xthc02cw.js} +0 -0
- /package/dist/chunks/{event-feed-yc7nft6q.js → options-yc7nft6q.js} +0 -0
package/dist/api.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./chunks/
|
|
4
|
-
import"./chunks/
|
|
5
|
-
import"./chunks/
|
|
6
|
-
import"./chunks/
|
|
7
|
-
import"./chunks/
|
|
3
|
+
} from "./chunks/options-v7p1kzzd.js";
|
|
4
|
+
import"./chunks/options-ddnay6e1.js";
|
|
5
|
+
import"./chunks/options-x74w7e1f.js";
|
|
6
|
+
import"./chunks/options-gymtz25n.js";
|
|
7
|
+
import"./chunks/options-smaf4a18.js";
|
|
8
8
|
export {
|
|
9
9
|
Api2 as Api
|
|
10
10
|
};
|
package/dist/auth.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
missingSession2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./options-smaf4a18.js";
|
|
4
4
|
import {
|
|
5
5
|
locationErrors2,
|
|
6
6
|
awaitPlugins2,
|
|
7
7
|
response2,
|
|
8
8
|
requestRef2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./options-gymtz25n.js";
|
|
10
10
|
|
|
11
11
|
// src/handlers/artifact.ts
|
|
12
12
|
import { Artifact } from "@opencode/core/artifact";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./options-gymtz25n.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./options-v7p1kzzd.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/plugin.ts
|
|
9
9
|
import { Plugin } from "@opencode/core/plugin";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./options-v7p1kzzd.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
5
|
+
Service4,
|
|
6
6
|
frame2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./options-wecgp61r.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* Service4;
|
|
16
16
|
return handlers.handleRaw("event.subscribe", (ctx) => Effect.gen(function* () {
|
|
17
17
|
const connected = {
|
|
18
18
|
id: Event.ID.create(),
|
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./
|
|
2
|
+
layer2
|
|
3
|
+
} from "./options-gymtz25n.js";
|
|
4
4
|
import {
|
|
5
5
|
formLocationLayer2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./options-ddnay6e1.js";
|
|
7
7
|
import {
|
|
8
8
|
sessionLocationLayer2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./options-x74w7e1f.js";
|
|
10
10
|
import {
|
|
11
11
|
Api2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./options-v7p1kzzd.js";
|
|
13
13
|
import {
|
|
14
14
|
Config2
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./options-j4at0y5c.js";
|
|
16
16
|
import {
|
|
17
17
|
CorsConfig2
|
|
18
|
-
} from "./
|
|
18
|
+
} from "./options-q4bn6dy8.js";
|
|
19
19
|
import {
|
|
20
|
-
|
|
21
|
-
} from "./
|
|
20
|
+
layer3
|
|
21
|
+
} from "./options-3te71694.js";
|
|
22
22
|
import {
|
|
23
23
|
node2
|
|
24
|
-
} from "./
|
|
24
|
+
} from "./options-kqr36gas.js";
|
|
25
25
|
import {
|
|
26
26
|
handlers2
|
|
27
|
-
} from "./
|
|
27
|
+
} from "./options-q59gseq4.js";
|
|
28
28
|
import {
|
|
29
29
|
authorizationLayer2
|
|
30
|
-
} from "./
|
|
30
|
+
} from "./options-7b9xm1qg.js";
|
|
31
31
|
import {
|
|
32
32
|
schemaErrorLayer2
|
|
33
|
-
} from "./
|
|
33
|
+
} from "./options-bd8755ek.js";
|
|
34
34
|
|
|
35
35
|
// src/routes.ts
|
|
36
36
|
import { Database } from "@opencode/core/database/database";
|
|
37
37
|
import { V1Migration } from "@opencode/core/database/v1-migration";
|
|
38
38
|
import { App } from "@opencode/core/app";
|
|
39
39
|
import { LayerNode } from "@opencode/util/effect/layer-node";
|
|
40
|
-
import { httpClient } from "@opencode/util/effect/app-node-platform";
|
|
40
|
+
import { fetchLayer, httpClient, httpFetch } from "@opencode/util/effect/app-node-platform";
|
|
41
41
|
import { AppNodeBuilder } from "@opencode/core/effect/app-node-builder";
|
|
42
42
|
import { Bus } from "@opencode/core/bus";
|
|
43
43
|
import { EventLogger } from "@opencode/core/event-logger";
|
|
@@ -119,6 +119,7 @@ function makeRoutes(auth, options, serviceURLs, overrides, instances) {
|
|
|
119
119
|
Bus.node.replace(Bus.configured({ persist: options.events?.persist })),
|
|
120
120
|
App.node.replace(App.configured(options.app)),
|
|
121
121
|
ModelsDev.node.replace(ModelsDev.configured(options.models)),
|
|
122
|
+
httpFetch.replace(fetchLayer(options.fetch)),
|
|
122
123
|
Watcher.node.replace(Watcher.configured({ enabled: options.fs?.filewatcher })),
|
|
123
124
|
FileWatch.node.replace(FileWatch.configured({ enabled: options.fs?.filewatcher })),
|
|
124
125
|
FileSystemSearch.node.replace(FileSystemSearch.configured({ fff: options.fs?.fff })),
|
|
@@ -153,8 +154,8 @@ function makeRoutes(auth, options, serviceURLs, overrides, instances) {
|
|
|
153
154
|
})) : build(overrides);
|
|
154
155
|
return serviceLayer.pipe(Layer.flatMap((context) => {
|
|
155
156
|
const services = Layer.succeedContext(context);
|
|
156
|
-
const requestServices = Layer.merge(Layer.succeedContext(Context.pick(Database.Service, Credential.Service, PermissionSaved.Service, PluginUpdate.Service, Project.Service, WellKnown.Service)(context)),
|
|
157
|
-
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(
|
|
157
|
+
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));
|
|
158
|
+
const api = HttpApiBuilder.layer(Api2, { openapiPath: "/openapi.json" }).pipe(Layer.provide(handlers2.pipe(Layer.provide(services), Layer.provide(Layer.succeed(CorsConfig2, options)))), Layer.provide(formLocationLayer2), Layer.provide(sessionLocationLayer2), Layer.provide(layer2), Layer.provide(authorizationLayer2), Layer.provide(schemaErrorLayer2), Layer.provide(auth), HttpRouter.provideRequest(requestServices), Layer.provideMerge(services), Layer.provideMerge(HttpRouter.layer));
|
|
158
159
|
return Layer.merge(api, V1Migration.layer.pipe(Layer.provide(services)));
|
|
159
160
|
}));
|
|
160
161
|
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__export
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./options-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: () => Service3,
|
|
10
10
|
connectionURLs: () => connectionURLs2,
|
|
11
|
-
layer: () =>
|
|
11
|
+
layer: () => layer3
|
|
12
12
|
});
|
|
13
13
|
import { Context, Layer } from "effect";
|
|
14
14
|
import { networkInterfaces } from "node:os";
|
|
15
15
|
|
|
16
|
-
class
|
|
16
|
+
class Service3 extends Context.Service()("@opencode/server/ServerInfo") {
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
return Layer.succeed(
|
|
18
|
+
function layer3(urls, tmp, app = {}) {
|
|
19
|
+
return Layer.succeed(Service3, Service3.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 { Service3, layer3, connectionURLs2, exports_server_info };
|
|
@@ -2,17 +2,18 @@ import {
|
|
|
2
2
|
locationErrors2,
|
|
3
3
|
response2,
|
|
4
4
|
requestRef2
|
|
5
|
-
} from "./
|
|
5
|
+
} from "./options-gymtz25n.js";
|
|
6
6
|
import {
|
|
7
7
|
Api2
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./options-v7p1kzzd.js";
|
|
9
9
|
import {
|
|
10
10
|
CorsConfig2,
|
|
11
11
|
isAllowedRequestOrigin2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./options-q4bn6dy8.js";
|
|
13
13
|
import {
|
|
14
|
-
runPtySocket2
|
|
15
|
-
|
|
14
|
+
runPtySocket2,
|
|
15
|
+
holdLocation2
|
|
16
|
+
} from "./options-q187pxxd.js";
|
|
16
17
|
|
|
17
18
|
// src/handlers/pty.ts
|
|
18
19
|
import { Pty } from "@opencode/core/pty";
|
|
@@ -90,6 +91,7 @@ var PtyHandler2 = HttpApiBuilder.group(Api2, "server.pty", (handlers) => Effect.
|
|
|
90
91
|
const cursor = cursorNumber !== undefined && Number.isSafeInteger(cursorNumber) && cursorNumber >= -1 ? cursorNumber : undefined;
|
|
91
92
|
const socket = yield* Effect.orDie(ctx.request.upgrade);
|
|
92
93
|
const outbox = yield* Queue.unbounded();
|
|
94
|
+
yield* holdLocation2(outbox);
|
|
93
95
|
const attachment = yield* pty.attach(ctx.params.ptyID, {
|
|
94
96
|
cursor,
|
|
95
97
|
onData: (chunk) => Queue.offerUnsafe(outbox, chunk),
|
|
@@ -121,7 +123,7 @@ var PtyHandler2 = HttpApiBuilder.group(Api2, "server.pty", (handlers) => Effect.
|
|
|
121
123
|
detach: () => attachment?.detach()
|
|
122
124
|
});
|
|
123
125
|
return HttpServerResponse.empty();
|
|
124
|
-
}).pipe(Effect.provide(locations.get(ref)), locationErrors2);
|
|
126
|
+
}).pipe(Effect.scoped, Effect.provide(locations.get(ref)), locationErrors2);
|
|
125
127
|
}));
|
|
126
128
|
}));
|
|
127
129
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
awaitPlugins2,
|
|
3
3
|
response2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./options-gymtz25n.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./options-v7p1kzzd.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/provider.ts
|
|
10
10
|
import { Provider } from "@opencode/core/provider";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
missingSession2
|
|
3
|
+
} from "./options-smaf4a18.js";
|
|
4
|
+
|
|
5
|
+
// src/handlers/job.ts
|
|
6
|
+
import { Job } from "@opencode/core/job";
|
|
7
|
+
import { Session } from "@opencode/core/session";
|
|
8
|
+
import { SessionBackground } from "@opencode/core/session/background";
|
|
9
|
+
import { Effect, Option } from "effect";
|
|
10
|
+
var makeJob2 = Effect.gen(function* () {
|
|
11
|
+
const jobs = yield* Job.Service;
|
|
12
|
+
const sessions = yield* Session.Service;
|
|
13
|
+
const lookup = {
|
|
14
|
+
get: (sessionID) => sessions.get(sessionID).pipe(Effect.option, Effect.map(Option.getOrUndefined))
|
|
15
|
+
};
|
|
16
|
+
return {
|
|
17
|
+
list: Effect.fn("JobHandler.list")(function* (query) {
|
|
18
|
+
if (query.sessionID !== undefined) {
|
|
19
|
+
yield* sessions.get(query.sessionID).pipe(Effect.catchTag("Session.NotFoundError", missingSession2));
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
data: yield* SessionBackground.list(jobs, lookup, query)
|
|
23
|
+
};
|
|
24
|
+
})
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export { makeJob2 };
|
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./options-v7p1kzzd.js";
|
|
4
4
|
import {
|
|
5
5
|
CorsConfig2,
|
|
6
6
|
isAllowedRequestOrigin2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./options-q4bn6dy8.js";
|
|
8
8
|
import {
|
|
9
9
|
makeArtifact2
|
|
10
|
-
} from "./
|
|
10
|
+
} from "./options-02a60aws.js";
|
|
11
|
+
import {
|
|
12
|
+
makeJob2
|
|
13
|
+
} from "./options-78rcgzsr.js";
|
|
11
14
|
import {
|
|
12
15
|
makeMediaGet2
|
|
13
|
-
} from "./
|
|
16
|
+
} from "./options-djr0jy89.js";
|
|
14
17
|
import {
|
|
15
18
|
runPtySocket2
|
|
16
|
-
} from "./
|
|
19
|
+
} from "./options-q187pxxd.js";
|
|
17
20
|
import {
|
|
18
21
|
makeSchedule2
|
|
19
|
-
} from "./
|
|
22
|
+
} from "./options-059rbh9c.js";
|
|
20
23
|
|
|
21
24
|
// src/handlers/persistent-pty.ts
|
|
22
25
|
import { PersistentPty } from "@opencode/core/persistent-pty";
|
|
@@ -42,9 +45,10 @@ var PersistentPtyHandler2 = HttpApiBuilder.group(Api2, "server.experimental", (h
|
|
|
42
45
|
const cors = yield* CorsConfig2;
|
|
43
46
|
const pty = yield* PersistentPty.Service;
|
|
44
47
|
const artifact = yield* makeArtifact2;
|
|
48
|
+
const job = yield* makeJob2;
|
|
45
49
|
const mediaGet = yield* makeMediaGet2;
|
|
46
50
|
const schedule = yield* makeSchedule2;
|
|
47
|
-
return handlers.handleRaw("media.get", (ctx) => mediaGet(ctx.params.hash, ctx.request)).handle("artifacts.providers", (ctx) => artifact.providers(ctx.query, ctx.request)).handle("artifacts.list", (ctx) => artifact.list(ctx.query, ctx.request)).handle("artifacts.create", (ctx) => artifact.create(ctx.query, ctx.payload, ctx.request)).handle("artifacts.get", (ctx) => artifact.get(ctx.params.artifactID, ctx.query, ctx.request)).handle("artifacts.update", (ctx) => artifact.update(ctx.params.artifactID, ctx.query, ctx.payload, ctx.request)).handle("artifacts.delete", (ctx) => artifact.remove(ctx.params.artifactID, ctx.query, ctx.request)).handleRaw("artifacts.view", (ctx) => artifact.view(ctx.params.artifactID, ctx.query, ctx.request)).handle("schedule.create", (ctx) => schedule.create(ctx.payload)).handle("schedule.list", (ctx) => schedule.list(ctx.query.sessionID)).handle("schedule.get", (ctx) => schedule.get(ctx.params.scheduleID)).handle("schedule.pause", (ctx) => schedule.pause(ctx.params.scheduleID)).handle("schedule.resume", (ctx) => schedule.resume(ctx.params.scheduleID)).handle("schedule.delete", (ctx) => schedule.remove(ctx.params.scheduleID)).handle("persistentPty.read", Effect.fn(function* (ctx) {
|
|
51
|
+
return handlers.handleRaw("media.get", (ctx) => mediaGet(ctx.params.hash, ctx.request)).handle("job.list", (ctx) => job.list(ctx.query)).handle("artifacts.providers", (ctx) => artifact.providers(ctx.query, ctx.request)).handle("artifacts.list", (ctx) => artifact.list(ctx.query, ctx.request)).handle("artifacts.create", (ctx) => artifact.create(ctx.query, ctx.payload, ctx.request)).handle("artifacts.get", (ctx) => artifact.get(ctx.params.artifactID, ctx.query, ctx.request)).handle("artifacts.update", (ctx) => artifact.update(ctx.params.artifactID, ctx.query, ctx.payload, ctx.request)).handle("artifacts.delete", (ctx) => artifact.remove(ctx.params.artifactID, ctx.query, ctx.request)).handleRaw("artifacts.view", (ctx) => artifact.view(ctx.params.artifactID, ctx.query, ctx.request)).handle("schedule.create", (ctx) => schedule.create(ctx.payload)).handle("schedule.list", (ctx) => schedule.list(ctx.query.sessionID)).handle("schedule.get", (ctx) => schedule.get(ctx.params.scheduleID)).handle("schedule.pause", (ctx) => schedule.pause(ctx.params.scheduleID)).handle("schedule.resume", (ctx) => schedule.resume(ctx.params.scheduleID)).handle("schedule.delete", (ctx) => schedule.remove(ctx.params.scheduleID)).handle("persistentPty.read", Effect.fn(function* (ctx) {
|
|
48
52
|
return { data: yield* pty.read(ctx.params.sessionID, ctx.query.lines).pipe(mapUnavailable) };
|
|
49
53
|
})).handle("persistentPty.list", Effect.fn(function* (ctx) {
|
|
50
54
|
return { data: yield* pty.list(ctx.params.sessionID).pipe(mapUnavailable) };
|
|
@@ -2,17 +2,18 @@ import {
|
|
|
2
2
|
locationErrors2,
|
|
3
3
|
response2,
|
|
4
4
|
requestRef2
|
|
5
|
-
} from "./
|
|
5
|
+
} from "./options-gymtz25n.js";
|
|
6
6
|
import {
|
|
7
7
|
Api2
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./options-v7p1kzzd.js";
|
|
9
9
|
import {
|
|
10
10
|
CorsConfig2,
|
|
11
11
|
isAllowedRequestOrigin2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./options-q4bn6dy8.js";
|
|
13
13
|
import {
|
|
14
|
-
runPtySocket2
|
|
15
|
-
|
|
14
|
+
runPtySocket2,
|
|
15
|
+
holdLocation2
|
|
16
|
+
} from "./options-q187pxxd.js";
|
|
16
17
|
|
|
17
18
|
// src/handlers/mcp.ts
|
|
18
19
|
import { Location } from "@opencode/core/location";
|
|
@@ -78,6 +79,7 @@ var McpHandler2 = HttpApiBuilder.group(Api2, "server.mcp", (handlers) => Effect.
|
|
|
78
79
|
const { McpSocketClient } = yield* Effect.promise(() => import("@opencode/core/mcp/socket-client"));
|
|
79
80
|
const socket = yield* Effect.orDie(ctx.request.upgrade);
|
|
80
81
|
const outbox = yield* Queue.unbounded();
|
|
82
|
+
yield* holdLocation2(outbox);
|
|
81
83
|
const state = { attached: false, disconnected: false };
|
|
82
84
|
const transport = McpSocketClient.make({
|
|
83
85
|
send: (text) => Queue.offerUnsafe(outbox, text),
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./options-v7p1kzzd.js";
|
|
4
4
|
import {
|
|
5
5
|
SESSION_TTL_SECONDS2,
|
|
6
6
|
Config2,
|
|
7
7
|
issueSession2,
|
|
8
8
|
sessionCookieName2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./options-j4at0y5c.js";
|
|
10
10
|
import {
|
|
11
|
-
|
|
12
|
-
} from "./
|
|
11
|
+
Service3
|
|
12
|
+
} from "./options-3te71694.js";
|
|
13
13
|
import {
|
|
14
|
-
|
|
15
|
-
} from "./
|
|
14
|
+
Service2
|
|
15
|
+
} from "./options-kqr36gas.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* Service2;
|
|
26
26
|
const auth = yield* Config2;
|
|
27
27
|
return handlers.handle("server.info", () => Effect.gen(function* () {
|
|
28
|
-
const info = yield*
|
|
28
|
+
const info = yield* Service3;
|
|
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
|
awaitPlugins2,
|
|
3
3
|
response2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./options-gymtz25n.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./options-v7p1kzzd.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/websearch.ts
|
|
10
10
|
import { WebSearch } from "@opencode/core/websearch";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
missingSession2,
|
|
3
3
|
failedMessageDecode2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./options-smaf4a18.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./options-v7p1kzzd.js";
|
|
8
8
|
import {
|
|
9
9
|
wantsMediaRefs2
|
|
10
|
-
} from "./
|
|
10
|
+
} from "./options-xthc02cw.js";
|
|
11
11
|
|
|
12
12
|
// src/handlers/message.ts
|
|
13
13
|
import { SessionMessage } from "@opencode/core/session/message";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
locationErrors2,
|
|
3
3
|
awaitPlugins2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./options-gymtz25n.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./options-v7p1kzzd.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/generate.ts
|
|
10
10
|
import { Generate } from "@opencode/core/generate";
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CONTENT_SECURITY_POLICY2,
|
|
3
|
+
disposition2
|
|
4
|
+
} from "./options-t32e1bbt.js";
|
|
5
|
+
|
|
1
6
|
// src/handlers/media.ts
|
|
2
7
|
import { Database } from "@opencode/core/database/database";
|
|
3
8
|
import { SessionBlob } from "@opencode/core/session/blob";
|
|
@@ -6,10 +11,6 @@ import { Effect } from "effect";
|
|
|
6
11
|
import { HttpServerResponse } from "effect/http";
|
|
7
12
|
var INLINE_IMAGE_MIMES = new Set(["image/png", "image/jpeg", "image/gif", "image/webp"]);
|
|
8
13
|
var CACHE_CONTROL = "private, max-age=31536000, immutable";
|
|
9
|
-
var SECURITY_HEADERS = {
|
|
10
|
-
"x-content-type-options": "nosniff",
|
|
11
|
-
"content-security-policy": "default-src 'none'; sandbox"
|
|
12
|
-
};
|
|
13
14
|
var makeMediaGet2 = Effect.gen(function* () {
|
|
14
15
|
const { db } = yield* Database.Service;
|
|
15
16
|
return (hash, request) => Effect.gen(function* () {
|
|
@@ -22,8 +23,9 @@ var makeMediaGet2 = Effect.gen(function* () {
|
|
|
22
23
|
const headers = {
|
|
23
24
|
"cache-control": CACHE_CONTROL,
|
|
24
25
|
etag,
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
"content-disposition": disposition2(""),
|
|
27
|
+
"content-security-policy": CONTENT_SECURITY_POLICY2,
|
|
28
|
+
"x-content-type-options": "nosniff"
|
|
27
29
|
};
|
|
28
30
|
if (matchesIfNoneMatch(request.headers["if-none-match"], etag))
|
|
29
31
|
return HttpServerResponse.empty({ status: 304, headers });
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./options-gymtz25n.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./options-v7p1kzzd.js";
|
|
7
|
+
import {
|
|
8
|
+
download2
|
|
9
|
+
} from "./options-t32e1bbt.js";
|
|
7
10
|
|
|
8
11
|
// src/handlers/fs.ts
|
|
9
12
|
import { FileSystem } from "@opencode/core/filesystem";
|
|
@@ -21,7 +24,7 @@ var FileSystemHandler2 = HttpApiBuilder.group(Api2, "server.fs", (handlers) => E
|
|
|
21
24
|
const path2 = yield* decodeRequestPath(ctx.request.url);
|
|
22
25
|
const fs = yield* FileSystem.Service;
|
|
23
26
|
const file = yield* fs.read({ path: path2 }).pipe(Effect.mapError((error) => new FileNotFoundError({ path: error.path, message: `File not found: ${error.path}` })));
|
|
24
|
-
return serveFile(ctx.request, file);
|
|
27
|
+
return serveFile(ctx.request, file, download2({ path: path2, mime: file.mime }));
|
|
25
28
|
})).handle("fs.list", (ctx) => response2(Effect.gen(function* () {
|
|
26
29
|
const fs = yield* FileSystem.Service;
|
|
27
30
|
return yield* fs.list(ctx.query).pipe(Effect.mapError((error) => new FileNotFoundError({ path: error.path, message: `Directory not found: ${error.path}` })));
|
|
@@ -54,7 +57,7 @@ function decodeRequestPath(url) {
|
|
|
54
57
|
catch: () => new FileNotFoundError({ path: raw, message: `File not found: ${raw}` })
|
|
55
58
|
});
|
|
56
59
|
}
|
|
57
|
-
function serveFile(request, file) {
|
|
60
|
+
function serveFile(request, file, content) {
|
|
58
61
|
const etag = `W/"${file.size.toString(16)}-${Option.match(file.mtime, {
|
|
59
62
|
onNone: () => "0",
|
|
60
63
|
onSome: (mtime) => mtime.getTime().toString(16)
|
|
@@ -66,7 +69,7 @@ function serveFile(request, file) {
|
|
|
66
69
|
...lastModified === undefined ? {} : { "last-modified": lastModified }
|
|
67
70
|
};
|
|
68
71
|
if (isNotModified(request, etag, lastModified))
|
|
69
|
-
return HttpServerResponse.empty({ status: 304, headers: validators });
|
|
72
|
+
return HttpServerResponse.empty({ status: 304, headers: { ...validators, ...content } });
|
|
70
73
|
const rangeHeader = request.method === "GET" ? request.headers["range"] : undefined;
|
|
71
74
|
const range = rangeHeader !== undefined && matchesIfRange(request.headers["if-range"], etag, lastModified) ? parseRange(rangeHeader, file.size) : undefined;
|
|
72
75
|
if (range === "unsatisfiable")
|
|
@@ -81,8 +84,8 @@ function serveFile(request, file) {
|
|
|
81
84
|
contentLength: length,
|
|
82
85
|
headers: {
|
|
83
86
|
...validators,
|
|
87
|
+
...content,
|
|
84
88
|
"accept-ranges": "bytes",
|
|
85
|
-
"content-type": file.mime,
|
|
86
89
|
...range === undefined ? {} : { "content-range": `bytes ${range.start}-${range.end}/${file.size}` }
|
|
87
90
|
}
|
|
88
91
|
});
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__export
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./options-9rqn6x4v.js";
|
|
4
4
|
|
|
5
5
|
// src/service-status.ts
|
|
6
6
|
var exports_service_status = {};
|
|
7
7
|
__export(exports_service_status, {
|
|
8
8
|
Status: () => exports_service_status,
|
|
9
|
-
make: () =>
|
|
9
|
+
make: () => make3
|
|
10
10
|
});
|
|
11
11
|
import { Effect, Ref } from "effect";
|
|
12
|
-
var
|
|
12
|
+
var make3 = Effect.fnUntraced(function* (options = {}) {
|
|
13
13
|
const current = yield* Ref.make(options.initial ?? { type: "starting" });
|
|
14
14
|
const beginStopping = Ref.update(current, (status) => status.type === "stopping" ? status : { type: "stopping" });
|
|
15
15
|
return {
|
|
@@ -20,4 +20,4 @@ var make2 = Effect.fnUntraced(function* (options = {}) {
|
|
|
20
20
|
};
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
export {
|
|
23
|
+
export { make3, exports_service_status };
|