Refactor open service onto Effect-backed process spawning
- Add external opener support alongside browser/editor launches - Remove the `open` dependency and cover platform behavior in tests
This commit is contained in:
1 parent
48fc85e7fe
commit
2ade03788b
7 files changed
+1134
-437
No files matched your search
@@ -63,6 +63,8 @@ const asThreadId = (value: string): ThreadId => ThreadId.makeUnsafe(value);
|
||||
const asTurnId = (value: string): TurnId => TurnId.makeUnsafe(value);
|
||||
|
||||
const defaultOpenService: OpenShape = {
|
||||
getAvailableEditors: Effect.succeed([]),
|
||||
openExternal: () => Effect.void,
|
||||
openBrowser: () => Effect.void,
|
||||
openInEditor: () => Effect.void,
|
||||
};
|
||||
@@ -1030,6 +1032,8 @@ describe("WebSocket Server", () => {
|
||||
it("routes shell.openInEditor through the injected open service", async () => {
|
||||
const openCalls: Array<{ cwd: string; editor: string }> = [];
|
||||
const openService: OpenShape = {
|
||||
getAvailableEditors: Effect.succeed([]),
|
||||
openExternal: () => Effect.void,
|
||||
openBrowser: () => Effect.void,
|
||||
openInEditor: (input) => {
|
||||
openCalls.push({ cwd: input.cwd, editor: input.editor });
|
||||
@@ -1531,6 +1535,8 @@ describe("WebSocket Server", () => {
|
||||
process.on("unhandledRejection", onUnhandledRejection);
|
||||
|
||||
const brokenOpenService: OpenShape = {
|
||||
getAvailableEditors: Effect.succeed([]),
|
||||
openExternal: () => Effect.void,
|
||||
openBrowser: () => Effect.void,
|
||||
openInEditor: () =>
|
||||
Effect.sync(() => BigInt(1)).pipe(Effect.map((result) => result as unknown as void)),
|
||||
|
||||
Reference in new issue
Block a user