@opencode/server 2.3.2 → 2.4.0
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 +249 -1
- package/dist/api.js +5 -5
- package/dist/auth.js +1 -1
- package/dist/chunks/{media-uri-tbqv89f6.js → content-headers-0r476wkb.js} +5 -5
- package/dist/chunks/content-headers-0rzj25w4.js +194 -0
- package/dist/chunks/{media-uri-rha2aq18.js → content-headers-100nc7c0.js} +2 -5
- package/dist/chunks/{media-uri-wmep189j.js → content-headers-1r438we2.js} +4 -4
- package/dist/chunks/{media-uri-f559fakr.js → content-headers-2cm4dfcc.js} +2 -2
- package/dist/chunks/{media-uri-6z9pvq7p.js → content-headers-2dzr03as.js} +1 -1
- package/dist/chunks/{media-uri-1gwc8nvb.js → content-headers-2rb1ee6g.js} +3 -3
- package/dist/chunks/{media-uri-39nnfjx1.js → content-headers-39nnfjx1.js} +1 -1
- package/dist/chunks/{media-uri-8mj7kvhm.js → content-headers-4fc68szf.js} +2 -2
- package/dist/chunks/{media-uri-a8jcac9a.js → content-headers-4zkx9wb3.js} +1 -1
- package/dist/chunks/{media-uri-4q6e7fh8.js → content-headers-5jm9kajg.js} +2 -2
- package/dist/chunks/{media-uri-cmnrxx36.js → content-headers-7jm4dc4a.js} +2 -2
- package/dist/chunks/{media-uri-p86kew8c.js → content-headers-7qpea5x7.js} +2 -2
- package/dist/chunks/{media-uri-78rcgzsr.js → content-headers-7ydfwv45.js} +4 -1
- package/dist/chunks/{media-uri-qd0r787n.js → content-headers-801prsqk.js} +2 -2
- package/dist/chunks/{media-uri-kkdkqt8j.js → content-headers-8ja97vv6.js} +2 -4
- package/dist/chunks/{media-uri-8sb6qqpn.js → content-headers-8sb6qqpn.js} +1 -1
- package/dist/chunks/{media-uri-9cd3a4b8.js → content-headers-9cd3a4b8.js} +1 -1
- package/dist/chunks/{media-uri-yk755swr.js → content-headers-9t07vtvz.js} +5 -4
- package/dist/chunks/{media-uri-htyf2qs7.js → content-headers-ah2sj2pr.js} +1 -1
- package/dist/chunks/{media-uri-1h6b4sc5.js → content-headers-b03d5rht.js} +6 -18
- package/dist/chunks/{media-uri-cezwbsk5.js → content-headers-d20xfnpc.js} +1 -1
- package/dist/chunks/{media-uri-n0chxnkn.js → content-headers-ddrpmftb.js} +4 -4
- package/dist/chunks/{media-uri-djr0jy89.js → content-headers-djr0jy89.js} +1 -1
- package/dist/chunks/{media-uri-sssj0qa5.js → content-headers-fjcqsaaz.js} +44 -17
- package/dist/chunks/{media-uri-cr5sd8bz.js → content-headers-g23ffrnz.js} +3 -3
- package/dist/chunks/{media-uri-btahnm2b.js → content-headers-gq4jwh93.js} +3 -3
- package/dist/chunks/{media-uri-z9zyd4qg.js → content-headers-hf3kgjhr.js} +4 -4
- package/dist/chunks/{media-uri-91858wp1.js → content-headers-hk9crnsa.js} +2 -2
- package/dist/chunks/{media-uri-myqk22k5.js → content-headers-hmwn16zp.js} +2 -2
- package/dist/chunks/{media-uri-b4rhnd07.js → content-headers-hnbeyfax.js} +15 -9
- package/dist/chunks/{media-uri-j4at0y5c.js → content-headers-j4at0y5c.js} +1 -1
- package/dist/chunks/{media-uri-6kawhtwy.js → content-headers-jhbndf2d.js} +4 -4
- package/dist/chunks/{media-uri-ny1j968n.js → content-headers-jmmhprac.js} +2 -2
- package/dist/chunks/{media-uri-ssxxka7j.js → content-headers-ky9xhfwk.js} +4 -4
- package/dist/chunks/{media-uri-3pb3n73h.js → content-headers-mvp6540g.js} +33 -33
- package/dist/chunks/{media-uri-mzs0n5xz.js → content-headers-mzs0n5xz.js} +1 -1
- package/dist/chunks/{media-uri-az0609r6.js → content-headers-p83m65n5.js} +2 -4
- package/dist/chunks/{media-uri-zcvan105.js → content-headers-prn0chz2.js} +1 -1
- package/dist/chunks/{media-uri-qfyg9gb7.js → content-headers-qfyg9gb7.js} +1 -1
- package/dist/chunks/{media-uri-2eaky32g.js → content-headers-r40v995e.js} +2 -2
- package/dist/chunks/{media-uri-7b9xm1qg.js → content-headers-rktygpea.js} +4 -1
- package/dist/chunks/{media-uri-5cpb32hf.js → content-headers-rmfb1myj.js} +1 -1
- package/dist/chunks/{media-uri-d0edqfxx.js → content-headers-s3zgwc17.js} +3 -6
- package/dist/chunks/{media-uri-t32e1bbt.js → content-headers-t32e1bbt.js} +1 -1
- package/dist/chunks/{media-uri-b3bmdkga.js → content-headers-vw0q3knq.js} +1 -1
- package/dist/chunks/{media-uri-rs3v36hp.js → content-headers-w3xmknp7.js} +2 -2
- package/dist/chunks/{media-uri-te8jwba1.js → content-headers-wka57cdm.js} +2 -2
- package/dist/chunks/{media-uri-qcg3sqtb.js → content-headers-y60jfeab.js} +2 -2
- package/dist/chunks/{media-uri-09kw3a77.js → content-headers-ykk3p1r3.js} +2 -2
- package/dist/chunks/{media-uri-enp1bp7r.js → content-headers-yty6dk04.js} +1 -1
- package/dist/chunks/{media-uri-50bbk3b2.js → content-headers-ywn523ee.js} +3 -11
- package/dist/chunks/{media-uri-z3e7v67k.js → content-headers-z3e7v67k.js} +1 -1
- package/dist/chunks/{media-uri-j87xz9bt.js → content-headers-zjmacp9c.js} +3 -3
- package/dist/content-headers.js +1 -1
- package/dist/cors.js +1 -1
- package/dist/event-feed.js +1 -1
- package/dist/fetch.js +60 -59
- package/dist/handlers/agent.js +6 -6
- package/dist/handlers/artifact.js +3 -3
- package/dist/handlers/automation.d.ts +1 -1
- package/dist/handlers/automation.js +2 -2
- package/dist/handlers/blob.js +3 -3
- package/dist/handlers/command.js +6 -6
- package/dist/handlers/config.js +6 -6
- package/dist/handlers/credential.d.ts +1 -1
- 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 +8 -8
- package/dist/handlers/generate.js +6 -6
- package/dist/handlers/integration.js +6 -6
- package/dist/handlers/job.d.ts +13 -1
- package/dist/handlers/job.js +2 -2
- package/dist/handlers/location.js +6 -6
- package/dist/handlers/machine.d.ts +95 -0
- package/dist/handlers/machine.js +18 -0
- package/dist/handlers/mcp.js +8 -8
- package/dist/handlers/media.js +2 -2
- 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 +16 -15
- 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.d.ts +1 -1
- package/dist/handlers.js +53 -52
- package/dist/location.d.ts +1 -3
- package/dist/location.js +2 -4
- package/dist/media-uri.js +1 -1
- package/dist/middleware/authorization.js +2 -2
- package/dist/middleware/defect-response.js +1 -1
- 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 +1 -1
- package/dist/process.js +72 -63
- package/dist/range.js +1 -1
- package/dist/request-site.js +2 -2
- package/dist/request-tracing.js +1 -1
- package/dist/routes.d.ts +6 -2
- package/dist/routes.js +57 -56
- package/dist/server-info.js +1 -1
- package/dist/service-status.js +1 -1
- package/dist/workerd.js +63 -60
- package/package.json +8 -8
- /package/dist/chunks/{media-uri-9rqn6x4v.js → content-headers-9rqn6x4v.js} +0 -0
- /package/dist/chunks/{media-uri-bd8755ek.js → content-headers-bd8755ek.js} +0 -0
- /package/dist/chunks/{media-uri-n26yr6pw.js → content-headers-n26yr6pw.js} +0 -0
- /package/dist/chunks/{media-uri-q187pxxd.js → content-headers-q187pxxd.js} +0 -0
- /package/dist/chunks/{media-uri-q4bn6dy8.js → content-headers-q4bn6dy8.js} +0 -0
- /package/dist/chunks/{media-uri-smaf4a18.js → content-headers-smaf4a18.js} +0 -0
- /package/dist/chunks/{media-uri-xthc02cw.js → content-headers-xthc02cw.js} +0 -0
- /package/dist/chunks/{media-uri-yc7nft6q.js → content-headers-yc7nft6q.js} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./content-headers-ywn523ee.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./content-headers-zjmacp9c.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/agent.ts
|
|
9
9
|
import { Agent } from "@opencode/core/agent";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./content-headers-ywn523ee.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./content-headers-zjmacp9c.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/command.ts
|
|
9
9
|
import { Command } from "@opencode/core/command";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./content-headers-zjmacp9c.js";
|
|
4
4
|
import {
|
|
5
5
|
Service3,
|
|
6
6
|
frame2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./content-headers-qfyg9gb7.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/event.ts
|
|
10
10
|
import { Event } from "@opencode/schema/event";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
missingSession2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./content-headers-smaf4a18.js";
|
|
4
4
|
import {
|
|
5
5
|
locationErrors2,
|
|
6
6
|
response2,
|
|
7
7
|
requestRef2
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./content-headers-ywn523ee.js";
|
|
9
9
|
|
|
10
10
|
// src/handlers/artifact.ts
|
|
11
11
|
import { Artifact } from "@opencode/core/artifact";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
missingSession2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./content-headers-smaf4a18.js";
|
|
4
4
|
|
|
5
5
|
// src/handlers/job.ts
|
|
6
6
|
import { Job } from "@opencode/core/job";
|
|
@@ -21,6 +21,9 @@ var makeJob2 = Effect.gen(function* () {
|
|
|
21
21
|
return {
|
|
22
22
|
data: yield* SessionBackground.list(jobs, lookup, query)
|
|
23
23
|
};
|
|
24
|
+
}),
|
|
25
|
+
cancel: Effect.fn("JobHandler.cancel")(function* (id) {
|
|
26
|
+
yield* jobs.cancel(id);
|
|
24
27
|
})
|
|
25
28
|
};
|
|
26
29
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./content-headers-ywn523ee.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./content-headers-zjmacp9c.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/shell.ts
|
|
9
9
|
import { Shell } from "@opencode/core/shell";
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
awaitPlugins2,
|
|
3
2
|
response2
|
|
4
|
-
} from "./
|
|
3
|
+
} from "./content-headers-ywn523ee.js";
|
|
5
4
|
import {
|
|
6
5
|
Api2
|
|
7
|
-
} from "./
|
|
6
|
+
} from "./content-headers-zjmacp9c.js";
|
|
8
7
|
|
|
9
8
|
// src/handlers/websearch.ts
|
|
10
9
|
import { WebSearch } from "@opencode/core/websearch";
|
|
@@ -16,7 +15,6 @@ var WebSearchHandler2 = HttpApiBuilder.group(Api2, "server.websearch", (handlers
|
|
|
16
15
|
const websearch = yield* WebSearch.Service;
|
|
17
16
|
return yield* response2(websearch.providers());
|
|
18
17
|
})).handle("websearch.query", Effect.fn("server.websearch.query")(function* (request) {
|
|
19
|
-
yield* awaitPlugins2;
|
|
20
18
|
const websearch = yield* WebSearch.Service;
|
|
21
19
|
return yield* response2(websearch.query(request.payload).pipe(Effect.catchTags({
|
|
22
20
|
"WebSearch.ProviderRequired": () => new InvalidRequestError({
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./content-headers-zjmacp9c.js";
|
|
4
4
|
import {
|
|
5
5
|
requireConnectable2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./content-headers-hk9crnsa.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/credential.ts
|
|
9
9
|
import { Credential } from "@opencode/core/credential";
|
|
10
10
|
import { FileSystem } from "@opencode/core/filesystem";
|
|
11
|
+
import { Integration } from "@opencode/core/integration";
|
|
11
12
|
import { Location } from "@opencode/core/location";
|
|
12
13
|
import { LocationServiceMap } from "@opencode/core/location-services";
|
|
13
14
|
import { AbsolutePath } from "@opencode/core/schema";
|
|
@@ -42,8 +43,8 @@ var CredentialHandler2 = HttpApiBuilder.group(Api2, "server.credential", (handle
|
|
|
42
43
|
yield* credential.activate(ctx.params.credentialID);
|
|
43
44
|
return HttpApiSchema.NoContent.make();
|
|
44
45
|
})).handle("credential.remove", Effect.fn(function* (ctx) {
|
|
45
|
-
const
|
|
46
|
-
yield*
|
|
46
|
+
const integrations = yield* Integration.Service.pipe(Effect.provide(services), Effect.orDie);
|
|
47
|
+
yield* integrations.connection.remove(ctx.params.credentialID);
|
|
47
48
|
return HttpApiSchema.NoContent.make();
|
|
48
49
|
}));
|
|
49
50
|
}));
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
|
-
locationErrors2
|
|
3
|
-
|
|
4
|
-
} from "./media-uri-50bbk3b2.js";
|
|
2
|
+
locationErrors2
|
|
3
|
+
} from "./content-headers-ywn523ee.js";
|
|
5
4
|
import {
|
|
6
5
|
Api2
|
|
7
|
-
} from "./
|
|
6
|
+
} from "./content-headers-zjmacp9c.js";
|
|
8
7
|
|
|
9
8
|
// src/handlers/generate.ts
|
|
10
|
-
import { Flag } from "@opencode/core/flag";
|
|
11
9
|
import { Generate } from "@opencode/core/generate";
|
|
12
10
|
import { VideoGeneration } from "@opencode/core/video-generation";
|
|
13
11
|
import { Location } from "@opencode/core/location";
|
|
14
12
|
import { LocationServiceMap } from "@opencode/core/location-services";
|
|
15
13
|
import { AbsolutePath } from "@opencode/core/schema";
|
|
16
14
|
import {
|
|
17
|
-
ForbiddenError,
|
|
18
15
|
VideoNotFoundError,
|
|
19
16
|
InvalidRequestError,
|
|
20
17
|
ModelNotFoundError,
|
|
@@ -31,12 +28,10 @@ var GenerateHandler2 = HttpApiBuilder.group(Api2, "server.generate", (handlers)
|
|
|
31
28
|
const videos = yield* VideoGeneration.Service;
|
|
32
29
|
const services = locations.get(Location.Ref.make({ directory: AbsolutePath.make(global.config) }));
|
|
33
30
|
const text = Effect.fn("server.generate.text")(function* (request) {
|
|
34
|
-
yield* awaitPlugins2;
|
|
35
31
|
const generate = yield* Generate.Service;
|
|
36
32
|
return { data: { text: yield* generate.text(request.payload).pipe(Effect.mapError(generateError)) } };
|
|
37
33
|
}, Effect.provide(services), locationErrors2);
|
|
38
34
|
const image = Effect.fn("server.generate.image")(function* (request) {
|
|
39
|
-
yield* awaitPlugins2;
|
|
40
35
|
const generate = yield* Generate.Service;
|
|
41
36
|
return { data: yield* generate.image(request.payload).pipe(Effect.mapError(generateError)) };
|
|
42
37
|
}, Effect.provide(services), locationErrors2);
|
|
@@ -47,22 +42,15 @@ var GenerateHandler2 = HttpApiBuilder.group(Api2, "server.generate", (handlers)
|
|
|
47
42
|
message: "Decision question names must be unique",
|
|
48
43
|
field: "questions"
|
|
49
44
|
});
|
|
50
|
-
yield* awaitPlugins2;
|
|
51
45
|
const generate = yield* Generate.Service;
|
|
52
46
|
return { data: yield* generate.decisions(request.payload).pipe(Effect.mapError(generateError)) };
|
|
53
47
|
}, Effect.provide(services), locationErrors2);
|
|
54
|
-
const videoEnabled = Effect.gen(function* () {
|
|
55
|
-
if (yield* Flag.enabled("video_generate"))
|
|
56
|
-
return;
|
|
57
|
-
return yield* new ForbiddenError({ message: "Video generation is disabled; enable experimental.video_generate" });
|
|
58
|
-
});
|
|
59
48
|
const videoCreate = Effect.fn("server.generate.video.create")(function* (request) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
49
|
+
return {
|
|
50
|
+
data: yield* videos.start(Generate.videoInput(request.payload)).pipe(Effect.mapError(generateError))
|
|
51
|
+
};
|
|
63
52
|
}, Effect.provide(services), locationErrors2);
|
|
64
53
|
const videoGet = Effect.fn("server.generate.video.get")(function* (request) {
|
|
65
|
-
yield* videoEnabled;
|
|
66
54
|
const job = yield* videos.get(request.params.id).pipe(Effect.mapError((error) => new VideoNotFoundError({ videoID: error.id, message: error.message })));
|
|
67
55
|
return { data: job };
|
|
68
56
|
}, Effect.provide(services), locationErrors2);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./content-headers-ywn523ee.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./content-headers-zjmacp9c.js";
|
|
7
7
|
import {
|
|
8
8
|
download2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./content-headers-t32e1bbt.js";
|
|
10
10
|
import {
|
|
11
11
|
parse2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./content-headers-8sb6qqpn.js";
|
|
13
13
|
|
|
14
14
|
// src/handlers/fs.ts
|
|
15
15
|
import { FileSystem } from "@opencode/core/filesystem";
|
|
@@ -1,44 +1,45 @@
|
|
|
1
1
|
import {
|
|
2
2
|
layer4
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./content-headers-ywn523ee.js";
|
|
4
4
|
import {
|
|
5
5
|
formLocationLayer2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./content-headers-ah2sj2pr.js";
|
|
7
7
|
import {
|
|
8
8
|
sessionLocationLayer2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./content-headers-vw0q3knq.js";
|
|
10
10
|
import {
|
|
11
11
|
Api2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./content-headers-zjmacp9c.js";
|
|
13
13
|
import {
|
|
14
14
|
Config2
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./content-headers-j4at0y5c.js";
|
|
16
16
|
import {
|
|
17
17
|
CorsConfig2
|
|
18
|
-
} from "./
|
|
18
|
+
} from "./content-headers-q4bn6dy8.js";
|
|
19
19
|
import {
|
|
20
20
|
layer2
|
|
21
|
-
} from "./
|
|
21
|
+
} from "./content-headers-z3e7v67k.js";
|
|
22
22
|
import {
|
|
23
23
|
node2
|
|
24
|
-
} from "./
|
|
24
|
+
} from "./content-headers-mzs0n5xz.js";
|
|
25
25
|
import {
|
|
26
26
|
handlers2
|
|
27
|
-
} from "./
|
|
27
|
+
} from "./content-headers-mvp6540g.js";
|
|
28
28
|
import {
|
|
29
29
|
authorizationLayer2
|
|
30
|
-
} from "./
|
|
30
|
+
} from "./content-headers-rktygpea.js";
|
|
31
31
|
import {
|
|
32
32
|
schemaErrorLayer2
|
|
33
|
-
} from "./
|
|
33
|
+
} from "./content-headers-bd8755ek.js";
|
|
34
34
|
import {
|
|
35
35
|
defectResponseLayer2
|
|
36
|
-
} from "./
|
|
36
|
+
} from "./content-headers-n26yr6pw.js";
|
|
37
37
|
|
|
38
38
|
// src/routes.ts
|
|
39
39
|
import { Database } from "@opencode/core/database/database";
|
|
40
40
|
import { V1Migration } from "@opencode/core/database/v1-migration";
|
|
41
41
|
import { App } from "@opencode/core/app";
|
|
42
|
+
import { CodeModeApi } from "@opencode/core/codemode/api";
|
|
42
43
|
import { LayerNode } from "@opencode/util/effect/layer-node";
|
|
43
44
|
import { fetchLayer, httpClient, httpFetch } from "@opencode/util/effect/app-node-platform";
|
|
44
45
|
import { AppNodeBuilder } from "@opencode/core/effect/app-node-builder";
|
|
@@ -68,6 +69,9 @@ import { FSUtil } from "@opencode/util/fs-util";
|
|
|
68
69
|
import { InstructionDiscovery } from "@opencode/core/instruction-discovery";
|
|
69
70
|
import { LocationServiceMap } from "@opencode/core/location-service-map";
|
|
70
71
|
import { LocationActivity } from "@opencode/core/location-activity";
|
|
72
|
+
import { Identity } from "@opencode/core/machine/identity";
|
|
73
|
+
import { Machines } from "@opencode/core/machine/machines";
|
|
74
|
+
import { SessionSearchBuild } from "@opencode/core/session/search-build";
|
|
71
75
|
import { ModelsDev } from "@opencode/core/models-dev";
|
|
72
76
|
import { SessionRestart } from "@opencode/core/session/execution/restart";
|
|
73
77
|
import { Automation } from "@opencode/core/automation";
|
|
@@ -77,11 +81,13 @@ import { WellKnown } from "@opencode/core/wellknown";
|
|
|
77
81
|
import { Workspace } from "@opencode/core/workspace";
|
|
78
82
|
import { Watcher } from "@opencode/core/filesystem/watcher";
|
|
79
83
|
import { FileWatch } from "@opencode/core/filesystem/file-watch";
|
|
80
|
-
import { HttpRouter } from "effect/http";
|
|
84
|
+
import { HttpEffect, HttpRouter } from "effect/http";
|
|
81
85
|
import { HttpApiBuilder } from "effect/http-api";
|
|
82
86
|
import { Context, Effect, Layer, Option } from "effect";
|
|
87
|
+
import { Base64 } from "effect/encoding";
|
|
83
88
|
var applicationServiceNodes = [
|
|
84
89
|
App.node,
|
|
90
|
+
CodeModeApi.node,
|
|
85
91
|
Global.node,
|
|
86
92
|
FSUtil.node,
|
|
87
93
|
Database.node,
|
|
@@ -112,18 +118,37 @@ var applicationServiceNodes = [
|
|
|
112
118
|
Automation.node,
|
|
113
119
|
BlobStore.node,
|
|
114
120
|
VideoGeneration.node,
|
|
121
|
+
SessionSearchBuild.node,
|
|
115
122
|
Workspace.node,
|
|
123
|
+
Machines.node,
|
|
124
|
+
Identity.node,
|
|
116
125
|
FileWatch.node
|
|
117
126
|
];
|
|
118
127
|
var applicationServices = LayerNode.group(applicationServiceNodes);
|
|
119
128
|
function createRoutes2(options = {}, serviceURLs = () => [], overrides = []) {
|
|
120
|
-
return makeRoutes(options.password ?
|
|
129
|
+
return makeRoutes(options.password ? Option.some(options.password) : Option.none(), options, serviceURLs, overrides);
|
|
121
130
|
}
|
|
122
131
|
function createEmbeddedRoutes2(options = {}, overrides = [], instances) {
|
|
123
|
-
return makeRoutes(
|
|
132
|
+
return makeRoutes(Option.none(), options, () => [], overrides, instances);
|
|
124
133
|
}
|
|
125
|
-
function makeRoutes(
|
|
134
|
+
function makeRoutes(password, options, serviceURLs, overrides, instances) {
|
|
135
|
+
const auth = Config2.configLayer({ password });
|
|
136
|
+
const credential = Option.map(password, (value) => `Basic ${Base64.encode(`opencode:${value}`)}`);
|
|
137
|
+
let internal;
|
|
126
138
|
const standard = [
|
|
139
|
+
CodeModeApi.node.replace(Layer.succeed(CodeModeApi.Service, CodeModeApi.Service.of({
|
|
140
|
+
fetch: (request) => Effect.suspend(() => {
|
|
141
|
+
const handle = internal;
|
|
142
|
+
if (!handle)
|
|
143
|
+
return Effect.fail(new Error("The OpenCode API is not ready yet."));
|
|
144
|
+
if (Option.isSome(credential))
|
|
145
|
+
request.headers.set("authorization", credential.value);
|
|
146
|
+
return Effect.tryPromise({
|
|
147
|
+
try: () => handle(request),
|
|
148
|
+
catch: (error) => error instanceof Error ? error : new Error(String(error))
|
|
149
|
+
});
|
|
150
|
+
})
|
|
151
|
+
}))),
|
|
127
152
|
Database.node.replace(Database.configured(options.database)),
|
|
128
153
|
PersistentPty.node.replace(PersistentPty.configured(options.pty)),
|
|
129
154
|
Bus.node.replace(Bus.configured({ persist: options.events?.persist })),
|
|
@@ -168,7 +193,9 @@ function makeRoutes(auth, options, serviceURLs, overrides, instances) {
|
|
|
168
193
|
return serviceLayer.pipe(Layer.flatMap((context) => {
|
|
169
194
|
const services = Layer.succeedContext(context);
|
|
170
195
|
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));
|
|
171
|
-
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(layer4), Layer.provide(authorizationLayer2), Layer.provide(schemaErrorLayer2), Layer.provide(auth), HttpRouter.provideRequest(requestServices), Layer.merge(defectResponseLayer2), Layer.provideMerge(services), Layer.provideMerge(HttpRouter.layer))
|
|
196
|
+
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(layer4), Layer.provide(authorizationLayer2), Layer.provide(schemaErrorLayer2), Layer.provide(auth), HttpRouter.provideRequest(requestServices), Layer.merge(defectResponseLayer2), Layer.provideMerge(services), Layer.provideMerge(HttpRouter.layer), Layer.tap((context) => Effect.sync(() => {
|
|
197
|
+
internal = Context.get(context, HttpRouter.HttpRouter).asHttpEffect().pipe(HttpEffect.toWebHandlerWith(context));
|
|
198
|
+
})));
|
|
172
199
|
return Layer.merge(api, V1Migration.layer.pipe(Layer.provide(services)));
|
|
173
200
|
}));
|
|
174
201
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
download2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./content-headers-t32e1bbt.js";
|
|
4
4
|
import {
|
|
5
5
|
parse2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./content-headers-8sb6qqpn.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/blob.ts
|
|
9
9
|
import { BlobStore } from "@opencode/core/blob-store";
|
|
@@ -19,7 +19,7 @@ var makeBlobGet2 = Effect.gen(function* () {
|
|
|
19
19
|
const etag = `"${id}"`;
|
|
20
20
|
const headers = {
|
|
21
21
|
...download2({ mime: blob.mime }),
|
|
22
|
-
"cache-control": "private, max-age=
|
|
22
|
+
"cache-control": "private, max-age=31536000, immutable",
|
|
23
23
|
etag,
|
|
24
24
|
"accept-ranges": "bytes"
|
|
25
25
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
missingSession2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./content-headers-smaf4a18.js";
|
|
4
4
|
import {
|
|
5
5
|
locationErrors2,
|
|
6
6
|
response2,
|
|
7
7
|
sessionInfo2
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./content-headers-ywn523ee.js";
|
|
9
9
|
import {
|
|
10
10
|
Api2
|
|
11
|
-
} from "./
|
|
11
|
+
} from "./content-headers-zjmacp9c.js";
|
|
12
12
|
|
|
13
13
|
// src/handlers/permission.ts
|
|
14
14
|
import { Instance } from "@opencode/core/instance/service";
|
|
@@ -2,18 +2,18 @@ import {
|
|
|
2
2
|
locationErrors2,
|
|
3
3
|
response2,
|
|
4
4
|
requestRef2
|
|
5
|
-
} from "./
|
|
5
|
+
} from "./content-headers-ywn523ee.js";
|
|
6
6
|
import {
|
|
7
7
|
Api2
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./content-headers-zjmacp9c.js";
|
|
9
9
|
import {
|
|
10
10
|
CorsConfig2,
|
|
11
11
|
isAllowedRequestOrigin2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./content-headers-q4bn6dy8.js";
|
|
13
13
|
import {
|
|
14
14
|
runPtySocket2,
|
|
15
15
|
holdLocation2
|
|
16
|
-
} from "./
|
|
16
|
+
} from "./content-headers-q187pxxd.js";
|
|
17
17
|
|
|
18
18
|
// src/handlers/mcp.ts
|
|
19
19
|
import { Location } from "@opencode/core/location";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./content-headers-ywn523ee.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./content-headers-zjmacp9c.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/integration.ts
|
|
9
9
|
import { Integration } from "@opencode/core/integration";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isAllowedRequestOrigin2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./content-headers-q4bn6dy8.js";
|
|
4
4
|
import {
|
|
5
5
|
__export
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./content-headers-9rqn6x4v.js";
|
|
7
7
|
|
|
8
8
|
// src/request-site.ts
|
|
9
9
|
var exports_request_site = {};
|
|
@@ -1,28 +1,32 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./content-headers-zjmacp9c.js";
|
|
4
4
|
import {
|
|
5
5
|
CorsConfig2,
|
|
6
6
|
isAllowedRequestOrigin2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./content-headers-q4bn6dy8.js";
|
|
8
8
|
import {
|
|
9
9
|
makeArtifact2
|
|
10
|
-
} from "./
|
|
10
|
+
} from "./content-headers-7qpea5x7.js";
|
|
11
11
|
import {
|
|
12
12
|
makeBlobGet2
|
|
13
|
-
} from "./
|
|
13
|
+
} from "./content-headers-g23ffrnz.js";
|
|
14
14
|
import {
|
|
15
15
|
makeAutomation2
|
|
16
|
-
} from "./
|
|
16
|
+
} from "./content-headers-9cd3a4b8.js";
|
|
17
17
|
import {
|
|
18
18
|
makeJob2
|
|
19
|
-
} from "./
|
|
19
|
+
} from "./content-headers-7ydfwv45.js";
|
|
20
|
+
import {
|
|
21
|
+
makeMachineLink2,
|
|
22
|
+
makeMachine2
|
|
23
|
+
} from "./content-headers-0rzj25w4.js";
|
|
20
24
|
import {
|
|
21
25
|
makeMediaGet2
|
|
22
|
-
} from "./
|
|
26
|
+
} from "./content-headers-djr0jy89.js";
|
|
23
27
|
import {
|
|
24
28
|
runPtySocket2
|
|
25
|
-
} from "./
|
|
29
|
+
} from "./content-headers-q187pxxd.js";
|
|
26
30
|
|
|
27
31
|
// src/handlers/persistent-pty.ts
|
|
28
32
|
import { PersistentPty } from "@opencode/core/persistent-pty";
|
|
@@ -51,7 +55,9 @@ var PersistentPtyHandler2 = HttpApiBuilder.group(Api2, "server.experimental", (h
|
|
|
51
55
|
const mediaGet = yield* makeMediaGet2;
|
|
52
56
|
const blobGet = yield* makeBlobGet2;
|
|
53
57
|
const automation = yield* makeAutomation2;
|
|
54
|
-
|
|
58
|
+
const machine = yield* makeMachine2;
|
|
59
|
+
const machineLink = yield* makeMachineLink2;
|
|
60
|
+
return handlers.handleRaw("media.get", (ctx) => mediaGet(ctx.params.hash, ctx.request)).handleRaw("blob.get", (ctx) => blobGet(ctx.params.id, ctx.request)).handle("job.list", (ctx) => job.list(ctx.query)).handle("job.cancel", (ctx) => job.cancel(ctx.params.id)).handleRaw("machine.link", (ctx) => machineLink(ctx.request)).handle("machine.list", () => machine.list()).handle("machine.add", (ctx) => machine.add(ctx.payload)).handle("machine.remove", (ctx) => machine.remove(ctx.params.name)).handle("artifacts.providers", (ctx) => artifact.providers(ctx.query, ctx.request)).handle("artifacts.list", (ctx) => artifact.list(ctx.query, ctx.request)).handle("artifacts.create", (ctx) => artifact.create(ctx.query, ctx.payload, ctx.request)).handle("artifacts.get", (ctx) => artifact.get(ctx.params.artifactID, ctx.query, ctx.request)).handle("artifacts.update", (ctx) => artifact.update(ctx.params.artifactID, ctx.query, ctx.payload, ctx.request)).handle("artifacts.delete", (ctx) => artifact.remove(ctx.params.artifactID, ctx.query, ctx.request)).handleRaw("artifacts.view", (ctx) => artifact.view(ctx.params.artifactID, ctx.query, ctx.request)).handle("automation.create", (ctx) => automation.create(ctx.payload)).handle("automation.list", (ctx) => automation.list(ctx.query)).handle("automation.get", (ctx) => automation.get(ctx.params.automationID)).handle("automation.pause", (ctx) => automation.pause(ctx.params.automationID)).handle("automation.resume", (ctx) => automation.resume(ctx.params.automationID)).handle("automation.delete", (ctx) => automation.remove(ctx.params.automationID)).handle("persistentPty.read", Effect.fn(function* (ctx) {
|
|
55
61
|
return { data: yield* pty.read(ctx.params.sessionID, ctx.query.lines).pipe(mapUnavailable) };
|
|
56
62
|
})).handle("persistentPty.list", Effect.fn(function* (ctx) {
|
|
57
63
|
return { data: yield* pty.list(ctx.params.sessionID).pipe(mapUnavailable) };
|
|
@@ -2,18 +2,18 @@ import {
|
|
|
2
2
|
locationErrors2,
|
|
3
3
|
response2,
|
|
4
4
|
requestRef2
|
|
5
|
-
} from "./
|
|
5
|
+
} from "./content-headers-ywn523ee.js";
|
|
6
6
|
import {
|
|
7
7
|
Api2
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./content-headers-zjmacp9c.js";
|
|
9
9
|
import {
|
|
10
10
|
CorsConfig2,
|
|
11
11
|
isAllowedRequestOrigin2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./content-headers-q4bn6dy8.js";
|
|
13
13
|
import {
|
|
14
14
|
runPtySocket2,
|
|
15
15
|
holdLocation2
|
|
16
|
-
} from "./
|
|
16
|
+
} from "./content-headers-q187pxxd.js";
|
|
17
17
|
|
|
18
18
|
// src/handlers/pty.ts
|
|
19
19
|
import { Pty } from "@opencode/core/pty";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./content-headers-ywn523ee.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./content-headers-zjmacp9c.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/skill.ts
|
|
9
9
|
import { Skill } from "@opencode/core/skill";
|
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
missingMessage2,
|
|
4
4
|
failedMessageDecode2,
|
|
5
5
|
failedSnapshot2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./content-headers-smaf4a18.js";
|
|
7
7
|
import {
|
|
8
8
|
locationErrors2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./content-headers-ywn523ee.js";
|
|
10
10
|
import {
|
|
11
11
|
Api2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./content-headers-zjmacp9c.js";
|
|
13
13
|
import {
|
|
14
14
|
wantsMediaRefs2
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./content-headers-xthc02cw.js";
|
|
16
16
|
|
|
17
17
|
// src/handlers/session.ts
|
|
18
18
|
import { Instance } from "@opencode/core/instance/service";
|