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,14 @@
import { AwsCredentialIdentityProvider } from '@smithy/types';
import { MergedRequestInit } from "../internal/types.mjs";
type AuthProps = {
url: string;
regionName: string;
awsAccessKey: string | null | undefined;
awsSecretKey: string | null | undefined;
awsSessionToken: string | null | undefined;
fetchOptions?: MergedRequestInit | undefined;
providerChainResolver?: (() => Promise<AwsCredentialIdentityProvider>) | null;
};
export declare const getAuthHeaders: (req: RequestInit, props: AuthProps) => Promise<Record<string, string>>;
export {};
//# sourceMappingURL=auth.d.mts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"auth.d.mts","sourceRoot":"","sources":["../src/core/auth.ts"],"names":[],"mappings":"OAIO,EAAE,6BAA6B,EAAE,MAAM,eAAe;OAEtD,EAAE,iBAAiB,EAAE;AAE5B,KAAK,SAAS,GAAG;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACxC,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACxC,eAAe,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC3C,YAAY,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAC7C,qBAAqB,CAAC,EAAE,CAAC,MAAM,OAAO,CAAC,6BAA6B,CAAC,CAAC,GAAG,IAAI,CAAC;CAC/E,CAAC;AA0BF,eAAO,MAAM,cAAc,GAAU,KAAK,WAAW,EAAE,OAAO,SAAS,KAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAgDvG,CAAC"}

View File

@@ -0,0 +1,14 @@
import { AwsCredentialIdentityProvider } from '@smithy/types';
import { MergedRequestInit } from "../internal/types.js";
type AuthProps = {
url: string;
regionName: string;
awsAccessKey: string | null | undefined;
awsSecretKey: string | null | undefined;
awsSessionToken: string | null | undefined;
fetchOptions?: MergedRequestInit | undefined;
providerChainResolver?: (() => Promise<AwsCredentialIdentityProvider>) | null;
};
export declare const getAuthHeaders: (req: RequestInit, props: AuthProps) => Promise<Record<string, string>>;
export {};
//# sourceMappingURL=auth.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/core/auth.ts"],"names":[],"mappings":"OAIO,EAAE,6BAA6B,EAAE,MAAM,eAAe;OAEtD,EAAE,iBAAiB,EAAE;AAE5B,KAAK,SAAS,GAAG;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACxC,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACxC,eAAe,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC3C,YAAY,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAC7C,qBAAqB,CAAC,EAAE,CAAC,MAAM,OAAO,CAAC,6BAA6B,CAAC,CAAC,GAAG,IAAI,CAAC;CAC/E,CAAC;AA0BF,eAAO,MAAM,cAAc,GAAU,KAAK,WAAW,EAAE,OAAO,SAAS,KAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAgDvG,CAAC"}

View File

@@ -0,0 +1,105 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getAuthHeaders = void 0;
const sha256_js_1 = require("@aws-crypto/sha256-js");
const fetch_http_handler_1 = require("@smithy/fetch-http-handler");
const protocol_http_1 = require("@smithy/protocol-http");
const signature_v4_1 = require("@smithy/signature-v4");
const assert_1 = __importDefault(require("assert"));
const DEFAULT_PROVIDER_CHAIN_RESOLVER = () => Promise.resolve().then(() => __importStar(require('@aws-sdk/credential-providers'))).then(({ fromNodeProviderChain }) => fromNodeProviderChain({
clientConfig: {
requestHandler: new fetch_http_handler_1.FetchHttpHandler({
requestInit: (httpRequest) => {
return {
...httpRequest,
};
},
}),
},
}))
.catch((error) => {
throw new Error(`Failed to import '@aws-sdk/credential-providers'.` +
`You can provide a custom \`providerChainResolver\` in the client options if your runtime does not have access to '@aws-sdk/credential-providers': ` +
`\`new AnthropicBedrock({ providerChainResolver })\` ` +
`Original error: ${error.message}`);
});
const getAuthHeaders = async (req, props) => {
(0, assert_1.default)(req.method, 'Expected request method property to be set');
let credentials;
if (props.awsAccessKey && props.awsSecretKey) {
credentials = {
accessKeyId: props.awsAccessKey,
secretAccessKey: props.awsSecretKey,
...(props.awsSessionToken != null && { sessionToken: props.awsSessionToken }),
};
}
else {
const provider = await (props.providerChainResolver ?
props.providerChainResolver()
: DEFAULT_PROVIDER_CHAIN_RESOLVER());
credentials = await provider();
}
const signer = new signature_v4_1.SignatureV4({
service: 'bedrock',
region: props.regionName,
credentials,
sha256: sha256_js_1.Sha256,
});
const url = new URL(props.url);
const headers = !req.headers ? {}
: Symbol.iterator in req.headers ?
Object.fromEntries(Array.from(req.headers).map((header) => [...header]))
: { ...req.headers };
// The connection header may be stripped by a proxy somewhere, so the receiver
// of this message may not see this header, so we remove it from the set of headers
// that are signed.
delete headers['connection'];
headers['host'] = url.hostname;
const request = new protocol_http_1.HttpRequest({
method: req.method.toUpperCase(),
protocol: url.protocol,
path: url.pathname,
headers,
body: req.body,
});
const signed = await signer.sign(request);
return signed.headers;
};
exports.getAuthHeaders = getAuthHeaders;
//# sourceMappingURL=auth.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/core/auth.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAA+C;AAC/C,mEAA8D;AAC9D,yDAAoD;AACpD,uDAAmD;AAEnD,oDAA4B;AAa5B,MAAM,+BAA+B,GAAiD,GAAG,EAAE,CACzF,kDAAO,+BAA+B,IACnC,IAAI,CAAC,CAAC,EAAE,qBAAqB,EAAE,EAAE,EAAE,CAClC,qBAAqB,CAAC;IACpB,YAAY,EAAE;QACZ,cAAc,EAAE,IAAI,qCAAgB,CAAC;YACnC,WAAW,EAAE,CAAC,WAAW,EAAE,EAAE;gBAC3B,OAAO;oBACL,GAAG,WAAW;iBACA,CAAC;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AAI,GAAG,CAAC,OAAO,CAAC,CAAC;YAChC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;YAC1E,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;IAEvB,8EAA8E;IAC9E,mFAAmF;IACnF,mBAAmB;IACnB,OAAO,OAAO,CAAC,YAAY,CAAC,CAAC;IAC7B,OAAO,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,QAAQ,CAAC;IAE/B,MAAM,OAAO,GAAG,IAAI,2BAAW,CAAC;QAC9B,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE;QAChC,QAAQ,EAAE,GAAG,CAAC,QAAQ;QACtB,IAAI,EAAE,GAAG,CAAC,QAAQ;QAClB,OAAO;QACP,IAAI,EAAE,GAAG,CAAC,IAAI;KACf,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1C,OAAO,MAAM,CAAC,OAAO,CAAC;AACxB,CAAC,CAAC;AAhDW,QAAA,cAAc,kBAgDzB"}

View File

@@ -0,0 +1,65 @@
import { Sha256 } from '@aws-crypto/sha256-js';
import { FetchHttpHandler } from '@smithy/fetch-http-handler';
import { HttpRequest } from '@smithy/protocol-http';
import { SignatureV4 } from '@smithy/signature-v4';
import assert from 'assert';
const DEFAULT_PROVIDER_CHAIN_RESOLVER = () => import('@aws-sdk/credential-providers').then(({ fromNodeProviderChain }) => fromNodeProviderChain({
clientConfig: {
requestHandler: new FetchHttpHandler({
requestInit: (httpRequest) => {
return {
...httpRequest,
};
},
}),
},
}))
.catch((error) => {
throw new Error(`Failed to import '@aws-sdk/credential-providers'.` +
`You can provide a custom \`providerChainResolver\` in the client options if your runtime does not have access to '@aws-sdk/credential-providers': ` +
`\`new AnthropicBedrock({ providerChainResolver })\` ` +
`Original error: ${error.message}`);
});
export const getAuthHeaders = async (req, props) => {
assert(req.method, 'Expected request method property to be set');
let credentials;
if (props.awsAccessKey && props.awsSecretKey) {
credentials = {
accessKeyId: props.awsAccessKey,
secretAccessKey: props.awsSecretKey,
...(props.awsSessionToken != null && { sessionToken: props.awsSessionToken }),
};
}
else {
const provider = await (props.providerChainResolver ?
props.providerChainResolver()
: DEFAULT_PROVIDER_CHAIN_RESOLVER());
credentials = await provider();
}
const signer = new SignatureV4({
service: 'bedrock',
region: props.regionName,
credentials,
sha256: Sha256,
});
const url = new URL(props.url);
const headers = !req.headers ? {}
: Symbol.iterator in req.headers ?
Object.fromEntries(Array.from(req.headers).map((header) => [...header]))
: { ...req.headers };
// The connection header may be stripped by a proxy somewhere, so the receiver
// of this message may not see this header, so we remove it from the set of headers
// that are signed.
delete headers['connection'];
headers['host'] = url.hostname;
const request = new HttpRequest({
method: req.method.toUpperCase(),
protocol: url.protocol,
path: url.pathname,
headers,
body: req.body,
});
const signed = await signer.sign(request);
return signed.headers;
};
//# sourceMappingURL=auth.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"auth.mjs","sourceRoot":"","sources":["../src/core/auth.ts"],"names":[],"mappings":"OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB;OACvC,EAAE,gBAAgB,EAAE,MAAM,4BAA4B;OACtD,EAAE,WAAW,EAAE,MAAM,uBAAuB;OAC5C,EAAE,WAAW,EAAE,MAAM,sBAAsB;OAE3C,MAAM,MAAM,QAAQ;AAa3B,MAAM,+BAA+B,GAAiD,GAAG,EAAE,CACzF,MAAM,CAAC,+BAA+B,EACnC,IAAI,CAAC,CAAC,EAAE,qBAAqB,EAAE,EAAE,EAAE,CAClC,qBAAqB,CAAC;IACpB,YAAY,EAAE;QACZ,cAAc,EAAE,IAAI,gBAAgB,CAAC;YACnC,WAAW,EAAE,CAAC,WAAW,EAAE,EAAE;gBAC3B,OA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jB,CAAC,CAAC,MAAM,CAAC,QAAQ,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;YAChC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;YAC1E,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;IAEvB,8EAA8E;IAC9E,mFAAmF;IACnF,mBAAmB;IACnB,OAAO,OAAO,CAAC,YAAY,CAAC,CAAC;IAC7B,OAAO,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,QAAQ,CAAC;IAE/B,MAAM,OAAO,GAAG,IAAI,WAAW,CAAC;QAC9B,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,WAAW,EAAE;QAChC,QAAQ,EAAE,GAAG,CAAC,QAAQ;QACtB,IAAI,EAAE,GAAG,CAAC,QAAQ;QAClB,OAAO;QACP,IAAI,EAAE,GAAG,CAAC,IAAI;KACf,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC1C,OAAO,MAAM,CAAC,OAAO,CAAC;AACxB,CAAC,CAAC"}

View File

@@ -0,0 +1,2 @@
export * from '@anthropic-ai/sdk/core/error';
//# sourceMappingURL=error.d.mts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"error.d.mts","sourceRoot":"","sources":["../src/core/error.ts"],"names":[],"mappings":"cAAc,8BAA8B"}

View File

@@ -0,0 +1,2 @@
export * from '@anthropic-ai/sdk/core/error';
//# sourceMappingURL=error.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/core/error.ts"],"names":[],"mappings":"cAAc,8BAA8B"}

View File

@@ -0,0 +1,18 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("@anthropic-ai/sdk/core/error"), exports);
//# sourceMappingURL=error.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"error.js","sourceRoot":"","sources":["../src/core/error.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+DAA6C"}

View File

@@ -0,0 +1,2 @@
export * from '@anthropic-ai/sdk/core/error';
//# sourceMappingURL=error.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"error.mjs","sourceRoot":"","sources":["../src/core/error.ts"],"names":[],"mappings":"cAAc,8BAA8B"}

View File

@@ -0,0 +1,2 @@
export * from '@anthropic-ai/sdk/core/pagination';
//# sourceMappingURL=pagination.d.mts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"pagination.d.mts","sourceRoot":"","sources":["../src/core/pagination.ts"],"names":[],"mappings":"cAAc,mCAAmC"}

View File

@@ -0,0 +1,2 @@
export * from '@anthropic-ai/sdk/core/pagination';
//# sourceMappingURL=pagination.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../src/core/pagination.ts"],"names":[],"mappings":"cAAc,mCAAmC"}

View File

@@ -0,0 +1,18 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("@anthropic-ai/sdk/core/pagination"), exports);
//# sourceMappingURL=pagination.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../src/core/pagination.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oEAAkD"}

View File

@@ -0,0 +1,2 @@
export * from '@anthropic-ai/sdk/core/pagination';
//# sourceMappingURL=pagination.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"pagination.mjs","sourceRoot":"","sources":["../src/core/pagination.ts"],"names":[],"mappings":"cAAc,mCAAmC"}

View File

@@ -0,0 +1,10 @@
import { EventStreamSerdeContext, SerdeContext } from '@smithy/types';
import { Stream as CoreStream } from '@anthropic-ai/sdk/streaming';
import { BaseAnthropic } from '@anthropic-ai/sdk';
export declare const toUtf8: (input: Uint8Array) => string;
export declare const fromUtf8: (input: string) => Uint8Array;
export declare const getMinimalSerdeContext: () => SerdeContext & EventStreamSerdeContext;
export declare class Stream<Item> extends CoreStream<Item> {
static fromSSEResponse<Item>(response: Response, controller: AbortController, client?: BaseAnthropic): Stream<Item>;
}
//# sourceMappingURL=streaming.d.mts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"streaming.d.mts","sourceRoot":"","sources":["../src/core/streaming.ts"],"names":[],"mappings":"OAGO,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,eAAe;OAC9D,EAAE,MAAM,IAAI,UAAU,EAAmB,MAAM,6BAA6B;OAE5E,EAAY,aAAa,EAAE,MAAM,mBAAmB;AAQ3D,eAAO,MAAM,MAAM,GAAI,OAAO,UAAU,KAAG,MAAgD,CAAC;AAC5F,eAAO,MAAM,QAAQ,GAAI,OAAO,MAAM,KAAG,UAA6C,CAAC;AAKvF,eAAO,MAAM,sBAAsB,QAAO,YAAY,GAAG,uBAUxD,CAAC;AAEF,qBAAa,MAAM,CAAC,IAAI,CAAE,SAAQ,UAAU,CAAC,IAAI,CAAC;WAChC,eAAe,CAAC,IAAI,EAClC,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,eAAe,EAC3B,MAAM,CAAC,EAAE,aAAa;CAqEzB"}

View File

@@ -0,0 +1,10 @@
import { EventStreamSerdeContext, SerdeContext } from '@smithy/types';
import { Stream as CoreStream } from '@anthropic-ai/sdk/streaming';
import { BaseAnthropic } from '@anthropic-ai/sdk';
export declare const toUtf8: (input: Uint8Array) => string;
export declare const fromUtf8: (input: string) => Uint8Array;
export declare const getMinimalSerdeContext: () => SerdeContext & EventStreamSerdeContext;
export declare class Stream<Item> extends CoreStream<Item> {
static fromSSEResponse<Item>(response: Response, controller: AbortController, client?: BaseAnthropic): Stream<Item>;
}
//# sourceMappingURL=streaming.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"streaming.d.ts","sourceRoot":"","sources":["../src/core/streaming.ts"],"names":[],"mappings":"OAGO,EAAE,uBAAuB,EAAE,YAAY,EAAE,MAAM,eAAe;OAC9D,EAAE,MAAM,IAAI,UAAU,EAAmB,MAAM,6BAA6B;OAE5E,EAAY,aAAa,EAAE,MAAM,mBAAmB;AAQ3D,eAAO,MAAM,MAAM,GAAI,OAAO,UAAU,KAAG,MAAgD,CAAC;AAC5F,eAAO,MAAM,QAAQ,GAAI,OAAO,MAAM,KAAG,UAA6C,CAAC;AAKvF,eAAO,MAAM,sBAAsB,QAAO,YAAY,GAAG,uBAUxD,CAAC;AAEF,qBAAa,MAAM,CAAC,IAAI,CAAE,SAAQ,UAAU,CAAC,IAAI,CAAC;WAChC,eAAe,CAAC,IAAI,EAClC,QAAQ,EAAE,QAAQ,EAClB,UAAU,EAAE,eAAe,EAC3B,MAAM,CAAC,EAAE,aAAa;CAqEzB"}

View File

@@ -0,0 +1,115 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Stream = exports.getMinimalSerdeContext = exports.fromUtf8 = exports.toUtf8 = void 0;
const eventstream_serde_node_1 = require("@smithy/eventstream-serde-node");
const util_base64_1 = require("@smithy/util-base64");
const fetch_http_handler_1 = require("@smithy/fetch-http-handler");
const streaming_1 = require("@anthropic-ai/sdk/streaming");
const error_1 = require("@anthropic-ai/sdk/error");
const sdk_1 = require("@anthropic-ai/sdk");
const AWS_restJson1_1 = require("../AWS_restJson1.js");
const shims_1 = require("../internal/shims.js");
const values_1 = require("../internal/utils/values.js");
const log_1 = require("../internal/utils/log.js");
const toUtf8 = (input) => new TextDecoder('utf-8').decode(input);
exports.toUtf8 = toUtf8;
const fromUtf8 = (input) => new TextEncoder().encode(input);
exports.fromUtf8 = fromUtf8;
// `de_ResponseStream` parses a Bedrock response stream and emits events as they are found.
// It requires a "context" argument which has many fields, but for what we're using it for
// it only needs this.
const getMinimalSerdeContext = () => {
const marshaller = new eventstream_serde_node_1.EventStreamMarshaller({ utf8Encoder: exports.toUtf8, utf8Decoder: exports.fromUtf8 });
return {
base64Decoder: util_base64_1.fromBase64,
base64Encoder: util_base64_1.toBase64,
utf8Decoder: exports.fromUtf8,
utf8Encoder: exports.toUtf8,
eventStreamMarshaller: marshaller,
streamCollector: fetch_http_handler_1.streamCollector,
};
};
exports.getMinimalSerdeContext = getMinimalSerdeContext;
class Stream extends streaming_1.Stream {
static fromSSEResponse(response, controller, client) {
let consumed = false;
const logger = client ? (0, log_1.loggerFor)(client) : console;
async function* iterMessages() {
if (!response.body) {
controller.abort();
throw new error_1.AnthropicError(`Attempted to iterate over a response with no body`);
}
const responseBodyIter = (0, shims_1.ReadableStreamToAsyncIterable)(response.body);
const eventStream = (0, AWS_restJson1_1.de_ResponseStream)(responseBodyIter, (0, exports.getMinimalSerdeContext)());
for await (const event of eventStream) {
if (event.chunk && event.chunk.bytes) {
const s = (0, exports.toUtf8)(event.chunk.bytes);
yield { event: 'chunk', data: s, raw: [] };
}
else if (event.internalServerException) {
yield { event: 'error', data: 'InternalServerException', raw: [] };
}
else if (event.modelStreamErrorException) {
yield { event: 'error', data: 'ModelStreamErrorException', raw: [] };
}
else if (event.validationException) {
yield { event: 'error', data: 'ValidationException', raw: [] };
}
else if (event.throttlingException) {
yield { event: 'error', data: 'ThrottlingException', raw: [] };
}
}
}
// Note: this function is copied entirely from the core SDK
async function* iterator() {
if (consumed) {
throw new Error('Cannot iterate over a consumed stream, use `.tee()` to split the stream.');
}
consumed = true;
let done = false;
try {
for await (const sse of iterMessages()) {
if (sse.event === 'chunk') {
try {
yield JSON.parse(sse.data);
}
catch (e) {
logger.error(`Could not parse message into JSON:`, sse.data);
logger.error(`From chunk:`, sse.raw);
throw e;
}
}
if (sse.event === 'error') {
const errText = sse.data;
const errJSON = (0, values_1.safeJSON)(errText);
const errMessage = errJSON ? undefined : errText;
throw sdk_1.APIError.generate(undefined, errJSON, errMessage, response.headers);
}
}
done = true;
}
catch (e) {
// If the user calls `stream.controller.abort()`, we should exit without throwing.
if (isAbortError(e))
return;
throw e;
}
finally {
// If the user `break`s, abort the ongoing request.
if (!done)
controller.abort();
}
}
return new Stream(iterator, controller);
}
}
exports.Stream = Stream;
function isAbortError(err) {
return (typeof err === 'object' &&
err !== null &&
// Spec-compliant fetch implementations
(('name' in err && err.name === 'AbortError') ||
// Expo fetch
('message' in err && String(err.message).includes('FetchRequestCanceledException'))));
}
//# sourceMappingURL=streaming.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"streaming.js","sourceRoot":"","sources":["../src/core/streaming.ts"],"names":[],"mappings":";;;AAAA,2EAAuE;AACvE,qDAA2D;AAC3D,mEAA6D;AAE7D,2DAAoF;AACpF,mDAAyD;AACzD,2CAA4D;AAC5D,uDAAqD;AACrD,gDAAkE;AAClE,wDAAoD;AACpD,kDAAkD;AAI3C,MAAM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AAE,UAAU,CAAC,CAAC;IAC1C,CAAC;CACF;AAzED,wBAyEC;AAED,SAAS,YAAY,CAAC,GAAY;IAChC,OAAO,CACL,OAAO,GAAG,KAAK,QAAQ;QACvB,GAAG,KAAK,IAAI;QACZ,uCAAuC;QACvC,CAAC,CAAC,MAAM,IAAI,GAAG,IAAK,GAAW,CAAC,IAAI,KAAK,YAAY,CAAC;YACpD,aAAa;YACb,CAAC,SAAS,IAAI,GAAG,IAAI,MAAM,CAAE,GAAW,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,+BAA+B,CAAC,CAAC,CAAC,CAChG,CAAC;AACJ,CAAC"}

View File

@@ -0,0 +1,108 @@
import { EventStreamMarshaller } from '@smithy/eventstream-serde-node';
import { fromBase64, toBase64 } from '@smithy/util-base64';
import { streamCollector } from '@smithy/fetch-http-handler';
import { Stream as CoreStream } from '@anthropic-ai/sdk/streaming';
import { AnthropicError } from '@anthropic-ai/sdk/error';
import { APIError } from '@anthropic-ai/sdk';
import { de_ResponseStream } from "../AWS_restJson1.mjs";
import { ReadableStreamToAsyncIterable } from "../internal/shims.mjs";
import { safeJSON } from "../internal/utils/values.mjs";
import { loggerFor } from "../internal/utils/log.mjs";
export const toUtf8 = (input) => new TextDecoder('utf-8').decode(input);
export const fromUtf8 = (input) => new TextEncoder().encode(input);
// `de_ResponseStream` parses a Bedrock response stream and emits events as they are found.
// It requires a "context" argument which has many fields, but for what we're using it for
// it only needs this.
export const getMinimalSerdeContext = () => {
const marshaller = new EventStreamMarshaller({ utf8Encoder: toUtf8, utf8Decoder: fromUtf8 });
return {
base64Decoder: fromBase64,
base64Encoder: toBase64,
utf8Decoder: fromUtf8,
utf8Encoder: toUtf8,
eventStreamMarshaller: marshaller,
streamCollector: streamCollector,
};
};
export class Stream extends CoreStream {
static fromSSEResponse(response, controller, client) {
let consumed = false;
const logger = client ? loggerFor(client) : console;
async function* iterMessages() {
if (!response.body) {
controller.abort();
throw new AnthropicError(`Attempted to iterate over a response with no body`);
}
const responseBodyIter = ReadableStreamToAsyncIterable(response.body);
const eventStream = de_ResponseStream(responseBodyIter, getMinimalSerdeContext());
for await (const event of eventStream) {
if (event.chunk && event.chunk.bytes) {
const s = toUtf8(event.chunk.bytes);
yield { event: 'chunk', data: s, raw: [] };
}
else if (event.internalServerException) {
yield { event: 'error', data: 'InternalServerException', raw: [] };
}
else if (event.modelStreamErrorException) {
yield { event: 'error', data: 'ModelStreamErrorException', raw: [] };
}
else if (event.validationException) {
yield { event: 'error', data: 'ValidationException', raw: [] };
}
else if (event.throttlingException) {
yield { event: 'error', data: 'ThrottlingException', raw: [] };
}
}
}
// Note: this function is copied entirely from the core SDK
async function* iterator() {
if (consumed) {
throw new Error('Cannot iterate over a consumed stream, use `.tee()` to split the stream.');
}
consumed = true;
let done = false;
try {
for await (const sse of iterMessages()) {
if (sse.event === 'chunk') {
try {
yield JSON.parse(sse.data);
}
catch (e) {
logger.error(`Could not parse message into JSON:`, sse.data);
logger.error(`From chunk:`, sse.raw);
throw e;
}
}
if (sse.event === 'error') {
const errText = sse.data;
const errJSON = safeJSON(errText);
const errMessage = errJSON ? undefined : errText;
throw APIError.generate(undefined, errJSON, errMessage, response.headers);
}
}
done = true;
}
catch (e) {
// If the user calls `stream.controller.abort()`, we should exit without throwing.
if (isAbortError(e))
return;
throw e;
}
finally {
// If the user `break`s, abort the ongoing request.
if (!done)
controller.abort();
}
}
return new Stream(iterator, controller);
}
}
function isAbortError(err) {
return (typeof err === 'object' &&
err !== null &&
// Spec-compliant fetch implementations
(('name' in err && err.name === 'AbortError') ||
// Expo fetch
('message' in err && String(err.message).includes('FetchRequestCanceledException'))));
}
//# sourceMappingURL=streaming.mjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"streaming.mjs","sourceRoot":"","sources":["../src/core/streaming.ts"],"names":[],"mappings":"OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC;OAC/D,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,qBAAqB;OACnD,E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