@jmanuelcorral/openteam 0.1.30 → 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.
- package/dist/cli/consoleServe.d.ts +9 -0
- package/dist/cli/consoleServe.d.ts.map +1 -1
- package/dist/cli.js +1614 -1287
- package/dist/config/schema.d.ts +30 -0
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/index.js +12 -1
- package/dist/storage/httpStorageProvider.d.ts +21 -0
- package/dist/storage/httpStorageProvider.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/dist/web/server.d.ts +6 -0
- package/dist/web/server.d.ts.map +1 -1
- package/dist/web/start.d.ts +3 -0
- package/dist/web/start.d.ts.map +1 -1
- package/dist/web/storageRoute.d.ts +36 -0
- package/dist/web/storageRoute.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/config/schema.d.ts
CHANGED
|
@@ -31,11 +31,26 @@ export declare const ConsoleConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
31
31
|
refreshMs: z.ZodDefault<z.ZodNumber>;
|
|
32
32
|
recentRoutes: z.ZodDefault<z.ZodNumber>;
|
|
33
33
|
openBrowser: z.ZodDefault<z.ZodBoolean>;
|
|
34
|
+
remoteStorage: z.ZodDefault<z.ZodBoolean>;
|
|
34
35
|
terminal: z.ZodDefault<z.ZodObject<{
|
|
35
36
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
36
37
|
pty: z.ZodOptional<z.ZodBoolean>;
|
|
37
38
|
}, z.core.$strip>>;
|
|
38
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>>;
|
|
39
54
|
export declare const LocalRuntimeSchema: z.ZodObject<{
|
|
40
55
|
id: z.ZodEnum<{
|
|
41
56
|
ollama: "ollama";
|
|
@@ -123,11 +138,18 @@ export declare const OpenTeamConfigObjectSchema: z.ZodObject<{
|
|
|
123
138
|
refreshMs: z.ZodDefault<z.ZodNumber>;
|
|
124
139
|
recentRoutes: z.ZodDefault<z.ZodNumber>;
|
|
125
140
|
openBrowser: z.ZodDefault<z.ZodBoolean>;
|
|
141
|
+
remoteStorage: z.ZodDefault<z.ZodBoolean>;
|
|
126
142
|
terminal: z.ZodDefault<z.ZodObject<{
|
|
127
143
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
128
144
|
pty: z.ZodOptional<z.ZodBoolean>;
|
|
129
145
|
}, z.core.$strip>>;
|
|
130
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>>;
|
|
131
153
|
}, z.core.$strip>;
|
|
132
154
|
/** Esquema público de la config de openteam. */
|
|
133
155
|
export declare const OpenTeamConfigSchema: z.ZodObject<{
|
|
@@ -199,11 +221,18 @@ export declare const OpenTeamConfigSchema: z.ZodObject<{
|
|
|
199
221
|
refreshMs: z.ZodDefault<z.ZodNumber>;
|
|
200
222
|
recentRoutes: z.ZodDefault<z.ZodNumber>;
|
|
201
223
|
openBrowser: z.ZodDefault<z.ZodBoolean>;
|
|
224
|
+
remoteStorage: z.ZodDefault<z.ZodBoolean>;
|
|
202
225
|
terminal: z.ZodDefault<z.ZodObject<{
|
|
203
226
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
204
227
|
pty: z.ZodOptional<z.ZodBoolean>;
|
|
205
228
|
}, z.core.$strip>>;
|
|
206
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>>;
|
|
207
236
|
}, z.core.$strip>;
|
|
208
237
|
export type ModelRef = z.infer<typeof ModelRefSchema>;
|
|
209
238
|
export type RouterMode = z.infer<typeof RouterModeSchema>;
|
|
@@ -211,4 +240,5 @@ export type PrivacyMode = z.infer<typeof PrivacyModeSchema>;
|
|
|
211
240
|
export type OpenTeamConfig = z.infer<typeof OpenTeamConfigSchema>;
|
|
212
241
|
export type LocalRuntime = z.infer<typeof LocalRuntimeSchema>;
|
|
213
242
|
export type ConsoleConfig = z.infer<typeof ConsoleConfigSchema>;
|
|
243
|
+
export type StorageConfig = z.infer<typeof StorageConfigSchema>;
|
|
214
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,gBAA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AAC,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
|
@@ -341,6 +341,7 @@ var ConsoleConfigSchema = z.object({
|
|
|
341
341
|
refreshMs: z.number().int().min(250).default(2000),
|
|
342
342
|
recentRoutes: z.number().int().positive().default(50),
|
|
343
343
|
openBrowser: z.boolean().default(false),
|
|
344
|
+
remoteStorage: z.boolean().default(false),
|
|
344
345
|
terminal: z.object({
|
|
345
346
|
enabled: z.boolean().default(true),
|
|
346
347
|
pty: z.boolean().optional()
|
|
@@ -352,8 +353,17 @@ var ConsoleConfigSchema = z.object({
|
|
|
352
353
|
refreshMs: 2000,
|
|
353
354
|
recentRoutes: 50,
|
|
354
355
|
openBrowser: false,
|
|
356
|
+
remoteStorage: false,
|
|
355
357
|
terminal: { enabled: true }
|
|
356
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
|
+
});
|
|
357
367
|
var defaultLocalModel = {
|
|
358
368
|
providerID: "ollama",
|
|
359
369
|
modelID: "qwen3:8b"
|
|
@@ -416,7 +426,8 @@ var OpenTeamConfigObjectSchema = z.object({
|
|
|
416
426
|
hardStopOnBudgetExhaustion: z.boolean().default(false)
|
|
417
427
|
}).default({ hardStopOnBudgetExhaustion: false }),
|
|
418
428
|
privacyMode: PrivacyModeSchema.default("forceLocalOnSensitive"),
|
|
419
|
-
console: ConsoleConfigSchema
|
|
429
|
+
console: ConsoleConfigSchema,
|
|
430
|
+
storage: StorageConfigSchema
|
|
420
431
|
});
|
|
421
432
|
var OpenTeamConfigSchema = OpenTeamConfigObjectSchema;
|
|
422
433
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { StorageProvider } from "./provider";
|
|
2
|
+
/**
|
|
3
|
+
* `createHttpStorageProvider` — adapter remoto del `StorageProvider` (§ Fase 4).
|
|
4
|
+
*
|
|
5
|
+
* Habla con el endpoint `/storage/...` servido por la Console (ver
|
|
6
|
+
* `web/storageRoute.ts`) para leer/escribir el estado del equipo a través del
|
|
7
|
+
* tunnel. Es un proxy transparente del contrato: cada operación se traduce a una
|
|
8
|
+
* petición HTTP autenticada con el token efímero de la Console.
|
|
9
|
+
*
|
|
10
|
+
* `fetch` es inyectable para tests deterministas; en producción usa el global.
|
|
11
|
+
*/
|
|
12
|
+
export type HttpStorageProviderOptions = {
|
|
13
|
+
/** Origen del endpoint, p. ej. `http://127.0.0.1:4599`. Sin barra final. */
|
|
14
|
+
baseUrl: string;
|
|
15
|
+
/** Token efímero de la Console (bearer). */
|
|
16
|
+
token: string;
|
|
17
|
+
/** Implementación de `fetch` (inyectable). Por defecto el global. */
|
|
18
|
+
fetch?: typeof fetch;
|
|
19
|
+
};
|
|
20
|
+
export declare function createHttpStorageProvider(options: HttpStorageProviderOptions): StorageProvider;
|
|
21
|
+
//# sourceMappingURL=httpStorageProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpStorageProvider.d.ts","sourceRoot":"","sources":["../../src/storage/httpStorageProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAe,MAAM,YAAY,CAAC;AAE/D;;;;;;;;;GASG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACvC,4EAA4E;IAC5E,OAAO,EAAE,MAAM,CAAC;IAChB,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB,CAAC;AAOF,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,0BAA0B,GAClC,eAAe,CA2CjB"}
|
|
@@ -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,EAAE,KAAK,OAAO,CAAC;CACxC,CAAC;AAEF,mFAAmF;AACnF,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC;IACpD,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,eAAe,CAAC;IACxC,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IAC/B,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AAEF,0EAA0E;AAC1E,MAAM,MAAM,aAAa,GAAG;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,yEAAyE;IACzE,OAAO,EAAE,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,KAAK,IAAI,CAAC;IACpD,0CAA0C;IAC1C,MAAM,EAAE,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,KAAK,IAAI,CAAC;IACnD,2DAA2D;IAC3D,SAAS,EAAE,MAAM,aAAa,EAAE,CAAC;IACjC,sDAAsD;IACtD,cAAc,EAAE,MAAM,aAAa,EAAE,CAAC;IACtC,+DAA+D;IAC/D,SAAS,EAAE,MAAM,eAAe,CAAC;IACjC,qCAAqC;IACrC,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AAwDF,8EAA8E;AAC9E,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,cAAc,GAAG,gBAAgB,CAwD3E;AAED;;;;GAIG;AACH,wBAAsB,6BAA6B,CACjD,KAAK,EAAE,gBAAgB,EACvB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,qBAAqB,GAC1B,OAAO,CAAC,MAAM,CAAC,CAIjB"}
|
package/dist/web/server.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { ConsoleConfig } from "../config/schema";
|
|
|
3
3
|
import type { ConsoleClient } from "../console/opencodeClient";
|
|
4
4
|
import type { PtyClient } from "../console/pty";
|
|
5
5
|
import type { ConsoleInputs } from "../console/state";
|
|
6
|
+
import { type StorageRouteDeps } from "./storageRoute";
|
|
6
7
|
export type ConsoleServerDeps = {
|
|
7
8
|
/** Relee las fuentes y produce los inputs crudos del console. */
|
|
8
9
|
readSnapshot: () => Promise<ConsoleInputs>;
|
|
@@ -20,6 +21,11 @@ export type ConsoleServerDeps = {
|
|
|
20
21
|
createClient: (endpoint: string) => ConsoleClient;
|
|
21
22
|
createPtyClient?: (endpoint: string) => PtyClient;
|
|
22
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* Endpoint remoto de storage (`/storage/*`). Opcional y opt-in: expone el
|
|
26
|
+
* estado del equipo autenticado con token para una Console remota vía tunnel.
|
|
27
|
+
*/
|
|
28
|
+
storageApi?: StorageRouteDeps;
|
|
23
29
|
};
|
|
24
30
|
export type ConsoleServer = {
|
|
25
31
|
url: string;
|
package/dist/web/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/web/server.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,IAAI,gBAAgB,EAIjC,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/web/server.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,IAAI,gBAAgB,EAIjC,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGtD,OAAO,EAAsB,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAW3E,MAAM,MAAM,iBAAiB,GAAG;IAC9B,iEAAiE;IACjE,YAAY,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,CAAC;IAC3C,MAAM,EAAE,aAAa,CAAC;IACtB,2EAA2E;IAC3E,YAAY,CAAC,EAAE,OAAO,gBAAgB,CAAC;IACvC,sCAAsC;IACtC,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,8EAA8E;IAC9E,OAAO,CAAC,EAAE;QACR,KAAK,EAAE,MAAM,CAAC;QACd,eAAe,EAAE,OAAO,CAAC;QACzB,+DAA+D;QAC/D,UAAU,CAAC,EAAE,OAAO,CAAC;QACrB,YAAY,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,aAAa,CAAC;QAClD,eAAe,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,SAAS,CAAC;KACnD,CAAC;IACF;;;OAGG;IACH,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,oEAAoE;IACpE,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AA2DF;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,iBAAiB,GACtB,OAAO,CAAC,aAAa,CAAC,CAmIxB"}
|
package/dist/web/start.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { ConsoleClient } from "../console/opencodeClient";
|
|
|
5
5
|
import type { PtyClient } from "../console/pty";
|
|
6
6
|
import type { CommitView } from "../console/types";
|
|
7
7
|
import type { StorageProvider } from "../storage/provider";
|
|
8
|
+
import type { StorageRouteDeps } from "./storageRoute";
|
|
8
9
|
export type ConsoleRuntimeDeps = {
|
|
9
10
|
config: ConsoleConfig;
|
|
10
11
|
/** Directorio de logs de sesión (`sessions/*.jsonl`). */
|
|
@@ -31,6 +32,8 @@ export type ConsoleRuntimeDeps = {
|
|
|
31
32
|
createClient: (endpoint: string) => ConsoleClient;
|
|
32
33
|
createPtyClient?: (endpoint: string) => PtyClient;
|
|
33
34
|
};
|
|
35
|
+
/** Endpoint remoto de storage (`/storage/*`). Opcional y opt-in. */
|
|
36
|
+
storageApi?: StorageRouteDeps;
|
|
34
37
|
/** Inyectables para tests. */
|
|
35
38
|
serve?: typeof import("./server").createConsoleServer;
|
|
36
39
|
watch?: (path: string, listener: () => void) => ReturnType<typeof fsWatch>;
|
package/dist/web/start.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/web/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/web/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA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,EAAE,mBAAmB,CAAC;IACtD,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,KAAK,UAAU,CAAC,OAAO,OAAO,CAAC,CAAC;IAC3E,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,cAAc,CAAC,CAEzB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
|
+
import type { StorageProvider } from "../storage/provider";
|
|
3
|
+
/**
|
|
4
|
+
* Endpoint HTTP que expone un `StorageProvider` sobre la red (§ Fase 4). Permite
|
|
5
|
+
* que una Console/sesión remota lea el estado del equipo a través del tunnel ya
|
|
6
|
+
* existente, reutilizando el token efímero de la Console.
|
|
7
|
+
*
|
|
8
|
+
* Seguridad:
|
|
9
|
+
* - Exige el token (bearer `Authorization` o `?token=`), como el resto de la
|
|
10
|
+
* Console. Sin token válido → 401.
|
|
11
|
+
* - `readOnly` (por defecto activo cuando se expone remoto) rechaza cualquier
|
|
12
|
+
* mutación (`write`/`append`/`mkdir`/`delete`) con 403.
|
|
13
|
+
* - `allowPrefixes` restringe las rutas accesibles a un allowlist normalizado;
|
|
14
|
+
* fuera de él → 403. Así solo se expone lo pactado (sessions/decisions/backlog/
|
|
15
|
+
* agentes), nunca ficheros arbitrarios del disco.
|
|
16
|
+
*
|
|
17
|
+
* El storage de openteam solo contiene telemetría hasheada y artefactos Markdown
|
|
18
|
+
* del equipo: nunca prompts crudos ni PII.
|
|
19
|
+
*/
|
|
20
|
+
export type StorageRouteDeps = {
|
|
21
|
+
storage: StorageProvider;
|
|
22
|
+
token: string;
|
|
23
|
+
/** Si es `true`, rechaza toda mutación con 403. Por defecto `false`. */
|
|
24
|
+
readOnly?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Allowlist de prefijos virtuales accesibles. Si es `undefined`, se permite
|
|
27
|
+
* cualquier ruta (útil en tests). En producción se acota al estado del equipo.
|
|
28
|
+
*/
|
|
29
|
+
allowPrefixes?: readonly string[];
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Enruta las peticiones de `/storage/...`. Devuelve `true` si la petición fue
|
|
33
|
+
* atendida (y respondida), `false` para que el servidor siga con sus rutas.
|
|
34
|
+
*/
|
|
35
|
+
export declare function handleStorageRoute(request: IncomingMessage, response: ServerResponse, url: URL, deps: StorageRouteDeps): Promise<boolean>;
|
|
36
|
+
//# sourceMappingURL=storageRoute.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storageRoute.d.ts","sourceRoot":"","sources":["../../src/web/storageRoute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAGjE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAE3D;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,eAAe,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC,CAAC;AAgKF;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,eAAe,EACxB,QAAQ,EAAE,cAAc,EACxB,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAAC,OAAO,CAAC,CA4ClB"}
|