無用なexportを排除
This commit is contained in:
parent
cbed66a9ba
commit
7d20c016c7
@ -3,10 +3,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { describe, it, expect } from 'vitest';
|
import { describe, it, expect } from 'vitest';
|
||||||
import {
|
import { isRegexSafe } from '../infra/claude/utils.js';
|
||||||
detectRuleIndex,
|
import { detectRuleIndex } from '../shared/utils/ruleIndex.js';
|
||||||
isRegexSafe,
|
|
||||||
} from '../infra/claude/client.js';
|
|
||||||
|
|
||||||
describe('isRegexSafe', () => {
|
describe('isRegexSafe', () => {
|
||||||
it('should accept simple patterns', () => {
|
it('should accept simple patterns', () => {
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import { join } from 'node:path';
|
|||||||
import { tmpdir } from 'node:os';
|
import { tmpdir } from 'node:os';
|
||||||
import { setMockScenario, resetScenario } from '../infra/mock/index.js';
|
import { setMockScenario, resetScenario } from '../infra/mock/index.js';
|
||||||
import type { PieceConfig, PieceMovement, PieceRule } from '../core/models/index.js';
|
import type { PieceConfig, PieceMovement, PieceRule } from '../core/models/index.js';
|
||||||
import { detectRuleIndex } from '../infra/claude/index.js';
|
import { detectRuleIndex } from '../shared/utils/ruleIndex.js';
|
||||||
import { makeRule } from './test-helpers.js';
|
import { makeRule } from './test-helpers.js';
|
||||||
import { callAiJudge } from '../agents/ai-judge.js';
|
import { callAiJudge } from '../agents/ai-judge.js';
|
||||||
|
|
||||||
|
|||||||
@ -15,7 +15,7 @@ import { join } from 'node:path';
|
|||||||
import { tmpdir } from 'node:os';
|
import { tmpdir } from 'node:os';
|
||||||
import { setMockScenario, resetScenario } from '../infra/mock/index.js';
|
import { setMockScenario, resetScenario } from '../infra/mock/index.js';
|
||||||
import type { PieceConfig, PieceMovement, PieceRule } from '../core/models/index.js';
|
import type { PieceConfig, PieceMovement, PieceRule } from '../core/models/index.js';
|
||||||
import { detectRuleIndex } from '../infra/claude/index.js';
|
import { detectRuleIndex } from '../shared/utils/ruleIndex.js';
|
||||||
import { makeRule } from './test-helpers.js';
|
import { makeRule } from './test-helpers.js';
|
||||||
import { callAiJudge } from '../agents/ai-judge.js';
|
import { callAiJudge } from '../agents/ai-judge.js';
|
||||||
|
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import { mkdtempSync, mkdirSync, rmSync } from 'node:fs';
|
|||||||
import { join } from 'node:path';
|
import { join } from 'node:path';
|
||||||
import { tmpdir } from 'node:os';
|
import { tmpdir } from 'node:os';
|
||||||
import { setMockScenario, resetScenario } from '../infra/mock/index.js';
|
import { setMockScenario, resetScenario } from '../infra/mock/index.js';
|
||||||
import { detectRuleIndex } from '../infra/claude/index.js';
|
import { detectRuleIndex } from '../shared/utils/ruleIndex.js';
|
||||||
import { callAiJudge } from '../agents/ai-judge.js';
|
import { callAiJudge } from '../agents/ai-judge.js';
|
||||||
|
|
||||||
// --- Mocks ---
|
// --- Mocks ---
|
||||||
|
|||||||
@ -36,7 +36,7 @@ vi.mock('../infra/config/project/projectConfig.js', () => ({
|
|||||||
|
|
||||||
import { evaluateAggregateConditions } from '../core/piece/index.js';
|
import { evaluateAggregateConditions } from '../core/piece/index.js';
|
||||||
import { detectMatchedRule } from '../core/piece/evaluation/index.js';
|
import { detectMatchedRule } from '../core/piece/evaluation/index.js';
|
||||||
import { detectRuleIndex } from '../infra/claude/index.js';
|
import { detectRuleIndex } from '../shared/utils/ruleIndex.js';
|
||||||
import type { RuleMatch, RuleEvaluatorContext } from '../core/piece/index.js';
|
import type { RuleMatch, RuleEvaluatorContext } from '../core/piece/index.js';
|
||||||
|
|
||||||
// --- Test helpers ---
|
// --- Test helpers ---
|
||||||
|
|||||||
@ -15,7 +15,7 @@ import { join } from 'node:path';
|
|||||||
import { tmpdir } from 'node:os';
|
import { tmpdir } from 'node:os';
|
||||||
import { setMockScenario, resetScenario } from '../infra/mock/index.js';
|
import { setMockScenario, resetScenario } from '../infra/mock/index.js';
|
||||||
import type { PieceConfig, PieceMovement, PieceRule } from '../core/models/index.js';
|
import type { PieceConfig, PieceMovement, PieceRule } from '../core/models/index.js';
|
||||||
import { detectRuleIndex } from '../infra/claude/index.js';
|
import { detectRuleIndex } from '../shared/utils/ruleIndex.js';
|
||||||
import { makeRule } from './test-helpers.js';
|
import { makeRule } from './test-helpers.js';
|
||||||
import { callAiJudge } from '../agents/ai-judge.js';
|
import { callAiJudge } from '../agents/ai-judge.js';
|
||||||
|
|
||||||
|
|||||||
@ -15,11 +15,6 @@ describe('public API exports', () => {
|
|||||||
expect(typeof api.decomposeTask).toBe('function');
|
expect(typeof api.decomposeTask).toBe('function');
|
||||||
|
|
||||||
expect(typeof api.PieceEngine).toBe('function');
|
expect(typeof api.PieceEngine).toBe('function');
|
||||||
expect(typeof api.createInitialState).toBe('function');
|
|
||||||
expect(typeof api.addUserInput).toBe('function');
|
|
||||||
expect(typeof api.getPreviousOutput).toBe('function');
|
|
||||||
expect(api.COMPLETE_MOVEMENT).toBeDefined();
|
|
||||||
expect(api.ABORT_MOVEMENT).toBeDefined();
|
|
||||||
|
|
||||||
expect(typeof api.loadPiece).toBe('function');
|
expect(typeof api.loadPiece).toBe('function');
|
||||||
expect(typeof api.loadPieceByIdentifier).toBe('function');
|
expect(typeof api.loadPieceByIdentifier).toBe('function');
|
||||||
@ -43,6 +38,16 @@ describe('public API exports', () => {
|
|||||||
expect('ParallelLogger' in api).toBe(false);
|
expect('ParallelLogger' in api).toBe(false);
|
||||||
expect('InstructionBuilder' in api).toBe(false);
|
expect('InstructionBuilder' in api).toBe(false);
|
||||||
expect('ReportInstructionBuilder' in api).toBe(false);
|
expect('ReportInstructionBuilder' in api).toBe(false);
|
||||||
|
expect('COMPLETE_MOVEMENT' in api).toBe(false);
|
||||||
|
expect('ABORT_MOVEMENT' in api).toBe(false);
|
||||||
|
expect('ERROR_MESSAGES' in api).toBe(false);
|
||||||
|
expect('determineNextMovementByRules' in api).toBe(false);
|
||||||
|
expect('extractBlockedPrompt' in api).toBe(false);
|
||||||
|
expect('LoopDetector' in api).toBe(false);
|
||||||
|
expect('createInitialState' in api).toBe(false);
|
||||||
|
expect('addUserInput' in api).toBe(false);
|
||||||
|
expect('getPreviousOutput' in api).toBe(false);
|
||||||
|
expect('handleBlocked' in api).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not expose infrastructure implementations and internal shared utilities', async () => {
|
it('should not expose infrastructure implementations and internal shared utilities', async () => {
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
* Type definitions for agent execution
|
* Type definitions for agent execution
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { StreamCallback, PermissionHandler, AskUserQuestionHandler } from '../infra/claude/index.js';
|
import type { StreamCallback, PermissionHandler, AskUserQuestionHandler } from '../infra/claude/types.js';
|
||||||
import type { PermissionMode, Language, McpServerConfig } from '../core/models/index.js';
|
import type { PermissionMode, Language, McpServerConfig } from '../core/models/index.js';
|
||||||
|
|
||||||
export type { StreamCallback };
|
export type { StreamCallback };
|
||||||
|
|||||||
@ -6,7 +6,8 @@ import { readFileSync } from 'node:fs';
|
|||||||
import { PieceEngine, type IterationLimitRequest, type UserInputRequest } from '../../../core/piece/index.js';
|
import { PieceEngine, type IterationLimitRequest, type UserInputRequest } from '../../../core/piece/index.js';
|
||||||
import type { PieceConfig } from '../../../core/models/index.js';
|
import type { PieceConfig } from '../../../core/models/index.js';
|
||||||
import type { PieceExecutionResult, PieceExecutionOptions } from './types.js';
|
import type { PieceExecutionResult, PieceExecutionOptions } from './types.js';
|
||||||
import { detectRuleIndex, interruptAllQueries } from '../../../infra/claude/index.js';
|
import { detectRuleIndex } from '../../../shared/utils/ruleIndex.js';
|
||||||
|
import { interruptAllQueries } from '../../../infra/claude/query-manager.js';
|
||||||
import { callAiJudge } from '../../../agents/ai-judge.js';
|
import { callAiJudge } from '../../../agents/ai-judge.js';
|
||||||
|
|
||||||
export type { PieceExecutionResult, PieceExecutionOptions };
|
export type { PieceExecutionResult, PieceExecutionOptions };
|
||||||
|
|||||||
12
src/index.ts
12
src/index.ts
@ -42,16 +42,6 @@ export {
|
|||||||
// Piece engine
|
// Piece engine
|
||||||
export {
|
export {
|
||||||
PieceEngine,
|
PieceEngine,
|
||||||
COMPLETE_MOVEMENT,
|
|
||||||
ABORT_MOVEMENT,
|
|
||||||
ERROR_MESSAGES,
|
|
||||||
determineNextMovementByRules,
|
|
||||||
extractBlockedPrompt,
|
|
||||||
LoopDetector,
|
|
||||||
createInitialState,
|
|
||||||
addUserInput,
|
|
||||||
getPreviousOutput,
|
|
||||||
handleBlocked,
|
|
||||||
isOutputContractItem,
|
isOutputContractItem,
|
||||||
executeAgent,
|
executeAgent,
|
||||||
generateReport,
|
generateReport,
|
||||||
@ -67,8 +57,6 @@ export type {
|
|||||||
SessionUpdateCallback,
|
SessionUpdateCallback,
|
||||||
IterationLimitCallback,
|
IterationLimitCallback,
|
||||||
PieceEngineOptions,
|
PieceEngineOptions,
|
||||||
LoopCheckResult,
|
|
||||||
ProviderType,
|
ProviderType,
|
||||||
JudgeStatusResult,
|
JudgeStatusResult,
|
||||||
BlockedHandlerResult,
|
|
||||||
} from './core/piece/index.js';
|
} from './core/piece/index.js';
|
||||||
|
|||||||
@ -11,7 +11,6 @@ import { createLogger } from '../../shared/utils/index.js';
|
|||||||
import { loadTemplate } from '../../shared/prompts/index.js';
|
import { loadTemplate } from '../../shared/prompts/index.js';
|
||||||
|
|
||||||
export type { ClaudeCallOptions } from './types.js';
|
export type { ClaudeCallOptions } from './types.js';
|
||||||
export { detectRuleIndex, isRegexSafe } from './utils.js';
|
|
||||||
|
|
||||||
const log = createLogger('client');
|
const log = createLogger('client');
|
||||||
|
|
||||||
|
|||||||
@ -61,13 +61,5 @@ export {
|
|||||||
buildSdkOptions,
|
buildSdkOptions,
|
||||||
} from './options-builder.js';
|
} from './options-builder.js';
|
||||||
|
|
||||||
// Client functions
|
|
||||||
export {
|
|
||||||
callClaude,
|
|
||||||
callClaudeCustom,
|
|
||||||
callClaudeAgent,
|
|
||||||
callClaudeSkill,
|
|
||||||
detectRuleIndex,
|
|
||||||
isRegexSafe,
|
|
||||||
} from './client.js';
|
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,6 @@
|
|||||||
/**
|
/**
|
||||||
* Utility functions for Claude client operations.
|
* Utility functions for Claude client operations.
|
||||||
*
|
|
||||||
* Stateless helpers for rule detection and regex safety validation.
|
|
||||||
*/
|
*/
|
||||||
import { detectRuleIndex } from '../../shared/utils/ruleIndex.js';
|
|
||||||
|
|
||||||
export { detectRuleIndex };
|
|
||||||
|
|
||||||
/** Validate regex pattern for ReDoS safety */
|
/** Validate regex pattern for ReDoS safety */
|
||||||
export function isRegexSafe(pattern: string): boolean {
|
export function isRegexSafe(pattern: string): boolean {
|
||||||
|
|||||||
@ -2,7 +2,8 @@
|
|||||||
* Claude provider implementation
|
* Claude provider implementation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { callClaude, callClaudeCustom, callClaudeAgent, callClaudeSkill, type ClaudeCallOptions } from '../claude/index.js';
|
import { callClaude, callClaudeCustom, callClaudeAgent, callClaudeSkill } from '../claude/client.js';
|
||||||
|
import type { ClaudeCallOptions } from '../claude/types.js';
|
||||||
import { resolveAnthropicApiKey } from '../config/index.js';
|
import { resolveAnthropicApiKey } from '../config/index.js';
|
||||||
import type { AgentResponse } from '../../core/models/index.js';
|
import type { AgentResponse } from '../../core/models/index.js';
|
||||||
import type { AgentSetup, Provider, ProviderAgent, ProviderCallOptions } from './types.js';
|
import type { AgentSetup, Provider, ProviderAgent, ProviderCallOptions } from './types.js';
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user