@garuda-agent/garuda 0.18.0 → 0.18.2

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.
Files changed (58) hide show
  1. package/CHANGELOG.md +156 -0
  2. package/README.md +3 -2
  3. package/dist/{acpCommand-IUZPLPLI.js → acpCommand-PUJHFWYU.js} +10 -8
  4. package/dist/advise-C777SZ5M.js +433 -0
  5. package/dist/brief-RWKESOPT.js +91 -0
  6. package/dist/buildCheck-HB46NWLX.js +19 -0
  7. package/dist/buildInfo-Z4P7QAQL.js +8 -0
  8. package/dist/chunk-2OYTNNUJ.js +216 -0
  9. package/dist/chunk-4BELTWP4.js +156 -0
  10. package/dist/chunk-4QRTTRVK.js +88 -0
  11. package/dist/chunk-6JQTPW3P.js +88 -0
  12. package/dist/chunk-A5DLAXB4.js +1780 -0
  13. package/dist/{chunk-FARS4R67.js → chunk-AX3A5KPH.js} +18 -1
  14. package/dist/chunk-CFDRP6XW.js +9 -0
  15. package/dist/chunk-E6YRCDSF.js +9 -0
  16. package/dist/{chunk-OQ26W5L4.js → chunk-HP6EGFHV.js} +132 -75
  17. package/dist/chunk-L55VUSX3.js +54 -0
  18. package/dist/{chunk-B4SJY7KT.js → chunk-LMKGSYJC.js} +77 -8
  19. package/dist/{chunk-Q4P3W657.js → chunk-LWNMEGDF.js} +10 -1124
  20. package/dist/{chunk-23FXBNBB.js → chunk-MNE7HHX2.js} +2 -1
  21. package/dist/{chunk-UKIE4AAM.js → chunk-NLS7GMF7.js} +11 -105
  22. package/dist/{chunk-6XHON3Q6.js → chunk-QXTHEFKP.js} +3 -3
  23. package/dist/{chunk-4BVCYCQT.js → chunk-R7RCW4BQ.js} +9 -7
  24. package/dist/{chunk-NHWHG3SW.js → chunk-STVFWSIL.js} +350 -57
  25. package/dist/{chunk-5B5HDTUR.js → chunk-TWQ7V2L6.js} +2 -2
  26. package/dist/chunk-ULAJPMY7.js +107 -0
  27. package/dist/chunk-VISKX36R.js +306 -0
  28. package/dist/{chunk-55CFEEIN.js → chunk-WK5NE6RY.js} +2 -2
  29. package/dist/chunk-Y62J7PTD.js +90 -0
  30. package/dist/chunk-YAQ6QLKB.js +40 -0
  31. package/dist/{chunk-FOPBOB7W.js → chunk-YEH2OONM.js} +6 -4
  32. package/dist/{chunk-7TH3NHCQ.js → chunk-ZKT4P2PC.js} +2 -2
  33. package/dist/cli/index.js +242 -52
  34. package/dist/{create-W6BV75QX.js → create-OACSGJ37.js} +5 -5
  35. package/dist/{evalCommand-SKJQ6CW2.js → evalCommand-MRO6ENCA.js} +77 -39
  36. package/dist/{evalTune-CZRCPSZ3.js → evalTune-VL5RHYOG.js} +24 -18
  37. package/dist/{export-SJ3DUP6W.js → export-ZPF3AMO6.js} +27 -4
  38. package/dist/exportHtml-ISISG5HG.js +21 -0
  39. package/dist/{inkChat-WYYAFZXD.js → inkChat-UDFX6GH6.js} +256 -41
  40. package/dist/{install-TKWN5AYH.js → install-4ST5BNRG.js} +3 -3
  41. package/dist/{jobCommand-2ODQLHB3.js → jobCommand-ILOTYOX3.js} +8 -7
  42. package/dist/{launchd-3A3ONEW5.js → launchd-QG6R5RAK.js} +4 -4
  43. package/dist/{lspCommand-ZZ6R4PA2.js → lspCommand-X4FTTONR.js} +3 -3
  44. package/dist/{manager-TCYTA5XU.js → manager-YH7722C2.js} +3 -3
  45. package/dist/{nightCommand-WJU6VZA6.js → nightCommand-XPWT6CQZ.js} +8 -7
  46. package/dist/receiptView-YFDHV253.js +19 -0
  47. package/dist/{remove-42WQNVPX.js → remove-STX5UO7X.js} +3 -3
  48. package/dist/{run-PTMRQCIU.js → run-W4TK52WT.js} +5 -5
  49. package/dist/runner-EBF6EOYM.js +97 -0
  50. package/dist/{server-VEYIJHEU.js → server-ASM73QVY.js} +3 -3
  51. package/dist/tour-CEVMAC5S.js +18 -0
  52. package/dist/tune-KSNKBPNJ.js +51 -0
  53. package/dist/uiState-YFJQ43D7.js +16 -0
  54. package/package.json +1 -1
  55. package/dist/chunk-4JSUUDFQ.js +0 -118
  56. package/dist/chunk-C57GHLKP.js +0 -9
  57. package/dist/chunk-DOCDCQVM.js +0 -484
  58. package/dist/tune-YVI2KWQF.js +0 -31
@@ -36,6 +36,7 @@ var BUILTIN_COMMANDS = [
36
36
  "search",
37
37
  "undo",
38
38
  "redo",
39
+ "rewind",
39
40
  "exit",
40
41
  "quit"
41
42
  ];
@@ -43,4 +44,4 @@ var BUILTIN_COMMANDS = [
43
44
  export {
44
45
  BUILTIN_COMMANDS
45
46
  };
46
- //# sourceMappingURL=chunk-23FXBNBB.js.map
47
+ //# sourceMappingURL=chunk-MNE7HHX2.js.map
@@ -4,17 +4,11 @@ import {
4
4
  contextSize,
5
5
  totalTokens
6
6
  } from "./chunk-7KBOIPUT.js";
7
- import {
8
- cleanLine
9
- } from "./chunk-PZS3V6P3.js";
10
7
  import {
11
8
  ZERO_USAGE,
12
9
  addUsage,
13
10
  reportedUsage
14
11
  } from "./chunk-BHZ6G65V.js";
15
- import {
16
- formatRule
17
- } from "./chunk-3NJNVZTK.js";
18
12
 
19
13
  // src/session/store.ts
20
14
  import { randomBytes } from "crypto";
@@ -227,7 +221,15 @@ function addSnapshot(session, tree, prompt, durationMs) {
227
221
  const messages = session.messages.length;
228
222
  pushPoint(session.undo, tree, messages, prompt);
229
223
  const point = session.undo.points.at(-1);
230
- session.journal?.write({ type: "snapshot", tree, messages, prompt: point.prompt, durationMs });
224
+ point.at = Date.now();
225
+ session.journal?.write({
226
+ type: "snapshot",
227
+ tree,
228
+ messages,
229
+ prompt: point.prompt,
230
+ durationMs,
231
+ at: point.at
232
+ });
231
233
  }
232
234
  function undoTurn(session, after) {
233
235
  const point = popPoint(session.undo, session.messages, after);
@@ -343,101 +345,6 @@ function addSideUsage(session, purpose, response, costUsd) {
343
345
  });
344
346
  }
345
347
 
346
- // src/permissions/projectSettings.ts
347
- import { createHash as createHash2 } from "crypto";
348
- function settingsRisk(settings) {
349
- const risk = {
350
- executorHost: settings.executor === "host",
351
- allow: settings.allow.map(formatRule),
352
- writePaths: [...settings.sandbox?.writePaths ?? []],
353
- envAllow: [...settings.envAllow],
354
- allowLocalhost: settings.web?.allowLocalhost === true
355
- };
356
- const formatterCommands = Object.entries(settings.formatters?.commands ?? {}).flatMap(
357
- ([name, f]) => f === false ? [] : [`${name}: ${f.command.join(" ")}`]
358
- );
359
- if (formatterCommands.length > 0) risk.formatterCommands = formatterCommands;
360
- const none = !risk.executorHost && risk.allow.length === 0 && risk.writePaths.length === 0 && risk.envAllow.length === 0 && !risk.allowLocalhost && risk.formatterCommands === void 0;
361
- return none ? void 0 : risk;
362
- }
363
- function settingsRiskHash(risk) {
364
- return createHash2("sha256").update(JSON.stringify(risk)).digest("hex");
365
- }
366
- function settingsRiskLines(risk) {
367
- const lines = [];
368
- if (risk.executorHost) lines.push('executor: "host" (commands run with no OS sandbox)');
369
- if (risk.allow.length > 0) {
370
- lines.push(`permissions.allow (no question for these): ${risk.allow.join(", ")}`);
371
- }
372
- if (risk.writePaths.length > 0) {
373
- lines.push(`sandbox.writePaths (commands may write there): ${risk.writePaths.join(", ")}`);
374
- }
375
- if (risk.envAllow.length > 0) {
376
- lines.push(`env.allow (commands see these variables): ${risk.envAllow.join(", ")}`);
377
- }
378
- if (risk.allowLocalhost) lines.push("web.allowLocalhost (web_fetch may reach this machine)");
379
- if (risk.formatterCommands !== void 0) {
380
- lines.push(
381
- `formatters.commands (run after each edit): ${risk.formatterCommands.map(cleanLine).join("; ")}`
382
- );
383
- }
384
- return lines;
385
- }
386
- function withoutRisk(settings) {
387
- const { sandbox, web, formatters, ...rest } = settings;
388
- const { writePaths: _writePaths, ...sandboxRest } = sandbox ?? {};
389
- const keptCommands = Object.fromEntries(
390
- Object.entries(formatters?.commands ?? {}).filter(([, f]) => f === false)
391
- );
392
- return {
393
- ...rest,
394
- ...formatters === void 0 ? {} : { formatters: { ...formatters, commands: keptCommands } },
395
- executor: settings.executor === "host" ? "auto" : settings.executor,
396
- allow: [],
397
- envAllow: [],
398
- ...sandbox === void 0 ? {} : { sandbox: sandboxRest },
399
- ...web === void 0 ? {} : { web: { ...web, allowLocalhost: false } }
400
- };
401
- }
402
- async function gateProjectSettings(options) {
403
- const risk = settingsRisk(options.settings);
404
- if (risk === void 0) return { settings: options.settings };
405
- const hash2 = settingsRiskHash(risk);
406
- const known = options.trust?.settingsHash(options.root);
407
- if (known === hash2) return { settings: options.settings };
408
- const lines = settingsRiskLines(risk);
409
- if (options.ask !== void 0) {
410
- const choice = await options.ask({
411
- tool: "settings",
412
- target: { kind: "input", json: "" },
413
- title: "Project settings that loosen safety",
414
- preview: [
415
- `This project's .garuda/settings.json ${known === void 0 ? "asks for" : "changed and now asks for"}:`,
416
- ...lines.map((line) => ` - ${line}`),
417
- "A cloned repository can ship this file. Without your yes, Garuda uses safe defaults for these",
418
- "parts; the rest of the file applies."
419
- ].join("\n"),
420
- isolation: options.isolation ?? "os",
421
- question: "Use these project settings?",
422
- choices: ["once", "session", "deny"],
423
- labels: {
424
- once: "Yes, for this run",
425
- session: "Yes, and remember (asks again when they change)",
426
- deny: "No, use safe defaults"
427
- }
428
- });
429
- if (choice === "session") await options.trust?.setSettingsHash(options.root, hash2);
430
- if (choice !== "deny") return { settings: options.settings };
431
- }
432
- return {
433
- settings: withoutRisk(options.settings),
434
- notice: [
435
- `Project settings not applied (not approved): ${lines.join("; ")}.`,
436
- "Start the chat in a terminal and answer yes to use them."
437
- ].join(" ")
438
- };
439
- }
440
-
441
348
  export {
442
349
  FileTracker,
443
350
  FileSessionStore,
@@ -466,7 +373,6 @@ export {
466
373
  addChildDebit,
467
374
  addChildReport,
468
375
  settleChildDebits,
469
- addSideUsage,
470
- gateProjectSettings
376
+ addSideUsage
471
377
  };
472
- //# sourceMappingURL=chunk-UKIE4AAM.js.map
378
+ //# sourceMappingURL=chunk-NLS7GMF7.js.map
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  DEFAULT_ENV_ALLOWLIST
4
- } from "./chunk-B4SJY7KT.js";
4
+ } from "./chunk-LMKGSYJC.js";
5
5
 
6
6
  // src/jobs/git.ts
7
7
  var GIT_TIMEOUT_MS = 12e4;
@@ -28,7 +28,7 @@ async function hostCommand(executor, cwd, argv, options = {}) {
28
28
  const command = argv.map(shellWord).join(" ");
29
29
  const result = await executor.run(command, policy, {
30
30
  ...options.signal === void 0 ? {} : { signal: options.signal },
31
- env: { GIT_TERMINAL_PROMPT: "0" }
31
+ env: { ...options.env, GIT_TERMINAL_PROMPT: "0" }
32
32
  });
33
33
  if (result.aborted) throw options.signal?.reason ?? new Error("stopped");
34
34
  const out = { exitCode: result.exitCode, stdout: result.stdout.text, stderr: result.stderr.text };
@@ -46,4 +46,4 @@ export {
46
46
  git,
47
47
  hostCommand
48
48
  };
49
- //# sourceMappingURL=chunk-6XHON3Q6.js.map
49
+ //# sourceMappingURL=chunk-QXTHEFKP.js.map
@@ -4,9 +4,11 @@ import {
4
4
  pickChannel
5
5
  } from "./chunk-N4I6YS3E.js";
6
6
  import {
7
- gateProjectSettings,
7
+ gateProjectSettings
8
+ } from "./chunk-ULAJPMY7.js";
9
+ import {
8
10
  isCostIncomplete
9
- } from "./chunk-UKIE4AAM.js";
11
+ } from "./chunk-NLS7GMF7.js";
10
12
  import {
11
13
  totalTokens
12
14
  } from "./chunk-7KBOIPUT.js";
@@ -19,11 +21,11 @@ import {
19
21
  jobChanges,
20
22
  outsideScope,
21
23
  prepareWorktree
22
- } from "./chunk-55CFEEIN.js";
24
+ } from "./chunk-WK5NE6RY.js";
23
25
  import {
24
26
  defaultAgentEnv,
25
27
  removeAgent
26
- } from "./chunk-5B5HDTUR.js";
28
+ } from "./chunk-TWQ7V2L6.js";
27
29
  import {
28
30
  jobReport
29
31
  } from "./chunk-3MRQJKUO.js";
@@ -40,11 +42,11 @@ import {
40
42
  JobGitError,
41
43
  git,
42
44
  hostCommand
43
- } from "./chunk-6XHON3Q6.js";
45
+ } from "./chunk-QXTHEFKP.js";
44
46
  import {
45
47
  createExecutor,
46
48
  loadSettings
47
- } from "./chunk-B4SJY7KT.js";
49
+ } from "./chunk-LMKGSYJC.js";
48
50
  import {
49
51
  JOBS_DIR,
50
52
  loadJob,
@@ -350,4 +352,4 @@ export {
350
352
  msUntil,
351
353
  finishJob
352
354
  };
353
- //# sourceMappingURL=chunk-4BVCYCQT.js.map
355
+ //# sourceMappingURL=chunk-R7RCW4BQ.js.map