chore: generate
This commit is contained in:
@@ -1017,20 +1017,14 @@ export type Error = ModelNotFoundError | InitError | NoProvidersError | NoModels
|
||||
export interface Interface {
|
||||
readonly list: () => Effect.Effect<Record<ProviderV2.ID, Info>>
|
||||
readonly getProvider: (providerID: ProviderV2.ID) => Effect.Effect<Info>
|
||||
readonly getModel: (
|
||||
providerID: ProviderV2.ID,
|
||||
modelID: ModelV2.ID,
|
||||
) => Effect.Effect<Model, ModelNotFoundError>
|
||||
readonly getModel: (providerID: ProviderV2.ID, modelID: ModelV2.ID) => Effect.Effect<Model, ModelNotFoundError>
|
||||
readonly getLanguage: (model: Model) => Effect.Effect<LanguageModelV3, ModelNotFoundError>
|
||||
readonly closest: (
|
||||
providerID: ProviderV2.ID,
|
||||
query: string[],
|
||||
) => Effect.Effect<{ providerID: ProviderV2.ID; modelID: string } | undefined>
|
||||
readonly getSmallModel: (providerID: ProviderV2.ID) => Effect.Effect<Model | undefined>
|
||||
readonly defaultModel: () => Effect.Effect<
|
||||
{ providerID: ProviderV2.ID; modelID: ModelV2.ID },
|
||||
DefaultModelError
|
||||
>
|
||||
readonly defaultModel: () => Effect.Effect<{ providerID: ProviderV2.ID; modelID: ModelV2.ID }, DefaultModelError>
|
||||
}
|
||||
|
||||
interface State {
|
||||
|
||||
@@ -192,7 +192,15 @@ type RouteRequirements =
|
||||
export function createRoutes(
|
||||
corsOptions?: CorsOptions,
|
||||
): Layer.Layer<never, EffectConfig.ConfigError, RouteRequirements> {
|
||||
return Layer.mergeAll(rootApiRoutes, eventApiRoutes, ptyConnectApiRoutes, instanceRoutes, v2Routes, docRoute, uiRoute).pipe(
|
||||
return Layer.mergeAll(
|
||||
rootApiRoutes,
|
||||
eventApiRoutes,
|
||||
ptyConnectApiRoutes,
|
||||
instanceRoutes,
|
||||
v2Routes,
|
||||
docRoute,
|
||||
uiRoute,
|
||||
).pipe(
|
||||
Layer.provide([
|
||||
errorLayer,
|
||||
compressionLayer,
|
||||
|
||||
@@ -574,10 +574,7 @@ export const layer: Layer.Layer<
|
||||
}
|
||||
log.info("created", result)
|
||||
|
||||
yield* events.publish(
|
||||
SessionV1.Event.Created,
|
||||
{ sessionID: result.id, info: result },
|
||||
)
|
||||
yield* events.publish(SessionV1.Event.Created, { sessionID: result.id, info: result })
|
||||
|
||||
return result
|
||||
})
|
||||
@@ -664,10 +661,7 @@ export const layer: Layer.Layer<
|
||||
yield* remove(child.id)
|
||||
}
|
||||
|
||||
yield* events.publish(
|
||||
SessionV1.Event.Deleted,
|
||||
{ sessionID, info: session },
|
||||
)
|
||||
yield* events.publish(SessionV1.Event.Deleted, { sessionID, info: session })
|
||||
yield* events.remove(sessionID)
|
||||
} catch (e) {
|
||||
log.error(e)
|
||||
@@ -682,14 +676,11 @@ export const layer: Layer.Layer<
|
||||
|
||||
const updatePart = <T extends SessionV1.Part>(part: T): Effect.Effect<T> =>
|
||||
Effect.gen(function* () {
|
||||
yield* events.publish(
|
||||
SessionV1.Event.PartUpdated,
|
||||
{
|
||||
sessionID: part.sessionID,
|
||||
part: structuredClone(part),
|
||||
time: Date.now(),
|
||||
},
|
||||
)
|
||||
yield* events.publish(SessionV1.Event.PartUpdated, {
|
||||
sessionID: part.sessionID,
|
||||
part: structuredClone(part),
|
||||
time: Date.now(),
|
||||
})
|
||||
return part
|
||||
}).pipe(Effect.withSpan("Session.updatePart"))
|
||||
|
||||
@@ -892,13 +883,10 @@ export const layer: Layer.Layer<
|
||||
sessionID: SessionID
|
||||
messageID: MessageID
|
||||
}) {
|
||||
yield* events.publish(
|
||||
SessionV1.Event.MessageRemoved,
|
||||
{
|
||||
sessionID: input.sessionID,
|
||||
messageID: input.messageID,
|
||||
},
|
||||
)
|
||||
yield* events.publish(SessionV1.Event.MessageRemoved, {
|
||||
sessionID: input.sessionID,
|
||||
messageID: input.messageID,
|
||||
})
|
||||
return input.messageID
|
||||
})
|
||||
|
||||
@@ -907,14 +895,11 @@ export const layer: Layer.Layer<
|
||||
messageID: MessageID
|
||||
partID: PartID
|
||||
}) {
|
||||
yield* events.publish(
|
||||
SessionV1.Event.PartRemoved,
|
||||
{
|
||||
sessionID: input.sessionID,
|
||||
messageID: input.messageID,
|
||||
partID: input.partID,
|
||||
},
|
||||
)
|
||||
yield* events.publish(SessionV1.Event.PartRemoved, {
|
||||
sessionID: input.sessionID,
|
||||
messageID: input.messageID,
|
||||
partID: input.partID,
|
||||
})
|
||||
return input.partID
|
||||
})
|
||||
|
||||
|
||||
@@ -980,14 +980,8 @@ it.instance(
|
||||
it.instance("getModel returns consistent results", () =>
|
||||
Effect.gen(function* () {
|
||||
yield* set("ANTHROPIC_API_KEY", "test-api-key")
|
||||
const model1 = yield* Provider.use.getModel(
|
||||
ProviderV2.ID.anthropic,
|
||||
ModelV2.ID.make("claude-sonnet-4-20250514"),
|
||||
)
|
||||
const model2 = yield* Provider.use.getModel(
|
||||
ProviderV2.ID.anthropic,
|
||||
ModelV2.ID.make("claude-sonnet-4-20250514"),
|
||||
)
|
||||
const model1 = yield* Provider.use.getModel(ProviderV2.ID.anthropic, ModelV2.ID.make("claude-sonnet-4-20250514"))
|
||||
const model2 = yield* Provider.use.getModel(ProviderV2.ID.anthropic, ModelV2.ID.make("claude-sonnet-4-20250514"))
|
||||
expect(model1.providerID).toEqual(model2.providerID)
|
||||
expect(model1.id).toEqual(model2.id)
|
||||
expect(model1).toEqual(model2)
|
||||
|
||||
@@ -457,7 +457,8 @@ describe("session HttpApi", () => {
|
||||
})}`,
|
||||
{ headers },
|
||||
)
|
||||
const sessionCursor = (yield* json<{ data: Session.Info[]; cursor: { next?: string } }>(sessionPage)).cursor.next
|
||||
const sessionCursor = (yield* json<{ data: Session.Info[]; cursor: { next?: string } }>(sessionPage)).cursor
|
||||
.next
|
||||
expect(sessionCursor).toBeTruthy()
|
||||
expect(JSON.parse(Buffer.from(sessionCursor!, "base64url").toString("utf8"))).toMatchObject({
|
||||
order: "asc",
|
||||
|
||||
@@ -57,7 +57,10 @@ describe("v2 location HttpApi", () => {
|
||||
for (const route of ["/api/command", "/api/skill"]) {
|
||||
const response = await request(route, tmp.path)
|
||||
expect(response.status).toBe(200)
|
||||
const body = (await response.json()) as { location: { directory: string; project: { id: string } }; data: unknown }
|
||||
const body = (await response.json()) as {
|
||||
location: { directory: string; project: { id: string } }
|
||||
data: unknown
|
||||
}
|
||||
expect(body.data).toBeArray()
|
||||
expect(body.location.directory).toBe(tmp.path)
|
||||
expect(body.location.project.id).toBeTruthy()
|
||||
|
||||
@@ -1671,10 +1671,7 @@ describe("session.llm.stream", () => {
|
||||
]
|
||||
const request = waitRequest("/messages", createEventResponse(chunks))
|
||||
|
||||
const resolved = yield* Provider.use.getModel(
|
||||
ProviderV2.ID.make("anthropic"),
|
||||
ModelV2.ID.make(model.id),
|
||||
)
|
||||
const resolved = yield* Provider.use.getModel(ProviderV2.ID.make("anthropic"), ModelV2.ID.make(model.id))
|
||||
const sessionID = SessionID.make("session-test-anthropic-tools")
|
||||
const agent = {
|
||||
name: "test",
|
||||
|
||||
Reference in New Issue
Block a user