agent-afk 5.267.0 → 5.268.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,6 @@
1
1
  export * from './types.js';
2
2
  export { JournalSync, type SyncOptions } from './sync.js';
3
+ export { JournalProvenance } from './provenance.js';
3
4
  export { createMessageJournal, isMessageJournalDisabled, type CreateMessageJournalOptions } from './writer.js';
4
5
  export { findToolResult, foldJournal, hydrateMessages, journalExists, listSubagentJournals, loadJournalFold, loadJournalMessages, readJournalRecords, type FoldResult, type JournalLocator, } from './reader.js';
5
6
  export { forkJournal } from './fork.js';
@@ -0,0 +1,6 @@
1
+ import type { JournalAdoption, JournalMessage } from './types.js';
2
+ export declare class JournalProvenance<T extends object> {
3
+ private readonly origins;
4
+ record(sources: readonly JournalMessage[], members: readonly T[]): void;
5
+ adopt(messages: readonly T[], at: number): JournalAdoption | undefined;
6
+ }
@@ -7,6 +7,7 @@ export declare class JournalSync<T> {
7
7
  private readonly adapter;
8
8
  private committed;
9
9
  private lenAfter;
10
+ private starts;
10
11
  private seeded;
11
12
  constructor(journal: MessageJournal | undefined, adapter: JournalAdapter<T>);
12
13
  get enabled(): boolean;
@@ -42,9 +42,11 @@ export type JournalBlock = {
42
42
  type: 'thinking';
43
43
  thinking: string;
44
44
  signature?: string;
45
+ origin?: string;
45
46
  } | {
46
47
  type: 'redacted_thinking';
47
48
  data: string;
49
+ origin?: string;
48
50
  } | {
49
51
  type: 'tool_use';
50
52
  id: string;
@@ -67,6 +69,10 @@ export interface JournalMessage {
67
69
  role: 'user' | 'assistant';
68
70
  content: JournalBlock[];
69
71
  }
72
+ export interface JournalAdoption {
73
+ readonly entries: readonly JournalMessage[];
74
+ readonly count: number;
75
+ }
70
76
  export type JournalTruncateReason = 'resync' | 'compact' | 'rewind' | 'clear' | 'repair' | 'provider_switch';
71
77
  export type JournalMarkLabel = 'compact' | 'rewind' | 'clear' | 'resume' | 'fork' | 'model_switch';
72
78
  interface RecordBase {
@@ -117,5 +123,6 @@ export interface MessageJournal {
117
123
  export interface JournalAdapter<T> {
118
124
  toJournal(message: T): JournalMessage | null;
119
125
  fromJournalMessages(messages: readonly JournalMessage[]): T[];
126
+ adopt?(messages: readonly T[], at: number): JournalAdoption | undefined;
120
127
  }
121
128
  export {};
@@ -1,3 +1,4 @@
1
1
  import type { MessageParam } from '@anthropic-ai/sdk/resources';
2
2
  import type { JournalAdapter } from '../../journal/index.js';
3
+ export declare const ANTHROPIC_ORIGIN = "anthropic";
3
4
  export declare const anthropicJournalAdapter: JournalAdapter<MessageParam>;
@@ -0,0 +1,4 @@
1
+ import type { MessageParam } from '@anthropic-ai/sdk/resources';
2
+ export declare function isInvalidSignatureError(err: unknown): boolean;
3
+ export declare function stripEarlierThinking(messages: MessageParam[], lastRealUserIdx: number): MessageParam[];
4
+ export declare function buildSignatureRetryMessages(messages: MessageParam[]): MessageParam[] | null;
@@ -1,4 +1,5 @@
1
1
  import type { JournalAdapter } from '../../journal/index.js';
2
2
  import type { OpenAIMessage } from './messages.js';
3
+ export declare const OPENAI_COMPATIBLE_ORIGIN = "openai-compatible";
3
4
  export declare const INTERRUPTED_TOOL_RESULT: string;
4
5
  export declare const openAIJournalAdapter: JournalAdapter<OpenAIMessage>;