@johpaz/hive-sdk 0.4.4 → 0.4.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/CHANGELOG.md +20 -4
- package/README.md +48 -7
- package/SECURITY.md +17 -0
- package/docs/API-AGENTS.md +430 -0
- package/docs/API-ARTIFACTS.md +55 -0
- package/docs/API-CONTEXT-COMPILER.md +285 -0
- package/docs/API-CRON.md +188 -0
- package/docs/API-DAG-SCHEDULER.md +291 -0
- package/docs/API-HOOKS.md +147 -0
- package/docs/API-RESILIENCE.md +45 -0
- package/docs/API-SERVICES.md +458 -0
- package/docs/API-SESSIONS.md +146 -0
- package/docs/API-TOOLS-SKILLS-CHANNELS.md +499 -0
- package/docs/API-WORKERS-EVENTS.md +311 -0
- package/docs/HIVE-HARNESS.md +232 -0
- package/docs/INDEX.md +198 -0
- package/docs/SECURITY-GUARDRAILS.md +87 -0
- package/docs/TEMPLATE-HIVE-APP.md +360 -0
- package/docs/UPGRADING.md +65 -0
- package/docs/assets/logoblack.png +0 -0
- package/docs/assets/logocolor-dark.png +0 -0
- package/docs/assets/logocolorbg.png +0 -0
- package/docs/plans/2026-09-05-office-dependency-hardening-design.md +28 -0
- package/docs/plans/2026-09-06-dependency-audit-remediation-design.md +25 -0
- package/docs/plans/2026-09-06-pptx-image-size-remediation-design.md +54 -0
- package/docs/plans/2026-09-06-typescript7-bun142-documentation-design.md +48 -0
- package/package.json +5 -4
- package/packages/core/src/agent/llm-providers/hiveagents.ts +2 -2
- package/packages/core/src/agent/providers/index.ts +17 -1
- package/packages/core/src/api/createAgent.ts +4 -2
- package/packages/core/src/gateway/server.ts +1 -1
- package/packages/core/src/mcp/transports/sse.ts +11 -3
- package/packages/core/src/mcp/transports/websocket.ts +11 -9
- package/packages/core/src/tool-runtime/tool-worker.ts +3 -1
- package/packages/core/src/tools/office/office-escribir-pptx.ts +3 -1
- package/packages/core/src/vendor/pptxgenjs/LICENSE +21 -0
- package/packages/core/src/vendor/pptxgenjs/README.md +17 -0
- package/packages/core/src/vendor/pptxgenjs/pptxgen.es.d.ts +17 -0
- package/packages/core/src/vendor/pptxgenjs/pptxgen.es.js +7368 -0
- package/packages/core/src/voice/index.ts +4 -4
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Office dependency hardening
|
|
2
|
+
|
|
3
|
+
## Scope
|
|
4
|
+
|
|
5
|
+
Remediate the five high-severity advisories reported for the Office tools without
|
|
6
|
+
changing their public names or successful result shapes. The XLSX reader is the
|
|
7
|
+
highest-priority path because it parses user-selected files synchronously. The
|
|
8
|
+
PDF reader only extracts text and does not render the viewer or annotation layer,
|
|
9
|
+
but its vulnerable dependency is still upgraded. The `image-size` findings are
|
|
10
|
+
documented rather than forcing a PPTX replacement because the dependency is not
|
|
11
|
+
loaded by the published `pptxgenjs` path used by Hive.
|
|
12
|
+
|
|
13
|
+
## Design
|
|
14
|
+
|
|
15
|
+
Use the current safe PDF.js major and the official SheetJS CE tarball, updating
|
|
16
|
+
both manifests so workspace and published metadata remain aligned. Before loading
|
|
17
|
+
PDF or XLSX data into memory, inspect the regular file and reject inputs above a
|
|
18
|
+
fixed byte limit. PDF processing explicitly disables scripting/eval, bounds the
|
|
19
|
+
number of pages returned per call, and checks a processing deadline between
|
|
20
|
+
pages. XLSX processing bounds workbook sheet count, rows returned per sheet, and
|
|
21
|
+
checks a deadline between sheets. These controls are defense in depth; dependency
|
|
22
|
+
updates remain the remediation for the reported CVEs.
|
|
23
|
+
|
|
24
|
+
Tests exercise rejection before parsing, page-range validation, XLSX row limits,
|
|
25
|
+
and normal PDF/XLSX behavior. A repository security note records the exact
|
|
26
|
+
`image-size` dependency chain, why it is currently unreachable, the evidence
|
|
27
|
+
required before suppressing it in scanners, and the conditions that invalidate
|
|
28
|
+
the exception (adding image input or an upstream package change).
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Dependency audit remediation
|
|
2
|
+
|
|
3
|
+
## Scope
|
|
4
|
+
|
|
5
|
+
Remove the critical Baileys advisory and every remaining audit finding that can
|
|
6
|
+
be fixed inside the dependency ranges already accepted by the SDK. Preserve the
|
|
7
|
+
public API and avoid package overrides unless a direct dependency cannot express
|
|
8
|
+
the safe version. The unpatched and unreachable `image-size` findings retain the
|
|
9
|
+
documented exception in `SECURITY.md`.
|
|
10
|
+
|
|
11
|
+
## Design
|
|
12
|
+
|
|
13
|
+
Pin `@whiskeysockets/baileys` to the latest official release candidate in both
|
|
14
|
+
published manifests. This moves beyond the security fix in rc12 and includes the
|
|
15
|
+
follow-up protocol-message regression fix. Refresh transitive packages only
|
|
16
|
+
within their parents' declared semver ranges so patched `ws`, `protobufjs`,
|
|
17
|
+
`nanoid`, `fast-uri`, `hono`, `undici`, and related HTTP packages can resolve
|
|
18
|
+
without changing Hive application code.
|
|
19
|
+
|
|
20
|
+
Use `bun audit` as the failing security regression check: the baseline must show
|
|
21
|
+
the critical advisory before the change and no critical finding afterward. Run
|
|
22
|
+
the channel tests, typecheck, and complete suite to detect API or runtime drift.
|
|
23
|
+
Inspect the final lockfile and audit output before committing. Any advisory that
|
|
24
|
+
cannot be removed by a compatible update is reported separately rather than
|
|
25
|
+
hidden with a broad suppression.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Remediación de `image-size` en la generación PPTX
|
|
2
|
+
|
|
3
|
+
## Contexto y decisión
|
|
4
|
+
|
|
5
|
+
`pptxgenjs@4.0.1` declara `image-size@^1.2.1`, afectado por
|
|
6
|
+
GHSA-w3rx-r6r6-pgpr y GHSA-5p2g-fcmc-qvqq. No existe una versión corregida de
|
|
7
|
+
`image-size`, y el repositorio oficial de PptxGenJS todavía conserva la
|
|
8
|
+
dependencia. Sin embargo, el artefacto ESM publicado de PptxGenJS no importa
|
|
9
|
+
`image-size`: sólo usa `jszip`. Hive tampoco expone imágenes en
|
|
10
|
+
`office_escribir_pptx`; el flujo acepta texto, viñetas y notas del presentador.
|
|
11
|
+
|
|
12
|
+
Se conservará una copia vendorizada del artefacto ESM oficial de
|
|
13
|
+
PptxGenJS 4.0.1, junto con su licencia MIT y un archivo de procedencia. El
|
|
14
|
+
wrapper de Hive importará ese artefacto local y mantendrá deliberadamente una
|
|
15
|
+
API limitada a texto y notas. Se eliminará `pptxgenjs` de los manifiestos y del
|
|
16
|
+
lockfile, lo que también elimina `image-size` y `queue` del grafo instalable.
|
|
17
|
+
|
|
18
|
+
Se descartan dos alternativas. Mantener la excepción conserva funcionalidad,
|
|
19
|
+
pero deja el auditor en rojo. Reimplementar directamente el paquete OOXML
|
|
20
|
+
evitaría código vendorizado, pero introduce un riesgo mayor de incompatibilidad
|
|
21
|
+
con PowerPoint, Keynote y LibreOffice, especialmente para notas y relaciones
|
|
22
|
+
internas.
|
|
23
|
+
|
|
24
|
+
## Integración, errores y mantenimiento
|
|
25
|
+
|
|
26
|
+
El código vendorizado vivirá bajo `packages/core/src/vendor/pptxgenjs/` y no
|
|
27
|
+
tendrá un `package.json` con dependencias. Un módulo TypeScript local expondrá
|
|
28
|
+
únicamente los métodos que usa la herramienta (`addSlide`, `addText`,
|
|
29
|
+
`addNotes`, `writeFile`), evitando que el resto del SDK dependa de la API amplia
|
|
30
|
+
de PptxGenJS. La herramienta conservará su manejo actual de directorios,
|
|
31
|
+
errores y forma de respuesta.
|
|
32
|
+
|
|
33
|
+
El archivo de procedencia fijará versión, URL oficial y licencia. Las futuras
|
|
34
|
+
actualizaciones deben reemplazar el artefacto desde una versión oficial,
|
|
35
|
+
verificar su hash y volver a ejecutar las pruebas y el audit. No se añadirá
|
|
36
|
+
soporte para imágenes mediante esta copia: cualquier ampliación de esa API
|
|
37
|
+
requiere una revisión de seguridad nueva.
|
|
38
|
+
|
|
39
|
+
## Verificación
|
|
40
|
+
|
|
41
|
+
Una prueba funcional generará una presentación temporal con portada, texto,
|
|
42
|
+
viñetas y notas. Después abrirá el resultado como ZIP y comprobará las partes
|
|
43
|
+
OOXML principales, el número de diapositivas y la presencia del contenido y de
|
|
44
|
+
las notas. Esto protege el comportamiento que Hive usa realmente, sin probar
|
|
45
|
+
detalles internos del proveedor.
|
|
46
|
+
|
|
47
|
+
La aceptación requiere:
|
|
48
|
+
|
|
49
|
+
1. La prueba PPTX nueva y la suite de Office pasan.
|
|
50
|
+
2. El typecheck del workspace pasa.
|
|
51
|
+
3. `bun audit` reporta cero vulnerabilidades.
|
|
52
|
+
4. `rg` no encuentra `image-size` ni `pptxgenjs` como dependencias en los
|
|
53
|
+
manifiestos o el lockfile.
|
|
54
|
+
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Cierre de migración a TypeScript 7 y Bun 1.4.2
|
|
2
|
+
|
|
3
|
+
## Objetivo y decisión
|
|
4
|
+
|
|
5
|
+
Hive adoptará TypeScript 7.0.2 para su desarrollo y mantendrá Bun 1.4.2 como
|
|
6
|
+
runtime mínimo y versión de referencia en CI. La migración debe terminar con el
|
|
7
|
+
typecheck limpio; no se conservarán `@ts-ignore` ni conversiones a `any` para
|
|
8
|
+
ocultar incompatibilidades. Los puntos donde los tipos DOM y Bun describen de
|
|
9
|
+
forma distinta una misma API tendrán adaptadores locales y estrechos que
|
|
10
|
+
expresen sólo el contrato usado por Hive.
|
|
11
|
+
|
|
12
|
+
La documentación se dividirá en dos referencias. `UPGRADING.md` explicará los
|
|
13
|
+
requisitos de Bun y TypeScript, los pasos de actualización, los cambios de tipos
|
|
14
|
+
y la validación. `SECURITY-GUARDRAILS.md` inventariará los controles que ya
|
|
15
|
+
existen en dependencias, documentos Office, transporte y CI. README, el índice,
|
|
16
|
+
la API de cron y el changelog enlazarán estas referencias.
|
|
17
|
+
|
|
18
|
+
Se descartan dos alternativas: documentar únicamente en el changelog dificulta
|
|
19
|
+
encontrar instrucciones operativas; mezclar migración y seguridad en una sola
|
|
20
|
+
página confunde requisitos de plataforma con controles de entrada.
|
|
21
|
+
|
|
22
|
+
## Compatibilidad y correcciones de tipos
|
|
23
|
+
|
|
24
|
+
El lector SSE consumirá un contrato estructural mínimo (`read`) en vez de exigir
|
|
25
|
+
la extensión `readMany` que Bun añade al lector global. El cliente WebSocket
|
|
26
|
+
usará un constructor tipado localmente con `Bun.WebSocketOptions`, porque al
|
|
27
|
+
incluir `DOM` TypeScript selecciona el constructor estándar y omite la
|
|
28
|
+
sobrecarga de opciones de Bun. Audio convertirá toda entrada a bytes propios
|
|
29
|
+
respaldados por `ArrayBuffer` antes de crear un `Blob`; esto satisface el modelo
|
|
30
|
+
genérico de typed arrays de TypeScript 7 y evita compartir memoria mutable.
|
|
31
|
+
|
|
32
|
+
Los demás cambios de migración se conservarán sólo si el typecheck y las pruebas
|
|
33
|
+
demuestran que son compatibles con Bun 1.4.2. Los casts se limitarán a fronteras
|
|
34
|
+
con APIs externas y tendrán comentarios que expliquen la divergencia.
|
|
35
|
+
|
|
36
|
+
## Guardrails y validación
|
|
37
|
+
|
|
38
|
+
La referencia de guardrails documentará límites exactos y el comportamiento al
|
|
39
|
+
rechazar entradas: PDF de 25 MiB, máximo 200 páginas, scripting/eval apagados y
|
|
40
|
+
deadline; XLSX de 15 MiB, máximo 25 hojas y 10.000 filas por hoja; PPTX sólo de
|
|
41
|
+
texto con artefacto vendorizado; dependencias auditadas y distribuciones
|
|
42
|
+
oficiales fijadas. También cubrirá el mínimo de Bun, CI con lockfile congelado y
|
|
43
|
+
typecheck de TypeScript 7.
|
|
44
|
+
|
|
45
|
+
La aceptación requiere `bun --version` 1.4.2, `bun run typecheck` limpio, pruebas
|
|
46
|
+
de los componentes modificados, suite completa, `bun audit` sin hallazgos y
|
|
47
|
+
`git diff --check` limpio. Cualquier prueba intermitente se repetirá aislada y
|
|
48
|
+
se informará explícitamente.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@johpaz/hive-sdk",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Hive SDK — The Agent Harness SDK. Build, deploy, and scale AI agent applications with multi-channel support, context engineering, and swarm orchestration.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -77,6 +77,8 @@
|
|
|
77
77
|
"!packages/**/*.test.ts",
|
|
78
78
|
"README.md",
|
|
79
79
|
"CHANGELOG.md",
|
|
80
|
+
"SECURITY.md",
|
|
81
|
+
"docs",
|
|
80
82
|
"LICENSE"
|
|
81
83
|
],
|
|
82
84
|
"engines": {
|
|
@@ -103,7 +105,7 @@
|
|
|
103
105
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
104
106
|
"@sapphire/snowflake": "^3.5.5",
|
|
105
107
|
"@slack/bolt": "^4.7.2",
|
|
106
|
-
"@whiskeysockets/baileys": "7.0.0-
|
|
108
|
+
"@whiskeysockets/baileys": "7.0.0-rc14",
|
|
107
109
|
"async-mutex": "^0.5.0",
|
|
108
110
|
"discord.js": "^14.26.4",
|
|
109
111
|
"docx": "^9.6.1",
|
|
@@ -116,7 +118,6 @@
|
|
|
116
118
|
"ollama": "^0.6.3",
|
|
117
119
|
"openai": "^6.18.0",
|
|
118
120
|
"pdfjs-dist": "^6.3.289",
|
|
119
|
-
"pptxgenjs": "^4.0.1",
|
|
120
121
|
"qrcode-terminal": "^0.12.0",
|
|
121
122
|
"toon-format-parser": "^1.1.0",
|
|
122
123
|
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz",
|
|
@@ -125,6 +126,6 @@
|
|
|
125
126
|
"devDependencies": {
|
|
126
127
|
"@types/bun": "^1.4.1",
|
|
127
128
|
"@types/jsonwebtoken": "^9.0.10",
|
|
128
|
-
"typescript": "
|
|
129
|
+
"typescript": "7.0.2"
|
|
129
130
|
}
|
|
130
131
|
}
|
|
@@ -135,8 +135,8 @@ export class HiveAgentsProvider extends OpenAICompatBase {
|
|
|
135
135
|
return new OpenAI({
|
|
136
136
|
apiKey,
|
|
137
137
|
baseURL,
|
|
138
|
-
fetch: async (url:
|
|
139
|
-
const headers = new Headers(init?.headers
|
|
138
|
+
fetch: async (url: string | URL | Request, init?: RequestInit) => {
|
|
139
|
+
const headers = new Headers(init?.headers)
|
|
140
140
|
for (const h of BLOCKED_HEADERS) headers.delete(h)
|
|
141
141
|
|
|
142
142
|
// Debug: log exact request so we can replicate with curl
|
|
@@ -13,6 +13,19 @@ import type { ContentPart } from "../../multimodal/types.ts"
|
|
|
13
13
|
import type { TurnSource } from "../../storage/collections.ts"
|
|
14
14
|
import type { MCPClientManager } from "../../mcp/index.ts"
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Bloque de contenido de un mensaje del loop.
|
|
18
|
+
*
|
|
19
|
+
* El mensaje llega con `content` laxo (`string` o arreglo), y acá sólo se
|
|
20
|
+
* consumen los bloques de texto. Declarar la forma quita el `any` implícito
|
|
21
|
+
* del filtro y, de paso, el `as any` que hacía falta para leer `.text`.
|
|
22
|
+
* Bajo el `strict: false` de este repo el `any` era invisible; en un
|
|
23
|
+
* consumidor que compile en estricto es un error, y el SDK se publica en
|
|
24
|
+
* fuente, así que lo compilan con SU configuración.
|
|
25
|
+
*/
|
|
26
|
+
interface ContentBlock { type?: string }
|
|
27
|
+
interface TextBlock extends ContentBlock { type: "text"; text: string }
|
|
28
|
+
|
|
16
29
|
export type Provider = "openai" | "anthropic" | "gemini" | "mistral" | "kimi" | "ollama" | "openrouter" | "deepseek" | "nvidia" | "hiveagents" | "z-ai" | "modelscope" | "minimax" | "qwen" | "groq" | "opencode-go"
|
|
17
30
|
|
|
18
31
|
export interface StepEvent {
|
|
@@ -164,7 +177,10 @@ export class AgentRunner {
|
|
|
164
177
|
const content = typeof lastMsg.content === "string"
|
|
165
178
|
? lastMsg.content
|
|
166
179
|
: Array.isArray(lastMsg.content)
|
|
167
|
-
? lastMsg.content
|
|
180
|
+
? (lastMsg.content as ContentBlock[])
|
|
181
|
+
.filter((p): p is TextBlock => p.type === "text")
|
|
182
|
+
.map((p) => p.text)
|
|
183
|
+
.join("\n")
|
|
168
184
|
: ""
|
|
169
185
|
lastAgentContent = content
|
|
170
186
|
// Accumulate non-empty content that's not just whitespace
|
|
@@ -285,7 +285,7 @@ export async function createAgent(config: AgentConfig): Promise<Agent> {
|
|
|
285
285
|
|
|
286
286
|
const { runAgent } = await import("../agent/agent-loop.ts");
|
|
287
287
|
|
|
288
|
-
|
|
288
|
+
const agente: Agent = {
|
|
289
289
|
name: config.name,
|
|
290
290
|
id: agentId,
|
|
291
291
|
config,
|
|
@@ -340,13 +340,15 @@ export async function createAgent(config: AgentConfig): Promise<Agent> {
|
|
|
340
340
|
// El loop emite el texto acumulado del turno, no deltas: quedarse con el
|
|
341
341
|
// último evento evita duplicar la respuesta al concatenar.
|
|
342
342
|
let response = "";
|
|
343
|
-
for await (const event of
|
|
343
|
+
for await (const event of agente.chat(task, opts)) {
|
|
344
344
|
if (event.type === "text") response = event.content;
|
|
345
345
|
if (event.type === "done" && event.response) response = event.response;
|
|
346
346
|
}
|
|
347
347
|
return response;
|
|
348
348
|
},
|
|
349
349
|
};
|
|
350
|
+
|
|
351
|
+
return agente;
|
|
350
352
|
}
|
|
351
353
|
|
|
352
354
|
function safeParse(raw: string): Record<string, unknown> {
|
|
@@ -98,7 +98,7 @@ async function handleChat(
|
|
|
98
98
|
mcpManager?: MCPClientManager | null
|
|
99
99
|
): Promise<Response> {
|
|
100
100
|
try {
|
|
101
|
-
const body = await req.json();
|
|
101
|
+
const body = (await req.json()) as { message?: string; threadId?: string };
|
|
102
102
|
const message = body.message ?? "";
|
|
103
103
|
const threadId = body.threadId ?? crypto.randomUUID();
|
|
104
104
|
|
|
@@ -6,6 +6,14 @@ export interface SSETransportConfig {
|
|
|
6
6
|
headers?: Record<string, string>;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
+
interface ByteStreamReader {
|
|
10
|
+
read(): Promise<{ done: boolean; value?: Uint8Array }>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface ByteStream {
|
|
14
|
+
getReader(): ByteStreamReader;
|
|
15
|
+
}
|
|
16
|
+
|
|
9
17
|
export class SSETransport implements Transport {
|
|
10
18
|
private baseUrl: string;
|
|
11
19
|
private messagesUrl: string | null = null; // Endpoint recibido del servidor
|
|
@@ -111,7 +119,7 @@ export class SSETransport implements Transport {
|
|
|
111
119
|
}
|
|
112
120
|
}
|
|
113
121
|
|
|
114
|
-
private startReading(stream:
|
|
122
|
+
private startReading(stream: ByteStream) {
|
|
115
123
|
const reader = stream.getReader();
|
|
116
124
|
const decoder = new TextDecoder();
|
|
117
125
|
let buffer = "";
|
|
@@ -124,7 +132,7 @@ export class SSETransport implements Transport {
|
|
|
124
132
|
}
|
|
125
133
|
|
|
126
134
|
private async processStream(
|
|
127
|
-
reader:
|
|
135
|
+
reader: ByteStreamReader,
|
|
128
136
|
decoder: TextDecoder,
|
|
129
137
|
buffer: string
|
|
130
138
|
): Promise<void> {
|
|
@@ -244,4 +252,4 @@ export class SSETransport implements Transport {
|
|
|
244
252
|
|
|
245
253
|
export function createSSETransport(config: SSETransportConfig): Transport {
|
|
246
254
|
return new SSETransport(config) as unknown as Transport;
|
|
247
|
-
}
|
|
255
|
+
}
|
|
@@ -8,6 +8,11 @@ export interface WebSocketTransportConfig {
|
|
|
8
8
|
reconnectMaxAttempts?: number; // máximo de intentos (default: 10)
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
type BunWebSocketConstructor = new (
|
|
12
|
+
url: string | URL,
|
|
13
|
+
options?: Bun.WebSocketOptions,
|
|
14
|
+
) => WebSocket;
|
|
15
|
+
|
|
11
16
|
export class WebSocketTransport implements Transport {
|
|
12
17
|
private url: string;
|
|
13
18
|
private ws: WebSocket | null = null;
|
|
@@ -40,15 +45,12 @@ export class WebSocketTransport implements Transport {
|
|
|
40
45
|
return new Promise((resolve, reject) => {
|
|
41
46
|
|
|
42
47
|
// CORRECCIÓN 1 — headers en Bun WebSocket
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
|
|
48
|
+
// Con la lib DOM activa, TypeScript expone sólo la sobrecarga estándar
|
|
49
|
+
// (subprotocols). El runtime de Bun acepta Bun.WebSocketOptions.
|
|
50
|
+
const BunWebSocket = WebSocket as unknown as BunWebSocketConstructor;
|
|
46
51
|
const ws = this.headers && Object.keys(this.headers).length > 0
|
|
47
|
-
? new
|
|
48
|
-
|
|
49
|
-
headers: this.headers,
|
|
50
|
-
})
|
|
51
|
-
: new WebSocket(this.url);
|
|
52
|
+
? new BunWebSocket(this.url, { headers: this.headers })
|
|
53
|
+
: new BunWebSocket(this.url);
|
|
52
54
|
|
|
53
55
|
this.ws = ws;
|
|
54
56
|
let resolved = false;
|
|
@@ -156,4 +158,4 @@ export function createWebSocketTransport(
|
|
|
156
158
|
config: WebSocketTransportConfig
|
|
157
159
|
): Transport {
|
|
158
160
|
return new WebSocketTransport(config) as unknown as Transport;
|
|
159
|
-
}
|
|
161
|
+
}
|
|
@@ -100,7 +100,9 @@ async function runTool(message: WorkerRunMessage): Promise<void> {
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
declare const self: Worker
|
|
104
|
+
|
|
105
|
+
self.onmessage = (event: MessageEvent<WorkerRunMessage | WorkerRpcResponse>) => {
|
|
104
106
|
const message = event.data
|
|
105
107
|
|
|
106
108
|
if (message.type === "rpc_result") {
|
|
@@ -60,7 +60,9 @@ export const officeEscribirPptxTool: Tool = {
|
|
|
60
60
|
log.debug(`Generando PPTX: ${ruta}`);
|
|
61
61
|
|
|
62
62
|
try {
|
|
63
|
-
|
|
63
|
+
// PptxGenJS 4.0.1 ESM is vendored without its unused image parser.
|
|
64
|
+
// Keep this tool text-only; image support requires a new security review.
|
|
65
|
+
const pptxgen = (await import("../../vendor/pptxgenjs/pptxgen.es.js")).default;
|
|
64
66
|
const pres = new pptxgen();
|
|
65
67
|
|
|
66
68
|
// Configuración básica
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015-2022 Brent Ely
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# PptxGenJS vendorizado
|
|
2
|
+
|
|
3
|
+
- Proyecto: PptxGenJS
|
|
4
|
+
- Versión: 4.0.1
|
|
5
|
+
- Fuente: https://www.npmjs.com/package/pptxgenjs/v/4.0.1
|
|
6
|
+
- Repositorio: https://github.com/gitbrent/PptxGenJS/tree/v4.0.1
|
|
7
|
+
- Licencia: MIT (`LICENSE`)
|
|
8
|
+
- Artefacto: `dist/pptxgen.es.js` de la distribución oficial
|
|
9
|
+
- SHA-256: `05844c5625e2cda3b449eb967c2246dd57ca57341886a7c28eeebca263b29bd4`
|
|
10
|
+
|
|
11
|
+
Hive conserva únicamente el artefacto ESM, que importa `jszip` y no importa
|
|
12
|
+
`image-size`. No copie el `package.json` upstream: declara `image-size` para las
|
|
13
|
+
funciones de imágenes que Hive no expone.
|
|
14
|
+
|
|
15
|
+
Para actualizar esta copia, descargue una versión oficial, compruebe su licencia
|
|
16
|
+
y procedencia, reemplace el artefacto, actualice el hash y ejecute la prueba de
|
|
17
|
+
`office_escribir_pptx`, el typecheck y `bun audit`.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface TextRun {
|
|
2
|
+
text: string;
|
|
3
|
+
options?: Record<string, unknown>;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
interface Slide {
|
|
7
|
+
addText(text: string | TextRun[], options?: Record<string, unknown>): void;
|
|
8
|
+
addNotes(notes: string | string[]): void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare class PptxGenJS {
|
|
12
|
+
layout: string;
|
|
13
|
+
addSlide(): Slide;
|
|
14
|
+
writeFile(options: { fileName: string }): Promise<string>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default PptxGenJS;
|