@symerian/symi 3.0.17 → 3.0.19

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 (259) hide show
  1. package/dist/{audio-preflight-CBDFctZN.js → audio-preflight-BfmZbg4Y.js} +4 -4
  2. package/dist/{audio-preflight-gsZSpG-6.js → audio-preflight-DcuC-liM.js} +4 -4
  3. package/dist/build-info.json +3 -3
  4. package/dist/bundled/boot-md/handler.js +8 -8
  5. package/dist/bundled/session-memory/handler.js +7 -7
  6. package/dist/canvas-host/a2ui/.bundle.hash +1 -1
  7. package/dist/{chrome-nPMY1XTJ.js → chrome-Bo7cbvFK.js} +5 -5
  8. package/dist/{chrome-BjVab8gM.js → chrome-DYp18Q0t.js} +5 -5
  9. package/dist/{deliver-D-QFqm31.js → deliver-ChSIbiMM.js} +1 -1
  10. package/dist/{deliver-B4-bcot9.js → deliver-DEgRQM4J.js} +1 -1
  11. package/dist/extensionAPI.js +7 -7
  12. package/dist/{image-CDwtQjmt.js → image-Bx-hvoNJ.js} +1 -1
  13. package/dist/{image-CcS-vzTA.js → image-CQl_mjWk.js} +1 -1
  14. package/dist/llm-slug-generator.js +7 -7
  15. package/dist/{manager-BnEdHzmO.js → manager-D_pn0urG.js} +1 -1
  16. package/dist/{manager-09r0qPze.js → manager-YQxK2t0C.js} +1 -1
  17. package/dist/{pi-embedded-CWsY69-4.js → pi-embedded-CLw_ZzEZ.js} +16 -16
  18. package/dist/{pi-embedded-helpers-BBMy-lqr.js → pi-embedded-helpers-B5I53aw6.js} +4 -4
  19. package/dist/{pi-embedded-helpers-ChEYbgVj.js → pi-embedded-helpers-sUAEIC9X.js} +4 -4
  20. package/dist/plugin-sdk/{accounts-BfyWsC_i.js → accounts-CWFytwbR.js} +3 -3
  21. package/dist/plugin-sdk/{active-listener-DcJW7xAT.js → active-listener-BkZ4jHrL.js} +2 -2
  22. package/dist/plugin-sdk/{agent-scope-ChbGV6of.js → agent-scope-C9gfY_Gk.js} +2 -2
  23. package/dist/plugin-sdk/{audio-preflight-D3GtNLqW.js → audio-preflight-HKbdzXLZ.js} +21 -21
  24. package/dist/plugin-sdk/{bindings-CN2Qmefj.js → bindings-BaKIqPPy.js} +2 -2
  25. package/dist/plugin-sdk/{channel-web-DTyqujjA.js → channel-web-D5nWiTH1.js} +18 -18
  26. package/dist/plugin-sdk/{chrome-BKzAKr3K.js → chrome-klTSnz-9.js} +3 -3
  27. package/dist/plugin-sdk/{chunk-DhDkBujV.js → chunk-BbrYSny_.js} +1 -1
  28. package/dist/plugin-sdk/{command-format-CVrYFyZS.js → command-format-BN6tyZt6.js} +1 -1
  29. package/dist/plugin-sdk/{commands-registry-17yfZkHZ.js → commands-registry-CTzKKtY6.js} +4 -4
  30. package/dist/plugin-sdk/{config-7wk65zKC.js → config-Crv2qEdJ.js} +9 -9
  31. package/dist/plugin-sdk/{consolidate-exbAW0ml.js → consolidate-DT1QH65Q.js} +2 -2
  32. package/dist/plugin-sdk/{deliver-TxAcw7J5.js → deliver-7rOvAlrc.js} +12 -12
  33. package/dist/plugin-sdk/{diagnostic-Debx4frd.js → diagnostic-0nsxhWp7.js} +1 -1
  34. package/dist/plugin-sdk/{fs-safe-wBYbAkJF.js → fs-safe-DfWYBeWF.js} +1 -1
  35. package/dist/plugin-sdk/{gemini-auth-7U2pm2Ky.js → gemini-auth-C0N0_u49.js} +1 -1
  36. package/dist/plugin-sdk/{image-BtDVmYA5.js → image-WOSl2apK.js} +4 -4
  37. package/dist/plugin-sdk/index.js +43 -43
  38. package/dist/plugin-sdk/{ir-CKMvRrGW.js → ir-9J84MTls.js} +4 -4
  39. package/dist/plugin-sdk/{local-roots-c_gaPs01.js → local-roots-OLRDbvyY.js} +3 -3
  40. package/dist/plugin-sdk/{login-DUym1Jy0.js → login-C7x4q0i2.js} +7 -7
  41. package/dist/plugin-sdk/{login-qr-B-WBdvrX.js → login-qr-Dv5_MoAW.js} +9 -9
  42. package/dist/plugin-sdk/{manager-B71SCzos.js → manager-C83tK17x.js} +8 -8
  43. package/dist/plugin-sdk/{manifest-registry-Dnic6Chh.js → manifest-registry-CJMV-PI7.js} +1 -1
  44. package/dist/plugin-sdk/{markdown-tables-Dur7OTlM.js → markdown-tables-DXNKz5y_.js} +1 -1
  45. package/dist/plugin-sdk/{message-channel-BrAhJJV_.js → message-channel-aGy1HbQQ.js} +1 -1
  46. package/dist/plugin-sdk/{model-selection-B9qaVQSJ.js → model-selection-C-3-tpe7.js} +4 -4
  47. package/dist/plugin-sdk/{outbound-DB1wDM8b.js → outbound-DquCeSy5.js} +6 -6
  48. package/dist/plugin-sdk/{pi-auth-json-ZO118hoy.js → pi-auth-json-D9PDCXGn.js} +1 -1
  49. package/dist/plugin-sdk/{pi-embedded-helpers-s_U0Un7j.js → pi-embedded-helpers-D3ygfH7l.js} +16 -16
  50. package/dist/plugin-sdk/{plugins-DF81oSaI.js → plugins-DOwnSg9D.js} +4 -4
  51. package/dist/plugin-sdk/{pw-ai-CTwP02uv.js → pw-ai-rlengLjb.js} +8 -8
  52. package/dist/plugin-sdk/{qmd-manager-CBaSGant.js → qmd-manager-BzxFjRFa.js} +4 -4
  53. package/dist/plugin-sdk/{registry-CZVURNhF.js → registry-5iFfixlB.js} +2 -2
  54. package/dist/plugin-sdk/{replies-hwRbkU3z.js → replies-BXOzO_H5.js} +7 -7
  55. package/dist/plugin-sdk/{reply-prefix-CaXmzZlx.js → reply-prefix-INAKTqCU.js} +1 -1
  56. package/dist/plugin-sdk/{resolve-outbound-target-fxVSOBmk.js → resolve-outbound-target-DvbxHtqp.js} +2 -2
  57. package/dist/plugin-sdk/{resolve-route-ClCyiOeu.js → resolve-route-URXlY3AK.js} +3 -3
  58. package/dist/plugin-sdk/{runner-Cq5jvwQ7.js → runner-Bv0_DWoH.js} +9 -9
  59. package/dist/plugin-sdk/{session-B_TkB65Y.js → session-C3r8l7ou.js} +4 -4
  60. package/dist/plugin-sdk/{skill-commands-0LF9HTGr.js → skill-commands-KjLUGIdZ.js} +5 -5
  61. package/dist/plugin-sdk/{skills-BIT_O7J0.js → skills-BrsD4L5c.js} +7 -7
  62. package/dist/plugin-sdk/{sqlite-Bx5Y5U5X.js → sqlite-CjW7ME1H.js} +1 -1
  63. package/dist/plugin-sdk/{subsystem-CXqYeDy-.js → subsystem-DcOg1xJr.js} +1 -1
  64. package/dist/plugin-sdk/{synthesis-DtsYAj1E.js → synthesis-CY7YAasV.js} +38 -38
  65. package/dist/plugin-sdk/{target-errors-B8mokOeH.js → target-errors-BVWJGWFq.js} +2 -2
  66. package/dist/plugin-sdk/{thinking-Ca0DhqzO.js → thinking-CtsTDPOi.js} +3 -3
  67. package/dist/plugin-sdk/{tokens-CvlONEqh.js → tokens-8lqOTZCB.js} +1 -1
  68. package/dist/plugin-sdk/{tool-images-DpBaWEHT.js → tool-images-Cl_rGIUZ.js} +2 -2
  69. package/dist/plugin-sdk/{tool-loop-detection-BOvUFa0f.js → tool-loop-detection-Da4WUT_P.js} +2 -2
  70. package/dist/plugin-sdk/{unified-runner-CnM7lyNd.js → unified-runner-nwMnsZyj.js} +60 -60
  71. package/dist/plugin-sdk/web-BlweOZDp.js +54 -0
  72. package/dist/plugin-sdk/{whatsapp-actions-CvnfsFJm.js → whatsapp-actions-DpfaGYs7.js} +21 -21
  73. package/dist/{pw-ai-BW8_KeDf.js → pw-ai-BqxJG-Wh.js} +1 -1
  74. package/dist/{pw-ai-j9IE1K0-.js → pw-ai-C-NSGye0.js} +1 -1
  75. package/dist/{runner-8ALr2UII.js → runner-COGFTeDw.js} +1 -1
  76. package/dist/{runner-C4-9kFdR.js → runner-DhCi2lT1.js} +1 -1
  77. package/dist/{synthesis-Cph3LhA1.js → synthesis-CXZu24Vx.js} +7 -7
  78. package/dist/{synthesis-Cus0A2dL.js → synthesis-DrPxcMlQ.js} +7 -7
  79. package/dist/{unified-runner-CX80YMTk.js → unified-runner-iByUazvW.js} +16 -16
  80. package/dist/{web-ChozvJ7I.js → web-EsMQBIYf.js} +7 -7
  81. package/dist/{web-DFlsbXmQ.js → web-PPg5y6xI.js} +7 -7
  82. package/package.json +1 -1
  83. package/dist/plugin-sdk/web-CIPJBHAU.js +0 -54
  84. package/extensions/copilot-proxy/README.md +0 -24
  85. package/extensions/copilot-proxy/index.ts +0 -154
  86. package/extensions/copilot-proxy/node_modules/.bin/symi +0 -21
  87. package/extensions/copilot-proxy/package.json +0 -15
  88. package/extensions/copilot-proxy/symi.plugin.json +0 -9
  89. package/extensions/device-pair/index.ts +0 -642
  90. package/extensions/device-pair/symi.plugin.json +0 -20
  91. package/extensions/diagnostics-otel/index.ts +0 -15
  92. package/extensions/diagnostics-otel/node_modules/.bin/acorn +0 -21
  93. package/extensions/diagnostics-otel/node_modules/.bin/symi +0 -21
  94. package/extensions/diagnostics-otel/package.json +0 -27
  95. package/extensions/diagnostics-otel/src/service.test.ts +0 -290
  96. package/extensions/diagnostics-otel/src/service.ts +0 -666
  97. package/extensions/diagnostics-otel/symi.plugin.json +0 -8
  98. package/extensions/google-antigravity-auth/README.md +0 -24
  99. package/extensions/google-antigravity-auth/index.ts +0 -424
  100. package/extensions/google-antigravity-auth/node_modules/.bin/symi +0 -21
  101. package/extensions/google-antigravity-auth/package.json +0 -15
  102. package/extensions/google-antigravity-auth/symi.plugin.json +0 -9
  103. package/extensions/google-gemini-cli-auth/README.md +0 -35
  104. package/extensions/google-gemini-cli-auth/index.ts +0 -75
  105. package/extensions/google-gemini-cli-auth/node_modules/.bin/symi +0 -21
  106. package/extensions/google-gemini-cli-auth/oauth.test.ts +0 -162
  107. package/extensions/google-gemini-cli-auth/oauth.ts +0 -636
  108. package/extensions/google-gemini-cli-auth/package.json +0 -15
  109. package/extensions/google-gemini-cli-auth/symi.plugin.json +0 -9
  110. package/extensions/learning-loop/index.ts +0 -159
  111. package/extensions/learning-loop/node_modules/.bin/symi +0 -21
  112. package/extensions/learning-loop/package.json +0 -18
  113. package/extensions/learning-loop/src/analytics/gateway-methods.ts +0 -230
  114. package/extensions/learning-loop/src/analytics/metrics-aggregator.ts +0 -153
  115. package/extensions/learning-loop/src/capture/run-tracker.ts +0 -181
  116. package/extensions/learning-loop/src/capture/serializer.ts +0 -74
  117. package/extensions/learning-loop/src/db.ts +0 -583
  118. package/extensions/learning-loop/src/feedback/explicit-feedback.ts +0 -58
  119. package/extensions/learning-loop/src/feedback/implicit-signals.ts +0 -89
  120. package/extensions/learning-loop/src/graph/edge-inference.ts +0 -189
  121. package/extensions/learning-loop/src/graph/graph-retrieval.ts +0 -144
  122. package/extensions/learning-loop/src/graph/graph-store.ts +0 -183
  123. package/extensions/learning-loop/src/hooks.ts +0 -244
  124. package/extensions/learning-loop/src/injection/cache.ts +0 -73
  125. package/extensions/learning-loop/src/injection/context-injector.ts +0 -104
  126. package/extensions/learning-loop/src/injection/prompt-builder.ts +0 -43
  127. package/extensions/learning-loop/src/learning/embedding-bridge.ts +0 -54
  128. package/extensions/learning-loop/src/learning/learning-extractor.ts +0 -217
  129. package/extensions/learning-loop/src/learning/learning-store.ts +0 -158
  130. package/extensions/learning-loop/src/learning/retrieval.ts +0 -87
  131. package/extensions/learning-loop/src/math/confidence-intervals.ts +0 -62
  132. package/extensions/learning-loop/src/math/ewma.ts +0 -51
  133. package/extensions/learning-loop/src/math/weighted-scorer.ts +0 -42
  134. package/extensions/learning-loop/src/schema.ts +0 -176
  135. package/extensions/learning-loop/src/scoring/normalization.ts +0 -32
  136. package/extensions/learning-loop/src/scoring/quality-engine.ts +0 -78
  137. package/extensions/learning-loop/src/scoring/signal-extractors.ts +0 -155
  138. package/extensions/learning-loop/src/test/context-injector.test.ts +0 -142
  139. package/extensions/learning-loop/src/test/fixes.test.ts +0 -1286
  140. package/extensions/learning-loop/src/test/graph.test.ts +0 -711
  141. package/extensions/learning-loop/src/test/integration.test.ts +0 -312
  142. package/extensions/learning-loop/src/test/learning-store.test.ts +0 -191
  143. package/extensions/learning-loop/src/test/math.test.ts +0 -148
  144. package/extensions/learning-loop/src/test/quality-engine.test.ts +0 -231
  145. package/extensions/learning-loop/src/test/run-tracker.test.ts +0 -143
  146. package/extensions/learning-loop/src/types.ts +0 -281
  147. package/extensions/learning-loop/symi.plugin.json +0 -46
  148. package/extensions/llm-task/README.md +0 -97
  149. package/extensions/llm-task/index.ts +0 -6
  150. package/extensions/llm-task/package.json +0 -12
  151. package/extensions/llm-task/src/llm-task-tool.test.ts +0 -138
  152. package/extensions/llm-task/src/llm-task-tool.ts +0 -249
  153. package/extensions/llm-task/symi.plugin.json +0 -21
  154. package/extensions/memory-lancedb/config.ts +0 -161
  155. package/extensions/memory-lancedb/index.test.ts +0 -330
  156. package/extensions/memory-lancedb/index.ts +0 -670
  157. package/extensions/memory-lancedb/node_modules/.bin/arrow2csv +0 -21
  158. package/extensions/memory-lancedb/node_modules/.bin/openai +0 -21
  159. package/extensions/memory-lancedb/node_modules/.bin/symi +0 -21
  160. package/extensions/memory-lancedb/package.json +0 -20
  161. package/extensions/memory-lancedb/symi.plugin.json +0 -71
  162. package/extensions/minimax-portal-auth/README.md +0 -33
  163. package/extensions/minimax-portal-auth/index.ts +0 -161
  164. package/extensions/minimax-portal-auth/node_modules/.bin/symi +0 -21
  165. package/extensions/minimax-portal-auth/oauth.ts +0 -247
  166. package/extensions/minimax-portal-auth/package.json +0 -15
  167. package/extensions/minimax-portal-auth/symi.plugin.json +0 -9
  168. package/extensions/model-equalizer/index.ts +0 -80
  169. package/extensions/model-equalizer/skills/model-equalizer/SKILL.md +0 -58
  170. package/extensions/model-equalizer/src/detection.ts +0 -62
  171. package/extensions/model-equalizer/src/enhancer.ts +0 -63
  172. package/extensions/model-equalizer/src/test/detection.test.ts +0 -218
  173. package/extensions/model-equalizer/src/test/enhancer.test.ts +0 -137
  174. package/extensions/model-equalizer/src/test/integration.test.ts +0 -185
  175. package/extensions/model-equalizer/src/types.ts +0 -24
  176. package/extensions/model-equalizer/symi.plugin.json +0 -12
  177. package/extensions/phone-control/index.ts +0 -421
  178. package/extensions/phone-control/symi.plugin.json +0 -10
  179. package/extensions/pipeline/README.md +0 -75
  180. package/extensions/pipeline/SKILL.md +0 -97
  181. package/extensions/pipeline/index.ts +0 -18
  182. package/extensions/pipeline/package.json +0 -11
  183. package/extensions/pipeline/src/pipeline-tool.test.ts +0 -345
  184. package/extensions/pipeline/src/pipeline-tool.ts +0 -266
  185. package/extensions/pipeline/src/windows-spawn.test.ts +0 -148
  186. package/extensions/pipeline/src/windows-spawn.ts +0 -193
  187. package/extensions/pipeline/symi.plugin.json +0 -10
  188. package/extensions/qwen-portal-auth/README.md +0 -24
  189. package/extensions/qwen-portal-auth/index.ts +0 -134
  190. package/extensions/qwen-portal-auth/oauth.ts +0 -190
  191. package/extensions/qwen-portal-auth/symi.plugin.json +0 -9
  192. package/extensions/talk-voice/index.ts +0 -150
  193. package/extensions/talk-voice/symi.plugin.json +0 -10
  194. package/extensions/thread-ownership/index.test.ts +0 -180
  195. package/extensions/thread-ownership/index.ts +0 -133
  196. package/extensions/thread-ownership/symi.plugin.json +0 -28
  197. package/skills/1password/SKILL.md +0 -71
  198. package/skills/1password/references/cli-examples.md +0 -29
  199. package/skills/1password/references/get-started.md +0 -17
  200. package/skills/apple-notes/SKILL.md +0 -78
  201. package/skills/apple-reminders/SKILL.md +0 -119
  202. package/skills/bear-notes/SKILL.md +0 -108
  203. package/skills/blogwatcher/SKILL.md +0 -70
  204. package/skills/blucli/SKILL.md +0 -48
  205. package/skills/bluebubbles/SKILL.md +0 -132
  206. package/skills/camsnap/SKILL.md +0 -46
  207. package/skills/canvas/SKILL.md +0 -204
  208. package/skills/connect-email/SKILL.md +0 -142
  209. package/skills/document-generation/SKILL.md +0 -83
  210. package/skills/eightctl/SKILL.md +0 -51
  211. package/skills/food-order/SKILL.md +0 -49
  212. package/skills/gemini/SKILL.md +0 -44
  213. package/skills/gh-issues/SKILL.md +0 -865
  214. package/skills/gifgrep/SKILL.md +0 -80
  215. package/skills/github/SKILL.md +0 -164
  216. package/skills/gog/SKILL.md +0 -117
  217. package/skills/goplaces/SKILL.md +0 -53
  218. package/skills/healthcheck/SKILL.md +0 -246
  219. package/skills/himalaya/SKILL.md +0 -258
  220. package/skills/himalaya/references/configuration.md +0 -184
  221. package/skills/himalaya/references/message-composition.md +0 -199
  222. package/skills/imsg/SKILL.md +0 -122
  223. package/skills/long-task/SKILL.md +0 -58
  224. package/skills/long-task/scripts/detach-task.sh +0 -187
  225. package/skills/nano-banana-pro/SKILL.md +0 -59
  226. package/skills/nano-banana-pro/scripts/generate_image.py +0 -184
  227. package/skills/nano-pdf/SKILL.md +0 -39
  228. package/skills/notion/SKILL.md +0 -173
  229. package/skills/obsidian/SKILL.md +0 -82
  230. package/skills/openai-image-gen/SKILL.md +0 -90
  231. package/skills/openai-image-gen/scripts/gen.py +0 -240
  232. package/skills/openai-whisper/SKILL.md +0 -39
  233. package/skills/openai-whisper-api/SKILL.md +0 -53
  234. package/skills/openai-whisper-api/scripts/transcribe.sh +0 -85
  235. package/skills/openhue/SKILL.md +0 -113
  236. package/skills/oracle/SKILL.md +0 -126
  237. package/skills/ordercli/SKILL.md +0 -79
  238. package/skills/peekaboo/SKILL.md +0 -191
  239. package/skills/reactions-extensive/SKILL.md +0 -30
  240. package/skills/reactions-minimal/SKILL.md +0 -31
  241. package/skills/safe-edit/SKILL.md +0 -51
  242. package/skills/sag/SKILL.md +0 -88
  243. package/skills/sherpa-onnx-tts/SKILL.md +0 -104
  244. package/skills/sherpa-onnx-tts/bin/sherpa-onnx-tts +0 -178
  245. package/skills/songsee/SKILL.md +0 -50
  246. package/skills/sonoscli/SKILL.md +0 -66
  247. package/skills/spotify-player/SKILL.md +0 -65
  248. package/skills/symihub/SKILL.md +0 -78
  249. package/skills/things-mac/SKILL.md +0 -87
  250. package/skills/tmux/SKILL.md +0 -153
  251. package/skills/tmux/scripts/find-sessions.sh +0 -112
  252. package/skills/tmux/scripts/wait-for-text.sh +0 -83
  253. package/skills/trello/SKILL.md +0 -96
  254. package/skills/video-frames/SKILL.md +0 -47
  255. package/skills/video-frames/scripts/frame.sh +0 -81
  256. package/skills/voice-call/SKILL.md +0 -46
  257. package/skills/wacli/SKILL.md +0 -73
  258. package/skills/weather/SKILL.md +0 -113
  259. package/skills/xurl/SKILL.md +0 -462
@@ -1,231 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import { combineSignals } from "../scoring/normalization.js";
3
- import {
4
- extractTaskCompletion,
5
- extractToolEfficiency,
6
- extractResponseAppropriateness,
7
- extractLatencyRelative,
8
- extractUserFeedback,
9
- } from "../scoring/signal-extractors.js";
10
- import type { CompletedRun } from "../types.js";
11
-
12
- function makeRun(overrides: Partial<CompletedRun> = {}): CompletedRun {
13
- return {
14
- runId: "test-run",
15
- sessionId: "sess-1",
16
- sessionKey: "sk-1",
17
- agentId: "agent-1",
18
- provider: "openai",
19
- model: "gpt-4",
20
- promptHash: "abc123",
21
- promptLength: 100,
22
- responseLength: 200,
23
- responseToolCallCount: 0,
24
- usage: { input: 50, output: 100, total: 150 },
25
- toolCalls: [],
26
- success: true,
27
- error: null,
28
- durationMs: 1000,
29
- startedAt: Date.now() - 1000,
30
- completedAt: Date.now(),
31
- ...overrides,
32
- };
33
- }
34
-
35
- describe("Signal Extractors", () => {
36
- describe("Task Completion", () => {
37
- it("should return 1.0 for success without error", () => {
38
- const signal = extractTaskCompletion(makeRun({ success: true, error: null }), 0.35);
39
- expect(signal.value).toBe(1.0);
40
- expect(signal.confidence).toBe(1.0);
41
- });
42
-
43
- it("should return 0.5 for success with error", () => {
44
- const signal = extractTaskCompletion(makeRun({ success: true, error: "warning" }), 0.35);
45
- expect(signal.value).toBe(0.5);
46
- });
47
-
48
- it("should return 0.0 for failure", () => {
49
- const signal = extractTaskCompletion(makeRun({ success: false }), 0.35);
50
- expect(signal.value).toBe(0.0);
51
- });
52
- });
53
-
54
- describe("Tool Efficiency", () => {
55
- it("should return 1.0 with no tool calls", () => {
56
- const signal = extractToolEfficiency(makeRun({ toolCalls: [] }), 0.25);
57
- expect(signal.value).toBe(1.0);
58
- expect(signal.confidence).toBe(0.3);
59
- });
60
-
61
- it("should return 1.0 for all successful unique tool calls", () => {
62
- const signal = extractToolEfficiency(
63
- makeRun({
64
- toolCalls: [
65
- { toolName: "a", durationMs: 10, success: true, error: null, paramHash: "h1" },
66
- { toolName: "b", durationMs: 20, success: true, error: null, paramHash: "h2" },
67
- ],
68
- }),
69
- 0.25,
70
- );
71
- expect(signal.value).toBe(1.0);
72
- });
73
-
74
- it("should penalize errors", () => {
75
- const signal = extractToolEfficiency(
76
- makeRun({
77
- toolCalls: [
78
- { toolName: "a", durationMs: 10, success: false, error: "fail", paramHash: "h1" },
79
- { toolName: "b", durationMs: 20, success: true, error: null, paramHash: "h2" },
80
- ],
81
- }),
82
- 0.25,
83
- );
84
- // 1.0 - 0.6*(1/2) - 0.4*(0/2) = 0.7
85
- expect(signal.value).toBeCloseTo(0.7, 5);
86
- });
87
-
88
- it("should penalize redundant calls", () => {
89
- const signal = extractToolEfficiency(
90
- makeRun({
91
- toolCalls: [
92
- { toolName: "a", durationMs: 10, success: true, error: null, paramHash: "h1" },
93
- { toolName: "a", durationMs: 10, success: true, error: null, paramHash: "h1" },
94
- ],
95
- }),
96
- 0.25,
97
- );
98
- // 1.0 - 0.6*(0/2) - 0.4*(1/2) = 0.8
99
- expect(signal.value).toBeCloseTo(0.8, 5);
100
- });
101
-
102
- it("should increase confidence with more tool calls", () => {
103
- const few = extractToolEfficiency(
104
- makeRun({
105
- toolCalls: [
106
- { toolName: "a", durationMs: 10, success: true, error: null, paramHash: "h1" },
107
- ],
108
- }),
109
- 0.25,
110
- );
111
- const many = extractToolEfficiency(
112
- makeRun({
113
- toolCalls: Array.from({ length: 5 }, (_, i) => ({
114
- toolName: `t${i}`,
115
- durationMs: 10,
116
- success: true,
117
- error: null,
118
- paramHash: `h${i}`,
119
- })),
120
- }),
121
- 0.25,
122
- );
123
- expect(many.confidence).toBeGreaterThan(few.confidence);
124
- });
125
- });
126
-
127
- describe("Response Appropriateness", () => {
128
- it("should return 0.5 for zero prompt length", () => {
129
- const signal = extractResponseAppropriateness(makeRun({ promptLength: 0 }), 0.1);
130
- expect(signal.value).toBe(0.5);
131
- });
132
-
133
- it("should return ~1.0 for equal prompt and response length", () => {
134
- const signal = extractResponseAppropriateness(
135
- makeRun({ promptLength: 100, responseLength: 100 }),
136
- 0.1,
137
- );
138
- // ratio = 1.0, ln(1) = 0, exp(-0) = 1.0
139
- expect(signal.value).toBeCloseTo(1.0, 5);
140
- });
141
-
142
- it("should penalize very long responses", () => {
143
- const signal = extractResponseAppropriateness(
144
- makeRun({ promptLength: 10, responseLength: 10000 }),
145
- 0.1,
146
- );
147
- expect(signal.value).toBeLessThan(0.5);
148
- });
149
- });
150
-
151
- describe("Latency Relative", () => {
152
- it("should return 1.0 for zero duration", () => {
153
- const signal = extractLatencyRelative(makeRun({ durationMs: 0 }), 0.1, {
154
- value: 0,
155
- count: 0,
156
- });
157
- expect(signal.value).toBe(1.0);
158
- });
159
-
160
- it("should return 1.0 when faster than EWMA", () => {
161
- const signal = extractLatencyRelative(makeRun({ durationMs: 500 }), 0.1, {
162
- value: 1000,
163
- count: 10,
164
- });
165
- expect(signal.value).toBe(1.0);
166
- });
167
-
168
- it("should degrade when slower than EWMA", () => {
169
- const signal = extractLatencyRelative(makeRun({ durationMs: 2000 }), 0.1, {
170
- value: 1000,
171
- count: 10,
172
- });
173
- expect(signal.value).toBeCloseTo(0.5, 5);
174
- });
175
- });
176
-
177
- describe("User Feedback", () => {
178
- it("should return confidence 0 when no feedback", () => {
179
- const signal = extractUserFeedback(0.2);
180
- expect(signal.confidence).toBe(0.0);
181
- });
182
-
183
- it("should map explicit 5 to 1.0", () => {
184
- const signal = extractUserFeedback(0.2, { source: "explicit", score: 5 });
185
- expect(signal.value).toBe(1.0);
186
- expect(signal.confidence).toBe(1.0);
187
- });
188
-
189
- it("should map explicit 1 to 0.0", () => {
190
- const signal = extractUserFeedback(0.2, { source: "explicit", score: 1 });
191
- expect(signal.value).toBe(0.0);
192
- });
193
-
194
- it("should map explicit 3 to 0.5", () => {
195
- const signal = extractUserFeedback(0.2, { source: "explicit", score: 3 });
196
- expect(signal.value).toBe(0.5);
197
- });
198
-
199
- it("should use lower confidence for implicit feedback", () => {
200
- const signal = extractUserFeedback(0.2, { source: "implicit", score: 0.8 });
201
- expect(signal.confidence).toBe(0.6);
202
- });
203
- });
204
- });
205
-
206
- describe("Signal Combination", () => {
207
- it("should produce score in [0, 1]", () => {
208
- const score = combineSignals([
209
- { name: "taskCompletion", value: 1.0, confidence: 1.0, weight: 0.35 },
210
- { name: "toolEfficiency", value: 0.8, confidence: 0.7, weight: 0.25 },
211
- { name: "responseAppropriateLength", value: 0.9, confidence: 0.5, weight: 0.1 },
212
- { name: "latencyRelative", value: 0.7, confidence: 0.3, weight: 0.1 },
213
- { name: "userFeedback", value: 0.5, confidence: 0.0, weight: 0.2 },
214
- ]);
215
- expect(score.score).toBeGreaterThanOrEqual(0);
216
- expect(score.score).toBeLessThanOrEqual(1);
217
- expect(score.algorithmVersion).toBe(1);
218
- });
219
-
220
- it("should exclude zero-confidence signals", () => {
221
- const withFeedback = combineSignals([
222
- { name: "taskCompletion", value: 1.0, confidence: 1.0, weight: 0.35 },
223
- { name: "userFeedback", value: 0.0, confidence: 0.0, weight: 0.2 },
224
- ]);
225
- const withoutFeedback = combineSignals([
226
- { name: "taskCompletion", value: 1.0, confidence: 1.0, weight: 0.35 },
227
- ]);
228
- // Should be equal since feedback has 0 confidence
229
- expect(withFeedback.score).toBeCloseTo(withoutFeedback.score, 5);
230
- });
231
- });
@@ -1,143 +0,0 @@
1
- import { describe, it, expect, beforeEach } from "vitest";
2
- import { createRunTracker } from "../capture/run-tracker.js";
3
-
4
- describe("RunTracker", () => {
5
- let tracker: ReturnType<typeof createRunTracker>;
6
-
7
- beforeEach(() => {
8
- tracker = createRunTracker();
9
- });
10
-
11
- it("should start with no active runs", () => {
12
- expect(tracker.getActiveRunCount()).toBe(0);
13
- });
14
-
15
- it("should create a run on llm_input", () => {
16
- tracker.onLlmInput({
17
- runId: "run-1",
18
- sessionId: "sess-1",
19
- provider: "openai",
20
- model: "gpt-4",
21
- prompt: "Hello world",
22
- sessionKey: "sk-1",
23
- agentId: "agent-1",
24
- });
25
- expect(tracker.getActiveRunCount()).toBe(1);
26
- });
27
-
28
- it("should bind session to run", () => {
29
- tracker.onLlmInput({
30
- runId: "run-1",
31
- sessionId: "sess-1",
32
- provider: "openai",
33
- model: "gpt-4",
34
- prompt: "Hello",
35
- sessionKey: "sk-1",
36
- });
37
- expect(tracker.getRunIdForSession("sk-1")).toBe("run-1");
38
- });
39
-
40
- it("should accumulate tool calls", () => {
41
- tracker.onLlmInput({
42
- runId: "run-1",
43
- sessionId: "sess-1",
44
- provider: "openai",
45
- model: "gpt-4",
46
- prompt: "Hello",
47
- sessionKey: "sk-1",
48
- });
49
-
50
- tracker.onToolCall({
51
- toolName: "search",
52
- durationMs: 50,
53
- success: true,
54
- paramHash: "h1",
55
- sessionKey: "sk-1",
56
- });
57
-
58
- tracker.onToolCall({
59
- toolName: "read",
60
- durationMs: 30,
61
- success: false,
62
- error: "not found",
63
- paramHash: "h2",
64
- sessionKey: "sk-1",
65
- });
66
-
67
- const result = tracker.finalize({
68
- sessionKey: "sk-1",
69
- success: true,
70
- durationMs: 500,
71
- });
72
-
73
- expect(result).not.toBeNull();
74
- expect(result!.toolCalls).toHaveLength(2);
75
- expect(result!.toolCalls[0]!.toolName).toBe("search");
76
- expect(result!.toolCalls[1]!.success).toBe(false);
77
- });
78
-
79
- it("should capture usage from llm_output", () => {
80
- tracker.onLlmInput({
81
- runId: "run-1",
82
- sessionId: "sess-1",
83
- provider: "claude",
84
- model: "claude-3",
85
- prompt: "Test prompt",
86
- sessionKey: "sk-1",
87
- });
88
-
89
- tracker.onLlmOutput({
90
- runId: "run-1",
91
- sessionId: "sess-1",
92
- assistantTexts: ["Response text here"],
93
- usage: { input: 10, output: 20, total: 30 },
94
- });
95
-
96
- const result = tracker.finalize({
97
- sessionKey: "sk-1",
98
- success: true,
99
- durationMs: 200,
100
- });
101
-
102
- expect(result).not.toBeNull();
103
- expect(result!.responseLength).toBe("Response text here".length);
104
- expect(result!.usage.input).toBe(10);
105
- expect(result!.usage.output).toBe(20);
106
- });
107
-
108
- it("should return null for finalize without llm_input", () => {
109
- const result = tracker.finalize({
110
- sessionKey: "sk-unknown",
111
- success: true,
112
- });
113
- expect(result).toBeNull();
114
- });
115
-
116
- it("should clean up after finalize", () => {
117
- tracker.onLlmInput({
118
- runId: "run-1",
119
- sessionId: "sess-1",
120
- provider: "openai",
121
- model: "gpt-4",
122
- prompt: "Hello",
123
- sessionKey: "sk-1",
124
- });
125
-
126
- tracker.finalize({ sessionKey: "sk-1", success: true });
127
- expect(tracker.getActiveRunCount()).toBe(0);
128
- expect(tracker.getRunIdForSession("sk-1")).toBeUndefined();
129
- });
130
-
131
- it("should clear all state", () => {
132
- tracker.onLlmInput({
133
- runId: "run-1",
134
- sessionId: "sess-1",
135
- provider: "openai",
136
- model: "gpt-4",
137
- prompt: "Hello",
138
- sessionKey: "sk-1",
139
- });
140
- tracker.clear();
141
- expect(tracker.getActiveRunCount()).toBe(0);
142
- });
143
- });
@@ -1,281 +0,0 @@
1
- export type RunId = string;
2
- export type SessionId = string;
3
- export type SessionKey = string;
4
- export type AgentId = string;
5
-
6
- export type UsageData = {
7
- input?: number;
8
- output?: number;
9
- cacheRead?: number;
10
- cacheWrite?: number;
11
- total?: number;
12
- };
13
-
14
- export type ToolCallRecord = {
15
- toolName: string;
16
- durationMs: number | null;
17
- success: boolean;
18
- error: string | null;
19
- paramHash: string;
20
- };
21
-
22
- export type PartialRun = {
23
- runId: RunId;
24
- sessionId?: SessionId;
25
- sessionKey?: SessionKey;
26
- agentId?: AgentId;
27
- provider?: string;
28
- model?: string;
29
- promptHash?: string;
30
- promptLength?: number;
31
- responseLength?: number;
32
- responseToolCallCount?: number;
33
- usage?: UsageData;
34
- toolCalls: ToolCallRecord[];
35
- success?: boolean;
36
- error?: string;
37
- durationMs?: number;
38
- startedAt: number;
39
- };
40
-
41
- export type CompletedRun = {
42
- runId: RunId;
43
- sessionId: string;
44
- sessionKey: string;
45
- agentId: string;
46
- provider: string;
47
- model: string;
48
- promptHash: string;
49
- promptLength: number;
50
- responseLength: number;
51
- responseToolCallCount: number;
52
- usage: UsageData;
53
- toolCalls: ToolCallRecord[];
54
- success: boolean;
55
- error: string | null;
56
- durationMs: number;
57
- startedAt: number;
58
- completedAt: number;
59
- };
60
-
61
- export type QualitySignalName =
62
- | "taskCompletion"
63
- | "toolEfficiency"
64
- | "responseAppropriateLength"
65
- | "latencyRelative"
66
- | "userFeedback";
67
-
68
- export type QualitySignal = {
69
- name: QualitySignalName;
70
- value: number;
71
- confidence: number;
72
- weight: number;
73
- };
74
-
75
- export type QualityScore = {
76
- score: number;
77
- signals: QualitySignal[];
78
- algorithmVersion: number;
79
- };
80
-
81
- export type LearningCategory =
82
- | "tool_pattern"
83
- | "error_recovery"
84
- | "model_affinity"
85
- | "anti_pattern";
86
-
87
- export type LearningRecord = {
88
- id: string;
89
- runId: RunId;
90
- category: LearningCategory;
91
- content: string;
92
- embedding: number[] | null;
93
- confidence: number;
94
- appliedCount: number;
95
- createdAt: number;
96
- updatedAt: number;
97
- };
98
-
99
- export type FeedbackRecord = {
100
- id: string;
101
- runId: RunId;
102
- source: "explicit" | "implicit";
103
- score: number;
104
- createdAt: number;
105
- };
106
-
107
- export type MetricsBucket = {
108
- provider: string;
109
- model: string;
110
- bucketHour: string;
111
- runCount: number;
112
- successCount: number;
113
- qualitySum: number;
114
- qualitySumSq: number;
115
- latencySum: number;
116
- latencySumSq: number;
117
- tokenInputSum: number;
118
- tokenOutputSum: number;
119
- };
120
-
121
- export type RunRow = {
122
- run_id: string;
123
- session_id: string;
124
- session_key: string;
125
- agent_id: string;
126
- provider: string;
127
- model: string;
128
- prompt_hash: string;
129
- prompt_length: number;
130
- response_length: number;
131
- response_tool_call_count: number;
132
- usage_input: number;
133
- usage_output: number;
134
- usage_cache_read: number;
135
- usage_cache_write: number;
136
- usage_total: number;
137
- success: number;
138
- error: string | null;
139
- duration_ms: number;
140
- quality_score: number | null;
141
- algorithm_version: number | null;
142
- started_at: number;
143
- completed_at: number;
144
- };
145
-
146
- export type ToolCallRow = {
147
- id: number;
148
- run_id: string;
149
- tool_name: string;
150
- duration_ms: number | null;
151
- success: number;
152
- error: string | null;
153
- param_hash: string;
154
- };
155
-
156
- export type LearningRow = {
157
- id: string;
158
- run_id: string;
159
- category: string;
160
- content: string;
161
- embedding: string | null;
162
- confidence: number;
163
- applied_count: number;
164
- created_at: number;
165
- updated_at: number;
166
- };
167
-
168
- export type FeedbackRow = {
169
- id: string;
170
- run_id: string;
171
- source: string;
172
- score: number;
173
- created_at: number;
174
- };
175
-
176
- export type MetricsBucketRow = {
177
- provider: string;
178
- model: string;
179
- bucket_hour: string;
180
- run_count: number;
181
- success_count: number;
182
- quality_sum: number;
183
- quality_sum_sq: number;
184
- latency_sum: number;
185
- latency_sum_sq: number;
186
- token_input_sum: number;
187
- token_output_sum: number;
188
- };
189
-
190
- export type ScoringWeights = {
191
- taskCompletion: number;
192
- toolEfficiency: number;
193
- responseAppropriateLength: number;
194
- latencyRelative: number;
195
- userFeedback: number;
196
- };
197
-
198
- export type InjectionConfig = {
199
- maxLearnings: number;
200
- minRelevance: number;
201
- maxTokens: number;
202
- cacheTtlMs: number;
203
- };
204
-
205
- export type CaptureConfig = {
206
- embedPrompts: boolean;
207
- maxRuns: number;
208
- };
209
-
210
- export type DecayConfig = {
211
- halfLifeDays: number;
212
- };
213
-
214
- export type LearningLoopConfig = {
215
- capture: CaptureConfig;
216
- scoring: { weights: ScoringWeights };
217
- injection: InjectionConfig;
218
- decay: DecayConfig;
219
- };
220
-
221
- const DEFAULT_CONFIG: LearningLoopConfig = {
222
- capture: { embedPrompts: false, maxRuns: 10_000 },
223
- scoring: {
224
- weights: {
225
- taskCompletion: 0.35,
226
- toolEfficiency: 0.25,
227
- responseAppropriateLength: 0.1,
228
- latencyRelative: 0.1,
229
- userFeedback: 0.2,
230
- },
231
- },
232
- injection: {
233
- maxLearnings: 5,
234
- minRelevance: 0.3,
235
- maxTokens: 500,
236
- cacheTtlMs: 60_000,
237
- },
238
- decay: { halfLifeDays: 30 },
239
- };
240
-
241
- export function resolveConfig(pluginConfig?: Record<string, unknown>): LearningLoopConfig {
242
- if (!pluginConfig) return { ...DEFAULT_CONFIG };
243
-
244
- const raw = pluginConfig as Partial<{
245
- capture: Partial<CaptureConfig>;
246
- scoring: Partial<{ weights: Partial<ScoringWeights> }>;
247
- injection: Partial<InjectionConfig>;
248
- decay: Partial<DecayConfig>;
249
- }>;
250
-
251
- return {
252
- capture: { ...DEFAULT_CONFIG.capture, ...raw.capture },
253
- scoring: {
254
- weights: { ...DEFAULT_CONFIG.scoring.weights, ...raw.scoring?.weights },
255
- },
256
- injection: { ...DEFAULT_CONFIG.injection, ...raw.injection },
257
- decay: { ...DEFAULT_CONFIG.decay, ...raw.decay },
258
- };
259
- }
260
-
261
- export type EdgeType = "T" | "S" | "C" | "U" | "X" | "R";
262
-
263
- export interface LearningEdge {
264
- id: number;
265
- sourceId: string;
266
- targetId: string;
267
- edgeType: EdgeType;
268
- weight: number;
269
- createdAt: number;
270
- }
271
-
272
- export interface EdgeRow {
273
- id: number;
274
- source_id: string;
275
- target_id: string;
276
- edge_type: string;
277
- weight: number;
278
- created_at: number;
279
- }
280
-
281
- export const ALGORITHM_VERSION = 1;
@@ -1,46 +0,0 @@
1
- {
2
- "id": "learning-loop",
3
- "configSchema": {
4
- "type": "object",
5
- "additionalProperties": false,
6
- "properties": {
7
- "capture": {
8
- "type": "object",
9
- "properties": {
10
- "embedPrompts": { "type": "boolean" },
11
- "maxRuns": { "type": "number" }
12
- }
13
- },
14
- "scoring": {
15
- "type": "object",
16
- "properties": {
17
- "weights": {
18
- "type": "object",
19
- "properties": {
20
- "taskCompletion": { "type": "number" },
21
- "toolEfficiency": { "type": "number" },
22
- "responseAppropriateLength": { "type": "number" },
23
- "latencyRelative": { "type": "number" },
24
- "userFeedback": { "type": "number" }
25
- }
26
- }
27
- }
28
- },
29
- "injection": {
30
- "type": "object",
31
- "properties": {
32
- "maxLearnings": { "type": "number" },
33
- "minRelevance": { "type": "number" },
34
- "maxTokens": { "type": "number" },
35
- "cacheTtlMs": { "type": "number" }
36
- }
37
- },
38
- "decay": {
39
- "type": "object",
40
- "properties": {
41
- "halfLifeDays": { "type": "number" }
42
- }
43
- }
44
- }
45
- }
46
- }