mcp-scraper 0.28.3 → 0.29.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.
@@ -36,7 +36,7 @@ import {
36
36
  sanitizeAttempts,
37
37
  sanitizeHarvestResult,
38
38
  transcribeMediaUrl
39
- } from "./chunk-2W4RWWXL.js";
39
+ } from "./chunk-HVQR7VAE.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-EMF4W6QM.js";
80
+ import "./chunk-63PP32WV.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", "Calendar"];
20702
20702
  var MAX_VAULT_RECORDS = 200;
20703
20703
  var MAX_MEMORY_READ_CONCURRENCY = 4;
20704
20704
  var MAX_MEMORY_READ_ATTEMPTS = 3;
@@ -20752,16 +20752,55 @@ 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";
20758
+ if (vault === "Calendar") return "event";
20757
20759
  return "unclassified";
20758
20760
  }
20759
20761
  function defaultStatus(vault) {
20760
20762
  if (vault === "People") return "active";
20763
+ if (vault === "Deals") return "lead";
20761
20764
  if (vault === "Projects") return "active";
20762
20765
  if (vault === "Tasks") return "to_do";
20766
+ if (vault === "Calendar") return "scheduled";
20763
20767
  return "inbox";
20764
20768
  }
20769
+ function nonEmptyStrings(value) {
20770
+ return Array.isArray(value) ? value.filter((entry) => typeof entry === "string" && entry.trim().length > 0) : [];
20771
+ }
20772
+ function validateNewRecord(vault, props) {
20773
+ const type = typeof props.type === "string" ? props.type : "";
20774
+ if (vault === "People" && !["person", "organization"].includes(type)) return "People records must be a person or organization";
20775
+ if (vault === "Deals") {
20776
+ if (type !== "deal") return "Deals records must have type deal";
20777
+ if (typeof props.organization_ref !== "string" && nonEmptyStrings(props.person_refs).length === 0) {
20778
+ return "Deals require a known organization or person";
20779
+ }
20780
+ }
20781
+ if (vault === "Projects") {
20782
+ if (!["project", "vault_settings"].includes(type)) return "Projects records must have type project";
20783
+ if (type === "project" && !["codebase", "client", "personal", "workstream"].includes(String(props.project_kind ?? ""))) {
20784
+ return "Projects require project_kind: codebase, client, personal, or workstream";
20785
+ }
20786
+ }
20787
+ if (vault === "Tasks") {
20788
+ if (!["task", "milestone"].includes(type)) return "Tasks records must have type task or milestone";
20789
+ const hasProjectRef = typeof props.project_ref === "string" && props.project_ref.trim().length > 0;
20790
+ const hasProjectTitle = typeof props.project === "string" && props.project.trim().length > 0;
20791
+ if (hasProjectRef !== hasProjectTitle) return "Tasks project_ref and project must be supplied together when a task is linked to a project";
20792
+ }
20793
+ if (vault === "Communications") {
20794
+ if (!["email", "slack", "message", "call", "meeting", "social_media", "thread", "decision"].includes(type)) return "Communications records need a valid communication type";
20795
+ if (!["none", "needs_reply", "needs_review", "waiting"].includes(String(props.attention_state ?? ""))) {
20796
+ return "Communications require attention_state: none, needs_reply, needs_review, or waiting";
20797
+ }
20798
+ if (type === "email" && props.direction === "draft" && props.approval_state !== "pending") {
20799
+ return "Email drafts awaiting review must have approval_state pending";
20800
+ }
20801
+ }
20802
+ return null;
20803
+ }
20765
20804
  function shouldRetryMemoryRead(error) {
20766
20805
  return /deadlock|timeout|timed out|temporar|econnreset|fetch failed/i.test(error ?? "");
20767
20806
  }
@@ -20826,6 +20865,8 @@ vaultApp.post("/api/records", async (c) => {
20826
20865
  const content = typeof body.content === "string" && body.content.length <= 1e5 ? body.content : "";
20827
20866
  const props = propsValue(body.props) ?? {};
20828
20867
  if (!isVault(vault) || !path5 || !title) return c.json({ ok: false, error: "vault, path, and title are required" }, 400);
20868
+ const validationError = validateNewRecord(vault, props);
20869
+ if (validationError) return c.json({ ok: false, error: validationError }, 400);
20829
20870
  const baseRevision = typeof body.baseRevision === "number" && Number.isInteger(body.baseRevision) ? body.baseRevision : void 0;
20830
20871
  const result = await memoryCall("putTool", { vault, path: path5, title, content: content || title, props, ...baseRevision === void 0 ? {} : { baseRevision } }, token);
20831
20872
  return c.json(result, result.ok ? 200 : result.conflict ? 409 : 502);
@@ -20866,12 +20907,15 @@ vaultApp.post("/api/records/update", async (c) => {
20866
20907
  }
20867
20908
  const current = await readMemory("getTool", { vault, path: path5 }, token);
20868
20909
  if (!current.ok || !current.note) return c.json(current, current.ok ? 404 : 502);
20910
+ const nextProps = { ...current.note.props ?? {}, ...props ?? {} };
20911
+ const validationError = validateNewRecord(vault, nextProps);
20912
+ if (validationError) return c.json({ ok: false, error: validationError }, 400);
20869
20913
  const result = await memoryCall("putTool", {
20870
20914
  vault,
20871
20915
  path: path5,
20872
20916
  title: title ?? current.note.title,
20873
20917
  content: content ?? current.note.content,
20874
- props: { ...current.note.props ?? {}, ...props ?? {} },
20918
+ props: nextProps,
20875
20919
  baseRevision: baseRevision ?? current.note.revision
20876
20920
  }, token);
20877
20921
  return c.json(result, result.ok ? 200 : result.conflict ? 409 : 502);
@@ -20906,20 +20950,25 @@ vaultApp.post("/api/communications/review", async (c) => {
20906
20950
  const content = typeof body.content === "string" && body.content.length <= 1e5 ? body.content : void 0;
20907
20951
  const feedback = typeof body.feedback === "string" ? body.feedback.trim().slice(0, 1e4) : void 0;
20908
20952
  const baseRevision = typeof body.baseRevision === "number" && Number.isInteger(body.baseRevision) ? body.baseRevision : void 0;
20909
- if (!path5 || !action || !["accept", "deny", "edit"].includes(action) || body.title !== void 0 && !title) {
20953
+ const normalizedAction = action === "accept" ? "approve" : action;
20954
+ if (!path5 || !normalizedAction || !["approve", "deny", "edit"].includes(normalizedAction) || body.title !== void 0 && !title) {
20910
20955
  return c.json({ ok: false, error: "valid path, action, and optional draft fields are required" }, 400);
20911
20956
  }
20912
20957
  const current = await readMemory("getTool", { vault: "Communications", path: path5 }, token);
20913
20958
  if (!current.ok || !current.note) return c.json(current, current.ok ? 404 : 502);
20914
20959
  if (current.note.props?.type !== "email") return c.json({ ok: false, error: "only email communications can be reviewed" }, 400);
20915
- const reviewed = action === "accept" || action === "deny";
20916
- const reviewState = action === "accept" ? "accepted" : action === "deny" ? "denied" : "pending";
20917
- const status = action === "accept" ? "triaged" : action === "deny" ? "archived" : typeof current.note.props?.status === "string" ? current.note.props.status : "inbox";
20960
+ const reviewed = normalizedAction === "approve" || normalizedAction === "deny";
20961
+ const reviewState = normalizedAction === "approve" ? "accepted" : normalizedAction === "deny" ? "denied" : "pending";
20962
+ const approvalState = normalizedAction === "approve" ? "approved" : normalizedAction === "deny" ? "denied" : "pending";
20963
+ const status = normalizedAction === "approve" ? "triaged" : normalizedAction === "deny" ? "archived" : "inbox";
20918
20964
  const props = {
20919
20965
  ...current.note.props ?? {},
20920
20966
  status,
20921
20967
  review_state: reviewState,
20968
+ approval_state: approvalState,
20969
+ attention_state: normalizedAction === "edit" ? "needs_review" : "none",
20922
20970
  ...reviewed ? { reviewed_at: (/* @__PURE__ */ new Date()).toISOString() } : {},
20971
+ ...normalizedAction === "approve" ? { approved_at: (/* @__PURE__ */ new Date()).toISOString() } : {},
20923
20972
  ...feedback ? { review_feedback: feedback } : {}
20924
20973
  };
20925
20974
  const result = await memoryCall("putTool", {
@@ -20946,7 +20995,7 @@ vaultApp.post("/api/activity", async (c) => {
20946
20995
  path: `Inbox/activity-${stamp}`,
20947
20996
  title,
20948
20997
  content: content || title,
20949
- props: { status: "triaged", type: "decision", occurred_at: (/* @__PURE__ */ new Date()).toISOString(), ...props }
20998
+ props: { status: "triaged", type: "decision", attention_state: "none", occurred_at: (/* @__PURE__ */ new Date()).toISOString(), ...props }
20950
20999
  }, token);
20951
21000
  return c.json(result, result.ok ? 200 : 502);
20952
21001
  });
@@ -27472,4 +27521,4 @@ app.get("/blog/:slug/", (c) => {
27472
27521
  export {
27473
27522
  app
27474
27523
  };
27475
- //# sourceMappingURL=server-53OTA5HA.js.map
27524
+ //# sourceMappingURL=server-F3I77L26.js.map