agent-afk 5.326.2 → 5.326.3

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.
@@ -83,7 +83,14 @@ export interface JournalAdoption {
83
83
  readonly count: number;
84
84
  }
85
85
  export type JournalTruncateReason = 'resync' | 'compact' | 'rewind' | 'clear' | 'repair' | 'provider_switch';
86
- export type JournalMarkLabel = 'compact' | 'rewind' | 'clear' | 'resume' | 'fork' | 'model_switch';
86
+ export type JournalMarkLabel = 'compact' | 'rewind' | 'clear' | 'resume' | 'fork' | 'model_switch' | 'suggestion';
87
+ export type JournalSuggestionDetail = {
88
+ event: 'generated' | 'accepted' | 'word_accepted' | 'dismissed';
89
+ source: 'completion' | 'prompt';
90
+ text: string;
91
+ buffer?: string;
92
+ model?: string;
93
+ };
87
94
  interface RecordBase {
88
95
  v: typeof JOURNAL_VERSION;
89
96
  ts: number;
@@ -1,2 +1,10 @@
1
1
  export declare function isTooBroadRoot(candidate: string): boolean;
2
2
  export declare function ungatedSensitiveRoot(candidate: string): string | undefined;
3
+ export type RootField = 'cwd' | 'readRoots' | 'writeRoots';
4
+ export type RootValidationCaller = {
5
+ kind: 'agent';
6
+ } | {
7
+ kind: 'compose';
8
+ nodeId: string;
9
+ };
10
+ export declare function validateRootPath(value: unknown, field: RootField, caller: RootValidationCaller): string;
@@ -18,17 +18,22 @@ export interface IsolationWorktreeResult {
18
18
  setupNotice?: string;
19
19
  }
20
20
  export interface SetupIsolationWorktreeArgs {
21
- parsed: AgentInput;
21
+ parsed: Pick<AgentInput, 'prompt' | 'mode' | 'agent_type' | 'id_prefix'>;
22
22
  currentCwd: string | undefined;
23
23
  isolationCounterRef: {
24
24
  value: number;
25
25
  };
26
- childConfig: AgentConfig;
26
+ childConfig: Pick<AgentConfig, 'cwd'>;
27
+ dagNodeId?: string;
27
28
  childWriteCapable: boolean;
28
29
  probe: StreamCutProbe | undefined;
29
30
  budgetReceipt: SpawnReceipt | undefined;
30
31
  signal?: AbortSignal;
31
32
  }
33
+ export declare function setupIsolationWorktree(args: SetupIsolationWorktreeArgs & {
34
+ dagNodeId: string;
35
+ childWriteCapable: true;
36
+ }): Promise<IsolationWorktreeResult>;
32
37
  export declare function setupIsolationWorktree(args: SetupIsolationWorktreeArgs): Promise<IsolationWorktreeResult | {
33
38
  skipped: true;
34
39
  } | {
@@ -0,0 +1,3 @@
1
+ import type { SessionRef } from '../../../agent/session-ref.js';
2
+ import type { SuggestionRecorder } from '../../input/suggest.js';
3
+ export declare function buildSuggestionJournalRecorder(session: SessionRef): SuggestionRecorder;
@@ -1,10 +1,11 @@
1
- import type { CompleteFn, SuggestContext } from './suggest-types.js';
1
+ import type { CompleteFn, SuggestContext, SuggestionRecorder } from './suggest-types.js';
2
2
  export interface PromptSuggestionStateDeps {
3
3
  pickModel(ctx: SuggestContext): string;
4
4
  resolveComplete(model: string, ctx: SuggestContext): CompleteFn | null;
5
5
  timeoutMs: number;
6
6
  scrub(s: string): string;
7
7
  onError?: (err: unknown) => void;
8
+ onRecord?: SuggestionRecorder;
8
9
  }
9
10
  export interface PromptSuggestionState {
10
11
  prime(ctx: SuggestContext): Promise<void>;
@@ -1,4 +1,4 @@
1
- import type { CompleteFn } from './suggest-types.js';
1
+ import type { CompleteFn, SuggestionRecorder } from './suggest-types.js';
2
2
  import type { SuggestContext } from './suggest.js';
3
3
  export declare const MIN_LLM_CHARS = 3;
4
4
  export declare const DEBOUNCE_MS = 250;
@@ -11,6 +11,7 @@ export interface Tier2Deps {
11
11
  debounceMs: number;
12
12
  timeoutMs: number;
13
13
  onError?: (err: unknown) => void;
14
+ onRecord?: SuggestionRecorder;
14
15
  }
15
16
  export interface Tier2Runner {
16
17
  request(buffer: string, ctx: SuggestContext): Promise<string | null>;
@@ -1,3 +1,4 @@
1
+ import type { JournalSuggestionDetail } from '../../agent/journal/types.js';
1
2
  import type { ModelProvider } from '../../agent/provider.js';
2
3
  import type { ProviderRouteHints } from '../../agent/providers/index.js';
3
4
  export interface SuggestContext {
@@ -32,12 +33,16 @@ export interface SuggestEngineOptions {
32
33
  debounceMs?: number;
33
34
  timeoutMs?: number;
34
35
  onError?: (err: unknown) => void;
36
+ onRecord?: SuggestionRecorder;
35
37
  }
38
+ export type SuggestionRecord = JournalSuggestionDetail;
39
+ export type SuggestionRecorder = (record: SuggestionRecord) => void;
36
40
  export interface SuggestEngine {
37
41
  getDeterministicGhost(buffer: string, ctx: SuggestContext): string | null;
38
42
  getGhost(buffer: string, ctx: SuggestContext): Promise<string | null>;
39
43
  primePromptSuggestion(ctx: SuggestContext): Promise<void>;
40
44
  peekPromptSuggestion(): string | null;
41
45
  clearPromptSuggestion(): void;
46
+ recordOutcome?(record: SuggestionRecord): void;
42
47
  dispose(): void;
43
48
  }
@@ -1,5 +1,5 @@
1
1
  import type { SuggestEngine, SuggestEngineOptions } from './suggest-types.js';
2
- export type { CompleteFn, CompleteRequest, SuggestContext, SuggestEngine, SuggestEngineOptions, } from './suggest-types.js';
2
+ export type { CompleteFn, CompleteRequest, SuggestContext, SuggestEngine, SuggestEngineOptions, SuggestionRecord, SuggestionRecorder, } from './suggest-types.js';
3
3
  export { stripGhostControlChars } from './suggest-sanitize.js';
4
4
  export { pickModel } from './suggest-provider.js';
5
5
  export { getDeterministicGhost } from './suggest-tier1.js';
@@ -0,0 +1,5 @@
1
+ import type { AutocompleteHost } from './terminal-compositor.autocomplete.js';
2
+ export type GhostSource = 'completion' | 'prompt' | null;
3
+ export declare function noteGhostSource(self: AutocompleteHost, ghost: string, source: GhostSource): void;
4
+ export declare function recordGhostAccept(self: AutocompleteHost, ghost: string, full: boolean): void;
5
+ export declare function recordPromptDismiss(self: AutocompleteHost, text: string): void;