Address Codex review feedback
Co-authored-by: codex <[email protected]>
This commit is contained in:
1 parent
46fb2a207d
commit
625f049017
5 files changed
+75
-8
No files matched your search
@@ -121,4 +121,34 @@ it.layer(NodeServices.layer)("effect-codex-app-server client", (it) => {
|
||||
]);
|
||||
}),
|
||||
);
|
||||
|
||||
it.effect("initializes a command-backed app-server client", () =>
|
||||
Effect.gen(function* () {
|
||||
const path = yield* Path.Path;
|
||||
const scope = yield* Scope.make();
|
||||
const clientLayer = CodexClient.layerCommand({
|
||||
command: "bun",
|
||||
args: ["run", yield* mockPeerPath],
|
||||
cwd: path.join(import.meta.dirname, ".."),
|
||||
});
|
||||
const context = yield* Layer.buildWithScope(clientLayer, scope);
|
||||
|
||||
const initialized = yield* Effect.gen(function* () {
|
||||
const client = yield* CodexClient.CodexAppServerClient;
|
||||
return yield* client.request("initialize", {
|
||||
clientInfo: {
|
||||
name: "effect-codex-app-server-test",
|
||||
title: "Effect Codex App Server Test",
|
||||
version: "0.0.0",
|
||||
},
|
||||
capabilities: {
|
||||
experimentalApi: true,
|
||||
optOutNotificationMethods: null,
|
||||
},
|
||||
});
|
||||
}).pipe(Effect.provide(context), Effect.ensuring(Scope.close(scope, Exit.void)));
|
||||
|
||||
assert.equal(initialized.userAgent, "mock-codex-app-server");
|
||||
}),
|
||||
);
|
||||
});
|
||||
@@ -281,7 +281,7 @@ export const layerCommand = (
|
||||
...(options.env ? { env: { ...process.env, ...options.env } } : {}),
|
||||
shell: process.platform === "win32",
|
||||
});
|
||||
const handle = yield* spawner.spawn(command).pipe(
|
||||
return yield* spawner.spawn(command).pipe(
|
||||
Effect.mapError(
|
||||
(cause) =>
|
||||
new CodexError.CodexAppServerSpawnError({
|
||||
@@ -290,9 +290,11 @@ export const layerCommand = (
|
||||
}),
|
||||
),
|
||||
);
|
||||
const client = yield* make(makeChildStdio(handle), options, makeTerminationError(handle));
|
||||
return { client, handle };
|
||||
}),
|
||||
({ handle }) => handle.kill().pipe(Effect.orDie),
|
||||
).pipe(Effect.map(({ client }) => client)),
|
||||
(handle) => handle.kill().pipe(Effect.orDie),
|
||||
).pipe(
|
||||
Effect.flatMap((handle) =>
|
||||
make(makeChildStdio(handle), options, makeTerminationError(handle)),
|
||||
),
|
||||
),
|
||||
);
|
||||
Reference in new issue
Block a user