@shawnstack/quickforge 1.2.10 → 1.3.1

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 (490) hide show
  1. package/README.md +168 -168
  2. package/bin/quickforge.mjs +1 -1
  3. package/dist/assets/{anthropic-Djv-yfjG.js → anthropic-BatEyK8y.js} +1 -1
  4. package/dist/assets/{azure-openai-responses-CPKUoCEU.js → azure-openai-responses-x2zt1vQ5.js} +1 -1
  5. package/dist/assets/{google-C-R-u2qc.js → google-Bu82Bpnf.js} +1 -1
  6. package/dist/assets/{google-gemini-cli-dDAuABJc.js → google-gemini-cli-DS9GBhgL.js} +1 -1
  7. package/dist/assets/{google-vertex-_Wbk8kup.js → google-vertex-BSYJREKA.js} +1 -1
  8. package/dist/assets/{index-BX7ubNTi.js → index-BcdhSSEb.js} +720 -651
  9. package/dist/assets/index-CeD3UXoG.css +3 -0
  10. package/dist/assets/lit-vendor-Dr3cpBGF.js +2 -0
  11. package/dist/assets/{mistral-BRgU1d4N.js → mistral-HBkLbNNt.js} +1 -1
  12. package/dist/assets/{openai-codex-responses-vU6EYFL-.js → openai-codex-responses-Cl5j_Ziv.js} +1 -1
  13. package/dist/assets/{openai-completions-Ihn7oMVQ.js → openai-completions-ualO3AwD.js} +1 -1
  14. package/dist/assets/{openai-responses-C9WUeUKV.js → openai-responses-Bgz1mp5h.js} +1 -1
  15. package/dist/assets/{openai-responses-shared-Cv0LKYNf.js → openai-responses-shared-D_-OXsDz.js} +1 -1
  16. package/dist/index.html +3 -3
  17. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/endpoint/endpointResolver.js +2 -2
  18. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/index.js +9 -13
  19. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/runtimeConfig.browser.js +5 -5
  20. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-cjs/runtimeConfig.js +2 -3
  21. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-es/BedrockRuntimeClient.js +1 -4
  22. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-es/endpoint/endpointResolver.js +1 -1
  23. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-es/runtimeConfig.browser.js +1 -1
  24. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-es/runtimeConfig.js +1 -2
  25. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-es/runtimeExtensions.js +1 -1
  26. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-types/BedrockRuntimeClient.d.ts +1 -2
  27. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-types/runtimeConfig.browser.d.ts +1 -1
  28. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-types/runtimeConfig.d.ts +1 -1
  29. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-types/runtimeConfig.native.d.ts +1 -1
  30. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-types/ts3.4/BedrockRuntimeClient.d.ts +5 -7
  31. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-types/ts3.4/runtimeConfig.browser.d.ts +1 -1
  32. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-types/ts3.4/runtimeConfig.d.ts +1 -1
  33. package/node_modules/@aws-sdk/client-bedrock-runtime/dist-types/ts3.4/runtimeConfig.native.d.ts +1 -1
  34. package/node_modules/@aws-sdk/client-bedrock-runtime/package.json +11 -19
  35. package/node_modules/@aws-sdk/core/dist-cjs/index.js +14 -16
  36. package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.browser.js +595 -0
  37. package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.js +715 -0
  38. package/node_modules/@aws-sdk/core/dist-cjs/submodules/client/index.native.js +588 -0
  39. package/node_modules/@aws-sdk/core/dist-cjs/submodules/protocols/index.js +10 -10
  40. package/node_modules/@aws-sdk/core/dist-es/index.js +3 -3
  41. package/node_modules/@aws-sdk/core/dist-es/submodules/client/index.browser.js +36 -0
  42. package/node_modules/@aws-sdk/core/dist-es/submodules/client/index.js +26 -4
  43. package/node_modules/@aws-sdk/core/dist-es/submodules/client/index.native.js +37 -0
  44. package/node_modules/@aws-sdk/core/dist-es/submodules/client/middleware-recursion-detection/getRecursionDetectionPlugin.browser.js +3 -0
  45. package/node_modules/@aws-sdk/{middleware-user-agent/dist-es → core/dist-es/submodules/client/middleware-user-agent}/check-features.js +1 -1
  46. package/node_modules/@aws-sdk/{middleware-user-agent/dist-es → core/dist-es/submodules/client/middleware-user-agent}/user-agent-middleware.js +1 -1
  47. package/node_modules/@aws-sdk/{util-endpoints/dist-es → core/dist-es/submodules/client/util-endpoints}/lib/aws/partition.js +1 -1
  48. package/node_modules/@aws-sdk/core/dist-es/submodules/client/util-endpoints/lib/aws/partitions.js +1 -0
  49. package/node_modules/@aws-sdk/core/dist-es/submodules/client/util-user-agent-browser/defaultUserAgent.browser.js +1 -0
  50. package/node_modules/@aws-sdk/{util-user-agent-node/dist-es → core/dist-es/submodules/client/util-user-agent-node}/nodeAppIdConfigOptions.js +1 -1
  51. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/AwsJsonRpcProtocol.js +1 -1
  52. package/node_modules/@aws-sdk/core/dist-es/submodules/protocols/json/parseJsonBody.js +9 -9
  53. package/node_modules/@aws-sdk/core/dist-types/api-extractor-type-index.d.ts +3 -2
  54. package/node_modules/@aws-sdk/core/dist-types/index.d.ts +12 -14
  55. package/node_modules/@aws-sdk/core/dist-types/submodules/client/index.browser.d.ts +47 -0
  56. package/node_modules/@aws-sdk/core/dist-types/submodules/client/index.d.ts +38 -4
  57. package/node_modules/@aws-sdk/core/dist-types/submodules/client/index.native.d.ts +48 -0
  58. package/node_modules/@aws-sdk/core/dist-types/submodules/client/middleware-recursion-detection/getRecursionDetectionPlugin.d.ts +5 -0
  59. package/node_modules/@aws-sdk/core/dist-types/submodules/client/util-endpoints/lib/aws/partitions.d.ts +638 -0
  60. package/node_modules/@aws-sdk/{util-user-agent-browser/dist-types → core/dist-types/submodules/client/util-user-agent-browser}/createUserAgentStringParsingProvider.d.ts +1 -1
  61. package/node_modules/@aws-sdk/core/dist-types/submodules/client/util-user-agent-browser/defaultUserAgent.browser.d.ts +1 -0
  62. package/node_modules/@aws-sdk/core/dist-types/submodules/protocols/json/parseJsonBody.d.ts +1 -1
  63. package/node_modules/@aws-sdk/core/dist-types/ts3.4/api-extractor-type-index.d.ts +0 -2
  64. package/node_modules/@aws-sdk/core/dist-types/ts3.4/index.d.ts +65 -3
  65. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/index.browser.d.ts +116 -0
  66. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/index.d.ts +123 -4
  67. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/index.native.d.ts +116 -0
  68. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/middleware-recursion-detection/getRecursionDetectionPlugin.d.ts +4 -0
  69. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-endpoints/lib/aws/partitions.d.ts +647 -0
  70. package/node_modules/@aws-sdk/{util-user-agent-browser/dist-types/ts3.4 → core/dist-types/ts3.4/submodules/client/util-user-agent-browser}/createUserAgentStringParsingProvider.d.ts +1 -1
  71. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/client/util-user-agent-browser/defaultUserAgent.browser.d.ts +1 -0
  72. package/node_modules/@aws-sdk/core/dist-types/ts3.4/submodules/protocols/json/parseJsonBody.d.ts +0 -1
  73. package/node_modules/@aws-sdk/core/package.json +27 -8
  74. package/node_modules/@aws-sdk/credential-provider-env/package.json +3 -3
  75. package/node_modules/@aws-sdk/credential-provider-http/package.json +5 -5
  76. package/node_modules/@aws-sdk/credential-provider-ini/package.json +11 -11
  77. package/node_modules/@aws-sdk/credential-provider-login/package.json +4 -4
  78. package/node_modules/@aws-sdk/credential-provider-node/package.json +9 -9
  79. package/node_modules/@aws-sdk/credential-provider-process/package.json +3 -3
  80. package/node_modules/@aws-sdk/credential-provider-sso/package.json +5 -5
  81. package/node_modules/@aws-sdk/credential-provider-web-identity/package.json +4 -4
  82. package/node_modules/@aws-sdk/eventstream-handler-node/package.json +2 -2
  83. package/node_modules/@aws-sdk/middleware-eventstream/package.json +2 -2
  84. package/node_modules/@aws-sdk/middleware-websocket/package.json +5 -5
  85. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/cognito-identity/index.js +13 -20
  86. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/signin/index.js +13 -20
  87. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso/index.js +13 -20
  88. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js +13 -20
  89. package/node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sts/index.js +14 -21
  90. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/CognitoIdentityClient.js +1 -4
  91. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/endpoint/endpointResolver.js +1 -1
  92. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/runtimeConfig.browser.js +1 -1
  93. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/runtimeConfig.js +1 -2
  94. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/cognito-identity/runtimeExtensions.js +1 -1
  95. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/SigninClient.js +1 -4
  96. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/endpoint/endpointResolver.js +1 -1
  97. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/runtimeConfig.browser.js +1 -1
  98. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/runtimeConfig.js +1 -2
  99. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/signin/runtimeExtensions.js +1 -1
  100. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/SSOClient.js +1 -4
  101. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/endpoint/endpointResolver.js +1 -1
  102. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/runtimeConfig.browser.js +1 -1
  103. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/runtimeConfig.js +1 -2
  104. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso/runtimeExtensions.js +1 -1
  105. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/SSOOIDCClient.js +1 -4
  106. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/endpoint/endpointResolver.js +1 -1
  107. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/runtimeConfig.browser.js +1 -1
  108. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/runtimeConfig.js +1 -2
  109. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sso-oidc/runtimeExtensions.js +1 -1
  110. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/STSClient.js +1 -4
  111. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/defaultStsRoleAssumers.js +1 -2
  112. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/endpoint/endpointResolver.js +1 -1
  113. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/runtimeConfig.browser.js +1 -1
  114. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/runtimeConfig.js +1 -2
  115. package/node_modules/@aws-sdk/nested-clients/dist-es/submodules/sts/runtimeExtensions.js +1 -1
  116. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/CognitoIdentityClient.d.ts +1 -2
  117. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/runtimeConfig.browser.d.ts +1 -1
  118. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/runtimeConfig.d.ts +1 -1
  119. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/cognito-identity/runtimeConfig.native.d.ts +1 -1
  120. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/SigninClient.d.ts +1 -2
  121. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/runtimeConfig.browser.d.ts +1 -1
  122. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/runtimeConfig.d.ts +1 -1
  123. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/signin/runtimeConfig.native.d.ts +1 -1
  124. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/SSOClient.d.ts +1 -2
  125. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/runtimeConfig.browser.d.ts +1 -1
  126. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/runtimeConfig.d.ts +1 -1
  127. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso/runtimeConfig.native.d.ts +1 -1
  128. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/SSOOIDCClient.d.ts +1 -2
  129. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/runtimeConfig.browser.d.ts +1 -1
  130. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/runtimeConfig.d.ts +1 -1
  131. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sso-oidc/runtimeConfig.native.d.ts +1 -1
  132. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/STSClient.d.ts +1 -2
  133. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/runtimeConfig.browser.d.ts +1 -1
  134. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/runtimeConfig.d.ts +1 -1
  135. package/node_modules/@aws-sdk/nested-clients/dist-types/submodules/sts/runtimeConfig.native.d.ts +1 -1
  136. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/cognito-identity/CognitoIdentityClient.d.ts +1 -3
  137. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/cognito-identity/runtimeConfig.browser.d.ts +1 -1
  138. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/cognito-identity/runtimeConfig.d.ts +1 -1
  139. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/cognito-identity/runtimeConfig.native.d.ts +1 -1
  140. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/SigninClient.d.ts +1 -3
  141. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/runtimeConfig.browser.d.ts +1 -1
  142. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/runtimeConfig.d.ts +1 -1
  143. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/signin/runtimeConfig.native.d.ts +1 -1
  144. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso/SSOClient.d.ts +1 -3
  145. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso/runtimeConfig.browser.d.ts +1 -1
  146. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso/runtimeConfig.d.ts +1 -1
  147. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso/runtimeConfig.native.d.ts +1 -1
  148. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso-oidc/SSOOIDCClient.d.ts +1 -3
  149. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso-oidc/runtimeConfig.browser.d.ts +1 -1
  150. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso-oidc/runtimeConfig.d.ts +1 -1
  151. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sso-oidc/runtimeConfig.native.d.ts +1 -1
  152. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/STSClient.d.ts +1 -3
  153. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/runtimeConfig.browser.d.ts +1 -1
  154. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/runtimeConfig.d.ts +1 -1
  155. package/node_modules/@aws-sdk/nested-clients/dist-types/ts3.4/submodules/sts/runtimeConfig.native.d.ts +1 -1
  156. package/node_modules/@aws-sdk/nested-clients/package.json +6 -14
  157. package/node_modules/@aws-sdk/signature-v4-multi-region/package.json +3 -3
  158. package/node_modules/@aws-sdk/token-providers/package.json +4 -4
  159. package/node_modules/@aws-sdk/xml-builder/package.json +2 -2
  160. package/node_modules/@protobufjs/fetch/CHANGELOG.md +8 -0
  161. package/node_modules/@protobufjs/fetch/index.d.ts +7 -7
  162. package/node_modules/@protobufjs/fetch/index.js +4 -7
  163. package/node_modules/@protobufjs/fetch/package.json +7 -5
  164. package/node_modules/@protobufjs/fetch/tests/data/file.txt +1 -0
  165. package/node_modules/@protobufjs/fetch/tests/index.js +150 -8
  166. package/node_modules/@protobufjs/fetch/util/fs.js +11 -0
  167. package/node_modules/@protobufjs/inquire/CHANGELOG.md +8 -0
  168. package/node_modules/@protobufjs/inquire/index.d.ts +1 -0
  169. package/node_modules/@protobufjs/inquire/index.js +1 -0
  170. package/node_modules/@protobufjs/inquire/package.json +1 -1
  171. package/node_modules/@smithy/core/package.json +2 -2
  172. package/node_modules/@smithy/credential-provider-imds/package.json +3 -3
  173. package/node_modules/@smithy/fetch-http-handler/package.json +4 -4
  174. package/node_modules/@smithy/node-http-handler/package.json +4 -4
  175. package/node_modules/@smithy/signature-v4/package.json +3 -3
  176. package/node_modules/@smithy/types/README.md +3 -3
  177. package/node_modules/@smithy/types/dist-types/abort.d.ts +4 -6
  178. package/node_modules/@smithy/types/dist-types/auth/auth.d.ts +6 -4
  179. package/node_modules/@smithy/types/dist-types/blob/blob-payload-input-types.d.ts +7 -10
  180. package/node_modules/@smithy/types/dist-types/checksum.d.ts +4 -6
  181. package/node_modules/@smithy/types/dist-types/client.d.ts +8 -8
  182. package/node_modules/@smithy/types/dist-types/command.d.ts +2 -2
  183. package/node_modules/@smithy/types/dist-types/crypto.d.ts +6 -8
  184. package/node_modules/@smithy/types/dist-types/downlevel-ts3.4/transform/type-transform.d.ts +6 -7
  185. package/node_modules/@smithy/types/dist-types/eventStream.d.ts +10 -10
  186. package/node_modules/@smithy/types/dist-types/extensions/defaultClientConfiguration.d.ts +9 -10
  187. package/node_modules/@smithy/types/dist-types/extensions/defaultExtensionConfiguration.d.ts +2 -2
  188. package/node_modules/@smithy/types/dist-types/externals-check/browser-externals-check.d.ts +10 -10
  189. package/node_modules/@smithy/types/dist-types/http/httpHandlerInitialization.d.ts +2 -2
  190. package/node_modules/@smithy/types/dist-types/http.d.ts +18 -21
  191. package/node_modules/@smithy/types/dist-types/logger.d.ts +2 -2
  192. package/node_modules/@smithy/types/dist-types/middleware.d.ts +28 -27
  193. package/node_modules/@smithy/types/dist-types/pagination.d.ts +4 -4
  194. package/node_modules/@smithy/types/dist-types/serde.d.ts +10 -10
  195. package/node_modules/@smithy/types/dist-types/shapes.d.ts +9 -12
  196. package/node_modules/@smithy/types/dist-types/signature.d.ts +4 -4
  197. package/node_modules/@smithy/types/dist-types/stream.d.ts +2 -2
  198. package/node_modules/@smithy/types/dist-types/streaming-payload/streaming-blob-common-types.d.ts +7 -11
  199. package/node_modules/@smithy/types/dist-types/streaming-payload/streaming-blob-payload-input-types.d.ts +23 -29
  200. package/node_modules/@smithy/types/dist-types/streaming-payload/streaming-blob-payload-output-types.d.ts +9 -19
  201. package/node_modules/@smithy/types/dist-types/transfer.d.ts +2 -1
  202. package/node_modules/@smithy/types/dist-types/transform/client-method-transforms.d.ts +4 -4
  203. package/node_modules/@smithy/types/dist-types/transform/client-payload-blob-type-narrow.d.ts +14 -18
  204. package/node_modules/@smithy/types/dist-types/transform/exact.d.ts +2 -2
  205. package/node_modules/@smithy/types/dist-types/transform/no-undefined.d.ts +12 -12
  206. package/node_modules/@smithy/types/dist-types/transform/type-transform.d.ts +14 -9
  207. package/node_modules/@smithy/types/dist-types/uri.d.ts +2 -2
  208. package/node_modules/@smithy/types/dist-types/util.d.ts +28 -28
  209. package/node_modules/@smithy/types/package.json +1 -1
  210. package/node_modules/@types/node/README.md +1 -1
  211. package/node_modules/@types/node/async_hooks.d.ts +108 -0
  212. package/node_modules/@types/node/crypto.d.ts +14 -3
  213. package/node_modules/@types/node/fs/promises.d.ts +126 -0
  214. package/node_modules/@types/node/fs.d.ts +4 -2
  215. package/node_modules/@types/node/index.d.ts +2 -0
  216. package/node_modules/@types/node/inspector.generated.d.ts +5 -0
  217. package/node_modules/@types/node/module.d.ts +1 -0
  218. package/node_modules/@types/node/package.json +3 -3
  219. package/node_modules/@types/node/process.d.ts +25 -1
  220. package/node_modules/@types/node/quic.d.ts +2 -2
  221. package/node_modules/@types/node/repl.d.ts +15 -0
  222. package/node_modules/@types/node/sqlite.d.ts +54 -7
  223. package/node_modules/@types/node/stream/iter.d.ts +298 -0
  224. package/node_modules/@types/node/test.d.ts +84 -16
  225. package/node_modules/@types/node/ts5.6/index.d.ts +2 -0
  226. package/node_modules/@types/node/ts5.7/index.d.ts +2 -0
  227. package/node_modules/@types/node/url.d.ts +4 -2
  228. package/node_modules/@types/node/vm.d.ts +5 -4
  229. package/node_modules/@types/node/zlib/iter.d.ts +131 -0
  230. package/node_modules/@vscode/ripgrep/LICENSE +13 -0
  231. package/node_modules/@vscode/ripgrep/README.md +33 -0
  232. package/node_modules/@vscode/ripgrep/lib/index.d.ts +1 -0
  233. package/node_modules/@vscode/ripgrep/lib/index.js +19 -0
  234. package/node_modules/@vscode/ripgrep/package.json +39 -0
  235. package/node_modules/@vscode/ripgrep-win32-x64/LICENSE +13 -0
  236. package/node_modules/@vscode/ripgrep-win32-x64/README.md +5 -0
  237. package/node_modules/@vscode/ripgrep-win32-x64/bin/rg.exe +0 -0
  238. package/node_modules/@vscode/ripgrep-win32-x64/package.json +19 -0
  239. package/node_modules/fast-xml-parser/CHANGELOG.md +7 -0
  240. package/node_modules/fast-xml-parser/README.md +0 -3
  241. package/node_modules/fast-xml-parser/lib/fxbuilder.min.js +1 -1
  242. package/node_modules/fast-xml-parser/lib/fxbuilder.min.js.map +1 -1
  243. package/node_modules/fast-xml-parser/lib/fxp.cjs +1 -1
  244. package/node_modules/fast-xml-parser/lib/fxp.d.cts +1 -0
  245. package/node_modules/fast-xml-parser/lib/fxp.min.js +1 -1
  246. package/node_modules/fast-xml-parser/lib/fxp.min.js.map +1 -1
  247. package/node_modules/fast-xml-parser/lib/fxparser.min.js +1 -1
  248. package/node_modules/fast-xml-parser/lib/fxparser.min.js.map +1 -1
  249. package/node_modules/fast-xml-parser/package.json +2 -4
  250. package/node_modules/fast-xml-parser/src/fxp.d.ts +1 -0
  251. package/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +1 -1
  252. package/node_modules/fast-xml-parser/src/xmlparser/node2json.js +4 -0
  253. package/node_modules/protobufjs/README.md +1 -1
  254. package/node_modules/protobufjs/dist/light/protobuf.js +193 -157
  255. package/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
  256. package/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
  257. package/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
  258. package/node_modules/protobufjs/dist/minimal/protobuf.js +14 -5
  259. package/node_modules/protobufjs/dist/minimal/protobuf.js.map +1 -1
  260. package/node_modules/protobufjs/dist/minimal/protobuf.min.js +3 -3
  261. package/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +1 -1
  262. package/node_modules/protobufjs/dist/protobuf.js +213 -177
  263. package/node_modules/protobufjs/dist/protobuf.js.map +1 -1
  264. package/node_modules/protobufjs/dist/protobuf.min.js +3 -3
  265. package/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
  266. package/node_modules/protobufjs/index.d.ts +2 -1
  267. package/node_modules/protobufjs/package.json +7 -4
  268. package/node_modules/protobufjs/src/converter.js +5 -3
  269. package/node_modules/protobufjs/src/type.js +1 -1
  270. package/node_modules/protobufjs/src/util/fs.js +11 -0
  271. package/node_modules/protobufjs/src/util/minimal.js +10 -2
  272. package/node_modules/protobufjs/src/util.js +1 -1
  273. package/node_modules/undici-types/connector.d.ts +2 -0
  274. package/node_modules/undici-types/dispatcher.d.ts +7 -5
  275. package/node_modules/undici-types/errors.d.ts +17 -1
  276. package/node_modules/undici-types/index.d.ts +4 -1
  277. package/node_modules/undici-types/interceptors.d.ts +7 -0
  278. package/node_modules/undici-types/package.json +1 -1
  279. package/node_modules/undici-types/socks5-proxy-agent.d.ts +25 -0
  280. package/package.json +5 -3
  281. package/server/agent-manager.mjs +8 -2
  282. package/server/custom-commands.mjs +42 -14
  283. package/server/project-config.mjs +8 -0
  284. package/server/routes/project.mjs +26 -1
  285. package/server/system-prompt.mjs +22 -0
  286. package/server/tools/definitions.mjs +7 -15
  287. package/server/tools/index.mjs +748 -485
  288. package/dist/assets/index-B094j8RZ.css +0 -3
  289. package/dist/assets/lit-vendor-1dsGB-Iy.js +0 -2
  290. package/node_modules/@aws-sdk/middleware-host-header/LICENSE +0 -201
  291. package/node_modules/@aws-sdk/middleware-host-header/README.md +0 -4
  292. package/node_modules/@aws-sdk/middleware-host-header/dist-cjs/index.js +0 -41
  293. package/node_modules/@aws-sdk/middleware-host-header/package.json +0 -59
  294. package/node_modules/@aws-sdk/middleware-logger/LICENSE +0 -201
  295. package/node_modules/@aws-sdk/middleware-logger/README.md +0 -4
  296. package/node_modules/@aws-sdk/middleware-logger/dist-cjs/index.js +0 -48
  297. package/node_modules/@aws-sdk/middleware-logger/dist-es/index.js +0 -1
  298. package/node_modules/@aws-sdk/middleware-logger/dist-types/index.d.ts +0 -1
  299. package/node_modules/@aws-sdk/middleware-logger/dist-types/ts3.4/index.d.ts +0 -1
  300. package/node_modules/@aws-sdk/middleware-logger/package.json +0 -59
  301. package/node_modules/@aws-sdk/middleware-recursion-detection/LICENSE +0 -201
  302. package/node_modules/@aws-sdk/middleware-recursion-detection/README.md +0 -17
  303. package/node_modules/@aws-sdk/middleware-recursion-detection/dist-cjs/index.js +0 -29
  304. package/node_modules/@aws-sdk/middleware-recursion-detection/dist-cjs/recursionDetectionMiddleware.browser.js +0 -5
  305. package/node_modules/@aws-sdk/middleware-recursion-detection/dist-cjs/recursionDetectionMiddleware.js +0 -33
  306. package/node_modules/@aws-sdk/middleware-recursion-detection/dist-cjs/recursionDetectionMiddleware.native.js +0 -5
  307. package/node_modules/@aws-sdk/middleware-recursion-detection/dist-es/index.js +0 -2
  308. package/node_modules/@aws-sdk/middleware-recursion-detection/dist-types/index.d.ts +0 -2
  309. package/node_modules/@aws-sdk/middleware-recursion-detection/dist-types/ts3.4/index.d.ts +0 -2
  310. package/node_modules/@aws-sdk/middleware-recursion-detection/package.json +0 -66
  311. package/node_modules/@aws-sdk/middleware-user-agent/LICENSE +0 -201
  312. package/node_modules/@aws-sdk/middleware-user-agent/README.md +0 -4
  313. package/node_modules/@aws-sdk/middleware-user-agent/dist-cjs/index.js +0 -194
  314. package/node_modules/@aws-sdk/middleware-user-agent/dist-es/index.js +0 -2
  315. package/node_modules/@aws-sdk/middleware-user-agent/dist-types/index.d.ts +0 -2
  316. package/node_modules/@aws-sdk/middleware-user-agent/dist-types/ts3.4/index.d.ts +0 -2
  317. package/node_modules/@aws-sdk/middleware-user-agent/package.json +0 -61
  318. package/node_modules/@aws-sdk/region-config-resolver/LICENSE +0 -201
  319. package/node_modules/@aws-sdk/region-config-resolver/README.md +0 -19
  320. package/node_modules/@aws-sdk/region-config-resolver/dist-cjs/index.js +0 -38
  321. package/node_modules/@aws-sdk/region-config-resolver/dist-cjs/regionConfig/stsRegionDefaultResolver.browser.js +0 -6
  322. package/node_modules/@aws-sdk/region-config-resolver/dist-cjs/regionConfig/stsRegionDefaultResolver.js +0 -19
  323. package/node_modules/@aws-sdk/region-config-resolver/dist-cjs/regionConfig/stsRegionDefaultResolver.native.js +0 -6
  324. package/node_modules/@aws-sdk/region-config-resolver/dist-es/index.js +0 -3
  325. package/node_modules/@aws-sdk/region-config-resolver/dist-types/index.d.ts +0 -3
  326. package/node_modules/@aws-sdk/region-config-resolver/dist-types/ts3.4/index.d.ts +0 -3
  327. package/node_modules/@aws-sdk/region-config-resolver/package.json +0 -64
  328. package/node_modules/@aws-sdk/util-endpoints/LICENSE +0 -201
  329. package/node_modules/@aws-sdk/util-endpoints/README.md +0 -6
  330. package/node_modules/@aws-sdk/util-endpoints/dist-cjs/index.js +0 -406
  331. package/node_modules/@aws-sdk/util-endpoints/dist-cjs/lib/aws/partitions.json +0 -267
  332. package/node_modules/@aws-sdk/util-endpoints/dist-es/index.js +0 -6
  333. package/node_modules/@aws-sdk/util-endpoints/dist-es/lib/aws/index.js +0 -3
  334. package/node_modules/@aws-sdk/util-endpoints/dist-es/lib/aws/partitions.json +0 -267
  335. package/node_modules/@aws-sdk/util-endpoints/dist-es/types/index.js +0 -6
  336. package/node_modules/@aws-sdk/util-endpoints/dist-types/index.d.ts +0 -6
  337. package/node_modules/@aws-sdk/util-endpoints/dist-types/lib/aws/index.d.ts +0 -3
  338. package/node_modules/@aws-sdk/util-endpoints/dist-types/ts3.4/index.d.ts +0 -6
  339. package/node_modules/@aws-sdk/util-endpoints/dist-types/ts3.4/lib/aws/index.d.ts +0 -3
  340. package/node_modules/@aws-sdk/util-endpoints/dist-types/ts3.4/types/index.d.ts +0 -6
  341. package/node_modules/@aws-sdk/util-endpoints/dist-types/types/index.d.ts +0 -6
  342. package/node_modules/@aws-sdk/util-endpoints/package.json +0 -59
  343. package/node_modules/@aws-sdk/util-user-agent-browser/LICENSE +0 -201
  344. package/node_modules/@aws-sdk/util-user-agent-browser/README.md +0 -29
  345. package/node_modules/@aws-sdk/util-user-agent-browser/dist-cjs/createUserAgentStringParsingProvider.js +0 -24
  346. package/node_modules/@aws-sdk/util-user-agent-browser/dist-cjs/index.browser.js +0 -4
  347. package/node_modules/@aws-sdk/util-user-agent-browser/dist-cjs/index.js +0 -61
  348. package/node_modules/@aws-sdk/util-user-agent-browser/dist-cjs/index.native.js +0 -22
  349. package/node_modules/@aws-sdk/util-user-agent-browser/dist-es/index.browser.js +0 -1
  350. package/node_modules/@aws-sdk/util-user-agent-browser/dist-types/index.browser.d.ts +0 -1
  351. package/node_modules/@aws-sdk/util-user-agent-browser/dist-types/ts3.4/index.browser.d.ts +0 -1
  352. package/node_modules/@aws-sdk/util-user-agent-browser/package.json +0 -60
  353. package/node_modules/@aws-sdk/util-user-agent-node/LICENSE +0 -201
  354. package/node_modules/@aws-sdk/util-user-agent-node/README.md +0 -17
  355. package/node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js +0 -185
  356. package/node_modules/@aws-sdk/util-user-agent-node/dist-es/index.js +0 -2
  357. package/node_modules/@aws-sdk/util-user-agent-node/dist-types/index.d.ts +0 -2
  358. package/node_modules/@aws-sdk/util-user-agent-node/dist-types/ts3.4/index.d.ts +0 -2
  359. package/node_modules/@aws-sdk/util-user-agent-node/package.json +0 -68
  360. package/skills/ai-context-package/SKILL.md +0 -104
  361. package/skills/ai-context-package/skill.json +0 -9
  362. package/skills/code-review/SKILL.md +0 -23
  363. package/skills/code-review/skill.json +0 -9
  364. package/skills/frontend-react/SKILL.md +0 -22
  365. package/skills/frontend-react/skill.json +0 -9
  366. package/skills/quickforge-project/SKILL.md +0 -22
  367. package/skills/quickforge-project/skill.json +0 -9
  368. /package/node_modules/@aws-sdk/{middleware-host-header/dist-es/index.js → core/dist-es/submodules/client/middleware-host-header/hostHeaderMiddleware.js} +0 -0
  369. /package/node_modules/@aws-sdk/{middleware-logger/dist-es → core/dist-es/submodules/client/middleware-logger}/loggerMiddleware.js +0 -0
  370. /package/node_modules/@aws-sdk/{middleware-recursion-detection/dist-es → core/dist-es/submodules/client/middleware-recursion-detection}/configuration.js +0 -0
  371. /package/node_modules/@aws-sdk/{middleware-recursion-detection/dist-es → core/dist-es/submodules/client/middleware-recursion-detection}/getRecursionDetectionPlugin.js +0 -0
  372. /package/node_modules/@aws-sdk/{middleware-recursion-detection/dist-es → core/dist-es/submodules/client/middleware-recursion-detection}/recursionDetectionMiddleware.browser.js +0 -0
  373. /package/node_modules/@aws-sdk/{middleware-recursion-detection/dist-es → core/dist-es/submodules/client/middleware-recursion-detection}/recursionDetectionMiddleware.js +0 -0
  374. /package/node_modules/@aws-sdk/{middleware-recursion-detection/dist-es → core/dist-es/submodules/client/middleware-recursion-detection}/recursionDetectionMiddleware.native.js +0 -0
  375. /package/node_modules/@aws-sdk/{middleware-user-agent/dist-es → core/dist-es/submodules/client/middleware-user-agent}/configurations.js +0 -0
  376. /package/node_modules/@aws-sdk/{middleware-user-agent/dist-es → core/dist-es/submodules/client/middleware-user-agent}/constants.js +0 -0
  377. /package/node_modules/@aws-sdk/{middleware-user-agent/dist-es → core/dist-es/submodules/client/middleware-user-agent}/encode-features.js +0 -0
  378. /package/node_modules/@aws-sdk/{region-config-resolver/dist-es/regionConfig → core/dist-es/submodules/client/region-config-resolver}/awsRegionConfig.js +0 -0
  379. /package/node_modules/@aws-sdk/{region-config-resolver/dist-es/extensions/index.js → core/dist-es/submodules/client/region-config-resolver/extensions.js} +0 -0
  380. /package/node_modules/@aws-sdk/{region-config-resolver/dist-es/regionConfig → core/dist-es/submodules/client/region-config-resolver}/stsRegionDefaultResolver.browser.js +0 -0
  381. /package/node_modules/@aws-sdk/{region-config-resolver/dist-es/regionConfig → core/dist-es/submodules/client/region-config-resolver}/stsRegionDefaultResolver.js +0 -0
  382. /package/node_modules/@aws-sdk/{region-config-resolver/dist-es/regionConfig → core/dist-es/submodules/client/region-config-resolver}/stsRegionDefaultResolver.native.js +0 -0
  383. /package/node_modules/@aws-sdk/{util-endpoints/dist-es → core/dist-es/submodules/client/util-endpoints}/aws.js +0 -0
  384. /package/node_modules/@aws-sdk/{util-endpoints/dist-es → core/dist-es/submodules/client/util-endpoints}/lib/aws/isVirtualHostableS3Bucket.js +0 -0
  385. /package/node_modules/@aws-sdk/{util-endpoints/dist-es → core/dist-es/submodules/client/util-endpoints}/lib/aws/parseArn.js +0 -0
  386. /package/node_modules/@aws-sdk/{util-endpoints/dist-es → core/dist-es/submodules/client/util-endpoints}/lib/isIpAddress.js +0 -0
  387. /package/node_modules/@aws-sdk/{util-endpoints/dist-es → core/dist-es/submodules/client/util-endpoints}/resolveDefaultAwsRegionalEndpointsConfig.js +0 -0
  388. /package/node_modules/@aws-sdk/{util-endpoints/dist-es → core/dist-es/submodules/client/util-endpoints}/resolveEndpoint.js +0 -0
  389. /package/node_modules/@aws-sdk/{util-endpoints/dist-es → core/dist-es/submodules/client/util-endpoints}/types/EndpointError.js +0 -0
  390. /package/node_modules/@aws-sdk/{util-endpoints/dist-es → core/dist-es/submodules/client/util-endpoints}/types/EndpointRuleObject.js +0 -0
  391. /package/node_modules/@aws-sdk/{util-endpoints/dist-es → core/dist-es/submodules/client/util-endpoints}/types/ErrorRuleObject.js +0 -0
  392. /package/node_modules/@aws-sdk/{util-endpoints/dist-es → core/dist-es/submodules/client/util-endpoints}/types/RuleSetObject.js +0 -0
  393. /package/node_modules/@aws-sdk/{util-endpoints/dist-es → core/dist-es/submodules/client/util-endpoints}/types/TreeRuleObject.js +0 -0
  394. /package/node_modules/@aws-sdk/{util-endpoints/dist-es → core/dist-es/submodules/client/util-endpoints}/types/shared.js +0 -0
  395. /package/node_modules/@aws-sdk/{util-user-agent-browser/dist-es → core/dist-es/submodules/client/util-user-agent-browser}/configurations.js +0 -0
  396. /package/node_modules/@aws-sdk/{util-user-agent-browser/dist-es → core/dist-es/submodules/client/util-user-agent-browser}/createUserAgentStringParsingProvider.js +0 -0
  397. /package/node_modules/@aws-sdk/{util-user-agent-browser/dist-es/index.js → core/dist-es/submodules/client/util-user-agent-browser/defaultUserAgent.js} +0 -0
  398. /package/node_modules/@aws-sdk/{util-user-agent-browser/dist-es/index.native.js → core/dist-es/submodules/client/util-user-agent-browser/defaultUserAgent.native.js} +0 -0
  399. /package/node_modules/@aws-sdk/{util-user-agent-node/dist-es → core/dist-es/submodules/client/util-user-agent-node}/crt-availability.js +0 -0
  400. /package/node_modules/@aws-sdk/{util-user-agent-node/dist-es → core/dist-es/submodules/client/util-user-agent-node}/defaultUserAgent.js +0 -0
  401. /package/node_modules/@aws-sdk/{util-user-agent-node/dist-es → core/dist-es/submodules/client/util-user-agent-node}/getNodeModulesParentDirs.js +0 -0
  402. /package/node_modules/@aws-sdk/{util-user-agent-node/dist-es → core/dist-es/submodules/client/util-user-agent-node}/getRuntimeUserAgentPair.js +0 -0
  403. /package/node_modules/@aws-sdk/{util-user-agent-node/dist-es → core/dist-es/submodules/client/util-user-agent-node}/getSanitizedDevTypeScriptVersion.js +0 -0
  404. /package/node_modules/@aws-sdk/{util-user-agent-node/dist-es → core/dist-es/submodules/client/util-user-agent-node}/getSanitizedTypeScriptVersion.js +0 -0
  405. /package/node_modules/@aws-sdk/{util-user-agent-node/dist-es → core/dist-es/submodules/client/util-user-agent-node}/getTypeScriptUserAgentPair.js +0 -0
  406. /package/node_modules/@aws-sdk/{util-user-agent-node/dist-es → core/dist-es/submodules/client/util-user-agent-node}/is-crt-available.js +0 -0
  407. /package/node_modules/@aws-sdk/{middleware-host-header/dist-types/index.d.ts → core/dist-types/submodules/client/middleware-host-header/hostHeaderMiddleware.d.ts} +0 -0
  408. /package/node_modules/@aws-sdk/{middleware-logger/dist-types → core/dist-types/submodules/client/middleware-logger}/loggerMiddleware.d.ts +0 -0
  409. /package/node_modules/@aws-sdk/{middleware-recursion-detection/dist-types → core/dist-types/submodules/client/middleware-recursion-detection}/configuration.d.ts +0 -0
  410. /package/node_modules/@aws-sdk/{middleware-recursion-detection/dist-types/getRecursionDetectionPlugin.d.ts → core/dist-types/submodules/client/middleware-recursion-detection/getRecursionDetectionPlugin.browser.d.ts} +0 -0
  411. /package/node_modules/@aws-sdk/{middleware-recursion-detection/dist-types → core/dist-types/submodules/client/middleware-recursion-detection}/recursionDetectionMiddleware.browser.d.ts +0 -0
  412. /package/node_modules/@aws-sdk/{middleware-recursion-detection/dist-types → core/dist-types/submodules/client/middleware-recursion-detection}/recursionDetectionMiddleware.d.ts +0 -0
  413. /package/node_modules/@aws-sdk/{middleware-recursion-detection/dist-types → core/dist-types/submodules/client/middleware-recursion-detection}/recursionDetectionMiddleware.native.d.ts +0 -0
  414. /package/node_modules/@aws-sdk/{middleware-user-agent/dist-types → core/dist-types/submodules/client/middleware-user-agent}/check-features.d.ts +0 -0
  415. /package/node_modules/@aws-sdk/{middleware-user-agent/dist-types → core/dist-types/submodules/client/middleware-user-agent}/configurations.d.ts +0 -0
  416. /package/node_modules/@aws-sdk/{middleware-user-agent/dist-types → core/dist-types/submodules/client/middleware-user-agent}/constants.d.ts +0 -0
  417. /package/node_modules/@aws-sdk/{middleware-user-agent/dist-types → core/dist-types/submodules/client/middleware-user-agent}/encode-features.d.ts +0 -0
  418. /package/node_modules/@aws-sdk/{middleware-user-agent/dist-types → core/dist-types/submodules/client/middleware-user-agent}/user-agent-middleware.d.ts +0 -0
  419. /package/node_modules/@aws-sdk/{region-config-resolver/dist-types/regionConfig → core/dist-types/submodules/client/region-config-resolver}/awsRegionConfig.d.ts +0 -0
  420. /package/node_modules/@aws-sdk/{region-config-resolver/dist-types/extensions/index.d.ts → core/dist-types/submodules/client/region-config-resolver/extensions.d.ts} +0 -0
  421. /package/node_modules/@aws-sdk/{region-config-resolver/dist-types/regionConfig → core/dist-types/submodules/client/region-config-resolver}/stsRegionDefaultResolver.browser.d.ts +0 -0
  422. /package/node_modules/@aws-sdk/{region-config-resolver/dist-types/regionConfig → core/dist-types/submodules/client/region-config-resolver}/stsRegionDefaultResolver.d.ts +0 -0
  423. /package/node_modules/@aws-sdk/{region-config-resolver/dist-types/regionConfig → core/dist-types/submodules/client/region-config-resolver}/stsRegionDefaultResolver.native.d.ts +0 -0
  424. /package/node_modules/@aws-sdk/{util-endpoints/dist-types → core/dist-types/submodules/client/util-endpoints}/aws.d.ts +0 -0
  425. /package/node_modules/@aws-sdk/{util-endpoints/dist-types → core/dist-types/submodules/client/util-endpoints}/lib/aws/isVirtualHostableS3Bucket.d.ts +0 -0
  426. /package/node_modules/@aws-sdk/{util-endpoints/dist-types → core/dist-types/submodules/client/util-endpoints}/lib/aws/parseArn.d.ts +0 -0
  427. /package/node_modules/@aws-sdk/{util-endpoints/dist-types → core/dist-types/submodules/client/util-endpoints}/lib/aws/partition.d.ts +0 -0
  428. /package/node_modules/@aws-sdk/{util-endpoints/dist-types → core/dist-types/submodules/client/util-endpoints}/lib/isIpAddress.d.ts +0 -0
  429. /package/node_modules/@aws-sdk/{util-endpoints/dist-types → core/dist-types/submodules/client/util-endpoints}/resolveDefaultAwsRegionalEndpointsConfig.d.ts +0 -0
  430. /package/node_modules/@aws-sdk/{util-endpoints/dist-types → core/dist-types/submodules/client/util-endpoints}/resolveEndpoint.d.ts +0 -0
  431. /package/node_modules/@aws-sdk/{util-endpoints/dist-types/ts3.4 → core/dist-types/submodules/client/util-endpoints}/types/EndpointError.d.ts +0 -0
  432. /package/node_modules/@aws-sdk/{util-endpoints/dist-types → core/dist-types/submodules/client/util-endpoints}/types/EndpointRuleObject.d.ts +0 -0
  433. /package/node_modules/@aws-sdk/{util-endpoints/dist-types/ts3.4 → core/dist-types/submodules/client/util-endpoints}/types/ErrorRuleObject.d.ts +0 -0
  434. /package/node_modules/@aws-sdk/{util-endpoints/dist-types → core/dist-types/submodules/client/util-endpoints}/types/RuleSetObject.d.ts +0 -0
  435. /package/node_modules/@aws-sdk/{util-endpoints/dist-types/ts3.4 → core/dist-types/submodules/client/util-endpoints}/types/TreeRuleObject.d.ts +0 -0
  436. /package/node_modules/@aws-sdk/{util-endpoints/dist-types → core/dist-types/submodules/client/util-endpoints}/types/shared.d.ts +0 -0
  437. /package/node_modules/@aws-sdk/{util-user-agent-browser/dist-types → core/dist-types/submodules/client/util-user-agent-browser}/configurations.d.ts +0 -0
  438. /package/node_modules/@aws-sdk/{util-user-agent-browser/dist-types/index.d.ts → core/dist-types/submodules/client/util-user-agent-browser/defaultUserAgent.d.ts} +0 -0
  439. /package/node_modules/@aws-sdk/{util-user-agent-browser/dist-types/index.native.d.ts → core/dist-types/submodules/client/util-user-agent-browser/defaultUserAgent.native.d.ts} +0 -0
  440. /package/node_modules/@aws-sdk/{util-user-agent-node/dist-types → core/dist-types/submodules/client/util-user-agent-node}/crt-availability.d.ts +0 -0
  441. /package/node_modules/@aws-sdk/{util-user-agent-node/dist-types → core/dist-types/submodules/client/util-user-agent-node}/defaultUserAgent.d.ts +0 -0
  442. /package/node_modules/@aws-sdk/{util-user-agent-node/dist-types → core/dist-types/submodules/client/util-user-agent-node}/getNodeModulesParentDirs.d.ts +0 -0
  443. /package/node_modules/@aws-sdk/{util-user-agent-node/dist-types → core/dist-types/submodules/client/util-user-agent-node}/getRuntimeUserAgentPair.d.ts +0 -0
  444. /package/node_modules/@aws-sdk/{util-user-agent-node/dist-types → core/dist-types/submodules/client/util-user-agent-node}/getSanitizedDevTypeScriptVersion.d.ts +0 -0
  445. /package/node_modules/@aws-sdk/{util-user-agent-node/dist-types → core/dist-types/submodules/client/util-user-agent-node}/getSanitizedTypeScriptVersion.d.ts +0 -0
  446. /package/node_modules/@aws-sdk/{util-user-agent-node/dist-types → core/dist-types/submodules/client/util-user-agent-node}/getTypeScriptUserAgentPair.d.ts +0 -0
  447. /package/node_modules/@aws-sdk/{util-user-agent-node/dist-types → core/dist-types/submodules/client/util-user-agent-node}/is-crt-available.d.ts +0 -0
  448. /package/node_modules/@aws-sdk/{util-user-agent-node/dist-types → core/dist-types/submodules/client/util-user-agent-node}/nodeAppIdConfigOptions.d.ts +0 -0
  449. /package/node_modules/@aws-sdk/{middleware-host-header/dist-types/ts3.4/index.d.ts → core/dist-types/ts3.4/submodules/client/middleware-host-header/hostHeaderMiddleware.d.ts} +0 -0
  450. /package/node_modules/@aws-sdk/{middleware-logger/dist-types/ts3.4 → core/dist-types/ts3.4/submodules/client/middleware-logger}/loggerMiddleware.d.ts +0 -0
  451. /package/node_modules/@aws-sdk/{middleware-recursion-detection/dist-types/ts3.4 → core/dist-types/ts3.4/submodules/client/middleware-recursion-detection}/configuration.d.ts +0 -0
  452. /package/node_modules/@aws-sdk/{middleware-recursion-detection/dist-types/ts3.4/getRecursionDetectionPlugin.d.ts → core/dist-types/ts3.4/submodules/client/middleware-recursion-detection/getRecursionDetectionPlugin.browser.d.ts} +0 -0
  453. /package/node_modules/@aws-sdk/{middleware-recursion-detection/dist-types/ts3.4 → core/dist-types/ts3.4/submodules/client/middleware-recursion-detection}/recursionDetectionMiddleware.browser.d.ts +0 -0
  454. /package/node_modules/@aws-sdk/{middleware-recursion-detection/dist-types/ts3.4 → core/dist-types/ts3.4/submodules/client/middleware-recursion-detection}/recursionDetectionMiddleware.d.ts +0 -0
  455. /package/node_modules/@aws-sdk/{middleware-recursion-detection/dist-types/ts3.4 → core/dist-types/ts3.4/submodules/client/middleware-recursion-detection}/recursionDetectionMiddleware.native.d.ts +0 -0
  456. /package/node_modules/@aws-sdk/{middleware-user-agent/dist-types/ts3.4 → core/dist-types/ts3.4/submodules/client/middleware-user-agent}/check-features.d.ts +0 -0
  457. /package/node_modules/@aws-sdk/{middleware-user-agent/dist-types/ts3.4 → core/dist-types/ts3.4/submodules/client/middleware-user-agent}/configurations.d.ts +0 -0
  458. /package/node_modules/@aws-sdk/{middleware-user-agent/dist-types/ts3.4 → core/dist-types/ts3.4/submodules/client/middleware-user-agent}/constants.d.ts +0 -0
  459. /package/node_modules/@aws-sdk/{middleware-user-agent/dist-types/ts3.4 → core/dist-types/ts3.4/submodules/client/middleware-user-agent}/encode-features.d.ts +0 -0
  460. /package/node_modules/@aws-sdk/{middleware-user-agent/dist-types/ts3.4 → core/dist-types/ts3.4/submodules/client/middleware-user-agent}/user-agent-middleware.d.ts +0 -0
  461. /package/node_modules/@aws-sdk/{region-config-resolver/dist-types/ts3.4/regionConfig → core/dist-types/ts3.4/submodules/client/region-config-resolver}/awsRegionConfig.d.ts +0 -0
  462. /package/node_modules/@aws-sdk/{region-config-resolver/dist-types/ts3.4/extensions/index.d.ts → core/dist-types/ts3.4/submodules/client/region-config-resolver/extensions.d.ts} +0 -0
  463. /package/node_modules/@aws-sdk/{region-config-resolver/dist-types/ts3.4/regionConfig → core/dist-types/ts3.4/submodules/client/region-config-resolver}/stsRegionDefaultResolver.browser.d.ts +0 -0
  464. /package/node_modules/@aws-sdk/{region-config-resolver/dist-types/ts3.4/regionConfig → core/dist-types/ts3.4/submodules/client/region-config-resolver}/stsRegionDefaultResolver.d.ts +0 -0
  465. /package/node_modules/@aws-sdk/{region-config-resolver/dist-types/ts3.4/regionConfig → core/dist-types/ts3.4/submodules/client/region-config-resolver}/stsRegionDefaultResolver.native.d.ts +0 -0
  466. /package/node_modules/@aws-sdk/{util-endpoints/dist-types/ts3.4 → core/dist-types/ts3.4/submodules/client/util-endpoints}/aws.d.ts +0 -0
  467. /package/node_modules/@aws-sdk/{util-endpoints/dist-types/ts3.4 → core/dist-types/ts3.4/submodules/client/util-endpoints}/lib/aws/isVirtualHostableS3Bucket.d.ts +0 -0
  468. /package/node_modules/@aws-sdk/{util-endpoints/dist-types/ts3.4 → core/dist-types/ts3.4/submodules/client/util-endpoints}/lib/aws/parseArn.d.ts +0 -0
  469. /package/node_modules/@aws-sdk/{util-endpoints/dist-types/ts3.4 → core/dist-types/ts3.4/submodules/client/util-endpoints}/lib/aws/partition.d.ts +0 -0
  470. /package/node_modules/@aws-sdk/{util-endpoints/dist-types/ts3.4 → core/dist-types/ts3.4/submodules/client/util-endpoints}/lib/isIpAddress.d.ts +0 -0
  471. /package/node_modules/@aws-sdk/{util-endpoints/dist-types/ts3.4 → core/dist-types/ts3.4/submodules/client/util-endpoints}/resolveDefaultAwsRegionalEndpointsConfig.d.ts +0 -0
  472. /package/node_modules/@aws-sdk/{util-endpoints/dist-types/ts3.4 → core/dist-types/ts3.4/submodules/client/util-endpoints}/resolveEndpoint.d.ts +0 -0
  473. /package/node_modules/@aws-sdk/{util-endpoints/dist-types → core/dist-types/ts3.4/submodules/client/util-endpoints}/types/EndpointError.d.ts +0 -0
  474. /package/node_modules/@aws-sdk/{util-endpoints/dist-types/ts3.4 → core/dist-types/ts3.4/submodules/client/util-endpoints}/types/EndpointRuleObject.d.ts +0 -0
  475. /package/node_modules/@aws-sdk/{util-endpoints/dist-types → core/dist-types/ts3.4/submodules/client/util-endpoints}/types/ErrorRuleObject.d.ts +0 -0
  476. /package/node_modules/@aws-sdk/{util-endpoints/dist-types/ts3.4 → core/dist-types/ts3.4/submodules/client/util-endpoints}/types/RuleSetObject.d.ts +0 -0
  477. /package/node_modules/@aws-sdk/{util-endpoints/dist-types → core/dist-types/ts3.4/submodules/client/util-endpoints}/types/TreeRuleObject.d.ts +0 -0
  478. /package/node_modules/@aws-sdk/{util-endpoints/dist-types/ts3.4 → core/dist-types/ts3.4/submodules/client/util-endpoints}/types/shared.d.ts +0 -0
  479. /package/node_modules/@aws-sdk/{util-user-agent-browser/dist-types/ts3.4 → core/dist-types/ts3.4/submodules/client/util-user-agent-browser}/configurations.d.ts +0 -0
  480. /package/node_modules/@aws-sdk/{util-user-agent-browser/dist-types/ts3.4/index.d.ts → core/dist-types/ts3.4/submodules/client/util-user-agent-browser/defaultUserAgent.d.ts} +0 -0
  481. /package/node_modules/@aws-sdk/{util-user-agent-browser/dist-types/ts3.4/index.native.d.ts → core/dist-types/ts3.4/submodules/client/util-user-agent-browser/defaultUserAgent.native.d.ts} +0 -0
  482. /package/node_modules/@aws-sdk/{util-user-agent-node/dist-types/ts3.4 → core/dist-types/ts3.4/submodules/client/util-user-agent-node}/crt-availability.d.ts +0 -0
  483. /package/node_modules/@aws-sdk/{util-user-agent-node/dist-types/ts3.4 → core/dist-types/ts3.4/submodules/client/util-user-agent-node}/defaultUserAgent.d.ts +0 -0
  484. /package/node_modules/@aws-sdk/{util-user-agent-node/dist-types/ts3.4 → core/dist-types/ts3.4/submodules/client/util-user-agent-node}/getNodeModulesParentDirs.d.ts +0 -0
  485. /package/node_modules/@aws-sdk/{util-user-agent-node/dist-types/ts3.4 → core/dist-types/ts3.4/submodules/client/util-user-agent-node}/getRuntimeUserAgentPair.d.ts +0 -0
  486. /package/node_modules/@aws-sdk/{util-user-agent-node/dist-types/ts3.4 → core/dist-types/ts3.4/submodules/client/util-user-agent-node}/getSanitizedDevTypeScriptVersion.d.ts +0 -0
  487. /package/node_modules/@aws-sdk/{util-user-agent-node/dist-types/ts3.4 → core/dist-types/ts3.4/submodules/client/util-user-agent-node}/getSanitizedTypeScriptVersion.d.ts +0 -0
  488. /package/node_modules/@aws-sdk/{util-user-agent-node/dist-types/ts3.4 → core/dist-types/ts3.4/submodules/client/util-user-agent-node}/getTypeScriptUserAgentPair.d.ts +0 -0
  489. /package/node_modules/@aws-sdk/{util-user-agent-node/dist-types/ts3.4 → core/dist-types/ts3.4/submodules/client/util-user-agent-node}/is-crt-available.d.ts +0 -0
  490. /package/node_modules/@aws-sdk/{util-user-agent-node/dist-types/ts3.4 → core/dist-types/ts3.4/submodules/client/util-user-agent-node}/nodeAppIdConfigOptions.d.ts +0 -0
@@ -1,485 +1,748 @@
1
- import { promises as fs } from 'node:fs'
2
- import path from 'node:path'
3
- import { spawn } from 'node:child_process'
4
- import { resolveWorkspacePath, toWorkspaceRelative, assertSafeWorkspacePath, truncateText, splitLines, walkFiles } from '../utils/workspace.mjs'
5
- import { createTextDiff } from '../utils/text-diff.mjs'
6
- import { readProjectConfig, getActiveProject } from '../project-config.mjs'
7
- import {
8
- formatSkillActivation,
9
- loadSelectedGlobalSkills,
10
- loadSelectedProjectSkills,
11
- mergeSkills,
12
- readSkillResource,
13
- } from '../skills.mjs'
14
- import { getWorkspaceRoot, getToolWorkspaceRoot } from '../utils/workspace.mjs'
15
-
16
- // --- get_project_info ---
17
- export async function toolGetProjectInfo(_params, context) {
18
- const config = context?.project ? null : await readProjectConfig()
19
- const project = context?.project || getActiveProject(config)
20
- const workspaceRoot = context?.workspaceRoot || project?.path || getWorkspaceRoot()
21
-
22
- if (!project) {
23
- return {
24
- content: 'No active project is configured.',
25
- details: { project: null, workspaceRoot },
26
- }
27
- }
28
-
29
- return {
30
- content: [`Project: ${project.name}`, `Path: ${workspaceRoot}`, `ID: ${project.id}`].join('\n'),
31
- details: { project, workspaceRoot },
32
- }
33
- }
34
-
35
- // --- list_dir ---
36
- export async function toolListDir(params, context) {
37
- const dir = resolveWorkspacePath(params?.path || '.', context)
38
- await assertSafeWorkspacePath(dir, context)
39
-
40
- const entries = await fs.readdir(dir, { withFileTypes: true })
41
- const rows = await Promise.all(entries.map(async (entry) => {
42
- const fullPath = path.join(dir, entry.name)
43
- const stat = await fs.lstat(fullPath).catch(() => null)
44
- return {
45
- name: `${entry.name}${entry.isDirectory() ? '/' : ''}`,
46
- type: entry.isDirectory() ? 'directory' : stat?.isSymbolicLink() ? 'other' : entry.isFile() ? 'file' : 'other',
47
- size: stat?.size ?? 0,
48
- modified: stat?.mtime?.toISOString?.() ?? '',
49
- }
50
- }))
51
-
52
- rows.sort((a, b) => {
53
- if (a.type !== b.type) return a.type === 'directory' ? -1 : 1
54
- return a.name.localeCompare(b.name)
55
- })
56
-
57
- const content = rows.length
58
- ? rows.map((row) => `${row.type.padEnd(9)} ${String(row.size).padStart(10)} ${row.modified} ${row.name}`).join('\n')
59
- : '(empty directory)'
60
-
61
- return { content, details: { path: toWorkspaceRelative(dir, context), project: context?.project, count: rows.length } }
62
- }
63
-
64
- // --- read_file ---
65
- export async function toolReadFile(params, context) {
66
- const file = resolveWorkspacePath(params?.path, context)
67
- await assertSafeWorkspacePath(file, context)
68
-
69
- const text = await fs.readFile(file, 'utf8')
70
- const lines = splitLines(text)
71
- const offset = Math.max(1, Number(params?.offset || 1))
72
- const limit = Math.min(2000, Math.max(1, Number(params?.limit || 200)))
73
- const selected = lines.slice(offset - 1, offset - 1 + limit)
74
- const content = selected.map((line, index) => `${offset + index}: ${line}`).join('\n')
75
- const suffix = offset - 1 + limit < lines.length ? `\n\n[showing ${selected.length} of ${lines.length} lines]` : ''
76
-
77
- return {
78
- content: truncateText(`${content}${suffix}`),
79
- details: { path: toWorkspaceRelative(file, context), project: context?.project, totalLines: lines.length, offset, limit },
80
- }
81
- }
82
-
83
- // --- grep_files ---
84
-
85
- /**
86
- * Process items with bounded concurrency. Returns results in input order.
87
- * @template T, R
88
- * @param {T[]} items
89
- * @param {(item: T, index: number) => Promise<R>} fn
90
- * @param {number} concurrency
91
- * @returns {Promise<R[]>}
92
- */
93
- async function poolMap(items, fn, concurrency = 20) {
94
- const results = new Array(items.length)
95
- let cursor = 0
96
-
97
- async function worker() {
98
- while (cursor < items.length) {
99
- const index = cursor++
100
- results[index] = await fn(items[index], index)
101
- }
102
- }
103
-
104
- const workers = Array.from({ length: Math.min(concurrency, items.length) }, () => worker())
105
- await Promise.all(workers)
106
- return results
107
- }
108
-
109
- export async function toolGrepFiles(params, context) {
110
- const root = resolveWorkspacePath(params?.path || '.', context)
111
- await assertSafeWorkspacePath(root, context)
112
-
113
- const query = String(params?.query || '')
114
- if (!query) {
115
- const error = new Error('query is required')
116
- error.statusCode = 400
117
- throw error
118
- }
119
-
120
- const limit = Math.min(1000, Math.max(1, Number(params?.limit || 200)))
121
- const flags = params?.caseSensitive ? 'g' : 'gi'
122
- let matcher
123
- try {
124
- matcher = params?.regex
125
- ? new RegExp(query, flags)
126
- : new RegExp(query.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), flags)
127
- } catch {
128
- const error = new Error('Invalid regular expression')
129
- error.statusCode = 400
130
- throw error
131
- }
132
-
133
- const files = await walkFiles(root, [], context)
134
- const matches = []
135
-
136
- // Stat and filter files in parallel, then grep in parallel batches
137
- const candidateResults = await poolMap(files, async (file) => {
138
- try {
139
- const stat = await fs.stat(file)
140
- if (stat.size > 1024 * 1024) return { file, skip: true }
141
- return { file, skip: false }
142
- } catch {
143
- return { file, skip: true }
144
- }
145
- })
146
-
147
- const candidates = candidateResults.filter((r) => !r.skip).map((r) => r.file)
148
-
149
- // Grep with bounded concurrency — short-circuit when limit reached
150
- let matchCount = 0
151
- for (let batchStart = 0; batchStart < candidates.length && matchCount < limit; batchStart += 20) {
152
- const batch = candidates.slice(batchStart, batchStart + 20)
153
- const batchMatches = await Promise.all(
154
- batch.map(async (file) => {
155
- if (matchCount >= limit) return []
156
- try {
157
- const text = await fs.readFile(file, 'utf8')
158
- const lines = splitLines(text)
159
- const fileMatches = []
160
- for (let index = 0; index < lines.length && (matchCount + fileMatches.length) < limit; index++) {
161
- matcher.lastIndex = 0
162
- if (matcher.test(lines[index])) {
163
- fileMatches.push(`${toWorkspaceRelative(file, context)}:${index + 1}: ${lines[index]}`)
164
- }
165
- }
166
- return fileMatches
167
- } catch {
168
- return []
169
- }
170
- }),
171
- )
172
- for (const fm of batchMatches) {
173
- if (matchCount >= limit) break
174
- for (const m of fm) {
175
- if (matchCount >= limit) break
176
- matches.push(m)
177
- matchCount++
178
- }
179
- }
180
- }
181
-
182
- return {
183
- content: matches.length ? truncateText(matches.join('\n')) : 'No matches found.',
184
- details: { path: toWorkspaceRelative(root, context), project: context?.project, query, count: matches.length, limit },
185
- }
186
- }
187
-
188
- // --- write_file ---
189
- export async function toolWriteFile(params, context) {
190
- const file = resolveWorkspacePath(params?.path, context)
191
- await assertSafeWorkspacePath(file, context, { forWrite: true })
192
-
193
- const content = String(params?.content ?? '')
194
- const relativePath = toWorkspaceRelative(file, context)
195
- let oldText = ''
196
- let existed = true
197
- try {
198
- oldText = await fs.readFile(file, 'utf8')
199
- } catch (error) {
200
- if (error?.code !== 'ENOENT') throw error
201
- existed = false
202
- }
203
- const diff = createTextDiff(oldText, content, relativePath, { oldExists: existed })
204
-
205
- await fs.mkdir(path.dirname(file), { recursive: true })
206
- await fs.writeFile(file, content, 'utf8')
207
-
208
- return {
209
- content: `${existed ? 'Wrote' : 'Created'} ${relativePath} (+${diff.addedLines} -${diff.removedLines})`,
210
- details: { path: relativePath, project: context?.project, bytes: Buffer.byteLength(content, 'utf8'), created: !existed, diff },
211
- }
212
- }
213
-
214
- // --- edit_file ---
215
- function countOccurrences(text, needle) {
216
- if (!needle) return 0
217
- let count = 0
218
- let index = 0
219
- while ((index = text.indexOf(needle, index)) !== -1) {
220
- count++
221
- index += needle.length
222
- }
223
- return count
224
- }
225
-
226
- export async function toolEditFile(params, context) {
227
- const file = resolveWorkspacePath(params?.path, context)
228
- await assertSafeWorkspacePath(file, context)
229
-
230
- const oldText = String(params?.oldText ?? '')
231
- const newText = String(params?.newText ?? '')
232
- const text = await fs.readFile(file, 'utf8')
233
- const count = countOccurrences(text, oldText)
234
-
235
- if (count !== 1) {
236
- const error = new Error(`oldText must match exactly once; found ${count} matches`)
237
- error.statusCode = 400
238
- throw error
239
- }
240
-
241
- const nextText = text.replace(oldText, newText)
242
- const relativePath = toWorkspaceRelative(file, context)
243
- const diff = createTextDiff(text, nextText, relativePath)
244
-
245
- await fs.writeFile(file, nextText, 'utf8')
246
-
247
- return {
248
- content: `Edited ${relativePath} (+${diff.addedLines} -${diff.removedLines})`,
249
- details: { path: relativePath, project: context?.project, replaced: count, diff },
250
- }
251
- }
252
-
253
- // --- run_command ---
254
- function activeSkillsForContext(context) {
255
- return mergeSkills(context?.globalSkills, context?.projectSkills)
256
- }
257
-
258
- function activeSkillByName(context, name) {
259
- const skillName = String(name || '')
260
- return activeSkillsForContext(context).find((skill) => skill.name === skillName)
261
- }
262
-
263
- export async function loadSkillToolContext(config = {}) {
264
- const globalSkills = await loadSelectedGlobalSkills(config.globalSkillNames)
265
- const projectSkills = config.workspaceRoot
266
- ? await loadSelectedProjectSkills(config.projectSkillNames, config.workspaceRoot)
267
- : []
268
- return { globalSkills, projectSkills }
269
- }
270
-
271
- // --- activate_skill ---
272
- export async function toolActivateSkill(params, context) {
273
- const skill = activeSkillByName(context, params?.name)
274
- if (!skill) {
275
- const error = new Error(`Unknown or disabled skill: ${params?.name || ''}`)
276
- error.statusCode = 404
277
- throw error
278
- }
279
-
280
- return {
281
- content: truncateText(await formatSkillActivation(skill)),
282
- details: {
283
- skill: skill.name,
284
- source: skill.source,
285
- directory: skill.rootDir,
286
- },
287
- }
288
- }
289
-
290
- // --- read_skill_resource ---
291
- export async function toolReadSkillResource(params, context) {
292
- const skill = activeSkillByName(context, params?.skill)
293
- if (!skill) {
294
- const error = new Error(`Unknown or disabled skill: ${params?.skill || ''}`)
295
- error.statusCode = 404
296
- throw error
297
- }
298
-
299
- const result = await readSkillResource(skill, params?.path, params)
300
- return {
301
- content: truncateText(result.content),
302
- details: result.details,
303
- }
304
- }
305
-
306
- // --- run_command ---
307
- function commandStatus(meta = {}) {
308
- if (meta.running) return 'Status: running'
309
- const flags = [
310
- meta.timedOut ? 'timed out' : null,
311
- meta.aborted ? 'aborted' : null,
312
- ].filter(Boolean)
313
- const suffix = flags.length ? ` (${flags.join(', ')})` : ''
314
- return `Exit code: ${meta.code ?? 'unknown'}${meta.signal ? `, signal: ${meta.signal}` : ''}${suffix}`
315
- }
316
-
317
- function formatCommandOutput(command, stdout, stderr, meta = {}) {
318
- return [
319
- `Command: ${command}`,
320
- commandStatus(meta),
321
- '',
322
- 'STDOUT:',
323
- stdout || '(empty)',
324
- '',
325
- 'STDERR:',
326
- stderr || '(empty)',
327
- ].join('\n')
328
- }
329
-
330
- function killProcessTree(child, signal = 'SIGTERM') {
331
- if (!child?.pid) return
332
-
333
- if (process.platform === 'win32') {
334
- const killer = spawn('taskkill', ['/pid', String(child.pid), '/T', '/F'], {
335
- stdio: 'ignore',
336
- windowsHide: true,
337
- })
338
- killer.on('error', () => {
339
- try { child.kill(signal) } catch { /* ignore */ }
340
- })
341
- return
342
- }
343
-
344
- try {
345
- process.kill(-child.pid, signal)
346
- } catch {
347
- try { child.kill(signal) } catch { /* ignore */ }
348
- }
349
- }
350
-
351
- export async function toolRunCommand(params, context, runtime = {}) {
352
- const command = String(params?.command || '')
353
- if (!command.trim()) {
354
- const error = new Error('command is required')
355
- error.statusCode = 400
356
- throw error
357
- }
358
-
359
- const timeoutMs = Math.min(10 * 60, Math.max(1, Number(params?.timeoutSeconds || 60))) * 1000
360
- const cwd = getToolWorkspaceRoot(context)
361
-
362
- if (runtime.signal?.aborted) {
363
- const content = formatCommandOutput(command, '', 'Command aborted before start.', { aborted: true })
364
- return { content: truncateText(content), details: { command, project: context?.project, cwd, aborted: true } }
365
- }
366
-
367
- return new Promise((resolve) => {
368
- const child = spawn(command, {
369
- cwd,
370
- shell: true,
371
- stdio: ['ignore', 'pipe', 'pipe'],
372
- windowsHide: true,
373
- detached: process.platform !== 'win32',
374
- })
375
-
376
- let stdout = ''
377
- let stderr = ''
378
- let timedOut = false
379
- let aborted = false
380
- let settled = false
381
- let updateTimer = null
382
- let updatePending = false
383
- let forceKillTimer = null
384
-
385
- const cleanup = () => {
386
- clearTimeout(timer)
387
- if (forceKillTimer) clearTimeout(forceKillTimer)
388
- if (updateTimer) clearTimeout(updateTimer)
389
- runtime.signal?.removeEventListener?.('abort', onAbort)
390
- }
391
-
392
- const finish = ({ code = null, signal = null, error = null } = {}) => {
393
- if (settled) return
394
- flushUpdate()
395
- settled = true
396
- cleanup()
397
- if (error) {
398
- resolve({
399
- isError: true,
400
- content: truncateText(`Error running command: ${error.message}`),
401
- details: { command, project: context?.project, cwd, error: error.message, aborted, timedOut },
402
- })
403
- return
404
- }
405
- const content = formatCommandOutput(command, stdout, stderr, { code, signal, timedOut, aborted })
406
- resolve({ content: truncateText(content), details: { command, project: context?.project, cwd, code, signal, timedOut, aborted } })
407
- }
408
-
409
- const stopChild = (reason) => {
410
- if (reason === 'timeout') timedOut = true
411
- if (reason === 'abort') aborted = true
412
- killProcessTree(child, 'SIGTERM')
413
- forceKillTimer = setTimeout(() => {
414
- killProcessTree(child, 'SIGKILL')
415
- }, 1500)
416
- }
417
-
418
- function onAbort() {
419
- stopChild('abort')
420
- finish({ signal: 'SIGTERM' })
421
- }
422
-
423
- const emitUpdate = () => {
424
- updateTimer = null
425
- if (settled || !updatePending) return
426
- updatePending = false
427
- runtime.onUpdate?.({
428
- content: [{ type: 'text', text: truncateText(formatCommandOutput(command, stdout, stderr, { running: true })) }],
429
- details: { command, project: context?.project, cwd, running: true, stdout, stderr },
430
- })
431
- }
432
- const flushUpdate = () => {
433
- if (updateTimer) {
434
- clearTimeout(updateTimer)
435
- updateTimer = null
436
- }
437
- if (!updatePending) return
438
- updatePending = false
439
- runtime.onUpdate?.({
440
- content: [{ type: 'text', text: truncateText(formatCommandOutput(command, stdout, stderr, { running: true })) }],
441
- details: { command, project: context?.project, cwd, running: true, stdout, stderr },
442
- })
443
- }
444
- const scheduleUpdate = () => {
445
- if (settled) return
446
- updatePending = true
447
- if (!updateTimer) updateTimer = setTimeout(emitUpdate, 150)
448
- }
449
- const timer = setTimeout(() => {
450
- stopChild('timeout')
451
- finish({ signal: 'SIGTERM' })
452
- }, timeoutMs)
453
-
454
- runtime.signal?.addEventListener?.('abort', onAbort, { once: true })
455
-
456
- child.stdout.on('data', (chunk) => {
457
- if (settled) return
458
- stdout = truncateText(stdout + chunk.toString())
459
- scheduleUpdate()
460
- })
461
- child.stderr.on('data', (chunk) => {
462
- if (settled) return
463
- stderr = truncateText(stderr + chunk.toString())
464
- scheduleUpdate()
465
- })
466
- child.on('close', (code, signal) => {
467
- finish({ code, signal })
468
- })
469
- child.on('error', (err) => {
470
- finish({ error: err })
471
- })
472
- })
473
- }
474
-
475
- export const toolHandlers = {
476
- get_project_info: toolGetProjectInfo,
477
- list_dir: toolListDir,
478
- read_file: toolReadFile,
479
- grep_files: toolGrepFiles,
480
- write_file: toolWriteFile,
481
- edit_file: toolEditFile,
482
- run_command: toolRunCommand,
483
- activate_skill: toolActivateSkill,
484
- read_skill_resource: toolReadSkillResource,
485
- }
1
+ import { promises as fs } from 'node:fs'
2
+ import path from 'node:path'
3
+ import { spawn } from 'node:child_process'
4
+ import { createRequire } from 'node:module'
5
+ import { resolveWorkspacePath, toWorkspaceRelative, assertSafeWorkspacePath, truncateText, splitLines, walkFiles } from '../utils/workspace.mjs'
6
+ import { createTextDiff } from '../utils/text-diff.mjs'
7
+ import {
8
+ formatSkillActivation,
9
+ loadSelectedGlobalSkills,
10
+ loadSelectedProjectSkills,
11
+ mergeSkills,
12
+ readSkillResource,
13
+ } from '../skills.mjs'
14
+ import { getToolWorkspaceRoot } from '../utils/workspace.mjs'
15
+
16
+ const require = createRequire(import.meta.url)
17
+
18
+ // --- read_file ---
19
+ export async function toolReadFile(params, context) {
20
+ const file = resolveWorkspacePath(params?.path, context)
21
+ await assertSafeWorkspacePath(file, context)
22
+
23
+ const text = await fs.readFile(file, 'utf8')
24
+ const lines = splitLines(text)
25
+ const offset = Math.max(1, Number(params?.offset || 1))
26
+ const limit = Math.min(2000, Math.max(1, Number(params?.limit || 200)))
27
+ const selected = lines.slice(offset - 1, offset - 1 + limit)
28
+ const content = selected.map((line, index) => `${offset + index}: ${line}`).join('\n')
29
+ const suffix = offset - 1 + limit < lines.length ? `\n\n[showing ${selected.length} of ${lines.length} lines]` : ''
30
+
31
+ return {
32
+ content: truncateText(`${content}${suffix}`),
33
+ details: { path: toWorkspaceRelative(file, context), project: context?.project, totalLines: lines.length, offset, limit },
34
+ }
35
+ }
36
+
37
+ // --- grep_files ---
38
+
39
+ const RIPGREP_MAX_FILESIZE = '1M'
40
+ const RIPGREP_TIMEOUT_MS = 60 * 1000
41
+ const DEFAULT_EXCLUDE_GLOBS = [
42
+ '!.git/**',
43
+ '!node_modules/**',
44
+ '!dist/**',
45
+ '!dist-ssr/**',
46
+ '!.vite/**',
47
+ '!**/*.png',
48
+ '!**/*.jpg',
49
+ '!**/*.jpeg',
50
+ '!**/*.gif',
51
+ '!**/*.webp',
52
+ '!**/*.ico',
53
+ '!**/*.pdf',
54
+ '!**/*.zip',
55
+ '!**/*.gz',
56
+ '!**/*.7z',
57
+ '!**/*.exe',
58
+ '!**/*.dll',
59
+ '!**/*.woff',
60
+ '!**/*.woff2',
61
+ '!**/*.ttf',
62
+ ]
63
+ const SENSITIVE_EXCLUDE_GLOBS = [
64
+ '!.env',
65
+ '!**/.env',
66
+ '!.env.*',
67
+ '!**/.env.*',
68
+ '!**/*.pem',
69
+ '!**/*.key',
70
+ '!**/*.p12',
71
+ '!**/*.pfx',
72
+ '!**/*.crt',
73
+ '!**/*.cer',
74
+ '!**/*.token',
75
+ '!credentials.json',
76
+ '!**/credentials.json',
77
+ '!secrets.json',
78
+ '!**/secrets.json',
79
+ '!id_rsa',
80
+ '!**/id_rsa',
81
+ '!id_ed25519',
82
+ '!**/id_ed25519',
83
+ ]
84
+
85
+ let cachedRipgrepExecutable
86
+
87
+ /**
88
+ * Process items with bounded concurrency. Returns results in input order.
89
+ * @template T, R
90
+ * @param {T[]} items
91
+ * @param {(item: T, index: number) => Promise<R>} fn
92
+ * @param {number} concurrency
93
+ * @returns {Promise<R[]>}
94
+ */
95
+ async function poolMap(items, fn, concurrency = 20) {
96
+ const results = new Array(items.length)
97
+ let cursor = 0
98
+
99
+ async function worker() {
100
+ while (cursor < items.length) {
101
+ const index = cursor++
102
+ results[index] = await fn(items[index], index)
103
+ }
104
+ }
105
+
106
+ const workers = Array.from({ length: Math.min(concurrency, items.length) }, () => worker())
107
+ await Promise.all(workers)
108
+ return results
109
+ }
110
+
111
+ function clampNumber(value, defaultValue, min, max) {
112
+ const number = Number(value)
113
+ if (!Number.isFinite(number)) return defaultValue
114
+ return Math.min(max, Math.max(min, Math.trunc(number)))
115
+ }
116
+
117
+ function escapeRegExp(value) {
118
+ return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
119
+ }
120
+
121
+ function normalizeGlobList(value) {
122
+ const values = Array.isArray(value) ? value : typeof value === 'string' ? [value] : []
123
+ return values
124
+ .map((item) => String(item || '').trim())
125
+ .filter(Boolean)
126
+ .slice(0, 50)
127
+ }
128
+
129
+ function normalizeGrepParams(params, context) {
130
+ const root = resolveWorkspacePath(params?.path || '.', context)
131
+ const query = String(params?.query || '')
132
+ if (!query) {
133
+ const error = new Error('query is required')
134
+ error.statusCode = 400
135
+ throw error
136
+ }
137
+
138
+ const flags = params?.caseSensitive ? 'g' : 'gi'
139
+ try {
140
+ params?.regex
141
+ ? new RegExp(query, flags)
142
+ : new RegExp(escapeRegExp(query), flags)
143
+ } catch {
144
+ const error = new Error('Invalid regular expression')
145
+ error.statusCode = 400
146
+ throw error
147
+ }
148
+
149
+ return {
150
+ root,
151
+ query,
152
+ regex: Boolean(params?.regex),
153
+ caseSensitive: Boolean(params?.caseSensitive),
154
+ limit: clampNumber(params?.limit, 200, 1, 1000),
155
+ glob: normalizeGlobList(params?.glob),
156
+ context: clampNumber(params?.context, 0, 0, 20),
157
+ beforeContext: clampNumber(params?.beforeContext, 0, 0, 20),
158
+ afterContext: clampNumber(params?.afterContext, 0, 0, 20),
159
+ filesWithMatches: Boolean(params?.filesWithMatches),
160
+ respectGitIgnore: Boolean(params?.respectGitIgnore),
161
+ }
162
+ }
163
+
164
+ function isRegexLikelyRipgrepCompatible(query) {
165
+ return !(/\(\?[=!<]/.test(query) || /\\[1-9]/.test(query))
166
+ }
167
+
168
+ function ripgrepCandidatePath() {
169
+ try {
170
+ return require('@vscode/ripgrep').rgPath || null
171
+ } catch {
172
+ return null
173
+ }
174
+ }
175
+
176
+ async function verifyRipgrepExecutable(command) {
177
+ return new Promise((resolve) => {
178
+ const child = spawn(command, ['--version'], { shell: false, windowsHide: true })
179
+ child.once('error', () => resolve(false))
180
+ child.once('close', (code) => resolve(code === 0))
181
+ })
182
+ }
183
+
184
+ async function resolveRipgrepExecutable() {
185
+ if (cachedRipgrepExecutable !== undefined) return cachedRipgrepExecutable
186
+
187
+ const bundled = ripgrepCandidatePath()
188
+ if (bundled && await verifyRipgrepExecutable(bundled)) {
189
+ cachedRipgrepExecutable = { command: bundled, source: 'bundled' }
190
+ return cachedRipgrepExecutable
191
+ }
192
+
193
+ if (await verifyRipgrepExecutable('rg')) {
194
+ cachedRipgrepExecutable = { command: 'rg', source: 'system' }
195
+ return cachedRipgrepExecutable
196
+ }
197
+
198
+ cachedRipgrepExecutable = null
199
+ return cachedRipgrepExecutable
200
+ }
201
+
202
+ function buildRipgrepArgs(options, context) {
203
+ const args = [
204
+ '--line-number',
205
+ '--color=never',
206
+ '--max-filesize',
207
+ RIPGREP_MAX_FILESIZE,
208
+ ]
209
+
210
+ if (options.filesWithMatches) {
211
+ args.push('--files-with-matches')
212
+ } else {
213
+ args.push('--json')
214
+ }
215
+ if (!options.regex) args.push('--fixed-strings')
216
+ if (!options.caseSensitive) args.push('--ignore-case')
217
+ if (!options.respectGitIgnore) args.push('--hidden', '--no-ignore')
218
+ if (options.context > 0) args.push('-C', String(options.context))
219
+ if (options.beforeContext > 0) args.push('-B', String(options.beforeContext))
220
+ if (options.afterContext > 0) args.push('-A', String(options.afterContext))
221
+
222
+ for (const pattern of options.glob) args.push('--glob', pattern)
223
+ for (const pattern of DEFAULT_EXCLUDE_GLOBS) args.push('--glob', pattern)
224
+ for (const pattern of SENSITIVE_EXCLUDE_GLOBS) args.push('--glob', pattern)
225
+
226
+ args.push('--', options.query, toWorkspaceRelative(options.root, context) || '.')
227
+ return args
228
+ }
229
+
230
+ function cleanRipgrepLine(value) {
231
+ return String(value || '').replace(/[\r\n]+$/, '')
232
+ }
233
+
234
+ function ripgrepRelativePath(value) {
235
+ return String(value || '').replace(/\\/g, '/')
236
+ }
237
+
238
+ function formatRipgrepJsonEvent(event) {
239
+ if (event?.type !== 'match' && event?.type !== 'context') return null
240
+ const data = event.data || {}
241
+ const file = ripgrepRelativePath(data.path?.text)
242
+ const lineNumber = data.line_number
243
+ const line = cleanRipgrepLine(data.lines?.text)
244
+ if (!file || !lineNumber) return null
245
+ const separator = event.type === 'match' ? ':' : '-'
246
+ return `${file}:${lineNumber}${separator} ${line}`
247
+ }
248
+
249
+ function fallbackDetails(extra = {}) {
250
+ return Object.fromEntries(Object.entries(extra).filter(([, value]) => value !== undefined && value !== null && value !== ''))
251
+ }
252
+
253
+ async function grepFilesWithRipgrep(executable, options, context, runtime = {}) {
254
+ if (options.regex && !isRegexLikelyRipgrepCompatible(options.query)) {
255
+ throw new Error('regex uses JavaScript-only features that ripgrep does not support')
256
+ }
257
+
258
+ const cwd = getToolWorkspaceRoot(context)
259
+ const args = buildRipgrepArgs(options, context)
260
+ const matches = []
261
+ let stderr = ''
262
+ let buffer = ''
263
+ let killedForLimit = false
264
+ let settled = false
265
+
266
+ await new Promise((resolve, reject) => {
267
+ if (runtime.signal?.aborted) {
268
+ reject(new Error('Search aborted'))
269
+ return
270
+ }
271
+
272
+ const child = spawn(executable.command, args, {
273
+ cwd,
274
+ shell: false,
275
+ stdio: ['ignore', 'pipe', 'pipe'],
276
+ windowsHide: true,
277
+ })
278
+
279
+ const cleanup = () => {
280
+ clearTimeout(timer)
281
+ runtime.signal?.removeEventListener?.('abort', onAbort)
282
+ }
283
+ const finish = (error) => {
284
+ if (settled) return
285
+ settled = true
286
+ cleanup()
287
+ if (error) reject(error)
288
+ else resolve()
289
+ }
290
+ const stopForLimit = () => {
291
+ if (killedForLimit) return
292
+ killedForLimit = true
293
+ killProcessTree(child, 'SIGTERM')
294
+ }
295
+ const processLine = (line) => {
296
+ if (!line || matches.length >= options.limit) return
297
+ if (options.filesWithMatches) {
298
+ matches.push(ripgrepRelativePath(line))
299
+ } else {
300
+ try {
301
+ const formatted = formatRipgrepJsonEvent(JSON.parse(line))
302
+ if (formatted) matches.push(formatted)
303
+ } catch {
304
+ // Ignore malformed partial output and let process exit handling decide fallback.
305
+ }
306
+ }
307
+ if (matches.length >= options.limit) stopForLimit()
308
+ }
309
+ const flushLines = (chunk) => {
310
+ buffer += chunk.toString()
311
+ const lines = buffer.split(/\r?\n/)
312
+ buffer = lines.pop() || ''
313
+ for (const line of lines) processLine(line)
314
+ }
315
+ function onAbort() {
316
+ killProcessTree(child, 'SIGTERM')
317
+ finish(new Error('Search aborted'))
318
+ }
319
+
320
+ const timer = setTimeout(() => {
321
+ killProcessTree(child, 'SIGTERM')
322
+ finish(new Error('ripgrep search timed out'))
323
+ }, RIPGREP_TIMEOUT_MS)
324
+
325
+ runtime.signal?.addEventListener?.('abort', onAbort, { once: true })
326
+ child.stdout.on('data', flushLines)
327
+ child.stderr.on('data', (chunk) => {
328
+ stderr = truncateText(stderr + chunk.toString(), 2000)
329
+ })
330
+ child.once('error', finish)
331
+ child.once('close', (code) => {
332
+ if (buffer) processLine(buffer)
333
+ if (killedForLimit || code === 0 || code === 1) {
334
+ finish()
335
+ } else {
336
+ finish(new Error(stderr.trim() || `ripgrep exited with code ${code}`))
337
+ }
338
+ })
339
+ })
340
+
341
+ return {
342
+ content: matches.length ? truncateText(matches.slice(0, options.limit).join('\n')) : 'No matches found.',
343
+ details: {
344
+ path: toWorkspaceRelative(options.root, context),
345
+ project: context?.project,
346
+ query: options.query,
347
+ count: matches.length,
348
+ limit: options.limit,
349
+ backend: 'ripgrep',
350
+ ripgrepSource: executable.source,
351
+ },
352
+ }
353
+ }
354
+
355
+ async function grepFilesWithNode(options, context, extraDetails = {}) {
356
+ const flags = options.caseSensitive ? 'g' : 'gi'
357
+ const matcher = options.regex
358
+ ? new RegExp(options.query, flags)
359
+ : new RegExp(escapeRegExp(options.query), flags)
360
+
361
+ const files = await walkFiles(options.root, [], context)
362
+ const matches = []
363
+
364
+ // Stat and filter files in parallel, then grep in parallel batches.
365
+ const candidateResults = await poolMap(files, async (file) => {
366
+ try {
367
+ const stat = await fs.stat(file)
368
+ if (stat.size > 1024 * 1024) return { file, skip: true }
369
+ return { file, skip: false }
370
+ } catch {
371
+ return { file, skip: true }
372
+ }
373
+ })
374
+
375
+ const candidates = candidateResults.filter((r) => !r.skip).map((r) => r.file)
376
+
377
+ // Grep with bounded concurrency — short-circuit when limit reached.
378
+ let matchCount = 0
379
+ const filesWithMatches = new Set()
380
+ for (let batchStart = 0; batchStart < candidates.length && matchCount < options.limit; batchStart += 20) {
381
+ const batch = candidates.slice(batchStart, batchStart + 20)
382
+ const batchMatches = await Promise.all(
383
+ batch.map(async (file) => {
384
+ if (matchCount >= options.limit) return []
385
+ try {
386
+ const text = await fs.readFile(file, 'utf8')
387
+ const lines = splitLines(text)
388
+ const fileMatches = []
389
+ for (let index = 0; index < lines.length && (matchCount + fileMatches.length) < options.limit; index++) {
390
+ matcher.lastIndex = 0
391
+ if (matcher.test(lines[index])) {
392
+ const relative = toWorkspaceRelative(file, context)
393
+ if (options.filesWithMatches) {
394
+ if (!filesWithMatches.has(relative)) {
395
+ filesWithMatches.add(relative)
396
+ fileMatches.push(relative)
397
+ }
398
+ } else {
399
+ fileMatches.push(`${relative}:${index + 1}: ${lines[index]}`)
400
+ }
401
+ }
402
+ }
403
+ return fileMatches
404
+ } catch {
405
+ return []
406
+ }
407
+ }),
408
+ )
409
+ for (const fm of batchMatches) {
410
+ if (matchCount >= options.limit) break
411
+ for (const m of fm) {
412
+ if (matchCount >= options.limit) break
413
+ matches.push(m)
414
+ matchCount++
415
+ }
416
+ }
417
+ }
418
+
419
+ return {
420
+ content: matches.length ? truncateText(matches.join('\n')) : 'No matches found.',
421
+ details: {
422
+ path: toWorkspaceRelative(options.root, context),
423
+ project: context?.project,
424
+ query: options.query,
425
+ count: matches.length,
426
+ limit: options.limit,
427
+ backend: 'node',
428
+ ...fallbackDetails(extraDetails),
429
+ },
430
+ }
431
+ }
432
+
433
+ export async function toolGrepFiles(params, context, runtime = {}) {
434
+ const options = normalizeGrepParams(params, context)
435
+ await assertSafeWorkspacePath(options.root, context)
436
+
437
+ const executable = await resolveRipgrepExecutable()
438
+ if (executable) {
439
+ try {
440
+ return await grepFilesWithRipgrep(executable, options, context, runtime)
441
+ } catch (error) {
442
+ if (runtime.signal?.aborted) throw error
443
+ return grepFilesWithNode(options, context, {
444
+ fallbackFrom: 'ripgrep',
445
+ fallbackReason: error?.message || 'ripgrep unavailable',
446
+ })
447
+ }
448
+ }
449
+
450
+ return grepFilesWithNode(options, context, { fallbackReason: 'ripgrep unavailable' })
451
+ }
452
+
453
+ // --- write_file ---
454
+ export async function toolWriteFile(params, context) {
455
+ const file = resolveWorkspacePath(params?.path, context)
456
+ await assertSafeWorkspacePath(file, context, { forWrite: true })
457
+
458
+ const content = String(params?.content ?? '')
459
+ const relativePath = toWorkspaceRelative(file, context)
460
+ let oldText = ''
461
+ let existed = true
462
+ try {
463
+ oldText = await fs.readFile(file, 'utf8')
464
+ } catch (error) {
465
+ if (error?.code !== 'ENOENT') throw error
466
+ existed = false
467
+ }
468
+ const diff = createTextDiff(oldText, content, relativePath, { oldExists: existed })
469
+
470
+ await fs.mkdir(path.dirname(file), { recursive: true })
471
+ await fs.writeFile(file, content, 'utf8')
472
+
473
+ return {
474
+ content: `${existed ? 'Wrote' : 'Created'} ${relativePath} (+${diff.addedLines} -${diff.removedLines})`,
475
+ details: { path: relativePath, project: context?.project, bytes: Buffer.byteLength(content, 'utf8'), created: !existed, diff },
476
+ }
477
+ }
478
+
479
+ // --- edit_file ---
480
+ function countOccurrences(text, needle) {
481
+ if (!needle) return 0
482
+ let count = 0
483
+ let index = 0
484
+ while ((index = text.indexOf(needle, index)) !== -1) {
485
+ count++
486
+ index += needle.length
487
+ }
488
+ return count
489
+ }
490
+
491
+ export async function toolEditFile(params, context) {
492
+ const file = resolveWorkspacePath(params?.path, context)
493
+ await assertSafeWorkspacePath(file, context)
494
+
495
+ const oldText = String(params?.oldText ?? '')
496
+ const newText = String(params?.newText ?? '')
497
+ const text = await fs.readFile(file, 'utf8')
498
+ const count = countOccurrences(text, oldText)
499
+
500
+ if (count !== 1) {
501
+ const error = new Error(`oldText must match exactly once; found ${count} matches`)
502
+ error.statusCode = 400
503
+ throw error
504
+ }
505
+
506
+ const nextText = text.replace(oldText, newText)
507
+ const relativePath = toWorkspaceRelative(file, context)
508
+ const diff = createTextDiff(text, nextText, relativePath)
509
+
510
+ await fs.writeFile(file, nextText, 'utf8')
511
+
512
+ return {
513
+ content: `Edited ${relativePath} (+${diff.addedLines} -${diff.removedLines})`,
514
+ details: { path: relativePath, project: context?.project, replaced: count, diff },
515
+ }
516
+ }
517
+
518
+ // --- run_command ---
519
+ function activeSkillsForContext(context) {
520
+ return mergeSkills(context?.globalSkills, context?.projectSkills)
521
+ }
522
+
523
+ function activeSkillByName(context, name) {
524
+ const skillName = String(name || '')
525
+ return activeSkillsForContext(context).find((skill) => skill.name === skillName)
526
+ }
527
+
528
+ export async function loadSkillToolContext(config = {}) {
529
+ const globalSkills = await loadSelectedGlobalSkills(config.globalSkillNames)
530
+ const projectSkills = config.workspaceRoot
531
+ ? await loadSelectedProjectSkills(config.projectSkillNames, config.workspaceRoot)
532
+ : []
533
+ return { globalSkills, projectSkills }
534
+ }
535
+
536
+ // --- activate_skill ---
537
+ export async function toolActivateSkill(params, context) {
538
+ const skill = activeSkillByName(context, params?.name)
539
+ if (!skill) {
540
+ const error = new Error(`Unknown or disabled skill: ${params?.name || ''}`)
541
+ error.statusCode = 404
542
+ throw error
543
+ }
544
+
545
+ return {
546
+ content: truncateText(await formatSkillActivation(skill)),
547
+ details: {
548
+ skill: skill.name,
549
+ source: skill.source,
550
+ directory: skill.rootDir,
551
+ },
552
+ }
553
+ }
554
+
555
+ // --- read_skill_resource ---
556
+ export async function toolReadSkillResource(params, context) {
557
+ const skill = activeSkillByName(context, params?.skill)
558
+ if (!skill) {
559
+ const error = new Error(`Unknown or disabled skill: ${params?.skill || ''}`)
560
+ error.statusCode = 404
561
+ throw error
562
+ }
563
+
564
+ const result = await readSkillResource(skill, params?.path, params)
565
+ return {
566
+ content: truncateText(result.content),
567
+ details: result.details,
568
+ }
569
+ }
570
+
571
+ // --- run_command ---
572
+ function commandStatus(meta = {}) {
573
+ if (meta.running) return 'Status: running'
574
+ const flags = [
575
+ meta.timedOut ? 'timed out' : null,
576
+ meta.aborted ? 'aborted' : null,
577
+ ].filter(Boolean)
578
+ const suffix = flags.length ? ` (${flags.join(', ')})` : ''
579
+ return `Exit code: ${meta.code ?? 'unknown'}${meta.signal ? `, signal: ${meta.signal}` : ''}${suffix}`
580
+ }
581
+
582
+ function formatCommandOutput(command, stdout, stderr, meta = {}) {
583
+ return [
584
+ `Command: ${command}`,
585
+ commandStatus(meta),
586
+ '',
587
+ 'STDOUT:',
588
+ stdout || '(empty)',
589
+ '',
590
+ 'STDERR:',
591
+ stderr || '(empty)',
592
+ ].join('\n')
593
+ }
594
+
595
+ function killProcessTree(child, signal = 'SIGTERM') {
596
+ if (!child?.pid) return
597
+
598
+ if (process.platform === 'win32') {
599
+ const killer = spawn('taskkill', ['/pid', String(child.pid), '/T', '/F'], {
600
+ stdio: 'ignore',
601
+ windowsHide: true,
602
+ })
603
+ killer.on('error', () => {
604
+ try { child.kill(signal) } catch { /* ignore */ }
605
+ })
606
+ return
607
+ }
608
+
609
+ try {
610
+ process.kill(-child.pid, signal)
611
+ } catch {
612
+ try { child.kill(signal) } catch { /* ignore */ }
613
+ }
614
+ }
615
+
616
+ export async function toolRunCommand(params, context, runtime = {}) {
617
+ const command = String(params?.command || '')
618
+ if (!command.trim()) {
619
+ const error = new Error('command is required')
620
+ error.statusCode = 400
621
+ throw error
622
+ }
623
+
624
+ const timeoutMs = Math.min(10 * 60, Math.max(1, Number(params?.timeoutSeconds || 60))) * 1000
625
+ const cwd = getToolWorkspaceRoot(context)
626
+
627
+ if (runtime.signal?.aborted) {
628
+ const content = formatCommandOutput(command, '', 'Command aborted before start.', { aborted: true })
629
+ return { content: truncateText(content), details: { command, project: context?.project, cwd, aborted: true } }
630
+ }
631
+
632
+ return new Promise((resolve) => {
633
+ const child = spawn(command, {
634
+ cwd,
635
+ shell: true,
636
+ stdio: ['ignore', 'pipe', 'pipe'],
637
+ windowsHide: true,
638
+ detached: process.platform !== 'win32',
639
+ })
640
+
641
+ let stdout = ''
642
+ let stderr = ''
643
+ let timedOut = false
644
+ let aborted = false
645
+ let settled = false
646
+ let updateTimer = null
647
+ let updatePending = false
648
+ let forceKillTimer = null
649
+
650
+ const cleanup = () => {
651
+ clearTimeout(timer)
652
+ if (forceKillTimer) clearTimeout(forceKillTimer)
653
+ if (updateTimer) clearTimeout(updateTimer)
654
+ runtime.signal?.removeEventListener?.('abort', onAbort)
655
+ }
656
+
657
+ const finish = ({ code = null, signal = null, error = null } = {}) => {
658
+ if (settled) return
659
+ flushUpdate()
660
+ settled = true
661
+ cleanup()
662
+ if (error) {
663
+ resolve({
664
+ isError: true,
665
+ content: truncateText(`Error running command: ${error.message}`),
666
+ details: { command, project: context?.project, cwd, error: error.message, aborted, timedOut },
667
+ })
668
+ return
669
+ }
670
+ const content = formatCommandOutput(command, stdout, stderr, { code, signal, timedOut, aborted })
671
+ resolve({ content: truncateText(content), details: { command, project: context?.project, cwd, code, signal, timedOut, aborted } })
672
+ }
673
+
674
+ const stopChild = (reason) => {
675
+ if (reason === 'timeout') timedOut = true
676
+ if (reason === 'abort') aborted = true
677
+ killProcessTree(child, 'SIGTERM')
678
+ forceKillTimer = setTimeout(() => {
679
+ killProcessTree(child, 'SIGKILL')
680
+ }, 1500)
681
+ }
682
+
683
+ function onAbort() {
684
+ stopChild('abort')
685
+ finish({ signal: 'SIGTERM' })
686
+ }
687
+
688
+ const emitUpdate = () => {
689
+ updateTimer = null
690
+ if (settled || !updatePending) return
691
+ updatePending = false
692
+ runtime.onUpdate?.({
693
+ content: [{ type: 'text', text: truncateText(formatCommandOutput(command, stdout, stderr, { running: true })) }],
694
+ details: { command, project: context?.project, cwd, running: true, stdout, stderr },
695
+ })
696
+ }
697
+ const flushUpdate = () => {
698
+ if (updateTimer) {
699
+ clearTimeout(updateTimer)
700
+ updateTimer = null
701
+ }
702
+ if (!updatePending) return
703
+ updatePending = false
704
+ runtime.onUpdate?.({
705
+ content: [{ type: 'text', text: truncateText(formatCommandOutput(command, stdout, stderr, { running: true })) }],
706
+ details: { command, project: context?.project, cwd, running: true, stdout, stderr },
707
+ })
708
+ }
709
+ const scheduleUpdate = () => {
710
+ if (settled) return
711
+ updatePending = true
712
+ if (!updateTimer) updateTimer = setTimeout(emitUpdate, 150)
713
+ }
714
+ const timer = setTimeout(() => {
715
+ stopChild('timeout')
716
+ finish({ signal: 'SIGTERM' })
717
+ }, timeoutMs)
718
+
719
+ runtime.signal?.addEventListener?.('abort', onAbort, { once: true })
720
+
721
+ child.stdout.on('data', (chunk) => {
722
+ if (settled) return
723
+ stdout = truncateText(stdout + chunk.toString())
724
+ scheduleUpdate()
725
+ })
726
+ child.stderr.on('data', (chunk) => {
727
+ if (settled) return
728
+ stderr = truncateText(stderr + chunk.toString())
729
+ scheduleUpdate()
730
+ })
731
+ child.on('close', (code, signal) => {
732
+ finish({ code, signal })
733
+ })
734
+ child.on('error', (err) => {
735
+ finish({ error: err })
736
+ })
737
+ })
738
+ }
739
+
740
+ export const toolHandlers = {
741
+ read_file: toolReadFile,
742
+ grep_files: toolGrepFiles,
743
+ write_file: toolWriteFile,
744
+ edit_file: toolEditFile,
745
+ run_command: toolRunCommand,
746
+ activate_skill: toolActivateSkill,
747
+ read_skill_resource: toolReadSkillResource,
748
+ }