@bdsqqq/pi 0.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/dist/chunk-DsIazq42.js +26 -0
- package/dist/command-palette-B97yKqne.js +406 -0
- package/dist/core/agents-md.d.ts +22 -0
- package/dist/core/agents-md.js +174 -0
- package/dist/core/box-chrome.d.ts +56 -0
- package/dist/core/box-chrome.js +207 -0
- package/dist/core/box-format.d.ts +82 -0
- package/dist/core/box-format.js +381 -0
- package/dist/core/config.d.ts +14 -0
- package/dist/core/config.js +201 -0
- package/dist/core/file-tracker.d.ts +65 -0
- package/dist/core/file-tracker.js +439 -0
- package/dist/core/github-api.d.ts +45 -0
- package/dist/core/github-api.js +101 -0
- package/dist/core/html-to-md.d.ts +5 -0
- package/dist/core/html-to-md.js +289 -0
- package/dist/core/interpolate.d.ts +44 -0
- package/dist/core/interpolate.js +475 -0
- package/dist/core/mutex.d.ts +8 -0
- package/dist/core/mutex.js +142 -0
- package/dist/core/output-buffer.d.ts +80 -0
- package/dist/core/output-buffer.js +517 -0
- package/dist/core/permissions.d.ts +19 -0
- package/dist/core/permissions.js +140 -0
- package/dist/core/pi-spawn.d.ts +62 -0
- package/dist/core/pi-spawn.js +244 -0
- package/dist/core/prompt-patch.d.ts +11 -0
- package/dist/core/prompt-patch.js +16 -0
- package/dist/core/show-renderer.d.ts +10 -0
- package/dist/core/show-renderer.js +39 -0
- package/dist/core/show.d.ts +29 -0
- package/dist/core/show.js +288 -0
- package/dist/core/sub-agent-render.d.ts +56 -0
- package/dist/core/sub-agent-render.js +579 -0
- package/dist/core/tool-cost.d.ts +17 -0
- package/dist/core/tool-cost.js +58 -0
- package/dist/core/tui.d.ts +9 -0
- package/dist/core/tui.js +33 -0
- package/dist/editor-BljciPdx.js +537 -0
- package/dist/extensions/bash.d.ts +12 -0
- package/dist/extensions/bash.js +261 -0
- package/dist/extensions/code-review.d.ts +14 -0
- package/dist/extensions/code-review.js +175 -0
- package/dist/extensions/command-palette.d.ts +6 -0
- package/dist/extensions/command-palette.js +2 -0
- package/dist/extensions/create-file.d.ts +7 -0
- package/dist/extensions/create-file.js +88 -0
- package/dist/extensions/edit-file.d.ts +7 -0
- package/dist/extensions/edit-file.js +395 -0
- package/dist/extensions/editor.d.ts +6 -0
- package/dist/extensions/editor.js +2 -0
- package/dist/extensions/finder.d.ts +13 -0
- package/dist/extensions/finder.js +108 -0
- package/dist/extensions/format-file.d.ts +11 -0
- package/dist/extensions/format-file.js +145 -0
- package/dist/extensions/github.d.ts +13 -0
- package/dist/extensions/github.js +527 -0
- package/dist/extensions/glob.d.ts +10 -0
- package/dist/extensions/glob.js +163 -0
- package/dist/extensions/grep.d.ts +13 -0
- package/dist/extensions/grep.js +356 -0
- package/dist/extensions/handoff.d.ts +6 -0
- package/dist/extensions/handoff.js +277 -0
- package/dist/extensions/librarian.d.ts +13 -0
- package/dist/extensions/librarian.js +113 -0
- package/dist/extensions/look-at.d.ts +13 -0
- package/dist/extensions/look-at.js +121 -0
- package/dist/extensions/ls.d.ts +8 -0
- package/dist/extensions/ls.js +87 -0
- package/dist/extensions/mermaid.d.ts +20 -0
- package/dist/extensions/mermaid.js +2 -0
- package/dist/extensions/oracle.d.ts +13 -0
- package/dist/extensions/oracle.js +143 -0
- package/dist/extensions/read-session.d.ts +13 -0
- package/dist/extensions/read-session.js +265 -0
- package/dist/extensions/read-web-page.d.ts +11 -0
- package/dist/extensions/read-web-page.js +234 -0
- package/dist/extensions/read.d.ts +23 -0
- package/dist/extensions/read.js +323 -0
- package/dist/extensions/search-sessions.d.ts +29 -0
- package/dist/extensions/search-sessions.js +426 -0
- package/dist/extensions/session-name.d.ts +6 -0
- package/dist/extensions/session-name.js +54 -0
- package/dist/extensions/skill.d.ts +7 -0
- package/dist/extensions/skill.js +232 -0
- package/dist/extensions/system-prompt.d.ts +6 -0
- package/dist/extensions/system-prompt.js +31 -0
- package/dist/extensions/task.d.ts +11 -0
- package/dist/extensions/task.js +114 -0
- package/dist/extensions/tool-harness.d.ts +6 -0
- package/dist/extensions/tool-harness.js +37 -0
- package/dist/extensions/undo-edit.d.ts +7 -0
- package/dist/extensions/undo-edit.js +127 -0
- package/dist/extensions/web-search.d.ts +12 -0
- package/dist/extensions/web-search.js +254 -0
- package/dist/extensions.d.ts +29 -0
- package/dist/extensions.js +29 -0
- package/dist/mermaid-C7xCVBrw.js +95296 -0
- package/package.json +67 -0
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
//#region packages/core/html-to-md/index.ts
|
|
3
|
+
/**
|
|
4
|
+
* cheerio-based HTML→markdown. returns null when cheerio isn't
|
|
5
|
+
* resolvable (caller falls back to raw output). optimizes for
|
|
6
|
+
* LLM-readable output over pixel-perfect fidelity.
|
|
7
|
+
*/
|
|
8
|
+
let cheerioLoad = null;
|
|
9
|
+
try {
|
|
10
|
+
cheerioLoad = createRequire(import.meta.url)("cheerio").load;
|
|
11
|
+
} catch {}
|
|
12
|
+
const REMOVE_SELECTORS = [
|
|
13
|
+
"script",
|
|
14
|
+
"style",
|
|
15
|
+
"noscript",
|
|
16
|
+
"svg",
|
|
17
|
+
"iframe",
|
|
18
|
+
"nav",
|
|
19
|
+
"footer",
|
|
20
|
+
"header",
|
|
21
|
+
"aside",
|
|
22
|
+
"[role=\"navigation\"]",
|
|
23
|
+
"[role=\"banner\"]",
|
|
24
|
+
"[role=\"complementary\"]",
|
|
25
|
+
"[role=\"contentinfo\"]",
|
|
26
|
+
".cookie-banner",
|
|
27
|
+
".cookie-consent",
|
|
28
|
+
"#cookie-banner",
|
|
29
|
+
"#cookie-consent"
|
|
30
|
+
].join(", ");
|
|
31
|
+
const MAIN_SELECTORS = [
|
|
32
|
+
"main",
|
|
33
|
+
"article",
|
|
34
|
+
"[role=\"main\"]",
|
|
35
|
+
"#content",
|
|
36
|
+
"#main",
|
|
37
|
+
".content",
|
|
38
|
+
".main",
|
|
39
|
+
".post-content",
|
|
40
|
+
".article-content",
|
|
41
|
+
".entry-content"
|
|
42
|
+
];
|
|
43
|
+
function isHtml(text) {
|
|
44
|
+
const trimmed = text.trimStart().slice(0, 200).toLowerCase();
|
|
45
|
+
return trimmed.startsWith("<!doctype") || trimmed.startsWith("<html") || trimmed.startsWith("<?xml");
|
|
46
|
+
}
|
|
47
|
+
function nodeToMd($, node) {
|
|
48
|
+
if (node.type === "text") return (node.data || "").replace(/[ \t]+/g, " ");
|
|
49
|
+
if (node.type !== "tag") return "";
|
|
50
|
+
const tag = node.name?.toLowerCase();
|
|
51
|
+
if (!tag) return "";
|
|
52
|
+
const el = $(node);
|
|
53
|
+
const children = el.contents().toArray();
|
|
54
|
+
const inner = () => children.map((c) => nodeToMd($, c)).join("");
|
|
55
|
+
if (/^h[1-6]$/.test(tag)) {
|
|
56
|
+
const level = parseInt(tag[1]);
|
|
57
|
+
const text = inner().trim();
|
|
58
|
+
if (!text) return "";
|
|
59
|
+
return `\n\n${"#".repeat(level)} ${text}\n\n`;
|
|
60
|
+
}
|
|
61
|
+
if (tag === "p") {
|
|
62
|
+
const text = inner().trim();
|
|
63
|
+
return text ? `\n\n${text}\n\n` : "";
|
|
64
|
+
}
|
|
65
|
+
if (tag === "br") return "\n";
|
|
66
|
+
if (tag === "a") {
|
|
67
|
+
const href = el.attr("href");
|
|
68
|
+
const text = inner().trim();
|
|
69
|
+
if (!text) return "";
|
|
70
|
+
if (!href || href.startsWith("#") || href.startsWith("javascript:")) return text;
|
|
71
|
+
return `[${text}](${href})`;
|
|
72
|
+
}
|
|
73
|
+
if (tag === "strong" || tag === "b") {
|
|
74
|
+
const text = inner().trim();
|
|
75
|
+
return text ? `**${text}**` : "";
|
|
76
|
+
}
|
|
77
|
+
if (tag === "em" || tag === "i") {
|
|
78
|
+
const text = inner().trim();
|
|
79
|
+
return text ? `*${text}*` : "";
|
|
80
|
+
}
|
|
81
|
+
if (tag === "code") {
|
|
82
|
+
if (el.parent().is("pre")) return el.text();
|
|
83
|
+
const text = el.text().trim();
|
|
84
|
+
return text ? `\`${text}\`` : "";
|
|
85
|
+
}
|
|
86
|
+
if (tag === "pre") {
|
|
87
|
+
const code = el.find("code");
|
|
88
|
+
return `\n\n\`\`\`${code.attr("class")?.match(/language-(\w+)/)?.[1] || ""}\n${code.length > 0 ? code.text() : el.text()}\n\`\`\`\n\n`;
|
|
89
|
+
}
|
|
90
|
+
if (tag === "ul" || tag === "ol") return `\n\n${el.children("li").toArray().map((li, i) => {
|
|
91
|
+
const text = nodeToMd($, li).trim();
|
|
92
|
+
return `${tag === "ol" ? `${i + 1}. ` : "- "}${text}`;
|
|
93
|
+
}).join("\n")}\n\n`;
|
|
94
|
+
if (tag === "li") return inner();
|
|
95
|
+
if (tag === "blockquote") {
|
|
96
|
+
const text = inner().trim();
|
|
97
|
+
return text ? `\n\n${text.split("\n").map((l) => `> ${l}`).join("\n")}\n\n` : "";
|
|
98
|
+
}
|
|
99
|
+
if (tag === "img") {
|
|
100
|
+
const alt = el.attr("alt") || "";
|
|
101
|
+
const src = el.attr("src") || "";
|
|
102
|
+
if (!src) return "";
|
|
103
|
+
return ``;
|
|
104
|
+
}
|
|
105
|
+
if (tag === "table") {
|
|
106
|
+
const rows = el.find("tr").toArray();
|
|
107
|
+
if (rows.length === 0) return "";
|
|
108
|
+
const result = [];
|
|
109
|
+
for (let i = 0; i < rows.length; i++) {
|
|
110
|
+
const cells = $(rows[i]).find("th, td").toArray().map((c) => $(c).text().trim());
|
|
111
|
+
if (cells.length === 0) continue;
|
|
112
|
+
result.push(`| ${cells.join(" | ")} |`);
|
|
113
|
+
if (i === 0) result.push(`| ${cells.map(() => "---").join(" | ")} |`);
|
|
114
|
+
}
|
|
115
|
+
return result.length > 0 ? `\n\n${result.join("\n")}\n\n` : "";
|
|
116
|
+
}
|
|
117
|
+
if ([
|
|
118
|
+
"div",
|
|
119
|
+
"section",
|
|
120
|
+
"article",
|
|
121
|
+
"main",
|
|
122
|
+
"figure",
|
|
123
|
+
"figcaption",
|
|
124
|
+
"details",
|
|
125
|
+
"summary",
|
|
126
|
+
"dl",
|
|
127
|
+
"dt",
|
|
128
|
+
"dd"
|
|
129
|
+
].includes(tag)) return inner();
|
|
130
|
+
if (tag === "hr") return "\n\n---\n\n";
|
|
131
|
+
return inner();
|
|
132
|
+
}
|
|
133
|
+
function collapseWhitespace(text) {
|
|
134
|
+
return text.replace(/\n{3,}/g, "\n\n").replace(/[ \t]+\n/g, "\n").trim();
|
|
135
|
+
}
|
|
136
|
+
function htmlToMarkdown(html) {
|
|
137
|
+
if (!cheerioLoad) return null;
|
|
138
|
+
if (!isHtml(html)) return null;
|
|
139
|
+
const $ = cheerioLoad(html);
|
|
140
|
+
$(REMOVE_SELECTORS).remove();
|
|
141
|
+
let root = null;
|
|
142
|
+
for (const sel of MAIN_SELECTORS) {
|
|
143
|
+
const found = $(sel);
|
|
144
|
+
if (found.length > 0) {
|
|
145
|
+
root = found.first();
|
|
146
|
+
break;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
if (!root) root = $("body");
|
|
150
|
+
return collapseWhitespace(root.contents().toArray().map((n) => nodeToMd($, n)).join(""));
|
|
151
|
+
}
|
|
152
|
+
if (import.meta.vitest) {
|
|
153
|
+
const { describe, it, expect } = import.meta.vitest;
|
|
154
|
+
describe("isHtml", () => {
|
|
155
|
+
it("returns true for doctype", () => {
|
|
156
|
+
expect(isHtml("<!DOCTYPE html><html><body>test</body></html>")).toBe(true);
|
|
157
|
+
expect(isHtml(" <!DOCTYPE html>\n<html>")).toBe(true);
|
|
158
|
+
});
|
|
159
|
+
it("returns true for html tag", () => {
|
|
160
|
+
expect(isHtml("<html><body>test</body></html>")).toBe(true);
|
|
161
|
+
expect(isHtml(" <html lang='en'>")).toBe(true);
|
|
162
|
+
});
|
|
163
|
+
it("returns true for xml declaration", () => {
|
|
164
|
+
expect(isHtml("<?xml version='1.0'?><root>")).toBe(true);
|
|
165
|
+
expect(isHtml(" <?xml?>")).toBe(true);
|
|
166
|
+
});
|
|
167
|
+
it("returns false for plain text", () => {
|
|
168
|
+
expect(isHtml("just plain text")).toBe(false);
|
|
169
|
+
expect(isHtml("some <b>bold</b> in text")).toBe(false);
|
|
170
|
+
});
|
|
171
|
+
it("returns false for markdown", () => {
|
|
172
|
+
expect(isHtml("# Heading\n\nParagraph")).toBe(false);
|
|
173
|
+
expect(isHtml("- list item\n- another")).toBe(false);
|
|
174
|
+
});
|
|
175
|
+
it("returns false for empty string", () => {
|
|
176
|
+
expect(isHtml("")).toBe(false);
|
|
177
|
+
});
|
|
178
|
+
it("only checks first 200 chars", () => {
|
|
179
|
+
const padding = "x".repeat(250);
|
|
180
|
+
expect(isHtml(padding + "<!DOCTYPE html>")).toBe(false);
|
|
181
|
+
expect(isHtml("<!DOCTYPE html>" + padding)).toBe(true);
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
describe("htmlToMarkdown", () => {
|
|
185
|
+
it("returns null for non-HTML content", () => {
|
|
186
|
+
expect(htmlToMarkdown("plain text")).toBeNull();
|
|
187
|
+
expect(htmlToMarkdown("# Markdown")).toBeNull();
|
|
188
|
+
});
|
|
189
|
+
it("converts headings", () => {
|
|
190
|
+
const md = htmlToMarkdown("<!DOCTYPE html><html><body><h1>Title</h1><h2>Subtitle</h2></body></html>");
|
|
191
|
+
expect(md).toContain("# Title");
|
|
192
|
+
expect(md).toContain("## Subtitle");
|
|
193
|
+
});
|
|
194
|
+
it("converts paragraphs", () => {
|
|
195
|
+
const md = htmlToMarkdown("<!DOCTYPE html><html><body><p>First para.</p><p>Second para.</p></body></html>");
|
|
196
|
+
expect(md).toContain("First para.");
|
|
197
|
+
expect(md).toContain("Second para.");
|
|
198
|
+
});
|
|
199
|
+
it("converts links", () => {
|
|
200
|
+
expect(htmlToMarkdown("<!DOCTYPE html><html><body><a href=\"https://example.com\">Click here</a></body></html>")).toContain("[Click here](https://example.com)");
|
|
201
|
+
});
|
|
202
|
+
it("converts bold and italic", () => {
|
|
203
|
+
const md = htmlToMarkdown("<!DOCTYPE html><html><body><strong>bold</strong> <em>italic</em></body></html>");
|
|
204
|
+
expect(md).toContain("**bold**");
|
|
205
|
+
expect(md).toContain("*italic*");
|
|
206
|
+
});
|
|
207
|
+
it("converts code blocks", () => {
|
|
208
|
+
const md = htmlToMarkdown("<!DOCTYPE html><html><body><pre><code class=\"language-typescript\">const x = 1;</code></pre></body></html>");
|
|
209
|
+
expect(md).toContain("```typescript");
|
|
210
|
+
expect(md).toContain("const x = 1;");
|
|
211
|
+
});
|
|
212
|
+
it("converts inline code", () => {
|
|
213
|
+
expect(htmlToMarkdown("<!DOCTYPE html><html><body><p>Use <code>npm install</code> to install.</p></body></html>")).toContain("`npm install`");
|
|
214
|
+
});
|
|
215
|
+
it("converts unordered lists", () => {
|
|
216
|
+
const md = htmlToMarkdown("<!DOCTYPE html><html><body><ul><li>Item 1</li><li>Item 2</li></ul></body></html>");
|
|
217
|
+
expect(md).toContain("- Item 1");
|
|
218
|
+
expect(md).toContain("- Item 2");
|
|
219
|
+
});
|
|
220
|
+
it("converts ordered lists", () => {
|
|
221
|
+
const md = htmlToMarkdown("<!DOCTYPE html><html><body><ol><li>First</li><li>Second</li></ol></body></html>");
|
|
222
|
+
expect(md).toContain("1. First");
|
|
223
|
+
expect(md).toContain("2. Second");
|
|
224
|
+
});
|
|
225
|
+
it("converts blockquotes", () => {
|
|
226
|
+
expect(htmlToMarkdown("<!DOCTYPE html><html><body><blockquote>A wise quote</blockquote></body></html>")).toContain("> A wise quote");
|
|
227
|
+
});
|
|
228
|
+
it("converts images", () => {
|
|
229
|
+
expect(htmlToMarkdown("<!DOCTYPE html><html><body><img src=\"test.png\" alt=\"Alt text\"></body></html>")).toContain("");
|
|
230
|
+
});
|
|
231
|
+
it("converts tables", () => {
|
|
232
|
+
const md = htmlToMarkdown(`<!DOCTYPE html><html><body>
|
|
233
|
+
<table>
|
|
234
|
+
<tr><th>A</th><th>B</th></tr>
|
|
235
|
+
<tr><td>1</td><td>2</td></tr>
|
|
236
|
+
</table>
|
|
237
|
+
</body></html>`);
|
|
238
|
+
expect(md).toContain("| A | B |");
|
|
239
|
+
expect(md).toContain("| --- | --- |");
|
|
240
|
+
expect(md).toContain("| 1 | 2 |");
|
|
241
|
+
});
|
|
242
|
+
it("removes script and style tags", () => {
|
|
243
|
+
const md = htmlToMarkdown(`<!DOCTYPE html><html><body>
|
|
244
|
+
<script>console.log('hidden')<\/script>
|
|
245
|
+
<p>Visible content</p>
|
|
246
|
+
<style>.hidden { display: none; }</style>
|
|
247
|
+
</body></html>`);
|
|
248
|
+
expect(md).toContain("Visible content");
|
|
249
|
+
expect(md).not.toContain("console.log");
|
|
250
|
+
expect(md).not.toContain(".hidden");
|
|
251
|
+
});
|
|
252
|
+
it("removes navigation elements", () => {
|
|
253
|
+
const md = htmlToMarkdown(`<!DOCTYPE html><html><body>
|
|
254
|
+
<nav><a href="/">Home</a></nav>
|
|
255
|
+
<main><p>Main content</p></main>
|
|
256
|
+
<footer>Copyright</footer>
|
|
257
|
+
</body></html>`);
|
|
258
|
+
expect(md).toContain("Main content");
|
|
259
|
+
expect(md).not.toContain("Home");
|
|
260
|
+
expect(md).not.toContain("Copyright");
|
|
261
|
+
});
|
|
262
|
+
it("finds main content area", () => {
|
|
263
|
+
const md = htmlToMarkdown(`<!DOCTYPE html><html><body>
|
|
264
|
+
<nav>Navigation</nav>
|
|
265
|
+
<article>
|
|
266
|
+
<h1>Article Title</h1>
|
|
267
|
+
<p>Article content.</p>
|
|
268
|
+
</article>
|
|
269
|
+
</body></html>`);
|
|
270
|
+
expect(md).toContain("Article Title");
|
|
271
|
+
expect(md).toContain("Article content");
|
|
272
|
+
});
|
|
273
|
+
it("collapses excessive whitespace", () => {
|
|
274
|
+
expect(htmlToMarkdown(`<!DOCTYPE html><html><body><p>Test</p></body></html>`)).not.toMatch(/\n{3,}/);
|
|
275
|
+
});
|
|
276
|
+
it("handles nested elements", () => {
|
|
277
|
+
const md = htmlToMarkdown(`<!DOCTYPE html><html><body>
|
|
278
|
+
<ul>
|
|
279
|
+
<li><strong>Bold item</strong></li>
|
|
280
|
+
<li><em>Italic item</em></li>
|
|
281
|
+
</ul>
|
|
282
|
+
</body></html>`);
|
|
283
|
+
expect(md).toContain("- **Bold item**");
|
|
284
|
+
expect(md).toContain("- *Italic item*");
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
//#endregion
|
|
289
|
+
export { htmlToMarkdown, isHtml };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//#region packages/core/interpolate/index.d.ts
|
|
2
|
+
type VariableDefinition = {
|
|
3
|
+
/** built-in runtime var key (cwd, roots, date, os, repo, sessionId, ls, identity, harness, harnessDocsSection) */runtime?: string; /** static string value */
|
|
4
|
+
literal?: string; /** reference another variable by name */
|
|
5
|
+
alias?: string; /** read file contents — path relative to resolveConfigDir() */
|
|
6
|
+
file?: string; /** read environment variable */
|
|
7
|
+
env?: string; /** eval JS expression via new Function("require", ...) */
|
|
8
|
+
dangerously_evaluate_js?: string; /** run shell command, capture stdout */
|
|
9
|
+
dangerously_evaluate_sh?: string; /** fallback when resolver returns empty. supports {var} refs. */
|
|
10
|
+
default?: string; /** drop entire template line if var is empty. default true. */
|
|
11
|
+
dropLineIfEmpty?: boolean; /** working directory for dangerously_evaluate_sh. supports {var} refs. */
|
|
12
|
+
cwd?: string;
|
|
13
|
+
};
|
|
14
|
+
type PromptVariables = Record<string, VariableDefinition>;
|
|
15
|
+
declare const DEFAULT_PROMPT_VARIABLES: PromptVariables;
|
|
16
|
+
/** walk up from dir looking for .git to find the workspace root. falls back to dir itself. */
|
|
17
|
+
declare function findGitRoot(dir: string): string;
|
|
18
|
+
/** try to get the git remote origin URL for a directory. */
|
|
19
|
+
declare function getGitRemoteUrl(dir: string): string;
|
|
20
|
+
/** extra context from the parent pi session — fields are empty when the API doesn't expose them. */
|
|
21
|
+
interface InterpolateContext {
|
|
22
|
+
sessionId?: string;
|
|
23
|
+
repo?: string;
|
|
24
|
+
/** agent identity name, e.g. "Amp". default: "Amp" */
|
|
25
|
+
identity?: string;
|
|
26
|
+
/** harness name, e.g. "pi" or "amp". determines which docs to load. default: "pi" */
|
|
27
|
+
harness?: string;
|
|
28
|
+
/** pre-loaded harness docs section. if provided, skips file read. */
|
|
29
|
+
harnessDocsSection?: string;
|
|
30
|
+
}
|
|
31
|
+
/** compute the built-in runtime variables map from cwd + extra context. */
|
|
32
|
+
declare function computeRuntimeVars(cwd: string, extra?: InterpolateContext): Record<string, string>;
|
|
33
|
+
/**
|
|
34
|
+
* resolve template variables in agent prompts (e.g. {cwd}, {roots}, {date}).
|
|
35
|
+
*
|
|
36
|
+
* when a value is unavailable and dropLineIfEmpty is true (default),
|
|
37
|
+
* the entire line containing the placeholder is removed rather than
|
|
38
|
+
* leaving an empty label like "Repository: ".
|
|
39
|
+
*
|
|
40
|
+
* merge order: DEFAULT_PROMPT_VARIABLES → global config promptVariables → variables arg.
|
|
41
|
+
*/
|
|
42
|
+
declare function interpolatePromptVars(prompt: string, cwd: string, extra?: InterpolateContext, variables?: PromptVariables): string;
|
|
43
|
+
//#endregion
|
|
44
|
+
export { DEFAULT_PROMPT_VARIABLES, InterpolateContext, PromptVariables, VariableDefinition, computeRuntimeVars, findGitRoot, getGitRemoteUrl, interpolatePromptVars };
|