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

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.
@@ -1,49 +1,3 @@
1
- /**
2
- * Surviving an upstream's bad minute.
3
- *
4
- * Every connector eventually meets the same three answers — a rate limit, a
5
- * gateway that briefly forgot how to work, a socket that died mid-call — and
6
- * every author writes the same retry loop for them, usually without the one
7
- * part that matters: only repeating calls that are safe to repeat. Doing it
8
- * here means a connector gets it by saying nothing at all.
9
- */
10
- interface RetryPolicy {
11
- /** Total tries, including the first. Defaults to 3. */
12
- attempts?: number;
13
- /** First backoff step; each retry doubles it. Defaults to 250ms. */
14
- baseDelayMs?: number;
15
- /** Ceiling for any single wait, including one the server asked for. */
16
- maxDelayMs?: number;
17
- }
18
- interface ResilientFetchOptions {
19
- fetchImpl: typeof fetch;
20
- /**
21
- * Whether repeating the call is safe. A read always is; a write is only when
22
- * the action said so, because retrying a `create` invents a second one.
23
- */
24
- retryable: boolean;
25
- retry?: RetryPolicy;
26
- /** Replaced in tests so backoff costs no real time. */
27
- sleep?: (ms: number) => Promise<void>;
28
- }
29
- /**
30
- * How long the server asked us to wait, in milliseconds.
31
- *
32
- * `Retry-After` is either a count of seconds or an HTTP date; both are common
33
- * enough that reading only one of them is how a connector ends up hammering a
34
- * rate limiter it was politely asked to back off from.
35
- */
36
- declare function retryAfterMs(header: string | null, now: number): number | undefined;
37
- /** The wait before try number `attempt`, counting the first try as zero. */
38
- declare function backoffMs(attempt: number, policy?: RetryPolicy): number;
39
- /**
40
- * Wrap a fetch so it retries what is worth retrying.
41
- *
42
- * The wrapper is the value handed to actions as `context.fetch`, so a
43
- * hand-written action and a declared request are equally protected.
44
- */
45
- declare function resilientFetch(options: ResilientFetchOptions): typeof fetch;
46
-
47
1
  /**
48
2
  * Author-facing types for Vorn connectors.
49
3
  *
@@ -519,6 +473,80 @@ interface Connector extends ConnectorDefinition {
519
473
  readonly actions: ActionDefinition[];
520
474
  }
521
475
 
476
+ /**
477
+ * What a connector must be true of as a *package*, rather than as a definition.
478
+ *
479
+ * Both `check` and `pack` ask these questions — check to fail a pull request
480
+ * early, pack to refuse an artifact — so they live here rather than in either,
481
+ * and neither imports the other.
482
+ */
483
+ /** Largest pack Vorn will install, matched by the server's own verification. */
484
+ declare const MAX_PACK_BYTES: number;
485
+ interface BundleRequest {
486
+ contents: string;
487
+ resolveDir: string;
488
+ }
489
+ interface BundleOutput {
490
+ code: string;
491
+ /** Specifiers the bundler left for the runtime to resolve. */
492
+ external: string[];
493
+ }
494
+ /** Reject a source package whose install would run code on the user's machine. */
495
+ declare function lifecycleScriptFindings(pkg: unknown): CheckFinding[];
496
+ /** Specifiers left outside a bundle, which would need a registry at launch. */
497
+ declare function bundleDependencyFindings(external: string[]): CheckFinding[];
498
+ declare function bundledRequireFindings(code: string): CheckFinding[];
499
+ /** Nearest package.json at or above a directory, or undefined when there is none. */
500
+ declare function readNearestPackageJson(fromDir: string): Record<string, unknown> | undefined;
501
+ /** The bundler `pack` uses, shared so `check` gates on the same answer. */
502
+ declare function esbuildBundle(request: BundleRequest): Promise<BundleOutput>;
503
+
504
+ /**
505
+ * Surviving an upstream's bad minute.
506
+ *
507
+ * Every connector eventually meets the same three answers — a rate limit, a
508
+ * gateway that briefly forgot how to work, a socket that died mid-call — and
509
+ * every author writes the same retry loop for them, usually without the one
510
+ * part that matters: only repeating calls that are safe to repeat. Doing it
511
+ * here means a connector gets it by saying nothing at all.
512
+ */
513
+ interface RetryPolicy {
514
+ /** Total tries, including the first. Defaults to 3. */
515
+ attempts?: number;
516
+ /** First backoff step; each retry doubles it. Defaults to 250ms. */
517
+ baseDelayMs?: number;
518
+ /** Ceiling for any single wait, including one the server asked for. */
519
+ maxDelayMs?: number;
520
+ }
521
+ interface ResilientFetchOptions {
522
+ fetchImpl: typeof fetch;
523
+ /**
524
+ * Whether repeating the call is safe. A read always is; a write is only when
525
+ * the action said so, because retrying a `create` invents a second one.
526
+ */
527
+ retryable: boolean;
528
+ retry?: RetryPolicy;
529
+ /** Replaced in tests so backoff costs no real time. */
530
+ sleep?: (ms: number) => Promise<void>;
531
+ }
532
+ /**
533
+ * How long the server asked us to wait, in milliseconds.
534
+ *
535
+ * `Retry-After` is either a count of seconds or an HTTP date; both are common
536
+ * enough that reading only one of them is how a connector ends up hammering a
537
+ * rate limiter it was politely asked to back off from.
538
+ */
539
+ declare function retryAfterMs(header: string | null, now: number): number | undefined;
540
+ /** The wait before try number `attempt`, counting the first try as zero. */
541
+ declare function backoffMs(attempt: number, policy?: RetryPolicy): number;
542
+ /**
543
+ * Wrap a fetch so it retries what is worth retrying.
544
+ *
545
+ * The wrapper is the value handed to actions as `context.fetch`, so a
546
+ * hand-written action and a declared request are equally protected.
547
+ */
548
+ declare function resilientFetch(options: ResilientFetchOptions): typeof fetch;
549
+
522
550
  interface PollPage {
523
551
  items: NormalizedItem[];
524
552
  nextCursor?: string;
@@ -763,7 +791,7 @@ declare function createConnectorHarness(connector: Connector, harnessOptions?: H
763
791
  * named check owns is a compile error rather than a receipt quietly vouching
764
792
  * for a check whose failure nothing was watching.
765
793
  */
766
- type CheckCode = 'missing-description' | 'auth-undeclared' | 'auth-probe-missing' | 'secret-not-marked' | 'action-no-outputs' | 'input-type-unsupported' | 'missing-idempotent' | 'unverifiable' | 'sample-unusable' | 'poll-failed' | 'no-items' | 'no-cursor' | 'cursor-rejected' | 'redelivers-items' | 'stuck-cursor' | 'lifecycle-scripts' | 'keywords-missing' | 'runtime-dependencies' | 'mock-action-failed' | 'mock-network-escape' | 'mock-not-observed' | 'preflight-failed' | 'live-action-failed' | 'pack-too-large';
794
+ type CheckCode = 'missing-description' | 'auth-undeclared' | 'auth-probe-missing' | 'secret-not-marked' | 'action-no-outputs' | 'input-type-unsupported' | 'missing-idempotent' | 'unverifiable' | 'sample-unusable' | 'poll-failed' | 'no-items' | 'no-cursor' | 'cursor-rejected' | 'redelivers-items' | 'stuck-cursor' | 'lifecycle-scripts' | 'keywords-missing' | 'runtime-dependencies' | 'mock-action-failed' | 'mock-network-escape' | 'mock-not-observed' | 'preflight-failed' | 'live-action-failed' | 'pack-launch' | 'pack-too-large';
767
795
  interface CheckFinding {
768
796
  /** `error` means the connector will misbehave in Vorn; `warn` is advisory. */
769
797
  level: 'error' | 'warn';
@@ -852,31 +880,4 @@ declare function runConformance(connector: Connector, options?: CheckOptions): P
852
880
  /** Render findings for a terminal. Returns an empty string when all clear. */
853
881
  declare function formatFindings(findings: CheckFinding[]): string;
854
882
 
855
- /**
856
- * What a connector must be true of as a *package*, rather than as a definition.
857
- *
858
- * Both `check` and `pack` ask these questions — check to fail a pull request
859
- * early, pack to refuse an artifact — so they live here rather than in either,
860
- * and neither imports the other.
861
- */
862
- /** Largest pack Vorn will install, matched by the server's own verification. */
863
- declare const MAX_PACK_BYTES: number;
864
- interface BundleRequest {
865
- contents: string;
866
- resolveDir: string;
867
- }
868
- interface BundleOutput {
869
- code: string;
870
- /** Specifiers the bundler left for the runtime to resolve. */
871
- external: string[];
872
- }
873
- /** Reject a source package whose install would run code on the user's machine. */
874
- declare function lifecycleScriptFindings(pkg: unknown): CheckFinding[];
875
- /** Specifiers left outside a bundle, which would need a registry at launch. */
876
- declare function bundleDependencyFindings(external: string[]): CheckFinding[];
877
- /** Nearest package.json at or above a directory, or undefined when there is none. */
878
- declare function readNearestPackageJson(fromDir: string): Record<string, unknown> | undefined;
879
- /** The bundler `pack` uses, shared so `check` gates on the same answer. */
880
- declare function esbuildBundle(request: BundleRequest): Promise<BundleOutput>;
881
-
882
- export { type StatusSuggestion as $, type ActionRequest as A, type BundleRequest as B, type ConnectorDefinition as C, type DedupeStrategy as D, MAX_PACK_BYTES as E, type FetchContext as F, MAX_POLL_PAGES as G, type HarnessOptions as H, type MockCall as I, type MockRoute as J, MockRouteMissError as K, type MockRun as L, MANIFEST_TOOL as M, type NormalizedItem as N, OPTIONS_TOOL as O, type PollContext as P, type OptionsContext as Q, type OptionsLoader as R, PREFLIGHT_TOOL as S, type TriggerDefinition as T, type PaginationStrategy as U, type PollPage as V, type PreflightResult as W, type ResilientFetchOptions as X, type RetryPolicy as Y, type RunActionOptions as Z, type RunPollOptions as _, type BundleOutput as a, backoffMs as a0, bundleDependencyFindings as a1, checkConnector as a2, connectionSetup as a3, connectorManifest as a4, createConnectorHarness as a5, drainPoll as a6, esbuildBundle as a7, escapedMockHttp as a8, formatFindings as a9, lifecycleScriptFindings as aa, pollToolName as ab, readNearestPackageJson as ac, resilientFetch as ad, retryAfterMs as ae, runAction as af, runConformance as ag, runOptions as ah, runPoll as ai, withMockHttp as aj, type Connector as b, type ConnectorConfig as c, type PollOutcome as d, type ConnectorItem as e, type PostReceiveOp as f, type CheckFinding as g, type ActionContext as h, type ActionDefinition as i, type ActionInputField as j, type ActionInputOption as k, type ActionInputType as l, type ActionOutputField as m, type AuthRung as n, CHECK_OWNERS as o, type CheckCode as p, type CheckOptions as q, type ConformanceRun as r, type ConnectionSetup as s, type ConnectorAuth as t, type ConnectorConfigField as u, type ConnectorHarness as v, type ConnectorIcon as w, type ConnectorManifest as x, type ConnectorVerification as y, type DefaultWorkflow as z };
883
+ export { type StatusSuggestion as $, type ActionRequest as A, type BundleRequest as B, type CheckFinding as C, type DedupeStrategy as D, MAX_PACK_BYTES as E, type FetchContext as F, MAX_POLL_PAGES as G, type HarnessOptions as H, type MockCall as I, type MockRoute as J, MockRouteMissError as K, type MockRun as L, MANIFEST_TOOL as M, type NormalizedItem as N, OPTIONS_TOOL as O, type PollContext as P, type OptionsContext as Q, type OptionsLoader as R, PREFLIGHT_TOOL as S, type TriggerDefinition as T, type PaginationStrategy as U, type PollPage as V, type PreflightResult as W, type ResilientFetchOptions as X, type RetryPolicy as Y, type RunActionOptions as Z, type RunPollOptions as _, type BundleOutput as a, backoffMs as a0, bundleDependencyFindings as a1, bundledRequireFindings as a2, checkConnector as a3, connectionSetup as a4, connectorManifest as a5, createConnectorHarness as a6, drainPoll as a7, esbuildBundle as a8, escapedMockHttp as a9, formatFindings as aa, lifecycleScriptFindings as ab, pollToolName as ac, readNearestPackageJson as ad, resilientFetch as ae, retryAfterMs as af, runAction as ag, runConformance as ah, runOptions as ai, runPoll as aj, withMockHttp as ak, type ConnectorDefinition as b, type Connector as c, type ConnectorConfig as d, type PollOutcome as e, type ConnectorItem as f, type PostReceiveOp as g, type ActionContext as h, type ActionDefinition as i, type ActionInputField as j, type ActionInputOption as k, type ActionInputType as l, type ActionOutputField as m, type AuthRung as n, CHECK_OWNERS as o, type CheckCode as p, type CheckOptions as q, type ConformanceRun as r, type ConnectionSetup as s, type ConnectorAuth as t, type ConnectorConfigField as u, type ConnectorHarness as v, type ConnectorIcon as w, type ConnectorManifest as x, type ConnectorVerification as y, type DefaultWorkflow as z };