@zackbart/connecta 0.28.0 → 0.29.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 (320) hide show
  1. package/CHANGELOG.md +961 -5
  2. package/README.md +62 -39
  3. package/bin/connecta.mjs +110 -139
  4. package/bin/meta-tool-names.d.mts +2 -0
  5. package/bin/meta-tool-names.mjs +9 -0
  6. package/bin/version.mjs +3 -0
  7. package/dist/access-tokens.js +53 -63
  8. package/dist/activity-request.js +8 -0
  9. package/dist/activity.d.ts +76 -42
  10. package/dist/activity.js +110 -42
  11. package/dist/auth/clerk-sdk/client.d.ts +65 -0
  12. package/dist/auth/clerk-sdk/client.js +5 -0
  13. package/dist/auth/clerk-sdk/generated.js +1845 -0
  14. package/dist/auth/clerk-transport.js +19 -0
  15. package/dist/auth/clerk.d.ts +17 -7
  16. package/dist/auth/clerk.js +189 -107
  17. package/dist/auth/cloudflare-access.js +25 -26
  18. package/dist/auth/downstream-client-metadata.d.ts +29 -0
  19. package/dist/auth/downstream-client-metadata.js +133 -0
  20. package/dist/auth/downstream-oauth.js +1632 -1509
  21. package/dist/auth/downstream-revocation.js +106 -0
  22. package/dist/auth/oauth-token-response.js +231 -0
  23. package/dist/auth/oauth-v2-migration.js +116 -0
  24. package/dist/auth/static-oauth.js +526 -0
  25. package/dist/auth-elicitation.js +283 -0
  26. package/dist/branding.d.ts +8 -16
  27. package/dist/branding.js +26 -59
  28. package/dist/byte-read-response.js +39 -0
  29. package/dist/call-admission.js +12 -16
  30. package/dist/catalog-cache.js +739 -0
  31. package/dist/catalog-drift.d.ts +50 -15
  32. package/dist/catalog-drift.js +365 -128
  33. package/dist/catalog-fingerprint.js +2 -4
  34. package/dist/catalog-freshness.js +13 -0
  35. package/dist/catalog-limits.js +2 -2
  36. package/dist/catalog-service.js +368 -224
  37. package/dist/catalog.js +43 -84
  38. package/dist/concurrency.js +3 -4
  39. package/dist/config-defaults.d.ts +39 -0
  40. package/dist/config-defaults.js +46 -0
  41. package/dist/config-schema.d.ts +181 -0
  42. package/dist/config-schema.js +435 -0
  43. package/dist/config-value-sources.js +102 -0
  44. package/dist/config.d.ts +631 -0
  45. package/dist/config.js +503 -0
  46. package/dist/connector-access.d.ts +1 -0
  47. package/dist/connector-access.js +13 -15
  48. package/dist/connector-caller.d.ts +8 -0
  49. package/dist/connector-caller.js +15 -6
  50. package/dist/connector-scope.js +1 -1
  51. package/dist/connectors/api-connector.d.ts +220 -0
  52. package/dist/connectors/api-connector.js +214 -0
  53. package/dist/connectors/api.d.ts +8 -71
  54. package/dist/connectors/api.js +13 -99
  55. package/dist/connectors/guarded-fetch.d.ts +144 -0
  56. package/dist/connectors/guarded-fetch.js +108 -25
  57. package/dist/connectors/negotiation-cache.js +46 -0
  58. package/dist/connectors/option-shapes.js +27 -0
  59. package/dist/connectors/remote-mcp.d.ts +30 -4
  60. package/dist/connectors/remote-mcp.js +1780 -351
  61. package/dist/connectors/resource-uri.js +335 -0
  62. package/dist/credential-contract.d.ts +10 -0
  63. package/dist/credential-rules.js +1 -3
  64. package/dist/credential-url.js +108 -0
  65. package/dist/credentials.d.ts +6 -1
  66. package/dist/credentials.js +27 -18
  67. package/dist/d1.d.ts +130 -0
  68. package/dist/d1.js +290 -0
  69. package/dist/describe-config.d.ts +165 -0
  70. package/dist/describe-config.js +315 -0
  71. package/dist/described.js +106 -0
  72. package/dist/downstream-input-context.js +119 -0
  73. package/dist/downstream-input.js +323 -0
  74. package/dist/errors.d.ts +97 -20
  75. package/dist/errors.js +158 -80
  76. package/dist/execute.js +453 -305
  77. package/dist/executor-admission.d.ts +1 -0
  78. package/dist/executor-admission.js +11 -15
  79. package/dist/executor-contract.d.ts +20 -0
  80. package/dist/executor-contract.js +48 -0
  81. package/dist/executor-result.js +24 -9
  82. package/dist/executors/quickjs-child.js +3 -4
  83. package/dist/executors/quickjs-runtime.js +147 -59
  84. package/dist/executors/quickjs.js +29 -35
  85. package/dist/favicon.js +1 -2
  86. package/dist/fix-prompt.js +1 -3
  87. package/dist/guest-runtime.js +188 -0
  88. package/dist/guest-types.d.ts +176 -0
  89. package/dist/guest-types.js +1 -0
  90. package/dist/html-security.js +24 -0
  91. package/dist/identity.js +1 -3
  92. package/dist/inbound-credential.js +52 -0
  93. package/dist/index.d.ts +25 -257
  94. package/dist/index.js +65 -478
  95. package/dist/invocation-auth.js +69 -0
  96. package/dist/invocation.js +230 -73
  97. package/dist/json-schema.d.ts +1 -1
  98. package/dist/mcp-client-context.js +35 -0
  99. package/dist/mcp-result.js +11 -7
  100. package/dist/meta-output.js +76 -0
  101. package/dist/meta-tool-names.d.ts +2 -0
  102. package/dist/meta-tool-names.js +3 -0
  103. package/dist/meta-tools.js +285 -209
  104. package/dist/module-contracts.d.ts +8 -23
  105. package/dist/node.d.ts +0 -2
  106. package/dist/node.js +2 -2
  107. package/dist/oauth-callback-outcome.js +1 -3
  108. package/dist/oauth-handoff.js +117 -0
  109. package/dist/oauth-partition.js +17 -0
  110. package/dist/oauth-sealing.js +20 -0
  111. package/dist/operator-record.d.ts +137 -0
  112. package/dist/operator-record.js +420 -0
  113. package/dist/operator-ui/assets.js +31 -0
  114. package/dist/operator-ui/contract.d.ts +72 -0
  115. package/dist/operator-ui/contract.js +1 -0
  116. package/dist/operator-ui/fix-prompts.d.ts +18 -0
  117. package/dist/operator-ui/generated.js +5 -4
  118. package/dist/operator-ui/model.d.ts +12 -87
  119. package/dist/operator-ui/model.js +2 -9
  120. package/dist/operator-ui/setup-commands.js +1 -3
  121. package/dist/operator-ui/view.d.ts +323 -0
  122. package/dist/operator-ui/view.js +62 -189
  123. package/dist/page-styles.js +2 -3
  124. package/dist/program-source.js +14 -2
  125. package/dist/{exempt-writes.js → program-writes.js} +55 -18
  126. package/dist/provider.d.ts +142 -0
  127. package/dist/provider.js +187 -0
  128. package/dist/providers/_shared/google/result-size.js +57 -0
  129. package/dist/providers/_shared/google/service-account.d.ts +58 -0
  130. package/dist/providers/_shared/google/service-account.js +500 -0
  131. package/dist/providers/_shared/google/workspace.d.ts +276 -0
  132. package/dist/providers/_shared/google/workspace.js +518 -0
  133. package/dist/providers/basecamp/index.d.ts +43 -0
  134. package/dist/providers/basecamp/index.js +997 -0
  135. package/dist/providers/basecamp/skill.generated.js +9 -0
  136. package/dist/providers/breeze/index.d.ts +34 -0
  137. package/dist/providers/breeze/index.js +1446 -0
  138. package/dist/providers/breeze/skill.generated.js +9 -0
  139. package/dist/providers/ccb/index.d.ts +103 -0
  140. package/dist/providers/ccb/index.js +1725 -0
  141. package/dist/providers/ccb/skill.generated.js +9 -0
  142. package/dist/providers/{cloudflare.d.ts → cloudflare/index.d.ts} +8 -7
  143. package/dist/providers/{cloudflare.js → cloudflare/index.js} +171 -738
  144. package/dist/providers/cloudflare/skill.generated.js +10 -0
  145. package/dist/providers/docs/index.d.ts +54 -0
  146. package/dist/providers/docs/index.js +1237 -0
  147. package/dist/providers/docs/skill.generated.js +9 -0
  148. package/dist/providers/drive/index.d.ts +53 -0
  149. package/dist/providers/drive/index.js +1523 -0
  150. package/dist/providers/drive/skill.generated.js +9 -0
  151. package/dist/providers/forms/index.d.ts +54 -0
  152. package/dist/providers/forms/index.js +1217 -0
  153. package/dist/providers/forms/skill.generated.js +11 -0
  154. package/dist/providers/github/auth.d.ts +32 -0
  155. package/dist/providers/github/auth.js +361 -0
  156. package/dist/providers/github/hosted.js +218 -0
  157. package/dist/providers/github/index.d.ts +13 -0
  158. package/dist/providers/github/index.js +140 -0
  159. package/dist/providers/github/key.js +100 -0
  160. package/dist/providers/github/rest.js +321 -0
  161. package/dist/providers/github/scope.d.ts +29 -0
  162. package/dist/providers/github/scope.js +124 -0
  163. package/dist/providers/github/skill.generated.js +8 -0
  164. package/dist/providers/gmail/index.d.ts +51 -0
  165. package/dist/providers/gmail/index.js +1436 -0
  166. package/dist/providers/gmail/skill.generated.js +9 -0
  167. package/dist/providers/{linear.d.ts → linear/index.d.ts} +11 -14
  168. package/dist/providers/linear/index.js +352 -0
  169. package/dist/providers/linear/skill.generated.js +8 -0
  170. package/dist/providers/{mixpanel.d.ts → mixpanel/index.d.ts} +5 -10
  171. package/dist/providers/mixpanel/index.js +416 -0
  172. package/dist/providers/mixpanel/skill.generated.js +9 -0
  173. package/dist/providers/{notion.d.ts → notion/index.d.ts} +8 -8
  174. package/dist/providers/{notion.js → notion/index.js} +226 -239
  175. package/dist/providers/notion/skill.generated.js +10 -0
  176. package/dist/providers/overflow/index.d.ts +60 -0
  177. package/dist/providers/overflow/index.js +1535 -0
  178. package/dist/providers/overflow/skill.generated.js +8 -0
  179. package/dist/providers/planning-center/index.d.ts +59 -0
  180. package/dist/providers/planning-center/index.js +2199 -0
  181. package/dist/providers/planning-center/skill.generated.js +10 -0
  182. package/dist/providers/{revenuecat.d.ts → revenuecat/index.d.ts} +5 -10
  183. package/dist/providers/revenuecat/index.js +557 -0
  184. package/dist/providers/revenuecat/skill.generated.js +11 -0
  185. package/dist/providers/sheets/index.d.ts +54 -0
  186. package/dist/providers/sheets/index.js +1237 -0
  187. package/dist/providers/sheets/skill.generated.js +10 -0
  188. package/dist/providers/slides/index.d.ts +53 -0
  189. package/dist/providers/slides/index.js +2645 -0
  190. package/dist/providers/slides/skill.generated.js +9 -0
  191. package/dist/providers/{stripe.d.ts → stripe/index.d.ts} +5 -12
  192. package/dist/providers/stripe/index.js +266 -0
  193. package/dist/providers/stripe/skill.generated.js +11 -0
  194. package/dist/providers/tithely/index.d.ts +49 -0
  195. package/dist/providers/tithely/index.js +1003 -0
  196. package/dist/providers/tithely/skill.generated.js +8 -0
  197. package/dist/providers/{vercel.d.ts → vercel/index.d.ts} +8 -8
  198. package/dist/providers/vercel/index.js +1038 -0
  199. package/dist/providers/vercel/mcp-ownership.js +212 -0
  200. package/dist/providers/vercel/skill.generated.js +11 -0
  201. package/dist/registry.d.ts +108 -171
  202. package/dist/registry.js +513 -925
  203. package/dist/request-state.js +21 -0
  204. package/dist/resource-read.js +100 -0
  205. package/dist/result-shapes.js +17 -49
  206. package/dist/retired-toolkits.js +1 -1
  207. package/dist/routes/access-tokens.js +3 -6
  208. package/dist/routes/activity-context.js +21 -0
  209. package/dist/routes/activity-disclosure.js +40 -0
  210. package/dist/routes/activity.js +59 -21
  211. package/dist/routes/actor-labels.js +3 -50
  212. package/dist/routes/connect.js +221 -0
  213. package/dist/routes/credentials.js +15 -27
  214. package/dist/routes/mcp.js +356 -130
  215. package/dist/routes/oauth-client-metadata.js +15 -0
  216. package/dist/routes/oauth-management.js +45 -107
  217. package/dist/routes/oauth.js +136 -57
  218. package/dist/routes/operator.js +3 -3
  219. package/dist/routes/shared.d.ts +25 -64
  220. package/dist/routes/shared.js +160 -80
  221. package/dist/routes/skills.js +30 -0
  222. package/dist/routes/ui-config.js +225 -0
  223. package/dist/routes/ui-data.js +40 -35
  224. package/dist/routes/ui.js +66 -56
  225. package/dist/runtime/admission.js +4 -2
  226. package/dist/runtime/call-admission.js +3 -1
  227. package/dist/runtime/connector-scope.js +1 -4
  228. package/dist/runtime/run.js +10 -39
  229. package/dist/runtime/services.js +12 -117
  230. package/dist/runtime/shared-read.js +1 -3
  231. package/dist/runtime/storage.js +8 -1
  232. package/dist/sent-secrets.d.ts +52 -0
  233. package/dist/sent-secrets.js +474 -0
  234. package/dist/server.js +28 -71
  235. package/dist/skills.js +406 -174
  236. package/dist/sqlite.d.ts +48 -0
  237. package/dist/sqlite.js +166 -0
  238. package/dist/storage/keys.js +428 -0
  239. package/dist/storage/memory.js +7 -0
  240. package/dist/storage/sql.d.ts +66 -0
  241. package/dist/storage/sql.js +534 -0
  242. package/dist/timeout.js +4 -2
  243. package/dist/tool-name.js +17 -0
  244. package/dist/tool-safety.d.ts +9 -35
  245. package/dist/tool-safety.js +20 -40
  246. package/dist/types.d.ts +320 -54
  247. package/dist/types.js +0 -1
  248. package/dist/ui.d.ts +7 -19
  249. package/dist/ui.js +76 -90
  250. package/dist/url-safety.js +3 -6
  251. package/dist/usage-guide.js +137 -0
  252. package/dist/validate.d.ts +7 -0
  253. package/dist/validate.js +309 -47
  254. package/dist/version.d.ts +1 -7
  255. package/dist/version.js +3 -7
  256. package/dist/worker.d.ts +11 -0
  257. package/dist/worker.js +434 -0
  258. package/documentation/architecture.md +665 -230
  259. package/documentation/auth.md +962 -458
  260. package/documentation/code-mode.md +501 -312
  261. package/documentation/meta-tools.md +449 -200
  262. package/documentation/operator-tests.md +93 -0
  263. package/documentation/provider-migration-0.29.md +60 -0
  264. package/examples/worker/AGENTS.md +34 -12
  265. package/examples/worker/README.md +286 -255
  266. package/examples/worker/kv-to-d1.wrangler.jsonc +26 -0
  267. package/examples/worker/scripts/copy-kv-to-d1.mjs +162 -0
  268. package/examples/worker/src/connecta.config.ts +151 -0
  269. package/examples/worker/src/index.ts +14 -197
  270. package/examples/worker/wrangler.jsonc +15 -35
  271. package/package.json +125 -35
  272. package/templates/node/.dockerignore +1 -2
  273. package/templates/node/.env.example +20 -21
  274. package/templates/node/AGENTS.md +21 -17
  275. package/templates/node/Dockerfile +3 -5
  276. package/templates/node/README.md +133 -58
  277. package/templates/node/docker-compose.yml +11 -12
  278. package/templates/node/package.json +4 -2
  279. package/templates/node/src/connecta.config.ts +119 -0
  280. package/templates/node/src/index.ts +9 -154
  281. package/templates/node/src/provision-token.ts +17 -0
  282. package/AGENTS.md +0 -170
  283. package/dist/artifacts/connector.d.ts +0 -58
  284. package/dist/artifacts/connector.js +0 -730
  285. package/dist/artifacts/document.js +0 -86
  286. package/dist/artifacts/guide.js +0 -140
  287. package/dist/artifacts/html-scan.js +0 -329
  288. package/dist/artifacts/json.js +0 -78
  289. package/dist/artifacts/kv-store.d.ts +0 -20
  290. package/dist/artifacts/kv-store.js +0 -140
  291. package/dist/artifacts/markdown.js +0 -478
  292. package/dist/artifacts/module.d.ts +0 -37
  293. package/dist/artifacts/module.js +0 -66
  294. package/dist/artifacts/operations.d.ts +0 -197
  295. package/dist/artifacts/operations.js +0 -1002
  296. package/dist/artifacts/refresh.d.ts +0 -55
  297. package/dist/artifacts/refresh.js +0 -236
  298. package/dist/artifacts/routes.js +0 -206
  299. package/dist/artifacts/types.d.ts +0 -214
  300. package/dist/artifacts/types.js +0 -22
  301. package/dist/artifacts/validate.d.ts +0 -62
  302. package/dist/artifacts/validate.js +0 -651
  303. package/dist/artifacts.d.ts +0 -6
  304. package/dist/artifacts.js +0 -9
  305. package/dist/auth/bearer.d.ts +0 -11
  306. package/dist/auth/bearer.js +0 -50
  307. package/dist/providers/linear.js +0 -217
  308. package/dist/providers/mixpanel.js +0 -247
  309. package/dist/providers/revenuecat.js +0 -317
  310. package/dist/providers/stripe.js +0 -253
  311. package/dist/providers/vercel.js +0 -1253
  312. package/dist/storage/file.d.ts +0 -15
  313. package/dist/storage/file.js +0 -455
  314. package/ethos.md +0 -93
  315. package/examples/worker/src/cloudflare-kv.ts +0 -43
  316. package/examples/worker/src/d1-activity-row.ts +0 -155
  317. package/examples/worker/src/d1-activity.ts +0 -147
  318. package/examples/worker/src/d1-storage.ts +0 -138
  319. package/examples/worker/src/r2-artifact-blobs.ts +0 -29
  320. package/templates/node/src/file-activity.ts +0 -182
package/dist/types.d.ts CHANGED
@@ -1,17 +1,25 @@
1
+ import type { CallErrorDetails } from "./errors.js";
1
2
  /** A JSON Schema object describing a tool's input. */
2
3
  export type JsonSchema = Record<string, unknown>;
3
- /** Minimal key/value store — the only state connecta needs. */
4
+ /**
5
+ * Minimal key/value store — the only state connecta needs. Keys and list
6
+ * prefixes must not contain U+0000 (NUL); adapters reject them with TypeError
7
+ * before accessing storage. SQL TEXT results truncate at NUL on Node 22.
8
+ */
4
9
  export interface KVStorage {
10
+ /** The live value at `key`; null when absent or expired. */
5
11
  get(key: string): Promise<string | null>;
12
+ /**
13
+ * Write `value`. With `opts.ttlSeconds` the entry reads as absent once that
14
+ * many seconds pass; omitted or zero means no expiry. Shared stores must
15
+ * create and check expiry with a storage-owned clock, not each caller's clock.
16
+ */
6
17
  set(key: string, value: string, opts?: {
7
18
  ttlSeconds?: number;
8
19
  }): Promise<void>;
9
20
  delete(key: string): Promise<void>;
10
- /**
11
- * Sorted keys beginning with `prefix`. Optional for existing adapters;
12
- * subsystems that need independent, enumerable records require it explicitly.
13
- */
14
- list?(prefix: string): Promise<string[]>;
21
+ /** Live keys beginning with `prefix`, sorted by UTF-16 code unit. */
22
+ list(prefix: string): Promise<string[]>;
15
23
  /**
16
24
  * Atomic compare-and-set: write `next` only if the key's current value is
17
25
  * exactly `expected`, and report whether the write happened. `expected:
@@ -24,14 +32,24 @@ export interface KVStorage {
24
32
  * store, `set` and `delete` included: of N concurrent `compareAndSet(key,
25
33
  * null, value)` claims on an absent key, exactly one returns true.
26
34
  *
27
- * Optional, because not every backend can promise it: an eventually
28
- * consistent store such as Cloudflare Workers KV must omit the method
29
- * rather than emulate it with a read followed by a write. Subsystems that
30
- * need an atomic claim require it explicitly.
31
- */
32
- compareAndSet?(key: string, expected: string | null, next: string | null, options?: {
35
+ * Required. Every subsystem that must claim a key exactly once relies on
36
+ * it, and none of them carries a read-then-write fallback. The shipped
37
+ * adapters are `memoryStorage()`, `d1Storage()` from
38
+ * `@zackbart/connecta/d1`, and `sqliteStorage()` from
39
+ * `@zackbart/connecta/sqlite`; an eventually consistent store such as
40
+ * Cloudflare Workers KV cannot implement it and is not supported.
41
+ */
42
+ compareAndSet(key: string, expected: string | null, next: string | null, options?: {
33
43
  ttlSeconds?: number;
34
44
  }): Promise<boolean>;
45
+ /**
46
+ * Which adapter this is, for `Connecta.describeConfig()`. The shipped
47
+ * adapters answer `"memory"`, `"d1"`, or `"sqlite"`; any other answer, or
48
+ * none, is described as `"custom"`. Never a path, binding, or value.
49
+ */
50
+ describe?(): {
51
+ kind: string;
52
+ };
35
53
  }
36
54
  export interface Logger {
37
55
  debug(...args: unknown[]): void;
@@ -40,16 +58,30 @@ export interface Logger {
40
58
  error(...args: unknown[]): void;
41
59
  }
42
60
  export interface ToolDef {
61
+ /** Final verdict on a request-scoped published catalog entry. Never persisted. */
62
+ classification?: "read" | "write";
43
63
  name: string;
44
64
  description?: string;
65
+ /** Downstream display metadata retained with the catalog. */
66
+ title?: string;
67
+ icons?: Array<{
68
+ src: string;
69
+ mimeType?: string;
70
+ sizes?: string[];
71
+ theme?: "light" | "dark";
72
+ }>;
73
+ /** Downstream execution requirements, enforced even on a cached catalog. */
74
+ execution?: {
75
+ taskSupport?: "required" | "optional" | "forbidden";
76
+ };
45
77
  inputSchema?: JsonSchema;
46
78
  /** Optional JSON Schema describing the tool's structured result. */
47
79
  outputSchema?: JsonSchema;
48
80
  /**
49
81
  * Standard MCP tool behavior hints plus provider-specific extensions.
50
- * Connecta fails closed: only readOnlyHint === true (without a contradictory
51
- * destructiveHint) may use call_tool or execute_code. Every other tool must
52
- * cross the call_destructive_tool approval boundary.
82
+ * The registry classifies these after deployment overrides and provider
83
+ * review. Only a stored read verdict may use call_tool; program writes
84
+ * require a trusted pool. Approval belongs to the host.
53
85
  */
54
86
  annotations?: ToolAnnotations;
55
87
  }
@@ -82,7 +114,7 @@ export interface ConnectorRollingWindowBudget {
82
114
  * pretending multi-rule admission is already atomic.
83
115
  */
84
116
  export interface ConnectorCallAdmissionRule {
85
- /** Maximum simultaneous Connector.callTool attempts in one partition. */
117
+ /** Maximum simultaneous tool calls and resource reads in one partition. */
86
118
  maxConcurrency?: number;
87
119
  /** Callers allowed to wait behind the concurrency bound. Default 32. */
88
120
  maxQueueSize?: number;
@@ -150,9 +182,9 @@ export interface ConnectorCredentialConfig {
150
182
  export interface CredentialTestResult {
151
183
  ok: boolean;
152
184
  /**
153
- * Detail for the deployment's log. The operator page shows fixed copy for
154
- * `ok` and never this text, since a downstream's reply quoted here can
155
- * quote the credential it rejected.
185
+ * Shown and logged nowhere: a downstream's reply quoted here can quote the
186
+ * credential it rejected (INV-6). The operator page shows fixed copy for
187
+ * `ok`, and the log records only that a test failed.
156
188
  */
157
189
  message?: string;
158
190
  }
@@ -164,6 +196,10 @@ export interface ConnectorContext {
164
196
  logger: Logger;
165
197
  /** Public base URL of this deployment (origin), used for OAuth callbacks. */
166
198
  baseUrl: string;
199
+ /** Fixed deployment configuration, independent of the request Host. */
200
+ publicUrl?: string;
201
+ /** Deployment name used in downstream client metadata. */
202
+ oauthClientName?: string;
167
203
  /**
168
204
  * Read-only access to this connector's human-managed credential. Present
169
205
  * only when the connector declares `credential` and the deployment configures
@@ -182,17 +218,59 @@ export interface ConnectorContext {
182
218
  requestScope?: object;
183
219
  /** Best-effort cancellation signal for this connector operation. */
184
220
  signal?: AbortSignal;
221
+ /** Runtime hook keeping a dispatched OAuth refresh alive through its commit. */
222
+ defer?: (promise: Promise<unknown>) => void;
185
223
  /** Requested connector-operation deadline in milliseconds. */
186
224
  timeoutMs?: number;
187
225
  }
188
- type ConnectorStatusState = "ok" | "auth_required" | "error";
226
+ type ConnectorStatusState = "ok" | "auth_required" | "credential_required" | "error";
227
+ /**
228
+ * What a reviewed downstream tool does. `"read"` is observational. `"write"`
229
+ * changes state without destroying any that already exists, such as a create.
230
+ * `"destructive"` modifies or removes existing state, including an upsert that
231
+ * can overwrite. Both writes leave the read-only path; `"destructive"` also
232
+ * asserts `destructiveHint`, which shapes the approval copy a human reads.
233
+ */
234
+ export type ToolVerdict = "read" | "write" | "destructive";
235
+ /** One reviewed tool, with the evidence that justifies its verdict. */
236
+ export interface ReviewedTool {
237
+ readonly verdict: ToolVerdict;
238
+ /** Why the verdict holds when the name or downstream annotations do not say. */
239
+ readonly reason?: string;
240
+ /**
241
+ * `sha256:<hex>` digest of the input and output schemas the review read.
242
+ * Omit until a review has actually read them; an invented digest reports
243
+ * drift that never happened. When the live schema no longer matches it, or
244
+ * it cannot be checked, the verdict lapses and the tool is served as a write.
245
+ */
246
+ readonly schemaDigest?: string;
247
+ }
248
+ /**
249
+ * A reviewed classification of a downstream MCP catalog, keyed by exact tool
250
+ * name. Plain data, validated at construction, so the same record classifies
251
+ * live tools and feeds the drift check. A connector carries it as
252
+ * `Connector.classification`, and the registry applies it on every read.
253
+ *
254
+ * It fails closed. A name it does not list keeps only an explicit downstream
255
+ * read annotation; silence and contradiction classify as writes. A listed read
256
+ * fills downstream silence but never overrules an explicit write annotation.
257
+ * A listed write or destructive tool stays a write whatever the downstream
258
+ * claims. A listed tool whose `schemaDigest` no longer matches is a write.
259
+ */
260
+ export interface ToolClassification {
261
+ /** Hide every name absent from tools, including tools claiming to be reads. */
262
+ readonly unlisted?: "hide";
263
+ readonly tools: Readonly<Record<string, ToolVerdict | ReviewedTool>>;
264
+ }
189
265
  /**
190
266
  * How far a downstream catalog has moved away from the manifest a release
191
- * reviewed. Four numbers and nothing else: names, schemas, and prose stay out
267
+ * reviewed. Counts and nothing else: names, schemas, and prose stay out
192
268
  * of every surface this rides on, so a drift report can never become a payload
193
269
  * ([#343](https://github.com/zackbart/connecta/issues/343)).
194
270
  */
195
271
  export interface CatalogDriftCounts {
272
+ /** Downstream tools dropped because their names contain C0, DEL, or C1. */
273
+ droppedTools?: number;
196
274
  /** Live tools no release classified. Each one fails closed at call time. */
197
275
  unclassifiedTools: number;
198
276
  /** Classified names this catalog no longer serves — plan gating included. */
@@ -213,7 +291,10 @@ export interface CatalogAccessObservation {
213
291
  state: "fresh" | "stale";
214
292
  observedAt: string;
215
293
  }
294
+ export type ResourceTemplateRefusalCode = "resource_template_ambiguous" | "resource_match_budget_exceeded";
216
295
  export interface ConnectorStatus {
296
+ /** Distinct host-observed refusal codes, without URI or template text. */
297
+ resourceTemplateRefusals?: ResourceTemplateRefusalCode[];
217
298
  state: ConnectorStatusState;
218
299
  /** When state === "auth_required", the URL the operator should open. */
219
300
  authorizationUrl?: string;
@@ -222,6 +303,15 @@ export interface ConnectorStatus {
222
303
  * authorization URL instead of starting a new flow. Absent otherwise.
223
304
  */
224
305
  authorizationReused?: boolean;
306
+ /** The client registration mechanism actually selected for this grant. */
307
+ registrationPath?: "cimd" | "dcr" | "static";
308
+ /**
309
+ * From `startAuth()`, the message reaches the agent. From `status()`, it is
310
+ * never logged, and `Registry.statusFor` keeps it only when connecta wrote
311
+ * it: a custom connector's `status()` contributes its state alone, since
312
+ * its text can quote a downstream (INV-6). Connecta's connectors describe a
313
+ * failed status from its typed record.
314
+ */
225
315
  message?: string;
226
316
  /**
227
317
  * Drift observed the last time this connector served a catalog refresh *in
@@ -237,6 +327,27 @@ export interface ConnectorStatus {
237
327
  */
238
328
  catalogAccess?: CatalogAccessObservation;
239
329
  }
330
+ /** A downstream skill's verbatim frontmatter and complete file manifest. */
331
+ export interface ConnectorSkill {
332
+ uri: string;
333
+ frontmatter: Record<string, unknown>;
334
+ resources: "dynamic" | Array<{
335
+ uri: string;
336
+ digest: string;
337
+ size: number;
338
+ }>;
339
+ }
340
+ /** Resource bytes before the agent boundary, with exactly one encoding. */
341
+ export type ConnectorSkillResourceContents = {
342
+ uri: string;
343
+ mimeType?: string;
344
+ } & ({
345
+ text: string;
346
+ blob?: never;
347
+ } | {
348
+ blob: string;
349
+ text?: never;
350
+ });
240
351
  /** The whole plugin contract — the one open seam. */
241
352
  export interface Connector {
242
353
  id: string;
@@ -250,29 +361,17 @@ export interface Connector {
250
361
  title?: string;
251
362
  /** How call_tool wraps results. "mcp" passes the content array through; anything else is JSON-wrapped. */
252
363
  kind?: "mcp" | "api";
253
- /**
254
- * This connector's own default for its tools that are not explicitly
255
- * read-only, inside `execute_code`: `"never"` lets a program call them
256
- * without asking for approval. Reserved for connectors connecta ships
257
- * whose writes are cheap to undo (the artifacts connector, whose
258
- * every write is a new immutable version); a deployment's own connectors
259
- * leave it unset and exempt through `execute.approval`, which overrides
260
- * this either way. Never read from a downstream catalog — a server cannot
261
- * exempt its own tools — and never makes a tool read-only anywhere else.
262
- */
263
- approval?: "never";
264
364
  description?: string;
265
365
  /**
266
366
  * Max inline result size (bytes) for this connector's tools before
267
- * call_tool truncates and stashes the full text for get_result
367
+ * call_tool truncates and stashes the full text for connecta.result
268
368
  * paging. Overrides `ConnectaConfig.calls.maxResultBytes`;
269
369
  * omit to inherit it (which itself defaults to 24_000). Must be a whole
270
- * number of bytes >= 1; anything else warns at startup and is ignored, so
271
- * the connector inherits the deployment-wide cap.
370
+ * number of bytes >= 1; anything else refuses to construct.
272
371
  */
273
372
  maxResultBytes?: number;
274
373
  /**
275
- * Optional per-runtime admission policy for downstream tool calls. It covers
374
+ * Optional per-runtime admission policy for downstream tool calls and resource reads. It covers
276
375
  * call_tool, call_destructive_tool, and every execute_code host call, but
277
376
  * not catalog/status/auth operations.
278
377
  */
@@ -284,11 +383,22 @@ export interface Connector {
284
383
  * cannot describe correct use (for example a generic API wrapper or a
285
384
  * cross-operation sequencing rule).
286
385
  *
287
- * Listed by `skills` as `connector:<id>` and returned verbatim by
288
- * `skills({ name: "connector:<id>" })`. The guide remains deployment-owned
289
- * configuration; no runtime registration or shared mutable copy exists.
386
+ * Served as `skill://connecta/connectors/<slug>/SKILL.md`, with generated
387
+ * frontmatter followed by the unchanged guide body. `connector:<id>` is a
388
+ * one-release lookup alias. The guide remains deployment-owned configuration;
389
+ * no runtime registration or shared mutable copy exists.
290
390
  */
291
391
  usageGuide?: string | ConnectorUsageGuide;
392
+ /**
393
+ * Opted-in downstream Skills transport. The registry validates advertised
394
+ * URIs and manifest bounds before exposing these bytes to an agent. The host
395
+ * verifies preserved digests against the returned bytes. Neither
396
+ * operation registers tools or retains a catalog across requests.
397
+ */
398
+ downstreamSkills?: {
399
+ list(ctx: ConnectorContext): Promise<ConnectorSkill[]>;
400
+ read(uri: string, ctx: ConnectorContext): Promise<ConnectorSkillResourceContents[]>;
401
+ };
292
402
  /** Optional human-managed credential slot rendered in the connection in the operator UI. */
293
403
  credential?: ConnectorCredentialConfig;
294
404
  /** Optional server-side check used by the connection's Test action in the operator UI. */
@@ -301,21 +411,69 @@ export interface Connector {
301
411
  * fetched lazily over the network and are not known at construction time.
302
412
  */
303
413
  staticTools?: ToolDef[];
414
+ /**
415
+ * Optional reviewed classification of the tools `listTools` returns: data
416
+ * the registry applies, never something the connector applies itself.
417
+ * `remoteMcp({ classify })` and maintained providers set it to a
418
+ * deep-frozen record; a custom connector may set one too. It is validated
419
+ * when a registry first reads it (INV-11), and read once per connector
420
+ * object. A connector that sets it lists raw downstream tools; the
421
+ * registry caches and persists only that listing, and classifies it on
422
+ * every read with this record, so no cache layer carries a verdict.
423
+ * Connectors with `staticTools` cannot set it: annotate those directly.
424
+ *
425
+ * A wrapper that rebuilds a connector must forward this field to keep the
426
+ * review. `{ ...connector }`, `Object.assign`, and `Object.create` keep it;
427
+ * a forwarding class that omits it serves an unreviewed connector, whose
428
+ * downstream annotations are its own claims and fail closed when absent.
429
+ * Deployment-level classifier overrides, keyed by connector id
430
+ * and tool ([#706](https://github.com/zackbart/connecta/issues/706)), apply
431
+ * regardless of wrapping.
432
+ */
433
+ readonly classification?: ToolClassification | undefined;
304
434
  /**
305
435
  * Optional: the drift this connector saw the last time it listed tools,
306
- * or undefined when it has not listed any yet. Implemented by maintained
307
- * hosted-MCP proxies, which compare the live catalog with the manifest a
308
- * release reviewed *while* serving a refresh the deployment already asked
309
- * for. It is a getter over an observation, never a probe: calling it makes
310
- * no request, touches no credential, and returns counts only.
436
+ * or undefined when it has not listed any yet. A getter over an
437
+ * observation, never a probe: calling it makes no request, touches no
438
+ * credential, and returns counts only. Ignored for a connector with a
439
+ * `classification`, whose drift the registry observes itself, against
440
+ * that record, while serving a refresh the deployment already asked for.
311
441
  */
312
442
  catalogDrift?(): CatalogDriftReport | undefined;
443
+ /**
444
+ * Optional: what this connector is, for `Connecta.describeConfig()` and the
445
+ * operator surfaces built on it — where it points, how it authenticates,
446
+ * and its static tools. Never a probe and never a secret: header names but
447
+ * no values, a credential slot's labels but never its contents, an
448
+ * endpoint's origin and path but no query or userinfo. `remoteMcp()`,
449
+ * `api()` and the maintained providers implement
450
+ * it; a custom connector without it is described as `{ source: { kind:
451
+ * "custom" } }`. Core copies only the fields named in
452
+ * `ConnectorDescription`, so anything else returned is dropped.
453
+ */
454
+ describe?(): ConnectorDescription;
313
455
  listTools(ctx: ConnectorContext): Promise<ToolDef[]>;
314
- callTool(name: string, args: unknown, ctx: ConnectorContext): Promise<unknown>;
456
+ callTool(name: string, args: unknown, ctx: ConnectorContext,
457
+ /** A fresh deep copy of the catalog definition for this dispatch. */
458
+ options?: {
459
+ definition?: ToolDef;
460
+ /** Verified direct-call continuation, never populated by a program. */
461
+ input?: {
462
+ requestState?: string;
463
+ inputResponses: Record<string, unknown>;
464
+ } | undefined;
465
+ }): Promise<unknown>;
466
+ /**
467
+ * Optional read-only downstream resource operation. The URI is an opaque
468
+ * argument to this configured connector, never a destination to fetch.
469
+ * Return the MCP-shaped `{ contents }` result. Programs require a grant to
470
+ * the whole connector; an exact-tool grant does not authorize resources.
471
+ */
472
+ readResource?(uri: string, ctx: ConnectorContext): Promise<unknown>;
315
473
  /**
316
474
  * Optional best-effort teardown for resources retained under
317
- * `ctx.requestScope`. The core calls this at most once when a scope it created
318
- * solely for probing ends, and never uses that scope again. Teardown gets a
475
+ * `ctx.requestScope`. The core calls this at most once when a probe or
476
+ * execute_code scope ends, and never uses that scope again. Teardown gets a
319
477
  * small, fixed best-effort completion window; a missing, rejected, or
320
478
  * never-settling hook cannot change or hold open the operation's result
321
479
  * beyond that bound.
@@ -349,12 +507,88 @@ export interface Connector {
349
507
  * pending URL could complete consent with their own account.
350
508
  */
351
509
  verifyState?(state: string | null, ctx: ConnectorContext): Promise<boolean>;
510
+ /** Validate a callback issuer against its verified consent, including error responses. */
511
+ verifyCallbackIssuer?(issuer: string | null, ctx: ConnectorContext): Promise<boolean>;
512
+ /**
513
+ * Atomically terminate the consent verified in this context, discarding its
514
+ * verifier. Required to accept error callbacks; must share finishAuth's
515
+ * single-use claim so concurrent error and code callbacks have one winner.
516
+ */
517
+ consumeAuthError?(ctx: ConnectorContext): Promise<void>;
352
518
  /**
353
519
  * Optional: complete a downstream OAuth flow (called by
354
520
  * /oauth/callback/<id>). `callbackParams` preserves the authorization
355
- * server's RFC 9207 `iss` response parameter for SDK validation.
521
+ * server's RFC 9207 `iss` response parameter for validation. Built-in
522
+ * OAuth adapters require a nonempty `state` in this parameter, including
523
+ * programmatic calls and `api()` flows with PKCE disabled. Missing state
524
+ * is refused before any downstream request.
356
525
  */
357
- finishAuth?(code: string, ctx: ConnectorContext, callbackParams?: URLSearchParams): Promise<void>;
526
+ finishAuth?(code: string, ctx: ConnectorContext, callbackParams: URLSearchParams): Promise<void>;
527
+ }
528
+ /** An endpoint as `describeConfig()` shows it: never a query, fragment, or userinfo. */
529
+ export interface DescribedEndpoint {
530
+ origin: string;
531
+ path: string;
532
+ }
533
+ /** A connector's downstream authentication, without a single secret. */
534
+ export interface ConnectorAuthDescription {
535
+ /** `none` when the connector authenticates nothing itself. */
536
+ mode: "none" | "headers" | "credential" | "oauth" | "request";
537
+ /** Names of deployment-owned static headers; their values never appear. */
538
+ headerNames?: string[];
539
+ /** Header a stored credential rides. */
540
+ header?: string;
541
+ /** Framing placed before a stored credential; null sends it verbatim. */
542
+ scheme?: string | null;
543
+ /** Requested OAuth scopes. */
544
+ scope?: string;
545
+ /** Public CIMD client metadata document. */
546
+ clientMetadataUrl?: string;
547
+ /** A declared authorization endpoint (`api()` OAuth). */
548
+ authorizationEndpoint?: DescribedEndpoint;
549
+ /** A declared token endpoint (`api()` OAuth). */
550
+ tokenEndpoint?: DescribedEndpoint;
551
+ /** Origins `ctx.oauth.fetch` sends the access token to. */
552
+ apiOrigins?: string[];
553
+ /** Token-endpoint client authentication method. */
554
+ tokenEndpointAuthMethod?: string;
555
+ /** Whether the client authenticates with a secret; the secret never appears. */
556
+ confidentialClient?: boolean;
557
+ /** Whether PKCE is used. */
558
+ pkce?: boolean;
559
+ /** Names of extra authorization-request parameters; values never appear. */
560
+ authorizationParamNames?: string[];
561
+ /** Names of extra token-request headers; values never appear. */
562
+ tokenRequestHeaderNames?: string[];
563
+ }
564
+ /** One statically known tool, with the classification core will apply. */
565
+ export interface ConnectorToolDescription {
566
+ name: string;
567
+ description?: string;
568
+ annotations?: ToolAnnotations;
569
+ inputSchema?: JsonSchema;
570
+ outputSchema?: JsonSchema;
571
+ /** Present on registry descriptions after overrides and provider review (INV-1). */
572
+ classification?: "read" | "write";
573
+ }
574
+ /** What `Connector.describe()` reports. Every field is optional but `source`. */
575
+ export interface ConnectorDescription {
576
+ /** Construction-time presence for described fields, keyed by relative dot path. Never option values. */
577
+ optionSources?: Readonly<Record<string, "default" | "config">>;
578
+ source: {
579
+ kind: "remote-mcp" | "api" | "custom";
580
+ /** The maintained provider or built-in module that built the connector. */
581
+ provider?: string;
582
+ };
583
+ endpoint?: DescribedEndpoint;
584
+ auth?: ConnectorAuthDescription;
585
+ transport?: {
586
+ versionNegotiation?: "auto" | "legacy";
587
+ redirects?: "none" | "same-origin";
588
+ requireHttps?: boolean;
589
+ };
590
+ /** Static tools; omitted for a catalog that loads from the network. */
591
+ tools?: ConnectorToolDescription[];
358
592
  }
359
593
  export interface ConnectorUsageGuide {
360
594
  /** Markdown returned verbatim by `skills({ name: "connector:<id>" })`. */
@@ -377,6 +611,17 @@ export interface ConnectorUsageGuide {
377
611
  export interface ExecuteResult {
378
612
  result: unknown;
379
613
  error?: string;
614
+ /** Host-owned sandbox facts. Never derive these from guest result values or logs. */
615
+ failure?: {
616
+ name: string;
617
+ /** An uncaught typed host rejection, retained by guest Error identity. */
618
+ call?: CallErrorDetails;
619
+ line?: number;
620
+ timeout?: {
621
+ elapsedMs: number;
622
+ deadlineMs: number;
623
+ };
624
+ };
380
625
  logs?: string[];
381
626
  }
382
627
  /** A named group of host functions exposed to sandboxed code as a global. */
@@ -385,7 +630,7 @@ export interface ExecutorProvider {
385
630
  fns: Record<string, (...args: unknown[]) => Promise<unknown>>;
386
631
  /**
387
632
  * Optional trusted sandbox-side setup run after provider globals exist.
388
- * Connecta uses this to restore typed host errors. This is host-authored code, never
633
+ * Connecta uses this for the immutable namespace and emission acknowledgements. This is host-authored code, never
389
634
  * model input. See documentation/code-mode.md#what-an-executor-must-implement.
390
635
  */
391
636
  prelude?: string;
@@ -393,8 +638,13 @@ export interface ExecutorProvider {
393
638
  /**
394
639
  * Runs model-written JavaScript in a sandbox where the ONLY capabilities are
395
640
  * the provider functions — no network, filesystem, env, or timers. Structurally
396
- * compatible with `DynamicWorkerExecutor` from `@cloudflare/codemode` (Workers);
641
+ * compatible with the upstream `DynamicWorkerExecutor` result/provider seam;
642
+ * Workers must use `workerExecutor()` from "@zackbart/connecta/worker" so each
643
+ * run owns and releases its Worker Loader and RPC handles. Direct upstream
644
+ * construction is rejected by `createConnecta()`.
397
645
  * `quickJsExecutor()` from "@zackbart/connecta/quickjs" is the Node implementation.
646
+ * Custom implementations must explicitly opt in with
647
+ * `customExecutor(executor, { lifecycle: "self-managed" })` from the root entry.
398
648
  * NEVER back this with an unsandboxed eval — the code is untrusted.
399
649
  */
400
650
  export interface Executor {
@@ -436,11 +686,13 @@ export interface AdmissionSnapshot {
436
686
  /**
437
687
  * Optional admission capability used by bounded executors. The acquired lease
438
688
  * carries execution so an already-admitted caller cannot accidentally acquire
439
- * a second slot and deadlock a pool of one.
689
+ * a second slot and deadlock a pool of one. `wait: false` must refuse with
690
+ * executor_overloaded immediately when no slot is free; never queue it.
440
691
  */
441
692
  export interface AdmittingExecutor extends Executor {
442
693
  acquire(options?: {
443
694
  signal?: AbortSignal;
695
+ wait?: boolean;
444
696
  }): Promise<ExecutorLease>;
445
697
  /** Payload-free health/metrics view when the executor exposes one. */
446
698
  admissionSnapshot?(): AdmissionSnapshot;
@@ -457,6 +709,8 @@ export type AuthResult = {
457
709
  ok: true;
458
710
  userId?: string;
459
711
  subjectId?: string;
712
+ /** Browser session cookies refreshed by an interactive provider. */
713
+ sessionCookies?: readonly string[];
460
714
  /** Human owner represented by a non-interactive access credential. */
461
715
  principal?: IdentityReference;
462
716
  } | {
@@ -600,11 +854,21 @@ export interface ConnectaTheme {
600
854
  */
601
855
  colorScheme?: "system" | "light" | "dark";
602
856
  }
603
- /** An inbound authentication provider (bearer token, interactive identity, ...). */
857
+ /** An inbound authentication provider (machine token or interactive identity). */
604
858
  export interface InboundAuth {
605
859
  kind: string;
606
860
  /** This provider may admit a human identity to operator mutation routes. */
607
861
  interactiveOperator?: true;
862
+ /**
863
+ * Recognize credential syntax or trusted runtime context, without verifying
864
+ * it or doing I/O. The first recognizing provider owns the verdict, including
865
+ * refusals. Human routes reject recognized machine credentials without
866
+ * consulting storage or another identity. A throw fails closed.
867
+ * Explicit Authorization headers are normalized and exclude cookies and
868
+ * Access context. Without recognition, the first eligible provider owns
869
+ * that header's verdict; a refusal never falls back to another provider.
870
+ */
871
+ recognizesCredential?(request: Request, runtimeContext?: InboundAuthRuntimeContext): boolean;
608
872
  /**
609
873
  * Stable, non-secret namespace of the identity directory behind
610
874
  * `activityActorLabel`. Stored with new activity actors so two providers with
@@ -622,11 +886,13 @@ export interface InboundAuth {
622
886
  activityActorLabel?(subjectId: string): string | undefined | Promise<string | undefined>;
623
887
  /**
624
888
  * Optional browser sign-in configuration. When present, operator pages use
625
- * the provider instead of asking the operator to paste a static bearer secret.
889
+ * the provider's interactive sign-in flow.
626
890
  */
627
891
  uiAuth?: UiAuthConfig;
628
892
  /** Serve/short-circuit .well-known + OPTIONS. Return null when not handled. */
629
893
  handleMetadata?(request: Request, baseUrl: string): Response | null | Promise<Response | null>;
894
+ /** 401 challenge, selected only when this provider serves the resource metadata. */
895
+ challenge?(request: Request, baseUrl: string): string;
630
896
  /** Attempt to authorize a request. */
631
897
  authorize(request: Request, baseUrl: string, runtimeContext?: InboundAuthRuntimeContext): AuthResult | Promise<AuthResult>;
632
898
  }
package/dist/types.js CHANGED
@@ -1,2 +1 @@
1
- // Core contracts for connecta. Web-API only — no node: imports here.
2
1
  export {};
package/dist/ui.d.ts CHANGED
@@ -2,21 +2,15 @@ import type { OperatorSurface } from "./module-contracts.js";
2
2
  import type { CredentialVault } from "./credential-contract.js";
3
3
  import { type DeferredWork } from "./connector-scope.js";
4
4
  import { type CredentialManagementCapability, type UiData, type UiProblem, type UiToolSafety } from "./operator-ui/model.js";
5
- import { type ApprovalPolicy } from "./tool-safety.js";
6
5
  import type { RegistryView } from "./registry.js";
7
6
  import type { ConnectaBranding, Connector, ConnectorStatus, ToolDef, UiAuthConfig } from "./types.js";
8
7
  export { filterUiConnectors, type CredentialManagementCapability, type UiConnector, type UiData, } from "./operator-ui/model.js";
9
8
  export { CONNECTA_FAVICON_SVG, resolveBranding, isSafeHttpUrl, isSafeHttpsUrl, isSafeIconHref } from "./branding.js";
10
- export type OperatorPage = "tokens" | "connections" | "activity" | "artifacts" | "artifact";
9
+ export type OperatorPage = import("./operator-ui/view.js").OperatorPage;
11
10
  export declare function operatorPageForPath(path: string): OperatorPage | undefined;
12
11
  export declare function operatorPageTitle(page: OperatorPage, configuredTitle: string): string;
13
- /**
14
- * The badge a tool earns, from the predicates core enforces with. Computed
15
- * here so the page reports the rule rather than restating it. `exempt` is the
16
- * config exemption (#566), which `isApprovalExempt` already refuses to grant
17
- * a read-only tool.
18
- */
19
- export declare function uiToolSafety(definition: ToolDef, exempt?: boolean): UiToolSafety;
12
+ /** Report the verdict the registry stored, independent of pool trust. */
13
+ export declare function uiToolSafety(definition: ToolDef): UiToolSafety;
20
14
  /**
21
15
  * The fix-prompt key for a connector that is not usable. Chosen from the
22
16
  * status state and the connector's declared auth shape — configuration, never
@@ -43,22 +37,16 @@ export declare function buildUiData(registry: RegistryView, baseUrl: string, ser
43
37
  mayManage?: (id: string) => boolean;
44
38
  timeoutMs?: number;
45
39
  signal?: AbortSignal;
46
- approval?: ApprovalPolicy;
47
40
  }): Promise<UiData>;
48
41
  /**
49
42
  * Every operator page serves this same data-free shell. Connector, credential,
50
43
  * and activity data arrives only through the authenticated `/ui/*` APIs.
51
44
  */
52
- export declare function renderUiHtml(uiAuth?: UiAuthConfig, mcpUrl?: string, branding?: ConnectaBranding, nonce?: string, page?: OperatorPage, options?: {
53
- /** Where the Connections page lives, when this shell is on another origin. */
54
- homeUrl?: string;
55
- /**
56
- * The origin that serves `/favicon.*`, when this shell is on another one:
57
- * an artifact host answers those paths with 404. See `PageLayout.iconOrigin`.
58
- */
59
- iconOrigin?: string | undefined;
60
- }): string;
45
+ export declare function renderUiHtml(uiAuth?: UiAuthConfig, mcpUrl?: string, branding?: ConnectaBranding,
46
+ /** @deprecated Scripts load from same-origin assets; ignored. */
47
+ _nonce?: string, page?: OperatorPage): string;
61
48
  /** Mount the connection UI without enabling any storage or activity module. */
62
49
  export declare function operatorUi(options?: {
63
50
  branding?: ConnectaBranding;
64
51
  }): OperatorSurface;
52
+ export type { OperatorUiContract, OperatorConnectorOverlay, OperatorTool, OperatorViewer, OperatorGrant, OperatorPool, OperatorLastCall, } from "./operator-ui/contract.js";