agent-afk 5.93.3 → 5.95.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.
@@ -158,6 +158,7 @@ export interface ProviderQuery extends AsyncIterable<ProviderEvent> {
158
158
  listRewindTargets?(): RewindTarget[];
159
159
  rewindConversation?(turnIndex: number): Promise<ProviderRewindConversationResult>;
160
160
  setCwd?(cwd: string): void;
161
+ setSystemPrompt?(basePrompt: string | undefined): boolean;
161
162
  reauth?(): Promise<{
162
163
  accountId: string;
163
164
  swapped: boolean;
@@ -0,0 +1,13 @@
1
+ import type { AgentConfig } from '../../../types/config-types.js';
2
+ import type { RuntimeStateSource } from '../../../awareness/index.js';
3
+ import { type StableSystemParts } from './system-prompt.js';
4
+ export type SystemPromptRebuildFactory = (basePrompt: string | undefined) => string;
5
+ export interface SystemPromptRebuildFactoryArgs {
6
+ stableSystemPrefix: StableSystemParts;
7
+ config: AgentConfig;
8
+ surface: string;
9
+ runtimeStateSource: RuntimeStateSource;
10
+ getCurrentCwd: () => string | undefined;
11
+ fallbackCwd: string;
12
+ }
13
+ export declare function createSystemPromptRebuildFactory(args: SystemPromptRebuildFactoryArgs): SystemPromptRebuildFactory;
@@ -31,6 +31,7 @@ export interface AnthropicDirectQueryOptions {
31
31
  userSystem: string;
32
32
  dispatcher: ToolDispatcher;
33
33
  };
34
+ systemPromptRebuildFactory?: (basePrompt: string | undefined) => string;
34
35
  onPermissionMode?: (mode: string) => void;
35
36
  mcpManager?: import('../../mcp/index.js').McpManager;
36
37
  autoCompactThreshold?: number;
@@ -53,6 +54,7 @@ export declare class AnthropicDirectQuery implements ProviderQuery {
53
54
  private readonly abort;
54
55
  private readonly retry;
55
56
  private readonly cwdDependentsFactory?;
57
+ private readonly systemPromptRebuildFactory?;
56
58
  private readonly onPermissionMode?;
57
59
  private readonly mcpManager?;
58
60
  private readonly hookRegistry?;
@@ -65,6 +67,7 @@ export declare class AnthropicDirectQuery implements ProviderQuery {
65
67
  setModel(model?: string): Promise<void>;
66
68
  setPermissionMode(mode: string): Promise<void>;
67
69
  setCwd(cwd: string): void;
70
+ setSystemPrompt(basePrompt: string | undefined): boolean;
68
71
  supportedCommands(): Promise<ProviderCommandInfo[]>;
69
72
  supportedModels(): Promise<ProviderModelInfo[]>;
70
73
  supportedAgents(): Promise<ProviderAgentInfo[]>;
@@ -16,6 +16,8 @@ export declare class ProviderRouter implements ProviderQuery {
16
16
  private currentModel;
17
17
  private currentPermissionMode;
18
18
  private currentCwd;
19
+ private currentSystemPrompt;
20
+ private systemPromptOverridden;
19
21
  private readonly startupFamily;
20
22
  private active;
21
23
  private activeModel;
@@ -36,6 +38,7 @@ export declare class ProviderRouter implements ProviderQuery {
36
38
  setModel(model?: string): Promise<void>;
37
39
  setPermissionMode(mode: string): Promise<void>;
38
40
  setCwd(cwd: string): void;
41
+ setSystemPrompt(basePrompt: string | undefined): boolean;
39
42
  reauth(): Promise<{
40
43
  accountId: string;
41
44
  swapped: boolean;
@@ -61,6 +61,7 @@ export declare class AgentSession implements IAgentSession {
61
61
  message: string;
62
62
  mode: PermissionMode;
63
63
  } | undefined>;
64
+ setSystemPrompt(basePrompt: string | undefined): boolean;
64
65
  setCwd(cwd: string): void;
65
66
  reauth(): Promise<{
66
67
  accountId: string;
@@ -3,4 +3,4 @@ export interface AfkMdResult {
3
3
  paths: string[];
4
4
  }
5
5
  export declare function resetAfkMdCache(): void;
6
- export declare function loadAfkMd(): AfkMdResult | null;
6
+ export declare function loadAfkMd(cwd?: string): AfkMdResult | null;
@@ -12,5 +12,5 @@ export declare function _resetConfigCache(): void;
12
12
  export declare function loadTelegramConfig(): NonNullable<CliConfig['telegram']>;
13
13
  export declare function resolveCliPermissionMode(): PermissionMode;
14
14
  export declare function resolveAutoResumeOnUsageLimit(): boolean;
15
- export declare function loadConfig(overrides?: Partial<CliConfig>): CliConfig;
15
+ export declare function loadConfig(overrides?: Partial<CliConfig>, cwd?: string): CliConfig;
16
16
  export declare function resolvedProviderName(config: CliConfig): BundledProviderName;
@@ -0,0 +1,4 @@
1
+ export declare const DEFAULT_TEXT_MEASURE = 100;
2
+ export declare const MIN_TEXT_MEASURE = 20;
3
+ export declare function resolveTextMeasure(): number | null;
4
+ export declare function capToMeasure(width: number): number;
@@ -5,7 +5,7 @@ export declare function loadSystemPrompt(): string | undefined;
5
5
  export declare function loadConfigSystemPrompt(): string | undefined;
6
6
  export declare const OPERATOR_CONFIG_HEADER: string;
7
7
  export declare function composeSystemPrompt(framework: string | undefined, overlay: string | undefined): string | undefined;
8
- export declare function resolveBaseSystemPrompt(): {
8
+ export declare function resolveBaseSystemPrompt(cwd?: string): {
9
9
  prompt: string | undefined;
10
10
  source: string;
11
11
  };
@@ -0,0 +1,4 @@
1
+ import type { SlashContext } from '../../types.js';
2
+ import { type AfkMdTarget } from './targets.js';
3
+ export declare function editTarget(ctx: SlashContext, target: AfkMdTarget): Promise<void>;
4
+ export declare function appendToTarget(ctx: SlashContext, target: AfkMdTarget, text: string): void;
@@ -0,0 +1,11 @@
1
+ import type { SlashContext } from '../../types.js';
2
+ export interface ReloadOutcome {
3
+ applied: boolean;
4
+ tokens: number;
5
+ delta: number;
6
+ source: string;
7
+ shadowed: boolean;
8
+ }
9
+ export declare function currentOverlayTokens(cwd?: string): number;
10
+ export declare function applyReload(ctx: SlashContext, baselineTokens: number): ReloadOutcome;
11
+ export declare function formatDelta(delta: number): string;
@@ -0,0 +1,17 @@
1
+ export type AfkMdScope = 'user' | 'project';
2
+ export interface AfkMdTarget {
3
+ scope: AfkMdScope;
4
+ label: string;
5
+ path: string;
6
+ exists: boolean;
7
+ bytes: number;
8
+ tokens: number;
9
+ blank: boolean;
10
+ duplicate: boolean;
11
+ }
12
+ export declare const OVERLAY_TOKEN_WARN_THRESHOLD = 10000;
13
+ export declare function resolveTargets(cwd?: string): AfkMdTarget[];
14
+ export declare function targetFor(scope: AfkMdScope, cwd?: string): AfkMdTarget;
15
+ export declare function contributes(t: AfkMdTarget): boolean;
16
+ export declare function formatTokens(tokens: number): string;
17
+ export declare function renderTargetRows(targets: AfkMdTarget[]): string[];
@@ -0,0 +1,2 @@
1
+ import type { SlashCommand } from '../types.js';
2
+ export declare const afkMdCmd: SlashCommand;
@@ -1,12 +1,10 @@
1
1
  import type { TerminalCompositor } from '../../terminal-compositor.js';
2
- export type EditorNotifyKind = 'info' | 'warn' | 'error';
2
+ import { resolveEditor, type EditorNotifyKind } from './editor-spawn.js';
3
+ export { resolveEditor };
4
+ export type { EditorNotifyKind };
3
5
  export interface EditorHandoffDeps {
4
6
  compositor: TerminalCompositor | null;
5
7
  notify: (kind: EditorNotifyKind, message: string) => void;
6
8
  }
7
9
  export type EditorHandoffResult = 'no-tty' | 'no-editor' | 'loaded' | 'kept' | 'spawn-failed';
8
- export declare function resolveEditor(): {
9
- cmd: string;
10
- args: string[];
11
- } | null;
12
10
  export declare function openEditorForBuffer(deps: EditorHandoffDeps): Promise<EditorHandoffResult>;
@@ -0,0 +1,17 @@
1
+ import type { TerminalCompositor } from '../../terminal-compositor.js';
2
+ export type EditorNotifyKind = 'info' | 'warn' | 'error';
3
+ export type EditorSpawnOutcome = 'no-tty' | 'no-editor' | 'clean' | 'nonzero' | 'spawn-failed';
4
+ export interface EditorSpawnResult {
5
+ outcome: EditorSpawnOutcome;
6
+ exitCode: number | null;
7
+ }
8
+ export interface EditorSpawnDeps {
9
+ compositor: TerminalCompositor | null;
10
+ filePath: string;
11
+ notify: (kind: EditorNotifyKind, message: string) => void;
12
+ }
13
+ export declare function resolveEditor(): {
14
+ cmd: string;
15
+ args: string[];
16
+ } | null;
17
+ export declare function spawnEditorOnPath(deps: EditorSpawnDeps): Promise<EditorSpawnResult>;