@staff0rd/assist 0.929.0 → 0.931.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.
- package/README.md +6 -1
- package/allowed.cli-reads +1 -0
- package/dist/allowed.cli-reads +1 -0
- package/dist/commands/extension/extension/background.js +1 -1
- package/dist/commands/extension/extension/content.js +29 -29
- package/dist/commands/extension/extension/docs.js +26 -26
- package/dist/commands/extension/extension/manifest.json +1 -1
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +829 -573
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -47,7 +47,7 @@ The user guide is an [Astro Starlight](https://starlight.astro.build/) site in i
|
|
|
47
47
|
- **Session status glyphs** — write `:status[running]` (or `verifying`, `waiting`, `done`, `error`, `stopped`) to show a session card's status glyph in the dashboard's colours, and `:badge[clone]` (or `harness`, `serving`, `node`) for a card badge.
|
|
48
48
|
- **Icons** — write `:icon[OpenInFull]` to show the icon a dashboard button uses. Add a new icon to the registry in `src/docs/starlight/renderIcon.ts`.
|
|
49
49
|
- **Coverage report** — `npx tsx src/docs/docsCoverage.ts --report` lists the commands, skills, config keys and routes no page covers, by kind. `verify:docs-coverage` fails when any item is covered by no page, so a new command, skill, config key or route needs docs before verify passes.
|
|
50
|
-
- **Screenshots** — each entry in the frontmatter's `screenshots` declares a `file`, `alt` and `route
|
|
50
|
+
- **Screenshots** — each entry in the frontmatter's `screenshots` declares a `file`, `alt` and either a `route` on the capture web server or a `url` on `https://github.com/` (a live page, logged out, with the browser extension's `content.js` injected and its `browser.*` APIs stubbed; a `script: <name>` action runs `docs/capture/github/<name>.js` in the page to stand in for what a logged-out page lacks), and optionally `viewport` (default 1280×800), `theme`, `waitFor` and `crop` selectors, a `scene` (a named list of setup steps in `docs/capture/scenes.json`), `setup` steps run after the scene, and `actions` (`click: <selector>`, `press: <key>`, `type: <text>`, `drag: { from: <selector>, to: <selector> }`) performed on the page before capture, and `highlight` (a list of selectors; every match is outlined in the capture to point the reader at it). Setup steps: `assist: [args]` runs an assist command in the sandbox, `run: <name>` starts a run session from `docs/capture/assist.yml`, and `session: { repo, prompt, title?, reply?, status? }` starts an agent session in the `sandbox`, `api` or `website` repo and sets its status (`running`, `waiting` or `done`). `openPr: { repo, number, title, author? }` gives the repo an open pull request: the capture also puts a fake `gh` (`docs/capture/bin/gh`) on the `PATH`, which answers `gh pr list` and `gh pr view` with it and fails every other call. `gh: { match, json }` makes that fake `gh` print `json` for any call whose arguments contain every string in `match`, with each `"{{ago:<n><m|h|d>}}"` in it replaced by the ISO time that long ago. `sql: <statements>` runs SQL against the capture database, and `newsFeed: { name, title, items }` serves an RSS feed of `{ title, hoursAgo, excerpt? }` items locally and adds it with `assist news add`. Between states the capture also restores `~/.assist.yml` and empties the backlog, backups and usage tables. Preview steps open a preview pane on the session started with the step's `session` prompt and hold it open until the state changes: `preview: { session, kind: ask|show, title, body }`, `pr: { session, title, what, why, how?, resolves?, prNumber?, draft? }`, `proposal: { session, item }` (an `assist backlog propose` payload) and `highLevelReview: { session, prNumber, title, headRef, body, linkedIssues?, criticalPaths?, uiPaths?, files }`, where each file is `{ path, status, content?, patch? }` and an added file's patch is built from its `content`. The capture puts a fake `claude` (`docs/capture/bin/claude`) on the `PATH`, which prints the step's `reply` lines as its transcript and answers title generation with its `title`, so no real harness runs. Screenshots sharing a scene and setup are captured together, and the sessions are drained before the next state is set up. Without a `theme`, it is captured as `<file>` (light) and `<file>-dark.png`, and the site shows the one matching the theme the reader picked. A `::screenshot{file="<file>"}` line in the page places it; a declared screenshot with no such line, or a line naming an undeclared one, fails the build.
|
|
51
51
|
- **Recapture** — `npm run docs:capture [-- <file.png>...] [--skip-build] [--keep-home]` builds assist, starts a throwaway Postgres container (Docker required), clones `staff0rd/sandbox` (plus local `api` and `website` repos) into a temporary `HOME`, runs the real daemon and web server there on a free port, captures the screenshots with Playwright (`npx playwright install chromium` once) and tears everything down. Commit the changed PNGs.
|
|
52
52
|
- **Preview** — `npm run docs:build` builds the site into `docs/dist/`, and `npm run docs:preview` runs the Astro dev server on port 4173, replacing any dev server already running for the checkout, which reloads open tabs as pages change; a tab with a feedback popover open reloads once the popover closes. Set `DOCS_BASE_PATH=<path>` to build for a site hosted under a sub-path. The server restarts itself when a page is added or removed, a page's `group` or `order` changes, a screenshot PNG is added or removed, or code under `src/docs/` or `docs/capture/scenes.json` changes. A page whose frontmatter fails validation shows the error in the browser instead of its last valid copy.
|
|
53
53
|
- **Feedback** — start the `docs` run entry (a `server: docs` run of `docs:preview` on port 4173) from the dashboard and open the preview in Firefox with the [assist browser extension](#docs-feedback) installed. Select text on a page with the mouse, and a prompt popover opens at the end of the selection with its textbox focused; type a prompt and press **Enter**: it arrives as a user prompt naming the page id, section heading and source `.md` file, with the selected text quoted, in the live Claude session that shares the docs server's directory — the one the run is grouped under on the dashboard. With several such sessions, the one that most recently wrote that page (else the newest) gets it; with none, the live session that most recently wrote the page or anything under `docs/src/`.
|
|
@@ -345,6 +345,7 @@ Rules are `- **<code>** — **<title>** — <text>` bullets, the title optional,
|
|
|
345
345
|
- `assist netcap [-p, --port <port>] [-o, --out <dir>] [-f, --filter <pattern>]` - Capture browser network traffic under `--out` (default `~/.assist/netcap`), paired with the [netcap browser extension](#netcap-browser-extension)
|
|
346
346
|
- `assist netcap extract-linkedin-posts [file]` - Parse a netcap capture into structured LinkedIn posts
|
|
347
347
|
- `assist extension [--sign] [--url]` - Locate the [assist browser extension](#assist-browser-extension) to load unpacked; `--sign` signs it for a permanent Firefox install; `--url` prints the latest signed build's download URL
|
|
348
|
+
- `assist browser status [--url <substring>] [--server <url>]` - Through the [browser link](#browser-link), print the connected extension's version, the target tab's URL and whether the assist content script runs there; `--url` targets the most recently active tab whose URL contains the substring instead of the focused window's active tab; `--server` is the web server the extension connects to (default `http://localhost:3100`)
|
|
348
349
|
- `assist screenshot <process>` - Capture a screenshot of a running application window (`screenshot.outputDir`, default `./screenshots`)
|
|
349
350
|
- `assist mermaid export [file.md]` - Render each fenced mermaid block to SVG via [Kroki](https://kroki.io) (`--out`, `--index`, `mermaid.krokiUrl`)
|
|
350
351
|
- `assist prompts` - Show the most frequently denied tool calls
|
|
@@ -592,6 +593,10 @@ In a clone whose remote is on Azure DevOps, `assist prs list-comments`, `fixed`,
|
|
|
592
593
|
|
|
593
594
|
Sending is Firefox-only (it relies on the `browser.*` promise APIs). The web server URL is set on the extension's options page (**about:addons** → the extension → **Options**) and defaults to `http://localhost:3100`. `host_permissions` covers any port on `localhost` and `127.0.0.1`; another host relies on the endpoint's CORS.
|
|
594
595
|
|
|
596
|
+
### Browser link
|
|
597
|
+
|
|
598
|
+
The background script keeps a websocket open to the options page's web server at `/ws/browser`, which accepts only `moz-extension://` and `chrome-extension://` origins, and says hello with the extension's version. It reconnects 5s after the socket drops, and a 30s `alarms` alarm wakes a suspended event page to reconnect, so a web server restart or suspension needs no browser restart. `assist browser` commands POST to `/api/browser`, which refuses any request carrying an `Origin` header, relays the request to the extension and waits 10s for its reply. While no extension is connected but one was seen in the last 90s (or the web server started that recently), the relay waits up to 35s for it to reconnect before answering that none is connected. The background script resolves the target tab and only acts on tabs on the assist content scripts' hosts (`github.com`, `dev.azure.com`, `*.visualstudio.com`, `localhost`, `127.0.0.1`); any other tab gets an error naming its URL.
|
|
599
|
+
|
|
595
600
|
### Docs feedback
|
|
596
601
|
|
|
597
602
|
`npm run docs:preview` stamps each page with `<meta name="assist-docs-page">` (the page id), `assist-docs-title` and `assist-docs-source` (its title and `.md` file, used as the section for a selection in the page title or the text before the first heading) and marks each section with `data-docs-heading` and `data-docs-source` (its `.md` file); `docs:build` output carries none of these. The `docs.js` content script runs on any `localhost` / `127.0.0.1` page but only activates on one with the page meta. Selecting text inside a section with the mouse opens the same prompt popover straight away, anchored at the end of the selection with its textbox focused (keyboard selections open nothing), and **Enter** sends a non-empty prompt. Ctrl/Cmd+C in the empty textbox copies the selected page text. Clicking away closes an empty popover, but one with a typed draft stays open — ignoring new selections — until **Esc** or a successful send. The background script POSTs `{ pageId, heading, source, selection, prompt }` to `POST /api/sessions/docs-feedback`, which asks the daemon (`type-prompt-to-writer`) to paste the prompt into the live agent session whose working directory matches a live server run's directory that contains `source`, and submit it. Ties go to the session whose Claude transcript has the newest Write/Edit of `source`, else the newest session; with no such session it falls back to the newest writer of `source`, else of any file under `docs/src/`. A toast names the session, or reports a 404 when no session qualifies.
|
package/allowed.cli-reads
CHANGED
package/dist/allowed.cli-reads
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(()=>{function u(s){let{type:e,pageId:
|
|
1
|
+
"use strict";(()=>{function m(){return globalThis.browser?.storage?.local}function w(s){let e;try{e=new URL(s.trim())}catch{return}if(!(e.protocol!=="http:"&&e.protocol!=="https:"))return e.origin}var _="http://localhost:3100",c="serverUrl";async function u(){let e=(await m()?.get(c).catch(()=>{}))?.[c];return typeof e=="string"&&w(e)||_}function d(){let s=globalThis.browser;return s?.runtime&&s.tabs?s:void 0}var O=new Set(["localhost","127.0.0.1"]);function b(s){if(!s)return!1;let e;try{e=new URL(s)}catch{return!1}let{protocol:r,hostname:t}=e;return r==="http:"?O.has(t):r!=="https:"?!1:t==="github.com"||t==="dev.azure.com"||t.endsWith(".visualstudio.com")}function y(s){return s.reduce((e,r)=>!e||(r.lastAccessed??0)>(e.lastAccessed??0)?r:e,void 0)}function k(s,e,r){if(r)return y(s.filter(n=>n.url?.includes(r)));let t=s.filter(n=>n.active);return t.find(n=>n.windowId===e)??y(t)}var R="assist-browser-probe",S="/ws/browser";var U="github.com, dev.azure.com, *.visualstudio.com, localhost, 127.0.0.1";async function A(s){let e=d();if(!e)return{ok:!1,error:"browser tabs API unavailable"};let[r,t]=await Promise.all([e.tabs.query({}),e.windows?.getLastFocused().catch(()=>{})]),n=k(r,t?.id,s.url);if(!n||n.id===void 0)return{ok:!1,error:s.url?`no open tab has a URL containing "${s.url}"`:"no active tab found"};let o=n.url;if(!o||!b(o))return{ok:!1,tabUrl:o,error:`the target tab is not on an assist host (${U})`};let f=await e.tabs.sendMessage(n.id,{type:R,op:s.op}).then(a=>a?.running===!0).catch(()=>!1);return{ok:!0,result:{tabUrl:o,contentScript:f}}}var h="assist-browser-link",F=5e3,i,l;function v(){let s=d();s&&(s.alarms?.create(h,{periodInMinutes:.5}),s.alarms?.onAlarm.addListener(e=>{e.name===h&&g()}),s.storage?.onChanged.addListener(e=>{c in e&&i?.close()}),g())}function g(){l||i&&i.readyState<=WebSocket.OPEN||(l=D().finally(()=>{l=void 0}))}async function D(){let s=await u(),e=new WebSocket(`${s.replace(/^http/,"ws")}${S}`);i=e,e.addEventListener("open",()=>B(e,{type:"hello",version:d()?.runtime.getManifest().version??"unknown"})),e.addEventListener("message",r=>{q(e,r.data)}),e.addEventListener("close",()=>{i===e&&(i=void 0,setTimeout(g,F))})}async function q(s,e){let r;try{r=JSON.parse(String(e))}catch{return}if(r.type!=="request")return;let t=await A(r).catch(n=>({ok:!1,error:n instanceof Error?n.message:String(n)}));B(s,{...t,type:"response",id:r.id})}function B(s,e){s.readyState===WebSocket.OPEN&&s.send(JSON.stringify(e))}function x(s){let{type:e,pageId:r,prompt:t}=s??{};return e==="assist-docs-feedback"&&typeof r=="string"&&typeof t=="string"}async function p(s,e,r){let t;try{t=await fetch(`${s}${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})}catch{return{ok:!1,message:`assist web server unreachable at ${s}`}}let n=await t.json().catch(()=>({}));return t.ok?{ok:!0,data:n}:{ok:!1,message:n.error??`assist web server returned ${t.status}`}}async function M(s,{type:e,...r}){let t=await p(s,"/api/sessions/docs-feedback",r);return t.ok?{ok:!0,message:t.data.message??"Sent to the docs session"}:t}var W={draft:["draft","--once"],bug:["bug","--once"]};function T(s){return typeof s=="string"&&Object.hasOwn(W,s)}function E(s){let{type:e,url:r,args:t,mode:n}=s??{};return e==="assist-send"&&typeof r=="string"&&(t===void 0||Array.isArray(t)&&t.every(o=>typeof o=="string"))&&(n===void 0||T(n))}function L(){return globalThis.browser?.runtime}async function P(s,{url:e,instructions:r,args:t,mode:n}){let[o,f]=t?["review-from-github",{url:e,args:t}]:["from-github",{url:e,instructions:r,mode:n}],a=await p(s,`/api/sessions/${o}`,f);return a.ok?{ok:!0,message:`assist session started in ${a.data.cwd}`}:a}function I(){L()?.onMessage.addListener(s=>{if(E(s))return u().then(e=>P(e,s));if(x(s))return u().then(e=>M(e,s))})}I();v();})();
|