@opencode/server 2.0.7 → 2.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api.d.ts +4 -4
- package/dist/api.js +10 -9
- package/dist/auth.js +12 -17
- package/dist/chunks/fetch-00nn3k4b.js +20 -0
- package/dist/chunks/fetch-04xw3v55.js +23 -0
- package/dist/chunks/fetch-0d9kah4z.js +23 -0
- package/dist/chunks/fetch-19c9ysa1.js +61 -0
- package/dist/chunks/fetch-1c4qas2w.js +346 -0
- package/dist/chunks/fetch-254zvkj6.js +22 -0
- package/dist/chunks/fetch-3kzx88w9.js +26 -0
- package/dist/chunks/fetch-4cf3x1kw.js +21 -0
- package/dist/chunks/fetch-4g0fa6m0.js +32 -0
- package/dist/chunks/fetch-4vn5bvkr.js +25 -0
- package/dist/chunks/fetch-5rwqcaw2.js +33 -0
- package/dist/chunks/fetch-6gkz39ey.js +55 -0
- package/dist/chunks/fetch-6nvan4e0.js +17 -0
- package/dist/chunks/fetch-7rzt3wm8.js +13 -0
- package/dist/chunks/fetch-8bajbwjh.js +40 -0
- package/dist/chunks/fetch-99sfd1j8.js +83 -0
- package/dist/chunks/fetch-9rqn6x4v.js +16 -0
- package/dist/chunks/fetch-a6yp8301.js +156 -0
- package/dist/chunks/fetch-arj41x43.js +77 -0
- package/dist/chunks/fetch-b0b71rwa.js +39 -0
- package/dist/chunks/fetch-bjrwanme.js +22 -0
- package/dist/chunks/fetch-br99j6q1.js +35 -0
- package/dist/chunks/fetch-ceh2h0m9.js +25 -0
- package/dist/chunks/fetch-csspsf0t.js +99 -0
- package/dist/chunks/fetch-d4bshj6j.js +37 -0
- package/dist/chunks/fetch-hezj1jdf.js +7 -0
- package/dist/chunks/fetch-hjnxtxmk.js +34 -0
- package/dist/chunks/fetch-j2pfq4q6.js +42 -0
- package/dist/chunks/fetch-m6wvgbfq.js +60 -0
- package/dist/chunks/fetch-n0er2m55.js +163 -0
- package/dist/chunks/fetch-pnqq1zxv.js +29 -0
- package/dist/chunks/fetch-q0ycym90.js +13 -0
- package/dist/chunks/fetch-q4bn6dy8.js +39 -0
- package/dist/chunks/fetch-qm92ga5h.js +26 -0
- package/dist/chunks/fetch-qnwpcgp7.js +22 -0
- package/dist/chunks/fetch-r7e9r02j.js +13 -0
- package/dist/chunks/fetch-rcg4y18n.js +59 -0
- package/dist/chunks/fetch-req22b70.js +22 -0
- package/dist/chunks/fetch-s4aja1df.js +36 -0
- package/dist/chunks/fetch-smaf4a18.js +28 -0
- package/dist/chunks/fetch-t8yzmczr.js +18 -0
- package/dist/chunks/fetch-vgpejxxy.js +149 -0
- package/dist/chunks/fetch-xsrtpxyd.js +23 -0
- package/dist/chunks/fetch-yc7nft6q.js +5 -0
- package/dist/chunks/fetch-ychamt23.js +139 -0
- package/dist/chunks/fetch-ysabas57.js +13 -0
- package/dist/chunks/fetch-z5shrcz9.js +19 -0
- package/dist/chunks/fetch-zp2jm6dt.js +15 -0
- package/dist/chunks/fetch-zyv89x5n.js +30 -0
- package/dist/cors.js +10 -36
- package/dist/event-feed.js +20 -60
- package/dist/fetch.js +53 -11
- package/dist/handlers/agent.js +11 -17
- package/dist/handlers/command.js +11 -5
- package/dist/handlers/config.js +11 -16
- package/dist/handlers/credential.js +11 -14
- package/dist/handlers/debug.js +11 -11
- package/dist/handlers/event.js +12 -27
- package/dist/handlers/form.js +11 -9
- package/dist/handlers/fs.js +11 -22
- package/dist/handlers/generate.js +11 -15
- package/dist/handlers/integration.js +10 -142
- package/dist/handlers/location.js +11 -16
- package/dist/handlers/mcp.js +11 -31
- package/dist/handlers/message.js +10 -42
- package/dist/handlers/migration.js +11 -7
- package/dist/handlers/model.js +11 -14
- package/dist/handlers/permission.js +11 -57
- package/dist/handlers/persistent-pty.js +12 -135
- package/dist/handlers/plugin.js +11 -47
- package/dist/handlers/project.js +11 -9
- package/dist/handlers/provider.js +11 -20
- package/dist/handlers/pty-socket.js +6 -4
- package/dist/handlers/pty.js +13 -107
- package/dist/handlers/reference.js +11 -5
- package/dist/handlers/rpc.js +11 -15
- package/dist/handlers/server.js +12 -13
- package/dist/handlers/session-error.js +12 -26
- package/dist/handlers/session.js +10 -311
- package/dist/handlers/shell.js +11 -25
- package/dist/handlers/skill.js +11 -5
- package/dist/handlers/vcs.js +11 -19
- package/dist/handlers/websearch.js +11 -31
- package/dist/handlers/worktree.js +11 -37
- package/dist/handlers.d.ts +1 -1
- package/dist/handlers.js +46 -33
- package/dist/location.js +15 -49
- package/dist/middleware/authorization.js +11 -49
- package/dist/middleware/form-location.js +10 -25
- package/dist/middleware/schema-error.js +8 -15
- package/dist/middleware/session-location.js +10 -19
- package/dist/options.js +5 -1
- package/dist/process.js +108 -28
- package/dist/pty-environment.js +12 -9
- package/dist/request-tracing.js +6 -2
- package/dist/routes.d.ts +2 -2
- package/dist/routes.js +52 -118
- package/dist/server-info.js +12 -22
- package/dist/service-status.js +8 -11
- package/dist/workerd.js +80 -12
- package/package.json +8 -8
package/dist/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
|
+
Service4,
|
|
6
|
+
frame2,
|
|
7
|
+
make4,
|
|
8
|
+
layer5,
|
|
9
|
+
exports_event_feed
|
|
10
|
+
} from "./chunks/fetch-99sfd1j8.js";
|
|
11
|
+
export {
|
|
12
|
+
EncodingError2 as EncodingError,
|
|
13
|
+
exports_event_feed as EventFeed,
|
|
14
|
+
Service4 as Service,
|
|
15
|
+
SubscriberCapacity2 as SubscriberCapacity,
|
|
16
|
+
SubscriberOverflowError2 as SubscriberOverflowError,
|
|
17
|
+
frame2 as frame,
|
|
18
|
+
layer5 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
|
+
make3,
|
|
3
|
+
exports_fetch
|
|
4
|
+
} from "./chunks/fetch-qm92ga5h.js";
|
|
5
|
+
import"./chunks/fetch-vgpejxxy.js";
|
|
6
|
+
import"./chunks/fetch-m6wvgbfq.js";
|
|
7
|
+
import"./chunks/fetch-t8yzmczr.js";
|
|
8
|
+
import"./chunks/fetch-zyv89x5n.js";
|
|
9
|
+
import"./chunks/fetch-csspsf0t.js";
|
|
10
|
+
import"./chunks/fetch-4vn5bvkr.js";
|
|
11
|
+
import"./chunks/fetch-br99j6q1.js";
|
|
12
|
+
import"./chunks/fetch-qnwpcgp7.js";
|
|
13
|
+
import"./chunks/fetch-req22b70.js";
|
|
14
|
+
import"./chunks/fetch-04xw3v55.js";
|
|
15
|
+
import"./chunks/fetch-bjrwanme.js";
|
|
16
|
+
import"./chunks/fetch-ceh2h0m9.js";
|
|
17
|
+
import"./chunks/fetch-8bajbwjh.js";
|
|
18
|
+
import"./chunks/fetch-hjnxtxmk.js";
|
|
19
|
+
import"./chunks/fetch-254zvkj6.js";
|
|
20
|
+
import"./chunks/fetch-a6yp8301.js";
|
|
21
|
+
import"./chunks/fetch-rcg4y18n.js";
|
|
22
|
+
import"./chunks/fetch-6nvan4e0.js";
|
|
23
|
+
import"./chunks/fetch-r7e9r02j.js";
|
|
24
|
+
import"./chunks/fetch-ychamt23.js";
|
|
25
|
+
import"./chunks/fetch-ysabas57.js";
|
|
26
|
+
import"./chunks/fetch-j2pfq4q6.js";
|
|
27
|
+
import"./chunks/fetch-19c9ysa1.js";
|
|
28
|
+
import"./chunks/fetch-1c4qas2w.js";
|
|
29
|
+
import"./chunks/fetch-7rzt3wm8.js";
|
|
30
|
+
import"./chunks/fetch-zp2jm6dt.js";
|
|
31
|
+
import"./chunks/fetch-q0ycym90.js";
|
|
32
|
+
import"./chunks/fetch-pnqq1zxv.js";
|
|
33
|
+
import"./chunks/fetch-4g0fa6m0.js";
|
|
34
|
+
import"./chunks/fetch-4cf3x1kw.js";
|
|
35
|
+
import"./chunks/fetch-d4bshj6j.js";
|
|
36
|
+
import"./chunks/fetch-00nn3k4b.js";
|
|
37
|
+
import"./chunks/fetch-n0er2m55.js";
|
|
38
|
+
import"./chunks/fetch-hezj1jdf.js";
|
|
39
|
+
import"./chunks/fetch-b0b71rwa.js";
|
|
40
|
+
import"./chunks/fetch-arj41x43.js";
|
|
41
|
+
import"./chunks/fetch-s4aja1df.js";
|
|
42
|
+
import"./chunks/fetch-q4bn6dy8.js";
|
|
43
|
+
import"./chunks/fetch-0d9kah4z.js";
|
|
44
|
+
import"./chunks/fetch-z5shrcz9.js";
|
|
45
|
+
import"./chunks/fetch-3kzx88w9.js";
|
|
46
|
+
import"./chunks/fetch-5rwqcaw2.js";
|
|
47
|
+
import"./chunks/fetch-6gkz39ey.js";
|
|
48
|
+
import"./chunks/fetch-smaf4a18.js";
|
|
49
|
+
import"./chunks/fetch-99sfd1j8.js";
|
|
50
|
+
export {
|
|
51
|
+
exports_fetch as ServerFetch,
|
|
52
|
+
make3 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/fetch-ceh2h0m9.js";
|
|
4
|
+
import"../chunks/fetch-z5shrcz9.js";
|
|
5
|
+
import"../chunks/fetch-3kzx88w9.js";
|
|
6
|
+
import"../chunks/fetch-5rwqcaw2.js";
|
|
7
|
+
import"../chunks/fetch-6gkz39ey.js";
|
|
8
|
+
import"../chunks/fetch-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/fetch-r7e9r02j.js";
|
|
4
|
+
import"../chunks/fetch-z5shrcz9.js";
|
|
5
|
+
import"../chunks/fetch-3kzx88w9.js";
|
|
6
|
+
import"../chunks/fetch-5rwqcaw2.js";
|
|
7
|
+
import"../chunks/fetch-6gkz39ey.js";
|
|
8
|
+
import"../chunks/fetch-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/fetch-qnwpcgp7.js";
|
|
4
|
+
import"../chunks/fetch-z5shrcz9.js";
|
|
5
|
+
import"../chunks/fetch-3kzx88w9.js";
|
|
6
|
+
import"../chunks/fetch-5rwqcaw2.js";
|
|
7
|
+
import"../chunks/fetch-6gkz39ey.js";
|
|
8
|
+
import"../chunks/fetch-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/fetch-04xw3v55.js";
|
|
4
|
+
import"../chunks/fetch-z5shrcz9.js";
|
|
5
|
+
import"../chunks/fetch-3kzx88w9.js";
|
|
6
|
+
import"../chunks/fetch-5rwqcaw2.js";
|
|
7
|
+
import"../chunks/fetch-6gkz39ey.js";
|
|
8
|
+
import"../chunks/fetch-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/fetch-00nn3k4b.js";
|
|
4
|
+
import"../chunks/fetch-z5shrcz9.js";
|
|
5
|
+
import"../chunks/fetch-3kzx88w9.js";
|
|
6
|
+
import"../chunks/fetch-5rwqcaw2.js";
|
|
7
|
+
import"../chunks/fetch-6gkz39ey.js";
|
|
8
|
+
import"../chunks/fetch-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/fetch-d4bshj6j.js";
|
|
4
|
+
import"../chunks/fetch-z5shrcz9.js";
|
|
5
|
+
import"../chunks/fetch-3kzx88w9.js";
|
|
6
|
+
import"../chunks/fetch-5rwqcaw2.js";
|
|
7
|
+
import"../chunks/fetch-6gkz39ey.js";
|
|
8
|
+
import"../chunks/fetch-smaf4a18.js";
|
|
9
|
+
import"../chunks/fetch-99sfd1j8.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/fetch-6nvan4e0.js";
|
|
4
|
+
import"../chunks/fetch-z5shrcz9.js";
|
|
5
|
+
import"../chunks/fetch-3kzx88w9.js";
|
|
6
|
+
import"../chunks/fetch-5rwqcaw2.js";
|
|
7
|
+
import"../chunks/fetch-6gkz39ey.js";
|
|
8
|
+
import"../chunks/fetch-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/fetch-hjnxtxmk.js";
|
|
4
|
+
import"../chunks/fetch-z5shrcz9.js";
|
|
5
|
+
import"../chunks/fetch-3kzx88w9.js";
|
|
6
|
+
import"../chunks/fetch-5rwqcaw2.js";
|
|
7
|
+
import"../chunks/fetch-6gkz39ey.js";
|
|
8
|
+
import"../chunks/fetch-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/fetch-4vn5bvkr.js";
|
|
4
|
+
import"../chunks/fetch-z5shrcz9.js";
|
|
5
|
+
import"../chunks/fetch-3kzx88w9.js";
|
|
6
|
+
import"../chunks/fetch-5rwqcaw2.js";
|
|
7
|
+
import"../chunks/fetch-6gkz39ey.js";
|
|
8
|
+
import"../chunks/fetch-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/fetch-a6yp8301.js";
|
|
4
|
+
import"../chunks/fetch-z5shrcz9.js";
|
|
5
|
+
import"../chunks/fetch-3kzx88w9.js";
|
|
6
|
+
import"../chunks/fetch-5rwqcaw2.js";
|
|
7
|
+
import"../chunks/fetch-6gkz39ey.js";
|
|
8
|
+
import"../chunks/fetch-smaf4a18.js";
|
|
9
|
+
export {
|
|
10
|
+
IntegrationHandler2 as IntegrationHandler
|
|
11
|
+
};
|
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
directory: location.directory,
|
|
13
|
-
project: location.project
|
|
14
|
-
});
|
|
15
|
-
})).handle("location.reload", () => LocationServiceMap.reload().pipe(Effect.provideService(LocationServiceMap.Service, locations), Effect.catchCause((cause) => Cause.hasInterruptsOnly(cause) ? Effect.failCause(cause) : Effect.fail(new ServiceUnavailableError({ message: Cause.pretty(cause), service: "location" })))));
|
|
16
|
-
}));
|
|
1
|
+
import {
|
|
2
|
+
LocationHandler2
|
|
3
|
+
} from "../chunks/fetch-req22b70.js";
|
|
4
|
+
import"../chunks/fetch-z5shrcz9.js";
|
|
5
|
+
import"../chunks/fetch-3kzx88w9.js";
|
|
6
|
+
import"../chunks/fetch-5rwqcaw2.js";
|
|
7
|
+
import"../chunks/fetch-6gkz39ey.js";
|
|
8
|
+
import"../chunks/fetch-smaf4a18.js";
|
|
9
|
+
export {
|
|
10
|
+
LocationHandler2 as LocationHandler
|
|
11
|
+
};
|
package/dist/handlers/mcp.js
CHANGED
|
@@ -1,31 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
})).handle("mcp.add", Effect.fn(function* (ctx) {
|
|
13
|
-
yield* (yield* Mcp.Service).add(ctx.params.server, ctx.payload.config);
|
|
14
|
-
return HttpApiSchema.NoContent.make();
|
|
15
|
-
})).handle("mcp.remove", Effect.fn(function* (ctx) {
|
|
16
|
-
const service = yield* Mcp.Service;
|
|
17
|
-
yield* notFound(service.remove(ctx.params.server));
|
|
18
|
-
return HttpApiSchema.NoContent.make();
|
|
19
|
-
})).handle("mcp.connect", Effect.fn(function* (ctx) {
|
|
20
|
-
const service = yield* Mcp.Service;
|
|
21
|
-
yield* notFound(service.connect(ctx.params.server));
|
|
22
|
-
return HttpApiSchema.NoContent.make();
|
|
23
|
-
})).handle("mcp.disconnect", Effect.fn(function* (ctx) {
|
|
24
|
-
const service = yield* Mcp.Service;
|
|
25
|
-
yield* notFound(service.disconnect(ctx.params.server));
|
|
26
|
-
return HttpApiSchema.NoContent.make();
|
|
27
|
-
})).handle("mcp.resource.catalog", Effect.fn(function* () {
|
|
28
|
-
const service = yield* Mcp.Service;
|
|
29
|
-
return yield* response(service.resourceCatalog());
|
|
30
|
-
}));
|
|
31
|
-
}));
|
|
1
|
+
import {
|
|
2
|
+
McpHandler2
|
|
3
|
+
} from "../chunks/fetch-8bajbwjh.js";
|
|
4
|
+
import"../chunks/fetch-z5shrcz9.js";
|
|
5
|
+
import"../chunks/fetch-3kzx88w9.js";
|
|
6
|
+
import"../chunks/fetch-5rwqcaw2.js";
|
|
7
|
+
import"../chunks/fetch-6gkz39ey.js";
|
|
8
|
+
import"../chunks/fetch-smaf4a18.js";
|
|
9
|
+
export {
|
|
10
|
+
McpHandler2 as McpHandler
|
|
11
|
+
};
|