Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 30 additions & 19 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@pulumi/pulumi": "3.231.0",
"ai": "6.0.199",
"commander": "14.0.3",
"effect": "4.0.0-beta.107",
"minimatch": "10.1.1",
"typescript": "5.9.3",
"zod": "4.3.6"
Expand Down
2 changes: 1 addition & 1 deletion packages/agentlayer-provider-openai-codex/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@
"@humanlayer/agentlayer-core": "workspace:*",
"@humanlayer/agentlayer-provider-auth": "workspace:*",
"ai": "catalog:",
"effect": "4.0.0-beta.66"
"effect": "catalog:"
}
}
2 changes: 1 addition & 1 deletion packages/opencode-llm-vendor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@
"./tool-runtime": "./src/tool-runtime.ts"
},
"dependencies": {
"effect": "4.0.0-beta.66"
"effect": "catalog:"
}
}
3 changes: 2 additions & 1 deletion packages/opencode-llm-vendor/src/protocols/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ export const sseFraming = (bytes: Stream.Stream<Uint8Array, LLMError>): Stream.S
}),
),
),
Stream.mapError((error) => eventError('sse', `Invalid SSE stream: ${error.message}`)),
Stream.filter((event) => event.data.length > 0 && event.data !== '[DONE]'),
Stream.map((event) => event.data),
)
Expand Down Expand Up @@ -219,7 +220,7 @@ export const matchToolChoice = <Auto, None, Required, Tool>(
if (toolChoice.type === 'auto') return cases.auto()
if (toolChoice.type === 'none') return cases.none()
if (toolChoice.type === 'required') return cases.required()
if (!toolChoice.name) return yield* invalidRequest(`${route} tool choice requires a tool name`)
if (!toolChoice.name) return yield* Effect.fail(invalidRequest(`${route} tool choice requires a tool name`))
return cases.tool(toolChoice.name)
})

Expand Down
4 changes: 3 additions & 1 deletion packages/opencode-llm-vendor/src/route/transport/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ const bodyWithOverlay = <Body>(body: Body, request: LLMRequest, encodeBody: (bod
const overlaid = mergeJsonRecords(body, request.http.body) ?? {}
return { jsonBody: overlaid, bodyText: ProviderShared.encodeJson(overlaid) }
}
return yield* ProviderShared.invalidRequest('http.body can only overlay JSON object request bodies')
return yield* Effect.fail(
ProviderShared.invalidRequest('http.body can only overlay JSON object request bodies'),
)
})

export const jsonRequestParts = <Body>(input: JsonRequestInput<Body>) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const webSocketUrl = (value: string) =>
}),
})

const wsRetrySchedule = Schedule.exponential('500 millis').pipe(Schedule.jittered, Schedule.both(Schedule.recurs(5)))
const wsRetrySchedule = Schedule.min([Schedule.exponential('500 millis').pipe(Schedule.jittered), Schedule.recurs(5)])

export const open = (input: WebSocketRequest) => {
let openAttempt = 0
Expand Down
6 changes: 3 additions & 3 deletions packages/opencode-llm-vendor/src/schema/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export const LLMErrorReason = Schema.Union([
]).pipe(Schema.toTaggedUnion('_tag'))
export type LLMErrorReason = Schema.Schema.Type<typeof LLMErrorReason>

export class LLMError extends Schema.TaggedErrorClass<LLMError>()('LLM.Error', {
export class LLMError extends Schema.TaggedError<LLMError>()('LLM.Error', {
module: Schema.String,
method: Schema.String,
reason: LLMErrorReason,
Expand Down Expand Up @@ -196,8 +196,8 @@ export class LLMError extends Schema.TaggedErrorClass<LLMError>()('LLM.Error', {
* Anything thrown or yielded by a handler that is not a `ToolFailure` is
* treated as a defect and fails the stream.
*/
export class ToolFailure extends Schema.TaggedErrorClass<ToolFailure>()('LLM.ToolFailure', {
export class ToolFailure extends Schema.TaggedError<ToolFailure>()('LLM.ToolFailure', {
message: Schema.String,
error: Schema.optional(Schema.Defect),
error: Schema.optional(Schema.Defect()),
metadata: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),
}) {}
2 changes: 1 addition & 1 deletion packages/opencode-llm-vendor/src/schema/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export const ToolError = Schema.Struct({
id: ToolCallID,
name: Schema.String,
message: Schema.String,
error: Schema.optional(Schema.Defect),
error: Schema.optional(Schema.Defect()),
providerMetadata: Schema.optional(ProviderMetadata),
}).annotate({ identifier: 'LLM.Event.ToolError' })
export type ToolError = Schema.Schema.Type<typeof ToolError>
Expand Down
Loading