paperclip-plugin-autopilot-ops 0.1.43 → 0.1.44

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.43";
3
+ var PLUGIN_VERSION = "0.1.44";
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.43";
11
+ var PLUGIN_VERSION = "0.1.44";
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.43";
39935
+ var PLUGIN_VERSION = "0.1.44";
39936
39936
  var DB_NAMESPACE_SLUG = "autopilot_ops";
39937
39937
  var PAGE_ROUTE = "autopilot";
39938
39938
  var TOOL_NAMES = {
@@ -46995,7 +46995,16 @@ function controlarTabla(ref, columnas, filas, problemas) {
46995
46995
  }
46996
46996
  }
46997
46997
  function jergaEn(texto10) {
46998
- const m = /\b[A-Z]{2,5}-\d+\b|\b[a-z]+_[a-z0-9_]+\b|\bv\d+\.\d+(\.\d+)?\b/.exec(texto10) ?? /\bAlephoo\b|\bcapa sem[aá]ntica\b|\brecetas? sem[aá]nticas?\b/i.exec(texto10);
46998
+ const m = /\b[A-Z]{2,5}-\d+\b|\b[a-z]+_[a-z0-9_]+\b|\bv\d+\.\d+(\.\d+)?\b|\b[Ii][Dd] \d+\b/.exec(texto10) ?? /\bAlephoo\b|\bcapa sem[aá]ntica\b|\brecetas? sem[aá]nticas?\b|\bborrad[oa]s? l[oó]gicamente\b|\bSELECT\b/i.exec(texto10);
46999
+ return m ? m[0] : null;
47000
+ }
47001
+ var MAX_TEXTOS = 1;
47002
+ var MAX_LARGO_LECTURA = 900;
47003
+ var MAX_LARGO_PERIODO = 60;
47004
+ var MAX_LARGO_DESCRIPCION = 160;
47005
+ var MAX_LARGO_CONTEXTO = 120;
47006
+ function marcaDelSistemaEn(texto10) {
47007
+ const m = /\bAlephoo\b|\b[Ii][Dd] \d+\b/.exec(texto10);
46999
47008
  return m ? m[0] : null;
47000
47009
  }
47001
47010
  var MAX_BARRAS = 12;
@@ -47023,7 +47032,7 @@ function validarWidgets(entrada) {
47023
47032
  const unidad = texto9(o.unidad, 16, `${ref}.unidad`, problemas);
47024
47033
  if (unidad === "%" && !ES_VARIACION.test(etiqueta)) controlarPorcentaje(valor, `${ref}.valor`, problemas);
47025
47034
  const { calculo, origen } = leerCalculo(o.calculo, ref, problemas);
47026
- salida.push({ tipo, etiqueta, valor, unidad, contexto: texto9(o.contexto, 160, `${ref}.contexto`, problemas), tono, ancho: a, ...calculo ? { calculo } : {}, origen });
47035
+ salida.push({ tipo, etiqueta, valor, unidad, contexto: texto9(o.contexto, MAX_LARGO_CONTEXTO, `${ref}.contexto`, problemas), tono, ancho: a, ...calculo ? { calculo } : {}, origen });
47027
47036
  break;
47028
47037
  }
47029
47038
  case "barras": {
@@ -47082,15 +47091,36 @@ function validarWidgets(entrada) {
47082
47091
  }
47083
47092
  });
47084
47093
  for (const [k, w] of salida.entries()) {
47085
- const textos = [w.tipo === "texto" ? w.texto : null, w.tipo === "texto" ? w.titulo : null, "titulo" in w ? w.titulo : null, w.tipo === "indicador" ? w.contexto : null, w.tipo === "indicador" ? w.etiqueta : null].filter((x) => typeof x === "string");
47086
- for (const x of textos) {
47094
+ const textos2 = [w.tipo === "texto" ? w.texto : null, w.tipo === "texto" ? w.titulo : null, "titulo" in w ? w.titulo : null, w.tipo === "indicador" ? w.contexto : null, w.tipo === "indicador" ? w.etiqueta : null].filter((x) => typeof x === "string");
47095
+ for (const x of textos2) {
47087
47096
  const jerga = jergaEn(x);
47088
47097
  if (jerga) problemas.push(`widgets[${k}]: \xAB${jerga}\xBB es un t\xE9rmino interno; la direcci\xF3n no lo entiende (us\xE1 \xABel HIS\xBB y nombres de negocio; el detalle t\xE9cnico va en fuentes o en el comentario de la tarea)`);
47089
47098
  }
47090
47099
  }
47100
+ const vistos = /* @__PURE__ */ new Map();
47101
+ for (const [k, w] of salida.entries()) {
47102
+ if (w.tipo !== "indicador" || w.valor === "" || w.valor === 0) continue;
47103
+ const llave = `${w.valor}|${w.unidad ?? ""}`;
47104
+ if (vistos.has(llave)) problemas.push(`widgets[${k}]: repite el n\xFAmero de widgets[${vistos.get(llave)}] (${w.valor}${w.unidad ? ` ${w.unidad}` : ""}): dej\xE1 uno solo y llev\xE1 el otro dato al contexto`);
47105
+ else vistos.set(llave, k);
47106
+ }
47107
+ for (const [k, w] of salida.entries()) {
47108
+ const titulo = "titulo" in w ? w.titulo : void 0;
47109
+ if (titulo && /\$\s?\d|\d{1,3}(\.\d{3})+/.test(titulo)) problemas.push(`widgets[${k}]: el t\xEDtulo lleva una cifra (\xAB${titulo}\xBB): el t\xEDtulo dice qu\xE9 muestra; la cifra va en un indicador`);
47110
+ }
47111
+ for (const [k, w] of salida.entries()) {
47112
+ if (w.tipo === "indicador" && (w.tono === "ambar" || w.tono === "corte") && !w.contexto) problemas.push(`widgets[${k}]: un n\xFAmero en ${w.tono === "corte" ? "rojo" : "\xE1mbar"} lleva en \xABcontexto\xBB por qu\xE9 pide atenci\xF3n (una l\xEDnea)`);
47113
+ }
47114
+ for (const [k, w] of salida.entries()) {
47115
+ const nombres = w.tipo === "barras" ? w.series.map((x) => x.etiqueta) : w.tipo === "tabla" ? w.filas.flatMap((f) => f.filter((c) => typeof c === "string")) : [];
47116
+ const marca = nombres.map(marcaDelSistemaEn).find(Boolean);
47117
+ if (marca) problemas.push(`widgets[${k}]: \xAB${marca}\xBB no es un dato de la instituci\xF3n (un usuario o la marca del sistema): sac\xE1 esa fila o agrupala en \xABSin asignar\xBB`);
47118
+ }
47119
+ const textos = salida.filter((w) => w.tipo === "texto");
47120
+ if (textos.length > MAX_TEXTOS) problemas.push(`un solo widget de texto (\xABLectura\xBB): lo que cambi\xF3 va en una frase al final de ella, el resto en el comentario de la tarea`);
47121
+ for (const t6 of textos) if (t6.texto.length > MAX_LARGO_LECTURA) problemas.push(`la Lectura tiene ${t6.texto.length} caracteres: hasta ${MAX_LARGO_LECTURA} (2 o 3 p\xE1rrafos breves; el primero, qu\xE9 conviene hacer)`);
47091
47122
  const tonos = (t6) => salida.filter((w) => w.tipo === "indicador" && w.tono === t6).length;
47092
- if (tonos("ambar") > 1) problemas.push("como m\xE1ximo un indicador en \xE1mbar por tablero: el que pide una acci\xF3n de la direcci\xF3n (los dem\xE1s, neutro)");
47093
- if (tonos("corte") > 1) problemas.push("como m\xE1ximo un indicador en rojo (corte) por tablero: solo lo urgente");
47123
+ if (tonos("ambar") + tonos("corte") > 1) problemas.push("como m\xE1ximo un indicador en \xE1mbar o rojo por tablero: el que pide una acci\xF3n de la direcci\xF3n (rojo solo si es urgente); los dem\xE1s, neutro");
47094
47124
  if (problemas.length) throw new OpsError("tablero_invalido", `el tablero no se puede publicar: ${problemas.slice(0, 12).join("; ")}${problemas.length > 12 ? ` (y ${problemas.length - 12} m\xE1s)` : ""}`, { problemas });
47095
47125
  return salida;
47096
47126
  }
@@ -47135,6 +47165,12 @@ async function publicarTablero(ctx, input2) {
47135
47165
  const jerga = typeof v === "string" ? jergaEn(v) : null;
47136
47166
  if (jerga) throw new OpsError("tablero_invalido", `${campo}: \xAB${jerga}\xBB es un t\xE9rmino interno; la direcci\xF3n no lo entiende (us\xE1 \xABel HIS\xBB y nombres de negocio)`);
47137
47167
  }
47168
+ if (typeof input2.descripcion === "string" && input2.descripcion.trim().length > MAX_LARGO_DESCRIPCION) {
47169
+ throw new OpsError("tablero_invalido", `descripcion: hasta ${MAX_LARGO_DESCRIPCION} caracteres (qu\xE9 muestra el tablero, en una o dos frases); el m\xE9todo va en fuentes o en el comentario de la tarea`);
47170
+ }
47171
+ if (typeof input2.periodo === "string" && input2.periodo.trim().length > MAX_LARGO_PERIODO) {
47172
+ throw new OpsError("tablero_invalido", `periodo: hasta ${MAX_LARGO_PERIODO} caracteres (p. ej. \xABoctubre 2025 a septiembre 2026\xBB); las aclaraciones van en la descripci\xF3n`);
47173
+ }
47138
47174
  const widgets = validarWidgets(input2.widgets);
47139
47175
  const fuentes = arr(input2.fuentes).filter((f) => typeof f === "string" && f.trim()).map((f) => String(f).trim().slice(0, 120)).slice(0, 12);
47140
47176
  const limpio = (v, max) => typeof v === "string" && v.trim() ? v.trim().slice(0, max) : null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paperclip-plugin-autopilot-ops",
3
- "version": "0.1.43",
3
+ "version": "0.1.44",
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": [