@engineeros/connector 1.59.103 → 1.59.105

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.
@@ -1,4 +1,4 @@
1
- import ie from"node:path";import ae from"node:v8";import{Worker as ce,isMainThread as le,parentPort as L,workerData as v}from"node:worker_threads";import{constants as W}from"node:fs";import{lstat as Y,open as K,realpath as j}from"node:fs/promises";import h from"node:path";var I=10*1024*1024,N=(s,e)=>{let t=h.relative(s,e);return t&&!t.startsWith(`..${h.sep}`)&&t!==".."&&!h.isAbsolute(t)};async function R(s,e,{maxBytes:t=I}={}){let n=()=>Object.assign(new Error("Use a regular file inside the workspace without symlinks or redirected directories."),{code:"WORKSPACE_READ_UNSAFE"}),r=()=>Object.assign(new Error(`Workspace file exceeds the ${t} byte read limit. Provide a smaller file before retrying.`),{code:"WORKSPACE_READ_LIMIT"}),o=String(e||"").replaceAll("\\","/");if(!o||h.isAbsolute(o)||h.win32.isAbsolute(o))throw n();let p=await j(s),f=h.resolve(p,o);if(!N(p,f))throw n();let d=p,i;for(let c of h.relative(p,f).split(h.sep))if(d=h.join(d,c),i=await Y(d),i.isSymbolicLink())throw n();if(!i.isFile())throw n();if(i.size>t)throw r();if(!N(p,await j(f)))throw n();let m=await K(f,W.O_RDONLY|(W.O_NOFOLLOW||0));try{let c=await m.stat();if(!c.isFile()||c.ino!==i.ino||c.dev!==i.dev||!N(p,await j(f)))throw n();if(c.size>t)throw r();let b=Buffer.alloc(Math.min(t+1,64*1024)),x=[],g=0;for(;g<=t;){let{bytesRead:a}=await m.read(b,0,Math.min(b.length,t+1-g),null);if(!a)break;if(g+=a,g>t)throw r();x.push(Buffer.from(b.subarray(0,a)))}return Buffer.concat(x,g)}finally{await m.close()}}import{execFile as q}from"node:child_process";import{promisify as J}from"node:util";var Ae=J(q);var Re=Object.freeze({"skills.include_instructions":!1,"skills.bundled.enabled":!1,"features.apps":!1,"features.plugins":!1,include_apps_instructions:!1}),Me=Object.freeze({"read-only":"read-only","workspace-write":"workspace-write"});var ee="engineeros-verifier",te=Object.freeze({"*":"ask",read:"allow",glob:"allow",grep:"allow",list:"allow",bash:"allow",edit:"deny",task:"deny",external_directory:"deny",patch:"deny",apply_patch:"deny"});var ne=Object.freeze({OPENCODE_CONFIG:"",OPENCODE_CONFIG_CONTENT:JSON.stringify({agent:{[ee]:{mode:"primary",description:"Independent Goal verification with commands and no direct edits",permission:te},plan:{permission:{"*":"ask",read:"allow",glob:"allow",grep:"allow",list:"allow",edit:"deny",bash:"deny",task:"deny",external_directory:"deny",patch:"deny",apply_patch:"deny"}}}}),OPENCODE_DISABLE_PROJECT_CONFIG:"true",OPENCODE_DISABLE_CLAUDE_CODE:"true",OPENCODE_DISABLE_EXTERNAL_SKILLS:"true"});var De=String.raw`import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
1
+ import ae from"node:path";import ce from"node:v8";import{Worker as le,isMainThread as ue,parentPort as L,workerData as v}from"node:worker_threads";import{constants as W}from"node:fs";import{lstat as Y,open as K,realpath as j}from"node:fs/promises";import h from"node:path";var R=10*1024*1024,N=(s,e)=>{let t=h.relative(s,e);return t&&!t.startsWith(`..${h.sep}`)&&t!==".."&&!h.isAbsolute(t)};async function I(s,e,{maxBytes:t=R}={}){let n=()=>Object.assign(new Error("Use a regular file inside the workspace without symlinks or redirected directories."),{code:"WORKSPACE_READ_UNSAFE"}),r=()=>Object.assign(new Error(`Workspace file exceeds the ${t} byte read limit. Provide a smaller file before retrying.`),{code:"WORKSPACE_READ_LIMIT"}),o=String(e||"").replaceAll("\\","/");if(!o||h.isAbsolute(o)||h.win32.isAbsolute(o))throw n();let p=await j(s),f=h.resolve(p,o);if(!N(p,f))throw n();let d=p,i;for(let c of h.relative(p,f).split(h.sep))if(d=h.join(d,c),i=await Y(d),i.isSymbolicLink())throw n();if(!i.isFile())throw n();if(i.size>t)throw r();if(!N(p,await j(f)))throw n();let m=await K(f,W.O_RDONLY|(W.O_NOFOLLOW||0));try{let c=await m.stat();if(!c.isFile()||c.ino!==i.ino||c.dev!==i.dev||!N(p,await j(f)))throw n();if(c.size>t)throw r();let b=Buffer.alloc(Math.min(t+1,64*1024)),x=[],g=0;for(;g<=t;){let{bytesRead:a}=await m.read(b,0,Math.min(b.length,t+1-g),null);if(!a)break;if(g+=a,g>t)throw r();x.push(Buffer.from(b.subarray(0,a)))}return Buffer.concat(x,g)}finally{await m.close()}}import{execFile as q}from"node:child_process";import{promisify as J}from"node:util";var Ce=J(q);var Me=Object.freeze({"skills.include_instructions":!1,"skills.bundled.enabled":!1,"features.apps":!1,"features.plugins":!1,include_apps_instructions:!1}),ee=Object.freeze({"read-only":"read-only","workspace-write":"workspace-write"}),Le=Object.freeze({"codex-acp":ee,"claude-acp":Object.freeze({"read-only":"plan","workspace-write":"acceptEdits"}),opencode:Object.freeze({"read-only":"plan","workspace-write":"build"})});var te="engineeros-verifier",ne=Object.freeze({"*":"ask",read:"allow",glob:"allow",grep:"allow",list:"allow",bash:"allow",edit:"deny",task:"deny",external_directory:"deny",patch:"deny",apply_patch:"deny"});var se=Object.freeze({OPENCODE_CONFIG:"",OPENCODE_CONFIG_CONTENT:JSON.stringify({agent:{[te]:{mode:"primary",description:"Independent Goal verification with commands and no direct edits",permission:ne},plan:{permission:{"*":"ask",read:"allow",glob:"allow",grep:"allow",list:"allow",edit:"deny",bash:"deny",task:"deny",external_directory:"deny",patch:"deny",apply_patch:"deny"}}}}),OPENCODE_DISABLE_PROJECT_CONFIG:"true",OPENCODE_DISABLE_CLAUDE_CODE:"true",OPENCODE_DISABLE_EXTERNAL_SKILLS:"true"});var ze=String.raw`import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
2
2
  import path from "node:path";
3
3
  import { spawnSync } from "node:child_process";
4
4
 
@@ -215,16 +215,16 @@ export default {
215
215
  return "Patch applied:\n" + summary.join("\n");
216
216
  },
217
217
  };
218
- `;var Xe=10080*60*1e3;var Ye=new URL("../grammars/",import.meta.url);var M=`
218
+ `;var He=10080*60*1e3;var Ke=new URL("../grammars/",import.meta.url);var M=`
219
219
  (program (lexical_declaration (variable_declarator name: (identifier) @name) @definition.constant))
220
220
  (program (variable_declaration (variable_declarator name: (identifier) @name) @definition.constant))
221
221
  (program (export_statement declaration: (lexical_declaration (variable_declarator name: (identifier) @name) @definition.constant)))
222
222
  `,B=`
223
223
  (type_alias_declaration name: (type_identifier) @name) @definition.type
224
224
  (enum_declaration name: (identifier) @name) @definition.enum
225
- `,Ke={javascript:M,typescript:M+B,tsx:M+B};var Ve=40*1024*1024;var st=768*1024;var oe=new Set([".js",".jsx",".mjs",".cjs",".ts",".tsx"]),ot=new Set([...oe,".py",".go",".java",".kt",".cs",".rb",".rs"]);var rt=new RegExp([String.raw`\bassert\w*\b`,String.raw`\bexpect\w*\s*\(`,String.raw`\.should\b`,String.raw`\bpytest\.raises\b`,String.raw`\bself\.assert\w+`,String.raw`\bt\.(?:Error|Errorf|Fatal|Fatalf|Fail|FailNow)\b`,String.raw`\brequire\.\w+\(`,String.raw`\bAssert\.\w+`,String.raw`\bassert_(?:eq|ne)!`,String.raw`\bverify\s*\(`,String.raw`\bto(?:Have|Be|Equal|Contain|Match|Throw)\w*\s*\(`].join("|"),"g");var Ot=512*1024,jt=1024*1024;var Nt=10080*60*1e3,It=720*60*60*1e3;var Rt=new Set("a an and are as at be been being but by can could did do does done for from had has have how into is it its may might must need needs no not of on or our our should so than that the their them then there these they this those to too use used using very was were what when where which while who why will with would you your about after all also any before between both during each every here how just make made more most need next now once only other over same should some such take then through under until up upon via want wants well when work works".split(/\s+/));var Mt=256*1024;function _(s){return String(s||"").replace(/[\u0000-\u001f\u007f]/g,e=>`\\u${e.codePointAt(0).toString(16).padStart(4,"0")}`).replaceAll("`","'")}var re={"claude.md":"Claude Code","gemini.md":"Gemini CLI"},Lt=new Set(["agents.md",...Object.keys(re)]);var ue=50,D=4e3,G=1e3,U=8,P=1e3,pe=5e3,fe=2,F=0;async function Ut(s,e,t){let n=String(e.pattern??""),r=String(e.glob??"");if(!n)throw new Error("Pass a non-empty pattern to engineeros_grep.");if(n.length>4096||r.length>1024)throw new Error("Grep pattern or glob is too long. Use a smaller pattern and narrower glob.");if(F>=fe)throw new Error("Two workspace searches are already running. Retry after one finishes.");F+=1;let o,p;try{let f=await t();return o=new ce(new URL("./context-grep.mjs",import.meta.url),{workerData:{kind:"context-grep",workspace:s,args:e,files:f},execArgv:[],env:{},resourceLimits:{maxOldGenerationSizeMb:128,maxYoungGenerationSizeMb:16,stackSizeMb:4}}),await new Promise((d,i)=>{p=setTimeout(()=>i(new Error("Workspace search exceeded its five-second limit. Narrow the glob or simplify the regular expression.")),pe),o.once("message",m=>m.error?i(new Error(m.error)):d(m.text)),o.once("error",()=>i(new Error("Workspace search worker failed or exceeded its memory limit. Narrow the glob or pattern."))),o.once("exit",()=>i(new Error("Workspace search stopped before returning a result. Narrow the glob or pattern.")))})}finally{clearTimeout(p);try{o&&await o.terminate()}finally{F-=1}}}!le&&v?.kind==="context-grep"&&(ae.setFlagsFromString("--enable-experimental-regexp-engine-on-excessive-backtracks"),de(v.workspace,v.args,v.files).then(s=>L.postMessage({text:s}),s=>L.postMessage({error:s.message})).finally(()=>L.close()));async function de(s,e,t){let n=String(e.pattern??"");if(!n)throw new Error("Pass a non-empty pattern to engineeros_grep.");let r;try{r=new RegExp(e.regex===!0?n:n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),e.ignore_case===!0?"i":"")}catch(l){throw new Error(`The pattern is not a valid regular expression: ${l.message}`)}let o=String(e.glob||"").trim(),p=o?he(o):()=>!0,f=t.filter(p),d=[],i=0,m=0,c=0;e:for(let l=0;l<f.length;l+=U){let S=f.slice(l,l+U),C=await Promise.all(S.map(async w=>{try{return await R(s,w)}catch(y){return y.code==="WORKSPACE_READ_LIMIT"?{tooLarge:!0}:null}}));for(let w=0;w<S.length;w+=1){m+=1;let y=C[w];if(y?.tooLarge){i+=1;continue}if(!y||y.subarray(0,8192).includes(0))continue;let E=y.toString("utf8"),T=[];for(let $=0,z=1;$<=E.length;z+=1){let k=E.indexOf(`
226
- `,$),Z=k<0?E.length:k,O=E.slice($,Z).replace(/\r$/,"");if(r.test(O)&&(T.push({line:z,text:me(O,r),shortened:O.trimEnd().length>D}),c+=1),c===P||k<0)break;$=k+1}if(T.length&&d.push({path:S[w],lines:T}),c===P)break e}}let b=c===P,x=`${o?` in \`${_(o)}\``:""}`,g=`searched ${m.toLocaleString()} file(s)${i?`; ${i} file(s) over ${I/1024/1024} MB were not read`:""}`,a=["# EngineerOS Grep",""];if(o&&!f.length)return a.push(`The glob \`${_(o)}\` matched no file, so nothing was searched. A glob without a slash matches file names; name a directory as \`dir/\` or \`dir/**\`.`),a.join(`
225
+ `,qe={javascript:M,typescript:M+B,tsx:M+B};var Qe=40*1024*1024;var ot=768*1024;var re=new Set([".js",".jsx",".mjs",".cjs",".ts",".tsx"]),rt=new Set([...re,".py",".go",".java",".kt",".cs",".rb",".rs"]);var it=new RegExp([String.raw`\bassert\w*\b`,String.raw`\bexpect\w*\s*\(`,String.raw`\.should\b`,String.raw`\bpytest\.raises\b`,String.raw`\bself\.assert\w+`,String.raw`\bt\.(?:Error|Errorf|Fatal|Fatalf|Fail|FailNow)\b`,String.raw`\brequire\.\w+\(`,String.raw`\bAssert\.\w+`,String.raw`\bassert_(?:eq|ne)!`,String.raw`\bverify\s*\(`,String.raw`\bto(?:Have|Be|Equal|Contain|Match|Throw)\w*\s*\(`].join("|"),"g");var jt=512*1024,Nt=1024*1024;var Rt=10080*60*1e3,It=720*60*60*1e3;var Mt=new Set("a an and are as at be been being but by can could did do does done for from had has have how into is it its may might must need needs no not of on or our our should so than that the their them then there these they this those to too use used using very was were what when where which while who why will with would you your about after all also any before between both during each every here how just make made more most need next now once only other over same should some such take then through under until up upon via want wants well when work works".split(/\s+/));var Lt=256*1024;function _(s){return String(s||"").replace(/[\u0000-\u001f\u007f]/g,e=>`\\u${e.codePointAt(0).toString(16).padStart(4,"0")}`).replaceAll("`","'")}var ie={"claude.md":"Claude Code","gemini.md":"Gemini CLI"},Pt=new Set(["agents.md",...Object.keys(ie)]);var pe=50,D=4e3,G=1e3,U=8,P=1e3,fe=5e3,de=2,F=0;async function Xt(s,e,t){let n=String(e.pattern??""),r=String(e.glob??"");if(!n)throw new Error("Pass a non-empty pattern to engineeros_grep.");if(n.length>4096||r.length>1024)throw new Error("Grep pattern or glob is too long. Use a smaller pattern and narrower glob.");if(F>=de)throw new Error("Two workspace searches are already running. Retry after one finishes.");F+=1;let o,p;try{let f=await t();return o=new le(new URL("./context-grep.mjs",import.meta.url),{workerData:{kind:"context-grep",workspace:s,args:e,files:f},execArgv:[],env:{},resourceLimits:{maxOldGenerationSizeMb:128,maxYoungGenerationSizeMb:16,stackSizeMb:4}}),await new Promise((d,i)=>{p=setTimeout(()=>i(new Error("Workspace search exceeded its five-second limit. Narrow the glob or simplify the regular expression.")),fe),o.once("message",m=>m.error?i(new Error(m.error)):d(m.text)),o.once("error",()=>i(new Error("Workspace search worker failed or exceeded its memory limit. Narrow the glob or pattern."))),o.once("exit",()=>i(new Error("Workspace search stopped before returning a result. Narrow the glob or pattern.")))})}finally{clearTimeout(p);try{o&&await o.terminate()}finally{F-=1}}}!ue&&v?.kind==="context-grep"&&(ce.setFlagsFromString("--enable-experimental-regexp-engine-on-excessive-backtracks"),me(v.workspace,v.args,v.files).then(s=>L.postMessage({text:s}),s=>L.postMessage({error:s.message})).finally(()=>L.close()));async function me(s,e,t){let n=String(e.pattern??"");if(!n)throw new Error("Pass a non-empty pattern to engineeros_grep.");let r;try{r=new RegExp(e.regex===!0?n:n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),e.ignore_case===!0?"i":"")}catch(l){throw new Error(`The pattern is not a valid regular expression: ${l.message}`)}let o=String(e.glob||"").trim(),p=o?ge(o):()=>!0,f=t.filter(p),d=[],i=0,m=0,c=0;e:for(let l=0;l<f.length;l+=U){let S=f.slice(l,l+U),C=await Promise.all(S.map(async w=>{try{return await I(s,w)}catch(y){return y.code==="WORKSPACE_READ_LIMIT"?{tooLarge:!0}:null}}));for(let w=0;w<S.length;w+=1){m+=1;let y=C[w];if(y?.tooLarge){i+=1;continue}if(!y||y.subarray(0,8192).includes(0))continue;let E=y.toString("utf8"),O=[];for(let $=0,z=1;$<=E.length;z+=1){let k=E.indexOf(`
226
+ `,$),Z=k<0?E.length:k,T=E.slice($,Z).replace(/\r$/,"");if(r.test(T)&&(O.push({line:z,text:he(T,r),shortened:T.trimEnd().length>D}),c+=1),c===P||k<0)break;$=k+1}if(O.length&&d.push({path:S[w],lines:O}),c===P)break e}}let b=c===P,x=`${o?` in \`${_(o)}\``:""}`,g=`searched ${m.toLocaleString()} file(s)${i?`; ${i} file(s) over ${R/1024/1024} MB were not read`:""}`,a=["# EngineerOS Grep",""];if(o&&!f.length)return a.push(`The glob \`${_(o)}\` matched no file, so nothing was searched. A glob without a slash matches file names; name a directory as \`dir/\` or \`dir/**\`.`),a.join(`
227
227
  `);if(!d.length)return a.push(`No file matches \`${_(n)}\`${x} (${g}).`),a.join(`
228
- `);let H=e.output==="files"||e.output==="lines"?e.output:c<=ue?"lines":"files";if(a.push(`\`${_(n)}\`${x}: ${c.toLocaleString()} matching line(s) in ${d.length.toLocaleString()} file(s) (${g}).`),b&&a.push("Search reached the 1,000-line limit; counts may be partial. Narrow `glob` or the pattern to continue.",""),H==="files")return a.push('Narrow this with `glob`, or pass `output: "lines"` for the matching lines within the search limit.',"",...d.map(l=>`- \`${_(l.path)}\` (${l.lines.length})`)),a.join(`
228
+ `);let H=e.output==="files"||e.output==="lines"?e.output:c<=pe?"lines":"files";if(a.push(`\`${_(n)}\`${x}: ${c.toLocaleString()} matching line(s) in ${d.length.toLocaleString()} file(s) (${g}).`),b&&a.push("Search reached the 1,000-line limit; counts may be partial. Narrow `glob` or the pattern to continue.",""),H==="files")return a.push('Narrow this with `glob`, or pass `output: "lines"` for the matching lines within the search limit.',"",...d.map(l=>`- \`${_(l.path)}\` (${l.lines.length})`)),a.join(`
229
229
  `);let A=0;for(let l of d)a.push("",...l.lines.map(({line:S,text:C,shortened:w})=>(w&&(A+=1),`${l.path}:${S}: ${C}`)));return A&&a.push("",`${A} line(s) over ${D.toLocaleString()} characters (minified or generated code) are shown around their match; read the file for the rest.`),a.join(`
230
- `)}function me(s,e){let t=s.trimEnd();if(t.length<=D)return t;let n=Math.max(0,t.search(e)-Math.floor(G/3)),r=n+G;return`${n?"\u2026":""}${t.slice(n,r)}${r<t.length?"\u2026":""}`}function he(s){let e=s.replaceAll("\\","/").replace(/^\.\//,"");e.endsWith("/")&&(e+="**");let t=new RegExp(`^${X(e)}$`),n=!e.includes("/"),r=/[*?{]/.test(e)?null:`${e}/`;return o=>t.test(n?ie.posix.basename(o):o)||r!==null&&o.startsWith(r)}function X(s){let e="";for(let t=0;t<s.length;t+=1){let n=s[t];if(n==="*"&&s[t+1]==="*")t+=1,s[t+1]==="/"?(t+=1,e+="(?:.*/)?"):e+=".*";else if(n==="*")e+="[^/]*";else if(n==="?")e+="[^/]";else if(n==="{"){let r=s.indexOf("}",t);if(r<0){e+="\\{";continue}e+=`(?:${s.slice(t+1,r).split(",").map(X).join("|")})`,t=r}else e+=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}return e}export{P as GREP_MAX_MATCHES,pe as GREP_TIMEOUT_MS,Ut as boundedGrep,he as globMatcher};
230
+ `)}function he(s,e){let t=s.trimEnd();if(t.length<=D)return t;let n=Math.max(0,t.search(e)-Math.floor(G/3)),r=n+G;return`${n?"\u2026":""}${t.slice(n,r)}${r<t.length?"\u2026":""}`}function ge(s){let e=s.replaceAll("\\","/").replace(/^\.\//,"");e.endsWith("/")&&(e+="**");let t=new RegExp(`^${X(e)}$`),n=!e.includes("/"),r=/[*?{]/.test(e)?null:`${e}/`;return o=>t.test(n?ae.posix.basename(o):o)||r!==null&&o.startsWith(r)}function X(s){let e="";for(let t=0;t<s.length;t+=1){let n=s[t];if(n==="*"&&s[t+1]==="*")t+=1,s[t+1]==="/"?(t+=1,e+="(?:.*/)?"):e+=".*";else if(n==="*")e+="[^/]*";else if(n==="?")e+="[^/]";else if(n==="{"){let r=s.indexOf("}",t);if(r<0){e+="\\{";continue}e+=`(?:${s.slice(t+1,r).split(",").map(X).join("|")})`,t=r}else e+=n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}return e}export{P as GREP_MAX_MATCHES,fe as GREP_TIMEOUT_MS,Xt as boundedGrep,ge as globMatcher};