@vornrun/connector-sdk 0.7.0-beta.13 → 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 } from './packaging-DFTuP4fr.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>;
@@ -9,6 +9,8 @@ interface CliDeps {
9
9
  cwd?: string;
10
10
  /** Replaced in tests so pack does not shell out to a bundler. */
11
11
  bundle?(request: BundleRequest): Promise<BundleOutput>;
12
+ /** Replaced in tests so pack does not start the staged bundle. */
13
+ launch?(dir: string): Promise<CheckFinding[]>;
12
14
  /** Writes a scaffold file or a receipt; replaced in tests so nothing touches disk. */
13
15
  writeFile?(path: string, contents: string): Promise<void>;
14
16
  /** Replaced in tests beside writeFile. */
package/dist/cli.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  runPoll,
11
11
  scaffoldFiles,
12
12
  serveConnector
13
- } from "./chunk-XOP6JKBX.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)) {
@@ -171,7 +173,8 @@ ${connector.id} passed with ${findings.length} warning(s)`
171
173
  entry: modulePath,
172
174
  ...flags.out !== void 0 && { outDir: flags.out },
173
175
  ...deps.cwd !== void 0 && { resolveDir: deps.cwd },
174
- ...deps.bundle !== void 0 && { bundle: deps.bundle }
176
+ ...deps.bundle !== void 0 && { bundle: deps.bundle },
177
+ ...deps.launch !== void 0 && { launch: deps.launch }
175
178
  });
176
179
  if (result.findings.length > 0) deps.write(formatFindings(result.findings));
177
180
  const errors = result.findings.filter((item) => item.level === "error");
package/dist/index.d.ts CHANGED
@@ -1,7 +1,11 @@
1
- import { C as ConnectorDefinition, b as Connector, c as ConnectorConfig, T as TriggerDefinition, P as PollContext, d as PollOutcome, e as ConnectorItem, N as NormalizedItem, f as PostReceiveOp, A as ActionRequest, B as BundleRequest, a as BundleOutput, g as CheckFinding } from './packaging-DFTuP4fr.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 checkConnector, a3 as connectionSetup, a4 as connectorManifest, a5 as createConnectorHarness, a6 as drainPoll, a7 as esbuildBundle, a8 as escapedMockHttp, a9 as formatFindings, aa as lifecycleScriptFindings, ab as pollToolName, ac as readNearestPackageJson, ad as resilientFetch, ae as retryAfterMs, af as runAction, ag as runConformance, ah as runOptions, ai as runPoll, aj as withMockHttp } from './packaging-DFTuP4fr.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,8 +154,12 @@ 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>;
161
+ /** Replaced in tests whose subject is the archive rather than the launch; defaults to starting it for real. */
162
+ launch?(dir: string): Promise<CheckFinding[]>;
120
163
  }
121
164
  interface PackResult {
122
165
  findings: CheckFinding[];
@@ -133,6 +176,8 @@ interface ConnectorServerOptions {
133
176
  /** Resolved connector configuration. Defaults to reading `process.env`. */
134
177
  config?: ConnectorConfig;
135
178
  now?: () => string;
179
+ /** The host an extension's contributions talk to; defaults to the bridge Vorn served. */
180
+ host?(sessionId: string): ExtensionHost;
136
181
  }
137
182
  /**
138
183
  * Expose a connector as an MCP server.
@@ -165,6 +210,8 @@ interface ScaffoldOptions {
165
210
  description?: string;
166
211
  /** Emit the shape the connectors repository expects of a package inside it. */
167
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';
168
215
  }
169
216
  interface ScaffoldFile {
170
217
  /** Relative to the directory the connector is created in. */
@@ -173,7 +220,7 @@ interface ScaffoldFile {
173
220
  }
174
221
  /** `acme-tickets` → `Acme Tickets`, so a generated name reads like a name. */
175
222
  declare function titleCase(id: string): string;
176
- /** 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. */
177
224
  declare function scaffoldFiles(options: ScaffoldOptions): ScaffoldFile[];
178
225
 
179
- 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,23 +11,30 @@ import {
7
11
  MockRouteMissError,
8
12
  OPTIONS_TOOL,
9
13
  PREFLIGHT_TOOL,
14
+ PermissionDeniedError,
10
15
  applyPostReceive,
11
16
  asOutput,
12
17
  backoffMs,
13
18
  bundleDependencyFindings,
19
+ bundledRequireFindings,
14
20
  checkConnector,
15
21
  connectionSetup,
16
22
  connectorManifest,
17
23
  createConnectorHarness,
18
24
  createConnectorServer,
25
+ createExtensionHost,
19
26
  defineConnector,
27
+ defineExtension,
20
28
  drainPoll,
21
29
  envNameFor,
22
30
  esbuildBundle,
23
31
  escapedMockHttp,
24
32
  executeRequest,
33
+ footerToolName,
25
34
  formatFindings,
35
+ handlerToolName,
26
36
  lifecycleScriptFindings,
37
+ mockExtensionHost,
27
38
  nextLink,
28
39
  normalizeItem,
29
40
  normalizeItems,
@@ -46,9 +57,13 @@ import {
46
57
  titleCase,
47
58
  valueAt,
48
59
  withMockHttp
49
- } from "./chunk-XOP6JKBX.js";
60
+ } from "./chunk-FHGC7LE7.js";
50
61
  export {
51
62
  CHECK_OWNERS,
63
+ EXTENSION_PERMISSIONS,
64
+ HOST_PERMISSIONS,
65
+ HOST_TOKEN_ENV,
66
+ HOST_URL_ENV,
52
67
  MANIFEST_TOOL,
53
68
  MAX_PACK_BYTES,
54
69
  MAX_POLL_PAGES,
@@ -56,23 +71,30 @@ export {
56
71
  MockRouteMissError,
57
72
  OPTIONS_TOOL,
58
73
  PREFLIGHT_TOOL,
74
+ PermissionDeniedError,
59
75
  applyPostReceive,
60
76
  asOutput,
61
77
  backoffMs,
62
78
  bundleDependencyFindings,
79
+ bundledRequireFindings,
63
80
  checkConnector,
64
81
  connectionSetup,
65
82
  connectorManifest,
66
83
  createConnectorHarness,
67
84
  createConnectorServer,
85
+ createExtensionHost,
68
86
  defineConnector,
87
+ defineExtension,
69
88
  drainPoll,
70
89
  envNameFor,
71
90
  esbuildBundle,
72
91
  escapedMockHttp,
73
92
  executeRequest,
93
+ footerToolName,
74
94
  formatFindings,
95
+ handlerToolName,
75
96
  lifecycleScriptFindings,
97
+ mockExtensionHost,
76
98
  nextLink,
77
99
  normalizeItem,
78
100
  normalizeItems,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vornrun/connector-sdk",
3
- "version": "0.7.0-beta.13",
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",