mcp-scraper 0.28.2 → 0.29.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.
@@ -0,0 +1,7 @@
1
+ // src/version.ts
2
+ var PACKAGE_VERSION = "0.29.0";
3
+
4
+ export {
5
+ PACKAGE_VERSION
6
+ };
7
+ //# sourceMappingURL=chunk-7TNTBRQW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/version.ts"],"sourcesContent":["export const PACKAGE_VERSION = '0.29.0'\n"],"mappings":";AAAO,IAAM,kBAAkB;","names":[]}
@@ -36,7 +36,7 @@ import {
36
36
  sanitizeAttempts,
37
37
  sanitizeHarvestResult,
38
38
  transcribeMediaUrl
39
- } from "./chunk-Q7VZUYRR.js";
39
+ } from "./chunk-66SYKL2G.js";
40
40
  import {
41
41
  auditImages,
42
42
  buildLinkReport,
@@ -77,7 +77,7 @@ import {
77
77
  RawMapsOverviewSchema,
78
78
  RawMapsReviewStatsSchema
79
79
  } from "./chunk-ZQSHKWV4.js";
80
- import "./chunk-GOAQIV6K.js";
80
+ import "./chunk-7TNTBRQW.js";
81
81
  import {
82
82
  completeExtractJob,
83
83
  countSuccessfulPages,
@@ -20698,7 +20698,7 @@ loadChannels();
20698
20698
 
20699
20699
  // src/api/vault-routes.ts
20700
20700
  import { Hono as Hono22 } from "hono";
20701
- var VAULTS = ["People", "Projects", "Tasks", "Communications"];
20701
+ var VAULTS = ["People", "Deals", "Projects", "Tasks", "Communications"];
20702
20702
  var MAX_VAULT_RECORDS = 200;
20703
20703
  var MAX_MEMORY_READ_CONCURRENCY = 4;
20704
20704
  var MAX_MEMORY_READ_ATTEMPTS = 3;
@@ -20726,7 +20726,7 @@ function cors(c) {
20726
20726
  const local = !!origin && /^http:\/\/localhost(?::\d+)?$/.test(origin);
20727
20727
  if (origin && (configured.includes(origin) || local)) c.header("Access-Control-Allow-Origin", origin);
20728
20728
  c.header("Vary", "Origin");
20729
- c.header("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
20729
+ c.header("Access-Control-Allow-Methods", "GET, POST, DELETE, OPTIONS");
20730
20730
  c.header("Access-Control-Allow-Headers", "content-type");
20731
20731
  }
20732
20732
  vaultApp.use("/api/*", async (c, next) => {
@@ -20752,16 +20752,53 @@ function workspaceRecord(vault, note) {
20752
20752
  }
20753
20753
  function defaultType(vault) {
20754
20754
  if (vault === "People" || vault === "Communications") return "unclassified";
20755
+ if (vault === "Deals") return "deal";
20755
20756
  if (vault === "Projects") return "project";
20756
20757
  if (vault === "Tasks") return "task";
20757
20758
  return "unclassified";
20758
20759
  }
20759
20760
  function defaultStatus(vault) {
20760
20761
  if (vault === "People") return "active";
20762
+ if (vault === "Deals") return "lead";
20761
20763
  if (vault === "Projects") return "active";
20762
20764
  if (vault === "Tasks") return "to_do";
20763
20765
  return "inbox";
20764
20766
  }
20767
+ function nonEmptyStrings(value) {
20768
+ return Array.isArray(value) ? value.filter((entry) => typeof entry === "string" && entry.trim().length > 0) : [];
20769
+ }
20770
+ function validateNewRecord(vault, props) {
20771
+ const type = typeof props.type === "string" ? props.type : "";
20772
+ if (vault === "People" && !["person", "organization"].includes(type)) return "People records must be a person or organization";
20773
+ if (vault === "Deals") {
20774
+ if (type !== "deal") return "Deals records must have type deal";
20775
+ if (typeof props.organization_ref !== "string" && nonEmptyStrings(props.person_refs).length === 0) {
20776
+ return "Deals require a known organization or person";
20777
+ }
20778
+ }
20779
+ if (vault === "Projects") {
20780
+ if (!["project", "vault_settings"].includes(type)) return "Projects records must have type project";
20781
+ if (type === "project" && !["codebase", "client", "personal", "workstream"].includes(String(props.project_kind ?? ""))) {
20782
+ return "Projects require project_kind: codebase, client, personal, or workstream";
20783
+ }
20784
+ }
20785
+ if (vault === "Tasks") {
20786
+ if (!["task", "milestone"].includes(type)) return "Tasks records must have type task or milestone";
20787
+ if (typeof props.project_ref !== "string" || !props.project_ref.trim() || typeof props.project !== "string" || !props.project.trim()) {
20788
+ return "Tasks must be linked to an existing project";
20789
+ }
20790
+ }
20791
+ if (vault === "Communications") {
20792
+ if (!["email", "slack", "message", "call", "meeting", "social_media", "thread", "decision"].includes(type)) return "Communications records need a valid communication type";
20793
+ if (!["none", "needs_reply", "needs_review", "waiting"].includes(String(props.attention_state ?? ""))) {
20794
+ return "Communications require attention_state: none, needs_reply, needs_review, or waiting";
20795
+ }
20796
+ if (type === "email" && props.direction === "draft" && props.approval_state !== "pending") {
20797
+ return "Email drafts awaiting review must have approval_state pending";
20798
+ }
20799
+ }
20800
+ return null;
20801
+ }
20765
20802
  function shouldRetryMemoryRead(error) {
20766
20803
  return /deadlock|timeout|timed out|temporar|econnreset|fetch failed/i.test(error ?? "");
20767
20804
  }
@@ -20826,6 +20863,8 @@ vaultApp.post("/api/records", async (c) => {
20826
20863
  const content = typeof body.content === "string" && body.content.length <= 1e5 ? body.content : "";
20827
20864
  const props = propsValue(body.props) ?? {};
20828
20865
  if (!isVault(vault) || !path5 || !title) return c.json({ ok: false, error: "vault, path, and title are required" }, 400);
20866
+ const validationError = validateNewRecord(vault, props);
20867
+ if (validationError) return c.json({ ok: false, error: validationError }, 400);
20829
20868
  const baseRevision = typeof body.baseRevision === "number" && Number.isInteger(body.baseRevision) ? body.baseRevision : void 0;
20830
20869
  const result = await memoryCall("putTool", { vault, path: path5, title, content: content || title, props, ...baseRevision === void 0 ? {} : { baseRevision } }, token);
20831
20870
  return c.json(result, result.ok ? 200 : result.conflict ? 409 : 502);
@@ -20876,6 +20915,26 @@ vaultApp.post("/api/records/update", async (c) => {
20876
20915
  }, token);
20877
20916
  return c.json(result, result.ok ? 200 : result.conflict ? 409 : 502);
20878
20917
  });
20918
+ vaultApp.delete("/api/records", async (c) => {
20919
+ const body = await c.req.json().catch(() => ({}));
20920
+ const token = typeof body.token === "string" ? body.token : void 0;
20921
+ if (!validToken(token)) return c.json({ ok: false, error: "missing or malformed Vault App link" }, 401);
20922
+ const vault = body.vault;
20923
+ const path5 = stringValue(body.path, 320);
20924
+ const baseRevision = typeof body.baseRevision === "number" && Number.isInteger(body.baseRevision) ? body.baseRevision : void 0;
20925
+ if (vault !== "Tasks" || !path5) return c.json({ ok: false, error: "only a valid task record can be deleted" }, 400);
20926
+ const current = await readMemory("getTool", { vault, path: path5 }, token);
20927
+ if (!current.ok || !current.note) return c.json(current, current.ok ? 404 : 502);
20928
+ if (!["task", "milestone"].includes(typeof current.note.props?.type === "string" ? current.note.props.type : defaultType("Tasks"))) {
20929
+ return c.json({ ok: false, error: "only task records can be deleted" }, 400);
20930
+ }
20931
+ const result = await memoryCall("deleteNoteTool", {
20932
+ vault,
20933
+ path: path5,
20934
+ baseRevision: baseRevision ?? current.note.revision
20935
+ }, token);
20936
+ return c.json(result, result.ok ? 200 : result.conflict ? 409 : 502);
20937
+ });
20879
20938
  vaultApp.post("/api/communications/review", async (c) => {
20880
20939
  const body = await c.req.json().catch(() => ({}));
20881
20940
  const token = typeof body.token === "string" ? body.token : void 0;
@@ -20886,20 +20945,25 @@ vaultApp.post("/api/communications/review", async (c) => {
20886
20945
  const content = typeof body.content === "string" && body.content.length <= 1e5 ? body.content : void 0;
20887
20946
  const feedback = typeof body.feedback === "string" ? body.feedback.trim().slice(0, 1e4) : void 0;
20888
20947
  const baseRevision = typeof body.baseRevision === "number" && Number.isInteger(body.baseRevision) ? body.baseRevision : void 0;
20889
- if (!path5 || !action || !["accept", "deny", "edit"].includes(action) || body.title !== void 0 && !title) {
20948
+ const normalizedAction = action === "accept" ? "approve" : action;
20949
+ if (!path5 || !normalizedAction || !["approve", "deny", "edit"].includes(normalizedAction) || body.title !== void 0 && !title) {
20890
20950
  return c.json({ ok: false, error: "valid path, action, and optional draft fields are required" }, 400);
20891
20951
  }
20892
20952
  const current = await readMemory("getTool", { vault: "Communications", path: path5 }, token);
20893
20953
  if (!current.ok || !current.note) return c.json(current, current.ok ? 404 : 502);
20894
20954
  if (current.note.props?.type !== "email") return c.json({ ok: false, error: "only email communications can be reviewed" }, 400);
20895
- const reviewed = action === "accept" || action === "deny";
20896
- const reviewState = action === "accept" ? "accepted" : action === "deny" ? "denied" : "pending";
20897
- const status = action === "accept" ? "triaged" : action === "deny" ? "archived" : typeof current.note.props?.status === "string" ? current.note.props.status : "inbox";
20955
+ const reviewed = normalizedAction === "approve" || normalizedAction === "deny";
20956
+ const reviewState = normalizedAction === "approve" ? "accepted" : normalizedAction === "deny" ? "denied" : "pending";
20957
+ const approvalState = normalizedAction === "approve" ? "approved" : normalizedAction === "deny" ? "denied" : "pending";
20958
+ const status = normalizedAction === "approve" ? "triaged" : normalizedAction === "deny" ? "archived" : "inbox";
20898
20959
  const props = {
20899
20960
  ...current.note.props ?? {},
20900
20961
  status,
20901
20962
  review_state: reviewState,
20963
+ approval_state: approvalState,
20964
+ attention_state: normalizedAction === "edit" ? "needs_review" : "none",
20902
20965
  ...reviewed ? { reviewed_at: (/* @__PURE__ */ new Date()).toISOString() } : {},
20966
+ ...normalizedAction === "approve" ? { approved_at: (/* @__PURE__ */ new Date()).toISOString() } : {},
20903
20967
  ...feedback ? { review_feedback: feedback } : {}
20904
20968
  };
20905
20969
  const result = await memoryCall("putTool", {
@@ -20926,7 +20990,7 @@ vaultApp.post("/api/activity", async (c) => {
20926
20990
  path: `Inbox/activity-${stamp}`,
20927
20991
  title,
20928
20992
  content: content || title,
20929
- props: { status: "triaged", type: "decision", occurred_at: (/* @__PURE__ */ new Date()).toISOString(), ...props }
20993
+ props: { status: "triaged", type: "decision", attention_state: "none", occurred_at: (/* @__PURE__ */ new Date()).toISOString(), ...props }
20930
20994
  }, token);
20931
20995
  return c.json(result, result.ok ? 200 : 502);
20932
20996
  });
@@ -27452,4 +27516,4 @@ app.get("/blog/:slug/", (c) => {
27452
27516
  export {
27453
27517
  app
27454
27518
  };
27455
- //# sourceMappingURL=server-TB3USFGN.js.map
27519
+ //# sourceMappingURL=server-N4QMTJPS.js.map