@jmanuelcorral/openteam 0.1.31 → 0.1.32

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.
@@ -37,6 +37,20 @@ export declare const ConsoleConfigSchema: z.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;AAeL,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;iBAM7B,CAAC;AAEH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA2DrC,CAAC;AAEH,gDAAgD;AAChD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAA6B,CAAC;AAE/D,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AACtD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC1D,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC5D,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,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
 
@@ -0,0 +1,20 @@
1
+ import type { ReadSessionEventsDeps } 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
+ {"version":3,"file":"sqliteIndex.d.ts","sourceRoot":"","sources":["../../../src/storage/index/sqliteIndex.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,KAAK,qBAAqB,EAE3B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,wBAAwB,CAAC;AAEhC;;;;;;;;;;;;GAYG;AAEH,oDAAoD;AACpD,MAAM,MAAM,eAAe,GAAG;IAC5B,GAAG,EAAE,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,KAAK,OAAO,EAAE,CAAC;IACzC,GAAG,EAAE,CAAC,GAAG,MAAM,EAAE,OAAO,E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AED;;;;GAIG;AACH,wBAAsB,6BAA6B,CACjD,KAAK,EAAE,gBAAgB,EACvB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,qBAAqB,GAC1B,OAAO,CAAC,MAAM,CAAC,CAIjB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jmanuelcorral/openteam",
3
- "version": "0.1.31",
3
+ "version": "0.1.32",
4
4
  "description": "Plugin opencode de routing coste-consciente local-first con orquestación Squad.",
5
5
  "license": "MIT",
6
6
  "author": "Jose Manuel Corral",