@khanglvm/relay 0.23.1 → 0.23.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.
package/docs/AGENT.md CHANGED
@@ -849,7 +849,9 @@ call rather than calling it repeatedly in a loop.
849
849
 
850
850
  - Prefer `--detach` + `rly wait` if your shell tool kills long commands.
851
851
  - Don't pass `--no-open` for real users — the browser tab opening *is* the
852
- notification. Use it only in tests.
852
+ notification. Use it only in tests. Under T3 Code or Sushi, Relay already
853
+ skips the tab, because the person reads the board from another device.
854
+ Give them the printed URL.
853
855
  - Quote JSON carefully; prefer writing a spec file or piping via `--file -`.
854
856
  - Use stable `id`s on questions so your follow-up logic reads clean keys.
855
857
  - `rly result <id>` while a board is open returns the live draft — useful to
package/docs/SETUP.md CHANGED
@@ -75,6 +75,13 @@ charts and diagrams and loads them only when a board needs them. Local
75
75
  file links open referenced paths in the default app; `RLY_OPEN_CMD` overrides
76
76
  the opener.
77
77
 
78
+ A new board opens in this machine's browser, except under an agent host the
79
+ person drives from another device: T3 Code (`T3CODE_THREAD_ID` or
80
+ `T3CODE_HOME` set) or Sushi (`SUSHI_BOT_ID` or `SUSHI_HOME` set). There the
81
+ board shows in the host app and through the printed URL. `RLY_OPEN=1` or
82
+ `RLY_OPEN=0` sets the default either way, and `--open` or `--no-open` decides
83
+ for one board.
84
+
78
85
  ## Migration from quest-board
79
86
 
80
87
  relay was formerly `@khanglvm/quest-board` (CLI: `qbd`) — that package is
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@khanglvm/relay",
3
- "version": "0.23.1",
3
+ "version": "0.23.2",
4
4
  "description": "Question boards with rich blocks (markdown, charts, mermaid, tables, code, diffs, video, sandboxed HTML), clickable local file-links, and element-level annotations for AI coding agents (Claude Code, Codex, …): ask users structured questions, present interactive visuals, collect inline comments, read answers as JSON — in a local browser board OR rendered INLINE inside the Claude & Codex apps as an MCP App (SEP-1865).",
5
5
  "keywords": [
6
6
  "ai-agents",
package/src/cli/help.js CHANGED
@@ -79,7 +79,8 @@ USAGE
79
79
 
80
80
  COMMON FLAGS
81
81
  --title <s> --intro <s> --html-file <f> --height <px> --submit-label <s>
82
- --timeout <sec> (default 86400; 0 = none) --port <n> --no-open --detach --display-only
82
+ --timeout <sec> (default 86400; 0 = none) --port <n> --open | --no-open --detach --display-only
83
+ no browser tab by default under T3 Code or Sushi; $RLY_OPEN=1|0 sets the default
83
84
  --devlink | --no-devlink | --public-url <url> where the board link points (see rly config link)
84
85
 
85
86
  EXIT CODES 0 submitted/acknowledged · 2 timeout · 3 cancelled · 4 usage · 5 not found
package/src/cli/io.js CHANGED
@@ -4,6 +4,7 @@ import fs from 'node:fs';
4
4
  import path from 'node:path';
5
5
  import { envFileRoots, expandHome } from '../file-access.js';
6
6
  import { linkSetting, loadConfig, serializeLink } from '../link.js';
7
+ import { autoOpenDefault } from '../open.js';
7
8
  import { runBoard } from '../server/index.js';
8
9
  import { assertSpecReady, questionFromInline } from '../spec/index.js';
9
10
  import { HOME, loadBoard, loadRunning, saveBoard, saveResultFile } from '../store.js';
@@ -158,7 +159,7 @@ export async function runOrDetach(record, args) {
158
159
  await assertSpecReady(record.spec);
159
160
  const timeoutSec = args.timeout !== undefined ? Math.max(0, Number.parseInt(args.timeout, 10) || 0) : DEFAULT_BOARD_TIMEOUT_SEC;
160
161
  const port = args.port !== undefined ? Number.parseInt(args.port, 10) || 0 : 0;
161
- const open = args.open !== false;
162
+ const open = args.open === true || (args.open !== false && autoOpenDefault());
162
163
  const link = linkSetting({ args, config: loadConfig(HOME) });
163
164
 
164
165
  // Push-wake: persist the agent's --on-result command on the record so BOTH
package/src/open.js CHANGED
@@ -7,6 +7,24 @@ import { spawn } from 'node:child_process';
7
7
  // RLY_OPEN_CMD overrides the platform opener with a custom command — the target
8
8
  // is passed as its sole argument ("$1"). Power users can point it at a chooser;
9
9
  // the test suite points it at a no-op so opening a file launches nothing.
10
+ // Agent hosts the person drives from another device (T3 Code, Sushi). A tab
11
+ // opened on this Mac lands on a screen nobody is watching, and the board is
12
+ // already in front of the person through the host's own view of it.
13
+ const REMOTE_AGENT_HOST_VARS = ['T3CODE_THREAD_ID', 'T3CODE_HOME', 'SUSHI_BOT_ID', 'SUSHI_HOME'];
14
+
15
+ /**
16
+ * Whether a new board opens in this machine's browser when the caller passed
17
+ * neither --open nor --no-open. RLY_OPEN (1/0, on/off, true/false, yes/no)
18
+ * decides when set; otherwise boards stay closed under a remote agent host.
19
+ * @param {NodeJS.ProcessEnv} [env]
20
+ */
21
+ export function autoOpenDefault(env = process.env) {
22
+ const forced = String(env.RLY_OPEN ?? '').trim().toLowerCase();
23
+ if (['1', 'on', 'true', 'yes'].includes(forced)) return true;
24
+ if (['0', 'off', 'false', 'no'].includes(forced)) return false;
25
+ return !REMOTE_AGENT_HOST_VARS.some((name) => env[name]);
26
+ }
27
+
10
28
  export function openUrl(url) {
11
29
  try {
12
30
  const custom = process.env.RLY_OPEN_CMD;