pi-landstrip 0.16.5 → 0.16.6
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/index.ts +11 -6
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -572,8 +572,9 @@ function notify(ctx: ExtensionContext, message: string, level: NotificationLevel
|
|
|
572
572
|
}
|
|
573
573
|
|
|
574
574
|
function hasTuiStatus(ctx: ExtensionContext): boolean {
|
|
575
|
-
|
|
576
|
-
|
|
575
|
+
if (!ctx.hasUI) return false;
|
|
576
|
+
const mode = 'mode' in ctx ? (ctx as Record<string, unknown>).mode : undefined;
|
|
577
|
+
return mode === undefined || mode === 'tui';
|
|
577
578
|
}
|
|
578
579
|
|
|
579
580
|
function setTuiStatus(ctx: ExtensionContext, key: string, value: string | undefined): void {
|
|
@@ -862,9 +863,9 @@ type LandstripBashTool = ReturnType<typeof createBashToolDefinition>;
|
|
|
862
863
|
/** Options for creating a landstrip sandbox integration. */
|
|
863
864
|
export interface LandstripIntegrationOptions {
|
|
864
865
|
/** Register a sandboxed bash tool when the integration is registered. */
|
|
865
|
-
registerBashTool?: boolean;
|
|
866
|
+
readonly registerBashTool?: boolean;
|
|
866
867
|
/** Working directory used when registering the default bash tool. */
|
|
867
|
-
cwd?: string;
|
|
868
|
+
readonly cwd?: string;
|
|
868
869
|
}
|
|
869
870
|
|
|
870
871
|
/** Landstrip sandbox integration hooks for Pi. */
|
|
@@ -1158,13 +1159,17 @@ export function createLandstripIntegration(
|
|
|
1158
1159
|
server.on('error', reject);
|
|
1159
1160
|
let client: NetSocket | null = null;
|
|
1160
1161
|
server.on('connection', (serverEnd) => {
|
|
1162
|
+
server.removeListener('error', reject);
|
|
1161
1163
|
server.close();
|
|
1162
1164
|
try {
|
|
1163
1165
|
rmSync(sockPath, { force: true });
|
|
1164
1166
|
} catch {
|
|
1165
1167
|
/* ok */
|
|
1166
1168
|
}
|
|
1167
|
-
if (client)
|
|
1169
|
+
if (client) {
|
|
1170
|
+
client.removeListener('error', reject);
|
|
1171
|
+
resolve([client, serverEnd]);
|
|
1172
|
+
}
|
|
1168
1173
|
});
|
|
1169
1174
|
server.listen(sockPath, () => {
|
|
1170
1175
|
client = new NetSocket();
|
|
@@ -1218,7 +1223,7 @@ export function createLandstripIntegration(
|
|
|
1218
1223
|
childEnd.destroy();
|
|
1219
1224
|
|
|
1220
1225
|
function killChild(): void {
|
|
1221
|
-
if (
|
|
1226
|
+
if (child.pid === undefined) return;
|
|
1222
1227
|
try {
|
|
1223
1228
|
process.kill(-child.pid, 'SIGKILL');
|
|
1224
1229
|
} catch {
|