@getpochi/cli 0.5.75 → 0.5.77
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.js +56 -30
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -404610,7 +404610,7 @@ var {
|
|
|
404610
404610
|
// package.json
|
|
404611
404611
|
var package_default = {
|
|
404612
404612
|
name: "@getpochi/cli",
|
|
404613
|
-
version: "0.5.
|
|
404613
|
+
version: "0.5.77",
|
|
404614
404614
|
type: "module",
|
|
404615
404615
|
bin: {
|
|
404616
404616
|
pochi: "src/cli.ts"
|
|
@@ -416482,18 +416482,26 @@ async function loadAgents(workingDirectory2, includeSystemAgents = true) {
|
|
|
416482
416482
|
|
|
416483
416483
|
// src/lib/workflow-loader.ts
|
|
416484
416484
|
import * as fs6 from "node:fs/promises";
|
|
416485
|
+
import { homedir as homedir4 } from "node:os";
|
|
416485
416486
|
import * as path11 from "node:path";
|
|
416486
416487
|
function getWorkflowPath(id4) {
|
|
416487
416488
|
const workflowsDir = path11.join(...exports_constants.WorkspaceWorkflowPathSegments);
|
|
416488
416489
|
return path11.join(workflowsDir, `${id4}.md`);
|
|
416489
416490
|
}
|
|
416490
|
-
async function loadWorkflow(id4, cwd) {
|
|
416491
|
-
|
|
416492
|
-
|
|
416493
|
-
|
|
416494
|
-
} catch (error42) {
|
|
416495
|
-
return null;
|
|
416491
|
+
async function loadWorkflow(id4, cwd, includeGlobalWorkflow = true) {
|
|
416492
|
+
const workflowFilePaths = [path11.join(cwd, getWorkflowPath(id4))];
|
|
416493
|
+
if (includeGlobalWorkflow) {
|
|
416494
|
+
workflowFilePaths.push(path11.join(homedir4(), getWorkflowPath(id4)));
|
|
416496
416495
|
}
|
|
416496
|
+
for (const filePath of workflowFilePaths) {
|
|
416497
|
+
try {
|
|
416498
|
+
const content3 = await fs6.readFile(filePath, "utf-8");
|
|
416499
|
+
if (content3) {
|
|
416500
|
+
return content3;
|
|
416501
|
+
}
|
|
416502
|
+
} catch (error42) {}
|
|
416503
|
+
}
|
|
416504
|
+
return null;
|
|
416497
416505
|
}
|
|
416498
416506
|
function containsWorkflowReference(prompt) {
|
|
416499
416507
|
return /\/\w+[\w-]*/.test(prompt);
|
|
@@ -430452,7 +430460,7 @@ function isToolEnabledChanged(oldConfig, newConfig) {
|
|
|
430452
430460
|
|
|
430453
430461
|
// ../common/src/mcp-utils/mcp-connection.ts
|
|
430454
430462
|
var AbortedError = "AbortedError";
|
|
430455
|
-
var AutoReconnectDelay =
|
|
430463
|
+
var AutoReconnectDelay = 1000;
|
|
430456
430464
|
var AutoReconnectMaxAttempts = 20;
|
|
430457
430465
|
|
|
430458
430466
|
class McpConnection {
|
|
@@ -431007,20 +431015,23 @@ async function initializeMcp(program5) {
|
|
|
431007
431015
|
const spinner = ora("Initializing MCP connections...").start();
|
|
431008
431016
|
let attempts = 0;
|
|
431009
431017
|
const maxAttempts = 15;
|
|
431010
|
-
while (
|
|
431018
|
+
while (true) {
|
|
431011
431019
|
const status3 = mcpHub.status.value;
|
|
431012
431020
|
const connections = Object.values(status3.connections);
|
|
431013
431021
|
const readyConnections = connections.filter((conn) => conn.status === "ready").length;
|
|
431014
431022
|
const errorConnections = connections.filter((conn) => conn.status === "error").length;
|
|
431015
|
-
if (errorConnections > 0) {
|
|
431016
|
-
spinner.fail(`Failed to initialize MCP connections after ${attempts} attempts.`);
|
|
431017
|
-
return program5.error("MCP initialization failed");
|
|
431018
|
-
}
|
|
431019
431023
|
if (readyConnections >= connections.length) {
|
|
431020
431024
|
break;
|
|
431021
431025
|
}
|
|
431026
|
+
if (errorConnections > 0) {
|
|
431027
|
+
if (attempts < maxAttempts) {
|
|
431028
|
+
attempts++;
|
|
431029
|
+
} else {
|
|
431030
|
+
spinner.fail(`Failed to initialize MCP connections after ${attempts} attempts.`);
|
|
431031
|
+
return program5.error("MCP initialization failed");
|
|
431032
|
+
}
|
|
431033
|
+
}
|
|
431022
431034
|
await new Promise((resolve11) => setTimeout(resolve11, 500));
|
|
431023
|
-
attempts++;
|
|
431024
431035
|
}
|
|
431025
431036
|
spinner.stop();
|
|
431026
431037
|
return mcpHub;
|
|
@@ -444897,7 +444908,7 @@ function createNewTaskMiddleware(store, cwd2, parentTaskId, customAgents) {
|
|
|
444897
444908
|
};
|
|
444898
444909
|
}
|
|
444899
444910
|
// ../livekit/src/chat/middlewares/tool-call-middleware.ts
|
|
444900
|
-
function createToolCallMiddleware() {
|
|
444911
|
+
function createToolCallMiddleware(useStopWordStream) {
|
|
444901
444912
|
const toolCallEndTag = "</api-request>";
|
|
444902
444913
|
const toolResponseTagTemplate = (name17) => `<api-response name="${name17}">`;
|
|
444903
444914
|
const toolResponseEndTag = "</api-response>";
|
|
@@ -444938,16 +444949,25 @@ ${processedPrompt[0].content}`
|
|
|
444938
444949
|
},
|
|
444939
444950
|
...processedPrompt
|
|
444940
444951
|
];
|
|
444952
|
+
let stopSequences = params3.stopSequences;
|
|
444953
|
+
if (!useStopWordStream) {
|
|
444954
|
+
stopSequences = [...stopSequences || [], "</api-section>"];
|
|
444955
|
+
}
|
|
444941
444956
|
return {
|
|
444942
444957
|
...params3,
|
|
444958
|
+
stopSequences,
|
|
444943
444959
|
tools: undefined,
|
|
444944
444960
|
prompt: promptWithTools
|
|
444945
444961
|
};
|
|
444946
444962
|
},
|
|
444947
444963
|
wrapStream: async ({ doStream }) => {
|
|
444948
444964
|
const { stream: stream12, ...rest } = await doStream();
|
|
444965
|
+
let newStream = stream12;
|
|
444966
|
+
if (useStopWordStream) {
|
|
444967
|
+
newStream = stream12.pipeThrough(createStopWordStream(toolSectionEndTag));
|
|
444968
|
+
}
|
|
444949
444969
|
return {
|
|
444950
|
-
stream:
|
|
444970
|
+
stream: newStream.pipeThrough(createToolCallStream(toolCallStartRegex, toolCallStartPrefix, toolCallEndTag, toolSectionStartTag)),
|
|
444951
444971
|
...rest
|
|
444952
444972
|
};
|
|
444953
444973
|
}
|
|
@@ -445441,21 +445461,27 @@ function createPatchedFetchForFinetune(accessToken) {
|
|
|
445441
445461
|
...requestInit,
|
|
445442
445462
|
headers
|
|
445443
445463
|
};
|
|
445464
|
+
let finalUrl;
|
|
445444
445465
|
if (requestInfo instanceof URL) {
|
|
445445
|
-
|
|
445446
|
-
|
|
445447
|
-
|
|
445448
|
-
}
|
|
445449
|
-
if (requestInfo instanceof Request) {
|
|
445466
|
+
finalUrl = new URL(requestInfo);
|
|
445467
|
+
finalUrl.pathname = patchString(finalUrl.pathname);
|
|
445468
|
+
} else if (requestInfo instanceof Request) {
|
|
445450
445469
|
const patchedUrl = patchString(requestInfo.url);
|
|
445451
|
-
|
|
445452
|
-
|
|
445453
|
-
}
|
|
445454
|
-
if (typeof requestInfo === "string") {
|
|
445470
|
+
finalUrl = new URL(patchedUrl);
|
|
445471
|
+
} else if (typeof requestInfo === "string") {
|
|
445455
445472
|
const patchedUrl = patchString(requestInfo);
|
|
445456
|
-
|
|
445473
|
+
finalUrl = new URL(patchedUrl);
|
|
445474
|
+
} else {
|
|
445475
|
+
throw new Error(`Unexpected requestInfo type: ${typeof requestInfo}`);
|
|
445476
|
+
}
|
|
445477
|
+
if (globalThis.POCHI_CORS_PROXY_PORT) {
|
|
445478
|
+
const origin = finalUrl.origin;
|
|
445479
|
+
finalUrl.protocol = "http:";
|
|
445480
|
+
finalUrl.host = "localhost";
|
|
445481
|
+
finalUrl.port = globalThis.POCHI_CORS_PROXY_PORT;
|
|
445482
|
+
patchedRequestInit.headers.set("x-proxy-origin", origin);
|
|
445457
445483
|
}
|
|
445458
|
-
|
|
445484
|
+
return fetch(finalUrl, patchedRequestInit);
|
|
445459
445485
|
};
|
|
445460
445486
|
}
|
|
445461
445487
|
function createVertexModel(vertex2, modelId) {
|
|
@@ -445699,7 +445725,7 @@ class FlexibleChatTransport {
|
|
|
445699
445725
|
middlewares.push(createOutputSchemaMiddleware(chatId, model2, this.outputSchema));
|
|
445700
445726
|
}
|
|
445701
445727
|
if (llm.useToolCallMiddleware) {
|
|
445702
|
-
middlewares.push(createToolCallMiddleware());
|
|
445728
|
+
middlewares.push(createToolCallMiddleware(llm.type !== "google-vertex-tuning"));
|
|
445703
445729
|
}
|
|
445704
445730
|
const mcpTools = mcpInfo?.toolset && parseMcpToolSet(this.store, mcpInfo.toolset);
|
|
445705
445731
|
const tools = d2({
|
|
@@ -446870,7 +446896,7 @@ import {
|
|
|
446870
446896
|
rmSync,
|
|
446871
446897
|
statSync as statSync3
|
|
446872
446898
|
} from "node:fs";
|
|
446873
|
-
import { homedir as
|
|
446899
|
+
import { homedir as homedir6, tmpdir as tmpdir3 } from "node:os";
|
|
446874
446900
|
import { extname as extname5, join as join21 } from "node:path";
|
|
446875
446901
|
|
|
446876
446902
|
// src/upgrade/platform-utils.ts
|
|
@@ -446934,7 +446960,7 @@ function extractVersionFromTag(tag9) {
|
|
|
446934
446960
|
|
|
446935
446961
|
// src/upgrade/binary-installer.ts
|
|
446936
446962
|
function getPochiDir() {
|
|
446937
|
-
const pochiDir = join21(
|
|
446963
|
+
const pochiDir = join21(homedir6(), ".pochi");
|
|
446938
446964
|
const binDir = join21(pochiDir, "bin");
|
|
446939
446965
|
if (!existsSync7(pochiDir)) {
|
|
446940
446966
|
mkdirSync(pochiDir, { recursive: true });
|