@mrclrchtr/supi-web 6.4.0 → 7.0.1
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
package/src/tool/result.ts
CHANGED
|
@@ -7,9 +7,6 @@ import {
|
|
|
7
7
|
} from "@earendil-works/pi-coding-agent";
|
|
8
8
|
import { writeTempFile } from "../temp-file.ts";
|
|
9
9
|
|
|
10
|
-
/** Human-readable truncation contract shared by all model-visible web outputs. */
|
|
11
|
-
export const MODEL_OUTPUT_LIMIT_DESCRIPTION = `Inline truncates at ${DEFAULT_MAX_LINES.toLocaleString()} lines/${formatSize(DEFAULT_MAX_BYTES)}; full saved to temp.`;
|
|
12
|
-
|
|
13
10
|
/** Result of preparing content for a tool response visible to the model. */
|
|
14
11
|
export interface ModelVisibleOutput {
|
|
15
12
|
/** Text safe to return in a tool result. */
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
export const toolDescription =
|
|
2
|
+
"Fetch focused Context7 docs for a known library_id. Search first if the ID is unknown. Markdown is the default; raw=true returns JSON snippets.";
|
|
2
3
|
|
|
3
|
-
export const
|
|
4
|
+
export const promptSnippet = "fetch focused Context7 documentation";
|
|
4
5
|
|
|
5
|
-
export const
|
|
6
|
-
|
|
7
|
-
export const promptGuidelines = [
|
|
8
|
-
"Use web_docs_fetch with a known library_id and narrow query; raw only for JSON.",
|
|
9
|
-
];
|
|
6
|
+
export const promptGuidelines: string[] = [];
|
|
@@ -8,7 +8,7 @@ export const WEB_DOCS_FETCH_TOOL_LABEL = "Web Docs Fetch";
|
|
|
8
8
|
export const webDocsFetchParameters = Type.Object(
|
|
9
9
|
{
|
|
10
10
|
library_id: Type.String({
|
|
11
|
-
description: "Context7 ID
|
|
11
|
+
description: "Context7 ID, for example /facebook/react.",
|
|
12
12
|
}),
|
|
13
13
|
query: Type.String({ description: "Specific docs question" }),
|
|
14
14
|
raw: Type.Optional(
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
export const toolDescription = "Search Context7 for library IDs and return compact Markdown.";
|
|
2
2
|
|
|
3
|
-
export const
|
|
3
|
+
export const promptSnippet = "find Context7 library IDs";
|
|
4
4
|
|
|
5
|
-
export const
|
|
6
|
-
|
|
7
|
-
export const promptGuidelines = ["Use web_docs_search before web_docs_fetch if ID unknown."];
|
|
5
|
+
export const promptGuidelines: string[] = [];
|
|
@@ -1,32 +1,17 @@
|
|
|
1
|
-
import { spawnSync } from "node:child_process";
|
|
2
|
-
import { MODEL_OUTPUT_LIMIT_DESCRIPTION } from "../result.ts";
|
|
3
1
|
import type { WebToolPromptSurface } from "../tool-specs.ts";
|
|
4
2
|
import { WEB_FETCH_INLINE_MAX_CHARS } from "./spec.ts";
|
|
5
3
|
|
|
6
|
-
export const toolDescription = `Fetch public http(s) URL as Markdown. Not for login
|
|
4
|
+
export const toolDescription = `Fetch a public http(s) URL as Markdown. Not for login or private pages. Use gh for GitHub URLs when available. output_mode auto returns up to ${WEB_FETCH_INLINE_MAX_CHARS.toLocaleString()} characters inline and otherwise returns a temporary-file path; file always returns a temporary-file path. Links are absolute by default.`;
|
|
7
5
|
|
|
8
|
-
export const promptSnippet = "
|
|
6
|
+
export const promptSnippet = "fetch a public URL as Markdown";
|
|
9
7
|
|
|
10
|
-
export const promptGuidelines = [
|
|
8
|
+
export const promptGuidelines: string[] = [];
|
|
11
9
|
|
|
12
|
-
/**
|
|
10
|
+
/** Return the static prompt surface for web_fetch_md. */
|
|
13
11
|
export function getWebFetchPromptSurface(): WebToolPromptSurface {
|
|
14
|
-
const guidelines = [...promptGuidelines];
|
|
15
|
-
if (isGhAvailable()) {
|
|
16
|
-
guidelines.push("Use `gh` CLI instead of web_fetch_md for GitHub URLs.");
|
|
17
|
-
}
|
|
18
12
|
return {
|
|
19
13
|
description: toolDescription,
|
|
20
14
|
promptSnippet,
|
|
21
|
-
promptGuidelines
|
|
15
|
+
promptGuidelines,
|
|
22
16
|
};
|
|
23
17
|
}
|
|
24
|
-
|
|
25
|
-
function isGhAvailable(): boolean {
|
|
26
|
-
try {
|
|
27
|
-
const result = spawnSync("gh", ["--version"], { stdio: "ignore" });
|
|
28
|
-
return result.status === 0;
|
|
29
|
-
} catch {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
}
|