pando-ai 0.0.16 → 0.0.18

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.
@@ -0,0 +1,4 @@
1
+ import{b as P}from"./chunk-AYCBSZ56.mjs";import s from"path";import x from"os";import l from"fs";import v from"crypto";function D(){return process.env.PANDO_DATA_DIR||s.join(x.homedir(),h)}function O(n){let t=n,r=s.parse(t);for(;t.length>r.root.length&&/[\\/]+$/.test(t);)t=t.replace(/[\\/]+$/,"");return t}function g(n){let t=s.resolve(n),r=t;try{let e=l.realpathSync.native;r=typeof e=="function"?e(t):l.realpathSync(t)}catch{}return O(r)}function G(n){let t=n.trim().replace(/\.git$/,"");if(!t)return null;let r=t.match(/^git@([^:]+):(.+)$/);if(r){let e=r[1],i=r[2].replace(/^\/+/,"").split("/");if(i.length>=2)return`${e}/${i[0]}/${i[1]}`}try{let e=new URL(t),o=e.hostname,c=e.pathname.replace(/^\/+/,"").split("/");if(o&&c.length>=2)return`${o}/${c[0]}/${c[1]}`}catch{}return null}function d(n){return v.createHash("sha1").update(n).digest("hex").slice(0,12)}function w(n){return n.normalize("NFKD").replace(/[\u0300-\u036f]/g,"").replace(/[^A-Za-z0-9._-]+/g,"-").replace(/-+/g,"-").replace(/^[-._]+|[-._]+$/g,"").slice(0,64).replace(/^[-._]+|[-._]+$/g,"")||"workspace"}function T(n,t){let r=s.basename(O(n));return`${w(r)}-${t}`}function _(){return s.join(D(),"workspace-registry.json")}function p(n){try{return l.readFileSync(n,"utf8").trim()}catch{return null}}function j(n){let t=s.join(n,".git");try{let r=l.statSync(t);if(r.isDirectory())return t;if(r.isFile()){let o=p(t)?.match(/^gitdir:\s*(.+)$/i);if(o){let i=o[1].trim();return s.isAbsolute(i)?i:s.resolve(n,i)}}}catch{return null}return null}function C(n){let t=s.join(n,"commondir"),r=p(t);if(!r)return g(n);let e=s.isAbsolute(r)?r:s.resolve(n,r);return g(e)}function L(n){return g(s.join(n,"objects"))}function W(n){let t=g(n);for(;;){let r=s.join(t,".git");if(l.existsSync(r))return t;let e=s.dirname(t);if(e===t)break;t=e}return null}function H(n){let t=g(n),r=W(t);return r?g(r):null}function M(n){let t=s.join(n,"config"),r=p(t);if(!r)return null;let e=r.split(/\r?\n/),o=!1,i=null;for(let c of e){if(c.match(/^\s*\[remote\s+"([^"]+)"\]\s*$/)){o=!0;continue}if(c.startsWith("[")&&(o=!1),o){let a=c.match(/^\s*url\s*=\s*(.+)$/);if(a&&(i=a[1].trim(),i))return i}}return i}function z(n){let t=s.join(n,"HEAD"),r=p(t);if(!r)return{branch:null,commit:null};if(r.startsWith("ref:")){let e=r.replace("ref:","").trim(),o=e.split("/").slice(-1)[0]||null,i=s.join(n,e),c=p(i);if(!c){let u=p(s.join(n,"packed-refs"));if(u){let a=u.split(/\r?\n/).find(m=>m.endsWith(` ${e}`));a&&(c=a.split(" ")[0])}}return{branch:o,commit:c||null}}return{branch:"HEAD",commit:r||null}}function F(){try{let n=l.readFileSync(_(),"utf8"),t=JSON.parse(n);if(t&&t.version===1&&t.entries&&typeof t.entries=="object")return{version:1,entries:t.entries}}catch{}return{version:1,entries:{}}}function B(n){let t=_(),r=s.dirname(t);l.mkdirSync(r,{recursive:!0});let e=`${t}.${process.pid}.${Date.now()}.tmp`;l.writeFileSync(e,`${JSON.stringify(n,null,2)}
2
+ `,"utf8"),l.renameSync(e,t)}function X(n,t){if(!t)return{canonicalRepoRoot:n,gitCommonDir:null,gitObjectDir:null,fingerprint:`non-git:path:${n}`};let r=j(t),e=r?C(r):null,o=e?L(e):null;return{canonicalRepoRoot:t,gitCommonDir:e,gitObjectDir:o,fingerprint:["git",`root:${t}`,`common:${e??""}`,`objects:${o??""}`].join("|")}}function U(n){try{let t=F();t.entries[n.storageRoot]={workspaceId:n.id,workspaceDirName:n.dirName,locationId:n.locationId,incarnationId:n.incarnationId,canonicalProjectRoot:n.canonicalProjectRoot,canonicalRepoRoot:n.canonicalRepoRoot,storageRoot:n.storageRoot,repoIdentity:n.repoIdentity??null,gitCommonDir:n.gitCommonDir??null,gitObjectDir:n.gitObjectDir??null,remote:n.remote??null,branch:n.branch??null,commit:n.commit??null,updatedAt:new Date().toISOString()},B(t)}catch{}}function J(n){let t=g(n),r=H(t),e=r??t,o=r,i=d(e),c=X(e,o),u=d(c.fingerprint),a=`ws-${d(`${i}:${u}`)}`,m=T(e,a);if(!o)return{id:a,dirName:m,locationId:i,incarnationId:u,canonicalProjectRoot:t,canonicalRepoRoot:e,storageRoot:e,gitCommonDir:c.gitCommonDir,gitObjectDir:c.gitObjectDir,repoIdentity:null,remote:null,branch:null,commit:null};let f=j(o),R=f?M(f):null,S=R?G(R):null,N=f?z(f):{branch:null,commit:null};return{id:a,dirName:m,locationId:i,incarnationId:u,canonicalProjectRoot:t,canonicalRepoRoot:o,storageRoot:e,gitCommonDir:c.gitCommonDir,gitObjectDir:c.gitObjectDir,repoIdentity:S??`local:${d(e)}`,remote:R,branch:N.branch,commit:N.commit}}function K(n){let t=J(n);return U(t),s.join(D(),"workspaces",t.dirName)}function hn(n){return s.join(K(n),".pando-snapshots.db")}var h,A=P(()=>{"use strict";h=".pando-data"});import k from"fs";import $ from"os";import y from"path";import{inspect as q}from"util";function rn(){try{k.mkdirSync(E,{recursive:!0})}catch{}}function en(n){if(n!==void 0)try{return typeof n=="string"?n:q(n,{depth:null,breakLength:1/0,maxArrayLength:1/0})}catch{try{return JSON.stringify(n)}catch{return String(n)}}}function Pn(){return b}function sn(n){return b?tn.has(n)?Y:!(!Z&&nn.has(n)):!1}function On(n,t,r){if(!sn(n))return;let e=new Date().toISOString(),o=en(r),i=o?`[${e}] [${n}] ${t} :: ${o}`:`[${e}] [${n}] ${t}`;if(!on&&!process.env.PANDO_QUIET)try{process.stderr.write(i+`
3
+ `)}catch{}try{rn(),k.appendFileSync(Q,i+`
4
+ `,"utf8")}catch{}}var E,Q,I,V,b,Z,Y,nn,tn,on,cn=P(()=>{"use strict";A();E=(()=>{let n=process.env.PANDO_LOG_DIR||process.env.PANDO_WORKSPACE_DATA_DIR;if(n)return n;try{return D()}catch{let r=typeof $.homedir=="function"?$.homedir():process.env.HOME;if(r)return y.join(r,h)}let t=process.env.HOME||process.cwd();return y.join(t,h)})(),Q=y.join(E,"pando.log"),I=n=>{if(n==null)return!1;let t=n.trim().toLowerCase();return t!=="0"&&t!=="false"&&t!=="off"&&t!=="no"},V=I(process.env.PANDO_LOG_DISABLED),b=!V&&I(process.env.PANDO_DEBUG),Z=b&&(process.env.PANDO_INDEX_HOT_LOG==null||I(process.env.PANDO_INDEX_HOT_LOG)),Y=b&&(process.env.PANDO_INDEX_TIMING==null||I(process.env.PANDO_INDEX_TIMING)),nn=new Set(["BatchAnalysisScheduler","ClojureIndex","ClojureIndexer","ThreadedIndexer"]),tn=new Set(["IndexTiming"]);on=!1});import{createHash as an}from"crypto";var ln=/^-?\d+$/,un=(1n<<63n)-1n;function gn(n){let t=an("sha1").update(n).digest(),r=0n;for(let e=0;e<8;e+=1)r=r<<8n|BigInt(t[e]);return r&un}function An(n){if(n==null)return null;if(typeof n=="bigint")return n;if(typeof n=="number"&&Number.isFinite(n))return BigInt(Math.trunc(n));if(typeof n=="string"){let t=n.trim();if(!t)return null;if(ln.test(t))try{return BigInt(t)}catch{return null}return gn(t)}return null}export{K as a,hn as b,A as c,Pn as d,On as e,cn as f,An as g};