@opencode/server 2.2.2 → 2.2.4
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 +191 -1
- package/dist/api.js +5 -5
- package/dist/auth.js +1 -1
- package/dist/chunks/{workerd-ze052fvn.js → event-feed-04phqjtk.js} +17 -15
- package/dist/chunks/{workerd-059rbh9c.js → event-feed-059rbh9c.js} +1 -1
- package/dist/chunks/{workerd-zmgfywqd.js → event-feed-05c5061t.js} +1 -1
- package/dist/chunks/{workerd-r5696se6.js → event-feed-0e81et3m.js} +3 -3
- package/dist/chunks/{workerd-0pbbhyf6.js → event-feed-0ey2b45p.js} +2 -2
- package/dist/chunks/event-feed-0fv515j7.js +144 -0
- package/dist/chunks/{workerd-wqv43pj9.js → event-feed-0j6zxxn8.js} +2 -2
- package/dist/chunks/{workerd-zyntahe8.js → event-feed-0n4tjm17.js} +1 -1
- package/dist/chunks/event-feed-2wexxjwf.js +61 -0
- package/dist/chunks/{workerd-0q7s66m2.js → event-feed-39nnfjx1.js} +4 -4
- package/dist/chunks/{workerd-370cpmna.js → event-feed-4p2y0qs3.js} +2 -2
- package/dist/chunks/{workerd-gqq6kfhc.js → event-feed-50bbk3b2.js} +3 -3
- package/dist/chunks/{workerd-zhns4s2s.js → event-feed-5dbnrgeg.js} +2 -2
- package/dist/chunks/{workerd-7b9xm1qg.js → event-feed-7b9xm1qg.js} +1 -1
- package/dist/chunks/{workerd-5z5anmwp.js → event-feed-89egwzf3.js} +2 -2
- package/dist/chunks/{workerd-2qjvs0kv.js → event-feed-8wqj6mpn.js} +4 -4
- package/dist/chunks/{workerd-vtfzy3at.js → event-feed-9grnt8dc.js} +2 -2
- package/dist/chunks/{workerd-fvqb5t8b.js → event-feed-axe8xgk8.js} +27 -9
- package/dist/chunks/{workerd-yet0vexm.js → event-feed-b3bmdkga.js} +1 -1
- package/dist/chunks/{workerd-xpg37vzc.js → event-feed-b4mqtccx.js} +2 -2
- package/dist/chunks/{workerd-7cd61xtm.js → event-feed-dx89xydc.js} +2 -2
- package/dist/chunks/{workerd-2835150m.js → event-feed-et00mhwf.js} +2 -2
- package/dist/chunks/{workerd-rxyx8sa0.js → event-feed-f8r9p2vr.js} +2 -2
- package/dist/chunks/{workerd-wh109kze.js → event-feed-g2961dtz.js} +8 -8
- package/dist/chunks/{workerd-jc2vwkyw.js → event-feed-h1thjy6x.js} +2 -2
- package/dist/chunks/{workerd-gk0yxcp6.js → event-feed-htyf2qs7.js} +1 -1
- package/dist/chunks/{workerd-0e4fm4yw.js → event-feed-hx8bsq9d.js} +1 -1
- package/dist/chunks/{workerd-j4at0y5c.js → event-feed-j4at0y5c.js} +1 -1
- package/dist/chunks/{workerd-50xc6x42.js → event-feed-kg0ybx4v.js} +3 -3
- package/dist/chunks/{workerd-5553qfcy.js → event-feed-m119esdv.js} +3 -3
- package/dist/chunks/{workerd-yemng8y6.js → event-feed-m9ezm2eq.js} +6 -6
- package/dist/chunks/{workerd-1s3664te.js → event-feed-mzqcpmk1.js} +4 -4
- package/dist/chunks/{workerd-kqr36gas.js → event-feed-mzs0n5xz.js} +7 -7
- package/dist/chunks/{workerd-4gk9fc6f.js → event-feed-n1zdbfv7.js} +29 -4
- package/dist/chunks/{workerd-71pkxez6.js → event-feed-ndcq61v8.js} +35 -35
- package/dist/chunks/{workerd-7tewdwsb.js → event-feed-nz17qv97.js} +2 -2
- package/dist/chunks/{workerd-xbqm7mpj.js → event-feed-q44yktpv.js} +2 -2
- package/dist/chunks/{workerd-20b2yx1f.js → event-feed-qfyg9gb7.js} +7 -7
- package/dist/chunks/{workerd-vfkjeyp3.js → event-feed-r6xkfcdx.js} +1 -1
- package/dist/chunks/{workerd-f4exzdsf.js → event-feed-s62wjkvx.js} +2 -2
- package/dist/chunks/{workerd-skcryrty.js → event-feed-s9tkswmw.js} +2 -2
- package/dist/chunks/{workerd-7x1re4zg.js → event-feed-v8aqacn3.js} +2 -2
- package/dist/chunks/{workerd-sqxx1p54.js → event-feed-vbgqk0mr.js} +2 -2
- package/dist/chunks/{workerd-vvp99hc9.js → event-feed-x4b2rtcb.js} +1 -1
- package/dist/chunks/{workerd-7dtbad8d.js → event-feed-z3e7v67k.js} +7 -7
- package/dist/chunks/{workerd-74kxthdf.js → event-feed-zbe9jfhy.js} +1 -1
- package/dist/chunks/{workerd-z9kgby92.js → event-feed-zvbhqxt5.js} +4 -4
- package/dist/cors.js +1 -1
- package/dist/event-feed.js +5 -5
- package/dist/fetch.js +54 -53
- package/dist/handlers/agent.js +6 -6
- package/dist/handlers/artifact.d.ts +62 -0
- package/dist/handlers/artifact.js +8 -0
- package/dist/handlers/command.js +6 -6
- package/dist/handlers/config.js +6 -6
- package/dist/handlers/credential.d.ts +3 -1
- package/dist/handlers/credential.js +7 -6
- package/dist/handlers/debug.js +6 -6
- package/dist/handlers/event.js +7 -7
- package/dist/handlers/form.js +6 -6
- package/dist/handlers/fs.js +6 -6
- package/dist/handlers/generate.js +6 -6
- package/dist/handlers/integration.d.ts +5 -0
- package/dist/handlers/integration.js +9 -7
- package/dist/handlers/location.js +6 -6
- package/dist/handlers/mcp.js +8 -8
- package/dist/handlers/media.js +1 -1
- 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 +11 -10
- 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/schedule.d.ts +30 -0
- package/dist/handlers/schedule.js +2 -2
- 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 +48 -47
- package/dist/location.js +4 -4
- package/dist/media-uri.js +1 -1
- package/dist/middleware/authorization.js +2 -2
- package/dist/middleware/form-location.js +3 -3
- package/dist/middleware/schema-error.js +1 -1
- package/dist/middleware/session-location.js +3 -3
- package/dist/pairing.js +3 -3
- package/dist/process.js +57 -56
- package/dist/request-tracing.js +1 -1
- package/dist/routes.d.ts +3 -2
- package/dist/routes.js +51 -50
- package/dist/server-info.js +5 -5
- package/dist/service-status.js +3 -3
- package/dist/workerd.d.ts +4 -3
- package/dist/workerd.js +69 -54
- package/package.json +9 -9
- package/dist/chunks/workerd-hdwd22w5.js +0 -47
- /package/dist/chunks/{workerd-9rqn6x4v.js → event-feed-9rqn6x4v.js} +0 -0
- /package/dist/chunks/{workerd-bd8755ek.js → event-feed-bd8755ek.js} +0 -0
- /package/dist/chunks/{workerd-h6rt5k9s.js → event-feed-h6rt5k9s.js} +0 -0
- /package/dist/chunks/{workerd-n321d8vm.js → event-feed-n321d8vm.js} +0 -0
- /package/dist/chunks/{workerd-q4bn6dy8.js → event-feed-q4bn6dy8.js} +0 -0
- /package/dist/chunks/{workerd-smaf4a18.js → event-feed-smaf4a18.js} +0 -0
- /package/dist/chunks/{workerd-xthc02cw.js → event-feed-xthc02cw.js} +0 -0
- /package/dist/chunks/{workerd-yc7nft6q.js → event-feed-yc7nft6q.js} +0 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import {
|
|
2
|
+
missingSession2
|
|
3
|
+
} from "./event-feed-smaf4a18.js";
|
|
4
|
+
import {
|
|
5
|
+
locationErrors2,
|
|
6
|
+
awaitPlugins2,
|
|
7
|
+
response2,
|
|
8
|
+
requestRef2
|
|
9
|
+
} from "./event-feed-50bbk3b2.js";
|
|
10
|
+
|
|
11
|
+
// src/handlers/artifact.ts
|
|
12
|
+
import { Artifact } from "@opencode/core/artifact";
|
|
13
|
+
import { KV } from "@opencode/core/kv";
|
|
14
|
+
import { Location } from "@opencode/core/location";
|
|
15
|
+
import { LocationServiceMap } from "@opencode/core/location-service-map";
|
|
16
|
+
import { AbsolutePath } from "@opencode/core/schema";
|
|
17
|
+
import { Session } from "@opencode/core/session";
|
|
18
|
+
import {
|
|
19
|
+
ArtifactNotFoundError,
|
|
20
|
+
FileNotFoundError,
|
|
21
|
+
ForbiddenError,
|
|
22
|
+
InvalidRequestError,
|
|
23
|
+
ProviderNotFoundError,
|
|
24
|
+
ServiceUnavailableError
|
|
25
|
+
} from "@opencode/protocol/errors";
|
|
26
|
+
import { Effect } from "effect";
|
|
27
|
+
import { HttpServerResponse } from "effect/http";
|
|
28
|
+
import { HttpApiSchema } from "effect/http-api";
|
|
29
|
+
var makeArtifact2 = Effect.gen(function* () {
|
|
30
|
+
const locations = yield* LocationServiceMap.Service;
|
|
31
|
+
const sessions = yield* Session.Service;
|
|
32
|
+
const kv = yield* KV.Service;
|
|
33
|
+
const explicitDirectory = (request, location) => {
|
|
34
|
+
if (location?.directory !== undefined)
|
|
35
|
+
return location.directory;
|
|
36
|
+
const query = new URL(request.url, "http://localhost").searchParams.get("location[directory]");
|
|
37
|
+
if (query)
|
|
38
|
+
return query;
|
|
39
|
+
const header = request.headers["x-opencode-directory"];
|
|
40
|
+
if (!header)
|
|
41
|
+
return;
|
|
42
|
+
try {
|
|
43
|
+
return decodeURIComponent(header);
|
|
44
|
+
} catch {
|
|
45
|
+
return header;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const resolveLocation = (request, options) => Effect.gen(function* () {
|
|
49
|
+
const requestedDir = explicitDirectory(request, options.location);
|
|
50
|
+
if (requestedDir !== undefined) {
|
|
51
|
+
return Location.Ref.make({ directory: AbsolutePath.make(requestedDir) });
|
|
52
|
+
}
|
|
53
|
+
if (options.sessionID !== undefined) {
|
|
54
|
+
const session = yield* sessions.get(options.sessionID).pipe(Effect.mapError(missingSession2));
|
|
55
|
+
return session.location;
|
|
56
|
+
}
|
|
57
|
+
if (options.artifactID !== undefined) {
|
|
58
|
+
const directory = yield* Artifact.locate(kv, options.artifactID);
|
|
59
|
+
if (directory !== undefined) {
|
|
60
|
+
return Location.Ref.make({ directory: AbsolutePath.make(directory) });
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return requestRef2(request);
|
|
64
|
+
});
|
|
65
|
+
const inLocation = (request, options, effect) => Effect.gen(function* () {
|
|
66
|
+
const ref = yield* resolveLocation(request, options);
|
|
67
|
+
return yield* awaitPlugins2.pipe(Effect.andThen(effect), Effect.provide(locations.get(ref)), locationErrors2);
|
|
68
|
+
});
|
|
69
|
+
const mapCommon = (effect) => effect.pipe(Effect.catchTags({
|
|
70
|
+
"Artifact.DisabledError": (error) => Effect.fail(new ForbiddenError({ message: error.message })),
|
|
71
|
+
"Artifact.NotFoundError": (error) => Effect.fail(new ArtifactNotFoundError({ artifactID: error.artifactID, message: error.message })),
|
|
72
|
+
"Artifact.ProviderNotFoundError": (error) => Effect.fail(new ProviderNotFoundError({ providerID: error.providerID, message: error.message })),
|
|
73
|
+
"Artifact.InvalidError": (error) => Effect.fail(new InvalidRequestError({ message: error.message, kind: "artifact_invalid", field: error.field })),
|
|
74
|
+
"Artifact.ProviderError": (error) => Effect.fail(new ServiceUnavailableError({ message: error.message, service: error.providerID })),
|
|
75
|
+
"Session.NotFoundError": (error) => Effect.fail(missingSession2(error))
|
|
76
|
+
}));
|
|
77
|
+
return {
|
|
78
|
+
providers: (query, request) => inLocation(request, { location: query.location }, Effect.gen(function* () {
|
|
79
|
+
const artifacts = yield* Artifact.Service;
|
|
80
|
+
return yield* response2(artifacts.providers());
|
|
81
|
+
})).pipe(mapCommon),
|
|
82
|
+
list: (query, request) => inLocation(request, { location: query.location, sessionID: query.sessionID }, Effect.gen(function* () {
|
|
83
|
+
const artifacts = yield* Artifact.Service;
|
|
84
|
+
return yield* response2(artifacts.list({ sessionID: query.sessionID, provider: query.provider }));
|
|
85
|
+
})).pipe(mapCommon),
|
|
86
|
+
create: (query, payload, request) => inLocation(request, { location: query.location, sessionID: payload.sessionID }, Effect.gen(function* () {
|
|
87
|
+
const artifacts = yield* Artifact.Service;
|
|
88
|
+
return yield* response2(artifacts.create(payload));
|
|
89
|
+
})).pipe(mapCommon),
|
|
90
|
+
get: (artifactID, query, request) => inLocation(request, { location: query.location, artifactID }, Effect.gen(function* () {
|
|
91
|
+
const artifacts = yield* Artifact.Service;
|
|
92
|
+
return yield* response2(artifacts.get(artifactID));
|
|
93
|
+
})).pipe(mapCommon),
|
|
94
|
+
update: (artifactID, query, payload, request) => inLocation(request, { location: query.location, sessionID: payload.sessionID, artifactID }, Effect.gen(function* () {
|
|
95
|
+
const artifacts = yield* Artifact.Service;
|
|
96
|
+
return yield* response2(artifacts.update(artifactID, payload));
|
|
97
|
+
})).pipe(mapCommon),
|
|
98
|
+
remove: (artifactID, query, request) => inLocation(request, { location: query.location, artifactID }, Effect.gen(function* () {
|
|
99
|
+
const artifacts = yield* Artifact.Service;
|
|
100
|
+
yield* artifacts.remove(artifactID);
|
|
101
|
+
return HttpApiSchema.NoContent.make();
|
|
102
|
+
})).pipe(mapCommon),
|
|
103
|
+
view: (artifactID, query, request) => inLocation(request, { location: query.location, artifactID }, Effect.gen(function* () {
|
|
104
|
+
const artifacts = yield* Artifact.Service;
|
|
105
|
+
const parsed = new URL(request.url, "http://localhost");
|
|
106
|
+
const prefix = `/api/experimental/artifacts/${encodeURIComponent(artifactID)}/view`;
|
|
107
|
+
if (parsed.pathname === prefix) {
|
|
108
|
+
yield* artifacts.info(artifactID);
|
|
109
|
+
return HttpServerResponse.empty({
|
|
110
|
+
status: 308,
|
|
111
|
+
headers: { location: `${prefix}/${parsed.search}` }
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
const subpath = extractViewSubpath(request.url, artifactID);
|
|
115
|
+
const file = yield* artifacts.readLocalFile(artifactID, subpath).pipe(Effect.catchTag("Artifact.FileMissingError", (error) => Effect.fail(new FileNotFoundError({ path: error.path, message: error.message }))));
|
|
116
|
+
return HttpServerResponse.uint8Array(file.bytes, {
|
|
117
|
+
status: 200,
|
|
118
|
+
contentType: file.mime,
|
|
119
|
+
headers: {
|
|
120
|
+
"access-control-allow-origin": "*",
|
|
121
|
+
"cache-control": "private, no-cache",
|
|
122
|
+
"content-security-policy": "sandbox allow-scripts",
|
|
123
|
+
"x-content-type-options": "nosniff"
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
})).pipe(mapCommon)
|
|
127
|
+
};
|
|
128
|
+
});
|
|
129
|
+
function extractViewSubpath(url, artifactID) {
|
|
130
|
+
const pathname = new URL(url, "http://localhost").pathname;
|
|
131
|
+
const prefix = `/api/experimental/artifacts/${encodeURIComponent(artifactID)}/view/`;
|
|
132
|
+
if (!pathname.startsWith(prefix))
|
|
133
|
+
return;
|
|
134
|
+
const raw = pathname.slice(prefix.length);
|
|
135
|
+
if (!raw)
|
|
136
|
+
return;
|
|
137
|
+
try {
|
|
138
|
+
return decodeURIComponent(raw);
|
|
139
|
+
} catch {
|
|
140
|
+
return raw;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export { makeArtifact2 };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
locationErrors2,
|
|
3
3
|
awaitPlugins2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./event-feed-50bbk3b2.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./event-feed-0e81et3m.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/generate.ts
|
|
10
10
|
import { Generate } from "@opencode/core/generate";
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Api2
|
|
3
|
+
} from "./event-feed-0e81et3m.js";
|
|
4
|
+
import {
|
|
5
|
+
requireConnectable2
|
|
6
|
+
} from "./event-feed-n1zdbfv7.js";
|
|
7
|
+
|
|
8
|
+
// src/handlers/credential.ts
|
|
9
|
+
import { Credential } from "@opencode/core/credential";
|
|
10
|
+
import { FileSystem } from "@opencode/core/filesystem";
|
|
11
|
+
import { Location } from "@opencode/core/location";
|
|
12
|
+
import { LocationServiceMap } from "@opencode/core/location-services";
|
|
13
|
+
import { AbsolutePath } from "@opencode/core/schema";
|
|
14
|
+
import { ConflictError } from "@opencode/protocol/errors";
|
|
15
|
+
import { Global } from "@opencode/util/global";
|
|
16
|
+
import { Effect } from "effect";
|
|
17
|
+
import { HttpApiBuilder, HttpApiSchema } from "effect/http-api";
|
|
18
|
+
var CredentialHandler2 = HttpApiBuilder.group(Api2, "server.credential", (handlers) => Effect.gen(function* () {
|
|
19
|
+
const global = yield* Global.Service;
|
|
20
|
+
const locations = yield* LocationServiceMap.Service;
|
|
21
|
+
const services = locations.get(Location.Ref.make({ directory: AbsolutePath.make(global.config) }));
|
|
22
|
+
return handlers.handle("credential.list", Effect.fn(function* () {
|
|
23
|
+
const credential = yield* Credential.Service;
|
|
24
|
+
return { data: entries(yield* credential.all()) };
|
|
25
|
+
})).handle("credential.create", Effect.fn(function* (ctx) {
|
|
26
|
+
yield* requireConnectable2(ctx.payload.integrationID).pipe(Effect.provide(services), Effect.catchIf((error) => error instanceof FileSystem.DirectoryNotFoundError, Effect.die));
|
|
27
|
+
const credential = yield* Credential.Service;
|
|
28
|
+
if (ctx.payload.id && (yield* credential.get(ctx.payload.id)))
|
|
29
|
+
return yield* new ConflictError({
|
|
30
|
+
resource: ctx.payload.id,
|
|
31
|
+
message: `Credential already exists: ${ctx.payload.id}`
|
|
32
|
+
});
|
|
33
|
+
const created = yield* credential.create(ctx.payload);
|
|
34
|
+
const entry = entries(yield* credential.list(created.integrationID)).find((item) => item.id === created.id);
|
|
35
|
+
return { data: entry ?? { ...created, active: false } };
|
|
36
|
+
})).handle("credential.update", Effect.fn(function* (ctx) {
|
|
37
|
+
const credential = yield* Credential.Service;
|
|
38
|
+
yield* credential.update(ctx.params.credentialID, { label: ctx.payload.label });
|
|
39
|
+
return HttpApiSchema.NoContent.make();
|
|
40
|
+
})).handle("credential.activate", Effect.fn(function* (ctx) {
|
|
41
|
+
const credential = yield* Credential.Service;
|
|
42
|
+
yield* credential.activate(ctx.params.credentialID);
|
|
43
|
+
return HttpApiSchema.NoContent.make();
|
|
44
|
+
})).handle("credential.remove", Effect.fn(function* (ctx) {
|
|
45
|
+
const credential = yield* Credential.Service;
|
|
46
|
+
yield* credential.remove(ctx.params.credentialID);
|
|
47
|
+
return HttpApiSchema.NoContent.make();
|
|
48
|
+
}));
|
|
49
|
+
}));
|
|
50
|
+
function entries(credentials) {
|
|
51
|
+
const selected = new Map(credentials.map((item) => [item.integrationID, item.id]));
|
|
52
|
+
return credentials.map((item) => ({
|
|
53
|
+
id: item.id,
|
|
54
|
+
integrationID: item.integrationID,
|
|
55
|
+
label: item.label,
|
|
56
|
+
active: selected.get(item.integrationID) === item.id,
|
|
57
|
+
value: item.value
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { CredentialHandler2 };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__export
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./event-feed-9rqn6x4v.js";
|
|
4
4
|
|
|
5
5
|
// src/service-status.ts
|
|
6
6
|
var exports_service_status = {};
|
|
7
7
|
__export(exports_service_status, {
|
|
8
8
|
Status: () => exports_service_status,
|
|
9
|
-
make: () =>
|
|
9
|
+
make: () => make2
|
|
10
10
|
});
|
|
11
11
|
import { Effect, Ref } from "effect";
|
|
12
|
-
var
|
|
12
|
+
var make2 = Effect.fnUntraced(function* (options = {}) {
|
|
13
13
|
const current = yield* Ref.make(options.initial ?? { type: "starting" });
|
|
14
14
|
const beginStopping = Ref.update(current, (status) => status.type === "stopping" ? status : { type: "stopping" });
|
|
15
15
|
return {
|
|
@@ -20,4 +20,4 @@ var make4 = Effect.fnUntraced(function* (options = {}) {
|
|
|
20
20
|
};
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
export {
|
|
23
|
+
export { make2, exports_service_status };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
awaitPlugins2,
|
|
3
3
|
response2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./event-feed-50bbk3b2.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./event-feed-0e81et3m.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/model.ts
|
|
10
10
|
import { Model } from "@opencode/core/model";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
missingSession2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./event-feed-smaf4a18.js";
|
|
4
4
|
|
|
5
5
|
// src/location.ts
|
|
6
6
|
import { FileSystem } from "@opencode/core/filesystem";
|
|
@@ -59,7 +59,7 @@ function decode(input) {
|
|
|
59
59
|
return input;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
var
|
|
62
|
+
var layer4 = Layer.effect(LocationMiddleware2, Effect.gen(function* () {
|
|
63
63
|
const locations = yield* LocationServiceMap.Service;
|
|
64
64
|
return LocationMiddleware2.of((effect) => Effect.gen(function* () {
|
|
65
65
|
const request = yield* HttpServerRequest.HttpServerRequest;
|
|
@@ -67,4 +67,4 @@ var layer3 = Layer.effect(LocationMiddleware2, Effect.gen(function* () {
|
|
|
67
67
|
}));
|
|
68
68
|
}));
|
|
69
69
|
|
|
70
|
-
export { LocationMiddleware2, locationErrors2, awaitPlugins2, response2, sessionInfo2, requestRef2,
|
|
70
|
+
export { LocationMiddleware2, locationErrors2, awaitPlugins2, response2, sessionInfo2, requestRef2, layer4 };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./event-feed-0e81et3m.js";
|
|
4
4
|
import {
|
|
5
5
|
Service3,
|
|
6
6
|
frame2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./event-feed-qfyg9gb7.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/event.ts
|
|
10
10
|
import { Event } from "@opencode/schema/event";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
awaitPlugins2,
|
|
3
3
|
response2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./event-feed-50bbk3b2.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./event-feed-0e81et3m.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/usage.ts
|
|
10
10
|
import { UsageLimits } from "@opencode/core/usage-limits";
|
|
@@ -2,17 +2,17 @@ import {
|
|
|
2
2
|
locationErrors2,
|
|
3
3
|
response2,
|
|
4
4
|
requestRef2
|
|
5
|
-
} from "./
|
|
5
|
+
} from "./event-feed-50bbk3b2.js";
|
|
6
6
|
import {
|
|
7
7
|
Api2
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./event-feed-0e81et3m.js";
|
|
9
9
|
import {
|
|
10
10
|
CorsConfig2,
|
|
11
11
|
isAllowedRequestOrigin2
|
|
12
|
-
} from "./
|
|
12
|
+
} from "./event-feed-q4bn6dy8.js";
|
|
13
13
|
import {
|
|
14
14
|
runPtySocket2
|
|
15
|
-
} from "./
|
|
15
|
+
} from "./event-feed-h6rt5k9s.js";
|
|
16
16
|
|
|
17
17
|
// src/handlers/pty.ts
|
|
18
18
|
import { Pty } from "@opencode/core/pty";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
awaitPlugins2,
|
|
3
3
|
response2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./event-feed-50bbk3b2.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./event-feed-0e81et3m.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/provider.ts
|
|
10
10
|
import { Provider } from "@opencode/core/provider";
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./event-feed-0e81et3m.js";
|
|
4
4
|
import {
|
|
5
5
|
CorsConfig2,
|
|
6
6
|
isAllowedRequestOrigin2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./event-feed-q4bn6dy8.js";
|
|
8
|
+
import {
|
|
9
|
+
makeArtifact2
|
|
10
|
+
} from "./event-feed-0fv515j7.js";
|
|
8
11
|
import {
|
|
9
12
|
makeMediaGet2
|
|
10
|
-
} from "./
|
|
13
|
+
} from "./event-feed-n321d8vm.js";
|
|
11
14
|
import {
|
|
12
15
|
runPtySocket2
|
|
13
|
-
} from "./
|
|
16
|
+
} from "./event-feed-h6rt5k9s.js";
|
|
14
17
|
import {
|
|
15
18
|
makeSchedule2
|
|
16
|
-
} from "./
|
|
19
|
+
} from "./event-feed-059rbh9c.js";
|
|
17
20
|
|
|
18
21
|
// src/handlers/persistent-pty.ts
|
|
19
22
|
import { PersistentPty } from "@opencode/core/persistent-pty";
|
|
@@ -21,6 +24,7 @@ import { PtyTicket } from "@opencode/core/pty/ticket";
|
|
|
21
24
|
import {
|
|
22
25
|
ForbiddenError,
|
|
23
26
|
InvalidRequestError,
|
|
27
|
+
PtyFeatureUnsupportedError,
|
|
24
28
|
PtyNotFoundError,
|
|
25
29
|
ServiceUnavailableError
|
|
26
30
|
} from "@opencode/protocol/errors";
|
|
@@ -37,9 +41,10 @@ var PersistentPtyHandler2 = HttpApiBuilder.group(Api2, "server.experimental", (h
|
|
|
37
41
|
const tickets = yield* PtyTicket.Service;
|
|
38
42
|
const cors = yield* CorsConfig2;
|
|
39
43
|
const pty = yield* PersistentPty.Service;
|
|
44
|
+
const artifact = yield* makeArtifact2;
|
|
40
45
|
const mediaGet = yield* makeMediaGet2;
|
|
41
46
|
const schedule = yield* makeSchedule2;
|
|
42
|
-
return handlers.handleRaw("media.get", (ctx) => mediaGet(ctx.params.hash, ctx.request)).handle("schedule.create", (ctx) => schedule.create(ctx.payload)).handle("schedule.list", (ctx) => schedule.list(ctx.query.sessionID)).handle("schedule.get", (ctx) => schedule.get(ctx.params.scheduleID)).handle("schedule.pause", (ctx) => schedule.pause(ctx.params.scheduleID)).handle("schedule.resume", (ctx) => schedule.resume(ctx.params.scheduleID)).handle("schedule.delete", (ctx) => schedule.remove(ctx.params.scheduleID)).handle("persistentPty.read", Effect.fn(function* (ctx) {
|
|
47
|
+
return handlers.handleRaw("media.get", (ctx) => mediaGet(ctx.params.hash, ctx.request)).handle("artifacts.providers", (ctx) => artifact.providers(ctx.query, ctx.request)).handle("artifacts.list", (ctx) => artifact.list(ctx.query, ctx.request)).handle("artifacts.create", (ctx) => artifact.create(ctx.query, ctx.payload, ctx.request)).handle("artifacts.get", (ctx) => artifact.get(ctx.params.artifactID, ctx.query, ctx.request)).handle("artifacts.update", (ctx) => artifact.update(ctx.params.artifactID, ctx.query, ctx.payload, ctx.request)).handle("artifacts.delete", (ctx) => artifact.remove(ctx.params.artifactID, ctx.query, ctx.request)).handleRaw("artifacts.view", (ctx) => artifact.view(ctx.params.artifactID, ctx.query, ctx.request)).handle("schedule.create", (ctx) => schedule.create(ctx.payload)).handle("schedule.list", (ctx) => schedule.list(ctx.query.sessionID)).handle("schedule.get", (ctx) => schedule.get(ctx.params.scheduleID)).handle("schedule.pause", (ctx) => schedule.pause(ctx.params.scheduleID)).handle("schedule.resume", (ctx) => schedule.resume(ctx.params.scheduleID)).handle("schedule.delete", (ctx) => schedule.remove(ctx.params.scheduleID)).handle("persistentPty.read", Effect.fn(function* (ctx) {
|
|
43
48
|
return { data: yield* pty.read(ctx.params.sessionID, ctx.query.lines).pipe(mapUnavailable) };
|
|
44
49
|
})).handle("persistentPty.list", Effect.fn(function* (ctx) {
|
|
45
50
|
return { data: yield* pty.list(ctx.params.sessionID).pipe(mapUnavailable) };
|
|
@@ -66,8 +71,20 @@ var PersistentPtyHandler2 = HttpApiBuilder.group(Api2, "server.experimental", (h
|
|
|
66
71
|
})).handle("persistentPty.get", Effect.fn(function* (ctx) {
|
|
67
72
|
return { data: yield* pty.get(ctx.params.ptyID).pipe(mapTerminalError) };
|
|
68
73
|
})).handle("persistentPty.update", Effect.fn(function* (ctx) {
|
|
69
|
-
|
|
70
|
-
|
|
74
|
+
if (ctx.payload.size)
|
|
75
|
+
yield* pty.resize(ctx.params.ptyID, ctx.payload.size.cols, ctx.payload.size.rows, ctx.payload.attachmentID).pipe(mapTerminalError);
|
|
76
|
+
if (ctx.payload.title === undefined)
|
|
77
|
+
return { data: yield* pty.get(ctx.params.ptyID).pipe(mapTerminalError) };
|
|
78
|
+
return {
|
|
79
|
+
data: yield* pty.rename(ctx.params.ptyID, ctx.payload.title).pipe(Effect.catchTags({
|
|
80
|
+
"PersistentPty.NotFoundError": notFound,
|
|
81
|
+
"PersistentPty.UnsupportedError": (error) => new PtyFeatureUnsupportedError({
|
|
82
|
+
feature: error.feature,
|
|
83
|
+
message: "Terminal renaming will be available after OpenCode's terminal service restarts"
|
|
84
|
+
}),
|
|
85
|
+
"PersistentPty.UnavailableError": unavailable
|
|
86
|
+
}))
|
|
87
|
+
};
|
|
71
88
|
})).handle("persistentPty.snapshot", Effect.fn(function* (ctx) {
|
|
72
89
|
return { data: yield* pty.snapshot(ctx.params.ptyID).pipe(mapTerminalError) };
|
|
73
90
|
})).handle("persistentPty.remove", Effect.fn(function* (ctx) {
|
|
@@ -166,9 +183,10 @@ var PersistentPtyHandler2 = HttpApiBuilder.group(Api2, "server.experimental", (h
|
|
|
166
183
|
}));
|
|
167
184
|
var mapUnavailable = (effect) => effect.pipe(Effect.catchTag("PersistentPty.UnavailableError", unavailable));
|
|
168
185
|
var mapTerminalError = (effect) => effect.pipe(Effect.catchTags({
|
|
169
|
-
"PersistentPty.NotFoundError":
|
|
186
|
+
"PersistentPty.NotFoundError": notFound,
|
|
170
187
|
"PersistentPty.UnavailableError": unavailable
|
|
171
188
|
}));
|
|
189
|
+
var notFound = (error) => new PtyNotFoundError({ ptyID: error.ptyID, message: `PTY session not found: ${error.ptyID}` });
|
|
172
190
|
var unavailable = (error) => new ServiceUnavailableError({ message: error.message, service: "opencode-pty" });
|
|
173
191
|
|
|
174
192
|
export { PersistentPtyHandler2 };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
response2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./event-feed-50bbk3b2.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./event-feed-0e81et3m.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/command.ts
|
|
9
9
|
import { Command } from "@opencode/core/command";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
awaitPlugins2,
|
|
3
3
|
response2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./event-feed-50bbk3b2.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./event-feed-0e81et3m.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/websearch.ts
|
|
10
10
|
import { WebSearch } from "@opencode/core/websearch";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
locationErrors2,
|
|
3
3
|
awaitPlugins2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./event-feed-50bbk3b2.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./event-feed-0e81et3m.js";
|
|
8
8
|
|
|
9
9
|
// src/handlers/voice.ts
|
|
10
10
|
import { Location } from "@opencode/core/location";
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Api2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./event-feed-0e81et3m.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 "./event-feed-j4at0y5c.js";
|
|
13
10
|
import {
|
|
14
11
|
Service2
|
|
15
|
-
} from "./
|
|
12
|
+
} from "./event-feed-z3e7v67k.js";
|
|
13
|
+
import {
|
|
14
|
+
Service4
|
|
15
|
+
} from "./event-feed-mzs0n5xz.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* Service4;
|
|
26
26
|
const auth = yield* Config2;
|
|
27
27
|
return handlers.handle("server.info", () => Effect.gen(function* () {
|
|
28
|
-
const info = yield*
|
|
28
|
+
const info = yield* Service2;
|
|
29
29
|
return {
|
|
30
30
|
version: info.app.version ?? "unknown",
|
|
31
31
|
pid: process.pid ?? 0,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
requestRef2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./event-feed-50bbk3b2.js";
|
|
4
4
|
import {
|
|
5
5
|
Api2
|
|
6
|
-
} from "./
|
|
6
|
+
} from "./event-feed-0e81et3m.js";
|
|
7
7
|
|
|
8
8
|
// src/handlers/debug.ts
|
|
9
9
|
import { LocationServiceMap } from "@opencode/core/location-service-map";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
missingSession2
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./event-feed-smaf4a18.js";
|
|
4
4
|
import {
|
|
5
5
|
locationErrors2,
|
|
6
6
|
response2,
|
|
7
7
|
sessionInfo2
|
|
8
|
-
} from "./
|
|
8
|
+
} from "./event-feed-50bbk3b2.js";
|
|
9
9
|
import {
|
|
10
10
|
Api2
|
|
11
|
-
} from "./
|
|
11
|
+
} from "./event-feed-0e81et3m.js";
|
|
12
12
|
|
|
13
13
|
// src/handlers/permission.ts
|
|
14
14
|
import { Instance } from "@opencode/core/instance/service";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
missingSession2,
|
|
3
3
|
failedMessageDecode2
|
|
4
|
-
} from "./
|
|
4
|
+
} from "./event-feed-smaf4a18.js";
|
|
5
5
|
import {
|
|
6
6
|
Api2
|
|
7
|
-
} from "./
|
|
7
|
+
} from "./event-feed-0e81et3m.js";
|
|
8
8
|
import {
|
|
9
9
|
wantsMediaRefs2
|
|
10
|
-
} from "./
|
|
10
|
+
} from "./event-feed-xthc02cw.js";
|
|
11
11
|
|
|
12
12
|
// src/handlers/message.ts
|
|
13
13
|
import { SessionMessage } from "@opencode/core/session/message";
|