@code-yeongyu/senpi-ai 2026.8.30 → 2026.8.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -3
- package/dist/api/anthropic-messages.d.ts.map +1 -1
- package/dist/api/anthropic-messages.js +24 -7
- package/dist/api/anthropic-messages.js.map +1 -1
- package/dist/api/cursor-agent.d.ts +7 -0
- package/dist/api/cursor-agent.d.ts.map +1 -1
- package/dist/api/cursor-agent.js +316 -2
- package/dist/api/cursor-agent.js.map +1 -1
- package/dist/api/cursor-conversation-rotation.d.ts +4 -0
- package/dist/api/cursor-conversation-rotation.d.ts.map +1 -1
- package/dist/api/cursor-conversation-rotation.js +23 -0
- package/dist/api/cursor-conversation-rotation.js.map +1 -1
- package/dist/api/openai-responses.d.ts +24 -0
- package/dist/api/openai-responses.d.ts.map +1 -1
- package/dist/api/openai-responses.js +20 -2
- package/dist/api/openai-responses.js.map +1 -1
- package/dist/providers/data/.manifest.json +1 -1
- package/dist/providers/data/openrouter.json +1 -1
- package/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -97,6 +97,9 @@ Unified LLM API with provider collections, automatic auth resolution, token and
|
|
|
97
97
|
|
|
98
98
|
```bash
|
|
99
99
|
npm install @earendil-works/pi-ai
|
|
100
|
+
|
|
101
|
+
# Bun alternative
|
|
102
|
+
bun add @earendil-works/pi-ai
|
|
100
103
|
```
|
|
101
104
|
|
|
102
105
|
TypeBox exports are re-exported from `@earendil-works/pi-ai`: `Type`, `Static`, and `TSchema`.
|
|
@@ -1552,9 +1555,9 @@ Official docs: [Application Default Credentials](https://cloud.google.com/docs/a
|
|
|
1552
1555
|
The quickest way to authenticate:
|
|
1553
1556
|
|
|
1554
1557
|
```bash
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
+
bunx @earendil-works/pi-ai login # interactive provider selection
|
|
1559
|
+
bunx @earendil-works/pi-ai login anthropic # login to specific provider
|
|
1560
|
+
bunx @earendil-works/pi-ai list # list available providers
|
|
1558
1561
|
```
|
|
1559
1562
|
|
|
1560
1563
|
Credentials are saved to `auth.json` in the current directory.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic-messages.d.ts","sourceRoot":"","sources":["../../src/api/anthropic-messages.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAC1C,OAAO,KAAK,EAGX,+BAA+B,EAK/B,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"anthropic-messages.d.ts","sourceRoot":"","sources":["../../src/api/anthropic-messages.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAC1C,OAAO,KAAK,EAGX,+BAA+B,EAK/B,MAAM,yCAAyC,CAAC;AAGjD,OAAO,KAAK,EACX,wBAAwB,EAKxB,OAAO,EAGP,KAAK,EAGL,mBAAmB,EAEnB,cAAc,EACd,aAAa,EAOb,MAAM,aAAa,CAAC;AAqCrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AA6JlE,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AAE1E,MAAM,MAAM,wBAAwB,GAAG,YAAY,GAAG,SAAS,CAAC;AAuFhE,MAAM,WAAW,gBAAiB,SAAQ,aAAa;IACtD;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB;;;;;;;;;;;OAWG;IACH,eAAe,CAAC,EAAE,wBAAwB,CAAC;IAC3C;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,wEAAwE;IACxE,gBAAgB,CAAC,EAAE,wBAAwB,CAAC;IAC5C;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;IACtE;;;;OAIG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;CACnB;AAo4BD,eAAO,MAAM,MAAM,EAAE,cAAc,CAAC,oBAAoB,EAAE,gBAAgB,CAqbzE,CAAC;AA0FF,eAAO,MAAM,YAAY,EAAE,cAAc,CAAC,oBAAoB,EAAE,mBAAmB,CA+ClF,CAAC;AA6IF,wBAAgB,mCAAmC,CAClD,KAAK,EAAE,KAAK,CAAC,oBAAoB,CAAC,EAClC,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,gBAAgB,GACxB,+BAA+B,CAkBjC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Anthropic from "@anthropic-ai/sdk";
|
|
2
2
|
import { calculateCost } from "../models.js";
|
|
3
|
+
import { registerSessionResourceCleanup } from "../session-resources.js";
|
|
3
4
|
import { isVideoMimeType } from "../types.js";
|
|
4
5
|
import { combineAbortSignals } from "../utils/abort-signals.js";
|
|
5
6
|
import { splitDeferredTools } from "../utils/deferred-tools.js";
|
|
@@ -181,6 +182,20 @@ const SERVER_SIDE_FALLBACK_BETA = "server-side-fallback-2026-07-01";
|
|
|
181
182
|
// A provider can reject its own empty signatures. Learn that capability for one
|
|
182
183
|
// conversation without changing the shared model definition used by other sessions.
|
|
183
184
|
const unsignedThinkingTextReplayFallbacks = new Set();
|
|
185
|
+
registerSessionResourceCleanup((sessionId) => {
|
|
186
|
+
// One small entry per (session, base URL, model) that ever hit the fallback;
|
|
187
|
+
// drop the session's entries at teardown so long-lived hosts do not collect
|
|
188
|
+
// them for every session that ever ran.
|
|
189
|
+
if (sessionId === undefined) {
|
|
190
|
+
unsignedThinkingTextReplayFallbacks.clear();
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
const prefix = `${sessionId}\u0000`;
|
|
194
|
+
for (const key of unsignedThinkingTextReplayFallbacks) {
|
|
195
|
+
if (key.startsWith(prefix))
|
|
196
|
+
unsignedThinkingTextReplayFallbacks.delete(key);
|
|
197
|
+
}
|
|
198
|
+
});
|
|
184
199
|
function unsignedThinkingFallbackKey(model, sessionId) {
|
|
185
200
|
return sessionId === undefined ? undefined : `${sessionId}\u0000${model.baseUrl}\u0000${model.id}`;
|
|
186
201
|
}
|
|
@@ -237,12 +252,13 @@ const REPLAYABLE_ANTHROPIC_PROVIDER_NATIVE_TYPES = new Set([
|
|
|
237
252
|
"text_editor_code_execution_tool_result",
|
|
238
253
|
"tool_search_tool_result",
|
|
239
254
|
"container_upload",
|
|
240
|
-
//
|
|
241
|
-
//
|
|
242
|
-
//
|
|
243
|
-
//
|
|
244
|
-
// and
|
|
245
|
-
|
|
255
|
+
// The server-side fallback marker (`fallback`, server-side-fallback-2026-06-01
|
|
256
|
+
// beta) is deliberately absent: the Messages API rejects it as an *input* tag
|
|
257
|
+
// ("Input tag 'fallback' found using 'type' does not match any of the expected
|
|
258
|
+
// tags"), so replaying it 400s every subsequent same-model request. The stored
|
|
259
|
+
// marker is audit metadata and still drives declined-attempt pruning in
|
|
260
|
+
// convertMessages (see lastAnthropicFallbackBoundary and
|
|
261
|
+
// collectDiscardedFallbackToolCallIds); blocks after it replay verbatim.
|
|
246
262
|
]);
|
|
247
263
|
function isReplayableAnthropicProviderNativeBlock(raw) {
|
|
248
264
|
return isRecord(raw) && typeof raw.type === "string" && REPLAYABLE_ANTHROPIC_PROVIDER_NATIVE_TYPES.has(raw.type);
|
|
@@ -1796,7 +1812,8 @@ function convertMessages(transformedMessages, model, isOAuthToken, cacheControl,
|
|
|
1796
1812
|
const blocks = [];
|
|
1797
1813
|
const isSameModel = isSameAnthropicModel(msg, model);
|
|
1798
1814
|
// Blocks before the final fallback marker are the declined attempt; the
|
|
1799
|
-
//
|
|
1815
|
+
// blocks after it are the serving model's output and replay verbatim. The
|
|
1816
|
+
// marker itself never replays: the API rejects `fallback` as an input tag.
|
|
1800
1817
|
const fallbackBoundary = isSameModel ? lastAnthropicFallbackBoundary(msg.content) : -1;
|
|
1801
1818
|
const preBoundaryPairedServerToolUseIds = fallbackBoundary >= 0
|
|
1802
1819
|
? pairedServerToolUseIdsBeforeBoundary(msg.content, fallbackBoundary)
|