mcp-scraper 0.29.1 → 0.31.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.
@@ -36,7 +36,7 @@ import {
36
36
  sanitizeAttempts,
37
37
  sanitizeHarvestResult,
38
38
  transcribeMediaUrl
39
- } from "./chunk-HVQR7VAE.js";
39
+ } from "./chunk-ZOXL3VWO.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-63PP32WV.js";
80
+ import "./chunk-W3GYPHFL.js";
81
81
  import {
82
82
  completeExtractJob,
83
83
  countSuccessfulPages,
@@ -20698,7 +20698,21 @@ loadChannels();
20698
20698
 
20699
20699
  // src/api/vault-routes.ts
20700
20700
  import { Hono as Hono22 } from "hono";
20701
- var VAULTS = ["People", "Deals", "Projects", "Tasks", "Communications", "Calendar"];
20701
+ var VAULTS = ["People", "Organizations", "Deals", "Projects", "Tasks", "Communications", "Calendar"];
20702
+ var PROJECT_TYPES = ["codebase", "personal", "work", "client"];
20703
+ var PROJECT_KIND_BY_TYPE = {
20704
+ codebase: "codebase",
20705
+ personal: "personal",
20706
+ work: "workstream",
20707
+ client: "client"
20708
+ };
20709
+ var PROJECT_TYPE_BY_KIND = {
20710
+ codebase: "codebase",
20711
+ personal: "personal",
20712
+ work: "work",
20713
+ workstream: "work",
20714
+ client: "client"
20715
+ };
20702
20716
  var MAX_VAULT_RECORDS = 200;
20703
20717
  var MAX_MEMORY_READ_CONCURRENCY = 4;
20704
20718
  var MAX_MEMORY_READ_ATTEMPTS = 3;
@@ -20735,7 +20749,7 @@ vaultApp.use("/api/*", async (c, next) => {
20735
20749
  await next();
20736
20750
  });
20737
20751
  function workspaceRecord(vault, note) {
20738
- const props = note.props ?? {};
20752
+ const props = normalizeRelationshipProps(vault, note.props ?? {});
20739
20753
  return {
20740
20754
  id: `${vault}:${note.path}`,
20741
20755
  vault,
@@ -20750,8 +20764,25 @@ function workspaceRecord(vault, note) {
20750
20764
  capturedAt: note.capturedAt
20751
20765
  };
20752
20766
  }
20767
+ function projectTypeFor(props) {
20768
+ const projectType = typeof props.project_type === "string" ? props.project_type : "";
20769
+ if (PROJECT_TYPES.includes(projectType)) return projectType;
20770
+ const projectKind = typeof props.project_kind === "string" ? props.project_kind : "";
20771
+ return PROJECT_TYPE_BY_KIND[projectKind] ?? null;
20772
+ }
20773
+ function normalizeRelationshipProps(vault, props) {
20774
+ if (vault !== "Projects" || props.type === "vault_settings") return props;
20775
+ const projectType = projectTypeFor(props);
20776
+ if (!projectType) return props;
20777
+ return {
20778
+ ...props,
20779
+ project_type: projectType,
20780
+ project_kind: PROJECT_KIND_BY_TYPE[projectType]
20781
+ };
20782
+ }
20753
20783
  function defaultType(vault) {
20754
20784
  if (vault === "People" || vault === "Communications") return "unclassified";
20785
+ if (vault === "Organizations") return "organization";
20755
20786
  if (vault === "Deals") return "deal";
20756
20787
  if (vault === "Projects") return "project";
20757
20788
  if (vault === "Tasks") return "task";
@@ -20759,7 +20790,7 @@ function defaultType(vault) {
20759
20790
  return "unclassified";
20760
20791
  }
20761
20792
  function defaultStatus(vault) {
20762
- if (vault === "People") return "active";
20793
+ if (vault === "People" || vault === "Organizations") return "active";
20763
20794
  if (vault === "Deals") return "lead";
20764
20795
  if (vault === "Projects") return "active";
20765
20796
  if (vault === "Tasks") return "to_do";
@@ -20772,6 +20803,12 @@ function nonEmptyStrings(value) {
20772
20803
  function validateNewRecord(vault, props) {
20773
20804
  const type = typeof props.type === "string" ? props.type : "";
20774
20805
  if (vault === "People" && !["person", "organization"].includes(type)) return "People records must be a person or organization";
20806
+ if (vault === "Organizations") {
20807
+ if (type !== "organization") return "Organizations records must have type organization";
20808
+ if (typeof props.organization_name !== "string" || !props.organization_name.trim()) {
20809
+ return "Organizations require organization_name";
20810
+ }
20811
+ }
20775
20812
  if (vault === "Deals") {
20776
20813
  if (type !== "deal") return "Deals records must have type deal";
20777
20814
  if (typeof props.organization_ref !== "string" && nonEmptyStrings(props.person_refs).length === 0) {
@@ -20780,8 +20817,8 @@ function validateNewRecord(vault, props) {
20780
20817
  }
20781
20818
  if (vault === "Projects") {
20782
20819
  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";
20820
+ if (type === "project" && !projectTypeFor(props)) {
20821
+ return "Projects require project_type: codebase, personal, work, or client";
20785
20822
  }
20786
20823
  }
20787
20824
  if (vault === "Tasks") {
@@ -20865,10 +20902,11 @@ vaultApp.post("/api/records", async (c) => {
20865
20902
  const content = typeof body.content === "string" && body.content.length <= 1e5 ? body.content : "";
20866
20903
  const props = propsValue(body.props) ?? {};
20867
20904
  if (!isVault(vault) || !path5 || !title) return c.json({ ok: false, error: "vault, path, and title are required" }, 400);
20868
- const validationError = validateNewRecord(vault, props);
20905
+ const normalizedProps = normalizeRelationshipProps(vault, props);
20906
+ const validationError = validateNewRecord(vault, normalizedProps);
20869
20907
  if (validationError) return c.json({ ok: false, error: validationError }, 400);
20870
20908
  const baseRevision = typeof body.baseRevision === "number" && Number.isInteger(body.baseRevision) ? body.baseRevision : void 0;
20871
- const result = await memoryCall("putTool", { vault, path: path5, title, content: content || title, props, ...baseRevision === void 0 ? {} : { baseRevision } }, token);
20909
+ const result = await memoryCall("putTool", { vault, path: path5, title, content: content || title, props: normalizedProps, ...baseRevision === void 0 ? {} : { baseRevision } }, token);
20872
20910
  return c.json(result, result.ok ? 200 : result.conflict ? 409 : 502);
20873
20911
  });
20874
20912
  vaultApp.post("/api/records/transition", async (c) => {
@@ -20907,7 +20945,7 @@ vaultApp.post("/api/records/update", async (c) => {
20907
20945
  }
20908
20946
  const current = await readMemory("getTool", { vault, path: path5 }, token);
20909
20947
  if (!current.ok || !current.note) return c.json(current, current.ok ? 404 : 502);
20910
- const nextProps = { ...current.note.props ?? {}, ...props ?? {} };
20948
+ const nextProps = normalizeRelationshipProps(vault, { ...current.note.props ?? {}, ...props ?? {} });
20911
20949
  const validationError = validateNewRecord(vault, nextProps);
20912
20950
  if (validationError) return c.json({ ok: false, error: validationError }, 400);
20913
20951
  const result = await memoryCall("putTool", {
@@ -20989,13 +21027,39 @@ vaultApp.post("/api/activity", async (c) => {
20989
21027
  const content = typeof body.content === "string" && body.content.length <= 2e4 ? body.content : "";
20990
21028
  const props = propsValue(body.props) ?? {};
20991
21029
  if (!title) return c.json({ ok: false, error: "title is required" }, 400);
21030
+ const personRefs = nonEmptyStrings(props.person_refs);
21031
+ if (personRefs.length === 0 || personRefs.some((ref) => !/^People::.+/.test(ref))) {
21032
+ return c.json({ ok: false, error: "Activities require at least one canonical People reference in person_refs" }, 400);
21033
+ }
21034
+ for (const ref of personRefs) {
21035
+ const person = await readMemory("getTool", { vault: "People", path: ref.replace(/^People::/, "") }, token);
21036
+ if (!person.ok || !person.note || !["person", "organization"].includes(String(person.note.props?.type ?? ""))) {
21037
+ return c.json({ ok: false, error: `Activity person reference is not a known People record: ${ref}` }, 400);
21038
+ }
21039
+ }
20992
21040
  const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
20993
21041
  const result = await memoryCall("putTool", {
20994
21042
  vault: "Communications",
20995
21043
  path: `Inbox/activity-${stamp}`,
20996
21044
  title,
20997
21045
  content: content || title,
20998
- props: { status: "triaged", type: "decision", attention_state: "none", occurred_at: (/* @__PURE__ */ new Date()).toISOString(), ...props }
21046
+ props: {
21047
+ status: "triaged",
21048
+ type: "decision",
21049
+ attention_state: "none",
21050
+ occurred_at: (/* @__PURE__ */ new Date()).toISOString(),
21051
+ source_type: "manual",
21052
+ source_ref: "vault-app:activity",
21053
+ summary: title,
21054
+ embedding_summary: title,
21055
+ related: [],
21056
+ related_vault_notes: personRefs,
21057
+ embed: true,
21058
+ embed_priority: "normal",
21059
+ activity_kind: "note",
21060
+ ...props,
21061
+ person_refs: personRefs
21062
+ }
20999
21063
  }, token);
21000
21064
  return c.json(result, result.ok ? 200 : 502);
21001
21065
  });
@@ -27521,4 +27585,4 @@ app.get("/blog/:slug/", (c) => {
27521
27585
  export {
27522
27586
  app
27523
27587
  };
27524
- //# sourceMappingURL=server-F3I77L26.js.map
27588
+ //# sourceMappingURL=server-DS3ZSNNO.js.map