@jmanuelcorral/openteam 0.1.32 → 0.1.34

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 CHANGED
@@ -496,6 +496,29 @@ openteam tunnel --allow-anonymous --yes # túnel anónimo (requiere doble confi
496
496
  > Instala devtunnel con `winget install Microsoft.devtunnel` e inicia sesión con
497
497
  > `devtunnel user login`.
498
498
 
499
+ ### Memoria del equipo por MCP (solo lectura): `openteam mcp`
500
+
501
+ `openteam mcp` arranca un **servidor MCP de solo lectura** (JSON-RPC 2.0 sobre
502
+ stdio, sin dependencias) que expone la memoria del equipo agregada desde los
503
+ eventos por sesión para que agentes/herramientas la consulten. Se apoya en el
504
+ mismo `StorageProvider` que la Console y **nunca** expone prompts crudos, solo el
505
+ estado ya redactado. Tools disponibles: `list_decisions` (filtrable por
506
+ `agent`/`tag`), `list_meetings`, `list_sessions` y `cost_summary` (coste/tokens
507
+ reales + ahorro estimado vs baseline all-frontier).
508
+
509
+ Regístralo en `opencode.json` como cualquier MCP server local:
510
+
511
+ ```json
512
+ {
513
+ "mcp": {
514
+ "openteam-memory": {
515
+ "type": "local",
516
+ "command": ["openteam", "mcp"]
517
+ }
518
+ }
519
+ }
520
+ ```
521
+
499
522
 
500
523
 
501
524
  ### Ollama
package/dist/cli.js CHANGED
@@ -4184,6 +4184,7 @@ var HELP = [
4184
4184
  " openteam console Lanza la Console web multi-sesión (Ctrl+C para parar; --open abre el navegador)",
4185
4185
  " openteam console --status Muestra la config de la Console sin lanzarla",
4186
4186
  " openteam tunnel Expone la Console vía Dev Tunnels (--terminal expone opencode; Ctrl+C para cerrar)",
4187
+ " openteam mcp Servidor MCP de solo lectura (memoria del equipo) sobre stdio",
4187
4188
  " openteam report Resumen de coste/ahorro (telemetría)",
4188
4189
  " openteam yolo status Muestra si el modo YOLO está activo",
4189
4190
  " openteam yolo on Activa YOLO (opencode auto-aprueba todo)",
@@ -4944,6 +4945,220 @@ function loadOpenTeamConfig(raw) {
4944
4945
  return OpenTeamConfigSchema.parse(raw ?? {});
4945
4946
  }
4946
4947
 
4948
+ // src/mcp/teamMemory.ts
4949
+ function buildTeamMemory(events) {
4950
+ const aggregate = aggregateEvents(events);
4951
+ return {
4952
+ sessions: aggregate.sessions,
4953
+ totals: aggregate.totals,
4954
+ decisions: aggregate.decisions,
4955
+ meetings: aggregate.meetings
4956
+ };
4957
+ }
4958
+ function applyLimit(list, limit) {
4959
+ if (limit === undefined || limit <= 0) {
4960
+ return [...list];
4961
+ }
4962
+ return list.slice(0, limit);
4963
+ }
4964
+ function queryDecisions(memory, query = {}) {
4965
+ const filtered = memory.decisions.filter((decision) => {
4966
+ if (query.agent !== undefined && decision.agent !== query.agent) {
4967
+ return false;
4968
+ }
4969
+ if (query.tag !== undefined && !(decision.tags ?? []).includes(query.tag)) {
4970
+ return false;
4971
+ }
4972
+ return true;
4973
+ });
4974
+ return applyLimit(filtered, query.limit);
4975
+ }
4976
+ function queryMeetings(memory, query = {}) {
4977
+ return applyLimit(memory.meetings, query.limit);
4978
+ }
4979
+ function querySessions(memory, query = {}) {
4980
+ return applyLimit(memory.sessions, query.limit);
4981
+ }
4982
+ function costSummary(memory) {
4983
+ const { totals } = memory;
4984
+ return {
4985
+ sessions: totals.sessions,
4986
+ messageCount: totals.messageCount,
4987
+ realCostUSD: totals.realCostUSD,
4988
+ estimatedCostUSD: totals.estimatedCostUSD,
4989
+ estimatedSavingsUSD: totals.estimatedSavingsUSD,
4990
+ tokensIn: totals.tokensIn,
4991
+ tokensOut: totals.tokensOut
4992
+ };
4993
+ }
4994
+
4995
+ // src/mcp/server.ts
4996
+ var MCP_PROTOCOL_VERSION = "2024-11-05";
4997
+ var DEFAULT_SERVER_INFO = {
4998
+ name: "openteam-memory",
4999
+ version: "1"
5000
+ };
5001
+ var LIMIT_PROP = {
5002
+ limit: {
5003
+ type: "integer",
5004
+ minimum: 1,
5005
+ description: "Máximo de elementos a devolver."
5006
+ }
5007
+ };
5008
+ var MCP_TOOLS = [
5009
+ {
5010
+ name: "list_decisions",
5011
+ description: "Decisiones/aprendizajes del equipo (redactadas), más recientes primero. Filtra por agente y/o etiqueta.",
5012
+ inputSchema: {
5013
+ type: "object",
5014
+ properties: {
5015
+ agent: { type: "string", description: "Filtra por agente." },
5016
+ tag: { type: "string", description: "Filtra por etiqueta." },
5017
+ ...LIMIT_PROP
5018
+ }
5019
+ }
5020
+ },
5021
+ {
5022
+ name: "list_meetings",
5023
+ description: "Reuniones (batches multi-agente del orquestador), más recientes primero.",
5024
+ inputSchema: { type: "object", properties: { ...LIMIT_PROP } }
5025
+ },
5026
+ {
5027
+ name: "list_sessions",
5028
+ description: "Resúmenes de sesión (coste/tokens reales, modelos, toolcalls), más activas primero.",
5029
+ inputSchema: { type: "object", properties: { ...LIMIT_PROP } }
5030
+ },
5031
+ {
5032
+ name: "cost_summary",
5033
+ description: "Resumen de coste/tokens del equipo, con ahorro estimado frente al baseline all-frontier.",
5034
+ inputSchema: { type: "object", properties: {} }
5035
+ }
5036
+ ];
5037
+ function response(id, result) {
5038
+ return { jsonrpc: "2.0", id, result };
5039
+ }
5040
+ function errorResponse(id, code, message) {
5041
+ return { jsonrpc: "2.0", id, error: { code, message } };
5042
+ }
5043
+ function textContent(data) {
5044
+ return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
5045
+ }
5046
+ function optionalString(value) {
5047
+ return typeof value === "string" && value.length > 0 ? value : undefined;
5048
+ }
5049
+ function optionalLimit(value) {
5050
+ return typeof value === "number" && Number.isFinite(value) ? value : undefined;
5051
+ }
5052
+ async function callTool(name, args, deps) {
5053
+ const memory = await deps.readMemory();
5054
+ switch (name) {
5055
+ case "list_decisions": {
5056
+ const query = {};
5057
+ const agent = optionalString(args.agent);
5058
+ const tag = optionalString(args.tag);
5059
+ const limit = optionalLimit(args.limit);
5060
+ if (agent !== undefined) {
5061
+ query.agent = agent;
5062
+ }
5063
+ if (tag !== undefined) {
5064
+ query.tag = tag;
5065
+ }
5066
+ if (limit !== undefined) {
5067
+ query.limit = limit;
5068
+ }
5069
+ return textContent(queryDecisions(memory, query));
5070
+ }
5071
+ case "list_meetings":
5072
+ return textContent(queryMeetings(memory, { limit: optionalLimit(args.limit) ?? 0 }));
5073
+ case "list_sessions":
5074
+ return textContent(querySessions(memory, { limit: optionalLimit(args.limit) ?? 0 }));
5075
+ case "cost_summary":
5076
+ return textContent(costSummary(memory));
5077
+ default:
5078
+ return;
5079
+ }
5080
+ }
5081
+ async function handleMcpMessage(message, deps) {
5082
+ const isNotification = message.id === undefined;
5083
+ const id = message.id ?? null;
5084
+ const serverInfo = deps.serverInfo ?? DEFAULT_SERVER_INFO;
5085
+ switch (message.method) {
5086
+ case "initialize":
5087
+ return response(id, {
5088
+ protocolVersion: MCP_PROTOCOL_VERSION,
5089
+ capabilities: { tools: {} },
5090
+ serverInfo
5091
+ });
5092
+ case "tools/list":
5093
+ return response(id, { tools: MCP_TOOLS });
5094
+ case "tools/call": {
5095
+ const params = message.params ?? {};
5096
+ const name = optionalString(params.name);
5097
+ if (name === undefined) {
5098
+ return errorResponse(id, -32602, "tools/call requiere 'name'");
5099
+ }
5100
+ const args = typeof params.arguments === "object" && params.arguments !== null ? params.arguments : {};
5101
+ const result = await callTool(name, args, deps);
5102
+ if (result === undefined) {
5103
+ return errorResponse(id, -32602, `tool desconocida: ${name}`);
5104
+ }
5105
+ return response(id, result);
5106
+ }
5107
+ default:
5108
+ if (isNotification) {
5109
+ return null;
5110
+ }
5111
+ return errorResponse(id, -32601, `método no soportado: ${message.method}`);
5112
+ }
5113
+ }
5114
+
5115
+ // src/mcp/stdio.ts
5116
+ function parseErrorResponse() {
5117
+ return JSON.stringify({
5118
+ jsonrpc: "2.0",
5119
+ id: null,
5120
+ error: { code: -32700, message: "JSON inválido" }
5121
+ });
5122
+ }
5123
+ async function runMcpStdio(deps, io) {
5124
+ for await (const rawLine of io.lines) {
5125
+ const line = rawLine.trim();
5126
+ if (line.length === 0) {
5127
+ continue;
5128
+ }
5129
+ let message;
5130
+ try {
5131
+ message = JSON.parse(line);
5132
+ } catch {
5133
+ io.write(`${parseErrorResponse()}
5134
+ `);
5135
+ continue;
5136
+ }
5137
+ const reply = await handleMcpMessage(message, deps);
5138
+ if (reply !== null) {
5139
+ io.write(`${JSON.stringify(reply)}
5140
+ `);
5141
+ }
5142
+ }
5143
+ }
5144
+ async function* linesFromReadable(readable) {
5145
+ let buffer = "";
5146
+ for await (const chunk of readable) {
5147
+ buffer += typeof chunk === "string" ? chunk : chunk.toString("utf8");
5148
+ let newlineIndex = buffer.indexOf(`
5149
+ `);
5150
+ while (newlineIndex >= 0) {
5151
+ yield buffer.slice(0, newlineIndex);
5152
+ buffer = buffer.slice(newlineIndex + 1);
5153
+ newlineIndex = buffer.indexOf(`
5154
+ `);
5155
+ }
5156
+ }
5157
+ if (buffer.length > 0) {
5158
+ yield buffer;
5159
+ }
5160
+ }
5161
+
4947
5162
  // src/web/git.ts
4948
5163
  function createGitLastCommit(exec) {
4949
5164
  return async () => {
@@ -5110,6 +5325,18 @@ async function main() {
5110
5325
  process.exitCode = result2.exitCode;
5111
5326
  return;
5112
5327
  }
5328
+ if (argv[0] === "mcp") {
5329
+ await runMcpStdio({
5330
+ readMemory: async () => buildTeamMemory(await readSessionEvents(DEFAULT_SESSIONS_DIR, {
5331
+ storage,
5332
+ legacyTelemetryPath: DEFAULT_TELEMETRY_PATH
5333
+ }))
5334
+ }, {
5335
+ lines: linesFromReadable(process.stdin),
5336
+ write: (line) => process.stdout.write(line)
5337
+ });
5338
+ return;
5339
+ }
5113
5340
  const result = await runCli(argv, deps);
5114
5341
  process.stdout.write(`${result.stdout}
5115
5342
  `);
@@ -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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AS,EAAE,CAAC,CAAC;IACtD,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AA2NF,wBAAsB,MAAM,CAC1B,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,IAAI,EAAE,OAAO,GACZ,OAAO,CAAC,SAAS,CAAC,CA+DpB"}
package/dist/index.js CHANGED
@@ -1505,6 +1505,7 @@ var HELP = [
1505
1505
  " openteam console Lanza la Console web multi-sesión (Ctrl+C para parar; --open abre el navegador)",
1506
1506
  " openteam console --status Muestra la config de la Console sin lanzarla",
1507
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",
1508
1509
  " openteam report Resumen de coste/ahorro (telemetría)",
1509
1510
  " openteam yolo status Muestra si el modo YOLO está activo",
1510
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,qBAAqB,CAAC;AAEzD;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,MAAM,EAAE,WAAW,CAAC;IACpB,SAAS,EAAE,YAAY,EAAE,CAAC;IAC1B,QAAQ,EAAE,WAAW,EAAE,CAAC;CACzB,CAAC;AAEF,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,GAAG,UAAU,CAQ5E;AASD,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,8EAA8E;AAC9E,wBAAgB,cAAc,CAC5B,MAAM,EAAE,UAAU,EAClB,KAAK,GAAE,aAAkB,GACxB,YAAY,EAAE,CAWhB;AAED,+DAA+D;AAC/D,wBAAgB,aAAa,CAC3B,MAAM,EAAE,UAAU,EAClB,KAAK,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GAC7B,WAAW,EAAE,CAEf;AAED,iDAAiD;AACjD,wBAAgB,aAAa,CAC3B,MAAM,EAAE,UAAU,EAClB,KAAK,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GAC7B,cAAc,EAAE,CAElB;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,iFAAiF;AACjF,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,WAAW,CAW3D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jmanuelcorral/openteam",
3
- "version": "0.1.32",
3
+ "version": "0.1.34",
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",