@code-yeongyu/senpi-ai 2026.8.18 → 2026.8.20
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 +5 -3
- package/dist/api/anthropic-messages.d.ts +7 -1
- package/dist/api/anthropic-messages.d.ts.map +1 -1
- package/dist/api/anthropic-messages.js +21 -4
- package/dist/api/anthropic-messages.js.map +1 -1
- package/dist/api/azure-openai-responses.d.ts +2 -0
- package/dist/api/azure-openai-responses.d.ts.map +1 -1
- package/dist/api/azure-openai-responses.js +7 -1
- package/dist/api/azure-openai-responses.js.map +1 -1
- package/dist/api/bedrock-converse-stream.d.ts.map +1 -1
- package/dist/api/bedrock-converse-stream.js +39 -2
- package/dist/api/bedrock-converse-stream.js.map +1 -1
- package/dist/api/cursor-agent/gen/agent_pb.d.ts +22 -1
- package/dist/api/cursor-agent/gen/agent_pb.d.ts.map +1 -1
- package/dist/api/cursor-agent/gen/agent_pb.js +1 -1
- package/dist/api/cursor-agent/gen/agent_pb.js.map +1 -1
- package/dist/api/cursor-agent/reasoning-params.d.ts +20 -0
- package/dist/api/cursor-agent/reasoning-params.d.ts.map +1 -0
- package/dist/api/cursor-agent/reasoning-params.js +26 -0
- package/dist/api/cursor-agent/reasoning-params.js.map +1 -0
- package/dist/api/cursor-agent/types.d.ts +7 -1
- package/dist/api/cursor-agent/types.d.ts.map +1 -1
- package/dist/api/cursor-agent/types.js.map +1 -1
- package/dist/api/cursor-agent.d.ts +7 -3
- package/dist/api/cursor-agent.d.ts.map +1 -1
- package/dist/api/cursor-agent.js +363 -218
- package/dist/api/cursor-agent.js.map +1 -1
- package/dist/api/cursor-conversation-rotation.d.ts +37 -0
- package/dist/api/cursor-conversation-rotation.d.ts.map +1 -0
- package/dist/api/cursor-conversation-rotation.js +110 -0
- package/dist/api/cursor-conversation-rotation.js.map +1 -0
- package/dist/api/cursor-task-args.d.ts +3 -0
- package/dist/api/cursor-task-args.d.ts.map +1 -0
- package/dist/api/cursor-task-args.js +17 -0
- package/dist/api/cursor-task-args.js.map +1 -0
- package/dist/api/google-generative-ai.d.ts +2 -2
- package/dist/api/google-generative-ai.d.ts.map +1 -1
- package/dist/api/google-generative-ai.js +14 -11
- package/dist/api/google-generative-ai.js.map +1 -1
- package/dist/api/google-shared.d.ts +5 -2
- package/dist/api/google-shared.d.ts.map +1 -1
- package/dist/api/google-shared.js +16 -0
- package/dist/api/google-shared.js.map +1 -1
- package/dist/api/google-vertex.d.ts +2 -2
- package/dist/api/google-vertex.d.ts.map +1 -1
- package/dist/api/google-vertex.js +13 -10
- package/dist/api/google-vertex.js.map +1 -1
- package/dist/api/mistral-conversations.d.ts.map +1 -1
- package/dist/api/mistral-conversations.js +4 -1
- package/dist/api/mistral-conversations.js.map +1 -1
- package/dist/api/openai-codex-responses.d.ts.map +1 -1
- package/dist/api/openai-codex-responses.js +4 -1
- package/dist/api/openai-codex-responses.js.map +1 -1
- package/dist/api/openai-completions.d.ts +1 -1
- package/dist/api/openai-completions.d.ts.map +1 -1
- package/dist/api/openai-completions.js +45 -29
- package/dist/api/openai-completions.js.map +1 -1
- package/dist/api/openai-responses.d.ts.map +1 -1
- package/dist/api/openai-responses.js +8 -1
- package/dist/api/openai-responses.js.map +1 -1
- package/dist/api/pi-messages.js +1 -1
- package/dist/api/pi-messages.js.map +1 -1
- package/dist/api/simple-options.d.ts +4 -0
- package/dist/api/simple-options.d.ts.map +1 -1
- package/dist/api/simple-options.js +18 -9
- package/dist/api/simple-options.js.map +1 -1
- package/dist/auth/oauth/device-code.d.ts +1 -0
- package/dist/auth/oauth/device-code.d.ts.map +1 -1
- package/dist/auth/oauth/device-code.js +1 -1
- package/dist/auth/oauth/device-code.js.map +1 -1
- package/dist/auth/oauth/github-copilot.d.ts.map +1 -1
- package/dist/auth/oauth/github-copilot.js +22 -9
- package/dist/auth/oauth/github-copilot.js.map +1 -1
- package/dist/cursor/catalog-grouping.d.ts +25 -0
- package/dist/cursor/catalog-grouping.d.ts.map +1 -0
- package/dist/cursor/catalog-grouping.js +134 -0
- package/dist/cursor/catalog-grouping.js.map +1 -0
- package/dist/cursor/cursor-variant-aliases.json +1893 -0
- package/dist/cursor/model-capabilities.d.ts +47 -0
- package/dist/cursor/model-capabilities.d.ts.map +1 -0
- package/dist/cursor/model-capabilities.js +208 -0
- package/dist/cursor/model-capabilities.js.map +1 -0
- package/dist/cursor/selection-descriptor.d.ts +21 -0
- package/dist/cursor/selection-descriptor.d.ts.map +1 -0
- package/dist/cursor/selection-descriptor.js +99 -0
- package/dist/cursor/selection-descriptor.js.map +1 -0
- package/dist/cursor/store-migration.d.ts +8 -0
- package/dist/cursor/store-migration.d.ts.map +1 -0
- package/dist/cursor/store-migration.js +76 -0
- package/dist/cursor/store-migration.js.map +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/model.d.ts +13 -0
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js.map +1 -1
- package/dist/models.d.ts +6 -0
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js +9 -1
- package/dist/models.js.map +1 -1
- package/dist/providers/cursor.d.ts.map +1 -1
- package/dist/providers/cursor.js +40 -11
- package/dist/providers/cursor.js.map +1 -1
- package/dist/providers/data/.manifest.json +1 -1
- package/dist/providers/data/amazon-bedrock.json +1 -1
- package/dist/providers/data/anthropic.json +1 -1
- package/dist/providers/data/baseten.json +1 -1
- package/dist/providers/data/github-copilot.json +1 -1
- package/dist/providers/data/huggingface.json +1 -1
- package/dist/providers/data/openai-codex.json +1 -1
- package/dist/providers/data/openai.json +1 -1
- package/dist/providers/data/opencode-go.json +1 -1
- package/dist/providers/data/opencode.json +1 -1
- package/dist/providers/data/openrouter.json +1 -1
- package/dist/providers/data/qwen-token-plan-individual.json +1 -1
- package/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/dist/providers/data/xai.json +1 -1
- package/dist/providers/data/xiaomi-token-plan-ams.json +1 -1
- package/dist/providers/data/xiaomi-token-plan-cn.json +1 -1
- package/dist/providers/data/xiaomi-token-plan-sgp.json +1 -1
- package/dist/providers/data/xiaomi.json +1 -1
- package/dist/providers/data/zai-coding-cn.json +1 -1
- package/dist/providers/data/zai.json +1 -1
- package/dist/providers/xai.d.ts +1 -1
- package/dist/providers/xai.d.ts.map +1 -1
- package/dist/providers/xai.js +1 -5
- package/dist/providers/xai.js.map +1 -1
- package/dist/tool-call-middleware/index.d.ts.map +1 -1
- package/dist/tool-call-middleware/index.js +2 -0
- package/dist/tool-call-middleware/index.js.map +1 -1
- package/dist/tool-call-middleware/protocols/anthropic-xml/tool-resolver.d.ts.map +1 -1
- package/dist/tool-call-middleware/protocols/anthropic-xml/tool-resolver.js +21 -1
- package/dist/tool-call-middleware/protocols/anthropic-xml/tool-resolver.js.map +1 -1
- package/dist/tool-call-middleware/recovery-message-snapshot.d.ts.map +1 -1
- package/dist/tool-call-middleware/recovery-message-snapshot.js +2 -1
- package/dist/tool-call-middleware/recovery-message-snapshot.js.map +1 -1
- package/dist/types.d.ts +45 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils/overflow.d.ts +30 -0
- package/dist/utils/overflow.d.ts.map +1 -1
- package/dist/utils/overflow.js +48 -0
- package/dist/utils/overflow.js.map +1 -1
- package/dist/utils/pi-user-agent.d.ts +2 -0
- package/dist/utils/pi-user-agent.d.ts.map +1 -1
- package/dist/utils/pi-user-agent.js +7 -0
- package/dist/utils/pi-user-agent.js.map +1 -1
- package/dist/utils/prompt-cache-ttl.d.ts +2 -1
- package/dist/utils/prompt-cache-ttl.d.ts.map +1 -1
- package/dist/utils/prompt-cache-ttl.js +2 -0
- package/dist/utils/prompt-cache-ttl.js.map +1 -1
- package/package.json +2 -3
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ModelThinkingLevel } from "../types.ts";
|
|
2
|
+
export type CursorCapabilityEvidence = "available-models" | "cli-live" | "suffix-only";
|
|
3
|
+
export type CursorLevelEncoding = "parameters" | "variant-id";
|
|
4
|
+
export type CursorParameterId = "thinking" | "context" | "effort" | "reasoning" | "fast";
|
|
5
|
+
export interface CursorLevelSpec {
|
|
6
|
+
readonly value: string;
|
|
7
|
+
readonly encoding: CursorLevelEncoding;
|
|
8
|
+
}
|
|
9
|
+
export interface CursorModelCapability {
|
|
10
|
+
readonly catalogKey?: string;
|
|
11
|
+
readonly evidence: CursorCapabilityEvidence;
|
|
12
|
+
readonly window: number;
|
|
13
|
+
readonly maxWindow?: number;
|
|
14
|
+
readonly parameterOrder: readonly CursorParameterId[];
|
|
15
|
+
readonly defaultContext?: string;
|
|
16
|
+
/** Context token matching `window`; cursor truncates to whatever this asks for. */
|
|
17
|
+
readonly requestContext?: string;
|
|
18
|
+
readonly levels: Partial<Record<ModelThinkingLevel, CursorLevelSpec>>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Static cursor capability table. Values come from the live
|
|
22
|
+
* aiserver.v1 AvailableModels capture of 2026-08-18 (evidence:
|
|
23
|
+
* local-ignore/qa-evidence/20260818-cursor-reasoning-levels/available-models-catalog.json).
|
|
24
|
+
* `GetUsableModels` carries no window or parameter field, so this table is the
|
|
25
|
+
* authoritative source; see .omo/plans/cursor-reasoning-levels.md §3.1/§6.
|
|
26
|
+
*/
|
|
27
|
+
export declare const CURSOR_MODEL_CAPABILITIES: Record<string, CursorModelCapability>;
|
|
28
|
+
export interface CursorVariantAlias {
|
|
29
|
+
readonly targetId: string;
|
|
30
|
+
readonly level?: ModelThinkingLevel;
|
|
31
|
+
readonly legacyVariantId: string;
|
|
32
|
+
readonly encoding: "legacy-variant";
|
|
33
|
+
}
|
|
34
|
+
export interface CursorVariantParse {
|
|
35
|
+
readonly baseId: string;
|
|
36
|
+
readonly level: string | undefined;
|
|
37
|
+
readonly thinking: boolean | undefined;
|
|
38
|
+
readonly fast: boolean;
|
|
39
|
+
readonly originalId: string;
|
|
40
|
+
}
|
|
41
|
+
/** Lossless suffix parser: trailing `-fast`, `-thinking-<level>` or `-<level>-thinking`, bare `-thinking`, trailing level. */
|
|
42
|
+
export declare function parseCursorVariantId(originalId: string): CursorVariantParse;
|
|
43
|
+
export declare function getCursorVariantAlias(originalId: string): CursorVariantAlias | undefined;
|
|
44
|
+
/** Resolve any known variant id to its selectable base identity; unknown ids return undefined. */
|
|
45
|
+
export declare function getCursorBaseIdForVariant(originalId: string): string | undefined;
|
|
46
|
+
export declare function getCursorCapabilityForBase(baseId: string): CursorModelCapability | undefined;
|
|
47
|
+
//# sourceMappingURL=model-capabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-capabilities.d.ts","sourceRoot":"","sources":["../../src/cursor/model-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGtD,MAAM,MAAM,wBAAwB,GAAG,kBAAkB,GAAG,UAAU,GAAG,aAAa,CAAC;AACvF,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG,YAAY,CAAC;AAC9D,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,SAAS,GAAG,QAAQ,GAAG,WAAW,GAAG,MAAM,CAAC;AAEzF,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,EAAE,mBAAmB,CAAC;CACvC;AAED,MAAM,WAAW,qBAAqB;IACrC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,wBAAwB,CAAC;IAC5C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,cAAc,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACtD,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,mFAAmF;IACnF,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,kBAAkB,EAAE,eAAe,CAAC,CAAC,CAAC;CACtE;AAmDD;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAkH3E,CAAC;AAEF,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,CAAC,EAAE,kBAAkB,CAAC;IACpC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;CACpC;AAKD,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,QAAQ,CAAC,QAAQ,EAAE,OAAO,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC5B;AAED,8HAA8H;AAC9H,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,kBAAkB,CAiC3E;AAED,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAExF;AAED,kGAAkG;AAClG,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAOhF;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,qBAAqB,GAAG,SAAS,CAE5F"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import aliasData from "./cursor-variant-aliases.json" with { type: "json" };
|
|
2
|
+
const P = "parameters";
|
|
3
|
+
const V = "variant-id";
|
|
4
|
+
function ladder(values, encoding = P) {
|
|
5
|
+
const out = {};
|
|
6
|
+
for (const value of values)
|
|
7
|
+
out[value === "none" ? "off" : value] = { value, encoding };
|
|
8
|
+
return out;
|
|
9
|
+
}
|
|
10
|
+
const CLAUDE_ORDER = ["thinking", "context", "effort"];
|
|
11
|
+
const GPT_ORDER = ["context", "reasoning", "fast"];
|
|
12
|
+
function claude(window, maxWindow, levels, defaultContext) {
|
|
13
|
+
return {
|
|
14
|
+
evidence: "available-models",
|
|
15
|
+
window,
|
|
16
|
+
maxWindow,
|
|
17
|
+
parameterOrder: CLAUDE_ORDER,
|
|
18
|
+
defaultContext,
|
|
19
|
+
requestContext: window >= 1_000_000 ? "1m" : defaultContext,
|
|
20
|
+
levels: ladder(levels),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function gpt(levels, order = GPT_ORDER, window = 400000, maxWindow = 400000) {
|
|
24
|
+
return {
|
|
25
|
+
evidence: "available-models",
|
|
26
|
+
window,
|
|
27
|
+
maxWindow,
|
|
28
|
+
parameterOrder: order,
|
|
29
|
+
defaultContext: "272k",
|
|
30
|
+
requestContext: order.includes("context") && window >= 1_000_000 ? "1m" : undefined,
|
|
31
|
+
levels: ladder(levels),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Static cursor capability table. Values come from the live
|
|
36
|
+
* aiserver.v1 AvailableModels capture of 2026-08-18 (evidence:
|
|
37
|
+
* local-ignore/qa-evidence/20260818-cursor-reasoning-levels/available-models-catalog.json).
|
|
38
|
+
* `GetUsableModels` carries no window or parameter field, so this table is the
|
|
39
|
+
* authoritative source; see .omo/plans/cursor-reasoning-levels.md §3.1/§6.
|
|
40
|
+
*/
|
|
41
|
+
export const CURSOR_MODEL_CAPABILITIES = {
|
|
42
|
+
"claude-fable-5": claude(1000000, 1000000, ["low", "medium", "high", "xhigh", "max"], "300k"),
|
|
43
|
+
"claude-sonnet-5": claude(1000000, 1000000, ["low", "medium", "high", "xhigh", "max"], "300k"),
|
|
44
|
+
"claude-opus-4-7": claude(1000000, 1000000, ["low", "medium", "high", "xhigh", "max"], "300k"),
|
|
45
|
+
"claude-opus-4-8": claude(1000000, 1000000, ["low", "medium", "high", "xhigh", "max"], "300k"),
|
|
46
|
+
"claude-opus-5": claude(1000000, 1000000, ["low", "medium", "high", "xhigh", "max"], "300k"),
|
|
47
|
+
"claude-4.6-opus": claude(1000000, 1000000, ["high", "max"], "200k"),
|
|
48
|
+
"claude-4.6-sonnet": claude(1000000, 1000000, ["medium"], "200k"),
|
|
49
|
+
"claude-4.5-opus": {
|
|
50
|
+
evidence: "available-models",
|
|
51
|
+
window: 200000,
|
|
52
|
+
parameterOrder: ["thinking"],
|
|
53
|
+
levels: { high: { value: "high", encoding: V } },
|
|
54
|
+
},
|
|
55
|
+
"gpt-5.6-sol": gpt(["none", "low", "medium", "high", "xhigh", "max"], GPT_ORDER, 1000000, 1000000),
|
|
56
|
+
"gpt-5.6-luna": gpt(["none", "low", "medium", "high", "xhigh", "max"], GPT_ORDER, 1000000, 1000000),
|
|
57
|
+
"gpt-5.6-terra": gpt(["none", "low", "medium", "high", "xhigh", "max"], GPT_ORDER, 272000, 272000),
|
|
58
|
+
"gpt-5.5": {
|
|
59
|
+
...gpt(["none", "low", "medium", "high"], GPT_ORDER, 1000000, 1000000),
|
|
60
|
+
levels: { ...ladder(["none", "low", "medium", "high"]), xhigh: { value: "extra-high", encoding: P } },
|
|
61
|
+
},
|
|
62
|
+
"gpt-5.3-codex": {
|
|
63
|
+
...gpt([], ["reasoning", "fast"]),
|
|
64
|
+
maxWindow: undefined,
|
|
65
|
+
defaultContext: undefined,
|
|
66
|
+
levels: { ...ladder(["low", "medium", "high"]), xhigh: { value: "extra-high", encoding: P } },
|
|
67
|
+
},
|
|
68
|
+
"gpt-5.1": {
|
|
69
|
+
...gpt([], ["reasoning"]),
|
|
70
|
+
maxWindow: undefined,
|
|
71
|
+
defaultContext: undefined,
|
|
72
|
+
levels: ladder(["low", "high"]),
|
|
73
|
+
},
|
|
74
|
+
"gpt-5.2": {
|
|
75
|
+
...gpt([], ["reasoning"]),
|
|
76
|
+
maxWindow: undefined,
|
|
77
|
+
defaultContext: undefined,
|
|
78
|
+
levels: { ...ladder(["low", "high"]), xhigh: { value: "xhigh", encoding: V } },
|
|
79
|
+
},
|
|
80
|
+
"gpt-5.4": {
|
|
81
|
+
...gpt([], ["reasoning"]),
|
|
82
|
+
maxWindow: undefined,
|
|
83
|
+
defaultContext: undefined,
|
|
84
|
+
levels: { ...ladder(["low", "medium", "high"]), xhigh: { value: "xhigh", encoding: V } },
|
|
85
|
+
},
|
|
86
|
+
"gpt-5.4-mini": {
|
|
87
|
+
evidence: "available-models",
|
|
88
|
+
window: 400_000,
|
|
89
|
+
parameterOrder: [],
|
|
90
|
+
levels: ladder(["none", "low", "medium", "high", "xhigh"], V),
|
|
91
|
+
},
|
|
92
|
+
"gpt-5.4-nano": {
|
|
93
|
+
...gpt([], ["reasoning"]),
|
|
94
|
+
maxWindow: undefined,
|
|
95
|
+
defaultContext: undefined,
|
|
96
|
+
levels: ladder(["none", "low", "medium", "high", "xhigh"]),
|
|
97
|
+
},
|
|
98
|
+
"gemini-3.7-flash": {
|
|
99
|
+
evidence: "cli-live",
|
|
100
|
+
window: 1_048_576,
|
|
101
|
+
parameterOrder: ["effort"],
|
|
102
|
+
levels: ladder(["low", "medium", "high"]),
|
|
103
|
+
},
|
|
104
|
+
"gemini-3.6-flash": {
|
|
105
|
+
evidence: "suffix-only",
|
|
106
|
+
window: 1_048_576,
|
|
107
|
+
parameterOrder: [],
|
|
108
|
+
levels: ladder(["minimal", "low", "medium", "high"], V),
|
|
109
|
+
},
|
|
110
|
+
"cursor-grok-4.6": {
|
|
111
|
+
evidence: "available-models",
|
|
112
|
+
window: 500_000,
|
|
113
|
+
parameterOrder: ["effort", "fast"],
|
|
114
|
+
levels: ladder(["low", "medium", "high", "xhigh"]),
|
|
115
|
+
},
|
|
116
|
+
"cursor-grok-4.5": {
|
|
117
|
+
evidence: "suffix-only",
|
|
118
|
+
window: 500_000,
|
|
119
|
+
parameterOrder: [],
|
|
120
|
+
levels: ladder(["low", "medium", "high"], V),
|
|
121
|
+
},
|
|
122
|
+
"glm-5.2": {
|
|
123
|
+
evidence: "available-models",
|
|
124
|
+
window: 1000000,
|
|
125
|
+
parameterOrder: ["reasoning"],
|
|
126
|
+
levels: ladder(["high", "max"]),
|
|
127
|
+
},
|
|
128
|
+
"kimi-k3": {
|
|
129
|
+
evidence: "available-models",
|
|
130
|
+
window: 1048576,
|
|
131
|
+
parameterOrder: ["reasoning"],
|
|
132
|
+
levels: ladder(["low", "high", "max"]),
|
|
133
|
+
},
|
|
134
|
+
"composer-2.5": { evidence: "available-models", window: 200000, parameterOrder: ["fast"], levels: {} },
|
|
135
|
+
"claude-haiku-4-5": { evidence: "available-models", window: 200000, parameterOrder: ["thinking"], levels: {} },
|
|
136
|
+
"claude-4-sonnet": {
|
|
137
|
+
evidence: "available-models",
|
|
138
|
+
window: 200000,
|
|
139
|
+
parameterOrder: ["thinking", "context"],
|
|
140
|
+
defaultContext: "200k",
|
|
141
|
+
levels: {},
|
|
142
|
+
},
|
|
143
|
+
"claude-4.5-sonnet": {
|
|
144
|
+
evidence: "available-models",
|
|
145
|
+
window: 200_000,
|
|
146
|
+
parameterOrder: ["thinking", "context"],
|
|
147
|
+
defaultContext: "200k",
|
|
148
|
+
levels: {},
|
|
149
|
+
},
|
|
150
|
+
"kimi-k2.7-code": { evidence: "available-models", window: 262_144, parameterOrder: [], levels: {} },
|
|
151
|
+
"gemini-3-flash": { evidence: "available-models", window: 1000000, parameterOrder: [], levels: {} },
|
|
152
|
+
"gemini-3.1-pro": { evidence: "available-models", window: 1000000, parameterOrder: [], levels: {} },
|
|
153
|
+
"gemini-3.5-flash": { evidence: "available-models", window: 1_048_576, parameterOrder: [], levels: {} },
|
|
154
|
+
"gpt-5-mini": { evidence: "available-models", window: 400_000, parameterOrder: [], levels: {} },
|
|
155
|
+
};
|
|
156
|
+
const ALIASES = aliasData.aliases;
|
|
157
|
+
const LEVEL_TOKENS = ["minimal", "low", "medium", "high", "extra-high", "xhigh", "max", "none"];
|
|
158
|
+
/** Lossless suffix parser: trailing `-fast`, `-thinking-<level>` or `-<level>-thinking`, bare `-thinking`, trailing level. */
|
|
159
|
+
export function parseCursorVariantId(originalId) {
|
|
160
|
+
let rest = originalId;
|
|
161
|
+
let fast = false;
|
|
162
|
+
if (rest.endsWith("-fast")) {
|
|
163
|
+
fast = true;
|
|
164
|
+
rest = rest.slice(0, -5);
|
|
165
|
+
}
|
|
166
|
+
let level;
|
|
167
|
+
let thinking;
|
|
168
|
+
const alternation = LEVEL_TOKENS.join("|");
|
|
169
|
+
const patterns = [
|
|
170
|
+
[new RegExp(`-thinking-(${alternation})$`), true],
|
|
171
|
+
[new RegExp(`-(${alternation})-thinking$`), true],
|
|
172
|
+
];
|
|
173
|
+
for (const [pattern, flag] of patterns) {
|
|
174
|
+
const match = rest.match(pattern);
|
|
175
|
+
if (match) {
|
|
176
|
+
level = match[1];
|
|
177
|
+
thinking = flag;
|
|
178
|
+
rest = rest.slice(0, match.index);
|
|
179
|
+
return { baseId: rest, level, thinking, fast, originalId };
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
if (rest.endsWith("-thinking")) {
|
|
183
|
+
return { baseId: rest.slice(0, -9), level, thinking: true, fast, originalId };
|
|
184
|
+
}
|
|
185
|
+
const levelMatch = rest.match(new RegExp(`-(${alternation})$`));
|
|
186
|
+
if (levelMatch) {
|
|
187
|
+
level = levelMatch[1];
|
|
188
|
+
thinking = false;
|
|
189
|
+
rest = rest.slice(0, levelMatch.index);
|
|
190
|
+
}
|
|
191
|
+
return { baseId: rest, level, thinking, fast, originalId };
|
|
192
|
+
}
|
|
193
|
+
export function getCursorVariantAlias(originalId) {
|
|
194
|
+
return ALIASES[originalId];
|
|
195
|
+
}
|
|
196
|
+
/** Resolve any known variant id to its selectable base identity; unknown ids return undefined. */
|
|
197
|
+
export function getCursorBaseIdForVariant(originalId) {
|
|
198
|
+
const alias = ALIASES[originalId];
|
|
199
|
+
if (alias) {
|
|
200
|
+
const parsed = parseCursorVariantId(alias.targetId);
|
|
201
|
+
return parsed.baseId;
|
|
202
|
+
}
|
|
203
|
+
return undefined;
|
|
204
|
+
}
|
|
205
|
+
export function getCursorCapabilityForBase(baseId) {
|
|
206
|
+
return CURSOR_MODEL_CAPABILITIES[baseId];
|
|
207
|
+
}
|
|
208
|
+
//# sourceMappingURL=model-capabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-capabilities.js","sourceRoot":"","sources":["../../src/cursor/model-capabilities.ts"],"names":[],"mappings":"AACA,OAAO,SAAS,MAAM,+BAA+B,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAuB5E,MAAM,CAAC,GAAG,YAAqB,CAAC;AAChC,MAAM,CAAC,GAAG,YAAqB,CAAC;AAEhC,SAAS,MAAM,CACd,MAAyB,EACzB,WAAgC,CAAC;IAEjC,MAAM,GAAG,GAAyD,EAAE,CAAC;IACrE,KAAK,MAAM,KAAK,IAAI,MAAM;QAAE,GAAG,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAE,KAA4B,CAAC,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;IAChH,OAAO,GAAG,CAAC;AACZ,CAAC;AAED,MAAM,YAAY,GAAiC,CAAC,UAAU,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AACrF,MAAM,SAAS,GAAiC,CAAC,SAAS,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;AAEjF,SAAS,MAAM,CACd,MAAc,EACd,SAAiB,EACjB,MAAyB,EACzB,cAAsB;IAEtB,OAAO;QACN,QAAQ,EAAE,kBAAkB;QAC5B,MAAM;QACN,SAAS;QACT,cAAc,EAAE,YAAY;QAC5B,cAAc;QACd,cAAc,EAAE,MAAM,IAAI,SAAS,CAAC,CAAC,C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,CAAC,CAAC;QACpD,OAAO,MAAM,CAAC,MAAM,CAAC;IACtB,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,MAAc;IACxD,OAAO,yBAAyB,CAAC,MAAM,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["import type { ModelThinkingLevel } from \"../types.ts\";\nimport aliasData from \"./cursor-variant-aliases.json\" with { type: \"json\" };\n\nexport type CursorCapabilityEvidence = \"available-models\" | \"cli-live\" | \"suffix-only\";\nexport type CursorLevelEncoding = \"parameters\" | \"variant-id\";\nexport type CursorParameterId = \"thinking\" | \"context\" | \"effort\" | \"reasoning\" | \"fast\";\n\nexport interface CursorLevelSpec {\n\treadonly value: string;\n\treadonly encoding: CursorLevelEncoding;\n}\n\nexport interface CursorModelCapability {\n\treadonly catalogKey?: string;\n\treadonly evidence: CursorCapabilityEvidence;\n\treadonly window: number;\n\treadonly maxWindow?: number;\n\treadonly parameterOrder: readonly CursorParameterId[];\n\treadonly defaultContext?: string;\n\t/** Context token matching `window`; cursor truncates to whatever this asks for. */\n\treadonly requestContext?: string;\n\treadonly levels: Partial<Record<ModelThinkingLevel, CursorLevelSpec>>;\n}\n\nconst P = \"parameters\" as const;\nconst V = \"variant-id\" as const;\n\nfunction ladder(\n\tvalues: readonly string[],\n\tencoding: CursorLevelEncoding = P,\n): Partial<Record<ModelThinkingLevel, CursorLevelSpec>> {\n\tconst out: Partial<Record<ModelThinkingLevel, CursorLevelSpec>> = {};\n\tfor (const value of values) out[value === \"none\" ? \"off\" : (value as ModelThinkingLevel)] = { value, encoding };\n\treturn out;\n}\n\nconst CLAUDE_ORDER: readonly CursorParameterId[] = [\"thinking\", \"context\", \"effort\"];\nconst GPT_ORDER: readonly CursorParameterId[] = [\"context\", \"reasoning\", \"fast\"];\n\nfunction claude(\n\twindow: number,\n\tmaxWindow: number,\n\tlevels: readonly string[],\n\tdefaultContext: string,\n): CursorModelCapability {\n\treturn {\n\t\tevidence: \"available-models\",\n\t\twindow,\n\t\tmaxWindow,\n\t\tparameterOrder: CLAUDE_ORDER,\n\t\tdefaultContext,\n\t\trequestContext: window >= 1_000_000 ? \"1m\" : defaultContext,\n\t\tlevels: ladder(levels),\n\t};\n}\n\nfunction gpt(\n\tlevels: readonly string[],\n\torder: readonly CursorParameterId[] = GPT_ORDER,\n\twindow = 400000,\n\tmaxWindow = 400000,\n): CursorModelCapability {\n\treturn {\n\t\tevidence: \"available-models\",\n\t\twindow,\n\t\tmaxWindow,\n\t\tparameterOrder: order,\n\t\tdefaultContext: \"272k\",\n\t\trequestContext: order.includes(\"context\") && window >= 1_000_000 ? \"1m\" : undefined,\n\t\tlevels: ladder(levels),\n\t};\n}\n\n/**\n * Static cursor capability table. Values come from the live\n * aiserver.v1 AvailableModels capture of 2026-08-18 (evidence:\n * local-ignore/qa-evidence/20260818-cursor-reasoning-levels/available-models-catalog.json).\n * `GetUsableModels` carries no window or parameter field, so this table is the\n * authoritative source; see .omo/plans/cursor-reasoning-levels.md §3.1/§6.\n */\nexport const CURSOR_MODEL_CAPABILITIES: Record<string, CursorModelCapability> = {\n\t\"claude-fable-5\": claude(1000000, 1000000, [\"low\", \"medium\", \"high\", \"xhigh\", \"max\"], \"300k\"),\n\t\"claude-sonnet-5\": claude(1000000, 1000000, [\"low\", \"medium\", \"high\", \"xhigh\", \"max\"], \"300k\"),\n\t\"claude-opus-4-7\": claude(1000000, 1000000, [\"low\", \"medium\", \"high\", \"xhigh\", \"max\"], \"300k\"),\n\t\"claude-opus-4-8\": claude(1000000, 1000000, [\"low\", \"medium\", \"high\", \"xhigh\", \"max\"], \"300k\"),\n\t\"claude-opus-5\": claude(1000000, 1000000, [\"low\", \"medium\", \"high\", \"xhigh\", \"max\"], \"300k\"),\n\t\"claude-4.6-opus\": claude(1000000, 1000000, [\"high\", \"max\"], \"200k\"),\n\t\"claude-4.6-sonnet\": claude(1000000, 1000000, [\"medium\"], \"200k\"),\n\t\"claude-4.5-opus\": {\n\t\tevidence: \"available-models\",\n\t\twindow: 200000,\n\t\tparameterOrder: [\"thinking\"],\n\t\tlevels: { high: { value: \"high\", encoding: V } },\n\t},\n\t\"gpt-5.6-sol\": gpt([\"none\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"], GPT_ORDER, 1000000, 1000000),\n\t\"gpt-5.6-luna\": gpt([\"none\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"], GPT_ORDER, 1000000, 1000000),\n\t\"gpt-5.6-terra\": gpt([\"none\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"], GPT_ORDER, 272000, 272000),\n\t\"gpt-5.5\": {\n\t\t...gpt([\"none\", \"low\", \"medium\", \"high\"], GPT_ORDER, 1000000, 1000000),\n\t\tlevels: { ...ladder([\"none\", \"low\", \"medium\", \"high\"]), xhigh: { value: \"extra-high\", encoding: P } },\n\t},\n\t\"gpt-5.3-codex\": {\n\t\t...gpt([], [\"reasoning\", \"fast\"]),\n\t\tmaxWindow: undefined,\n\t\tdefaultContext: undefined,\n\t\tlevels: { ...ladder([\"low\", \"medium\", \"high\"]), xhigh: { value: \"extra-high\", encoding: P } },\n\t},\n\t\"gpt-5.1\": {\n\t\t...gpt([], [\"reasoning\"]),\n\t\tmaxWindow: undefined,\n\t\tdefaultContext: undefined,\n\t\tlevels: ladder([\"low\", \"high\"]),\n\t},\n\t\"gpt-5.2\": {\n\t\t...gpt([], [\"reasoning\"]),\n\t\tmaxWindow: undefined,\n\t\tdefaultContext: undefined,\n\t\tlevels: { ...ladder([\"low\", \"high\"]), xhigh: { value: \"xhigh\", encoding: V } },\n\t},\n\t\"gpt-5.4\": {\n\t\t...gpt([], [\"reasoning\"]),\n\t\tmaxWindow: undefined,\n\t\tdefaultContext: undefined,\n\t\tlevels: { ...ladder([\"low\", \"medium\", \"high\"]), xhigh: { value: \"xhigh\", encoding: V } },\n\t},\n\t\"gpt-5.4-mini\": {\n\t\tevidence: \"available-models\",\n\t\twindow: 400_000,\n\t\tparameterOrder: [],\n\t\tlevels: ladder([\"none\", \"low\", \"medium\", \"high\", \"xhigh\"], V),\n\t},\n\t\"gpt-5.4-nano\": {\n\t\t...gpt([], [\"reasoning\"]),\n\t\tmaxWindow: undefined,\n\t\tdefaultContext: undefined,\n\t\tlevels: ladder([\"none\", \"low\", \"medium\", \"high\", \"xhigh\"]),\n\t},\n\t\"gemini-3.7-flash\": {\n\t\tevidence: \"cli-live\",\n\t\twindow: 1_048_576,\n\t\tparameterOrder: [\"effort\"],\n\t\tlevels: ladder([\"low\", \"medium\", \"high\"]),\n\t},\n\t\"gemini-3.6-flash\": {\n\t\tevidence: \"suffix-only\",\n\t\twindow: 1_048_576,\n\t\tparameterOrder: [],\n\t\tlevels: ladder([\"minimal\", \"low\", \"medium\", \"high\"], V),\n\t},\n\t\"cursor-grok-4.6\": {\n\t\tevidence: \"available-models\",\n\t\twindow: 500_000,\n\t\tparameterOrder: [\"effort\", \"fast\"],\n\t\tlevels: ladder([\"low\", \"medium\", \"high\", \"xhigh\"]),\n\t},\n\t\"cursor-grok-4.5\": {\n\t\tevidence: \"suffix-only\",\n\t\twindow: 500_000,\n\t\tparameterOrder: [],\n\t\tlevels: ladder([\"low\", \"medium\", \"high\"], V),\n\t},\n\t\"glm-5.2\": {\n\t\tevidence: \"available-models\",\n\t\twindow: 1000000,\n\t\tparameterOrder: [\"reasoning\"],\n\t\tlevels: ladder([\"high\", \"max\"]),\n\t},\n\t\"kimi-k3\": {\n\t\tevidence: \"available-models\",\n\t\twindow: 1048576,\n\t\tparameterOrder: [\"reasoning\"],\n\t\tlevels: ladder([\"low\", \"high\", \"max\"]),\n\t},\n\t\"composer-2.5\": { evidence: \"available-models\", window: 200000, parameterOrder: [\"fast\"], levels: {} },\n\t\"claude-haiku-4-5\": { evidence: \"available-models\", window: 200000, parameterOrder: [\"thinking\"], levels: {} },\n\t\"claude-4-sonnet\": {\n\t\tevidence: \"available-models\",\n\t\twindow: 200000,\n\t\tparameterOrder: [\"thinking\", \"context\"],\n\t\tdefaultContext: \"200k\",\n\t\tlevels: {},\n\t},\n\t\"claude-4.5-sonnet\": {\n\t\tevidence: \"available-models\",\n\t\twindow: 200_000,\n\t\tparameterOrder: [\"thinking\", \"context\"],\n\t\tdefaultContext: \"200k\",\n\t\tlevels: {},\n\t},\n\t\"kimi-k2.7-code\": { evidence: \"available-models\", window: 262_144, parameterOrder: [], levels: {} },\n\t\"gemini-3-flash\": { evidence: \"available-models\", window: 1000000, parameterOrder: [], levels: {} },\n\t\"gemini-3.1-pro\": { evidence: \"available-models\", window: 1000000, parameterOrder: [], levels: {} },\n\t\"gemini-3.5-flash\": { evidence: \"available-models\", window: 1_048_576, parameterOrder: [], levels: {} },\n\t\"gpt-5-mini\": { evidence: \"available-models\", window: 400_000, parameterOrder: [], levels: {} },\n};\n\nexport interface CursorVariantAlias {\n\treadonly targetId: string;\n\treadonly level?: ModelThinkingLevel;\n\treadonly legacyVariantId: string;\n\treadonly encoding: \"legacy-variant\";\n}\n\nconst ALIASES = aliasData.aliases as Record<string, CursorVariantAlias>;\nconst LEVEL_TOKENS = [\"minimal\", \"low\", \"medium\", \"high\", \"extra-high\", \"xhigh\", \"max\", \"none\"] as const;\n\nexport interface CursorVariantParse {\n\treadonly baseId: string;\n\treadonly level: string | undefined;\n\treadonly thinking: boolean | undefined;\n\treadonly fast: boolean;\n\treadonly originalId: string;\n}\n\n/** Lossless suffix parser: trailing `-fast`, `-thinking-<level>` or `-<level>-thinking`, bare `-thinking`, trailing level. */\nexport function parseCursorVariantId(originalId: string): CursorVariantParse {\n\tlet rest = originalId;\n\tlet fast = false;\n\tif (rest.endsWith(\"-fast\")) {\n\t\tfast = true;\n\t\trest = rest.slice(0, -5);\n\t}\n\tlet level: string | undefined;\n\tlet thinking: boolean | undefined;\n\tconst alternation = LEVEL_TOKENS.join(\"|\");\n\tconst patterns: [RegExp, boolean][] = [\n\t\t[new RegExp(`-thinking-(${alternation})$`), true],\n\t\t[new RegExp(`-(${alternation})-thinking$`), true],\n\t];\n\tfor (const [pattern, flag] of patterns) {\n\t\tconst match = rest.match(pattern);\n\t\tif (match) {\n\t\t\tlevel = match[1];\n\t\t\tthinking = flag;\n\t\t\trest = rest.slice(0, match.index);\n\t\t\treturn { baseId: rest, level, thinking, fast, originalId };\n\t\t}\n\t}\n\tif (rest.endsWith(\"-thinking\")) {\n\t\treturn { baseId: rest.slice(0, -9), level, thinking: true, fast, originalId };\n\t}\n\tconst levelMatch = rest.match(new RegExp(`-(${alternation})$`));\n\tif (levelMatch) {\n\t\tlevel = levelMatch[1];\n\t\tthinking = false;\n\t\trest = rest.slice(0, levelMatch.index);\n\t}\n\treturn { baseId: rest, level, thinking, fast, originalId };\n}\n\nexport function getCursorVariantAlias(originalId: string): CursorVariantAlias | undefined {\n\treturn ALIASES[originalId];\n}\n\n/** Resolve any known variant id to its selectable base identity; unknown ids return undefined. */\nexport function getCursorBaseIdForVariant(originalId: string): string | undefined {\n\tconst alias = ALIASES[originalId];\n\tif (alias) {\n\t\tconst parsed = parseCursorVariantId(alias.targetId);\n\t\treturn parsed.baseId;\n\t}\n\treturn undefined;\n}\n\nexport function getCursorCapabilityForBase(baseId: string): CursorModelCapability | undefined {\n\treturn CURSOR_MODEL_CAPABILITIES[baseId];\n}\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Model } from "../model.ts";
|
|
2
|
+
import type { ThinkingSelection } from "../types.ts";
|
|
3
|
+
import { type CursorParameterId } from "./model-capabilities.ts";
|
|
4
|
+
export interface CursorResolvedSelection {
|
|
5
|
+
readonly modelId: string;
|
|
6
|
+
readonly parameters: readonly {
|
|
7
|
+
readonly id: CursorParameterId;
|
|
8
|
+
readonly value: string;
|
|
9
|
+
}[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Resolve a Cursor model + thinking selection to its wire descriptor: the exact
|
|
13
|
+
* model id plus ordered parameters. Both Cursor transports consume this; the
|
|
14
|
+
* native lane renders parameters into protobuf, the CLI lane renders a model
|
|
15
|
+
* string. Absent/unsupported selections return the representative or upstream
|
|
16
|
+
* id with zero parameters.
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolveCursorSelectionDescriptor(model: Model<"cursor-agent">, selection: ThinkingSelection | undefined): CursorResolvedSelection;
|
|
19
|
+
/** Render the resolved descriptor as one CLI `--model` argv element (bracket or suffix form). */
|
|
20
|
+
export declare function renderCursorCliModelString(model: Model<"cursor-agent">, selection: ThinkingSelection | undefined): string;
|
|
21
|
+
//# sourceMappingURL=selection-descriptor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection-descriptor.d.ts","sourceRoot":"","sources":["../../src/cursor/selection-descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,KAAK,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,KAAK,EAAsB,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACzE,OAAO,EAGN,KAAK,iBAAiB,EAEtB,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,uBAAuB;IACvC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,SAAS;QAAE,QAAQ,CAAC,EAAE,EAAE,iBAAiB,CAAC;QAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC3F;AAiED;;;;;;GAMG;AACH,wBAAgB,gCAAgC,CAC/C,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,EAC5B,SAAS,EAAE,iBAAiB,GAAG,SAAS,GACtC,uBAAuB,CAiCzB;AAED,iGAAiG;AACjG,wBAAgB,0BAA0B,CACzC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,EAC5B,SAAS,EAAE,iBAAiB,GAAG,SAAS,GACtC,MAAM,CAKR"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { CURSOR_MODEL_CAPABILITIES, getCursorVariantAlias, } from "./model-capabilities.js";
|
|
2
|
+
function identityCompat(model) {
|
|
3
|
+
return model.compat?.cursorReasoning;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Catalog-guaranteed suffix alias for a base + level, or undefined. Cursor Run
|
|
7
|
+
* rejects bare capability ids with Connect `not_found` (issue #1008; live
|
|
8
|
+
* probes 2026-08-20), so every resolvable level prefers the suffix variant id
|
|
9
|
+
* the `GetUsableModels` catalog actually serves. Candidates try the level's
|
|
10
|
+
* wire value first, then the level token itself (`extra-high` vs `xhigh`),
|
|
11
|
+
* with thinking-infixed forms for thinking Claude identities.
|
|
12
|
+
*/
|
|
13
|
+
function suffixAliasId(compat, level, spec) {
|
|
14
|
+
const suffixes = level === "off" ? ["none"] : spec.value === level ? [spec.value] : [spec.value, level];
|
|
15
|
+
for (const suffix of suffixes) {
|
|
16
|
+
const candidates = compat.thinkingMode === true
|
|
17
|
+
? [`${compat.capabilityId}-thinking-${suffix}`, `${compat.capabilityId}-${suffix}-thinking`]
|
|
18
|
+
: [`${compat.capabilityId}-${suffix}`];
|
|
19
|
+
for (const candidate of candidates) {
|
|
20
|
+
const alias = getCursorVariantAlias(candidate);
|
|
21
|
+
if (alias)
|
|
22
|
+
return alias.legacyVariantId;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
function buildParameters(capabilityId, value, thinkingMode) {
|
|
28
|
+
const capability = CURSOR_MODEL_CAPABILITIES[capabilityId];
|
|
29
|
+
if (!capability)
|
|
30
|
+
return [];
|
|
31
|
+
const out = [];
|
|
32
|
+
for (const id of capability.parameterOrder) {
|
|
33
|
+
switch (id) {
|
|
34
|
+
case "thinking":
|
|
35
|
+
out.push({ id, value: thinkingMode === true ? "true" : "false" });
|
|
36
|
+
break;
|
|
37
|
+
case "context": {
|
|
38
|
+
const context = capability.requestContext ?? capability.defaultContext;
|
|
39
|
+
if (context !== undefined)
|
|
40
|
+
out.push({ id, value: context });
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
case "effort":
|
|
44
|
+
case "reasoning":
|
|
45
|
+
out.push({ id, value });
|
|
46
|
+
break;
|
|
47
|
+
case "fast":
|
|
48
|
+
out.push({ id, value: "false" });
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return out;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Resolve a Cursor model + thinking selection to its wire descriptor: the exact
|
|
56
|
+
* model id plus ordered parameters. Both Cursor transports consume this; the
|
|
57
|
+
* native lane renders parameters into protobuf, the CLI lane renders a model
|
|
58
|
+
* string. Absent/unsupported selections return the representative or upstream
|
|
59
|
+
* id with zero parameters.
|
|
60
|
+
*/
|
|
61
|
+
export function resolveCursorSelectionDescriptor(model, selection) {
|
|
62
|
+
const compat = identityCompat(model);
|
|
63
|
+
const fallback = { modelId: model.upstreamModelId ?? model.id, parameters: [] };
|
|
64
|
+
if (!compat)
|
|
65
|
+
return fallback;
|
|
66
|
+
if (selection === undefined) {
|
|
67
|
+
return { modelId: compat.representativeVariantId, parameters: [] };
|
|
68
|
+
}
|
|
69
|
+
if (selection.source === "legacy-variant") {
|
|
70
|
+
if (selection.legacyVariantId === undefined || getCursorVariantAlias(selection.legacyVariantId) === undefined) {
|
|
71
|
+
return { modelId: compat.representativeVariantId, parameters: [] };
|
|
72
|
+
}
|
|
73
|
+
return { modelId: selection.legacyVariantId, parameters: [] };
|
|
74
|
+
}
|
|
75
|
+
const capability = CURSOR_MODEL_CAPABILITIES[compat.capabilityId];
|
|
76
|
+
const spec = capability?.levels[selection.level];
|
|
77
|
+
if (!capability || !spec) {
|
|
78
|
+
return { modelId: compat.representativeVariantId, parameters: [] };
|
|
79
|
+
}
|
|
80
|
+
const suffixId = suffixAliasId(compat, selection.level, spec);
|
|
81
|
+
if (suffixId !== undefined)
|
|
82
|
+
return { modelId: suffixId, parameters: [] };
|
|
83
|
+
if (spec.encoding === "variant-id") {
|
|
84
|
+
return { modelId: compat.representativeVariantId, parameters: [] };
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
modelId: compat.capabilityId,
|
|
88
|
+
parameters: buildParameters(compat.capabilityId, spec.value, compat.thinkingMode),
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/** Render the resolved descriptor as one CLI `--model` argv element (bracket or suffix form). */
|
|
92
|
+
export function renderCursorCliModelString(model, selection) {
|
|
93
|
+
const resolved = resolveCursorSelectionDescriptor(model, selection);
|
|
94
|
+
if (resolved.parameters.length === 0)
|
|
95
|
+
return resolved.modelId;
|
|
96
|
+
const args = resolved.parameters.map((parameter) => `${parameter.id}=${parameter.value}`).join(",");
|
|
97
|
+
return `${resolved.modelId}[${args}]`;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=selection-descriptor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection-descriptor.js","sourceRoot":"","sources":["../../src/cursor/selection-descriptor.ts"],"names":[],"mappings":"AAEA,OAAO,EACN,yBAAyB,EAGzB,qBAAqB,GACrB,MAAM,yBAAyB,CAAC;AAOjC,SAAS,cAAc,CAAC,KAA4B;IACnD,OAAO,KAAK,CAAC,MAAM,EAAE,eAAe,CAAC;AACtC,CAAC;AAID;;;;;;;GAOG;AACH,SAAS,aAAa,CACrB,MAA+B,EAC/B,KAAyB,EACzB,IAAqB;IAErB,MAAM,QAAQ,GAAG,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACxG,KAAK,MAAM,MAAM,IAAI,QAAQ,EAAE,CAAC;QAC/B,MAAM,UAAU,GACf,MAAM,CAAC,YAAY,KAAK,IAAI;YAC3B,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,YAA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AAE,EAAE,CAAC;IACpE,CAAC;IAED,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,EAAE,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAC9D,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;IAEzE,IAAI,IAAI,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;QACpC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,uBAAuB,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;IACpE,CAAC;IAED,OAAO;QACN,OAAO,EAAE,MAAM,CAAC,YAAY;QAC5B,UAAU,EAAE,eAAe,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,YAAY,CAAC;KACjF,CAAC;AACH,CAAC;AAED,iGAAiG;AACjG,MAAM,UAAU,0BAA0B,CACzC,KAA4B,EAC5B,SAAwC;IAExC,MAAM,QAAQ,GAAG,gCAAgC,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IACpE,IAAI,QAAQ,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,QAAQ,CAAC,OAAO,CAAC;IAC9D,MAAM,IAAI,GAAG,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,GAAG,SAAS,CAAC,EAAE,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACpG,OAAO,GAAG,QAAQ,CAAC,OAAO,IAAI,IAAI,GAAG,CAAC;AACvC,CAAC","sourcesContent":["import type { CursorAgentCompat, Model } from \"../model.ts\";\nimport type { ModelThinkingLevel, ThinkingSelection } from \"../types.ts\";\nimport {\n\tCURSOR_MODEL_CAPABILITIES,\n\ttype CursorLevelSpec,\n\ttype CursorParameterId,\n\tgetCursorVariantAlias,\n} from \"./model-capabilities.ts\";\n\nexport interface CursorResolvedSelection {\n\treadonly modelId: string;\n\treadonly parameters: readonly { readonly id: CursorParameterId; readonly value: string }[];\n}\n\nfunction identityCompat(model: Model<\"cursor-agent\">): CursorAgentCompat[\"cursorReasoning\"] {\n\treturn model.compat?.cursorReasoning;\n}\n\ntype CursorReasoningIdentity = NonNullable<CursorAgentCompat[\"cursorReasoning\"]>;\n\n/**\n * Catalog-guaranteed suffix alias for a base + level, or undefined. Cursor Run\n * rejects bare capability ids with Connect `not_found` (issue #1008; live\n * probes 2026-08-20), so every resolvable level prefers the suffix variant id\n * the `GetUsableModels` catalog actually serves. Candidates try the level's\n * wire value first, then the level token itself (`extra-high` vs `xhigh`),\n * with thinking-infixed forms for thinking Claude identities.\n */\nfunction suffixAliasId(\n\tcompat: CursorReasoningIdentity,\n\tlevel: ModelThinkingLevel,\n\tspec: CursorLevelSpec,\n): string | undefined {\n\tconst suffixes = level === \"off\" ? [\"none\"] : spec.value === level ? [spec.value] : [spec.value, level];\n\tfor (const suffix of suffixes) {\n\t\tconst candidates =\n\t\t\tcompat.thinkingMode === true\n\t\t\t\t? [`${compat.capabilityId}-thinking-${suffix}`, `${compat.capabilityId}-${suffix}-thinking`]\n\t\t\t\t: [`${compat.capabilityId}-${suffix}`];\n\t\tfor (const candidate of candidates) {\n\t\t\tconst alias = getCursorVariantAlias(candidate);\n\t\t\tif (alias) return alias.legacyVariantId;\n\t\t}\n\t}\n\treturn undefined;\n}\n\nfunction buildParameters(\n\tcapabilityId: string,\n\tvalue: string,\n\tthinkingMode: boolean | undefined,\n): { id: CursorParameterId; value: string }[] {\n\tconst capability = CURSOR_MODEL_CAPABILITIES[capabilityId];\n\tif (!capability) return [];\n\tconst out: { id: CursorParameterId; value: string }[] = [];\n\tfor (const id of capability.parameterOrder) {\n\t\tswitch (id) {\n\t\t\tcase \"thinking\":\n\t\t\t\tout.push({ id, value: thinkingMode === true ? \"true\" : \"false\" });\n\t\t\t\tbreak;\n\t\t\tcase \"context\": {\n\t\t\t\tconst context = capability.requestContext ?? capability.defaultContext;\n\t\t\t\tif (context !== undefined) out.push({ id, value: context });\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tcase \"effort\":\n\t\t\tcase \"reasoning\":\n\t\t\t\tout.push({ id, value });\n\t\t\t\tbreak;\n\t\t\tcase \"fast\":\n\t\t\t\tout.push({ id, value: \"false\" });\n\t\t\t\tbreak;\n\t\t}\n\t}\n\treturn out;\n}\n\n/**\n * Resolve a Cursor model + thinking selection to its wire descriptor: the exact\n * model id plus ordered parameters. Both Cursor transports consume this; the\n * native lane renders parameters into protobuf, the CLI lane renders a model\n * string. Absent/unsupported selections return the representative or upstream\n * id with zero parameters.\n */\nexport function resolveCursorSelectionDescriptor(\n\tmodel: Model<\"cursor-agent\">,\n\tselection: ThinkingSelection | undefined,\n): CursorResolvedSelection {\n\tconst compat = identityCompat(model);\n\tconst fallback: CursorResolvedSelection = { modelId: model.upstreamModelId ?? model.id, parameters: [] };\n\tif (!compat) return fallback;\n\n\tif (selection === undefined) {\n\t\treturn { modelId: compat.representativeVariantId, parameters: [] };\n\t}\n\n\tif (selection.source === \"legacy-variant\") {\n\t\tif (selection.legacyVariantId === undefined || getCursorVariantAlias(selection.legacyVariantId) === undefined) {\n\t\t\treturn { modelId: compat.representativeVariantId, parameters: [] };\n\t\t}\n\t\treturn { modelId: selection.legacyVariantId, parameters: [] };\n\t}\n\n\tconst capability = CURSOR_MODEL_CAPABILITIES[compat.capabilityId];\n\tconst spec = capability?.levels[selection.level];\n\tif (!capability || !spec) {\n\t\treturn { modelId: compat.representativeVariantId, parameters: [] };\n\t}\n\n\tconst suffixId = suffixAliasId(compat, selection.level, spec);\n\tif (suffixId !== undefined) return { modelId: suffixId, parameters: [] };\n\n\tif (spec.encoding === \"variant-id\") {\n\t\treturn { modelId: compat.representativeVariantId, parameters: [] };\n\t}\n\n\treturn {\n\t\tmodelId: compat.capabilityId,\n\t\tparameters: buildParameters(compat.capabilityId, spec.value, compat.thinkingMode),\n\t};\n}\n\n/** Render the resolved descriptor as one CLI `--model` argv element (bracket or suffix form). */\nexport function renderCursorCliModelString(\n\tmodel: Model<\"cursor-agent\">,\n\tselection: ThinkingSelection | undefined,\n): string {\n\tconst resolved = resolveCursorSelectionDescriptor(model, selection);\n\tif (resolved.parameters.length === 0) return resolved.modelId;\n\tconst args = resolved.parameters.map((parameter) => `${parameter.id}=${parameter.value}`).join(\",\");\n\treturn `${resolved.modelId}[${args}]`;\n}\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Model } from "../types.ts";
|
|
2
|
+
/**
|
|
3
|
+
* Idempotent stored-catalog transform: pre-grouping 204-variant cursor entries
|
|
4
|
+
* are regrouped into selectable identities; already-grouped, unknown, and
|
|
5
|
+
* malformed entries pass through unchanged in stable input order.
|
|
6
|
+
*/
|
|
7
|
+
export declare function regroupStoredCursorModels(models: readonly Model<"cursor-agent">[]): Model<"cursor-agent">[];
|
|
8
|
+
//# sourceMappingURL=store-migration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store-migration.d.ts","sourceRoot":"","sources":["../../src/cursor/store-migration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAyCzC;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,SAAS,KAAK,CAAC,cAAc,CAAC,EAAE,GAAG,KAAK,CAAC,cAAc,CAAC,EAAE,CAiC3G"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { normalizeCursorCatalog } from "./catalog-grouping.js";
|
|
2
|
+
import { getCursorVariantAlias } from "./model-capabilities.js";
|
|
3
|
+
function isGroupedShape(model) {
|
|
4
|
+
return model.compat?.cursorReasoning !== undefined || getCursorVariantAlias(model.id) === undefined;
|
|
5
|
+
}
|
|
6
|
+
function entryToModel(entry, maxTokensById) {
|
|
7
|
+
const representative = entry.representativeVariantId ?? entry.legacyAliases[0] ?? entry.id;
|
|
8
|
+
const maxTokens = maxTokensById.get(representative) ?? maxTokensById.get(entry.id) ?? 64000;
|
|
9
|
+
return {
|
|
10
|
+
id: entry.id,
|
|
11
|
+
name: entry.name,
|
|
12
|
+
api: "cursor-agent",
|
|
13
|
+
provider: "cursor",
|
|
14
|
+
baseUrl: "https://api2.cursor.sh",
|
|
15
|
+
reasoning: entry.reasoning,
|
|
16
|
+
...(entry.thinkingLevelMap ? { thinkingLevelMap: entry.thinkingLevelMap } : {}),
|
|
17
|
+
input: entry.input,
|
|
18
|
+
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
|
19
|
+
contextWindow: entry.window,
|
|
20
|
+
maxTokens,
|
|
21
|
+
...(entry.representativeVariantId !== undefined && entry.representativeVariantId !== entry.id
|
|
22
|
+
? { upstreamModelId: entry.representativeVariantId }
|
|
23
|
+
: {}),
|
|
24
|
+
compat: {
|
|
25
|
+
...(entry.cursorMaxMode ? { cursorMaxMode: true } : {}),
|
|
26
|
+
...(entry.capabilityId !== undefined && entry.representativeVariantId !== undefined
|
|
27
|
+
? {
|
|
28
|
+
cursorReasoning: {
|
|
29
|
+
capabilityId: entry.capabilityId,
|
|
30
|
+
...(entry.thinkingMode !== undefined ? { thinkingMode: entry.thinkingMode } : {}),
|
|
31
|
+
representativeVariantId: entry.representativeVariantId,
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
: {}),
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Idempotent stored-catalog transform: pre-grouping 204-variant cursor entries
|
|
40
|
+
* are regrouped into selectable identities; already-grouped, unknown, and
|
|
41
|
+
* malformed entries pass through unchanged in stable input order.
|
|
42
|
+
*/
|
|
43
|
+
export function regroupStoredCursorModels(models) {
|
|
44
|
+
const legacy = models.filter((model) => !isGroupedShape(model));
|
|
45
|
+
if (legacy.length === 0)
|
|
46
|
+
return [...models];
|
|
47
|
+
const maxTokensById = new Map(models.map((model) => [model.id, model.maxTokens]));
|
|
48
|
+
const regrouped = new Map(normalizeCursorCatalog(legacy.map((model) => ({
|
|
49
|
+
id: model.id,
|
|
50
|
+
name: model.name,
|
|
51
|
+
input: model.input.filter((modality) => modality !== "video"),
|
|
52
|
+
cursorMaxMode: model.compat?.cursorMaxMode === true,
|
|
53
|
+
}))).map((entry) => [entry.id, entryToModel(entry, maxTokensById)]));
|
|
54
|
+
const seen = new Set();
|
|
55
|
+
const out = [];
|
|
56
|
+
for (const model of models) {
|
|
57
|
+
if (isGroupedShape(model)) {
|
|
58
|
+
out.push(model);
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
const alias = getCursorVariantAlias(model.id);
|
|
62
|
+
const targetId = alias?.targetId ?? model.id;
|
|
63
|
+
if (seen.has(targetId))
|
|
64
|
+
continue;
|
|
65
|
+
seen.add(targetId);
|
|
66
|
+
const transformed = regrouped.get(targetId);
|
|
67
|
+
if (transformed !== undefined) {
|
|
68
|
+
out.push(transformed);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
out.push(model);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return out;
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=store-migration.js.map
|
|
@@ -0,0 +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,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IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,GAAG,GAA4B,EAAE,CAAC;IACxC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC5B,IAAI,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;YAC3B,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAChB,SAAS;QACV,CAAC;QACD,MAAM,KAAK,GAAG,qBAAqB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC9C,MAAM,QAAQ,GAAG,KAAK,EAAE,QAAQ,IAAI,KAAK,CAAC,EAAE,CAAC;QAC7C,IAAI,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC;YAAE,SAAS;QACjC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACnB,MAAM,WAAW,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 { 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: 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"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type { BedrockOptions, BedrockThinkingDisplay } from "./api/bedrock-conve
|
|
|
7
7
|
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";
|
|
8
8
|
export type { CursorAgentOptions, CursorExecHandlerResult, CursorExecHandlers, CursorExecPairing, CursorMcpCall, CursorPiCall, CursorShellStreamCallbacks, CursorToolResultHandler, } from "./api/cursor-agent/types.ts";
|
|
9
9
|
export type { GoogleOptions } from "./api/google-generative-ai.ts";
|
|
10
|
-
export type {
|
|
10
|
+
export type { GoogleApiThinkingLevel, ResolvedGoogleThinkingLevel } from "./api/google-shared.ts";
|
|
11
11
|
export type { GoogleVertexOptions } from "./api/google-vertex.ts";
|
|
12
12
|
export * from "./api/lazy.ts";
|
|
13
13
|
export type { MistralOptions } from "./api/mistral-conversations.ts";
|
|
@@ -25,6 +25,9 @@ export * from "./auth/helpers.ts";
|
|
|
25
25
|
export * from "./auth/types.ts";
|
|
26
26
|
export type { OAuthAuthInfo, OAuthDeviceCodeInfo, OAuthLoginCallbacks, OAuthPrompt, OAuthProviderId, OAuthSelectOption, OAuthSelectPrompt, } from "./compat/extension-oauth-types.ts";
|
|
27
27
|
export { CONTEXT_PROVENANCE_FIELD, type ContextProvenance, contextProvenanceFingerprint, copyContextProvenance, getContextProvenance, } from "./context-provenance.ts";
|
|
28
|
+
export * from "./cursor/catalog-grouping.ts";
|
|
29
|
+
export { CURSOR_MODEL_CAPABILITIES, type CursorCapabilityEvidence, type CursorLevelEncoding, type CursorLevelSpec, type CursorModelCapability, type CursorParameterId, type CursorVariantAlias, type CursorVariantParse, getCursorBaseIdForVariant, getCursorCapabilityForBase, getCursorVariantAlias, } from "./cursor/model-capabilities.ts";
|
|
30
|
+
export { type CursorResolvedSelection, renderCursorCliModelString, resolveCursorSelectionDescriptor, } from "./cursor/selection-descriptor.ts";
|
|
28
31
|
export * from "./env-api-keys.ts";
|
|
29
32
|
export * from "./images-models.ts";
|
|
30
33
|
export * from "./models.ts";
|
|
@@ -37,6 +40,7 @@ export { wrapStreamWithInvokeRecovery } from "./tool-call-middleware/recovery-st
|
|
|
37
40
|
export * from "./types.ts";
|
|
38
41
|
export { type CursorExecResolvedCarrier, copyCursorExecResolved, isCursorExecResolved, kCursorExecResolved, } from "./utils/block-symbols.ts";
|
|
39
42
|
export * from "./utils/diagnostics.ts";
|
|
43
|
+
export { estimateContextTokens } from "./utils/estimate.ts";
|
|
40
44
|
export * from "./utils/event-stream.ts";
|
|
41
45
|
export * from "./utils/json-parse.ts";
|
|
42
46
|
export { extractOpenAiCodexAccountId } from "./utils/openai-codex-auth.ts";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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;AA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;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"}
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,9 @@ export * from "./auth/headers.js";
|
|
|
11
11
|
export * from "./auth/helpers.js";
|
|
12
12
|
export * from "./auth/types.js";
|
|
13
13
|
export { CONTEXT_PROVENANCE_FIELD, contextProvenanceFingerprint, copyContextProvenance, getContextProvenance, } from "./context-provenance.js";
|
|
14
|
+
export * from "./cursor/catalog-grouping.js";
|
|
15
|
+
export { CURSOR_MODEL_CAPABILITIES, getCursorBaseIdForVariant, getCursorCapabilityForBase, getCursorVariantAlias, } from "./cursor/model-capabilities.js";
|
|
16
|
+
export { renderCursorCliModelString, resolveCursorSelectionDescriptor, } from "./cursor/selection-descriptor.js";
|
|
14
17
|
export * from "./env-api-keys.js";
|
|
15
18
|
export * from "./images-models.js";
|
|
16
19
|
export * from "./models.js";
|
|
@@ -23,6 +26,7 @@ export { wrapStreamWithInvokeRecovery } from "./tool-call-middleware/recovery-st
|
|
|
23
26
|
export * from "./types.js";
|
|
24
27
|
export { copyCursorExecResolved, isCursorExecResolved, kCursorExecResolved, } from "./utils/block-symbols.js";
|
|
25
28
|
export * from "./utils/diagnostics.js";
|
|
29
|
+
export { estimateContextTokens } from "./utils/estimate.js";
|
|
26
30
|
export * from "./utils/event-stream.js";
|
|
27
31
|
export * from "./utils/json-parse.js";
|
|
28
32
|
export { extractOpenAiCodexAccountId } from "./utils/openai-codex-auth.js";
|