praxis-agent 0.62.6 → 0.62.7

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.
@@ -0,0 +1,4 @@
1
+ export type AnthropicModelAliasOverrides = Readonly<Partial<Record<'sonnet' | 'opus' | 'haiku', string>>>;
2
+ export declare function anthropicModelAliasOverridesFromEnvironment(environment: Readonly<Record<string, string | undefined>>): AnthropicModelAliasOverrides;
3
+ export declare function resolveAnthropicModelAlias(model: string, overrides?: AnthropicModelAliasOverrides): string;
4
+ //# sourceMappingURL=anthropic-model-alias.d.ts.map
@@ -0,0 +1,37 @@
1
+ const DEFAULTS = {
2
+ sonnet: 'claude-sonnet-5',
3
+ opus: 'claude-opus-5',
4
+ haiku: 'claude-haiku-4-5-20251001',
5
+ };
6
+ const ENVIRONMENT_KEYS = {
7
+ sonnet: 'ANTHROPIC_DEFAULT_SONNET_MODEL',
8
+ opus: 'ANTHROPIC_DEFAULT_OPUS_MODEL',
9
+ haiku: 'ANTHROPIC_DEFAULT_HAIKU_MODEL',
10
+ };
11
+ export function anthropicModelAliasOverridesFromEnvironment(environment) {
12
+ const overrides = {};
13
+ for (const family of ['sonnet', 'opus', 'haiku']) {
14
+ const value = environment[ENVIRONMENT_KEYS[family]];
15
+ if (value === undefined || value.trim().length === 0)
16
+ continue;
17
+ if (value.length > 256) {
18
+ throw new Error(`${ENVIRONMENT_KEYS[family]} must be at most 256 characters`);
19
+ }
20
+ overrides[family] = value;
21
+ }
22
+ return overrides;
23
+ }
24
+ export function resolveAnthropicModelAlias(model, overrides = {}) {
25
+ const longContext = model.endsWith('[1m]');
26
+ const family = longContext ? model.slice(0, -'[1m]'.length) : model;
27
+ if (family !== 'sonnet' && family !== 'opus' && family !== 'haiku') {
28
+ return model;
29
+ }
30
+ if (longContext && family === 'haiku')
31
+ return model;
32
+ const resolved = overrides[family] ?? DEFAULTS[family];
33
+ if (!longContext || resolved.endsWith('[1m]'))
34
+ return resolved;
35
+ return `${resolved}[1m]`;
36
+ }
37
+ //# sourceMappingURL=anthropic-model-alias.js.map
@@ -1,6 +1,7 @@
1
1
  import type { ModelProvider, ModelThinkingConfig } from '../core/runtime.js';
2
2
  import { type CodexOAuthVault } from './codex-oauth.js';
3
3
  import { type ProviderProtocol, type ProviderTarget } from './provider-settings.js';
4
+ import { type AnthropicModelAliasOverrides } from './anthropic-model-alias.js';
4
5
  import type { ProviderCredentialSourceMetadata, ProviderCredentialReader, ResolvedProviderCredential } from './provider-auth.js';
5
6
  import { parseProviderEnvironment, type ContextEnvironment } from './environment.js';
6
7
  import { type AnthropicPromptCachePolicy } from './anthropic-prompt-cache.js';
@@ -22,6 +23,7 @@ export interface ProviderRegistryOptions {
22
23
  }) => AnthropicPromptCachePolicy;
23
24
  fetchImplementation?: typeof fetch;
24
25
  providerEnvironment?: ReturnType<typeof parseProviderEnvironment>;
26
+ anthropicModelAliasOverrides?: AnthropicModelAliasOverrides;
25
27
  vault?: CodexOAuthVault;
26
28
  }
27
29
  export interface ResolveProviderRegistryOptions {
@@ -7,6 +7,7 @@ import { NonStreamingFallbackModelProvider } from './non-streaming-fallback-prov
7
7
  import { CodexOAuthCredentialManager, } from './codex-oauth.js';
8
8
  import { resolveProviderTarget, } from './provider-settings.js';
9
9
  import { resolveAnthropicModelSpec } from './anthropic-model-spec.js';
10
+ import { anthropicModelAliasOverridesFromEnvironment, resolveAnthropicModelAlias, } from './anthropic-model-alias.js';
10
11
  import { ProviderAuthenticationError, resolveProviderCredential, } from './provider-auth.js';
11
12
  import { parseContextEnvironment, parseProviderEnvironment, } from './environment.js';
12
13
  import { createAnthropicPromptCachePolicyResolver, } from './anthropic-prompt-cache.js';
@@ -55,6 +56,10 @@ export async function resolveProviderRegistry(options) {
55
56
  PRAXIS_BASE_URL: target.baseUrl,
56
57
  };
57
58
  const providerEnvironment = parseProviderEnvironment(controlsEnvironment);
59
+ const anthropicModelAliasOverrides = target.providerId === 'anthropic' &&
60
+ target.protocol === 'anthropic-messages'
61
+ ? anthropicModelAliasOverridesFromEnvironment(environment)
62
+ : undefined;
58
63
  const promptCacheResolver = target.protocol === 'anthropic-messages'
59
64
  ? createAnthropicPromptCachePolicyResolver(controlsEnvironment)
60
65
  : undefined;
@@ -74,6 +79,9 @@ export async function resolveProviderRegistry(options) {
74
79
  ...(promptCacheResolver === undefined
75
80
  ? {}
76
81
  : { anthropicPromptCacheResolver: promptCacheResolver }),
82
+ ...(anthropicModelAliasOverrides === undefined
83
+ ? {}
84
+ : { anthropicModelAliasOverrides }),
77
85
  ...(options.fetchImplementation === undefined
78
86
  ? {}
79
87
  : { fetchImplementation: options.fetchImplementation }),
@@ -91,7 +99,7 @@ class NativeProviderRegistry {
91
99
  codexManager;
92
100
  constructor(options) {
93
101
  this.options = options;
94
- this.target = options.target;
102
+ this.target = this.resolveTarget(options.target);
95
103
  this.credentialSource = options.credential.source;
96
104
  if (options.target.protocol === 'codex-subscription') {
97
105
  if (options.credential.type !== 'oauth') {
@@ -106,7 +114,7 @@ class NativeProviderRegistry {
106
114
  }
107
115
  }
108
116
  create(modelId = this.target.modelId) {
109
- const target = { ...this.target, modelId };
117
+ const target = this.resolveTarget({ ...this.target, modelId });
110
118
  if (target.protocol === 'codex-subscription') {
111
119
  if (!this.codexManager)
112
120
  throw new ProviderAuthenticationError('invalid_credential', 'Provider authentication failed: Codex subscription credentials are unavailable');
@@ -220,6 +228,15 @@ class NativeProviderRegistry {
220
228
  }
221
229
  throw new ProviderRegistryError('unsupported_provider', `Unsupported provider protocol: ${target.protocol}`);
222
230
  }
231
+ resolveTarget(target) {
232
+ if (target.providerId !== 'anthropic' ||
233
+ target.protocol !== 'anthropic-messages')
234
+ return target;
235
+ return {
236
+ ...target,
237
+ modelId: resolveAnthropicModelAlias(target.modelId, this.options.anthropicModelAliasOverrides),
238
+ };
239
+ }
223
240
  withDeadline(provider) {
224
241
  const environment = this.options.providerEnvironment;
225
242
  return environment === undefined
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "praxis-agent",
3
- "version": "0.62.6",
3
+ "version": "0.62.7",
4
4
  "description": "Local-first, single-user general agent for the command line.",
5
5
  "license": "MIT",
6
6
  "author": "wuqisen",