@tiens.nguyen/gu-cli 1.0.939 → 1.0.940

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 (64) hide show
  1. package/README.md +17 -7
  2. package/agent-deps-preflight.mjs +1 -1
  3. package/autocompact.mjs +2 -2
  4. package/browser-bridge.mjs +2 -2
  5. package/browser-chrome.mjs +2 -2
  6. package/browser-command.mjs +4 -4
  7. package/browser-extension/README.md +6 -6
  8. package/clear-logs.mjs +3 -3
  9. package/clear-state.mjs +3 -3
  10. package/cli-token.mjs +8 -8
  11. package/client-expert-api.mjs +9 -9
  12. package/client-expert-run.mjs +7 -7
  13. package/client-expert-setup.mjs +4 -4
  14. package/command-allow.mjs +1 -1
  15. package/conversation-archive.mjs +2 -2
  16. package/credential-recovery.mjs +1 -1
  17. package/daemon-control.mjs +4 -4
  18. package/device-login.mjs +3 -3
  19. package/free-model.mjs +1 -1
  20. package/full-log-command.mjs +1 -1
  21. package/gonext_agent_chat.py +71 -71
  22. package/gu-cli.mjs +29 -28
  23. package/gu-home-move.mjs +193 -0
  24. package/gu-repl.mjs +54 -51
  25. package/gu_browser.py +3 -3
  26. package/gu_free_budget.py +2 -2
  27. package/gu_gif.py +1 -1
  28. package/gu_hooks.py +1 -1
  29. package/gu_turn_notes.py +2 -2
  30. package/hooks-config.mjs +4 -4
  31. package/image-paste.mjs +8 -8
  32. package/install-path.mjs +1 -1
  33. package/log-level.mjs +1 -1
  34. package/log-policy.mjs +1 -1
  35. package/lsp-host.mjs +2 -2
  36. package/lsp-registry.mjs +9 -9
  37. package/mcp-command.mjs +1 -1
  38. package/mcp-config.mjs +5 -5
  39. package/model-doctor.mjs +10 -10
  40. package/mongo-mac.mjs +2 -2
  41. package/mongo-windows.mjs +3 -3
  42. package/package.json +2 -1
  43. package/platform-tools.mjs +3 -3
  44. package/poll-errors.mjs +2 -2
  45. package/prompt_scaffold_check.py +1 -1
  46. package/proxy-store.mjs +1 -1
  47. package/python-unix.mjs +6 -6
  48. package/python-windows.mjs +1 -1
  49. package/rag-selftest.mjs +2 -2
  50. package/resume-memory.mjs +1 -1
  51. package/scripts/image-paste-check.mjs +1 -1
  52. package/setup-fixes.mjs +4 -4
  53. package/shell-details.mjs +2 -2
  54. package/skill-install.mjs +9 -9
  55. package/skill-package.mjs +10 -10
  56. package/skill-source.mjs +4 -4
  57. package/skills-copy.mjs +15 -15
  58. package/skills.mjs +4 -4
  59. package/support-bundle.mjs +6 -6
  60. package/support-report.mjs +5 -5
  61. package/terminal-layout.mjs +1 -1
  62. package/turn-notes.mjs +2 -2
  63. package/version-check.mjs +1 -1
  64. package/workspace-revert.mjs +2 -2
@@ -2495,7 +2495,7 @@ def _looks_like_scratchpad(stripped: str) -> bool:
2495
2495
  # THE CODE-AGENT SCAFFOLD IS NOT IN THIS FILE (task #246). The fixed system prompt — the
2496
2496
  # Thought → Code → Observation rules that replace smolagents' stock ~9.9k-char template — is served
2497
2497
  # by the API (GET /api/worker/prompt-scaffold) and never shipped in the gu package. The worker
2498
- # gets it once per job — from ~/.gonext/prompt-scaffolds/code-agent.txt if YOU put one there (gu
2498
+ # gets it once per job — from ~/.gu/prompt-scaffolds/code-agent.txt if YOU put one there (gu
2499
2499
  # never writes it), else from the API — and if it cannot, the turn stops with the reason. There is
2500
2500
  # no bundled copy to fall back to: the point is that the text is not in what gu ships.
2501
2501
  #
@@ -2522,11 +2522,11 @@ _SCAFFOLD_REQUIRED = _psc.SCAFFOLD_REQUIRED
2522
2522
  # client name with error 1010 before the API sees the request. Every direct call to the gu service
2523
2523
  # names itself instead; the default API host (chat-api-v2) is not behind Cloudflare, gucli.com is.
2524
2524
  def _internal_label() -> str:
2525
- """Our own machines only: GU_INTERNAL_LABEL or ~/.gonext/internal-label (real users have neither)."""
2525
+ """Our own machines only: GU_INTERNAL_LABEL or ~/.gu/internal-label (real users have neither)."""
2526
2526
  v = os.environ.get("GU_INTERNAL_LABEL", "").strip()
2527
2527
  if not v:
2528
2528
  try:
2529
- v = open(os.path.join(os.path.expanduser("~"), ".gonext", "internal-label"), encoding="utf-8").read().strip()
2529
+ v = open(os.path.join(os.path.expanduser("~"), ".gu", "internal-label"), encoding="utf-8").read().strip()
2530
2530
  except OSError:
2531
2531
  v = ""
2532
2532
  return re.sub(r"[^A-Za-z0-9._-]", "", v)[:40]
@@ -2538,7 +2538,7 @@ _GU_UA = "gu-agent/1.0 (+https://gucli.com" + (f"; internal:{_internal_label()}"
2538
2538
  def _load_prompt_scaffold(api_base: str, worker_key: str):
2539
2539
  """The scaffold for this turn → (template, version, source).
2540
2540
 
2541
- YOUR LOCAL FILE FIRST (~/.gonext/prompt-scaffolds/code-agent.txt): when it exists it is used and
2541
+ YOUR LOCAL FILE FIRST (~/.gu/prompt-scaffolds/code-agent.txt): when it exists it is used and
2542
2542
  the API is not asked. Otherwise the API's version (the database's). Either way it passes the
2543
2543
  three checks in _scaffold_problem, and a failure stops the turn with the reason — a broken local
2544
2544
  file is NOT quietly replaced by the database version, or an edit that broke it would look like
@@ -3562,7 +3562,7 @@ def _repair_request(kwargs: dict, err):
3562
3562
 
3563
3563
 
3564
3564
  def _shape_path() -> str:
3565
- return os.path.join(os.path.expanduser("~"), ".gonext", "request-shapes.json")
3565
+ return os.path.join(os.path.expanduser("~"), ".gu", "request-shapes.json")
3566
3566
 
3567
3567
 
3568
3568
  def _shape_entries() -> dict:
@@ -4644,7 +4644,7 @@ def _ctx_learned_path() -> str:
4644
4644
  forget. Persisting turns that into once ever — which is what "we should not have to tell it"
4645
4645
  actually requires.
4646
4646
  """
4647
- return os.path.join(os.path.expanduser("~"), ".gonext", "context-windows.json")
4647
+ return os.path.join(os.path.expanduser("~"), ".gu", "context-windows.json")
4648
4648
 
4649
4649
 
4650
4650
  def _load_learned_windows() -> dict:
@@ -4701,7 +4701,7 @@ _UNKNOWN_CTX_COMPACT_AT = 24000
4701
4701
 
4702
4702
  def _autocompact_path() -> str:
4703
4703
  """The user's autocompact choice (GH #538), written by gu's startup question and /autocompact."""
4704
- return os.path.join(os.path.expanduser("~"), ".gonext", "autocompact.json")
4704
+ return os.path.join(os.path.expanduser("~"), ".gu", "autocompact.json")
4705
4705
 
4706
4706
 
4707
4707
  def _autocompact_cap(model_id: str = "") -> int:
@@ -6632,7 +6632,7 @@ def _rag_source_key(url: str) -> str:
6632
6632
  def _rag_known_sources() -> list:
6633
6633
  """Every knowledge base that exists for THIS folder, by its original key.
6634
6634
 
6635
- The keys on disk are hashes (~/.gonext/rag/<sha(activeFolder)>/<sha(sourceKey)>/), so they
6635
+ The keys on disk are hashes (~/.gu/rag/<sha(activeFolder)>/<sha(sourceKey)>/), so they
6636
6636
  cannot be reversed — but each index writes a manifest carrying "sourceUrl", the key as it
6637
6637
  was given. Reading those back is the only way to answer "what IS indexed here?", which is
6638
6638
  what turns "No knowledge base found" from a dead end into something actionable.
@@ -6648,7 +6648,7 @@ def _rag_known_sources() -> list:
6648
6648
  try:
6649
6649
  folder = _WS_ACTIVE or os.getcwd()
6650
6650
  fhash = hashlib.sha256(os.path.realpath(folder).encode("utf-8")).hexdigest()[:32]
6651
- base = os.path.join(os.path.expanduser("~"), ".gonext", "rag", fhash)
6651
+ base = os.path.join(os.path.expanduser("~"), ".gu", "rag", fhash)
6652
6652
  out = []
6653
6653
  for name in sorted(os.listdir(base)):
6654
6654
  mpath = os.path.join(base, name, "manifest.json")
@@ -6755,7 +6755,7 @@ def _rag_assert_safe_url(url: str) -> None:
6755
6755
 
6756
6756
  def _rag_workdir(source_key: str) -> str:
6757
6757
  import os
6758
- base = os.path.join(os.path.expanduser("~"), ".gonext", "rag-work", source_key)
6758
+ base = os.path.join(os.path.expanduser("~"), ".gu", "rag-work", source_key)
6759
6759
  os.makedirs(base, exist_ok=True)
6760
6760
  return base
6761
6761
 
@@ -6763,7 +6763,7 @@ def _rag_workdir(source_key: str) -> str:
6763
6763
  def _rag_base_dir(source_key: str) -> str:
6764
6764
  """Where a URL's downloaded/unzipped files should live. Prefer the active terminal
6765
6765
  workspace (the folder the `gu` REPL was opened from) so files land in the
6766
- user's project; otherwise fall back to the per-URL cache dir under ~/.gonext."""
6766
+ user's project; otherwise fall back to the per-URL cache dir under ~/.gu."""
6767
6767
  import os
6768
6768
  if _WS_ACTIVE:
6769
6769
  os.makedirs(_WS_ACTIVE, exist_ok=True)
@@ -7004,14 +7004,14 @@ def _rag_resolve_embed_model(configured: str, served: str) -> str:
7004
7004
 
7005
7005
  def _rag_local_index_dir(source_url: str) -> str:
7006
7006
  """Local RAG index dir for a source, scoped PER-FOLDER (task #97): the vector shards
7007
- live at ~/.gonext/rag/<sha256(activeFolder)>/<sha256(sourceUrl)>/. Keying on the active
7007
+ live at ~/.gu/rag/<sha256(activeFolder)>/<sha256(sourceUrl)>/. Keying on the active
7008
7008
  terminal folder (the SAME sha256 scheme the REPL uses for its session files) isolates
7009
7009
  each project's knowledge base, so the same URL indexed from two folders stays separate."""
7010
7010
  import hashlib
7011
7011
  import os
7012
7012
  folder = _WS_ACTIVE or os.getcwd()
7013
7013
  fhash = hashlib.sha256(os.path.realpath(folder).encode("utf-8")).hexdigest()[:32]
7014
- base = os.path.join(os.path.expanduser("~"), ".gonext", "rag", fhash,
7014
+ base = os.path.join(os.path.expanduser("~"), ".gu", "rag", fhash,
7015
7015
  _rag_source_key(source_url))
7016
7016
  os.makedirs(base, exist_ok=True)
7017
7017
  return base
@@ -7019,7 +7019,7 @@ def _rag_local_index_dir(source_url: str) -> str:
7019
7019
 
7020
7020
  def _rag_download(url: str, dest_path: str = "") -> tuple:
7021
7021
  """Download a public URL with SSRF + size guards — IDEMPOTENT per URL. Every URL
7022
- maps to a deterministic work dir (~/.gonext/rag-work/<urlHash>/); relative
7022
+ maps to a deterministic work dir (~/.gu/rag-work/<urlHash>/); relative
7023
7023
  dest_paths are contained there (never the process cwd, which is the user's home),
7024
7024
  and a repeat call for an already-downloaded URL reuses the cached file instantly
7025
7025
  (follow-up questions re-run the pipeline cheaply). Returns (path, cached)."""
@@ -7089,7 +7089,7 @@ def _rag_resolve_zip(zip_path: str) -> str:
7089
7089
  if os.path.isfile(cand):
7090
7090
  return cand
7091
7091
  hits = _glob.glob(os.path.join(
7092
- os.path.expanduser("~"), ".gonext", "rag-work", "*", base))
7092
+ os.path.expanduser("~"), ".gu", "rag-work", "*", base))
7093
7093
  if hits:
7094
7094
  return hits[0]
7095
7095
  return zp
@@ -7219,7 +7219,7 @@ def _rag_iter_text_files(root: str):
7219
7219
 
7220
7220
  def _rg_binary(env=None):
7221
7221
  """The ripgrep to use, or "" for none. GU_RG=0 turns it off; GU_RG=<path> picks one; then PATH,
7222
- then gu's own copy in ~/.gonext/bin."""
7222
+ then gu's own copy in ~/.gu/bin."""
7223
7223
  import os
7224
7224
  env = os.environ if env is None else env
7225
7225
  want = (env.get("GU_RG") or "").strip()
@@ -7238,7 +7238,7 @@ def _rg_binary(env=None):
7238
7238
  cand = os.path.join(d, exe)
7239
7239
  if os.path.isfile(cand) and os.access(cand, os.X_OK):
7240
7240
  return cand
7241
- own = os.path.join(os.path.expanduser("~"), ".gonext", "bin", exe)
7241
+ own = os.path.join(os.path.expanduser("~"), ".gu", "bin", exe)
7242
7242
  return own if os.path.isfile(own) and os.access(own, os.X_OK) else ""
7243
7243
 
7244
7244
 
@@ -7731,14 +7731,14 @@ def _rag_parse_location(loc: str):
7731
7731
  return bucket, prefix.strip("/")
7732
7732
 
7733
7733
 
7734
- # Registered workspace roots (from ~/.gonext/workspaces.json via the worker) — set
7734
+ # Registered workspace roots (from ~/.gu/workspaces.json via the worker) — set
7735
7735
  # per-run by run_agent_chat. Reads are allowed in any of them; WRITES additionally
7736
7736
  # require _ws_write_allowed (workspace root + not inside .git/).
7737
7737
  _WS_ROOTS: list = [] # [{"name": str, "path": realpath str, "allowRun": bool}]
7738
7738
 
7739
7739
  # The active terminal workspace: the folder the `gu` REPL was launched from
7740
7740
  # (passed through as payload.activeWorkspace). When set, download_file/unzip_file put
7741
- # their output HERE instead of the shared ~/.gonext/rag-work cache, so files land in
7741
+ # their output HERE instead of the shared ~/.gu/rag-work cache, so files land in
7742
7742
  # the user's actual project folder. Only honoured if it's a registered workspace root.
7743
7743
  _WS_ACTIVE: str = ""
7744
7744
 
@@ -7794,7 +7794,7 @@ def _ws_strip_echoed_root(base: str, rel: str, need_parent: bool = False) -> str
7794
7794
 
7795
7795
 
7796
7796
  def _rag_read_allowed(path: str) -> str:
7797
- """Resolve `path` and ensure it stays within a safe root (temp dir, ~/.gonext, the
7797
+ """Resolve `path` and ensure it stays within a safe root (temp dir, ~/.gu, the
7798
7798
  active terminal folder, or a registered workspace) — so the agent's file tools can't
7799
7799
  read arbitrary files like ~/.ssh. Relative paths anchor to the terminal workspace
7800
7800
  (where downloads/unzips land), because the model routinely passes bare names like
@@ -7804,7 +7804,7 @@ def _rag_read_allowed(path: str) -> str:
7804
7804
  daemon is often launched from ~/Projects (the PARENT of every workspace), so trusting
7805
7805
  os.getcwd() let `grep_repo(path="/Users/joseph/Projects")` read EVERY project on disk
7806
7806
  — including other repos' secrets. Reads are confined to the registered/active
7807
- workspaces + ~/.gonext + the temp dir. Fail-closed: no workspace ⇒ no repo reads."""
7807
+ workspaces + ~/.gu + the temp dir. Fail-closed: no workspace ⇒ no repo reads."""
7808
7808
  import os
7809
7809
  import tempfile
7810
7810
  expanded = os.path.expanduser((path or "").strip())
@@ -7820,7 +7820,7 @@ def _rag_read_allowed(path: str) -> str:
7820
7820
  rp = os.path.realpath(expanded)
7821
7821
  roots = [
7822
7822
  os.path.realpath(tempfile.gettempdir()),
7823
- os.path.realpath(os.path.join(os.path.expanduser("~"), ".gonext")),
7823
+ os.path.realpath(os.path.join(os.path.expanduser("~"), ".gu")),
7824
7824
  ] + [w["path"] for w in _WS_ROOTS]
7825
7825
  # The active terminal folder (download/unzip target) — allow reading what we just
7826
7826
  # extracted there, even when it isn't a registered workspace.
@@ -7917,13 +7917,13 @@ def _workspace_overview(roots, max_entries: int = 40) -> str:
7917
7917
  def _turn_checkpoint_path(workspace: str) -> str:
7918
7918
  """Path to the interrupted-turn checkpoint for a given workspace. Keyed by a hash
7919
7919
  of the workspace path (same sha256-slice convention as _rag_source_key) — but a
7920
- separate file/purpose from the REPL's own ~/.gonext/sessions: this holds one
7920
+ separate file/purpose from the REPL's own ~/.gu/sessions: this holds one
7921
7921
  in-PROGRESS turn's step trace, written incrementally as the agent works, not
7922
7922
  completed Q&A history."""
7923
7923
  import hashlib
7924
7924
  import os
7925
7925
  h = hashlib.sha256(workspace.encode("utf-8")).hexdigest()[:32]
7926
- base = os.path.join(os.path.expanduser("~"), ".gonext", "agent-turns")
7926
+ base = os.path.join(os.path.expanduser("~"), ".gu", "agent-turns")
7927
7927
  os.makedirs(base, exist_ok=True)
7928
7928
  return os.path.join(base, f"{h}.json")
7929
7929
 
@@ -7960,7 +7960,7 @@ def _load_turn_checkpoint(workspace: str):
7960
7960
  That window is not theoretical: it is the reported bug. Changing the coding model is
7961
7961
  exactly what makes a turn die before step 1 — a new coder with a missing or stale API
7962
7962
  key, or a name the server does not have, raises on the FIRST model call. The user saw
7963
- ~/.gonext/agent-turns emptied "only when I change model" and concluded the model
7963
+ ~/.gu/agent-turns emptied "only when I change model" and concluded the model
7964
7964
  switch deleted it; nothing on that path touches the file. The consume did, on behalf
7965
7965
  of a turn that never ran.
7966
7966
 
@@ -8301,7 +8301,7 @@ def _ws_backup_root() -> str:
8301
8301
  import time as _t
8302
8302
  if _WS_RUN_ID is None:
8303
8303
  _WS_RUN_ID = _t.strftime("%Y%m%d-%H%M%S", _t.localtime())
8304
- root = os.path.join(os.path.expanduser("~"), ".gonext", "workspace-backups", _WS_RUN_ID)
8304
+ root = os.path.join(os.path.expanduser("~"), ".gu", "workspace-backups", _WS_RUN_ID)
8305
8305
  os.makedirs(root, exist_ok=True)
8306
8306
  return root
8307
8307
 
@@ -8316,7 +8316,7 @@ _KILL_BY_NAME_RE = re.compile(
8316
8316
  r"(?:pkill|killall)\s+(?:-\S+\s+)*['\"]?|get-process\s+(?:-name\s+)?['\"]?)"
8317
8317
  r"(node|python|python3|py|pythonw|gu|gu-cli|gu-repl)(?:\.exe)?\b")
8318
8318
  _GU_OWN_CMD_RE = re.compile(
8319
- r"(?i)(gu-repl\.mjs|gu-cli\.mjs|gonext_agent_chat\.py|gu-local-worker|[\\/]\.gonext[\\/]api[\\/])")
8319
+ r"(?i)(gu-repl\.mjs|gu-cli\.mjs|gonext_agent_chat\.py|gu-local-worker|[\\/]\.gu[\\/]api[\\/])")
8320
8320
 
8321
8321
 
8322
8322
  def _gu_kill_refusal(command: str, own: dict) -> str:
@@ -8339,10 +8339,10 @@ def _gu_kill_refusal(command: str, own: dict) -> str:
8339
8339
 
8340
8340
  def _gu_own_processes() -> dict:
8341
8341
  """pid → what it is, for every process that is gu: this turn and its parent, the pid files
8342
- in ~/.gonext, and any process whose command line is gu's (the REPL, the worker, the API)."""
8342
+ in ~/.gu, and any process whose command line is gu's (the REPL, the worker, the API)."""
8343
8343
  import subprocess
8344
8344
  own = {os.getpid(): "this turn", os.getppid(): "the gu worker running this turn"}
8345
- gdir = os.path.join(os.path.expanduser("~"), ".gonext")
8345
+ gdir = os.path.join(os.path.expanduser("~"), ".gu")
8346
8346
  for name, what in (("local-api.pid", "gu's local API"), ("worker.pid", "the gu worker")):
8347
8347
  try:
8348
8348
  with open(os.path.join(gdir, name), encoding="utf-8") as fh:
@@ -9056,7 +9056,7 @@ def _ws_shell_command_risk(scan, denyset, wd="", allowset=None, roots=None, env_
9056
9056
  cur = os.path.normpath(os.path.join(cur or os.getcwd(),
9057
9057
  os.path.expanduser(_shell_path_to_native(a[1]))))
9058
9058
  cwds[id(c)] = cur
9059
- # GH #515: gu sources <workspace>/.gonext/env ITSELF before every line (#181), so a line that sources
9059
+ # GH #515: gu sources <workspace>/.gu/env ITSELF before every line (#181), so a line that sources
9060
9060
  # that same file adds nothing — never ask. Another file the user said yes to for good is not asked
9061
9061
  # while it is unchanged, and only when nothing but `cd` (or such sources) runs before it in the line:
9062
9062
  # anything else could rewrite it first.
@@ -9458,10 +9458,10 @@ _BG_LINE = ("A LONG job (build, deploy, big test run) → run_command(…, backg
9458
9458
  "polls; a build whose result you need next is simpler as one run_command(…, "
9459
9459
  "timeout_seconds=600). A command still running at its timeout moves to the background "
9460
9460
  "by itself instead of being killed. Setup every command needs (exports) goes ONCE in "
9461
- "<workspace>/.gonext/env, which gu sources before each command by itself (never `source` "
9461
+ "<workspace>/.gu/env, which gu sources before each command by itself (never `source` "
9462
9462
  "it in a command). A recipe that WORKED "
9463
9463
  "after effort (a login, build flags, a deploy path) or a short project summary goes as "
9464
- "ONE line in <workspace>/.gonext/notes.md, shown at the start of every later turn.\n")
9464
+ "ONE line in <workspace>/.gu/notes.md, shown at the start of every later turn.\n")
9465
9465
 
9466
9466
 
9467
9467
  # What to do instead, said where quoting broke — in gu's own pre-check (an unbalanced quote never
@@ -9614,12 +9614,12 @@ _WS_NOTES_CAP = 1500
9614
9614
 
9615
9615
 
9616
9616
  def _ws_notes_line(root: str, cap: int = _WS_NOTES_CAP) -> str:
9617
- """<workspace>/.gonext/notes.md shown in every turn's context (GitHub #184, turn review #389):
9617
+ """<workspace>/.gu/notes.md shown in every turn's context (GitHub #184, turn review #389):
9618
9618
  a recipe that worked (turn #7 spent ~15 steps rediscovering turn #6's App Store login) and a
9619
9619
  short project summary (turns #4/#5/#8 each re-read the same docs). Capped; "" when absent."""
9620
9620
  if not root:
9621
9621
  return ""
9622
- p = os.path.join(root, ".gonext", "notes.md")
9622
+ p = os.path.join(root, ".gu", "notes.md")
9623
9623
  try:
9624
9624
  with open(p, encoding="utf-8", errors="replace") as fh:
9625
9625
  txt = fh.read(cap + 1).strip()
@@ -9629,7 +9629,7 @@ def _ws_notes_line(root: str, cap: int = _WS_NOTES_CAP) -> str:
9629
9629
  return ""
9630
9630
  if len(txt) > cap:
9631
9631
  txt = txt[:cap].rstrip() + " …(cut — keep notes.md short)"
9632
- return (" WORKSPACE NOTES (.gonext/notes.md — recipes and facts saved by earlier turns; use them "
9632
+ return (" WORKSPACE NOTES (.gu/notes.md — recipes and facts saved by earlier turns; use them "
9633
9633
  "before rediscovering):\n" + "\n".join(f" {l}" for l in txt.splitlines()) + "\n")
9634
9634
 
9635
9635
 
@@ -10180,7 +10180,7 @@ def _ws_delete_outside_reason(argv, wd, roots=None):
10180
10180
  # run_command itself (after the risk gate, just before the spawn), not left to the model: a rule
10181
10181
  # in the prompt is followed most of the time. Only commits gu makes; the user's own are untouched.
10182
10182
  #
10183
- # Settings, ~/.gonext/settings.json then <project>/.gonext/settings.json (the project wins):
10183
+ # Settings, ~/.gu/settings.json then <project>/.gu/settings.json (the project wins):
10184
10184
  # "attribution": {"commit": true, "pr": true, "name": "gu", "email": "…"}
10185
10185
  _ATTRIBUTION_DEFAULT = {"commit": True, "pr": True, "name": "gu",
10186
10186
  "email": "334027377+gu-marsic-agent@users.noreply.github.com"}
@@ -10193,12 +10193,12 @@ def _attribution_settings(wd="", home=None, roots=None):
10193
10193
  """The attribution settings in force for a command run in `wd`."""
10194
10194
  out = dict(_ATTRIBUTION_DEFAULT)
10195
10195
  home = home or os.path.expanduser("~")
10196
- places = [os.path.join(home, ".gonext", "settings.json")]
10196
+ places = [os.path.join(home, ".gu", "settings.json")]
10197
10197
  wd_real = os.path.realpath(wd) if wd else ""
10198
10198
  for r in (_WS_ROOTS if roots is None else roots):
10199
10199
  p = os.path.realpath(r.get("path") or "")
10200
10200
  if p and wd_real and (wd_real == p or wd_real.startswith(p.rstrip(os.sep) + os.sep)):
10201
- places.append(os.path.join(p, ".gonext", "settings.json"))
10201
+ places.append(os.path.join(p, ".gu", "settings.json"))
10202
10202
  break
10203
10203
  for path in places:
10204
10204
  try:
@@ -10260,14 +10260,14 @@ def _with_attribution(argv, settings):
10260
10260
  return argv, ""
10261
10261
 
10262
10262
 
10263
- # GH #215: "Yes, always in this folder" for the SOFT destructive question. ~/.gonext/command-allow.json
10263
+ # GH #215: "Yes, always in this folder" for the SOFT destructive question. ~/.gu/command-allow.json
10264
10264
  # ({"folders": [...]}) is written by the terminal (command-allow.mjs). It never covers a hard reason
10265
10265
  # (sudo, denylist, delete outside the project) - those keep asking.
10266
10266
  _CMD_ALLOW_ASK = "a destructive command"
10267
10267
 
10268
10268
 
10269
10269
  def _cmd_allow_path():
10270
- return os.environ.get("GU_COMMAND_ALLOW") or os.path.join(os.path.expanduser("~"), ".gonext", "command-allow.json")
10270
+ return os.environ.get("GU_COMMAND_ALLOW") or os.path.join(os.path.expanduser("~"), ".gu", "command-allow.json")
10271
10271
 
10272
10272
 
10273
10273
  def _cmd_source_allowed(path, wd):
@@ -10423,7 +10423,7 @@ def _ws_request_approval(api_base, worker_key, job_id, command, reason, deadline
10423
10423
  # bun dev, a custom `make serve`, anything. (An earlier version pattern-matched command
10424
10424
  # names like "npm start"; rejected as unwinnable hardcode — same lesson as task #37.)
10425
10425
  # Detected servers are left running in their own process group (start_new_session),
10426
- # recorded in ~/.gonext/servers.json, and stoppable via the stop_server tool.
10426
+ # recorded in ~/.gu/servers.json, and stoppable via the stop_server tool.
10427
10427
 
10428
10428
 
10429
10429
  # Windows has no process groups in the POSIX sense, no pgrep, and no lsof — and os.setsid /
@@ -10808,7 +10808,7 @@ def _ws_gui_pids(pgid: int) -> list:
10808
10808
 
10809
10809
  def _ws_servers_path() -> str:
10810
10810
  import os
10811
- base = os.path.join(os.path.expanduser("~"), ".gonext")
10811
+ base = os.path.join(os.path.expanduser("~"), ".gu")
10812
10812
  os.makedirs(base, exist_ok=True)
10813
10813
  return os.path.join(base, "servers.json")
10814
10814
 
@@ -10883,7 +10883,7 @@ _FG_SHELL_AFTER_S = 4 # a foreground command shows up as a shell after this man
10883
10883
 
10884
10884
  def _shells_path() -> str:
10885
10885
  import os
10886
- base = os.path.join(os.path.expanduser("~"), ".gonext")
10886
+ base = os.path.join(os.path.expanduser("~"), ".gu")
10887
10887
  os.makedirs(base, exist_ok=True)
10888
10888
  return os.path.join(base, "shells.json")
10889
10889
 
@@ -11250,7 +11250,7 @@ def _run_state_path() -> str:
11250
11250
  import atexit
11251
11251
  import time as _t
11252
11252
  if not _RUN_STATE["path"]:
11253
- d = os.path.join(os.path.expanduser("~"), ".gonext", "run-state")
11253
+ d = os.path.join(os.path.expanduser("~"), ".gu", "run-state")
11254
11254
  os.makedirs(d, exist_ok=True)
11255
11255
  # A background shell that ends after its turn rewrites its file; sweep day-old ones.
11256
11256
  try:
@@ -11369,20 +11369,20 @@ def _run_state_set_cwd(cwd: str) -> None:
11369
11369
 
11370
11370
 
11371
11371
  def _ws_env_file(root: str = "") -> str:
11372
- """<workspace>/.gonext/env when it exists, else "" (GitHub #181, turn review #389): the setup
11372
+ """<workspace>/.gu/env when it exists, else "" (GitHub #181, turn review #389): the setup
11373
11373
  every command needs (`export DEVELOPER_DIR=…; export LC_ALL=…`) is written there ONCE and
11374
11374
  sourced before each run_command line, instead of being repeated on every call."""
11375
11375
  try:
11376
11376
  root = root or _default_ws_root()
11377
11377
  except Exception: # noqa: BLE001
11378
11378
  return ""
11379
- p = os.path.join(root or "", ".gonext", "env")
11379
+ p = os.path.join(root or "", ".gu", "env")
11380
11380
  return p if root and os.path.isfile(p) else ""
11381
11381
 
11382
11382
 
11383
11383
  def _run_state_wrapper() -> str:
11384
11384
  """The outer script: $1 the line, $2 the exit file, $3 the state file, $4 the env file."""
11385
- # $4: the workspace's .gonext/env (GitHub #181) — sourced first, so this turn's own exports win.
11385
+ # $4: the workspace's .gu/env (GitHub #181) — sourced first, so this turn's own exports win.
11386
11386
  return ('[ -n "$4" ] && [ -f "$4" ] && . "$4" >/dev/null 2>&1; [ -f "$3" ] && . "$3" >/dev/null 2>&1; '
11387
11387
  "trap '__gu_rc=$?; echo $__gu_rc > \"$2\"; "
11388
11388
  f"export -p | grep -vE \"{_RUN_STATE_SKIP}\" > \"$3.tmp\" 2>/dev/null && mv -f \"$3.tmp\" \"$3\"; "
@@ -11410,11 +11410,11 @@ def _ws_scrubbed_env() -> dict:
11410
11410
  # PowerShell finds its own modules (Microsoft.PowerShell.*) through it (#374).
11411
11411
  "PSModulePath")
11412
11412
  env = {k: os.environ[k] for k in keep if k in os.environ}
11413
- # gu's own Python environment (~/.gonext/venv) FIRST on PATH: the document skills (xlsx, pptx, docx, pdf) are run as
11413
+ # gu's own Python environment (~/.gu/venv) FIRST on PATH: the document skills (xlsx, pptx, docx, pdf) are run as
11414
11414
  # `python scripts/...` and their libraries were installed there by `gu-cli deps`. Without this a bare `python` is the
11415
11415
  # system one (on Windows 11 often the Microsoft Store stub) and every import fails.
11416
11416
  try:
11417
- venv_bin = os.path.join(os.path.expanduser("~"), ".gonext", "venv", "Scripts" if os.name == "nt" else "bin")
11417
+ venv_bin = os.path.join(os.path.expanduser("~"), ".gu", "venv", "Scripts" if os.name == "nt" else "bin")
11418
11418
  if os.path.isdir(venv_bin):
11419
11419
  env["PATH"] = venv_bin + os.pathsep + env.get("PATH", "")
11420
11420
  env["VIRTUAL_ENV"] = os.path.dirname(venv_bin)
@@ -11422,7 +11422,7 @@ def _ws_scrubbed_env() -> dict:
11422
11422
  pass
11423
11423
  # The docx / pptx skills `require('docx')` / `require('pptxgenjs')`; `gu-cli deps` installs them here.
11424
11424
  try:
11425
- node_libs = os.path.join(os.path.expanduser("~"), ".gonext", "node-libs", "node_modules")
11425
+ node_libs = os.path.join(os.path.expanduser("~"), ".gu", "node-libs", "node_modules")
11426
11426
  if os.path.isdir(node_libs):
11427
11427
  env["NODE_PATH"] = node_libs + (os.pathsep + env["NODE_PATH"] if env.get("NODE_PATH") else "")
11428
11428
  except Exception:
@@ -11552,10 +11552,10 @@ def _rag_s3_client(region: str, akid: str, secret: str):
11552
11552
 
11553
11553
 
11554
11554
  # PASTED IMAGES (task #284). The REPL sends "[Image #1: <file>]" in the message text (the API
11555
- # passes text only); the file is in ~/.gonext/images, copied there at paste time. The CURRENT
11555
+ # passes text only); the file is in ~/.gu/images, copied there at paste time. The CURRENT
11556
11556
  # question's images are attached to the request for a Claude coder (the adapter turns them into
11557
11557
  # Anthropic image blocks); the model reads "[Image #1]". Older messages keep only the label —
11558
- # their images are not re-sent. Files are read from ~/.gonext/images and nowhere else: the
11558
+ # their images are not re-sent. Files are read from ~/.gu/images and nowhere else: the
11559
11559
  # marker is text, and text can be typed.
11560
11560
  _IMAGE_MARKER_RE = re.compile(r"\[Image #(\d+): ([^\]\n]+)\]")
11561
11561
  _MAX_TURN_IMAGES = 20
@@ -11564,7 +11564,7 @@ _MAX_TURN_IMAGES = 20
11564
11564
  def _take_image_markers(messages, images_dir=None):
11565
11565
  """Rewrite the markers in `messages` (in place). → the latest user message's image files,
11566
11566
  in order, as [(label, path)] — only files that exist inside the images folder."""
11567
- root = os.path.realpath(images_dir or os.path.join(os.path.expanduser("~"), ".gonext", "images"))
11567
+ root = os.path.realpath(images_dir or os.path.join(os.path.expanduser("~"), ".gu", "images"))
11568
11568
  last_user = max((i for i, m in enumerate(messages) if isinstance(m, dict) and m.get("role") == "user"),
11569
11569
  default=-1)
11570
11570
  found = []
@@ -11692,13 +11692,13 @@ def _image_coders():
11692
11692
  def _cloud_image_coders():
11693
11693
  """GH #528: the models the cloud list says take images — [{host, exact}].
11694
11694
 
11695
- From the cloud token table this job read (_CLOUD_LIMITS), else from ~/.gonext/image-models.json,
11695
+ From the cloud token table this job read (_CLOUD_LIMITS), else from ~/.gu/image-models.json,
11696
11696
  which the CLI writes from the same table: the CLI's Ctrl+V gate and this one stay the same list."""
11697
11697
  rows = [r for r in _CLOUD_LIMITS["rows"] if r.get("images") and r.get("host") and not r.get("regex")]
11698
11698
  if rows:
11699
11699
  return [{"host": r["host"], "exact": str(r["model"]).strip().lower()} for r in rows]
11700
11700
  try:
11701
- path = os.path.join(os.path.expanduser("~"), ".gonext", "image-models.json")
11701
+ path = os.path.join(os.path.expanduser("~"), ".gu", "image-models.json")
11702
11702
  with open(path, encoding="utf-8") as f:
11703
11703
  saved = json.load(f).get("coders") or []
11704
11704
  return [c for c in saved if isinstance(c, dict) and c.get("host") and c.get("exact")]
@@ -11916,8 +11916,8 @@ def run_agent_chat(cfg):
11916
11916
  return _ws_request_approval(worker_api_base, worker_api_key, _job_id, command, "", deadline_s=45)
11917
11917
  return _lsp_code_check(_lsp_cfg, _lsp_turn, rp, content, changed,
11918
11918
  _WS_ACTIVE or _default_ws_root(), ask=_ask, emit=_emit, log=_log)
11919
- # Skills and MCP servers (task #269). The worker scans ~/.gonext/skills, ~/.gonext/mcp.json and
11920
- # this folder's .gonext/skills + .mcp.json for every turn; none present = neither appears
11919
+ # Skills and MCP servers (task #269). The worker scans ~/.gu/skills, ~/.gu/mcp.json and
11920
+ # this folder's .gu/skills + .mcp.json for every turn; none present = neither appears
11921
11921
  # anywhere in the prompt. Names only here — a skill's body is read when it is used.
11922
11922
  import gu_skills as _skills_mod
11923
11923
  _skills = _skills_mod.clean_list(cfg.get("skills"))
@@ -12198,7 +12198,7 @@ def run_agent_chat(cfg):
12198
12198
  _boto3_ok = True
12199
12199
  except Exception: # noqa: BLE001
12200
12200
  _boto3_ok = False
12201
- # RAG storage backend (task #97): "local" keeps the index on disk under ~/.gonext,
12201
+ # RAG storage backend (task #97): "local" keeps the index on disk under ~/.gu,
12202
12202
  # PER-FOLDER, and needs NO S3 creds / boto3 — only the embedding server. "cloud" (default,
12203
12203
  # and what the web app always uses) stores it on the user's own S3 bucket via boto3. The
12204
12204
  # terminal REPL picks this per-folder and sends it as cfg.ragMode.
@@ -12283,12 +12283,12 @@ def run_agent_chat(cfg):
12283
12283
  coding_base_url, agent_base_url,
12284
12284
  )
12285
12285
  if _RAG_CLOUD_SYNC:
12286
- _store = "LOCAL (~/.gonext/rag, per-folder) + MIRRORED to your S3 bucket"
12286
+ _store = "LOCAL (~/.gu/rag, per-folder) + MIRRORED to your S3 bucket"
12287
12287
  elif _RAG_CLOUD_SYNC_WANTED:
12288
- _store = ("LOCAL (~/.gonext/rag, per-folder); cloud sync is ON but UNAVAILABLE "
12288
+ _store = ("LOCAL (~/.gu/rag, per-folder); cloud sync is ON but UNAVAILABLE "
12289
12289
  "(needs RAG AWS credentials + boto3) - staying local only")
12290
12290
  elif _RAG_LOCAL:
12291
- _store = "LOCAL (index under ~/.gonext/rag, per-folder)"
12291
+ _store = "LOCAL (index under ~/.gu/rag, per-folder)"
12292
12292
  else:
12293
12293
  _store = "cloud (S3)"
12294
12294
  _log(
@@ -12400,10 +12400,10 @@ def run_agent_chat(cfg):
12400
12400
  _WS_RUN_DENYLIST = _split_cmds(cfg.get("runDenylist"))
12401
12401
  # Active terminal workspace: the folder the `gu` REPL was launched from (sent as
12402
12402
  # payload.activeWorkspace = the terminal's cwd). download_file / unzip_file put their
12403
- # output HERE instead of the shared ~/.gonext/rag-work cache, so files land where the
12403
+ # output HERE instead of the shared ~/.gu/rag-work cache, so files land where the
12404
12404
  # user opened the terminal. Honoured for any real directory the user explicitly opened
12405
12405
  # the terminal in — these tools already write outside registered workspaces (to
12406
- # ~/.gonext), so this is not a new write boundary; the code-EDIT tools stay gated on
12406
+ # ~/.gu), so this is not a new write boundary; the code-EDIT tools stay gated on
12407
12407
  # _WS_ROOTS (registered workspaces) via _ws_write_allowed, unchanged.
12408
12408
  _WS_ACTIVE = ""
12409
12409
  _aw_raw = str(cfg.get("activeWorkspace") or "").strip()
@@ -12431,7 +12431,7 @@ def run_agent_chat(cfg):
12431
12431
  if _remote_ws:
12432
12432
  # HARD-DISABLE the workspace tools. Leaving them pointed at a scratch folder on THIS
12433
12433
  # machine let the agent "succeed" at work the user never asked for: observed live, a
12434
- # client asked for a folder and the agent created it under ~/.gonext/web-agent-work on
12434
+ # client asked for a folder and the agent created it under ~/.gu/web-agent-work on
12435
12435
  # the MODEL machine, then reported "Done ✅". Silently acting on the wrong filesystem
12436
12436
  # is worse than refusing — the user believes their folder changed when it did not.
12437
12437
  _WS_ROOTS = []
@@ -12565,7 +12565,7 @@ def run_agent_chat(cfg):
12565
12565
  all. A snapshot must REPLACE, not accumulate.
12566
12566
 
12567
12567
  Backend-agnostic on purpose: same mechanism either way, only the store differs —
12568
- local disk under ~/.gonext/rag, or the user's own S3 bucket (what the web app uses).
12568
+ local disk under ~/.gu/rag, or the user's own S3 bucket (what the web app uses).
12569
12569
  """
12570
12570
  import glob as _glob
12571
12571
  import os
@@ -13701,7 +13701,7 @@ def run_agent_chat(cfg):
13701
13701
  """
13702
13702
  # A FILE, read here (task #269 follow-up): "a PDF of this .txt file" used to be caught by
13703
13703
  # a keyword fast-path that rendered the REQUEST's own words. The same reach as
13704
- # read_text_file — registered workspaces, the terminal folder, ~/.gonext, the temp dir.
13704
+ # read_text_file — registered workspaces, the terminal folder, ~/.gu, the temp dir.
13705
13705
  if (path or "").strip():
13706
13706
  import os as _os_pdf
13707
13707
  try:
@@ -16618,7 +16618,7 @@ def run_agent_chat(cfg):
16618
16618
  """
16619
16619
  # SAME mechanism as rag_index (chunk -> embed -> shard + manifest) and the SAME
16620
16620
  # storage abstraction: ragMode decides where the JSON shards land — local disk
16621
- # under ~/.gonext/rag for the terminal, the user's own S3 bucket for the web app.
16621
+ # under ~/.gu/rag for the terminal, the user's own S3 bucket for the web app.
16622
16622
  # The only thing special here is the KEY: the folder path instead of a source URL.
16623
16623
  if not _RAG_AVAILABLE:
16624
16624
  msg = _rag_unavailable_msg()
@@ -17498,7 +17498,7 @@ def run_agent_chat(cfg):
17498
17498
  # what lets a server OUTLIVE this job process, and what lets a timeout
17499
17499
  # kill take the runner's whole child tree (npm's node child etc. — the
17500
17500
  # old subprocess.run timeout killed only the direct child, leaking it).
17501
- logs_dir = os.path.join(os.path.expanduser("~"), ".gonext", "run-logs")
17501
+ logs_dir = os.path.join(os.path.expanduser("~"), ".gu", "run-logs")
17502
17502
  os.makedirs(logs_dir, exist_ok=True)
17503
17503
  log_path = os.path.join(logs_dir, f"{_t.strftime('%Y%m%d-%H%M%S')}-{os.getpid()}.log")
17504
17504
  log_fh = open(log_path, "wb")
@@ -18062,7 +18062,7 @@ def run_agent_chat(cfg):
18062
18062
 
18063
18063
  # ASK FIRST (#150), the way Claude Code does: the first browser call of a turn asks the user
18064
18064
  # (Allow once / Always in this folder / No), unless this folder is on the "always" list in
18065
- # ~/.gonext/browser-allow.json. A "No" holds for the rest of the turn.
18065
+ # ~/.gu/browser-allow.json. A "No" holds for the rest of the turn.
18066
18066
  _browser_consent = {"ok": False, "no": False, "where": ""}
18067
18067
  import gu_gif as _gu_gif
18068
18068
  _gif = _gu_gif.GifRecorder() # GH #548: browser(action="record_start" … "record_stop")
@@ -18444,7 +18444,7 @@ def run_agent_chat(cfg):
18444
18444
  verdict = _mcp_mod.decide(allow, deny, server, tool_name, _ask)
18445
18445
  if verdict == "deny":
18446
18446
  return False, (f"MCP tool {server}/{tool_name} is blocked by a deny rule in "
18447
- "~/.gonext/mcp.json. Do not call it again; carry on without it.")
18447
+ "~/.gu/mcp.json. Do not call it again; carry on without it.")
18448
18448
  if verdict == "allow" or (server, tool_name) in _mcp_turn_allowed:
18449
18449
  return True, ""
18450
18450
  if not (_interactive_approval and _job_id and worker_api_base and worker_api_key):
@@ -18512,7 +18512,7 @@ def run_agent_chat(cfg):
18512
18512
  # logged; the text never is.
18513
18513
  _scaffold, _scaffold_version, _scaffold_source = _load_prompt_scaffold(worker_api_base, worker_api_key)
18514
18514
  # A LOCAL FILE IS USED SILENTLY — no line, no location (the user's call: "if it is on
18515
- # .gonext location, not say anything"). Only a BROKEN one speaks, and without the path.
18515
+ # .gu location, not say anything"). Only a BROKEN one speaks, and without the path.
18516
18516
  try:
18517
18517
  import yaml as _yaml
18518
18518
  import os as _os