baychat 0.55.0 → 0.57.0

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 (42) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +7 -0
  3. package/dist/approval-wait.js +1 -1
  4. package/dist/bay-gone.js +35 -0
  5. package/dist/bay-mcp.js +22 -8
  6. package/dist/channel/launch.js +10 -3
  7. package/dist/channel/mcp-server.js +37 -0
  8. package/dist/channel/server.js +6 -20
  9. package/dist/claude-command.js +130 -0
  10. package/dist/claude-register.js +162 -0
  11. package/dist/claude-user-config.js +215 -0
  12. package/dist/codex-onboarding.js +16 -2
  13. package/dist/commands.js +22 -187
  14. package/dist/connect-claude.js +26 -5
  15. package/dist/connect-link-budget.js +2 -0
  16. package/dist/connect-link-check.js +96 -0
  17. package/dist/connect-link-setup.js +17 -0
  18. package/dist/connect-link.js +41 -34
  19. package/dist/doctor-claude-file.js +17 -0
  20. package/dist/doctor-command.js +3 -0
  21. package/dist/doctor-questions.js +22 -0
  22. package/dist/doctor.js +13 -12
  23. package/dist/notify-answer.js +53 -31
  24. package/dist/protocol-content.js +1 -1
  25. package/dist/quiet-claude-env.js +15 -0
  26. package/dist/refresh-clients.js +4 -6
  27. package/dist/relay/launcher/blocking-screen.fixtures.js +147 -0
  28. package/dist/relay/launcher/blocking-screen.js +68 -0
  29. package/dist/relay/launcher/dev-channel-screen.js +1 -1
  30. package/dist/relay/launcher/handle.js +3 -2
  31. package/dist/relay/launcher/loop.js +3 -0
  32. package/dist/relay/launcher/multiplexer.js +26 -0
  33. package/dist/relay/launcher/pane-watch.js +16 -0
  34. package/dist/relay/launcher/reset-time.js +82 -0
  35. package/dist/relay/launcher/session-watch-deps.js +116 -0
  36. package/dist/relay/launcher/session-watch.js +252 -0
  37. package/dist/runtimes.js +1 -3
  38. package/dist/tool-defs-boards.js +8 -0
  39. package/dist/tool-defs.js +6 -6
  40. package/dist/tool-hints.js +11 -5
  41. package/dist/waiting-cards.js +33 -3
  42. package/package.json +2 -2
@@ -16,7 +16,7 @@ exports.TOOL_HINTS = {
16
16
  get_file: INSIDE,
17
17
  list_agents: INSIDE,
18
18
  list_notes: INSIDE,
19
- get_note: INSIDE,
19
+ get_note: { ...INSIDE, visibleRead: true }, // people in the chat see that you read it (OpenAI's scan, 25 Nov)
20
20
  list_board_cards: INSIDE,
21
21
  list_file_comments: INSIDE,
22
22
  list_launch_targets: INSIDE,
@@ -44,13 +44,11 @@ exports.TOOL_HINTS = {
44
44
  join_session: INSIDE,
45
45
  create_group: INSIDE,
46
46
  submit_result: INSIDE, // a scheduled run's result
47
+ draw_flow: INSIDE, // an agent's draft flow (2.44, server-only)
47
48
  create_upload_url: INSIDE,
48
49
  // ── Writes that change something, nothing lost ───────────────────────────────────────────────────────────
49
- update_note: INSIDE, // every save adds a NoteVersion (note-write.service): the old text is kept
50
50
  move_board_card: INSIDE, // nothing lost; moving it back undoes it
51
51
  file_to_folder: INSIDE, // the file stays; filing it back undoes a move
52
- vote_in_poll: INSIDE, // only your own mark, which you can set again
53
- react_to_message: INSIDE, // only your own mark, which you can set again
54
52
  resolve_file_comment: INSIDE, // people can unresolve it; nothing lost
55
53
  set_typing: INSIDE,
56
54
  listen_messages: INSIDE, // opens this session's own feed
@@ -65,6 +63,9 @@ exports.TOOL_HINTS = {
65
63
  stage_done: INSIDE, // a person approves it or asks for a rewrite
66
64
  // ── Content lost, or an action that cannot be taken back ─────────────────────────────────────────────────
67
65
  update_board_card: LOSES, // overwrites fields; a to-do keeps no history
66
+ update_note: LOSES, // replaces the text people read; a NoteVersion keeps the old, but undo is no reason for false (OpenAI, 25 Nov)
67
+ vote_in_poll: LOSES, // changes a vote people see counted; setting it again is undo, which is no reason for false
68
+ react_to_message: LOSES, // a mark people see at once; setting it again is undo, which is no reason for false
68
69
  close_poll: LOSES, // no more votes, ever
69
70
  end_session: LOSES, // the session ends
70
71
  call_app_tool: { destructive: true, openWorld: true }, // writes in someone else's app
@@ -78,5 +79,10 @@ function toolAnnotations(name, access, title) {
78
79
  const hints = Object.hasOwn(exports.TOOL_HINTS, name) ? exports.TOOL_HINTS[name] : undefined;
79
80
  if (!hints)
80
81
  return null;
81
- return { title, readOnlyHint: access === "read", destructiveHint: access === "write" && hints.destructive, openWorldHint: hints.openWorld };
82
+ return {
83
+ title,
84
+ readOnlyHint: access === "read" && !hints.visibleRead,
85
+ destructiveHint: access === "write" && hints.destructive,
86
+ openWorldHint: hints.openWorld,
87
+ };
82
88
  }
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.markWaitingCard = markWaitingCard;
37
+ exports.sessionHasWaitingCard = sessionHasWaitingCard;
37
38
  exports.countWaitingCards = countWaitingCards;
38
39
  const fs = __importStar(require("fs"));
39
40
  const path = __importStar(require("path"));
@@ -54,14 +55,19 @@ const MARKER_MAX_AGE_MS = 2 * 24 * 60 * 60 * 1000;
54
55
  function markerDir() {
55
56
  return path.join((0, config_1.configDir)(), "waiting-cards");
56
57
  }
57
- /** Mark `cardId` as waited on by this process. Returns the function that ends the mark. Never throws. */
58
- function markWaitingCard(cardId, pid = process.pid) {
58
+ /**
59
+ * Mark `cardId` as waited on by this process. Returns the function that ends the mark. Never throws.
60
+ * `session` (the BayChat session the card is about) is the marker's content, so the relay's session
61
+ * watch (relay/launcher/session-watch.ts) can see a hook already has a card up for that session's
62
+ * terminal, and never puts a second card on the phone for the same question.
63
+ */
64
+ function markWaitingCard(cardId, pid = process.pid, session) {
59
65
  const safeId = cardId.replace(/[^A-Za-z0-9_-]/g, "").slice(0, 64) || "card";
60
66
  let file;
61
67
  try {
62
68
  file = path.join(markerDir(), `${pid}-${safeId}`);
63
69
  fs.mkdirSync(markerDir(), { recursive: true, mode: 0o700 });
64
- fs.writeFileSync(file, "");
70
+ fs.writeFileSync(file, session ?? "");
65
71
  }
66
72
  catch {
67
73
  // Without the marker an update might restart the relay mid-question; the card itself still
@@ -77,6 +83,30 @@ function markWaitingCard(cardId, pid = process.pid) {
77
83
  }
78
84
  };
79
85
  }
86
+ /** Is another live process (a hook) waiting on a card about `session` right now? Never throws. */
87
+ function sessionHasWaitingCard(session, isAlive = parent_watch_1.processIsAlive, now = Date.now(), ownPid = process.pid) {
88
+ if (!session)
89
+ return false;
90
+ let names;
91
+ try {
92
+ names = fs.readdirSync(markerDir());
93
+ }
94
+ catch {
95
+ return false;
96
+ }
97
+ return names.some((name) => {
98
+ const pid = Number(name.split("-")[0]);
99
+ if (!Number.isInteger(pid) || pid <= 1 || pid === ownPid || !isAlive(pid))
100
+ return false;
101
+ try {
102
+ const file = path.join(markerDir(), name);
103
+ return now - fs.statSync(file).mtimeMs < MARKER_MAX_AGE_MS && fs.readFileSync(file, "utf8") === session;
104
+ }
105
+ catch {
106
+ return false;
107
+ }
108
+ });
109
+ }
80
110
  /** How many cards live processes are waiting on. Stale markers are removed on the way. */
81
111
  function countWaitingCards(isAlive = parent_watch_1.processIsAlive, now = Date.now()) {
82
112
  let names;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baychat",
3
- "version": "0.55.0",
3
+ "version": "0.57.0",
4
4
  "description": "BayChat connector CLI — pair an agent session (Claude Code, Codex, Cursor) with BayChat, or have the relay run DeepSeek or the Cursor CLI for you",
5
5
  "bin": {
6
6
  "baychat": "dist/index.js"
@@ -47,7 +47,7 @@
47
47
  ],
48
48
  "dependencies": {
49
49
  "@agentclientprotocol/sdk": "1.4.0",
50
- "@modelcontextprotocol/sdk": "^1.29.0",
50
+ "@modelcontextprotocol/sdk": "1.32.2",
51
51
  "qrcode": "^1.5.4",
52
52
  "yaml": "^2.9.0",
53
53
  "zod": "^3.25 || ^4.0"