@sigil0/looking-glass 0.1.0 → 0.2.0
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/README.md +143 -61
- package/dist/agents/coordinator.js +1 -1
- package/dist/agents/coordinator.js.map +1 -1
- package/dist/cli.js +14 -8
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +5 -3
- package/dist/config.js.map +1 -1
- package/dist/paths.d.ts +8 -4
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +39 -15
- package/dist/paths.js.map +1 -1
- package/dist/scheduler/index.d.ts +5 -1
- package/dist/scheduler/index.d.ts.map +1 -1
- package/dist/scheduler/index.js +3 -1
- package/dist/scheduler/index.js.map +1 -1
- package/dist/scheduler/runner.d.ts.map +1 -1
- package/dist/scheduler/runner.js +35 -3
- package/dist/scheduler/runner.js.map +1 -1
- package/dist/scheduler/service.d.ts +15 -0
- package/dist/scheduler/service.d.ts.map +1 -0
- package/dist/scheduler/service.js +20 -0
- package/dist/scheduler/service.js.map +1 -0
- package/dist/scheduler/windows.d.ts +87 -0
- package/dist/scheduler/windows.d.ts.map +1 -0
- package/dist/scheduler/windows.js +506 -0
- package/dist/scheduler/windows.js.map +1 -0
- package/dist/storage/artifact-store.d.ts +2 -1
- package/dist/storage/artifact-store.d.ts.map +1 -1
- package/dist/storage/artifact-store.js +8 -3
- package/dist/storage/artifact-store.js.map +1 -1
- package/dist/storage/database.d.ts +1 -1
- package/dist/storage/database.d.ts.map +1 -1
- package/dist/storage/database.js +10 -6
- package/dist/storage/database.js.map +1 -1
- package/dist/tools/apply-patch.d.ts +15 -0
- package/dist/tools/apply-patch.d.ts.map +1 -1
- package/dist/tools/apply-patch.js +81 -12
- package/dist/tools/apply-patch.js.map +1 -1
- package/dist/tools/bash.d.ts +2 -0
- package/dist/tools/bash.d.ts.map +1 -1
- package/dist/tools/bash.js +43 -22
- package/dist/tools/bash.js.map +1 -1
- package/dist/tools/executable.d.ts +13 -0
- package/dist/tools/executable.d.ts.map +1 -0
- package/dist/tools/executable.js +82 -0
- package/dist/tools/executable.js.map +1 -0
- package/dist/tools/process.d.ts +8 -0
- package/dist/tools/process.d.ts.map +1 -1
- package/dist/tools/process.js +105 -35
- package/dist/tools/process.js.map +1 -1
- package/dist/tools/safety.d.ts +5 -1
- package/dist/tools/safety.d.ts.map +1 -1
- package/dist/tools/safety.js +125 -7
- package/dist/tools/safety.js.map +1 -1
- package/dist/tools/schedule.d.ts.map +1 -1
- package/dist/tools/schedule.js +4 -3
- package/dist/tools/schedule.js.map +1 -1
- package/dist/tools/search.d.ts.map +1 -1
- package/dist/tools/search.js +9 -4
- package/dist/tools/search.js.map +1 -1
- package/dist/tools/shell.d.ts +30 -0
- package/dist/tools/shell.d.ts.map +1 -0
- package/dist/tools/shell.js +51 -0
- package/dist/tools/shell.js.map +1 -0
- package/dist/ui/tui.d.ts +6 -0
- package/dist/ui/tui.d.ts.map +1 -1
- package/dist/ui/tui.js +44 -21
- package/dist/ui/tui.js.map +1 -1
- package/looking-glass-title.svg +69 -0
- package/package.json +7 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/tools/shell.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,YAAY,CAAC;AAE9C,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,SAAS,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,2EAA2E;IAC3E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAYD;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,GAAE,MAAM,GAAG,SAAkC,GAAG,MAAM,CAGjG;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAEjF;AAED,wBAAgB,oBAAoB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED,wBAAgB,kBAAkB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED,8EAA8E;AAC9E,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAE7D;AAED,wBAAgB,SAAS,CAAC,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAAG,SAAS,CAEjF;AAED,wBAAgB,eAAe,CAAC,QAAQ,GAAE,MAAM,CAAC,QAA2B,EAAE,OAAO,GAAE,YAAiB,GAAG,eAAe,CAQzH;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,YAAmB,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,YAAiB,GAAG;IACvH,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB,CAGA"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { win32 } from "node:path";
|
|
2
|
+
const BASH_SHELL = {
|
|
3
|
+
kind: "bash",
|
|
4
|
+
executable: "/bin/bash",
|
|
5
|
+
args: (command) => ["--noprofile", "--norc", "-c", command],
|
|
6
|
+
description: "Run one noninteractive Bash command in the workspace. Do not start background jobs or commands requiring a TTY.",
|
|
7
|
+
};
|
|
8
|
+
const WINDOWS_FALLBACK_SYSTEM_ROOT = "C:\\Windows";
|
|
9
|
+
const POWERSHELL_UTF8_SETUP = "$OutputEncoding = [System.Text.UTF8Encoding]::new($false); [Console]::OutputEncoding = $OutputEncoding; ";
|
|
10
|
+
/**
|
|
11
|
+
* Return an absolute, deterministic Windows system root. A relative
|
|
12
|
+
* SystemRoot would make executable resolution depend on the working
|
|
13
|
+
* directory, so it is rejected rather than used for security-sensitive
|
|
14
|
+
* helpers such as PowerShell and taskkill.
|
|
15
|
+
*/
|
|
16
|
+
export function windowsSystemRoot(systemRoot = process.env.SystemRoot) {
|
|
17
|
+
if (systemRoot && !systemRoot.includes("\0") && /^[A-Za-z]:[\\/]/.test(systemRoot))
|
|
18
|
+
return win32.normalize(systemRoot);
|
|
19
|
+
return WINDOWS_FALLBACK_SYSTEM_ROOT;
|
|
20
|
+
}
|
|
21
|
+
export function windowsSystemExecutable(name, systemRoot) {
|
|
22
|
+
return win32.join(windowsSystemRoot(systemRoot), "System32", name);
|
|
23
|
+
}
|
|
24
|
+
export function powershellExecutable(systemRoot) {
|
|
25
|
+
return win32.join(windowsSystemRoot(systemRoot), "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
|
|
26
|
+
}
|
|
27
|
+
export function taskkillExecutable(systemRoot) {
|
|
28
|
+
return windowsSystemExecutable("taskkill.exe", systemRoot);
|
|
29
|
+
}
|
|
30
|
+
/** Select arguments for a noninteractive UTF-8 Windows PowerShell process. */
|
|
31
|
+
export function powershellArguments(command) {
|
|
32
|
+
return ["-NoLogo", "-NoProfile", "-NonInteractive", "-Command", `${POWERSHELL_UTF8_SETUP}${command}`];
|
|
33
|
+
}
|
|
34
|
+
export function shellKind(platform = process.platform) {
|
|
35
|
+
return platform === "win32" ? "powershell" : "bash";
|
|
36
|
+
}
|
|
37
|
+
export function shellDefinition(platform = process.platform, options = {}) {
|
|
38
|
+
if (shellKind(platform) === "bash")
|
|
39
|
+
return BASH_SHELL;
|
|
40
|
+
return {
|
|
41
|
+
kind: "powershell",
|
|
42
|
+
executable: powershellExecutable(options.systemRoot),
|
|
43
|
+
args: powershellArguments,
|
|
44
|
+
description: "Run one noninteractive Windows PowerShell command in the workspace. Do not start background jobs or commands requiring a TTY.",
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export function shellCommand(platform = process.platform, command, options = {}) {
|
|
48
|
+
const shell = shellDefinition(platform, options);
|
|
49
|
+
return { executable: shell.executable, args: shell.args(command) };
|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C;AAED,8EAA8E;AAC9E,MAAM,UAAU,mBAAmB,CAAC,OAAe;IACjD,OAAO,CAAC,SAAS,EAAE,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAAE,GAAG,qBAAqB,GAAG,OAAO,EAAE,CAAC,CAAC;AACxG,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,WAA4B,OAAO,CAAC,QAAQ;IACpE,OAAO,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC;AACtD,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,WAA4B,OAAO,CAAC,QAAQ,EAAE,UAAwB,EAAE;IACtG,IAAI,SAAS,CAAC,QAAQ,CAAC,KAAK,MAAM;QAAE,OAAO,UAAU,CAAC;IACtD,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,UAAU,EAAE,oBAAoB,CAAC,OAAO,CAAC,UAAU,CAAC;QACpD,IAAI,EAAE,mBAAmB;QACzB,WAAW,EAAE,+HAA+H;KAC7I,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,WAA4B,OAAO,CAAC,QAAQ,EAAE,OAAe,EAAE,UAAwB,EAAE;IAIpH,MAAM,KAAK,GAAG,eAAe,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACjD,OAAO,EAAE,UAAU,EAAE,KAAK,CAAC,UAAU,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;AACrE,CAAC"}
|
package/dist/ui/tui.d.ts
CHANGED
|
@@ -18,6 +18,12 @@ export declare function contextUsageLabel(inputTokens: number, contextWindow: nu
|
|
|
18
18
|
export declare function sessionMetadataLine(session: SessionRecord, approval: ApprovalMode, contextUsage: string, width?: number): string;
|
|
19
19
|
export declare function activityLine(active: boolean, status: string, frame: number, scrollOffset: number): string;
|
|
20
20
|
export declare function selectedScreenText(lines: string[], anchor: ScreenPoint, focus: ScreenPoint): string;
|
|
21
|
+
export interface CommandApprovalDisplay {
|
|
22
|
+
label: string;
|
|
23
|
+
description: string;
|
|
24
|
+
}
|
|
25
|
+
/** Render persisted approval signatures without exposing their JSON encoding in the TUI. */
|
|
26
|
+
export declare function formatCommandApproval(signature: string, approvedAt: number): CommandApprovalDisplay;
|
|
21
27
|
declare class AlternateScreenTerminal extends ProcessTerminal {
|
|
22
28
|
private active;
|
|
23
29
|
private alternate;
|
package/dist/ui/tui.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tui.d.ts","sourceRoot":"","sources":["../../src/ui/tui.ts"],"names":[],"mappings":"AAIA,OAAO,EAML,QAAQ,EACR,eAAe,EAQf,KAAK,SAAS,EASf,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAMjD,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAEvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAmB,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"tui.d.ts","sourceRoot":"","sources":["../../src/ui/tui.ts"],"names":[],"mappings":"AAIA,OAAO,EAML,QAAQ,EACR,eAAe,EAQf,KAAK,SAAS,EASf,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAMjD,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAEvE,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAmB,MAAM,mBAAmB,CAAC;AAG5F,OAAO,KAAK,EACV,YAAY,EAGZ,aAAa,EACd,MAAM,aAAa,CAAC;AAYrB,UAAU,WAAW;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,kBAAmB,SAAQ,WAAW;IACrD,MAAM,EAAE,OAAO,GAAG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kB,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE,WAAW,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,GAAG,MAAM,CAIrG;AAMD,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,eAAe,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAI/G;AAED,6EAA6E;AAC7E,wBAAsB,MAAM,CAAC,GAAG,EAAE,eAAe,EAAE,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA6oC3F"}
|
package/dist/ui/tui.js
CHANGED
|
@@ -6,6 +6,7 @@ import { CombinedAutocompleteProvider, Container, Editor, Input, Key, Markdown,
|
|
|
6
6
|
import { projectContext } from "../engine/context.js";
|
|
7
7
|
import { initialDue } from "../scheduler/schedule.js";
|
|
8
8
|
import { isWithin } from "../tools/paths.js";
|
|
9
|
+
import { windowsSystemExecutable } from "../tools/shell.js";
|
|
9
10
|
const MIN_COLUMNS = 32;
|
|
10
11
|
const MIN_ROWS = 12;
|
|
11
12
|
const STREAM_RENDER_MS = 40;
|
|
@@ -163,6 +164,45 @@ function jsonPreview(value) {
|
|
|
163
164
|
return oneLine(String(value));
|
|
164
165
|
}
|
|
165
166
|
}
|
|
167
|
+
function approvalShellName(value) {
|
|
168
|
+
if (value === "bash")
|
|
169
|
+
return "Bash";
|
|
170
|
+
if (value === "powershell")
|
|
171
|
+
return "PowerShell";
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
/** Render persisted approval signatures without exposing their JSON encoding in the TUI. */
|
|
175
|
+
export function formatCommandApproval(signature, approvedAt) {
|
|
176
|
+
let label = signature;
|
|
177
|
+
let description = new Date(approvedAt).toISOString();
|
|
178
|
+
try {
|
|
179
|
+
const parsed = JSON.parse(signature);
|
|
180
|
+
if (Array.isArray(parsed) && parsed[0] === "shell-executable" && typeof parsed[3] === "string") {
|
|
181
|
+
const shell = approvalShellName(parsed[2]);
|
|
182
|
+
if (shell)
|
|
183
|
+
label = `All ${shell} commands starting with '${parsed[3]}'`;
|
|
184
|
+
}
|
|
185
|
+
else if (Array.isArray(parsed) && parsed[0] === "shell-exec" && typeof parsed[3] === "string") {
|
|
186
|
+
label = parsed[3];
|
|
187
|
+
description = `${String(parsed[4])} | ${String(parsed[5])}ms | ${description}`;
|
|
188
|
+
}
|
|
189
|
+
else if (Array.isArray(parsed) && parsed[0] === "bash-exec" && typeof parsed[2] === "string") {
|
|
190
|
+
// Keep the legacy Bash signature display stable while supporting the new encoding above.
|
|
191
|
+
label = parsed[2];
|
|
192
|
+
description = `${String(parsed[3])} | ${String(parsed[4])}ms | ${description}`;
|
|
193
|
+
}
|
|
194
|
+
else if (Array.isArray(parsed) && parsed[0] === "tool-action" && typeof parsed[2] === "string") {
|
|
195
|
+
const args = parsed[3];
|
|
196
|
+
label = parsed[2] === "bash" && typeof args?.command === "string"
|
|
197
|
+
? args.command
|
|
198
|
+
: `${parsed[2]}: ${JSON.stringify(args ?? {})}`;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
catch {
|
|
202
|
+
// Retain the raw signature for forward-compatible records.
|
|
203
|
+
}
|
|
204
|
+
return { label, description };
|
|
205
|
+
}
|
|
166
206
|
function fit(line, width) {
|
|
167
207
|
return truncateToWidth(line, Math.max(1, width), "");
|
|
168
208
|
}
|
|
@@ -208,7 +248,7 @@ class AlternateScreenTerminal extends ProcessTerminal {
|
|
|
208
248
|
if (platform() === "darwin")
|
|
209
249
|
command = "pbcopy";
|
|
210
250
|
else if (platform() === "win32")
|
|
211
|
-
command = "clip.exe";
|
|
251
|
+
command = windowsSystemExecutable("clip.exe");
|
|
212
252
|
else if (process.env.WAYLAND_DISPLAY)
|
|
213
253
|
command = "wl-copy";
|
|
214
254
|
else if (process.env.DISPLAY) {
|
|
@@ -1568,28 +1608,11 @@ export async function runTui(app, initialSessionId) {
|
|
|
1568
1608
|
return;
|
|
1569
1609
|
}
|
|
1570
1610
|
const selected = await selectValue("Always-approved actions", approvals.map((approval) => {
|
|
1571
|
-
|
|
1572
|
-
let detail = new Date(approval.approvedAt).toISOString();
|
|
1573
|
-
try {
|
|
1574
|
-
const parsed = JSON.parse(approval.signature);
|
|
1575
|
-
if (Array.isArray(parsed) && parsed[0] === "bash-exec" && typeof parsed[2] === "string") {
|
|
1576
|
-
command = parsed[2];
|
|
1577
|
-
detail = `${String(parsed[3])} | ${String(parsed[4])}ms | ${detail}`;
|
|
1578
|
-
}
|
|
1579
|
-
else if (Array.isArray(parsed) && parsed[0] === "tool-action" && typeof parsed[2] === "string") {
|
|
1580
|
-
const args = parsed[3];
|
|
1581
|
-
command = parsed[2] === "bash" && typeof args?.command === "string"
|
|
1582
|
-
? args.command
|
|
1583
|
-
: `${parsed[2]}: ${JSON.stringify(args ?? {})}`;
|
|
1584
|
-
}
|
|
1585
|
-
}
|
|
1586
|
-
catch {
|
|
1587
|
-
// Retain the raw signature for forward-compatible records.
|
|
1588
|
-
}
|
|
1611
|
+
const display = formatCommandApproval(approval.signature, approval.approvedAt);
|
|
1589
1612
|
return {
|
|
1590
1613
|
value: approval.signature,
|
|
1591
|
-
label: oneLine(
|
|
1592
|
-
description:
|
|
1614
|
+
label: oneLine(display.label, 240),
|
|
1615
|
+
description: display.description,
|
|
1593
1616
|
};
|
|
1594
1617
|
}), "Delete/Supr revokes the highlighted action approval.", { deletable: true });
|
|
1595
1618
|
if (!selected || stopping)
|