pi-agent-ide 0.8.3 → 0.8.4
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/CHANGELOG.md +6 -0
- package/dist/chunk-CM3XGY72.js +3 -0
- package/dist/{chunk-4W7GH3T7.js → chunk-Z2MNHSJ4.js} +1 -1
- package/dist/entry-34.js +1 -1
- package/dist/entry-35.js +3 -3
- package/node_modules/pi-agent-doctor/package.json +1 -1
- package/node_modules/pi-agent-documentation/package.json +1 -1
- package/node_modules/pi-agent-filesystem/package.json +7 -7
- package/node_modules/pi-agent-filesystem-image/package.json +3 -3
- package/node_modules/pi-agent-filesystem-jq/package.json +5 -5
- package/node_modules/pi-agent-filesystem-pdf/package.json +3 -3
- package/node_modules/pi-agent-filesystem-text/package.json +3 -3
- package/node_modules/pi-agent-ide-ast/package.json +13 -13
- package/node_modules/pi-agent-ide-ast/src/ast/manager.ts +13 -1
- package/node_modules/pi-agent-ide-changes/package.json +8 -8
- package/node_modules/pi-agent-ide-formatter/package.json +3 -3
- package/node_modules/pi-agent-ide-languages/package.json +2 -2
- package/node_modules/pi-agent-ide-lint/package.json +7 -7
- package/node_modules/pi-agent-ide-lsp/package.json +9 -9
- package/node_modules/pi-agent-image/package.json +2 -2
- package/node_modules/pi-agent-invariant/package.json +1 -1
- package/node_modules/pi-agent-pdf/package.json +2 -2
- package/node_modules/pi-agent-read/package.json +7 -7
- package/node_modules/pi-agent-resource/package.json +1 -1
- package/node_modules/pi-agent-search/package.json +5 -5
- package/node_modules/pi-agent-search-text/package.json +9 -9
- package/node_modules/pi-agent-text/package.json +2 -2
- package/node_modules/pi-agent-text-anchor-constant/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-exact/package.json +3 -3
- package/node_modules/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/node_modules/pi-agent-text-editor/package.json +9 -9
- package/node_modules/pi-agent-text-editor-renderer/package.json +5 -5
- package/node_modules/pi-agent-text-editor-stale-anchor/package.json +5 -5
- package/node_modules/pi-agent-tool-call-interception/package.json +2 -2
- package/node_modules/pi-agent-tool-ui/package.json +1 -1
- package/node_modules/pi-agent-web/package.json +7 -7
- package/node_modules/pi-agent-web-html/package.json +2 -2
- package/node_modules/pi-agent-web-image/package.json +3 -3
- package/node_modules/pi-agent-web-pdf/package.json +3 -3
- package/node_modules/pi-agent-web-text/package.json +3 -3
- package/package.json +35 -35
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/package.json +7 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-image/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-jq/package.json +5 -5
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-pdf/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-filesystem/plugins/pi-agent-filesystem-text/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/package.json +7 -7
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-html/package.json +2 -2
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-image/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-pdf/package.json +3 -3
- package/src/extensions/pi-agent-read/extensions/pi-agent-web/plugins/pi-agent-web-text/package.json +3 -3
- package/src/extensions/pi-agent-read/package.json +7 -7
- package/src/extensions/pi-agent-search/package.json +5 -5
- package/src/extensions/pi-agent-search/plugins/pi-agent-search-text/package.json +9 -9
- package/src/extensions/pi-agent-text-editor/package.json +9 -9
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-constant/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-exact/package.json +3 -3
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-anchor-line-hash/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-renderer/package.json +5 -5
- package/src/extensions/pi-agent-text-editor/plugins/pi-agent-text-editor-stale-anchor/package.json +5 -5
- package/src/plugins/pi-agent-ide-ast/package.json +13 -13
- package/src/plugins/pi-agent-ide-ast/src/ast/manager.ts +13 -1
- package/src/plugins/pi-agent-ide-changes/package.json +8 -8
- package/src/plugins/pi-agent-ide-formatter/package.json +3 -3
- package/src/plugins/pi-agent-ide-languages/package.json +2 -2
- package/src/plugins/pi-agent-ide-lint/package.json +7 -7
- package/src/plugins/pi-agent-ide-lsp/package.json +9 -9
- package/dist/chunk-UEVGZUII.js +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as S}from"./chunk-ZPT5D4VP.js";import{a as c}from"./chunk-EI7MMDWY.js";import{createRequire as F}from"node:module";import{Lang as y,parse as R,registerDynamicLanguage as B}from"@ast-grep/napi";var D=F(new URL("../src/plugins/pi-agent-ide-ast/src/ast/native-parser.ts",import.meta.url).href),$={bash:"@ast-grep/lang-bash",csharp:"@ast-grep/lang-csharp",dart:"@ast-grep/lang-dart",elixir:"@ast-grep/lang-elixir",go:"@ast-grep/lang-go",html:"@ast-grep/lang-html",java:"@ast-grep/lang-java",kotlin:"@ast-grep/lang-kotlin",lua:"@ast-grep/lang-lua",markdown:"@ast-grep/lang-markdown",php:"@ast-grep/lang-php",ruby:"@ast-grep/lang-ruby",scala:"@ast-grep/lang-scala",sql:"@ast-grep/lang-sql",swift:"@ast-grep/lang-swift"},O={".bash":"bash",".cs":"csharp",".css":y.Css,".less":y.Css,".scss":y.Css,".dart":"dart",".ex":"elixir",".exs":"elixir",".go":"go",".htm":"html",".html":"html",".java":"java",".kt":"kotlin",".kts":"kotlin",".lua":"lua",".md":"markdown",".mdx":"markdown",".php":"php",".rb":"ruby",".rake":"ruby",".scala":"scala",".sc":"scala",".sql":"sql",".sh":"bash",".swift":"swift"},N=!1;function q(){if(N)return;let s={};for(let[e,t]of Object.entries($))s[e]=D(t);B(s),N=!0}c(q,"ensureLanguagesRegistered");function k(s,e){let t=O[s];if(t)return q(),{rootNode:new b(R(t,e).root(),e)}}c(k,"parseNativeDocument");var b=class s{constructor(e,t){this.node=e;this.source=t}static{c(this,"NativeSyntaxNode")}get type(){return String(this.node.kind())}get text(){return this.node.text()}get isNamed(){return this.node.isNamed()}get hasError(){return this.type==="ERROR"||this.node.children().some(e=>new s(e,this.source).hasError)}get startIndex(){return C(this.source,this.node.range().start.index)}get endIndex(){return C(this.source,this.node.range().end.index)}get startPosition(){let{line:e,column:t}=this.node.range().start;return{row:e,column:t}}get endPosition(){let{line:e,column:t}=this.node.range().end;return{row:e,column:t}}get parent(){let e=this.node.parent();return e?new s(e,this.source):null}get namedChildCount(){return this.namedChildren.length}get namedChildren(){return this.node.children().filter(e=>e.isNamed()).map(e=>new s(e,this.source))}childForFieldName(e){let t=this.node.field(e);return t?new s(t,this.source):null}};function C(s,e){return Buffer.from(s).subarray(0,e).toString("utf8").length}c(C,"byteOffsetToStringIndex");import{createHash as W}from"node:crypto";import{createRequire as I}from"node:module";import L from"node:path";import*as p from"web-tree-sitter";var M=I(new URL("../src/plugins/pi-agent-ide-ast/src/ast/manager.ts",import.meta.url).href),G=new Set(["program","module"]),x=new Set(["body","consequence","alternative","handler","finalizer"]);function P(s){let{startPosition:e,endPosition:t}=s;return`${s.type}:${e.row}:${e.column}:${t.row}:${t.column}`}c(P,"siblingKey");var A,v=new Map;function U(s){switch(s){case".ts":case".tsx":case".mts":case".cts":return"tree-sitter-typescript/tree-sitter-typescript.wasm";case".js":case".jsx":case".mjs":case".cjs":return"tree-sitter-javascript/tree-sitter-javascript.wasm";case".py":case".pyi":return"tree-sitter-python/tree-sitter-python.wasm";case".rs":return"tree-sitter-rust/tree-sitter-rust.wasm";case".c":case".cc":case".hh":case".hxx":case".cpp":case".cxx":case".h":case".hpp":return"tree-sitter-cpp/tree-sitter-cpp.wasm";case".json":case".jsonc":return"tree-sitter-json/tree-sitter-json.wasm";case".yaml":case".yml":return"@tree-sitter-grammars/tree-sitter-yaml/tree-sitter-yaml.wasm";case".toml":return"@tree-sitter-grammars/tree-sitter-toml/tree-sitter-toml.wasm";default:return}}c(U,"grammarWasmPath");async function H(s){let e=U(s);if(!e)return;A??=p.Parser.init(),await A;let t=v.get(e);if(t===void 0){let a=M.resolve(e);t=p.Language.load(a),v.set(e,t)}let i=await t,o=new p.Parser;return o.setLanguage(i),o}c(H,"ensureParser");async function K(s,e,t){if(t.length===0)return;let i=s.includes("://")||L.isAbsolute(s)?s:L.resolve(e,s),o=L.extname(i).toLowerCase(),a=t.join(`
|
|
2
|
+
`),d=await H(o);if(d)try{return d.parse(a)??void 0}finally{d.delete()}return k(o,a)}c(K,"parseDocument");function E(s,e,t){let i=s.slice(Math.max(0,e-1),Math.max(0,t)).join(`
|
|
3
|
+
`);return W("sha1").update(i).digest("hex").slice(0,4).toUpperCase()}c(E,"hashScope");var w=class extends S{static{c(this,"AstScopeTextAnchor")}constructor(e,t,i,o){super(`scope-${e}-${t}${o===void 0?"":`-${o}`}`,i)}};function h(s,e,t,i){return new w(s,e,t,i)}c(h,"createScopeAnchor");var j=class{static{c(this,"AstScopeManager")}async getDocumentScopes(e,t,i){if(i.length===0)return[];let o=await K(e,t,i);if(!o)return[];let a=[];return this.collectCandidates(o.rootNode,a),this.buildEntries(a,i)}collectCandidates(e,t,i=0,o=!1){if(i>100||!e.isNamed)return;let a=e.type;if(!a||G.has(a)){for(let n of e.namedChildren)this.collectCandidates(n,t,i+1);return}let d=new Set;for(let n of x){let r=e.childForFieldName(n);if(!r?.isNamed)continue;d.add(P(r));let u=r.startPosition.row+1,m=r.endPosition.row+1,l=m-u>=3,g=[...x].some(T=>r.childForFieldName(T)!==null);l&&!g&&t.push({startLine:u,endLine:m,kind:`${a}.${n}`,fromBodyField:!0}),this.collectCandidates(r,t,i+1,!0)}if(![...x].some(n=>e.childForFieldName(n)!==null)&&!o){let n=e.startPosition.row+1,r=e.endPosition.row+1;r-n>=3&&e.namedChildren.length>0&&t.push({startLine:n,endLine:r,kind:a,fromBodyField:!1})}for(let n of e.namedChildren)d.has(P(n))||this.collectCandidates(n,t,i+1)}buildEntries(e,t){let i=new Map;for(let n of e){let r=i.get(n.startLine);(!r||n.endLine>r.endLine||n.endLine===r.endLine&&n.fromBodyField&&!r.fromBodyField)&&i.set(n.startLine,n)}let o=[...i.values()].sort((n,r)=>n.startLine-r.startLine||r.endLine-n.endLine),a=[];for(let n of o)a.some(u=>u.startLine<n.startLine&&u.endLine===n.endLine)||a.push(n);let d=new Map;for(let n of a){let r=E(t,n.startLine,n.endLine);d.set(r,(d.get(r)??0)+1)}let f=new Map;return a.map(n=>{let r=E(t,n.startLine,n.endLine),u=d.get(r)??1,m=(f.get(r)??0)+1;f.set(r,m);let l=u>1?m:void 0;return{name:n.kind,kind:n.kind,startLine:n.startLine,endLine:n.endLine,depth:a.filter(g=>g!==n&&g.startLine<=n.startLine&&g.endLine>=n.endLine&&(g.startLine<n.startLine||g.endLine>n.endLine)).length,hash:r,blockHash:r,...l!==void 0&&{occurrence:l},beginAnchor:h("begin",r,n.startLine,l),endScopeAnchor:h("end",r,n.endLine,l),scopeBeginAnchor:h("begin",r,n.startLine,l),scopeEndAnchor:h("end",r,n.endLine,l)}})}};export{O as a,K as b,j as c};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as N}from"./chunk-LEKC4GQK.js";import{a as k,b as E,c as v}from"./chunk-
|
|
1
|
+
import{b as N}from"./chunk-LEKC4GQK.js";import{a as k,b as E,c as v}from"./chunk-CM3XGY72.js";import{f as I,g as S}from"./chunk-DUUOCBS3.js";import"./chunk-T4FTT3U4.js";import"./chunk-ZPT5D4VP.js";import"./chunk-KINKBPPX.js";import{a as b}from"./chunk-ZC65Z3CK.js";import{a}from"./chunk-EI7MMDWY.js";import h from"node:path";import{readdir as Y}from"node:fs/promises";import K from"node:path";async function P(e){let n=[],t=await Y(e,{withFileTypes:!0});for(let i of t){let o=K.join(e,i.name);i.isDirectory()?n.push(...await P(o)):(i.isFile()||i.isSymbolicLink())&&n.push(o)}return n}a(P,"collectFiles");var W=new Set([...Object.keys(k),".ts",".tsx",".mts",".cts",".js",".jsx",".mjs",".cjs",".py",".pyi",".rs",".c",".cc",".hh",".hxx",".cpp",".cxx",".h",".hpp",".json",".jsonc",".yaml",".yml",".toml"]),H=new Set([".json",".jsonc",".yaml",".yml",".toml"]),j=new Set(["class_declaration","class_definition","class_specifier","enum_declaration","enum_definition","enum_item","enum_specifier","export_statement","function_declaration","function_definition","function_item","impl_item","interface_declaration","lexical_declaration","namespace_definition","mod_item","public_field_definition","method_definition","method_signature","property_signature","field_declaration","struct_item","struct_specifier","trait_item","type_alias_declaration","type_item","variable_declaration","assignment"]),X=new Set(["module","program","source_file"]),G=new Set(["import_declaration","import_from_statement","import_statement","use_declaration"]),A=new Set(["arrow_function","function_declaration","function_definition","function_item","function_expression","method_definition"]),q=new Set(["public_field_definition","variable_declarator","assignment"]),F=new Set(["field_identifier","identifier","property_identifier","shorthand_property_identifier_pattern","type_identifier"]);function w(e){return W.has(h.extname(e).toLowerCase())}a(w,"isSupportedOutlinePath");var L={failureLabel:"PEEK_FAILED",emptyReason:"no entries to peek.",recovery:['Call peek with { peers: [{ path: "path/to/file.ts" }, ...] }.']},Z={failureLabel:"AST_OUTLINE_FAILED",emptyReason:"no AST outline was produced."};function Ie(e){return S([e],Z)}a(Ie,"formatAstOutline");var M=class{constructor(n=Number.POSITIVE_INFINITY){this.maxDepth=n}static{a(this,"AstOutlineManager")}fallbackScopeManager=new v;async readFileOutline(n,t){let i=T(n,t),o=i.includes("://")?i:h.relative(t,i)||i;if(!w(i))throw new Error(`AST outline is not supported for ${o}.`);let r=await N(i);return this.readDocumentOutline(i,t,r.lines)}async readDocumentOutline(n,t,i,o){let r=T(n,t),c=r.includes("://")?r:h.relative(t,r)||r;if(!w(r))throw new Error(`AST outline is not supported for ${c}.`);let s=await E(r,t,i);if(!s)throw new Error(`No AST parser is available for ${c}.`);if(Number.isFinite(this.maxDepth)&&s.rootNode.hasError)throw new Error(`Cannot build an automatic outline from invalid syntax in ${c}.`);let u=i.join(`
|
|
2
2
|
`);for(let d=this.maxDepth;;d-=1){let l=await this.createSourceViewBlock(s.rootNode,r,c,t,i,u,h.extname(r).toLowerCase(),void 0,void 0,d);if(o===void 0||o(l)||d<=0||!Number.isFinite(d))return l}}async formatFile(n,t){let i=T(n,t),o=i.includes("://")?i:h.relative(t,i)||i;if(!w(i)){let r=await N(i);return S([z(i,o,r.lines)],L)}try{return S([await this.readFileOutline(i,t)],L)}catch(r){let c=r instanceof Error?r.message:String(r);return S([R(o,c)],L)}}async formatSymbol(n,t){let o=(await P(t)).filter(r=>w(r)).sort();for(let r of o){let c;try{c=await N(r)}catch{continue}let s;try{s=await E(r,t,c.lines)}catch{continue}if(!s)continue;let u=ee(s.rootNode,n);if(!u)continue;let d=h.relative(t,r)||r,l=await this.createSourceViewBlock(u,r,d,t,c.lines,c.content,h.extname(r).toLowerCase(),n,[`defined in: ${d}:${u.startPosition.row+1}`]);return S([l],L)}return S([R("",`symbol not found: ${n}`,"PEEK_NOT_FOUND")],L)}async createSourceViewBlock(n,t,i,o,r,c,s,u,d,l=this.maxDepth){let f=re(n,c,s,l),m=await J(this.fallbackScopeManager,t,o,r),_=Q(m),g=f.map(y=>{let p=y.sourceLine,x=p===void 0?void 0:r[p-1]??"",O=(p===void 0?void 0:_.get(p))?.map(U=>` <!-- ${U} -->`).join("")??"";return I({content:y.content,...!(p===void 0||x===void 0)&&{sourceLine:{source:t,lineNumber:p,content:x}},...O.length>0&&{suffix:O}})});return{path:i,...u!==void 0&&{heading:u},...d!==void 0&&{details:d},startLine:n.startPosition.row+1,endLine:n.endPosition.row+1,totalLines:r.length,renderedLines:g}}};function z(e,n,t){return{path:n,startLine:t.length>0?1:0,endLine:t.length,totalLines:t.length,renderedLines:t.map((i,o)=>I({content:i,sourceLine:{source:e,lineNumber:o+1,content:i}}))}}a(z,"formatUnsupportedSourceBlock");function R(e,n,t="PEEK_FAILED"){return{path:e,startLine:0,endLine:0,totalLines:0,renderedLines:[],status:"failed",error:n,code:t}}a(R,"failedSourceViewBlock");function J(e,n,t,i){return e.getDocumentScopes(n,t,i)}a(J,"getOutlineScopes");function Q(e){let n=new Map;for(let t of e){let i=n.get(t.startLine)??[];i.push(t.beginAnchor.value),n.set(t.startLine,i);let o=n.get(t.endLine)??[];o.push(t.endScopeAnchor.value),n.set(t.endLine,o)}return n}a(Q,"buildScopeMarkers");function T(e,n){return e.startsWith("ssh://")?e:e.startsWith("file://")?decodeURIComponent(e.slice(7)):h.isAbsolute(e)?e:h.resolve(n,e)}a(T,"resolvePath");function ee(e,n){let t,i=a(o=>{if(!t){if(j.has(o.type)&&te(o)===n){t=ne(o);return}for(let r of o.namedChildren)i(r)}},"visit");return i(e),t}a(ee,"findSymbol");function te(e){let n=e.childForFieldName("name");if(n&&F.has(n.type))return n.text;for(let t of e.namedChildren)if(F.has(t.type))return t.text;if(e.type==="lexical_declaration"||e.type==="variable_declaration")return e.namedChildren.find(o=>o.type==="variable_declarator")?.childForFieldName("name")?.text;if(e.type==="function_definition"){let t=e.childForFieldName("declarator");return t?B(t):void 0}}a(te,"getNodeName");function B(e){if(F.has(e.type))return e.text;for(let n of e.namedChildren){let t=B(n);if(t)return t}}a(B,"findNestedName");function ne(e){let n=e.parent;return n&&(n.type==="export_statement"||n.type==="decorated_definition"||n.type==="template_declaration")?n:e}a(ne,"unwrapDeclaration");function re(e,n,t,i){let o=[];H.has(t)?D(e,t,o,i):$(e,t,o,!1,i);let r=ie(n,e.startIndex),c=oe(n,e.endIndex),s=o.filter(l=>l.start>=r&&l.end<=c).sort((l,f)=>f.start-l.start),u=se(n,r,c);for(let l of s){let f=l.start-r,m=l.end-r,_=ae(l);u.splice(f,m-f,..._)}for(;u.length>0&&/\s/u.test(b(u.at(-1)).char);)u.pop();let d=[[]];for(let l of u)l.char===`
|
|
3
3
|
`?d.push([]):b(d.at(-1)).push(l);return d.map(l=>{let f=[...new Set(l.flatMap(m=>m.sourceLine===void 0?[]:[m.sourceLine]))];return{content:l.map(m=>m.char).join(""),...f.length===1&&{sourceLine:f[0]}}})}a(re,"renderNodeLines");function ie(e,n){return e.lastIndexOf(`
|
|
4
4
|
`,Math.max(0,n-1))+1}a(ie,"lineStartAt");function oe(e,n){let t=e.indexOf(`
|
package/dist/entry-34.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as e,c as o}from"./chunk-
|
|
1
|
+
import{b as e,c as o}from"./chunk-CM3XGY72.js";import"./chunk-ZPT5D4VP.js";import"./chunk-EI7MMDWY.js";export{o as AstScopeManager,e as parseDocument};
|
package/dist/entry-35.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import{a as Te}from"./chunk-LEKC4GQK.js";import{f as Re,g as Ae}from"./chunk-XH5WN5XA.js";import{b as Le}from"./chunk-LEJKDYCK.js";import"./chunk-6TJPMBUQ.js";import{b as P,c as Oe}from"./chunk-
|
|
1
|
+
import{a as Te}from"./chunk-LEKC4GQK.js";import{f as Re,g as Ae}from"./chunk-XH5WN5XA.js";import{b as Le}from"./chunk-LEJKDYCK.js";import"./chunk-6TJPMBUQ.js";import{b as P,c as Oe}from"./chunk-CM3XGY72.js";import{b as Ie,c as ve}from"./chunk-R2U5WXYR.js";import{a as we}from"./chunk-47SPPIXK.js";import{b as xe}from"./chunk-4DIUPEDF.js";import{a as be,b as Se}from"./chunk-VAXLSPPU.js";import{e as N}from"./chunk-I6NPILT5.js";import{e as te,f as ne}from"./chunk-T7I2VX3J.js";import{a as re}from"./chunk-YJ6T3PEP.js";import{b as Z,c as ee}from"./chunk-S72FVLUX.js";import{a as ye}from"./chunk-XXLLY66B.js";import{c as fe,d as ge,e as he}from"./chunk-235QMMVA.js";import"./chunk-NNCZYO4Q.js";import{d as de}from"./chunk-IICJXZBU.js";import{a as ae,b as ce,e as le}from"./chunk-PS2B6THP.js";import{a as ie}from"./chunk-BU7IZLKB.js";import{a as oe,b as se}from"./chunk-S5PL5DFQ.js";import{H as D,J as k,K as me,f as ue,i as pe,j as M}from"./chunk-LCWBVOII.js";import{h as Q}from"./chunk-DUUOCBS3.js";import{a as J,b as X,c as W}from"./chunk-T4FTT3U4.js";import{m as Y}from"./chunk-ZPT5D4VP.js";import"./chunk-KINKBPPX.js";import"./chunk-756K3LJY.js";import{a as K}from"./chunk-ZC65Z3CK.js";import{a as p}from"./chunk-EI7MMDWY.js";import{readFile as dt}from"node:fs/promises";var ut={cmake:"no compatible Tree-sitter parser is packaged",dockerfile:"no compatible Tree-sitter parser is packaged",julia:"no compatible Tree-sitter parser is packaged",powershell:"no compatible Tree-sitter parser is packaged",r:"no compatible Tree-sitter parser is packaged",svelte:"the container grammar is not available as an ast-grep language package",terraform:"the HCL grammar is not available as an ast-grep language package",vue:"the container grammar is not available as an ast-grep language package",xml:"no compatible Tree-sitter parser is packaged",zig:"no compatible Tree-sitter parser is packaged"},U=new Set(["c","cpp","csharp","css","dart","elixir","go","html","java","kotlin","lua","markdown","php","ruby","scala","shell","sql","swift","javascript","typescript","python","rust","json","yaml","toml"]),Ee={protocol:Z,apiVersion:ee,id:"ast",setup(t){t.addSetupCheck({id:"structural-search",async inspect(e){return[...e.detectedLanguageIds].some(o=>U.has(o))?await ve(e,"ast-grep")?{}:{actions:[{id:"ast-grep-unavailable",message:"Structural search is unavailable because ast-grep was not found"}]}:{}}}),t.addCheck({id:"parsers",title:"AST",async run(e){let n=[];for(let o of e.detectedLanguageIds){let r=ut[o];if(r!==void 0){n.push({status:"skip",message:`${o} AST is unavailable: ${r}`});continue}if(!U.has(o))continue;let s=e.files.find(i=>pt(i,o));if(s!==void 0)try{e.signal?.throwIfAborted();let i=e.workspace?await e.workspace.readText(s,e.signal):await dt(s,{encoding:"utf8",signal:e.signal});if(i===void 0)throw new Error(`Source disappeared: ${s}`);e.signal?.throwIfAborted();let a=await P(s,e.cwd,i.replaceAll(`\r
|
|
2
2
|
`,`
|
|
3
3
|
`).split(`
|
|
4
|
-
`));n.push(a===void 0?{status:"fail",message:`${o} parser did not return a tree`}:{status:"pass",message:`${o} parser loaded`,detail:s})}catch(i){e.signal?.throwIfAborted(),n.push({status:"fail",message:`${o}: ${i instanceof Error?i.message:String(i)}`})}}return n.length>0?n:[{status:"skip",message:"No supported AST files found"}]}}),t.addCheck({id:"ast-grep",title:"Structural search",async run(e){if(![...e.detectedLanguageIds].some(o=>U.has(o)))return[{status:"skip",message:"No supported structural-search files found"}];let n=await Ie(e,"ast-grep",["--version"]);return[n.ok?{status:"pass",message:"ast-grep is available",detail:n.detail}:{status:"fail",message:"ast-grep is not available",detail:n.detail}]}})}};function pt(t,e){let n=t.slice(t.lastIndexOf(".")).toLowerCase();return{c:[".c",".h"],cpp:[".cc",".cpp",".cxx",".hh",".hpp",".hxx"],csharp:[".cs"],css:[".css",".scss",".less"],dart:[".dart"],elixir:[".ex",".exs"],go:[".go"],html:[".html",".htm"],java:[".java"],kotlin:[".kt",".kts"],lua:[".lua"],markdown:[".md",".mdx"],php:[".php"],ruby:[".rb",".rake"],scala:[".scala",".sc"],shell:[".sh",".bash"],sql:[".sql"],swift:[".swift"],javascript:[".js",".jsx",".mjs",".cjs"],typescript:[".ts",".tsx",".mts",".cts"],python:[".py",".pyi"],rust:[".rs"],json:[".json",".jsonc"],yaml:[".yaml",".yml"],toml:[".toml"]}[e]?.includes(n)??!1}p(pt,"matchesLanguage");var mt,ft;function ke(t,e){return{id:"ast",tryResolve(n,o){return Promise.resolve(gt(n,o,t,e))}}}p(ke,"createAstOutlineResolver");function gt(t,e,n,o){let r;try{r=J(t,"ast")}catch(a){return{kind:"failed",error:a}}if(r===void 0)return{kind:"not-handled"};let s;try{s=X(r.path,e.cwd)}catch(a){return{kind:"failed",error:a}}let i=W("ast",s);return{kind:"resolved",resource:{source:s,link:i,async read({signal:a}){a?.throwIfAborted();let l=await(ft??=import("./chunk-
|
|
5
|
-
`))>Te)throw new Error("File exceeds the 262144-byte AST outline limit.");if(f.lines.some(g=>g.includes("\0")))throw new Error("Binary resources cannot be read as AST outlines.");u=await d.readDocumentOutline(f.source,e.cwd,f.lines)}else u=await d.readFileOutline(s,e.cwd);return a?.throwIfAborted(),[l.formatAstOutline(u)]}}}}p(gt,"resolveAstOutlineSource");import{DEFAULT_MAX_BYTES as ht,DEFAULT_MAX_LINES as yt,truncateHead as G}from"@earendil-works/pi-coding-agent";var B=p(async(t,e,n)=>{let{source:o,resolvedBy:r,lines:s,totalLines:i,startLine:a}=t.details;if(!(o===void 0||r!=="filesystem"&&!o.startsWith("ssh://")||s===void 0||s.length!==i||a!==void 0&&a!==1))try{let{AstOutlineManager:l,isSupportedOutlinePath:d}=await import("./chunk-
|
|
4
|
+
`));n.push(a===void 0?{status:"fail",message:`${o} parser did not return a tree`}:{status:"pass",message:`${o} parser loaded`,detail:s})}catch(i){e.signal?.throwIfAborted(),n.push({status:"fail",message:`${o}: ${i instanceof Error?i.message:String(i)}`})}}return n.length>0?n:[{status:"skip",message:"No supported AST files found"}]}}),t.addCheck({id:"ast-grep",title:"Structural search",async run(e){if(![...e.detectedLanguageIds].some(o=>U.has(o)))return[{status:"skip",message:"No supported structural-search files found"}];let n=await Ie(e,"ast-grep",["--version"]);return[n.ok?{status:"pass",message:"ast-grep is available",detail:n.detail}:{status:"fail",message:"ast-grep is not available",detail:n.detail}]}})}};function pt(t,e){let n=t.slice(t.lastIndexOf(".")).toLowerCase();return{c:[".c",".h"],cpp:[".cc",".cpp",".cxx",".hh",".hpp",".hxx"],csharp:[".cs"],css:[".css",".scss",".less"],dart:[".dart"],elixir:[".ex",".exs"],go:[".go"],html:[".html",".htm"],java:[".java"],kotlin:[".kt",".kts"],lua:[".lua"],markdown:[".md",".mdx"],php:[".php"],ruby:[".rb",".rake"],scala:[".scala",".sc"],shell:[".sh",".bash"],sql:[".sql"],swift:[".swift"],javascript:[".js",".jsx",".mjs",".cjs"],typescript:[".ts",".tsx",".mts",".cts"],python:[".py",".pyi"],rust:[".rs"],json:[".json",".jsonc"],yaml:[".yaml",".yml"],toml:[".toml"]}[e]?.includes(n)??!1}p(pt,"matchesLanguage");var mt,ft;function ke(t,e){return{id:"ast",tryResolve(n,o){return Promise.resolve(gt(n,o,t,e))}}}p(ke,"createAstOutlineResolver");function gt(t,e,n,o){let r;try{r=J(t,"ast")}catch(a){return{kind:"failed",error:a}}if(r===void 0)return{kind:"not-handled"};let s;try{s=X(r.path,e.cwd)}catch(a){return{kind:"failed",error:a}}let i=W("ast",s);return{kind:"resolved",resource:{source:s,link:i,async read({signal:a}){a?.throwIfAborted();let l=await(ft??=import("./chunk-Z2MNHSJ4.js")),d=n??(mt??=new l.AstOutlineManager),u;if(s.startsWith("ssh://")){if(o===void 0)throw new Error("No AST snapshot owner for this resource.");let f=await o(s,{...e,signal:a});if(Buffer.byteLength(f.lines.join(`
|
|
5
|
+
`))>Te)throw new Error("File exceeds the 262144-byte AST outline limit.");if(f.lines.some(g=>g.includes("\0")))throw new Error("Binary resources cannot be read as AST outlines.");u=await d.readDocumentOutline(f.source,e.cwd,f.lines)}else u=await d.readFileOutline(s,e.cwd);return a?.throwIfAborted(),[l.formatAstOutline(u)]}}}}p(gt,"resolveAstOutlineSource");import{DEFAULT_MAX_BYTES as ht,DEFAULT_MAX_LINES as yt,truncateHead as G}from"@earendil-works/pi-coding-agent";var B=p(async(t,e,n)=>{let{source:o,resolvedBy:r,lines:s,totalLines:i,startLine:a}=t.details;if(!(o===void 0||r!=="filesystem"&&!o.startsWith("ssh://")||s===void 0||s.length!==i||a!==void 0&&a!==1))try{let{AstOutlineManager:l,isSupportedOutlinePath:d}=await import("./chunk-Z2MNHSJ4.js");if(!d(o))return;let u=p(h=>[`Code overview of ${h.path}, source lines 1-${h.totalLines}: the requested text exceeded the output limit.`,`Some source text is omitted. Read ${JSON.stringify(o)} with offset and limit for exact source text.`,...h.renderedLines.map(b=>`${b.sourceLine?.lineNumber??"\u2026"} | ${b.text}`)].join(`
|
|
6
6
|
`),"format");e.signal?.throwIfAborted();let f=await new l(12).readDocumentOutline(o,e.cwd,s.map(h=>h.content),h=>(e.signal?.throwIfAborted(),!G(u(h),n).truncated)),g=u(f);return G(g,n).truncated?void 0:{script:t.script,content:[{type:"text",text:g}],details:{source:o,resolvedBy:"ast-overflow"}}}catch{e.signal?.throwIfAborted();return}},"reduceAstReadOutput");function Ne(){return async t=>{let{state:e,result:n}=t,o=n?.content.length===1?n.content[0]:void 0;if(t.audience==="script"||n===void 0||e?.contentKind!=="text"||e.resolvedBy!=="filesystem"&&!e.source.startsWith("ssh://")||o?.type!=="text"||!G(o.text).truncated)return{kind:"continue",context:t};let r=await B({...n,details:{...n.details,source:e.source,resolvedBy:e.resolvedBy,lines:e.text.lines,startLine:1,totalLines:e.text.lines.length}},t.resolverContext,{maxBytes:ht,maxLines:yt});return r===void 0?{kind:"continue",context:t}:{kind:"continue",context:t,transform:p(s=>({...r,script:s.script}),"transform")}}}p(Ne,"createAstOverflowHandler");var Pe="pi-agent-ast";function je(t){return{id:"ast-scopes",async present(e,n){if(n.resolvedBy!=="filesystem"&&!e.source.startsWith("ssh://"))return e;try{let o=await t.getDocumentScopes(e.source,n.cwd,e.lines.map(s=>s.content)),r=bt(e.lines,o);return r===e.lines?e:{...e,lines:r}}catch{return e}}}}p(je,"createAstScopePresenter");function Ce(){return t=>{let e=t.state,n=t.result;if(e?.contentKind!=="text"||n===void 0)return{kind:"continue",context:t};let o=n.details.lines;if(o===void 0)return{kind:"continue",context:t};let r=new Map(e.text.lines.map(u=>[u.lineNumber,u])),s=new Set(o.map(u=>u.lineNumber)),i=new Map;for(let u of o){let f=r.get(u.lineNumber),g=$e(f);for(let h of g?.boundaries??[]){if(s.has(h.endLine))continue;let b=r.get(h.endLine);b!==void 0&&i.set(h.endLine,b)}}if(i.size===0)return{kind:"continue",context:t};let a=[...i.values()].sort((u,f)=>u.lineNumber-f.lineNumber),l=[...o,...a],d=o.at(-1);return{kind:"continue",context:t,transform:p(u=>St(u,l,d),"transform")}}}p(Ce,"createAstScopePostReadHandler");function bt(t,e){if(e.length===0)return t;let n=new Map,o=new Map;for(let r of e){let s=n.get(r.startLine)??[];s.push(r.beginAnchor.value),n.set(r.startLine,s);let i=o.get(r.startLine)??[];i.push({endLine:r.endLine,beginAnchor:r.beginAnchor.value,endAnchor:r.endScopeAnchor.value}),o.set(r.startLine,i);let a=n.get(r.endLine)??[];a.push(r.endScopeAnchor.value),n.set(r.endLine,a)}return t.map(r=>{let s=n.get(r.lineNumber),i=o.get(r.lineNumber);return s===void 0&&i===void 0?r:{...r,...s!==void 0&&{anchors:[...new Set([...r.anchors??[],...s])],presentation:{...r.presentation,suffix:`${r.presentation?.suffix??""}${s.map(a=>` <!-- ${a} -->`).join("")}`}},metadata:{...r.metadata,[Pe]:{...$e(r),...i!==void 0&&{boundaries:i}}}}})}p(bt,"addScopeMarkers");function $e(t){let e=t?.metadata?.[Pe];if(!(typeof e!="object"||e===null))return e}p($e,"getAstScopeMetadata");function St(t,e,n){let o=t.content.length===1?t.content[0]:void 0;if(o?.type!=="text"||t.details.lines===void 0)return t;let r=e.slice(t.details.lines.length);if(r.length===0)return t;let s=n?.lineEnding!==void 0&&n.lineEnding.length>0?n.lineEnding:r[0]?.lineEnding!==void 0&&r[0].lineEnding.length>0?r[0].lineEnding:`
|
|
7
7
|
`,i=r.map((d,u)=>{let g=u===r.length-1?d.lineEnding:d.lineEnding||s,h=d.presentation?.prefix??"",b=d.presentation?.suffix??"";return`${h}${d.content}${b}${g}`}).join(""),a=/(?:\r\n|\r|\n)$/.test(o.text)?"":s,l=`${o.text}${a}${i}`;return{...t,content:[{...o,text:l}],details:{...t.details,lines:e}}}p(St,"appendTextLines");var _e=/^scope-(begin|end)-[A-Z0-9]{3,4}(?:-[1-9]\d*)?$/;function Me(t){return{id:"ast-scope",description:'`scope-begin-HASH` / `scope-end-HASH` from read views: ["ast"] \u2014 first/last lines of a scope. Any numeric suffix is part of the anchor.',renderFull(e){return e},renderCompact(e){return _e.exec(e)?.[1]==="begin"?"scope start":"scope end"},async tryResolve(e,n){if(!_e.test(e))return{kind:"not-handled"};try{let r=(await t.getDocumentScopes(n.source,n.cwd,n.lines)).find(s=>s.beginAnchor.value===e||s.endScopeAnchor.value===e);return r===void 0?{kind:"rejected",rejection:{code:"stale",reason:`AST scope anchor ${e} is stale`}}:{kind:"resolved",anchor:r.beginAnchor.value===e?r.beginAnchor:r.endScopeAnchor}}catch(o){return{kind:"failed",error:o}}}}}p(Me,"createAstScopeAnchorResolver");import It from"cross-spawn";import{readFile as vt,stat as Ge}from"node:fs/promises";import Lt from"node:path";import De from"node:path";import{pathToFileURL as wt}from"node:url";function Ue(t,e,n,o,r){let s=new Map;for(let a of e){let l=s.get(a.file)??[];l.push(a),s.set(a.file,l)}let i=[...s.entries()].map(([a,l])=>xt(a,l,o));return{sessionId:r,query:t,matchCount:e.length,fileCount:i.length,complete:n,files:i}}p(Ue,"createAstSearchPresentation");function xt(t,e,n){let o=new Map;e.forEach((a,l)=>{let d=a.lines.replace(/\r/gu,"").split(`
|
|
8
8
|
`);d.at(-1)===""&&d.pop();let u=`${t}:${String(l)}`;d.forEach((f,g)=>{let h=a.range.start.line+g+1,b=Rt(a,f,g,d.length);if(b===void 0)return;let w=o.get(h)??{text:f,ranges:[],logicalMatchIds:[]};w.ranges.push(b),w.logicalMatchIds.push(u),o.set(h,w)})});let r=[...o.entries()].sort(([a],[l])=>a-l).map(([a,l])=>{let d=At(l.ranges);return{lineNumber:a,text:l.text,matchCount:d.length,ranges:d,logicalMatchIds:[...new Set(l.logicalMatchIds)]}}),s=t.includes("://"),i=s?t:De.resolve(n,t);return{path:s?i:De.relative(n,i),link:s?i:wt(i).href,matchCount:e.length,lines:r}}p(xt,"createFilePresentation");function Rt(t,e,n,o){let r=n===0,s=n===o-1,i=r?t.range.start.column:0,a=s?t.range.end.column:e.length;if(!(a<=i))return{from:Math.min(i,e.length),to:Math.min(a,e.length)}}p(Rt,"highlightedRange");function At(t){let e=[...t].sort((o,r)=>o.from-r.from||o.to-r.to),n=[];for(let o of e){let r=n.at(-1);r===void 0||o.from>r.to?n.push(o):n[n.length-1]={from:r.from,to:Math.max(r.to,o.to)}}return n}p(At,"mergeRanges");function He(t){return{id:"ast",supportsResultScope:!0,readResources:p((e,n)=>e.query.startsWith("ast:")?n.scope?.targets.map(o=>o.source)??[e.path??n.cwd]:[],"readResources"),renderResult:Le,async tryResolve(e,n){if(!e.query.startsWith("ast:"))return{kind:"not-handled"};let o=e.query.slice(4).trim();if(o.length===0)return{kind:"failed",error:new Error("ast: pattern must not be empty")};let r=p(f=>n.environmentForSource?.(f)??n.environment,"owner"),s=p(async f=>{n.scope!==void 0&&await k(n.scope,f);let g=[];if(n.scope===void 0)g.push(...await Ve(o,e,n.cwd,f,n.environment));else for(let m of new Set(n.scope.targets.map(y=>y.source)))f?.throwIfAborted(),g.push(...await Ve(o,{...e,path:m},n.cwd,f,r(m)));let h=g.map(m=>({...m,file:j(n.cwd,m.file,r(m.file))}));h.sort((m,y)=>m.file.localeCompare(y.file)||m.range.byteOffset.start-y.range.byteOffset.start||m.range.byteOffset.end-y.range.byteOffset.end);let b=[];for(let m of h){let y=(await Be([m],n.cwd,f,r(m.file)))[0];if(y===void 0)throw new Error("Missing AST selection snapshot");n.scope!==void 0&&!xe(n.scope,y)||b.push({selection:y,raw:{...m,range:{...m.range,start:{line:y.lineNumber-1,column:y.startColumn},end:{line:(y.endLineNumber??y.lineNumber)-1,column:y.endColumn}}}})}let w=b.slice(0,e.limit??100);return n.scope!==void 0&&await k(n.scope,f),{raw:w.map(m=>m.raw),matches:w.map(m=>m.selection),complete:(n.scope?.complete??!0)&&b.length<=(e.limit??100)}},"collect"),i=await s(n.signal),a=await t({request:e,matches:i.matches,complete:i.complete,refresh:s},n),l=N(i.matches,i.complete,a.id,a),d=[],u=[];for(let f of i.raw.slice(0,l.matches.length)){let g=Object.entries({...Object.fromEntries(Object.entries(f.metaVariables?.single??{}).map(([w,m])=>[w,[m]])),...f.metaVariables?.multi}),h=[],b={};for(let[w,m]of g){for(let R of m)if(R.range.byteOffset.start<f.range.byteOffset.start||R.range.byteOffset.end>f.range.byteOffset.end)throw new Error("AST capture lies outside its parent match.");let y=await Be(m.map(R=>({...f,...R})),n.cwd,n.signal,r(f.file)),x=await t({request:e,matches:y,complete:i.complete,refresh:p(async()=>{throw new Error("Capture snapshots cannot refresh; repeat the AST search.")},"refresh")},n);b[w]={target:K(N(y,i.complete,void 0,x).target),nodes:y.length};let A=[];for(let R=0;R<y.length;R+=100){let E=y.slice(R,R+100),I=await t({request:e,matches:E,complete:i.complete,refresh:p(async()=>{throw new Error("Capture snapshots cannot refresh; repeat the AST search.")},"refresh")},n);A.push(...N(E,i.complete,void 0,I).matches)}h.push([w,A])}d.push(Object.fromEntries(h)),u.push(b)}return n.scope!==void 0&&await k(n.scope,n.signal),{kind:"resolved",payload:{data:{...l,matches:l.matches.map((f,g)=>({...f,captures:d[g]}))},captureGroups:u,pattern:o,matches:i.raw.map((f,g)=>({...f,selection:i.matches[g]})),complete:i.complete,sessionId:a.id,presentation:Ue(e.query,i.raw,i.complete,n.cwd,a.id)}}},toScriptData(e){return e.data},format(e){let n=e;if(n.matches.length===0)return{content:[{type:"text",text:"No AST matches found."}],details:n.presentation};let o=n.matches.flatMap((r,s)=>{let i=[`SEARCH#${n.sessionId}:${s+1}:match ${r.file}:${r.range.start.line+1}:${r.range.start.column+1} ${r.language}`,` ${r.lines.trim()}`];for(let[a,l]of Object.entries(n.captureGroups[s]??{}))i.push(` capture ${a}: ${l.target} ${l.nodes} node(s)`);return i});return n.complete&&o.unshift(`SEARCH#${n.sessionId}:all:match selects all exact AST matches.`),{content:[{type:"text",text:o.join(`
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-image": "0.8.
|
|
10
|
-
"pi-agent-invariant": "0.8.
|
|
11
|
-
"pi-agent-read": "0.8.
|
|
12
|
-
"pi-agent-resource": "0.8.
|
|
13
|
-
"pi-agent-text": "0.8.
|
|
14
|
-
"pi-agent-text-editor": "0.8.
|
|
9
|
+
"pi-agent-image": "0.8.4",
|
|
10
|
+
"pi-agent-invariant": "0.8.4",
|
|
11
|
+
"pi-agent-read": "0.8.4",
|
|
12
|
+
"pi-agent-resource": "0.8.4",
|
|
13
|
+
"pi-agent-text": "0.8.4",
|
|
14
|
+
"pi-agent-text-editor": "0.8.4"
|
|
15
15
|
},
|
|
16
16
|
"pi": {
|
|
17
17
|
"extensions": [
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-image",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#extension": "./index.ts"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-image": "0.8.
|
|
10
|
-
"pi-agent-resource": "0.8.
|
|
9
|
+
"pi-agent-image": "0.8.4",
|
|
10
|
+
"pi-agent-resource": "0.8.4"
|
|
11
11
|
},
|
|
12
12
|
"pi": {
|
|
13
13
|
"extensions": [
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-jq",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-doctor": "0.8.
|
|
10
|
-
"pi-agent-documentation": "0.8.
|
|
11
|
-
"pi-agent-read": "0.8.
|
|
12
|
-
"pi-agent-text": "0.8.
|
|
9
|
+
"pi-agent-doctor": "0.8.4",
|
|
10
|
+
"pi-agent-documentation": "0.8.4",
|
|
11
|
+
"pi-agent-read": "0.8.4",
|
|
12
|
+
"pi-agent-text": "0.8.4"
|
|
13
13
|
},
|
|
14
14
|
"pi": {
|
|
15
15
|
"extensions": [
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-pdf",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-pdf": "0.8.
|
|
7
|
-
"pi-agent-resource": "0.8.
|
|
6
|
+
"pi-agent-pdf": "0.8.4",
|
|
7
|
+
"pi-agent-resource": "0.8.4"
|
|
8
8
|
},
|
|
9
9
|
"pi": {
|
|
10
10
|
"extensions": [
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-filesystem-text",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#extension": "./index.ts"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"pi-agent-resource": "0.8.
|
|
10
|
-
"pi-agent-text": "0.8.
|
|
9
|
+
"pi-agent-resource": "0.8.4",
|
|
10
|
+
"pi-agent-text": "0.8.4"
|
|
11
11
|
},
|
|
12
12
|
"pi": {
|
|
13
13
|
"extensions": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-ide-ast",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -12,17 +12,17 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"pi-agent-doctor": "0.8.
|
|
16
|
-
"pi-agent-documentation": "0.8.
|
|
17
|
-
"pi-agent-invariant": "0.8.
|
|
18
|
-
"pi-agent-read": "0.8.
|
|
19
|
-
"pi-agent-resource": "0.8.
|
|
20
|
-
"pi-agent-search": "0.8.
|
|
21
|
-
"pi-agent-search-text": "0.8.
|
|
22
|
-
"pi-agent-text": "0.8.
|
|
23
|
-
"pi-agent-text-editor": "0.8.
|
|
24
|
-
"pi-agent-tool-call-interception": "0.8.
|
|
25
|
-
"pi-agent-tool-ui": "0.8.
|
|
15
|
+
"pi-agent-doctor": "0.8.4",
|
|
16
|
+
"pi-agent-documentation": "0.8.4",
|
|
17
|
+
"pi-agent-invariant": "0.8.4",
|
|
18
|
+
"pi-agent-read": "0.8.4",
|
|
19
|
+
"pi-agent-resource": "0.8.4",
|
|
20
|
+
"pi-agent-search": "0.8.4",
|
|
21
|
+
"pi-agent-search-text": "0.8.4",
|
|
22
|
+
"pi-agent-text": "0.8.4",
|
|
23
|
+
"pi-agent-text-editor": "0.8.4",
|
|
24
|
+
"pi-agent-tool-call-interception": "0.8.4",
|
|
25
|
+
"pi-agent-tool-ui": "0.8.4"
|
|
26
26
|
},
|
|
27
27
|
"pi": {
|
|
28
28
|
"extensions": [
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@earendil-works/pi-coding-agent": "*",
|
|
34
34
|
"@earendil-works/pi-tui": "*",
|
|
35
|
-
"pi-agent-ide": "0.8.
|
|
35
|
+
"pi-agent-ide": "0.8.4",
|
|
36
36
|
"typebox": "*"
|
|
37
37
|
},
|
|
38
38
|
"peerDependenciesMeta": {
|
|
@@ -42,6 +42,12 @@ Named AST fields that represent block-level bodies.
|
|
|
42
42
|
*/
|
|
43
43
|
const BODY_FIELDS = new Set(["body", "consequence", "alternative", "handler", "finalizer"]);
|
|
44
44
|
|
|
45
|
+
/** Identify a child among its siblings; parsers return a new wrapper object on each access. */
|
|
46
|
+
function siblingKey(node: SyntaxNode): string {
|
|
47
|
+
const { startPosition: start, endPosition: end } = node;
|
|
48
|
+
return `${node.type}:${start.row}:${start.column}:${end.row}:${end.column}`;
|
|
49
|
+
}
|
|
50
|
+
|
|
45
51
|
let initPromise: Promise<void> | undefined;
|
|
46
52
|
const loadedLanguages = new Map<string, Promise<WTS.Language>>();
|
|
47
53
|
|
|
@@ -230,6 +236,9 @@ export class AstScopeManager {
|
|
|
230
236
|
}
|
|
231
237
|
|
|
232
238
|
// 1. Collect block bodies from named fields (body, consequence, alternative, etc.)
|
|
239
|
+
// Field children are also named children; step 3 must not walk them again, or every
|
|
240
|
+
// nesting level doubles the traversal and large files freeze the session.
|
|
241
|
+
const visitedFieldChildren = new Set<string>();
|
|
233
242
|
for (const fieldName of BODY_FIELDS) {
|
|
234
243
|
const child = node.childForFieldName(fieldName);
|
|
235
244
|
|
|
@@ -237,6 +246,8 @@ export class AstScopeManager {
|
|
|
237
246
|
continue;
|
|
238
247
|
}
|
|
239
248
|
|
|
249
|
+
visitedFieldChildren.add(siblingKey(child));
|
|
250
|
+
|
|
240
251
|
const startLine = child.startPosition.row + 1;
|
|
241
252
|
const endLine = child.endPosition.row + 1;
|
|
242
253
|
const isMultiLine = endLine - startLine >= 3;
|
|
@@ -276,8 +287,9 @@ export class AstScopeManager {
|
|
|
276
287
|
}
|
|
277
288
|
}
|
|
278
289
|
|
|
279
|
-
// 3. Recurse into
|
|
290
|
+
// 3. Recurse into the remaining named children (to find nested constructs)
|
|
280
291
|
for (const child of node.namedChildren) {
|
|
292
|
+
if (visitedFieldChildren.has(siblingKey(child))) continue;
|
|
281
293
|
this.collectCandidates(child, candidates, depth + 1);
|
|
282
294
|
}
|
|
283
295
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-ide-changes",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"pi-agent-doctor": "0.8.
|
|
16
|
-
"pi-agent-documentation": "0.8.
|
|
17
|
-
"pi-agent-invariant": "0.8.
|
|
18
|
-
"pi-agent-read": "0.8.
|
|
19
|
-
"pi-agent-resource": "0.8.
|
|
20
|
-
"pi-agent-text": "0.8.
|
|
21
|
-
"pi-agent-text-editor": "0.8.
|
|
15
|
+
"pi-agent-doctor": "0.8.4",
|
|
16
|
+
"pi-agent-documentation": "0.8.4",
|
|
17
|
+
"pi-agent-invariant": "0.8.4",
|
|
18
|
+
"pi-agent-read": "0.8.4",
|
|
19
|
+
"pi-agent-resource": "0.8.4",
|
|
20
|
+
"pi-agent-text": "0.8.4",
|
|
21
|
+
"pi-agent-text-editor": "0.8.4"
|
|
22
22
|
},
|
|
23
23
|
"pi": {
|
|
24
24
|
"extensions": [
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-ide-formatter",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-doctor": "0.8.
|
|
6
|
+
"pi-agent-doctor": "0.8.4"
|
|
7
7
|
},
|
|
8
8
|
"pi": {
|
|
9
9
|
"extensions": [
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
14
|
"@earendil-works/pi-coding-agent": "*",
|
|
15
|
-
"pi-agent-ide": "0.8.
|
|
15
|
+
"pi-agent-ide": "0.8.4"
|
|
16
16
|
},
|
|
17
17
|
"peerDependenciesMeta": {
|
|
18
18
|
"pi-agent-ide": {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-ide-lint",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-doctor": "0.8.
|
|
7
|
-
"pi-agent-invariant": "0.8.
|
|
8
|
-
"pi-agent-read": "0.8.
|
|
9
|
-
"pi-agent-resource": "0.8.
|
|
10
|
-
"pi-agent-text": "0.8.
|
|
6
|
+
"pi-agent-doctor": "0.8.4",
|
|
7
|
+
"pi-agent-invariant": "0.8.4",
|
|
8
|
+
"pi-agent-read": "0.8.4",
|
|
9
|
+
"pi-agent-resource": "0.8.4",
|
|
10
|
+
"pi-agent-text": "0.8.4"
|
|
11
11
|
},
|
|
12
12
|
"pi": {
|
|
13
13
|
"extensions": [
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
},
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"@earendil-works/pi-coding-agent": "*",
|
|
19
|
-
"pi-agent-ide": "0.8.
|
|
19
|
+
"pi-agent-ide": "0.8.4"
|
|
20
20
|
},
|
|
21
21
|
"peerDependenciesMeta": {
|
|
22
22
|
"pi-agent-ide": {
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-ide-lsp",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"pi-agent-doctor": "0.8.
|
|
7
|
-
"pi-agent-invariant": "0.8.
|
|
8
|
-
"pi-agent-read": "0.8.
|
|
9
|
-
"pi-agent-resource": "0.8.
|
|
10
|
-
"pi-agent-search": "0.8.
|
|
11
|
-
"pi-agent-text": "0.8.
|
|
12
|
-
"pi-agent-text-editor": "0.8.
|
|
6
|
+
"pi-agent-doctor": "0.8.4",
|
|
7
|
+
"pi-agent-invariant": "0.8.4",
|
|
8
|
+
"pi-agent-read": "0.8.4",
|
|
9
|
+
"pi-agent-resource": "0.8.4",
|
|
10
|
+
"pi-agent-search": "0.8.4",
|
|
11
|
+
"pi-agent-text": "0.8.4",
|
|
12
|
+
"pi-agent-text-editor": "0.8.4"
|
|
13
13
|
},
|
|
14
14
|
"pi": {
|
|
15
15
|
"extensions": [
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@earendil-works/pi-coding-agent": "*",
|
|
21
|
-
"pi-agent-ide": "0.8.
|
|
21
|
+
"pi-agent-ide": "0.8.4"
|
|
22
22
|
},
|
|
23
23
|
"peerDependenciesMeta": {
|
|
24
24
|
"pi-agent-ide": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-image",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./src/index.ts",
|
|
6
6
|
"exports": {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"pi-agent-resource": "0.8.
|
|
13
|
+
"pi-agent-resource": "0.8.4"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
16
|
"@earendil-works/pi-coding-agent": "*"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-pdf",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./src/index.ts",
|
|
6
6
|
"exports": {
|
|
@@ -10,6 +10,6 @@
|
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"pi-agent-resource": "0.8.
|
|
13
|
+
"pi-agent-resource": "0.8.4"
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-read",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"pi-agent-documentation": "0.8.
|
|
28
|
-
"pi-agent-invariant": "0.8.
|
|
29
|
-
"pi-agent-resource": "0.8.
|
|
30
|
-
"pi-agent-text": "0.8.
|
|
31
|
-
"pi-agent-tool-call-interception": "0.8.
|
|
32
|
-
"pi-agent-tool-ui": "0.8.
|
|
27
|
+
"pi-agent-documentation": "0.8.4",
|
|
28
|
+
"pi-agent-invariant": "0.8.4",
|
|
29
|
+
"pi-agent-resource": "0.8.4",
|
|
30
|
+
"pi-agent-text": "0.8.4",
|
|
31
|
+
"pi-agent-tool-call-interception": "0.8.4",
|
|
32
|
+
"pi-agent-tool-ui": "0.8.4"
|
|
33
33
|
},
|
|
34
34
|
"pi": {
|
|
35
35
|
"extensions": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-search",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"pi-agent-documentation": "0.8.
|
|
24
|
-
"pi-agent-resource": "0.8.
|
|
25
|
-
"pi-agent-tool-call-interception": "0.8.
|
|
26
|
-
"pi-agent-tool-ui": "0.8.
|
|
23
|
+
"pi-agent-documentation": "0.8.4",
|
|
24
|
+
"pi-agent-resource": "0.8.4",
|
|
25
|
+
"pi-agent-tool-call-interception": "0.8.4",
|
|
26
|
+
"pi-agent-tool-ui": "0.8.4"
|
|
27
27
|
},
|
|
28
28
|
"pi": {
|
|
29
29
|
"extensions": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-search-text",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"imports": {
|
|
6
6
|
"#src/*": "./src/*"
|
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"pi-agent-doctor": "0.8.
|
|
28
|
-
"pi-agent-invariant": "0.8.
|
|
29
|
-
"pi-agent-read": "0.8.
|
|
30
|
-
"pi-agent-resource": "0.8.
|
|
31
|
-
"pi-agent-search": "0.8.
|
|
32
|
-
"pi-agent-text": "0.8.
|
|
33
|
-
"pi-agent-text-editor": "0.8.
|
|
34
|
-
"pi-agent-tool-ui": "0.8.
|
|
27
|
+
"pi-agent-doctor": "0.8.4",
|
|
28
|
+
"pi-agent-invariant": "0.8.4",
|
|
29
|
+
"pi-agent-read": "0.8.4",
|
|
30
|
+
"pi-agent-resource": "0.8.4",
|
|
31
|
+
"pi-agent-search": "0.8.4",
|
|
32
|
+
"pi-agent-text": "0.8.4",
|
|
33
|
+
"pi-agent-text-editor": "0.8.4",
|
|
34
|
+
"pi-agent-tool-ui": "0.8.4"
|
|
35
35
|
},
|
|
36
36
|
"pi": {
|
|
37
37
|
"extensions": [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-agent-text",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./src/index.ts",
|
|
6
6
|
"imports": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"pi-agent-resource": "0.8.
|
|
16
|
+
"pi-agent-resource": "0.8.4"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"typebox": "*"
|