praxis-agent 0.62.6 → 0.63.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.
@@ -72,6 +72,8 @@ export interface ClaudeSessionServiceOptions {
72
72
  providerForMainModel?: (model: string) => ModelProvider;
73
73
  /** Creates one fresh main-turn provider per outer user turn; never used for auxiliary model calls. */
74
74
  providerForTurn?: (model?: string) => ModelProvider;
75
+ /** Creates one fresh provider for each automatic session-name suggestion. */
76
+ sessionNameProviderFactory?: () => ModelProvider;
75
77
  /** Creates a provider adapter dedicated to Session memory requests so
76
78
  * adapter-local cache and retry state are not shared with the foreground. */
77
79
  sessionMemoryProviderFactory?: () => ModelProvider;
@@ -1534,7 +1534,7 @@ export class ClaudeSessionService {
1534
1534
  }
1535
1535
  }
1536
1536
  async sessionNameSuggestion(sessionId, signal) {
1537
- const provider = this.provider();
1537
+ const provider = this.options.sessionNameProviderFactory?.() ?? this.provider();
1538
1538
  {
1539
1539
  const transcript = new NativeSessionTranscript({
1540
1540
  sessionId,
@@ -1047,6 +1047,7 @@ const createDefaultService = async ({ eventSink, requireProvider, hooksOnly = fa
1047
1047
  let providerForModel;
1048
1048
  let providerForMainModel;
1049
1049
  let providerForTurn;
1050
+ let sessionNameProviderFactory;
1050
1051
  let providerBillingMode;
1051
1052
  const context = parseContextEnvironment(runtimeEnvironment);
1052
1053
  const apiKey = runtimeEnvironment.PRAXIS_API_KEY;
@@ -1186,6 +1187,9 @@ const createDefaultService = async ({ eventSink, requireProvider, hooksOnly = fa
1186
1187
  ? defaultProvider
1187
1188
  : createProviderStack(selectedModel, 'turn');
1188
1189
  };
1190
+ if (registry.hasExplicitModelAlias('haiku')) {
1191
+ sessionNameProviderFactory = () => createProviderStack('haiku', 'completion');
1192
+ }
1189
1193
  }
1190
1194
  catch (error) {
1191
1195
  const optionalProviderError = error instanceof ProviderAuthenticationError ||
@@ -1238,6 +1242,9 @@ const createDefaultService = async ({ eventSink, requireProvider, hooksOnly = fa
1238
1242
  ...(!experimentalNativeTranscriptWrites && sessionMemoryProviderFactory
1239
1243
  ? { sessionMemoryProviderFactory }
1240
1244
  : {}),
1245
+ ...(!experimentalNativeTranscriptWrites && sessionNameProviderFactory
1246
+ ? { sessionNameProviderFactory }
1247
+ : {}),
1241
1248
  ...(!experimentalNativeTranscriptWrites && sessionKind !== undefined
1242
1249
  ? { sessionKind }
1243
1250
  : {}),
@@ -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 {
@@ -45,6 +47,7 @@ export type ProviderRegistrySourceMetadata = ProviderCredentialSourceMetadata;
45
47
  export interface ProviderRegistry {
46
48
  readonly target: ProviderTarget;
47
49
  readonly credentialSource: ProviderRegistrySourceMetadata;
50
+ hasExplicitModelAlias(modelId: string): boolean;
48
51
  create(modelId?: string): ModelProvider;
49
52
  }
50
53
  export declare function resolveProviderContextWindowTokens(options: {
@@ -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,24 @@ class NativeProviderRegistry {
220
228
  }
221
229
  throw new ProviderRegistryError('unsupported_provider', `Unsupported provider protocol: ${target.protocol}`);
222
230
  }
231
+ hasExplicitModelAlias(modelId) {
232
+ if (this.target.providerId !== 'anthropic' ||
233
+ this.target.protocol !== 'anthropic-messages')
234
+ return false;
235
+ if (modelId !== 'sonnet' && modelId !== 'opus' && modelId !== 'haiku')
236
+ return false;
237
+ const override = this.options.anthropicModelAliasOverrides?.[modelId];
238
+ return override !== undefined && override.trim().length > 0;
239
+ }
240
+ resolveTarget(target) {
241
+ if (target.providerId !== 'anthropic' ||
242
+ target.protocol !== 'anthropic-messages')
243
+ return target;
244
+ return {
245
+ ...target,
246
+ modelId: resolveAnthropicModelAlias(target.modelId, this.options.anthropicModelAliasOverrides),
247
+ };
248
+ }
223
249
  withDeadline(provider) {
224
250
  const environment = this.options.providerEnvironment;
225
251
  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.63.0",
4
4
  "description": "Local-first, single-user general agent for the command line.",
5
5
  "license": "MIT",
6
6
  "author": "wuqisen",