@repogo/plugins 0.1.35 → 0.1.38

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.
@@ -0,0 +1,41 @@
1
+ import type { RunMetadata } from "./contracts";
2
+ import type { StepPolicy } from "./policy";
3
+ import { type JournalEvent, type JournalFailure, type JSONValue } from "./events";
4
+ export type StepState = {
5
+ status: "running" | "waiting" | "completed" | "failed" | "unknown";
6
+ attempt: number;
7
+ limit: number;
8
+ policy: StepPolicy;
9
+ result: JSONValue;
10
+ error: JournalFailure | null;
11
+ nextAttemptAt: string | null;
12
+ };
13
+ export type SleepState = {
14
+ status: "waiting" | "completed";
15
+ durationMs: number;
16
+ wakeAt: string;
17
+ };
18
+ export type RunState = {
19
+ version: 2;
20
+ lastSeq: number;
21
+ status: "pending" | "running" | "waiting" | "attention" | "completed" | "failed" | "cancelled" | "expired" | "unknown";
22
+ workflow: string | null;
23
+ input: JSONValue;
24
+ currentStep: string | null;
25
+ operationOrder: string[];
26
+ steps: Record<string, StepState>;
27
+ sleeps: Record<string, SleepState>;
28
+ result: JSONValue;
29
+ error: JournalFailure | null;
30
+ expiryReason: string | null;
31
+ deadlineAt: string | null;
32
+ /** The run's lifetime, which a restart starts again. */
33
+ timeoutMs: number | null;
34
+ cancelRequested: boolean;
35
+ updatedAt: string | null;
36
+ endedAt: string | null;
37
+ metadata: RunMetadata | null;
38
+ };
39
+ export declare function initialState(): RunState;
40
+ /** One reducer defines state both during execution and journal recovery. */
41
+ export declare function applyEvent(state: RunState, event: JournalEvent): RunState;
@@ -0,0 +1,22 @@
1
+ export declare const maxRecordBytes: number;
2
+ export declare const maxJournalBytes: number;
3
+ /** Storage methods resolve only after their writes have been flushed. */
4
+ export interface JournalStorage {
5
+ readEvents(): Promise<Uint8Array>;
6
+ append(record: Uint8Array): Promise<void>;
7
+ truncateEvents(bytes: number): Promise<void>;
8
+ replaceSnapshot(snapshot: string): Promise<void>;
9
+ close(): Promise<void>;
10
+ }
11
+ export declare class FileJournalStorage implements JournalStorage {
12
+ private directory;
13
+ private events;
14
+ private release;
15
+ private constructor();
16
+ static open(directory: string, create?: boolean): Promise<FileJournalStorage>;
17
+ readEvents(): Promise<Uint8Array>;
18
+ append(record: Uint8Array): Promise<void>;
19
+ truncateEvents(bytes: number): Promise<void>;
20
+ replaceSnapshot(snapshot: string): Promise<void>;
21
+ close(): Promise<void>;
22
+ }
@@ -0,0 +1,80 @@
1
+ import type { RunMetadata, RunSummary } from "./contracts";
2
+ import { type RunState } from "./state";
3
+ import type { JournalFailure, JSONValue } from "./events";
4
+ export declare function summarize(run: RunMetadata, state: RunState): RunSummary;
5
+ export declare const terminalStatuses: Set<string>;
6
+ export declare const activeStatuses: Set<string>;
7
+ /** Not finished: what Cancel all reaches, and what a deadline can still expire. */
8
+ export declare const openStatuses: Set<string>;
9
+ export declare function describe(state: RunState): {
10
+ error: {
11
+ message: string;
12
+ code?: string | undefined;
13
+ } | null;
14
+ input: unknown;
15
+ result: unknown;
16
+ resultTruncated: boolean;
17
+ inputTruncated: boolean;
18
+ expiryReason: string | null;
19
+ cancelRequested: boolean;
20
+ steps: ({
21
+ id: string;
22
+ kind: string;
23
+ status: "waiting" | "completed";
24
+ attempt: number;
25
+ attempts: number;
26
+ error: null;
27
+ nextAttemptAt: string | null;
28
+ durationMs: number;
29
+ } | {
30
+ id: string;
31
+ kind: string;
32
+ durationMs: null;
33
+ status: "running" | "failed" | "waiting" | "completed" | "unknown";
34
+ attempt: number;
35
+ attempts: number;
36
+ error: {
37
+ message: string;
38
+ code?: string | undefined;
39
+ } | null;
40
+ nextAttemptAt: string | null;
41
+ })[];
42
+ };
43
+ export declare function briefError(error: JournalFailure | null): {
44
+ message: string;
45
+ code?: string | undefined;
46
+ } | null;
47
+ export declare function unavailableDetail(input: JSONValue, error: string | null): {
48
+ error: {
49
+ message: string;
50
+ code?: string | undefined;
51
+ } | null;
52
+ input: unknown;
53
+ result: unknown;
54
+ resultTruncated: boolean;
55
+ inputTruncated: boolean;
56
+ expiryReason: string | null;
57
+ cancelRequested: boolean;
58
+ steps: ({
59
+ id: string;
60
+ kind: string;
61
+ status: "waiting" | "completed";
62
+ attempt: number;
63
+ attempts: number;
64
+ error: null;
65
+ nextAttemptAt: string | null;
66
+ durationMs: number;
67
+ } | {
68
+ id: string;
69
+ kind: string;
70
+ durationMs: null;
71
+ status: "running" | "failed" | "waiting" | "completed" | "unknown";
72
+ attempt: number;
73
+ attempts: number;
74
+ error: {
75
+ message: string;
76
+ code?: string | undefined;
77
+ } | null;
78
+ nextAttemptAt: string | null;
79
+ })[];
80
+ };
@@ -0,0 +1,12 @@
1
+ import "../self";
2
+ import type { TestCall, TestHost } from "../testing";
3
+ /** File-backed fixtures exercise the same pinned executors and durable storage as the host. */
4
+ export declare function testWorkflowRuntime(directory: string, options?: {
5
+ root?: string;
6
+ host?: TestHost;
7
+ }): Promise<{
8
+ call: (method: string, input?: unknown, call?: TestCall) => Promise<unknown>;
9
+ manifest: () => import("..").Manifest;
10
+ wait: (method: string, id: string, timeout?: number) => Promise<unknown>;
11
+ close: () => Promise<void>;
12
+ }>;