paperclip-plugin-autopilot-ops 0.1.40 → 0.1.41

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.40";
3
+ var PLUGIN_VERSION = "0.1.41";
4
4
  var DB_NAMESPACE_SLUG = "autopilot_ops";
5
5
  var PAGE_ROUTE = "autopilot";
6
6
  var TOOL_NAMES = {
@@ -402,6 +402,22 @@ var manifest = {
402
402
  capability: "api.routes.register",
403
403
  companyResolution: { from: "query", key: "companyId" }
404
404
  },
405
+ {
406
+ routeKey: "tableros-retirados",
407
+ method: "GET",
408
+ path: "/tableros-retirados",
409
+ auth: "board",
410
+ capability: "api.routes.register",
411
+ companyResolution: { from: "query", key: "companyId" }
412
+ },
413
+ {
414
+ routeKey: "restaurar-tablero",
415
+ method: "POST",
416
+ path: "/tableros/:clave/restaurar",
417
+ auth: "board",
418
+ capability: "api.routes.register",
419
+ companyResolution: { from: "query", key: "companyId" }
420
+ },
405
421
  {
406
422
  routeKey: "retirar-tablero",
407
423
  method: "POST",
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.40";
11
+ var PLUGIN_VERSION = "0.1.41";
12
12
  var DB_NAMESPACE_SLUG = "autopilot_ops";
13
13
  var PAGE_ROUTE = "autopilot";
14
14
  var TOOL_NAMES = {
@@ -410,6 +410,22 @@ var manifest = {
410
410
  capability: "api.routes.register",
411
411
  companyResolution: { from: "query", key: "companyId" }
412
412
  },
413
+ {
414
+ routeKey: "tableros-retirados",
415
+ method: "GET",
416
+ path: "/tableros-retirados",
417
+ auth: "board",
418
+ capability: "api.routes.register",
419
+ companyResolution: { from: "query", key: "companyId" }
420
+ },
421
+ {
422
+ routeKey: "restaurar-tablero",
423
+ method: "POST",
424
+ path: "/tableros/:clave/restaurar",
425
+ auth: "board",
426
+ capability: "api.routes.register",
427
+ companyResolution: { from: "query", key: "companyId" }
428
+ },
413
429
  {
414
430
  routeKey: "retirar-tablero",
415
431
  method: "POST",
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.40";
39935
+ var PLUGIN_VERSION = "0.1.41";
39936
39936
  var DB_NAMESPACE_SLUG = "autopilot_ops";
39937
39937
  var PAGE_ROUTE = "autopilot";
39938
39938
  var TOOL_NAMES = {
@@ -40334,6 +40334,22 @@ var manifest = {
40334
40334
  capability: "api.routes.register",
40335
40335
  companyResolution: { from: "query", key: "companyId" }
40336
40336
  },
40337
+ {
40338
+ routeKey: "tableros-retirados",
40339
+ method: "GET",
40340
+ path: "/tableros-retirados",
40341
+ auth: "board",
40342
+ capability: "api.routes.register",
40343
+ companyResolution: { from: "query", key: "companyId" }
40344
+ },
40345
+ {
40346
+ routeKey: "restaurar-tablero",
40347
+ method: "POST",
40348
+ path: "/tableros/:clave/restaurar",
40349
+ auth: "board",
40350
+ capability: "api.routes.register",
40351
+ companyResolution: { from: "query", key: "companyId" }
40352
+ },
40337
40353
  {
40338
40354
  routeKey: "retirar-tablero",
40339
40355
  method: "POST",
@@ -46955,6 +46971,7 @@ function controlarTabla(ref, columnas, filas, problemas) {
46955
46971
  }
46956
46972
  }
46957
46973
  }
46974
+ var MAX_BARRAS = 12;
46958
46975
  function validarWidgets(entrada) {
46959
46976
  const problemas = [];
46960
46977
  const lista3 = Array.isArray(entrada) ? entrada : [];
@@ -46985,9 +47002,9 @@ function validarWidgets(entrada) {
46985
47002
  case "barras": {
46986
47003
  const titulo = texto9(o.titulo, 120, `${ref}.titulo`, problemas, true) ?? "";
46987
47004
  const series = arr(o.series);
46988
- if (series.length === 0 || series.length > 40) problemas.push(`${ref}.series debe tener entre 1 y 40 barras`);
47005
+ if (series.length === 0 || series.length > MAX_BARRAS) problemas.push(`${ref}.series debe tener entre 1 y ${MAX_BARRAS} barras: mostr\xE1 las principales y sum\xE1 el resto en una barra \xABOtros\xBB (el detalle completo puede ir en una tabla)`);
46989
47006
  const unidad = texto9(o.unidad, 16, `${ref}.unidad`, problemas);
46990
- const barras = series.slice(0, 40).map((s, j) => {
47007
+ const barras = series.slice(0, MAX_BARRAS).map((s, j) => {
46991
47008
  const so = s && typeof s === "object" ? s : {};
46992
47009
  return { etiqueta: texto9(so.etiqueta, 60, `${ref}.series[${j}].etiqueta`, problemas, true) ?? "", valor: numero2(so.valor, `${ref}.series[${j}].valor`, problemas) };
46993
47010
  });
@@ -47103,6 +47120,20 @@ async function publicarTablero(ctx, input2) {
47103
47120
  tablero: { id: id3, companyId: input2.companyId, clave, titulo, descripcion: limpio(input2.descripcion, 600), pedido: limpio(input2.pedido, 1e3), periodo: limpio(input2.periodo, 80), fuentes, widgets, agenteId: input2.agenteId ?? null, issueId: input2.issueId ?? null, publicadoPorTipo: input2.actor.tipo, publicadoPorId: input2.actor.id, versiones: 1, createdAt: now, updatedAt: now, retirado: null }
47104
47121
  };
47105
47122
  }
47123
+ async function listarTablerosRetirados(ctx, companyId) {
47124
+ const rows = await ctx.db.query(`SELECT ${COLS2} FROM ${t5(ctx, "tablero")} WHERE company_id = $1 AND retirado_at IS NOT NULL ORDER BY retirado_at DESC`, [companyId]);
47125
+ return rows.map(mapTablero);
47126
+ }
47127
+ async function restaurarTablero(ctx, input2) {
47128
+ if (input2.actor.tipo !== "humano") throw new OpsError("actor_no_permitido", "un tablero retirado lo vuelve a mostrar una persona de la instituci\xF3n");
47129
+ const clave = typeof input2.clave === "string" ? input2.clave.trim().toLowerCase() : "";
47130
+ const previo = CLAVE_RE2.test(clave) ? await leerTablero(ctx, input2.companyId, clave) : null;
47131
+ if (!previo) throw new OpsError("tablero_inexistente", "no hay un tablero con esa clave");
47132
+ if (!previo.retirado) return previo;
47133
+ await ctx.db.execute(`UPDATE ${t5(ctx, "tablero")} SET retirado_at = NULL, retirado_por = NULL, retirado_motivo = NULL WHERE company_id = $1 AND clave = $2`, [input2.companyId, clave]);
47134
+ await ctx.activity.log({ companyId: input2.companyId, message: `Autopilot Care: tablero \xAB${previo.titulo}\xBB vuelve a mostrarse (${clave})`, metadata: { clave, por: input2.actor.id } });
47135
+ return { ...previo, retirado: null };
47136
+ }
47106
47137
  async function retirarTablero(ctx, input2) {
47107
47138
  if (input2.actor.tipo !== "humano") throw new OpsError("actor_no_permitido", "un tablero lo da de baja una persona de la instituci\xF3n");
47108
47139
  const clave = typeof input2.clave === "string" ? input2.clave.trim().toLowerCase() : "";
@@ -47448,6 +47479,12 @@ async function manejarApi(ctx, input2) {
47448
47479
  const tb = await leerTablero(ctx, companyId, (input2.params.clave ?? "").toLowerCase());
47449
47480
  return tb && !tb.retirado ? respuesta(200, tb) : respuesta(404, { error: "tablero_inexistente" });
47450
47481
  }
47482
+ case "tableros-retirados":
47483
+ return respuesta(200, { tableros: await listarTablerosRetirados(ctx, companyId) });
47484
+ case "restaurar-tablero": {
47485
+ if (actor.tipo !== "humano") return respuesta(403, { error: "actor_no_permitido", motivo: "un tablero retirado lo vuelve a mostrar una persona de la instituci\xF3n" });
47486
+ return respuesta(200, { tablero: await restaurarTablero(ctx, { companyId, clave: input2.params.clave ?? "", actor: { tipo: "humano", id: decididoPor ?? actor.id } }) });
47487
+ }
47451
47488
  case "retirar-tablero": {
47452
47489
  if (actor.tipo !== "humano") return respuesta(403, { error: "actor_no_permitido", motivo: "un tablero lo da de baja una persona de la instituci\xF3n" });
47453
47490
  return respuesta(200, { tablero: await retirarTablero(ctx, { companyId, clave: input2.params.clave ?? "", motivo: str3(body.motivo), actor: { tipo: "humano", id: decididoPor ?? actor.id } }) });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paperclip-plugin-autopilot-ops",
3
- "version": "0.1.40",
3
+ "version": "0.1.41",
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": [