@uluops/core 0.5.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.
Files changed (167) hide show
  1. package/README.md +543 -0
  2. package/definitions/starter/code-validator.agent.yaml +134 -0
  3. package/definitions/starter/docs-validator.agent.yaml +142 -0
  4. package/definitions/starter/public-interface-validator.agent.yaml +138 -0
  5. package/definitions/starter/security-analyst.agent.yaml +144 -0
  6. package/definitions/starter/test-architect.agent.yaml +137 -0
  7. package/dist/ai/AIProvider.d.ts +198 -0
  8. package/dist/ai/AIProvider.d.ts.map +1 -0
  9. package/dist/ai/AIProvider.js +557 -0
  10. package/dist/ai/AIProvider.js.map +1 -0
  11. package/dist/ai/ModelCatalog.d.ts +78 -0
  12. package/dist/ai/ModelCatalog.d.ts.map +1 -0
  13. package/dist/ai/ModelCatalog.js +193 -0
  14. package/dist/ai/ModelCatalog.js.map +1 -0
  15. package/dist/ai/ShellExecutor.d.ts +42 -0
  16. package/dist/ai/ShellExecutor.d.ts.map +1 -0
  17. package/dist/ai/ShellExecutor.js +62 -0
  18. package/dist/ai/ShellExecutor.js.map +1 -0
  19. package/dist/ai/TokenBudgetTracker.d.ts +49 -0
  20. package/dist/ai/TokenBudgetTracker.d.ts.map +1 -0
  21. package/dist/ai/TokenBudgetTracker.js +61 -0
  22. package/dist/ai/TokenBudgetTracker.js.map +1 -0
  23. package/dist/ai/ToolAdapter.d.ts +25 -0
  24. package/dist/ai/ToolAdapter.d.ts.map +1 -0
  25. package/dist/ai/ToolAdapter.js +135 -0
  26. package/dist/ai/ToolAdapter.js.map +1 -0
  27. package/dist/ai/index.d.ts +6 -0
  28. package/dist/ai/index.d.ts.map +1 -0
  29. package/dist/ai/index.js +4 -0
  30. package/dist/ai/index.js.map +1 -0
  31. package/dist/client/UluOpsClient.d.ts +111 -0
  32. package/dist/client/UluOpsClient.d.ts.map +1 -0
  33. package/dist/client/UluOpsClient.js +329 -0
  34. package/dist/client/UluOpsClient.js.map +1 -0
  35. package/dist/constants.d.ts +6 -0
  36. package/dist/constants.d.ts.map +1 -0
  37. package/dist/constants.js +9 -0
  38. package/dist/constants.js.map +1 -0
  39. package/dist/errors/UluOpsError.d.ts +10 -0
  40. package/dist/errors/UluOpsError.d.ts.map +1 -0
  41. package/dist/errors/UluOpsError.js +13 -0
  42. package/dist/errors/UluOpsError.js.map +1 -0
  43. package/dist/errors/index.d.ts +64 -0
  44. package/dist/errors/index.d.ts.map +1 -0
  45. package/dist/errors/index.js +93 -0
  46. package/dist/errors/index.js.map +1 -0
  47. package/dist/executor/AgentExecutor.d.ts +57 -0
  48. package/dist/executor/AgentExecutor.d.ts.map +1 -0
  49. package/dist/executor/AgentExecutor.js +331 -0
  50. package/dist/executor/AgentExecutor.js.map +1 -0
  51. package/dist/executor/CommandExecutor.d.ts +33 -0
  52. package/dist/executor/CommandExecutor.d.ts.map +1 -0
  53. package/dist/executor/CommandExecutor.js +183 -0
  54. package/dist/executor/CommandExecutor.js.map +1 -0
  55. package/dist/executor/PipelineExecutor.d.ts +55 -0
  56. package/dist/executor/PipelineExecutor.d.ts.map +1 -0
  57. package/dist/executor/PipelineExecutor.js +273 -0
  58. package/dist/executor/PipelineExecutor.js.map +1 -0
  59. package/dist/executor/ToolHandler.d.ts +47 -0
  60. package/dist/executor/ToolHandler.d.ts.map +1 -0
  61. package/dist/executor/ToolHandler.js +615 -0
  62. package/dist/executor/ToolHandler.js.map +1 -0
  63. package/dist/executor/WorkflowExecutor.d.ts +55 -0
  64. package/dist/executor/WorkflowExecutor.d.ts.map +1 -0
  65. package/dist/executor/WorkflowExecutor.js +368 -0
  66. package/dist/executor/WorkflowExecutor.js.map +1 -0
  67. package/dist/executor/preflight.d.ts +8 -0
  68. package/dist/executor/preflight.d.ts.map +1 -0
  69. package/dist/executor/preflight.js +102 -0
  70. package/dist/executor/preflight.js.map +1 -0
  71. package/dist/executor/symbols.d.ts +13 -0
  72. package/dist/executor/symbols.d.ts.map +1 -0
  73. package/dist/executor/symbols.js +102 -0
  74. package/dist/executor/symbols.js.map +1 -0
  75. package/dist/index.d.ts +32 -0
  76. package/dist/index.d.ts.map +1 -0
  77. package/dist/index.js +25 -0
  78. package/dist/index.js.map +1 -0
  79. package/dist/parser/OutputExtractor.d.ts +52 -0
  80. package/dist/parser/OutputExtractor.d.ts.map +1 -0
  81. package/dist/parser/OutputExtractor.js +818 -0
  82. package/dist/parser/OutputExtractor.js.map +1 -0
  83. package/dist/parser/outputSchemas.d.ts +223 -0
  84. package/dist/parser/outputSchemas.d.ts.map +1 -0
  85. package/dist/parser/outputSchemas.js +73 -0
  86. package/dist/parser/outputSchemas.js.map +1 -0
  87. package/dist/registry/RegistryClient.d.ts +75 -0
  88. package/dist/registry/RegistryClient.d.ts.map +1 -0
  89. package/dist/registry/RegistryClient.js +419 -0
  90. package/dist/registry/RegistryClient.js.map +1 -0
  91. package/dist/registry/index.d.ts +2 -0
  92. package/dist/registry/index.d.ts.map +1 -0
  93. package/dist/registry/index.js +2 -0
  94. package/dist/registry/index.js.map +1 -0
  95. package/dist/types/agent.d.ts +406 -0
  96. package/dist/types/agent.d.ts.map +1 -0
  97. package/dist/types/agent.js +2 -0
  98. package/dist/types/agent.js.map +1 -0
  99. package/dist/types/ai.d.ts +14 -0
  100. package/dist/types/ai.d.ts.map +1 -0
  101. package/dist/types/ai.js +2 -0
  102. package/dist/types/ai.js.map +1 -0
  103. package/dist/types/command.d.ts +153 -0
  104. package/dist/types/command.d.ts.map +1 -0
  105. package/dist/types/command.js +2 -0
  106. package/dist/types/command.js.map +1 -0
  107. package/dist/types/config.d.ts +136 -0
  108. package/dist/types/config.d.ts.map +1 -0
  109. package/dist/types/config.js +2 -0
  110. package/dist/types/config.js.map +1 -0
  111. package/dist/types/execution.d.ts +172 -0
  112. package/dist/types/execution.d.ts.map +1 -0
  113. package/dist/types/execution.js +2 -0
  114. package/dist/types/execution.js.map +1 -0
  115. package/dist/types/index.d.ts +12 -0
  116. package/dist/types/index.d.ts.map +1 -0
  117. package/dist/types/index.js +2 -0
  118. package/dist/types/index.js.map +1 -0
  119. package/dist/types/parser.d.ts +75 -0
  120. package/dist/types/parser.d.ts.map +1 -0
  121. package/dist/types/parser.js +2 -0
  122. package/dist/types/parser.js.map +1 -0
  123. package/dist/types/pipeline.d.ts +155 -0
  124. package/dist/types/pipeline.d.ts.map +1 -0
  125. package/dist/types/pipeline.js +2 -0
  126. package/dist/types/pipeline.js.map +1 -0
  127. package/dist/types/registry.d.ts +232 -0
  128. package/dist/types/registry.d.ts.map +1 -0
  129. package/dist/types/registry.js +2 -0
  130. package/dist/types/registry.js.map +1 -0
  131. package/dist/types/tools.d.ts +29 -0
  132. package/dist/types/tools.d.ts.map +1 -0
  133. package/dist/types/tools.js +2 -0
  134. package/dist/types/tools.js.map +1 -0
  135. package/dist/types/validation.d.ts +237 -0
  136. package/dist/types/validation.d.ts.map +1 -0
  137. package/dist/types/validation.js +2 -0
  138. package/dist/types/validation.js.map +1 -0
  139. package/dist/types/workflow.d.ts +131 -0
  140. package/dist/types/workflow.d.ts.map +1 -0
  141. package/dist/types/workflow.js +2 -0
  142. package/dist/types/workflow.js.map +1 -0
  143. package/dist/utils/formatError.d.ts +6 -0
  144. package/dist/utils/formatError.d.ts.map +1 -0
  145. package/dist/utils/formatError.js +10 -0
  146. package/dist/utils/formatError.js.map +1 -0
  147. package/dist/utils/parseRef.d.ts +11 -0
  148. package/dist/utils/parseRef.d.ts.map +1 -0
  149. package/dist/utils/parseRef.js +16 -0
  150. package/dist/utils/parseRef.js.map +1 -0
  151. package/dist/utils/sumTokenMetrics.d.ts +9 -0
  152. package/dist/utils/sumTokenMetrics.d.ts.map +1 -0
  153. package/dist/utils/sumTokenMetrics.js +20 -0
  154. package/dist/utils/sumTokenMetrics.js.map +1 -0
  155. package/dist/utils/topoSort.d.ts +24 -0
  156. package/dist/utils/topoSort.d.ts.map +1 -0
  157. package/dist/utils/topoSort.js +60 -0
  158. package/dist/utils/topoSort.js.map +1 -0
  159. package/dist/validation/ValidationClient.d.ts +51 -0
  160. package/dist/validation/ValidationClient.d.ts.map +1 -0
  161. package/dist/validation/ValidationClient.js +179 -0
  162. package/dist/validation/ValidationClient.js.map +1 -0
  163. package/dist/validation/index.d.ts +2 -0
  164. package/dist/validation/index.d.ts.map +1 -0
  165. package/dist/validation/index.js +2 -0
  166. package/dist/validation/index.js.map +1 -0
  167. package/package.json +76 -0
@@ -0,0 +1,93 @@
1
+ import { UluOpsError } from './UluOpsError.js';
2
+ export { UluOpsError } from './UluOpsError.js';
3
+ /** Thrown when agent/command/workflow execution fails. May include a partial result. */
4
+ export class ExecutionError extends UluOpsError {
5
+ partialResult;
6
+ constructor(message, partialResult, options) {
7
+ super(message, options);
8
+ this.partialResult = partialResult;
9
+ this.name = 'ExecutionError';
10
+ }
11
+ }
12
+ /** Thrown when a preflight check fails (e.g. missing env var, unavailable tool). */
13
+ export class PreflightError extends UluOpsError {
14
+ check;
15
+ details;
16
+ constructor(message, check, details) {
17
+ super(message);
18
+ this.check = check;
19
+ this.details = details;
20
+ this.name = 'PreflightError';
21
+ }
22
+ }
23
+ /** Thrown when the SDK is misconfigured (missing API key, invalid provider, etc.). */
24
+ export class ConfigurationError extends UluOpsError {
25
+ constructor(message) {
26
+ super(message);
27
+ this.name = 'ConfigurationError';
28
+ }
29
+ }
30
+ /** Thrown when a model alias cannot be resolved via the registry model catalog. */
31
+ export class ModelNotFoundError extends UluOpsError {
32
+ constructor(message) {
33
+ super(message);
34
+ this.name = 'ModelNotFoundError';
35
+ }
36
+ }
37
+ /** Thrown when a resolved model lacks a required capability (e.g. tools, vision, extendedThinking). */
38
+ export class CapabilityError extends UluOpsError {
39
+ constructor(message) {
40
+ super(message);
41
+ this.name = 'CapabilityError';
42
+ }
43
+ }
44
+ /**
45
+ * Error codes for validation service errors
46
+ */
47
+ export const ValidationErrorCodes = {
48
+ VALIDATION_ERROR: 'VALIDATION_ERROR',
49
+ NOT_FOUND: 'NOT_FOUND',
50
+ CONFLICT: 'CONFLICT',
51
+ RATE_LIMITED: 'RATE_LIMITED',
52
+ REQUEST_FAILED: 'REQUEST_FAILED',
53
+ SUBMISSION_FAILED: 'SUBMISSION_FAILED',
54
+ UNAUTHORIZED: 'UNAUTHORIZED',
55
+ FORBIDDEN: 'FORBIDDEN',
56
+ };
57
+ /** Thrown when the validation service rejects a submission or returns an error. */
58
+ export class ValidationError extends UluOpsError {
59
+ code;
60
+ constructor(message, code) {
61
+ super(message);
62
+ this.name = 'ValidationError';
63
+ this.code = code;
64
+ }
65
+ }
66
+ /** Thrown when a workflow phase gate fails. Includes partial results for completed phases. */
67
+ export class WorkflowError extends UluOpsError {
68
+ context;
69
+ constructor(message, context) {
70
+ super(message);
71
+ this.context = context;
72
+ this.name = 'WorkflowError';
73
+ }
74
+ }
75
+ /** Thrown when a pipeline stage fails or a pipeline-level error occurs. */
76
+ export class PipelineError extends UluOpsError {
77
+ constructor(message) {
78
+ super(message);
79
+ this.name = 'PipelineError';
80
+ }
81
+ }
82
+ /** Thrown when structured output cannot be extracted from an LLM response. */
83
+ export class ParseError extends UluOpsError {
84
+ contentPreview;
85
+ constructor(message, contentPreview) {
86
+ super(message);
87
+ this.name = 'ParseError';
88
+ this.contentPreview = contentPreview;
89
+ }
90
+ }
91
+ // Re-exports from @uluops/sdk-core
92
+ export { SdkApiError, RateLimitError, UnauthorizedError, ForbiddenError, NotFoundError, ServiceUnavailableError, NetworkError, TimeoutError, } from '@uluops/sdk-core/errors';
93
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,wFAAwF;AACxF,MAAM,OAAO,cAAe,SAAQ,WAAW;IAG3B;IAFlB,YACE,OAAe,EACC,aAAuB,EACvC,OAAsB;QAEtB,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,IAAI,CAAuB;IAE3C,YAAY,OAAe,EAAE,IAA0B;QACrD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,8FAA8F;AAC9F,MAAM,OAAO,aAAc,SAAQ,WAAW;IAG1B;IAFlB,YACE,OAAe,EACC,OAAmC;QAEnD,KAAK,CAAC,OAAO,CAAC,CAAC;QAFC,YAAO,GAAP,OAAO,CAA4B;QAGnD,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AAED,2EAA2E;AAC3E,MAAM,OAAO,aAAc,SAAQ,WAAW;IAC5C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AAED,8EAA8E;AAC9E,MAAM,OAAO,UAAW,SAAQ,WAAW;IAChC,cAAc,CAAS;IAEhC,YAAY,OAAe,EAAE,cAAsB;QACjD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;QACzB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;CACF;AAED,mCAAmC;AACnC,OAAO,EACL,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,uBAAuB,EACvB,YAAY,EACZ,YAAY,GACb,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,57 @@
1
+ import type { AIProvider } from '../ai/AIProvider.js';
2
+ import type { ResolvedConfig } from '../types/config.js';
3
+ import type { ResolvedDefinition } from '../types/registry.js';
4
+ import type { ExecutionInput, ExecutionOptions } from '../types/execution.js';
5
+ import type { AgentResult } from '../types/agent.js';
6
+ import type { Logger } from '@uluops/sdk-core';
7
+ /**
8
+ * Primary executor for single-agent runs.
9
+ *
10
+ * Orchestrates:
11
+ * 1. Prompt rendering from agent definition
12
+ * 2. Tool setup and adaptation for AI SDK
13
+ * 3. LLM generation via AIProvider (tool loop handled by AI SDK)
14
+ * 4. Output parsing and result construction
15
+ *
16
+ * Used directly by `UluOpsClient.runAgent()` and delegated to by
17
+ * `CommandExecutor` for single-agent commands.
18
+ */
19
+ export declare class AgentExecutor {
20
+ private config;
21
+ private aiProvider;
22
+ private logger;
23
+ private outputExtractor;
24
+ constructor(config: ResolvedConfig, aiProvider: AIProvider, logger: Logger);
25
+ /**
26
+ * Execute an agent with optional runtime options
27
+ */
28
+ execute(resolved: ResolvedDefinition, input: ExecutionInput, options?: ExecutionOptions): Promise<AgentResult>;
29
+ /**
30
+ * Merge agent defaults with runtime options.
31
+ * Priority: options > agent defaults > config defaults
32
+ */
33
+ private resolveContext;
34
+ private resolveThresholds;
35
+ /**
36
+ * Build the initial user message with project structure context
37
+ */
38
+ private buildInitialMessage;
39
+ private scanProjectStructure;
40
+ private detectLanguages;
41
+ private buildTreePreview;
42
+ /**
43
+ * Get the appropriate output schema for an agent type.
44
+ */
45
+ private getOutputSchema;
46
+ /**
47
+ * Map structured output to ParsedOutput.
48
+ * Null values from .nullable() fields are converted to undefined.
49
+ */
50
+ private mapStructuredOutput;
51
+ /**
52
+ * Flatten parsed categories → flat Recommendation array
53
+ */
54
+ private flattenRecommendations;
55
+ private calculateEffectiveTokens;
56
+ }
57
+ //# sourceMappingURL=AgentExecutor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentExecutor.d.ts","sourceRoot":"","sources":["../../src/executor/AgentExecutor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAUtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAqC,MAAM,sBAAsB,CAAC;AAClG,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAA4C,MAAM,uBAAuB,CAAC;AACxH,OAAO,KAAK,EAAE,WAAW,EAA6C,MAAM,mBAAmB,CAAC;AAIhG,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;;;;;;;;;;GAWG;AACH,qBAAa,aAAa;IAItB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,MAAM;IALhB,OAAO,CAAC,eAAe,CAAyB;gBAGtC,MAAM,EAAE,cAAc,EACtB,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM;IAGxB;;OAEG;IACG,OAAO,CACX,QAAQ,EAAE,kBAAkB,EAC5B,KAAK,EAAE,cAAc,EACrB,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,WAAW,CAAC;IAmJvB;;;OAGG;IACH,OAAO,CAAC,cAAc;IAsBtB,OAAO,CAAC,iBAAiB;IAUzB;;OAEG;YACW,mBAAmB;YAsBnB,oBAAoB;IA4BlC,OAAO,CAAC,eAAe;IAevB,OAAO,CAAC,gBAAgB;IAUxB;;OAEG;IACH,OAAO,CAAC,eAAe;IAcvB;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAyB3B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IA0B9B,OAAO,CAAC,wBAAwB;CAOjC"}
@@ -0,0 +1,331 @@
1
+ import { ToolHandler, extToLanguage } from './ToolHandler.js';
2
+ import { ToolAdapter } from '../ai/ToolAdapter.js';
3
+ import { TokenBudgetTracker } from '../ai/TokenBudgetTracker.js';
4
+ import { OutputExtractor } from '../parser/OutputExtractor.js';
5
+ import { validatorOutputSchema, executorOutputSchema, genericOutputSchema, } from '../parser/outputSchemas.js';
6
+ /**
7
+ * Primary executor for single-agent runs.
8
+ *
9
+ * Orchestrates:
10
+ * 1. Prompt rendering from agent definition
11
+ * 2. Tool setup and adaptation for AI SDK
12
+ * 3. LLM generation via AIProvider (tool loop handled by AI SDK)
13
+ * 4. Output parsing and result construction
14
+ *
15
+ * Used directly by `UluOpsClient.runAgent()` and delegated to by
16
+ * `CommandExecutor` for single-agent commands.
17
+ */
18
+ export class AgentExecutor {
19
+ config;
20
+ aiProvider;
21
+ logger;
22
+ outputExtractor = new OutputExtractor();
23
+ constructor(config, aiProvider, logger) {
24
+ this.config = config;
25
+ this.aiProvider = aiProvider;
26
+ this.logger = logger;
27
+ }
28
+ /**
29
+ * Execute an agent with optional runtime options
30
+ */
31
+ async execute(resolved, input, options) {
32
+ const startTime = Date.now();
33
+ const agentType = resolved.agentType ?? 'validator';
34
+ this.logger.info(`Agent: ${resolved.name} v${resolved.version} (${agentType})`);
35
+ this.logger.debug(`Target: ${input.target}`);
36
+ // 1. Merge options with agent defaults
37
+ const context = this.resolveContext(resolved, options);
38
+ this.logger.debug(`Context: model=${context.model}, maxSteps=${context.maxSteps}, temp=${context.temperature}, timeout=${context.timeoutMs}ms`);
39
+ // 2. Determine if shell tool should be enabled (opt-in via agent tools list)
40
+ const runtime = resolved.runtime;
41
+ const agentTools = runtime.interface?.tools;
42
+ let additionalTools;
43
+ if (agentTools?.includes('bash')) {
44
+ // Resolve model early to determine the provider for shell tool selection
45
+ const modelInput = options?.model ?? runtime.defaults?.model ?? this.config.ai.modelOverride ?? 'sonnet';
46
+ const resolvedModel = await this.aiProvider.resolveModel(modelInput);
47
+ additionalTools = this.aiProvider.createProviderShellTool(resolvedModel.provider, input.target, context.timeoutMs);
48
+ }
49
+ // 3. Setup tool handler, budget tracker, and AI SDK tool adapter
50
+ const toolHandler = new ToolHandler(input.target, this.logger);
51
+ const contextBudget = this.config.contextBudget;
52
+ const budgetTracker = new TokenBudgetTracker(contextBudget);
53
+ const toolAdapter = new ToolAdapter(toolHandler, additionalTools, budgetTracker);
54
+ // 4. Get the system prompt
55
+ const systemPrompt = runtime.prompt;
56
+ // 5. Build initial context message
57
+ const initialMessage = await this.buildInitialMessage(input, toolHandler);
58
+ // 6. Execute via AI SDK (tool loop handled automatically)
59
+ const outputSchema = this.getOutputSchema(agentType);
60
+ const result = await this.aiProvider.generate({
61
+ model: context.model,
62
+ system: systemPrompt,
63
+ prompt: initialMessage,
64
+ tools: toolAdapter.getTools(),
65
+ maxTokens: context.maxTokens,
66
+ maxSteps: context.maxSteps,
67
+ timeoutMs: context.timeoutMs,
68
+ temperature: context.temperature,
69
+ contextBudget,
70
+ budgetTracker,
71
+ output: outputSchema,
72
+ });
73
+ // 6b. Log raw LLM output for cross-model diagnosis
74
+ const rawText = result.text ?? '';
75
+ this.logger.debug(`Raw output: ${rawText.length} chars, finishReason=${result.finishReason}`);
76
+ if (rawText.length > 0 && rawText.length <= 5000) {
77
+ this.logger.debug(`Raw output text:\n${rawText}`);
78
+ }
79
+ else if (rawText.length > 5000) {
80
+ this.logger.debug(`Raw output (last 2000 chars):\n${rawText.slice(-2000)}`);
81
+ }
82
+ else {
83
+ this.logger.warn('Empty output — model likely hit maxSteps while still calling tools');
84
+ }
85
+ // 7. Parse output — prefer structured output, fall back to extraction
86
+ let parsed;
87
+ let extraction;
88
+ if (result.structuredOutput) {
89
+ parsed = this.mapStructuredOutput(result.structuredOutput, agentType);
90
+ extraction = {
91
+ output: parsed,
92
+ method: 'structured_output',
93
+ confidence: 1.0,
94
+ warnings: [],
95
+ };
96
+ this.logger.info('Output extraction: method=structured_output, confidence=1.0');
97
+ }
98
+ else {
99
+ extraction = this.outputExtractor.extractWithMetadata(result.text, agentType);
100
+ parsed = extraction.output;
101
+ this.logger.info(`Output extraction: method=${extraction.method}, confidence=${extraction.confidence}`);
102
+ }
103
+ this.logger.debug(`Parsed output: decision=${parsed.decision}, score=${parsed.score}, hasRawJson=${!!parsed.rawJson}`);
104
+ if (parsed.rawJson) {
105
+ const keys = Object.keys(parsed.rawJson);
106
+ this.logger.debug(`Raw JSON keys: [${keys.join(', ')}]`);
107
+ this.logger.debug(`Raw JSON sample: ${JSON.stringify(parsed.rawJson).slice(0, 1000)}`);
108
+ }
109
+ if (extraction.warnings.length > 0) {
110
+ this.logger.warn(`Extraction warnings: ${extraction.warnings.join('; ')}`);
111
+ }
112
+ // 7. Build recommendations
113
+ const recommendations = this.flattenRecommendations(parsed, resolved.name);
114
+ this.logger.info(`Result: decision=${parsed.decision}, score=${parsed.score ?? 'N/A'}, recommendations=${recommendations.length}`);
115
+ // 8. Compute metrics
116
+ const durationMs = Date.now() - startTime;
117
+ const metrics = {
118
+ inputTokens: result.usage.input_tokens,
119
+ outputTokens: result.usage.output_tokens,
120
+ cacheCreationTokens: result.usage.cache_creation_input_tokens,
121
+ cacheReadTokens: result.usage.cache_read_input_tokens,
122
+ thinkingTokens: result.usage.thinking_tokens,
123
+ totalEffectiveTokens: this.calculateEffectiveTokens(result.usage),
124
+ durationMs,
125
+ model: result.model,
126
+ toolCallCount: result.toolCallCount,
127
+ };
128
+ // 9. Return discriminated result
129
+ if (agentType === 'validator') {
130
+ return {
131
+ type: 'agent',
132
+ agentType: 'validator',
133
+ name: resolved.name,
134
+ version: resolved.version,
135
+ definitionHash: resolved.hash,
136
+ decision: parsed.decision ?? 'FAIL',
137
+ score: parsed.score ?? 0,
138
+ maxScore: parsed.maxScore ?? 100,
139
+ threshold: context.thresholds?.pass,
140
+ categories: parsed.categories?.map(c => ({
141
+ name: c.name,
142
+ score: c.score,
143
+ maxScore: c.maxPoints,
144
+ findings: c.findings,
145
+ })),
146
+ recommendations,
147
+ durationMs,
148
+ metrics,
149
+ rawOutput: rawText || undefined,
150
+ };
151
+ }
152
+ return {
153
+ type: 'agent',
154
+ agentType: 'executor',
155
+ name: resolved.name,
156
+ version: resolved.version,
157
+ definitionHash: resolved.hash,
158
+ decision: parsed.decision ?? 'FAILED',
159
+ artifacts: parsed.artifacts,
160
+ recommendations,
161
+ durationMs,
162
+ metrics,
163
+ rawOutput: rawText || undefined,
164
+ };
165
+ }
166
+ /**
167
+ * Merge agent defaults with runtime options.
168
+ * Priority: options > agent defaults > config defaults
169
+ */
170
+ resolveContext(resolved, options) {
171
+ const runtime = resolved.runtime;
172
+ const defaults = runtime?.defaults;
173
+ return {
174
+ model: options?.model ?? defaults?.model ?? this.config.ai.modelOverride ?? 'sonnet',
175
+ maxTokens: options?.maxTokens ?? defaults?.maxTokens ?? 8192,
176
+ timeoutMs: options?.timeoutMs ?? defaults?.timeout ?? this.config.timeout ?? 300_000,
177
+ temperature: options?.temperature ?? defaults?.temperature ?? 0,
178
+ maxSteps: options?.maxSteps ?? 50,
179
+ thresholds: this.resolveThresholds(options?.thresholds, defaults && 'thresholds' in defaults ? defaults.thresholds : undefined),
180
+ trackResults: options?.trackResults ?? this.config.trackingEnabled,
181
+ project: options?.project ?? this.config.defaultProject,
182
+ };
183
+ }
184
+ resolveThresholds(optThresholds, defThresholds) {
185
+ const pass = optThresholds?.pass ?? defThresholds?.pass;
186
+ const warn = optThresholds?.warn ?? defThresholds?.warn;
187
+ if (pass === undefined && warn === undefined)
188
+ return undefined;
189
+ return { pass: pass ?? 75, warn: warn ?? 50 };
190
+ }
191
+ /**
192
+ * Build the initial user message with project structure context
193
+ */
194
+ async buildInitialMessage(input, toolHandler) {
195
+ const stats = await this.scanProjectStructure(toolHandler);
196
+ return [
197
+ 'Analyze the following project:',
198
+ '',
199
+ `Target: ${input.target}`,
200
+ '',
201
+ 'Project Structure:',
202
+ stats.tree,
203
+ '',
204
+ 'Statistics:',
205
+ `- Files: ${stats.fileCount}`,
206
+ `- Languages: ${stats.languages.join(', ')}`,
207
+ '',
208
+ `Options: ${JSON.stringify(input.options ?? {})}`,
209
+ '',
210
+ 'Use the provided tools to read files and analyze the codebase.',
211
+ 'Produce your assessment in the required JSON output format.',
212
+ ].join('\n');
213
+ }
214
+ async scanProjectStructure(toolHandler) {
215
+ const files = await toolHandler.fulfill({
216
+ id: 'init',
217
+ name: 'list_files',
218
+ input: { path: '.', pattern: '**/*', max_results: 100 },
219
+ });
220
+ const fileList = files.content.split('\n').filter(Boolean);
221
+ const languages = this.detectLanguages(fileList);
222
+ const tree = this.buildTreePreview(fileList, 20);
223
+ // Count may include "... and N more files" line
224
+ const countLine = fileList.find(l => l.startsWith('... and '));
225
+ let fileCount = fileList.length;
226
+ if (countLine) {
227
+ const match = /\.\.\. and (\d+) more files/.exec(countLine);
228
+ if (match) {
229
+ fileCount = fileList.length - 1 + parseInt(match[1], 10);
230
+ }
231
+ }
232
+ return { tree, fileCount, languages };
233
+ }
234
+ detectLanguages(files) {
235
+ const detected = new Set();
236
+ for (const file of files) {
237
+ // Strip metadata suffix: "file.ts (3.8 KB, 120 lines)" → "file.ts"
238
+ const fileName = file.replace(/\s+\(.*\)$/, '');
239
+ const dotIdx = fileName.lastIndexOf('.');
240
+ if (dotIdx === -1)
241
+ continue;
242
+ const ext = fileName.substring(dotIdx);
243
+ const lang = extToLanguage(ext);
244
+ if (lang !== 'Unknown')
245
+ detected.add(lang);
246
+ }
247
+ return Array.from(detected);
248
+ }
249
+ buildTreePreview(files, maxFiles) {
250
+ const preview = files.slice(0, maxFiles);
251
+ const remaining = files.length - maxFiles;
252
+ let tree = preview.map(f => ` ${f}`).join('\n');
253
+ if (remaining > 0)
254
+ tree += `\n ... and ${remaining} more files`;
255
+ return tree;
256
+ }
257
+ /**
258
+ * Get the appropriate output schema for an agent type.
259
+ */
260
+ getOutputSchema(agentType) {
261
+ switch (agentType) {
262
+ case 'validator':
263
+ return { schema: validatorOutputSchema, name: 'ValidationResult' };
264
+ case 'executor':
265
+ return { schema: executorOutputSchema, name: 'ExecutionResult' };
266
+ case 'analyst':
267
+ case 'generator':
268
+ case 'explorer':
269
+ case 'forecaster':
270
+ return { schema: genericOutputSchema, name: 'AgentResult' };
271
+ }
272
+ }
273
+ /**
274
+ * Map structured output to ParsedOutput.
275
+ * Null values from .nullable() fields are converted to undefined.
276
+ */
277
+ mapStructuredOutput(output, agentType) {
278
+ const base = output;
279
+ const result = {
280
+ decision: base.decision,
281
+ score: base.score,
282
+ maxScore: base.maxScore,
283
+ summary: base.summary ?? undefined,
284
+ rawJson: output,
285
+ };
286
+ if (agentType === 'validator') {
287
+ const v = output;
288
+ if (v.categories) {
289
+ result.categories = v.categories;
290
+ }
291
+ }
292
+ else if (agentType === 'executor') {
293
+ const e = output;
294
+ if (e.artifacts) {
295
+ result.artifacts = e.artifacts;
296
+ }
297
+ }
298
+ return result;
299
+ }
300
+ /**
301
+ * Flatten parsed categories → flat Recommendation array
302
+ */
303
+ flattenRecommendations(parsed, agentName) {
304
+ const recommendations = [];
305
+ for (const category of parsed.categories ?? []) {
306
+ for (const finding of category.findings ?? []) {
307
+ for (const issue of finding.issues ?? []) {
308
+ recommendations.push({
309
+ validator: agentName,
310
+ title: issue.title,
311
+ priority: issue.priority,
312
+ severity: issue.severity,
313
+ failureCode: issue.failureCode,
314
+ filePath: issue.filePath,
315
+ lineNumber: issue.lineNumber,
316
+ description: issue.description,
317
+ });
318
+ }
319
+ }
320
+ }
321
+ return recommendations;
322
+ }
323
+ calculateEffectiveTokens(usage) {
324
+ // reasoning_tokens (OpenAI) excluded: already counted within output_tokens by OpenAI's billing.
325
+ // thinking_tokens (Google) included: charged separately from output_tokens by Google.
326
+ return usage.input_tokens + usage.output_tokens
327
+ + (usage.cache_creation_input_tokens ?? 0)
328
+ + (usage.thinking_tokens ?? 0);
329
+ }
330
+ }
331
+ //# sourceMappingURL=AgentExecutor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AgentExecutor.js","sourceRoot":"","sources":["../../src/executor/AgentExecutor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AAUpC;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,aAAa;IAId;IACA;IACA;I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AwB,CAAC,KAAmB;QAClD,gGAAgG;QAChG,sFAAsF;QACtF,OAAO,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC,aAAa;cAC3C,CAAC,KAAK,CAAC,2BAA2B,IAAI,CAAC,CAAC;cACxC,CAAC,KAAK,CAAC,eAAe,IAAI,CAAC,CAAC,CAAC;IACnC,CAAC;CACF"}
@@ -0,0 +1,33 @@
1
+ import type { AgentExecutor } from './AgentExecutor.js';
2
+ import type { RegistryClient } from '../registry/RegistryClient.js';
3
+ import type { ResolvedDefinition } from '../types/registry.js';
4
+ import type { ExecutionInput } from '../types/execution.js';
5
+ import type { CommandResult } from '../types/command.js';
6
+ /**
7
+ * Executes command definitions.
8
+ *
9
+ * - Single-agent commands: delegates to AgentExecutor
10
+ * - Multi-agent commands: runs agents in sequence, aggregates results
11
+ *
12
+ * Handles preflight checks, model/threshold overrides from command definition,
13
+ * and multi-agent score aggregation.
14
+ */
15
+ export declare class CommandExecutor {
16
+ private agentExecutor;
17
+ private registry;
18
+ constructor(agentExecutor: AgentExecutor, registry: RegistryClient);
19
+ /**
20
+ * Execute a command definition
21
+ */
22
+ execute(resolved: ResolvedDefinition, input: ExecutionInput): Promise<CommandResult>;
23
+ private executeSequentially;
24
+ /**
25
+ * Wrap a single agent result as a CommandResult
26
+ */
27
+ private wrapAgentResult;
28
+ /**
29
+ * Aggregate multiple agent results into a single CommandResult
30
+ */
31
+ private aggregateResults;
32
+ }
33
+ //# sourceMappingURL=CommandExecutor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommandExecutor.d.ts","sourceRoot":"","sources":["../../src/executor/CommandExecutor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAEpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,uBAAuB,CAAC;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAkB,MAAM,qBAAqB,CAAC;AAKzE;;;;;;;;GAQG;AACH,qBAAa,eAAe;IAExB,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,QAAQ;gBADR,aAAa,EAAE,aAAa,EAC5B,QAAQ,EAAE,cAAc;IAGlC;;OAEG;IACG,OAAO,CAAC,QAAQ,EAAE,kBAAkB,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;YAmD5E,mBAAmB;IAWjC;;OAEG;IACH,OAAO,CAAC,eAAe;IA4CvB;;OAEG;IACH,OAAO,CAAC,gBAAgB;CAyFzB"}