mcp-scraper 0.79.2 → 0.79.4
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/CHANGELOG.md +11 -0
- package/README.md +1 -1
- package/dist/{analytics-repository-VEUDEPWI.js → analytics-repository-YOY5KMOD.js} +3 -3
- package/dist/bin/api-server.js +4 -4
- package/dist/bin/mcp-scraper-cli.js +1 -1
- package/dist/bin/mcp-scraper-core.js +7 -7
- package/dist/bin/mcp-scraper-install.js +2 -2
- package/dist/bin/mcp-stdio-server.js +7 -7
- package/dist/bin/paa-harvest.js +3 -3
- package/dist/{chunk-LB2GNACG.js → chunk-3423R23T.js} +3 -3
- package/dist/{chunk-NGLZ6UJR.js → chunk-5UAFBKJR.js} +1 -1
- package/dist/{chunk-B6L73AO4.js → chunk-6HAV7LCE.js} +3 -1
- package/dist/{chunk-Q5L2OCOQ.js → chunk-C5Z4OFKW.js} +1 -1
- package/dist/{chunk-KAGHJQFO.js → chunk-EQGTEHLZ.js} +1 -1
- package/dist/{chunk-6FL7ZZCF.js → chunk-ETQ7J2EB.js} +1 -1
- package/dist/{chunk-BTQ23KCT.js → chunk-F5GQJWZU.js} +1 -1
- package/dist/{chunk-DUWZQSSJ.js → chunk-HEUMDX4I.js} +1 -1
- package/dist/{chunk-OUBH6XMY.js → chunk-K3Z5AQYE.js} +1 -1
- package/dist/{chunk-WEEAXPWK.js → chunk-KNGTQD6U.js} +207 -36
- package/dist/{chunk-2RTELL6M.js → chunk-N63ZFFU2.js} +1 -1
- package/dist/{chunk-47ZCUBM5.js → chunk-NVUKO5NN.js} +12 -1
- package/dist/{chunk-XUM2LEGU.js → chunk-PQVLX5WT.js} +3 -3
- package/dist/{chunk-JECPQBLZ.js → chunk-RUBI3OXR.js} +138 -11
- package/dist/{chunk-SL7YVA4S.js → chunk-YBR32LOD.js} +1 -1
- package/dist/{chunk-OU4FV2RP.js → chunk-YXNDOQXN.js} +49 -0
- package/dist/{db-TA567JLA.js → db-Z34LPZNR.js} +5 -1
- package/dist/{extract-bundle-I2GNC25L.js → extract-bundle-S3ZGNFML.js} +3 -3
- package/dist/{gmail-service-GGQVJUC3.js → gmail-service-YFS2OV4S.js} +4 -4
- package/dist/index.cjs +205 -34
- package/dist/index.d.cts +35 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +3 -3
- package/dist/{lead-list-enrichment-repository-5LEWW4X7.js → lead-list-enrichment-repository-36RPVV6N.js} +2 -2
- package/dist/{location-data-repository-AHKDXTEQ.js → location-data-repository-WPRG62GE.js} +2 -2
- package/dist/{server-5OSHEEVT.js → server-BMQKWVCZ.js} +73 -28
- package/dist/{site-extract-repository-KF736IR6.js → site-extract-repository-WAJMIDPJ.js} +2 -2
- package/dist/{worker-2TYCYFPM.js → worker-3LUFQWWJ.js} +5 -5
- package/package.json +2 -2
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
} from "./chunk-T3MZISOF.js";
|
|
20
20
|
import {
|
|
21
21
|
sanitizeOutboundDiagnostics
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-6HAV7LCE.js";
|
|
23
23
|
import {
|
|
24
24
|
MC_PER_CREDIT,
|
|
25
25
|
PAA_BASE_CREDITS,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
import {
|
|
35
35
|
recordVendorUsage,
|
|
36
36
|
vendorCostUsd
|
|
37
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-5UAFBKJR.js";
|
|
38
38
|
import {
|
|
39
39
|
buildSerpEmailQuery,
|
|
40
40
|
classifyEmailScope,
|
|
@@ -45,14 +45,14 @@ import {
|
|
|
45
45
|
} from "./chunk-VXLU74YZ.js";
|
|
46
46
|
import {
|
|
47
47
|
PACKAGE_VERSION
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-N63ZFFU2.js";
|
|
49
49
|
import {
|
|
50
50
|
PUBLIC_ERROR_CODES,
|
|
51
51
|
buildPublicErrorEnvelope,
|
|
52
52
|
normalizePublicErrorCode,
|
|
53
53
|
publicErrorMessage,
|
|
54
54
|
sanitizeVendorName
|
|
55
|
-
} from "./chunk-
|
|
55
|
+
} from "./chunk-YXNDOQXN.js";
|
|
56
56
|
|
|
57
57
|
// src/harvest-timeout.ts
|
|
58
58
|
var SCRAPE_FUNCTION_MAX_MS = 8e5;
|
|
@@ -1139,9 +1139,64 @@ function publicPaaLifecycle(value) {
|
|
|
1139
1139
|
knownQuestions: finiteNonNegative(row.knownQuestions) ?? questionsFound,
|
|
1140
1140
|
processedQuestions: finiteNonNegative(row.processedQuestions) ?? 0,
|
|
1141
1141
|
failedInteractions: finiteNonNegative(row.failedInteractions) ?? 0,
|
|
1142
|
-
noGrowthConfirmations: finiteNonNegative(row.noGrowthConfirmations) ?? 0
|
|
1142
|
+
noGrowthConfirmations: finiteNonNegative(row.noGrowthConfirmations) ?? 0,
|
|
1143
|
+
visibleControls: finiteNonNegative(row.visibleControls) ?? 0,
|
|
1144
|
+
eligibleControls: finiteNonNegative(row.eligibleControls) ?? 0,
|
|
1145
|
+
dispatchedInteractions: finiteNonNegative(row.dispatchedInteractions) ?? 0,
|
|
1146
|
+
confirmedInteractions: finiteNonNegative(row.confirmedInteractions) ?? 0,
|
|
1147
|
+
unconfirmedInteractions: finiteNonNegative(row.unconfirmedInteractions) ?? 0
|
|
1143
1148
|
};
|
|
1144
1149
|
}
|
|
1150
|
+
function publicPaaInteraction(value) {
|
|
1151
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
1152
|
+
const row = value;
|
|
1153
|
+
const id = nullableBoundedString(row.id, 200);
|
|
1154
|
+
const question = nullableBoundedString(row.question, 2e3);
|
|
1155
|
+
if (!id || !question) return null;
|
|
1156
|
+
const outcome = row.outcome === "confirmed" || row.outcome === "unconfirmed" || row.outcome === "dispatch_failed" ? row.outcome : "unconfirmed";
|
|
1157
|
+
const allowedSignals = /* @__PURE__ */ new Set(["expanded", "answer", "source", "question_growth"]);
|
|
1158
|
+
return {
|
|
1159
|
+
id,
|
|
1160
|
+
questionId: nullableBoundedString(row.questionId, 100) ?? "",
|
|
1161
|
+
question,
|
|
1162
|
+
batchNumber: finiteNonNegative(row.batchNumber) ?? 0,
|
|
1163
|
+
controlAttempt: finiteNonNegative(row.controlAttempt) ?? 0,
|
|
1164
|
+
observedAt: nullableBoundedString(row.observedAt, 100),
|
|
1165
|
+
dispatched: row.dispatched === true,
|
|
1166
|
+
outcome,
|
|
1167
|
+
confirmationSignals: Array.isArray(row.confirmationSignals) ? row.confirmationSignals.filter((signal) => typeof signal === "string" && allowedSignals.has(signal)) : [],
|
|
1168
|
+
confirmationCheckpointMs: finiteNonNegative(row.confirmationCheckpointMs),
|
|
1169
|
+
confirmedAtMs: finiteNonNegative(row.confirmedAtMs),
|
|
1170
|
+
dispatchDurationMs: finiteNonNegative(row.dispatchDurationMs) ?? 0,
|
|
1171
|
+
totalDurationMs: finiteNonNegative(row.totalDurationMs) ?? 0,
|
|
1172
|
+
beforeQuestionCount: finiteNonNegative(row.beforeQuestionCount) ?? 0,
|
|
1173
|
+
afterQuestionCount: finiteNonNegative(row.afterQuestionCount) ?? 0,
|
|
1174
|
+
newQuestionCount: finiteNonNegative(row.newQuestionCount) ?? 0,
|
|
1175
|
+
expandedBefore: row.expandedBefore === true,
|
|
1176
|
+
expandedAfter: row.expandedAfter === true,
|
|
1177
|
+
answerObserved: row.answerObserved === true,
|
|
1178
|
+
sourceCount: finiteNonNegative(row.sourceCount) ?? 0,
|
|
1179
|
+
errorCode: nullableBoundedString(row.errorCode, 100)
|
|
1180
|
+
};
|
|
1181
|
+
}
|
|
1182
|
+
function publicPaaInteractionSummary(value) {
|
|
1183
|
+
const row = structuredRecord(value);
|
|
1184
|
+
return Object.fromEntries([
|
|
1185
|
+
"observations",
|
|
1186
|
+
"dispatched",
|
|
1187
|
+
"confirmed",
|
|
1188
|
+
"unconfirmed",
|
|
1189
|
+
"dispatchFailures",
|
|
1190
|
+
"confirmedWithoutDispatchAck",
|
|
1191
|
+
"expandedSignals",
|
|
1192
|
+
"answerSignals",
|
|
1193
|
+
"sourceSignals",
|
|
1194
|
+
"questionGrowthBatches",
|
|
1195
|
+
"checkpoint700ms",
|
|
1196
|
+
"checkpoint1000ms",
|
|
1197
|
+
"checkpoint1400ms"
|
|
1198
|
+
].map((key) => [key, finiteNonNegative(row[key]) ?? 0]));
|
|
1199
|
+
}
|
|
1145
1200
|
function publicPaaSource(value) {
|
|
1146
1201
|
if (!value || typeof value !== "object") return null;
|
|
1147
1202
|
const source = value;
|
|
@@ -1318,6 +1373,11 @@ function durablePaaProgress(result, options) {
|
|
|
1318
1373
|
row.source_cite ?? row.sourceCite ?? row.source_site ?? row.sourceSite ?? row.source_url ?? row.sourceUrl
|
|
1319
1374
|
) !== null).length;
|
|
1320
1375
|
const lifecycle = publicPaaLifecycle(diagnostics.paaLifecycle ?? structuredRecord(result.progress).lifecycle);
|
|
1376
|
+
const rawProgress = structuredRecord(result.progress);
|
|
1377
|
+
const interactions = Array.isArray(rawProgress.interactions) ? rawProgress.interactions.flatMap((value) => {
|
|
1378
|
+
const interaction = publicPaaInteraction(value);
|
|
1379
|
+
return interaction ? [interaction] : [];
|
|
1380
|
+
}) : [];
|
|
1321
1381
|
if (lifecycle) {
|
|
1322
1382
|
lifecycle.automaticRetries = Math.max(
|
|
1323
1383
|
finiteNonNegative(lifecycle.automaticRetries) ?? 0,
|
|
@@ -1331,7 +1391,9 @@ function durablePaaProgress(result, options) {
|
|
|
1331
1391
|
sourcedQuestions: sourced,
|
|
1332
1392
|
missingAnswers: finiteNonNegative(completeness.paaWithoutAnswer ?? completeness.missingAnswers) ?? Math.max(0, captured - answered),
|
|
1333
1393
|
missingSources: finiteNonNegative(completeness.paaWithoutSource ?? completeness.missingSources) ?? Math.max(0, captured - sourced),
|
|
1334
|
-
lifecycle
|
|
1394
|
+
lifecycle,
|
|
1395
|
+
interactionSummary: publicPaaInteractionSummary(rawProgress.interactionSummary),
|
|
1396
|
+
recentInteractions: interactions.slice(-20)
|
|
1335
1397
|
};
|
|
1336
1398
|
}
|
|
1337
1399
|
function durablePaaResult(result) {
|
|
@@ -1356,11 +1418,14 @@ function durablePaaAttempts(value) {
|
|
|
1356
1418
|
if (!entry || typeof entry !== "object" || Array.isArray(entry)) return [];
|
|
1357
1419
|
const row = entry;
|
|
1358
1420
|
return [{
|
|
1421
|
+
attemptId: nullableBoundedString(row.id ?? row.attemptId, 200) ?? "",
|
|
1359
1422
|
attemptNumber: finiteNonNegative(row.attempt_number ?? row.attemptNumber) ?? index + 1,
|
|
1423
|
+
status: nullableBoundedString(row.status, 100),
|
|
1360
1424
|
outcome: nullableBoundedString(row.outcome),
|
|
1361
1425
|
questionCount: finiteNonNegative(row.question_count ?? row.questionCount),
|
|
1362
1426
|
provider: nullableBoundedString(row.browser_provider ?? row.provider, 100),
|
|
1363
1427
|
providerSessionId: nullableBoundedString(row.provider_session_id ?? row.providerSessionId, 200),
|
|
1428
|
+
providerSessionObservedAt: nullableBoundedString(row.provider_session_observed_at ?? row.providerSessionObservedAt, 100),
|
|
1364
1429
|
providerLookupStatus: nullableBoundedString(row.provider_lookup_status ?? row.providerLookupStatus, 100),
|
|
1365
1430
|
providerStatus: nullableBoundedString(row.provider_status ?? row.providerStatus, 100),
|
|
1366
1431
|
providerErrorCode: nullableBoundedString(row.provider_error_code ?? row.providerErrorCode, 100),
|
|
@@ -1371,7 +1436,10 @@ function durablePaaAttempts(value) {
|
|
|
1371
1436
|
providerBandwidthBytes: finiteNonNegative(row.provider_bandwidth_bytes ?? row.providerBandwidthBytes),
|
|
1372
1437
|
providerCaptcha: typeof (row.provider_captcha ?? row.providerCaptcha) === "boolean" ? row.provider_captcha ?? row.providerCaptcha : null,
|
|
1373
1438
|
providerCheckedAt: nullableBoundedString(row.provider_checked_at ?? row.providerCheckedAt, 100),
|
|
1374
|
-
willRetry: typeof (row.will_retry ?? row.willRetry) === "boolean" ? row.will_retry ?? row.willRetry : null
|
|
1439
|
+
willRetry: typeof (row.will_retry ?? row.willRetry) === "boolean" ? row.will_retry ?? row.willRetry : null,
|
|
1440
|
+
durationMs: finiteNonNegative(row.duration_ms ?? row.durationMs),
|
|
1441
|
+
startedAt: nullableBoundedString(row.created_at ?? row.startedAt, 100),
|
|
1442
|
+
completedAt: nullableBoundedString(row.completed_at ?? row.completedAt, 100)
|
|
1375
1443
|
}];
|
|
1376
1444
|
});
|
|
1377
1445
|
}
|
|
@@ -1401,6 +1469,8 @@ function formatHarvestPaaStart(raw) {
|
|
|
1401
1469
|
const state = durablePaaState(parsed.data.status ?? parsed.data.state);
|
|
1402
1470
|
const structuredContent = {
|
|
1403
1471
|
jobId,
|
|
1472
|
+
operationId: jobId,
|
|
1473
|
+
taskId: jobId,
|
|
1404
1474
|
status: durablePaaStatus(state),
|
|
1405
1475
|
replayed: parsed.data.replayed === true,
|
|
1406
1476
|
statusTool: "harvest_paa_status"
|
|
@@ -1429,6 +1499,8 @@ function formatHarvestPaaStatus(raw) {
|
|
|
1429
1499
|
const billingState = billingSettled ? billedMc === 0 ? "refunded" : "settled" : state === "failed" || state === "cancelled" ? "refund_pending" : holdMc !== null ? "held" : "unknown";
|
|
1430
1500
|
const structuredContent = {
|
|
1431
1501
|
jobId,
|
|
1502
|
+
operationId: jobId,
|
|
1503
|
+
taskId: jobId,
|
|
1432
1504
|
status: durablePaaStatus(state),
|
|
1433
1505
|
replayed: parsed.data.replayed === true,
|
|
1434
1506
|
progress,
|
|
@@ -8546,8 +8618,51 @@ var PaaLifecycleOutput = z6.object({
|
|
|
8546
8618
|
knownQuestions: z6.number().int().min(0),
|
|
8547
8619
|
processedQuestions: z6.number().int().min(0),
|
|
8548
8620
|
failedInteractions: z6.number().int().min(0),
|
|
8549
|
-
noGrowthConfirmations: z6.number().int().min(0)
|
|
8621
|
+
noGrowthConfirmations: z6.number().int().min(0),
|
|
8622
|
+
visibleControls: z6.number().int().min(0),
|
|
8623
|
+
eligibleControls: z6.number().int().min(0),
|
|
8624
|
+
dispatchedInteractions: z6.number().int().min(0),
|
|
8625
|
+
confirmedInteractions: z6.number().int().min(0),
|
|
8626
|
+
unconfirmedInteractions: z6.number().int().min(0)
|
|
8550
8627
|
}).nullable();
|
|
8628
|
+
var PaaInteractionSummaryOutput = z6.object({
|
|
8629
|
+
observations: z6.number().int().min(0),
|
|
8630
|
+
dispatched: z6.number().int().min(0),
|
|
8631
|
+
confirmed: z6.number().int().min(0),
|
|
8632
|
+
unconfirmed: z6.number().int().min(0),
|
|
8633
|
+
dispatchFailures: z6.number().int().min(0),
|
|
8634
|
+
confirmedWithoutDispatchAck: z6.number().int().min(0),
|
|
8635
|
+
expandedSignals: z6.number().int().min(0),
|
|
8636
|
+
answerSignals: z6.number().int().min(0),
|
|
8637
|
+
sourceSignals: z6.number().int().min(0),
|
|
8638
|
+
questionGrowthBatches: z6.number().int().min(0),
|
|
8639
|
+
checkpoint700ms: z6.number().int().min(0),
|
|
8640
|
+
checkpoint1000ms: z6.number().int().min(0),
|
|
8641
|
+
checkpoint1400ms: z6.number().int().min(0)
|
|
8642
|
+
});
|
|
8643
|
+
var PaaInteractionOutput = z6.object({
|
|
8644
|
+
id: z6.string(),
|
|
8645
|
+
questionId: z6.string(),
|
|
8646
|
+
question: z6.string(),
|
|
8647
|
+
batchNumber: z6.number().int().min(0),
|
|
8648
|
+
controlAttempt: z6.number().int().min(0),
|
|
8649
|
+
observedAt: NullableString,
|
|
8650
|
+
dispatched: z6.boolean(),
|
|
8651
|
+
outcome: z6.enum(["confirmed", "unconfirmed", "dispatch_failed"]),
|
|
8652
|
+
confirmationSignals: z6.array(z6.enum(["expanded", "answer", "source", "question_growth"])),
|
|
8653
|
+
confirmationCheckpointMs: z6.union([z6.literal(700), z6.literal(1e3), z6.literal(1400)]).nullable(),
|
|
8654
|
+
confirmedAtMs: z6.number().int().min(0).nullable(),
|
|
8655
|
+
dispatchDurationMs: z6.number().int().min(0),
|
|
8656
|
+
totalDurationMs: z6.number().int().min(0),
|
|
8657
|
+
beforeQuestionCount: z6.number().int().min(0),
|
|
8658
|
+
afterQuestionCount: z6.number().int().min(0),
|
|
8659
|
+
newQuestionCount: z6.number().int().min(0),
|
|
8660
|
+
expandedBefore: z6.boolean(),
|
|
8661
|
+
expandedAfter: z6.boolean(),
|
|
8662
|
+
answerObserved: z6.boolean(),
|
|
8663
|
+
sourceCount: z6.number().int().min(0),
|
|
8664
|
+
errorCode: z6.enum(["click_failed", "click_ack_timeout", "control_missing", "confirmation_timeout"]).nullable()
|
|
8665
|
+
});
|
|
8551
8666
|
var HarvestPaaOutputSchema = {
|
|
8552
8667
|
query: z6.string(),
|
|
8553
8668
|
location: NullableString,
|
|
@@ -8571,14 +8686,19 @@ var HarvestPaaDurableProgressOutput = z6.object({
|
|
|
8571
8686
|
sourcedQuestions: z6.number().int().min(0),
|
|
8572
8687
|
missingAnswers: z6.number().int().min(0),
|
|
8573
8688
|
missingSources: z6.number().int().min(0),
|
|
8574
|
-
lifecycle: PaaLifecycleOutput
|
|
8689
|
+
lifecycle: PaaLifecycleOutput,
|
|
8690
|
+
interactionSummary: PaaInteractionSummaryOutput,
|
|
8691
|
+
recentInteractions: z6.array(PaaInteractionOutput).max(20)
|
|
8575
8692
|
});
|
|
8576
8693
|
var HarvestPaaDurableAttemptOutput = z6.object({
|
|
8694
|
+
attemptId: z6.string(),
|
|
8577
8695
|
attemptNumber: z6.number().int().min(1),
|
|
8696
|
+
status: NullableString,
|
|
8578
8697
|
outcome: NullableString,
|
|
8579
8698
|
questionCount: z6.number().int().min(0).nullable(),
|
|
8580
8699
|
provider: NullableString,
|
|
8581
8700
|
providerSessionId: NullableString,
|
|
8701
|
+
providerSessionObservedAt: NullableString,
|
|
8582
8702
|
providerLookupStatus: NullableString,
|
|
8583
8703
|
providerStatus: NullableString,
|
|
8584
8704
|
providerErrorCode: NullableString,
|
|
@@ -8589,7 +8709,10 @@ var HarvestPaaDurableAttemptOutput = z6.object({
|
|
|
8589
8709
|
providerBandwidthBytes: z6.number().int().min(0).nullable(),
|
|
8590
8710
|
providerCaptcha: z6.boolean().nullable(),
|
|
8591
8711
|
providerCheckedAt: NullableString,
|
|
8592
|
-
willRetry: z6.boolean().nullable()
|
|
8712
|
+
willRetry: z6.boolean().nullable(),
|
|
8713
|
+
durationMs: z6.number().int().min(0).nullable(),
|
|
8714
|
+
startedAt: NullableString,
|
|
8715
|
+
completedAt: NullableString
|
|
8593
8716
|
});
|
|
8594
8717
|
var HarvestPaaDurableBillingOutput = z6.object({
|
|
8595
8718
|
state: z6.enum(["held", "settled", "refund_pending", "refunded", "unknown"]),
|
|
@@ -8647,6 +8770,8 @@ var HarvestPaaDurableStateOutput = z6.discriminatedUnion("state", [
|
|
|
8647
8770
|
]);
|
|
8648
8771
|
var HarvestPaaStartOutputSchema = {
|
|
8649
8772
|
jobId: z6.string(),
|
|
8773
|
+
operationId: z6.string(),
|
|
8774
|
+
taskId: z6.string(),
|
|
8650
8775
|
status: z6.object({
|
|
8651
8776
|
state: z6.enum(["pending", "running"]),
|
|
8652
8777
|
terminal: z6.literal(false),
|
|
@@ -8658,6 +8783,8 @@ var HarvestPaaStartOutputSchema = {
|
|
|
8658
8783
|
};
|
|
8659
8784
|
var HarvestPaaStatusOutputSchema = {
|
|
8660
8785
|
jobId: z6.string(),
|
|
8786
|
+
operationId: z6.string(),
|
|
8787
|
+
taskId: z6.string(),
|
|
8661
8788
|
status: HarvestPaaDurableStateOutput,
|
|
8662
8789
|
replayed: z6.boolean(),
|
|
8663
8790
|
progress: HarvestPaaDurableProgressOutput,
|
|
@@ -14436,7 +14563,7 @@ function registerPaaExtractorMcpTools(server, executor, options = {}) {
|
|
|
14436
14563
|
});
|
|
14437
14564
|
server.registerTool("harvest_paa_status", {
|
|
14438
14565
|
title: "Check Durable Google PAA Harvest",
|
|
14439
|
-
description: "Poll an owner-scoped harvest_paa_start job. Returns
|
|
14566
|
+
description: "Poll an owner-scoped harvest_paa_start job. Returns the job/operation/task correlation ID, saved progress, automatic-recovery count, target and discovery status, material completeness, recent per-control interaction outcomes with 0.7/1.0/1.4-second confirmation telemetry, provider-session-correlated attempts, terminal rows, and billing. frontier_exhausted means every observed eligible PAA control was processed plus three healthy no-growth confirmations; interruption never means exhaustion. Polling never starts or bills another run.",
|
|
14440
14567
|
inputSchema: HarvestPaaStatusInputSchema,
|
|
14441
14568
|
outputSchema: recordOutputSchema("harvest_paa_status", HarvestPaaStatusOutputSchema),
|
|
14442
14569
|
annotations: { ...liveWebToolAnnotations("Check Durable Google PAA Harvest"), idempotentHint: true, openWorldHint: false }
|
|
@@ -488,6 +488,7 @@ var CORE_SCHEMA_COLUMNS = {
|
|
|
488
488
|
"debug_json",
|
|
489
489
|
"browser_provider",
|
|
490
490
|
"provider_session_id",
|
|
491
|
+
"provider_session_observed_at",
|
|
491
492
|
"provider_lookup_status",
|
|
492
493
|
"provider_status",
|
|
493
494
|
"provider_error_code",
|
|
@@ -711,6 +712,7 @@ async function migrate(options = {}) {
|
|
|
711
712
|
debug_json TEXT,
|
|
712
713
|
browser_provider TEXT,
|
|
713
714
|
provider_session_id TEXT,
|
|
715
|
+
provider_session_observed_at TEXT,
|
|
714
716
|
provider_lookup_status TEXT,
|
|
715
717
|
provider_status TEXT,
|
|
716
718
|
provider_error_code TEXT,
|
|
@@ -737,6 +739,7 @@ async function migrate(options = {}) {
|
|
|
737
739
|
for (const column of [
|
|
738
740
|
"browser_provider TEXT",
|
|
739
741
|
"provider_session_id TEXT",
|
|
742
|
+
"provider_session_observed_at TEXT",
|
|
740
743
|
"provider_lookup_status TEXT",
|
|
741
744
|
"provider_status TEXT",
|
|
742
745
|
"provider_error_code TEXT",
|
|
@@ -1912,6 +1915,7 @@ function rowToHarvestAttemptLog(row) {
|
|
|
1912
1915
|
browser_close_error: row.browser_close_error != null ? String(row.browser_close_error) : null,
|
|
1913
1916
|
browser_provider: row.browser_provider != null ? String(row.browser_provider) : null,
|
|
1914
1917
|
provider_session_id: row.provider_session_id != null ? String(row.provider_session_id) : null,
|
|
1918
|
+
provider_session_observed_at: row.provider_session_observed_at != null ? String(row.provider_session_observed_at) : null,
|
|
1915
1919
|
provider_lookup_status: row.provider_lookup_status != null ? String(row.provider_lookup_status) : null,
|
|
1916
1920
|
provider_status: row.provider_status != null ? String(row.provider_status) : null,
|
|
1917
1921
|
provider_error_code: row.provider_error_code != null ? String(row.provider_error_code) : null,
|
|
@@ -1991,6 +1995,49 @@ async function startHarvestAttempt(input) {
|
|
|
1991
1995
|
]
|
|
1992
1996
|
});
|
|
1993
1997
|
}
|
|
1998
|
+
async function attachHarvestAttemptProviderSession(input) {
|
|
1999
|
+
const result = await getDb().execute({
|
|
2000
|
+
sql: `
|
|
2001
|
+
UPDATE harvest_attempts SET
|
|
2002
|
+
browser_provider = ?,
|
|
2003
|
+
provider_session_id = ?,
|
|
2004
|
+
provider_session_observed_at = COALESCE(provider_session_observed_at, ?),
|
|
2005
|
+
provider_lookup_status = CASE
|
|
2006
|
+
WHEN provider_lookup_status = 'complete' THEN provider_lookup_status
|
|
2007
|
+
ELSE 'pending'
|
|
2008
|
+
END
|
|
2009
|
+
WHERE job_id = ? AND attempt_number = ? AND status = 'running'
|
|
2010
|
+
`,
|
|
2011
|
+
args: [
|
|
2012
|
+
input.browserProvider,
|
|
2013
|
+
input.providerSessionId,
|
|
2014
|
+
input.observedAt,
|
|
2015
|
+
input.jobId,
|
|
2016
|
+
input.attemptNumber
|
|
2017
|
+
]
|
|
2018
|
+
});
|
|
2019
|
+
return result.rowsAffected === 1;
|
|
2020
|
+
}
|
|
2021
|
+
async function finalizeExpiredHarvestAttempts(jobId, willRetry, completedAt = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
2022
|
+
const result = await getDb().execute({
|
|
2023
|
+
sql: `
|
|
2024
|
+
UPDATE harvest_attempts SET
|
|
2025
|
+
status = 'finished',
|
|
2026
|
+
outcome = COALESCE(outcome, 'timeout'),
|
|
2027
|
+
question_count = COALESCE(question_count, 0),
|
|
2028
|
+
duration_ms = COALESCE(duration_ms, MAX(0, CAST((julianday(?) - julianday(created_at)) * 86400000 AS INTEGER))),
|
|
2029
|
+
error = COALESCE(error, 'Durable worker lease expired before attempt completion'),
|
|
2030
|
+
will_retry = ?,
|
|
2031
|
+
provider_error_code = COALESCE(provider_error_code, 'timeout'),
|
|
2032
|
+
provider_error_message = COALESCE(provider_error_message, 'Durable worker lease expired before attempt completion'),
|
|
2033
|
+
provider_reason_source = COALESCE(provider_reason_source, 'client_runtime'),
|
|
2034
|
+
completed_at = COALESCE(completed_at, ?)
|
|
2035
|
+
WHERE job_id = ? AND status = 'running'
|
|
2036
|
+
`,
|
|
2037
|
+
args: [completedAt, willRetry ? 1 : 0, completedAt, jobId]
|
|
2038
|
+
});
|
|
2039
|
+
return result.rowsAffected;
|
|
2040
|
+
}
|
|
1994
2041
|
async function finishHarvestAttempt(input) {
|
|
1995
2042
|
await getDb().execute({
|
|
1996
2043
|
sql: `
|
|
@@ -3869,6 +3916,8 @@ export {
|
|
|
3869
3916
|
createRunningJob,
|
|
3870
3917
|
getOrCreateRunningJob,
|
|
3871
3918
|
startHarvestAttempt,
|
|
3919
|
+
attachHarvestAttemptProviderSession,
|
|
3920
|
+
finalizeExpiredHarvestAttempts,
|
|
3872
3921
|
finishHarvestAttempt,
|
|
3873
3922
|
updateHarvestAttemptProviderTelemetry,
|
|
3874
3923
|
listHarvestAttemptsPendingProviderTelemetry,
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
SiteAuditPhaseLogRowSchema,
|
|
8
8
|
advanceWorkflowRunStep,
|
|
9
9
|
appendWorkflowArtifacts,
|
|
10
|
+
attachHarvestAttemptProviderSession,
|
|
10
11
|
cancelJob,
|
|
11
12
|
checkRateLimit,
|
|
12
13
|
checkpointDurablePaaJob,
|
|
@@ -49,6 +50,7 @@ import {
|
|
|
49
50
|
failRunningJob,
|
|
50
51
|
failStripeEvent,
|
|
51
52
|
failWorkflowRunRecord,
|
|
53
|
+
finalizeExpiredHarvestAttempts,
|
|
52
54
|
finishHarvestAttempt,
|
|
53
55
|
generateApiKey,
|
|
54
56
|
getBillingLedgerSummary,
|
|
@@ -137,7 +139,7 @@ import {
|
|
|
137
139
|
updateKpoJobState,
|
|
138
140
|
upsertPageSnapshot,
|
|
139
141
|
verifyPassword
|
|
140
|
-
} from "./chunk-
|
|
142
|
+
} from "./chunk-YXNDOQXN.js";
|
|
141
143
|
export {
|
|
142
144
|
CORE_SCHEMA_VERSION,
|
|
143
145
|
CREDIT_LOTS_EPOCH,
|
|
@@ -147,6 +149,7 @@ export {
|
|
|
147
149
|
SiteAuditPhaseLogRowSchema,
|
|
148
150
|
advanceWorkflowRunStep,
|
|
149
151
|
appendWorkflowArtifacts,
|
|
152
|
+
attachHarvestAttemptProviderSession,
|
|
150
153
|
cancelJob,
|
|
151
154
|
checkRateLimit,
|
|
152
155
|
checkpointDurablePaaJob,
|
|
@@ -189,6 +192,7 @@ export {
|
|
|
189
192
|
failRunningJob,
|
|
190
193
|
failStripeEvent,
|
|
191
194
|
failWorkflowRunRecord,
|
|
195
|
+
finalizeExpiredHarvestAttempts,
|
|
192
196
|
finishHarvestAttempt,
|
|
193
197
|
generateApiKey,
|
|
194
198
|
getBillingLedgerSummary,
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
downloadAsset,
|
|
5
5
|
embedCommonsTexts,
|
|
6
6
|
publicizeExtractionFailure
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-F5GQJWZU.js";
|
|
8
8
|
import {
|
|
9
9
|
createSiteExtractBundleArtifactStream,
|
|
10
10
|
createSiteExtractContentReader,
|
|
11
11
|
createSiteExtractImageArtifact,
|
|
12
12
|
extractJobLimitInfo
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-YBR32LOD.js";
|
|
14
14
|
import "./chunk-OZJMVCDK.js";
|
|
15
15
|
import {
|
|
16
16
|
computeIssues,
|
|
@@ -23,7 +23,7 @@ import "./chunk-VFCUGTCF.js";
|
|
|
23
23
|
import "./chunk-GGZEC22A.js";
|
|
24
24
|
import {
|
|
25
25
|
getDb
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-YXNDOQXN.js";
|
|
27
27
|
|
|
28
28
|
// src/api/extract-bundle.ts
|
|
29
29
|
import { createWriteStream, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "fs";
|
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
GmailServiceError,
|
|
8
8
|
normalizeGmailMessage,
|
|
9
9
|
parseGmailAddresses
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-3423R23T.js";
|
|
11
|
+
import "./chunk-C5Z4OFKW.js";
|
|
12
12
|
import "./chunk-T3MZISOF.js";
|
|
13
13
|
import "./chunk-VFCUGTCF.js";
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-5UAFBKJR.js";
|
|
15
|
+
import "./chunk-YXNDOQXN.js";
|
|
16
16
|
export {
|
|
17
17
|
GMAIL_ATTACHMENT_REF_TTL_MS,
|
|
18
18
|
GMAIL_INLINE_BODY_BYTES,
|