agent-afk 5.254.3 → 5.255.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/README.md +2 -0
- 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/mcp/client.d.ts +1 -1
- package/dist/agent/mcp/health-check.d.ts +13 -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/types/session-types.d.ts +1 -1
- package/dist/cli/terminal-compositor.reset.d.ts +1 -0
- package/dist/cli.mjs +349 -349
- package/dist/config/env.d.ts +7 -0
- package/dist/config/env.mcp.d.ts +15 -0
- package/dist/index.mjs +138 -138
- package/dist/telegram.mjs +174 -174
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,6 +30,8 @@ afk chat "hello" # first real conversation
|
|
|
30
30
|
|
|
31
31
|
That's it. You're in.
|
|
32
32
|
|
|
33
|
+
**Using pnpm?** `pnpm add -g agent-afk` works, but pnpm 10 blocks build scripts by default and silently skips `postinstall` (see [#2199](https://github.com/griffinwork40/agent-afk/issues/2199)). Run `pnpm approve-builds -g` after install to approve the hook, or use `npm install -g agent-afk` instead. If a launchd/systemd-supervised `afk daemon` is already running and pnpm skipped the hook, restart it manually with `afk service restart daemon`.
|
|
34
|
+
|
|
33
35
|
**Try without installing:** `npx agent-afk chat "hello"` runs a one-shot turn with zero global install.
|
|
34
36
|
|
|
35
37
|
**Already using Claude Code or Codex?** `afk login` will detect your existing credentials automatically. Run `afk migrate` to import your plugins, skills, and MCP servers too -- it live-reads the source tool's dirs, so anything you install there keeps showing up in AFK with no re-run.
|
|
@@ -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;
|
|
@@ -22,7 +22,7 @@ export declare class McpClient {
|
|
|
22
22
|
onToolListChanged?: () => void;
|
|
23
23
|
constructor(serverName: string, config: McpServerConfig, layer?: McpServerLayer, trustedAllowSecretEnv?: readonly string[]);
|
|
24
24
|
connect(): Promise<McpClientConnectResult>;
|
|
25
|
-
listTools(): Promise<McpTool[]>;
|
|
25
|
+
listTools(signal?: AbortSignal): Promise<McpTool[]>;
|
|
26
26
|
refreshTools(): Promise<McpTool[]>;
|
|
27
27
|
callTool(toolName: string, input: unknown, signal: AbortSignal): Promise<ToolResult>;
|
|
28
28
|
finishAuth(authorizationCode: string): Promise<void>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface McpHealthCheckResult {
|
|
2
|
+
serverName: string;
|
|
3
|
+
healthy: boolean;
|
|
4
|
+
error?: string;
|
|
5
|
+
durationMs: number;
|
|
6
|
+
}
|
|
7
|
+
export interface HealthCheckTarget {
|
|
8
|
+
serverName: string;
|
|
9
|
+
listTools(signal?: AbortSignal): Promise<unknown[]>;
|
|
10
|
+
}
|
|
11
|
+
export declare function runMcpHealthChecks(targets: readonly HealthCheckTarget[], timeoutMs?: number): Promise<McpHealthCheckResult[]>;
|
|
12
|
+
export declare function warnUnhealthyServers(results: readonly McpHealthCheckResult[]): void;
|
|
13
|
+
export declare function isMcpHealthCheckEnabled(): boolean;
|
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;
|