@staff0rd/assist 0.928.0 → 0.930.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 +5 -0
- 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 +2 -2
- package/dist/commands/extension/extension/updates.json +2 -2
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +973 -777
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -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();})();
|