@opencode/server 2.4.1 → 2.4.2
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 +45 -1
- package/dist/api.js +5 -5
- package/dist/auth.js +1 -1
- package/dist/chunks/{workerd-0rzj25w4.js → range-017ycvbx.js} +1 -1
- package/dist/chunks/{workerd-86dz2n4m.js → range-0x6anvwr.js} +2 -2
- package/dist/chunks/{workerd-39nnfjx1.js → range-39nnfjx1.js} +1 -1
- package/dist/chunks/{workerd-b1x3j2e8.js → range-3rtm8r3z.js} +2 -2
- package/dist/chunks/{workerd-7dtbad8d.js → range-3te71694.js} +7 -7
- package/dist/chunks/{workerd-nkfbbfe7.js → range-5pef2nys.js} +4 -4
- package/dist/chunks/{workerd-hgrkvk6s.js → range-6pm6ek88.js} +1 -1
- package/dist/chunks/{workerd-20wvj9q6.js → range-78jk0pbb.js} +2 -2
- package/dist/chunks/{workerd-kffke7z4.js → range-79t5cra8.js} +14 -10
- package/dist/chunks/{workerd-7x6cg3xs.js → range-7zz6jxhb.js} +2 -2
- package/dist/chunks/{workerd-8sb6qqpn.js → range-8sb6qqpn.js} +1 -1
- package/dist/chunks/{workerd-4r2ye500.js → range-9agv2b4c.js} +2 -2
- package/dist/chunks/{workerd-qahj7606.js → range-aexh791j.js} +1 -1
- package/dist/chunks/{workerd-zrptb2x8.js → range-amxj52x5.js} +2 -2
- package/dist/chunks/{workerd-s8t5gq7c.js → range-ay32z58n.js} +3 -3
- package/dist/chunks/{workerd-pv4dnzzq.js → range-b3sk57wg.js} +1 -1
- package/dist/chunks/{workerd-b7yt2ykh.js → range-c6kzfg4f.js} +2 -2
- package/dist/chunks/{workerd-w13ad1dk.js → range-cddawxec.js} +3 -3
- package/dist/chunks/{workerd-djr0jy89.js → range-djr0jy89.js} +1 -1
- package/dist/chunks/range-dnyhqccw.js +27 -0
- package/dist/chunks/{workerd-d0advawr.js → range-f93zkajm.js} +2 -2
- package/dist/chunks/{workerd-g23ffrnz.js → range-g23ffrnz.js} +2 -2
- package/dist/chunks/{workerd-wh07bcjv.js → range-gwtm9cga.js} +1 -1
- package/dist/chunks/{workerd-v0z8pce5.js → range-heqw7kpr.js} +2 -2
- package/dist/chunks/{workerd-6t6fd9bq.js → range-hgd5b6k8.js} +2 -2
- package/dist/chunks/{workerd-j4at0y5c.js → range-j4at0y5c.js} +1 -1
- package/dist/chunks/{workerd-8mfdzabk.js → range-jrjpfy36.js} +2 -2
- package/dist/chunks/{workerd-n6ypjnhz.js → range-jy2ammbg.js} +1 -1
- package/dist/chunks/{workerd-g97h7k0s.js → range-k2bx5n4e.js} +1 -1
- package/dist/chunks/{workerd-t8azv5ge.js → range-k518ftvz.js} +2 -2
- package/dist/chunks/{workerd-edwk6ehd.js → range-k58xpxwn.js} +1 -1
- package/dist/chunks/{workerd-w9jcwh65.js → range-kqr36gas.js} +7 -7
- package/dist/chunks/{workerd-8n1ypg70.js → range-mjhh6jvz.js} +3 -3
- package/dist/chunks/{workerd-myqk22k5.js → range-myqk22k5.js} +2 -2
- package/dist/chunks/{workerd-77gnb026.js → range-n8nthg9q.js} +4 -4
- package/dist/chunks/{workerd-b87bs0cf.js → range-pa4xtt5h.js} +2 -2
- package/dist/chunks/range-qpnw2qd1.js +58 -0
- package/dist/chunks/{workerd-rktygpea.js → range-rktygpea.js} +1 -1
- package/dist/chunks/{workerd-k26h7zjg.js → range-rn83nvae.js} +2 -2
- package/dist/chunks/{workerd-smaf4a18.js → range-rqgv9x42.js} +6 -2
- package/dist/chunks/{workerd-5dgtfnrn.js → range-s3d15g1k.js} +23 -17
- package/dist/chunks/{workerd-vxy32kc1.js → range-s557cdqw.js} +14 -4
- package/dist/chunks/{workerd-73tyf2qy.js → range-s6q3ch5r.js} +8 -8
- package/dist/chunks/{workerd-t62b1gmw.js → range-sqfq92mf.js} +2 -2
- package/dist/chunks/{workerd-j80tzjj3.js → range-stx1bw5w.js} +3 -3
- package/dist/chunks/{workerd-t32e1bbt.js → range-t32e1bbt.js} +1 -1
- package/dist/chunks/{workerd-g80pvn6e.js → range-tmb89r25.js} +2 -2
- package/dist/chunks/{workerd-jpqse2v9.js → range-tmbyzr8c.js} +35 -35
- package/dist/chunks/{workerd-4gbck4qg.js → range-vkj8vbyf.js} +2 -2
- package/dist/chunks/{workerd-p9wp66hf.js → range-vnpm7f9y.js} +1 -1
- package/dist/chunks/{workerd-3rn5pzng.js → range-wa6vk4hf.js} +14 -9
- package/dist/chunks/{workerd-bvm82fhd.js → range-wazndna9.js} +4 -4
- package/dist/chunks/{workerd-fvpjvjpp.js → range-wecgp61r.js} +7 -7
- package/dist/chunks/{workerd-7ydfwv45.js → range-x2qy7jg1.js} +1 -1
- package/dist/chunks/{workerd-dqfyxmp4.js → range-zs3ssmns.js} +26 -21
- package/dist/chunks/{workerd-p4zkxzv7.js → range-zx60pg73.js} +1 -1
- package/dist/content-headers.js +1 -1
- package/dist/cors.js +1 -1
- package/dist/event-feed.js +5 -5
- package/dist/fetch.d.ts +57 -0
- package/dist/fetch.js +64 -61
- package/dist/handlers/agent.js +6 -6
- package/dist/handlers/artifact.js +3 -3
- 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.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.js +2 -2
- package/dist/handlers/location.js +6 -6
- package/dist/handlers/machine.js +1 -1
- 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 +17 -16
- 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/push.d.ts +28 -0
- package/dist/handlers/push.js +6 -0
- 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.d.ts +3 -1
- package/dist/handlers/session-error.js +4 -2
- 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 +54 -53
- package/dist/location.js +4 -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.d.ts +1 -1
- package/dist/pairing.js +3 -3
- package/dist/process.js +62 -61
- 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 +4 -2
- package/dist/routes.js +58 -57
- package/dist/server-info.js +5 -5
- package/dist/service-status.js +1 -1
- package/dist/workerd.d.ts +20 -6
- package/dist/workerd.js +87 -81
- package/package.json +9 -9
- package/dist/chunks/workerd-4apj6a8e.js +0 -13
- /package/dist/chunks/{workerd-9rqn6x4v.js → range-9rqn6x4v.js} +0 -0
- /package/dist/chunks/{workerd-bd8755ek.js → range-bd8755ek.js} +0 -0
- /package/dist/chunks/{workerd-n26yr6pw.js → range-n26yr6pw.js} +0 -0
- /package/dist/chunks/{workerd-q187pxxd.js → range-q187pxxd.js} +0 -0
- /package/dist/chunks/{workerd-q4bn6dy8.js → range-q4bn6dy8.js} +0 -0
- /package/dist/chunks/{workerd-xthc02cw.js → range-xthc02cw.js} +0 -0
- /package/dist/chunks/{workerd-yc7nft6q.js → range-yc7nft6q.js} +0 -0
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
missingSession2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./range-rqgv9x42.js";
|
|
4
4
|
import {
|
|
5
5
|
locationErrors2,
|
|
6
6
|
response2,
|
|
7
7
|
sessionInfo2
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./range-stx1bw5w.js";
|
|
9
9
|
import {
|
|
10
10
|
Api2
|
|
11
|
-
} from "./
|
|
11
|
+
} from "./range-ay32z58n.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
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./range-ay32z58n.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
5
|
+
Service4,
|
|
6
6
|
frame2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./range-wecgp61r.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/event.ts
|
|
10
10
|
import { Event } from "@opencode/schema/event";
|
|
@@ -12,7 +12,7 @@ import { Effect, Stream } from "effect";
|
|
|
12
12
|
import { HttpServerResponse } from "effect/http";
|
|
13
13
|
import { HttpApiBuilder } from "effect/http-api";
|
|
14
14
|
var EventHandler2 = HttpApiBuilder.group(Api2, "server.event", (handlers) => Effect.gen(function* () {
|
|
15
|
-
const feed = yield*
|
|
15
|
+
const feed = yield* Service4;
|
|
16
16
|
return handlers.handleRaw("event.subscribe", (ctx) => Effect.gen(function* () {
|
|
17
17
|
const connected = {
|
|
18
18
|
id: Event.ID.create(),
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// src/handlers/push.ts
|
|
2
|
+
import { Effect, Option } from "effect";
|
|
3
|
+
import { HttpApiSchema } from "effect/http-api";
|
|
4
|
+
import { PushList } from "@opencode/core/push/list";
|
|
5
|
+
import { InvalidRequestError, PushDeviceNotFoundError } from "@opencode/protocol/errors";
|
|
6
|
+
import { Session } from "@opencode/core/session";
|
|
7
|
+
var makePush2 = Effect.gen(function* () {
|
|
8
|
+
const list = yield* PushList.Service;
|
|
9
|
+
const sessions = yield* Session.Service;
|
|
10
|
+
const invalid = (error) => new InvalidRequestError({ message: error.reason });
|
|
11
|
+
const notFound = (error) => new PushDeviceNotFoundError({ deviceID: error.id, message: error.message });
|
|
12
|
+
const rejectSubagent = Effect.fnUntraced(function* (sessionID) {
|
|
13
|
+
const session = Option.getOrUndefined(yield* sessions.get(sessionID).pipe(Effect.option));
|
|
14
|
+
if (session?.parentID)
|
|
15
|
+
return yield* new InvalidRequestError({ message: "Set the bell on the top-level session, not on a subagent" });
|
|
16
|
+
});
|
|
17
|
+
return {
|
|
18
|
+
get: Effect.fn("PushHandler.get")(function* () {
|
|
19
|
+
return { data: yield* list.info() };
|
|
20
|
+
}),
|
|
21
|
+
register: Effect.fn("PushHandler.register")(function* (id, payload) {
|
|
22
|
+
return { data: yield* list.register(id, payload).pipe(Effect.mapError(invalid)) };
|
|
23
|
+
}),
|
|
24
|
+
remove: Effect.fn("PushHandler.remove")(function* (id) {
|
|
25
|
+
yield* list.remove(id);
|
|
26
|
+
return HttpApiSchema.NoContent.make();
|
|
27
|
+
}),
|
|
28
|
+
update: Effect.fn("PushHandler.update")(function* (id, payload) {
|
|
29
|
+
return { data: yield* list.update(id, payload).pipe(Effect.mapError(notFound)) };
|
|
30
|
+
}),
|
|
31
|
+
setDeviceBell: Effect.fn("PushHandler.setDeviceBell")(function* (id, sessionID, bell) {
|
|
32
|
+
yield* rejectSubagent(sessionID);
|
|
33
|
+
return {
|
|
34
|
+
data: yield* list.setDeviceBell(id, sessionID, bell).pipe(Effect.catchTags({
|
|
35
|
+
"PushList.InvalidError": (error) => Effect.fail(invalid(error)),
|
|
36
|
+
"PushList.NotFoundError": (error) => Effect.fail(notFound(error))
|
|
37
|
+
}))
|
|
38
|
+
};
|
|
39
|
+
}),
|
|
40
|
+
removeDeviceBell: Effect.fn("PushHandler.removeDeviceBell")(function* (id, sessionID) {
|
|
41
|
+
yield* list.removeDeviceBell(id, sessionID).pipe(Effect.mapError(notFound));
|
|
42
|
+
return HttpApiSchema.NoContent.make();
|
|
43
|
+
}),
|
|
44
|
+
setSessionBell: Effect.fn("PushHandler.setSessionBell")(function* (sessionID, bell) {
|
|
45
|
+
yield* rejectSubagent(sessionID);
|
|
46
|
+
return { data: yield* list.setSessionBell(sessionID, bell).pipe(Effect.mapError(invalid)) };
|
|
47
|
+
}),
|
|
48
|
+
removeSessionBell: Effect.fn("PushHandler.removeSessionBell")(function* (sessionID) {
|
|
49
|
+
yield* list.removeSessionBell(sessionID);
|
|
50
|
+
return HttpApiSchema.NoContent.make();
|
|
51
|
+
}),
|
|
52
|
+
setSettings: Effect.fn("PushHandler.setSettings")(function* (settings) {
|
|
53
|
+
return { data: yield* list.setSettings(settings).pipe(Effect.mapError(invalid)) };
|
|
54
|
+
})
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
export { makePush2 };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// src/handlers/session-error.ts
|
|
2
|
-
import {
|
|
2
|
+
import { Skill } from "@opencode/core/skill";
|
|
3
|
+
import { MessageNotFoundError, SessionNotFoundError, SkillLoadError, UnknownError } from "@opencode/protocol/errors";
|
|
3
4
|
import { Effect } from "effect";
|
|
4
5
|
function missingSession2(error) {
|
|
5
6
|
return new SessionNotFoundError({
|
|
@@ -7,6 +8,9 @@ function missingSession2(error) {
|
|
|
7
8
|
message: `Session not found: ${error.sessionID}`
|
|
8
9
|
});
|
|
9
10
|
}
|
|
11
|
+
function skillLoadFailed2(error) {
|
|
12
|
+
return new SkillLoadError({ skill: Skill.ID.make(error.skill), message: error.message });
|
|
13
|
+
}
|
|
10
14
|
function missingMessage2(error) {
|
|
11
15
|
return new MessageNotFoundError({
|
|
12
16
|
sessionID: error.sessionID,
|
|
@@ -25,4 +29,4 @@ function failedSnapshot2(operation, sessionID) {
|
|
|
25
29
|
};
|
|
26
30
|
}
|
|
27
31
|
|
|
28
|
-
export { missingSession2, missingMessage2, failedMessageDecode2, failedSnapshot2 };
|
|
32
|
+
export { missingSession2, skillLoadFailed2, missingMessage2, failedMessageDecode2, failedSnapshot2 };
|
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "./
|
|
2
|
+
layer2
|
|
3
|
+
} from "./range-stx1bw5w.js";
|
|
4
4
|
import {
|
|
5
5
|
formLocationLayer2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./range-jy2ammbg.js";
|
|
7
7
|
import {
|
|
8
8
|
sessionLocationLayer2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./range-aexh791j.js";
|
|
10
10
|
import {
|
|
11
11
|
Api2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./range-ay32z58n.js";
|
|
13
13
|
import {
|
|
14
14
|
Config2
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./range-j4at0y5c.js";
|
|
16
16
|
import {
|
|
17
17
|
CorsConfig2
|
|
18
|
-
} from "./
|
|
18
|
+
} from "./range-q4bn6dy8.js";
|
|
19
19
|
import {
|
|
20
|
-
|
|
21
|
-
} from "./
|
|
20
|
+
layer3
|
|
21
|
+
} from "./range-3te71694.js";
|
|
22
22
|
import {
|
|
23
23
|
node2
|
|
24
|
-
} from "./
|
|
24
|
+
} from "./range-kqr36gas.js";
|
|
25
25
|
import {
|
|
26
26
|
handlers2
|
|
27
|
-
} from "./
|
|
27
|
+
} from "./range-tmbyzr8c.js";
|
|
28
28
|
import {
|
|
29
29
|
authorizationLayer2
|
|
30
|
-
} from "./
|
|
30
|
+
} from "./range-rktygpea.js";
|
|
31
31
|
import {
|
|
32
32
|
schemaErrorLayer2
|
|
33
|
-
} from "./
|
|
33
|
+
} from "./range-bd8755ek.js";
|
|
34
34
|
import {
|
|
35
35
|
defectResponseLayer2
|
|
36
|
-
} from "./
|
|
36
|
+
} from "./range-n26yr6pw.js";
|
|
37
37
|
|
|
38
38
|
// src/routes.ts
|
|
39
39
|
import { Database } from "@opencode/core/database/database";
|
|
@@ -78,6 +78,9 @@ import { Automation } from "@opencode/core/automation";
|
|
|
78
78
|
import { PluginUpdate } from "@opencode/core/plugin/update";
|
|
79
79
|
import { SdkPlugins } from "@opencode/core/plugin/sdk";
|
|
80
80
|
import { WellKnown } from "@opencode/core/wellknown";
|
|
81
|
+
import { PushList } from "@opencode/core/push/list";
|
|
82
|
+
import { PushSender } from "@opencode/core/push/sender";
|
|
83
|
+
import { PushWatcher } from "@opencode/core/push/watcher";
|
|
81
84
|
import { Workspace } from "@opencode/core/workspace";
|
|
82
85
|
import { Watcher } from "@opencode/core/filesystem/watcher";
|
|
83
86
|
import { FileWatch } from "@opencode/core/filesystem/file-watch";
|
|
@@ -122,7 +125,10 @@ var applicationServiceNodes = [
|
|
|
122
125
|
Workspace.node,
|
|
123
126
|
Machines.node,
|
|
124
127
|
Identity.node,
|
|
125
|
-
FileWatch.node
|
|
128
|
+
FileWatch.node,
|
|
129
|
+
PushList.node,
|
|
130
|
+
PushSender.node,
|
|
131
|
+
PushWatcher.node
|
|
126
132
|
];
|
|
127
133
|
var applicationServices = LayerNode.group(applicationServiceNodes);
|
|
128
134
|
function createRoutes2(options = {}, serviceURLs = () => [], overrides = []) {
|
|
@@ -192,8 +198,8 @@ function makeRoutes(password, options, serviceURLs, overrides, instances) {
|
|
|
192
198
|
})) : build(overrides);
|
|
193
199
|
return serviceLayer.pipe(Layer.flatMap((context) => {
|
|
194
200
|
const services = Layer.succeedContext(context);
|
|
195
|
-
const requestServices = Layer.merge(Layer.succeedContext(Context.pick(Database.Service, Credential.Service, PermissionSaved.Service, PluginUpdate.Service, Project.Service, WellKnown.Service)(context)),
|
|
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(
|
|
201
|
+
const requestServices = Layer.merge(Layer.succeedContext(Context.pick(Database.Service, Credential.Service, PermissionSaved.Service, PluginUpdate.Service, Project.Service, WellKnown.Service)(context)), layer3(serviceURLs, Context.get(context, Global.Service).tmp, options.app));
|
|
202
|
+
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(layer2), 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
203
|
internal = Context.get(context, HttpRouter.HttpRouter).asHttpEffect().pipe(HttpEffect.toWebHandlerWith(context));
|
|
198
204
|
})));
|
|
199
205
|
return Layer.merge(api, V1Migration.layer.pipe(Layer.provide(services)));
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./range-stx1bw5w.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./range-ay32z58n.js";
|
|
7
7
|
import {
|
|
8
8
|
download2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./range-t32e1bbt.js";
|
|
10
10
|
import {
|
|
11
11
|
parse2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./range-8sb6qqpn.js";
|
|
13
13
|
|
|
14
14
|
// src/handlers/fs.ts
|
|
15
|
+
import { Environment } from "@opencode/core/environment/index";
|
|
15
16
|
import { FileSystem } from "@opencode/core/filesystem";
|
|
16
17
|
import { FileWatch } from "@opencode/core/filesystem/file-watch";
|
|
17
18
|
import { Location } from "@opencode/core/location";
|
|
@@ -38,6 +39,12 @@ var FileSystemHandler2 = HttpApiBuilder.group(Api2, "server.fs", (handlers) => E
|
|
|
38
39
|
const fs = yield* FileSystem.Service;
|
|
39
40
|
return yield* fs.write({ path: ctx.query.path, data: ctx.payload });
|
|
40
41
|
}))).handle("fs.watch", (ctx) => Effect.gen(function* () {
|
|
42
|
+
const environment = yield* Environment.Service;
|
|
43
|
+
if (!environment.local)
|
|
44
|
+
return yield* new ServiceUnavailableError({
|
|
45
|
+
service: "filewatcher",
|
|
46
|
+
message: "File watching is not available for this location"
|
|
47
|
+
});
|
|
41
48
|
const fs = yield* FileSystem.Service;
|
|
42
49
|
const location = yield* Location.Service;
|
|
43
50
|
yield* fs.read({ path: RelativePath.make(ctx.payload.path) }).pipe(Effect.mapError((error) => new FileNotFoundError({ path: error.path, message: `File not found: ${error.path}` })));
|
|
@@ -46,6 +53,9 @@ var FileSystemHandler2 = HttpApiBuilder.group(Api2, "server.fs", (handlers) => E
|
|
|
46
53
|
file: path.resolve(location.directory, ctx.payload.path)
|
|
47
54
|
}).pipe(Effect.mapError((error) => new ServiceUnavailableError({ message: error.message, service: "filewatcher" })));
|
|
48
55
|
})).handle("fs.unwatch", (ctx) => Effect.gen(function* () {
|
|
56
|
+
const environment = yield* Environment.Service;
|
|
57
|
+
if (!environment.local)
|
|
58
|
+
return;
|
|
49
59
|
const location = yield* Location.Service;
|
|
50
60
|
yield* fileWatch.unwatch({
|
|
51
61
|
location: { directory: location.directory, workspaceID: location.workspaceID },
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./range-ay32z58n.js";
|
|
4
4
|
import {
|
|
5
5
|
SESSION_TTL_SECONDS2,
|
|
6
6
|
Config2,
|
|
7
7
|
issueSession2,
|
|
8
8
|
sessionCookieName2
|
|
9
|
-
} from "./
|
|
10
|
-
import {
|
|
11
|
-
Service4
|
|
12
|
-
} from "./workerd-7dtbad8d.js";
|
|
9
|
+
} from "./range-j4at0y5c.js";
|
|
13
10
|
import {
|
|
14
11
|
Service3
|
|
15
|
-
} from "./
|
|
12
|
+
} from "./range-3te71694.js";
|
|
13
|
+
import {
|
|
14
|
+
Service2
|
|
15
|
+
} from "./range-kqr36gas.js";
|
|
16
16
|
|
|
17
17
|
// src/handlers/server.ts
|
|
18
18
|
import { hostname } from "node:os";
|
|
@@ -22,10 +22,10 @@ import { HttpApiBuilder } from "effect/http-api";
|
|
|
22
22
|
import { PersistentPty } from "@opencode/core/persistent-pty";
|
|
23
23
|
import { UnauthorizedError } from "@opencode/protocol/errors";
|
|
24
24
|
var ServerHandler2 = HttpApiBuilder.group(Api2, "server.server", (handlers) => Effect.gen(function* () {
|
|
25
|
-
const pairing = yield*
|
|
25
|
+
const pairing = yield* Service2;
|
|
26
26
|
const auth = yield* Config2;
|
|
27
27
|
return handlers.handle("server.info", () => Effect.gen(function* () {
|
|
28
|
-
const info = yield*
|
|
28
|
+
const info = yield* Service3;
|
|
29
29
|
return {
|
|
30
30
|
version: info.app.version ?? "unknown",
|
|
31
31
|
pid: process.pid ?? 0,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
missingSession2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./range-rqgv9x42.js";
|
|
4
4
|
import {
|
|
5
5
|
locationErrors2,
|
|
6
6
|
response2,
|
|
7
7
|
requestRef2
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./range-stx1bw5w.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 "./range-rqgv9x42.js";
|
|
4
4
|
|
|
5
5
|
// src/location.ts
|
|
6
6
|
import { FileSystem } from "@opencode/core/filesystem";
|
|
@@ -51,7 +51,7 @@ function decode(input) {
|
|
|
51
51
|
return input;
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
var
|
|
54
|
+
var layer2 = Layer.effect(LocationMiddleware2, Effect.gen(function* () {
|
|
55
55
|
const locations = yield* LocationServiceMap.Service;
|
|
56
56
|
return LocationMiddleware2.of((effect) => Effect.gen(function* () {
|
|
57
57
|
const request = yield* HttpServerRequest.HttpServerRequest;
|
|
@@ -59,4 +59,4 @@ var layer3 = Layer.effect(LocationMiddleware2, Effect.gen(function* () {
|
|
|
59
59
|
}));
|
|
60
60
|
}));
|
|
61
61
|
|
|
62
|
-
export { LocationMiddleware2, locationErrors2, response2, sessionInfo2, requestRef2,
|
|
62
|
+
export { LocationMiddleware2, locationErrors2, response2, sessionInfo2, requestRef2, layer2 };
|
|
@@ -1,105 +1,105 @@
|
|
|
1
1
|
import {
|
|
2
2
|
GenerateHandler2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./range-jrjpfy36.js";
|
|
4
4
|
import {
|
|
5
5
|
VoiceHandler2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./range-heqw7kpr.js";
|
|
7
7
|
import {
|
|
8
8
|
MessageHandler2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./range-cddawxec.js";
|
|
10
10
|
import {
|
|
11
11
|
ModelHandler2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./range-f93zkajm.js";
|
|
13
13
|
import {
|
|
14
14
|
ProviderHandler2
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./range-hgd5b6k8.js";
|
|
16
16
|
import {
|
|
17
17
|
SessionHandler2
|
|
18
|
-
} from "./
|
|
18
|
+
} from "./range-zs3ssmns.js";
|
|
19
19
|
import {
|
|
20
20
|
PermissionHandler2
|
|
21
|
-
} from "./
|
|
21
|
+
} from "./range-mjhh6jvz.js";
|
|
22
22
|
import {
|
|
23
23
|
FileSystemHandler2
|
|
24
|
-
} from "./
|
|
24
|
+
} from "./range-s557cdqw.js";
|
|
25
25
|
import {
|
|
26
26
|
FormHandler2
|
|
27
|
-
} from "./
|
|
27
|
+
} from "./range-amxj52x5.js";
|
|
28
28
|
import {
|
|
29
29
|
CommandHandler2
|
|
30
|
-
} from "./
|
|
30
|
+
} from "./range-pa4xtt5h.js";
|
|
31
31
|
import {
|
|
32
32
|
SkillHandler2
|
|
33
|
-
} from "./
|
|
33
|
+
} from "./range-dnyhqccw.js";
|
|
34
34
|
import {
|
|
35
35
|
RpcHandler2
|
|
36
|
-
} from "./
|
|
36
|
+
} from "./range-zx60pg73.js";
|
|
37
37
|
import {
|
|
38
|
-
|
|
39
|
-
} from "./
|
|
38
|
+
layer4
|
|
39
|
+
} from "./range-wecgp61r.js";
|
|
40
40
|
import {
|
|
41
41
|
EventHandler2
|
|
42
|
-
} from "./
|
|
42
|
+
} from "./range-n8nthg9q.js";
|
|
43
43
|
import {
|
|
44
44
|
AgentHandler2
|
|
45
|
-
} from "./
|
|
45
|
+
} from "./range-rn83nvae.js";
|
|
46
46
|
import {
|
|
47
47
|
PluginHandler2
|
|
48
|
-
} from "./
|
|
48
|
+
} from "./range-78jk0pbb.js";
|
|
49
49
|
import {
|
|
50
50
|
ServerHandler2
|
|
51
|
-
} from "./
|
|
51
|
+
} from "./range-s6q3ch5r.js";
|
|
52
52
|
import {
|
|
53
53
|
DebugHandler2
|
|
54
|
-
} from "./
|
|
54
|
+
} from "./range-c6kzfg4f.js";
|
|
55
55
|
import {
|
|
56
56
|
PtyHandler2
|
|
57
|
-
} from "./
|
|
57
|
+
} from "./range-5pef2nys.js";
|
|
58
58
|
import {
|
|
59
59
|
PersistentPtyHandler2
|
|
60
|
-
} from "./
|
|
60
|
+
} from "./range-79t5cra8.js";
|
|
61
61
|
import {
|
|
62
62
|
ShellHandler2
|
|
63
|
-
} from "./
|
|
63
|
+
} from "./range-3rtm8r3z.js";
|
|
64
64
|
import {
|
|
65
65
|
ReferenceHandler2
|
|
66
|
-
} from "./
|
|
66
|
+
} from "./range-k518ftvz.js";
|
|
67
67
|
import {
|
|
68
68
|
LocationHandler2
|
|
69
|
-
} from "./
|
|
69
|
+
} from "./range-gwtm9cga.js";
|
|
70
70
|
import {
|
|
71
71
|
IntegrationHandler2
|
|
72
|
-
} from "./
|
|
72
|
+
} from "./range-9agv2b4c.js";
|
|
73
73
|
import {
|
|
74
74
|
WebSearchHandler2
|
|
75
|
-
} from "./
|
|
75
|
+
} from "./range-7zz6jxhb.js";
|
|
76
76
|
import {
|
|
77
77
|
UsageHandler2
|
|
78
|
-
} from "./
|
|
78
|
+
} from "./range-vkj8vbyf.js";
|
|
79
79
|
import {
|
|
80
80
|
McpHandler2
|
|
81
|
-
} from "./
|
|
81
|
+
} from "./range-wazndna9.js";
|
|
82
82
|
import {
|
|
83
83
|
CredentialHandler2
|
|
84
|
-
} from "./
|
|
84
|
+
} from "./range-0x6anvwr.js";
|
|
85
85
|
import {
|
|
86
86
|
ProjectHandler2
|
|
87
|
-
} from "./
|
|
87
|
+
} from "./range-k58xpxwn.js";
|
|
88
88
|
import {
|
|
89
89
|
WorktreeHandler2
|
|
90
|
-
} from "./
|
|
90
|
+
} from "./range-vnpm7f9y.js";
|
|
91
91
|
import {
|
|
92
92
|
VcsHandler2
|
|
93
|
-
} from "./
|
|
93
|
+
} from "./range-tmb89r25.js";
|
|
94
94
|
import {
|
|
95
95
|
MigrationHandler2
|
|
96
|
-
} from "./
|
|
96
|
+
} from "./range-b3sk57wg.js";
|
|
97
97
|
import {
|
|
98
98
|
ConfigHandler2
|
|
99
|
-
} from "./
|
|
99
|
+
} from "./range-k2bx5n4e.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 };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./range-stx1bw5w.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./range-ay32z58n.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/usage.ts
|
|
9
9
|
import { UsageLimits } from "@opencode/core/usage-limits";
|
|
@@ -1,32 +1,37 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isAllowedCorsOrigin2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./range-q4bn6dy8.js";
|
|
4
4
|
import {
|
|
5
5
|
middleware2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./range-myqk22k5.js";
|
|
7
7
|
import {
|
|
8
8
|
withoutParentSpan2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./range-yc7nft6q.js";
|
|
10
10
|
import {
|
|
11
11
|
createRoutes2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./range-s3d15g1k.js";
|
|
13
13
|
import {
|
|
14
14
|
__export
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./range-9rqn6x4v.js";
|
|
16
16
|
|
|
17
17
|
// src/fetch.ts
|
|
18
18
|
var exports_fetch = {};
|
|
19
19
|
__export(exports_fetch, {
|
|
20
20
|
ServerFetch: () => exports_fetch,
|
|
21
|
-
make: () => make3
|
|
21
|
+
make: () => make3,
|
|
22
|
+
makeWithContext: () => makeWithContext2
|
|
22
23
|
});
|
|
23
24
|
import { Context, Effect, Layer } from "effect";
|
|
24
25
|
import { HttpEffect, HttpMiddleware, HttpRouter, HttpServer } from "effect/http";
|
|
25
26
|
import { SessionRestart } from "@opencode/core/session/execution/restart";
|
|
26
|
-
var
|
|
27
|
+
var makeWithContext2 = Effect.fn("ServerFetch.makeWithContext")(function* (options = {}, boot = {}) {
|
|
27
28
|
const context = yield* Layer.build(createRoutes2(options, () => [], boot.overrides ?? []).pipe(Layer.provide(HttpServer.layerServices))).pipe(withoutParentSpan2);
|
|
28
29
|
yield* Effect.forkDetach(Context.get(context, SessionRestart.Service).resumeSuspendedSessions);
|
|
29
|
-
|
|
30
|
+
const handler = Context.get(context, HttpRouter.HttpRouter).asHttpEffect().pipe(middleware2(options), HttpMiddleware.cors({ allowedOrigins: (origin) => isAllowedCorsOrigin2(origin, options), maxAge: 86400 }), HttpEffect.toWebHandlerWith(context));
|
|
31
|
+
return { handler, context };
|
|
32
|
+
});
|
|
33
|
+
var make3 = Effect.fn("ServerFetch.make")(function* (options = {}, boot = {}) {
|
|
34
|
+
return (yield* makeWithContext2(options, boot)).handler;
|
|
30
35
|
});
|
|
31
36
|
|
|
32
|
-
export { make3, exports_fetch };
|
|
37
|
+
export { makeWithContext2, make3, exports_fetch };
|
|
@@ -2,18 +2,18 @@ import {
|
|
|
2
2
|
locationErrors2,
|
|
3
3
|
response2,
|
|
4
4
|
requestRef2
|
|
5
|
-
} from "./
|
|
5
|
+
} from "./range-stx1bw5w.js";
|
|
6
6
|
import {
|
|
7
7
|
Api2
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./range-ay32z58n.js";
|
|
9
9
|
import {
|
|
10
10
|
CorsConfig2,
|
|
11
11
|
isAllowedRequestOrigin2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./range-q4bn6dy8.js";
|
|
13
13
|
import {
|
|
14
14
|
runPtySocket2,
|
|
15
15
|
holdLocation2
|
|
16
|
-
} from "./
|
|
16
|
+
} from "./range-q187pxxd.js";
|
|
17
17
|
|
|
18
18
|
// src/handlers/mcp.ts
|
|
19
19
|
import { Location } from "@opencode/core/location";
|