mcp-scraper 0.55.0 → 0.56.0

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 (36) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +2 -2
  3. package/dist/bin/api-server.cjs +55 -20
  4. package/dist/bin/api-server.cjs.map +1 -1
  5. package/dist/bin/api-server.js +2 -2
  6. package/dist/bin/mcp-scraper-cli.cjs +1 -1
  7. package/dist/bin/mcp-scraper-cli.cjs.map +1 -1
  8. package/dist/bin/mcp-scraper-cli.js +1 -1
  9. package/dist/bin/mcp-scraper-install.cjs +2 -2
  10. package/dist/bin/mcp-scraper-install.cjs.map +1 -1
  11. package/dist/bin/mcp-scraper-install.js +2 -2
  12. package/dist/bin/mcp-stdio-server.cjs +26 -4
  13. package/dist/bin/mcp-stdio-server.cjs.map +1 -1
  14. package/dist/bin/mcp-stdio-server.js +4 -4
  15. package/dist/chunk-245IAJ7R.js +7 -0
  16. package/dist/chunk-245IAJ7R.js.map +1 -0
  17. package/dist/{chunk-WYLIDW4S.js → chunk-JEZW6N2X.js} +27 -5
  18. package/dist/chunk-JEZW6N2X.js.map +1 -0
  19. package/dist/{chunk-PGI2QPFE.js → chunk-LUJYVNO7.js} +2 -2
  20. package/dist/{chunk-PGI2QPFE.js.map → chunk-LUJYVNO7.js.map} +1 -1
  21. package/dist/{chunk-2FL5FXMV.js → chunk-NP66MZ5A.js} +2 -2
  22. package/dist/{chunk-N4LT53JX.js → chunk-WO2SSENO.js} +3 -3
  23. package/dist/{chunk-N4LT53JX.js.map → chunk-WO2SSENO.js.map} +1 -1
  24. package/dist/{extract-bundle-3CRG7FAN.js → extract-bundle-6KYTD55T.js} +3 -3
  25. package/dist/{server-WKBCZ2TH.js → server-SETYJPYO.js} +37 -24
  26. package/dist/{server-WKBCZ2TH.js.map → server-SETYJPYO.js.map} +1 -1
  27. package/dist/{site-extract-repository-QSRPXNMI.js → site-extract-repository-YGNYFTNE.js} +3 -3
  28. package/dist/{worker-W5C6SKZT.js → worker-DTVBN3RQ.js} +2 -2
  29. package/package.json +1 -1
  30. package/dist/chunk-V2QWNGEK.js +0 -7
  31. package/dist/chunk-V2QWNGEK.js.map +0 -1
  32. package/dist/chunk-WYLIDW4S.js.map +0 -1
  33. /package/dist/{chunk-2FL5FXMV.js.map → chunk-NP66MZ5A.js.map} +0 -0
  34. /package/dist/{extract-bundle-3CRG7FAN.js.map → extract-bundle-6KYTD55T.js.map} +0 -0
  35. /package/dist/{site-extract-repository-QSRPXNMI.js.map → site-extract-repository-YGNYFTNE.js.map} +0 -0
  36. /package/dist/{worker-W5C6SKZT.js.map → worker-DTVBN3RQ.js.map} +0 -0
@@ -169,7 +169,7 @@ import {
169
169
  resolveDeploymentProfile,
170
170
  resolveLocalSourcebookSchemaType,
171
171
  transcribeMediaUrl
172
- } from "./chunk-WYLIDW4S.js";
172
+ } from "./chunk-JEZW6N2X.js";
173
173
  import {
174
174
  auditImageUrls,
175
175
  auditImages,
@@ -225,7 +225,7 @@ import {
225
225
  } from "./chunk-FG6LJGJ7.js";
226
226
  import {
227
227
  PACKAGE_VERSION
228
- } from "./chunk-V2QWNGEK.js";
228
+ } from "./chunk-245IAJ7R.js";
229
229
  import {
230
230
  abandonExtractSettlement,
231
231
  countSuccessfulPages,
@@ -248,7 +248,7 @@ import {
248
248
  setExtractJobTotal,
249
249
  settleExtractJob,
250
250
  terminalExtractJobStatus
251
- } from "./chunk-2FL5FXMV.js";
251
+ } from "./chunk-NP66MZ5A.js";
252
252
  import {
253
253
  BROWSER_OPEN_MIN_BALANCE_MC,
254
254
  CONCURRENCY_PACK_INVOICE_DESCRIPTION,
@@ -301,7 +301,7 @@ import {
301
301
  tierChangeLeavesPrivateOffer,
302
302
  tierCreditsPerInterval,
303
303
  vendorCostUsdToMc
304
- } from "./chunk-N4LT53JX.js";
304
+ } from "./chunk-WO2SSENO.js";
305
305
  import {
306
306
  CaptchaError,
307
307
  MapsSearchIncompletePageError,
@@ -9393,7 +9393,7 @@ var siteExtractFn = inngest.createFunction(
9393
9393
  });
9394
9394
  }) : null;
9395
9395
  const finalized = await step.run("finalize", async () => {
9396
- const { assembleExtractArtifacts } = await import("./extract-bundle-3CRG7FAN.js");
9396
+ const { assembleExtractArtifacts } = await import("./extract-bundle-6KYTD55T.js");
9397
9397
  const current = await getExtractJob(jobId2);
9398
9398
  if (!current) throw new Error("extract job disappeared before finalization");
9399
9399
  const stored = await assembleExtractArtifacts(current, { branding, imageAudit });
@@ -33755,18 +33755,17 @@ async function validateCommonsEntity(input, user) {
33755
33755
  errors.push(`Unsupported placeholder sections must be omitted instead of published: ${placeholderSections.join(", ")}.`);
33756
33756
  }
33757
33757
  if (existing && input.baseRevision === void 0) {
33758
- warnings.push("An existing entity matches this slug or entityId. Submit will create a pending_review proposal unless the current baseRevision is supplied.");
33758
+ warnings.push(`An existing entity matches this slug or entityId. Submit will edit it on top of revision ${existing.revision} and record the edit on the contribution ledger.`);
33759
33759
  }
33760
33760
  if (existing && input.baseRevision !== void 0 && input.baseRevision !== existing.revision) {
33761
- warnings.push(`The matching entity is revision ${existing.revision}; this payload targets revision ${input.baseRevision}. Submit will be held for review.`);
33761
+ warnings.push(`The matching entity is revision ${existing.revision}; this payload targets revision ${input.baseRevision}. Submit will apply on top of revision ${existing.revision} and note the divergence on the ledger.`);
33762
33762
  }
33763
33763
  if (input.reviewPolicy === "always_review") {
33764
33764
  warnings.push("reviewPolicy is always_review, so the proposal will not auto-publish even if the payload is otherwise valid.");
33765
33765
  }
33766
33766
  if (user?.id == null) warnings.push("No authenticated user was supplied to validation; submit still requires API-key authenticated user context.");
33767
33767
  const valid = errors.length === 0;
33768
- const revisionAllowsAutoPublish = !existing || input.baseRevision === existing.revision;
33769
- const autoPublishEligible = valid && revisionAllowsAutoPublish && input.reviewPolicy !== "always_review";
33768
+ const autoPublishEligible = valid && input.reviewPolicy !== "always_review";
33770
33769
  const tagVocabulary = await commonsTagVocabulary();
33771
33770
  return {
33772
33771
  ok: true,
@@ -33826,6 +33825,7 @@ async function submitCommonsEntity(input, user) {
33826
33825
  entity: entity2,
33827
33826
  applied: existingProposal.status === "accepted",
33828
33827
  reviewReason: existingProposal.reviewReason,
33828
+ conflictNote: null,
33829
33829
  publicUrl: entity2?.status === "published" ? publicUrlForSlug(entity2.slug) : null
33830
33830
  };
33831
33831
  }
@@ -33899,7 +33899,7 @@ async function submitCommonsEntity(input, user) {
33899
33899
  ...changedFieldPaths(existing, nextEntity),
33900
33900
  ...normalized.claims !== void 0 ? ["claims"] : []
33901
33901
  ]),
33902
- normalized.changeSummary || (existing ? "Updated Commons entity." : "Created Commons entity."),
33902
+ ledgerSummary(normalized.changeSummary, existing, safety.conflictNote),
33903
33903
  existing ? JSON.stringify({
33904
33904
  ...entityLedgerSnapshot(existing),
33905
33905
  ...normalized.claims !== void 0 ? { claims: existingClaims } : {}
@@ -33922,6 +33922,7 @@ async function submitCommonsEntity(input, user) {
33922
33922
  entity,
33923
33923
  applied: shouldApply,
33924
33924
  reviewReason: safety.reason,
33925
+ conflictNote: safety.conflictNote,
33925
33926
  publicUrl: entity?.status === "published" && shouldApply ? publicUrlForSlug(entity.slug) : null
33926
33927
  };
33927
33928
  }
@@ -34115,8 +34116,8 @@ function commonsDatabaseReport() {
34115
34116
  directPublicHtmlWrites: false,
34116
34117
  normalWorkflow: ["commons_prepare_entity", "commons_validate_entity", "commons_submit_entity"],
34117
34118
  writesCreate: ["commons_proposals", "commons_ledger", "commons_entities when accepted"],
34118
- safeAutoPublish: "New non-conflicting entities with title, description, featured image, and body/source evidence.",
34119
- conflictBehavior: "Existing entity edits require baseRevision. Otherwise the proposal is pending_review.",
34119
+ safeAutoPublish: "Any entity with title, description, featured image, and body/source evidence. Creates and edits both publish.",
34120
+ conflictBehavior: "Anyone may edit any entity. A missing or stale baseRevision still applies on top of the current revision; the divergence is recorded on the contribution ledger.",
34120
34121
  billing: { validationCredits: 0, createCredits: LISTING_WRITE_RATE_POLICY.create.credits, editCredits: LISTING_WRITE_RATE_POLICY.edit.credits }
34121
34122
  },
34122
34123
  searchCorpus: ["title", "disambiguationName", "description", "tags", "keywords", "relatedEntities", "relationship claims", "bodyMarkdown", "sections", "media", "source metadata", "jsonLd"],
@@ -34438,19 +34439,23 @@ function normalizeClaimsForRepository(input) {
34438
34439
  throw new CommonsRepositoryError("invalid_claims", error instanceof Error ? error.message : "Claims are invalid.");
34439
34440
  }
34440
34441
  }
34442
+ function ledgerSummary(changeSummary, existing, conflictNote) {
34443
+ const base = changeSummary || (existing ? "Updated Commons entity." : "Created Commons entity.");
34444
+ return conflictNote ? `${base} ${conflictNote}` : base;
34445
+ }
34441
34446
  function evaluatePublishSafety(input, existing) {
34442
- if (!input.featuredImage?.url) return { safe: false, reason: "A featured image is required before a Commons entity can publish." };
34447
+ if (!input.featuredImage?.url) return { safe: false, reason: "A featured image is required before a Commons entity can publish.", conflictNote: null };
34443
34448
  if (!input.bodyMarkdown.trim() && !input.source.originalUrl && !input.source.resolvedUrl) {
34444
- return { safe: false, reason: "A public entity needs article body text or source evidence before publishing." };
34449
+ return { safe: false, reason: "A public entity needs article body text or source evidence before publishing.", conflictNote: null };
34445
34450
  }
34446
- if (!existing) return { safe: true, reason: null };
34451
+ if (!existing) return { safe: true, reason: null, conflictNote: null };
34447
34452
  if (input.baseRevision === void 0) {
34448
- return { safe: false, reason: "Existing entity edits require baseRevision so agents do not overwrite someone else silently." };
34453
+ return { safe: true, reason: null, conflictNote: `Applied without baseRevision on top of revision ${existing.revision}.` };
34449
34454
  }
34450
34455
  if (input.baseRevision !== existing.revision) {
34451
- return { safe: false, reason: `Existing entity revision is ${existing.revision}; proposal targeted ${input.baseRevision}.` };
34456
+ return { safe: true, reason: null, conflictNote: `Applied on top of revision ${existing.revision}; this edit targeted revision ${input.baseRevision}.` };
34452
34457
  }
34453
- return { safe: true, reason: null };
34458
+ return { safe: true, reason: null, conflictNote: null };
34454
34459
  }
34455
34460
  function buildNextEntity(input) {
34456
34461
  const current = input.existing;
@@ -35988,7 +35993,15 @@ commonsApp.post("/entities/propose", auth2, async (c) => {
35988
35993
  if ("insufficient" in charged) return c.json(charged.insufficient, 402);
35989
35994
  billing = charged;
35990
35995
  const result = await submitCommonsEntity(parsed.data, c.get("user"));
35991
- return c.json({ ok: true, data: result, billing: publicListingWriteBilling(billing) }, result.applied ? 201 : 202);
35996
+ if (!result.applied) {
35997
+ await refundListingWrite(billing, "Transparent Commons proposal was held for review instead of published.").catch(() => null);
35998
+ return c.json({
35999
+ ok: true,
36000
+ data: result,
36001
+ billing: { ...publicListingWriteBilling(billing), charged: false, refunded: !billing.duplicate }
36002
+ }, 202);
36003
+ }
36004
+ return c.json({ ok: true, data: result, billing: publicListingWriteBilling(billing) }, 201);
35992
36005
  } catch (error) {
35993
36006
  if (billing) await refundListingWrite(billing, "Transparent Commons write failed before persistence.").catch(() => null);
35994
36007
  if (error instanceof CommonsRepositoryError) {
@@ -46765,7 +46778,7 @@ app.get("/cron/tick", async (c) => {
46765
46778
  return c.json({ error: "Unauthorized" }, 401);
46766
46779
  }
46767
46780
  const startedAt = Date.now();
46768
- const { drainQueue } = await import("./worker-W5C6SKZT.js");
46781
+ const { drainQueue } = await import("./worker-DTVBN3RQ.js");
46769
46782
  const budget = { maxJobs: 10, deadlineMs: startedAt + CRON_TICK_DRAIN_BUDGET_MS };
46770
46783
  const origin = `${new URL(c.req.url).protocol}//${new URL(c.req.url).host}`;
46771
46784
  const unfinished = [];
@@ -46835,8 +46848,8 @@ app.post("/api/internal/extract-refinalize/:id", async (c) => {
46835
46848
  finishExtractJob: finishExtractJob2,
46836
46849
  terminalExtractJobStatus: terminalExtractJobStatus2,
46837
46850
  extractJobLimitInfo: extractJobLimitInfo2
46838
- } = await import("./site-extract-repository-QSRPXNMI.js");
46839
- const { assembleExtractArtifacts } = await import("./extract-bundle-3CRG7FAN.js");
46851
+ } = await import("./site-extract-repository-YGNYFTNE.js");
46852
+ const { assembleExtractArtifacts } = await import("./extract-bundle-6KYTD55T.js");
46840
46853
  const existing = await getExtractJob2(jobId2);
46841
46854
  if (!existing) return c.json({ error: "job not found" }, 404);
46842
46855
  if (existing.status !== "failed") {
@@ -46863,7 +46876,7 @@ app.post("/api/internal/extract-refinalize/:id", async (c) => {
46863
46876
  if (!updated) return c.json({ error: "job state changed during re-finalization" }, 409);
46864
46877
  let settlement = "already_settled_or_refunded";
46865
46878
  if (job.billedMc == null && job.userId != null) {
46866
- const { settleExtractJob: settleExtractJob3, countSuccessfulPages: countSuccessfulPages2 } = await import("./site-extract-repository-QSRPXNMI.js");
46879
+ const { settleExtractJob: settleExtractJob3, countSuccessfulPages: countSuccessfulPages2 } = await import("./site-extract-repository-YGNYFTNE.js");
46867
46880
  const heldMc = Number(job.options.heldMc ?? 0);
46868
46881
  const successful = await countSuccessfulPages2(jobId2);
46869
46882
  const usedMc = Math.min(successful * MC_COSTS.page_scrape, heldMc);
@@ -47048,4 +47061,4 @@ app.get("/blog/:slug/", (c) => {
47048
47061
  export {
47049
47062
  app
47050
47063
  };
47051
- //# sourceMappingURL=server-WKBCZ2TH.js.map
47064
+ //# sourceMappingURL=server-SETYJPYO.js.map