@opencode/server 0.0.0-dev-19794 → 0.0.0-dev-19808
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.js +10 -9
- package/dist/auth.js +12 -17
- package/dist/chunks/workerd-00nn3k4b.js +20 -0
- package/dist/chunks/workerd-04xw3v55.js +23 -0
- package/dist/chunks/workerd-19c9ysa1.js +61 -0
- package/dist/chunks/workerd-1c4qas2w.js +346 -0
- package/dist/chunks/workerd-254zvkj6.js +22 -0
- package/dist/chunks/workerd-2rvsests.js +99 -0
- package/dist/chunks/workerd-2sy3c7de.js +83 -0
- package/dist/chunks/workerd-3kzx88w9.js +26 -0
- package/dist/chunks/workerd-4g0fa6m0.js +32 -0
- package/dist/chunks/workerd-4vn5bvkr.js +25 -0
- package/dist/chunks/workerd-5rwqcaw2.js +33 -0
- package/dist/chunks/workerd-5w24ch67.js +23 -0
- package/dist/chunks/workerd-6gkz39ey.js +55 -0
- package/dist/chunks/workerd-6nvan4e0.js +17 -0
- package/dist/chunks/workerd-6ptwb1q1.js +149 -0
- package/dist/chunks/workerd-75c938bc.js +23 -0
- package/dist/chunks/workerd-7cfyat0f.js +37 -0
- package/dist/chunks/workerd-7rzt3wm8.js +13 -0
- package/dist/chunks/workerd-8bajbwjh.js +40 -0
- package/dist/chunks/workerd-9rqn6x4v.js +16 -0
- package/dist/chunks/workerd-a6yp8301.js +156 -0
- package/dist/chunks/workerd-arj41x43.js +77 -0
- package/dist/chunks/workerd-b0b71rwa.js +39 -0
- package/dist/chunks/workerd-bjrwanme.js +22 -0
- package/dist/chunks/workerd-bkqymx4n.js +26 -0
- package/dist/chunks/workerd-br99j6q1.js +35 -0
- package/dist/chunks/workerd-ceh2h0m9.js +25 -0
- package/dist/chunks/workerd-hezj1jdf.js +7 -0
- package/dist/chunks/workerd-hjnxtxmk.js +34 -0
- package/dist/chunks/workerd-j2pfq4q6.js +42 -0
- package/dist/chunks/workerd-m6wvgbfq.js +60 -0
- package/dist/chunks/workerd-mzr9gftb.js +36 -0
- package/dist/chunks/workerd-n0er2m55.js +163 -0
- package/dist/chunks/workerd-pnqq1zxv.js +29 -0
- package/dist/chunks/workerd-q0ycym90.js +13 -0
- package/dist/chunks/workerd-q4bn6dy8.js +39 -0
- package/dist/chunks/workerd-qnwpcgp7.js +22 -0
- package/dist/chunks/workerd-qzap92t7.js +139 -0
- package/dist/chunks/workerd-r7e9r02j.js +13 -0
- package/dist/chunks/workerd-rcg4y18n.js +59 -0
- package/dist/chunks/workerd-req22b70.js +22 -0
- package/dist/chunks/workerd-smaf4a18.js +28 -0
- package/dist/chunks/workerd-t8yzmczr.js +18 -0
- package/dist/chunks/workerd-x1haxfjx.js +21 -0
- package/dist/chunks/workerd-yc7nft6q.js +5 -0
- package/dist/chunks/workerd-ysabas57.js +13 -0
- package/dist/chunks/workerd-z5shrcz9.js +19 -0
- package/dist/chunks/workerd-zp2jm6dt.js +15 -0
- package/dist/chunks/workerd-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.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.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
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__export
|
|
3
|
+
} from "./workerd-9rqn6x4v.js";
|
|
4
|
+
|
|
5
|
+
// src/auth.ts
|
|
6
|
+
var exports_auth = {};
|
|
7
|
+
__export(exports_auth, {
|
|
8
|
+
Config: () => Config2,
|
|
9
|
+
ServerAuth: () => exports_auth,
|
|
10
|
+
authorized: () => authorized2,
|
|
11
|
+
required: () => required2
|
|
12
|
+
});
|
|
13
|
+
import { Context, Layer, Option, Redacted } from "effect";
|
|
14
|
+
|
|
15
|
+
class Config2 extends Context.Service()("@opencode/ServerAuthConfig") {
|
|
16
|
+
static configLayer(input) {
|
|
17
|
+
return Layer.succeed(this, this.of({ ...input, username: "opencode" }));
|
|
18
|
+
}
|
|
19
|
+
static get layer() {
|
|
20
|
+
return this.configLayer({ password: Option.none() });
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function required2(config) {
|
|
24
|
+
return Option.isSome(config.password) && config.password.value !== "";
|
|
25
|
+
}
|
|
26
|
+
function authorized2(credentials, config) {
|
|
27
|
+
return Option.isSome(config.password) && credentials.username === config.username && Redacted.value(credentials.password) === config.password.value;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { Config2, required2, authorized2, exports_auth };
|
package/dist/cors.js
CHANGED
|
@@ -1,36 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
if (input.startsWith("http://localhost:"))
|
|
12
|
-
return !0;
|
|
13
|
-
if (input.startsWith("http://127.0.0.1:"))
|
|
14
|
-
return !0;
|
|
15
|
-
if (input.startsWith("oc://renderer"))
|
|
16
|
-
return !0;
|
|
17
|
-
if (input === "tauri://localhost" || input === "http://tauri.localhost" || input === "https://tauri.localhost")
|
|
18
|
-
return !0;
|
|
19
|
-
if (opencodeOrigin.test(input))
|
|
20
|
-
return !0;
|
|
21
|
-
return opts?.cors?.includes(input) ?? !1;
|
|
22
|
-
}
|
|
23
|
-
export function isAllowedRequestOrigin(input, host, opts) {
|
|
24
|
-
if (!input)
|
|
25
|
-
return !0;
|
|
26
|
-
if (host && sameHost(input, host))
|
|
27
|
-
return !0;
|
|
28
|
-
return isAllowedCorsOrigin(input, opts);
|
|
29
|
-
}
|
|
30
|
-
function sameHost(origin, host) {
|
|
31
|
-
try {
|
|
32
|
-
return new URL(origin).host === host;
|
|
33
|
-
} catch {
|
|
34
|
-
return !1;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
CorsConfig2,
|
|
3
|
+
isAllowedCorsOrigin2,
|
|
4
|
+
isAllowedRequestOrigin2
|
|
5
|
+
} from "./chunks/workerd-q4bn6dy8.js";
|
|
6
|
+
export {
|
|
7
|
+
CorsConfig2 as CorsConfig,
|
|
8
|
+
isAllowedCorsOrigin2 as isAllowedCorsOrigin,
|
|
9
|
+
isAllowedRequestOrigin2 as isAllowedRequestOrigin
|
|
10
|
+
};
|
package/dist/event-feed.js
CHANGED
|
@@ -1,60 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return `data: ${JSON.stringify(event)}
|
|
22
|
-
|
|
23
|
-
`;
|
|
24
|
-
}
|
|
25
|
-
export const make = Effect.fn("EventFeed.make")(function* (observe, options) {
|
|
26
|
-
const capacity = options?.capacity ?? SubscriberCapacity, render = options?.encode ?? frame, subscribers = new Set, fail = (error) => Effect.sync(() => {
|
|
27
|
-
const current = Array.from(subscribers);
|
|
28
|
-
subscribers.clear();
|
|
29
|
-
for (const subscriber of current)
|
|
30
|
-
Queue.failCauseUnsafe(subscriber, Cause.fail(error));
|
|
31
|
-
}), publish = Effect.fnUntraced(function* (event) {
|
|
32
|
-
if (!isOpenCodeEvent(event))
|
|
33
|
-
return;
|
|
34
|
-
if (subscribers.size === 0)
|
|
35
|
-
return;
|
|
36
|
-
const encoded = yield* Effect.try({
|
|
37
|
-
try: () => render(event),
|
|
38
|
-
catch: (cause) => new EncodingError({ eventID: event.id, eventType: event.type, cause })
|
|
39
|
-
}).pipe(Effect.catch((error) => Effect.logError("Failed to encode public event", {
|
|
40
|
-
eventID: error.eventID,
|
|
41
|
-
eventType: error.eventType,
|
|
42
|
-
cause: error.cause
|
|
43
|
-
}).pipe(Effect.andThen(fail(error)), Effect.as(void 0))));
|
|
44
|
-
if (encoded === void 0)
|
|
45
|
-
return;
|
|
46
|
-
for (const subscriber of subscribers) {
|
|
47
|
-
if (Queue.offerUnsafe(subscriber, encoded))
|
|
48
|
-
continue;
|
|
49
|
-
subscribers.delete(subscriber);
|
|
50
|
-
Queue.failCauseUnsafe(subscriber, Cause.fail(new SubscriberOverflowError({ capacity })));
|
|
51
|
-
}
|
|
52
|
-
}), unsubscribe = yield* observe(publish);
|
|
53
|
-
yield* Effect.addFinalizer(() => unsubscribe);
|
|
54
|
-
return Service.of({
|
|
55
|
-
subscribe: Effect.acquireRelease(Queue.dropping(capacity).pipe(Effect.tap((queue) => Effect.sync(() => subscribers.add(queue)))), (queue) => Effect.sync(() => subscribers.delete(queue)).pipe(Effect.andThen(Queue.shutdown(queue)), Effect.asVoid)).pipe(Effect.map(Stream.fromQueue))
|
|
56
|
-
});
|
|
57
|
-
}), layer = Layer.effect(Service, Effect.gen(function* () {
|
|
58
|
-
const bus = yield* Bus.Service;
|
|
59
|
-
return yield* make(bus.listen);
|
|
60
|
-
}));
|
|
1
|
+
import {
|
|
2
|
+
SubscriberCapacity2,
|
|
3
|
+
SubscriberOverflowError2,
|
|
4
|
+
EncodingError2,
|
|
5
|
+
Service2,
|
|
6
|
+
frame2,
|
|
7
|
+
make4,
|
|
8
|
+
layer2,
|
|
9
|
+
exports_event_feed
|
|
10
|
+
} from "./chunks/workerd-2sy3c7de.js";
|
|
11
|
+
export {
|
|
12
|
+
EncodingError2 as EncodingError,
|
|
13
|
+
exports_event_feed as EventFeed,
|
|
14
|
+
Service2 as Service,
|
|
15
|
+
SubscriberCapacity2 as SubscriberCapacity,
|
|
16
|
+
SubscriberOverflowError2 as SubscriberOverflowError,
|
|
17
|
+
frame2 as frame,
|
|
18
|
+
layer2 as layer,
|
|
19
|
+
make4 as make
|
|
20
|
+
};
|
package/dist/fetch.js
CHANGED
|
@@ -1,11 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import {
|
|
2
|
+
make2,
|
|
3
|
+
exports_fetch
|
|
4
|
+
} from "./chunks/workerd-bkqymx4n.js";
|
|
5
|
+
import"./chunks/workerd-6ptwb1q1.js";
|
|
6
|
+
import"./chunks/workerd-m6wvgbfq.js";
|
|
7
|
+
import"./chunks/workerd-t8yzmczr.js";
|
|
8
|
+
import"./chunks/workerd-zyv89x5n.js";
|
|
9
|
+
import"./chunks/workerd-2rvsests.js";
|
|
10
|
+
import"./chunks/workerd-7cfyat0f.js";
|
|
11
|
+
import"./chunks/workerd-q0ycym90.js";
|
|
12
|
+
import"./chunks/workerd-bjrwanme.js";
|
|
13
|
+
import"./chunks/workerd-254zvkj6.js";
|
|
14
|
+
import"./chunks/workerd-4g0fa6m0.js";
|
|
15
|
+
import"./chunks/workerd-19c9ysa1.js";
|
|
16
|
+
import"./chunks/workerd-req22b70.js";
|
|
17
|
+
import"./chunks/workerd-a6yp8301.js";
|
|
18
|
+
import"./chunks/workerd-j2pfq4q6.js";
|
|
19
|
+
import"./chunks/workerd-1c4qas2w.js";
|
|
20
|
+
import"./chunks/workerd-4vn5bvkr.js";
|
|
21
|
+
import"./chunks/workerd-8bajbwjh.js";
|
|
22
|
+
import"./chunks/workerd-ceh2h0m9.js";
|
|
23
|
+
import"./chunks/workerd-ysabas57.js";
|
|
24
|
+
import"./chunks/workerd-arj41x43.js";
|
|
25
|
+
import"./chunks/workerd-b0b71rwa.js";
|
|
26
|
+
import"./chunks/workerd-hjnxtxmk.js";
|
|
27
|
+
import"./chunks/workerd-br99j6q1.js";
|
|
28
|
+
import"./chunks/workerd-qzap92t7.js";
|
|
29
|
+
import"./chunks/workerd-x1haxfjx.js";
|
|
30
|
+
import"./chunks/workerd-6nvan4e0.js";
|
|
31
|
+
import"./chunks/workerd-qnwpcgp7.js";
|
|
32
|
+
import"./chunks/workerd-r7e9r02j.js";
|
|
33
|
+
import"./chunks/workerd-pnqq1zxv.js";
|
|
34
|
+
import"./chunks/workerd-rcg4y18n.js";
|
|
35
|
+
import"./chunks/workerd-zp2jm6dt.js";
|
|
36
|
+
import"./chunks/workerd-n0er2m55.js";
|
|
37
|
+
import"./chunks/workerd-hezj1jdf.js";
|
|
38
|
+
import"./chunks/workerd-00nn3k4b.js";
|
|
39
|
+
import"./chunks/workerd-04xw3v55.js";
|
|
40
|
+
import"./chunks/workerd-7rzt3wm8.js";
|
|
41
|
+
import"./chunks/workerd-2sy3c7de.js";
|
|
42
|
+
import"./chunks/workerd-q4bn6dy8.js";
|
|
43
|
+
import"./chunks/workerd-mzr9gftb.js";
|
|
44
|
+
import"./chunks/workerd-z5shrcz9.js";
|
|
45
|
+
import"./chunks/workerd-3kzx88w9.js";
|
|
46
|
+
import"./chunks/workerd-5rwqcaw2.js";
|
|
47
|
+
import"./chunks/workerd-6gkz39ey.js";
|
|
48
|
+
import"./chunks/workerd-smaf4a18.js";
|
|
49
|
+
import"./chunks/workerd-75c938bc.js";
|
|
50
|
+
export {
|
|
51
|
+
exports_fetch as ServerFetch,
|
|
52
|
+
make2 as make
|
|
53
|
+
};
|
package/dist/handlers/agent.js
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return yield* new AgentNotFoundError({
|
|
13
|
-
agentID: ctx.params.agentID,
|
|
14
|
-
message: `Agent not found: ${ctx.params.agentID}`
|
|
15
|
-
});
|
|
16
|
-
return yield* response(Effect.succeed(agent));
|
|
17
|
-
})));
|
|
1
|
+
import {
|
|
2
|
+
AgentHandler2
|
|
3
|
+
} from "../chunks/workerd-ceh2h0m9.js";
|
|
4
|
+
import"../chunks/workerd-z5shrcz9.js";
|
|
5
|
+
import"../chunks/workerd-3kzx88w9.js";
|
|
6
|
+
import"../chunks/workerd-5rwqcaw2.js";
|
|
7
|
+
import"../chunks/workerd-6gkz39ey.js";
|
|
8
|
+
import"../chunks/workerd-smaf4a18.js";
|
|
9
|
+
export {
|
|
10
|
+
AgentHandler2 as AgentHandler
|
|
11
|
+
};
|
package/dist/handlers/command.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
1
|
+
import {
|
|
2
|
+
CommandHandler2
|
|
3
|
+
} from "../chunks/workerd-r7e9r02j.js";
|
|
4
|
+
import"../chunks/workerd-z5shrcz9.js";
|
|
5
|
+
import"../chunks/workerd-3kzx88w9.js";
|
|
6
|
+
import"../chunks/workerd-5rwqcaw2.js";
|
|
7
|
+
import"../chunks/workerd-6gkz39ey.js";
|
|
8
|
+
import"../chunks/workerd-smaf4a18.js";
|
|
9
|
+
export {
|
|
10
|
+
CommandHandler2 as CommandHandler
|
|
11
|
+
};
|
package/dist/handlers/config.js
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
const shell = yield* ShellSelect.Service;
|
|
13
|
-
if (!shell.list)
|
|
14
|
-
return yield* Effect.die(Error("Shell discovery is unavailable"));
|
|
15
|
-
return yield* shell.list();
|
|
16
|
-
})));
|
|
1
|
+
import {
|
|
2
|
+
ConfigHandler2
|
|
3
|
+
} from "../chunks/workerd-qnwpcgp7.js";
|
|
4
|
+
import"../chunks/workerd-z5shrcz9.js";
|
|
5
|
+
import"../chunks/workerd-3kzx88w9.js";
|
|
6
|
+
import"../chunks/workerd-5rwqcaw2.js";
|
|
7
|
+
import"../chunks/workerd-6gkz39ey.js";
|
|
8
|
+
import"../chunks/workerd-smaf4a18.js";
|
|
9
|
+
export {
|
|
10
|
+
ConfigHandler2 as ConfigHandler
|
|
11
|
+
};
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
yield* (yield* Credential.Service).remove(ctx.params.credentialID);
|
|
13
|
-
return HttpApiSchema.NoContent.make();
|
|
14
|
-
})));
|
|
1
|
+
import {
|
|
2
|
+
CredentialHandler2
|
|
3
|
+
} from "../chunks/workerd-04xw3v55.js";
|
|
4
|
+
import"../chunks/workerd-z5shrcz9.js";
|
|
5
|
+
import"../chunks/workerd-3kzx88w9.js";
|
|
6
|
+
import"../chunks/workerd-5rwqcaw2.js";
|
|
7
|
+
import"../chunks/workerd-6gkz39ey.js";
|
|
8
|
+
import"../chunks/workerd-smaf4a18.js";
|
|
9
|
+
export {
|
|
10
|
+
CredentialHandler2 as CredentialHandler
|
|
11
|
+
};
|
package/dist/handlers/debug.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
DebugHandler2
|
|
3
|
+
} from "../chunks/workerd-00nn3k4b.js";
|
|
4
|
+
import"../chunks/workerd-z5shrcz9.js";
|
|
5
|
+
import"../chunks/workerd-3kzx88w9.js";
|
|
6
|
+
import"../chunks/workerd-5rwqcaw2.js";
|
|
7
|
+
import"../chunks/workerd-6gkz39ey.js";
|
|
8
|
+
import"../chunks/workerd-smaf4a18.js";
|
|
9
|
+
export {
|
|
10
|
+
DebugHandler2 as DebugHandler
|
|
11
|
+
};
|
package/dist/handlers/event.js
CHANGED
|
@@ -1,27 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
type: "server.connected",
|
|
14
|
-
data: {}
|
|
15
|
-
}, output = Stream.unwrap(feed.subscribe.pipe(Effect.map((live) => Stream.make(EventFeed.frame(connected)).pipe(Stream.concat(live))))), heartbeat = Stream.tick("15 seconds").pipe(Stream.map(() => `: heartbeat
|
|
16
|
-
|
|
17
|
-
`));
|
|
18
|
-
return HttpServerResponse.stream(output.pipe(Stream.merge(heartbeat, { haltStrategy: "left" }), Stream.encodeText), {
|
|
19
|
-
contentType: "text/event-stream",
|
|
20
|
-
headers: {
|
|
21
|
-
"Cache-Control": "no-cache, no-transform",
|
|
22
|
-
"X-Accel-Buffering": "no",
|
|
23
|
-
"X-Content-Type-Options": "nosniff"
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}));
|
|
27
|
-
}));
|
|
1
|
+
import {
|
|
2
|
+
EventHandler2
|
|
3
|
+
} from "../chunks/workerd-7cfyat0f.js";
|
|
4
|
+
import"../chunks/workerd-2sy3c7de.js";
|
|
5
|
+
import"../chunks/workerd-z5shrcz9.js";
|
|
6
|
+
import"../chunks/workerd-3kzx88w9.js";
|
|
7
|
+
import"../chunks/workerd-5rwqcaw2.js";
|
|
8
|
+
import"../chunks/workerd-6gkz39ey.js";
|
|
9
|
+
import"../chunks/workerd-smaf4a18.js";
|
|
10
|
+
export {
|
|
11
|
+
EventHandler2 as EventHandler
|
|
12
|
+
};
|
package/dist/handlers/form.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import {
|
|
2
|
+
FormHandler2
|
|
3
|
+
} from "../chunks/workerd-6nvan4e0.js";
|
|
4
|
+
import"../chunks/workerd-z5shrcz9.js";
|
|
5
|
+
import"../chunks/workerd-3kzx88w9.js";
|
|
6
|
+
import"../chunks/workerd-5rwqcaw2.js";
|
|
7
|
+
import"../chunks/workerd-6gkz39ey.js";
|
|
8
|
+
import"../chunks/workerd-smaf4a18.js";
|
|
9
|
+
export {
|
|
10
|
+
FormHandler2 as FormHandler
|
|
11
|
+
};
|
package/dist/handlers/fs.js
CHANGED
|
@@ -1,22 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
path: RelativePath.make(decodeURIComponent(new URL(ctx.request.url, "http://localhost").pathname.slice(13)))
|
|
13
|
-
}).pipe(Effect.mapError((error) => new FileNotFoundError({ path: error.path, message: `File not found: ${error.path}` })));
|
|
14
|
-
return HttpServerResponse.uint8Array(file.content, { contentType: file.mime });
|
|
15
|
-
})).handle("fs.list", (ctx) => response(Effect.gen(function* () {
|
|
16
|
-
return yield* (yield* FileSystem.Service).list(ctx.query);
|
|
17
|
-
}))).handle("fs.find", (ctx) => response(Effect.gen(function* () {
|
|
18
|
-
return yield* (yield* FileSystem.Service).find(ctx.query);
|
|
19
|
-
}))).handle("fs.write", (ctx) => response(Effect.gen(function* () {
|
|
20
|
-
return yield* (yield* FileSystem.Service).write({ path: ctx.query.path, data: ctx.payload });
|
|
21
|
-
})));
|
|
22
|
-
}));
|
|
1
|
+
import {
|
|
2
|
+
FileSystemHandler2
|
|
3
|
+
} from "../chunks/workerd-hjnxtxmk.js";
|
|
4
|
+
import"../chunks/workerd-z5shrcz9.js";
|
|
5
|
+
import"../chunks/workerd-3kzx88w9.js";
|
|
6
|
+
import"../chunks/workerd-5rwqcaw2.js";
|
|
7
|
+
import"../chunks/workerd-6gkz39ey.js";
|
|
8
|
+
import"../chunks/workerd-smaf4a18.js";
|
|
9
|
+
export {
|
|
10
|
+
FileSystemHandler2 as FileSystemHandler
|
|
11
|
+
};
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return handlers.handle("generate.text", Effect.fn("server.generate.text")(function* (request) {
|
|
13
|
-
return { data: { text: yield* (yield* Generate.Service).text(request.payload).pipe(Effect.mapError((error) => error._tag === "Generate.ModelSelectionError" ? new InvalidRequestError({ message: error.message }) : new ServiceUnavailableError({ message: error.message, service: error.service }))) } };
|
|
14
|
-
}, Effect.provide(services)));
|
|
15
|
-
}));
|
|
1
|
+
import {
|
|
2
|
+
GenerateHandler2
|
|
3
|
+
} from "../chunks/workerd-4vn5bvkr.js";
|
|
4
|
+
import"../chunks/workerd-z5shrcz9.js";
|
|
5
|
+
import"../chunks/workerd-3kzx88w9.js";
|
|
6
|
+
import"../chunks/workerd-5rwqcaw2.js";
|
|
7
|
+
import"../chunks/workerd-6gkz39ey.js";
|
|
8
|
+
import"../chunks/workerd-smaf4a18.js";
|
|
9
|
+
export {
|
|
10
|
+
GenerateHandler2 as GenerateHandler
|
|
11
|
+
};
|
|
@@ -1,143 +1,11 @@
|
|
|
1
|
-
import { Integration } from "@opencode/core/integration";
|
|
2
|
-
import { Plugin } from "@opencode/core/plugin";
|
|
3
|
-
import { Effect } from "effect";
|
|
4
|
-
import { HttpApiBuilder, HttpApiSchema } from "effect/unstable/httpapi";
|
|
5
|
-
import { Api } from "../api";
|
|
6
1
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
})));
|
|
18
|
-
export const IntegrationHandler = HttpApiBuilder.group(Api, "server.integration", (handlers) => Effect.gen(function* () {
|
|
19
|
-
return handlers.handle("integration.list", Effect.fn(function* () {
|
|
20
|
-
yield* Plugin.awaitActivation;
|
|
21
|
-
const service = yield* Integration.Service;
|
|
22
|
-
return yield* response(service.list());
|
|
23
|
-
})).handle("integration.get", Effect.fn(function* (ctx) {
|
|
24
|
-
const integration = yield* (yield* Integration.Service).get(ctx.params.integrationID);
|
|
25
|
-
if (!integration)
|
|
26
|
-
return yield* new IntegrationNotFoundError({
|
|
27
|
-
integrationID: ctx.params.integrationID,
|
|
28
|
-
message: `Integration not found: ${ctx.params.integrationID}`
|
|
29
|
-
});
|
|
30
|
-
return yield* response(Effect.succeed(integration));
|
|
31
|
-
})).handle("integration.wellknown.add", Effect.fn(function* (ctx) {
|
|
32
|
-
const wellknown = yield* WellKnown.Service, integration = yield* Integration.Service;
|
|
33
|
-
yield* wellknown.add(ctx.payload.url).pipe(Effect.mapError((error) => new InvalidRequestError({ message: error.message, kind: "well_known_discovery" })));
|
|
34
|
-
yield* integration.reload();
|
|
35
|
-
return HttpApiSchema.NoContent.make();
|
|
36
|
-
})).handle("integration.connect.key", Effect.fn(function* (ctx) {
|
|
37
|
-
const service = yield* Integration.Service;
|
|
38
|
-
if (!(yield* service.get(ctx.params.integrationID)))
|
|
39
|
-
return yield* new IntegrationNotFoundError({
|
|
40
|
-
integrationID: ctx.params.integrationID,
|
|
41
|
-
message: `Integration not found: ${ctx.params.integrationID}`
|
|
42
|
-
});
|
|
43
|
-
yield* authorize(service.connection.key({
|
|
44
|
-
integrationID: ctx.params.integrationID,
|
|
45
|
-
key: ctx.payload.key,
|
|
46
|
-
answer: ctx.payload.answer,
|
|
47
|
-
label: ctx.payload.label
|
|
48
|
-
}));
|
|
49
|
-
return HttpApiSchema.NoContent.make();
|
|
50
|
-
})).handle("integration.oauth.connect", Effect.fn(function* (ctx) {
|
|
51
|
-
const service = yield* Integration.Service;
|
|
52
|
-
return yield* response(authorize(service.oauth.connect({
|
|
53
|
-
integrationID: ctx.params.integrationID,
|
|
54
|
-
methodID: ctx.payload.methodID,
|
|
55
|
-
answer: ctx.payload.answer,
|
|
56
|
-
label: ctx.payload.label
|
|
57
|
-
})));
|
|
58
|
-
})).handle("integration.oauth.status", Effect.fn(function* (ctx) {
|
|
59
|
-
const service = yield* Integration.Service;
|
|
60
|
-
if (!(yield* service.get(ctx.params.integrationID)))
|
|
61
|
-
return yield* new IntegrationNotFoundError({
|
|
62
|
-
integrationID: ctx.params.integrationID,
|
|
63
|
-
message: `Integration not found: ${ctx.params.integrationID}`
|
|
64
|
-
});
|
|
65
|
-
return yield* response(service.oauth.status({
|
|
66
|
-
integrationID: ctx.params.integrationID,
|
|
67
|
-
attemptID: ctx.params.attemptID
|
|
68
|
-
}).pipe(Effect.mapError((error) => new IntegrationAttemptNotFoundError({
|
|
69
|
-
integrationID: error.integrationID,
|
|
70
|
-
attemptID: error.attemptID,
|
|
71
|
-
message: `OAuth attempt not found: ${error.attemptID}`
|
|
72
|
-
}))));
|
|
73
|
-
})).handle("integration.oauth.complete", Effect.fn(function* (ctx) {
|
|
74
|
-
const service = yield* Integration.Service;
|
|
75
|
-
if (!(yield* service.get(ctx.params.integrationID)))
|
|
76
|
-
return yield* new IntegrationNotFoundError({
|
|
77
|
-
integrationID: ctx.params.integrationID,
|
|
78
|
-
message: `Integration not found: ${ctx.params.integrationID}`
|
|
79
|
-
});
|
|
80
|
-
yield* service.oauth.complete({
|
|
81
|
-
integrationID: ctx.params.integrationID,
|
|
82
|
-
attemptID: ctx.params.attemptID,
|
|
83
|
-
code: ctx.payload.code
|
|
84
|
-
}).pipe(Effect.mapError((error) => {
|
|
85
|
-
if (error._tag === "Integration.AttemptNotFound")
|
|
86
|
-
return new IntegrationAttemptNotFoundError({
|
|
87
|
-
integrationID: error.integrationID,
|
|
88
|
-
attemptID: error.attemptID,
|
|
89
|
-
message: `OAuth attempt not found: ${error.attemptID}`
|
|
90
|
-
});
|
|
91
|
-
return new InvalidRequestError({
|
|
92
|
-
message: error._tag === "Integration.CodeRequired" ? "Authorization code is required" : "Authentication failed",
|
|
93
|
-
kind: error._tag === "Integration.CodeRequired" ? "integration_code_required" : "integration_authorization"
|
|
94
|
-
});
|
|
95
|
-
}));
|
|
96
|
-
return HttpApiSchema.NoContent.make();
|
|
97
|
-
})).handle("integration.oauth.cancel", Effect.fn(function* (ctx) {
|
|
98
|
-
yield* (yield* Integration.Service).oauth.cancel({
|
|
99
|
-
integrationID: ctx.params.integrationID,
|
|
100
|
-
attemptID: ctx.params.attemptID
|
|
101
|
-
});
|
|
102
|
-
return HttpApiSchema.NoContent.make();
|
|
103
|
-
})).handle("integration.command.connect", Effect.fn(function* (ctx) {
|
|
104
|
-
const service = yield* Integration.Service, integration = yield* service.get(ctx.params.integrationID);
|
|
105
|
-
if (!integration)
|
|
106
|
-
return yield* new IntegrationNotFoundError({
|
|
107
|
-
integrationID: ctx.params.integrationID,
|
|
108
|
-
message: `Integration not found: ${ctx.params.integrationID}`
|
|
109
|
-
});
|
|
110
|
-
if (!integration.methods.some((method) => method.type === "command" && method.id === ctx.payload.methodID))
|
|
111
|
-
return yield* new IntegrationMethodNotFoundError({
|
|
112
|
-
integrationID: ctx.params.integrationID,
|
|
113
|
-
methodID: ctx.payload.methodID,
|
|
114
|
-
message: `Integration method not found: ${ctx.payload.methodID}`
|
|
115
|
-
});
|
|
116
|
-
return yield* response(authorize(service.command.connect({
|
|
117
|
-
integrationID: ctx.params.integrationID,
|
|
118
|
-
methodID: ctx.payload.methodID,
|
|
119
|
-
label: ctx.payload.label
|
|
120
|
-
})));
|
|
121
|
-
})).handle("integration.command.status", Effect.fn(function* (ctx) {
|
|
122
|
-
const service = yield* Integration.Service;
|
|
123
|
-
if (!(yield* service.get(ctx.params.integrationID)))
|
|
124
|
-
return yield* new IntegrationNotFoundError({
|
|
125
|
-
integrationID: ctx.params.integrationID,
|
|
126
|
-
message: `Integration not found: ${ctx.params.integrationID}`
|
|
127
|
-
});
|
|
128
|
-
return yield* response(service.command.status({
|
|
129
|
-
integrationID: ctx.params.integrationID,
|
|
130
|
-
attemptID: ctx.params.attemptID
|
|
131
|
-
}).pipe(Effect.mapError((error) => new IntegrationAttemptNotFoundError({
|
|
132
|
-
integrationID: error.integrationID,
|
|
133
|
-
attemptID: error.attemptID,
|
|
134
|
-
message: `Command attempt not found: ${error.attemptID}`
|
|
135
|
-
}))));
|
|
136
|
-
})).handle("integration.command.cancel", Effect.fn(function* (ctx) {
|
|
137
|
-
yield* (yield* Integration.Service).command.cancel({
|
|
138
|
-
integrationID: ctx.params.integrationID,
|
|
139
|
-
attemptID: ctx.params.attemptID
|
|
140
|
-
});
|
|
141
|
-
return HttpApiSchema.NoContent.make();
|
|
142
|
-
}));
|
|
143
|
-
}));
|
|
2
|
+
IntegrationHandler2
|
|
3
|
+
} from "../chunks/workerd-a6yp8301.js";
|
|
4
|
+
import"../chunks/workerd-z5shrcz9.js";
|
|
5
|
+
import"../chunks/workerd-3kzx88w9.js";
|
|
6
|
+
import"../chunks/workerd-5rwqcaw2.js";
|
|
7
|
+
import"../chunks/workerd-6gkz39ey.js";
|
|
8
|
+
import"../chunks/workerd-smaf4a18.js";
|
|
9
|
+
export {
|
|
10
|
+
IntegrationHandler2 as IntegrationHandler
|
|
11
|
+
};
|