agent-afk 5.277.0 → 5.278.1
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/memory/index.d.ts +1 -1
- package/dist/agent/memory/memory-store.access.d.ts +5 -0
- package/dist/agent/memory/memory-store.d.ts +3 -1
- package/dist/agent/memory/types.d.ts +7 -0
- package/dist/agent/outcomes/load-outcome-turns.d.ts +2 -0
- package/dist/agent/plugins/tool-injector.d.ts +1 -0
- package/dist/agent/providers/anthropic-direct/auth.d.ts +1 -0
- package/dist/agent/providers/openai-compatible/query/build-query.d.ts +19 -0
- package/dist/agent/providers/openai-compatible/query/live-updates.d.ts +5 -0
- package/dist/agent/providers/openai-compatible/query/query-options.d.ts +1 -0
- package/dist/agent/providers/openai-compatible/query/retry.d.ts +1 -0
- package/dist/agent/providers/openai-compatible/query/rewind-conversation.d.ts +5 -0
- package/dist/agent/providers/openai-compatible/query/turn-driver.d.ts +3 -0
- package/dist/agent/providers/openai-compatible/query/usage-limit-tier.d.ts +18 -0
- package/dist/agent/providers/openai-compatible/query.d.ts +13 -17
- package/dist/agent/tools/skill-bridge.d.ts +1 -0
- package/dist/cli/config/types.d.ts +6 -0
- package/dist/cli/slash/commands/afk-md/reload.d.ts +1 -0
- package/dist/cli.mjs +325 -311
- package/dist/config/mutate.d.ts +1 -1
- package/dist/config/settable-keys.d.ts +2 -2
- package/dist/index.mjs +141 -127
- package/dist/skills/skill-types.d.ts +1 -0
- package/dist/telegram.mjs +163 -149
- package/dist/whatif/question-fit.d.ts +9 -0
- package/package.json +1 -1
|
@@ -4,4 +4,4 @@ export { injectGoalPrompt } from '../goals/inject.js';
|
|
|
4
4
|
export { createMemorySessionEndHook, createChildMemoryHotBlockHook } from './memory-hooks.js';
|
|
5
5
|
export { guardChildHotWrites, isForkedChildSession, CHILD_HOT_WRITE_DENIED, type ForkSignals } from './memory-hot-guard.js';
|
|
6
6
|
export { memorySearchTool, memoryUpdateTool, procedureWriteTool, memoryToolSchemas, MEMORY_TOOL_NAMES, createMemoryHandlers, } from './memory-tools.js';
|
|
7
|
-
export type { Fact, NewFact, FactCategory, SessionRecord, NewSession, SessionOutcome, Procedure, SearchOpts, MemorySearchResult, MemoryUpdateAction, MemoryUpdateTarget, WALEntry, } from './types.js';
|
|
7
|
+
export type { AccessStats, Fact, NewFact, FactCategory, SessionRecord, NewSession, SessionOutcome, Procedure, SearchOpts, MemorySearchResult, MemoryUpdateAction, MemoryUpdateTarget, WALEntry, } from './types.js';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type BetterSqlite3 from 'better-sqlite3';
|
|
2
|
+
import type { AccessStats, Fact } from './types.js';
|
|
3
|
+
export type { AccessStats };
|
|
4
|
+
export declare function queryUnaccessed(db: BetterSqlite3.Database, minAgeDays?: number): Fact[];
|
|
5
|
+
export declare function queryAccessStats(db: BetterSqlite3.Database): AccessStats;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Fact, NewFact, SearchOpts, MemorySearchResult, SessionRecord, NewSession, Procedure, SessionOutcome } from './types.js';
|
|
1
|
+
import type { AccessStats, Fact, NewFact, SearchOpts, MemorySearchResult, SessionRecord, NewSession, Procedure, SessionOutcome } from './types.js';
|
|
2
2
|
export declare const HOT_SOFT_WARN_RATIO = 0.8;
|
|
3
3
|
export declare function estimateTokens(text: string): number;
|
|
4
4
|
export interface HotUsage {
|
|
@@ -21,6 +21,8 @@ export declare class MemoryStore {
|
|
|
21
21
|
supersedeFact(factId: number, newContent: string, category?: string, evidence?: string | null): number;
|
|
22
22
|
removeFact(factId: number): boolean;
|
|
23
23
|
getFact(factId: number): Fact | null;
|
|
24
|
+
getUnaccessed(minAgeDays?: number): Fact[];
|
|
25
|
+
getAccessStats(): AccessStats;
|
|
24
26
|
searchFacts(query: string, opts?: SearchOpts): Fact[];
|
|
25
27
|
startSession(session: NewSession): void;
|
|
26
28
|
endSession(sessionId: string, summary: string, outcome: SessionOutcome, tokenCount?: number, costUsd?: number): void;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { JournalMessage, JournalRecord } from '../journal/types.js';
|
|
2
2
|
import type { Turn } from './artifacts.js';
|
|
3
|
+
import type { Artifacts } from './schema.js';
|
|
3
4
|
export type OutcomeTurnsSource = 'sidecar' | 'journal' | 'none';
|
|
4
5
|
export interface OutcomeTurnsResult {
|
|
5
6
|
turns: Turn[];
|
|
6
7
|
source: OutcomeTurnsSource;
|
|
7
8
|
}
|
|
8
9
|
export declare function loadOutcomeTurns(sessionId: string): OutcomeTurnsResult;
|
|
10
|
+
export declare function recoverSubagentArtifacts(sessionId: string): Artifacts;
|
|
9
11
|
export declare function sessionHistoryMessages(records: readonly JournalRecord[]): JournalMessage[];
|
|
@@ -10,6 +10,7 @@ export interface PluginSkillMetadata {
|
|
|
10
10
|
model?: string;
|
|
11
11
|
body?: string;
|
|
12
12
|
audience?: 'public' | 'internal';
|
|
13
|
+
disableModelInvocation?: boolean;
|
|
13
14
|
}
|
|
14
15
|
export declare function normalizeToolToken(token: string, knownToolNames: ReadonlySet<string>): string | undefined;
|
|
15
16
|
export declare function parseToolsField(inlineValue: string, remainingLines: string[]): string[];
|
|
@@ -13,6 +13,7 @@ export declare function buildClientOptions(token: string, mode: AuthMode, baseUr
|
|
|
13
13
|
}) & {
|
|
14
14
|
baseURL?: string;
|
|
15
15
|
fetch?: typeof fetch;
|
|
16
|
+
maxRetries: 0;
|
|
16
17
|
};
|
|
17
18
|
export declare function buildRequestHeaders(mode: AuthMode, sessionId: string, requestId: string, withEffort?: boolean, extendedCacheTtl?: boolean, withFast?: boolean): Record<string, string>;
|
|
18
19
|
export declare function buildSystemPrefix(mode: AuthMode): ContentBlockParam[] | null;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AgentConfig } from '../../../types/config-types.js';
|
|
2
|
+
import type { ProviderUserTurn } from '../../../provider.js';
|
|
3
|
+
import { type AuthResolverDeps } from '../auth.js';
|
|
4
|
+
import type { ToolDispatcher } from '../../anthropic-direct/tool-dispatcher.js';
|
|
5
|
+
import { OpenAICompatibleQuery } from '../query.js';
|
|
6
|
+
import type { FastTierOptions } from './fast-tier-session.js';
|
|
7
|
+
export declare function buildQueryFromConfig(config: AgentConfig, promptStream: AsyncIterable<ProviderUserTurn>, options?: {
|
|
8
|
+
baseURL?: string;
|
|
9
|
+
defaultHeaders?: Record<string, string>;
|
|
10
|
+
toolDispatcher?: ToolDispatcher;
|
|
11
|
+
onPermissionMode?: (mode: string) => void;
|
|
12
|
+
onCwdChange?: (cwd: string) => void;
|
|
13
|
+
systemPromptRebuildFactory?: (basePrompt: string | undefined) => string;
|
|
14
|
+
mcpManager?: import('../../../mcp/index.js').McpManager;
|
|
15
|
+
useResponsesApi?: boolean;
|
|
16
|
+
authDeps?: AuthResolverDeps;
|
|
17
|
+
sessionIdOverride?: string;
|
|
18
|
+
fastTier?: FastTierOptions;
|
|
19
|
+
}): OpenAICompatibleQuery;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { AgentConfig } from '../../../types/config-types.js';
|
|
2
|
+
export declare function applySetSystemPrompt(config: AgentConfig, basePrompt: string | undefined, systemPromptRebuildFactory?: (basePrompt: string | undefined) => string, currentBasePromptRef?: {
|
|
3
|
+
current: string | undefined;
|
|
4
|
+
}): boolean;
|
|
5
|
+
export type BeforeNextRoundCallback = (() => string | undefined) | undefined;
|
|
@@ -15,6 +15,7 @@ export interface OpenAICompatibleQueryOptions {
|
|
|
15
15
|
toolDispatcher?: ToolDispatcher;
|
|
16
16
|
onPermissionMode?: (mode: string) => void;
|
|
17
17
|
onCwdChange?: (cwd: string) => void;
|
|
18
|
+
systemPromptRebuildFactory?: (basePrompt: string | undefined) => string;
|
|
18
19
|
mcpManager?: import('../../../mcp/index.js').McpManager;
|
|
19
20
|
useResponsesApi?: boolean;
|
|
20
21
|
traceWriter?: TraceSink;
|
|
@@ -3,6 +3,7 @@ export declare const MAX_STREAM_RETRIES = 3;
|
|
|
3
3
|
export declare function __setRetryBaseDelay(ms: number | null): void;
|
|
4
4
|
export declare function computeBackoffDelay(attempt: number): number;
|
|
5
5
|
export declare const RETRY_AFTER_MAX_WAIT_MS = 120000;
|
|
6
|
+
export declare function __setRetryAfterMaxWaitMs(ms: number | null): void;
|
|
6
7
|
export declare function retryAfterDelayMs(err: unknown): number | undefined;
|
|
7
8
|
export declare function getErrorStatus(err: unknown): number | undefined;
|
|
8
9
|
export declare function isRetryableConnectionError(err: unknown): boolean;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ProviderRewindConversationResult, RewindTarget } from '../../../provider.js';
|
|
2
|
+
import type { OpenAIMessage } from '../messages.js';
|
|
3
|
+
import type { AbortCoordinator } from '../../shared/abort-coordinator.js';
|
|
4
|
+
export declare function listOpenAIUserTurns(priorTurns: readonly OpenAIMessage[]): RewindTarget[];
|
|
5
|
+
export declare function rewindOpenAIConversation(priorTurns: OpenAIMessage[], abort: AbortCoordinator, closed: boolean, turnIndex: number): ProviderRewindConversationResult;
|
|
@@ -21,5 +21,8 @@ export interface TurnDriverContext extends IterationContext, FinishTurnContext {
|
|
|
21
21
|
readonly currentModel: string;
|
|
22
22
|
readonly currentPermissionMode: string;
|
|
23
23
|
readonly closed: boolean;
|
|
24
|
+
readonly beforeNextRound: (() => string | undefined) | undefined;
|
|
24
25
|
}
|
|
26
|
+
export declare function applyBeforeNextRound(priorTurns: OpenAIMessage[], steeringText: string | undefined, traceWriter: TraceSink | undefined, subagentId: string | undefined): void;
|
|
27
|
+
export declare function applyAndSyncSteering(ctx: TurnDriverContext): void;
|
|
25
28
|
export declare function runTurnInner(ctx: TurnDriverContext, content: ProviderUserTurn['content'], controller: AbortController, turnStartTime: number, taskId: string): AsyncGenerator<ProviderEvent>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ProviderEvent } from '../../../provider.js';
|
|
2
|
+
import type { TraceSink } from '../../../trace/index.js';
|
|
3
|
+
import type { IterationResult } from './stream-drive.js';
|
|
4
|
+
export declare const QUOTA_TRANSIENT_THRESHOLD_MS: number;
|
|
5
|
+
export declare function __setQuotaTransientThresholdMs(ms: number | null): void;
|
|
6
|
+
export declare const QUOTA_TWO_HOURS_MS: number;
|
|
7
|
+
export declare const QUOTA_FALLBACK_WAIT_MS: number;
|
|
8
|
+
export declare function __setQuotaTwoHoursMs(ms: number | null): void;
|
|
9
|
+
export declare function __setQuotaFallbackWaitMs(ms: number | null): void;
|
|
10
|
+
export declare function isQuotaLimitErrorEvent(event: ProviderEvent): boolean;
|
|
11
|
+
export interface QuotaLimitTierContext {
|
|
12
|
+
autoResumeOnUsageLimit: boolean;
|
|
13
|
+
traceWriter: TraceSink | undefined;
|
|
14
|
+
signal: AbortSignal;
|
|
15
|
+
isClosed: () => boolean;
|
|
16
|
+
sessionId: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function runIterationWithQuotaLimitPause(makeIteration: () => AsyncGenerator<ProviderEvent, IterationResult | null>, ctx: QuotaLimitTierContext): AsyncGenerator<ProviderEvent, IterationResult | null>;
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import OpenAI from 'openai';
|
|
2
|
-
import type { AgentConfig } from '../../types/config-types.js';
|
|
3
2
|
import type { TraceSink } from '../../trace/index.js';
|
|
4
|
-
import type { ProviderQuery, ProviderEvent,
|
|
5
|
-
import { type AuthResolverDeps } from './auth.js';
|
|
3
|
+
import type { ProviderQuery, ProviderEvent, ProviderContextUsage, ProviderRewindResult, ProviderModelInfo, ProviderCommandInfo, ProviderAgentInfo, ProviderMcpServerStatus, ProviderAccountInfo, ProviderUsage, ProviderCompactResult } from '../../provider.js';
|
|
6
4
|
import { type OpenAIMessage } from './messages.js';
|
|
7
5
|
import { type OpenAIFunctionTool } from './loop.js';
|
|
8
6
|
import { type WireMode } from './responses-config.js';
|
|
@@ -10,12 +8,14 @@ import type { ToolDispatcher } from '../anthropic-direct/tool-dispatcher.js';
|
|
|
10
8
|
import { AbortCoordinator } from '../shared/abort-coordinator.js';
|
|
11
9
|
import { OpenAIJournalWiring } from './query/journal-wiring.js';
|
|
12
10
|
import { resolveReasoningEffort } from './query/model-params.js';
|
|
13
|
-
import { FastTierSession
|
|
11
|
+
import { FastTierSession } from './query/fast-tier-session.js';
|
|
14
12
|
import { type TurnDriverContext } from './query/turn-driver.js';
|
|
15
13
|
import { type CompactHandlerContext } from './query/compact-handler.js';
|
|
16
14
|
import type { OpenAICompatibleQueryOptions } from './query/query-options.js';
|
|
17
15
|
export type { OpenAICompatibleQueryOptions } from './query/query-options.js';
|
|
18
|
-
|
|
16
|
+
import { type BeforeNextRoundCallback } from './query/live-updates.js';
|
|
17
|
+
export { buildQueryFromConfig } from './query/build-query.js';
|
|
18
|
+
export { __setRetryBaseDelay, __setRetryAfterMaxWaitMs } from './query/retry.js';
|
|
19
19
|
export { __setOpenAIClientFactory } from './query/client.js';
|
|
20
20
|
export type { OpenAIClientFactory } from './query/client.js';
|
|
21
21
|
export { isOSeriesModel, mapEffortForOpenAI } from './query/model-params.js';
|
|
@@ -27,6 +27,10 @@ export declare class OpenAICompatibleQuery implements ProviderQuery, TurnDriverC
|
|
|
27
27
|
readonly toolDispatcher: ToolDispatcher | undefined;
|
|
28
28
|
private readonly onPermissionMode?;
|
|
29
29
|
private readonly onCwdChange?;
|
|
30
|
+
private readonly systemPromptRebuildFactory?;
|
|
31
|
+
private readonly _currentBasePromptRef;
|
|
32
|
+
private _beforeNextRound;
|
|
33
|
+
get beforeNextRound(): BeforeNextRoundCallback;
|
|
30
34
|
private readonly openAITools;
|
|
31
35
|
readonly wireMode: WireMode;
|
|
32
36
|
readonly useOpenAIPricing: boolean;
|
|
@@ -56,6 +60,10 @@ export declare class OpenAICompatibleQuery implements ProviderQuery, TurnDriverC
|
|
|
56
60
|
setModel(model?: string): Promise<void>;
|
|
57
61
|
setPermissionMode(mode: string): Promise<void>;
|
|
58
62
|
setCwd(cwd: string): void;
|
|
63
|
+
setSystemPrompt(basePrompt: string | undefined): boolean;
|
|
64
|
+
setBeforeNextRound(cb: BeforeNextRoundCallback): void;
|
|
65
|
+
listRewindTargets(): import('../../provider.js').RewindTarget[];
|
|
66
|
+
rewindConversation(turnIndex: number): Promise<import('../../provider.js').ProviderRewindConversationResult>;
|
|
59
67
|
supportedCommands(): Promise<ProviderCommandInfo[]>;
|
|
60
68
|
supportedModels(): Promise<ProviderModelInfo[]>;
|
|
61
69
|
supportedAgents(): Promise<ProviderAgentInfo[]>;
|
|
@@ -68,15 +76,3 @@ export declare class OpenAICompatibleQuery implements ProviderQuery, TurnDriverC
|
|
|
68
76
|
journalSnapshot(): ReturnType<OpenAIJournalWiring['snapshot']>;
|
|
69
77
|
close(): void;
|
|
70
78
|
}
|
|
71
|
-
export declare function buildQueryFromConfig(config: AgentConfig, promptStream: AsyncIterable<ProviderUserTurn>, options?: {
|
|
72
|
-
baseURL?: string;
|
|
73
|
-
defaultHeaders?: Record<string, string>;
|
|
74
|
-
toolDispatcher?: ToolDispatcher;
|
|
75
|
-
onPermissionMode?: (mode: string) => void;
|
|
76
|
-
onCwdChange?: (cwd: string) => void;
|
|
77
|
-
mcpManager?: import('../../mcp/index.js').McpManager;
|
|
78
|
-
useResponsesApi?: boolean;
|
|
79
|
-
authDeps?: AuthResolverDeps;
|
|
80
|
-
sessionIdOverride?: string;
|
|
81
|
-
fastTier?: FastTierOptions;
|
|
82
|
-
}): OpenAICompatibleQuery;
|
|
@@ -7,6 +7,7 @@ export interface SkillManifestEntry {
|
|
|
7
7
|
source: 'builtin' | 'user' | 'project' | 'plugin' | 'imported' | 'command';
|
|
8
8
|
argumentHint?: string;
|
|
9
9
|
whenToUse?: string;
|
|
10
|
+
disableModelInvocation?: boolean;
|
|
10
11
|
}
|
|
11
12
|
export declare function buildSkillManifest(pluginConfigs?: SdkPluginConfig[], opts?: BuildSkillManifestOptions): string;
|
|
12
13
|
export interface CollectSkillEntriesOptions {
|
|
@@ -62,6 +62,9 @@ export interface CliConfig {
|
|
|
62
62
|
enableShellHooks?: boolean;
|
|
63
63
|
enablePluginHooks?: boolean;
|
|
64
64
|
importFrom?: ImportFromConfig;
|
|
65
|
+
skills?: {
|
|
66
|
+
hidden?: string[];
|
|
67
|
+
};
|
|
65
68
|
}
|
|
66
69
|
export interface ModelSlotConfigEntry {
|
|
67
70
|
id?: string;
|
|
@@ -131,6 +134,9 @@ export interface ConfigFileSchema {
|
|
|
131
134
|
skills?: boolean;
|
|
132
135
|
mcp?: boolean;
|
|
133
136
|
}>>;
|
|
137
|
+
skills?: {
|
|
138
|
+
hidden?: unknown[];
|
|
139
|
+
};
|
|
134
140
|
}
|
|
135
141
|
export declare const DEFAULT_CONFIG: Omit<CliConfig, 'apiKey'>;
|
|
136
142
|
export declare const DEFAULT_CLI_PERMISSION_MODE: PermissionMode;
|
|
@@ -5,6 +5,7 @@ export interface ReloadOutcome {
|
|
|
5
5
|
delta: number;
|
|
6
6
|
source: string;
|
|
7
7
|
shadowed: boolean;
|
|
8
|
+
frameworkPromptError?: string;
|
|
8
9
|
}
|
|
9
10
|
export declare function currentOverlayTokens(cwd?: string): number;
|
|
10
11
|
export declare function applyReload(ctx: SlashContext, baselineTokens: number): ReloadOutcome;
|