@getpochi/cli 0.5.78 → 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.
Files changed (2) hide show
  1. package/dist/cli.js +23 -14
  2. 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 isAutoApproveToolName(name17) {
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 isAutoApproveTool(part) {
386134
- return isAutoApproveToolName(getToolName(part));
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 = isUserInputToolPart(part) || isAutoApproveTool(part);
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 resp = await apiClient.api.models.$get();
390552
- const data = await resp.json();
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.78",
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 ((isUserInputToolPart(part) || isAutoApproveTool(part)) && part.state === "input-available" || part.state === "output-available" || part.state === "output-error") {
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 toolDefs = message.content.filter((x11) => x11.type === "tool-call").map((x11) => `<api-request name="${x11.toolName}">${JSON.stringify(x11.input)}</api-request>`);
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
- ${toolDefs.join(`
445150
+ ${toolCalls.join(`
445148
445151
  `)}
445149
445152
  </api-section>`;
445150
445153
  const content3 = [...message.content.filter((x11) => x11.type !== "tool-call")];
445151
- if (toolDefs.length > 0) {
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)}${convertToolResultOutput(x11.output)}${toolResponseEndTag}`
445180
+ text: `${toolResponseTagTemplate(x11.toolName)}${convertToolCallOutput(x11.output)}${toolResponseEndTag}`
445178
445181
  });
445179
445182
  }
445180
445183
  }
@@ -445322,7 +445325,13 @@ function createStopWordStream(stop3) {
445322
445325
  }
445323
445326
  });
445324
445327
  }
445325
- function convertToolResultOutput(x11) {
445328
+ function convertToolCallInput(x11) {
445329
+ if (typeof x11 === "string") {
445330
+ return x11;
445331
+ }
445332
+ return JSON.stringify(x11);
445333
+ }
445334
+ function convertToolCallOutput(x11) {
445326
445335
  if (x11.type === "json") {
445327
445336
  return JSON.stringify(x11.value);
445328
445337
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpochi/cli",
3
- "version": "0.5.78",
3
+ "version": "0.5.79",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "pochi": "dist/cli.js"