@aistastudio/myc 0.3.0 → 0.3.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/README.md +32 -15
- package/dist/code_index_worker.ts +1 -1
- package/dist/myc.js +558 -531
- package/dist/worker.ts +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ Installation is one command:
|
|
|
31
31
|
|
|
32
32
|
```bash
|
|
33
33
|
bun install -g @aistastudio/myc # 3.20 MB, 10 files, no models pulled at install
|
|
34
|
-
myc --version # myc 0.3.
|
|
34
|
+
myc --version # myc 0.3.2 (schema 1)
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
The embedding model is **not** downloaded during install. Semantic search is
|
|
@@ -103,11 +103,27 @@ attempted, so exceeding the hook's timeout costs the summary, not the record:
|
|
|
103
103
|
|
|
104
104
|
```
|
|
105
105
|
$ myc absorb-session --reason manual --transcript … --agent claude
|
|
106
|
-
# myc:
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
# myc: context is being compacted — here is what must not be lost
|
|
107
|
+
episode sess-5jh8je4g050m saved (265 B)
|
|
108
|
+
NEXT myc show sess-5jh8je4g050m · myc ready --claim
|
|
109
109
|
```
|
|
110
110
|
|
|
111
|
+
**A status line with what the agent cannot see.** `myc wire --status-line`
|
|
112
|
+
puts one line under Claude Code's prompt — how full the context is, the task
|
|
113
|
+
queue, the code index, the project's memory, and how many of this session's
|
|
114
|
+
calls to myc actually returned something:
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
myc │ ctx 42% │ 61 ready · 34 blocked │ 612 files · 4268 symbols · 1h ago │ 101 notes │ 600/653 useful calls
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
"Useful" is counted from the host's own transcript, not guessed: an error, a
|
|
121
|
+
refusal or an empty answer is a call, not a useful one. It is opt-in — `wire`
|
|
122
|
+
without the flag never touches `statusLine` — and it does not evict a line that
|
|
123
|
+
was there before: the previous command (a status line some other tool relies
|
|
124
|
+
on) keeps receiving the same input and is never waited on or killed. A render
|
|
125
|
+
took 34 ms at the median in the run of 2026-09-10.
|
|
126
|
+
|
|
111
127
|
**Memory is separated by session, and the separation is visible.** Every note
|
|
112
128
|
carries a reach: `session` (this conversation) or `project` (everyone). The
|
|
113
129
|
automatic context packet — `prime` — only carries the current session's notes;
|
|
@@ -117,9 +133,10 @@ marks each row for what it is: `ses` own session, `ses*` someone else's, `prj`
|
|
|
117
133
|
project-wide.
|
|
118
134
|
|
|
119
135
|
```
|
|
120
|
-
$ MYC_SESSION_ID=s1 myc recall "
|
|
121
|
-
|
|
122
|
-
|
|
136
|
+
$ MYC_SESSION_ID=s1 myc recall "retries" $ MYC_SESSION_ID=s2 myc recall "retries"
|
|
137
|
+
… prj project note: retries use jitter … prj project note: retries use jitter
|
|
138
|
+
… ses session note: retries back off… … ses* session note: retries back off…
|
|
139
|
+
3 of 3 · bm25 only 3 of 3 · bm25 only · 2 from other sessions
|
|
123
140
|
```
|
|
124
141
|
|
|
125
142
|
**Memory has three independent axes**, and the surface says what it hid:
|
|
@@ -155,20 +172,20 @@ is treated as absent.
|
|
|
155
172
|
## Roadmap
|
|
156
173
|
|
|
157
174
|
Numbers are closed/total subtasks per milestone (`myc show <epic-id>`), as of
|
|
158
|
-
2026-09-
|
|
175
|
+
2026-09-10. Done and not-done are shown the same way on purpose. Totals grow
|
|
159
176
|
when work uncovers work: M0 went 33 → 39 because measuring it found four real
|
|
160
177
|
defects, not because the plan changed.
|
|
161
178
|
|
|
162
179
|
| milestone | status |
|
|
163
180
|
|---|---|
|
|
164
|
-
| **M0** core and tasks |
|
|
181
|
+
| **M0** core and tasks | 40 / 43 |
|
|
165
182
|
| **M0.5** self-hosting (myc developed through myc) | **4 / 4 — closed** |
|
|
166
|
-
| **M1** memory |
|
|
167
|
-
| **M2** semantics |
|
|
168
|
-
| **M7** human interface (board, cards, threads, routing panel) |
|
|
169
|
-
| **M3** code intelligence |
|
|
183
|
+
| **M1** memory | 22 / 24 |
|
|
184
|
+
| **M2** semantics | 20 / 22 |
|
|
185
|
+
| **M7** human interface (board, cards, threads, routing panel, status line) | **15 / 15** |
|
|
186
|
+
| **M3** code intelligence | 6 / 10 |
|
|
170
187
|
| **M4** team: `myc serve`, ACL, network sync, Postgres, containers | 3 / 14 |
|
|
171
|
-
| **M5** swarm self-learning: routing by cost and outcome | 0 /
|
|
188
|
+
| **M5** swarm self-learning: routing by cost and outcome | 0 / 13 |
|
|
172
189
|
| **M6** distillation | 0 / 7 |
|
|
173
190
|
|
|
174
191
|
What that means in practice: **today myc is a single-user local tool over files
|
|
@@ -184,7 +201,7 @@ tree-sitter, with grammars fetched on demand rather than shipped (all 36 weigh
|
|
|
184
201
|
myc code symbol <name> where it is defined, and what knowledge is anchored there
|
|
185
202
|
myc callers <name> who calls it; --direction out, --depth all
|
|
186
203
|
myc code search "…" by meaning, when you do not know the name
|
|
187
|
-
myc code grep "<lit>" exhaustive,
|
|
204
|
+
myc code grep "<lit>" exhaustive, every occurrence; --in <path> narrows it
|
|
188
205
|
myc skeleton <file> the file's API — 26× cheaper than reading it
|
|
189
206
|
```
|
|
190
207
|
|
|
@@ -3,4 +3,4 @@ var N0=Object.create;var{getPrototypeOf:I0,defineProperty:H0,getOwnPropertyNames
|
|
|
3
3
|
`)[0],R=V.match(QUERY_WORD_REGEX)[0],T;switch(K){case 2:T=RangeError(`Bad node name '${R}'`);break;case 3:T=RangeError(`Bad field name '${R}'`);break;case 4:T=RangeError(`Bad capture name @${R}`);break;case 5:T=TypeError(`Bad pattern structure at offset ${D}: '${V}'...`),R="";break;default:T=SyntaxError(`Bad syntax at offset ${D}: '${V}'...`),R="";break}throw T.index=D,T.length=R.length,C._free($),T}let q=C._ts_query_string_count(J),H=C._ts_query_capture_count(J),U=C._ts_query_pattern_count(J),Y=Array(H),j=Array(q);for(let K=0;K<H;K++){let w=C._ts_query_capture_name_for_id(J,K,TRANSFER_BUFFER),D=getValue(TRANSFER_BUFFER,"i32");Y[K]=UTF8ToString(w,D)}for(let K=0;K<q;K++){let w=C._ts_query_string_value_for_id(J,K,TRANSFER_BUFFER),D=getValue(TRANSFER_BUFFER,"i32");j[K]=UTF8ToString(w,D)}let W=Array(U),k=Array(U),F=Array(U),z=Array(U),G=Array(U);for(let K=0;K<U;K++){let w=C._ts_query_predicates_for_pattern(J,K,TRANSFER_BUFFER),D=getValue(TRANSFER_BUFFER,"i32");z[K]=[],G[K]=[];let V=[],R=w;for(let T=0;T<D;T++){let S=getValue(R,"i32");R+=SIZE_OF_INT;let b=getValue(R,"i32");if(R+=SIZE_OF_INT,S===PREDICATE_STEP_TYPE_CAPTURE)V.push({type:"capture",name:Y[b]});else if(S===PREDICATE_STEP_TYPE_STRING)V.push({type:"string",value:j[b]});else if(V.length>0){if(V[0].type!=="string")throw Error("Predicates must begin with a literal value");let L=V[0].value,E=!0,h=!0,N;switch(L){case"any-not-eq?":case"not-eq?":E=!1;case"any-eq?":case"eq?":if(V.length!==3)throw Error(`Wrong number of arguments to \`#${L}\` predicate. Expected 2, got ${V.length-1}`);if(V[1].type!=="capture")throw Error(`First argument of \`#${L}\` predicate must be a capture. Got "${V[1].value}"`);if(h=!L.startsWith("any-"),V[2].type==="capture"){let B=V[1].name,_=V[2].name;G[K].push((A)=>{let O=[],I=[];for(let P of A){if(P.name===B)O.push(P.node);if(P.name===_)I.push(P.node)}let M=(P,f,v0)=>v0?P.text===f.text:P.text!==f.text;return h?O.every((P)=>I.some((f)=>M(P,f,E))):O.some((P)=>I.some((f)=>M(P,f,E)))})}else{N=V[1].name;let B=V[2].value,_=(O)=>O.text===B,A=(O)=>O.text!==B;G[K].push((O)=>{let I=[];for(let P of O)if(P.name===N)I.push(P.node);let M=E?_:A;return h?I.every(M):I.some(M)})}break;case"any-not-match?":case"not-match?":E=!1;case"any-match?":case"match?":if(V.length!==3)throw Error(`Wrong number of arguments to \`#${L}\` predicate. Expected 2, got ${V.length-1}.`);if(V[1].type!=="capture")throw Error(`First argument of \`#${L}\` predicate must be a capture. Got "${V[1].value}".`);if(V[2].type!=="string")throw Error(`Second argument of \`#${L}\` predicate must be a string. Got @${V[2].value}.`);N=V[1].name;let y=new RegExp(V[2].value);h=!L.startsWith("any-"),G[K].push((B)=>{let _=[];for(let O of B)if(O.name===N)_.push(O.node.text);let A=(O,I)=>I?y.test(O):!y.test(O);if(_.length===0)return!E;return h?_.every((O)=>A(O,E)):_.some((O)=>A(O,E))});break;case"set!":if(V.length<2||V.length>3)throw Error(`Wrong number of arguments to \`#set!\` predicate. Expected 1 or 2. Got ${V.length-1}.`);if(V.some((B)=>B.type!=="string"))throw Error('Arguments to `#set!` predicate must be a strings.".');if(!W[K])W[K]={};W[K][V[1].value]=V[2]?V[2].value:null;break;case"is?":case"is-not?":if(V.length<2||V.length>3)throw Error(`Wrong number of arguments to \`#${L}\` predicate. Expected 1 or 2. Got ${V.length-1}.`);if(V.some((B)=>B.type!=="string"))throw Error(`Arguments to \`#${L}\` predicate must be a strings.".`);let x=L==="is?"?k:F;if(!x[K])x[K]={};x[K][V[1].value]=V[2]?V[2].value:null;break;case"not-any-of?":E=!1;case"any-of?":if(V.length<2)throw Error(`Wrong number of arguments to \`#${L}\` predicate. Expected at least 1. Got ${V.length-1}.`);if(V[1].type!=="capture")throw Error(`First argument of \`#${L}\` predicate must be a capture. Got "${V[1].value}".`);for(let B=2;B<V.length;B++)if(V[B].type!=="string")throw Error(`Arguments to \`#${L}\` predicate must be a strings.".`);N=V[1].name;let q0=V.slice(2).map((B)=>B.value);G[K].push((B)=>{let _=[];for(let A of B)if(A.name===N)_.push(A.node.text);if(_.length===0)return!E;return _.every((A)=>q0.includes(A))===E});break;default:z[K].push({operator:L,operands:V.slice(1)})}V.length=0}}Object.freeze(W[K]),Object.freeze(k[K]),Object.freeze(F[K])}return C._free($),new Query(INTERNAL,J,Y,G,z,Object.freeze(W),Object.freeze(k),Object.freeze(F))}static load(Q){let Z;if(Q instanceof Uint8Array)Z=Promise.resolve(Q);else{let $=Q;if(typeof process<"u"&&process.versions&&process.versions.node){let J=t("fs");Z=Promise.resolve(J.readFileSync($))}else Z=fetch($).then((J)=>J.arrayBuffer().then((q)=>{if(J.ok)return new Uint8Array(q);else{let H=new TextDecoder("utf-8").decode(q);throw Error(`Language.load failed with status ${J.status}.
|
|
4
4
|
|
|
5
5
|
${H}`)}}))}return Z.then(($)=>loadWebAssemblyModule($,{loadAsync:!0})).then(($)=>{let J=Object.keys($),q=J.find((U)=>LANGUAGE_FUNCTION_REGEX.test(U)&&!U.includes("external_scanner_"));if(!q)console.log(`Couldn't find language function in WASM file. Symbols:
|
|
6
|
-
${JSON.stringify(J,null,2)}`);let H=$[q]();return new Language(INTERNAL,H)})}}class LookaheadIterable{constructor(Q,Z,$){assertInternal(Q),this[0]=Z,this.language=$}get currentTypeId(){return C._ts_lookahead_iterator_current_symbol(this[0])}get currentType(){return this.language.types[this.currentTypeId]||"ERROR"}delete(){C._ts_lookahead_iterator_delete(this[0]),this[0]=0}resetState(Q){return C._ts_lookahead_iterator_reset_state(this[0],Q)}reset(Q,Z){if(C._ts_lookahead_iterator_reset(this[0],Q[0],Z))return this.language=Q,!0;return!1}[Symbol.iterator](){let Q=this;return{next(){if(C._ts_lookahead_iterator_next(Q[0]))return{done:!1,value:Q.currentType};return{done:!0,value:""}}}}}class Query{constructor(Q,Z,$,J,q,H,U,Y){assertInternal(Q),this[0]=Z,this.captureNames=$,this.textPredicates=J,this.predicates=q,this.setProperties=H,this.assertedProperties=U,this.refutedProperties=Y,this.exceededMatchLimit=!1}delete(){C._ts_query_delete(this[0]),this[0]=0}matches(Q,{startPosition:Z=ZERO_POINT,endPosition:$=ZERO_POINT,startIndex:J=0,endIndex:q=0,matchLimit:H=4294967295,maxStartDepth:U=4294967295,timeoutMicros:Y=0}={}){if(typeof H!=="number")throw Error("Arguments must be numbers");marshalNode(Q),C._ts_query_matches_wasm(this[0],Q.tree[0],Z.row,Z.column,$.row,$.column,J,q,H,U,Y);let j=getValue(TRANSFER_BUFFER,"i32"),W=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),k=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),F=Array(j);this.exceededMatchLimit=Boolean(k);let z=0,G=W;for(let K=0;K<j;K++){let w=getValue(G,"i32");G+=SIZE_OF_INT;let D=getValue(G,"i32");G+=SIZE_OF_INT;let V=Array(D);if(G=unmarshalCaptures(this,Q.tree,G,V),this.textPredicates[w].every((R)=>R(V))){F[z]={pattern:w,captures:V};let R=this.setProperties[w];if(R)F[z].setProperties=R;let T=this.assertedProperties[w];if(T)F[z].assertedProperties=T;let S=this.refutedProperties[w];if(S)F[z].refutedProperties=S;z++}}return F.length=z,C._free(W),F}captures(Q,{startPosition:Z=ZERO_POINT,endPosition:$=ZERO_POINT,startIndex:J=0,endIndex:q=0,matchLimit:H=4294967295,maxStartDepth:U=4294967295,timeoutMicros:Y=0}={}){if(typeof H!=="number")throw Error("Arguments must be numbers");marshalNode(Q),C._ts_query_captures_wasm(this[0],Q.tree[0],Z.row,Z.column,$.row,$.column,J,q,H,U,Y);let j=getValue(TRANSFER_BUFFER,"i32"),W=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),k=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),F=[];this.exceededMatchLimit=Boolean(k);let z=[],G=W;for(let K=0;K<j;K++){let w=getValue(G,"i32");G+=SIZE_OF_INT;let D=getValue(G,"i32");G+=SIZE_OF_INT;let V=getValue(G,"i32");if(G+=SIZE_OF_INT,z.length=D,G=unmarshalCaptures(this,Q.tree,G,z),this.textPredicates[w].every((R)=>R(z))){let R=z[V],T=this.setProperties[w];if(T)R.setProperties=T;let S=this.assertedProperties[w];if(S)R.assertedProperties=S;let b=this.refutedProperties[w];if(b)R.refutedProperties=b;F.push(R)}}return C._free(W),F}predicatesForPattern(Q){return this.predicates[Q]}disableCapture(Q){let Z=lengthBytesUTF8(Q),$=C._malloc(Z+1);stringToUTF8(Q,$,Z+1),C._ts_query_disable_capture(this[0],$,Z),C._free($)}didExceedMatchLimit(){return this.exceededMatchLimit}}function getText(Q,Z,$){let J=$-Z,q=Q.textCallback(Z,null,$);Z+=q.length;while(Z<$){let H=Q.textCallback(Z,null,$);if(H&&H.length>0)Z+=H.length,q+=H;else break}if(Z>$)q=q.slice(0,J);return q}function unmarshalCaptures(Q,Z,$,J){for(let q=0,H=J.length;q<H;q++){let U=getValue($,"i32");$+=SIZE_OF_INT;let Y=unmarshalNode(Z,$);$+=SIZE_OF_NODE,J[q]={name:Q.captureNames[U],node:Y}}return $}function assertInternal(Q){if(Q!==INTERNAL)throw Error("Illegal constructor")}function isPoint(Q){return Q&&typeof Q.row==="number"&&typeof Q.column==="number"}function marshalNode(Q){let Z=TRANSFER_BUFFER;setValue(Z,Q.id,"i32"),Z+=SIZE_OF_INT,setValue(Z,Q.startIndex,"i32"),Z+=SIZE_OF_INT,setValue(Z,Q.startPosition.row,"i32"),Z+=SIZE_OF_INT,setValue(Z,Q.startPosition.column,"i32"),Z+=SIZE_OF_INT,setValue(Z,Q[0],"i32")}function unmarshalNode(Q,Z=TRANSFER_BUFFER){let $=getValue(Z,"i32");if(Z+=SIZE_OF_INT,$===0)return null;let J=getValue(Z,"i32");Z+=SIZE_OF_INT;let q=getValue(Z,"i32");Z+=SIZE_OF_INT;let H=getValue(Z,"i32");Z+=SIZE_OF_INT;let U=getValue(Z,"i32"),Y=new Node(INTERNAL,Q);return Y.id=$,Y.startIndex=J,Y.startPosition={row:q,column:H},Y[0]=U,Y}function marshalTreeCursor(Q,Z=TRANSFER_BUFFER){setValue(Z+0*SIZE_OF_INT,Q[0],"i32"),setValue(Z+1*SIZE_OF_INT,Q[1],"i32"),setValue(Z+2*SIZE_OF_INT,Q[2],"i32"),setValue(Z+3*SIZE_OF_INT,Q[3],"i32")}function unmarshalTreeCursor(Q){Q[0]=getValue(TRANSFER_BUFFER+0*SIZE_OF_INT,"i32"),Q[1]=getValue(TRANSFER_BUFFER+1*SIZE_OF_INT,"i32"),Q[2]=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),Q[3]=getValue(TRANSFER_BUFFER+3*SIZE_OF_INT,"i32")}function marshalPoint(Q,Z){setValue(Q,Z.row,"i32"),setValue(Q+SIZE_OF_INT,Z.column,"i32")}function unmarshalPoint(Q){return{row:getValue(Q,"i32")>>>0,column:getValue(Q+SIZE_OF_INT,"i32")>>>0}}function marshalRange(Q,Z){marshalPoint(Q,Z.startPosition),Q+=SIZE_OF_POINT,marshalPoint(Q,Z.endPosition),Q+=SIZE_OF_POINT,setValue(Q,Z.startIndex,"i32"),Q+=SIZE_OF_INT,setValue(Q,Z.endIndex,"i32"),Q+=SIZE_OF_INT}function unmarshalRange(Q){let Z={};return Z.startPosition=unmarshalPoint(Q),Q+=SIZE_OF_POINT,Z.endPosition=unmarshalPoint(Q),Q+=SIZE_OF_POINT,Z.startIndex=getValue(Q,"i32")>>>0,Q+=SIZE_OF_INT,Z.endIndex=getValue(Q,"i32")>>>0,Z}function marshalEdit(Q){let Z=TRANSFER_BUFFER;marshalPoint(Z,Q.startPosition),Z+=SIZE_OF_POINT,marshalPoint(Z,Q.oldEndPosition),Z+=SIZE_OF_POINT,marshalPoint(Z,Q.newEndPosition),Z+=SIZE_OF_POINT,setValue(Z,Q.startIndex,"i32"),Z+=SIZE_OF_INT,setValue(Z,Q.oldEndIndex,"i32"),Z+=SIZE_OF_INT,setValue(Z,Q.newEndIndex,"i32"),Z+=SIZE_OF_INT}for(let Q of Object.getOwnPropertyNames(ParserImpl.prototype))Object.defineProperty(Parser.prototype,Q,{value:ParserImpl.prototype[Q],enumerable:!1,writable:!1});Parser.Language=Language,X.onRuntimeInitialized=()=>{ParserImpl.init(),resolveInitPromise()}})}}return Parser}();if(typeof m==="object")g.exports=m0});var d=g0(Y0(),1);import{delimiter as OQ,join as t0}from"path";import{existsSync as FQ,statSync as p0}from"fs";import{homedir as u0}from"os";import{delimiter as V0,dirname as c,join as u}from"path";import{fileURLToPath as a}from"url";var s={"web-tree-sitter":"0.24.7","tree-sitter-wasms":"0.1.13"};var l0=s["tree-sitter-wasms"];function i0(Q){return`https://cdn.jsdelivr.net/npm/tree-sitter-wasms@${l0}/out/tree-sitter-${Q}.wasm`}function p(Q,Z,$,J){return{name:Q,file:`tree-sitter-${Q}.wasm`,url:i0(Q),sha256:Z,bytes:$,langs:J}}var K0={typescript:p("typescript","8515404dceed38e1ed86aa34b09fcf3379fff1b4ff9dd3967bcd6d1eb5ac3d8f",2342690,["ts"]),tsx:p("tsx","6aa3b2c70e76f5d48eafef1093e9c4de383e13f2fdde2f4e9b98a378f6a8f1b6",2411272,["tsx"]),javascript:p("javascript","63812b9e275d26851264734868d27a1656bd44a2ef6eb3e85e6b03728c595ab5",647334,["js","jsx"]),python:p("python","9056d0fb0c337810d019fae350e8167786119da98f0f282aceae7ab89ee8253b",476105,["py"])},n0=(()=>{let Q={};for(let Z of Object.values(K0))for(let $ of Z.langs)Q[$]=Z.name;return Q})();function e(Q){let Z=n0[Q];if(Z===void 0)throw Error(`\u043D\u0435\u0442 \u0433\u0440\u0430\u043C\u043C\u0430\u0442\u0438\u043A\u0438 \u0434\u043B\u044F \u044F\u0437\u044B\u043A\u0430 "${Q}"`);return K0[Z]}function o0(Q=process.env){let Z=Q.MYC_GRAMMARS_DIR;if(Z!==void 0&&Z!=="")return Z;return u(u0(),".cache","myc","grammars")}function j0(Q){try{return u(c(a(import.meta.url)),"..","vendor",Q)}catch{return null}}function d0(){try{let Q=Bun.resolveSync("tree-sitter-wasms/package.json",c(a(import.meta.url)));return u(c(Q),"out")}catch{return null}}function Q0(Q=process.env){let Z=Q.MYC_TREE_SITTER_GRAMMAR_DIR;if(Z!==void 0&&Z!=="")return Z.split(V0).filter((H)=>H.length>0);let $=[o0(Q)],J=j0("tree-sitter-grammars");if(J!==null)$.push(J);let q=d0();if(q!==null)$.push(q);return $}function Z0(Q=process.env){let Z=Q.MYC_TREE_SITTER_DIR;if(Z!==void 0&&Z!=="")return Z.split(V0).filter((q)=>q.length>0);let $=[],J=j0("tree-sitter");if(J!==null)$.push(J);try{let q=Bun.resolveSync("web-tree-sitter/package.json",c(a(import.meta.url)));$.push(c(q))}catch{}return $}var l="tree-sitter.wasm";function W0(Q,Z,$){for(let J of Q){let q=u(J,Z);try{let H=p0(q);if(!H.isFile())continue;if($!==void 0&&H.size!==$)continue;return q}catch{continue}}return null}function z0(Q,Z=process.env){let $=e(Q);return W0(Q0(Z),$.file,$.bytes)}function C0(Q=process.env){return W0(Z0(Q),l)}function G0(Q){if(Q<1024)return`${Q} \u0411`;let Z=["\u041A\u0411","\u041C\u0411","\u0413\u0411"],$=Q/1024,J=0;while($>=1024&&J<Z.length-1)$/=1024,J++;return`${$.toFixed(1)} ${Z[J]}`}class F0 extends Error{lang;constructor(Q){super(`\u0433\u0440\u0430\u043C\u043C\u0430\u0442\u0438\u043A\u0430 tree-sitter \u0434\u043B\u044F "${Q}" \u043D\u0435 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043D\u0430: \u0432\u044B\u0437\u043E\u0432\u0438\u0442\u0435 await loadLang("${Q}") \u0434\u043E listDefs`);this.lang=Q;this.name="GrammarNotLoadedError"}}var n={function_declaration:"function",generator_function_declaration:"function",class_declaration:"class",abstract_class_declaration:"class",interface_declaration:"interface",enum_declaration:"enum",type_alias_declaration:"type",method_definition:"method"},r0={function_definition:"function",class_definition:"class"},s0=new Set(["arrow_function","function_expression","function","generator_function"]),w0={ts:{kinds:n,declarators:!0,methodByParent:[]},tsx:{kinds:n,declarators:!0,methodByParent:[]},js:{kinds:n,declarators:!0,methodByParent:[]},jsx:{kinds:n,declarators:!0,methodByParent:[]},py:{kinds:r0,declarators:!1,methodByParent:["block"]}},_Q=Object.keys(w0),o=null,$0=new Map,k0=new Map;class X0 extends Error{hint;constructor(Q,Z){super(Q);this.hint=Z;this.name="MissingResourceError"}}class R0 extends X0{searched;constructor(Q){super(`\u0440\u0430\u043D\u0442\u0430\u0439\u043C tree-sitter \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D: ${l} \u043D\u0435\u0442 \u043D\u0438 \u0432 \u043E\u0434\u043D\u043E\u043C \u0438\u0437 \u043A\u0430\u0442\u0430\u043B\u043E\u0433\u043E\u0432 `+`[${Q.join(", ")}]. \u041E\u043D \u043F\u043E\u0441\u0442\u0430\u0432\u043B\u044F\u0435\u0442\u0441\u044F \u0432\u043C\u0435\u0441\u0442\u0435 \u0441 myc, \u0438 \u0435\u0433\u043E \u043E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 `+"\u043E\u0437\u043D\u0430\u0447\u0430\u0435\u0442 \u043F\u043E\u0432\u0440\u0435\u0436\u0434\u0451\u043D\u043D\u0443\u044E \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u043A\u0443: \u043F\u0435\u0440\u0435\u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u0435 \u043F\u0430\u043A\u0435\u0442 \u043B\u0438\u0431\u043E \u0443\u043A\u0430\u0436\u0438\u0442\u0435 \u043A\u0430\u0442\u0430\u043B\u043E\u0433 "+"\u0441 \u0444\u0430\u0439\u043B\u043E\u043C \u0432 MYC_TREE_SITTER_DIR","bun add -g @aistastudio/myc");this.searched=Q;this.name="RuntimeMissingError"}}class B0 extends X0{lang;searched;constructor(Q,Z){let $=e(Q);super(`\u0433\u0440\u0430\u043C\u043C\u0430\u0442\u0438\u043A\u0430 tree-sitter \u0434\u043B\u044F "${Q}" \u043D\u0435 \u0441\u043A\u0430\u0447\u0430\u043D\u0430: ${$.file} (${G0($.bytes)}) \u043D\u0435\u0442 \u043D\u0438 \u0432 \u043E\u0434\u043D\u043E\u043C \u0438\u0437 \u043A\u0430\u0442\u0430\u043B\u043E\u0433\u043E\u0432 [${Z.join(", ")}]`,`myc code fetch ${Q}`);this.lang=Q;this.searched=Z;this.name="GrammarMissingError"}}function a0(){let Q=C0();if(Q===null)throw new R0(Z0());return Q.slice(0,Q.length-l.length-1)}function e0(Q){let Z=z0(Q);if(Z===null)throw new B0(Q,Q0());return Z}async function QQ(){if(o===null){let Q=a0();o=d.default.init({locateFile:(Z)=>t0(Q,Z)}).catch((Z)=>{throw o=null,Z})}return o}async function T0(Q){let Z=$0.get(Q);if(Z===void 0)Z=(async()=>{await QQ();let $=await d.default.Language.load(e0(Q)),J=new d.default;return J.setLanguage($),J})().catch(($)=>{throw $0.delete(Q),$}),$0.set(Q,Z);k0.set(Q,await Z)}function ZQ(Q){let Z=k0.get(Q);if(Z===void 0)throw new F0(Q);return Z}function $Q(Q){let Z=Q.childForFieldName("name");if(Z===null)return null;let $=Z.text;return $.length>0?$:null}function XQ(Q){let Z=Q.childForFieldName("value");return Z!==null&&s0.has(Z.type)}function JQ(Q,Z){if(Z.length===0)return!1;let $=Q.parent;while($!==null&&$.type==="decorated_definition")$=$.parent;if($===null||!Z.includes($.type))return!1;let J=$.parent;return J!==null&&J.type.endsWith("class_definition")}function D0(Q,Z){let $=w0[Z],J=$.kinds[Q.type];if(J!==void 0)return JQ(Q,$.methodByParent)?"method":J;if($.declarators&&Q.type==="variable_declarator"&&XQ(Q))return"function";return null}function O0(Q){return $Q(Q)}function L0(Q,Z,$,J={}){let q=$.startPosition.row+1;return{name:Q,kind:Z,startLine:q,endLine:J.naiveEnd===!0?q:$.endPosition.row+1}}function _0(Q){return ZQ(Q)}var qQ=new Set(["identifier","type_identifier","property_identifier","shorthand_property_identifier"]),HQ=new Set(["formal_parameters","required_parameter","optional_parameter","rest_pattern","object_pattern","array_pattern","pair_pattern","object_assignment_pattern","import_clause","namespace_import","parameters","lambda_parameters","default_parameter","typed_parameter","typed_default_parameter","as_pattern_target"]),UQ=new Set(["import_specifier","export_specifier","aliased_import"]),YQ=new Set(["jsx_opening_element","jsx_self_closing_element","jsx_closing_element"]),E0=new Set(["call_expression","call"]),VQ=new Set(["member_expression","attribute"]);function v(Q,Z,$){let J=Q.childForFieldName(Z);return J!==null&&J.id===$.id}function KQ(Q){let Z=Q.parent,$=Z===null?null:Z.parent;return $!==null&&$.childForFieldName("source")!==null}function jQ(Q){let Z=Q.parent;if(Z===null)return null;if(E0.has(Z.type)&&v(Z,"function",Q))return"call";if(Z.type==="new_expression"&&v(Z,"constructor",Q))return"new";return null}function WQ(Q){let Z=Q.parent;if(Z===null)return null;let $=Z.type;if(UQ.has($)){if(!v(Z,"name",Q))return null;return $==="export_specifier"&&!KQ(Z)?"read":"import"}if(YQ.has($))return v(Z,"name",Q)?"read":null;if($==="jsx_attribute")return null;if(HQ.has($))return null;if(v(Z,"name",Q))return null;if($==="pair"&&v(Z,"key",Q))return null;if($==="keyword_argument"&&v(Z,"name",Q))return null;if($==="catch_clause"&&v(Z,"parameter",Q))return null;if(E0.has($)&&v(Z,"function",Q))return"call";if($==="new_expression"&&v(Z,"constructor",Q))return"new";if(VQ.has($)){if(v(Z,"property",Q)||v(Z,"attribute",Q))return jQ(Z)??"prop";return"read"}if($==="dotted_name")return"import";if(Q.type==="type_identifier")return"type";if($==="extends_clause"||$==="implements_clause")return"type";if(Q.type==="property_identifier")return"prop";return"read"}function A0(Q,Z,$={}){let q=_0(Z).parse(Q);try{let H=[],U=[],Y=new Set,j=[],W=$.naiveOwner===!0,k=(F)=>{let z=!1,G=D0(F,Z);if(G!==null){let K=O0(F);if(K!==null)H.push(L0(K,G,F,$)),j.push({name:K,start:F.startPosition.row+1}),z=!0}if(qQ.has(F.type)){let K=WQ(F);if(K!==null){let w=F.text;if(w.length>0){let D=W||j.length===0?null:j[j.length-1],V=F.startPosition.row+1,R=D===null?"":D.name,T=D===null?0:D.start,S=`${w}\x00${V}\x00${K}\x00${T}`;if(!Y.has(S))Y.add(S),U.push({name:w,line:V,kind:K,from:R,fromStart:T})}}}for(let K=0;K<F.namedChildCount;K++){let w=F.namedChild(K);if(w!==null)k(w)}if(z)j.pop()};return k(q.rootNode),{defs:H,refs:U}}finally{q.delete()}}var P0=process.env.MYC_TREE_SITTER_DIR,S0=process.env.MYC_TREE_SITTER_GRAMMAR_DIR;if(P0===void 0||P0===""||S0===void 0||S0==="")throw Error("\u0432\u043E\u0440\u043A\u0435\u0440 \u0440\u0430\u0437\u0431\u043E\u0440\u0430 \u0437\u0430\u043F\u0443\u0449\u0435\u043D \u0431\u0435\u0437 \u043A\u0430\u0442\u0430\u043B\u043E\u0433\u043E\u0432 tree-sitter: MYC_TREE_SITTER_DIR \u0438 "+"MYC_TREE_SITTER_GRAMMAR_DIR \u0432\u044B\u0441\u0442\u0430\u0432\u043B\u044F\u0435\u0442 \u0433\u043B\u0430\u0432\u043D\u044B\u0439 \u043F\u043E\u0442\u043E\u043A (ParsePool). \u0418\u0441\u043A\u0430\u0442\u044C \u0438\u0445 "+"\u0437\u0434\u0435\u0441\u044C \u043D\u0435\u0447\u0435\u043C \u2014 \u0437\u0430 \u0433\u0440\u0430\u043D\u0438\u0446\u0435\u0439 \u043F\u043E\u0442\u043E\u043A\u0430 node_modules \u043D\u0435\u0442");var J0=globalThis;J0.onmessage=(Q)=>{let{id:Z,source:$,lang:J}=Q.data;(async()=>{try{await T0(J);let{defs:q,refs:H}=A0($,J);J0.postMessage({id:Z,defs:q,refs:H})}catch(q){J0.postMessage({id:Z,error:q instanceof Error?q.message:String(q)})}})()};
|
|
6
|
+
${JSON.stringify(J,null,2)}`);let H=$[q]();return new Language(INTERNAL,H)})}}class LookaheadIterable{constructor(Q,Z,$){assertInternal(Q),this[0]=Z,this.language=$}get currentTypeId(){return C._ts_lookahead_iterator_current_symbol(this[0])}get currentType(){return this.language.types[this.currentTypeId]||"ERROR"}delete(){C._ts_lookahead_iterator_delete(this[0]),this[0]=0}resetState(Q){return C._ts_lookahead_iterator_reset_state(this[0],Q)}reset(Q,Z){if(C._ts_lookahead_iterator_reset(this[0],Q[0],Z))return this.language=Q,!0;return!1}[Symbol.iterator](){let Q=this;return{next(){if(C._ts_lookahead_iterator_next(Q[0]))return{done:!1,value:Q.currentType};return{done:!0,value:""}}}}}class Query{constructor(Q,Z,$,J,q,H,U,Y){assertInternal(Q),this[0]=Z,this.captureNames=$,this.textPredicates=J,this.predicates=q,this.setProperties=H,this.assertedProperties=U,this.refutedProperties=Y,this.exceededMatchLimit=!1}delete(){C._ts_query_delete(this[0]),this[0]=0}matches(Q,{startPosition:Z=ZERO_POINT,endPosition:$=ZERO_POINT,startIndex:J=0,endIndex:q=0,matchLimit:H=4294967295,maxStartDepth:U=4294967295,timeoutMicros:Y=0}={}){if(typeof H!=="number")throw Error("Arguments must be numbers");marshalNode(Q),C._ts_query_matches_wasm(this[0],Q.tree[0],Z.row,Z.column,$.row,$.column,J,q,H,U,Y);let j=getValue(TRANSFER_BUFFER,"i32"),W=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),k=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),F=Array(j);this.exceededMatchLimit=Boolean(k);let z=0,G=W;for(let K=0;K<j;K++){let w=getValue(G,"i32");G+=SIZE_OF_INT;let D=getValue(G,"i32");G+=SIZE_OF_INT;let V=Array(D);if(G=unmarshalCaptures(this,Q.tree,G,V),this.textPredicates[w].every((R)=>R(V))){F[z]={pattern:w,captures:V};let R=this.setProperties[w];if(R)F[z].setProperties=R;let T=this.assertedProperties[w];if(T)F[z].assertedProperties=T;let S=this.refutedProperties[w];if(S)F[z].refutedProperties=S;z++}}return F.length=z,C._free(W),F}captures(Q,{startPosition:Z=ZERO_POINT,endPosition:$=ZERO_POINT,startIndex:J=0,endIndex:q=0,matchLimit:H=4294967295,maxStartDepth:U=4294967295,timeoutMicros:Y=0}={}){if(typeof H!=="number")throw Error("Arguments must be numbers");marshalNode(Q),C._ts_query_captures_wasm(this[0],Q.tree[0],Z.row,Z.column,$.row,$.column,J,q,H,U,Y);let j=getValue(TRANSFER_BUFFER,"i32"),W=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),k=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),F=[];this.exceededMatchLimit=Boolean(k);let z=[],G=W;for(let K=0;K<j;K++){let w=getValue(G,"i32");G+=SIZE_OF_INT;let D=getValue(G,"i32");G+=SIZE_OF_INT;let V=getValue(G,"i32");if(G+=SIZE_OF_INT,z.length=D,G=unmarshalCaptures(this,Q.tree,G,z),this.textPredicates[w].every((R)=>R(z))){let R=z[V],T=this.setProperties[w];if(T)R.setProperties=T;let S=this.assertedProperties[w];if(S)R.assertedProperties=S;let b=this.refutedProperties[w];if(b)R.refutedProperties=b;F.push(R)}}return C._free(W),F}predicatesForPattern(Q){return this.predicates[Q]}disableCapture(Q){let Z=lengthBytesUTF8(Q),$=C._malloc(Z+1);stringToUTF8(Q,$,Z+1),C._ts_query_disable_capture(this[0],$,Z),C._free($)}didExceedMatchLimit(){return this.exceededMatchLimit}}function getText(Q,Z,$){let J=$-Z,q=Q.textCallback(Z,null,$);Z+=q.length;while(Z<$){let H=Q.textCallback(Z,null,$);if(H&&H.length>0)Z+=H.length,q+=H;else break}if(Z>$)q=q.slice(0,J);return q}function unmarshalCaptures(Q,Z,$,J){for(let q=0,H=J.length;q<H;q++){let U=getValue($,"i32");$+=SIZE_OF_INT;let Y=unmarshalNode(Z,$);$+=SIZE_OF_NODE,J[q]={name:Q.captureNames[U],node:Y}}return $}function assertInternal(Q){if(Q!==INTERNAL)throw Error("Illegal constructor")}function isPoint(Q){return Q&&typeof Q.row==="number"&&typeof Q.column==="number"}function marshalNode(Q){let Z=TRANSFER_BUFFER;setValue(Z,Q.id,"i32"),Z+=SIZE_OF_INT,setValue(Z,Q.startIndex,"i32"),Z+=SIZE_OF_INT,setValue(Z,Q.startPosition.row,"i32"),Z+=SIZE_OF_INT,setValue(Z,Q.startPosition.column,"i32"),Z+=SIZE_OF_INT,setValue(Z,Q[0],"i32")}function unmarshalNode(Q,Z=TRANSFER_BUFFER){let $=getValue(Z,"i32");if(Z+=SIZE_OF_INT,$===0)return null;let J=getValue(Z,"i32");Z+=SIZE_OF_INT;let q=getValue(Z,"i32");Z+=SIZE_OF_INT;let H=getValue(Z,"i32");Z+=SIZE_OF_INT;let U=getValue(Z,"i32"),Y=new Node(INTERNAL,Q);return Y.id=$,Y.startIndex=J,Y.startPosition={row:q,column:H},Y[0]=U,Y}function marshalTreeCursor(Q,Z=TRANSFER_BUFFER){setValue(Z+0*SIZE_OF_INT,Q[0],"i32"),setValue(Z+1*SIZE_OF_INT,Q[1],"i32"),setValue(Z+2*SIZE_OF_INT,Q[2],"i32"),setValue(Z+3*SIZE_OF_INT,Q[3],"i32")}function unmarshalTreeCursor(Q){Q[0]=getValue(TRANSFER_BUFFER+0*SIZE_OF_INT,"i32"),Q[1]=getValue(TRANSFER_BUFFER+1*SIZE_OF_INT,"i32"),Q[2]=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),Q[3]=getValue(TRANSFER_BUFFER+3*SIZE_OF_INT,"i32")}function marshalPoint(Q,Z){setValue(Q,Z.row,"i32"),setValue(Q+SIZE_OF_INT,Z.column,"i32")}function unmarshalPoint(Q){return{row:getValue(Q,"i32")>>>0,column:getValue(Q+SIZE_OF_INT,"i32")>>>0}}function marshalRange(Q,Z){marshalPoint(Q,Z.startPosition),Q+=SIZE_OF_POINT,marshalPoint(Q,Z.endPosition),Q+=SIZE_OF_POINT,setValue(Q,Z.startIndex,"i32"),Q+=SIZE_OF_INT,setValue(Q,Z.endIndex,"i32"),Q+=SIZE_OF_INT}function unmarshalRange(Q){let Z={};return Z.startPosition=unmarshalPoint(Q),Q+=SIZE_OF_POINT,Z.endPosition=unmarshalPoint(Q),Q+=SIZE_OF_POINT,Z.startIndex=getValue(Q,"i32")>>>0,Q+=SIZE_OF_INT,Z.endIndex=getValue(Q,"i32")>>>0,Z}function marshalEdit(Q){let Z=TRANSFER_BUFFER;marshalPoint(Z,Q.startPosition),Z+=SIZE_OF_POINT,marshalPoint(Z,Q.oldEndPosition),Z+=SIZE_OF_POINT,marshalPoint(Z,Q.newEndPosition),Z+=SIZE_OF_POINT,setValue(Z,Q.startIndex,"i32"),Z+=SIZE_OF_INT,setValue(Z,Q.oldEndIndex,"i32"),Z+=SIZE_OF_INT,setValue(Z,Q.newEndIndex,"i32"),Z+=SIZE_OF_INT}for(let Q of Object.getOwnPropertyNames(ParserImpl.prototype))Object.defineProperty(Parser.prototype,Q,{value:ParserImpl.prototype[Q],enumerable:!1,writable:!1});Parser.Language=Language,X.onRuntimeInitialized=()=>{ParserImpl.init(),resolveInitPromise()}})}}return Parser}();if(typeof m==="object")g.exports=m0});var d=g0(Y0(),1);import{delimiter as OQ,join as t0}from"path";import{existsSync as FQ,statSync as p0}from"fs";import{homedir as u0}from"os";import{delimiter as V0,dirname as c,join as u}from"path";import{fileURLToPath as a}from"url";var s={"web-tree-sitter":"0.24.7","tree-sitter-wasms":"0.1.13"};var l0=s["tree-sitter-wasms"];function i0(Q){return`https://cdn.jsdelivr.net/npm/tree-sitter-wasms@${l0}/out/tree-sitter-${Q}.wasm`}function p(Q,Z,$,J){return{name:Q,file:`tree-sitter-${Q}.wasm`,url:i0(Q),sha256:Z,bytes:$,langs:J}}var K0={typescript:p("typescript","8515404dceed38e1ed86aa34b09fcf3379fff1b4ff9dd3967bcd6d1eb5ac3d8f",2342690,["ts"]),tsx:p("tsx","6aa3b2c70e76f5d48eafef1093e9c4de383e13f2fdde2f4e9b98a378f6a8f1b6",2411272,["tsx"]),javascript:p("javascript","63812b9e275d26851264734868d27a1656bd44a2ef6eb3e85e6b03728c595ab5",647334,["js","jsx"]),python:p("python","9056d0fb0c337810d019fae350e8167786119da98f0f282aceae7ab89ee8253b",476105,["py"])},n0=(()=>{let Q={};for(let Z of Object.values(K0))for(let $ of Z.langs)Q[$]=Z.name;return Q})();function e(Q){let Z=n0[Q];if(Z===void 0)throw Error(`no grammar for language "${Q}"`);return K0[Z]}function o0(Q=process.env){let Z=Q.MYC_GRAMMARS_DIR;if(Z!==void 0&&Z!=="")return Z;return u(u0(),".cache","myc","grammars")}function j0(Q){try{return u(c(a(import.meta.url)),"..","vendor",Q)}catch{return null}}function d0(){try{let Q=Bun.resolveSync("tree-sitter-wasms/package.json",c(a(import.meta.url)));return u(c(Q),"out")}catch{return null}}function Q0(Q=process.env){let Z=Q.MYC_TREE_SITTER_GRAMMAR_DIR;if(Z!==void 0&&Z!=="")return Z.split(V0).filter((H)=>H.length>0);let $=[o0(Q)],J=j0("tree-sitter-grammars");if(J!==null)$.push(J);let q=d0();if(q!==null)$.push(q);return $}function Z0(Q=process.env){let Z=Q.MYC_TREE_SITTER_DIR;if(Z!==void 0&&Z!=="")return Z.split(V0).filter((q)=>q.length>0);let $=[],J=j0("tree-sitter");if(J!==null)$.push(J);try{let q=Bun.resolveSync("web-tree-sitter/package.json",c(a(import.meta.url)));$.push(c(q))}catch{}return $}var l="tree-sitter.wasm";function W0(Q,Z,$){for(let J of Q){let q=u(J,Z);try{let H=p0(q);if(!H.isFile())continue;if($!==void 0&&H.size!==$)continue;return q}catch{continue}}return null}function z0(Q,Z=process.env){let $=e(Q);return W0(Q0(Z),$.file,$.bytes)}function C0(Q=process.env){return W0(Z0(Q),l)}function G0(Q){if(Q<1024)return`${Q} B`;let Z=["KB","MB","GB"],$=Q/1024,J=0;while($>=1024&&J<Z.length-1)$/=1024,J++;return`${$.toFixed(1)} ${Z[J]}`}class F0 extends Error{lang;constructor(Q){super(`tree-sitter grammar for "${Q}" is not loaded: call await loadLang("${Q}") before listDefs`);this.lang=Q;this.name="GrammarNotLoadedError"}}var n={function_declaration:"function",generator_function_declaration:"function",class_declaration:"class",abstract_class_declaration:"class",interface_declaration:"interface",enum_declaration:"enum",type_alias_declaration:"type",method_definition:"method"},r0={function_definition:"function",class_definition:"class"},s0=new Set(["arrow_function","function_expression","function","generator_function"]),w0={ts:{kinds:n,declarators:!0,methodByParent:[]},tsx:{kinds:n,declarators:!0,methodByParent:[]},js:{kinds:n,declarators:!0,methodByParent:[]},jsx:{kinds:n,declarators:!0,methodByParent:[]},py:{kinds:r0,declarators:!1,methodByParent:["block"]}},_Q=Object.keys(w0),o=null,$0=new Map,k0=new Map;class X0 extends Error{hint;constructor(Q,Z){super(Q);this.hint=Z;this.name="MissingResourceError"}}class R0 extends X0{searched;constructor(Q){super(`tree-sitter runtime not found: ${l} is in none of the directories [${Q.join(", ")}]. It ships with myc, so its absence means a broken install: reinstall the package or set MYC_TREE_SITTER_DIR to the directory that has the file`,"bun add -g @aistastudio/myc");this.searched=Q;this.name="RuntimeMissingError"}}class B0 extends X0{lang;searched;constructor(Q,Z){let $=e(Q);super(`tree-sitter grammar for "${Q}" is not downloaded: ${$.file} (${G0($.bytes)}) is in none of the directories [${Z.join(", ")}]`,`myc code fetch ${Q}`);this.lang=Q;this.searched=Z;this.name="GrammarMissingError"}}function a0(){let Q=C0();if(Q===null)throw new R0(Z0());return Q.slice(0,Q.length-l.length-1)}function e0(Q){let Z=z0(Q);if(Z===null)throw new B0(Q,Q0());return Z}async function QQ(){if(o===null){let Q=a0();o=d.default.init({locateFile:(Z)=>t0(Q,Z)}).catch((Z)=>{throw o=null,Z})}return o}async function T0(Q){let Z=$0.get(Q);if(Z===void 0)Z=(async()=>{await QQ();let $=await d.default.Language.load(e0(Q)),J=new d.default;return J.setLanguage($),J})().catch(($)=>{throw $0.delete(Q),$}),$0.set(Q,Z);k0.set(Q,await Z)}function ZQ(Q){let Z=k0.get(Q);if(Z===void 0)throw new F0(Q);return Z}function $Q(Q){let Z=Q.childForFieldName("name");if(Z===null)return null;let $=Z.text;return $.length>0?$:null}function XQ(Q){let Z=Q.childForFieldName("value");return Z!==null&&s0.has(Z.type)}function JQ(Q,Z){if(Z.length===0)return!1;let $=Q.parent;while($!==null&&$.type==="decorated_definition")$=$.parent;if($===null||!Z.includes($.type))return!1;let J=$.parent;return J!==null&&J.type.endsWith("class_definition")}function D0(Q,Z){let $=w0[Z],J=$.kinds[Q.type];if(J!==void 0)return JQ(Q,$.methodByParent)?"method":J;if($.declarators&&Q.type==="variable_declarator"&&XQ(Q))return"function";return null}function O0(Q){return $Q(Q)}function L0(Q,Z,$,J={}){let q=$.startPosition.row+1;return{name:Q,kind:Z,startLine:q,endLine:J.naiveEnd===!0?q:$.endPosition.row+1}}function _0(Q){return ZQ(Q)}var qQ=new Set(["identifier","type_identifier","property_identifier","shorthand_property_identifier"]),HQ=new Set(["formal_parameters","required_parameter","optional_parameter","rest_pattern","object_pattern","array_pattern","pair_pattern","object_assignment_pattern","import_clause","namespace_import","parameters","lambda_parameters","default_parameter","typed_parameter","typed_default_parameter","as_pattern_target"]),UQ=new Set(["import_specifier","export_specifier","aliased_import"]),YQ=new Set(["jsx_opening_element","jsx_self_closing_element","jsx_closing_element"]),E0=new Set(["call_expression","call"]),VQ=new Set(["member_expression","attribute"]);function v(Q,Z,$){let J=Q.childForFieldName(Z);return J!==null&&J.id===$.id}function KQ(Q){let Z=Q.parent,$=Z===null?null:Z.parent;return $!==null&&$.childForFieldName("source")!==null}function jQ(Q){let Z=Q.parent;if(Z===null)return null;if(E0.has(Z.type)&&v(Z,"function",Q))return"call";if(Z.type==="new_expression"&&v(Z,"constructor",Q))return"new";return null}function WQ(Q){let Z=Q.parent;if(Z===null)return null;let $=Z.type;if(UQ.has($)){if(!v(Z,"name",Q))return null;return $==="export_specifier"&&!KQ(Z)?"read":"import"}if(YQ.has($))return v(Z,"name",Q)?"read":null;if($==="jsx_attribute")return null;if(HQ.has($))return null;if(v(Z,"name",Q))return null;if($==="pair"&&v(Z,"key",Q))return null;if($==="keyword_argument"&&v(Z,"name",Q))return null;if($==="catch_clause"&&v(Z,"parameter",Q))return null;if(E0.has($)&&v(Z,"function",Q))return"call";if($==="new_expression"&&v(Z,"constructor",Q))return"new";if(VQ.has($)){if(v(Z,"property",Q)||v(Z,"attribute",Q))return jQ(Z)??"prop";return"read"}if($==="dotted_name")return"import";if(Q.type==="type_identifier")return"type";if($==="extends_clause"||$==="implements_clause")return"type";if(Q.type==="property_identifier")return"prop";return"read"}function A0(Q,Z,$={}){let q=_0(Z).parse(Q);try{let H=[],U=[],Y=new Set,j=[],W=$.naiveOwner===!0,k=(F)=>{let z=!1,G=D0(F,Z);if(G!==null){let K=O0(F);if(K!==null)H.push(L0(K,G,F,$)),j.push({name:K,start:F.startPosition.row+1}),z=!0}if(qQ.has(F.type)){let K=WQ(F);if(K!==null){let w=F.text;if(w.length>0){let D=W||j.length===0?null:j[j.length-1],V=F.startPosition.row+1,R=D===null?"":D.name,T=D===null?0:D.start,S=`${w}\x00${V}\x00${K}\x00${T}`;if(!Y.has(S))Y.add(S),U.push({name:w,line:V,kind:K,from:R,fromStart:T})}}}for(let K=0;K<F.namedChildCount;K++){let w=F.namedChild(K);if(w!==null)k(w)}if(z)j.pop()};return k(q.rootNode),{defs:H,refs:U}}finally{q.delete()}}var P0=process.env.MYC_TREE_SITTER_DIR,S0=process.env.MYC_TREE_SITTER_GRAMMAR_DIR;if(P0===void 0||P0===""||S0===void 0||S0==="")throw Error("parse worker started without tree-sitter directories: MYC_TREE_SITTER_DIR and MYC_TREE_SITTER_GRAMMAR_DIR are set by the main thread (ParsePool). There is nothing "+"to look them up with here \u2014 node_modules does not exist across the thread boundary");var J0=globalThis;J0.onmessage=(Q)=>{let{id:Z,source:$,lang:J}=Q.data;(async()=>{try{await T0(J);let{defs:q,refs:H}=A0($,J);J0.postMessage({id:Z,defs:q,refs:H})}catch(q){J0.postMessage({id:Z,error:q instanceof Error?q.message:String(q)})}})()};
|