pi-harness-runtime 1.1.439 → 1.1.441

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 (359) hide show
  1. package/harness/e2e/auto-test-loop.ts +8 -2
  2. package/harness/e2e/browser-scrapers/base-browser-scraper.ts +2 -0
  3. package/harness/e2e/browser-scrapers/chrome-profile-manager.ts +2 -0
  4. package/harness/e2e/browser-scrapers/codex-browser-scraper.ts +2 -0
  5. package/harness/e2e/tools-detector.ts +2 -0
  6. package/harness/index.ts +2 -1
  7. package/harness/key-loader.ts +2 -0
  8. package/harness/langchain/checkpointer.ts +2 -0
  9. package/harness/langchain/cron-cli.ts +2 -0
  10. package/harness/langchain/graph.ts +2 -0
  11. package/harness/master-planner.ts +1 -1
  12. package/harness/notification-center.ts +2 -0
  13. package/harness/output-limit-handler.ts +1 -1
  14. package/harness/project-detector/detector.ts +2 -4
  15. package/harness/secret-provider.ts +2 -0
  16. package/harness/task-graph.ts +460 -113
  17. package/index.ts +16 -7
  18. package/package.json +7 -1
  19. package/packages/a2a-adapter/package.json +1 -1
  20. package/packages/agent-policy/dist/extension.d.ts.map +1 -1
  21. package/packages/agent-policy/dist/extension.js +2 -0
  22. package/packages/agent-policy/dist/extension.js.map +1 -1
  23. package/packages/agent-policy/package.json +1 -1
  24. package/packages/agent-policy/src/extension.ts +2 -0
  25. package/packages/architecture-generator/package.json +1 -1
  26. package/packages/auth/dist/minimax-browser-auth.d.ts.map +1 -1
  27. package/packages/auth/dist/minimax-browser-auth.js +23 -1
  28. package/packages/auth/dist/minimax-browser-auth.js.map +1 -1
  29. package/packages/auth/package.json +1 -1
  30. package/packages/auth/src/minimax-browser-auth.ts +30 -5
  31. package/packages/autonomous-refactor/package.json +1 -1
  32. package/packages/autonomous-runtime/dist/inbox.d.ts.map +1 -1
  33. package/packages/autonomous-runtime/dist/inbox.js +2 -0
  34. package/packages/autonomous-runtime/dist/inbox.js.map +1 -1
  35. package/packages/autonomous-runtime/package.json +1 -1
  36. package/packages/autonomous-runtime/src/inbox.ts +2 -0
  37. package/packages/cache-strategy/package.json +1 -1
  38. package/packages/capability-registry/package.json +1 -1
  39. package/packages/checkpoint/package.json +1 -1
  40. package/packages/cli-plugin-sdk/package.json +1 -1
  41. package/packages/clipboard/dist/src/clipboard.d.ts.map +1 -1
  42. package/packages/clipboard/dist/src/clipboard.js +2 -0
  43. package/packages/clipboard/dist/src/clipboard.js.map +1 -1
  44. package/packages/clipboard/dist/src/copy-sync.d.ts.map +1 -1
  45. package/packages/clipboard/dist/src/copy-sync.js +2 -0
  46. package/packages/clipboard/dist/src/copy-sync.js.map +1 -1
  47. package/packages/clipboard/dist/src/gist-relay.d.ts.map +1 -1
  48. package/packages/clipboard/dist/src/gist-relay.js +2 -0
  49. package/packages/clipboard/dist/src/gist-relay.js.map +1 -1
  50. package/packages/clipboard/package.json +1 -1
  51. package/packages/clipboard/src/clipboard.ts +2 -0
  52. package/packages/clipboard/src/copy-sync.ts +2 -0
  53. package/packages/clipboard/src/gist-relay.ts +2 -0
  54. package/packages/clipboard-plugin/dist/types.d.ts +9 -2
  55. package/packages/clipboard-plugin/dist/types.d.ts.map +1 -1
  56. package/packages/clipboard-plugin/package.json +1 -1
  57. package/packages/clipboard-plugin/src/types.ts +9 -2
  58. package/packages/code-generation/package.json +1 -1
  59. package/packages/code-review/package.json +1 -1
  60. package/packages/codex-adapter/package.json +1 -1
  61. package/packages/codex-watcher/package.json +1 -1
  62. package/packages/config-capture/package.json +1 -1
  63. package/packages/connection-runtime/package.json +1 -1
  64. package/packages/context-compiler/package.json +1 -1
  65. package/packages/context-discovery/package.json +1 -1
  66. package/packages/context-manager/package.json +1 -1
  67. package/packages/contracts/dist/delegation-store.js +1 -4
  68. package/packages/contracts/dist/workspace-env.js +28 -1
  69. package/packages/contracts/package.json +1 -1
  70. package/packages/contracts/src/delegation-store.ts +9 -4
  71. package/packages/contracts/src/workspace-env.ts +29 -4
  72. package/packages/cookie-sanitizer/package.json +1 -1
  73. package/packages/cost-optimizer/package.json +1 -1
  74. package/packages/dependency-analyzer/package.json +1 -1
  75. package/packages/django-plugin/package.json +1 -1
  76. package/packages/doc-generator/package.json +1 -1
  77. package/packages/durable-review/package.json +1 -1
  78. package/packages/e2e-tester/package.json +1 -1
  79. package/packages/evaluation-engine/package.json +1 -1
  80. package/packages/evaluation-runner/package.json +1 -1
  81. package/packages/event-bus/package.json +1 -1
  82. package/packages/event-sink/package.json +1 -1
  83. package/packages/event-store/dist/src/store.d.ts.map +1 -1
  84. package/packages/event-store/dist/src/store.js +2 -0
  85. package/packages/event-store/dist/src/store.js.map +1 -1
  86. package/packages/event-store/package.json +1 -1
  87. package/packages/event-store/src/store.ts +3 -0
  88. package/packages/experience-replay/package.json +1 -1
  89. package/packages/feedback-collector/package.json +1 -1
  90. package/packages/file-copy-helper/package.json +1 -1
  91. package/packages/framework-detector/package.json +1 -1
  92. package/packages/framework-plugin-sdk/package.json +1 -1
  93. package/packages/frappe-plugin/package.json +1 -1
  94. package/packages/generic-web-plugin/dist/analyzer.d.ts.map +1 -1
  95. package/packages/generic-web-plugin/dist/analyzer.js +2 -0
  96. package/packages/generic-web-plugin/dist/analyzer.js.map +1 -1
  97. package/packages/generic-web-plugin/package.json +1 -1
  98. package/packages/generic-web-plugin/src/analyzer.ts +3 -0
  99. package/packages/health-monitor/package.json +1 -1
  100. package/packages/intent-analyzer/package.json +1 -1
  101. package/packages/jev-judge/package.json +1 -1
  102. package/packages/knowledge-graph/package.json +1 -1
  103. package/packages/knowledge-retrieval/dist/mcp-client.d.ts.map +1 -1
  104. package/packages/knowledge-retrieval/dist/mcp-client.js +0 -1
  105. package/packages/knowledge-retrieval/dist/mcp-client.js.map +1 -1
  106. package/packages/knowledge-retrieval/package.json +1 -4
  107. package/packages/knowledge-retrieval/src/mcp-client.ts +0 -1
  108. package/packages/laravel-plugin/package.json +1 -1
  109. package/packages/learning-engine/package.json +1 -1
  110. package/packages/logging/package.json +1 -1
  111. package/packages/mcp-adapter/dist/server.d.ts.map +1 -1
  112. package/packages/mcp-adapter/dist/server.js +2 -0
  113. package/packages/mcp-adapter/dist/server.js.map +1 -1
  114. package/packages/mcp-adapter/package.json +1 -1
  115. package/packages/mcp-adapter/src/server.ts +3 -0
  116. package/packages/memory-engine/package.json +1 -1
  117. package/packages/milestone-manager/package.json +1 -1
  118. package/packages/model-registry/package.json +1 -1
  119. package/packages/nextjs-plugin/package.json +1 -1
  120. package/packages/notification/package.json +1 -1
  121. package/packages/observability/package.json +1 -1
  122. package/packages/okf-indexer/package.json +1 -1
  123. package/packages/paperclip-integration/dist/index.d.ts.map +1 -1
  124. package/packages/paperclip-integration/dist/index.js +2 -0
  125. package/packages/paperclip-integration/dist/index.js.map +1 -1
  126. package/packages/paperclip-integration/package.json +1 -1
  127. package/packages/paperclip-integration/src/index.ts +2 -0
  128. package/packages/performance-optimizer/package.json +1 -1
  129. package/packages/permission-mode/package.json +1 -1
  130. package/packages/privilege-broker/dist/audit.d.ts.map +1 -1
  131. package/packages/privilege-broker/dist/audit.js +2 -0
  132. package/packages/privilege-broker/dist/audit.js.map +1 -1
  133. package/packages/privilege-broker/package.json +1 -1
  134. package/packages/privilege-broker/src/audit.ts +2 -0
  135. package/packages/project-analyzer/package.json +1 -1
  136. package/packages/project-bootstrap/package.json +1 -1
  137. package/packages/projection-engine/package.json +1 -1
  138. package/packages/prompt-compiler/dist/compiler.d.ts.map +1 -1
  139. package/packages/prompt-compiler/dist/compiler.js +2 -0
  140. package/packages/prompt-compiler/dist/compiler.js.map +1 -1
  141. package/packages/prompt-compiler/package.json +1 -1
  142. package/packages/prompt-compiler/src/compiler.ts +2 -0
  143. package/packages/prompt-versioning/package.json +1 -1
  144. package/packages/provider-adapter-sdk/package.json +1 -1
  145. package/packages/provider-router/package.json +1 -1
  146. package/packages/provider-selector/package.json +1 -1
  147. package/packages/providers/package.json +1 -1
  148. package/packages/qdrant-skills/package.json +1 -1
  149. package/packages/quota-manager/package.json +1 -1
  150. package/packages/rate-limiter/package.json +1 -1
  151. package/packages/react-vite-plugin/package.json +1 -1
  152. package/packages/relay/package.json +1 -1
  153. package/packages/release-manager/package.json +1 -1
  154. package/packages/requirement-compiler/package.json +1 -1
  155. package/packages/runtime/package.json +1 -1
  156. package/packages/scheduler/package.json +1 -1
  157. package/packages/scheduler-adapter/package.json +1 -1
  158. package/packages/session/package.json +1 -1
  159. package/packages/session-api/package.json +1 -1
  160. package/packages/session-export/package.json +1 -1
  161. package/packages/shared-context/package.json +1 -1
  162. package/packages/skill-mcp-client/dist/client.d.ts.map +1 -1
  163. package/packages/skill-mcp-client/dist/client.js +0 -1
  164. package/packages/skill-mcp-client/dist/client.js.map +1 -1
  165. package/packages/skill-mcp-client/package.json +1 -4
  166. package/packages/skill-mcp-client/src/client.ts +0 -1
  167. package/packages/skill-registry/package.json +1 -1
  168. package/packages/skills/dist/parser.d.ts.map +1 -1
  169. package/packages/skills/dist/parser.js +2 -0
  170. package/packages/skills/dist/parser.js.map +1 -1
  171. package/packages/skills/dist/skill-versioning.d.ts.map +1 -1
  172. package/packages/skills/dist/skill-versioning.js +2 -0
  173. package/packages/skills/dist/skill-versioning.js.map +1 -1
  174. package/packages/skills/package.json +1 -1
  175. package/packages/skills/src/parser.ts +3 -0
  176. package/packages/skills/src/skill-versioning.ts +2 -0
  177. package/packages/sprint-planner/package.json +1 -1
  178. package/packages/subscription-engine/package.json +1 -1
  179. package/packages/task-compiler/package.json +1 -1
  180. package/packages/tencentdb-memory/package.json +1 -1
  181. package/packages/tencentdb-sync/package.json +1 -1
  182. package/packages/test-data-generator/package.json +1 -1
  183. package/packages/test-generator/package.json +1 -1
  184. package/packages/todo-bd-sync/package.json +1 -1
  185. package/packages/token-estimation/package.json +1 -1
  186. package/packages/token-optimizer/package.json +1 -1
  187. package/packages/tooling-preference/package.json +1 -1
  188. package/packages/trajectory/package.json +1 -1
  189. package/packages/tui/package.json +1 -1
  190. package/packages/two-phase-review/package.json +1 -1
  191. package/packages/types/package.json +1 -1
  192. package/packages/voice-api/package.json +1 -1
  193. package/packages/webmcp-tester/dist/index.js +0 -2
  194. package/packages/webmcp-tester/package.json +1 -1
  195. package/packages/webmcp-tester/src/index.ts +0 -3
  196. package/packages/wiki/package.json +1 -1
  197. package/packages/workflow-events/package.json +1 -1
  198. package/packages/workspace-scanner/package.json +1 -1
  199. package/packages/worktree/package.json +1 -1
  200. package/packages/write-review/dist/trigger.d.ts.map +1 -1
  201. package/packages/write-review/dist/trigger.js +1 -2
  202. package/packages/write-review/dist/trigger.js.map +1 -1
  203. package/packages/write-review/package.json +1 -1
  204. package/packages/write-review/src/trigger.ts +1 -2
  205. package/scripts/lib/runtime-imports.ts +189 -3
  206. package/scripts/release-all.ts +5 -3
  207. package/scripts/telegram-webhook-server.ts +2 -0
  208. package/scripts/typecheck-packages.mjs +7 -4
  209. package/scripts/verify-package-contents.ts +161 -2
  210. package/harness/e2e/tools-detector.test.ts +0 -156
  211. package/harness/glm-quota-countdown.test.ts +0 -323
  212. package/harness/langchain/agents.test.ts +0 -39
  213. package/harness/langchain/checkpointer.test.ts +0 -243
  214. package/harness/langchain/daemon.test.ts +0 -459
  215. package/harness/langchain/model-router.test.ts +0 -191
  216. package/harness/langchain/ping-pong-middleware.test.ts +0 -69
  217. package/harness/langchain/scoreboard.test.ts +0 -245
  218. package/harness/langchain/status-line.test.ts +0 -106
  219. package/harness/langchain/surge.test.ts +0 -467
  220. package/harness/langchain/widget.test.ts +0 -251
  221. package/harness/skill-sync.test.ts +0 -57
  222. package/harness/ssh-detach-interceptor.test.ts +0 -263
  223. package/harness/ssh-hang-recovery.test.ts +0 -86
  224. package/packages/a2a-adapter/test/a2a.test.ts +0 -151
  225. package/packages/agent-policy/test/interlock.test.ts +0 -101
  226. package/packages/agent-policy/test/policy-retention.test.ts +0 -380
  227. package/packages/agent-policy/test/policy.test.ts +0 -387
  228. package/packages/auth/test/auth.test.ts +0 -238
  229. package/packages/autonomous-refactor/test/refactor.test.ts +0 -202
  230. package/packages/autonomous-runtime/test/types.test.ts +0 -95
  231. package/packages/cache-strategy/test/cache.test.ts +0 -137
  232. package/packages/capability-registry/test/registry.test.ts +0 -204
  233. package/packages/checkpoint/test/engine.test.ts +0 -265
  234. package/packages/cli-plugin-sdk/test/cli.test.ts +0 -45
  235. package/packages/code-generation/test/generator.test.ts +0 -238
  236. package/packages/code-review/test/engine.test.ts +0 -302
  237. package/packages/codex-adapter/test/provider.test.ts +0 -142
  238. package/packages/codex-watcher/test/watch.test.ts +0 -453
  239. package/packages/context-compiler/test/context-compiler.test.ts +0 -746
  240. package/packages/context-manager/test/context.test.ts +0 -198
  241. package/packages/contracts/test/delegation.test.ts +0 -350
  242. package/packages/contracts/test/workspace-env.test.ts +0 -802
  243. package/packages/cookie-sanitizer/test/infer.test.ts +0 -110
  244. package/packages/cookie-sanitizer/test/normalize.test.ts +0 -113
  245. package/packages/cookie-sanitizer/test/parse.test.ts +0 -204
  246. package/packages/cookie-sanitizer/test/sync.test.ts +0 -237
  247. package/packages/cookie-sanitizer/test/watcher.test.ts +0 -27
  248. package/packages/cost-optimizer/test/cost-optimizer.test.ts +0 -438
  249. package/packages/dependency-analyzer/test/analyzer.test.ts +0 -49
  250. package/packages/django-plugin/test/analyzer.test.ts +0 -195
  251. package/packages/doc-generator/test/docs.test.ts +0 -168
  252. package/packages/durable-review/test/acceptance.test.ts +0 -357
  253. package/packages/durable-review/test/smoke.test.ts +0 -107
  254. package/packages/evaluation-engine/test/engine.test.ts +0 -277
  255. package/packages/evaluation-runner/test/runner.test.ts +0 -168
  256. package/packages/event-bus/test/bus.test.ts +0 -100
  257. package/packages/event-store/test/store.test.ts +0 -115
  258. package/packages/experience-replay/test/replay.test.ts +0 -267
  259. package/packages/feedback-collector/test/collector.test.ts +0 -142
  260. package/packages/framework-detector/test/detector.test.ts +0 -75
  261. package/packages/framework-plugin-sdk/test/manager.test.ts +0 -320
  262. package/packages/frappe-plugin/test/analyzer.test.ts +0 -250
  263. package/packages/generic-web-plugin/test/analyzer.test.ts +0 -134
  264. package/packages/health-monitor/test/health.test.ts +0 -231
  265. package/packages/intent-analyzer/test/analyzer.test.ts +0 -72
  266. package/packages/intent-analyzer/test/ping-pong.test.ts +0 -96
  267. package/packages/jev-judge/tests/auto-continue-context.test.ts +0 -280
  268. package/packages/jev-judge/tests/continuation-controller.test.ts +0 -1396
  269. package/packages/jev-judge/tests/jev-provider-chain.test.ts +0 -536
  270. package/packages/jev-judge/tests/outcome-application.test.ts +0 -132
  271. package/packages/jev-judge/tests/question-risk.test.ts +0 -129
  272. package/packages/jev-judge/tests/typesafe-provider.test.ts +0 -640
  273. package/packages/jev-judge/tests/validation-ledger.test.ts +0 -181
  274. package/packages/jev-judge/tests/validation-plan.test.ts +0 -170
  275. package/packages/jev-judge/tests/validation-tie-breaker.test.ts +0 -88
  276. package/packages/laravel-plugin/test/analyzer.test.ts +0 -220
  277. package/packages/learning-engine/test/engine.test.ts +0 -331
  278. package/packages/logging/test/buffer.test.ts +0 -44
  279. package/packages/logging/test/classification.test.ts +0 -137
  280. package/packages/logging/test/config.test.ts +0 -97
  281. package/packages/logging/test/fanout.test.ts +0 -186
  282. package/packages/logging/test/identity-transport.test.ts +0 -197
  283. package/packages/logging/test/incidents.test.ts +0 -404
  284. package/packages/logging/test/ingest-schema.test.ts +0 -184
  285. package/packages/logging/test/integration.test.ts +0 -140
  286. package/packages/logging/test/log-http.test.ts +0 -246
  287. package/packages/logging/test/redact.test.ts +0 -109
  288. package/packages/logging/test/sampler.test.ts +0 -57
  289. package/packages/logging/test/server.test.ts +0 -444
  290. package/packages/logging/test/shipper.test.ts +0 -152
  291. package/packages/logging/test/spool.test.ts +0 -96
  292. package/packages/mcp-adapter/test/server.test.ts +0 -91
  293. package/packages/memory-engine/test/engine.test.ts +0 -456
  294. package/packages/model-registry/test/registry.test.ts +0 -342
  295. package/packages/nextjs-plugin/test/analyzer.test.ts +0 -149
  296. package/packages/notification/test/approval-payload.test.ts +0 -269
  297. package/packages/notification/test/detail-format.test.ts +0 -106
  298. package/packages/notification/test/notification.test.ts +0 -375
  299. package/packages/notification/test/pending-question-lifecycle.test.ts +0 -195
  300. package/packages/notification/test/pending-question.test.ts +0 -331
  301. package/packages/notification/test/tooling-proposal-payload.test.ts +0 -212
  302. package/packages/observability/test/observability.test.ts +0 -1350
  303. package/packages/performance-optimizer/test/optimizer.test.ts +0 -267
  304. package/packages/project-analyzer/test/index.test.ts +0 -1719
  305. package/packages/prompt-compiler/test/prompt-compiler.test.ts +0 -813
  306. package/packages/prompt-versioning/test/versioning.test.ts +0 -112
  307. package/packages/provider-adapter-sdk/test/sdk.test.ts +0 -220
  308. package/packages/provider-router/test/provider-router.test.ts +0 -405
  309. package/packages/provider-selector/test/selector.test.ts +0 -192
  310. package/packages/providers/test/providers.test.ts +0 -225
  311. package/packages/qdrant-skills/test/collection-info.test.ts +0 -165
  312. package/packages/qdrant-skills/test/embedder-batch.test.ts +0 -184
  313. package/packages/qdrant-skills/test/embedder.test.ts +0 -97
  314. package/packages/quota-manager/test/quota.test.ts +0 -432
  315. package/packages/rate-limiter/test/limiter.test.ts +0 -128
  316. package/packages/react-vite-plugin/test/analyzer.test.ts +0 -139
  317. package/packages/relay/test/client.test.ts +0 -446
  318. package/packages/relay/test/relay-e2e.test.ts +0 -299
  319. package/packages/relay/test/relay-endpoint.test.ts +0 -278
  320. package/packages/release-manager/test/release.test.ts +0 -215
  321. package/packages/requirement-compiler/test/requirement-compiler.test.ts +0 -743
  322. package/packages/runtime/test/runtime-api.test.ts +0 -169
  323. package/packages/runtime/test/runtime.test.ts +0 -297
  324. package/packages/scheduler/test/scheduler.test.ts +0 -125
  325. package/packages/session/test/manager.test.ts +0 -233
  326. package/packages/shared-context/test/shared-context.test.ts +0 -114
  327. package/packages/skill-registry/test/registry.test.ts +0 -508
  328. package/packages/skills/test/init-skills.test.ts +0 -114
  329. package/packages/skills/test/remote-skills.test.ts +0 -360
  330. package/packages/skills/test/remote-source.test.ts +0 -248
  331. package/packages/skills/test/sanitize.test.ts +0 -250
  332. package/packages/skills/test/vector-indexing.test.ts +0 -205
  333. package/packages/skills/test/vector-schema.test.ts +0 -180
  334. package/packages/skills/test/vector-threshold.test.ts +0 -108
  335. package/packages/sprint-planner/test/planner.test.ts +0 -187
  336. package/packages/task-compiler/test/task-compiler.test.ts +0 -628
  337. package/packages/test-data-generator/test/generator.test.ts +0 -265
  338. package/packages/test-generator/test/generator.test.ts +0 -156
  339. package/packages/token-estimation/test/token-estimation.test.ts +0 -207
  340. package/packages/token-optimizer/test/optimizer.test.ts +0 -141
  341. package/packages/tooling-preference/tests/changed-files.test.ts +0 -124
  342. package/packages/tooling-preference/tests/detect.test.ts +0 -188
  343. package/packages/tooling-preference/tests/proposal.test.ts +0 -107
  344. package/packages/tooling-preference/tests/quality-check.test.ts +0 -272
  345. package/packages/tooling-preference/tests/registry.test.ts +0 -51
  346. package/packages/tooling-preference/tests/store.test.ts +0 -99
  347. package/packages/trajectory/test/store.test.ts +0 -250
  348. package/packages/tui/test/harness-footer.test.ts +0 -559
  349. package/packages/tui/test/harness-header.test.ts +0 -590
  350. package/packages/two-phase-review/test/classify.test.ts +0 -102
  351. package/packages/two-phase-review/test/helpers.ts +0 -72
  352. package/packages/two-phase-review/test/rules.test.ts +0 -150
  353. package/packages/two-phase-review/test/runtime.test.ts +0 -362
  354. package/packages/two-phase-review/test/scope.test.ts +0 -186
  355. package/packages/two-phase-review/test/signals.test.ts +0 -183
  356. package/packages/two-phase-review/test/state.test.ts +0 -201
  357. package/packages/wiki/test/basic.test.ts +0 -242
  358. package/packages/workspace-scanner/test/scanner.test.ts +0 -43
  359. package/packages/worktree/test/worktree.test.ts +0 -163
@@ -1,360 +0,0 @@
1
- /**
2
- * The skills that only exist in the vector store.
3
- *
4
- * The vector store holds the skills of a team. A client that has no local
5
- * copy of a skill must still be able to find it - and to use it: the
6
- * payload carries the name, the description and the body.
7
- *
8
- * The registry used to DROP every hit whose skill was not registered
9
- * locally, so a shared skill was invisible on every machine that had no
10
- * local copy of it - which is exactly the case the vector store exists for.
11
- *
12
- * The client and the embedder are injected, so the test neither reaches the
13
- * network nor replaces a process-global module.
14
- */
15
-
16
- import { afterEach, beforeEach, describe, expect, it } from "bun:test";
17
- import { fileURLToPath } from "node:url";
18
-
19
- import {
20
- createSkillRegistry,
21
- type QdrantClientLike,
22
- type QdrantEmbedderLike,
23
- } from "../src/loader.js";
24
- import { resetSanitizationRulesCache } from "../src/sanitize-rules.js";
25
- import type { Skill } from "../src/types.js";
26
-
27
- /**
28
- * The rules of the test.
29
- *
30
- * The rules of a client live in a local file, outside the repository. The
31
- * test uses a fixture with made up names, so that the result of the test
32
- * does not depend on the machine it runs on.
33
- */
34
- const FIXTURE = fileURLToPath(
35
- new URL("./fixtures/sanitization.json", import.meta.url),
36
- );
37
- const originalEnv = process.env.PI_SKILL_SANITIZATION_FILE;
38
-
39
- beforeEach(() => {
40
- process.env.PI_SKILL_SANITIZATION_FILE = FIXTURE;
41
- resetSanitizationRulesCache();
42
- });
43
-
44
- afterEach(() => {
45
- resetSanitizationRulesCache();
46
- if (originalEnv === undefined) delete process.env.PI_SKILL_SANITIZATION_FILE;
47
- else process.env.PI_SKILL_SANITIZATION_FILE = originalEnv;
48
- });
49
-
50
- /** A point of the vector store. */
51
- interface VectorPoint {
52
- id: number;
53
- score: number;
54
- payload?: Record<string, unknown>;
55
- }
56
-
57
- /** A client that answers a query with the given points. */
58
- function fakeClient(
59
- points: VectorPoint[],
60
- description?: Record<string, unknown>,
61
- ): QdrantClientLike & { queries: number } {
62
- const client = {
63
- queries: 0,
64
- async upsert(): Promise<void> {},
65
- async query(): Promise<unknown> {
66
- client.queries += 1;
67
- return { points };
68
- },
69
- async getCollection(): Promise<unknown> {
70
- if (!description) throw new Error("Not found: Collection not found");
71
- return description;
72
- },
73
- };
74
- return client;
75
- }
76
-
77
- /** An embedder that returns a fixed vector. */
78
- const fakeEmbedder: QdrantEmbedderLike = {
79
- async createEmbedding() {
80
- return { embedding: [0.1, 0.2, 0.3], tokens: 3 };
81
- },
82
- };
83
-
84
- /** A local skill, as the scanner would register it. */
85
- function localSkill(id: string): Skill {
86
- return {
87
- id,
88
- path: `/tmp/skills/${id}`,
89
- frontmatter: { name: id, description: `the local ${id}` },
90
- body: `the local body of ${id}`,
91
- references: [],
92
- examples: [],
93
- metadata: { name: id, description: `the local ${id}` },
94
- loaded: false,
95
- };
96
- }
97
-
98
- describe("a skill that only exists in the vector store", () => {
99
- it("is found instead of being dropped", async () => {
100
- const client = fakeClient([
101
- {
102
- id: 19,
103
- score: 0.91,
104
- payload: {
105
- name: "frappe-doctype-field-order",
106
- description: "the shared skill",
107
- body: "the shared body",
108
- },
109
- },
110
- ]);
111
- const registry = createSkillRegistry({
112
- qdrantClient: client,
113
- embedder: fakeEmbedder,
114
- collection: "pi-harness-skills-test",
115
- });
116
-
117
- const results = await registry.findVector("field order");
118
-
119
- expect(results).toHaveLength(1);
120
- expect(results[0].source).toBe("remote");
121
- expect(results[0].skill.id).toBe("frappe-doctype-field-order");
122
- // The payload is the skill - the body travels with it.
123
- expect(results[0].skill.body).toBe("the shared body");
124
- expect(results[0].skill.frontmatter.description).toBe("the shared skill");
125
- });
126
-
127
- it("does not count as a local skill", async () => {
128
- const client = fakeClient([
129
- { id: 19, score: 0.9, payload: { name: "shared", description: "d", body: "b" } },
130
- ]);
131
- const registry = createSkillRegistry({
132
- qdrantClient: client,
133
- embedder: fakeEmbedder,
134
- collection: "pi-harness-skills-test",
135
- });
136
- registry.register(localSkill("local-one"));
137
-
138
- await registry.findVector("shared");
139
-
140
- // The local count stays local - that is what the startup line shows.
141
- expect(registry.list()).toHaveLength(1);
142
- expect(registry.list().map((skill) => skill.id)).toEqual(["local-one"]);
143
- expect(registry.listRemote().map((skill) => skill.id)).toEqual(["shared"]);
144
- });
145
-
146
- it("can be loaded without a local directory", async () => {
147
- const client = fakeClient([
148
- { id: 19, score: 0.9, payload: { name: "shared", description: "d", body: "the body" } },
149
- ]);
150
- const registry = createSkillRegistry({
151
- qdrantClient: client,
152
- embedder: fakeEmbedder,
153
- collection: "pi-harness-skills-test",
154
- });
155
-
156
- await registry.findVector("shared");
157
- const loaded = await registry.load("shared");
158
-
159
- expect(loaded).not.toBeNull();
160
- expect(loaded?.body).toBe("the body");
161
- expect(loaded?.path).toBe("");
162
- });
163
-
164
- it("marks a local hit as local", async () => {
165
- const client = fakeClient([
166
- { id: 1, score: 0.9, payload: { name: "local-one", description: "d", body: "b" } },
167
- ]);
168
- const registry = createSkillRegistry({
169
- qdrantClient: client,
170
- embedder: fakeEmbedder,
171
- collection: "pi-harness-skills-test",
172
- });
173
- registry.register(localSkill("local-one"));
174
-
175
- const results = await registry.findVector("local");
176
-
177
- expect(results).toHaveLength(1);
178
- expect(results[0].source).toBe("local");
179
- expect(results[0].skill.path).toBe("/tmp/skills/local-one");
180
- });
181
-
182
- it("skips a hit without a name", async () => {
183
- const client = fakeClient([
184
- { id: 1, score: 0.9, payload: { description: "no name" } },
185
- { id: 2, score: 0.8, payload: { name: "", description: "empty name" } },
186
- ]);
187
- const registry = createSkillRegistry({
188
- qdrantClient: client,
189
- embedder: fakeEmbedder,
190
- collection: "pi-harness-skills-test",
191
- });
192
-
193
- expect(await registry.findVector("anything")).toHaveLength(0);
194
- });
195
- });
196
-
197
- describe("a hit that carries the shared name of a local skill", () => {
198
- it("resolves to the local skill", async () => {
199
- // The collection is shared, so the point carries the SANITIZED name.
200
- const client = fakeClient([
201
- {
202
- id: 1,
203
- score: 0.9,
204
- payload: {
205
- name: "client-a-pe-approval-workflow",
206
- description: "the workflow",
207
- body: "the body",
208
- },
209
- },
210
- ]);
211
- const registry = createSkillRegistry({
212
- qdrantClient: client,
213
- embedder: fakeEmbedder,
214
- collection: "pi-harness-skills-test",
215
- });
216
- registry.register(localSkill("acmecorp-pe-approval-workflow"));
217
-
218
- const results = await registry.findVector("workflow");
219
-
220
- expect(results).toHaveLength(1);
221
- // The skill of this machine stays a local skill - with its own
222
- // name and its own body, not the sanitized copy.
223
- expect(results[0].source).toBe("local");
224
- expect(results[0].skill.id).toBe("acmecorp-pe-approval-workflow");
225
- expect(results[0].skill.body).toBe(
226
- "the local body of acmecorp-pe-approval-workflow",
227
- );
228
- });
229
-
230
- it("resolves the shared name of a local skill in a lookup", () => {
231
- const registry = createSkillRegistry({ indexer: null });
232
- registry.register(localSkill("acmecorp-pe-approval-workflow"));
233
-
234
- expect(registry.get("client-a-pe-approval-workflow")?.id).toBe(
235
- "acmecorp-pe-approval-workflow",
236
- );
237
- });
238
- });
239
-
240
- describe("the state of the vector store", () => {
241
- it("reports the number of skills", async () => {
242
- const client = fakeClient([], {
243
- points_count: 79,
244
- config: { params: { vectors: { size: 1536, distance: "Cosine" } } },
245
- });
246
- const registry = createSkillRegistry({
247
- qdrantClient: client,
248
- embedder: fakeEmbedder,
249
- collection: "pi-harness-skills-openai-v1",
250
- });
251
-
252
- const stats = await registry.getQdrantStats();
253
-
254
- expect(stats.state).toBe("populated");
255
- expect(stats.count).toBe(79);
256
- expect(stats.dimensions).toBe(1536);
257
- expect(stats.schemaMismatch).toBeUndefined();
258
- });
259
-
260
- it("names the real cause of an incompatible collection", async () => {
261
- const client = fakeClient([], {
262
- points_count: 79,
263
- config: { params: { vectors: { size: 384, distance: "Cosine" } } },
264
- });
265
- const registry = createSkillRegistry({
266
- qdrantClient: client,
267
- embedder: fakeEmbedder,
268
- collection: "pi-harness-skills",
269
- });
270
-
271
- const stats = await registry.getQdrantStats();
272
-
273
- // The mismatch names the numbers, so the reader knows WHICH schema
274
- // the collection was built with.
275
- expect(stats.schemaMismatch).toContain("384");
276
- expect(stats.schemaMismatch).toContain("1536");
277
- expect(stats.schemaMismatch).toContain("sync-to-qdrant.ts");
278
- });
279
-
280
- it("reports an empty collection", async () => {
281
- const client = fakeClient([], {
282
- points_count: 0,
283
- config: { params: { vectors: { size: 1536, distance: "Cosine" } } },
284
- });
285
- const registry = createSkillRegistry({
286
- qdrantClient: client,
287
- embedder: fakeEmbedder,
288
- collection: "pi-harness-skills-openai-v1",
289
- });
290
-
291
- const stats = await registry.getQdrantStats();
292
-
293
- expect(stats.state).toBe("empty");
294
- expect(stats.count).toBe(0);
295
- });
296
-
297
- it("reports a collection that does not exist", async () => {
298
- const client = fakeClient([]);
299
- const registry = createSkillRegistry({
300
- qdrantClient: client,
301
- embedder: fakeEmbedder,
302
- collection: "pi-harness-skills-openai-v1",
303
- });
304
-
305
- const stats = await registry.getQdrantStats();
306
-
307
- expect(stats.state).toBe("missing");
308
- expect(stats.count).toBe(0);
309
- });
310
-
311
- it("names the skills of the legacy collection", async () => {
312
- // The runtime collection does not exist yet, but the collection of
313
- // the previous version still holds the skills. They are not lost -
314
- // the reader has to know where they are.
315
- const client = {
316
- async upsert(): Promise<void> {},
317
- async query(): Promise<unknown> {
318
- return { points: [] };
319
- },
320
- async getCollection(name: string): Promise<unknown> {
321
- if (name === "pi-harness-skills") {
322
- return {
323
- points_count: 79,
324
- config: { params: { vectors: { size: 384, distance: "Cosine" } } },
325
- };
326
- }
327
- throw new Error("Not Found");
328
- },
329
- };
330
- const registry = createSkillRegistry({
331
- qdrantClient: client as never,
332
- embedder: fakeEmbedder,
333
- collection: "pi-harness-skills-openai-v1",
334
- });
335
-
336
- const stats = await registry.getQdrantStats();
337
-
338
- expect(stats.state).toBe("missing");
339
- expect(stats.legacy?.collection).toBe("pi-harness-skills");
340
- expect(stats.legacy?.count).toBe(79);
341
- expect(stats.legacy?.dimensions).toBe(384);
342
- expect(stats.legacy?.model).toBe("sentence-transformers/all-MiniLM-L6-v2");
343
- });
344
-
345
- it("does not look for a second collection when the legacy one is the runtime one", async () => {
346
- const client = fakeClient([], {
347
- points_count: 0,
348
- config: { params: { vectors: { size: 1536, distance: "Cosine" } } },
349
- });
350
- const registry = createSkillRegistry({
351
- qdrantClient: client,
352
- embedder: fakeEmbedder,
353
- collection: "pi-harness-skills",
354
- });
355
-
356
- const stats = await registry.getQdrantStats();
357
-
358
- expect(stats.legacy).toBeUndefined();
359
- });
360
- });
@@ -1,248 +0,0 @@
1
- /**
2
- * The skills that live on the server.
3
- *
4
- * The vector store is an index - it says WHICH skill fits a question. The
5
- * service holds the authoritative files, so a machine without a local copy
6
- * can still use a skill.
7
- *
8
- * The states must stay apart: a service that refused the call needs a
9
- * different fix than a service that could not be reached, and both differ
10
- * from a service that holds nothing.
11
- *
12
- * The source is injected, so the test neither reaches the network nor
13
- * replaces a process-global module.
14
- */
15
-
16
- import { describe, expect, it } from "bun:test";
17
-
18
- import { createSkillRegistry } from "../src/loader.js";
19
- import type { RemoteSkill, RemoteSkillSource } from "../src/remote-source.js";
20
-
21
- /** A source that holds the given skills. */
22
- class FakeSource implements RemoteSkillSource {
23
- /** The skills the source holds. */
24
- readonly skills: RemoteSkill[];
25
- /** The ids that were asked for. */
26
- readonly requested: string[] = [];
27
- /** The error the next call raises. */
28
- failure: { message: string; code: "denied" | "unavailable" } | null = null;
29
-
30
- constructor(skills: RemoteSkill[] = []) {
31
- this.skills = skills;
32
- }
33
-
34
- async list(): Promise<RemoteSkill[]> {
35
- if (this.failure) {
36
- const error = new Error(this.failure.message) as Error & {
37
- code: string;
38
- };
39
- error.code = this.failure.code;
40
- throw error;
41
- }
42
- return this.skills;
43
- }
44
-
45
- async get(id: string): Promise<RemoteSkill | null> {
46
- this.requested.push(id);
47
- if (this.failure) {
48
- const error = new Error(this.failure.message) as Error & {
49
- code: string;
50
- };
51
- error.code = this.failure.code;
52
- throw error;
53
- }
54
- return this.skills.find((skill) => skill.id === id) ?? null;
55
- }
56
- }
57
-
58
- describe("the skills of the server", () => {
59
- it("are listed by the registry", async () => {
60
- const source = new FakeSource([
61
- {
62
- id: "shared-skill",
63
- name: "shared-skill",
64
- description: "the shared skill",
65
- version: "1.2.0",
66
- },
67
- ]);
68
- const registry = createSkillRegistry();
69
- registry.setRemoteSource(source);
70
-
71
- const stats = await registry.refreshRemoteSkills();
72
-
73
- expect(stats.state).toBe("populated");
74
- expect(stats.count).toBe(1);
75
- expect(registry.listRemote().map((skill) => skill.id)).toEqual(["shared-skill"]);
76
- // The local count stays local.
77
- expect(registry.list()).toHaveLength(0);
78
- });
79
-
80
- it("are not local skills", async () => {
81
- const source = new FakeSource([
82
- { id: "shared-skill", name: "shared-skill", description: "d", version: "1.0.0" },
83
- ]);
84
- const registry = createSkillRegistry();
85
- registry.setRemoteSource(source);
86
- await registry.refreshRemoteSkills();
87
-
88
- expect(registry.list()).toHaveLength(0);
89
- expect(registry.listRemote()).toHaveLength(1);
90
- });
91
-
92
- it("replace the cached skill when the version changed", async () => {
93
- const source = new FakeSource([
94
- { id: "shared-skill", name: "shared-skill", description: "old", version: "1.0.0" },
95
- ]);
96
- const registry = createSkillRegistry();
97
- registry.setRemoteSource(source);
98
- await registry.refreshRemoteSkills();
99
- expect(registry.listRemote()[0].frontmatter.description).toBe("old");
100
-
101
- // The server publishes a new version.
102
- source.skills[0] = {
103
- id: "shared-skill",
104
- name: "shared-skill",
105
- description: "new",
106
- version: "1.1.0",
107
- };
108
- await registry.refreshRemoteSkills();
109
-
110
- expect(registry.listRemote()[0].frontmatter.description).toBe("new");
111
- expect(registry.listRemote()[0].frontmatter.version).toBe("1.1.0");
112
- });
113
-
114
- it("stay when the version is unknown", async () => {
115
- const source = new FakeSource([
116
- { id: "shared-skill", name: "shared-skill", description: "known", version: "1.0.0" },
117
- ]);
118
- const registry = createSkillRegistry();
119
- registry.setRemoteSource(source);
120
- await registry.refreshRemoteSkills();
121
-
122
- // A record without a version is not evidence of a change.
123
- source.skills[0] = {
124
- id: "shared-skill",
125
- name: "shared-skill",
126
- description: "changed without a version",
127
- };
128
- await registry.refreshRemoteSkills();
129
-
130
- expect(registry.listRemote()[0].frontmatter.description).toBe("known");
131
- });
132
-
133
- it("are loaded completely from the service", async () => {
134
- const source = new FakeSource([
135
- {
136
- id: "shared-skill",
137
- name: "shared-skill",
138
- description: "the shared skill",
139
- version: "1.0.0",
140
- content: "the complete body of the skill",
141
- contentComplete: true,
142
- },
143
- ]);
144
- const registry = createSkillRegistry();
145
- registry.setRemoteSource(source);
146
-
147
- const loaded = await registry.load("shared-skill");
148
-
149
- expect(loaded).not.toBeNull();
150
- expect(loaded?.body).toBe("the complete body of the skill");
151
- expect(source.requested).toContain("shared-skill");
152
- });
153
-
154
- it("are not asked for again once the content is complete", async () => {
155
- const source = new FakeSource([
156
- {
157
- id: "shared-skill",
158
- name: "shared-skill",
159
- description: "d",
160
- version: "1.0.0",
161
- content: "the body",
162
- contentComplete: true,
163
- },
164
- ]);
165
- const registry = createSkillRegistry();
166
- registry.setRemoteSource(source);
167
-
168
- await registry.load("shared-skill");
169
- const afterFirst = source.requested.length;
170
- await registry.load("shared-skill");
171
-
172
- expect(source.requested.length).toBe(afterFirst);
173
- });
174
-
175
- it("are reported as empty when the service holds nothing", async () => {
176
- const registry = createSkillRegistry();
177
- registry.setRemoteSource(new FakeSource([]));
178
-
179
- const stats = await registry.refreshRemoteSkills();
180
-
181
- expect(stats.state).toBe("empty");
182
- expect(stats.count).toBe(0);
183
- });
184
-
185
- it("are reported as not configured without a service", async () => {
186
- const registry = createSkillRegistry();
187
-
188
- const stats = await registry.getRemoteStats();
189
-
190
- expect(stats.state).toBe("not-configured");
191
- });
192
- });
193
-
194
- describe("a service that does not answer", () => {
195
- it("reports a refusal as denied", async () => {
196
- const source = new FakeSource();
197
- source.failure = { message: "unauthorized", code: "denied" };
198
- const registry = createSkillRegistry();
199
- registry.setRemoteSource(source);
200
-
201
- const stats = await registry.refreshRemoteSkills();
202
-
203
- expect(stats.state).toBe("denied");
204
- expect(stats.error).toContain("unauthorized");
205
- });
206
-
207
- it("reports an unreachable service as unavailable", async () => {
208
- const source = new FakeSource();
209
- source.failure = { message: "connection refused", code: "unavailable" };
210
- const registry = createSkillRegistry();
211
- registry.setRemoteSource(source);
212
-
213
- const stats = await registry.refreshRemoteSkills();
214
-
215
- expect(stats.state).toBe("unavailable");
216
- expect(stats.error).toContain("connection refused");
217
- });
218
-
219
- it("keeps the cached skills after a failed refresh", async () => {
220
- const source = new FakeSource([
221
- { id: "shared-skill", name: "shared-skill", description: "d", version: "1.0.0" },
222
- ]);
223
- const registry = createSkillRegistry();
224
- registry.setRemoteSource(source);
225
- await registry.refreshRemoteSkills();
226
-
227
- source.failure = { message: "connection refused", code: "unavailable" };
228
- const stats = await registry.refreshRemoteSkills();
229
-
230
- expect(stats.state).toBe("unavailable");
231
- // A failed refresh must not throw the cached skills away.
232
- expect(registry.listRemote()).toHaveLength(1);
233
- });
234
-
235
- it("does not put a credential into the message", async () => {
236
- const source = new FakeSource();
237
- source.failure = {
238
- message: "Bearer sk-abcdefghijklmnopqrstuvwxyz0123456789 refused",
239
- code: "denied",
240
- };
241
- const registry = createSkillRegistry();
242
- registry.setRemoteSource(source);
243
-
244
- const stats = await registry.refreshRemoteSkills();
245
-
246
- expect(stats.error).not.toContain("sk-abcdefghijklmnopqrstuvwxyz0123456789");
247
- });
248
- });