@tencent-ai/agent-sdk 0.1.0-next.989 → 0.1.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/README.md +73 -2
- package/cli/CHANGELOG.md +2418 -0
- package/cli/LICENSE.txt +19 -0
- package/cli/README.md +26 -0
- package/cli/bin/codebuddy +39 -0
- package/cli/dist/codebuddy.js +20 -0
- package/cli/package.json +44 -0
- package/cli/product.cloudhosted.json +242 -0
- package/cli/product.internal.json +244 -0
- package/cli/product.ioa.json +467 -0
- package/cli/product.json +948 -0
- package/cli/product.selfhosted.json +196 -0
- package/cli/vendor/ripgrep/COPYING +3 -0
- package/cli/vendor/ripgrep/arm64-darwin/rg +0 -0
- package/cli/vendor/ripgrep/arm64-darwin/ripgrep.node +0 -0
- package/cli/vendor/ripgrep/arm64-linux/rg +0 -0
- package/cli/vendor/ripgrep/arm64-linux/ripgrep.node +0 -0
- package/cli/vendor/ripgrep/x64-darwin/rg +0 -0
- package/cli/vendor/ripgrep/x64-darwin/ripgrep.node +0 -0
- package/cli/vendor/ripgrep/x64-linux/rg +0 -0
- package/cli/vendor/ripgrep/x64-linux/ripgrep.node +0 -0
- package/cli/vendor/ripgrep/x64-win32/rg.exe +0 -0
- package/cli/vendor/ripgrep/x64-win32/ripgrep.node +0 -0
- package/lib/errors.d.ts +10 -0
- package/lib/errors.d.ts.map +1 -0
- package/lib/errors.js +17 -0
- package/lib/errors.js.map +1 -0
- package/lib/index.d.ts +36 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +40 -0
- package/lib/index.js.map +1 -0
- package/lib/package.spec.js +3 -2
- package/lib/package.spec.js.map +1 -1
- package/lib/query.d.ts +46 -0
- package/lib/query.d.ts.map +1 -0
- package/lib/query.js +270 -0
- package/lib/query.js.map +1 -0
- package/lib/session.d.ts +53 -0
- package/lib/session.d.ts.map +1 -0
- package/lib/session.js +163 -0
- package/lib/session.js.map +1 -0
- package/lib/transport/index.d.ts +104 -0
- package/lib/transport/index.d.ts.map +1 -0
- package/lib/transport/index.js +20 -0
- package/lib/transport/index.js.map +1 -0
- package/lib/transport/process-transport.d.ts +65 -0
- package/lib/transport/process-transport.d.ts.map +1 -0
- package/lib/transport/process-transport.js +380 -0
- package/lib/transport/process-transport.js.map +1 -0
- package/lib/types.d.ts +603 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +58 -0
- package/lib/types.js.map +1 -0
- package/lib/utils/cli-resolver.d.ts +36 -0
- package/lib/utils/cli-resolver.d.ts.map +1 -0
- package/lib/utils/cli-resolver.js +123 -0
- package/lib/utils/cli-resolver.js.map +1 -0
- package/lib/utils/env-utils.d.ts +9 -0
- package/lib/utils/env-utils.d.ts.map +1 -0
- package/lib/utils/env-utils.js +19 -0
- package/lib/utils/env-utils.js.map +1 -0
- package/lib/utils/index.d.ts +8 -0
- package/lib/utils/index.d.ts.map +1 -0
- package/lib/utils/index.js +17 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/process.d.ts +8 -0
- package/lib/utils/process.d.ts.map +1 -0
- package/lib/utils/process.js +16 -0
- package/lib/utils/process.js.map +1 -0
- package/lib/utils/stream.d.ts +24 -0
- package/lib/utils/stream.d.ts.map +1 -0
- package/lib/utils/stream.js +85 -0
- package/lib/utils/stream.js.map +1 -0
- package/package.json +21 -14
- package/dist/agent-sdk.js +0 -1
- package/lib/common/application-utils.d.ts +0 -5
- package/lib/common/application-utils.d.ts.map +0 -1
- package/lib/common/application-utils.js +0 -18
- package/lib/common/application-utils.js.map +0 -1
- package/lib/common/component-registry.d.ts +0 -10
- package/lib/common/component-registry.d.ts.map +0 -1
- package/lib/common/component-registry.js +0 -50
- package/lib/common/component-registry.js.map +0 -1
- package/lib/common/index.d.ts +0 -4
- package/lib/common/index.d.ts.map +0 -1
- package/lib/common/index.js +0 -20
- package/lib/common/index.js.map +0 -1
- package/lib/common/services.d.ts +0 -8
- package/lib/common/services.d.ts.map +0 -1
- package/lib/common/services.js +0 -21
- package/lib/common/services.js.map +0 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI Resolver
|
|
3
|
+
*
|
|
4
|
+
* Resolves the path to the CodeBuddy CLI.
|
|
5
|
+
* Supports multiple resolution strategies:
|
|
6
|
+
* 1. Environment variable (CODEBUDDY_CODE_PATH)
|
|
7
|
+
* 2. Bundled CLI in package's cli/ directory
|
|
8
|
+
* 3. Monorepo development path (fallback)
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Error thrown when CLI cannot be found.
|
|
12
|
+
*/
|
|
13
|
+
export declare class CLINotFoundError extends Error {
|
|
14
|
+
readonly platform: string;
|
|
15
|
+
readonly arch: string;
|
|
16
|
+
constructor(message: string, platform: string, arch: string);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Resolve the path to the CodeBuddy CLI.
|
|
20
|
+
*
|
|
21
|
+
* Resolution order:
|
|
22
|
+
* 1. CODEBUDDY_CODE_PATH environment variable
|
|
23
|
+
* 2. Bundled CLI in package's cli/ directory
|
|
24
|
+
* 3. Monorepo development path
|
|
25
|
+
*
|
|
26
|
+
* @returns The absolute path to the CLI
|
|
27
|
+
* @throws CLINotFoundError if the CLI cannot be found
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveCLIPath(): string;
|
|
30
|
+
/**
|
|
31
|
+
* Check if CLI is available without throwing.
|
|
32
|
+
*
|
|
33
|
+
* @returns The CLI path if found, null otherwise
|
|
34
|
+
*/
|
|
35
|
+
export declare function tryCLIPath(): string | null;
|
|
36
|
+
//# sourceMappingURL=cli-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-resolver.d.ts","sourceRoot":"","sources":["../../src/utils/cli-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAeH;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,KAAK;aAGnB,QAAQ,EAAE,MAAM;aAChB,IAAI,EAAE,MAAM;gBAF5B,OAAO,EAAE,MAAM,EACC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM;CAKnC;AAuCD;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAuCvC;AAED;;;;GAIG;AACH,wBAAgB,UAAU,IAAI,MAAM,GAAG,IAAI,CAM1C"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* CLI Resolver
|
|
4
|
+
*
|
|
5
|
+
* Resolves the path to the CodeBuddy CLI.
|
|
6
|
+
* Supports multiple resolution strategies:
|
|
7
|
+
* 1. Environment variable (CODEBUDDY_CODE_PATH)
|
|
8
|
+
* 2. Bundled CLI in package's cli/ directory
|
|
9
|
+
* 3. Monorepo development path (fallback)
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CLINotFoundError = void 0;
|
|
13
|
+
exports.resolveCLIPath = resolveCLIPath;
|
|
14
|
+
exports.tryCLIPath = tryCLIPath;
|
|
15
|
+
const os_1 = require("os");
|
|
16
|
+
const path_1 = require("path");
|
|
17
|
+
const fs_1 = require("fs");
|
|
18
|
+
/**
|
|
19
|
+
* Binary name per platform.
|
|
20
|
+
*/
|
|
21
|
+
const BINARY_NAMES = {
|
|
22
|
+
win32: 'codebuddy.exe',
|
|
23
|
+
darwin: 'codebuddy',
|
|
24
|
+
linux: 'codebuddy',
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Error thrown when CLI cannot be found.
|
|
28
|
+
*/
|
|
29
|
+
class CLINotFoundError extends Error {
|
|
30
|
+
constructor(message, platform, arch) {
|
|
31
|
+
super(message);
|
|
32
|
+
this.platform = platform;
|
|
33
|
+
this.arch = arch;
|
|
34
|
+
this.name = 'CLINotFoundError';
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.CLINotFoundError = CLINotFoundError;
|
|
38
|
+
/**
|
|
39
|
+
* Try to resolve CLI path from bundled cli/ directory.
|
|
40
|
+
* The SDK package bundles the CLI in its cli/ directory.
|
|
41
|
+
*/
|
|
42
|
+
function resolveFromBundled() {
|
|
43
|
+
// The bundled CLI is at: package-root/cli/bin/codebuddy
|
|
44
|
+
// __dirname is lib/utils, so we go up to package root
|
|
45
|
+
const bundledBinPath = (0, path_1.resolve)(__dirname, '../../cli/bin/codebuddy');
|
|
46
|
+
if ((0, fs_1.existsSync)(bundledBinPath)) {
|
|
47
|
+
return bundledBinPath;
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Try to resolve CLI path from monorepo development structure.
|
|
53
|
+
*/
|
|
54
|
+
function resolveFromMonorepo() {
|
|
55
|
+
// Try relative to this package (agent-sdk-js -> agent-cli)
|
|
56
|
+
// First try the bin script (for Node.js execution)
|
|
57
|
+
const binScriptPath = (0, path_1.resolve)(__dirname, '../../../agent-cli/bin/codebuddy');
|
|
58
|
+
if ((0, fs_1.existsSync)(binScriptPath)) {
|
|
59
|
+
return binScriptPath;
|
|
60
|
+
}
|
|
61
|
+
// Fall back to looking for compiled binary in dist
|
|
62
|
+
const binaryName = BINARY_NAMES[(0, os_1.platform)()] || 'codebuddy';
|
|
63
|
+
const distPath = (0, path_1.resolve)(__dirname, '../../../agent-cli/dist', binaryName);
|
|
64
|
+
if ((0, fs_1.existsSync)(distPath)) {
|
|
65
|
+
return distPath;
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Resolve the path to the CodeBuddy CLI.
|
|
71
|
+
*
|
|
72
|
+
* Resolution order:
|
|
73
|
+
* 1. CODEBUDDY_CODE_PATH environment variable
|
|
74
|
+
* 2. Bundled CLI in package's cli/ directory
|
|
75
|
+
* 3. Monorepo development path
|
|
76
|
+
*
|
|
77
|
+
* @returns The absolute path to the CLI
|
|
78
|
+
* @throws CLINotFoundError if the CLI cannot be found
|
|
79
|
+
*/
|
|
80
|
+
function resolveCLIPath() {
|
|
81
|
+
const currentPlatform = (0, os_1.platform)();
|
|
82
|
+
const currentArch = process.arch;
|
|
83
|
+
// 1. Environment variable takes precedence
|
|
84
|
+
const envPath = process.env.CODEBUDDY_CODE_PATH;
|
|
85
|
+
if (envPath) {
|
|
86
|
+
if ((0, fs_1.existsSync)(envPath)) {
|
|
87
|
+
return envPath;
|
|
88
|
+
}
|
|
89
|
+
// Warn but continue to try other methods
|
|
90
|
+
console.warn(`Warning: CODEBUDDY_CODE_PATH is set to "${envPath}" but file does not exist. ` +
|
|
91
|
+
'Falling back to other resolution methods.');
|
|
92
|
+
}
|
|
93
|
+
// 2. Try bundled CLI
|
|
94
|
+
const bundledPath = resolveFromBundled();
|
|
95
|
+
if (bundledPath) {
|
|
96
|
+
return bundledPath;
|
|
97
|
+
}
|
|
98
|
+
// 3. Try monorepo development path
|
|
99
|
+
const monorepoPath = resolveFromMonorepo();
|
|
100
|
+
if (monorepoPath) {
|
|
101
|
+
return monorepoPath;
|
|
102
|
+
}
|
|
103
|
+
// 4. Nothing found - throw helpful error
|
|
104
|
+
throw new CLINotFoundError(`CodeBuddy CLI not found.\n\n` +
|
|
105
|
+
`Possible solutions:\n` +
|
|
106
|
+
` 1. Reinstall the SDK package:\n` +
|
|
107
|
+
` npm install @tencent-ai/agent-sdk\n\n` +
|
|
108
|
+
` 2. Set CODEBUDDY_CODE_PATH environment variable to the CLI path\n`, currentPlatform, currentArch);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Check if CLI is available without throwing.
|
|
112
|
+
*
|
|
113
|
+
* @returns The CLI path if found, null otherwise
|
|
114
|
+
*/
|
|
115
|
+
function tryCLIPath() {
|
|
116
|
+
try {
|
|
117
|
+
return resolveCLIPath();
|
|
118
|
+
}
|
|
119
|
+
catch (_a) {
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=cli-resolver.js.map
|
|
@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
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Check if an environment variable value is truthy.
|
|
6
|
+
* Accepts: '1', 'true', 'yes', 'on' (case-insensitive)
|
|
7
|
+
*/
|
|
8
|
+
export declare function isEnvTruthy(envVar: string | boolean | undefined): boolean;
|
|
9
|
+
//# sourceMappingURL=env-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-utils.d.ts","sourceRoot":"","sources":["../../src/utils/env-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAKzE"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Environment variable utilities.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isEnvTruthy = isEnvTruthy;
|
|
7
|
+
/**
|
|
8
|
+
* Check if an environment variable value is truthy.
|
|
9
|
+
* Accepts: '1', 'true', 'yes', 'on' (case-insensitive)
|
|
10
|
+
*/
|
|
11
|
+
function isEnvTruthy(envVar) {
|
|
12
|
+
if (!envVar)
|
|
13
|
+
return false;
|
|
14
|
+
if (typeof envVar === 'boolean')
|
|
15
|
+
return envVar;
|
|
16
|
+
const normalizedValue = envVar.toLowerCase().trim();
|
|
17
|
+
return ['1', 'true', 'yes', 'on'].includes(normalizedValue);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=env-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-utils.js","sourceRoot":"","sources":["../../src/utils/env-utils.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAMH,kCAKC;AATD;;;GAGG;AACH,SAAgB,WAAW,CAAC,MAAoC;IAC5D,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAC1B,IAAI,OAAO,MAAM,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC;IAC/C,MAAM,eAAe,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;IACpD,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC;AAChE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility exports
|
|
3
|
+
*/
|
|
4
|
+
export { Stream } from './stream';
|
|
5
|
+
export { writeToStderr } from './process';
|
|
6
|
+
export { isEnvTruthy } from './env-utils';
|
|
7
|
+
export { resolveCLIPath, tryCLIPath, CLINotFoundError } from './cli-resolver';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CLINotFoundError = exports.tryCLIPath = exports.resolveCLIPath = exports.isEnvTruthy = exports.writeToStderr = exports.Stream = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Utility exports
|
|
6
|
+
*/
|
|
7
|
+
var stream_1 = require("./stream");
|
|
8
|
+
Object.defineProperty(exports, "Stream", { enumerable: true, get: function () { return stream_1.Stream; } });
|
|
9
|
+
var process_1 = require("./process");
|
|
10
|
+
Object.defineProperty(exports, "writeToStderr", { enumerable: true, get: function () { return process_1.writeToStderr; } });
|
|
11
|
+
var env_utils_1 = require("./env-utils");
|
|
12
|
+
Object.defineProperty(exports, "isEnvTruthy", { enumerable: true, get: function () { return env_utils_1.isEnvTruthy; } });
|
|
13
|
+
var cli_resolver_1 = require("./cli-resolver");
|
|
14
|
+
Object.defineProperty(exports, "resolveCLIPath", { enumerable: true, get: function () { return cli_resolver_1.resolveCLIPath; } });
|
|
15
|
+
Object.defineProperty(exports, "tryCLIPath", { enumerable: true, get: function () { return cli_resolver_1.tryCLIPath; } });
|
|
16
|
+
Object.defineProperty(exports, "CLINotFoundError", { enumerable: true, get: function () { return cli_resolver_1.CLINotFoundError; } });
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,mCAAkC;AAAzB,gGAAA,MAAM,OAAA;AACf,qCAA0C;AAAjC,wGAAA,aAAa,OAAA;AACtB,yCAA0C;AAAjC,wGAAA,WAAW,OAAA;AACpB,+CAA8E;AAArE,8GAAA,cAAc,OAAA;AAAE,0GAAA,UAAU,OAAA;AAAE,gHAAA,gBAAgB,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../src/utils/process.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAIhD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Process utilities for safe I/O operations.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.writeToStderr = writeToStderr;
|
|
7
|
+
const CHUNK_SIZE = 2000;
|
|
8
|
+
/**
|
|
9
|
+
* Write data to stderr in chunks to avoid buffer overflow.
|
|
10
|
+
*/
|
|
11
|
+
function writeToStderr(data) {
|
|
12
|
+
for (let i = 0; i < data.length; i += CHUNK_SIZE) {
|
|
13
|
+
process.stderr.write(data.substring(i, i + CHUNK_SIZE));
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=process.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process.js","sourceRoot":"","sources":["../../src/utils/process.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAOH,sCAIC;AATD,MAAM,UAAU,GAAG,IAAI,CAAC;AAExB;;GAEG;AACH,SAAgB,aAAa,CAAC,IAAY;IACtC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,UAAU,EAAE,CAAC;QAC/C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;IAC5D,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stream - A clean AsyncGenerator implementation with queue support.
|
|
3
|
+
*
|
|
4
|
+
* Provides a simple way to create async iterables that can be
|
|
5
|
+
* fed values from external sources (like process stdout).
|
|
6
|
+
*/
|
|
7
|
+
export declare class Stream<T, TReturn = void> implements AsyncGenerator<T, TReturn, unknown> {
|
|
8
|
+
private returned?;
|
|
9
|
+
private queue;
|
|
10
|
+
private readResolve?;
|
|
11
|
+
private readReject?;
|
|
12
|
+
private isDone;
|
|
13
|
+
private hasError?;
|
|
14
|
+
private started;
|
|
15
|
+
constructor(returned?: () => void);
|
|
16
|
+
[Symbol.asyncIterator](): AsyncGenerator<T, TReturn, unknown>;
|
|
17
|
+
next(): Promise<IteratorResult<T, TReturn>>;
|
|
18
|
+
enqueue(value: T): void;
|
|
19
|
+
done(): void;
|
|
20
|
+
error(error: Error): void;
|
|
21
|
+
return(): Promise<IteratorResult<T, TReturn>>;
|
|
22
|
+
throw(e?: Error): Promise<IteratorResult<T, TReturn>>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=stream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../src/utils/stream.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,qBAAa,MAAM,CAAC,CAAC,EAAE,OAAO,GAAG,IAAI,CACjC,YAAW,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC;IAE9C,OAAO,CAAC,QAAQ,CAAC,CAAa;IAC9B,OAAO,CAAC,KAAK,CAAW;IACxB,OAAO,CAAC,WAAW,CAAC,CAA+C;IACnE,OAAO,CAAC,UAAU,CAAC,CAAyB;IAC5C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAC,CAAQ;IACzB,OAAO,CAAC,OAAO,CAAS;gBAEZ,QAAQ,CAAC,EAAE,MAAM,IAAI;IAIjC,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC;IAQ7D,IAAI,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAsB3C,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI;IAWvB,IAAI,IAAI,IAAI;IAUZ,KAAK,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI;IAUzB,MAAM,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAQ7C,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;CAKxD"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Stream = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Stream - A clean AsyncGenerator implementation with queue support.
|
|
6
|
+
*
|
|
7
|
+
* Provides a simple way to create async iterables that can be
|
|
8
|
+
* fed values from external sources (like process stdout).
|
|
9
|
+
*/
|
|
10
|
+
class Stream {
|
|
11
|
+
constructor(returned) {
|
|
12
|
+
this.queue = [];
|
|
13
|
+
this.isDone = false;
|
|
14
|
+
this.started = false;
|
|
15
|
+
this.returned = returned;
|
|
16
|
+
}
|
|
17
|
+
[Symbol.asyncIterator]() {
|
|
18
|
+
if (this.started) {
|
|
19
|
+
throw new Error('Stream can only be iterated once');
|
|
20
|
+
}
|
|
21
|
+
this.started = true;
|
|
22
|
+
return this;
|
|
23
|
+
}
|
|
24
|
+
next() {
|
|
25
|
+
if (this.queue.length > 0) {
|
|
26
|
+
return Promise.resolve({
|
|
27
|
+
done: false,
|
|
28
|
+
value: this.queue.shift(),
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
if (this.isDone) {
|
|
32
|
+
return Promise.resolve({ done: true, value: undefined });
|
|
33
|
+
}
|
|
34
|
+
if (this.hasError) {
|
|
35
|
+
return Promise.reject(this.hasError);
|
|
36
|
+
}
|
|
37
|
+
return new Promise((resolve, reject) => {
|
|
38
|
+
this.readResolve = resolve;
|
|
39
|
+
this.readReject = reject;
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
enqueue(value) {
|
|
43
|
+
if (this.readResolve) {
|
|
44
|
+
const resolve = this.readResolve;
|
|
45
|
+
this.readResolve = undefined;
|
|
46
|
+
this.readReject = undefined;
|
|
47
|
+
resolve({ done: false, value });
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
this.queue.push(value);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
done() {
|
|
54
|
+
this.isDone = true;
|
|
55
|
+
if (this.readResolve) {
|
|
56
|
+
const resolve = this.readResolve;
|
|
57
|
+
this.readResolve = undefined;
|
|
58
|
+
this.readReject = undefined;
|
|
59
|
+
resolve({ done: true, value: undefined });
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
error(error) {
|
|
63
|
+
this.hasError = error;
|
|
64
|
+
if (this.readReject) {
|
|
65
|
+
const reject = this.readReject;
|
|
66
|
+
this.readResolve = undefined;
|
|
67
|
+
this.readReject = undefined;
|
|
68
|
+
reject(error);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return() {
|
|
72
|
+
this.isDone = true;
|
|
73
|
+
if (this.returned) {
|
|
74
|
+
this.returned();
|
|
75
|
+
}
|
|
76
|
+
return Promise.resolve({ done: true, value: undefined });
|
|
77
|
+
}
|
|
78
|
+
throw(e) {
|
|
79
|
+
this.hasError = e;
|
|
80
|
+
this.isDone = true;
|
|
81
|
+
return Promise.reject(e);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.Stream = Stream;
|
|
85
|
+
//# sourceMappingURL=stream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../../src/utils/stream.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACH,MAAa,MAAM;IAWf,YAAY,QAAqB;QAPzB,UAAK,GAAQ,EAAE,CAAC;QAGhB,WAAM,GAAG,KAAK,CAAC;QAEf,YAAO,GAAG,KAAK,CAAC;QAGpB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;IAED,CAAC,MAAM,CAAC,aAAa,CAAC;QAClB,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;QACxD,CAAC;QACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,IAAI;QACA,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACxB,OAAO,OAAO,CAAC,OAAO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,EAAE,KAAK,EAAE,SAAoB,EAAE,CAAC,CAAC;QACzD,CAAC;IACL,CAAC;IAED,KAAK,CAAC,KAAY;QACd,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YAClB,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC;YAC/B,IAAI,CAAC,WAAW,GAAG,SAAS,CAAC;YAC7B,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;YAC5B,MAAM,CAAC,KAAK,CAAC,CAAC;QAClB,CAAC;IACL,CAAC;IAED,MAAM;QACF,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChB,IAAI,CAAC,QAAQ,EAAE,CAAC;QACpB,CAAC;QACD,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,SAAoB,EAAE,CAAC,CAAC;IACxE,CAAC;IAED,KAAK,CAAC,CAAS;QACX,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC7B,CAAC;CACJ;AAzFD,wBAyFC"}
|
package/package.json
CHANGED
|
@@ -1,22 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tencent-ai/agent-sdk",
|
|
3
|
-
"version": "0.1.0
|
|
4
|
-
"description": "
|
|
5
|
-
"main": "
|
|
6
|
-
"typings": "lib/
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "CodeBuddy Code SDK for JavaScript/TypeScript",
|
|
5
|
+
"main": "lib/index.js",
|
|
6
|
+
"typings": "lib/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./lib/index.d.ts",
|
|
10
|
+
"import": "./lib/index.js",
|
|
11
|
+
"require": "./lib/index.js"
|
|
12
|
+
}
|
|
11
13
|
},
|
|
12
|
-
"
|
|
13
|
-
"agent-sdk"
|
|
14
|
-
],
|
|
14
|
+
"license": "MIT",
|
|
15
15
|
"files": [
|
|
16
|
-
"
|
|
17
|
-
"
|
|
16
|
+
"lib",
|
|
17
|
+
"cli"
|
|
18
|
+
],
|
|
19
|
+
"keywords": [
|
|
20
|
+
"agent-sdk",
|
|
21
|
+
"codebuddy-code"
|
|
18
22
|
],
|
|
19
23
|
"scripts": {},
|
|
24
|
+
"dependencies": {},
|
|
20
25
|
"devDependencies": {},
|
|
21
|
-
"
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
}
|
|
22
29
|
}
|