contracts: restore Claude schemas on sibling stack

Co-authored-by: codex <[email protected]>
This commit is contained in:
Julius Marmingeandcodex committed 2026-03-16 10:09:06 -07:00
1 parent da9cbcc98c
commit 95c50053bc
3 files changed
+77

No files matched your search

+17
View File
@@ -1,6 +1,9 @@
import { Schema } from "effect";
import { ProviderKind } from "./orchestration";
export const CURSOR_REASONING_OPTIONS = ["low", "normal", "high", "xhigh"] as const;
export type CursorReasoningOption = (typeof CURSOR_REASONING_OPTIONS)[number];
export const CODEX_REASONING_EFFORT_OPTIONS = ["xhigh", "high", "medium", "low"] as const;
export type CodexReasoningEffort = (typeof CODEX_REASONING_EFFORT_OPTIONS)[number];
@@ -10,8 +13,22 @@ export const CodexModelOptions = Schema.Struct({
});
export type CodexModelOptions = typeof CodexModelOptions.Type;
export const ClaudeCodeModelOptions = Schema.Struct({
thinking: Schema.optional(Schema.Boolean),
});
export type ClaudeCodeModelOptions = typeof ClaudeCodeModelOptions.Type;
export const CursorModelOptions = Schema.Struct({
reasoning: Schema.optional(Schema.Literals(CURSOR_REASONING_OPTIONS)),
fastMode: Schema.optional(Schema.Boolean),
thinking: Schema.optional(Schema.Boolean),
});
export type CursorModelOptions = typeof CursorModelOptions.Type;
export const ProviderModelOptions = Schema.Struct({
codex: Schema.optional(CodexModelOptions),
claudeCode: Schema.optional(ClaudeCodeModelOptions),
cursor: Schema.optional(CursorModelOptions),
});
export type ProviderModelOptions = typeof ProviderModelOptions.Type;
+47
View File
@@ -42,6 +42,53 @@ describe("ProviderSessionStartInput", () => {
}),
).toThrow();
});
it("accepts claude runtime knobs", () => {
const parsed = decodeProviderSessionStartInput({
threadId: "thread-1",
provider: "claudeCode",
cwd: "/tmp/workspace",
model: "claude-sonnet-4-6",
providerOptions: {
claudeCode: {
binaryPath: "/usr/local/bin/claude",
permissionMode: "plan",
maxThinkingTokens: 12_000,
},
},
runtimeMode: "full-access",
});
expect(parsed.provider).toBe("claudeCode");
expect(parsed.providerOptions?.claudeCode?.binaryPath).toBe("/usr/local/bin/claude");
expect(parsed.providerOptions?.claudeCode?.permissionMode).toBe("plan");
expect(parsed.providerOptions?.claudeCode?.maxThinkingTokens).toBe(12_000);
expect(parsed.runtimeMode).toBe("full-access");
});
it("accepts cursor provider payloads", () => {
const parsed = decodeProviderSessionStartInput({
threadId: "thread-1",
provider: "cursor",
cwd: "/tmp/workspace",
model: "composer-1.5",
modelOptions: {
cursor: {
thinking: true,
},
},
providerOptions: {
cursor: {
binaryPath: "/usr/local/bin/agent",
},
},
runtimeMode: "approval-required",
});
expect(parsed.provider).toBe("cursor");
expect(parsed.model).toBe("composer-1.5");
expect(parsed.modelOptions?.cursor?.thinking).toBe(true);
expect(parsed.providerOptions?.cursor?.binaryPath).toBe("/usr/local/bin/agent");
expect(parsed.runtimeMode).toBe("approval-required");
});
});
describe("ProviderSendTurnInput", () => {
+13
View File
@@ -5,6 +5,7 @@ import {
ApprovalRequestId,
EventId,
IsoDateTime,
NonNegativeInt,
ProviderItemId,
ThreadId,
TurnId,
@@ -52,8 +53,20 @@ const CodexProviderStartOptions = Schema.Struct({
homePath: Schema.optional(TrimmedNonEmptyStringSchema),
});
const ClaudeCodeProviderStartOptions = Schema.Struct({
binaryPath: Schema.optional(TrimmedNonEmptyStringSchema),
permissionMode: Schema.optional(TrimmedNonEmptyStringSchema),
maxThinkingTokens: Schema.optional(NonNegativeInt),
});
const CursorProviderStartOptions = Schema.Struct({
binaryPath: Schema.optional(TrimmedNonEmptyStringSchema),
});
export const ProviderStartOptions = Schema.Struct({
codex: Schema.optional(CodexProviderStartOptions),
claudeCode: Schema.optional(ClaudeCodeProviderStartOptions),
cursor: Schema.optional(CursorProviderStartOptions),
});
export type ProviderStartOptions = typeof ProviderStartOptions.Type;