@opencode/server 0.0.0-dev-21881 → 0.0.0-dev-21903
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/{fetch-ez8kk7rt.js → api-0e4fm4yw.js} +1 -1
- package/dist/chunks/{fetch-j1p3e665.js → api-0pbbhyf6.js} +24 -6
- package/dist/chunks/{fetch-vdcre1n5.js → api-2835150m.js} +2 -2
- package/dist/chunks/{fetch-9ysy73xp.js → api-2x373xak.js} +2 -2
- package/dist/chunks/{fetch-e6e4kz0w.js → api-39nnfjx1.js} +4 -4
- package/dist/chunks/{fetch-yv9sxhn9.js → api-3mffapg0.js} +2 -2
- package/dist/chunks/{fetch-eajbg6ry.js → api-3whnvwbg.js} +4 -4
- package/dist/chunks/{fetch-w0jn068c.js → api-3yw6ah7d.js} +2 -2
- package/dist/chunks/{fetch-mhfbkkb7.js → api-4gk9fc6f.js} +2 -2
- package/dist/chunks/{fetch-9mfgjndz.js → api-50xc6x42.js} +3 -3
- package/dist/chunks/{fetch-82sqqxbn.js → api-5z5anmwp.js} +2 -2
- package/dist/chunks/{fetch-3aej5azy.js → api-74kxthdf.js} +1 -1
- package/dist/chunks/{fetch-7b9xm1qg.js → api-7b9xm1qg.js} +1 -1
- package/dist/chunks/{fetch-vdtx70fv.js → api-7cd61xtm.js} +2 -2
- package/dist/chunks/{fetch-3te71694.js → api-7dtbad8d.js} +7 -7
- package/dist/chunks/{fetch-gsqctp76.js → api-7x1re4zg.js} +2 -2
- package/dist/chunks/{fetch-5ynbgcax.js → api-8qyt6kbr.js} +19 -16
- package/dist/chunks/{fetch-0r0edp62.js → api-cgzc922k.js} +6 -6
- package/dist/chunks/{fetch-dnwg64ce.js → api-dnwg64ce.js} +1 -1
- package/dist/chunks/{fetch-mk2mz66m.js → api-f4exzdsf.js} +4 -2
- package/dist/chunks/{fetch-4gnb9897.js → api-gk0yxcp6.js} +5 -3
- package/dist/chunks/{fetch-50bbk3b2.js → api-gqq6kfhc.js} +3 -3
- package/dist/chunks/{fetch-n60r5keb.js → api-hdwd22w5.js} +1 -1
- package/dist/chunks/{fetch-j4at0y5c.js → api-j4at0y5c.js} +1 -1
- package/dist/chunks/{fetch-kypj8v4s.js → api-jc2vwkyw.js} +2 -2
- package/dist/chunks/{fetch-ztnmeapk.js → api-m3t57gm1.js} +4 -4
- package/dist/chunks/{fetch-rfdbtrd0.js → api-nhmzdcst.js} +3 -3
- package/dist/chunks/{fetch-rc3nk1bx.js → api-np6gr6g7.js} +2 -2
- package/dist/chunks/{fetch-rwnm9zvw.js → api-q0cx51af.js} +10 -8
- package/dist/chunks/{fetch-4w75v92x.js → api-qfvz5xpd.js} +2 -2
- package/dist/chunks/{fetch-q8n44kky.js → api-r5696se6.js} +3 -3
- package/dist/chunks/{fetch-v4mq5ya7.js → api-rwp3459r.js} +3 -3
- package/dist/chunks/{fetch-6ypp9np2.js → api-rxyx8sa0.js} +2 -2
- package/dist/chunks/{fetch-eaxk76q8.js → api-skcryrty.js} +2 -2
- package/dist/chunks/{fetch-zy1yk0n2.js → api-vfkjeyp3.js} +1 -1
- package/dist/chunks/{fetch-gx9nwmym.js → api-vtfzy3at.js} +4 -2
- package/dist/chunks/{fetch-vbanrv0z.js → api-vvp99hc9.js} +1 -1
- package/dist/chunks/{fetch-ka1fmf42.js → api-w1nd6x62.js} +33 -33
- package/dist/chunks/{fetch-mzs0n5xz.js → api-w9jcwh65.js} +7 -7
- package/dist/chunks/{fetch-krpsczf8.js → api-xbqm7mpj.js} +2 -2
- package/dist/chunks/{fetch-0cppk2bc.js → api-xckd9f88.js} +2 -2
- package/dist/chunks/{fetch-mahm5rvs.js → api-xpg37vzc.js} +2 -2
- package/dist/chunks/{fetch-b3bmdkga.js → api-yet0vexm.js} +1 -1
- package/dist/chunks/{fetch-k8rzy6d4.js → api-zmgfywqd.js} +1 -1
- package/dist/chunks/{fetch-7b00qdf6.js → api-zyntahe8.js} +1 -1
- package/dist/cors.js +1 -1
- package/dist/event-feed.js +1 -1
- 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.d.ts +2 -1
- 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/message.js +6 -6
- 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 +8 -8
- 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 +6 -6
- 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 +44 -44
- package/dist/location.js +4 -4
- 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/pairing.js +3 -3
- package/dist/process.js +52 -52
- package/dist/request-tracing.js +1 -1
- package/dist/routes.d.ts +3 -2
- package/dist/routes.js +47 -47
- package/dist/server-info.js +5 -5
- package/dist/service-status.js +3 -3
- package/dist/workerd.js +51 -51
- package/package.json +8 -8
- /package/dist/chunks/{fetch-9rqn6x4v.js → api-9rqn6x4v.js} +0 -0
- /package/dist/chunks/{fetch-erzfdgke.js → api-erzfdgke.js} +0 -0
- /package/dist/chunks/{fetch-h6rt5k9s.js → api-h6rt5k9s.js} +0 -0
- /package/dist/chunks/{fetch-q4bn6dy8.js → api-q4bn6dy8.js} +0 -0
- /package/dist/chunks/{fetch-smaf4a18.js → api-smaf4a18.js} +0 -0
- /package/dist/chunks/{fetch-yc7nft6q.js → api-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/api-r5696se6.js";
|
|
4
|
+
import"./chunks/api-gk0yxcp6.js";
|
|
5
|
+
import"./chunks/api-yet0vexm.js";
|
|
6
|
+
import"./chunks/api-gqq6kfhc.js";
|
|
7
|
+
import"./chunks/api-smaf4a18.js";
|
|
8
8
|
export {
|
|
9
9
|
Api2 as Api
|
|
10
10
|
};
|
package/dist/auth.js
CHANGED
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./api-gqq6kfhc.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./api-r5696se6.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/fs.ts
|
|
9
9
|
import { FileSystem } from "@opencode/core/filesystem";
|
|
10
|
+
import { FileWatch } from "@opencode/core/filesystem/file-watch";
|
|
11
|
+
import { Location } from "@opencode/core/location";
|
|
10
12
|
import { RelativePath } from "@opencode/core/schema";
|
|
11
|
-
import { FileNotFoundError } from "@opencode/protocol/errors";
|
|
13
|
+
import { FileNotFoundError, ServiceUnavailableError } from "@opencode/protocol/errors";
|
|
12
14
|
import { Effect, Option, Stream } from "effect";
|
|
13
15
|
import { HttpServerResponse } from "effect/http";
|
|
14
16
|
import { HttpApiBuilder } from "effect/http-api";
|
|
17
|
+
import path from "path";
|
|
15
18
|
var FileSystemHandler2 = HttpApiBuilder.group(Api2, "server.fs", (handlers) => Effect.gen(function* () {
|
|
19
|
+
const fileWatch = yield* FileWatch.Service;
|
|
16
20
|
return handlers.handleRaw("fs.read", (ctx) => Effect.gen(function* () {
|
|
17
|
-
const
|
|
21
|
+
const path2 = yield* decodeRequestPath(ctx.request.url);
|
|
18
22
|
const fs = yield* FileSystem.Service;
|
|
19
|
-
const file = yield* fs.read({ path }).pipe(Effect.mapError((error) => new FileNotFoundError({ path: error.path, message: `File not found: ${error.path}` })));
|
|
23
|
+
const file = yield* fs.read({ path: path2 }).pipe(Effect.mapError((error) => new FileNotFoundError({ path: error.path, message: `File not found: ${error.path}` })));
|
|
20
24
|
return serveFile(ctx.request, file);
|
|
21
25
|
})).handle("fs.list", (ctx) => response2(Effect.gen(function* () {
|
|
22
26
|
const fs = yield* FileSystem.Service;
|
|
@@ -27,7 +31,21 @@ var FileSystemHandler2 = HttpApiBuilder.group(Api2, "server.fs", (handlers) => E
|
|
|
27
31
|
}))).handle("fs.write", (ctx) => response2(Effect.gen(function* () {
|
|
28
32
|
const fs = yield* FileSystem.Service;
|
|
29
33
|
return yield* fs.write({ path: ctx.query.path, data: ctx.payload });
|
|
30
|
-
})))
|
|
34
|
+
}))).handle("fs.watch", (ctx) => Effect.gen(function* () {
|
|
35
|
+
const fs = yield* FileSystem.Service;
|
|
36
|
+
const location = yield* Location.Service;
|
|
37
|
+
yield* fs.read({ path: RelativePath.make(ctx.payload.path) }).pipe(Effect.mapError((error) => new FileNotFoundError({ path: error.path, message: `File not found: ${error.path}` })));
|
|
38
|
+
yield* fileWatch.watch({
|
|
39
|
+
location: { directory: location.directory, workspaceID: location.workspaceID },
|
|
40
|
+
file: path.resolve(location.directory, ctx.payload.path)
|
|
41
|
+
}).pipe(Effect.mapError((error) => new ServiceUnavailableError({ message: error.message, service: "filewatcher" })));
|
|
42
|
+
})).handle("fs.unwatch", (ctx) => Effect.gen(function* () {
|
|
43
|
+
const location = yield* Location.Service;
|
|
44
|
+
yield* fileWatch.unwatch({
|
|
45
|
+
location: { directory: location.directory, workspaceID: location.workspaceID },
|
|
46
|
+
file: path.resolve(location.directory, ctx.payload.path)
|
|
47
|
+
});
|
|
48
|
+
}));
|
|
31
49
|
}));
|
|
32
50
|
function decodeRequestPath(url) {
|
|
33
51
|
const raw = new URL(url, "http://localhost").pathname.slice(13);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
locationErrors2,
|
|
3
3
|
awaitPlugins2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./api-gqq6kfhc.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./api-r5696se6.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/voice.ts
|
|
10
10
|
import { Location } from "@opencode/core/location";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__export
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./api-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: () => make2
|
|
10
10
|
});
|
|
11
11
|
import { Effect, Ref } from "effect";
|
|
12
|
-
var
|
|
12
|
+
var make2 = 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 make3 = Effect.fnUntraced(function* (options = {}) {
|
|
|
20
20
|
};
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
export {
|
|
23
|
+
export { make2, exports_service_status };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
awaitPlugins2,
|
|
3
3
|
response2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./api-gqq6kfhc.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./api-r5696se6.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/model.ts
|
|
10
10
|
import { Model } from "@opencode/core/model";
|
|
@@ -2,17 +2,17 @@ import {
|
|
|
2
2
|
locationErrors2,
|
|
3
3
|
response2,
|
|
4
4
|
requestRef2
|
|
5
|
-
} from "./
|
|
5
|
+
} from "./api-gqq6kfhc.js";
|
|
6
6
|
import {
|
|
7
7
|
Api2
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./api-r5696se6.js";
|
|
9
9
|
import {
|
|
10
10
|
CorsConfig2,
|
|
11
11
|
isAllowedRequestOrigin2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./api-q4bn6dy8.js";
|
|
13
13
|
import {
|
|
14
14
|
runPtySocket2
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./api-h6rt5k9s.js";
|
|
16
16
|
|
|
17
17
|
// src/handlers/mcp.ts
|
|
18
18
|
import { Location } from "@opencode/core/location";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
locationErrors2,
|
|
3
3
|
awaitPlugins2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./api-gqq6kfhc.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./api-r5696se6.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/generate.ts
|
|
10
10
|
import { Generate } from "@opencode/core/generate";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
missingSession2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./api-smaf4a18.js";
|
|
4
4
|
import {
|
|
5
5
|
locationErrors2,
|
|
6
6
|
response2,
|
|
7
7
|
sessionInfo2
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./api-gqq6kfhc.js";
|
|
9
9
|
import {
|
|
10
10
|
Api2
|
|
11
|
-
} from "./
|
|
11
|
+
} from "./api-r5696se6.js";
|
|
12
12
|
|
|
13
13
|
// src/handlers/permission.ts
|
|
14
14
|
import { Instance } from "@opencode/core/instance/service";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
awaitPlugins2,
|
|
3
3
|
response2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./api-gqq6kfhc.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./api-r5696se6.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/usage.ts
|
|
10
10
|
import { UsageLimits } from "@opencode/core/usage-limits";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
awaitPlugins2,
|
|
3
3
|
response2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./api-gqq6kfhc.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./api-r5696se6.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/websearch.ts
|
|
10
10
|
import { WebSearch } from "@opencode/core/websearch";
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__export
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./api-9rqn6x4v.js";
|
|
4
4
|
|
|
5
5
|
// src/server-info.ts
|
|
6
6
|
var exports_server_info = {};
|
|
7
7
|
__export(exports_server_info, {
|
|
8
8
|
ServerInfo: () => exports_server_info,
|
|
9
|
-
Service: () =>
|
|
9
|
+
Service: () => Service4,
|
|
10
10
|
connectionURLs: () => connectionURLs2,
|
|
11
|
-
layer: () =>
|
|
11
|
+
layer: () => layer4
|
|
12
12
|
});
|
|
13
13
|
import { Context, Layer } from "effect";
|
|
14
14
|
import { networkInterfaces } from "node:os";
|
|
15
15
|
|
|
16
|
-
class
|
|
16
|
+
class Service4 extends Context.Service()("@opencode/server/ServerInfo") {
|
|
17
17
|
}
|
|
18
|
-
function
|
|
19
|
-
return Layer.succeed(
|
|
18
|
+
function layer4(urls, tmp, app = {}) {
|
|
19
|
+
return Layer.succeed(Service4, Service4.of({ urls, app, paths: { tmp } }));
|
|
20
20
|
}
|
|
21
21
|
function connectionURLs2(value, requestedHostname) {
|
|
22
22
|
const url = new URL(value);
|
|
@@ -38,4 +38,4 @@ function connectionURLs2(value, requestedHostname) {
|
|
|
38
38
|
];
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
export {
|
|
41
|
+
export { Service4, layer4, connectionURLs2, exports_server_info };
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./
|
|
2
|
+
layer3
|
|
3
|
+
} from "./api-gqq6kfhc.js";
|
|
4
4
|
import {
|
|
5
5
|
formLocationLayer2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./api-gk0yxcp6.js";
|
|
7
7
|
import {
|
|
8
8
|
sessionLocationLayer2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./api-yet0vexm.js";
|
|
10
10
|
import {
|
|
11
11
|
Api2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./api-r5696se6.js";
|
|
13
13
|
import {
|
|
14
14
|
Config2
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./api-j4at0y5c.js";
|
|
16
16
|
import {
|
|
17
17
|
CorsConfig2
|
|
18
|
-
} from "./
|
|
18
|
+
} from "./api-q4bn6dy8.js";
|
|
19
19
|
import {
|
|
20
|
-
|
|
21
|
-
} from "./
|
|
20
|
+
layer4
|
|
21
|
+
} from "./api-7dtbad8d.js";
|
|
22
22
|
import {
|
|
23
23
|
node2
|
|
24
|
-
} from "./
|
|
24
|
+
} from "./api-w9jcwh65.js";
|
|
25
25
|
import {
|
|
26
26
|
handlers2
|
|
27
|
-
} from "./
|
|
27
|
+
} from "./api-w1nd6x62.js";
|
|
28
28
|
import {
|
|
29
29
|
authorizationLayer2
|
|
30
|
-
} from "./
|
|
30
|
+
} from "./api-7b9xm1qg.js";
|
|
31
31
|
import {
|
|
32
32
|
schemaErrorLayer2
|
|
33
|
-
} from "./
|
|
33
|
+
} from "./api-erzfdgke.js";
|
|
34
34
|
|
|
35
35
|
// src/routes.ts
|
|
36
36
|
import { Database } from "@opencode/core/database/database";
|
|
@@ -68,6 +68,7 @@ import { SdkPlugins } from "@opencode/core/plugin/sdk";
|
|
|
68
68
|
import { WellKnown } from "@opencode/core/wellknown";
|
|
69
69
|
import { Workspace } from "@opencode/core/workspace";
|
|
70
70
|
import { Watcher } from "@opencode/core/filesystem/watcher";
|
|
71
|
+
import { FileWatch } from "@opencode/core/filesystem/file-watch";
|
|
71
72
|
import { HttpRouter } from "effect/http";
|
|
72
73
|
import { HttpApiBuilder } from "effect/http-api";
|
|
73
74
|
import { Context, Effect, Layer, Option } from "effect";
|
|
@@ -97,7 +98,8 @@ var applicationServiceNodes = [
|
|
|
97
98
|
LocationServiceMap.node,
|
|
98
99
|
LocationActivity.node,
|
|
99
100
|
SessionRestart.node,
|
|
100
|
-
Workspace.node
|
|
101
|
+
Workspace.node,
|
|
102
|
+
FileWatch.node
|
|
101
103
|
];
|
|
102
104
|
var applicationServices = LayerNode.group(applicationServiceNodes);
|
|
103
105
|
function createRoutes2(options = {}, serviceURLs = () => [], overrides = []) {
|
|
@@ -114,6 +116,7 @@ function makeRoutes(auth, options, serviceURLs, overrides, instances) {
|
|
|
114
116
|
App.node.replace(App.configured(options.app)),
|
|
115
117
|
ModelsDev.node.replace(ModelsDev.configured(options.models)),
|
|
116
118
|
Watcher.node.replace(Watcher.configured({ enabled: options.fs?.filewatcher })),
|
|
119
|
+
FileWatch.node.replace(FileWatch.configured({ enabled: options.fs?.filewatcher })),
|
|
117
120
|
FileSystemSearch.node.replace(FileSystemSearch.configured({ fff: options.fs?.fff })),
|
|
118
121
|
Global.node.replace(Global.layerWith(options.config?.directory ? { config: options.config.directory } : {})),
|
|
119
122
|
Config.node.replace(Config.configured({
|
|
@@ -146,8 +149,8 @@ function makeRoutes(auth, options, serviceURLs, overrides, instances) {
|
|
|
146
149
|
})) : build(overrides);
|
|
147
150
|
return serviceLayer.pipe(Layer.flatMap((context) => {
|
|
148
151
|
const services = Layer.succeedContext(context);
|
|
149
|
-
const requestServices = Layer.merge(Layer.succeedContext(Context.pick(Database.Service, Credential.Service, PermissionSaved.Service, PluginUpdate.Service, Project.Service, WellKnown.Service)(context)),
|
|
150
|
-
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(
|
|
152
|
+
const requestServices = Layer.merge(Layer.succeedContext(Context.pick(Database.Service, Credential.Service, PermissionSaved.Service, PluginUpdate.Service, Project.Service, WellKnown.Service)(context)), layer4(serviceURLs, Context.get(context, Global.Service).tmp, options.app));
|
|
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));
|
|
151
154
|
return Layer.merge(api, V1Migration.layer.pipe(Layer.provide(services)));
|
|
152
155
|
}));
|
|
153
156
|
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isAllowedCorsOrigin2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./api-q4bn6dy8.js";
|
|
4
4
|
import {
|
|
5
5
|
createRoutes2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./api-8qyt6kbr.js";
|
|
7
7
|
import {
|
|
8
8
|
__export
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./api-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,9 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
+
awaitPlugins2,
|
|
2
3
|
response2
|
|
3
|
-
} from "./
|
|
4
|
+
} from "./api-gqq6kfhc.js";
|
|
4
5
|
import {
|
|
5
6
|
Api2
|
|
6
|
-
} from "./
|
|
7
|
+
} from "./api-r5696se6.js";
|
|
7
8
|
|
|
8
9
|
// src/handlers/agent.ts
|
|
9
10
|
import { Agent } from "@opencode/core/agent";
|
|
@@ -11,6 +12,7 @@ import { Effect } from "effect";
|
|
|
11
12
|
import { HttpApiBuilder } from "effect/http-api";
|
|
12
13
|
import { AgentNotFoundError } from "@opencode/protocol/errors";
|
|
13
14
|
var AgentHandler2 = HttpApiBuilder.group(Api2, "server.agent", (handlers) => handlers.handle("agent.list", () => Effect.gen(function* () {
|
|
15
|
+
yield* awaitPlugins2;
|
|
14
16
|
return yield* response2(Agent.Service.use((agent) => agent.list()));
|
|
15
17
|
})).handle("agent.get", Effect.fn(function* (ctx) {
|
|
16
18
|
const agent = yield* Agent.Service.use((service) => service.get(ctx.params.agentID));
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
locationErrors2,
|
|
3
3
|
sessionInfo2,
|
|
4
4
|
requestRef2
|
|
5
|
-
} from "./
|
|
5
|
+
} from "./api-gqq6kfhc.js";
|
|
6
6
|
|
|
7
7
|
// src/middleware/form-location.ts
|
|
8
8
|
import { Instance } from "@opencode/core/instance/service";
|
|
@@ -10,7 +10,7 @@ import { LocationServiceMap } from "@opencode/core/location-services";
|
|
|
10
10
|
import { Session } from "@opencode/core/session";
|
|
11
11
|
import { LocationNotFoundError, InvalidRequestError, SessionNotFoundError } from "@opencode/protocol/errors";
|
|
12
12
|
import { Effect, Layer } from "effect";
|
|
13
|
-
import { HttpRouter, HttpServerRequest } from "effect/http";
|
|
13
|
+
import { HttpRouter, HttpServerRequest, HttpServerResponse } from "effect/http";
|
|
14
14
|
import { HttpApiMiddleware } from "effect/http-api";
|
|
15
15
|
class FormLocationMiddleware2 extends HttpApiMiddleware.Service()("@opencode/HttpApiFormLocation", {
|
|
16
16
|
error: [InvalidRequestError, SessionNotFoundError, LocationNotFoundError]
|
|
@@ -20,13 +20,15 @@ var formLocationLayer2 = Layer.effect(FormLocationMiddleware2, Effect.gen(functi
|
|
|
20
20
|
const sessions = yield* Session.Service;
|
|
21
21
|
const instances = yield* Instance.Service;
|
|
22
22
|
const locations = yield* LocationServiceMap.Service;
|
|
23
|
-
return FormLocationMiddleware2.of((effect) => Effect.gen(function* () {
|
|
23
|
+
return FormLocationMiddleware2.of((effect, options) => Effect.gen(function* () {
|
|
24
24
|
const route = yield* HttpRouter.RouteContext;
|
|
25
25
|
if (route.params.sessionID === "global") {
|
|
26
26
|
const request = yield* HttpServerRequest.HttpServerRequest;
|
|
27
27
|
return yield* effect.pipe(Effect.provide(locations.get(requestRef2(request))), locationErrors2);
|
|
28
28
|
}
|
|
29
29
|
const session = yield* sessionInfo2(sessions, route.params.sessionID);
|
|
30
|
+
if (options.endpoint.identifier === "session.form.list" && instances.live && !(yield* instances.live(session)))
|
|
31
|
+
return HttpServerResponse.jsonUnsafe({ data: [] });
|
|
30
32
|
return yield* effect.pipe(instances.provide(session), locationErrors2);
|
|
31
33
|
}));
|
|
32
34
|
}));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
missingSession2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./api-smaf4a18.js";
|
|
4
4
|
|
|
5
5
|
// src/location.ts
|
|
6
6
|
import { FileSystem } from "@opencode/core/filesystem";
|
|
@@ -59,7 +59,7 @@ function decode(input) {
|
|
|
59
59
|
return input;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
var
|
|
62
|
+
var layer3 = Layer.effect(LocationMiddleware2, Effect.gen(function* () {
|
|
63
63
|
const locations = yield* LocationServiceMap.Service;
|
|
64
64
|
return LocationMiddleware2.of((effect) => Effect.gen(function* () {
|
|
65
65
|
const request = yield* HttpServerRequest.HttpServerRequest;
|
|
@@ -67,4 +67,4 @@ var layer4 = Layer.effect(LocationMiddleware2, Effect.gen(function* () {
|
|
|
67
67
|
}));
|
|
68
68
|
}));
|
|
69
69
|
|
|
70
|
-
export { LocationMiddleware2, locationErrors2, awaitPlugins2, response2, sessionInfo2, requestRef2,
|
|
70
|
+
export { LocationMiddleware2, locationErrors2, awaitPlugins2, response2, sessionInfo2, requestRef2, layer3 };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
requestRef2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./api-gqq6kfhc.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./api-r5696se6.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/debug.ts
|
|
9
9
|
import { LocationServiceMap } from "@opencode/core/location-service-map";
|
|
@@ -2,17 +2,17 @@ import {
|
|
|
2
2
|
locationErrors2,
|
|
3
3
|
response2,
|
|
4
4
|
requestRef2
|
|
5
|
-
} from "./
|
|
5
|
+
} from "./api-gqq6kfhc.js";
|
|
6
6
|
import {
|
|
7
7
|
Api2
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./api-r5696se6.js";
|
|
9
9
|
import {
|
|
10
10
|
CorsConfig2,
|
|
11
11
|
isAllowedRequestOrigin2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./api-q4bn6dy8.js";
|
|
13
13
|
import {
|
|
14
14
|
runPtySocket2
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./api-h6rt5k9s.js";
|
|
16
16
|
|
|
17
17
|
// src/handlers/pty.ts
|
|
18
18
|
import { Pty } from "@opencode/core/pty";
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
missingMessage2,
|
|
4
4
|
failedMessageDecode2,
|
|
5
5
|
failedSnapshot2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./api-smaf4a18.js";
|
|
7
7
|
import {
|
|
8
8
|
locationErrors2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./api-gqq6kfhc.js";
|
|
10
10
|
import {
|
|
11
11
|
Api2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./api-r5696se6.js";
|
|
13
13
|
|
|
14
14
|
// src/handlers/session.ts
|
|
15
15
|
import { Instance } from "@opencode/core/instance/service";
|