agent-afk 5.347.0 → 5.348.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.
@@ -1,5 +1,9 @@
1
1
  export type { EpisodeRecord } from './types.js';
2
2
  export { buildEpisodeFromFacet } from './facet-bridge.js';
3
3
  export { writeEpisode, formatEpisodeContent, sanitizeNarrative } from './writer.js';
4
+ export { ingestEpisodes } from './q-ingest.js';
5
+ export type { IngestResult, ParsedEpisodeContent } from './q-ingest.js';
6
+ export { QEpisodesStore, Q_EPISODES_SCHEMA_VERSION } from './q-store.js';
7
+ export type { QEpisodeRow, QEpisodeInput } from './q-store.js';
4
8
  import type { EpisodeRecord } from './types.js';
5
9
  export declare function synthesizeAndWriteEpisode(sessionId: string): Promise<EpisodeRecord | null>;
@@ -0,0 +1,16 @@
1
+ export interface IngestResult {
2
+ found: number;
3
+ upserted: number;
4
+ watermark: string | null;
5
+ totalStored: number;
6
+ }
7
+ export interface ParsedEpisodeContent {
8
+ sessionId: string;
9
+ goal: string;
10
+ narrative: string;
11
+ tags: string[];
12
+ files: string[];
13
+ synthesizedAt: string;
14
+ }
15
+ export declare function parseEpisodeContent(content: string, fallbackSessionId: string | null): ParsedEpisodeContent | null;
16
+ export declare function ingestEpisodes(memoryDir?: string, storeDir?: string): IngestResult;
@@ -0,0 +1,35 @@
1
+ export declare const Q_EPISODES_SCHEMA_VERSION = 1;
2
+ export interface QEpisodeRow {
3
+ session_id: string;
4
+ goal: string;
5
+ narrative: string;
6
+ tags_json: string;
7
+ files_json: string;
8
+ synthesized_at: string;
9
+ ingested_at: string;
10
+ }
11
+ export interface QEpisodeInput {
12
+ sessionId: string;
13
+ goal: string;
14
+ narrative: string;
15
+ tags: string[];
16
+ files: string[];
17
+ synthesizedAt: string;
18
+ }
19
+ export declare class QEpisodesStore {
20
+ private readonly dir;
21
+ private readonly db;
22
+ constructor(storeDir?: string);
23
+ getWatermark(): string | null;
24
+ setWatermark(ts: string): void;
25
+ upsertEpisode(input: QEpisodeInput): void;
26
+ getEpisode(sessionId: string): QEpisodeRow | null;
27
+ listEpisodes(opts?: {
28
+ domain?: string;
29
+ since?: string;
30
+ limit?: number;
31
+ }): QEpisodeRow[];
32
+ searchEpisodes(query: string, limit?: number): QEpisodeRow[];
33
+ count(): number;
34
+ close(): void;
35
+ }
@@ -1,6 +1,6 @@
1
1
  export { MemoryStore } from './memory-store.js';
2
2
  export { estimateTokens } from './estimate-tokens.js';
3
- export { loadHotMemory, injectHotMemory } from './memory-loader.js';
3
+ export { loadHotMemory, injectHotMemory, injectEpisodeRecall } from './memory-loader.js';
4
4
  export { injectGoalPrompt } from '../goals/inject.js';
5
5
  export { createMemorySessionEndHook, createChildMemoryHotBlockHook } from './memory-hooks.js';
6
6
  export { guardChildHotWrites, isForkedChildSession, CHILD_HOT_WRITE_DENIED, type ForkSignals } from './memory-hot-guard.js';
@@ -1,3 +1,13 @@
1
1
  import type { AgentConfig } from '../types/config-types.js';
2
+ import { MemoryStore } from './memory-store.js';
3
+ import type { Fact } from './types.js';
2
4
  export declare function loadHotMemory(): string | null;
3
5
  export declare function injectHotMemory(config: AgentConfig): AgentConfig;
6
+ export declare function getCurrentBranch(cwd?: string): string | null;
7
+ export declare function getRecentlyModifiedFiles(cwd?: string): string[];
8
+ export declare function parseEpisodeFiles(content: string): string[];
9
+ export declare function scoreEpisode(fact: Fact, fileBasenames: Set<string>, branch: string | null, highFreqFiles: Set<string>): number;
10
+ export declare function buildHighFreqFiles(episodes: Fact[]): Set<string>;
11
+ export declare function formatEpisodeForRecall(fact: Fact): string;
12
+ export declare function recallEpisodes(memoryDir?: string, cwd?: string, store?: MemoryStore): Fact[];
13
+ export declare function injectEpisodeRecall(config: AgentConfig, memoryDir?: string, cwd?: string, store?: MemoryStore): AgentConfig;
@@ -23,6 +23,7 @@ export declare class MemoryStore {
23
23
  getFact(factId: number): Fact | null;
24
24
  getUnaccessed(minAgeDays?: number): Fact[];
25
25
  getAccessStats(): AccessStats;
26
+ getEpisodes(limit?: number): Fact[];
26
27
  searchFacts(query: string, opts?: SearchOpts): Fact[];
27
28
  startSession(session: NewSession): void;
28
29
  endSession(sessionId: string, summary: string, outcome: SessionOutcome, tokenCount?: number, costUsd?: number): void;
@@ -10,7 +10,7 @@ export interface Fact {
10
10
  created_at: string;
11
11
  category: FactCategory;
12
12
  content: string;
13
- source_surface: string;
13
+ source_surface: SourceSurface | (string & {});
14
14
  superseded_by: number | null;
15
15
  confidence: number;
16
16
  access_count: number;
@@ -21,7 +21,7 @@ export interface NewFact {
21
21
  session_id?: string;
22
22
  category: FactCategory;
23
23
  content: string;
24
- source_surface: string;
24
+ source_surface: SourceSurface | (string & {});
25
25
  evidence?: string | null;
26
26
  }
27
27
  export interface SessionRecord {
@@ -48,10 +48,12 @@ export interface Procedure {
48
48
  source_session: string | null;
49
49
  access_count: number;
50
50
  }
51
+ export type SourceSurface = 'cli' | 'telegram' | 'daemon' | 'afk' | 'episode-synthesis' | 'whatif' | 'test';
51
52
  export interface SearchOpts {
52
53
  category?: FactCategory;
53
54
  since?: string;
54
55
  limit?: number;
56
+ source_surface?: SourceSurface;
55
57
  }
56
58
  export interface MemorySearchResult {
57
59
  type: 'fact' | 'procedure';
@@ -1 +1,6 @@
1
- export declare function abortableStream<T>(source: AsyncIterable<T>, signal: AbortSignal): AsyncGenerator<T>;
1
+ interface PauseSuspendable {
2
+ suspend(): void;
3
+ resumeTimer(): void;
4
+ }
5
+ export declare function abortableStream<T>(source: AsyncIterable<T>, signal: AbortSignal, stallHandle?: PauseSuspendable): AsyncGenerator<T>;
6
+ export {};
@@ -7,6 +7,8 @@ export interface StreamStallHandle {
7
7
  readonly signal: AbortSignal;
8
8
  timedOut(): boolean;
9
9
  progress(): void;
10
+ suspend(): void;
11
+ resumeTimer(): void;
10
12
  dispose(): void;
11
13
  }
12
14
  export declare function armStreamStallWatchdog(baseSignal: AbortSignal, timeoutMs: number, onFire?: (info: {
@@ -1,2 +1,4 @@
1
1
  import type { AgentModelInput } from '../types.js';
2
+ import { type ModelSlots } from './model-slots.js';
2
3
  export declare function getDefaultSubagentModel(parentModel?: AgentModelInput): AgentModelInput;
4
+ export declare function describeDefaultSubagentModelSource(defaultModel: AgentModelInput, bindings: ModelSlots): string;
@@ -6,9 +6,12 @@ export declare class PauseController {
6
6
  private _paused;
7
7
  private _pollInterval;
8
8
  private _watchPath;
9
+ private _pauseStartedAt;
10
+ private _lastPauseDurationMs;
9
11
  private constructor();
10
12
  dispose(): void;
11
13
  isPaused(): boolean;
14
+ consumeLastPauseDuration(): number | undefined;
12
15
  check(signal?: AbortSignal): Promise<void>;
13
16
  private _handlePause;
14
17
  private _handleResume;
@@ -38,4 +38,4 @@ export declare function registerOverlaySlots(overlayComposer: OverlayComposer, c
38
38
  export declare function formatInterruptAffordance(interrupting: boolean): string;
39
39
  export declare function subscribeToResize(overlayComposer: OverlayComposer, disposed: boolean): () => void;
40
40
  export declare function checkPauseAnnotations(ctx: LifecycleContext): boolean;
41
- export declare function checkThinkingAnnotation(ctx: LifecycleContext, _now: number): boolean;
41
+ export declare function checkThinkingAnnotation(ctx: LifecycleContext, now: number): boolean;
@@ -37,7 +37,7 @@ export interface BuildAgentSessionDeps {
37
37
  temperature?: number;
38
38
  explicitProvider?: string;
39
39
  }
40
- export declare function buildAgentSession(deps: BuildAgentSessionDeps): AgentSession;
40
+ export declare function buildAgentSession(deps: BuildAgentSessionDeps, sharedMemoryStore?: import('../../../agent/memory/memory-store.js').MemoryStore): AgentSession;
41
41
  export declare function buildSharedDeps(a: {
42
42
  sessionModel: string;
43
43
  resumeConfig: Partial<AgentConfig>;