paperclip-plugin-autopilot-ops 0.1.51 → 0.1.52

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.
package/dist/manifest.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // src/manifest.ts
2
2
  var PLUGIN_ID = "alephoo.autopilot-ops";
3
- var PLUGIN_VERSION = "0.1.51";
3
+ var PLUGIN_VERSION = "0.1.52";
4
4
  var DB_NAMESPACE_SLUG = "autopilot_ops";
5
5
  var PAGE_ROUTE = "autopilot";
6
6
  var TOOL_NAMES = {
package/dist/ui/index.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
 
9
9
  // src/manifest.ts
10
10
  var PLUGIN_ID = "alephoo.autopilot-ops";
11
- var PLUGIN_VERSION = "0.1.51";
11
+ var PLUGIN_VERSION = "0.1.52";
12
12
  var DB_NAMESPACE_SLUG = "autopilot_ops";
13
13
  var PAGE_ROUTE = "autopilot";
14
14
  var TOOL_NAMES = {
package/dist/worker.js CHANGED
@@ -39932,7 +39932,7 @@ function startWorkerRpcHost(options) {
39932
39932
 
39933
39933
  // src/manifest.ts
39934
39934
  var PLUGIN_ID = "alephoo.autopilot-ops";
39935
- var PLUGIN_VERSION = "0.1.51";
39935
+ var PLUGIN_VERSION = "0.1.52";
39936
39936
  var DB_NAMESPACE_SLUG = "autopilot_ops";
39937
39937
  var PAGE_ROUTE = "autopilot";
39938
39938
  var TOOL_NAMES = {
@@ -42502,12 +42502,12 @@ function observacionDe(r) {
42502
42502
  if (r.situacion !== "habilitado") return "inhabilitada";
42503
42503
  return null;
42504
42504
  }
42505
- function matriculaInvalida(cargada) {
42505
+ function matriculaInvalida(cargada, tipo) {
42506
42506
  const crudo = String(cargada ?? "").trim();
42507
42507
  if (!crudo) return false;
42508
42508
  if (/[^0-9\s.\-/]/.test(crudo)) return true;
42509
42509
  const d = crudo.replace(/\D/g, "");
42510
- if (d.length < 4) return true;
42510
+ if (d.length < (tipo === "provincial" ? 3 : 4)) return true;
42511
42511
  if (/^(\d)\1+$/.test(d)) return true;
42512
42512
  return "01234567890".includes(d) || "9876543210".includes(d);
42513
42513
  }
@@ -42516,7 +42516,7 @@ function tienePropiaHabilitada(enRegistro) {
42516
42516
  }
42517
42517
  function observacionMatricula(r, ficha) {
42518
42518
  const obs = observacionDe(r);
42519
- if ((obs === "otra_persona" || obs === "no_figura") && (matriculaInvalida(ficha.cargada) || tienePropiaHabilitada(ficha.enRegistro))) return "numero_mal_cargado";
42519
+ if ((obs === "otra_persona" || obs === "no_figura") && (matriculaInvalida(ficha.cargada, ficha.tipo) || tienePropiaHabilitada(ficha.enRegistro))) return "numero_mal_cargado";
42520
42520
  return obs;
42521
42521
  }
42522
42522
  var GRAVES_MATRICULA = ["inhabilitada", "sancion", "otra_persona"];
@@ -42581,6 +42581,8 @@ var credencialProfesional = {
42581
42581
  descripcion: "La matr\xEDcula est\xE1 de verdad inhabilitada, con sanci\xF3n o a nombre de otra persona: la instituci\xF3n suspendi\xF3 la agenda del profesional hasta que lo regularice. Queda registrado qui\xE9n lo decidi\xF3 y por qu\xE9.",
42582
42582
  validar: (caso, datos) => [
42583
42583
  GRAVES_MATRICULA.includes(texto4(caso.datos.observacion) ?? "") ? ok("observacion_grave") : falla("observacion_grave", "suspender la agenda es para una matr\xEDcula inhabilitada, con sanci\xF3n o a nombre de otra persona"),
42584
+ // A nombre de otra persona: solo con la búsqueda por nombre hecha (sin ella puede ser un número mal cargado).
42585
+ caso.datos.observacion !== "otra_persona" || Array.isArray(caso.datos.en_registro) ? ok("busqueda_por_nombre") : falla("busqueda_por_nombre", "a nombre de otra persona sin buscar al profesional por su nombre en el registro: volver a verificarlo antes de suspender"),
42584
42586
  texto4(datos.motivo) ? ok("motivo_presente") : falla("motivo_presente", "suspender_agenda requiere motivo")
42585
42587
  ]
42586
42588
  },
@@ -44889,7 +44891,7 @@ function resultadoDistinto(leido, informado) {
44889
44891
  function fichaMatricula(d) {
44890
44892
  const tipo = String(d.tipo_matricula ?? "");
44891
44893
  const cargada = tipo === "provincial" ? d.matricula_provincial : tipo === "nacional" ? d.matricula_nacional : void 0;
44892
- return { cargada: cargada ?? d.matricula, enRegistro: d.en_registro };
44894
+ return { cargada: cargada ?? d.matricula, tipo: tipo || null, enRegistro: d.en_registro };
44893
44895
  }
44894
44896
  function conMarcasMatricula(workflow, datos, titulo) {
44895
44897
  if (workflow !== "credencial_profesional") return datos;
@@ -44898,7 +44900,7 @@ function conMarcasMatricula(workflow, datos, titulo) {
44898
44900
  const r = leerResultadoRegistro(d.resultado);
44899
44901
  if (r && (d.observacion === "otra_persona" || d.observacion === "no_figura")) {
44900
44902
  const obs = observacionMatricula(r, fichaMatricula(d));
44901
- if (obs !== d.observacion) d = { ...d, observacion: obs, mal_cargado_por: matriculaInvalida(fichaMatricula(d).cargada) ? "formato" : "propia_en_registro" };
44903
+ if (obs !== d.observacion) d = { ...d, observacion: obs, mal_cargado_por: matriculaInvalida(fichaMatricula(d).cargada, fichaMatricula(d).tipo) ? "formato" : "propia_en_registro" };
44902
44904
  }
44903
44905
  return d;
44904
44906
  }
@@ -45531,7 +45533,7 @@ async function transicionar(ctx, input2) {
45531
45533
  );
45532
45534
  const lectura = rows[0];
45533
45535
  const evidencia = lectura && lectura.evidencia && typeof lectura.evidencia === "object" ? lectura.evidencia : null;
45534
- const distinta = lectura && caso.workflow === "credencial_profesional" && resultado.via === "verificar" && evidencia ? evidencia.profesional_id !== void 0 && String(evidencia.profesional_id) !== String(datos.profesional_id ?? caso.datos.profesional_id ?? "") ? `la lectura ${lecturaId} es de otro profesional (${String(evidencia.profesional_id)})` : evidencia.matricula !== void 0 && datos.matricula !== void 0 && datos.matricula !== null && String(evidencia.matricula) !== String(datos.matricula) ? `la lectura ${lecturaId} es de la matr\xEDcula ${String(evidencia.matricula)} y se informa la ${String(datos.matricula)}` : resultadoDistinto(evidencia.resultado, datos.resultado) ? `lo que se informa no es lo que devolvi\xF3 el registro en la lectura ${lecturaId}: ${resultadoDistinto(evidencia.resultado, datos.resultado)}` : null : null;
45536
+ const distinta = lectura && caso.workflow === "credencial_profesional" && resultado.via === "verificar" && evidencia ? evidencia.profesional_id !== void 0 && String(evidencia.profesional_id) !== String(datos.profesional_id ?? caso.datos.profesional_id ?? "") ? `la lectura ${lecturaId} es de otro profesional (${String(evidencia.profesional_id)})` : evidencia.matricula !== void 0 && datos.matricula !== void 0 && datos.matricula !== null && String(evidencia.matricula) !== String(datos.matricula) ? `la lectura ${lecturaId} es de la matr\xEDcula ${String(evidencia.matricula)} y se informa la ${String(datos.matricula)}` : leerResultadoRegistro(evidencia.resultado) === null ? `la lectura ${lecturaId} no guard\xF3 el resultado del registro (evidencia.resultado): sin eso no se puede comprobar lo que se informa` : evidencia.matricula === void 0 && leerResultadoRegistro(datos.resultado)?.sin_matricula !== true ? `la lectura ${lecturaId} no guard\xF3 qu\xE9 matr\xEDcula se consult\xF3 (evidencia.matricula)` : resultadoDistinto(evidencia.resultado, datos.resultado) ? `lo que se informa no es lo que devolvi\xF3 el registro en la lectura ${lecturaId}: ${resultadoDistinto(evidencia.resultado, datos.resultado)}` : null : null;
45535
45537
  let vieja = false;
45536
45538
  if (lectura && (resultado.via === "comprobar" || (caso.workflow === "circular_aranceles" || caso.workflow === "ajuste_convenio") && resultado.via === "verificar" || caso.workflow === "credencial_profesional" && resultado.via === "verificar" && caso.estado === "corregida")) {
45537
45539
  const ultima = await ctx.db.query(
@@ -45866,7 +45868,7 @@ async function transicionar(ctx, input2) {
45866
45868
  if (r) {
45867
45869
  datos.resultado = r;
45868
45870
  datos.observacion = observacionMatricula(r, fichaMatricula({ ...caso.datos, ...datos }));
45869
- datos.mal_cargado_por = datos.observacion === "numero_mal_cargado" ? matriculaInvalida(fichaMatricula({ ...caso.datos, ...datos }).cargada) ? "formato" : "propia_en_registro" : null;
45871
+ datos.mal_cargado_por = datos.observacion === "numero_mal_cargado" ? ((f) => matriculaInvalida(f.cargada, f.tipo) ? "formato" : "propia_en_registro")(fichaMatricula({ ...caso.datos, ...datos })) : null;
45870
45872
  datos.verificada_el = contexto.hoy ?? null;
45871
45873
  }
45872
45874
  if (caso.estado === "corregida") {
@@ -46840,7 +46842,7 @@ async function casosQueEsperan(ctx, companyId, workflows) {
46840
46842
  const out = [];
46841
46843
  for (const [workflow, estados] of Object.entries(ESPERAN_PERSONA)) {
46842
46844
  if (workflows && workflows.length > 0 && !workflows.includes(workflow)) continue;
46843
- out.push(...await listarCasos(ctx, { companyId, workflow, estados, limit: 100 }));
46845
+ out.push(...await listarCasos(ctx, { companyId, workflow, estados, limit: 500 }));
46844
46846
  }
46845
46847
  return out;
46846
46848
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paperclip-plugin-autopilot-ops",
3
- "version": "0.1.51",
3
+ "version": "0.1.52",
4
4
  "type": "module",
5
5
  "description": "Autopilot Care · operación autónoma gobernada para instituciones de salud: workflows determinísticos, validaciones, registro de negocio, políticas (observa/propone/ejecuta/corte) y tablero del director, como plugin de Paperclip.",
6
6
  "files": [