@nagi-js/core 0.1.1-rc.17 → 0.1.1-rc.18

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/dist/index.d.ts CHANGED
@@ -291,7 +291,6 @@ interface StepConfigBase<Input, N extends NeedsMap> {
291
291
  readonly input: NoInfer<Input>;
292
292
  readonly needs: NoInfer<ResolvedNeeds<N>>;
293
293
  }) => boolean;
294
- readonly timeoutMs?: Millis;
295
294
  }
296
295
  interface StepLifecycleHooks<Output> {
297
296
  readonly onStart?: (event: StepStartEvent) => void | Promise<void>;
@@ -328,6 +327,7 @@ interface StreamingTaskConfig<Input, N extends NeedsMap, Output, Chunk> extends
328
327
  interface SignalConfig<Input, N extends NeedsMap, Schema extends StandardSchemaV1> extends StepConfigBase<Input, N> {
329
328
  readonly schema: Schema;
330
329
  readonly names?: readonly [string, ...string[]];
330
+ readonly timeoutMs: Millis | "unbounded";
331
331
  }
332
332
  interface MatchArmGuard<Input, N extends NeedsMap, M extends StepMap> {
333
333
  readonly when: (args: {
@@ -483,7 +483,16 @@ interface WorkerConfig {
483
483
  readonly pollIntervalMs?: Millis;
484
484
  readonly signal?: AbortSignal;
485
485
  readonly timerSweepIntervalMs?: Millis;
486
+ readonly snapshotGonePolicy?: SnapshotGonePolicy;
487
+ readonly maxConcurrencyPerFlow?: number;
486
488
  }
489
+ type SnapshotGoneDisposition = {
490
+ readonly action: "retry";
491
+ readonly delayMs: Millis;
492
+ } | {
493
+ readonly action: "fail";
494
+ };
495
+ type SnapshotGonePolicy = (readCount: number) => SnapshotGoneDisposition;
487
496
  interface WorkerRunOnceOpts {
488
497
  readonly maxSteps?: number;
489
498
  }
@@ -642,6 +651,8 @@ interface QueueMessage {
642
651
  readonly stepId: StepId;
643
652
  readonly payload: Json;
644
653
  readonly attempt: AttemptNumber;
654
+ readonly readCount: number;
655
+ readonly flowId?: string;
645
656
  }
646
657
  interface QueueDequeueOpts {
647
658
  readonly count: number;
@@ -650,6 +661,13 @@ interface QueueEnqueueOpts {
650
661
  readonly attempt?: AttemptNumber;
651
662
  readonly delayMs?: Millis;
652
663
  readonly payload?: Json;
664
+ readonly flowId?: string;
665
+ }
666
+ interface QueueInspectEntry {
667
+ readonly stepId: StepId;
668
+ readonly attempt: AttemptNumber;
669
+ readonly readCount: number;
670
+ readonly visibleAt: Date;
653
671
  }
654
672
  interface Queue {
655
673
  enqueue(runId: RunId$1, stepId: StepId, opts?: QueueEnqueueOpts): Promise<void>;
@@ -660,6 +678,7 @@ interface Queue {
660
678
  }): Promise<void>;
661
679
  extend(receipt: string, leaseMs: Millis): Promise<void>;
662
680
  ensureSchema?(): Promise<void>;
681
+ inspect?(runId: RunId$1): Promise<readonly QueueInspectEntry[]>;
663
682
  }
664
683
  interface Clock {
665
684
  now(): Date;
@@ -896,6 +915,11 @@ declare class NagiValidationError extends Error {
896
915
  declare class NagiRuntimeError extends Error {
897
916
  constructor(message: string);
898
917
  }
918
+ declare class NagiNonRetryableError extends Error {
919
+ constructor(message: string, opts?: {
920
+ readonly cause?: unknown;
921
+ });
922
+ }
899
923
  declare class NagiCanceledError extends Error {
900
924
  readonly runId: RunId$1;
901
925
  readonly canceledByRunId: RunId$1;
@@ -961,6 +985,7 @@ declare class InMemoryStore implements Store, StreamTransport {
961
985
  private readonly globalFacts;
962
986
  private readonly activeByKey;
963
987
  private readonly keyByActiveRun;
988
+ private readonly slotByRun;
964
989
  private readonly childrenByParent;
965
990
  private readonly summaries;
966
991
  private readonly streamHub;
@@ -1056,6 +1081,7 @@ declare class InMemoryQueue implements Queue {
1056
1081
  delayMs?: Millis;
1057
1082
  }): Promise<void>;
1058
1083
  extend(receipt: string, leaseMs: Millis): Promise<void>;
1084
+ inspect(runId: RunId$1): Promise<readonly QueueInspectEntry[]>;
1059
1085
  }
1060
1086
  interface InMemoryClockOpts {
1061
1087
  readonly trigger?: InMemoryTrigger;
@@ -1094,6 +1120,7 @@ interface NagiConfig {
1094
1120
  readonly codeVersion?: string;
1095
1121
  readonly heartbeatIntervalMs?: Millis;
1096
1122
  readonly heartbeatLeaseMs?: Millis;
1123
+ readonly leaseHoldWarnMs?: Millis;
1097
1124
  readonly reaperIntervalMs?: Millis;
1098
1125
  }
1099
1126
  interface StartOpts {
@@ -1126,6 +1153,7 @@ interface Wf<TFlows extends ReadonlyArray<Flow> = ReadonlyArray<Flow>> {
1126
1153
  replay(runId: RunId$1, opts?: ReplayOpts): Promise<void>;
1127
1154
  queryRuns(opts?: QueryRunsOpts<FlowIdOf<TFlows>>): Promise<QueryRunsResult<FlowIdOf<TFlows>>>;
1128
1155
  describe(runId: RunId$1): Promise<RunDescription>;
1156
+ inspectQueue(runId: RunId$1): Promise<readonly QueueInspectEntry[]>;
1129
1157
  subscribe<C = Json>(runId: RunId$1, stepId: StepId, opts?: {
1130
1158
  readonly replayBuffered?: boolean;
1131
1159
  }): AsyncIterable<StreamEvent<C>>;
@@ -1193,4 +1221,6 @@ declare class NagiAbortError extends Error {
1193
1221
  constructor(runId: RunId$1, kind: "run" | "step");
1194
1222
  }
1195
1223
 
1196
- export { type Anomaly, type AttemptNumber, type BackoffStrategy, type Builder, type CancelArgs, type CanonicalDag, type CanonicalMatchArm, type CanonicalRetryPolicy, type CanonicalSchema, type CanonicalStep, type ClaimToken, type Clock, type ConcurrencyMode, DEFAULT_REAPER_INTERVAL_MS, type Fact, type FactKind, type Flow, type FlowCanceledByConcurrencyFact, type FlowCanceledByOperatorFact, type FlowCanceledExplicitlyFact, type FlowCanceledFact, type FlowCompleteEvent, type FlowCompletedFact, type FlowConcurrency, type FlowConfig, type FlowErrorEvent, type FlowEvent, type FlowFailedFact, type FlowHooks, type FlowIdOf, type FlowInput, type FlowOutput, type FlowRefUpdatedFact, type FlowStartEvent, type FlowStartedFact, type GlobalFact, InMemoryClock, InMemoryQueue, InMemoryStore, InMemoryTrigger, type InferSchemaInput, type InferSchemaOutput, type Json, type LeaseReapedFact, type LogEntry, type LogLevel, type Logger, type MatchArm, type MatchArmGuard, type MatchArmOtherwise, type MatchArmOutput, type MatchArmSelectedFact, type MatchArmShape, type MatchGuardConfig, type Millis, NagiAbortError, NagiCanceledError, NagiConcurrencyConflictError, type NagiConfig, NagiFlowSnapshotGoneError, type NagiRunConfig, NagiRuntimeError, NagiSignalTimeoutError, NagiSnapshotDriftError, NagiValidationError, type NeedRef, type NeedsMap, type NeedsOutputs, type OnceRecordedFact, type Operator, type OperatorAuditOpts, type Optional, type ParentLink, type ParentRef, type PrunableStatus, type PruneOpts, type PruneResult, type QueryRunsOpts, type QueryRunsResult, type QueryRunsWhere, type Queue, type QueueDequeueOpts, type QueueEnqueueOpts, type QueueMessage, type ReapedLease, type ReaperDecision, type Register, type ReplayMode, type ReplayOpts, type Resolved, type ResolvedConcurrency, type ResolvedNeeds, type RetryPolicy, type RunCancelCause, type RunDescription, RunId, type RunPhase, type RunState, type RunStatus, type RunSummary, type RunView, type RuntimeHandle, type SerializedError, type SettleSignalResult, type SignalBufferedFact, type SignalConfig, type SignalDecision, type SignalReceivedEvent, type SignalReceivedFact, type SignalSentEvent, type SignalSentFact, type SkipReason, type SnapshotChangedEdge, type SnapshotChangedField, type SnapshotDiff, StandardSchemaV1, type StartOpts, type StartStagedOpts, type StartStagedResult, type Step, type StepAbortRequestedFact, type StepCancelCause, type StepCanceledFact, type StepCompleteEvent, type StepCompletedFact, type StepCtx, type StepErrorEvent, type StepEvent, type StepFailedFact, type StepId, type StepKind, type StepMap, type StepOutput, type StepResetFact, type StepRetriedFact, type StepRetryEvent, type StepRunStatus, type StepSkippedFact, type StepStartEvent, type StepStartedFact, type StepState, type StepStatus, type StepView, type Store, type StreamEvent, type StreamTransport, type StreamingStepCtx, type StreamingTaskConfig, type StringKeyOf, type SubflowConfig, type SubflowStepOutput, type TaskConfig, type TimedOutSignal, type TimeoutDecision, type Trigger, type Tx, type Wf, type Worker, type WorkerConfig, type WorkerRunOnceOpts, type WorkerRunResult, type WorkerRunUntilEmptyOpts, attemptOf, canonicalize, decideExpiredLeaseAction, decideSignal, decideTimeout, diffSnapshots, errorOf, fingerprintFlows, flow, isStepTerminal, isTerminalRun, nagi, optional, outputOf, foldRun as projectRunState, resolvedOf, runStatusOf, sha256Canonical, stepStateOf, stepStatusOf, unwrap };
1224
+ declare const defaultSnapshotGonePolicy: SnapshotGonePolicy;
1225
+
1226
+ export { type Anomaly, type AttemptNumber, type BackoffStrategy, type Builder, type CancelArgs, type CanonicalDag, type CanonicalMatchArm, type CanonicalRetryPolicy, type CanonicalSchema, type CanonicalStep, type ClaimToken, type Clock, type ConcurrencyMode, DEFAULT_REAPER_INTERVAL_MS, type Fact, type FactKind, type Flow, type FlowCanceledByConcurrencyFact, type FlowCanceledByOperatorFact, type FlowCanceledExplicitlyFact, type FlowCanceledFact, type FlowCompleteEvent, type FlowCompletedFact, type FlowConcurrency, type FlowConfig, type FlowErrorEvent, type FlowEvent, type FlowFailedFact, type FlowHooks, type FlowIdOf, type FlowInput, type FlowOutput, type FlowRefUpdatedFact, type FlowStartEvent, type FlowStartedFact, type GlobalFact, InMemoryClock, InMemoryQueue, InMemoryStore, InMemoryTrigger, type InferSchemaInput, type InferSchemaOutput, type Json, type LeaseReapedFact, type LogEntry, type LogLevel, type Logger, type MatchArm, type MatchArmGuard, type MatchArmOtherwise, type MatchArmOutput, type MatchArmSelectedFact, type MatchArmShape, type MatchGuardConfig, type Millis, NagiAbortError, NagiCanceledError, NagiConcurrencyConflictError, type NagiConfig, NagiFlowSnapshotGoneError, NagiNonRetryableError, type NagiRunConfig, NagiRuntimeError, NagiSignalTimeoutError, NagiSnapshotDriftError, NagiValidationError, type NeedRef, type NeedsMap, type NeedsOutputs, type OnceRecordedFact, type Operator, type OperatorAuditOpts, type Optional, type ParentLink, type ParentRef, type PrunableStatus, type PruneOpts, type PruneResult, type QueryRunsOpts, type QueryRunsResult, type QueryRunsWhere, type Queue, type QueueDequeueOpts, type QueueEnqueueOpts, type QueueInspectEntry, type QueueMessage, type ReapedLease, type ReaperDecision, type Register, type ReplayMode, type ReplayOpts, type Resolved, type ResolvedConcurrency, type ResolvedNeeds, type RetryPolicy, type RunCancelCause, type RunDescription, RunId, type RunPhase, type RunState, type RunStatus, type RunSummary, type RunView, type RuntimeHandle, type SerializedError, type SettleSignalResult, type SignalBufferedFact, type SignalConfig, type SignalDecision, type SignalReceivedEvent, type SignalReceivedFact, type SignalSentEvent, type SignalSentFact, type SkipReason, type SnapshotChangedEdge, type SnapshotChangedField, type SnapshotDiff, type SnapshotGoneDisposition, type SnapshotGonePolicy, StandardSchemaV1, type StartOpts, type StartStagedOpts, type StartStagedResult, type Step, type StepAbortRequestedFact, type StepCancelCause, type StepCanceledFact, type StepCompleteEvent, type StepCompletedFact, type StepCtx, type StepErrorEvent, type StepEvent, type StepFailedFact, type StepId, type StepKind, type StepMap, type StepOutput, type StepResetFact, type StepRetriedFact, type StepRetryEvent, type StepRunStatus, type StepSkippedFact, type StepStartEvent, type StepStartedFact, type StepState, type StepStatus, type StepView, type Store, type StreamEvent, type StreamTransport, type StreamingStepCtx, type StreamingTaskConfig, type StringKeyOf, type SubflowConfig, type SubflowStepOutput, type TaskConfig, type TimedOutSignal, type TimeoutDecision, type Trigger, type Tx, type Wf, type Worker, type WorkerConfig, type WorkerRunOnceOpts, type WorkerRunResult, type WorkerRunUntilEmptyOpts, attemptOf, canonicalize, decideExpiredLeaseAction, decideSignal, decideTimeout, defaultSnapshotGonePolicy, diffSnapshots, errorOf, fingerprintFlows, flow, isStepTerminal, isTerminalRun, nagi, optional, outputOf, foldRun as projectRunState, resolvedOf, runStatusOf, sha256Canonical, stepStateOf, stepStatusOf, unwrap };