@salesforce/sfdx-agent-chat-generations 0.1.0 → 0.3.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.
- package/CHANGELOG.md +10 -0
- package/dist/chat-response.d.ts +8 -1
- package/dist/chat-response.js +18 -1
- package/dist/gpt5-response-processor.js +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to `@salesforce/sfdx-agent-chat-generations` are documented in this file.
|
|
4
4
|
Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
5
5
|
|
|
6
|
+
## [0.3.0] - 2026-07-30
|
|
7
|
+
|
|
8
|
+
### Fixes
|
|
9
|
+
- **chat-generations**: accept non-streaming GPT-5 response missing parameters.provider @W-23637485@ ([#714](https://github.com/forcedotcom/agentic-dx/pull/714))
|
|
10
|
+
|
|
11
|
+
## [0.2.0] - 2026-07-29
|
|
12
|
+
|
|
13
|
+
### Fixes
|
|
14
|
+
- **chat-generations**: accept azureOpenAI provider on GovCloud GPT-5 stream @W-23614921@ ([#711](https://github.com/forcedotcom/agentic-dx/pull/711))
|
|
15
|
+
|
|
6
16
|
## [0.1.0] - 2026-07-28
|
|
7
17
|
|
|
8
18
|
_No changes — released alongside dependent packages._
|
package/dist/chat-response.d.ts
CHANGED
|
@@ -90,8 +90,9 @@ type GPT5Generation = {
|
|
|
90
90
|
};
|
|
91
91
|
tool_invocations?: RawToolInvocation[] | null;
|
|
92
92
|
};
|
|
93
|
+
export type GPT5Provider = 'openai' | 'azureOpenAI';
|
|
93
94
|
type GPT5GenerationParameters = {
|
|
94
|
-
provider:
|
|
95
|
+
provider: GPT5Provider;
|
|
95
96
|
created?: number;
|
|
96
97
|
model?: string;
|
|
97
98
|
usage?: GPT5TokenUsageDetails;
|
|
@@ -116,4 +117,10 @@ export declare function isLLMGErrorEvent(chunk: RawChatChunk): chunk is LLMGErro
|
|
|
116
117
|
* Type guard to check if a raw response is from GPT-5.
|
|
117
118
|
*/
|
|
118
119
|
export declare function isGPT5Response(response: RawChatChunk): response is GPT5RawChatChunk;
|
|
120
|
+
/**
|
|
121
|
+
* Non-streaming variant of {@link isGPT5Response}. The `/chat/generations` (non-stream)
|
|
122
|
+
* response omits `parameters.provider` that SSE chunks stamp, so the provider-based
|
|
123
|
+
* guard wrongly rejects a valid GPT-5 envelope
|
|
124
|
+
*/
|
|
125
|
+
export declare function isGPT5NonStreamingResponse(response: RawChatChunk): response is GPT5RawChatChunk;
|
|
119
126
|
export {};
|
package/dist/chat-response.js
CHANGED
|
@@ -11,11 +11,28 @@
|
|
|
11
11
|
export function isLLMGErrorEvent(chunk) {
|
|
12
12
|
return 'error' in chunk && typeof chunk.error === 'object' && 'errorCode' in chunk.error;
|
|
13
13
|
}
|
|
14
|
+
// Provider labels that denote an OpenAI GPT-5 envelope on this GPT-only path:
|
|
15
|
+
// 'openai' (commercial gateway) and 'azureOpenAI' (GovCloud's Azure-hosted
|
|
16
|
+
// gateway). A Bedrock/Anthropic envelope reaching here is still refused.
|
|
17
|
+
const GPT5_PROVIDERS = new Set(['openai', 'azureOpenAI']);
|
|
14
18
|
/**
|
|
15
19
|
* Type guard to check if a raw response is from GPT-5.
|
|
16
20
|
*/
|
|
17
21
|
export function isGPT5Response(response) {
|
|
18
22
|
const params = 'generation_details' in response ? response.generation_details?.parameters : undefined;
|
|
19
|
-
return params !== undefined && 'provider' in params && params.provider
|
|
23
|
+
return params !== undefined && 'provider' in params && GPT5_PROVIDERS.has(params.provider);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Non-streaming variant of {@link isGPT5Response}. The `/chat/generations` (non-stream)
|
|
27
|
+
* response omits `parameters.provider` that SSE chunks stamp, so the provider-based
|
|
28
|
+
* guard wrongly rejects a valid GPT-5 envelope
|
|
29
|
+
*/
|
|
30
|
+
export function isGPT5NonStreamingResponse(response) {
|
|
31
|
+
if (!('generation_details' in response))
|
|
32
|
+
return false;
|
|
33
|
+
const params = response.generation_details?.parameters;
|
|
34
|
+
if (params && 'provider' in params)
|
|
35
|
+
return GPT5_PROVIDERS.has(params.provider);
|
|
36
|
+
return params !== undefined;
|
|
20
37
|
}
|
|
21
38
|
//# sourceMappingURL=chat-response.js.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright 2026, Salesforce, Inc. All rights reserved.
|
|
3
3
|
* See LICENSE.txt for license terms.
|
|
4
4
|
*/
|
|
5
|
-
import { isLLMGErrorEvent, isGPT5Response } from './chat-response.js';
|
|
5
|
+
import { isLLMGErrorEvent, isGPT5Response, isGPT5NonStreamingResponse } from './chat-response.js';
|
|
6
6
|
import { normalizeToolArguments } from './tool-arg-normalize.js';
|
|
7
7
|
// Detect if this is the start of a new tool call (has id and name)
|
|
8
8
|
function isToolCallStart(inv) {
|
|
@@ -159,7 +159,7 @@ export class GPT5ResponseProcessor {
|
|
|
159
159
|
if (isLLMGErrorEvent(raw)) {
|
|
160
160
|
throw new Error(raw.error.message);
|
|
161
161
|
}
|
|
162
|
-
if (!
|
|
162
|
+
if (!isGPT5NonStreamingResponse(raw)) {
|
|
163
163
|
throw new Error('Invalid response type for GPT-5 processor');
|
|
164
164
|
}
|
|
165
165
|
const generation = raw.generation_details?.generations?.[0];
|
package/package.json
CHANGED