@getpochi/cli 0.5.76 → 0.5.78
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 +71 -31
- 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.78",
|
|
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
|
}
|
|
@@ -445157,7 +445174,7 @@ function processToolResult(tool2, toolResponseTagTemplate, toolResponseEndTag) {
|
|
|
445157
445174
|
} else {
|
|
445158
445175
|
content3.push({
|
|
445159
445176
|
type: "text",
|
|
445160
|
-
text: `${toolResponseTagTemplate(x11.toolName)}${
|
|
445177
|
+
text: `${toolResponseTagTemplate(x11.toolName)}${convertToolResultOutput(x11.output)}${toolResponseEndTag}`
|
|
445161
445178
|
});
|
|
445162
445179
|
}
|
|
445163
445180
|
}
|
|
@@ -445305,6 +445322,23 @@ function createStopWordStream(stop3) {
|
|
|
445305
445322
|
}
|
|
445306
445323
|
});
|
|
445307
445324
|
}
|
|
445325
|
+
function convertToolResultOutput(x11) {
|
|
445326
|
+
if (x11.type === "json") {
|
|
445327
|
+
return JSON.stringify(x11.value);
|
|
445328
|
+
}
|
|
445329
|
+
if (x11.type === "text") {
|
|
445330
|
+
return x11.value;
|
|
445331
|
+
}
|
|
445332
|
+
if (x11.type === "error-text" || x11.type === "error-json") {
|
|
445333
|
+
return JSON.stringify({
|
|
445334
|
+
error: x11.value
|
|
445335
|
+
});
|
|
445336
|
+
}
|
|
445337
|
+
assertUnreachable(x11);
|
|
445338
|
+
}
|
|
445339
|
+
function assertUnreachable(x11) {
|
|
445340
|
+
throw new Error(`Unreachable case: ${x11}`);
|
|
445341
|
+
}
|
|
445308
445342
|
// ../livekit/src/chat/middlewares/output-schema-middleware.ts
|
|
445309
445343
|
function createOutputSchemaMiddleware(taskId, model2, outputSchema2) {
|
|
445310
445344
|
return {
|
|
@@ -445444,21 +445478,27 @@ function createPatchedFetchForFinetune(accessToken) {
|
|
|
445444
445478
|
...requestInit,
|
|
445445
445479
|
headers
|
|
445446
445480
|
};
|
|
445481
|
+
let finalUrl;
|
|
445447
445482
|
if (requestInfo instanceof URL) {
|
|
445448
|
-
|
|
445449
|
-
|
|
445450
|
-
|
|
445451
|
-
}
|
|
445452
|
-
if (requestInfo instanceof Request) {
|
|
445483
|
+
finalUrl = new URL(requestInfo);
|
|
445484
|
+
finalUrl.pathname = patchString(finalUrl.pathname);
|
|
445485
|
+
} else if (requestInfo instanceof Request) {
|
|
445453
445486
|
const patchedUrl = patchString(requestInfo.url);
|
|
445454
|
-
|
|
445455
|
-
|
|
445456
|
-
}
|
|
445457
|
-
if (typeof requestInfo === "string") {
|
|
445487
|
+
finalUrl = new URL(patchedUrl);
|
|
445488
|
+
} else if (typeof requestInfo === "string") {
|
|
445458
445489
|
const patchedUrl = patchString(requestInfo);
|
|
445459
|
-
|
|
445490
|
+
finalUrl = new URL(patchedUrl);
|
|
445491
|
+
} else {
|
|
445492
|
+
throw new Error(`Unexpected requestInfo type: ${typeof requestInfo}`);
|
|
445493
|
+
}
|
|
445494
|
+
if (globalThis.POCHI_CORS_PROXY_PORT) {
|
|
445495
|
+
const origin = finalUrl.origin;
|
|
445496
|
+
finalUrl.protocol = "http:";
|
|
445497
|
+
finalUrl.host = "localhost";
|
|
445498
|
+
finalUrl.port = globalThis.POCHI_CORS_PROXY_PORT;
|
|
445499
|
+
patchedRequestInit.headers.set("x-proxy-origin", origin);
|
|
445460
445500
|
}
|
|
445461
|
-
|
|
445501
|
+
return fetch(finalUrl, patchedRequestInit);
|
|
445462
445502
|
};
|
|
445463
445503
|
}
|
|
445464
445504
|
function createVertexModel(vertex2, modelId) {
|
|
@@ -445651,9 +445691,9 @@ function createModel2({ llm }) {
|
|
|
445651
445691
|
if (llm.type === "openai-responses") {
|
|
445652
445692
|
return createOpenAIResponsesModel(llm);
|
|
445653
445693
|
}
|
|
445654
|
-
|
|
445694
|
+
assertUnreachable2(llm);
|
|
445655
445695
|
}
|
|
445656
|
-
function
|
|
445696
|
+
function assertUnreachable2(_x) {
|
|
445657
445697
|
throw new Error("Didn't expect to get here");
|
|
445658
445698
|
}
|
|
445659
445699
|
|
|
@@ -445702,7 +445742,7 @@ class FlexibleChatTransport {
|
|
|
445702
445742
|
middlewares.push(createOutputSchemaMiddleware(chatId, model2, this.outputSchema));
|
|
445703
445743
|
}
|
|
445704
445744
|
if (llm.useToolCallMiddleware) {
|
|
445705
|
-
middlewares.push(createToolCallMiddleware());
|
|
445745
|
+
middlewares.push(createToolCallMiddleware(llm.type !== "google-vertex-tuning"));
|
|
445706
445746
|
}
|
|
445707
445747
|
const mcpTools = mcpInfo?.toolset && parseMcpToolSet(this.store, mcpInfo.toolset);
|
|
445708
445748
|
const tools = d2({
|
|
@@ -446873,7 +446913,7 @@ import {
|
|
|
446873
446913
|
rmSync,
|
|
446874
446914
|
statSync as statSync3
|
|
446875
446915
|
} from "node:fs";
|
|
446876
|
-
import { homedir as
|
|
446916
|
+
import { homedir as homedir6, tmpdir as tmpdir3 } from "node:os";
|
|
446877
446917
|
import { extname as extname5, join as join21 } from "node:path";
|
|
446878
446918
|
|
|
446879
446919
|
// src/upgrade/platform-utils.ts
|
|
@@ -446937,7 +446977,7 @@ function extractVersionFromTag(tag9) {
|
|
|
446937
446977
|
|
|
446938
446978
|
// src/upgrade/binary-installer.ts
|
|
446939
446979
|
function getPochiDir() {
|
|
446940
|
-
const pochiDir = join21(
|
|
446980
|
+
const pochiDir = join21(homedir6(), ".pochi");
|
|
446941
446981
|
const binDir = join21(pochiDir, "bin");
|
|
446942
446982
|
if (!existsSync7(pochiDir)) {
|
|
446943
446983
|
mkdirSync(pochiDir, { recursive: true });
|
|
@@ -447356,7 +447396,7 @@ async function createLLMConfigWithProviders(program6, model2) {
|
|
|
447356
447396
|
useToolCallMiddleware: modelSetting.useToolCallMiddleware
|
|
447357
447397
|
};
|
|
447358
447398
|
}
|
|
447359
|
-
|
|
447399
|
+
assertUnreachable3(modelProvider.kind);
|
|
447360
447400
|
}
|
|
447361
447401
|
async function waitForSync(inputStore, timeoutDuration = "1 second") {
|
|
447362
447402
|
if (!process.env.POCHI_LIVEKIT_SYNC_ON) {
|
|
@@ -447376,7 +447416,7 @@ async function waitForSync(inputStore, timeoutDuration = "1 second") {
|
|
|
447376
447416
|
await store.shutdown();
|
|
447377
447417
|
}
|
|
447378
447418
|
}
|
|
447379
|
-
function
|
|
447419
|
+
function assertUnreachable3(_x) {
|
|
447380
447420
|
throw new Error("Didn't expect to get here");
|
|
447381
447421
|
}
|
|
447382
447422
|
async function getModelFromWorkflow(options6) {
|