Files
AgentHub/client/src/lib/openInChanges.ts
T
nntrivi2001 fa156d6a59 feat: v2.6.0 — Chat UI composer (+ menu, project files, activity panel, permission mode, Stop), git on a workspace's extra folders (#70), long paste as a file (#68), S3 server mode (experimental)
Chat UI:
- Each Claude/Codex session keeps its own chat/terminal view; Settings only
  sets how new sessions open.
- Composer + menu: upload, project files and folders (#54, also dragged from
  the Files/Changes tree), context files, recent uploads, skills, plugins.
- Activity side panel (progress, outputs, files read, uploads, memory,
  skills, connectors) with a file preview; edited-file counts per turn.
- Permission-mode chip (Shift+Tab steps, read back from the pane:
  server/lib/pane-mode.js, GET|POST /api/run/:id/permission-mode).
- Stop (Esc) while the main agent works; the status is checked per agent
  (with session_id /api/agents ignores its status filter) and re-read every
  5 s while Stop shows.
- Dropped images shown in the conversation (GET /api/run/drop/:name, the
  requester's own drop dir), full-size viewer.
- A plain-text paste over 5,000 characters is attached as pasted-text.txt,
  so no prompt reaches tmux/argv limits (#68).

Changes panel: every /api/lanes/:id/git* route takes ?source=<lane_sources
id> (sourceFolder; ENOSOURCE otherwise) and a folder picker switches the
whole panel to a workspace's extra folder (#70).

Server mode S3 (one Linux user per account) — experimental, verified with
fake sudo plus a P6 managed-settings spike on a test account:
- member tmux listing runs in the background (cached, 15 s => unknown);
- transcript snapshot copy is async, chunked, temp file + rename;
- Express Layer patch only on Express 4;
- tmux capturePane/sendKey go to the member's own server.

Docs: the multi-user design moved in as docs/plans/server-mode/README.md
(the AgentHub-Server repo is gone); S3-PLAN P6 result; LANES/API/openapi.
2026-10-09 16:35:07 +07:00

24 lines
1.1 KiB
TypeScript

/**
* @file openInChanges.ts — asks the Workspace page to open a file in its
* Changes panel: a chat's "Edited N files" card names absolute paths deep in
* a pane, the panel lives on the page, so the request travels as a window
* event (like the sidebar's `LIVE_RUNS_EVENT`). The page opens the panel and
* that file there, if the panel shows the same workspace; else nothing.
* @author Nguyễn Ngọc Trí Vĩ <vinnt@smartgift.vn>
*/
export const OPEN_IN_CHANGES_EVENT = "agenthub:open-in-changes";
/** A file to open: its workspace, and its path relative to the panel's folder. */
export type OpenInChanges = { laneId: number; path: string };
/** Opens `path` (absolute) when it lies under `cwd`, the pane's folder — the
* folder the Changes panel reads for it. False when it does not. */
export function openInChanges(laneId: number, cwd: string, path: string): boolean {
const base = cwd.replace(/\/+$/, "");
if (!base || !path.startsWith(`${base}/`)) return false;
const detail: OpenInChanges = { laneId, path: path.slice(base.length + 1) };
window.dispatchEvent(new CustomEvent(OPEN_IN_CHANGES_EVENT, { detail }));
return true;
}