@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
package/dist/api.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { LocationMiddleware } from "./location";
|
|
|
2
2
|
import { FormLocationMiddleware } from "./middleware/form-location";
|
|
3
3
|
import { SessionLocationMiddleware } from "./middleware/session-location";
|
|
4
4
|
export declare const Api: import("@opencode/protocol/api").Api<LocationMiddleware, import("effect/http-api/HttpApiMiddleware").HttpApiMiddleware<import("@opencode/core/instance").Services, readonly [typeof import("@opencode/protocol/errors").LocationNotFoundError], never>, FormLocationMiddleware, import("effect/http-api/HttpApiMiddleware").HttpApiMiddleware<import("@opencode/core/instance").Services, readonly [typeof import("@opencode/protocol/errors").InvalidRequestError, typeof import("@opencode/protocol/errors").SessionNotFoundError, typeof import("@opencode/protocol/errors").LocationNotFoundError], never>, SessionLocationMiddleware, import("effect/http-api/HttpApiMiddleware").HttpApiMiddleware<import("@opencode/core/instance").Services, readonly [typeof import("@opencode/protocol/errors").InvalidRequestError, typeof import("@opencode/protocol/errors").SessionNotFoundError, typeof import("@opencode/protocol/errors").LocationNotFoundError], never>, import("effect/http-api/HttpApiGroup").HttpApiGroup<"server.event", import("effect/http-api/HttpApiEndpoint").HttpApiEndpoint<"event.subscribe", "GET", "/api/event", never, import("effect/Schema").toCodecStringTree<import("effect/Schema").Struct<{
|
|
5
|
-
readonly types: import("effect/Schema").optional<import("effect/Schema").ArrayEnsure<import("effect/Schema").Union<readonly [import("effect/Schema").Literals<readonly ("agent.updated" | "artifact.updated" | "command.updated" | "config.updated" | "credential.switched" | "credential.updated" | "experimental.mcp.event" | "filesystem.changed" | "form.cancelled" | "form.created" | "form.replied" | "installation.update-available" | "installation.updated" | "integration.updated" | "location.shutdown" | "mcp.resources.changed" | "mcp.status.changed" | "model.updated" | "models-dev.refreshed" | "permission.asked" | "permission.replied" | "persistent-pty.added" | "persistent-pty.removed" | "persistent-pty.updated" | "plugin.updated" | "project.updated" | "provider.updated" | "pty.created" | "pty.deleted" | "pty.exited" | "pty.updated" | "reference.updated" | "session.agent.selected" | "session.archived" | "session.compaction.delta" | "session.compaction.ended" | "session.compaction.failed" | "session.compaction.started" | "session.created" | "session.deleted" | "session.execution.failed" | "session.execution.interrupted" | "session.execution.started" | "session.execution.succeeded" | "session.forked" | "session.idle" | "session.inbox.cancelled" | "session.inbox.delivered" | "session.inbox.delivery.changed" | "session.inbox.enqueued" | "session.instructions.updated" | "session.metadata.updated" | "session.model.selected" | "session.moved" | "session.permissions" | "session.reasoning.delta" | "session.reasoning.ended" | "session.reasoning.started" | "session.renamed" | "session.retry.scheduled" | "session.revert.cleared" | "session.revert.committed" | "session.revert.staged" | "session.shell.ended" | "session.shell.started" | "session.skill.activated" | "session.status" | "session.step.ended" | "session.step.failed" | "session.step.first-token" | "session.step.started" | "session.step.streamed" | "session.synthetic" | "session.text.delta" | "session.text.ended" | "session.text.started" | "session.tool.called" | "session.tool.failed" | "session.tool.input.delta" | "session.tool.input.ended" | "session.tool.input.started" | "session.tool.progress" | "session.tool.success" | "session.unarchived" | "session.usage.updated" | "session.viewed" | "shell.created" | "shell.deleted" | "shell.exited" | "skill.updated" | "tui.command.execute" | "tui.prompt.append" | "tui.session.select" | "tui.toast.show" | "vcs.branch.updated" | "websearch.updated" | "worktree.resolved" | "worktree.updated")[]>, import("effect/Schema").TemplateLiteral<readonly ["rpc.", import("effect/Schema").String]>]>>>;
|
|
5
|
+
readonly types: import("effect/Schema").optional<import("effect/Schema").ArrayEnsure<import("effect/Schema").Union<readonly [import("effect/Schema").Literals<readonly ("agent.updated" | "artifact.updated" | "command.updated" | "config.updated" | "credential.switched" | "credential.updated" | "experimental.job.updated" | "experimental.mcp.event" | "filesystem.changed" | "form.cancelled" | "form.created" | "form.replied" | "installation.update-available" | "installation.updated" | "integration.updated" | "location.shutdown" | "mcp.resources.changed" | "mcp.status.changed" | "model.updated" | "models-dev.refreshed" | "permission.asked" | "permission.replied" | "persistent-pty.added" | "persistent-pty.removed" | "persistent-pty.updated" | "plugin.updated" | "project.updated" | "provider.updated" | "pty.created" | "pty.deleted" | "pty.exited" | "pty.updated" | "reference.updated" | "session.agent.selected" | "session.archived" | "session.compaction.delta" | "session.compaction.ended" | "session.compaction.failed" | "session.compaction.started" | "session.created" | "session.deleted" | "session.execution.failed" | "session.execution.interrupted" | "session.execution.started" | "session.execution.succeeded" | "session.forked" | "session.idle" | "session.inbox.cancelled" | "session.inbox.delivered" | "session.inbox.delivery.changed" | "session.inbox.enqueued" | "session.instructions.updated" | "session.metadata.updated" | "session.model.selected" | "session.moved" | "session.permissions" | "session.reasoning.delta" | "session.reasoning.ended" | "session.reasoning.started" | "session.renamed" | "session.retry.scheduled" | "session.revert.cleared" | "session.revert.committed" | "session.revert.staged" | "session.shell.ended" | "session.shell.started" | "session.skill.activated" | "session.status" | "session.step.ended" | "session.step.failed" | "session.step.first-token" | "session.step.started" | "session.step.streamed" | "session.synthetic" | "session.text.delta" | "session.text.ended" | "session.text.started" | "session.tool.called" | "session.tool.failed" | "session.tool.input.delta" | "session.tool.input.ended" | "session.tool.input.started" | "session.tool.progress" | "session.tool.success" | "session.unarchived" | "session.usage.updated" | "session.viewed" | "shell.created" | "shell.deleted" | "shell.exited" | "skill.updated" | "tui.command.execute" | "tui.prompt.append" | "tui.session.select" | "tui.toast.show" | "vcs.branch.updated" | "websearch.updated" | "worktree.resolved" | "worktree.updated")[]>, import("effect/Schema").TemplateLiteral<readonly ["rpc.", import("effect/Schema").String]>]>>>;
|
|
6
6
|
}>>, never, never, import("effect/http-api/HttpApiSchema").StreamSse<import("effect/http-api/HttpApiSchema").SseEventFromData<import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
7
7
|
readonly id: import("effect/Schema").brand<import("effect/Schema").String, "Event.ID"> & {
|
|
8
8
|
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
@@ -5539,6 +5539,182 @@ export declare const Api: import("@opencode/protocol/api").Api<LocationMiddlewar
|
|
|
5539
5539
|
ascending: (id?: string) => string & import("effect/Brand").Brand<"Shell.ID">;
|
|
5540
5540
|
};
|
|
5541
5541
|
}>;
|
|
5542
|
+
}, import("effect/Schema").Struct<{
|
|
5543
|
+
readonly id: import("effect/Schema").brand<import("effect/Schema").String, "Event.ID"> & {
|
|
5544
|
+
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
5545
|
+
};
|
|
5546
|
+
readonly created: import("effect/Schema").Finite;
|
|
5547
|
+
readonly metadata: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>>>, import("effect/Schema").optionalKey<import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").Unknown>>, never, never>;
|
|
5548
|
+
readonly type: import("effect/Schema").Literal<"experimental.job.updated">;
|
|
5549
|
+
readonly location: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Struct<{
|
|
5550
|
+
readonly directory: import("effect/Schema").brand<import("effect/Schema").String, "AbsolutePath">;
|
|
5551
|
+
readonly workspaceID: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
5552
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
5553
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
5554
|
+
}>>, import("effect/Schema").optionalKey<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
5555
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
5556
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
5557
|
+
}>, never, never>;
|
|
5558
|
+
}>>>, import("effect/Schema").optionalKey<import("effect/Schema").Struct<{
|
|
5559
|
+
readonly directory: import("effect/Schema").brand<import("effect/Schema").String, "AbsolutePath">;
|
|
5560
|
+
readonly workspaceID: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
5561
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
5562
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
5563
|
+
}>>, import("effect/Schema").optionalKey<import("effect/Schema").brand<import("effect/Schema").String, "Workspace.ID"> & {
|
|
5564
|
+
ascending: (id?: string) => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
5565
|
+
create: () => string & import("effect/Brand").Brand<"Workspace.ID">;
|
|
5566
|
+
}>, never, never>;
|
|
5567
|
+
}>>, never, never>;
|
|
5568
|
+
readonly data: import("effect/Schema").Struct<{
|
|
5569
|
+
readonly info: import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
5570
|
+
readonly id: import("effect/Schema").String;
|
|
5571
|
+
readonly sessionID: import("effect/Schema").brand<import("effect/Schema").String, "SessionID"> & {
|
|
5572
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
5573
|
+
};
|
|
5574
|
+
readonly status: import("effect/Schema").Literals<readonly ["running", "completed", "error", "cancelled"]>;
|
|
5575
|
+
readonly title: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").String>>, import("effect/Schema").optionalKey<import("effect/Schema").String>, never, never>;
|
|
5576
|
+
readonly time: import("effect/Schema").Struct<{
|
|
5577
|
+
readonly started: import("effect/Schema").Finite;
|
|
5578
|
+
readonly completed: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Finite>>, import("effect/Schema").optionalKey<import("effect/Schema").Finite>, never, never>;
|
|
5579
|
+
}>;
|
|
5580
|
+
readonly kind: import("effect/Schema").tag<"shell">;
|
|
5581
|
+
readonly shellID: import("effect/Schema").String;
|
|
5582
|
+
readonly command: import("effect/Schema").String;
|
|
5583
|
+
}>, import("effect/Schema").Struct<{
|
|
5584
|
+
readonly id: import("effect/Schema").String;
|
|
5585
|
+
readonly sessionID: import("effect/Schema").brand<import("effect/Schema").String, "SessionID"> & {
|
|
5586
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
5587
|
+
};
|
|
5588
|
+
readonly status: import("effect/Schema").Literals<readonly ["running", "completed", "error", "cancelled"]>;
|
|
5589
|
+
readonly title: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").String>>, import("effect/Schema").optionalKey<import("effect/Schema").String>, never, never>;
|
|
5590
|
+
readonly time: import("effect/Schema").Struct<{
|
|
5591
|
+
readonly started: import("effect/Schema").Finite;
|
|
5592
|
+
readonly completed: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Finite>>, import("effect/Schema").optionalKey<import("effect/Schema").Finite>, never, never>;
|
|
5593
|
+
}>;
|
|
5594
|
+
readonly kind: import("effect/Schema").tag<"subagent">;
|
|
5595
|
+
readonly childSessionID: import("effect/Schema").brand<import("effect/Schema").String, "SessionID"> & {
|
|
5596
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
5597
|
+
};
|
|
5598
|
+
readonly agent: import("effect/Schema").String;
|
|
5599
|
+
readonly description: import("effect/Schema").String;
|
|
5600
|
+
}>, import("effect/Schema").Struct<{
|
|
5601
|
+
readonly id: import("effect/Schema").String;
|
|
5602
|
+
readonly sessionID: import("effect/Schema").brand<import("effect/Schema").String, "SessionID"> & {
|
|
5603
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
5604
|
+
};
|
|
5605
|
+
readonly status: import("effect/Schema").Literals<readonly ["running", "completed", "error", "cancelled"]>;
|
|
5606
|
+
readonly title: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").String>>, import("effect/Schema").optionalKey<import("effect/Schema").String>, never, never>;
|
|
5607
|
+
readonly time: import("effect/Schema").Struct<{
|
|
5608
|
+
readonly started: import("effect/Schema").Finite;
|
|
5609
|
+
readonly completed: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Finite>>, import("effect/Schema").optionalKey<import("effect/Schema").Finite>, never, never>;
|
|
5610
|
+
}>;
|
|
5611
|
+
readonly kind: import("effect/Schema").tag<"image">;
|
|
5612
|
+
readonly path: import("effect/Schema").String;
|
|
5613
|
+
readonly model: import("effect/Schema").String;
|
|
5614
|
+
}>, import("effect/Schema").Struct<{
|
|
5615
|
+
readonly id: import("effect/Schema").String;
|
|
5616
|
+
readonly sessionID: import("effect/Schema").brand<import("effect/Schema").String, "SessionID"> & {
|
|
5617
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
5618
|
+
};
|
|
5619
|
+
readonly status: import("effect/Schema").Literals<readonly ["running", "completed", "error", "cancelled"]>;
|
|
5620
|
+
readonly title: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").String>>, import("effect/Schema").optionalKey<import("effect/Schema").String>, never, never>;
|
|
5621
|
+
readonly time: import("effect/Schema").Struct<{
|
|
5622
|
+
readonly started: import("effect/Schema").Finite;
|
|
5623
|
+
readonly completed: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Finite>>, import("effect/Schema").optionalKey<import("effect/Schema").Finite>, never, never>;
|
|
5624
|
+
}>;
|
|
5625
|
+
readonly kind: import("effect/Schema").tag<"video">;
|
|
5626
|
+
readonly path: import("effect/Schema").String;
|
|
5627
|
+
}>, import("effect/Schema").Struct<{
|
|
5628
|
+
readonly id: import("effect/Schema").String;
|
|
5629
|
+
readonly sessionID: import("effect/Schema").brand<import("effect/Schema").String, "SessionID"> & {
|
|
5630
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
5631
|
+
};
|
|
5632
|
+
readonly status: import("effect/Schema").Literals<readonly ["running", "completed", "error", "cancelled"]>;
|
|
5633
|
+
readonly title: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").String>>, import("effect/Schema").optionalKey<import("effect/Schema").String>, never, never>;
|
|
5634
|
+
readonly time: import("effect/Schema").Struct<{
|
|
5635
|
+
readonly started: import("effect/Schema").Finite;
|
|
5636
|
+
readonly completed: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Finite>>, import("effect/Schema").optionalKey<import("effect/Schema").Finite>, never, never>;
|
|
5637
|
+
}>;
|
|
5638
|
+
readonly kind: import("effect/Schema").tag<"codemode">;
|
|
5639
|
+
}>]>;
|
|
5640
|
+
}>;
|
|
5641
|
+
}> & {
|
|
5642
|
+
type: "experimental.job.updated";
|
|
5643
|
+
durability: "ephemeral";
|
|
5644
|
+
durable: undefined;
|
|
5645
|
+
data: import("effect/Schema").Struct<{
|
|
5646
|
+
readonly info: import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
|
|
5647
|
+
readonly id: import("effect/Schema").String;
|
|
5648
|
+
readonly sessionID: import("effect/Schema").brand<import("effect/Schema").String, "SessionID"> & {
|
|
5649
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
5650
|
+
};
|
|
5651
|
+
readonly status: import("effect/Schema").Literals<readonly ["running", "completed", "error", "cancelled"]>;
|
|
5652
|
+
readonly title: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").String>>, import("effect/Schema").optionalKey<import("effect/Schema").String>, never, never>;
|
|
5653
|
+
readonly time: import("effect/Schema").Struct<{
|
|
5654
|
+
readonly started: import("effect/Schema").Finite;
|
|
5655
|
+
readonly completed: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Finite>>, import("effect/Schema").optionalKey<import("effect/Schema").Finite>, never, never>;
|
|
5656
|
+
}>;
|
|
5657
|
+
readonly kind: import("effect/Schema").tag<"shell">;
|
|
5658
|
+
readonly shellID: import("effect/Schema").String;
|
|
5659
|
+
readonly command: import("effect/Schema").String;
|
|
5660
|
+
}>, import("effect/Schema").Struct<{
|
|
5661
|
+
readonly id: import("effect/Schema").String;
|
|
5662
|
+
readonly sessionID: import("effect/Schema").brand<import("effect/Schema").String, "SessionID"> & {
|
|
5663
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
5664
|
+
};
|
|
5665
|
+
readonly status: import("effect/Schema").Literals<readonly ["running", "completed", "error", "cancelled"]>;
|
|
5666
|
+
readonly title: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").String>>, import("effect/Schema").optionalKey<import("effect/Schema").String>, never, never>;
|
|
5667
|
+
readonly time: import("effect/Schema").Struct<{
|
|
5668
|
+
readonly started: import("effect/Schema").Finite;
|
|
5669
|
+
readonly completed: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Finite>>, import("effect/Schema").optionalKey<import("effect/Schema").Finite>, never, never>;
|
|
5670
|
+
}>;
|
|
5671
|
+
readonly kind: import("effect/Schema").tag<"subagent">;
|
|
5672
|
+
readonly childSessionID: import("effect/Schema").brand<import("effect/Schema").String, "SessionID"> & {
|
|
5673
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
5674
|
+
};
|
|
5675
|
+
readonly agent: import("effect/Schema").String;
|
|
5676
|
+
readonly description: import("effect/Schema").String;
|
|
5677
|
+
}>, import("effect/Schema").Struct<{
|
|
5678
|
+
readonly id: import("effect/Schema").String;
|
|
5679
|
+
readonly sessionID: import("effect/Schema").brand<import("effect/Schema").String, "SessionID"> & {
|
|
5680
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
5681
|
+
};
|
|
5682
|
+
readonly status: import("effect/Schema").Literals<readonly ["running", "completed", "error", "cancelled"]>;
|
|
5683
|
+
readonly title: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").String>>, import("effect/Schema").optionalKey<import("effect/Schema").String>, never, never>;
|
|
5684
|
+
readonly time: import("effect/Schema").Struct<{
|
|
5685
|
+
readonly started: import("effect/Schema").Finite;
|
|
5686
|
+
readonly completed: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Finite>>, import("effect/Schema").optionalKey<import("effect/Schema").Finite>, never, never>;
|
|
5687
|
+
}>;
|
|
5688
|
+
readonly kind: import("effect/Schema").tag<"image">;
|
|
5689
|
+
readonly path: import("effect/Schema").String;
|
|
5690
|
+
readonly model: import("effect/Schema").String;
|
|
5691
|
+
}>, import("effect/Schema").Struct<{
|
|
5692
|
+
readonly id: import("effect/Schema").String;
|
|
5693
|
+
readonly sessionID: import("effect/Schema").brand<import("effect/Schema").String, "SessionID"> & {
|
|
5694
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
5695
|
+
};
|
|
5696
|
+
readonly status: import("effect/Schema").Literals<readonly ["running", "completed", "error", "cancelled"]>;
|
|
5697
|
+
readonly title: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").String>>, import("effect/Schema").optionalKey<import("effect/Schema").String>, never, never>;
|
|
5698
|
+
readonly time: import("effect/Schema").Struct<{
|
|
5699
|
+
readonly started: import("effect/Schema").Finite;
|
|
5700
|
+
readonly completed: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Finite>>, import("effect/Schema").optionalKey<import("effect/Schema").Finite>, never, never>;
|
|
5701
|
+
}>;
|
|
5702
|
+
readonly kind: import("effect/Schema").tag<"video">;
|
|
5703
|
+
readonly path: import("effect/Schema").String;
|
|
5704
|
+
}>, import("effect/Schema").Struct<{
|
|
5705
|
+
readonly id: import("effect/Schema").String;
|
|
5706
|
+
readonly sessionID: import("effect/Schema").brand<import("effect/Schema").String, "SessionID"> & {
|
|
5707
|
+
create: () => string & import("effect/Brand").Brand<"SessionID">;
|
|
5708
|
+
};
|
|
5709
|
+
readonly status: import("effect/Schema").Literals<readonly ["running", "completed", "error", "cancelled"]>;
|
|
5710
|
+
readonly title: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").String>>, import("effect/Schema").optionalKey<import("effect/Schema").String>, never, never>;
|
|
5711
|
+
readonly time: import("effect/Schema").Struct<{
|
|
5712
|
+
readonly started: import("effect/Schema").Finite;
|
|
5713
|
+
readonly completed: import("effect/Schema").decodeTo<import("effect/Schema").optional<import("effect/Schema").toType<import("effect/Schema").Finite>>, import("effect/Schema").optionalKey<import("effect/Schema").Finite>, never, never>;
|
|
5714
|
+
}>;
|
|
5715
|
+
readonly kind: import("effect/Schema").tag<"codemode">;
|
|
5716
|
+
}>]>;
|
|
5717
|
+
}>;
|
|
5542
5718
|
}, import("effect/Schema").Struct<{
|
|
5543
5719
|
readonly id: import("effect/Schema").brand<import("effect/Schema").String, "Event.ID"> & {
|
|
5544
5720
|
create: () => string & import("effect/Brand").Brand<"Event.ID">;
|
|
@@ -7909,6 +8085,78 @@ export declare const Api: import("@opencode/protocol/api").Api<LocationMiddlewar
|
|
|
7909
8085
|
readonly integrationID: string & import("effect/Brand").Brand<"Integration.ID">;
|
|
7910
8086
|
readonly credentialID: string & import("effect/Brand").Brand<"Credential.ID">;
|
|
7911
8087
|
};
|
|
8088
|
+
} | {
|
|
8089
|
+
readonly id: string & import("effect/Brand").Brand<"Event.ID">;
|
|
8090
|
+
readonly created: number;
|
|
8091
|
+
readonly metadata?: {
|
|
8092
|
+
readonly [x: string]: unknown;
|
|
8093
|
+
} | undefined;
|
|
8094
|
+
readonly type: "experimental.job.updated";
|
|
8095
|
+
readonly location?: {
|
|
8096
|
+
readonly directory: string & import("effect/Brand").Brand<"AbsolutePath">;
|
|
8097
|
+
readonly workspaceID?: (string & import("effect/Brand").Brand<"Workspace.ID">) | undefined;
|
|
8098
|
+
} | undefined;
|
|
8099
|
+
readonly data: {
|
|
8100
|
+
readonly info: {
|
|
8101
|
+
readonly id: string;
|
|
8102
|
+
readonly sessionID: string & import("effect/Brand").Brand<"SessionID">;
|
|
8103
|
+
readonly status: "cancelled" | "completed" | "error" | "running";
|
|
8104
|
+
readonly title?: string | undefined;
|
|
8105
|
+
readonly time: {
|
|
8106
|
+
readonly started: number;
|
|
8107
|
+
readonly completed?: number | undefined;
|
|
8108
|
+
};
|
|
8109
|
+
readonly kind: "shell";
|
|
8110
|
+
readonly shellID: string;
|
|
8111
|
+
readonly command: string;
|
|
8112
|
+
} | {
|
|
8113
|
+
readonly id: string;
|
|
8114
|
+
readonly sessionID: string & import("effect/Brand").Brand<"SessionID">;
|
|
8115
|
+
readonly status: "cancelled" | "completed" | "error" | "running";
|
|
8116
|
+
readonly title?: string | undefined;
|
|
8117
|
+
readonly time: {
|
|
8118
|
+
readonly started: number;
|
|
8119
|
+
readonly completed?: number | undefined;
|
|
8120
|
+
};
|
|
8121
|
+
readonly kind: "subagent";
|
|
8122
|
+
readonly childSessionID: string & import("effect/Brand").Brand<"SessionID">;
|
|
8123
|
+
readonly agent: string;
|
|
8124
|
+
readonly description: string;
|
|
8125
|
+
} | {
|
|
8126
|
+
readonly id: string;
|
|
8127
|
+
readonly sessionID: string & import("effect/Brand").Brand<"SessionID">;
|
|
8128
|
+
readonly status: "cancelled" | "completed" | "error" | "running";
|
|
8129
|
+
readonly title?: string | undefined;
|
|
8130
|
+
readonly time: {
|
|
8131
|
+
readonly started: number;
|
|
8132
|
+
readonly completed?: number | undefined;
|
|
8133
|
+
};
|
|
8134
|
+
readonly kind: "image";
|
|
8135
|
+
readonly path: string;
|
|
8136
|
+
readonly model: string;
|
|
8137
|
+
} | {
|
|
8138
|
+
readonly id: string;
|
|
8139
|
+
readonly sessionID: string & import("effect/Brand").Brand<"SessionID">;
|
|
8140
|
+
readonly status: "cancelled" | "completed" | "error" | "running";
|
|
8141
|
+
readonly title?: string | undefined;
|
|
8142
|
+
readonly time: {
|
|
8143
|
+
readonly started: number;
|
|
8144
|
+
readonly completed?: number | undefined;
|
|
8145
|
+
};
|
|
8146
|
+
readonly kind: "video";
|
|
8147
|
+
readonly path: string;
|
|
8148
|
+
} | {
|
|
8149
|
+
readonly id: string;
|
|
8150
|
+
readonly sessionID: string & import("effect/Brand").Brand<"SessionID">;
|
|
8151
|
+
readonly status: "cancelled" | "completed" | "error" | "running";
|
|
8152
|
+
readonly title?: string | undefined;
|
|
8153
|
+
readonly time: {
|
|
8154
|
+
readonly started: number;
|
|
8155
|
+
readonly completed?: number | undefined;
|
|
8156
|
+
};
|
|
8157
|
+
readonly kind: "codemode";
|
|
8158
|
+
};
|
|
8159
|
+
};
|
|
7912
8160
|
} | {
|
|
7913
8161
|
readonly id: string & import("effect/Brand").Brand<"Event.ID">;
|
|
7914
8162
|
readonly created: number;
|
package/dist/api.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./chunks/
|
|
4
|
-
import"./chunks/
|
|
5
|
-
import"./chunks/
|
|
6
|
-
import"./chunks/
|
|
7
|
-
import"./chunks/
|
|
3
|
+
} from "./chunks/content-headers-zjmacp9c.js";
|
|
4
|
+
import"./chunks/content-headers-vw0q3knq.js";
|
|
5
|
+
import"./chunks/content-headers-ah2sj2pr.js";
|
|
6
|
+
import"./chunks/content-headers-ywn523ee.js";
|
|
7
|
+
import"./chunks/content-headers-smaf4a18.js";
|
|
8
8
|
export {
|
|
9
9
|
Api2 as Api
|
|
10
10
|
};
|
package/dist/auth.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isAllowedCorsOrigin2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./content-headers-q4bn6dy8.js";
|
|
4
4
|
import {
|
|
5
5
|
middleware2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./content-headers-hmwn16zp.js";
|
|
7
7
|
import {
|
|
8
8
|
withoutParentSpan2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./content-headers-yc7nft6q.js";
|
|
10
10
|
import {
|
|
11
11
|
createRoutes2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./content-headers-fjcqsaaz.js";
|
|
13
13
|
import {
|
|
14
14
|
__export
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./content-headers-9rqn6x4v.js";
|
|
16
16
|
|
|
17
17
|
// src/fetch.ts
|
|
18
18
|
var exports_fetch = {};
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
// src/handlers/machine.ts
|
|
2
|
+
import { NodeHttpServerRequest } from "@effect/platform-node";
|
|
3
|
+
import { WebSocketServer } from "@effect/platform-node-shared/NodeWS";
|
|
4
|
+
import { Environment } from "@opencode/core/environment/index";
|
|
5
|
+
import { Flag } from "@opencode/core/flag";
|
|
6
|
+
import { Location } from "@opencode/core/location";
|
|
7
|
+
import { LocationServiceMap } from "@opencode/core/location-services";
|
|
8
|
+
import { Frames } from "@opencode/core/machine/frames";
|
|
9
|
+
import { Iroh } from "@opencode/core/machine/iroh";
|
|
10
|
+
import { Join } from "@opencode/core/machine/join";
|
|
11
|
+
import { Link } from "@opencode/core/machine/link";
|
|
12
|
+
import { Machines } from "@opencode/core/machine/machines";
|
|
13
|
+
import { AbsolutePath } from "@opencode/core/schema";
|
|
14
|
+
import { ConflictError, ForbiddenError, InvalidRequestError, MachineNotFoundError } from "@opencode/protocol/errors";
|
|
15
|
+
import { isWebSocketUpgrade } from "@opencode/protocol/groups/machine";
|
|
16
|
+
import { Global } from "@opencode/util/global";
|
|
17
|
+
import { Context, Effect, Latch, Option, Scope, Semaphore } from "effect";
|
|
18
|
+
import { HttpMiddleware, HttpServerResponse } from "effect/http";
|
|
19
|
+
import { HttpApiSchema } from "effect/http-api";
|
|
20
|
+
import { Socket } from "effect/socket";
|
|
21
|
+
import { IncomingMessage } from "node:http";
|
|
22
|
+
var MAX_HANDSHAKES = 32;
|
|
23
|
+
var MAX_FRAME = 65535;
|
|
24
|
+
var MIN_FRAME = 16;
|
|
25
|
+
var MAX_WAITING = Frames.MAX_MESSAGE;
|
|
26
|
+
var STALL = "60 seconds";
|
|
27
|
+
var PING = "30 seconds";
|
|
28
|
+
var CLOSING = "5 seconds";
|
|
29
|
+
var STOPPING = "1 second";
|
|
30
|
+
var CLOSE = 1008;
|
|
31
|
+
var Watch2 = Context.Reference("@opencode/MachineLink/Watch", {
|
|
32
|
+
defaultValue: () => () => {}
|
|
33
|
+
});
|
|
34
|
+
var machinesEnabled2 = Effect.gen(function* () {
|
|
35
|
+
const global = yield* Global.Service;
|
|
36
|
+
const locations = yield* LocationServiceMap.Service;
|
|
37
|
+
return Flag.enabled("machines").pipe(Effect.provide(locations.get(Location.Ref.make({ directory: AbsolutePath.make(global.config) }))), Effect.orElseSucceed(() => false));
|
|
38
|
+
});
|
|
39
|
+
var drop = (socket) => {
|
|
40
|
+
socket.close(CLOSE);
|
|
41
|
+
socket.terminate();
|
|
42
|
+
};
|
|
43
|
+
var upgrade2 = (sockets, request) => Effect.acquireRelease(Effect.callback((resume) => {
|
|
44
|
+
const refused = () => resume(Effect.fail(new Link.Closed));
|
|
45
|
+
if (request.socket.destroyed)
|
|
46
|
+
return refused();
|
|
47
|
+
request.socket.once("close", refused);
|
|
48
|
+
sockets.handleUpgrade(request, request.socket, Buffer.alloc(0), (socket) => {
|
|
49
|
+
request.socket.off("close", refused);
|
|
50
|
+
socket.on("message", (data) => {
|
|
51
|
+
if ([data].flat().reduce((bytes, part) => bytes + part.byteLength, 0) < MIN_FRAME)
|
|
52
|
+
drop(socket);
|
|
53
|
+
});
|
|
54
|
+
resume(Effect.succeed(socket));
|
|
55
|
+
});
|
|
56
|
+
}), (socket) => Effect.gen(function* () {
|
|
57
|
+
const gone = Effect.callback((resume) => {
|
|
58
|
+
if (socket.readyState === socket.CLOSED)
|
|
59
|
+
return resume(Effect.void);
|
|
60
|
+
socket.once("close", () => resume(Effect.void));
|
|
61
|
+
});
|
|
62
|
+
socket.close(CLOSE);
|
|
63
|
+
if (Option.isNone(yield* Effect.timeoutOption(gone, CLOSING)))
|
|
64
|
+
socket.terminate();
|
|
65
|
+
}));
|
|
66
|
+
var carrier2 = (reader, transport) => {
|
|
67
|
+
const waiting = [];
|
|
68
|
+
return {
|
|
69
|
+
describe: () => ({ kind: "websocket" }),
|
|
70
|
+
send: (message) => Effect.gen(function* () {
|
|
71
|
+
const taken = Latch.makeUnsafe();
|
|
72
|
+
transport.send(message, () => taken.openUnsafe());
|
|
73
|
+
while (true) {
|
|
74
|
+
const held = transport.bufferedAmount;
|
|
75
|
+
if (Option.isSome(yield* Effect.timeoutOption(taken.await, STALL)))
|
|
76
|
+
return;
|
|
77
|
+
if (transport.bufferedAmount >= held)
|
|
78
|
+
return transport.terminate();
|
|
79
|
+
}
|
|
80
|
+
}),
|
|
81
|
+
receive: Effect.gen(function* () {
|
|
82
|
+
if (waiting.length === 0) {
|
|
83
|
+
const read = yield* reader.pull;
|
|
84
|
+
if (read.reduce((bytes, message) => bytes + message.length, 0) > MAX_WAITING)
|
|
85
|
+
return yield* new Link.Closed;
|
|
86
|
+
waiting.push(...read);
|
|
87
|
+
}
|
|
88
|
+
const message = waiting.shift();
|
|
89
|
+
if (message === undefined || typeof message === "string")
|
|
90
|
+
return yield* new Link.Closed;
|
|
91
|
+
return message;
|
|
92
|
+
}).pipe(Effect.mapError(() => new Link.Closed))
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
var keepalive2 = (transport) => Effect.gen(function* () {
|
|
96
|
+
const interval = { heard: true, paused: false };
|
|
97
|
+
const heard = () => {
|
|
98
|
+
interval.heard = true;
|
|
99
|
+
};
|
|
100
|
+
const events = ["pong", "ping", "message"];
|
|
101
|
+
events.forEach((event) => transport.on(event, heard));
|
|
102
|
+
yield* Effect.addFinalizer(() => Effect.sync(() => events.forEach((event) => transport.off(event, heard))));
|
|
103
|
+
while (interval.heard || interval.paused || transport.isPaused) {
|
|
104
|
+
interval.heard = false;
|
|
105
|
+
interval.paused = transport.isPaused;
|
|
106
|
+
transport.ping();
|
|
107
|
+
yield* Effect.sleep(PING);
|
|
108
|
+
}
|
|
109
|
+
transport.terminate();
|
|
110
|
+
}).pipe(Effect.scoped);
|
|
111
|
+
var makeMachineLink2 = Effect.gen(function* () {
|
|
112
|
+
const enabled = yield* machinesEnabled2;
|
|
113
|
+
const services = yield* Effect.context();
|
|
114
|
+
const handshakes = Semaphore.makeUnsafe(MAX_HANDSHAKES);
|
|
115
|
+
const scope = yield* Effect.scope;
|
|
116
|
+
const watch = yield* Watch2;
|
|
117
|
+
const server = yield* Effect.cached(Effect.acquireRelease(Effect.sync(() => {
|
|
118
|
+
const sockets = new WebSocketServer({ noServer: true, maxPayload: MAX_FRAME });
|
|
119
|
+
watch(sockets);
|
|
120
|
+
return sockets;
|
|
121
|
+
}), (sockets) => Effect.gen(function* () {
|
|
122
|
+
sockets.clients.forEach((socket) => socket.close(CLOSE));
|
|
123
|
+
const empty = Effect.callback((resume) => sockets.close(() => resume(Effect.void)));
|
|
124
|
+
if (Option.isNone(yield* Effect.timeoutOption(empty, STOPPING)))
|
|
125
|
+
sockets.clients.forEach((socket) => socket.terminate());
|
|
126
|
+
})).pipe(Scope.provide(scope)));
|
|
127
|
+
return Effect.fn("MachineLink.serve")(function* (request) {
|
|
128
|
+
const incoming = NodeHttpServerRequest.toIncomingMessage(request);
|
|
129
|
+
if (!(incoming instanceof IncomingMessage) || !isWebSocketUpgrade(request) || Option.isNone(yield* Effect.option(request.upgrade)) || !(yield* enabled))
|
|
130
|
+
return HttpServerResponse.empty({ status: 404 });
|
|
131
|
+
return yield* Effect.gen(function* () {
|
|
132
|
+
const sockets = yield* server;
|
|
133
|
+
const admitted = yield* handshakes.withPermitsIfAvailable(1)(Effect.gen(function* () {
|
|
134
|
+
const transport = yield* upgrade2(sockets, incoming);
|
|
135
|
+
yield* HttpMiddleware.withLoggerDisabled(Effect.void);
|
|
136
|
+
const socket = yield* Socket.fromWebSocket(Effect.succeed(transport));
|
|
137
|
+
const link = yield* Link.serve(carrier2(yield* socket.reader, transport)).pipe(Effect.onError(() => Effect.sync(() => drop(transport))));
|
|
138
|
+
return { transport, link };
|
|
139
|
+
}));
|
|
140
|
+
if (Option.isNone(admitted))
|
|
141
|
+
return HttpServerResponse.empty({ status: 503 });
|
|
142
|
+
yield* Effect.forkScoped(keepalive2(admitted.value.transport));
|
|
143
|
+
const machines = yield* Machines.Service;
|
|
144
|
+
yield* machines.connect(admitted.value.link.machine, admitted.value.link.connection);
|
|
145
|
+
return HttpServerResponse.empty();
|
|
146
|
+
}).pipe(Effect.scoped, Effect.orElseSucceed(() => HttpServerResponse.empty()), Effect.provide(services));
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
var makeMachine2 = Effect.gen(function* () {
|
|
150
|
+
const enabled = yield* machinesEnabled2;
|
|
151
|
+
const machines = yield* Machines.Service;
|
|
152
|
+
const requireEnabled = Effect.gen(function* () {
|
|
153
|
+
if (yield* enabled)
|
|
154
|
+
return;
|
|
155
|
+
return yield* new ForbiddenError({ message: "Machines are disabled; enable experimental.machines" });
|
|
156
|
+
});
|
|
157
|
+
const iroh = yield* Effect.cached(Iroh.listen(enabled).pipe(Effect.tapError((error) => Effect.logWarning("Machines connect over WebSockets only: Iroh is unavailable", error)), Effect.option, Scope.provide(yield* Effect.scope), Effect.provide(yield* Effect.context())));
|
|
158
|
+
yield* Effect.forkScoped(Effect.gen(function* () {
|
|
159
|
+
const list = yield* machines.list();
|
|
160
|
+
if (list.length === 0)
|
|
161
|
+
return;
|
|
162
|
+
const on = yield* enabled;
|
|
163
|
+
if (on)
|
|
164
|
+
yield* iroh;
|
|
165
|
+
}));
|
|
166
|
+
return {
|
|
167
|
+
list: Effect.fn("MachineHandler.list")(function* () {
|
|
168
|
+
yield* requireEnabled;
|
|
169
|
+
return { data: yield* machines.list() };
|
|
170
|
+
}),
|
|
171
|
+
add: Effect.fn("MachineHandler.add")(function* (payload) {
|
|
172
|
+
yield* requireEnabled;
|
|
173
|
+
const id = yield* machines.add(payload.name).pipe(Effect.catchTag("Machines.AlreadyExists", (error) => Effect.succeed(error.machine)), Effect.catchTag("Machines.InvalidName", (error) => Effect.fail(new InvalidRequestError({ message: error.message, kind: "invalid_name", field: "name" }))));
|
|
174
|
+
const reach = Option.isSome(yield* iroh) ? [...payload.reach, { type: "iroh" }] : payload.reach;
|
|
175
|
+
const join = yield* machines.invite(id, { reach, replace: payload.replace }).pipe(Effect.catchTags({
|
|
176
|
+
"Machines.AlreadyPaired": (error) => Effect.fail(new ConflictError({ message: error.message, resource: error.machine })),
|
|
177
|
+
"Machines.NotFound": (error) => Effect.fail(new MachineNotFoundError({ machine: error.machine, message: error.message })),
|
|
178
|
+
"Identity.InvalidKey": (error) => Effect.die(error)
|
|
179
|
+
}));
|
|
180
|
+
const decoded = Option.getOrUndefined(Join.decode(join));
|
|
181
|
+
if (!decoded)
|
|
182
|
+
return yield* Effect.die(new Error("Server produced an unreadable join string"));
|
|
183
|
+
return { data: { name: id, join, expires: decoded.expires, reach: decoded.reach } };
|
|
184
|
+
}),
|
|
185
|
+
remove: Effect.fn("MachineHandler.remove")(function* (name) {
|
|
186
|
+
yield* requireEnabled;
|
|
187
|
+
if (!(yield* machines.remove(Environment.ID.make(name))))
|
|
188
|
+
return yield* new MachineNotFoundError({ machine: name, message: `No machine named ${JSON.stringify(name)}.` });
|
|
189
|
+
return HttpApiSchema.NoContent.make();
|
|
190
|
+
})
|
|
191
|
+
};
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
export { Watch2, machinesEnabled2, upgrade2, carrier2, keepalive2, makeMachineLink2, makeMachine2 };
|
|
@@ -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/model.ts
|
|
10
9
|
import { Model } from "@opencode/core/model";
|
|
@@ -12,11 +11,9 @@ import { Effect } from "effect";
|
|
|
12
11
|
import { HttpApiBuilder } from "effect/http-api";
|
|
13
12
|
var ModelHandler2 = HttpApiBuilder.group(Api2, "server.model", (handlers) => Effect.gen(function* () {
|
|
14
13
|
return handlers.handle("model.list", Effect.fn(function* (ctx) {
|
|
15
|
-
yield* awaitPlugins2;
|
|
16
14
|
const models = yield* Model.Service;
|
|
17
15
|
return yield* response2(models.available(ctx.query.types));
|
|
18
16
|
})).handle("model.default", Effect.fn(function* () {
|
|
19
|
-
yield* awaitPlugins2;
|
|
20
17
|
const models = yield* Model.Service;
|
|
21
18
|
return yield* response2(models.default());
|
|
22
19
|
}));
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./content-headers-zjmacp9c.js";
|
|
4
4
|
import {
|
|
5
5
|
SESSION_TTL_SECONDS2,
|
|
6
6
|
Config2,
|
|
7
7
|
issueSession2,
|
|
8
8
|
sessionCookieName2
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./content-headers-j4at0y5c.js";
|
|
10
10
|
import {
|
|
11
11
|
Service2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./content-headers-z3e7v67k.js";
|
|
13
13
|
import {
|
|
14
14
|
Service4
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./content-headers-mzs0n5xz.js";
|
|
16
16
|
|
|
17
17
|
// src/handlers/server.ts
|
|
18
18
|
import { hostname } from "node:os";
|
|
@@ -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/form.ts
|
|
9
9
|
import { Form } from "@opencode/core/form";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
missingSession2,
|
|
3
3
|
failedMessageDecode2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./content-headers-smaf4a18.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./content-headers-zjmacp9c.js";
|
|
8
8
|
import {
|
|
9
9
|
wantsMediaRefs2
|
|
10
|
-
} from "./
|
|
10
|
+
} from "./content-headers-xthc02cw.js";
|
|
11
11
|
|
|
12
12
|
// src/handlers/message.ts
|
|
13
13
|
import { SessionMessage } from "@opencode/core/session/message";
|