@office-ai/aioncli-core 0.24.1 → 0.24.3
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/dist/docs/bedrock-integration-plan.md +595 -0
- package/dist/docs/get-started/authentication.md +162 -0
- package/dist/src/agents/introspection-agent.d.ts +2 -2
- package/dist/src/code_assist/oauth2.test.js +3 -1
- package/dist/src/code_assist/oauth2.test.js.map +1 -1
- package/dist/src/config/models.d.ts +26 -0
- package/dist/src/config/models.js +134 -0
- package/dist/src/config/models.js.map +1 -1
- package/dist/src/core/bedrockContentGenerator.d.ts +72 -0
- package/dist/src/core/bedrockContentGenerator.js +628 -0
- package/dist/src/core/bedrockContentGenerator.js.map +1 -0
- package/dist/src/core/contentGenerator.d.ts +3 -1
- package/dist/src/core/contentGenerator.js +29 -0
- package/dist/src/core/contentGenerator.js.map +1 -1
- package/dist/src/core/coreToolHookTriggers.js +3 -3
- package/dist/src/generated/git-commit.d.ts +2 -2
- package/dist/src/generated/git-commit.js +2 -2
- package/dist/src/ide/types.d.ts +44 -44
- package/dist/src/telemetry/memory-monitor.test.js +1 -0
- package/dist/src/telemetry/memory-monitor.test.js.map +1 -1
- package/dist/src/utils/checkpointUtils.d.ts +2 -2
- package/dist/src/utils/retry.js +25 -0
- package/dist/src/utils/retry.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import type { CountTokensResponse, GenerateContentParameters, CountTokensParameters, EmbedContentResponse, EmbedContentParameters } from '@google/genai';
|
|
7
|
+
import { GenerateContentResponse } from '@google/genai';
|
|
8
|
+
import type { ContentGenerator } from './contentGenerator.js';
|
|
9
|
+
/**
|
|
10
|
+
* BedrockContentGenerator implements ContentGenerator interface for AWS Bedrock.
|
|
11
|
+
*/
|
|
12
|
+
export declare class BedrockContentGenerator implements ContentGenerator {
|
|
13
|
+
private client;
|
|
14
|
+
private model;
|
|
15
|
+
private region;
|
|
16
|
+
/**
|
|
17
|
+
* Accumulator for streaming tool calls.
|
|
18
|
+
* Bedrock sends tool input as JSON fragments across multiple contentBlockDelta events.
|
|
19
|
+
* We accumulate the fragments and emit complete functionCall when contentBlockStop arrives.
|
|
20
|
+
*/
|
|
21
|
+
private streamingToolUses;
|
|
22
|
+
constructor(config: {
|
|
23
|
+
model: string;
|
|
24
|
+
region?: string;
|
|
25
|
+
});
|
|
26
|
+
private detectCredentialSource;
|
|
27
|
+
generateContent(request: GenerateContentParameters, _userPromptId: string): Promise<GenerateContentResponse>;
|
|
28
|
+
generateContentStream(request: GenerateContentParameters, _userPromptId: string): Promise<AsyncGenerator<GenerateContentResponse>>;
|
|
29
|
+
countTokens(request: CountTokensParameters): Promise<CountTokensResponse>;
|
|
30
|
+
embedContent(_request: EmbedContentParameters): Promise<EmbedContentResponse>;
|
|
31
|
+
/**
|
|
32
|
+
* Generator function to process streaming response from Bedrock.
|
|
33
|
+
* Handles text chunks and accumulates tool calls until complete.
|
|
34
|
+
*/
|
|
35
|
+
private streamGenerator;
|
|
36
|
+
/**
|
|
37
|
+
* Convert Gemini request to Bedrock Converse format.
|
|
38
|
+
*/
|
|
39
|
+
private convertToBedrockMessages;
|
|
40
|
+
/**
|
|
41
|
+
* Type guard to check if value is Content or Content[]
|
|
42
|
+
*/
|
|
43
|
+
private isContentOrArray;
|
|
44
|
+
/**
|
|
45
|
+
* Convert system instruction to Bedrock format.
|
|
46
|
+
*/
|
|
47
|
+
private convertSystemInstruction;
|
|
48
|
+
/**
|
|
49
|
+
* Convert Bedrock response to Gemini format.
|
|
50
|
+
*/
|
|
51
|
+
private convertToGeminiFormat;
|
|
52
|
+
/**
|
|
53
|
+
* Convert Bedrock StopReason to Gemini FinishReason.
|
|
54
|
+
*/
|
|
55
|
+
private convertStopReason;
|
|
56
|
+
/**
|
|
57
|
+
* Convert Gemini Tools to Bedrock ToolConfiguration format.
|
|
58
|
+
*/
|
|
59
|
+
private convertToolsToBedrockFormat;
|
|
60
|
+
/**
|
|
61
|
+
* Sanitize JSON schema for Bedrock compatibility.
|
|
62
|
+
* Bedrock has stricter requirements than Gemini:
|
|
63
|
+
* - Root level must have type: "object"
|
|
64
|
+
* - No nullable types (type: ["string", "null"])
|
|
65
|
+
* - No additionalProperties
|
|
66
|
+
*/
|
|
67
|
+
private sanitizeJsonSchema;
|
|
68
|
+
/**
|
|
69
|
+
* Enhance error with user-friendly messages.
|
|
70
|
+
*/
|
|
71
|
+
private enhanceError;
|
|
72
|
+
}
|