agent-afk 5.310.5 → 5.310.6
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/file-checkpoint/file-checkpoint.d.ts +15 -0
- package/dist/agent/file-checkpoint/rewind-files.d.ts +11 -0
- package/dist/agent/file-checkpoint/rewind-staging.d.ts +2 -0
- package/dist/agent/file-checkpoint/write-policy.d.ts +3 -0
- package/dist/agent/provider.d.ts +2 -0
- package/dist/agent/providers/anthropic-direct/query/session-state.d.ts +3 -0
- package/dist/agent/providers/anthropic-direct/query-options.d.ts +1 -0
- package/dist/agent/providers/anthropic-direct/query-runtime.d.ts +1 -1
- package/dist/agent/providers/openai-compatible/query.d.ts +2 -1
- package/dist/agent/providers/openai-compatible/query.file-checkpoint.d.ts +14 -0
- package/dist/agent/providers/shared/chain-provider-close.d.ts +2 -0
- package/dist/agent/session/stream-consumer.d.ts +1 -1
- package/dist/agent/tools/dispatcher.d.ts +2 -0
- package/dist/agent/tools/dispatcher.file-checkpoint.d.ts +9 -0
- package/dist/agent/tools/types.d.ts +2 -0
- package/dist/agent/types/message-types.d.ts +1 -0
- package/dist/cli.mjs +481 -476
- package/dist/index.mjs +206 -201
- package/dist/paths.checkpoint.d.ts +3 -0
- package/dist/paths.d.ts +2 -1
- package/dist/paths.whatif.d.ts +1 -0
- package/dist/telegram.mjs +240 -235
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface FileCheckpointRegistry {
|
|
2
|
+
snapshotFile(absPath: string): Promise<void>;
|
|
3
|
+
readonly turnId: string;
|
|
4
|
+
}
|
|
5
|
+
export interface FileSnapshot {
|
|
6
|
+
absPath: string;
|
|
7
|
+
snapshotPath: string;
|
|
8
|
+
isNewFile: boolean;
|
|
9
|
+
mode?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function decodePathKey(key: string): string;
|
|
12
|
+
export declare const NEW_FILE_SENTINEL = "__afk_new_file__\n";
|
|
13
|
+
export declare function createFileCheckpointRegistry(sessionId: string, turnId: string, _stateDir?: string): FileCheckpointRegistry;
|
|
14
|
+
export declare function hasTurnCheckpoint(sessionId: string, turnId: string, _stateDir?: string): boolean;
|
|
15
|
+
export declare function listTurnSnapshots(sessionId: string, turnId: string, _stateDir?: string): FileSnapshot[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ProviderRewindResult } from '../provider.js';
|
|
2
|
+
import type { ToolHandlerContext } from '../tools/types.js';
|
|
3
|
+
export interface RewindFilesDeps {
|
|
4
|
+
sessionId: string;
|
|
5
|
+
enableFileCheckpointing: boolean;
|
|
6
|
+
writePolicy?: ToolHandlerContext;
|
|
7
|
+
_stateDir?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function rewindFiles(deps: RewindFilesDeps, turnId: string, options?: {
|
|
10
|
+
dryRun?: boolean;
|
|
11
|
+
}): Promise<ProviderRewindResult>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ToolHandlerContext } from '../tools/types.js';
|
|
2
|
+
export declare function validatedWriteTarget(path: string, context: ToolHandlerContext | undefined, cwd?: string): Promise<string>;
|
|
3
|
+
export declare function currentWritePolicy(dispatcher: object | undefined, fallback: ToolHandlerContext): ToolHandlerContext;
|
package/dist/agent/provider.d.ts
CHANGED
|
@@ -118,6 +118,7 @@ export type ProviderEvent = {
|
|
|
118
118
|
sessionId?: string;
|
|
119
119
|
} | {
|
|
120
120
|
type: 'turn.completed';
|
|
121
|
+
userMessageId?: string;
|
|
121
122
|
usage: ProviderUsage;
|
|
122
123
|
sessionId?: string;
|
|
123
124
|
} | {
|
|
@@ -156,6 +157,7 @@ export type ProviderEvent = {
|
|
|
156
157
|
};
|
|
157
158
|
export interface ProviderUserTurn {
|
|
158
159
|
content: string | ContentBlockParam[];
|
|
160
|
+
userMessageId?: string;
|
|
159
161
|
sessionId?: string;
|
|
160
162
|
}
|
|
161
163
|
export interface ProviderQueryArgs {
|
|
@@ -14,6 +14,8 @@ export interface SessionState {
|
|
|
14
14
|
autoCompactThreshold: number | undefined;
|
|
15
15
|
readonly journalSync: JournalSync<MessageParam>;
|
|
16
16
|
readonly messageJournal: MessageJournal | undefined;
|
|
17
|
+
enableFileCheckpointing: boolean;
|
|
18
|
+
currentTurnId: string | undefined;
|
|
17
19
|
}
|
|
18
20
|
export declare function createSessionState(opts: {
|
|
19
21
|
model: string;
|
|
@@ -25,4 +27,5 @@ export declare function createSessionState(opts: {
|
|
|
25
27
|
autoCompactThreshold?: number;
|
|
26
28
|
initialUsageInputTokens?: number;
|
|
27
29
|
messageJournal?: MessageJournal;
|
|
30
|
+
enableFileCheckpointing?: boolean;
|
|
28
31
|
}): SessionState;
|
|
@@ -46,5 +46,6 @@ export interface AnthropicDirectQueryOptions {
|
|
|
46
46
|
throttleQueue?: import('./throttle-queue.js').ThrottleQueue;
|
|
47
47
|
fastModeController?: import('../../fast-mode.js').FastModeController;
|
|
48
48
|
beforeNextRound?: () => string | undefined;
|
|
49
|
+
enableFileCheckpointing?: boolean;
|
|
49
50
|
}
|
|
50
51
|
export declare function starterModels(): ProviderModelInfo[];
|
|
@@ -57,7 +57,7 @@ export declare class AnthropicDirectQuery implements ProviderQuery {
|
|
|
57
57
|
oldAccountId: string;
|
|
58
58
|
swapped: boolean;
|
|
59
59
|
} | null>;
|
|
60
|
-
rewindFiles(
|
|
60
|
+
rewindFiles(userMessageId: string, options?: {
|
|
61
61
|
dryRun?: boolean;
|
|
62
62
|
}): Promise<ProviderRewindResult>;
|
|
63
63
|
compact(): Promise<ProviderCompactResult>;
|
|
@@ -56,6 +56,7 @@ export declare class OpenAICompatibleQuery implements ProviderQuery, TurnDriverC
|
|
|
56
56
|
get closed(): boolean;
|
|
57
57
|
lastUsage: ProviderUsage | null;
|
|
58
58
|
private readonly autoCompactThreshold;
|
|
59
|
+
private readonly checkpoint;
|
|
59
60
|
constructor(opts: OpenAICompatibleQueryOptions);
|
|
60
61
|
activeOpenAITools(): OpenAIFunctionTool[] | undefined;
|
|
61
62
|
[Symbol.asyncIterator](): AsyncIterator<ProviderEvent>;
|
|
@@ -81,7 +82,7 @@ export declare class OpenAICompatibleQuery implements ProviderQuery, TurnDriverC
|
|
|
81
82
|
getContextUsage(): Promise<ProviderContextUsage>;
|
|
82
83
|
mcpServerStatus(): Promise<ProviderMcpServerStatus[]>;
|
|
83
84
|
accountInfo(): Promise<ProviderAccountInfo>;
|
|
84
|
-
rewindFiles(
|
|
85
|
+
rewindFiles(userMessageId: string, options?: {
|
|
85
86
|
dryRun?: boolean;
|
|
86
87
|
}): Promise<ProviderRewindResult>;
|
|
87
88
|
journalSnapshot(): ReturnType<OpenAIJournalWiring['snapshot']>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ToolHandlerContext } from '../../tools/types.js';
|
|
2
|
+
import type { ProviderEvent, ProviderRewindResult } from '../../provider.js';
|
|
3
|
+
export declare class FileCheckpointState {
|
|
4
|
+
private readonly enabled;
|
|
5
|
+
private readonly sessionId;
|
|
6
|
+
private currentTurnId;
|
|
7
|
+
constructor(enabled: boolean, sessionId: string);
|
|
8
|
+
begin(dispatcher: object | undefined, userMessageId?: string): string | undefined;
|
|
9
|
+
end(dispatcher: object | undefined): void;
|
|
10
|
+
events(events: AsyncIterable<ProviderEvent>, dispatcher: object | undefined, checkpointId: string | undefined): AsyncGenerator<ProviderEvent>;
|
|
11
|
+
rewind(userMessageId: string, options?: {
|
|
12
|
+
dryRun?: boolean;
|
|
13
|
+
}, writePolicy?: ToolHandlerContext): Promise<ProviderRewindResult>;
|
|
14
|
+
}
|
|
@@ -20,5 +20,5 @@ export declare function parsePersistedOutput(content: string): {
|
|
|
20
20
|
sizeBytes: number;
|
|
21
21
|
absolutePath: string;
|
|
22
22
|
} | null;
|
|
23
|
-
export declare function usageToMetadata(usage: ProviderUsage, sessionId: string | undefined): ResponseMetadata;
|
|
23
|
+
export declare function usageToMetadata(usage: ProviderUsage, sessionId: string | undefined, userMessageId?: string): ResponseMetadata;
|
|
24
24
|
export declare function transformProviderEvent(event: ProviderEvent, deps: TransformDeps): OutputEvent | null;
|
|
@@ -16,6 +16,7 @@ import type { TraceSink } from '../trace/index.js';
|
|
|
16
16
|
import { type UserAttention } from './user-yield.js';
|
|
17
17
|
import { type DetachableToolRegistry } from './detach-bash.js';
|
|
18
18
|
import type { ProcessJobRegistry } from '../shell-jobs/process-jobs.js';
|
|
19
|
+
import { FileCheckpointWiring } from './dispatcher.file-checkpoint.js';
|
|
19
20
|
export { defaultConcurrencyClassifier } from './dispatch-batching.js';
|
|
20
21
|
export declare const REPEAT_CIRCUIT_BREAKER_THRESHOLD = 8;
|
|
21
22
|
export { DEFAULT_MAX_CONCURRENT_SAFE_TOOL_CALLS, resolveMaxConcurrentSafeToolCalls };
|
|
@@ -79,6 +80,7 @@ export declare class SessionToolDispatcher implements ToolDispatcher {
|
|
|
79
80
|
private readonly userAttention;
|
|
80
81
|
private readonly detachRegistry;
|
|
81
82
|
private readonly processJobs;
|
|
83
|
+
readonly fileCheckpointWiring: FileCheckpointWiring;
|
|
82
84
|
private readonly bashOutputTailReporter;
|
|
83
85
|
private readonly gateState;
|
|
84
86
|
private readonly repeatFailureGuard;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FileCheckpointRegistry } from '../file-checkpoint/file-checkpoint.js';
|
|
2
|
+
export type { FileCheckpointRegistry };
|
|
3
|
+
export declare class FileCheckpointWiring {
|
|
4
|
+
private _registry;
|
|
5
|
+
set(registry: FileCheckpointRegistry | undefined): void;
|
|
6
|
+
contextSpread(): {
|
|
7
|
+
fileCheckpoint: FileCheckpointRegistry;
|
|
8
|
+
} | Record<never, never>;
|
|
9
|
+
}
|
|
@@ -8,6 +8,7 @@ import type { SpawnedPidRegistry } from './handlers/pid-registry.js';
|
|
|
8
8
|
import type { UserAttention } from './user-yield.js';
|
|
9
9
|
import type { DetachableToolRegistry } from './detach-registry.js';
|
|
10
10
|
import type { ProcessJobRegistry } from '../shell-jobs/process-jobs.js';
|
|
11
|
+
import type { FileCheckpointRegistry } from '../file-checkpoint/file-checkpoint.js';
|
|
11
12
|
export interface ToolHandlerContext {
|
|
12
13
|
resolveBase?: string;
|
|
13
14
|
cwd?: string;
|
|
@@ -23,6 +24,7 @@ export interface ToolHandlerContext {
|
|
|
23
24
|
userAttention?: UserAttention;
|
|
24
25
|
detachRegistry?: DetachableToolRegistry;
|
|
25
26
|
processJobs?: ProcessJobRegistry;
|
|
27
|
+
fileCheckpoint?: FileCheckpointRegistry;
|
|
26
28
|
}
|
|
27
29
|
export type ToolHandler = (input: unknown, signal: AbortSignal, context?: ToolHandlerContext) => Promise<ToolResult>;
|
|
28
30
|
export type ConcurrencyClassifier = (toolName: string, input?: unknown) => boolean;
|
|
@@ -2,6 +2,7 @@ import type { DiffPayload } from '../../utils/diff.js';
|
|
|
2
2
|
import type { ToolFailureClass } from '../trace/types.js';
|
|
3
3
|
export type MessageRole = 'user' | 'assistant';
|
|
4
4
|
export interface ResponseMetadata extends Record<string, unknown> {
|
|
5
|
+
userMessageId?: string;
|
|
5
6
|
sessionId?: string;
|
|
6
7
|
stopReason?: string | null;
|
|
7
8
|
resultSubtype?: string;
|