refactor(codex): keep app-server client internals private (#10035)
This commit is contained in:
1 parent
a98dad77e1
commit
62e4ae4005
3 files changed
+10
-16
No files matched your search
@@ -5,7 +5,7 @@ import * as CodexError from "../errors.ts";
|
||||
|
||||
export const JsonRpcId = Schema.Union([Schema.Number, Schema.String]);
|
||||
|
||||
export const JsonRpcError = Schema.Struct({
|
||||
const JsonRpcError = Schema.Struct({
|
||||
code: Schema.Number,
|
||||
message: Schema.String,
|
||||
data: Schema.optional(Schema.Unknown),
|
||||
|
||||
@@ -84,7 +84,7 @@ type ServerNotificationHandler = (
|
||||
payload: unknown,
|
||||
) => Effect.Effect<void, CodexError.CodexAppServerError>;
|
||||
|
||||
export const make = Effect.fn("effect-codex-app-server/CodexAppServerClient.make")(function* (
|
||||
const make = Effect.fn("effect-codex-app-server/CodexAppServerClient.make")(function* (
|
||||
stdio: Stdio.Stdio,
|
||||
options: CodexAppServerClientOptions = {},
|
||||
terminationError?: Effect.Effect<CodexError.CodexAppServerError>,
|
||||
@@ -250,11 +250,6 @@ export const make = Effect.fn("effect-codex-app-server/CodexAppServerClient.make
|
||||
});
|
||||
});
|
||||
|
||||
export const layer = (
|
||||
stdio: Stdio.Stdio,
|
||||
options: CodexAppServerClientOptions = {},
|
||||
): Layer.Layer<CodexAppServerClient> => Layer.effect(CodexAppServerClient, make(stdio, options));
|
||||
|
||||
export const layerChildProcess = (
|
||||
handle: ChildProcessSpawner.ChildProcessHandle,
|
||||
options: CodexAppServerClientOptions = {},
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import * as Schema from "effect/Schema";
|
||||
import type * as SchemaIssue from "effect/SchemaIssue";
|
||||
|
||||
export const CodexAppServerRequestOperation = Schema.Literals([
|
||||
const CodexAppServerRequestOperation = Schema.Literals([
|
||||
"decode-payload",
|
||||
"encode-payload",
|
||||
"handle-request",
|
||||
"receive-response",
|
||||
]);
|
||||
export type CodexAppServerRequestOperation = typeof CodexAppServerRequestOperation.Type;
|
||||
type CodexAppServerRequestOperation = typeof CodexAppServerRequestOperation.Type;
|
||||
|
||||
export const CodexAppServerSchemaIssueKind = Schema.Literals([
|
||||
const CodexAppServerSchemaIssueKind = Schema.Literals([
|
||||
"Filter",
|
||||
"Encoding",
|
||||
"Pointer",
|
||||
@@ -22,9 +22,9 @@ export const CodexAppServerSchemaIssueKind = Schema.Literals([
|
||||
"Forbidden",
|
||||
"OneOf",
|
||||
]);
|
||||
export type CodexAppServerSchemaIssueKind = typeof CodexAppServerSchemaIssueKind.Type;
|
||||
type CodexAppServerSchemaIssueKind = typeof CodexAppServerSchemaIssueKind.Type;
|
||||
|
||||
export interface CodexAppServerSchemaIssueDiagnostics {
|
||||
interface CodexAppServerSchemaIssueDiagnostics {
|
||||
readonly issueCount: number;
|
||||
readonly issueKinds: ReadonlyArray<CodexAppServerSchemaIssueKind>;
|
||||
readonly maximumPathDepth: number;
|
||||
@@ -62,7 +62,7 @@ const schemaIssueDiagnostics = (root: SchemaIssue.Issue): CodexAppServerSchemaIs
|
||||
};
|
||||
};
|
||||
|
||||
export const CodexAppServerPayloadKind = Schema.Literals([
|
||||
const CodexAppServerPayloadKind = Schema.Literals([
|
||||
"null",
|
||||
"array",
|
||||
"string",
|
||||
@@ -74,7 +74,7 @@ export const CodexAppServerPayloadKind = Schema.Literals([
|
||||
"function",
|
||||
"undefined",
|
||||
]);
|
||||
export type CodexAppServerPayloadKind = typeof CodexAppServerPayloadKind.Type;
|
||||
type CodexAppServerPayloadKind = typeof CodexAppServerPayloadKind.Type;
|
||||
|
||||
const payloadKind = (payload: unknown): CodexAppServerPayloadKind => {
|
||||
if (payload === null) return "null";
|
||||
@@ -84,8 +84,7 @@ const payloadKind = (payload: unknown): CodexAppServerPayloadKind => {
|
||||
|
||||
const protocolMessageFields = ["id", "method", "params", "result", "error"] as const;
|
||||
|
||||
export const CodexAppServerProtocolMessageField = Schema.Literals(protocolMessageFields);
|
||||
export type CodexAppServerProtocolMessageField = typeof CodexAppServerProtocolMessageField.Type;
|
||||
const CodexAppServerProtocolMessageField = Schema.Literals(protocolMessageFields);
|
||||
|
||||
export interface CodexAppServerRequestDiagnostics {
|
||||
readonly method?: string;
|
||||
|
||||
Reference in new issue
Block a user