@aliou/pi-synthetic 0.18.2 → 0.18.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aliou/pi-synthetic",
3
- "version": "0.18.2",
3
+ "version": "0.18.3",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "private": false,
@@ -37,6 +37,18 @@
37
37
  "@earendil-works/pi-tui": "*",
38
38
  "typebox": "*"
39
39
  },
40
+ "scripts": {
41
+ "typecheck": "tsc --noEmit",
42
+ "lint": "biome check",
43
+ "format": "biome check --write",
44
+ "test": "vitest run",
45
+ "test:watch": "vitest",
46
+ "check:lockfile": "pnpm install --frozen-lockfile --ignore-scripts",
47
+ "prepare": "[ -d .git ] && husky || true",
48
+ "changeset": "changeset",
49
+ "version": "changeset version",
50
+ "release": "pnpm changeset publish"
51
+ },
40
52
  "dependencies": {
41
53
  "@aliou/pi-utils-settings": "^0.15.0",
42
54
  "@aliou/pi-utils-ui": "^0.4.0"
@@ -53,6 +65,12 @@
53
65
  "vitest": "^4.0.18",
54
66
  "@earendil-works/pi-tui": "0.77.0"
55
67
  },
68
+ "pnpm": {
69
+ "overrides": {
70
+ "@earendil-works/pi-ai": "$@earendil-works/pi-coding-agent",
71
+ "@earendil-works/pi-tui": "$@earendil-works/pi-coding-agent"
72
+ }
73
+ },
56
74
  "peerDependenciesMeta": {
57
75
  "@earendil-works/pi-coding-agent": {
58
76
  "optional": true
@@ -64,15 +82,5 @@
64
82
  "optional": true
65
83
  }
66
84
  },
67
- "scripts": {
68
- "typecheck": "tsc --noEmit",
69
- "lint": "biome check",
70
- "format": "biome check --write",
71
- "test": "vitest run",
72
- "test:watch": "vitest",
73
- "check:lockfile": "pnpm install --frozen-lockfile --ignore-scripts",
74
- "changeset": "changeset",
75
- "version": "changeset version",
76
- "release": "pnpm changeset publish"
77
- }
78
- }
85
+ "packageManager": "pnpm@10.26.1"
86
+ }
@@ -155,22 +155,6 @@ export const SYNTHETIC_MODELS: SyntheticModelEntry[] = [
155
155
  contextWindow: 131072,
156
156
  maxTokens: 32768,
157
157
  },
158
- // API: hf:Qwen/Qwen3-Coder-480B-A35B-Instruct → ctx=262144, out=65536
159
- {
160
- id: "hf:Qwen/Qwen3-Coder-480B-A35B-Instruct",
161
- name: "Qwen/Qwen3-Coder-480B-A35B-Instruct",
162
- provider: "together",
163
- reasoning: false,
164
- input: ["text"],
165
- cost: {
166
- input: 2,
167
- output: 2,
168
- cacheRead: 2,
169
- cacheWrite: 0,
170
- },
171
- contextWindow: 262144,
172
- maxTokens: 65536,
173
- },
174
158
  // API: hf:moonshotai/Kimi-K2.6 → ctx=262144, out=65536
175
159
  {
176
160
  id: "hf:moonshotai/Kimi-K2.6",
@@ -5,8 +5,6 @@ import { join } from "node:path";
5
5
  import { ToolCallHeader, ToolFooter } from "@aliou/pi-utils-ui";
6
6
  import type { ExtensionAPI, Theme } from "@earendil-works/pi-coding-agent";
7
7
  import {
8
- DEFAULT_MAX_BYTES,
9
- DEFAULT_MAX_LINES,
10
8
  defineTool,
11
9
  formatSize,
12
10
  keyHint,
@@ -38,8 +36,6 @@ interface WebSearchResultDetails {
38
36
  tempFilePath?: string;
39
37
  totalLines: number;
40
38
  totalBytes: number;
41
- outputLines: number;
42
- outputBytes: number;
43
39
  }
44
40
 
45
41
  interface WebSearchDetails {
@@ -58,7 +54,7 @@ type SearchParamsType = Static<typeof SearchParams>;
58
54
  export const syntheticWebSearchTool = defineTool({
59
55
  name: SYNTHETIC_WEB_SEARCH_TOOL,
60
56
  label: "Synthetic: Web Search",
61
- description: `Search the web using Synthetic's zero-data-retention API. Returns search results with titles, URLs, content snippets, and publication dates. Use for finding documentation, articles, recent information, or any web content. Results are fresh and not cached by Synthetic. Results are truncated to ${DEFAULT_MAX_LINES} lines or ${formatSize(DEFAULT_MAX_BYTES)} (whichever is hit first). If truncated, full output is saved to a temp file.`,
57
+ description: `Search the web using Synthetic's zero-data-retention API. Returns search results with titles, URLs, content snippets, and publication dates. Use for finding documentation, articles, recent information, or any web content. Results are fresh and not cached by Synthetic. Results exceeding 1000 lines or 25KB are saved to temp files and referenced inline (use the read tool to inspect). Shorter results are included inline.`,
62
58
  promptSnippet: "Search the web using Synthetic's zero-data-retention API",
63
59
  promptGuidelines: [
64
60
  "Use synthetic_web_search for finding documentation, articles, recent information, or any web content.",
@@ -123,26 +119,31 @@ export const syntheticWebSearchTool = defineTool({
123
119
  .replace(/(^-|-$)/g, "")
124
120
  .slice(0, 40);
125
121
  const truncation = truncateHead(result.text, {
126
- maxLines: DEFAULT_MAX_LINES,
127
- maxBytes: DEFAULT_MAX_BYTES,
122
+ maxLines: 1000,
123
+ maxBytes: 25_000,
128
124
  });
129
125
 
130
- let preview = truncation.content;
126
+ let inline: string;
131
127
  let tempFilePath: string | undefined;
132
128
 
133
129
  if (truncation.truncated) {
130
+ // Result exceeds limits — write full content to a temp file
131
+ // and only reference it inline to avoid eating LLM context
134
132
  tempFilePath = join(
135
133
  tmpdir(),
136
134
  `pi-synthetic-search-${slug}-${randomBytes(4).toString("hex")}.md`,
137
135
  );
138
136
  await writeFile(tempFilePath, result.text, "utf8");
139
- preview += `\n\n[Result truncated: ${truncation.outputLines} of ${truncation.totalLines} lines (${formatSize(truncation.outputBytes)} of ${formatSize(truncation.totalBytes)}). Full result: ${tempFilePath}]`;
137
+ inline = `[Result too large: ${truncation.totalLines} lines, ${formatSize(truncation.totalBytes)}. Full result saved to: ${tempFilePath}. Use the read tool to inspect it.]`;
138
+ } else {
139
+ // Result fits within limits — include inline
140
+ inline = truncation.content;
140
141
  }
141
142
 
142
143
  content += `## ${result.title}\n`;
143
144
  content += `URL: ${result.url}\n`;
144
145
  content += `Published: ${result.published}\n`;
145
- content += `\n${preview}\n`;
146
+ content += `\n${inline}\n`;
146
147
  content += "\n---\n\n";
147
148
 
148
149
  resultDetails.push({
@@ -153,8 +154,6 @@ export const syntheticWebSearchTool = defineTool({
153
154
  tempFilePath,
154
155
  totalLines: truncation.totalLines,
155
156
  totalBytes: truncation.totalBytes,
156
- outputLines: truncation.outputLines,
157
- outputBytes: truncation.outputBytes,
158
157
  });
159
158
  }
160
159
 
@@ -214,7 +213,7 @@ export const syntheticWebSearchTool = defineTool({
214
213
  // Collapsed: show result count + first result title
215
214
  let text = theme.fg("success", `Found ${results.length} result(s)`);
216
215
  if (hasTruncation) {
217
- text += theme.fg("warning", " (truncated)");
216
+ text += theme.fg("warning", " (offloaded)");
218
217
  }
219
218
  const first = results[0];
220
219
  if (first) {
@@ -258,7 +257,7 @@ export const syntheticWebSearchTool = defineTool({
258
257
  if (r.truncated) {
259
258
  container.addChild(
260
259
  new Text(
261
- ` ${theme.fg("warning", `Truncated: ${r.outputLines} of ${r.totalLines} lines (${formatSize(r.outputBytes)} of ${formatSize(r.totalBytes)}). Full content: ${r.tempFilePath}`)}`,
260
+ ` ${theme.fg("warning", `Offloaded: ${r.totalLines} lines, ${formatSize(r.totalBytes)}. Full result: ${r.tempFilePath}`)}`,
262
261
  0,
263
262
  0,
264
263
  ),
@@ -275,7 +274,7 @@ export const syntheticWebSearchTool = defineTool({
275
274
  if (hasTruncation) {
276
275
  const truncatedCount = results.filter((r) => r.truncated).length;
277
276
  footerItems.push({
278
- label: "truncated",
277
+ label: "offloaded",
279
278
  value: `${truncatedCount}`,
280
279
  });
281
280
  }