noskills 4.1.56 → 4.5.0

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.
Files changed (187) hide show
  1. package/LICENSE +13 -0
  2. package/README.md +47 -10
  3. package/chunks/ajan-bridge-T5M4DPDT.js +1 -0
  4. package/chunks/anthropic-TS7EMQML.js +1 -0
  5. package/chunks/approve-HEW3VFYH.js +1 -0
  6. package/chunks/ask-AXHTCVD6.js +2 -0
  7. package/chunks/block-VN76CXZW.js +1 -0
  8. package/chunks/{browser-XLYVEO2J.js → browser-BGFD24RX.js} +1 -1
  9. package/chunks/bun-WZ7BVR7Y.js +1 -0
  10. package/chunks/cancel-7WRAST62.js +1 -0
  11. package/chunks/chunk-3ZJ3UGQL.js +48 -0
  12. package/chunks/chunk-4PF2MT7S.js +29 -0
  13. package/chunks/chunk-575Y3OEG.js +1 -0
  14. package/chunks/{chunk-DZTBXXB3.js → chunk-5DZHAHXW.js} +23 -23
  15. package/chunks/chunk-5PBNUBBY.js +3 -0
  16. package/chunks/{chunk-HNAHPI6V.js → chunk-5RLCKUIF.js} +1 -1
  17. package/chunks/chunk-6YSS6PEL.js +3 -0
  18. package/chunks/chunk-7GC46XEU.js +1 -0
  19. package/chunks/{chunk-LBPD4EIH.js → chunk-7PPUGTKL.js} +1 -1
  20. package/chunks/chunk-AUZWXMWA.js +27 -0
  21. package/chunks/chunk-CH6A3LES.js +91 -0
  22. package/chunks/{chunk-UG26APX2.js → chunk-CML74SNT.js} +1 -1
  23. package/chunks/chunk-CTTMQSHF.js +1 -0
  24. package/chunks/chunk-DBKXMYLF.js +4 -0
  25. package/chunks/chunk-DEHRWREM.js +1 -0
  26. package/chunks/chunk-EIGFDYGQ.js +1 -0
  27. package/chunks/chunk-EIMBEXUJ.js +1 -0
  28. package/chunks/chunk-EJYSOUEA.js +1 -0
  29. package/chunks/chunk-ENP4P2YH.js +0 -0
  30. package/chunks/{chunk-RJX4ZXQ4.js → chunk-EROZRDGT.js} +1 -1
  31. package/chunks/chunk-FE4MKOI4.js +1 -0
  32. package/chunks/chunk-GQTHILPL.js +5 -0
  33. package/chunks/chunk-HISXAZ4Y.js +1 -0
  34. package/chunks/chunk-I4Z2RF7L.js +31 -0
  35. package/chunks/chunk-IFE5SYGK.js +1 -0
  36. package/chunks/chunk-IGDFEGCH.js +2 -0
  37. package/chunks/chunk-JL3MAFYQ.js +1 -0
  38. package/chunks/chunk-JYVB6UAV.js +1 -0
  39. package/chunks/chunk-KJLEPI7T.js +1 -0
  40. package/chunks/chunk-KM64FL2X.js +1 -0
  41. package/chunks/chunk-KMLNG3EC.js +1 -0
  42. package/chunks/chunk-KRKOWSYW.js +148 -0
  43. package/chunks/chunk-KRRPOVQG.js +1 -0
  44. package/chunks/{chunk-CKETVOVQ.js → chunk-LJEWPIEI.js} +1 -1
  45. package/chunks/{chunk-VAP3TSYK.js → chunk-LN4NDYT6.js} +1 -1
  46. package/chunks/{chunk-Z3O5HAIO.js → chunk-NGCBWJML.js} +1 -1
  47. package/chunks/chunk-O4KKKYCH.js +1 -0
  48. package/chunks/chunk-OAWYVETM.js +1 -0
  49. package/chunks/chunk-PKEQKXZW.js +23 -0
  50. package/chunks/chunk-PRQ5CRIG.js +1 -0
  51. package/chunks/{chunk-SWYX6WYQ.js → chunk-PSX63TYP.js} +2 -2
  52. package/chunks/{chunk-5P46WSNG.js → chunk-Q4TI7EYT.js} +1 -1
  53. package/chunks/chunk-QKWJ72HI.js +3 -0
  54. package/chunks/chunk-RAQY37P6.js +1 -0
  55. package/chunks/{openai-QGEN33SU.js → chunk-S4MUTKHT.js} +3 -3
  56. package/chunks/chunk-SLO22P65.js +1 -0
  57. package/chunks/chunk-UE56BMAW.js +21 -0
  58. package/chunks/{chunk-O2NUECRA.js → chunk-VJRCTYGL.js} +1 -1
  59. package/chunks/chunk-VXU6XZ66.js +39 -0
  60. package/chunks/chunk-W4TQLLUK.js +7 -0
  61. package/chunks/{chunk-PKYW3S5P.js → chunk-XDRX4ZBJ.js} +1 -1
  62. package/chunks/{chunk-XNGHRJVK.js → chunk-Y5E7ZCCX.js} +1 -1
  63. package/chunks/chunk-Z7OYXH3J.js +1 -0
  64. package/chunks/claude-code-DIWRQKZA.js +1 -0
  65. package/chunks/cmd-46ZIHXLB.js +1 -0
  66. package/chunks/concern-QSENGU6C.js +1 -0
  67. package/chunks/{config-CZDLCSOC.js → config-S3UXTJN2.js} +1 -1
  68. package/chunks/decision-ledger-GY2W6VWL.js +1 -0
  69. package/chunks/delegate-WKXIER7E.js +1 -0
  70. package/chunks/deno-YM5PW6ZM.js +1 -0
  71. package/chunks/{diagrams-H7NLJF7W.js → diagrams-A7W2EBYV.js} +1 -1
  72. package/chunks/diagrams-CBCUA47B.js +1 -0
  73. package/chunks/{dist-UI3SRKS3.js → dist-3MH5UCQU.js} +3 -3
  74. package/chunks/done-WR3UFYJT.js +1 -0
  75. package/chunks/followup-5EGZEF5Q.js +1 -0
  76. package/chunks/free-KJQHRYZA.js +1 -0
  77. package/chunks/gemini-IWP24T63.js +1 -0
  78. package/chunks/init-437SU6XH.js +1 -0
  79. package/chunks/invoke-hook-LMCWNF65.js +13 -0
  80. package/chunks/kiro-THWCXS5L.js +1 -0
  81. package/chunks/{learn-KIZTV5OH.js → learn-ZTYKBZER.js} +1 -1
  82. package/chunks/ledger-FOOPJ2UO.js +1 -0
  83. package/chunks/list-HNGIOVBK.js +1 -0
  84. package/chunks/loader-command-3A5FK2RF.js +1 -0
  85. package/chunks/loader-reactor-YZM7HO4G.js +1 -0
  86. package/chunks/manager-2MOLEJ4Q.js +3 -0
  87. package/chunks/mod-6EZYRKWV.js +1 -0
  88. package/chunks/{mod-TYCXSLSH.js → mod-7VTKN6Q5.js} +1 -1
  89. package/chunks/mod-7X5TKHKC.js +1 -0
  90. package/chunks/mod-AJIRKRAH.js +1 -0
  91. package/chunks/mod-SFSUQWSB.js +8 -0
  92. package/chunks/mod-TGOMO3CJ.js +1 -0
  93. package/chunks/{multipart-parser-UVM6CEKF.js → multipart-parser-DKDFOZKD.js} +1 -1
  94. package/chunks/next-Y6FOPM4Z.js +15 -0
  95. package/chunks/node-AZK2C657.js +12 -0
  96. package/chunks/node-GQQ42DT2.js +68 -0
  97. package/chunks/node-J4GTOSL2.js +1 -0
  98. package/chunks/ollama-2KAMCXVL.js +1 -0
  99. package/chunks/openai-HHE35TAX.js +31 -0
  100. package/chunks/openai-YES2XJDU.js +1 -0
  101. package/chunks/opencode-S4M7WJTO.js +1 -0
  102. package/chunks/{pack-33LQ7SJT.js → pack-KUT53Z24.js} +4 -4
  103. package/chunks/plan-export-PG2BVRQZ.js +3 -0
  104. package/chunks/purge-JGNJNEET.js +4 -0
  105. package/chunks/reopen-RPDXN3CF.js +1 -0
  106. package/chunks/reset-RBCQO2RF.js +1 -0
  107. package/chunks/review-VMS5MYOV.js +1 -0
  108. package/chunks/{rule-XREVPB5P.js → rule-IB4VKSBC.js} +2 -2
  109. package/chunks/run-62PWXVII.js +3 -0
  110. package/chunks/sdk-FR7Z4YSC.js +1 -0
  111. package/chunks/{session-HBP5GGI2.js → session-Q43KMFL2.js} +1 -1
  112. package/chunks/spec-4RKLPOEM.js +1 -0
  113. package/chunks/{src-GLQPTDNR.js → src-HXQVVTGQ.js} +1 -1
  114. package/chunks/{status-P754FM5Y.js → status-OGLFEFF7.js} +1 -1
  115. package/chunks/sync-H35O5DN5.js +1 -0
  116. package/chunks/{unstable_chmod-RZ5DE3XZ.js → unstable_chmod-44MCKF3B.js} +1 -1
  117. package/chunks/validate-JX7UTAK5.js +1 -0
  118. package/chunks/vertexai-WF5CKMYI.js +1 -0
  119. package/chunks/watch-SOZDHLSC.js +8 -0
  120. package/chunks/web-3VGRM3W4.js +1 -0
  121. package/chunks/wontfix-RBOGLLWJ.js +1 -0
  122. package/chunks/workerd-I7MLRCLJ.js +1 -0
  123. package/noskills.js +1 -1
  124. package/package.json +2 -2
  125. package/chunks/anthropic-LDUWIUPL.js +0 -1
  126. package/chunks/approve-OIXULOYH.js +0 -1
  127. package/chunks/ask-VGI3BFZW.js +0 -2
  128. package/chunks/block-6L3XJKPC.js +0 -1
  129. package/chunks/bun-5VMFSLLY.js +0 -1
  130. package/chunks/cancel-6IH4L4BL.js +0 -1
  131. package/chunks/chunk-2GF5IUQD.js +0 -39
  132. package/chunks/chunk-2N4GTHXQ.js +0 -1
  133. package/chunks/chunk-5CNPFLE6.js +0 -1
  134. package/chunks/chunk-5MN3MWQN.js +0 -1
  135. package/chunks/chunk-65A35QPF.js +0 -1
  136. package/chunks/chunk-7UX6WIXX.js +0 -1
  137. package/chunks/chunk-AGPCY6XP.js +0 -1
  138. package/chunks/chunk-AGWPQX43.js +0 -31
  139. package/chunks/chunk-AP3YBNPX.js +0 -1
  140. package/chunks/chunk-BJ2X6GHW.js +0 -5
  141. package/chunks/chunk-D3IKJ7FF.js +0 -1
  142. package/chunks/chunk-EFG5UU32.js +0 -1
  143. package/chunks/chunk-H77MLIL5.js +0 -4
  144. package/chunks/chunk-JVCVWI3B.js +0 -3
  145. package/chunks/chunk-OLM5RTFK.js +0 -1
  146. package/chunks/chunk-OTRBRRIO.js +0 -1
  147. package/chunks/chunk-U5SHLIO4.js +0 -3
  148. package/chunks/chunk-UT6ZCLRA.js +0 -1
  149. package/chunks/chunk-XXBSEOQR.js +0 -148
  150. package/chunks/chunk-YSLRAWBK.js +0 -1
  151. package/chunks/chunk-YSSDQJTT.js +0 -91
  152. package/chunks/chunk-YTNM7A5Y.js +0 -3
  153. package/chunks/claude-code-BWCSAVK2.js +0 -1
  154. package/chunks/cmd-ZXO6KFK6.js +0 -1
  155. package/chunks/concern-RB444PUE.js +0 -1
  156. package/chunks/delegate-NEWTWM6L.js +0 -1
  157. package/chunks/deno-QOH6TCLQ.js +0 -1
  158. package/chunks/diagrams-I2QKL7WR.js +0 -1
  159. package/chunks/done-KCSWC5WY.js +0 -1
  160. package/chunks/followup-5IFWOU4E.js +0 -1
  161. package/chunks/free-R4ZTZ76O.js +0 -1
  162. package/chunks/gemini-YR5KT32S.js +0 -1
  163. package/chunks/init-JRL2FB64.js +0 -1
  164. package/chunks/invoke-hook-CYJM3RDY.js +0 -13
  165. package/chunks/kiro-RGYUKJAX.js +0 -3
  166. package/chunks/list-6EQP6VUL.js +0 -1
  167. package/chunks/manager-WDSQSVF6.js +0 -6
  168. package/chunks/mod-A77UWGGG.js +0 -1
  169. package/chunks/next-47KYGODA.js +0 -7
  170. package/chunks/node-3FTYLC7H.js +0 -67
  171. package/chunks/node-BPWE6I45.js +0 -1
  172. package/chunks/ollama-LTZ43OHQ.js +0 -3
  173. package/chunks/openai-Y74OQTVB.js +0 -23
  174. package/chunks/opencode-PZDL7VDP.js +0 -1
  175. package/chunks/purge-G22VY6CI.js +0 -4
  176. package/chunks/reopen-63HEEXO6.js +0 -1
  177. package/chunks/reset-UDDESCDH.js +0 -1
  178. package/chunks/review-BC5HZNOU.js +0 -1
  179. package/chunks/run-GI2ZJ7BS.js +0 -3
  180. package/chunks/sdk-6IMATOQ3.js +0 -40
  181. package/chunks/spec-CLMOWKHY.js +0 -1
  182. package/chunks/sync-LPYKBDG2.js +0 -1
  183. package/chunks/vertexai-RUXZ24C2.js +0 -1
  184. package/chunks/watch-MONZHLBZ.js +0 -8
  185. package/chunks/web-PEDL6264.js +0 -1
  186. package/chunks/wontfix-A6OZSA3P.js +0 -1
  187. package/chunks/workerd-IIQRIOBX.js +0 -1
package/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2023-present Eser Ozvataf and other contributors.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
package/README.md CHANGED
@@ -1,4 +1,18 @@
1
- # [@eser/noskills](./)
1
+ # [@eserstack/noskills](./)
2
+
3
+ > **eserstack Product** — AI development orchestrator ·
4
+ > [eser/stack](https://github.com/eser/stack) **Install:**
5
+ > `curl -fsSL https://raw.githubusercontent.com/eser/stack/main/etc/scripts/install.sh | sh -s noskills`
6
+
7
+ `noskills` is a command, so install it as a binary — the line above, or
8
+ `brew install eser/tap/noskills`, or `npm i -g @eserstack/noskills`. On Windows
9
+ use `install.ps1 -Product noskills`.
10
+
11
+ Adding this package as a dependency (`pnpm add jsr:@eserstack/noskills`) gets
12
+ you the modules, not the command: the source package declares no `bin`, which is
13
+ generated at publish time by `scripts/npm-build.ts`. Depend on it when embedding
14
+ the orchestrator in your own program; install the binary when you want to run
15
+ it.
2
16
 
3
17
  AI agents are powerful. But left alone, they take shortcuts — they skip
4
18
  requirements, rush past edge cases, declare "done" when it isn't, and forget
@@ -191,6 +205,28 @@ Before the six questions, noskills asks which discovery mode to use:
191
205
 
192
206
  The mode shapes how questions are asked and which concern extras appear.
193
207
 
208
+ ### Listen-first merged entry
209
+
210
+ When you run `noskills spec <name> next` for the first time on a new spec,
211
+ noskills presents a single entry menu combining listen-first and mode selection:
212
+
213
+ - **(a)** Share context — write requirements, Linear tasks, meeting notes
214
+ (recursive; you can keep adding)
215
+ - **(b)** Technical depth mode — architecture, data flow, integration focus
216
+ - **(c)** Move fast mode — minimum viable scope
217
+ - **(d)** Validate mode — challenge assumptions, find gaps
218
+
219
+ Option (a) appends to `discovery.userContext[]` without advancing. Picking b/c/d
220
+ sets `entryComplete: true` and starts discovery.
221
+
222
+ ### Auto-classification
223
+
224
+ At DISCOVERY_REFINEMENT, noskills automatically classifies your spec across five
225
+ categories (Web UI, CLI, Public API, Migration, Data Handling) by regex-scanning
226
+ your spec description, userContext entries, and discovery answers. The
227
+ classification is shown with keyword evidence for you to confirm or adjust — no
228
+ separate classification prompt step required.
229
+
194
230
  ## Who is this for
195
231
 
196
232
  **Vibe coders** who are tired of babysitting agents — you want to describe what
@@ -341,11 +377,12 @@ and performance degrades. The Ralph loop solves this by restarting the agent
341
377
  every iteration with fresh context while persisting state in files. noskills IS
342
378
  the Ralph loop — no separate bash script needed.
343
379
 
344
- State persists in `.eser/.state/state.json` between iterations. The Stop hook
345
- snapshots git state automatically. Verification backpressure prevents advancing
346
- past broken tests. When `autoCommit: true` in `manifest.yml`, the `noskills run`
347
- CLI loop handles git commits between iterations — the agent never touches git.
348
- Git write operations are the CLI's responsibility, never the agent's.
380
+ State persists in `.eser/.state/progresses/state.json` between iterations. The
381
+ Stop hook snapshots git state automatically. Verification backpressure prevents
382
+ advancing past broken tests. When `autoCommit: true` in `manifest.yml`, the
383
+ `noskills run` CLI loop handles git commits between iterations — the agent never
384
+ touches git. Git write operations are the CLI's responsibility, never the
385
+ agent's.
349
386
 
350
387
  ### Behavioral Guardrails
351
388
 
@@ -421,14 +458,14 @@ hook log), noskills adds those rules to the acceptance criteria during status
421
458
  reports:
422
459
 
423
460
  ```
424
- (folder: pkg/@eser/noskills/sync) Sync output must be idempotent
425
- (folder: pkg/@eser/noskills/sync) Hook scripts must be self-contained
461
+ (folder: pkg/@eserstack/noskills/sync) Sync output must be idempotent
462
+ (folder: pkg/@eserstack/noskills/sync) Hook scripts must be self-contained
426
463
  ```
427
464
 
428
465
  Rules stack upward — `.folder-rules.md` files in parent directories also apply,
429
466
  like CSS specificity. A rule at `pkg/` applies to all files under `pkg/`, while
430
- a rule at `pkg/@eser/streams/` applies only to that package. Zero token cost —
431
- derived from filesystem, not LLM.
467
+ a rule at `pkg/@eserstack/streams/` applies only to that package. Zero token
468
+ cost — derived from filesystem, not LLM.
432
469
 
433
470
  ## How noskills differs
434
471
 
@@ -0,0 +1 @@
1
+ import{a,b,c,d,e}from"./chunk-PRQ5CRIG.js";import"./chunk-JYVB6UAV.js";import"./chunk-OAWYVETM.js";import"./chunk-HISXAZ4Y.js";export{a as AjanBridgeModel,b as AjanBridgeModelFactory,c as createBridgeFactories,e as getBridgeLoadError,d as tryLoadBridgeFactories};
@@ -0,0 +1 @@
1
+ import{a,b}from"./chunk-7GC46XEU.js";import"./chunk-EJYSOUEA.js";import"./chunk-JYVB6UAV.js";import"./chunk-OAWYVETM.js";import"./chunk-HISXAZ4Y.js";export{a as AnthropicModel,b as anthropicFactory};
@@ -0,0 +1 @@
1
+ import{a as b}from"./chunk-6YSS6PEL.js";import"./chunk-EROZRDGT.js";import{a as k,d as x}from"./chunk-LN4NDYT6.js";import{h as S}from"./chunk-5RLCKUIF.js";import{J as $,j as _,m as I,y as f}from"./chunk-UE56BMAW.js";import"./chunk-XDRX4ZBJ.js";import{c}from"./chunk-IFE5SYGK.js";import{c as o,d as p,f as n,g as m,k as w,o as P,q as v,r as E}from"./chunk-VXU6XZ66.js";import"./chunk-VJRCTYGL.js";import"./chunk-PKEQKXZW.js";import"./chunk-O4KKKYCH.js";import{E as D,f as C,h as R,j as y,o as O,s as A,u}from"./chunk-KRKOWSYW.js";import{a as h,b as i}from"./chunk-OAWYVETM.js";import{i as g}from"./chunk-Y5E7ZCCX.js";import"./chunk-LJEWPIEI.js";import"./chunk-FE4MKOI4.js";import"./chunk-HISXAZ4Y.js";var J=async L=>{let e=P({renderer:E.ansi(),sink:v.stdout()}),{root:a}=await D(),l=y(L);if(!l.ok)return e.writeln(n(l.error)),await e.close(),i({exitCode:1});let t;try{t=await R(a,l.spec)}catch(s){let r=s instanceof Error?s.message:String(s);return e.writeln(n(r)),await e.close(),i({exitCode:1})}let N=await O(a);if(t.spec!==null){let s=`${a}/${C.specDir(t.spec)}`;try{await g.fs.stat(s)}catch{return e.writeln(n(`Active spec '${t.spec}' directory not found.`)),e.writeln(p("Run `noskills reset` to return to idle.")),await e.close(),i({exitCode:1})}}let d=$(t);if(d.length>0&&(t.phase==="SPEC_PROPOSAL"||t.phase==="DISCOVERY_REFINEMENT")){e.writeln(n(`Cannot approve \u2014 ${d.length} pending delegation(s):`)),e.writeln("");for(let s of d)e.writeln(` ${s.questionId}: delegated to `,o(s.delegatedTo),p(` (pending since ${s.delegatedAt.slice(0,10)})`));return e.writeln(""),e.writeln(p("All delegations must be answered before approval.")),await e.close(),i({exitCode:1})}if(t.phase==="SPEC_PROPOSAL"){if(t.classification===null&&t.spec!==null){let T=(await A(a)).filter(V=>N?.concerns.includes(V.id)??!1);try{await b(a,t,T)}catch{}}let s=await S(a),r=I(t);r=f(r,"SPEC_PROPOSAL","SPEC_APPROVED",s),await u(a,r),r.spec!==null&&(await k(a,r.spec,"approved"),await x(a,r.spec,"approved")),e.writeln(m("\u2714")," Spec approved. Phase: ",w("SPEC_APPROVED")),e.writeln("When ready, run ",o(`${c('next --answer="start"')}`)," to begin execution.")}else if(t.phase==="DISCOVERY_REFINEMENT"){let s=await S(a),r=_(t);r=f(r,"DISCOVERY_REFINEMENT","SPEC_PROPOSAL",s),await u(a,r),e.writeln(m("\u2714")," Discovery answers approved. Phase: ",w("SPEC_PROPOSAL")),e.writeln("Review the spec and run ",o(c("approve"))," again to approve.")}else t.phase==="DISCOVERY"&&t.discovery.completed?(e.writeln(p("Discovery complete. Spec draft already generated.")),e.writeln("Review the spec and run ",o(c("approve"))," again when in SPEC_PROPOSAL phase.")):e.writeln(n(`Cannot approve in phase: ${t.phase}`));return await e.close(),h(void 0)};export{J as main};
@@ -0,0 +1,2 @@
1
+ import{b as Ke,f as We}from"./chunk-CTTMQSHF.js";import{c as me}from"./chunk-Z7OYXH3J.js";import{a as le,b as L,c as z,d as K,f as A,g as De,h as Ge,j as Me,k as ue,l as $e,o as fe,p as je,q as pe,r as Ve}from"./chunk-VXU6XZ66.js";import{a as ze}from"./chunk-EJYSOUEA.js";import"./chunk-JYVB6UAV.js";import{a as b,c as O}from"./chunk-575Y3OEG.js";import"./chunk-4PF2MT7S.js";import{a as Ne,b as N,c as Oe}from"./chunk-OAWYVETM.js";import{i as v}from"./chunk-Y5E7ZCCX.js";import"./chunk-LJEWPIEI.js";import"./chunk-FE4MKOI4.js";import{d as ce}from"./chunk-HISXAZ4Y.js";var d=e=>typeof e=="string"?e.split(".").filter(Boolean):e,R=(e,t=".")=>e.join(t),C=e=>e.join("\0");var He=(e,t)=>e.length<t.length?!1:t.every((r,n)=>e[n]===r);var Be=(e,t)=>{let r=[];for(let n of t.values()){let o=d(n.category);He(e,o)&&r.push(n)}return r.sort((n,o)=>{let i=d(n.category).length;return d(o.category).length-i}),r};var W=(e,t)=>{let r=typeof t=="string"?[t]:t;return[...e,...r]};var U={};ce(U,{configure:()=>It,getEffectiveConfig:()=>he,getFilterNames:()=>jt,getLoggerCategories:()=>Vt,getRegistryState:()=>Ft,getSinkNames:()=>$t,isConfigured:()=>_t,registerConfigureHook:()=>Se,registerFilter:()=>Dt,registerLogger:()=>Mt,registerLoggerCacheClear:()=>xe,registerSink:()=>Nt,reset:()=>rt,unregisterFilter:()=>Gt,unregisterSink:()=>Ot});var g={Trace:1,Debug:5,Info:9,Notice:10,Warning:13,Error:17,Critical:21,Alert:22,Emergency:23},Ue={[g.Trace]:"Trace",[g.Debug]:"Debug",[g.Info]:"Info",[g.Notice]:"Notice",[g.Warning]:"Warning",[g.Error]:"Error",[g.Critical]:"Critical",[g.Alert]:"Alert",[g.Emergency]:"Emergency"};var H,B,bt=()=>{if(H===void 0)try{let e=globalThis.AsyncLocalStorage??globalThis.require?.("async_hooks")?.AsyncLocalStorage;e&&(H=new e)}catch{}return H},kt=()=>{if(B===void 0)try{let e=globalThis.AsyncLocalStorage??globalThis.require?.("async_hooks")?.AsyncLocalStorage;e&&(B=new e)}catch{}return B},qe,Je,ye=e=>{qe=e},Ye=e=>{Je=e},Xe=()=>{H=void 0,B=void 0},At=()=>qe??bt(),Rt=()=>Je??kt();var Qe=()=>{let e=At();return e?e.getStore()??{}:{}};var Et=()=>{let e=Rt();return e?e.getStore()??[]:[]},Ze=e=>{let t=Et();return t.length===0?e:W(t,e)};var et=null,xe=e=>{et=e},tt=null,Se=e=>{tt=e},f=null,x=new Map,Ft=()=>f,_t=()=>f!==null,It=async e=>{(e.reset||f===null)&&await rt(),f={sinks:new Map(Object.entries(e.sinks)),filters:new Map(Object.entries(e.filters??{})),loggers:new Map,contextLocalStorage:e.contextLocalStorage};for(let t of e.loggers){let r=d(t.category),n=C(r);f.loggers.set(n,{...t,category:r})}e.contextLocalStorage&&ye(e.contextLocalStorage),x.clear(),await tt?.(e.loggers)},rt=async()=>{if(f)for(let e of f.sinks.values()){let t=e;typeof t.dispose=="function"?await t.dispose():typeof t[Symbol.asyncDispose]=="function"&&await t[Symbol.asyncDispose]()}f=null,x.clear(),et?.(),ye(void 0),Ye(void 0),Xe()},he=e=>{let t=C(e),r=x.get(t);if(r)return r;let n={sinks:[],filters:[],lowestLevel:g.Info};if(!f)return n;let o=Be(e,f.loggers),i=new Set,a=new Set,l=!1;for(let s of o){if(s.sinks&&s.sinks.length>0){s.parentSinks==="override"&&i.clear();for(let c of s.sinks)i.add(c)}if(s.filters)for(let c of s.filters)a.add(c);!l&&s.lowestLevel!==void 0&&(n.lowestLevel=s.lowestLevel,l=!0)}for(let s of i){let c=f.sinks.get(s);c&&n.sinks.push(c)}for(let s of a){let c=f.filters.get(s);c&&n.filters.push(c)}return x.set(t,n),n},Nt=(e,t)=>{if(!f)throw new Error("Logging not configured. Call configure() first.");f.sinks.set(e,t),x.clear()},Ot=e=>{f&&(f.sinks.delete(e),x.clear())},Dt=(e,t)=>{if(!f)throw new Error("Logging not configured. Call configure() first.");f.filters.set(e,t),x.clear()},Gt=e=>{f&&(f.filters.delete(e),x.clear())},Mt=e=>{if(!f)throw new Error("Logging not configured. Call configure() first.");let t=d(e.category),r=C(t);f.loggers.set(r,{...e,category:t}),x.clear()},$t=()=>f?Array.from(f.sinks.keys()):[],jt=()=>f?Array.from(f.filters.keys()):[],Vt=()=>f?Array.from(f.loggers.values()).map(e=>d(e.category)):[];var J={};ce(J,{DEFAULT_LEVEL:()=>zt,Logger:()=>D,clearLoggerCache:()=>at,current:()=>Ut,getLogger:()=>Bt});await b();var zt=g.Info,q=e=>e<=4?"TRACE":e<=8?"DEBUG":e<=12?"INFO":e<=16?"WARN":e<=20?"ERROR":e<=24?"FATAL":"PANIC",Kt='"error"',ot=e=>{try{return JSON.stringify(e)}catch{return null}},nt=e=>e instanceof Error?e.message:String(e),it=e=>{try{console.error(e)}catch{}},ve=!1,Wt=e=>{ve||(ve=!0,it(`[eserstack/logging] Go logging backend unavailable (${e}); log records now go to a local console sink on stderr. Reported once per process.`))},Ht=(e,t,r,n)=>{let o=Object.keys(n).length>0?` ${ot(n)??'{"attrs":"unserializable"}'}`:"";it(`${new Date().toISOString()} ${q(t)} ${R(e)}: ${r}${o}`)},st=new Map,D=class e{category;parent;#e;#r=null;#n=null;#o=!1;#i=!1;constructor(t,r=null,n={}){this.category=d(t),this.parent=r,this.#e=n}#s(){return this.#r===null&&(this.#r=he(this.category)),this.#r}#t(t){this.#i=!0,Wt(t)}async#a(){if(this.#o)return this.#n;this.#o=!0;try{await b();let t=O(),r=this.#s(),n=t.symbols.EserAjanLogCreate(JSON.stringify({scopeName:R(this.category),level:q(r.lowestLevel)})),o=JSON.parse(n);if(o.handle===void 0||o.handle==="")return this.#t(o.error??`EserAjanLogCreate returned ${n}`),null;this.#n=o.handle,st.set(C(this.category),o.handle)}catch(t){return this.#t(nt(t)),null}return this.#n}#g(t,r,n,o){let i=ot({handle:t,level:q(r),message:n,attrs:o});if(i===null)return!1;try{let a=O().symbols.EserAjanLogWrite(i);if(!a.includes(Kt))return!0;let l=JSON.parse(a);if(l.error===void 0||l.error==="")return!0;this.#t(l.error)}catch(a){this.#t(nt(a))}return!1}async#c(t,r,n){let o=this.#i?null:await this.#a();o!==null&&this.#g(o,t,r,n)||Ht(this.category,t,r,n)}getChild(t){let r=W(this.category,d(t));return new e(r,this,this.#e)}with(t){return new e(this.category,this.parent,{...this.#e,...t})}get loggerName(){return R(this.category)}asString(t,r=!1){return typeof t=="string"?r?`"${t}"`:t:t===null||typeof t=="number"||typeof t=="bigint"||typeof t=="boolean"||typeof t>"u"||typeof t=="symbol"?String(t):t instanceof Error?t.stack:t!==null&&typeof t=="object"?Array.isArray(t)?JSON.stringify(t):`{${Object.entries(t).map(([n,o])=>`"${n}":${this.asString(o,!0)}`).join(",")}}`:"undefined"}async log(t,r,...n){let o=this.#s();if(t<o.lowestLevel)return r instanceof Function?void 0:r;let i,a;r instanceof Function?(i=r(),a=this.asString(i)):a=this.asString(r);let l=Qe(),s={...this.#e,...l??{}};return n.length>0&&(s.args=n),await this.#c(t,a,s),r instanceof Function?i:r}debug(t,...r){return this.log(g.Debug,t,...r)}info(t,...r){return this.log(g.Info,t,...r)}warn(t,...r){return this.log(g.Warning,t,...r)}error(t,...r){return this.log(g.Error,t,...r)}critical(t,...r){return this.log(g.Critical,t,...r)}emergency(t,...r){return this.log(g.Emergency,t,...r)}alert(t,...r){return this.log(g.Alert,t,...r)}notice(t,...r){return this.log(g.Notice,t,...r)}trace(t,...r){return this.log(g.Trace,t,...r)}},Ce=new Map,Bt=e=>{let t=Ze(d(e)),r=C(t),n=Ce.get(r);return n||(n=new D(t),Ce.set(r,n)),b(),n},at=()=>{Ce.clear(),ve=!1};xe(at);Se(async e=>{await b();let t=O();for(let r of e){if(r.lowestLevel===void 0)continue;let n=d(r.category),o=C(n),i=st.get(o);i!==void 0&&t.symbols.EserAjanLogConfigure(JSON.stringify({handle:i,level:q(r.lowestLevel)}))}});var Ut=new D(["default"]);var Y={};ce(Y,{fingersCrossedSink:()=>nr,getBufferedSink:()=>rr,getOutputSink:()=>er,getRecordCollectorSink:()=>ct,getTestSink:()=>or,withFilter:()=>tr});var qt={[g.Trace]:"TRCE",[g.Debug]:"DBUG",[g.Info]:"INFO",[g.Notice]:"NOTC",[g.Warning]:"WARN",[g.Error]:"ERRO",[g.Critical]:"CRIT",[g.Alert]:"ALRT",[g.Emergency]:"EMRG"};var Jt=(e,t)=>{if(t==="none")return"";if(typeof t=="function")return t(e);let r=e.toISOString(),n=r.slice(0,10),o=r.slice(11,19),i=r.slice(19);switch(t){case"rfc3339":return r;case"date-time-timezone":case void 0:return`${n} ${o}${i}`;case"date-time":return`${n} ${o}`;case"time-timezone":return`${o}${i}`;case"time":return o;case"date":return n}},Yt=e=>{try{return JSON.stringify(e)}catch{return String(e)}},Xt=(e,t)=>{let r={...t,...e},n=Object.entries(r);return n.length===0?"":" "+n.map(([o,i])=>{let a=typeof i=="string"?i:Yt(i);return`${o}=${a}`}).join(" ")};var Qt=(e,t)=>{switch(e){case g.Trace:return K(Me(t));case g.Debug:return $e(t);case g.Info:return De(t);case g.Notice:return ue(t);case g.Warning:return Ge(t);case g.Error:return A(t);case g.Critical:return z(A(t));case g.Alert:return z(A(t));case g.Emergency:return z(A(t));default:return L(t)}},gt=e=>{let t=Jt(e.datetime,"date-time-timezone"),r=qt[e.severity]??"????",n=e.category.length>0?R(e.category):"",o=Xt(e.properties,e.context),i=[];return t&&i.push(K(t),L(" ")),i.push(Qt(e.severity,r),L(" ")),n&&i.push(ue(`[${n}]`),L(" ")),e.severity>=g.Error?i.push(A(e.message)):i.push(L(e.message)),o.trim()&&i.push(L(" "),K(o.trim())),i};var er=(e,t)=>{let r=t?.formatter??gt;return n=>{let o=r(n);e.writeln(...o)}},tr=(e,t)=>r=>{if(t(r))return e(r)},rr=(e,t={})=>{let{maxSize:r=100,flushIntervalMs:n=5e3}=t,o=[],i=null,a=async()=>{if(o.length===0)return;let c=o;o=[],i&&(clearTimeout(i),i=null),await Promise.all(c.map(p=>e(p)))},l=()=>{i===null&&(i=setTimeout(()=>{i=null,a().catch(()=>{})},n))},s=async c=>{o.push(c),o.length>=r?await a():l()};return s.flush=a,s},nr=(e,t={})=>{let{triggerLevel:r=17,maxBufferSize:n=1e3}=t,o=[],i=!1,a=async()=>{let c=o;o=[],i=!0,await Promise.all(c.map(p=>e(p)))},l=()=>{o=[],i=!1},s=async c=>{if(i){await e(c);return}if(c.severity>=r){o.push(c),await a();return}o.push(c),o.length>n&&o.shift()};return s.flush=a,s.clear=l,s},ct=()=>{let e=[];return{sink:r=>{e.push(r)},records:e}},or=ct;var S="1.9.1";var lt=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;function sr(e){let t=new Set([e]),r=new Set,n=e.match(lt);if(!n)return()=>!1;let o={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(o.prerelease!=null)return function(s){return s===e};function i(l){return r.add(l),!1}function a(l){return t.add(l),!0}return function(s){if(t.has(s))return!0;if(r.has(s))return!1;let c=s.match(lt);if(!c)return i(s);let p={major:+c[1],minor:+c[2],patch:+c[3],prerelease:c[4]};return p.prerelease!=null||o.major!==p.major?i(s):o.major===0?o.minor===p.minor&&o.patch<=p.patch?a(s):i(s):o.minor<=p.minor?a(s):i(s)}}var ut=sr(S);var ar=S.split(".")[0],G=Symbol.for(`opentelemetry.js.api.${ar}`),M=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{};function E(e,t,r,n=!1){var o;let i=M[G]=(o=M[G])!==null&&o!==void 0?o:{version:S};if(!n&&i[e]){let a=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return r.error(a.stack||a.message),!1}if(i.version!==S){let a=new Error(`@opentelemetry/api: Registration of version v${i.version} for ${e} does not match previously registered API v${S}`);return r.error(a.stack||a.message),!1}return i[e]=t,r.debug(`@opentelemetry/api: Registered a global for ${e} v${S}.`),!0}function h(e){var t,r;let n=(t=M[G])===null||t===void 0?void 0:t.version;if(!(!n||!ut(n)))return(r=M[G])===null||r===void 0?void 0:r[e]}function P(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${S}.`);let r=M[G];r&&delete r[e]}var X=class{constructor(t){this._namespace=t.namespace||"DiagComponentLogger"}debug(...t){return $("debug",this._namespace,t)}error(...t){return $("error",this._namespace,t)}info(...t){return $("info",this._namespace,t)}warn(...t){return $("warn",this._namespace,t)}verbose(...t){return $("verbose",this._namespace,t)}};function $(e,t,r){let n=h("diag");if(n)return n[e](t,...r)}var m;(function(e){e[e.NONE=0]="NONE",e[e.ERROR=30]="ERROR",e[e.WARN=50]="WARN",e[e.INFO=60]="INFO",e[e.DEBUG=70]="DEBUG",e[e.VERBOSE=80]="VERBOSE",e[e.ALL=9999]="ALL"})(m||(m={}));function ft(e,t){e<m.NONE?e=m.NONE:e>m.ALL&&(e=m.ALL),t=t||{};function r(n,o){let i=t[n];return typeof i=="function"&&e>=o?i.bind(t):function(){}}return{error:r("error",m.ERROR),warn:r("warn",m.WARN),info:r("info",m.INFO),debug:r("debug",m.DEBUG),verbose:r("verbose",m.VERBOSE)}}var gr="diag",T=class e{static instance(){return this._instance||(this._instance=new e),this._instance}constructor(){function t(o){return function(...i){let a=h("diag");if(a)return a[o](...i)}}let r=this,n=(o,i={logLevel:m.INFO})=>{var a,l,s;if(o===r){let u=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((a=u.stack)!==null&&a!==void 0?a:u.message),!1}typeof i=="number"&&(i={logLevel:i});let c=h("diag"),p=ft((l=i.logLevel)!==null&&l!==void 0?l:m.INFO,o);if(c&&!i.suppressOverrideMessage){let u=(s=new Error().stack)!==null&&s!==void 0?s:"<failed to generate stacktrace>";c.warn(`Current logger will be overwritten from ${u}`),p.warn(`Current logger will overwrite one already registered from ${u}`)}return E("diag",p,r,!0)};r.setLogger=n,r.disable=()=>{P(gr,r)},r.createComponentLogger=o=>new X(o),r.verbose=t("verbose"),r.debug=t("debug"),r.info=t("info"),r.warn=t("warn"),r.error=t("error")}};function pt(e){return Symbol.for(e)}var Te=class e{constructor(t){let r=this;r._currentContext=t?new Map(t):new Map,r.getValue=n=>r._currentContext.get(n),r.setValue=(n,o)=>{let i=new e(r._currentContext);return i._currentContext.set(n,o),i},r.deleteValue=n=>{let o=new e(r._currentContext);return o._currentContext.delete(n),o}}},mt=new Te;var Q=class{active(){return mt}with(t,r,n,...o){return r.call(n,...o)}bind(t,r){return r}enable(){return this}disable(){return this}};var we="context",cr=new Q,F=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalContextManager(t){return E(we,t,T.instance())}active(){return this._getContextManager().active()}with(t,r,n,...o){return this._getContextManager().with(t,r,n,...o)}bind(t,r){return this._getContextManager().bind(t,r)}_getContextManager(){return h(we)||cr}disable(){this._getContextManager().disable(),P(we,T.instance())}};var Z;(function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(Z||(Z={}));var Le="0000000000000000",be="00000000000000000000000000000000",dt={traceId:be,spanId:Le,traceFlags:Z.NONE};var y=class{constructor(t=dt){this._spanContext=t}spanContext(){return this._spanContext}setAttribute(t,r){return this}setAttributes(t){return this}addEvent(t,r){return this}addLink(t){return this}addLinks(t){return this}setStatus(t){return this}updateName(t){return this}end(t){}isRecording(){return!1}recordException(t,r){}};var ke=pt("OpenTelemetry Context Key SPAN");function ee(e){return e.getValue(ke)||void 0}function yt(){return ee(F.getInstance().active())}function j(e,t){return e.setValue(ke,t)}function xt(e){return e.deleteValue(ke)}function St(e,t){return j(e,new y(t))}function te(e){var t;return(t=ee(e))===null||t===void 0?void 0:t.spanContext()}var re=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1]);function ht(e,t){if(typeof e!="string"||e.length!==t)return!1;let r=0;for(let n=0;n<e.length;n+=4)r+=(re[e.charCodeAt(n)]|0)+(re[e.charCodeAt(n+1)]|0)+(re[e.charCodeAt(n+2)]|0)+(re[e.charCodeAt(n+3)]|0);return r===t}function lr(e){return ht(e,32)&&e!==be}function ur(e){return ht(e,16)&&e!==Le}function ne(e){return lr(e.traceId)&&ur(e.spanId)}function vt(e){return new y(e)}var Ae=F.getInstance(),_=class{startSpan(t,r,n=Ae.active()){if(!!r?.root)return new y;let i=n&&te(n);return fr(i)&&ne(i)?new y(i):new y}startActiveSpan(t,r,n,o){let i,a,l;if(arguments.length<2)return;arguments.length===2?l=r:arguments.length===3?(i=r,l=n):(i=r,a=n,l=o);let s=a??Ae.active(),c=this.startSpan(t,i,s),p=j(s,c);return Ae.with(p,l,void 0,c)}};function fr(e){return e!==null&&typeof e=="object"&&"spanId"in e&&typeof e.spanId=="string"&&"traceId"in e&&typeof e.traceId=="string"&&"traceFlags"in e&&typeof e.traceFlags=="number"}var pr=new _,oe=class{constructor(t,r,n,o){this._provider=t,this.name=r,this.version=n,this.options=o}startSpan(t,r,n){return this._getTracer().startSpan(t,r,n)}startActiveSpan(t,r,n,o){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let t=this._provider.getDelegateTracer(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):pr}};var ie=class{getTracer(t,r,n){return new _}};var mr=new ie,V=class{getTracer(t,r,n){var o;return(o=this.getDelegateTracer(t,r,n))!==null&&o!==void 0?o:new oe(this,t,r,n)}getDelegate(){var t;return(t=this._delegate)!==null&&t!==void 0?t:mr}setDelegate(t){this._delegate=t}getDelegateTracer(t,r,n){var o;return(o=this._delegate)===null||o===void 0?void 0:o.getTracer(t,r,n)}};var Re="trace",se=class e{constructor(){this._proxyTracerProvider=new V,this.wrapSpanContext=vt,this.isSpanContextValid=ne,this.deleteSpan=xt,this.getSpan=ee,this.getActiveSpan=yt,this.getSpanContext=te,this.setSpan=j,this.setSpanContext=St}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalTracerProvider(t){let r=E(Re,this._proxyTracerProvider,T.instance());return r&&this._proxyTracerProvider.setDelegate(t),r}getTracerProvider(){return h(Re)||this._proxyTracerProvider}getTracer(t,r){return this.getTracerProvider().getTracer(t,r)}disable(){P(Re,T.instance()),this._proxyTracerProvider=new V}};var Ee=se.getInstance();var Zn=Ee.getTracer("@eserstack/logging");var Pe=(e,t,r)=>{let n=e.streamText(t,r);return{name:`ai-text/${e.provider}/${e.modelId}`,readable:new ReadableStream({async start(o){try{for await(let i of n)i.kind==="content_delta"&&o.enqueue(le(i.textDelta));o.close()}catch(i){o.error(i)}}})}};var Sr={cc:"claude-code",ol:"ollama",oc:"opencode",oai:"openai",ant:"anthropic",gem:"gemini",vtx:"vertexai",kr:"kiro"},hr={"claude-code":"Claude Code",ollama:"Ollama",opencode:"OpenCode",kiro:"Kiro",anthropic:"Anthropic API",openai:"OpenAI API",gemini:"Gemini API",vertexai:"Vertex AI"},vr=e=>Sr[e]??e,Cr=async e=>{if(e){let t=v.process.stderr.getWriter(),r=fe({renderer:Ve.ansi(),sink:pe.writable(new WritableStream({async write(n){await t.write(new TextEncoder().encode(String(n.data)))},close(){t.releaseLock()}}))});await U.configure({sinks:{stderr:Y.getOutputSink(r)},loggers:[{category:["ai"],lowestLevel:g.Debug,sinks:["stderr"]}]})}return J.getLogger(["ai","ask"])},Tr=async e=>{if(await e.info("Auto-detecting AI provider..."),await me("claude"))return await e.info("Claude Code detected."),"claude-code";try{if((await fetch("http://localhost:11434/api/version",{signal:AbortSignal.timeout(1e3)})).ok)return await e.info("Ollama detected at localhost:11434."),"ollama"}catch{}if(await me("opencode"))return await e.info("OpenCode detected."),"opencode";if(v.capabilities.env){if(v.env.has("ANTHROPIC_API_KEY")||v.env.has("ANTHROPIC_AUTH_TOKEN"))return await e.info("Anthropic API key detected."),"anthropic";if(v.env.has("OPENAI_API_KEY"))return await e.info("OpenAI API key detected."),"openai"}throw new Error("No AI provider detected. Install claude, ollama, or set ANTHROPIC_API_KEY / ANTHROPIC_AUTH_TOKEN / OPENAI_API_KEY.")},wr=async e=>{let{factoryFor:t}=await import("./mod-6EZYRKWV.js"),r=await t(e);if(r===void 0)throw new Error(`Unknown provider: ${e}`);return r},xo=async e=>{let t=e??[],r=null,n=null,o=null,i=!1,a=!1,l=[],s=0;for(;s<t.length;){let u=t[s];if(u==="-p"||u==="--provider"){r=t[s+1]??null,s+=2;continue}if(u==="-m"||u==="--model"){n=t[s+1]??null,s+=2;continue}if(u==="--max-tokens"){let w=t[s+1];w!==void 0&&(o=Number(w)),s+=2;continue}if(u==="--json"){i=!0,s+=1;continue}if(u==="-v"||u==="--verbose"){a=!0,s+=1;continue}u.startsWith("-")||l.push(u),s+=1}let c=l.join(" ");if(c.length===0)return N({message:'Usage: ai ask "your prompt" [-p provider] [-m model] [--verbose]',exitCode:1});let p=await Cr(a);try{let u=r!==null?vr(r):await Tr(p),w=hr[u]??u,Fe=n??Ar(u);await p.info(`Using ${w} (${Fe})`);let Tt=await wr(u),ae=new We({factories:[Tt]});await ae.addModel("default",{provider:u,model:Fe});let ge=ae.getDefault();if(ge===null)return N({message:"Failed to initialize model",exitCode:1});let _e=[ze("user",c)];if(await p.info(`Sending prompt (${c.length} chars)...`),i){let k=await ge.generateText({messages:_e,maxTokens:o??void 0});if(Oe(k))return await p.error(k.error.message),N({message:k.error.message,exitCode:1});let I=k.value;await p.info(`Response received (${Ke(I).length} chars)`);let Ie=fe({sink:pe.stdout()});Ie.writeln(JSON.stringify(I,null,2)),await Ie.close()}else{let k=Pe(ge,{messages:_e,maxTokens:o??void 0});await je().from(k).to(kr()).run();let I=v.process.stdout.getWriter();await I.write(new TextEncoder().encode(`
2
+ `)),I.releaseLock()}return await ae.close(),Ne(void 0)}catch(u){let w=u instanceof Error?u.message:String(u);return await p.error(w),a&&u instanceof Error&&u.cause!==void 0&&await p.debug(`Cause: ${String(u.cause)}`),N({message:w,exitCode:1})}},Lr=12,br=e=>new Promise(t=>setTimeout(t,e)),kr=(e=Lr)=>{let t=new TextEncoder;return{name:"typewriter",writable:new WritableStream({async write(r){let n=String(r.data),o=v.process.stdout.getWriter();for(let i of n)await o.write(t.encode(i)),await br(e);o.releaseLock()}})}},Ar=e=>{switch(e){case"claude-code":return"claude-sonnet-5";case"ollama":return"llama3";case"opencode":return"default";case"kiro":return"default";case"anthropic":return"claude-sonnet-5";case"openai":return"gpt-5.6-terra";case"gemini":return"gemini-3.6-flash";case"vertexai":return"gemini-3.6-flash";default:return"default"}};export{xo as main};
@@ -0,0 +1 @@
1
+ import{h as R}from"./chunk-5RLCKUIF.js";import{o as x,y as E}from"./chunk-UE56BMAW.js";import"./chunk-XDRX4ZBJ.js";import{c as A}from"./chunk-IFE5SYGK.js";import{c as u,d as c,f as i,h as f,o as w,q as h,r as g}from"./chunk-VXU6XZ66.js";import"./chunk-VJRCTYGL.js";import"./chunk-PKEQKXZW.js";import"./chunk-O4KKKYCH.js";import{E as v,f as k,h as y,j as C,u as S}from"./chunk-KRKOWSYW.js";import{a as m,b as r}from"./chunk-OAWYVETM.js";import{i as d}from"./chunk-Y5E7ZCCX.js";import"./chunk-LJEWPIEI.js";import"./chunk-FE4MKOI4.js";import"./chunk-HISXAZ4Y.js";var X=async p=>{let e=w({renderer:g.ansi(),sink:h.stdout()}),{root:o}=await v(),n=C(p);if(!n.ok)return e.writeln(i(n.error)),await e.close(),r({exitCode:1});let a=(p??[]).filter(s=>!s.startsWith("--spec=")).join(" ")||"No reason given",t;try{t=await y(o,n.spec)}catch(s){let b=s instanceof Error?s.message:String(s);return e.writeln(i(b)),await e.close(),r({exitCode:1})}if(t.spec!==null){let s=`${o}/${k.specDir(t.spec)}`;try{await d.fs.stat(s)}catch{return e.writeln(i(`Active spec '${t.spec}' directory not found.`)),e.writeln(c("Run `noskills reset` to return to idle.")),await e.close(),r({exitCode:1})}}if(t.phase!=="EXECUTING")return e.writeln(i(`Cannot block in phase: ${t.phase}`)),await e.close(),r({exitCode:1});let $=await R(o),l=x(t,a);return l=E(l,"EXECUTING","BLOCKED",$,a),await S(o,l),e.writeln(f("\u26A0")," Spec blocked: ",c(a)),e.writeln("Resolve with: ",u(`${A('next --answer="resolution"')}`)),await e.close(),m(void 0)};export{X as main};
@@ -1 +1 @@
1
- import{f as e,u as s,v as t,w as r,x as a}from"./chunk-YSLRAWBK.js";import"./chunk-OTRBRRIO.js";var o={fs:!1,fsSync:!1,exec:!1,process:!1,env:!1,stdin:!1,stdout:!1,kv:!1},c=()=>({name:"browser",version:globalThis.navigator?.userAgent??"unknown",capabilities:o,fs:s("browser"),path:e,exec:t("browser"),env:a(),process:r("browser")});export{o as BROWSER_CAPABILITIES,c as createBrowserRuntime};
1
+ import{f as e,u as s,v as t,w as r,x as a}from"./chunk-FE4MKOI4.js";import"./chunk-HISXAZ4Y.js";var o={fs:!1,fsSync:!1,exec:!1,process:!1,env:!1,stdin:!1,stdout:!1,kv:!1},c=()=>({name:"browser",version:globalThis.navigator?.userAgent??"unknown",capabilities:o,fs:s("browser"),path:e,exec:t("browser"),env:a(),process:r("browser")});export{o as BROWSER_CAPABILITIES,c as createBrowserRuntime};
@@ -0,0 +1 @@
1
+ import{a as m,b as h,c as g,d as S}from"./chunk-KRRPOVQG.js";import{s as l,t as p}from"./chunk-FE4MKOI4.js";import"./chunk-HISXAZ4Y.js";var y={fs:!0,fsSync:!0,exec:!0,process:!0,env:!0,stdin:!0,stdout:!0,kv:!1},u=async d=>{if(!d)return new Uint8Array(0);let n=[],t=d.getReader();try{for(;;){let{done:e,value:s}=await t.read();if(e)break;n.push(s)}}finally{t.releaseLock()}let a=n.reduce((e,s)=>e+s.length,0),i=new Uint8Array(a),o=0;for(let e of n)i.set(e,o),o+=e.length;return i},f=async(d,n=[],t)=>{let[a,i,o]=l(t),e=Bun.spawn([d,...n],{cwd:t?.cwd,env:t?.env,stdin:t?.stdinText===void 0?a:new TextEncoder().encode(t.stdinText),stdout:i,stderr:o}),[s,r,c]=await Promise.all([e.exited,u(e.stdout),u(e.stderr)]);return{success:s===0,code:s,stdout:r,stderr:c}},P=(d,n=[],t)=>{let[a,i,o]=l(t),e=Bun.spawn([d,...n],{cwd:t?.cwd,env:t?.env,stdin:a,stdout:i,stderr:o}),s=e.exited.then(r=>({success:r===0,code:r,signal:void 0}));return{pid:e.pid,stdin:e.stdin,stdout:e.stdout,stderr:e.stderr,status:s,output:async()=>{let[r,c,w]=await Promise.all([s,u(e.stdout),u(e.stderr)]);return{success:r.success,code:r.code,stdout:c,stderr:w}},kill:r=>{e.kill(r)}}},x=()=>({name:"bun",version:Bun.version,capabilities:y,fs:m(),path:h(),exec:p(f,P),env:g(),process:S()});export{y as BUN_CAPABILITIES,x as createBunRuntime};
@@ -0,0 +1 @@
1
+ import{a as P}from"./chunk-DBKXMYLF.js";import{a as T,d as x}from"./chunk-LN4NDYT6.js";import{h as I}from"./chunk-5RLCKUIF.js";import{K as D,q as k,y as v}from"./chunk-UE56BMAW.js";import"./chunk-XDRX4ZBJ.js";import"./chunk-IFE5SYGK.js";import{d as m,f as i,g as d,o as u,q as f,r as w}from"./chunk-VXU6XZ66.js";import"./chunk-VJRCTYGL.js";import"./chunk-PKEQKXZW.js";import"./chunk-O4KKKYCH.js";import{E as C,f as h,h as S,j as g,k as E,m as y}from"./chunk-KRKOWSYW.js";import{a as p,b as n}from"./chunk-OAWYVETM.js";import{i as l}from"./chunk-Y5E7ZCCX.js";import"./chunk-LJEWPIEI.js";import"./chunk-FE4MKOI4.js";import"./chunk-HISXAZ4Y.js";var Z=async L=>{let t=u({renderer:w.ansi(),sink:f.stdout()}),{root:r}=await C(),o=g(L);if(!o.ok)return t.writeln(i(o.error)),await t.close(),n({exitCode:1});let e;try{e=await S(r,o.spec)}catch(a){let A=a instanceof Error?a.message:String(a);return t.writeln(i(A)),await t.close(),n({exitCode:1})}if(e.phase==="IDLE"||e.phase==="UNINITIALIZED"||e.phase==="COMPLETED")return t.writeln(i(`Cannot cancel in phase: ${e.phase}`)),await t.close(),n({exitCode:1});if(e.spec!==null){let a=`${r}/${h.specDir(e.spec)}`;try{await l.fs.stat(a)}catch{return t.writeln(i(`Active spec '${e.spec}' directory not found.`)),t.writeln(m("Run `noskills reset` to return to idle.")),await t.close(),n({exitCode:1})}}let c=await I(r),s=k(e,"cancelled");s=v(s,e.phase,"COMPLETED",c,"cancelled"),s.spec!==null&&await y(r,s.spec,s);let U=D(s);return await E(r,U),s.spec!==null&&(await T(r,s.spec,"cancelled"),await x(r,s.spec,"cancelled")),await P(r,{ts:new Date().toISOString(),type:"phase-change",spec:e.spec??"unknown",user:c.name,from:e.phase,to:"COMPLETED",reason:"cancelled"}),t.writeln(d("\u2714")," Spec cancelled."),await t.close(),p(void 0)};export{Z as main};