@opencode/server 0.0.0-dev-21920 → 0.0.0-dev-44
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 +3 -1
- package/dist/api.js +5 -5
- package/dist/auth.d.ts +5 -1
- package/dist/auth.js +3 -1
- package/dist/chunks/{media-uri-b2acc4mg.js → options-0a5jm2na.js} +4 -4
- package/dist/chunks/{media-uri-0c5s68vs.js → options-17ecnfcg.js} +2 -2
- package/dist/chunks/{media-uri-6z9pvq7p.js → options-1je14sn4.js} +1 -1
- package/dist/chunks/{media-uri-qd0r787n.js → options-22wspztn.js} +2 -2
- package/dist/chunks/{media-uri-s282vggx.js → options-2xcc0x05.js} +1 -1
- package/dist/chunks/{media-uri-z3e7v67k.js → options-5pdfedjd.js} +5 -5
- package/dist/chunks/{media-uri-ny1j968n.js → options-6vs5sqy6.js} +2 -2
- package/dist/chunks/{media-uri-j87xz9bt.js → options-9c4eyh8m.js} +3 -3
- package/dist/chunks/{media-uri-7b9xm1qg.js → options-9tsb9bht.js} +1 -1
- package/dist/chunks/{media-uri-5xzbpdv4.js → options-awjv4jq4.js} +2 -2
- package/dist/chunks/{media-uri-cezwbsk5.js → options-b2k9041j.js} +1 -1
- package/dist/chunks/{media-uri-5b42hxrf.js → options-be53s2qz.js} +1 -1
- package/dist/chunks/{media-uri-a8jcac9a.js → options-dk68ymtv.js} +1 -1
- package/dist/chunks/{media-uri-kkdkqt8j.js → options-e46y0tfd.js} +2 -2
- package/dist/chunks/{media-uri-0q7s66m2.js → options-e6e4kz0w.js} +4 -4
- package/dist/chunks/{media-uri-wcn6e2d2.js → options-e9906t2e.js} +6 -6
- package/dist/chunks/{media-uri-8254b7zm.js → options-fqnn17ss.js} +35 -35
- package/dist/chunks/{media-uri-htyf2qs7.js → options-gk0yxcp6.js} +1 -1
- package/dist/chunks/{media-uri-50bbk3b2.js → options-gqq6kfhc.js} +3 -3
- package/dist/chunks/{media-uri-zcvan105.js → options-h072q2hm.js} +1 -1
- package/dist/chunks/{media-uri-4fy84009.js → options-h9rcwvg0.js} +1 -1
- package/dist/chunks/{media-uri-az0609r6.js → options-hax1v4bv.js} +2 -2
- package/dist/chunks/{media-uri-1v577ncx.js → options-hnheq3hv.js} +2 -2
- package/dist/chunks/{media-uri-b105zy65.js → options-j9gxd9me.js} +2 -2
- package/dist/chunks/{media-uri-htj50t1a.js → options-kffvskmv.js} +4 -4
- package/dist/chunks/{media-uri-p9jzpjd0.js → options-khcas2q2.js} +3 -3
- package/dist/chunks/{media-uri-mzs0n5xz.js → options-kqr36gas.js} +7 -7
- package/dist/chunks/{media-uri-f559fakr.js → options-m5rae7m4.js} +2 -2
- package/dist/chunks/{media-uri-20hxek78.js → options-nha9c8fp.js} +4 -4
- package/dist/chunks/{media-uri-j4at0y5c.js → options-peg0afvz.js} +9 -5
- package/dist/chunks/{media-uri-btahnm2b.js → options-ppma8fcc.js} +3 -3
- package/dist/chunks/{media-uri-2h6qktqa.js → options-r6vmgwff.js} +2 -2
- package/dist/chunks/{media-uri-sz1xtn87.js → options-s9k7mqbm.js} +14 -14
- package/dist/chunks/{media-uri-vsfeekyx.js → options-vj2c9626.js} +4 -4
- package/dist/chunks/{media-uri-47s7e54k.js → options-wcfd0w14.js} +8 -8
- package/dist/chunks/{media-uri-y4zerkz9.js → options-wecgp61r.js} +27 -26
- package/dist/chunks/{media-uri-d0edqfxx.js → options-wxj3d9av.js} +2 -2
- package/dist/chunks/{media-uri-qcg3sqtb.js → options-x8dgc261.js} +2 -2
- package/dist/chunks/{media-uri-5s6gh8sx.js → options-xe9t9xr4.js} +2 -2
- package/dist/chunks/{media-uri-8s23qbm0.js → options-xga54a1t.js} +4 -4
- package/dist/chunks/{media-uri-b3bmdkga.js → options-yet0vexm.js} +1 -1
- package/dist/chunks/{media-uri-te8jwba1.js → options-yr4wsvrw.js} +2 -2
- package/dist/chunks/{media-uri-4q6e7fh8.js → options-z59gyc0x.js} +2 -2
- package/dist/chunks/{media-uri-58psf7ej.js → options-zgt2tacv.js} +3 -3
- package/dist/chunks/{media-uri-h29xjj1e.js → options-zjy4sw3d.js} +2 -2
- package/dist/cors.js +1 -1
- package/dist/event-feed.d.ts +1 -1
- package/dist/event-feed.js +7 -7
- package/dist/fetch.d.ts +1 -0
- package/dist/fetch.js +50 -50
- package/dist/handlers/agent.js +6 -6
- package/dist/handlers/command.js +6 -6
- package/dist/handlers/config.js +6 -6
- package/dist/handlers/credential.js +6 -6
- 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 +6 -6
- package/dist/handlers/generate.js +6 -6
- package/dist/handlers/integration.js +6 -6
- package/dist/handlers/location.js +6 -6
- package/dist/handlers/mcp.js +8 -8
- package/dist/handlers/media.js +1 -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.js +9 -9
- 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.js +46 -46
- 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 +1 -0
- package/dist/options.js +1 -0
- package/dist/pairing.js +3 -3
- package/dist/process.d.ts +1 -0
- package/dist/process.js +61 -57
- package/dist/request-tracing.js +1 -1
- package/dist/routes.js +49 -49
- package/dist/server-info.js +3 -3
- package/dist/service-status.js +3 -3
- package/dist/workerd.js +51 -51
- package/package.json +9 -8
- /package/dist/chunks/{media-uri-9rqn6x4v.js → options-9rqn6x4v.js} +0 -0
- /package/dist/chunks/{media-uri-erzfdgke.js → options-erzfdgke.js} +0 -0
- /package/dist/chunks/{media-uri-h6rt5k9s.js → options-h6rt5k9s.js} +0 -0
- /package/dist/chunks/{media-uri-n321d8vm.js → options-n321d8vm.js} +0 -0
- /package/dist/chunks/{media-uri-q4bn6dy8.js → options-q4bn6dy8.js} +0 -0
- /package/dist/chunks/{media-uri-smaf4a18.js → options-smaf4a18.js} +0 -0
- /package/dist/chunks/{media-uri-xthc02cw.js → options-xthc02cw.js} +0 -0
- /package/dist/chunks/{media-uri-yc7nft6q.js → options-yc7nft6q.js} +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__export
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./options-9rqn6x4v.js";
|
|
4
4
|
|
|
5
5
|
// src/pairing.ts
|
|
6
6
|
var exports_pairing = {};
|
|
7
7
|
__export(exports_pairing, {
|
|
8
8
|
ServerPairing: () => exports_pairing,
|
|
9
|
-
Service: () =>
|
|
9
|
+
Service: () => Service2,
|
|
10
10
|
node: () => node2
|
|
11
11
|
});
|
|
12
12
|
import { Cache, Context, Duration, Effect, Layer } from "effect";
|
|
@@ -14,12 +14,12 @@ import { makeGlobalNode } from "@opencode/util/effect/app-node";
|
|
|
14
14
|
import { randomBytes } from "node:crypto";
|
|
15
15
|
var TTL = Duration.minutes(5);
|
|
16
16
|
|
|
17
|
-
class
|
|
17
|
+
class Service2 extends Context.Service()("@opencode/ServerPairing") {
|
|
18
18
|
}
|
|
19
19
|
var noLookup = () => Effect.die(new Error("ServerPairing cache must be used via set/invalidateWhen, never get"));
|
|
20
|
-
var layer = Layer.effect(
|
|
20
|
+
var layer = Layer.effect(Service2, Effect.gen(function* () {
|
|
21
21
|
const cache = yield* Cache.make({ capacity: 1000, lookup: noLookup, timeToLive: TTL });
|
|
22
|
-
return
|
|
22
|
+
return Service2.of({
|
|
23
23
|
issue: Effect.fn("ServerPairing.issue")(function* () {
|
|
24
24
|
const code = randomBytes(16).toString("base64url");
|
|
25
25
|
yield* Cache.set(cache, code, true);
|
|
@@ -30,6 +30,6 @@ var layer = Layer.effect(Service4, Effect.gen(function* () {
|
|
|
30
30
|
})
|
|
31
31
|
});
|
|
32
32
|
}));
|
|
33
|
-
var node2 = makeGlobalNode({ service:
|
|
33
|
+
var node2 = makeGlobalNode({ service: Service2, layer, deps: [] });
|
|
34
34
|
|
|
35
|
-
export {
|
|
35
|
+
export { Service2, node2, exports_pairing };
|
|
@@ -2,17 +2,17 @@ import {
|
|
|
2
2
|
locationErrors2,
|
|
3
3
|
response2,
|
|
4
4
|
requestRef2
|
|
5
|
-
} from "./
|
|
5
|
+
} from "./options-gqq6kfhc.js";
|
|
6
6
|
import {
|
|
7
7
|
Api2
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./options-9c4eyh8m.js";
|
|
9
9
|
import {
|
|
10
10
|
CorsConfig2,
|
|
11
11
|
isAllowedRequestOrigin2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./options-q4bn6dy8.js";
|
|
13
13
|
import {
|
|
14
14
|
runPtySocket2
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./options-h6rt5k9s.js";
|
|
16
16
|
|
|
17
17
|
// src/handlers/mcp.ts
|
|
18
18
|
import { Location } from "@opencode/core/location";
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__export
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./options-9rqn6x4v.js";
|
|
4
4
|
|
|
5
5
|
// src/auth.ts
|
|
6
6
|
var exports_auth = {};
|
|
7
7
|
__export(exports_auth, {
|
|
8
8
|
Config: () => Config2,
|
|
9
|
+
DEFAULT_USERNAME: () => DEFAULT_USERNAME2,
|
|
9
10
|
SESSION_TTL_SECONDS: () => SESSION_TTL_SECONDS2,
|
|
10
11
|
ServerAuth: () => exports_auth,
|
|
11
12
|
authorized: () => authorized2,
|
|
@@ -16,11 +17,12 @@ __export(exports_auth, {
|
|
|
16
17
|
});
|
|
17
18
|
import { Context, Layer, Option, Redacted } from "effect";
|
|
18
19
|
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
20
|
+
var DEFAULT_USERNAME2 = "opencode";
|
|
19
21
|
var SESSION_TTL_SECONDS2 = 30 * 24 * 60 * 60;
|
|
20
22
|
|
|
21
23
|
class Config2 extends Context.Service()("@opencode/ServerAuthConfig") {
|
|
22
24
|
static configLayer(input) {
|
|
23
|
-
return Layer.succeed(this, this.of({
|
|
25
|
+
return Layer.succeed(this, this.of({ password: input.password, username: input.username ?? DEFAULT_USERNAME2 }));
|
|
24
26
|
}
|
|
25
27
|
static get layer() {
|
|
26
28
|
return this.configLayer({ password: Option.none() });
|
|
@@ -30,10 +32,12 @@ function required2(config) {
|
|
|
30
32
|
return Option.isSome(config.password) && config.password.value !== "";
|
|
31
33
|
}
|
|
32
34
|
function authorized2(credentials, config) {
|
|
33
|
-
if (Option.isNone(config.password)
|
|
35
|
+
if (Option.isNone(config.password))
|
|
34
36
|
return false;
|
|
35
37
|
const password = Redacted.value(credentials.password);
|
|
36
|
-
|
|
38
|
+
if (verifySession2(password, config))
|
|
39
|
+
return true;
|
|
40
|
+
return credentials.username === config.username && password === config.password.value;
|
|
37
41
|
}
|
|
38
42
|
function issueSession2(config, now = Date.now()) {
|
|
39
43
|
if (Option.isNone(config.password))
|
|
@@ -63,4 +67,4 @@ function sign(password, payload) {
|
|
|
63
67
|
return createHmac("sha256", key).update(payload).digest("base64url");
|
|
64
68
|
}
|
|
65
69
|
|
|
66
|
-
export { SESSION_TTL_SECONDS2, Config2, required2, authorized2, issueSession2, verifySession2, sessionCookieName2, exports_auth };
|
|
70
|
+
export { DEFAULT_USERNAME2, SESSION_TTL_SECONDS2, Config2, required2, authorized2, issueSession2, verifySession2, sessionCookieName2, exports_auth };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
missingSession2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./options-smaf4a18.js";
|
|
4
4
|
import {
|
|
5
5
|
locationErrors2,
|
|
6
6
|
response2,
|
|
7
7
|
sessionInfo2
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./options-gqq6kfhc.js";
|
|
9
9
|
import {
|
|
10
10
|
Api2
|
|
11
|
-
} from "./
|
|
11
|
+
} from "./options-9c4eyh8m.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
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./options-gqq6kfhc.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./options-9c4eyh8m.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/fs.ts
|
|
9
9
|
import { FileSystem } from "@opencode/core/filesystem";
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./
|
|
2
|
+
layer3
|
|
3
|
+
} from "./options-gqq6kfhc.js";
|
|
4
4
|
import {
|
|
5
5
|
formLocationLayer2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./options-gk0yxcp6.js";
|
|
7
7
|
import {
|
|
8
8
|
sessionLocationLayer2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./options-yet0vexm.js";
|
|
10
10
|
import {
|
|
11
11
|
Api2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./options-9c4eyh8m.js";
|
|
13
13
|
import {
|
|
14
14
|
Config2
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./options-peg0afvz.js";
|
|
16
16
|
import {
|
|
17
17
|
CorsConfig2
|
|
18
|
-
} from "./
|
|
18
|
+
} from "./options-q4bn6dy8.js";
|
|
19
19
|
import {
|
|
20
20
|
layer2
|
|
21
|
-
} from "./
|
|
21
|
+
} from "./options-5pdfedjd.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-fqnn17ss.js";
|
|
28
28
|
import {
|
|
29
29
|
authorizationLayer2
|
|
30
|
-
} from "./
|
|
30
|
+
} from "./options-9tsb9bht.js";
|
|
31
31
|
import {
|
|
32
32
|
schemaErrorLayer2
|
|
33
|
-
} from "./
|
|
33
|
+
} from "./options-erzfdgke.js";
|
|
34
34
|
|
|
35
35
|
// src/routes.ts
|
|
36
36
|
import { Database } from "@opencode/core/database/database";
|
|
@@ -103,7 +103,7 @@ var applicationServiceNodes = [
|
|
|
103
103
|
];
|
|
104
104
|
var applicationServices = LayerNode.group(applicationServiceNodes);
|
|
105
105
|
function createRoutes2(options = {}, serviceURLs = () => [], overrides = []) {
|
|
106
|
-
return makeRoutes(options.password ? Config2.configLayer({ password: Option.some(options.password) }) : Config2.layer, options, serviceURLs, overrides);
|
|
106
|
+
return makeRoutes(options.password ? Config2.configLayer({ password: Option.some(options.password), username: options.username }) : Config2.layer, options, serviceURLs, overrides);
|
|
107
107
|
}
|
|
108
108
|
function createEmbeddedRoutes2(options = {}, overrides = [], instances) {
|
|
109
109
|
return makeRoutes(Config2.configLayer({ password: Option.none() }), options, () => [], overrides, instances);
|
|
@@ -150,7 +150,7 @@ function makeRoutes(auth, options, serviceURLs, overrides, instances) {
|
|
|
150
150
|
return serviceLayer.pipe(Layer.flatMap((context) => {
|
|
151
151
|
const services = Layer.succeedContext(context);
|
|
152
152
|
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));
|
|
153
|
-
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(
|
|
153
|
+
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));
|
|
154
154
|
return Layer.merge(api, V1Migration.layer.pipe(Layer.provide(services)));
|
|
155
155
|
}));
|
|
156
156
|
}
|
|
@@ -2,17 +2,17 @@ import {
|
|
|
2
2
|
locationErrors2,
|
|
3
3
|
response2,
|
|
4
4
|
requestRef2
|
|
5
|
-
} from "./
|
|
5
|
+
} from "./options-gqq6kfhc.js";
|
|
6
6
|
import {
|
|
7
7
|
Api2
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./options-9c4eyh8m.js";
|
|
9
9
|
import {
|
|
10
10
|
CorsConfig2,
|
|
11
11
|
isAllowedRequestOrigin2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./options-q4bn6dy8.js";
|
|
13
13
|
import {
|
|
14
14
|
runPtySocket2
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./options-h6rt5k9s.js";
|
|
16
16
|
|
|
17
17
|
// src/handlers/pty.ts
|
|
18
18
|
import { Pty } from "@opencode/core/pty";
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./options-9c4eyh8m.js";
|
|
4
4
|
import {
|
|
5
5
|
SESSION_TTL_SECONDS2,
|
|
6
6
|
Config2,
|
|
7
7
|
issueSession2,
|
|
8
8
|
sessionCookieName2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./options-peg0afvz.js";
|
|
10
10
|
import {
|
|
11
|
-
|
|
12
|
-
} from "./
|
|
11
|
+
Service3
|
|
12
|
+
} from "./options-5pdfedjd.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,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__export
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./options-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: () => Service4,
|
|
11
11
|
SubscriberCapacity: () => SubscriberCapacity2,
|
|
12
12
|
SubscriberOverflowError: () => SubscriberOverflowError2,
|
|
13
13
|
frame: () => frame2,
|
|
14
|
-
layer: () =>
|
|
15
|
-
make: () =>
|
|
14
|
+
layer: () => layer4,
|
|
15
|
+
make: () => make4
|
|
16
16
|
});
|
|
17
17
|
import { Bus } from "@opencode/core/bus";
|
|
18
18
|
import { Event } from "@opencode/schema/event";
|
|
@@ -30,19 +30,19 @@ class EncodingError2 extends Schema.TaggedError()("EventFeed.EncodingError", {
|
|
|
30
30
|
}) {
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
class
|
|
33
|
+
class Service4 extends Context.Service()("@opencode/server/EventFeed") {
|
|
34
34
|
}
|
|
35
35
|
function frame2(event) {
|
|
36
36
|
return `data: ${JSON.stringify(event)}
|
|
37
37
|
|
|
38
38
|
`;
|
|
39
39
|
}
|
|
40
|
-
var
|
|
40
|
+
var make4 = Effect.fn("EventFeed.make")(function* (observe, options) {
|
|
41
41
|
const capacity = options?.capacity ?? SubscriberCapacity2;
|
|
42
42
|
const render = options?.encode ?? frame2;
|
|
43
|
-
const subscribers = new
|
|
43
|
+
const subscribers = new Map;
|
|
44
44
|
const fail = (error) => Effect.sync(() => {
|
|
45
|
-
const current = Array.from(subscribers);
|
|
45
|
+
const current = Array.from(subscribers.keys());
|
|
46
46
|
subscribers.clear();
|
|
47
47
|
for (const subscriber of current)
|
|
48
48
|
Queue.failCauseUnsafe(subscriber, Cause.fail(error));
|
|
@@ -50,19 +50,20 @@ var make3 = Effect.fn("EventFeed.make")(function* (observe, options) {
|
|
|
50
50
|
const publish = Effect.fnUntraced(function* (event) {
|
|
51
51
|
if (!isOpenCodeEvent(event))
|
|
52
52
|
return;
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
53
|
+
let encoded;
|
|
54
|
+
for (const [subscriber, types] of subscribers) {
|
|
55
|
+
if (types && !types.has(event.type))
|
|
56
|
+
continue;
|
|
57
|
+
encoded ??= yield* Effect.try({
|
|
58
|
+
try: () => render(event),
|
|
59
|
+
catch: (cause) => new EncodingError2({ eventID: event.id, eventType: event.type, cause })
|
|
60
|
+
}).pipe(Effect.catch((error) => Effect.logError("Failed to encode public event", {
|
|
61
|
+
eventID: error.eventID,
|
|
62
|
+
eventType: error.eventType,
|
|
63
|
+
cause: error.cause
|
|
64
|
+
}).pipe(Effect.andThen(fail(error)), Effect.as(undefined))));
|
|
65
|
+
if (encoded === undefined)
|
|
66
|
+
return;
|
|
66
67
|
if (Queue.offerUnsafe(subscriber, encoded))
|
|
67
68
|
continue;
|
|
68
69
|
subscribers.delete(subscriber);
|
|
@@ -71,13 +72,13 @@ var make3 = Effect.fn("EventFeed.make")(function* (observe, options) {
|
|
|
71
72
|
});
|
|
72
73
|
const unsubscribe = yield* observe(publish);
|
|
73
74
|
yield* Effect.addFinalizer(() => unsubscribe);
|
|
74
|
-
return
|
|
75
|
-
subscribe: Effect.acquireRelease(Queue.dropping(capacity).pipe(Effect.tap((queue) => Effect.sync(() => subscribers.
|
|
75
|
+
return Service4.of({
|
|
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))
|
|
76
77
|
});
|
|
77
78
|
});
|
|
78
|
-
var
|
|
79
|
+
var layer4 = Layer.effect(Service4, Effect.gen(function* () {
|
|
79
80
|
const bus = yield* Bus.Service;
|
|
80
|
-
return yield*
|
|
81
|
+
return yield* make4(bus.listen);
|
|
81
82
|
}));
|
|
82
83
|
|
|
83
|
-
export { SubscriberCapacity2, SubscriberOverflowError2, EncodingError2,
|
|
84
|
+
export { SubscriberCapacity2, SubscriberOverflowError2, EncodingError2, Service4, frame2, make4, layer4, exports_event_feed };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
locationErrors2,
|
|
3
3
|
awaitPlugins2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./options-gqq6kfhc.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./options-9c4eyh8m.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/voice.ts
|
|
10
10
|
import { Location } from "@opencode/core/location";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
requestRef2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./options-gqq6kfhc.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./options-9c4eyh8m.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/debug.ts
|
|
9
9
|
import { LocationServiceMap } from "@opencode/core/location-service-map";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./options-9c4eyh8m.js";
|
|
4
4
|
import {
|
|
5
5
|
CorsConfig2,
|
|
6
6
|
isAllowedRequestOrigin2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./options-q4bn6dy8.js";
|
|
8
8
|
import {
|
|
9
9
|
makeMediaGet2
|
|
10
|
-
} from "./
|
|
10
|
+
} from "./options-n321d8vm.js";
|
|
11
11
|
import {
|
|
12
12
|
runPtySocket2
|
|
13
|
-
} from "./
|
|
13
|
+
} from "./options-h6rt5k9s.js";
|
|
14
14
|
|
|
15
15
|
// src/handlers/persistent-pty.ts
|
|
16
16
|
import { PersistentPty } from "@opencode/core/persistent-pty";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./options-gqq6kfhc.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./options-9c4eyh8m.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/reference.ts
|
|
9
9
|
import { Reference } from "@opencode/core/reference";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./options-gqq6kfhc.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./options-9c4eyh8m.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/command.ts
|
|
9
9
|
import { Command } from "@opencode/core/command";
|
|
@@ -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-9c4eyh8m.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,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./options-gqq6kfhc.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./options-9c4eyh8m.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/integration.ts
|
|
9
9
|
import { Integration } from "@opencode/core/integration";
|
package/dist/cors.js
CHANGED
package/dist/event-feed.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export declare class EncodingError extends EncodingError_base {
|
|
|
19
19
|
}
|
|
20
20
|
export type Error = SubscriberOverflowError | EncodingError;
|
|
21
21
|
export interface Interface {
|
|
22
|
-
readonly subscribe: Effect.Effect<Stream.Stream<string, Error>, never, Scope.Scope>;
|
|
22
|
+
readonly subscribe: (types?: ReadonlyArray<string>) => Effect.Effect<Stream.Stream<string, Error>, never, Scope.Scope>;
|
|
23
23
|
}
|
|
24
24
|
declare const Service_base: Context.ServiceClass<Service, "@opencode/server/EventFeed", Interface>;
|
|
25
25
|
export declare class Service extends Service_base {
|
package/dist/event-feed.js
CHANGED
|
@@ -2,19 +2,19 @@ import {
|
|
|
2
2
|
SubscriberCapacity2,
|
|
3
3
|
SubscriberOverflowError2,
|
|
4
4
|
EncodingError2,
|
|
5
|
-
|
|
5
|
+
Service4,
|
|
6
6
|
frame2,
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
make4,
|
|
8
|
+
layer4,
|
|
9
9
|
exports_event_feed
|
|
10
|
-
} from "./chunks/
|
|
10
|
+
} from "./chunks/options-wecgp61r.js";
|
|
11
11
|
export {
|
|
12
12
|
EncodingError2 as EncodingError,
|
|
13
13
|
exports_event_feed as EventFeed,
|
|
14
|
-
|
|
14
|
+
Service4 as Service,
|
|
15
15
|
SubscriberCapacity2 as SubscriberCapacity,
|
|
16
16
|
SubscriberOverflowError2 as SubscriberOverflowError,
|
|
17
17
|
frame2 as frame,
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
layer4 as layer,
|
|
19
|
+
make4 as make
|
|
20
20
|
};
|
package/dist/fetch.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export declare const make: (options?: {
|
|
|
39
39
|
readonly hostname?: string | undefined;
|
|
40
40
|
readonly port?: number | undefined;
|
|
41
41
|
readonly password?: string | undefined;
|
|
42
|
+
readonly username?: string | undefined;
|
|
42
43
|
readonly cors?: readonly string[] | undefined;
|
|
43
44
|
readonly simulation?: boolean | undefined;
|
|
44
45
|
readonly database?: {
|