agent-afk 5.254.4 → 5.256.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/cwd-validator.d.ts +9 -0
- package/dist/agent/daemon/schedule-store.d.ts +1 -0
- package/dist/agent/daemon/session-spawn.d.ts +1 -0
- package/dist/agent/daemon/shell-task.d.ts +1 -0
- package/dist/agent/daemon/triggers.d.ts +1 -0
- package/dist/agent/fast-mode.d.ts +2 -0
- package/dist/agent/provider.d.ts +1 -1
- package/dist/agent/providers/openai-compatible/index.d.ts +1 -0
- package/dist/agent/providers/openai-compatible/models-catalog.d.ts +16 -0
- package/dist/agent/providers/openai-compatible/pricing.d.ts +1 -0
- package/dist/agent/providers/openai-compatible/query/chatgpt-backend-errors.d.ts +2 -0
- package/dist/agent/providers/openai-compatible/query/fast-mode.d.ts +6 -0
- package/dist/agent/providers/openai-compatible/query/fast-tier-session.d.ts +26 -0
- package/dist/agent/providers/openai-compatible/query.d.ts +4 -1
- package/dist/agent/providers/openai-compatible/translate.d.ts +1 -1
- package/dist/agent/providers/shared/tool-call-trace.d.ts +1 -0
- package/dist/agent/session/preamble-strip.d.ts +3 -0
- package/dist/agent/trace/events.d.ts +4 -0
- package/dist/agent/trace/types.d.ts +1 -0
- package/dist/agent/types/session-types.d.ts +1 -1
- package/dist/agent/whatif-episode-gate.d.ts +5 -0
- package/dist/cli/terminal-compositor.reset.d.ts +1 -0
- package/dist/cli.mjs +351 -350
- package/dist/config/env.d.ts +23 -0
- package/dist/config/env.paths.d.ts +28 -0
- package/dist/config/env.whatif.d.ts +24 -0
- package/dist/index.mjs +138 -138
- package/dist/paths.d.ts +1 -0
- package/dist/telegram.mjs +175 -174
- package/package.json +1 -1
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function expandCwd(rawCwd: string): string;
|
|
2
|
+
export declare function validateScheduleCwd(rawCwd: string): {
|
|
3
|
+
ok: true;
|
|
4
|
+
resolved: string;
|
|
5
|
+
} | {
|
|
6
|
+
ok: false;
|
|
7
|
+
error: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function checkTaskCwdAtRuntime(cwd: string): string | undefined;
|
|
@@ -8,6 +8,7 @@ export interface DaemonSpawnOptions {
|
|
|
8
8
|
sessionConfig?: Partial<AgentConfig>;
|
|
9
9
|
sessionFactory?: (config: AgentConfig, ownedTraceWriter?: TraceWriter) => AgentSession;
|
|
10
10
|
trigger?: 'cron' | 'sessionstart' | 'pull';
|
|
11
|
+
taskCwd?: string;
|
|
11
12
|
}
|
|
12
13
|
export declare function daemonTraceLabel(taskId: string): string;
|
|
13
14
|
export declare function spawnDaemonSession(taskId: string, options: DaemonSpawnOptions): Promise<{
|
|
@@ -6,6 +6,7 @@ export interface FastModeContext {
|
|
|
6
6
|
providerFamily: string;
|
|
7
7
|
hasCustomEndpoint: boolean;
|
|
8
8
|
executionPath: FastExecutionPath;
|
|
9
|
+
modelEligible?: boolean;
|
|
9
10
|
}
|
|
10
11
|
export type FastModeStatus = Readonly<{
|
|
11
12
|
preference: FastModePreference;
|
|
@@ -13,6 +14,7 @@ export type FastModeStatus = Readonly<{
|
|
|
13
14
|
reason?: FastModeInactiveReason;
|
|
14
15
|
}>;
|
|
15
16
|
export type FastTurnDecision = FastModeStatus;
|
|
17
|
+
export declare const OPENAI_FAST_MODEL_FALLBACK: RegExp;
|
|
16
18
|
export declare function resolveFastModeStatus(preference: FastModePreference, context: FastModeContext): FastModeStatus;
|
|
17
19
|
export declare class FastModeController {
|
|
18
20
|
private preference;
|
package/dist/agent/provider.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export interface OpenAICompatibleProviderOptions extends ChildSessionOptions {
|
|
|
28
28
|
tools?: ToolDispatcher;
|
|
29
29
|
mcpManager?: import('../../mcp/index.js').McpManager;
|
|
30
30
|
customTools?: import('../../tools/custom-tool.js').CustomToolDef[];
|
|
31
|
+
fastModeController?: import('../../fast-mode.js').FastModeController;
|
|
31
32
|
}
|
|
32
33
|
export declare class OpenAICompatibleProvider implements ModelProvider {
|
|
33
34
|
readonly name = "openai-compatible";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface CatalogModel {
|
|
2
|
+
slug: string;
|
|
3
|
+
service_tiers?: Array<{
|
|
4
|
+
id: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
}>;
|
|
8
|
+
default_service_tier?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface CatalogReaderDeps {
|
|
11
|
+
homedir?: () => string;
|
|
12
|
+
readFile?: (path: string) => string | null;
|
|
13
|
+
}
|
|
14
|
+
export declare function resetCatalogCache(): void;
|
|
15
|
+
export declare function loadModelsCatalog(deps?: CatalogReaderDeps): Map<string, CatalogModel>;
|
|
16
|
+
export declare function isCatalogModelPriorityEligible(modelSlug: string, deps?: CatalogReaderDeps): boolean | undefined;
|
|
@@ -5,3 +5,4 @@ export interface ModelPricing {
|
|
|
5
5
|
}
|
|
6
6
|
export declare const MODEL_PRICING: ReadonlyMap<string, ModelPricing>;
|
|
7
7
|
export declare function deriveCallCostUsd(model: string, inputTokens: number, outputTokens: number, cachedInputTokens?: number): number | undefined;
|
|
8
|
+
export declare function deriveCallCostUsdWithTier(model: string, inputTokens: number, outputTokens: number, cachedInputTokens?: number, confirmedPriorityTier?: boolean): number | undefined;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { FastModeController, FastTurnDecision } from '../../../fast-mode.js';
|
|
2
|
+
export declare function snapshotFastDecision(controller: FastModeController | undefined, model: string, hasCustomEndpoint: boolean): FastTurnDecision | undefined;
|
|
3
|
+
export declare function isFastModeServiceTierError(error: unknown): boolean;
|
|
4
|
+
export declare function extractResponsesServiceTier(responseObj: Record<string, unknown> | null | undefined): string | undefined;
|
|
5
|
+
export declare function extractChatCompletionsServiceTier(chunk: Record<string, unknown> | null | undefined): string | undefined;
|
|
6
|
+
export declare function makeFastModeMismatchWarning(fast: boolean, appliedTier: string | undefined): string | undefined;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { FastModeController } from '../../../fast-mode.js';
|
|
2
|
+
import type { ProviderEvent } from '../../../provider.js';
|
|
3
|
+
export declare const OPENAI_FAST_SERVICE_TIER = "priority";
|
|
4
|
+
export declare function isCustomOpenAIEndpoint(baseURL: string | undefined): boolean;
|
|
5
|
+
export interface FastTierOptions {
|
|
6
|
+
controller: FastModeController;
|
|
7
|
+
hasCustomEndpoint: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare class FastTierSession {
|
|
10
|
+
private readonly opts;
|
|
11
|
+
private rejected;
|
|
12
|
+
private warned;
|
|
13
|
+
private turnFast;
|
|
14
|
+
private appliedTier;
|
|
15
|
+
private pendingNotice;
|
|
16
|
+
constructor(opts: FastTierOptions | undefined);
|
|
17
|
+
beginTurn(model: string): boolean;
|
|
18
|
+
get active(): boolean;
|
|
19
|
+
create<T>(body: Record<string, unknown>, call: (b: Record<string, unknown>) => Promise<T>): Promise<T>;
|
|
20
|
+
observeResponsesEvent(event: unknown): void;
|
|
21
|
+
observeChatChunk(chunk: unknown): void;
|
|
22
|
+
confirmedFast(): boolean;
|
|
23
|
+
drainNotice(sessionId: string): Generator<ProviderEvent>;
|
|
24
|
+
private recordApplied;
|
|
25
|
+
private queueNotice;
|
|
26
|
+
}
|
|
@@ -4,6 +4,7 @@ import type { ProviderQuery, ProviderEvent, ProviderUserTurn, ProviderContextUsa
|
|
|
4
4
|
import { type OpenAIAuthResolution, type AuthResolverDeps } from './auth.js';
|
|
5
5
|
import type { ToolDispatcher } from '../anthropic-direct/tool-dispatcher.js';
|
|
6
6
|
import { resolveReasoningEffort } from './query/model-params.js';
|
|
7
|
+
import { type FastTierOptions } from './query/fast-tier-session.js';
|
|
7
8
|
export { __setRetryBaseDelay } from './query/retry.js';
|
|
8
9
|
export { __setOpenAIClientFactory } from './query/client.js';
|
|
9
10
|
export type { OpenAIClientFactory } from './query/client.js';
|
|
@@ -23,6 +24,7 @@ export interface OpenAICompatibleQueryOptions {
|
|
|
23
24
|
mcpManager?: import('../../mcp/index.js').McpManager;
|
|
24
25
|
useResponsesApi?: boolean;
|
|
25
26
|
traceWriter?: TraceSink;
|
|
27
|
+
fastTier?: FastTierOptions;
|
|
26
28
|
}
|
|
27
29
|
export declare class OpenAICompatibleQuery implements ProviderQuery {
|
|
28
30
|
private readonly client;
|
|
@@ -35,6 +37,7 @@ export declare class OpenAICompatibleQuery implements ProviderQuery {
|
|
|
35
37
|
private readonly wireMode;
|
|
36
38
|
private readonly useOpenAIPricing;
|
|
37
39
|
private readonly traceWriter;
|
|
40
|
+
private readonly fastTier;
|
|
38
41
|
private priorTurns;
|
|
39
42
|
private currentModel;
|
|
40
43
|
private currentPermissionMode;
|
|
@@ -49,7 +52,6 @@ export declare class OpenAICompatibleQuery implements ProviderQuery {
|
|
|
49
52
|
private runTurn;
|
|
50
53
|
private _runTurnInner;
|
|
51
54
|
private finishTurn;
|
|
52
|
-
private clarifyResponsesError;
|
|
53
55
|
private runIteration;
|
|
54
56
|
private dispatchAndAppend;
|
|
55
57
|
interrupt(reason?: import('../../abort-reason.js').ProviderAbortReason): Promise<void>;
|
|
@@ -80,4 +82,5 @@ export declare function buildQueryFromConfig(config: AgentConfig, promptStream:
|
|
|
80
82
|
useResponsesApi?: boolean;
|
|
81
83
|
authDeps?: AuthResolverDeps;
|
|
82
84
|
sessionIdOverride?: string;
|
|
85
|
+
fastTier?: FastTierOptions;
|
|
83
86
|
}): OpenAICompatibleQuery;
|
|
@@ -48,6 +48,6 @@ export interface AccumulatedToolCall {
|
|
|
48
48
|
}
|
|
49
49
|
export declare function createStreamState(): StreamState;
|
|
50
50
|
export declare function translateChunk(chunk: OpenAIChunk, state: StreamState, sessionId: string): Generator<ProviderEvent>;
|
|
51
|
-
export declare function usageFromState(state: StreamState, model?: string): ProviderUsage;
|
|
51
|
+
export declare function usageFromState(state: StreamState, model?: string, confirmedPriorityTier?: boolean): ProviderUsage;
|
|
52
52
|
export declare function finalizedToolCalls(state: StreamState): AccumulatedToolCall[];
|
|
53
53
|
export declare function isToolCallStop(state: StreamState): boolean;
|
|
@@ -6,6 +6,7 @@ export declare function buildToolCallStartedPayload(args: {
|
|
|
6
6
|
input: unknown;
|
|
7
7
|
subagentId?: string | undefined;
|
|
8
8
|
}): ToolCallStartedPayload;
|
|
9
|
+
export declare function buildErrorHead(isError: boolean, content: string): string | undefined;
|
|
9
10
|
export declare function buildToolCallCompletedPayload(args: {
|
|
10
11
|
toolUseId: string;
|
|
11
12
|
name: string;
|
|
@@ -47,6 +47,7 @@ export declare const ToolCallCompletedPayloadSchema: z.ZodObject<{
|
|
|
47
47
|
batchIndex: z.ZodOptional<z.ZodNumber>;
|
|
48
48
|
batchSize: z.ZodOptional<z.ZodNumber>;
|
|
49
49
|
subagentId: z.ZodOptional<z.ZodString>;
|
|
50
|
+
errorHead: z.ZodOptional<z.ZodString>;
|
|
50
51
|
}, z.core.$strip>;
|
|
51
52
|
export declare const ToolCallPayloadSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
52
53
|
phase: z.ZodLiteral<"started">;
|
|
@@ -82,6 +83,7 @@ export declare const ToolCallPayloadSchema: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
82
83
|
batchIndex: z.ZodOptional<z.ZodNumber>;
|
|
83
84
|
batchSize: z.ZodOptional<z.ZodNumber>;
|
|
84
85
|
subagentId: z.ZodOptional<z.ZodString>;
|
|
86
|
+
errorHead: z.ZodOptional<z.ZodString>;
|
|
85
87
|
}, z.core.$strip>], "phase">;
|
|
86
88
|
export declare const HookEventNameSchema: z.ZodEnum<{
|
|
87
89
|
PreToolUse: "PreToolUse";
|
|
@@ -631,6 +633,7 @@ export declare const TraceEventInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject
|
|
|
631
633
|
batchIndex: z.ZodOptional<z.ZodNumber>;
|
|
632
634
|
batchSize: z.ZodOptional<z.ZodNumber>;
|
|
633
635
|
subagentId: z.ZodOptional<z.ZodString>;
|
|
636
|
+
errorHead: z.ZodOptional<z.ZodString>;
|
|
634
637
|
}, z.core.$strip>], "phase">;
|
|
635
638
|
}, z.core.$strip>, z.ZodObject<{
|
|
636
639
|
kind: z.ZodLiteral<"hook_decision">;
|
|
@@ -981,6 +984,7 @@ export declare const TraceEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
981
984
|
batchIndex: z.ZodOptional<z.ZodNumber>;
|
|
982
985
|
batchSize: z.ZodOptional<z.ZodNumber>;
|
|
983
986
|
subagentId: z.ZodOptional<z.ZodString>;
|
|
987
|
+
errorHead: z.ZodOptional<z.ZodString>;
|
|
984
988
|
}, z.core.$strip>], "phase">;
|
|
985
989
|
}, z.core.$strip>, z.ZodObject<{
|
|
986
990
|
ts: z.ZodString;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { HookContext, HookDecision } from './hooks.js';
|
|
2
|
+
export declare function resetWhatifEpisodeGateForTests(): void;
|
|
3
|
+
export declare function isWhatifEpisode(): boolean;
|
|
4
|
+
export declare const EPISODE_BLOCK_REASON: string;
|
|
5
|
+
export declare function createWhatifEpisodeGate(): (context: HookContext) => HookDecision;
|