@zackbart/connecta 0.7.9 → 0.8.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 (180) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +67 -144
  3. package/dist/auth/bearer.d.ts +1 -1
  4. package/dist/auth/bearer.js +4 -4
  5. package/dist/auth/bearer.js.map +1 -1
  6. package/dist/auth/clerk.d.ts +1 -1
  7. package/dist/auth/clerk.js +1 -1
  8. package/dist/call-admission.d.ts.map +1 -1
  9. package/dist/call-admission.js +9 -3
  10. package/dist/call-admission.js.map +1 -1
  11. package/dist/catalog-fingerprint.d.ts +20 -0
  12. package/dist/catalog-fingerprint.d.ts.map +1 -0
  13. package/dist/catalog-fingerprint.js +34 -0
  14. package/dist/catalog-fingerprint.js.map +1 -0
  15. package/dist/catalog-limits.d.ts +10 -0
  16. package/dist/catalog-limits.d.ts.map +1 -0
  17. package/dist/catalog-limits.js +10 -0
  18. package/dist/catalog-limits.js.map +1 -0
  19. package/dist/catalog-service.d.ts +138 -0
  20. package/dist/catalog-service.d.ts.map +1 -0
  21. package/dist/catalog-service.js +407 -0
  22. package/dist/catalog-service.js.map +1 -0
  23. package/dist/catalog.js +2 -2
  24. package/dist/catalog.js.map +1 -1
  25. package/dist/concurrency.d.ts +4 -0
  26. package/dist/concurrency.d.ts.map +1 -0
  27. package/dist/concurrency.js +31 -0
  28. package/dist/concurrency.js.map +1 -0
  29. package/dist/connectors/api.d.ts.map +1 -1
  30. package/dist/connectors/api.js +22 -12
  31. package/dist/connectors/api.js.map +1 -1
  32. package/dist/connectors/remote-mcp.d.ts.map +1 -1
  33. package/dist/connectors/remote-mcp.js +44 -19
  34. package/dist/connectors/remote-mcp.js.map +1 -1
  35. package/dist/credential-health.d.ts +0 -22
  36. package/dist/credential-health.d.ts.map +1 -1
  37. package/dist/credential-health.js +14 -10
  38. package/dist/credential-health.js.map +1 -1
  39. package/dist/credentials.d.ts +3 -2
  40. package/dist/credentials.d.ts.map +1 -1
  41. package/dist/errors.d.ts +1 -1
  42. package/dist/errors.d.ts.map +1 -1
  43. package/dist/errors.js.map +1 -1
  44. package/dist/execute.d.ts +9 -8
  45. package/dist/execute.d.ts.map +1 -1
  46. package/dist/execute.js +144 -321
  47. package/dist/execute.js.map +1 -1
  48. package/dist/executor-result.d.ts +0 -3
  49. package/dist/executor-result.d.ts.map +1 -1
  50. package/dist/executor-result.js +2 -2
  51. package/dist/executor-result.js.map +1 -1
  52. package/dist/executors/quickjs-child.js +3 -3
  53. package/dist/executors/quickjs-child.js.map +1 -1
  54. package/dist/executors/quickjs-protocol.d.ts +4 -1
  55. package/dist/executors/quickjs-protocol.d.ts.map +1 -1
  56. package/dist/executors/quickjs-runtime.d.ts.map +1 -1
  57. package/dist/executors/quickjs-runtime.js +7 -2
  58. package/dist/executors/quickjs-runtime.js.map +1 -1
  59. package/dist/executors/quickjs.d.ts.map +1 -1
  60. package/dist/executors/quickjs.js +4 -1
  61. package/dist/executors/quickjs.js.map +1 -1
  62. package/dist/favicon.js +2 -2
  63. package/dist/favicon.js.map +1 -1
  64. package/dist/index.d.ts +5 -0
  65. package/dist/index.d.ts.map +1 -1
  66. package/dist/index.js +44 -17
  67. package/dist/index.js.map +1 -1
  68. package/dist/invocation.d.ts +96 -0
  69. package/dist/invocation.d.ts.map +1 -0
  70. package/dist/invocation.js +369 -0
  71. package/dist/invocation.js.map +1 -0
  72. package/dist/meta-tools.d.ts +8 -86
  73. package/dist/meta-tools.d.ts.map +1 -1
  74. package/dist/meta-tools.js +145 -583
  75. package/dist/meta-tools.js.map +1 -1
  76. package/dist/operator-ui/generated.d.ts +3 -0
  77. package/dist/operator-ui/generated.d.ts.map +1 -0
  78. package/dist/operator-ui/generated.js +5 -0
  79. package/dist/operator-ui/generated.js.map +1 -0
  80. package/dist/operator-ui/model.d.ts +94 -0
  81. package/dist/operator-ui/model.d.ts.map +1 -0
  82. package/dist/operator-ui/model.js +28 -0
  83. package/dist/operator-ui/model.js.map +1 -0
  84. package/dist/registry.d.ts +22 -6
  85. package/dist/registry.d.ts.map +1 -1
  86. package/dist/registry.js +328 -35
  87. package/dist/registry.js.map +1 -1
  88. package/dist/routes/activity.d.ts +3 -0
  89. package/dist/routes/activity.d.ts.map +1 -0
  90. package/dist/routes/activity.js +173 -0
  91. package/dist/routes/activity.js.map +1 -0
  92. package/dist/routes/credentials.d.ts +3 -0
  93. package/dist/routes/credentials.d.ts.map +1 -0
  94. package/dist/routes/credentials.js +181 -0
  95. package/dist/routes/credentials.js.map +1 -0
  96. package/dist/routes/mcp.d.ts +8 -0
  97. package/dist/routes/mcp.d.ts.map +1 -0
  98. package/dist/routes/mcp.js +383 -0
  99. package/dist/routes/mcp.js.map +1 -0
  100. package/dist/routes/oauth.d.ts +4 -0
  101. package/dist/routes/oauth.d.ts.map +1 -0
  102. package/dist/routes/oauth.js +268 -0
  103. package/dist/routes/oauth.js.map +1 -0
  104. package/dist/routes/shared.d.ts +97 -0
  105. package/dist/routes/shared.d.ts.map +1 -0
  106. package/dist/routes/shared.js +199 -0
  107. package/dist/routes/shared.js.map +1 -0
  108. package/dist/routes/ui.d.ts +3 -0
  109. package/dist/routes/ui.d.ts.map +1 -0
  110. package/dist/routes/ui.js +122 -0
  111. package/dist/routes/ui.js.map +1 -0
  112. package/dist/server.d.ts +9 -40
  113. package/dist/server.d.ts.map +1 -1
  114. package/dist/server.js +63 -1293
  115. package/dist/server.js.map +1 -1
  116. package/dist/skills.d.ts +0 -15
  117. package/dist/skills.d.ts.map +1 -1
  118. package/dist/skills.js +6 -5
  119. package/dist/skills.js.map +1 -1
  120. package/dist/storage/file.d.ts.map +1 -1
  121. package/dist/storage/file.js +3 -1
  122. package/dist/storage/file.js.map +1 -1
  123. package/dist/storage/memory.d.ts.map +1 -1
  124. package/dist/storage/memory.js +3 -1
  125. package/dist/storage/memory.js.map +1 -1
  126. package/dist/toolkits.d.ts +0 -22
  127. package/dist/toolkits.d.ts.map +1 -1
  128. package/dist/toolkits.js +2 -2
  129. package/dist/toolkits.js.map +1 -1
  130. package/dist/types.d.ts +9 -2
  131. package/dist/types.d.ts.map +1 -1
  132. package/dist/ui.d.ts +3 -93
  133. package/dist/ui.d.ts.map +1 -1
  134. package/dist/ui.js +26 -1393
  135. package/dist/ui.js.map +1 -1
  136. package/dist/version.d.ts +1 -1
  137. package/dist/version.js +1 -1
  138. package/package.json +15 -8
  139. package/src/auth/bearer.ts +4 -4
  140. package/src/auth/clerk.ts +1 -1
  141. package/src/call-admission.ts +8 -5
  142. package/src/catalog-fingerprint.ts +52 -0
  143. package/src/catalog-limits.ts +11 -0
  144. package/src/catalog-service.ts +601 -0
  145. package/src/catalog.ts +2 -2
  146. package/src/concurrency.ts +39 -0
  147. package/src/connectors/api.ts +22 -12
  148. package/src/connectors/remote-mcp.ts +52 -22
  149. package/src/credential-health.ts +13 -10
  150. package/src/credentials.ts +2 -2
  151. package/src/errors.ts +1 -1
  152. package/src/execute.ts +194 -409
  153. package/src/executor-result.ts +2 -2
  154. package/src/executors/quickjs-child.ts +8 -4
  155. package/src/executors/quickjs-protocol.ts +1 -1
  156. package/src/executors/quickjs-runtime.ts +5 -1
  157. package/src/executors/quickjs.ts +11 -8
  158. package/src/favicon.ts +2 -2
  159. package/src/index.ts +49 -17
  160. package/src/invocation.ts +527 -0
  161. package/src/meta-tools.ts +366 -906
  162. package/src/operator-ui/browser.css +413 -0
  163. package/src/operator-ui/browser.ts +1121 -0
  164. package/src/operator-ui/generated.ts +4 -0
  165. package/src/operator-ui/model.ts +127 -0
  166. package/src/registry.ts +434 -44
  167. package/src/routes/activity.ts +220 -0
  168. package/src/routes/credentials.ts +266 -0
  169. package/src/routes/mcp.ts +485 -0
  170. package/src/routes/oauth.ts +328 -0
  171. package/src/routes/shared.ts +330 -0
  172. package/src/routes/ui.ts +153 -0
  173. package/src/server.ts +66 -1703
  174. package/src/skills.ts +6 -5
  175. package/src/storage/file.ts +3 -1
  176. package/src/storage/memory.ts +3 -1
  177. package/src/toolkits.ts +2 -2
  178. package/src/types.ts +9 -2
  179. package/src/ui.ts +52 -1493
  180. package/src/version.ts +1 -1
@@ -0,0 +1,122 @@
1
+ import { CONNECTA_FAVICON_ICO } from "../favicon.js";
2
+ import { buildUiData, CONNECTA_FAVICON_SVG, credentialManagementCapability, operatorPageForPath, renderUiHtml, } from "../ui.js";
3
+ import { authorize, isToolkitRestricted, privateJson, restrictedOperatorSurface, } from "./shared.js";
4
+ /**
5
+ * Headers that make an operator-supplied favicon body inert on this origin.
6
+ * The SVG route is the sharp one: `image/svg+xml` is an *active* content type,
7
+ * so a `<script>` inside a branding SVG would run on the deployment origin the
8
+ * moment anyone navigated straight to `/favicon.svg` — strictly more powerful
9
+ * than the `favicon.href` vector the branding gates close, because the payload
10
+ * is same-origin. Neutralizing the response rather than inspecting the body
11
+ * keeps every valid static SVG (the built-in mark included) byte-identical:
12
+ *
13
+ * - `sandbox` (no tokens ⇒ every restriction) drops the document into an opaque
14
+ * origin with scripting off, so even a script that ran would have nothing to
15
+ * reach.
16
+ * - `default-src 'none'` denies script, network, and framing outright.
17
+ * - `style-src 'unsafe-inline'` is the single allowance: the default mark styles
18
+ * itself inline to follow the OS colour scheme, and CSS cannot script.
19
+ * - `nosniff` keeps the declared type authoritative in both directions — an SVG
20
+ * can never be re-read as HTML, and `.ico` bytes can never be re-read as SVG.
21
+ *
22
+ * `.ico` bodies are deliberately in scope: they are inert bytes rather than
23
+ * active content, so they are still served verbatim, but they carry the same
24
+ * headers so the invariant is "every favicon route is neutralized" rather than
25
+ * "whichever route got attention".
26
+ */
27
+ const INERT_ICON_HEADERS = {
28
+ "Content-Security-Policy": "default-src 'none'; style-src 'unsafe-inline'; sandbox",
29
+ "X-Content-Type-Options": "nosniff",
30
+ };
31
+ /** Per-request base64 nonce for an operator shell's scripts (Node 20+ and Workers). */
32
+ function uiScriptNonce() {
33
+ const bytes = crypto.getRandomValues(new Uint8Array(16));
34
+ let binary = "";
35
+ for (const byte of bytes)
36
+ binary += String.fromCharCode(byte);
37
+ return btoa(binary);
38
+ }
39
+ export async function routeUi(context) {
40
+ const { request, url, path, baseUrl, opts, defer, sweepCredentials } = context;
41
+ if (request.method === "GET" && path === "/favicon.svg") {
42
+ return new Response(opts.branding?.favicon?.svg ?? CONNECTA_FAVICON_SVG, {
43
+ headers: {
44
+ "Content-Type": "image/svg+xml",
45
+ "Cache-Control": "public, max-age=86400",
46
+ ...INERT_ICON_HEADERS,
47
+ },
48
+ });
49
+ }
50
+ if (request.method === "GET" && path === "/favicon.ico") {
51
+ return new Response(opts.branding?.favicon?.ico ?? CONNECTA_FAVICON_ICO, {
52
+ headers: {
53
+ "Content-Type": "image/x-icon",
54
+ "Cache-Control": "public, max-age=86400",
55
+ ...INERT_ICON_HEADERS,
56
+ },
57
+ });
58
+ }
59
+ if (path === "/ui") {
60
+ if (request.method !== "GET") {
61
+ return privateJson({ error: "method not allowed" }, { status: 405 });
62
+ }
63
+ const target = new URL(`/${url.search}`, baseUrl);
64
+ return new Response(null, {
65
+ status: 308,
66
+ headers: { Location: target.toString() },
67
+ });
68
+ }
69
+ const operatorPage = operatorPageForPath(path);
70
+ if (operatorPage) {
71
+ if (request.method !== "GET" && request.method !== "HEAD") {
72
+ return privateJson({ error: "method not allowed" }, { status: 405 });
73
+ }
74
+ // Open shell — carries no operator data; everything comes from the
75
+ // authenticated /ui/* APIs after the browser establishes a session.
76
+ const uiAuth = opts.auth.find((provider) => provider.uiAuth)?.uiAuth;
77
+ const mcpUrl = new URL("/mcp", baseUrl).toString();
78
+ // Nonce the page's inline script (and the Clerk loader). 'strict-dynamic'
79
+ // lets scripts the nonced Clerk loader injects at runtime execute; the
80
+ // https:/'unsafe-inline' fallbacks are ignored by CSP3 browsers that
81
+ // honour the nonce and only cover legacy ones. No default-src, so Clerk's
82
+ // style/font/network needs and the page's inline <style> stay unrestricted
83
+ // — only script execution, the XSS sink, is gated.
84
+ const nonce = uiScriptNonce();
85
+ return new Response(request.method === "HEAD"
86
+ ? null
87
+ : renderUiHtml(uiAuth, mcpUrl, opts.branding, nonce, operatorPage), {
88
+ status: 200,
89
+ headers: {
90
+ "Content-Type": "text/html; charset=utf-8",
91
+ "Content-Security-Policy": `script-src 'nonce-${nonce}' 'strict-dynamic' https: 'unsafe-inline'; ` +
92
+ "object-src 'none'; base-uri 'none'; frame-ancestors 'none'",
93
+ "X-Content-Type-Options": "nosniff",
94
+ },
95
+ });
96
+ }
97
+ if (path !== "/ui/data")
98
+ return null;
99
+ const authz = await authorize(request, baseUrl, opts.auth, opts.logger);
100
+ if (!authz.ok)
101
+ return authz.response;
102
+ if (isToolkitRestricted(authz.toolkitBinding)) {
103
+ return restrictedOperatorSurface();
104
+ }
105
+ // After the restriction check, not before: an identity that may not
106
+ // read this surface should not get to trigger background work from it.
107
+ sweepCredentials();
108
+ const eligibleClerkOperator = authz.uiAdminEligible === true;
109
+ const credentialManagement = credentialManagementCapability({
110
+ eligibleClerkOperator,
111
+ hasCredentialSlots: opts.registry
112
+ .listConnectors()
113
+ .some((connector) => Boolean(connector.credential)),
114
+ hasCredentialVault: Boolean(opts.credentialVault),
115
+ });
116
+ const data = await buildUiData(opts.registry, baseUrl, opts.serverInfo,
117
+ // The static headless bearer may read connector health, but only a
118
+ // Clerk-authenticated operator receives credential metadata.
119
+ eligibleClerkOperator ? opts.credentialVault : undefined, Boolean(opts.activity?.list), credentialManagement, opts.toolkits, defer, eligibleClerkOperator, opts.discoveryConcurrency);
120
+ return privateJson(data);
121
+ }
122
+ //# sourceMappingURL=ui.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui.js","sourceRoot":"","sources":["../../src/routes/ui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EACL,WAAW,EACX,oBAAoB,EACpB,8BAA8B,EAC9B,mBAAmB,EACnB,YAAY,GACb,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,SAAS,EACT,mBAAmB,EACn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AC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS,EACxD,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,EAC5B,oBAAoB,EACpB,IAAI,CAAC,QAAQ,EACb,KAAK,EACL,qBAAqB,EACrB,IAAI,CAAC,oBAAoB,CAC1B,CAAC;IACF,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC"}
package/dist/server.d.ts CHANGED
@@ -1,42 +1,11 @@
1
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- import type { ActivityReadGate, ActivityStore } from "./activity.js";
3
- import type { CredentialVault } from "./credentials.js";
4
- import { type Registry } from "./registry.js";
5
- import { type Toolkit } from "./toolkits.js";
6
- import type { ConnectaBranding, Executor, InboundAuth, Logger } from "./types.js";
7
- import { type AdmissionController } from "./executor-admission.js";
8
- export interface ServerOptions {
9
- registry: Registry;
10
- auth: InboundAuth[];
11
- publicUrl?: string;
12
- serverInfo: ConstructorParameters<typeof McpServer>[0];
13
- logger: Logger;
14
- activity?: ActivityStore;
15
- activityReadGate?: ActivityReadGate;
16
- activityDeploymentId?: string;
17
- deploymentInfo?: Record<string, unknown>;
18
- /** Deadline for call_tool/batch_call calls that pass no timeoutMs. Off when unset. */
19
- defaultToolTimeoutMs?: number;
20
- /** Per-connector deadline for the list/search/describe probe fan-out. Default 30_000. */
21
- probeTimeoutMs?: number;
22
- /** When set, the execute_code meta-tool is registered on top of the nine. */
23
- executor?: Executor;
24
- /** Global FIFO boundary for all non-preflight `/mcp` requests. */
25
- requestAdmission: AdmissionController;
26
- /** Encrypted connector-credential storage backing the Credentials page. */
27
- credentialVault?: CredentialVault;
28
- /** Optional browser UI and OAuth result-page labels. */
29
- branding?: ConnectaBranding;
30
- /**
31
- * Validated named scopes, selected per connection with `?toolkit=<name>` on
32
- * `/mcp`. Omit (or leave empty) and every connection sees the full registry.
33
- */
34
- toolkits?: ReadonlyMap<string, Toolkit>;
35
- }
36
- /** Build the Web-standard fetch handler that serves connecta. */
1
+ import { type RuntimeExecutionContext, type ServerOptions } from "./routes/shared.js";
2
+ export type { ServerOptions } from "./routes/shared.js";
3
+ /**
4
+ * Build the Web-standard fetch handler.
5
+ *
6
+ * Route ordering is the contract: private mutation routes precede wildcard
7
+ * OPTIONS, every built-in precedes connector-owned routes, and the security
8
+ * wrapper is applied to every response.
9
+ */
37
10
  export declare function createFetchHandler(opts: ServerOptions): (request: Request, runtimeContext?: RuntimeExecutionContext) => Promise<Response>;
38
- interface RuntimeExecutionContext {
39
- waitUntil(promise: Promise<unknown>): void;
40
- }
41
- export {};
42
11
  //# sourceMappingURL=server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAKpE,OAAO,KAAK,EAGV,gBAAgB,EAGhB,aAAa,EACd,MAAM,eAAe,CAAC;AAOvB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAkB,KAAK,QAAQ,EAAqB,MAAM,eAAe,CAAC;AACjF,OAAO,EAGL,KAAK,OAAO,EACb,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAKV,gBAAgB,EAChB,QAAQ,EACR,WAAW,EACX,MAAM,EAEP,MAAM,YAAY,CAAC;AAEpB,OAAO,EAGL,KAAK,mBAAmB,EAEzB,MAAM,yBAAyB,CAAC;AAoDjC,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,WAAW,EAAE,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IAGnB,UAAU,EAAE,qBAAqB,CAAC,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IACvD,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,gBAAgB,CAAC,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