@ai-matrx/records 0.73.0 → 0.73.2

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.
@@ -114,6 +114,7 @@ __export(templates_exports, {
114
114
  ruleBreak: () => ruleBreak,
115
115
  runTemplateDoor: () => runTemplateDoor,
116
116
  selfDeclaredFieldSpec: () => selfDeclaredFieldSpec,
117
+ sensitivityFloorOf: () => sensitivityFloorOf,
117
118
  shellsPayload: () => shellsPayload,
118
119
  stageFieldOf: () => stageFieldOf,
119
120
  stageRulesSpec: () => stageRulesSpec,
@@ -5128,23 +5129,15 @@ function validateTemplate(raw, options = {}) {
5128
5129
  }
5129
5130
  }
5130
5131
  }
5131
- const RESTRICTED_KEY = /(^|_)(member_id|ssn|social_security|dob|date_of_birth|birth_date|allerg(y|ies)|diagnos(is|es)|medical_conditions?|conditions|medications?|current_medications|gate_code|access_code|door_code|alarm_code|password|passcode|pin|clinical_notes?|visit_notes?|progress_notes?|soap_notes?|case_notes?|legal_notes?|privileged_notes?|bank(_\w+)?|routing(_number)?|account_number|iban|swift(_code)?|card(_number|_on_file)?|credit_card|cvv|cvc)($|_)/;
5132
- const RESTRICTED_LABEL = /\b(bank|routing number|iban|card on file|credit card|card number|cvv|medical conditions?|medications?|diagnos[ie]s|case notes|legal notes|privileged)\b/;
5133
- const PERSONAL_ONLY = /(^|_)(dob|date_of_birth|birth_date|allerg(y|ies)|diagnos(is|es)|medical_conditions?|conditions|medications?|current_medications|clinical_notes?|visit_notes?|progress_notes?|soap_notes?|member_id|ssn|social_security)($|_)/;
5134
- const holdsPeople = (t) => t.subject ? t.subject === "person" : t.fields.some((f) => /name/.test(f.key)) && t.fields.some((f) => f.parityType === "phone" || f.parityType === "email");
5135
5132
  for (const t of own) {
5136
5133
  for (const f of t.fields) {
5137
5134
  const at = `tables (${t.token}).fields (${f.key})`;
5138
5135
  const text2 = `${f.key} ${norm(f.label)}`;
5139
5136
  const e = effective(t.token, f);
5140
- const billingTable = /(invoice|bill|statement|receipt|payment|charge|fee|order|account)/i.test(`${t.token} ${t.labelSingular}`);
5141
- const criminalCharges = /(^|_)charges?($|_)/.test(f.key) && behaviorOf(f) === "text" && !billingTable;
5142
- const phoneLike = behaviorOf(f) === "text" && /\b(cell|mobile|phone)\b/.test(norm(f.label));
5143
- const personal = PERSONAL_ONLY.test(f.key) || /\b(medical conditions?|medications?|diagnos[ie]s)\b/.test(norm(f.label));
5144
- const floored = (RESTRICTED_KEY.test(f.key) || RESTRICTED_LABEL.test(norm(f.label)) || criminalCharges) && (!personal || holdsPeople(t));
5145
- if (floored && !(e.sensitivity === "restricted" && e.contextPolicy === "exclude")) {
5137
+ const floor = sensitivityFloorOf(t, f);
5138
+ if (floor === "restricted" && !(e.sensitivity === "restricted" && e.contextPolicy === "exclude")) {
5146
5139
  say(at, `"${f.label}" is the kind of value that is restricted and kept from the AI (restricted + exclude).`);
5147
- } else if ((f.parityType === "phone" || phoneLike || f.parityType === "email" || /address|street/.test(text2)) && SENSITIVITY_RANK.indexOf(e.sensitivity) < 2) {
5140
+ } else if (floor === "confidential" && SENSITIVITY_RANK.indexOf(e.sensitivity) < 2) {
5148
5141
  say(at, `"${f.label}" reaches a person or a home, so it is at least confidential.`);
5149
5142
  } else if (/note/.test(text2) && e.sensitivity === "public") {
5150
5143
  say(at, `"${f.label}" is somebody's notes; notes are never public.`);
@@ -5998,6 +5991,21 @@ function assertTemplate(spec, options = {}) {
5998
5991
  throw new Error(`The template "${spec.id}" is not ready \u2014 ${verdict.problems.length} problem(s):
5999
5992
  ${verdict.problems.map((p) => ` \xB7 ${p.at}: ${p.says}`).join("\n")}`);
6000
5993
  }
5994
+ var RESTRICTED_KEY = /(^|_)(member_id|ssn|social_security|dob|date_of_birth|birth_date|allerg(y|ies)|diagnos(is|es)|medical_conditions?|conditions|medications?|current_medications|gate_code|access_code|door_code|alarm_code|password|passcode|pin|clinical_notes?|visit_notes?|progress_notes?|soap_notes?|case_notes?|legal_notes?|privileged_notes?|bank(_\w+)?|routing(_number)?|account_number|iban|swift(_code)?|card(_number|_on_file)?|credit_card|cvv|cvc)($|_)/;
5995
+ var RESTRICTED_LABEL = /\b(bank|routing number|iban|card on file|credit card|card number|cvv|medical conditions?|medications?|diagnos[ie]s|case notes|legal notes|privileged)\b/;
5996
+ var PERSONAL_ONLY = /(^|_)(dob|date_of_birth|birth_date|allerg(y|ies)|diagnos(is|es)|medical_conditions?|conditions|medications?|current_medications|clinical_notes?|visit_notes?|progress_notes?|soap_notes?|member_id|ssn|social_security)($|_)/;
5997
+ var holdsPeople = (t) => t.subject ? t.subject === "person" : t.fields.some((f) => /name/.test(f.key)) && t.fields.some((f) => f.parityType === "phone" || f.parityType === "email");
5998
+ function sensitivityFloorOf(table, f) {
5999
+ const text = `${f.key} ${norm(f.label)}`;
6000
+ const billingTable = /(invoice|bill|statement|receipt|payment|charge|fee|order|account)/i.test(`${table.token} ${table.labelSingular ?? ""}`);
6001
+ const criminalCharges = /(^|_)charges?($|_)/.test(f.key) && behaviorOf(f) === "text" && !billingTable;
6002
+ const phoneLike = behaviorOf(f) === "text" && /\b(cell|mobile|phone)\b/.test(norm(f.label));
6003
+ const personal = PERSONAL_ONLY.test(f.key) || /\b(medical conditions?|medications?|diagnos[ie]s)\b/.test(norm(f.label));
6004
+ const floored = (RESTRICTED_KEY.test(f.key) || RESTRICTED_LABEL.test(norm(f.label)) || criminalCharges) && (!personal || holdsPeople(table));
6005
+ if (floored) return "restricted";
6006
+ if (f.parityType === "phone" || phoneLike || f.parityType === "email" || /address|street/.test(text)) return "confidential";
6007
+ return null;
6008
+ }
6001
6009
 
6002
6010
  // src/templates/plan.ts
6003
6011
  var INSTALL_PLAN_VERSION = 1;