@getpochi/cli 0.5.67 → 0.5.68

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 +24 -5
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -375096,7 +375096,7 @@ var {
375096
375096
  // package.json
375097
375097
  var package_default = {
375098
375098
  name: "@getpochi/cli",
375099
- version: "0.5.67",
375099
+ version: "0.5.68",
375100
375100
  type: "module",
375101
375101
  bin: {
375102
375102
  pochi: "src/cli.ts"
@@ -388920,7 +388920,7 @@ var ContentOutput = zod_default.object({
388920
388920
  ]))
388921
388921
  });
388922
388922
  async function fileToUri(store, file5, signal2) {
388923
- if (typeof process === "undefined") {
388923
+ if ("POCHI_CORS_PROXY_PORT" in globalThis) {
388924
388924
  return fileToRemoteUri(file5, signal2);
388925
388925
  }
388926
388926
  const data = new Uint8Array(await file5.arrayBuffer());
@@ -417042,7 +417042,7 @@ function parseMcpTool(store, _name, mcpTool) {
417042
417042
  if (item.type === "text") {
417043
417043
  return item;
417044
417044
  }
417045
- const blob3 = findBlob(store, new URL(item.data));
417045
+ const blob3 = findBlob(store, new URL(item.data), item.mimeType);
417046
417046
  if (!blob3) {
417047
417047
  return {
417048
417048
  type: "text",
@@ -417067,7 +417067,7 @@ function toBase642(bytes) {
417067
417067
  const base643 = btoa(binString);
417068
417068
  return base643;
417069
417069
  }
417070
- function findBlob(store, url3) {
417070
+ function findBlob(store, url3, mediaType) {
417071
417071
  if (url3.protocol === StoreBlobProtocol) {
417072
417072
  const blob3 = store.query(makeBlobQuery(url3.pathname));
417073
417073
  if (blob3) {
@@ -417076,6 +417076,11 @@ function findBlob(store, url3) {
417076
417076
  mediaType: blob3.mimeType
417077
417077
  };
417078
417078
  }
417079
+ } else {
417080
+ return {
417081
+ data: fetch(url3).then((x11) => x11.blob()).then((blob3) => blob3.arrayBuffer()).then((data) => toBase642(new Uint8Array(data))),
417082
+ mediaType
417083
+ };
417079
417084
  }
417080
417085
  }
417081
417086
 
@@ -418099,12 +418104,13 @@ class FlexibleChatTransport {
418099
418104
  return true;
418100
418105
  });
418101
418106
  const preparedMessages = await prepareMessages(messages2, environment2);
418107
+ const modelMessages = await resolvePromise(convertToModelMessages(formatters.llm(preparedMessages), { tools }));
418102
418108
  const stream12 = streamText({
418103
418109
  headers: {
418104
418110
  [PochiTaskIdHeader]: chatId
418105
418111
  },
418106
418112
  system: prompts.system(environment2?.info?.customRules, this.customAgent, mcpInfo?.instructions),
418107
- messages: convertToModelMessages(formatters.llm(preparedMessages), { tools }),
418113
+ messages: modelMessages,
418108
418114
  model: wrapLanguageModel({
418109
418115
  model: model2,
418110
418116
  middleware: middlewares
@@ -418191,6 +418197,19 @@ function estimateTotalTokens(messages2) {
418191
418197
  }
418192
418198
  return Math.ceil(totalTextLength / 4);
418193
418199
  }
418200
+ async function resolvePromise(o10) {
418201
+ const resolved = await o10;
418202
+ if (o5(resolved)) {
418203
+ return Promise.all(resolved.map((x11) => resolvePromise(x11)));
418204
+ }
418205
+ if (o4(resolved)) {
418206
+ return Object.fromEntries(await Promise.all(Object.entries(resolved).map(async ([k11, v11]) => [
418207
+ k11,
418208
+ await resolvePromise(v11)
418209
+ ])));
418210
+ }
418211
+ return resolved;
418212
+ }
418194
418213
 
418195
418214
  // ../livekit/src/chat/live-chat-kit.ts
418196
418215
  var logger23 = getLogger("LiveChatKit");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpochi/cli",
3
- "version": "0.5.67",
3
+ "version": "0.5.68",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "pochi": "dist/cli.js"