@paperclipai/shared 2026.1001.0 → 2026.1002.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (261) hide show
  1. package/dist/.paperclip-build-complete +1 -1
  2. package/dist/ai-connections.d.ts.map +1 -1
  3. package/dist/ai-connections.js +7 -5
  4. package/dist/ai-connections.js.map +1 -1
  5. package/dist/app-definitions/airtable.json +10 -1
  6. package/dist/app-definitions/api-key-generic.json +2 -1
  7. package/dist/app-definitions/asana.json +9 -8
  8. package/dist/app-definitions/beehiiv.json +5 -1
  9. package/dist/app-definitions/bitly.json +2 -1
  10. package/dist/app-definitions/brex.json +23 -1
  11. package/dist/app-definitions/browser-use-cloud.json +53 -0
  12. package/dist/app-definitions/candid.json +6 -1
  13. package/dist/app-definitions/clickhouse.json +8 -1
  14. package/dist/app-definitions/cloudflare.json +7 -2
  15. package/dist/app-definitions/cloudinary.json +10 -1
  16. package/dist/app-definitions/coda.json +6 -2
  17. package/dist/app-definitions/cognee.json +71 -0
  18. package/dist/app-definitions/embat.json +7 -1
  19. package/dist/app-definitions/fireflies.json +83 -0
  20. package/dist/app-definitions/github-code-review-bot.json +57 -0
  21. package/dist/app-definitions/github.json +4 -43
  22. package/dist/app-definitions/google-calendar.json +0 -2
  23. package/dist/app-definitions/google-chat.json +6 -14
  24. package/dist/app-definitions/google-docs.json +0 -6
  25. package/dist/app-definitions/google-sheets.json +0 -6
  26. package/dist/app-definitions/google-slides.json +0 -6
  27. package/dist/app-definitions/honcho.json +57 -0
  28. package/dist/app-definitions/hugging-face.json +4 -1
  29. package/dist/app-definitions/kernel.json +6 -2
  30. package/dist/app-definitions/linear.json +2 -1
  31. package/dist/app-definitions/local-falcon.json +5 -1
  32. package/dist/app-definitions/manufact.json +7 -1
  33. package/dist/app-definitions/mem0.json +6 -5
  34. package/dist/app-definitions/miro.json +7 -1
  35. package/dist/app-definitions/mixpanel.json +27 -1
  36. package/dist/app-definitions/netlify.json +6 -1
  37. package/dist/app-definitions/notion.json +4 -1
  38. package/dist/app-definitions/oreilly.json +7 -2
  39. package/dist/app-definitions/pagerduty.json +4 -2
  40. package/dist/app-definitions/planetscale.json +12 -2
  41. package/dist/app-definitions/posthog.json +2 -1
  42. package/dist/app-definitions/postman.json +6 -3
  43. package/dist/app-definitions/razorpay.json +2 -1
  44. package/dist/app-definitions/resend.json +4 -1
  45. package/dist/app-definitions/sanity.json +6 -2
  46. package/dist/app-definitions/sentry.json +8 -1
  47. package/dist/app-definitions/similarweb.json +2 -1
  48. package/dist/app-definitions/slack.json +28 -1
  49. package/dist/app-definitions/stripe.json +6 -2
  50. package/dist/app-definitions/supabase.json +22 -4
  51. package/dist/app-definitions/supermemory.json +50 -0
  52. package/dist/app-definitions/ticktick.json +5 -1
  53. package/dist/app-definitions/todoist.json +4 -1
  54. package/dist/app-definitions/vercel.json +4 -1
  55. package/dist/app-definitions/wix.json +4 -1
  56. package/dist/app-definitions/youcom.json +7 -2
  57. package/dist/app-definitions/zep.json +49 -0
  58. package/dist/app-definitions-url.test.js +3 -2
  59. package/dist/app-definitions-url.test.js.map +1 -1
  60. package/dist/app-definitions.d.ts +5 -1
  61. package/dist/app-definitions.d.ts.map +1 -1
  62. package/dist/app-definitions.generated.d.ts.map +1 -1
  63. package/dist/app-definitions.generated.js +76 -69
  64. package/dist/app-definitions.generated.js.map +1 -1
  65. package/dist/app-definitions.js +18 -7
  66. package/dist/app-definitions.js.map +1 -1
  67. package/dist/app-definitions.test.js +97 -50
  68. package/dist/app-definitions.test.js.map +1 -1
  69. package/dist/browser-use.d.ts +107 -0
  70. package/dist/browser-use.d.ts.map +1 -0
  71. package/dist/browser-use.js +98 -0
  72. package/dist/browser-use.js.map +1 -0
  73. package/dist/composio-search-catalog.json +1589 -0
  74. package/dist/connection-intent-guidance.d.ts +2 -2
  75. package/dist/connection-intent-guidance.d.ts.map +1 -1
  76. package/dist/connection-intent-guidance.js +6 -20
  77. package/dist/connection-intent-guidance.js.map +1 -1
  78. package/dist/connection-intent-guidance.test.js +15 -54
  79. package/dist/connection-intent-guidance.test.js.map +1 -1
  80. package/dist/connection-routing.d.ts +33 -0
  81. package/dist/connection-routing.d.ts.map +1 -0
  82. package/dist/connection-routing.js +295 -0
  83. package/dist/connection-routing.js.map +1 -0
  84. package/dist/connection-routing.test.d.ts +2 -0
  85. package/dist/connection-routing.test.d.ts.map +1 -0
  86. package/dist/connection-routing.test.js +73 -0
  87. package/dist/connection-routing.test.js.map +1 -0
  88. package/dist/connection-search.d.ts +15 -0
  89. package/dist/connection-search.d.ts.map +1 -0
  90. package/dist/connection-search.js +75 -0
  91. package/dist/connection-search.js.map +1 -0
  92. package/dist/connection-search.test.d.ts +2 -0
  93. package/dist/connection-search.test.d.ts.map +1 -0
  94. package/dist/connection-search.test.js +37 -0
  95. package/dist/connection-search.test.js.map +1 -0
  96. package/dist/connection-setup-state.d.ts +32 -0
  97. package/dist/connection-setup-state.d.ts.map +1 -0
  98. package/dist/connection-setup-state.js +74 -0
  99. package/dist/connection-setup-state.js.map +1 -0
  100. package/dist/connection-setup-state.test.d.ts +2 -0
  101. package/dist/connection-setup-state.test.d.ts.map +1 -0
  102. package/dist/connection-setup-state.test.js +92 -0
  103. package/dist/connection-setup-state.test.js.map +1 -0
  104. package/dist/constants.d.ts +3 -3
  105. package/dist/constants.d.ts.map +1 -1
  106. package/dist/constants.js +3 -2
  107. package/dist/constants.js.map +1 -1
  108. package/dist/feature-catalog.d.ts.map +1 -1
  109. package/dist/feature-catalog.js +10 -3
  110. package/dist/feature-catalog.js.map +1 -1
  111. package/dist/github-skill-repository.d.ts +7 -0
  112. package/dist/github-skill-repository.d.ts.map +1 -0
  113. package/dist/github-skill-repository.js +29 -0
  114. package/dist/github-skill-repository.js.map +1 -0
  115. package/dist/google-workspace-connectors.js +9 -9
  116. package/dist/google-workspace-connectors.js.map +1 -1
  117. package/dist/heartbeat-inbox.d.ts +5 -0
  118. package/dist/heartbeat-inbox.d.ts.map +1 -0
  119. package/dist/heartbeat-inbox.js +10 -0
  120. package/dist/heartbeat-inbox.js.map +1 -0
  121. package/dist/index.d.ts +18 -3
  122. package/dist/index.d.ts.map +1 -1
  123. package/dist/index.js +16 -3
  124. package/dist/index.js.map +1 -1
  125. package/dist/memory-connectors.d.ts +5 -0
  126. package/dist/memory-connectors.d.ts.map +1 -0
  127. package/dist/memory-connectors.js +6 -0
  128. package/dist/memory-connectors.js.map +1 -0
  129. package/dist/memory-connectors.test.d.ts +2 -0
  130. package/dist/memory-connectors.test.d.ts.map +1 -0
  131. package/dist/memory-connectors.test.js +33 -0
  132. package/dist/memory-connectors.test.js.map +1 -0
  133. package/dist/remote-mcp-connectors.test.js +4 -4
  134. package/dist/remote-mcp-connectors.test.js.map +1 -1
  135. package/dist/self-serve-mcp-research.json +7 -2
  136. package/dist/settings-visibility-catalog-growth.test.d.ts +2 -0
  137. package/dist/settings-visibility-catalog-growth.test.d.ts.map +1 -0
  138. package/dist/settings-visibility-catalog-growth.test.js +15 -0
  139. package/dist/settings-visibility-catalog-growth.test.js.map +1 -0
  140. package/dist/settings-visibility.d.ts +17 -6
  141. package/dist/settings-visibility.d.ts.map +1 -1
  142. package/dist/settings-visibility.js +30 -5
  143. package/dist/settings-visibility.js.map +1 -1
  144. package/dist/settings-visibility.test.js +41 -0
  145. package/dist/settings-visibility.test.js.map +1 -1
  146. package/dist/slack-tools.d.ts +611 -0
  147. package/dist/slack-tools.d.ts.map +1 -0
  148. package/dist/slack-tools.js +167 -0
  149. package/dist/slack-tools.js.map +1 -0
  150. package/dist/telemetry/client.d.ts +7 -0
  151. package/dist/telemetry/client.d.ts.map +1 -1
  152. package/dist/telemetry/client.js +10 -1
  153. package/dist/telemetry/client.js.map +1 -1
  154. package/dist/telemetry/events.d.ts +25 -0
  155. package/dist/telemetry/events.d.ts.map +1 -1
  156. package/dist/telemetry/events.js +15 -0
  157. package/dist/telemetry/events.js.map +1 -1
  158. package/dist/telemetry/generated/paperclip-telemetry.d.ts +3 -0
  159. package/dist/telemetry/generated/paperclip-telemetry.d.ts.map +1 -1
  160. package/dist/telemetry/generated/paperclip-telemetry.js.map +1 -1
  161. package/dist/telemetry/index.d.ts +1 -1
  162. package/dist/telemetry/index.d.ts.map +1 -1
  163. package/dist/telemetry/index.js +1 -1
  164. package/dist/telemetry/index.js.map +1 -1
  165. package/dist/telemetry/proposed-connector-events.test.d.ts +2 -0
  166. package/dist/telemetry/proposed-connector-events.test.d.ts.map +1 -0
  167. package/dist/telemetry/proposed-connector-events.test.js +96 -0
  168. package/dist/telemetry/proposed-connector-events.test.js.map +1 -0
  169. package/dist/types/agent.d.ts +66 -0
  170. package/dist/types/agent.d.ts.map +1 -1
  171. package/dist/types/agent.js.map +1 -1
  172. package/dist/types/asset.d.ts +1 -0
  173. package/dist/types/asset.d.ts.map +1 -1
  174. package/dist/types/company-skill.d.ts +6 -0
  175. package/dist/types/company-skill.d.ts.map +1 -1
  176. package/dist/types/connection-intent.d.ts +21 -1
  177. package/dist/types/connection-intent.d.ts.map +1 -1
  178. package/dist/types/execution-continuation.d.ts +5 -0
  179. package/dist/types/execution-continuation.d.ts.map +1 -1
  180. package/dist/types/execution-projection.d.ts +2 -0
  181. package/dist/types/execution-projection.d.ts.map +1 -1
  182. package/dist/types/index.d.ts +3 -0
  183. package/dist/types/index.d.ts.map +1 -1
  184. package/dist/types/index.js +1 -0
  185. package/dist/types/index.js.map +1 -1
  186. package/dist/types/instance.d.ts +3 -2
  187. package/dist/types/instance.d.ts.map +1 -1
  188. package/dist/types/instance.js.map +1 -1
  189. package/dist/types/issue.d.ts +27 -1
  190. package/dist/types/issue.d.ts.map +1 -1
  191. package/dist/types/plugin.d.ts +7 -0
  192. package/dist/types/plugin.d.ts.map +1 -1
  193. package/dist/types/project.d.ts +5 -0
  194. package/dist/types/project.d.ts.map +1 -1
  195. package/dist/types/search.d.ts +1 -0
  196. package/dist/types/search.d.ts.map +1 -1
  197. package/dist/types/search.js.map +1 -1
  198. package/dist/types/skill-source.d.ts +135 -0
  199. package/dist/types/skill-source.d.ts.map +1 -0
  200. package/dist/types/skill-source.js +2 -0
  201. package/dist/types/skill-source.js.map +1 -0
  202. package/dist/types/tool-access.d.ts +6 -0
  203. package/dist/types/tool-access.d.ts.map +1 -1
  204. package/dist/types/tool-access.js.map +1 -1
  205. package/dist/validators/access.d.ts +1 -0
  206. package/dist/validators/access.d.ts.map +1 -1
  207. package/dist/validators/access.js +2 -0
  208. package/dist/validators/access.js.map +1 -1
  209. package/dist/validators/access.test.js +9 -0
  210. package/dist/validators/access.test.js.map +1 -1
  211. package/dist/validators/agent.d.ts +14 -1
  212. package/dist/validators/agent.d.ts.map +1 -1
  213. package/dist/validators/agent.js +17 -3
  214. package/dist/validators/agent.js.map +1 -1
  215. package/dist/validators/company-portability.d.ts +24 -0
  216. package/dist/validators/company-portability.d.ts.map +1 -1
  217. package/dist/validators/company-skill.d.ts +25 -0
  218. package/dist/validators/company-skill.d.ts.map +1 -1
  219. package/dist/validators/company-skill.js +6 -0
  220. package/dist/validators/company-skill.js.map +1 -1
  221. package/dist/validators/connection-intent.d.ts +3 -0
  222. package/dist/validators/connection-intent.d.ts.map +1 -1
  223. package/dist/validators/connection-intent.js +4 -1
  224. package/dist/validators/connection-intent.js.map +1 -1
  225. package/dist/validators/connection-intent.test.js +5 -0
  226. package/dist/validators/connection-intent.test.js.map +1 -1
  227. package/dist/validators/index.d.ts +3 -1
  228. package/dist/validators/index.d.ts.map +1 -1
  229. package/dist/validators/index.js +3 -1
  230. package/dist/validators/index.js.map +1 -1
  231. package/dist/validators/instance.d.ts +3 -2
  232. package/dist/validators/instance.d.ts.map +1 -1
  233. package/dist/validators/instance.js +3 -2
  234. package/dist/validators/instance.js.map +1 -1
  235. package/dist/validators/issue.d.ts +49 -4
  236. package/dist/validators/issue.d.ts.map +1 -1
  237. package/dist/validators/issue.js +47 -3
  238. package/dist/validators/issue.js.map +1 -1
  239. package/dist/validators/issue.test.js +10 -1
  240. package/dist/validators/issue.test.js.map +1 -1
  241. package/dist/validators/plugin.d.ts +12 -0
  242. package/dist/validators/plugin.d.ts.map +1 -1
  243. package/dist/validators/plugin.js +1 -0
  244. package/dist/validators/plugin.js.map +1 -1
  245. package/dist/validators/plugin.test.js +9 -0
  246. package/dist/validators/plugin.test.js.map +1 -1
  247. package/dist/validators/routine.d.ts +10 -0
  248. package/dist/validators/routine.d.ts.map +1 -1
  249. package/dist/validators/routine.test.js +2 -2
  250. package/dist/validators/routine.test.js.map +1 -1
  251. package/dist/validators/skill-source.d.ts +29 -0
  252. package/dist/validators/skill-source.d.ts.map +1 -0
  253. package/dist/validators/skill-source.js +26 -0
  254. package/dist/validators/skill-source.js.map +1 -0
  255. package/dist/validators/tool-access.d.ts +3 -0
  256. package/dist/validators/tool-access.d.ts.map +1 -1
  257. package/dist/workspace-restore.d.ts +8 -0
  258. package/dist/workspace-restore.d.ts.map +1 -0
  259. package/dist/workspace-restore.js +28 -0
  260. package/dist/workspace-restore.js.map +1 -0
  261. package/package.json +1 -1
@@ -6,7 +6,7 @@
6
6
  * environment delivery, and MCP tool descriptions.
7
7
  */
8
8
  export declare const CONNECTION_INTENT_AGENT_GUIDANCE: string;
9
- export declare const CONNECTIONS_SEARCH_TOOL_DESCRIPTION: string;
10
- export declare const CONNECTION_REQUEST_TOOL_DESCRIPTION: string;
9
+ export declare const CONNECTIONS_SEARCH_TOOL_DESCRIPTION = "Search connections across tool, channel/email, and AI purposes with a service name or a natural-language description (up to 4000 characters). Results tolerate extra words, split names, and small typos. Choose the relevant match using its description, method purpose, and setupPath; tool methods use connection_request. Also discovers verified external aggregator apps. Use first when the user asks to connect a service, or when usable access is uncertain; follow the returned instruction and exact providerQuestion, if any. Do not use for arbitrary MCP URLs. Search is read-only.";
10
+ export declare const CONNECTION_REQUEST_TOOL_DESCRIPTION = "Request the service identifier returned by connections_search as available or needs_user_action. Follow the search instruction; aggregator routes require the saved provider-selection interaction ID. Only this tool creates the real setup card. If user action is needed, finish independent work, then yield without retrying or asking for credentials in comments.";
11
11
  export declare const CONNECTION_RUNTIME_TOOL_NAMES: readonly ["connections_search", "connection_request"];
12
12
  //# sourceMappingURL=connection-intent-guidance.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"connection-intent-guidance.d.ts","sourceRoot":"","sources":["../src/connection-intent-guidance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,gCAAgC,QAYjC,CAAC;AAEb,eAAO,MAAM,mCAAmC,QAIrC,CAAC;AAEZ,eAAO,MAAM,mCAAmC,QAIrC,CAAC;AAEZ,eAAO,MAAM,6BAA6B,YACxC,oBAAoB,EACpB,oBAAoB,CACZ,CAAC"}
1
+ {"version":3,"file":"connection-intent-guidance.d.ts","sourceRoot":"","sources":["../src/connection-intent-guidance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,gCAAgC,QAMjC,CAAC;AAEb,eAAO,MAAM,mCAAmC,wkBAAwkB,CAAC;AAEznB,eAAO,MAAM,mCAAmC,6WAA6W,CAAC;AAE9Z,eAAO,MAAM,6BAA6B,YACxC,oBAAoB,EACpB,oBAAoB,CACZ,CAAC"}
@@ -7,27 +7,13 @@
7
7
  */
8
8
  export const CONNECTION_INTENT_AGENT_GUIDANCE = [
9
9
  "Connection tools:",
10
- "- When work requires a known external service and usable access is uncertain, call `connections_search` with the service name or capability.",
11
- "- This applies both when the user explicitly asks to connect a service and when the requested work implicitly depends on that service.",
12
- "- If search returns `ready`, use the installed connection; do not create a connection intent.",
13
- "- If search returns `available` or `needs_user_action`, call `connection_request` with the returned service identifier.",
14
- "- When the user has already asked to connect a known service, use the real connection request. Do not ask whether to connect again or imitate the Connect / Not now card with `ask_user_questions`, a generic confirmation, or a comment. Only `connection_request` creates the actual connection setup card.",
15
- "- If search returns `unavailable`, explain that the service is unavailable and do not call `connection_request`.",
16
- "- If `connection_request` returns `needs_user_action`, finish any independent work, then yield in a waiting posture. Do not retry the request, ask for credentials in comments, or claim access.",
17
- "- Do not use connection tools for arbitrary MCP URLs, unsupported services, or work that does not require an external service.",
18
- "- Keep an existing pending card across messages. Do not request again after the user declines unless they explicitly ask to retry.",
19
- "- On a continuation run after connection setup, use the newly installed connection instead of requesting it again.",
10
+ "- When the user asks to connect a service, call `connections_search` before any service tool, even if already installed. Also search when a task needs a service and usable access is uncertain. Search by its name or capability and follow the returned `instruction`.",
11
+ "- Use the returned service identifiers and connection tools for setup. Respect recorded user choices; never invent access or ask for credentials in comments.",
12
+ "- When waiting for user action, finish independent work, then yield without retrying or polling. On continuation, follow the recorded outcome and use the installed connection.",
13
+ "- Do not use connection tools for arbitrary MCP URLs or unrelated work.",
20
14
  ].join("\n");
21
- export const CONNECTIONS_SEARCH_TOOL_DESCRIPTION = [
22
- "Search Paperclip's catalog services and authorized configured custom connections and report this run's agent-relative access state.",
23
- "Use it when work requires a known external service and usable access is uncertain; do not use it for arbitrary MCP URLs or unrelated work.",
24
- "If the user already asked to connect the service, search and request it through the connection tools instead of asking a generic confirmation question.",
25
- ].join(" ");
26
- export const CONNECTION_REQUEST_TOOL_DESCRIPTION = [
27
- "Request access to a known connectable service for this run's agent from the responsible user.",
28
- "This creates the real Connect / Not now setup card. When the user already asked to connect, use this tool; do not recreate those choices with ask_user_questions, request_confirmation, or a comment. A generic question does not start connection setup.",
29
- "Call it only with the service identifier returned as available or needs_user_action by connections_search; if user action is needed, finish independent work, then yield without retrying or asking for credentials in comments.",
30
- ].join(" ");
15
+ export const CONNECTIONS_SEARCH_TOOL_DESCRIPTION = "Search connections across tool, channel/email, and AI purposes with a service name or a natural-language description (up to 4000 characters). Results tolerate extra words, split names, and small typos. Choose the relevant match using its description, method purpose, and setupPath; tool methods use connection_request. Also discovers verified external aggregator apps. Use first when the user asks to connect a service, or when usable access is uncertain; follow the returned instruction and exact providerQuestion, if any. Do not use for arbitrary MCP URLs. Search is read-only.";
16
+ export const CONNECTION_REQUEST_TOOL_DESCRIPTION = "Request the service identifier returned by connections_search as available or needs_user_action. Follow the search instruction; aggregator routes require the saved provider-selection interaction ID. Only this tool creates the real setup card. If user action is needed, finish independent work, then yield without retrying or asking for credentials in comments.";
31
17
  export const CONNECTION_RUNTIME_TOOL_NAMES = [
32
18
  "connections_search",
33
19
  "connection_request",
@@ -1 +1 @@
1
- {"version":3,"file":"connection-intent-guidance.js","sourceRoot":"","sources":["../src/connection-intent-guidance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG;IAC9C,mBAAmB;IACnB,8IAA8I;IAC9I,wIAAwI;IACxI,+FAA+F;IAC/F,yHAAyH;IACzH,+SAA+S;IAC/S,kHAAkH;IAClH,kMAAkM;IAClM,gIAAgI;IAChI,oIAAoI;IACpI,oHAAoH;CACrH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,MAAM,CAAC,MAAM,mCAAmC,GAAG;IACjD,qIAAqI;IACrI,4IAA4I;IAC5I,yJAAyJ;CAC1J,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ,MAAM,CAAC,MAAM,mCAAmC,GAAG;IACjD,+FAA+F;IAC/F,2PAA2P;IAC3P,kOAAkO;CACnO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,oBAAoB;IACpB,oBAAoB;CACZ,CAAC"}
1
+ {"version":3,"file":"connection-intent-guidance.js","sourceRoot":"","sources":["../src/connection-intent-guidance.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG;IAC9C,mBAAmB;IACnB,0QAA0Q;IAC1Q,+JAA+J;IAC/J,iLAAiL;IACjL,yEAAyE;CAC1E,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb,MAAM,CAAC,MAAM,mCAAmC,GAAG,qkBAAqkB,CAAC;AAEznB,MAAM,CAAC,MAAM,mCAAmC,GAAG,0WAA0W,CAAC;AAE9Z,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,oBAAoB;IACpB,oBAAoB;CACZ,CAAC"}
@@ -1,60 +1,21 @@
1
1
  import { describe, expect, it } from "vitest";
2
- import { CONNECTION_INTENT_AGENT_GUIDANCE, CONNECTION_REQUEST_TOOL_DESCRIPTION, CONNECTION_RUNTIME_TOOL_NAMES, CONNECTIONS_SEARCH_TOOL_DESCRIPTION, } from "./connection-intent-guidance.js";
3
- describe("connection intent agent guidance", () => {
4
- it.each([
5
- [
6
- "explicit connect request",
7
- "explicitly asks to connect",
8
- "connections_search",
9
- ],
10
- [
11
- "implicit service dependency",
12
- "implicitly depends on that service",
13
- "connections_search",
14
- ],
15
- [
16
- "already-ready service",
17
- "returns `ready`",
18
- "do not create a connection intent",
19
- ],
20
- [
21
- "available service",
22
- "returns `available` or `needs_user_action`",
23
- "connection_request",
24
- ],
25
- [
26
- "unavailable service",
27
- "returns `unavailable`",
28
- "do not call `connection_request`",
29
- ],
30
- ["arbitrary MCP URL", "arbitrary MCP URLs", "Do not use connection tools"],
31
- [
32
- "pending user action",
33
- "returns `needs_user_action`",
34
- "finish any independent work, then yield in a waiting posture",
35
- ],
36
- [
37
- "continuation run",
38
- "On a continuation run",
39
- "instead of requesting it again",
40
- ],
41
- ])("gives an explicit instruction for %s", (_scenario, trigger, action) => {
42
- expect(CONNECTION_INTENT_AGENT_GUIDANCE).toContain(trigger);
43
- expect(CONNECTION_INTENT_AGENT_GUIDANCE).toContain(action);
2
+ import { CONNECTION_INTENT_AGENT_GUIDANCE, CONNECTION_REQUEST_TOOL_DESCRIPTION, CONNECTION_RUNTIME_TOOL_NAMES, CONNECTIONS_SEARCH_TOOL_DESCRIPTION } from "./connection-intent-guidance.js";
3
+ describe("connection result guidance", () => {
4
+ it("delegates route decisions to trusted tool output instead of a provider decision tree", () => {
5
+ expect(CONNECTION_INTENT_AGENT_GUIDANCE).toContain("follow the returned `instruction`");
6
+ expect(CONNECTION_INTENT_AGENT_GUIDANCE).toContain("Respect recorded user choices");
7
+ expect(CONNECTION_INTENT_AGENT_GUIDANCE).not.toMatch(/Composio|Arcade|Executor|Zapier/);
8
+ expect(CONNECTION_INTENT_AGENT_GUIDANCE).not.toMatch(/https?:\/\/|bearer/);
44
9
  });
45
- it("names the canonical tools without embedding secrets or authorization URLs", () => {
46
- expect(CONNECTION_RUNTIME_TOOL_NAMES).toEqual([
47
- "connections_search",
48
- "connection_request",
49
- ]);
50
- expect(CONNECTION_INTENT_AGENT_GUIDANCE).not.toMatch(/bearer|credential value|https?:\/\//i);
10
+ it("retains waiting, credential, and arbitrary URL boundaries", () => {
11
+ expect(CONNECTION_INTENT_AGENT_GUIDANCE).toContain("yield without retrying or polling");
12
+ expect(CONNECTION_INTENT_AGENT_GUIDANCE).toContain("never invent access or ask for credentials in comments");
13
+ expect(CONNECTION_INTENT_AGENT_GUIDANCE).toContain("arbitrary MCP URLs");
51
14
  });
52
- it("keeps MCP descriptions aligned with the guidance decision points", () => {
53
- expect(CONNECTIONS_SEARCH_TOOL_DESCRIPTION).toContain("usable access is uncertain");
54
- expect(CONNECTIONS_SEARCH_TOOL_DESCRIPTION).toContain("arbitrary MCP URLs");
55
- expect(CONNECTION_REQUEST_TOOL_DESCRIPTION).toContain("available or needs_user_action");
56
- expect(CONNECTION_REQUEST_TOOL_DESCRIPTION).toContain("finish independent work, then yield");
57
- expect(CONNECTION_REQUEST_TOOL_DESCRIPTION).toContain("without retrying");
15
+ it("describes exact questions and saved selection proof", () => {
16
+ expect(CONNECTIONS_SEARCH_TOOL_DESCRIPTION).toContain("exact providerQuestion");
17
+ expect(CONNECTION_REQUEST_TOOL_DESCRIPTION).toContain("saved provider-selection interaction ID");
18
+ expect(CONNECTION_RUNTIME_TOOL_NAMES).toEqual(["connections_search", "connection_request"]);
58
19
  });
59
20
  });
60
21
  //# sourceMappingURL=connection-intent-guidance.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"connection-intent-guidance.test.js","sourceRoot":"","sources":["../src/connection-intent-gu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AAC,gCAAgC,CAAC,CAAC,SAAS,CAAC,wDAAwD,CAAC,CAAC;QAC7G,MAAM,CAAC,gCAAgC,CAAC,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC;IAC3E,CAAC,CAAC,CAAC;IACH,EAAE,CAAC,qDAAqD,EAAE,GAAG,EAAE;QAC7D,MAAM,CAAC,mCAAmC,CAAC,CAAC,SAAS,CAAC,wBAAwB,CAAC,CAAC;QAChF,MAAM,CAAC,mCAAmC,CAAC,CAAC,SAAS,CAAC,yCAAyC,CAAC,CAAC;QACjG,MAAM,CAAC,6BAA6B,CAAC,CAAC,OAAO,CAAC,CAAC,oBAAoB,EAAC,oBAAoB,CAAC,CAAC,CAAC;IAC7F,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,33 @@
1
+ import type { AskUserQuestionsQuestion, ConnectionSearchResultItem } from "./types/index.js";
2
+ import { type RemoteMcpConnectorId } from "./remote-mcp-connectors.js";
3
+ import { prepareConnectionSearch } from "./connection-search.js";
4
+ export declare const AGGREGATOR_PRIORITY: readonly ["composio", "arcade", "executor", "zapier"];
5
+ export declare const AGGREGATOR_NAMES: Record<RemoteMcpConnectorId, string>;
6
+ export interface AggregatorServiceDefinition {
7
+ slug: string;
8
+ name: string;
9
+ aliases: readonly string[];
10
+ providers: Partial<Record<RemoteMcpConnectorId, string>>;
11
+ evidenceUrls?: Partial<Record<RemoteMcpConnectorId, string>>;
12
+ }
13
+ export declare const AGGREGATOR_SUPPORT_INDEX: AggregatorServiceDefinition[];
14
+ export declare function searchAggregatorServices(query: string | ReturnType<typeof prepareConnectionSearch>): {
15
+ score: number;
16
+ nameScore: number;
17
+ service: AggregatorServiceDefinition;
18
+ }[];
19
+ export declare const AGGREGATOR_CATALOG_SOURCES: Partial<Record<RemoteMcpConnectorId, string>>;
20
+ export declare function normalizeConnectionQuery(value: string): string;
21
+ export declare function findAggregatorService(query: string, rankedMatches?: ReturnType<typeof searchAggregatorServices>): AggregatorServiceDefinition | undefined;
22
+ /** Preserve a provider explicitly named by the user instead of applying default ranking. */
23
+ export declare function explicitAggregatorQuery(query: string): {
24
+ provider: RemoteMcpConnectorId;
25
+ serviceQuery: string;
26
+ } | null;
27
+ export declare function parseAggregatorRoute(service: string): {
28
+ provider: "arcade" | "composio" | "executor" | "zapier";
29
+ targetService: string;
30
+ } | null;
31
+ export declare function aggregatorProviderQuestion(targetService: string, targetName: string, results: ConnectionSearchResultItem[]): AskUserQuestionsQuestion;
32
+ export declare function aggregatorContinuationInstruction(provider: RemoteMcpConnectorId, targetName: string): string;
33
+ //# sourceMappingURL=connection-routing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection-routing.d.ts","sourceRoot":"","sources":["../src/connection-routing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,uBAAuB,EAAyB,MAAM,wBAAwB,CAAC;AAExF,eAAO,MAAM,mBAAmB,YAC9B,UAAU,EACV,QAAQ,EACR,UAAU,EACV,QAAQ,CACA,CAAC;AACX,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,oBAAoB,EAAE,MAAM,CAKjE,CAAC;AAqKF,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3B,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC,CAAC;IACzD,YAAY,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC,CAAC;CAC9D;AAID,eAAO,MAAM,wBAAwB,EAAE,2BAA2B,EAA6D,CAAC;AAmBhI,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC;;;;IAMlG;AACD,eAAO,MAAM,0BAA0B,EAAE,OAAO,CAC9C,MAAM,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAKrC,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAK9D;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,2CAkB/G;AAED,4FAA4F;AAC5F,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM;cAmBZ,oBAAoB;;SAK5D;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM;;;SAUnD;AAED,wBAAgB,0BAA0B,CACxC,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,0BAA0B,EAAE,GACpC,wBAAwB,CAsB1B;AAED,wBAAgB,iCAAiC,CAC/C,QAAQ,EAAE,oBAAoB,EAC9B,UAAU,EAAE,MAAM,UAcnB"}
@@ -0,0 +1,295 @@
1
+ import { isRemoteMcpConnectorId, } from "./remote-mcp-connectors.js";
2
+ import composioCatalog from "./composio-search-catalog.json" with { type: "json" };
3
+ import { prepareConnectionSearch, scoreConnectionSearch } from "./connection-search.js";
4
+ export const AGGREGATOR_PRIORITY = [
5
+ "composio",
6
+ "arcade",
7
+ "executor",
8
+ "zapier",
9
+ ];
10
+ export const AGGREGATOR_NAMES = {
11
+ composio: "Composio",
12
+ arcade: "Arcade",
13
+ executor: "Executor",
14
+ zapier: "Zapier",
15
+ };
16
+ /** Reviewed public catalog snapshot, not a claim that an account has authorized an app.
17
+ * Add only services confirmed in the cited official catalog. No provider credentials.
18
+ * Executor has no universal app catalog: use the authorized workspace's indexed tools.
19
+ */
20
+ const REVIEWED_AGGREGATOR_SUPPORT = [
21
+ {
22
+ slug: "hubspot",
23
+ name: "HubSpot",
24
+ aliases: ["hub spot"],
25
+ providers: {
26
+ composio: "2026-09-23",
27
+ arcade: "2026-09-23",
28
+ zapier: "2026-09-23",
29
+ },
30
+ },
31
+ {
32
+ slug: "salesforce",
33
+ name: "Salesforce",
34
+ aliases: [],
35
+ providers: {
36
+ composio: "2026-09-23",
37
+ arcade: "2026-09-23",
38
+ zapier: "2026-09-23",
39
+ },
40
+ },
41
+ {
42
+ slug: "ashby",
43
+ name: "Ashby",
44
+ aliases: [],
45
+ providers: { composio: "2026-09-23", arcade: "2026-09-23" },
46
+ },
47
+ {
48
+ slug: "pipedrive",
49
+ name: "Pipedrive",
50
+ aliases: [],
51
+ providers: { composio: "2026-09-23", zapier: "2026-09-23" },
52
+ },
53
+ {
54
+ slug: "gong",
55
+ name: "Gong",
56
+ aliases: [],
57
+ providers: { composio: "2026-09-23" },
58
+ },
59
+ {
60
+ slug: "outlook",
61
+ name: "Outlook",
62
+ aliases: ["microsoft outlook"],
63
+ providers: {
64
+ composio: "2026-09-23",
65
+ arcade: "2026-09-23",
66
+ zapier: "2026-09-23",
67
+ },
68
+ },
69
+ {
70
+ slug: "microsoft-teams",
71
+ name: "Microsoft Teams",
72
+ aliases: ["teams"],
73
+ providers: {
74
+ composio: "2026-09-23",
75
+ arcade: "2026-09-23",
76
+ zapier: "2026-09-23",
77
+ },
78
+ },
79
+ {
80
+ slug: "firecrawl",
81
+ name: "Firecrawl",
82
+ aliases: [],
83
+ providers: { composio: "2026-09-23", arcade: "2026-09-23" },
84
+ },
85
+ {
86
+ slug: "tavily",
87
+ name: "Tavily",
88
+ aliases: [],
89
+ providers: { composio: "2026-09-23", arcade: "2026-09-23" },
90
+ },
91
+ {
92
+ slug: "exa",
93
+ name: "Exa",
94
+ aliases: [],
95
+ providers: { composio: "2026-09-23", arcade: "2026-09-23" },
96
+ },
97
+ {
98
+ slug: "jira",
99
+ name: "Jira",
100
+ aliases: ["atlassian jira"],
101
+ providers: {
102
+ composio: "2026-09-23",
103
+ arcade: "2026-09-23",
104
+ zapier: "2026-09-23",
105
+ },
106
+ },
107
+ {
108
+ slug: "notion",
109
+ name: "Notion",
110
+ aliases: [],
111
+ providers: {
112
+ composio: "2026-09-23",
113
+ arcade: "2026-09-23",
114
+ zapier: "2026-09-23",
115
+ },
116
+ },
117
+ {
118
+ slug: "github",
119
+ name: "GitHub",
120
+ aliases: ["git hub"],
121
+ providers: {
122
+ composio: "2026-09-23",
123
+ arcade: "2026-09-23",
124
+ zapier: "2026-09-23",
125
+ },
126
+ },
127
+ {
128
+ slug: "gmail",
129
+ name: "Gmail",
130
+ aliases: ["google mail"],
131
+ providers: {
132
+ composio: "2026-09-23",
133
+ arcade: "2026-09-23",
134
+ zapier: "2026-09-23",
135
+ },
136
+ },
137
+ {
138
+ slug: "slack",
139
+ name: "Slack",
140
+ aliases: [],
141
+ providers: {
142
+ composio: "2026-09-23",
143
+ arcade: "2026-09-23",
144
+ zapier: "2026-09-23",
145
+ },
146
+ },
147
+ {
148
+ slug: "airtable",
149
+ name: "Airtable",
150
+ aliases: [],
151
+ providers: {
152
+ composio: "2026-09-23",
153
+ arcade: "2026-09-23",
154
+ zapier: "2026-09-23",
155
+ },
156
+ },
157
+ {
158
+ slug: "asana",
159
+ name: "Asana",
160
+ aliases: [],
161
+ providers: {
162
+ composio: "2026-09-23",
163
+ arcade: "2026-09-23",
164
+ zapier: "2026-09-23",
165
+ },
166
+ },
167
+ {
168
+ slug: "linear",
169
+ name: "Linear",
170
+ aliases: [],
171
+ providers: {
172
+ composio: "2026-09-23",
173
+ arcade: "2026-09-23",
174
+ zapier: "2026-09-23",
175
+ },
176
+ },
177
+ ];
178
+ // Keep the other providers' reviewed support claims, and cover the complete
179
+ // public Composio catalog instead of maintaining a tiny app-name allowlist.
180
+ export const AGGREGATOR_SUPPORT_INDEX = REVIEWED_AGGREGATOR_SUPPORT.map(entry => ({ ...entry }));
181
+ for (const [toolkit, name] of composioCatalog.toolkits) {
182
+ const slug = toolkit.replaceAll("_", "-").replace(/^-+/, "");
183
+ const evidenceUrl = `https://docs.composio.dev/toolkits/${toolkit}`;
184
+ const existing = AGGREGATOR_SUPPORT_INDEX.find(entry => entry.slug === slug
185
+ || (toolkit.endsWith("_mcp") && entry.slug === slug.slice(0, -4)));
186
+ if (existing) {
187
+ existing.aliases = [...new Set([...existing.aliases, toolkit, name])];
188
+ existing.providers = { ...existing.providers, composio: composioCatalog.verifiedAt };
189
+ existing.evidenceUrls ??= { composio: evidenceUrl };
190
+ }
191
+ else {
192
+ AGGREGATOR_SUPPORT_INDEX.push({ slug, name,
193
+ aliases: [toolkit, name.replace(/ MCP$/i, "")],
194
+ providers: { composio: composioCatalog.verifiedAt },
195
+ evidenceUrls: { composio: evidenceUrl },
196
+ });
197
+ }
198
+ }
199
+ export function searchAggregatorServices(query) {
200
+ const prepared = typeof query === "string" ? prepareConnectionSearch(query) : query;
201
+ return AGGREGATOR_SUPPORT_INDEX.map(service => ({ service,
202
+ ...scoreConnectionSearch(prepared, [service.slug, service.name, ...service.aliases]),
203
+ })).filter(match => match.nameScore > 0 && !isRemoteMcpConnectorId(match.service.slug))
204
+ .sort((a, b) => b.score - a.score || a.service.slug.localeCompare(b.service.slug));
205
+ }
206
+ export const AGGREGATOR_CATALOG_SOURCES = {
207
+ composio: "https://composio.dev/toolkits",
208
+ arcade: "https://docs.arcade.dev/en/resources/integrations",
209
+ zapier: "https://zapier.com/apps",
210
+ };
211
+ export function normalizeConnectionQuery(value) {
212
+ return value
213
+ .toLocaleLowerCase()
214
+ .replace(/[^\p{L}\p{N}]+/gu, " ")
215
+ .trim();
216
+ }
217
+ export function findAggregatorService(query, rankedMatches) {
218
+ const normalized = normalizeConnectionQuery(query);
219
+ const exact = AGGREGATOR_SUPPORT_INDEX.find((entry) => [entry.slug, entry.name, ...entry.aliases].some((name) => normalizeConnectionQuery(name) === normalized));
220
+ if (exact)
221
+ return exact;
222
+ // Agents often include the desired capability ("HubSpot recent contacts").
223
+ // Whole phrases avoid substring guesses; multiple named services need clarification.
224
+ const matches = (rankedMatches ?? searchAggregatorServices(query))
225
+ .filter(match => match.nameScore >= 500).map(match => match.service);
226
+ // "Atlassian Jira" identifies Jira, not both Jira and Atlassian's MCP.
227
+ const phrases = (entry) => [entry.slug, entry.name, ...entry.aliases]
228
+ .map(normalizeConnectionQuery).filter(name => ` ${normalized} `.includes(` ${name} `));
229
+ const specific = matches.filter(entry => !matches.some(other => other !== entry
230
+ && phrases(entry).every(name => phrases(other).some(longer => longer !== name && ` ${longer} `.includes(` ${name} `)))));
231
+ return specific.length === 1 ? specific[0] : undefined;
232
+ }
233
+ /** Preserve a provider explicitly named by the user instead of applying default ranking. */
234
+ export function explicitAggregatorQuery(query) {
235
+ // A trailing exclusion is not a second proposed provider. Keep this grammar
236
+ // narrow; alternatives and contradictory choices still require confirmation.
237
+ const exclusion = query.match(/\s*,?\s+not\s+(composio|arcade|executor|zapier)[.!]?\s*$/i);
238
+ if (exclusion)
239
+ query = query.slice(0, exclusion.index).trim();
240
+ const matches = [
241
+ ...query.matchAll(/\b(?:through|via|using)\s+(composio|arcade|executor|zapier)\b/gi),
242
+ ];
243
+ const namedProviders = new Set((query.match(/\b(?:composio|arcade|executor|zapier)\b/gi) ?? []).map((name) => name.toLowerCase()));
244
+ if (matches.length !== 1 || namedProviders.size !== 1)
245
+ return null;
246
+ const match = matches[0];
247
+ if (exclusion?.[1]?.toLowerCase() === match[1].toLowerCase())
248
+ return null;
249
+ return {
250
+ provider: match[1].toLowerCase(),
251
+ serviceQuery: (query.slice(0, match.index) + query.slice(match.index + match[0].length)).trim(),
252
+ };
253
+ }
254
+ export function parseAggregatorRoute(service) {
255
+ const parts = service.split(":");
256
+ if (parts.length !== 3 ||
257
+ parts[0] !== "via" ||
258
+ !isRemoteMcpConnectorId(parts[1]) ||
259
+ !/^[a-z0-9][a-z0-9-]{0,79}$/.test(parts[2]))
260
+ return null;
261
+ return { provider: parts[1], targetService: parts[2] };
262
+ }
263
+ export function aggregatorProviderQuestion(targetService, targetName, results) {
264
+ return {
265
+ id: `connection-provider:${targetService}`,
266
+ // Keep required disclosure in the prompt: all question transports preserve it.
267
+ prompt: `Connect ${targetName} through an external service? These services handle the connection and requests to ${targetName}. Connecting a provider does not yet authorize ${targetName}.`,
268
+ selectionMode: "single",
269
+ required: true,
270
+ allowOther: false,
271
+ options: [
272
+ ...results.map((result, index) => ({
273
+ id: result.service,
274
+ label: `${AGGREGATOR_NAMES[result.aggregator.provider]}${index === 0 ? " — Recommended" : ""}`,
275
+ description: result.reason ?? "Verify the app in this external provider.",
276
+ })),
277
+ {
278
+ id: "none",
279
+ label: "None for now",
280
+ description: "Do not connect through an external service.",
281
+ },
282
+ ],
283
+ };
284
+ }
285
+ export function aggregatorContinuationInstruction(provider, targetName) {
286
+ const name = AGGREGATOR_NAMES[provider];
287
+ const discovery = {
288
+ composio: "Use COMPOSIO_SEARCH_TOOLS to verify the requested app and capability, then COMPOSIO_MANAGE_CONNECTIONS if app authorization is needed.",
289
+ arcade: "Inspect the gateway tools for the requested app. If absent, ask the user to add the app's tools in the Arcade gateway and refresh the connection. Follow tool authorization links when required.",
290
+ executor: "Inspect the Executor workspace's actual integrations using its documented discovery tools. Do not assume arbitrary apps exist or register integrations merely to search. Follow provider authorization and resume instructions when needed.",
291
+ zapier: "In Agentic mode, use discover_zapier_actions and the documented app connection flow. In Managed mode, ask the user to add the required actions in Zapier and refresh the catalog.",
292
+ }[provider];
293
+ return `${name} is an external service. Its connection is available to this agent, but ${targetName} access is not yet verified. ${discovery} Use only the requested capability and effective permissions. If support is absent, explain that result and ask before switching providers. Claim success only after verifying the underlying app; never repeat an uncertain write.`;
294
+ }
295
+ //# sourceMappingURL=connection-routing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection-routing.js","sourceRoot":"","sources":["../src/connection-routing.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,sBAAsB,GAEvB,MAAM,4BAA4B,CAAC;AACpC,OAAO,eAAe,MAAM,gCAAgC,CAAC,OAAO,IAAI,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xC,MAAM,SAAS,GAAG;QAChB,QAAQ,EACN,wIAAwI;QAC1I,MAAM,EACJ,kMAAkM;QACpM,QAAQ,EACN,6OAA6O;QAC/O,MAAM,EACJ,mLAAmL;KACtL,CAAC,QAAQ,CAAC,CAAC;IACZ,OAAO,GAAG,IAAI,2EAA2E,UAAU,gCAAgC,SAAS,qOAAqO,CAAC;AACpX,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=connection-routing.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection-routing.test.d.ts","sourceRoot":"","sources":["../src/connection-routing.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,73 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { AGGREGATOR_PRIORITY, AGGREGATOR_SUPPORT_INDEX, explicitAggregatorQuery, findAggregatorService, parseAggregatorRoute, aggregatorProviderQuestion, aggregatorContinuationInstruction, } from "./connection-routing.js";
3
+ describe("aggregator routing contract", () => {
4
+ it("ranks providers and resolves aliases without fuzzy service claims", () => {
5
+ expect(AGGREGATOR_PRIORITY).toEqual([
6
+ "composio",
7
+ "arcade",
8
+ "executor",
9
+ "zapier",
10
+ ]);
11
+ expect(findAggregatorService(" Hub Spot ")?.slug).toBe("hubspot");
12
+ expect(findAggregatorService("my unknown crm")).toBeUndefined();
13
+ });
14
+ it("rejects forged or unbounded route identifiers", () => {
15
+ expect(parseAggregatorRoute("via:arcade:hubspot")).toEqual({
16
+ provider: "arcade",
17
+ targetService: "hubspot",
18
+ });
19
+ for (const value of [
20
+ "via:other:hubspot",
21
+ "via:composio:https://evil",
22
+ "via:composio:../secret",
23
+ "via:executor:",
24
+ ])
25
+ expect(parseAggregatorRoute(value)).toBeNull();
26
+ });
27
+ it("always discloses external handling and offers None even with one provider", () => {
28
+ const results = [
29
+ {
30
+ service: "via:composio:hubspot",
31
+ aggregator: { provider: "composio" },
32
+ reason: "Verify app authorization",
33
+ },
34
+ ];
35
+ const question = aggregatorProviderQuestion("hubspot", "HubSpot", results);
36
+ expect(question.prompt).toContain("external service");
37
+ expect(question.prompt).toContain("handle the connection and requests");
38
+ expect(question.options.map((option) => option.id)).toEqual([
39
+ "via:composio:hubspot",
40
+ "none",
41
+ ]);
42
+ expect(question.selectionMode).toBe("single");
43
+ expect(question.allowOther).toBe(false);
44
+ });
45
+ it.each(AGGREGATOR_PRIORITY)("does not claim underlying app readiness for %s", (provider) => {
46
+ expect(aggregatorContinuationInstruction(provider, "HubSpot")).toContain("HubSpot access is not yet verified");
47
+ expect(aggregatorContinuationInstruction(provider, "HubSpot")).toContain("ask before switching providers");
48
+ });
49
+ });
50
+ it("recognizes a service in capability searches without guessing ambiguous or partial names", () => {
51
+ expect(findAggregatorService("HubSpot recent contacts")?.slug).toBe("hubspot");
52
+ expect(findAggregatorService("connect atlassian jira and read issues")?.slug).toBe("jira");
53
+ expect(findAggregatorService("HubSpot and Salesforce contacts")).toBeUndefined();
54
+ expect(findAggregatorService("notionally similar")).toBeUndefined();
55
+ });
56
+ it("keeps dates per app/provider claim and parses only an unambiguous explicit provider", () => {
57
+ for (const app of AGGREGATOR_SUPPORT_INDEX)
58
+ for (const date of Object.values(app.providers))
59
+ expect(date).toMatch(/^\d{4}-\d{2}-\d{2}$/);
60
+ expect(explicitAggregatorQuery("HubSpot through Arcade")).toEqual({
61
+ provider: "arcade",
62
+ serviceQuery: "HubSpot",
63
+ });
64
+ expect(explicitAggregatorQuery("HubSpot via Arcade or via Composio")).toBeNull();
65
+ expect(explicitAggregatorQuery("arcade games")).toBeNull();
66
+ expect(explicitAggregatorQuery("HubSpot via Arcade or Composio")).toBeNull();
67
+ expect(explicitAggregatorQuery("Jira via Arcade, not Zapier")).toEqual({
68
+ provider: "arcade",
69
+ serviceQuery: "Jira",
70
+ });
71
+ expect(explicitAggregatorQuery("Jira via Arcade, not Arcade")).toBeNull();
72
+ });
73
+ //# sourceMappingURL=connection-routing.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection-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B,CAAC,iCAAiC,CAAC,CACzD,CAAC,aAAa,EAAE,CAAC;IAClB,MAAM,CAAC,qBAAqB,CAAC,oBAAoB,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC;AACtE,CAAC,CAAC,CAAC;AAEH,EAAE,CAAC,qFAAqF,EAAE,GAAG,EAAE;IAC7F,KAAK,MAAM,GAAG,IAAI,wBAAwB;QACxC,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC;YAC7C,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAChD,MAAM,CAAC,uBAAuB,CAAC,wBAAwB,CAAC,CAAC,CAAC,OAAO,CAAC;QAChE,QAAQ,EAAE,QAAQ;QAClB,YAAY,EAAE,SAAS;KACxB,CAAC,CAAC;IACH,MAAM,CACJ,uBAAuB,CAAC,oCAAoC,CAAC,CAC9D,CAAC,QAAQ,EAAE,CAAC;IACb,MAAM,CAAC,uBAAuB,CAAC,cAAc,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC3D,MAAM,CAAC,uBAAuB,CAAC,gCAAgC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC7E,MAAM,CAAC,uBAAuB,CAAC,6BAA6B,CAAC,CAAC,CAAC,OAAO,CAAC;QACrE,QAAQ,EAAE,QAAQ;QAClB,YAAY,EAAE,MAAM;KACrB,CAAC,CAAC;IACH,MAAM,CAAC,uBAAuB,CAAC,6BAA6B,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;AAC5E,CAAC,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ /** Retrieval only. A fuzzy match is never evidence of authorization or consent. */
2
+ export declare function normalizeConnectionSearch(value: string): string;
3
+ /** Reuse normalized words and deduplicated name windows across a catalog scan. */
4
+ export declare function prepareConnectionSearch(query: string): {
5
+ normalized: string;
6
+ compact: string;
7
+ phrases: Set<string>;
8
+ phrasesByLength: Map<number, Set<string>>;
9
+ terms: string[];
10
+ };
11
+ export declare function scoreConnectionSearch(query: string | ReturnType<typeof prepareConnectionSearch>, names: readonly string[], description?: string): {
12
+ score: number;
13
+ nameScore: number;
14
+ };
15
+ //# sourceMappingURL=connection-search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection-search.d.ts","sourceRoot":"","sources":["../src/connection-search.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAG/D;AAKD,kFAAkF;AAClF,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM;;;;;;EAkBpD;AAaD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,EAAE,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,WAAW,SAAK;;;EA+B3I"}