@jmanuelcorral/openteam 0.1.24 → 0.1.26
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/.opencode/command/openteam.md +2 -2
- package/README.md +65 -16
- package/dist/cli/{dashboardServe.d.ts → consoleServe.d.ts} +23 -13
- package/dist/cli/consoleServe.d.ts.map +1 -0
- package/dist/cli/tunnel.d.ts +89 -0
- package/dist/cli/tunnel.d.ts.map +1 -0
- package/dist/cli.js +1168 -187
- package/dist/commands/console.d.ts +9 -0
- package/dist/commands/console.d.ts.map +1 -0
- package/dist/commands/dispatch.d.ts.map +1 -1
- package/dist/config/schema.d.ts +88 -4
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/console/backlog.d.ts.map +1 -0
- package/dist/console/opencodeClient.d.ts +30 -0
- package/dist/console/opencodeClient.d.ts.map +1 -0
- package/dist/console/protocol.d.ts +42 -0
- package/dist/console/protocol.d.ts.map +1 -0
- package/dist/console/pty.d.ts +47 -0
- package/dist/console/pty.d.ts.map +1 -0
- package/dist/console/render.d.ts +20 -0
- package/dist/console/render.d.ts.map +1 -0
- package/dist/console/session.d.ts +23 -0
- package/dist/console/session.d.ts.map +1 -0
- package/dist/console/sse.d.ts +21 -0
- package/dist/console/sse.d.ts.map +1 -0
- package/dist/{dashboard → console}/state.d.ts +10 -5
- package/dist/console/state.d.ts.map +1 -0
- package/dist/console/token.d.ts +24 -0
- package/dist/console/token.d.ts.map +1 -0
- package/dist/{dashboard → console}/types.d.ts +24 -3
- package/dist/console/types.d.ts.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +85 -34
- package/dist/plugin/capture.d.ts +12 -1
- package/dist/plugin/capture.d.ts.map +1 -1
- package/dist/plugin/commandTool.d.ts +1 -1
- package/dist/plugin/commandTool.d.ts.map +1 -1
- package/dist/telemetry/aggregate.d.ts +15 -1
- package/dist/telemetry/aggregate.d.ts.map +1 -1
- package/dist/telemetry/decisions.d.ts +1 -1
- package/dist/telemetry/eventLog.d.ts +1 -1
- package/dist/telemetry/eventLog.d.ts.map +1 -1
- package/dist/telemetry/events.d.ts +28 -1
- package/dist/telemetry/events.d.ts.map +1 -1
- package/dist/web/console.d.ts +28 -0
- package/dist/web/console.d.ts.map +1 -0
- package/dist/web/git.d.ts +1 -1
- package/dist/web/git.d.ts.map +1 -1
- package/dist/web/paths.d.ts +1 -1
- package/dist/web/paths.d.ts.map +1 -1
- package/dist/web/server.d.ts +20 -9
- package/dist/web/server.d.ts.map +1 -1
- package/dist/web/snapshot.d.ts +6 -6
- package/dist/web/snapshot.d.ts.map +1 -1
- package/dist/web/start.d.ts +19 -9
- package/dist/web/start.d.ts.map +1 -1
- package/package.json +4 -2
- package/dist/cli/dashboardServe.d.ts.map +0 -1
- package/dist/commands/dashboard.d.ts +0 -9
- package/dist/commands/dashboard.d.ts.map +0 -1
- package/dist/dashboard/backlog.d.ts.map +0 -1
- package/dist/dashboard/render.d.ts +0 -14
- package/dist/dashboard/render.d.ts.map +0 -1
- package/dist/dashboard/state.d.ts.map +0 -1
- package/dist/dashboard/types.d.ts.map +0 -1
- /package/dist/{dashboard → console}/backlog.d.ts +0 -0
package/dist/index.js
CHANGED
|
@@ -110,7 +110,7 @@ function buildOrchestratorAgent(frontier, options = {}) {
|
|
|
110
110
|
"- **scribe** — memoria silenciosa del equipo. Registra decisiones y",
|
|
111
111
|
" aprendizajes en un log compartido (`.opencode/openteam-decisions.md`) sin",
|
|
112
112
|
" ejecutar cambios de código. Modelo **local**; permisos de solo lectura más",
|
|
113
|
-
" edición de ese log. **Formato parseable** para el
|
|
113
|
+
" edición de ese log. **Formato parseable** para el console: una decisión",
|
|
114
114
|
" por línea como item de lista Markdown, ya **redactada** (sin prompts ni",
|
|
115
115
|
" datos sensibles):",
|
|
116
116
|
" `- YYYY-MM-DD [agente] Resumen breve de la decisión #tag1 #tag2`",
|
|
@@ -215,21 +215,26 @@ var PrivacyModeSchema = z.enum([
|
|
|
215
215
|
"off"
|
|
216
216
|
]);
|
|
217
217
|
var BaselineModeSchema = z.enum(["auto", "pinned"]);
|
|
218
|
-
var
|
|
219
|
-
var
|
|
220
|
-
host:
|
|
218
|
+
var ConsoleHostSchema = z.enum(["127.0.0.1", "localhost"]);
|
|
219
|
+
var ConsoleConfigSchema = z.object({
|
|
220
|
+
host: ConsoleHostSchema.default("127.0.0.1"),
|
|
221
221
|
port: z.number().int().min(1024).max(65535).default(4599),
|
|
222
222
|
autoPortFallback: z.boolean().default(true),
|
|
223
223
|
refreshMs: z.number().int().min(250).default(2000),
|
|
224
224
|
recentRoutes: z.number().int().positive().default(50),
|
|
225
|
-
openBrowser: z.boolean().default(false)
|
|
225
|
+
openBrowser: z.boolean().default(false),
|
|
226
|
+
terminal: z.object({
|
|
227
|
+
enabled: z.boolean().default(true),
|
|
228
|
+
pty: z.boolean().optional()
|
|
229
|
+
}).default({ enabled: true })
|
|
226
230
|
}).default({
|
|
227
231
|
host: "127.0.0.1",
|
|
228
232
|
port: 4599,
|
|
229
233
|
autoPortFallback: true,
|
|
230
234
|
refreshMs: 2000,
|
|
231
235
|
recentRoutes: 50,
|
|
232
|
-
openBrowser: false
|
|
236
|
+
openBrowser: false,
|
|
237
|
+
terminal: { enabled: true }
|
|
233
238
|
});
|
|
234
239
|
var defaultLocalModel = {
|
|
235
240
|
providerID: "ollama",
|
|
@@ -246,7 +251,7 @@ var LocalRuntimeSchema = z.object({
|
|
|
246
251
|
discovery: z.enum(["cli", "sdk", "manual"]).optional(),
|
|
247
252
|
defaultModel: ModelRefSchema
|
|
248
253
|
});
|
|
249
|
-
var
|
|
254
|
+
var OpenTeamConfigObjectSchema = z.object({
|
|
250
255
|
baseline: z.object({
|
|
251
256
|
mode: BaselineModeSchema.default("auto"),
|
|
252
257
|
pinnedModel: ModelRefSchema.nullable().default(null),
|
|
@@ -293,8 +298,9 @@ var OpenTeamConfigSchema = z.object({
|
|
|
293
298
|
hardStopOnBudgetExhaustion: z.boolean().default(false)
|
|
294
299
|
}).default({ hardStopOnBudgetExhaustion: false }),
|
|
295
300
|
privacyMode: PrivacyModeSchema.default("forceLocalOnSensitive"),
|
|
296
|
-
|
|
301
|
+
console: ConsoleConfigSchema
|
|
297
302
|
});
|
|
303
|
+
var OpenTeamConfigSchema = OpenTeamConfigObjectSchema;
|
|
298
304
|
|
|
299
305
|
// src/config/persist.ts
|
|
300
306
|
var DEFAULT_CONFIG_PATH = ".opencode/openteam.json";
|
|
@@ -863,13 +869,21 @@ var ActivityEventSchema = EventBaseSchema.extend({
|
|
|
863
869
|
agent: z3.string().min(1).optional(),
|
|
864
870
|
summary: z3.string().min(1)
|
|
865
871
|
});
|
|
872
|
+
var SessionEndpointEventSchema = EventBaseSchema.extend({
|
|
873
|
+
type: z3.literal("session-endpoint"),
|
|
874
|
+
url: z3.string().url(),
|
|
875
|
+
directory: z3.string().min(1).optional(),
|
|
876
|
+
worktree: z3.string().min(1).optional(),
|
|
877
|
+
title: z3.string().min(1).optional()
|
|
878
|
+
});
|
|
866
879
|
var OpenTeamEventSchema = z3.discriminatedUnion("type", [
|
|
867
880
|
RouteEventSchema,
|
|
868
881
|
MessageEventSchema,
|
|
869
882
|
ToolcallEventSchema,
|
|
870
883
|
MeetingEventSchema,
|
|
871
884
|
DecisionEventSchema,
|
|
872
|
-
ActivityEventSchema
|
|
885
|
+
ActivityEventSchema,
|
|
886
|
+
SessionEndpointEventSchema
|
|
873
887
|
]);
|
|
874
888
|
|
|
875
889
|
// src/plugin/capture.ts
|
|
@@ -911,6 +925,34 @@ function messageEventFrom(info, now) {
|
|
|
911
925
|
}
|
|
912
926
|
return event;
|
|
913
927
|
}
|
|
928
|
+
function sessionEndpointEventFrom(sessionID, url, now, meta = {}) {
|
|
929
|
+
let origin;
|
|
930
|
+
try {
|
|
931
|
+
origin = new URL(url).origin;
|
|
932
|
+
} catch {
|
|
933
|
+
return;
|
|
934
|
+
}
|
|
935
|
+
if (origin === "null" || origin.length === 0) {
|
|
936
|
+
return;
|
|
937
|
+
}
|
|
938
|
+
const event = {
|
|
939
|
+
v: EVENT_SCHEMA_VERSION,
|
|
940
|
+
type: "session-endpoint",
|
|
941
|
+
ts: now(),
|
|
942
|
+
sessionID,
|
|
943
|
+
url: origin
|
|
944
|
+
};
|
|
945
|
+
if (meta.directory !== undefined) {
|
|
946
|
+
event.directory = meta.directory;
|
|
947
|
+
}
|
|
948
|
+
if (meta.worktree !== undefined) {
|
|
949
|
+
event.worktree = meta.worktree;
|
|
950
|
+
}
|
|
951
|
+
if (meta.title !== undefined) {
|
|
952
|
+
event.title = meta.title;
|
|
953
|
+
}
|
|
954
|
+
return event;
|
|
955
|
+
}
|
|
914
956
|
var ACTIVITY_SUMMARIES = {
|
|
915
957
|
"session.created": "Sesión creada",
|
|
916
958
|
"session.idle": "Sesión en reposo",
|
|
@@ -1165,18 +1207,18 @@ function autoBaseline(config) {
|
|
|
1165
1207
|
};
|
|
1166
1208
|
}
|
|
1167
1209
|
|
|
1168
|
-
// src/commands/
|
|
1169
|
-
function
|
|
1170
|
-
const url = `http://${
|
|
1210
|
+
// src/commands/console.ts
|
|
1211
|
+
function renderConsoleStatus(console_) {
|
|
1212
|
+
const url = `http://${console_.host}:${console_.port}`;
|
|
1171
1213
|
return [
|
|
1172
|
-
"
|
|
1214
|
+
"Console (multi-sesión, se lanza desde la CLI):",
|
|
1173
1215
|
` URL: ${url}`,
|
|
1174
|
-
` Refresco: ${
|
|
1175
|
-
` Rutas: últimas ${
|
|
1176
|
-
|
|
1216
|
+
` Refresco: ${console_.refreshMs} ms (SSE + polling)`,
|
|
1217
|
+
` Rutas: últimas ${console_.recentRoutes}`,
|
|
1218
|
+
console_.autoPortFallback ? " Puerto: con fallback automático si está ocupado" : " Puerto: fijo (sin fallback)",
|
|
1177
1219
|
"",
|
|
1178
|
-
"
|
|
1179
|
-
" openteam
|
|
1220
|
+
"Lánzala con:",
|
|
1221
|
+
" openteam console (Ctrl+C para parar; --open abre el navegador)",
|
|
1180
1222
|
"",
|
|
1181
1223
|
"Agrega TODAS las sesiones de opencode que escriben eventos en",
|
|
1182
1224
|
" .opencode/openteam/sessions/*.jsonl",
|
|
@@ -1334,8 +1376,9 @@ var HELP = [
|
|
|
1334
1376
|
" openteam baseline auto Baseline cheapest-capable (modo auto)",
|
|
1335
1377
|
" openteam doctor Diagnóstico de runtimes y config",
|
|
1336
1378
|
" openteam agents Lista los agentes y el LLM (local/frontier) de cada uno",
|
|
1337
|
-
" openteam
|
|
1338
|
-
" openteam
|
|
1379
|
+
" openteam console Lanza la Console web multi-sesión (Ctrl+C para parar; --open abre el navegador)",
|
|
1380
|
+
" openteam console --status Muestra la config de la Console sin lanzarla",
|
|
1381
|
+
" openteam tunnel Expone la Console vía Dev Tunnels (--terminal expone opencode; Ctrl+C para cerrar)",
|
|
1339
1382
|
" openteam report Resumen de coste/ahorro (telemetría)",
|
|
1340
1383
|
" openteam yolo status Muestra si el modo YOLO está activo",
|
|
1341
1384
|
" openteam yolo on Activa YOLO (opencode auto-aprueba todo)",
|
|
@@ -1525,9 +1568,9 @@ async function runCli(argv, deps) {
|
|
|
1525
1568
|
if (command === "agents") {
|
|
1526
1569
|
return await runAgents(deps, configPath, opencodeConfigPath);
|
|
1527
1570
|
}
|
|
1528
|
-
if (command === "
|
|
1571
|
+
if (command === "console") {
|
|
1529
1572
|
const config = await deps.loadConfig(configPath);
|
|
1530
|
-
return { exitCode: 0, stdout:
|
|
1573
|
+
return { exitCode: 0, stdout: renderConsoleStatus(config.console) };
|
|
1531
1574
|
}
|
|
1532
1575
|
if (command === undefined || command === "help" || command === "--help") {
|
|
1533
1576
|
return { exitCode: 0, stdout: HELP };
|
|
@@ -1559,23 +1602,15 @@ function commandArgv(action, model) {
|
|
|
1559
1602
|
return ["report"];
|
|
1560
1603
|
case "agents":
|
|
1561
1604
|
return ["agents"];
|
|
1562
|
-
case "
|
|
1563
|
-
return ["
|
|
1605
|
+
case "console":
|
|
1606
|
+
return ["console"];
|
|
1564
1607
|
}
|
|
1565
1608
|
}
|
|
1566
1609
|
function createCommandTool(deps) {
|
|
1567
1610
|
return tool({
|
|
1568
|
-
description: "Comandos runtime de openteam: baseline (show/set/auto), doctor, report, agents (LLM por agente: local/frontier + suscripción) y
|
|
1611
|
+
description: "Comandos runtime de openteam: baseline (show/set/auto), doctor, report, agents (LLM por agente: local/frontier + suscripción) y console (estado/URL de la Console web).",
|
|
1569
1612
|
args: {
|
|
1570
|
-
action: tool.schema.enum([
|
|
1571
|
-
"show",
|
|
1572
|
-
"set",
|
|
1573
|
-
"auto",
|
|
1574
|
-
"doctor",
|
|
1575
|
-
"report",
|
|
1576
|
-
"agents",
|
|
1577
|
-
"dashboard"
|
|
1578
|
-
]).describe("Acción a ejecutar"),
|
|
1613
|
+
action: tool.schema.enum(["show", "set", "auto", "doctor", "report", "agents", "console"]).describe("Acción a ejecutar"),
|
|
1579
1614
|
model: tool.schema.string().optional().describe("Modelo provider/model (solo para action=set)")
|
|
1580
1615
|
},
|
|
1581
1616
|
async execute(args) {
|
|
@@ -2463,6 +2498,20 @@ var server = async (ctx, rawOptions) => {
|
|
|
2463
2498
|
const cliDeps = createCliDeps(config, registry, telemetryPath, sessionsDir);
|
|
2464
2499
|
const toolcalls = createToolcallTracker({ sink });
|
|
2465
2500
|
const now = () => Date.now();
|
|
2501
|
+
const announcedSessions = new Set;
|
|
2502
|
+
const announceEndpoint = (sessionID) => {
|
|
2503
|
+
if (sessionID === undefined || announcedSessions.has(sessionID)) {
|
|
2504
|
+
return;
|
|
2505
|
+
}
|
|
2506
|
+
announcedSessions.add(sessionID);
|
|
2507
|
+
const endpoint = sessionEndpointEventFrom(sessionID, ctx.serverUrl, now, {
|
|
2508
|
+
directory: ctx.directory,
|
|
2509
|
+
worktree: ctx.worktree
|
|
2510
|
+
});
|
|
2511
|
+
if (endpoint !== undefined) {
|
|
2512
|
+
sink.emit(endpoint);
|
|
2513
|
+
}
|
|
2514
|
+
};
|
|
2466
2515
|
return {
|
|
2467
2516
|
...hooks,
|
|
2468
2517
|
tool: {
|
|
@@ -2480,12 +2529,14 @@ var server = async (ctx, rawOptions) => {
|
|
|
2480
2529
|
}
|
|
2481
2530
|
const activity = activityEventFrom(event, now);
|
|
2482
2531
|
if (activity !== undefined) {
|
|
2532
|
+
announceEndpoint(activity.sessionID);
|
|
2483
2533
|
sink.emit(activity);
|
|
2484
2534
|
}
|
|
2485
2535
|
if (event.type === "message.updated") {
|
|
2486
2536
|
const info = event.properties?.info;
|
|
2487
2537
|
const message = info === undefined ? undefined : messageEventFrom(info, now);
|
|
2488
2538
|
if (message !== undefined) {
|
|
2539
|
+
announceEndpoint(message.sessionID);
|
|
2489
2540
|
sink.emit(message);
|
|
2490
2541
|
}
|
|
2491
2542
|
}
|
package/dist/plugin/capture.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ActivityEvent, type MessageEvent } from "../telemetry/events";
|
|
1
|
+
import { type ActivityEvent, type MessageEvent, type SessionEndpointEvent } from "../telemetry/events";
|
|
2
2
|
/**
|
|
3
3
|
* Mapeo **puro** de eventos de opencode a `OpenTeamEvent` redactados. Sin I/O,
|
|
4
4
|
* red, reloj (se inyecta `now`), random ni env vars.
|
|
@@ -32,10 +32,21 @@ export type AssistantInfoLike = {
|
|
|
32
32
|
* no ha terminado, o le falta sesión/modelo.
|
|
33
33
|
*/
|
|
34
34
|
export declare function messageEventFrom(info: AssistantInfoLike, now: () => number): MessageEvent | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* Construye un `session-endpoint` event para anunciar el servidor opencode de una
|
|
37
|
+
* sesión. `url` se normaliza a solo el **origen** (`protocol//host:port`): nunca
|
|
38
|
+
* rutas, query ni credenciales. Devuelve `undefined` si `url` no es parseable.
|
|
39
|
+
*/
|
|
40
|
+
export declare function sessionEndpointEventFrom(sessionID: string, url: string | URL, now: () => number, meta?: {
|
|
41
|
+
directory?: string;
|
|
42
|
+
worktree?: string;
|
|
43
|
+
title?: string;
|
|
44
|
+
}): SessionEndpointEvent | undefined;
|
|
35
45
|
type OpencodeEventLike = {
|
|
36
46
|
type: string;
|
|
37
47
|
properties?: unknown;
|
|
38
48
|
};
|
|
49
|
+
export declare function sessionIDFromEvent(event: OpencodeEventLike): string | undefined;
|
|
39
50
|
/**
|
|
40
51
|
* Construye un `activity` event redactado (solo el tipo de evento, nunca
|
|
41
52
|
* contenido) a partir de un evento de ciclo de vida de sesión. Devuelve
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../../src/plugin/capture.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"capture.d.ts","sourceRoot":"","sources":["../../src/plugin/capture.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAElB,KAAK,YAAY,EACjB,KAAK,oBAAoB,EAC1B,MAAM,qBAAqB,CAAC;AAE7B;;;GAGG;AAEH,qEAAqE;AACrE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAChD,MAAM,CAAC,EAAE;QACP,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,KAAK,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,MAAM,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC;KAC3C,CAAC;CACH,CAAC;AAMF;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,iBAAiB,EACvB,GAAG,EAAE,MAAM,MAAM,GAChB,YAAY,GAAG,SAAS,CA0C1B;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,GAAG,GAAG,EACjB,GAAG,EAAE,MAAM,MAAM,EACjB,IAAI,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GACnE,oBAAoB,GAAG,SAAS,CA4BlC;AAQD,KAAK,iBAAiB,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,iBAAiB,GACvB,MAAM,GAAG,SAAS,CAgBpB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,iBAAiB,EACxB,GAAG,EAAE,MAAM,MAAM,GAChB,aAAa,GAAG,SAAS,CAiB3B"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ToolDefinition } from "@opencode-ai/plugin";
|
|
2
2
|
import { type CliDeps } from "../commands/dispatch";
|
|
3
|
-
export type CommandAction = "show" | "set" | "auto" | "doctor" | "report" | "agents" | "
|
|
3
|
+
export type CommandAction = "show" | "set" | "auto" | "doctor" | "report" | "agents" | "console";
|
|
4
4
|
/**
|
|
5
5
|
* Map a tool action (+ optional model) to the argv understood by {@link runCli}.
|
|
6
6
|
* Pure so it can be unit-tested without the opencode runtime.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commandTool.d.ts","sourceRoot":"","sources":["../../src/plugin/commandTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAC;AAEhE,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,sBAAsB,CAAC;AAE5D,MAAM,MAAM,aAAa,GACrB,MAAM,GACN,KAAK,GACL,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,
|
|
1
|
+
{"version":3,"file":"commandTool.d.ts","sourceRoot":"","sources":["../../src/plugin/commandTool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAC;AAEhE,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,sBAAsB,CAAC;AAE5D,MAAM,MAAM,aAAa,GACrB,MAAM,GACN,KAAK,GACL,MAAM,GACN,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,SAAS,CAAC;AAEd;;;GAGG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAmB3E;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,OAAO,GAAG,cAAc,CAkB/D"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ActivityEvent, OpenTeamEvent } from "./events";
|
|
2
2
|
/**
|
|
3
|
-
* Agregación **pura y determinista** de eventos de openteam para el
|
|
3
|
+
* Agregación **pura y determinista** de eventos de openteam para el console.
|
|
4
4
|
* Reconstruye resúmenes por sesión y rollups globales sin depender del orden de
|
|
5
5
|
* entrada. Sin I/O, red, reloj, random ni env vars.
|
|
6
6
|
*/
|
|
@@ -13,6 +13,18 @@ export type ToolUsage = {
|
|
|
13
13
|
export type ToolcallStats = ToolUsage & {
|
|
14
14
|
byTool: Record<string, ToolUsage>;
|
|
15
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* Endpoint del servidor opencode de una sesión (loopback). Lo aporta el evento
|
|
18
|
+
* `session-endpoint`; la Console lo usa para conectarse a la terminal/SSE.
|
|
19
|
+
*/
|
|
20
|
+
export type SessionEndpointView = {
|
|
21
|
+
url: string;
|
|
22
|
+
directory?: string;
|
|
23
|
+
worktree?: string;
|
|
24
|
+
title?: string;
|
|
25
|
+
/** `ts` del último `session-endpoint` visto (para quedarse con el más reciente). */
|
|
26
|
+
lastSeenTs: number;
|
|
27
|
+
};
|
|
16
28
|
export type SessionSummary = {
|
|
17
29
|
sessionID: string;
|
|
18
30
|
firstTs: number;
|
|
@@ -34,6 +46,8 @@ export type SessionSummary = {
|
|
|
34
46
|
models: string[];
|
|
35
47
|
/** Agentes vistos, orden estable. */
|
|
36
48
|
agents: string[];
|
|
49
|
+
/** Endpoint del servidor opencode, si la sesión lo anunció. */
|
|
50
|
+
endpoint?: SessionEndpointView;
|
|
37
51
|
};
|
|
38
52
|
export type DecisionView = {
|
|
39
53
|
ts: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aggregate.d.ts","sourceRoot":"","sources":["../../src/telemetry/aggregate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAIb,aAAa,
|
|
1
|
+
{"version":3,"file":"aggregate.d.ts","sourceRoot":"","sources":["../../src/telemetry/aggregate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAIb,aAAa,EAId,MAAM,UAAU,CAAC;AAElB;;;;GAIG;AAEH,MAAM,MAAM,SAAS,GAAG;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG;IACtC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACnC,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CA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,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,aAAa,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,MAAM,EAAE,WAAW,CAAC;IACpB,SAAS,EAAE,YAAY,EAAE,CAAC;IAC1B,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,QAAQ,EAAE,YAAY,EAAE,CAAC;CAC1B,CAAC;AAmMF;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,SAAS,aAAa,EAAE,GAC/B,eAAe,CA2EjB"}
|
|
@@ -4,7 +4,7 @@ import { type DecisionEvent } from "./events";
|
|
|
4
4
|
*
|
|
5
5
|
* El scribe escribe cada decisión/aprendizaje como un item de lista Markdown ya
|
|
6
6
|
* **redactado** (nunca prompts ni datos sensibles). Este parser lo convierte a
|
|
7
|
-
* `decision` events para que el
|
|
7
|
+
* `decision` events para que el console los agregue junto al resto.
|
|
8
8
|
*
|
|
9
9
|
* Sin I/O, red, reloj (`now`), random ni env vars. `Date.parse` sobre una fecha
|
|
10
10
|
* literal es determinista.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type OpenTeamEvent, type RouteEvent } from "./events";
|
|
2
2
|
import type { CostRecord } from "./types";
|
|
3
|
-
/** Directorio por defecto de los logs de sesión que alimentan el
|
|
3
|
+
/** Directorio por defecto de los logs de sesión que alimentan el console. */
|
|
4
4
|
export declare const DEFAULT_SESSIONS_DIR = ".opencode/openteam/sessions";
|
|
5
5
|
/** Sesión sintética para registros del telemetry legacy sin `sessionID`. */
|
|
6
6
|
export declare const LEGACY_SESSION_ID = "legacy";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventLog.d.ts","sourceRoot":"","sources":["../../src/telemetry/eventLog.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,aAAa,EAElB,KAAK,UAAU,EAChB,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C
|
|
1
|
+
{"version":3,"file":"eventLog.d.ts","sourceRoot":"","sources":["../../src/telemetry/eventLog.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,aAAa,EAElB,KAAK,UAAU,EAChB,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,6EAA6E;AAC7E,eAAO,MAAM,oBAAoB,gCAAgC,CAAC;AAElE,4EAA4E;AAC5E,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAE1C,sEAAsE;AACtE,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACtD,CAAC;AAEF,sEAAsE;AACtE,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM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,iEAAiE;IACjE,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,qBAAqB,GAC1B,OAAO,CAAC,aAAa,EAAE,CAAC,CAyB1B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
/**
|
|
3
3
|
* Modelo de eventos de openteam. Cada sesión de opencode escribe una secuencia
|
|
4
|
-
* de estos eventos (JSONL) que el
|
|
4
|
+
* de estos eventos (JSONL) que el console agrega. Discriminados por `type`.
|
|
5
5
|
*
|
|
6
6
|
* Privacidad: **nunca** contienen texto de prompt, argumentos de tool ni salida
|
|
7
7
|
* en claro; solo `promptHash`, contadores y resúmenes ya redactados.
|
|
@@ -113,6 +113,23 @@ export declare const ActivityEventSchema: z.ZodObject<{
|
|
|
113
113
|
agent: z.ZodOptional<z.ZodString>;
|
|
114
114
|
summary: z.ZodString;
|
|
115
115
|
}, z.core.$strip>;
|
|
116
|
+
/**
|
|
117
|
+
* Endpoint del servidor opencode de una sesión. Lo emite el plugin al arrancar
|
|
118
|
+
* usando `PluginInput.serverUrl`, para que la Console sepa cómo conectarse a la
|
|
119
|
+
* sesión (terminal/SSE). `url` es solo el origen loopback (`http://host:port`);
|
|
120
|
+
* nunca incluye rutas, query ni credenciales. `directory`/`worktree`/`title` son
|
|
121
|
+
* metadatos no sensibles del workspace.
|
|
122
|
+
*/
|
|
123
|
+
export declare const SessionEndpointEventSchema: z.ZodObject<{
|
|
124
|
+
v: z.ZodLiteral<1>;
|
|
125
|
+
ts: z.ZodNumber;
|
|
126
|
+
sessionID: z.ZodString;
|
|
127
|
+
type: z.ZodLiteral<"session-endpoint">;
|
|
128
|
+
url: z.ZodString;
|
|
129
|
+
directory: z.ZodOptional<z.ZodString>;
|
|
130
|
+
worktree: z.ZodOptional<z.ZodString>;
|
|
131
|
+
title: z.ZodOptional<z.ZodString>;
|
|
132
|
+
}, z.core.$strip>;
|
|
116
133
|
export declare const OpenTeamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
117
134
|
v: z.ZodLiteral<1>;
|
|
118
135
|
ts: z.ZodNumber;
|
|
@@ -205,6 +222,15 @@ export declare const OpenTeamEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
205
222
|
}>;
|
|
206
223
|
agent: z.ZodOptional<z.ZodString>;
|
|
207
224
|
summary: z.ZodString;
|
|
225
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
226
|
+
v: z.ZodLiteral<1>;
|
|
227
|
+
ts: z.ZodNumber;
|
|
228
|
+
sessionID: z.ZodString;
|
|
229
|
+
type: z.ZodLiteral<"session-endpoint">;
|
|
230
|
+
url: z.ZodString;
|
|
231
|
+
directory: z.ZodOptional<z.ZodString>;
|
|
232
|
+
worktree: z.ZodOptional<z.ZodString>;
|
|
233
|
+
title: z.ZodOptional<z.ZodString>;
|
|
208
234
|
}, z.core.$strip>], "type">;
|
|
209
235
|
export type OpenTeamEvent = z.infer<typeof OpenTeamEventSchema>;
|
|
210
236
|
export type RouteEvent = z.infer<typeof RouteEventSchema>;
|
|
@@ -213,5 +239,6 @@ export type ToolcallEvent = z.infer<typeof ToolcallEventSchema>;
|
|
|
213
239
|
export type MeetingEvent = z.infer<typeof MeetingEventSchema>;
|
|
214
240
|
export type DecisionEvent = z.infer<typeof DecisionEventSchema>;
|
|
215
241
|
export type ActivityEvent = z.infer<typeof ActivityEventSchema>;
|
|
242
|
+
export type SessionEndpointEvent = z.infer<typeof SessionEndpointEventSchema>;
|
|
216
243
|
export type OpenTeamEventType = OpenTeamEvent["type"];
|
|
217
244
|
//# sourceMappingURL=events.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/telemetry/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAA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C;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAQ9B,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAChE,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC1D,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,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;AAChE,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC9E,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
|
+
import type { ConsoleClient } from "../console/opencodeClient";
|
|
3
|
+
import type { PtyClient } from "../console/pty";
|
|
4
|
+
/**
|
|
5
|
+
* Rutas HTTP **impuras** de la vista "Sesión" de la Console (§ Fase 3). Todas
|
|
6
|
+
* exigen el token efímero (§7.4) y solo actúan si `terminalEnabled`. El
|
|
7
|
+
* transporte es SSE (salida) + POST (input/permiso): portable y sin WebSocket
|
|
8
|
+
* (la terminal PTY real llega en Fase 5).
|
|
9
|
+
*/
|
|
10
|
+
export type ConsoleRouteDeps = {
|
|
11
|
+
token: string;
|
|
12
|
+
terminalEnabled: boolean;
|
|
13
|
+
/** Habilita la vista "Terminal" (PTY real, Fase 5). Opt-in. */
|
|
14
|
+
ptyEnabled?: boolean;
|
|
15
|
+
/** Resuelve el origen del servidor opencode de una sesión (o `undefined`). */
|
|
16
|
+
resolveEndpoint: (sessionID: string) => Promise<string | undefined>;
|
|
17
|
+
/** Crea un cliente opencode para un endpoint (inyectable en tests). */
|
|
18
|
+
createClient: (endpoint: string) => ConsoleClient;
|
|
19
|
+
/** Crea un cliente PTY para un endpoint (solo si `ptyEnabled`). */
|
|
20
|
+
createPtyClient?: (endpoint: string) => PtyClient;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Enruta las peticiones de la vista "Sesión". Devuelve `true` si la petición
|
|
24
|
+
* pertenece a `/console/...` (y por tanto ya fue respondida), `false` para que el
|
|
25
|
+
* servidor continúe con sus rutas de solo lectura.
|
|
26
|
+
*/
|
|
27
|
+
export declare function handleConsoleRoute(request: IncomingMessage, response: ServerResponse, url: URL, deps: ConsoleRouteDeps): Promise<boolean>;
|
|
28
|
+
//# sourceMappingURL=console.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../src/web/console.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAM/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGhD;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,OAAO,CAAC;IACzB,+DAA+D;IAC/D,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,8EAA8E;IAC9E,eAAe,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACpE,uEAAuE;IACvE,YAAY,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,aAAa,CAAC;IAClD,mEAAmE;IACnE,eAAe,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,SAAS,CAAC;CACnD,CAAC;AAyNF;;;;GAIG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,eAAe,EACxB,QAAQ,EAAE,cAAc,EACxB,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,gBAAgB,GACrB,OAAO,CAAC,OAAO,CAAC,CA6ClB"}
|
package/dist/web/git.d.ts
CHANGED
package/dist/web/git.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/web/git.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/web/git.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,QAAQ,GACb,MAAM,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAgBvC"}
|
package/dist/web/paths.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Rutas por defecto de las fuentes que alimentan el
|
|
1
|
+
/** Rutas por defecto de las fuentes que alimentan el console. */
|
|
2
2
|
export declare const DEFAULT_BACKLOG_PATH = ".opencode/openteam-backlog.md";
|
|
3
3
|
export declare const DEFAULT_DECISIONS_PATH = ".opencode/openteam-decisions.md";
|
|
4
4
|
//# sourceMappingURL=paths.d.ts.map
|
package/dist/web/paths.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/web/paths.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/web/paths.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,eAAO,MAAM,oBAAoB,kCAAkC,CAAC;AACpE,eAAO,MAAM,sBAAsB,oCAAoC,CAAC"}
|
package/dist/web/server.d.ts
CHANGED
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
import { createServer as createHttpServer } from "node:http";
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import type { ConsoleConfig } from "../config/schema";
|
|
3
|
+
import type { ConsoleClient } from "../console/opencodeClient";
|
|
4
|
+
import type { PtyClient } from "../console/pty";
|
|
5
|
+
import type { ConsoleInputs } from "../console/state";
|
|
6
|
+
export type ConsoleServerDeps = {
|
|
7
|
+
/** Relee las fuentes y produce los inputs crudos del console. */
|
|
8
|
+
readSnapshot: () => Promise<ConsoleInputs>;
|
|
9
|
+
config: ConsoleConfig;
|
|
8
10
|
/** Inyectable para tests; por defecto el `createServer` de `node:http`. */
|
|
9
11
|
createServer?: typeof createHttpServer;
|
|
10
12
|
/** Logger (por defecto `console`). */
|
|
11
13
|
log?: (message: string) => void;
|
|
14
|
+
/** Vista "Sesión": token efímero + factoría de cliente opencode. Opcional. */
|
|
15
|
+
console?: {
|
|
16
|
+
token: string;
|
|
17
|
+
terminalEnabled: boolean;
|
|
18
|
+
/** Habilita la vista "Terminal" (PTY real, Fase 5). Opt-in. */
|
|
19
|
+
ptyEnabled?: boolean;
|
|
20
|
+
createClient: (endpoint: string) => ConsoleClient;
|
|
21
|
+
createPtyClient?: (endpoint: string) => PtyClient;
|
|
22
|
+
};
|
|
12
23
|
};
|
|
13
|
-
export type
|
|
24
|
+
export type ConsoleServer = {
|
|
14
25
|
url: string;
|
|
15
26
|
port: number;
|
|
16
27
|
/** Reevalúa el estado y lo empuja a los clientes SSE conectados. */
|
|
@@ -18,10 +29,10 @@ export type DashboardServer = {
|
|
|
18
29
|
close: () => void;
|
|
19
30
|
};
|
|
20
31
|
/**
|
|
21
|
-
* Arranca el servidor del
|
|
32
|
+
* Arranca el servidor del console con `node:http` (portable a Node y Bun) en
|
|
22
33
|
* loopback. Sirve `/` (HTML), `/api/state` (JSON), `/events` (SSE) y `/healthz`.
|
|
23
34
|
* Solo lectura: cualquier método ≠ GET → 405; ruta desconocida → 404. Con
|
|
24
35
|
* `autoPortFallback` prueba puertos sucesivos si el preferido está ocupado.
|
|
25
36
|
*/
|
|
26
|
-
export declare function
|
|
37
|
+
export declare function createConsoleServer(deps: ConsoleServerDeps): Promise<ConsoleServer>;
|
|
27
38
|
//# sourceMappingURL=server.d.ts.map
|
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;
|
|
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;AAatD,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;CACH,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,CA4HxB"}
|
package/dist/web/snapshot.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AgentFile } from "../commands/agents";
|
|
2
|
-
import type {
|
|
3
|
-
import type { CommitView } from "../
|
|
4
|
-
/** Dependencias de I/O que el driver inyecta para leer las fuentes del
|
|
2
|
+
import type { ConsoleInputs } from "../console/state";
|
|
3
|
+
import type { CommitView } from "../console/types";
|
|
4
|
+
/** Dependencias de I/O que el driver inyecta para leer las fuentes del console. */
|
|
5
5
|
export type SnapshotDeps = {
|
|
6
6
|
/** Lee un fichero de texto; devuelve `undefined` si no existe (ENOENT). */
|
|
7
7
|
readText: (path: string) => Promise<string | undefined>;
|
|
@@ -33,8 +33,8 @@ export type SnapshotContext = {
|
|
|
33
33
|
};
|
|
34
34
|
/**
|
|
35
35
|
* Crea un lector de snapshot: cada llamada relee las fuentes en disco (todos los
|
|
36
|
-
* logs de sesión + decisiones + backlog + agentes) y devuelve los `
|
|
37
|
-
* crudos que `
|
|
36
|
+
* logs de sesión + decisiones + backlog + agentes) y devuelve los `ConsoleInputs`
|
|
37
|
+
* crudos que `buildConsoleState` (puro) compondrá agregando las sesiones.
|
|
38
38
|
*/
|
|
39
|
-
export declare function createSnapshotReader(deps: SnapshotDeps, paths: SnapshotPaths, context?: SnapshotContext): () => Promise<
|
|
39
|
+
export declare function createSnapshotReader(deps: SnapshotDeps, paths: SnapshotPaths, context?: SnapshotContext): () => Promise<ConsoleInputs>;
|
|
40
40
|
//# sourceMappingURL=snapshot.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../src/web/snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAa,MAAM,oBAAoB,CAAC;AAG/D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../src/web/snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAa,MAAM,oBAAoB,CAAC;AAG/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAQnD,mFAAmF;AACnF,MAAM,MAAM,YAAY,GAAG;IACzB,2EAA2E;IAC3E,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACxD,wEAAwE;IACxE,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9C,sDAAsD;IACtD,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC;IACtD,4CAA4C;IAC5C,GAAG,EAAE,MAAM,MAAM,CAAC;IAClB,qCAAqC;IACrC,aAAa,CAAC,EAAE,MAAM,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;CACvD,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,yDAAyD;IACzD,WAAW,EAAE,MAAM,CAAC;IACpB,mDAAmD;IACnD,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,kFAAkF;IAClF,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,OAAO,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC9C,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,YAAY,EAClB,KAAK,EAAE,aAAa,EACpB,OAAO,GAAE,eAAoB,GAC5B,MAAM,OAAO,CAAC,aAAa,CAAC,CAiD9B"}
|
package/dist/web/start.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { watch as fsWatch } from "node:fs";
|
|
2
2
|
import type { AgentFile } from "../commands/agents";
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import type { ConsoleConfig } from "../config/schema";
|
|
4
|
+
import type { ConsoleClient } from "../console/opencodeClient";
|
|
5
|
+
import type { PtyClient } from "../console/pty";
|
|
6
|
+
import type { CommitView } from "../console/types";
|
|
7
|
+
export type ConsoleRuntimeDeps = {
|
|
8
|
+
config: ConsoleConfig;
|
|
7
9
|
/** Directorio de logs de sesión (`sessions/*.jsonl`). */
|
|
8
10
|
sessionsDir: string;
|
|
9
11
|
agentDir: string;
|
|
@@ -20,20 +22,28 @@ export type DashboardRuntimeDeps = {
|
|
|
20
22
|
id?: string;
|
|
21
23
|
startedAt?: string;
|
|
22
24
|
};
|
|
25
|
+
/** Vista "Sesión": token + factoría de cliente opencode. Opcional. */
|
|
26
|
+
console?: {
|
|
27
|
+
token: string;
|
|
28
|
+
terminalEnabled: boolean;
|
|
29
|
+
ptyEnabled?: boolean;
|
|
30
|
+
createClient: (endpoint: string) => ConsoleClient;
|
|
31
|
+
createPtyClient?: (endpoint: string) => PtyClient;
|
|
32
|
+
};
|
|
23
33
|
/** Inyectables para tests. */
|
|
24
|
-
serve?: typeof import("./server").
|
|
34
|
+
serve?: typeof import("./server").createConsoleServer;
|
|
25
35
|
watch?: (path: string, listener: () => void) => ReturnType<typeof fsWatch>;
|
|
26
36
|
log?: (message: string) => void;
|
|
27
37
|
};
|
|
28
|
-
export type
|
|
38
|
+
export type ConsoleRuntime = {
|
|
29
39
|
url: string;
|
|
30
40
|
port: number;
|
|
31
41
|
close: () => void;
|
|
32
42
|
};
|
|
33
43
|
/**
|
|
34
|
-
* Compone el runtime del
|
|
35
|
-
* `node:http` + watcher de ficheros. Lo arranca la CLI (`openteam
|
|
44
|
+
* Compone el runtime del console: lector de snapshot multi-sesión + servidor
|
|
45
|
+
* `node:http` + watcher de ficheros. Lo arranca la CLI (`openteam console`) y
|
|
36
46
|
* agrega **todas** las sesiones de opencode que escriben en `sessionsDir`.
|
|
37
47
|
*/
|
|
38
|
-
export declare function
|
|
48
|
+
export declare function startConsole(deps: ConsoleRuntimeDeps): Promise<ConsoleRuntime>;
|
|
39
49
|
//# sourceMappingURL=start.d.ts.map
|