agent-afk 5.95.7 → 5.96.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/cli/config/json-tier-parse.d.ts +8 -0
- package/dist/cli/config/json-tier-paths.d.ts +7 -0
- package/dist/cli/config/json-tier.d.ts +1 -1
- package/dist/cli/config/live-apply.d.ts +15 -0
- package/dist/cli/config/provenance-cache.d.ts +8 -0
- package/dist/cli/config/provenance.d.ts +24 -0
- package/dist/cli/input/input-surface.d.ts +1 -0
- package/dist/cli/input/suggest-prompt-state.d.ts +15 -0
- package/dist/cli/input/suggest-prompt.d.ts +16 -0
- package/dist/cli/input/suggest-provider.d.ts +9 -0
- package/dist/cli/input/suggest-sanitize.d.ts +1 -0
- package/dist/cli/input/suggest-tier1.d.ts +2 -0
- package/dist/cli/input/suggest-tier2.d.ts +19 -0
- package/dist/cli/input/suggest-types.d.ts +39 -0
- package/dist/cli/input/suggest.d.ts +5 -35
- package/dist/cli/render/config-menu-model.d.ts +20 -0
- package/dist/cli/render/config-menu.d.ts +6 -20
- package/dist/cli/terminal-compositor.autocomplete.d.ts +0 -2
- package/dist/cli/terminal-compositor.d.ts +2 -0
- package/dist/cli/terminal-compositor.ghost.d.ts +5 -0
- package/dist/cli/terminal-compositor.input-dispatch.d.ts +1 -0
- package/dist/cli.mjs +503 -502
- package/dist/config/env.d.ts +2 -0
- package/dist/index.mjs +158 -158
- package/dist/telegram.mjs +196 -196
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ModelSlotBinding, type SlotName } from '../../agent/session/model-slots.js';
|
|
2
|
+
import type { CliConfig } from './types.js';
|
|
3
|
+
export interface ParsedJsonConfigFile {
|
|
4
|
+
readonly config: Partial<CliConfig>;
|
|
5
|
+
readonly modelsPartial: Partial<Record<SlotName, ModelSlotBinding>>;
|
|
6
|
+
}
|
|
7
|
+
export declare function parseJsonConfigFile(configPath: string): ParsedJsonConfigFile | undefined;
|
|
8
|
+
export declare function validatedValueView(parsed: ParsedJsonConfigFile): Record<string, unknown>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type JsonConfigTier = 'project' | 'user' | 'legacy';
|
|
2
|
+
export interface JsonConfigTierPath {
|
|
3
|
+
readonly tier: JsonConfigTier;
|
|
4
|
+
readonly path: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const TIER_LABELS: Readonly<Record<JsonConfigTier, string>>;
|
|
7
|
+
export declare function jsonConfigTierPaths(): readonly JsonConfigTierPath[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ModelSlotBinding, SlotName } from '../../agent/session/model-slots.js';
|
|
2
2
|
import type { CliConfig } from './types.js';
|
|
3
3
|
export declare function resetJsonConfigCache(): void;
|
|
4
4
|
export declare function loadJsonConfig(): {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface LiveApplyHandle {
|
|
2
|
+
setModel(id: string): Promise<void>;
|
|
3
|
+
noteModel?(id: string): void;
|
|
4
|
+
repaint?(): void;
|
|
5
|
+
}
|
|
6
|
+
export type LiveApplyOutcome = {
|
|
7
|
+
readonly applied: true;
|
|
8
|
+
readonly note: string;
|
|
9
|
+
} | {
|
|
10
|
+
readonly applied: false;
|
|
11
|
+
readonly reason?: string;
|
|
12
|
+
};
|
|
13
|
+
export declare function isLiveAppliable(path: string): boolean;
|
|
14
|
+
export declare function liveAppliableKeys(): readonly string[];
|
|
15
|
+
export declare function applyConfigLive(path: string, rawValue: string, handle: LiveApplyHandle | undefined): Promise<LiveApplyOutcome>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
type TierObject = Record<string, unknown> | undefined;
|
|
2
|
+
export interface ProvenanceCache {
|
|
3
|
+
raw(file: string, compute: () => TierObject): TierObject;
|
|
4
|
+
validated(file: string, compute: () => TierObject): TierObject;
|
|
5
|
+
}
|
|
6
|
+
export declare function createProvenanceCache(): ProvenanceCache;
|
|
7
|
+
export declare const NO_PROVENANCE_CACHE: ProvenanceCache;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type JsonConfigTier } from './json-tier-paths.js';
|
|
2
|
+
import { type ProvenanceCache } from './provenance-cache.js';
|
|
3
|
+
export declare const CONFIG_ENV_SHADOWS: Readonly<Record<string, readonly string[]>>;
|
|
4
|
+
export type ConfigSource = {
|
|
5
|
+
readonly kind: 'env';
|
|
6
|
+
readonly via: string;
|
|
7
|
+
} | {
|
|
8
|
+
readonly kind: JsonConfigTier;
|
|
9
|
+
readonly path: string;
|
|
10
|
+
} | {
|
|
11
|
+
readonly kind: 'default';
|
|
12
|
+
};
|
|
13
|
+
export interface ConfigProvenance {
|
|
14
|
+
readonly path: string;
|
|
15
|
+
readonly effective: unknown;
|
|
16
|
+
readonly source: ConfigSource;
|
|
17
|
+
readonly shadowedBy?: ConfigSource;
|
|
18
|
+
readonly userValue: unknown;
|
|
19
|
+
}
|
|
20
|
+
export declare function describeSource(src: ConfigSource): string;
|
|
21
|
+
export declare function sourceSuffix(prov: ConfigProvenance): string | undefined;
|
|
22
|
+
export declare function shadowNote(prov: ConfigProvenance): string | undefined;
|
|
23
|
+
export declare function activeEnvShadow(path: string): string | undefined;
|
|
24
|
+
export declare function resolveConfigProvenance(path: string, cache?: ProvenanceCache): ConfigProvenance;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CompleteFn, SuggestContext } from './suggest-types.js';
|
|
2
|
+
export interface PromptSuggestionStateDeps {
|
|
3
|
+
pickModel(ctx: SuggestContext): string;
|
|
4
|
+
resolveComplete(model: string, ctx: SuggestContext): CompleteFn | null;
|
|
5
|
+
timeoutMs: number;
|
|
6
|
+
scrub(s: string): string;
|
|
7
|
+
onError?: (err: unknown) => void;
|
|
8
|
+
}
|
|
9
|
+
export interface PromptSuggestionState {
|
|
10
|
+
prime(ctx: SuggestContext): Promise<void>;
|
|
11
|
+
peek(): string | null;
|
|
12
|
+
clear(): void;
|
|
13
|
+
dispose(): void;
|
|
14
|
+
}
|
|
15
|
+
export declare function createPromptSuggestionState(deps: PromptSuggestionStateDeps): PromptSuggestionState;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { CompleteRequest, SuggestContext } from './suggest-types.js';
|
|
2
|
+
export declare function buildPromptSuggestionSystem(): string;
|
|
3
|
+
export declare function buildPromptSuggestionUser(ctx: SuggestContext): string;
|
|
4
|
+
export declare function hasSuggestionGrounding(ctx: SuggestContext): boolean;
|
|
5
|
+
export declare function isValidPromptSuggestion(reply: string): boolean;
|
|
6
|
+
export declare function normalizePromptSuggestion(raw: string): string | null;
|
|
7
|
+
export type PromptCompleteRequest = CompleteRequest;
|
|
8
|
+
export interface PromptSuggestionDeps {
|
|
9
|
+
resolveComplete(model: string): ((req: PromptCompleteRequest) => Promise<string>) | null;
|
|
10
|
+
model: string;
|
|
11
|
+
timeoutMs: number;
|
|
12
|
+
scrub(s: string): string;
|
|
13
|
+
onController(c: AbortController | null): void;
|
|
14
|
+
onError?(err: unknown): void;
|
|
15
|
+
}
|
|
16
|
+
export declare function generatePromptSuggestion(ctx: SuggestContext, deps: PromptSuggestionDeps): Promise<string | null>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ProviderRouteHints } from '../../agent/providers/index.js';
|
|
2
|
+
import type { ModelProvider } from '../../agent/provider.js';
|
|
3
|
+
import type { SuggestContext } from './suggest.js';
|
|
4
|
+
export declare function pickModel(ctx: SuggestContext): string;
|
|
5
|
+
export interface ProviderPool {
|
|
6
|
+
resolve(model: string | undefined, hints: ProviderRouteHints | undefined): ModelProvider;
|
|
7
|
+
closeAll(): void;
|
|
8
|
+
}
|
|
9
|
+
export declare function createProviderPool(resolveProviderFn?: (model: string | undefined, hints: ProviderRouteHints | undefined) => ModelProvider): ProviderPool;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function stripGhostControlChars(text: string): string;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CompleteFn } from './suggest-types.js';
|
|
2
|
+
import type { SuggestContext } from './suggest.js';
|
|
3
|
+
export declare const MIN_LLM_CHARS = 3;
|
|
4
|
+
export declare const DEBOUNCE_MS = 250;
|
|
5
|
+
export declare const TIMEOUT_MS = 1500;
|
|
6
|
+
export declare function buildSystem(): string;
|
|
7
|
+
export declare function buildUser(buffer: string, ctx: SuggestContext): string;
|
|
8
|
+
export interface Tier2Deps {
|
|
9
|
+
pickModel(ctx: SuggestContext): string;
|
|
10
|
+
resolveComplete(model: string, ctx: SuggestContext): CompleteFn | null;
|
|
11
|
+
debounceMs: number;
|
|
12
|
+
timeoutMs: number;
|
|
13
|
+
onError?: (err: unknown) => void;
|
|
14
|
+
}
|
|
15
|
+
export interface Tier2Runner {
|
|
16
|
+
request(buffer: string, ctx: SuggestContext): Promise<string | null>;
|
|
17
|
+
cancel(): void;
|
|
18
|
+
}
|
|
19
|
+
export declare function createTier2Runner(deps: Tier2Deps): Tier2Runner;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ModelProvider } from '../../agent/provider.js';
|
|
2
|
+
import type { ProviderRouteHints } from '../../agent/providers/index.js';
|
|
3
|
+
export interface SuggestContext {
|
|
4
|
+
model: string;
|
|
5
|
+
apiKey?: string;
|
|
6
|
+
baseUrl?: string;
|
|
7
|
+
cwd: string;
|
|
8
|
+
getHistory(): string[];
|
|
9
|
+
getDropdownTopCandidate(buffer: string): string | null;
|
|
10
|
+
getTranscriptTail(): string;
|
|
11
|
+
getRecentCommands(): string[];
|
|
12
|
+
llmEnabled(): boolean;
|
|
13
|
+
promptSuggestEnabled?(): boolean;
|
|
14
|
+
}
|
|
15
|
+
export interface CompleteRequest {
|
|
16
|
+
system: string;
|
|
17
|
+
user: string;
|
|
18
|
+
model: string;
|
|
19
|
+
maxTokens: number;
|
|
20
|
+
signal: AbortSignal;
|
|
21
|
+
apiKey?: string;
|
|
22
|
+
baseUrl?: string;
|
|
23
|
+
}
|
|
24
|
+
export type CompleteFn = (req: CompleteRequest) => Promise<string>;
|
|
25
|
+
export interface SuggestEngineOptions {
|
|
26
|
+
completeFn?: CompleteFn;
|
|
27
|
+
resolveProviderFn?: (model: string | undefined, hints: ProviderRouteHints | undefined) => ModelProvider;
|
|
28
|
+
debounceMs?: number;
|
|
29
|
+
timeoutMs?: number;
|
|
30
|
+
onError?: (err: unknown) => void;
|
|
31
|
+
}
|
|
32
|
+
export interface SuggestEngine {
|
|
33
|
+
getDeterministicGhost(buffer: string, ctx: SuggestContext): string | null;
|
|
34
|
+
getGhost(buffer: string, ctx: SuggestContext): Promise<string | null>;
|
|
35
|
+
primePromptSuggestion(ctx: SuggestContext): Promise<void>;
|
|
36
|
+
peekPromptSuggestion(): string | null;
|
|
37
|
+
clearPromptSuggestion(): void;
|
|
38
|
+
dispose(): void;
|
|
39
|
+
}
|
|
@@ -1,36 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
baseUrl?: string;
|
|
7
|
-
cwd: string;
|
|
8
|
-
getHistory(): string[];
|
|
9
|
-
getDropdownTopCandidate(buffer: string): string | null;
|
|
10
|
-
getTranscriptTail(): string;
|
|
11
|
-
getRecentCommands(): string[];
|
|
12
|
-
llmEnabled(): boolean;
|
|
13
|
-
}
|
|
14
|
-
export declare function stripGhostControlChars(text: string): string;
|
|
15
|
-
export interface SuggestEngineOptions {
|
|
16
|
-
completeFn?: (args: {
|
|
17
|
-
system: string;
|
|
18
|
-
user: string;
|
|
19
|
-
model: string;
|
|
20
|
-
maxTokens: number;
|
|
21
|
-
signal: AbortSignal;
|
|
22
|
-
apiKey?: string;
|
|
23
|
-
baseUrl?: string;
|
|
24
|
-
}) => Promise<string>;
|
|
25
|
-
resolveProviderFn?: (model: string | undefined, hints: ProviderRouteHints | undefined) => ModelProvider;
|
|
26
|
-
debounceMs?: number;
|
|
27
|
-
timeoutMs?: number;
|
|
28
|
-
onError?: (err: unknown) => void;
|
|
29
|
-
}
|
|
30
|
-
export interface SuggestEngine {
|
|
31
|
-
getDeterministicGhost(buffer: string, ctx: SuggestContext): string | null;
|
|
32
|
-
getGhost(buffer: string, ctx: SuggestContext): Promise<string | null>;
|
|
33
|
-
dispose(): void;
|
|
34
|
-
}
|
|
1
|
+
import type { SuggestEngine, SuggestEngineOptions } from './suggest-types.js';
|
|
2
|
+
export type { CompleteFn, CompleteRequest, SuggestContext, SuggestEngine, SuggestEngineOptions, } from './suggest-types.js';
|
|
3
|
+
export { stripGhostControlChars } from './suggest-sanitize.js';
|
|
4
|
+
export { pickModel } from './suggest-provider.js';
|
|
5
|
+
export { getDeterministicGhost } from './suggest-tier1.js';
|
|
35
6
|
export declare function createSuggestEngine(opts?: SuggestEngineOptions): SuggestEngine;
|
|
36
|
-
export declare function pickModel(ctx: SuggestContext): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type ConfigKeySpec } from '../../config/settable-keys.js';
|
|
2
|
+
export declare const CATEGORY_ORDER: readonly ["Model & routing", "Interactive", "Session", "Telegram", "Advanced"];
|
|
3
|
+
export declare function categoryOf(path: string): (typeof CATEGORY_ORDER)[number];
|
|
4
|
+
interface MenuCategory {
|
|
5
|
+
name: (typeof CATEGORY_ORDER)[number];
|
|
6
|
+
keys: readonly ConfigKeySpec[];
|
|
7
|
+
}
|
|
8
|
+
export declare function buildCategories(specs: readonly ConfigKeySpec[]): MenuCategory[];
|
|
9
|
+
export declare function formatValue(v: unknown): string;
|
|
10
|
+
export declare function keyRowLabel(spec: ConfigKeySpec, current: unknown, pad: number, suffix?: string): string;
|
|
11
|
+
type EditorPlan = {
|
|
12
|
+
kind: 'pick';
|
|
13
|
+
options: string[];
|
|
14
|
+
} | {
|
|
15
|
+
kind: 'text';
|
|
16
|
+
help: string;
|
|
17
|
+
};
|
|
18
|
+
export declare function editorFor(spec: ConfigKeySpec): EditorPlan;
|
|
19
|
+
export declare function makeValidator(spec: ConfigKeySpec): (raw: string) => string | null;
|
|
20
|
+
export {};
|
|
@@ -1,23 +1,8 @@
|
|
|
1
1
|
import type { TerminalCompositor } from '../terminal-compositor.js';
|
|
2
2
|
import { type ConfigKeySpec } from '../../config/settable-keys.js';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
name: (typeof CATEGORY_ORDER)[number];
|
|
7
|
-
keys: readonly ConfigKeySpec[];
|
|
8
|
-
}
|
|
9
|
-
export declare function buildCategories(specs: readonly ConfigKeySpec[]): MenuCategory[];
|
|
10
|
-
export declare function formatValue(v: unknown): string;
|
|
11
|
-
export declare function keyRowLabel(spec: ConfigKeySpec, current: unknown, pad: number): string;
|
|
12
|
-
type EditorPlan = {
|
|
13
|
-
kind: 'pick';
|
|
14
|
-
options: string[];
|
|
15
|
-
} | {
|
|
16
|
-
kind: 'text';
|
|
17
|
-
help: string;
|
|
18
|
-
};
|
|
19
|
-
export declare function editorFor(spec: ConfigKeySpec): EditorPlan;
|
|
20
|
-
export declare function makeValidator(spec: ConfigKeySpec): (raw: string) => string | null;
|
|
3
|
+
import { type ConfigProvenance } from '../config/provenance.js';
|
|
4
|
+
import { type ProvenanceCache } from '../config/provenance-cache.js';
|
|
5
|
+
import { type LiveApplyHandle, type LiveApplyOutcome } from '../config/live-apply.js';
|
|
21
6
|
export interface MenuOverlays {
|
|
22
7
|
pick(header: readonly string[], options: readonly string[]): Promise<number | null>;
|
|
23
8
|
editText(header: readonly string[], initial: string, help: string, validate: (v: string) => string | null): Promise<string | null>;
|
|
@@ -27,8 +12,9 @@ export interface MenuIo {
|
|
|
27
12
|
specs(): readonly ConfigKeySpec[];
|
|
28
13
|
current(path: string): unknown;
|
|
29
14
|
write(path: string, rawValue: string, allowHuman: boolean): string;
|
|
15
|
+
provenance?(path: string, cache?: ProvenanceCache): ConfigProvenance;
|
|
16
|
+
applyLive?(path: string, rawValue: string): Promise<LiveApplyOutcome>;
|
|
30
17
|
}
|
|
31
18
|
export declare function runConfigMenu(ov: MenuOverlays, io: MenuIo): Promise<void>;
|
|
32
19
|
export declare function overlaysFromCompositor(c: TerminalCompositor): MenuOverlays;
|
|
33
|
-
export declare function defaultIo(): MenuIo;
|
|
34
|
-
export {};
|
|
20
|
+
export declare function defaultIo(handle?: LiveApplyHandle): MenuIo;
|
|
@@ -13,6 +13,4 @@ export interface AutocompleteHost {
|
|
|
13
13
|
repaint(): void;
|
|
14
14
|
}
|
|
15
15
|
export declare function updateAutocomplete(self: AutocompleteHost): void;
|
|
16
|
-
export declare function updateGhost(self: AutocompleteHost): void;
|
|
17
16
|
export declare function applyDropdownSelection(self: AutocompleteHost): boolean;
|
|
18
|
-
export declare function applyGhostAccept(self: AutocompleteHost): boolean;
|
|
@@ -120,6 +120,8 @@ export declare class TerminalCompositor {
|
|
|
120
120
|
renderInputLine(): string;
|
|
121
121
|
updateAutocomplete(): void;
|
|
122
122
|
updateGhost(): void;
|
|
123
|
+
primePromptGhost(): void;
|
|
124
|
+
dismissPromptGhost(): boolean;
|
|
123
125
|
renderDropdownRows(): string[];
|
|
124
126
|
renderHintRow(): string | null;
|
|
125
127
|
repaint(): void;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type AutocompleteHost } from './terminal-compositor.autocomplete.js';
|
|
2
|
+
export declare function primePromptGhost(self: AutocompleteHost): void;
|
|
3
|
+
export declare function dismissPromptGhost(self: AutocompleteHost): boolean;
|
|
4
|
+
export declare function updateGhost(self: AutocompleteHost): void;
|
|
5
|
+
export declare function applyGhostAccept(self: AutocompleteHost): boolean;
|
|
@@ -10,6 +10,7 @@ export interface KeyDispatchHost {
|
|
|
10
10
|
applyEdit(next: InputCoreState): boolean;
|
|
11
11
|
updateAutocomplete(): void;
|
|
12
12
|
updateGhost(): void;
|
|
13
|
+
dismissPromptGhost(): boolean;
|
|
13
14
|
applyDropdownSelection(): boolean;
|
|
14
15
|
applyGhostAccept(): boolean;
|
|
15
16
|
readonly armed: boolean;
|