@corbat-tech/coco 2.27.1 → 2.27.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +887 -696
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +28 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1408,7 +1408,7 @@ function getApiKey(provider) {
|
|
|
1408
1408
|
case "gemini":
|
|
1409
1409
|
return process.env["GEMINI_API_KEY"] ?? process.env["GOOGLE_API_KEY"];
|
|
1410
1410
|
case "vertex":
|
|
1411
|
-
return
|
|
1411
|
+
return process.env["VERTEX_API_KEY"] ?? process.env["GOOGLE_API_KEY"];
|
|
1412
1412
|
case "kimi":
|
|
1413
1413
|
return process.env["KIMI_API_KEY"] ?? process.env["MOONSHOT_API_KEY"];
|
|
1414
1414
|
case "kimi-code":
|
|
@@ -16437,21 +16437,26 @@ var VertexProvider = class {
|
|
|
16437
16437
|
config = {};
|
|
16438
16438
|
project = "";
|
|
16439
16439
|
location = DEFAULT_LOCATION;
|
|
16440
|
+
apiKey;
|
|
16440
16441
|
retryConfig = DEFAULT_RETRY_CONFIG;
|
|
16441
16442
|
async initialize(config) {
|
|
16442
16443
|
this.config = config;
|
|
16443
16444
|
this.project = config.project ?? process.env["VERTEX_PROJECT"] ?? process.env["GOOGLE_CLOUD_PROJECT"] ?? process.env["GCLOUD_PROJECT"] ?? "";
|
|
16444
16445
|
this.location = config.location ?? process.env["VERTEX_LOCATION"] ?? process.env["GOOGLE_CLOUD_LOCATION"] ?? DEFAULT_LOCATION;
|
|
16446
|
+
this.apiKey = config.apiKey ?? process.env["VERTEX_API_KEY"] ?? process.env["GOOGLE_API_KEY"];
|
|
16445
16447
|
if (!this.project.trim()) {
|
|
16446
16448
|
throw new ProviderError(
|
|
16447
16449
|
"Vertex AI project not configured. Set provider.project, VERTEX_PROJECT, or GOOGLE_CLOUD_PROJECT.",
|
|
16448
16450
|
{ provider: this.id }
|
|
16449
16451
|
);
|
|
16450
16452
|
}
|
|
16453
|
+
if (this.apiKey?.trim()) {
|
|
16454
|
+
return;
|
|
16455
|
+
}
|
|
16451
16456
|
const token = await getCachedADCToken();
|
|
16452
16457
|
if (!token) {
|
|
16453
16458
|
throw new ProviderError(
|
|
16454
|
-
"Vertex AI
|
|
16459
|
+
"Vertex AI authentication is not configured. Set VERTEX_API_KEY (or GOOGLE_API_KEY), or run `gcloud auth application-default login`.",
|
|
16455
16460
|
{ provider: this.id }
|
|
16456
16461
|
);
|
|
16457
16462
|
}
|
|
@@ -16570,10 +16575,17 @@ var VertexProvider = class {
|
|
|
16570
16575
|
return `${this.getResolvedBaseUrl()}/projects/${encodeURIComponent(this.project)}/locations/${encodeURIComponent(this.location)}/publishers/google/models/${encodeURIComponent(this.getModel(model))}:${action}`;
|
|
16571
16576
|
}
|
|
16572
16577
|
async getHeaders() {
|
|
16578
|
+
if (this.apiKey?.trim()) {
|
|
16579
|
+
return {
|
|
16580
|
+
"Content-Type": "application/json",
|
|
16581
|
+
"x-goog-api-key": this.apiKey,
|
|
16582
|
+
"x-goog-user-project": this.project
|
|
16583
|
+
};
|
|
16584
|
+
}
|
|
16573
16585
|
const token = await getCachedADCToken();
|
|
16574
16586
|
if (!token) {
|
|
16575
16587
|
throw new ProviderError(
|
|
16576
|
-
"Vertex AI
|
|
16588
|
+
"Vertex AI token is unavailable. Re-authenticate with gcloud or configure VERTEX_API_KEY.",
|
|
16577
16589
|
{ provider: this.id }
|
|
16578
16590
|
);
|
|
16579
16591
|
}
|
|
@@ -25949,7 +25961,8 @@ var SuggestImprovementsSchema = z.object({
|
|
|
25949
25961
|
context: z.string().optional().describe("Additional context about the code")
|
|
25950
25962
|
});
|
|
25951
25963
|
async function analyzeAndSuggest(filePath, _context) {
|
|
25952
|
-
const
|
|
25964
|
+
const rawContent = await fs33.readFile(filePath, "utf-8");
|
|
25965
|
+
const content = typeof rawContent === "string" ? rawContent : String(rawContent ?? "");
|
|
25953
25966
|
const lines = content.split("\n");
|
|
25954
25967
|
const suggestions = [];
|
|
25955
25968
|
for (let i = 0; i < lines.length; i++) {
|
|
@@ -28441,9 +28454,10 @@ var SSETransport = class {
|
|
|
28441
28454
|
// src/mcp/lifecycle.ts
|
|
28442
28455
|
init_errors2();
|
|
28443
28456
|
init_logger();
|
|
28444
|
-
var MCPServerManager = class {
|
|
28457
|
+
var MCPServerManager = class _MCPServerManager {
|
|
28445
28458
|
connections = /* @__PURE__ */ new Map();
|
|
28446
28459
|
logger = getLogger();
|
|
28460
|
+
static STOP_TIMEOUT_MS = 5e3;
|
|
28447
28461
|
/**
|
|
28448
28462
|
* Create transport for a server config
|
|
28449
28463
|
*/
|
|
@@ -28530,7 +28544,15 @@ var MCPServerManager = class {
|
|
|
28530
28544
|
}
|
|
28531
28545
|
this.logger.info(`Stopping MCP server: ${name}`);
|
|
28532
28546
|
try {
|
|
28533
|
-
await
|
|
28547
|
+
await Promise.race([
|
|
28548
|
+
connection.transport.disconnect(),
|
|
28549
|
+
new Promise(
|
|
28550
|
+
(_, reject) => setTimeout(
|
|
28551
|
+
() => reject(new Error("MCP disconnect timeout")),
|
|
28552
|
+
_MCPServerManager.STOP_TIMEOUT_MS
|
|
28553
|
+
)
|
|
28554
|
+
)
|
|
28555
|
+
]);
|
|
28534
28556
|
} catch (error) {
|
|
28535
28557
|
this.logger.error(
|
|
28536
28558
|
`Error disconnecting server '${name}': ${error instanceof Error ? error.message : String(error)}`
|