@getpochi/cli 0.5.42 → 0.5.43
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 +111 -39
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -352558,11 +352558,15 @@ function isAutoApproveTool(part) {
|
|
|
352558
352558
|
}
|
|
352559
352559
|
var ToolsByPermission = {
|
|
352560
352560
|
read: [
|
|
352561
|
-
|
|
352562
|
-
|
|
352563
|
-
|
|
352564
|
-
|
|
352565
|
-
|
|
352561
|
+
...[
|
|
352562
|
+
"readFile",
|
|
352563
|
+
"listFiles",
|
|
352564
|
+
"globFiles",
|
|
352565
|
+
"searchFiles",
|
|
352566
|
+
"readBackgroundJobOutput"
|
|
352567
|
+
],
|
|
352568
|
+
"webFetch",
|
|
352569
|
+
"webSearch"
|
|
352566
352570
|
],
|
|
352567
352571
|
write: [
|
|
352568
352572
|
"writeToFile",
|
|
@@ -353212,7 +353216,19 @@ function extractCompactMessages(messages) {
|
|
|
353212
353216
|
}
|
|
353213
353217
|
return messages;
|
|
353214
353218
|
}
|
|
353219
|
+
function removeEmptyTextParts(messages) {
|
|
353220
|
+
return messages.map((message) => {
|
|
353221
|
+
message.parts = message.parts.filter((part) => {
|
|
353222
|
+
if (part.type === "text" || part.type === "reasoning") {
|
|
353223
|
+
return part.text.trim().length > 0;
|
|
353224
|
+
}
|
|
353225
|
+
return true;
|
|
353226
|
+
});
|
|
353227
|
+
return message;
|
|
353228
|
+
});
|
|
353229
|
+
}
|
|
353215
353230
|
var LLMFormatOps = [
|
|
353231
|
+
removeEmptyTextParts,
|
|
353216
353232
|
removeEmptyMessages,
|
|
353217
353233
|
extractCompactMessages,
|
|
353218
353234
|
removeMessagesWithoutTextOrToolCall,
|
|
@@ -356607,6 +356623,90 @@ function updatePochiCredentials(credentials) {
|
|
|
356607
356623
|
});
|
|
356608
356624
|
}
|
|
356609
356625
|
|
|
356626
|
+
// ../vendor-pochi/src/tools/web-fetch.ts
|
|
356627
|
+
var makeWebFetch = (getToken) => ({
|
|
356628
|
+
description: `
|
|
356629
|
+
- Fetches content from a specified URL and converts HTML to markdown
|
|
356630
|
+
- Use this tool when you need to retrieve and analyze web content
|
|
356631
|
+
|
|
356632
|
+
Usage notes:
|
|
356633
|
+
- IMPORTANT: If an MCP-provided web fetch tool is available, prefer using that tool instead of this one, as it may have fewer restrictions.
|
|
356634
|
+
- The URL must be a fully-formed valid URL
|
|
356635
|
+
- The prompt should describe what information you want to extract from the page
|
|
356636
|
+
- This tool is read-only and does not modify any files
|
|
356637
|
+
- Includes a self-cleaning 10-minute cache for faster responses when repeatedly accessing the same URL
|
|
356638
|
+
`.trim(),
|
|
356639
|
+
inputSchema: {
|
|
356640
|
+
jsonSchema: v4_default.toJSONSchema(v4_default.object({
|
|
356641
|
+
url: v4_default.url()
|
|
356642
|
+
}))
|
|
356643
|
+
},
|
|
356644
|
+
execute: async (args) => {
|
|
356645
|
+
const token = await getToken();
|
|
356646
|
+
const response = await fetch("https://api-gateway.getpochi.com/https/r.jina.ai", {
|
|
356647
|
+
method: "POST",
|
|
356648
|
+
headers: {
|
|
356649
|
+
"Content-Type": "application/json",
|
|
356650
|
+
Authorization: `Bearer ${token}`
|
|
356651
|
+
},
|
|
356652
|
+
body: JSON.stringify(args)
|
|
356653
|
+
});
|
|
356654
|
+
if (response.ok) {
|
|
356655
|
+
const content = await response.text();
|
|
356656
|
+
return {
|
|
356657
|
+
content: [
|
|
356658
|
+
{
|
|
356659
|
+
type: "text",
|
|
356660
|
+
text: content
|
|
356661
|
+
}
|
|
356662
|
+
]
|
|
356663
|
+
};
|
|
356664
|
+
}
|
|
356665
|
+
throw new Error(`Failed to fetch: ${response.statusText}`);
|
|
356666
|
+
}
|
|
356667
|
+
});
|
|
356668
|
+
// ../vendor-pochi/src/tools/web-search.ts
|
|
356669
|
+
var makeWebSearch = (getToken) => ({
|
|
356670
|
+
description: `
|
|
356671
|
+
- Allows Pochi to search the web and use the results to inform responses
|
|
356672
|
+
- Provides up-to-date information for current events and recent data
|
|
356673
|
+
- Returns search result information formatted as search result blocks
|
|
356674
|
+
- Searches are performed automatically within a single API call
|
|
356675
|
+
`.trim(),
|
|
356676
|
+
inputSchema: {
|
|
356677
|
+
jsonSchema: v4_default.toJSONSchema(v4_default.object({
|
|
356678
|
+
query: v4_default.string().describe("The search query to perform"),
|
|
356679
|
+
country: v4_default.string().optional().describe("Country code to filter search results by, e.g. 'US', 'GB', 'JP'")
|
|
356680
|
+
}))
|
|
356681
|
+
},
|
|
356682
|
+
execute: async (args) => {
|
|
356683
|
+
const token = await getToken();
|
|
356684
|
+
const response = await fetch("https://api-gateway.getpochi.com/https/api.perplexity.ai/search", {
|
|
356685
|
+
method: "POST",
|
|
356686
|
+
headers: {
|
|
356687
|
+
"Content-Type": "application/json",
|
|
356688
|
+
Authorization: `Bearer ${token}`
|
|
356689
|
+
},
|
|
356690
|
+
body: JSON.stringify({
|
|
356691
|
+
...args,
|
|
356692
|
+
max_tokens_per_page: 256
|
|
356693
|
+
})
|
|
356694
|
+
});
|
|
356695
|
+
if (response.ok) {
|
|
356696
|
+
const { results } = await response.json();
|
|
356697
|
+
return {
|
|
356698
|
+
content: results.map((result2) => ({
|
|
356699
|
+
type: "text",
|
|
356700
|
+
text: `# ${result2.title}
|
|
356701
|
+
created: ${result2.date}, last updated: ${result2.last_updated}, [Read more](${result2.url})
|
|
356702
|
+
|
|
356703
|
+
${result2.snippet}`
|
|
356704
|
+
}))
|
|
356705
|
+
};
|
|
356706
|
+
}
|
|
356707
|
+
throw new Error(`Failed to fetch: ${response.statusText}`);
|
|
356708
|
+
}
|
|
356709
|
+
});
|
|
356610
356710
|
// ../vendor-pochi/src/types.ts
|
|
356611
356711
|
var VendorId = "pochi";
|
|
356612
356712
|
|
|
@@ -356660,38 +356760,10 @@ class Pochi extends VendorBase {
|
|
|
356660
356760
|
};
|
|
356661
356761
|
}
|
|
356662
356762
|
async getTools() {
|
|
356763
|
+
const getToken = () => this.getCredentials().then((c3) => c3.jwt || "");
|
|
356663
356764
|
return {
|
|
356664
|
-
webFetch:
|
|
356665
|
-
|
|
356666
|
-
inputSchema: {
|
|
356667
|
-
jsonSchema: v4_default.toJSONSchema(v4_default.object({
|
|
356668
|
-
url: v4_default.url()
|
|
356669
|
-
}))
|
|
356670
|
-
},
|
|
356671
|
-
execute: async (args) => {
|
|
356672
|
-
const { jwt: jwt2 } = await this.getCredentials();
|
|
356673
|
-
const response = await fetch("https://api-gateway.getpochi.com/https/r.jina.ai", {
|
|
356674
|
-
method: "POST",
|
|
356675
|
-
headers: {
|
|
356676
|
-
"Content-Type": "application/json",
|
|
356677
|
-
Authorization: `Bearer ${jwt2}`
|
|
356678
|
-
},
|
|
356679
|
-
body: JSON.stringify(args)
|
|
356680
|
-
});
|
|
356681
|
-
if (response.ok) {
|
|
356682
|
-
const content = await response.text();
|
|
356683
|
-
return {
|
|
356684
|
-
content: [
|
|
356685
|
-
{
|
|
356686
|
-
type: "text",
|
|
356687
|
-
text: content
|
|
356688
|
-
}
|
|
356689
|
-
]
|
|
356690
|
-
};
|
|
356691
|
-
}
|
|
356692
|
-
throw new Error(`Failed to fetch: ${response.statusText}`);
|
|
356693
|
-
}
|
|
356694
|
-
}
|
|
356765
|
+
webFetch: makeWebFetch(getToken),
|
|
356766
|
+
webSearch: makeWebSearch(getToken)
|
|
356695
356767
|
};
|
|
356696
356768
|
}
|
|
356697
356769
|
}
|
|
@@ -358365,7 +358437,7 @@ function createPochiModel({
|
|
|
358365
358437
|
};
|
|
358366
358438
|
}
|
|
358367
358439
|
function createApiClient(getCredentials) {
|
|
358368
|
-
const
|
|
358440
|
+
const apiClient = hc(getServerBaseUrl(), {
|
|
358369
358441
|
async fetch(input2, init) {
|
|
358370
358442
|
const { token } = await getCredentials();
|
|
358371
358443
|
const headers = new Headers(init?.headers);
|
|
@@ -358376,7 +358448,7 @@ function createApiClient(getCredentials) {
|
|
|
358376
358448
|
});
|
|
358377
358449
|
}
|
|
358378
358450
|
});
|
|
358379
|
-
return
|
|
358451
|
+
return apiClient;
|
|
358380
358452
|
}
|
|
358381
358453
|
function convertFilePartDataToBase64(prompt) {
|
|
358382
358454
|
return prompt.map((message) => {
|
|
@@ -368082,7 +368154,7 @@ var {
|
|
|
368082
368154
|
// package.json
|
|
368083
368155
|
var package_default = {
|
|
368084
368156
|
name: "@getpochi/cli",
|
|
368085
|
-
version: "0.5.
|
|
368157
|
+
version: "0.5.43",
|
|
368086
368158
|
type: "module",
|
|
368087
368159
|
bin: {
|
|
368088
368160
|
pochi: "src/cli.ts"
|