@salesforce/sfdx-agent-sdk 0.21.0 → 0.22.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 (59) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +12 -11
  3. package/dist/agent-connectivity-resolver.d.ts +47 -25
  4. package/dist/agent-connectivity-resolver.js +92 -15
  5. package/dist/agent-manager.d.ts +17 -1
  6. package/dist/agent-manager.js +40 -7
  7. package/dist/agent.d.ts +33 -10
  8. package/dist/agent.js +38 -50
  9. package/dist/api-key-connectivity-resolver.d.ts +110 -0
  10. package/dist/api-key-connectivity-resolver.js +114 -0
  11. package/dist/errors.d.ts +1 -0
  12. package/dist/errors.js +1 -0
  13. package/dist/harness/agent-harness.d.ts +27 -5
  14. package/dist/harness/harness-bus-owner.d.ts +17 -0
  15. package/dist/harness/harness-bus-owner.js +27 -0
  16. package/dist/harness/harness-config.d.ts +3 -2
  17. package/dist/harness/harness-factory.d.ts +13 -0
  18. package/dist/harness/stream-input.d.ts +9 -5
  19. package/dist/harness/stream-input.js +12 -14
  20. package/dist/index.d.ts +8 -2
  21. package/dist/index.js +4 -1
  22. package/dist/internal/wire-communication-router.d.ts +43 -0
  23. package/dist/internal/wire-communication-router.js +119 -0
  24. package/dist/mcp-auth.d.ts +1 -1
  25. package/dist/models/claude-opus-4-5.d.ts +11 -0
  26. package/dist/models/claude-opus-4-5.js +21 -0
  27. package/dist/models/claude-opus-4-6.d.ts +11 -0
  28. package/dist/models/claude-opus-4-6.js +22 -0
  29. package/dist/models/claude-opus-4-7.d.ts +11 -0
  30. package/dist/models/claude-opus-4-7.js +22 -0
  31. package/dist/models/claude-sonnet-4-5.d.ts +11 -0
  32. package/dist/models/claude-sonnet-4-5.js +23 -0
  33. package/dist/models/claude-sonnet-4-6.d.ts +11 -0
  34. package/dist/models/claude-sonnet-4-6.js +22 -0
  35. package/dist/models/create-claude-model.d.ts +54 -0
  36. package/dist/models/create-claude-model.js +62 -0
  37. package/dist/models/gpt-5-4.d.ts +11 -0
  38. package/dist/models/gpt-5-4.js +21 -0
  39. package/dist/models/gpt-5-5.d.ts +15 -0
  40. package/dist/models/gpt-5-5.js +24 -0
  41. package/dist/models/gpt-5.d.ts +11 -0
  42. package/dist/models/gpt-5.js +23 -0
  43. package/dist/models/index.d.ts +19 -0
  44. package/dist/models/index.js +49 -0
  45. package/dist/models/model.d.ts +69 -0
  46. package/dist/models/model.js +63 -0
  47. package/dist/models/multimodal.d.ts +35 -0
  48. package/dist/models/multimodal.js +78 -0
  49. package/dist/models/types.d.ts +49 -0
  50. package/dist/models/types.js +18 -0
  51. package/dist/types/index.d.ts +1 -0
  52. package/dist/types/model-connectivity-info.d.ts +87 -0
  53. package/dist/types/model-connectivity-info.js +6 -0
  54. package/dist/types/usage.d.ts +3 -3
  55. package/dist/types/wire-communication-event.d.ts +124 -0
  56. package/dist/types/wire-communication-event.js +6 -0
  57. package/dist/wire-communication-file-writer.d.ts +39 -0
  58. package/dist/wire-communication-file-writer.js +142 -0
  59. package/package.json +7 -8
@@ -2,7 +2,6 @@
2
2
  * Copyright 2026, Salesforce, Inc. All rights reserved.
3
3
  * See LICENSE.txt for license terms.
4
4
  */
5
- import { LLMGClientError } from '@salesforce/llm-gateway-sdk';
6
5
  import { AgentSDKError, AgentSDKErrorType } from '../errors.js';
7
6
  /**
8
7
  * Shared `MessagePart[]` validation + lowering for `AgentHarness.stream()` implementations. Every
@@ -13,8 +12,10 @@ import { AgentSDKError, AgentSDKErrorType } from '../errors.js';
13
12
  *
14
13
  * Order of operations:
15
14
  * 1. Collect `image` / `file` parts into a {@link MultimodalFile} list and hand them to
16
- * `validateFiles` (per-model + global gateway caps). An {@link LLMGClientError} is mapped to
17
- * `AgentSDKError(MULTIMODAL_NOT_SUPPORTED)`; any other throw propagates unchanged.
15
+ * `validateFiles` (per-model + global gateway caps). The standard
16
+ * {@link validateMultimodalFiles} helper throws
17
+ * `AgentSDKError(MULTIMODAL_NOT_SUPPORTED)` directly on a cap/format violation; any other
18
+ * throw propagates unchanged.
18
19
  * 2. Lower each part via `mapPart`. A `reasoning` / `tool-call` / `tool-result` part is not valid
19
20
  * stream input and throws `AgentSDKError(INVALID_MESSAGE_CONTENT)` before `mapPart` sees it.
20
21
  *
@@ -23,8 +24,10 @@ import { AgentSDKError, AgentSDKErrorType } from '../errors.js';
23
24
  * failure rejects the harness's `stream()` promise pre-stream rather than mid-iteration.
24
25
  *
25
26
  * @param parts - the user message parts to validate and lower.
26
- * @param validateFiles - per-harness file validation (e.g. `validateMultimodalFiles(files, model)`)
27
- * that throws `LLMGClientError` on a cap/format violation and no-ops for text-only input.
27
+ * @param validateFiles - per-harness file validation (typically
28
+ * `(files) => validateMultimodalFiles(files, model)`) that throws
29
+ * `AgentSDKError(MULTIMODAL_NOT_SUPPORTED)` on a cap/format violation and no-ops for text-only
30
+ * input.
28
31
  * @param mapPart - lowers one validated input part into the harness's content-block shape.
29
32
  * @returns the lowered blocks, in the original part order.
30
33
  */
@@ -35,15 +38,10 @@ export function lowerStreamInput(parts, validateFiles, mapPart) {
35
38
  files.push({ mimeType: part.mimeType, data: part.data });
36
39
  }
37
40
  }
38
- try {
39
- validateFiles(files);
40
- }
41
- catch (err) {
42
- if (err instanceof LLMGClientError) {
43
- throw new AgentSDKError(err.message, AgentSDKErrorType.MULTIMODAL_NOT_SUPPORTED, { cause: err });
44
- }
45
- throw err;
46
- }
41
+ // validateFiles is expected to throw AgentSDKError(MULTIMODAL_NOT_SUPPORTED) directly
42
+ // on a cap/format violation; harnesses pass `validateMultimodalFiles(files, model)`
43
+ // from this package, which already throws the typed error. Other throws propagate.
44
+ validateFiles(files);
47
45
  return parts.map((part) => {
48
46
  if (part.type === 'text' || part.type === 'image' || part.type === 'file') {
49
47
  return mapPart(part);
package/dist/index.d.ts CHANGED
@@ -7,17 +7,23 @@ export type { AgentConfig, HarnessAgentConfig, StreamOptions, ToolApprovalMode }
7
7
  export { DEFAULT_MAX_STEPS, resolveToolApprovalMode } from './harness/harness-config.js';
8
8
  export type { MCPConfiguration, MCPServerConfig, MCPStdioServerConfig, MCPRemoteServerConfig, McpServerInfo, McpServerErrorCategory, McpServerErrorDetail, McpToolInfo, McpToolAnnotations, } from './mcp-config.js';
9
9
  export { McpServerStatus, mcpServerConfigEqual } from './mcp-config.js';
10
- export { Model, ModelName, createClaudeModel } from '@salesforce/llm-gateway-sdk';
11
- export type { ClaudeModelOverrides } from '@salesforce/llm-gateway-sdk';
10
+ export { Model, ModelName, createClaudeModel, Models, validateMultimodalFiles } from './models/index.js';
11
+ export type { ClaudeModelOverrides, MultimodalFile, SupportedFileFormat } from './models/index.js';
12
+ export { MimeType } from './models/index.js';
12
13
  export { inferSfApiEnv, SfApiEnv } from '@salesforce/agentic-common';
13
14
  export { type AgentManager, type RestoreFailure, createAgentManager } from './agent-manager.js';
14
15
  export { type Agent } from './agent.js';
15
16
  export { type ChatSession, type ChatOptions } from './chat-session.js';
16
17
  export type { AgentConnectivityResolver, ResolvedConnectivity } from './agent-connectivity-resolver.js';
18
+ export { ApiKeyConnectivityResolver, type ApiKeyConnectivityResolverConfig } from './api-key-connectivity-resolver.js';
19
+ export type { ModelConnectivityInfo, ProviderHint } from './types/model-connectivity-info.js';
20
+ export type { LlmRequestEvent, LlmResponseEvent, WireCommunicationEvent, WireCommunicationEventCallback, WireMonitoringNotSupportedEvent, } from './types/wire-communication-event.js';
21
+ export { WireCommunicationFileWriter, type WireCommunicationEmitter, type WireCommunicationFileWriterOptions, } from './wire-communication-file-writer.js';
17
22
  export type { AgentHarness, HarnessFactory, WithAgentConfig, ConfigOf } from './harness/index.js';
18
23
  export { AgentSDKError, AgentSDKErrorType } from './errors.js';
19
24
  export type { AgentCreatedEvent, AgentDestroyedEvent, ChatStreamCompletedEvent, ChatStreamErrorEvent, ChatStreamStartedEvent, ChatStreamTrigger, McpServerDiscoveryCompletedEvent, McpServerDiscoveryFailedEvent, McpServerDiscoveryStartedEvent, McpServerStatusChangedEvent, SessionCreatedEvent, SessionDestroyedEvent, TelemetryEvent, TelemetryEventCallback, ToolApprovalRequestedEvent, ToolApprovalResolvedEvent, ToolExecutionCompletedEvent, ToolExecutionStartedEvent, } from './types/telemetry-events.js';
20
25
  export type { LogLevel, LogRecord, Unsubscribe } from '@salesforce/agentic-common';
21
26
  export { resolveMcpServerHeaders } from './mcp-auth.js';
22
27
  export type { OrgConnection, OrgConnectionFactory } from '@salesforce/agentic-common';
28
+ export type { JSONWebToken, JWTOptions, RequiredJWTHeaders, RequiredJWTPayload } from '@salesforce/agentic-common';
23
29
  export { Workspace } from './workspace.js';
package/dist/index.js CHANGED
@@ -4,12 +4,15 @@
4
4
  */
5
5
  export { DEFAULT_MAX_STEPS, resolveToolApprovalMode } from './harness/harness-config.js';
6
6
  export { McpServerStatus, mcpServerConfigEqual } from './mcp-config.js';
7
- export { Model, ModelName, createClaudeModel } from '@salesforce/llm-gateway-sdk';
7
+ export { Model, ModelName, createClaudeModel, Models, validateMultimodalFiles } from './models/index.js';
8
+ export { MimeType } from './models/index.js';
8
9
  export { inferSfApiEnv, SfApiEnv } from '@salesforce/agentic-common';
9
10
  // ── Agent Layer ─────────────────────────────────────────────────────
10
11
  export { createAgentManager } from './agent-manager.js';
11
12
  export {} from './agent.js';
12
13
  export {} from './chat-session.js';
14
+ export { ApiKeyConnectivityResolver } from './api-key-connectivity-resolver.js';
15
+ export { WireCommunicationFileWriter, } from './wire-communication-file-writer.js';
13
16
  // ── Errors ───────────────────────────────────────────────────────────
14
17
  export { AgentSDKError, AgentSDKErrorType } from './errors.js';
15
18
  // ── MCP Auth ────────────────────────────────────────────────────────
@@ -0,0 +1,43 @@
1
+ import { EventBus } from '@salesforce/agentic-common';
2
+ import type { AgentHarness } from '../harness/agent-harness.js';
3
+ import type { WireCommunicationEvent } from '../types/wire-communication-event.js';
4
+ /**
5
+ * A wire-communication bus scoped to a single agent, session, or the unrouted
6
+ * catch-all.
7
+ *
8
+ * Mirrors {@link TelemetrySlice} from `telemetry-router.ts` — `DefaultAgent`
9
+ * and `DefaultChatSession` receive their slice at construction time and
10
+ * wire `forwardTo()` from the slice bus into their own bus so wire events
11
+ * bubble upward through the hierarchy.
12
+ */
13
+ export type WireCommunicationSlice = {
14
+ readonly wire: EventBus<WireCommunicationEvent>;
15
+ };
16
+ /**
17
+ * Splits a harness's wire-communication stream into per-agent, per-session,
18
+ * and unrouted sub-streams. The shape mirrors {@link TelemetryRouter} so the
19
+ * three event channels (telemetry / log / wire-communication) all route
20
+ * through the same per-`agentId` / per-`threadId` keys.
21
+ *
22
+ * Wire-communication events do not currently carry routing fields on their
23
+ * public shape (the wire surface is kept minimal), so the harness is
24
+ * responsible for emitting the right event-pair on a slice that knows its
25
+ * agentId / threadId. This is the same pattern as `TelemetryRouter` for log
26
+ * records routed via `context.agentId` / `context.threadId`.
27
+ */
28
+ export declare class WireCommunicationRouter {
29
+ private readonly agentSlices;
30
+ private readonly sessionSlices;
31
+ private readonly unroutedSlice;
32
+ private readonly harnessUnsubs;
33
+ private disposed;
34
+ constructor(harness: Pick<AgentHarness, 'onWireCommunication'>);
35
+ get unrouted(): WireCommunicationSlice;
36
+ registerAgent(agentId: string): WireCommunicationSlice;
37
+ unregisterAgent(agentId: string): void;
38
+ registerSession(threadId: string): WireCommunicationSlice;
39
+ unregisterSession(threadId: string): void;
40
+ dispose(): void;
41
+ private routeEvent;
42
+ private static createSlice;
43
+ }
@@ -0,0 +1,119 @@
1
+ /*
2
+ * Copyright 2026, Salesforce, Inc. All rights reserved.
3
+ * See LICENSE.txt for license terms.
4
+ */
5
+ import { EventBus } from '@salesforce/agentic-common';
6
+ /**
7
+ * Splits a harness's wire-communication stream into per-agent, per-session,
8
+ * and unrouted sub-streams. The shape mirrors {@link TelemetryRouter} so the
9
+ * three event channels (telemetry / log / wire-communication) all route
10
+ * through the same per-`agentId` / per-`threadId` keys.
11
+ *
12
+ * Wire-communication events do not currently carry routing fields on their
13
+ * public shape (the wire surface is kept minimal), so the harness is
14
+ * responsible for emitting the right event-pair on a slice that knows its
15
+ * agentId / threadId. This is the same pattern as `TelemetryRouter` for log
16
+ * records routed via `context.agentId` / `context.threadId`.
17
+ */
18
+ export class WireCommunicationRouter {
19
+ agentSlices = new Map();
20
+ sessionSlices = new Map();
21
+ unroutedSlice;
22
+ harnessUnsubs = [];
23
+ disposed = false;
24
+ constructor(harness) {
25
+ this.unroutedSlice = WireCommunicationRouter.createSlice();
26
+ // Lazy bridge from the harness bus into the router's unrouted slice. We only attach the
27
+ // upstream `onWireCommunication` subscription while the slice has at least one downstream
28
+ // listener, and detach when it loses its last. Combined with the slice's own
29
+ // `forwardWhileSubscribed` link into `manager.wireBus`, this propagates
30
+ // "no consumer anywhere downstream" all the way back to the harness — the Claude harness
31
+ // reads `wireBus.listenerCount > 0` before each subprocess spawn and skips the expensive
32
+ // `ANTHROPIC_LOG=debug` env when nobody is listening.
33
+ let upstreamUnsub;
34
+ const attachUpstream = () => {
35
+ if (!upstreamUnsub) {
36
+ upstreamUnsub = harness.onWireCommunication((event) => this.routeEvent(event));
37
+ }
38
+ };
39
+ const detachUpstream = () => {
40
+ if (upstreamUnsub) {
41
+ upstreamUnsub();
42
+ upstreamUnsub = undefined;
43
+ }
44
+ };
45
+ const presenceUnsub = this.unroutedSlice.wire.onSubscriberPresenceChange((hasSubscribers) => {
46
+ if (hasSubscribers)
47
+ attachUpstream();
48
+ else
49
+ detachUpstream();
50
+ });
51
+ if (this.unroutedSlice.wire.listenerCount > 0) {
52
+ attachUpstream();
53
+ }
54
+ this.harnessUnsubs.push(presenceUnsub, () => detachUpstream());
55
+ }
56
+ get unrouted() {
57
+ return this.unroutedSlice;
58
+ }
59
+ registerAgent(agentId) {
60
+ let slice = this.agentSlices.get(agentId);
61
+ if (!slice) {
62
+ slice = WireCommunicationRouter.createSlice();
63
+ this.agentSlices.set(agentId, slice);
64
+ }
65
+ return slice;
66
+ }
67
+ unregisterAgent(agentId) {
68
+ const slice = this.agentSlices.get(agentId);
69
+ if (slice) {
70
+ slice.wire.dispose();
71
+ this.agentSlices.delete(agentId);
72
+ }
73
+ }
74
+ registerSession(threadId) {
75
+ let slice = this.sessionSlices.get(threadId);
76
+ if (!slice) {
77
+ slice = WireCommunicationRouter.createSlice();
78
+ this.sessionSlices.set(threadId, slice);
79
+ }
80
+ return slice;
81
+ }
82
+ unregisterSession(threadId) {
83
+ const slice = this.sessionSlices.get(threadId);
84
+ if (slice) {
85
+ slice.wire.dispose();
86
+ this.sessionSlices.delete(threadId);
87
+ }
88
+ }
89
+ dispose() {
90
+ if (this.disposed)
91
+ return;
92
+ this.disposed = true;
93
+ for (const unsub of this.harnessUnsubs)
94
+ unsub();
95
+ this.harnessUnsubs.length = 0;
96
+ for (const slice of this.agentSlices.values())
97
+ slice.wire.dispose();
98
+ this.agentSlices.clear();
99
+ for (const slice of this.sessionSlices.values())
100
+ slice.wire.dispose();
101
+ this.sessionSlices.clear();
102
+ this.unroutedSlice.wire.dispose();
103
+ }
104
+ routeEvent(event) {
105
+ if (this.disposed)
106
+ return;
107
+ // Public WireCommunicationEvent currently has no routing fields. Until
108
+ // that changes, every event lands on the unrouted slice; the
109
+ // manager-level subscriber sees them. Per-agent / per-session routing
110
+ // is plumbed for forward-compat — adding routing fields to the event
111
+ // shape in a future change lights up the per-slice paths without
112
+ // touching consumers.
113
+ this.unroutedSlice.wire.emit(event);
114
+ }
115
+ static createSlice() {
116
+ return { wire: new EventBus() };
117
+ }
118
+ }
119
+ //# sourceMappingURL=wire-communication-router.js.map
@@ -1,4 +1,4 @@
1
- import type { JSONWebToken } from '@salesforce/llm-gateway-sdk';
1
+ import type { JSONWebToken } from '@salesforce/agentic-common';
2
2
  /**
3
3
  * Returns true if the URL matches a Salesforce Hosted MCP Server endpoint.
4
4
  * Covers all environments (prod, dev, test, perf, stage) and all API versions
@@ -0,0 +1,11 @@
1
+ import { Model, ModelName } from './model.js';
2
+ import { type SupportedFileFormat } from './types.js';
3
+ export declare class ClaudeOpus45 extends Model {
4
+ readonly name: ModelName;
5
+ readonly displayId: string;
6
+ readonly maxInputTokens: number;
7
+ readonly maxOutputTokens: number;
8
+ readonly contextWindow: number;
9
+ readonly supportsPromptCache: boolean;
10
+ readonly supportedFormats: readonly SupportedFileFormat[];
11
+ }
@@ -0,0 +1,21 @@
1
+ /*
2
+ * Copyright 2026, Salesforce, Inc. All rights reserved.
3
+ * See LICENSE.txt for license terms.
4
+ */
5
+ import { Model, ModelName } from './model.js';
6
+ import { MimeType } from './types.js';
7
+ export class ClaudeOpus45 extends Model {
8
+ name = ModelName.CLAUDE_OPUS_4_5;
9
+ displayId = 'Claude Opus 4.5';
10
+ maxInputTokens = 200000;
11
+ // 64K — 4× the Sonnet 4.6 ceiling. Anthropic raised the cap on Opus 4.5 explicitly.
12
+ maxOutputTokens = 64000;
13
+ contextWindow = 200000;
14
+ supportsPromptCache = true;
15
+ supportedFormats = [
16
+ { name: 'png', mimeType: MimeType.Png, maxBytesPerFile: 3.75 * 1024 * 1024 },
17
+ { name: 'jpeg', mimeType: MimeType.Jpeg, maxBytesPerFile: 3.75 * 1024 * 1024 },
18
+ { name: 'pdf', mimeType: MimeType.Pdf, maxBytesPerFile: 4.5 * 1024 * 1024, maxFilesPerRequest: 5 },
19
+ ];
20
+ }
21
+ //# sourceMappingURL=claude-opus-4-5.js.map
@@ -0,0 +1,11 @@
1
+ import { Model, ModelName } from './model.js';
2
+ import { type SupportedFileFormat } from './types.js';
3
+ export declare class ClaudeOpus46 extends Model {
4
+ readonly name: ModelName;
5
+ readonly displayId: string;
6
+ readonly maxInputTokens: number;
7
+ readonly maxOutputTokens: number;
8
+ readonly contextWindow: number;
9
+ readonly supportsPromptCache: boolean;
10
+ readonly supportedFormats: readonly SupportedFileFormat[];
11
+ }
@@ -0,0 +1,22 @@
1
+ /*
2
+ * Copyright 2026, Salesforce, Inc. All rights reserved.
3
+ * See LICENSE.txt for license terms.
4
+ */
5
+ import { Model, ModelName } from './model.js';
6
+ import { MimeType } from './types.js';
7
+ export class ClaudeOpus46 extends Model {
8
+ name = ModelName.CLAUDE_OPUS_4_6;
9
+ displayId = 'Claude Opus 4.6';
10
+ // Caps sourced from the LLM Gateway model registry:
11
+ // git.soma.salesforce.com/a360/file-metadata/.../bedrock/llmgateway/BedrockAnthropicClaude46Opus.yml
12
+ maxInputTokens = 1_000_000;
13
+ maxOutputTokens = 128_000;
14
+ contextWindow = 1_000_000;
15
+ supportsPromptCache = true;
16
+ supportedFormats = [
17
+ { name: 'png', mimeType: MimeType.Png, maxBytesPerFile: 3.75 * 1024 * 1024 },
18
+ { name: 'jpeg', mimeType: MimeType.Jpeg, maxBytesPerFile: 3.75 * 1024 * 1024 },
19
+ { name: 'pdf', mimeType: MimeType.Pdf, maxBytesPerFile: 4.5 * 1024 * 1024, maxFilesPerRequest: 5 },
20
+ ];
21
+ }
22
+ //# sourceMappingURL=claude-opus-4-6.js.map
@@ -0,0 +1,11 @@
1
+ import { Model, ModelName } from './model.js';
2
+ import { type SupportedFileFormat } from './types.js';
3
+ export declare class ClaudeOpus47 extends Model {
4
+ readonly name: ModelName;
5
+ readonly displayId: string;
6
+ readonly maxInputTokens: number;
7
+ readonly maxOutputTokens: number;
8
+ readonly contextWindow: number;
9
+ readonly supportsPromptCache: boolean;
10
+ readonly supportedFormats: readonly SupportedFileFormat[];
11
+ }
@@ -0,0 +1,22 @@
1
+ /*
2
+ * Copyright 2026, Salesforce, Inc. All rights reserved.
3
+ * See LICENSE.txt for license terms.
4
+ */
5
+ import { Model, ModelName } from './model.js';
6
+ import { MimeType } from './types.js';
7
+ export class ClaudeOpus47 extends Model {
8
+ name = ModelName.CLAUDE_OPUS_4_7;
9
+ displayId = 'Claude Opus 4.7';
10
+ // Caps sourced from the LLM Gateway model registry:
11
+ // git.soma.salesforce.com/a360/file-metadata/.../bedrock/llmgateway/BedrockAnthropicClaude47Opus.yml
12
+ maxInputTokens = 1_000_000;
13
+ maxOutputTokens = 128_000;
14
+ contextWindow = 1_000_000;
15
+ supportsPromptCache = true;
16
+ supportedFormats = [
17
+ { name: 'png', mimeType: MimeType.Png, maxBytesPerFile: 3.75 * 1024 * 1024 },
18
+ { name: 'jpeg', mimeType: MimeType.Jpeg, maxBytesPerFile: 3.75 * 1024 * 1024 },
19
+ { name: 'pdf', mimeType: MimeType.Pdf, maxBytesPerFile: 4.5 * 1024 * 1024, maxFilesPerRequest: 5 },
20
+ ];
21
+ }
22
+ //# sourceMappingURL=claude-opus-4-7.js.map
@@ -0,0 +1,11 @@
1
+ import { Model, ModelName } from './model.js';
2
+ import { type SupportedFileFormat } from './types.js';
3
+ export declare class ClaudeSonnet45 extends Model {
4
+ readonly name: ModelName;
5
+ readonly displayId: string;
6
+ readonly maxInputTokens: number;
7
+ readonly maxOutputTokens: number;
8
+ readonly contextWindow: number;
9
+ readonly supportsPromptCache: boolean;
10
+ readonly supportedFormats: readonly SupportedFileFormat[];
11
+ }
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright 2026, Salesforce, Inc. All rights reserved.
3
+ * See LICENSE.txt for license terms.
4
+ */
5
+ import { Model, ModelName } from './model.js';
6
+ import { MimeType } from './types.js';
7
+ export class ClaudeSonnet45 extends Model {
8
+ name = ModelName.CLAUDE_SONNET_4_5;
9
+ displayId = 'Claude Sonnet 4.5';
10
+ // Reference: https://help.salesforce.com/s/articleView?id=ai.generative_ai_llm_limits.htm&type=5
11
+ maxInputTokens = 200000;
12
+ maxOutputTokens = 8192;
13
+ contextWindow = 200000;
14
+ supportsPromptCache = true;
15
+ // Multimodal limits: 3.75 MiB / image, 4.5 MiB / PDF, 5 PDFs / request
16
+ // Reference: https://help.salesforce.com/s/articleView?id=ai.generative_ai_llm_multimodal_support.htm&type=5
17
+ supportedFormats = [
18
+ { name: 'png', mimeType: MimeType.Png, maxBytesPerFile: 3.75 * 1024 * 1024 },
19
+ { name: 'jpeg', mimeType: MimeType.Jpeg, maxBytesPerFile: 3.75 * 1024 * 1024 },
20
+ { name: 'pdf', mimeType: MimeType.Pdf, maxBytesPerFile: 4.5 * 1024 * 1024, maxFilesPerRequest: 5 },
21
+ ];
22
+ }
23
+ //# sourceMappingURL=claude-sonnet-4-5.js.map
@@ -0,0 +1,11 @@
1
+ import { Model, ModelName } from './model.js';
2
+ import { type SupportedFileFormat } from './types.js';
3
+ export declare class ClaudeSonnet46 extends Model {
4
+ readonly name: ModelName;
5
+ readonly displayId: string;
6
+ readonly maxInputTokens: number;
7
+ readonly maxOutputTokens: number;
8
+ readonly contextWindow: number;
9
+ readonly supportsPromptCache: boolean;
10
+ readonly supportedFormats: readonly SupportedFileFormat[];
11
+ }
@@ -0,0 +1,22 @@
1
+ /*
2
+ * Copyright 2026, Salesforce, Inc. All rights reserved.
3
+ * See LICENSE.txt for license terms.
4
+ */
5
+ import { Model, ModelName } from './model.js';
6
+ import { MimeType } from './types.js';
7
+ export class ClaudeSonnet46 extends Model {
8
+ name = ModelName.CLAUDE_SONNET_4_6;
9
+ displayId = 'Claude Sonnet 4.6';
10
+ // See: https://help.salesforce.com/s/articleView?id=ai.generative_ai_llm_limits.htm&type=5
11
+ maxInputTokens = 200000;
12
+ maxOutputTokens = 16384;
13
+ contextWindow = 200000;
14
+ supportsPromptCache = true;
15
+ // Multimodal limits: 3.75 MiB / image, 4.5 MiB / PDF, 5 PDFs / request
16
+ supportedFormats = [
17
+ { name: 'png', mimeType: MimeType.Png, maxBytesPerFile: 3.75 * 1024 * 1024 },
18
+ { name: 'jpeg', mimeType: MimeType.Jpeg, maxBytesPerFile: 3.75 * 1024 * 1024 },
19
+ { name: 'pdf', mimeType: MimeType.Pdf, maxBytesPerFile: 4.5 * 1024 * 1024, maxFilesPerRequest: 5 },
20
+ ];
21
+ }
22
+ //# sourceMappingURL=claude-sonnet-4-6.js.map
@@ -0,0 +1,54 @@
1
+ import { Model } from './model.js';
2
+ import { type SupportedFileFormat } from './types.js';
3
+ /**
4
+ * Optional overrides for {@link createClaudeModel}. Any field omitted falls back to a conservative
5
+ * Claude-baseline default (the Sonnet 4.5 / Opus 4.5 caps) — newer flagship variants (Opus 4.6+,
6
+ * Sonnet 4.7+) ship with larger windows, so callers targeting a specific variant should pass the
7
+ * caps explicitly rather than relying on these defaults.
8
+ */
9
+ export type ClaudeModelOverrides = {
10
+ /** Human-readable display id (e.g. `'Claude Opus 4.8'`). Defaults to the gateway id. */
11
+ displayId?: string;
12
+ /** Maximum input tokens accepted by the model. Defaults to 200_000 (Sonnet/Opus 4.5 baseline). */
13
+ maxInputTokens?: number;
14
+ /** Maximum output tokens the model can emit per response. Defaults to 64_000 (Sonnet/Opus 4.5 baseline). */
15
+ maxOutputTokens?: number;
16
+ /** Total context window. Defaults to 200_000 (Sonnet/Opus 4.5 baseline). */
17
+ contextWindow?: number;
18
+ /** Whether the gateway honors prompt caching for this model. Defaults to true. */
19
+ supportsPromptCache?: boolean;
20
+ /** Multimodal file format caps. Defaults to the Claude image+PDF caps. */
21
+ supportedFormats?: readonly SupportedFileFormat[];
22
+ /** Gateway-permitted generation parameters for this model. */
23
+ permittedParameters?: string[];
24
+ /**
25
+ * Extra HTTP headers to attach to chat requests for this model. Use for vendor
26
+ * labels (`anthropic-version`, model-tag opt-in headers) only — reserved
27
+ * fields like `Authorization`, `Content-Type`, `x-client-feature-id`,
28
+ * `x-sfdc-app-context`, and `x-sfdc-core-tenant-id` are silently shadowed by
29
+ * the resolver's freshly-built values. See {@link Model.customHeaders} for
30
+ * the full override-precedence rule.
31
+ */
32
+ customHeaders?: Record<string, string>;
33
+ };
34
+ /**
35
+ * Construct a {@link Model} instance for a Bedrock-hosted Anthropic Claude variant by
36
+ * gateway id without waiting for a new SDK release that adds it to {@link ModelName}.
37
+ *
38
+ * Used by consumers (notably AFV) that need to opt into a newly-published Claude model
39
+ * on the gateway before the SDK has released it. The returned instance carries the
40
+ * conservative Sonnet/Opus 4.5-baseline caps; pass `overrides` to dial caps in for the
41
+ * specific variant — newer flagships (Opus 4.6+, Sonnet 4.7+) ship with larger windows.
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * const model = createClaudeModel('llmgateway__BedrockAnthropicClaude48Opus', {
46
+ * displayId: 'Claude Opus 4.8',
47
+ * maxInputTokens: 1_000_000,
48
+ * contextWindow: 1_000_000,
49
+ * maxOutputTokens: 128_000,
50
+ * });
51
+ * await agent.updateAgentConfig({ modelId: model });
52
+ * ```
53
+ */
54
+ export declare function createClaudeModel(gatewayId: string, overrides?: ClaudeModelOverrides): Model;
@@ -0,0 +1,62 @@
1
+ /*
2
+ * Copyright 2026, Salesforce, Inc. All rights reserved.
3
+ * See LICENSE.txt for license terms.
4
+ */
5
+ import { Model } from './model.js';
6
+ import { MimeType } from './types.js';
7
+ /**
8
+ * Default multimodal limits shared by Bedrock-hosted Anthropic Claude variants on the
9
+ * Salesforce LLM Gateway: 3.75 MiB / image, 4.5 MiB / PDF, 5 PDFs / request.
10
+ */
11
+ const DEFAULT_CLAUDE_SUPPORTED_FORMATS = [
12
+ { name: 'png', mimeType: MimeType.Png, maxBytesPerFile: 3.75 * 1024 * 1024 },
13
+ { name: 'jpeg', mimeType: MimeType.Jpeg, maxBytesPerFile: 3.75 * 1024 * 1024 },
14
+ { name: 'pdf', mimeType: MimeType.Pdf, maxBytesPerFile: 4.5 * 1024 * 1024, maxFilesPerRequest: 5 },
15
+ ];
16
+ /**
17
+ * Construct a {@link Model} instance for a Bedrock-hosted Anthropic Claude variant by
18
+ * gateway id without waiting for a new SDK release that adds it to {@link ModelName}.
19
+ *
20
+ * Used by consumers (notably AFV) that need to opt into a newly-published Claude model
21
+ * on the gateway before the SDK has released it. The returned instance carries the
22
+ * conservative Sonnet/Opus 4.5-baseline caps; pass `overrides` to dial caps in for the
23
+ * specific variant — newer flagships (Opus 4.6+, Sonnet 4.7+) ship with larger windows.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * const model = createClaudeModel('llmgateway__BedrockAnthropicClaude48Opus', {
28
+ * displayId: 'Claude Opus 4.8',
29
+ * maxInputTokens: 1_000_000,
30
+ * contextWindow: 1_000_000,
31
+ * maxOutputTokens: 128_000,
32
+ * });
33
+ * await agent.updateAgentConfig({ modelId: model });
34
+ * ```
35
+ */
36
+ export function createClaudeModel(gatewayId, overrides = {}) {
37
+ return new InlineClaudeModel(gatewayId, overrides);
38
+ }
39
+ class InlineClaudeModel extends Model {
40
+ name;
41
+ displayId;
42
+ maxInputTokens;
43
+ maxOutputTokens;
44
+ contextWindow;
45
+ supportsPromptCache;
46
+ supportedFormats;
47
+ permittedParameters;
48
+ customHeaders;
49
+ constructor(gatewayId, overrides) {
50
+ super();
51
+ this.name = gatewayId;
52
+ this.displayId = overrides.displayId ?? gatewayId;
53
+ this.maxInputTokens = overrides.maxInputTokens ?? 200_000;
54
+ this.maxOutputTokens = overrides.maxOutputTokens ?? 64_000;
55
+ this.contextWindow = overrides.contextWindow ?? 200_000;
56
+ this.supportsPromptCache = overrides.supportsPromptCache ?? true;
57
+ this.supportedFormats = overrides.supportedFormats ?? DEFAULT_CLAUDE_SUPPORTED_FORMATS;
58
+ this.permittedParameters = overrides.permittedParameters;
59
+ this.customHeaders = overrides.customHeaders;
60
+ }
61
+ }
62
+ //# sourceMappingURL=create-claude-model.js.map
@@ -0,0 +1,11 @@
1
+ import { Model, ModelName } from './model.js';
2
+ import { type SupportedFileFormat } from './types.js';
3
+ export declare class GPT54 extends Model {
4
+ readonly name: ModelName;
5
+ readonly displayId: string;
6
+ readonly maxInputTokens: number;
7
+ readonly maxOutputTokens: number;
8
+ readonly contextWindow: number;
9
+ readonly supportsPromptCache: boolean;
10
+ readonly supportedFormats: readonly SupportedFileFormat[];
11
+ }
@@ -0,0 +1,21 @@
1
+ /*
2
+ * Copyright 2026, Salesforce, Inc. All rights reserved.
3
+ * See LICENSE.txt for license terms.
4
+ */
5
+ import { Model, ModelName } from './model.js';
6
+ import { MimeType } from './types.js';
7
+ export class GPT54 extends Model {
8
+ name = ModelName.GPT_5_4;
9
+ displayId = 'GPT-5.4';
10
+ // Source of truth: a360/file-metadata `OpenAIGPT54.yml` (maxInputToken, max_tokens.maxRangeValue).
11
+ maxInputTokens = 1050000;
12
+ maxOutputTokens = 128000;
13
+ contextWindow = 1050000;
14
+ supportsPromptCache = false;
15
+ supportedFormats = [
16
+ { name: 'png', mimeType: MimeType.Png },
17
+ { name: 'jpeg', mimeType: MimeType.Jpeg },
18
+ { name: 'pdf', mimeType: MimeType.Pdf },
19
+ ];
20
+ }
21
+ //# sourceMappingURL=gpt-5-4.js.map
@@ -0,0 +1,15 @@
1
+ import { Model, ModelName } from './model.js';
2
+ import { type SupportedFileFormat } from './types.js';
3
+ /**
4
+ * GPT-5.5 is BETA on the gateway and gated behind the `AIModelBetaEnabled` org preference plus the
5
+ * `enableBetaModels` perm. Orgs without the gate active will receive a gateway error at request time.
6
+ */
7
+ export declare class GPT55 extends Model {
8
+ readonly name: ModelName;
9
+ readonly displayId: string;
10
+ readonly maxInputTokens: number;
11
+ readonly maxOutputTokens: number;
12
+ readonly contextWindow: number;
13
+ readonly supportsPromptCache: boolean;
14
+ readonly supportedFormats: readonly SupportedFileFormat[];
15
+ }
@@ -0,0 +1,24 @@
1
+ /*
2
+ * Copyright 2026, Salesforce, Inc. All rights reserved.
3
+ * See LICENSE.txt for license terms.
4
+ */
5
+ import { Model, ModelName } from './model.js';
6
+ import { MimeType } from './types.js';
7
+ /**
8
+ * GPT-5.5 is BETA on the gateway and gated behind the `AIModelBetaEnabled` org preference plus the
9
+ * `enableBetaModels` perm. Orgs without the gate active will receive a gateway error at request time.
10
+ */
11
+ export class GPT55 extends Model {
12
+ name = ModelName.GPT_5_5;
13
+ displayId = 'GPT-5.5';
14
+ maxInputTokens = 1050000;
15
+ maxOutputTokens = 128000;
16
+ contextWindow = 1050000;
17
+ supportsPromptCache = false;
18
+ supportedFormats = [
19
+ { name: 'png', mimeType: MimeType.Png },
20
+ { name: 'jpeg', mimeType: MimeType.Jpeg },
21
+ { name: 'pdf', mimeType: MimeType.Pdf },
22
+ ];
23
+ }
24
+ //# sourceMappingURL=gpt-5-5.js.map