deepline 0.3.283 → 0.3.285
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/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/activity-observation.ts +26 -2
- package/dist/bundling-sources/shared_libs/play-runtime/batch-runtime.ts +7 -0
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +817 -2236
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +19 -6
- package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +127 -789
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +180 -14
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +3 -22
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-incident-drills.ts +26 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +50 -8
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +122 -18
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +218 -41
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +20 -2
- package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +13 -2
- package/dist/bundling-sources/shared_libs/play-runtime/tool-call/receipt-cohort.ts +181 -326
- package/dist/bundling-sources/shared_libs/play-runtime/tool-call/runtime-step-receipts-adapter.ts +38 -151
- package/dist/bundling-sources/shared_libs/play-runtime/worker-api-types.ts +8 -0
- package/dist/bundling-sources/shared_libs/security/secret-redaction.ts +89 -1
- package/dist/cli/index.js +28 -3
- package/dist/cli/index.mjs +28 -3
- package/dist/{client-B0AjIkgb.d.mts → client-Cl-zj2oS.d.mts} +4 -0
- package/dist/{client-BCXQ_Ftc.d.ts → client-T2jVnZrq.d.ts} +4 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +25 -1
- package/dist/index.mjs +25 -1
- package/dist/install-integrity.json +2 -2
- package/dist/plays/run-request.d.mts +1 -1
- package/dist/plays/run-request.d.ts +1 -1
- 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 +1 -1
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts
CHANGED
|
@@ -35,6 +35,7 @@ import { runtimeWorkCountersFromStats } from '../runtime-work-counters';
|
|
|
35
35
|
import {
|
|
36
36
|
buildPlayRunLedgerEventsFromStatusPatch,
|
|
37
37
|
createEmptyPlayRunLedgerSnapshot,
|
|
38
|
+
type PlayMapRowActivitySource,
|
|
38
39
|
type PlayRunLedgerEvent,
|
|
39
40
|
} from '../run-ledger';
|
|
40
41
|
import {
|
|
@@ -186,6 +187,21 @@ function callsInFlightMessage(input: {
|
|
|
186
187
|
: `${active} calls in flight`;
|
|
187
188
|
}
|
|
188
189
|
|
|
190
|
+
function mapRowProgressMessage(input: {
|
|
191
|
+
completed: number;
|
|
192
|
+
total: number | undefined;
|
|
193
|
+
supersededRows?: number;
|
|
194
|
+
activeRows?: number;
|
|
195
|
+
}): string | undefined {
|
|
196
|
+
const settled = rowsProcessedMessage(
|
|
197
|
+
input.completed,
|
|
198
|
+
input.total,
|
|
199
|
+
input.supersededRows,
|
|
200
|
+
);
|
|
201
|
+
if (input.activeRows === undefined) return settled;
|
|
202
|
+
return `${settled ?? `${input.completed.toLocaleString()} rows processed`} · ${input.activeRows.toLocaleString()} rows processing`;
|
|
203
|
+
}
|
|
204
|
+
|
|
189
205
|
export type PostgresSchedulerProgressReporter = {
|
|
190
206
|
/**
|
|
191
207
|
* Consume one raw runner event. Synchronous and cheap on purpose: this is
|
|
@@ -426,6 +442,10 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
426
442
|
let deferredFlushTimer: ReturnType<typeof setTimeout> | null = null;
|
|
427
443
|
let totalRows = 0;
|
|
428
444
|
let activeMapNodeId: string | null = null;
|
|
445
|
+
// Private per-node provenance, reset for each map invocation. Tool-batch
|
|
446
|
+
// cardinality is call evidence; an explicit resolver sample owns row counts.
|
|
447
|
+
const mapsWithResolverActivity = new Set<string>();
|
|
448
|
+
const mapInvocationIds = new Map<string, string>();
|
|
429
449
|
let pendingDatasetLifecycleEvents: Array<
|
|
430
450
|
Extract<
|
|
431
451
|
PlayExecutionEvent,
|
|
@@ -688,6 +708,18 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
688
708
|
...(current.waitingRows !== undefined
|
|
689
709
|
? { waitingRows: current.waitingRows }
|
|
690
710
|
: {}),
|
|
711
|
+
...(current.rowActivitySource !== undefined
|
|
712
|
+
? { rowActivitySource: current.rowActivitySource }
|
|
713
|
+
: {}),
|
|
714
|
+
...(current.mapInvocationId !== undefined
|
|
715
|
+
? { mapInvocationId: current.mapInvocationId }
|
|
716
|
+
: {}),
|
|
717
|
+
...(current.rowActivityStartedAt !== undefined
|
|
718
|
+
? { rowActivityStartedAt: current.rowActivityStartedAt }
|
|
719
|
+
: {}),
|
|
720
|
+
...(current.rowActivityObservedAt !== undefined
|
|
721
|
+
? { rowActivityObservedAt: current.rowActivityObservedAt }
|
|
722
|
+
: {}),
|
|
691
723
|
...(current.completedRows !== undefined
|
|
692
724
|
? { completedRows: current.completedRows }
|
|
693
725
|
: {}),
|
|
@@ -719,6 +751,21 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
719
751
|
...(patch.waitingRows !== undefined
|
|
720
752
|
? { waitingRows: patch.waitingRows }
|
|
721
753
|
: {}),
|
|
754
|
+
...(patch.rowActivitySource !== undefined
|
|
755
|
+
? { rowActivitySource: patch.rowActivitySource }
|
|
756
|
+
: {}),
|
|
757
|
+
...(mapInvocationIds.has(nodeId)
|
|
758
|
+
? { mapInvocationId: mapInvocationIds.get(nodeId) }
|
|
759
|
+
: {}),
|
|
760
|
+
...(patch.mapInvocationId !== undefined
|
|
761
|
+
? { mapInvocationId: patch.mapInvocationId }
|
|
762
|
+
: {}),
|
|
763
|
+
...(patch.rowActivityStartedAt !== undefined
|
|
764
|
+
? { rowActivityStartedAt: patch.rowActivityStartedAt }
|
|
765
|
+
: {}),
|
|
766
|
+
...(patch.rowActivityObservedAt !== undefined
|
|
767
|
+
? { rowActivityObservedAt: patch.rowActivityObservedAt }
|
|
768
|
+
: {}),
|
|
722
769
|
...(patch.completedRows !== undefined
|
|
723
770
|
? { completedRows: patch.completedRows }
|
|
724
771
|
: {}),
|
|
@@ -758,6 +805,15 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
758
805
|
);
|
|
759
806
|
stepLifecycle.markPreDatasetStepsStarted();
|
|
760
807
|
|
|
808
|
+
const sourceForMapLog = (nodeId: string): PlayMapRowActivitySource => {
|
|
809
|
+
if (mapsWithResolverActivity.has(nodeId)) return 'resolver';
|
|
810
|
+
// Coalescing must retain a witnessed map start, settlement or resume in
|
|
811
|
+
// this batch. Otherwise its subsequent compatibility log hides the fact
|
|
812
|
+
// that resets the preceding batch's resolver authority.
|
|
813
|
+
const current = liveNodeProgress[nodeId]?.rowActivitySource;
|
|
814
|
+
return current === 'map_event' || current === 'map_start' ? current : 'log';
|
|
815
|
+
};
|
|
816
|
+
|
|
761
817
|
const markMapStartedFromLog = (line: string) => {
|
|
762
818
|
const match = line.match(MAP_START_LOG_PATTERN);
|
|
763
819
|
if (!match) {
|
|
@@ -795,18 +851,26 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
795
851
|
);
|
|
796
852
|
const failed = Math.max(0, Number(current.failed ?? 0));
|
|
797
853
|
const settled = completed + failed;
|
|
854
|
+
const startedRows = Math.max(Number(current.startedRows ?? 0), settled);
|
|
798
855
|
setNodeProgress(nodeRef.nodeId, {
|
|
799
856
|
completed,
|
|
800
857
|
failed,
|
|
801
858
|
total: effectiveTotal > 0 ? effectiveTotal : undefined,
|
|
802
|
-
|
|
803
|
-
|
|
859
|
+
rowActivitySource: sourceForMapLog(nodeRef.nodeId),
|
|
860
|
+
startedRows,
|
|
861
|
+
activeRows: current.activeRows ?? 0,
|
|
804
862
|
waitingRows:
|
|
805
|
-
effectiveTotal > 0
|
|
863
|
+
effectiveTotal > 0
|
|
864
|
+
? Math.max(0, effectiveTotal - startedRows)
|
|
865
|
+
: undefined,
|
|
806
866
|
completedRows: completed,
|
|
807
867
|
artifactTableNamespace: nodeRef.artifactTableNamespace,
|
|
808
868
|
startedAt: current.startedAt ?? Date.now(),
|
|
809
|
-
message:
|
|
869
|
+
message: mapRowProgressMessage({
|
|
870
|
+
completed,
|
|
871
|
+
total: effectiveTotal,
|
|
872
|
+
activeRows: current.activeRows,
|
|
873
|
+
}),
|
|
810
874
|
});
|
|
811
875
|
};
|
|
812
876
|
|
|
@@ -837,23 +901,31 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
837
901
|
const completed = Math.max(0, Number(current.completed ?? 0));
|
|
838
902
|
const failed = Math.max(0, Number(current.failed ?? 0));
|
|
839
903
|
const settled = completed + failed;
|
|
904
|
+
const startedRows = Math.max(Number(current.startedRows ?? 0), settled);
|
|
840
905
|
setNodeProgress(nodeRef.nodeId, {
|
|
841
906
|
completed,
|
|
842
907
|
failed,
|
|
843
908
|
total: effectiveTotal > 0 ? effectiveTotal : undefined,
|
|
844
|
-
|
|
845
|
-
|
|
909
|
+
rowActivitySource: sourceForMapLog(nodeRef.nodeId),
|
|
910
|
+
startedRows,
|
|
911
|
+
activeRows: current.activeRows ?? 0,
|
|
846
912
|
waitingRows:
|
|
847
|
-
effectiveTotal > 0
|
|
913
|
+
effectiveTotal > 0
|
|
914
|
+
? Math.max(0, effectiveTotal - startedRows)
|
|
915
|
+
: undefined,
|
|
848
916
|
completedRows: completed,
|
|
849
917
|
artifactTableNamespace: nodeRef.artifactTableNamespace,
|
|
850
918
|
startedAt: current.startedAt ?? Date.now(),
|
|
851
|
-
message:
|
|
919
|
+
message: mapRowProgressMessage({
|
|
920
|
+
completed,
|
|
921
|
+
total: effectiveTotal,
|
|
922
|
+
activeRows: current.activeRows,
|
|
923
|
+
}),
|
|
852
924
|
});
|
|
853
925
|
};
|
|
854
926
|
|
|
855
927
|
const markToolBatchInFlightFromLog = (line: string) => {
|
|
856
|
-
if (!activeMapNodeId) {
|
|
928
|
+
if (!activeMapNodeId || mapsWithResolverActivity.has(activeMapNodeId)) {
|
|
857
929
|
return;
|
|
858
930
|
}
|
|
859
931
|
const match = line.match(PLAY_TOOL_BATCH_LOG_PATTERN);
|
|
@@ -876,6 +948,7 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
876
948
|
settled + activeRows,
|
|
877
949
|
);
|
|
878
950
|
setNodeProgress(activeMapNodeId, {
|
|
951
|
+
rowActivitySource: sourceForMapLog(activeMapNodeId),
|
|
879
952
|
startedRows: total > 0 ? Math.min(total, startedRows) : startedRows,
|
|
880
953
|
activeRows,
|
|
881
954
|
waitingRows:
|
|
@@ -1007,6 +1080,7 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
1007
1080
|
if (!nodeId) {
|
|
1008
1081
|
return;
|
|
1009
1082
|
}
|
|
1083
|
+
mapInvocationIds.set(nodeId, event.mapInvocationId);
|
|
1010
1084
|
activeMapNodeId = nodeId;
|
|
1011
1085
|
const eventTotalRows = 'totalRows' in event ? event.totalRows : undefined;
|
|
1012
1086
|
if (
|
|
@@ -1021,11 +1095,15 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
1021
1095
|
event.type === 'map.started' ||
|
|
1022
1096
|
event.type === 'map.resumed'
|
|
1023
1097
|
) {
|
|
1098
|
+
mapsWithResolverActivity.delete(nodeId);
|
|
1024
1099
|
stepLifecycle.onMapStarted(nodeId);
|
|
1025
1100
|
setNodeProgress(nodeId, {
|
|
1026
1101
|
completed: event.completedRows,
|
|
1027
1102
|
failed: 0,
|
|
1028
1103
|
total: eventTotalRows,
|
|
1104
|
+
rowActivitySource: 'map_start',
|
|
1105
|
+
rowActivityStartedAt: event.at,
|
|
1106
|
+
rowActivityObservedAt: event.at,
|
|
1029
1107
|
startedRows: event.completedRows + (event.supersededRows ?? 0),
|
|
1030
1108
|
activeRows: 0,
|
|
1031
1109
|
waitingRows:
|
|
@@ -1055,6 +1133,13 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
1055
1133
|
return;
|
|
1056
1134
|
}
|
|
1057
1135
|
if (event.type === 'map.progress') {
|
|
1136
|
+
if (
|
|
1137
|
+
event.startedRows !== undefined ||
|
|
1138
|
+
event.activeRows !== undefined ||
|
|
1139
|
+
event.waitingRows !== undefined
|
|
1140
|
+
) {
|
|
1141
|
+
mapsWithResolverActivity.add(nodeId);
|
|
1142
|
+
}
|
|
1058
1143
|
const current = liveNodeProgress[nodeId] ?? {};
|
|
1059
1144
|
const settled = Math.max(
|
|
1060
1145
|
0,
|
|
@@ -1066,32 +1151,42 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
1066
1151
|
: 0,
|
|
1067
1152
|
Number(current.total ?? 0),
|
|
1068
1153
|
);
|
|
1069
|
-
const startedRows = Math.max(
|
|
1070
|
-
|
|
1154
|
+
const startedRows = Math.max(
|
|
1155
|
+
settled,
|
|
1156
|
+
Number(event.startedRows ?? current.startedRows ?? 0),
|
|
1157
|
+
);
|
|
1158
|
+
const activeRows = Math.max(0, event.activeRows ?? startedRows - settled);
|
|
1071
1159
|
setNodeProgress(nodeId, {
|
|
1072
1160
|
completed: event.completedRows,
|
|
1073
1161
|
failed: event.failedRows,
|
|
1074
1162
|
total: progressTotalRows > 0 ? progressTotalRows : undefined,
|
|
1163
|
+
rowActivitySource: mapsWithResolverActivity.has(nodeId)
|
|
1164
|
+
? 'resolver'
|
|
1165
|
+
: 'map_event',
|
|
1166
|
+
rowActivityObservedAt: event.at,
|
|
1075
1167
|
startedRows,
|
|
1076
1168
|
activeRows,
|
|
1077
1169
|
waitingRows:
|
|
1078
|
-
|
|
1170
|
+
event.waitingRows ??
|
|
1171
|
+
(progressTotalRows > 0
|
|
1079
1172
|
? Math.max(0, progressTotalRows - startedRows)
|
|
1080
|
-
: undefined,
|
|
1173
|
+
: undefined),
|
|
1081
1174
|
completedRows: event.completedRows,
|
|
1082
1175
|
...(event.supersededRows !== undefined
|
|
1083
1176
|
? { supersededRows: event.supersededRows }
|
|
1084
1177
|
: {}),
|
|
1085
1178
|
artifactTableNamespace: event.artifactTableNamespace,
|
|
1086
|
-
message:
|
|
1087
|
-
event.completedRows,
|
|
1088
|
-
progressTotalRows,
|
|
1089
|
-
event.supersededRows,
|
|
1090
|
-
|
|
1179
|
+
message: mapRowProgressMessage({
|
|
1180
|
+
completed: event.completedRows,
|
|
1181
|
+
total: progressTotalRows,
|
|
1182
|
+
supersededRows: event.supersededRows,
|
|
1183
|
+
activeRows: event.activeRows,
|
|
1184
|
+
}),
|
|
1091
1185
|
});
|
|
1092
1186
|
return;
|
|
1093
1187
|
}
|
|
1094
1188
|
if (event.type === 'map.completed' || event.type === 'map.failed') {
|
|
1189
|
+
mapsWithResolverActivity.delete(nodeId);
|
|
1095
1190
|
if (event.type === 'map.failed') {
|
|
1096
1191
|
stepLifecycle.onMapFailed(nodeId);
|
|
1097
1192
|
} else {
|
|
@@ -1109,6 +1204,8 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
1109
1204
|
completed: event.completedRows,
|
|
1110
1205
|
failed: event.failedRows,
|
|
1111
1206
|
total: event.totalRows,
|
|
1207
|
+
rowActivitySource: 'map_event',
|
|
1208
|
+
rowActivityObservedAt: event.at,
|
|
1112
1209
|
startedRows:
|
|
1113
1210
|
terminalTotal > 0
|
|
1114
1211
|
? Math.min(terminalTotal, processedRows)
|
|
@@ -1131,10 +1228,14 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
1131
1228
|
return;
|
|
1132
1229
|
}
|
|
1133
1230
|
if (event.type === 'map.suspended') {
|
|
1231
|
+
mapsWithResolverActivity.add(nodeId);
|
|
1134
1232
|
setNodeProgress(nodeId, {
|
|
1135
1233
|
completed: event.completedRows,
|
|
1136
1234
|
failed: event.failedRows,
|
|
1137
1235
|
total: event.totalRows,
|
|
1236
|
+
activeRows: 0,
|
|
1237
|
+
rowActivitySource: 'resolver',
|
|
1238
|
+
rowActivityObservedAt: event.at,
|
|
1138
1239
|
completedRows: event.completedRows,
|
|
1139
1240
|
artifactTableNamespace: event.artifactTableNamespace,
|
|
1140
1241
|
message: rowsProcessedMessage(event.completedRows, event.totalRows),
|
|
@@ -1339,6 +1440,8 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
1339
1440
|
completed,
|
|
1340
1441
|
failed,
|
|
1341
1442
|
total: total > 0 ? total : undefined,
|
|
1443
|
+
rowActivitySource: 'map_event',
|
|
1444
|
+
mapInvocationId: frame.mapInvocationId,
|
|
1342
1445
|
startedRows: total > 0 ? total : completed + failed,
|
|
1343
1446
|
activeRows: 0,
|
|
1344
1447
|
waitingRows: 0,
|
|
@@ -1413,6 +1516,7 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
1413
1516
|
completed,
|
|
1414
1517
|
failed,
|
|
1415
1518
|
total: total > 0 ? total : undefined,
|
|
1519
|
+
rowActivitySource: 'map_event',
|
|
1416
1520
|
startedRows: total > 0 ? total : completed + failed + supersededRows,
|
|
1417
1521
|
activeRows: 0,
|
|
1418
1522
|
waitingRows: 0,
|