paperclip-plugin-autopilot-ops 0.1.19 → 0.1.20
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 +1 -1
- package/dist/ui/index.js +1 -1
- package/dist/worker.js +9 -6
- package/package.json +1 -1
package/dist/manifest.js
CHANGED
package/dist/ui/index.js
CHANGED
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.
|
|
39935
|
+
var PLUGIN_VERSION = "0.1.20";
|
|
39936
39936
|
var DB_NAMESPACE_SLUG = "autopilot_ops";
|
|
39937
39937
|
var PAGE_ROUTE = "autopilot";
|
|
39938
39938
|
var TOOL_NAMES = {
|
|
@@ -42867,16 +42867,19 @@ async function listarAvisos(ctx, companyId, opciones = {}) {
|
|
|
42867
42867
|
const rows = await ctx.db.query(`SELECT ${COLS_AVISO} FROM ${t3(ctx, "aviso")} WHERE company_id = $1 AND dia >= $2 ORDER BY created_at ASC`, [companyId, desde]);
|
|
42868
42868
|
return rows.map(mapAviso);
|
|
42869
42869
|
}
|
|
42870
|
-
async function casosQueEsperan(ctx, companyId) {
|
|
42870
|
+
async function casosQueEsperan(ctx, companyId, workflows) {
|
|
42871
42871
|
const out = [];
|
|
42872
|
-
for (const [workflow, estados] of Object.entries(ESPERAN_PERSONA))
|
|
42872
|
+
for (const [workflow, estados] of Object.entries(ESPERAN_PERSONA)) {
|
|
42873
|
+
if (workflows && workflows.length > 0 && !workflows.includes(workflow)) continue;
|
|
42874
|
+
out.push(...await listarCasos(ctx, { companyId, workflow, estados, limit: 100 }));
|
|
42875
|
+
}
|
|
42873
42876
|
return out;
|
|
42874
42877
|
}
|
|
42875
|
-
async function responsablesPendientes(ctx, companyId) {
|
|
42878
|
+
async function responsablesPendientes(ctx, companyId, workflows) {
|
|
42876
42879
|
const contactos = await listarContactos(ctx, companyId);
|
|
42877
42880
|
const con = new Map(contactos.filter((c) => c.activo && (c.mail || c.whatsapp)).map((c) => [c.clave, c]));
|
|
42878
42881
|
const acumulado = /* @__PURE__ */ new Map();
|
|
42879
|
-
for (const caso of await casosQueEsperan(ctx, companyId)) {
|
|
42882
|
+
for (const caso of await casosQueEsperan(ctx, companyId, workflows)) {
|
|
42880
42883
|
for (const p of pendientesDe(caso)) {
|
|
42881
42884
|
const r = acumulado.get(p.responsable.clave) ?? { clave: p.responsable.clave, nombre: p.responsable.nombre, pendientes: 0, tieneContacto: con.has(p.responsable.clave), reserva: p.responsable.reserva };
|
|
42882
42885
|
r.pendientes += 1;
|
|
@@ -43619,7 +43622,7 @@ async function manejarApi(ctx, input2) {
|
|
|
43619
43622
|
case "contacto":
|
|
43620
43623
|
return respuesta(200, await registrarContacto(ctx, { companyId, casoId: input2.params.casoId ?? "", canal: body.canal, respuesta: body.respuesta, comentario: str3(body.comentario), persona: decididoPor, idempotencyKey: str3(body.idempotencyKey), actor }));
|
|
43621
43624
|
case "contactos":
|
|
43622
|
-
return respuesta(200, await responsablesPendientes(ctx, companyId));
|
|
43625
|
+
return respuesta(200, await responsablesPendientes(ctx, companyId, (qs("workflows") ?? "").split(",").map((w) => w.trim()).filter(Boolean)));
|
|
43623
43626
|
case "guardar-contacto": {
|
|
43624
43627
|
if (actor.tipo !== "humano") return respuesta(403, { error: "actor_no_permitido", motivo: "los contactos los carga una persona de la instituci\xF3n" });
|
|
43625
43628
|
return respuesta(200, { contacto: await guardarContacto(ctx, { companyId, clave: str3(body.clave) ?? "", nombre: str3(body.nombre), mail: str3(body.mail), whatsapp: str3(body.whatsapp), activo: body.activo !== false, 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.
|
|
3
|
+
"version": "0.1.20",
|
|
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": [
|