import { EngineService } from '../../engine'; import { ILogger } from '../../logger'; import { StoreService } from '../../store'; import { TelemetryService } from '../../telemetry'; import { ActivityData, ActivityLeg, ActivityMetadata, ActivityType } from '../../../types/activity'; import { ProviderClient, ProviderTransaction, TransactionResultList } from '../../../types/provider'; import { JobState, JobStatus } from '../../../types/job'; import { StringAnyType } from '../../../types/serializer'; import { StreamCode, StreamData, StreamStatus } from '../../../types/stream'; /** * Base class for every node in the workflow DAG. * * An activity's lifecycle flows top-to-bottom through this file: * enter → load state → map data → persist → transition → complete. * * Each section delegates to a purpose-specific module inside `activity/`. * Open the module when you need implementation detail; read this file * when you need the big picture. */ declare class Activity { config: ActivityType; data: ActivityData; hook: ActivityData; metadata: ActivityMetadata; /** @hidden */ store: StoreService; engine: EngineService; logger: ILogger; context: JobState; status: StreamStatus; code: StreamCode; leg: ActivityLeg; adjacencyList: StreamData[]; adjacentIndex: number; guidLedger: number; constructor(config: ActivityType, data: ActivityData, metadata: ActivityMetadata, hook: ActivityData | null, engine: EngineService, context?: JobState); /** Leg 1 entry for duplex activities (Worker, Await, Cycle) */ verifyEntry(): Promise; /** Leg 2 re-entry for duplex activities; returns the activity ledger */ verifyReentry(): Promise; /** Leg 1 entry for Category B (Hook passthrough, Signal, Interrupt-target). * Returns true when resuming from a prior crash (Leg1 already committed). */ verifyLeg1Entry(): Promise; /** Load job state from the store into `this.context` */ getState(): Promise; /** Bootstrap $self, $job refs and output.metadata.au timestamp */ initSelf(ctx: StringAnyType): JobState; /** Resolve expire and persistent policies from config */ initPolicies(ctx: JobState): void; /** Set the dimensional address for this activity */ initDimensionalAddress(dad: string): void; /** Reject stale messages from a prior job generation */ assertGenerationalId(jobGID: string, msgGID?: string): void; /** Map data INTO this activity (from other activities' outputs) */ mapInputData(): void; /** Transform this activity's own output via output.maps */ mapOutputData(): void; /** Promote activity data to the shared job state via job.maps */ mapJobData(): void; /** Resolve the Dynamic Activation Control threshold (default: 0) */ mapStatusThreshold(): number; /** Stamp job-level `ju` (job_updated) timestamp */ bindJobMetadata(): void; /** Stamp activity-level timestamps, type, and subtype */ bindActivityMetadata(): void; /** Flatten job-level context paths into store-ready key/values */ bindJobState(state: StringAnyType): Promise; /** Flatten activity-level context paths into store-ready key/values */ bindActivityState(state: StringAnyType): void; /** Write the dimensional address into the state payload */ bindDimensionalAddress(state: StringAnyType): void; /** Attach inbound data (output or hook) to the activity's context slot */ bindActivityData(type: 'output' | 'hook'): void; /** Attach an error response to the activity's context slot */ bindActivityError(data: Record): void; /** Promote an unhandled activity error to the job level */ bindJobError(data: Record): void; /** Persist the full activity + job state in a single store call */ setState(txn?: ProviderTransaction): Promise; /** Increment/decrement the job semaphore */ setStatus(amount: number, txn?: ProviderTransaction): Promise; /** Build the list of child activities to transition to */ filterAdjacent(): Promise; /** Current dimensional address (accounts for cycle offset) */ resolveDad(): string; /** Dimensional address for children (appends seed `,0`) */ resolveAdjacentDad(): string; /** Did the semaphore reach its threshold? (from transaction results) */ resolveThresholdHit(results: TransactionResultList): boolean; /** Extract the job status from the last transaction result */ resolveStatus(multi: TransactionResultList): number; /** Should this activity emit to the graph's publishes topic? */ shouldEmit(): boolean; /** Should this activity emit completion while keeping the job alive? */ shouldPersistJob(): boolean; isJobComplete(s: JobStatus): boolean; jobWasInterrupted(s: JobStatus): boolean; /** Leg 2 protocol: save → spawn → complete (duplex activities) */ executeStepProtocol(delta: number, shouldFinalize: boolean): Promise; /** Leg 1 protocol: save → spawn → complete (Category B activities) */ executeLeg1StepProtocol(delta: number): Promise; processEvent(status?: StreamStatus, code?: StreamCode, type?: 'hook' | 'output'): Promise; setLeg(leg: ActivityLeg): void; registerTimeout(): Promise; getJobStatus(): null | number; authorizeEntry(_state: StringAnyType): string[]; bindSearchData(_options?: any): void; bindMarkerData(_options?: any): void; /** Job metadata paths to persist (Trigger overrides with full JOB set) */ bindJobMetadataPaths(): string[]; /** Activity metadata paths to persist (Trigger overrides; leg-aware) */ bindActivityMetadataPaths(): string[]; getTriggerConfig(): Promise; handleProcessError(error: Error, telemetry: TelemetryService | undefined, label: string): void; } export { Activity, ActivityType };