@celljs/ta-workspace
A pi package that comes with Ta: the workspace of the conversation shown, in the workbench beside it in the web client of ta serve, as the tools of an IDE.
| View | What it does |
|---|---|
| Explorer | The files of the conversation's directory, with the file icons of VS Code, the colors and letters of git (folders take the change inside them, ignored files are dimmed) and indent guides; it follows the tab shown. A click opens a file as a preview tab (the next preview takes its place), a double click keeps it: Markdown, HTML, images, videos, sounds and PDFs as a preview, the rest in Monaco (pi.ui.CodeEditor), saved with Ctrl+S or Cmd+S. New file and folder (a/b.ts makes the folders), rename and delete in place, with the checks of VS Code on names; a context menu with copy path and relative path, find in folder, upload files or a folder, and download (a folder as a zip made in the page); in Ta Desktop, reveal in Finder (File Explorer on Windows, the file manager on Linux) for directories of this machine (pi.ui.desktop). Drag an item onto a folder to move it there (a closed folder opens while it is held over it), files or folders of the system onto the tree to upload them, and an item onto the message box (an @ reference) or a terminal (its path) (pi.ui.fileDrag); the keys of a tree (arrows, Home/End, F2 or Enter on a Mac, Delete) |
| Open files | The tabs of files and changes this package opened, the one shown marked; close, close others, close below, reveal in the explorer |
| Search | Text in the files (ripgrep, git grep or grep, whichever the machine has): match case, whole word, a regular expression (its error shown), files to include and to exclude (globs separated by commas, a folder takes all inside it); each match of a line is a result, which opens the file selected on it. Replace one, in a file or all (with $1 for a group), the change shown on each result; dismiss results (a file or a folder); collapse and expand all; the results as a list or a tree of folders |
| Source control | The branch with what it is ahead and behind, a box for the commit message (Ctrl+Enter or Cmd+Enter; with nothing staged it offers to stage all), merge changes, staged changes and changes, as a list or a tree; stage, unstage and discard a file or a group (discarding asks; for an untracked file it deletes), pull, push and fetch. A change opens in Monaco's diff editor, side by side or inline, the unchanged lines folded; a change not staged can be edited there and saved |
| Terminal | Shells on the machine of the session, in one tab; the first opens with it; they survive a dropped connection for 30 s. Files dragged from the explorer are typed as their paths, quoted for the shell |
| Browser | A page in its tab, such as the dev server the agent started: back, forward, reload and the address in one bar, a line while the page loads; a start page with the addresses opened lately (remove one with its ×), or the ports dev servers take when there are none yet. A page of the origin of Ta itself runs without allow-same-origin, so it cannot reach the page or its token. In a directory of another machine (ssh://), a page of its localhost is that machine's: its port is opened on the machine of ta serve (pi.remote.forwardPort), and the bar keeps the address as typed. In Ta Desktop (pi.ui.supportsWebview) the page is a <webview> instead of a frame: sites cannot refuse it, signing in works and stays (a partition of its own), back and forward follow the page, the bar shows its title and icon and stops a load, a failed load or a crashed page says so with a retry, and the context menu, browser shortcuts and DevTools are the app's. There the agent works the same page with the browser tool (pi.ui.debugWebview): navigate, back, forward, reload; a snapshot of the accessibility tree whose elements carry refs; click, type, press, scroll; a screenshot (a data URL for codemode's image()); evaluate, wait, and any command of the DevTools protocol on the page. Refs hold for the page of the last snapshot only. The view comes up while the agent works it and the bar says so; text goes in without the keyboard focus, and a click or a key gives the focus back to where the user was typing. The start page offers to import sign-ins (pi.ui.desktop.browserData, macOS and Windows): the user picks a profile of Chrome, Edge, Brave, Arc, Vivaldi or Chromium, says yes in a dialog of the app, and its cookies come over; passwords and history do not. The same dialog clears the data of the browser |
Each view is a panel view of its web extension, opened from the + of the workbench or its empty state (pi.web of package.json); the work runs on the server through pi.workspace (listDirectory, readFile, writeFile, uploadFile, fileUrl, runCommand, …) and pi.terminals, in the execution environment of the directory, so a remote ta exec-server works the same. Search, source control and the changes to files are this package's: it runs rg (or git grep, or grep), git, mkdir, mv -n and rm with runCommand and reads their output; paths go to git as :(literal) pathspecs. Paths may not leave the directory. What the agent changes with its tools shows at once.
Files open in Monaco, which the page brings (pi.ui.CodeEditor, bundled with Ta, no network); Markdown, HTML, SVG open as a preview first, with Edit beside Preview. Previews load the file from TaWorkspaceServer.fileUrl: a page runs sandboxed in an origin of its own, Markdown (rendered with marked, bundled in) runs no scripts, and both load the files beside them with relative URLs. Diffs open in Monaco's diff editor (pi.ui.DiffEditor), terminals are xterm.js, as in VS Code (pi.ui.createTerminal: drawn with WebGL, in the theme of the page; Cmd or Ctrl + click opens the URLs and the paths of files they print, at the line a compiler or grep names). The file icons are the Seti icons VS Code shows by default (font and map from extensions/theme-seti of microsoft/vscode, MIT; bun scripts/seti.ts writes them again into web-src/util/seti*.ts). With script on the server a shell gets a pseudo-terminal; without it, it runs on pipes and the server echoes and edits the line.
Links of replies open here (pi.registerOpener): a file as its tab, with the lines the link names selected (src/a.ts#L10-L20, src/a.ts:10:5), even a file open with changes, which keeps them; a directory in the explorer, which switches to it; a page in the browser. Cmd or Ctrl + click opens a page in the browser of the system instead, which Ta does itself.
Turn it off in Settings → Packages.
Development
bun run build # tsc -b, then bun build web-src/index.tsx → web/index.js (one module, no imports)
bun run testThe web extension gets React from the page (web-src/react.ts) and icons from pi.ui.icons: it imports nothing at run time. To try it with an installed Ta, link the package into ~/.ta/agent/extensions/.