feat: Complete zCode CLI X with Telegram bot integration

- Add full Telegram bot functionality with Z.AI API integration
- Implement 4 tools: Bash, FileEdit, WebSearch, Git
- Add 3 agents: Code Reviewer, Architect, DevOps Engineer
- Add 6 skills for common coding tasks
- Add systemd service file for 24/7 operation
- Add nginx configuration for HTTPS webhook
- Add comprehensive documentation
- Implement WebSocket server for real-time updates
- Add logging system with Winston
- Add environment validation

🤖 zCode CLI X - Agentic coder with Z.AI + Telegram integration
This commit is contained in:
admin
2026-05-05 09:01:26 +00:00
Unverified
parent 4a7035dd92
commit 875c7f9b91
24688 changed files with 3224957 additions and 221 deletions

View File

@@ -0,0 +1,63 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.resolveHttpAuthSchemeConfig = exports.defaultBedrockRuntimeHttpAuthSchemeProvider = exports.defaultBedrockRuntimeHttpAuthSchemeParametersProvider = void 0;
const httpAuthSchemes_1 = require("@aws-sdk/core/httpAuthSchemes");
const core_1 = require("@smithy/core");
const util_middleware_1 = require("@smithy/util-middleware");
const defaultBedrockRuntimeHttpAuthSchemeParametersProvider = async (config, context, input) => {
return {
operation: (0, util_middleware_1.getSmithyContext)(context).operation,
region: await (0, util_middleware_1.normalizeProvider)(config.region)() || (() => {
throw new Error("expected `region` to be configured for `aws.auth#sigv4`");
})(),
};
};
exports.defaultBedrockRuntimeHttpAuthSchemeParametersProvider = defaultBedrockRuntimeHttpAuthSchemeParametersProvider;
function createAwsAuthSigv4HttpAuthOption(authParameters) {
return {
schemeId: "aws.auth#sigv4",
signingProperties: {
name: "bedrock",
region: authParameters.region,
},
propertiesExtractor: (config, context) => ({
signingProperties: {
config,
context,
},
}),
};
}
function createSmithyApiHttpBearerAuthHttpAuthOption(authParameters) {
return {
schemeId: "smithy.api#httpBearerAuth",
propertiesExtractor: ({ profile, filepath, configFilepath, ignoreCache, }, context) => ({
identityProperties: {
profile,
filepath,
configFilepath,
ignoreCache,
},
}),
};
}
const defaultBedrockRuntimeHttpAuthSchemeProvider = (authParameters) => {
const options = [];
switch (authParameters.operation) {
default: {
options.push(createAwsAuthSigv4HttpAuthOption(authParameters));
options.push(createSmithyApiHttpBearerAuthHttpAuthOption(authParameters));
}
}
return options;
};
exports.defaultBedrockRuntimeHttpAuthSchemeProvider = defaultBedrockRuntimeHttpAuthSchemeProvider;
const resolveHttpAuthSchemeConfig = (config) => {
const token = (0, core_1.memoizeIdentityProvider)(config.token, core_1.isIdentityExpired, core_1.doesIdentityRequireRefresh);
const config_0 = (0, httpAuthSchemes_1.resolveAwsSdkSigV4Config)(config);
return Object.assign(config_0, {
authSchemePreference: (0, util_middleware_1.normalizeProvider)(config.authSchemePreference ?? []),
token,
});
};
exports.resolveHttpAuthSchemeConfig = resolveHttpAuthSchemeConfig;

View File

@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.defaultEndpointResolver = void 0;
const util_endpoints_1 = require("@aws-sdk/util-endpoints");
const util_endpoints_2 = require("@smithy/util-endpoints");
const ruleset_1 = require("./ruleset");
const cache = new util_endpoints_2.EndpointCache({
size: 50,
params: ["Endpoint", "Region", "UseDualStack", "UseFIPS"],
});
const defaultEndpointResolver = (endpointParams, context = {}) => {
return cache.get(endpointParams, () => (0, util_endpoints_2.resolveEndpoint)(ruleset_1.ruleSet, {
endpointParams: endpointParams,
logger: context.logger,
}));
};
exports.defaultEndpointResolver = defaultEndpointResolver;
util_endpoints_2.customEndpointFunctions.aws = util_endpoints_1.awsEndpointFunctions;

View File

@@ -0,0 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ruleSet = void 0;
const s = "required", t = "fn", u = "argv", v = "ref";
const a = true, b = "isSet", c = "booleanEquals", d = "error", e = "endpoint", f = "tree", g = "PartitionResult", h = { [s]: false, "type": "string" }, i = { [s]: true, "default": false, "type": "boolean" }, j = { [v]: "Endpoint" }, k = { [t]: c, [u]: [{ [v]: "UseFIPS" }, true] }, l = { [t]: c, [u]: [{ [v]: "UseDualStack" }, true] }, m = {}, n = { [t]: "getAttr", [u]: [{ [v]: g }, "supportsFIPS"] }, o = { [t]: c, [u]: [true, { [t]: "getAttr", [u]: [{ [v]: g }, "supportsDualStack"] }] }, p = [k], q = [l], r = [{ [v]: "Region" }];
const _data = { version: "1.0", parameters: { Region: h, UseDualStack: i, UseFIPS: i, Endpoint: h }, rules: [{ conditions: [{ [t]: b, [u]: [j] }], rules: [{ conditions: p, error: "Invalid Configuration: FIPS and custom endpoint are not supported", type: d }, { rules: [{ conditions: q, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", type: d }, { endpoint: { url: j, properties: m, headers: m }, type: e }], type: f }], type: f }, { rules: [{ conditions: [{ [t]: b, [u]: r }], rules: [{ conditions: [{ [t]: "aws.partition", [u]: r, assign: g }], rules: [{ conditions: [k, l], rules: [{ conditions: [{ [t]: c, [u]: [a, n] }, o], rules: [{ rules: [{ endpoint: { url: "https://bedrock-runtime-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: m, headers: m }, type: e }], type: f }], type: f }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", type: d }], type: f }, { conditions: p, rules: [{ conditions: [{ [t]: c, [u]: [n, a] }], rules: [{ rules: [{ endpoint: { url: "https://bedrock-runtime-fips.{Region}.{PartitionResult#dnsSuffix}", properties: m, headers: m }, type: e }], type: f }], type: f }, { error: "FIPS is enabled but this partition does not support FIPS", type: d }], type: f }, { conditions: q, rules: [{ conditions: [o], rules: [{ rules: [{ endpoint: { url: "https://bedrock-runtime.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: m, headers: m }, type: e }], type: f }], type: f }, { error: "DualStack is enabled but this partition does not support DualStack", type: d }], type: f }, { rules: [{ endpoint: { url: "https://bedrock-runtime.{Region}.{PartitionResult#dnsSuffix}", properties: m, headers: m }, type: e }], type: f }], type: f }], type: f }, { error: "Invalid Configuration: Missing Region", type: d }], type: f }] };
exports.ruleSet = _data;

View File

@@ -0,0 +1,608 @@
'use strict';
var middlewareEventstream = require('@aws-sdk/middleware-eventstream');
var middlewareHostHeader = require('@aws-sdk/middleware-host-header');
var middlewareLogger = require('@aws-sdk/middleware-logger');
var middlewareRecursionDetection = require('@aws-sdk/middleware-recursion-detection');
var middlewareUserAgent = require('@aws-sdk/middleware-user-agent');
var middlewareWebsocket = require('@aws-sdk/middleware-websocket');
var configResolver = require('@smithy/config-resolver');
var core = require('@smithy/core');
var schema = require('@smithy/core/schema');
var eventstreamSerdeConfigResolver = require('@smithy/eventstream-serde-config-resolver');
var middlewareContentLength = require('@smithy/middleware-content-length');
var middlewareEndpoint = require('@smithy/middleware-endpoint');
var middlewareRetry = require('@smithy/middleware-retry');
var smithyClient = require('@smithy/smithy-client');
var httpAuthSchemeProvider = require('./auth/httpAuthSchemeProvider');
var runtimeConfig = require('./runtimeConfig');
var regionConfigResolver = require('@aws-sdk/region-config-resolver');
var protocolHttp = require('@smithy/protocol-http');
var schemas_0 = require('./schemas/schemas_0');
var errors = require('./models/errors');
var BedrockRuntimeServiceException = require('./models/BedrockRuntimeServiceException');
const resolveClientEndpointParameters = (options) => {
return Object.assign(options, {
useDualstackEndpoint: options.useDualstackEndpoint ?? false,
useFipsEndpoint: options.useFipsEndpoint ?? false,
defaultSigningName: "bedrock",
});
};
const commonParams = {
UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
Endpoint: { type: "builtInParams", name: "endpoint" },
Region: { type: "builtInParams", name: "region" },
UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" },
};
const getHttpAuthExtensionConfiguration = (runtimeConfig) => {
const _httpAuthSchemes = runtimeConfig.httpAuthSchemes;
let _httpAuthSchemeProvider = runtimeConfig.httpAuthSchemeProvider;
let _credentials = runtimeConfig.credentials;
let _token = runtimeConfig.token;
return {
setHttpAuthScheme(httpAuthScheme) {
const index = _httpAuthSchemes.findIndex((scheme) => scheme.schemeId === httpAuthScheme.schemeId);
if (index === -1) {
_httpAuthSchemes.push(httpAuthScheme);
}
else {
_httpAuthSchemes.splice(index, 1, httpAuthScheme);
}
},
httpAuthSchemes() {
return _httpAuthSchemes;
},
setHttpAuthSchemeProvider(httpAuthSchemeProvider) {
_httpAuthSchemeProvider = httpAuthSchemeProvider;
},
httpAuthSchemeProvider() {
return _httpAuthSchemeProvider;
},
setCredentials(credentials) {
_credentials = credentials;
},
credentials() {
return _credentials;
},
setToken(token) {
_token = token;
},
token() {
return _token;
},
};
};
const resolveHttpAuthRuntimeConfig = (config) => {
return {
httpAuthSchemes: config.httpAuthSchemes(),
httpAuthSchemeProvider: config.httpAuthSchemeProvider(),
credentials: config.credentials(),
token: config.token(),
};
};
const resolveRuntimeExtensions = (runtimeConfig, extensions) => {
const extensionConfiguration = Object.assign(regionConfigResolver.getAwsRegionExtensionConfiguration(runtimeConfig), smithyClient.getDefaultExtensionConfiguration(runtimeConfig), protocolHttp.getHttpHandlerExtensionConfiguration(runtimeConfig), getHttpAuthExtensionConfiguration(runtimeConfig));
extensions.forEach((extension) => extension.configure(extensionConfiguration));
return Object.assign(runtimeConfig, regionConfigResolver.resolveAwsRegionExtensionConfiguration(extensionConfiguration), smithyClient.resolveDefaultRuntimeConfig(extensionConfiguration), protocolHttp.resolveHttpHandlerRuntimeConfig(extensionConfiguration), resolveHttpAuthRuntimeConfig(extensionConfiguration));
};
class BedrockRuntimeClient extends smithyClient.Client {
config;
constructor(...[configuration]) {
const _config_0 = runtimeConfig.getRuntimeConfig(configuration || {});
super(_config_0);
this.initConfig = _config_0;
const _config_1 = resolveClientEndpointParameters(_config_0);
const _config_2 = middlewareUserAgent.resolveUserAgentConfig(_config_1);
const _config_3 = middlewareRetry.resolveRetryConfig(_config_2);
const _config_4 = configResolver.resolveRegionConfig(_config_3);
const _config_5 = middlewareHostHeader.resolveHostHeaderConfig(_config_4);
const _config_6 = middlewareEndpoint.resolveEndpointConfig(_config_5);
const _config_7 = eventstreamSerdeConfigResolver.resolveEventStreamSerdeConfig(_config_6);
const _config_8 = httpAuthSchemeProvider.resolveHttpAuthSchemeConfig(_config_7);
const _config_9 = middlewareEventstream.resolveEventStreamConfig(_config_8);
const _config_10 = middlewareWebsocket.resolveWebSocketConfig(_config_9);
const _config_11 = resolveRuntimeExtensions(_config_10, configuration?.extensions || []);
this.config = _config_11;
this.middlewareStack.use(schema.getSchemaSerdePlugin(this.config));
this.middlewareStack.use(middlewareUserAgent.getUserAgentPlugin(this.config));
this.middlewareStack.use(middlewareRetry.getRetryPlugin(this.config));
this.middlewareStack.use(middlewareContentLength.getContentLengthPlugin(this.config));
this.middlewareStack.use(middlewareHostHeader.getHostHeaderPlugin(this.config));
this.middlewareStack.use(middlewareLogger.getLoggerPlugin(this.config));
this.middlewareStack.use(middlewareRecursionDetection.getRecursionDetectionPlugin(this.config));
this.middlewareStack.use(core.getHttpAuthSchemeEndpointRuleSetPlugin(this.config, {
httpAuthSchemeParametersProvider: httpAuthSchemeProvider.defaultBedrockRuntimeHttpAuthSchemeParametersProvider,
identityProviderConfigProvider: async (config) => new core.DefaultIdentityProviderConfig({
"aws.auth#sigv4": config.credentials,
"smithy.api#httpBearerAuth": config.token,
}),
}));
this.middlewareStack.use(core.getHttpSigningPlugin(this.config));
}
destroy() {
super.destroy();
}
}
class ApplyGuardrailCommand extends smithyClient.Command
.classBuilder()
.ep(commonParams)
.m(function (Command, cs, config, o) {
return [middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
})
.s("AmazonBedrockFrontendService", "ApplyGuardrail", {})
.n("BedrockRuntimeClient", "ApplyGuardrailCommand")
.sc(schemas_0.ApplyGuardrail$)
.build() {
}
class ConverseCommand extends smithyClient.Command
.classBuilder()
.ep(commonParams)
.m(function (Command, cs, config, o) {
return [middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
})
.s("AmazonBedrockFrontendService", "Converse", {})
.n("BedrockRuntimeClient", "ConverseCommand")
.sc(schemas_0.Converse$)
.build() {
}
class ConverseStreamCommand extends smithyClient.Command
.classBuilder()
.ep(commonParams)
.m(function (Command, cs, config, o) {
return [middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
})
.s("AmazonBedrockFrontendService", "ConverseStream", {
eventStream: {
output: true,
},
})
.n("BedrockRuntimeClient", "ConverseStreamCommand")
.sc(schemas_0.ConverseStream$)
.build() {
}
class CountTokensCommand extends smithyClient.Command
.classBuilder()
.ep(commonParams)
.m(function (Command, cs, config, o) {
return [middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
})
.s("AmazonBedrockFrontendService", "CountTokens", {})
.n("BedrockRuntimeClient", "CountTokensCommand")
.sc(schemas_0.CountTokens$)
.build() {
}
class GetAsyncInvokeCommand extends smithyClient.Command
.classBuilder()
.ep(commonParams)
.m(function (Command, cs, config, o) {
return [middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
})
.s("AmazonBedrockFrontendService", "GetAsyncInvoke", {})
.n("BedrockRuntimeClient", "GetAsyncInvokeCommand")
.sc(schemas_0.GetAsyncInvoke$)
.build() {
}
class InvokeModelCommand extends smithyClient.Command
.classBuilder()
.ep(commonParams)
.m(function (Command, cs, config, o) {
return [middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
})
.s("AmazonBedrockFrontendService", "InvokeModel", {})
.n("BedrockRuntimeClient", "InvokeModelCommand")
.sc(schemas_0.InvokeModel$)
.build() {
}
class InvokeModelWithBidirectionalStreamCommand extends smithyClient.Command
.classBuilder()
.ep(commonParams)
.m(function (Command, cs, config, o) {
return [
middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
middlewareEventstream.getEventStreamPlugin(config),
middlewareWebsocket.getWebSocketPlugin(config, {
headerPrefix: 'x-amz-bedrock-',
}),
];
})
.s("AmazonBedrockFrontendService", "InvokeModelWithBidirectionalStream", {
eventStream: {
input: true,
output: true,
},
})
.n("BedrockRuntimeClient", "InvokeModelWithBidirectionalStreamCommand")
.sc(schemas_0.InvokeModelWithBidirectionalStream$)
.build() {
}
class InvokeModelWithResponseStreamCommand extends smithyClient.Command
.classBuilder()
.ep(commonParams)
.m(function (Command, cs, config, o) {
return [middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
})
.s("AmazonBedrockFrontendService", "InvokeModelWithResponseStream", {
eventStream: {
output: true,
},
})
.n("BedrockRuntimeClient", "InvokeModelWithResponseStreamCommand")
.sc(schemas_0.InvokeModelWithResponseStream$)
.build() {
}
class ListAsyncInvokesCommand extends smithyClient.Command
.classBuilder()
.ep(commonParams)
.m(function (Command, cs, config, o) {
return [middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
})
.s("AmazonBedrockFrontendService", "ListAsyncInvokes", {})
.n("BedrockRuntimeClient", "ListAsyncInvokesCommand")
.sc(schemas_0.ListAsyncInvokes$)
.build() {
}
class StartAsyncInvokeCommand extends smithyClient.Command
.classBuilder()
.ep(commonParams)
.m(function (Command, cs, config, o) {
return [middlewareEndpoint.getEndpointPlugin(config, Command.getEndpointParameterInstructions())];
})
.s("AmazonBedrockFrontendService", "StartAsyncInvoke", {})
.n("BedrockRuntimeClient", "StartAsyncInvokeCommand")
.sc(schemas_0.StartAsyncInvoke$)
.build() {
}
const paginateListAsyncInvokes = core.createPaginator(BedrockRuntimeClient, ListAsyncInvokesCommand, "nextToken", "nextToken", "maxResults");
const commands = {
ApplyGuardrailCommand,
ConverseCommand,
ConverseStreamCommand,
CountTokensCommand,
GetAsyncInvokeCommand,
InvokeModelCommand,
InvokeModelWithBidirectionalStreamCommand,
InvokeModelWithResponseStreamCommand,
ListAsyncInvokesCommand,
StartAsyncInvokeCommand,
};
const paginators = {
paginateListAsyncInvokes,
};
class BedrockRuntime extends BedrockRuntimeClient {
}
smithyClient.createAggregatedClient(commands, BedrockRuntime, { paginators });
const AsyncInvokeStatus = {
COMPLETED: "Completed",
FAILED: "Failed",
IN_PROGRESS: "InProgress",
};
const SortAsyncInvocationBy = {
SUBMISSION_TIME: "SubmissionTime",
};
const SortOrder = {
ASCENDING: "Ascending",
DESCENDING: "Descending",
};
const GuardrailImageFormat = {
JPEG: "jpeg",
PNG: "png",
};
const GuardrailContentQualifier = {
GROUNDING_SOURCE: "grounding_source",
GUARD_CONTENT: "guard_content",
QUERY: "query",
};
const GuardrailOutputScope = {
FULL: "FULL",
INTERVENTIONS: "INTERVENTIONS",
};
const GuardrailContentSource = {
INPUT: "INPUT",
OUTPUT: "OUTPUT",
};
const GuardrailAction = {
GUARDRAIL_INTERVENED: "GUARDRAIL_INTERVENED",
NONE: "NONE",
};
const GuardrailOrigin = {
ACCOUNT_ENFORCED: "ACCOUNT_ENFORCED",
ORGANIZATION_ENFORCED: "ORGANIZATION_ENFORCED",
REQUEST: "REQUEST",
};
const GuardrailOwnership = {
CROSS_ACCOUNT: "CROSS_ACCOUNT",
SELF: "SELF",
};
const GuardrailAutomatedReasoningLogicWarningType = {
ALWAYS_FALSE: "ALWAYS_FALSE",
ALWAYS_TRUE: "ALWAYS_TRUE",
};
const GuardrailContentPolicyAction = {
BLOCKED: "BLOCKED",
NONE: "NONE",
};
const GuardrailContentFilterConfidence = {
HIGH: "HIGH",
LOW: "LOW",
MEDIUM: "MEDIUM",
NONE: "NONE",
};
const GuardrailContentFilterStrength = {
HIGH: "HIGH",
LOW: "LOW",
MEDIUM: "MEDIUM",
NONE: "NONE",
};
const GuardrailContentFilterType = {
HATE: "HATE",
INSULTS: "INSULTS",
MISCONDUCT: "MISCONDUCT",
PROMPT_ATTACK: "PROMPT_ATTACK",
SEXUAL: "SEXUAL",
VIOLENCE: "VIOLENCE",
};
const GuardrailContextualGroundingPolicyAction = {
BLOCKED: "BLOCKED",
NONE: "NONE",
};
const GuardrailContextualGroundingFilterType = {
GROUNDING: "GROUNDING",
RELEVANCE: "RELEVANCE",
};
const GuardrailSensitiveInformationPolicyAction = {
ANONYMIZED: "ANONYMIZED",
BLOCKED: "BLOCKED",
NONE: "NONE",
};
const GuardrailPiiEntityType = {
ADDRESS: "ADDRESS",
AGE: "AGE",
AWS_ACCESS_KEY: "AWS_ACCESS_KEY",
AWS_SECRET_KEY: "AWS_SECRET_KEY",
CA_HEALTH_NUMBER: "CA_HEALTH_NUMBER",
CA_SOCIAL_INSURANCE_NUMBER: "CA_SOCIAL_INSURANCE_NUMBER",
CREDIT_DEBIT_CARD_CVV: "CREDIT_DEBIT_CARD_CVV",
CREDIT_DEBIT_CARD_EXPIRY: "CREDIT_DEBIT_CARD_EXPIRY",
CREDIT_DEBIT_CARD_NUMBER: "CREDIT_DEBIT_CARD_NUMBER",
DRIVER_ID: "DRIVER_ID",
EMAIL: "EMAIL",
INTERNATIONAL_BANK_ACCOUNT_NUMBER: "INTERNATIONAL_BANK_ACCOUNT_NUMBER",
IP_ADDRESS: "IP_ADDRESS",
LICENSE_PLATE: "LICENSE_PLATE",
MAC_ADDRESS: "MAC_ADDRESS",
NAME: "NAME",
PASSWORD: "PASSWORD",
PHONE: "PHONE",
PIN: "PIN",
SWIFT_CODE: "SWIFT_CODE",
UK_NATIONAL_HEALTH_SERVICE_NUMBER: "UK_NATIONAL_HEALTH_SERVICE_NUMBER",
UK_NATIONAL_INSURANCE_NUMBER: "UK_NATIONAL_INSURANCE_NUMBER",
UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER: "UK_UNIQUE_TAXPAYER_REFERENCE_NUMBER",
URL: "URL",
USERNAME: "USERNAME",
US_BANK_ACCOUNT_NUMBER: "US_BANK_ACCOUNT_NUMBER",
US_BANK_ROUTING_NUMBER: "US_BANK_ROUTING_NUMBER",
US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER: "US_INDIVIDUAL_TAX_IDENTIFICATION_NUMBER",
US_PASSPORT_NUMBER: "US_PASSPORT_NUMBER",
US_SOCIAL_SECURITY_NUMBER: "US_SOCIAL_SECURITY_NUMBER",
VEHICLE_IDENTIFICATION_NUMBER: "VEHICLE_IDENTIFICATION_NUMBER",
};
const GuardrailTopicPolicyAction = {
BLOCKED: "BLOCKED",
NONE: "NONE",
};
const GuardrailTopicType = {
DENY: "DENY",
};
const GuardrailWordPolicyAction = {
BLOCKED: "BLOCKED",
NONE: "NONE",
};
const GuardrailManagedWordType = {
PROFANITY: "PROFANITY",
};
const GuardrailTrace = {
DISABLED: "disabled",
ENABLED: "enabled",
ENABLED_FULL: "enabled_full",
};
const AudioFormat = {
AAC: "aac",
FLAC: "flac",
M4A: "m4a",
MKA: "mka",
MKV: "mkv",
MP3: "mp3",
MP4: "mp4",
MPEG: "mpeg",
MPGA: "mpga",
OGG: "ogg",
OPUS: "opus",
PCM: "pcm",
WAV: "wav",
WEBM: "webm",
X_AAC: "x-aac",
};
const CacheTTL = {
FIVE_MINUTES: "5m",
ONE_HOUR: "1h",
};
const CachePointType = {
DEFAULT: "default",
};
const DocumentFormat = {
CSV: "csv",
DOC: "doc",
DOCX: "docx",
HTML: "html",
MD: "md",
PDF: "pdf",
TXT: "txt",
XLS: "xls",
XLSX: "xlsx",
};
const GuardrailConverseImageFormat = {
JPEG: "jpeg",
PNG: "png",
};
const GuardrailConverseContentQualifier = {
GROUNDING_SOURCE: "grounding_source",
GUARD_CONTENT: "guard_content",
QUERY: "query",
};
const ImageFormat = {
GIF: "gif",
JPEG: "jpeg",
PNG: "png",
WEBP: "webp",
};
const VideoFormat = {
FLV: "flv",
MKV: "mkv",
MOV: "mov",
MP4: "mp4",
MPEG: "mpeg",
MPG: "mpg",
THREE_GP: "three_gp",
WEBM: "webm",
WMV: "wmv",
};
const ToolResultStatus = {
ERROR: "error",
SUCCESS: "success",
};
const ToolUseType = {
SERVER_TOOL_USE: "server_tool_use",
};
const ConversationRole = {
ASSISTANT: "assistant",
USER: "user",
};
const OutputFormatType = {
JSON_SCHEMA: "json_schema",
};
const PerformanceConfigLatency = {
OPTIMIZED: "optimized",
STANDARD: "standard",
};
const ServiceTierType = {
DEFAULT: "default",
FLEX: "flex",
PRIORITY: "priority",
RESERVED: "reserved",
};
const StopReason = {
CONTENT_FILTERED: "content_filtered",
END_TURN: "end_turn",
GUARDRAIL_INTERVENED: "guardrail_intervened",
MALFORMED_MODEL_OUTPUT: "malformed_model_output",
MALFORMED_TOOL_USE: "malformed_tool_use",
MAX_TOKENS: "max_tokens",
MODEL_CONTEXT_WINDOW_EXCEEDED: "model_context_window_exceeded",
STOP_SEQUENCE: "stop_sequence",
TOOL_USE: "tool_use",
};
const GuardrailStreamProcessingMode = {
ASYNC: "async",
SYNC: "sync",
};
const Trace = {
DISABLED: "DISABLED",
ENABLED: "ENABLED",
ENABLED_FULL: "ENABLED_FULL",
};
exports.$Command = smithyClient.Command;
exports.__Client = smithyClient.Client;
exports.BedrockRuntimeServiceException = BedrockRuntimeServiceException.BedrockRuntimeServiceException;
exports.ApplyGuardrailCommand = ApplyGuardrailCommand;
exports.AsyncInvokeStatus = AsyncInvokeStatus;
exports.AudioFormat = AudioFormat;
exports.BedrockRuntime = BedrockRuntime;
exports.BedrockRuntimeClient = BedrockRuntimeClient;
exports.CachePointType = CachePointType;
exports.CacheTTL = CacheTTL;
exports.ConversationRole = ConversationRole;
exports.ConverseCommand = ConverseCommand;
exports.ConverseStreamCommand = ConverseStreamCommand;
exports.CountTokensCommand = CountTokensCommand;
exports.DocumentFormat = DocumentFormat;
exports.GetAsyncInvokeCommand = GetAsyncInvokeCommand;
exports.GuardrailAction = GuardrailAction;
exports.GuardrailAutomatedReasoningLogicWarningType = GuardrailAutomatedReasoningLogicWarningType;
exports.GuardrailContentFilterConfidence = GuardrailContentFilterConfidence;
exports.GuardrailContentFilterStrength = GuardrailContentFilterStrength;
exports.GuardrailContentFilterType = GuardrailContentFilterType;
exports.GuardrailContentPolicyAction = GuardrailContentPolicyAction;
exports.GuardrailContentQualifier = GuardrailContentQualifier;
exports.GuardrailContentSource = GuardrailContentSource;
exports.GuardrailContextualGroundingFilterType = GuardrailContextualGroundingFilterType;
exports.GuardrailContextualGroundingPolicyAction = GuardrailContextualGroundingPolicyAction;
exports.GuardrailConverseContentQualifier = GuardrailConverseContentQualifier;
exports.GuardrailConverseImageFormat = GuardrailConverseImageFormat;
exports.GuardrailImageFormat = GuardrailImageFormat;
exports.GuardrailManagedWordType = GuardrailManagedWordType;
exports.GuardrailOrigin = GuardrailOrigin;
exports.GuardrailOutputScope = GuardrailOutputScope;
exports.GuardrailOwnership = GuardrailOwnership;
exports.GuardrailPiiEntityType = GuardrailPiiEntityType;
exports.GuardrailSensitiveInformationPolicyAction = GuardrailSensitiveInformationPolicyAction;
exports.GuardrailStreamProcessingMode = GuardrailStreamProcessingMode;
exports.GuardrailTopicPolicyAction = GuardrailTopicPolicyAction;
exports.GuardrailTopicType = GuardrailTopicType;
exports.GuardrailTrace = GuardrailTrace;
exports.GuardrailWordPolicyAction = GuardrailWordPolicyAction;
exports.ImageFormat = ImageFormat;
exports.InvokeModelCommand = InvokeModelCommand;
exports.InvokeModelWithBidirectionalStreamCommand = InvokeModelWithBidirectionalStreamCommand;
exports.InvokeModelWithResponseStreamCommand = InvokeModelWithResponseStreamCommand;
exports.ListAsyncInvokesCommand = ListAsyncInvokesCommand;
exports.OutputFormatType = OutputFormatType;
exports.PerformanceConfigLatency = PerformanceConfigLatency;
exports.ServiceTierType = ServiceTierType;
exports.SortAsyncInvocationBy = SortAsyncInvocationBy;
exports.SortOrder = SortOrder;
exports.StartAsyncInvokeCommand = StartAsyncInvokeCommand;
exports.StopReason = StopReason;
exports.ToolResultStatus = ToolResultStatus;
exports.ToolUseType = ToolUseType;
exports.Trace = Trace;
exports.VideoFormat = VideoFormat;
exports.paginateListAsyncInvokes = paginateListAsyncInvokes;
Object.prototype.hasOwnProperty.call(schemas_0, '__proto__') &&
!Object.prototype.hasOwnProperty.call(exports, '__proto__') &&
Object.defineProperty(exports, '__proto__', {
enumerable: true,
value: schemas_0['__proto__']
});
Object.keys(schemas_0).forEach(function (k) {
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = schemas_0[k];
});
Object.prototype.hasOwnProperty.call(errors, '__proto__') &&
!Object.prototype.hasOwnProperty.call(exports, '__proto__') &&
Object.defineProperty(exports, '__proto__', {
enumerable: true,
value: errors['__proto__']
});
Object.keys(errors).forEach(function (k) {
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = errors[k];
});

View File

@@ -0,0 +1,12 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BedrockRuntimeServiceException = exports.__ServiceException = void 0;
const smithy_client_1 = require("@smithy/smithy-client");
Object.defineProperty(exports, "__ServiceException", { enumerable: true, get: function () { return smithy_client_1.ServiceException; } });
class BedrockRuntimeServiceException extends smithy_client_1.ServiceException {
constructor(options) {
super(options);
Object.setPrototypeOf(this, BedrockRuntimeServiceException.prototype);
}
}
exports.BedrockRuntimeServiceException = BedrockRuntimeServiceException;

View File

@@ -0,0 +1,169 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ModelStreamErrorException = exports.ModelTimeoutException = exports.ModelNotReadyException = exports.ModelErrorException = exports.ServiceUnavailableException = exports.ServiceQuotaExceededException = exports.ResourceNotFoundException = exports.ConflictException = exports.ValidationException = exports.ThrottlingException = exports.InternalServerException = exports.AccessDeniedException = void 0;
const BedrockRuntimeServiceException_1 = require("./BedrockRuntimeServiceException");
class AccessDeniedException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
name = "AccessDeniedException";
$fault = "client";
constructor(opts) {
super({
name: "AccessDeniedException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, AccessDeniedException.prototype);
}
}
exports.AccessDeniedException = AccessDeniedException;
class InternalServerException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
name = "InternalServerException";
$fault = "server";
constructor(opts) {
super({
name: "InternalServerException",
$fault: "server",
...opts,
});
Object.setPrototypeOf(this, InternalServerException.prototype);
}
}
exports.InternalServerException = InternalServerException;
class ThrottlingException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
name = "ThrottlingException";
$fault = "client";
constructor(opts) {
super({
name: "ThrottlingException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, ThrottlingException.prototype);
}
}
exports.ThrottlingException = ThrottlingException;
class ValidationException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
name = "ValidationException";
$fault = "client";
constructor(opts) {
super({
name: "ValidationException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, ValidationException.prototype);
}
}
exports.ValidationException = ValidationException;
class ConflictException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
name = "ConflictException";
$fault = "client";
constructor(opts) {
super({
name: "ConflictException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, ConflictException.prototype);
}
}
exports.ConflictException = ConflictException;
class ResourceNotFoundException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
name = "ResourceNotFoundException";
$fault = "client";
constructor(opts) {
super({
name: "ResourceNotFoundException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, ResourceNotFoundException.prototype);
}
}
exports.ResourceNotFoundException = ResourceNotFoundException;
class ServiceQuotaExceededException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
name = "ServiceQuotaExceededException";
$fault = "client";
constructor(opts) {
super({
name: "ServiceQuotaExceededException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, ServiceQuotaExceededException.prototype);
}
}
exports.ServiceQuotaExceededException = ServiceQuotaExceededException;
class ServiceUnavailableException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
name = "ServiceUnavailableException";
$fault = "server";
constructor(opts) {
super({
name: "ServiceUnavailableException",
$fault: "server",
...opts,
});
Object.setPrototypeOf(this, ServiceUnavailableException.prototype);
}
}
exports.ServiceUnavailableException = ServiceUnavailableException;
class ModelErrorException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
name = "ModelErrorException";
$fault = "client";
originalStatusCode;
resourceName;
constructor(opts) {
super({
name: "ModelErrorException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, ModelErrorException.prototype);
this.originalStatusCode = opts.originalStatusCode;
this.resourceName = opts.resourceName;
}
}
exports.ModelErrorException = ModelErrorException;
class ModelNotReadyException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
name = "ModelNotReadyException";
$fault = "client";
$retryable = {};
constructor(opts) {
super({
name: "ModelNotReadyException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, ModelNotReadyException.prototype);
}
}
exports.ModelNotReadyException = ModelNotReadyException;
class ModelTimeoutException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
name = "ModelTimeoutException";
$fault = "client";
constructor(opts) {
super({
name: "ModelTimeoutException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, ModelTimeoutException.prototype);
}
}
exports.ModelTimeoutException = ModelTimeoutException;
class ModelStreamErrorException extends BedrockRuntimeServiceException_1.BedrockRuntimeServiceException {
name = "ModelStreamErrorException";
$fault = "client";
originalStatusCode;
originalMessage;
constructor(opts) {
super({
name: "ModelStreamErrorException",
$fault: "client",
...opts,
});
Object.setPrototypeOf(this, ModelStreamErrorException.prototype);
this.originalStatusCode = opts.originalStatusCode;
this.originalMessage = opts.originalMessage;
}
}
exports.ModelStreamErrorException = ModelStreamErrorException;

View File

@@ -0,0 +1,43 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRuntimeConfig = void 0;
const tslib_1 = require("tslib");
const package_json_1 = tslib_1.__importDefault(require("../package.json"));
const sha256_browser_1 = require("@aws-crypto/sha256-browser");
const middleware_websocket_1 = require("@aws-sdk/middleware-websocket");
const util_user_agent_browser_1 = require("@aws-sdk/util-user-agent-browser");
const config_resolver_1 = require("@smithy/config-resolver");
const eventstream_serde_browser_1 = require("@smithy/eventstream-serde-browser");
const fetch_http_handler_1 = require("@smithy/fetch-http-handler");
const invalid_dependency_1 = require("@smithy/invalid-dependency");
const smithy_client_1 = require("@smithy/smithy-client");
const util_body_length_browser_1 = require("@smithy/util-body-length-browser");
const util_defaults_mode_browser_1 = require("@smithy/util-defaults-mode-browser");
const util_retry_1 = require("@smithy/util-retry");
const runtimeConfig_shared_1 = require("./runtimeConfig.shared");
const getRuntimeConfig = (config) => {
const defaultsMode = (0, util_defaults_mode_browser_1.resolveDefaultsModeConfig)(config);
const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode);
const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config);
return {
...clientSharedValues,
...config,
runtime: "browser",
defaultsMode,
bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_browser_1.calculateBodyLength,
credentialDefaultProvider: config?.credentialDefaultProvider ?? ((_) => () => Promise.reject(new Error("Credential is missing"))),
defaultUserAgentProvider: config?.defaultUserAgentProvider ?? (0, util_user_agent_browser_1.createDefaultUserAgentProvider)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }),
eventStreamPayloadHandlerProvider: config?.eventStreamPayloadHandlerProvider ?? middleware_websocket_1.eventStreamPayloadHandlerProvider,
eventStreamSerdeProvider: config?.eventStreamSerdeProvider ?? eventstream_serde_browser_1.eventStreamSerdeProvider,
maxAttempts: config?.maxAttempts ?? util_retry_1.DEFAULT_MAX_ATTEMPTS,
region: config?.region ?? (0, invalid_dependency_1.invalidProvider)("Region is missing"),
requestHandler: middleware_websocket_1.WebSocketFetchHandler.create(config?.requestHandler
?? defaultConfigProvider, fetch_http_handler_1.FetchHttpHandler.create(defaultConfigProvider)),
retryMode: config?.retryMode ?? (async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE),
sha256: config?.sha256 ?? sha256_browser_1.Sha256,
streamCollector: config?.streamCollector ?? fetch_http_handler_1.streamCollector,
useDualstackEndpoint: config?.useDualstackEndpoint ?? (() => Promise.resolve(config_resolver_1.DEFAULT_USE_DUALSTACK_ENDPOINT)),
useFipsEndpoint: config?.useFipsEndpoint ?? (() => Promise.resolve(config_resolver_1.DEFAULT_USE_FIPS_ENDPOINT)),
};
};
exports.getRuntimeConfig = getRuntimeConfig;

View File

@@ -0,0 +1,83 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRuntimeConfig = void 0;
const tslib_1 = require("tslib");
const package_json_1 = tslib_1.__importDefault(require("../package.json"));
const client_1 = require("@aws-sdk/core/client");
const httpAuthSchemes_1 = require("@aws-sdk/core/httpAuthSchemes");
const credential_provider_node_1 = require("@aws-sdk/credential-provider-node");
const eventstream_handler_node_1 = require("@aws-sdk/eventstream-handler-node");
const token_providers_1 = require("@aws-sdk/token-providers");
const util_user_agent_node_1 = require("@aws-sdk/util-user-agent-node");
const config_resolver_1 = require("@smithy/config-resolver");
const core_1 = require("@smithy/core");
const eventstream_serde_node_1 = require("@smithy/eventstream-serde-node");
const hash_node_1 = require("@smithy/hash-node");
const middleware_retry_1 = require("@smithy/middleware-retry");
const node_config_provider_1 = require("@smithy/node-config-provider");
const node_http_handler_1 = require("@smithy/node-http-handler");
const smithy_client_1 = require("@smithy/smithy-client");
const util_body_length_node_1 = require("@smithy/util-body-length-node");
const util_defaults_mode_node_1 = require("@smithy/util-defaults-mode-node");
const util_retry_1 = require("@smithy/util-retry");
const runtimeConfig_shared_1 = require("./runtimeConfig.shared");
const getRuntimeConfig = (config) => {
(0, smithy_client_1.emitWarningIfUnsupportedVersion)(process.version);
const defaultsMode = (0, util_defaults_mode_node_1.resolveDefaultsModeConfig)(config);
const defaultConfigProvider = () => defaultsMode().then(smithy_client_1.loadConfigsForDefaultMode);
const clientSharedValues = (0, runtimeConfig_shared_1.getRuntimeConfig)(config);
(0, client_1.emitWarningIfUnsupportedVersion)(process.version);
const loaderConfig = {
profile: config?.profile,
logger: clientSharedValues.logger,
signingName: "bedrock",
};
return {
...clientSharedValues,
...config,
runtime: "node",
defaultsMode,
authSchemePreference: config?.authSchemePreference ?? (0, node_config_provider_1.loadConfig)(httpAuthSchemes_1.NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, loaderConfig),
bodyLengthChecker: config?.bodyLengthChecker ?? util_body_length_node_1.calculateBodyLength,
credentialDefaultProvider: config?.credentialDefaultProvider ?? credential_provider_node_1.defaultProvider,
defaultUserAgentProvider: config?.defaultUserAgentProvider ?? (0, util_user_agent_node_1.createDefaultUserAgentProvider)({ serviceId: clientSharedValues.serviceId, clientVersion: package_json_1.default.version }),
eventStreamPayloadHandlerProvider: config?.eventStreamPayloadHandlerProvider ?? eventstream_handler_node_1.eventStreamPayloadHandlerProvider,
eventStreamSerdeProvider: config?.eventStreamSerdeProvider ?? eventstream_serde_node_1.eventStreamSerdeProvider,
httpAuthSchemes: config?.httpAuthSchemes ?? [
{
schemeId: "aws.auth#sigv4",
identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
signer: new httpAuthSchemes_1.AwsSdkSigV4Signer(),
},
{
schemeId: "smithy.api#httpBearerAuth",
identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#httpBearerAuth") || (async (idProps) => {
try {
return await (0, token_providers_1.fromEnvSigningName)({ signingName: "bedrock" })();
}
catch (error) {
return await (0, token_providers_1.nodeProvider)(idProps)(idProps);
}
}),
signer: new core_1.HttpBearerAuthSigner(),
},
],
maxAttempts: config?.maxAttempts ?? (0, node_config_provider_1.loadConfig)(middleware_retry_1.NODE_MAX_ATTEMPT_CONFIG_OPTIONS, config),
region: config?.region ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_REGION_CONFIG_OPTIONS, { ...config_resolver_1.NODE_REGION_CONFIG_FILE_OPTIONS, ...loaderConfig }),
requestHandler: node_http_handler_1.NodeHttp2Handler.create(config?.requestHandler ?? (async () => ({
...await defaultConfigProvider(),
disableConcurrentStreams: true
}))),
retryMode: config?.retryMode ??
(0, node_config_provider_1.loadConfig)({
...middleware_retry_1.NODE_RETRY_MODE_CONFIG_OPTIONS,
default: async () => (await defaultConfigProvider()).retryMode || util_retry_1.DEFAULT_RETRY_MODE,
}, config),
sha256: config?.sha256 ?? hash_node_1.Hash.bind(null, "sha256"),
streamCollector: config?.streamCollector ?? node_http_handler_1.streamCollector,
useDualstackEndpoint: config?.useDualstackEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
useFipsEndpoint: config?.useFipsEndpoint ?? (0, node_config_provider_1.loadConfig)(config_resolver_1.NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, loaderConfig),
userAgentAppId: config?.userAgentAppId ?? (0, node_config_provider_1.loadConfig)(util_user_agent_node_1.NODE_APP_ID_CONFIG_OPTIONS, loaderConfig),
};
};
exports.getRuntimeConfig = getRuntimeConfig;

View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRuntimeConfig = void 0;
const sha256_js_1 = require("@aws-crypto/sha256-js");
const invalid_dependency_1 = require("@smithy/invalid-dependency");
const runtimeConfig_browser_1 = require("./runtimeConfig.browser");
const getRuntimeConfig = (config) => {
const browserDefaults = (0, runtimeConfig_browser_1.getRuntimeConfig)(config);
return {
...browserDefaults,
...config,
runtime: "react-native",
eventStreamPayloadHandlerProvider: config?.eventStreamPayloadHandlerProvider ?? (() => ({
handle: (0, invalid_dependency_1.invalidFunction)("event stream request is not supported in ReactNative."),
})),
sha256: config?.sha256 ?? sha256_js_1.Sha256,
};
};
exports.getRuntimeConfig = getRuntimeConfig;

View File

@@ -0,0 +1,49 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRuntimeConfig = void 0;
const httpAuthSchemes_1 = require("@aws-sdk/core/httpAuthSchemes");
const protocols_1 = require("@aws-sdk/core/protocols");
const core_1 = require("@smithy/core");
const smithy_client_1 = require("@smithy/smithy-client");
const url_parser_1 = require("@smithy/url-parser");
const util_base64_1 = require("@smithy/util-base64");
const util_utf8_1 = require("@smithy/util-utf8");
const httpAuthSchemeProvider_1 = require("./auth/httpAuthSchemeProvider");
const endpointResolver_1 = require("./endpoint/endpointResolver");
const schemas_0_1 = require("./schemas/schemas_0");
const getRuntimeConfig = (config) => {
return {
apiVersion: "2023-09-30",
base64Decoder: config?.base64Decoder ?? util_base64_1.fromBase64,
base64Encoder: config?.base64Encoder ?? util_base64_1.toBase64,
disableHostPrefix: config?.disableHostPrefix ?? false,
endpointProvider: config?.endpointProvider ?? endpointResolver_1.defaultEndpointResolver,
extensions: config?.extensions ?? [],
httpAuthSchemeProvider: config?.httpAuthSchemeProvider ?? httpAuthSchemeProvider_1.defaultBedrockRuntimeHttpAuthSchemeProvider,
httpAuthSchemes: config?.httpAuthSchemes ?? [
{
schemeId: "aws.auth#sigv4",
identityProvider: (ipc) => ipc.getIdentityProvider("aws.auth#sigv4"),
signer: new httpAuthSchemes_1.AwsSdkSigV4Signer(),
},
{
schemeId: "smithy.api#httpBearerAuth",
identityProvider: (ipc) => ipc.getIdentityProvider("smithy.api#httpBearerAuth"),
signer: new core_1.HttpBearerAuthSigner(),
},
],
logger: config?.logger ?? new smithy_client_1.NoOpLogger(),
protocol: config?.protocol ?? protocols_1.AwsRestJsonProtocol,
protocolSettings: config?.protocolSettings ?? {
defaultNamespace: "com.amazonaws.bedrockruntime",
errorTypeRegistries: schemas_0_1.errorTypeRegistries,
version: "2023-09-30",
serviceTarget: "AmazonBedrockFrontendService",
},
serviceId: config?.serviceId ?? "Bedrock Runtime",
urlParser: config?.urlParser ?? url_parser_1.parseUrl,
utf8Decoder: config?.utf8Decoder ?? util_utf8_1.fromUtf8,
utf8Encoder: config?.utf8Encoder ?? util_utf8_1.toUtf8,
};
};
exports.getRuntimeConfig = getRuntimeConfig;