mcp-scraper 0.66.0 → 0.66.1

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.
Files changed (88) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +2 -2
  3. package/dist/{analytics-repository-IKE53S3E.js → analytics-repository-RUXBFSFX.js} +1 -2
  4. package/dist/bin/api-server.cjs +1648 -17
  5. package/dist/bin/api-server.js +4 -5
  6. package/dist/bin/mcp-scraper-cli.cjs +1 -2
  7. package/dist/bin/mcp-scraper-cli.js +6 -7
  8. package/dist/bin/mcp-scraper-install.cjs +7 -3
  9. package/dist/bin/mcp-scraper-install.js +2 -3
  10. package/dist/bin/mcp-stdio-server.cjs +1618 -14
  11. package/dist/bin/mcp-stdio-server.js +11 -12
  12. package/dist/bin/paa-harvest.cjs +0 -1
  13. package/dist/bin/paa-harvest.js +4 -5
  14. package/dist/{chunk-5PIO7QBG.js → chunk-3PIXKLGZ.js} +3 -4
  15. package/dist/{chunk-VIWT35S6.js → chunk-4OT7BAIE.js} +1 -2
  16. package/dist/{chunk-AJ4YGHG2.js → chunk-4P3PHFPQ.js} +3 -4
  17. package/dist/{chunk-P7YFUNKR.js → chunk-75VW7CWE.js} +3 -4
  18. package/dist/{chunk-FG6LJGJ7.js → chunk-77LQV73B.js} +0 -1
  19. package/dist/{chunk-DKIG2TEE.js → chunk-AQKJOSIB.js} +2 -3
  20. package/dist/{chunk-2XUXVKT4.js → chunk-AYJHI2FK.js} +0 -1
  21. package/dist/{chunk-5BEPOFKG.js → chunk-CNLLTD5B.js} +0 -1
  22. package/dist/{chunk-EKJ65E3Z.js → chunk-DNM65UCK.js} +0 -1
  23. package/dist/{chunk-SRRI2HJL.js → chunk-E4LMY5OJ.js} +1617 -19
  24. package/dist/{chunk-3YSEJTMC.js → chunk-GGZEC22A.js} +0 -1
  25. package/dist/{chunk-4VG3NUUY.js → chunk-GTGSD4YS.js} +2 -2
  26. package/dist/{chunk-XPFRP5QT.js → chunk-KBTUPRTF.js} +3 -4
  27. package/dist/{chunk-AAGVOPP5.js → chunk-NS754CRS.js} +2 -3
  28. package/dist/{chunk-BIUQ6O2Y.js → chunk-OZJMVCDK.js} +0 -1
  29. package/dist/{chunk-X7UG2JCF.js → chunk-PGJQDMC2.js} +1 -2
  30. package/dist/{chunk-G3P3ZDB4.js → chunk-RJ7JVYKU.js} +0 -1
  31. package/dist/{chunk-N54JS5WP.js → chunk-TNJIPV74.js} +1 -2
  32. package/dist/{chunk-4LINSJNI.js → chunk-TNLGHNLX.js} +1 -2
  33. package/dist/chunk-VRJ7CO6L.js +6 -0
  34. package/dist/{chunk-WD73OFL3.js → chunk-VXLU74YZ.js} +1 -2
  35. package/dist/{chunk-DCWXVAQT.js → chunk-WID3MFRS.js} +6 -2
  36. package/dist/{db-BRI465XQ.js → db-PO7N7ZP3.js} +1 -2
  37. package/dist/{extract-bundle-QAI7JYV2.js → extract-bundle-SIBFUA6I.js} +8 -9
  38. package/dist/index.cjs +0 -1
  39. package/dist/index.js +4 -5
  40. package/dist/{lead-list-enrichment-repository-ODWGRVCQ.js → lead-list-enrichment-repository-OTAUQONJ.js} +2 -3
  41. package/dist/{location-data-repository-67MMEVZQ.js → location-data-repository-RM2KJ3H5.js} +3 -4
  42. package/dist/{server-MTKWBSAR.js → server-ELEJNRRE.js} +57 -35
  43. package/dist/{site-extract-repository-J3RH3MOS.js → site-extract-repository-ASYEJO7Z.js} +4 -5
  44. package/dist/{worker-K7MPPQ7I.js → worker-MAVYYWM7.js} +8 -9
  45. package/package.json +3 -1
  46. package/dist/analytics-repository-IKE53S3E.js.map +0 -1
  47. package/dist/bin/api-server.cjs.map +0 -1
  48. package/dist/bin/api-server.js.map +0 -1
  49. package/dist/bin/mcp-scraper-cli.cjs.map +0 -1
  50. package/dist/bin/mcp-scraper-cli.js.map +0 -1
  51. package/dist/bin/mcp-scraper-install.cjs.map +0 -1
  52. package/dist/bin/mcp-scraper-install.js.map +0 -1
  53. package/dist/bin/mcp-stdio-server.cjs.map +0 -1
  54. package/dist/bin/mcp-stdio-server.js.map +0 -1
  55. package/dist/bin/paa-harvest.cjs.map +0 -1
  56. package/dist/bin/paa-harvest.js.map +0 -1
  57. package/dist/chunk-2XUXVKT4.js.map +0 -1
  58. package/dist/chunk-3YSEJTMC.js.map +0 -1
  59. package/dist/chunk-4LINSJNI.js.map +0 -1
  60. package/dist/chunk-4VG3NUUY.js.map +0 -1
  61. package/dist/chunk-5BEPOFKG.js.map +0 -1
  62. package/dist/chunk-5PIO7QBG.js.map +0 -1
  63. package/dist/chunk-AAGVOPP5.js.map +0 -1
  64. package/dist/chunk-AJ4YGHG2.js.map +0 -1
  65. package/dist/chunk-BIUQ6O2Y.js.map +0 -1
  66. package/dist/chunk-DCWXVAQT.js.map +0 -1
  67. package/dist/chunk-DKIG2TEE.js.map +0 -1
  68. package/dist/chunk-EKJ65E3Z.js.map +0 -1
  69. package/dist/chunk-FG6LJGJ7.js.map +0 -1
  70. package/dist/chunk-G3P3ZDB4.js.map +0 -1
  71. package/dist/chunk-HDYOVGC6.js +0 -7
  72. package/dist/chunk-HDYOVGC6.js.map +0 -1
  73. package/dist/chunk-N54JS5WP.js.map +0 -1
  74. package/dist/chunk-P7YFUNKR.js.map +0 -1
  75. package/dist/chunk-SRRI2HJL.js.map +0 -1
  76. package/dist/chunk-VIWT35S6.js.map +0 -1
  77. package/dist/chunk-WD73OFL3.js.map +0 -1
  78. package/dist/chunk-X7UG2JCF.js.map +0 -1
  79. package/dist/chunk-XPFRP5QT.js.map +0 -1
  80. package/dist/db-BRI465XQ.js.map +0 -1
  81. package/dist/extract-bundle-QAI7JYV2.js.map +0 -1
  82. package/dist/index.cjs.map +0 -1
  83. package/dist/index.js.map +0 -1
  84. package/dist/lead-list-enrichment-repository-ODWGRVCQ.js.map +0 -1
  85. package/dist/location-data-repository-67MMEVZQ.js.map +0 -1
  86. package/dist/server-MTKWBSAR.js.map +0 -1
  87. package/dist/site-extract-repository-J3RH3MOS.js.map +0 -1
  88. package/dist/worker-K7MPPQ7I.js.map +0 -1
@@ -213,4 +213,3 @@ export {
213
213
  validatePublicHttpUrl,
214
214
  loadHtmlDocument
215
215
  };
216
- //# sourceMappingURL=chunk-3YSEJTMC.js.map
@@ -186,8 +186,9 @@ function publicErrorMessage(code) {
186
186
  case "proxy_unavailable":
187
187
  return "The web request could not establish a working connection. Please retry later.";
188
188
  case "harvest_timeout":
189
- case "mcp_request_timeout":
190
189
  return "The request timed out before it completed. Please retry with a smaller request.";
190
+ case "mcp_request_timeout":
191
+ return "The MCP caller stopped waiting before a final response arrived. Durable work may still be running; continue with the returned Task or job handle instead of restarting it.";
191
192
  case "concurrency_limit_exceeded":
192
193
  return "The service is available, but this account has reached its parallel-operation limit. Wait for an active operation to finish or add capacity.";
193
194
  case "unauthorized":
@@ -3573,4 +3574,3 @@ export {
3573
3574
  insertInboxMessage,
3574
3575
  listActiveUserIds
3575
3576
  };
3576
- //# sourceMappingURL=chunk-4VG3NUUY.js.map
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  rowsToCsv
3
- } from "./chunk-G3P3ZDB4.js";
3
+ } from "./chunk-RJ7JVYKU.js";
4
4
  import {
5
5
  DEFAULT_MAPS_PROXY_MODE,
6
6
  postToMemoryLibrary
7
- } from "./chunk-FG6LJGJ7.js";
7
+ } from "./chunk-77LQV73B.js";
8
8
  import {
9
9
  buildSerpEmailQuery,
10
10
  contactAttemptUrls,
11
11
  extractContactEvidence,
12
12
  extractSerpEmailEvidence,
13
13
  selectPrimaryEmail
14
- } from "./chunk-WD73OFL3.js";
14
+ } from "./chunk-VXLU74YZ.js";
15
15
 
16
16
  // src/lib/slugify.ts
17
17
  function slugify(s) {
@@ -1913,4 +1913,3 @@ export {
1913
1913
  runWorkflow,
1914
1914
  runWorkflowStep
1915
1915
  };
1916
- //# sourceMappingURL=chunk-XPFRP5QT.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isVendorUnavailableError
3
- } from "./chunk-BIUQ6O2Y.js";
3
+ } from "./chunk-OZJMVCDK.js";
4
4
  import {
5
5
  CaptchaError,
6
6
  LocationMismatchError,
@@ -10,7 +10,7 @@ import {
10
10
  finishHarvestAttempt,
11
11
  publicErrorMessage,
12
12
  startHarvestAttempt
13
- } from "./chunk-4VG3NUUY.js";
13
+ } from "./chunk-GTGSD4YS.js";
14
14
 
15
15
  // src/api/webhook.ts
16
16
  async function deliverWebhook(url, payload, retries = 3) {
@@ -235,4 +235,3 @@ export {
235
235
  publicErrorBoundary,
236
236
  createHarvestAttemptRecorder
237
237
  };
238
- //# sourceMappingURL=chunk-AAGVOPP5.js.map
@@ -14,4 +14,3 @@ function isVendorUnavailableError(err, message) {
14
14
  export {
15
15
  isVendorUnavailableError
16
16
  };
17
- //# sourceMappingURL=chunk-BIUQ6O2Y.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  validatePublicHttpUrl
3
- } from "./chunk-3YSEJTMC.js";
3
+ } from "./chunk-GGZEC22A.js";
4
4
 
5
5
  // src/api/image-audit.ts
6
6
  var OVER_BYTES = 100 * 1024;
@@ -381,4 +381,3 @@ export {
381
381
  computeIssues,
382
382
  renderIssueReport
383
383
  };
384
- //# sourceMappingURL=chunk-X7UG2JCF.js.map
@@ -66,4 +66,3 @@ export {
66
66
  csvRecords,
67
67
  rowsToCsv
68
68
  };
69
- //# sourceMappingURL=chunk-G3P3ZDB4.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getDb
3
- } from "./chunk-4VG3NUUY.js";
3
+ } from "./chunk-GTGSD4YS.js";
4
4
 
5
5
  // src/api/lead-list-enrichment-repository.ts
6
6
  import { createHash, randomUUID } from "crypto";
@@ -590,4 +590,3 @@ export {
590
590
  markLeadListEnrichmentOutboxDispatched,
591
591
  markLeadListEnrichmentOutboxFailed
592
592
  };
593
- //# sourceMappingURL=chunk-N54JS5WP.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getDb
3
- } from "./chunk-4VG3NUUY.js";
3
+ } from "./chunk-GTGSD4YS.js";
4
4
 
5
5
  // src/lib/browser-service-env.ts
6
6
  function browserServiceApiKey() {
@@ -275,4 +275,3 @@ export {
275
275
  recordKernelSession,
276
276
  recordVendorUsage
277
277
  };
278
- //# sourceMappingURL=chunk-4LINSJNI.js.map
@@ -0,0 +1,6 @@
1
+ // src/version.ts
2
+ var PACKAGE_VERSION = "0.66.1";
3
+
4
+ export {
5
+ PACKAGE_VERSION
6
+ };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  isPrivateIpAddress,
3
3
  loadHtmlDocument
4
- } from "./chunk-3YSEJTMC.js";
4
+ } from "./chunk-GGZEC22A.js";
5
5
 
6
6
  // src/lib/contact-evidence.ts
7
7
  var MAX_EMAILS = 20;
@@ -291,4 +291,3 @@ export {
291
291
  buildSerpEmailQuery,
292
292
  extractSerpEmailEvidence
293
293
  };
294
- //# sourceMappingURL=chunk-WD73OFL3.js.map
@@ -1,3 +1,8 @@
1
+ // release-message.json
2
+ var release_message_default = {
3
+ message: "Long PAA research now continues as a durable MCP Task with preserved progress, while transient browser interruptions return specific retry guidance instead of a generic outage."
4
+ };
5
+
1
6
  // src/install-terminal.ts
2
7
  var CODES = {
3
8
  reset: "\x1B[0m",
@@ -48,7 +53,7 @@ function renderInstallTerminal(options) {
48
53
  colorize(ascii, "amber", color),
49
54
  `${colorize("MCP Scraper Agent", "cyan", color)} . v${options.version} . mcpscraper.dev`,
50
55
  "1/1 install surfaces ready",
51
- colorize("Newest: any approved connection read can become an indexed Memory snapshot in one call. OAuth stays tenant-isolated and provider content is redacted and marked untrusted.", "lime", color),
56
+ colorize(`Newest in v${options.version}: ${release_message_default.message}`, "lime", color),
52
57
  "",
53
58
  `${colorize("Tools", "cyan", color)} ${colorize("(259 MCP tools)", "muted", color)}`,
54
59
  toolRow("search", ["harvest_paa", "search_serp", "maps_search", "maps_place_intel"], color),
@@ -106,4 +111,3 @@ function renderInstallTerminal(options) {
106
111
  export {
107
112
  renderInstallTerminal
108
113
  };
109
- //# sourceMappingURL=chunk-DCWXVAQT.js.map
@@ -126,7 +126,7 @@ import {
126
126
  updateKpoJobState,
127
127
  upsertPageSnapshot,
128
128
  verifyPassword
129
- } from "./chunk-4VG3NUUY.js";
129
+ } from "./chunk-GTGSD4YS.js";
130
130
  export {
131
131
  CORE_SCHEMA_VERSION,
132
132
  CREDIT_LOTS_EPOCH,
@@ -256,4 +256,3 @@ export {
256
256
  upsertPageSnapshot,
257
257
  verifyPassword
258
258
  };
259
- //# sourceMappingURL=db-BRI465XQ.js.map
@@ -4,26 +4,26 @@ import {
4
4
  downloadAsset,
5
5
  embedCommonsTexts,
6
6
  publicizeExtractionFailure
7
- } from "./chunk-P7YFUNKR.js";
8
- import "./chunk-BIUQ6O2Y.js";
7
+ } from "./chunk-75VW7CWE.js";
8
+ import "./chunk-OZJMVCDK.js";
9
9
  import {
10
10
  computeIssues,
11
11
  renderImageSection,
12
12
  renderIssueReport,
13
13
  renderLinkReport
14
- } from "./chunk-X7UG2JCF.js";
15
- import "./chunk-3YSEJTMC.js";
14
+ } from "./chunk-PGJQDMC2.js";
15
+ import "./chunk-GGZEC22A.js";
16
16
  import {
17
17
  createSiteExtractBundleArtifactStream,
18
18
  createSiteExtractContentReader,
19
19
  createSiteExtractImageArtifact,
20
20
  extractJobLimitInfo
21
- } from "./chunk-5PIO7QBG.js";
22
- import "./chunk-EKJ65E3Z.js";
23
- import "./chunk-2XUXVKT4.js";
21
+ } from "./chunk-3PIXKLGZ.js";
22
+ import "./chunk-DNM65UCK.js";
23
+ import "./chunk-AYJHI2FK.js";
24
24
  import {
25
25
  getDb
26
- } from "./chunk-4VG3NUUY.js";
26
+ } from "./chunk-GTGSD4YS.js";
27
27
 
28
28
  // src/api/extract-bundle.ts
29
29
  import { createWriteStream, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "fs";
@@ -1001,4 +1001,3 @@ export {
1001
1001
  SITE_EXTRACT_PAGE_CHUNK,
1002
1002
  assembleExtractArtifacts
1003
1003
  };
1004
- //# sourceMappingURL=extract-bundle-QAI7JYV2.js.map
package/dist/index.cjs CHANGED
@@ -4809,4 +4809,3 @@ var VideoGenerator = class {
4809
4809
  buildClipPrompts,
4810
4810
  harvest
4811
4811
  });
4812
- //# sourceMappingURL=index.cjs.map
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  harvest
3
- } from "./chunk-AJ4YGHG2.js";
3
+ } from "./chunk-4P3PHFPQ.js";
4
4
  import {
5
5
  recordVendorUsage
6
- } from "./chunk-4LINSJNI.js";
7
- import "./chunk-FG6LJGJ7.js";
8
- import "./chunk-4VG3NUUY.js";
6
+ } from "./chunk-TNLGHNLX.js";
7
+ import "./chunk-77LQV73B.js";
8
+ import "./chunk-GTGSD4YS.js";
9
9
 
10
10
  // src/video/VideoGenerator.ts
11
11
  import { execSync as execSync2 } from "child_process";
@@ -333,4 +333,3 @@ export {
333
333
  buildClipPrompts,
334
334
  harvest
335
335
  };
336
- //# sourceMappingURL=index.js.map
@@ -30,8 +30,8 @@ import {
30
30
  saveLeadListEnrichmentRowResult,
31
31
  setInitializingLeadListEnrichmentConcurrencyLock,
32
32
  stableCanonicalJson
33
- } from "./chunk-N54JS5WP.js";
34
- import "./chunk-4VG3NUUY.js";
33
+ } from "./chunk-TNJIPV74.js";
34
+ import "./chunk-GTGSD4YS.js";
35
35
  export {
36
36
  LEAD_LIST_MAX_DISPATCH_ATTEMPTS,
37
37
  LEAD_LIST_RUNNING_STALE_MINUTES,
@@ -65,4 +65,3 @@ export {
65
65
  setInitializingLeadListEnrichmentConcurrencyLock,
66
66
  stableCanonicalJson
67
67
  };
68
- //# sourceMappingURL=lead-list-enrichment-repository-ODWGRVCQ.js.map
@@ -13,9 +13,9 @@ import {
13
13
  parseHostedCensusPlacesCsv,
14
14
  parseHostedZipGroupsCsv,
15
15
  queryHostedLocationMarkets
16
- } from "./chunk-DKIG2TEE.js";
17
- import "./chunk-G3P3ZDB4.js";
18
- import "./chunk-4VG3NUUY.js";
16
+ } from "./chunk-AQKJOSIB.js";
17
+ import "./chunk-RJ7JVYKU.js";
18
+ import "./chunk-GTGSD4YS.js";
19
19
  export {
20
20
  HOSTED_CENSUS_DATASET_PREFIX,
21
21
  HOSTED_ZIP_DATASET_KIND,
@@ -32,4 +32,3 @@ export {
32
32
  parseHostedZipGroupsCsv,
33
33
  queryHostedLocationMarkets
34
34
  };
35
- //# sourceMappingURL=location-data-repository-67MMEVZQ.js.map
@@ -10,13 +10,13 @@ import {
10
10
  queuedCommonsDocumentCount,
11
11
  semanticCommonsEntityScores,
12
12
  typeFromMime
13
- } from "./chunk-P7YFUNKR.js";
13
+ } from "./chunk-75VW7CWE.js";
14
14
  import {
15
15
  REQUIRED_LOCATION_STATE_CODES,
16
16
  importHostedCensusPlacesCsv,
17
17
  importHostedZipGroupsCsv,
18
18
  listActiveHostedLocationDatasets
19
- } from "./chunk-DKIG2TEE.js";
19
+ } from "./chunk-AQKJOSIB.js";
20
20
  import {
21
21
  cancelPendingLeadListEnrichmentRows,
22
22
  claimLeadListEnrichmentOutbox,
@@ -43,7 +43,7 @@ import {
43
43
  saveLeadListEnrichmentRowResult,
44
44
  setInitializingLeadListEnrichmentConcurrencyLock,
45
45
  stableCanonicalJson
46
- } from "./chunk-N54JS5WP.js";
46
+ } from "./chunk-TNJIPV74.js";
47
47
  import {
48
48
  ANALYTICS_CONTENT_SORTS,
49
49
  AnalyticsRepositoryError,
@@ -99,7 +99,7 @@ import {
99
99
  updateAnalyticsPixel,
100
100
  upsertAnalyticsAdSpend,
101
101
  verifySession
102
- } from "./chunk-5BEPOFKG.js";
102
+ } from "./chunk-CNLLTD5B.js";
103
103
  import {
104
104
  classifyHarvestProblem,
105
105
  createHarvestAttemptRecorder,
@@ -108,8 +108,8 @@ import {
108
108
  harvestProblemResponse,
109
109
  publicErrorBoundary,
110
110
  serializeHarvestProblem
111
- } from "./chunk-AAGVOPP5.js";
112
- import "./chunk-BIUQ6O2Y.js";
111
+ } from "./chunk-NS754CRS.js";
112
+ import "./chunk-OZJMVCDK.js";
113
113
  import {
114
114
  AIModeSelectors,
115
115
  AIOverviewSelectors,
@@ -137,7 +137,7 @@ import {
137
137
  resolveKernelProxyId,
138
138
  serpArrivalUrl,
139
139
  withRuntimeUserAgent
140
- } from "./chunk-AJ4YGHG2.js";
140
+ } from "./chunk-4P3PHFPQ.js";
141
141
  import {
142
142
  ApiErrorResponseSchema,
143
143
  ArtifactTemplatePresetKeySchema,
@@ -209,18 +209,18 @@ import {
209
209
  resolveDeploymentProfile,
210
210
  resolveLocalSourcebookSchemaType,
211
211
  transcribeMediaUrl
212
- } from "./chunk-SRRI2HJL.js";
212
+ } from "./chunk-E4LMY5OJ.js";
213
213
  import {
214
214
  auditImageUrls,
215
215
  auditImages,
216
216
  buildLinkReport,
217
217
  computeIssues
218
- } from "./chunk-X7UG2JCF.js";
218
+ } from "./chunk-PGJQDMC2.js";
219
219
  import {
220
220
  sanitizeAttempts,
221
221
  sanitizeHarvestResult,
222
222
  sanitizeOutboundDiagnostics
223
- } from "./chunk-VIWT35S6.js";
223
+ } from "./chunk-4OT7BAIE.js";
224
224
  import {
225
225
  browserServiceApiKey,
226
226
  browserServiceProfileName,
@@ -230,7 +230,7 @@ import {
230
230
  recordKernelSession,
231
231
  recordVendorUsage,
232
232
  runWithCostContext
233
- } from "./chunk-4LINSJNI.js";
233
+ } from "./chunk-TNLGHNLX.js";
234
234
  import {
235
235
  listWorkflowDefinitions,
236
236
  runWorkflow,
@@ -240,12 +240,12 @@ import {
240
240
  workflowOutputBaseDir,
241
241
  workflowStepCount,
242
242
  workflowSupportsSteps
243
- } from "./chunk-XPFRP5QT.js";
243
+ } from "./chunk-KBTUPRTF.js";
244
244
  import {
245
245
  csvRecords,
246
246
  parseCsv,
247
247
  rowsToCsv
248
- } from "./chunk-G3P3ZDB4.js";
248
+ } from "./chunk-RJ7JVYKU.js";
249
249
  import {
250
250
  DEFAULT_MAPS_PROXY_MODE,
251
251
  DEFAULT_PROXY_MODE,
@@ -255,18 +255,18 @@ import {
255
255
  RawMapsHoursRowSchema,
256
256
  RawMapsOverviewSchema,
257
257
  RawMapsReviewStatsSchema
258
- } from "./chunk-FG6LJGJ7.js";
258
+ } from "./chunk-77LQV73B.js";
259
259
  import {
260
260
  extractContactEvidence
261
- } from "./chunk-WD73OFL3.js";
261
+ } from "./chunk-VXLU74YZ.js";
262
262
  import {
263
263
  isPrivateIpAddress,
264
264
  loadHtmlDocument,
265
265
  validatePublicHttpUrl
266
- } from "./chunk-3YSEJTMC.js";
266
+ } from "./chunk-GGZEC22A.js";
267
267
  import {
268
268
  PACKAGE_VERSION
269
- } from "./chunk-HDYOVGC6.js";
269
+ } from "./chunk-VRJ7CO6L.js";
270
270
  import {
271
271
  SITE_EXTRACT_ARTIFACT_PREFIX,
272
272
  abandonExtractSettlement,
@@ -297,14 +297,14 @@ import {
297
297
  setExtractJobTotal,
298
298
  settleExtractJob,
299
299
  terminalExtractJobStatus
300
- } from "./chunk-5PIO7QBG.js";
300
+ } from "./chunk-3PIXKLGZ.js";
301
301
  import {
302
302
  createPrivateArtifact,
303
303
  privateArtifactOwnerId,
304
304
  readPrivateArtifactBuffer,
305
305
  readPrivateArtifactWindow,
306
306
  renewPrivateArtifactDownload
307
- } from "./chunk-EKJ65E3Z.js";
307
+ } from "./chunk-DNM65UCK.js";
308
308
  import {
309
309
  BROWSER_OPEN_MIN_BALANCE_MC,
310
310
  CONCURRENCY_PACK_INVOICE_DESCRIPTION,
@@ -357,7 +357,7 @@ import {
357
357
  tierChangeLeavesPrivateOffer,
358
358
  tierCreditsPerInterval,
359
359
  vendorCostUsdToMc
360
- } from "./chunk-2XUXVKT4.js";
360
+ } from "./chunk-AYJHI2FK.js";
361
361
  import {
362
362
  CaptchaError,
363
363
  MapsSearchIncompletePageError,
@@ -463,7 +463,7 @@ import {
463
463
  startHarvestAttempt,
464
464
  upsertPageSnapshot,
465
465
  verifyPassword
466
- } from "./chunk-4VG3NUUY.js";
466
+ } from "./chunk-GTGSD4YS.js";
467
467
 
468
468
  // src/blog/registry.ts
469
469
  var posts = [
@@ -9554,7 +9554,7 @@ var siteExtractFn = inngest.createFunction(
9554
9554
  });
9555
9555
  }) : null;
9556
9556
  const finalized = await step.run("finalize", async () => {
9557
- const { assembleExtractArtifacts } = await import("./extract-bundle-QAI7JYV2.js");
9557
+ const { assembleExtractArtifacts } = await import("./extract-bundle-SIBFUA6I.js");
9558
9558
  const current = await getExtractJob(jobId2);
9559
9559
  if (!current) throw new Error("extract job disappeared before finalization");
9560
9560
  const stored = await assembleExtractArtifacts(current, { branding, imageAudit });
@@ -10514,7 +10514,7 @@ async function resolveUsZipsPath(requestedPath) {
10514
10514
  async function loadZipGroups(stateAbbr, requestedPath, warnings, sourceMode) {
10515
10515
  const mode = resolvedLocationDataMode({ zipSource: sourceMode });
10516
10516
  if (mode === "hosted") {
10517
- const { getHostedZipGroups } = await import("./location-data-repository-67MMEVZQ.js");
10517
+ const { getHostedZipGroups } = await import("./location-data-repository-RM2KJ3H5.js");
10518
10518
  const hosted = await getHostedZipGroups(stateAbbr);
10519
10519
  if (!hosted.dataset) {
10520
10520
  throw new DirectoryLocationError(
@@ -10577,7 +10577,7 @@ async function resolveDirectoryMarkets(options, config = {}) {
10577
10577
  const sourceUrl = censusStateUrl(state.fips);
10578
10578
  const warnings = [];
10579
10579
  if (resolvedLocationDataMode(config) === "hosted") {
10580
- const { queryHostedLocationMarkets } = await import("./location-data-repository-67MMEVZQ.js");
10580
+ const { queryHostedLocationMarkets } = await import("./location-data-repository-RM2KJ3H5.js");
10581
10581
  const hosted = await queryHostedLocationMarkets({
10582
10582
  state: state.abbr,
10583
10583
  minPopulation: options.minPopulation,
@@ -12064,7 +12064,7 @@ function summarizePersistedLeadRows(rows, warnings = []) {
12064
12064
  async function settlePersistedLeadListEnrichment(jobId2) {
12065
12065
  const jobs = await listLeadListEnrichmentJobsNeedingSettlement(100);
12066
12066
  const job = jobs.find((candidate) => candidate.id === jobId2);
12067
- const { getLeadListEnrichmentJob: getLeadListEnrichmentJob2 } = await import("./lead-list-enrichment-repository-ODWGRVCQ.js");
12067
+ const { getLeadListEnrichmentJob: getLeadListEnrichmentJob2 } = await import("./lead-list-enrichment-repository-OTAUQONJ.js");
12068
12068
  const current = job ?? await getLeadListEnrichmentJob2(jobId2);
12069
12069
  if (!current) return null;
12070
12070
  const rows = await listLeadListEnrichmentRows(jobId2);
@@ -12120,7 +12120,7 @@ async function reconcileLeadListEnrichmentSettlements(limit = 25) {
12120
12120
  const persisted = job.result ?? summarizePersistedLeadRows(rows, job.warnings);
12121
12121
  const status = job.cancelRequestedAt ? "cancelled" : persisted.failedRows > 0 && persisted.completeRows > 0 ? "partial" : persisted.failedRows > 0 ? "cancelled" : persisted.rowsWithContacts > 0 ? "complete" : "empty";
12122
12122
  if (persisted.failedRows > 0 && persisted.completeRows === 0 && !job.cancelRequestedAt) {
12123
- const { failLeadListEnrichmentJob: failLeadListEnrichmentJob2 } = await import("./lead-list-enrichment-repository-ODWGRVCQ.js");
12123
+ const { failLeadListEnrichmentJob: failLeadListEnrichmentJob2 } = await import("./lead-list-enrichment-repository-OTAUQONJ.js");
12124
12124
  await failLeadListEnrichmentJob2({
12125
12125
  jobId: job.id,
12126
12126
  errorCode: "lead_list_all_rows_failed",
@@ -48651,8 +48651,6 @@ app.post("/harvest", auth4, async (c) => {
48651
48651
  if (checked.error) return c.json({ error: checked.error }, 400);
48652
48652
  body.callback_url = checked.parsed?.href;
48653
48653
  }
48654
- const limitErr = await checkHarvestLimits(user, c.req.header("x-mcp-scraper-concurrency-lock"));
48655
- if (limitErr) return c.json(limitErr, 429, { "Retry-After": "30" });
48656
48654
  const options = {
48657
48655
  query: body.query.trim(),
48658
48656
  location: body.location,
@@ -48674,6 +48672,26 @@ app.post("/harvest", auth4, async (c) => {
48674
48672
  includeAiOverview: body.includeAiOverview ?? false,
48675
48673
  includeWhatPeopleSaying: body.includeWhatPeopleSaying ?? false
48676
48674
  };
48675
+ const suppliedIdempotencyKey = c.req.header("idempotency-key") ?? c.req.header("x-idempotency-key");
48676
+ let derivedJobId = null;
48677
+ let requestFingerprint3 = null;
48678
+ if (!options.serpOnly && suppliedIdempotencyKey != null) {
48679
+ const trimmedKey = suppliedIdempotencyKey.trim();
48680
+ if (!trimmedKey || trimmedKey.length > 200) {
48681
+ return c.json({ error: "Idempotency-Key must contain 1-200 characters.", errorCode: "invalid_idempotency_key", retryable: false }, 400);
48682
+ }
48683
+ derivedJobId = `paa-${sha256Hex(`${user.id}\0${trimmedKey}`).slice(0, 24)}`;
48684
+ requestFingerprint3 = sha256Hex(JSON.stringify({ options, callbackUrl: body.callback_url ?? null }));
48685
+ const existing = await getJob(derivedJobId, user.id);
48686
+ if (existing) {
48687
+ if (existing.options.requestFingerprint !== requestFingerprint3) {
48688
+ return c.json({ error: "Idempotency-Key was already used for a different asynchronous harvest_paa call.", errorCode: "idempotency_conflict", retryable: false }, 409);
48689
+ }
48690
+ return c.json({ job_id: existing.id, status: existing.status, replayed: true }, ["done", "failed", "cancelled"].includes(existing.status) ? 200 : 202);
48691
+ }
48692
+ }
48693
+ const limitErr = await checkHarvestLimits(user, c.req.header("x-mcp-scraper-concurrency-lock"));
48694
+ if (limitErr) return c.json(limitErr, 429, { "Retry-After": "30" });
48677
48695
  const harvestCost = options.serpOnly ? MC_COSTS.serp_headful : paaCostForQuestionCount(options.maxQuestions);
48678
48696
  let jobId2;
48679
48697
  if (options.serpOnly) {
@@ -48686,7 +48704,7 @@ app.post("/harvest", auth4, async (c) => {
48686
48704
  if (!harvestOk) return c.json(insufficientBalanceResponse(harvestBal, harvestCost), 402);
48687
48705
  jobId2 = await createJob(user.id, options.query, { ...options, billingHoldMc: harvestCost }, body.callback_url);
48688
48706
  } else {
48689
- jobId2 = randomUUID28();
48707
+ jobId2 = derivedJobId ?? randomUUID28();
48690
48708
  const billingDebitKey = `paa-harvest:${jobId2}:hold`;
48691
48709
  const description = `PAA harvest: ${options.query}`.slice(0, 500);
48692
48710
  const hold = await debitMcIdempotent(
@@ -48702,9 +48720,14 @@ app.post("/harvest", auth4, async (c) => {
48702
48720
  ...options,
48703
48721
  executionOwner: "inngest",
48704
48722
  billingHoldMc: harvestCost,
48705
- billingDebitKey
48723
+ billingDebitKey,
48724
+ ...requestFingerprint3 ? { requestFingerprint: requestFingerprint3 } : {}
48706
48725
  }, body.callback_url);
48707
48726
  } catch (error) {
48727
+ const existing = derivedJobId ? await getJob(derivedJobId, user.id).catch(() => null) : null;
48728
+ if (existing && existing.options.requestFingerprint === requestFingerprint3) {
48729
+ return c.json({ job_id: existing.id, status: existing.status, replayed: true }, 202);
48730
+ }
48708
48731
  await settleDebitMcIdempotent(
48709
48732
  user.id,
48710
48733
  billingDebitKey,
@@ -50237,7 +50260,7 @@ app.get("/cron/tick", async (c) => {
50237
50260
  return c.json({ error: "Unauthorized" }, 401);
50238
50261
  }
50239
50262
  const startedAt = Date.now();
50240
- const { drainQueue } = await import("./worker-K7MPPQ7I.js");
50263
+ const { drainQueue } = await import("./worker-MAVYYWM7.js");
50241
50264
  const budget = { maxJobs: 10, deadlineMs: startedAt + CRON_TICK_DRAIN_BUDGET_MS };
50242
50265
  const origin = `${new URL(c.req.url).protocol}//${new URL(c.req.url).host}`;
50243
50266
  const unfinished = [];
@@ -50317,8 +50340,8 @@ app.post("/api/internal/extract-refinalize/:id", async (c) => {
50317
50340
  finishExtractJob: finishExtractJob2,
50318
50341
  terminalExtractJobStatus: terminalExtractJobStatus2,
50319
50342
  extractJobLimitInfo: extractJobLimitInfo2
50320
- } = await import("./site-extract-repository-J3RH3MOS.js");
50321
- const { assembleExtractArtifacts } = await import("./extract-bundle-QAI7JYV2.js");
50343
+ } = await import("./site-extract-repository-ASYEJO7Z.js");
50344
+ const { assembleExtractArtifacts } = await import("./extract-bundle-SIBFUA6I.js");
50322
50345
  const existing = await getExtractJob2(jobId2);
50323
50346
  if (!existing) return c.json({ error: "job not found" }, 404);
50324
50347
  if (existing.status !== "failed") {
@@ -50345,7 +50368,7 @@ app.post("/api/internal/extract-refinalize/:id", async (c) => {
50345
50368
  if (!updated) return c.json({ error: "job state changed during re-finalization" }, 409);
50346
50369
  let settlement = "already_settled_or_refunded";
50347
50370
  if (job.billedMc == null && job.userId != null) {
50348
- const { settleExtractJob: settleExtractJob3, countSuccessfulPages: countSuccessfulPages2 } = await import("./site-extract-repository-J3RH3MOS.js");
50371
+ const { settleExtractJob: settleExtractJob3, countSuccessfulPages: countSuccessfulPages2 } = await import("./site-extract-repository-ASYEJO7Z.js");
50349
50372
  const heldMc = Number(job.options.heldMc ?? 0);
50350
50373
  const successful = await countSuccessfulPages2(jobId2);
50351
50374
  const usedMc = Math.min(successful * MC_COSTS.page_scrape, heldMc);
@@ -50532,4 +50555,3 @@ app.get("/blog/:slug/", (c) => {
50532
50555
  export {
50533
50556
  app
50534
50557
  };
50535
- //# sourceMappingURL=server-MTKWBSAR.js.map
@@ -28,10 +28,10 @@ import {
28
28
  setExtractJobTotal,
29
29
  settleExtractJob,
30
30
  terminalExtractJobStatus
31
- } from "./chunk-5PIO7QBG.js";
32
- import "./chunk-EKJ65E3Z.js";
33
- import "./chunk-2XUXVKT4.js";
34
- import "./chunk-4VG3NUUY.js";
31
+ } from "./chunk-3PIXKLGZ.js";
32
+ import "./chunk-DNM65UCK.js";
33
+ import "./chunk-AYJHI2FK.js";
34
+ import "./chunk-GTGSD4YS.js";
35
35
  export {
36
36
  abandonExtractSettlement,
37
37
  claimFailedExtractJobForRefinalize,
@@ -63,4 +63,3 @@ export {
63
63
  settleExtractJob,
64
64
  terminalExtractJobStatus
65
65
  };
66
- //# sourceMappingURL=site-extract-repository-J3RH3MOS.js.map
@@ -5,24 +5,24 @@ import {
5
5
  harvestProblemEnvelope,
6
6
  harvestProblemResponse,
7
7
  serializeHarvestProblem
8
- } from "./chunk-AAGVOPP5.js";
9
- import "./chunk-BIUQ6O2Y.js";
8
+ } from "./chunk-NS754CRS.js";
9
+ import "./chunk-OZJMVCDK.js";
10
10
  import {
11
11
  harvest
12
- } from "./chunk-AJ4YGHG2.js";
12
+ } from "./chunk-4P3PHFPQ.js";
13
13
  import {
14
14
  sanitizeAttempts,
15
15
  sanitizeHarvestResult
16
- } from "./chunk-VIWT35S6.js";
16
+ } from "./chunk-4OT7BAIE.js";
17
17
  import {
18
18
  browserServiceApiKey,
19
19
  runWithCostContext
20
- } from "./chunk-4LINSJNI.js";
21
- import "./chunk-FG6LJGJ7.js";
20
+ } from "./chunk-TNLGHNLX.js";
21
+ import "./chunk-77LQV73B.js";
22
22
  import {
23
23
  MC_COSTS,
24
24
  serpActualCostMc
25
- } from "./chunk-2XUXVKT4.js";
25
+ } from "./chunk-AYJHI2FK.js";
26
26
  import {
27
27
  claimPendingJob,
28
28
  completeJob,
@@ -30,7 +30,7 @@ import {
30
30
  debitMc,
31
31
  failJob,
32
32
  listHarvestAttempts
33
- } from "./chunk-4VG3NUUY.js";
33
+ } from "./chunk-GTGSD4YS.js";
34
34
 
35
35
  // src/api/worker.ts
36
36
  var MAX_CONCURRENT = 2;
@@ -142,4 +142,3 @@ export {
142
142
  startWorker,
143
143
  tickOnce
144
144
  };
145
- //# sourceMappingURL=worker-K7MPPQ7I.js.map