mirror of
https://github.com/KeygraphHQ/shannon.git
synced 2026-08-16 00:10:30 +02:00
refactor(worker): rename claude-executor to pi-executor
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
* - Load prompt template using AGENTS[agentName].promptTemplate
|
||||
* - Create git checkpoint
|
||||
* - Start audit logging
|
||||
* - Invoke Claude SDK via runClaudePrompt
|
||||
* - Invoke the pi agent via runPiPrompt
|
||||
* - Spending cap check using isSpendingCapBehavior
|
||||
* - Handle failure (rollback, audit)
|
||||
* - Validate output using AGENTS[agentName].deliverableFilename
|
||||
@@ -22,7 +22,7 @@
|
||||
*/
|
||||
|
||||
import { fs, path } from 'zx';
|
||||
import { type ClaudePromptResult, runClaudePrompt, validateAgentOutput } from '../ai/claude-executor.js';
|
||||
import { type PiPromptResult, runPiPrompt, validateAgentOutput } from '../ai/pi-executor.js';
|
||||
import { createQueueSubmitTool, getQueueFilename } from '../ai/queue-schemas.js';
|
||||
import type { AuditSession } from '../audit/index.js';
|
||||
import { authStateFile } from '../audit/utils.js';
|
||||
@@ -59,7 +59,7 @@ export interface AgentExecutionInput {
|
||||
|
||||
interface FailAgentOpts {
|
||||
attemptNumber: number;
|
||||
result: ClaudePromptResult;
|
||||
result: PiPromptResult;
|
||||
rollbackReason: string;
|
||||
errorMessage: string;
|
||||
errorCode: ErrorCode;
|
||||
@@ -167,7 +167,7 @@ export class AgentExecutionService {
|
||||
// exploitation queue (pi has no JSON-schema output format).
|
||||
const submitTool = createQueueSubmitTool(agentName, distributedConfig?.exploit ?? true);
|
||||
const callerTools = [...(customTools ?? []), ...(submitTool ? [submitTool.tool] : [])];
|
||||
const result: ClaudePromptResult = await runClaudePrompt(
|
||||
const result: PiPromptResult = await runPiPrompt(
|
||||
prompt,
|
||||
repoPath,
|
||||
'', // context
|
||||
@@ -309,7 +309,7 @@ export class AgentExecutionService {
|
||||
/**
|
||||
* Convert AgentEndResult to AgentMetrics for workflow state.
|
||||
*/
|
||||
static toMetrics(endResult: AgentEndResult, result: ClaudePromptResult): AgentMetrics {
|
||||
static toMetrics(endResult: AgentEndResult, result: PiPromptResult): AgentMetrics {
|
||||
return {
|
||||
durationMs: endResult.duration_ms,
|
||||
inputTokens: null, // Not currently exposed by SDK wrapper
|
||||
|
||||
@@ -62,7 +62,7 @@ const RETRYABLE_PATTERNS = [
|
||||
'internal server error',
|
||||
'service unavailable',
|
||||
'bad gateway',
|
||||
// Claude API errors
|
||||
// Provider API errors
|
||||
'model unavailable',
|
||||
'service temporarily unavailable',
|
||||
'api error',
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
* Services are pure domain logic with no Temporal dependencies.
|
||||
*/
|
||||
|
||||
export type { ClaudePromptResult } from '../ai/claude-executor.js';
|
||||
export { runClaudePrompt } from '../ai/claude-executor.js';
|
||||
export type { PiPromptResult } from '../ai/pi-executor.js';
|
||||
export { runPiPrompt } from '../ai/pi-executor.js';
|
||||
export type { AgentExecutionInput } from './agent-execution.js';
|
||||
export { AgentExecutionService } from './agent-execution.js';
|
||||
export { ConfigLoaderService } from './config-loader.js';
|
||||
|
||||
@@ -350,7 +350,7 @@ async function probeCredentialsWithPi(authType: string, baseUrl?: string): Promi
|
||||
return ok(undefined);
|
||||
}
|
||||
|
||||
/** Validate credentials via a minimal Claude Agent SDK query. */
|
||||
/** Validate credentials via a minimal pi session. */
|
||||
async function validateCredentials(
|
||||
logger: ActivityLogger,
|
||||
apiKey?: string,
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
import { readFile, rm } from 'node:fs/promises';
|
||||
import { defineTool, type ToolDefinition } from '@earendil-works/pi-coding-agent';
|
||||
import { Type } from 'typebox';
|
||||
import { runClaudePrompt } from '../ai/claude-executor.js';
|
||||
import { runPiPrompt } from '../ai/pi-executor.js';
|
||||
import type { AuditSession } from '../audit/index.js';
|
||||
import { authStateFile } from '../audit/utils.js';
|
||||
import type { ActivityLogger } from '../types/activity-logger.js';
|
||||
@@ -123,7 +123,7 @@ export async function validateAuthentication(input: ValidateAuthInput): Promise<
|
||||
const startTime = Date.now();
|
||||
|
||||
const submit = createAuthSubmitTool();
|
||||
const result = await runClaudePrompt(
|
||||
const result = await runPiPrompt(
|
||||
prompt,
|
||||
repoPath,
|
||||
'',
|
||||
@@ -219,7 +219,7 @@ function countStorageEntries(parsed: unknown, key: 'cookies' | 'origins'): numbe
|
||||
}
|
||||
|
||||
function classifyResult(
|
||||
result: import('../ai/claude-executor.js').ClaudePromptResult,
|
||||
result: import('../ai/pi-executor.js').PiPromptResult,
|
||||
authentication: NonNullable<DistributedConfig['authentication']>,
|
||||
): Result<void, PentestError> {
|
||||
if (!result.success) {
|
||||
|
||||
Reference in New Issue
Block a user