@bike4mind/cli 0.2.81 → 0.2.82

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.
@@ -22,6 +22,9 @@ max-iterations:
22
22
  medium: 10
23
23
  very_thorough: 20
24
24
  default-thoroughness: medium
25
+ shared-context:
26
+ - read
27
+ - write
25
28
  ---
26
29
 
27
30
  You are a code exploration specialist. Your job is to search and analyze codebases efficiently.
@@ -5,6 +5,9 @@ max-iterations:
5
5
  medium: 16
6
6
  very_thorough: 30
7
7
  default-thoroughness: medium
8
+ shared-context:
9
+ - read
10
+ - write
8
11
  ---
9
12
 
10
13
  You are a general-purpose agent. Your job is to accomplish the given task using whatever tools are available to you.
@@ -19,6 +19,9 @@ max-iterations:
19
19
  medium: 14
20
20
  very_thorough: 24
21
21
  default-thoroughness: medium
22
+ shared-context:
23
+ - read
24
+ - write
22
25
  ---
23
26
 
24
27
  You are a task planning specialist. Your job is to break down complex tasks into clear, actionable steps.
@@ -18,6 +18,8 @@ max-iterations:
18
18
  medium: 16
19
19
  very_thorough: 30
20
20
  default-thoroughness: medium
21
+ shared-context:
22
+ - read
21
23
  ---
22
24
 
23
25
  You are a code review specialist. Your job is to analyze code quality and identify issues.
@@ -21,6 +21,8 @@ max-iterations:
21
21
  medium: 10
22
22
  very_thorough: 16
23
23
  default-thoroughness: medium
24
+ shared-context:
25
+ - read
24
26
  ---
25
27
 
26
28
  You are a test execution and analysis specialist. Your job is to run tests, analyze results, and identify failures.
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { i as version, n as fetchLatestVersion, r as forceCheckForUpdate } from "../updateChecker-ChPS3GEC.mjs";
2
+ import { i as version, n as fetchLatestVersion, r as forceCheckForUpdate } from "../updateChecker-CPr5OfMn.mjs";
3
3
  import { execSync } from "child_process";
4
4
  import { constants, existsSync, promises } from "fs";
5
5
  import { homedir } from "os";
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { B as ReActAgent, C as loadContextFiles, D as generateCliTools, E as PermissionManager, F as setWebSocketToolExecutor, H as CheckpointStore, L as buildCoreSystemPrompt, V as CustomCommandStore, W as SessionStore, _ as WebSocketLlmBackend, a as createCoordinateTaskTool, c as createAgentDelegateTool, d as createSkillTool, g as FallbackLlmBackend, h as WebSocketConnectionManager, i as createWriteTodosTool, l as AgentStore, m as WebSocketToolExecutor, n as createFindDefinitionTool, o as createBackgroundAgentTools, p as ApiClient, r as createTodoStore, s as BackgroundAgentManager, t as createGetFileStructureTool, u as SubagentOrchestrator, v as ServerLlmBackend, w as getApiUrl, y as McpManager, z as isReadOnlyTool } from "../tools-zV2_TeFM.mjs";
2
+ import { B as ReActAgent, C as loadContextFiles, D as generateCliTools, E as PermissionManager, F as setWebSocketToolExecutor, H as CheckpointStore, L as buildCoreSystemPrompt, V as CustomCommandStore, W as SessionStore, _ as WebSocketLlmBackend, a as createCoordinateTaskTool, c as createAgentDelegateTool, d as createSkillTool, g as FallbackLlmBackend, h as WebSocketConnectionManager, i as createWriteTodosTool, l as AgentStore, m as WebSocketToolExecutor, n as createFindDefinitionTool, o as createBackgroundAgentTools, p as ApiClient, r as createTodoStore, s as BackgroundAgentManager, t as createGetFileStructureTool, u as SubagentOrchestrator, v as ServerLlmBackend, w as getApiUrl, y as McpManager, z as isReadOnlyTool } from "../tools-C0eJHV0Y.mjs";
3
3
  import { n as logger, t as ConfigStore } from "../ConfigStore-DTyUBb3A.mjs";
4
4
  import { t as DEFAULT_SANDBOX_CONFIG } from "../types-DBEjF9YS.mjs";
5
5
  import { t as createSandboxRuntime } from "../SandboxRuntimeAdapter-C1B4t20N.mjs";
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { i as version, r as forceCheckForUpdate } from "../updateChecker-ChPS3GEC.mjs";
2
+ import { i as version, r as forceCheckForUpdate } from "../updateChecker-CPr5OfMn.mjs";
3
3
  import { execSync } from "child_process";
4
4
  //#region src/commands/updateCommand.ts
5
5
  /**
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import { n as useCliStore, t as selectActiveBackgroundAgents } from "./store-Dw1nZX2Y.mjs";
3
- import { A as DEFAULT_MAX_ITERATIONS, B as ReActAgent, C as loadContextFiles, D as generateCliTools, E as PermissionManager, F as setWebSocketToolExecutor, G as OAuthClient, H as CheckpointStore, I as OllamaBackend, J as searchCommands, K as hasFileReferences, L as buildCoreSystemPrompt, M as DEFAULT_THOROUGHNESS, N as clearFeatureModuleTools, O as ALWAYS_DENIED_FOR_AGENTS, P as registerFeatureModuleTools, Q as warmFileCache, R as buildSkillsPromptSection, S as extractCompactInstructions, T as getEnvironmentName, U as CommandHistoryStore, V as CustomCommandStore, W as SessionStore, X as formatFileSize, Y as mergeCommands, Z as searchFiles, _ as WebSocketLlmBackend, a as createCoordinateTaskTool, b as substituteArguments, c as createAgentDelegateTool, d as createSkillTool, f as parseAgentConfig, g as FallbackLlmBackend, h as WebSocketConnectionManager, i as createWriteTodosTool, j as DEFAULT_RETRY_CONFIG, k as DEFAULT_AGENT_MODEL, l as AgentStore, m as WebSocketToolExecutor, n as createFindDefinitionTool, o as createBackgroundAgentTools, p as ApiClient, q as processFileReferences, r as createTodoStore, s as BackgroundAgentManager, t as createGetFileStructureTool, u as SubagentOrchestrator, v as ServerLlmBackend, w as getApiUrl, x as formatStep, y as McpManager, z as isReadOnlyTool } from "./tools-zV2_TeFM.mjs";
3
+ import { A as DEFAULT_MAX_ITERATIONS, B as ReActAgent, C as loadContextFiles, D as generateCliTools, E as PermissionManager, F as setWebSocketToolExecutor, G as OAuthClient, H as CheckpointStore, I as OllamaBackend, J as searchCommands, K as hasFileReferences, L as buildCoreSystemPrompt, M as DEFAULT_THOROUGHNESS, N as clearFeatureModuleTools, O as ALWAYS_DENIED_FOR_AGENTS, P as registerFeatureModuleTools, Q as warmFileCache, R as buildSkillsPromptSection, S as extractCompactInstructions, T as getEnvironmentName, U as CommandHistoryStore, V as CustomCommandStore, W as SessionStore, X as formatFileSize, Y as mergeCommands, Z as searchFiles, _ as WebSocketLlmBackend, a as createCoordinateTaskTool, b as substituteArguments, c as createAgentDelegateTool, d as createSkillTool, f as parseAgentConfig, g as FallbackLlmBackend, h as WebSocketConnectionManager, i as createWriteTodosTool, j as DEFAULT_RETRY_CONFIG, k as DEFAULT_AGENT_MODEL, l as AgentStore, m as WebSocketToolExecutor, n as createFindDefinitionTool, o as createBackgroundAgentTools, p as ApiClient, q as processFileReferences, r as createTodoStore, s as BackgroundAgentManager, t as createGetFileStructureTool, u as SubagentOrchestrator, v as ServerLlmBackend, w as getApiUrl, x as formatStep, y as McpManager, z as isReadOnlyTool } from "./tools-C0eJHV0Y.mjs";
4
4
  import { Dt as validateJupyterKernelName, Ot as validateNotebookPath$1, g as ChatModels, m as CREDIT_DEDUCT_TRANSACTION_TYPES, n as logger, t as ConfigStore } from "./ConfigStore-DTyUBb3A.mjs";
5
- import { i as version, t as checkForUpdate } from "./updateChecker-ChPS3GEC.mjs";
5
+ import { i as version, t as checkForUpdate } from "./updateChecker-CPr5OfMn.mjs";
6
6
  import React, { useCallback, useEffect, useMemo, useReducer, useRef, useState } from "react";
7
7
  import { Box, Static, Text, render, useApp, useInput } from "ink";
8
8
  import { execSync } from "child_process";
@@ -18126,7 +18126,8 @@ const AgentFrontmatterSchema = z.object({
18126
18126
  retry: z.object({
18127
18127
  maxRetries: z.int().nonnegative().optional(),
18128
18128
  initialDelay: z.number().positive().optional()
18129
- }).optional()
18129
+ }).optional(),
18130
+ "shared-context": z.array(z.enum(["read", "write"])).optional()
18130
18131
  });
18131
18132
  /**
18132
18133
  * Default iteration limits for agents
@@ -20812,6 +20813,10 @@ var SubagentOrchestrator = class {
20812
20813
  const skillsSection = buildSkillsPromptSection(this.deps.customCommandStore.getAllCommands(), agentDef.skills);
20813
20814
  if (skillsSection) systemPrompt += skillsSection;
20814
20815
  }
20816
+ if (options.sharedContext && agentDef.sharedContext?.length) {
20817
+ const sharedContextTools = this.buildSharedContextTools(options.sharedContext, agentDef.sharedContext, agentName);
20818
+ filteredTools.push(...sharedContextTools);
20819
+ }
20815
20820
  const hookWrapperContext = {
20816
20821
  sessionId: parentSessionId,
20817
20822
  agentName,
@@ -20891,6 +20896,92 @@ var SubagentOrchestrator = class {
20891
20896
  };
20892
20897
  }
20893
20898
  /**
20899
+ * Build shared context tools based on agent's declared access permissions.
20900
+ */
20901
+ buildSharedContextTools(sharedContext, access, agentName) {
20902
+ const tools = [];
20903
+ const canRead = access.includes("read");
20904
+ const canWrite = access.includes("write");
20905
+ if (canRead) {
20906
+ const ReadArgsSchema = z.object({
20907
+ namespace: z.string().min(1),
20908
+ key: z.string().optional()
20909
+ });
20910
+ tools.push({
20911
+ toolFn: async (args) => {
20912
+ const { namespace, key } = ReadArgsSchema.parse(args);
20913
+ if (key) {
20914
+ const value = sharedContext.get(namespace, key);
20915
+ return value !== void 0 ? `Value for "${key}" in namespace "${namespace}": ${value}` : `No entry found for "${key}" in namespace "${namespace}"`;
20916
+ }
20917
+ const all = sharedContext.getAll(namespace);
20918
+ const entries = Object.entries(all);
20919
+ if (entries.length === 0) return `Namespace "${namespace}" is empty or does not exist.`;
20920
+ return entries.map(([k, v]) => `- ${k}: ${v}`).join("\n");
20921
+ },
20922
+ toolSchema: {
20923
+ name: "shared_context_read",
20924
+ description: "Read entries from the shared agent context. Use this to access findings from other agents in the pipeline.",
20925
+ parameters: {
20926
+ type: "object",
20927
+ properties: {
20928
+ namespace: {
20929
+ type: "string",
20930
+ description: "Namespace to read from"
20931
+ },
20932
+ key: {
20933
+ type: "string",
20934
+ description: "Specific key to read (omit to list all entries in namespace)"
20935
+ }
20936
+ },
20937
+ required: ["namespace"]
20938
+ }
20939
+ }
20940
+ });
20941
+ }
20942
+ if (canWrite) {
20943
+ const WriteArgsSchema = z.object({
20944
+ namespace: z.string().min(1),
20945
+ key: z.string().min(1),
20946
+ value: z.string()
20947
+ });
20948
+ tools.push({
20949
+ toolFn: async (args) => {
20950
+ const { namespace, key, value } = WriteArgsSchema.parse(args);
20951
+ sharedContext.set(namespace, key, value, agentName);
20952
+ return `Stored "${key}" in namespace "${namespace}"`;
20953
+ },
20954
+ toolSchema: {
20955
+ name: "shared_context_write",
20956
+ description: "Write an entry to the shared agent context. Use this to share findings (file paths, insights, data) with other agents in the pipeline.",
20957
+ parameters: {
20958
+ type: "object",
20959
+ properties: {
20960
+ namespace: {
20961
+ type: "string",
20962
+ description: "Namespace to write to"
20963
+ },
20964
+ key: {
20965
+ type: "string",
20966
+ description: "Key to store the value under"
20967
+ },
20968
+ value: {
20969
+ type: "string",
20970
+ description: "Value to store (max 2000 chars)"
20971
+ }
20972
+ },
20973
+ required: [
20974
+ "namespace",
20975
+ "key",
20976
+ "value"
20977
+ ]
20978
+ }
20979
+ }
20980
+ });
20981
+ }
20982
+ return tools;
20983
+ }
20984
+ /**
20894
20985
  * Substitute variables in system prompt
20895
20986
  * Reserved: $TASK, $MAX_ITERATIONS, $THOROUGHNESS
20896
20987
  */
@@ -21195,7 +21286,8 @@ var AgentStore = class {
21195
21286
  retry: {
21196
21287
  maxRetries: parsed.retry?.maxRetries ?? DEFAULT_RETRY_CONFIG.maxRetries,
21197
21288
  initialDelayMs: parsed.retry?.initialDelay ?? DEFAULT_RETRY_CONFIG.initialDelayMs
21198
- }
21289
+ },
21290
+ sharedContext: parsed["shared-context"]
21199
21291
  };
21200
21292
  }
21201
21293
  /**
@@ -21539,6 +21631,30 @@ var BackgroundAgentManager = class {
21539
21631
  return id;
21540
21632
  }
21541
21633
  /**
21634
+ * Spawn an agent and return both the job ID and a result promise.
21635
+ *
21636
+ * The promise resolves when the job completes successfully, or rejects
21637
+ * if the job fails or is cancelled. Existing fire-and-forget workflows
21638
+ * can continue using spawn() — this adds explicit await-based coordination.
21639
+ */
21640
+ spawnWithFuture(options) {
21641
+ let capturedJobId = "";
21642
+ const result = new Promise((resolve, reject) => {
21643
+ capturedJobId = this.spawn(options);
21644
+ const internal = this.jobs.get(capturedJobId);
21645
+ if (!internal) {
21646
+ reject(/* @__PURE__ */ new Error("Failed to create job"));
21647
+ return;
21648
+ }
21649
+ internal.futureResolve = resolve;
21650
+ internal.futureReject = reject;
21651
+ });
21652
+ return {
21653
+ jobId: capturedJobId,
21654
+ result
21655
+ };
21656
+ }
21657
+ /**
21542
21658
  * Get a job by ID (public-facing snapshot without internals)
21543
21659
  */
21544
21660
  getJob(id) {
@@ -21568,6 +21684,7 @@ var BackgroundAgentManager = class {
21568
21684
  status: "cancelled",
21569
21685
  endTime: Date.now()
21570
21686
  });
21687
+ internal.futureReject?.(/* @__PURE__ */ new Error("Job was cancelled"));
21571
21688
  return true;
21572
21689
  }
21573
21690
  if (internal.job.status === "running") {
@@ -21576,6 +21693,7 @@ var BackgroundAgentManager = class {
21576
21693
  status: "cancelled",
21577
21694
  endTime: Date.now()
21578
21695
  });
21696
+ internal.futureReject?.(/* @__PURE__ */ new Error("Job was cancelled"));
21579
21697
  this.runningCount--;
21580
21698
  this.processQueue();
21581
21699
  return true;
@@ -21652,12 +21770,14 @@ var BackgroundAgentManager = class {
21652
21770
  ...options,
21653
21771
  abortSignal: internal.abortController.signal
21654
21772
  }).then((result) => {
21773
+ if (internal.abortController.signal.aborted) return;
21655
21774
  this.updateJob(job.id, {
21656
21775
  status: "completed",
21657
21776
  endTime: Date.now(),
21658
21777
  resultSummary: result.summary
21659
21778
  });
21660
21779
  internal.result = result;
21780
+ internal.futureResolve?.(result);
21661
21781
  this.handleJobCompletion(job, "completed", result.summary);
21662
21782
  return result;
21663
21783
  }).catch((error) => {
@@ -21669,6 +21789,7 @@ var BackgroundAgentManager = class {
21669
21789
  endTime: Date.now(),
21670
21790
  error: errorMsg
21671
21791
  });
21792
+ internal.futureReject?.(new Error(isCancelled ? "Job was cancelled" : errorMsg));
21672
21793
  this.handleJobCompletion(job, status, errorMsg);
21673
21794
  }).finally(() => {
21674
21795
  this.runningCount--;
@@ -21892,12 +22013,21 @@ var TaskPipeline = class {
21892
22013
  *
21893
22014
  * Tasks within the same level are executed in parallel.
21894
22015
  * Each level must complete before the next level starts.
22016
+ * If a task fails, all transitive dependents are cascade-failed.
21895
22017
  */
21896
22018
  async execute(executor) {
21897
22019
  const results = /* @__PURE__ */ new Map();
22020
+ const failedTaskIds = /* @__PURE__ */ new Set();
21898
22021
  for (const level of this.executionOrder) {
21899
22022
  const levelPromises = level.map(async (taskId) => {
21900
22023
  const task = this.tasks.get(taskId);
22024
+ const failedDep = task.dependsOn.find((depId) => failedTaskIds.has(depId));
22025
+ if (failedDep) {
22026
+ task.status = "cascade_failed";
22027
+ task.error = `Blocked by failed dependency "${failedDep}"`;
22028
+ failedTaskIds.add(taskId);
22029
+ return;
22030
+ }
21901
22031
  task.status = "running";
21902
22032
  const depResults = /* @__PURE__ */ new Map();
21903
22033
  for (const depId of task.dependsOn) {
@@ -21912,10 +22042,10 @@ var TaskPipeline = class {
21912
22042
  } catch (error) {
21913
22043
  task.status = "failed";
21914
22044
  task.error = error instanceof Error ? error.message : String(error);
22045
+ failedTaskIds.add(taskId);
21915
22046
  }
21916
22047
  });
21917
22048
  await Promise.all(levelPromises);
21918
- if (level.filter((id) => this.tasks.get(id).status === "failed").length > 0) break;
21919
22049
  }
21920
22050
  return this.buildResult();
21921
22051
  }
@@ -22015,8 +22145,9 @@ var TaskPipeline = class {
22015
22145
  }));
22016
22146
  const completed = taskResults.filter((t) => t.status === "completed");
22017
22147
  const failed = taskResults.filter((t) => t.status === "failed");
22148
+ const cascadeFailed = taskResults.filter((t) => t.status === "cascade_failed");
22018
22149
  const pending = taskResults.filter((t) => t.status === "pending");
22019
- const success = failed.length === 0 && pending.length === 0;
22150
+ const success = failed.length === 0 && cascadeFailed.length === 0 && pending.length === 0;
22020
22151
  const summaryParts = [];
22021
22152
  if (completed.length > 0) {
22022
22153
  summaryParts.push(`## Completed Tasks (${completed.length}/${taskResults.length})\n`);
@@ -22039,9 +22170,13 @@ var TaskPipeline = class {
22039
22170
  summaryParts.push(`**Error:** ${task.error}\n`);
22040
22171
  }
22041
22172
  }
22173
+ if (cascadeFailed.length > 0) {
22174
+ summaryParts.push(`## Cascade-Failed Tasks (${cascadeFailed.length})\n`);
22175
+ for (const task of cascadeFailed) summaryParts.push(`- ${task.id}: ${task.description} — ${task.error}\n`);
22176
+ }
22042
22177
  if (pending.length > 0) {
22043
22178
  summaryParts.push(`## Skipped Tasks (${pending.length})\n`);
22044
- for (const task of pending) summaryParts.push(`- ${task.id}: ${task.description} (blocked by failure)\n`);
22179
+ for (const task of pending) summaryParts.push(`- ${task.id}: ${task.description}\n`);
22045
22180
  }
22046
22181
  return {
22047
22182
  success,
@@ -22153,6 +22288,164 @@ Tasks at the same dependency level run in parallel.
22153
22288
  };
22154
22289
  }
22155
22290
  //#endregion
22291
+ //#region src/agents/SharedAgentContext.ts
22292
+ /**
22293
+ * SharedAgentContext — a namespaced key-value store for inter-agent communication.
22294
+ *
22295
+ * Enables agents in a pipeline to share discoveries without re-exploring.
22296
+ * Agent A can write file paths and insights; Agent B reads them.
22297
+ *
22298
+ * Constraints:
22299
+ * - Max 50 entries per namespace
22300
+ * - Values truncated at 2000 characters
22301
+ * - TTL: entries expire after 30 minutes (configurable)
22302
+ * - Agents declare access via frontmatter: shared-context: [read, write] | [read]
22303
+ */
22304
+ /** Maximum entries per namespace */
22305
+ const MAX_ENTRIES_PER_NAMESPACE = 50;
22306
+ /** Maximum number of namespaces */
22307
+ const MAX_NAMESPACES = 20;
22308
+ /** Maximum character length for values */
22309
+ const MAX_VALUE_LENGTH = 2e3;
22310
+ /** Default TTL in milliseconds (30 minutes) */
22311
+ const DEFAULT_TTL_MS = 1800 * 1e3;
22312
+ /**
22313
+ * SharedAgentContext provides a namespaced key-value store
22314
+ * for agents running in the same pipeline to exchange information.
22315
+ */
22316
+ var SharedAgentContext = class {
22317
+ constructor(ttlMs = DEFAULT_TTL_MS) {
22318
+ this.namespaces = /* @__PURE__ */ new Map();
22319
+ this.ttlMs = ttlMs;
22320
+ }
22321
+ /**
22322
+ * Set a value in the shared context.
22323
+ *
22324
+ * @param namespace - Namespace to scope the key under
22325
+ * @param key - Key to store the value under
22326
+ * @param value - Value to store (truncated at 2000 chars)
22327
+ * @param writtenBy - Agent name that wrote this entry
22328
+ * @throws If the namespace has reached its 50-entry limit for a new key
22329
+ */
22330
+ set(namespace, key, value, writtenBy) {
22331
+ const ns = this.getOrCreateNamespace(namespace);
22332
+ this.evictExpired(ns);
22333
+ const truncatedValue = value.length > MAX_VALUE_LENGTH ? value.slice(0, MAX_VALUE_LENGTH) : value;
22334
+ const existing = ns.get(key);
22335
+ const now = Date.now();
22336
+ if (existing) {
22337
+ existing.value = truncatedValue;
22338
+ existing.updatedAt = now;
22339
+ existing.expiresAt = now + this.ttlMs;
22340
+ existing.writtenBy = writtenBy;
22341
+ return;
22342
+ }
22343
+ if (ns.size >= MAX_ENTRIES_PER_NAMESPACE) throw new Error(`Namespace "${namespace}" has reached the maximum of ${MAX_ENTRIES_PER_NAMESPACE} entries. Remove unused entries or use a different namespace.`);
22344
+ ns.set(key, {
22345
+ value: truncatedValue,
22346
+ createdAt: now,
22347
+ updatedAt: now,
22348
+ expiresAt: now + this.ttlMs,
22349
+ writtenBy
22350
+ });
22351
+ }
22352
+ /**
22353
+ * Get a value from the shared context.
22354
+ *
22355
+ * @returns The value, or undefined if not found or expired
22356
+ */
22357
+ get(namespace, key) {
22358
+ const ns = this.namespaces.get(namespace);
22359
+ if (!ns) return void 0;
22360
+ const entry = ns.get(key);
22361
+ if (!entry) return void 0;
22362
+ if (Date.now() > entry.expiresAt) {
22363
+ ns.delete(key);
22364
+ return;
22365
+ }
22366
+ return entry.value;
22367
+ }
22368
+ /**
22369
+ * Check if a key exists and is not expired.
22370
+ */
22371
+ has(namespace, key) {
22372
+ return this.get(namespace, key) !== void 0;
22373
+ }
22374
+ /**
22375
+ * Delete a specific key from a namespace.
22376
+ */
22377
+ delete(namespace, key) {
22378
+ const ns = this.namespaces.get(namespace);
22379
+ if (!ns) return false;
22380
+ return ns.delete(key);
22381
+ }
22382
+ /**
22383
+ * List all non-expired keys in a namespace.
22384
+ */
22385
+ keys(namespace) {
22386
+ const ns = this.namespaces.get(namespace);
22387
+ if (!ns) return [];
22388
+ this.evictExpired(ns);
22389
+ return Array.from(ns.keys());
22390
+ }
22391
+ /**
22392
+ * Get all non-expired entries in a namespace as a plain object.
22393
+ */
22394
+ getAll(namespace) {
22395
+ const ns = this.namespaces.get(namespace);
22396
+ if (!ns) return {};
22397
+ this.evictExpired(ns);
22398
+ const result = {};
22399
+ for (const [key, entry] of ns) result[key] = entry.value;
22400
+ return result;
22401
+ }
22402
+ /**
22403
+ * Get the number of non-expired entries in a namespace.
22404
+ */
22405
+ size(namespace) {
22406
+ const ns = this.namespaces.get(namespace);
22407
+ if (!ns) return 0;
22408
+ this.evictExpired(ns);
22409
+ return ns.size;
22410
+ }
22411
+ /**
22412
+ * List all namespaces that have at least one non-expired entry.
22413
+ */
22414
+ listNamespaces() {
22415
+ const active = [];
22416
+ for (const [name, ns] of this.namespaces) {
22417
+ this.evictExpired(ns);
22418
+ if (ns.size > 0) active.push(name);
22419
+ }
22420
+ return active;
22421
+ }
22422
+ /**
22423
+ * Clear all entries in a specific namespace.
22424
+ */
22425
+ clearNamespace(namespace) {
22426
+ this.namespaces.delete(namespace);
22427
+ }
22428
+ /**
22429
+ * Clear all namespaces and entries.
22430
+ */
22431
+ clearAll() {
22432
+ this.namespaces.clear();
22433
+ }
22434
+ getOrCreateNamespace(namespace) {
22435
+ let ns = this.namespaces.get(namespace);
22436
+ if (!ns) {
22437
+ if (this.namespaces.size >= MAX_NAMESPACES) throw new Error(`Maximum of ${MAX_NAMESPACES} namespaces reached. Reuse an existing namespace or clear unused ones.`);
22438
+ ns = /* @__PURE__ */ new Map();
22439
+ this.namespaces.set(namespace, ns);
22440
+ }
22441
+ return ns;
22442
+ }
22443
+ evictExpired(ns) {
22444
+ const now = Date.now();
22445
+ for (const [key, entry] of ns) if (now > entry.expiresAt) ns.delete(key);
22446
+ }
22447
+ };
22448
+ //#endregion
22156
22449
  //#region src/agents/coordinatorTool.ts
22157
22450
  /**
22158
22451
  * Zod schema for coordinate_task tool parameters
@@ -22202,6 +22495,7 @@ function createCoordinateTaskTool(orchestrator, agentStore, parentSessionId) {
22202
22495
  if (!capture.result) return `Coordinator did not produce a task decomposition. Raw output:\n\n${coordinatorResult.summary}`;
22203
22496
  const pipeline = new TaskPipeline(capture.result);
22204
22497
  if (pipeline.isSingleTask()) return `**Single Task Execution** (pipeline overhead skipped)\n\n${await executeSingleTask(orchestrator, pipeline.getSingleTask(), agentStore, parentSessionId, thoroughness)}`;
22498
+ const sharedContext = new SharedAgentContext();
22205
22499
  const pipelineResult = await pipeline.execute(async (pipelineTask, dependencyResults) => {
22206
22500
  let taskDescription = pipelineTask.description;
22207
22501
  if (dependencyResults.size > 0) {
@@ -22216,7 +22510,8 @@ function createCoordinateTaskTool(orchestrator, agentStore, parentSessionId) {
22216
22510
  task: taskDescription,
22217
22511
  agentName: resolveAgentName(pipelineTask.agentType, agentStore),
22218
22512
  thoroughness,
22219
- parentSessionId
22513
+ parentSessionId,
22514
+ sharedContext
22220
22515
  })).summary;
22221
22516
  });
22222
22517
  return `**Coordinated Execution Complete — ${pipelineResult.success ? "SUCCESS" : "PARTIAL FAILURE"}**\n\n${pipelineResult.summary}`;
@@ -4,7 +4,7 @@ import { homedir } from "os";
4
4
  import path from "path";
5
5
  import axios from "axios";
6
6
  //#region package.json
7
- var version = "0.2.81";
7
+ var version = "0.2.82";
8
8
  //#endregion
9
9
  //#region src/utils/updateChecker.ts
10
10
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bike4mind/cli",
3
- "version": "0.2.81",
3
+ "version": "0.2.82",
4
4
  "type": "module",
5
5
  "description": "Interactive CLI tool for Bike4Mind with ReAct agents",
6
6
  "license": "UNLICENSED",
@@ -119,7 +119,7 @@
119
119
  "@bike4mind/agents": "0.4.17",
120
120
  "@bike4mind/common": "2.86.0",
121
121
  "@bike4mind/mcp": "1.35.2",
122
- "@bike4mind/services": "2.76.0",
122
+ "@bike4mind/services": "2.76.1",
123
123
  "@bike4mind/utils": "2.18.0",
124
124
  "@types/better-sqlite3": "^7.6.13",
125
125
  "@types/jsonwebtoken": "^9.0.4",
@@ -137,5 +137,5 @@
137
137
  "optionalDependencies": {
138
138
  "@vscode/ripgrep": "^1.17.1"
139
139
  },
140
- "gitHead": "f300ad457f3b73ae96fc39e11fa5b16fe124ad6d"
140
+ "gitHead": "df02a331a746b242deb8512acef906fbc91a965f"
141
141
  }