@getpochi/cli 0.5.77 → 0.5.79
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 +43 -17
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -386127,11 +386127,13 @@ function isUserInputToolPart(part) {
|
|
|
386127
386127
|
return false;
|
|
386128
386128
|
return isUserInputToolName(getToolName(part));
|
|
386129
386129
|
}
|
|
386130
|
-
function
|
|
386131
|
-
return ToolsByPermission.default.some((tool2) => name17 === tool2);
|
|
386130
|
+
function isAutoSuccessToolName(name17) {
|
|
386131
|
+
return isUserInputToolName(name17) || ToolsByPermission.default.some((tool2) => name17 === tool2);
|
|
386132
386132
|
}
|
|
386133
|
-
function
|
|
386134
|
-
|
|
386133
|
+
function isAutoSuccessToolPart(part) {
|
|
386134
|
+
if (!isToolUIPart(part))
|
|
386135
|
+
return false;
|
|
386136
|
+
return isAutoSuccessToolName(getToolName(part));
|
|
386135
386137
|
}
|
|
386136
386138
|
var ToolsByPermission = {
|
|
386137
386139
|
read: [
|
|
@@ -386669,7 +386671,7 @@ function resolvePendingToolCalls(messages, resolveLastMessage = false) {
|
|
|
386669
386671
|
if ((resolveLastMessage ? true : index < messages.length - 1) && message.role === "assistant") {
|
|
386670
386672
|
const parts = message.parts.map((part) => {
|
|
386671
386673
|
if (isToolUIPart(part) && part.state !== "output-available" && part.state !== "output-error") {
|
|
386672
|
-
const isSuccess =
|
|
386674
|
+
const isSuccess = isAutoSuccessToolPart(part);
|
|
386673
386675
|
return {
|
|
386674
386676
|
...part,
|
|
386675
386677
|
state: "output-available",
|
|
@@ -390548,8 +390550,9 @@ class Pochi extends VendorBase {
|
|
|
390548
390550
|
async fetchModels() {
|
|
390549
390551
|
if (!this.cachedModels) {
|
|
390550
390552
|
const apiClient = hc(getServerBaseUrl());
|
|
390551
|
-
const
|
|
390552
|
-
|
|
390553
|
+
const data = await apiClient.api.models.$get().then((x) => x.json()).catch(() => {
|
|
390554
|
+
return [];
|
|
390555
|
+
});
|
|
390553
390556
|
this.cachedModels = Object.fromEntries(data.map((x) => [
|
|
390554
390557
|
x.id,
|
|
390555
390558
|
{
|
|
@@ -404610,7 +404613,7 @@ var {
|
|
|
404610
404613
|
// package.json
|
|
404611
404614
|
var package_default = {
|
|
404612
404615
|
name: "@getpochi/cli",
|
|
404613
|
-
version: "0.5.
|
|
404616
|
+
version: "0.5.79",
|
|
404614
404617
|
type: "module",
|
|
404615
404618
|
bin: {
|
|
404616
404619
|
pochi: "src/cli.ts"
|
|
@@ -443911,7 +443914,7 @@ class OutputRenderer {
|
|
|
443911
443914
|
} else {
|
|
443912
443915
|
const { text: text20, stop: stop3, error: error46 } = renderToolPart(part);
|
|
443913
443916
|
this.spinner.prefixText = text20;
|
|
443914
|
-
if ((
|
|
443917
|
+
if (isAutoSuccessToolPart(part) && part.state === "input-available" || part.state === "output-available" || part.state === "output-error") {
|
|
443915
443918
|
if (error46) {
|
|
443916
443919
|
this.spinner.fail(source_default.dim(JSON.stringify(error46)));
|
|
443917
443920
|
} else {
|
|
@@ -445142,13 +445145,13 @@ function createToolCallStream(toolCallStartRegex, toolCallStartPrefix, toolCallE
|
|
|
445142
445145
|
});
|
|
445143
445146
|
}
|
|
445144
445147
|
function processAssistant(message) {
|
|
445145
|
-
const
|
|
445148
|
+
const toolCalls = message.content.filter((x11) => x11.type === "tool-call").map((x11) => `<api-request name="${x11.toolName}">${convertToolCallInput(x11)}</api-request>`);
|
|
445146
445149
|
const toolContent = `<api-section>
|
|
445147
|
-
${
|
|
445150
|
+
${toolCalls.join(`
|
|
445148
445151
|
`)}
|
|
445149
445152
|
</api-section>`;
|
|
445150
445153
|
const content3 = [...message.content.filter((x11) => x11.type !== "tool-call")];
|
|
445151
|
-
if (
|
|
445154
|
+
if (toolCalls.length > 0) {
|
|
445152
445155
|
content3.push({
|
|
445153
445156
|
type: "text",
|
|
445154
445157
|
text: toolContent
|
|
@@ -445174,7 +445177,7 @@ function processToolResult(tool2, toolResponseTagTemplate, toolResponseEndTag) {
|
|
|
445174
445177
|
} else {
|
|
445175
445178
|
content3.push({
|
|
445176
445179
|
type: "text",
|
|
445177
|
-
text: `${toolResponseTagTemplate(x11.toolName)}${
|
|
445180
|
+
text: `${toolResponseTagTemplate(x11.toolName)}${convertToolCallOutput(x11.output)}${toolResponseEndTag}`
|
|
445178
445181
|
});
|
|
445179
445182
|
}
|
|
445180
445183
|
}
|
|
@@ -445322,6 +445325,29 @@ function createStopWordStream(stop3) {
|
|
|
445322
445325
|
}
|
|
445323
445326
|
});
|
|
445324
445327
|
}
|
|
445328
|
+
function convertToolCallInput(x11) {
|
|
445329
|
+
if (typeof x11 === "string") {
|
|
445330
|
+
return x11;
|
|
445331
|
+
}
|
|
445332
|
+
return JSON.stringify(x11);
|
|
445333
|
+
}
|
|
445334
|
+
function convertToolCallOutput(x11) {
|
|
445335
|
+
if (x11.type === "json") {
|
|
445336
|
+
return JSON.stringify(x11.value);
|
|
445337
|
+
}
|
|
445338
|
+
if (x11.type === "text") {
|
|
445339
|
+
return x11.value;
|
|
445340
|
+
}
|
|
445341
|
+
if (x11.type === "error-text" || x11.type === "error-json") {
|
|
445342
|
+
return JSON.stringify({
|
|
445343
|
+
error: x11.value
|
|
445344
|
+
});
|
|
445345
|
+
}
|
|
445346
|
+
assertUnreachable(x11);
|
|
445347
|
+
}
|
|
445348
|
+
function assertUnreachable(x11) {
|
|
445349
|
+
throw new Error(`Unreachable case: ${x11}`);
|
|
445350
|
+
}
|
|
445325
445351
|
// ../livekit/src/chat/middlewares/output-schema-middleware.ts
|
|
445326
445352
|
function createOutputSchemaMiddleware(taskId, model2, outputSchema2) {
|
|
445327
445353
|
return {
|
|
@@ -445674,9 +445700,9 @@ function createModel2({ llm }) {
|
|
|
445674
445700
|
if (llm.type === "openai-responses") {
|
|
445675
445701
|
return createOpenAIResponsesModel(llm);
|
|
445676
445702
|
}
|
|
445677
|
-
|
|
445703
|
+
assertUnreachable2(llm);
|
|
445678
445704
|
}
|
|
445679
|
-
function
|
|
445705
|
+
function assertUnreachable2(_x) {
|
|
445680
445706
|
throw new Error("Didn't expect to get here");
|
|
445681
445707
|
}
|
|
445682
445708
|
|
|
@@ -447379,7 +447405,7 @@ async function createLLMConfigWithProviders(program6, model2) {
|
|
|
447379
447405
|
useToolCallMiddleware: modelSetting.useToolCallMiddleware
|
|
447380
447406
|
};
|
|
447381
447407
|
}
|
|
447382
|
-
|
|
447408
|
+
assertUnreachable3(modelProvider.kind);
|
|
447383
447409
|
}
|
|
447384
447410
|
async function waitForSync(inputStore, timeoutDuration = "1 second") {
|
|
447385
447411
|
if (!process.env.POCHI_LIVEKIT_SYNC_ON) {
|
|
@@ -447399,7 +447425,7 @@ async function waitForSync(inputStore, timeoutDuration = "1 second") {
|
|
|
447399
447425
|
await store.shutdown();
|
|
447400
447426
|
}
|
|
447401
447427
|
}
|
|
447402
|
-
function
|
|
447428
|
+
function assertUnreachable3(_x) {
|
|
447403
447429
|
throw new Error("Didn't expect to get here");
|
|
447404
447430
|
}
|
|
447405
447431
|
async function getModelFromWorkflow(options6) {
|