🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP →
Sign In

@github/copilot-linux-arm64

Package Overview
Dependencies
Maintainers
25
Versions
324
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@github/copilot-linux-arm64 - npm Package Compare versions

Comparing version
1.0.78-2
to
1.0.78-3
+108
builtin-skills/github-pr-media/SKILL.md
---
name: github-pr-media
description: Upload an image or video to GitHub's user attachments API and embed it in a pull request description or comment. Use when asked to add screenshots, diagrams, recordings, or other media to a PR or GitHub comment.
user-invocable: false
---
# GitHub PR Media Uploads
Use this skill when a workspace agent needs to attach screenshots, diagrams, or videos to a pull request description or comment.
## When to use it
- Adding before/after screenshots to explain a UI change
- Sharing a diagram that clarifies architecture or flow
- Attaching a short recording that makes behavior easier to review
- Turning a local media file into a GitHub-hosted URL that can be linked from markdown
Only use this when visuals genuinely improve reviewer understanding.
## Instructions
1. Put the real values in shell variables first, so the untrusted filename is never
pasted into the middle of another command. Set `TARGET` to the PR (or comment) you
were asked to update, and `REPO` to that target's `owner/repo` — do **not** assume
the current checkout is the right repository:
```bash
FILE='assets/dashboard.png' # path to the media file on disk
NAME="$(basename -- "$FILE")" # display name shown in the attachment
MIME='image/png' # actual MIME type (e.g. video/mp4 for video)
TARGET='https://github.com/OWNER/REPO/pull/123'
REPO='OWNER/REPO' # owner/repo that owns TARGET
```
Never build these from `$(...)` command substitution embedded in an untrusted
filename — assign the filename to `FILE` with single quotes, then reference `"$FILE"`.
2. Resolve the repository database id for `REPO`, failing loudly if the lookup does not
return a numeric id:
```bash
REPO_ID="$(gh api "repos/$REPO" --jq .id)" || { echo "repo lookup failed" >&2; exit 1; }
case "$REPO_ID" in ''|*[!0-9]*) echo "no repository_id for $REPO" >&2; exit 1;; esac
```
3. Upload the raw media bytes to GitHub. Everything untrusted stays inside a quoted
variable, and `--url-query` URL-encodes each value:
```bash
URL="$(curl --fail-with-body -sS -X POST \
"https://uploads.github.com/user-attachments/assets" \
--url-query "name=$NAME" \
--url-query "content_type=$MIME" \
--url-query "repository_id=$REPO_ID" \
-H "Content-Type: application/octet-stream" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Authorization: Bearer $(gh auth token)" \
--data-binary "@$FILE" | jq -r .url)"
case "$URL" in https://*) ;; *) echo "upload failed: $URL" >&2; exit 1;; esac
```
On GitHub Enterprise Server the upload host is not `uploads.github.com`; substitute
your instance's uploads host (the `uploadsUrl` for the configured `gh` endpoint).
4. `URL` now holds the hosted attachment link, which looks like:
```text
https://github.com/user-attachments/assets/...
```
5. Embed the hosted URL in markdown and **actually submit it** to the requested target —
showing the markdown is not enough, you must update the PR or comment:
```bash
# For a PR description: fetch, append, and write it back.
BODY="$(gh pr view "$TARGET" --repo "$REPO" --json body -q .body)"
printf '%s\n\n![%s](%s)\n' "$BODY" "$NAME" "$URL" \
| gh pr edit "$TARGET" --repo "$REPO" --body-file -
# For a new PR comment instead:
# gh pr comment "$TARGET" --repo "$REPO" --body "![$NAME]($URL)"
```
Use `![alt text](url)` for images. For video or other non-image media, paste the URL
on its own line (GitHub renders a player) or use a plain markdown link if that reads
better in context.
## Important details
- Send the file as raw binary bytes with `--data-binary "@$FILE"`. Do **not** use
multipart form uploads, base64 encoding, or JSON wrappers.
- Put `name`, `content_type`, and `repository_id` in the query string via `--url-query`,
which URL-encodes each value. Never interpolate them directly into the URL — a filename
with spaces, `&`, `#`, or other reserved characters would corrupt the request.
- Keep untrusted filenames inside quoted shell variables; never paste them into the body
of another command where shell metacharacters could be evaluated.
- `--url-query` needs curl >= 7.87 and `--fail-with-body` needs curl >= 7.76. On older
curl, encode the query manually and use `--fail --show-error` (which exits nonzero but
discards the error body).
- Always confirm a `https://` `url` came back before embedding it, so an expired token or
4xx/5xx response fails the task instead of silently succeeding.
- For videos, keep the same request shape and set `MIME` to the real video MIME type, for
example `video/mp4`.
## When not to use it
- Text-only changes where the diff already explains everything
- Cases where a simple markdown list or code snippet is clearer than an image
---
name: github-pr-media
description: Upload an image or video to GitHub's user attachments API and embed it in a pull request description or comment. Use when asked to add screenshots, diagrams, recordings, or other media to a PR or GitHub comment.
user-invocable: false
---
# GitHub PR Media Uploads
Use this skill when a workspace agent needs to attach screenshots, diagrams, or videos to a pull request description or comment.
## When to use it
- Adding before/after screenshots to explain a UI change
- Sharing a diagram that clarifies architecture or flow
- Attaching a short recording that makes behavior easier to review
- Turning a local media file into a GitHub-hosted URL that can be linked from markdown
Only use this when visuals genuinely improve reviewer understanding.
## Instructions
1. Put the real values in shell variables first, so the untrusted filename is never
pasted into the middle of another command. Set `TARGET` to the PR (or comment) you
were asked to update, and `REPO` to that target's `owner/repo` — do **not** assume
the current checkout is the right repository:
```bash
FILE='assets/dashboard.png' # path to the media file on disk
NAME="$(basename -- "$FILE")" # display name shown in the attachment
MIME='image/png' # actual MIME type (e.g. video/mp4 for video)
TARGET='https://github.com/OWNER/REPO/pull/123'
REPO='OWNER/REPO' # owner/repo that owns TARGET
```
Never build these from `$(...)` command substitution embedded in an untrusted
filename — assign the filename to `FILE` with single quotes, then reference `"$FILE"`.
2. Resolve the repository database id for `REPO`, failing loudly if the lookup does not
return a numeric id:
```bash
REPO_ID="$(gh api "repos/$REPO" --jq .id)" || { echo "repo lookup failed" >&2; exit 1; }
case "$REPO_ID" in ''|*[!0-9]*) echo "no repository_id for $REPO" >&2; exit 1;; esac
```
3. Upload the raw media bytes to GitHub. Everything untrusted stays inside a quoted
variable, and `--url-query` URL-encodes each value:
```bash
URL="$(curl --fail-with-body -sS -X POST \
"https://uploads.github.com/user-attachments/assets" \
--url-query "name=$NAME" \
--url-query "content_type=$MIME" \
--url-query "repository_id=$REPO_ID" \
-H "Content-Type: application/octet-stream" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Authorization: Bearer $(gh auth token)" \
--data-binary "@$FILE" | jq -r .url)"
case "$URL" in https://*) ;; *) echo "upload failed: $URL" >&2; exit 1;; esac
```
On GitHub Enterprise Server the upload host is not `uploads.github.com`; substitute
your instance's uploads host (the `uploadsUrl` for the configured `gh` endpoint).
4. `URL` now holds the hosted attachment link, which looks like:
```text
https://github.com/user-attachments/assets/...
```
5. Embed the hosted URL in markdown and **actually submit it** to the requested target —
showing the markdown is not enough, you must update the PR or comment:
```bash
# For a PR description: fetch, append, and write it back.
BODY="$(gh pr view "$TARGET" --repo "$REPO" --json body -q .body)"
printf '%s\n\n![%s](%s)\n' "$BODY" "$NAME" "$URL" \
| gh pr edit "$TARGET" --repo "$REPO" --body-file -
# For a new PR comment instead:
# gh pr comment "$TARGET" --repo "$REPO" --body "![$NAME]($URL)"
```
Use `![alt text](url)` for images. For video or other non-image media, paste the URL
on its own line (GitHub renders a player) or use a plain markdown link if that reads
better in context.
## Important details
- Send the file as raw binary bytes with `--data-binary "@$FILE"`. Do **not** use
multipart form uploads, base64 encoding, or JSON wrappers.
- Put `name`, `content_type`, and `repository_id` in the query string via `--url-query`,
which URL-encodes each value. Never interpolate them directly into the URL — a filename
with spaces, `&`, `#`, or other reserved characters would corrupt the request.
- Keep untrusted filenames inside quoted shell variables; never paste them into the body
of another command where shell metacharacters could be evaluated.
- `--url-query` needs curl >= 7.87 and `--fail-with-body` needs curl >= 7.76. On older
curl, encode the query manually and use `--fail --show-error` (which exits nonzero but
discards the error body).
- Always confirm a `https://` `url` came back before embedding it, so an expired token or
4xx/5xx response fails the task instead of silently succeeding.
- For videos, keep the same request shape and set `MIME` to the real video MIME type, for
example `video/mp4`.
## When not to use it
- Text-only changes where the diff already explains everything
- Cases where a simple markdown list or code snippet is clearer than an image
+3
-3

@@ -9,8 +9,8 @@ #!/usr/bin/env node

var Ve=Object.create;var M=Object.defineProperty;var Ue=Object.getOwnPropertyDescriptor;var je=Object.getOwnPropertyNames;var We=Object.getPrototypeOf,qe=Object.prototype.hasOwnProperty;var B=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(r,t)=>(typeof require<"u"?require:r)[t]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var E=(e,r)=>()=>{try{return r||e((r={exports:{}}).exports,r),r.exports}catch(t){throw r=0,t}};var Ge=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of je(r))!qe.call(e,o)&&o!==t&&M(e,o,{get:()=>r[o],enumerable:!(n=Ue(r,o))||n.enumerable});return e};var Ke=(e,r,t)=>(t=e!=null?Ve(We(e)):{},Ge(r||!e||!e.__esModule?M(t,"default",{value:e,enumerable:!0}):t,e));var X=E((Jr,z)=>{"use strict";var Y=()=>process.platform==="linux",C=null,Ze=()=>{if(!C)if(Y()&&process.report){let e=process.report.excludeNetwork;process.report.excludeNetwork=!0,C=process.report.getReport(),process.report.excludeNetwork=e}else C={};return C};z.exports={isLinux:Y,getReport:Ze}});var Z=E((Yr,Q)=>{"use strict";var y=B("fs"),er="/usr/bin/ldd",rr="/proc/self/exe",P=2048,tr=e=>{let r=y.openSync(e,"r"),t=Buffer.alloc(P),n=y.readSync(r,t,0,P,0);return y.close(r,()=>{}),t.subarray(0,n)},nr=e=>new Promise((r,t)=>{y.open(e,"r",(n,o)=>{if(n)t(n);else{let i=Buffer.alloc(P);y.read(o,i,0,P,0,(s,c)=>{r(i.subarray(0,c)),y.close(o,()=>{})})}})});Q.exports={LDD_PATH:er,SELF_PATH:rr,readFileSync:tr,readFile:nr}});var re=E((zr,ee)=>{"use strict";var or=e=>{if(e.length<64||e.readUInt32BE(0)!==2135247942||e.readUInt8(4)!==2||e.readUInt8(5)!==1)return null;let r=e.readUInt32LE(32),t=e.readUInt16LE(54),n=e.readUInt16LE(56);for(let o=0;o<n;o++){let i=r+o*t;if(e.readUInt32LE(i)===3){let c=e.readUInt32LE(i+8),h=e.readUInt32LE(i+32);return e.subarray(c,c+h).toString().replace(/\0.*$/g,"")}}return null};ee.exports={interpreterPath:or}});var Ee=E((Xr,ve)=>{"use strict";var ne=B("child_process"),{isLinux:b,getReport:oe}=X(),{LDD_PATH:L,SELF_PATH:ie,readFile:w,readFileSync:I}=Z(),{interpreterPath:se}=re(),u,f,d,ae="getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",m="",ce=()=>m||new Promise(e=>{ne.exec(ae,(r,t)=>{m=r?" ":t,e(m)})}),le=()=>{if(!m)try{m=ne.execSync(ae,{encoding:"utf8"})}catch{m=" "}return m},p="glibc",ue=/LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i,g="musl",ir=e=>e.includes("libc.musl-")||e.includes("ld-musl-"),fe=()=>{let e=oe();return e.header&&e.header.glibcVersionRuntime?p:Array.isArray(e.sharedObjects)&&e.sharedObjects.some(ir)?g:null},de=e=>{let[r,t]=e.split(/[\r\n]+/);return r&&r.includes(p)?p:t&&t.includes(g)?g:null},pe=e=>{if(e){if(e.includes("/ld-musl-"))return g;if(e.includes("/ld-linux-"))return p}return null},me=e=>(e=e.toString(),e.includes("musl")?g:e.includes("GNU C Library")?p:null),sr=async()=>{if(f!==void 0)return f;f=null;try{let e=await w(L);f=me(e)}catch{}return f},ar=()=>{if(f!==void 0)return f;f=null;try{let e=I(L);f=me(e)}catch{}return f},cr=async()=>{if(u!==void 0)return u;u=null;try{let e=await w(ie),r=se(e);u=pe(r)}catch{}return u},lr=()=>{if(u!==void 0)return u;u=null;try{let e=I(ie),r=se(e);u=pe(r)}catch{}return u},ge=async()=>{let e=null;if(b()&&(e=await cr(),!e&&(e=await sr(),e||(e=fe()),!e))){let r=await ce();e=de(r)}return e},he=()=>{let e=null;if(b()&&(e=lr(),!e&&(e=ar(),e||(e=fe()),!e))){let r=le();e=de(r)}return e},ur=async()=>b()&&await ge()!==p,fr=()=>b()&&he()!==p,dr=async()=>{if(d!==void 0)return d;d=null;try{let r=(await w(L)).match(ue);r&&(d=r[1])}catch{}return d},pr=()=>{if(d!==void 0)return d;d=null;try{let r=I(L).match(ue);r&&(d=r[1])}catch{}return d},ye=()=>{let e=oe();return e.header&&e.header.glibcVersionRuntime?e.header.glibcVersionRuntime:null},te=e=>e.trim().split(/\s+/)[1],be=e=>{let[r,t,n]=e.split(/[\r\n]+/);return r&&r.includes(p)?te(r):t&&n&&t.includes(g)?te(n):null},mr=async()=>{let e=null;if(b()&&(e=await dr(),e||(e=ye()),!e)){let r=await ce();e=be(r)}return e},gr=()=>{let e=null;if(b()&&(e=pr(),e||(e=ye()),!e)){let r=le();e=be(r)}return e};ve.exports={GLIBC:p,MUSL:g,family:ge,familySync:he,isNonGlibcLinux:ur,isNonGlibcLinuxSync:fr,version:mr,versionSync:gr}});import $r from"node:module";import{dirname as Dr,join as Mr}from"node:path";import*as Be from"node:sea";import{fileURLToPath as Br,pathToFileURL as k}from"node:url";import{basename as hr,join as N}from"node:path";var V="0.0.1";import{readdir as Je,access as Ye,constants as ze}from"node:fs/promises";import{join as a,basename as U}from"node:path";import{homedir as x}from"node:os";function W(){return process.env.XDG_CACHE_HOME||a(x(),".cache")}function q(){if(process.argv.includes("--no-auto-update")||process.argv.includes("--prefer-version"))return!1;let e=process.env.COPILOT_AUTO_UPDATE;return!(e&&e.toLowerCase()==="false")}function G(){let e=process.argv.indexOf("--prefer-version");if(!(e===-1||e+1>=process.argv.length))return process.argv[e+1]}function Xe(){if(process.platform==="darwin")return a(x(),"Library","Caches","copilot");if(process.platform==="win32"){let e=process.env.LOCALAPPDATA||a(x(),".cache");return a(e,"copilot")}return a(W(),"copilot")}function K(){let e=[];return process.env.COPILOT_PKG_CACHE_HOME&&e.push(a(process.env.COPILOT_PKG_CACHE_HOME,"pkg")),process.env.COPILOT_CACHE_HOME&&e.push(a(process.env.COPILOT_CACHE_HOME,"pkg")),e.push(a(Xe(),"pkg")),e.push(a(W(),"copilot","pkg")),process.env.COPILOT_HOME&&e.push(a(process.env.COPILOT_HOME,"pkg")),e.push(a(x(),".copilot","pkg")),[...new Set(e)]}function j(e){let r=e.match(/^(\d+)\.(\d+)\.(\d+)/);if(r)return[Number(r[1]),Number(r[2]),Number(r[3])]}function Qe(e,r){let t=j(e),n=j(r);if(!t&&!n)return 0;if(!t)return-1;if(!n)return 1;for(let s=0;s<3;s++)if(t[s]!==n[s])return t[s]-n[s];let o=e.includes("-"),i=r.includes("-");return o!==i?o?-1:1:e.localeCompare(r)}async function J(e,...r){let t=[];for(let n of r){let o;try{o=await Je(n)}catch{continue}for(let i of o){let s=a(n,i);try{await Ye(a(s,e),ze.R_OK),t.push(s)}catch{continue}}}return t.sort((n,o)=>{let i=Qe(U(o),U(n));return i!==0?i:n.localeCompare(o)}),t}import{join as Ce}from"node:path";var O=Ke(Ee(),1);function S(e={}){return(e.platform??process.platform)!=="linux"?"gnu":e.detectLibcFamily?e.detectLibcFamily()==="musl"?"musl":"gnu":(0,O.familySync)()===O.MUSL?"musl":"gnu"}function A(e=process.platform,r){let t=r??(e==="linux"?S():"gnu");return e==="linux"&&t==="musl"?"linuxmusl":e}function xe(e=process.platform,r,t=process.arch){return`${A(e,r)}-${t}`}function Pe(){let e=xe();return K().flatMap(r=>[Ce(r,"universal"),Ce(r,e)])}function yr(){return process.env.COPILOT_CLI_VERSION?process.env.COPILOT_CLI_VERSION:"1.0.78-2"}async function Le(e,r){let t=N(e,"app.js"),n=yr()===V,o=G();if(r&&(o||q()&&!n)){let i=Pe(),s=await J("app.js",...i);if(o){let c=s.find(h=>hr(h)===o);c?t=N(c,"app.js"):process.stderr.write(`Warning: preferred version ${o} not found in package cache, using built-in version
var Ve=Object.create;var $=Object.defineProperty;var Ue=Object.getOwnPropertyDescriptor;var je=Object.getOwnPropertyNames;var We=Object.getPrototypeOf,qe=Object.prototype.hasOwnProperty;var B=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(r,t)=>(typeof require<"u"?require:r)[t]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var E=(e,r)=>()=>{try{return r||e((r={exports:{}}).exports,r),r.exports}catch(t){throw r=0,t}};var Ge=(e,r,t,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of je(r))!qe.call(e,o)&&o!==t&&$(e,o,{get:()=>r[o],enumerable:!(n=Ue(r,o))||n.enumerable});return e};var Ke=(e,r,t)=>(t=e!=null?Ve(We(e)):{},Ge(r||!e||!e.__esModule?$(t,"default",{value:e,enumerable:!0}):t,e));var X=E((Yr,z)=>{"use strict";var J=()=>process.platform==="linux",C=null,Ze=()=>{if(!C)if(J()&&process.report){let e=process.report.excludeNetwork;process.report.excludeNetwork=!0,C=process.report.getReport(),process.report.excludeNetwork=e}else C={};return C};z.exports={isLinux:J,getReport:Ze}});var Z=E((Jr,Q)=>{"use strict";var y=B("fs"),er="/usr/bin/ldd",rr="/proc/self/exe",P=2048,tr=e=>{let r=y.openSync(e,"r"),t=Buffer.alloc(P),n=y.readSync(r,t,0,P,0);return y.close(r,()=>{}),t.subarray(0,n)},nr=e=>new Promise((r,t)=>{y.open(e,"r",(n,o)=>{if(n)t(n);else{let i=Buffer.alloc(P);y.read(o,i,0,P,0,(s,c)=>{r(i.subarray(0,c)),y.close(o,()=>{})})}})});Q.exports={LDD_PATH:er,SELF_PATH:rr,readFileSync:tr,readFile:nr}});var re=E((zr,ee)=>{"use strict";var or=e=>{if(e.length<64||e.readUInt32BE(0)!==2135247942||e.readUInt8(4)!==2||e.readUInt8(5)!==1)return null;let r=e.readUInt32LE(32),t=e.readUInt16LE(54),n=e.readUInt16LE(56);for(let o=0;o<n;o++){let i=r+o*t;if(e.readUInt32LE(i)===3){let c=e.readUInt32LE(i+8),h=e.readUInt32LE(i+32);return e.subarray(c,c+h).toString().replace(/\0.*$/g,"")}}return null};ee.exports={interpreterPath:or}});var Ee=E((Xr,ve)=>{"use strict";var ne=B("child_process"),{isLinux:b,getReport:oe}=X(),{LDD_PATH:L,SELF_PATH:ie,readFile:w,readFileSync:I}=Z(),{interpreterPath:se}=re(),u,f,d,ae="getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true",m="",ce=()=>m||new Promise(e=>{ne.exec(ae,(r,t)=>{m=r?" ":t,e(m)})}),le=()=>{if(!m)try{m=ne.execSync(ae,{encoding:"utf8"})}catch{m=" "}return m},p="glibc",ue=/LIBC[a-z0-9 \-).]*?(\d+\.\d+)/i,g="musl",ir=e=>e.includes("libc.musl-")||e.includes("ld-musl-"),fe=()=>{let e=oe();return e.header&&e.header.glibcVersionRuntime?p:Array.isArray(e.sharedObjects)&&e.sharedObjects.some(ir)?g:null},de=e=>{let[r,t]=e.split(/[\r\n]+/);return r&&r.includes(p)?p:t&&t.includes(g)?g:null},pe=e=>{if(e){if(e.includes("/ld-musl-"))return g;if(e.includes("/ld-linux-"))return p}return null},me=e=>(e=e.toString(),e.includes("musl")?g:e.includes("GNU C Library")?p:null),sr=async()=>{if(f!==void 0)return f;f=null;try{let e=await w(L);f=me(e)}catch{}return f},ar=()=>{if(f!==void 0)return f;f=null;try{let e=I(L);f=me(e)}catch{}return f},cr=async()=>{if(u!==void 0)return u;u=null;try{let e=await w(ie),r=se(e);u=pe(r)}catch{}return u},lr=()=>{if(u!==void 0)return u;u=null;try{let e=I(ie),r=se(e);u=pe(r)}catch{}return u},ge=async()=>{let e=null;if(b()&&(e=await cr(),!e&&(e=await sr(),e||(e=fe()),!e))){let r=await ce();e=de(r)}return e},he=()=>{let e=null;if(b()&&(e=lr(),!e&&(e=ar(),e||(e=fe()),!e))){let r=le();e=de(r)}return e},ur=async()=>b()&&await ge()!==p,fr=()=>b()&&he()!==p,dr=async()=>{if(d!==void 0)return d;d=null;try{let r=(await w(L)).match(ue);r&&(d=r[1])}catch{}return d},pr=()=>{if(d!==void 0)return d;d=null;try{let r=I(L).match(ue);r&&(d=r[1])}catch{}return d},ye=()=>{let e=oe();return e.header&&e.header.glibcVersionRuntime?e.header.glibcVersionRuntime:null},te=e=>e.trim().split(/\s+/)[1],be=e=>{let[r,t,n]=e.split(/[\r\n]+/);return r&&r.includes(p)?te(r):t&&n&&t.includes(g)?te(n):null},mr=async()=>{let e=null;if(b()&&(e=await dr(),e||(e=ye()),!e)){let r=await ce();e=be(r)}return e},gr=()=>{let e=null;if(b()&&(e=pr(),e||(e=ye()),!e)){let r=le();e=be(r)}return e};ve.exports={GLIBC:p,MUSL:g,family:ge,familySync:he,isNonGlibcLinux:ur,isNonGlibcLinuxSync:fr,version:mr,versionSync:gr}});import Dr from"node:module";import{dirname as Mr,join as $r}from"node:path";import*as Be from"node:sea";import{fileURLToPath as Br,pathToFileURL as k}from"node:url";import{basename as hr,join as N}from"node:path";var V="0.0.1";import{readdir as Ye,access as Je,constants as ze}from"node:fs/promises";import{join as a,basename as U}from"node:path";import{homedir as x}from"node:os";function W(){return process.env.XDG_CACHE_HOME||a(x(),".cache")}function q(){if(process.argv.includes("--no-auto-update")||process.argv.includes("--prefer-version"))return!1;let e=process.env.COPILOT_AUTO_UPDATE;return!(e&&e.toLowerCase()==="false")}function G(){let e=process.argv.indexOf("--prefer-version");if(!(e===-1||e+1>=process.argv.length))return process.argv[e+1]}function Xe(){if(process.platform==="darwin")return a(x(),"Library","Caches","copilot");if(process.platform==="win32"){let e=process.env.LOCALAPPDATA||a(x(),".cache");return a(e,"copilot")}return a(W(),"copilot")}function K(){let e=[];return process.env.COPILOT_PKG_CACHE_HOME&&e.push(a(process.env.COPILOT_PKG_CACHE_HOME,"pkg")),process.env.COPILOT_CACHE_HOME&&e.push(a(process.env.COPILOT_CACHE_HOME,"pkg")),e.push(a(Xe(),"pkg")),e.push(a(W(),"copilot","pkg")),process.env.COPILOT_HOME&&e.push(a(process.env.COPILOT_HOME,"pkg")),e.push(a(x(),".copilot","pkg")),[...new Set(e)]}function j(e){let r=e.match(/^(\d+)\.(\d+)\.(\d+)/);if(r)return[Number(r[1]),Number(r[2]),Number(r[3])]}function Qe(e,r){let t=j(e),n=j(r);if(!t&&!n)return 0;if(!t)return-1;if(!n)return 1;for(let s=0;s<3;s++)if(t[s]!==n[s])return t[s]-n[s];let o=e.includes("-"),i=r.includes("-");return o!==i?o?-1:1:e.localeCompare(r)}async function Y(e,...r){let t=[];for(let n of r){let o;try{o=await Ye(n)}catch{continue}for(let i of o){let s=a(n,i);try{await Je(a(s,e),ze.R_OK),t.push(s)}catch{continue}}}return t.sort((n,o)=>{let i=Qe(U(o),U(n));return i!==0?i:n.localeCompare(o)}),t}import{join as Ce}from"node:path";var O=Ke(Ee(),1);function S(e={}){return(e.platform??process.platform)!=="linux"?"gnu":e.detectLibcFamily?e.detectLibcFamily()==="musl"?"musl":"gnu":(0,O.familySync)()===O.MUSL?"musl":"gnu"}function A(e=process.platform,r){let t=r??(e==="linux"?S():"gnu");return e==="linux"&&t==="musl"?"linuxmusl":e}function xe(e=process.platform,r,t=process.arch){return`${A(e,r)}-${t}`}function Pe(){let e=xe();return K().flatMap(r=>[Ce(r,"universal"),Ce(r,e)])}function yr(){return process.env.COPILOT_CLI_VERSION?process.env.COPILOT_CLI_VERSION:"1.0.78-3"}async function Le(e,r){let t=N(e,"app.js"),n=yr()===V,o=G();if(r&&(o||q()&&!n)){let i=Pe(),s=await Y("app.js",...i);if(o){let c=s.find(h=>hr(h)===o);c?t=N(c,"app.js"):process.stderr.write(`Warning: preferred version ${o} not found in package cache, using built-in version
`)}else s.length>0&&(t=N(s[0],"app.js"))}return t}import{existsSync as br}from"node:fs";import{basename as vr,resolve as Er}from"node:path";var Oe="extension_bootstrap.mjs";function Se(e,r,t=br){let n=e.find(s=>vr(s)===Oe);if(!n)return;process.stderr.write(`[extension-fork] resolveBootstrapPath: __dir=${r}, argv-bootstrap=${n}
`);let o=Er(r,"preloads",Oe),i=t(o);if(process.stderr.write(`[extension-fork] resolveBootstrapPath: localBootstrap=${o}, localExists=${i}
`),i)return o}var xr=new Set(["--server","--headless","--acp","--embedded-host"]),Cr=new Set(["completion","help","init","login","mcp","plugin","update","version"]);function Pr(e){return e==="--prompt"||e.startsWith("--prompt=")||e==="-p"||e.startsWith("-p")&&e.length>2}function Lr(e){if(e.some(t=>xr.has(t)||Pr(t)))return!0;let r=e.find(t=>!t.startsWith("-"));return r!==void 0&&Cr.has(r)}function Te(e){return!Lr(e)}var Or="github.copilot.cli.typeahead.capture",_e=Symbol.for(Or);function F(){let e=globalThis,r=e[_e];return r||(r={buffer:[],capturing:!1,listener:null,exitHandler:null},e[_e]=r),r}var H=class{detachListener(r){r.listener&&(process.stdin.removeListener("data",r.listener),r.listener=null)}clearExitHandler(r){r.exitHandler&&(process.removeListener("exit",r.exitHandler),r.exitHandler=null)}start(){let r=F();if(!process.stdin.isTTY||typeof process.stdin.setRawMode!="function"||r.capturing)return;try{process.stdin.setRawMode(!0)}catch{return}if(!r.exitHandler){let n=()=>{if(r.capturing)try{process.stdin.setRawMode(!1)}catch{}};r.exitHandler=n,process.once("exit",n)}let t=n=>{if(n.length===1&&n[0]===3){this.dispose(),process.kill(process.pid,"SIGINT");return}r.buffer.push(Buffer.from(n))};r.listener=t,process.stdin.on("data",t),process.stdin.unref(),r.capturing=!0}drain(){let r=F();if(this.detachListener(r),this.clearExitHandler(r),r.capturing=!1,r.buffer.length===0)return null;let t=Buffer.concat(r.buffer);return r.buffer=[],t}dispose(){let r=F();if(this.detachListener(r),this.clearExitHandler(r),r.buffer=[],!!r.capturing){try{process.stdin.setRawMode(!1)}catch{}process.stdin.pause(),r.capturing=!1}}},we=new H;import Re from"node:path";import{fileURLToPath as Rr}from"node:url";function Sr(e){if(e.includes("<!DOCTYPE")||e.includes("<html")){let r=Math.min(e.indexOf("<!DOCTYPE")!==-1?e.indexOf("<!DOCTYPE"):1/0,e.indexOf("<html")!==-1?e.indexOf("<html"):1/0),t=e.substring(0,r).trim();return t?`${t} [HTML error page omitted]`:"[HTML error page omitted]"}return e}function Ie(e){let r;if(e instanceof Error)r=String(e);else if(typeof e=="object"&&e!==null)try{r=JSON.stringify(e)??"[object]"}catch{return"[object with circular reference]"}else r=String(e);return Sr(r)}import{createRequire as Tr}from"node:module";import{platform as _r,type as wr}from"node:os";import{join as Ae,resolve as Ir}from"node:path";import{fileURLToPath as Ar}from"node:url";function Nr(){let e=Fe(),r=e==="linux"?S({platform:e}):"gnu";return`${A(e,r)}-${process.arch}`}function Fr(){let e=Fe(),{arch:r}=process;switch(e){case"win32":return`win32-${r}-msvc`;case"darwin":return`darwin-${r}`;case"linux":return`linux-${r}-${S({platform:e})}`;default:throw new Error(`Unsupported platform: ${e}/${r}`)}}var l;function Fe(){if(l!==void 0)return l;switch(wr()){case"Windows_NT":l="win32";break;case"Darwin":l="darwin";break;case"Linux":l="linux";break;case"AIX":l="aix";break;case"FreeBSD":case"DragonFly":l="freebsd";break;case"OpenBSD":l="openbsd";break;case"NetBSD":l="netbsd";break;case"SunOS":l="sunos";break;default:l=_r();break}return l}function He(e,r){let t=Nr(),n=`${e}.node`,o=`${e}.${Fr()}.node`,i=[];for(let c of r){let h=Ir(c),$=Ae(h,"prebuilds",t,n),T=Ne($);if(T.ok)return T.value;i.push({path:$,err:T.err});let D=Ae(h,o),_=Ne(D);if(_.ok)return _.value;i.push({path:D,err:_.err})}let s=i.map(c=>` ${c.path}: ${Hr(c.err)}`).join(`
`),i)return o}var xr=new Set(["--server","--headless","--acp","--embedded-host"]),Cr=new Set(["completion","help","init","login","mcp","plugin","update","version"]);function Pr(e){return e==="--prompt"||e.startsWith("--prompt=")||e==="-p"||e.startsWith("-p")&&e.length>2}function Lr(e){if(e.some(t=>xr.has(t)||Pr(t)))return!0;let r=e.find(t=>!t.startsWith("-"));return r!==void 0&&Cr.has(r)}function Te(e){return!Lr(e)}var Or="github.copilot.cli.typeahead.capture",_e=Symbol.for(Or);function F(){let e=globalThis,r=e[_e];return r||(r={buffer:[],capturing:!1,listener:null,exitHandler:null},e[_e]=r),r}var H=class{detachListener(r){r.listener&&(process.stdin.removeListener("data",r.listener),r.listener=null)}clearExitHandler(r){r.exitHandler&&(process.removeListener("exit",r.exitHandler),r.exitHandler=null)}start(){let r=F();if(!process.stdin.isTTY||typeof process.stdin.setRawMode!="function"||r.capturing)return;try{process.stdin.setRawMode(!0)}catch{return}if(!r.exitHandler){let n=()=>{if(r.capturing)try{process.stdin.setRawMode(!1)}catch{}};r.exitHandler=n,process.once("exit",n)}let t=n=>{if(n.length===1&&n[0]===3){this.dispose(),process.kill(process.pid,"SIGINT");return}r.buffer.push(Buffer.from(n))};r.listener=t,process.stdin.on("data",t),process.stdin.unref(),r.capturing=!0}drain(){let r=F();if(this.detachListener(r),this.clearExitHandler(r),r.capturing=!1,r.buffer.length===0)return null;let t=Buffer.concat(r.buffer);return r.buffer=[],t}dispose(){let r=F();if(this.detachListener(r),this.clearExitHandler(r),r.buffer=[],!!r.capturing){try{process.stdin.setRawMode(!1)}catch{}process.stdin.pause(),r.capturing=!1}}},we=new H;import Re from"node:path";import{fileURLToPath as Rr}from"node:url";function Sr(e){if(e.includes("<!DOCTYPE")||e.includes("<html")){let r=Math.min(e.indexOf("<!DOCTYPE")!==-1?e.indexOf("<!DOCTYPE"):1/0,e.indexOf("<html")!==-1?e.indexOf("<html"):1/0),t=e.substring(0,r).trim();return t?`${t} [HTML error page omitted]`:"[HTML error page omitted]"}return e}function Ie(e){let r;if(e instanceof Error)r=String(e);else if(typeof e=="object"&&e!==null)try{r=JSON.stringify(e)??"[object]"}catch{return"[object with circular reference]"}else r=String(e);return Sr(r)}import{createRequire as Tr}from"node:module";import{platform as _r,type as wr}from"node:os";import{join as Ae,resolve as Ir}from"node:path";import{fileURLToPath as Ar}from"node:url";function Nr(){let e=Fe(),r=e==="linux"?S({platform:e}):"gnu";return`${A(e,r)}-${process.arch}`}function Fr(){let e=Fe(),{arch:r}=process;switch(e){case"win32":return`win32-${r}-msvc`;case"darwin":return`darwin-${r}`;case"linux":return`linux-${r}-${S({platform:e})}`;default:throw new Error(`Unsupported platform: ${e}/${r}`)}}var l;function Fe(){if(l!==void 0)return l;switch(wr()){case"Windows_NT":l="win32";break;case"Darwin":l="darwin";break;case"Linux":l="linux";break;case"AIX":l="aix";break;case"FreeBSD":case"DragonFly":l="freebsd";break;case"OpenBSD":l="openbsd";break;case"NetBSD":l="netbsd";break;case"SunOS":l="sunos";break;default:l=_r();break}return l}function He(e,r){let t=Nr(),n=`${e}.node`,o=`${e}.${Fr()}.node`,i=[];for(let c of r){let h=Ir(c),D=Ae(h,"prebuilds",t,n),T=Ne(D);if(T.ok)return T.value;i.push({path:D,err:T.err});let M=Ae(h,o),_=Ne(M);if(_.ok)return _.value;i.push({path:M,err:_.err})}let s=i.map(c=>` ${c.path}: ${Hr(c.err)}`).join(`
`);throw new Error(`Native addon "${e}" not found for ${t}. Tried:
${s}`)}function Hr(e){if(e instanceof Error)return e.message;if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return Object.prototype.toString.call(e)}}function Ne(e){try{return{ok:!0,value:kr(e)}}catch(r){return{ok:!1,err:r}}}function kr(e){return Tr(Ar(import.meta.url))(e)}var v,ke=Re.dirname(Rr(import.meta.url));function $e(){if(v){if(v.kind==="ok")return v.addon;throw v.error}try{let e=He("cli-native",[ke,Re.resolve(ke,"..","native","cli")]);return v={kind:"ok",addon:e},e}catch(e){let r=e instanceof Error?e:new Error(`Failed to load cli-native addon: ${Ie(e)}`);throw v={kind:"error",error:r},r}}function De(){if(process.platform==="win32")return $e()}try{$r.enableCompileCache?.()}catch{}var R=Dr(Br(import.meta.url)),Vr=Be.isSea();process.report.reportOnFatalError=!0;process.report.excludeEnv=!0;if(process.platform==="win32")try{let e=De();if(!e)throw new Error("loadWin32NativeAddon returned undefined on win32");e.enableCrashReporting(),e.installExceptionFilter()}catch{}var Me=Se(process.argv,R);if(Me)await import(k(Me).href);else if(process.env.COPILOT_VOICE_SERVER_MODE==="1"){let e=Mr(R,"voice-server.js");try{let{runVoiceServer:r}=await import(k(e).href);await r()}catch(r){process.stderr.write(`voice server: fatal at ${e}: ${r.stack??String(r)}
${s}`)}function Hr(e){if(e instanceof Error)return e.message;if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return Object.prototype.toString.call(e)}}function Ne(e){try{return{ok:!0,value:kr(e)}}catch(r){return{ok:!1,err:r}}}function kr(e){return Tr(Ar(import.meta.url))(e)}var v,ke=Re.dirname(Rr(import.meta.url));function De(){if(v){if(v.kind==="ok")return v.addon;throw v.error}try{let e=He("cli-native",[ke,Re.resolve(ke,"..","native","cli")]);return v={kind:"ok",addon:e},e}catch(e){let r=e instanceof Error?e:new Error(`Failed to load cli-native addon: ${Ie(e)}`);throw v={kind:"error",error:r},r}}function Me(){if(process.platform==="win32")return De()}try{Dr.enableCompileCache?.()}catch{}var R=Mr(Br(import.meta.url)),Vr=Be.isSea();process.report.reportOnFatalError=!0;process.report.excludeEnv=!0;if(process.platform==="win32")try{let e=Me();if(!e)throw new Error("loadWin32NativeAddon returned undefined on win32");e.enableCrashReporting(),e.installExceptionFilter()}catch{}var $e=Se(process.argv,R);if($e)await import(k($e).href);else if(process.env.COPILOT_VOICE_SERVER_MODE==="1"){let e=$r(R,"voice-server.js");try{let{runVoiceServer:r}=await import(k(e).href);await r()}catch(r){process.stderr.write(`voice server: fatal at ${e}: ${r.stack??String(r)}
`),process.exit(1)}}else if(process.env.COPILOT_SHUTDOWN_FLUSH){try{let{url:e,headers:r,body:t}=JSON.parse(process.env.COPILOT_SHUTDOWN_FLUSH);await fetch(e,{method:"POST",headers:r,body:t,signal:AbortSignal.timeout(3e4)})}catch{}process.exit(0)}else{Te(process.argv.slice(2))&&we.start();let e=await Le(R,Vr);await import(k(e).href)}
{
"name": "@github/copilot-linux-arm64",
"version": "1.0.78-2",
"version": "1.0.78-3",
"description": "GitHub Copilot CLI for linux-arm64",

@@ -5,0 +5,0 @@ "license": "SEE LICENSE IN LICENSE.md",

@@ -1,2 +0,2 @@

(()=>{const stack=new Error().stack;stack&&(globalThis._sentryDebugIds=globalThis._sentryDebugIds||{},globalThis._sentryDebugIds[stack]="0b0ec479-25c1-5837-898f-b5c14b11ddf1",globalThis._sentryDebugIdIdentifier="sentry-dbid-0b0ec479-25c1-5837-898f-b5c14b11ddf1");})();
(()=>{const stack=new Error().stack;stack&&(globalThis._sentryDebugIds=globalThis._sentryDebugIds||{},globalThis._sentryDebugIds[stack]="563fc973-88ef-54e4-9333-7b41a6b01186",globalThis._sentryDebugIdIdentifier="sentry-dbid-563fc973-88ef-54e4-9333-7b41a6b01186");})();

@@ -60,4 +60,4 @@ /*---------------------------------------------------------------------------------------------

const __esmShimDirname = __path.dirname(__esmShimFilename);
import{parentPort as F,workerData as B}from"node:worker_threads";var m=class{initialQueue=[];initialQueueResolvers=Promise.withResolvers();logWriter=null;cachedOutputPath;writePromise=this.initialQueueResolvers.promise;setLogWriter(e){this.logWriter=e,this.cachedOutputPath=void 0;for(let t of this.initialQueue)this.writeTo(e,t.method,t.message);this.initialQueue=[],this.initialQueueResolvers.resolve()}async flush(){if(!this.logWriter)return;let e=this.logWriter,t=(async()=>{try{await this.writePromise,await e.flush?.()}catch{}})(),o,n=new Promise(s=>{o=setTimeout(s,5e3),o.unref?.()});try{await Promise.race([t,n])}finally{o&&clearTimeout(o)}}async dispose(){await this.flush()}outputPath(){return this.cachedOutputPath??=this.logWriter?.outputPath()}logToLevel(e,t){this.logWriter?this.writeTo(this.logWriter,e,t):this.initialQueue.push({method:e,message:t})}writeTo(e,t,o){if(e.write&&e.flush){e.write(t,o),this.writePromise=e.flush().catch(()=>{});return}this.writePromise=e.writeLog(t,o).catch(()=>{})}info(e){this.logToLevel("info",e)}debug(e){this.logToLevel("debug",e)}warning(e){this.logToLevel("warning",e)}error(e){this.logToLevel("error",e instanceof Error?e.message:e)}log(e){this.error(e)}isDebug(){return!1}shouldLog(e){return!0}notice(e){this.info(e instanceof Error?e.message:e)}startGroup(e,t){this.info(`--- Start of group: ${e} ---`)}endGroup(e){this.info("--- End of group ---")}},u=new m;import{createRequire as H}from"node:module";import*as i from"node:fs/promises";import*as a from"node:path";import{createHash as W}from"node:crypto";import{join as l,basename as or}from"node:path";import{homedir as h}from"node:os";function A(){return process.env.XDG_CACHE_HOME||l(h(),".cache")}function O(){if(process.platform==="darwin")return l(h(),"Library","Caches","copilot");if(process.platform==="win32"){let r=process.env.LOCALAPPDATA||l(h(),".cache");return l(r,"copilot")}return l(A(),"copilot")}function D(r){if(r.includes("<!DOCTYPE")||r.includes("<html")){let e=Math.min(r.indexOf("<!DOCTYPE")!==-1?r.indexOf("<!DOCTYPE"):1/0,r.indexOf("<html")!==-1?r.indexOf("<html"):1/0),t=r.substring(0,e).trim();return t?`${t} [HTML error page omitted]`:"[HTML error page omitted]"}return r}function y(r){let e;if(r instanceof Error)e=String(r);else if(typeof r=="object"&&r!==null)try{e=JSON.stringify(r)??"[object]"}catch{return"[object with circular reference]"}else e=String(r);return D(e)}var j=1,I=".complete";var w={"win32-x64":"win-x64","win32-arm64":"win-arm64","linux-x64":"linux-x64","darwin-arm64":"osx-arm64"};function S(){return typeof __foundryRequire<"u"&&__foundryRequire||H(import.meta.url)}var f;function U(){if(f)return f;try{let r=S()("foundry-local-sdk/script/install-utils.cjs");if(typeof r.runInstall!="function")throw new Error(`Expected exports {runInstall: function}, got: ${JSON.stringify(Object.fromEntries(Object.entries(r).map(([e,t])=>[e,typeof t])))}`);return f=r,f}catch(r){throw new Error(`Failed to load foundry-local-sdk/script/install-utils.cjs: ${y(r)}. The upstream foundry-local-sdk installer may have changed shape \u2014 re-run the audit checklist in src/cli/voice/foundry/installer/nativeLoader.ts and update accordingly.`)}}var p;function J(){if(p)return p;try{let r=S()("foundry-local-sdk/deps_versions.json");if(typeof r["foundry-local-core"]?.nuget!="string"||typeof r.onnxruntime?.version!="string"||typeof r["onnxruntime-genai"]?.version!="string")throw new Error('deps_versions.json is missing one of the expected version keys: ["foundry-local-core"].nuget, .onnxruntime.version, ["onnxruntime-genai"].version');return p=r,p}catch(r){throw new Error(`Failed to load foundry-local-sdk/deps_versions.json: ${y(r)}. The upstream foundry-local-sdk installer may have changed shape \u2014 re-run the audit checklist in src/cli/voice/foundry/installer/nativeLoader.ts and update accordingly.`)}}function C(r=process.platform){let e=J();return[{name:"Microsoft.AI.Foundry.Local.Core",version:e["foundry-local-core"].nuget},{name:r==="linux"?"Microsoft.ML.OnnxRuntime.Gpu.Linux":"Microsoft.ML.OnnxRuntime.Foundry",version:e.onnxruntime.version},{name:"Microsoft.ML.OnnxRuntimeGenAI.Foundry",version:e["onnxruntime-genai"].version}]}function b(r){return r==="win32"?".dll":r==="darwin"?".dylib":".so"}function V(r,e){return a.join(r,`Microsoft.AI.Foundry.Local.Core${b(e)}`)}function K(r){let e=b(r),t=r==="win32"?"":"lib";return[`Microsoft.AI.Foundry.Local.Core${e}`,`${t}onnxruntime${e}`,`${t}onnxruntime-genai${e}`]}function q(r,e=process.platform,t=process.arch){let o=w[`${e}-${t}`];if(!o)throw new Error(`Voice mode not supported on ${e}-${t}`);let n=r??process.env.COPILOT_CACHE_HOME??O(),s=C(e),c=W("sha256").update(JSON.stringify({schema:j,artifacts:s})).digest("hex").slice(0,12);return a.join(n,"foundry",c,o)}async function _(r={}){let e=r.platform??process.platform,t=r.arch??process.arch,o=`${e}-${t}`;if(!w[o])throw new Error(`Voice mode is not supported on ${o}. Supported platforms: ${Object.keys(w).join(", ")}.`);let s=q(r.cacheRoot,e,t),c=V(s,e),d=K(e);return await T(s,d)?{corePath:c}:(r.onDownloadStart?.(),await G(s,e,d,r.runInstall),{corePath:c})}async function T(r,e){return await v(a.join(r,I))?(await Promise.all(e.map(o=>v(a.join(r,o))))).every(Boolean):!1}async function v(r){try{return await i.access(r),!0}catch{return!1}}async function G(r,e,t,o){let n=a.dirname(r);await i.mkdir(n,{recursive:!0});let s=a.join(n,`.tmp-${a.basename(r)}-${process.pid}-${Date.now()}`);await i.mkdir(s,{recursive:!0});try{let c=o??U().runInstall,d=C(e);await z(()=>c(d,{binDir:s}));for(let k of t)if(!await v(a.join(s,k)))throw new Error(`Foundry runtime download finished but required file is missing: ${k}. RID for ${e} may not be supported by the published packages.`);await i.writeFile(a.join(s,I),""),await Q(s,r,t)}catch(c){throw await i.rm(s,{recursive:!0,force:!0}).catch(()=>{}),c}}async function Q(r,e,t){try{await i.rename(r,e)}catch(o){let n=o.code;if(n==="ENOTEMPTY"||n==="EEXIST"||n==="EPERM"){if(await T(e,t)){await i.rm(r,{recursive:!0,force:!0}).catch(()=>{});return}await i.rm(e,{recursive:!0,force:!0}),await i.rename(r,e);return}throw o}}async function z(r){let e=process.stdout.write.bind(process.stdout),t=process.stderr.write.bind(process.stderr);process.stdout.write=(()=>!0),process.stderr.write=(()=>!0);try{return await r()}finally{process.stdout.write=e,process.stderr.write=t}}var E=class extends Error{constructor(t,o,n){super(t,n);this.code=o;this.name="VoiceBackendError"}code};function $(r){return r instanceof E?{message:r.message,code:r.code}:r instanceof Error?{message:r.message}:{message:String(r)}}function M(r){return r instanceof Error?r:new Error(String(r))}var X=16;function L(r){return N(r,new WeakSet,0)}function N(r,e,t){if(t>=X)return"<cause chain truncated>";if(typeof r=="object"&&r!==null){if(e.has(r))return"<cyclic cause>";e.add(r)}if(!(r instanceof Error))return String(r);let o=r.stack??`${r.name}: ${r.message}`;if(r.cause===void 0)return o;let n=N(r.cause,e,t+1);return`${o}
Caused by: ${n}`}var P=16*1024,x=class{constructor(e){this.port=e}port;writeLog(e,t){let o={kind:"log",level:e,message:Y(t)};try{this.port.postMessage(o)}catch{}return Promise.resolve()}outputPath(){return"<voice-worker>"}};function R(r,e=u){e.setLogWriter(new x(r))}function Y(r){return r.length<=P?r:`${r.slice(0,P)}\u2026 [truncated, ${r.length-P} more chars]`}if(!F)throw new Error("voice-installer.worker.js must be loaded as a worker thread.");var g=F;R(g);var Z=B??{};async function rr(){try{let e={kind:"ok",location:await _({cacheRoot:Z.cacheRoot,onDownloadStart:()=>{let t={kind:"download-started"};g.postMessage(t)}})};g.postMessage(e)}catch(r){let e=M(r);u.error(`[voice-installer worker] install failed: ${L(e)}`);let t={kind:"error",error:$(e)};g.postMessage(t)}finally{setImmediate(()=>process.exit(0))}}rr().catch(r=>{u.error(`[voice-installer worker] fatal: ${L(r)}`),process.exit(1)});
import{parentPort as F,workerData as B}from"node:worker_threads";var m=class{initialQueue=[];initialQueueResolvers=Promise.withResolvers();logWriter=null;cachedOutputPath;writePromise=this.initialQueueResolvers.promise;setLogWriter(e){this.logWriter=e,this.cachedOutputPath=void 0;for(let t of this.initialQueue)this.writeTo(e,t.method,t.message);this.initialQueue=[],this.initialQueueResolvers.resolve()}async flush(){if(!this.logWriter)return;let e=this.logWriter,t=(async()=>{try{await this.writePromise,await e.flush?.()}catch{}})(),o,n=new Promise(s=>{o=setTimeout(s,5e3),o.unref?.()});try{await Promise.race([t,n])}finally{o&&clearTimeout(o)}}async dispose(){await this.flush()}outputPath(){return this.cachedOutputPath??=this.logWriter?.outputPath()}logToLevel(e,t){this.logWriter?this.writeTo(this.logWriter,e,t):this.initialQueue.push({method:e,message:t})}writeTo(e,t,o){if(e.write&&e.flush){e.write(t,o),this.writePromise=e.flush().catch(()=>{});return}this.writePromise=e.writeLog(t,o).catch(()=>{})}info(e){this.logToLevel("info",e)}debug(e){this.logToLevel("debug",e)}warning(e){this.logToLevel("warning",e)}error(e){this.logToLevel("error",e instanceof Error?e.message:e)}log(e){this.error(e)}isDebug(){return!1}shouldLog(e){return!0}notice(e){this.info(e instanceof Error?e.message:e)}startGroup(e,t){this.info(`--- Start of group: ${e} ---`)}endGroup(e){this.info("--- End of group ---")}},u=new m;import{createRequire as H}from"node:module";import*as i from"node:fs/promises";import*as a from"node:path";import{createHash as W}from"node:crypto";import{join as l,basename as or}from"node:path";import{homedir as h}from"node:os";function A(){return process.env.XDG_CACHE_HOME||l(h(),".cache")}function O(){if(process.platform==="darwin")return l(h(),"Library","Caches","copilot");if(process.platform==="win32"){let r=process.env.LOCALAPPDATA||l(h(),".cache");return l(r,"copilot")}return l(A(),"copilot")}function D(r){if(r.includes("<!DOCTYPE")||r.includes("<html")){let e=Math.min(r.indexOf("<!DOCTYPE")!==-1?r.indexOf("<!DOCTYPE"):1/0,r.indexOf("<html")!==-1?r.indexOf("<html"):1/0),t=r.substring(0,e).trim();return t?`${t} [HTML error page omitted]`:"[HTML error page omitted]"}return r}function y(r){let e;if(r instanceof Error)e=String(r);else if(typeof r=="object"&&r!==null)try{e=JSON.stringify(r)??"[object]"}catch{return"[object with circular reference]"}else e=String(r);return D(e)}var j=1,I=".complete";var v={"win32-x64":"win-x64","win32-arm64":"win-arm64","linux-x64":"linux-x64","darwin-arm64":"osx-arm64"};function C(){return typeof __foundryRequire<"u"&&__foundryRequire||H(import.meta.url)}var f;function U(){if(f)return f;try{let r=C()("foundry-local-sdk/script/install-utils.cjs");if(typeof r.runInstall!="function")throw new Error(`Expected exports {runInstall: function}, got: ${JSON.stringify(Object.fromEntries(Object.entries(r).map(([e,t])=>[e,typeof t])))}`);return f=r,f}catch(r){throw new Error(`Failed to load foundry-local-sdk/script/install-utils.cjs: ${y(r)}. The upstream foundry-local-sdk installer may have changed shape \u2014 re-run the audit checklist in src/cli/voice/foundry/installer/nativeLoader.ts and update accordingly.`)}}var p;function J(){if(p)return p;try{let r=C()("foundry-local-sdk/deps_versions.json");if(typeof r["foundry-local-core"]?.nuget!="string"||typeof r.onnxruntime?.version!="string"||typeof r["onnxruntime-genai"]?.version!="string")throw new Error('deps_versions.json is missing one of the expected version keys: ["foundry-local-core"].nuget, .onnxruntime.version, ["onnxruntime-genai"].version');return p=r,p}catch(r){throw new Error(`Failed to load foundry-local-sdk/deps_versions.json: ${y(r)}. The upstream foundry-local-sdk installer may have changed shape \u2014 re-run the audit checklist in src/cli/voice/foundry/installer/nativeLoader.ts and update accordingly.`)}}function S(r=process.platform){let e=J();return[{name:"Microsoft.AI.Foundry.Local.Core",version:e["foundry-local-core"].nuget},{name:r==="linux"?"Microsoft.ML.OnnxRuntime.Gpu.Linux":"Microsoft.ML.OnnxRuntime.Foundry",version:e.onnxruntime.version},{name:"Microsoft.ML.OnnxRuntimeGenAI.Foundry",version:e["onnxruntime-genai"].version}]}function b(r){return r==="win32"?".dll":r==="darwin"?".dylib":".so"}function V(r,e){return a.join(r,`Microsoft.AI.Foundry.Local.Core${b(e)}`)}function K(r){let e=b(r),t=r==="win32"?"":"lib";return[`Microsoft.AI.Foundry.Local.Core${e}`,`${t}onnxruntime${e}`,`${t}onnxruntime-genai${e}`]}function q(r,e=process.platform,t=process.arch){let o=v[`${e}-${t}`];if(!o)throw new Error(`Voice mode not supported on ${e}-${t}`);let n=r??process.env.COPILOT_CACHE_HOME??O(),s=S(e),c=W("sha256").update(JSON.stringify({schema:j,artifacts:s})).digest("hex").slice(0,12);return a.join(n,"foundry",c,o)}async function _(r={}){let e=r.platform??process.platform,t=r.arch??process.arch,o=`${e}-${t}`;if(!v[o])throw new Error(`Voice mode is not supported on ${o}. Supported platforms: ${Object.keys(v).join(", ")}.`);let s=q(r.cacheRoot,e,t),c=V(s,e),d=K(e);return await T(s,d)?{corePath:c}:(r.onDownloadStart?.(),await G(s,e,d,r.runInstall),{corePath:c})}async function T(r,e){return await w(a.join(r,I))?(await Promise.all(e.map(o=>w(a.join(r,o))))).every(Boolean):!1}async function w(r){try{return await i.access(r),!0}catch{return!1}}async function G(r,e,t,o){let n=a.dirname(r);await i.mkdir(n,{recursive:!0});let s=a.join(n,`.tmp-${a.basename(r)}-${process.pid}-${Date.now()}`);await i.mkdir(s,{recursive:!0});try{let c=o??U().runInstall,d=S(e);await z(()=>c(d,{binDir:s}));for(let k of t)if(!await w(a.join(s,k)))throw new Error(`Foundry runtime download finished but required file is missing: ${k}. RID for ${e} may not be supported by the published packages.`);await i.writeFile(a.join(s,I),""),await Q(s,r,t)}catch(c){throw await i.rm(s,{recursive:!0,force:!0}).catch(()=>{}),c}}async function Q(r,e,t){try{await i.rename(r,e)}catch(o){let n=o.code;if(n==="ENOTEMPTY"||n==="EEXIST"||n==="EPERM"){if(await T(e,t)){await i.rm(r,{recursive:!0,force:!0}).catch(()=>{});return}await i.rm(e,{recursive:!0,force:!0}),await i.rename(r,e);return}throw o}}async function z(r){let e=process.stdout.write.bind(process.stdout),t=process.stderr.write.bind(process.stderr);process.stdout.write=(()=>!0),process.stderr.write=(()=>!0);try{return await r()}finally{process.stdout.write=e,process.stderr.write=t}}var E=class extends Error{constructor(t,o,n){super(t,n);this.code=o;this.name="VoiceBackendError"}code};function M(r){return r instanceof E?{message:r.message,code:r.code}:r instanceof Error?{message:r.message}:{message:String(r)}}function N(r){return r instanceof Error?r:new Error(String(r))}var X=16;function L(r){return R(r,new WeakSet,0)}function R(r,e,t){if(t>=X)return"<cause chain truncated>";if(typeof r=="object"&&r!==null){if(e.has(r))return"<cyclic cause>";e.add(r)}if(!(r instanceof Error))return String(r);let o=r.stack??`${r.name}: ${r.message}`;if(r.cause===void 0)return o;let n=R(r.cause,e,t+1);return`${o}
Caused by: ${n}`}var x=16*1024,P=class{constructor(e){this.port=e}port;writeLog(e,t){let o={kind:"log",level:e,message:Y(t)};try{this.port.postMessage(o)}catch{}return Promise.resolve()}outputPath(){return"<voice-worker>"}};function $(r,e=u){e.setLogWriter(new P(r))}function Y(r){return r.length<=x?r:`${r.slice(0,x)}\u2026 [truncated, ${r.length-x} more chars]`}if(!F)throw new Error("voice-installer.worker.js must be loaded as a worker thread.");var g=F;$(g);var Z=B??{};async function rr(){try{let e={kind:"ok",location:await _({cacheRoot:Z.cacheRoot,onDownloadStart:()=>{let t={kind:"download-started"};g.postMessage(t)}})};g.postMessage(e)}catch(r){let e=N(r);u.error(`[voice-installer worker] install failed: ${L(e)}`);let t={kind:"error",error:M(e)};g.postMessage(t)}finally{setImmediate(()=>process.exit(0))}}rr().catch(r=>{u.error(`[voice-installer worker] fatal: ${L(r)}`),process.exit(1)});
//# sourceMappingURL=voice-installer.worker.js.map

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display