@opencode/server 2.2.5 → 2.2.7
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 +16 -3
- package/dist/api.js +5 -5
- package/dist/auth.js +1 -1
- package/dist/chunks/{location-059rbh9c.js → process-059rbh9c.js} +1 -1
- package/dist/chunks/{location-e0z6mnzj.js → process-0e4fm4yw.js} +1 -1
- package/dist/chunks/{location-1jtv083t.js → process-1vxxxmgg.js} +2 -2
- package/dist/chunks/{location-xfynz25m.js → process-2835150m.js} +2 -2
- package/dist/chunks/{location-y56ann6c.js → process-370cpmna.js} +2 -2
- package/dist/chunks/{location-bknbvq67.js → process-4z8yg1dv.js} +7 -5
- package/dist/chunks/{location-q7gnt7ra.js → process-50xc6x42.js} +3 -3
- package/dist/chunks/{location-ey9m07rx.js → process-5553qfcy.js} +3 -3
- package/dist/chunks/{location-1kj4am0h.js → process-5kr30cfc.js} +11 -5
- package/dist/chunks/{location-7dtbad8d.js → process-5pdfedjd.js} +7 -7
- package/dist/chunks/{location-f0kpaq89.js → process-74kxthdf.js} +1 -1
- package/dist/chunks/process-78rcgzsr.js +28 -0
- package/dist/chunks/{location-7b9xm1qg.js → process-7b9xm1qg.js} +1 -1
- package/dist/chunks/{location-axx4wwen.js → process-7cd61xtm.js} +2 -2
- package/dist/chunks/{location-vyzvby0b.js → process-7x1re4zg.js} +2 -2
- package/dist/chunks/{location-85kbrn7y.js → process-agenqygg.js} +2 -4
- package/dist/chunks/{location-f1ds1268.js → process-amndpc82.js} +9 -6
- package/dist/chunks/{location-nzrkt0f5.js → process-dfxfd950.js} +6 -6
- package/dist/chunks/{location-n321d8vm.js → process-djr0jy89.js} +8 -6
- package/dist/chunks/{location-e6e4kz0w.js → process-e6e4kz0w.js} +1 -1
- package/dist/chunks/{location-5n22zpzy.js → process-f3xrm535.js} +6 -6
- package/dist/chunks/{location-ja97ph8b.js → process-fszbw5sk.js} +4 -4
- package/dist/chunks/{location-ddnay6e1.js → process-gk0yxcp6.js} +1 -1
- package/dist/chunks/{location-gymtz25n.js → process-gqq6kfhc.js} +3 -3
- package/dist/chunks/{location-j4at0y5c.js → process-j4at0y5c.js} +1 -1
- package/dist/chunks/{location-j6d0mxrp.js → process-jc2vwkyw.js} +2 -2
- package/dist/chunks/{location-va7wgp70.js → process-jqvq1ywe.js} +2 -4
- package/dist/chunks/{location-kqr36gas.js → process-kqr36gas.js} +1 -1
- package/dist/chunks/{location-wy3c18g3.js → process-mx6chrwy.js} +35 -35
- package/dist/chunks/process-myqk22k5.js +39 -0
- package/dist/chunks/{location-xad49dn3.js → process-p3f060n2.js} +3 -7
- package/dist/chunks/{location-h6rt5k9s.js → process-q187pxxd.js} +7 -1
- package/dist/chunks/{location-pbxe02h0.js → process-r2veymj8.js} +8 -6
- package/dist/chunks/{location-v7p1kzzd.js → process-r5696se6.js} +3 -3
- package/dist/chunks/{location-hr24310e.js → process-rcmctvp9.js} +1 -3
- package/dist/chunks/{location-4xzps9pr.js → process-rxyx8sa0.js} +2 -2
- package/dist/chunks/{location-f96zeczf.js → process-skcryrty.js} +2 -2
- package/dist/chunks/{location-0r9ve3h3.js → process-sqxx1p54.js} +2 -2
- package/dist/chunks/process-t32e1bbt.js +32 -0
- package/dist/chunks/{location-62bfwtjc.js → process-vtfzy3at.js} +2 -2
- package/dist/chunks/{location-xwy6frfd.js → process-vvp99hc9.js} +1 -1
- package/dist/chunks/{location-02a60aws.js → process-w5yp0ga8.js} +3 -4
- package/dist/chunks/{location-qfyg9gb7.js → process-wecgp61r.js} +7 -7
- package/dist/chunks/{location-dczgzh3x.js → process-wqv43pj9.js} +2 -2
- package/dist/chunks/{location-9q55v56g.js → process-xbqm7mpj.js} +2 -2
- package/dist/chunks/{location-c48av16v.js → process-xjbee3xk.js} +18 -16
- package/dist/chunks/{location-zzxz7279.js → process-xpg37vzc.js} +2 -2
- package/dist/chunks/{location-x74w7e1f.js → process-yet0vexm.js} +1 -1
- package/dist/chunks/{location-z48nkxh0.js → process-zds85vps.js} +2 -2
- package/dist/chunks/{location-tgb4pddq.js → process-zgvwy66h.js} +9 -6
- package/dist/chunks/{location-g6bmzkma.js → process-zgw0abca.js} +11 -7
- package/dist/chunks/{location-mam5ppd3.js → process-zmgfywqd.js} +1 -1
- 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 +56 -52
- 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 +1 -1
- package/dist/process.d.ts +1 -0
- package/dist/process.js +61 -56
- 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.d.ts +3 -2
- package/dist/routes.js +53 -51
- package/dist/server-info.js +5 -5
- package/dist/service-status.js +1 -1
- package/dist/workerd.d.ts +2 -0
- package/dist/workerd.js +59 -54
- package/package.json +13 -13
- /package/dist/chunks/{location-9rqn6x4v.js → process-9rqn6x4v.js} +0 -0
- /package/dist/chunks/{location-bd8755ek.js → process-bd8755ek.js} +0 -0
- /package/dist/chunks/{location-q4bn6dy8.js → process-q4bn6dy8.js} +0 -0
- /package/dist/chunks/{location-smaf4a18.js → process-smaf4a18.js} +0 -0
- /package/dist/chunks/{location-xthc02cw.js → process-xthc02cw.js} +0 -0
- /package/dist/chunks/{location-yc7nft6q.js → process-yc7nft6q.js} +0 -0
|
@@ -1,105 +1,105 @@
|
|
|
1
1
|
import {
|
|
2
2
|
GenerateHandler2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./process-wqv43pj9.js";
|
|
4
4
|
import {
|
|
5
5
|
VoiceHandler2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./process-2835150m.js";
|
|
7
7
|
import {
|
|
8
8
|
MessageHandler2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./process-5553qfcy.js";
|
|
10
10
|
import {
|
|
11
11
|
ModelHandler2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./process-370cpmna.js";
|
|
13
13
|
import {
|
|
14
14
|
ProviderHandler2
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./process-vtfzy3at.js";
|
|
16
16
|
import {
|
|
17
17
|
SessionHandler2
|
|
18
|
-
} from "./
|
|
18
|
+
} from "./process-dfxfd950.js";
|
|
19
19
|
import {
|
|
20
20
|
PermissionHandler2
|
|
21
|
-
} from "./
|
|
21
|
+
} from "./process-50xc6x42.js";
|
|
22
22
|
import {
|
|
23
23
|
FileSystemHandler2
|
|
24
|
-
} from "./
|
|
24
|
+
} from "./process-zgvwy66h.js";
|
|
25
25
|
import {
|
|
26
26
|
FormHandler2
|
|
27
|
-
} from "./
|
|
27
|
+
} from "./process-7x1re4zg.js";
|
|
28
28
|
import {
|
|
29
29
|
CommandHandler2
|
|
30
|
-
} from "./
|
|
30
|
+
} from "./process-xpg37vzc.js";
|
|
31
31
|
import {
|
|
32
32
|
SkillHandler2
|
|
33
|
-
} from "./
|
|
33
|
+
} from "./process-xbqm7mpj.js";
|
|
34
34
|
import {
|
|
35
35
|
RpcHandler2
|
|
36
|
-
} from "./
|
|
36
|
+
} from "./process-rcmctvp9.js";
|
|
37
37
|
import {
|
|
38
|
-
|
|
39
|
-
} from "./
|
|
38
|
+
layer4
|
|
39
|
+
} from "./process-wecgp61r.js";
|
|
40
40
|
import {
|
|
41
41
|
EventHandler2
|
|
42
|
-
} from "./
|
|
42
|
+
} from "./process-fszbw5sk.js";
|
|
43
43
|
import {
|
|
44
44
|
AgentHandler2
|
|
45
|
-
} from "./
|
|
45
|
+
} from "./process-p3f060n2.js";
|
|
46
46
|
import {
|
|
47
47
|
PluginHandler2
|
|
48
|
-
} from "./
|
|
48
|
+
} from "./process-sqxx1p54.js";
|
|
49
49
|
import {
|
|
50
50
|
ServerHandler2
|
|
51
|
-
} from "./
|
|
51
|
+
} from "./process-f3xrm535.js";
|
|
52
52
|
import {
|
|
53
53
|
DebugHandler2
|
|
54
|
-
} from "./
|
|
54
|
+
} from "./process-jc2vwkyw.js";
|
|
55
55
|
import {
|
|
56
56
|
PtyHandler2
|
|
57
|
-
} from "./
|
|
57
|
+
} from "./process-r2veymj8.js";
|
|
58
58
|
import {
|
|
59
59
|
PersistentPtyHandler2
|
|
60
|
-
} from "./
|
|
60
|
+
} from "./process-zgw0abca.js";
|
|
61
61
|
import {
|
|
62
62
|
ShellHandler2
|
|
63
|
-
} from "./
|
|
63
|
+
} from "./process-rxyx8sa0.js";
|
|
64
64
|
import {
|
|
65
65
|
ReferenceHandler2
|
|
66
|
-
} from "./
|
|
66
|
+
} from "./process-skcryrty.js";
|
|
67
67
|
import {
|
|
68
68
|
LocationHandler2
|
|
69
|
-
} from "./
|
|
69
|
+
} from "./process-74kxthdf.js";
|
|
70
70
|
import {
|
|
71
71
|
IntegrationHandler2
|
|
72
|
-
} from "./
|
|
72
|
+
} from "./process-amndpc82.js";
|
|
73
73
|
import {
|
|
74
74
|
WebSearchHandler2
|
|
75
|
-
} from "./
|
|
75
|
+
} from "./process-7cd61xtm.js";
|
|
76
76
|
import {
|
|
77
77
|
UsageHandler2
|
|
78
|
-
} from "./
|
|
78
|
+
} from "./process-jqvq1ywe.js";
|
|
79
79
|
import {
|
|
80
80
|
McpHandler2
|
|
81
|
-
} from "./
|
|
81
|
+
} from "./process-4z8yg1dv.js";
|
|
82
82
|
import {
|
|
83
83
|
CredentialHandler2
|
|
84
|
-
} from "./
|
|
84
|
+
} from "./process-1vxxxmgg.js";
|
|
85
85
|
import {
|
|
86
86
|
ProjectHandler2
|
|
87
|
-
} from "./
|
|
87
|
+
} from "./process-zmgfywqd.js";
|
|
88
88
|
import {
|
|
89
89
|
WorktreeHandler2
|
|
90
|
-
} from "./
|
|
90
|
+
} from "./process-zds85vps.js";
|
|
91
91
|
import {
|
|
92
92
|
VcsHandler2
|
|
93
|
-
} from "./
|
|
93
|
+
} from "./process-agenqygg.js";
|
|
94
94
|
import {
|
|
95
95
|
MigrationHandler2
|
|
96
|
-
} from "./
|
|
96
|
+
} from "./process-vvp99hc9.js";
|
|
97
97
|
import {
|
|
98
98
|
ConfigHandler2
|
|
99
|
-
} from "./
|
|
99
|
+
} from "./process-0e4fm4yw.js";
|
|
100
100
|
|
|
101
101
|
// src/handlers.ts
|
|
102
102
|
import { Layer } from "effect";
|
|
103
|
-
var handlers2 = Layer.mergeAll(ServerHandler2, DebugHandler2, MigrationHandler2, LocationHandler2, AgentHandler2, PluginHandler2, SessionHandler2, MessageHandler2, ModelHandler2, GenerateHandler2, VoiceHandler2, ProviderHandler2, IntegrationHandler2, WebSearchHandler2, UsageHandler2, McpHandler2, CredentialHandler2, ProjectHandler2, FormHandler2, PermissionHandler2, FileSystemHandler2, CommandHandler2, SkillHandler2, RpcHandler2, EventHandler2.pipe(Layer.provide(
|
|
103
|
+
var handlers2 = Layer.mergeAll(ServerHandler2, DebugHandler2, MigrationHandler2, LocationHandler2, AgentHandler2, PluginHandler2, SessionHandler2, MessageHandler2, ModelHandler2, GenerateHandler2, VoiceHandler2, ProviderHandler2, IntegrationHandler2, WebSearchHandler2, UsageHandler2, McpHandler2, CredentialHandler2, ProjectHandler2, FormHandler2, PermissionHandler2, FileSystemHandler2, CommandHandler2, SkillHandler2, RpcHandler2, EventHandler2.pipe(Layer.provide(layer4)), PtyHandler2, PersistentPtyHandler2, ShellHandler2, ReferenceHandler2, WorktreeHandler2, VcsHandler2, ConfigHandler2);
|
|
104
104
|
|
|
105
105
|
export { handlers2 };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isAllowedRequestOrigin2
|
|
3
|
+
} from "./process-q4bn6dy8.js";
|
|
4
|
+
import {
|
|
5
|
+
__export
|
|
6
|
+
} from "./process-9rqn6x4v.js";
|
|
7
|
+
|
|
8
|
+
// src/request-site.ts
|
|
9
|
+
var exports_request_site = {};
|
|
10
|
+
__export(exports_request_site, {
|
|
11
|
+
RequestSite: () => exports_request_site,
|
|
12
|
+
middleware: () => middleware2,
|
|
13
|
+
rejected: () => rejected2
|
|
14
|
+
});
|
|
15
|
+
import { Effect } from "effect";
|
|
16
|
+
import { HttpMiddleware, HttpServerRequest, HttpServerResponse } from "effect/http";
|
|
17
|
+
var ARTIFACT_VIEW = /^\/api\/experimental\/artifacts\/[^/]+\/view(\/|$)/;
|
|
18
|
+
function rejected2(request, options) {
|
|
19
|
+
const site = request.headers["sec-fetch-site"];
|
|
20
|
+
if (site !== "cross-site" && site !== "same-site")
|
|
21
|
+
return false;
|
|
22
|
+
const pathname = new URL(request.url, "http://localhost").pathname;
|
|
23
|
+
if (pathname !== "/api" && !pathname.startsWith("/api/"))
|
|
24
|
+
return false;
|
|
25
|
+
if (ARTIFACT_VIEW.test(pathname))
|
|
26
|
+
return false;
|
|
27
|
+
if (request.headers["sec-fetch-mode"] === "navigate")
|
|
28
|
+
return true;
|
|
29
|
+
const origin = request.headers.origin;
|
|
30
|
+
return origin !== undefined && !isAllowedRequestOrigin2(origin, request.headers.host, options);
|
|
31
|
+
}
|
|
32
|
+
var middleware2 = (options) => HttpMiddleware.make((app) => Effect.gen(function* () {
|
|
33
|
+
const request = yield* HttpServerRequest.HttpServerRequest;
|
|
34
|
+
if (!rejected2(request, options))
|
|
35
|
+
return yield* app;
|
|
36
|
+
return HttpServerResponse.jsonUnsafe({ _tag: "ForbiddenError", message: "Cross-site requests to the API are not allowed" }, { status: 403 });
|
|
37
|
+
}));
|
|
38
|
+
|
|
39
|
+
export { rejected2, middleware2, exports_request_site };
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
|
-
awaitPlugins2,
|
|
3
2
|
response2
|
|
4
|
-
} from "./
|
|
3
|
+
} from "./process-gqq6kfhc.js";
|
|
5
4
|
import {
|
|
6
5
|
Api2
|
|
7
|
-
} from "./
|
|
6
|
+
} from "./process-r5696se6.js";
|
|
8
7
|
|
|
9
8
|
// src/handlers/agent.ts
|
|
10
9
|
import { Agent } from "@opencode/core/agent";
|
|
11
10
|
import { Effect } from "effect";
|
|
12
11
|
import { HttpApiBuilder } from "effect/http-api";
|
|
13
12
|
import { AgentNotFoundError } from "@opencode/protocol/errors";
|
|
14
|
-
var AgentHandler2 = HttpApiBuilder.group(Api2, "server.agent", (handlers) => handlers.handle("agent.list", () => Effect.
|
|
15
|
-
yield* awaitPlugins2;
|
|
16
|
-
return yield* response2(Agent.Service.use((agent) => agent.list()));
|
|
17
|
-
})).handle("agent.get", Effect.fn(function* (ctx) {
|
|
13
|
+
var AgentHandler2 = HttpApiBuilder.group(Api2, "server.agent", (handlers) => handlers.handle("agent.list", () => response2(Agent.Service.use((agent) => agent.list()))).handle("agent.get", Effect.fn(function* (ctx) {
|
|
18
14
|
const agent = yield* Agent.Service.use((service) => service.get(ctx.params.agentID));
|
|
19
15
|
if (!agent)
|
|
20
16
|
return yield* new AgentNotFoundError({
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// src/handlers/pty-socket.ts
|
|
2
|
+
import { LocationLifecycle } from "@opencode/core/location-lifecycle";
|
|
2
3
|
import { Effect, Queue } from "effect";
|
|
3
4
|
import { Socket } from "effect/socket";
|
|
4
5
|
function runPtySocket2(input) {
|
|
@@ -20,5 +21,10 @@ function runPtySocket2(input) {
|
|
|
20
21
|
});
|
|
21
22
|
return Effect.raceFirst(drain, read).pipe(Effect.ensuring(Effect.sync(input.detach)), Effect.catchReason("SocketError", "SocketCloseError", () => Effect.void), Effect.orDie);
|
|
22
23
|
}
|
|
24
|
+
var holdLocation2 = Effect.fnUntraced(function* (outbox) {
|
|
25
|
+
const lifecycle = yield* LocationLifecycle.Service;
|
|
26
|
+
yield* lifecycle.retain;
|
|
27
|
+
yield* lifecycle.awaitShutdown.pipe(Effect.andThen(Queue.offer(outbox, new Socket.CloseEvent(1012, "location shut down"))), Effect.forkChild);
|
|
28
|
+
});
|
|
23
29
|
|
|
24
|
-
export { runPtySocket2 };
|
|
30
|
+
export { runPtySocket2, holdLocation2 };
|
|
@@ -2,17 +2,18 @@ import {
|
|
|
2
2
|
locationErrors2,
|
|
3
3
|
response2,
|
|
4
4
|
requestRef2
|
|
5
|
-
} from "./
|
|
5
|
+
} from "./process-gqq6kfhc.js";
|
|
6
6
|
import {
|
|
7
7
|
Api2
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./process-r5696se6.js";
|
|
9
9
|
import {
|
|
10
10
|
CorsConfig2,
|
|
11
11
|
isAllowedRequestOrigin2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./process-q4bn6dy8.js";
|
|
13
13
|
import {
|
|
14
|
-
runPtySocket2
|
|
15
|
-
|
|
14
|
+
runPtySocket2,
|
|
15
|
+
holdLocation2
|
|
16
|
+
} from "./process-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,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LocationMiddleware2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./process-gqq6kfhc.js";
|
|
4
4
|
import {
|
|
5
5
|
FormLocationMiddleware2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./process-gk0yxcp6.js";
|
|
7
7
|
import {
|
|
8
8
|
SessionLocationMiddleware2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./process-yet0vexm.js";
|
|
10
10
|
|
|
11
11
|
// src/api.ts
|
|
12
12
|
import { makeDefaultApi } from "@opencode/protocol/api";
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./process-r5696se6.js";
|
|
4
4
|
|
|
5
5
|
// src/handlers/rpc.ts
|
|
6
6
|
import { Rpc } from "@opencode/core/rpc";
|
|
7
|
-
import { Plugin } from "@opencode/core/plugin";
|
|
8
7
|
import { RpcError, RpcInternalError } from "@opencode/protocol/errors";
|
|
9
8
|
import { Effect } from "effect";
|
|
10
9
|
import { HttpApiBuilder } from "effect/http-api";
|
|
11
10
|
var RpcHandler2 = HttpApiBuilder.group(Api2, "server.rpc", (handlers) => handlers.handle("rpc.call", ({ params, payload }) => Effect.gen(function* () {
|
|
12
|
-
yield* Plugin.awaitActivation;
|
|
13
11
|
const rpc = yield* Rpc.Service;
|
|
14
12
|
const output = yield* rpc.call(params.rpcID, params.method, payload.input);
|
|
15
13
|
return output === undefined ? {} : { output };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./process-gqq6kfhc.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./process-r5696se6.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/reference.ts
|
|
9
9
|
import { Reference } from "@opencode/core/reference";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__export
|
|
3
|
+
} from "./process-9rqn6x4v.js";
|
|
4
|
+
|
|
5
|
+
// src/content-headers.ts
|
|
6
|
+
var exports_content_headers = {};
|
|
7
|
+
__export(exports_content_headers, {
|
|
8
|
+
CONTENT_SECURITY_POLICY: () => CONTENT_SECURITY_POLICY2,
|
|
9
|
+
ContentHeaders: () => exports_content_headers,
|
|
10
|
+
disposition: () => disposition2,
|
|
11
|
+
download: () => download2
|
|
12
|
+
});
|
|
13
|
+
import path from "path";
|
|
14
|
+
var CONTENT_SECURITY_POLICY2 = "default-src 'none'; img-src 'self'; media-src 'self'; sandbox";
|
|
15
|
+
var TEXT_TYPE = "text/plain; charset=utf-8";
|
|
16
|
+
function download2(input) {
|
|
17
|
+
return {
|
|
18
|
+
"content-type": /^(text\/html|text\/javascript|application\/(x-)?javascript)\b|[/+]xml\b/i.test(input.mime) ? TEXT_TYPE : input.mime,
|
|
19
|
+
"content-disposition": disposition2(input.path === undefined ? "" : path.basename(input.path)),
|
|
20
|
+
"content-security-policy": CONTENT_SECURITY_POLICY2,
|
|
21
|
+
"x-content-type-options": "nosniff"
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function disposition2(name) {
|
|
25
|
+
if (name === "")
|
|
26
|
+
return "attachment";
|
|
27
|
+
const fallback = name.replace(/[^\x20-\x7e]|["\\%]/g, "_");
|
|
28
|
+
const encoded = encodeURIComponent(name).replace(/['()*]/g, (char) => `%${char.charCodeAt(0).toString(16).toUpperCase()}`);
|
|
29
|
+
return `attachment; filename="${fallback}"; filename*=UTF-8''${encoded}`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export { CONTENT_SECURITY_POLICY2, download2, disposition2, exports_content_headers };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
awaitPlugins2,
|
|
3
3
|
response2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./process-gqq6kfhc.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./process-r5696se6.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/provider.ts
|
|
10
10
|
import { Provider } from "@opencode/core/provider";
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
missingSession2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./process-smaf4a18.js";
|
|
4
4
|
import {
|
|
5
5
|
locationErrors2,
|
|
6
|
-
awaitPlugins2,
|
|
7
6
|
response2,
|
|
8
7
|
requestRef2
|
|
9
|
-
} from "./
|
|
8
|
+
} from "./process-gqq6kfhc.js";
|
|
10
9
|
|
|
11
10
|
// src/handlers/artifact.ts
|
|
12
11
|
import { Artifact } from "@opencode/core/artifact";
|
|
@@ -64,7 +63,7 @@ var makeArtifact2 = Effect.gen(function* () {
|
|
|
64
63
|
});
|
|
65
64
|
const inLocation = (request, options, effect) => Effect.gen(function* () {
|
|
66
65
|
const ref = yield* resolveLocation(request, options);
|
|
67
|
-
return yield*
|
|
66
|
+
return yield* effect.pipe(Effect.provide(locations.get(ref)), locationErrors2);
|
|
68
67
|
});
|
|
69
68
|
const mapCommon = (effect) => effect.pipe(Effect.catchTags({
|
|
70
69
|
"Artifact.DisabledError": (error) => Effect.fail(new ForbiddenError({ message: error.message })),
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__export
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./process-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: () =>
|
|
14
|
+
layer: () => layer4,
|
|
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 Service4 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 Service4.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 layer4 = Layer.effect(Service4, 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, Service4, frame2, make4, layer4, exports_event_feed };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
locationErrors2,
|
|
3
3
|
awaitPlugins2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./process-gqq6kfhc.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./process-r5696se6.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/generate.ts
|
|
10
10
|
import { Generate } from "@opencode/core/generate";
|
|
@@ -1,43 +1,43 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./
|
|
2
|
+
layer3
|
|
3
|
+
} from "./process-gqq6kfhc.js";
|
|
4
4
|
import {
|
|
5
5
|
formLocationLayer2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./process-gk0yxcp6.js";
|
|
7
7
|
import {
|
|
8
8
|
sessionLocationLayer2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./process-yet0vexm.js";
|
|
10
10
|
import {
|
|
11
11
|
Api2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./process-r5696se6.js";
|
|
13
13
|
import {
|
|
14
14
|
Config2
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./process-j4at0y5c.js";
|
|
16
16
|
import {
|
|
17
17
|
CorsConfig2
|
|
18
|
-
} from "./
|
|
18
|
+
} from "./process-q4bn6dy8.js";
|
|
19
19
|
import {
|
|
20
|
-
|
|
21
|
-
} from "./
|
|
20
|
+
layer2
|
|
21
|
+
} from "./process-5pdfedjd.js";
|
|
22
22
|
import {
|
|
23
23
|
node2
|
|
24
|
-
} from "./
|
|
24
|
+
} from "./process-kqr36gas.js";
|
|
25
25
|
import {
|
|
26
26
|
handlers2
|
|
27
|
-
} from "./
|
|
27
|
+
} from "./process-mx6chrwy.js";
|
|
28
28
|
import {
|
|
29
29
|
authorizationLayer2
|
|
30
|
-
} from "./
|
|
30
|
+
} from "./process-7b9xm1qg.js";
|
|
31
31
|
import {
|
|
32
32
|
schemaErrorLayer2
|
|
33
|
-
} from "./
|
|
33
|
+
} from "./process-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";
|
|
@@ -75,6 +75,7 @@ import { HttpRouter } from "effect/http";
|
|
|
75
75
|
import { HttpApiBuilder } from "effect/http-api";
|
|
76
76
|
import { Context, Effect, Layer, Option } from "effect";
|
|
77
77
|
var applicationServiceNodes = [
|
|
78
|
+
App.node,
|
|
78
79
|
Global.node,
|
|
79
80
|
FSUtil.node,
|
|
80
81
|
Database.node,
|
|
@@ -119,6 +120,7 @@ function makeRoutes(auth, options, serviceURLs, overrides, instances) {
|
|
|
119
120
|
Bus.node.replace(Bus.configured({ persist: options.events?.persist })),
|
|
120
121
|
App.node.replace(App.configured(options.app)),
|
|
121
122
|
ModelsDev.node.replace(ModelsDev.configured(options.models)),
|
|
123
|
+
httpFetch.replace(fetchLayer(options.fetch)),
|
|
122
124
|
Watcher.node.replace(Watcher.configured({ enabled: options.fs?.filewatcher })),
|
|
123
125
|
FileWatch.node.replace(FileWatch.configured({ enabled: options.fs?.filewatcher })),
|
|
124
126
|
FileSystemSearch.node.replace(FileSystemSearch.configured({ fff: options.fs?.fff })),
|
|
@@ -153,8 +155,8 @@ function makeRoutes(auth, options, serviceURLs, overrides, instances) {
|
|
|
153
155
|
})) : build(overrides);
|
|
154
156
|
return serviceLayer.pipe(Layer.flatMap((context) => {
|
|
155
157
|
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(
|
|
158
|
+
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));
|
|
159
|
+
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));
|
|
158
160
|
return Layer.merge(api, V1Migration.layer.pipe(Layer.provide(services)));
|
|
159
161
|
}));
|
|
160
162
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./process-r5696se6.js";
|
|
4
4
|
|
|
5
5
|
// src/handlers/worktree.ts
|
|
6
6
|
import { Git } from "@opencode/core/git";
|
|
@@ -27,7 +27,7 @@ function missingProject(error) {
|
|
|
27
27
|
}
|
|
28
28
|
function message(error) {
|
|
29
29
|
if (error instanceof Worktree.SourceDirectoryNotFoundError)
|
|
30
|
-
return error.directory ? `
|
|
30
|
+
return error.directory ? `Cannot create a worktree from ${error.directory}: it is not a checkout of this project that supports worktrees, such as a git repository` : `Worktree source not found for project: ${error.projectID}`;
|
|
31
31
|
if (error instanceof Worktree.DestinationExistsError)
|
|
32
32
|
return `Worktree destination already exists: ${error.directory}`;
|
|
33
33
|
if (error instanceof Worktree.DirectoryUnavailableError)
|