@zackbart/connecta 0.34.1 → 0.36.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 (441) hide show
  1. package/CHANGELOG.md +418 -0
  2. package/README.md +65 -105
  3. package/SECURITY.md +3 -2
  4. package/bin/connecta.mjs +41 -16
  5. package/bin/version.mjs +1 -1
  6. package/dist/access-tokens.d.ts +2 -1
  7. package/dist/access-tokens.js +66 -30
  8. package/dist/activity.d.ts +1 -1
  9. package/dist/activity.js +2 -0
  10. package/dist/agent-config.d.ts +23 -0
  11. package/dist/agent-config.js +59 -0
  12. package/dist/agent-description.js +16 -0
  13. package/dist/agent-identity.js +4 -4
  14. package/dist/agent-observation.js +39 -0
  15. package/dist/auth/clerk-sdk/client.d.ts +2 -0
  16. package/dist/auth/clerk-sdk/generated.js +554 -563
  17. package/dist/auth/clerk-transport.js +70 -3
  18. package/dist/auth/clerk.d.ts +13 -0
  19. package/dist/auth/clerk.js +653 -246
  20. package/dist/auth/cloudflare-access.js +46 -42
  21. package/dist/auth/downstream-client-metadata.js +2 -2
  22. package/dist/auth/downstream-oauth.js +2044 -1161
  23. package/dist/auth/downstream-revocation.js +88 -88
  24. package/dist/auth/native-call.js +20 -0
  25. package/dist/auth/native.js +184 -0
  26. package/dist/auth/oauth-start-reset.js +11 -5
  27. package/dist/auth/oauth-token-response.js +121 -102
  28. package/dist/auth/oauth-v2-migration.js +97 -78
  29. package/dist/auth/renewable-grant.js +10 -0
  30. package/dist/auth/static-oauth.js +751 -281
  31. package/dist/auth/vercel-agent.js +266 -0
  32. package/dist/auth-admission.js +204 -0
  33. package/dist/auth-elicitation.js +350 -241
  34. package/dist/authorization-handoff.js +164 -90
  35. package/dist/call-admission-context.js +3 -10
  36. package/dist/call-admission.js +2 -0
  37. package/dist/call-classification.js +9 -0
  38. package/dist/call-recovery.js +32 -13
  39. package/dist/canonical-json.js +8 -0
  40. package/dist/catalog-cache.js +369 -213
  41. package/dist/catalog-service.js +659 -530
  42. package/dist/catalog.js +5 -1
  43. package/dist/concurrency.js +0 -25
  44. package/dist/config-defaults.d.ts +1 -0
  45. package/dist/config-defaults.js +1 -0
  46. package/dist/config-schema.d.ts +3 -1
  47. package/dist/config-schema.js +13 -3
  48. package/dist/config.d.ts +40 -6
  49. package/dist/config.js +40 -26
  50. package/dist/connector-caller.d.ts +4 -0
  51. package/dist/connector-caller.js +17 -4
  52. package/dist/connectors/api-connector.d.ts +29 -7
  53. package/dist/connectors/api-connector.js +145 -57
  54. package/dist/connectors/guarded-fetch.d.ts +51 -17
  55. package/dist/connectors/guarded-fetch.js +215 -121
  56. package/dist/connectors/negotiation-cache.js +20 -10
  57. package/dist/connectors/remote-mcp.d.ts +10 -30
  58. package/dist/connectors/remote-mcp.js +955 -563
  59. package/dist/d1.js +10 -243
  60. package/dist/derived-context.js +5 -0
  61. package/dist/describe-config.d.ts +3 -1
  62. package/dist/describe-config.js +2 -0
  63. package/dist/downstream-input.js +347 -260
  64. package/dist/errors.d.ts +87 -6
  65. package/dist/errors.js +114 -4
  66. package/dist/execute.js +87 -50
  67. package/dist/executor-admission.js +3 -0
  68. package/dist/executors/quickjs.js +163 -112
  69. package/dist/guarded-transport.js +50 -0
  70. package/dist/guest-runtime.js +1 -1
  71. package/dist/http/client.js +439 -0
  72. package/dist/http/errors.js +558 -0
  73. package/dist/http/fields.js +49 -0
  74. package/dist/http/hatch-paging.js +318 -0
  75. package/dist/http/hatch.js +1279 -0
  76. package/dist/http/json-schema.js +267 -0
  77. package/dist/http/node-transport.js +241 -0
  78. package/dist/http/oauth.js +162 -0
  79. package/dist/http/paging.js +227 -0
  80. package/dist/http/provider.js +221 -0
  81. package/dist/http/safety.js +82 -0
  82. package/dist/http/services.js +79 -0
  83. package/dist/http/tools.js +379 -0
  84. package/dist/http/vendor-index.js +138 -0
  85. package/dist/http/vendor.js +448 -0
  86. package/dist/http/write-request.js +66 -0
  87. package/dist/http-policy.d.ts +11 -0
  88. package/dist/http-policy.js +45 -0
  89. package/dist/inbound-credential.js +1 -1
  90. package/dist/index.d.ts +2 -2
  91. package/dist/index.js +4 -0
  92. package/dist/invocation-auth.js +30 -19
  93. package/dist/invocation.js +218 -85
  94. package/dist/mcp-result.js +0 -4
  95. package/dist/membership.d.ts +4 -0
  96. package/dist/meta-output.js +1 -1
  97. package/dist/meta-tools.js +531 -406
  98. package/dist/native-recovery.js +52 -0
  99. package/dist/native-tools.js +382 -0
  100. package/dist/node.d.ts +4 -3
  101. package/dist/node.js +45 -8
  102. package/dist/oauth-handoff.js +177 -104
  103. package/dist/oauth-partition.js +6 -20
  104. package/dist/oauth-sealing.js +6 -7
  105. package/dist/operation-vocabulary.js +101 -0
  106. package/dist/operator-record.d.ts +2 -2
  107. package/dist/operator-record.js +17 -4
  108. package/dist/operator-ui/contract.d.ts +8 -3
  109. package/dist/operator-ui/generated.js +4 -4
  110. package/dist/operator-ui/model.d.ts +2 -3
  111. package/dist/program-writes.js +47 -26
  112. package/dist/provider-call-facts.d.ts +115 -0
  113. package/dist/provider-call-facts.js +182 -0
  114. package/dist/provider-call.d.ts +112 -0
  115. package/dist/provider-call.js +271 -0
  116. package/dist/provider.d.ts +65 -31
  117. package/dist/provider.js +116 -39
  118. package/dist/providers/_shared/google/hatch.js +91 -0
  119. package/dist/providers/_shared/google/kit.js +427 -0
  120. package/dist/providers/_shared/google/result-size.js +15 -2
  121. package/dist/providers/_shared/google/service-account.d.ts +2 -1
  122. package/dist/providers/_shared/google/service-account.js +8 -4
  123. package/dist/providers/_shared/google/workspace.d.ts +6 -210
  124. package/dist/providers/_shared/google/workspace.js +6 -425
  125. package/dist/providers/_shared/rest/compact-index.js +86 -0
  126. package/dist/providers/_shared/rest/kit.js +146 -0
  127. package/dist/providers/_shared/rest/operation-index.js +230 -14
  128. package/dist/providers/_shared/rest/response-media.js +11 -0
  129. package/dist/providers/_shared/rest/value-safety.js +353 -195
  130. package/dist/providers/_shared/sensitive-fields.js +27 -0
  131. package/dist/providers/breeze/api.js +584 -0
  132. package/dist/providers/breeze/index.d.ts +1 -3
  133. package/dist/providers/breeze/index.js +67 -1420
  134. package/dist/providers/breeze/openapi.generated.js +60 -0
  135. package/dist/providers/breeze/skill.generated.js +2 -6
  136. package/dist/providers/breeze/tools.js +696 -0
  137. package/dist/providers/ccb/api.js +496 -0
  138. package/dist/providers/ccb/index.d.ts +15 -37
  139. package/dist/providers/ccb/index.js +77 -1702
  140. package/dist/providers/ccb/lib/constants.d.ts +34 -0
  141. package/dist/providers/ccb/lib/constants.js +74 -0
  142. package/dist/providers/ccb/lib/guide.js +9 -0
  143. package/dist/providers/ccb/lib/verdicts.js +387 -0
  144. package/dist/providers/ccb/openapi.generated.js +397 -0
  145. package/dist/providers/ccb/safety.js +295 -0
  146. package/dist/providers/ccb/skill.generated.js +2 -6
  147. package/dist/providers/ccb/tools.js +853 -0
  148. package/dist/providers/cloudflare/api.js +1066 -0
  149. package/dist/providers/cloudflare/index.d.ts +5 -22
  150. package/dist/providers/cloudflare/index.js +79 -197
  151. package/dist/providers/cloudflare/lib/config.d.ts +16 -0
  152. package/dist/providers/cloudflare/lib/config.js +2 -0
  153. package/dist/providers/cloudflare/lib/discovery.js +29 -0
  154. package/dist/providers/cloudflare/{graphql.js → lib/graphql.js} +1 -1
  155. package/dist/providers/cloudflare/lib/hatch.js +103 -0
  156. package/dist/providers/cloudflare/lib/path-bounds.js +28 -0
  157. package/dist/providers/cloudflare/lib/response-media.js +75 -0
  158. package/dist/providers/cloudflare/openapi.generated.js +4 -3
  159. package/dist/providers/cloudflare/{value-safety.js → safety.js} +487 -0
  160. package/dist/providers/cloudflare/skill.generated.js +2 -10
  161. package/dist/providers/cloudflare/tools.js +360 -0
  162. package/dist/providers/docs/api.js +51 -0
  163. package/dist/providers/docs/index.d.ts +1 -12
  164. package/dist/providers/docs/index.js +53 -1165
  165. package/dist/providers/docs/lib/constants.d.ts +18 -0
  166. package/dist/providers/docs/lib/constants.js +18 -0
  167. package/dist/providers/docs/lib/discovery.js +26 -0
  168. package/dist/providers/docs/lib/requests.js +48 -0
  169. package/dist/providers/docs/lib/schemas.js +168 -0
  170. package/dist/providers/docs/openapi.generated.js +16 -0
  171. package/dist/providers/docs/safety.js +54 -0
  172. package/dist/providers/docs/skill.generated.js +2 -6
  173. package/dist/providers/docs/tools.js +801 -0
  174. package/dist/providers/drive/api.js +177 -0
  175. package/dist/providers/drive/index.d.ts +1 -12
  176. package/dist/providers/drive/index.js +38 -1448
  177. package/dist/providers/drive/lib/constants.d.ts +6 -0
  178. package/dist/providers/drive/lib/constants.js +6 -0
  179. package/dist/providers/drive/lib/contracts.js +532 -0
  180. package/dist/providers/drive/lib/hatch.js +197 -0
  181. package/dist/providers/drive/openapi.generated.js +77 -0
  182. package/dist/providers/drive/safety.js +90 -0
  183. package/dist/providers/drive/skill.generated.js +2 -6
  184. package/dist/providers/drive/tools.js +1290 -0
  185. package/dist/providers/forms/api.js +71 -0
  186. package/dist/providers/forms/index.d.ts +1 -12
  187. package/dist/providers/forms/index.js +49 -1145
  188. package/dist/providers/forms/lib/constants.d.ts +14 -0
  189. package/dist/providers/forms/lib/constants.js +19 -0
  190. package/dist/providers/forms/lib/hatch.js +72 -0
  191. package/dist/providers/forms/openapi.generated.js +23 -0
  192. package/dist/providers/forms/safety.js +34 -0
  193. package/dist/providers/forms/skill.generated.js +2 -8
  194. package/dist/providers/forms/tools.js +1023 -0
  195. package/dist/providers/github/api.js +150 -0
  196. package/dist/providers/github/index.d.ts +4 -5
  197. package/dist/providers/github/index.js +30 -87
  198. package/dist/providers/github/{auth.d.ts → lib/auth.d.ts} +5 -3
  199. package/dist/providers/github/{auth.js → lib/auth.js} +40 -43
  200. package/dist/providers/github/lib/discovery.js +132 -0
  201. package/dist/providers/github/lib/operations.js +58 -0
  202. package/dist/providers/github/{scope.d.ts → lib/scope.d.ts} +2 -0
  203. package/dist/providers/github/{scope.js → lib/scope.js} +25 -1
  204. package/dist/providers/github/openapi.generated.js +1216 -0
  205. package/dist/providers/github/safety.js +216 -0
  206. package/dist/providers/github/skill.generated.js +2 -5
  207. package/dist/providers/github/tools.js +506 -0
  208. package/dist/providers/gmail/api.js +114 -0
  209. package/dist/providers/gmail/index.d.ts +1 -12
  210. package/dist/providers/gmail/index.js +73 -1621
  211. package/dist/providers/gmail/lib/constants.d.ts +13 -0
  212. package/dist/providers/gmail/lib/constants.js +16 -0
  213. package/dist/providers/gmail/lib/index.js +173 -0
  214. package/dist/providers/gmail/lib/schemas.js +176 -0
  215. package/dist/providers/gmail/lib/threading.js +120 -0
  216. package/dist/providers/gmail/openapi.generated.js +92 -0
  217. package/dist/providers/gmail/safety.js +21 -0
  218. package/dist/providers/gmail/skill.generated.js +2 -6
  219. package/dist/providers/gmail/tools.js +1435 -0
  220. package/dist/providers/overflow/api.js +1008 -0
  221. package/dist/providers/overflow/index.d.ts +1 -17
  222. package/dist/providers/overflow/index.js +60 -1488
  223. package/dist/providers/overflow/skill.generated.js +2 -5
  224. package/dist/providers/overflow/tools.js +873 -0
  225. package/dist/providers/planning-center/api.js +467 -0
  226. package/dist/providers/planning-center/index.d.ts +4 -35
  227. package/dist/providers/planning-center/index.js +69 -2445
  228. package/dist/providers/planning-center/lib/constants.d.ts +58 -0
  229. package/dist/providers/planning-center/lib/constants.js +83 -0
  230. package/dist/providers/planning-center/lib/discovery.js +40 -0
  231. package/dist/providers/planning-center/lib/guide.js +39 -0
  232. package/dist/providers/planning-center/lib/json-api.js +83 -0
  233. package/dist/providers/planning-center/lib/verdicts.js +1758 -0
  234. package/dist/providers/planning-center/openapi.generated.js +1764 -0
  235. package/dist/providers/planning-center/safety.js +188 -0
  236. package/dist/providers/planning-center/skill.generated.js +2 -27
  237. package/dist/providers/planning-center/tools.js +1010 -0
  238. package/dist/providers/quickbooks/api.js +299 -0
  239. package/dist/providers/quickbooks/index.d.ts +13 -0
  240. package/dist/providers/quickbooks/index.js +93 -0
  241. package/dist/providers/quickbooks/lib/query.js +118 -0
  242. package/dist/providers/quickbooks/lib/writes.js +168 -0
  243. package/dist/providers/quickbooks/safety.js +222 -0
  244. package/dist/providers/quickbooks/skill.generated.js +5 -0
  245. package/dist/providers/quickbooks/tools.js +117 -0
  246. package/dist/providers/sheets/api.js +133 -0
  247. package/dist/providers/sheets/index.d.ts +4 -16
  248. package/dist/providers/sheets/index.js +61 -1172
  249. package/dist/providers/sheets/lib/constants.d.ts +14 -0
  250. package/dist/providers/sheets/lib/constants.js +14 -0
  251. package/dist/providers/sheets/lib/hatch.js +163 -0
  252. package/dist/providers/sheets/lib/requests.js +105 -0
  253. package/dist/providers/sheets/lib/schemas.js +138 -0
  254. package/dist/providers/sheets/openapi.generated.js +30 -0
  255. package/dist/providers/sheets/safety.js +27 -0
  256. package/dist/providers/sheets/skill.generated.js +2 -7
  257. package/dist/providers/sheets/tools.js +733 -0
  258. package/dist/providers/slides/api.js +147 -0
  259. package/dist/providers/slides/index.d.ts +2 -10
  260. package/dist/providers/slides/index.js +48 -2555
  261. package/dist/providers/slides/lib/constants.d.ts +11 -0
  262. package/dist/providers/slides/lib/constants.js +11 -0
  263. package/dist/providers/slides/lib/requests.js +60 -0
  264. package/dist/providers/slides/lib/schemas.js +565 -0
  265. package/dist/providers/slides/openapi.generated.js +18 -0
  266. package/dist/providers/slides/skill.generated.js +2 -6
  267. package/dist/providers/slides/tools.js +1968 -0
  268. package/dist/providers/stripe/api.js +401 -0
  269. package/dist/providers/stripe/index.d.ts +5 -27
  270. package/dist/providers/stripe/index.js +74 -210
  271. package/dist/providers/stripe/lib/config.d.ts +4 -0
  272. package/dist/providers/stripe/lib/config.js +2 -0
  273. package/dist/providers/stripe/openapi.generated.js +4 -3
  274. package/dist/providers/stripe/{value-safety.js → safety.js} +5 -5
  275. package/dist/providers/stripe/skill.generated.js +2 -11
  276. package/dist/providers/stripe/tools.js +77 -0
  277. package/dist/providers/tithely/api.js +531 -0
  278. package/dist/providers/tithely/index.d.ts +17 -0
  279. package/dist/providers/tithely/index.js +86 -965
  280. package/dist/providers/tithely/skill.generated.js +2 -5
  281. package/dist/providers/tithely/tools.js +426 -0
  282. package/dist/providers/vercel/api.js +551 -0
  283. package/dist/providers/vercel/index.d.ts +9 -25
  284. package/dist/providers/vercel/index.js +65 -260
  285. package/dist/providers/vercel/lib/config.d.ts +2 -0
  286. package/dist/providers/vercel/lib/config.js +2 -0
  287. package/dist/providers/vercel/lib/index.js +117 -0
  288. package/dist/providers/vercel/lib/logs.js +100 -0
  289. package/dist/providers/vercel/lib/pin.js +270 -0
  290. package/dist/providers/vercel/openapi.generated.js +10 -5
  291. package/dist/providers/vercel/{value-safety.js → safety.js} +247 -38
  292. package/dist/providers/vercel/skill.generated.js +2 -7
  293. package/dist/providers/vercel/tools.js +642 -0
  294. package/dist/redaction-identity.js +47 -0
  295. package/dist/redaction-marker.js +125 -0
  296. package/dist/registry.d.ts +21 -15
  297. package/dist/registry.js +409 -376
  298. package/dist/routes/access-tokens.js +1 -1
  299. package/dist/routes/actor-labels.js +1 -1
  300. package/dist/routes/connect.js +1 -1
  301. package/dist/routes/dispatch.js +103 -0
  302. package/dist/routes/mcp.js +170 -79
  303. package/dist/routes/oauth.js +6 -1
  304. package/dist/routes/operator.js +2 -2
  305. package/dist/routes/shared.d.ts +5 -4
  306. package/dist/routes/shared.js +244 -177
  307. package/dist/routes/skills.js +10 -8
  308. package/dist/routes/ui-config.js +27 -3
  309. package/dist/routes/ui-data.js +21 -20
  310. package/dist/routes/ui.js +1 -1
  311. package/dist/runtime/call-admission.js +0 -26
  312. package/dist/runtime/call-entry.js +30 -0
  313. package/dist/runtime/call.js +552 -0
  314. package/dist/runtime/connector-scope.js +7 -0
  315. package/dist/runtime/credential-probe.js +34 -0
  316. package/dist/runtime/executor.js +40 -0
  317. package/dist/runtime/native-storage.js +63 -0
  318. package/dist/runtime/registry.js +27 -0
  319. package/dist/runtime/request-scope.js +72 -0
  320. package/dist/runtime/run.js +15 -7
  321. package/dist/runtime/shared-read.js +34 -5
  322. package/dist/runtime/storage.js +34 -21
  323. package/dist/sent-secrets.d.ts +194 -37
  324. package/dist/sent-secrets.js +1743 -340
  325. package/dist/server.js +5 -56
  326. package/dist/skills.js +322 -223
  327. package/dist/sqlite.js +15 -14
  328. package/dist/storage/d1-copy.js +255 -0
  329. package/dist/storage/d1-driver.js +15 -0
  330. package/dist/storage/keys.js +28 -0
  331. package/dist/storage/sql-driver.js +88 -0
  332. package/dist/storage/sql-native.js +544 -0
  333. package/dist/storage/sql-schema.d.ts +6 -0
  334. package/dist/storage/sql-schema.js +15 -0
  335. package/dist/storage/sql.d.ts +14 -20
  336. package/dist/storage/sql.js +29 -535
  337. package/dist/timeout.js +0 -26
  338. package/dist/tool-safety.js +20 -10
  339. package/dist/types.d.ts +9 -109
  340. package/dist/ui.d.ts +1 -1
  341. package/dist/ui.js +0 -1
  342. package/dist/upward.js +3 -0
  343. package/dist/usage-guide.js +3 -1
  344. package/dist/validate.d.ts +4 -2
  345. package/dist/validate.js +86 -9
  346. package/dist/version.d.ts +1 -1
  347. package/dist/version.js +1 -1
  348. package/dist/worker.js +312 -292
  349. package/dist/workspace-subject.js +5 -1
  350. package/dist/write-outcome.js +454 -34
  351. package/documentation/README.md +28 -7
  352. package/documentation/architecture.md +2409 -255
  353. package/documentation/auth.md +867 -114
  354. package/documentation/code-mode.md +49 -16
  355. package/documentation/deploying.md +164 -20
  356. package/documentation/hosted-mcp-migration.md +460 -0
  357. package/documentation/integrating.md +129 -144
  358. package/documentation/meta-tools.md +409 -32
  359. package/documentation/operating.md +27 -3
  360. package/documentation/operator-tests.md +3 -0
  361. package/documentation/operator-ui.md +84 -48
  362. package/documentation/provider-auth-migration.md +16 -63
  363. package/documentation/provider-migration-0.29.md +10 -5
  364. package/documentation/provider-migration-0.35.md +975 -0
  365. package/documentation/providers.md +1347 -0
  366. package/examples/worker/AGENTS.md +23 -9
  367. package/examples/worker/README.md +254 -135
  368. package/examples/worker/alchemy.run.ts +116 -0
  369. package/examples/worker/gitignore +10 -0
  370. package/examples/worker/src/connecta.config.ts +23 -21
  371. package/examples/worker/wrangler.jsonc +14 -5
  372. package/guides/connecting-agents.md +157 -0
  373. package/guides/how-it-works.md +156 -0
  374. package/guides/safety-and-trust.md +153 -0
  375. package/package.json +30 -50
  376. package/templates/node/.env.example +3 -0
  377. package/templates/node/README.md +22 -2
  378. package/templates/node/docker-compose.yml +1 -0
  379. package/templates/node/package.json +3 -2
  380. package/templates/node/src/connecta.config.ts +8 -0
  381. package/dist/catalog-drift.d.ts +0 -138
  382. package/dist/catalog-drift.js +0 -578
  383. package/dist/operator-ui/agents.d.ts +0 -74
  384. package/dist/operator-ui/agents.js +0 -104
  385. package/dist/operator-ui/config-summary.js +0 -565
  386. package/dist/operator-ui/connection-map.js +0 -376
  387. package/dist/operator-ui/endpoints.js +0 -221
  388. package/dist/operator-ui/fix-prompts.d.ts +0 -18
  389. package/dist/operator-ui/fix-prompts.js +0 -87
  390. package/dist/operator-ui/health.js +0 -52
  391. package/dist/operator-ui/member-page.js +0 -97
  392. package/dist/operator-ui/overview.js +0 -123
  393. package/dist/operator-ui/setup-commands.js +0 -51
  394. package/dist/operator-ui/view.d.ts +0 -401
  395. package/dist/operator-ui/view.js +0 -705
  396. package/dist/providers/_shared/request-token.js +0 -83
  397. package/dist/providers/_shared/rest/dispatch.js +0 -41
  398. package/dist/providers/_shared/rest/operation-index.d.ts +0 -133
  399. package/dist/providers/_shared/rest/tools.d.ts +0 -141
  400. package/dist/providers/_shared/rest/tools.js +0 -569
  401. package/dist/providers/_shared/rest/value-safety.d.ts +0 -201
  402. package/dist/providers/basecamp/index.d.ts +0 -45
  403. package/dist/providers/basecamp/index.js +0 -997
  404. package/dist/providers/basecamp/skill.generated.js +0 -9
  405. package/dist/providers/cloudflare/rest.d.ts +0 -37
  406. package/dist/providers/cloudflare/rest.js +0 -1097
  407. package/dist/providers/github/hosted.js +0 -218
  408. package/dist/providers/github/rest.js +0 -321
  409. package/dist/providers/infisical/index.d.ts +0 -7
  410. package/dist/providers/infisical/index.js +0 -713
  411. package/dist/providers/infisical/skill.generated.js +0 -8
  412. package/dist/providers/intercom/index.d.ts +0 -24
  413. package/dist/providers/intercom/index.js +0 -121
  414. package/dist/providers/intercom/skill.generated.js +0 -8
  415. package/dist/providers/linear/index.d.ts +0 -55
  416. package/dist/providers/linear/index.js +0 -537
  417. package/dist/providers/linear/skill.generated.js +0 -8
  418. package/dist/providers/mixpanel/index.d.ts +0 -59
  419. package/dist/providers/mixpanel/index.js +0 -472
  420. package/dist/providers/mixpanel/operations.js +0 -20
  421. package/dist/providers/mixpanel/rest.js +0 -603
  422. package/dist/providers/mixpanel/skill.generated.js +0 -10
  423. package/dist/providers/mixpanel/value-safety.js +0 -16
  424. package/dist/providers/notion/index.d.ts +0 -67
  425. package/dist/providers/notion/index.js +0 -368
  426. package/dist/providers/notion/openapi.generated.js +0 -75
  427. package/dist/providers/notion/rest.d.ts +0 -24
  428. package/dist/providers/notion/rest.js +0 -1226
  429. package/dist/providers/notion/skill.generated.js +0 -11
  430. package/dist/providers/notion/value-safety.js +0 -56
  431. package/dist/providers/revenuecat/index.d.ts +0 -51
  432. package/dist/providers/revenuecat/index.js +0 -697
  433. package/dist/providers/revenuecat/skill.generated.js +0 -11
  434. package/dist/providers/stripe/rest.d.ts +0 -14
  435. package/dist/providers/stripe/rest.js +0 -402
  436. package/dist/providers/vercel/rest.d.ts +0 -20
  437. package/dist/providers/vercel/rest.js +0 -1020
  438. package/dist/providers/wispr-flow/index.d.ts +0 -14
  439. package/dist/providers/wispr-flow/index.js +0 -117
  440. package/dist/providers/wispr-flow/skill.generated.js +0 -8
  441. /package/dist/providers/github/{key.js → lib/key.js} +0 -0
@@ -1,376 +0,0 @@
1
- import { endpointRows, hueOf, initialsOf } from "./endpoints.js";
2
- import { connectorVerdict } from "./view.js";
3
- /* Layout. One coordinate system, scaled by the SVG's viewBox. */
4
- const MAP_WIDTH = 1000;
5
- const COLUMN_X = [16, 280, 544];
6
- const COLUMN_WIDTH = [196, 196, 196];
7
- /** Each connector's read and write tools sit in a fourth column, joined by a straight link. */
8
- const TOOLS_X = 808;
9
- const TOOLS_WIDTH = 176;
10
- const NODE_HEIGHT = 54;
11
- const NODE_GAP = 12;
12
- const HEAD = 40;
13
- const FOOT = 12;
14
- /** Characters a node's name keeps before it is cut with an ellipsis. */
15
- const LABEL_LIMIT = [18, 17, 17];
16
- /** A read-only endpoint's name shares its row with the read-only chip. */
17
- const READ_ONLY_LABEL_LIMIT = 12;
18
- /** "a", "a and b", "a, b and c". */
19
- export function joinList(items) {
20
- if (items.length <= 1)
21
- return items[0] ?? "";
22
- return `${items.slice(0, -1).join(", ")} and ${items[items.length - 1]}`;
23
- }
24
- function plural(count, one, many = `${one}s`) {
25
- return `${count} ${count === 1 ? one : many}`;
26
- }
27
- /** Cut a name to `limit` characters, ending in an ellipsis when it was longer. */
28
- export function truncate(text, limit) {
29
- return text.length <= limit ? text : `${text.slice(0, limit - 1).trimEnd()}…`;
30
- }
31
- /** Where an endpoint's row opens on the Endpoints page. */
32
- export function endpointHref(path) {
33
- return `/endpoints#${path.replace(/^\//, "")}`;
34
- }
35
- /** The endpoint path an Endpoints page hash names, or null. */
36
- export function endpointFromHash(hash) {
37
- const value = hash.replace(/^#/, "");
38
- return value.startsWith("mcp") ? `/${value}` : null;
39
- }
40
- function connectorHref(id, healthy) {
41
- return `/connectors/${encodeURIComponent(id)}#${healthy ? "tools" : "connection"}`;
42
- }
43
- function tokenWorks(agent) {
44
- return agent?.token.state === "issued";
45
- }
46
- /**
47
- * People in the order the contract first lists them (plain /mcp's
48
- * maintainers, then each pool's members), then every declared agent, then any
49
- * agent a pool lists that is not declared. Plain /mcp admits no agents.
50
- */
51
- function callersOf(contract, rows) {
52
- const people = new Map();
53
- const agents = new Map();
54
- for (const agent of contract.agents) {
55
- agents.set(agent.name, { id: `agent:${agent.name}`, kind: "agent", name: agent.name, agent, endpoints: [] });
56
- }
57
- const memberLists = rows.map((row) => [
58
- row,
59
- row.pool === null
60
- ? (contract.root?.maintainers ?? [])
61
- : (contract.pools.find((pool) => pool.name === row.pool)?.members ?? []),
62
- ]);
63
- for (const [row, members] of memberLists) {
64
- for (const member of members) {
65
- if (member.kind === "agent") {
66
- if (row.pool === null)
67
- continue;
68
- let caller = agents.get(member.name);
69
- if (!caller) {
70
- caller = { id: `agent:${member.name}`, kind: "agent", name: member.name, agent: null, endpoints: [] };
71
- agents.set(member.name, caller);
72
- }
73
- if (!caller.endpoints.includes(row))
74
- caller.endpoints.push(row);
75
- continue;
76
- }
77
- const id = `person:${member.namespace}:${member.id}`;
78
- let caller = people.get(id);
79
- if (!caller) {
80
- caller = { id, kind: "person", name: member.label ?? member.id, agent: null, endpoints: [] };
81
- people.set(id, caller);
82
- }
83
- if (!caller.endpoints.includes(row))
84
- caller.endpoints.push(row);
85
- }
86
- }
87
- return [...people.values(), ...agents.values()];
88
- }
89
- /** Unique live tools a set of endpoints serves, by address. */
90
- function servedTools(rows) {
91
- const connectors = new Set();
92
- const tools = new Map();
93
- for (const row of rows) {
94
- for (const group of row.groups) {
95
- connectors.add(group.config.id);
96
- for (const tool of group.tools)
97
- tools.set(tool.address, tool.classification);
98
- }
99
- }
100
- const write = [...tools.values()].filter((value) => value === "write").length;
101
- return { connectors, tools: tools.size, write };
102
- }
103
- export function toolsPhrase(tools, write) {
104
- if (!tools)
105
- return "no tools";
106
- return write ? `${plural(tools, "tool")}, ${write} write` : `${plural(tools, "tool")}, all read`;
107
- }
108
- function callerSummary(caller) {
109
- const name = caller.name;
110
- if (!caller.endpoints.length) {
111
- return caller.kind === "agent" ? `${name} is in no endpoint, so it reaches nothing.` : `${name} reaches nothing.`;
112
- }
113
- const served = servedTools(caller.endpoints);
114
- // An agent connects only at a pool's agent URL, never the people's one.
115
- const through = joinList(caller.endpoints.map((row) => (caller.kind === "agent" ? (row.agentPath ?? row.path) : row.path)));
116
- const reach = served.connectors.size
117
- ? `${name} reaches ${plural(served.connectors.size, "connector")} through ${through}: ${toolsPhrase(served.tools, served.write)}.`
118
- : `${name} uses ${through}, which serves no connectors.`;
119
- if (caller.kind !== "agent" || tokenWorks(caller.agent))
120
- return reach;
121
- const state = caller.agent?.token.state;
122
- return `${reach} ${state === "revoked" ? "Its token is revoked" : "It has no token"}, so it can't connect.`;
123
- }
124
- function callerDetail(caller, maintainers) {
125
- if (caller.kind === "person")
126
- return maintainers.has(caller.id) ? "maintainer" : "member";
127
- const state = caller.agent?.token.state;
128
- return state === "issued"
129
- ? "agent · token issued"
130
- : state === "revoked"
131
- ? "agent · token revoked"
132
- : "agent · no token";
133
- }
134
- function endpointSummary(row, callers) {
135
- const listed = callers.filter((caller) => caller.endpoints.includes(row));
136
- const people = listed.filter((caller) => caller.kind === "person").length;
137
- const agents = listed.length - people;
138
- const who = row.pool === null ? plural(people, "maintainer") : plural(people, "person", "people");
139
- const users = agents ? `${who} and ${plural(agents, "agent")}` : who;
140
- const served = servedTools([row]);
141
- const mode = row.readOnly ? `${row.path} is read-only and serves ${users}` : `${row.path} serves ${users}`;
142
- if (!served.connectors.size)
143
- return `${mode}. It has no connectors.`;
144
- return `${mode} with ${plural(served.connectors.size, "connector")}: ${toolsPhrase(served.tools, served.write)}.`;
145
- }
146
- const STATUS_SENTENCE = {
147
- ok: "",
148
- neutral: "",
149
- warn: " It needs attention.",
150
- danger: " It is failing.",
151
- };
152
- function connectorSummary(title, id, health, rows, callers) {
153
- const on = rows.filter((row) => row.groups.some((group) => group.config.id === id));
154
- const status = STATUS_SENTENCE[health.tone];
155
- if (!on.length)
156
- return `No endpoint serves ${title}, so nobody reaches it.${status}`;
157
- const reaching = callers.filter((caller) => caller.endpoints.some((row) => on.includes(row)));
158
- const people = reaching.filter((caller) => caller.kind === "person").length;
159
- const agents = reaching.length - people;
160
- const who = agents
161
- ? `${plural(people, "person", "people")} and ${plural(agents, "agent")}`
162
- : plural(people, "person", "people");
163
- const verb = reaching.length === 1 ? "reaches" : "reach";
164
- return `${who} ${verb} ${title} through ${joinList(on.map((row) => row.path))}.${status}`;
165
- }
166
- function edgePath(from, to) {
167
- const x1 = from.x + from.width;
168
- const y1 = from.y + from.height / 2;
169
- const x2 = to.x;
170
- const y2 = to.y + to.height / 2;
171
- const dx = (x2 - x1) / 2;
172
- return `M${x1},${y1} C${x1 + dx},${y1} ${x2 - dx},${y2} ${x2},${y2}`;
173
- }
174
- /** Each column's nodes stacked from the top, the shorter columns centered on the tallest. */
175
- function place(nodes) {
176
- const columns = [0, 1, 2].map((column) => nodes.filter((node) => node.column === column));
177
- const tallest = Math.max(1, ...columns.map((column) => column.length));
178
- const body = tallest * (NODE_HEIGHT + NODE_GAP) - NODE_GAP;
179
- columns.forEach((column, index) => {
180
- const height = column.length * (NODE_HEIGHT + NODE_GAP) - NODE_GAP;
181
- const top = HEAD + Math.max(0, (body - height) / 2);
182
- column.forEach((node, position) => {
183
- node.x = COLUMN_X[index];
184
- node.width = COLUMN_WIDTH[index];
185
- node.height = NODE_HEIGHT;
186
- node.y = top + position * (NODE_HEIGHT + NODE_GAP);
187
- if (node.kind === "connector")
188
- node.toolsBox = { x: TOOLS_X, y: node.y, width: TOOLS_WIDTH, height: NODE_HEIGHT };
189
- });
190
- });
191
- return HEAD + body + FOOT;
192
- }
193
- function node(fields, limit) {
194
- return { hue: 0, ...fields, label: truncate(fields.name, limit), toolsBox: null, x: 0, y: 0, width: 0, height: 0 };
195
- }
196
- /** A connector's tile: two words' initials, a camel-case title's two capitals, or one letter. */
197
- export function monogram(title) {
198
- const words = title.split(/[\s._-]+/).filter(Boolean);
199
- if (words.length > 1)
200
- return (words[0][0] + words[1][0]).toUpperCase();
201
- const capitals = title.match(/[A-Z]/g) ?? [];
202
- if (capitals.length >= 2)
203
- return capitals[0] + capitals[1];
204
- return (words[0] ?? title).charAt(0).toUpperCase();
205
- }
206
- /** The whole map for a maintainer's contract; an empty map for anyone else. */
207
- export function connectionMap(contract, options = {}) {
208
- const rows = contract.role === "maintainer" ? endpointRows(contract) : [];
209
- const callers = callersOf(contract, rows);
210
- const maintainers = new Set((contract.root?.maintainers ?? []).flatMap((member) => member.kind === "human" ? [`person:${member.namespace}:${member.id}`] : []));
211
- const connectors = (contract.role === "maintainer" ? (contract.config?.connectors ?? []) : []).flatMap((config) => {
212
- const live = contract.live.connectors.find((c) => c.id === config.id);
213
- const signals = options.signals && Object.hasOwn(options.signals, config.id) ? options.signals[config.id] : undefined;
214
- return live ? [{ config, live, health: connectorVerdict(live, signals) }] : [];
215
- });
216
- const health = new Map(connectors.map(({ config, health }) => [config.id, health]));
217
- const nodes = [];
218
- for (const caller of callers) {
219
- const works = caller.kind === "person" || tokenWorks(caller.agent);
220
- nodes.push(node({
221
- id: caller.id,
222
- kind: caller.kind,
223
- column: 0,
224
- name: caller.name,
225
- detail: callerDetail(caller, maintainers),
226
- href: caller.kind === "agent"
227
- ? options.tokensPage
228
- ? "/tokens"
229
- : null
230
- : caller.endpoints[0]
231
- ? endpointHref(caller.endpoints[0].path)
232
- : null,
233
- tone: works ? "neutral" : "warn",
234
- readOnly: false,
235
- tools: null,
236
- initials: caller.kind === "person" ? initialsOf(caller.name) : "",
237
- hue: caller.kind === "person" ? hueOf(caller.id.slice("person:".length)) : 0,
238
- summary: callerSummary(caller),
239
- }, LABEL_LIMIT[0]));
240
- }
241
- for (const row of rows) {
242
- const listed = callers.filter((caller) => caller.endpoints.includes(row)).length;
243
- nodes.push(node({
244
- id: `endpoint:${row.path}`,
245
- kind: "endpoint",
246
- column: 1,
247
- name: row.path,
248
- detail: `${row.pool === null ? "maintainers" : plural(listed, "caller")} · ${plural(row.groups.length, "connector")}`,
249
- href: endpointHref(row.path),
250
- tone: "neutral",
251
- readOnly: row.readOnly,
252
- tools: null,
253
- initials: "",
254
- summary: endpointSummary(row, callers),
255
- }, row.readOnly ? READ_ONLY_LABEL_LIMIT : LABEL_LIMIT[1]));
256
- }
257
- for (const { config, live, health: verdict } of connectors) {
258
- const title = config.title ?? config.id;
259
- const read = live.tools.filter((tool) => tool.classification === "read").length;
260
- const scope = config.authScope === "personal" ? "personal" : "shared";
261
- // A failed or unobserved catalog has no tools to count, which is not zero tools.
262
- const known = live.tools.length > 0 || (live.status === "ok" && !live.problem);
263
- nodes.push(node({
264
- id: `connector:${config.id}`,
265
- kind: "connector",
266
- column: 2,
267
- name: title,
268
- detail: verdict.tone === "ok" ? `${scope} · ${plural(live.tools.length, "tool")}` : verdict.label,
269
- href: connectorHref(config.id, verdict.tone === "ok"),
270
- tone: verdict.tone,
271
- readOnly: false,
272
- tools: known ? { read, write: live.tools.length - read } : null,
273
- initials: monogram(title),
274
- summary: connectorSummary(title, config.id, verdict, rows, callers),
275
- }, LABEL_LIMIT[2]));
276
- }
277
- const height = place(nodes);
278
- const byId = new Map(nodes.map((n) => [n.id, n]));
279
- const edges = [];
280
- for (const caller of callers) {
281
- for (const row of caller.endpoints) {
282
- const from = byId.get(caller.id);
283
- const to = byId.get(`endpoint:${row.path}`);
284
- edges.push({
285
- id: `${from.id}>${to.id}`,
286
- from: from.id,
287
- to: to.id,
288
- kind: "access",
289
- tone: "neutral",
290
- readOnly: false,
291
- noToken: caller.kind === "agent" && !tokenWorks(caller.agent),
292
- served: null,
293
- path: edgePath(from, to),
294
- });
295
- }
296
- }
297
- for (const row of rows) {
298
- for (const group of row.groups) {
299
- const from = byId.get(`endpoint:${row.path}`);
300
- const to = byId.get(`connector:${group.config.id}`);
301
- if (!to)
302
- continue;
303
- edges.push({
304
- id: `${from.id}>${to.id}`,
305
- from: from.id,
306
- to: to.id,
307
- kind: "grant",
308
- tone: health.get(group.config.id)?.tone ?? "neutral",
309
- readOnly: row.readOnly,
310
- noToken: false,
311
- served: {
312
- tools: group.tools.length,
313
- write: group.tools.filter((tool) => tool.classification === "write").length,
314
- },
315
- path: edgePath(from, to),
316
- });
317
- }
318
- }
319
- return {
320
- nodes,
321
- edges,
322
- width: MAP_WIDTH,
323
- height,
324
- columns: [
325
- { label: "Callers", count: callers.length, x: COLUMN_X[0] },
326
- { label: "Endpoints", count: rows.length, x: COLUMN_X[1] },
327
- { label: "Connectors", count: connectors.length, x: COLUMN_X[2] },
328
- { label: "Tools", count: connectors.reduce((n, { live }) => n + live.tools.length, 0), x: TOOLS_X },
329
- ],
330
- };
331
- }
332
- /**
333
- * What hovering a node lights up: every node and link on a path through it.
334
- * Links are walked forward from the node and backward to it, never both ways
335
- * from a neighbor, so a caller lights only what it reaches and a connector
336
- * lights only who reaches it.
337
- */
338
- export function mapHighlight(map, id) {
339
- const nodes = new Set([id]);
340
- const edges = new Set();
341
- const walk = (forward) => {
342
- const queue = [id];
343
- const seen = new Set([id]);
344
- while (queue.length) {
345
- const current = queue.shift();
346
- for (const edge of map.edges) {
347
- if ((forward ? edge.from : edge.to) !== current)
348
- continue;
349
- const target = forward ? edge.to : edge.from;
350
- edges.add(edge.id);
351
- nodes.add(target);
352
- if (!seen.has(target)) {
353
- seen.add(target);
354
- queue.push(target);
355
- }
356
- }
357
- }
358
- };
359
- walk(true);
360
- walk(false);
361
- return { nodes, edges };
362
- }
363
- export function mapList(map) {
364
- const byId = new Map(map.nodes.map((n) => [n.id, n]));
365
- return map.nodes
366
- .filter((n) => n.kind === "endpoint")
367
- .map((endpoint) => ({
368
- endpoint,
369
- callers: map.edges
370
- .filter((edge) => edge.to === endpoint.id)
371
- .map((edge) => ({ node: byId.get(edge.from), noToken: edge.noToken })),
372
- connectors: map.edges
373
- .filter((edge) => edge.from === endpoint.id)
374
- .map((edge) => ({ node: byId.get(edge.to), served: edge.served ?? { tools: 0, write: 0 } })),
375
- }));
376
- }
@@ -1,221 +0,0 @@
1
- /** How many chips an endpoint row shows before "+N more". */
2
- const ACCESS_CHIP_LIMIT = 4;
3
- /** Up to two letters for a person's avatar, from their label or raw id. */
4
- export function initialsOf(text) {
5
- const words = text
6
- .replace(/^user_/, "")
7
- .split(/[\s._@-]+/)
8
- .filter(Boolean);
9
- const letters = words.length > 1 ? words[0][0] + words[1][0] : (words[0] ?? text).slice(0, 2);
10
- return letters.toUpperCase();
11
- }
12
- /** A stable tint bucket for a member key, shared by chips and the Overview map. */
13
- export function hueOf(key) {
14
- let hash = 0;
15
- for (const char of key)
16
- hash = (hash * 31 + char.charCodeAt(0)) >>> 0;
17
- return hash % 6;
18
- }
19
- /** A member as a chip. Labels are null on Access deployments, where the raw id shows instead. */
20
- function accessChip(member) {
21
- if (member.kind === "agent") {
22
- const key = `agent:${member.name}`;
23
- return { key, kind: "agent", text: member.name, initials: "", hue: hueOf(key) };
24
- }
25
- const key = `${member.namespace}:${member.id}`;
26
- const text = member.label ?? member.id;
27
- return { key, kind: "human", text, initials: initialsOf(text), hue: hueOf(key) };
28
- }
29
- /** Chips for one endpoint in contract order, people first, without repeats. */
30
- export function accessChips(members) {
31
- const unique = new Map();
32
- for (const chip of members.map(accessChip))
33
- if (!unique.has(chip.key))
34
- unique.set(chip.key, chip);
35
- const chips = [...unique.values()];
36
- return [...chips.filter((chip) => chip.kind === "human"), ...chips.filter((chip) => chip.kind === "agent")];
37
- }
38
- /** The chips a collapsed row shows, and how many the "+N more" button holds back. */
39
- export function visibleChips(chips, expanded) {
40
- if (expanded || chips.length <= ACCESS_CHIP_LIMIT)
41
- return { shown: chips, hidden: 0 };
42
- return { shown: chips.slice(0, ACCESS_CHIP_LIMIT), hidden: chips.length - ACCESS_CHIP_LIMIT };
43
- }
44
- /** Matrix cells for one endpoint, keyed by connector id. */
45
- function cellsFor(contract, pool) {
46
- return new Map(contract.matrix.filter((cell) => cell.pool === pool).map((cell) => [cell.connectorId, cell]));
47
- }
48
- /** Plain /mcp declares no tool list; its matrix cells are its grants. */
49
- function rootGrants(contract) {
50
- return contract.matrix
51
- .filter((cell) => cell.pool === null)
52
- .map((cell) => ({
53
- connectorId: cell.connectorId,
54
- tools: cell.tools === "all" ? "all" : cell.tools.map((name) => ({ name, requireReadOnly: false })),
55
- }));
56
- }
57
- /** Intersect declared grants with final live verdicts, in config order. */
58
- function endpointGroups(contract, grants, readOnly, pool) {
59
- const cells = cellsFor(contract, pool);
60
- return (contract.config?.connectors ?? []).flatMap((config) => {
61
- const live = contract.live.connectors.find((c) => c.id === config.id);
62
- const grant = grants.find((g) => g.connectorId === config.id);
63
- if (!live || !grant)
64
- return [];
65
- const tools = live.tools.filter((tool) => {
66
- if ((readOnly || config.readOnly) && tool.classification !== "read")
67
- return false;
68
- return (grant.tools === "all" ||
69
- grant.tools.some((g) => g.name === tool.name && (!g.requireReadOnly || tool.classification === "read")));
70
- });
71
- // A granted connector with no complete catalog still needs a visible fix.
72
- return [{ config, live, tools, runsAs: cells.get(config.id)?.runsAs ?? null }];
73
- });
74
- }
75
- const toolCount = (groups) => groups.reduce((n, group) => n + group.tools.length, 0);
76
- /** How many of these tools read and how many write; an unclassified tool counts as neither. */
77
- export function toolSplit(tools) {
78
- let read = 0;
79
- let write = 0;
80
- for (const tool of tools) {
81
- if (tool.classification === "read")
82
- read++;
83
- else if (tool.classification === "write")
84
- write++;
85
- }
86
- return { read, write };
87
- }
88
- /** One row for plain /mcp, then one per pool, in contract order. Maintainer view only. */
89
- export function endpointRows(contract) {
90
- if (contract.role !== "maintainer")
91
- return [];
92
- const rows = [];
93
- if (contract.root) {
94
- const groups = endpointGroups(contract, rootGrants(contract), contract.root.readOnly, null);
95
- rows.push({
96
- pool: null,
97
- label: "Default",
98
- path: contract.root.path,
99
- agentPath: null,
100
- readOnly: contract.root.readOnly,
101
- toolCount: toolCount(groups),
102
- groups,
103
- access: accessChips(contract.root.maintainers),
104
- });
105
- }
106
- for (const pool of contract.pools) {
107
- const groups = endpointGroups(contract, pool.tools, pool.readOnly, pool.name);
108
- rows.push({
109
- pool: pool.name,
110
- label: pool.name,
111
- path: pool.humanPath,
112
- agentPath: pool.members.some((member) => member.kind === "agent") ? pool.agentPath : null,
113
- readOnly: pool.readOnly,
114
- toolCount: toolCount(groups),
115
- groups,
116
- access: accessChips(pool.members),
117
- });
118
- }
119
- return rows;
120
- }
121
- /** A calendar day, without the time: when a shared credential was saved. */
122
- function formatDay(value) {
123
- const date = new Date(value);
124
- return Number.isNaN(date.valueOf()) ? "" : date.toLocaleDateString(undefined, { dateStyle: "medium" });
125
- }
126
- /** Where a shared credential lives; a vault or OAuth date when the contract has one. */
127
- function sharedSourceLabel(source, date) {
128
- switch (source) {
129
- case "vault":
130
- return date ? `saved ${date}` : "saved";
131
- case "oauth":
132
- return date ? `connected ${date}` : "connected";
133
- case "missing":
134
- return "not configured";
135
- case "config":
136
- return "set in deployment";
137
- case "unauthenticated":
138
- return "no credential needed";
139
- }
140
- }
141
- /** Whose account a connector acts with on one endpoint, in one line. */
142
- export function runsAsLabel(runsAs, day = formatDay) {
143
- switch (runsAs.kind) {
144
- case "shared":
145
- return `Shared · ${sharedSourceLabel(runsAs.source, runsAs.savedAt ? day(runsAs.savedAt) : "")}`;
146
- case "personal":
147
- return `Personal · ${runsAs.connectedMembers} of ${runsAs.members} connected`;
148
- case "workspace":
149
- return `Workspace · people: self · agents: ${runsAs.agents ?? "none"}`;
150
- case "workspaceFixed":
151
- return `Everyone acts as ${runsAs.subject}`;
152
- }
153
- }
154
- export function matrixColumns(contract) {
155
- if (contract.role !== "maintainer")
156
- return [];
157
- return [
158
- ...(contract.root ? [{ pool: null, path: contract.root.path, readOnly: contract.root.readOnly }] : []),
159
- ...contract.pools.map((pool) => ({ pool: pool.name, path: pool.humanPath, readOnly: pool.readOnly })),
160
- ];
161
- }
162
- /** What one connector × endpoint cell holds, straight from the contract's matrix. */
163
- export function matrixCell(contract, connectorId, column) {
164
- const cell = contract.matrix.find((c) => c.connectorId === connectorId && c.pool === column.pool);
165
- if (!cell)
166
- return { kind: "none" };
167
- const overlay = contract.live.connectors.find((c) => c.id === connectorId);
168
- const live = overlay?.tools ?? [];
169
- const tools = cell.tools === "all"
170
- ? live.map(({ name, classification }) => ({ name, classification }))
171
- : cell.tools.map((name) => ({ name, classification: live.find((t) => t.name === name)?.classification ?? null }));
172
- const known = overlay && (live.length > 0 || (overlay.status === "ok" && !overlay.problem));
173
- const granted = cell.tools === "all" ? live : live.filter((tool) => cell.tools.includes(tool.name));
174
- return {
175
- kind: cell.tools === "all" ? "all" : "some",
176
- tools,
177
- runsAs: cell.runsAs,
178
- coverage: known ? { granted: granted.length, total: live.length } : null,
179
- };
180
- }
181
- /** The live grant fraction, or null when no complete catalog is available. */
182
- export function matrixCellShare(cell) {
183
- if (cell.kind === "none")
184
- return 0;
185
- if (!cell.coverage)
186
- return null;
187
- return cell.coverage.total ? cell.coverage.granted / cell.coverage.total : 0;
188
- }
189
- /** The cell's visible text: "all", a count, or a dash. */
190
- export function matrixCellText(cell) {
191
- if (cell.kind === "none")
192
- return "—";
193
- if (!cell.coverage)
194
- return "?";
195
- return cell.kind === "all" ? "all" : String(cell.coverage.granted);
196
- }
197
- /** The cell's accessible name, e.g. "GitHub on /mcp/support: 1 of 2 live tools". */
198
- export function matrixCellLabel(connector, column, cell) {
199
- const where = `${connector} on ${column.path}`;
200
- if (cell.kind === "none")
201
- return `${where}: no tools`;
202
- const what = !cell.coverage
203
- ? "unknown live tool coverage"
204
- : cell.kind === "all"
205
- ? `all ${cell.coverage.total} tools`
206
- : `${cell.coverage.granted} of ${cell.coverage.total} live tools`;
207
- return `${where}: ${what}${column.readOnly ? ", read-only" : ""}`;
208
- }
209
- /** The connector's subject for the matrix's Runs as column: the /mcp cell, else its first pool's. */
210
- export function connectorRunsAs(contract, connectorId) {
211
- const cells = contract.matrix.filter((cell) => cell.connectorId === connectorId);
212
- const root = cells.find((cell) => cell.pool === null);
213
- if (root)
214
- return root.runsAs;
215
- for (const pool of contract.pools) {
216
- const cell = cells.find((c) => c.pool === pool.name);
217
- if (cell)
218
- return cell.runsAs;
219
- }
220
- return null;
221
- }
@@ -1,18 +0,0 @@
1
- import type { UiCredentialProblem, UiProblem } from "./model.js";
2
- /**
3
- * Every failure the Connections page can show, with the prompt its "Copy fix
4
- * prompt" button puts on the clipboard.
5
- *
6
- * The signature is the guarantee. A prompt is looked up by kind and may name
7
- * the connector's configured id; there is no argument an error message, a
8
- * downstream body, or a credential could travel through, so none can reach a
9
- * coding agent's context by way of this page. The notice beside it is fixed
10
- * copy too wherever a downstream could have written the failure (see
11
- * `refusedNotice` in view.ts); what remains are the page's own sentences and a
12
- * credential form's field checks.
13
- */
14
- export type FixPromptKind = UiProblem | UiCredentialProblem | "credential_test_failed" | "oauth_action_failed" | "catalog_drift";
15
- /** The clipboard text for one failure. Fixed by kind; see `CATALOGUE`. */
16
- export declare function fixPrompt(kind: FixPromptKind, connectorId?: string): string;
17
- /** Every kind, so a test can walk the whole catalogue. */
18
- export declare const FIX_PROMPT_KINDS: FixPromptKind[];