@gkoreli/ghx 2.3.2 → 2.4.1

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 (2) hide show
  1. package/README.md +53 -4
  2. package/package.json +7 -7
package/README.md CHANGED
@@ -67,6 +67,7 @@ you can `ls` and `jq`:
67
67
  traces.jsonl # OTel spans: session → turn → each tool call
68
68
  logs.jsonl # GenAI-convention message-content records
69
69
  metrics.jsonl # duration, token, report-size metrics
70
+ tier-decisions.jsonl # escalation policy evaluation per turn (which tier, why)
70
71
  ```
71
72
 
72
73
  Sessions persist, so follow-up questions on the same repo are cheaper and
@@ -168,7 +169,8 @@ diff and refuses to overwrite without `--force`.
168
169
  ### 3. Verify
169
170
 
170
171
  ```bash
171
- ghx sidecar doctor # checks token, network, ghx binary, and the ACP handshake
172
+ ghx sidecar doctor # token, network, ghx binary, ACP handshake, report sink
173
+ ghx sidecar doctor --live # also run a REAL one-prompt turn through the agent
172
174
  ```
173
175
 
174
176
  `doctor` fails fast with an actionable message if the configured agent cannot
@@ -178,6 +180,13 @@ matches the running ghx version — a stale sink binary would silently degrade
178
180
  structured reports to a text fallback, so doctor fails loudly with fix-it text
179
181
  instead.
180
182
 
183
+ `--live` goes one step further: the plain handshake stops at ACP *initialize*,
184
+ which passes even on setups where a real turn then fails (auth typically
185
+ resolves lazily at prompt time). `--live` runs a full `session/new` + one tiny
186
+ prompt turn through the configured agent and, on failure, prints the failing
187
+ **stage** and the agent's **stderr tail** — the deterministic way to diagnose a
188
+ machine where `ask` produces nothing (see [ADR-0033](docs/adr/0033-sidecar-out-of-box-agent-config.md)).
189
+
181
190
  ### 4. Ask
182
191
 
183
192
  ```bash
@@ -188,9 +197,13 @@ ghx sidecar ask --repo hono/hono "How does Hono implement middleware chaining, a
188
197
  Without it: **discovery** — "which repos/libraries do X" — the sidecar sweeps
189
198
  GitHub for candidates and reads into the top ones before claiming anything
190
199
  (see [ADR-0019.1](docs/adr/0019.1-discovery-tier.md)).
191
- - `--session <name>` is optional (defaults to a repo slug like `hono-hono`, or a
192
- question-derived slug for discovery asks printed so you can resume it); use
193
- it to keep parallel investigation threads apart.
200
+ - `--session <name>` is advanced: pin a specific session; normally omit ghx
201
+ routes each question to the right session for you
202
+ ([ADR-0030.1](docs/adr/0030.1-session-routing.md)). With `--repo` the
203
+ repo-slug session (like `hono-hono`) still stands; with neither flag the
204
+ daemon runs a deterministic cascade (explicit → repo mention in the question
205
+ → warm continuation → ledger overlap → new session) and reports the route it
206
+ chose: `session: hono-hono (routed: overlap 0.62, next 0.21)`.
194
207
  - `--json` prints an envelope — `{"report": {...}, "artifacts": {"sessionDir":
195
208
  "...", "traceId": "..."}}` — the validated report plus a pointer to the
196
209
  session's audit trail. Without it you get the answer plus compact verified /
@@ -207,6 +220,7 @@ session automatically and answer faster. A fresh question takes tens of seconds.
207
220
  ghx sidecar sessions list # all sessions
208
221
  ghx sidecar sessions show <session> # details + report history
209
222
  ghx sidecar sessions ledger <session> # the accumulated evidence ledger
223
+ ghx sidecar sessions reroute <s> <turn> <dest> # move a mis-routed turn; both ledgers rebuilt by replay
210
224
  ghx sidecar view [session] # spawn a local trace UI over the session's artifacts
211
225
  ghx sidecar view --list # sessions with turn/report counts
212
226
  ghx sidecar view --port 9000 # viewer UI port (default 8000)
@@ -220,6 +234,33 @@ most recent session. Everything it shows is the same file you can read by hand.
220
234
  Requires the viewer on PATH:
221
235
  `go install github.com/CtrlSpice/otel-desktop-viewer@latest`.
222
236
 
237
+ ### Troubleshooting
238
+
239
+ If an `ask` returns nothing useful, the failure is recorded, not lost
240
+ ([ADR-0033](docs/adr/0033-sidecar-out-of-box-agent-config.md)):
241
+
242
+ - **Per-session agent stderr.** The spawned agent's stderr is captured to
243
+ `~/.ghx/sessions/<session>/agent-stderr.log`. Under the always-on daemon it
244
+ no longer disappears into the daemon's own log. A failed turn also splices the
245
+ tail of that log — and its path — into the error the CLI prints.
246
+ - **Reproduce it deterministically.** `ghx sidecar doctor --live` runs a real
247
+ prompt turn and prints the failing stage plus the agent's stderr, even when the
248
+ plain handshake passes.
249
+ - **`this workspace has not been trusted`.** ghx already runs the agent in a
250
+ neutral, ghx-owned session directory (outside any git repo, no `.claude`
251
+ settings), so this warning should not appear. If it still does, the agent
252
+ picked up a git-repo workspace: trust it once (run the agent interactively
253
+ there and accept the dialog) or set
254
+ `projects["<dir>"].hasTrustDialogAccepted: true` in `~/.claude.json`. ghx will
255
+ never write that file for you.
256
+ - **"works from shell A, fails from shell B".** The daemon auto-spawns from the
257
+ **first** caller's environment, so a missing auth/proxy env var is a common
258
+ cause. `ghx sidecar sessions show <session>` lists the agent command, the
259
+ session's spawn cwd, and the **names** (never values) of the agent-relevant
260
+ environment variables present when it was created. If the wrong env was
261
+ inherited, `ghx sidecar daemon --stop` and re-run `ask` from a shell that has
262
+ the right variables.
263
+
223
264
  ### Delegating from a main agent (MCP)
224
265
 
225
266
  A main agent talks to the sidecar through a single MCP tool — one tool it cannot
@@ -343,6 +384,14 @@ before any clone; answers fall back to remote Tier-1 evidence — never a
343
384
  silent or faked Tier-2 result. `astgrep` follows grep parity: exit `1` with
344
385
  `[]` means the search ran and found nothing.
345
386
 
387
+ When the sidecar answers a question, escalation is never vibes: every turn
388
+ gets a declarative policy evaluation
389
+ ([ADR-0024.2](docs/adr/0024.2-escalation-policy.md)) over named observables
390
+ (question shape, exhausted searches, low-confidence remote-only reports),
391
+ recorded as a `ghx.tier.decision` span in `traces.jsonl`, a line in the
392
+ session's `tier-decisions.jsonl`, and `tierUsed` provenance on the report —
393
+ so "which tier answered and why" is always recomputable from the artifacts.
394
+
346
395
  ### Codemode
347
396
 
348
397
  Write JS programs that compose multiple operations in one round-trip. All
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gkoreli/ghx",
3
- "version": "2.3.2",
3
+ "version": "2.4.1",
4
4
  "description": "Agent-first GitHub code exploration. GraphQL batching, code maps, codemode TypeScript sandbox, MCP server.",
5
5
  "bin": {
6
6
  "ghx": "npm/bin/ghx"
@@ -28,11 +28,11 @@
28
28
  "node": ">=16"
29
29
  },
30
30
  "optionalDependencies": {
31
- "@gkoreli/ghx-darwin-arm64": "2.3.2",
32
- "@gkoreli/ghx-darwin-x64": "2.3.2",
33
- "@gkoreli/ghx-linux-arm64": "2.3.2",
34
- "@gkoreli/ghx-linux-x64": "2.3.2",
35
- "@gkoreli/ghx-win32-arm64": "2.3.2",
36
- "@gkoreli/ghx-win32-x64": "2.3.2"
31
+ "@gkoreli/ghx-darwin-arm64": "2.4.1",
32
+ "@gkoreli/ghx-darwin-x64": "2.4.1",
33
+ "@gkoreli/ghx-linux-arm64": "2.4.1",
34
+ "@gkoreli/ghx-linux-x64": "2.4.1",
35
+ "@gkoreli/ghx-win32-arm64": "2.4.1",
36
+ "@gkoreli/ghx-win32-x64": "2.4.1"
37
37
  }
38
38
  }