@johpaz/hive-agents 1.1.4 → 1.1.5
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/README.md +3 -3
- package/dist/hive.js +52027 -4372
- package/dist/tool-worker.js +49660 -1160
- package/dist/ui/assets/{A2UIPage-EDS7lN-K.js → A2UIPage-Dr3p75oE.js} +1 -1
- package/dist/ui/assets/{AgentCreateForm-KvhVhAFP.js → AgentCreateForm-DqYhH_gm.js} +1 -1
- package/dist/ui/assets/{AgentDetailPage-B2dCpO92.js → AgentDetailPage-BVtE88U5.js} +1 -1
- package/dist/ui/assets/{AgentNewPage-CF2B4dbu.js → AgentNewPage-BRpFxJIT.js} +1 -1
- package/dist/ui/assets/{AgentsPage-CMvz-CtA.js → AgentsPage-BOIJ55cj.js} +1 -1
- package/dist/ui/assets/{ApiClientPage-tzzL3rZC.js → ApiClientPage-R9UDWfR2.js} +1 -1
- package/dist/ui/assets/{ChannelsPage-fE2vRwup.js → ChannelsPage-C5V2BmjL.js} +1 -1
- package/dist/ui/assets/{DashboardPage-57SaHnBL.js → DashboardPage-B18gMzNj.js} +1 -1
- package/dist/ui/assets/{LoginPage-Fag9Bp5h.js → LoginPage-nrsYF9AY.js} +1 -1
- package/dist/ui/assets/{LogsPage-GVJd_a65.js → LogsPage-DICMU_7m.js} +1 -1
- package/dist/ui/assets/{MeetingPage-TKQu8Nr-.js → MeetingPage-xslJGfIz.js} +1 -1
- package/dist/ui/assets/{ModelSelector-DciHLo7R.js → ModelSelector-BX4IvuYY.js} +1 -1
- package/dist/ui/assets/Office3DPage-a6cuzt5X.js +727 -0
- package/dist/ui/assets/{ProvidersPage-BsWFvzqz.js → ProvidersPage-C8-xGoeh.js} +1 -1
- package/dist/ui/assets/{RecoverPage-BkdOyljs.js → RecoverPage-Blms3NBa.js} +1 -1
- package/dist/ui/assets/{SettingsPage-D_43Rc2I.js → SettingsPage-BBeeq_QS.js} +1 -1
- package/dist/ui/assets/{SetupPage-D6Z3SYZu.js → SetupPage-CAjLseE_.js} +1 -1
- package/dist/ui/assets/{Vignette-bSrGVyRd.js → Vignette-DrI2yK2m.js} +1 -1
- package/dist/ui/assets/VoicePage-BeSSYstD.js +307 -0
- package/dist/ui/assets/{WebChatPage-Dzk3FhiR.js → WebChatPage-Bat7uUfd.js} +1 -1
- package/dist/ui/assets/{bia-csMImkVQ.glb → bia-qdLMQRFi.glb} +0 -0
- package/dist/ui/assets/{conversationsStore-5hf5grlP.js → conversationsStore-DhM07qYi.js} +1 -1
- package/dist/ui/assets/{dialog-DKnsGLwr.js → dialog-BP3GTCPn.js} +1 -1
- package/dist/ui/assets/{index-mBw9Tl7u.js → index-BG3nUPKq.js} +2 -2
- package/dist/ui/assets/{useAudioDevices-BYFaA0X-.js → useAudioDevices-zj0fuGwZ.js} +1 -1
- package/dist/ui/assets/{useHiveAgentsModelLoad-RRQ6-ANC.js → useHiveAgentsModelLoad-Cd9p-bjs.js} +1 -1
- package/dist/ui/assets/{useProviders-DXr4pJ57.js → useProviders-Dj1k5PCk.js} +1 -1
- package/dist/ui/index.html +1 -1
- package/package.json +1 -1
- package/packages/cli/src/commands/onboard.ts +8 -7
- package/packages/core/src/gateway/routes/providers.ts +26 -79
- package/packages/core/src/gateway/server.ts +20 -0
- package/packages/core/src/scheduler/integration.ts +26 -20
- package/packages/core/src/storage/collections.ts +7 -0
- package/packages/core/src/storage/model-sync.ts +404 -0
- package/packages/core/src/storage/seed.ts +33 -3
- package/packages/core/src/tools/cron/index.ts +25 -3
- package/packages/core/src/tools/office/office-escribir-docx.ts +275 -97
- package/packages/core/src/tools/office/office-escribir-pdf.ts +489 -99
- package/packages/core/src/tools/office/office-escribir-pptx.ts +86 -84
- package/packages/core/src/tools/office/office-escribir-xlsx.ts +196 -40
- package/packages/core/src/tools/office/office-style.ts +452 -0
- package/packages/core/src/tools/web/obscura-install.ts +119 -0
- package/packages/core/src/tools/web/obscura.ts +26 -4
- package/packages/core/src/utils/date.ts +29 -0
- package/packages/skills/src/bundled-data.generated.ts +780 -780
- package/dist/ui/assets/Office3DPage-CQnO522l.js +0 -727
- package/dist/ui/assets/VoicePage-CCE2EOE9.js +0 -307
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Estilos y bloques compartidos por las herramientas office_escribir_*.
|
|
3
|
+
*
|
|
4
|
+
* Espeja el SDK de Rust (hiveSDK-Rust/crates/hive-core/src/tools/office): mismos
|
|
5
|
+
* temas, mismos colores y la misma forma de describir el contenido en bloques.
|
|
6
|
+
* Los parámetros antiguos (`parrafos`, `tablas`, `contenido`) se siguen aceptando
|
|
7
|
+
* y se convierten a bloques, así que las tareas y agentes existentes no se rompen.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export type Familia = "sans" | "serif" | "mono";
|
|
11
|
+
|
|
12
|
+
export interface TemaDocumento {
|
|
13
|
+
fuenteCuerpo: Familia;
|
|
14
|
+
fuenteTitulos: Familia;
|
|
15
|
+
texto: string;
|
|
16
|
+
titulo: string;
|
|
17
|
+
acento: string;
|
|
18
|
+
atenuado: string;
|
|
19
|
+
encabezadoTablaFondo: string;
|
|
20
|
+
encabezadoTablaTexto: string;
|
|
21
|
+
bordeTabla: string;
|
|
22
|
+
cebra: string;
|
|
23
|
+
codigoFondo: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const HEX = /^[0-9A-Fa-f]{6}$/;
|
|
27
|
+
|
|
28
|
+
/** Mismas paletas que `pdf_write.rs::theme_from`. */
|
|
29
|
+
const TEMAS_DOCUMENTO: Record<string, TemaDocumento> = {
|
|
30
|
+
modern: {
|
|
31
|
+
fuenteCuerpo: "sans", fuenteTitulos: "sans",
|
|
32
|
+
texto: "1E293B", titulo: "0F172A", acento: "2563EB", atenuado: "64748B",
|
|
33
|
+
encabezadoTablaFondo: "0F172A", encabezadoTablaTexto: "FFFFFF",
|
|
34
|
+
bordeTabla: "CBD5E1", cebra: "F1F5F9", codigoFondo: "F1F5F9",
|
|
35
|
+
},
|
|
36
|
+
classic: {
|
|
37
|
+
fuenteCuerpo: "serif", fuenteTitulos: "serif",
|
|
38
|
+
texto: "111111", titulo: "000000", acento: "7F1D1D", atenuado: "555555",
|
|
39
|
+
encabezadoTablaFondo: "E5E5E5", encabezadoTablaTexto: "000000",
|
|
40
|
+
bordeTabla: "999999", cebra: "F5F5F5", codigoFondo: "F3F3F3",
|
|
41
|
+
},
|
|
42
|
+
corporate: {
|
|
43
|
+
fuenteCuerpo: "sans", fuenteTitulos: "serif",
|
|
44
|
+
texto: "374151", titulo: "1E3A5F", acento: "B8923A", atenuado: "6B7280",
|
|
45
|
+
encabezadoTablaFondo: "1E3A5F", encabezadoTablaTexto: "FFFFFF",
|
|
46
|
+
bordeTabla: "D1D5DB", cebra: "F3F4F6", codigoFondo: "F3F4F6",
|
|
47
|
+
},
|
|
48
|
+
minimal: {
|
|
49
|
+
fuenteCuerpo: "sans", fuenteTitulos: "sans",
|
|
50
|
+
texto: "222222", titulo: "000000", acento: "444444", atenuado: "777777",
|
|
51
|
+
encabezadoTablaFondo: "FFFFFF", encabezadoTablaTexto: "000000",
|
|
52
|
+
bordeTabla: "DDDDDD", cebra: "FAFAFA", codigoFondo: "F5F5F5",
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
const CLAVES_COLOR: Record<string, keyof TemaDocumento> = {
|
|
57
|
+
text: "texto", texto: "texto",
|
|
58
|
+
heading: "titulo", titulo: "titulo",
|
|
59
|
+
accent: "acento", acento: "acento",
|
|
60
|
+
muted: "atenuado", atenuado: "atenuado",
|
|
61
|
+
table_header_background: "encabezadoTablaFondo", encabezado_tabla_fondo: "encabezadoTablaFondo",
|
|
62
|
+
table_header_text: "encabezadoTablaTexto", encabezado_tabla_texto: "encabezadoTablaTexto",
|
|
63
|
+
table_border: "bordeTabla", borde_tabla: "bordeTabla",
|
|
64
|
+
zebra: "cebra", cebra: "cebra",
|
|
65
|
+
code_background: "codigoFondo", codigo_fondo: "codigoFondo",
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export function hexValido(valor: unknown): string | null {
|
|
69
|
+
if (typeof valor !== "string") return null;
|
|
70
|
+
const limpio = valor.replace(/^#/, "");
|
|
71
|
+
return HEX.test(limpio) ? limpio.toUpperCase() : null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function familia(valor: unknown, defecto: Familia): Familia {
|
|
75
|
+
return valor === "sans" || valor === "serif" || valor === "mono" ? valor : defecto;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** Tema de documento (PDF/Word): preset + colores y fuentes que el llamador sobreescriba. */
|
|
79
|
+
export function resolverTemaDocumento(entrada: unknown): TemaDocumento {
|
|
80
|
+
const t = (entrada && typeof entrada === "object" ? entrada : {}) as Record<string, any>;
|
|
81
|
+
const nombre = String(t.preset ?? "modern");
|
|
82
|
+
const base = TEMAS_DOCUMENTO[nombre];
|
|
83
|
+
if (!base) {
|
|
84
|
+
throw new Error(
|
|
85
|
+
`Tema desconocido «${nombre}». Usa: ${Object.keys(TEMAS_DOCUMENTO).join(", ")}.`,
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
const tema: TemaDocumento = { ...base };
|
|
89
|
+
const colores = (t.colors ?? t.colores ?? {}) as Record<string, unknown>;
|
|
90
|
+
for (const [clave, valor] of Object.entries(colores)) {
|
|
91
|
+
const destino = CLAVES_COLOR[clave];
|
|
92
|
+
const hex = hexValido(valor);
|
|
93
|
+
if (destino && hex) (tema as any)[destino] = hex;
|
|
94
|
+
}
|
|
95
|
+
const fuentes = (t.fonts ?? t.fuentes ?? {}) as Record<string, unknown>;
|
|
96
|
+
tema.fuenteCuerpo = familia(fuentes.body ?? fuentes.cuerpo, tema.fuenteCuerpo);
|
|
97
|
+
tema.fuenteTitulos = familia(fuentes.heading ?? fuentes.titulos, tema.fuenteTitulos);
|
|
98
|
+
return tema;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// ─── Paletas de presentación (pptx.rs::preset) ───────────────────────────────
|
|
102
|
+
|
|
103
|
+
export interface PaletaPresentacion {
|
|
104
|
+
fondo: string;
|
|
105
|
+
titulo: string;
|
|
106
|
+
texto: string;
|
|
107
|
+
acento: string;
|
|
108
|
+
acento2: string;
|
|
109
|
+
portadaFondo: string;
|
|
110
|
+
portadaTexto: string;
|
|
111
|
+
fuenteTitulo: string;
|
|
112
|
+
fuenteCuerpo: string;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const PALETAS: Record<string, PaletaPresentacion> = {
|
|
116
|
+
modern: { fondo: "F8FAFC", titulo: "0F172A", texto: "334155", acento: "2563EB", acento2: "F59E0B", portadaFondo: "0F172A", portadaTexto: "FFFFFF", fuenteTitulo: "Calibri", fuenteCuerpo: "Calibri" },
|
|
117
|
+
light: { fondo: "FFFFFF", titulo: "1F2937", texto: "4B5563", acento: "0284C7", acento2: "94A3B8", portadaFondo: "0284C7", portadaTexto: "FFFFFF", fuenteTitulo: "Calibri", fuenteCuerpo: "Calibri" },
|
|
118
|
+
dark: { fondo: "111827", titulo: "F9FAFB", texto: "D1D5DB", acento: "22D3EE", acento2: "A78BFA", portadaFondo: "030712", portadaTexto: "F9FAFB", fuenteTitulo: "Calibri", fuenteCuerpo: "Calibri" },
|
|
119
|
+
corporate: { fondo: "FFFFFF", titulo: "1E3A5F", texto: "374151", acento: "1E3A5F", acento2: "B8923A", portadaFondo: "1E3A5F", portadaTexto: "FFFFFF", fuenteTitulo: "Georgia", fuenteCuerpo: "Calibri" },
|
|
120
|
+
warm: { fondo: "FFFBF5", titulo: "7C2D12", texto: "44403C", acento: "EA580C", acento2: "FACC15", portadaFondo: "7C2D12", portadaTexto: "FFF7ED", fuenteTitulo: "Georgia", fuenteCuerpo: "Calibri" },
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
const CLAVES_PALETA: Record<string, keyof PaletaPresentacion> = {
|
|
124
|
+
background: "fondo", fondo: "fondo",
|
|
125
|
+
title: "titulo", titulo: "titulo",
|
|
126
|
+
text: "texto", texto: "texto",
|
|
127
|
+
accent: "acento", acento: "acento",
|
|
128
|
+
accent2: "acento2", acento2: "acento2",
|
|
129
|
+
cover_background: "portadaFondo", portada_fondo: "portadaFondo",
|
|
130
|
+
cover_text: "portadaTexto", portada_texto: "portadaTexto",
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export function resolverPaleta(entrada: unknown): PaletaPresentacion {
|
|
134
|
+
const t = (entrada && typeof entrada === "object" ? entrada : {}) as Record<string, any>;
|
|
135
|
+
const nombre = String(t.preset ?? "modern");
|
|
136
|
+
const base = PALETAS[nombre];
|
|
137
|
+
if (!base) {
|
|
138
|
+
throw new Error(`Tema desconocido «${nombre}». Usa: ${Object.keys(PALETAS).join(", ")}.`);
|
|
139
|
+
}
|
|
140
|
+
const paleta = { ...base };
|
|
141
|
+
const colores = (t.colors ?? t.colores ?? {}) as Record<string, unknown>;
|
|
142
|
+
for (const [clave, valor] of Object.entries(colores)) {
|
|
143
|
+
const destino = CLAVES_PALETA[clave];
|
|
144
|
+
const hex = hexValido(valor);
|
|
145
|
+
if (destino && hex) (paleta as any)[destino] = hex;
|
|
146
|
+
}
|
|
147
|
+
const fuentes = (t.fonts ?? t.fuentes ?? {}) as Record<string, unknown>;
|
|
148
|
+
const nombreFuente = (v: unknown) =>
|
|
149
|
+
typeof v === "string" && /^[A-Za-z0-9 .-]{1,64}$/.test(v) ? v : null;
|
|
150
|
+
paleta.fuenteTitulo = nombreFuente(fuentes.title ?? fuentes.titulo) ?? paleta.fuenteTitulo;
|
|
151
|
+
paleta.fuenteCuerpo = nombreFuente(fuentes.body ?? fuentes.cuerpo) ?? paleta.fuenteCuerpo;
|
|
152
|
+
return paleta;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// ─── Bloques de contenido ────────────────────────────────────────────────────
|
|
156
|
+
|
|
157
|
+
export type Alineacion = "left" | "center" | "right" | "justify";
|
|
158
|
+
|
|
159
|
+
export interface Tramo {
|
|
160
|
+
text: string;
|
|
161
|
+
bold?: boolean;
|
|
162
|
+
italic?: boolean;
|
|
163
|
+
underline?: boolean;
|
|
164
|
+
color?: string;
|
|
165
|
+
size?: number;
|
|
166
|
+
font?: Familia;
|
|
167
|
+
link?: string;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export interface ElementoLista {
|
|
171
|
+
text: string;
|
|
172
|
+
items?: ElementoLista[];
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export interface Celda {
|
|
176
|
+
text: string;
|
|
177
|
+
bold?: boolean;
|
|
178
|
+
color?: string;
|
|
179
|
+
fill?: string;
|
|
180
|
+
align?: Alineacion;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export type Bloque =
|
|
184
|
+
| { type: "heading"; level: 1 | 2 | 3; text: string; runs?: Tramo[]; align?: Alineacion; color?: string }
|
|
185
|
+
| { type: "paragraph"; text: string; runs?: Tramo[]; align?: Alineacion; size?: number; bold?: boolean; italic?: boolean; color?: string; indent?: number; spaceAfter?: number }
|
|
186
|
+
| { type: "list"; style: "bullet" | "numbered"; items: ElementoLista[] }
|
|
187
|
+
| { type: "table"; header: boolean; zebra: boolean; columns?: number[]; align?: Alineacion[]; rows: Celda[][] }
|
|
188
|
+
| { type: "quote"; text: string; author?: string }
|
|
189
|
+
| { type: "code"; text: string }
|
|
190
|
+
| { type: "rule" }
|
|
191
|
+
| { type: "spacer"; height: number }
|
|
192
|
+
| { type: "page_break" };
|
|
193
|
+
|
|
194
|
+
const TIPOS: Record<string, string> = {
|
|
195
|
+
heading: "heading", encabezado: "heading", titulo: "heading", title: "heading",
|
|
196
|
+
title1: "heading", title2: "heading", title3: "heading",
|
|
197
|
+
titulo1: "heading", titulo2: "heading", titulo3: "heading",
|
|
198
|
+
paragraph: "paragraph", parrafo: "paragraph",
|
|
199
|
+
list: "list", lista: "list",
|
|
200
|
+
table: "table", tabla: "table",
|
|
201
|
+
quote: "quote", cita: "quote",
|
|
202
|
+
code: "code", codigo: "code",
|
|
203
|
+
rule: "rule", regla: "rule", linea: "rule",
|
|
204
|
+
spacer: "spacer", espacio: "spacer",
|
|
205
|
+
page_break: "page_break", salto_pagina: "page_break",
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
const ALINEACIONES = new Set(["left", "center", "right", "justify"]);
|
|
209
|
+
const ALINEACION_ES: Record<string, Alineacion> = {
|
|
210
|
+
izquierda: "left", centro: "center", centrado: "center", derecha: "right", justificado: "justify",
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
function alineacion(valor: unknown): Alineacion | undefined {
|
|
214
|
+
if (typeof valor !== "string") return undefined;
|
|
215
|
+
if (ALINEACIONES.has(valor)) return valor as Alineacion;
|
|
216
|
+
return ALINEACION_ES[valor];
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const g = (o: Record<string, any>, ...claves: string[]) => {
|
|
220
|
+
for (const c of claves) if (o[c] !== undefined && o[c] !== null) return o[c];
|
|
221
|
+
return undefined;
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
function tramos(valor: unknown): Tramo[] | undefined {
|
|
225
|
+
if (!Array.isArray(valor)) return undefined;
|
|
226
|
+
const salida: Tramo[] = [];
|
|
227
|
+
for (const r of valor) {
|
|
228
|
+
if (!r || typeof r !== "object") continue;
|
|
229
|
+
const o = r as Record<string, any>;
|
|
230
|
+
const text = String(g(o, "text", "texto") ?? "");
|
|
231
|
+
if (!text) continue;
|
|
232
|
+
const link = g(o, "link", "enlace");
|
|
233
|
+
salida.push({
|
|
234
|
+
text,
|
|
235
|
+
bold: g(o, "bold", "negrita") === true,
|
|
236
|
+
italic: g(o, "italic", "cursiva") === true,
|
|
237
|
+
underline: g(o, "underline", "subrayado") === true,
|
|
238
|
+
color: hexValido(g(o, "color")) ?? undefined,
|
|
239
|
+
size: typeof g(o, "size", "tamano", "tamaño") === "number" ? g(o, "size", "tamano", "tamaño") : undefined,
|
|
240
|
+
font: familia(g(o, "font", "fuente"), "sans") === g(o, "font", "fuente") ? g(o, "font", "fuente") : undefined,
|
|
241
|
+
link: typeof link === "string" && /^(https?:|mailto:)/i.test(link) ? link : undefined,
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
return salida.length ? salida : undefined;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
function elementos(valor: unknown): ElementoLista[] {
|
|
248
|
+
if (!Array.isArray(valor)) return [];
|
|
249
|
+
return valor.map((e) => {
|
|
250
|
+
if (typeof e === "string") return { text: e };
|
|
251
|
+
const o = (e ?? {}) as Record<string, any>;
|
|
252
|
+
return {
|
|
253
|
+
text: String(g(o, "text", "texto") ?? ""),
|
|
254
|
+
items: elementos(g(o, "items", "elementos")),
|
|
255
|
+
};
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function celda(valor: unknown): Celda {
|
|
260
|
+
if (valor === null || valor === undefined) return { text: "" };
|
|
261
|
+
if (typeof valor !== "object") return { text: String(valor) };
|
|
262
|
+
const o = valor as Record<string, any>;
|
|
263
|
+
return {
|
|
264
|
+
text: String(g(o, "text", "texto") ?? ""),
|
|
265
|
+
bold: g(o, "bold", "negrita") === true || undefined,
|
|
266
|
+
color: hexValido(g(o, "color")) ?? undefined,
|
|
267
|
+
fill: hexValido(g(o, "fill", "relleno")) ?? undefined,
|
|
268
|
+
align: alineacion(g(o, "align", "alineacion")),
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
function filas(valor: unknown): Celda[][] {
|
|
273
|
+
if (!Array.isArray(valor)) return [];
|
|
274
|
+
return valor.map((f) => {
|
|
275
|
+
// `{celdas: [...]}` (formato antiguo de Word) o un array de celdas directo.
|
|
276
|
+
const lista = Array.isArray(f) ? f : (f as any)?.celdas ?? (f as any)?.cells ?? [];
|
|
277
|
+
return (lista as unknown[]).map(celda);
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
function normalizarBloque(crudo: unknown): Bloque | null {
|
|
282
|
+
if (!crudo || typeof crudo !== "object") return null;
|
|
283
|
+
const o = crudo as Record<string, any>;
|
|
284
|
+
const tipoCrudo = String(g(o, "type", "tipo") ?? "paragraph").toLowerCase();
|
|
285
|
+
const tipo = TIPOS[tipoCrudo];
|
|
286
|
+
if (!tipo) return null;
|
|
287
|
+
|
|
288
|
+
const texto = String(g(o, "text", "texto") ?? "");
|
|
289
|
+
switch (tipo) {
|
|
290
|
+
case "heading": {
|
|
291
|
+
const dePrefijo = /(\d)$/.exec(tipoCrudo)?.[1];
|
|
292
|
+
const nivel = Number(g(o, "level", "nivel") ?? dePrefijo ?? 1);
|
|
293
|
+
return {
|
|
294
|
+
type: "heading",
|
|
295
|
+
level: (nivel >= 3 ? 3 : nivel <= 1 ? 1 : 2) as 1 | 2 | 3,
|
|
296
|
+
text: texto,
|
|
297
|
+
runs: tramos(g(o, "runs", "tramos")),
|
|
298
|
+
align: alineacion(g(o, "align", "alineacion")),
|
|
299
|
+
color: hexValido(g(o, "color")) ?? undefined,
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
case "paragraph": {
|
|
303
|
+
const tam = g(o, "size", "tamano", "tamaño");
|
|
304
|
+
return {
|
|
305
|
+
type: "paragraph",
|
|
306
|
+
text: texto,
|
|
307
|
+
runs: tramos(g(o, "runs", "tramos")),
|
|
308
|
+
align: alineacion(g(o, "align", "alineacion")),
|
|
309
|
+
size: typeof tam === "number" ? tam : undefined,
|
|
310
|
+
bold: g(o, "bold", "negrita") === true || undefined,
|
|
311
|
+
italic: g(o, "italic", "cursiva") === true || undefined,
|
|
312
|
+
color: hexValido(g(o, "color")) ?? undefined,
|
|
313
|
+
indent: typeof g(o, "indent", "sangria") === "number" ? g(o, "indent", "sangria") : undefined,
|
|
314
|
+
spaceAfter: typeof g(o, "space_after", "espacio_despues") === "number" ? g(o, "space_after", "espacio_despues") : undefined,
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
case "list": {
|
|
318
|
+
const estilo = String(g(o, "style", "estilo") ?? "bullet").toLowerCase();
|
|
319
|
+
return {
|
|
320
|
+
type: "list",
|
|
321
|
+
style: estilo === "numbered" || estilo === "numerada" ? "numbered" : "bullet",
|
|
322
|
+
items: elementos(g(o, "items", "elementos")),
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
case "table": {
|
|
326
|
+
const alin = g(o, "align", "alineacion");
|
|
327
|
+
return {
|
|
328
|
+
type: "table",
|
|
329
|
+
header: g(o, "header", "encabezado") !== false,
|
|
330
|
+
zebra: g(o, "zebra", "cebra") !== false,
|
|
331
|
+
columns: Array.isArray(g(o, "columns", "columnas"))
|
|
332
|
+
? (g(o, "columns", "columnas") as unknown[]).map(Number).filter((n) => n > 0)
|
|
333
|
+
: undefined,
|
|
334
|
+
align: Array.isArray(alin) ? alin.map((a) => alineacion(a) ?? "left") : undefined,
|
|
335
|
+
rows: filas(g(o, "rows", "filas")),
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
case "quote":
|
|
339
|
+
return { type: "quote", text: texto, author: g(o, "author", "autor") };
|
|
340
|
+
case "code":
|
|
341
|
+
return { type: "code", text: texto };
|
|
342
|
+
case "rule":
|
|
343
|
+
return { type: "rule" };
|
|
344
|
+
case "spacer":
|
|
345
|
+
return { type: "spacer", height: Number(g(o, "height", "alto") ?? 12) };
|
|
346
|
+
case "page_break":
|
|
347
|
+
return { type: "page_break" };
|
|
348
|
+
}
|
|
349
|
+
return null;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Texto plano → bloques. Reconoce `#`/`##`/`###`, viñetas (`-`, `*`, `•`),
|
|
354
|
+
* listas numeradas (`1.`), citas (`>`), reglas (`---`) y tablas con `|`; las
|
|
355
|
+
* líneas seguidas forman un párrafo y la línea en blanco los separa.
|
|
356
|
+
*/
|
|
357
|
+
export function textoABloques(texto: string): Bloque[] {
|
|
358
|
+
const bloques: Bloque[] = [];
|
|
359
|
+
let parrafo: string[] = [];
|
|
360
|
+
let lista: { style: "bullet" | "numbered"; items: ElementoLista[] } | null = null;
|
|
361
|
+
let tabla: string[][] | null = null;
|
|
362
|
+
|
|
363
|
+
const cerrarParrafo = () => {
|
|
364
|
+
if (parrafo.length) bloques.push({ type: "paragraph", text: parrafo.join(" ") });
|
|
365
|
+
parrafo = [];
|
|
366
|
+
};
|
|
367
|
+
const cerrarLista = () => {
|
|
368
|
+
if (lista) bloques.push({ type: "list", style: lista.style, items: lista.items });
|
|
369
|
+
lista = null;
|
|
370
|
+
};
|
|
371
|
+
const cerrarTabla = () => {
|
|
372
|
+
if (tabla && tabla.length) {
|
|
373
|
+
bloques.push({ type: "table", header: true, zebra: true, rows: tabla.map((f) => f.map((t) => ({ text: t }))) });
|
|
374
|
+
}
|
|
375
|
+
tabla = null;
|
|
376
|
+
};
|
|
377
|
+
const cerrarTodo = () => { cerrarParrafo(); cerrarLista(); cerrarTabla(); };
|
|
378
|
+
|
|
379
|
+
for (const bruta of texto.replace(/\r\n?/g, "\n").split("\n")) {
|
|
380
|
+
const linea = bruta.trimEnd();
|
|
381
|
+
const t = linea.trim();
|
|
382
|
+
if (!t) { cerrarTodo(); continue; }
|
|
383
|
+
|
|
384
|
+
const h = /^(#{1,3})\s+(.*)$/.exec(t);
|
|
385
|
+
if (h) { cerrarTodo(); bloques.push({ type: "heading", level: h[1]!.length as 1 | 2 | 3, text: h[2]! }); continue; }
|
|
386
|
+
if (/^(-{3,}|_{3,}|\*{3,})$/.test(t)) { cerrarTodo(); bloques.push({ type: "rule" }); continue; }
|
|
387
|
+
if (t.startsWith(">")) { cerrarTodo(); bloques.push({ type: "quote", text: t.replace(/^>\s?/, "") }); continue; }
|
|
388
|
+
|
|
389
|
+
if (t.startsWith("|") && t.endsWith("|")) {
|
|
390
|
+
cerrarParrafo(); cerrarLista();
|
|
391
|
+
if (/^\|[\s:|-]+\|$/.test(t)) continue; // separador markdown
|
|
392
|
+
(tabla ??= []).push(t.slice(1, -1).split("|").map((c) => c.trim()));
|
|
393
|
+
continue;
|
|
394
|
+
}
|
|
395
|
+
const b = /^[-*•]\s+(.*)$/.exec(t);
|
|
396
|
+
const n = /^\d+[.)]\s+(.*)$/.exec(t);
|
|
397
|
+
if (b || n) {
|
|
398
|
+
cerrarParrafo(); cerrarTabla();
|
|
399
|
+
const estilo = b ? "bullet" : "numbered";
|
|
400
|
+
if (lista && lista.style !== estilo) cerrarLista();
|
|
401
|
+
(lista ??= { style: estilo, items: [] }).items.push({ text: (b ?? n)![1]! });
|
|
402
|
+
continue;
|
|
403
|
+
}
|
|
404
|
+
cerrarLista(); cerrarTabla();
|
|
405
|
+
parrafo.push(t);
|
|
406
|
+
}
|
|
407
|
+
cerrarTodo();
|
|
408
|
+
return bloques;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Bloques de una llamada: `bloques`/`blocks` si vienen; si no, se arman a partir
|
|
413
|
+
* de los parámetros antiguos (`parrafos` y `tablas`, y `contenido` en PDF).
|
|
414
|
+
*/
|
|
415
|
+
export function bloquesDeParametros(params: Record<string, unknown>): Bloque[] {
|
|
416
|
+
const explicitos = (params.bloques ?? params.blocks) as unknown;
|
|
417
|
+
if (Array.isArray(explicitos)) {
|
|
418
|
+
return explicitos.map(normalizarBloque).filter((b): b is Bloque => b !== null);
|
|
419
|
+
}
|
|
420
|
+
const salida: Bloque[] = [];
|
|
421
|
+
if (typeof params.contenido === "string") salida.push(...textoABloques(params.contenido));
|
|
422
|
+
if (Array.isArray(params.parrafos)) {
|
|
423
|
+
// Elementos `lista` consecutivos se agrupan en una sola lista.
|
|
424
|
+
for (const p of params.parrafos) {
|
|
425
|
+
const o = (p ?? {}) as Record<string, any>;
|
|
426
|
+
const ultimo = salida[salida.length - 1];
|
|
427
|
+
if (String(o.tipo ?? o.type ?? "").toLowerCase() === "list" || String(o.tipo ?? o.type ?? "").toLowerCase() === "lista") {
|
|
428
|
+
const item: ElementoLista = { text: String(o.texto ?? o.text ?? "") };
|
|
429
|
+
if (ultimo?.type === "list" && ultimo.style === "bullet") ultimo.items.push(item);
|
|
430
|
+
else salida.push({ type: "list", style: "bullet", items: [item] });
|
|
431
|
+
continue;
|
|
432
|
+
}
|
|
433
|
+
const b = normalizarBloque(p);
|
|
434
|
+
if (b) salida.push(b);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
if (Array.isArray(params.tablas)) {
|
|
438
|
+
for (const t of params.tablas) {
|
|
439
|
+
const b = normalizarBloque({ type: "table", ...(t as object) });
|
|
440
|
+
if (b) salida.push(b);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
return salida;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/** Sustituye {page}, {pages} y {title} en el texto de encabezados y pies. */
|
|
447
|
+
export function rellenarMarcadores(texto: string, pagina: number, paginas: number, titulo: string): string {
|
|
448
|
+
return texto
|
|
449
|
+
.replace(/\{page\}|\{pagina\}/g, String(pagina))
|
|
450
|
+
.replace(/\{pages\}|\{paginas\}/g, String(paginas))
|
|
451
|
+
.replace(/\{title\}|\{titulo\}/g, titulo);
|
|
452
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Instalación automática del binario de Obscura en ~/.hive/bin.
|
|
3
|
+
*
|
|
4
|
+
* Se dispara la primera vez que una tool `obscura_*` no encuentra el binario.
|
|
5
|
+
* Baja el release fijado desde GitHub (Apache-2.0), lo extrae con `tar` (en
|
|
6
|
+
* Windows 10+ es bsdtar y también lee .zip) y lo deja listo para el resolvedor.
|
|
7
|
+
* `HIVE_OBSCURA_AUTO_INSTALL=0` lo apaga (entornos sin red o que lo gestionan aparte).
|
|
8
|
+
*/
|
|
9
|
+
import { chmodSync, existsSync, mkdirSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs"
|
|
10
|
+
import { homedir, tmpdir } from "node:os"
|
|
11
|
+
import { join } from "node:path"
|
|
12
|
+
import { logger } from "../../utils/logger.ts"
|
|
13
|
+
|
|
14
|
+
const log = logger.child("obscura-install")
|
|
15
|
+
|
|
16
|
+
/** Versión fijada: así una release nueva de Obscura no rompe a Hive sin pasar por un cambio nuestro. */
|
|
17
|
+
export const OBSCURA_VERSION = "v0.2.7"
|
|
18
|
+
const RELEASE_BASE = `https://github.com/h4ckf0r0day/obscura/releases/download/${OBSCURA_VERSION}`
|
|
19
|
+
|
|
20
|
+
export function obscuraInstallDir(): string {
|
|
21
|
+
return join(homedir(), ".hive", "bin")
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function obscuraBinName(): string {
|
|
25
|
+
return process.platform === "win32" ? "obscura.exe" : "obscura"
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Nombre del asset de la release para este equipo, o null si no hay build. */
|
|
29
|
+
export function obscuraAssetName(
|
|
30
|
+
platform: string = process.platform,
|
|
31
|
+
arch: string = process.arch,
|
|
32
|
+
): string | null {
|
|
33
|
+
const cpu = arch === "x64" ? "x86_64" : arch === "arm64" ? "aarch64" : null
|
|
34
|
+
if (!cpu) return null
|
|
35
|
+
if (platform === "linux") return `obscura-${cpu}-linux.tar.gz`
|
|
36
|
+
if (platform === "darwin") return `obscura-${cpu}-macos.tar.gz`
|
|
37
|
+
if (platform === "win32" && cpu === "x86_64") return "obscura-x86_64-windows.zip"
|
|
38
|
+
return null
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function autoInstallEnabled(): boolean {
|
|
42
|
+
const v = process.env.HIVE_OBSCURA_AUTO_INSTALL
|
|
43
|
+
return !(v === "0" || v === "false")
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function findBinary(dir: string, name: string): string | null {
|
|
47
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
48
|
+
const full = join(dir, entry.name)
|
|
49
|
+
if (entry.isFile() && entry.name === name) return full
|
|
50
|
+
if (entry.isDirectory()) {
|
|
51
|
+
const nested = findBinary(full, name)
|
|
52
|
+
if (nested) return nested
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return null
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
let inflight: Promise<string | null> | null = null
|
|
59
|
+
let lastError: string | null = null
|
|
60
|
+
|
|
61
|
+
/** Motivo del último intento fallido, para mostrarlo en el mensaje de error. */
|
|
62
|
+
export function obscuraInstallError(): string | null {
|
|
63
|
+
return lastError
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** Descarga e instala Obscura. Devuelve la ruta del binario o null si falló. Idempotente. */
|
|
67
|
+
export function installObscura(): Promise<string | null> {
|
|
68
|
+
if (!autoInstallEnabled()) {
|
|
69
|
+
lastError = "la instalación automática está apagada (HIVE_OBSCURA_AUTO_INSTALL=0)"
|
|
70
|
+
return Promise.resolve(null)
|
|
71
|
+
}
|
|
72
|
+
inflight ??= doInstall().finally(() => { inflight = null })
|
|
73
|
+
return inflight
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async function doInstall(): Promise<string | null> {
|
|
77
|
+
const asset = obscuraAssetName()
|
|
78
|
+
if (!asset) {
|
|
79
|
+
lastError = `no hay build de Obscura para ${process.platform}/${process.arch}`
|
|
80
|
+
return null
|
|
81
|
+
}
|
|
82
|
+
const dest = join(obscuraInstallDir(), obscuraBinName())
|
|
83
|
+
const work = join(tmpdir(), `hive-obscura-${process.pid}-${Date.now()}`)
|
|
84
|
+
try {
|
|
85
|
+
log.info(`[obscura] no está instalado; descargando ${asset} (${OBSCURA_VERSION})`)
|
|
86
|
+
mkdirSync(work, { recursive: true })
|
|
87
|
+
const res = await fetch(`${RELEASE_BASE}/${asset}`, { redirect: "follow" })
|
|
88
|
+
if (!res.ok) throw new Error(`descarga falló: HTTP ${res.status}`)
|
|
89
|
+
const archive = join(work, asset)
|
|
90
|
+
writeFileSync(archive, new Uint8Array(await res.arrayBuffer()))
|
|
91
|
+
|
|
92
|
+
const out = join(work, "out")
|
|
93
|
+
mkdirSync(out)
|
|
94
|
+
const tar = Bun.spawnSync(["tar", "-xf", archive, "-C", out], { stdout: "ignore", stderr: "pipe" })
|
|
95
|
+
if (tar.exitCode !== 0) throw new Error(`no se pudo extraer: ${tar.stderr.toString().trim()}`)
|
|
96
|
+
|
|
97
|
+
const found = findBinary(out, obscuraBinName())
|
|
98
|
+
if (!found) throw new Error("el archivo descargado no contiene el binario de Obscura")
|
|
99
|
+
|
|
100
|
+
mkdirSync(obscuraInstallDir(), { recursive: true })
|
|
101
|
+
// Escribir y renombrar: nunca queda un binario a medias si el proceso muere.
|
|
102
|
+
const tmpDest = `${dest}.part`
|
|
103
|
+
await Bun.write(tmpDest, Bun.file(found))
|
|
104
|
+
if (process.platform !== "win32") chmodSync(tmpDest, 0o755)
|
|
105
|
+
const { renameSync } = await import("node:fs")
|
|
106
|
+
renameSync(tmpDest, dest)
|
|
107
|
+
|
|
108
|
+
if (!existsSync(dest) || statSync(dest).size === 0) throw new Error("la instalación quedó vacía")
|
|
109
|
+
lastError = null
|
|
110
|
+
log.info(`[obscura] instalado en ${dest}`)
|
|
111
|
+
return dest
|
|
112
|
+
} catch (err) {
|
|
113
|
+
lastError = (err as Error).message
|
|
114
|
+
log.warn(`[obscura] instalación automática falló: ${lastError}`)
|
|
115
|
+
return null
|
|
116
|
+
} finally {
|
|
117
|
+
try { rmSync(work, { recursive: true, force: true }) } catch { /* ignore */ }
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -29,6 +29,7 @@ import { join } from "node:path"
|
|
|
29
29
|
import { logger } from "../../utils/logger.ts"
|
|
30
30
|
import type { Tool, ToolParameter } from "../types.ts"
|
|
31
31
|
import type { Subprocess } from "bun"
|
|
32
|
+
import { installObscura, obscuraInstallError } from "./obscura-install.ts"
|
|
32
33
|
|
|
33
34
|
const log = logger.child("obscura")
|
|
34
35
|
|
|
@@ -91,6 +92,27 @@ export function resolveObscuraBin(): string | null {
|
|
|
91
92
|
return null
|
|
92
93
|
}
|
|
93
94
|
|
|
95
|
+
/** Olvida el resultado cacheado de la búsqueda (tras instalar el binario). */
|
|
96
|
+
export function resetObscuraBinCache(): void {
|
|
97
|
+
cachedBin = undefined
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Garantiza el binario: si no está, lo descarga a ~/.hive/bin. Devuelve true si
|
|
102
|
+
* quedó disponible. Es lo que usan las tools; `obscuraAvailable` sigue siendo sync.
|
|
103
|
+
*/
|
|
104
|
+
export async function ensureObscura(): Promise<boolean> {
|
|
105
|
+
if (resolveObscuraBin()) return true
|
|
106
|
+
if (!(await installObscura())) return false
|
|
107
|
+
resetObscuraBinCache()
|
|
108
|
+
return resolveObscuraBin() !== null
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function installError(): string {
|
|
112
|
+
const why = obscuraInstallError()
|
|
113
|
+
return why ? `${INSTALL_ERROR} (instalación automática: ${why})` : INSTALL_ERROR
|
|
114
|
+
}
|
|
115
|
+
|
|
94
116
|
/** True when the Obscura CLI is available (used for capability reporting). */
|
|
95
117
|
export function obscuraAvailable(): boolean {
|
|
96
118
|
return resolveObscuraBin() !== null
|
|
@@ -154,8 +176,8 @@ class ObscuraMcpSession {
|
|
|
154
176
|
}
|
|
155
177
|
|
|
156
178
|
private async start(): Promise<void> {
|
|
157
|
-
|
|
158
|
-
|
|
179
|
+
if (!(await ensureObscura())) throw new Error(installError())
|
|
180
|
+
const bin = resolveObscuraBin()!
|
|
159
181
|
|
|
160
182
|
const args = ["mcp"]
|
|
161
183
|
if (process.env.OBSCURA_STEALTH === "1" || process.env.OBSCURA_STEALTH === "true") args.push("--stealth")
|
|
@@ -467,7 +489,7 @@ function obscuraTool(
|
|
|
467
489
|
...(required.length > 0 ? { required } : {}),
|
|
468
490
|
},
|
|
469
491
|
async execute(args: Record<string, unknown>): Promise<string | object> {
|
|
470
|
-
if (!
|
|
492
|
+
if (!(await ensureObscura())) return { ok: false, error: installError() }
|
|
471
493
|
|
|
472
494
|
// Forward only schema-declared keys
|
|
473
495
|
const serverArgs: Record<string, unknown> = {}
|
|
@@ -850,7 +872,7 @@ export function obscuraToolNames(): string[] {
|
|
|
850
872
|
|
|
851
873
|
/** List the tools the Obscura MCP server actually exposes (diagnostics). */
|
|
852
874
|
export async function listObscuraTools() {
|
|
853
|
-
if (!
|
|
875
|
+
if (!(await ensureObscura())) return { ok: false as const, error: installError(), tools: [] as Array<{ name: string; description?: string; inputSchema?: unknown }> }
|
|
854
876
|
try {
|
|
855
877
|
const tools = await getSession().listTools()
|
|
856
878
|
return { ok: true as const, tools, protocol: getSession().protocolVersion, mode: getSession().protocolMode }
|
|
@@ -40,3 +40,32 @@ export function getUserTime(timezone: string = "UTC", date: Date = new Date()):
|
|
|
40
40
|
return date.toISOString().split("T")[1].split(".")[0];
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Fecha y hora legibles en la zona horaria del usuario (p. ej. "17/11/2026 14:30:05").
|
|
46
|
+
* Acepta ISO o Date; devuelve null si no hay valor y cae a UTC si la zona es inválida.
|
|
47
|
+
*/
|
|
48
|
+
export function formatUserDateTime(
|
|
49
|
+
value: string | Date | null | undefined,
|
|
50
|
+
timezone: string = "UTC",
|
|
51
|
+
): string | null {
|
|
52
|
+
if (!value) return null;
|
|
53
|
+
const date = value instanceof Date ? value : new Date(value);
|
|
54
|
+
if (Number.isNaN(date.getTime())) return null;
|
|
55
|
+
const fmt = (tz: string) => {
|
|
56
|
+
const parts = new Intl.DateTimeFormat("es-CO", {
|
|
57
|
+
timeZone: tz,
|
|
58
|
+
year: "numeric", month: "2-digit", day: "2-digit",
|
|
59
|
+
hour: "2-digit", minute: "2-digit", second: "2-digit",
|
|
60
|
+
hour12: false,
|
|
61
|
+
}).formatToParts(date);
|
|
62
|
+
const p = (t: string) => parts.find((x) => x.type === t)?.value ?? "";
|
|
63
|
+
const hour = p("hour") === "24" ? "00" : p("hour");
|
|
64
|
+
return `${p("day")}/${p("month")}/${p("year")} ${hour}:${p("minute")}:${p("second")}`;
|
|
65
|
+
};
|
|
66
|
+
try {
|
|
67
|
+
return fmt(timezone);
|
|
68
|
+
} catch {
|
|
69
|
+
return fmt("UTC");
|
|
70
|
+
}
|
|
71
|
+
}
|