@byokkit/cmd-provider-anthropic 0.1.0
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 +16 -0
- package/dist/chunk-4XYJWEC6.js +127 -0
- package/dist/chunk-4XYJWEC6.js.map +1 -0
- package/dist/chunk-V3B4JGF6.js +127 -0
- package/dist/chunk-V3B4JGF6.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +464 -0
- package/dist/index.js.map +1 -0
- package/dist/models.d.ts +121 -0
- package/dist/models.js +15 -0
- package/dist/models.js.map +1 -0
- package/dist/server/index.d.ts +19 -0
- package/dist/server/index.js +242 -0
- package/dist/server/index.js.map +1 -0
- package/package.json +44 -0
package/README.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# @byokkit/cmd-provider-anthropic
|
|
2
|
+
|
|
3
|
+
Anthropic OAuth for the cmd CLI, packaged as an external BYOK provider.
|
|
4
|
+
|
|
5
|
+
For individual use, not affiliated with cmd.
|
|
6
|
+
|
|
7
|
+
## Development
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
pnpm install
|
|
11
|
+
pnpm typecheck
|
|
12
|
+
pnpm test
|
|
13
|
+
pnpm build
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Tests inject `fetch` and the clock; no real network.
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// src/models.ts
|
|
2
|
+
var EFFORT_LOW_TO_MAX = [
|
|
3
|
+
"low",
|
|
4
|
+
"medium",
|
|
5
|
+
"high",
|
|
6
|
+
"xhigh",
|
|
7
|
+
"max"
|
|
8
|
+
];
|
|
9
|
+
var ANTHROPIC_MODEL_OPTIONS = {
|
|
10
|
+
SONNET_5: {
|
|
11
|
+
id: "claude-sonnet-5",
|
|
12
|
+
inputModalities: ["text", "image"],
|
|
13
|
+
provider: "anthropic",
|
|
14
|
+
spec: "chatComplete",
|
|
15
|
+
label: "Claude Sonnet 5",
|
|
16
|
+
name: "Claude Sonnet 5",
|
|
17
|
+
description: "best combo of speed & intelligence (recommended)",
|
|
18
|
+
// Sonnet 5 rejects non-default `temperature` with a 400 (new for
|
|
19
|
+
// Sonnet-class, same as Opus 4.7+). `reasoning: true` stops the API from
|
|
20
|
+
// injecting temperature. Sonnet 4.6 still accepts it, so it stays unset.
|
|
21
|
+
reasoning: true,
|
|
22
|
+
reasoningEfforts: EFFORT_LOW_TO_MAX,
|
|
23
|
+
contextWindow: 1e6
|
|
24
|
+
},
|
|
25
|
+
SONNET_4_6: {
|
|
26
|
+
id: "claude-sonnet-4-6",
|
|
27
|
+
inputModalities: ["text", "image"],
|
|
28
|
+
provider: "anthropic",
|
|
29
|
+
spec: "chatComplete",
|
|
30
|
+
label: "Claude Sonnet 4.6",
|
|
31
|
+
name: "Claude Sonnet 4.6",
|
|
32
|
+
description: "prev Sonnet, still fast & capable",
|
|
33
|
+
reasoningEfforts: EFFORT_LOW_TO_MAX,
|
|
34
|
+
contextWindow: 1e6
|
|
35
|
+
},
|
|
36
|
+
FABLE_5: {
|
|
37
|
+
id: "claude-fable-5",
|
|
38
|
+
inputModalities: ["text", "image"],
|
|
39
|
+
provider: "anthropic",
|
|
40
|
+
spec: "chatComplete",
|
|
41
|
+
label: "Claude Fable 5",
|
|
42
|
+
name: "Claude Fable 5",
|
|
43
|
+
description: "most capable for demanding reasoning & long-horizon agents",
|
|
44
|
+
reasoning: true,
|
|
45
|
+
reasoningEfforts: EFFORT_LOW_TO_MAX,
|
|
46
|
+
contextWindow: 1e6
|
|
47
|
+
},
|
|
48
|
+
OPUS_5: {
|
|
49
|
+
id: "claude-opus-5",
|
|
50
|
+
inputModalities: ["text", "image"],
|
|
51
|
+
provider: "anthropic",
|
|
52
|
+
spec: "chatComplete",
|
|
53
|
+
label: "Claude Opus 5",
|
|
54
|
+
name: "Claude Opus 5",
|
|
55
|
+
description: "most intelligent Opus for agents and coding",
|
|
56
|
+
reasoning: true,
|
|
57
|
+
reasoningEfforts: EFFORT_LOW_TO_MAX,
|
|
58
|
+
contextWindow: 1e6
|
|
59
|
+
},
|
|
60
|
+
OPUS_4_8: {
|
|
61
|
+
id: "claude-opus-4-8",
|
|
62
|
+
inputModalities: ["text", "image"],
|
|
63
|
+
provider: "anthropic",
|
|
64
|
+
spec: "chatComplete",
|
|
65
|
+
label: "Claude Opus 4.8",
|
|
66
|
+
name: "Claude Opus 4.8",
|
|
67
|
+
description: "prev flagship, still strong for agents and coding",
|
|
68
|
+
reasoning: true,
|
|
69
|
+
reasoningEfforts: EFFORT_LOW_TO_MAX,
|
|
70
|
+
contextWindow: 1e6
|
|
71
|
+
},
|
|
72
|
+
OPUS_4_7: {
|
|
73
|
+
id: "claude-opus-4-7",
|
|
74
|
+
inputModalities: ["text", "image"],
|
|
75
|
+
provider: "anthropic",
|
|
76
|
+
spec: "chatComplete",
|
|
77
|
+
label: "Claude Opus 4.7",
|
|
78
|
+
name: "Claude Opus 4.7",
|
|
79
|
+
description: "older Opus, still strong for agents and coding",
|
|
80
|
+
reasoning: true,
|
|
81
|
+
reasoningEfforts: EFFORT_LOW_TO_MAX,
|
|
82
|
+
contextWindow: 1e6
|
|
83
|
+
},
|
|
84
|
+
HAIKU_4_5: {
|
|
85
|
+
id: "claude-haiku-4-5-20251001",
|
|
86
|
+
inputModalities: ["text", "image"],
|
|
87
|
+
provider: "anthropic",
|
|
88
|
+
spec: "chatComplete",
|
|
89
|
+
label: "Claude Haiku 4.5",
|
|
90
|
+
name: "Claude Haiku 4.5",
|
|
91
|
+
description: "fastest & most compact, great for quick tasks",
|
|
92
|
+
contextWindow: 2e5
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
var ANTHROPIC_MODEL_IDS = Object.values(
|
|
96
|
+
ANTHROPIC_MODEL_OPTIONS
|
|
97
|
+
).map((option) => option.id);
|
|
98
|
+
var ANTHROPIC_DEPRECATED_MODEL_ALIASES = {
|
|
99
|
+
"claude-sonnet-4-20250514": "claude-sonnet-4-6",
|
|
100
|
+
"claude-sonnet-4-5-20250929": "claude-sonnet-4-6",
|
|
101
|
+
"claude-opus-4-5-20251101": "claude-opus-4-7",
|
|
102
|
+
"claude-opus-4-6": "claude-opus-4-7",
|
|
103
|
+
// Undated alias for the Haiku 4.5 dated snapshot.
|
|
104
|
+
"claude-haiku-4-5": "claude-haiku-4-5-20251001"
|
|
105
|
+
};
|
|
106
|
+
function matchesAnthropicModel(modelId) {
|
|
107
|
+
return modelId.toLowerCase().includes("claude");
|
|
108
|
+
}
|
|
109
|
+
var ANTHROPIC_MODEL_SPECS = Object.values(ANTHROPIC_MODEL_OPTIONS).map(
|
|
110
|
+
(option) => ({
|
|
111
|
+
id: option.id,
|
|
112
|
+
provider: "anthropic",
|
|
113
|
+
contextWindow: option.contextWindow,
|
|
114
|
+
reasoningEfforts: "reasoningEfforts" in option ? option.reasoningEfforts : void 0,
|
|
115
|
+
inputModalities: option.inputModalities,
|
|
116
|
+
interleavedThinking: true
|
|
117
|
+
})
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
export {
|
|
121
|
+
ANTHROPIC_MODEL_OPTIONS,
|
|
122
|
+
ANTHROPIC_MODEL_IDS,
|
|
123
|
+
ANTHROPIC_DEPRECATED_MODEL_ALIASES,
|
|
124
|
+
matchesAnthropicModel,
|
|
125
|
+
ANTHROPIC_MODEL_SPECS
|
|
126
|
+
};
|
|
127
|
+
//# sourceMappingURL=chunk-4XYJWEC6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/models.ts"],"sourcesContent":["// @commandcode/cmd-provider-anthropic/models — the COMPLETE Anthropic model catalog: /model picker\n// metadata, wire-spec kinds, context windows, reasoning efforts, deprecated-alias migrations, and\n// the id heuristics core code used to hardcode. This file is intentionally dependency-free (plain\n// data + tiny helpers, structural types) so it can be consumed by the CLI (via shared/constants),\n// the API worker, and Studio alike, and so this package can move to its own repo without dragging\n// monorepo internals along. Every value is a verbatim port from shared/constants.ts +\n// harness/config/known-models.ts — those sites now import from HERE.\n\nexport type AnthropicReasoningEffort =\n\t| 'low'\n\t| 'medium'\n\t| 'high'\n\t| 'xhigh'\n\t| 'max';\n\n// Structural copy of shared's ModelOption (shared `satisfies`-checks on import, so drift fails the\n// build there, not silently here). Kept local so this package never imports monorepo internals.\nexport interface AnthropicModelOption {\n\treadonly id: string;\n\treadonly provider: 'anthropic';\n\treadonly spec: 'chatComplete';\n\treadonly label: string;\n\treadonly name: string;\n\treadonly description: string;\n\treadonly reasoning?: boolean;\n\treadonly reasoningEfforts?: readonly AnthropicReasoningEffort[];\n\treadonly contextWindow?: number;\n\treadonly inputModalities?: readonly ('text' | 'image')[];\n}\n\nconst EFFORT_LOW_TO_MAX: readonly AnthropicReasoningEffort[] = [\n\t'low',\n\t'medium',\n\t'high',\n\t'xhigh',\n\t'max',\n];\n\n// The /model catalog entries (verbatim from shared MODEL_OPTIONS). Key names preserved so\n// shared's MODEL_OPTIONS spread keeps identical keys (SONNET_5, OPUS_4_8, …).\nexport const ANTHROPIC_MODEL_OPTIONS = {\n\tSONNET_5: {\n\t\tid: 'claude-sonnet-5',\n\t\tinputModalities: ['text', 'image'],\n\t\tprovider: 'anthropic',\n\t\tspec: 'chatComplete',\n\t\tlabel: 'Claude Sonnet 5',\n\t\tname: 'Claude Sonnet 5',\n\t\tdescription: 'best combo of speed & intelligence (recommended)',\n\t\t// Sonnet 5 rejects non-default `temperature` with a 400 (new for\n\t\t// Sonnet-class, same as Opus 4.7+). `reasoning: true` stops the API from\n\t\t// injecting temperature. Sonnet 4.6 still accepts it, so it stays unset.\n\t\treasoning: true,\n\t\treasoningEfforts: EFFORT_LOW_TO_MAX,\n\t\tcontextWindow: 1_000_000,\n\t},\n\tSONNET_4_6: {\n\t\tid: 'claude-sonnet-4-6',\n\t\tinputModalities: ['text', 'image'],\n\t\tprovider: 'anthropic',\n\t\tspec: 'chatComplete',\n\t\tlabel: 'Claude Sonnet 4.6',\n\t\tname: 'Claude Sonnet 4.6',\n\t\tdescription: 'prev Sonnet, still fast & capable',\n\t\treasoningEfforts: EFFORT_LOW_TO_MAX,\n\t\tcontextWindow: 1_000_000,\n\t},\n\tFABLE_5: {\n\t\tid: 'claude-fable-5',\n\t\tinputModalities: ['text', 'image'],\n\t\tprovider: 'anthropic',\n\t\tspec: 'chatComplete',\n\t\tlabel: 'Claude Fable 5',\n\t\tname: 'Claude Fable 5',\n\t\tdescription:\n\t\t\t'most capable for demanding reasoning & long-horizon agents',\n\t\treasoning: true,\n\t\treasoningEfforts: EFFORT_LOW_TO_MAX,\n\t\tcontextWindow: 1_000_000,\n\t},\n\tOPUS_5: {\n\t\tid: 'claude-opus-5',\n\t\tinputModalities: ['text', 'image'],\n\t\tprovider: 'anthropic',\n\t\tspec: 'chatComplete',\n\t\tlabel: 'Claude Opus 5',\n\t\tname: 'Claude Opus 5',\n\t\tdescription: 'most intelligent Opus for agents and coding',\n\t\treasoning: true,\n\t\treasoningEfforts: EFFORT_LOW_TO_MAX,\n\t\tcontextWindow: 1_000_000,\n\t},\n\tOPUS_4_8: {\n\t\tid: 'claude-opus-4-8',\n\t\tinputModalities: ['text', 'image'],\n\t\tprovider: 'anthropic',\n\t\tspec: 'chatComplete',\n\t\tlabel: 'Claude Opus 4.8',\n\t\tname: 'Claude Opus 4.8',\n\t\tdescription: 'prev flagship, still strong for agents and coding',\n\t\treasoning: true,\n\t\treasoningEfforts: EFFORT_LOW_TO_MAX,\n\t\tcontextWindow: 1_000_000,\n\t},\n\tOPUS_4_7: {\n\t\tid: 'claude-opus-4-7',\n\t\tinputModalities: ['text', 'image'],\n\t\tprovider: 'anthropic',\n\t\tspec: 'chatComplete',\n\t\tlabel: 'Claude Opus 4.7',\n\t\tname: 'Claude Opus 4.7',\n\t\tdescription: 'older Opus, still strong for agents and coding',\n\t\treasoning: true,\n\t\treasoningEfforts: EFFORT_LOW_TO_MAX,\n\t\tcontextWindow: 1_000_000,\n\t},\n\tHAIKU_4_5: {\n\t\tid: 'claude-haiku-4-5-20251001',\n\t\tinputModalities: ['text', 'image'],\n\t\tprovider: 'anthropic',\n\t\tspec: 'chatComplete',\n\t\tlabel: 'Claude Haiku 4.5',\n\t\tname: 'Claude Haiku 4.5',\n\t\tdescription: 'fastest & most compact, great for quick tasks',\n\t\tcontextWindow: 200_000,\n\t},\n} as const satisfies Record<string, AnthropicModelOption>;\n\n/** Canonical Anthropic model ids, in catalog order. */\nexport const ANTHROPIC_MODEL_IDS: readonly string[] = Object.values(\n\tANTHROPIC_MODEL_OPTIONS,\n).map(option => option.id);\n\n// Deprecated / undated aliases → canonical id (verbatim from harness known-models\n// DEPRECATED_MODEL_MIGRATIONS — every entry there is an Anthropic id, so the whole map lives\n// here now). Keys are lowercase and matched case-insensitively by consumers.\nexport const ANTHROPIC_DEPRECATED_MODEL_ALIASES: Readonly<\n\tRecord<string, string>\n> = {\n\t'claude-sonnet-4-20250514': 'claude-sonnet-4-6',\n\t'claude-sonnet-4-5-20250929': 'claude-sonnet-4-6',\n\t'claude-opus-4-5-20251101': 'claude-opus-4-7',\n\t'claude-opus-4-6': 'claude-opus-4-7',\n\t// Undated alias for the Haiku 4.5 dated snapshot.\n\t'claude-haiku-4-5': 'claude-haiku-4-5-20251001',\n};\n\n/**\n * Does an id look like an Anthropic model (including BYO/dated ids the catalog doesn't list)?\n * This is the predicate that used to live inline in the harness model client\n * (`model.includes('claude')`) to decide interleaved-thinking finalization — provider heuristics\n * belong to the provider.\n */\nexport function matchesAnthropicModel(modelId: string): boolean {\n\treturn modelId.toLowerCase().includes('claude');\n}\n\n/**\n * Harness ModelSpec-shaped catalog (structural — the harness validates on registration). Declares\n * interleaved thinking for every Anthropic model so the core model client needs no 'claude'\n * string of its own.\n */\nexport const ANTHROPIC_MODEL_SPECS = Object.values(ANTHROPIC_MODEL_OPTIONS).map(\n\toption => ({\n\t\tid: option.id,\n\t\tprovider: 'anthropic' as const,\n\t\tcontextWindow: option.contextWindow,\n\t\treasoningEfforts:\n\t\t\t'reasoningEfforts' in option ? option.reasoningEfforts : undefined,\n\t\tinputModalities: option.inputModalities,\n\t\tinterleavedThinking: true,\n\t}),\n);\n"],"mappings":";AA8BA,IAAM,oBAAyD;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAIO,IAAM,0BAA0B;AAAA,EACtC,UAAU;AAAA,IACT,IAAI;AAAA,IACJ,iBAAiB,CAAC,QAAQ,OAAO;AAAA,IACjC,UAAU;AAAA,IACV,MAAM;AAAA,IACN,OAAO;AAAA,IACP,MAAM;AAAA,IACN,aAAa;AAAA;AAAA;AAAA;AAAA,IAIb,WAAW;AAAA,IACX,kBAAkB;AAAA,IAClB,eAAe;AAAA,EAChB;AAAA,EACA,YAAY;AAAA,IACX,IAAI;AAAA,IACJ,iBAAiB,CAAC,QAAQ,OAAO;AAAA,IACjC,UAAU;AAAA,IACV,MAAM;AAAA,IACN,OAAO;AAAA,IACP,MAAM;AAAA,IACN,aAAa;AAAA,IACb,kBAAkB;AAAA,IAClB,eAAe;AAAA,EAChB;AAAA,EACA,SAAS;AAAA,IACR,IAAI;AAAA,IACJ,iBAAiB,CAAC,QAAQ,OAAO;AAAA,IACjC,UAAU;AAAA,IACV,MAAM;AAAA,IACN,OAAO;AAAA,IACP,MAAM;AAAA,IACN,aACC;AAAA,IACD,WAAW;AAAA,IACX,kBAAkB;AAAA,IAClB,eAAe;AAAA,EAChB;AAAA,EACA,QAAQ;AAAA,IACP,IAAI;AAAA,IACJ,iBAAiB,CAAC,QAAQ,OAAO;AAAA,IACjC,UAAU;AAAA,IACV,MAAM;AAAA,IACN,OAAO;AAAA,IACP,MAAM;AAAA,IACN,aAAa;AAAA,IACb,WAAW;AAAA,IACX,kBAAkB;AAAA,IAClB,eAAe;AAAA,EAChB;AAAA,EACA,UAAU;AAAA,IACT,IAAI;AAAA,IACJ,iBAAiB,CAAC,QAAQ,OAAO;AAAA,IACjC,UAAU;AAAA,IACV,MAAM;AAAA,IACN,OAAO;AAAA,IACP,MAAM;A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
9
|
+
var ANTHROPIC_MODEL_OPTIONS = {
|
|
10
|
+
SONNET_5: {
|
|
11
|
+
id: "claude-sonnet-5",
|
|
12
|
+
inputModalities: ["text", "image"],
|
|
13
|
+
provider: "anthropic",
|
|
14
|
+
spec: "chatComplete",
|
|
15
|
+
label: "Claude Sonnet 5",
|
|
16
|
+
name: "Claude Sonnet 5",
|
|
17
|
+
description: "best combo of speed & intelligence (recommended)",
|
|
18
|
+
// Sonnet 5 rejects non-default `temperature` with a 400 (new for
|
|
19
|
+
// Sonnet-class, same as Opus 4.7+). `reasoning: true` stops the API from
|
|
20
|
+
// injecting temperature. Sonnet 4.6 still accepts it, so it stays unset.
|
|
21
|
+
reasoning: true,
|
|
22
|
+
reasoningEfforts: EFFORT_LOW_TO_MAX,
|
|
23
|
+
contextWindow: 1e6
|
|
24
|
+
},
|
|
25
|
+
SONNET_4_6: {
|
|
26
|
+
id: "claude-sonnet-4-6",
|
|
27
|
+
inputModalities: ["text", "image"],
|
|
28
|
+
provider: "anthropic",
|
|
29
|
+
spec: "chatComplete",
|
|
30
|
+
label: "Claude Sonnet 4.6",
|
|
31
|
+
name: "Claude Sonnet 4.6",
|
|
32
|
+
description: "prev Sonnet, still fast & capable",
|
|
33
|
+
reasoningEfforts: EFFORT_LOW_TO_MAX,
|
|
34
|
+
contextWindow: 1e6
|
|
35
|
+
},
|
|
36
|
+
FABLE_5: {
|
|
37
|
+
id: "claude-fable-5",
|
|
38
|
+
inputModalities: ["text", "image"],
|
|
39
|
+
provider: "anthropic",
|
|
40
|
+
spec: "chatComplete",
|
|
41
|
+
label: "Claude Fable 5",
|
|
42
|
+
name: "Claude Fable 5",
|
|
43
|
+
description: "most capable for demanding reasoning & long-horizon agents",
|
|
44
|
+
reasoning: true,
|
|
45
|
+
reasoningEfforts: EFFORT_LOW_TO_MAX,
|
|
46
|
+
contextWindow: 1e6
|
|
47
|
+
},
|
|
48
|
+
OPUS_5: {
|
|
49
|
+
id: "claude-opus-5",
|
|
50
|
+
inputModalities: ["text", "image"],
|
|
51
|
+
provider: "anthropic",
|
|
52
|
+
spec: "chatComplete",
|
|
53
|
+
label: "Claude Opus 5",
|
|
54
|
+
name: "Claude Opus 5",
|
|
55
|
+
description: "most intelligent Opus for agents and coding",
|
|
56
|
+
reasoning: true,
|
|
57
|
+
reasoningEfforts: EFFORT_LOW_TO_MAX,
|
|
58
|
+
contextWindow: 1e6
|
|
59
|
+
},
|
|
60
|
+
OPUS_4_8: {
|
|
61
|
+
id: "claude-opus-4-8",
|
|
62
|
+
inputModalities: ["text", "image"],
|
|
63
|
+
provider: "anthropic",
|
|
64
|
+
spec: "chatComplete",
|
|
65
|
+
label: "Claude Opus 4.8",
|
|
66
|
+
name: "Claude Opus 4.8",
|
|
67
|
+
description: "prev flagship, still strong for agents and coding",
|
|
68
|
+
reasoning: true,
|
|
69
|
+
reasoningEfforts: EFFORT_LOW_TO_MAX,
|
|
70
|
+
contextWindow: 1e6
|
|
71
|
+
},
|
|
72
|
+
OPUS_4_7: {
|
|
73
|
+
id: "claude-opus-4-7",
|
|
74
|
+
inputModalities: ["text", "image"],
|
|
75
|
+
provider: "anthropic",
|
|
76
|
+
spec: "chatComplete",
|
|
77
|
+
label: "Claude Opus 4.7",
|
|
78
|
+
name: "Claude Opus 4.7",
|
|
79
|
+
description: "older Opus, still strong for agents and coding",
|
|
80
|
+
reasoning: true,
|
|
81
|
+
reasoningEfforts: EFFORT_LOW_TO_MAX,
|
|
82
|
+
contextWindow: 1e6
|
|
83
|
+
},
|
|
84
|
+
HAIKU_4_5: {
|
|
85
|
+
id: "claude-haiku-4-5-20251001",
|
|
86
|
+
inputModalities: ["text", "image"],
|
|
87
|
+
provider: "anthropic",
|
|
88
|
+
spec: "chatComplete",
|
|
89
|
+
label: "Claude Haiku 4.5",
|
|
90
|
+
name: "Claude Haiku 4.5",
|
|
91
|
+
description: "fastest & most compact, great for quick tasks",
|
|
92
|
+
contextWindow: 2e5
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
var ANTHROPIC_MODEL_IDS = Object.values(
|
|
96
|
+
ANTHROPIC_MODEL_OPTIONS
|
|
97
|
+
).map((option) => option.id);
|
|
98
|
+
var ANTHROPIC_DEPRECATED_MODEL_ALIASES = {
|
|
99
|
+
"claude-sonnet-4-20250514": "claude-sonnet-4-6",
|
|
100
|
+
"claude-sonnet-4-5-20250929": "claude-sonnet-4-6",
|
|
101
|
+
"claude-opus-4-5-20251101": "claude-opus-4-7",
|
|
102
|
+
"claude-opus-4-6": "claude-opus-4-7",
|
|
103
|
+
// Undated alias for the Haiku 4.5 dated snapshot.
|
|
104
|
+
"claude-haiku-4-5": "claude-haiku-4-5-20251001"
|
|
105
|
+
};
|
|
106
|
+
function matchesAnthropicModel(modelId) {
|
|
107
|
+
return modelId.toLowerCase().includes("claude");
|
|
108
|
+
}
|
|
109
|
+
var ANTHROPIC_MODEL_SPECS = Object.values(ANTHROPIC_MODEL_OPTIONS).map(
|
|
110
|
+
(option) => ({
|
|
111
|
+
id: option.id,
|
|
112
|
+
provider: "anthropic",
|
|
113
|
+
contextWindow: option.contextWindow,
|
|
114
|
+
reasoningEfforts: "reasoningEfforts" in option ? option.reasoningEfforts : void 0,
|
|
115
|
+
inputModalities: option.inputModalities,
|
|
116
|
+
interleavedThinking: true
|
|
117
|
+
})
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
export {
|
|
121
|
+
ANTHROPIC_MODEL_OPTIONS,
|
|
122
|
+
ANTHROPIC_MODEL_IDS,
|
|
123
|
+
ANTHROPIC_DEPRECATED_MODEL_ALIASES,
|
|
124
|
+
matchesAnthropicModel,
|
|
125
|
+
ANTHROPIC_MODEL_SPECS
|
|
126
|
+
};
|
|
127
|
+
//# sourceMappingURL=chunk-V3B4JGF6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/models.ts"],"sourcesContent":["// @byokkit/cmd-provider-anthropic/models — the COMPLETE Anthropic model catalog: /model picker\n// metadata, wire-spec kinds, context windows, reasoning efforts, deprecated-alias migrations, and\n// the id heuristics core code used to hardcode. This file is intentionally dependency-free (plain\n// data + tiny helpers, structural types) so it can be consumed by the CLI (via shared/constants),\n// the API worker, and Studio alike, and so this package can move to its own repo without dragging\n// monorepo internals along. Every value is a verbatim port from shared/constants.ts +\n// harness/config/known-models.ts — those sites now import from HERE.\n\nexport type AnthropicReasoningEffort =\n\t| 'low'\n\t| 'medium'\n\t| 'high'\n\t| 'xhigh'\n\t| 'max';\n\n// Structural copy of shared's ModelOption (shared `satisfies`-checks on import, so drift fails the\n// build there, not silently here). Kept local so this package never imports monorepo internals.\nexport interface AnthropicModelOption {\n\treadonly id: string;\n\treadonly provider: 'anthropic';\n\treadonly spec: 'chatComplete';\n\treadonly label: string;\n\treadonly name: string;\n\treadonly description: string;\n\treadonly reasoning?: boolean;\n\treadonly reasoningEfforts?: readonly AnthropicReasoningEffort[];\n\treadonly contextWindow?: number;\n\treadonly inputModalities?: readonly ('text' | 'image')[];\n}\n\nconst EFFORT_LOW_TO_MAX: readonly AnthropicReasoningEffort[] = [\n\t'low',\n\t'medium',\n\t'high',\n\t'xhigh',\n\t'max',\n];\n\n// The /model catalog entries (verbatim from shared MODEL_OPTIONS). Key names preserved so\n// shared's MODEL_OPTIONS spread keeps identical keys (SONNET_5, OPUS_4_8, …).\nexport const ANTHROPIC_MODEL_OPTIONS = {\n\tSONNET_5: {\n\t\tid: 'claude-sonnet-5',\n\t\tinputModalities: ['text', 'image'],\n\t\tprovider: 'anthropic',\n\t\tspec: 'chatComplete',\n\t\tlabel: 'Claude Sonnet 5',\n\t\tname: 'Claude Sonnet 5',\n\t\tdescription: 'best combo of speed & intelligence (recommended)',\n\t\t// Sonnet 5 rejects non-default `temperature` with a 400 (new for\n\t\t// Sonnet-class, same as Opus 4.7+). `reasoning: true` stops the API from\n\t\t// injecting temperature. Sonnet 4.6 still accepts it, so it stays unset.\n\t\treasoning: true,\n\t\treasoningEfforts: EFFORT_LOW_TO_MAX,\n\t\tcontextWindow: 1_000_000,\n\t},\n\tSONNET_4_6: {\n\t\tid: 'claude-sonnet-4-6',\n\t\tinputModalities: ['text', 'image'],\n\t\tprovider: 'anthropic',\n\t\tspec: 'chatComplete',\n\t\tlabel: 'Claude Sonnet 4.6',\n\t\tname: 'Claude Sonnet 4.6',\n\t\tdescription: 'prev Sonnet, still fast & capable',\n\t\treasoningEfforts: EFFORT_LOW_TO_MAX,\n\t\tcontextWindow: 1_000_000,\n\t},\n\tFABLE_5: {\n\t\tid: 'claude-fable-5',\n\t\tinputModalities: ['text', 'image'],\n\t\tprovider: 'anthropic',\n\t\tspec: 'chatComplete',\n\t\tlabel: 'Claude Fable 5',\n\t\tname: 'Claude Fable 5',\n\t\tdescription:\n\t\t\t'most capable for demanding reasoning & long-horizon agents',\n\t\treasoning: true,\n\t\treasoningEfforts: EFFORT_LOW_TO_MAX,\n\t\tcontextWindow: 1_000_000,\n\t},\n\tOPUS_5: {\n\t\tid: 'claude-opus-5',\n\t\tinputModalities: ['text', 'image'],\n\t\tprovider: 'anthropic',\n\t\tspec: 'chatComplete',\n\t\tlabel: 'Claude Opus 5',\n\t\tname: 'Claude Opus 5',\n\t\tdescription: 'most intelligent Opus for agents and coding',\n\t\treasoning: true,\n\t\treasoningEfforts: EFFORT_LOW_TO_MAX,\n\t\tcontextWindow: 1_000_000,\n\t},\n\tOPUS_4_8: {\n\t\tid: 'claude-opus-4-8',\n\t\tinputModalities: ['text', 'image'],\n\t\tprovider: 'anthropic',\n\t\tspec: 'chatComplete',\n\t\tlabel: 'Claude Opus 4.8',\n\t\tname: 'Claude Opus 4.8',\n\t\tdescription: 'prev flagship, still strong for agents and coding',\n\t\treasoning: true,\n\t\treasoningEfforts: EFFORT_LOW_TO_MAX,\n\t\tcontextWindow: 1_000_000,\n\t},\n\tOPUS_4_7: {\n\t\tid: 'claude-opus-4-7',\n\t\tinputModalities: ['text', 'image'],\n\t\tprovider: 'anthropic',\n\t\tspec: 'chatComplete',\n\t\tlabel: 'Claude Opus 4.7',\n\t\tname: 'Claude Opus 4.7',\n\t\tdescription: 'older Opus, still strong for agents and coding',\n\t\treasoning: true,\n\t\treasoningEfforts: EFFORT_LOW_TO_MAX,\n\t\tcontextWindow: 1_000_000,\n\t},\n\tHAIKU_4_5: {\n\t\tid: 'claude-haiku-4-5-20251001',\n\t\tinputModalities: ['text', 'image'],\n\t\tprovider: 'anthropic',\n\t\tspec: 'chatComplete',\n\t\tlabel: 'Claude Haiku 4.5',\n\t\tname: 'Claude Haiku 4.5',\n\t\tdescription: 'fastest & most compact, great for quick tasks',\n\t\tcontextWindow: 200_000,\n\t},\n} as const satisfies Record<string, AnthropicModelOption>;\n\n/** Canonical Anthropic model ids, in catalog order. */\nexport const ANTHROPIC_MODEL_IDS: readonly string[] = Object.values(\n\tANTHROPIC_MODEL_OPTIONS,\n).map(option => option.id);\n\n// Deprecated / undated aliases → canonical id (verbatim from harness known-models\n// DEPRECATED_MODEL_MIGRATIONS — every entry there is an Anthropic id, so the whole map lives\n// here now). Keys are lowercase and matched case-insensitively by consumers.\nexport const ANTHROPIC_DEPRECATED_MODEL_ALIASES: Readonly<\n\tRecord<string, string>\n> = {\n\t'claude-sonnet-4-20250514': 'claude-sonnet-4-6',\n\t'claude-sonnet-4-5-20250929': 'claude-sonnet-4-6',\n\t'claude-opus-4-5-20251101': 'claude-opus-4-7',\n\t'claude-opus-4-6': 'claude-opus-4-7',\n\t// Undated alias for the Haiku 4.5 dated snapshot.\n\t'claude-haiku-4-5': 'claude-haiku-4-5-20251001',\n};\n\n/**\n * Does an id look like an Anthropic model (including BYO/dated ids the catalog doesn't list)?\n * This is the predicate that used to live inline in the harness model client\n * (`model.includes('claude')`) to decide interleaved-thinking finalization — provider heuristics\n * belong to the provider.\n */\nexport function matchesAnthropicModel(modelId: string): boolean {\n\treturn modelId.toLowerCase().includes('claude');\n}\n\n/**\n * Harness ModelSpec-shaped catalog (structural — the harness validates on registration). Declares\n * interleaved thinking for every Anthropic model so the core model client needs no 'claude'\n * string of its own.\n */\nexport const ANTHROPIC_MODEL_SPECS = Object.values(ANTHROPIC_MODEL_OPTIONS).map(\n\toption => ({\n\t\tid: option.id,\n\t\tprovider: 'anthropic' as const,\n\t\tcontextWindow: option.contextWindow,\n\t\treasoningEfforts:\n\t\t\t'reasoningEfforts' in option ? option.reasoningEfforts : undefined,\n\t\tinputModalities: option.inputModalities,\n\t\tinterleavedThinking: true,\n\t}),\n);\n"],"mappings":";AA8BA,IAAM,oBAAyD;AAAA,EAC9D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAIO,IAAM,0BAA0B;AAAA,EACtC,UAAU;AAAA,IACT,IAAI;AAAA,IACJ,iBAAiB,CAAC,QAAQ,OAAO;AAAA,IACjC,UAAU;AAAA,IACV,MAAM;AAAA,IACN,OAAO;AAAA,IACP,MAAM;AAAA,IACN,aAAa;AAAA;AAAA;AAAA;AAAA,IAIb,WAAW;AAAA,IACX,kBAAkB;AAAA,IAClB,eAAe;AAAA,EAChB;AAAA,EACA,YAAY;AAAA,IACX,IAAI;AAAA,IACJ,iBAAiB,CAAC,QAAQ,OAAO;AAAA,IACjC,UAAU;AAAA,IACV,MAAM;AAAA,IACN,OAAO;AAAA,IACP,MAAM;AAAA,IACN,aAAa;AAAA,IACb,kBAAkB;AAAA,IAClB,eAAe;AAAA,EAChB;AAAA,EACA,SAAS;AAAA,IACR,IAAI;AAAA,IACJ,iBAAiB,CAAC,QAAQ,OAAO;AAAA,IACjC,UAAU;AAAA,IACV,MAAM;AAAA,IACN,OAAO;AAAA,IACP,MAAM;AAAA,IACN,aACC;AAAA,IACD,WAAW;AAAA,IACX,kBAAkB;AAAA,IAClB,eAAe;AAAA,EAChB;AAAA,EACA,QAAQ;AAAA,IACP,IAAI;AAAA,IACJ,iBAAiB,CAAC,QAAQ,OAAO;AAAA,IACjC,UAAU;AAAA,IACV,MAAM;AAAA,IACN,OAAO;AAAA,IACP,MAAM;AAAA,IACN,aAAa;AAAA,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ACD;","names":[]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { OAuthFetchImpl, ProviderModule } from '@commandcode/harness/provider-kit';
|
|
2
|
+
|
|
3
|
+
declare const ANTHROPIC_PROVIDER_ID = "anthropic";
|
|
4
|
+
declare const OAUTH_TOKEN_HEADER = "x-oauth-token";
|
|
5
|
+
declare const OAUTH_PROVIDER_HEADER = "x-oauth-provider";
|
|
6
|
+
declare const OAUTH_PROVIDER_VALUE = "anthropic";
|
|
7
|
+
interface AnthropicProviderOptions {
|
|
8
|
+
readonly fetchImpl?: OAuthFetchImpl;
|
|
9
|
+
readonly now?: () => number;
|
|
10
|
+
}
|
|
11
|
+
declare function createAnthropicProvider(options?: AnthropicProviderOptions): ProviderModule;
|
|
12
|
+
declare const anthropicProvider: ProviderModule;
|
|
13
|
+
|
|
14
|
+
export { ANTHROPIC_PROVIDER_ID, type AnthropicProviderOptions, OAUTH_PROVIDER_HEADER, OAUTH_PROVIDER_VALUE, OAUTH_TOKEN_HEADER, createAnthropicProvider, anthropicProvider as default };
|