@code-yeongyu/senpi 2026.9.11 → 2026.9.12-2
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/CHANGELOG.md +40 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +5 -1
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session.d.ts +13 -9
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +54 -121
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/cursor-history-admission.d.ts +50 -0
- package/dist/core/cursor-history-admission.d.ts.map +1 -0
- package/dist/core/cursor-history-admission.js +130 -0
- package/dist/core/cursor-history-admission.js.map +1 -0
- package/dist/core/extensions/builtin/cursor-cli-oauth/models.d.ts.map +1 -1
- package/dist/core/extensions/builtin/cursor-cli-oauth/models.js +2 -1
- package/dist/core/extensions/builtin/cursor-cli-oauth/models.js.map +1 -1
- package/dist/core/session-manager.d.ts +2 -0
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +22 -13
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/session-write-reservation.d.ts +9 -0
- package/dist/core/session-write-reservation.d.ts.map +1 -1
- package/dist/core/session-write-reservation.js +33 -0
- package/dist/core/session-write-reservation.js.map +1 -1
- package/dist/modes/interactive/components/ask-user-async-widget.d.ts +2 -0
- package/dist/modes/interactive/components/ask-user-async-widget.d.ts.map +1 -1
- package/dist/modes/interactive/components/ask-user-async-widget.js +17 -1
- package/dist/modes/interactive/components/ask-user-async-widget.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +2 -2
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +2 -1
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js +1 -0
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/modes/rpc/session-path-reservations.d.ts +30 -0
- package/dist/modes/rpc/session-path-reservations.d.ts.map +1 -0
- package/dist/modes/rpc/session-path-reservations.js +58 -0
- package/dist/modes/rpc/session-path-reservations.js.map +1 -0
- package/dist/modes/rpc/session-registry.d.ts +3 -1
- package/dist/modes/rpc/session-registry.d.ts.map +1 -1
- package/dist/modes/rpc/session-registry.js.map +1 -1
- package/dist/modes/rpc/session-worker-client.d.ts +10 -8
- package/dist/modes/rpc/session-worker-client.d.ts.map +1 -1
- package/dist/modes/rpc/session-worker-client.js +14 -23
- package/dist/modes/rpc/session-worker-client.js.map +1 -1
- package/dist/modes/rpc/session-worker-credit.d.ts +17 -0
- package/dist/modes/rpc/session-worker-credit.d.ts.map +1 -0
- package/dist/modes/rpc/session-worker-credit.js +39 -0
- package/dist/modes/rpc/session-worker-credit.js.map +1 -0
- package/dist/modes/rpc/session-worker-protocol.d.ts +10 -0
- package/dist/modes/rpc/session-worker-protocol.d.ts.map +1 -1
- package/dist/modes/rpc/session-worker-protocol.js +2 -0
- package/dist/modes/rpc/session-worker-protocol.js.map +1 -1
- package/dist/modes/rpc/session-worker-signals.d.ts +7 -0
- package/dist/modes/rpc/session-worker-signals.d.ts.map +1 -0
- package/dist/modes/rpc/session-worker-signals.js +19 -0
- package/dist/modes/rpc/session-worker-signals.js.map +1 -0
- package/dist/modes/rpc/session-worker.js +12 -16
- package/dist/modes/rpc/session-worker.js.map +1 -1
- package/dist/modes/rpc/worker-session-registry.d.ts +12 -0
- package/dist/modes/rpc/worker-session-registry.d.ts.map +1 -1
- package/dist/modes/rpc/worker-session-registry.js +51 -24
- package/dist/modes/rpc/worker-session-registry.js.map +1 -1
- package/docs/rpc.md +14 -6
- package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +24 -0
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
- package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/measure.d.ts +11 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/measure.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/measure.js +18 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/measure.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.d.ts +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.js +5 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/discovery.d.ts +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/discovery.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/discovery.js +96 -51
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/discovery.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/gen/cascade_pb.d.ts +389 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/gen/cascade_pb.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/gen/cascade_pb.js +132 -4
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/gen/cascade_pb.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/metadata.d.ts +34 -4
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/metadata.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/metadata.js +41 -8
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/metadata.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/paths.d.ts +20 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/paths.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/paths.js +20 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/paths.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/request.d.ts +18 -6
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/request.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/request.js +77 -35
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/request.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/stream-state.d.ts +9 -3
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/stream-state.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/stream-state.js +30 -38
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/stream-state.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/trailer.d.ts +16 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/trailer.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/trailer.js +69 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/trailer.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/unary.d.ts +26 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/unary.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/unary.js +61 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/unary.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/wire.d.ts +6 -4
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/wire.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/wire.js +6 -4
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent/wire.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent.d.ts +13 -5
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent.js +76 -21
- package/node_modules/@earendil-works/pi-ai/dist/api/devin-agent.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/devin.d.ts +5 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/devin.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/devin.js +7 -2
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/devin.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/cursor/context-limit-store.d.ts +32 -0
- package/node_modules/@earendil-works/pi-ai/dist/cursor/context-limit-store.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/cursor/context-limit-store.js +62 -0
- package/node_modules/@earendil-works/pi-ai/dist/cursor/context-limit-store.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/cursor/store-migration.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/cursor/store-migration.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/cursor/store-migration.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.d.ts +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/model.d.ts +11 -1
- package/node_modules/@earendil-works/pi-ai/dist/model.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/model.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cursor.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cursor.js +2 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/cursor.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/venice.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/devin.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/devin.js +3 -3
- package/node_modules/@earendil-works/pi-ai/dist/providers/devin.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/devin.models.d.ts +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/devin.models.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/devin.models.js +18 -9
- package/node_modules/@earendil-works/pi-ai/dist/providers/devin.models.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/cursor-context-limit.d.ts +12 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/cursor-context-limit.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/cursor-context-limit.js +93 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/cursor-context-limit.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/package.json +2 -2
- package/node_modules/@earendil-works/pi-pty/package.json +1 -1
- package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/package.json +7 -7
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { normalizeCursorCatalog } from "./catalog-grouping.js";
|
|
2
|
+
import { resolveCursorContextWindow } from "./context-limit-store.js";
|
|
2
3
|
import { getCursorVariantAlias } from "./model-capabilities.js";
|
|
3
4
|
function isGroupedShape(model) {
|
|
4
5
|
return model.compat?.cursorReasoning !== undefined || getCursorVariantAlias(model.id) === undefined;
|
|
@@ -16,7 +17,7 @@ function entryToModel(entry, maxTokensById) {
|
|
|
16
17
|
...(entry.thinkingLevelMap ? { thinkingLevelMap: entry.thinkingLevelMap } : {}),
|
|
17
18
|
input: entry.input,
|
|
18
19
|
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
19
|
-
contextWindow: entry.window,
|
|
20
|
+
contextWindow: resolveCursorContextWindow(entry.id, entry.window),
|
|
20
21
|
maxTokens,
|
|
21
22
|
...(entry.representativeVariantId !== undefined && entry.representativeVariantId !== entry.id
|
|
22
23
|
? { upstreamModelId: entry.representativeVariantId }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-migration.js","sourceRoot":"","sources":["../../src/cursor/store-migration.ts"],"names":[],"mappings":"AACA,OAAO,EAA2B,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACxF,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAEhE,SAAS,cAAc,CAAC,KAA4B;IACnD,OAAO,KAAK,CAAC,MAAM,EAAE,eAAe,KAAK,SAAS,IAAI,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,SAAS,CAAC;AACrG,CAAC;AAED,SAAS,YAAY,CAAC,KAAyB,EAAE,aAA0C;IAC1F,MAAM,cAAc,GAAG,KAAK,CAAC,uBAAuB,IAAI,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;IAC3F,MAAM,SAAS,GAAG,aAAa,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,IAAI,KAAK,CAAC;IAC5F,OAAO;QACN,EAAE,EAAE,KAAK,CAAC,EAAE;QACZ,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,GAAG,EAAE,cAAc;QACnB,QAAQ,EAAE,QAAQ;QAClB,OAAO,EAAE,wBAAwB;QACjC,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,GAAG,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,KAAK,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,EA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AAW,GAAG,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC5C,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAC/B,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACvB,CAAC;aAAM,CAAC;YACP,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC;IACF,CAAC;IACD,OAAO,GAAG,CAAC;AACZ,CAAC","sourcesContent":["import type { Model } from \"../types.ts\";\nimport { type CursorCatalogEntry, normalizeCursorCatalog } from \"./catalog-grouping.ts\";\nimport { resolveCursorContextWindow } from \"./context-limit-store.ts\";\nimport { getCursorVariantAlias } from \"./model-capabilities.ts\";\n\nfunction isGroupedShape(model: Model<\"cursor-agent\">): boolean {\n\treturn model.compat?.cursorReasoning !== undefined || getCursorVariantAlias(model.id) === undefined;\n}\n\nfunction entryToModel(entry: CursorCatalogEntry, maxTokensById: ReadonlyMap<string, number>): Model<\"cursor-agent\"> {\n\tconst representative = entry.representativeVariantId ?? entry.legacyAliases[0] ?? entry.id;\n\tconst maxTokens = maxTokensById.get(representative) ?? maxTokensById.get(entry.id) ?? 64000;\n\treturn {\n\t\tid: entry.id,\n\t\tname: entry.name,\n\t\tapi: \"cursor-agent\",\n\t\tprovider: \"cursor\",\n\t\tbaseUrl: \"https://api2.cursor.sh\",\n\t\treasoning: entry.reasoning,\n\t\t...(entry.thinkingLevelMap ? { thinkingLevelMap: entry.thinkingLevelMap } : {}),\n\t\tinput: entry.input,\n\t\tcost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },\n\t\tcontextWindow: resolveCursorContextWindow(entry.id, entry.window),\n\t\tmaxTokens,\n\t\t...(entry.representativeVariantId !== undefined && entry.representativeVariantId !== entry.id\n\t\t\t? { upstreamModelId: entry.representativeVariantId }\n\t\t\t: {}),\n\t\tcompat: {\n\t\t\t...(entry.cursorMaxMode ? { cursorMaxMode: true } : {}),\n\t\t\t...(entry.capabilityId !== undefined && entry.representativeVariantId !== undefined\n\t\t\t\t? {\n\t\t\t\t\t\tcursorReasoning: {\n\t\t\t\t\t\t\tcapabilityId: entry.capabilityId,\n\t\t\t\t\t\t\t...(entry.thinkingMode !== undefined ? { thinkingMode: entry.thinkingMode } : {}),\n\t\t\t\t\t\t\trepresentativeVariantId: entry.representativeVariantId,\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t},\n\t};\n}\n\n/**\n * Idempotent stored-catalog transform: pre-grouping 204-variant cursor entries\n * are regrouped into selectable identities; already-grouped, unknown, and\n * malformed entries pass through unchanged in stable input order.\n */\nexport function regroupStoredCursorModels(models: readonly Model<\"cursor-agent\">[]): Model<\"cursor-agent\">[] {\n\tconst legacy = models.filter((model) => !isGroupedShape(model));\n\tif (legacy.length === 0) return [...models];\n\tconst maxTokensById = new Map(models.map((model) => [model.id, model.maxTokens]));\n\tconst regrouped = new Map(\n\t\tnormalizeCursorCatalog(\n\t\t\tlegacy.map((model) => ({\n\t\t\t\tid: model.id,\n\t\t\t\tname: model.name,\n\t\t\t\tinput: model.input.filter((modality): modality is \"text\" | \"image\" => modality !== \"video\"),\n\t\t\t\tcursorMaxMode: model.compat?.cursorMaxMode === true,\n\t\t\t})),\n\t\t).map((entry) => [entry.id, entryToModel(entry, maxTokensById)] as const),\n\t);\n\tconst seen = new Set<string>();\n\tconst out: Model<\"cursor-agent\">[] = [];\n\tfor (const model of models) {\n\t\tif (isGroupedShape(model)) {\n\t\t\tout.push(model);\n\t\t\tcontinue;\n\t\t}\n\t\tconst alias = getCursorVariantAlias(model.id);\n\t\tconst targetId = alias?.targetId ?? model.id;\n\t\tif (seen.has(targetId)) continue;\n\t\tseen.add(targetId);\n\t\tconst transformed = regrouped.get(targetId);\n\t\tif (transformed !== undefined) {\n\t\t\tout.push(transformed);\n\t\t} else {\n\t\t\tout.push(model);\n\t\t}\n\t}\n\treturn out;\n}\n"]}
|
|
@@ -4,7 +4,7 @@ export type { AnthropicEffort, AnthropicOptions, AnthropicThinkingDisplay } from
|
|
|
4
4
|
export { sanitizeAnthropicToolPairs } from "./api/anthropic-tool-pairs.ts";
|
|
5
5
|
export type { AzureOpenAIResponsesOptions } from "./api/azure-openai-responses.ts";
|
|
6
6
|
export type { BedrockOptions, BedrockThinkingDisplay } from "./api/bedrock-converse-stream.ts";
|
|
7
|
-
export { measureCursorHistorySerializedBytes } from "./api/cursor-agent/measure.ts";
|
|
7
|
+
export { measureCursorHistorySerializedBytes, measureCursorModelInputSerializedBytes, } from "./api/cursor-agent/measure.ts";
|
|
8
8
|
export { composeShellCommand as composeCursorShellCommand, omitUndefinedArgs as omitUndefinedCursorArgs, piLimit as cursorPiLimit, piLsPath as cursorPiLsPath, piReadArgs as cursorPiReadArgs, piTimeout as cursorPiTimeout, } from "./api/cursor-agent/pi-args.ts";
|
|
9
9
|
export type { CursorAgentOptions, CursorExecHandlerResult, CursorExecHandlers, CursorExecPairing, CursorMcpCall, CursorPiCall, CursorShellStreamCallbacks, CursorToolResultHandler, } from "./api/cursor-agent/types.ts";
|
|
10
10
|
export type { GoogleOptions } from "./api/google-generative-ai.ts";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAM/B,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AAC/G,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,YAAY,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AACnF,YAAY,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC/F,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[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EAC1B,gBAAgB,EAChB,2BAA2B,EAC3B,gCAAgC,GAChC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,8BAA8B,EAAE,MAAM,+DAA+D,CAAC;AAC/G,OAAO,EAAE,4BAA4B,EAAE,MAAM,mDAAmD,CAAC;AACjG,cAAc,YAAY,CAAC;AAC3B,OAAO,EACN,KAAK,yBAAyB,EAC9B,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,GACnB,MAAM,0BAA0B,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAClF,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,OAAO,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAC3E,cAAc,qBAAqB,CAAC;AACpC,OAAO,EACN,qBAAqB,EACrB,6BAA6B,EAC7B,8BAA8B,EAC9B,4BAA4B,GAC5B,MAAM,6BAA6B,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oCAAoC,CAAC;AACnD,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Type } from "typebox";
|
|
2
2
|
export { sanitizeAnthropicToolPairs } from "./api/anthropic-tool-pairs.js";
|
|
3
|
-
export { measureCursorHistorySerializedBytes } from "./api/cursor-agent/measure.js";
|
|
3
|
+
export { measureCursorHistorySerializedBytes, measureCursorModelInputSerializedBytes, } from "./api/cursor-agent/measure.js";
|
|
4
4
|
export { composeShellCommand as composeCursorShellCommand, omitUndefinedArgs as omitUndefinedCursorArgs, piLimit as cursorPiLimit, piLsPath as cursorPiLsPath, piReadArgs as cursorPiReadArgs, piTimeout as cursorPiTimeout, } from "./api/cursor-agent/pi-args.js";
|
|
5
5
|
export * from "./api/lazy.js";
|
|
6
6
|
export { convertResponsesMessages } from "./api/openai-responses-shared.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAO/B,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAG3E,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAO/B,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAG3E,OAAO,EACN,mCAAmC,EACnC,sCAAsC,GACtC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACN,mBAAmB,IAAI,yBAAyB,EAChD,iBAAiB,IAAI,uBAAuB,EAC5C,OAAO,IAAI,aAAa,EACxB,QAAQ,IAAI,cAAc,EAC1B,UAAU,IAAI,gBAAgB,EAC9B,SAAS,IAAI,eAAe,GAC5B,MAAM,+BAA+B,CAAC;AAcvC,cAAc,eAAe,CAAC;AAK9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAE5E,OAAO,EAIN,eAAe,GACf,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,cAAc,mBAAmB,CAAC;AAClC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAi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nD,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,yBAAyB,CAAC;AACxC,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["export type { Static, TSchema } from \"typebox\";\nexport { Type } from \"typebox\";\n// Core only, side-effect free: no generated catalogs, no provider factories,\n// no api-registry, no OAuth implementations, no compat. Provider factories\n// live under \"@earendil-works/pi-ai/providers/*\", API implementations under\n// \"@earendil-works/pi-ai/api/*\", the old global API under\n// \"@earendil-works/pi-ai/compat\".\nexport type { AnthropicEffort, AnthropicOptions, AnthropicThinkingDisplay } from \"./api/anthropic-messages.ts\";\nexport { sanitizeAnthropicToolPairs } from \"./api/anthropic-tool-pairs.ts\";\nexport type { AzureOpenAIResponsesOptions } from \"./api/azure-openai-responses.ts\";\nexport type { BedrockOptions, BedrockThinkingDisplay } from \"./api/bedrock-converse-stream.ts\";\nexport {\n\tmeasureCursorHistorySerializedBytes,\n\tmeasureCursorModelInputSerializedBytes,\n} from \"./api/cursor-agent/measure.ts\";\nexport {\n\tcomposeShellCommand as composeCursorShellCommand,\n\tomitUndefinedArgs as omitUndefinedCursorArgs,\n\tpiLimit as cursorPiLimit,\n\tpiLsPath as cursorPiLsPath,\n\tpiReadArgs as cursorPiReadArgs,\n\tpiTimeout as cursorPiTimeout,\n} from \"./api/cursor-agent/pi-args.ts\";\nexport type {\n\tCursorAgentOptions,\n\tCursorExecHandlerResult,\n\tCursorExecHandlers,\n\tCursorExecPairing,\n\tCursorMcpCall,\n\tCursorPiCall,\n\tCursorShellStreamCallbacks,\n\tCursorToolResultHandler,\n} from \"./api/cursor-agent/types.ts\";\nexport type { GoogleOptions } from \"./api/google-generative-ai.ts\";\nexport type { GoogleApiThinkingLevel, ResolvedGoogleThinkingLevel } from \"./api/google-shared.ts\";\nexport type { GoogleVertexOptions } from \"./api/google-vertex.ts\";\nexport * from \"./api/lazy.ts\";\nexport type { MistralOptions } from \"./api/mistral-conversations.ts\";\nexport type { OpenAICodexResponsesOptions, OpenAICodexWebSocketDebugStats } from \"./api/openai-codex-responses.ts\";\nexport type { OpenAICompletionsOptions } from \"./api/openai-completions.ts\";\nexport type { OpenAIResponsesOptions } from \"./api/openai-responses.ts\";\nexport { convertResponsesMessages } from \"./api/openai-responses-shared.ts\";\nexport type { PiMessagesEvent, PiMessagesOptions, PiMessagesRewriteImpact } from \"./api/pi-messages.ts\";\nexport {\n\ttype WarmPromptCacheOptions,\n\ttype WarmPromptCacheResult,\n\ttype WarmPromptCacheUsage,\n\twarmPromptCache,\n} from \"./api/warm-prompt-cache.ts\";\nexport { getApiProvider } from \"./api-registry.ts\";\nexport * from \"./auth/context.ts\";\nexport * from \"./auth/credential-store.ts\";\nexport * from \"./auth/headers.ts\";\nexport * from \"./auth/helpers.ts\";\nexport * from \"./auth/types.ts\";\nexport type {\n\tOAuthAuthInfo,\n\tOAuthDeviceCodeInfo,\n\tOAuthLoginCallbacks,\n\tOAuthPrompt,\n\tOAuthProviderId,\n\tOAuthSelectOption,\n\tOAuthSelectPrompt,\n} from \"./compat/extension-oauth-types.ts\";\nexport {\n\tCONTEXT_PROVENANCE_FIELD,\n\ttype ContextProvenance,\n\tcontextProvenanceFingerprint,\n\tcopyContextProvenance,\n\tgetContextProvenance,\n} from \"./context-provenance.ts\";\nexport * from \"./cursor/catalog-grouping.ts\";\nexport {\n\tCURSOR_MODEL_CAPABILITIES,\n\ttype CursorCapabilityEvidence,\n\ttype CursorLevelEncoding,\n\ttype CursorLevelSpec,\n\ttype CursorModelCapability,\n\ttype CursorParameterId,\n\ttype CursorVariantAlias,\n\ttype CursorVariantParse,\n\tgetCursorBaseIdForVariant,\n\tgetCursorCapabilityForBase,\n\tgetCursorVariantAlias,\n} from \"./cursor/model-capabilities.ts\";\nexport {\n\ttype CursorResolvedSelection,\n\trenderCursorCliModelString,\n\tresolveCursorSelectionDescriptor,\n} from \"./cursor/selection-descriptor.ts\";\nexport * from \"./env-api-keys.ts\";\nexport * from \"./images-models.ts\";\nexport * from \"./models.ts\";\nexport * from \"./models-store.ts\";\nexport * from \"./providers/faux.ts\";\nexport * from \"./session-resources.ts\";\nexport {\n\tgetProtocol,\n\tgetToolCallFormat,\n\thasKimiTextToolCallRecovery,\n\tshouldRecoverTextToolCalls,\n\ttransformContext,\n\twrapStreamWithModelRecovery,\n\twrapStreamWithToolCallMiddleware,\n} from \"./tool-call-middleware/index.ts\";\nexport { createXtmlRecoveryStreamParser } from \"./tool-call-middleware/protocols/kimi-xtml/recovery-stream.ts\";\nexport { wrapStreamWithInvokeRecovery } from \"./tool-call-middleware/recovery-stream-wrapper.ts\";\nexport * from \"./types.ts\";\nexport {\n\ttype CursorExecResolvedCarrier,\n\tcopyCursorExecResolved,\n\tisCursorExecResolved,\n\tkCursorExecResolved,\n} from \"./utils/block-symbols.ts\";\nexport * from \"./utils/diagnostics.ts\";\nexport { dropFailedAssistantTurns } from \"./utils/drop-failed-assistant-turns.ts\";\nexport { estimateContextTokens } from \"./utils/estimate.ts\";\nexport * from \"./utils/event-stream.ts\";\nexport * from \"./utils/json-parse.ts\";\nexport { extractOpenAiCodexAccountId } from \"./utils/openai-codex-auth.ts\";\nexport * from \"./utils/overflow.ts\";\nexport {\n\tisAnthropicApiBaseUrl,\n\tPROMPT_CACHE_TTL_LONG_SECONDS,\n\tPROMPT_CACHE_TTL_SHORT_SECONDS,\n\tresolvePromptCacheTtlSeconds,\n} from \"./utils/prompt-cache-ttl.ts\";\nexport * from \"./utils/retry.ts\";\nexport * from \"./utils/server-fallback-receipt.ts\";\nexport * from \"./utils/stop-details.ts\";\nexport { contentText } from \"./utils/text.ts\";\nexport * from \"./utils/tool-pair-repair.ts\";\nexport * from \"./utils/typebox-helpers.ts\";\nexport { uuidv7 } from \"./utils/uuid.ts\";\nexport * from \"./utils/validation.ts\";\nexport * from \"./utils/visible-text.ts\";\nexport { getWireIdentity, setWireIdentity } from \"./wire-identity.ts\";\n"]}
|
|
@@ -32,7 +32,17 @@ export interface Model<TApi extends Api> {
|
|
|
32
32
|
/** Whether to recover supported text-encoded tool calls from assistant text. */
|
|
33
33
|
recoverTextToolCalls?: boolean;
|
|
34
34
|
/** Compatibility overrides for OpenAI-compatible APIs. If not set, auto-detected from baseUrl. */
|
|
35
|
-
compat?: TApi extends "openai-completions" ? OpenAICompletionsCompat : TApi extends "openai-responses" | "openai-codex-responses" | "azure-openai-responses" ? OpenAIResponsesCompat : TApi extends "anthropic-messages" ? AnthropicMessagesCompat : TApi extends "bedrock-converse-stream" ? BedrockCompat : TApi extends "cursor-agent" ? CursorAgentCompat : never;
|
|
35
|
+
compat?: TApi extends "openai-completions" ? OpenAICompletionsCompat : TApi extends "openai-responses" | "openai-codex-responses" | "azure-openai-responses" ? OpenAIResponsesCompat : TApi extends "anthropic-messages" ? AnthropicMessagesCompat : TApi extends "bedrock-converse-stream" ? BedrockCompat : TApi extends "cursor-agent" ? CursorAgentCompat : TApi extends "devin-agent" ? DevinAgentCompat : never;
|
|
36
|
+
}
|
|
37
|
+
/** Devin (Cascade) model metadata the transport branches on. */
|
|
38
|
+
export interface DevinAgentCompat {
|
|
39
|
+
/**
|
|
40
|
+
* Server-side router (`adaptive`): its uid is never a legal chat model uid, so
|
|
41
|
+
* the transport resolves it through `AssignModel` before every turn.
|
|
42
|
+
*/
|
|
43
|
+
modelRouter?: boolean;
|
|
44
|
+
/** The lane accepts several tool calls per turn; absent means one at a time. */
|
|
45
|
+
supportsParallelToolCalls?: boolean;
|
|
36
46
|
}
|
|
37
47
|
/** Cursor agent protocol model metadata. */
|
|
38
48
|
export interface CursorAgentCompat {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../src/model.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B,GAAG,wBAAwB,GACpF,qBAAqB,GACrB,IAAI,SAAS,oBAAoB,GAChC,uBAAuB,GACvB,IAAI,SAAS,yBAAyB,GACrC,aAAa,GACb,IAAI,SAAS,cAAc,GAC1B,iBAAiB,GACjB,IAAI,SAAS,aAAa,GACzB,gBAAgB,GAChB,KAAK,CAAC;CACd;AAED,gEAAgE;AAChE,MAAM,WAAW,gBAAgB;IAChC;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gFAAgF;IAChF,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACpC;AAED,4CAA4C;AAC5C,MAAM,WAAW,iBAAiB;IACjC,mEAAmE;IACnE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;OAIG;IACH,eAAe,CAAC,EAAE;QACjB,uDAAuD;QACvD,YAAY,EAAE,MAAM,CAAC;QACrB,kEAAkE;QAClE,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,oEAAoE;QACpE,uBAAuB,EAAE,MAAM,CAAC;KAChC,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n\tAnthropicMessagesCompat,\n\tApi,\n\tBedrockCompat,\n\tCacheRetention,\n\tModelCost,\n\tOpenAICompletionsCompat,\n\tOpenAIResponsesCompat,\n\tProviderId,\n\tThinkingLevelMap,\n} from \"./types.ts\";\n\n/** Model interface for the unified model system. */\nexport interface Model<TApi extends Api> {\n\tid: string;\n\tname: string;\n\tapi: TApi;\n\tprovider: ProviderId;\n\tbaseUrl: string;\n\treasoning: boolean;\n\t/**\n\t * Maps pi thinking levels to provider/model-specific values.\n\t * In a present map, omitting `xhigh` or `max` disables that extended tier; ordinary missing levels\n\t * use provider defaults. null marks any level as unsupported.\n\t */\n\tthinkingLevelMap?: ThinkingLevelMap;\n\tinput: (\"text\" | \"image\" | \"video\")[];\n\tcost: ModelCost;\n\tcontextWindow: number;\n\tmaxTokens: number;\n\t/** Default sampling parameters; per-request values override these by key. */\n\tsamplingParams?: Record<string, unknown>;\n\theaders?: Record<string, string>;\n\t/** Default prompt-cache retention preference when the request omits one. */\n\tcacheRetention?: CacheRetention;\n\t/**\n\t * Upstream model id sent on the wire when it differs from the catalog id\n\t * (for example `-fast` priority-tier variants aliasing their base model).\n\t */\n\tupstreamModelId?: string;\n\t/** Service tier requested by default for this model (for example `-fast` variants). */\n\tserviceTier?: \"auto\" | \"flex\" | \"priority\";\n\t/** Whether to recover supported text-encoded tool calls from assistant text. */\n\trecoverTextToolCalls?: boolean;\n\t/** Compatibility overrides for OpenAI-compatible APIs. If not set, auto-detected from baseUrl. */\n\tcompat?: TApi extends \"openai-completions\"\n\t\t? OpenAICompletionsCompat\n\t\t: TApi extends \"openai-responses\" | \"openai-codex-responses\" | \"azure-openai-responses\"\n\t\t\t? OpenAIResponsesCompat\n\t\t\t: TApi extends \"anthropic-messages\"\n\t\t\t\t? AnthropicMessagesCompat\n\t\t\t\t: TApi extends \"bedrock-converse-stream\"\n\t\t\t\t\t? BedrockCompat\n\t\t\t\t\t: TApi extends \"cursor-agent\"\n\t\t\t\t\t\t? CursorAgentCompat\n\t\t\t\t\t\t: never;\n}\n\n/** Cursor agent protocol model metadata. */\nexport interface CursorAgentCompat {\n\t/** Request Cursor's max-mode (1M-context) variant of the model. */\n\tcursorMaxMode?: boolean;\n\t/**\n\t * Wire-reasoning capability for grouped Cursor catalog identities.\n\t * Presence is the capability gate: models without it never emit reasoning\n\t * parameters on the wire.\n\t */\n\tcursorReasoning?: {\n\t\t/** Base id into the static cursor capability table. */\n\t\tcapabilityId: string;\n\t\t/** Fixed Claude thinking boolean for this selectable identity. */\n\t\tthinkingMode?: boolean;\n\t\t/** Exact catalog variant sent when no explicit selection exists. */\n\t\trepresentativeVariantId: string;\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../src/model.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n\tAnthropicMessagesCompat,\n\tApi,\n\tBedrockCompat,\n\tCacheRetention,\n\tModelCost,\n\tOpenAICompletionsCompat,\n\tOpenAIResponsesCompat,\n\tProviderId,\n\tThinkingLevelMap,\n} from \"./types.ts\";\n\n/** Model interface for the unified model system. */\nexport interface Model<TApi extends Api> {\n\tid: string;\n\tname: string;\n\tapi: TApi;\n\tprovider: ProviderId;\n\tbaseUrl: string;\n\treasoning: boolean;\n\t/**\n\t * Maps pi thinking levels to provider/model-specific values.\n\t * In a present map, omitting `xhigh` or `max` disables that extended tier; ordinary missing levels\n\t * use provider defaults. null marks any level as unsupported.\n\t */\n\tthinkingLevelMap?: ThinkingLevelMap;\n\tinput: (\"text\" | \"image\" | \"video\")[];\n\tcost: ModelCost;\n\tcontextWindow: number;\n\tmaxTokens: number;\n\t/** Default sampling parameters; per-request values override these by key. */\n\tsamplingParams?: Record<string, unknown>;\n\theaders?: Record<string, string>;\n\t/** Default prompt-cache retention preference when the request omits one. */\n\tcacheRetention?: CacheRetention;\n\t/**\n\t * Upstream model id sent on the wire when it differs from the catalog id\n\t * (for example `-fast` priority-tier variants aliasing their base model).\n\t */\n\tupstreamModelId?: string;\n\t/** Service tier requested by default for this model (for example `-fast` variants). */\n\tserviceTier?: \"auto\" | \"flex\" | \"priority\";\n\t/** Whether to recover supported text-encoded tool calls from assistant text. */\n\trecoverTextToolCalls?: boolean;\n\t/** Compatibility overrides for OpenAI-compatible APIs. If not set, auto-detected from baseUrl. */\n\tcompat?: TApi extends \"openai-completions\"\n\t\t? OpenAICompletionsCompat\n\t\t: TApi extends \"openai-responses\" | \"openai-codex-responses\" | \"azure-openai-responses\"\n\t\t\t? OpenAIResponsesCompat\n\t\t\t: TApi extends \"anthropic-messages\"\n\t\t\t\t? AnthropicMessagesCompat\n\t\t\t\t: TApi extends \"bedrock-converse-stream\"\n\t\t\t\t\t? BedrockCompat\n\t\t\t\t\t: TApi extends \"cursor-agent\"\n\t\t\t\t\t\t? CursorAgentCompat\n\t\t\t\t\t\t: TApi extends \"devin-agent\"\n\t\t\t\t\t\t\t? DevinAgentCompat\n\t\t\t\t\t\t\t: never;\n}\n\n/** Devin (Cascade) model metadata the transport branches on. */\nexport interface DevinAgentCompat {\n\t/**\n\t * Server-side router (`adaptive`): its uid is never a legal chat model uid, so\n\t * the transport resolves it through `AssignModel` before every turn.\n\t */\n\tmodelRouter?: boolean;\n\t/** The lane accepts several tool calls per turn; absent means one at a time. */\n\tsupportsParallelToolCalls?: boolean;\n}\n\n/** Cursor agent protocol model metadata. */\nexport interface CursorAgentCompat {\n\t/** Request Cursor's max-mode (1M-context) variant of the model. */\n\tcursorMaxMode?: boolean;\n\t/**\n\t * Wire-reasoning capability for grouped Cursor catalog identities.\n\t * Presence is the capability gate: models without it never emit reasoning\n\t * parameters on the wire.\n\t */\n\tcursorReasoning?: {\n\t\t/** Base id into the static cursor capability table. */\n\t\tcapabilityId: string;\n\t\t/** Fixed Claude thinking boolean for this selectable identity. */\n\t\tthinkingMode?: boolean;\n\t\t/** Exact catalog variant sent when no explicit selection exists. */\n\t\trepresentativeVariantId: string;\n\t};\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../../src/providers/cursor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../../src/providers/cursor.ts"],"names":[],"mappings":"AAMA,OAAO,EAAkB,KAAK,QAAQ,EAA6B,MAAM,cAAc,CAAC;AAiExF;;;;;;;;GAQG;AACH,wBAAgB,cAAc,IAAI,QAAQ,CAAC,cAAc,CAAC,CAkBzD"}
|
|
@@ -2,6 +2,7 @@ import { cursorAgentApi, loadCursorAgentModule } from "../api/cursor-agent.lazy.
|
|
|
2
2
|
import { lazyOAuth } from "../auth/helpers.js";
|
|
3
3
|
import { loadCursorOAuth } from "../auth/oauth/load.js";
|
|
4
4
|
import { normalizeCursorCatalog } from "../cursor/catalog-grouping.js";
|
|
5
|
+
import { resolveCursorContextWindow } from "../cursor/context-limit-store.js";
|
|
5
6
|
import { regroupStoredCursorModels } from "../cursor/store-migration.js";
|
|
6
7
|
import { createProvider } from "../models.js";
|
|
7
8
|
const CURSOR_BASE_URL = "https://api2.cursor.sh";
|
|
@@ -43,7 +44,7 @@ async function fetchCursorModels(context) {
|
|
|
43
44
|
input: entry.input,
|
|
44
45
|
// Subscription-billed: Cursor reports no per-token pricing here.
|
|
45
46
|
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
46
|
-
contextWindow: entry.window,
|
|
47
|
+
contextWindow: resolveCursorContextWindow(entry.id, entry.window),
|
|
47
48
|
maxTokens,
|
|
48
49
|
...(entry.representativeVariantId !== undefined && entry.representativeVariantId !== entry.id
|
|
49
50
|
? { upstreamModelId: entry.representativeVariantId }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cursor.js","sourceRoot":"","sources":["../../src/providers/cursor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpF,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,EAAE,cAAc,EAA4C,MAAM,cAAc,CAAC;AAGxF,MAAM,eAAe,GAAG,wBAAwB,CAAC;AAEjD;;;;;;GAMG;AACH,KAAK,UAAU,iBAAiB,CAAC,OAA6B;IAC7D,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IACtC,MAAM,WAAW,GAAG,UAAU,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,EAAE,GAA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E,QAAQ;QACZ,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,eAAe;QACxB,aAAa,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,yBAAyB,CAAC,MAAM,CAAC;QAC5D,IAAI,EAAE;YACL,KAAK,EAAE,SAAS,CAAC;gBAChB,IAAI,EAAE,0BAA0B;gBAChC,cAAc,EAAE,IAAI;gBACpB,UAAU,EAAE,qBAAqB;gBACjC,IAAI,EAAE,eAAe;aACrB,CAAC;SACF;QACD,MAAM,EAAE,EAAE;QACV,WAAW,EAAE,iBAAiB;QAC9B,GAAG,EAAE,cAAc,EAAE;KACrB,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { cursorAgentApi, loadCursorAgentModule } from \"../api/cursor-agent.lazy.ts\";\nimport { lazyOAuth } from \"../auth/helpers.ts\";\nimport { loadCursorOAuth } from \"../auth/oauth/load.ts\";\nimport { normalizeCursorCatalog } from \"../cursor/catalog-grouping.ts\";\nimport { resolveCursorContextWindow } from \"../cursor/context-limit-store.ts\";\nimport { regroupStoredCursorModels } from \"../cursor/store-migration.ts\";\nimport { createProvider, type Provider, type RefreshModelsContext } from \"../models.ts\";\nimport type { Model } from \"../types.ts\";\n\nconst CURSOR_BASE_URL = \"https://api2.cursor.sh\";\n\n/**\n * Cursor's catalog is fully dynamic: `GetUsableModels` requires an\n * authenticated access token and reports the account's usable models, so the\n * provider ships no static baseline. The discovery call lives in the\n * Node-only `cursor-agent` API module, loaded through the bundler-opaque\n * lazy boundary so the provider factory stays browser-safe.\n */\nasync function fetchCursorModels(context: RefreshModelsContext): Promise<Model<\"cursor-agent\">[]> {\n\tconst credential = context.credential;\n\tconst accessToken = credential?.type === \"oauth\" ? credential.access : credential?.key;\n\tif (!accessToken) return [];\n\tconst { fetchCursorUsableModels } = await loadCursorAgentModule();\n\tconst discovered = await fetchCursorUsableModels({ apiKey: accessToken, signal: context.signal });\n\tif (discovered === null) {\n\t\tthrow new Error(\"Could not load Cursor model catalog from GetUsableModels\");\n\t}\n\tconst normalized = normalizeCursorCatalog(\n\t\tdiscovered.map((model) => ({\n\t\t\tid: model.id,\n\t\t\tname: model.name,\n\t\t\tinput: model.input,\n\t\t\tcursorMaxMode: model.cursorMaxMode,\n\t\t})),\n\t);\n\tconst maxTokensByVariant = new Map(discovered.map((model) => [model.id, model.maxTokens]));\n\treturn normalized.map((entry): Model<\"cursor-agent\"> => {\n\t\tconst representative = entry.representativeVariantId ?? entry.legacyAliases[0] ?? entry.id;\n\t\tconst maxTokens = maxTokensByVariant.get(representative) ?? maxTokensByVariant.get(entry.id) ?? 64000;\n\t\treturn {\n\t\t\tid: entry.id,\n\t\t\tname: entry.name,\n\t\t\tapi: \"cursor-agent\",\n\t\t\tprovider: \"cursor\",\n\t\t\tbaseUrl: CURSOR_BASE_URL,\n\t\t\treasoning: entry.reasoning,\n\t\t\t...(entry.thinkingLevelMap ? { thinkingLevelMap: entry.thinkingLevelMap } : {}),\n\t\t\tinput: entry.input,\n\t\t\t// Subscription-billed: Cursor reports no per-token pricing here.\n\t\t\tcost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },\n\t\t\tcontextWindow: resolveCursorContextWindow(entry.id, entry.window),\n\t\t\tmaxTokens,\n\t\t\t...(entry.representativeVariantId !== undefined && entry.representativeVariantId !== entry.id\n\t\t\t\t? { upstreamModelId: entry.representativeVariantId }\n\t\t\t\t: {}),\n\t\t\tcompat: {\n\t\t\t\t...(entry.cursorMaxMode ? { cursorMaxMode: true } : {}),\n\t\t\t\t...(entry.capabilityId !== undefined && entry.representativeVariantId !== undefined\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tcursorReasoning: {\n\t\t\t\t\t\t\t\tcapabilityId: entry.capabilityId,\n\t\t\t\t\t\t\t\t...(entry.thinkingMode !== undefined ? { thinkingMode: entry.thinkingMode } : {}),\n\t\t\t\t\t\t\t\trepresentativeVariantId: entry.representativeVariantId,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t}\n\t\t\t\t\t: {}),\n\t\t\t},\n\t\t};\n\t});\n}\n\n/**\n * Cursor subscription provider (OAuth only).\n *\n * Chat runs on Cursor's protobuf Connect-RPC agent protocol\n * (`agent.v1.AgentService/Run` on `api2.cursor.sh`), implemented by the\n * `cursor-agent` API. The model catalog is discovered per account through\n * `GetUsableModels` after login (`Models.refresh` runs automatically after a\n * successful `/login cursor`).\n */\nexport function cursorProvider(): Provider<\"cursor-agent\"> {\n\treturn createProvider({\n\t\tid: \"cursor\",\n\t\tname: \"Cursor\",\n\t\tbaseUrl: CURSOR_BASE_URL,\n\t\trestoreModels: (models) => regroupStoredCursorModels(models),\n\t\tauth: {\n\t\t\toauth: lazyOAuth({\n\t\t\t\tname: \"Cursor (Pro/Ultra/Teams)\",\n\t\t\t\tisSubscription: true,\n\t\t\t\tloginLabel: \"Sign in with Cursor\",\n\t\t\t\tload: loadCursorOAuth,\n\t\t\t}),\n\t\t},\n\t\tmodels: [],\n\t\tfetchModels: fetchCursorModels,\n\t\tapi: cursorAgentApi(),\n\t});\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"schemaVersion":3,"generatedAt":"2026-09-
|
|
1
|
+
{"schemaVersion":3,"generatedAt":"2026-09-12T06:20:51.564Z","structureHash":"b923e6312c0aab42f23e34d0ea52f496652de19fd408d6b6573803c48382fc37","files":{"alibaba-token-plan.json":"9f9e8f88b1faa2e4134a0d8bcda600531d4d044d64b7ec3d2373f1db46dcf452","amazon-bedrock.json":"24a7b48f0b60c7aeaa9286049cb06aecbd603a41aa373b1ea5b4d484a3bff97f","ant-ling.json":"4979fe79d99ed97382d7ce40170c6132e932e77906de1eb54464c042e7d63633","anthropic.json":"e9d883ee35d94dba963320b5496bd7dd368d226cbafcf134bfec66a0a24b3b7f","azure-openai-responses.json":"eebbe078feec3565c7457c6b6c065d3d8931b20b168ea4ffb31a33e93066e9ee","baseten.json":"c7cf9a7e7e6bee9c53005acf4706c25f954adaa64a9058535fb7e5b1d6920852","cerebras.json":"9eaa554e1b02f3665f8f63e6432d253bf81351af7c72001054dd8108aa528a52","cloudflare-ai-gateway.json":"244d98311e81b5f33fa736688d135b29add6a8acee466aa3a5988ac5b022d1eb","cloudflare-workers-ai.json":"07ef63208ff7517fd1a80962f18143e21de399640423329490b157f459ccf995","deepseek.json":"e3106724723fd82d48a3ff685da9908a3a7b7b4fd84cc3cfe97a6a23067b6029","fireworks.json":"eb986d5c6649ded170df730c579b08861b6c510347ed7479d6966722bda41527","github-copilot.json":"26cd0af57e17caf7fbd9c0b34da4653e2e29f1ba5a00c1ff996d2549f8b74c05","google-vertex.json":"e1631109172dc1f7d7977570420a5bb86258bdd1088427e244a2c51545c4f24d","google.json":"7619bf03edd2a7acb06a2274a14b13c3a61354288abe029a758401d4de36a8fd","groq.json":"e4728fd72e358cd8f25e9a518e9b49a521ef44523d3debe38a7db9e0663c4077","huggingface.json":"a488b6f175b382277ccf7d487f877ef0c698994576bb55d2410838bf9c8c7c41","kimi-coding.json":"88150f8970f83e17968b02f3b33fac803b96ebf1474e76437689b7d0f1b69363","minimax-cn.json":"65d37e55a6d9585855f94b3fb7739308d107fe248ebd9e1001d1c5d4606ad2c4","minimax.json":"c7dc5765995ae77242916430929c7cc9a782589f7e483e13f7e01663190d028e","mistral.json":"e3a109306644bf2f2fa38fece50b2d3ce1dbe3b87b1f1b9e2d70cce7eb5c0ea1","moonshotai-cn.json":"c4e1801b5dfd61bebcaa33cbfc5ed0c69df14a3bee37da218a558668d817864e","moonshotai.json":"3dab637e7e2648792c786157f85f29026b93393f7098b77593c1180928d371c9","nvidia.json":"a942cfffa6fc764d603503f7ce2abf4d2bdd1d541b98a65aa6ff53bfe2df4efd","openai-codex.json":"b8f275f5b501456000f6445398faac2189292378b837beeddcdbe1c42a319d22","openai.json":"203a1d6bf61178268edf3d3f0ad4a6408eded401c4472bda4ac0ec73142f38ce","opencode-go.json":"f97adb96bf613ee102585c6c4cd0a8cc8047d51c8cfe4cf2f98673afce09ee3d","opencode.json":"52b40ba8ab7435c9029bf59f38558f41528462990a6a7d7ba3f00aa10481da09","opengateway.json":"7a4c98061b7b84c476ba70d6f597019ef53c02c0135b9d8a7507e2c30905c07d","openrouter.json":"5889088cd8c2c06b5d08aae122c615b6285a601ffd0239c0ab981e99491b8b06","qwen-token-plan-cn.json":"e62dde34edb603376a1dc60b2a74a9c2605b9e81d81df55cc259796c45aa4793","qwen-token-plan-individual.json":"5649fd4075ada766ec65a7a162cd65f096a7ecc29960ace04b2e6a6a4a995a41","qwen-token-plan.json":"fe914313157ff41ab2f71977f0fdcfedb3a8a205d1092e3180f6799e5d7942fd","together.json":"6010980c9b0af72c60965ae325dbdb21e67c91844a7f7f6f7d71d363f1325f56","venice.json":"ece2872660f480c3580de21be569681e13c752ded8c346ec9feb8c32ddf61a96","vercel-ai-gateway.json":"70381264ccd02d5ac7444205cd703be832726a67c8e7c3a8a9a789385ab50120","xai.json":"9973aae022723732b8a7ea12107e6fb8b3f1d0e087ec6bbc2ee18f0820595e19","xiaomi-token-plan-ams.json":"568b9992cf320536a65826e26a414afa5c0d17f083a01af4bd96658d9dd3e705","xiaomi-token-plan-cn.json":"c423857d0bbb0b126394eaf1ebb2a91bf2d1193cc5a4fe77843ff0f4536a0a80","xiaomi-token-plan-sgp.json":"008f1eb41037e93c5ae478f12815cd67bac1978f131ffefa602775bb60b63fea","xiaomi.json":"37acf451bb4364bdca2ecea6b7d962590d9974a87e80cfe34bb800be6a95c13b","zai-coding-cn.json":"d3c969020a7ab978497837a3301c7bca364d704082832221cfe61e6596333e56","zai.json":"f42790c77fb4681a656897a9d860b939916c0ddf979a5f16856bce9573cdf64e"}}
|