deepline 0.3.257 → 0.3.259
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/bundling-sources/sdk/src/api-error.ts +45 -0
- package/dist/bundling-sources/sdk/src/client.ts +98 -459
- package/dist/bundling-sources/sdk/src/http.ts +1 -34
- package/dist/bundling-sources/sdk/src/index.ts +8 -0
- package/dist/bundling-sources/sdk/src/plays/csv-data-input.ts +139 -0
- package/dist/bundling-sources/sdk/src/plays/run-request.ts +855 -0
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/runs/overview.ts +45 -2
- package/dist/bundling-sources/sdk/src/types.ts +5 -0
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +8 -0
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +42 -10
- package/dist/bundling-sources/shared_libs/play-runtime/launch-identity.ts +3 -0
- package/dist/bundling-sources/shared_libs/play-runtime/launch-source-policy.ts +23 -0
- package/dist/bundling-sources/shared_libs/play-runtime/live-state-contract.ts +3 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-admission-outcome.ts +23 -5
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/projection/gateway-adapter.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/run-execution-state.ts +845 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +106 -6
- package/dist/bundling-sources/shared_libs/play-runtime/run-observation.ts +440 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +35 -2
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +66 -7
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +0 -29
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-row-transition.ts +47 -2
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +475 -36
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +78 -11
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +550 -42
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +181 -8
- package/dist/bundling-sources/shared_libs/play-runtime/step-lifecycle-tracker.ts +0 -18
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +80 -7
- package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +37 -2
- package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +148 -18
- package/dist/bundling-sources/shared_libs/plays/cascade-falloff.ts +86 -0
- package/dist/bundling-sources/shared_libs/plays/docflow-unreached-reason.ts +611 -0
- package/dist/bundling-sources/shared_libs/plays/docflow.ts +21 -0
- package/dist/bundling-sources/shared_libs/plays/play-exports.ts +28 -5
- package/dist/bundling-sources/shared_libs/plays/play-grep-search.ts +40 -2
- package/dist/bundling-sources/shared_libs/plays/settings-contract.ts +92 -10
- package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +5 -0
- package/dist/bundling-sources/shared_libs/plays/trigger-config-contract.ts +222 -0
- package/dist/bundling-sources/shared_libs/plays/trigger-config-route.ts +15 -0
- package/dist/cli/index.js +4957 -771
- package/dist/cli/index.mjs +4957 -771
- package/dist/client-B5XbKrrs.d.mts +6564 -0
- package/dist/client-C9Y49yya.d.ts +6564 -0
- package/dist/{compiler-manifest-C4mdRJOP.d.mts → compiler-manifest-CUuh8C3b.d.mts} +14 -1
- package/dist/{compiler-manifest-C4mdRJOP.d.ts → compiler-manifest-CUuh8C3b.d.ts} +14 -1
- package/dist/index.d.mts +7 -6275
- package/dist/index.d.ts +7 -6275
- package/dist/index.js +360 -326
- package/dist/index.mjs +360 -326
- package/dist/install-integrity.json +21 -2
- package/dist/plays/bundle-play-file.d.mts +2 -2
- package/dist/plays/bundle-play-file.d.ts +2 -2
- package/dist/plays/bundle-play-file.mjs +117 -18
- package/dist/plays/csv-data-input.d.mts +37 -0
- package/dist/plays/csv-data-input.d.ts +37 -0
- package/dist/plays/csv-data-input.js +3135 -0
- package/dist/plays/csv-data-input.mjs +3108 -0
- package/dist/plays/run-request.d.mts +6 -0
- package/dist/plays/run-request.d.ts +6 -0
- package/dist/plays/run-request.js +664 -0
- package/dist/plays/run-request.mjs +614 -0
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +1 -1
- package/dist/release.mjs +1 -1
- package/package.json +12 -1
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
TOOL_EXECUTION_ERROR_SCHEMA_VERSION,
|
|
33
33
|
} from '../../shared_libs/plays/tool-execution-error';
|
|
34
34
|
import { SDK_API_CONTRACT, SDK_VERSION } from './version.js';
|
|
35
|
+
import { apiErrorCodeFromResponse, apiErrorMessage } from './api-error';
|
|
35
36
|
import type { LiveEventEnvelope } from './types.js';
|
|
36
37
|
import { detectAgentRuntime, isCoworkLikeSandbox } from './agent-runtime.js';
|
|
37
38
|
import { readSdkSkillsLocalVersion } from './skills-version.js';
|
|
@@ -987,13 +988,6 @@ function isMonitorRateLimitEnvelope(parsed: unknown): boolean {
|
|
|
987
988
|
);
|
|
988
989
|
}
|
|
989
990
|
|
|
990
|
-
function apiErrorCodeFromResponse(parsed: unknown): string {
|
|
991
|
-
const response = asRecord(parsed);
|
|
992
|
-
const error = asRecord(response?.error);
|
|
993
|
-
const code = error?.code ?? response?.code;
|
|
994
|
-
return typeof code === 'string' ? code : 'API_ERROR';
|
|
995
|
-
}
|
|
996
|
-
|
|
997
991
|
function asRecord(value: unknown): Record<string, unknown> | null {
|
|
998
992
|
return typeof value === 'object' && value !== null
|
|
999
993
|
? (value as Record<string, unknown>)
|
|
@@ -1052,33 +1046,6 @@ function detectHtmlErrorBody(
|
|
|
1052
1046
|
};
|
|
1053
1047
|
}
|
|
1054
1048
|
|
|
1055
|
-
function apiErrorMessage(parsed: unknown, status: number): string {
|
|
1056
|
-
const errorValue =
|
|
1057
|
-
typeof parsed === 'object' && parsed && 'error' in parsed
|
|
1058
|
-
? (parsed as Record<string, unknown>).error
|
|
1059
|
-
: undefined;
|
|
1060
|
-
if (typeof errorValue === 'string') {
|
|
1061
|
-
return errorValue;
|
|
1062
|
-
}
|
|
1063
|
-
if (
|
|
1064
|
-
errorValue &&
|
|
1065
|
-
typeof errorValue === 'object' &&
|
|
1066
|
-
'message' in errorValue &&
|
|
1067
|
-
typeof (errorValue as Record<string, unknown>).message === 'string'
|
|
1068
|
-
) {
|
|
1069
|
-
return (errorValue as Record<string, string>).message;
|
|
1070
|
-
}
|
|
1071
|
-
if (
|
|
1072
|
-
typeof parsed === 'object' &&
|
|
1073
|
-
parsed &&
|
|
1074
|
-
'message' in parsed &&
|
|
1075
|
-
typeof (parsed as Record<string, unknown>).message === 'string'
|
|
1076
|
-
) {
|
|
1077
|
-
return (parsed as Record<string, string>).message;
|
|
1078
|
-
}
|
|
1079
|
-
return `HTTP ${status}`;
|
|
1080
|
-
}
|
|
1081
|
-
|
|
1082
1049
|
/** Parse the `Retry-After` header as milliseconds. Falls back to 5000ms. */
|
|
1083
1050
|
function parseRetryAfter(response: Response): number {
|
|
1084
1051
|
return parseOptionalRetryAfter(response) ?? 5000;
|
|
@@ -5,6 +5,14 @@ export type {
|
|
|
5
5
|
PlaySettingsResult,
|
|
6
6
|
PlaySettingsPathsPage,
|
|
7
7
|
} from '../../shared_libs/plays/settings-contract';
|
|
8
|
+
export type {
|
|
9
|
+
PlayCronTriggerConfig,
|
|
10
|
+
PlayTriggerConfigUpdate,
|
|
11
|
+
PlayTriggerConfigUpdateResult,
|
|
12
|
+
PlayTriggerConfigView,
|
|
13
|
+
PlayWebhookAuthConfig,
|
|
14
|
+
PlayWebhookTriggerConfig,
|
|
15
|
+
} from '../../shared_libs/plays/trigger-config-contract';
|
|
8
16
|
/**
|
|
9
17
|
* Deepline SDK — TypeScript client for the Deepline enrichment platform.
|
|
10
18
|
*
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strict parse of a Play's CSV DATA input (the `csv` key, the row source).
|
|
3
|
+
* The CLI runs it on the local file before staging; the dashboard runs it on a
|
|
4
|
+
* dropped file before enabling Run. Same parser, same options, same errors.
|
|
5
|
+
*
|
|
6
|
+
* Kept apart from `./run-request` so the SDK client entrypoint does not carry
|
|
7
|
+
* the CSV parser. Browser-safe: uses csv-parse's self-contained browser build.
|
|
8
|
+
*/
|
|
9
|
+
import { parse as parseCsvSync } from 'csv-parse/browser/esm/sync';
|
|
10
|
+
import { DeeplineError } from '../../../shared_libs/plays/tool-execution-error';
|
|
11
|
+
|
|
12
|
+
export type CsvDataInputSource = {
|
|
13
|
+
/** Dotted path into the run input, for error messages. */
|
|
14
|
+
inputPath: string;
|
|
15
|
+
/** What the caller supplied: a CLI path or a dropped file's name. */
|
|
16
|
+
value: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type ParsedCsvDataInput = {
|
|
20
|
+
/** Trimmed header names, in column order. */
|
|
21
|
+
headers: string[];
|
|
22
|
+
/** Trimmed data records, positional (one entry per header, ragged allowed). */
|
|
23
|
+
records: string[][];
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* STRICT validation of the play's CSV DATA input (the row source):
|
|
28
|
+
*
|
|
29
|
+
* - parses with `relax_quotes: false` so an unclosed/ragged quote is a LOUD
|
|
30
|
+
* error naming the line/character (prod run 20260611t145823-710 swallowed an
|
|
31
|
+
* entire `"https://...`-no-closing-quote row into one giant linkedin_url),
|
|
32
|
+
* - detects EXACT-after-trim duplicate header names (prod run
|
|
33
|
+
* 20260611t145821-917 had two `linkedin_url` columns; the second silently
|
|
34
|
+
* won) — case-DIFFERENT duplicates are handled play-side and not rejected,
|
|
35
|
+
* - rejects a header-only CSV with zero data rows.
|
|
36
|
+
*
|
|
37
|
+
* Any violation throws a `DeeplineError` (code `PLAY_INPUT_FILE_PREFLIGHT`)
|
|
38
|
+
* before any staging or API call, so no run is created and nothing is billed.
|
|
39
|
+
*/
|
|
40
|
+
export function parseCsvDataInput(
|
|
41
|
+
source: CsvDataInputSource,
|
|
42
|
+
content: string,
|
|
43
|
+
options: {
|
|
44
|
+
/**
|
|
45
|
+
* Called after each parsed record (header included) with the running
|
|
46
|
+
* count. Observation only: it cannot change, drop, or reorder records.
|
|
47
|
+
* The dashboard's parser worker uses it to report row progress.
|
|
48
|
+
*/
|
|
49
|
+
onRecord?: (recordCount: number) => void;
|
|
50
|
+
} = {},
|
|
51
|
+
): ParsedCsvDataInput {
|
|
52
|
+
const onRecord = options.onRecord;
|
|
53
|
+
let recordCount = 0;
|
|
54
|
+
// Parse into an array-of-arrays so we can both surface quoting errors AND
|
|
55
|
+
// inspect the raw header row for duplicates. `columns: false` keeps every
|
|
56
|
+
// record positional; the first record is the header.
|
|
57
|
+
let records: string[][];
|
|
58
|
+
try {
|
|
59
|
+
records = parseCsvSync(content, {
|
|
60
|
+
bom: true,
|
|
61
|
+
columns: false,
|
|
62
|
+
skip_empty_lines: true,
|
|
63
|
+
relax_column_count: true,
|
|
64
|
+
// STRICT RFC quoting: an unclosed quote or ragged quoting is a hard
|
|
65
|
+
// error rather than being swallowed into one giant field.
|
|
66
|
+
relax_quotes: false,
|
|
67
|
+
trim: true,
|
|
68
|
+
...(onRecord
|
|
69
|
+
? {
|
|
70
|
+
on_record: (record: string[]) => {
|
|
71
|
+
recordCount += 1;
|
|
72
|
+
onRecord(recordCount);
|
|
73
|
+
return record;
|
|
74
|
+
},
|
|
75
|
+
}
|
|
76
|
+
: {}),
|
|
77
|
+
}) as string[][];
|
|
78
|
+
} catch (error) {
|
|
79
|
+
throw new DeeplineError(
|
|
80
|
+
`Input ${source.inputPath} could not be parsed as CSV (${source.value}): ${
|
|
81
|
+
error instanceof Error ? error.message : String(error)
|
|
82
|
+
}. This usually means an unclosed quote or ragged quoting. No run was created.`,
|
|
83
|
+
undefined,
|
|
84
|
+
'PLAY_INPUT_FILE_PREFLIGHT',
|
|
85
|
+
{ inputPath: source.inputPath, path: source.value },
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (records.length === 0) {
|
|
90
|
+
// Nothing parsed at all: there is no header row to speak of either.
|
|
91
|
+
throw new DeeplineError(
|
|
92
|
+
`${source.value} is empty: it has no header row and no data rows. No run was created.`,
|
|
93
|
+
undefined,
|
|
94
|
+
'PLAY_INPUT_FILE_PREFLIGHT',
|
|
95
|
+
{ inputPath: source.inputPath, path: source.value },
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Duplicate header detection (exact match after trim). Report both raw
|
|
100
|
+
// spellings and the 1-based column positions.
|
|
101
|
+
const header = records[0]!;
|
|
102
|
+
const seen = new Map<string, { index: number; raw: string }>();
|
|
103
|
+
for (let i = 0; i < header.length; i++) {
|
|
104
|
+
const raw = header[i] ?? '';
|
|
105
|
+
const name = raw.trim();
|
|
106
|
+
if (name.length === 0) continue;
|
|
107
|
+
const prior = seen.get(name);
|
|
108
|
+
if (prior) {
|
|
109
|
+
throw new DeeplineError(
|
|
110
|
+
`Input ${source.inputPath} (${source.value}) has a duplicate CSV header "${name}" (columns ${
|
|
111
|
+
prior.index + 1
|
|
112
|
+
} and ${i + 1}). The second column would silently overwrite the first. Rename one of them. No run was created.`,
|
|
113
|
+
undefined,
|
|
114
|
+
'PLAY_INPUT_FILE_PREFLIGHT',
|
|
115
|
+
{
|
|
116
|
+
inputPath: source.inputPath,
|
|
117
|
+
path: source.value,
|
|
118
|
+
duplicateHeader: name,
|
|
119
|
+
columns: [prior.index + 1, i + 1],
|
|
120
|
+
rawSpellings: [prior.raw, raw],
|
|
121
|
+
},
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
seen.set(name, { index: i, raw });
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (records.length - 1 < 1) {
|
|
128
|
+
throw new DeeplineError(
|
|
129
|
+
`${source.value} has a header row but no data rows. No run was created.`,
|
|
130
|
+
undefined,
|
|
131
|
+
'PLAY_INPUT_FILE_PREFLIGHT',
|
|
132
|
+
{ inputPath: source.inputPath, path: source.value },
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
return {
|
|
136
|
+
headers: header.map((name) => name.trim()),
|
|
137
|
+
records: records.slice(1),
|
|
138
|
+
};
|
|
139
|
+
}
|