orient-cli 0.1.0 → 0.2.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 (862) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/cli.js.map +1 -1
  3. package/dist/index.d.ts +1 -1
  4. package/dist/index.js +1 -1
  5. package/dist/index.js.map +1 -1
  6. package/dist/integrations/notebooklm/notebooklm-extension.d.ts +1 -1
  7. package/dist/integrations/notebooklm/notebooklm-extension.js +1 -1
  8. package/dist/integrations/notebooklm/notebooklm-extension.js.map +1 -1
  9. package/dist/orient/change-packet.d.ts +2 -1
  10. package/dist/orient/change-packet.js +25 -8
  11. package/dist/orient/change-packet.js.map +1 -1
  12. package/dist/orient/clarify.d.ts +114 -0
  13. package/dist/orient/clarify.js +186 -0
  14. package/dist/orient/clarify.js.map +1 -0
  15. package/dist/orient/clear-command.d.ts +79 -0
  16. package/dist/orient/clear-command.js +117 -0
  17. package/dist/orient/clear-command.js.map +1 -0
  18. package/dist/orient/mode.d.ts +70 -0
  19. package/dist/orient/mode.js +124 -0
  20. package/dist/orient/mode.js.map +1 -0
  21. package/dist/orient/orient-extension.d.ts +1 -1
  22. package/dist/orient/orient-extension.js +306 -17
  23. package/dist/orient/orient-extension.js.map +1 -1
  24. package/dist/orient/plan-execute.d.ts +137 -0
  25. package/dist/orient/plan-execute.js +333 -0
  26. package/dist/orient/plan-execute.js.map +1 -0
  27. package/dist/orient/tiers.d.ts +109 -0
  28. package/dist/orient/tiers.js +162 -0
  29. package/dist/orient/tiers.js.map +1 -0
  30. package/dist/orient/wizard.d.ts +108 -0
  31. package/dist/orient/wizard.js +183 -0
  32. package/dist/orient/wizard.js.map +1 -0
  33. package/docs/open-source-resources.md +1 -1
  34. package/node_modules/@orient-cli/agent-core/README.md +456 -0
  35. package/node_modules/@orient-cli/agent-core/dist/agent-loop.d.ts +24 -0
  36. package/node_modules/@orient-cli/agent-core/dist/agent-loop.d.ts.map +1 -0
  37. package/node_modules/@orient-cli/agent-core/dist/agent-loop.js +404 -0
  38. package/node_modules/@orient-cli/agent-core/dist/agent-loop.js.map +1 -0
  39. package/node_modules/@orient-cli/agent-core/dist/agent.d.ts +115 -0
  40. package/node_modules/@orient-cli/agent-core/dist/agent.d.ts.map +1 -0
  41. package/node_modules/@orient-cli/agent-core/dist/agent.js +395 -0
  42. package/node_modules/@orient-cli/agent-core/dist/agent.js.map +1 -0
  43. package/node_modules/@orient-cli/agent-core/dist/index.d.ts +5 -0
  44. package/node_modules/@orient-cli/agent-core/dist/index.d.ts.map +1 -0
  45. package/node_modules/@orient-cli/agent-core/dist/index.js +9 -0
  46. package/node_modules/@orient-cli/agent-core/dist/index.js.map +1 -0
  47. package/node_modules/@orient-cli/agent-core/dist/proxy.d.ts +85 -0
  48. package/node_modules/@orient-cli/agent-core/dist/proxy.d.ts.map +1 -0
  49. package/node_modules/@orient-cli/agent-core/dist/proxy.js +268 -0
  50. package/node_modules/@orient-cli/agent-core/dist/proxy.js.map +1 -0
  51. package/node_modules/@orient-cli/agent-core/dist/types.d.ts +323 -0
  52. package/node_modules/@orient-cli/agent-core/dist/types.d.ts.map +1 -0
  53. package/node_modules/@orient-cli/agent-core/dist/types.js +2 -0
  54. package/node_modules/@orient-cli/agent-core/dist/types.js.map +1 -0
  55. package/node_modules/@orient-cli/agent-core/package.json +44 -0
  56. package/node_modules/@orient-cli/ai/README.md +1315 -0
  57. package/node_modules/@orient-cli/ai/dist/api-registry.d.ts +20 -0
  58. package/node_modules/@orient-cli/ai/dist/api-registry.d.ts.map +1 -0
  59. package/node_modules/@orient-cli/ai/dist/api-registry.js +44 -0
  60. package/node_modules/@orient-cli/ai/dist/api-registry.js.map +1 -0
  61. package/node_modules/@orient-cli/ai/dist/bedrock-provider.d.ts +5 -0
  62. package/node_modules/@orient-cli/ai/dist/bedrock-provider.d.ts.map +1 -0
  63. package/node_modules/@orient-cli/ai/dist/bedrock-provider.js +6 -0
  64. package/node_modules/@orient-cli/ai/dist/bedrock-provider.js.map +1 -0
  65. package/node_modules/@orient-cli/ai/dist/cli.d.ts +3 -0
  66. package/node_modules/@orient-cli/ai/dist/cli.d.ts.map +1 -0
  67. package/node_modules/@orient-cli/ai/dist/cli.js +116 -0
  68. package/node_modules/@orient-cli/ai/dist/cli.js.map +1 -0
  69. package/node_modules/@orient-cli/ai/dist/env-api-keys.d.ts +9 -0
  70. package/node_modules/@orient-cli/ai/dist/env-api-keys.d.ts.map +1 -0
  71. package/node_modules/@orient-cli/ai/dist/env-api-keys.js +107 -0
  72. package/node_modules/@orient-cli/ai/dist/env-api-keys.js.map +1 -0
  73. package/node_modules/@orient-cli/ai/dist/index.d.ts +26 -0
  74. package/node_modules/@orient-cli/ai/dist/index.d.ts.map +1 -0
  75. package/node_modules/@orient-cli/ai/dist/index.js +14 -0
  76. package/node_modules/@orient-cli/ai/dist/index.js.map +1 -0
  77. package/node_modules/@orient-cli/ai/dist/models.d.ts +24 -0
  78. package/node_modules/@orient-cli/ai/dist/models.d.ts.map +1 -0
  79. package/node_modules/@orient-cli/ai/dist/models.generated.d.ts +14473 -0
  80. package/node_modules/@orient-cli/ai/dist/models.generated.d.ts.map +1 -0
  81. package/node_modules/@orient-cli/ai/dist/models.generated.js +14241 -0
  82. package/node_modules/@orient-cli/ai/dist/models.generated.js.map +1 -0
  83. package/node_modules/@orient-cli/ai/dist/models.js +55 -0
  84. package/node_modules/@orient-cli/ai/dist/models.js.map +1 -0
  85. package/node_modules/@orient-cli/ai/dist/oauth.d.ts +2 -0
  86. package/node_modules/@orient-cli/ai/dist/oauth.d.ts.map +1 -0
  87. package/node_modules/@orient-cli/ai/dist/oauth.js +2 -0
  88. package/node_modules/@orient-cli/ai/dist/oauth.js.map +1 -0
  89. package/node_modules/@orient-cli/ai/dist/providers/amazon-bedrock.d.ts +20 -0
  90. package/node_modules/@orient-cli/ai/dist/providers/amazon-bedrock.d.ts.map +1 -0
  91. package/node_modules/@orient-cli/ai/dist/providers/amazon-bedrock.js +651 -0
  92. package/node_modules/@orient-cli/ai/dist/providers/amazon-bedrock.js.map +1 -0
  93. package/node_modules/@orient-cli/ai/dist/providers/anthropic.d.ts +40 -0
  94. package/node_modules/@orient-cli/ai/dist/providers/anthropic.d.ts.map +1 -0
  95. package/node_modules/@orient-cli/ai/dist/providers/anthropic.js +749 -0
  96. package/node_modules/@orient-cli/ai/dist/providers/anthropic.js.map +1 -0
  97. package/node_modules/@orient-cli/ai/dist/providers/azure-openai-responses.d.ts +15 -0
  98. package/node_modules/@orient-cli/ai/dist/providers/azure-openai-responses.d.ts.map +1 -0
  99. package/node_modules/@orient-cli/ai/dist/providers/azure-openai-responses.js +176 -0
  100. package/node_modules/@orient-cli/ai/dist/providers/azure-openai-responses.js.map +1 -0
  101. package/node_modules/@orient-cli/ai/dist/providers/faux.d.ts +56 -0
  102. package/node_modules/@orient-cli/ai/dist/providers/faux.d.ts.map +1 -0
  103. package/node_modules/@orient-cli/ai/dist/providers/faux.js +367 -0
  104. package/node_modules/@orient-cli/ai/dist/providers/faux.js.map +1 -0
  105. package/node_modules/@orient-cli/ai/dist/providers/github-copilot-headers.d.ts +8 -0
  106. package/node_modules/@orient-cli/ai/dist/providers/github-copilot-headers.d.ts.map +1 -0
  107. package/node_modules/@orient-cli/ai/dist/providers/github-copilot-headers.js +29 -0
  108. package/node_modules/@orient-cli/ai/dist/providers/github-copilot-headers.js.map +1 -0
  109. package/node_modules/@orient-cli/ai/dist/providers/google-gemini-cli.d.ts +74 -0
  110. package/node_modules/@orient-cli/ai/dist/providers/google-gemini-cli.d.ts.map +1 -0
  111. package/node_modules/@orient-cli/ai/dist/providers/google-gemini-cli.js +776 -0
  112. package/node_modules/@orient-cli/ai/dist/providers/google-gemini-cli.js.map +1 -0
  113. package/node_modules/@orient-cli/ai/dist/providers/google-shared.d.ts +65 -0
  114. package/node_modules/@orient-cli/ai/dist/providers/google-shared.d.ts.map +1 -0
  115. package/node_modules/@orient-cli/ai/dist/providers/google-shared.js +312 -0
  116. package/node_modules/@orient-cli/ai/dist/providers/google-shared.js.map +1 -0
  117. package/node_modules/@orient-cli/ai/dist/providers/google-vertex.d.ts +15 -0
  118. package/node_modules/@orient-cli/ai/dist/providers/google-vertex.d.ts.map +1 -0
  119. package/node_modules/@orient-cli/ai/dist/providers/google-vertex.js +419 -0
  120. package/node_modules/@orient-cli/ai/dist/providers/google-vertex.js.map +1 -0
  121. package/node_modules/@orient-cli/ai/dist/providers/google.d.ts +13 -0
  122. package/node_modules/@orient-cli/ai/dist/providers/google.d.ts.map +1 -0
  123. package/node_modules/@orient-cli/ai/dist/providers/google.js +399 -0
  124. package/node_modules/@orient-cli/ai/dist/providers/google.js.map +1 -0
  125. package/node_modules/@orient-cli/ai/dist/providers/mistral.d.ts +22 -0
  126. package/node_modules/@orient-cli/ai/dist/providers/mistral.d.ts.map +1 -0
  127. package/node_modules/@orient-cli/ai/dist/providers/mistral.js +501 -0
  128. package/node_modules/@orient-cli/ai/dist/providers/mistral.js.map +1 -0
  129. package/node_modules/@orient-cli/ai/dist/providers/openai-codex-responses.d.ts +9 -0
  130. package/node_modules/@orient-cli/ai/dist/providers/openai-codex-responses.d.ts.map +1 -0
  131. package/node_modules/@orient-cli/ai/dist/providers/openai-codex-responses.js +741 -0
  132. package/node_modules/@orient-cli/ai/dist/providers/openai-codex-responses.js.map +1 -0
  133. package/node_modules/@orient-cli/ai/dist/providers/openai-completions.d.ts +15 -0
  134. package/node_modules/@orient-cli/ai/dist/providers/openai-completions.d.ts.map +1 -0
  135. package/node_modules/@orient-cli/ai/dist/providers/openai-completions.js +753 -0
  136. package/node_modules/@orient-cli/ai/dist/providers/openai-completions.js.map +1 -0
  137. package/node_modules/@orient-cli/ai/dist/providers/openai-responses-shared.d.ts +17 -0
  138. package/node_modules/@orient-cli/ai/dist/providers/openai-responses-shared.d.ts.map +1 -0
  139. package/node_modules/@orient-cli/ai/dist/providers/openai-responses-shared.js +470 -0
  140. package/node_modules/@orient-cli/ai/dist/providers/openai-responses-shared.js.map +1 -0
  141. package/node_modules/@orient-cli/ai/dist/providers/openai-responses.d.ts +13 -0
  142. package/node_modules/@orient-cli/ai/dist/providers/openai-responses.d.ts.map +1 -0
  143. package/node_modules/@orient-cli/ai/dist/providers/openai-responses.js +190 -0
  144. package/node_modules/@orient-cli/ai/dist/providers/openai-responses.js.map +1 -0
  145. package/node_modules/@orient-cli/ai/dist/providers/register-builtins.d.ts +38 -0
  146. package/node_modules/@orient-cli/ai/dist/providers/register-builtins.d.ts.map +1 -0
  147. package/node_modules/@orient-cli/ai/dist/providers/register-builtins.js +261 -0
  148. package/node_modules/@orient-cli/ai/dist/providers/register-builtins.js.map +1 -0
  149. package/node_modules/@orient-cli/ai/dist/providers/simple-options.d.ts +8 -0
  150. package/node_modules/@orient-cli/ai/dist/providers/simple-options.d.ts.map +1 -0
  151. package/node_modules/@orient-cli/ai/dist/providers/simple-options.js +35 -0
  152. package/node_modules/@orient-cli/ai/dist/providers/simple-options.js.map +1 -0
  153. package/node_modules/@orient-cli/ai/dist/providers/transform-messages.d.ts +8 -0
  154. package/node_modules/@orient-cli/ai/dist/providers/transform-messages.d.ts.map +1 -0
  155. package/node_modules/@orient-cli/ai/dist/providers/transform-messages.js +155 -0
  156. package/node_modules/@orient-cli/ai/dist/providers/transform-messages.js.map +1 -0
  157. package/node_modules/@orient-cli/ai/dist/stream.d.ts +8 -0
  158. package/node_modules/@orient-cli/ai/dist/stream.d.ts.map +1 -0
  159. package/node_modules/@orient-cli/ai/dist/stream.js +27 -0
  160. package/node_modules/@orient-cli/ai/dist/stream.js.map +1 -0
  161. package/node_modules/@orient-cli/ai/dist/types.d.ts +353 -0
  162. package/node_modules/@orient-cli/ai/dist/types.d.ts.map +1 -0
  163. package/node_modules/@orient-cli/ai/dist/types.js +2 -0
  164. package/node_modules/@orient-cli/ai/dist/types.js.map +1 -0
  165. package/node_modules/@orient-cli/ai/dist/utils/event-stream.d.ts +21 -0
  166. package/node_modules/@orient-cli/ai/dist/utils/event-stream.d.ts.map +1 -0
  167. package/node_modules/@orient-cli/ai/dist/utils/event-stream.js +81 -0
  168. package/node_modules/@orient-cli/ai/dist/utils/event-stream.js.map +1 -0
  169. package/node_modules/@orient-cli/ai/dist/utils/hash.d.ts +3 -0
  170. package/node_modules/@orient-cli/ai/dist/utils/hash.d.ts.map +1 -0
  171. package/node_modules/@orient-cli/ai/dist/utils/hash.js +14 -0
  172. package/node_modules/@orient-cli/ai/dist/utils/hash.js.map +1 -0
  173. package/node_modules/@orient-cli/ai/dist/utils/json-parse.d.ts +9 -0
  174. package/node_modules/@orient-cli/ai/dist/utils/json-parse.d.ts.map +1 -0
  175. package/node_modules/@orient-cli/ai/dist/utils/json-parse.js +29 -0
  176. package/node_modules/@orient-cli/ai/dist/utils/json-parse.js.map +1 -0
  177. package/node_modules/@orient-cli/ai/dist/utils/oauth/anthropic.d.ts +25 -0
  178. package/node_modules/@orient-cli/ai/dist/utils/oauth/anthropic.d.ts.map +1 -0
  179. package/node_modules/@orient-cli/ai/dist/utils/oauth/anthropic.js +335 -0
  180. package/node_modules/@orient-cli/ai/dist/utils/oauth/anthropic.js.map +1 -0
  181. package/node_modules/@orient-cli/ai/dist/utils/oauth/github-copilot.d.ts +30 -0
  182. package/node_modules/@orient-cli/ai/dist/utils/oauth/github-copilot.d.ts.map +1 -0
  183. package/node_modules/@orient-cli/ai/dist/utils/oauth/github-copilot.js +292 -0
  184. package/node_modules/@orient-cli/ai/dist/utils/oauth/github-copilot.js.map +1 -0
  185. package/node_modules/@orient-cli/ai/dist/utils/oauth/google-antigravity.d.ts +26 -0
  186. package/node_modules/@orient-cli/ai/dist/utils/oauth/google-antigravity.d.ts.map +1 -0
  187. package/node_modules/@orient-cli/ai/dist/utils/oauth/google-antigravity.js +376 -0
  188. package/node_modules/@orient-cli/ai/dist/utils/oauth/google-antigravity.js.map +1 -0
  189. package/node_modules/@orient-cli/ai/dist/utils/oauth/google-gemini-cli.d.ts +26 -0
  190. package/node_modules/@orient-cli/ai/dist/utils/oauth/google-gemini-cli.d.ts.map +1 -0
  191. package/node_modules/@orient-cli/ai/dist/utils/oauth/google-gemini-cli.js +481 -0
  192. package/node_modules/@orient-cli/ai/dist/utils/oauth/google-gemini-cli.js.map +1 -0
  193. package/node_modules/@orient-cli/ai/dist/utils/oauth/index.d.ts +61 -0
  194. package/node_modules/@orient-cli/ai/dist/utils/oauth/index.d.ts.map +1 -0
  195. package/node_modules/@orient-cli/ai/dist/utils/oauth/index.js +131 -0
  196. package/node_modules/@orient-cli/ai/dist/utils/oauth/index.js.map +1 -0
  197. package/node_modules/@orient-cli/ai/dist/utils/oauth/oauth-page.d.ts +3 -0
  198. package/node_modules/@orient-cli/ai/dist/utils/oauth/oauth-page.d.ts.map +1 -0
  199. package/node_modules/@orient-cli/ai/dist/utils/oauth/oauth-page.js +105 -0
  200. package/node_modules/@orient-cli/ai/dist/utils/oauth/oauth-page.js.map +1 -0
  201. package/node_modules/@orient-cli/ai/dist/utils/oauth/openai-codex.d.ts +34 -0
  202. package/node_modules/@orient-cli/ai/dist/utils/oauth/openai-codex.d.ts.map +1 -0
  203. package/node_modules/@orient-cli/ai/dist/utils/oauth/openai-codex.js +373 -0
  204. package/node_modules/@orient-cli/ai/dist/utils/oauth/openai-codex.js.map +1 -0
  205. package/node_modules/@orient-cli/ai/dist/utils/oauth/pkce.d.ts +13 -0
  206. package/node_modules/@orient-cli/ai/dist/utils/oauth/pkce.d.ts.map +1 -0
  207. package/node_modules/@orient-cli/ai/dist/utils/oauth/pkce.js +31 -0
  208. package/node_modules/@orient-cli/ai/dist/utils/oauth/pkce.js.map +1 -0
  209. package/node_modules/@orient-cli/ai/dist/utils/oauth/types.d.ts +47 -0
  210. package/node_modules/@orient-cli/ai/dist/utils/oauth/types.d.ts.map +1 -0
  211. package/node_modules/@orient-cli/ai/dist/utils/oauth/types.js +2 -0
  212. package/node_modules/@orient-cli/ai/dist/utils/oauth/types.js.map +1 -0
  213. package/node_modules/@orient-cli/ai/dist/utils/overflow.d.ts +53 -0
  214. package/node_modules/@orient-cli/ai/dist/utils/overflow.d.ts.map +1 -0
  215. package/node_modules/@orient-cli/ai/dist/utils/overflow.js +132 -0
  216. package/node_modules/@orient-cli/ai/dist/utils/overflow.js.map +1 -0
  217. package/node_modules/@orient-cli/ai/dist/utils/sanitize-unicode.d.ts +22 -0
  218. package/node_modules/@orient-cli/ai/dist/utils/sanitize-unicode.d.ts.map +1 -0
  219. package/node_modules/@orient-cli/ai/dist/utils/sanitize-unicode.js +26 -0
  220. package/node_modules/@orient-cli/ai/dist/utils/sanitize-unicode.js.map +1 -0
  221. package/node_modules/@orient-cli/ai/dist/utils/typebox-helpers.d.ts +17 -0
  222. package/node_modules/@orient-cli/ai/dist/utils/typebox-helpers.d.ts.map +1 -0
  223. package/node_modules/@orient-cli/ai/dist/utils/typebox-helpers.js +21 -0
  224. package/node_modules/@orient-cli/ai/dist/utils/typebox-helpers.js.map +1 -0
  225. package/node_modules/@orient-cli/ai/dist/utils/validation.d.ts +18 -0
  226. package/node_modules/@orient-cli/ai/dist/utils/validation.d.ts.map +1 -0
  227. package/node_modules/@orient-cli/ai/dist/utils/validation.js +80 -0
  228. package/node_modules/@orient-cli/ai/dist/utils/validation.js.map +1 -0
  229. package/node_modules/@orient-cli/ai/package.json +114 -0
  230. package/node_modules/@orient-cli/coding-agent/README.md +618 -0
  231. package/node_modules/@orient-cli/coding-agent/dist/bun/cli.d.ts +3 -0
  232. package/node_modules/@orient-cli/coding-agent/dist/bun/cli.d.ts.map +1 -0
  233. package/node_modules/@orient-cli/coding-agent/dist/bun/cli.js +7 -0
  234. package/node_modules/@orient-cli/coding-agent/dist/bun/cli.js.map +1 -0
  235. package/node_modules/@orient-cli/coding-agent/dist/bun/register-bedrock.d.ts +2 -0
  236. package/node_modules/@orient-cli/coding-agent/dist/bun/register-bedrock.d.ts.map +1 -0
  237. package/node_modules/@orient-cli/coding-agent/dist/bun/register-bedrock.js +4 -0
  238. package/node_modules/@orient-cli/coding-agent/dist/bun/register-bedrock.js.map +1 -0
  239. package/node_modules/@orient-cli/coding-agent/dist/cli/args.d.ts +52 -0
  240. package/node_modules/@orient-cli/coding-agent/dist/cli/args.d.ts.map +1 -0
  241. package/node_modules/@orient-cli/coding-agent/dist/cli/args.js +326 -0
  242. package/node_modules/@orient-cli/coding-agent/dist/cli/args.js.map +1 -0
  243. package/node_modules/@orient-cli/coding-agent/dist/cli/config-selector.d.ts +14 -0
  244. package/node_modules/@orient-cli/coding-agent/dist/cli/config-selector.d.ts.map +1 -0
  245. package/node_modules/@orient-cli/coding-agent/dist/cli/config-selector.js +31 -0
  246. package/node_modules/@orient-cli/coding-agent/dist/cli/config-selector.js.map +1 -0
  247. package/node_modules/@orient-cli/coding-agent/dist/cli/file-processor.d.ts +15 -0
  248. package/node_modules/@orient-cli/coding-agent/dist/cli/file-processor.d.ts.map +1 -0
  249. package/node_modules/@orient-cli/coding-agent/dist/cli/file-processor.js +83 -0
  250. package/node_modules/@orient-cli/coding-agent/dist/cli/file-processor.js.map +1 -0
  251. package/node_modules/@orient-cli/coding-agent/dist/cli/initial-message.d.ts +18 -0
  252. package/node_modules/@orient-cli/coding-agent/dist/cli/initial-message.d.ts.map +1 -0
  253. package/node_modules/@orient-cli/coding-agent/dist/cli/initial-message.js +22 -0
  254. package/node_modules/@orient-cli/coding-agent/dist/cli/initial-message.js.map +1 -0
  255. package/node_modules/@orient-cli/coding-agent/dist/cli/list-models.d.ts +9 -0
  256. package/node_modules/@orient-cli/coding-agent/dist/cli/list-models.d.ts.map +1 -0
  257. package/node_modules/@orient-cli/coding-agent/dist/cli/list-models.js +92 -0
  258. package/node_modules/@orient-cli/coding-agent/dist/cli/list-models.js.map +1 -0
  259. package/node_modules/@orient-cli/coding-agent/dist/cli/session-picker.d.ts +9 -0
  260. package/node_modules/@orient-cli/coding-agent/dist/cli/session-picker.d.ts.map +1 -0
  261. package/node_modules/@orient-cli/coding-agent/dist/cli/session-picker.js +35 -0
  262. package/node_modules/@orient-cli/coding-agent/dist/cli/session-picker.js.map +1 -0
  263. package/node_modules/@orient-cli/coding-agent/dist/cli.d.ts +3 -0
  264. package/node_modules/@orient-cli/coding-agent/dist/cli.d.ts.map +1 -0
  265. package/node_modules/@orient-cli/coding-agent/dist/cli.js +15 -0
  266. package/node_modules/@orient-cli/coding-agent/dist/cli.js.map +1 -0
  267. package/node_modules/@orient-cli/coding-agent/dist/config.d.ts +77 -0
  268. package/node_modules/@orient-cli/coding-agent/dist/config.d.ts.map +1 -0
  269. package/node_modules/@orient-cli/coding-agent/dist/config.js +229 -0
  270. package/node_modules/@orient-cli/coding-agent/dist/config.js.map +1 -0
  271. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-runtime.d.ts +83 -0
  272. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-runtime.d.ts.map +1 -0
  273. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-runtime.js +236 -0
  274. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-runtime.js.map +1 -0
  275. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-services.d.ts +86 -0
  276. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-services.d.ts.map +1 -0
  277. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-services.js +116 -0
  278. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session-services.js.map +1 -0
  279. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session.d.ts +585 -0
  280. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session.d.ts.map +1 -0
  281. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session.js +2497 -0
  282. package/node_modules/@orient-cli/coding-agent/dist/core/agent-session.js.map +1 -0
  283. package/node_modules/@orient-cli/coding-agent/dist/core/auth-storage.d.ts +132 -0
  284. package/node_modules/@orient-cli/coding-agent/dist/core/auth-storage.d.ts.map +1 -0
  285. package/node_modules/@orient-cli/coding-agent/dist/core/auth-storage.js +422 -0
  286. package/node_modules/@orient-cli/coding-agent/dist/core/auth-storage.js.map +1 -0
  287. package/node_modules/@orient-cli/coding-agent/dist/core/bash-executor.d.ts +46 -0
  288. package/node_modules/@orient-cli/coding-agent/dist/core/bash-executor.d.ts.map +1 -0
  289. package/node_modules/@orient-cli/coding-agent/dist/core/bash-executor.js +125 -0
  290. package/node_modules/@orient-cli/coding-agent/dist/core/bash-executor.js.map +1 -0
  291. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/branch-summarization.d.ts +88 -0
  292. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/branch-summarization.d.ts.map +1 -0
  293. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/branch-summarization.js +243 -0
  294. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/branch-summarization.js.map +1 -0
  295. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/compaction.d.ts +121 -0
  296. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/compaction.d.ts.map +1 -0
  297. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/compaction.js +613 -0
  298. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/compaction.js.map +1 -0
  299. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/index.d.ts +7 -0
  300. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/index.d.ts.map +1 -0
  301. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/index.js +7 -0
  302. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/index.js.map +1 -0
  303. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/utils.d.ts +38 -0
  304. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/utils.d.ts.map +1 -0
  305. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/utils.js +153 -0
  306. package/node_modules/@orient-cli/coding-agent/dist/core/compaction/utils.js.map +1 -0
  307. package/node_modules/@orient-cli/coding-agent/dist/core/defaults.d.ts +3 -0
  308. package/node_modules/@orient-cli/coding-agent/dist/core/defaults.d.ts.map +1 -0
  309. package/node_modules/@orient-cli/coding-agent/dist/core/defaults.js +2 -0
  310. package/node_modules/@orient-cli/coding-agent/dist/core/defaults.js.map +1 -0
  311. package/node_modules/@orient-cli/coding-agent/dist/core/diagnostics.d.ts +15 -0
  312. package/node_modules/@orient-cli/coding-agent/dist/core/diagnostics.d.ts.map +1 -0
  313. package/node_modules/@orient-cli/coding-agent/dist/core/diagnostics.js +2 -0
  314. package/node_modules/@orient-cli/coding-agent/dist/core/diagnostics.js.map +1 -0
  315. package/node_modules/@orient-cli/coding-agent/dist/core/event-bus.d.ts +9 -0
  316. package/node_modules/@orient-cli/coding-agent/dist/core/event-bus.d.ts.map +1 -0
  317. package/node_modules/@orient-cli/coding-agent/dist/core/event-bus.js +25 -0
  318. package/node_modules/@orient-cli/coding-agent/dist/core/event-bus.js.map +1 -0
  319. package/node_modules/@orient-cli/coding-agent/dist/core/exec.d.ts +29 -0
  320. package/node_modules/@orient-cli/coding-agent/dist/core/exec.d.ts.map +1 -0
  321. package/node_modules/@orient-cli/coding-agent/dist/core/exec.js +75 -0
  322. package/node_modules/@orient-cli/coding-agent/dist/core/exec.js.map +1 -0
  323. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/ansi-to-html.d.ts +22 -0
  324. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
  325. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/ansi-to-html.js +249 -0
  326. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/ansi-to-html.js.map +1 -0
  327. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/index.d.ts +37 -0
  328. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/index.d.ts.map +1 -0
  329. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/index.js +224 -0
  330. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/index.js.map +1 -0
  331. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/template.css +1001 -0
  332. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/template.html +55 -0
  333. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/template.js +1690 -0
  334. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/tool-renderer.d.ts +40 -0
  335. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/tool-renderer.d.ts.map +1 -0
  336. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/tool-renderer.js +95 -0
  337. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/tool-renderer.js.map +1 -0
  338. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/vendor/highlight.min.js +1213 -0
  339. package/node_modules/@orient-cli/coding-agent/dist/core/export-html/vendor/marked.min.js +6 -0
  340. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/index.d.ts +12 -0
  341. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/index.d.ts.map +1 -0
  342. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/index.js +9 -0
  343. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/index.js.map +1 -0
  344. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/loader.d.ts +25 -0
  345. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/loader.d.ts.map +1 -0
  346. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/loader.js +438 -0
  347. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/loader.js.map +1 -0
  348. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/runner.d.ts +148 -0
  349. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/runner.d.ts.map +1 -0
  350. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/runner.js +700 -0
  351. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/runner.js.map +1 -0
  352. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/types.d.ts +1073 -0
  353. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/types.d.ts.map +1 -0
  354. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/types.js +45 -0
  355. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/types.js.map +1 -0
  356. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/wrapper.d.ts +20 -0
  357. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/wrapper.d.ts.map +1 -0
  358. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/wrapper.js +22 -0
  359. package/node_modules/@orient-cli/coding-agent/dist/core/extensions/wrapper.js.map +1 -0
  360. package/node_modules/@orient-cli/coding-agent/dist/core/footer-data-provider.d.ts +48 -0
  361. package/node_modules/@orient-cli/coding-agent/dist/core/footer-data-provider.d.ts.map +1 -0
  362. package/node_modules/@orient-cli/coding-agent/dist/core/footer-data-provider.js +314 -0
  363. package/node_modules/@orient-cli/coding-agent/dist/core/footer-data-provider.js.map +1 -0
  364. package/node_modules/@orient-cli/coding-agent/dist/core/index.d.ts +12 -0
  365. package/node_modules/@orient-cli/coding-agent/dist/core/index.d.ts.map +1 -0
  366. package/node_modules/@orient-cli/coding-agent/dist/core/index.js +12 -0
  367. package/node_modules/@orient-cli/coding-agent/dist/core/index.js.map +1 -0
  368. package/node_modules/@orient-cli/coding-agent/dist/core/keybindings.d.ts +288 -0
  369. package/node_modules/@orient-cli/coding-agent/dist/core/keybindings.d.ts.map +1 -0
  370. package/node_modules/@orient-cli/coding-agent/dist/core/keybindings.js +240 -0
  371. package/node_modules/@orient-cli/coding-agent/dist/core/keybindings.js.map +1 -0
  372. package/node_modules/@orient-cli/coding-agent/dist/core/messages.d.ts +77 -0
  373. package/node_modules/@orient-cli/coding-agent/dist/core/messages.d.ts.map +1 -0
  374. package/node_modules/@orient-cli/coding-agent/dist/core/messages.js +123 -0
  375. package/node_modules/@orient-cli/coding-agent/dist/core/messages.js.map +1 -0
  376. package/node_modules/@orient-cli/coding-agent/dist/core/model-registry.d.ts +132 -0
  377. package/node_modules/@orient-cli/coding-agent/dist/core/model-registry.d.ts.map +1 -0
  378. package/node_modules/@orient-cli/coding-agent/dist/core/model-registry.js +612 -0
  379. package/node_modules/@orient-cli/coding-agent/dist/core/model-registry.js.map +1 -0
  380. package/node_modules/@orient-cli/coding-agent/dist/core/model-resolver.d.ts +110 -0
  381. package/node_modules/@orient-cli/coding-agent/dist/core/model-resolver.d.ts.map +1 -0
  382. package/node_modules/@orient-cli/coding-agent/dist/core/model-resolver.js +486 -0
  383. package/node_modules/@orient-cli/coding-agent/dist/core/model-resolver.js.map +1 -0
  384. package/node_modules/@orient-cli/coding-agent/dist/core/output-guard.d.ts +6 -0
  385. package/node_modules/@orient-cli/coding-agent/dist/core/output-guard.d.ts.map +1 -0
  386. package/node_modules/@orient-cli/coding-agent/dist/core/output-guard.js +59 -0
  387. package/node_modules/@orient-cli/coding-agent/dist/core/output-guard.js.map +1 -0
  388. package/node_modules/@orient-cli/coding-agent/dist/core/package-manager.d.ts +192 -0
  389. package/node_modules/@orient-cli/coding-agent/dist/core/package-manager.d.ts.map +1 -0
  390. package/node_modules/@orient-cli/coding-agent/dist/core/package-manager.js +1829 -0
  391. package/node_modules/@orient-cli/coding-agent/dist/core/package-manager.js.map +1 -0
  392. package/node_modules/@orient-cli/coding-agent/dist/core/prompt-templates.d.ts +51 -0
  393. package/node_modules/@orient-cli/coding-agent/dist/core/prompt-templates.d.ts.map +1 -0
  394. package/node_modules/@orient-cli/coding-agent/dist/core/prompt-templates.js +249 -0
  395. package/node_modules/@orient-cli/coding-agent/dist/core/prompt-templates.js.map +1 -0
  396. package/node_modules/@orient-cli/coding-agent/dist/core/resolve-config-value.d.ts +23 -0
  397. package/node_modules/@orient-cli/coding-agent/dist/core/resolve-config-value.d.ts.map +1 -0
  398. package/node_modules/@orient-cli/coding-agent/dist/core/resolve-config-value.js +126 -0
  399. package/node_modules/@orient-cli/coding-agent/dist/core/resolve-config-value.js.map +1 -0
  400. package/node_modules/@orient-cli/coding-agent/dist/core/resource-loader.d.ts +185 -0
  401. package/node_modules/@orient-cli/coding-agent/dist/core/resource-loader.d.ts.map +1 -0
  402. package/node_modules/@orient-cli/coding-agent/dist/core/resource-loader.js +720 -0
  403. package/node_modules/@orient-cli/coding-agent/dist/core/resource-loader.js.map +1 -0
  404. package/node_modules/@orient-cli/coding-agent/dist/core/sdk.d.ts +93 -0
  405. package/node_modules/@orient-cli/coding-agent/dist/core/sdk.d.ts.map +1 -0
  406. package/node_modules/@orient-cli/coding-agent/dist/core/sdk.js +236 -0
  407. package/node_modules/@orient-cli/coding-agent/dist/core/sdk.js.map +1 -0
  408. package/node_modules/@orient-cli/coding-agent/dist/core/session-cwd.d.ts +19 -0
  409. package/node_modules/@orient-cli/coding-agent/dist/core/session-cwd.d.ts.map +1 -0
  410. package/node_modules/@orient-cli/coding-agent/dist/core/session-cwd.js +38 -0
  411. package/node_modules/@orient-cli/coding-agent/dist/core/session-cwd.js.map +1 -0
  412. package/node_modules/@orient-cli/coding-agent/dist/core/session-manager.d.ts +333 -0
  413. package/node_modules/@orient-cli/coding-agent/dist/core/session-manager.d.ts.map +1 -0
  414. package/node_modules/@orient-cli/coding-agent/dist/core/session-manager.js +1105 -0
  415. package/node_modules/@orient-cli/coding-agent/dist/core/session-manager.js.map +1 -0
  416. package/node_modules/@orient-cli/coding-agent/dist/core/settings-manager.d.ts +237 -0
  417. package/node_modules/@orient-cli/coding-agent/dist/core/settings-manager.d.ts.map +1 -0
  418. package/node_modules/@orient-cli/coding-agent/dist/core/settings-manager.js +708 -0
  419. package/node_modules/@orient-cli/coding-agent/dist/core/settings-manager.js.map +1 -0
  420. package/node_modules/@orient-cli/coding-agent/dist/core/skills.d.ts +60 -0
  421. package/node_modules/@orient-cli/coding-agent/dist/core/skills.d.ts.map +1 -0
  422. package/node_modules/@orient-cli/coding-agent/dist/core/skills.js +409 -0
  423. package/node_modules/@orient-cli/coding-agent/dist/core/skills.js.map +1 -0
  424. package/node_modules/@orient-cli/coding-agent/dist/core/slash-commands.d.ts +14 -0
  425. package/node_modules/@orient-cli/coding-agent/dist/core/slash-commands.d.ts.map +1 -0
  426. package/node_modules/@orient-cli/coding-agent/dist/core/slash-commands.js +23 -0
  427. package/node_modules/@orient-cli/coding-agent/dist/core/slash-commands.js.map +1 -0
  428. package/node_modules/@orient-cli/coding-agent/dist/core/source-info.d.ts +18 -0
  429. package/node_modules/@orient-cli/coding-agent/dist/core/source-info.d.ts.map +1 -0
  430. package/node_modules/@orient-cli/coding-agent/dist/core/source-info.js +19 -0
  431. package/node_modules/@orient-cli/coding-agent/dist/core/source-info.js.map +1 -0
  432. package/node_modules/@orient-cli/coding-agent/dist/core/system-prompt.d.ts +28 -0
  433. package/node_modules/@orient-cli/coding-agent/dist/core/system-prompt.d.ts.map +1 -0
  434. package/node_modules/@orient-cli/coding-agent/dist/core/system-prompt.js +116 -0
  435. package/node_modules/@orient-cli/coding-agent/dist/core/system-prompt.js.map +1 -0
  436. package/node_modules/@orient-cli/coding-agent/dist/core/timings.d.ts +8 -0
  437. package/node_modules/@orient-cli/coding-agent/dist/core/timings.d.ts.map +1 -0
  438. package/node_modules/@orient-cli/coding-agent/dist/core/timings.js +31 -0
  439. package/node_modules/@orient-cli/coding-agent/dist/core/timings.js.map +1 -0
  440. package/node_modules/@orient-cli/coding-agent/dist/core/tools/bash.d.ts +73 -0
  441. package/node_modules/@orient-cli/coding-agent/dist/core/tools/bash.d.ts.map +1 -0
  442. package/node_modules/@orient-cli/coding-agent/dist/core/tools/bash.js +352 -0
  443. package/node_modules/@orient-cli/coding-agent/dist/core/tools/bash.js.map +1 -0
  444. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit-diff.d.ts +85 -0
  445. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit-diff.d.ts.map +1 -0
  446. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit-diff.js +337 -0
  447. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit-diff.js.map +1 -0
  448. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit.d.ts +53 -0
  449. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit.d.ts.map +1 -0
  450. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit.js +196 -0
  451. package/node_modules/@orient-cli/coding-agent/dist/core/tools/edit.js.map +1 -0
  452. package/node_modules/@orient-cli/coding-agent/dist/core/tools/file-mutation-queue.d.ts +6 -0
  453. package/node_modules/@orient-cli/coding-agent/dist/core/tools/file-mutation-queue.d.ts.map +1 -0
  454. package/node_modules/@orient-cli/coding-agent/dist/core/tools/file-mutation-queue.js +37 -0
  455. package/node_modules/@orient-cli/coding-agent/dist/core/tools/file-mutation-queue.js.map +1 -0
  456. package/node_modules/@orient-cli/coding-agent/dist/core/tools/find.d.ts +46 -0
  457. package/node_modules/@orient-cli/coding-agent/dist/core/tools/find.d.ts.map +1 -0
  458. package/node_modules/@orient-cli/coding-agent/dist/core/tools/find.js +258 -0
  459. package/node_modules/@orient-cli/coding-agent/dist/core/tools/find.js.map +1 -0
  460. package/node_modules/@orient-cli/coding-agent/dist/core/tools/grep.d.ts +56 -0
  461. package/node_modules/@orient-cli/coding-agent/dist/core/tools/grep.d.ts.map +1 -0
  462. package/node_modules/@orient-cli/coding-agent/dist/core/tools/grep.js +293 -0
  463. package/node_modules/@orient-cli/coding-agent/dist/core/tools/grep.js.map +1 -0
  464. package/node_modules/@orient-cli/coding-agent/dist/core/tools/index.d.ts +115 -0
  465. package/node_modules/@orient-cli/coding-agent/dist/core/tools/index.d.ts.map +1 -0
  466. package/node_modules/@orient-cli/coding-agent/dist/core/tools/index.js +86 -0
  467. package/node_modules/@orient-cli/coding-agent/dist/core/tools/index.js.map +1 -0
  468. package/node_modules/@orient-cli/coding-agent/dist/core/tools/ls.d.ts +46 -0
  469. package/node_modules/@orient-cli/coding-agent/dist/core/tools/ls.d.ts.map +1 -0
  470. package/node_modules/@orient-cli/coding-agent/dist/core/tools/ls.js +172 -0
  471. package/node_modules/@orient-cli/coding-agent/dist/core/tools/ls.js.map +1 -0
  472. package/node_modules/@orient-cli/coding-agent/dist/core/tools/path-utils.d.ts +8 -0
  473. package/node_modules/@orient-cli/coding-agent/dist/core/tools/path-utils.d.ts.map +1 -0
  474. package/node_modules/@orient-cli/coding-agent/dist/core/tools/path-utils.js +81 -0
  475. package/node_modules/@orient-cli/coding-agent/dist/core/tools/path-utils.js.map +1 -0
  476. package/node_modules/@orient-cli/coding-agent/dist/core/tools/read.d.ts +46 -0
  477. package/node_modules/@orient-cli/coding-agent/dist/core/tools/read.d.ts.map +1 -0
  478. package/node_modules/@orient-cli/coding-agent/dist/core/tools/read.js +225 -0
  479. package/node_modules/@orient-cli/coding-agent/dist/core/tools/read.js.map +1 -0
  480. package/node_modules/@orient-cli/coding-agent/dist/core/tools/render-utils.d.ts +21 -0
  481. package/node_modules/@orient-cli/coding-agent/dist/core/tools/render-utils.d.ts.map +1 -0
  482. package/node_modules/@orient-cli/coding-agent/dist/core/tools/render-utils.js +49 -0
  483. package/node_modules/@orient-cli/coding-agent/dist/core/tools/render-utils.js.map +1 -0
  484. package/node_modules/@orient-cli/coding-agent/dist/core/tools/tool-definition-wrapper.d.ts +14 -0
  485. package/node_modules/@orient-cli/coding-agent/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -0
  486. package/node_modules/@orient-cli/coding-agent/dist/core/tools/tool-definition-wrapper.js +32 -0
  487. package/node_modules/@orient-cli/coding-agent/dist/core/tools/tool-definition-wrapper.js.map +1 -0
  488. package/node_modules/@orient-cli/coding-agent/dist/core/tools/truncate.d.ts +70 -0
  489. package/node_modules/@orient-cli/coding-agent/dist/core/tools/truncate.d.ts.map +1 -0
  490. package/node_modules/@orient-cli/coding-agent/dist/core/tools/truncate.js +205 -0
  491. package/node_modules/@orient-cli/coding-agent/dist/core/tools/truncate.js.map +1 -0
  492. package/node_modules/@orient-cli/coding-agent/dist/core/tools/write.d.ts +35 -0
  493. package/node_modules/@orient-cli/coding-agent/dist/core/tools/write.d.ts.map +1 -0
  494. package/node_modules/@orient-cli/coding-agent/dist/core/tools/write.js +216 -0
  495. package/node_modules/@orient-cli/coding-agent/dist/core/tools/write.js.map +1 -0
  496. package/node_modules/@orient-cli/coding-agent/dist/index.d.ts +28 -0
  497. package/node_modules/@orient-cli/coding-agent/dist/index.d.ts.map +1 -0
  498. package/node_modules/@orient-cli/coding-agent/dist/index.js +43 -0
  499. package/node_modules/@orient-cli/coding-agent/dist/index.js.map +1 -0
  500. package/node_modules/@orient-cli/coding-agent/dist/main.d.ts +8 -0
  501. package/node_modules/@orient-cli/coding-agent/dist/main.d.ts.map +1 -0
  502. package/node_modules/@orient-cli/coding-agent/dist/main.js +593 -0
  503. package/node_modules/@orient-cli/coding-agent/dist/main.js.map +1 -0
  504. package/node_modules/@orient-cli/coding-agent/dist/migrations.d.ts +33 -0
  505. package/node_modules/@orient-cli/coding-agent/dist/migrations.d.ts.map +1 -0
  506. package/node_modules/@orient-cli/coding-agent/dist/migrations.js +281 -0
  507. package/node_modules/@orient-cli/coding-agent/dist/migrations.js.map +1 -0
  508. package/node_modules/@orient-cli/coding-agent/dist/modes/index.d.ts +9 -0
  509. package/node_modules/@orient-cli/coding-agent/dist/modes/index.d.ts.map +1 -0
  510. package/node_modules/@orient-cli/coding-agent/dist/modes/index.js +8 -0
  511. package/node_modules/@orient-cli/coding-agent/dist/modes/index.js.map +1 -0
  512. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/assistant-message.d.ts +18 -0
  513. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
  514. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/assistant-message.js +107 -0
  515. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/assistant-message.js.map +1 -0
  516. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bash-execution.d.ts +34 -0
  517. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bash-execution.d.ts.map +1 -0
  518. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bash-execution.js +175 -0
  519. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bash-execution.js.map +1 -0
  520. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bordered-loader.d.ts +16 -0
  521. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -0
  522. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bordered-loader.js +51 -0
  523. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/bordered-loader.js.map +1 -0
  524. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/branch-summary-message.d.ts +16 -0
  525. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -0
  526. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/branch-summary-message.js +44 -0
  527. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/branch-summary-message.js.map +1 -0
  528. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/compaction-summary-message.d.ts +16 -0
  529. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -0
  530. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/compaction-summary-message.js +45 -0
  531. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/compaction-summary-message.js.map +1 -0
  532. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/config-selector.d.ts +71 -0
  533. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/config-selector.d.ts.map +1 -0
  534. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/config-selector.js +479 -0
  535. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/config-selector.js.map +1 -0
  536. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
  537. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -0
  538. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/countdown-timer.js +33 -0
  539. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/countdown-timer.js.map +1 -0
  540. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-editor.d.ts +21 -0
  541. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-editor.d.ts.map +1 -0
  542. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-editor.js +70 -0
  543. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-editor.js.map +1 -0
  544. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-message.d.ts +20 -0
  545. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-message.d.ts.map +1 -0
  546. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-message.js +79 -0
  547. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/custom-message.js.map +1 -0
  548. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/diff.d.ts +12 -0
  549. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/diff.d.ts.map +1 -0
  550. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/diff.js +133 -0
  551. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/diff.js.map +1 -0
  552. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/dynamic-border.d.ts +15 -0
  553. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -0
  554. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/dynamic-border.js +21 -0
  555. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/dynamic-border.js.map +1 -0
  556. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-editor.d.ts +20 -0
  557. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-editor.d.ts.map +1 -0
  558. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-editor.js +111 -0
  559. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-editor.js.map +1 -0
  560. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-input.d.ts +23 -0
  561. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-input.d.ts.map +1 -0
  562. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-input.js +61 -0
  563. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-input.js.map +1 -0
  564. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-selector.d.ts +24 -0
  565. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-selector.d.ts.map +1 -0
  566. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-selector.js +78 -0
  567. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/extension-selector.js.map +1 -0
  568. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/footer.d.ts +27 -0
  569. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/footer.d.ts.map +1 -0
  570. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/footer.js +201 -0
  571. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/footer.js.map +1 -0
  572. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/index.d.ts +31 -0
  573. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/index.d.ts.map +1 -0
  574. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/index.js +34 -0
  575. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/index.js.map +1 -0
  576. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/keybinding-hints.d.ts +8 -0
  577. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -0
  578. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/keybinding-hints.js +22 -0
  579. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/keybinding-hints.js.map +1 -0
  580. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/login-dialog.d.ts +42 -0
  581. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/login-dialog.d.ts.map +1 -0
  582. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/login-dialog.js +145 -0
  583. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/login-dialog.js.map +1 -0
  584. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/model-selector.d.ts +47 -0
  585. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/model-selector.d.ts.map +1 -0
  586. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/model-selector.js +275 -0
  587. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/model-selector.js.map +1 -0
  588. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/oauth-selector.d.ts +19 -0
  589. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -0
  590. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/oauth-selector.js +97 -0
  591. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/oauth-selector.js.map +1 -0
  592. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/orient-banner.d.ts +53 -0
  593. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/orient-banner.d.ts.map +1 -0
  594. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/orient-banner.js +204 -0
  595. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/orient-banner.js.map +1 -0
  596. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/scoped-models-selector.d.ts +49 -0
  597. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -0
  598. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/scoped-models-selector.js +275 -0
  599. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/scoped-models-selector.js.map +1 -0
  600. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector-search.d.ts +23 -0
  601. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -0
  602. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector-search.js +155 -0
  603. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector-search.js.map +1 -0
  604. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector.d.ts +95 -0
  605. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector.d.ts.map +1 -0
  606. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector.js +848 -0
  607. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/session-selector.js.map +1 -0
  608. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/settings-selector.d.ts +58 -0
  609. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/settings-selector.d.ts.map +1 -0
  610. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/settings-selector.js +301 -0
  611. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/settings-selector.js.map +1 -0
  612. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/show-images-selector.d.ts +10 -0
  613. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -0
  614. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/show-images-selector.js +39 -0
  615. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/show-images-selector.js.map +1 -0
  616. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts +17 -0
  617. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -0
  618. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/skill-invocation-message.js +47 -0
  619. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/skill-invocation-message.js.map +1 -0
  620. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/theme-selector.d.ts +11 -0
  621. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/theme-selector.d.ts.map +1 -0
  622. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/theme-selector.js +50 -0
  623. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/theme-selector.js.map +1 -0
  624. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/thinking-selector.d.ts +11 -0
  625. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -0
  626. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/thinking-selector.js +51 -0
  627. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/thinking-selector.js.map +1 -0
  628. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tool-execution.d.ts +58 -0
  629. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tool-execution.d.ts.map +1 -0
  630. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tool-execution.js +274 -0
  631. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tool-execution.js.map +1 -0
  632. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tree-selector.d.ts +89 -0
  633. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tree-selector.d.ts.map +1 -0
  634. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tree-selector.js +1084 -0
  635. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/tree-selector.js.map +1 -0
  636. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message-selector.d.ts +30 -0
  637. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -0
  638. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message-selector.js +113 -0
  639. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message-selector.js.map +1 -0
  640. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message.d.ts +9 -0
  641. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message.d.ts.map +1 -0
  642. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message.js +28 -0
  643. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/user-message.js.map +1 -0
  644. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/visual-truncate.d.ts +24 -0
  645. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -0
  646. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/visual-truncate.js +33 -0
  647. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/components/visual-truncate.js.map +1 -0
  648. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/interactive-mode.d.ts +321 -0
  649. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
  650. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/interactive-mode.js +4000 -0
  651. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -0
  652. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/dark.json +85 -0
  653. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/light.json +84 -0
  654. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/theme-schema.json +335 -0
  655. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/theme.d.ts +81 -0
  656. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -0
  657. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/theme.js +979 -0
  658. package/node_modules/@orient-cli/coding-agent/dist/modes/interactive/theme/theme.js.map +1 -0
  659. package/node_modules/@orient-cli/coding-agent/dist/modes/print-mode.d.ts +28 -0
  660. package/node_modules/@orient-cli/coding-agent/dist/modes/print-mode.d.ts.map +1 -0
  661. package/node_modules/@orient-cli/coding-agent/dist/modes/print-mode.js +112 -0
  662. package/node_modules/@orient-cli/coding-agent/dist/modes/print-mode.js.map +1 -0
  663. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/jsonl.d.ts +17 -0
  664. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/jsonl.d.ts.map +1 -0
  665. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/jsonl.js +49 -0
  666. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/jsonl.js.map +1 -0
  667. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-client.d.ts +217 -0
  668. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-client.d.ts.map +1 -0
  669. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-client.js +402 -0
  670. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-client.js.map +1 -0
  671. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-mode.d.ts +20 -0
  672. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-mode.d.ts.map +1 -0
  673. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-mode.js +550 -0
  674. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-mode.js.map +1 -0
  675. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-types.d.ts +408 -0
  676. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-types.d.ts.map +1 -0
  677. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-types.js +8 -0
  678. package/node_modules/@orient-cli/coding-agent/dist/modes/rpc/rpc-types.js.map +1 -0
  679. package/node_modules/@orient-cli/coding-agent/dist/package-manager-cli.d.ts +4 -0
  680. package/node_modules/@orient-cli/coding-agent/dist/package-manager-cli.d.ts.map +1 -0
  681. package/node_modules/@orient-cli/coding-agent/dist/package-manager-cli.js +234 -0
  682. package/node_modules/@orient-cli/coding-agent/dist/package-manager-cli.js.map +1 -0
  683. package/node_modules/@orient-cli/coding-agent/dist/utils/changelog.d.ts +21 -0
  684. package/node_modules/@orient-cli/coding-agent/dist/utils/changelog.d.ts.map +1 -0
  685. package/node_modules/@orient-cli/coding-agent/dist/utils/changelog.js +87 -0
  686. package/node_modules/@orient-cli/coding-agent/dist/utils/changelog.js.map +1 -0
  687. package/node_modules/@orient-cli/coding-agent/dist/utils/child-process.d.ts +11 -0
  688. package/node_modules/@orient-cli/coding-agent/dist/utils/child-process.d.ts.map +1 -0
  689. package/node_modules/@orient-cli/coding-agent/dist/utils/child-process.js +78 -0
  690. package/node_modules/@orient-cli/coding-agent/dist/utils/child-process.js.map +1 -0
  691. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-image.d.ts +11 -0
  692. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-image.d.ts.map +1 -0
  693. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-image.js +245 -0
  694. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-image.js.map +1 -0
  695. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-native.d.ts +8 -0
  696. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-native.d.ts.map +1 -0
  697. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-native.js +14 -0
  698. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard-native.js.map +1 -0
  699. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard.d.ts +2 -0
  700. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard.d.ts.map +1 -0
  701. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard.js +78 -0
  702. package/node_modules/@orient-cli/coding-agent/dist/utils/clipboard.js.map +1 -0
  703. package/node_modules/@orient-cli/coding-agent/dist/utils/exif-orientation.d.ts +5 -0
  704. package/node_modules/@orient-cli/coding-agent/dist/utils/exif-orientation.d.ts.map +1 -0
  705. package/node_modules/@orient-cli/coding-agent/dist/utils/exif-orientation.js +158 -0
  706. package/node_modules/@orient-cli/coding-agent/dist/utils/exif-orientation.js.map +1 -0
  707. package/node_modules/@orient-cli/coding-agent/dist/utils/frontmatter.d.ts +8 -0
  708. package/node_modules/@orient-cli/coding-agent/dist/utils/frontmatter.d.ts.map +1 -0
  709. package/node_modules/@orient-cli/coding-agent/dist/utils/frontmatter.js +26 -0
  710. package/node_modules/@orient-cli/coding-agent/dist/utils/frontmatter.js.map +1 -0
  711. package/node_modules/@orient-cli/coding-agent/dist/utils/git.d.ts +26 -0
  712. package/node_modules/@orient-cli/coding-agent/dist/utils/git.d.ts.map +1 -0
  713. package/node_modules/@orient-cli/coding-agent/dist/utils/git.js +163 -0
  714. package/node_modules/@orient-cli/coding-agent/dist/utils/git.js.map +1 -0
  715. package/node_modules/@orient-cli/coding-agent/dist/utils/image-convert.d.ts +9 -0
  716. package/node_modules/@orient-cli/coding-agent/dist/utils/image-convert.d.ts.map +1 -0
  717. package/node_modules/@orient-cli/coding-agent/dist/utils/image-convert.js +39 -0
  718. package/node_modules/@orient-cli/coding-agent/dist/utils/image-convert.js.map +1 -0
  719. package/node_modules/@orient-cli/coding-agent/dist/utils/image-resize.d.ts +36 -0
  720. package/node_modules/@orient-cli/coding-agent/dist/utils/image-resize.d.ts.map +1 -0
  721. package/node_modules/@orient-cli/coding-agent/dist/utils/image-resize.js +137 -0
  722. package/node_modules/@orient-cli/coding-agent/dist/utils/image-resize.js.map +1 -0
  723. package/node_modules/@orient-cli/coding-agent/dist/utils/mime.d.ts +2 -0
  724. package/node_modules/@orient-cli/coding-agent/dist/utils/mime.d.ts.map +1 -0
  725. package/node_modules/@orient-cli/coding-agent/dist/utils/mime.js +26 -0
  726. package/node_modules/@orient-cli/coding-agent/dist/utils/mime.js.map +1 -0
  727. package/node_modules/@orient-cli/coding-agent/dist/utils/paths.d.ts +7 -0
  728. package/node_modules/@orient-cli/coding-agent/dist/utils/paths.d.ts.map +1 -0
  729. package/node_modules/@orient-cli/coding-agent/dist/utils/paths.js +19 -0
  730. package/node_modules/@orient-cli/coding-agent/dist/utils/paths.js.map +1 -0
  731. package/node_modules/@orient-cli/coding-agent/dist/utils/photon.d.ts +21 -0
  732. package/node_modules/@orient-cli/coding-agent/dist/utils/photon.d.ts.map +1 -0
  733. package/node_modules/@orient-cli/coding-agent/dist/utils/photon.js +121 -0
  734. package/node_modules/@orient-cli/coding-agent/dist/utils/photon.js.map +1 -0
  735. package/node_modules/@orient-cli/coding-agent/dist/utils/shell.d.ts +26 -0
  736. package/node_modules/@orient-cli/coding-agent/dist/utils/shell.d.ts.map +1 -0
  737. package/node_modules/@orient-cli/coding-agent/dist/utils/shell.js +186 -0
  738. package/node_modules/@orient-cli/coding-agent/dist/utils/shell.js.map +1 -0
  739. package/node_modules/@orient-cli/coding-agent/dist/utils/sleep.d.ts +5 -0
  740. package/node_modules/@orient-cli/coding-agent/dist/utils/sleep.d.ts.map +1 -0
  741. package/node_modules/@orient-cli/coding-agent/dist/utils/sleep.js +17 -0
  742. package/node_modules/@orient-cli/coding-agent/dist/utils/sleep.js.map +1 -0
  743. package/node_modules/@orient-cli/coding-agent/dist/utils/tools-manager.d.ts +3 -0
  744. package/node_modules/@orient-cli/coding-agent/dist/utils/tools-manager.d.ts.map +1 -0
  745. package/node_modules/@orient-cli/coding-agent/dist/utils/tools-manager.js +252 -0
  746. package/node_modules/@orient-cli/coding-agent/dist/utils/tools-manager.js.map +1 -0
  747. package/node_modules/@orient-cli/coding-agent/package.json +104 -0
  748. package/node_modules/@orient-cli/tui/README.md +767 -0
  749. package/node_modules/@orient-cli/tui/dist/autocomplete.d.ts +52 -0
  750. package/node_modules/@orient-cli/tui/dist/autocomplete.d.ts.map +1 -0
  751. package/node_modules/@orient-cli/tui/dist/autocomplete.js +623 -0
  752. package/node_modules/@orient-cli/tui/dist/autocomplete.js.map +1 -0
  753. package/node_modules/@orient-cli/tui/dist/components/box.d.ts +22 -0
  754. package/node_modules/@orient-cli/tui/dist/components/box.d.ts.map +1 -0
  755. package/node_modules/@orient-cli/tui/dist/components/box.js +104 -0
  756. package/node_modules/@orient-cli/tui/dist/components/box.js.map +1 -0
  757. package/node_modules/@orient-cli/tui/dist/components/cancellable-loader.d.ts +22 -0
  758. package/node_modules/@orient-cli/tui/dist/components/cancellable-loader.d.ts.map +1 -0
  759. package/node_modules/@orient-cli/tui/dist/components/cancellable-loader.js +35 -0
  760. package/node_modules/@orient-cli/tui/dist/components/cancellable-loader.js.map +1 -0
  761. package/node_modules/@orient-cli/tui/dist/components/editor.d.ts +244 -0
  762. package/node_modules/@orient-cli/tui/dist/components/editor.d.ts.map +1 -0
  763. package/node_modules/@orient-cli/tui/dist/components/editor.js +1861 -0
  764. package/node_modules/@orient-cli/tui/dist/components/editor.js.map +1 -0
  765. package/node_modules/@orient-cli/tui/dist/components/image.d.ts +28 -0
  766. package/node_modules/@orient-cli/tui/dist/components/image.d.ts.map +1 -0
  767. package/node_modules/@orient-cli/tui/dist/components/image.js +69 -0
  768. package/node_modules/@orient-cli/tui/dist/components/image.js.map +1 -0
  769. package/node_modules/@orient-cli/tui/dist/components/input.d.ts +37 -0
  770. package/node_modules/@orient-cli/tui/dist/components/input.d.ts.map +1 -0
  771. package/node_modules/@orient-cli/tui/dist/components/input.js +426 -0
  772. package/node_modules/@orient-cli/tui/dist/components/input.js.map +1 -0
  773. package/node_modules/@orient-cli/tui/dist/components/loader.d.ts +21 -0
  774. package/node_modules/@orient-cli/tui/dist/components/loader.d.ts.map +1 -0
  775. package/node_modules/@orient-cli/tui/dist/components/loader.js +49 -0
  776. package/node_modules/@orient-cli/tui/dist/components/loader.js.map +1 -0
  777. package/node_modules/@orient-cli/tui/dist/components/markdown.d.ts +95 -0
  778. package/node_modules/@orient-cli/tui/dist/components/markdown.d.ts.map +1 -0
  779. package/node_modules/@orient-cli/tui/dist/components/markdown.js +663 -0
  780. package/node_modules/@orient-cli/tui/dist/components/markdown.js.map +1 -0
  781. package/node_modules/@orient-cli/tui/dist/components/select-list.d.ts +50 -0
  782. package/node_modules/@orient-cli/tui/dist/components/select-list.d.ts.map +1 -0
  783. package/node_modules/@orient-cli/tui/dist/components/select-list.js +159 -0
  784. package/node_modules/@orient-cli/tui/dist/components/select-list.js.map +1 -0
  785. package/node_modules/@orient-cli/tui/dist/components/settings-list.d.ts +50 -0
  786. package/node_modules/@orient-cli/tui/dist/components/settings-list.d.ts.map +1 -0
  787. package/node_modules/@orient-cli/tui/dist/components/settings-list.js +185 -0
  788. package/node_modules/@orient-cli/tui/dist/components/settings-list.js.map +1 -0
  789. package/node_modules/@orient-cli/tui/dist/components/spacer.d.ts +12 -0
  790. package/node_modules/@orient-cli/tui/dist/components/spacer.d.ts.map +1 -0
  791. package/node_modules/@orient-cli/tui/dist/components/spacer.js +23 -0
  792. package/node_modules/@orient-cli/tui/dist/components/spacer.js.map +1 -0
  793. package/node_modules/@orient-cli/tui/dist/components/text.d.ts +19 -0
  794. package/node_modules/@orient-cli/tui/dist/components/text.d.ts.map +1 -0
  795. package/node_modules/@orient-cli/tui/dist/components/text.js +89 -0
  796. package/node_modules/@orient-cli/tui/dist/components/text.js.map +1 -0
  797. package/node_modules/@orient-cli/tui/dist/components/truncated-text.d.ts +13 -0
  798. package/node_modules/@orient-cli/tui/dist/components/truncated-text.d.ts.map +1 -0
  799. package/node_modules/@orient-cli/tui/dist/components/truncated-text.js +51 -0
  800. package/node_modules/@orient-cli/tui/dist/components/truncated-text.js.map +1 -0
  801. package/node_modules/@orient-cli/tui/dist/editor-component.d.ts +39 -0
  802. package/node_modules/@orient-cli/tui/dist/editor-component.d.ts.map +1 -0
  803. package/node_modules/@orient-cli/tui/dist/editor-component.js +2 -0
  804. package/node_modules/@orient-cli/tui/dist/editor-component.js.map +1 -0
  805. package/node_modules/@orient-cli/tui/dist/fuzzy.d.ts +16 -0
  806. package/node_modules/@orient-cli/tui/dist/fuzzy.d.ts.map +1 -0
  807. package/node_modules/@orient-cli/tui/dist/fuzzy.js +107 -0
  808. package/node_modules/@orient-cli/tui/dist/fuzzy.js.map +1 -0
  809. package/node_modules/@orient-cli/tui/dist/index.d.ts +23 -0
  810. package/node_modules/@orient-cli/tui/dist/index.d.ts.map +1 -0
  811. package/node_modules/@orient-cli/tui/dist/index.js +32 -0
  812. package/node_modules/@orient-cli/tui/dist/index.js.map +1 -0
  813. package/node_modules/@orient-cli/tui/dist/keybindings.d.ts +193 -0
  814. package/node_modules/@orient-cli/tui/dist/keybindings.d.ts.map +1 -0
  815. package/node_modules/@orient-cli/tui/dist/keybindings.js +174 -0
  816. package/node_modules/@orient-cli/tui/dist/keybindings.js.map +1 -0
  817. package/node_modules/@orient-cli/tui/dist/keys.d.ts +170 -0
  818. package/node_modules/@orient-cli/tui/dist/keys.d.ts.map +1 -0
  819. package/node_modules/@orient-cli/tui/dist/keys.js +1124 -0
  820. package/node_modules/@orient-cli/tui/dist/keys.js.map +1 -0
  821. package/node_modules/@orient-cli/tui/dist/kill-ring.d.ts +28 -0
  822. package/node_modules/@orient-cli/tui/dist/kill-ring.d.ts.map +1 -0
  823. package/node_modules/@orient-cli/tui/dist/kill-ring.js +44 -0
  824. package/node_modules/@orient-cli/tui/dist/kill-ring.js.map +1 -0
  825. package/node_modules/@orient-cli/tui/dist/stdin-buffer.d.ts +48 -0
  826. package/node_modules/@orient-cli/tui/dist/stdin-buffer.d.ts.map +1 -0
  827. package/node_modules/@orient-cli/tui/dist/stdin-buffer.js +317 -0
  828. package/node_modules/@orient-cli/tui/dist/stdin-buffer.js.map +1 -0
  829. package/node_modules/@orient-cli/tui/dist/terminal-image.d.ts +68 -0
  830. package/node_modules/@orient-cli/tui/dist/terminal-image.d.ts.map +1 -0
  831. package/node_modules/@orient-cli/tui/dist/terminal-image.js +288 -0
  832. package/node_modules/@orient-cli/tui/dist/terminal-image.js.map +1 -0
  833. package/node_modules/@orient-cli/tui/dist/terminal.d.ts +84 -0
  834. package/node_modules/@orient-cli/tui/dist/terminal.d.ts.map +1 -0
  835. package/node_modules/@orient-cli/tui/dist/terminal.js +285 -0
  836. package/node_modules/@orient-cli/tui/dist/terminal.js.map +1 -0
  837. package/node_modules/@orient-cli/tui/dist/tui.d.ts +222 -0
  838. package/node_modules/@orient-cli/tui/dist/tui.d.ts.map +1 -0
  839. package/node_modules/@orient-cli/tui/dist/tui.js +1008 -0
  840. package/node_modules/@orient-cli/tui/dist/tui.js.map +1 -0
  841. package/node_modules/@orient-cli/tui/dist/undo-stack.d.ts +17 -0
  842. package/node_modules/@orient-cli/tui/dist/undo-stack.d.ts.map +1 -0
  843. package/node_modules/@orient-cli/tui/dist/undo-stack.js +25 -0
  844. package/node_modules/@orient-cli/tui/dist/undo-stack.js.map +1 -0
  845. package/node_modules/@orient-cli/tui/dist/utils.d.ts +78 -0
  846. package/node_modules/@orient-cli/tui/dist/utils.d.ts.map +1 -0
  847. package/node_modules/@orient-cli/tui/dist/utils.js +960 -0
  848. package/node_modules/@orient-cli/tui/dist/utils.js.map +1 -0
  849. package/node_modules/@orient-cli/tui/package.json +52 -0
  850. package/package.json +47 -8
  851. package/schemas/orient-standard/templates-tier-1/brief.md +22 -0
  852. package/schemas/orient-standard/templates-tier-1/plan.md +17 -0
  853. package/schemas/orient-standard/templates-tier-1/spec.md +23 -0
  854. package/schemas/orient-standard/templates-tier-1/tasks.md +14 -0
  855. package/schemas/orient-standard/templates-tier-2/brief.md +32 -0
  856. package/schemas/orient-standard/templates-tier-2/plan.md +44 -0
  857. package/schemas/orient-standard/templates-tier-2/spec.md +46 -0
  858. package/schemas/orient-standard/templates-tier-2/tasks.md +34 -0
  859. package/schemas/orient-standard/templates-tier-3/brief.md +54 -0
  860. package/schemas/orient-standard/templates-tier-3/plan.md +67 -0
  861. package/schemas/orient-standard/templates-tier-3/spec.md +65 -0
  862. package/schemas/orient-standard/templates-tier-3/tasks.md +79 -0
@@ -0,0 +1,1829 @@
1
+ import { spawn, spawnSync } from "node:child_process";
2
+ import { createHash } from "node:crypto";
3
+ import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
4
+ import { homedir, tmpdir } from "node:os";
5
+ import { basename, dirname, join, relative, resolve, sep } from "node:path";
6
+ import ignore from "ignore";
7
+ import { minimatch } from "minimatch";
8
+ import { CONFIG_DIR_NAME } from "../config.js";
9
+ import { parseGitUrl } from "../utils/git.js";
10
+ import { isLocalPath } from "../utils/paths.js";
11
+ import { isStdoutTakenOver } from "./output-guard.js";
12
+ const NETWORK_TIMEOUT_MS = 10000;
13
+ const UPDATE_CHECK_CONCURRENCY = 4;
14
+ function isOfflineModeEnabled() {
15
+ const value = process.env.PI_OFFLINE;
16
+ if (!value)
17
+ return false;
18
+ return value === "1" || value.toLowerCase() === "true" || value.toLowerCase() === "yes";
19
+ }
20
+ /**
21
+ * Compute a numeric precedence rank for a resource based on its metadata.
22
+ * Lower rank = higher precedence. Used to sort resolved resources so that
23
+ * name-collision resolution ("first wins") produces the correct outcome.
24
+ *
25
+ * Precedence (highest to lowest):
26
+ * 0 project + settings entry (source: "local", scope: "project")
27
+ * 1 project + auto-discovered (source: "auto", scope: "project")
28
+ * 2 user + settings entry (source: "local", scope: "user")
29
+ * 3 user + auto-discovered (source: "auto", scope: "user")
30
+ * 4 package resource (origin: "package")
31
+ */
32
+ function resourcePrecedenceRank(m) {
33
+ if (m.origin === "package")
34
+ return 4;
35
+ const scopeBase = m.scope === "project" ? 0 : 2;
36
+ return scopeBase + (m.source === "local" ? 0 : 1);
37
+ }
38
+ const RESOURCE_TYPES = ["extensions", "skills", "prompts", "themes"];
39
+ const FILE_PATTERNS = {
40
+ extensions: /\.(ts|js)$/,
41
+ skills: /\.md$/,
42
+ prompts: /\.md$/,
43
+ themes: /\.json$/,
44
+ };
45
+ const IGNORE_FILE_NAMES = [".gitignore", ".ignore", ".fdignore"];
46
+ function toPosixPath(p) {
47
+ return p.split(sep).join("/");
48
+ }
49
+ function getHomeDir() {
50
+ return process.env.HOME || homedir();
51
+ }
52
+ function prefixIgnorePattern(line, prefix) {
53
+ const trimmed = line.trim();
54
+ if (!trimmed)
55
+ return null;
56
+ if (trimmed.startsWith("#") && !trimmed.startsWith("\\#"))
57
+ return null;
58
+ let pattern = line;
59
+ let negated = false;
60
+ if (pattern.startsWith("!")) {
61
+ negated = true;
62
+ pattern = pattern.slice(1);
63
+ }
64
+ else if (pattern.startsWith("\\!")) {
65
+ pattern = pattern.slice(1);
66
+ }
67
+ if (pattern.startsWith("/")) {
68
+ pattern = pattern.slice(1);
69
+ }
70
+ const prefixed = prefix ? `${prefix}${pattern}` : pattern;
71
+ return negated ? `!${prefixed}` : prefixed;
72
+ }
73
+ function addIgnoreRules(ig, dir, rootDir) {
74
+ const relativeDir = relative(rootDir, dir);
75
+ const prefix = relativeDir ? `${toPosixPath(relativeDir)}/` : "";
76
+ for (const filename of IGNORE_FILE_NAMES) {
77
+ const ignorePath = join(dir, filename);
78
+ if (!existsSync(ignorePath))
79
+ continue;
80
+ try {
81
+ const content = readFileSync(ignorePath, "utf-8");
82
+ const patterns = content
83
+ .split(/\r?\n/)
84
+ .map((line) => prefixIgnorePattern(line, prefix))
85
+ .filter((line) => Boolean(line));
86
+ if (patterns.length > 0) {
87
+ ig.add(patterns);
88
+ }
89
+ }
90
+ catch { }
91
+ }
92
+ }
93
+ function isPattern(s) {
94
+ return s.startsWith("!") || s.startsWith("+") || s.startsWith("-") || s.includes("*") || s.includes("?");
95
+ }
96
+ function splitPatterns(entries) {
97
+ const plain = [];
98
+ const patterns = [];
99
+ for (const entry of entries) {
100
+ if (isPattern(entry)) {
101
+ patterns.push(entry);
102
+ }
103
+ else {
104
+ plain.push(entry);
105
+ }
106
+ }
107
+ return { plain, patterns };
108
+ }
109
+ function collectFiles(dir, filePattern, skipNodeModules = true, ignoreMatcher, rootDir) {
110
+ const files = [];
111
+ if (!existsSync(dir))
112
+ return files;
113
+ const root = rootDir ?? dir;
114
+ const ig = ignoreMatcher ?? ignore();
115
+ addIgnoreRules(ig, dir, root);
116
+ try {
117
+ const entries = readdirSync(dir, { withFileTypes: true });
118
+ for (const entry of entries) {
119
+ if (entry.name.startsWith("."))
120
+ continue;
121
+ if (skipNodeModules && entry.name === "node_modules")
122
+ continue;
123
+ const fullPath = join(dir, entry.name);
124
+ let isDir = entry.isDirectory();
125
+ let isFile = entry.isFile();
126
+ if (entry.isSymbolicLink()) {
127
+ try {
128
+ const stats = statSync(fullPath);
129
+ isDir = stats.isDirectory();
130
+ isFile = stats.isFile();
131
+ }
132
+ catch {
133
+ continue;
134
+ }
135
+ }
136
+ const relPath = toPosixPath(relative(root, fullPath));
137
+ const ignorePath = isDir ? `${relPath}/` : relPath;
138
+ if (ig.ignores(ignorePath))
139
+ continue;
140
+ if (isDir) {
141
+ files.push(...collectFiles(fullPath, filePattern, skipNodeModules, ig, root));
142
+ }
143
+ else if (isFile && filePattern.test(entry.name)) {
144
+ files.push(fullPath);
145
+ }
146
+ }
147
+ }
148
+ catch {
149
+ // Ignore errors
150
+ }
151
+ return files;
152
+ }
153
+ function collectSkillEntries(dir, mode, ignoreMatcher, rootDir) {
154
+ const entries = [];
155
+ if (!existsSync(dir))
156
+ return entries;
157
+ const root = rootDir ?? dir;
158
+ const ig = ignoreMatcher ?? ignore();
159
+ addIgnoreRules(ig, dir, root);
160
+ try {
161
+ const dirEntries = readdirSync(dir, { withFileTypes: true });
162
+ for (const entry of dirEntries) {
163
+ if (entry.name !== "SKILL.md") {
164
+ continue;
165
+ }
166
+ const fullPath = join(dir, entry.name);
167
+ let isFile = entry.isFile();
168
+ if (entry.isSymbolicLink()) {
169
+ try {
170
+ isFile = statSync(fullPath).isFile();
171
+ }
172
+ catch {
173
+ continue;
174
+ }
175
+ }
176
+ const relPath = toPosixPath(relative(root, fullPath));
177
+ if (isFile && !ig.ignores(relPath)) {
178
+ entries.push(fullPath);
179
+ return entries;
180
+ }
181
+ }
182
+ for (const entry of dirEntries) {
183
+ if (entry.name.startsWith("."))
184
+ continue;
185
+ if (entry.name === "node_modules")
186
+ continue;
187
+ const fullPath = join(dir, entry.name);
188
+ let isDir = entry.isDirectory();
189
+ let isFile = entry.isFile();
190
+ if (entry.isSymbolicLink()) {
191
+ try {
192
+ const stats = statSync(fullPath);
193
+ isDir = stats.isDirectory();
194
+ isFile = stats.isFile();
195
+ }
196
+ catch {
197
+ continue;
198
+ }
199
+ }
200
+ const relPath = toPosixPath(relative(root, fullPath));
201
+ if (mode === "pi" && dir === root && isFile && entry.name.endsWith(".md") && !ig.ignores(relPath)) {
202
+ entries.push(fullPath);
203
+ continue;
204
+ }
205
+ if (!isDir)
206
+ continue;
207
+ if (ig.ignores(`${relPath}/`))
208
+ continue;
209
+ entries.push(...collectSkillEntries(fullPath, mode, ig, root));
210
+ }
211
+ }
212
+ catch {
213
+ // Ignore errors
214
+ }
215
+ return entries;
216
+ }
217
+ function collectAutoSkillEntries(dir, mode) {
218
+ return collectSkillEntries(dir, mode);
219
+ }
220
+ function findGitRepoRoot(startDir) {
221
+ let dir = resolve(startDir);
222
+ while (true) {
223
+ if (existsSync(join(dir, ".git"))) {
224
+ return dir;
225
+ }
226
+ const parent = dirname(dir);
227
+ if (parent === dir) {
228
+ return null;
229
+ }
230
+ dir = parent;
231
+ }
232
+ }
233
+ function collectAncestorAgentsSkillDirs(startDir) {
234
+ const skillDirs = [];
235
+ const resolvedStartDir = resolve(startDir);
236
+ const gitRepoRoot = findGitRepoRoot(resolvedStartDir);
237
+ let dir = resolvedStartDir;
238
+ while (true) {
239
+ skillDirs.push(join(dir, ".agents", "skills"));
240
+ if (gitRepoRoot && dir === gitRepoRoot) {
241
+ break;
242
+ }
243
+ const parent = dirname(dir);
244
+ if (parent === dir) {
245
+ break;
246
+ }
247
+ dir = parent;
248
+ }
249
+ return skillDirs;
250
+ }
251
+ function collectAutoPromptEntries(dir) {
252
+ const entries = [];
253
+ if (!existsSync(dir))
254
+ return entries;
255
+ const ig = ignore();
256
+ addIgnoreRules(ig, dir, dir);
257
+ try {
258
+ const dirEntries = readdirSync(dir, { withFileTypes: true });
259
+ for (const entry of dirEntries) {
260
+ if (entry.name.startsWith("."))
261
+ continue;
262
+ if (entry.name === "node_modules")
263
+ continue;
264
+ const fullPath = join(dir, entry.name);
265
+ let isFile = entry.isFile();
266
+ if (entry.isSymbolicLink()) {
267
+ try {
268
+ isFile = statSync(fullPath).isFile();
269
+ }
270
+ catch {
271
+ continue;
272
+ }
273
+ }
274
+ const relPath = toPosixPath(relative(dir, fullPath));
275
+ if (ig.ignores(relPath))
276
+ continue;
277
+ if (isFile && entry.name.endsWith(".md")) {
278
+ entries.push(fullPath);
279
+ }
280
+ }
281
+ }
282
+ catch {
283
+ // Ignore errors
284
+ }
285
+ return entries;
286
+ }
287
+ function collectAutoThemeEntries(dir) {
288
+ const entries = [];
289
+ if (!existsSync(dir))
290
+ return entries;
291
+ const ig = ignore();
292
+ addIgnoreRules(ig, dir, dir);
293
+ try {
294
+ const dirEntries = readdirSync(dir, { withFileTypes: true });
295
+ for (const entry of dirEntries) {
296
+ if (entry.name.startsWith("."))
297
+ continue;
298
+ if (entry.name === "node_modules")
299
+ continue;
300
+ const fullPath = join(dir, entry.name);
301
+ let isFile = entry.isFile();
302
+ if (entry.isSymbolicLink()) {
303
+ try {
304
+ isFile = statSync(fullPath).isFile();
305
+ }
306
+ catch {
307
+ continue;
308
+ }
309
+ }
310
+ const relPath = toPosixPath(relative(dir, fullPath));
311
+ if (ig.ignores(relPath))
312
+ continue;
313
+ if (isFile && entry.name.endsWith(".json")) {
314
+ entries.push(fullPath);
315
+ }
316
+ }
317
+ }
318
+ catch {
319
+ // Ignore errors
320
+ }
321
+ return entries;
322
+ }
323
+ function readPiManifestFile(packageJsonPath) {
324
+ try {
325
+ const content = readFileSync(packageJsonPath, "utf-8");
326
+ const pkg = JSON.parse(content);
327
+ return pkg.pi ?? null;
328
+ }
329
+ catch {
330
+ return null;
331
+ }
332
+ }
333
+ function resolveExtensionEntries(dir) {
334
+ const packageJsonPath = join(dir, "package.json");
335
+ if (existsSync(packageJsonPath)) {
336
+ const manifest = readPiManifestFile(packageJsonPath);
337
+ if (manifest?.extensions?.length) {
338
+ const entries = [];
339
+ for (const extPath of manifest.extensions) {
340
+ const resolvedExtPath = resolve(dir, extPath);
341
+ if (existsSync(resolvedExtPath)) {
342
+ entries.push(resolvedExtPath);
343
+ }
344
+ }
345
+ if (entries.length > 0) {
346
+ return entries;
347
+ }
348
+ }
349
+ }
350
+ const indexTs = join(dir, "index.ts");
351
+ const indexJs = join(dir, "index.js");
352
+ if (existsSync(indexTs)) {
353
+ return [indexTs];
354
+ }
355
+ if (existsSync(indexJs)) {
356
+ return [indexJs];
357
+ }
358
+ return null;
359
+ }
360
+ function collectAutoExtensionEntries(dir) {
361
+ const entries = [];
362
+ if (!existsSync(dir))
363
+ return entries;
364
+ // First check if this directory itself has explicit extension entries (package.json or index)
365
+ const rootEntries = resolveExtensionEntries(dir);
366
+ if (rootEntries) {
367
+ return rootEntries;
368
+ }
369
+ // Otherwise, discover extensions from directory contents
370
+ const ig = ignore();
371
+ addIgnoreRules(ig, dir, dir);
372
+ try {
373
+ const dirEntries = readdirSync(dir, { withFileTypes: true });
374
+ for (const entry of dirEntries) {
375
+ if (entry.name.startsWith("."))
376
+ continue;
377
+ if (entry.name === "node_modules")
378
+ continue;
379
+ const fullPath = join(dir, entry.name);
380
+ let isDir = entry.isDirectory();
381
+ let isFile = entry.isFile();
382
+ if (entry.isSymbolicLink()) {
383
+ try {
384
+ const stats = statSync(fullPath);
385
+ isDir = stats.isDirectory();
386
+ isFile = stats.isFile();
387
+ }
388
+ catch {
389
+ continue;
390
+ }
391
+ }
392
+ const relPath = toPosixPath(relative(dir, fullPath));
393
+ const ignorePath = isDir ? `${relPath}/` : relPath;
394
+ if (ig.ignores(ignorePath))
395
+ continue;
396
+ if (isFile && (entry.name.endsWith(".ts") || entry.name.endsWith(".js"))) {
397
+ entries.push(fullPath);
398
+ }
399
+ else if (isDir) {
400
+ const resolvedEntries = resolveExtensionEntries(fullPath);
401
+ if (resolvedEntries) {
402
+ entries.push(...resolvedEntries);
403
+ }
404
+ }
405
+ }
406
+ }
407
+ catch {
408
+ // Ignore errors
409
+ }
410
+ return entries;
411
+ }
412
+ /**
413
+ * Collect resource files from a directory based on resource type.
414
+ * Extensions use smart discovery (index.ts in subdirs), others use recursive collection.
415
+ */
416
+ function collectResourceFiles(dir, resourceType) {
417
+ if (resourceType === "skills") {
418
+ return collectSkillEntries(dir, "pi");
419
+ }
420
+ if (resourceType === "extensions") {
421
+ return collectAutoExtensionEntries(dir);
422
+ }
423
+ return collectFiles(dir, FILE_PATTERNS[resourceType]);
424
+ }
425
+ function matchesAnyPattern(filePath, patterns, baseDir) {
426
+ const rel = toPosixPath(relative(baseDir, filePath));
427
+ const name = basename(filePath);
428
+ const filePathPosix = toPosixPath(filePath);
429
+ const isSkillFile = name === "SKILL.md";
430
+ const parentDir = isSkillFile ? dirname(filePath) : undefined;
431
+ const parentRel = isSkillFile ? toPosixPath(relative(baseDir, parentDir)) : undefined;
432
+ const parentName = isSkillFile ? basename(parentDir) : undefined;
433
+ const parentDirPosix = isSkillFile ? toPosixPath(parentDir) : undefined;
434
+ return patterns.some((pattern) => {
435
+ const normalizedPattern = toPosixPath(pattern);
436
+ if (minimatch(rel, normalizedPattern) ||
437
+ minimatch(name, normalizedPattern) ||
438
+ minimatch(filePathPosix, normalizedPattern)) {
439
+ return true;
440
+ }
441
+ if (!isSkillFile)
442
+ return false;
443
+ return (minimatch(parentRel, normalizedPattern) ||
444
+ minimatch(parentName, normalizedPattern) ||
445
+ minimatch(parentDirPosix, normalizedPattern));
446
+ });
447
+ }
448
+ function normalizeExactPattern(pattern) {
449
+ const normalized = pattern.startsWith("./") || pattern.startsWith(".\\") ? pattern.slice(2) : pattern;
450
+ return toPosixPath(normalized);
451
+ }
452
+ function matchesAnyExactPattern(filePath, patterns, baseDir) {
453
+ if (patterns.length === 0)
454
+ return false;
455
+ const rel = toPosixPath(relative(baseDir, filePath));
456
+ const name = basename(filePath);
457
+ const filePathPosix = toPosixPath(filePath);
458
+ const isSkillFile = name === "SKILL.md";
459
+ const parentDir = isSkillFile ? dirname(filePath) : undefined;
460
+ const parentRel = isSkillFile ? toPosixPath(relative(baseDir, parentDir)) : undefined;
461
+ const parentDirPosix = isSkillFile ? toPosixPath(parentDir) : undefined;
462
+ return patterns.some((pattern) => {
463
+ const normalized = normalizeExactPattern(pattern);
464
+ if (normalized === rel || normalized === filePathPosix) {
465
+ return true;
466
+ }
467
+ if (!isSkillFile)
468
+ return false;
469
+ return normalized === parentRel || normalized === parentDirPosix;
470
+ });
471
+ }
472
+ function getOverridePatterns(entries) {
473
+ return entries.filter((pattern) => pattern.startsWith("!") || pattern.startsWith("+") || pattern.startsWith("-"));
474
+ }
475
+ function isEnabledByOverrides(filePath, patterns, baseDir) {
476
+ const overrides = getOverridePatterns(patterns);
477
+ const excludes = overrides.filter((pattern) => pattern.startsWith("!")).map((pattern) => pattern.slice(1));
478
+ const forceIncludes = overrides.filter((pattern) => pattern.startsWith("+")).map((pattern) => pattern.slice(1));
479
+ const forceExcludes = overrides.filter((pattern) => pattern.startsWith("-")).map((pattern) => pattern.slice(1));
480
+ let enabled = true;
481
+ if (excludes.length > 0 && matchesAnyPattern(filePath, excludes, baseDir)) {
482
+ enabled = false;
483
+ }
484
+ if (forceIncludes.length > 0 && matchesAnyExactPattern(filePath, forceIncludes, baseDir)) {
485
+ enabled = true;
486
+ }
487
+ if (forceExcludes.length > 0 && matchesAnyExactPattern(filePath, forceExcludes, baseDir)) {
488
+ enabled = false;
489
+ }
490
+ return enabled;
491
+ }
492
+ /**
493
+ * Apply patterns to paths and return a Set of enabled paths.
494
+ * Pattern types:
495
+ * - Plain patterns: include matching paths
496
+ * - `!pattern`: exclude matching paths
497
+ * - `+path`: force-include exact path (overrides exclusions)
498
+ * - `-path`: force-exclude exact path (overrides force-includes)
499
+ */
500
+ function applyPatterns(allPaths, patterns, baseDir) {
501
+ const includes = [];
502
+ const excludes = [];
503
+ const forceIncludes = [];
504
+ const forceExcludes = [];
505
+ for (const p of patterns) {
506
+ if (p.startsWith("+")) {
507
+ forceIncludes.push(p.slice(1));
508
+ }
509
+ else if (p.startsWith("-")) {
510
+ forceExcludes.push(p.slice(1));
511
+ }
512
+ else if (p.startsWith("!")) {
513
+ excludes.push(p.slice(1));
514
+ }
515
+ else {
516
+ includes.push(p);
517
+ }
518
+ }
519
+ // Step 1: Apply includes (or all if no includes)
520
+ let result;
521
+ if (includes.length === 0) {
522
+ result = [...allPaths];
523
+ }
524
+ else {
525
+ result = allPaths.filter((filePath) => matchesAnyPattern(filePath, includes, baseDir));
526
+ }
527
+ // Step 2: Apply excludes
528
+ if (excludes.length > 0) {
529
+ result = result.filter((filePath) => !matchesAnyPattern(filePath, excludes, baseDir));
530
+ }
531
+ // Step 3: Force-include (add back from allPaths, overriding exclusions)
532
+ if (forceIncludes.length > 0) {
533
+ for (const filePath of allPaths) {
534
+ if (!result.includes(filePath) && matchesAnyExactPattern(filePath, forceIncludes, baseDir)) {
535
+ result.push(filePath);
536
+ }
537
+ }
538
+ }
539
+ // Step 4: Force-exclude (remove even if included or force-included)
540
+ if (forceExcludes.length > 0) {
541
+ result = result.filter((filePath) => !matchesAnyExactPattern(filePath, forceExcludes, baseDir));
542
+ }
543
+ return new Set(result);
544
+ }
545
+ export class DefaultPackageManager {
546
+ cwd;
547
+ agentDir;
548
+ settingsManager;
549
+ globalNpmRoot;
550
+ globalNpmRootCommandKey;
551
+ progressCallback;
552
+ constructor(options) {
553
+ this.cwd = options.cwd;
554
+ this.agentDir = options.agentDir;
555
+ this.settingsManager = options.settingsManager;
556
+ }
557
+ setProgressCallback(callback) {
558
+ this.progressCallback = callback;
559
+ }
560
+ addSourceToSettings(source, options) {
561
+ const scope = options?.local ? "project" : "user";
562
+ const currentSettings = scope === "project" ? this.settingsManager.getProjectSettings() : this.settingsManager.getGlobalSettings();
563
+ const currentPackages = currentSettings.packages ?? [];
564
+ const normalizedSource = this.normalizePackageSourceForSettings(source, scope);
565
+ const exists = currentPackages.some((existing) => this.packageSourcesMatch(existing, source, scope));
566
+ if (exists) {
567
+ return false;
568
+ }
569
+ const nextPackages = [...currentPackages, normalizedSource];
570
+ if (scope === "project") {
571
+ this.settingsManager.setProjectPackages(nextPackages);
572
+ }
573
+ else {
574
+ this.settingsManager.setPackages(nextPackages);
575
+ }
576
+ return true;
577
+ }
578
+ removeSourceFromSettings(source, options) {
579
+ const scope = options?.local ? "project" : "user";
580
+ const currentSettings = scope === "project" ? this.settingsManager.getProjectSettings() : this.settingsManager.getGlobalSettings();
581
+ const currentPackages = currentSettings.packages ?? [];
582
+ const nextPackages = currentPackages.filter((existing) => !this.packageSourcesMatch(existing, source, scope));
583
+ const changed = nextPackages.length !== currentPackages.length;
584
+ if (!changed) {
585
+ return false;
586
+ }
587
+ if (scope === "project") {
588
+ this.settingsManager.setProjectPackages(nextPackages);
589
+ }
590
+ else {
591
+ this.settingsManager.setPackages(nextPackages);
592
+ }
593
+ return true;
594
+ }
595
+ getInstalledPath(source, scope) {
596
+ const parsed = this.parseSource(source);
597
+ if (parsed.type === "npm") {
598
+ const path = this.getNpmInstallPath(parsed, scope);
599
+ return existsSync(path) ? path : undefined;
600
+ }
601
+ if (parsed.type === "git") {
602
+ const path = this.getGitInstallPath(parsed, scope);
603
+ return existsSync(path) ? path : undefined;
604
+ }
605
+ if (parsed.type === "local") {
606
+ const baseDir = this.getBaseDirForScope(scope);
607
+ const path = this.resolvePathFromBase(parsed.path, baseDir);
608
+ return existsSync(path) ? path : undefined;
609
+ }
610
+ return undefined;
611
+ }
612
+ emitProgress(event) {
613
+ this.progressCallback?.(event);
614
+ }
615
+ async withProgress(action, source, message, operation) {
616
+ this.emitProgress({ type: "start", action, source, message });
617
+ try {
618
+ await operation();
619
+ this.emitProgress({ type: "complete", action, source });
620
+ }
621
+ catch (error) {
622
+ const errorMessage = error instanceof Error ? error.message : String(error);
623
+ this.emitProgress({ type: "error", action, source, message: errorMessage });
624
+ throw error;
625
+ }
626
+ }
627
+ async resolve(onMissing) {
628
+ const accumulator = this.createAccumulator();
629
+ const globalSettings = this.settingsManager.getGlobalSettings();
630
+ const projectSettings = this.settingsManager.getProjectSettings();
631
+ // Collect all packages with scope (project first so cwd resources win collisions)
632
+ const allPackages = [];
633
+ for (const pkg of projectSettings.packages ?? []) {
634
+ allPackages.push({ pkg, scope: "project" });
635
+ }
636
+ for (const pkg of globalSettings.packages ?? []) {
637
+ allPackages.push({ pkg, scope: "user" });
638
+ }
639
+ // Dedupe: project scope wins over global for same package identity
640
+ const packageSources = this.dedupePackages(allPackages);
641
+ await this.resolvePackageSources(packageSources, accumulator, onMissing);
642
+ const globalBaseDir = this.agentDir;
643
+ const projectBaseDir = join(this.cwd, CONFIG_DIR_NAME);
644
+ for (const resourceType of RESOURCE_TYPES) {
645
+ const target = this.getTargetMap(accumulator, resourceType);
646
+ const globalEntries = (globalSettings[resourceType] ?? []);
647
+ const projectEntries = (projectSettings[resourceType] ?? []);
648
+ this.resolveLocalEntries(projectEntries, resourceType, target, {
649
+ source: "local",
650
+ scope: "project",
651
+ origin: "top-level",
652
+ }, projectBaseDir);
653
+ this.resolveLocalEntries(globalEntries, resourceType, target, {
654
+ source: "local",
655
+ scope: "user",
656
+ origin: "top-level",
657
+ }, globalBaseDir);
658
+ }
659
+ this.addAutoDiscoveredResources(accumulator, globalSettings, projectSettings, globalBaseDir, projectBaseDir);
660
+ return this.toResolvedPaths(accumulator);
661
+ }
662
+ async resolveExtensionSources(sources, options) {
663
+ const accumulator = this.createAccumulator();
664
+ const scope = options?.temporary ? "temporary" : options?.local ? "project" : "user";
665
+ const packageSources = sources.map((source) => ({ pkg: source, scope }));
666
+ await this.resolvePackageSources(packageSources, accumulator);
667
+ return this.toResolvedPaths(accumulator);
668
+ }
669
+ listConfiguredPackages() {
670
+ const globalSettings = this.settingsManager.getGlobalSettings();
671
+ const projectSettings = this.settingsManager.getProjectSettings();
672
+ const configuredPackages = [];
673
+ for (const pkg of globalSettings.packages ?? []) {
674
+ const source = typeof pkg === "string" ? pkg : pkg.source;
675
+ configuredPackages.push({
676
+ source,
677
+ scope: "user",
678
+ filtered: typeof pkg === "object",
679
+ installedPath: this.getInstalledPath(source, "user"),
680
+ });
681
+ }
682
+ for (const pkg of projectSettings.packages ?? []) {
683
+ const source = typeof pkg === "string" ? pkg : pkg.source;
684
+ configuredPackages.push({
685
+ source,
686
+ scope: "project",
687
+ filtered: typeof pkg === "object",
688
+ installedPath: this.getInstalledPath(source, "project"),
689
+ });
690
+ }
691
+ return configuredPackages;
692
+ }
693
+ async install(source, options) {
694
+ const parsed = this.parseSource(source);
695
+ const scope = options?.local ? "project" : "user";
696
+ await this.withProgress("install", source, `Installing ${source}...`, async () => {
697
+ if (parsed.type === "npm") {
698
+ await this.installNpm(parsed, scope, false);
699
+ return;
700
+ }
701
+ if (parsed.type === "git") {
702
+ await this.installGit(parsed, scope);
703
+ return;
704
+ }
705
+ if (parsed.type === "local") {
706
+ const resolved = this.resolvePath(parsed.path);
707
+ if (!existsSync(resolved)) {
708
+ throw new Error(`Path does not exist: ${resolved}`);
709
+ }
710
+ return;
711
+ }
712
+ throw new Error(`Unsupported install source: ${source}`);
713
+ });
714
+ }
715
+ async installAndPersist(source, options) {
716
+ await this.install(source, options);
717
+ this.addSourceToSettings(source, options);
718
+ }
719
+ async remove(source, options) {
720
+ const parsed = this.parseSource(source);
721
+ const scope = options?.local ? "project" : "user";
722
+ await this.withProgress("remove", source, `Removing ${source}...`, async () => {
723
+ if (parsed.type === "npm") {
724
+ await this.uninstallNpm(parsed, scope);
725
+ return;
726
+ }
727
+ if (parsed.type === "git") {
728
+ await this.removeGit(parsed, scope);
729
+ return;
730
+ }
731
+ if (parsed.type === "local") {
732
+ return;
733
+ }
734
+ throw new Error(`Unsupported remove source: ${source}`);
735
+ });
736
+ }
737
+ async removeAndPersist(source, options) {
738
+ await this.remove(source, options);
739
+ return this.removeSourceFromSettings(source, options);
740
+ }
741
+ async update(source) {
742
+ const globalSettings = this.settingsManager.getGlobalSettings();
743
+ const projectSettings = this.settingsManager.getProjectSettings();
744
+ const identity = source ? this.getPackageIdentity(source) : undefined;
745
+ let matched = false;
746
+ for (const pkg of globalSettings.packages ?? []) {
747
+ const sourceStr = typeof pkg === "string" ? pkg : pkg.source;
748
+ if (identity && this.getPackageIdentity(sourceStr, "user") !== identity)
749
+ continue;
750
+ matched = true;
751
+ await this.updateSourceForScope(sourceStr, "user");
752
+ }
753
+ for (const pkg of projectSettings.packages ?? []) {
754
+ const sourceStr = typeof pkg === "string" ? pkg : pkg.source;
755
+ if (identity && this.getPackageIdentity(sourceStr, "project") !== identity)
756
+ continue;
757
+ matched = true;
758
+ await this.updateSourceForScope(sourceStr, "project");
759
+ }
760
+ if (source && !matched) {
761
+ throw new Error(this.buildNoMatchingPackageMessage(source, [
762
+ ...(globalSettings.packages ?? []),
763
+ ...(projectSettings.packages ?? []),
764
+ ]));
765
+ }
766
+ }
767
+ async updateSourceForScope(source, scope) {
768
+ if (isOfflineModeEnabled()) {
769
+ return;
770
+ }
771
+ const parsed = this.parseSource(source);
772
+ if (parsed.type === "npm") {
773
+ if (parsed.pinned)
774
+ return;
775
+ await this.withProgress("update", source, `Updating ${source}...`, async () => {
776
+ await this.installNpm({
777
+ ...parsed,
778
+ spec: `${parsed.name}@latest`,
779
+ }, scope, false);
780
+ });
781
+ return;
782
+ }
783
+ if (parsed.type === "git") {
784
+ if (parsed.pinned)
785
+ return;
786
+ await this.withProgress("update", source, `Updating ${source}...`, async () => {
787
+ await this.updateGit(parsed, scope);
788
+ });
789
+ return;
790
+ }
791
+ }
792
+ async checkForAvailableUpdates() {
793
+ if (isOfflineModeEnabled()) {
794
+ return [];
795
+ }
796
+ const globalSettings = this.settingsManager.getGlobalSettings();
797
+ const projectSettings = this.settingsManager.getProjectSettings();
798
+ const allPackages = [];
799
+ for (const pkg of projectSettings.packages ?? []) {
800
+ allPackages.push({ pkg, scope: "project" });
801
+ }
802
+ for (const pkg of globalSettings.packages ?? []) {
803
+ allPackages.push({ pkg, scope: "user" });
804
+ }
805
+ const packageSources = this.dedupePackages(allPackages);
806
+ const checks = packageSources
807
+ .filter((entry) => entry.scope !== "temporary")
808
+ .map((entry) => async () => {
809
+ const source = typeof entry.pkg === "string" ? entry.pkg : entry.pkg.source;
810
+ const parsed = this.parseSource(source);
811
+ if (parsed.type === "local" || parsed.pinned) {
812
+ return undefined;
813
+ }
814
+ if (parsed.type === "npm") {
815
+ const installedPath = this.getNpmInstallPath(parsed, entry.scope);
816
+ if (!existsSync(installedPath)) {
817
+ return undefined;
818
+ }
819
+ const hasUpdate = await this.npmHasAvailableUpdate(parsed, installedPath);
820
+ if (!hasUpdate) {
821
+ return undefined;
822
+ }
823
+ return {
824
+ source,
825
+ displayName: parsed.name,
826
+ type: "npm",
827
+ scope: entry.scope,
828
+ };
829
+ }
830
+ const installedPath = this.getGitInstallPath(parsed, entry.scope);
831
+ if (!existsSync(installedPath)) {
832
+ return undefined;
833
+ }
834
+ const hasUpdate = await this.gitHasAvailableUpdate(installedPath);
835
+ if (!hasUpdate) {
836
+ return undefined;
837
+ }
838
+ return {
839
+ source,
840
+ displayName: `${parsed.host}/${parsed.path}`,
841
+ type: "git",
842
+ scope: entry.scope,
843
+ };
844
+ });
845
+ const results = await this.runWithConcurrency(checks, UPDATE_CHECK_CONCURRENCY);
846
+ return results.filter((result) => result !== undefined);
847
+ }
848
+ async resolvePackageSources(sources, accumulator, onMissing) {
849
+ for (const { pkg, scope } of sources) {
850
+ const sourceStr = typeof pkg === "string" ? pkg : pkg.source;
851
+ const filter = typeof pkg === "object" ? pkg : undefined;
852
+ const parsed = this.parseSource(sourceStr);
853
+ const metadata = { source: sourceStr, scope, origin: "package" };
854
+ if (parsed.type === "local") {
855
+ const baseDir = this.getBaseDirForScope(scope);
856
+ this.resolveLocalExtensionSource(parsed, accumulator, filter, metadata, baseDir);
857
+ continue;
858
+ }
859
+ const installMissing = async () => {
860
+ if (isOfflineModeEnabled()) {
861
+ return false;
862
+ }
863
+ if (!onMissing) {
864
+ await this.installParsedSource(parsed, scope);
865
+ return true;
866
+ }
867
+ const action = await onMissing(sourceStr);
868
+ if (action === "skip")
869
+ return false;
870
+ if (action === "error")
871
+ throw new Error(`Missing source: ${sourceStr}`);
872
+ await this.installParsedSource(parsed, scope);
873
+ return true;
874
+ };
875
+ if (parsed.type === "npm") {
876
+ const installedPath = this.getNpmInstallPath(parsed, scope);
877
+ const needsInstall = !existsSync(installedPath) ||
878
+ (parsed.pinned && !(await this.installedNpmMatchesPinnedVersion(parsed, installedPath)));
879
+ if (needsInstall) {
880
+ const installed = await installMissing();
881
+ if (!installed)
882
+ continue;
883
+ }
884
+ metadata.baseDir = installedPath;
885
+ this.collectPackageResources(installedPath, accumulator, filter, metadata);
886
+ continue;
887
+ }
888
+ if (parsed.type === "git") {
889
+ const installedPath = this.getGitInstallPath(parsed, scope);
890
+ if (!existsSync(installedPath)) {
891
+ const installed = await installMissing();
892
+ if (!installed)
893
+ continue;
894
+ }
895
+ else if (scope === "temporary" && !parsed.pinned && !isOfflineModeEnabled()) {
896
+ await this.refreshTemporaryGitSource(parsed, sourceStr);
897
+ }
898
+ metadata.baseDir = installedPath;
899
+ this.collectPackageResources(installedPath, accumulator, filter, metadata);
900
+ }
901
+ }
902
+ }
903
+ resolveLocalExtensionSource(source, accumulator, filter, metadata, baseDir) {
904
+ const resolved = this.resolvePathFromBase(source.path, baseDir);
905
+ if (!existsSync(resolved)) {
906
+ return;
907
+ }
908
+ try {
909
+ const stats = statSync(resolved);
910
+ if (stats.isFile()) {
911
+ metadata.baseDir = dirname(resolved);
912
+ this.addResource(accumulator.extensions, resolved, metadata, true);
913
+ return;
914
+ }
915
+ if (stats.isDirectory()) {
916
+ metadata.baseDir = resolved;
917
+ const resources = this.collectPackageResources(resolved, accumulator, filter, metadata);
918
+ if (!resources) {
919
+ this.addResource(accumulator.extensions, resolved, metadata, true);
920
+ }
921
+ }
922
+ }
923
+ catch {
924
+ return;
925
+ }
926
+ }
927
+ async installParsedSource(parsed, scope) {
928
+ if (parsed.type === "npm") {
929
+ await this.installNpm(parsed, scope, scope === "temporary");
930
+ return;
931
+ }
932
+ if (parsed.type === "git") {
933
+ await this.installGit(parsed, scope);
934
+ return;
935
+ }
936
+ }
937
+ getPackageSourceString(pkg) {
938
+ return typeof pkg === "string" ? pkg : pkg.source;
939
+ }
940
+ getSourceMatchKeyForInput(source) {
941
+ const parsed = this.parseSource(source);
942
+ if (parsed.type === "npm") {
943
+ return `npm:${parsed.name}`;
944
+ }
945
+ if (parsed.type === "git") {
946
+ return `git:${parsed.host}/${parsed.path}`;
947
+ }
948
+ return `local:${this.resolvePath(parsed.path)}`;
949
+ }
950
+ getSourceMatchKeyForSettings(source, scope) {
951
+ const parsed = this.parseSource(source);
952
+ if (parsed.type === "npm") {
953
+ return `npm:${parsed.name}`;
954
+ }
955
+ if (parsed.type === "git") {
956
+ return `git:${parsed.host}/${parsed.path}`;
957
+ }
958
+ const baseDir = this.getBaseDirForScope(scope);
959
+ return `local:${this.resolvePathFromBase(parsed.path, baseDir)}`;
960
+ }
961
+ buildNoMatchingPackageMessage(source, configuredPackages) {
962
+ const suggestion = this.findSuggestedConfiguredSource(source, configuredPackages);
963
+ if (!suggestion) {
964
+ return `No matching package found for ${source}`;
965
+ }
966
+ return `No matching package found for ${source}. Did you mean ${suggestion}?`;
967
+ }
968
+ findSuggestedConfiguredSource(source, configuredPackages) {
969
+ const trimmedSource = source.trim();
970
+ const suggestions = new Set();
971
+ for (const pkg of configuredPackages) {
972
+ const sourceStr = this.getPackageSourceString(pkg);
973
+ const parsed = this.parseSource(sourceStr);
974
+ if (parsed.type === "npm") {
975
+ if (trimmedSource === parsed.name || trimmedSource === parsed.spec) {
976
+ suggestions.add(sourceStr);
977
+ }
978
+ continue;
979
+ }
980
+ if (parsed.type === "git") {
981
+ const shorthand = `${parsed.host}/${parsed.path}`;
982
+ const shorthandWithRef = parsed.ref ? `${shorthand}@${parsed.ref}` : undefined;
983
+ if (trimmedSource === shorthand || (shorthandWithRef && trimmedSource === shorthandWithRef)) {
984
+ suggestions.add(sourceStr);
985
+ }
986
+ }
987
+ }
988
+ return suggestions.values().next().value;
989
+ }
990
+ packageSourcesMatch(existing, inputSource, scope) {
991
+ const left = this.getSourceMatchKeyForSettings(this.getPackageSourceString(existing), scope);
992
+ const right = this.getSourceMatchKeyForInput(inputSource);
993
+ return left === right;
994
+ }
995
+ normalizePackageSourceForSettings(source, scope) {
996
+ const parsed = this.parseSource(source);
997
+ if (parsed.type !== "local") {
998
+ return source;
999
+ }
1000
+ const baseDir = this.getBaseDirForScope(scope);
1001
+ const resolved = this.resolvePath(parsed.path);
1002
+ const rel = relative(baseDir, resolved);
1003
+ return rel || ".";
1004
+ }
1005
+ parseSource(source) {
1006
+ if (source.startsWith("npm:")) {
1007
+ const spec = source.slice("npm:".length).trim();
1008
+ const { name, version } = this.parseNpmSpec(spec);
1009
+ return {
1010
+ type: "npm",
1011
+ spec,
1012
+ name,
1013
+ pinned: Boolean(version),
1014
+ };
1015
+ }
1016
+ if (isLocalPath(source)) {
1017
+ return { type: "local", path: source };
1018
+ }
1019
+ // Try parsing as git URL
1020
+ const gitParsed = parseGitUrl(source);
1021
+ if (gitParsed) {
1022
+ return gitParsed;
1023
+ }
1024
+ return { type: "local", path: source };
1025
+ }
1026
+ async installedNpmMatchesPinnedVersion(source, installedPath) {
1027
+ const installedVersion = this.getInstalledNpmVersion(installedPath);
1028
+ if (!installedVersion) {
1029
+ return false;
1030
+ }
1031
+ const { version: pinnedVersion } = this.parseNpmSpec(source.spec);
1032
+ if (!pinnedVersion) {
1033
+ return true;
1034
+ }
1035
+ return installedVersion === pinnedVersion;
1036
+ }
1037
+ async npmHasAvailableUpdate(source, installedPath) {
1038
+ if (isOfflineModeEnabled()) {
1039
+ return false;
1040
+ }
1041
+ const installedVersion = this.getInstalledNpmVersion(installedPath);
1042
+ if (!installedVersion) {
1043
+ return false;
1044
+ }
1045
+ try {
1046
+ const latestVersion = await this.getLatestNpmVersion(source.name);
1047
+ return latestVersion !== installedVersion;
1048
+ }
1049
+ catch {
1050
+ return false;
1051
+ }
1052
+ }
1053
+ getInstalledNpmVersion(installedPath) {
1054
+ const packageJsonPath = join(installedPath, "package.json");
1055
+ if (!existsSync(packageJsonPath))
1056
+ return undefined;
1057
+ try {
1058
+ const content = readFileSync(packageJsonPath, "utf-8");
1059
+ const pkg = JSON.parse(content);
1060
+ return pkg.version;
1061
+ }
1062
+ catch {
1063
+ return undefined;
1064
+ }
1065
+ }
1066
+ async getLatestNpmVersion(packageName) {
1067
+ const response = await fetch(`https://registry.npmjs.org/${packageName}/latest`, {
1068
+ signal: AbortSignal.timeout(NETWORK_TIMEOUT_MS),
1069
+ });
1070
+ if (!response.ok)
1071
+ throw new Error(`Failed to fetch npm registry: ${response.status}`);
1072
+ const data = (await response.json());
1073
+ return data.version;
1074
+ }
1075
+ async gitHasAvailableUpdate(installedPath) {
1076
+ if (isOfflineModeEnabled()) {
1077
+ return false;
1078
+ }
1079
+ try {
1080
+ const localHead = await this.runCommandCapture("git", ["rev-parse", "HEAD"], {
1081
+ cwd: installedPath,
1082
+ timeoutMs: NETWORK_TIMEOUT_MS,
1083
+ });
1084
+ const remoteHead = await this.getRemoteGitHead(installedPath);
1085
+ return localHead.trim() !== remoteHead.trim();
1086
+ }
1087
+ catch {
1088
+ return false;
1089
+ }
1090
+ }
1091
+ async getRemoteGitHead(installedPath) {
1092
+ const upstreamRef = await this.getGitUpstreamRef(installedPath);
1093
+ if (upstreamRef) {
1094
+ const remoteHead = await this.runGitRemoteCommand(installedPath, ["ls-remote", "origin", upstreamRef]);
1095
+ const match = remoteHead.match(/^([0-9a-f]{40})\s+/m);
1096
+ if (match?.[1]) {
1097
+ return match[1];
1098
+ }
1099
+ }
1100
+ const remoteHead = await this.runGitRemoteCommand(installedPath, ["ls-remote", "origin", "HEAD"]);
1101
+ const match = remoteHead.match(/^([0-9a-f]{40})\s+HEAD$/m);
1102
+ if (!match?.[1]) {
1103
+ throw new Error("Failed to determine remote HEAD");
1104
+ }
1105
+ return match[1];
1106
+ }
1107
+ async getLocalGitUpdateTarget(installedPath) {
1108
+ try {
1109
+ const upstream = await this.runCommandCapture("git", ["rev-parse", "--abbrev-ref", "@{upstream}"], {
1110
+ cwd: installedPath,
1111
+ timeoutMs: NETWORK_TIMEOUT_MS,
1112
+ });
1113
+ const trimmedUpstream = upstream.trim();
1114
+ if (!trimmedUpstream.startsWith("origin/")) {
1115
+ throw new Error(`Unsupported upstream remote: ${trimmedUpstream}`);
1116
+ }
1117
+ const branch = trimmedUpstream.slice("origin/".length);
1118
+ if (!branch) {
1119
+ throw new Error("Missing upstream branch name");
1120
+ }
1121
+ const head = await this.runCommandCapture("git", ["rev-parse", "@{upstream}"], {
1122
+ cwd: installedPath,
1123
+ timeoutMs: NETWORK_TIMEOUT_MS,
1124
+ });
1125
+ return {
1126
+ ref: "@{upstream}",
1127
+ head,
1128
+ fetchArgs: [
1129
+ "fetch",
1130
+ "--prune",
1131
+ "--no-tags",
1132
+ "origin",
1133
+ `+refs/heads/${branch}:refs/remotes/origin/${branch}`,
1134
+ ],
1135
+ };
1136
+ }
1137
+ catch {
1138
+ await this.runCommand("git", ["remote", "set-head", "origin", "-a"], { cwd: installedPath }).catch(() => { });
1139
+ const head = await this.runCommandCapture("git", ["rev-parse", "origin/HEAD"], {
1140
+ cwd: installedPath,
1141
+ timeoutMs: NETWORK_TIMEOUT_MS,
1142
+ });
1143
+ const originHeadRef = await this.runCommandCapture("git", ["symbolic-ref", "refs/remotes/origin/HEAD"], {
1144
+ cwd: installedPath,
1145
+ timeoutMs: NETWORK_TIMEOUT_MS,
1146
+ }).catch(() => "");
1147
+ const branch = originHeadRef.trim().replace(/^refs\/remotes\/origin\//, "");
1148
+ if (branch) {
1149
+ return {
1150
+ ref: "origin/HEAD",
1151
+ head,
1152
+ fetchArgs: [
1153
+ "fetch",
1154
+ "--prune",
1155
+ "--no-tags",
1156
+ "origin",
1157
+ `+refs/heads/${branch}:refs/remotes/origin/${branch}`,
1158
+ ],
1159
+ };
1160
+ }
1161
+ return {
1162
+ ref: "origin/HEAD",
1163
+ head,
1164
+ fetchArgs: ["fetch", "--prune", "--no-tags", "origin", "+HEAD:refs/remotes/origin/HEAD"],
1165
+ };
1166
+ }
1167
+ }
1168
+ async getGitUpstreamRef(installedPath) {
1169
+ try {
1170
+ const upstream = await this.runCommandCapture("git", ["rev-parse", "--abbrev-ref", "@{upstream}"], {
1171
+ cwd: installedPath,
1172
+ timeoutMs: NETWORK_TIMEOUT_MS,
1173
+ });
1174
+ const trimmed = upstream.trim();
1175
+ if (!trimmed.startsWith("origin/")) {
1176
+ return undefined;
1177
+ }
1178
+ const branch = trimmed.slice("origin/".length);
1179
+ return branch ? `refs/heads/${branch}` : undefined;
1180
+ }
1181
+ catch {
1182
+ return undefined;
1183
+ }
1184
+ }
1185
+ runGitRemoteCommand(installedPath, args) {
1186
+ return this.runCommandCapture("git", args, {
1187
+ cwd: installedPath,
1188
+ timeoutMs: NETWORK_TIMEOUT_MS,
1189
+ env: {
1190
+ GIT_TERMINAL_PROMPT: "0",
1191
+ },
1192
+ });
1193
+ }
1194
+ async runWithConcurrency(tasks, limit) {
1195
+ if (tasks.length === 0) {
1196
+ return [];
1197
+ }
1198
+ const results = new Array(tasks.length);
1199
+ let nextIndex = 0;
1200
+ const workerCount = Math.max(1, Math.min(limit, tasks.length));
1201
+ const worker = async () => {
1202
+ while (true) {
1203
+ const index = nextIndex;
1204
+ nextIndex += 1;
1205
+ if (index >= tasks.length) {
1206
+ return;
1207
+ }
1208
+ results[index] = await tasks[index]();
1209
+ }
1210
+ };
1211
+ await Promise.all(Array.from({ length: workerCount }, () => worker()));
1212
+ return results;
1213
+ }
1214
+ /**
1215
+ * Get a unique identity for a package, ignoring version/ref.
1216
+ * Used to detect when the same package is in both global and project settings.
1217
+ * For git packages, uses normalized host/path to ensure SSH and HTTPS URLs
1218
+ * for the same repository are treated as identical.
1219
+ */
1220
+ getPackageIdentity(source, scope) {
1221
+ const parsed = this.parseSource(source);
1222
+ if (parsed.type === "npm") {
1223
+ return `npm:${parsed.name}`;
1224
+ }
1225
+ if (parsed.type === "git") {
1226
+ // Use host/path for identity to normalize SSH and HTTPS
1227
+ return `git:${parsed.host}/${parsed.path}`;
1228
+ }
1229
+ if (scope) {
1230
+ const baseDir = this.getBaseDirForScope(scope);
1231
+ return `local:${this.resolvePathFromBase(parsed.path, baseDir)}`;
1232
+ }
1233
+ return `local:${this.resolvePath(parsed.path)}`;
1234
+ }
1235
+ /**
1236
+ * Dedupe packages: if same package identity appears in both global and project,
1237
+ * keep only the project one (project wins).
1238
+ */
1239
+ dedupePackages(packages) {
1240
+ const seen = new Map();
1241
+ for (const entry of packages) {
1242
+ const sourceStr = typeof entry.pkg === "string" ? entry.pkg : entry.pkg.source;
1243
+ const identity = this.getPackageIdentity(sourceStr, entry.scope);
1244
+ const existing = seen.get(identity);
1245
+ if (!existing) {
1246
+ seen.set(identity, entry);
1247
+ }
1248
+ else if (entry.scope === "project" && existing.scope === "user") {
1249
+ // Project wins over user
1250
+ seen.set(identity, entry);
1251
+ }
1252
+ // If existing is project and new is global, keep existing (project)
1253
+ // If both are same scope, keep first one
1254
+ }
1255
+ return Array.from(seen.values());
1256
+ }
1257
+ parseNpmSpec(spec) {
1258
+ const match = spec.match(/^(@?[^@]+(?:\/[^@]+)?)(?:@(.+))?$/);
1259
+ if (!match) {
1260
+ return { name: spec };
1261
+ }
1262
+ const name = match[1] ?? spec;
1263
+ const version = match[2];
1264
+ return { name, version };
1265
+ }
1266
+ getNpmCommand() {
1267
+ const configuredCommand = this.settingsManager.getNpmCommand();
1268
+ if (!configuredCommand || configuredCommand.length === 0) {
1269
+ return { command: "npm", args: [] };
1270
+ }
1271
+ const [command, ...args] = configuredCommand;
1272
+ if (!command) {
1273
+ throw new Error("Invalid npmCommand: first array entry must be a non-empty command");
1274
+ }
1275
+ return { command, args };
1276
+ }
1277
+ async runNpmCommand(args, options) {
1278
+ const npmCommand = this.getNpmCommand();
1279
+ await this.runCommand(npmCommand.command, [...npmCommand.args, ...args], options);
1280
+ }
1281
+ runNpmCommandSync(args) {
1282
+ const npmCommand = this.getNpmCommand();
1283
+ return this.runCommandSync(npmCommand.command, [...npmCommand.args, ...args]);
1284
+ }
1285
+ async installNpm(source, scope, temporary) {
1286
+ if (scope === "user" && !temporary) {
1287
+ await this.runNpmCommand(["install", "-g", source.spec]);
1288
+ return;
1289
+ }
1290
+ const installRoot = this.getNpmInstallRoot(scope, temporary);
1291
+ this.ensureNpmProject(installRoot);
1292
+ await this.runNpmCommand(["install", source.spec, "--prefix", installRoot]);
1293
+ }
1294
+ async uninstallNpm(source, scope) {
1295
+ if (scope === "user") {
1296
+ await this.runNpmCommand(["uninstall", "-g", source.name]);
1297
+ return;
1298
+ }
1299
+ const installRoot = this.getNpmInstallRoot(scope, false);
1300
+ if (!existsSync(installRoot)) {
1301
+ return;
1302
+ }
1303
+ await this.runNpmCommand(["uninstall", source.name, "--prefix", installRoot]);
1304
+ }
1305
+ async installGit(source, scope) {
1306
+ const targetDir = this.getGitInstallPath(source, scope);
1307
+ if (existsSync(targetDir)) {
1308
+ return;
1309
+ }
1310
+ const gitRoot = this.getGitInstallRoot(scope);
1311
+ if (gitRoot) {
1312
+ this.ensureGitIgnore(gitRoot);
1313
+ }
1314
+ mkdirSync(dirname(targetDir), { recursive: true });
1315
+ await this.runCommand("git", ["clone", source.repo, targetDir]);
1316
+ if (source.ref) {
1317
+ await this.runCommand("git", ["checkout", source.ref], { cwd: targetDir });
1318
+ }
1319
+ const packageJsonPath = join(targetDir, "package.json");
1320
+ if (existsSync(packageJsonPath)) {
1321
+ await this.runNpmCommand(["install"], { cwd: targetDir });
1322
+ }
1323
+ }
1324
+ async updateGit(source, scope) {
1325
+ const targetDir = this.getGitInstallPath(source, scope);
1326
+ if (!existsSync(targetDir)) {
1327
+ await this.installGit(source, scope);
1328
+ return;
1329
+ }
1330
+ const target = await this.getLocalGitUpdateTarget(targetDir);
1331
+ // Fetch only the ref we will reset to, avoiding unrelated branch/tag noise.
1332
+ await this.runCommand("git", target.fetchArgs, { cwd: targetDir });
1333
+ const localHead = await this.runCommandCapture("git", ["rev-parse", "HEAD"], {
1334
+ cwd: targetDir,
1335
+ timeoutMs: NETWORK_TIMEOUT_MS,
1336
+ });
1337
+ const refreshedTargetHead = await this.runCommandCapture("git", ["rev-parse", target.ref], {
1338
+ cwd: targetDir,
1339
+ timeoutMs: NETWORK_TIMEOUT_MS,
1340
+ });
1341
+ if (localHead.trim() === refreshedTargetHead.trim()) {
1342
+ return;
1343
+ }
1344
+ await this.runCommand("git", ["reset", "--hard", target.ref], { cwd: targetDir });
1345
+ // Clean untracked files (extensions should be pristine)
1346
+ await this.runCommand("git", ["clean", "-fdx"], { cwd: targetDir });
1347
+ const packageJsonPath = join(targetDir, "package.json");
1348
+ if (existsSync(packageJsonPath)) {
1349
+ await this.runNpmCommand(["install"], { cwd: targetDir });
1350
+ }
1351
+ }
1352
+ async refreshTemporaryGitSource(source, sourceStr) {
1353
+ if (isOfflineModeEnabled()) {
1354
+ return;
1355
+ }
1356
+ try {
1357
+ await this.withProgress("pull", sourceStr, `Refreshing ${sourceStr}...`, async () => {
1358
+ await this.updateGit(source, "temporary");
1359
+ });
1360
+ }
1361
+ catch {
1362
+ // Keep cached temporary checkout if refresh fails.
1363
+ }
1364
+ }
1365
+ async removeGit(source, scope) {
1366
+ const targetDir = this.getGitInstallPath(source, scope);
1367
+ if (!existsSync(targetDir))
1368
+ return;
1369
+ rmSync(targetDir, { recursive: true, force: true });
1370
+ this.pruneEmptyGitParents(targetDir, this.getGitInstallRoot(scope));
1371
+ }
1372
+ pruneEmptyGitParents(targetDir, installRoot) {
1373
+ if (!installRoot)
1374
+ return;
1375
+ const resolvedRoot = resolve(installRoot);
1376
+ let current = dirname(targetDir);
1377
+ while (current.startsWith(resolvedRoot) && current !== resolvedRoot) {
1378
+ if (!existsSync(current)) {
1379
+ current = dirname(current);
1380
+ continue;
1381
+ }
1382
+ const entries = readdirSync(current);
1383
+ if (entries.length > 0) {
1384
+ break;
1385
+ }
1386
+ try {
1387
+ rmSync(current, { recursive: true, force: true });
1388
+ }
1389
+ catch {
1390
+ break;
1391
+ }
1392
+ current = dirname(current);
1393
+ }
1394
+ }
1395
+ ensureNpmProject(installRoot) {
1396
+ if (!existsSync(installRoot)) {
1397
+ mkdirSync(installRoot, { recursive: true });
1398
+ }
1399
+ this.ensureGitIgnore(installRoot);
1400
+ const packageJsonPath = join(installRoot, "package.json");
1401
+ if (!existsSync(packageJsonPath)) {
1402
+ const pkgJson = { name: "pi-extensions", private: true };
1403
+ writeFileSync(packageJsonPath, JSON.stringify(pkgJson, null, 2), "utf-8");
1404
+ }
1405
+ }
1406
+ ensureGitIgnore(dir) {
1407
+ if (!existsSync(dir)) {
1408
+ mkdirSync(dir, { recursive: true });
1409
+ }
1410
+ const ignorePath = join(dir, ".gitignore");
1411
+ if (!existsSync(ignorePath)) {
1412
+ writeFileSync(ignorePath, "*\n!.gitignore\n", "utf-8");
1413
+ }
1414
+ }
1415
+ getNpmInstallRoot(scope, temporary) {
1416
+ if (temporary) {
1417
+ return this.getTemporaryDir("npm");
1418
+ }
1419
+ if (scope === "project") {
1420
+ return join(this.cwd, CONFIG_DIR_NAME, "npm");
1421
+ }
1422
+ return join(this.getGlobalNpmRoot(), "..");
1423
+ }
1424
+ getGlobalNpmRoot() {
1425
+ const npmCommand = this.getNpmCommand();
1426
+ const commandKey = [npmCommand.command, ...npmCommand.args].join("\0");
1427
+ if (this.globalNpmRoot && this.globalNpmRootCommandKey === commandKey) {
1428
+ return this.globalNpmRoot;
1429
+ }
1430
+ const result = this.runNpmCommandSync(["root", "-g"]);
1431
+ this.globalNpmRoot = result.trim();
1432
+ this.globalNpmRootCommandKey = commandKey;
1433
+ return this.globalNpmRoot;
1434
+ }
1435
+ getNpmInstallPath(source, scope) {
1436
+ if (scope === "temporary") {
1437
+ return join(this.getTemporaryDir("npm"), "node_modules", source.name);
1438
+ }
1439
+ if (scope === "project") {
1440
+ return join(this.cwd, CONFIG_DIR_NAME, "npm", "node_modules", source.name);
1441
+ }
1442
+ return join(this.getGlobalNpmRoot(), source.name);
1443
+ }
1444
+ getGitInstallPath(source, scope) {
1445
+ if (scope === "temporary") {
1446
+ return this.getTemporaryDir(`git-${source.host}`, source.path);
1447
+ }
1448
+ if (scope === "project") {
1449
+ return join(this.cwd, CONFIG_DIR_NAME, "git", source.host, source.path);
1450
+ }
1451
+ return join(this.agentDir, "git", source.host, source.path);
1452
+ }
1453
+ getGitInstallRoot(scope) {
1454
+ if (scope === "temporary") {
1455
+ return undefined;
1456
+ }
1457
+ if (scope === "project") {
1458
+ return join(this.cwd, CONFIG_DIR_NAME, "git");
1459
+ }
1460
+ return join(this.agentDir, "git");
1461
+ }
1462
+ getTemporaryDir(prefix, suffix) {
1463
+ const hash = createHash("sha256")
1464
+ .update(`${prefix}-${suffix ?? ""}`)
1465
+ .digest("hex")
1466
+ .slice(0, 8);
1467
+ return join(tmpdir(), "pi-extensions", prefix, hash, suffix ?? "");
1468
+ }
1469
+ getBaseDirForScope(scope) {
1470
+ if (scope === "project") {
1471
+ return join(this.cwd, CONFIG_DIR_NAME);
1472
+ }
1473
+ if (scope === "user") {
1474
+ return this.agentDir;
1475
+ }
1476
+ return this.cwd;
1477
+ }
1478
+ resolvePath(input) {
1479
+ const trimmed = input.trim();
1480
+ if (trimmed === "~")
1481
+ return getHomeDir();
1482
+ if (trimmed.startsWith("~/"))
1483
+ return join(getHomeDir(), trimmed.slice(2));
1484
+ if (trimmed.startsWith("~"))
1485
+ return join(getHomeDir(), trimmed.slice(1));
1486
+ return resolve(this.cwd, trimmed);
1487
+ }
1488
+ resolvePathFromBase(input, baseDir) {
1489
+ const trimmed = input.trim();
1490
+ if (trimmed === "~")
1491
+ return getHomeDir();
1492
+ if (trimmed.startsWith("~/"))
1493
+ return join(getHomeDir(), trimmed.slice(2));
1494
+ if (trimmed.startsWith("~"))
1495
+ return join(getHomeDir(), trimmed.slice(1));
1496
+ return resolve(baseDir, trimmed);
1497
+ }
1498
+ collectPackageResources(packageRoot, accumulator, filter, metadata) {
1499
+ if (filter) {
1500
+ for (const resourceType of RESOURCE_TYPES) {
1501
+ const patterns = filter[resourceType];
1502
+ const target = this.getTargetMap(accumulator, resourceType);
1503
+ if (patterns !== undefined) {
1504
+ this.applyPackageFilter(packageRoot, patterns, resourceType, target, metadata);
1505
+ }
1506
+ else {
1507
+ this.collectDefaultResources(packageRoot, resourceType, target, metadata);
1508
+ }
1509
+ }
1510
+ return true;
1511
+ }
1512
+ const manifest = this.readPiManifest(packageRoot);
1513
+ if (manifest) {
1514
+ for (const resourceType of RESOURCE_TYPES) {
1515
+ const entries = manifest[resourceType];
1516
+ this.addManifestEntries(entries, packageRoot, resourceType, this.getTargetMap(accumulator, resourceType), metadata);
1517
+ }
1518
+ return true;
1519
+ }
1520
+ let hasAnyDir = false;
1521
+ for (const resourceType of RESOURCE_TYPES) {
1522
+ const dir = join(packageRoot, resourceType);
1523
+ if (existsSync(dir)) {
1524
+ // Collect all files from the directory (all enabled by default)
1525
+ const files = collectResourceFiles(dir, resourceType);
1526
+ for (const f of files) {
1527
+ this.addResource(this.getTargetMap(accumulator, resourceType), f, metadata, true);
1528
+ }
1529
+ hasAnyDir = true;
1530
+ }
1531
+ }
1532
+ return hasAnyDir;
1533
+ }
1534
+ collectDefaultResources(packageRoot, resourceType, target, metadata) {
1535
+ const manifest = this.readPiManifest(packageRoot);
1536
+ const entries = manifest?.[resourceType];
1537
+ if (entries) {
1538
+ this.addManifestEntries(entries, packageRoot, resourceType, target, metadata);
1539
+ return;
1540
+ }
1541
+ const dir = join(packageRoot, resourceType);
1542
+ if (existsSync(dir)) {
1543
+ // Collect all files from the directory (all enabled by default)
1544
+ const files = collectResourceFiles(dir, resourceType);
1545
+ for (const f of files) {
1546
+ this.addResource(target, f, metadata, true);
1547
+ }
1548
+ }
1549
+ }
1550
+ applyPackageFilter(packageRoot, userPatterns, resourceType, target, metadata) {
1551
+ const { allFiles } = this.collectManifestFiles(packageRoot, resourceType);
1552
+ if (userPatterns.length === 0) {
1553
+ // Empty array explicitly disables all resources of this type
1554
+ for (const f of allFiles) {
1555
+ this.addResource(target, f, metadata, false);
1556
+ }
1557
+ return;
1558
+ }
1559
+ // Apply user patterns
1560
+ const enabledByUser = applyPatterns(allFiles, userPatterns, packageRoot);
1561
+ for (const f of allFiles) {
1562
+ const enabled = enabledByUser.has(f);
1563
+ this.addResource(target, f, metadata, enabled);
1564
+ }
1565
+ }
1566
+ /**
1567
+ * Collect all files from a package for a resource type, applying manifest patterns.
1568
+ * Returns { allFiles, enabledByManifest } where enabledByManifest is the set of files
1569
+ * that pass the manifest's own patterns.
1570
+ */
1571
+ collectManifestFiles(packageRoot, resourceType) {
1572
+ const manifest = this.readPiManifest(packageRoot);
1573
+ const entries = manifest?.[resourceType];
1574
+ if (entries && entries.length > 0) {
1575
+ const allFiles = this.collectFilesFromManifestEntries(entries, packageRoot, resourceType);
1576
+ const manifestPatterns = entries.filter(isPattern);
1577
+ const enabledByManifest = manifestPatterns.length > 0 ? applyPatterns(allFiles, manifestPatterns, packageRoot) : new Set(allFiles);
1578
+ return { allFiles: Array.from(enabledByManifest), enabledByManifest };
1579
+ }
1580
+ const conventionDir = join(packageRoot, resourceType);
1581
+ if (!existsSync(conventionDir)) {
1582
+ return { allFiles: [], enabledByManifest: new Set() };
1583
+ }
1584
+ const allFiles = collectResourceFiles(conventionDir, resourceType);
1585
+ return { allFiles, enabledByManifest: new Set(allFiles) };
1586
+ }
1587
+ readPiManifest(packageRoot) {
1588
+ const packageJsonPath = join(packageRoot, "package.json");
1589
+ if (!existsSync(packageJsonPath)) {
1590
+ return null;
1591
+ }
1592
+ try {
1593
+ const content = readFileSync(packageJsonPath, "utf-8");
1594
+ const pkg = JSON.parse(content);
1595
+ return pkg.pi ?? null;
1596
+ }
1597
+ catch {
1598
+ return null;
1599
+ }
1600
+ }
1601
+ addManifestEntries(entries, root, resourceType, target, metadata) {
1602
+ if (!entries)
1603
+ return;
1604
+ const allFiles = this.collectFilesFromManifestEntries(entries, root, resourceType);
1605
+ const patterns = entries.filter(isPattern);
1606
+ const enabledPaths = applyPatterns(allFiles, patterns, root);
1607
+ for (const f of allFiles) {
1608
+ if (enabledPaths.has(f)) {
1609
+ this.addResource(target, f, metadata, true);
1610
+ }
1611
+ }
1612
+ }
1613
+ collectFilesFromManifestEntries(entries, root, resourceType) {
1614
+ const plain = entries.filter((entry) => !isPattern(entry));
1615
+ const resolved = plain.map((entry) => resolve(root, entry));
1616
+ return this.collectFilesFromPaths(resolved, resourceType);
1617
+ }
1618
+ resolveLocalEntries(entries, resourceType, target, metadata, baseDir) {
1619
+ if (entries.length === 0)
1620
+ return;
1621
+ // Collect all files from plain entries (non-pattern entries)
1622
+ const { plain, patterns } = splitPatterns(entries);
1623
+ const resolvedPlain = plain.map((p) => this.resolvePathFromBase(p, baseDir));
1624
+ const allFiles = this.collectFilesFromPaths(resolvedPlain, resourceType);
1625
+ // Determine which files are enabled based on patterns
1626
+ const enabledPaths = applyPatterns(allFiles, patterns, baseDir);
1627
+ // Add all files with their enabled state
1628
+ for (const f of allFiles) {
1629
+ this.addResource(target, f, metadata, enabledPaths.has(f));
1630
+ }
1631
+ }
1632
+ addAutoDiscoveredResources(accumulator, globalSettings, projectSettings, globalBaseDir, projectBaseDir) {
1633
+ const userMetadata = {
1634
+ source: "auto",
1635
+ scope: "user",
1636
+ origin: "top-level",
1637
+ baseDir: globalBaseDir,
1638
+ };
1639
+ const projectMetadata = {
1640
+ source: "auto",
1641
+ scope: "project",
1642
+ origin: "top-level",
1643
+ baseDir: projectBaseDir,
1644
+ };
1645
+ const userOverrides = {
1646
+ extensions: (globalSettings.extensions ?? []),
1647
+ skills: (globalSettings.skills ?? []),
1648
+ prompts: (globalSettings.prompts ?? []),
1649
+ themes: (globalSettings.themes ?? []),
1650
+ };
1651
+ const projectOverrides = {
1652
+ extensions: (projectSettings.extensions ?? []),
1653
+ skills: (projectSettings.skills ?? []),
1654
+ prompts: (projectSettings.prompts ?? []),
1655
+ themes: (projectSettings.themes ?? []),
1656
+ };
1657
+ const userDirs = {
1658
+ extensions: join(globalBaseDir, "extensions"),
1659
+ skills: join(globalBaseDir, "skills"),
1660
+ prompts: join(globalBaseDir, "prompts"),
1661
+ themes: join(globalBaseDir, "themes"),
1662
+ };
1663
+ const projectDirs = {
1664
+ extensions: join(projectBaseDir, "extensions"),
1665
+ skills: join(projectBaseDir, "skills"),
1666
+ prompts: join(projectBaseDir, "prompts"),
1667
+ themes: join(projectBaseDir, "themes"),
1668
+ };
1669
+ const userAgentsSkillsDir = join(getHomeDir(), ".agents", "skills");
1670
+ const projectAgentsSkillDirs = collectAncestorAgentsSkillDirs(this.cwd).filter((dir) => resolve(dir) !== resolve(userAgentsSkillsDir));
1671
+ const addResources = (resourceType, paths, metadata, overrides, baseDir) => {
1672
+ const target = this.getTargetMap(accumulator, resourceType);
1673
+ for (const path of paths) {
1674
+ const enabled = isEnabledByOverrides(path, overrides, baseDir);
1675
+ this.addResource(target, path, metadata, enabled);
1676
+ }
1677
+ };
1678
+ addResources("extensions", collectAutoExtensionEntries(projectDirs.extensions), projectMetadata, projectOverrides.extensions, projectBaseDir);
1679
+ addResources("skills", [
1680
+ ...collectAutoSkillEntries(projectDirs.skills, "pi"),
1681
+ ...projectAgentsSkillDirs.flatMap((dir) => collectAutoSkillEntries(dir, "agents")),
1682
+ ], projectMetadata, projectOverrides.skills, projectBaseDir);
1683
+ addResources("prompts", collectAutoPromptEntries(projectDirs.prompts), projectMetadata, projectOverrides.prompts, projectBaseDir);
1684
+ addResources("themes", collectAutoThemeEntries(projectDirs.themes), projectMetadata, projectOverrides.themes, projectBaseDir);
1685
+ addResources("extensions", collectAutoExtensionEntries(userDirs.extensions), userMetadata, userOverrides.extensions, globalBaseDir);
1686
+ addResources("skills", [...collectAutoSkillEntries(userDirs.skills, "pi"), ...collectAutoSkillEntries(userAgentsSkillsDir, "agents")], userMetadata, userOverrides.skills, globalBaseDir);
1687
+ addResources("prompts", collectAutoPromptEntries(userDirs.prompts), userMetadata, userOverrides.prompts, globalBaseDir);
1688
+ addResources("themes", collectAutoThemeEntries(userDirs.themes), userMetadata, userOverrides.themes, globalBaseDir);
1689
+ }
1690
+ collectFilesFromPaths(paths, resourceType) {
1691
+ const files = [];
1692
+ for (const p of paths) {
1693
+ if (!existsSync(p))
1694
+ continue;
1695
+ try {
1696
+ const stats = statSync(p);
1697
+ if (stats.isFile()) {
1698
+ files.push(p);
1699
+ }
1700
+ else if (stats.isDirectory()) {
1701
+ files.push(...collectResourceFiles(p, resourceType));
1702
+ }
1703
+ }
1704
+ catch {
1705
+ // Ignore errors
1706
+ }
1707
+ }
1708
+ return files;
1709
+ }
1710
+ getTargetMap(accumulator, resourceType) {
1711
+ switch (resourceType) {
1712
+ case "extensions":
1713
+ return accumulator.extensions;
1714
+ case "skills":
1715
+ return accumulator.skills;
1716
+ case "prompts":
1717
+ return accumulator.prompts;
1718
+ case "themes":
1719
+ return accumulator.themes;
1720
+ default:
1721
+ throw new Error(`Unknown resource type: ${resourceType}`);
1722
+ }
1723
+ }
1724
+ addResource(map, path, metadata, enabled) {
1725
+ if (!path)
1726
+ return;
1727
+ if (!map.has(path)) {
1728
+ map.set(path, { metadata, enabled });
1729
+ }
1730
+ }
1731
+ createAccumulator() {
1732
+ return {
1733
+ extensions: new Map(),
1734
+ skills: new Map(),
1735
+ prompts: new Map(),
1736
+ themes: new Map(),
1737
+ };
1738
+ }
1739
+ toResolvedPaths(accumulator) {
1740
+ const toResolved = (entries) => {
1741
+ const resolved = Array.from(entries.entries()).map(([path, { metadata, enabled }]) => ({
1742
+ path,
1743
+ enabled,
1744
+ metadata,
1745
+ }));
1746
+ resolved.sort((a, b) => resourcePrecedenceRank(a.metadata) - resourcePrecedenceRank(b.metadata));
1747
+ return resolved;
1748
+ };
1749
+ return {
1750
+ extensions: toResolved(accumulator.extensions),
1751
+ skills: toResolved(accumulator.skills),
1752
+ prompts: toResolved(accumulator.prompts),
1753
+ themes: toResolved(accumulator.themes),
1754
+ };
1755
+ }
1756
+ runCommandCapture(command, args, options) {
1757
+ return new Promise((resolvePromise, reject) => {
1758
+ const child = spawn(command, args, {
1759
+ cwd: options?.cwd,
1760
+ stdio: ["ignore", "pipe", "pipe"],
1761
+ shell: process.platform === "win32",
1762
+ env: options?.env ? { ...process.env, ...options.env } : process.env,
1763
+ });
1764
+ let stdout = "";
1765
+ let stderr = "";
1766
+ let timedOut = false;
1767
+ const timeout = typeof options?.timeoutMs === "number"
1768
+ ? setTimeout(() => {
1769
+ timedOut = true;
1770
+ child.kill();
1771
+ }, options.timeoutMs)
1772
+ : undefined;
1773
+ child.stdout?.on("data", (data) => {
1774
+ stdout += data.toString();
1775
+ });
1776
+ child.stderr?.on("data", (data) => {
1777
+ stderr += data.toString();
1778
+ });
1779
+ child.on("error", (error) => {
1780
+ if (timeout)
1781
+ clearTimeout(timeout);
1782
+ reject(error);
1783
+ });
1784
+ child.on("exit", (code) => {
1785
+ if (timeout)
1786
+ clearTimeout(timeout);
1787
+ if (timedOut) {
1788
+ reject(new Error(`${command} ${args.join(" ")} timed out after ${options?.timeoutMs}ms`));
1789
+ return;
1790
+ }
1791
+ if (code === 0) {
1792
+ resolvePromise(stdout.trim());
1793
+ return;
1794
+ }
1795
+ reject(new Error(`${command} ${args.join(" ")} failed with code ${code}: ${stderr || stdout}`));
1796
+ });
1797
+ });
1798
+ }
1799
+ runCommand(command, args, options) {
1800
+ return new Promise((resolvePromise, reject) => {
1801
+ const child = spawn(command, args, {
1802
+ cwd: options?.cwd,
1803
+ stdio: isStdoutTakenOver() ? ["ignore", 2, 2] : "inherit",
1804
+ shell: process.platform === "win32",
1805
+ });
1806
+ child.on("error", reject);
1807
+ child.on("exit", (code) => {
1808
+ if (code === 0) {
1809
+ resolvePromise();
1810
+ }
1811
+ else {
1812
+ reject(new Error(`${command} ${args.join(" ")} failed with code ${code}`));
1813
+ }
1814
+ });
1815
+ });
1816
+ }
1817
+ runCommandSync(command, args) {
1818
+ const result = spawnSync(command, args, {
1819
+ stdio: ["ignore", "pipe", "pipe"],
1820
+ encoding: "utf-8",
1821
+ shell: process.platform === "win32",
1822
+ });
1823
+ if (result.status !== 0) {
1824
+ throw new Error(`Failed to run ${command} ${args.join(" ")}: ${result.stderr || result.stdout}`);
1825
+ }
1826
+ return (result.stdout || result.stderr || "").trim();
1827
+ }
1828
+ }
1829
+ //# sourceMappingURL=package-manager.js.map