@vercel/factory 0.0.0

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,75 @@
1
+ import { T as Task, a as TaskId, F as FactoryStores, C as ChangeState, S as SignalOutcome, b as TaskState } from './engine-BXVTLiXU.js';
2
+ export { A as AppendReceiptInput, c as Change, d as ChangeEvidence, e as ChangeId, f as ChangePatch, g as ChangeTransitionOptions, h as Cost, i as CreateChangeInput, j as CreateSignalInput, k as CreateStoresOptions, l as CreateTaskInput, D as DecideSignalOptions, m as FactoryId, L as Level, R as Receipt, n as ReceiptId, o as ReceiptKind, p as ReceiptPhase, q as ReceiptState, r as Repository, s as RepositoryId, t as RepositorySlug, u as Signal, v as SignalId, w as SignalSource, x as TaskKind, y as TaskPatch, z as TaskTransitionOptions, B as changeEvidenceSchema, E as changeIdSchema, G as changeSchema, H as changeStateSchema, I as costSchema, J as createStores, K as factoryIdSchema, M as harnessSchema, N as levelSchema, O as receiptIdSchema, P as receiptKindSchema, Q as receiptPhaseSchema, U as receiptSchema, V as receiptStateSchema, W as repositoryIdSchema, X as repositoryIdsSchema, Y as repositorySchema, Z as repositorySlugSchema, _ as signalIdSchema, $ as signalOutcomeSchema, a0 as signalSchema, a1 as signalSourceSchema, a2 as standardReceiptKinds, a3 as standardReceiptPhases, a4 as standardReceiptStates, a5 as standardSignalSources, a6 as standardTaskKinds, a7 as taskDevboxSchema, a8 as taskIdSchema, a9 as taskKindSchema, aa as taskOriginSchema, ab as taskQuestionSchema, ac as taskSchema, ad as taskStateSchema } from './engine-BXVTLiXU.js';
3
+ import { z } from 'zod';
4
+ export { R as ReplyTo, S as SCHEMA_VERSION, i as isoDateTimeSchema, r as replyToSchema, s as schemaVersionSchema, u as usdSchema, v as vocabularySchema } from './common-CaHaEOAS.js';
5
+ import { S as StoreDriver } from './driver-tRNggCCJ.js';
6
+ export { C as CollectionName, R as RecordExistsError, a as RecordNotFoundError, b as StoredEntry, c as StoredRecord, V as VersionConflictError } from './driver-tRNggCCJ.js';
7
+
8
+ declare class DispatchRefusedError extends Error {
9
+ readonly taskId: TaskId;
10
+ readonly reason: string;
11
+ constructor(taskId: TaskId, reason: string);
12
+ }
13
+ interface DispatchOptions {
14
+ /**
15
+ * Starts the durable execution for the task (an Eve agent run). Runs after
16
+ * the task has won the queued -> running transition. The execution owns its
17
+ * own provisioning: it creates its Devbox as its first step and patches the
18
+ * task record with the result.
19
+ */
20
+ launch: (task: Task) => Promise<void>;
21
+ }
22
+ /**
23
+ * The handshake between recorded work and execution: win the store-gated
24
+ * transition (at most one dispatcher can succeed), then start the run. A
25
+ * launch failure moves the task to failed; a crash between the transition and
26
+ * the launch leaves a running task with no execution, which the sweep reaps.
27
+ */
28
+ declare function dispatchTask(stores: FactoryStores, taskId: TaskId, options: DispatchOptions): Promise<Task>;
29
+
30
+ declare const budgetMonthSchema: z.ZodString;
31
+ declare const budgetSchema: z.ZodObject<{
32
+ schemaVersion: z.ZodLiteral<1>;
33
+ factoryId: z.ZodString;
34
+ month: z.ZodString;
35
+ limits: z.ZodObject<{
36
+ totalUsd: z.ZodNumber;
37
+ investigationUsd: z.ZodNumber;
38
+ perTaskReservationUsd: z.ZodNumber;
39
+ warningPercent: z.ZodNumber;
40
+ perRepositoryUsd: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
41
+ }, z.core.$strict>;
42
+ notices: z.ZodObject<{
43
+ warningAt: z.ZodOptional<z.ZodISODateTime>;
44
+ exhaustedAt: z.ZodOptional<z.ZodISODateTime>;
45
+ }, z.core.$strict>;
46
+ }, z.core.$strict>;
47
+ type Budget = z.infer<typeof budgetSchema>;
48
+
49
+ type TransitionActor = "system" | "reconciler" | "foreman" | "operator" | "webhook" | "human";
50
+ interface Transition<State extends string> {
51
+ readonly from: State;
52
+ readonly to: State;
53
+ readonly trigger: string;
54
+ readonly actor: TransitionActor;
55
+ }
56
+ declare const taskInitialState = "queued";
57
+ declare const taskTransitions: readonly Transition<TaskState>[];
58
+ declare const changeInitialState = "verifying";
59
+ declare const changeTransitions: readonly Transition<ChangeState>[];
60
+ declare const signalInitialOutcome = "pending";
61
+ declare const signalOutcomeTransitions: readonly Transition<SignalOutcome>[];
62
+ declare function isTransitionAllowed<State extends string>(transitions: readonly Transition<State>[], from: State, to: State): boolean;
63
+ declare function legalNextStates<State extends string>(transitions: readonly Transition<State>[], from: State): readonly State[];
64
+ declare class InvalidTransitionError<State extends string> extends Error {
65
+ readonly from: State;
66
+ readonly to: State;
67
+ readonly legalNextStates: readonly State[];
68
+ constructor(from: State, to: State, legal: readonly State[]);
69
+ }
70
+ declare function assertTransition<State extends string>(transitions: readonly Transition<State>[], from: State, to: State): void;
71
+ declare function terminalStates<State extends string>(transitions: readonly Transition<State>[]): readonly State[];
72
+
73
+ declare function createInMemoryDriver(): StoreDriver;
74
+
75
+ export { type Budget, ChangeState, type DispatchOptions, DispatchRefusedError, FactoryStores, InvalidTransitionError, SignalOutcome, StoreDriver, Task, TaskId, TaskState, type Transition, type TransitionActor, assertTransition, budgetMonthSchema, budgetSchema, changeInitialState, changeTransitions, createInMemoryDriver, dispatchTask, isTransitionAllowed, legalNextStates, signalInitialOutcome, signalOutcomeTransitions, taskInitialState, taskTransitions, terminalStates };