@gencode/agents 0.9.3-preview.7 → 0.10.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.
- package/CHANGELOG.md +16 -0
- package/dist/index.d.ts +699 -699
- package/dist/index.js +63 -63
- package/package.json +10 -10
package/dist/index.d.ts
CHANGED
|
@@ -18,119 +18,6 @@ type ToolLoopDetectionConfig = {
|
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
20
|
//#endregion
|
|
21
|
-
//#region src/runner/turn-retry.d.ts
|
|
22
|
-
type LlmTurnRetryConfig = {
|
|
23
|
-
enabled?: boolean;
|
|
24
|
-
maxAttempts?: number;
|
|
25
|
-
initialDelayMs?: number;
|
|
26
|
-
maxDelayMs?: number;
|
|
27
|
-
};
|
|
28
|
-
//#endregion
|
|
29
|
-
//#region src/plugins/types.d.ts
|
|
30
|
-
type PluginDiagnostic = {
|
|
31
|
-
level: "warn" | "error";
|
|
32
|
-
message: string;
|
|
33
|
-
pluginId?: string;
|
|
34
|
-
source?: string;
|
|
35
|
-
};
|
|
36
|
-
type PluginOrigin = "bundled" | "global" | "workspace" | "config";
|
|
37
|
-
type PluginKind = "memory";
|
|
38
|
-
type PluginConfigUiHint = {
|
|
39
|
-
label?: string;
|
|
40
|
-
help?: string;
|
|
41
|
-
tags?: string[];
|
|
42
|
-
advanced?: boolean;
|
|
43
|
-
sensitive?: boolean;
|
|
44
|
-
placeholder?: string;
|
|
45
|
-
};
|
|
46
|
-
type PluginManifest = {
|
|
47
|
-
id: string;
|
|
48
|
-
configSchema: Record<string, unknown>;
|
|
49
|
-
kind?: PluginKind;
|
|
50
|
-
skills?: string[];
|
|
51
|
-
name?: string;
|
|
52
|
-
description?: string;
|
|
53
|
-
version?: string;
|
|
54
|
-
uiHints?: Record<string, PluginConfigUiHint>;
|
|
55
|
-
};
|
|
56
|
-
type PluginManifestLoadResult = {
|
|
57
|
-
ok: true;
|
|
58
|
-
manifest: PluginManifest;
|
|
59
|
-
manifestPath: string;
|
|
60
|
-
} | {
|
|
61
|
-
ok: false;
|
|
62
|
-
error: string;
|
|
63
|
-
manifestPath: string;
|
|
64
|
-
};
|
|
65
|
-
type PluginCandidate = {
|
|
66
|
-
idHint: string;
|
|
67
|
-
source: string;
|
|
68
|
-
rootDir: string;
|
|
69
|
-
origin: PluginOrigin;
|
|
70
|
-
workspaceDir?: string;
|
|
71
|
-
packageName?: string;
|
|
72
|
-
packageVersion?: string;
|
|
73
|
-
packageDescription?: string;
|
|
74
|
-
packageDir?: string;
|
|
75
|
-
packageManifest?: AIMaxPackageManifest;
|
|
76
|
-
};
|
|
77
|
-
type AIMaxPackageManifest = {
|
|
78
|
-
extensions?: string[];
|
|
79
|
-
};
|
|
80
|
-
type PluginDiscoveryResult = {
|
|
81
|
-
candidates: PluginCandidate[];
|
|
82
|
-
diagnostics: PluginDiagnostic[];
|
|
83
|
-
};
|
|
84
|
-
//#endregion
|
|
85
|
-
//#region src/plugins/manifest-registry.d.ts
|
|
86
|
-
type PluginManifestRecord = {
|
|
87
|
-
id: string;
|
|
88
|
-
rootDir: string;
|
|
89
|
-
source: string;
|
|
90
|
-
origin: PluginCandidate["origin"];
|
|
91
|
-
manifestPath: string;
|
|
92
|
-
manifest: PluginManifest;
|
|
93
|
-
};
|
|
94
|
-
type PluginManifestRegistry = {
|
|
95
|
-
manifests: Map<string, PluginManifestRecord>;
|
|
96
|
-
diagnostics: PluginDiagnostic[];
|
|
97
|
-
};
|
|
98
|
-
declare function loadPluginManifestRegistry(candidates: PluginCandidate[]): PluginManifestRegistry;
|
|
99
|
-
//#endregion
|
|
100
|
-
//#region src/plugins/config-state.d.ts
|
|
101
|
-
type PluginEntryConfig = {
|
|
102
|
-
enabled?: boolean;
|
|
103
|
-
config?: Record<string, unknown>;
|
|
104
|
-
};
|
|
105
|
-
type PluginsConfig = {
|
|
106
|
-
enabled?: boolean;
|
|
107
|
-
allow?: string[];
|
|
108
|
-
deny?: string[];
|
|
109
|
-
llmAllowlist?: string[];
|
|
110
|
-
load?: {
|
|
111
|
-
paths?: string[];
|
|
112
|
-
};
|
|
113
|
-
entries?: Record<string, PluginEntryConfig>;
|
|
114
|
-
slots?: Partial<Record<PluginKind, string>>;
|
|
115
|
-
};
|
|
116
|
-
type NormalizedPluginsConfig = {
|
|
117
|
-
enabled: boolean;
|
|
118
|
-
allow: string[];
|
|
119
|
-
deny: string[];
|
|
120
|
-
loadPaths: string[];
|
|
121
|
-
entries: Record<string, PluginEntryConfig>;
|
|
122
|
-
slots: Partial<Record<PluginKind, string>>;
|
|
123
|
-
};
|
|
124
|
-
type PluginsConfigValidationResult = {
|
|
125
|
-
ok: boolean;
|
|
126
|
-
diagnostics: PluginDiagnostic[];
|
|
127
|
-
};
|
|
128
|
-
declare function normalizePluginsConfig(input?: PluginsConfig): NormalizedPluginsConfig;
|
|
129
|
-
declare function validatePluginsConfig(params: {
|
|
130
|
-
config: NormalizedPluginsConfig;
|
|
131
|
-
registry: PluginManifestRegistry;
|
|
132
|
-
}): PluginsConfigValidationResult;
|
|
133
|
-
//#endregion
|
|
134
21
|
//#region src/memory/config.d.ts
|
|
135
22
|
type MemorySearchConfig = {
|
|
136
23
|
chunkTokens: number;
|
|
@@ -377,97 +264,310 @@ type MemoryProvider = {
|
|
|
377
264
|
};
|
|
378
265
|
type MemoryProviderFactory = (ctx: MemoryProviderContext) => MemoryProvider;
|
|
379
266
|
//#endregion
|
|
380
|
-
//#region src/
|
|
381
|
-
|
|
382
|
-
type
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
* sub-subagents (depth ≥ 2) inside their parent subagent's own directory.
|
|
392
|
-
*/
|
|
393
|
-
parentDir?: string;
|
|
267
|
+
//#region src/plugins/hooks.d.ts
|
|
268
|
+
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" | "dream_gate" | "memory_changed";
|
|
269
|
+
type PluginHookAgentContext = {
|
|
270
|
+
agentId?: string;
|
|
271
|
+
sessionId?: string;
|
|
272
|
+
workspaceDir?: string;
|
|
273
|
+
channel?: AgentRunParams["channel"];
|
|
274
|
+
};
|
|
275
|
+
type PluginExecutionRuntime = {
|
|
276
|
+
eventDispatcher: {
|
|
277
|
+
dispatchProgress: (sessionId: string, event: AgentProgressEvent$1) => Promise<void>;
|
|
394
278
|
};
|
|
395
279
|
};
|
|
396
|
-
type
|
|
397
|
-
|
|
398
|
-
metadata: SessionMetadata$1 | null;
|
|
399
|
-
transcriptPath: string;
|
|
400
|
-
contextSnapshotPath: string;
|
|
401
|
-
sessionMemoryPath: string;
|
|
402
|
-
collapseLogPath: string;
|
|
403
|
-
toolResultsDir: string;
|
|
404
|
-
transcriptEntryCount: number;
|
|
405
|
-
readStateCount: number;
|
|
406
|
-
toolResultRefCount: number;
|
|
407
|
-
transcriptEntries: TranscriptEntry[];
|
|
408
|
-
context: SessionContextSnapshot;
|
|
280
|
+
type PluginHookBeforeModelResolveEvent = {
|
|
281
|
+
prompt: string;
|
|
409
282
|
};
|
|
410
|
-
type
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
283
|
+
type PluginHookBeforeModelResolveResult = {
|
|
284
|
+
modelOverride?: string;
|
|
285
|
+
};
|
|
286
|
+
type PluginHookBeforePromptBuildEvent = {
|
|
287
|
+
prompt: string;
|
|
288
|
+
};
|
|
289
|
+
type PluginHookBeforePromptBuildResult = {
|
|
290
|
+
systemPrompt?: string;
|
|
291
|
+
prependContext?: string;
|
|
292
|
+
};
|
|
293
|
+
type PluginHookAfterPromptBuildEvent = {
|
|
294
|
+
prompt: string;
|
|
295
|
+
systemPrompt: string;
|
|
296
|
+
};
|
|
297
|
+
type PluginHookLlmInputEvent = {
|
|
298
|
+
sessionId: string;
|
|
299
|
+
model: string;
|
|
300
|
+
prompt: string;
|
|
301
|
+
historyMessages: unknown[];
|
|
302
|
+
};
|
|
303
|
+
type PluginHookAssistantMessageEndEvent = {
|
|
304
|
+
sessionId: string;
|
|
305
|
+
model: string;
|
|
306
|
+
assistantText: string;
|
|
307
|
+
assistantMessage: AssistantMessage;
|
|
308
|
+
hasToolCalls: boolean;
|
|
309
|
+
durationMs?: number;
|
|
310
|
+
usage?: {
|
|
311
|
+
input?: number;
|
|
312
|
+
output?: number;
|
|
313
|
+
total?: number;
|
|
421
314
|
};
|
|
422
315
|
};
|
|
423
|
-
type
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
316
|
+
type PluginHookLlmOutputEvent = {
|
|
317
|
+
sessionId: string;
|
|
318
|
+
model: string;
|
|
319
|
+
assistantTexts: string[];
|
|
320
|
+
lastAssistant?: AssistantMessage;
|
|
321
|
+
durationMs?: number;
|
|
322
|
+
usage?: {
|
|
323
|
+
input?: number;
|
|
324
|
+
output?: number;
|
|
325
|
+
total?: number;
|
|
326
|
+
};
|
|
429
327
|
};
|
|
430
|
-
|
|
431
|
-
type ArtifactOperationType = "write" | "edit" | "delete" | "move";
|
|
432
|
-
type ArtifactOperationName = "write_file" | "edit_file" | "patch_add" | "patch_update" | "patch_delete" | "patch_move";
|
|
433
|
-
type ArtifactOperationInput = {
|
|
434
|
-
type: ArtifactOperationType;
|
|
435
|
-
operation: ArtifactOperationName;
|
|
436
|
-
file: string;
|
|
437
|
-
sourceFile?: string;
|
|
438
|
-
content: string;
|
|
328
|
+
type PluginHookBeforeToolCallEvent = {
|
|
439
329
|
toolCallId: string;
|
|
440
|
-
toolName: string;
|
|
441
|
-
|
|
442
|
-
sessionId: string;
|
|
330
|
+
toolName: string;
|
|
331
|
+
params: Record<string, unknown>;
|
|
443
332
|
};
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
truncated: boolean;
|
|
449
|
-
originalChars: number;
|
|
333
|
+
type PluginHookBeforeToolCallResult = {
|
|
334
|
+
params?: Record<string, unknown>;
|
|
335
|
+
block?: boolean;
|
|
336
|
+
blockReason?: string;
|
|
450
337
|
};
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
338
|
+
type PluginHookAfterToolCallEvent = {
|
|
339
|
+
toolCallId: string;
|
|
340
|
+
toolName: string;
|
|
341
|
+
params: Record<string, unknown>;
|
|
342
|
+
result?: unknown;
|
|
343
|
+
error?: string;
|
|
344
|
+
durationMs?: number;
|
|
345
|
+
};
|
|
346
|
+
type PluginHookAgentEndEvent = {
|
|
347
|
+
success: boolean;
|
|
348
|
+
error?: string;
|
|
349
|
+
durationMs?: number;
|
|
350
|
+
};
|
|
351
|
+
type PluginHookBeforeCompactionEvent = {
|
|
352
|
+
messageCount: number;
|
|
353
|
+
compactingCount?: number;
|
|
354
|
+
};
|
|
355
|
+
type PluginHookBeforeCompactionResult = {
|
|
356
|
+
skipPersist?: boolean;
|
|
357
|
+
injectRecall?: string;
|
|
358
|
+
};
|
|
359
|
+
type PluginHookAfterCompactionEvent = {
|
|
360
|
+
messageCount: number;
|
|
361
|
+
compactedCount: number;
|
|
362
|
+
};
|
|
363
|
+
type PluginHookSessionStartEvent = {
|
|
364
|
+
sessionId: string;
|
|
365
|
+
};
|
|
366
|
+
type PluginHookSessionEndEvent = {
|
|
367
|
+
sessionId: string;
|
|
368
|
+
messageCount: number;
|
|
369
|
+
durationMs?: number;
|
|
370
|
+
};
|
|
371
|
+
type PluginHookSessionResetEvent = {
|
|
372
|
+
action: "new" | "reset";
|
|
373
|
+
sessionId: string;
|
|
374
|
+
previousSessionId?: string;
|
|
375
|
+
message: string;
|
|
376
|
+
};
|
|
377
|
+
type PluginHookDreamGateEvent = {
|
|
378
|
+
dataDir: string;
|
|
379
|
+
memoryDir: string;
|
|
380
|
+
providerId: string;
|
|
381
|
+
pluginId?: string;
|
|
382
|
+
trigger: "cli" | "cron";
|
|
383
|
+
dryRun?: boolean;
|
|
384
|
+
};
|
|
385
|
+
type PluginHookDreamGateResult = {
|
|
386
|
+
handled?: boolean;
|
|
387
|
+
status?: "noop" | "completed" | "queued" | "failed";
|
|
388
|
+
summary?: string;
|
|
389
|
+
details?: Record<string, unknown>;
|
|
390
|
+
};
|
|
391
|
+
type PluginHookMemoryChangedEvent = MemoryChangedEvent;
|
|
392
|
+
type PluginHookHandlerMap = {
|
|
393
|
+
before_model_resolve: (event: PluginHookBeforeModelResolveEvent, ctx: PluginHookAgentContext) => PluginHookBeforeModelResolveResult | void | Promise<PluginHookBeforeModelResolveResult | void>;
|
|
394
|
+
before_prompt_build: (event: PluginHookBeforePromptBuildEvent, ctx: PluginHookAgentContext) => PluginHookBeforePromptBuildResult | void | Promise<PluginHookBeforePromptBuildResult | void>;
|
|
395
|
+
after_prompt_build: (event: PluginHookAfterPromptBuildEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
|
|
396
|
+
llm_input: (event: PluginHookLlmInputEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
|
|
397
|
+
assistant_message_end: (event: PluginHookAssistantMessageEndEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
|
|
398
|
+
llm_output: (event: PluginHookLlmOutputEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
|
|
399
|
+
before_tool_call: (event: PluginHookBeforeToolCallEvent, ctx: PluginHookAgentContext) => PluginHookBeforeToolCallResult | void | Promise<PluginHookBeforeToolCallResult | void>;
|
|
400
|
+
after_tool_call: (event: PluginHookAfterToolCallEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
|
|
401
|
+
agent_end: (event: PluginHookAgentEndEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
|
|
402
|
+
before_compaction: (event: PluginHookBeforeCompactionEvent, ctx: PluginHookAgentContext) => PluginHookBeforeCompactionResult | void | Promise<PluginHookBeforeCompactionResult | void>;
|
|
403
|
+
after_compaction: (event: PluginHookAfterCompactionEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
|
|
404
|
+
session_start: (event: PluginHookSessionStartEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
|
|
405
|
+
session_end: (event: PluginHookSessionEndEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
|
|
406
|
+
session_reset: (event: PluginHookSessionResetEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
|
|
407
|
+
dream_gate: (event: PluginHookDreamGateEvent, ctx: PluginHookAgentContext) => PluginHookDreamGateResult | void | Promise<PluginHookDreamGateResult | void>;
|
|
408
|
+
memory_changed: (event: PluginHookMemoryChangedEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
|
|
409
|
+
};
|
|
410
|
+
type PluginHookRegistration<K extends PluginHookName = PluginHookName> = {
|
|
411
|
+
pluginId: string;
|
|
412
|
+
hookName: K;
|
|
413
|
+
handler: PluginHookHandlerMap[K];
|
|
414
|
+
priority?: number;
|
|
415
|
+
source: string;
|
|
416
|
+
};
|
|
417
|
+
declare class PluginHookRegistry {
|
|
418
|
+
private readonly hooks;
|
|
419
|
+
register<K extends PluginHookName>(registration: PluginHookRegistration<K>): void;
|
|
420
|
+
dispatch<K extends PluginHookName>(hookName: K, event: Parameters<PluginHookHandlerMap[K]>[0], ctx: Parameters<PluginHookHandlerMap[K]>[1], runtime?: PluginExecutionRuntime): Promise<Array<Awaited<ReturnType<PluginHookHandlerMap[K]>>>>;
|
|
421
|
+
}
|
|
422
|
+
//#endregion
|
|
423
|
+
//#region src/runner/event-dispatcher.d.ts
|
|
424
|
+
type EventDispatchParams = Pick<AgentRunParams, "onProgress" | "messageId" | "channel" | "subagentContext">;
|
|
425
|
+
/**
|
|
426
|
+
* Emits runner events to in-process listeners.
|
|
427
|
+
*/
|
|
428
|
+
declare class RunEventDispatcher {
|
|
429
|
+
private readonly params;
|
|
430
|
+
constructor(params: EventDispatchParams);
|
|
431
|
+
dispatchProgress(sessionId: string, event: AgentProgressEvent$2): Promise<void>;
|
|
432
|
+
dispatchDiagnostic(sessionId: string, event: Omit<AgentDiagnosticEvent, keyof AgentProgressEventBase | "type">): Promise<void>;
|
|
433
|
+
}
|
|
434
|
+
//#endregion
|
|
435
|
+
//#region src/runner/turn/retry.d.ts
|
|
436
|
+
type LlmTurnRetryConfig = {
|
|
437
|
+
enabled?: boolean;
|
|
438
|
+
maxAttempts?: number;
|
|
439
|
+
initialDelayMs?: number;
|
|
440
|
+
maxDelayMs?: number;
|
|
441
|
+
};
|
|
442
|
+
//#endregion
|
|
443
|
+
//#region src/bootstrap/bootstrap.d.ts
|
|
444
|
+
/** Maximum characters per bootstrap file before truncation */
|
|
445
|
+
declare const BOOTSTRAP_MAX_CHARS = 20000;
|
|
446
|
+
/** Maximum total characters across all bootstrap files */
|
|
447
|
+
declare const BOOTSTRAP_TOTAL_MAX_CHARS = 150000;
|
|
448
|
+
/** Names of bootstrap identity files, in injection order */
|
|
449
|
+
declare const BOOTSTRAP_FILE_NAMES: readonly ["AGENTS.md", "SOUL.md", "TOOLS.md", "IDENTITY.md", "USER.md", "MEMORY.md", "BOOTSTRAP.md"];
|
|
450
|
+
/** A loaded (or missing) bootstrap file */
|
|
451
|
+
type BootstrapFile = {
|
|
452
|
+
name: string;
|
|
453
|
+
path: string;
|
|
454
|
+
content: string | null;
|
|
455
|
+
missing: boolean;
|
|
456
|
+
};
|
|
457
|
+
/** A bootstrap file ready for system prompt injection */
|
|
458
|
+
type BootstrapContextFile = {
|
|
459
|
+
path: string;
|
|
460
|
+
content: string;
|
|
461
|
+
};
|
|
462
|
+
/** Resolves the base .aimax directory within a data directory */
|
|
463
|
+
declare function aimaxDir(dataDir: string): string;
|
|
464
|
+
/**
|
|
465
|
+
* Loads all standard bootstrap identity files from the .aimax directory.
|
|
466
|
+
* Missing files are included as `missing: true` entries.
|
|
467
|
+
* BOOTSTRAP.md is deleted after loading (one-time use).
|
|
468
|
+
*/
|
|
469
|
+
declare function loadBootstrapFiles(dataDir: string): Promise<BootstrapFile[]>;
|
|
470
|
+
/**
|
|
471
|
+
* Converts loaded bootstrap files into context file entries for system prompt injection.
|
|
472
|
+
* Applies per-file and total character budget limits.
|
|
473
|
+
*/
|
|
474
|
+
declare function buildBootstrapContextFiles(files: BootstrapFile[], opts?: {
|
|
475
|
+
maxChars?: number;
|
|
476
|
+
totalMaxChars?: number;
|
|
477
|
+
warn?: (message: string) => void;
|
|
478
|
+
}): BootstrapContextFile[];
|
|
479
|
+
//#endregion
|
|
480
|
+
//#region src/session/session.d.ts
|
|
481
|
+
declare const DEFAULT_SESSION_STORE_NAME = "sessions";
|
|
482
|
+
type SessionPathOptions = {
|
|
483
|
+
storeName?: string; /** Whether session data should be encrypted at rest. */
|
|
484
|
+
encryptSessions?: boolean;
|
|
485
|
+
subagent?: {
|
|
486
|
+
parentSessionId: string;
|
|
487
|
+
/**
|
|
488
|
+
* Absolute filesystem path of the parent session's directory.
|
|
489
|
+
* When set, the child path is resolved as `path.join(parentDir, "subagents", childSessionId)`
|
|
490
|
+
* rather than anchoring at `sessionsDir`. This is required for correctly nesting
|
|
491
|
+
* sub-subagents (depth ≥ 2) inside their parent subagent's own directory.
|
|
492
|
+
*/
|
|
493
|
+
parentDir?: string;
|
|
494
|
+
};
|
|
495
|
+
};
|
|
496
|
+
type SessionInspection = {
|
|
497
|
+
id: string;
|
|
498
|
+
metadata: SessionMetadata$1 | null;
|
|
499
|
+
transcriptPath: string;
|
|
500
|
+
contextSnapshotPath: string;
|
|
501
|
+
sessionMemoryPath: string;
|
|
502
|
+
collapseLogPath: string;
|
|
503
|
+
toolResultsDir: string;
|
|
504
|
+
transcriptEntryCount: number;
|
|
505
|
+
readStateCount: number;
|
|
506
|
+
toolResultRefCount: number;
|
|
507
|
+
transcriptEntries: TranscriptEntry[];
|
|
508
|
+
context: SessionContextSnapshot;
|
|
509
|
+
};
|
|
510
|
+
type SessionExport = {
|
|
511
|
+
id: string;
|
|
512
|
+
metadata: SessionMetadata$1 | null;
|
|
513
|
+
transcript: TranscriptEntry[];
|
|
514
|
+
context: SessionContextSnapshot;
|
|
515
|
+
paths: {
|
|
516
|
+
transcriptPath: string;
|
|
517
|
+
contextSnapshotPath: string;
|
|
518
|
+
sessionMemoryPath: string;
|
|
519
|
+
collapseLogPath: string;
|
|
520
|
+
toolResultsDir: string;
|
|
521
|
+
};
|
|
522
|
+
};
|
|
523
|
+
type CronExecutionRecord = {
|
|
524
|
+
task: string;
|
|
525
|
+
status: "done" | "error" | "killed";
|
|
526
|
+
content: string;
|
|
527
|
+
childSessionId?: string;
|
|
528
|
+
createdAt: string;
|
|
529
|
+
};
|
|
530
|
+
declare const MAX_ARTIFACT_CONTENT_CHARS = 2000;
|
|
531
|
+
type ArtifactOperationType = "write" | "edit" | "delete" | "move";
|
|
532
|
+
type ArtifactOperationName = "write_file" | "edit_file" | "patch_add" | "patch_update" | "patch_delete" | "patch_move";
|
|
533
|
+
type ArtifactOperationInput = {
|
|
534
|
+
type: ArtifactOperationType;
|
|
535
|
+
operation: ArtifactOperationName;
|
|
536
|
+
file: string;
|
|
537
|
+
sourceFile?: string;
|
|
538
|
+
content: string;
|
|
539
|
+
toolCallId: string;
|
|
540
|
+
toolName: string; /** Whether this operation was performed by the agent itself or a subagent */
|
|
541
|
+
source: "agent" | "subagent"; /** The session that actually performed this operation */
|
|
542
|
+
sessionId: string;
|
|
543
|
+
};
|
|
544
|
+
/** Operation shape that tool implementations provide before the recorder enriches it with source/sessionId. */
|
|
545
|
+
type ArtifactOpInput = Omit<ArtifactOperationInput, "source" | "sessionId">;
|
|
546
|
+
type ArtifactOperation = ArtifactOperationInput & {
|
|
547
|
+
timestamp: string;
|
|
548
|
+
truncated: boolean;
|
|
549
|
+
originalChars: number;
|
|
550
|
+
};
|
|
551
|
+
/** Resolves the sessions directory path within a data directory */
|
|
552
|
+
declare function normalizeSessionStoreName(storeName?: string): string;
|
|
553
|
+
/** Resolves the sessions directory path within a data directory */
|
|
554
|
+
declare function sessionsDir(dataDir: string, options?: SessionPathOptions): string;
|
|
555
|
+
/** Resolves the directory for a specific session */
|
|
556
|
+
declare function sessionDir(dataDir: string, sessionId: string, options?: SessionPathOptions): string;
|
|
557
|
+
/** Resolves the transcript file path for a session */
|
|
558
|
+
declare function transcriptPath(dataDir: string, sessionId: string, options?: SessionPathOptions): string;
|
|
559
|
+
/** Resolves the artifact operation log path for a session */
|
|
560
|
+
declare function artifactsPath(dataDir: string, sessionId: string, options?: SessionPathOptions): string;
|
|
561
|
+
/** Resolves the metadata file path for a session */
|
|
562
|
+
declare function metadataPath(dataDir: string, sessionId: string, options?: SessionPathOptions): string;
|
|
563
|
+
/** Resolves the persisted context snapshot path for a session */
|
|
564
|
+
declare function contextSnapshotPath(dataDir: string, sessionId: string, options?: SessionPathOptions): string;
|
|
565
|
+
declare function sessionMemoryPath(dataDir: string, sessionId: string, options?: SessionPathOptions): string;
|
|
566
|
+
declare function collapseLogPath(dataDir: string, sessionId: string, options?: SessionPathOptions): string;
|
|
567
|
+
/** Resolves the persisted tool-results directory for a session */
|
|
568
|
+
declare function toolResultsDir(dataDir: string, sessionId: string, options?: SessionPathOptions): string;
|
|
569
|
+
declare function cronExecutionsPath(dataDir: string, sessionId: string, options?: SessionPathOptions): string;
|
|
570
|
+
/** Creates a new session with a generated ID */
|
|
471
571
|
declare function createSession(dataDir: string, channel: Channel, options?: SessionPathOptions & {
|
|
472
572
|
sessionId?: string;
|
|
473
573
|
}): Promise<string>;
|
|
@@ -525,29 +625,141 @@ type TopicSegmentationConfig = {
|
|
|
525
625
|
maxTokens?: number;
|
|
526
626
|
};
|
|
527
627
|
//#endregion
|
|
528
|
-
//#region src/
|
|
529
|
-
|
|
530
|
-
declare function skillsDir(dataDir: string): string;
|
|
531
|
-
/** Represents a loaded skill */
|
|
532
|
-
type Skill = {
|
|
533
|
-
name: string;
|
|
534
|
-
description: string;
|
|
535
|
-
location: string;
|
|
536
|
-
version: string;
|
|
537
|
-
skillFileMtime: string;
|
|
538
|
-
};
|
|
539
|
-
type SkillDirectory = {
|
|
540
|
-
skill: Skill;
|
|
541
|
-
rootDir: string;
|
|
542
|
-
};
|
|
543
|
-
type SkillViewResult = {
|
|
544
|
-
skill: Skill;
|
|
628
|
+
//#region src/context/session-context-store.d.ts
|
|
629
|
+
type PersistedToolResult = {
|
|
545
630
|
content: string;
|
|
631
|
+
reference?: ToolResultReference;
|
|
546
632
|
};
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
633
|
+
type SessionContextStore = {
|
|
634
|
+
findReusableRead(path: string, offset?: number, limit?: number): Promise<ReadStateRecord | null>;
|
|
635
|
+
recordRead(params: {
|
|
636
|
+
path: string;
|
|
637
|
+
content: string;
|
|
638
|
+
lineCount: number;
|
|
639
|
+
offset?: number;
|
|
640
|
+
limit?: number;
|
|
641
|
+
}): Promise<ReadStateRecord>;
|
|
642
|
+
invalidatePath(path: string): Promise<void>;
|
|
643
|
+
persistToolResult(params: {
|
|
644
|
+
toolCallId: string;
|
|
645
|
+
toolName: string;
|
|
646
|
+
content: string;
|
|
647
|
+
thresholdChars?: number;
|
|
648
|
+
previewChars?: number;
|
|
649
|
+
}): Promise<PersistedToolResult>;
|
|
650
|
+
recordSnip(record: SnipRecord): Promise<void>;
|
|
651
|
+
recordCollapse(span: CollapseSpan): Promise<void>;
|
|
652
|
+
setSessionMemory(snapshot: SessionMemorySnapshot): Promise<void>;
|
|
653
|
+
recordModelUsage(checkpoint: ModelUsageCheckpoint): Promise<void>;
|
|
654
|
+
recordAutocompactResult(params: {
|
|
655
|
+
layer: "L6";
|
|
656
|
+
failed: boolean;
|
|
657
|
+
timestamp: string;
|
|
658
|
+
}): Promise<void>;
|
|
659
|
+
getSnapshot(): SessionContextSnapshot;
|
|
660
|
+
};
|
|
661
|
+
type SessionContextStoreOptions = {
|
|
662
|
+
dataDir: string;
|
|
663
|
+
sessionId: string;
|
|
664
|
+
} & SessionPathOptions;
|
|
665
|
+
declare function createSessionContextStore(options: SessionContextStoreOptions): Promise<SessionContextStore>;
|
|
666
|
+
//#endregion
|
|
667
|
+
//#region src/context/context-manager.d.ts
|
|
668
|
+
type ManageLayeredHistoryParams = {
|
|
669
|
+
entries: TranscriptEntry[];
|
|
670
|
+
modelInfo: {
|
|
671
|
+
model: string;
|
|
672
|
+
api: string;
|
|
673
|
+
};
|
|
674
|
+
contextWindowTokens: number;
|
|
675
|
+
llm: Pick<AgentRunParams["llm"], "apiFormat" | "baseUrl" | "apiKey" | "model" | "flashModel">;
|
|
676
|
+
historyLimit?: number;
|
|
677
|
+
compactionEnabled?: boolean;
|
|
678
|
+
pendingUserMessage?: string;
|
|
679
|
+
topicSegmentation?: TopicSegmentationConfig;
|
|
680
|
+
signal?: AbortSignal;
|
|
681
|
+
hooks?: PluginHookRegistry;
|
|
682
|
+
hookCtx?: PluginHookAgentContext;
|
|
683
|
+
contextStore?: SessionContextStore;
|
|
684
|
+
dataDir?: string;
|
|
685
|
+
sessionId?: string;
|
|
686
|
+
sessionStoreName?: string;
|
|
687
|
+
sessionPathScope?: Pick<SessionPathOptions, "subagent">;
|
|
688
|
+
channel?: Channel$1;
|
|
689
|
+
isSubagent?: boolean;
|
|
690
|
+
};
|
|
691
|
+
type ManageLayeredHistoryResult = {
|
|
692
|
+
messages: AgentMessage[];
|
|
693
|
+
priorSummary: string | undefined;
|
|
694
|
+
compactionEntry: CompactionEntry | undefined;
|
|
695
|
+
stats: {
|
|
696
|
+
originalCount: number;
|
|
697
|
+
keptCount: number;
|
|
698
|
+
estimatedTokens: number;
|
|
699
|
+
compacted: boolean;
|
|
700
|
+
};
|
|
701
|
+
compactionEvents: AgentProgressEvent$1[];
|
|
702
|
+
};
|
|
703
|
+
type ContextManager = {
|
|
704
|
+
getReusableRead(path: string, offset?: number, limit?: number): Promise<{
|
|
705
|
+
reused: boolean;
|
|
706
|
+
lineCount?: number;
|
|
707
|
+
}>;
|
|
708
|
+
rememberRead(params: {
|
|
709
|
+
path: string;
|
|
710
|
+
content: string;
|
|
711
|
+
lineCount: number;
|
|
712
|
+
offset?: number;
|
|
713
|
+
limit?: number;
|
|
714
|
+
}): Promise<void>;
|
|
715
|
+
invalidateReadPath(path: string): Promise<void>;
|
|
716
|
+
persistToolResult(params: {
|
|
717
|
+
toolCallId: string;
|
|
718
|
+
toolName: string;
|
|
719
|
+
content: string;
|
|
720
|
+
thresholdChars?: number;
|
|
721
|
+
previewChars?: number;
|
|
722
|
+
}): Promise<PersistedToolResult>;
|
|
723
|
+
recordModelUsage(params: {
|
|
724
|
+
model: string;
|
|
725
|
+
inputTokens: number;
|
|
726
|
+
outputTokens: number;
|
|
727
|
+
totalTokens: number;
|
|
728
|
+
coveredTranscriptEntryCount: number;
|
|
729
|
+
}): Promise<void>;
|
|
730
|
+
manageHistory(params: Omit<ManageLayeredHistoryParams, "contextStore">): Promise<ManageLayeredHistoryResult>;
|
|
731
|
+
getSnapshot: SessionContextStore["getSnapshot"];
|
|
732
|
+
};
|
|
733
|
+
declare function createContextManager(params: {
|
|
734
|
+
dataDir: string;
|
|
735
|
+
sessionId: string;
|
|
736
|
+
sessionStoreName?: string;
|
|
737
|
+
sessionPathScope?: Pick<SessionPathOptions, "subagent">;
|
|
738
|
+
}): Promise<ContextManager>;
|
|
739
|
+
//#endregion
|
|
740
|
+
//#region src/skills/skills.d.ts
|
|
741
|
+
/** Resolves the skills directory path within a data directory */
|
|
742
|
+
declare function skillsDir(dataDir: string): string;
|
|
743
|
+
/** Represents a loaded skill */
|
|
744
|
+
type Skill = {
|
|
745
|
+
name: string;
|
|
746
|
+
description: string;
|
|
747
|
+
location: string;
|
|
748
|
+
version: string;
|
|
749
|
+
skillFileMtime: string;
|
|
750
|
+
};
|
|
751
|
+
type SkillDirectory = {
|
|
752
|
+
skill: Skill;
|
|
753
|
+
rootDir: string;
|
|
754
|
+
};
|
|
755
|
+
type SkillViewResult = {
|
|
756
|
+
skill: Skill;
|
|
757
|
+
content: string;
|
|
758
|
+
};
|
|
759
|
+
/**
|
|
760
|
+
* Loads all installed skills from the skills directory.
|
|
761
|
+
* Each skill is a directory containing a SKILL.md file.
|
|
762
|
+
* Returns at most MAX_SKILLS_IN_PROMPT skills.
|
|
551
763
|
*/
|
|
552
764
|
declare function loadSkills(dataDir: string): Promise<Skill[]>;
|
|
553
765
|
declare function loadSkillsWithPluginDirs(dataDir: string, pluginDirs: string[], skillsLoadPaths?: string[]): Promise<Skill[]>;
|
|
@@ -561,6 +773,258 @@ declare function loadSkillView(dirs: string[], requestedName: string, skillPath?
|
|
|
561
773
|
*/
|
|
562
774
|
declare function buildSkillsPrompt(skills: Skill[]): string;
|
|
563
775
|
//#endregion
|
|
776
|
+
//#region src/auto-skills/types.d.ts
|
|
777
|
+
type AutoSkillSource = "auto";
|
|
778
|
+
type AutoSkillStatus = "active" | "archived";
|
|
779
|
+
type AutoSkillCategory = {
|
|
780
|
+
path: string;
|
|
781
|
+
name: string;
|
|
782
|
+
description: string;
|
|
783
|
+
createdBy?: string;
|
|
784
|
+
};
|
|
785
|
+
type AutoSkillIndexEntry = {
|
|
786
|
+
skillId: string;
|
|
787
|
+
name: string;
|
|
788
|
+
description: string;
|
|
789
|
+
categoryPath: string;
|
|
790
|
+
source: AutoSkillSource;
|
|
791
|
+
status: AutoSkillStatus;
|
|
792
|
+
rootDir: string;
|
|
793
|
+
skillDir: string;
|
|
794
|
+
skillFile: string;
|
|
795
|
+
metadataFile?: string;
|
|
796
|
+
tags: string[];
|
|
797
|
+
relatedSkills: string[];
|
|
798
|
+
confidence?: number;
|
|
799
|
+
createdAt?: string;
|
|
800
|
+
updatedAt?: string;
|
|
801
|
+
};
|
|
802
|
+
type AutoSkillListItem = {
|
|
803
|
+
skillId: string;
|
|
804
|
+
name: string;
|
|
805
|
+
description: string;
|
|
806
|
+
categoryPath: string;
|
|
807
|
+
source: AutoSkillSource;
|
|
808
|
+
};
|
|
809
|
+
type AutoSkillSearchResult = AutoSkillListItem & {
|
|
810
|
+
score: number;
|
|
811
|
+
};
|
|
812
|
+
type AutoSkillViewResult = AutoSkillListItem & {
|
|
813
|
+
status: AutoSkillStatus;
|
|
814
|
+
content: string;
|
|
815
|
+
path: string;
|
|
816
|
+
skillDir: string;
|
|
817
|
+
filePath?: string;
|
|
818
|
+
tags?: string[];
|
|
819
|
+
relatedSkills?: string[];
|
|
820
|
+
};
|
|
821
|
+
type AutoSkillsLoaderOptions = {
|
|
822
|
+
dataDir?: string;
|
|
823
|
+
rootDir?: string;
|
|
824
|
+
includeArchived?: boolean;
|
|
825
|
+
maxSkillBytes?: number;
|
|
826
|
+
maxResourceBytes?: number;
|
|
827
|
+
};
|
|
828
|
+
type AutoSkillListOptions = {
|
|
829
|
+
categoryPath?: string;
|
|
830
|
+
recursive?: boolean;
|
|
831
|
+
};
|
|
832
|
+
type AutoSkillSearchOptions = {
|
|
833
|
+
query: string;
|
|
834
|
+
limit?: number;
|
|
835
|
+
};
|
|
836
|
+
type AutoSkillViewOptions = {
|
|
837
|
+
skillId: string;
|
|
838
|
+
filePath?: string;
|
|
839
|
+
};
|
|
840
|
+
//#endregion
|
|
841
|
+
//#region src/subagent/types.d.ts
|
|
842
|
+
/** Status of a spawned subagent run */
|
|
843
|
+
type SubagentStatus = "running" | "done" | "error" | "killed";
|
|
844
|
+
/** Record tracking a single subagent run */
|
|
845
|
+
type SubagentRunRecord = {
|
|
846
|
+
runId: string;
|
|
847
|
+
childSessionId: string;
|
|
848
|
+
parentSessionId: string;
|
|
849
|
+
task: string;
|
|
850
|
+
label?: string; /** Nesting depth: parent is depth N, child is N+1 */
|
|
851
|
+
depth: number;
|
|
852
|
+
status: SubagentStatus;
|
|
853
|
+
result?: string;
|
|
854
|
+
error?: string;
|
|
855
|
+
startedAt: number;
|
|
856
|
+
endedAt?: number; /** Used to cancel the subagent run */
|
|
857
|
+
abortController: AbortController;
|
|
858
|
+
};
|
|
859
|
+
//#endregion
|
|
860
|
+
//#region src/subagent/registry.d.ts
|
|
861
|
+
declare const MAX_SUBAGENT_DEPTH = 2;
|
|
862
|
+
declare const MAX_CHILDREN_PER_SESSION = 5;
|
|
863
|
+
/**
|
|
864
|
+
* In-memory registry for subagent runs scoped to a single parent runAgent call.
|
|
865
|
+
* Child spawns create their own SubagentRegistry instances for their children.
|
|
866
|
+
*/
|
|
867
|
+
declare class SubagentRegistry {
|
|
868
|
+
private readonly entries;
|
|
869
|
+
/** RunIds whose terminal result has already been delivered to the parent. */
|
|
870
|
+
private readonly announced;
|
|
871
|
+
register(record: SubagentRunRecord, promise: Promise<void>): void;
|
|
872
|
+
complete(runId: string, result: string): void;
|
|
873
|
+
fail(runId: string, error: string): void;
|
|
874
|
+
/** Aborts and marks a specific run as killed. Returns false if not found or already ended. */
|
|
875
|
+
kill(runId: string): boolean;
|
|
876
|
+
/** Aborts all running subagents for the given parent session. Returns count killed. */
|
|
877
|
+
killAll(parentSessionId: string): number;
|
|
878
|
+
/** Lists all runs registered for the given parent session. */
|
|
879
|
+
list(parentSessionId: string): SubagentRunRecord[];
|
|
880
|
+
/** Returns true if any subagents for this session are still running. */
|
|
881
|
+
hasPending(parentSessionId: string): boolean;
|
|
882
|
+
/** Count of currently running children for a session. */
|
|
883
|
+
countActive(parentSessionId: string): number;
|
|
884
|
+
/**
|
|
885
|
+
* Waits until all currently-running subagents for the given session settle.
|
|
886
|
+
* Returns immediately if nothing is pending.
|
|
887
|
+
*/
|
|
888
|
+
waitForAll(parentSessionId: string): Promise<void>;
|
|
889
|
+
/**
|
|
890
|
+
* Returns all finished runs whose terminal result has not yet been delivered.
|
|
891
|
+
* This is a read-only snapshot; callers must explicitly mark delivery after
|
|
892
|
+
* the result has been handed back to the parent.
|
|
893
|
+
*/
|
|
894
|
+
peekCompleted(parentSessionId: string): SubagentRunRecord[];
|
|
895
|
+
/**
|
|
896
|
+
* Returns all finished runs that have not yet been returned by this method,
|
|
897
|
+
* and marks them as announced so they are not returned again.
|
|
898
|
+
*/
|
|
899
|
+
consumeCompleted(parentSessionId: string): SubagentRunRecord[];
|
|
900
|
+
/** Marks a finished run as already delivered to its parent. */
|
|
901
|
+
markAnnounced(runId: string | string[]): void;
|
|
902
|
+
/** Returns whether a run's terminal result has already been delivered. */
|
|
903
|
+
isAnnounced(runId: string): boolean;
|
|
904
|
+
/** Returns true if there are completed runs not yet returned by consumeCompleted. */
|
|
905
|
+
hasUnannounced(parentSessionId: string): boolean;
|
|
906
|
+
/**
|
|
907
|
+
* Returns true if the announce loop should run another iteration:
|
|
908
|
+
* either subagents are still running, or completed runs await announcement.
|
|
909
|
+
*/
|
|
910
|
+
needsAnnounce(parentSessionId: string): boolean;
|
|
911
|
+
/** Checks whether a new child can be spawned given depth and active-children limits. */
|
|
912
|
+
checkSpawnAllowed(parentSessionId: string, depth: number): {
|
|
913
|
+
allowed: true;
|
|
914
|
+
} | {
|
|
915
|
+
allowed: false;
|
|
916
|
+
reason: string;
|
|
917
|
+
};
|
|
918
|
+
/** Returns the current status snapshot for a single run, or null if not found. */
|
|
919
|
+
getStatus(runId: string): SubagentStatus | null;
|
|
920
|
+
private logTerminalStatus;
|
|
921
|
+
}
|
|
922
|
+
//#endregion
|
|
923
|
+
//#region src/plugins/types.d.ts
|
|
924
|
+
type PluginDiagnostic = {
|
|
925
|
+
level: "warn" | "error";
|
|
926
|
+
message: string;
|
|
927
|
+
pluginId?: string;
|
|
928
|
+
source?: string;
|
|
929
|
+
};
|
|
930
|
+
type PluginOrigin = "bundled" | "global" | "workspace" | "config";
|
|
931
|
+
type PluginKind = "memory";
|
|
932
|
+
type PluginConfigUiHint = {
|
|
933
|
+
label?: string;
|
|
934
|
+
help?: string;
|
|
935
|
+
tags?: string[];
|
|
936
|
+
advanced?: boolean;
|
|
937
|
+
sensitive?: boolean;
|
|
938
|
+
placeholder?: string;
|
|
939
|
+
};
|
|
940
|
+
type PluginManifest = {
|
|
941
|
+
id: string;
|
|
942
|
+
configSchema: Record<string, unknown>;
|
|
943
|
+
kind?: PluginKind;
|
|
944
|
+
skills?: string[];
|
|
945
|
+
name?: string;
|
|
946
|
+
description?: string;
|
|
947
|
+
version?: string;
|
|
948
|
+
uiHints?: Record<string, PluginConfigUiHint>;
|
|
949
|
+
};
|
|
950
|
+
type PluginManifestLoadResult = {
|
|
951
|
+
ok: true;
|
|
952
|
+
manifest: PluginManifest;
|
|
953
|
+
manifestPath: string;
|
|
954
|
+
} | {
|
|
955
|
+
ok: false;
|
|
956
|
+
error: string;
|
|
957
|
+
manifestPath: string;
|
|
958
|
+
};
|
|
959
|
+
type PluginCandidate = {
|
|
960
|
+
idHint: string;
|
|
961
|
+
source: string;
|
|
962
|
+
rootDir: string;
|
|
963
|
+
origin: PluginOrigin;
|
|
964
|
+
workspaceDir?: string;
|
|
965
|
+
packageName?: string;
|
|
966
|
+
packageVersion?: string;
|
|
967
|
+
packageDescription?: string;
|
|
968
|
+
packageDir?: string;
|
|
969
|
+
packageManifest?: AIMaxPackageManifest;
|
|
970
|
+
};
|
|
971
|
+
type AIMaxPackageManifest = {
|
|
972
|
+
extensions?: string[];
|
|
973
|
+
};
|
|
974
|
+
type PluginDiscoveryResult = {
|
|
975
|
+
candidates: PluginCandidate[];
|
|
976
|
+
diagnostics: PluginDiagnostic[];
|
|
977
|
+
};
|
|
978
|
+
//#endregion
|
|
979
|
+
//#region src/plugins/manifest-registry.d.ts
|
|
980
|
+
type PluginManifestRecord = {
|
|
981
|
+
id: string;
|
|
982
|
+
rootDir: string;
|
|
983
|
+
source: string;
|
|
984
|
+
origin: PluginCandidate["origin"];
|
|
985
|
+
manifestPath: string;
|
|
986
|
+
manifest: PluginManifest;
|
|
987
|
+
};
|
|
988
|
+
type PluginManifestRegistry = {
|
|
989
|
+
manifests: Map<string, PluginManifestRecord>;
|
|
990
|
+
diagnostics: PluginDiagnostic[];
|
|
991
|
+
};
|
|
992
|
+
declare function loadPluginManifestRegistry(candidates: PluginCandidate[]): PluginManifestRegistry;
|
|
993
|
+
//#endregion
|
|
994
|
+
//#region src/plugins/config-state.d.ts
|
|
995
|
+
type PluginEntryConfig = {
|
|
996
|
+
enabled?: boolean;
|
|
997
|
+
config?: Record<string, unknown>;
|
|
998
|
+
};
|
|
999
|
+
type PluginsConfig = {
|
|
1000
|
+
enabled?: boolean;
|
|
1001
|
+
allow?: string[];
|
|
1002
|
+
deny?: string[];
|
|
1003
|
+
llmAllowlist?: string[];
|
|
1004
|
+
load?: {
|
|
1005
|
+
paths?: string[];
|
|
1006
|
+
};
|
|
1007
|
+
entries?: Record<string, PluginEntryConfig>;
|
|
1008
|
+
slots?: Partial<Record<PluginKind, string>>;
|
|
1009
|
+
};
|
|
1010
|
+
type NormalizedPluginsConfig = {
|
|
1011
|
+
enabled: boolean;
|
|
1012
|
+
allow: string[];
|
|
1013
|
+
deny: string[];
|
|
1014
|
+
loadPaths: string[];
|
|
1015
|
+
entries: Record<string, PluginEntryConfig>;
|
|
1016
|
+
slots: Partial<Record<PluginKind, string>>;
|
|
1017
|
+
};
|
|
1018
|
+
type PluginsConfigValidationResult = {
|
|
1019
|
+
ok: boolean;
|
|
1020
|
+
diagnostics: PluginDiagnostic[];
|
|
1021
|
+
};
|
|
1022
|
+
declare function normalizePluginsConfig(input?: PluginsConfig): NormalizedPluginsConfig;
|
|
1023
|
+
declare function validatePluginsConfig(params: {
|
|
1024
|
+
config: NormalizedPluginsConfig;
|
|
1025
|
+
registry: PluginManifestRegistry;
|
|
1026
|
+
}): PluginsConfigValidationResult;
|
|
1027
|
+
//#endregion
|
|
564
1028
|
//#region src/agents/definitions.d.ts
|
|
565
1029
|
declare const SYSTEM_AGENTS_DIR = "/aimax/agents";
|
|
566
1030
|
type AgentConfigSource = "system" | "user" | "project";
|
|
@@ -810,265 +1274,27 @@ type ToolResultEntry = {
|
|
|
810
1274
|
role: "tool_result"; /** Matches AssistantEntry.toolCalls[].id */
|
|
811
1275
|
toolCallId: string;
|
|
812
1276
|
toolName: string; /** Text output of the tool */
|
|
813
|
-
content: string;
|
|
814
|
-
isError: boolean;
|
|
815
|
-
toolResultRef?: ToolResultReference;
|
|
816
|
-
timestamp: string;
|
|
817
|
-
source?: "cron";
|
|
818
|
-
};
|
|
819
|
-
/**
|
|
820
|
-
* A compaction record written after LLM-based history summarisation.
|
|
821
|
-
* `content` holds the summary text so it is accessible via the common
|
|
822
|
-
* `.content` property without narrowing on `role`.
|
|
823
|
-
*/
|
|
824
|
-
type CompactionEntry = {
|
|
825
|
-
role: "compaction"; /** Summary of the dropped conversation history */
|
|
826
|
-
content: string;
|
|
827
|
-
keptCount: number;
|
|
828
|
-
droppedCount: number;
|
|
829
|
-
timestamp: string;
|
|
830
|
-
source?: "cron";
|
|
831
|
-
};
|
|
832
|
-
/** Union of all persisted transcript entry types */
|
|
833
|
-
type TranscriptEntry = UserEntry | AssistantEntry | ToolResultEntry | CompactionEntry;
|
|
834
|
-
//#endregion
|
|
835
|
-
//#region src/subagent/types.d.ts
|
|
836
|
-
/** Status of a spawned subagent run */
|
|
837
|
-
type SubagentStatus = "running" | "done" | "error" | "killed";
|
|
838
|
-
/** Record tracking a single subagent run */
|
|
839
|
-
type SubagentRunRecord = {
|
|
840
|
-
runId: string;
|
|
841
|
-
childSessionId: string;
|
|
842
|
-
parentSessionId: string;
|
|
843
|
-
task: string;
|
|
844
|
-
label?: string; /** Nesting depth: parent is depth N, child is N+1 */
|
|
845
|
-
depth: number;
|
|
846
|
-
status: SubagentStatus;
|
|
847
|
-
result?: string;
|
|
848
|
-
error?: string;
|
|
849
|
-
startedAt: number;
|
|
850
|
-
endedAt?: number; /** Used to cancel the subagent run */
|
|
851
|
-
abortController: AbortController;
|
|
852
|
-
};
|
|
853
|
-
//#endregion
|
|
854
|
-
//#region src/subagent/registry.d.ts
|
|
855
|
-
declare const MAX_SUBAGENT_DEPTH = 2;
|
|
856
|
-
declare const MAX_CHILDREN_PER_SESSION = 5;
|
|
857
|
-
/**
|
|
858
|
-
* In-memory registry for subagent runs scoped to a single parent runAgent call.
|
|
859
|
-
* Child spawns create their own SubagentRegistry instances for their children.
|
|
860
|
-
*/
|
|
861
|
-
declare class SubagentRegistry {
|
|
862
|
-
private readonly entries;
|
|
863
|
-
/** RunIds whose terminal result has already been delivered to the parent. */
|
|
864
|
-
private readonly announced;
|
|
865
|
-
register(record: SubagentRunRecord, promise: Promise<void>): void;
|
|
866
|
-
complete(runId: string, result: string): void;
|
|
867
|
-
fail(runId: string, error: string): void;
|
|
868
|
-
/** Aborts and marks a specific run as killed. Returns false if not found or already ended. */
|
|
869
|
-
kill(runId: string): boolean;
|
|
870
|
-
/** Aborts all running subagents for the given parent session. Returns count killed. */
|
|
871
|
-
killAll(parentSessionId: string): number;
|
|
872
|
-
/** Lists all runs registered for the given parent session. */
|
|
873
|
-
list(parentSessionId: string): SubagentRunRecord[];
|
|
874
|
-
/** Returns true if any subagents for this session are still running. */
|
|
875
|
-
hasPending(parentSessionId: string): boolean;
|
|
876
|
-
/** Count of currently running children for a session. */
|
|
877
|
-
countActive(parentSessionId: string): number;
|
|
878
|
-
/**
|
|
879
|
-
* Waits until all currently-running subagents for the given session settle.
|
|
880
|
-
* Returns immediately if nothing is pending.
|
|
881
|
-
*/
|
|
882
|
-
waitForAll(parentSessionId: string): Promise<void>;
|
|
883
|
-
/**
|
|
884
|
-
* Returns all finished runs whose terminal result has not yet been delivered.
|
|
885
|
-
* This is a read-only snapshot; callers must explicitly mark delivery after
|
|
886
|
-
* the result has been handed back to the parent.
|
|
887
|
-
*/
|
|
888
|
-
peekCompleted(parentSessionId: string): SubagentRunRecord[];
|
|
889
|
-
/**
|
|
890
|
-
* Returns all finished runs that have not yet been returned by this method,
|
|
891
|
-
* and marks them as announced so they are not returned again.
|
|
892
|
-
*/
|
|
893
|
-
consumeCompleted(parentSessionId: string): SubagentRunRecord[];
|
|
894
|
-
/** Marks a finished run as already delivered to its parent. */
|
|
895
|
-
markAnnounced(runId: string | string[]): void;
|
|
896
|
-
/** Returns whether a run's terminal result has already been delivered. */
|
|
897
|
-
isAnnounced(runId: string): boolean;
|
|
898
|
-
/** Returns true if there are completed runs not yet returned by consumeCompleted. */
|
|
899
|
-
hasUnannounced(parentSessionId: string): boolean;
|
|
900
|
-
/**
|
|
901
|
-
* Returns true if the announce loop should run another iteration:
|
|
902
|
-
* either subagents are still running, or completed runs await announcement.
|
|
903
|
-
*/
|
|
904
|
-
needsAnnounce(parentSessionId: string): boolean;
|
|
905
|
-
/** Checks whether a new child can be spawned given depth and active-children limits. */
|
|
906
|
-
checkSpawnAllowed(parentSessionId: string, depth: number): {
|
|
907
|
-
allowed: true;
|
|
908
|
-
} | {
|
|
909
|
-
allowed: false;
|
|
910
|
-
reason: string;
|
|
911
|
-
};
|
|
912
|
-
/** Returns the current status snapshot for a single run, or null if not found. */
|
|
913
|
-
getStatus(runId: string): SubagentStatus | null;
|
|
914
|
-
private logTerminalStatus;
|
|
915
|
-
}
|
|
916
|
-
//#endregion
|
|
917
|
-
//#region src/plugins/hooks.d.ts
|
|
918
|
-
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" | "dream_gate" | "memory_changed";
|
|
919
|
-
type PluginHookAgentContext = {
|
|
920
|
-
agentId?: string;
|
|
921
|
-
sessionId?: string;
|
|
922
|
-
workspaceDir?: string;
|
|
923
|
-
channel?: AgentRunParams["channel"];
|
|
924
|
-
};
|
|
925
|
-
type PluginExecutionRuntime = {
|
|
926
|
-
eventDispatcher: {
|
|
927
|
-
dispatchProgress: (sessionId: string, event: AgentProgressEvent$1) => Promise<void>;
|
|
928
|
-
};
|
|
929
|
-
};
|
|
930
|
-
type PluginHookBeforeModelResolveEvent = {
|
|
931
|
-
prompt: string;
|
|
932
|
-
};
|
|
933
|
-
type PluginHookBeforeModelResolveResult = {
|
|
934
|
-
modelOverride?: string;
|
|
935
|
-
};
|
|
936
|
-
type PluginHookBeforePromptBuildEvent = {
|
|
937
|
-
prompt: string;
|
|
938
|
-
};
|
|
939
|
-
type PluginHookBeforePromptBuildResult = {
|
|
940
|
-
systemPrompt?: string;
|
|
941
|
-
prependContext?: string;
|
|
942
|
-
};
|
|
943
|
-
type PluginHookAfterPromptBuildEvent = {
|
|
944
|
-
prompt: string;
|
|
945
|
-
systemPrompt: string;
|
|
946
|
-
};
|
|
947
|
-
type PluginHookLlmInputEvent = {
|
|
948
|
-
sessionId: string;
|
|
949
|
-
model: string;
|
|
950
|
-
prompt: string;
|
|
951
|
-
historyMessages: unknown[];
|
|
952
|
-
};
|
|
953
|
-
type PluginHookAssistantMessageEndEvent = {
|
|
954
|
-
sessionId: string;
|
|
955
|
-
model: string;
|
|
956
|
-
assistantText: string;
|
|
957
|
-
assistantMessage: AssistantMessage;
|
|
958
|
-
hasToolCalls: boolean;
|
|
959
|
-
durationMs?: number;
|
|
960
|
-
usage?: {
|
|
961
|
-
input?: number;
|
|
962
|
-
output?: number;
|
|
963
|
-
total?: number;
|
|
964
|
-
};
|
|
965
|
-
};
|
|
966
|
-
type PluginHookLlmOutputEvent = {
|
|
967
|
-
sessionId: string;
|
|
968
|
-
model: string;
|
|
969
|
-
assistantTexts: string[];
|
|
970
|
-
lastAssistant?: AssistantMessage;
|
|
971
|
-
durationMs?: number;
|
|
972
|
-
usage?: {
|
|
973
|
-
input?: number;
|
|
974
|
-
output?: number;
|
|
975
|
-
total?: number;
|
|
976
|
-
};
|
|
977
|
-
};
|
|
978
|
-
type PluginHookBeforeToolCallEvent = {
|
|
979
|
-
toolCallId: string;
|
|
980
|
-
toolName: string;
|
|
981
|
-
params: Record<string, unknown>;
|
|
982
|
-
};
|
|
983
|
-
type PluginHookBeforeToolCallResult = {
|
|
984
|
-
params?: Record<string, unknown>;
|
|
985
|
-
block?: boolean;
|
|
986
|
-
blockReason?: string;
|
|
987
|
-
};
|
|
988
|
-
type PluginHookAfterToolCallEvent = {
|
|
989
|
-
toolCallId: string;
|
|
990
|
-
toolName: string;
|
|
991
|
-
params: Record<string, unknown>;
|
|
992
|
-
result?: unknown;
|
|
993
|
-
error?: string;
|
|
994
|
-
durationMs?: number;
|
|
995
|
-
};
|
|
996
|
-
type PluginHookAgentEndEvent = {
|
|
997
|
-
success: boolean;
|
|
998
|
-
error?: string;
|
|
999
|
-
durationMs?: number;
|
|
1000
|
-
};
|
|
1001
|
-
type PluginHookBeforeCompactionEvent = {
|
|
1002
|
-
messageCount: number;
|
|
1003
|
-
compactingCount?: number;
|
|
1004
|
-
};
|
|
1005
|
-
type PluginHookBeforeCompactionResult = {
|
|
1006
|
-
skipPersist?: boolean;
|
|
1007
|
-
injectRecall?: string;
|
|
1008
|
-
};
|
|
1009
|
-
type PluginHookAfterCompactionEvent = {
|
|
1010
|
-
messageCount: number;
|
|
1011
|
-
compactedCount: number;
|
|
1012
|
-
};
|
|
1013
|
-
type PluginHookSessionStartEvent = {
|
|
1014
|
-
sessionId: string;
|
|
1015
|
-
};
|
|
1016
|
-
type PluginHookSessionEndEvent = {
|
|
1017
|
-
sessionId: string;
|
|
1018
|
-
messageCount: number;
|
|
1019
|
-
durationMs?: number;
|
|
1020
|
-
};
|
|
1021
|
-
type PluginHookSessionResetEvent = {
|
|
1022
|
-
action: "new" | "reset";
|
|
1023
|
-
sessionId: string;
|
|
1024
|
-
previousSessionId?: string;
|
|
1025
|
-
message: string;
|
|
1026
|
-
};
|
|
1027
|
-
type PluginHookDreamGateEvent = {
|
|
1028
|
-
dataDir: string;
|
|
1029
|
-
memoryDir: string;
|
|
1030
|
-
providerId: string;
|
|
1031
|
-
pluginId?: string;
|
|
1032
|
-
trigger: "cli" | "cron";
|
|
1033
|
-
dryRun?: boolean;
|
|
1034
|
-
};
|
|
1035
|
-
type PluginHookDreamGateResult = {
|
|
1036
|
-
handled?: boolean;
|
|
1037
|
-
status?: "noop" | "completed" | "queued" | "failed";
|
|
1038
|
-
summary?: string;
|
|
1039
|
-
details?: Record<string, unknown>;
|
|
1040
|
-
};
|
|
1041
|
-
type PluginHookMemoryChangedEvent = MemoryChangedEvent;
|
|
1042
|
-
type PluginHookHandlerMap = {
|
|
1043
|
-
before_model_resolve: (event: PluginHookBeforeModelResolveEvent, ctx: PluginHookAgentContext) => PluginHookBeforeModelResolveResult | void | Promise<PluginHookBeforeModelResolveResult | void>;
|
|
1044
|
-
before_prompt_build: (event: PluginHookBeforePromptBuildEvent, ctx: PluginHookAgentContext) => PluginHookBeforePromptBuildResult | void | Promise<PluginHookBeforePromptBuildResult | void>;
|
|
1045
|
-
after_prompt_build: (event: PluginHookAfterPromptBuildEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
|
|
1046
|
-
llm_input: (event: PluginHookLlmInputEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
|
|
1047
|
-
assistant_message_end: (event: PluginHookAssistantMessageEndEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
|
|
1048
|
-
llm_output: (event: PluginHookLlmOutputEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
|
|
1049
|
-
before_tool_call: (event: PluginHookBeforeToolCallEvent, ctx: PluginHookAgentContext) => PluginHookBeforeToolCallResult | void | Promise<PluginHookBeforeToolCallResult | void>;
|
|
1050
|
-
after_tool_call: (event: PluginHookAfterToolCallEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
|
|
1051
|
-
agent_end: (event: PluginHookAgentEndEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
|
|
1052
|
-
before_compaction: (event: PluginHookBeforeCompactionEvent, ctx: PluginHookAgentContext) => PluginHookBeforeCompactionResult | void | Promise<PluginHookBeforeCompactionResult | void>;
|
|
1053
|
-
after_compaction: (event: PluginHookAfterCompactionEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
|
|
1054
|
-
session_start: (event: PluginHookSessionStartEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
|
|
1055
|
-
session_end: (event: PluginHookSessionEndEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
|
|
1056
|
-
session_reset: (event: PluginHookSessionResetEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
|
|
1057
|
-
dream_gate: (event: PluginHookDreamGateEvent, ctx: PluginHookAgentContext) => PluginHookDreamGateResult | void | Promise<PluginHookDreamGateResult | void>;
|
|
1058
|
-
memory_changed: (event: PluginHookMemoryChangedEvent, ctx: PluginHookAgentContext) => void | Promise<void>;
|
|
1277
|
+
content: string;
|
|
1278
|
+
isError: boolean;
|
|
1279
|
+
toolResultRef?: ToolResultReference;
|
|
1280
|
+
timestamp: string;
|
|
1281
|
+
source?: "cron";
|
|
1059
1282
|
};
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1283
|
+
/**
|
|
1284
|
+
* A compaction record written after LLM-based history summarisation.
|
|
1285
|
+
* `content` holds the summary text so it is accessible via the common
|
|
1286
|
+
* `.content` property without narrowing on `role`.
|
|
1287
|
+
*/
|
|
1288
|
+
type CompactionEntry = {
|
|
1289
|
+
role: "compaction"; /** Summary of the dropped conversation history */
|
|
1290
|
+
content: string;
|
|
1291
|
+
keptCount: number;
|
|
1292
|
+
droppedCount: number;
|
|
1293
|
+
timestamp: string;
|
|
1294
|
+
source?: "cron";
|
|
1066
1295
|
};
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
register<K extends PluginHookName>(registration: PluginHookRegistration<K>): void;
|
|
1070
|
-
dispatch<K extends PluginHookName>(hookName: K, event: Parameters<PluginHookHandlerMap[K]>[0], ctx: Parameters<PluginHookHandlerMap[K]>[1], runtime?: PluginExecutionRuntime): Promise<Array<Awaited<ReturnType<PluginHookHandlerMap[K]>>>>;
|
|
1071
|
-
}
|
|
1296
|
+
/** Union of all persisted transcript entry types */
|
|
1297
|
+
type TranscriptEntry = UserEntry | AssistantEntry | ToolResultEntry | CompactionEntry;
|
|
1072
1298
|
//#endregion
|
|
1073
1299
|
//#region src/runner/title.d.ts
|
|
1074
1300
|
type GenerateTitleParams = {
|
|
@@ -1100,155 +1326,6 @@ declare function appendSessionFile(filePath: string, line: string, encrypt?: boo
|
|
|
1100
1326
|
declare function atomicWriteSessionFile(filePath: string, content: string, encrypt?: boolean): Promise<void>;
|
|
1101
1327
|
declare function readSessionFileContent(filePath: string): Promise<string | null>;
|
|
1102
1328
|
//#endregion
|
|
1103
|
-
//#region src/context/session-context-store.d.ts
|
|
1104
|
-
type PersistedToolResult = {
|
|
1105
|
-
content: string;
|
|
1106
|
-
reference?: ToolResultReference;
|
|
1107
|
-
};
|
|
1108
|
-
type SessionContextStore = {
|
|
1109
|
-
findReusableRead(path: string, offset?: number, limit?: number): Promise<ReadStateRecord | null>;
|
|
1110
|
-
recordRead(params: {
|
|
1111
|
-
path: string;
|
|
1112
|
-
content: string;
|
|
1113
|
-
lineCount: number;
|
|
1114
|
-
offset?: number;
|
|
1115
|
-
limit?: number;
|
|
1116
|
-
}): Promise<ReadStateRecord>;
|
|
1117
|
-
invalidatePath(path: string): Promise<void>;
|
|
1118
|
-
persistToolResult(params: {
|
|
1119
|
-
toolCallId: string;
|
|
1120
|
-
toolName: string;
|
|
1121
|
-
content: string;
|
|
1122
|
-
thresholdChars?: number;
|
|
1123
|
-
previewChars?: number;
|
|
1124
|
-
}): Promise<PersistedToolResult>;
|
|
1125
|
-
recordSnip(record: SnipRecord): Promise<void>;
|
|
1126
|
-
recordCollapse(span: CollapseSpan): Promise<void>;
|
|
1127
|
-
setSessionMemory(snapshot: SessionMemorySnapshot): Promise<void>;
|
|
1128
|
-
recordModelUsage(checkpoint: ModelUsageCheckpoint): Promise<void>;
|
|
1129
|
-
recordAutocompactResult(params: {
|
|
1130
|
-
layer: "L6";
|
|
1131
|
-
failed: boolean;
|
|
1132
|
-
timestamp: string;
|
|
1133
|
-
}): Promise<void>;
|
|
1134
|
-
getSnapshot(): SessionContextSnapshot;
|
|
1135
|
-
};
|
|
1136
|
-
type SessionContextStoreOptions = {
|
|
1137
|
-
dataDir: string;
|
|
1138
|
-
sessionId: string;
|
|
1139
|
-
} & SessionPathOptions;
|
|
1140
|
-
declare function createSessionContextStore(options: SessionContextStoreOptions): Promise<SessionContextStore>;
|
|
1141
|
-
//#endregion
|
|
1142
|
-
//#region src/context/context-manager.d.ts
|
|
1143
|
-
type ManageLayeredHistoryParams = {
|
|
1144
|
-
entries: TranscriptEntry[];
|
|
1145
|
-
modelInfo: {
|
|
1146
|
-
model: string;
|
|
1147
|
-
api: string;
|
|
1148
|
-
};
|
|
1149
|
-
contextWindowTokens: number;
|
|
1150
|
-
llm: Pick<AgentRunParams["llm"], "apiFormat" | "baseUrl" | "apiKey" | "model" | "flashModel">;
|
|
1151
|
-
historyLimit?: number;
|
|
1152
|
-
compactionEnabled?: boolean;
|
|
1153
|
-
pendingUserMessage?: string;
|
|
1154
|
-
topicSegmentation?: TopicSegmentationConfig;
|
|
1155
|
-
signal?: AbortSignal;
|
|
1156
|
-
hooks?: PluginHookRegistry;
|
|
1157
|
-
hookCtx?: PluginHookAgentContext;
|
|
1158
|
-
contextStore?: SessionContextStore;
|
|
1159
|
-
dataDir?: string;
|
|
1160
|
-
sessionId?: string;
|
|
1161
|
-
sessionStoreName?: string;
|
|
1162
|
-
sessionPathScope?: Pick<SessionPathOptions, "subagent">;
|
|
1163
|
-
channel?: Channel$1;
|
|
1164
|
-
isSubagent?: boolean;
|
|
1165
|
-
};
|
|
1166
|
-
type ManageLayeredHistoryResult = {
|
|
1167
|
-
messages: AgentMessage[];
|
|
1168
|
-
priorSummary: string | undefined;
|
|
1169
|
-
compactionEntry: CompactionEntry | undefined;
|
|
1170
|
-
stats: {
|
|
1171
|
-
originalCount: number;
|
|
1172
|
-
keptCount: number;
|
|
1173
|
-
estimatedTokens: number;
|
|
1174
|
-
compacted: boolean;
|
|
1175
|
-
};
|
|
1176
|
-
compactionEvents: AgentProgressEvent$1[];
|
|
1177
|
-
};
|
|
1178
|
-
type ContextManager = {
|
|
1179
|
-
getReusableRead(path: string, offset?: number, limit?: number): Promise<{
|
|
1180
|
-
reused: boolean;
|
|
1181
|
-
lineCount?: number;
|
|
1182
|
-
}>;
|
|
1183
|
-
rememberRead(params: {
|
|
1184
|
-
path: string;
|
|
1185
|
-
content: string;
|
|
1186
|
-
lineCount: number;
|
|
1187
|
-
offset?: number;
|
|
1188
|
-
limit?: number;
|
|
1189
|
-
}): Promise<void>;
|
|
1190
|
-
invalidateReadPath(path: string): Promise<void>;
|
|
1191
|
-
persistToolResult(params: {
|
|
1192
|
-
toolCallId: string;
|
|
1193
|
-
toolName: string;
|
|
1194
|
-
content: string;
|
|
1195
|
-
thresholdChars?: number;
|
|
1196
|
-
previewChars?: number;
|
|
1197
|
-
}): Promise<PersistedToolResult>;
|
|
1198
|
-
recordModelUsage(params: {
|
|
1199
|
-
model: string;
|
|
1200
|
-
inputTokens: number;
|
|
1201
|
-
outputTokens: number;
|
|
1202
|
-
totalTokens: number;
|
|
1203
|
-
coveredTranscriptEntryCount: number;
|
|
1204
|
-
}): Promise<void>;
|
|
1205
|
-
manageHistory(params: Omit<ManageLayeredHistoryParams, "contextStore">): Promise<ManageLayeredHistoryResult>;
|
|
1206
|
-
getSnapshot: SessionContextStore["getSnapshot"];
|
|
1207
|
-
};
|
|
1208
|
-
declare function createContextManager(params: {
|
|
1209
|
-
dataDir: string;
|
|
1210
|
-
sessionId: string;
|
|
1211
|
-
sessionStoreName?: string;
|
|
1212
|
-
sessionPathScope?: Pick<SessionPathOptions, "subagent">;
|
|
1213
|
-
}): Promise<ContextManager>;
|
|
1214
|
-
//#endregion
|
|
1215
|
-
//#region src/bootstrap/bootstrap.d.ts
|
|
1216
|
-
/** Maximum characters per bootstrap file before truncation */
|
|
1217
|
-
declare const BOOTSTRAP_MAX_CHARS = 20000;
|
|
1218
|
-
/** Maximum total characters across all bootstrap files */
|
|
1219
|
-
declare const BOOTSTRAP_TOTAL_MAX_CHARS = 150000;
|
|
1220
|
-
/** Names of bootstrap identity files, in injection order */
|
|
1221
|
-
declare const BOOTSTRAP_FILE_NAMES: readonly ["AGENTS.md", "SOUL.md", "TOOLS.md", "IDENTITY.md", "USER.md", "MEMORY.md", "BOOTSTRAP.md"];
|
|
1222
|
-
/** A loaded (or missing) bootstrap file */
|
|
1223
|
-
type BootstrapFile = {
|
|
1224
|
-
name: string;
|
|
1225
|
-
path: string;
|
|
1226
|
-
content: string | null;
|
|
1227
|
-
missing: boolean;
|
|
1228
|
-
};
|
|
1229
|
-
/** A bootstrap file ready for system prompt injection */
|
|
1230
|
-
type BootstrapContextFile = {
|
|
1231
|
-
path: string;
|
|
1232
|
-
content: string;
|
|
1233
|
-
};
|
|
1234
|
-
/** Resolves the base .aimax directory within a data directory */
|
|
1235
|
-
declare function aimaxDir(dataDir: string): string;
|
|
1236
|
-
/**
|
|
1237
|
-
* Loads all standard bootstrap identity files from the .aimax directory.
|
|
1238
|
-
* Missing files are included as `missing: true` entries.
|
|
1239
|
-
* BOOTSTRAP.md is deleted after loading (one-time use).
|
|
1240
|
-
*/
|
|
1241
|
-
declare function loadBootstrapFiles(dataDir: string): Promise<BootstrapFile[]>;
|
|
1242
|
-
/**
|
|
1243
|
-
* Converts loaded bootstrap files into context file entries for system prompt injection.
|
|
1244
|
-
* Applies per-file and total character budget limits.
|
|
1245
|
-
*/
|
|
1246
|
-
declare function buildBootstrapContextFiles(files: BootstrapFile[], opts?: {
|
|
1247
|
-
maxChars?: number;
|
|
1248
|
-
totalMaxChars?: number;
|
|
1249
|
-
warn?: (message: string) => void;
|
|
1250
|
-
}): BootstrapContextFile[];
|
|
1251
|
-
//#endregion
|
|
1252
1329
|
//#region src/bootstrap/bootstrap-layout.d.ts
|
|
1253
1330
|
type BootstrapMountResult = {
|
|
1254
1331
|
dataDir: string;
|
|
@@ -1407,71 +1484,6 @@ declare function resetMemoryProviderRegistryForTests(): void;
|
|
|
1407
1484
|
//#region src/auto-skills/paths.d.ts
|
|
1408
1485
|
declare function autoSkillsDir(dataDir: string): string;
|
|
1409
1486
|
//#endregion
|
|
1410
|
-
//#region src/auto-skills/types.d.ts
|
|
1411
|
-
type AutoSkillSource = "auto";
|
|
1412
|
-
type AutoSkillStatus = "active" | "archived";
|
|
1413
|
-
type AutoSkillCategory = {
|
|
1414
|
-
path: string;
|
|
1415
|
-
name: string;
|
|
1416
|
-
description: string;
|
|
1417
|
-
createdBy?: string;
|
|
1418
|
-
};
|
|
1419
|
-
type AutoSkillIndexEntry = {
|
|
1420
|
-
skillId: string;
|
|
1421
|
-
name: string;
|
|
1422
|
-
description: string;
|
|
1423
|
-
categoryPath: string;
|
|
1424
|
-
source: AutoSkillSource;
|
|
1425
|
-
status: AutoSkillStatus;
|
|
1426
|
-
rootDir: string;
|
|
1427
|
-
skillDir: string;
|
|
1428
|
-
skillFile: string;
|
|
1429
|
-
metadataFile?: string;
|
|
1430
|
-
tags: string[];
|
|
1431
|
-
relatedSkills: string[];
|
|
1432
|
-
confidence?: number;
|
|
1433
|
-
createdAt?: string;
|
|
1434
|
-
updatedAt?: string;
|
|
1435
|
-
};
|
|
1436
|
-
type AutoSkillListItem = {
|
|
1437
|
-
skillId: string;
|
|
1438
|
-
name: string;
|
|
1439
|
-
description: string;
|
|
1440
|
-
categoryPath: string;
|
|
1441
|
-
source: AutoSkillSource;
|
|
1442
|
-
};
|
|
1443
|
-
type AutoSkillSearchResult = AutoSkillListItem & {
|
|
1444
|
-
score: number;
|
|
1445
|
-
};
|
|
1446
|
-
type AutoSkillViewResult = AutoSkillListItem & {
|
|
1447
|
-
status: AutoSkillStatus;
|
|
1448
|
-
content: string;
|
|
1449
|
-
path: string;
|
|
1450
|
-
skillDir: string;
|
|
1451
|
-
filePath?: string;
|
|
1452
|
-
tags?: string[];
|
|
1453
|
-
relatedSkills?: string[];
|
|
1454
|
-
};
|
|
1455
|
-
type AutoSkillsLoaderOptions = {
|
|
1456
|
-
dataDir?: string;
|
|
1457
|
-
rootDir?: string;
|
|
1458
|
-
includeArchived?: boolean;
|
|
1459
|
-
maxSkillBytes?: number;
|
|
1460
|
-
maxResourceBytes?: number;
|
|
1461
|
-
};
|
|
1462
|
-
type AutoSkillListOptions = {
|
|
1463
|
-
categoryPath?: string;
|
|
1464
|
-
recursive?: boolean;
|
|
1465
|
-
};
|
|
1466
|
-
type AutoSkillSearchOptions = {
|
|
1467
|
-
query: string;
|
|
1468
|
-
limit?: number;
|
|
1469
|
-
};
|
|
1470
|
-
type AutoSkillViewOptions = {
|
|
1471
|
-
skillId: string;
|
|
1472
|
-
filePath?: string;
|
|
1473
|
-
};
|
|
1474
|
-
//#endregion
|
|
1475
1487
|
//#region src/auto-skills/loader.d.ts
|
|
1476
1488
|
declare function createAutoSkillsLoader(options: AutoSkillsLoaderOptions): AutoSkillsLoader;
|
|
1477
1489
|
declare class AutoSkillsLoader {
|
|
@@ -1849,18 +1861,6 @@ declare function createMemoryUpdateTool(dataDir: string, options?: MemoryToolOpt
|
|
|
1849
1861
|
id: string;
|
|
1850
1862
|
}>;
|
|
1851
1863
|
//#endregion
|
|
1852
|
-
//#region src/runner/event-dispatcher.d.ts
|
|
1853
|
-
type EventDispatchParams = Pick<AgentRunParams, "onProgress" | "messageId" | "channel" | "subagentContext">;
|
|
1854
|
-
/**
|
|
1855
|
-
* Emits runner events to in-process listeners.
|
|
1856
|
-
*/
|
|
1857
|
-
declare class RunEventDispatcher {
|
|
1858
|
-
private readonly params;
|
|
1859
|
-
constructor(params: EventDispatchParams);
|
|
1860
|
-
dispatchProgress(sessionId: string, event: AgentProgressEvent$2): Promise<void>;
|
|
1861
|
-
dispatchDiagnostic(sessionId: string, event: Omit<AgentDiagnosticEvent, keyof AgentProgressEventBase | "type">): Promise<void>;
|
|
1862
|
-
}
|
|
1863
|
-
//#endregion
|
|
1864
1864
|
//#region src/tools/process-registry.d.ts
|
|
1865
1865
|
type ProcessStatus = "running" | "completed" | "failed" | "killed" | "timeout";
|
|
1866
1866
|
type ProcessSessionSnapshot = {
|