@getpochi/cli 0.5.76 → 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 +49 -26
- 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
|
-
}
|
|
416495
|
-
|
|
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)));
|
|
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) {}
|
|
416496
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 {
|
|
@@ -431006,8 +431014,8 @@ async function initializeMcp(program5) {
|
|
|
431006
431014
|
}
|
|
431007
431015
|
const spinner = ora("Initializing MCP connections...").start();
|
|
431008
431016
|
let attempts = 0;
|
|
431009
|
-
const maxAttempts =
|
|
431010
|
-
while (
|
|
431017
|
+
const maxAttempts = 15;
|
|
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;
|
|
@@ -444900,7 +444908,7 @@ function createNewTaskMiddleware(store, cwd2, parentTaskId, customAgents) {
|
|
|
444900
444908
|
};
|
|
444901
444909
|
}
|
|
444902
444910
|
// ../livekit/src/chat/middlewares/tool-call-middleware.ts
|
|
444903
|
-
function createToolCallMiddleware() {
|
|
444911
|
+
function createToolCallMiddleware(useStopWordStream) {
|
|
444904
444912
|
const toolCallEndTag = "</api-request>";
|
|
444905
444913
|
const toolResponseTagTemplate = (name17) => `<api-response name="${name17}">`;
|
|
444906
444914
|
const toolResponseEndTag = "</api-response>";
|
|
@@ -444941,16 +444949,25 @@ ${processedPrompt[0].content}`
|
|
|
444941
444949
|
},
|
|
444942
444950
|
...processedPrompt
|
|
444943
444951
|
];
|
|
444952
|
+
let stopSequences = params3.stopSequences;
|
|
444953
|
+
if (!useStopWordStream) {
|
|
444954
|
+
stopSequences = [...stopSequences || [], "</api-section>"];
|
|
444955
|
+
}
|
|
444944
444956
|
return {
|
|
444945
444957
|
...params3,
|
|
444958
|
+
stopSequences,
|
|
444946
444959
|
tools: undefined,
|
|
444947
444960
|
prompt: promptWithTools
|
|
444948
444961
|
};
|
|
444949
444962
|
},
|
|
444950
444963
|
wrapStream: async ({ doStream }) => {
|
|
444951
444964
|
const { stream: stream12, ...rest } = await doStream();
|
|
444965
|
+
let newStream = stream12;
|
|
444966
|
+
if (useStopWordStream) {
|
|
444967
|
+
newStream = stream12.pipeThrough(createStopWordStream(toolSectionEndTag));
|
|
444968
|
+
}
|
|
444952
444969
|
return {
|
|
444953
|
-
stream:
|
|
444970
|
+
stream: newStream.pipeThrough(createToolCallStream(toolCallStartRegex, toolCallStartPrefix, toolCallEndTag, toolSectionStartTag)),
|
|
444954
444971
|
...rest
|
|
444955
444972
|
};
|
|
444956
444973
|
}
|
|
@@ -445444,21 +445461,27 @@ function createPatchedFetchForFinetune(accessToken) {
|
|
|
445444
445461
|
...requestInit,
|
|
445445
445462
|
headers
|
|
445446
445463
|
};
|
|
445464
|
+
let finalUrl;
|
|
445447
445465
|
if (requestInfo instanceof URL) {
|
|
445448
|
-
|
|
445449
|
-
|
|
445450
|
-
|
|
445451
|
-
}
|
|
445452
|
-
if (requestInfo instanceof Request) {
|
|
445466
|
+
finalUrl = new URL(requestInfo);
|
|
445467
|
+
finalUrl.pathname = patchString(finalUrl.pathname);
|
|
445468
|
+
} else if (requestInfo instanceof Request) {
|
|
445453
445469
|
const patchedUrl = patchString(requestInfo.url);
|
|
445454
|
-
|
|
445455
|
-
|
|
445456
|
-
}
|
|
445457
|
-
if (typeof requestInfo === "string") {
|
|
445470
|
+
finalUrl = new URL(patchedUrl);
|
|
445471
|
+
} else if (typeof requestInfo === "string") {
|
|
445458
445472
|
const patchedUrl = patchString(requestInfo);
|
|
445459
|
-
|
|
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);
|
|
445460
445483
|
}
|
|
445461
|
-
|
|
445484
|
+
return fetch(finalUrl, patchedRequestInit);
|
|
445462
445485
|
};
|
|
445463
445486
|
}
|
|
445464
445487
|
function createVertexModel(vertex2, modelId) {
|
|
@@ -445702,7 +445725,7 @@ class FlexibleChatTransport {
|
|
|
445702
445725
|
middlewares.push(createOutputSchemaMiddleware(chatId, model2, this.outputSchema));
|
|
445703
445726
|
}
|
|
445704
445727
|
if (llm.useToolCallMiddleware) {
|
|
445705
|
-
middlewares.push(createToolCallMiddleware());
|
|
445728
|
+
middlewares.push(createToolCallMiddleware(llm.type !== "google-vertex-tuning"));
|
|
445706
445729
|
}
|
|
445707
445730
|
const mcpTools = mcpInfo?.toolset && parseMcpToolSet(this.store, mcpInfo.toolset);
|
|
445708
445731
|
const tools = d2({
|
|
@@ -446873,7 +446896,7 @@ import {
|
|
|
446873
446896
|
rmSync,
|
|
446874
446897
|
statSync as statSync3
|
|
446875
446898
|
} from "node:fs";
|
|
446876
|
-
import { homedir as
|
|
446899
|
+
import { homedir as homedir6, tmpdir as tmpdir3 } from "node:os";
|
|
446877
446900
|
import { extname as extname5, join as join21 } from "node:path";
|
|
446878
446901
|
|
|
446879
446902
|
// src/upgrade/platform-utils.ts
|
|
@@ -446937,7 +446960,7 @@ function extractVersionFromTag(tag9) {
|
|
|
446937
446960
|
|
|
446938
446961
|
// src/upgrade/binary-installer.ts
|
|
446939
446962
|
function getPochiDir() {
|
|
446940
|
-
const pochiDir = join21(
|
|
446963
|
+
const pochiDir = join21(homedir6(), ".pochi");
|
|
446941
446964
|
const binDir = join21(pochiDir, "bin");
|
|
446942
446965
|
if (!existsSync7(pochiDir)) {
|
|
446943
446966
|
mkdirSync(pochiDir, { recursive: true });
|