authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-09-05 01:38:51-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-05 01:38:51-07:00
log62e4ae400555e62a42d5cb401d744ba6dd0b401b
tree2470a90d38de9de3824f52bb157589befdfa22ce
parenta98dad77e15ef37d7fd6fc21e73434527a1fb21d
signature Signed by PGP key B5690EEEBB952194

refactor(codex): keep app-server client internals private (#10035)


3 files changed, 10 insertions(+), 16 deletions(-)

packages/effect-codex-app-server/src/_internal/shared.ts+1-1
......@@ -5,7 +5,7 @@ import * as CodexError from "../errors.ts";
55
66export const JsonRpcId = Schema.Union([Schema.Number, Schema.String]);
77
8export const JsonRpcError = Schema.Struct({
8const JsonRpcError = Schema.Struct({
99 code: Schema.Number,
1010 message: Schema.String,
1111 data: Schema.optional(Schema.Unknown),
packages/effect-codex-app-server/src/client.ts+1-6
......@@ -84,7 +84,7 @@ type ServerNotificationHandler = (
8484 payload: unknown,
8585) => Effect.Effect<void, CodexError.CodexAppServerError>;
8686
87export const make = Effect.fn("effect-codex-app-server/CodexAppServerClient.make")(function* (
87const make = Effect.fn("effect-codex-app-server/CodexAppServerClient.make")(function* (
8888 stdio: Stdio.Stdio,
8989 options: CodexAppServerClientOptions = {},
9090 terminationError?: Effect.Effect<CodexError.CodexAppServerError>,
......@@ -250,11 +250,6 @@ export const make = Effect.fn("effect-codex-app-server/CodexAppServerClient.make
250250 });
251251});
252252
253export const layer = (
254 stdio: Stdio.Stdio,
255 options: CodexAppServerClientOptions = {},
256): Layer.Layer<CodexAppServerClient> => Layer.effect(CodexAppServerClient, make(stdio, options));
257
258253export const layerChildProcess = (
259254 handle: ChildProcessSpawner.ChildProcessHandle,
260255 options: CodexAppServerClientOptions = {},
packages/effect-codex-app-server/src/errors.ts+8-9
......@@ -1,15 +1,15 @@
11import * as Schema from "effect/Schema";
22import type * as SchemaIssue from "effect/SchemaIssue";
33
4export const CodexAppServerRequestOperation = Schema.Literals([
4const CodexAppServerRequestOperation = Schema.Literals([
55 "decode-payload",
66 "encode-payload",
77 "handle-request",
88 "receive-response",
99]);
10export type CodexAppServerRequestOperation = typeof CodexAppServerRequestOperation.Type;
10type CodexAppServerRequestOperation = typeof CodexAppServerRequestOperation.Type;
1111
12export const CodexAppServerSchemaIssueKind = Schema.Literals([
12const CodexAppServerSchemaIssueKind = Schema.Literals([
1313 "Filter",
1414 "Encoding",
1515 "Pointer",
......@@ -22,9 +22,9 @@ export const CodexAppServerSchemaIssueKind = Schema.Literals([
2222 "Forbidden",
2323 "OneOf",
2424]);
25export type CodexAppServerSchemaIssueKind = typeof CodexAppServerSchemaIssueKind.Type;
25type CodexAppServerSchemaIssueKind = typeof CodexAppServerSchemaIssueKind.Type;
2626
27export interface CodexAppServerSchemaIssueDiagnostics {
27interface CodexAppServerSchemaIssueDiagnostics {
2828 readonly issueCount: number;
2929 readonly issueKinds: ReadonlyArray<CodexAppServerSchemaIssueKind>;
3030 readonly maximumPathDepth: number;
......@@ -62,7 +62,7 @@ const schemaIssueDiagnostics = (root: SchemaIssue.Issue): CodexAppServerSchemaIs
6262 };
6363};
6464
65export const CodexAppServerPayloadKind = Schema.Literals([
65const CodexAppServerPayloadKind = Schema.Literals([
6666 "null",
6767 "array",
6868 "string",
......@@ -74,7 +74,7 @@ export const CodexAppServerPayloadKind = Schema.Literals([
7474 "function",
7575 "undefined",
7676]);
77export type CodexAppServerPayloadKind = typeof CodexAppServerPayloadKind.Type;
77type CodexAppServerPayloadKind = typeof CodexAppServerPayloadKind.Type;
7878
7979const payloadKind = (payload: unknown): CodexAppServerPayloadKind => {
8080 if (payload === null) return "null";
......@@ -84,8 +84,7 @@ const payloadKind = (payload: unknown): CodexAppServerPayloadKind => {
8484
8585const protocolMessageFields = ["id", "method", "params", "result", "error"] as const;
8686
87export const CodexAppServerProtocolMessageField = Schema.Literals(protocolMessageFields);
88export type CodexAppServerProtocolMessageField = typeof CodexAppServerProtocolMessageField.Type;
87const CodexAppServerProtocolMessageField = Schema.Literals(protocolMessageFields);
8988
9089export interface CodexAppServerRequestDiagnostics {
9190 readonly method?: string;