Cell - Ta Extensions
A built-in pi package for Ta (enabled by default, can be disabled in Settings → Extensions): tells users they can create extensions in natural language, handles sharing them, and provides a marketplace. Does not modify Ta's core—three components:
- Skills (
pi.skills,skills/ta-package): Ta creates and edits pi packages (pi extensions, web extensions, skills, prompt templates) based on user descriptions, and exports or imports extensions on request. The skills are also available in the terminal Ta; disabling this package removes them as well. - Web Extension (
pi.web,web-src/index.tsx→web/index.js): The "Extensions" page in the navigation bar with two tabs at the top: "Mine" and "Marketplace" (the page's top-right menu also opens the marketplace directly).- A header line explains that the effect takes place when the response ends. Below the input are example illustrations for four extension types: cards, pages, commands, and skills (
web-src/pictures.tsx; uses page CSS variables and follows the theme). Click one to see an example; submitted requests open a new session (openSession+switchSession) and send "Create an extension: ..." to Ta. - "My Extensions": packages in the
extensions/directory (created by Ta or imported from files), showing name, version, content tags, and description. The right side has a toggle (setPackageEnabled; disabled ones fade). Hover to reveal edit, export, and remove actions; editing asks how to change the package, then opens a new session for Ta. - "Installed Extensions": packages from the
packagessetting (npm or Git), with toggles. You can copy the source or remove them. - Import: use the button, the page's top-right menu, or drag files to the page. In the dialog, select a
.tgzfile or enter annpm:…/ Git address to install (installPackage, equivalent tota install). After import, install, or remove, callreloadExtensionsso the current session and page get the updates immediately. - "Share with Others": export → send .tgz file → they import. A three-step diagram shows this flow, with a note explaining that npm, Git sources, or telling Ta directly also work.
- "Marketplace" (
market-view.tsx,market-detail.tsx): npm packages with thepi-packagekeyword—the ones listed in pi's official package directory.- Search box (searches 300 ms after input stops) and a few popular topics. Without keywords, lists by npm's combined ranking (download volume dominates); scrolling to the bottom auto-loads the next page.
- Each card shows an avatar from the first letter of the name (same name, same color), name (scope faded), author, monthly downloads, description, category tags, and publish date, with an "Install" button on the right: one-click install as user-level
npm:<name>(installPackage, unpinned version, updatable withta update). A loading spinner appears during install; "Installed" shows when done; built-in extensions show "Built-in". Installation continues if you leave the page. - Click a card to see its detail page (
Escor "Back" returns to the list, scroll position preserved): avatar, name, description, author/version/downloads/license/date, install or remove, npm/source/homepage links, previews frompi.video/pi.image, and README.
- A header line explains that the effect takes place when the response ends. Below the input are example illustrations for four extension types: cards, pages, commands, and skills (
- Server (
pi.host,web-src/host.ts→host/index.mjs): the page calls it viacallHost(TaPackageServer.callPackageHost).exportPackage(id): packs a package directory into a.tgzfile (gzip tar, top level is the package, skipsnode_modules,.git, and symlinks), sends it to the page as base64 for download. The format is the same astar -czf <name>.tgz <name>, so it can be unpacked withtarwithout Ta.searchMarket(query, from?),marketPackage(name)(market.ts): queries npm on the server (packages are installed there). Results are cached for 5 minutes; identical requests are deduplicated. Search uses/-/v1/search?text=<term> keywords:pi-package. Npm still ranks allpi-packagepackages below relevant results, so this filters to keep only packages with the term in their name, description, or keywords, stopping at the first irrelevant result. The detail doesn't fetch npm's entire package doc (frequently-updated packages can be tens of MB)—just the/<name>/latestmanifest and last month's downloads. The README is first fetched from jsDelivr for the published version; if not found, fetches from GitHub. HTML images, links, and headings in READMEs are converted to Markdown (Ta's Markdown doesn't render HTML), badges removed, relative links point to the GitHub repo.importPackage(data, overwrite?): validates the file (single top-level directory, containspackage.json, paths don't escape, at most 5000 files and 20 MB; skips symlinks and macOS tar's._*files), places it inextensions/<package-name-without-scope>in the agent directory, and pi loads it without configuration. Returnsexistsif a directory with the same name already exists; the page asks the user and retries withoverwrite. Writes to a hidden temporary directory first, then swaps it in, so the session won't load a half-written file. Packages output bynpm pack(with top-levelpackage/) can also be imported.
Limitations
- Export and import require
ta serve(both page and server run insideta serve). When runningtaalone, follow the skill's instructions to have Ta usetarandta install. - Extensions imported from files are placed only in the user's
extensions/. To use one in a project, place the directory in the project's.ta/extensions/and commit it. - Extensions run code on this machine. Before importing extensions from others, the page warns to only import from trusted sources, and the skill asks Ta to review it first and explain what it does. Marketplace installs are one-click (no approval prompts, following pi's practice); you can view the intro and source code at the bottom of the list or in the detail page.
- The marketplace only recognizes the official npm registry (search, manifests, and download counts at registry.npmjs.org). READMEs depend on jsDelivr or GitHub. If either is unreachable, the page shows why and offers "Retry"; this doesn't affect already-installed extensions. Installation still uses pi's npm, respecting your npm config.
- Most npm data is in English; Chinese searches won't find everything. Topic buttons use English keywords.