import { a as CredentialInputs, p as Primitive, t as AnyCredentialSet, u as ResolvedCredentials } from "./CredentialSet-lUr_8nN3.mjs"; import { c as AnyZodSchema, d as InputSchema, f as InputSchemaOrUndefined, l as InferSchema, p as JsonObject, u as InferSchemaOrUndefined } from "./schemas-DXcT2SRm.mjs"; import { M as Duration } from "./index-BqY2HTnE.mjs"; import { z } from "zod"; //#region src/artifacts/common.d.ts type SHA256Hash = string & { readonly __brand: 'SHA256Hash'; }; declare const RetryConfigSchema: z.ZodObject<{ constant: z.ZodOptional>; exponential: z.ZodOptional; multiplier: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>; type RetryConfig = z.infer; //#endregion //#region src/operation/schemas.d.ts declare const OperationManifestSchema: z.ZodObject<{ description: z.ZodString; id: z.ZodString; name: z.ZodString; needsApproval: z.ZodOptional; requiredOAuthScopes: z.ZodOptional>; retries: z.ZodOptional>; exponential: z.ZodOptional; multiplier: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>>; tags: z.ZodOptional>; timeout: z.ZodOptional>>; maxDurationMs: z.ZodOptional; manifestVersion: z.ZodLiteral<1>; type: z.ZodLiteral<"operation">; credentialSets: z.ZodArray; type: z.ZodLiteral<"credentialSet">; id: z.ZodString; name: z.ZodString; description: z.ZodOptional; auth: z.ZodType>; credentialType: z.ZodEnum<{ oauth: "oauth"; manual: "manual"; }>; exposure: z.ZodOptional>; proxy: z.ZodOptional>; hostPatterns: z.ZodOptional>; injection: z.ZodOptional; basicAuth: z.ZodOptional; queryParams: z.ZodOptional; body: z.ZodOptional; }, z.core.$strip>>; }, z.core.$strip>>; needsRawSecret: z.ZodOptional; }, z.core.$strip>>; input: z.ZodType>; output: z.ZodType>; workflowGlobals: z.ZodOptional>>; }, z.core.$strip>; type OperationManifest = z.infer; //#endregion //#region src/operation/types.d.ts type OperationCredentials = ResolvedCredentials; type OperationCredentialInputs = CredentialInputs; type OperationRuntimeContext = Record, TWorkflowGlobals = undefined> = Readonly<{ attempt?: number; credentials: Readonly; maxAttempts?: number; stepId?: string; toolCallId?: string; traceparent?: string; tracestate?: string; workflowGlobals: TWorkflowGlobals; }>; type OperationResolvedContext = OperationRuntimeContext, InferSchemaOrUndefined>; type OperationRunContext = Readonly<{ attempt?: number; credentials?: Readonly>>; maxAttempts?: number; stepId?: string; toolCallId?: string; traceparent?: string; tracestate?: string; workflowGlobals?: InputSchemaOrUndefined; }>; interface OperationConfig { /** * Credential sets the operation depends on at runtime. Uniqueness is enforced * at construction time via `assertUniqueCredentialSetIds` — duplicate raw ids * throw with a clear message. We avoid encoding uniqueness in the field type * because the deferred conditional (`AssertUniqueCredentialSetIds<...>`) does * not resolve when `TCredentialSets` is supplied through a generic factory, * and would force every wrapper to cast through `unknown`. */ readonly credentialSets?: TCredentialSets; readonly description: string; readonly id: string; readonly input: TInputSchema; readonly name: string; readonly needsApproval?: boolean; readonly output: TOutputSchema; readonly requiredOAuthScopes?: readonly string[]; readonly retries?: RetryConfig; readonly tags?: readonly string[]; readonly timeout?: Duration; /** * Upper bound on the operation's expected duration, in milliseconds. * * Informs the platform's proactive OAuth refresh — when a step with * `maxDurationMs: 15 * 60_000` runs against a token expiring in 10 * minutes, the credential coordinator refreshes before dispatch so the * step's own window has a valid token throughout. * * Omit for steps whose duration is unbounded by design (polling triggers, * human-in-the-loop) or trivially short (< 30s). Must be a positive * integer when set. * * @example new Step({ name: 'Upload large file', maxDurationMs: 15 * 60_000, ... }) */ readonly maxDurationMs?: number; readonly workflowGlobals?: TWorkflowGlobalsSchema; readonly run: (input: InferSchema, ctx: OperationResolvedContext) => Promise>; } type OperationInput = T extends Operation ? InputSchema : never; type OperationOutput = T extends Operation ? InferSchema : never; type OperationContextFor = T extends Operation ? OperationResolvedContext : never; type AnyOperation = Operation; //#endregion //#region src/operation/Operation.d.ts declare class Operation extends Primitive { #private; readonly kind: "operation"; readonly credentialSets: TCredentialSets; readonly description: string; readonly id: string; readonly input: TInputSchema; readonly name: string; readonly needsApproval?: boolean; readonly output: TOutputSchema; readonly requiredOAuthScopes?: readonly string[]; readonly retries?: RetryConfig; readonly tags: readonly string[]; readonly timeout?: Duration; /** * Upper bound on the operation's expected duration, in milliseconds. * See {@link OperationConfig.maxDurationMs}. */ readonly maxDurationMs?: number; readonly workflowGlobals?: TWorkflowGlobalsSchema; constructor(config: OperationConfig); withTimeout(duration: Duration): Operation; retry(policy: RetryConfig): Operation; configure(config: Readonly<{ description?: string; timeout?: Duration; retries?: RetryConfig; tags?: readonly string[]; needsApproval?: boolean; }>): Operation; getCredentialRequirements(): { credentialSetId: string; credentialType: "oauth" | "manual"; credentialKeys: string[]; optionalCredentialKeys?: string[] | undefined; storedCredentialKeys?: string[] | undefined; optionalStoredCredentialKeys?: string[] | undefined; schemaFingerprint?: string | undefined; needsDynamicResolution?: boolean | undefined; dynamicResolutionCacheMs?: number | undefined; onCredentialRevoked?: "fail" | "retry-once" | undefined; proxy?: { hosts?: string[] | undefined; hostPatterns?: string[] | undefined; injection?: { headers?: boolean | undefined; basicAuth?: boolean | undefined; queryParams?: boolean | undefined; body?: boolean | undefined; } | undefined; } | undefined; needsRawSecret?: boolean | undefined; requiredOAuthScopes?: string[] | undefined; }[]; /** @internal Used by the flow graph builder for nesting detection. */ getRunFunctionSource(): string; mapInput(schema: TNewInputSchema, fn: (input: InferSchema) => InferSchema): Operation; mapOutput(schema: TNewOutputSchema, fn: (output: InferSchema) => InferSchema): Operation; run(input: z.input, ctx?: OperationRunContext): Promise>; /** * Execute the step implementation directly, bypassing interceptors and * runtime checks. Used by the inline step execution runtime to avoid * recursion through handleStep. * @internal */ executeDirectly(input: z.input, ctx: OperationRunContext): Promise>; toManifest(): OperationManifest; } //#endregion export { OperationCredentialInputs as a, OperationOutput as c, OperationRuntimeContext as d, RetryConfig as f, OperationContextFor as i, OperationResolvedContext as l, SHA256Hash as m, AnyOperation as n, OperationCredentials as o, RetryConfigSchema as p, OperationConfig as r, OperationInput as s, Operation as t, OperationRunContext as u };