@opencode/server 2.0.8 → 2.0.10
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 +4 -4
- package/dist/api.js +10 -9
- package/dist/auth.js +12 -17
- package/dist/chunks/auth-0ar9gf7q.js +55 -0
- package/dist/chunks/auth-0qzy9yxk.js +163 -0
- package/dist/chunks/auth-1wj0ectp.js +22 -0
- package/dist/chunks/auth-23w8t84j.js +26 -0
- package/dist/chunks/auth-34e6wr3b.js +13 -0
- package/dist/chunks/auth-3582t7j8.js +139 -0
- package/dist/chunks/auth-40g8rvw4.js +59 -0
- package/dist/chunks/auth-5p62ed52.js +36 -0
- package/dist/chunks/auth-6aya8ky6.js +39 -0
- package/dist/chunks/auth-760vtqy2.js +29 -0
- package/dist/chunks/auth-7bj707s9.js +99 -0
- package/dist/chunks/auth-7qtja2kq.js +15 -0
- package/dist/chunks/auth-8e21y1bd.js +20 -0
- package/dist/chunks/auth-8nbs1vvt.js +34 -0
- package/dist/chunks/auth-8ygjd1s8.js +40 -0
- package/dist/chunks/auth-9rqn6x4v.js +16 -0
- package/dist/chunks/auth-b4atwt7w.js +37 -0
- package/dist/chunks/auth-bgzrbsek.js +13 -0
- package/dist/chunks/auth-bkb1xk38.js +42 -0
- package/dist/chunks/auth-bkk2wfbz.js +23 -0
- package/dist/chunks/auth-byzd2nk7.js +21 -0
- package/dist/chunks/auth-cm8xmqjn.js +13 -0
- package/dist/chunks/auth-d2g7egyw.js +25 -0
- package/dist/chunks/auth-e09mshwt.js +23 -0
- package/dist/chunks/auth-erwrh284.js +156 -0
- package/dist/chunks/auth-frv6gfy7.js +33 -0
- package/dist/chunks/auth-fyjxk8m3.js +22 -0
- package/dist/chunks/auth-gsks0nj8.js +149 -0
- package/dist/chunks/auth-hezj1jdf.js +7 -0
- package/dist/chunks/auth-kv6ycdgm.js +77 -0
- package/dist/chunks/auth-m6wvgbfq.js +60 -0
- package/dist/chunks/auth-p5hgn93y.js +26 -0
- package/dist/chunks/auth-pd1pbg0v.js +17 -0
- package/dist/chunks/auth-q4bn6dy8.js +39 -0
- package/dist/chunks/auth-r4dhhtgz.js +346 -0
- package/dist/chunks/auth-rjpqaa8h.js +83 -0
- package/dist/chunks/auth-smaf4a18.js +28 -0
- package/dist/chunks/auth-t8yzmczr.js +18 -0
- package/dist/chunks/auth-tk6nqkmh.js +22 -0
- package/dist/chunks/auth-txhx6f1m.js +13 -0
- package/dist/chunks/auth-vgxn80m1.js +61 -0
- package/dist/chunks/auth-xpxp1sqb.js +22 -0
- package/dist/chunks/auth-xsrtpxyd.js +23 -0
- package/dist/chunks/auth-yc7nft6q.js +5 -0
- package/dist/chunks/auth-z3nth2hg.js +35 -0
- package/dist/chunks/auth-z6kg9h7e.js +19 -0
- package/dist/chunks/auth-zw9j8b8g.js +32 -0
- package/dist/chunks/auth-zxvt7wd3.js +25 -0
- package/dist/chunks/auth-zyv89x5n.js +30 -0
- package/dist/cors.js +10 -36
- package/dist/event-feed.js +20 -60
- package/dist/fetch.js +53 -11
- package/dist/handlers/agent.js +11 -17
- package/dist/handlers/command.js +11 -5
- package/dist/handlers/config.js +11 -16
- package/dist/handlers/credential.js +11 -14
- package/dist/handlers/debug.js +11 -11
- package/dist/handlers/event.js +12 -27
- package/dist/handlers/form.js +11 -9
- package/dist/handlers/fs.js +11 -22
- package/dist/handlers/generate.js +11 -15
- package/dist/handlers/integration.js +10 -142
- package/dist/handlers/location.js +11 -16
- package/dist/handlers/mcp.js +11 -31
- package/dist/handlers/message.js +10 -42
- package/dist/handlers/migration.js +11 -7
- package/dist/handlers/model.js +11 -14
- package/dist/handlers/permission.js +11 -57
- package/dist/handlers/persistent-pty.js +12 -135
- package/dist/handlers/plugin.js +11 -47
- package/dist/handlers/project.js +11 -9
- package/dist/handlers/provider.js +11 -20
- package/dist/handlers/pty-socket.js +6 -4
- package/dist/handlers/pty.js +13 -107
- package/dist/handlers/reference.js +11 -5
- package/dist/handlers/rpc.js +11 -15
- package/dist/handlers/server.js +12 -13
- package/dist/handlers/session-error.js +12 -26
- package/dist/handlers/session.js +10 -311
- package/dist/handlers/shell.js +11 -25
- package/dist/handlers/skill.js +11 -5
- package/dist/handlers/vcs.js +11 -19
- package/dist/handlers/websearch.js +11 -31
- package/dist/handlers/worktree.js +11 -37
- package/dist/handlers.d.ts +1 -1
- package/dist/handlers.js +46 -33
- package/dist/location.js +15 -49
- package/dist/middleware/authorization.js +11 -49
- package/dist/middleware/form-location.js +10 -25
- package/dist/middleware/schema-error.js +8 -15
- package/dist/middleware/session-location.js +10 -19
- package/dist/options.js +5 -1
- package/dist/process.js +108 -28
- package/dist/pty-environment.js +12 -9
- package/dist/request-tracing.js +6 -2
- package/dist/routes.d.ts +2 -2
- package/dist/routes.js +52 -118
- package/dist/server-info.js +12 -22
- package/dist/service-status.js +8 -11
- package/dist/workerd.js +80 -12
- package/package.json +8 -8
package/dist/handlers/skill.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
1
|
+
import {
|
|
2
|
+
SkillHandler2
|
|
3
|
+
} from "../chunks/auth-34e6wr3b.js";
|
|
4
|
+
import"../chunks/auth-z6kg9h7e.js";
|
|
5
|
+
import"../chunks/auth-23w8t84j.js";
|
|
6
|
+
import"../chunks/auth-frv6gfy7.js";
|
|
7
|
+
import"../chunks/auth-0ar9gf7q.js";
|
|
8
|
+
import"../chunks/auth-smaf4a18.js";
|
|
9
|
+
export {
|
|
10
|
+
SkillHandler2 as SkillHandler
|
|
11
|
+
};
|
package/dist/handlers/vcs.js
CHANGED
|
@@ -1,19 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}))).handle("vcs.status", () => response(Effect.gen(function* () {
|
|
13
|
-
return yield* (yield* Vcs.Service).status();
|
|
14
|
-
}))).handle("vcs.branch.list", (ctx) => response(Effect.gen(function* () {
|
|
15
|
-
return yield* (yield* Vcs.Service).branches({ search: ctx.query.search, limit: Math.min(ctx.query.limit ?? 50, 100) });
|
|
16
|
-
}))).handle("vcs.diff", (ctx) => response(Effect.gen(function* () {
|
|
17
|
-
return yield* (yield* Vcs.Service).diff(ctx.query.mode, { context: ctx.query.context, base: ctx.query.base }).pipe(Effect.mapError((error) => new ServiceUnavailableError({ service: "vcs", message: error.message })));
|
|
18
|
-
})));
|
|
19
|
-
}));
|
|
1
|
+
import {
|
|
2
|
+
VcsHandler2
|
|
3
|
+
} from "../chunks/auth-zw9j8b8g.js";
|
|
4
|
+
import"../chunks/auth-z6kg9h7e.js";
|
|
5
|
+
import"../chunks/auth-23w8t84j.js";
|
|
6
|
+
import"../chunks/auth-frv6gfy7.js";
|
|
7
|
+
import"../chunks/auth-0ar9gf7q.js";
|
|
8
|
+
import"../chunks/auth-smaf4a18.js";
|
|
9
|
+
export {
|
|
10
|
+
VcsHandler2 as VcsHandler
|
|
11
|
+
};
|
|
@@ -1,31 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const websearch = yield* WebSearch.Service;
|
|
13
|
-
return yield* response(websearch.query(request.payload).pipe(Effect.catchTags({
|
|
14
|
-
"WebSearch.ProviderRequired": () => new InvalidRequestError({
|
|
15
|
-
message: "Web search provider is required",
|
|
16
|
-
kind: "websearch_provider_required",
|
|
17
|
-
field: "providerID"
|
|
18
|
-
}),
|
|
19
|
-
"WebSearch.ProviderNotFound": (error) => new InvalidRequestError({
|
|
20
|
-
message: `Web search provider not found: ${error.providerID}`,
|
|
21
|
-
kind: "websearch_provider_not_found",
|
|
22
|
-
field: "providerID"
|
|
23
|
-
}),
|
|
24
|
-
"WebSearch.Disabled": () => new InvalidRequestError({ message: "Web search is disabled", kind: "websearch_disabled" }),
|
|
25
|
-
"WebSearch.Request": (error) => new ServiceUnavailableError({
|
|
26
|
-
message: `Web search request failed: ${error.providerID}`,
|
|
27
|
-
service: error.providerID
|
|
28
|
-
})
|
|
29
|
-
})));
|
|
30
|
-
}));
|
|
31
|
-
}));
|
|
1
|
+
import {
|
|
2
|
+
WebSearchHandler2
|
|
3
|
+
} from "../chunks/auth-6aya8ky6.js";
|
|
4
|
+
import"../chunks/auth-z6kg9h7e.js";
|
|
5
|
+
import"../chunks/auth-23w8t84j.js";
|
|
6
|
+
import"../chunks/auth-frv6gfy7.js";
|
|
7
|
+
import"../chunks/auth-0ar9gf7q.js";
|
|
8
|
+
import"../chunks/auth-smaf4a18.js";
|
|
9
|
+
export {
|
|
10
|
+
WebSearchHandler2 as WebSearchHandler
|
|
11
|
+
};
|
|
@@ -1,37 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}));
|
|
13
|
-
function badRequest(effect) {
|
|
14
|
-
return effect.pipe(Effect.catchTag("Project.NotFoundError", missingProject), Effect.mapError((error) => error instanceof ProjectNotFoundError ? error : new WorktreeError({
|
|
15
|
-
name: "WorktreeError",
|
|
16
|
-
data: {
|
|
17
|
-
message: message(error),
|
|
18
|
-
forceRequired: error instanceof Git.WorktreeError || error instanceof Worktree.OperationError ? error.forceRequired : void 0
|
|
19
|
-
}
|
|
20
|
-
})));
|
|
21
|
-
}
|
|
22
|
-
function missingProject(error) {
|
|
23
|
-
return Effect.fail(new ProjectNotFoundError({ projectID: error.projectID, message: `Project not found: ${error.projectID}` }));
|
|
24
|
-
}
|
|
25
|
-
function message(error) {
|
|
26
|
-
if (error instanceof Worktree.SourceDirectoryNotFoundError)
|
|
27
|
-
return error.directory ? `Worktree source not found: ${error.directory}` : `Worktree source not found for project: ${error.projectID}`;
|
|
28
|
-
if (error instanceof Worktree.DestinationExistsError)
|
|
29
|
-
return `Worktree destination already exists: ${error.directory}`;
|
|
30
|
-
if (error instanceof Worktree.DirectoryUnavailableError)
|
|
31
|
-
return `Worktree directory unavailable: ${error.directory}`;
|
|
32
|
-
if (error instanceof Worktree.InvalidDirectoryError)
|
|
33
|
-
return `Invalid worktree directory: ${error.directory}`;
|
|
34
|
-
if (error instanceof Worktree.StrategyUnavailableError)
|
|
35
|
-
return `Worktree strategy unavailable: ${error.strategy}`;
|
|
36
|
-
return error.message;
|
|
37
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
WorktreeHandler2
|
|
3
|
+
} from "../chunks/auth-bkb1xk38.js";
|
|
4
|
+
import"../chunks/auth-z6kg9h7e.js";
|
|
5
|
+
import"../chunks/auth-23w8t84j.js";
|
|
6
|
+
import"../chunks/auth-frv6gfy7.js";
|
|
7
|
+
import"../chunks/auth-0ar9gf7q.js";
|
|
8
|
+
import"../chunks/auth-smaf4a18.js";
|
|
9
|
+
export {
|
|
10
|
+
WorktreeHandler2 as WorktreeHandler
|
|
11
|
+
};
|
package/dist/handlers.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Layer } from "effect";
|
|
2
|
-
export declare const handlers: Layer.Layer<import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.generate"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.message"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.model"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.provider"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.session"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.permission"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.fs"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.form"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.command"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.skill"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.rpc"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.event"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.agent"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.plugin"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.server"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.debug"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.pty"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.experimental"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.shell"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.reference"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.location"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.integration"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.websearch"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.mcp"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.credential"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.project"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.worktree"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.vcs"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.migration"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.config">, never, import("@opencode/protocol/middleware/schema-error").SchemaErrorMiddleware | import("@opencode/protocol/middleware/authorization").Authorization | import("@opencode/util/global").Service | import("@opencode/core/bus").Service | import("@opencode/core/persistent-pty/index").Service | import("@opencode/core/location-service-map").Service | import("@opencode/core/session").Service | import("@opencode/core/
|
|
2
|
+
export declare const handlers: Layer.Layer<import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.generate"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.message"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.model"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.provider"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.session"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.permission"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.fs"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.form"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.command"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.skill"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.rpc"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.event"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.agent"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.plugin"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.server"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.debug"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.pty"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.experimental"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.shell"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.reference"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.location"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.integration"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.websearch"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.mcp"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.credential"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.project"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.worktree"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.vcs"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.migration"> | import("effect/unstable/httpapi/HttpApiGroup").Service<"server", "server.config">, never, import("@opencode/protocol/middleware/schema-error").SchemaErrorMiddleware | import("@opencode/protocol/middleware/authorization").Authorization | import("@opencode/util/global").Service | import("@opencode/core/bus").Service | import("@opencode/core/persistent-pty/index").Service | import("@opencode/core/location-service-map").Service | import("@opencode/core/session").Service | import("@opencode/core/worktree").Service | import("@opencode/core/instance").Service | import("./location").LocationMiddleware | import("./middleware/form-location").FormLocationMiddleware | import("./middleware/session-location").SessionLocationMiddleware | import("@opencode/core/pty/ticket").Service | import("@opencode/core/session/transfer").Service | import("effect/unstable/http/HttpRouter").Request<"Requires", import("@opencode/core/database/database").Service> | import("effect/unstable/http/HttpRouter").Request<"Requires", import("@opencode/core/permission/saved").Service> | import("effect/unstable/http/HttpRouter").Request<"Requires", import("@opencode/core/plugin/update").Service> | import("effect/unstable/http/HttpRouter").Request<"Requires", import("./server-info").Service> | import("./pty-environment").Service | import("effect/unstable/http/HttpRouter").Request<"Requires", import("@opencode/core/wellknown").Service> | import("effect/unstable/http/HttpRouter").Request<"Requires", import("@opencode/core/credential").Service> | import("effect/unstable/http/HttpRouter").Request<"Requires", import("@opencode/core/project").Service>>;
|
package/dist/handlers.js
CHANGED
|
@@ -1,33 +1,46 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
|
|
1
|
+
import {
|
|
2
|
+
handlers2
|
|
3
|
+
} from "./chunks/auth-7bj707s9.js";
|
|
4
|
+
import"./chunks/auth-pd1pbg0v.js";
|
|
5
|
+
import"./chunks/auth-tk6nqkmh.js";
|
|
6
|
+
import"./chunks/auth-8nbs1vvt.js";
|
|
7
|
+
import"./chunks/auth-cm8xmqjn.js";
|
|
8
|
+
import"./chunks/auth-1wj0ectp.js";
|
|
9
|
+
import"./chunks/auth-bkb1xk38.js";
|
|
10
|
+
import"./chunks/auth-z3nth2hg.js";
|
|
11
|
+
import"./chunks/auth-6aya8ky6.js";
|
|
12
|
+
import"./chunks/auth-d2g7egyw.js";
|
|
13
|
+
import"./chunks/auth-b4atwt7w.js";
|
|
14
|
+
import"./chunks/auth-0qzy9yxk.js";
|
|
15
|
+
import"./chunks/auth-zw9j8b8g.js";
|
|
16
|
+
import"./chunks/auth-byzd2nk7.js";
|
|
17
|
+
import"./chunks/auth-zxvt7wd3.js";
|
|
18
|
+
import"./chunks/auth-fyjxk8m3.js";
|
|
19
|
+
import"./chunks/auth-bgzrbsek.js";
|
|
20
|
+
import"./chunks/auth-8e21y1bd.js";
|
|
21
|
+
import"./chunks/auth-3582t7j8.js";
|
|
22
|
+
import"./chunks/auth-34e6wr3b.js";
|
|
23
|
+
import"./chunks/auth-erwrh284.js";
|
|
24
|
+
import"./chunks/auth-40g8rvw4.js";
|
|
25
|
+
import"./chunks/auth-e09mshwt.js";
|
|
26
|
+
import"./chunks/auth-txhx6f1m.js";
|
|
27
|
+
import"./chunks/auth-xpxp1sqb.js";
|
|
28
|
+
import"./chunks/auth-7qtja2kq.js";
|
|
29
|
+
import"./chunks/auth-vgxn80m1.js";
|
|
30
|
+
import"./chunks/auth-hezj1jdf.js";
|
|
31
|
+
import"./chunks/auth-760vtqy2.js";
|
|
32
|
+
import"./chunks/auth-r4dhhtgz.js";
|
|
33
|
+
import"./chunks/auth-8ygjd1s8.js";
|
|
34
|
+
import"./chunks/auth-kv6ycdgm.js";
|
|
35
|
+
import"./chunks/auth-bkk2wfbz.js";
|
|
36
|
+
import"./chunks/auth-q4bn6dy8.js";
|
|
37
|
+
import"./chunks/auth-rjpqaa8h.js";
|
|
38
|
+
import"./chunks/auth-5p62ed52.js";
|
|
39
|
+
import"./chunks/auth-z6kg9h7e.js";
|
|
40
|
+
import"./chunks/auth-23w8t84j.js";
|
|
41
|
+
import"./chunks/auth-frv6gfy7.js";
|
|
42
|
+
import"./chunks/auth-0ar9gf7q.js";
|
|
43
|
+
import"./chunks/auth-smaf4a18.js";
|
|
44
|
+
export {
|
|
45
|
+
handlers2 as handlers
|
|
46
|
+
};
|
package/dist/location.js
CHANGED
|
@@ -1,49 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return {
|
|
17
|
-
location: new Location.Info({
|
|
18
|
-
directory: location.directory,
|
|
19
|
-
project: location.project
|
|
20
|
-
}),
|
|
21
|
-
data: yield* data
|
|
22
|
-
};
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
const decodeSessionID = Schema.decodeUnknownEffect(Session.ID);
|
|
26
|
-
export const sessionInfo = Effect.fnUntraced(function* (sessions, sessionID) {
|
|
27
|
-
const id = yield* decodeSessionID(sessionID).pipe(Effect.mapError(() => new InvalidRequestError({ message: "Invalid session ID", field: "sessionID" })));
|
|
28
|
-
return yield* sessions.get(id).pipe(Effect.catchTag("Session.NotFoundError", missingSession));
|
|
29
|
-
});
|
|
30
|
-
export function requestRef(request) {
|
|
31
|
-
const directory = new URL(request.url, "http://localhost").searchParams.get("location[directory]") || (request.headers["x-opencode-directory"] ? decode(request.headers["x-opencode-directory"]) : process.cwd());
|
|
32
|
-
return Location.Ref.make({
|
|
33
|
-
directory: AbsolutePath.make(directory)
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
function decode(input) {
|
|
37
|
-
try {
|
|
38
|
-
return decodeURIComponent(input);
|
|
39
|
-
} catch {
|
|
40
|
-
return input;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
export const layer = Layer.effect(LocationMiddleware, Effect.gen(function* () {
|
|
44
|
-
const locations = yield* LocationServiceMap.Service;
|
|
45
|
-
return LocationMiddleware.of((effect) => Effect.gen(function* () {
|
|
46
|
-
const request = yield* HttpServerRequest.HttpServerRequest;
|
|
47
|
-
return yield* effect.pipe(Effect.provide(locations.get(requestRef(request))));
|
|
48
|
-
}));
|
|
49
|
-
}));
|
|
1
|
+
import {
|
|
2
|
+
LocationMiddleware2,
|
|
3
|
+
response2,
|
|
4
|
+
sessionInfo2,
|
|
5
|
+
requestRef2,
|
|
6
|
+
layer5
|
|
7
|
+
} from "./chunks/auth-0ar9gf7q.js";
|
|
8
|
+
import"./chunks/auth-smaf4a18.js";
|
|
9
|
+
export {
|
|
10
|
+
LocationMiddleware2 as LocationMiddleware,
|
|
11
|
+
layer5 as layer,
|
|
12
|
+
requestRef2 as requestRef,
|
|
13
|
+
response2 as response,
|
|
14
|
+
sessionInfo2 as sessionInfo
|
|
15
|
+
};
|
|
@@ -1,49 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
function decodeCredential(input) {
|
|
14
|
-
return Effect.fromResult(Encoding.decodeBase64String(input)).pipe(Effect.match({
|
|
15
|
-
onFailure: emptyCredential,
|
|
16
|
-
onSuccess: (header) => {
|
|
17
|
-
const separator = header.indexOf(":");
|
|
18
|
-
if (separator === -1)
|
|
19
|
-
return emptyCredential();
|
|
20
|
-
return { username: header.slice(0, separator), password: Redacted.make(header.slice(separator + 1)) };
|
|
21
|
-
}
|
|
22
|
-
}));
|
|
23
|
-
}
|
|
24
|
-
function credentialFromRequest(request) {
|
|
25
|
-
const token = new URL(request.url, "http://localhost").searchParams.get(AUTH_TOKEN_QUERY);
|
|
26
|
-
if (token)
|
|
27
|
-
return decodeCredential(token);
|
|
28
|
-
const match = /^Basic\s+(.+)$/i.exec(request.headers.authorization ?? "");
|
|
29
|
-
if (match)
|
|
30
|
-
return decodeCredential(match[1]);
|
|
31
|
-
return Effect.succeed(emptyCredential());
|
|
32
|
-
}
|
|
33
|
-
export function authorizedRequest(request, config) {
|
|
34
|
-
return credentialFromRequest(request).pipe(Effect.map((credential) => ServerAuth.authorized(credential, config)));
|
|
35
|
-
}
|
|
36
|
-
export const authorizationLayer = Layer.effect(Authorization, Effect.gen(function* () {
|
|
37
|
-
const config = yield* ServerAuth.Config;
|
|
38
|
-
if (!ServerAuth.required(config))
|
|
39
|
-
return Authorization.of((effect) => effect);
|
|
40
|
-
return Authorization.of((effect) => Effect.gen(function* () {
|
|
41
|
-
const request = yield* HttpServerRequest.HttpServerRequest, url = new URL(request.url, "http://localhost");
|
|
42
|
-
if (hasPtyConnectTicketURL(url) || hasPersistentPtyConnectTicketURL(url))
|
|
43
|
-
return yield* effect;
|
|
44
|
-
if (yield* authorizedRequest(request, config))
|
|
45
|
-
return yield* effect;
|
|
46
|
-
yield* HttpEffect.appendPreResponseHandler((_request, response) => Effect.succeed(HttpServerResponse.setHeader(response, "www-authenticate", WWW_AUTHENTICATE)));
|
|
47
|
-
return yield* new UnauthorizedError({ message: "Authentication required" });
|
|
48
|
-
}));
|
|
49
|
-
}));
|
|
1
|
+
import {
|
|
2
|
+
authorizedRequest2,
|
|
3
|
+
authorizationLayer2,
|
|
4
|
+
Authorization2
|
|
5
|
+
} from "../chunks/auth-m6wvgbfq.js";
|
|
6
|
+
import"../chunks/auth-zyv89x5n.js";
|
|
7
|
+
export {
|
|
8
|
+
Authorization2 as Authorization,
|
|
9
|
+
authorizationLayer2 as authorizationLayer,
|
|
10
|
+
authorizedRequest2 as authorizedRequest
|
|
11
|
+
};
|
|
@@ -1,25 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
error: [InvalidRequestError, SessionNotFoundError]
|
|
12
|
-
}) {
|
|
13
|
-
}
|
|
14
|
-
export const formLocationLayer = Layer.effect(FormLocationMiddleware, Effect.gen(function* () {
|
|
15
|
-
const sessions = yield* Session.Service, instances = yield* Instance.Service, locations = yield* LocationServiceMap.Service;
|
|
16
|
-
return FormLocationMiddleware.of((effect) => Effect.gen(function* () {
|
|
17
|
-
const route = yield* HttpRouter.RouteContext;
|
|
18
|
-
if (route.params.sessionID === "global") {
|
|
19
|
-
const request = yield* HttpServerRequest.HttpServerRequest;
|
|
20
|
-
return yield* effect.pipe(Effect.provide(locations.get(requestRef(request))));
|
|
21
|
-
}
|
|
22
|
-
const session = yield* sessionInfo(sessions, route.params.sessionID);
|
|
23
|
-
return yield* effect.pipe(instances.provide(session));
|
|
24
|
-
}));
|
|
25
|
-
}));
|
|
1
|
+
import {
|
|
2
|
+
FormLocationMiddleware2,
|
|
3
|
+
formLocationLayer2
|
|
4
|
+
} from "../chunks/auth-frv6gfy7.js";
|
|
5
|
+
import"../chunks/auth-0ar9gf7q.js";
|
|
6
|
+
import"../chunks/auth-smaf4a18.js";
|
|
7
|
+
export {
|
|
8
|
+
FormLocationMiddleware2 as FormLocationMiddleware,
|
|
9
|
+
formLocationLayer2 as formLocationLayer
|
|
10
|
+
};
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return reason;
|
|
10
|
-
return reason.slice(0, REASON_LIMIT) + `... (${reason.length - REASON_LIMIT} more chars)`;
|
|
11
|
-
}
|
|
12
|
-
export const schemaErrorLayer = HttpApiMiddleware.layerSchemaErrorTransform(SchemaErrorMiddleware, (error) => {
|
|
13
|
-
const reason = truncateReason(error.cause.message);
|
|
14
|
-
return Effect.logWarning("schema rejection").pipe(Effect.annotateLogs({ kind: error.kind, reason }), Effect.andThen(Effect.fail(new InvalidRequestError({ message: reason, kind: error.kind }))));
|
|
15
|
-
});
|
|
1
|
+
import {
|
|
2
|
+
schemaErrorLayer2,
|
|
3
|
+
SchemaErrorMiddleware2
|
|
4
|
+
} from "../chunks/auth-t8yzmczr.js";
|
|
5
|
+
export {
|
|
6
|
+
SchemaErrorMiddleware2 as SchemaErrorMiddleware,
|
|
7
|
+
schemaErrorLayer2 as schemaErrorLayer
|
|
8
|
+
};
|
|
@@ -1,19 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}) {
|
|
12
|
-
}
|
|
13
|
-
export const sessionLocationLayer = Layer.effect(SessionLocationMiddleware, Effect.gen(function* () {
|
|
14
|
-
const sessions = yield* Session.Service, instances = yield* Instance.Service;
|
|
15
|
-
return SessionLocationMiddleware.of((effect) => Effect.gen(function* () {
|
|
16
|
-
const route = yield* HttpRouter.RouteContext, session = yield* sessionInfo(sessions, route.params.sessionID);
|
|
17
|
-
return yield* effect.pipe(instances.provide(session));
|
|
18
|
-
}));
|
|
19
|
-
}));
|
|
1
|
+
import {
|
|
2
|
+
SessionLocationMiddleware2,
|
|
3
|
+
sessionLocationLayer2
|
|
4
|
+
} from "../chunks/auth-23w8t84j.js";
|
|
5
|
+
import"../chunks/auth-0ar9gf7q.js";
|
|
6
|
+
import"../chunks/auth-smaf4a18.js";
|
|
7
|
+
export {
|
|
8
|
+
SessionLocationMiddleware2 as SessionLocationMiddleware,
|
|
9
|
+
sessionLocationLayer2 as sessionLocationLayer
|
|
10
|
+
};
|
package/dist/options.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
// src/options.ts
|
|
1
2
|
import { Database } from "@opencode/core/database/database";
|
|
2
3
|
import { ModelsDev } from "@opencode/core/models-dev";
|
|
3
4
|
import { PersistentPty } from "@opencode/core/persistent-pty";
|
|
4
5
|
import { Schema } from "effect";
|
|
5
|
-
|
|
6
|
+
var ServerOptions = Schema.Struct({
|
|
6
7
|
app: Schema.optional(Schema.Struct({
|
|
7
8
|
name: Schema.optional(Schema.String),
|
|
8
9
|
version: Schema.optional(Schema.String),
|
|
@@ -33,3 +34,6 @@ export const ServerOptions = Schema.Struct({
|
|
|
33
34
|
fff: Schema.optional(Schema.Boolean)
|
|
34
35
|
}))
|
|
35
36
|
});
|
|
37
|
+
export {
|
|
38
|
+
ServerOptions
|
|
39
|
+
};
|