Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5d433ba

Browse files
committed
Prune upstreamed Pi 0.67.6 patches
1 parent f60cc09 commit 5d433ba

3 files changed

Lines changed: 158 additions & 398 deletions

File tree

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22

33
Small install-time patches for [pi](https://github.com/badlogic/pi-mono).
44

5-
Today this repo patches two things directly:
6-
- **OSC 8 terminal hyperlinks** so wrapped links stay clickable
5+
Today this repo patches three things directly:
6+
- **extra OSC 8 hyperlink coverage** for gaps not yet upstreamed (update banner, inline code spans, and URL-only code-block lines)
77
- **extension-runtime tool lookup hooks** (`getToolDefinition`, `getAllRegisteredTools`) for native custom-tool integration
8+
- **conflict-pruned patch manifests** that stay compatible with upstream `0.67.6+`, where base markdown OSC 8 links and wrap tracking are now built in
89

910
It also acts as a patch orchestrator for sibling repos. Right now it loads the OpenRouter multimodal transport patch from:
1011
- **`../pi-read/patches/pi-patches.json`** — adds native `input_audio`, `video_url`, and `file` routing on Pi's OpenAI-compatible OpenRouter path
@@ -35,14 +36,14 @@ then `pi-update` runs the same one-shot flow from any directory.
3536

3637
| Patch | File | What |
3738
|-------|------|------|
38-
| 001 | `markdown.js` | Wrap markdown links in OSC 8 |
39-
| 002–005 | `utils.js` | Track OSC 8 state in `AnsiCodeTracker` so hyperlinks survive line wraps |
4039
| 006 | `interactive-mode.js` | Make the update banner changelog URL clickable |
4140
| 007 | `markdown.js` | Wrap URLs in inline code spans (`` `https://...` ``) |
4241
| 008–009 | `markdown.js` | Wrap URL-only lines in code blocks (highlighted + plain) |
4342
| 010–015 | `loader.js`, `runner.js`, `types.d.ts` | Expose extension tool lookup/runtime helpers so extensions can resolve registered tools natively by name |
4443
| 016–018 | `openai-completions.js` via `../pi-read/patches/pi-patches.json` | Route OpenRouter audio/video/PDF through native `input_audio` / `video_url` / `file` chat-completions content blocks |
4544

45+
> Upstream `0.67.6` absorbed former patches **001–005** by adding native markdown OSC 8 link rendering and hyperlink wrap tracking in `@mariozechner/pi-tui`.
46+
4647
## How it works
4748

4849
`update.sh` is the entrypoint for the shell alias. It:
@@ -51,5 +52,5 @@ then `pi-update` runs the same one-shot flow from any directory.
5152
2. runs `apply.sh` to re-apply the local patches from `patches.json`
5253
3. runs `test.sh` to verify the patched install still behaves correctly
5354

54-
`patches.json` defines local patches that live in this repo. `sources.json` points at additional patch manifests owned by sibling repos (for example `../pi-read/patches/pi-patches.json`). `apply.sh` loads all of them, locates pi's install directory, applies everything atomically (no files written if any patch fails), and `test.sh` validates both the OSC 8 behavior and the OpenRouter multimodal routing behavior.
55+
`patches.json` defines local patches that live in this repo. `sources.json` points at additional patch manifests owned by sibling repos (for example `../pi-read/patches/pi-patches.json`). `apply.sh` loads all of them, locates pi's install directory, applies everything atomically (no files written if any patch fails), and `test.sh` validates the upstream OSC 8 baseline, the remaining local hyperlink/runtime patches, and the OpenRouter multimodal routing behavior.
5556

patches.json

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,4 @@
11
[
2-
{
3-
"id": "001-osc8-markdown-links",
4-
"file": "node_modules/@mariozechner/pi-tui/dist/components/markdown.js",
5-
"intent": "Wrap markdown links in OSC 8 hyperlink sequences so they are clickable and copy-pasteable even when they wrap across multiple terminal lines.",
6-
"find": "if (token.text === token.href || token.text === hrefForComparison) {\n result += this.theme.link(this.theme.underline(linkText)) + stylePrefix;\n }\n else {\n result +=\n this.theme.link(this.theme.underline(linkText)) +\n this.theme.linkUrl(` (${token.href})`) +\n stylePrefix;\n }",
7-
"replace": "if (token.text === token.href || token.text === hrefForComparison) {\n result += `\\x1b]8;;${token.href}\\x07` + this.theme.link(this.theme.underline(linkText)) + `\\x1b]8;;\\x07` + stylePrefix;\n }\n else {\n result +=\n `\\x1b]8;;${token.href}\\x07` + this.theme.link(this.theme.underline(linkText)) + this.theme.linkUrl(` (${token.href})`) + `\\x1b]8;;\\x07` +\n stylePrefix;\n }",
8-
"verify": "\\x1b]8;;${token.href}\\x07",
9-
"occurrences": 1
10-
},
11-
{
12-
"id": "002-osc8-tracker-state",
13-
"file": "node_modules/@mariozechner/pi-tui/dist/utils.js",
14-
"intent": "Add OSC 8 hyperlink URL tracking to AnsiCodeTracker so wrapTextWithAnsi re-opens hyperlinks on continuation lines when a link wraps across multiple terminal lines.",
15-
"find": " fgColor = null; // Stores the full code like \"31\" or \"38;5;240\"\n bgColor = null; // Stores the full code like \"41\" or \"48;5;240\"\n process(ansiCode) {\n if (!ansiCode.endsWith(\"m\")) {\n return;",
16-
"replace": " fgColor = null; // Stores the full code like \"31\" or \"38;5;240\"\n bgColor = null; // Stores the full code like \"41\" or \"48;5;240\"\n oscHyperlink = null; // Stores the current OSC 8 hyperlink URL\n process(ansiCode) {\n // Track OSC 8 hyperlink sequences: \\x1b]8;;URL\\x07 or \\x1b]8;;\\x07 (close)\n const oscMatch = ansiCode.match(/\\x1b\\]8;([^;]*);([\\s\\S]*)(?:\\x07|\\x1b\\\\)/);\n if (oscMatch) {\n this.oscHyperlink = oscMatch[2] || null;\n return;\n }\n if (!ansiCode.endsWith(\"m\")) {\n return;",
17-
"verify": "oscHyperlink = null;",
18-
"occurrences": 1
19-
},
20-
{
21-
"id": "003-osc8-tracker-reset",
22-
"file": "node_modules/@mariozechner/pi-tui/dist/utils.js",
23-
"intent": "Clear OSC 8 hyperlink state when AnsiCodeTracker is reset.",
24-
"find": " this.fgColor = null;\n this.bgColor = null;\n }\n /** Clear all state for reuse. */",
25-
"replace": " this.fgColor = null;\n this.bgColor = null;\n this.oscHyperlink = null;\n }\n /** Clear all state for reuse. */",
26-
"verify": "this.oscHyperlink = null;\n }\n /** Clear all state for reuse. */",
27-
"occurrences": 1
28-
},
29-
{
30-
"id": "004-osc8-tracker-getactivecodes",
31-
"file": "node_modules/@mariozechner/pi-tui/dist/utils.js",
32-
"intent": "Include OSC 8 hyperlink opener in getActiveCodes() so wrapped lines re-open the clickable link.",
33-
"find": " if (codes.length === 0)\n return \"\";\n return `\\x1b[${codes.join(\";\")}m`;\n }",
34-
"replace": " const sgrPrefix = codes.length === 0 ? \"\" : `\\x1b[${codes.join(\";\")}m`;\n const oscPrefix = this.oscHyperlink ? `\\x1b]8;;${this.oscHyperlink}\\x07` : \"\";\n return oscPrefix + sgrPrefix;\n }",
35-
"verify": "const oscPrefix = this.oscHyperlink",
36-
"occurrences": 1
37-
},
38-
{
39-
"id": "005-osc8-tracker-hasactivecodes",
40-
"file": "node_modules/@mariozechner/pi-tui/dist/utils.js",
41-
"intent": "Include OSC 8 hyperlink in hasActiveCodes() check so the tracker knows there is active state to restore.",
42-
"find": " this.fgColor !== null ||\n this.bgColor !== null);",
43-
"replace": " this.fgColor !== null ||\n this.bgColor !== null ||\n this.oscHyperlink !== null);",
44-
"verify": "this.oscHyperlink !== null);",
45-
"occurrences": 1
46-
},
472
{
483
"id": "007-osc8-codespan-urls",
494
"file": "node_modules/@mariozechner/pi-tui/dist/components/markdown.js",

0 commit comments

Comments
 (0)