Files
openclaw/scripts/lib/actions-artifact-archive.d.mts
Peter Steinberger 2e2366b6d3 chore(tooling): typecheck scripts/** with a dedicated tsgo lane (#104348)
* feat(tooling): add tsgo typecheck lane for scripts/**

* fix(scripts): burn down scripts type debt surfaced by the new lane

Typing-only except bugs the lane surfaced: gh-read timeout race,
Discord Headers spread dropping entries, undefined allowedHeadBranches
match, plugin-boundary matchAll crash. Deletes retired config keys from
fixtures/benches (prompt snapshots regenerated, config dump only) and
the orphaned non-runnable sync-moonshot-docs script. Adds full-surface
.d.mts declarations for existing .mjs boundaries.
2026-07-11 02:31:17 -07:00

95 lines
2.8 KiB
TypeScript

export const ACTIONS_ARTIFACT_API_VERSION: "2026-03-10";
export const DEFAULT_MAX_ACTIONS_ARTIFACT_BYTES: number;
export const DEFAULT_MAX_ACTIONS_ARTIFACT_EXPANDED_BYTES: number;
export type ArtifactArchivePolicy = {
expectedEntries?: readonly string[];
minEntries?: number;
maxEntries?: number;
maxArchiveBytes?: number;
maxExpandedBytes?: number;
rejectCaseFoldAliases?: boolean;
allowPath?: (name: string) => boolean;
maxCompressedEntryBytes?: (name: string) => number;
maxEntryBytes: (name: string) => number;
};
export type ArtifactBinding = {
artifactDigest: string;
artifactId: number;
artifactName: string;
artifactSizeBytes: number;
repository: string;
runStatePolicy: "completed-success" | "same-run-producer-success";
runAttempt: number;
runId: number;
workflowEvent: string;
workflowHeadBranch: string;
workflowPath: string;
workflowSha: string;
consumerRunAttempt?: number;
producerJobName?: string;
};
export type ArtifactFileDescription = {
path: string;
sha256: string;
sizeBytes: number;
};
type ArtifactDownloadParams = {
expected: ArtifactBinding;
fetchImpl?: typeof fetch;
maxArchiveBytes?: number;
retryAttempts?: number;
retryDelayMs?: number;
timeoutMs?: number;
token: string;
};
type ArtifactDownloadResult = {
archiveBytes: Uint8Array;
artifactMetadata: Record<string, unknown>;
binding: ArtifactBinding;
workflowJobs: Record<string, unknown> | undefined;
workflowRun: Record<string, unknown>;
};
export function sha256Digest(bytes: Uint8Array): string;
export function describeActionsArtifactFiles(
files: Map<string, Uint8Array>,
): ArtifactFileDescription[];
export function readBoundedRegularFile(
path: string,
params: { label: string; maxBytes: number },
): Buffer;
export function inspectActionsArtifactZipWithPolicy(
inputBytes: Uint8Array,
inputPolicy: ArtifactArchivePolicy,
): Map<string, Buffer>;
export function inspectActionsArtifactZip(
bytes: Uint8Array,
expectedEntries?: number | readonly string[],
limits?: {
maxArchiveBytes?: number;
maxExpandedBytes?: number;
maxCompressedEntryBytes?: number;
maxEntryBytes?: number;
},
): Map<string, Buffer>;
export function validateActionsArtifactBinding(params: {
artifactMetadata: unknown;
expected: ArtifactBinding;
workflowRun: unknown;
}): ArtifactBinding;
export function validateActionsArtifactProducerJob(params: {
expected: ArtifactBinding;
workflowJobs: unknown;
}): ArtifactBinding;
export function downloadActionsArtifactArchive(
params: ArtifactDownloadParams,
): Promise<ArtifactDownloadResult>;
export function readPublicationArtifactArchive(
params: ArtifactDownloadParams & { archivePolicy: ArtifactArchivePolicy },
): Promise<ArtifactDownloadResult & { files: Map<string, Buffer> }>;