@aayambansal/squint 0.2.5 → 0.2.7

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.
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  findChrome,
4
4
  screenshot
5
- } from "./chunk-CJXYSQNB.js";
6
- import "./chunk-CH4GNJCZ.js";
5
+ } from "./chunk-B7LOERSP.js";
6
+ import "./chunk-BWZFACBT.js";
7
7
  export {
8
8
  findChrome,
9
9
  screenshot
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  variantsRoot
4
- } from "./chunk-XLNTTZX4.js";
4
+ } from "./chunk-X6MDBKED.js";
5
5
  import {
6
6
  findChrome,
7
7
  screenshot
8
- } from "./chunk-CJXYSQNB.js";
8
+ } from "./chunk-B7LOERSP.js";
9
9
  import {
10
10
  lineSplitter
11
- } from "./chunk-CH4GNJCZ.js";
11
+ } from "./chunk-BWZFACBT.js";
12
12
 
13
13
  // src/variants/shots.ts
14
14
  import path2 from "path";
@@ -79,12 +79,19 @@ var DevServer = class {
79
79
  callbacks;
80
80
  child = null;
81
81
  lines = [];
82
+ lastCommand = null;
83
+ restarts = 0;
82
84
  state = "stopped";
83
85
  url = null;
84
86
  start(command) {
87
+ this.restarts = 0;
88
+ return this.launch(command);
89
+ }
90
+ launch(command) {
85
91
  if (this.child) return true;
86
92
  const cmd = command ?? detectDevCommand(this.cwd);
87
93
  if (!cmd) return false;
94
+ this.lastCommand = cmd;
88
95
  this.setState("starting");
89
96
  this.lines = [];
90
97
  this.url = null;
@@ -118,7 +125,14 @@ var DevServer = class {
118
125
  });
119
126
  child.on("close", () => {
120
127
  this.child = null;
121
- if (this.state !== "stopped") this.setState("crashed");
128
+ if (this.state === "stopped") return;
129
+ this.setState("crashed");
130
+ if (this.restarts < 1 && this.lastCommand) {
131
+ this.restarts += 1;
132
+ setTimeout(() => {
133
+ if (this.state === "crashed") this.launch(this.lastCommand);
134
+ }, 1e3);
135
+ }
122
136
  });
123
137
  return true;
124
138
  }
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  findBinary
4
- } from "./chunk-CH4GNJCZ.js";
4
+ } from "./chunk-BWZFACBT.js";
5
5
 
6
6
  // src/preview/chrome.ts
7
7
  import { spawn } from "child_process";
@@ -1,5 +1,24 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ // src/engines/registry.ts
4
+ import fs from "fs";
5
+ import path from "path";
6
+
7
+ // src/engines/aider.ts
8
+ var aider = {
9
+ id: "aider",
10
+ name: "Aider",
11
+ binary: "aider",
12
+ install: "python -m pip install aider-install && aider-install",
13
+ supportsResume: false,
14
+ buildArgs(opts) {
15
+ const args = ["--message", opts.prompt, "--yes-always", "--no-auto-commits"];
16
+ if (opts.mode === "plan") args.push("--dry-run");
17
+ if (opts.model) args.push("--model", opts.model);
18
+ return args;
19
+ }
20
+ };
21
+
3
22
  // src/util/stream.ts
4
23
  function lineSplitter(onLine) {
5
24
  let buffer = "";
@@ -24,25 +43,6 @@ function truncate(text, max) {
24
43
  return text.slice(0, max - 1) + "\u2026";
25
44
  }
26
45
 
27
- // src/engines/registry.ts
28
- import fs from "fs";
29
- import path from "path";
30
-
31
- // src/engines/aider.ts
32
- var aider = {
33
- id: "aider",
34
- name: "Aider",
35
- binary: "aider",
36
- install: "python -m pip install aider-install && aider-install",
37
- supportsResume: false,
38
- buildArgs(opts) {
39
- const args = ["--message", opts.prompt, "--yes-always", "--no-auto-commits"];
40
- if (opts.mode === "plan") args.push("--dry-run");
41
- if (opts.model) args.push("--model", opts.model);
42
- return args;
43
- }
44
- };
45
-
46
46
  // src/engines/claudeProtocol.ts
47
47
  function createClaudeStreamParser(readyLabel) {
48
48
  let sawTextDelta = false;
@@ -300,9 +300,48 @@ var gemini = {
300
300
  supportsResume: false,
301
301
  buildArgs(opts) {
302
302
  const approval = opts.mode === "plan" ? "plan" : opts.mode === "yolo" ? "yolo" : "auto_edit";
303
- const args = ["-p", opts.prompt, "--approval-mode", approval];
303
+ const args = ["-p", opts.prompt, "--output-format", "stream-json", "--approval-mode", approval];
304
304
  if (opts.model) args.push("-m", opts.model);
305
305
  return args;
306
+ },
307
+ createParser() {
308
+ return (line) => {
309
+ let data;
310
+ try {
311
+ data = JSON.parse(line);
312
+ } catch {
313
+ return [{ type: "text", text: line }];
314
+ }
315
+ switch (data?.type) {
316
+ case "init":
317
+ return [{ type: "status", text: `gemini ready${data.model ? ` \xB7 ${data.model}` : ""}` }];
318
+ case "message": {
319
+ if (data.role && data.role !== "assistant" && data.role !== "model") return [];
320
+ const text = data.content ?? data.text ?? data.delta;
321
+ return typeof text === "string" && text.length > 0 ? [{ type: "text", text }] : [];
322
+ }
323
+ case "tool_use": {
324
+ const name = data.name ?? data.tool_name ?? "tool";
325
+ const input = data.args ?? data.input;
326
+ const detail = input && typeof input === "object" ? truncate(JSON.stringify(input), 80) : void 0;
327
+ return [{ type: "tool", name, detail }];
328
+ }
329
+ case "tool_result":
330
+ return [];
331
+ case "error":
332
+ return data.fatal === false ? [] : [{ type: "error", text: data.message ?? "gemini error" }];
333
+ case "result":
334
+ return [
335
+ {
336
+ type: "result",
337
+ ok: !data.error,
338
+ summary: typeof data.response === "string" ? data.response : void 0
339
+ }
340
+ ];
341
+ default:
342
+ return [{ type: "raw", data }];
343
+ }
344
+ };
306
345
  }
307
346
  };
308
347
 
@@ -402,6 +441,7 @@ function detectEngines() {
402
441
  export {
403
442
  lineSplitter,
404
443
  truncate,
444
+ engines,
405
445
  getEngine,
406
446
  findBinary,
407
447
  findEngineBinary,
@@ -3,7 +3,7 @@ import {
3
3
  findEngineBinary,
4
4
  lineSplitter,
5
5
  truncate
6
- } from "./chunk-CH4GNJCZ.js";
6
+ } from "./chunk-BWZFACBT.js";
7
7
 
8
8
  // src/runner/run.ts
9
9
  import { spawn } from "child_process";
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ findChrome,
4
+ screenshot
5
+ } from "./chunk-B7LOERSP.js";
2
6
  import {
3
7
  cdpCapture,
4
8
  hasWebSocket
5
9
  } from "./chunk-OC6RU6XH.js";
6
- import {
7
- findChrome,
8
- screenshot
9
- } from "./chunk-CJXYSQNB.js";
10
10
 
11
11
  // src/preview/preview.ts
12
12
  import fs2 from "fs";
@@ -2,7 +2,7 @@
2
2
 
3
3
  // src/session/commands.ts
4
4
  var COMMANDS = [
5
- { name: "dev", description: "start/stop the project dev server" },
5
+ { name: "dev", args: "[restart|logs]", description: "start/stop the dev server; restart or show recent output" },
6
6
  { name: "check", description: "run all quality gates (typecheck, lint, test, build)" },
7
7
  { name: "problems", description: "list open findings from gates, dev server, runtime, a11y" },
8
8
  { name: "fix", args: "[n]", description: "send all open problems to the engine, or just problem n" },
@@ -14,6 +14,7 @@ var COMMANDS = [
14
14
  { name: "restore", args: "<n>", description: "rewind files to before ask n" },
15
15
  { name: "mode", args: "plan|safe|yolo", description: "how much the engine may do (shift+tab cycles)" },
16
16
  { name: "engine", args: "<id>", description: "switch backend (new session)" },
17
+ { name: "engines", description: "list installed engines with streaming/resume support" },
17
18
  { name: "model", args: "[name]", description: "model override for the engine" },
18
19
  { name: "theme", args: "[name]", description: "switch the TUI theme", viewLevel: true },
19
20
  { name: "copy", description: "copy the last reply to the clipboard" },
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ runAgent
4
+ } from "./chunk-C7WKNJG6.js";
2
5
  import {
3
6
  FAMILIES,
4
7
  FIRST_TURN_ADDENDUM,
5
8
  renderFamilyBrief
6
9
  } from "./chunk-P3H4N2EN.js";
7
- import {
8
- runAgent
9
- } from "./chunk-TI2R7QRL.js";
10
10
 
11
11
  // src/variants/variants.ts
12
12
  import { execFileSync } from "child_process";