deepline 0.1.83 → 0.1.85

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.mts CHANGED
@@ -46,7 +46,7 @@ interface PlaySheetContractSnapshot {
46
46
  tableNamespace: string;
47
47
  columns: PlaySheetColumnContractSnapshot[];
48
48
  }
49
- type PlayStaticColumnProducerKindSnapshot = 'tool' | 'waterfall' | 'stepProgram' | 'playCall' | 'transform';
49
+ type PlayStaticColumnProducerKindSnapshot = 'tool' | 'waterfall' | 'stepProgram' | 'playCall' | 'controlFlow' | 'transform';
50
50
  interface PlayStaticColumnProducerSnapshot {
51
51
  id: string;
52
52
  kind: PlayStaticColumnProducerKindSnapshot;
@@ -148,6 +148,15 @@ type PlayStaticSubstepSnapshot = PlayStaticSubstepMetadataSnapshot & ({
148
148
  sourceRange?: PlayStaticSourceRangeSnapshot;
149
149
  callDepth?: number;
150
150
  callPath?: string[];
151
+ } | {
152
+ type: 'control_flow';
153
+ kind: 'conditional' | 'loop';
154
+ field: string;
155
+ steps: PlayStaticSubstepSnapshot[];
156
+ description?: string;
157
+ sourceRange?: PlayStaticSourceRangeSnapshot;
158
+ callDepth?: number;
159
+ callPath?: string[];
151
160
  } | {
152
161
  type: 'run_javascript';
153
162
  alias: string;
@@ -646,6 +655,10 @@ interface PlayRunListItem {
646
655
  closeTime: string | null;
647
656
  /** Duration string (e.g. `'2.5s'`). */
648
657
  executionTime: string | null;
658
+ /** Total Deepline credits charged for the run, when available. */
659
+ billingTotalCredits?: number;
660
+ /** Configured per-run Deepline credit cap, when available. */
661
+ billingMaxCreditsPerRun?: number | null;
649
662
  /** Metadata attached to the workflow. */
650
663
  memo: {
651
664
  /** Organization that owns this run. */
@@ -2036,6 +2049,35 @@ interface PlayDataset<T> extends AsyncIterable<T> {
2036
2049
 
2037
2050
  type EmailStatusVerdict = 'send' | 'send_with_caution' | 'verify_next' | 'hold' | 'drop';
2038
2051
  type EmailStatusValue = 'valid' | 'invalid' | 'catch_all' | 'valid_catch_all' | 'unknown' | 'do_not_mail' | 'spamtrap' | 'abuse' | 'disposable';
2052
+ type EmailDeliverability = 'high' | 'medium' | 'low' | 'unknown';
2053
+ type EmailMxClass = 'consumer_mailbox' | 'workspace_mailbox' | 'security_gateway' | 'on_prem' | 'unknown';
2054
+ type EmailStatus = {
2055
+ verdict: EmailStatusVerdict;
2056
+ status: EmailStatusValue;
2057
+ verified: boolean;
2058
+ confidence: number | null;
2059
+ reasons: string[];
2060
+ signals: {
2061
+ catch_all: boolean | null;
2062
+ deliverability: EmailDeliverability;
2063
+ mx_class: EmailMxClass;
2064
+ mx_provider: string | null;
2065
+ mx_record: string | null;
2066
+ fraud_score: number | null;
2067
+ disposable: boolean | null;
2068
+ role_based: boolean | null;
2069
+ free_email: boolean | null;
2070
+ abuse: boolean | null;
2071
+ spamtrap: boolean | null;
2072
+ suspect: boolean | null;
2073
+ valid: boolean | null;
2074
+ };
2075
+ provider: {
2076
+ name: string;
2077
+ raw_status: string | boolean | number | null;
2078
+ raw_score: number | null;
2079
+ };
2080
+ };
2039
2081
  type EmailStatusMapEntry = {
2040
2082
  status: EmailStatusValue;
2041
2083
  verdict?: EmailStatusVerdict;
@@ -2065,6 +2107,153 @@ type EmailStatusExtractorConfig = {
2065
2107
  rules?: EmailStatusRule[];
2066
2108
  };
2067
2109
 
2110
+ declare const JOB_CHANGE_STATUS_VALUES: readonly ["moved", "no_change", "left_company", "unknown", "profile_unavailable", "no_new_company"];
2111
+ type JobChangeStatus = (typeof JOB_CHANGE_STATUS_VALUES)[number];
2112
+ type JobChangeGetterValue = {
2113
+ status: JobChangeStatus;
2114
+ date: string | null;
2115
+ new_company: string | null;
2116
+ new_title: string | null;
2117
+ };
2118
+ declare const PHONE_STATUS_VALUES: readonly ["valid", "invalid", "unknown"];
2119
+ type PhoneStatus = (typeof PHONE_STATUS_VALUES)[number];
2120
+ declare const DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS: {
2121
+ readonly id: {
2122
+ readonly identity: true;
2123
+ readonly valueKind: "string";
2124
+ };
2125
+ readonly name: {
2126
+ readonly identity: true;
2127
+ readonly valueKind: "string";
2128
+ };
2129
+ readonly email: {
2130
+ readonly identity: true;
2131
+ readonly valueKind: "string";
2132
+ };
2133
+ readonly personal_email: {
2134
+ readonly identity: true;
2135
+ readonly valueKind: "string";
2136
+ };
2137
+ readonly phone: {
2138
+ readonly identity: true;
2139
+ readonly valueKind: "string";
2140
+ };
2141
+ readonly linkedin: {
2142
+ readonly identity: true;
2143
+ readonly valueKind: "string";
2144
+ };
2145
+ readonly linkedin_url: {
2146
+ readonly identity: true;
2147
+ readonly valueKind: "string";
2148
+ };
2149
+ readonly domain: {
2150
+ readonly identity: true;
2151
+ readonly valueKind: "string";
2152
+ };
2153
+ readonly website: {
2154
+ readonly identity: true;
2155
+ readonly valueKind: "string";
2156
+ };
2157
+ readonly first_name: {
2158
+ readonly identity: true;
2159
+ readonly valueKind: "string";
2160
+ };
2161
+ readonly last_name: {
2162
+ readonly identity: true;
2163
+ readonly valueKind: "string";
2164
+ };
2165
+ readonly full_name: {
2166
+ readonly identity: true;
2167
+ readonly valueKind: "string";
2168
+ };
2169
+ readonly company: {
2170
+ readonly identity: true;
2171
+ readonly valueKind: "string";
2172
+ };
2173
+ readonly company_name: {
2174
+ readonly identity: true;
2175
+ readonly valueKind: "string";
2176
+ };
2177
+ readonly organization_name: {
2178
+ readonly identity: true;
2179
+ readonly valueKind: "string";
2180
+ };
2181
+ readonly company_domain: {
2182
+ readonly identity: true;
2183
+ readonly valueKind: "string";
2184
+ };
2185
+ readonly company_website: {
2186
+ readonly identity: true;
2187
+ readonly valueKind: "string";
2188
+ };
2189
+ readonly company_linkedin_url: {
2190
+ readonly identity: true;
2191
+ readonly valueKind: "string";
2192
+ };
2193
+ readonly title: {
2194
+ readonly identity: false;
2195
+ readonly valueKind: "string";
2196
+ };
2197
+ readonly industry: {
2198
+ readonly identity: false;
2199
+ readonly valueKind: "string";
2200
+ };
2201
+ readonly status: {
2202
+ readonly identity: false;
2203
+ readonly valueKind: "string";
2204
+ };
2205
+ readonly job_change: {
2206
+ readonly identity: false;
2207
+ readonly valueKind: "job_change";
2208
+ };
2209
+ readonly job_change_status: {
2210
+ readonly identity: false;
2211
+ readonly valueKind: "job_change_status";
2212
+ readonly enum: readonly ["moved", "no_change", "left_company", "unknown", "profile_unavailable", "no_new_company"];
2213
+ };
2214
+ readonly email_status: {
2215
+ readonly identity: false;
2216
+ readonly valueKind: "email_status";
2217
+ };
2218
+ readonly phone_status: {
2219
+ readonly identity: false;
2220
+ readonly valueKind: "phone_status";
2221
+ readonly enum: readonly ["valid", "invalid", "unknown"];
2222
+ };
2223
+ };
2224
+ type DeeplineExtractorTarget = keyof typeof DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS;
2225
+ declare const DEEPLINE_EXTRACTOR_TARGETS: DeeplineExtractorTarget[];
2226
+ type DeeplineEmailStatusGetterValue = EmailStatus | EmailStatusValue;
2227
+ type DeeplineGetterValueMap = {
2228
+ id: string;
2229
+ name: string;
2230
+ email: string;
2231
+ personal_email: string;
2232
+ phone: string;
2233
+ linkedin: string;
2234
+ linkedin_url: string;
2235
+ domain: string;
2236
+ website: string;
2237
+ first_name: string;
2238
+ last_name: string;
2239
+ full_name: string;
2240
+ company: string;
2241
+ company_name: string;
2242
+ organization_name: string;
2243
+ company_domain: string;
2244
+ company_website: string;
2245
+ company_linkedin_url: string;
2246
+ title: string;
2247
+ industry: string;
2248
+ status: string;
2249
+ job_change: JobChangeGetterValue;
2250
+ job_change_status: JobChangeStatus;
2251
+ email_status: DeeplineEmailStatusGetterValue;
2252
+ phone_status: PhoneStatus;
2253
+ };
2254
+ type DeeplineGetterValue<TTarget extends DeeplineExtractorTarget = DeeplineExtractorTarget> = DeeplineGetterValueMap[TTarget];
2255
+ declare function isDeeplineExtractorTarget(value: string): value is DeeplineExtractorTarget;
2256
+
2068
2257
  type ToolResultExecutionMetadata = {
2069
2258
  idempotent: true;
2070
2259
  cached: boolean;
@@ -2128,7 +2317,7 @@ type ToolExecuteResultBase<TResult = unknown, TMeta = Record<string, unknown>> =
2128
2317
  }>;
2129
2318
  };
2130
2319
  };
2131
- type ToolExecuteResultAccessors<TExtracted extends Record<string, unknown> = Record<string, unknown>, TLists extends Record<string, Record<string, unknown>> = Record<string, Record<string, unknown>>> = {
2320
+ type ToolExecuteResultAccessors<TExtracted extends Record<string, unknown> = Partial<DeeplineGetterValueMap>, TLists extends Record<string, Record<string, unknown>> = Record<string, Record<string, unknown>>> = {
2132
2321
  extractedValues: {
2133
2322
  [K in keyof TExtracted]: ToolResultTargetAccessor<TExtracted[K]>;
2134
2323
  };
@@ -2149,7 +2338,16 @@ type ToolExecuteResultAccessors<TExtracted extends Record<string, unknown> = Rec
2149
2338
  * `toolResponse.raw` when you need provider-specific fields or when debugging
2150
2339
  * from persisted run rows.
2151
2340
  */
2152
- type ToolExecuteResult<TResult = unknown, TMeta = Record<string, unknown>, TExtracted extends Record<string, unknown> = Record<string, unknown>, TLists extends Record<string, Record<string, unknown>> = Record<string, Record<string, unknown>>> = ToolExecuteResultBase<TResult, TMeta> & ToolExecuteResultAccessors<TExtracted, TLists>;
2341
+ type ToolExecuteResult<TResult = unknown, TMeta = Record<string, unknown>, TExtracted extends Record<string, unknown> = Partial<DeeplineGetterValueMap>, TLists extends Record<string, Record<string, unknown>> = Record<string, Record<string, unknown>>> = ToolExecuteResultBase<TResult, TMeta> & ToolExecuteResultAccessors<TExtracted, TLists>;
2342
+
2343
+ type StaleAfterSecondsResolver<Value = unknown> = (value: Value) => number | null;
2344
+ type AuthoredStaleAfterSeconds<Value = unknown> = number | StaleAfterSecondsResolver<Value>;
2345
+ type PreviousCell<Value = unknown> = {
2346
+ value: Value;
2347
+ completedAt?: number;
2348
+ staleAt?: number | null;
2349
+ staleAfterSeconds?: number;
2350
+ };
2153
2351
 
2154
2352
  /**
2155
2353
  * Optional trigger bindings for a play.
@@ -2247,7 +2445,25 @@ type ToolExecutionRequest = {
2247
2445
  description?: string;
2248
2446
  staleAfterSeconds?: number;
2249
2447
  };
2250
- type StepResolver<Row, Value> = (row: Row, ctx: DeeplinePlayRuntimeContext, index: number) => Value | Promise<Value>;
2448
+ type StaleAfterSeconds<Value = unknown> = AuthoredStaleAfterSeconds<Value>;
2449
+ type StepResolver<Row, Value> = (row: Row, ctx: DeeplinePlayRuntimeContext, index: number, previousCell?: PreviousCell<Value>) => Value | Promise<Value>;
2450
+ type DatasetColumnRunInput<Row, Value> = {
2451
+ row: Row;
2452
+ ctx: DeeplinePlayRuntimeContext;
2453
+ index: number;
2454
+ /**
2455
+ * The prior stored value for this exact row+column when the runtime has
2456
+ * decided the cell is due to run again. `previousCell.value` is the same type
2457
+ * this column returns; metadata such as `completedAt` and `staleAt` lives
2458
+ * beside it and is not mixed into the value.
2459
+ */
2460
+ previousCell?: PreviousCell<Value>;
2461
+ };
2462
+ type DatasetColumnDefinition<Row, Value> = {
2463
+ run: (input: DatasetColumnRunInput<Row, Value>) => Value | Promise<Value>;
2464
+ readonly runIf?: (row: Row, index: number) => boolean | Promise<boolean>;
2465
+ readonly staleAfterSeconds?: StaleAfterSeconds<Value>;
2466
+ };
2251
2467
  type ConditionalStepResolver<Row, Value, Else = null> = {
2252
2468
  readonly kind: 'conditional';
2253
2469
  readonly when: (row: Row, index: number) => boolean | Promise<boolean>;
@@ -2255,9 +2471,9 @@ type ConditionalStepResolver<Row, Value, Else = null> = {
2255
2471
  readonly elseValue: Else;
2256
2472
  else<ValueElse>(value: ValueElse): ConditionalStepResolver<Row, Value, ValueElse>;
2257
2473
  };
2258
- type StepOptions<Row> = {
2474
+ type StepOptions<Row, Value = unknown> = {
2259
2475
  readonly runIf?: (row: Row, index: number) => boolean | Promise<boolean>;
2260
- readonly staleAfterSeconds?: number;
2476
+ readonly staleAfterSeconds?: StaleAfterSeconds<Value>;
2261
2477
  };
2262
2478
  type StepProgram<Input, Output, Return = Output> = {
2263
2479
  readonly kind: 'steps';
@@ -2265,7 +2481,7 @@ type StepProgram<Input, Output, Return = Output> = {
2265
2481
  readonly returnResolver?: StepResolver<Output, Return>;
2266
2482
  readonly __inputType?: (input: Input) => void;
2267
2483
  step<Name extends string, Value>(name: Name, resolver: StepResolver<Output, Value> | ConditionalStepResolver<Output, Value> | StepProgramResolver<Output, Value>): StepProgram<Input, Output & Record<Name, Value>, Return>;
2268
- step<Name extends string, Value>(name: Name, resolver: StepResolver<Output, Value> | StepProgramResolver<Output, Value>, options: StepOptions<Output>): StepProgram<Input, Output & Record<Name, Value | null>, Return>;
2484
+ step<Name extends string, Value>(name: Name, resolver: StepResolver<Output, Value> | StepProgramResolver<Output, Value>, options: StepOptions<Output, Value>): StepProgram<Input, Output & Record<Name, Value | null>, Return>;
2269
2485
  return<Value>(resolver: StepResolver<Output, Value>): StepProgram<Input, Output, Value>;
2270
2486
  };
2271
2487
  type StepProgramResolver<Input, Return> = {
@@ -2276,7 +2492,7 @@ type StepProgramResolver<Input, Return> = {
2276
2492
  };
2277
2493
  type PlayStepProgramStep = {
2278
2494
  readonly name: string;
2279
- readonly staleAfterSeconds?: number;
2495
+ readonly staleAfterSeconds?: StaleAfterSeconds;
2280
2496
  readonly resolver: StepResolver<Record<string, unknown>, unknown> | ConditionalStepResolver<Record<string, unknown>, unknown> | StepProgramResolver<Record<string, unknown>, unknown>;
2281
2497
  };
2282
2498
  type ColumnResolver<Row, Value> = StepResolver<Row, Value> | ConditionalStepResolver<Row, Value> | StepProgramResolver<Row, Value>;
@@ -2296,7 +2512,11 @@ type DatasetBuilder<InputRow extends object, OutputRow extends object> = {
2296
2512
  * @returns The same dataset builder with the new column type.
2297
2513
  */
2298
2514
  withColumn<Name extends string, Value>(name: Name, resolver: ColumnResolver<OutputRow, Value>): DatasetBuilder<InputRow, OutputRow & Record<Name, Value>>;
2299
- withColumn<Name extends string, Value>(name: Name, resolver: StepResolver<OutputRow, Value> | StepProgramResolver<OutputRow, Value>, options: StepOptions<OutputRow>): DatasetBuilder<InputRow, OutputRow & Record<Name, Value | null>>;
2515
+ withColumn<Name extends string, Value>(name: Name, definition: DatasetColumnDefinition<OutputRow, Value> & {
2516
+ readonly runIf: (row: OutputRow, index: number) => boolean | Promise<boolean>;
2517
+ }): DatasetBuilder<InputRow, OutputRow & Record<Name, Value | null>>;
2518
+ withColumn<Name extends string, Value>(name: Name, definition: DatasetColumnDefinition<OutputRow, Value>): DatasetBuilder<InputRow, OutputRow & Record<Name, Value>>;
2519
+ withColumn<Name extends string, Value>(name: Name, resolver: StepResolver<OutputRow, Value> | StepProgramResolver<OutputRow, Value>, options: StepOptions<OutputRow, Value>): DatasetBuilder<InputRow, OutputRow & Record<Name, Value | null>>;
2300
2520
  withColumns<Program extends StepProgram<OutputRow, object, unknown>>(program: Program): DatasetBuilder<InputRow, StepProgramOutput<Program>>;
2301
2521
  /** @deprecated Dataset `.step(...)` was replaced by `.withColumn(...)`. */
2302
2522
  step<Name extends string, Value>(name: Name, resolver: ColumnResolver<OutputRow, Value>): never;
@@ -3189,4 +3409,4 @@ declare function writeCsvOutputFile(rows: Array<Record<string, unknown>>, stem:
3189
3409
  */
3190
3410
  declare function extractSummaryFields(payload: unknown): Record<string, Scalar>;
3191
3411
 
3192
- export { AuthError, type ClearPlayHistoryRequest, type ClearPlayHistoryResult, type ColumnMap, type ColumnResolver, type ConditionalStepResolver, ConfigError, type CsvInput, DEEPLINE_TOOL_CATEGORIES, type DatasetBuilder, Deepline, DeeplineClient, type DeeplineClientOptions, DeeplineContext, DeeplineError, type DeeplineNamedPlay, type DeeplinePlayRuntimeContext, type DeeplineToolCategory, type DefinePlayConfig, type DefinedPlay, type FileInput, type LiveEventEnvelope, PLAY_BOOTSTRAP_COMPANY_FIELDS, PLAY_BOOTSTRAP_COMPANY_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_CONTACT_FIELDS, PLAY_BOOTSTRAP_FINDER_KINDS, PLAY_BOOTSTRAP_OUTPUT_FIELD_BY_FINDER, PLAY_BOOTSTRAP_PEOPLE_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_PROVIDER_CATEGORY_BY_FINDER, PLAY_BOOTSTRAP_SOURCE_KINDS, PLAY_BOOTSTRAP_STAGE_KINDS, PLAY_BOOTSTRAP_TEMPLATES, PROD_URL, type PlayBindings, type PlayBootstrapEntityKind, type PlayBootstrapFinderKind, type PlayDataset, type PlayDatasetInput, type PlayInputContract, type PlayJob, type PlayListItem, type PlayLiveEvent, type PlayRevisionSummary, type PlayRunResult, type PlayRunStart, type PlayStatus, type PlayStepProgramStep, type PrebuiltPlayRef, type PublishPlayVersionRequest, type PublishPlayVersionResult, RateLimitError, type ResolvedConfig, SDK_API_CONTRACT, SDK_VERSION, type StartPlayRunRequest, type StepProgram, type StepProgramResolver, type StepResolver, type ToolDefinition, type ToolExecuteResult, type ToolExecution, type ToolMetadata, defineInput, definePlay, defineWorkflow, extractSummaryFields, formatPlayBootstrapFinderKinds, formatPlayBootstrapFinderKindsForSentence, formatPlayBootstrapTemplates, getDefinedPlayMetadata, isPlayBootstrapFinderKind, isPlayBootstrapTemplate, resolveConfig, runIf, steps, tryConvertToList, writeCsvOutputFile, writeJsonOutputFile };
3412
+ export { AuthError, type ClearPlayHistoryRequest, type ClearPlayHistoryResult, type ColumnMap, type ColumnResolver, type ConditionalStepResolver, ConfigError, type CsvInput, DEEPLINE_EXTRACTOR_TARGETS, DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS, DEEPLINE_TOOL_CATEGORIES, type DatasetBuilder, Deepline, DeeplineClient, type DeeplineClientOptions, DeeplineContext, type DeeplineEmailStatusGetterValue, DeeplineError, type DeeplineExtractorTarget, type DeeplineGetterValue, type DeeplineGetterValueMap, type DeeplineNamedPlay, type DeeplinePlayRuntimeContext, type DeeplineToolCategory, type DefinePlayConfig, type DefinedPlay, type FileInput, JOB_CHANGE_STATUS_VALUES, type JobChangeStatus, type LiveEventEnvelope, PHONE_STATUS_VALUES, PLAY_BOOTSTRAP_COMPANY_FIELDS, PLAY_BOOTSTRAP_COMPANY_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_CONTACT_FIELDS, PLAY_BOOTSTRAP_FINDER_KINDS, PLAY_BOOTSTRAP_OUTPUT_FIELD_BY_FINDER, PLAY_BOOTSTRAP_PEOPLE_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_PROVIDER_CATEGORY_BY_FINDER, PLAY_BOOTSTRAP_SOURCE_KINDS, PLAY_BOOTSTRAP_STAGE_KINDS, PLAY_BOOTSTRAP_TEMPLATES, PROD_URL, type PhoneStatus, type PlayBindings, type PlayBootstrapEntityKind, type PlayBootstrapFinderKind, type PlayDataset, type PlayDatasetInput, type PlayInputContract, type PlayJob, type PlayListItem, type PlayLiveEvent, type PlayRevisionSummary, type PlayRunResult, type PlayRunStart, type PlayStatus, type PlayStepProgramStep, type PrebuiltPlayRef, type PublishPlayVersionRequest, type PublishPlayVersionResult, RateLimitError, type ResolvedConfig, SDK_API_CONTRACT, SDK_VERSION, type StartPlayRunRequest, type StepProgram, type StepProgramResolver, type StepResolver, type ToolDefinition, type ToolExecuteResult, type ToolExecution, type ToolMetadata, defineInput, definePlay, defineWorkflow, extractSummaryFields, formatPlayBootstrapFinderKinds, formatPlayBootstrapFinderKindsForSentence, formatPlayBootstrapTemplates, getDefinedPlayMetadata, isDeeplineExtractorTarget, isPlayBootstrapFinderKind, isPlayBootstrapTemplate, resolveConfig, runIf, steps, tryConvertToList, writeCsvOutputFile, writeJsonOutputFile };
package/dist/index.d.ts CHANGED
@@ -46,7 +46,7 @@ interface PlaySheetContractSnapshot {
46
46
  tableNamespace: string;
47
47
  columns: PlaySheetColumnContractSnapshot[];
48
48
  }
49
- type PlayStaticColumnProducerKindSnapshot = 'tool' | 'waterfall' | 'stepProgram' | 'playCall' | 'transform';
49
+ type PlayStaticColumnProducerKindSnapshot = 'tool' | 'waterfall' | 'stepProgram' | 'playCall' | 'controlFlow' | 'transform';
50
50
  interface PlayStaticColumnProducerSnapshot {
51
51
  id: string;
52
52
  kind: PlayStaticColumnProducerKindSnapshot;
@@ -148,6 +148,15 @@ type PlayStaticSubstepSnapshot = PlayStaticSubstepMetadataSnapshot & ({
148
148
  sourceRange?: PlayStaticSourceRangeSnapshot;
149
149
  callDepth?: number;
150
150
  callPath?: string[];
151
+ } | {
152
+ type: 'control_flow';
153
+ kind: 'conditional' | 'loop';
154
+ field: string;
155
+ steps: PlayStaticSubstepSnapshot[];
156
+ description?: string;
157
+ sourceRange?: PlayStaticSourceRangeSnapshot;
158
+ callDepth?: number;
159
+ callPath?: string[];
151
160
  } | {
152
161
  type: 'run_javascript';
153
162
  alias: string;
@@ -646,6 +655,10 @@ interface PlayRunListItem {
646
655
  closeTime: string | null;
647
656
  /** Duration string (e.g. `'2.5s'`). */
648
657
  executionTime: string | null;
658
+ /** Total Deepline credits charged for the run, when available. */
659
+ billingTotalCredits?: number;
660
+ /** Configured per-run Deepline credit cap, when available. */
661
+ billingMaxCreditsPerRun?: number | null;
649
662
  /** Metadata attached to the workflow. */
650
663
  memo: {
651
664
  /** Organization that owns this run. */
@@ -2036,6 +2049,35 @@ interface PlayDataset<T> extends AsyncIterable<T> {
2036
2049
 
2037
2050
  type EmailStatusVerdict = 'send' | 'send_with_caution' | 'verify_next' | 'hold' | 'drop';
2038
2051
  type EmailStatusValue = 'valid' | 'invalid' | 'catch_all' | 'valid_catch_all' | 'unknown' | 'do_not_mail' | 'spamtrap' | 'abuse' | 'disposable';
2052
+ type EmailDeliverability = 'high' | 'medium' | 'low' | 'unknown';
2053
+ type EmailMxClass = 'consumer_mailbox' | 'workspace_mailbox' | 'security_gateway' | 'on_prem' | 'unknown';
2054
+ type EmailStatus = {
2055
+ verdict: EmailStatusVerdict;
2056
+ status: EmailStatusValue;
2057
+ verified: boolean;
2058
+ confidence: number | null;
2059
+ reasons: string[];
2060
+ signals: {
2061
+ catch_all: boolean | null;
2062
+ deliverability: EmailDeliverability;
2063
+ mx_class: EmailMxClass;
2064
+ mx_provider: string | null;
2065
+ mx_record: string | null;
2066
+ fraud_score: number | null;
2067
+ disposable: boolean | null;
2068
+ role_based: boolean | null;
2069
+ free_email: boolean | null;
2070
+ abuse: boolean | null;
2071
+ spamtrap: boolean | null;
2072
+ suspect: boolean | null;
2073
+ valid: boolean | null;
2074
+ };
2075
+ provider: {
2076
+ name: string;
2077
+ raw_status: string | boolean | number | null;
2078
+ raw_score: number | null;
2079
+ };
2080
+ };
2039
2081
  type EmailStatusMapEntry = {
2040
2082
  status: EmailStatusValue;
2041
2083
  verdict?: EmailStatusVerdict;
@@ -2065,6 +2107,153 @@ type EmailStatusExtractorConfig = {
2065
2107
  rules?: EmailStatusRule[];
2066
2108
  };
2067
2109
 
2110
+ declare const JOB_CHANGE_STATUS_VALUES: readonly ["moved", "no_change", "left_company", "unknown", "profile_unavailable", "no_new_company"];
2111
+ type JobChangeStatus = (typeof JOB_CHANGE_STATUS_VALUES)[number];
2112
+ type JobChangeGetterValue = {
2113
+ status: JobChangeStatus;
2114
+ date: string | null;
2115
+ new_company: string | null;
2116
+ new_title: string | null;
2117
+ };
2118
+ declare const PHONE_STATUS_VALUES: readonly ["valid", "invalid", "unknown"];
2119
+ type PhoneStatus = (typeof PHONE_STATUS_VALUES)[number];
2120
+ declare const DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS: {
2121
+ readonly id: {
2122
+ readonly identity: true;
2123
+ readonly valueKind: "string";
2124
+ };
2125
+ readonly name: {
2126
+ readonly identity: true;
2127
+ readonly valueKind: "string";
2128
+ };
2129
+ readonly email: {
2130
+ readonly identity: true;
2131
+ readonly valueKind: "string";
2132
+ };
2133
+ readonly personal_email: {
2134
+ readonly identity: true;
2135
+ readonly valueKind: "string";
2136
+ };
2137
+ readonly phone: {
2138
+ readonly identity: true;
2139
+ readonly valueKind: "string";
2140
+ };
2141
+ readonly linkedin: {
2142
+ readonly identity: true;
2143
+ readonly valueKind: "string";
2144
+ };
2145
+ readonly linkedin_url: {
2146
+ readonly identity: true;
2147
+ readonly valueKind: "string";
2148
+ };
2149
+ readonly domain: {
2150
+ readonly identity: true;
2151
+ readonly valueKind: "string";
2152
+ };
2153
+ readonly website: {
2154
+ readonly identity: true;
2155
+ readonly valueKind: "string";
2156
+ };
2157
+ readonly first_name: {
2158
+ readonly identity: true;
2159
+ readonly valueKind: "string";
2160
+ };
2161
+ readonly last_name: {
2162
+ readonly identity: true;
2163
+ readonly valueKind: "string";
2164
+ };
2165
+ readonly full_name: {
2166
+ readonly identity: true;
2167
+ readonly valueKind: "string";
2168
+ };
2169
+ readonly company: {
2170
+ readonly identity: true;
2171
+ readonly valueKind: "string";
2172
+ };
2173
+ readonly company_name: {
2174
+ readonly identity: true;
2175
+ readonly valueKind: "string";
2176
+ };
2177
+ readonly organization_name: {
2178
+ readonly identity: true;
2179
+ readonly valueKind: "string";
2180
+ };
2181
+ readonly company_domain: {
2182
+ readonly identity: true;
2183
+ readonly valueKind: "string";
2184
+ };
2185
+ readonly company_website: {
2186
+ readonly identity: true;
2187
+ readonly valueKind: "string";
2188
+ };
2189
+ readonly company_linkedin_url: {
2190
+ readonly identity: true;
2191
+ readonly valueKind: "string";
2192
+ };
2193
+ readonly title: {
2194
+ readonly identity: false;
2195
+ readonly valueKind: "string";
2196
+ };
2197
+ readonly industry: {
2198
+ readonly identity: false;
2199
+ readonly valueKind: "string";
2200
+ };
2201
+ readonly status: {
2202
+ readonly identity: false;
2203
+ readonly valueKind: "string";
2204
+ };
2205
+ readonly job_change: {
2206
+ readonly identity: false;
2207
+ readonly valueKind: "job_change";
2208
+ };
2209
+ readonly job_change_status: {
2210
+ readonly identity: false;
2211
+ readonly valueKind: "job_change_status";
2212
+ readonly enum: readonly ["moved", "no_change", "left_company", "unknown", "profile_unavailable", "no_new_company"];
2213
+ };
2214
+ readonly email_status: {
2215
+ readonly identity: false;
2216
+ readonly valueKind: "email_status";
2217
+ };
2218
+ readonly phone_status: {
2219
+ readonly identity: false;
2220
+ readonly valueKind: "phone_status";
2221
+ readonly enum: readonly ["valid", "invalid", "unknown"];
2222
+ };
2223
+ };
2224
+ type DeeplineExtractorTarget = keyof typeof DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS;
2225
+ declare const DEEPLINE_EXTRACTOR_TARGETS: DeeplineExtractorTarget[];
2226
+ type DeeplineEmailStatusGetterValue = EmailStatus | EmailStatusValue;
2227
+ type DeeplineGetterValueMap = {
2228
+ id: string;
2229
+ name: string;
2230
+ email: string;
2231
+ personal_email: string;
2232
+ phone: string;
2233
+ linkedin: string;
2234
+ linkedin_url: string;
2235
+ domain: string;
2236
+ website: string;
2237
+ first_name: string;
2238
+ last_name: string;
2239
+ full_name: string;
2240
+ company: string;
2241
+ company_name: string;
2242
+ organization_name: string;
2243
+ company_domain: string;
2244
+ company_website: string;
2245
+ company_linkedin_url: string;
2246
+ title: string;
2247
+ industry: string;
2248
+ status: string;
2249
+ job_change: JobChangeGetterValue;
2250
+ job_change_status: JobChangeStatus;
2251
+ email_status: DeeplineEmailStatusGetterValue;
2252
+ phone_status: PhoneStatus;
2253
+ };
2254
+ type DeeplineGetterValue<TTarget extends DeeplineExtractorTarget = DeeplineExtractorTarget> = DeeplineGetterValueMap[TTarget];
2255
+ declare function isDeeplineExtractorTarget(value: string): value is DeeplineExtractorTarget;
2256
+
2068
2257
  type ToolResultExecutionMetadata = {
2069
2258
  idempotent: true;
2070
2259
  cached: boolean;
@@ -2128,7 +2317,7 @@ type ToolExecuteResultBase<TResult = unknown, TMeta = Record<string, unknown>> =
2128
2317
  }>;
2129
2318
  };
2130
2319
  };
2131
- type ToolExecuteResultAccessors<TExtracted extends Record<string, unknown> = Record<string, unknown>, TLists extends Record<string, Record<string, unknown>> = Record<string, Record<string, unknown>>> = {
2320
+ type ToolExecuteResultAccessors<TExtracted extends Record<string, unknown> = Partial<DeeplineGetterValueMap>, TLists extends Record<string, Record<string, unknown>> = Record<string, Record<string, unknown>>> = {
2132
2321
  extractedValues: {
2133
2322
  [K in keyof TExtracted]: ToolResultTargetAccessor<TExtracted[K]>;
2134
2323
  };
@@ -2149,7 +2338,16 @@ type ToolExecuteResultAccessors<TExtracted extends Record<string, unknown> = Rec
2149
2338
  * `toolResponse.raw` when you need provider-specific fields or when debugging
2150
2339
  * from persisted run rows.
2151
2340
  */
2152
- type ToolExecuteResult<TResult = unknown, TMeta = Record<string, unknown>, TExtracted extends Record<string, unknown> = Record<string, unknown>, TLists extends Record<string, Record<string, unknown>> = Record<string, Record<string, unknown>>> = ToolExecuteResultBase<TResult, TMeta> & ToolExecuteResultAccessors<TExtracted, TLists>;
2341
+ type ToolExecuteResult<TResult = unknown, TMeta = Record<string, unknown>, TExtracted extends Record<string, unknown> = Partial<DeeplineGetterValueMap>, TLists extends Record<string, Record<string, unknown>> = Record<string, Record<string, unknown>>> = ToolExecuteResultBase<TResult, TMeta> & ToolExecuteResultAccessors<TExtracted, TLists>;
2342
+
2343
+ type StaleAfterSecondsResolver<Value = unknown> = (value: Value) => number | null;
2344
+ type AuthoredStaleAfterSeconds<Value = unknown> = number | StaleAfterSecondsResolver<Value>;
2345
+ type PreviousCell<Value = unknown> = {
2346
+ value: Value;
2347
+ completedAt?: number;
2348
+ staleAt?: number | null;
2349
+ staleAfterSeconds?: number;
2350
+ };
2153
2351
 
2154
2352
  /**
2155
2353
  * Optional trigger bindings for a play.
@@ -2247,7 +2445,25 @@ type ToolExecutionRequest = {
2247
2445
  description?: string;
2248
2446
  staleAfterSeconds?: number;
2249
2447
  };
2250
- type StepResolver<Row, Value> = (row: Row, ctx: DeeplinePlayRuntimeContext, index: number) => Value | Promise<Value>;
2448
+ type StaleAfterSeconds<Value = unknown> = AuthoredStaleAfterSeconds<Value>;
2449
+ type StepResolver<Row, Value> = (row: Row, ctx: DeeplinePlayRuntimeContext, index: number, previousCell?: PreviousCell<Value>) => Value | Promise<Value>;
2450
+ type DatasetColumnRunInput<Row, Value> = {
2451
+ row: Row;
2452
+ ctx: DeeplinePlayRuntimeContext;
2453
+ index: number;
2454
+ /**
2455
+ * The prior stored value for this exact row+column when the runtime has
2456
+ * decided the cell is due to run again. `previousCell.value` is the same type
2457
+ * this column returns; metadata such as `completedAt` and `staleAt` lives
2458
+ * beside it and is not mixed into the value.
2459
+ */
2460
+ previousCell?: PreviousCell<Value>;
2461
+ };
2462
+ type DatasetColumnDefinition<Row, Value> = {
2463
+ run: (input: DatasetColumnRunInput<Row, Value>) => Value | Promise<Value>;
2464
+ readonly runIf?: (row: Row, index: number) => boolean | Promise<boolean>;
2465
+ readonly staleAfterSeconds?: StaleAfterSeconds<Value>;
2466
+ };
2251
2467
  type ConditionalStepResolver<Row, Value, Else = null> = {
2252
2468
  readonly kind: 'conditional';
2253
2469
  readonly when: (row: Row, index: number) => boolean | Promise<boolean>;
@@ -2255,9 +2471,9 @@ type ConditionalStepResolver<Row, Value, Else = null> = {
2255
2471
  readonly elseValue: Else;
2256
2472
  else<ValueElse>(value: ValueElse): ConditionalStepResolver<Row, Value, ValueElse>;
2257
2473
  };
2258
- type StepOptions<Row> = {
2474
+ type StepOptions<Row, Value = unknown> = {
2259
2475
  readonly runIf?: (row: Row, index: number) => boolean | Promise<boolean>;
2260
- readonly staleAfterSeconds?: number;
2476
+ readonly staleAfterSeconds?: StaleAfterSeconds<Value>;
2261
2477
  };
2262
2478
  type StepProgram<Input, Output, Return = Output> = {
2263
2479
  readonly kind: 'steps';
@@ -2265,7 +2481,7 @@ type StepProgram<Input, Output, Return = Output> = {
2265
2481
  readonly returnResolver?: StepResolver<Output, Return>;
2266
2482
  readonly __inputType?: (input: Input) => void;
2267
2483
  step<Name extends string, Value>(name: Name, resolver: StepResolver<Output, Value> | ConditionalStepResolver<Output, Value> | StepProgramResolver<Output, Value>): StepProgram<Input, Output & Record<Name, Value>, Return>;
2268
- step<Name extends string, Value>(name: Name, resolver: StepResolver<Output, Value> | StepProgramResolver<Output, Value>, options: StepOptions<Output>): StepProgram<Input, Output & Record<Name, Value | null>, Return>;
2484
+ step<Name extends string, Value>(name: Name, resolver: StepResolver<Output, Value> | StepProgramResolver<Output, Value>, options: StepOptions<Output, Value>): StepProgram<Input, Output & Record<Name, Value | null>, Return>;
2269
2485
  return<Value>(resolver: StepResolver<Output, Value>): StepProgram<Input, Output, Value>;
2270
2486
  };
2271
2487
  type StepProgramResolver<Input, Return> = {
@@ -2276,7 +2492,7 @@ type StepProgramResolver<Input, Return> = {
2276
2492
  };
2277
2493
  type PlayStepProgramStep = {
2278
2494
  readonly name: string;
2279
- readonly staleAfterSeconds?: number;
2495
+ readonly staleAfterSeconds?: StaleAfterSeconds;
2280
2496
  readonly resolver: StepResolver<Record<string, unknown>, unknown> | ConditionalStepResolver<Record<string, unknown>, unknown> | StepProgramResolver<Record<string, unknown>, unknown>;
2281
2497
  };
2282
2498
  type ColumnResolver<Row, Value> = StepResolver<Row, Value> | ConditionalStepResolver<Row, Value> | StepProgramResolver<Row, Value>;
@@ -2296,7 +2512,11 @@ type DatasetBuilder<InputRow extends object, OutputRow extends object> = {
2296
2512
  * @returns The same dataset builder with the new column type.
2297
2513
  */
2298
2514
  withColumn<Name extends string, Value>(name: Name, resolver: ColumnResolver<OutputRow, Value>): DatasetBuilder<InputRow, OutputRow & Record<Name, Value>>;
2299
- withColumn<Name extends string, Value>(name: Name, resolver: StepResolver<OutputRow, Value> | StepProgramResolver<OutputRow, Value>, options: StepOptions<OutputRow>): DatasetBuilder<InputRow, OutputRow & Record<Name, Value | null>>;
2515
+ withColumn<Name extends string, Value>(name: Name, definition: DatasetColumnDefinition<OutputRow, Value> & {
2516
+ readonly runIf: (row: OutputRow, index: number) => boolean | Promise<boolean>;
2517
+ }): DatasetBuilder<InputRow, OutputRow & Record<Name, Value | null>>;
2518
+ withColumn<Name extends string, Value>(name: Name, definition: DatasetColumnDefinition<OutputRow, Value>): DatasetBuilder<InputRow, OutputRow & Record<Name, Value>>;
2519
+ withColumn<Name extends string, Value>(name: Name, resolver: StepResolver<OutputRow, Value> | StepProgramResolver<OutputRow, Value>, options: StepOptions<OutputRow, Value>): DatasetBuilder<InputRow, OutputRow & Record<Name, Value | null>>;
2300
2520
  withColumns<Program extends StepProgram<OutputRow, object, unknown>>(program: Program): DatasetBuilder<InputRow, StepProgramOutput<Program>>;
2301
2521
  /** @deprecated Dataset `.step(...)` was replaced by `.withColumn(...)`. */
2302
2522
  step<Name extends string, Value>(name: Name, resolver: ColumnResolver<OutputRow, Value>): never;
@@ -3189,4 +3409,4 @@ declare function writeCsvOutputFile(rows: Array<Record<string, unknown>>, stem:
3189
3409
  */
3190
3410
  declare function extractSummaryFields(payload: unknown): Record<string, Scalar>;
3191
3411
 
3192
- export { AuthError, type ClearPlayHistoryRequest, type ClearPlayHistoryResult, type ColumnMap, type ColumnResolver, type ConditionalStepResolver, ConfigError, type CsvInput, DEEPLINE_TOOL_CATEGORIES, type DatasetBuilder, Deepline, DeeplineClient, type DeeplineClientOptions, DeeplineContext, DeeplineError, type DeeplineNamedPlay, type DeeplinePlayRuntimeContext, type DeeplineToolCategory, type DefinePlayConfig, type DefinedPlay, type FileInput, type LiveEventEnvelope, PLAY_BOOTSTRAP_COMPANY_FIELDS, PLAY_BOOTSTRAP_COMPANY_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_CONTACT_FIELDS, PLAY_BOOTSTRAP_FINDER_KINDS, PLAY_BOOTSTRAP_OUTPUT_FIELD_BY_FINDER, PLAY_BOOTSTRAP_PEOPLE_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_PROVIDER_CATEGORY_BY_FINDER, PLAY_BOOTSTRAP_SOURCE_KINDS, PLAY_BOOTSTRAP_STAGE_KINDS, PLAY_BOOTSTRAP_TEMPLATES, PROD_URL, type PlayBindings, type PlayBootstrapEntityKind, type PlayBootstrapFinderKind, type PlayDataset, type PlayDatasetInput, type PlayInputContract, type PlayJob, type PlayListItem, type PlayLiveEvent, type PlayRevisionSummary, type PlayRunResult, type PlayRunStart, type PlayStatus, type PlayStepProgramStep, type PrebuiltPlayRef, type PublishPlayVersionRequest, type PublishPlayVersionResult, RateLimitError, type ResolvedConfig, SDK_API_CONTRACT, SDK_VERSION, type StartPlayRunRequest, type StepProgram, type StepProgramResolver, type StepResolver, type ToolDefinition, type ToolExecuteResult, type ToolExecution, type ToolMetadata, defineInput, definePlay, defineWorkflow, extractSummaryFields, formatPlayBootstrapFinderKinds, formatPlayBootstrapFinderKindsForSentence, formatPlayBootstrapTemplates, getDefinedPlayMetadata, isPlayBootstrapFinderKind, isPlayBootstrapTemplate, resolveConfig, runIf, steps, tryConvertToList, writeCsvOutputFile, writeJsonOutputFile };
3412
+ export { AuthError, type ClearPlayHistoryRequest, type ClearPlayHistoryResult, type ColumnMap, type ColumnResolver, type ConditionalStepResolver, ConfigError, type CsvInput, DEEPLINE_EXTRACTOR_TARGETS, DEEPLINE_EXTRACTOR_TARGET_DEFINITIONS, DEEPLINE_TOOL_CATEGORIES, type DatasetBuilder, Deepline, DeeplineClient, type DeeplineClientOptions, DeeplineContext, type DeeplineEmailStatusGetterValue, DeeplineError, type DeeplineExtractorTarget, type DeeplineGetterValue, type DeeplineGetterValueMap, type DeeplineNamedPlay, type DeeplinePlayRuntimeContext, type DeeplineToolCategory, type DefinePlayConfig, type DefinedPlay, type FileInput, JOB_CHANGE_STATUS_VALUES, type JobChangeStatus, type LiveEventEnvelope, PHONE_STATUS_VALUES, PLAY_BOOTSTRAP_COMPANY_FIELDS, PLAY_BOOTSTRAP_COMPANY_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_CONTACT_FIELDS, PLAY_BOOTSTRAP_FINDER_KINDS, PLAY_BOOTSTRAP_OUTPUT_FIELD_BY_FINDER, PLAY_BOOTSTRAP_PEOPLE_PROVIDER_CATEGORY, PLAY_BOOTSTRAP_PROVIDER_CATEGORY_BY_FINDER, PLAY_BOOTSTRAP_SOURCE_KINDS, PLAY_BOOTSTRAP_STAGE_KINDS, PLAY_BOOTSTRAP_TEMPLATES, PROD_URL, type PhoneStatus, type PlayBindings, type PlayBootstrapEntityKind, type PlayBootstrapFinderKind, type PlayDataset, type PlayDatasetInput, type PlayInputContract, type PlayJob, type PlayListItem, type PlayLiveEvent, type PlayRevisionSummary, type PlayRunResult, type PlayRunStart, type PlayStatus, type PlayStepProgramStep, type PrebuiltPlayRef, type PublishPlayVersionRequest, type PublishPlayVersionResult, RateLimitError, type ResolvedConfig, SDK_API_CONTRACT, SDK_VERSION, type StartPlayRunRequest, type StepProgram, type StepProgramResolver, type StepResolver, type ToolDefinition, type ToolExecuteResult, type ToolExecution, type ToolMetadata, defineInput, definePlay, defineWorkflow, extractSummaryFields, formatPlayBootstrapFinderKinds, formatPlayBootstrapFinderKindsForSentence, formatPlayBootstrapTemplates, getDefinedPlayMetadata, isDeeplineExtractorTarget, isPlayBootstrapFinderKind, isPlayBootstrapTemplate, resolveConfig, runIf, steps, tryConvertToList, writeCsvOutputFile, writeJsonOutputFile };