@qvac/harness 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (462) hide show
  1. package/dist/harness.bundle +13 -64
  2. package/dist/prebuilds-manifest.json +0 -8
  3. package/dist-lib/index.d.ts +240 -0
  4. package/dist-lib/index.js +1063 -0
  5. package/dist-lib/lib/audio-transcode-bare.d.ts +2 -0
  6. package/dist-lib/lib/audio-transcode-bare.js +145 -0
  7. package/dist-lib/lib/audio-transcode-node.d.ts +2 -0
  8. package/dist-lib/lib/audio-transcode-node.js +6 -0
  9. package/dist-lib/lib/capabilities/audio-resample.d.ts +14 -0
  10. package/dist-lib/lib/capabilities/audio-resample.js +72 -0
  11. package/dist-lib/lib/capabilities/completion.d.ts +288 -0
  12. package/dist-lib/lib/capabilities/completion.js +1077 -0
  13. package/dist-lib/lib/capabilities/download.d.ts +46 -0
  14. package/dist-lib/lib/capabilities/download.js +124 -0
  15. package/dist-lib/lib/capabilities/embed.d.ts +20 -0
  16. package/dist-lib/lib/capabilities/embed.js +13 -0
  17. package/dist-lib/lib/capabilities/kv-cache.d.ts +13 -0
  18. package/dist-lib/lib/capabilities/kv-cache.js +21 -0
  19. package/dist-lib/lib/capabilities/prompt-prefix.d.ts +6 -0
  20. package/dist-lib/lib/capabilities/prompt-prefix.js +10 -0
  21. package/dist-lib/lib/capabilities/speech-lexicon.d.ts +5 -0
  22. package/dist-lib/lib/capabilities/speech-lexicon.js +32 -0
  23. package/dist-lib/lib/capabilities/speech-text.d.ts +6 -0
  24. package/dist-lib/lib/capabilities/speech-text.js +79 -0
  25. package/dist-lib/lib/capabilities/tool-names.d.ts +3 -0
  26. package/dist-lib/lib/capabilities/tool-names.js +3 -0
  27. package/dist-lib/lib/capabilities/tool-selection.d.ts +43 -0
  28. package/dist-lib/lib/capabilities/tool-selection.js +60 -0
  29. package/dist-lib/lib/capabilities/tool-turns.d.ts +9 -0
  30. package/dist-lib/lib/capabilities/tool-turns.js +101 -0
  31. package/dist-lib/lib/capabilities/usage-breakdown.d.ts +27 -0
  32. package/dist-lib/lib/capabilities/usage-breakdown.js +44 -0
  33. package/dist-lib/lib/capabilities/vision-history.d.ts +3 -0
  34. package/dist-lib/lib/capabilities/vision-history.js +21 -0
  35. package/dist-lib/lib/capabilities/voice.d.ts +78 -0
  36. package/dist-lib/lib/capabilities/voice.js +189 -0
  37. package/dist-lib/lib/connect.d.ts +76 -0
  38. package/dist-lib/lib/connect.js +789 -0
  39. package/dist-lib/lib/context-window.d.ts +7 -0
  40. package/dist-lib/lib/context-window.js +90 -0
  41. package/dist-lib/lib/contract-types.d.ts +210 -0
  42. package/dist-lib/lib/contract-types.js +1 -0
  43. package/dist-lib/lib/diagram-repair.d.ts +21 -0
  44. package/dist-lib/lib/diagram-repair.js +58 -0
  45. package/dist-lib/lib/dns-lookup.d.ts +1 -0
  46. package/dist-lib/lib/dns-lookup.js +13 -0
  47. package/dist-lib/lib/error-fields.d.ts +2 -0
  48. package/dist-lib/lib/error-fields.js +8 -0
  49. package/dist-lib/lib/fetch-node.d.ts +1 -0
  50. package/dist-lib/lib/fetch-node.js +1 -0
  51. package/dist-lib/lib/hardware/capability-probe.d.ts +9 -0
  52. package/dist-lib/lib/hardware/capability-probe.js +99 -0
  53. package/dist-lib/lib/hardware/gpu-classify.d.ts +2 -0
  54. package/dist-lib/lib/hardware/gpu-classify.js +32 -0
  55. package/dist-lib/lib/hardware/gpu-probe-addon.d.ts +2 -0
  56. package/dist-lib/lib/hardware/gpu-probe-addon.js +42 -0
  57. package/dist-lib/lib/hardware/gpu-stats.bare.d.ts +1 -0
  58. package/dist-lib/lib/hardware/gpu-stats.bare.js +24 -0
  59. package/dist-lib/lib/hardware/gpu-stats.stub.d.ts +1 -0
  60. package/dist-lib/lib/hardware/gpu-stats.stub.js +3 -0
  61. package/dist-lib/lib/hardware/memory-budget.d.ts +8 -0
  62. package/dist-lib/lib/hardware/memory-budget.js +1 -0
  63. package/dist-lib/lib/hardware/parsers.d.ts +7 -0
  64. package/dist-lib/lib/hardware/parsers.js +41 -0
  65. package/dist-lib/lib/headers-bare.d.ts +1 -0
  66. package/dist-lib/lib/headers-bare.js +1 -0
  67. package/dist-lib/lib/headers-node.d.ts +4 -0
  68. package/dist-lib/lib/headers-node.js +1 -0
  69. package/dist-lib/lib/helpers/buffer-burst.d.ts +1 -0
  70. package/dist-lib/lib/helpers/buffer-burst.js +20 -0
  71. package/dist-lib/lib/helpers/control-tokens.d.ts +7 -0
  72. package/dist-lib/lib/helpers/control-tokens.js +32 -0
  73. package/dist-lib/lib/helpers/join-guard.d.ts +6 -0
  74. package/dist-lib/lib/helpers/join-guard.js +46 -0
  75. package/dist-lib/lib/helpers/markup-stream-filter.d.ts +5 -0
  76. package/dist-lib/lib/helpers/markup-stream-filter.js +75 -0
  77. package/dist-lib/lib/helpers/race-abort.d.ts +5 -0
  78. package/dist-lib/lib/helpers/race-abort.js +18 -0
  79. package/dist-lib/lib/helpers/retry-memo.d.ts +5 -0
  80. package/dist-lib/lib/helpers/retry-memo.js +12 -0
  81. package/dist-lib/lib/helpers/run-outcome.d.ts +33 -0
  82. package/dist-lib/lib/helpers/run-outcome.js +204 -0
  83. package/dist-lib/lib/helpers/spawn-path.d.ts +5 -0
  84. package/dist-lib/lib/helpers/spawn-path.js +57 -0
  85. package/dist-lib/lib/helpers/text-coalescer.d.ts +15 -0
  86. package/dist-lib/lib/helpers/text-coalescer.js +34 -0
  87. package/dist-lib/lib/helpers/thinking.d.ts +8 -0
  88. package/dist-lib/lib/helpers/thinking.js +95 -0
  89. package/dist-lib/lib/helpers/tool-call-markup.d.ts +20 -0
  90. package/dist-lib/lib/helpers/tool-call-markup.js +201 -0
  91. package/dist-lib/lib/helpers/tool-intent.d.ts +7 -0
  92. package/dist-lib/lib/helpers/tool-intent.js +21 -0
  93. package/dist-lib/lib/helpers/tool-label.d.ts +8 -0
  94. package/dist-lib/lib/helpers/tool-label.js +131 -0
  95. package/dist-lib/lib/hooks/built-in/arg-repair.d.ts +5 -0
  96. package/dist-lib/lib/hooks/built-in/arg-repair.js +88 -0
  97. package/dist-lib/lib/hooks/built-in/egress.d.ts +5 -0
  98. package/dist-lib/lib/hooks/built-in/egress.js +29 -0
  99. package/dist-lib/lib/hooks/built-in/index.d.ts +3 -0
  100. package/dist-lib/lib/hooks/built-in/index.js +3 -0
  101. package/dist-lib/lib/hooks/built-in/skill-catalog.d.ts +10 -0
  102. package/dist-lib/lib/hooks/built-in/skill-catalog.js +17 -0
  103. package/dist-lib/lib/hooks/pipeline.d.ts +20 -0
  104. package/dist-lib/lib/hooks/pipeline.js +49 -0
  105. package/dist-lib/lib/hooks/registry.d.ts +2 -0
  106. package/dist-lib/lib/hooks/registry.js +6 -0
  107. package/dist-lib/lib/hooks/run.d.ts +5 -0
  108. package/dist-lib/lib/hooks/run.js +83 -0
  109. package/dist-lib/lib/hooks/types.d.ts +57 -0
  110. package/dist-lib/lib/hooks/types.js +1 -0
  111. package/dist-lib/lib/log.d.ts +5 -0
  112. package/dist-lib/lib/log.js +37 -0
  113. package/dist-lib/lib/model-download-progress.d.ts +22 -0
  114. package/dist-lib/lib/model-download-progress.js +95 -0
  115. package/dist-lib/lib/models/context.d.ts +5 -0
  116. package/dist-lib/lib/models/context.js +12 -0
  117. package/dist-lib/lib/models/embed-config.d.ts +14 -0
  118. package/dist-lib/lib/models/embed-config.js +31 -0
  119. package/dist-lib/lib/models/gpu-selection.d.ts +3 -0
  120. package/dist-lib/lib/models/gpu-selection.js +26 -0
  121. package/dist-lib/lib/models/kv-cache.d.ts +4 -0
  122. package/dist-lib/lib/models/kv-cache.js +6 -0
  123. package/dist-lib/lib/models/llm-presets.d.ts +10 -0
  124. package/dist-lib/lib/models/llm-presets.js +58 -0
  125. package/dist-lib/lib/models/model-catalog-constants.d.ts +29 -0
  126. package/dist-lib/lib/models/model-catalog-constants.js +103 -0
  127. package/dist-lib/lib/models/model-catalog.d.ts +125 -0
  128. package/dist-lib/lib/models/model-catalog.js +371 -0
  129. package/dist-lib/lib/models/model-delete.d.ts +18 -0
  130. package/dist-lib/lib/models/model-delete.js +47 -0
  131. package/dist-lib/lib/models/model-handle.d.ts +18 -0
  132. package/dist-lib/lib/models/model-handle.js +33 -0
  133. package/dist-lib/lib/models/model-list.d.ts +42 -0
  134. package/dist-lib/lib/models/model-list.js +123 -0
  135. package/dist-lib/lib/models/model-pool.d.ts +116 -0
  136. package/dist-lib/lib/models/model-pool.js +356 -0
  137. package/dist-lib/lib/models/model-source.d.ts +6 -0
  138. package/dist-lib/lib/models/model-source.js +21 -0
  139. package/dist-lib/lib/models/music-catalog.d.ts +12 -0
  140. package/dist-lib/lib/models/music-catalog.js +26 -0
  141. package/dist-lib/lib/models/opencl-cache.d.ts +5 -0
  142. package/dist-lib/lib/models/opencl-cache.js +50 -0
  143. package/dist-lib/lib/models/sdk-faults.d.ts +21 -0
  144. package/dist-lib/lib/models/sdk-faults.js +66 -0
  145. package/dist-lib/lib/models/tool-dialect.d.ts +2 -0
  146. package/dist-lib/lib/models/tool-dialect.js +19 -0
  147. package/dist-lib/lib/models/tts-model-default.d.ts +3 -0
  148. package/dist-lib/lib/models/tts-model-default.js +13 -0
  149. package/dist-lib/lib/no-redirect-fetch-bare.d.ts +15 -0
  150. package/dist-lib/lib/no-redirect-fetch-bare.js +59 -0
  151. package/dist-lib/lib/no-redirect-fetch-impl.d.ts +39 -0
  152. package/dist-lib/lib/no-redirect-fetch-impl.js +80 -0
  153. package/dist-lib/lib/no-redirect-fetch-node.d.ts +4 -0
  154. package/dist-lib/lib/no-redirect-fetch-node.js +52 -0
  155. package/dist-lib/lib/prompt.d.ts +22 -0
  156. package/dist-lib/lib/prompt.js +77 -0
  157. package/dist-lib/lib/queue.d.ts +9 -0
  158. package/dist-lib/lib/queue.js +48 -0
  159. package/dist-lib/lib/resolution-detector.d.ts +5 -0
  160. package/dist-lib/lib/resolution-detector.js +100 -0
  161. package/dist-lib/lib/rpc-session.d.ts +8 -0
  162. package/dist-lib/lib/rpc-session.js +20 -0
  163. package/dist-lib/lib/sdk-config-loader.bare.d.ts +1 -0
  164. package/dist-lib/lib/sdk-config-loader.bare.js +9 -0
  165. package/dist-lib/lib/sdk-config-loader.node.d.ts +1 -0
  166. package/dist-lib/lib/sdk-config-loader.node.js +1 -0
  167. package/dist-lib/lib/sdk-loader.d.ts +30 -0
  168. package/dist-lib/lib/sdk-loader.js +53 -0
  169. package/dist-lib/lib/sdk-storage.d.ts +8 -0
  170. package/dist-lib/lib/sdk-storage.js +24 -0
  171. package/dist-lib/lib/serve.d.ts +3 -0
  172. package/dist-lib/lib/serve.js +612 -0
  173. package/dist-lib/lib/spawn.d.ts +62 -0
  174. package/dist-lib/lib/spawn.js +71 -0
  175. package/dist-lib/lib/staging.d.ts +4 -0
  176. package/dist-lib/lib/staging.js +28 -0
  177. package/dist-lib/lib/storage.d.ts +18 -0
  178. package/dist-lib/lib/storage.js +26 -0
  179. package/dist-lib/lib/tmp-path.d.ts +7 -0
  180. package/dist-lib/lib/tmp-path.js +17 -0
  181. package/dist-lib/lib/tool-call-display.d.ts +21 -0
  182. package/dist-lib/lib/tool-call-display.js +1 -0
  183. package/dist-lib/lib/tools/catalog.d.ts +13 -0
  184. package/dist-lib/lib/tools/catalog.js +13 -0
  185. package/dist-lib/lib/tools/create-documents.d.ts +3 -0
  186. package/dist-lib/lib/tools/create-documents.js +87 -0
  187. package/dist-lib/lib/tools/edit-documents.d.ts +3 -0
  188. package/dist-lib/lib/tools/edit-documents.js +122 -0
  189. package/dist-lib/lib/tools/edit-image.d.ts +25 -0
  190. package/dist-lib/lib/tools/edit-image.js +271 -0
  191. package/dist-lib/lib/tools/exec/adapters/adapter.d.ts +27 -0
  192. package/dist-lib/lib/tools/exec/adapters/adapter.js +1 -0
  193. package/dist-lib/lib/tools/exec/adapters/python/attachments.d.ts +26 -0
  194. package/dist-lib/lib/tools/exec/adapters/python/attachments.js +160 -0
  195. package/dist-lib/lib/tools/exec/adapters/python/create-effect.d.ts +7 -0
  196. package/dist-lib/lib/tools/exec/adapters/python/create-effect.js +290 -0
  197. package/dist-lib/lib/tools/exec/adapters/python/loader.d.ts +11 -0
  198. package/dist-lib/lib/tools/exec/adapters/python/loader.js +94 -0
  199. package/dist-lib/lib/tools/exec/adapters/python/memfs.d.ts +47 -0
  200. package/dist-lib/lib/tools/exec/adapters/python/memfs.js +85 -0
  201. package/dist-lib/lib/tools/exec/adapters/python/output-policy.d.ts +13 -0
  202. package/dist-lib/lib/tools/exec/adapters/python/output-policy.js +129 -0
  203. package/dist-lib/lib/tools/exec/adapters/python/pyodide.d.ts +19 -0
  204. package/dist-lib/lib/tools/exec/adapters/python/pyodide.js +107 -0
  205. package/dist-lib/lib/tools/exec/adapters/python/python-adapter.d.ts +75 -0
  206. package/dist-lib/lib/tools/exec/adapters/python/python-adapter.js +1094 -0
  207. package/dist-lib/lib/tools/exec/adapters/python/run-session.d.ts +75 -0
  208. package/dist-lib/lib/tools/exec/adapters/python/run-session.js +273 -0
  209. package/dist-lib/lib/tools/exec/adapters/python/wheels.d.ts +38 -0
  210. package/dist-lib/lib/tools/exec/adapters/python/wheels.js +102 -0
  211. package/dist-lib/lib/tools/exec/adapters/python/worker/client.d.ts +7 -0
  212. package/dist-lib/lib/tools/exec/adapters/python/worker/client.js +188 -0
  213. package/dist-lib/lib/tools/exec/adapters/python/worker/entry.d.ts +1 -0
  214. package/dist-lib/lib/tools/exec/adapters/python/worker/entry.js +105 -0
  215. package/dist-lib/lib/tools/exec/adapters/python/worker/protocol.d.ts +38 -0
  216. package/dist-lib/lib/tools/exec/adapters/python/worker/protocol.js +41 -0
  217. package/dist-lib/lib/tools/exec/adapters/python/worker/spawn-bare.d.ts +2 -0
  218. package/dist-lib/lib/tools/exec/adapters/python/worker/spawn-bare.js +30 -0
  219. package/dist-lib/lib/tools/exec/adapters/python/worker/spawn-node.d.ts +13 -0
  220. package/dist-lib/lib/tools/exec/adapters/python/worker/spawn-node.js +45 -0
  221. package/dist-lib/lib/tools/exec/adapters/shell/shell-adapter.d.ts +12 -0
  222. package/dist-lib/lib/tools/exec/adapters/shell/shell-adapter.js +20 -0
  223. package/dist-lib/lib/tools/exec/obsidian/cli-process.d.ts +8 -0
  224. package/dist-lib/lib/tools/exec/obsidian/cli-process.js +74 -0
  225. package/dist-lib/lib/tools/exec/obsidian/cli.d.ts +18 -0
  226. package/dist-lib/lib/tools/exec/obsidian/cli.js +153 -0
  227. package/dist-lib/lib/tools/exec/obsidian/command.d.ts +5 -0
  228. package/dist-lib/lib/tools/exec/obsidian/command.js +18 -0
  229. package/dist-lib/lib/tools/exec/obsidian/guidance.d.ts +5 -0
  230. package/dist-lib/lib/tools/exec/obsidian/guidance.js +18 -0
  231. package/dist-lib/lib/tools/exec/obsidian/note-name.d.ts +1 -0
  232. package/dist-lib/lib/tools/exec/obsidian/note-name.js +6 -0
  233. package/dist-lib/lib/tools/exec/obsidian/output.d.ts +1 -0
  234. package/dist-lib/lib/tools/exec/obsidian/output.js +31 -0
  235. package/dist-lib/lib/tools/exec/obsidian/route.d.ts +19 -0
  236. package/dist-lib/lib/tools/exec/obsidian/route.js +85 -0
  237. package/dist-lib/lib/tools/exec/obsidian/safe-path.d.ts +3 -0
  238. package/dist-lib/lib/tools/exec/obsidian/safe-path.js +56 -0
  239. package/dist-lib/lib/tools/exec/obsidian/vault-create.d.ts +1 -0
  240. package/dist-lib/lib/tools/exec/obsidian/vault-create.js +40 -0
  241. package/dist-lib/lib/tools/exec/obsidian/vault-fs.d.ts +3 -0
  242. package/dist-lib/lib/tools/exec/obsidian/vault-fs.js +57 -0
  243. package/dist-lib/lib/tools/exec/obsidian/vault-paths.d.ts +20 -0
  244. package/dist-lib/lib/tools/exec/obsidian/vault-paths.js +171 -0
  245. package/dist-lib/lib/tools/exec/obsidian/vault-read.d.ts +11 -0
  246. package/dist-lib/lib/tools/exec/obsidian/vault-read.js +119 -0
  247. package/dist-lib/lib/tools/exec/obsidian/vault-write.d.ts +7 -0
  248. package/dist-lib/lib/tools/exec/obsidian/vault-write.js +134 -0
  249. package/dist-lib/lib/tools/exec/runner.d.ts +62 -0
  250. package/dist-lib/lib/tools/exec/runner.js +87 -0
  251. package/dist-lib/lib/tools/exec/scope.d.ts +3 -0
  252. package/dist-lib/lib/tools/exec/scope.js +97 -0
  253. package/dist-lib/lib/tools/exec/shell-argv.d.ts +2 -0
  254. package/dist-lib/lib/tools/exec/shell-argv.js +48 -0
  255. package/dist-lib/lib/tools/exec.d.ts +29 -0
  256. package/dist-lib/lib/tools/exec.js +459 -0
  257. package/dist-lib/lib/tools/file-glob.d.ts +15 -0
  258. package/dist-lib/lib/tools/file-glob.js +112 -0
  259. package/dist-lib/lib/tools/fs/drive.d.ts +26 -0
  260. package/dist-lib/lib/tools/fs/drive.js +1 -0
  261. package/dist-lib/lib/tools/fs/glob.d.ts +1 -0
  262. package/dist-lib/lib/tools/fs/glob.js +34 -0
  263. package/dist-lib/lib/tools/fs/local.d.ts +2 -0
  264. package/dist-lib/lib/tools/fs/local.js +29 -0
  265. package/dist-lib/lib/tools/fs/read.d.ts +2 -0
  266. package/dist-lib/lib/tools/fs/read.js +17 -0
  267. package/dist-lib/lib/tools/fs/remote-protocol.d.ts +40 -0
  268. package/dist-lib/lib/tools/fs/remote-protocol.js +1 -0
  269. package/dist-lib/lib/tools/fs/remote.d.ts +17 -0
  270. package/dist-lib/lib/tools/fs/remote.js +131 -0
  271. package/dist-lib/lib/tools/fs/scope.d.ts +37 -0
  272. package/dist-lib/lib/tools/fs/scope.js +130 -0
  273. package/dist-lib/lib/tools/fs/walk.d.ts +15 -0
  274. package/dist-lib/lib/tools/fs/walk.js +38 -0
  275. package/dist-lib/lib/tools/fs/write.d.ts +4 -0
  276. package/dist-lib/lib/tools/fs/write.js +5 -0
  277. package/dist-lib/lib/tools/generate-image.d.ts +111 -0
  278. package/dist-lib/lib/tools/generate-image.js +369 -0
  279. package/dist-lib/lib/tools/generate-music.d.ts +124 -0
  280. package/dist-lib/lib/tools/generate-music.js +522 -0
  281. package/dist-lib/lib/tools/grep.d.ts +5 -0
  282. package/dist-lib/lib/tools/grep.js +158 -0
  283. package/dist-lib/lib/tools/http-methods.d.ts +1 -0
  284. package/dist-lib/lib/tools/http-methods.js +1 -0
  285. package/dist-lib/lib/tools/http-request/encode-fields.d.ts +2 -0
  286. package/dist-lib/lib/tools/http-request/encode-fields.js +69 -0
  287. package/dist-lib/lib/tools/http-request/truncate-response.d.ts +1 -0
  288. package/dist-lib/lib/tools/http-request/truncate-response.js +83 -0
  289. package/dist-lib/lib/tools/http-request/utils.d.ts +27 -0
  290. package/dist-lib/lib/tools/http-request/utils.js +84 -0
  291. package/dist-lib/lib/tools/http-request.d.ts +20 -0
  292. package/dist-lib/lib/tools/http-request.js +177 -0
  293. package/dist-lib/lib/tools/mcp/utils.d.ts +47 -0
  294. package/dist-lib/lib/tools/mcp/utils.js +172 -0
  295. package/dist-lib/lib/tools/mcp-call.d.ts +14 -0
  296. package/dist-lib/lib/tools/mcp-call.js +155 -0
  297. package/dist-lib/lib/tools/model-args.d.ts +1 -0
  298. package/dist-lib/lib/tools/model-args.js +4 -0
  299. package/dist-lib/lib/tools/operations/builders.d.ts +17 -0
  300. package/dist-lib/lib/tools/operations/builders.js +179 -0
  301. package/dist-lib/lib/tools/operations/compile.d.ts +7 -0
  302. package/dist-lib/lib/tools/operations/compile.js +92 -0
  303. package/dist-lib/lib/tools/operations/gmail-message.d.ts +15 -0
  304. package/dist-lib/lib/tools/operations/gmail-message.js +62 -0
  305. package/dist-lib/lib/tools/operations/manifest.d.ts +60 -0
  306. package/dist-lib/lib/tools/operations/manifest.js +50 -0
  307. package/dist-lib/lib/tools/outbound-guard.d.ts +10 -0
  308. package/dist-lib/lib/tools/outbound-guard.js +127 -0
  309. package/dist-lib/lib/tools/private-ip.d.ts +4 -0
  310. package/dist-lib/lib/tools/private-ip.js +126 -0
  311. package/dist-lib/lib/tools/rag-search.d.ts +2 -0
  312. package/dist-lib/lib/tools/rag-search.js +98 -0
  313. package/dist-lib/lib/tools/read-files.d.ts +5 -0
  314. package/dist-lib/lib/tools/read-files.js +153 -0
  315. package/dist-lib/lib/tools/skill.d.ts +10 -0
  316. package/dist-lib/lib/tools/skill.js +123 -0
  317. package/dist-lib/lib/tools/skills/auth-resolver.d.ts +43 -0
  318. package/dist-lib/lib/tools/skills/auth-resolver.js +121 -0
  319. package/dist-lib/lib/tools/skills/bin-check.d.ts +9 -0
  320. package/dist-lib/lib/tools/skills/bin-check.js +56 -0
  321. package/dist-lib/lib/tools/skills/bundled-dir.d.ts +2 -0
  322. package/dist-lib/lib/tools/skills/bundled-dir.js +117 -0
  323. package/dist-lib/lib/tools/skills/bundled-hash.d.ts +4 -0
  324. package/dist-lib/lib/tools/skills/bundled-hash.js +12 -0
  325. package/dist-lib/lib/tools/skills/catalog.d.ts +60 -0
  326. package/dist-lib/lib/tools/skills/catalog.js +203 -0
  327. package/dist-lib/lib/tools/skills/cli-argv.d.ts +9 -0
  328. package/dist-lib/lib/tools/skills/cli-argv.js +147 -0
  329. package/dist-lib/lib/tools/skills/cli-schema-check.d.ts +3 -0
  330. package/dist-lib/lib/tools/skills/cli-schema-check.js +62 -0
  331. package/dist-lib/lib/tools/skills/cli-schema-load.d.ts +4 -0
  332. package/dist-lib/lib/tools/skills/cli-schema-load.js +90 -0
  333. package/dist-lib/lib/tools/skills/cli-schema-types.d.ts +30 -0
  334. package/dist-lib/lib/tools/skills/cli-schema-types.js +1 -0
  335. package/dist-lib/lib/tools/skills/cli-schema.d.ts +7 -0
  336. package/dist-lib/lib/tools/skills/cli-schema.js +35 -0
  337. package/dist-lib/lib/tools/skills/credential-check.d.ts +20 -0
  338. package/dist-lib/lib/tools/skills/credential-check.js +94 -0
  339. package/dist-lib/lib/tools/skills/credential-grants.d.ts +9 -0
  340. package/dist-lib/lib/tools/skills/credential-grants.js +25 -0
  341. package/dist-lib/lib/tools/skills/credential-health.d.ts +8 -0
  342. package/dist-lib/lib/tools/skills/credential-health.js +51 -0
  343. package/dist-lib/lib/tools/skills/credential-slots.d.ts +7 -0
  344. package/dist-lib/lib/tools/skills/credential-slots.js +8 -0
  345. package/dist-lib/lib/tools/skills/frontmatter-parser.d.ts +23 -0
  346. package/dist-lib/lib/tools/skills/frontmatter-parser.js +68 -0
  347. package/dist-lib/lib/tools/skills/index.d.ts +5 -0
  348. package/dist-lib/lib/tools/skills/index.js +5 -0
  349. package/dist-lib/lib/tools/skills/manifest-parse.d.ts +12 -0
  350. package/dist-lib/lib/tools/skills/manifest-parse.js +199 -0
  351. package/dist-lib/lib/tools/skills/manifest.d.ts +47 -0
  352. package/dist-lib/lib/tools/skills/manifest.js +1 -0
  353. package/dist-lib/lib/tools/skills/mention-name.d.ts +1 -0
  354. package/dist-lib/lib/tools/skills/mention-name.js +4 -0
  355. package/dist-lib/lib/tools/skills/mention.d.ts +6 -0
  356. package/dist-lib/lib/tools/skills/mention.js +42 -0
  357. package/dist-lib/lib/tools/skills/obsidian-readiness.d.ts +16 -0
  358. package/dist-lib/lib/tools/skills/obsidian-readiness.js +95 -0
  359. package/dist-lib/lib/tools/skills/overlay-crud.d.ts +18 -0
  360. package/dist-lib/lib/tools/skills/overlay-crud.js +98 -0
  361. package/dist-lib/lib/tools/skills/overlay-dir.d.ts +2 -0
  362. package/dist-lib/lib/tools/skills/overlay-dir.js +22 -0
  363. package/dist-lib/lib/tools/skills/overlay-watch.d.ts +13 -0
  364. package/dist-lib/lib/tools/skills/overlay-watch.js +44 -0
  365. package/dist-lib/lib/tools/skills/scope-key.d.ts +7 -0
  366. package/dist-lib/lib/tools/skills/scope-key.js +7 -0
  367. package/dist-lib/lib/tools/skills/setup-routes.d.ts +4 -0
  368. package/dist-lib/lib/tools/skills/setup-routes.js +14 -0
  369. package/dist-lib/lib/tools/skills/skill-settings.d.ts +16 -0
  370. package/dist-lib/lib/tools/skills/skill-settings.js +33 -0
  371. package/dist-lib/lib/tools/skills/skill-state-constants.d.ts +12 -0
  372. package/dist-lib/lib/tools/skills/skill-state-constants.js +14 -0
  373. package/dist-lib/lib/tools/skills/skill-state.d.ts +40 -0
  374. package/dist-lib/lib/tools/skills/skill-state.js +117 -0
  375. package/dist-lib/lib/tools/skills/tool-grants.d.ts +5 -0
  376. package/dist-lib/lib/tools/skills/tool-grants.js +14 -0
  377. package/dist-lib/lib/tools/toolsets.d.ts +8 -0
  378. package/dist-lib/lib/tools/toolsets.js +20 -0
  379. package/dist-lib/lib/tools/url-guard.d.ts +8 -0
  380. package/dist-lib/lib/tools/url-guard.js +40 -0
  381. package/dist-lib/lib/tools/web-fetch.d.ts +8 -0
  382. package/dist-lib/lib/tools/web-fetch.js +302 -0
  383. package/dist-lib/lib/tools/web-search.d.ts +6 -0
  384. package/dist-lib/lib/tools/web-search.js +55 -0
  385. package/dist-lib/lib/transport.d.ts +12 -0
  386. package/dist-lib/lib/transport.js +59 -0
  387. package/dist-lib/lib/user-agent.d.ts +1 -0
  388. package/dist-lib/lib/user-agent.js +1 -0
  389. package/dist-lib/lib/validating-lookup.d.ts +17 -0
  390. package/dist-lib/lib/validating-lookup.js +25 -0
  391. package/dist-lib/lib/wav-encode.d.ts +5 -0
  392. package/dist-lib/lib/wav-encode.js +24 -0
  393. package/dist-lib/lib/web-fetch/embedded-state.d.ts +1 -0
  394. package/dist-lib/lib/web-fetch/embedded-state.js +131 -0
  395. package/dist-lib/lib/web-fetch/extract.d.ts +6 -0
  396. package/dist-lib/lib/web-fetch/extract.js +65 -0
  397. package/dist-lib/lib/web-fetch/images.d.ts +3 -0
  398. package/dist-lib/lib/web-fetch/images.js +43 -0
  399. package/dist-lib/lib/web-fetch/video.d.ts +5 -0
  400. package/dist-lib/lib/web-fetch/video.js +42 -0
  401. package/dist-lib/lib/web-search/engine-registry.d.ts +7 -0
  402. package/dist-lib/lib/web-search/engine-registry.js +17 -0
  403. package/dist-lib/lib/web-search/engines/aol.d.ts +3 -0
  404. package/dist-lib/lib/web-search/engines/aol.js +81 -0
  405. package/dist-lib/lib/web-search/engines/bing.d.ts +3 -0
  406. package/dist-lib/lib/web-search/engines/bing.js +111 -0
  407. package/dist-lib/lib/web-search/engines/brave.d.ts +3 -0
  408. package/dist-lib/lib/web-search/engines/brave.js +59 -0
  409. package/dist-lib/lib/web-search/engines/duckduckgo.d.ts +3 -0
  410. package/dist-lib/lib/web-search/engines/duckduckgo.js +112 -0
  411. package/dist-lib/lib/web-search/engines/google.d.ts +3 -0
  412. package/dist-lib/lib/web-search/engines/google.js +92 -0
  413. package/dist-lib/lib/web-search/engines/wikipedia.d.ts +3 -0
  414. package/dist-lib/lib/web-search/engines/wikipedia.js +37 -0
  415. package/dist-lib/lib/web-search/engines/yahoo.d.ts +3 -0
  416. package/dist-lib/lib/web-search/engines/yahoo.js +81 -0
  417. package/dist-lib/lib/web-search/fetch-html.d.ts +25 -0
  418. package/dist-lib/lib/web-search/fetch-html.js +97 -0
  419. package/dist-lib/lib/web-search/format-results.d.ts +3 -0
  420. package/dist-lib/lib/web-search/format-results.js +14 -0
  421. package/dist-lib/lib/web-search/html-helpers.d.ts +3 -0
  422. package/dist-lib/lib/web-search/html-helpers.js +24 -0
  423. package/dist-lib/lib/web-search/merge-results.d.ts +2 -0
  424. package/dist-lib/lib/web-search/merge-results.js +53 -0
  425. package/dist-lib/lib/web-search/orchestrator.d.ts +14 -0
  426. package/dist-lib/lib/web-search/orchestrator.js +50 -0
  427. package/dist-lib/lib/web-search/types.d.ts +34 -0
  428. package/dist-lib/lib/web-search/types.js +1 -0
  429. package/dist-lib/lib/web-search/url-helpers.d.ts +1 -0
  430. package/dist-lib/lib/web-search/url-helpers.js +11 -0
  431. package/dist-lib/lib/web-search/url-normalize.d.ts +1 -0
  432. package/dist-lib/lib/web-search/url-normalize.js +25 -0
  433. package/dist-lib/lib/web-search/user-agents.d.ts +3 -0
  434. package/dist-lib/lib/web-search/user-agents.js +3 -0
  435. package/dist-lib/lib/wire.d.ts +50 -0
  436. package/dist-lib/lib/wire.js +145 -0
  437. package/dist-lib/schema/baseline.d.ts +8 -0
  438. package/dist-lib/schema/baseline.js +35 -0
  439. package/dist-lib/schema/build.d.ts +1 -0
  440. package/dist-lib/schema/build.js +39 -0
  441. package/dist-lib/schema/generate.d.ts +20 -0
  442. package/dist-lib/schema/generate.js +149 -0
  443. package/dist-lib/schema/harness.d.ts +2 -0
  444. package/dist-lib/schema/harness.js +745 -0
  445. package/dist-lib/schema/release-tags.d.ts +5 -0
  446. package/dist-lib/schema/release-tags.js +58 -0
  447. package/dist-lib/spec/bind.d.ts +2 -0
  448. package/dist-lib/spec/bind.js +124 -0
  449. package/dist-lib/spec/calls.d.ts +3 -0
  450. package/dist-lib/spec/calls.js +41 -0
  451. package/dist-lib/spec/hrpc/hrpc.json +356 -0
  452. package/dist-lib/spec/hrpc/index.d.ts +3 -0
  453. package/dist-lib/spec/hrpc/index.js +463 -0
  454. package/dist-lib/spec/hrpc/messages.d.ts +4 -0
  455. package/dist-lib/spec/hrpc/messages.js +3102 -0
  456. package/dist-lib/spec/hyperschema/index.js +3102 -0
  457. package/dist-lib/spec/hyperschema/schema.json +2290 -0
  458. package/dist-lib/spec/hyperschema/types.d.ts +554 -0
  459. package/dist-lib/spec/index.d.ts +8 -0
  460. package/dist-lib/spec/index.js +1 -0
  461. package/package.json +239 -64
  462. package/.gitattributes +0 -1
@@ -0,0 +1,20 @@
1
+ import type { AbortSignal as BareAbortSignal } from 'bare-abort-controller';
2
+ import { type CredentialStoreFn } from './auth-resolver.ts';
3
+ import type { SkillCatalogEntry } from './catalog.ts';
4
+ export declare const CREDENTIAL_CHECK_TTL_MS = 45000;
5
+ type CredentialCheckResponse = {
6
+ readonly status: number;
7
+ text?: () => Promise<string>;
8
+ };
9
+ export type CredentialCheckFetch = (input: string, init: {
10
+ method: string;
11
+ headers: Headers;
12
+ signal: BareAbortSignal;
13
+ }) => Promise<CredentialCheckResponse>;
14
+ export interface ValidateCredentialChecksOptions {
15
+ refresh?: boolean | undefined;
16
+ now?: () => number;
17
+ ttlMs?: number;
18
+ }
19
+ export declare function validateCredentialChecks(catalog: readonly SkillCatalogEntry[], credentialStore: CredentialStoreFn | undefined, agentId?: string | null, fetchImpl?: CredentialCheckFetch, { refresh, now, ttlMs }?: ValidateCredentialChecksOptions): Promise<void>;
20
+ export {};
@@ -0,0 +1,94 @@
1
+ import fetch from '#fetch';
2
+ import { Headers } from '#headers';
3
+ import { AbortController } from 'bare-abort-controller';
4
+ import { DEFAULT_USER_AGENT } from "../../user-agent.js";
5
+ import { credentialRecord, isCredentialUrlAllowed } from "./auth-resolver.js";
6
+ import { credentialLastProbedAt, markCredentialRejected, markCredentialValid, setCredentialLastProbedAt } from "./credential-health.js";
7
+ const TIMEOUT_MS = 5_000;
8
+ export const CREDENTIAL_CHECK_TTL_MS = 45_000;
9
+ const inflight = new Map();
10
+ function scopedKey(key, agentId) {
11
+ return agentId ? `${agentId}\0${key}` : key;
12
+ }
13
+ export async function validateCredentialChecks(catalog, credentialStore, agentId, fetchImpl, { refresh = false, now = Date.now, ttlMs = CREDENTIAL_CHECK_TTL_MS } = {}) {
14
+ if (!credentialStore)
15
+ return;
16
+ const doFetch = fetchImpl ?? fetch;
17
+ const checks = new Map();
18
+ for (const skill of catalog) {
19
+ for (const [key, check] of Object.entries(skill.requires?.credentialChecks ?? {})) {
20
+ if (!isCredentialUrlAllowed(check.url, skill.allowList))
21
+ continue;
22
+ if (!checks.has(key))
23
+ checks.set(key, { check, skill: skill.name });
24
+ }
25
+ }
26
+ const at = now();
27
+ await Promise.all([...checks].map(async ([key, { check, skill }]) => {
28
+ if (!refresh) {
29
+ const last = credentialLastProbedAt(key, agentId);
30
+ if (last !== undefined && at - last < ttlMs)
31
+ return;
32
+ }
33
+ const sk = scopedKey(key, agentId);
34
+ const pending = inflight.get(sk);
35
+ if (pending) {
36
+ await pending;
37
+ return;
38
+ }
39
+ const probe = runCheck(key, check, skill, credentialStore, agentId, doFetch).finally(() => {
40
+ inflight.delete(sk);
41
+ });
42
+ inflight.set(sk, probe);
43
+ await probe;
44
+ setCredentialLastProbedAt(key, now(), agentId);
45
+ }));
46
+ }
47
+ async function runCheck(key, check, skill, credentialStore, agentId, fetchImpl) {
48
+ const record = credentialRecord(await credentialStore(key, { agentId, skills: [skill] }));
49
+ if (!record)
50
+ return;
51
+ const controller = new AbortController();
52
+ const timer = setTimeout(() => controller.abort('credential check timed out'), TIMEOUT_MS);
53
+ try {
54
+ const headers = new Headers({ ...(check.headers ?? {}) });
55
+ if (!headers.has('user-agent')) {
56
+ headers.set('user-agent', DEFAULT_USER_AGENT);
57
+ }
58
+ headers.set('Authorization', `Bearer ${record.token}`);
59
+ const response = await fetchImpl(check.url, {
60
+ method: check.method ?? 'GET',
61
+ headers: headers,
62
+ signal: controller.signal
63
+ });
64
+ const rejected = response.status === 401 || response.status === 403 || (await hasMcpAuthError(response));
65
+ if (rejected) {
66
+ markCredentialRejected(key, agentId);
67
+ }
68
+ else if (response.status >= 200 && response.status < 300) {
69
+ markCredentialValid(key, agentId);
70
+ }
71
+ }
72
+ catch {
73
+ }
74
+ finally {
75
+ clearTimeout(timer);
76
+ }
77
+ }
78
+ async function hasMcpAuthError(response) {
79
+ if (response.status < 200 || response.status >= 300 || !response.text)
80
+ return false;
81
+ try {
82
+ const body = JSON.parse(await response.text());
83
+ const error = body.error;
84
+ if (!error)
85
+ return false;
86
+ if (error.code === 401 || error.code === 403)
87
+ return true;
88
+ return (typeof error.message === 'string' &&
89
+ /unauthori[sz]ed|forbidden|token.*expired/i.test(error.message));
90
+ }
91
+ catch {
92
+ return false;
93
+ }
94
+ }
@@ -0,0 +1,9 @@
1
+ import type { CredentialAllowList, CredentialAllowListFn } from './auth-resolver.ts';
2
+ import { type CredentialSlotSource } from './credential-slots.ts';
3
+ export interface CredentialGrantEntry extends CredentialSlotSource {
4
+ readonly name: string;
5
+ readonly allowList: readonly string[];
6
+ readonly origin?: 'overlay';
7
+ }
8
+ export declare function credentialGrants(catalog: readonly CredentialGrantEntry[], skills: readonly string[] | undefined): CredentialAllowList;
9
+ export declare function credentialAllowListFor(catalog: readonly CredentialGrantEntry[]): CredentialAllowListFn;
@@ -0,0 +1,25 @@
1
+ import { credentialSlots } from "./credential-slots.js";
2
+ export function credentialGrants(catalog, skills) {
3
+ if (!skills || skills.length === 0)
4
+ return {};
5
+ const loaded = new Set(skills);
6
+ const map = {};
7
+ for (const entry of catalog) {
8
+ if (entry.origin === 'overlay')
9
+ continue;
10
+ if (!loaded.has(entry.name) || entry.allowList.length === 0)
11
+ continue;
12
+ for (const key of credentialSlots(entry).flat()) {
13
+ const list = map[key] ?? [];
14
+ for (const host of entry.allowList) {
15
+ if (!list.includes(host))
16
+ list.push(host);
17
+ }
18
+ map[key] = list;
19
+ }
20
+ }
21
+ return map;
22
+ }
23
+ export function credentialAllowListFor(catalog) {
24
+ return (ctx) => credentialGrants(catalog, ctx?.skills);
25
+ }
@@ -0,0 +1,8 @@
1
+ export declare function markCredentialRejected(key: string, agentId?: string | null, skill?: string | null): void;
2
+ export declare function markCredentialValid(key: string, agentId?: string | null, skill?: string | null): void;
3
+ export declare function recordCredentialHealth(key: string, status: number, agentId?: string | null): void;
4
+ export declare function isCredentialRejected(key: string, agentId?: string | null, skill?: string | null): boolean;
5
+ export declare function credentialLastProbedAt(key: string, agentId?: string | null, skill?: string | null): number | undefined;
6
+ export declare function setCredentialLastProbedAt(key: string, at: number, agentId?: string | null, skill?: string | null): void;
7
+ export declare function resetCredentialHealth(key: string, agentId?: string | null, skill?: string | null): void;
8
+ export declare function resetAllCredentialHealth(): void;
@@ -0,0 +1,51 @@
1
+ import { hlog } from "../../log.js";
2
+ import { scopeKey } from "./scope-key.js";
3
+ const rejected = new Set();
4
+ const lastProbedAt = new Map();
5
+ function scopedKey(key, agentId, skill) {
6
+ return scopeKey({ agentId, skill, key });
7
+ }
8
+ export function markCredentialRejected(key, agentId, skill) {
9
+ rejected.add(scopedKey(key, agentId, skill));
10
+ }
11
+ export function markCredentialValid(key, agentId, skill) {
12
+ rejected.delete(scopedKey(key, agentId, skill));
13
+ if (skill)
14
+ rejected.delete(scopedKey(key, agentId));
15
+ }
16
+ export function recordCredentialHealth(key, status, agentId) {
17
+ if (status === 401 || status === 403) {
18
+ hlog('credential rejected by provider', { key, status });
19
+ markCredentialRejected(key, agentId);
20
+ }
21
+ else if (status < 400) {
22
+ if (isCredentialRejected(key, agentId))
23
+ hlog('credential recovered', { key });
24
+ markCredentialValid(key, agentId);
25
+ }
26
+ }
27
+ export function isCredentialRejected(key, agentId, skill) {
28
+ if (rejected.has(scopedKey(key, agentId)))
29
+ return true;
30
+ return skill ? rejected.has(scopedKey(key, agentId, skill)) : false;
31
+ }
32
+ export function credentialLastProbedAt(key, agentId, skill) {
33
+ return lastProbedAt.get(scopedKey(key, agentId, skill));
34
+ }
35
+ export function setCredentialLastProbedAt(key, at, agentId, skill) {
36
+ lastProbedAt.set(scopedKey(key, agentId, skill), at);
37
+ }
38
+ export function resetCredentialHealth(key, agentId, skill) {
39
+ const sk = scopedKey(key, agentId, skill);
40
+ rejected.delete(sk);
41
+ lastProbedAt.delete(sk);
42
+ if (skill) {
43
+ const shared = scopedKey(key, agentId);
44
+ rejected.delete(shared);
45
+ lastProbedAt.delete(shared);
46
+ }
47
+ }
48
+ export function resetAllCredentialHealth() {
49
+ rejected.clear();
50
+ lastProbedAt.clear();
51
+ }
@@ -0,0 +1,7 @@
1
+ export interface CredentialSlotSource {
2
+ readonly credentials?: readonly string[] | undefined;
3
+ readonly requires?: {
4
+ readonly credentials?: readonly string[] | undefined;
5
+ } | undefined;
6
+ }
7
+ export declare function credentialSlots(entry: CredentialSlotSource): readonly (readonly string[])[];
@@ -0,0 +1,8 @@
1
+ export function credentialSlots(entry) {
2
+ return [...new Set([...(entry.credentials ?? []), ...(entry.requires?.credentials ?? [])])]
3
+ .map((raw) => raw
4
+ .split('|')
5
+ .map((key) => key.trim())
6
+ .filter(Boolean))
7
+ .filter((alts) => alts.length > 0);
8
+ }
@@ -0,0 +1,23 @@
1
+ import type { InstallStep, SkillRequires, SkillSetup } from './manifest.ts';
2
+ export interface SkillFrontMatter {
3
+ name?: string;
4
+ description?: string;
5
+ aliases?: string[];
6
+ preloadOnName?: boolean;
7
+ tools?: string[];
8
+ platform?: string[];
9
+ credentials?: string[];
10
+ allowList?: string[];
11
+ mcpReads?: string[];
12
+ requires?: SkillRequires;
13
+ install?: InstallStep[];
14
+ setup?: SkillSetup;
15
+ stub?: boolean;
16
+ minCapabilityProfile?: string;
17
+ emoji?: string;
18
+ }
19
+ export interface ParsedSkill {
20
+ meta: SkillFrontMatter;
21
+ body: string;
22
+ }
23
+ export declare function parseSkillFrontMatter(raw: string): ParsedSkill;
@@ -0,0 +1,68 @@
1
+ import { parseManifestBlock } from "./manifest-parse.js";
2
+ const FRONT_MATTER_RE = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/;
3
+ const FIELD_RE = /^([A-Za-z_][\w-]*):(.*)$/;
4
+ const LIST_FIELDS = new Set(['tools', 'platform', 'credentials', 'allow_list', 'aliases']);
5
+ export function parseSkillFrontMatter(raw) {
6
+ try {
7
+ const match = FRONT_MATTER_RE.exec(raw);
8
+ if (!match)
9
+ return { meta: {}, body: raw };
10
+ const block = match[1] ?? '';
11
+ const meta = { ...parseFields(block), ...parseManifestBlock(block) };
12
+ return { meta, body: (match[2] ?? '').trim() };
13
+ }
14
+ catch {
15
+ return { meta: {}, body: raw };
16
+ }
17
+ }
18
+ function unwrap(lines) {
19
+ const out = [];
20
+ for (const line of lines) {
21
+ if (out.length > 0 && /^\s/.test(line) && line.trim().length > 0) {
22
+ out[out.length - 1] += ` ${line.trim()}`;
23
+ }
24
+ else {
25
+ out.push(line);
26
+ }
27
+ }
28
+ return out;
29
+ }
30
+ function parseFields(block) {
31
+ const meta = {};
32
+ for (const line of unwrap(block.split(/\r?\n/))) {
33
+ const field = FIELD_RE.exec(line);
34
+ if (!field)
35
+ continue;
36
+ const key = field[1] ?? '';
37
+ const value = (field[2] ?? '').trim();
38
+ if (!value)
39
+ continue;
40
+ if (key === 'allow_list') {
41
+ meta.allowList = parseList(value);
42
+ }
43
+ else if (key === 'mcp_reads') {
44
+ meta.mcpReads = parseList(value);
45
+ }
46
+ else if (LIST_FIELDS.has(key)) {
47
+ meta[key] = parseList(value);
48
+ }
49
+ else if (key === 'name' || key === 'description') {
50
+ meta[key] = stripQuotes(value);
51
+ }
52
+ else if (key === 'preload_on_name') {
53
+ meta.preloadOnName = stripQuotes(value).toLowerCase() !== 'false';
54
+ }
55
+ }
56
+ return meta;
57
+ }
58
+ function parseList(value) {
59
+ const inline = /^\[(.*)\]$/.exec(value);
60
+ const items = inline ? (inline[1] ?? '') : value.replace(/(^|\s)-\s+/g, ',');
61
+ return items
62
+ .split(',')
63
+ .map((item) => stripQuotes(item.trim()))
64
+ .filter((item) => item.length > 0);
65
+ }
66
+ function stripQuotes(value) {
67
+ return value.replace(/^["']|["']$/g, '');
68
+ }
@@ -0,0 +1,5 @@
1
+ export * from './auth-resolver.ts';
2
+ export * from './catalog.ts';
3
+ export * from './cli-schema.ts';
4
+ export * from './credential-grants.ts';
5
+ export * from './frontmatter-parser.ts';
@@ -0,0 +1,5 @@
1
+ export * from "./auth-resolver.js";
2
+ export * from "./catalog.js";
3
+ export * from "./cli-schema.js";
4
+ export * from "./credential-grants.js";
5
+ export * from "./frontmatter-parser.js";
@@ -0,0 +1,12 @@
1
+ import type { InstallStep, SkillRequires, SkillSetup } from './manifest.ts';
2
+ export interface ParsedManifest {
3
+ requires?: SkillRequires;
4
+ install?: InstallStep[];
5
+ setup?: SkillSetup;
6
+ stub?: boolean;
7
+ minCapabilityProfile?: string;
8
+ emoji?: string;
9
+ }
10
+ export declare function parseManifestBlock(block: string, key?: string): ParsedManifest;
11
+ export declare function readInstall(v: unknown): InstallStep[] | undefined;
12
+ export declare function readSetup(v: unknown): SkillSetup | undefined;
@@ -0,0 +1,199 @@
1
+ export function parseManifestBlock(block, key = 'metadata') {
2
+ const json = extractJsonBlock(block, key);
3
+ if (!isObj(json) || !isObj(json.openclaw))
4
+ return {};
5
+ const oc = json.openclaw;
6
+ const requires = readRequires(oc.requires);
7
+ const install = readInstall(oc.install);
8
+ const setup = readSetup(oc.setup);
9
+ return {
10
+ ...(requires ? { requires } : {}),
11
+ ...(install ? { install } : {}),
12
+ ...(setup ? { setup } : {}),
13
+ ...(typeof oc.stub === 'boolean' ? { stub: oc.stub } : {}),
14
+ ...(typeof oc.minCapabilityProfile === 'string'
15
+ ? { minCapabilityProfile: oc.minCapabilityProfile }
16
+ : {}),
17
+ ...(typeof oc.emoji === 'string' ? { emoji: oc.emoji } : {})
18
+ };
19
+ }
20
+ function extractJsonBlock(block, key) {
21
+ const at = block.indexOf(`${key}:`);
22
+ if (at === -1)
23
+ return null;
24
+ const rest = block.slice(at + key.length + 1);
25
+ const start = rest.indexOf('{');
26
+ if (start === -1)
27
+ return null;
28
+ let depth = 0;
29
+ let inString = false;
30
+ let escaped = false;
31
+ for (let i = start; i < rest.length; i++) {
32
+ const ch = rest[i];
33
+ if (inString) {
34
+ if (escaped)
35
+ escaped = false;
36
+ else if (ch === '\\')
37
+ escaped = true;
38
+ else if (ch === '"')
39
+ inString = false;
40
+ continue;
41
+ }
42
+ if (ch === '"')
43
+ inString = true;
44
+ else if (ch === '{')
45
+ depth++;
46
+ else if (ch === '}' && --depth === 0) {
47
+ try {
48
+ return JSON.parse(rest.slice(start, i + 1));
49
+ }
50
+ catch {
51
+ return null;
52
+ }
53
+ }
54
+ }
55
+ return null;
56
+ }
57
+ function isObj(v) {
58
+ return typeof v === 'object' && v !== null && !Array.isArray(v);
59
+ }
60
+ function strArr(v) {
61
+ if (!Array.isArray(v))
62
+ return undefined;
63
+ return v.filter((x) => typeof x === 'string');
64
+ }
65
+ function readRequires(v) {
66
+ if (!isObj(v))
67
+ return undefined;
68
+ const bins = strArr(v.bins);
69
+ const mins = readBinMinVersions(v.binMinVersions);
70
+ const credentials = strArr(v.credentials);
71
+ const credentialChecks = readCredentialChecks(v.credentialChecks);
72
+ return bins || mins || credentials || credentialChecks
73
+ ? {
74
+ ...(bins ? { bins } : {}),
75
+ ...(mins ? { binMinVersions: mins } : {}),
76
+ ...(credentials ? { credentials } : {}),
77
+ ...(credentialChecks ? { credentialChecks } : {})
78
+ }
79
+ : undefined;
80
+ }
81
+ function readBinMinVersions(v) {
82
+ if (!isObj(v))
83
+ return undefined;
84
+ const out = {};
85
+ for (const [bin, spec] of Object.entries(v)) {
86
+ if (!isObj(spec) || typeof spec.min !== 'string')
87
+ continue;
88
+ out[bin] = {
89
+ min: spec.min,
90
+ ...(typeof spec.command === 'string' ? { command: spec.command } : {})
91
+ };
92
+ }
93
+ return Object.keys(out).length > 0 ? out : undefined;
94
+ }
95
+ function readCredentialChecks(v) {
96
+ if (!isObj(v))
97
+ return undefined;
98
+ const out = {};
99
+ for (const [key, check] of Object.entries(v)) {
100
+ if (!isObj(check) || typeof check.url !== 'string')
101
+ continue;
102
+ const headers = readStringRecord(check.headers);
103
+ out[key] = {
104
+ url: check.url,
105
+ ...(typeof check.method === 'string' ? { method: check.method } : {}),
106
+ ...(headers && Object.keys(headers).length > 0 ? { headers } : {})
107
+ };
108
+ }
109
+ return Object.keys(out).length > 0 ? out : undefined;
110
+ }
111
+ function readStringRecord(v) {
112
+ if (!isObj(v))
113
+ return undefined;
114
+ const out = {};
115
+ for (const [key, value] of Object.entries(v)) {
116
+ if (typeof value === 'string')
117
+ out[key] = value;
118
+ }
119
+ return Object.keys(out).length > 0 ? out : undefined;
120
+ }
121
+ export function readInstall(v) {
122
+ if (!Array.isArray(v))
123
+ return undefined;
124
+ const steps = [];
125
+ for (const raw of v) {
126
+ if (!isObj(raw) ||
127
+ typeof raw.id !== 'string' ||
128
+ typeof raw.kind !== 'string' ||
129
+ typeof raw.label !== 'string') {
130
+ continue;
131
+ }
132
+ const bins = strArr(raw.bins);
133
+ steps.push({
134
+ id: raw.id,
135
+ kind: raw.kind,
136
+ label: raw.label,
137
+ ...(typeof raw.formula === 'string' ? { formula: raw.formula } : {}),
138
+ ...(bins ? { bins } : {}),
139
+ ...(typeof raw.command === 'string' ? { command: raw.command } : {}),
140
+ ...(typeof raw.manual === 'boolean' ? { manual: raw.manual } : {})
141
+ });
142
+ }
143
+ return steps.length > 0 ? steps : undefined;
144
+ }
145
+ const ROUTE_KINDS = new Set(['oauth', 'token', 'install', 'picker', 'instructions']);
146
+ function isRouteKind(v) {
147
+ return typeof v === 'string' && ROUTE_KINDS.has(v);
148
+ }
149
+ export function readSetup(v) {
150
+ if (!isObj(v))
151
+ return undefined;
152
+ const summary = typeof v.summary === 'string' ? v.summary : undefined;
153
+ const routes = readRoutes(v.routes);
154
+ return summary || routes
155
+ ? { ...(summary ? { summary } : {}), ...(routes ? { routes } : {}) }
156
+ : undefined;
157
+ }
158
+ function readRoutes(v) {
159
+ if (!Array.isArray(v))
160
+ return undefined;
161
+ const routes = [];
162
+ for (const raw of v) {
163
+ if (!isObj(raw) || !isRouteKind(raw.kind) || typeof raw.label !== 'string')
164
+ continue;
165
+ const steps = strArr(raw.steps);
166
+ const configSteps = strArr(raw.configSteps);
167
+ const fields = readFields(raw.fields);
168
+ routes.push({
169
+ kind: raw.kind,
170
+ label: raw.label,
171
+ ...(typeof raw.provider === 'string' ? { provider: raw.provider } : {}),
172
+ ...(typeof raw.credentialKey === 'string' ? { credentialKey: raw.credentialKey } : {}),
173
+ ...(typeof raw.description === 'string' ? { description: raw.description } : {}),
174
+ ...(typeof raw.helpUrl === 'string' ? { helpUrl: raw.helpUrl } : {}),
175
+ ...(steps ? { steps } : {}),
176
+ ...(configSteps ? { configSteps } : {}),
177
+ ...(fields ? { fields } : {}),
178
+ ...(typeof raw.satisfied === 'boolean' ? { satisfied: raw.satisfied } : {})
179
+ });
180
+ }
181
+ return routes.length > 0 ? routes : undefined;
182
+ }
183
+ function readFields(v) {
184
+ if (!Array.isArray(v))
185
+ return undefined;
186
+ const fields = [];
187
+ for (const raw of v) {
188
+ if (!isObj(raw) || typeof raw.key !== 'string' || typeof raw.label !== 'string')
189
+ continue;
190
+ fields.push({
191
+ key: raw.key,
192
+ label: raw.label,
193
+ ...(typeof raw.placeholder === 'string' ? { placeholder: raw.placeholder } : {}),
194
+ ...(typeof raw.secret === 'boolean' ? { secret: raw.secret } : {}),
195
+ ...(typeof raw.required === 'boolean' ? { required: raw.required } : {})
196
+ });
197
+ }
198
+ return fields.length > 0 ? fields : undefined;
199
+ }
@@ -0,0 +1,47 @@
1
+ import type { SkillCli } from './cli-schema.ts';
2
+ export type { SkillCli };
3
+ export interface SkillRequires {
4
+ readonly bins?: readonly string[];
5
+ readonly binMinVersions?: Readonly<Record<string, {
6
+ readonly min: string;
7
+ readonly command?: string;
8
+ }>>;
9
+ readonly credentials?: readonly string[];
10
+ readonly credentialChecks?: Readonly<Record<string, {
11
+ readonly url: string;
12
+ readonly method?: string;
13
+ readonly headers?: Readonly<Record<string, string>>;
14
+ }>>;
15
+ }
16
+ export interface InstallStep {
17
+ readonly id: string;
18
+ readonly kind: string;
19
+ readonly label: string;
20
+ readonly formula?: string;
21
+ readonly bins?: readonly string[];
22
+ readonly command?: string;
23
+ readonly manual?: boolean;
24
+ }
25
+ export interface SkillSetupField {
26
+ readonly key: string;
27
+ readonly label: string;
28
+ readonly placeholder?: string;
29
+ readonly secret?: boolean;
30
+ readonly required?: boolean;
31
+ }
32
+ export interface SkillSetupRoute {
33
+ readonly kind: 'oauth' | 'token' | 'install' | 'picker' | 'instructions';
34
+ readonly label: string;
35
+ readonly provider?: string;
36
+ readonly credentialKey?: string;
37
+ readonly description?: string;
38
+ readonly helpUrl?: string;
39
+ readonly steps?: readonly string[];
40
+ readonly configSteps?: readonly string[];
41
+ readonly fields?: readonly SkillSetupField[];
42
+ readonly satisfied?: boolean;
43
+ }
44
+ export interface SkillSetup {
45
+ readonly summary?: string;
46
+ readonly routes?: readonly SkillSetupRoute[];
47
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export declare function skillMentionName(text: string): string | null;
@@ -0,0 +1,4 @@
1
+ const MENTION_PATTERN = /^@([a-z0-9][a-z0-9_-]*)(?=\s|$)/;
2
+ export function skillMentionName(text) {
3
+ return MENTION_PATTERN.exec(text.trimStart().toLowerCase())?.[1] ?? null;
4
+ }
@@ -0,0 +1,6 @@
1
+ import type { SkillCatalogEntry } from './catalog.ts';
2
+ import { skillMentionName } from './mention-name.ts';
3
+ export { skillMentionName };
4
+ export declare function resolveSkillMention(text: string, catalog: readonly SkillCatalogEntry[]): SkillCatalogEntry | null;
5
+ export declare function resolveImplicitSkill(text: string, activeSkills: readonly SkillCatalogEntry[]): SkillCatalogEntry | null;
6
+ export declare function skillPreloadMessage(content: string, name: string, body: string): string;
@@ -0,0 +1,42 @@
1
+ import { has } from 'asenion';
2
+ import { skillMentionName } from "./mention-name.js";
3
+ export { skillMentionName };
4
+ export function resolveSkillMention(text, catalog) {
5
+ const name = skillMentionName(text);
6
+ if (!name)
7
+ return null;
8
+ return catalog.find((skill) => skill.name.toLowerCase() === name) ?? null;
9
+ }
10
+ const MIN_IMPLICIT_NAME_LENGTH = 4;
11
+ function matchesName(text, candidate) {
12
+ for (const part of candidate.split('+')) {
13
+ if (!has(text, part))
14
+ return false;
15
+ }
16
+ return true;
17
+ }
18
+ export function resolveImplicitSkill(text, activeSkills) {
19
+ let best = null;
20
+ let bestLength = 0;
21
+ for (const skill of activeSkills) {
22
+ const names = skill.preloadOnName === false
23
+ ? (skill.aliases ?? [])
24
+ : [skill.name, ...(skill.aliases ?? [])];
25
+ for (const word of names) {
26
+ const candidate = word.toLowerCase();
27
+ if (candidate.length < MIN_IMPLICIT_NAME_LENGTH)
28
+ continue;
29
+ if (!matchesName(text, candidate))
30
+ continue;
31
+ const weight = candidate.replace(/\+/g, '').length;
32
+ if (weight > bestLength) {
33
+ best = skill;
34
+ bestLength = weight;
35
+ }
36
+ }
37
+ }
38
+ return best;
39
+ }
40
+ export function skillPreloadMessage(content, name, body) {
41
+ return `[Skill invoked by user: ${name}]\n${body}\n\nThe user's message:\n${content}`;
42
+ }