runline 0.2.2 → 0.3.1

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.
@@ -23,6 +23,51 @@ export interface ActionContext {
23
23
  warn(msg: string): void;
24
24
  error(msg: string): void;
25
25
  };
26
+ /**
27
+ * Merge a partial config patch into the current connection,
28
+ * persisting it atomically to `.runline/config.json`.
29
+ *
30
+ * Intended for plugins that refresh credentials at runtime
31
+ * (OAuth access tokens, rotating API keys). The write is
32
+ * guarded by a file lock, so concurrent `runline exec`
33
+ * processes refreshing the same connection won't race.
34
+ *
35
+ * In-memory `ctx.connection.config` is also mutated so the
36
+ * rest of the current action sees the new values.
37
+ */
38
+ updateConnection(patch: Record<string, unknown>): Promise<void>;
39
+ }
40
+ /**
41
+ * OAuth2 authorization-code configuration declared by a plugin.
42
+ * Consumed by the generic `runline auth <plugin>` flow, which
43
+ * handles the browser redirect, code exchange, and persistence
44
+ * of `clientId`, `clientSecret`, `refreshToken`, `accessToken`,
45
+ * and `accessTokenExpiresAt` into the plugin's connection.
46
+ */
47
+ export interface OAuthConfig {
48
+ /** Authorization endpoint, e.g. https://accounts.google.com/o/oauth2/v2/auth */
49
+ authUrl: string;
50
+ /** Token endpoint, e.g. https://oauth2.googleapis.com/token */
51
+ tokenUrl: string;
52
+ /** Scopes to request on the consent screen. */
53
+ scopes: string[];
54
+ /**
55
+ * Extra query parameters on the auth URL. Used for provider-
56
+ * specific knobs like Google's `access_type=offline` and
57
+ * `prompt=consent` (both required to get a refresh token back).
58
+ */
59
+ authParams?: Record<string, string>;
60
+ /**
61
+ * Printed by `runline auth <plugin>` before credentials are
62
+ * requested. Each array entry is a line. The token
63
+ * `{{redirectUri}}` is substituted with the actual callback URL
64
+ * the plugin will use, so users can register it verbatim with
65
+ * the provider (e.g. in Google Cloud Console).
66
+ *
67
+ * Omit for plugins where client credentials come from the
68
+ * provider's partner program and no user setup is needed.
69
+ */
70
+ setupHelp?: string[];
26
71
  }
27
72
  export interface PluginDef {
28
73
  name: string;
@@ -35,6 +80,8 @@ export interface PluginDef {
35
80
  default?: unknown;
36
81
  env?: string;
37
82
  }>;
83
+ /** OAuth2 config for `runline auth <plugin>`. */
84
+ oauth?: OAuthConfig;
38
85
  /** @internal */
39
86
  initHooks?: Array<(config: Record<string, unknown>) => void>;
40
87
  }