@vornrun/connector-sdk 0.7.0-beta.14 → 0.7.0-beta.15

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.
package/dist/cli.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { B as BundleRequest, a as BundleOutput, C as CheckFinding } from './check-Hw1F1a5z.js';
2
+ import { B as BundleRequest, a as BundleOutput, C as CheckFinding } from './check-Cv6UNBA4.js';
3
3
 
4
4
  interface CliDeps {
5
5
  load(modulePath: string): Promise<unknown>;
package/dist/cli.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  runPoll,
11
11
  scaffoldFiles,
12
12
  serveConnector
13
- } from "./chunk-PMMEWBVK.js";
13
+ } from "./chunk-FHGC7LE7.js";
14
14
 
15
15
  // src/cli.ts
16
16
  import { fileURLToPath, pathToFileURL } from "url";
@@ -36,8 +36,9 @@ Options:
36
36
  --receipt <file> Where check writes what it verified, as JSON
37
37
  --out <dir> Directory new and pack write to
38
38
  --name <name> Display name for a new connector
39
- --repo-conventions Scaffold a package shaped for the connectors repository`;
40
- var BOOLEAN_FLAGS = /* @__PURE__ */ new Set(["live", "mock", "repo-conventions"]);
39
+ --repo-conventions Scaffold a package shaped for the connectors repository
40
+ --extension Scaffold an extension \u2014 footers, panes and link handlers`;
41
+ var BOOLEAN_FLAGS = /* @__PURE__ */ new Set(["live", "mock", "repo-conventions", "extension"]);
41
42
  function parseArgs(args) {
42
43
  const flags = {};
43
44
  const positional = [];
@@ -67,7 +68,7 @@ function pickConnector(loaded, modulePath) {
67
68
  const connector = candidate;
68
69
  if (!connector || typeof connector !== "object" || !Array.isArray(connector.triggers)) {
69
70
  throw new Error(
70
- `${modulePath} does not export a connector built with defineConnector() (default or named "connector")`
71
+ `${modulePath} does not export a connector built with defineConnector() or defineExtension() (default or named "connector")`
71
72
  );
72
73
  }
73
74
  return connector;
@@ -93,7 +94,8 @@ ${USAGE}`);
93
94
  const files = scaffoldFiles({
94
95
  id: modulePath,
95
96
  ...flags2.name !== void 0 && { name: flags2.name },
96
- ...flags2["repo-conventions"] === "true" && { repoConventions: true }
97
+ ...flags2["repo-conventions"] === "true" && { repoConventions: true },
98
+ ...flags2.extension === "true" && { kind: "extension" }
97
99
  });
98
100
  const root = join(flags2.out ?? deps.cwd ?? ".", modulePath);
99
101
  if ((deps.exists ?? existsSync)(root)) {
package/dist/index.d.ts CHANGED
@@ -1,7 +1,11 @@
1
- import { b as ConnectorDefinition, c as Connector, d as ConnectorConfig, T as TriggerDefinition, P as PollContext, e as PollOutcome, f as ConnectorItem, N as NormalizedItem, g as PostReceiveOp, A as ActionRequest, B as BundleRequest, a as BundleOutput, C as CheckFinding } from './check-Hw1F1a5z.js';
2
- export { h as ActionContext, i as ActionDefinition, j as ActionInputField, k as ActionInputOption, l as ActionInputType, m as ActionOutputField, n as AuthRung, o as CHECK_OWNERS, p as CheckCode, q as CheckOptions, r as ConformanceRun, s as ConnectionSetup, t as ConnectorAuth, u as ConnectorConfigField, v as ConnectorHarness, w as ConnectorIcon, x as ConnectorManifest, y as ConnectorVerification, D as DedupeStrategy, z as DefaultWorkflow, F as FetchContext, H as HarnessOptions, M as MANIFEST_TOOL, E as MAX_PACK_BYTES, G as MAX_POLL_PAGES, I as MockCall, J as MockRoute, K as MockRouteMissError, L as MockRun, O as OPTIONS_TOOL, Q as OptionsContext, R as OptionsLoader, S as PREFLIGHT_TOOL, U as PaginationStrategy, V as PollPage, W as PreflightResult, X as ResilientFetchOptions, Y as RetryPolicy, Z as RunActionOptions, _ as RunPollOptions, $ as StatusSuggestion, a0 as backoffMs, a1 as bundleDependencyFindings, a2 as bundledRequireFindings, a3 as checkConnector, a4 as connectionSetup, a5 as connectorManifest, a6 as createConnectorHarness, a7 as drainPoll, a8 as esbuildBundle, a9 as escapedMockHttp, aa as formatFindings, ab as lifecycleScriptFindings, ac as pollToolName, ad as readNearestPackageJson, ae as resilientFetch, af as retryAfterMs, ag as runAction, ah as runConformance, ai as runOptions, aj as runPoll, ak as withMockHttp } from './check-Hw1F1a5z.js';
1
+ import { E as ExtensionPermission, b as ExtensionHostMethod, c as ConnectorDefinition, d as Connector, e as ExtensionDefinition, f as ConnectorConfig, g as ExtensionHost, T as TriggerDefinition, P as PollContext, h as PollOutcome, i as ConnectorItem, N as NormalizedItem, j as PostReceiveOp, A as ActionRequest, B as BundleRequest, a as BundleOutput, C as CheckFinding } from './check-Cv6UNBA4.js';
2
+ export { k as ActionContext, l as ActionDefinition, m as ActionInputField, n as ActionInputOption, o as ActionInputType, p as ActionOutputField, q as ActivationPredicate, r as AuthRung, s as CHECK_OWNERS, t as CheckCode, u as CheckOptions, v as ConformanceRun, w as ConnectionSetup, x as ConnectorAuth, y as ConnectorConfigField, z as ConnectorHarness, D as ConnectorIcon, F as ConnectorKind, G as ConnectorManifest, H as ConnectorVerification, I as DedupeStrategy, J as DefaultWorkflow, K as ExtensionAgent, L as ExtensionContext, M as ExtensionContributions, O as ExtensionPlatform, Q as ExtensionUsage, R as ExtensionUsageWindow, S as FetchContext, U as FooterContribution, V as FooterItem, W as HarnessOptions, X as LinkContext, Y as LinkHandled, Z as LinkHandlerContribution, _ as MANIFEST_TOOL, $ as MAX_PACK_BYTES, a0 as MAX_POLL_PAGES, a1 as ManifestContributions, a2 as MockCall, a3 as MockHostAnswers, a4 as MockHostRun, a5 as MockRoute, a6 as MockRouteMissError, a7 as MockRun, a8 as OPTIONS_TOOL, a9 as OptionsContext, aa as OptionsLoader, ab as PREFLIGHT_TOOL, ac as PaginationStrategy, ad as PaneContribution, ae as PollPage, af as PreflightResult, ag as ResilientFetchOptions, ah as RetryPolicy, ai as RunActionOptions, aj as RunPollOptions, ak as StatusSuggestion, al as backoffMs, am as bundleDependencyFindings, an as bundledRequireFindings, ao as checkConnector, ap as connectionSetup, aq as connectorManifest, ar as createConnectorHarness, as as drainPoll, at as esbuildBundle, au as escapedMockHttp, av as footerToolName, aw as formatFindings, ax as handlerToolName, ay as lifecycleScriptFindings, az as mockExtensionHost, aA as pollToolName, aB as readNearestPackageJson, aC as resilientFetch, aD as retryAfterMs, aE as runAction, aF as runConformance, aG as runOptions, aH as runPoll, aI as withMockHttp } from './check-Cv6UNBA4.js';
3
3
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
4
4
 
5
+ /** Everything an extension may ask the host for; anything else is not grantable. */
6
+ declare const EXTENSION_PERMISSIONS: ExtensionPermission[];
7
+ /** What each host method costs, read by the bridge that grants it and the check that gates it. */
8
+ declare const HOST_PERMISSIONS: Record<ExtensionHostMethod, ExtensionPermission>;
5
9
  /** Environment variable a config field reads from, e.g. `apiToken` → `API_TOKEN`. */
6
10
  declare function envNameFor(key: string, explicit?: string): string;
7
11
  /**
@@ -12,6 +16,15 @@ declare function envNameFor(key: string, explicit?: string): string;
12
16
  * MCP tool once the connector is already installed in someone's app.
13
17
  */
14
18
  declare function defineConnector(definition: ConnectorDefinition): Connector;
19
+ /**
20
+ * Validate an extension and fill in its defaults.
21
+ *
22
+ * An extension is a pack like a connector, so it goes through the same
23
+ * manifest, pack, check and catalog; what differs is that it contributes to a
24
+ * session card rather than polling a service. Failing here — at import time —
25
+ * keeps a mistyped permission or an unreachable page from reaching a card.
26
+ */
27
+ declare function defineExtension(definition: ExtensionDefinition): Connector;
15
28
  /**
16
29
  * Read the connector's declared config out of the environment. Vorn supplies
17
30
  * these through the connection's `env` / `secretEnv` maps, so a missing
@@ -20,6 +33,32 @@ declare function defineConnector(definition: ConnectorDefinition): Connector;
20
33
  */
21
34
  declare function resolveConfig(connector: Connector, env?: NodeJS.ProcessEnv): ConnectorConfig;
22
35
 
36
+ /**
37
+ * How an extension asks the host for what it was granted.
38
+ *
39
+ * The extension runs as its own process, so the bridge is an HTTP endpoint the
40
+ * host serves and names in the environment, with a token that says which
41
+ * extension is calling. The host grants exactly the permissions the manifest
42
+ * declared, which is why a call outside them comes back refused rather than
43
+ * empty — the same answer the check's stub gives, so an extension meets the
44
+ * rule once rather than twice.
45
+ */
46
+ /** Where the host answers, and the token that says who is asking. */
47
+ declare const HOST_URL_ENV = "VORN_EXTENSION_HOST";
48
+ declare const HOST_TOKEN_ENV = "VORN_EXTENSION_TOKEN";
49
+ /** The host refused a call the extension's manifest never asked for. */
50
+ declare class PermissionDeniedError extends Error {
51
+ constructor(method: string, detail: string);
52
+ }
53
+ interface HostBridgeOptions {
54
+ sessionId: string;
55
+ env?: NodeJS.ProcessEnv;
56
+ /** Replaced in tests so nothing opens a socket. */
57
+ fetchImpl?: typeof fetch;
58
+ }
59
+ /** The host as an extension process reaches it, over the bridge Vorn served it. */
60
+ declare function createExtensionHost(options: HostBridgeOptions): ExtensionHost;
61
+
23
62
  /**
24
63
  * Run a declarative trigger: call the author's `fetch`, then apply the chosen
25
64
  * dedupe strategy.
@@ -115,6 +154,8 @@ interface PackOptions {
115
154
  sdkModule?: string;
116
155
  /** Size ceiling for the written archive; defaults to `MAX_PACK_BYTES`. */
117
156
  maxBytes?: number;
157
+ /** Size ceiling for what the archive unpacks to; defaults to `MAX_UNPACKED_BYTES`. */
158
+ maxUnpackedBytes?: number;
118
159
  /** Replaced in tests so packing does not shell out to a bundler. */
119
160
  bundle?(request: BundleRequest): Promise<BundleOutput>;
120
161
  /** Replaced in tests whose subject is the archive rather than the launch; defaults to starting it for real. */
@@ -135,6 +176,8 @@ interface ConnectorServerOptions {
135
176
  /** Resolved connector configuration. Defaults to reading `process.env`. */
136
177
  config?: ConnectorConfig;
137
178
  now?: () => string;
179
+ /** The host an extension's contributions talk to; defaults to the bridge Vorn served. */
180
+ host?(sessionId: string): ExtensionHost;
138
181
  }
139
182
  /**
140
183
  * Expose a connector as an MCP server.
@@ -167,6 +210,8 @@ interface ScaffoldOptions {
167
210
  description?: string;
168
211
  /** Emit the shape the connectors repository expects of a package inside it. */
169
212
  repoConventions?: boolean;
213
+ /** What to start: a connector that polls a service, or an extension that contributes to a card. */
214
+ kind?: 'connector' | 'extension';
170
215
  }
171
216
  interface ScaffoldFile {
172
217
  /** Relative to the directory the connector is created in. */
@@ -175,7 +220,7 @@ interface ScaffoldFile {
175
220
  }
176
221
  /** `acme-tickets` → `Acme Tickets`, so a generated name reads like a name. */
177
222
  declare function titleCase(id: string): string;
178
- /** Every file a new connector starts with, ready to build, check and pack. */
223
+ /** Every file a new connector or extension starts with, ready to build, check and pack. */
179
224
  declare function scaffoldFiles(options: ScaffoldOptions): ScaffoldFile[];
180
225
 
181
- export { ActionRequest, BundleOutput, BundleRequest, CheckFinding, Connector, ConnectorConfig, ConnectorDefinition, ConnectorItem, type ConnectorServerOptions, MAX_REQUEST_PAGES, NormalizedItem, type PackOptions, type PackResult, PollContext, PollOutcome, PostReceiveOp, type RequestScope, type ResolvedRequest, type ScaffoldFile, type ScaffoldOptions, type Substitution, TriggerDefinition, applyPostReceive, asOutput, createConnectorServer, defineConnector, envNameFor, executeRequest, nextLink, normalizeItem, normalizeItems, packConnector, packFileName, pollWithDedupe, resolveConfig, resolveRequest, resolveTemplates, scaffoldFiles, serveConnector, titleCase, valueAt };
226
+ export { ActionRequest, BundleOutput, BundleRequest, CheckFinding, Connector, ConnectorConfig, ConnectorDefinition, ConnectorItem, type ConnectorServerOptions, EXTENSION_PERMISSIONS, ExtensionDefinition, ExtensionHost, ExtensionHostMethod, ExtensionPermission, HOST_PERMISSIONS, HOST_TOKEN_ENV, HOST_URL_ENV, type HostBridgeOptions, MAX_REQUEST_PAGES, NormalizedItem, type PackOptions, type PackResult, PermissionDeniedError, PollContext, PollOutcome, PostReceiveOp, type RequestScope, type ResolvedRequest, type ScaffoldFile, type ScaffoldOptions, type Substitution, TriggerDefinition, applyPostReceive, asOutput, createConnectorServer, createExtensionHost, defineConnector, defineExtension, envNameFor, executeRequest, nextLink, normalizeItem, normalizeItems, packConnector, packFileName, pollWithDedupe, resolveConfig, resolveRequest, resolveTemplates, scaffoldFiles, serveConnector, titleCase, valueAt };
package/dist/index.js CHANGED
@@ -1,5 +1,9 @@
1
1
  import {
2
2
  CHECK_OWNERS,
3
+ EXTENSION_PERMISSIONS,
4
+ HOST_PERMISSIONS,
5
+ HOST_TOKEN_ENV,
6
+ HOST_URL_ENV,
3
7
  MANIFEST_TOOL,
4
8
  MAX_PACK_BYTES,
5
9
  MAX_POLL_PAGES,
@@ -7,6 +11,7 @@ import {
7
11
  MockRouteMissError,
8
12
  OPTIONS_TOOL,
9
13
  PREFLIGHT_TOOL,
14
+ PermissionDeniedError,
10
15
  applyPostReceive,
11
16
  asOutput,
12
17
  backoffMs,
@@ -17,14 +22,19 @@ import {
17
22
  connectorManifest,
18
23
  createConnectorHarness,
19
24
  createConnectorServer,
25
+ createExtensionHost,
20
26
  defineConnector,
27
+ defineExtension,
21
28
  drainPoll,
22
29
  envNameFor,
23
30
  esbuildBundle,
24
31
  escapedMockHttp,
25
32
  executeRequest,
33
+ footerToolName,
26
34
  formatFindings,
35
+ handlerToolName,
27
36
  lifecycleScriptFindings,
37
+ mockExtensionHost,
28
38
  nextLink,
29
39
  normalizeItem,
30
40
  normalizeItems,
@@ -47,9 +57,13 @@ import {
47
57
  titleCase,
48
58
  valueAt,
49
59
  withMockHttp
50
- } from "./chunk-PMMEWBVK.js";
60
+ } from "./chunk-FHGC7LE7.js";
51
61
  export {
52
62
  CHECK_OWNERS,
63
+ EXTENSION_PERMISSIONS,
64
+ HOST_PERMISSIONS,
65
+ HOST_TOKEN_ENV,
66
+ HOST_URL_ENV,
53
67
  MANIFEST_TOOL,
54
68
  MAX_PACK_BYTES,
55
69
  MAX_POLL_PAGES,
@@ -57,6 +71,7 @@ export {
57
71
  MockRouteMissError,
58
72
  OPTIONS_TOOL,
59
73
  PREFLIGHT_TOOL,
74
+ PermissionDeniedError,
60
75
  applyPostReceive,
61
76
  asOutput,
62
77
  backoffMs,
@@ -67,14 +82,19 @@ export {
67
82
  connectorManifest,
68
83
  createConnectorHarness,
69
84
  createConnectorServer,
85
+ createExtensionHost,
70
86
  defineConnector,
87
+ defineExtension,
71
88
  drainPoll,
72
89
  envNameFor,
73
90
  esbuildBundle,
74
91
  escapedMockHttp,
75
92
  executeRequest,
93
+ footerToolName,
76
94
  formatFindings,
95
+ handlerToolName,
77
96
  lifecycleScriptFindings,
97
+ mockExtensionHost,
78
98
  nextLink,
79
99
  normalizeItem,
80
100
  normalizeItems,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vornrun/connector-sdk",
3
- "version": "0.7.0-beta.14",
3
+ "version": "0.7.0-beta.15",
4
4
  "description": "Build and share Vorn pull connectors as ordinary npm packages",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -39,7 +39,7 @@
39
39
  "@modelcontextprotocol/sdk": "^1.29.0",
40
40
  "esbuild": "^0.28.2",
41
41
  "tar": "^7.5.21",
42
- "zod": "^4.4.3"
42
+ "zod": "^4.5.4"
43
43
  },
44
44
  "devDependencies": {
45
45
  "tsup": "^8.5.1",