@salesforce/sfdx-agent-sdk 0.32.0 → 0.34.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.
Files changed (42) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +45 -50
  3. package/dist/agent-connectivity-resolver.d.ts +11 -5
  4. package/dist/agent-connectivity-resolver.js +34 -16
  5. package/dist/harness/harness-config.d.ts +5 -84
  6. package/dist/harness/harness-config.js +0 -30
  7. package/dist/harness/public.d.ts +3 -4
  8. package/dist/index.d.ts +3 -3
  9. package/dist/index.js +1 -1
  10. package/dist/models/claude-opus-4-5.d.ts +2 -1
  11. package/dist/models/claude-opus-4-5.js +4 -0
  12. package/dist/models/claude-opus-4-6.d.ts +2 -1
  13. package/dist/models/claude-opus-4-6.js +4 -0
  14. package/dist/models/claude-opus-4-7.d.ts +3 -1
  15. package/dist/models/claude-opus-4-7.js +7 -0
  16. package/dist/models/claude-opus-4-8.d.ts +3 -1
  17. package/dist/models/claude-opus-4-8.js +7 -0
  18. package/dist/models/claude-sonnet-4-5.d.ts +2 -1
  19. package/dist/models/claude-sonnet-4-5.js +4 -0
  20. package/dist/models/claude-sonnet-4-6.d.ts +2 -1
  21. package/dist/models/claude-sonnet-4-6.js +4 -0
  22. package/dist/models/create-claude-model.d.ts +12 -5
  23. package/dist/models/create-claude-model.js +6 -4
  24. package/dist/models/{gpt-5-1-geo.d.ts → gpt-5-1.d.ts} +1 -1
  25. package/dist/models/{gpt-5-1-geo.js → gpt-5-1.js} +4 -4
  26. package/dist/models/{gpt-5-2-geo.d.ts → gpt-5-2.d.ts} +1 -1
  27. package/dist/models/{gpt-5-2-geo.js → gpt-5-2.js} +4 -4
  28. package/dist/models/gpt-5-4.d.ts +5 -0
  29. package/dist/models/gpt-5-4.js +5 -0
  30. package/dist/models/gpt-5.d.ts +5 -0
  31. package/dist/models/gpt-5.js +5 -0
  32. package/dist/models/index.d.ts +13 -5
  33. package/dist/models/index.js +39 -25
  34. package/dist/models/model.d.ts +65 -14
  35. package/dist/models/model.js +49 -17
  36. package/dist/policy-resolver.d.ts +4 -2
  37. package/dist/types/tools.d.ts +2 -2
  38. package/package.json +8 -8
  39. package/dist/models/gpt-5-4-geo.d.ts +0 -16
  40. package/dist/models/gpt-5-4-geo.js +0 -26
  41. package/dist/models/gpt-5-geo.d.ts +0 -17
  42. package/dist/models/gpt-5-geo.js +0 -28
@@ -1,4 +1,4 @@
1
- import { Model, ModelName } from './model.js';
1
+ import { Model, ModelName, type ThinkingMode } from './model.js';
2
2
  import { type SupportedFileFormat } from './types.js';
3
3
  export declare class ClaudeOpus47 extends Model {
4
4
  readonly name: ModelName;
@@ -7,5 +7,7 @@ export declare class ClaudeOpus47 extends Model {
7
7
  readonly maxOutputTokens: number;
8
8
  readonly contextWindow: number;
9
9
  readonly supportsPromptCache: boolean;
10
+ readonly excludedParameters: string[];
11
+ readonly thinkingMode: ThinkingMode;
10
12
  readonly supportedFormats: readonly SupportedFileFormat[];
11
13
  }
@@ -13,6 +13,13 @@ export class ClaudeOpus47 extends Model {
13
13
  maxOutputTokens = 128_000;
14
14
  contextWindow = 1_000_000;
15
15
  supportsPromptCache = true;
16
+ // The gateway deprecated `temperature` for Opus 4.7+ and rejects requests
17
+ // that include it, so the harness strips it before the request is sent.
18
+ excludedParameters = ['temperature'];
19
+ // The Bedrock 4.6+ backend requires the `thinking.type: "adaptive"` shape and
20
+ // rejects the legacy `"enabled"` the bundled CLI defaults to for this model.
21
+ // Verified on the wire; see the harness thinking-mode probe.
22
+ thinkingMode = 'adaptive';
16
23
  supportedFormats = [
17
24
  { name: 'png', mimeType: MimeType.Png, maxBytesPerFile: 3.75 * 1024 * 1024 },
18
25
  { name: 'jpeg', mimeType: MimeType.Jpeg, maxBytesPerFile: 3.75 * 1024 * 1024 },
@@ -1,4 +1,4 @@
1
- import { Model, ModelName } from './model.js';
1
+ import { Model, ModelName, type ThinkingMode } from './model.js';
2
2
  import { type SupportedFileFormat } from './types.js';
3
3
  export declare class ClaudeOpus48 extends Model {
4
4
  readonly name: ModelName;
@@ -7,5 +7,7 @@ export declare class ClaudeOpus48 extends Model {
7
7
  readonly maxOutputTokens: number;
8
8
  readonly contextWindow: number;
9
9
  readonly supportsPromptCache: boolean;
10
+ readonly excludedParameters: string[];
11
+ readonly thinkingMode: ThinkingMode;
10
12
  readonly supportedFormats: readonly SupportedFileFormat[];
11
13
  }
@@ -13,6 +13,13 @@ export class ClaudeOpus48 extends Model {
13
13
  maxOutputTokens = 128_000;
14
14
  contextWindow = 1_000_000;
15
15
  supportsPromptCache = true;
16
+ // The gateway deprecated `temperature` for Opus 4.7+ and rejects requests
17
+ // that include it, so the harness strips it before the request is sent.
18
+ excludedParameters = ['temperature'];
19
+ // The Bedrock 4.6+ backend requires the `thinking.type: "adaptive"` shape and
20
+ // rejects the legacy `"enabled"` the bundled CLI defaults to for this model.
21
+ // Verified on the wire; see the harness thinking-mode probe.
22
+ thinkingMode = 'adaptive';
16
23
  supportedFormats = [
17
24
  { name: 'png', mimeType: MimeType.Png, maxBytesPerFile: 3.75 * 1024 * 1024 },
18
25
  { name: 'jpeg', mimeType: MimeType.Jpeg, maxBytesPerFile: 3.75 * 1024 * 1024 },
@@ -1,4 +1,4 @@
1
- import { Model, ModelName } from './model.js';
1
+ import { Model, ModelName, type ThinkingMode } from './model.js';
2
2
  import { type SupportedFileFormat } from './types.js';
3
3
  export declare class ClaudeSonnet45 extends Model {
4
4
  readonly name: ModelName;
@@ -7,5 +7,6 @@ export declare class ClaudeSonnet45 extends Model {
7
7
  readonly maxOutputTokens: number;
8
8
  readonly contextWindow: number;
9
9
  readonly supportsPromptCache: boolean;
10
+ readonly thinkingMode: ThinkingMode;
10
11
  readonly supportedFormats: readonly SupportedFileFormat[];
11
12
  }
@@ -12,6 +12,10 @@ export class ClaudeSonnet45 extends Model {
12
12
  maxOutputTokens = 8192;
13
13
  contextWindow = 200000;
14
14
  supportsPromptCache = true;
15
+ // The Bedrock 4.5 backend accepts only the legacy `thinking.type: "enabled"`
16
+ // shape and rejects `"adaptive"` (which arrives with 4.6+). Verified on the
17
+ // wire; see the harness thinking-mode probe.
18
+ thinkingMode = 'enabled';
15
19
  // Multimodal limits: 3.75 MiB / image, 4.5 MiB / PDF, 5 PDFs / request
16
20
  // Reference: https://help.salesforce.com/s/articleView?id=ai.generative_ai_llm_multimodal_support.htm&type=5
17
21
  supportedFormats = [
@@ -1,4 +1,4 @@
1
- import { Model, ModelName } from './model.js';
1
+ import { Model, ModelName, type ThinkingMode } from './model.js';
2
2
  import { type SupportedFileFormat } from './types.js';
3
3
  export declare class ClaudeSonnet46 extends Model {
4
4
  readonly name: ModelName;
@@ -7,5 +7,6 @@ export declare class ClaudeSonnet46 extends Model {
7
7
  readonly maxOutputTokens: number;
8
8
  readonly contextWindow: number;
9
9
  readonly supportsPromptCache: boolean;
10
+ readonly thinkingMode: ThinkingMode;
10
11
  readonly supportedFormats: readonly SupportedFileFormat[];
11
12
  }
@@ -12,6 +12,10 @@ export class ClaudeSonnet46 extends Model {
12
12
  maxOutputTokens = 16384;
13
13
  contextWindow = 200000;
14
14
  supportsPromptCache = true;
15
+ // The Bedrock 4.6+ backend requires the `thinking.type: "adaptive"` shape and
16
+ // rejects the legacy `"enabled"`. Verified on the wire; see the harness
17
+ // thinking-mode probe.
18
+ thinkingMode = 'adaptive';
15
19
  // Multimodal limits: 3.75 MiB / image, 4.5 MiB / PDF, 5 PDFs / request
16
20
  supportedFormats = [
17
21
  { name: 'png', mimeType: MimeType.Png, maxBytesPerFile: 3.75 * 1024 * 1024 },
@@ -1,4 +1,4 @@
1
- import { Model } from './model.js';
1
+ import { Model, type ThinkingMode } from './model.js';
2
2
  import { type SupportedFileFormat } from './types.js';
3
3
  /**
4
4
  * Optional overrides for {@link createClaudeModel}. Any field omitted falls back to a conservative
@@ -19,8 +19,15 @@ export type ClaudeModelOverrides = {
19
19
  supportsPromptCache?: boolean;
20
20
  /** Multimodal file format caps. Defaults to the Claude image+PDF caps. */
21
21
  supportedFormats?: readonly SupportedFileFormat[];
22
- /** Gateway-permitted generation parameters for this model. */
23
- permittedParameters?: string[];
22
+ /** Generation parameters the gateway rejects for this model and the harness must strip. */
23
+ excludedParameters?: string[];
24
+ /**
25
+ * How this model expects extended thinking to be requested on the wire
26
+ * (`'enabled'` for Claude 4.5, `'adaptive'` for 4.6+). Omit unless the
27
+ * harness's default thinking shape is wrong for this variant's gateway
28
+ * backend. See {@link Model.thinkingMode}.
29
+ */
30
+ thinkingMode?: ThinkingMode;
24
31
  /**
25
32
  * Extra HTTP headers to attach to chat requests for this model. Use for vendor
26
33
  * labels (`anthropic-version`, model-tag opt-in headers) only — reserved
@@ -42,8 +49,8 @@ export type ClaudeModelOverrides = {
42
49
  *
43
50
  * @example
44
51
  * ```ts
45
- * const model = createClaudeModel('llmgateway__BedrockAnthropicClaude48Opus', {
46
- * displayId: 'Claude Opus 4.8',
52
+ * const model = createClaudeModel('sfdc_ai__DefaultBedrockAnthropicClaude49Opus', {
53
+ * displayId: 'Claude Opus 4.9',
47
54
  * maxInputTokens: 1_000_000,
48
55
  * contextWindow: 1_000_000,
49
56
  * maxOutputTokens: 128_000,
@@ -24,8 +24,8 @@ const DEFAULT_CLAUDE_SUPPORTED_FORMATS = [
24
24
  *
25
25
  * @example
26
26
  * ```ts
27
- * const model = createClaudeModel('llmgateway__BedrockAnthropicClaude48Opus', {
28
- * displayId: 'Claude Opus 4.8',
27
+ * const model = createClaudeModel('sfdc_ai__DefaultBedrockAnthropicClaude49Opus', {
28
+ * displayId: 'Claude Opus 4.9',
29
29
  * maxInputTokens: 1_000_000,
30
30
  * contextWindow: 1_000_000,
31
31
  * maxOutputTokens: 128_000,
@@ -44,7 +44,8 @@ class InlineClaudeModel extends Model {
44
44
  contextWindow;
45
45
  supportsPromptCache;
46
46
  supportedFormats;
47
- permittedParameters;
47
+ excludedParameters;
48
+ thinkingMode;
48
49
  customHeaders;
49
50
  constructor(gatewayId, overrides) {
50
51
  super();
@@ -55,7 +56,8 @@ class InlineClaudeModel extends Model {
55
56
  this.contextWindow = overrides.contextWindow ?? 200_000;
56
57
  this.supportsPromptCache = overrides.supportsPromptCache ?? true;
57
58
  this.supportedFormats = overrides.supportedFormats ?? DEFAULT_CLAUDE_SUPPORTED_FORMATS;
58
- this.permittedParameters = overrides.permittedParameters;
59
+ this.excludedParameters = overrides.excludedParameters;
60
+ this.thinkingMode = overrides.thinkingMode;
59
61
  this.customHeaders = overrides.customHeaders;
60
62
  }
61
63
  }
@@ -4,7 +4,7 @@ import { type SupportedFileFormat } from './types.js';
4
4
  * GPT-5.1 on the geo-aware `sfdc_ai__Default*` gateway route — routes to the
5
5
  * OpenAI Responses wire shape (Mastra harness). See W-23256760.
6
6
  */
7
- export declare class GPT51Geo extends Model {
7
+ export declare class GPT51 extends Model {
8
8
  readonly name: ModelName;
9
9
  readonly displayId: string;
10
10
  readonly maxInputTokens: number;
@@ -8,9 +8,9 @@ import { MimeType } from './types.js';
8
8
  * GPT-5.1 on the geo-aware `sfdc_ai__Default*` gateway route — routes to the
9
9
  * OpenAI Responses wire shape (Mastra harness). See W-23256760.
10
10
  */
11
- export class GPT51Geo extends Model {
12
- name = ModelName.GPT_5_1_GEO;
13
- displayId = 'GPT-5.1 (geo-aware)';
11
+ export class GPT51 extends Model {
12
+ name = ModelName.GPT_5_1;
13
+ displayId = 'GPT-5.1';
14
14
  // source of truth: https://git.soma.salesforce.com/a360/file-metadata/blob/master/fm-model-config/src/main/resources/ai/file-metadata/model/openai/llmgateway/OpenAIGPT51.yml
15
15
  maxInputTokens = 272000;
16
16
  maxOutputTokens = 128000;
@@ -22,4 +22,4 @@ export class GPT51Geo extends Model {
22
22
  { name: 'pdf', mimeType: MimeType.Pdf },
23
23
  ];
24
24
  }
25
- //# sourceMappingURL=gpt-5-1-geo.js.map
25
+ //# sourceMappingURL=gpt-5-1.js.map
@@ -4,7 +4,7 @@ import { type SupportedFileFormat } from './types.js';
4
4
  * GPT-5.2 on the geo-aware `sfdc_ai__Default*` gateway route — routes to the
5
5
  * OpenAI Responses wire shape (Mastra harness). See W-23256760.
6
6
  */
7
- export declare class GPT52Geo extends Model {
7
+ export declare class GPT52 extends Model {
8
8
  readonly name: ModelName;
9
9
  readonly displayId: string;
10
10
  readonly maxInputTokens: number;
@@ -8,9 +8,9 @@ import { MimeType } from './types.js';
8
8
  * GPT-5.2 on the geo-aware `sfdc_ai__Default*` gateway route — routes to the
9
9
  * OpenAI Responses wire shape (Mastra harness). See W-23256760.
10
10
  */
11
- export class GPT52Geo extends Model {
12
- name = ModelName.GPT_5_2_GEO;
13
- displayId = 'GPT-5.2 (geo-aware)';
11
+ export class GPT52 extends Model {
12
+ name = ModelName.GPT_5_2;
13
+ displayId = 'GPT-5.2';
14
14
  maxInputTokens = 272000;
15
15
  maxOutputTokens = 128000;
16
16
  contextWindow = 272000;
@@ -21,4 +21,4 @@ export class GPT52Geo extends Model {
21
21
  { name: 'pdf', mimeType: MimeType.Pdf },
22
22
  ];
23
23
  }
24
- //# sourceMappingURL=gpt-5-2-geo.js.map
24
+ //# sourceMappingURL=gpt-5-2.js.map
@@ -1,5 +1,10 @@
1
1
  import { Model, ModelName } from './model.js';
2
2
  import { type SupportedFileFormat } from './types.js';
3
+ /**
4
+ * GPT-5.4 on the geo-aware `sfdc_ai__DefaultGPT54` gateway route — routes to the
5
+ * OpenAI Responses wire shape (Mastra harness). The pinned `llmgateway__OpenAIGPT54`
6
+ * route was collapsed onto this geo id (W-23256760).
7
+ */
3
8
  export declare class GPT54 extends Model {
4
9
  readonly name: ModelName;
5
10
  readonly displayId: string;
@@ -4,6 +4,11 @@
4
4
  */
5
5
  import { Model, ModelName } from './model.js';
6
6
  import { MimeType } from './types.js';
7
+ /**
8
+ * GPT-5.4 on the geo-aware `sfdc_ai__DefaultGPT54` gateway route — routes to the
9
+ * OpenAI Responses wire shape (Mastra harness). The pinned `llmgateway__OpenAIGPT54`
10
+ * route was collapsed onto this geo id (W-23256760).
11
+ */
7
12
  export class GPT54 extends Model {
8
13
  name = ModelName.GPT_5_4;
9
14
  displayId = 'GPT-5.4';
@@ -1,5 +1,10 @@
1
1
  import { Model, ModelName } from './model.js';
2
2
  import { type SupportedFileFormat } from './types.js';
3
+ /**
4
+ * GPT-5 on the geo-aware `sfdc_ai__DefaultGPT5` gateway route — routes to the
5
+ * OpenAI Responses wire shape (Mastra harness). The pinned `llmgateway__OpenAIGPT5`
6
+ * route was collapsed onto this geo id (W-23256760).
7
+ */
3
8
  export declare class GPT5 extends Model {
4
9
  readonly name: ModelName;
5
10
  readonly displayId: string;
@@ -4,6 +4,11 @@
4
4
  */
5
5
  import { Model, ModelName } from './model.js';
6
6
  import { MimeType } from './types.js';
7
+ /**
8
+ * GPT-5 on the geo-aware `sfdc_ai__DefaultGPT5` gateway route — routes to the
9
+ * OpenAI Responses wire shape (Mastra harness). The pinned `llmgateway__OpenAIGPT5`
10
+ * route was collapsed onto this geo id (W-23256760).
11
+ */
7
12
  export class GPT5 extends Model {
8
13
  name = ModelName.GPT_5;
9
14
  displayId = 'GPT-5';
@@ -1,14 +1,12 @@
1
1
  import { Model, ModelName } from './model.js';
2
- export { Model, ModelName } from './model.js';
2
+ export { Model, ModelName, type ThinkingMode } from './model.js';
3
3
  export { MimeType, type SupportedFileFormat, type MultimodalFile } from './types.js';
4
4
  export { validateMultimodalFiles, MAX_FILES_PER_REQUEST, MAX_TOTAL_FILE_BYTES } from './multimodal.js';
5
5
  export { GPT5 } from './gpt-5.js';
6
+ export { GPT51 } from './gpt-5-1.js';
7
+ export { GPT52 } from './gpt-5-2.js';
6
8
  export { GPT54 } from './gpt-5-4.js';
7
9
  export { GPT55 } from './gpt-5-5.js';
8
- export { GPT5Geo } from './gpt-5-geo.js';
9
- export { GPT51Geo } from './gpt-5-1-geo.js';
10
- export { GPT52Geo } from './gpt-5-2-geo.js';
11
- export { GPT54Geo } from './gpt-5-4-geo.js';
12
10
  export { ClaudeSonnet45 } from './claude-sonnet-4-5.js';
13
11
  export { ClaudeSonnet46 } from './claude-sonnet-4-6.js';
14
12
  export { ClaudeOpus45 } from './claude-opus-4-5.js';
@@ -16,6 +14,16 @@ export { ClaudeOpus46 } from './claude-opus-4-6.js';
16
14
  export { ClaudeOpus47 } from './claude-opus-4-7.js';
17
15
  export { ClaudeOpus48 } from './claude-opus-4-8.js';
18
16
  export { createClaudeModel, type ClaudeModelOverrides } from './create-claude-model.js';
17
+ /**
18
+ * Legacy pinned wire-ids that predate the geo-aware `sfdc_ai__Default*` rename,
19
+ * mapped to their canonical {@link ModelName}. Consulted by {@link getByName} so an
20
+ * `AgentConfig` persisted before the rename still resolves to the current in-tree
21
+ * model — with canonical caps and prototype — instead of throwing on restore.
22
+ *
23
+ * Only the pinned ids that were REPLACED need entries; the geo GPT ids
24
+ * (`sfdc_ai__DefaultGPT5` etc.) are already live `ModelName` values.
25
+ */
26
+ export declare const LEGACY_MODEL_ID_ALIASES: Readonly<Record<string, ModelName>>;
19
27
  export declare function getDefault(): Model;
20
28
  export declare function getByName(modelName: ModelName): Model;
21
29
  export declare const Models: {
@@ -4,12 +4,10 @@
4
4
  */
5
5
  import { Model, ModelName } from './model.js';
6
6
  import { GPT5 } from './gpt-5.js';
7
+ import { GPT51 } from './gpt-5-1.js';
8
+ import { GPT52 } from './gpt-5-2.js';
7
9
  import { GPT54 } from './gpt-5-4.js';
8
10
  import { GPT55 } from './gpt-5-5.js';
9
- import { GPT5Geo } from './gpt-5-geo.js';
10
- import { GPT51Geo } from './gpt-5-1-geo.js';
11
- import { GPT52Geo } from './gpt-5-2-geo.js';
12
- import { GPT54Geo } from './gpt-5-4-geo.js';
13
11
  import { ClaudeSonnet45 } from './claude-sonnet-4-5.js';
14
12
  import { ClaudeSonnet46 } from './claude-sonnet-4-6.js';
15
13
  import { ClaudeOpus45 } from './claude-opus-4-5.js';
@@ -20,12 +18,10 @@ export { Model, ModelName } from './model.js';
20
18
  export { MimeType } from './types.js';
21
19
  export { validateMultimodalFiles, MAX_FILES_PER_REQUEST, MAX_TOTAL_FILE_BYTES } from './multimodal.js';
22
20
  export { GPT5 } from './gpt-5.js';
21
+ export { GPT51 } from './gpt-5-1.js';
22
+ export { GPT52 } from './gpt-5-2.js';
23
23
  export { GPT54 } from './gpt-5-4.js';
24
24
  export { GPT55 } from './gpt-5-5.js';
25
- export { GPT5Geo } from './gpt-5-geo.js';
26
- export { GPT51Geo } from './gpt-5-1-geo.js';
27
- export { GPT52Geo } from './gpt-5-2-geo.js';
28
- export { GPT54Geo } from './gpt-5-4-geo.js';
29
25
  export { ClaudeSonnet45 } from './claude-sonnet-4-5.js';
30
26
  export { ClaudeSonnet46 } from './claude-sonnet-4-6.js';
31
27
  export { ClaudeOpus45 } from './claude-opus-4-5.js';
@@ -33,35 +29,53 @@ export { ClaudeOpus46 } from './claude-opus-4-6.js';
33
29
  export { ClaudeOpus47 } from './claude-opus-4-7.js';
34
30
  export { ClaudeOpus48 } from './claude-opus-4-8.js';
35
31
  export { createClaudeModel } from './create-claude-model.js';
32
+ /**
33
+ * Legacy pinned wire-ids that predate the geo-aware `sfdc_ai__Default*` rename,
34
+ * mapped to their canonical {@link ModelName}. Consulted by {@link getByName} so an
35
+ * `AgentConfig` persisted before the rename still resolves to the current in-tree
36
+ * model — with canonical caps and prototype — instead of throwing on restore.
37
+ *
38
+ * Only the pinned ids that were REPLACED need entries; the geo GPT ids
39
+ * (`sfdc_ai__DefaultGPT5` etc.) are already live `ModelName` values.
40
+ */
41
+ export const LEGACY_MODEL_ID_ALIASES = {
42
+ llmgateway__OpenAIGPT5: ModelName.GPT_5,
43
+ llmgateway__OpenAIGPT54: ModelName.GPT_5_4,
44
+ llmgateway__OpenAIGPT55: ModelName.GPT_5_5,
45
+ llmgateway__BedrockAnthropicClaude45Sonnet: ModelName.CLAUDE_SONNET_4_5,
46
+ llmgateway__BedrockAnthropicClaude46Sonnet: ModelName.CLAUDE_SONNET_4_6,
47
+ llmgateway__BedrockAnthropicClaude45Opus: ModelName.CLAUDE_OPUS_4_5,
48
+ llmgateway__BedrockAnthropicClaude46Opus: ModelName.CLAUDE_OPUS_4_6,
49
+ llmgateway__BedrockAnthropicClaude47Opus: ModelName.CLAUDE_OPUS_4_7,
50
+ llmgateway__BedrockAnthropicClaude48Opus: ModelName.CLAUDE_OPUS_4_8,
51
+ };
36
52
  export function getDefault() {
37
53
  return new ClaudeSonnet46();
38
54
  }
39
55
  export function getByName(modelName) {
40
- if (modelName === ModelName.GPT_5)
56
+ // Map a legacy pinned id to its canonical member; leave canonical ids untouched.
57
+ const canonical = LEGACY_MODEL_ID_ALIASES[modelName] ?? modelName;
58
+ if (canonical === ModelName.GPT_5)
41
59
  return new GPT5();
42
- if (modelName === ModelName.GPT_5_4)
60
+ if (canonical === ModelName.GPT_5_1)
61
+ return new GPT51();
62
+ if (canonical === ModelName.GPT_5_2)
63
+ return new GPT52();
64
+ if (canonical === ModelName.GPT_5_4)
43
65
  return new GPT54();
44
- if (modelName === ModelName.GPT_5_5)
66
+ if (canonical === ModelName.GPT_5_5)
45
67
  return new GPT55();
46
- if (modelName === ModelName.GPT_5_GEO)
47
- return new GPT5Geo();
48
- if (modelName === ModelName.GPT_5_1_GEO)
49
- return new GPT51Geo();
50
- if (modelName === ModelName.GPT_5_2_GEO)
51
- return new GPT52Geo();
52
- if (modelName === ModelName.GPT_5_4_GEO)
53
- return new GPT54Geo();
54
- if (modelName === ModelName.CLAUDE_SONNET_4_5)
68
+ if (canonical === ModelName.CLAUDE_SONNET_4_5)
55
69
  return new ClaudeSonnet45();
56
- if (modelName === ModelName.CLAUDE_SONNET_4_6)
70
+ if (canonical === ModelName.CLAUDE_SONNET_4_6)
57
71
  return new ClaudeSonnet46();
58
- if (modelName === ModelName.CLAUDE_OPUS_4_5)
72
+ if (canonical === ModelName.CLAUDE_OPUS_4_5)
59
73
  return new ClaudeOpus45();
60
- if (modelName === ModelName.CLAUDE_OPUS_4_6)
74
+ if (canonical === ModelName.CLAUDE_OPUS_4_6)
61
75
  return new ClaudeOpus46();
62
- if (modelName === ModelName.CLAUDE_OPUS_4_7)
76
+ if (canonical === ModelName.CLAUDE_OPUS_4_7)
63
77
  return new ClaudeOpus47();
64
- if (modelName === ModelName.CLAUDE_OPUS_4_8)
78
+ if (canonical === ModelName.CLAUDE_OPUS_4_8)
65
79
  return new ClaudeOpus48();
66
80
  throw new Error(`No model mapping exists for "${modelName}".`);
67
81
  }
@@ -1,6 +1,32 @@
1
1
  import type { SupportedFileFormat } from './types.js';
2
+ /**
3
+ * How a model expects extended-thinking / reasoning to be requested on the wire.
4
+ * Mirrors the Anthropic thinking-config discriminator:
5
+ *
6
+ * - `'enabled'` — the legacy fixed-budget shape (`thinking.type: "enabled"`).
7
+ * Required by the Bedrock-Anthropic Claude 4.5 generation; the 4.6+ backends
8
+ * reject it.
9
+ * - `'adaptive'` — the newer "model decides how much to think" shape
10
+ * (`thinking.type: "adaptive"`). Required by Claude Opus 4.6+ / Sonnet 4.6+;
11
+ * the 4.5 backends reject it.
12
+ * - `'disabled'` — no extended thinking.
13
+ *
14
+ * The two shapes are NOT interchangeable across model versions — see
15
+ * {@link Model.thinkingMode}.
16
+ */
17
+ export type ThinkingMode = 'enabled' | 'adaptive' | 'disabled';
2
18
  /**
3
19
  * The canonical Salesforce LLM-Gateway model ids the SDK ships in-tree.
20
+ *
21
+ * The ids use the geo-aware `sfdc_ai__Default*` prefix: the gateway resolves
22
+ * the regional deployment for data-residency, latency, and failover, rather
23
+ * than pinning a single deployment. This replaced the older pinned
24
+ * `llmgateway__*` prefix, which the gateway advised against because it may not
25
+ * honor fallback (W-23256760). The pinned OpenAI + geo OpenAI members that used
26
+ * to coexist were collapsed onto their single geo id. Legacy pinned strings
27
+ * still resolve via {@link Models.getByName} through a back-compat alias map so
28
+ * persisted `AgentConfig`s keep restoring.
29
+ *
4
30
  * Consumer-built variants via {@link createClaudeModel} carry an arbitrary
5
31
  * gateway id string (the escape hatch for Bedrock-Anthropic Claude
6
32
  * variants the SDK has not released yet); cross-harness code that
@@ -10,19 +36,17 @@ import type { SupportedFileFormat } from './types.js';
10
36
  * silently miss escape-hatch ids.
11
37
  */
12
38
  export declare enum ModelName {
13
- GPT_5 = "llmgateway__OpenAIGPT5",
14
- GPT_5_4 = "llmgateway__OpenAIGPT54",
15
- GPT_5_5 = "llmgateway__OpenAIGPT55",
16
- GPT_5_GEO = "sfdc_ai__DefaultGPT5",
17
- GPT_5_1_GEO = "sfdc_ai__DefaultGPT51",
18
- GPT_5_2_GEO = "sfdc_ai__DefaultGPT52",
19
- GPT_5_4_GEO = "sfdc_ai__DefaultGPT54",
20
- CLAUDE_SONNET_4_5 = "llmgateway__BedrockAnthropicClaude45Sonnet",
21
- CLAUDE_SONNET_4_6 = "llmgateway__BedrockAnthropicClaude46Sonnet",
22
- CLAUDE_OPUS_4_5 = "llmgateway__BedrockAnthropicClaude45Opus",
23
- CLAUDE_OPUS_4_6 = "llmgateway__BedrockAnthropicClaude46Opus",
24
- CLAUDE_OPUS_4_7 = "llmgateway__BedrockAnthropicClaude47Opus",
25
- CLAUDE_OPUS_4_8 = "llmgateway__BedrockAnthropicClaude48Opus"
39
+ GPT_5 = "sfdc_ai__DefaultGPT5",
40
+ GPT_5_1 = "sfdc_ai__DefaultGPT51",
41
+ GPT_5_2 = "sfdc_ai__DefaultGPT52",
42
+ GPT_5_4 = "sfdc_ai__DefaultGPT54",
43
+ GPT_5_5 = "sfdc_ai__DefaultGPT55",
44
+ CLAUDE_SONNET_4_5 = "sfdc_ai__DefaultBedrockAnthropicClaude45Sonnet",
45
+ CLAUDE_SONNET_4_6 = "sfdc_ai__DefaultBedrockAnthropicClaude46Sonnet",
46
+ CLAUDE_OPUS_4_5 = "sfdc_ai__DefaultBedrockAnthropicClaude45Opus",
47
+ CLAUDE_OPUS_4_6 = "sfdc_ai__DefaultBedrockAnthropicClaude46Opus",
48
+ CLAUDE_OPUS_4_7 = "sfdc_ai__DefaultBedrockAnthropicClaude47Opus",
49
+ CLAUDE_OPUS_4_8 = "sfdc_ai__DefaultBedrockAnthropicClaude48Opus"
26
50
  }
27
51
  /**
28
52
  * Abstract description of a model the SDK / harness can talk to. Used for:
@@ -55,7 +79,34 @@ export declare abstract class Model {
55
79
  * empty array means the model is text-only.
56
80
  */
57
81
  abstract readonly supportedFormats: readonly SupportedFileFormat[];
58
- readonly permittedParameters?: string[];
82
+ /**
83
+ * Denylist of generation parameters the LLM Gateway rejects for this
84
+ * model. Harnesses consult it before forwarding a generation parameter —
85
+ * currently only `temperature`, which the gateway deprecated for Claude
86
+ * Opus 4.7+ and now rejects. A model that lists a parameter here has it
87
+ * stripped from the outbound request.
88
+ *
89
+ * `undefined` (the default) means nothing is excluded: every parameter the
90
+ * harness would send is forwarded. Set it only for models that must
91
+ * suppress a parameter the gateway no longer accepts.
92
+ */
93
+ readonly excludedParameters?: string[];
94
+ /**
95
+ * How this model expects extended thinking to be requested on the wire, when
96
+ * a harness that drives reasoning models (e.g. the Claude harness) would
97
+ * otherwise send a thinking config. The two Anthropic shapes are not
98
+ * interchangeable across model generations — the Bedrock-Anthropic backend
99
+ * rejects `thinking.type: "enabled"` for Claude 4.6+ and rejects
100
+ * `thinking.type: "adaptive"` for Claude 4.5 — so the accepted shape is a
101
+ * per-model property the harness must consult rather than assume.
102
+ *
103
+ * `undefined` (the default) means the harness uses whatever thinking config
104
+ * it would natively send (for the Claude harness, the bundled CLI's per-model
105
+ * default). Set it only for models where that default is wrong for the
106
+ * gateway — currently the in-tree Claude models, which pin `'enabled'` (4.5)
107
+ * or `'adaptive'` (4.6+).
108
+ */
109
+ readonly thinkingMode?: ThinkingMode;
59
110
  /**
60
111
  * Vendor-specific HTTP headers to add to every outbound request for this model
61
112
  * (e.g. `anthropic-version`, model-tag opt-in headers). Merged with the
@@ -4,6 +4,16 @@
4
4
  */
5
5
  /**
6
6
  * The canonical Salesforce LLM-Gateway model ids the SDK ships in-tree.
7
+ *
8
+ * The ids use the geo-aware `sfdc_ai__Default*` prefix: the gateway resolves
9
+ * the regional deployment for data-residency, latency, and failover, rather
10
+ * than pinning a single deployment. This replaced the older pinned
11
+ * `llmgateway__*` prefix, which the gateway advised against because it may not
12
+ * honor fallback (W-23256760). The pinned OpenAI + geo OpenAI members that used
13
+ * to coexist were collapsed onto their single geo id. Legacy pinned strings
14
+ * still resolve via {@link Models.getByName} through a back-compat alias map so
15
+ * persisted `AgentConfig`s keep restoring.
16
+ *
7
17
  * Consumer-built variants via {@link createClaudeModel} carry an arbitrary
8
18
  * gateway id string (the escape hatch for Bedrock-Anthropic Claude
9
19
  * variants the SDK has not released yet); cross-harness code that
@@ -14,22 +24,17 @@
14
24
  */
15
25
  export var ModelName;
16
26
  (function (ModelName) {
17
- ModelName["GPT_5"] = "llmgateway__OpenAIGPT5";
18
- ModelName["GPT_5_4"] = "llmgateway__OpenAIGPT54";
19
- ModelName["GPT_5_5"] = "llmgateway__OpenAIGPT55";
20
- // Geo-aware `sfdc_ai__Default*` route: the gateway selects the regional
21
- // OpenAI deployment. Distinct ids from the pinned `llmgateway__OpenAIGPT*`
22
- // entries above so both routings coexist (W-23256760).
23
- ModelName["GPT_5_GEO"] = "sfdc_ai__DefaultGPT5";
24
- ModelName["GPT_5_1_GEO"] = "sfdc_ai__DefaultGPT51";
25
- ModelName["GPT_5_2_GEO"] = "sfdc_ai__DefaultGPT52";
26
- ModelName["GPT_5_4_GEO"] = "sfdc_ai__DefaultGPT54";
27
- ModelName["CLAUDE_SONNET_4_5"] = "llmgateway__BedrockAnthropicClaude45Sonnet";
28
- ModelName["CLAUDE_SONNET_4_6"] = "llmgateway__BedrockAnthropicClaude46Sonnet";
29
- ModelName["CLAUDE_OPUS_4_5"] = "llmgateway__BedrockAnthropicClaude45Opus";
30
- ModelName["CLAUDE_OPUS_4_6"] = "llmgateway__BedrockAnthropicClaude46Opus";
31
- ModelName["CLAUDE_OPUS_4_7"] = "llmgateway__BedrockAnthropicClaude47Opus";
32
- ModelName["CLAUDE_OPUS_4_8"] = "llmgateway__BedrockAnthropicClaude48Opus";
27
+ ModelName["GPT_5"] = "sfdc_ai__DefaultGPT5";
28
+ ModelName["GPT_5_1"] = "sfdc_ai__DefaultGPT51";
29
+ ModelName["GPT_5_2"] = "sfdc_ai__DefaultGPT52";
30
+ ModelName["GPT_5_4"] = "sfdc_ai__DefaultGPT54";
31
+ ModelName["GPT_5_5"] = "sfdc_ai__DefaultGPT55";
32
+ ModelName["CLAUDE_SONNET_4_5"] = "sfdc_ai__DefaultBedrockAnthropicClaude45Sonnet";
33
+ ModelName["CLAUDE_SONNET_4_6"] = "sfdc_ai__DefaultBedrockAnthropicClaude46Sonnet";
34
+ ModelName["CLAUDE_OPUS_4_5"] = "sfdc_ai__DefaultBedrockAnthropicClaude45Opus";
35
+ ModelName["CLAUDE_OPUS_4_6"] = "sfdc_ai__DefaultBedrockAnthropicClaude46Opus";
36
+ ModelName["CLAUDE_OPUS_4_7"] = "sfdc_ai__DefaultBedrockAnthropicClaude47Opus";
37
+ ModelName["CLAUDE_OPUS_4_8"] = "sfdc_ai__DefaultBedrockAnthropicClaude48Opus";
33
38
  })(ModelName || (ModelName = {}));
34
39
  /**
35
40
  * Abstract description of a model the SDK / harness can talk to. Used for:
@@ -51,7 +56,34 @@ export var ModelName;
51
56
  * Reference: https://docs.internal.salesforce.com/ai/einstein/gateway/models-and-providers/
52
57
  */
53
58
  export class Model {
54
- permittedParameters;
59
+ /**
60
+ * Denylist of generation parameters the LLM Gateway rejects for this
61
+ * model. Harnesses consult it before forwarding a generation parameter —
62
+ * currently only `temperature`, which the gateway deprecated for Claude
63
+ * Opus 4.7+ and now rejects. A model that lists a parameter here has it
64
+ * stripped from the outbound request.
65
+ *
66
+ * `undefined` (the default) means nothing is excluded: every parameter the
67
+ * harness would send is forwarded. Set it only for models that must
68
+ * suppress a parameter the gateway no longer accepts.
69
+ */
70
+ excludedParameters;
71
+ /**
72
+ * How this model expects extended thinking to be requested on the wire, when
73
+ * a harness that drives reasoning models (e.g. the Claude harness) would
74
+ * otherwise send a thinking config. The two Anthropic shapes are not
75
+ * interchangeable across model generations — the Bedrock-Anthropic backend
76
+ * rejects `thinking.type: "enabled"` for Claude 4.6+ and rejects
77
+ * `thinking.type: "adaptive"` for Claude 4.5 — so the accepted shape is a
78
+ * per-model property the harness must consult rather than assume.
79
+ *
80
+ * `undefined` (the default) means the harness uses whatever thinking config
81
+ * it would natively send (for the Claude harness, the bundled CLI's per-model
82
+ * default). Set it only for models where that default is wrong for the
83
+ * gateway — currently the in-tree Claude models, which pin `'enabled'` (4.5)
84
+ * or `'adaptive'` (4.6+).
85
+ */
86
+ thinkingMode;
55
87
  /**
56
88
  * Vendor-specific HTTP headers to add to every outbound request for this model
57
89
  * (e.g. `anthropic-version`, model-tag opt-in headers). Merged with the
@@ -36,8 +36,10 @@ export type ResolverTiers = {
36
36
  /** Harness-shipped built-in rules (e.g. `MASTRA_BUILT_IN_TOOL_POLICIES`). */
37
37
  harness?: ReadonlyArray<ToolPolicyRule>;
38
38
  /**
39
- * Synthetic rules from harness factory inputs during a deprecation window.
40
- * Today: Claude's `bypassApprovalTools` translation. Empty after Phase 4.
39
+ * Reserved slot for synthetic rules a harness factory injects between the
40
+ * harness built-ins and the consumer's `toolPolicies`. No harness populates
41
+ * it today; it is kept so a future factory-injected tier can slot in
42
+ * without reshaping the resolver signature or the concatenation order.
41
43
  */
42
44
  factory?: ReadonlyArray<ToolPolicyRule>;
43
45
  };
@@ -21,8 +21,8 @@ import type { McpToolAnnotations } from '../mcp-config.js';
21
21
  * For harness-executed (native) tools such as MCP tools, use
22
22
  * `AgentConfig.mcpServers` — those run in the harness and never need
23
23
  * `submitToolResult`. To gate harness-executed tool calls with human approval,
24
- * use `StreamOptions.requireToolApproval` plus `approveToolCall` /
25
- * `declineToolCall`.
24
+ * configure `AgentConfig.toolPolicies` / `AgentConfig.defaultToolDecision`
25
+ * plus `approveToolCall` / `declineToolCall`.
26
26
  *
27
27
  * Structurally compatible with AI SDK `LanguageModelV4FunctionTool`.
28
28
  */