@ian-pascoe/pi-termctrl 0.0.0 → 0.1.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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ian-pascoe/pi-termctrl",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Interactive Terminals, Background jobs, and a /ps panel for Pi.",
|
|
6
6
|
"keywords": [
|
|
@@ -33,10 +33,6 @@
|
|
|
33
33
|
"access": "public",
|
|
34
34
|
"provenance": true
|
|
35
35
|
},
|
|
36
|
-
"scripts": {
|
|
37
|
-
"test": "vitest run --config ../../vitest.config.ts --root .",
|
|
38
|
-
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
39
|
-
},
|
|
40
36
|
"dependencies": {
|
|
41
37
|
"@kitlangton/terminal-control": "^1.2.1"
|
|
42
38
|
},
|
|
@@ -55,5 +51,9 @@
|
|
|
55
51
|
"skills": [
|
|
56
52
|
"./skills"
|
|
57
53
|
]
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"test": "vitest run --config ../../vitest.config.ts --root .",
|
|
57
|
+
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
58
58
|
}
|
|
59
|
-
}
|
|
59
|
+
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
name: pi-termctrl
|
|
3
3
|
description: Configure or diagnose Pi Termctrl when Terminal tools are missing, the bash replacement conflicts with another extension, Background jobs misbehave, or termctrl settings need changing.
|
|
4
4
|
license: MIT
|
|
5
|
+
disable-model-invocation: true
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
# Pi Termctrl
|
|
@@ -129,7 +129,7 @@ class PiTermctrlController {
|
|
|
129
129
|
const commandPrefix = settingsManager.getShellCommandPrefix();
|
|
130
130
|
if (this.binary.kind === "missing") {
|
|
131
131
|
context.ui.notify(
|
|
132
|
-
`Pi Termctrl: Terminal tools are unavailable: ${this.binary.reason}
|
|
132
|
+
`Pi Termctrl: Terminal tools are unavailable: ${this.binary.reason}\nRun /skill:pi-termctrl to diagnose.`,
|
|
133
133
|
"warning",
|
|
134
134
|
);
|
|
135
135
|
if (settings.replaceBash) this.registerManagementTools();
|
package/src/termctrl-registry.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type {
|
|
|
7
7
|
TerminalLaunchRequest,
|
|
8
8
|
} from "./terminal-driver.js";
|
|
9
9
|
import { isDriverGone } from "./terminal-driver.js";
|
|
10
|
+
import { TROUBLESHOOTING_HINT } from "./troubleshooting-skill.js";
|
|
10
11
|
import type { TerminalViewport } from "./pi-termctrl-settings.js";
|
|
11
12
|
|
|
12
13
|
/** The `globalThis` key every registry version shares. Its value always satisfies {@link RegistrySlot}. */
|
|
@@ -379,7 +380,7 @@ export class TermctrlRegistry {
|
|
|
379
380
|
cwd: request.cwd,
|
|
380
381
|
viewport: request.viewport,
|
|
381
382
|
};
|
|
382
|
-
let slot = await this.
|
|
383
|
+
let slot = await this.startDriver();
|
|
383
384
|
let handle: TerminalHandle;
|
|
384
385
|
try {
|
|
385
386
|
handle = await slot.driver.launch(launch);
|
|
@@ -387,7 +388,7 @@ export class TermctrlRegistry {
|
|
|
387
388
|
const error = cause instanceof Error ? cause : new Error(String(cause));
|
|
388
389
|
if (!isDriverGone(error)) throw error;
|
|
389
390
|
this.driverDied(slot.generation);
|
|
390
|
-
slot = await this.
|
|
391
|
+
slot = await this.startDriver();
|
|
391
392
|
handle = await slot.driver.launch(launch);
|
|
392
393
|
}
|
|
393
394
|
const entry: TerminalEntry = {
|
|
@@ -420,6 +421,16 @@ export class TermctrlRegistry {
|
|
|
420
421
|
}
|
|
421
422
|
}
|
|
422
423
|
|
|
424
|
+
/** Ensure a driver, pointing the agent at the troubleshooting Skill when none can start. */
|
|
425
|
+
private async startDriver(): Promise<DriverSlot> {
|
|
426
|
+
try {
|
|
427
|
+
return await this.ensureDriver();
|
|
428
|
+
} catch (cause) {
|
|
429
|
+
const error = cause instanceof Error ? cause : new Error(String(cause));
|
|
430
|
+
throw new Error(`${error.message}\n\n${TROUBLESHOOTING_HINT}`, { cause });
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
423
434
|
private async ensureDriver(): Promise<DriverSlot> {
|
|
424
435
|
if (this.state.driver !== undefined) return this.state.driver;
|
|
425
436
|
if (this.state.driverStarting !== undefined) return this.state.driverStarting;
|
package/src/terminal-tools.ts
CHANGED
|
@@ -21,6 +21,7 @@ import { describeExitStatus } from "./exit-notification.js";
|
|
|
21
21
|
import { termctrlTemporaryDirectory } from "./termctrl-driver.js";
|
|
22
22
|
import type { TerminalViewport } from "./pi-termctrl-settings.js";
|
|
23
23
|
import type { TerminalExit, TerminalSnapshot } from "./terminal-driver.js";
|
|
24
|
+
import { TROUBLESHOOTING_HINT } from "./troubleshooting-skill.js";
|
|
24
25
|
|
|
25
26
|
/** Screen quiet period that settles a Terminal. */
|
|
26
27
|
export const QUIET_MS = 250;
|
|
@@ -480,7 +481,10 @@ async function driveTerminal<T>(
|
|
|
480
481
|
} catch (cause) {
|
|
481
482
|
const error = cause instanceof Error ? cause : new Error(String(cause));
|
|
482
483
|
if (registry.reportTerminalError(entry, error)) {
|
|
483
|
-
throw new Error(
|
|
484
|
+
throw new Error(
|
|
485
|
+
`${entry.id} was lost because the termctrl driver exited\n\n${TROUBLESHOOTING_HINT}`,
|
|
486
|
+
{ cause },
|
|
487
|
+
);
|
|
484
488
|
}
|
|
485
489
|
throw error;
|
|
486
490
|
} finally {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { fileURLToPath } from "node:url";
|
|
2
|
+
|
|
3
|
+
/** Absolute path of this package's user-invoked troubleshooting Skill. */
|
|
4
|
+
export const TROUBLESHOOTING_SKILL_PATH = fileURLToPath(
|
|
5
|
+
new URL("../skills/pi-termctrl/SKILL.md", import.meta.url),
|
|
6
|
+
);
|
|
7
|
+
|
|
8
|
+
/** Model-facing pointer appended to failures this package's Skill diagnoses. */
|
|
9
|
+
export const TROUBLESHOOTING_HINT = `For diagnosis, read the pi-termctrl troubleshooting Skill at ${TROUBLESHOOTING_SKILL_PATH}.`;
|