@syrin/cli 1.3.1 → 1.4.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.
- package/README.md +36 -0
- package/dist/cli/commands/config.d.ts +47 -0
- package/dist/cli/commands/config.js +360 -0
- package/dist/cli/commands/dev.d.ts +6 -0
- package/dist/cli/commands/dev.js +67 -15
- package/dist/cli/commands/doctor.js +49 -13
- package/dist/cli/commands/init.d.ts +2 -0
- package/dist/cli/commands/init.js +89 -18
- package/dist/cli/commands/status.d.ts +10 -0
- package/dist/cli/commands/status.js +162 -0
- package/dist/cli/index.js +211 -12
- package/dist/cli/prompts/init-prompt.d.ts +18 -0
- package/dist/cli/prompts/init-prompt.js +159 -99
- package/dist/cli/utils/command-error-handler.js +2 -5
- package/dist/config/env-checker.d.ts +12 -2
- package/dist/config/env-checker.js +88 -38
- package/dist/config/env-templates.d.ts +15 -0
- package/dist/config/env-templates.js +49 -0
- package/dist/config/generator.js +17 -0
- package/dist/config/global-loader.d.ts +50 -0
- package/dist/config/global-loader.js +244 -0
- package/dist/config/loader.d.ts +28 -0
- package/dist/config/loader.js +95 -9
- package/dist/config/merger.d.ts +37 -0
- package/dist/config/merger.js +68 -0
- package/dist/config/schema.d.ts +26 -1
- package/dist/config/schema.js +73 -8
- package/dist/config/types.d.ts +19 -0
- package/dist/config/types.js +26 -1
- package/dist/constants/messages.d.ts +7 -0
- package/dist/constants/messages.js +8 -0
- package/dist/constants/paths.d.ts +6 -0
- package/dist/constants/paths.js +10 -0
- package/dist/events/emitter.js +7 -7
- package/dist/index.js +0 -0
- package/dist/presentation/config-ui.d.ts +34 -0
- package/dist/presentation/config-ui.js +139 -0
- package/dist/presentation/doctor-ui.d.ts +11 -0
- package/dist/presentation/doctor-ui.js +52 -1
- package/dist/presentation/init-ui.d.ts +9 -0
- package/dist/presentation/init-ui.js +33 -0
- package/dist/runtime/analysis/analyser.js +2 -2
- package/dist/runtime/analysis/rules/warnings/w104-generic-description.d.ts +1 -1
- package/dist/runtime/analysis/rules/warnings/w104-generic-description.js +1 -1
- package/dist/runtime/dev/event-mapper.js +19 -3
- package/dist/runtime/dev/session.d.ts +4 -0
- package/dist/runtime/dev/session.js +52 -3
- package/dist/runtime/llm/ollama.js +4 -4
- package/dist/runtime/mcp/client/manager.js +3 -3
- package/dist/runtime/sandbox/executor.js +5 -5
- package/dist/runtime/test/orchestrator.js +4 -4
- package/dist/utils/editor.d.ts +37 -0
- package/dist/utils/editor.js +137 -0
- package/dist/utils/logger.d.ts +24 -6
- package/dist/utils/logger.js +51 -8
- package/package.json +4 -4
- package/dist/runtime/analysis/rules/errors/e001-missing-output-schema.d.ts +0 -22
- package/dist/runtime/analysis/rules/errors/e001-missing-output-schema.js +0 -30
- package/dist/runtime/analysis/rules/errors/e002-underspecified-input.d.ts +0 -24
- package/dist/runtime/analysis/rules/errors/e002-underspecified-input.js +0 -52
- package/dist/runtime/analysis/rules/errors/e003-type-mismatch.d.ts +0 -23
- package/dist/runtime/analysis/rules/errors/e003-type-mismatch.js +0 -73
- package/dist/runtime/analysis/rules/errors/e004-free-text-propagation.d.ts +0 -23
- package/dist/runtime/analysis/rules/errors/e004-free-text-propagation.js +0 -47
- package/dist/runtime/analysis/rules/errors/e005-tool-ambiguity.d.ts +0 -25
- package/dist/runtime/analysis/rules/errors/e005-tool-ambiguity.js +0 -73
- package/dist/runtime/analysis/rules/errors/e006-param-not-in-description.d.ts +0 -22
- package/dist/runtime/analysis/rules/errors/e006-param-not-in-description.js +0 -57
- package/dist/runtime/analysis/rules/errors/e007-output-not-guaranteed.d.ts +0 -23
- package/dist/runtime/analysis/rules/errors/e007-output-not-guaranteed.js +0 -56
- package/dist/runtime/analysis/rules/errors/e008-circular-dependency.d.ts +0 -22
- package/dist/runtime/analysis/rules/errors/e008-circular-dependency.js +0 -84
- package/dist/runtime/analysis/rules/errors/e009-implicit-user-input.d.ts +0 -23
- package/dist/runtime/analysis/rules/errors/e009-implicit-user-input.js +0 -89
- package/dist/runtime/analysis/rules/errors/e010-non-serializable.d.ts +0 -25
- package/dist/runtime/analysis/rules/errors/e010-non-serializable.js +0 -46
- package/dist/runtime/analysis/rules/errors/e011-missing-tool-description.d.ts +0 -24
- package/dist/runtime/analysis/rules/errors/e011-missing-tool-description.js +0 -33
- package/dist/runtime/analysis/rules/errors/e012-side-effect-detected.d.ts +0 -39
- package/dist/runtime/analysis/rules/errors/e012-side-effect-detected.js +0 -40
- package/dist/runtime/analysis/rules/errors/e013-non-deterministic-output.d.ts +0 -37
- package/dist/runtime/analysis/rules/errors/e013-non-deterministic-output.js +0 -34
- package/dist/runtime/analysis/rules/errors/e013-output-explosion.d.ts +0 -39
- package/dist/runtime/analysis/rules/errors/e013-output-explosion.js +0 -36
- package/dist/runtime/analysis/rules/errors/e014-hidden-dependency.d.ts +0 -42
- package/dist/runtime/analysis/rules/errors/e014-hidden-dependency.js +0 -46
- package/dist/runtime/analysis/rules/errors/e014-output-explosion.d.ts +0 -39
- package/dist/runtime/analysis/rules/errors/e014-output-explosion.js +0 -36
- package/dist/runtime/analysis/rules/errors/e015-hidden-dependency.d.ts +0 -42
- package/dist/runtime/analysis/rules/errors/e015-hidden-dependency.js +0 -46
- package/dist/runtime/analysis/rules/errors/e015-unbounded-execution.d.ts +0 -44
- package/dist/runtime/analysis/rules/errors/e015-unbounded-execution.js +0 -66
- package/dist/runtime/analysis/rules/errors/e016-output-validation-failed.d.ts +0 -43
- package/dist/runtime/analysis/rules/errors/e016-output-validation-failed.js +0 -42
- package/dist/runtime/analysis/rules/errors/e016-unbounded-execution.d.ts +0 -44
- package/dist/runtime/analysis/rules/errors/e016-unbounded-execution.js +0 -66
- package/dist/runtime/analysis/rules/errors/e017-input-validation-failed.d.ts +0 -57
- package/dist/runtime/analysis/rules/errors/e017-input-validation-failed.js +0 -80
- package/dist/runtime/analysis/rules/errors/e017-output-validation-failed.d.ts +0 -43
- package/dist/runtime/analysis/rules/errors/e017-output-validation-failed.js +0 -42
- package/dist/runtime/analysis/rules/errors/e018-input-validation-failed.d.ts +0 -57
- package/dist/runtime/analysis/rules/errors/e018-input-validation-failed.js +0 -80
- package/dist/runtime/analysis/rules/errors/e018-tool-execution-failed.d.ts +0 -38
- package/dist/runtime/analysis/rules/errors/e018-tool-execution-failed.js +0 -37
- package/dist/runtime/analysis/rules/errors/e019-tool-execution-failed.d.ts +0 -38
- package/dist/runtime/analysis/rules/errors/e019-tool-execution-failed.js +0 -37
- package/dist/runtime/analysis/rules/errors/e019-unexpected-test-result.d.ts +0 -65
- package/dist/runtime/analysis/rules/errors/e019-unexpected-test-result.js +0 -109
- package/dist/runtime/analysis/rules/errors/e020-unexpected-test-result.d.ts +0 -65
- package/dist/runtime/analysis/rules/errors/e020-unexpected-test-result.js +0 -109
- package/dist/runtime/analysis/rules/warnings/w001-implicit-dependency.d.ts +0 -22
- package/dist/runtime/analysis/rules/warnings/w001-implicit-dependency.js +0 -39
- package/dist/runtime/analysis/rules/warnings/w002-free-text-without-normalization.d.ts +0 -24
- package/dist/runtime/analysis/rules/warnings/w002-free-text-without-normalization.js +0 -40
- package/dist/runtime/analysis/rules/warnings/w003-missing-examples.d.ts +0 -22
- package/dist/runtime/analysis/rules/warnings/w003-missing-examples.js +0 -84
- package/dist/runtime/analysis/rules/warnings/w004-overloaded-responsibility.d.ts +0 -23
- package/dist/runtime/analysis/rules/warnings/w004-overloaded-responsibility.js +0 -96
- package/dist/runtime/analysis/rules/warnings/w005-generic-description.d.ts +0 -53
- package/dist/runtime/analysis/rules/warnings/w005-generic-description.js +0 -108
- package/dist/runtime/analysis/rules/warnings/w006-optional-as-required.d.ts +0 -22
- package/dist/runtime/analysis/rules/warnings/w006-optional-as-required.js +0 -44
- package/dist/runtime/analysis/rules/warnings/w007-broad-output-schema.d.ts +0 -23
- package/dist/runtime/analysis/rules/warnings/w007-broad-output-schema.js +0 -37
- package/dist/runtime/analysis/rules/warnings/w008-multiple-entry-points.d.ts +0 -22
- package/dist/runtime/analysis/rules/warnings/w008-multiple-entry-points.js +0 -97
- package/dist/runtime/analysis/rules/warnings/w009-hidden-side-effects.d.ts +0 -23
- package/dist/runtime/analysis/rules/warnings/w009-hidden-side-effects.js +0 -88
- package/dist/runtime/analysis/rules/warnings/w010-output-not-reusable.d.ts +0 -22
- package/dist/runtime/analysis/rules/warnings/w010-output-not-reusable.js +0 -81
- package/dist/runtime/analysis/rules/warnings/w021-weak-schema.d.ts +0 -40
- package/dist/runtime/analysis/rules/warnings/w021-weak-schema.js +0 -32
- package/dist/runtime/analysis/rules/warnings/w022-high-entropy-output.d.ts +0 -39
- package/dist/runtime/analysis/rules/warnings/w022-high-entropy-output.js +0 -36
- package/dist/runtime/analysis/rules/warnings/w023-unstable-defaults.d.ts +0 -38
- package/dist/runtime/analysis/rules/warnings/w023-unstable-defaults.js +0 -36
- package/dist/runtime/test/dependency-tracker.d.ts +0 -66
- package/dist/runtime/test/dependency-tracker.js +0 -80
- package/dist/runtime/test/formatters.d.ts +0 -18
- package/dist/runtime/test/formatters.js +0 -172
- package/dist/runtime/test/input-generator.d.ts +0 -33
- package/dist/runtime/test/input-generator.js +0 -498
- package/dist/runtime/test/mcp-root-detector.d.ts +0 -31
- package/dist/runtime/test/mcp-root-detector.js +0 -105
- package/dist/runtime/test/retry-tester.d.ts +0 -44
- package/dist/runtime/test/retry-tester.js +0 -103
- package/dist/runtime/test/synthetic-input-generator.d.ts +0 -11
- package/dist/runtime/test/synthetic-input-generator.js +0 -154
- package/dist/runtime/test/test-runner.d.ts +0 -28
- package/dist/runtime/test/test-runner.js +0 -55
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* E016: Unbounded Execution
|
|
3
|
-
*
|
|
4
|
-
* Condition: Tool execution timed out or failed to terminate
|
|
5
|
-
*
|
|
6
|
-
* Why this is fatal:
|
|
7
|
-
* - Tool may hang indefinitely
|
|
8
|
-
* - Breaks agent reliability
|
|
9
|
-
* - Indicates design issue (missing timeouts, infinite loops)
|
|
10
|
-
*/
|
|
11
|
-
import { BaseRule } from '../base.js';
|
|
12
|
-
import type { AnalysisContext, Diagnostic } from '../../types.js';
|
|
13
|
-
/**
|
|
14
|
-
* Context for unbounded execution detection.
|
|
15
|
-
*/
|
|
16
|
-
export interface UnboundedExecutionContext {
|
|
17
|
-
/** Tool name */
|
|
18
|
-
toolName: string;
|
|
19
|
-
/** Whether execution timed out */
|
|
20
|
-
timedOut: boolean;
|
|
21
|
-
/** Declared max execution time (e.g., "5m", "2h") or undefined if using default */
|
|
22
|
-
declaredTimeout?: string;
|
|
23
|
-
/** Actual timeout used in milliseconds */
|
|
24
|
-
actualTimeoutMs?: number;
|
|
25
|
-
/** Execution errors */
|
|
26
|
-
errors: Array<{
|
|
27
|
-
message: string;
|
|
28
|
-
code?: string;
|
|
29
|
-
}>;
|
|
30
|
-
}
|
|
31
|
-
declare class E016UnboundedExecutionRule extends BaseRule {
|
|
32
|
-
readonly id: "E016";
|
|
33
|
-
readonly severity: "error";
|
|
34
|
-
readonly ruleName = "Unbounded Execution";
|
|
35
|
-
readonly description = "Tool execution timed out or failed to terminate. Tool may hang indefinitely, breaking agent reliability.";
|
|
36
|
-
check(_ctx: AnalysisContext): Diagnostic[];
|
|
37
|
-
/**
|
|
38
|
-
* Check with behavioral context (called from test orchestrator).
|
|
39
|
-
*/
|
|
40
|
-
checkWithBehavioralContext(behavioralCtx: UnboundedExecutionContext): Diagnostic[];
|
|
41
|
-
}
|
|
42
|
-
export declare const E016UnboundedExecution: E016UnboundedExecutionRule;
|
|
43
|
-
export {};
|
|
44
|
-
//# sourceMappingURL=e016-unbounded-execution.d.ts.map
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* E016: Unbounded Execution
|
|
3
|
-
*
|
|
4
|
-
* Condition: Tool execution timed out or failed to terminate
|
|
5
|
-
*
|
|
6
|
-
* Why this is fatal:
|
|
7
|
-
* - Tool may hang indefinitely
|
|
8
|
-
* - Breaks agent reliability
|
|
9
|
-
* - Indicates design issue (missing timeouts, infinite loops)
|
|
10
|
-
*/
|
|
11
|
-
import { BaseRule } from '../base.js';
|
|
12
|
-
import { ERROR_CODES } from '../error-codes.js';
|
|
13
|
-
/**
|
|
14
|
-
* Format timeout in milliseconds to human-readable string.
|
|
15
|
-
*/
|
|
16
|
-
function formatTimeout(ms) {
|
|
17
|
-
if (ms < 1000) {
|
|
18
|
-
return `${ms}ms`;
|
|
19
|
-
}
|
|
20
|
-
const s = Math.floor(ms / 1000);
|
|
21
|
-
if (s < 60) {
|
|
22
|
-
return `${s}s`;
|
|
23
|
-
}
|
|
24
|
-
const m = Math.floor(s / 60);
|
|
25
|
-
if (m < 60) {
|
|
26
|
-
return `${m}m`;
|
|
27
|
-
}
|
|
28
|
-
const h = Math.floor(m / 60);
|
|
29
|
-
return `${h}h`;
|
|
30
|
-
}
|
|
31
|
-
class E016UnboundedExecutionRule extends BaseRule {
|
|
32
|
-
id = ERROR_CODES.E016;
|
|
33
|
-
severity = 'error';
|
|
34
|
-
ruleName = 'Unbounded Execution';
|
|
35
|
-
description = 'Tool execution timed out or failed to terminate. Tool may hang indefinitely, breaking agent reliability.';
|
|
36
|
-
check(_ctx) {
|
|
37
|
-
// This rule requires behavioral context
|
|
38
|
-
return [];
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Check with behavioral context (called from test orchestrator).
|
|
42
|
-
*/
|
|
43
|
-
checkWithBehavioralContext(behavioralCtx) {
|
|
44
|
-
const diagnostics = [];
|
|
45
|
-
if (behavioralCtx.timedOut) {
|
|
46
|
-
const timeoutInfo = behavioralCtx.declaredTimeout
|
|
47
|
-
? ` (exceeded declared timeout: ${behavioralCtx.declaredTimeout})`
|
|
48
|
-
: behavioralCtx.actualTimeoutMs
|
|
49
|
-
? ` (exceeded default timeout: ${formatTimeout(behavioralCtx.actualTimeoutMs)})`
|
|
50
|
-
: '';
|
|
51
|
-
const suggestion = behavioralCtx.declaredTimeout
|
|
52
|
-
? `Tool exceeded its declared max_execution_time (${behavioralCtx.declaredTimeout}). Either fix the tool to complete within this time, or update the contract if a longer timeout is legitimate.`
|
|
53
|
-
: 'Add timeouts, fix infinite loops, or optimize slow operations. If tool legitimately takes longer, declare max_execution_time in contract (e.g., "5m", "2h").';
|
|
54
|
-
diagnostics.push(this.createDiagnostic(`Tool "${behavioralCtx.toolName}" execution timed out${timeoutInfo}. Tool may hang indefinitely.`, behavioralCtx.toolName, undefined, suggestion));
|
|
55
|
-
}
|
|
56
|
-
if (behavioralCtx.errors.length > 0 && !behavioralCtx.timedOut) {
|
|
57
|
-
const errorMessages = behavioralCtx.errors
|
|
58
|
-
.map(e => ` - ${e.message}`)
|
|
59
|
-
.join('\n');
|
|
60
|
-
diagnostics.push(this.createDiagnostic(`Tool "${behavioralCtx.toolName}" execution failed:\n${errorMessages}`, behavioralCtx.toolName, undefined, 'Fix tool implementation errors. Ensure tool handles all input cases gracefully.'));
|
|
61
|
-
}
|
|
62
|
-
return diagnostics;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
export const E016UnboundedExecution = new E016UnboundedExecutionRule();
|
|
66
|
-
//# sourceMappingURL=e016-unbounded-execution.js.map
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* E017: Input Validation Failed
|
|
3
|
-
*
|
|
4
|
-
* Condition: Tool input doesn't match declared input schema
|
|
5
|
-
*
|
|
6
|
-
* Why this is fatal:
|
|
7
|
-
* - Tool contract is inaccurate
|
|
8
|
-
* - Tool doesn't handle invalid inputs gracefully
|
|
9
|
-
* - Can cause runtime errors in production
|
|
10
|
-
* - Indicates missing input validation or schema mismatch
|
|
11
|
-
*/
|
|
12
|
-
import { BaseRule } from '../base.js';
|
|
13
|
-
import type { AnalysisContext, Diagnostic } from '../../types.js';
|
|
14
|
-
/**
|
|
15
|
-
* Context for input validation failure detection.
|
|
16
|
-
*/
|
|
17
|
-
export interface InputValidationContext {
|
|
18
|
-
/** Tool name */
|
|
19
|
-
toolName: string;
|
|
20
|
-
/** Test name (if applicable) */
|
|
21
|
-
testName?: string;
|
|
22
|
-
/** Test input that caused the failure */
|
|
23
|
-
testInput?: Record<string, unknown>;
|
|
24
|
-
/** Validation error details */
|
|
25
|
-
error?: string;
|
|
26
|
-
/** Parsed error details (field, message, etc.) */
|
|
27
|
-
parsedError?: {
|
|
28
|
-
field?: string;
|
|
29
|
-
message?: string;
|
|
30
|
-
inputValue?: string;
|
|
31
|
-
inputType?: string;
|
|
32
|
-
errorType?: string;
|
|
33
|
-
};
|
|
34
|
-
/** Additional validation details */
|
|
35
|
-
details?: Record<string, unknown>;
|
|
36
|
-
}
|
|
37
|
-
declare class E017InputValidationFailedRule extends BaseRule {
|
|
38
|
-
readonly id: "E017";
|
|
39
|
-
readonly severity: "error";
|
|
40
|
-
readonly ruleName = "Input Validation Failed";
|
|
41
|
-
readonly description = "Tool input doesn't match declared input schema. Tool doesn't handle invalid inputs gracefully.";
|
|
42
|
-
check(_ctx: AnalysisContext): Diagnostic[];
|
|
43
|
-
/**
|
|
44
|
-
* Build parsed error message fragment for a field.
|
|
45
|
-
* @param parsed - Parsed error details
|
|
46
|
-
* @param baseError - Base error message as fallback
|
|
47
|
-
* @returns Error message fragment describing the field validation issue
|
|
48
|
-
*/
|
|
49
|
-
private buildParsedErrorMessage;
|
|
50
|
-
/**
|
|
51
|
-
* Check with behavioral context (called from test orchestrator).
|
|
52
|
-
*/
|
|
53
|
-
checkWithBehavioralContext(behavioralCtx: InputValidationContext): Diagnostic[];
|
|
54
|
-
}
|
|
55
|
-
export declare const E017InputValidationFailed: E017InputValidationFailedRule;
|
|
56
|
-
export {};
|
|
57
|
-
//# sourceMappingURL=e017-input-validation-failed.d.ts.map
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* E017: Input Validation Failed
|
|
3
|
-
*
|
|
4
|
-
* Condition: Tool input doesn't match declared input schema
|
|
5
|
-
*
|
|
6
|
-
* Why this is fatal:
|
|
7
|
-
* - Tool contract is inaccurate
|
|
8
|
-
* - Tool doesn't handle invalid inputs gracefully
|
|
9
|
-
* - Can cause runtime errors in production
|
|
10
|
-
* - Indicates missing input validation or schema mismatch
|
|
11
|
-
*/
|
|
12
|
-
import { BaseRule } from '../base.js';
|
|
13
|
-
import { ERROR_CODES } from '../error-codes.js';
|
|
14
|
-
class E017InputValidationFailedRule extends BaseRule {
|
|
15
|
-
id = ERROR_CODES.E017;
|
|
16
|
-
severity = 'error';
|
|
17
|
-
ruleName = 'Input Validation Failed';
|
|
18
|
-
description = "Tool input doesn't match declared input schema. Tool doesn't handle invalid inputs gracefully.";
|
|
19
|
-
check(_ctx) {
|
|
20
|
-
// This rule requires behavioral context
|
|
21
|
-
return [];
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Build parsed error message fragment for a field.
|
|
25
|
-
* @param parsed - Parsed error details
|
|
26
|
-
* @param baseError - Base error message as fallback
|
|
27
|
-
* @returns Error message fragment describing the field validation issue
|
|
28
|
-
*/
|
|
29
|
-
buildParsedErrorMessage(parsed, baseError) {
|
|
30
|
-
if (!parsed?.field) {
|
|
31
|
-
return baseError;
|
|
32
|
-
}
|
|
33
|
-
if (parsed.message && parsed.inputType) {
|
|
34
|
-
return `Field "${parsed.field}" - ${parsed.message} (received invalid type ${parsed.inputType})`;
|
|
35
|
-
}
|
|
36
|
-
else if (parsed.message) {
|
|
37
|
-
return `Field "${parsed.field}" - ${parsed.message}`;
|
|
38
|
-
}
|
|
39
|
-
else if (parsed.inputType) {
|
|
40
|
-
return `Field "${parsed.field}" received invalid type ${parsed.inputType}`;
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
return baseError;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Check with behavioral context (called from test orchestrator).
|
|
48
|
-
*/
|
|
49
|
-
checkWithBehavioralContext(behavioralCtx) {
|
|
50
|
-
const diagnostics = [];
|
|
51
|
-
// Build a clear error message
|
|
52
|
-
const baseError = behavioralCtx.error || 'Invalid input';
|
|
53
|
-
const parsedMessage = this.buildParsedErrorMessage(behavioralCtx.parsedError, baseError);
|
|
54
|
-
let message;
|
|
55
|
-
if (behavioralCtx.testName) {
|
|
56
|
-
// Test-specific error message
|
|
57
|
-
if (behavioralCtx.parsedError?.field) {
|
|
58
|
-
message = `Test "${behavioralCtx.testName}" in tool "${behavioralCtx.toolName}" input validation failed: ${parsedMessage}`;
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
message = `Test "${behavioralCtx.testName}" in tool "${behavioralCtx.toolName}" input validation failed: ${baseError}`;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
else if (behavioralCtx.parsedError?.field) {
|
|
65
|
-
message = `Tool "${behavioralCtx.toolName}" input validation failed: ${parsedMessage}`;
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
message = `Tool "${behavioralCtx.toolName}" input validation failed: ${baseError}`;
|
|
69
|
-
}
|
|
70
|
-
diagnostics.push(this.createDiagnostic(message, behavioralCtx.toolName, undefined, 'Fix input validation to handle edge cases gracefully, update input schema to match actual validation, or add proper error handling for invalid inputs.', {
|
|
71
|
-
testName: behavioralCtx.testName,
|
|
72
|
-
testInput: behavioralCtx.testInput,
|
|
73
|
-
parsedError: behavioralCtx.parsedError,
|
|
74
|
-
...behavioralCtx.details,
|
|
75
|
-
}));
|
|
76
|
-
return diagnostics;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
export const E017InputValidationFailed = new E017InputValidationFailedRule();
|
|
80
|
-
//# sourceMappingURL=e017-input-validation-failed.js.map
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* E017: Output Structure Validation Failed
|
|
3
|
-
*
|
|
4
|
-
* Condition: Tool output doesn't match declared output schema
|
|
5
|
-
*
|
|
6
|
-
* Why this is fatal:
|
|
7
|
-
* - Tool contract is inaccurate
|
|
8
|
-
* - Breaks agent's ability to reason about tool outputs
|
|
9
|
-
* - Can cause downstream errors in tool chains
|
|
10
|
-
*/
|
|
11
|
-
import { BaseRule } from '../base.js';
|
|
12
|
-
import type { AnalysisContext, Diagnostic } from '../../types.js';
|
|
13
|
-
/**
|
|
14
|
-
* Context for output validation failure detection.
|
|
15
|
-
*/
|
|
16
|
-
export interface OutputValidationContext {
|
|
17
|
-
/** Tool name */
|
|
18
|
-
toolName: string;
|
|
19
|
-
/** Test name (if applicable) */
|
|
20
|
-
testName?: string;
|
|
21
|
-
/** Test input that caused the failure */
|
|
22
|
-
testInput?: Record<string, unknown>;
|
|
23
|
-
/** Expected output schema name */
|
|
24
|
-
expectedOutputSchema?: string;
|
|
25
|
-
/** Validation error details */
|
|
26
|
-
error?: string;
|
|
27
|
-
/** Additional validation details */
|
|
28
|
-
details?: Record<string, unknown>;
|
|
29
|
-
}
|
|
30
|
-
declare class E017OutputValidationFailedRule extends BaseRule {
|
|
31
|
-
readonly id: "E017";
|
|
32
|
-
readonly severity: "error";
|
|
33
|
-
readonly ruleName = "Output Structure Validation Failed";
|
|
34
|
-
readonly description = "Tool output doesn't match declared output schema. This breaks agent's ability to reason about tool outputs.";
|
|
35
|
-
check(_ctx: AnalysisContext): Diagnostic[];
|
|
36
|
-
/**
|
|
37
|
-
* Check with behavioral context (called from test orchestrator).
|
|
38
|
-
*/
|
|
39
|
-
checkWithBehavioralContext(behavioralCtx: OutputValidationContext): Diagnostic[];
|
|
40
|
-
}
|
|
41
|
-
export declare const E017OutputValidationFailed: E017OutputValidationFailedRule;
|
|
42
|
-
export {};
|
|
43
|
-
//# sourceMappingURL=e017-output-validation-failed.d.ts.map
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* E017: Output Structure Validation Failed
|
|
3
|
-
*
|
|
4
|
-
* Condition: Tool output doesn't match declared output schema
|
|
5
|
-
*
|
|
6
|
-
* Why this is fatal:
|
|
7
|
-
* - Tool contract is inaccurate
|
|
8
|
-
* - Breaks agent's ability to reason about tool outputs
|
|
9
|
-
* - Can cause downstream errors in tool chains
|
|
10
|
-
*/
|
|
11
|
-
import { BaseRule } from '../base.js';
|
|
12
|
-
import { ERROR_CODES } from '../error-codes.js';
|
|
13
|
-
class E017OutputValidationFailedRule extends BaseRule {
|
|
14
|
-
id = ERROR_CODES.E017;
|
|
15
|
-
severity = 'error';
|
|
16
|
-
ruleName = 'Output Structure Validation Failed';
|
|
17
|
-
description = "Tool output doesn't match declared output schema. This breaks agent's ability to reason about tool outputs.";
|
|
18
|
-
check(_ctx) {
|
|
19
|
-
// This rule requires behavioral context
|
|
20
|
-
return [];
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Check with behavioral context (called from test orchestrator).
|
|
24
|
-
*/
|
|
25
|
-
checkWithBehavioralContext(behavioralCtx) {
|
|
26
|
-
const diagnostics = [];
|
|
27
|
-
const errorMessage = behavioralCtx.error || 'Output structure does not match schema';
|
|
28
|
-
let message = `Tool "${behavioralCtx.toolName}" output validation failed: ${errorMessage}`;
|
|
29
|
-
if (behavioralCtx.testName) {
|
|
30
|
-
message = `Test "${behavioralCtx.testName}" in tool "${behavioralCtx.toolName}" output validation failed: ${errorMessage}`;
|
|
31
|
-
}
|
|
32
|
-
diagnostics.push(this.createDiagnostic(message, behavioralCtx.toolName, undefined, 'Fix output structure to match declared schema or update schema to match actual output. Ensure output schema accurately reflects tool behavior.', {
|
|
33
|
-
testName: behavioralCtx.testName,
|
|
34
|
-
testInput: behavioralCtx.testInput,
|
|
35
|
-
expectedOutputSchema: behavioralCtx.expectedOutputSchema,
|
|
36
|
-
...behavioralCtx.details,
|
|
37
|
-
}));
|
|
38
|
-
return diagnostics;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
export const E017OutputValidationFailed = new E017OutputValidationFailedRule();
|
|
42
|
-
//# sourceMappingURL=e017-output-validation-failed.js.map
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* E018: Input Validation Failed
|
|
3
|
-
*
|
|
4
|
-
* Condition: Tool input doesn't match declared input schema
|
|
5
|
-
*
|
|
6
|
-
* Why this is fatal:
|
|
7
|
-
* - Tool contract is inaccurate
|
|
8
|
-
* - Tool doesn't handle invalid inputs gracefully
|
|
9
|
-
* - Can cause runtime errors in production
|
|
10
|
-
* - Indicates missing input validation or schema mismatch
|
|
11
|
-
*/
|
|
12
|
-
import { BaseRule } from '../base.js';
|
|
13
|
-
import type { AnalysisContext, Diagnostic } from '../../types.js';
|
|
14
|
-
/**
|
|
15
|
-
* Context for input validation failure detection.
|
|
16
|
-
*/
|
|
17
|
-
export interface InputValidationContext {
|
|
18
|
-
/** Tool name */
|
|
19
|
-
toolName: string;
|
|
20
|
-
/** Test name (if applicable) */
|
|
21
|
-
testName?: string;
|
|
22
|
-
/** Test input that caused the failure */
|
|
23
|
-
testInput?: Record<string, unknown>;
|
|
24
|
-
/** Validation error details */
|
|
25
|
-
error?: string;
|
|
26
|
-
/** Parsed error details (field, message, etc.) */
|
|
27
|
-
parsedError?: {
|
|
28
|
-
field?: string;
|
|
29
|
-
message?: string;
|
|
30
|
-
inputValue?: string;
|
|
31
|
-
inputType?: string;
|
|
32
|
-
errorType?: string;
|
|
33
|
-
};
|
|
34
|
-
/** Additional validation details */
|
|
35
|
-
details?: Record<string, unknown>;
|
|
36
|
-
}
|
|
37
|
-
declare class E018InputValidationFailedRule extends BaseRule {
|
|
38
|
-
readonly id: "E018";
|
|
39
|
-
readonly severity: "error";
|
|
40
|
-
readonly ruleName = "Input Validation Failed";
|
|
41
|
-
readonly description = "Tool input doesn't match declared input schema. Tool doesn't handle invalid inputs gracefully.";
|
|
42
|
-
check(_ctx: AnalysisContext): Diagnostic[];
|
|
43
|
-
/**
|
|
44
|
-
* Build parsed error message fragment for a field.
|
|
45
|
-
* @param parsed - Parsed error details
|
|
46
|
-
* @param baseError - Base error message as fallback
|
|
47
|
-
* @returns Error message fragment describing the field validation issue
|
|
48
|
-
*/
|
|
49
|
-
private buildParsedErrorMessage;
|
|
50
|
-
/**
|
|
51
|
-
* Check with behavioral context (called from test orchestrator).
|
|
52
|
-
*/
|
|
53
|
-
checkWithBehavioralContext(behavioralCtx: InputValidationContext): Diagnostic[];
|
|
54
|
-
}
|
|
55
|
-
export declare const E018InputValidationFailed: E018InputValidationFailedRule;
|
|
56
|
-
export {};
|
|
57
|
-
//# sourceMappingURL=e018-input-validation-failed.d.ts.map
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* E018: Input Validation Failed
|
|
3
|
-
*
|
|
4
|
-
* Condition: Tool input doesn't match declared input schema
|
|
5
|
-
*
|
|
6
|
-
* Why this is fatal:
|
|
7
|
-
* - Tool contract is inaccurate
|
|
8
|
-
* - Tool doesn't handle invalid inputs gracefully
|
|
9
|
-
* - Can cause runtime errors in production
|
|
10
|
-
* - Indicates missing input validation or schema mismatch
|
|
11
|
-
*/
|
|
12
|
-
import { BaseRule } from '../base.js';
|
|
13
|
-
import { ERROR_CODES } from '../error-codes.js';
|
|
14
|
-
class E018InputValidationFailedRule extends BaseRule {
|
|
15
|
-
id = ERROR_CODES.E018;
|
|
16
|
-
severity = 'error';
|
|
17
|
-
ruleName = 'Input Validation Failed';
|
|
18
|
-
description = "Tool input doesn't match declared input schema. Tool doesn't handle invalid inputs gracefully.";
|
|
19
|
-
check(_ctx) {
|
|
20
|
-
// This rule requires behavioral context
|
|
21
|
-
return [];
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Build parsed error message fragment for a field.
|
|
25
|
-
* @param parsed - Parsed error details
|
|
26
|
-
* @param baseError - Base error message as fallback
|
|
27
|
-
* @returns Error message fragment describing the field validation issue
|
|
28
|
-
*/
|
|
29
|
-
buildParsedErrorMessage(parsed, baseError) {
|
|
30
|
-
if (!parsed?.field) {
|
|
31
|
-
return baseError;
|
|
32
|
-
}
|
|
33
|
-
if (parsed.message && parsed.inputType) {
|
|
34
|
-
return `Field "${parsed.field}" - ${parsed.message} (received invalid type ${parsed.inputType})`;
|
|
35
|
-
}
|
|
36
|
-
else if (parsed.message) {
|
|
37
|
-
return `Field "${parsed.field}" - ${parsed.message}`;
|
|
38
|
-
}
|
|
39
|
-
else if (parsed.inputType) {
|
|
40
|
-
return `Field "${parsed.field}" received invalid type ${parsed.inputType}`;
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
return baseError;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Check with behavioral context (called from test orchestrator).
|
|
48
|
-
*/
|
|
49
|
-
checkWithBehavioralContext(behavioralCtx) {
|
|
50
|
-
const diagnostics = [];
|
|
51
|
-
// Build a clear error message
|
|
52
|
-
const baseError = behavioralCtx.error || 'Invalid input';
|
|
53
|
-
const parsedMessage = this.buildParsedErrorMessage(behavioralCtx.parsedError, baseError);
|
|
54
|
-
let message;
|
|
55
|
-
if (behavioralCtx.testName) {
|
|
56
|
-
// Test-specific error message
|
|
57
|
-
if (behavioralCtx.parsedError?.field) {
|
|
58
|
-
message = `Test "${behavioralCtx.testName}" in tool "${behavioralCtx.toolName}" input validation failed: ${parsedMessage}`;
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
message = `Test "${behavioralCtx.testName}" in tool "${behavioralCtx.toolName}" input validation failed: ${baseError}`;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
else if (behavioralCtx.parsedError?.field) {
|
|
65
|
-
message = `Tool "${behavioralCtx.toolName}" input validation failed: ${parsedMessage}`;
|
|
66
|
-
}
|
|
67
|
-
else {
|
|
68
|
-
message = `Tool "${behavioralCtx.toolName}" input validation failed: ${baseError}`;
|
|
69
|
-
}
|
|
70
|
-
diagnostics.push(this.createDiagnostic(message, behavioralCtx.toolName, undefined, 'Fix input validation to handle edge cases gracefully, update input schema to match actual validation, or add proper error handling for invalid inputs.', {
|
|
71
|
-
testName: behavioralCtx.testName,
|
|
72
|
-
testInput: behavioralCtx.testInput,
|
|
73
|
-
parsedError: behavioralCtx.parsedError,
|
|
74
|
-
...behavioralCtx.details,
|
|
75
|
-
}));
|
|
76
|
-
return diagnostics;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
export const E018InputValidationFailed = new E018InputValidationFailedRule();
|
|
80
|
-
//# sourceMappingURL=e018-input-validation-failed.js.map
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* E018: Tool Execution Failed
|
|
3
|
-
*
|
|
4
|
-
* Condition: Tool raises an exception during execution
|
|
5
|
-
*
|
|
6
|
-
* Why this is fatal:
|
|
7
|
-
* - Tool crashes instead of handling errors gracefully
|
|
8
|
-
* - Breaks agent reliability
|
|
9
|
-
* - Indicates missing error handling or input validation
|
|
10
|
-
*/
|
|
11
|
-
import { BaseRule } from '../base.js';
|
|
12
|
-
import type { AnalysisContext, Diagnostic } from '../../types.js';
|
|
13
|
-
/**
|
|
14
|
-
* Context for execution error detection.
|
|
15
|
-
*/
|
|
16
|
-
export interface ExecutionErrorContext {
|
|
17
|
-
/** Tool name */
|
|
18
|
-
toolName: string;
|
|
19
|
-
/** Execution errors */
|
|
20
|
-
errors: Array<{
|
|
21
|
-
message: string;
|
|
22
|
-
code?: string;
|
|
23
|
-
}>;
|
|
24
|
-
}
|
|
25
|
-
declare class E018ToolExecutionFailedRule extends BaseRule {
|
|
26
|
-
readonly id: "E018";
|
|
27
|
-
readonly severity: "error";
|
|
28
|
-
readonly ruleName = "Tool Execution Failed";
|
|
29
|
-
readonly description = "Tool raises an exception during execution. Tool should handle errors gracefully instead of crashing.";
|
|
30
|
-
check(_ctx: AnalysisContext): Diagnostic[];
|
|
31
|
-
/**
|
|
32
|
-
* Check with behavioral context (called from test orchestrator).
|
|
33
|
-
*/
|
|
34
|
-
checkWithBehavioralContext(behavioralCtx: ExecutionErrorContext): Diagnostic[];
|
|
35
|
-
}
|
|
36
|
-
export declare const E018ToolExecutionFailed: E018ToolExecutionFailedRule;
|
|
37
|
-
export {};
|
|
38
|
-
//# sourceMappingURL=e018-tool-execution-failed.d.ts.map
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* E018: Tool Execution Failed
|
|
3
|
-
*
|
|
4
|
-
* Condition: Tool raises an exception during execution
|
|
5
|
-
*
|
|
6
|
-
* Why this is fatal:
|
|
7
|
-
* - Tool crashes instead of handling errors gracefully
|
|
8
|
-
* - Breaks agent reliability
|
|
9
|
-
* - Indicates missing error handling or input validation
|
|
10
|
-
*/
|
|
11
|
-
import { BaseRule } from '../base.js';
|
|
12
|
-
import { ERROR_CODES } from '../error-codes.js';
|
|
13
|
-
class E018ToolExecutionFailedRule extends BaseRule {
|
|
14
|
-
id = ERROR_CODES.E018;
|
|
15
|
-
severity = 'error';
|
|
16
|
-
ruleName = 'Tool Execution Failed';
|
|
17
|
-
description = 'Tool raises an exception during execution. Tool should handle errors gracefully instead of crashing.';
|
|
18
|
-
check(_ctx) {
|
|
19
|
-
// This rule requires behavioral context
|
|
20
|
-
return [];
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Check with behavioral context (called from test orchestrator).
|
|
24
|
-
*/
|
|
25
|
-
checkWithBehavioralContext(behavioralCtx) {
|
|
26
|
-
const diagnostics = [];
|
|
27
|
-
if (behavioralCtx.errors.length > 0) {
|
|
28
|
-
const errorMessages = behavioralCtx.errors
|
|
29
|
-
.map(e => ` - ${e.message}`)
|
|
30
|
-
.join('\n');
|
|
31
|
-
diagnostics.push(this.createDiagnostic(`Tool "${behavioralCtx.toolName}" execution failed:\n${errorMessages}`, behavioralCtx.toolName, undefined, 'Fix tool implementation errors. Ensure tool handles all input cases gracefully and validates inputs before processing.'));
|
|
32
|
-
}
|
|
33
|
-
return diagnostics;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
export const E018ToolExecutionFailed = new E018ToolExecutionFailedRule();
|
|
37
|
-
//# sourceMappingURL=e018-tool-execution-failed.js.map
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* E019: Tool Execution Failed
|
|
3
|
-
*
|
|
4
|
-
* Condition: Tool raises an exception during execution
|
|
5
|
-
*
|
|
6
|
-
* Why this is fatal:
|
|
7
|
-
* - Tool crashes instead of handling errors gracefully
|
|
8
|
-
* - Breaks agent reliability
|
|
9
|
-
* - Indicates missing error handling or input validation
|
|
10
|
-
*/
|
|
11
|
-
import { BaseRule } from '../base.js';
|
|
12
|
-
import type { AnalysisContext, Diagnostic } from '../../types.js';
|
|
13
|
-
/**
|
|
14
|
-
* Context for execution error detection.
|
|
15
|
-
*/
|
|
16
|
-
export interface ExecutionErrorContext {
|
|
17
|
-
/** Tool name */
|
|
18
|
-
toolName: string;
|
|
19
|
-
/** Execution errors */
|
|
20
|
-
errors: Array<{
|
|
21
|
-
message: string;
|
|
22
|
-
code?: string;
|
|
23
|
-
}>;
|
|
24
|
-
}
|
|
25
|
-
declare class E019ToolExecutionFailedRule extends BaseRule {
|
|
26
|
-
readonly id: "E019";
|
|
27
|
-
readonly severity: "error";
|
|
28
|
-
readonly ruleName = "Tool Execution Failed";
|
|
29
|
-
readonly description = "Tool raises an exception during execution. Tool should handle errors gracefully instead of crashing.";
|
|
30
|
-
check(_ctx: AnalysisContext): Diagnostic[];
|
|
31
|
-
/**
|
|
32
|
-
* Check with behavioral context (called from test orchestrator).
|
|
33
|
-
*/
|
|
34
|
-
checkWithBehavioralContext(behavioralCtx: ExecutionErrorContext): Diagnostic[];
|
|
35
|
-
}
|
|
36
|
-
export declare const E019ToolExecutionFailed: E019ToolExecutionFailedRule;
|
|
37
|
-
export {};
|
|
38
|
-
//# sourceMappingURL=e019-tool-execution-failed.d.ts.map
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* E019: Tool Execution Failed
|
|
3
|
-
*
|
|
4
|
-
* Condition: Tool raises an exception during execution
|
|
5
|
-
*
|
|
6
|
-
* Why this is fatal:
|
|
7
|
-
* - Tool crashes instead of handling errors gracefully
|
|
8
|
-
* - Breaks agent reliability
|
|
9
|
-
* - Indicates missing error handling or input validation
|
|
10
|
-
*/
|
|
11
|
-
import { BaseRule } from '../base.js';
|
|
12
|
-
import { ERROR_CODES } from '../error-codes.js';
|
|
13
|
-
class E019ToolExecutionFailedRule extends BaseRule {
|
|
14
|
-
id = ERROR_CODES.E019;
|
|
15
|
-
severity = 'error';
|
|
16
|
-
ruleName = 'Tool Execution Failed';
|
|
17
|
-
description = 'Tool raises an exception during execution. Tool should handle errors gracefully instead of crashing.';
|
|
18
|
-
check(_ctx) {
|
|
19
|
-
// This rule requires behavioral context
|
|
20
|
-
return [];
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Check with behavioral context (called from test orchestrator).
|
|
24
|
-
*/
|
|
25
|
-
checkWithBehavioralContext(behavioralCtx) {
|
|
26
|
-
const diagnostics = [];
|
|
27
|
-
if (behavioralCtx.errors.length > 0) {
|
|
28
|
-
const errorMessages = behavioralCtx.errors
|
|
29
|
-
.map(e => ` - ${e.message}`)
|
|
30
|
-
.join('\n');
|
|
31
|
-
diagnostics.push(this.createDiagnostic(`Tool "${behavioralCtx.toolName}" execution failed:\n${errorMessages}`, behavioralCtx.toolName, undefined, 'Fix tool implementation errors. Ensure tool handles all input cases gracefully and validates inputs before processing.'));
|
|
32
|
-
}
|
|
33
|
-
return diagnostics;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
export const E019ToolExecutionFailed = new E019ToolExecutionFailedRule();
|
|
37
|
-
//# sourceMappingURL=e019-tool-execution-failed.js.map
|