@jmanuelcorral/openteam 0.1.31 → 0.1.33
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 +23 -0
- package/dist/cli/consoleServe.d.ts +9 -0
- package/dist/cli/consoleServe.d.ts.map +1 -1
- package/dist/cli.js +1670 -1303
- package/dist/commands/dispatch.d.ts.map +1 -1
- package/dist/config/schema.d.ts +27 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/index.js +11 -1
- package/dist/mcp/server.d.ts +50 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/stdio.d.ts +24 -0
- package/dist/mcp/stdio.d.ts.map +1 -0
- package/dist/mcp/teamMemory.d.ts +42 -0
- package/dist/mcp/teamMemory.d.ts.map +1 -0
- package/dist/storage/index/bunSqlite.d.ts +20 -0
- package/dist/storage/index/bunSqlite.d.ts.map +1 -0
- package/dist/storage/index/sqliteIndex.d.ts +64 -0
- package/dist/storage/index/sqliteIndex.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../src/commands/dispatch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EACL,KAAK,SAAS,EAIf,MAAM,UAAU,CAAC;AAalB,MAAM,MAAM,OAAO,GAAG;IACpB,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;IACtD,UAAU,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpE,KAAK,EAAE,CAAC,MAAM,EAAE,c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.ZodDefault<z.ZodObject<{
|
|
|
37
37
|
pty: z.ZodOptional<z.ZodBoolean>;
|
|
38
38
|
}, z.core.$strip>>;
|
|
39
39
|
}, z.core.$strip>>;
|
|
40
|
+
/**
|
|
41
|
+
* Bloque de configuración de la Console web (nombre canónico `console`).
|
|
42
|
+
*/
|
|
43
|
+
/**
|
|
44
|
+
* Configuración del boundary de storage. `sqliteIndex` es un índice **derivado**
|
|
45
|
+
* y reconstruible (no fuente de verdad): acelera agregaciones/recall cross-sesión
|
|
46
|
+
* de la Console. Experimental y desactivado por defecto; borrarlo no pierde datos.
|
|
47
|
+
*/
|
|
48
|
+
export declare const StorageConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
49
|
+
sqliteIndex: z.ZodDefault<z.ZodObject<{
|
|
50
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
51
|
+
path: z.ZodDefault<z.ZodString>;
|
|
52
|
+
}, z.core.$strip>>;
|
|
53
|
+
}, z.core.$strip>>;
|
|
40
54
|
export declare const LocalRuntimeSchema: z.ZodObject<{
|
|
41
55
|
id: z.ZodEnum<{
|
|
42
56
|
ollama: "ollama";
|
|
@@ -130,6 +144,12 @@ export declare const OpenTeamConfigObjectSchema: z.ZodObject<{
|
|
|
130
144
|
pty: z.ZodOptional<z.ZodBoolean>;
|
|
131
145
|
}, z.core.$strip>>;
|
|
132
146
|
}, z.core.$strip>>;
|
|
147
|
+
storage: z.ZodDefault<z.ZodObject<{
|
|
148
|
+
sqliteIndex: z.ZodDefault<z.ZodObject<{
|
|
149
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
150
|
+
path: z.ZodDefault<z.ZodString>;
|
|
151
|
+
}, z.core.$strip>>;
|
|
152
|
+
}, z.core.$strip>>;
|
|
133
153
|
}, z.core.$strip>;
|
|
134
154
|
/** Esquema público de la config de openteam. */
|
|
135
155
|
export declare const OpenTeamConfigSchema: z.ZodObject<{
|
|
@@ -207,6 +227,12 @@ export declare const OpenTeamConfigSchema: z.ZodObject<{
|
|
|
207
227
|
pty: z.ZodOptional<z.ZodBoolean>;
|
|
208
228
|
}, z.core.$strip>>;
|
|
209
229
|
}, z.core.$strip>>;
|
|
230
|
+
storage: z.ZodDefault<z.ZodObject<{
|
|
231
|
+
sqliteIndex: z.ZodDefault<z.ZodObject<{
|
|
232
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
233
|
+
path: z.ZodDefault<z.ZodString>;
|
|
234
|
+
}, z.core.$strip>>;
|
|
235
|
+
}, z.core.$strip>>;
|
|
210
236
|
}, z.core.$strip>;
|
|
211
237
|
export type ModelRef = z.infer<typeof ModelRefSchema>;
|
|
212
238
|
export type RouterMode = z.infer<typeof RouterModeSchema>;
|
|
@@ -214,4 +240,5 @@ export type PrivacyMode = z.infer<typeof PrivacyModeSchema>;
|
|
|
214
240
|
export type OpenTeamConfig = z.infer<typeof OpenTeamConfigSchema>;
|
|
215
241
|
export type LocalRuntime = z.infer<typeof LocalRuntimeSchema>;
|
|
216
242
|
export type ConsoleConfig = z.infer<typeof ConsoleConfigSchema>;
|
|
243
|
+
export type StorageConfig = z.infer<typeof StorageConfigSchema>;
|
|
217
244
|
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,cAAc;;;iBAGzB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;EAA6C,CAAC;AAC3E,eAAO,MAAM,iBAAiB;;;;EAI5B,CAAC;AACH,eAAO,MAAM,kBAAkB;;;EAA6B,CAAC;AAE7D,eAAO,MAAM,iBAAiB;;;EAAqC,CAAC;AAEpE,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;kBAmC5B,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/config/schema.ts"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B,CAAC,CAAC;AAChE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -356,6 +356,14 @@ var ConsoleConfigSchema = z.object({
|
|
|
356
356
|
remoteStorage: false,
|
|
357
357
|
terminal: { enabled: true }
|
|
358
358
|
});
|
|
359
|
+
var StorageConfigSchema = z.object({
|
|
360
|
+
sqliteIndex: z.object({
|
|
361
|
+
enabled: z.boolean().default(false),
|
|
362
|
+
path: z.string().min(1).default(".opencode/openteam/index.sqlite")
|
|
363
|
+
}).default({ enabled: false, path: ".opencode/openteam/index.sqlite" })
|
|
364
|
+
}).default({
|
|
365
|
+
sqliteIndex: { enabled: false, path: ".opencode/openteam/index.sqlite" }
|
|
366
|
+
});
|
|
359
367
|
var defaultLocalModel = {
|
|
360
368
|
providerID: "ollama",
|
|
361
369
|
modelID: "qwen3:8b"
|
|
@@ -418,7 +426,8 @@ var OpenTeamConfigObjectSchema = z.object({
|
|
|
418
426
|
hardStopOnBudgetExhaustion: z.boolean().default(false)
|
|
419
427
|
}).default({ hardStopOnBudgetExhaustion: false }),
|
|
420
428
|
privacyMode: PrivacyModeSchema.default("forceLocalOnSensitive"),
|
|
421
|
-
console: ConsoleConfigSchema
|
|
429
|
+
console: ConsoleConfigSchema,
|
|
430
|
+
storage: StorageConfigSchema
|
|
422
431
|
});
|
|
423
432
|
var OpenTeamConfigSchema = OpenTeamConfigObjectSchema;
|
|
424
433
|
|
|
@@ -1496,6 +1505,7 @@ var HELP = [
|
|
|
1496
1505
|
" openteam console Lanza la Console web multi-sesión (Ctrl+C para parar; --open abre el navegador)",
|
|
1497
1506
|
" openteam console --status Muestra la config de la Console sin lanzarla",
|
|
1498
1507
|
" openteam tunnel Expone la Console vía Dev Tunnels (--terminal expone opencode; Ctrl+C para cerrar)",
|
|
1508
|
+
" openteam mcp Servidor MCP de solo lectura (memoria del equipo) sobre stdio",
|
|
1499
1509
|
" openteam report Resumen de coste/ahorro (telemetría)",
|
|
1500
1510
|
" openteam yolo status Muestra si el modo YOLO está activo",
|
|
1501
1511
|
" openteam yolo on Activa YOLO (opencode auto-aprueba todo)",
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type TeamMemory } from "./teamMemory";
|
|
2
|
+
/**
|
|
3
|
+
* Servidor MCP **de solo lectura** que expone la memoria del equipo
|
|
4
|
+
* (decisiones/reuniones/sesiones/costes) como tools para que agentes o
|
|
5
|
+
* herramientas la consulten. Implementa JSON-RPC 2.0 sin dependencias externas;
|
|
6
|
+
* el transporte (stdio) vive aparte en `stdio.ts`.
|
|
7
|
+
*
|
|
8
|
+
* `handleMcpMessage` es puro salvo por `deps.readMemory` (inyectado): no expone
|
|
9
|
+
* prompts crudos, solo el estado ya redactado por la agregación.
|
|
10
|
+
*/
|
|
11
|
+
export declare const MCP_PROTOCOL_VERSION = "2024-11-05";
|
|
12
|
+
export type JsonRpcId = string | number | null;
|
|
13
|
+
export type JsonRpcRequest = {
|
|
14
|
+
jsonrpc: "2.0";
|
|
15
|
+
id?: JsonRpcId;
|
|
16
|
+
method: string;
|
|
17
|
+
params?: Record<string, unknown>;
|
|
18
|
+
};
|
|
19
|
+
export type JsonRpcError = {
|
|
20
|
+
code: number;
|
|
21
|
+
message: string;
|
|
22
|
+
};
|
|
23
|
+
export type JsonRpcResponse = {
|
|
24
|
+
jsonrpc: "2.0";
|
|
25
|
+
id: JsonRpcId;
|
|
26
|
+
result?: unknown;
|
|
27
|
+
error?: JsonRpcError;
|
|
28
|
+
};
|
|
29
|
+
export type McpServerInfo = {
|
|
30
|
+
name: string;
|
|
31
|
+
version: string;
|
|
32
|
+
};
|
|
33
|
+
export type McpServerDeps = {
|
|
34
|
+
/** Lee la memoria del equipo bajo demanda (I/O inyectado). */
|
|
35
|
+
readMemory: () => Promise<TeamMemory>;
|
|
36
|
+
serverInfo?: McpServerInfo;
|
|
37
|
+
};
|
|
38
|
+
type ToolDef = {
|
|
39
|
+
name: string;
|
|
40
|
+
description: string;
|
|
41
|
+
inputSchema: Record<string, unknown>;
|
|
42
|
+
};
|
|
43
|
+
export declare const MCP_TOOLS: ToolDef[];
|
|
44
|
+
/**
|
|
45
|
+
* Procesa un mensaje JSON-RPC del cliente MCP. Devuelve la respuesta, o `null`
|
|
46
|
+
* para notificaciones (mensajes sin `id`, p. ej. `notifications/initialized`).
|
|
47
|
+
*/
|
|
48
|
+
export declare function handleMcpMessage(message: JsonRpcRequest, deps: McpServerDeps): Promise<JsonRpcResponse | null>;
|
|
49
|
+
export {};
|
|
50
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,UAAU,EAChB,MAAM,cAAc,CAAC;AAEtB;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,eAAe,CAAC;AAEjD,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;AAE/C,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,KAAK,CAAC;IACf,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,EAAE,KAAK,CAAC;IACf,EAAE,EAAE,SAAS,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,YAAY,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9D,MAAM,MAAM,aAAa,GAAG;IAC1B,8DAA8D;IAC9D,UAAU,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC;IACtC,UAAU,CAAC,EAAE,aAAa,CAAC;CAC5B,CAAC;AAOF,KAAK,OAAO,GAAG;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC,CAAC;AAUF,eAAO,MAAM,SAAS,EAAE,OAAO,EAgC9B,CAAC;AAoEF;;;GAGG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAwCjC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type McpServerDeps } from "./server";
|
|
2
|
+
/**
|
|
3
|
+
* Transporte stdio del servidor MCP: lee mensajes JSON-RPC delimitados por
|
|
4
|
+
* salto de línea y escribe las respuestas. El I/O se inyecta (`lines`/`write`)
|
|
5
|
+
* para poder testear el bucle sin procesos ni descriptores reales.
|
|
6
|
+
*/
|
|
7
|
+
export type McpStdioIo = {
|
|
8
|
+
/** Fuente de líneas de entrada (una por mensaje JSON-RPC). */
|
|
9
|
+
lines: AsyncIterable<string>;
|
|
10
|
+
/** Escribe una línea de salida (respuesta serializada + `\n`). */
|
|
11
|
+
write: (line: string) => void;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Ejecuta el bucle de lectura/escritura hasta que se agota la entrada. Ignora
|
|
15
|
+
* líneas en blanco; a JSON inválido responde con un error `-32700`; a
|
|
16
|
+
* notificaciones (sin `id`) no responde.
|
|
17
|
+
*/
|
|
18
|
+
export declare function runMcpStdio(deps: McpServerDeps, io: McpStdioIo): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Adapta un `Readable` (p. ej. `process.stdin`) a un iterable de líneas. Acumula
|
|
21
|
+
* chunks y emite por cada `\n`. Puro respecto al stream (no toca `process`).
|
|
22
|
+
*/
|
|
23
|
+
export declare function linesFromReadable(readable: AsyncIterable<string | Buffer>): AsyncGenerator<string>;
|
|
24
|
+
//# sourceMappingURL=stdio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../../src/mcp/stdio.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,aAAa,EACnB,MAAM,UAAU,CAAC;AAElB;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,8DAA8D;IAC9D,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC7B,kEAAkE;IAClE,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/B,CAAC;AAUF;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,aAAa,EACnB,EAAE,EAAE,UAAU,GACb,OAAO,CAAC,IAAI,CAAC,CAkBf;AAED;;;GAGG;AACH,wBAAuB,iBAAiB,CACtC,QAAQ,EAAE,aAAa,CAAC,MAAM,GAAG,MAAM,CAAC,GACvC,cAAc,CAAC,MAAM,CAAC,CAcxB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type DecisionView, type EventTotals, type MeetingView, type SessionSummary } from "../telemetry/aggregate";
|
|
2
|
+
import type { OpenTeamEvent } from "../telemetry/events";
|
|
3
|
+
/**
|
|
4
|
+
* Memoria del equipo: vista **de solo lectura** y redactada del estado agregado
|
|
5
|
+
* (sesiones, costes/tokens, decisiones y reuniones). Es el substrato que expone
|
|
6
|
+
* la superficie MCP; se apoya en el mismo `StorageProvider`/índice y en la
|
|
7
|
+
* agregación pura. Sin I/O aquí: `buildTeamMemory` es determinista y puro.
|
|
8
|
+
*/
|
|
9
|
+
export type TeamMemory = {
|
|
10
|
+
sessions: SessionSummary[];
|
|
11
|
+
totals: EventTotals;
|
|
12
|
+
decisions: DecisionView[];
|
|
13
|
+
meetings: MeetingView[];
|
|
14
|
+
};
|
|
15
|
+
export declare function buildTeamMemory(events: readonly OpenTeamEvent[]): TeamMemory;
|
|
16
|
+
export type DecisionQuery = {
|
|
17
|
+
agent?: string;
|
|
18
|
+
tag?: string;
|
|
19
|
+
limit?: number;
|
|
20
|
+
};
|
|
21
|
+
/** Decisiones (más recientes primero), filtrables por agente y/o etiqueta. */
|
|
22
|
+
export declare function queryDecisions(memory: TeamMemory, query?: DecisionQuery): DecisionView[];
|
|
23
|
+
/** Reuniones (batches multi-agente), más recientes primero. */
|
|
24
|
+
export declare function queryMeetings(memory: TeamMemory, query?: {
|
|
25
|
+
limit?: number;
|
|
26
|
+
}): MeetingView[];
|
|
27
|
+
/** Resúmenes de sesión (más activas primero). */
|
|
28
|
+
export declare function querySessions(memory: TeamMemory, query?: {
|
|
29
|
+
limit?: number;
|
|
30
|
+
}): SessionSummary[];
|
|
31
|
+
export type CostSummary = {
|
|
32
|
+
sessions: number;
|
|
33
|
+
messageCount: number;
|
|
34
|
+
realCostUSD: number;
|
|
35
|
+
estimatedCostUSD: number;
|
|
36
|
+
estimatedSavingsUSD: number;
|
|
37
|
+
tokensIn: number;
|
|
38
|
+
tokensOut: number;
|
|
39
|
+
};
|
|
40
|
+
/** Resumen de coste/tokens del equipo (reales + ahorro estimado vs baseline). */
|
|
41
|
+
export declare function costSummary(memory: TeamMemory): CostSummary;
|
|
42
|
+
//# sourceMappingURL=teamMemory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"teamMemory.d.ts","sourceRoot":"","sources":["../../src/mcp/teamMemory.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,cAAc,EACpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAA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Deps } from "../../telemetry/eventLog";
|
|
2
|
+
import { type SqliteDatabase, type SqliteEventIndex } from "./sqliteIndex";
|
|
3
|
+
/**
|
|
4
|
+
* Abre una base de datos `bun:sqlite` con import dinámico. Aislado aquí para no
|
|
5
|
+
* introducir un import estático de `bun:sqlite` en el bundle de node: solo se
|
|
6
|
+
* evalúa cuando `storage.sqliteIndex.enabled` está activo (feature experimental).
|
|
7
|
+
* Bajo node (sin `bun:sqlite`) lanza un error claro que el llamante captura.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createBunSqliteDatabase(path: string): Promise<SqliteDatabase>;
|
|
10
|
+
export type BuildSqliteIndexResult = {
|
|
11
|
+
index: SqliteEventIndex;
|
|
12
|
+
events: number;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Abre (o crea) el índice SQLite en `path` con el driver de `bun:sqlite` y lo
|
|
16
|
+
* reconstruye desde el estado del equipo. Best-effort: el llamante debe capturar
|
|
17
|
+
* errores (p. ej. runtime sin `bun:sqlite`) para no romper la Console.
|
|
18
|
+
*/
|
|
19
|
+
export declare function buildSqliteIndexFromConfig(path: string, sessionsDir: string, deps: ReadSessionEventsDeps): Promise<BuildSqliteIndexResult>;
|
|
20
|
+
//# sourceMappingURL=bunSqlite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bunSqlite.d.ts","sourceRoot":"","sources":["../../../src/storage/index/bunSqlite.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACtE,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACtB,MAAM,eAAe,CAAC;AAEvB;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,cAAc,CAAC,CAKzB;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,gBAAgB,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,0BAA0B,CAC9C,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,qBAAqB,GAC1B,OAAO,CAAC,sBAAsB,CAAC,CAKjC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { type EventsAggregate } from "../../telemetry/aggregate";
|
|
2
|
+
import { type ReadSessionEventsDeps } from "../../telemetry/eventLog";
|
|
3
|
+
import { type OpenTeamEvent } from "../../telemetry/events";
|
|
4
|
+
/**
|
|
5
|
+
* Índice SQLite **derivado** de los eventos de openteam. No es fuente de verdad:
|
|
6
|
+
* se reconstruye por completo desde los JSONL/MD vía el `StorageProvider`. Si el
|
|
7
|
+
* fichero se corrompe o se borra, `rebuild*` lo regenera sin pérdida de datos.
|
|
8
|
+
*
|
|
9
|
+
* Experimental y desactivado por defecto (`storage.sqliteIndex.enabled`). Acelera
|
|
10
|
+
* agregaciones/recall cross-sesión de la Console cuando la agregación en memoria
|
|
11
|
+
* deja de escalar.
|
|
12
|
+
*
|
|
13
|
+
* El driver SQLite se inyecta como `SqliteDatabase` (estructuralmente compatible
|
|
14
|
+
* con `bun:sqlite`) para no acoplar este módulo a un runtime concreto ni forzar
|
|
15
|
+
* un import estático de `bun:sqlite` en el bundle de node.
|
|
16
|
+
*/
|
|
17
|
+
/** Statement mínimo compatible con `bun:sqlite`. */
|
|
18
|
+
export type SqliteStatement = {
|
|
19
|
+
all: (...params: unknown[]) => unknown[];
|
|
20
|
+
run: (...params: unknown[]) => unknown;
|
|
21
|
+
};
|
|
22
|
+
/** Superficie mínima de una base de datos SQLite (compatible con `bun:sqlite`). */
|
|
23
|
+
export type SqliteDatabase = {
|
|
24
|
+
run: (sql: string, ...params: unknown[]) => unknown;
|
|
25
|
+
query: (sql: string) => SqliteStatement;
|
|
26
|
+
exec: (sql: string) => unknown;
|
|
27
|
+
close: () => void;
|
|
28
|
+
};
|
|
29
|
+
/** Rollup escalar por sesión, calculado en SQL (agregación acelerada). */
|
|
30
|
+
export type SessionRollup = {
|
|
31
|
+
sessionID: string;
|
|
32
|
+
eventCount: number;
|
|
33
|
+
routeCount: number;
|
|
34
|
+
messageCount: number;
|
|
35
|
+
toolcallCount: number;
|
|
36
|
+
realCostUSD: number;
|
|
37
|
+
tokensIn: number;
|
|
38
|
+
tokensOut: number;
|
|
39
|
+
firstTs: number;
|
|
40
|
+
lastTs: number;
|
|
41
|
+
};
|
|
42
|
+
export type SqliteEventIndex = {
|
|
43
|
+
/** Vacía el índice y lo repuebla con `events` (reconstrucción total). */
|
|
44
|
+
rebuild: (events: readonly OpenTeamEvent[]) => void;
|
|
45
|
+
/** Añade eventos sin vaciar el índice. */
|
|
46
|
+
append: (events: readonly OpenTeamEvent[]) => void;
|
|
47
|
+
/** Lee todos los eventos ordenados por `ts` ascendente. */
|
|
48
|
+
allEvents: () => OpenTeamEvent[];
|
|
49
|
+
/** Rollups escalares por sesión calculados en SQL. */
|
|
50
|
+
sessionRollups: () => SessionRollup[];
|
|
51
|
+
/** Agregación completa (reutiliza `aggregateEvents`, puro). */
|
|
52
|
+
aggregate: () => EventsAggregate;
|
|
53
|
+
/** Cierra la conexión subyacente. */
|
|
54
|
+
close: () => void;
|
|
55
|
+
};
|
|
56
|
+
/** Crea el índice sobre una base de datos ya abierta y asegura el esquema. */
|
|
57
|
+
export declare function createSqliteEventIndex(db: SqliteDatabase): SqliteEventIndex;
|
|
58
|
+
/**
|
|
59
|
+
* Reconstruye el índice desde el estado del equipo leído por el
|
|
60
|
+
* `StorageProvider` (todas las sesiones + telemetry legacy). Devuelve el número
|
|
61
|
+
* de eventos indexados. Es la operación de "regenerar" tras un borrado.
|
|
62
|
+
*/
|
|
63
|
+
export declare function rebuildSqliteIndexFromStorage(index: SqliteEventIndex, dir: string, deps: ReadSessionEventsDeps): Promise<number>;
|
|
64
|
+
//# sourceMappingURL=sqliteIndex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1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