@chatpanel/gateway 0.147.1 → 0.147.2
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/package.json +1 -1
- package/src/folder-picker.js +3 -2
- package/src/version.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chatpanel/gateway",
|
|
3
|
-
"version": "0.147.
|
|
3
|
+
"version": "0.147.2",
|
|
4
4
|
"description": "Local privacy gateway — redacts PII out of OpenAI/Anthropic API traffic before it reaches a model, then restores it in the reply. Point opencode, codex, aider, Claude Code, etc. at it.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/src/folder-picker.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import{execFile as
|
|
2
|
-
`),
|
|
1
|
+
import{execFile as d}from"node:child_process";import{existsSync as f}from"node:fs";import{delimiter as u,join as h}from"node:path";const g=10*6e4,m=120,y=["function run(argv) {",' ObjC.import("AppKit");'," const app = $.NSApplication.sharedApplication;"," app.setActivationPolicy($.NSApplicationActivationPolicyAccessory);"," app.activateIgnoringOtherApps(true);"," const p = $.NSOpenPanel.openPanel;"," p.canChooseDirectories = true;"," p.canChooseFiles = false;"," p.allowsMultipleSelection = false;"," p.canCreateDirectories = false;",' p.message = String(argv[0] || "Choose a folder");',' p.prompt = "Choose";',' if (p.runModal !== $.NSModalResponseOK) return "";'," return ObjC.unwrap(p.URLs.objectAtIndex(0).path);","}"].join(`
|
|
2
|
+
`),P=["on run argv"," activate"," set f to choose folder with prompt (item 1 of argv)"," return POSIX path of f","end run"].join(`
|
|
3
|
+
`),S="Add-Type -AssemblyName System.Windows.Forms; $d = New-Object System.Windows.Forms.FolderBrowserDialog; $d.Description = $env:CHAP_PICK_PROMPT; $d.ShowNewFolderButton = $false; if ($d.ShowDialog() -eq 'OK') { [Console]::Out.Write($d.SelectedPath) }";function w(s,t,{has:n=()=>!0}={}){if(s==="darwin"){const r=i=>/-128|User canceled/i.test(String(i?.stderr||i?.message||""));return{file:"/usr/bin/osascript",args:["-l","JavaScript","-e",y,t],cancelled:r,fallback:{file:"/usr/bin/osascript",args:["-e",P,t],cancelled:r}}}return s==="win32"?{file:"powershell.exe",args:["-NoProfile","-STA","-Command",S],env:{CHAP_PICK_PROMPT:t},cancelled:()=>!1}:n("zenity")?{file:"zenity",args:["--file-selection","--directory",`--title=${t}`],cancelled:r=>r?.code===1}:n("kdialog")?{file:"kdialog",args:["--getexistingdirectory","~","--title",t],cancelled:r=>r?.code===1}:null}let c=!1;async function O(s={},{platform:t=process.platform,run:n=A,has:r=C}={}){const i=String(s?.prompt||"Choose a folder for Chap to index").replace(/[\r\n\t]+/g," ").trim().slice(0,m)||"Choose a folder",e=w(t,i,{has:r});if(!e)return{status:501,body:{error:{message:"no folder chooser on this system — type the folder's path instead",type:"unsupported"}}};if(c)return{status:409,body:{error:{message:"a folder chooser is already open — finish or cancel it first",type:"conflict"}}};c=!0;try{const o={timeout:g,env:e.env?{...process.env,...e.env}:process.env};let a;try{a=await n(e.file,e.args,o)}catch(l){if(!e.fallback||e.cancelled(l)||l?.killed)throw l;a=await n(e.fallback.file,e.fallback.args,o)}const p=String(a||"").replace(/[\r\n]+$/,"").replace(/(.)\/$/,"$1");return{status:200,body:p?{path:p}:{cancelled:!0}}}catch(o){return e.cancelled(o)?{status:200,body:{cancelled:!0}}:{status:502,body:{error:{message:o?.killed?"the folder chooser did not answer in time":`the folder chooser failed: ${String(o?.stderr||o?.message||o).trim().slice(0,200)}`,type:"upstream"}}}}finally{c=!1}}function A(s,t,n){return new Promise((r,i)=>{d(s,t,{...n,maxBuffer:64*1024,windowsHide:!1},(e,o,a)=>{e?(e.stderr=a,i(e)):r(o)})})}function C(s){return String(process.env.PATH||"").split(u).some(t=>!!t&&f(h(t,s)))}export{g as PICK_FOLDER_TIMEOUT_MS,w as chooserFor,O as handlePickFolder};
|
package/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const o="0.147.
|
|
1
|
+
const o="0.147.2";export{o as VERSION};
|