pi-startup-redraw-fix 0.1.9 → 0.1.11
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/CHANGELOG.md +10 -0
- package/package.json +64 -64
- package/src/index.ts +18 -18
- package/src/terminal-clear-patch.ts +44 -44
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.11] - 2026-05-26
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
- Widened peer dependency ranges to `^0.74.0 || ^0.75.0`
|
|
7
|
+
|
|
8
|
+
## [0.1.10] - 2026-05-22
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- Aligned Pi peer dependency metadata with the `@earendil-works` Pi v0.75.4 extension runtime packages.
|
|
12
|
+
|
|
3
13
|
## [0.1.9] - 2026-04-25
|
|
4
14
|
|
|
5
15
|
### Changed
|
package/package.json
CHANGED
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "pi-startup-redraw-fix",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Pi extension that patches terminal full-clear ordering to avoid startup redraw glitches.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./index.ts",
|
|
7
|
-
"exports": {
|
|
8
|
-
".": "./index.ts"
|
|
9
|
-
},
|
|
10
|
-
"files": [
|
|
11
|
-
"index.ts",
|
|
12
|
-
"src",
|
|
13
|
-
"asset",
|
|
14
|
-
"config/config.example.json",
|
|
15
|
-
"README.md",
|
|
16
|
-
"CHANGELOG.md",
|
|
17
|
-
"LICENSE"
|
|
18
|
-
],
|
|
19
|
-
"scripts": {
|
|
20
|
-
"build": "npx --yes -p typescript@5.7.3 tsc -p tsconfig.json --noCheck",
|
|
21
|
-
"lint": "npm run build",
|
|
22
|
-
"test": "
|
|
23
|
-
"check": "npm run lint && npm run test"
|
|
24
|
-
},
|
|
25
|
-
"keywords": [
|
|
26
|
-
"pi-package",
|
|
27
|
-
"pi",
|
|
28
|
-
"pi-extension",
|
|
29
|
-
"pi-coding-agent",
|
|
30
|
-
"pi-tui",
|
|
31
|
-
"coding-agent",
|
|
32
|
-
"terminal",
|
|
33
|
-
"terminal-emulator",
|
|
34
|
-
"startup",
|
|
35
|
-
"startup-fix",
|
|
36
|
-
"redraw",
|
|
37
|
-
"bugfix"
|
|
38
|
-
],
|
|
39
|
-
"author": "MasuRii",
|
|
40
|
-
"license": "MIT",
|
|
41
|
-
"repository": {
|
|
42
|
-
"type": "git",
|
|
43
|
-
"url": "git+https://github.com/MasuRii/pi-startup-redraw-fix.git"
|
|
44
|
-
},
|
|
45
|
-
"bugs": {
|
|
46
|
-
"url": "https://github.com/MasuRii/pi-startup-redraw-fix/issues"
|
|
47
|
-
},
|
|
48
|
-
"homepage": "https://github.com/MasuRii/pi-startup-redraw-fix#readme",
|
|
49
|
-
"engines": {
|
|
50
|
-
"node": ">=20"
|
|
51
|
-
},
|
|
52
|
-
"publishConfig": {
|
|
53
|
-
"access": "public"
|
|
54
|
-
},
|
|
55
|
-
"pi": {
|
|
56
|
-
"extensions": [
|
|
57
|
-
"./index.ts"
|
|
58
|
-
]
|
|
59
|
-
},
|
|
60
|
-
"peerDependencies": {
|
|
61
|
-
"@
|
|
62
|
-
"@
|
|
63
|
-
}
|
|
64
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "pi-startup-redraw-fix",
|
|
3
|
+
"version": "0.1.11",
|
|
4
|
+
"description": "Pi extension that patches terminal full-clear ordering to avoid startup redraw glitches.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./index.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./index.ts"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"index.ts",
|
|
12
|
+
"src",
|
|
13
|
+
"asset",
|
|
14
|
+
"config/config.example.json",
|
|
15
|
+
"README.md",
|
|
16
|
+
"CHANGELOG.md",
|
|
17
|
+
"LICENSE"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "npx --yes -p typescript@5.7.3 tsc -p tsconfig.json --noCheck",
|
|
21
|
+
"lint": "npm run build",
|
|
22
|
+
"test": "npx --yes tsx --test normalize-clear-sequence.test.mjs",
|
|
23
|
+
"check": "npm run lint && npm run test"
|
|
24
|
+
},
|
|
25
|
+
"keywords": [
|
|
26
|
+
"pi-package",
|
|
27
|
+
"pi",
|
|
28
|
+
"pi-extension",
|
|
29
|
+
"pi-coding-agent",
|
|
30
|
+
"pi-tui",
|
|
31
|
+
"coding-agent",
|
|
32
|
+
"terminal",
|
|
33
|
+
"terminal-emulator",
|
|
34
|
+
"startup",
|
|
35
|
+
"startup-fix",
|
|
36
|
+
"redraw",
|
|
37
|
+
"bugfix"
|
|
38
|
+
],
|
|
39
|
+
"author": "MasuRii",
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "git+https://github.com/MasuRii/pi-startup-redraw-fix.git"
|
|
44
|
+
},
|
|
45
|
+
"bugs": {
|
|
46
|
+
"url": "https://github.com/MasuRii/pi-startup-redraw-fix/issues"
|
|
47
|
+
},
|
|
48
|
+
"homepage": "https://github.com/MasuRii/pi-startup-redraw-fix#readme",
|
|
49
|
+
"engines": {
|
|
50
|
+
"node": ">=20"
|
|
51
|
+
},
|
|
52
|
+
"publishConfig": {
|
|
53
|
+
"access": "public"
|
|
54
|
+
},
|
|
55
|
+
"pi": {
|
|
56
|
+
"extensions": [
|
|
57
|
+
"./index.ts"
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
"peerDependencies": {
|
|
61
|
+
"@earendil-works/pi-coding-agent": "^0.74.0 || ^0.75.0",
|
|
62
|
+
"@earendil-works/pi-tui": "^0.74.0 || ^0.75.0"
|
|
63
|
+
}
|
|
64
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import type { ExtensionAPI } from "@
|
|
2
|
-
|
|
3
|
-
import { applyTerminalClearSequencePatch } from "./terminal-clear-patch.js";
|
|
4
|
-
|
|
5
|
-
export default function startupRedrawFixExtension(pi: ExtensionAPI): void {
|
|
6
|
-
const patchResult = applyTerminalClearSequencePatch();
|
|
7
|
-
|
|
8
|
-
pi.on("session_start", async (_event, ctx) => {
|
|
9
|
-
if (!ctx.hasUI) {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (!patchResult.patched && !patchResult.alreadyPatched) {
|
|
14
|
-
const reason = patchResult.error ?? "unknown error";
|
|
15
|
-
ctx.ui.notify(`startup-redraw-fix: failed to patch terminal clear sequence (${reason})`, "warning");
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
}
|
|
1
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
|
|
3
|
+
import { applyTerminalClearSequencePatch } from "./terminal-clear-patch.js";
|
|
4
|
+
|
|
5
|
+
export default function startupRedrawFixExtension(pi: ExtensionAPI): void {
|
|
6
|
+
const patchResult = applyTerminalClearSequencePatch();
|
|
7
|
+
|
|
8
|
+
pi.on("session_start", async (_event, ctx) => {
|
|
9
|
+
if (!ctx.hasUI) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
if (!patchResult.patched && !patchResult.alreadyPatched) {
|
|
14
|
+
const reason = patchResult.error ?? "unknown error";
|
|
15
|
+
ctx.ui.notify(`startup-redraw-fix: failed to patch terminal clear sequence (${reason})`, "warning");
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import { ProcessTerminal } from "@
|
|
2
|
-
|
|
3
|
-
import { normalizeTerminalClearSequence } from "./normalize-clear-sequence.js";
|
|
4
|
-
|
|
5
|
-
const PATCH_FLAG_KEY = "__piStartupRedrawFixPatched__" as const;
|
|
6
|
-
|
|
7
|
-
type ProcessTerminalPrototype = typeof ProcessTerminal.prototype & {
|
|
8
|
-
[PATCH_FLAG_KEY]?: boolean;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export interface PatchResult {
|
|
12
|
-
patched: boolean;
|
|
13
|
-
alreadyPatched: boolean;
|
|
14
|
-
error?: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function applyTerminalClearSequencePatch(): PatchResult {
|
|
18
|
-
const prototype = ProcessTerminal.prototype as ProcessTerminalPrototype;
|
|
19
|
-
|
|
20
|
-
if (prototype[PATCH_FLAG_KEY]) {
|
|
21
|
-
return { patched: false, alreadyPatched: true };
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const originalWrite = prototype.write;
|
|
25
|
-
if (typeof originalWrite !== "function") {
|
|
26
|
-
return {
|
|
27
|
-
patched: false,
|
|
28
|
-
alreadyPatched: false,
|
|
29
|
-
error: "ProcessTerminal.write is unavailable",
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
prototype.write = function patchedProcessTerminalWrite(data: string): void {
|
|
34
|
-
const normalized = typeof data === "string"
|
|
35
|
-
? normalizeTerminalClearSequence(data)
|
|
36
|
-
: data;
|
|
37
|
-
|
|
38
|
-
originalWrite.call(this, normalized);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
prototype[PATCH_FLAG_KEY] = true;
|
|
42
|
-
|
|
43
|
-
return { patched: true, alreadyPatched: false };
|
|
44
|
-
}
|
|
1
|
+
import { ProcessTerminal } from "@earendil-works/pi-tui";
|
|
2
|
+
|
|
3
|
+
import { normalizeTerminalClearSequence } from "./normalize-clear-sequence.js";
|
|
4
|
+
|
|
5
|
+
const PATCH_FLAG_KEY = "__piStartupRedrawFixPatched__" as const;
|
|
6
|
+
|
|
7
|
+
type ProcessTerminalPrototype = typeof ProcessTerminal.prototype & {
|
|
8
|
+
[PATCH_FLAG_KEY]?: boolean;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export interface PatchResult {
|
|
12
|
+
patched: boolean;
|
|
13
|
+
alreadyPatched: boolean;
|
|
14
|
+
error?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function applyTerminalClearSequencePatch(): PatchResult {
|
|
18
|
+
const prototype = ProcessTerminal.prototype as ProcessTerminalPrototype;
|
|
19
|
+
|
|
20
|
+
if (prototype[PATCH_FLAG_KEY]) {
|
|
21
|
+
return { patched: false, alreadyPatched: true };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const originalWrite = prototype.write;
|
|
25
|
+
if (typeof originalWrite !== "function") {
|
|
26
|
+
return {
|
|
27
|
+
patched: false,
|
|
28
|
+
alreadyPatched: false,
|
|
29
|
+
error: "ProcessTerminal.write is unavailable",
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
prototype.write = function patchedProcessTerminalWrite(data: string): void {
|
|
34
|
+
const normalized = typeof data === "string"
|
|
35
|
+
? normalizeTerminalClearSequence(data)
|
|
36
|
+
: data;
|
|
37
|
+
|
|
38
|
+
originalWrite.call(this, normalized);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
prototype[PATCH_FLAG_KEY] = true;
|
|
42
|
+
|
|
43
|
+
return { patched: true, alreadyPatched: false };
|
|
44
|
+
}
|