@vite-hub/presets 0.0.0 → 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.
- package/LICENSE +201 -0
- package/README.md +415 -0
- package/dist/babysitter/server.d.ts +94 -0
- package/dist/babysitter/server.js +2 -0
- package/dist/babysitter-C71pgjkv.js +2487 -0
- package/dist/babysitter.d.ts +419 -0
- package/dist/babysitter.js +2 -0
- package/dist/error-diagnostics-BTBW9sZx.js +725 -0
- package/dist/host-Dsi6saqi.js +724 -0
- package/dist/labeller.d.ts +93 -0
- package/dist/labeller.js +289 -0
- package/dist/pr-workspaces-CjX3PSqM.d.ts +923 -0
- package/dist/server-CIgjUG63.js +11637 -0
- package/dist/workspace.d.ts +6 -0
- package/dist/workspace.js +13 -0
- package/package.json +93 -4
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { C as createGitHubAppCredentials, S as GitHubHostSecret, _ as GitHubHostCredentials, a as BabysitterAdmissionResult, b as GitHubHostPullRequest, c as PullRequestInboxStorage, d as GitHubHost, f as GitHubHostAccess, g as GitHubHostCredentialContext, h as GitHubHostCheckoutOptions, m as GitHubHostCheckout, n as PullRequestWorkspaces, o as PullRequestInbox, p as GitHubHostAccessOptions, u as GitHubAppEnvironment, v as GitHubHostForgeOptions, w as createGitHubHost, x as GitHubHostRateLimit, y as GitHubHostOptions } from "../pr-workspaces-CjX3PSqM.js";
|
|
2
|
+
import { AgentInput } from "@vite-hub/agent";
|
|
3
|
+
import { GitHubAppRepository } from "@vite-hub/forge";
|
|
4
|
+
import { ProcessReconcilerRunContext } from "@vite-hub/runtime/internal/node";
|
|
5
|
+
//#region src/babysitter/repositories.d.ts
|
|
6
|
+
/** The repositories that one Babysitter serves, as lowercase `owner/name`. */
|
|
7
|
+
interface BabysitterRepositories {
|
|
8
|
+
/** `"allow"` for `filter.repository.allow`, `"installations"` for every repository the GitHub App can access. */
|
|
9
|
+
readonly source: "allow" | "installations";
|
|
10
|
+
/** The list without a GitHub read. */
|
|
11
|
+
known(): readonly string[];
|
|
12
|
+
/** The list, read again from the App installations when it is stale. A failed read keeps the last list and rejects. */
|
|
13
|
+
current(): Promise<readonly string[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Notes a signed delivery. Installation events update the list and make it stale. An event from a
|
|
16
|
+
* repository the list does not have yet adds it, because GitHub sends only events of installed repositories.
|
|
17
|
+
* Returns whether the list changed.
|
|
18
|
+
*/
|
|
19
|
+
observe(event: string, payload: unknown): boolean;
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region src/babysitter/server.d.ts
|
|
23
|
+
export interface BabysitterRuntimeOptions {
|
|
24
|
+
agent: AgentInput;
|
|
25
|
+
/** Discovered Agent name for per-Agent public URLs. Defaults to the definition name. */
|
|
26
|
+
agentName?: string;
|
|
27
|
+
github: GitHubHost;
|
|
28
|
+
/** Private `node:sqlite` inbox file. Set this or `inboxStorage`. */
|
|
29
|
+
inboxPath?: string;
|
|
30
|
+
/** Inbox tables in shared SQL storage, for example `agentState.extension("babysitter")`. */
|
|
31
|
+
inboxStorage?: PullRequestInboxStorage;
|
|
32
|
+
/** Separates this Agent's inbox in shared storage. Defaults to the Agent name. */
|
|
33
|
+
inboxScope?: string;
|
|
34
|
+
/**
|
|
35
|
+
* Repositories to discover and serve: a fixed list, or a source such as every repository of the
|
|
36
|
+
* GitHub App installations, which each reconcile reads again.
|
|
37
|
+
*/
|
|
38
|
+
repositories: readonly string[] | BabysitterRepositories;
|
|
39
|
+
concurrency: number;
|
|
40
|
+
/** Public Console origin. Defaults to `vitehub({ publicUrl })`. */
|
|
41
|
+
publicUrl?: string;
|
|
42
|
+
event?: (name: string, properties: Record<string, unknown>) => void;
|
|
43
|
+
error?: (name: string, error: unknown, properties: Record<string, unknown>) => void;
|
|
44
|
+
wake?: () => void;
|
|
45
|
+
/** GitHub logins whose marked comments are emitted by this host. */
|
|
46
|
+
activityAuthors: readonly string[];
|
|
47
|
+
/** How long a pass may continue after a repair push. Defaults to 3 minutes. */
|
|
48
|
+
postPushGraceMs?: number;
|
|
49
|
+
/** Delay between provider rate-limit retries. Defaults to 10 seconds. */
|
|
50
|
+
providerRetryDelayMs?: number;
|
|
51
|
+
/** Delay between live reads while GitHub computes mergeability before a direct merge. Defaults to 3 seconds. */
|
|
52
|
+
mergeabilityRetryDelayMs?: number;
|
|
53
|
+
admission?: () => Promise<Pick<BabysitterAdmissionResult, "accepting" | "hostOnly" | "reason" | "retryAt" | "detail">>;
|
|
54
|
+
/**
|
|
55
|
+
* Samples memory and pressure for work that runs like a worker before the model starts, such as the
|
|
56
|
+
* merge and install of a conflicting PR. `active` counts the worker passes and preparations already
|
|
57
|
+
* running; a `concurrency` above it admits one more. Without it, that work is not gated.
|
|
58
|
+
*/
|
|
59
|
+
hostCapacity?: (context: {
|
|
60
|
+
active: number;
|
|
61
|
+
signal: AbortSignal;
|
|
62
|
+
}) => Promise<{
|
|
63
|
+
concurrency: number;
|
|
64
|
+
reason?: string;
|
|
65
|
+
}>;
|
|
66
|
+
/** One kept workspace per open PR. Without it, each pass clones and installs into temporary directories. */
|
|
67
|
+
workspaces?: PullRequestWorkspaces;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* GitHub settles most asynchronous merges in seconds, so poll a pending request less often as it ages:
|
|
71
|
+
* after 30 seconds at first, then after as long as it has been pending, at most every five minutes.
|
|
72
|
+
* vite-hub/vitehub#3350 was polled every 30 seconds for 19 hours.
|
|
73
|
+
*/
|
|
74
|
+
export declare function pendingMergeRetryAt(startedAt: number, now: number): number;
|
|
75
|
+
/** Provider quota and rate-limit failures. Cancellation is never a rate limit. */
|
|
76
|
+
export declare function isProviderRateLimit(error: unknown): boolean;
|
|
77
|
+
/** Own one durable PR inbox and its repair passes inside a process host. */
|
|
78
|
+
export interface BabysitterRuntime {
|
|
79
|
+
inbox: PullRequestInbox;
|
|
80
|
+
/** The repositories this runtime discovers and serves. */
|
|
81
|
+
repositories: BabysitterRepositories;
|
|
82
|
+
reconcile(reason: string, context: ProcessReconcilerRunContext, accepting?: () => boolean): Promise<void>;
|
|
83
|
+
workload(): {
|
|
84
|
+
running: number;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Makes the next reconcile check the default branch of the delivery's repository when the delivery
|
|
88
|
+
* is a failed push run of a watched workflow there. Returns whether it did.
|
|
89
|
+
*/
|
|
90
|
+
observeMainRepair(event: string, payload: unknown): Promise<boolean>;
|
|
91
|
+
}
|
|
92
|
+
export declare function createBabysitterRuntime(options: BabysitterRuntimeOptions): BabysitterRuntime;
|
|
93
|
+
//#endregion
|
|
94
|
+
export { type GitHubAppEnvironment, type GitHubHost, type GitHubHostAccess, type GitHubHostAccessOptions, type GitHubHostCheckout, type GitHubHostCheckoutOptions, type GitHubHostCredentialContext, type GitHubHostCredentials, type GitHubHostForgeOptions, type GitHubHostOptions, type GitHubHostPullRequest, type GitHubHostRateLimit, type GitHubHostSecret, type PullRequestInboxStorage, createGitHubAppCredentials, createGitHubHost };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { n as isProviderRateLimit, o as createGitHubAppCredentials, r as pendingMergeRetryAt, s as createGitHubHost, t as createBabysitterRuntime } from "../server-CIgjUG63.js";
|
|
2
|
+
export { createBabysitterRuntime, createGitHubAppCredentials, createGitHubHost, isProviderRateLimit, pendingMergeRetryAt };
|