progress
This commit is contained in:
16 files changed
+695
-458
No files matched your search
@@ -2,8 +2,6 @@ import type { AgentConfig, AgentExit, OutputChunk } from "./agent";
|
||||
import type {
|
||||
ProviderEvent,
|
||||
ProviderInterruptTurnInput,
|
||||
ProviderListModelsInput,
|
||||
ProviderModel,
|
||||
ProviderSendTurnInput,
|
||||
ProviderSession,
|
||||
ProviderSessionStartInput,
|
||||
@@ -29,7 +27,6 @@ export const IPC_CHANNELS = {
|
||||
providerTurnInterrupt: "provider:turn:interrupt",
|
||||
providerSessionStop: "provider:session:stop",
|
||||
providerSessionList: "provider:session:list",
|
||||
providerModelList: "provider:model:list",
|
||||
providerEvent: "provider:event",
|
||||
} as const;
|
||||
|
||||
@@ -60,7 +57,6 @@ export interface NativeApi {
|
||||
interruptTurn: (input: ProviderInterruptTurnInput) => Promise<void>;
|
||||
stopSession: (input: ProviderStopSessionInput) => Promise<void>;
|
||||
listSessions: () => Promise<ProviderSession[]>;
|
||||
listModels: (input?: ProviderListModelsInput) => Promise<ProviderModel[]>;
|
||||
onEvent: (callback: (event: ProviderEvent) => void) => () => void;
|
||||
};
|
||||
}
|
||||
@@ -2,7 +2,6 @@ import { describe, expect, it } from "vitest";
|
||||
|
||||
import {
|
||||
providerEventSchema,
|
||||
providerListModelsInputSchema,
|
||||
providerSendTurnInputSchema,
|
||||
providerSessionStartInputSchema,
|
||||
} from "./provider";
|
||||
@@ -17,21 +16,16 @@ describe("providerSessionStartInputSchema", () => {
|
||||
});
|
||||
|
||||
describe("providerSendTurnInputSchema", () => {
|
||||
it("trims input text and optional model", () => {
|
||||
it("trims input text and optional model/effort", () => {
|
||||
const parsed = providerSendTurnInputSchema.parse({
|
||||
sessionId: "sess_1",
|
||||
input: " summarize this repo ",
|
||||
model: " gpt-5.2-codex ",
|
||||
effort: " high ",
|
||||
});
|
||||
expect(parsed.input).toBe("summarize this repo");
|
||||
expect(parsed.model).toBe("gpt-5.2-codex");
|
||||
});
|
||||
});
|
||||
|
||||
describe("providerListModelsInputSchema", () => {
|
||||
it("defaults provider to codex", () => {
|
||||
const parsed = providerListModelsInputSchema.parse({});
|
||||
expect(parsed.provider).toBe("codex");
|
||||
expect(parsed.effort).toBe("high");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ export const providerSendTurnInputSchema = z.object({
|
||||
sessionId: z.string().min(1),
|
||||
input: z.string().trim().min(1).max(120_000),
|
||||
model: z.string().trim().min(1).optional(),
|
||||
effort: z.string().trim().min(1).optional(),
|
||||
});
|
||||
|
||||
export const providerTurnStartResultSchema = z.object({
|
||||
@@ -64,20 +65,6 @@ export const providerStopSessionInputSchema = z.object({
|
||||
sessionId: z.string().min(1),
|
||||
});
|
||||
|
||||
export const providerModelSchema = z.object({
|
||||
id: z.string().min(1),
|
||||
model: z.string().min(1),
|
||||
displayName: z.string().min(1),
|
||||
description: z.string().min(1).optional(),
|
||||
isDefault: z.boolean().optional(),
|
||||
upgrade: z.string().min(1).nullable().optional(),
|
||||
});
|
||||
|
||||
export const providerListModelsInputSchema = z.object({
|
||||
provider: providerKindSchema.default("codex"),
|
||||
cwd: z.string().min(1).optional(),
|
||||
});
|
||||
|
||||
export const providerEventKindSchema = z.enum([
|
||||
"session",
|
||||
"notification",
|
||||
@@ -120,9 +107,5 @@ export type ProviderInterruptTurnInput = z.input<
|
||||
export type ProviderStopSessionInput = z.input<
|
||||
typeof providerStopSessionInputSchema
|
||||
>;
|
||||
export type ProviderModel = z.infer<typeof providerModelSchema>;
|
||||
export type ProviderListModelsInput = z.input<
|
||||
typeof providerListModelsInputSchema
|
||||
>;
|
||||
export type ProviderEventKind = z.infer<typeof providerEventKindSchema>;
|
||||
export type ProviderEvent = z.infer<typeof providerEventSchema>;
|
||||
Reference in new issue
Block a user