@opencode/server 0.0.0-dev-21922 → 0.0.0-dev-51
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/{cors-x4gped6c.js → options-1h63dkgz.js} +16 -16
- package/dist/chunks/{cors-qkqa867r.js → options-32zxn73z.js} +6 -6
- package/dist/chunks/{cors-e6e4kz0w.js → options-39nnfjx1.js} +4 -4
- package/dist/chunks/{cors-z3e7v67k.js → options-3te71694.js} +7 -7
- package/dist/chunks/{cors-rxyx8sa0.js → options-4xzps9pr.js} +2 -2
- package/dist/chunks/{cors-3a2y3rg9.js → options-57bnbjk6.js} +8 -8
- package/dist/chunks/{cors-vtfzy3at.js → options-62bfwtjc.js} +2 -2
- package/dist/chunks/{cors-7tewdwsb.js → options-85kbrn7y.js} +2 -2
- package/dist/chunks/{cors-xbqm7mpj.js → options-9q55v56g.js} +2 -2
- package/dist/chunks/{cors-7b9xm1qg.js → options-9tsb9bht.js} +1 -1
- package/dist/chunks/{cors-7cd61xtm.js → options-axx4wwen.js} +2 -2
- package/dist/chunks/{cors-3whnvwbg.js → options-bknbvq67.js} +4 -4
- package/dist/chunks/{cors-hdwd22w5.js → options-dags6vpm.js} +1 -1
- package/dist/chunks/{cors-gk0yxcp6.js → options-ddnay6e1.js} +1 -1
- package/dist/chunks/{cors-0e4fm4yw.js → options-e0z6mnzj.js} +1 -1
- package/dist/chunks/{cors-5553qfcy.js → options-ey9m07rx.js} +3 -3
- package/dist/chunks/{cors-74kxthdf.js → options-f0kpaq89.js} +1 -1
- package/dist/chunks/{cors-skcryrty.js → options-f96zeczf.js} +2 -2
- package/dist/chunks/{cors-gqq6kfhc.js → options-gymtz25n.js} +3 -3
- package/dist/chunks/{cors-zyntahe8.js → options-hr24310e.js} +1 -1
- package/dist/chunks/{cors-3yw6ah7d.js → options-j5nctpa6.js} +2 -2
- package/dist/chunks/{cors-jc2vwkyw.js → options-j6d0mxrp.js} +2 -2
- package/dist/chunks/{cors-mzs0n5xz.js → options-kqr36gas.js} +7 -7
- package/dist/chunks/{cors-zmgfywqd.js → options-mam5ppd3.js} +1 -1
- package/dist/chunks/{cors-pw72p9a3.js → options-mftrjw1x.js} +33 -33
- package/dist/chunks/{cors-z9kgby92.js → options-nzrkt0f5.js} +4 -4
- package/dist/chunks/{cors-m3t57gm1.js → options-pbxe02h0.js} +4 -4
- package/dist/chunks/{cors-j4at0y5c.js → options-peg0afvz.js} +9 -5
- package/dist/chunks/{cors-631x5hrn.js → options-pf68b6b2.js} +4 -4
- package/dist/chunks/{cors-50xc6x42.js → options-q7gnt7ra.js} +3 -3
- package/dist/chunks/{cors-9jtrwq3h.js → options-sst5eg8z.js} +6 -6
- package/dist/chunks/{cors-0pbbhyf6.js → options-tgb4pddq.js} +2 -2
- package/dist/chunks/{cors-xckd9f88.js → options-v4jqkmz1.js} +2 -2
- package/dist/chunks/{cors-r5696se6.js → options-v7p1kzzd.js} +3 -3
- package/dist/chunks/{cors-5z5anmwp.js → options-va7wgp70.js} +2 -2
- package/dist/chunks/{cors-7x1re4zg.js → options-vyzvby0b.js} +2 -2
- package/dist/chunks/{cors-08zhnp7p.js → options-wecgp61r.js} +23 -22
- package/dist/chunks/{cors-yet0vexm.js → options-x74w7e1f.js} +1 -1
- package/dist/chunks/{cors-f4exzdsf.js → options-xad49dn3.js} +2 -2
- package/dist/chunks/{cors-2835150m.js → options-xfynz25m.js} +2 -2
- package/dist/chunks/{cors-vvp99hc9.js → options-xwy6frfd.js} +1 -1
- package/dist/chunks/{cors-3mffapg0.js → options-y56ann6c.js} +4 -4
- package/dist/chunks/{cors-vfkjeyp3.js → options-z48nkxh0.js} +1 -1
- package/dist/chunks/{cors-xpg37vzc.js → options-zzxz7279.js} +2 -2
- package/dist/chunks/{cors-4gk9fc6f.js → options-zzyy0zrw.js} +2 -2
- package/dist/cors.js +1 -1
- package/dist/event-feed.d.ts +1 -1
- package/dist/event-feed.js +3 -3
- package/dist/fetch.d.ts +1 -0
- package/dist/fetch.js +52 -52
- 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 +5 -5
- package/dist/service-status.js +3 -3
- package/dist/workerd.js +53 -53
- package/package.json +9 -8
- /package/dist/chunks/{cors-9rqn6x4v.js → options-9rqn6x4v.js} +0 -0
- /package/dist/chunks/{cors-erzfdgke.js → options-erzfdgke.js} +0 -0
- /package/dist/chunks/{cors-h6rt5k9s.js → options-h6rt5k9s.js} +0 -0
- /package/dist/chunks/{cors-n321d8vm.js → options-n321d8vm.js} +0 -0
- /package/dist/chunks/{cors-q4bn6dy8.js → options-q4bn6dy8.js} +0 -0
- /package/dist/chunks/{cors-smaf4a18.js → options-smaf4a18.js} +0 -0
- /package/dist/chunks/{cors-xthc02cw.js → options-xthc02cw.js} +0 -0
- /package/dist/chunks/{cors-yc7nft6q.js → options-yc7nft6q.js} +0 -0
|
@@ -1,102 +1,102 @@
|
|
|
1
1
|
import {
|
|
2
2
|
GenerateHandler2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./options-j5nctpa6.js";
|
|
4
4
|
import {
|
|
5
5
|
VoiceHandler2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./options-xfynz25m.js";
|
|
7
7
|
import {
|
|
8
8
|
MessageHandler2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./options-ey9m07rx.js";
|
|
10
10
|
import {
|
|
11
11
|
ModelHandler2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./options-y56ann6c.js";
|
|
13
13
|
import {
|
|
14
14
|
ProviderHandler2
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./options-62bfwtjc.js";
|
|
16
16
|
import {
|
|
17
17
|
SessionHandler2
|
|
18
|
-
} from "./
|
|
18
|
+
} from "./options-nzrkt0f5.js";
|
|
19
19
|
import {
|
|
20
20
|
PermissionHandler2
|
|
21
|
-
} from "./
|
|
21
|
+
} from "./options-q7gnt7ra.js";
|
|
22
22
|
import {
|
|
23
23
|
FileSystemHandler2
|
|
24
|
-
} from "./
|
|
24
|
+
} from "./options-tgb4pddq.js";
|
|
25
25
|
import {
|
|
26
26
|
FormHandler2
|
|
27
|
-
} from "./
|
|
27
|
+
} from "./options-vyzvby0b.js";
|
|
28
28
|
import {
|
|
29
29
|
CommandHandler2
|
|
30
|
-
} from "./
|
|
30
|
+
} from "./options-zzxz7279.js";
|
|
31
31
|
import {
|
|
32
32
|
SkillHandler2
|
|
33
|
-
} from "./
|
|
33
|
+
} from "./options-9q55v56g.js";
|
|
34
34
|
import {
|
|
35
35
|
RpcHandler2
|
|
36
|
-
} from "./
|
|
36
|
+
} from "./options-hr24310e.js";
|
|
37
37
|
import {
|
|
38
38
|
layer4
|
|
39
|
-
} from "./
|
|
39
|
+
} from "./options-wecgp61r.js";
|
|
40
40
|
import {
|
|
41
41
|
EventHandler2
|
|
42
|
-
} from "./
|
|
42
|
+
} from "./options-32zxn73z.js";
|
|
43
43
|
import {
|
|
44
44
|
AgentHandler2
|
|
45
|
-
} from "./
|
|
45
|
+
} from "./options-xad49dn3.js";
|
|
46
46
|
import {
|
|
47
47
|
PluginHandler2
|
|
48
|
-
} from "./
|
|
48
|
+
} from "./options-v4jqkmz1.js";
|
|
49
49
|
import {
|
|
50
50
|
ServerHandler2
|
|
51
|
-
} from "./
|
|
51
|
+
} from "./options-57bnbjk6.js";
|
|
52
52
|
import {
|
|
53
53
|
DebugHandler2
|
|
54
|
-
} from "./
|
|
54
|
+
} from "./options-j6d0mxrp.js";
|
|
55
55
|
import {
|
|
56
56
|
PtyHandler2
|
|
57
|
-
} from "./
|
|
57
|
+
} from "./options-pbxe02h0.js";
|
|
58
58
|
import {
|
|
59
59
|
PersistentPtyHandler2
|
|
60
|
-
} from "./
|
|
60
|
+
} from "./options-pf68b6b2.js";
|
|
61
61
|
import {
|
|
62
62
|
ShellHandler2
|
|
63
|
-
} from "./
|
|
63
|
+
} from "./options-4xzps9pr.js";
|
|
64
64
|
import {
|
|
65
65
|
ReferenceHandler2
|
|
66
|
-
} from "./
|
|
66
|
+
} from "./options-f96zeczf.js";
|
|
67
67
|
import {
|
|
68
68
|
LocationHandler2
|
|
69
|
-
} from "./
|
|
69
|
+
} from "./options-f0kpaq89.js";
|
|
70
70
|
import {
|
|
71
71
|
IntegrationHandler2
|
|
72
|
-
} from "./
|
|
72
|
+
} from "./options-zzyy0zrw.js";
|
|
73
73
|
import {
|
|
74
74
|
WebSearchHandler2
|
|
75
|
-
} from "./
|
|
75
|
+
} from "./options-axx4wwen.js";
|
|
76
76
|
import {
|
|
77
77
|
UsageHandler2
|
|
78
|
-
} from "./
|
|
78
|
+
} from "./options-va7wgp70.js";
|
|
79
79
|
import {
|
|
80
80
|
McpHandler2
|
|
81
|
-
} from "./
|
|
81
|
+
} from "./options-bknbvq67.js";
|
|
82
82
|
import {
|
|
83
83
|
CredentialHandler2
|
|
84
|
-
} from "./
|
|
84
|
+
} from "./options-dags6vpm.js";
|
|
85
85
|
import {
|
|
86
86
|
ProjectHandler2
|
|
87
|
-
} from "./
|
|
87
|
+
} from "./options-mam5ppd3.js";
|
|
88
88
|
import {
|
|
89
89
|
WorktreeHandler2
|
|
90
|
-
} from "./
|
|
90
|
+
} from "./options-z48nkxh0.js";
|
|
91
91
|
import {
|
|
92
92
|
VcsHandler2
|
|
93
|
-
} from "./
|
|
93
|
+
} from "./options-85kbrn7y.js";
|
|
94
94
|
import {
|
|
95
95
|
MigrationHandler2
|
|
96
|
-
} from "./
|
|
96
|
+
} from "./options-xwy6frfd.js";
|
|
97
97
|
import {
|
|
98
98
|
ConfigHandler2
|
|
99
|
-
} from "./
|
|
99
|
+
} from "./options-e0z6mnzj.js";
|
|
100
100
|
|
|
101
101
|
// src/handlers.ts
|
|
102
102
|
import { Layer } from "effect";
|
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
missingMessage2,
|
|
4
4
|
failedMessageDecode2,
|
|
5
5
|
failedSnapshot2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./options-smaf4a18.js";
|
|
7
7
|
import {
|
|
8
8
|
locationErrors2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./options-gymtz25n.js";
|
|
10
10
|
import {
|
|
11
11
|
Api2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./options-v7p1kzzd.js";
|
|
13
13
|
import {
|
|
14
14
|
wantsMediaRefs2
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./options-xthc02cw.js";
|
|
16
16
|
|
|
17
17
|
// src/handlers/session.ts
|
|
18
18
|
import { Instance } from "@opencode/core/instance/service";
|
|
@@ -2,17 +2,17 @@ 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
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,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,16 +1,16 @@
|
|
|
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
|
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,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-gymtz25n.js";
|
|
9
9
|
import {
|
|
10
10
|
Api2
|
|
11
|
-
} from "./
|
|
11
|
+
} from "./options-v7p1kzzd.js";
|
|
12
12
|
|
|
13
13
|
// src/handlers/permission.ts
|
|
14
14
|
import { Instance } from "@opencode/core/instance/service";
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isAllowedCorsOrigin2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./options-q4bn6dy8.js";
|
|
4
4
|
import {
|
|
5
5
|
createRoutes2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./options-1h63dkgz.js";
|
|
7
7
|
import {
|
|
8
8
|
__export
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./options-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: () =>
|
|
15
|
+
make: () => make3
|
|
16
16
|
});
|
|
17
17
|
import { Context, Effect, Layer } from "effect";
|
|
18
18
|
import { HttpEffect, HttpMiddleware, HttpRouter, HttpServer } from "effect/http";
|
|
19
19
|
import { SessionRestart } from "@opencode/core/session/execution/restart";
|
|
20
|
-
var
|
|
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 {
|
|
26
|
+
export { make3, exports_fetch };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LocationMiddleware2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./options-gymtz25n.js";
|
|
4
4
|
import {
|
|
5
5
|
FormLocationMiddleware2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./options-ddnay6e1.js";
|
|
7
7
|
import {
|
|
8
8
|
SessionLocationMiddleware2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./options-x74w7e1f.js";
|
|
10
10
|
|
|
11
11
|
// src/api.ts
|
|
12
12
|
import { makeDefaultApi } from "@opencode/protocol/api";
|
|
@@ -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/usage.ts
|
|
10
10
|
import { UsageLimits } from "@opencode/core/usage-limits";
|
|
@@ -1,13 +1,13 @@
|
|
|
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,
|
|
@@ -30,7 +30,7 @@ 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)}
|
|
@@ -40,9 +40,9 @@ function frame2(event) {
|
|
|
40
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 make4 = 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 make4 = 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 layer4 = Layer.effect(
|
|
79
|
+
var layer4 = Layer.effect(Service4, Effect.gen(function* () {
|
|
79
80
|
const bus = yield* Bus.Service;
|
|
80
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
|
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/agent.ts
|
|
10
10
|
import { Agent } from "@opencode/core/agent";
|
|
@@ -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/voice.ts
|
|
10
10
|
import { Location } from "@opencode/core/location";
|
|
@@ -1,20 +1,20 @@
|
|
|
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/model.ts
|
|
10
10
|
import { Model } from "@opencode/core/model";
|
|
11
11
|
import { Effect } from "effect";
|
|
12
12
|
import { HttpApiBuilder } from "effect/http-api";
|
|
13
13
|
var ModelHandler2 = HttpApiBuilder.group(Api2, "server.model", (handlers) => Effect.gen(function* () {
|
|
14
|
-
return handlers.handle("model.list", Effect.fn(function* () {
|
|
14
|
+
return handlers.handle("model.list", Effect.fn(function* (ctx) {
|
|
15
15
|
yield* awaitPlugins2;
|
|
16
16
|
const models = yield* Model.Service;
|
|
17
|
-
return yield* response2(models.available());
|
|
17
|
+
return yield* response2(models.available(ctx.query.types));
|
|
18
18
|
})).handle("model.default", Effect.fn(function* () {
|
|
19
19
|
yield* awaitPlugins2;
|
|
20
20
|
const models = yield* Model.Service;
|
|
@@ -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/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,16 +2,16 @@ import {
|
|
|
2
2
|
SubscriberCapacity2,
|
|
3
3
|
SubscriberOverflowError2,
|
|
4
4
|
EncodingError2,
|
|
5
|
-
|
|
5
|
+
Service4,
|
|
6
6
|
frame2,
|
|
7
7
|
make4,
|
|
8
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,
|
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?: {
|