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
6 changes: 3 additions & 3 deletions packages/agent/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@
"example:structured": "tsx examples/06-structured-output.ts"
},
"dependencies": {
"@ai-sdk/provider": "4.0.31",
"@ai-sdk/provider": "4.0.33",
"ws": "^8.22.0"
},
"devDependencies": {
"@ai-sdk/react": "4.0.152",
"@ai-sdk/react": "4.0.154",
"@types/node": "^26.6.5",
"@types/ws": "^8.18.2",
"ai": "^7.0.148",
"ai": "^7.0.150",
"tsup": "^9.0.0",
"tsx": "^4.23.15",
"typescript": "npm:@typescript/typescript6@^6.0.2",
Expand Down
10 changes: 5 additions & 5 deletions packages/effect/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,19 @@
"example:sandbox": "tsx examples/03-sandbox.ts"
},
"dependencies": {
"@ai-sdk/provider": "4.0.31",
"@ai-sdk/provider": "4.0.33",
"@coder/ai-sdk-agent": "workspace:^",
"@coder/ai-sdk-provider": "workspace:^",
"@coder/ai-sdk-sandbox": "workspace:^"
},
"devDependencies": {
"@ai-sdk/harness": "^1.0.159",
"@ai-sdk/provider-utils": "^5.0.65",
"@ai-sdk/harness": "^1.0.161",
"@ai-sdk/provider-utils": "^5.0.67",
"@arethetypeswrong/cli": "^0.18.5",
"@types/node": "^26.6.3",
"@vitest/coverage-v8": "^5.0.5",
"ai": "^7.0.148",
"effect": "4.0.5",
"ai": "^7.0.150",
"effect": "4.0.6",
"publint": "^0.3.25",
"tsup": "^9.0.0",
"tsx": "^4.23.15",
Expand Down
13 changes: 12 additions & 1 deletion packages/effect/src/language-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,17 @@ const responseMetadataPart = (metadata: {
timestamp: metadata.timestamp?.toISOString(),
});

/**
* Map the AI SDK's unified finish reason onto `effect/ai`'s. `effect/ai` has
* no `"interrupted"` (the provider stream ended without a completion signal),
* so it becomes `"unknown"`: the model gave no finish reason. Like every
* reason other than stop/tool-calls/pause, `effect/ai` treats it as an
* incomplete response and does not run tool handlers.
*/
const toFinishReason = (
unified: LanguageModelV4FinishReason["unified"],
): Response.FinishPartEncoded["reason"] => (unified === "interrupted" ? "unknown" : unified);

/** The finish part, with `metadata.coder` only when it has keys. */
const finishPart = (
finishReason: LanguageModelV4FinishReason,
Expand All @@ -738,7 +749,7 @@ const finishPart = (
): Response.FinishPartEncoded => {
const part: Response.FinishPartEncoded = {
type: "finish",
reason: finishReason.unified,
reason: toFinishReason(finishReason.unified),
usage: {
inputTokens: {
uncached: usage.inputTokens.noCache,
Expand Down
25 changes: 25 additions & 0 deletions packages/effect/test/language-model.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,31 @@ describe("streamText", () => {
expect(text).toBe("Hello");
});

it("maps an interrupted finish onto the unknown finish reason", async () => {
// @ai-sdk/anthropic emits `interrupted` when the provider stream ends
// without a completion signal; effect/ai has no such literal.
const model = fakeModel({
doStream: async () => ({
stream: streamOf([
{ type: "text-start", id: "t1" },
{ type: "text-delta", id: "t1", delta: "Hel" },
{
type: "finish",
finishReason: { unified: "interrupted", raw: undefined },
usage: USAGE,
},
]),
}),
});

const parts = await Effect.runPromise(
Effect.flatMap(service(model), (m) => Stream.runCollect(m.streamText({ prompt: "hi" }))),
);

const finish = parts.find((part) => part.type === "finish");
expect(finish?.reason).toBe("unknown");
});

it("streams server tool markers and reports server tool calls on finish", async () => {
const model = fakeModel({
doStream: async () => ({
Expand Down
8 changes: 4 additions & 4 deletions packages/provider/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@
"example:anthropic": "tsx examples/03-anthropic.ts"
},
"dependencies": {
"@ai-sdk/anthropic": "^4.0.85",
"@ai-sdk/openai-compatible": "^3.0.75",
"@ai-sdk/provider": "4.0.31"
"@ai-sdk/anthropic": "^4.0.87",
"@ai-sdk/openai-compatible": "^3.0.77",
"@ai-sdk/provider": "4.0.33"
},
"devDependencies": {
"@arethetypeswrong/cli": "^0.18.5",
"@types/node": "^26.6.5",
"@vitest/coverage-v8": "^5.0.5",
"ai": "^7.0.148",
"ai": "^7.0.150",
"publint": "^0.3.25",
"tsup": "^9.0.0",
"tsx": "^4.23.15",
Expand Down
4 changes: 2 additions & 2 deletions packages/release-please-ai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"release": "tsx src/cli.ts"
},
"dependencies": {
"@ai-sdk/anthropic": "^4.0.85",
"ai": "^7.0.148",
"@ai-sdk/anthropic": "^4.0.87",
"ai": "^7.0.150",
"release-please": "~17.11.2",
"zod": "4.6.7"
},
Expand Down
8 changes: 4 additions & 4 deletions packages/sandbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@
"yaml": "^2.9.1"
},
"devDependencies": {
"@ai-sdk/harness": "^1.0.159",
"@ai-sdk/harness-claude-code": "^1.0.163",
"@ai-sdk/provider-utils": "^5.0.65",
"@ai-sdk/tui": "^1.0.149",
"@ai-sdk/harness": "^1.0.161",
"@ai-sdk/harness-claude-code": "^1.0.165",
"@ai-sdk/provider-utils": "^5.0.67",
"@ai-sdk/tui": "^1.0.151",
"@arethetypeswrong/cli": "^0.18.5",
"@types/node": "^26.6.5",
"@types/ws": "^8.18.2",
Expand Down
Loading
Loading