@corbat-tech/coco 2.38.0 → 2.40.0

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.
@@ -1,6 +1,40 @@
1
- import { V as RuntimeTurnRunner, T as RuntimeTurnInput, Q as RuntimeTurnContext, U as RuntimeTurnResult, E as EventLog, G as RuntimeEventType, F as RuntimeEvent, t as AgentRuntime, x as PermissionPolicy, H as RuntimeMode, w as PermissionDecision, K as RuntimeSessionStore, J as RuntimeSessionCreateOptions, I as RuntimeSession } from './agent-runtime-DeLcB0Ie.js';
1
+ import { T as EventLog, a0 as AgentTask, g as AgentCapability, N as AgentTraceContext, ar as ToolRiskManifest, G as AgentRunResult, af as RuntimeTurnRunner, ad as RuntimeTurnInput, ac as RuntimeTurnContext, ae as RuntimeTurnResult, a2 as RuntimeEventType, a1 as RuntimeEvent, Y as PermissionPolicy, a3 as RuntimeMode, b2 as ToolDefinition, X as PermissionDecision, a8 as RuntimeSessionStore, a7 as RuntimeSessionCreateOptions, a6 as RuntimeSession, ap as ToolRegistry, a4 as RuntimePolicy, ab as RuntimeToolExecutionResult } from './workflow-engine-DleSoUhy.js';
2
2
  import { Server } from 'node:http';
3
- import { a as ToolDefinition } from './registry-CEpl9Jq0.js';
3
+ import { A as AgentRuntime } from './agent-runtime-Cd6pB640.js';
4
+
5
+ interface AgentRunnerExecutionInput {
6
+ task: AgentTask;
7
+ capability: AgentCapability;
8
+ trace?: AgentTraceContext;
9
+ toolRiskManifest?: ToolRiskManifest;
10
+ }
11
+ interface AgentRunnerExecutionContext {
12
+ task: AgentTask;
13
+ capability: AgentCapability;
14
+ trace: AgentTraceContext;
15
+ assertToolAllowed(toolName: string): void;
16
+ }
17
+ type AgentRunnerExecutor = (context: AgentRunnerExecutionContext) => Promise<AgentRunnerRawResult>;
18
+ interface AgentRunnerRawResult {
19
+ output: string;
20
+ success?: boolean;
21
+ turns?: number;
22
+ toolsUsed?: string[];
23
+ inputTokens?: number;
24
+ outputTokens?: number;
25
+ error?: string;
26
+ metadata?: Record<string, unknown>;
27
+ }
28
+ interface AgentRunnerOptions {
29
+ eventLog?: EventLog;
30
+ executor?: AgentRunnerExecutor;
31
+ }
32
+ declare class AgentRunner {
33
+ private readonly options;
34
+ constructor(options?: AgentRunnerOptions);
35
+ run(input: AgentRunnerExecutionInput): Promise<AgentRunResult>;
36
+ }
37
+ declare function createAgentRunner(options?: AgentRunnerOptions): AgentRunner;
4
38
 
5
39
  declare class DefaultRuntimeTurnRunner implements RuntimeTurnRunner {
6
40
  run(input: RuntimeTurnInput, context: RuntimeTurnContext): Promise<RuntimeTurnResult>;
@@ -110,4 +144,31 @@ interface McpToolPolicy {
110
144
  }
111
145
  declare function createMcpToolPolicy(server: string, tool: string, risk: ExtensionRisk, allowedModes?: string[]): McpToolPolicy;
112
146
 
113
- export { type AgentSurface as A, DefaultPermissionPolicy as D, type ExtensionRisk as E, FileEventLog as F, InMemoryEventLog as I, type McpToolPolicy as M, type RecipeManifest as R, type SkillManifest as S, ToolCallingRuntimeTurnRunner as T, DefaultRuntimeTurnRunner as a, FileRuntimeSessionStore as b, InMemoryRuntimeSessionStore as c, type RecipeStep as d, type RuntimeHttpServerOptions as e, type ToolCallingRuntimeTurnRunnerOptions as f, createDefaultRuntimeTurnRunner as g, createEventLog as h, createFileEventLog as i, createFileRuntimeSessionStore as j, createMcpToolPolicy as k, createPermissionPolicy as l, createRuntimeHttpServer as m, createRuntimeSessionStore as n, createToolCallingRuntimeTurnRunner as o };
147
+ interface RuntimeToolExecutorOptions {
148
+ toolRegistry: ToolRegistry;
149
+ eventLog?: EventLog;
150
+ permissionPolicy?: PermissionPolicy;
151
+ mode?: RuntimeMode;
152
+ runtimePolicy?: RuntimePolicy;
153
+ }
154
+ interface RuntimeToolExecutorInput {
155
+ toolName: string;
156
+ input: Record<string, unknown>;
157
+ mode?: RuntimeMode;
158
+ allowedTools?: string[];
159
+ confirmed?: boolean;
160
+ metadata?: Record<string, unknown>;
161
+ }
162
+ declare class RuntimeToolExecutor {
163
+ private readonly toolRegistry;
164
+ private readonly eventLog;
165
+ private readonly permissionPolicy;
166
+ private readonly defaultMode;
167
+ private readonly runtimePolicy?;
168
+ constructor(options: RuntimeToolExecutorOptions);
169
+ execute(input: RuntimeToolExecutorInput): Promise<RuntimeToolExecutionResult>;
170
+ private block;
171
+ }
172
+ declare function createRuntimeToolExecutor(options: RuntimeToolExecutorOptions): RuntimeToolExecutor;
173
+
174
+ export { AgentRunner as A, DefaultPermissionPolicy as D, type ExtensionRisk as E, FileEventLog as F, InMemoryEventLog as I, type McpToolPolicy as M, type RecipeManifest as R, type SkillManifest as S, ToolCallingRuntimeTurnRunner as T, type AgentRunnerExecutionContext as a, type AgentRunnerExecutionInput as b, type AgentRunnerExecutor as c, type AgentRunnerOptions as d, type AgentRunnerRawResult as e, type AgentSurface as f, DefaultRuntimeTurnRunner as g, FileRuntimeSessionStore as h, InMemoryRuntimeSessionStore as i, type RecipeStep as j, type RuntimeHttpServerOptions as k, RuntimeToolExecutor as l, type RuntimeToolExecutorInput as m, type RuntimeToolExecutorOptions as n, type ToolCallingRuntimeTurnRunnerOptions as o, createAgentRunner as p, createDefaultRuntimeTurnRunner as q, createEventLog as r, createFileEventLog as s, createFileRuntimeSessionStore as t, createMcpToolPolicy as u, createPermissionPolicy as v, createRuntimeHttpServer as w, createRuntimeSessionStore as x, createRuntimeToolExecutor as y, createToolCallingRuntimeTurnRunner as z };
@@ -1,5 +1,5 @@
1
- export { b as ToolCategory, a as ToolDefinition, T as ToolRegistry, d as ToolResult, c as createToolRegistry, e as defineTool, g as getToolRegistry } from '../registry-CEpl9Jq0.js';
2
- export { H as HumanEscalationHandler, a as HumanEscalationInput, b as HumanEscalationOutput, I as InternalOpsDraftHandler, l as InternalOpsDraftInput, m as InternalOpsDraftOutput, n as InternalOpsToolRegistryOptions, o as SalesIntakeToolRegistryOptions, p as SalesLeadSummaryHandler, q as SalesLeadSummaryInput, r as SalesLeadSummaryOutput, S as SupportDraftHandler, c as SupportDraftInput, d as SupportDraftOutput, e as SupportRagToolRegistryOptions, f as createCodingToolRegistry, g as createCustomerSupportToolRegistry, s as createInternalOpsToolRegistry, h as createNoToolRegistry, i as createPublicWebToolRegistry, j as createRagToolRegistry, t as createSalesIntakeToolRegistry, k as createSupportRagToolRegistry } from '../profiles-BcyL-gQ9.js';
3
- export { A as AgentTask, B as BuildResult, C as Checkpoint, d as ClassInfo, e as CodeAnalysisResult, f as CodeDefinition, g as CodeSuggestion, h as CodebaseMapOutput, i as ComplexityResult, j as ContextItem, k as CoverageResult, D as DefinitionType, l as DiagramOutput, E as ExecutionStrategy, m as ExportInfo, F as FileComplexity, n as FileMapEntry, o as FunctionComplexity, p as FunctionInfo, H as HttpResponse, I as ImageReadOutput, q as ImportInfo, L as LearningEntry, s as LintIssue, t as LintResult, u as LspReference, v as LspStatusOutput, w as LspSymbol, M as MCPConnectServerResult, x as MCPFleetServerStatus, y as MCPFleetStatus, z as Memory, O as OpenFileOutput, P as PRCheck, G as PackageManager, J as PdfReadOutput, R as RankedContextItem, K as RepoContextRequest, N as RepoContextResult, S as RepoGraphNode, T as RepoIntelligenceGraph, U as ReviewCategory, V as ReviewFinding, W as ReviewResult, X as ReviewSeverity, Y as ReviewSummary, Z as RiskLevel, _ as SchemaInspectOutput, $ as SearchMatch, a0 as SearchResult, a1 as SemanticSearchOutput, a2 as SemanticSearchResultItem, a3 as SkillDefinition, a4 as SqlQueryOutput, a5 as TestFailure, a6 as TestResult, a7 as ValidationResult, a8 as WebFetchOutput, a9 as WebSearchOutput, aa as WebSearchResultItem, ab as addContextTool, ac as agentCoordinatorTools, ad as aggregateResultsTool, ae as analyzeComplexityTool, af as analyzeDirectoryTool, ag as analyzeFileTool, ah as analyzeRepoHealthTool, ai as astValidatorTools, aj as bashBackgroundTool, ak as bashExecTool, al as bashTools, am as buildTools, an as calculateCodeScoreTool, ao as calculateQualityTool, ap as checkAgentCapabilityTool, aq as checkProtectedBranchTool, ar as checkpointTools, as as codeAnalyzerTools, at as codebaseMapTool, au as codebaseMapTools, av as commandExistsTool, aw as contextEnhancerTools, ax as copyFileTool, ay as createAgentPlanTool, az as createCheckpointTool, aA as createCustomToolTool, c as createFullToolRegistry, aB as createMemoryTool, aC as databaseTools, aD as delegateTaskTool, aE as deleteFileTool, aF as diagramTools, aG as diffTools, aH as discoverSkillsTool, aI as editFileTool, aJ as fileExistsTool, aK as fileTools, aL as findInFileTool, aM as findMissingImportsTool, aN as generateDiagramTool, aO as getCommitStatsTool, aP as getCoverageTool, aQ as getEffectDescription, aR as getEnvTool, aS as getLearnedPatternsTool, aT as getRelevantContextTool, aU as getRepoContext, aV as getRiskDescription, aW as getRiskLevel, aX as ghCheckAuthTool, aY as ghPrChecksTool, aZ as ghPrCreateTool, a_ as ghPrListTool, a$ as ghPrMergeTool, b0 as ghReleaseCreateTool, b1 as ghRepoInfoTool, b2 as gitAddTool, b3 as gitBranchTool, b4 as gitCheckoutTool, b5 as gitCommitTool, b6 as gitDiffTool, b7 as gitEnhancedTools, b8 as gitInitTool, b9 as gitLogTool, ba as gitPullTool, bb as gitPushTool, bc as gitSimpleTools, bd as gitStatusTool, be as gitTools, bf as githubTools, bg as globTool, bh as grepTool, bi as httpFetchTool, bj as httpJsonTool, bk as httpTools, bl as imageTools, bm as inspectSchemaTool, bn as installDepsTool, bo as listCheckpointsTool, bp as listDirTool, bq as listMemoriesTool, br as lspDefinitionTool, bs as lspDocumentSymbolsTool, bt as lspReferencesTool, bu as lspStatusTool, bv as lspTools, bw as lspWorkspaceSymbolsTool, bx as makeTool, by as managePermissionsTool, bz as mcpConnectServerTool, bA as mcpListServersTool, bB as mcpTools, bC as memoryTools, bD as moveFileTool, bE as openFileTool, bF as openTools, bG as pdfTools, bH as permissionsTools, bI as qualityTools, bJ as readFileTool, bK as readImageTool, bL as readPdfTool, bM as recallMemoryTool, bN as recommendBranchTool, bO as recordLearningTool, r as registerAllTools, bP as repoContext, bQ as repoContextTool, bR as repoIntelligenceTools, bS as restoreCheckpointTool, bT as reviewCodeTool, bU as reviewTools, bV as runLinterTool, bW as runScriptTool, bX as runTestFileTool, bY as runTestsTool, bZ as searchTools, b_ as semanticSearchTool, b$ as semanticSearchTools, c0 as showDiffTool, c1 as simpleAgentTools, c2 as simpleAutoCommitTool, c3 as skillEnhancerTools, c4 as smartSuggestionsTools, c5 as spawnSimpleAgentTool, c6 as sqlQueryTool, c7 as suggestImprovementsTool, c8 as testTools, c9 as treeTool, ca as tscTool, cb as validateCodeTool, cc as validateSkillTool, cd as webFetchTool, ce as webSearchTool, cf as webTools, cg as writeFileTool } from '../index-Dp1o8c9g.js';
1
+ export { b3 as ToolCategory, b2 as ToolDefinition, ap as ToolRegistry, b4 as ToolResult, aN as createToolRegistry, b5 as defineTool, b6 as getToolRegistry } from '../workflow-engine-DleSoUhy.js';
2
+ export { H as HumanEscalationHandler, a as HumanEscalationInput, b as HumanEscalationOutput, I as InternalOpsDraftHandler, l as InternalOpsDraftInput, m as InternalOpsDraftOutput, n as InternalOpsToolRegistryOptions, o as SalesIntakeToolRegistryOptions, p as SalesLeadSummaryHandler, q as SalesLeadSummaryInput, r as SalesLeadSummaryOutput, S as SupportDraftHandler, c as SupportDraftInput, d as SupportDraftOutput, e as SupportRagToolRegistryOptions, f as createCodingToolRegistry, g as createCustomerSupportToolRegistry, s as createInternalOpsToolRegistry, h as createNoToolRegistry, i as createPublicWebToolRegistry, j as createRagToolRegistry, t as createSalesIntakeToolRegistry, k as createSupportRagToolRegistry } from '../profiles-BA9dvyaF.js';
3
+ export { A as AgentTask, B as BuildResult, C as Checkpoint, d as ClassInfo, e as CodeAnalysisResult, f as CodeDefinition, g as CodeSuggestion, h as CodebaseMapOutput, i as ComplexityResult, j as ContextItem, k as CoverageResult, D as DefinitionType, l as DiagramOutput, E as ExecutionStrategy, m as ExportInfo, F as FileComplexity, n as FileMapEntry, o as FunctionComplexity, p as FunctionInfo, H as HttpResponse, I as ImageReadOutput, q as ImportInfo, L as LearningEntry, s as LintIssue, t as LintResult, u as LspReference, v as LspStatusOutput, w as LspSymbol, M as MCPConnectServerResult, x as MCPFleetServerStatus, y as MCPFleetStatus, z as Memory, O as OpenFileOutput, P as PRCheck, G as PackageManager, J as PdfReadOutput, R as RankedContextItem, K as RepoContextRequest, N as RepoContextResult, S as RepoGraphNode, T as RepoIntelligenceGraph, U as ReviewCategory, V as ReviewFinding, W as ReviewResult, X as ReviewSeverity, Y as ReviewSummary, Z as RiskLevel, _ as SchemaInspectOutput, $ as SearchMatch, a0 as SearchResult, a1 as SemanticSearchOutput, a2 as SemanticSearchResultItem, a3 as SkillDefinition, a4 as SqlQueryOutput, a5 as TestFailure, a6 as TestResult, a7 as ValidationResult, a8 as WebFetchOutput, a9 as WebSearchOutput, aa as WebSearchResultItem, ab as addContextTool, ac as agentCoordinatorTools, ad as aggregateResultsTool, ae as analyzeComplexityTool, af as analyzeDirectoryTool, ag as analyzeFileTool, ah as analyzeRepoHealthTool, ai as astValidatorTools, aj as bashBackgroundTool, ak as bashExecTool, al as bashTools, am as buildTools, an as calculateCodeScoreTool, ao as calculateQualityTool, ap as checkAgentCapabilityTool, aq as checkProtectedBranchTool, ar as checkpointTools, as as codeAnalyzerTools, at as codebaseMapTool, au as codebaseMapTools, av as commandExistsTool, aw as contextEnhancerTools, ax as copyFileTool, ay as createAgentPlanTool, az as createCheckpointTool, aA as createCustomToolTool, c as createFullToolRegistry, aB as createMemoryTool, aC as databaseTools, aD as delegateTaskTool, aE as deleteFileTool, aF as diagramTools, aG as diffTools, aH as discoverSkillsTool, aI as editFileTool, aJ as fileExistsTool, aK as fileTools, aL as findInFileTool, aM as findMissingImportsTool, aN as generateDiagramTool, aO as getCommitStatsTool, aP as getCoverageTool, aQ as getEffectDescription, aR as getEnvTool, aS as getLearnedPatternsTool, aT as getRelevantContextTool, aU as getRepoContext, aV as getRiskDescription, aW as getRiskLevel, aX as ghCheckAuthTool, aY as ghPrChecksTool, aZ as ghPrCreateTool, a_ as ghPrListTool, a$ as ghPrMergeTool, b0 as ghReleaseCreateTool, b1 as ghRepoInfoTool, b2 as gitAddTool, b3 as gitBranchTool, b4 as gitCheckoutTool, b5 as gitCommitTool, b6 as gitDiffTool, b7 as gitEnhancedTools, b8 as gitInitTool, b9 as gitLogTool, ba as gitPullTool, bb as gitPushTool, bc as gitSimpleTools, bd as gitStatusTool, be as gitTools, bf as githubTools, bg as globTool, bh as grepTool, bi as httpFetchTool, bj as httpJsonTool, bk as httpTools, bl as imageTools, bm as inspectSchemaTool, bn as installDepsTool, bo as listCheckpointsTool, bp as listDirTool, bq as listMemoriesTool, br as lspDefinitionTool, bs as lspDocumentSymbolsTool, bt as lspReferencesTool, bu as lspStatusTool, bv as lspTools, bw as lspWorkspaceSymbolsTool, bx as makeTool, by as managePermissionsTool, bz as mcpConnectServerTool, bA as mcpListServersTool, bB as mcpTools, bC as memoryTools, bD as moveFileTool, bE as openFileTool, bF as openTools, bG as pdfTools, bH as permissionsTools, bI as qualityTools, bJ as readFileTool, bK as readImageTool, bL as readPdfTool, bM as recallMemoryTool, bN as recommendBranchTool, bO as recordLearningTool, r as registerAllTools, bP as repoContext, bQ as repoContextTool, bR as repoIntelligenceTools, bS as restoreCheckpointTool, bT as reviewCodeTool, bU as reviewTools, bV as runLinterTool, bW as runScriptTool, bX as runTestFileTool, bY as runTestsTool, bZ as searchTools, b_ as semanticSearchTool, b$ as semanticSearchTools, c0 as showDiffTool, c1 as simpleAgentTools, c2 as simpleAutoCommitTool, c3 as skillEnhancerTools, c4 as smartSuggestionsTools, c5 as spawnSimpleAgentTool, c6 as sqlQueryTool, c7 as suggestImprovementsTool, c8 as testTools, c9 as treeTool, ca as tscTool, cb as validateCodeTool, cc as validateSkillTool, cd as webFetchTool, ce as webSearchTool, cf as webTools, cg as writeFileTool } from '../index-BD5_a3Q8.js';
4
4
  import 'zod';
5
- import '../rag-BakFRE-u.js';
5
+ import '../rag-D-Zo1oyo.js';
@@ -2010,7 +2010,9 @@ function createCustomerSupportToolRegistry(source) {
2010
2010
  return copyAllowedTools(CUSTOMER_SUPPORT_TOOLS, source);
2011
2011
  }
2012
2012
  function createSupportRagToolRegistry(options = {}) {
2013
- const registry = createRagToolRegistry(options.retriever);
2013
+ const registry = createRagToolRegistry(options.retriever, {
2014
+ runtimeContext: options.runtimeContext
2015
+ });
2014
2016
  if (options.supportDraft) {
2015
2017
  registry.register(
2016
2018
  defineTool({
@@ -2098,7 +2100,7 @@ function createInternalOpsToolRegistry(options = {}) {
2098
2100
  }
2099
2101
  return registry;
2100
2102
  }
2101
- function createRagToolRegistry(retriever) {
2103
+ function createRagToolRegistry(retriever, options = {}) {
2102
2104
  const registry = new ToolRegistry();
2103
2105
  if (!retriever) return registry;
2104
2106
  registry.register(
@@ -2110,7 +2112,11 @@ function createRagToolRegistry(retriever) {
2110
2112
  query: z.string(),
2111
2113
  limit: z.number().optional()
2112
2114
  }),
2113
- execute: async ({ query, limit }) => retriever.search(query, { limit })
2115
+ execute: async ({ query, limit }) => retriever.search(query, {
2116
+ limit,
2117
+ tenantId: options.runtimeContext?.tenant?.id,
2118
+ runtimeContext: options.runtimeContext
2119
+ })
2114
2120
  })
2115
2121
  );
2116
2122
  return registry;
@@ -3891,6 +3897,31 @@ var gitSimpleTools = [checkProtectedBranchTool, simpleAutoCommitTool];
3891
3897
 
3892
3898
  // src/cli/repl/agents/manager.ts
3893
3899
  init_logger();
3900
+ var LEGACY_ROLE_MAPPINGS = [
3901
+ { legacy: "explore", role: "researcher", reason: "read-only codebase exploration" },
3902
+ { legacy: "researcher", role: "researcher", reason: "legacy executor role" },
3903
+ { legacy: "plan", role: "planner", reason: "task planning" },
3904
+ { legacy: "planner", role: "planner", reason: "legacy executor role" },
3905
+ { legacy: "architect", role: "architect", reason: "architecture design" },
3906
+ { legacy: "editor", role: "editor", reason: "implementation edits" },
3907
+ { legacy: "debug", role: "coder", reason: "debugging maps to coding capability" },
3908
+ { legacy: "coder", role: "coder", reason: "legacy executor role" },
3909
+ { legacy: "test", role: "tester", reason: "test authoring/execution" },
3910
+ { legacy: "tester", role: "tester", reason: "legacy executor role" },
3911
+ { legacy: "tdd", role: "tester", reason: "test-first implementation" },
3912
+ { legacy: "e2e", role: "tester", reason: "end-to-end testing" },
3913
+ { legacy: "review", role: "reviewer", reason: "code review" },
3914
+ { legacy: "reviewer", role: "reviewer", reason: "legacy executor role" },
3915
+ { legacy: "refactor", role: "optimizer", reason: "structure optimization" },
3916
+ { legacy: "optimizer", role: "optimizer", reason: "legacy executor role" },
3917
+ { legacy: "security", role: "security", reason: "security analysis" },
3918
+ { legacy: "qa", role: "qa", reason: "quality assurance" },
3919
+ { legacy: "integrator", role: "integrator", reason: "integration coordination" },
3920
+ { legacy: "pm", role: "pm", reason: "product/project coordination" },
3921
+ { legacy: "docs", role: "docs", reason: "documentation" },
3922
+ { legacy: "database", role: "database", reason: "database work" }
3923
+ ];
3924
+ new Map(LEGACY_ROLE_MAPPINGS.map((mapping) => [mapping.legacy, mapping]));
3894
3925
  var AGENT_NAMES = {
3895
3926
  explore: "Explorer",
3896
3927
  plan: "Planner",
@@ -3950,7 +3981,7 @@ var AGENT_TYPES = [
3950
3981
  "docs",
3951
3982
  "database"
3952
3983
  ];
3953
- var LEGACY_ROLE_MAP = {
3984
+ var LEGACY_ROLE_MAP2 = {
3954
3985
  researcher: "explore",
3955
3986
  coder: "debug",
3956
3987
  // "debug" has write + bash + read — closest to general coding
@@ -3970,7 +4001,7 @@ var SpawnSimpleAgentSchema = z.object({
3970
4001
  });
3971
4002
  function resolveAgentType(input) {
3972
4003
  if (input.type) return input.type;
3973
- if (input.role && input.role in LEGACY_ROLE_MAP) return LEGACY_ROLE_MAP[input.role];
4004
+ if (input.role && input.role in LEGACY_ROLE_MAP2) return LEGACY_ROLE_MAP2[input.role];
3974
4005
  return "explore";
3975
4006
  }
3976
4007
  var spawnSimpleAgentTool = defineTool({