agent-afk 5.172.0 → 5.174.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/dist/agent/daemon/lease-store.d.ts +8 -0
- package/dist/agent/daemon/queue-store.d.ts +6 -0
- package/dist/agent/daemon/task-lifecycle.d.ts +23 -0
- package/dist/agent/dag-checkpoint.d.ts +15 -0
- package/dist/agent/dag.d.ts +1 -0
- package/dist/agent/tools/handlers/index.d.ts +4 -1
- package/dist/agent/tools/handlers/patch-apply-engine.d.ts +12 -0
- package/dist/agent/tools/handlers/patch-apply.d.ts +3 -0
- package/dist/agent/tools/handlers/patch-validate.d.ts +22 -0
- package/dist/agent/tools/handlers/test-failure-parser.d.ts +9 -0
- package/dist/agent/tools/handlers/test-run-discovery.d.ts +7 -0
- package/dist/agent/tools/handlers/test-run.d.ts +13 -0
- package/dist/agent/tools/handlers/wait-for-conditions.d.ts +32 -0
- package/dist/agent/tools/handlers/wait-for-poller.d.ts +19 -0
- package/dist/agent/tools/handlers/wait-for.d.ts +2 -0
- package/dist/agent/tools/schemas.d.ts +1 -0
- package/dist/agent/tools/schemas.orchestration.d.ts +1 -0
- package/dist/agent/tools/schemas.patch-apply.d.ts +2 -0
- package/dist/agent/tools/schemas.test-run.d.ts +2 -0
- package/dist/agent/tools/schemas.wait-for.d.ts +2 -0
- package/dist/agent/trace/types.d.ts +1 -0
- package/dist/cli/render/file-op-summary.d.ts +8 -0
- package/dist/cli/render/index.d.ts +1 -0
- package/dist/cli/render/status-panel.d.ts +8 -0
- package/dist/cli.mjs +678 -655
- package/dist/config/env.d.ts +1 -0
- package/dist/improve/schemas.d.ts +3 -3
- package/dist/index.mjs +251 -231
- package/dist/telegram.mjs +319 -296
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type QueuedTask } from './queue-store.js';
|
|
2
|
+
import { type TaskRecord } from './task-lifecycle.js';
|
|
3
|
+
export declare function leaseTask(task: QueuedTask, srcPath: string, leaseTtlMs?: number, queueDir?: string): TaskRecord;
|
|
4
|
+
export declare function renewLease(taskId: string, leaseTtlMs?: number, queueDir?: string): void;
|
|
5
|
+
export declare function completeTask(taskId: string, status: 'succeeded' | 'failed', error?: string, queueDir?: string): void;
|
|
6
|
+
export declare function recoverExpiredLeases(queueDir?: string): TaskRecord[];
|
|
7
|
+
export declare function getTaskRecord(taskId: string, queueDir?: string): TaskRecord | null;
|
|
8
|
+
export declare function listActiveTasks(queueDir?: string): TaskRecord[];
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
import { recoverExpiredLeases } from './lease-store.js';
|
|
2
|
+
export { recoverExpiredLeases };
|
|
1
3
|
export interface QueuedTask {
|
|
2
4
|
id: string;
|
|
3
5
|
command: string;
|
|
4
6
|
enqueuedAt: string;
|
|
5
7
|
sequence: number;
|
|
6
8
|
notifyOn?: 'failure' | 'always' | 'never';
|
|
9
|
+
attempts?: number;
|
|
10
|
+
maxAttempts?: number;
|
|
11
|
+
backoffStrategy?: 'fixed' | 'exponential';
|
|
12
|
+
backoffBaseMs?: number;
|
|
7
13
|
}
|
|
8
14
|
export interface EnqueueOptions {
|
|
9
15
|
notifyOn?: 'failure' | 'always' | 'never';
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type TaskState = 'queued' | 'leased' | 'running' | 'succeeded' | 'failed' | 'retrying' | 'dead-letter';
|
|
2
|
+
export interface TaskRecord {
|
|
3
|
+
id: string;
|
|
4
|
+
command: string;
|
|
5
|
+
state: TaskState;
|
|
6
|
+
attempts: number;
|
|
7
|
+
maxAttempts: number;
|
|
8
|
+
leaseExpiry?: number;
|
|
9
|
+
lastError?: string;
|
|
10
|
+
createdAt: number;
|
|
11
|
+
updatedAt: number;
|
|
12
|
+
backoffStrategy?: 'fixed' | 'exponential';
|
|
13
|
+
backoffBaseMs?: number;
|
|
14
|
+
meta?: Record<string, unknown>;
|
|
15
|
+
}
|
|
16
|
+
export interface RetryPolicy {
|
|
17
|
+
maxAttempts: number;
|
|
18
|
+
backoffStrategy: 'fixed' | 'exponential';
|
|
19
|
+
backoffBaseMs: number;
|
|
20
|
+
}
|
|
21
|
+
export declare const DEFAULT_RETRY_POLICY: RetryPolicy;
|
|
22
|
+
export declare const DEFAULT_LEASE_TTL_MS: number;
|
|
23
|
+
export declare function computeBackoffMs(attempts: number, policy: RetryPolicy): number;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { DAGGraph } from './dag.js';
|
|
2
|
+
export interface DAGCheckpoint {
|
|
3
|
+
dagHash: string;
|
|
4
|
+
completedNodes: string[];
|
|
5
|
+
nodeOutputs: Record<string, string>;
|
|
6
|
+
failedNodes: string[];
|
|
7
|
+
nodeErrors?: Record<string, string>;
|
|
8
|
+
skippedNodes: string[];
|
|
9
|
+
timestamp: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function computeDAGHash(graph: DAGGraph): string;
|
|
12
|
+
export declare function saveCheckpoint(dagId: string, checkpoint: DAGCheckpoint): Promise<void>;
|
|
13
|
+
export declare function loadCheckpoint(dagId: string, expectedHash: string): Promise<DAGCheckpoint | null>;
|
|
14
|
+
export declare function clearCheckpoint(dagId: string): Promise<void>;
|
|
15
|
+
export declare function serializeOutput(value: unknown): string;
|
package/dist/agent/dag.d.ts
CHANGED
|
@@ -19,5 +19,8 @@ import { browserObserveHandler } from './browser-observe.js';
|
|
|
19
19
|
import { browserActHandler } from './browser-act.js';
|
|
20
20
|
import { browserScreenshotHandler } from './browser-screenshot.js';
|
|
21
21
|
import { browserCloseHandler } from './browser-close.js';
|
|
22
|
+
import { waitForHandler } from './wait-for.js';
|
|
23
|
+
import { patchApplyHandler } from './patch-apply.js';
|
|
24
|
+
import { testRunHandler } from './test-run.js';
|
|
22
25
|
export declare function createBuiltinHandlers(permissionMode?: string, cwd?: string): Map<string, ToolHandler>;
|
|
23
|
-
export { bashHandler, readFileHandler, extractDocumentHandler, writeFileHandler, editFileHandler, globHandler, grepHandler, listDirectoryHandler, sendTelegramHandler, webScrapeHandler, createScheduleHandler, listSchedulesHandler, getScheduleHistoryHandler, cancelScheduleHandler, terminalFontSizeHandler, createWorktreeHandler, configGetHandler, configSetHandler, askQuestionHandler, browserOpenHandler, browserObserveHandler, browserActHandler, browserScreenshotHandler, browserCloseHandler, };
|
|
26
|
+
export { bashHandler, readFileHandler, extractDocumentHandler, writeFileHandler, editFileHandler, globHandler, grepHandler, listDirectoryHandler, sendTelegramHandler, webScrapeHandler, createScheduleHandler, listSchedulesHandler, getScheduleHistoryHandler, cancelScheduleHandler, terminalFontSizeHandler, createWorktreeHandler, configGetHandler, configSetHandler, askQuestionHandler, waitForHandler, patchApplyHandler, browserOpenHandler, browserObserveHandler, browserActHandler, browserScreenshotHandler, browserCloseHandler, testRunHandler, };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { PatchFileChange, ValidationError } from './patch-validate.js';
|
|
2
|
+
export interface PatchApplyResult {
|
|
3
|
+
status: 'applied' | 'dry_run' | 'validation_failed' | 'partial_failure';
|
|
4
|
+
diff: string;
|
|
5
|
+
files_changed: Array<{
|
|
6
|
+
path: string;
|
|
7
|
+
before_hash: string;
|
|
8
|
+
after_hash: string;
|
|
9
|
+
}>;
|
|
10
|
+
errors: ValidationError[];
|
|
11
|
+
}
|
|
12
|
+
export declare function applyPatch(changes: PatchFileChange[], fileContents: Map<string, string | null>, resolveBase: string, dryRun: boolean): Promise<PatchApplyResult>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ToolHandlerContext } from '../types.js';
|
|
2
|
+
export interface PatchFileChange {
|
|
3
|
+
path: string;
|
|
4
|
+
expected_hash?: string;
|
|
5
|
+
edits?: Array<{
|
|
6
|
+
old: string;
|
|
7
|
+
new: string;
|
|
8
|
+
}>;
|
|
9
|
+
content?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ValidationError {
|
|
12
|
+
path: string;
|
|
13
|
+
error: string;
|
|
14
|
+
detail?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ValidationResult {
|
|
17
|
+
valid: boolean;
|
|
18
|
+
errors: ValidationError[];
|
|
19
|
+
fileContents: Map<string, string | null>;
|
|
20
|
+
}
|
|
21
|
+
export declare function sha256Hex(content: string): string;
|
|
22
|
+
export declare function validatePatchChanges(changes: PatchFileChange[], resolveBase: string, context?: ToolHandlerContext): Promise<ValidationResult>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Runner } from './test-runner-detector.js';
|
|
2
|
+
export interface TestFailure {
|
|
3
|
+
name: string;
|
|
4
|
+
file?: string;
|
|
5
|
+
line?: number;
|
|
6
|
+
message: string;
|
|
7
|
+
stack?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function parseTestFailures(output: string, runner: Runner): TestFailure[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type DiscoveredRunner = 'vitest' | 'jest' | 'pytest' | 'mocha' | 'go-test' | 'cargo' | 'rspec' | 'node-generic';
|
|
2
|
+
export interface DiscoveredCommand {
|
|
3
|
+
runner: DiscoveredRunner;
|
|
4
|
+
command: string;
|
|
5
|
+
args: string[];
|
|
6
|
+
}
|
|
7
|
+
export declare function discoverTestCommand(cwd: string): DiscoveredCommand | null;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ToolHandler } from '../types.js';
|
|
2
|
+
import { type TestFailure } from './test-failure-parser.js';
|
|
3
|
+
export interface TestRunResult {
|
|
4
|
+
runner: string;
|
|
5
|
+
command: string;
|
|
6
|
+
passed: number;
|
|
7
|
+
failed: number;
|
|
8
|
+
skipped?: number;
|
|
9
|
+
duration_ms: number;
|
|
10
|
+
failures: TestFailure[];
|
|
11
|
+
raw_output: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const testRunHandler: ToolHandler;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type WaitCondition = UrlCondition | FileCondition | ProcessCondition | CommandCondition;
|
|
2
|
+
export interface UrlCondition {
|
|
3
|
+
type: 'url';
|
|
4
|
+
url: string;
|
|
5
|
+
method?: 'HEAD' | 'GET';
|
|
6
|
+
expected_status?: number;
|
|
7
|
+
body_contains?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface FileCondition {
|
|
10
|
+
type: 'file';
|
|
11
|
+
path: string;
|
|
12
|
+
content_contains?: string;
|
|
13
|
+
workspaceRoot?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ProcessCondition {
|
|
16
|
+
type: 'process';
|
|
17
|
+
pid: number;
|
|
18
|
+
}
|
|
19
|
+
export interface CommandCondition {
|
|
20
|
+
type: 'command';
|
|
21
|
+
command: string;
|
|
22
|
+
cwd?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface WaitResult {
|
|
25
|
+
met: boolean;
|
|
26
|
+
detail: string;
|
|
27
|
+
data?: Record<string, unknown>;
|
|
28
|
+
}
|
|
29
|
+
export declare function evaluateUrl(cond: UrlCondition, signal: AbortSignal): Promise<WaitResult>;
|
|
30
|
+
export declare function evaluateFile(cond: FileCondition, signal?: AbortSignal): Promise<WaitResult>;
|
|
31
|
+
export declare function evaluateProcess(cond: ProcessCondition): WaitResult;
|
|
32
|
+
export declare function evaluateCommand(cond: CommandCondition): WaitResult;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { WaitResult } from './wait-for-conditions.js';
|
|
2
|
+
export declare const DEFAULT_TIMEOUT_MS = 120000;
|
|
3
|
+
export declare const MAX_TIMEOUT_MS = 600000;
|
|
4
|
+
export declare const DEFAULT_POLL_INTERVAL_MS = 5000;
|
|
5
|
+
export declare const MIN_POLL_INTERVAL_MS = 1000;
|
|
6
|
+
export interface PollOptions {
|
|
7
|
+
timeout_ms: number;
|
|
8
|
+
poll_interval_ms: number;
|
|
9
|
+
backoff: 'none' | 'linear' | 'exponential';
|
|
10
|
+
signal: AbortSignal;
|
|
11
|
+
}
|
|
12
|
+
export interface PollResult {
|
|
13
|
+
status: 'succeeded' | 'timed_out' | 'cancelled' | 'failed';
|
|
14
|
+
elapsed_ms: number;
|
|
15
|
+
attempts: number;
|
|
16
|
+
result?: WaitResult;
|
|
17
|
+
error?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function pollUntil(evaluate: (signal: AbortSignal) => Promise<WaitResult>, options: PollOptions): Promise<PollResult>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { AnthropicToolDef } from './types.js';
|
|
2
|
+
export { waitForTool } from './schemas.wait-for.js';
|
|
2
3
|
export declare const bashTool: AnthropicToolDef;
|
|
3
4
|
export declare const readFileTool: AnthropicToolDef;
|
|
4
5
|
export declare const extractDocumentTool: AnthropicToolDef;
|
|
@@ -25,6 +25,7 @@ export interface ToolCallCompletedPayload {
|
|
|
25
25
|
batchIndex?: number;
|
|
26
26
|
batchSize?: number;
|
|
27
27
|
subagentId?: string;
|
|
28
|
+
testResult?: import('../tools/handlers/test-runner-detector.js').TestResult;
|
|
28
29
|
}
|
|
29
30
|
export type ToolCallPayload = ToolCallStartedPayload | ToolCallCompletedPayload;
|
|
30
31
|
export type HookEventName = 'PreToolUse' | 'PostToolUse' | 'PostToolUseFailure' | 'SessionStart' | 'SessionEnd' | 'SubagentStart' | 'SubagentStop';
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
export type StatusKind = 'ok' | 'warn' | 'error' | 'info';
|
|
2
|
+
export interface HealthCheck {
|
|
3
|
+
name: string;
|
|
4
|
+
state: 'pass' | 'warn' | 'fail';
|
|
5
|
+
detail?: string;
|
|
6
|
+
fix?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function healthCheckRows(check: HealthCheck): string[];
|
|
9
|
+
export declare function healthCheckSummary(checks: HealthCheck[]): string;
|
|
2
10
|
export interface StatusRow {
|
|
3
11
|
label: string;
|
|
4
12
|
value: string;
|