mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-14 01:50:39 +09:00
feat(adapter): claude local chrome flag and max-turns session handling
Add --chrome flag support for Claude adapter. Detect max-turns exhaustion (via subtype, stop_reason, or result text) and clear the session to prevent stale session re-use. Add unit tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
b0f3f04ac6
commit
9e89ca4a9e
9 changed files with 72 additions and 2 deletions
30
server/src/__tests__/claude-local-adapter.test.ts
Normal file
30
server/src/__tests__/claude-local-adapter.test.ts
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import { describe, expect, it } from "vitest";
|
||||
import { isClaudeMaxTurnsResult } from "@paperclip/adapter-claude-local/server";
|
||||
|
||||
describe("claude_local max-turn detection", () => {
|
||||
it("detects max-turn exhaustion by subtype", () => {
|
||||
expect(
|
||||
isClaudeMaxTurnsResult({
|
||||
subtype: "error_max_turns",
|
||||
result: "Reached max turns",
|
||||
}),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("detects max-turn exhaustion by stop_reason", () => {
|
||||
expect(
|
||||
isClaudeMaxTurnsResult({
|
||||
stop_reason: "max_turns",
|
||||
}),
|
||||
).toBe(true);
|
||||
});
|
||||
|
||||
it("returns false for non-max-turn results", () => {
|
||||
expect(
|
||||
isClaudeMaxTurnsResult({
|
||||
subtype: "success",
|
||||
stop_reason: "end_turn",
|
||||
}),
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue