@codemieai/code 0.15.3 → 0.15.4
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/dist/agents/core/AgentCLI.d.ts.map +1 -1
- package/dist/agents/core/AgentCLI.js +9 -0
- package/dist/agents/core/AgentCLI.js.map +1 -1
- package/dist/agents/core/BaseAgentAdapter.d.ts.map +1 -1
- package/dist/agents/core/BaseAgentAdapter.js +34 -9
- package/dist/agents/core/BaseAgentAdapter.js.map +1 -1
- package/dist/agents/plugins/claude/claude.models.d.ts +58 -0
- package/dist/agents/plugins/claude/claude.models.d.ts.map +1 -1
- package/dist/agents/plugins/claude/claude.models.js +196 -10
- package/dist/agents/plugins/claude/claude.models.js.map +1 -1
- package/dist/agents/plugins/claude/claude.plugin.d.ts.map +1 -1
- package/dist/agents/plugins/claude/claude.plugin.js +147 -45
- package/dist/agents/plugins/claude/claude.plugin.js.map +1 -1
- package/dist/agents/plugins/claude/plugin/statusline.bundle.mjs +729 -0
- package/dist/agents/plugins/claude/statusline-installer.d.ts +1 -1
- package/dist/agents/plugins/claude/statusline-installer.d.ts.map +1 -1
- package/dist/agents/plugins/claude/statusline-installer.js +41 -3
- package/dist/agents/plugins/claude/statusline-installer.js.map +1 -1
- package/dist/agents/plugins/codex/codex-models.d.ts.map +1 -1
- package/dist/agents/plugins/codex/codex-models.js +109 -8
- package/dist/agents/plugins/codex/codex-models.js.map +1 -1
- package/dist/agents/plugins/codex/codex.correlation.d.ts +39 -0
- package/dist/agents/plugins/codex/codex.correlation.d.ts.map +1 -0
- package/dist/agents/plugins/codex/codex.correlation.js +150 -0
- package/dist/agents/plugins/codex/codex.correlation.js.map +1 -0
- package/dist/agents/plugins/codex/codex.plugin.d.ts.map +1 -1
- package/dist/agents/plugins/codex/codex.plugin.js +8 -40
- package/dist/agents/plugins/codex/codex.plugin.js.map +1 -1
- package/dist/agents/plugins/kimi/kimi.env-model.d.ts +27 -0
- package/dist/agents/plugins/kimi/kimi.env-model.d.ts.map +1 -0
- package/dist/agents/plugins/kimi/kimi.env-model.js +52 -0
- package/dist/agents/plugins/kimi/kimi.env-model.js.map +1 -0
- package/dist/agents/plugins/kimi/kimi.session.d.ts +6 -0
- package/dist/agents/plugins/kimi/kimi.session.d.ts.map +1 -1
- package/dist/agents/plugins/kimi/kimi.session.js +24 -2
- package/dist/agents/plugins/kimi/kimi.session.js.map +1 -1
- package/dist/agents/plugins/opencode/opencode-dynamic-models.js +1 -1
- package/dist/agents/plugins/opencode/opencode-dynamic-models.js.map +1 -1
- package/dist/cli/commands/analytics/cost/cost-enricher.d.ts +19 -2
- package/dist/cli/commands/analytics/cost/cost-enricher.d.ts.map +1 -1
- package/dist/cli/commands/analytics/cost/cost-enricher.js +171 -14
- package/dist/cli/commands/analytics/cost/cost-enricher.js.map +1 -1
- package/dist/cli/commands/analytics/cost/local-models.d.ts +15 -0
- package/dist/cli/commands/analytics/cost/local-models.d.ts.map +1 -0
- package/dist/cli/commands/analytics/cost/local-models.js +21 -0
- package/dist/cli/commands/analytics/cost/local-models.js.map +1 -0
- package/dist/cli/commands/analytics/cost/types.d.ts +60 -0
- package/dist/cli/commands/analytics/cost/types.d.ts.map +1 -1
- package/dist/cli/commands/analytics/cost/types.js.map +1 -1
- package/dist/cli/commands/analytics/cost/usage-readers.d.ts +25 -2
- package/dist/cli/commands/analytics/cost/usage-readers.d.ts.map +1 -1
- package/dist/cli/commands/analytics/cost/usage-readers.js +61 -3
- package/dist/cli/commands/analytics/cost/usage-readers.js.map +1 -1
- package/dist/cli/commands/analytics/formatter.d.ts +11 -0
- package/dist/cli/commands/analytics/formatter.d.ts.map +1 -1
- package/dist/cli/commands/analytics/formatter.js +28 -0
- package/dist/cli/commands/analytics/formatter.js.map +1 -1
- package/dist/cli/commands/analytics/index.d.ts.map +1 -1
- package/dist/cli/commands/analytics/index.js +70 -73
- package/dist/cli/commands/analytics/index.js.map +1 -1
- package/dist/cli/commands/analytics/otel-loader.d.ts.map +1 -1
- package/dist/cli/commands/analytics/otel-loader.js +60 -14
- package/dist/cli/commands/analytics/otel-loader.js.map +1 -1
- package/dist/cli/commands/analytics/otel-pricing.d.ts +38 -0
- package/dist/cli/commands/analytics/otel-pricing.d.ts.map +1 -0
- package/dist/cli/commands/analytics/otel-pricing.js +33 -0
- package/dist/cli/commands/analytics/otel-pricing.js.map +1 -0
- package/dist/cli/commands/analytics/report/client/app.js +279 -18
- package/dist/cli/commands/analytics/report/output-target.d.ts +22 -0
- package/dist/cli/commands/analytics/report/output-target.d.ts.map +1 -0
- package/dist/cli/commands/analytics/report/output-target.js +56 -0
- package/dist/cli/commands/analytics/report/output-target.js.map +1 -0
- package/dist/cli/commands/analytics/report/payload-builder.d.ts.map +1 -1
- package/dist/cli/commands/analytics/report/payload-builder.js +6 -0
- package/dist/cli/commands/analytics/report/payload-builder.js.map +1 -1
- package/dist/cli/commands/analytics/report/report-generator.d.ts +1 -1
- package/dist/cli/commands/analytics/report/report-generator.js +1 -1
- package/dist/cli/commands/analytics/report/session-report.d.ts +1 -3
- package/dist/cli/commands/analytics/report/session-report.d.ts.map +1 -1
- package/dist/cli/commands/analytics/report/session-report.js +1 -3
- package/dist/cli/commands/analytics/report/session-report.js.map +1 -1
- package/dist/cli/commands/analytics/report/template.html +6 -6
- package/dist/cli/commands/analytics/report/types.d.ts +17 -1
- package/dist/cli/commands/analytics/report/types.d.ts.map +1 -1
- package/dist/cli/commands/analytics/sources/sessions-source.d.ts.map +1 -1
- package/dist/cli/commands/analytics/sources/sessions-source.js +9 -11
- package/dist/cli/commands/analytics/sources/sessions-source.js.map +1 -1
- package/dist/cli/commands/analytics/sources/types.d.ts +0 -2
- package/dist/cli/commands/analytics/sources/types.d.ts.map +1 -1
- package/dist/cli/commands/analytics/types.d.ts +8 -8
- package/dist/cli/commands/analytics/types.d.ts.map +1 -1
- package/dist/cli/commands/models.d.ts.map +1 -1
- package/dist/cli/commands/models.js +16 -3
- package/dist/cli/commands/models.js.map +1 -1
- package/dist/cli/commands/proxy/connect-orchestrator.js +1 -1
- package/dist/cli/commands/proxy/connect-orchestrator.js.map +1 -1
- package/dist/cli/commands/proxy/connectors/tenant-catalog.d.ts +16 -4
- package/dist/cli/commands/proxy/connectors/tenant-catalog.d.ts.map +1 -1
- package/dist/cli/commands/proxy/connectors/tenant-catalog.js +42 -14
- package/dist/cli/commands/proxy/connectors/tenant-catalog.js.map +1 -1
- package/dist/cli/commands/proxy/connectors/vscode-models.d.ts +18 -0
- package/dist/cli/commands/proxy/connectors/vscode-models.d.ts.map +1 -1
- package/dist/cli/commands/proxy/connectors/vscode-models.js +58 -0
- package/dist/cli/commands/proxy/connectors/vscode-models.js.map +1 -1
- package/dist/cli/commands/proxy/connectors/vscode.d.ts +2 -2
- package/dist/cli/commands/proxy/connectors/vscode.d.ts.map +1 -1
- package/dist/cli/commands/proxy/connectors/vscode.js +27 -38
- package/dist/cli/commands/proxy/connectors/vscode.js.map +1 -1
- package/dist/providers/core/codemie-auth-helpers.d.ts.map +1 -1
- package/dist/providers/core/codemie-auth-helpers.js +6 -1
- package/dist/providers/core/codemie-auth-helpers.js.map +1 -1
- package/dist/providers/core/default-agent-hooks.d.ts.map +1 -1
- package/dist/providers/core/default-agent-hooks.js +9 -0
- package/dist/providers/core/default-agent-hooks.js.map +1 -1
- package/dist/providers/plugins/bedrock/bedrock.template.d.ts.map +1 -1
- package/dist/providers/plugins/bedrock/bedrock.template.js +5 -31
- package/dist/providers/plugins/bedrock/bedrock.template.js.map +1 -1
- package/dist/providers/plugins/sso/proxy/plugins/background-request-normalizer.plugin.d.ts +44 -0
- package/dist/providers/plugins/sso/proxy/plugins/background-request-normalizer.plugin.d.ts.map +1 -0
- package/dist/providers/plugins/sso/proxy/plugins/background-request-normalizer.plugin.js +106 -0
- package/dist/providers/plugins/sso/proxy/plugins/background-request-normalizer.plugin.js.map +1 -0
- package/dist/providers/plugins/sso/proxy/plugins/index.d.ts +3 -1
- package/dist/providers/plugins/sso/proxy/plugins/index.d.ts.map +1 -1
- package/dist/providers/plugins/sso/proxy/plugins/index.js +5 -1
- package/dist/providers/plugins/sso/proxy/plugins/index.js.map +1 -1
- package/dist/providers/plugins/sso/proxy/plugins/routing-header-injector.plugin.d.ts +67 -0
- package/dist/providers/plugins/sso/proxy/plugins/routing-header-injector.plugin.d.ts.map +1 -0
- package/dist/providers/plugins/sso/proxy/plugins/routing-header-injector.plugin.js +203 -0
- package/dist/providers/plugins/sso/proxy/plugins/routing-header-injector.plugin.js.map +1 -0
- package/dist/providers/plugins/sso/sso.http-client.d.ts +95 -0
- package/dist/providers/plugins/sso/sso.http-client.d.ts.map +1 -1
- package/dist/providers/plugins/sso/sso.http-client.js +79 -0
- package/dist/providers/plugins/sso/sso.http-client.js.map +1 -1
- package/dist/providers/plugins/sso/sso.models.d.ts +7 -0
- package/dist/providers/plugins/sso/sso.models.d.ts.map +1 -1
- package/dist/providers/plugins/sso/sso.models.js +22 -14
- package/dist/providers/plugins/sso/sso.models.js.map +1 -1
- package/dist/utils/bedrock-pricing.mjs +111 -0
- package/dist/utils/cli-updater.d.ts.map +1 -1
- package/dist/utils/cli-updater.js +32 -7
- package/dist/utils/cli-updater.js.map +1 -1
- package/dist/utils/credential-crypto.d.ts +51 -0
- package/dist/utils/credential-crypto.d.ts.map +1 -0
- package/dist/utils/credential-crypto.js +96 -0
- package/dist/utils/credential-crypto.js.map +1 -0
- package/dist/utils/model-normalizer.d.ts +6 -0
- package/dist/utils/model-normalizer.d.ts.map +1 -1
- package/dist/utils/model-normalizer.js +37 -19
- package/dist/utils/model-normalizer.js.map +1 -1
- package/dist/utils/price-resolution.d.ts +42 -0
- package/dist/utils/price-resolution.d.ts.map +1 -0
- package/dist/utils/price-resolution.js +112 -0
- package/dist/utils/price-resolution.js.map +1 -0
- package/dist/utils/pricing.d.ts +65 -6
- package/dist/utils/pricing.d.ts.map +1 -1
- package/dist/utils/pricing.js +91 -117
- package/dist/utils/pricing.js.map +1 -1
- package/dist/utils/pricing.json +201 -20
- package/dist/utils/routing-headers.mjs +104 -0
- package/dist/utils/security.d.ts +0 -32
- package/dist/utils/security.d.ts.map +1 -1
- package/dist/utils/security.js +20 -102
- package/dist/utils/security.js.map +1 -1
- package/package.json +4 -2
- package/scripts/bundle-statusline.mjs +37 -0
- package/scripts/copy-plugins.js +19 -2
- package/src/utils/tips.json +9 -9
- package/dist/agents/plugins/claude/plugin/__tests__/statusline.test.ts +0 -323
- package/dist/agents/plugins/claude/plugin/statusline.mjs +0 -282
- package/dist/cli/commands/analytics/exporter.d.ts +0 -20
- package/dist/cli/commands/analytics/exporter.d.ts.map +0 -1
- package/dist/cli/commands/analytics/exporter.js +0 -91
- package/dist/cli/commands/analytics/exporter.js.map +0 -1
package/dist/utils/pricing.json
CHANGED
|
@@ -16,58 +16,106 @@
|
|
|
16
16
|
"keys": "All keys use dashes instead of dots (e.g. gpt-5-4 not gpt-5.4) so normalizeModelName dots→dashes works",
|
|
17
17
|
"cacheRead": "cache hit price (Anthropic: 0.1x input, OpenAI: varies, Google: ~0.1x input)",
|
|
18
18
|
"cacheWrite": "cache write price (Anthropic: 1.25x input, OpenAI: ~same as input)",
|
|
19
|
-
"claude5": "Sonnet 5 and Opus 5 standard API-equivalent token rates verified 2026-09-15 at https://platform.claude.com/docs/en/about-claude/pricing; excludes additional tool charges. Sonnet 5's planned September 1 price increase was cancelled."
|
|
19
|
+
"claude5": "Sonnet 5 and Opus 5 standard API-equivalent token rates verified 2026-09-15; Fable 5/5.1, Mythos 5/5.1 and Opus 4.7/4.8 verified 2026-09-27 at https://platform.claude.com/docs/en/about-claude/pricing; excludes additional tool charges. Sonnet 5's planned September 1 price increase was cancelled.",
|
|
20
|
+
"t10CatalogReconciliation": "Rows added 2026-09-26 to price catalog ids that resolvePrice() found unpriced (unify-analytics-cost-command T10), each verified against one official vendor page/API on that date. claude-opus-5-5: $4/$20 base, $5/$8 5m/1h cache write, $0.20 cache read (0.05x multiplier), bedrockRegionalMultiplier 1.1 (Opus 4.5+ scope) — https://platform.claude.com/docs/en/about-claude/pricing (Model pricing table row 'Claude Opus 5.5'). gpt-5-5: short-context Standard row '$5.00 | $0.50 | - | $30.00' — https://developers.openai.com/api/docs/pricing ('Standard Pricing Tables', row 'gpt-5.5 (<272K context length)'); cache-write column is '-' (not stated) so cacheWrite mirrors input, matching this table's existing gpt-5-4 handling. gpt-5-6-luna/-sol/-terra and gpt-6-luna/-sol: short-context Standard rows from the same OpenAI page/table, e.g. 'gpt-6-sol | $2.00 | $0.20 | $2.50 | $10.00'; these rows do state a real cache-write price (~1.25x input) so it is recorded as-is rather than mirrored. deepseek-v4-pro: peak (weekday 01:00-04:00/06:00-10:00 UTC) cache-miss input $1.32, cache-hit input $0.044, output $3.96 — https://api-docs.deepseek.com/quick_start/pricing/; off-peak (all other hours, including weekends) is exactly half: $0.66/$0.022/$1.98; peak chosen as the flat row like every other entry in this table, no time-of-day tiering supported by the schema; cacheWrite mirrors input per this table's deepseek-chat/deepseek-reasoner precedent. gemini-3-6-flash/gemini-3-8-flash: paid-tier Standard pricing 'through Dec 31, 2026' — $0.75 input/$3.75 output/$0.075 context-caching — https://ai.google.dev/gemini-api/docs/pricing; scheduled to double to $1.50/$7.50/$0.15 on 2027-01-01, not yet in effect as of verification; cacheWrite mirrors input per this table's gemini-3-5-flash/gemini-3-7-flash precedent. gemini-3-1-flash-image: Standard pricing 'Input: $0.50 (text/image); Output: $3 (text/thinking), $60.00 (images)' — https://ai.google.dev/gemini-api/docs/pricing; output field records the $60 image-generation rate (not the $3 text/thinking rate), matching this table's existing gemini-3-1-flash-image-preview/gemini-2-5-flash-image rows, which use the same convention (schema has no separate image-output field); cacheRead/cacheWrite 0 (no cache pricing published for this model). grok-4-6: base tier (<200k prompt tokens) row 'grok-4.6 (< 200k prompt tokens) | 500k | $2.00 | $0.50 | $6.00' — https://docs.x.ai/developers/models; xAI doubles every rate for prompts >=200k tokens, not represented here (schema is flat), so this is the base/short-context tier, consistent with this table's other short-context-only entries; cacheWrite mirrors input per this table's grok-4/grok-4-1-fast precedent. qwen3-coder-30b-a3b-v1 and qwen3-coder-480b-a35b-v1: AWS Bedrock on-demand Standard tier, US East (N. Virginia) — official AWS Price List API https://pricing.us-east-1.amazonaws.com/offers/v1.0/aws/AmazonBedrock/20260926004940/us-east-1/index.json (also rendered at https://aws.amazon.com/bedrock/pricing/), SKU usagetype 'qwen.qwen3-coder-30b-a3b-instruct-mantle-{input,output}-tokens-standard' = $0.00015/$0.0006 per 1K tokens ($0.15/$0.60 per 1M) and 'qwen.qwen3-coder-480b-a35b-instruct-mantle-{input,output}-tokens-standard' = $0.00045/$0.0018 per 1K tokens ($0.45/$1.80 per 1M); no cache pricing published for either. Checked but NOT added (no official page states a price for the exact catalog id): claude-4-5-sonnet / claude-4-5-sonnet-vertex now resolve via the T1 reorder fallback onto the existing claude-sonnet-4-5 row, so no new row was needed."
|
|
20
21
|
},
|
|
21
|
-
"note": "codemie: added claude 4-7/4-8 tier estimates 2026-06-08; added kimi-for-coding alias and normalized kimi-k2-5 key 2026-06-15; added claude-sonnet-5 pinned entry 2026-07-01 (
|
|
22
|
+
"note": "codemie: added claude 4-7/4-8 tier estimates 2026-06-08; added kimi-for-coding alias and normalized kimi-k2-5 key 2026-06-15; added claude-sonnet-5 pinned entry 2026-07-01 (current resolution order: exact match, then one trailing snapshot suffix stripped, then a version-first Claude id reordered to its family-first table key, else unpriced — no family/tier fallback; see resolvePrice() in pricing.ts); corrected claude-sonnet-5 to its real $2/$10 rate 2026-09-15 (was pinned at the old Sonnet 4.x $3/$15 rate — Anthropic's introductory $2/$10 pricing for Sonnet 5 became standard instead of increasing to $3/$15 as originally scheduled); added per-row bedrockRegionalMultiplier 2026-09-15 to every Sonnet 4.5+/Haiku 4.5+/Opus 4.5+ row (including their dated snapshots) — Amazon Bedrock bills a regional/multi-region endpoint (a US/EU/JP/AU cross-region inference profile, or a single named AWS region) at this multiplier over its global endpoint, for exactly these generations and later; see https://platform.claude.com/docs/en/build-with-claude/claude-in-amazon-bedrock#regions. Applied by lookupPrice() (pricing.ts) and lookupRate() (statusline.mjs) when isBedrockRegionalPremium() (bedrock-pricing.mjs) detects a non-global Bedrock region qualifier on the raw model id — never a flat account-wide discount, and never on a pre-4.5 row that has no such field. Added 14 catalog-pricing-reconciliation rows 2026-09-26 (unify-analytics-cost-command T10): claude-opus-5-5, gpt-5-5, gpt-5-6-luna, gpt-5-6-sol, gpt-5-6-terra, gpt-6-luna, gpt-6-sol, deepseek-v4-pro, gemini-3-6-flash, gemini-3-8-flash, gemini-3-1-flash-image, grok-4-6, qwen3-coder-30b-a3b-v1, qwen3-coder-480b-a35b-v1 — each sourced from one official vendor pricing page/API, see notes.t10CatalogReconciliation for exact quotes and URLs. deepseek-v4-pro and qwen3-coder-30b-a3b-v1 (Bedrock) remain named 'unresolved' in the T3 report's prior draft; the AWS official Price List API resolved the qwen rows where the rendered pricing page alone was ambiguous. 2026-09-27: added claude-fable-5-1 / claude-mythos-5-1 ($10/$50, cache read $0.25 = 0.025x input) and claude-fable-5 / claude-mythos-5 ($10/$50, cache read $1), and removed the estimated flag from claude-opus-4-7 / claude-opus-4-8 (published at $5/$25, cache read $0.50) — all verified at https://platform.claude.com/docs/en/about-claude/pricing. claude-sonnet-4-7, claude-sonnet-4-8 and claude-haiku-4-6 are not on that page and stay estimated. 2026-09-27: added gpt-6-astra ($10/$1/$50 short-context tier; long tier $20/$2/$75), gpt-5-5-pro ($30/$180, no cached-input discount), gpt-5-4-mini ($0.75/$0.075/$4.50) and gpt-5-4-nano ($0.20/$0.02/$1.25), and corrected rounded cacheRead on gpt-5-1 (0.125), o4-mini (0.275) and gpt-4o-mini (0.075) — standard tier at https://developers.openai.com/api/docs/pricing. 2026-09-27: added kimi-k3 ($3/$15, cache read $0.30, cache write $3, 1h cache write $6) with an identical bare `k3` alias row (kimi-code logs the bare id `k3`, and resolvePrice() does not strip a provider-less prefix), and kimi-k2-6 ($0.95/$4, cache read $0.16, cache write $0.95) — https://platform.kimi.ai/docs/pricing/chat. k3 used through api.kimi.com/coding is billed as a flat Kimi Code subscription, so its report cost is an API-equivalent estimate, not an invoice. kimi-k2.5 is no longer listed on that page; its existing row is kept as last published."
|
|
22
23
|
},
|
|
23
24
|
"claude-sonnet-5": {
|
|
24
25
|
"input": 2,
|
|
25
26
|
"output": 10,
|
|
26
27
|
"cacheRead": 0.2,
|
|
27
28
|
"cacheWrite": 2.5,
|
|
28
|
-
"cacheWrite1h": 4.0
|
|
29
|
+
"cacheWrite1h": 4.0,
|
|
30
|
+
"bedrockRegionalMultiplier": 1.1
|
|
31
|
+
},
|
|
32
|
+
"claude-fable-5-1": {
|
|
33
|
+
"input": 10,
|
|
34
|
+
"output": 50,
|
|
35
|
+
"cacheRead": 0.25,
|
|
36
|
+
"cacheWrite": 12.5,
|
|
37
|
+
"cacheWrite1h": 20,
|
|
38
|
+
"bedrockRegionalMultiplier": 1.1
|
|
39
|
+
},
|
|
40
|
+
"claude-mythos-5-1": {
|
|
41
|
+
"input": 10,
|
|
42
|
+
"output": 50,
|
|
43
|
+
"cacheRead": 0.25,
|
|
44
|
+
"cacheWrite": 12.5,
|
|
45
|
+
"cacheWrite1h": 20,
|
|
46
|
+
"bedrockRegionalMultiplier": 1.1
|
|
47
|
+
},
|
|
48
|
+
"claude-fable-5": {
|
|
49
|
+
"input": 10,
|
|
50
|
+
"output": 50,
|
|
51
|
+
"cacheRead": 1,
|
|
52
|
+
"cacheWrite": 12.5,
|
|
53
|
+
"cacheWrite1h": 20,
|
|
54
|
+
"bedrockRegionalMultiplier": 1.1
|
|
55
|
+
},
|
|
56
|
+
"claude-mythos-5": {
|
|
57
|
+
"input": 10,
|
|
58
|
+
"output": 50,
|
|
59
|
+
"cacheRead": 1,
|
|
60
|
+
"cacheWrite": 12.5,
|
|
61
|
+
"cacheWrite1h": 20,
|
|
62
|
+
"bedrockRegionalMultiplier": 1.1
|
|
63
|
+
},
|
|
64
|
+
"claude-opus-5-5": {
|
|
65
|
+
"input": 4,
|
|
66
|
+
"output": 20,
|
|
67
|
+
"cacheRead": 0.2,
|
|
68
|
+
"cacheWrite": 5,
|
|
69
|
+
"cacheWrite1h": 8,
|
|
70
|
+
"bedrockRegionalMultiplier": 1.1
|
|
29
71
|
},
|
|
30
72
|
"claude-opus-5": {
|
|
31
73
|
"input": 5,
|
|
32
74
|
"output": 25,
|
|
33
75
|
"cacheRead": 0.5,
|
|
34
76
|
"cacheWrite": 6.25,
|
|
35
|
-
"cacheWrite1h": 10.0
|
|
77
|
+
"cacheWrite1h": 10.0,
|
|
78
|
+
"bedrockRegionalMultiplier": 1.1
|
|
36
79
|
},
|
|
37
80
|
"claude-opus-4-6": {
|
|
38
81
|
"input": 5,
|
|
39
82
|
"output": 25,
|
|
40
83
|
"cacheRead": 0.5,
|
|
41
84
|
"cacheWrite": 6.25,
|
|
42
|
-
"cacheWrite1h": 10.0
|
|
85
|
+
"cacheWrite1h": 10.0,
|
|
86
|
+
"bedrockRegionalMultiplier": 1.1
|
|
43
87
|
},
|
|
44
88
|
"claude-sonnet-4-6": {
|
|
45
89
|
"input": 3,
|
|
46
90
|
"output": 15,
|
|
47
91
|
"cacheRead": 0.3,
|
|
48
92
|
"cacheWrite": 3.75,
|
|
49
|
-
"cacheWrite1h": 6.0
|
|
93
|
+
"cacheWrite1h": 6.0,
|
|
94
|
+
"bedrockRegionalMultiplier": 1.1
|
|
50
95
|
},
|
|
51
96
|
"claude-opus-4-5": {
|
|
52
97
|
"input": 5,
|
|
53
98
|
"output": 25,
|
|
54
99
|
"cacheRead": 0.5,
|
|
55
100
|
"cacheWrite": 6.25,
|
|
56
|
-
"cacheWrite1h": 10.0
|
|
101
|
+
"cacheWrite1h": 10.0,
|
|
102
|
+
"bedrockRegionalMultiplier": 1.1
|
|
57
103
|
},
|
|
58
104
|
"claude-sonnet-4-5": {
|
|
59
105
|
"input": 3,
|
|
60
106
|
"output": 15,
|
|
61
107
|
"cacheRead": 0.3,
|
|
62
108
|
"cacheWrite": 3.75,
|
|
63
|
-
"cacheWrite1h": 6.0
|
|
109
|
+
"cacheWrite1h": 6.0,
|
|
110
|
+
"bedrockRegionalMultiplier": 1.1
|
|
64
111
|
},
|
|
65
112
|
"claude-haiku-4-5": {
|
|
66
113
|
"input": 1,
|
|
67
114
|
"output": 5,
|
|
68
115
|
"cacheRead": 0.1,
|
|
69
116
|
"cacheWrite": 1.25,
|
|
70
|
-
"cacheWrite1h": 2.0
|
|
117
|
+
"cacheWrite1h": 2.0,
|
|
118
|
+
"bedrockRegionalMultiplier": 1.1
|
|
71
119
|
},
|
|
72
120
|
"claude-opus-4-1": {
|
|
73
121
|
"input": 15,
|
|
@@ -151,6 +199,66 @@
|
|
|
151
199
|
"cacheRead": 30,
|
|
152
200
|
"cacheWrite": 30
|
|
153
201
|
},
|
|
202
|
+
"gpt-5-5": {
|
|
203
|
+
"input": 5,
|
|
204
|
+
"output": 30,
|
|
205
|
+
"cacheRead": 0.5,
|
|
206
|
+
"cacheWrite": 5
|
|
207
|
+
},
|
|
208
|
+
"gpt-5-6-luna": {
|
|
209
|
+
"input": 0.2,
|
|
210
|
+
"output": 1.2,
|
|
211
|
+
"cacheRead": 0.02,
|
|
212
|
+
"cacheWrite": 0.25
|
|
213
|
+
},
|
|
214
|
+
"gpt-5-6-sol": {
|
|
215
|
+
"input": 4,
|
|
216
|
+
"output": 20,
|
|
217
|
+
"cacheRead": 0.4,
|
|
218
|
+
"cacheWrite": 5
|
|
219
|
+
},
|
|
220
|
+
"gpt-5-6-terra": {
|
|
221
|
+
"input": 2,
|
|
222
|
+
"output": 12,
|
|
223
|
+
"cacheRead": 0.2,
|
|
224
|
+
"cacheWrite": 2.5
|
|
225
|
+
},
|
|
226
|
+
"gpt-6-luna": {
|
|
227
|
+
"input": 0.1,
|
|
228
|
+
"output": 0.5,
|
|
229
|
+
"cacheRead": 0.01,
|
|
230
|
+
"cacheWrite": 0.125
|
|
231
|
+
},
|
|
232
|
+
"gpt-6-astra": {
|
|
233
|
+
"input": 10,
|
|
234
|
+
"output": 50,
|
|
235
|
+
"cacheRead": 1,
|
|
236
|
+
"cacheWrite": 10
|
|
237
|
+
},
|
|
238
|
+
"gpt-5-5-pro": {
|
|
239
|
+
"input": 30,
|
|
240
|
+
"output": 180,
|
|
241
|
+
"cacheRead": 30,
|
|
242
|
+
"cacheWrite": 30
|
|
243
|
+
},
|
|
244
|
+
"gpt-5-4-mini": {
|
|
245
|
+
"input": 0.75,
|
|
246
|
+
"output": 4.5,
|
|
247
|
+
"cacheRead": 0.075,
|
|
248
|
+
"cacheWrite": 0.75
|
|
249
|
+
},
|
|
250
|
+
"gpt-5-4-nano": {
|
|
251
|
+
"input": 0.2,
|
|
252
|
+
"output": 1.25,
|
|
253
|
+
"cacheRead": 0.02,
|
|
254
|
+
"cacheWrite": 0.2
|
|
255
|
+
},
|
|
256
|
+
"gpt-6-sol": {
|
|
257
|
+
"input": 2,
|
|
258
|
+
"output": 10,
|
|
259
|
+
"cacheRead": 0.2,
|
|
260
|
+
"cacheWrite": 2.5
|
|
261
|
+
},
|
|
154
262
|
"gpt-5-2": {
|
|
155
263
|
"input": 1.75,
|
|
156
264
|
"output": 14,
|
|
@@ -166,7 +274,7 @@
|
|
|
166
274
|
"gpt-5-1": {
|
|
167
275
|
"input": 1.25,
|
|
168
276
|
"output": 10,
|
|
169
|
-
"cacheRead": 0.
|
|
277
|
+
"cacheRead": 0.125,
|
|
170
278
|
"cacheWrite": 1.25
|
|
171
279
|
},
|
|
172
280
|
"gpt-5": {
|
|
@@ -256,7 +364,7 @@
|
|
|
256
364
|
"gpt-4o-mini": {
|
|
257
365
|
"input": 0.15,
|
|
258
366
|
"output": 0.6,
|
|
259
|
-
"cacheRead": 0.
|
|
367
|
+
"cacheRead": 0.075,
|
|
260
368
|
"cacheWrite": 0.15
|
|
261
369
|
},
|
|
262
370
|
"gpt-4-turbo": {
|
|
@@ -316,7 +424,7 @@
|
|
|
316
424
|
"o4-mini": {
|
|
317
425
|
"input": 1.1,
|
|
318
426
|
"output": 4.4,
|
|
319
|
-
"cacheRead": 0.
|
|
427
|
+
"cacheRead": 0.275,
|
|
320
428
|
"cacheWrite": 1.1
|
|
321
429
|
},
|
|
322
430
|
"gemini-3-1-pro": {
|
|
@@ -367,6 +475,18 @@
|
|
|
367
475
|
"cacheRead": 0.025,
|
|
368
476
|
"cacheWrite": 0.25
|
|
369
477
|
},
|
|
478
|
+
"gemini-3-6-flash": {
|
|
479
|
+
"input": 0.75,
|
|
480
|
+
"output": 3.75,
|
|
481
|
+
"cacheRead": 0.075,
|
|
482
|
+
"cacheWrite": 0.75
|
|
483
|
+
},
|
|
484
|
+
"gemini-3-8-flash": {
|
|
485
|
+
"input": 0.75,
|
|
486
|
+
"output": 3.75,
|
|
487
|
+
"cacheRead": 0.075,
|
|
488
|
+
"cacheWrite": 0.75
|
|
489
|
+
},
|
|
370
490
|
"gemini-2-5-pro": {
|
|
371
491
|
"input": 1.25,
|
|
372
492
|
"output": 10,
|
|
@@ -421,6 +541,12 @@
|
|
|
421
541
|
"cacheRead": 0.05,
|
|
422
542
|
"cacheWrite": 0.2
|
|
423
543
|
},
|
|
544
|
+
"grok-4-6": {
|
|
545
|
+
"input": 2,
|
|
546
|
+
"output": 6,
|
|
547
|
+
"cacheRead": 0.5,
|
|
548
|
+
"cacheWrite": 2
|
|
549
|
+
},
|
|
424
550
|
"grok-4-fast": {
|
|
425
551
|
"input": 0.2,
|
|
426
552
|
"output": 0.5,
|
|
@@ -457,12 +583,19 @@
|
|
|
457
583
|
"cacheRead": 0.028,
|
|
458
584
|
"cacheWrite": 0.28
|
|
459
585
|
},
|
|
586
|
+
"deepseek-v4-pro": {
|
|
587
|
+
"input": 1.32,
|
|
588
|
+
"output": 3.96,
|
|
589
|
+
"cacheRead": 0.044,
|
|
590
|
+
"cacheWrite": 1.32
|
|
591
|
+
},
|
|
460
592
|
"claude-opus-4-5-20251101": {
|
|
461
593
|
"input": 5,
|
|
462
594
|
"output": 25,
|
|
463
595
|
"cacheRead": 0.5,
|
|
464
596
|
"cacheWrite": 6.25,
|
|
465
|
-
"cacheWrite1h": 10.0
|
|
597
|
+
"cacheWrite1h": 10.0,
|
|
598
|
+
"bedrockRegionalMultiplier": 1.1
|
|
466
599
|
},
|
|
467
600
|
"claude-3-5-haiku-latest": {
|
|
468
601
|
"input": 0.8,
|
|
@@ -497,7 +630,8 @@
|
|
|
497
630
|
"output": 15,
|
|
498
631
|
"cacheRead": 0.3,
|
|
499
632
|
"cacheWrite": 3.75,
|
|
500
|
-
"cacheWrite1h": 6.0
|
|
633
|
+
"cacheWrite1h": 6.0,
|
|
634
|
+
"bedrockRegionalMultiplier": 1.1
|
|
501
635
|
},
|
|
502
636
|
"claude-3-5-haiku-20241022": {
|
|
503
637
|
"input": 0.8,
|
|
@@ -539,7 +673,8 @@
|
|
|
539
673
|
"output": 5,
|
|
540
674
|
"cacheRead": 0.1,
|
|
541
675
|
"cacheWrite": 1.25,
|
|
542
|
-
"cacheWrite1h": 2.0
|
|
676
|
+
"cacheWrite1h": 2.0,
|
|
677
|
+
"bedrockRegionalMultiplier": 1.1
|
|
543
678
|
},
|
|
544
679
|
"claude-3-opus-20240229": {
|
|
545
680
|
"input": 15,
|
|
@@ -700,6 +835,12 @@
|
|
|
700
835
|
"cacheRead": 0,
|
|
701
836
|
"cacheWrite": 0
|
|
702
837
|
},
|
|
838
|
+
"gemini-3-1-flash-image": {
|
|
839
|
+
"input": 0.5,
|
|
840
|
+
"output": 60,
|
|
841
|
+
"cacheRead": 0,
|
|
842
|
+
"cacheWrite": 0
|
|
843
|
+
},
|
|
703
844
|
"gemini-3-1-flash-lite-preview": {
|
|
704
845
|
"input": 0.5,
|
|
705
846
|
"output": 3,
|
|
@@ -988,6 +1129,26 @@
|
|
|
988
1129
|
"cacheRead": 0.1,
|
|
989
1130
|
"cacheWrite": 0
|
|
990
1131
|
},
|
|
1132
|
+
"kimi-k3": {
|
|
1133
|
+
"input": 3,
|
|
1134
|
+
"output": 15,
|
|
1135
|
+
"cacheRead": 0.3,
|
|
1136
|
+
"cacheWrite": 3,
|
|
1137
|
+
"cacheWrite1h": 6
|
|
1138
|
+
},
|
|
1139
|
+
"k3": {
|
|
1140
|
+
"input": 3,
|
|
1141
|
+
"output": 15,
|
|
1142
|
+
"cacheRead": 0.3,
|
|
1143
|
+
"cacheWrite": 3,
|
|
1144
|
+
"cacheWrite1h": 6
|
|
1145
|
+
},
|
|
1146
|
+
"kimi-k2-6": {
|
|
1147
|
+
"input": 0.95,
|
|
1148
|
+
"output": 4,
|
|
1149
|
+
"cacheRead": 0.16,
|
|
1150
|
+
"cacheWrite": 0.95
|
|
1151
|
+
},
|
|
991
1152
|
"kimi-k2-5": {
|
|
992
1153
|
"input": 0.6,
|
|
993
1154
|
"output": 3,
|
|
@@ -1018,39 +1179,59 @@
|
|
|
1018
1179
|
"cacheRead": 0,
|
|
1019
1180
|
"cacheWrite": 0
|
|
1020
1181
|
},
|
|
1182
|
+
"qwen3-coder-480b-a35b-v1": {
|
|
1183
|
+
"input": 0.45,
|
|
1184
|
+
"output": 1.8,
|
|
1185
|
+
"cacheRead": 0,
|
|
1186
|
+
"cacheWrite": 0
|
|
1187
|
+
},
|
|
1188
|
+
"qwen3-coder-30b-a3b-v1": {
|
|
1189
|
+
"input": 0.15,
|
|
1190
|
+
"output": 0.6,
|
|
1191
|
+
"cacheRead": 0,
|
|
1192
|
+
"cacheWrite": 0
|
|
1193
|
+
},
|
|
1021
1194
|
"claude-opus-4-7": {
|
|
1022
1195
|
"input": 5,
|
|
1023
1196
|
"output": 25,
|
|
1024
1197
|
"cacheRead": 0.5,
|
|
1025
1198
|
"cacheWrite": 6.25,
|
|
1026
|
-
"cacheWrite1h": 10.0
|
|
1199
|
+
"cacheWrite1h": 10.0,
|
|
1200
|
+
"bedrockRegionalMultiplier": 1.1
|
|
1027
1201
|
},
|
|
1028
1202
|
"claude-opus-4-8": {
|
|
1029
1203
|
"input": 5,
|
|
1030
1204
|
"output": 25,
|
|
1031
1205
|
"cacheRead": 0.5,
|
|
1032
1206
|
"cacheWrite": 6.25,
|
|
1033
|
-
"cacheWrite1h": 10.0
|
|
1207
|
+
"cacheWrite1h": 10.0,
|
|
1208
|
+
"bedrockRegionalMultiplier": 1.1
|
|
1034
1209
|
},
|
|
1035
1210
|
"claude-sonnet-4-7": {
|
|
1036
1211
|
"input": 3,
|
|
1037
1212
|
"output": 15,
|
|
1038
1213
|
"cacheRead": 0.3,
|
|
1039
1214
|
"cacheWrite": 3.75,
|
|
1040
|
-
"cacheWrite1h": 6.0
|
|
1215
|
+
"cacheWrite1h": 6.0,
|
|
1216
|
+
"bedrockRegionalMultiplier": 1.1,
|
|
1217
|
+
"estimated": true
|
|
1041
1218
|
},
|
|
1042
1219
|
"claude-sonnet-4-8": {
|
|
1043
1220
|
"input": 3,
|
|
1044
1221
|
"output": 15,
|
|
1045
1222
|
"cacheRead": 0.3,
|
|
1046
1223
|
"cacheWrite": 3.75,
|
|
1047
|
-
"cacheWrite1h": 6.0
|
|
1224
|
+
"cacheWrite1h": 6.0,
|
|
1225
|
+
"bedrockRegionalMultiplier": 1.1,
|
|
1226
|
+
"estimated": true
|
|
1048
1227
|
},
|
|
1049
1228
|
"claude-haiku-4-6": {
|
|
1050
1229
|
"input": 1,
|
|
1051
1230
|
"output": 5,
|
|
1052
1231
|
"cacheRead": 0.1,
|
|
1053
1232
|
"cacheWrite": 1.25,
|
|
1054
|
-
"cacheWrite1h": 2.0
|
|
1233
|
+
"cacheWrite1h": 2.0,
|
|
1234
|
+
"bedrockRegionalMultiplier": 1.1,
|
|
1235
|
+
"estimated": true
|
|
1055
1236
|
}
|
|
1056
1237
|
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// Routing-header domain layer.
|
|
2
|
+
//
|
|
3
|
+
// The CodeMie proxy's routing-header-injector plugin copies the upstream router's canonical
|
|
4
|
+
// x-codemie-routing-* response headers onto the message body verbatim — hyphens intact, no key
|
|
5
|
+
// transformation (see src/providers/plugins/sso/proxy/plugins/routing-header-injector.plugin.ts)
|
|
6
|
+
// — where the agent persists them in its own transcript. parseRoutingHeaders() is the ONE place
|
|
7
|
+
// that turns those raw header fields into the RoutingDecision domain entity (see
|
|
8
|
+
// routing-headers.d.mts) — every consumer reads the parsed entity, not the raw header strings.
|
|
9
|
+
//
|
|
10
|
+
// The proxy emits a single header vocabulary regardless of which mechanism actually made the
|
|
11
|
+
// routing decision on the backend (CodeMie Switchyard, LiteLLM's own auto-router, or anything
|
|
12
|
+
// added later) — that distinction is backend-internal and never reaches this repo. This module
|
|
13
|
+
// treats routing as one abstract concept: whatever the proxy reports is parsed uniformly.
|
|
14
|
+
// `x-codemie-routing-family` is carried through as an opaque, informational string (purely for
|
|
15
|
+
// display/analytics — e.g. "switchyard" vs "litellm" today) — nothing here branches on it.
|
|
16
|
+
//
|
|
17
|
+
// Scoped to the routing DECISION only (tier, routed/requested model, classifier cost) — not
|
|
18
|
+
// agent-specific, not about model pricing. Resolving a backend model id for Bedrock regional
|
|
19
|
+
// pricing lives in the separate bedrock-pricing.mjs, even though it also reads a header off the
|
|
20
|
+
// same message object: that's a pricing concern any agent going through this proxy needs,
|
|
21
|
+
// independent of whether a routing decision was made at all.
|
|
22
|
+
//
|
|
23
|
+
// Deliberately plain JS with zero imports, living under src/utils/ rather than beside a specific
|
|
24
|
+
// agent's plugin: this file is deployed as-is to two different runtimes —
|
|
25
|
+
// - Any agent's standalone statusline (e.g. the Claude one, plugin/statusline.mjs — no project
|
|
26
|
+
// imports, `node <path>` after the CLI process exits) imports it by relative path; its own
|
|
27
|
+
// installer deploys this file as a flat sibling (see statusline-installer.ts).
|
|
28
|
+
// - The analytics cost engine (src/cli/commands/analytics/cost/usage-readers.ts) imports it
|
|
29
|
+
// too, as a normal TS import — see the companion routing-headers.d.mts for its types, since
|
|
30
|
+
// this file itself is plain JS, not compiled.
|
|
31
|
+
// Because tsc does not compile `.mjs`, scripts/copy-plugins.js has an explicit copy entry for it
|
|
32
|
+
// (same pattern as pricing.json).
|
|
33
|
+
|
|
34
|
+
const CODEMIE_ROUTING_HEADERS = [
|
|
35
|
+
'x-codemie-routed-model',
|
|
36
|
+
'x-codemie-requested-model',
|
|
37
|
+
'x-codemie-routing-tier',
|
|
38
|
+
'x-codemie-routing-decision-source',
|
|
39
|
+
'x-codemie-routing-source',
|
|
40
|
+
'x-codemie-routing-router-type',
|
|
41
|
+
'x-codemie-routing-family',
|
|
42
|
+
'x-codemie-routing-classifier-model',
|
|
43
|
+
'x-codemie-routing-classifier-cost-usd',
|
|
44
|
+
'x-codemie-routing-counterfactual-model',
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
function hasAnyHeader(message, headerNames) {
|
|
48
|
+
return headerNames.some((name) => message?.[name] != null);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Parse one turn's routing decision out of its transcript message. Returns `null` when the
|
|
53
|
+
* message carries no routing metadata at all — the common case for non-routed deployments and
|
|
54
|
+
* for requests that name a literal model ID.
|
|
55
|
+
*
|
|
56
|
+
* @param {object | null | undefined} message
|
|
57
|
+
* @returns {import('./routing-headers.d.mts').RoutingDecision | null}
|
|
58
|
+
*/
|
|
59
|
+
export function parseRoutingHeaders(message) {
|
|
60
|
+
if (!hasAnyHeader(message, CODEMIE_ROUTING_HEADERS)) return null;
|
|
61
|
+
|
|
62
|
+
const routingTier = normalizeRoutingTier(message['x-codemie-routing-tier']);
|
|
63
|
+
const classifierCostUSD = parseOptFloat(message['x-codemie-routing-classifier-cost-usd']);
|
|
64
|
+
|
|
65
|
+
return {
|
|
66
|
+
...(message['x-codemie-requested-model'] != null && { requestedModel: message['x-codemie-requested-model'] }),
|
|
67
|
+
...(routingTier != null && { routingTier }),
|
|
68
|
+
...(message['x-codemie-routing-tier'] != null && { routingTierRaw: message['x-codemie-routing-tier'] }),
|
|
69
|
+
...(message['x-codemie-routed-model'] != null && { routedModel: message['x-codemie-routed-model'] }),
|
|
70
|
+
...(message['x-codemie-routing-classifier-model'] != null && { classifierModel: message['x-codemie-routing-classifier-model'] }),
|
|
71
|
+
...(message['x-codemie-routing-router-type'] != null && { routerType: message['x-codemie-routing-router-type'] }),
|
|
72
|
+
...(message['x-codemie-routing-source'] != null && { routingSource: message['x-codemie-routing-source'] }),
|
|
73
|
+
...(message['x-codemie-routing-decision-source'] != null && { decisionSource: message['x-codemie-routing-decision-source'] }),
|
|
74
|
+
// Opaque passthrough of whichever backend mechanism made the decision — informational only.
|
|
75
|
+
...(message['x-codemie-routing-family'] != null && { routingFamily: message['x-codemie-routing-family'] }),
|
|
76
|
+
// Backend-computed counterfactual: the model this turn's usage should be repriced at to
|
|
77
|
+
// estimate "what this would have cost unrouted" — see cost-enricher.ts's `buildModelTimeline`.
|
|
78
|
+
...(message['x-codemie-routing-counterfactual-model'] != null && { counterfactualModel: message['x-codemie-routing-counterfactual-model'] }),
|
|
79
|
+
// Known iff the proxy reported a classifier cost for this turn — absence means "no
|
|
80
|
+
// classifier ran / not measured", not "zero".
|
|
81
|
+
routingCostKnown: classifierCostUSD != null,
|
|
82
|
+
...(classifierCostUSD != null && { classifierCostUSD }),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function parseOptFloat(s) {
|
|
87
|
+
if (s == null) return undefined;
|
|
88
|
+
const v = parseFloat(s);
|
|
89
|
+
return Number.isNaN(v) ? undefined : v;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function normalizeRoutingTier(raw) {
|
|
93
|
+
if (raw == null) return undefined;
|
|
94
|
+
const key = String(raw).trim().toLowerCase();
|
|
95
|
+
const map = {
|
|
96
|
+
'simple': 'simple',
|
|
97
|
+
'efficient': 'middle',
|
|
98
|
+
'medium': 'middle',
|
|
99
|
+
'capable': 'complex',
|
|
100
|
+
'complex': 'complex',
|
|
101
|
+
'reasoning': 'reasoning',
|
|
102
|
+
};
|
|
103
|
+
return map[key] ?? key;
|
|
104
|
+
}
|
package/dist/utils/security.d.ts
CHANGED
|
@@ -44,35 +44,6 @@ export declare class CredentialStore {
|
|
|
44
44
|
private encryptionKey;
|
|
45
45
|
private constructor();
|
|
46
46
|
static getInstance(): CredentialStore;
|
|
47
|
-
/**
|
|
48
|
-
* Generate a storage key for a given URL.
|
|
49
|
-
*
|
|
50
|
-
* Reduces the URL to protocol+host before hashing so storage and retrieval
|
|
51
|
-
* always agree on a key regardless of which path a caller passes in (e.g.
|
|
52
|
-
* a bare portal URL from `codemie setup` vs. a full API URL from
|
|
53
|
-
* `codemie profile login --url <api-url>`). Only stripping a trailing
|
|
54
|
-
* slash here (without dropping the path) would make the key sensitive to
|
|
55
|
-
* whichever URL variant happened to be passed at store time.
|
|
56
|
-
* @param baseUrl - The URL to hash (path/query/hash, if any, are discarded)
|
|
57
|
-
* @returns Storage key (e.g., "sso-abc123...")
|
|
58
|
-
*/
|
|
59
|
-
private getUrlStorageKey;
|
|
60
|
-
/**
|
|
61
|
-
* Storage key as it was derived before the URL was normalized to protocol+host.
|
|
62
|
-
* Only used to find and clean up credentials written by an earlier version.
|
|
63
|
-
*/
|
|
64
|
-
private getLegacyUrlStorageKey;
|
|
65
|
-
private hashStorageKey;
|
|
66
|
-
/**
|
|
67
|
-
* Reduce a URL to protocol+host, or return it unchanged if it is not an
|
|
68
|
-
* http(s) URL with a host.
|
|
69
|
-
*
|
|
70
|
-
* `new URL()` does not throw on `scheme:rest` strings — `new URL('localhost:8080')`
|
|
71
|
-
* parses as protocol `localhost:` with an *empty* host. Without the host and
|
|
72
|
-
* protocol guard every scheme-less `host:port` would normalize to the same
|
|
73
|
-
* `scheme://` and two different instances would share one credential entry.
|
|
74
|
-
*/
|
|
75
|
-
private normalizeForKey;
|
|
76
47
|
storeSSOCredentials(credentials: SSOCredentials, baseUrl?: string): Promise<void>;
|
|
77
48
|
retrieveSSOCredentials(baseUrl?: string): Promise<SSOCredentials | null>;
|
|
78
49
|
clearSSOCredentials(baseUrl?: string): Promise<void>;
|
|
@@ -96,9 +67,6 @@ export declare class CredentialStore {
|
|
|
96
67
|
* @param baseUrl - Optional base URL for per-URL deletion
|
|
97
68
|
*/
|
|
98
69
|
clearJWTCredentials(baseUrl?: string): Promise<void>;
|
|
99
|
-
private encrypt;
|
|
100
|
-
private decrypt;
|
|
101
|
-
private getOrCreateEncryptionKey;
|
|
102
70
|
private storeToFile;
|
|
103
71
|
private retrieveFromFile;
|
|
104
72
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../../src/utils/security.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"security.d.ts","sourceRoot":"","sources":["../../src/utils/security.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAmE5E;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAqCnE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQpF;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GAAG,MAAM,CAWnF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAenE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA6DrG;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,OAAO,EAAE,CAgB7D;AA8BD;;;;;;;GAOG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAkB;IACzC,OAAO,CAAC,aAAa,CAAS;IAE9B,OAAO;IAIP,MAAM,CAAC,WAAW,IAAI,eAAe;IAO/B,mBAAmB,CAAC,WAAW,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAuBjF,sBAAsB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IA6BxE,mBAAmB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAe1D,OAAO,CAAC,kBAAkB;YAIZ,cAAc;YA4Bd,gBAAgB;IAiB9B;;;;OAIG;IACG,mBAAmB,CAAC,WAAW,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAwBvF;;;;OAIG;IACG,sBAAsB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAiD9E;;;OAGG;IACG,mBAAmB,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;YAyB5C,WAAW;YAMX,gBAAgB;CAO/B"}
|