@gencode/agents 0.0.12 → 0.0.14

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/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { S as AgentsConfig, _ as saveAgentsConfig, a as listAgents, b as AgentConfig, c as normalizeAgentId, d as resolveAgentDir, f as resolveAgentIdByBinding, g as resolveModelString, h as resolveModelFallbacks, i as getAgentConfig, l as removeAgent, m as resolveDefaultAgentId, n as addBinding, o as listBindings, p as resolveAgentsConfigPath, s as loadAgentsConfig, t as addAgent, u as removeBindings, v as updateAgentIdentity, x as AgentModelConfig, y as AgentBinding } from "./index-BdfpRxFA.js";
2
2
  import { AssistantMessage, Message } from "@mariozechner/pi-ai";
3
- import { AgentTool } from "@mariozechner/pi-agent-core";
4
- import { AgentProgressEvent, AgentProgressEvent as AgentProgressEvent$1, CallbackEventPayload, CallbackEventPayload as CallbackEventPayload$1, Channel, Channel as Channel$1, RunResultPayload, RunResultPayload as RunResultPayload$1 } from "@gencode/shared";
3
+ import { AgentMessage, AgentTool } from "@mariozechner/pi-agent-core";
4
+ import { AgentProgressEvent, AgentProgressEvent as AgentProgressEvent$1, CallbackEventPayload, CallbackEventPayload as CallbackEventPayload$1, Channel, Channel as Channel$1, CollapseSpan, ReadStateRecord, RunResultPayload, RunResultPayload as RunResultPayload$1, SessionContextSnapshot, SessionMemorySnapshot, SnipRecord, ToolResultReference } from "@gencode/shared";
5
5
 
6
6
  //#region src/loop-detection/tool-loop-detection.d.ts
7
7
  type ToolLoopDetectionConfig = {
@@ -212,6 +212,7 @@ type ToolResultEntry = {
212
212
  toolName: string; /** Text output of the tool */
213
213
  content: string;
214
214
  isError: boolean;
215
+ toolResultRef?: ToolResultReference;
215
216
  timestamp: string;
216
217
  };
217
218
  /**
@@ -546,6 +547,33 @@ type SessionSummary = {
546
547
  createdAt: string;
547
548
  updatedAt: string;
548
549
  };
550
+ type SessionInspection = {
551
+ id: string;
552
+ metadata: SessionMetadata | null;
553
+ transcriptPath: string;
554
+ contextSnapshotPath: string;
555
+ sessionMemoryPath: string;
556
+ collapseLogPath: string;
557
+ toolResultsDir: string;
558
+ transcriptEntryCount: number;
559
+ readStateCount: number;
560
+ toolResultRefCount: number;
561
+ transcriptEntries: TranscriptEntry[];
562
+ context: SessionContextSnapshot;
563
+ };
564
+ type SessionExport = {
565
+ id: string;
566
+ metadata: SessionMetadata | null;
567
+ transcript: TranscriptEntry[];
568
+ context: SessionContextSnapshot;
569
+ paths: {
570
+ transcriptPath: string;
571
+ contextSnapshotPath: string;
572
+ sessionMemoryPath: string;
573
+ collapseLogPath: string;
574
+ toolResultsDir: string;
575
+ };
576
+ };
549
577
  /** Resolves the sessions directory path within a data directory */
550
578
  declare function sessionsDir(dataDir: string): string;
551
579
  /** Resolves the directory for a specific session */
@@ -554,6 +582,12 @@ declare function sessionDir(dataDir: string, sessionId: string): string;
554
582
  declare function transcriptPath(dataDir: string, sessionId: string): string;
555
583
  /** Resolves the metadata file path for a session */
556
584
  declare function metadataPath(dataDir: string, sessionId: string): string;
585
+ /** Resolves the persisted context snapshot path for a session */
586
+ declare function contextSnapshotPath(dataDir: string, sessionId: string): string;
587
+ declare function sessionMemoryPath(dataDir: string, sessionId: string): string;
588
+ declare function collapseLogPath(dataDir: string, sessionId: string): string;
589
+ /** Resolves the persisted tool-results directory for a session */
590
+ declare function toolResultsDir(dataDir: string, sessionId: string): string;
557
591
  /** Creates a new session with a generated ID */
558
592
  declare function createSession(dataDir: string, channel: Channel): Promise<string>;
559
593
  /** Ensures a session directory exists (for resuming an existing session) */
@@ -574,6 +608,240 @@ declare function saveSessionMetadata(dataDir: string, metadata: SessionMetadata)
574
608
  declare function loadSessionMetadata(dataDir: string, sessionId: string): Promise<SessionMetadata | null>;
575
609
  /** Lists all sessions with their metadata summaries, optionally filtered by channel */
576
610
  declare function listSessionSummaries(dataDir: string, channel?: Channel): Promise<SessionSummary[]>;
611
+ declare function loadSessionContextSnapshot(dataDir: string, sessionId: string): Promise<SessionContextSnapshot>;
612
+ declare function inspectSession(dataDir: string, sessionId: string): Promise<SessionInspection>;
613
+ declare function exportSession(dataDir: string, sessionId: string): Promise<SessionExport>;
614
+ //#endregion
615
+ //#region src/plugins/hooks.d.ts
616
+ type PluginHookName = "before_model_resolve" | "before_prompt_build" | "after_prompt_build" | "llm_input" | "assistant_message_end" | "llm_output" | "before_tool_call" | "after_tool_call" | "agent_end" | "before_compaction" | "after_compaction" | "session_start" | "session_end" | "session_reset" | "memory_changed";
617
+ type PluginHookAgentContext = {
618
+ agentId?: string;
619
+ sessionId?: string;
620
+ workspaceDir?: string;
621
+ channel?: AgentRunParams["channel"];
622
+ };
623
+ type PluginHookBeforeModelResolveEvent = {
624
+ prompt: string;
625
+ };
626
+ type PluginHookBeforeModelResolveResult = {
627
+ modelOverride?: string;
628
+ };
629
+ type PluginHookBeforePromptBuildEvent = {
630
+ prompt: string;
631
+ };
632
+ type PluginHookBeforePromptBuildResult = {
633
+ systemPrompt?: string;
634
+ prependContext?: string;
635
+ };
636
+ type PluginHookAfterPromptBuildEvent = {
637
+ prompt: string;
638
+ systemPrompt: string;
639
+ };
640
+ type PluginHookLlmInputEvent = {
641
+ sessionId: string;
642
+ model: string;
643
+ prompt: string;
644
+ historyMessages: unknown[];
645
+ };
646
+ type PluginHookAssistantMessageEndEvent = {
647
+ sessionId: string;
648
+ model: string;
649
+ assistantText: string;
650
+ assistantMessage: AssistantMessage;
651
+ hasToolCalls: boolean;
652
+ durationMs?: number;
653
+ usage?: {
654
+ input?: number;
655
+ output?: number;
656
+ total?: number;
657
+ };
658
+ };
659
+ type PluginHookLlmOutputEvent = {
660
+ sessionId: string;
661
+ model: string;
662
+ assistantTexts: string[];
663
+ lastAssistant?: AssistantMessage;
664
+ usage?: {
665
+ input?: number;
666
+ output?: number;
667
+ total?: number;
668
+ };
669
+ };
670
+ type PluginHookBeforeToolCallEvent = {
671
+ toolCallId: string;
672
+ toolName: string;
673
+ params: Record<string, unknown>;
674
+ };
675
+ type PluginHookBeforeToolCallResult = {
676
+ params?: Record<string, unknown>;
677
+ block?: boolean;
678
+ blockReason?: string;
679
+ };
680
+ type PluginHookAfterToolCallEvent = {
681
+ toolCallId: string;
682
+ toolName: string;
683
+ params: Record<string, unknown>;
684
+ result?: unknown;
685
+ error?: string;
686
+ durationMs?: number;
687
+ };
688
+ type PluginHookAgentEndEvent = {
689
+ success: boolean;
690
+ error?: string;
691
+ durationMs?: number;
692
+ };
693
+ type PluginHookBeforeCompactionEvent = {
694
+ messageCount: number;
695
+ compactingCount?: number;
696
+ };
697
+ type PluginHookAfterCompactionEvent = {
698
+ messageCount: number;
699
+ compactedCount: number;
700
+ };
701
+ type PluginHookSessionStartEvent = {
702
+ sessionId: string;
703
+ };
704
+ type PluginHookSessionEndEvent = {
705
+ sessionId: string;
706
+ messageCount: number;
707
+ durationMs?: number;
708
+ };
709
+ type PluginHookSessionResetEvent = {
710
+ action: "new" | "reset";
711
+ sessionId: string;
712
+ previousSessionId?: string;
713
+ message: string;
714
+ };
715
+ type PluginHookMemoryChangedEvent = MemoryChangedEvent;
716
+ type PluginHookHandlerMap = {
717
+ before_model_resolve: (event: PluginHookBeforeModelResolveEvent, ctx: PluginHookAgentContext) => PluginHookBeforeModelResolveResult | void | Promise<PluginHookBeforeModelResolveResult | void>;
718
+ before_prompt_build: (event: PluginHookBeforePromptBuildEvent, ctx: PluginHookAgentContext) => PluginHookBeforePromptBuildResult | void | Promise<PluginHookBeforePromptBuildResult | void>;
719
+ after_prompt_build: (event: PluginHookAfterPromptBuildEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
720
+ llm_input: (event: PluginHookLlmInputEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
721
+ assistant_message_end: (event: PluginHookAssistantMessageEndEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
722
+ llm_output: (event: PluginHookLlmOutputEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
723
+ before_tool_call: (event: PluginHookBeforeToolCallEvent, ctx: PluginHookAgentContext) => PluginHookBeforeToolCallResult | void | Promise<PluginHookBeforeToolCallResult | void>;
724
+ after_tool_call: (event: PluginHookAfterToolCallEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
725
+ agent_end: (event: PluginHookAgentEndEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
726
+ before_compaction: (event: PluginHookBeforeCompactionEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
727
+ after_compaction: (event: PluginHookAfterCompactionEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
728
+ session_start: (event: PluginHookSessionStartEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
729
+ session_end: (event: PluginHookSessionEndEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
730
+ session_reset: (event: PluginHookSessionResetEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
731
+ memory_changed: (event: PluginHookMemoryChangedEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
732
+ };
733
+ type PluginHookRegistration<K extends PluginHookName = PluginHookName> = {
734
+ pluginId: string;
735
+ hookName: K;
736
+ handler: PluginHookHandlerMap[K];
737
+ priority?: number;
738
+ source: string;
739
+ };
740
+ declare class PluginHookRegistry {
741
+ private readonly hooks;
742
+ register<K extends PluginHookName>(registration: PluginHookRegistration<K>): void;
743
+ dispatch<K extends PluginHookName>(hookName: K, event: Parameters<PluginHookHandlerMap[K]>[0], ctx: Parameters<PluginHookHandlerMap[K]>[1]): Promise<Array<Awaited<ReturnType<PluginHookHandlerMap[K]>>>>;
744
+ }
745
+ //#endregion
746
+ //#region src/context/session-context-store.d.ts
747
+ type PersistedToolResult = {
748
+ content: string;
749
+ reference?: ToolResultReference;
750
+ };
751
+ type SessionContextStore = {
752
+ findReusableRead(path: string, offset?: number, limit?: number): Promise<ReadStateRecord | null>;
753
+ recordRead(params: {
754
+ path: string;
755
+ content: string;
756
+ lineCount: number;
757
+ offset?: number;
758
+ limit?: number;
759
+ }): Promise<ReadStateRecord>;
760
+ invalidatePath(path: string): Promise<void>;
761
+ persistToolResult(params: {
762
+ toolCallId: string;
763
+ toolName: string;
764
+ content: string;
765
+ thresholdChars?: number;
766
+ previewChars?: number;
767
+ }): Promise<PersistedToolResult>;
768
+ recordSnip(record: SnipRecord): Promise<void>;
769
+ recordCollapse(span: CollapseSpan): Promise<void>;
770
+ setSessionMemory(snapshot: SessionMemorySnapshot): Promise<void>;
771
+ recordAutocompactResult(params: {
772
+ layer: "L6";
773
+ failed: boolean;
774
+ timestamp: string;
775
+ }): Promise<void>;
776
+ getSnapshot(): SessionContextSnapshot;
777
+ };
778
+ type SessionContextStoreOptions = {
779
+ dataDir: string;
780
+ sessionId: string;
781
+ };
782
+ declare function createSessionContextStore(options: SessionContextStoreOptions): Promise<SessionContextStore>;
783
+ //#endregion
784
+ //#region src/context/context-manager.d.ts
785
+ type ManageLayeredHistoryParams = {
786
+ entries: TranscriptEntry[];
787
+ modelInfo: {
788
+ model: string;
789
+ api: string;
790
+ };
791
+ contextWindowTokens: number;
792
+ llm: {
793
+ baseUrl: string;
794
+ apiKey: string;
795
+ model: string;
796
+ };
797
+ historyLimit?: number;
798
+ compactionEnabled?: boolean;
799
+ signal?: AbortSignal;
800
+ hooks?: PluginHookRegistry;
801
+ hookCtx?: PluginHookAgentContext;
802
+ contextStore?: SessionContextStore;
803
+ dataDir?: string;
804
+ sessionId?: string;
805
+ };
806
+ type ManageLayeredHistoryResult = {
807
+ messages: AgentMessage[];
808
+ priorSummary: string | undefined;
809
+ compactionEntry: CompactionEntry | undefined;
810
+ stats: {
811
+ originalCount: number;
812
+ keptCount: number;
813
+ estimatedTokens: number;
814
+ compacted: boolean;
815
+ };
816
+ compactionEvents: AgentProgressEvent$1[];
817
+ };
818
+ type ContextManager = {
819
+ getReusableRead(path: string, offset?: number, limit?: number): Promise<{
820
+ reused: boolean;
821
+ lineCount?: number;
822
+ }>;
823
+ rememberRead(params: {
824
+ path: string;
825
+ content: string;
826
+ lineCount: number;
827
+ offset?: number;
828
+ limit?: number;
829
+ }): Promise<void>;
830
+ invalidateReadPath(path: string): Promise<void>;
831
+ persistToolResult(params: {
832
+ toolCallId: string;
833
+ toolName: string;
834
+ content: string;
835
+ thresholdChars?: number;
836
+ previewChars?: number;
837
+ }): Promise<PersistedToolResult>;
838
+ manageHistory(params: Omit<ManageLayeredHistoryParams, "contextStore">): Promise<ManageLayeredHistoryResult>;
839
+ getSnapshot: SessionContextStore["getSnapshot"];
840
+ };
841
+ declare function createContextManager(params: {
842
+ dataDir: string;
843
+ sessionId: string;
844
+ }): Promise<ContextManager>;
577
845
  //#endregion
578
846
  //#region src/bootstrap/bootstrap.d.ts
579
847
  /** Maximum characters per bootstrap file before truncation */
@@ -1065,6 +1333,8 @@ type ProcessSessionSnapshot = {
1065
1333
  exitCode?: number | null;
1066
1334
  exitSignal?: NodeJS.Signals | null;
1067
1335
  outputTail: string;
1336
+ stdoutTail: string;
1337
+ stderrTail: string;
1068
1338
  outputTruncated: boolean;
1069
1339
  };
1070
1340
  type ProcessLogSlice = {
@@ -1077,6 +1347,16 @@ type ProcessLogSlice = {
1077
1347
  exitCode?: number | null;
1078
1348
  exitSignal?: NodeJS.Signals | null;
1079
1349
  };
1350
+ type ProcessOutput = {
1351
+ sessionId: string;
1352
+ status: ProcessStatus;
1353
+ stdout: string;
1354
+ stderr: string;
1355
+ combined: string;
1356
+ truncated: boolean;
1357
+ exitCode?: number | null;
1358
+ exitSignal?: NodeJS.Signals | null;
1359
+ };
1080
1360
  type ProcessStartParams = {
1081
1361
  command: string;
1082
1362
  cwd: string;
@@ -1095,6 +1375,7 @@ type ProcessRegistry = {
1095
1375
  offset?: number;
1096
1376
  limit?: number;
1097
1377
  }): ProcessLogSlice | null;
1378
+ readOutput(sessionId: string, scopeKey?: string): ProcessOutput | null;
1098
1379
  terminate(sessionId: string, scopeKey?: string): Promise<ProcessSessionSnapshot | null>;
1099
1380
  };
1100
1381
  //#endregion
@@ -1111,6 +1392,7 @@ type ExecToolOptions = {
1111
1392
  workspaceDir: string;
1112
1393
  registry: ProcessRegistry;
1113
1394
  scopeKey?: string;
1395
+ contextManager?: ContextManager;
1114
1396
  };
1115
1397
  declare function createExecTool(options: ExecToolOptions): AgentTool<typeof execSchema, Record<string, unknown>>;
1116
1398
  //#endregion
@@ -1146,12 +1428,12 @@ type ReadFileResult = {
1146
1428
  lines: number;
1147
1429
  truncated: boolean;
1148
1430
  };
1149
- declare function createReadFileTool(workspaceDir: string): AgentTool<typeof readFileSchema, ReadFileResult>;
1431
+ declare function createReadFileTool(workspaceDir: string, contextManager?: ContextManager): AgentTool<typeof readFileSchema, ReadFileResult>;
1150
1432
  declare const writeFileSchema: TObject<{
1151
1433
  path: TString;
1152
1434
  content: TString;
1153
1435
  }>;
1154
- declare function createWriteFileTool(workspaceDir: string): AgentTool<typeof writeFileSchema, {
1436
+ declare function createWriteFileTool(workspaceDir: string, contextManager?: ContextManager): AgentTool<typeof writeFileSchema, {
1155
1437
  path: string;
1156
1438
  }>;
1157
1439
  declare const editFileSchema: TObject<{
@@ -1159,7 +1441,7 @@ declare const editFileSchema: TObject<{
1159
1441
  old_string: TString;
1160
1442
  new_string: TString;
1161
1443
  }>;
1162
- declare function createEditFileTool(workspaceDir: string): AgentTool<typeof editFileSchema, {
1444
+ declare function createEditFileTool(workspaceDir: string, contextManager?: ContextManager): AgentTool<typeof editFileSchema, {
1163
1445
  path: string;
1164
1446
  occurrences: number;
1165
1447
  }>;
@@ -1273,7 +1555,8 @@ type SubagentToolsContext = {
1273
1555
  llm: AgentRunParams["llm"];
1274
1556
  inheritedRunParams?: Pick<AgentRunParams, "plugins" | "memory" | "messaging" | "docs" | "historyLimit" | "onProgress" | "messageId">;
1275
1557
  loopDetection?: ToolLoopDetectionConfig;
1276
- memoryOptions?: MemoryToolOptions; /** Callback that runs a child agent; injected to avoid circular imports */
1558
+ memoryOptions?: MemoryToolOptions;
1559
+ contextManager?: ContextManager; /** Callback that runs a child agent; injected to avoid circular imports */
1277
1560
  spawnFn: (params: AgentRunParams) => Promise<AgentRunResult>;
1278
1561
  };
1279
1562
  /**
@@ -1328,137 +1611,6 @@ declare const PLUGIN_MANIFEST_FILENAMES: readonly ["aimax.plugin.json"];
1328
1611
  declare function resolvePluginManifestPath(rootDir: string): string;
1329
1612
  declare function loadPluginManifest(rootDir: string, rejectHardlinks?: boolean): PluginManifestLoadResult;
1330
1613
  //#endregion
1331
- //#region src/plugins/hooks.d.ts
1332
- type PluginHookName = "before_model_resolve" | "before_prompt_build" | "after_prompt_build" | "llm_input" | "assistant_message_end" | "llm_output" | "before_tool_call" | "after_tool_call" | "agent_end" | "before_compaction" | "after_compaction" | "session_start" | "session_end" | "session_reset" | "memory_changed";
1333
- type PluginHookAgentContext = {
1334
- agentId?: string;
1335
- sessionId?: string;
1336
- workspaceDir?: string;
1337
- channel?: AgentRunParams["channel"];
1338
- };
1339
- type PluginHookBeforeModelResolveEvent = {
1340
- prompt: string;
1341
- };
1342
- type PluginHookBeforeModelResolveResult = {
1343
- modelOverride?: string;
1344
- };
1345
- type PluginHookBeforePromptBuildEvent = {
1346
- prompt: string;
1347
- };
1348
- type PluginHookBeforePromptBuildResult = {
1349
- systemPrompt?: string;
1350
- prependContext?: string;
1351
- };
1352
- type PluginHookAfterPromptBuildEvent = {
1353
- prompt: string;
1354
- systemPrompt: string;
1355
- };
1356
- type PluginHookLlmInputEvent = {
1357
- sessionId: string;
1358
- model: string;
1359
- prompt: string;
1360
- historyMessages: unknown[];
1361
- };
1362
- type PluginHookAssistantMessageEndEvent = {
1363
- sessionId: string;
1364
- model: string;
1365
- assistantText: string;
1366
- assistantMessage: AssistantMessage;
1367
- hasToolCalls: boolean;
1368
- durationMs?: number;
1369
- usage?: {
1370
- input?: number;
1371
- output?: number;
1372
- total?: number;
1373
- };
1374
- };
1375
- type PluginHookLlmOutputEvent = {
1376
- sessionId: string;
1377
- model: string;
1378
- assistantTexts: string[];
1379
- lastAssistant?: AssistantMessage;
1380
- usage?: {
1381
- input?: number;
1382
- output?: number;
1383
- total?: number;
1384
- };
1385
- };
1386
- type PluginHookBeforeToolCallEvent = {
1387
- toolCallId: string;
1388
- toolName: string;
1389
- params: Record<string, unknown>;
1390
- };
1391
- type PluginHookBeforeToolCallResult = {
1392
- params?: Record<string, unknown>;
1393
- block?: boolean;
1394
- blockReason?: string;
1395
- };
1396
- type PluginHookAfterToolCallEvent = {
1397
- toolCallId: string;
1398
- toolName: string;
1399
- params: Record<string, unknown>;
1400
- result?: unknown;
1401
- error?: string;
1402
- durationMs?: number;
1403
- };
1404
- type PluginHookAgentEndEvent = {
1405
- success: boolean;
1406
- error?: string;
1407
- durationMs?: number;
1408
- };
1409
- type PluginHookBeforeCompactionEvent = {
1410
- messageCount: number;
1411
- compactingCount?: number;
1412
- };
1413
- type PluginHookAfterCompactionEvent = {
1414
- messageCount: number;
1415
- compactedCount: number;
1416
- };
1417
- type PluginHookSessionStartEvent = {
1418
- sessionId: string;
1419
- };
1420
- type PluginHookSessionEndEvent = {
1421
- sessionId: string;
1422
- messageCount: number;
1423
- durationMs?: number;
1424
- };
1425
- type PluginHookSessionResetEvent = {
1426
- action: "new" | "reset";
1427
- sessionId: string;
1428
- previousSessionId?: string;
1429
- message: string;
1430
- };
1431
- type PluginHookMemoryChangedEvent = MemoryChangedEvent;
1432
- type PluginHookHandlerMap = {
1433
- before_model_resolve: (event: PluginHookBeforeModelResolveEvent, ctx: PluginHookAgentContext) => PluginHookBeforeModelResolveResult | void | Promise<PluginHookBeforeModelResolveResult | void>;
1434
- before_prompt_build: (event: PluginHookBeforePromptBuildEvent, ctx: PluginHookAgentContext) => PluginHookBeforePromptBuildResult | void | Promise<PluginHookBeforePromptBuildResult | void>;
1435
- after_prompt_build: (event: PluginHookAfterPromptBuildEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
1436
- llm_input: (event: PluginHookLlmInputEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
1437
- assistant_message_end: (event: PluginHookAssistantMessageEndEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
1438
- llm_output: (event: PluginHookLlmOutputEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
1439
- before_tool_call: (event: PluginHookBeforeToolCallEvent, ctx: PluginHookAgentContext) => PluginHookBeforeToolCallResult | void | Promise<PluginHookBeforeToolCallResult | void>;
1440
- after_tool_call: (event: PluginHookAfterToolCallEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
1441
- agent_end: (event: PluginHookAgentEndEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
1442
- before_compaction: (event: PluginHookBeforeCompactionEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
1443
- after_compaction: (event: PluginHookAfterCompactionEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
1444
- session_start: (event: PluginHookSessionStartEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
1445
- session_end: (event: PluginHookSessionEndEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
1446
- session_reset: (event: PluginHookSessionResetEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
1447
- memory_changed: (event: PluginHookMemoryChangedEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
1448
- };
1449
- type PluginHookRegistration<K extends PluginHookName = PluginHookName> = {
1450
- pluginId: string;
1451
- hookName: K;
1452
- handler: PluginHookHandlerMap[K];
1453
- priority?: number;
1454
- source: string;
1455
- };
1456
- declare class PluginHookRegistry {
1457
- private readonly hooks;
1458
- register<K extends PluginHookName>(registration: PluginHookRegistration<K>): void;
1459
- dispatch<K extends PluginHookName>(hookName: K, event: Parameters<PluginHookHandlerMap[K]>[0], ctx: Parameters<PluginHookHandlerMap[K]>[1]): Promise<Array<Awaited<ReturnType<PluginHookHandlerMap[K]>>>>;
1460
- }
1461
- //#endregion
1462
1614
  //#region src/plugins/tools.d.ts
1463
1615
  type PluginToolOptions = {
1464
1616
  optional?: boolean;
@@ -1603,4 +1755,4 @@ declare function initializePluginSystem(options?: PluginSystemOptions): PluginSy
1603
1755
  //#region src/plugins/tool-hooks.d.ts
1604
1756
  declare function wrapToolsWithHooks(tools: AgentTool[], hooks: PluginHookRegistry, ctx: PluginHookAgentContext): AgentTool[];
1605
1757
  //#endregion
1606
- export { AgentBinding, AgentConfig, AgentModelConfig, type AgentProgressEvent, type AgentRunParams, type AgentRunResult, AgentsConfig, BOOTSTRAP_FILE_NAMES, BOOTSTRAP_MAX_CHARS, BOOTSTRAP_TOTAL_MAX_CHARS, type BootstrapContextFile, type BootstrapEnsureResult, type BootstrapFile, type BootstrapMountResult, type BootstrapMountStatus, type CallbackEventPayload, type CallbackPayload, type Channel, type EmbeddingProvider, type EmbeddingProviderContext, type EmbeddingProviderFactory, type EmbeddingProviderRegistration, MAX_CHILDREN_PER_SESSION, MAX_SUBAGENT_DEPTH, type MemoryCallOptions, type MemoryChangeSource, type MemoryChangedEvent, type MemoryChangedHandler, MemoryIndexManager, type MemoryProvider, type MemoryProviderContext, type MemoryProviderFactory, type MemoryProviderRegistration, type MemoryProviderStatus, type MemorySearchOptions, type MemorySearchResult, type NormalizedPluginsConfig, PLUGIN_MANIFEST_FILENAME, PLUGIN_MANIFEST_FILENAMES, type PersistedSubagentRunRecord, type PluginApi, type PluginCandidate, type PluginConfigUiHint, type PluginDiagnostic, type PluginDiscoveryOptions, type PluginDiscoveryResult, type PluginEntryConfig, type PluginHookAfterCompactionEvent, type PluginHookAfterPromptBuildEvent, type PluginHookAfterToolCallEvent, type PluginHookAgentContext, type PluginHookAgentEndEvent, type PluginHookAssistantMessageEndEvent, type PluginHookBeforeCompactionEvent, type PluginHookBeforeModelResolveEvent, type PluginHookBeforeModelResolveResult, type PluginHookBeforePromptBuildEvent, type PluginHookBeforePromptBuildResult, type PluginHookBeforeToolCallEvent, type PluginHookBeforeToolCallResult, type PluginHookHandlerMap, type PluginHookLlmInputEvent, type PluginHookLlmOutputEvent, type PluginHookMemoryChangedEvent, type PluginHookName, PluginHookRegistry, type PluginHookSessionEndEvent, type PluginHookSessionResetEvent, type PluginHookSessionStartEvent, type PluginKind, type PluginManifest, type PluginManifestLoadResult, type PluginManifestRegistry, type PluginOrigin, type PluginRecord, type PluginRegistry, type PluginRuntime, type PluginRuntimeContext, type PluginSystem, type PluginSystemOptions, type PluginToolOptions, PluginToolRegistry, type PluginsConfig, type PluginsConfigValidationResult, type RegisteredPluginTool, type RunResultPayload, type SessionMetadata, type SessionSummary, type Skill, type SlashCommandList, type SubagentContext, SubagentRegistry, type SubagentRunRecord, type SubagentStatus, type SubagentToolsContext, type SystemPromptParams, type ToolLoopDetectionConfig, type TranscriptEntry, addAgent, addBinding, aimaxDir, appendToMemory, appendTranscriptEntry, bootstrapMountLayout, buildBootstrapContextFiles, buildSkillsPrompt, buildSubagentAnnounceMessage, buildSystemPrompt, cleanupOldSubagentRecords, createAgentTools, createApplyPatchTool, createBashTool, createBuiltinMemoryProvider, createEditFileTool, createExecTool, createImageTool, createListDirTool, createMemoryAppendTool, createMemoryGetTool, createMemorySearchTool, createPluginRuntime, createProcessTool, createReadFileTool, createSession, createSessionsSpawnTool, createSubagentsTool, createWriteFileTool, deleteMemoryFile, discoverAIMaxPlugins, ensureBootstrapMountLayout, ensureSession, generateSessionTitle, getAgentConfig, getMemoryLines, hasBootstrapSentinel, initializePluginSystem, inspectBootstrapMountLayout, isBootstrapMountLayoutReady, listAgents, listAvailableSlashCommands, listBindings, listMemoryFiles, listSessionSummaries, listSessions, listSubagentRunsFromDisk, loadAgentsConfig, loadBootstrapFiles, loadPluginManifest, loadPluginManifestRegistry, loadPlugins, loadSessionMetadata, loadSkills, loadSkillsFromDirs, loadSkillsWithPluginDirs, loadSubagentRegistryFromDisk, loadTranscript, memoryDir, metadataPath, normalizeAgentId, normalizePluginsConfig, primaryMemoryPath, readMemoryFile, readPrimaryMemory, registerEmbeddingProvider, registerMemoryProvider, removeAgent, removeBindings, replaceMemoryFile, resetEmbeddingProviderRegistryForTests, resetMemoryProviderRegistryForTests, resolveAgentDir, resolveAgentIdByBinding, resolveAgentsConfigPath, resolveDefaultAgentId, resolveEmbeddingProvider, resolveMemoryProvider, resolveModelFallbacks, resolveModelString, resolvePluginManifestPath, runAgent, saveAgentsConfig, saveSessionMetadata, saveSubagentRegistryToDisk, searchMemory, sessionDir, sessionsDir, skillsDir, transcriptPath, updateAgentIdentity, validatePluginsConfig, wrapToolsWithHooks };
1758
+ export { AgentBinding, AgentConfig, AgentModelConfig, type AgentProgressEvent, type AgentRunParams, type AgentRunResult, AgentsConfig, BOOTSTRAP_FILE_NAMES, BOOTSTRAP_MAX_CHARS, BOOTSTRAP_TOTAL_MAX_CHARS, type BootstrapContextFile, type BootstrapEnsureResult, type BootstrapFile, type BootstrapMountResult, type BootstrapMountStatus, type CallbackEventPayload, type CallbackPayload, type Channel, type ContextManager, type EmbeddingProvider, type EmbeddingProviderContext, type EmbeddingProviderFactory, type EmbeddingProviderRegistration, MAX_CHILDREN_PER_SESSION, MAX_SUBAGENT_DEPTH, type MemoryCallOptions, type MemoryChangeSource, type MemoryChangedEvent, type MemoryChangedHandler, MemoryIndexManager, type MemoryProvider, type MemoryProviderContext, type MemoryProviderFactory, type MemoryProviderRegistration, type MemoryProviderStatus, type MemorySearchOptions, type MemorySearchResult, type NormalizedPluginsConfig, PLUGIN_MANIFEST_FILENAME, PLUGIN_MANIFEST_FILENAMES, type PersistedSubagentRunRecord, type PersistedToolResult, type PluginApi, type PluginCandidate, type PluginConfigUiHint, type PluginDiagnostic, type PluginDiscoveryOptions, type PluginDiscoveryResult, type PluginEntryConfig, type PluginHookAfterCompactionEvent, type PluginHookAfterPromptBuildEvent, type PluginHookAfterToolCallEvent, type PluginHookAgentContext, type PluginHookAgentEndEvent, type PluginHookAssistantMessageEndEvent, type PluginHookBeforeCompactionEvent, type PluginHookBeforeModelResolveEvent, type PluginHookBeforeModelResolveResult, type PluginHookBeforePromptBuildEvent, type PluginHookBeforePromptBuildResult, type PluginHookBeforeToolCallEvent, type PluginHookBeforeToolCallResult, type PluginHookHandlerMap, type PluginHookLlmInputEvent, type PluginHookLlmOutputEvent, type PluginHookMemoryChangedEvent, type PluginHookName, PluginHookRegistry, type PluginHookSessionEndEvent, type PluginHookSessionResetEvent, type PluginHookSessionStartEvent, type PluginKind, type PluginManifest, type PluginManifestLoadResult, type PluginManifestRegistry, type PluginOrigin, type PluginRecord, type PluginRegistry, type PluginRuntime, type PluginRuntimeContext, type PluginSystem, type PluginSystemOptions, type PluginToolOptions, PluginToolRegistry, type PluginsConfig, type PluginsConfigValidationResult, type RegisteredPluginTool, type RunResultPayload, type SessionContextStore, type SessionExport, type SessionInspection, type SessionMetadata, type SessionSummary, type Skill, type SlashCommandList, type SubagentContext, SubagentRegistry, type SubagentRunRecord, type SubagentStatus, type SubagentToolsContext, type SystemPromptParams, type ToolLoopDetectionConfig, type TranscriptEntry, addAgent, addBinding, aimaxDir, appendToMemory, appendTranscriptEntry, bootstrapMountLayout, buildBootstrapContextFiles, buildSkillsPrompt, buildSubagentAnnounceMessage, buildSystemPrompt, cleanupOldSubagentRecords, collapseLogPath, contextSnapshotPath, createAgentTools, createApplyPatchTool, createBashTool, createBuiltinMemoryProvider, createContextManager, createEditFileTool, createExecTool, createImageTool, createListDirTool, createMemoryAppendTool, createMemoryGetTool, createMemorySearchTool, createPluginRuntime, createProcessTool, createReadFileTool, createSession, createSessionContextStore, createSessionsSpawnTool, createSubagentsTool, createWriteFileTool, deleteMemoryFile, discoverAIMaxPlugins, ensureBootstrapMountLayout, ensureSession, exportSession, generateSessionTitle, getAgentConfig, getMemoryLines, hasBootstrapSentinel, initializePluginSystem, inspectBootstrapMountLayout, inspectSession, isBootstrapMountLayoutReady, listAgents, listAvailableSlashCommands, listBindings, listMemoryFiles, listSessionSummaries, listSessions, listSubagentRunsFromDisk, loadAgentsConfig, loadBootstrapFiles, loadPluginManifest, loadPluginManifestRegistry, loadPlugins, loadSessionContextSnapshot, loadSessionMetadata, loadSkills, loadSkillsFromDirs, loadSkillsWithPluginDirs, loadSubagentRegistryFromDisk, loadTranscript, memoryDir, metadataPath, normalizeAgentId, normalizePluginsConfig, primaryMemoryPath, readMemoryFile, readPrimaryMemory, registerEmbeddingProvider, registerMemoryProvider, removeAgent, removeBindings, replaceMemoryFile, resetEmbeddingProviderRegistryForTests, resetMemoryProviderRegistryForTests, resolveAgentDir, resolveAgentIdByBinding, resolveAgentsConfigPath, resolveDefaultAgentId, resolveEmbeddingProvider, resolveMemoryProvider, resolveModelFallbacks, resolveModelString, resolvePluginManifestPath, runAgent, saveAgentsConfig, saveSessionMetadata, saveSubagentRegistryToDisk, searchMemory, sessionDir, sessionMemoryPath, sessionsDir, skillsDir, toolResultsDir, transcriptPath, updateAgentIdentity, validatePluginsConfig, wrapToolsWithHooks };