@robota-sdk/agent-sdk 3.0.0-beta.6 → 3.0.0-beta.60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,191 +1,1395 @@
1
- import { TTrustLevel, TPermissionMode, IAIProvider, TToolArgs, IToolWithEventService } from '@robota-sdk/agent-core';
2
- export { IContextTokenUsage, IContextWindowState, IHookInput, IPermissionLists, THookEvent, THooksConfig, TPermissionDecision, TPermissionMode, TRUST_TO_MODE, TToolArgs, TTrustLevel, evaluatePermission, runHooks } from '@robota-sdk/agent-core';
3
- import * as _robota_sdk_agent_tools from '@robota-sdk/agent-tools';
4
- export { TToolResult, bashTool, editTool, globTool, grepTool, readTool, writeTool } from '@robota-sdk/agent-tools';
5
- import { ITerminalOutput, SessionStore, TPermissionHandler, ISessionLogger, Session } from '@robota-sdk/agent-sessions';
6
- export { FileSessionLogger, ISessionLogger, ISessionOptions, ISessionRecord, ISpinner, ITerminalOutput, Session, SessionStore, SilentSessionLogger, TPermissionHandler, TPermissionResult, TSessionLogData } from '@robota-sdk/agent-sessions';
7
- import { z } from 'zod';
1
+ import { ICompactEvent, ITerminalOutput, ISessionLogger, TPermissionHandler, Session, SessionStore, FileSessionLogger } from '@robota-sdk/agent-sessions';
2
+ export { ICompactEvent, ISpinner, ITerminalOutput, TCompactTrigger } from '@robota-sdk/agent-sessions';
3
+ import { TUniversalValue, TSessionEndReason, TPermissionMode, IToolWithEventService, IContextWindowState, IProviderProfileConfig, IProviderDefinition, IProviderSetupStepDefinition, TProviderSetupField, IProviderProbeResult, TToolArgs, IHistoryEntry, THooksConfig, IAIProvider, IHookTypeExecutor, IHookDefinition, IHookInput, IHookResult, TTrustLevel, TUniversalMessage } from '@robota-sdk/agent-core';
4
+ export { IAIProvider, IContextTokenUsage, IContextWindowState, IHistoryEntry, IHookInput, IPermissionLists, THookEvent, THooksConfig, TPermissionDecision, TPermissionMode, TRUST_TO_MODE, TToolArgs, TTrustLevel, chatEntryToMessage, evaluatePermission, getMessagesForAPI, isChatEntry, messageToHistoryEntry, runHooks } from '@robota-sdk/agent-core';
5
+ import { IBackgroundTaskManager, TBackgroundTaskStatus, IBackgroundTaskError, IBackgroundTaskListFilter, IBackgroundTaskState, IBackgroundTaskLogCursor, IBackgroundTaskLogPage, TBackgroundTaskEvent, ISubagentRunner, IBackgroundTaskRunner, IBackgroundTaskInput, ISubagentJobState, TBackgroundTaskIsolation, ISubagentJobResult, ISubagentManager } from '@robota-sdk/agent-runtime';
6
+ export { BackgroundTaskError, BackgroundTaskManager, IAgentBackgroundTaskRequest, IBackgroundTaskError, IBackgroundTaskHandle, IBackgroundTaskInput, IBackgroundTaskListFilter, IBackgroundTaskLogCursor, IBackgroundTaskLogPage, IBackgroundTaskManager, IBackgroundTaskManagerOptions, IBackgroundTaskRequest, IBackgroundTaskResult, IBackgroundTaskRunner, IBackgroundTaskStart, IBackgroundTaskState, IBaseBackgroundTaskRequest, IPreparedSubagentWorktree, IProcessBackgroundTaskRequest, ISerializableProviderProfile, ISubagentJobHandle, ISubagentJobResult, ISubagentJobStart, ISubagentJobState, ISubagentManager, ISubagentManagerOptions, ISubagentRunner, ISubagentSpawnRequest, ISubagentWorktreeAdapter, ISubagentWorktreePrepareRequest, IWorktreeSubagentRunnerOptions, SubagentManager, TBackgroundPermissionPolicy, TBackgroundPrimitive, TBackgroundTaskErrorCategory, TBackgroundTaskEvent, TBackgroundTaskEventListener, TBackgroundTaskIdFactory, TBackgroundTaskIsolation, TBackgroundTaskKind, TBackgroundTaskMode, TBackgroundTaskRunnerEvent, TBackgroundTaskStatus, TBackgroundTaskTimeoutReason, TBackgroundTaskTransitionEvent, TSubagentJobMode, TSubagentJobStatus, WorktreeSubagentRunner, createWorktreeSubagentRunner, getBackgroundTaskTransitions, isTerminalBackgroundTaskStatus, transitionBackgroundTaskStatus } from '@robota-sdk/agent-runtime';
7
+ import { createZodFunctionTool } from '@robota-sdk/agent-tools';
8
+ export { TToolResult } from '@robota-sdk/agent-tools';
9
+
10
+ type TCapabilityKind = 'builtin-command' | 'skill' | 'agent' | 'tool';
11
+ type TCapabilitySafety = 'read-only' | 'write' | 'process' | 'network' | 'background-agent';
12
+ interface ICapabilityDescriptor {
13
+ readonly name: string;
14
+ readonly kind: TCapabilityKind;
15
+ readonly description: string;
16
+ readonly userInvocable: boolean;
17
+ readonly modelInvocable: boolean;
18
+ readonly argumentHint?: string;
19
+ readonly safety?: TCapabilitySafety;
20
+ }
21
+
22
+ /** A command entry */
23
+ interface ICommand {
24
+ /** Command name without slash (e.g., "mode") */
25
+ name: string;
26
+ /** Short description shown in autocomplete */
27
+ description: string;
28
+ /** Source identifier (e.g., "builtin", "skill") */
29
+ source: string;
30
+ /** Subcommands for hierarchical menus */
31
+ subcommands?: ICommand[];
32
+ /** Execute the command. Args is everything after the command name. */
33
+ execute?: (args: string) => void | Promise<void>;
34
+ /** Full SKILL.md content (only for skill commands) */
35
+ skillContent?: string;
36
+ /** Hint for the expected argument (Claude Code frontmatter) */
37
+ argumentHint?: string;
38
+ /** When true, models cannot invoke this skill autonomously */
39
+ disableModelInvocation?: boolean;
40
+ /** When true, models may invoke this command through the command execution tool */
41
+ modelInvocable?: boolean;
42
+ /** When false, users cannot invoke this skill directly */
43
+ userInvocable?: boolean;
44
+ /** Safety category for model-visible capability descriptors */
45
+ safety?: TCapabilitySafety;
46
+ /** List of tools this skill is allowed to use */
47
+ allowedTools?: string[];
48
+ /** Preferred model for executing this skill */
49
+ model?: string;
50
+ /** Effort level hint for the skill */
51
+ effort?: string;
52
+ /** Context scope for the skill (e.g., "project") */
53
+ context?: string;
54
+ /** Agent identity to use when executing this skill */
55
+ agent?: string;
56
+ /** Plugin installation directory (plugin skills/commands only) */
57
+ pluginDir?: string;
58
+ }
59
+ /** A source that provides commands */
60
+ interface ICommandSource {
61
+ name: string;
62
+ getCommands(): ICommand[];
63
+ }
64
+
65
+ declare const STATUSLINE_COMMAND_DESCRIPTION = "Configure TUI status-line visibility and fields such as model, context, tokens, session, and git branch.";
66
+ declare const STATUSLINE_COMMAND_ARGUMENT_HINT = "on | off | reset | git on | git off";
67
+ interface IStatusLineCommandSettings {
68
+ enabled: boolean;
69
+ gitBranch: boolean;
70
+ }
71
+ type TStatusLineCommandSettingsPatch = Partial<IStatusLineCommandSettings> & Record<string, TUniversalValue>;
72
+ declare const DEFAULT_STATUS_LINE_COMMAND_SETTINGS: Readonly<IStatusLineCommandSettings>;
73
+ declare function buildStatusLineCommandSubcommands(source?: string): ICommand[];
74
+ declare function isStatusLineCommandSettingsPatch(value: Record<string, TUniversalValue>): value is TStatusLineCommandSettingsPatch;
75
+
76
+ type TCommandEffect = {
77
+ type: 'model-change-requested';
78
+ modelId: string;
79
+ } | {
80
+ type: 'language-change-requested';
81
+ language: string;
82
+ } | {
83
+ type: 'settings-reset-requested';
84
+ } | {
85
+ type: 'session-exit-requested';
86
+ reason?: TSessionEndReason;
87
+ message?: string;
88
+ } | {
89
+ type: 'session-restart-requested';
90
+ reason: TSessionEndReason;
91
+ message: string;
92
+ } | {
93
+ type: 'plugin-tui-requested';
94
+ } | {
95
+ type: 'plugin-registry-reload-requested';
96
+ } | {
97
+ type: 'session-picker-requested';
98
+ } | {
99
+ type: 'session-renamed';
100
+ name: string;
101
+ } | {
102
+ type: 'conversation-history-cleared';
103
+ } | {
104
+ type: 'statusline-settings-patch';
105
+ patch: TStatusLineCommandSettingsPatch;
106
+ };
107
+
108
+ /** Choice option for command-owned follow-up prompts. */
109
+ interface ICommandChoicePromptOption {
110
+ value: string;
111
+ label: string;
112
+ }
113
+ /** Generic prompt descriptor rendered by host UIs for command interactions. */
114
+ type TCommandInteractionPrompt = {
115
+ kind: 'choice';
116
+ title: string;
117
+ options: readonly ICommandChoicePromptOption[];
118
+ maxVisible?: number;
119
+ } | {
120
+ kind: 'text';
121
+ title: string;
122
+ placeholder?: string;
123
+ allowEmpty?: boolean;
124
+ masked?: boolean;
125
+ validate?: (value: string) => string | undefined;
126
+ };
127
+ /** Stateful command continuation owned by the command module. */
128
+ interface ICommandInteraction {
129
+ prompt: TCommandInteractionPrompt;
130
+ submit(value: string): Promise<ICommandResult> | ICommandResult;
131
+ cancel?(): Promise<ICommandResult> | ICommandResult;
132
+ }
133
+
134
+ type TCommandResultDataValue = TUniversalValue | object | readonly object[];
135
+ /** Result of a system command execution. */
136
+ interface ICommandResult {
137
+ /** Human-readable output message */
138
+ message: string;
139
+ /** Command completed successfully */
140
+ success: boolean;
141
+ /** Additional structured data (command-specific diagnostics only) */
142
+ data?: Record<string, TCommandResultDataValue>;
143
+ /** Typed host effects requested by the command */
144
+ effects?: readonly TCommandEffect[];
145
+ /** Command-owned follow-up prompt and continuation */
146
+ interaction?: ICommandInteraction;
147
+ }
148
+
149
+ type TBackgroundJobWaitPolicy = 'detached' | 'wait_all' | 'wait_any' | 'manual';
150
+ type TBackgroundJobGroupStatus = 'running' | 'completed';
151
+ interface IBackgroundJobResultEnvelope {
152
+ taskId: string;
153
+ label: string;
154
+ status: TBackgroundTaskStatus;
155
+ summary?: string;
156
+ outputRef?: string;
157
+ error?: IBackgroundTaskError;
158
+ startedAt?: string;
159
+ completedAt?: string;
160
+ }
161
+ interface IBackgroundJobGroupState {
162
+ id: string;
163
+ parentSessionId: string;
164
+ waitPolicy: TBackgroundJobWaitPolicy;
165
+ taskIds: string[];
166
+ status: TBackgroundJobGroupStatus;
167
+ createdAt: string;
168
+ updatedAt: string;
169
+ label?: string;
170
+ completedAt?: string;
171
+ results: IBackgroundJobResultEnvelope[];
172
+ }
173
+ interface IBackgroundJobGroupSummary {
174
+ groupId: string;
175
+ status: TBackgroundJobGroupStatus;
176
+ total: number;
177
+ completed: number;
178
+ failed: number;
179
+ cancelled: number;
180
+ pending: number;
181
+ lines: string[];
182
+ }
183
+ interface IBackgroundJobGroupCreateRequest {
184
+ parentSessionId: string;
185
+ waitPolicy: TBackgroundJobWaitPolicy;
186
+ taskIds: string[];
187
+ label?: string;
188
+ }
189
+ type TBackgroundJobGroupEvent = {
190
+ type: 'background_job_group_created';
191
+ group: IBackgroundJobGroupState;
192
+ } | {
193
+ type: 'background_job_group_updated';
194
+ group: IBackgroundJobGroupState;
195
+ } | {
196
+ type: 'background_job_group_completed';
197
+ group: IBackgroundJobGroupState;
198
+ };
199
+ type TBackgroundJobGroupEventListener = (event: TBackgroundJobGroupEvent) => void;
200
+ type TBackgroundJobGroupIdFactory = (request: IBackgroundJobGroupCreateRequest) => string;
201
+ interface IBackgroundJobOrchestratorOptions {
202
+ manager: IBackgroundTaskManager;
203
+ now?: () => string;
204
+ idFactory?: TBackgroundJobGroupIdFactory;
205
+ initialGroups?: readonly IBackgroundJobGroupState[];
206
+ }
207
+ declare class BackgroundJobOrchestrator {
208
+ private readonly manager;
209
+ private readonly now;
210
+ private readonly idFactory;
211
+ private readonly unsubscribeManager;
212
+ private readonly listeners;
213
+ private readonly groups;
214
+ private sequence;
215
+ constructor(options: IBackgroundJobOrchestratorOptions);
216
+ createGroup(request: IBackgroundJobGroupCreateRequest): IBackgroundJobGroupState;
217
+ listGroups(): IBackgroundJobGroupState[];
218
+ getGroup(groupId: string): IBackgroundJobGroupState | undefined;
219
+ waitGroup(groupId: string): Promise<IBackgroundJobGroupState>;
220
+ subscribe(listener: TBackgroundJobGroupEventListener): () => void;
221
+ dispose(): void;
222
+ private nextGroupId;
223
+ private restoreGroup;
224
+ private createRecord;
225
+ private captureExistingTerminalTasks;
226
+ private handleTaskEvent;
227
+ private captureTask;
228
+ private evaluateCompletion;
229
+ private emit;
230
+ }
231
+ declare function summarizeBackgroundJobGroup(group: IBackgroundJobGroupState): IBackgroundJobGroupSummary;
232
+
233
+ declare const PLUGIN_COMMAND_DESCRIPTION = "Manage plugins";
234
+ declare const PLUGIN_COMMAND_ARGUMENT_HINT = "manage | install <name@marketplace> | uninstall <name@marketplace> | enable <name@marketplace> | disable <name@marketplace> | marketplace <action>";
235
+ declare const RELOAD_PLUGINS_COMMAND_DESCRIPTION = "Reload all plugin resources";
236
+ type TPluginInstallScope = 'user' | 'project';
237
+ interface ICommandInstalledPlugin {
238
+ name: string;
239
+ description: string;
240
+ enabled: boolean;
241
+ }
242
+ interface ICommandAvailablePlugin {
243
+ name: string;
244
+ description: string;
245
+ installed: boolean;
246
+ }
247
+ interface ICommandMarketplaceSource {
248
+ name: string;
249
+ type: string;
250
+ }
251
+ interface ICommandPluginReloadResult {
252
+ loadedPluginCount: number;
253
+ }
254
+ interface ICommandPluginAdapter {
255
+ listInstalled(): Promise<readonly ICommandInstalledPlugin[]>;
256
+ listAvailablePlugins(marketplace: string): Promise<readonly ICommandAvailablePlugin[]>;
257
+ install(pluginId: string, scope?: TPluginInstallScope): Promise<void>;
258
+ uninstall(pluginId: string): Promise<void>;
259
+ enable(pluginId: string): Promise<void>;
260
+ disable(pluginId: string): Promise<void>;
261
+ marketplaceAdd(source: string): Promise<string>;
262
+ marketplaceRemove(name: string): Promise<void>;
263
+ marketplaceUpdate(name: string): Promise<void>;
264
+ marketplaceList(): Promise<readonly ICommandMarketplaceSource[]>;
265
+ reloadPlugins(): Promise<ICommandPluginReloadResult>;
266
+ }
267
+ declare function createPluginTuiRequestedEffect(): TCommandEffect;
268
+ declare function createPluginRegistryReloadRequestedEffect(): TCommandEffect;
269
+ declare function resolvePluginCommandAdapter(context: ICommandHostContext): ICommandPluginAdapter | undefined;
270
+ declare function buildPluginCommandSubcommands(): ICommand[];
271
+
272
+ interface ICommandSettingsDocument {
273
+ [key: string]: TUniversalValue;
274
+ }
275
+ interface ICommandSettingsAdapter<TSettings extends ICommandSettingsDocument = ICommandSettingsDocument> {
276
+ read(): TSettings;
277
+ write(settings: TSettings): void;
278
+ }
279
+ interface ICommandProcessAdapter {
280
+ requestExit(reason?: TSessionEndReason): void;
281
+ requestRestart(reason: TSessionEndReason, message: string): void;
282
+ }
283
+ interface ICommandPickerAdapter<TItem extends ICommandSettingsDocument> {
284
+ pick(items: readonly TItem[]): Promise<TItem | undefined> | TItem | undefined;
285
+ }
286
+ interface ICommandPermissionModeAdapter {
287
+ getPermissionMode(): TPermissionMode;
288
+ setPermissionMode(mode: TPermissionMode): void;
289
+ listSessionAllowedTools(): readonly string[];
290
+ }
291
+ interface ICommandHostAdapters {
292
+ settings?: ICommandSettingsAdapter;
293
+ process?: ICommandProcessAdapter;
294
+ permissionMode?: ICommandPermissionModeAdapter;
295
+ plugin?: ICommandPluginAdapter;
296
+ }
297
+
298
+ interface IEditCheckpointRecorder {
299
+ captureFile(filePath: string): Promise<void> | void;
300
+ }
301
+ interface IEditCheckpointTurnInput {
302
+ sessionId: string;
303
+ prompt: string;
304
+ }
305
+ interface IEditCheckpointSummary {
306
+ id: string;
307
+ sessionId: string;
308
+ sequence: number;
309
+ prompt: string;
310
+ createdAt: string;
311
+ fileCount: number;
312
+ }
313
+ interface IEditCheckpointFileRecord {
314
+ originalPath: string;
315
+ existed: boolean;
316
+ snapshotFile?: string;
317
+ }
318
+ interface IEditCheckpointManifest extends IEditCheckpointSummary {
319
+ version: 1;
320
+ files: IEditCheckpointFileRecord[];
321
+ }
322
+ type TEditCheckpointFileRestoreAction = 'restore-preimage' | 'delete-created-file';
323
+ interface IEditCheckpointFileInspection {
324
+ originalPath: string;
325
+ relativePath: string;
326
+ existed: boolean;
327
+ restoreAction: TEditCheckpointFileRestoreAction;
328
+ snapshotAvailable: boolean;
329
+ snapshotSizeBytes?: number;
330
+ }
331
+ interface IEditCheckpointInspectionPlan {
332
+ checkpointIds: string[];
333
+ fileCount: number;
334
+ }
335
+ interface IEditCheckpointInspection {
336
+ target: IEditCheckpointSummary;
337
+ capturedFiles: IEditCheckpointFileInspection[];
338
+ restoreToCheckpoint: IEditCheckpointInspectionPlan;
339
+ rollbackThroughCheckpoint: IEditCheckpointInspectionPlan;
340
+ }
341
+ interface IEditCheckpointRestoreResult {
342
+ target: IEditCheckpointSummary;
343
+ restoredCheckpointCount: number;
344
+ restoredFileCount: number;
345
+ removedCheckpointCount: number;
346
+ }
347
+
348
+ interface IEditCheckpointStoreOptions {
349
+ cwd: string;
350
+ now?: () => Date;
351
+ }
352
+ declare class EditCheckpointStore {
353
+ private readonly cwd;
354
+ private readonly rootDir;
355
+ private readonly now;
356
+ private activeTurn;
357
+ constructor(options: IEditCheckpointStoreOptions);
358
+ beginTurn(input: IEditCheckpointTurnInput): Promise<IEditCheckpointSummary>;
359
+ captureFile(filePath: string): Promise<void>;
360
+ finalizeTurn(): Promise<IEditCheckpointSummary | undefined>;
361
+ list(sessionId: string): IEditCheckpointSummary[];
362
+ inspect(sessionId: string, checkpointId: string): IEditCheckpointInspection;
363
+ restoreToCheckpoint(sessionId: string, checkpointId: string): Promise<IEditCheckpointRestoreResult>;
364
+ rollbackThroughCheckpoint(sessionId: string, checkpointId: string): Promise<IEditCheckpointRestoreResult>;
365
+ private createFileRecord;
366
+ private restoreFile;
367
+ private loadManifests;
368
+ private nextSequence;
369
+ private writeManifest;
370
+ private sessionDir;
371
+ private checkpointDir;
372
+ }
373
+
374
+ declare function wrapEditCheckpointTools(tools: readonly IToolWithEventService[], recorder: IEditCheckpointRecorder): IToolWithEventService[];
375
+
376
+ declare const MEMORY_INDEX_MAX_LINES = 200;
377
+ declare const MEMORY_INDEX_MAX_BYTES: number;
378
+ type TMemoryType = 'user' | 'feedback' | 'project' | 'reference';
379
+ interface IStartupMemory {
380
+ content: string;
381
+ path: string;
382
+ lineCount: number;
383
+ truncated: boolean;
384
+ }
385
+ interface IMemoryTopicSummary {
386
+ name: string;
387
+ path: string;
388
+ }
389
+ interface IProjectMemorySummary {
390
+ indexPath: string;
391
+ topicsPath: string;
392
+ topics: IMemoryTopicSummary[];
393
+ }
394
+ interface IAppendMemoryInput {
395
+ type: TMemoryType;
396
+ topic: string;
397
+ text: string;
398
+ }
399
+ interface IAppendMemoryResult {
400
+ indexPath: string;
401
+ topicPath: string;
402
+ topic: string;
403
+ deduplicated: boolean;
404
+ }
405
+ declare function isMemoryType(value: string): value is TMemoryType;
406
+ declare class ProjectMemoryStore {
407
+ private readonly cwd;
408
+ private readonly now;
409
+ constructor(cwd: string, now?: () => Date);
410
+ getIndexPath(): string;
411
+ getTopicsPath(): string;
412
+ loadStartupMemory(): IStartupMemory;
413
+ list(): IProjectMemorySummary;
414
+ readTopic(topic: string): string;
415
+ append(input: IAppendMemoryInput): IAppendMemoryResult;
416
+ }
417
+
418
+ type TMemoryCandidateStatus = 'pending' | 'approved' | 'rejected' | 'saved' | 'skipped';
419
+ interface IMemoryCandidate {
420
+ id: string;
421
+ type: TMemoryType;
422
+ topic: string;
423
+ text: string;
424
+ sourceMessageIds: string[];
425
+ confidence: number;
426
+ createdAt: string;
427
+ reason: string;
428
+ }
429
+ interface IMemoryPendingRecord extends IMemoryCandidate {
430
+ status: TMemoryCandidateStatus;
431
+ updatedAt: string;
432
+ decisionReason?: string;
433
+ }
434
+ interface IMemoryReference {
435
+ topic: string;
436
+ path: string;
437
+ score: number;
438
+ truncated: boolean;
439
+ }
440
+ interface IMemoryEvent {
441
+ type: 'memory_candidate_extracted' | 'memory_candidate_queued' | 'memory_candidate_saved' | 'memory_candidate_skipped' | 'memory_candidate_approved' | 'memory_candidate_rejected' | 'memory_retrieved';
442
+ at: string;
443
+ candidateId?: string;
444
+ topic?: string;
445
+ reason?: string;
446
+ data?: Record<string, TUniversalValue>;
447
+ }
448
+
449
+ type TAutoCompactThreshold$1 = number | false;
450
+ declare const DEFAULT_AUTO_COMPACT_THRESHOLD = 0.835;
451
+ declare const AUTO_COMPACT_THRESHOLD_SETTINGS_KEY = "autoCompactThreshold";
452
+ interface ICompactContextResult {
453
+ before: IContextWindowState;
454
+ after: IContextWindowState;
455
+ }
456
+ /** Read context-window state through the command host facade. */
457
+ declare function readCommandContextState(context: ICommandHostContext): IContextWindowState;
458
+ /** Read the effective automatic compact policy through the command host facade. */
459
+ declare function readAutoCompactThreshold(context: ICommandHostContext): TAutoCompactThreshold$1;
460
+ /** Read the source of the effective automatic compact policy. */
461
+ declare function readAutoCompactThresholdSource(context: ICommandHostContext): TAutoCompactThresholdSource;
462
+ /** Update the active session's automatic compact policy through the command host facade. */
463
+ declare function setCommandAutoCompactThreshold(context: ICommandHostContext, threshold: TAutoCompactThreshold$1, source: TAutoCompactThresholdSource): void;
464
+ /** Persist an automatic compact policy value through the host settings adapter, when present. */
465
+ declare function writeAutoCompactThresholdSetting(context: ICommandHostContext, threshold: TAutoCompactThreshold$1): boolean;
466
+ /** Remove the persisted automatic compact policy through the host settings adapter, when present. */
467
+ declare function resetAutoCompactThresholdSetting(context: ICommandHostContext): boolean;
468
+ /** Run manual compaction through the command host facade and return before/after state. */
469
+ declare function compactCommandContext(context: ICommandHostContext, instructions?: string): Promise<ICompactContextResult>;
470
+
471
+ interface ICommandListEntry {
472
+ name: string;
473
+ description: string;
474
+ }
475
+ type TAutoCompactThresholdSource = 'default' | 'settings' | 'session';
476
+ interface ICommandSessionRuntime {
477
+ clearHistory(): void;
478
+ compact(instructions?: string): Promise<void>;
479
+ getContextState(): IContextWindowState;
480
+ getPermissionMode(): TPermissionMode;
481
+ setPermissionMode(mode: TPermissionMode): void;
482
+ getSessionId(): string;
483
+ getMessageCount(): number;
484
+ getSessionAllowedTools(): readonly string[];
485
+ getAutoCompactThreshold?(): number | false;
486
+ setAutoCompactThreshold?(threshold: TAutoCompactThreshold$1): void;
487
+ }
488
+ interface ICommandHostContext {
489
+ clearConversationHistory?(): void;
490
+ getSession(): ICommandSessionRuntime;
491
+ getContextState(): IContextWindowState;
492
+ getAutoCompactThreshold(): TAutoCompactThreshold$1;
493
+ getAutoCompactThresholdSource?(): TAutoCompactThresholdSource;
494
+ setAutoCompactThreshold?(threshold: TAutoCompactThreshold$1, source?: TAutoCompactThresholdSource): void;
495
+ getCommandHostAdapters?(): ICommandHostAdapters;
496
+ compactContext(instructions?: string): Promise<void>;
497
+ getCwd(): string;
498
+ listCommands?(): ICommandListEntry[];
499
+ listEditCheckpoints(): IEditCheckpointSummary[];
500
+ inspectEditCheckpoint?(checkpointId: string): IEditCheckpointInspection;
501
+ restoreEditCheckpoint(checkpointId: string): Promise<IEditCheckpointRestoreResult>;
502
+ rollbackEditCheckpoint(checkpointId: string): Promise<IEditCheckpointRestoreResult>;
503
+ getUsedMemoryReferences(): IMemoryReference[];
504
+ recordMemoryEvent(event: IMemoryEvent): void;
505
+ listBackgroundTasks(filter?: IBackgroundTaskListFilter): IBackgroundTaskState[];
506
+ readBackgroundTaskLog(taskId: string, cursor?: IBackgroundTaskLogCursor): Promise<IBackgroundTaskLogPage>;
507
+ cancelBackgroundTask(taskId: string, reason?: string): Promise<void>;
508
+ closeBackgroundTask(taskId: string): Promise<void>;
509
+ }
510
+
511
+ type TSystemCommandLifecycle = 'inline' | 'blocking' | 'background';
512
+ /** A user-visible command with descriptor metadata and execute logic. */
513
+ interface ISystemCommand {
514
+ name: string;
515
+ description: string;
516
+ modelInvocable?: boolean;
517
+ userInvocable?: boolean;
518
+ argumentHint?: string;
519
+ safety?: TCapabilitySafety;
520
+ subcommands?: readonly ICommand[];
521
+ lifecycle?: TSystemCommandLifecycle;
522
+ execute(context: ICommandHostContext, args: string): Promise<ICommandResult> | ICommandResult;
523
+ }
524
+
525
+ type TCommandModuleSessionRequirement = 'agent-runtime';
526
+ /** Composable command capability module. */
527
+ interface ICommandModule {
528
+ /** Stable module id for diagnostics and duplicate handling. */
529
+ readonly name: string;
530
+ /** Slash palette/autocomplete command sources contributed by this module. */
531
+ readonly commandSources?: readonly ICommandSource[];
532
+ /** Executable system commands contributed by this module. */
533
+ readonly systemCommands?: readonly ISystemCommand[];
534
+ /** Additional model-visible descriptors not derived from executable commands. */
535
+ readonly commandDescriptors?: readonly ICapabilityDescriptor[];
536
+ /** Runtime facilities required by this module. */
537
+ readonly sessionRequirements?: readonly TCommandModuleSessionRequirement[];
538
+ }
539
+
540
+ interface IProviderProfileSettings extends IProviderProfileConfig {
541
+ [key: string]: TUniversalValue;
542
+ }
543
+ interface ILegacyProviderSettings {
544
+ [key: string]: TUniversalValue;
545
+ name?: string;
546
+ model?: string;
547
+ apiKey?: string;
548
+ baseURL?: string;
549
+ timeout?: number;
550
+ options?: Record<string, TUniversalValue>;
551
+ }
552
+ type TProviderSettingsDocument = Record<string, TUniversalValue> & {
553
+ currentProvider?: string;
554
+ providers?: Record<string, IProviderProfileSettings>;
555
+ provider?: ILegacyProviderSettings;
556
+ };
557
+ interface IProviderSetupInput {
558
+ profile: string;
559
+ type: string;
560
+ model?: string;
561
+ apiKey?: string;
562
+ apiKeyEnv?: string;
563
+ baseURL?: string;
564
+ timeout?: number;
565
+ setCurrent?: boolean;
566
+ }
567
+ interface IProviderSetupPatch {
568
+ currentProvider?: string;
569
+ providers: Record<string, IProviderProfileSettings>;
570
+ }
571
+ interface IProviderSettingsBuildOptions {
572
+ providerDefinitions?: readonly IProviderDefinition[];
573
+ }
574
+ declare function upsertProviderProfile(settings: TProviderSettingsDocument, profileName: string, profile: IProviderProfileSettings): TProviderSettingsDocument;
575
+ declare function setCurrentProvider(settings: TProviderSettingsDocument, profileName: string): TProviderSettingsDocument;
576
+ declare function validateProviderProfile(profileName: string, profile: IProviderProfileSettings, options?: IProviderSettingsBuildOptions): void;
577
+ declare function buildProviderSetupPatch(input: IProviderSetupInput, options?: IProviderSettingsBuildOptions): IProviderSetupPatch;
578
+ declare function buildProviderProfile(input: IProviderSetupInput, options?: IProviderSettingsBuildOptions): IProviderProfileSettings;
579
+ declare function mergeProviderPatch(settings: TProviderSettingsDocument, patch: IProviderSetupPatch): TProviderSettingsDocument;
580
+
581
+ interface IProviderCommandSettingsAdapter {
582
+ readMergedSettings(): TProviderSettingsDocument;
583
+ readTargetSettings(): TProviderSettingsDocument;
584
+ writeTargetSettings(settings: TProviderSettingsDocument): void;
585
+ }
586
+ interface IProviderCommandModuleOptions {
587
+ providerDefinitions: readonly IProviderDefinition[];
588
+ settings: IProviderCommandSettingsAdapter;
589
+ }
590
+
591
+ type TProviderSetupType = string;
592
+ type TPromptInput = (label: string, masked?: boolean) => Promise<string>;
593
+ interface IProviderSetupPromptStep extends IProviderSetupStepDefinition {
594
+ key: TProviderSetupField;
595
+ }
596
+ interface IProviderSetupFlowState {
597
+ type: TProviderSetupType;
598
+ steps: readonly IProviderSetupPromptStep[];
599
+ stepIndex: number;
600
+ values: Partial<Record<TProviderSetupField, string>>;
601
+ }
602
+ type TProviderSetupFlowSubmitResult = {
603
+ status: 'next';
604
+ state: IProviderSetupFlowState;
605
+ } | {
606
+ status: 'complete';
607
+ input: IProviderSetupInput;
608
+ } | {
609
+ status: 'error';
610
+ state: IProviderSetupFlowState;
611
+ message: string;
612
+ };
613
+ declare function createProviderSetupFlow(type: TProviderSetupType, providerDefinitions: readonly IProviderDefinition[]): IProviderSetupFlowState;
614
+ declare function formatProviderSetupSelectionPrompt(providerDefinitions: readonly IProviderDefinition[]): string;
615
+ declare function resolveProviderSetupSelection(rawValue: string, providerDefinitions: readonly IProviderDefinition[]): TProviderSetupType;
616
+ declare function getProviderSetupStep(state: IProviderSetupFlowState): IProviderSetupPromptStep;
617
+ declare function submitProviderSetupValue(state: IProviderSetupFlowState, rawValue: string): TProviderSetupFlowSubmitResult;
618
+ declare function runProviderSetupPromptFlow(type: TProviderSetupType, promptInput: TPromptInput, providerDefinitions: readonly IProviderDefinition[]): Promise<IProviderSetupInput>;
619
+ declare function formatProviderSetupPromptLabel(step: IProviderSetupPromptStep): string;
620
+ declare function formatProviderSetupChoiceLabel(definition: IProviderDefinition): string;
621
+ declare function validateProviderSetupValue(step: IProviderSetupPromptStep, value: string): string | undefined;
622
+
623
+ declare function isEnvReference(value: string): boolean;
624
+ declare function formatEnvReference(name: string): string;
625
+ declare function resolveEnvReference(value: string): string | undefined;
626
+ declare function hasUsableSecretReference(value: string | undefined): boolean;
627
+
628
+ declare function testProviderProfileCommand(currentProvider: string | undefined, providers: Record<string, IProviderProfileSettings> | undefined, profileArg: string | undefined, options: IProviderCommandModuleOptions): Promise<ICommandResult>;
629
+ declare function probeProviderProfile(profile: IProviderProfileConfig): Promise<IProviderProbeResult>;
630
+
631
+ declare const HELP_COMMAND_DESCRIPTION = "Show available commands";
632
+ declare function formatCommandHelpMessage(context: ICommandHostContext): string;
633
+
634
+ declare const BACKGROUND_COMMAND_DESCRIPTION = "List and control background tasks";
635
+ declare const BACKGROUND_COMMAND_USAGE = "Usage: background list | background read <task-id> [offset] | background cancel <task-id> | background close <task-id>";
636
+ declare function buildBackgroundCommandSubcommands(): ICommand[];
637
+ declare function formatCommandBackgroundTask(task: IBackgroundTaskState): string;
638
+ declare function formatCommandBackgroundTaskList(tasks: IBackgroundTaskState[]): string;
639
+ declare function parseCommandBackgroundLogCursor(value?: string): IBackgroundTaskLogCursor | undefined;
640
+ declare function listCommandBackgroundTasks(context: ICommandHostContext, filter?: IBackgroundTaskListFilter): IBackgroundTaskState[];
641
+ declare function readCommandBackgroundTaskLog(context: ICommandHostContext, taskId: string, cursor?: IBackgroundTaskLogCursor): Promise<IBackgroundTaskLogPage>;
642
+ declare function cancelCommandBackgroundTask(context: ICommandHostContext, taskId: string, reason?: string): Promise<void>;
643
+ declare function closeCommandBackgroundTask(context: ICommandHostContext, taskId: string): Promise<void>;
644
+
645
+ declare const MODEL_COMMAND_DESCRIPTION = "Change AI model";
646
+ declare const MODEL_COMMAND_ARGUMENT_HINT = "<model-id>";
647
+ declare function buildModelCommandSubcommands(source?: string): ICommand[];
648
+
649
+ declare const LANGUAGE_COMMAND_DESCRIPTION = "Set response language";
650
+ declare const LANGUAGE_COMMAND_ARGUMENT_HINT = "<code>";
651
+ declare const RECOMMENDED_RESPONSE_LANGUAGES: readonly [{
652
+ readonly code: "ko";
653
+ readonly description: "Korean";
654
+ }, {
655
+ readonly code: "en";
656
+ readonly description: "English";
657
+ }, {
658
+ readonly code: "ja";
659
+ readonly description: "Japanese";
660
+ }, {
661
+ readonly code: "zh";
662
+ readonly description: "Chinese";
663
+ }];
664
+ type TRecommendedResponseLanguage = (typeof RECOMMENDED_RESPONSE_LANGUAGES)[number]['code'];
665
+ declare function buildLanguageCommandSubcommands(source?: string): ICommand[];
666
+ declare function parseLanguageArgument(args: string): string | undefined;
667
+ declare function formatLanguageUsageMessage(commandName?: string): string;
668
+
669
+ declare const PERMISSION_MODE_COMMAND_DESCRIPTION = "Show/change permission mode";
670
+ declare const PERMISSION_MODE_ARGUMENT_HINT = "plan | default | acceptEdits | bypassPermissions";
671
+ declare const PERMISSIONS_COMMAND_DESCRIPTION = "Show permission rules";
672
+ interface IPermissionsCommandState {
673
+ readonly mode: TPermissionMode;
674
+ readonly sessionAllowed: readonly string[];
675
+ }
676
+ declare const VALID_PERMISSION_MODES: readonly TPermissionMode[];
677
+ declare function buildPermissionModeSubcommands(source?: string): ICommand[];
678
+ declare function parsePermissionModeArgument(args: string): string | undefined;
679
+ declare function isPermissionMode(value: string): value is TPermissionMode;
680
+ declare function formatInvalidPermissionModeMessage(): string;
681
+ declare function resolvePermissionModeAdapter(context: ICommandHostContext): ICommandPermissionModeAdapter;
682
+ declare function readCommandPermissionMode(context: ICommandHostContext): TPermissionMode;
683
+ declare function writeCommandPermissionMode(context: ICommandHostContext, mode: TPermissionMode): void;
684
+ declare function listCommandSessionAllowedTools(context: ICommandHostContext): readonly string[];
685
+ declare function readCommandPermissionsState(context: ICommandHostContext): IPermissionsCommandState;
686
+ declare function formatCommandPermissionsMessage(state: IPermissionsCommandState): string;
687
+
688
+ declare const CLEAR_COMMAND_DESCRIPTION = "Clear conversation history";
689
+ declare const RENAME_COMMAND_DESCRIPTION = "Rename the current session";
690
+ declare const RENAME_COMMAND_USAGE = "Usage: rename <name>";
691
+ declare const RESUME_COMMAND_DESCRIPTION = "Resume a previous session";
692
+ declare const COST_COMMAND_DESCRIPTION = "Show session info";
693
+ declare const EXIT_COMMAND_DESCRIPTION = "Exit CLI";
694
+ interface ICommandSessionInfo {
695
+ sessionId: string;
696
+ messageCount: number;
697
+ }
698
+ declare function clearConversationHistory(context: ICommandHostContext): void;
699
+ declare function parseSessionNameArgument(args: string): string | undefined;
700
+ declare function createSessionRenamedEffect(name: string): TCommandEffect;
701
+ declare function createSessionPickerRequestedEffect(): TCommandEffect;
702
+ declare function createSessionExitRequestedEffect(): TCommandEffect;
703
+ declare function readCommandSessionInfo(context: ICommandHostContext): ICommandSessionInfo;
704
+
705
+ declare const REWIND_COMMAND_DESCRIPTION = "List, inspect, restore, or rollback edit checkpoints.";
706
+ declare const REWIND_COMMAND_ARGUMENT_HINT = "list | inspect CHECKPOINT_ID | restore CHECKPOINT_ID | code CHECKPOINT_ID | rollback CHECKPOINT_ID";
707
+ declare function buildRewindCommandSubcommands(source?: string): ICommand[];
708
+ declare function listCommandEditCheckpoints(context: ICommandHostContext): readonly IEditCheckpointSummary[];
709
+ declare function inspectCommandEditCheckpoint(context: ICommandHostContext, checkpointId: string): IEditCheckpointInspection;
710
+ declare function restoreCommandEditCheckpoint(context: ICommandHostContext, checkpointId: string): Promise<IEditCheckpointRestoreResult>;
711
+ declare function rollbackCommandEditCheckpoint(context: ICommandHostContext, checkpointId: string): Promise<IEditCheckpointRestoreResult>;
712
+
713
+ declare const MEMORY_COMMAND_DESCRIPTION = "Project memory command. Use it to inspect project memory when stored context may help, save durable preferences, project conventions, feedback, or references worth reusing across sessions, review pending candidates, and report memory provenance. Do not store secrets, credentials, or transient facts.";
714
+ declare const MEMORY_COMMAND_ARGUMENT_HINT = "list | show [topic] | add <user|feedback|project|reference> <topic> <text> | pending | approve <id> | reject <id> | used";
715
+ declare const MEMORY_COMMAND_USAGE = "Usage: memory list | memory show [topic] | memory add <user|feedback|project|reference> <topic> <text> | memory pending | memory approve <id> | memory reject <id> | memory used";
716
+ interface ICommandProjectMemoryStore {
717
+ list(): IProjectMemorySummary;
718
+ loadStartupMemory(): IStartupMemory;
719
+ readTopic(topic: string): string;
720
+ append(input: IAppendMemoryInput): IAppendMemoryResult;
721
+ }
722
+ interface ICommandPendingMemoryStore {
723
+ get(id: string): IMemoryPendingRecord | undefined;
724
+ list(status?: TMemoryCandidateStatus): IMemoryPendingRecord[];
725
+ mark(id: string, status: TMemoryCandidateStatus, reason: string): IMemoryPendingRecord;
726
+ upsert(candidate: IMemoryCandidate, status: TMemoryCandidateStatus, reason: string): void;
727
+ }
728
+ interface ICommandMemoryStores {
729
+ project: ICommandProjectMemoryStore;
730
+ pending: ICommandPendingMemoryStore;
731
+ }
732
+
733
+ declare function buildMemoryCommandSubcommands(source?: string): ICommand[];
734
+ declare function createCommandProjectMemoryStore(cwd: string, now?: () => Date): ICommandProjectMemoryStore;
735
+ declare function createCommandPendingMemoryStore(cwd: string, now?: () => Date): ICommandPendingMemoryStore;
736
+ declare function createCommandMemoryStores(context: ICommandHostContext, now?: () => Date): ICommandMemoryStores;
737
+ declare function isCommandMemoryType(value: string): value is TMemoryType;
738
+ declare function hasSensitiveCommandMemoryContent(text: string): boolean;
739
+ declare function listCommandUsedMemoryReferences(context: ICommandHostContext): readonly IMemoryReference[];
740
+ declare function recordCommandMemoryEvent(context: ICommandHostContext, event: Omit<IMemoryEvent, 'at'>, now?: () => Date): void;
741
+
742
+ /** Aggregates commands from multiple sources */
743
+ declare class CommandRegistry {
744
+ private sources;
745
+ addSource(source: ICommandSource): void;
746
+ replaceSource(name: string, source?: ICommandSource): void;
747
+ addModule(module: ICommandModule): void;
748
+ /** Get all commands, optionally filtered by prefix */
749
+ getCommands(filter?: string): ICommand[];
750
+ /** Resolve a short name to its fully qualified plugin:name form */
751
+ resolveQualifiedName(shortName: string): string | null;
752
+ /** Get subcommands for a specific command */
753
+ getSubcommands(commandName: string): ICommand[];
754
+ getCapabilityDescriptors(): ICapabilityDescriptor[];
755
+ }
756
+
757
+ /** Command source for SDK-owned built-in commands. */
758
+ declare class BuiltinCommandSource implements ICommandSource {
759
+ readonly name = "builtin";
760
+ private readonly commands;
761
+ constructor(systemCommands?: readonly ISystemCommand[]);
762
+ getCommands(): ICommand[];
763
+ }
764
+ declare function createBuiltinCommandModule(): ICommandModule;
765
+
766
+ interface IFrontmatter {
767
+ name?: string;
768
+ description?: string;
769
+ argumentHint?: string;
770
+ disableModelInvocation?: boolean;
771
+ userInvocable?: boolean;
772
+ allowedTools?: string[];
773
+ model?: string;
774
+ effort?: string;
775
+ context?: string;
776
+ agent?: string;
777
+ }
778
+ /** Parse YAML-like frontmatter between --- markers */
779
+ declare function parseFrontmatter(content: string): IFrontmatter | null;
780
+ /** Command source that discovers skills from multiple directories */
781
+ declare class SkillCommandSource implements ICommandSource {
782
+ readonly name = "skill";
783
+ private readonly cwd;
784
+ private readonly home;
785
+ private cachedCommands;
786
+ constructor(cwd: string, home?: string);
787
+ getCommands(): ICommand[];
788
+ getModelInvocableSkills(): ICommand[];
789
+ getUserInvocableSkills(): ICommand[];
790
+ }
791
+
792
+ /**
793
+ * PluginSettingsStore — single point of read/write for plugin-related settings.
794
+ *
795
+ * Shared by MarketplaceClient and BundlePluginInstaller to prevent
796
+ * concurrent writes from overwriting each other's changes.
797
+ */
798
+ /** Source type for a marketplace registry. */
799
+ type IMarketplaceSource$1 = {
800
+ type: 'github';
801
+ repo: string;
802
+ ref?: string;
803
+ } | {
804
+ type: 'git';
805
+ url: string;
806
+ ref?: string;
807
+ } | {
808
+ type: 'local';
809
+ path: string;
810
+ } | {
811
+ type: 'url';
812
+ url: string;
813
+ };
814
+ /** Persisted marketplace source entry. */
815
+ interface IPersistedMarketplaceSource {
816
+ source: IMarketplaceSource$1;
817
+ }
818
+ /** Shape of the plugin-related keys in settings.json. */
819
+ interface IPluginSettings {
820
+ enabledPlugins: Record<string, boolean>;
821
+ extraKnownMarketplaces: Record<string, IPersistedMarketplaceSource>;
822
+ }
823
+ /** Centralized settings store for plugin configuration. */
824
+ declare class PluginSettingsStore {
825
+ private readonly settingsPath;
826
+ constructor(settingsPath: string);
827
+ /** Read the full settings file from disk. */
828
+ private readAll;
829
+ /** Write the full settings file to disk. */
830
+ private writeAll;
831
+ /** Get the enabledPlugins map. */
832
+ getEnabledPlugins(): Record<string, boolean>;
833
+ /** Set a single plugin's enabled state. */
834
+ setPluginEnabled(pluginId: string, enabled: boolean): void;
835
+ /** Remove a plugin from enabledPlugins. */
836
+ removePluginEntry(pluginId: string): void;
837
+ /** Get all persisted marketplace sources. */
838
+ getMarketplaceSources(): Record<string, IPersistedMarketplaceSource>;
839
+ /** Add or update a marketplace source. */
840
+ setMarketplaceSource(name: string, source: IMarketplaceSource$1): void;
841
+ /** Remove a marketplace source. */
842
+ removeMarketplaceSource(name: string): void;
843
+ private getEnabledPluginsFrom;
844
+ private getMarketplaceSourcesFrom;
845
+ }
846
+
847
+ /**
848
+ * Types for the BundlePlugin system.
849
+ *
850
+ * A BundlePlugin is a directory-based plugin package that bundles
851
+ * skills, hooks, agents, and MCP server configurations.
852
+ */
853
+ /** Feature flags indicating what a bundle plugin provides. */
854
+ interface IBundlePluginFeatures {
855
+ commands?: boolean;
856
+ agents?: boolean;
857
+ skills?: boolean;
858
+ hooks?: boolean;
859
+ mcp?: boolean;
860
+ }
861
+ /** Manifest read from `.claude-plugin/plugin.json`. */
862
+ interface IBundlePluginManifest {
863
+ name: string;
864
+ version: string;
865
+ description: string;
866
+ features: IBundlePluginFeatures;
867
+ }
868
+ /** A skill loaded from a bundle plugin's `skills/` directory. */
869
+ interface IBundleSkill {
870
+ name: string;
871
+ description: string;
872
+ skillContent: string;
873
+ [key: string]: unknown;
874
+ }
875
+ /** A fully loaded bundle plugin with all its assets. */
876
+ interface ILoadedBundlePlugin {
877
+ manifest: IBundlePluginManifest;
878
+ skills: IBundleSkill[];
879
+ commands: IBundleSkill[];
880
+ hooks: Record<string, unknown>;
881
+ mcpConfig?: unknown;
882
+ agents: string[];
883
+ pluginDir: string;
884
+ }
885
+ /** Map of plugin identifiers to enabled/disabled state. */
886
+ type TEnabledPlugins = Record<string, boolean>;
887
+
888
+ /**
889
+ * BundlePluginLoader — discovers and loads directory-based bundle plugins.
890
+ *
891
+ * Scans the cache directory (`<pluginsDir>/cache/<marketplace>/<plugin>/<version>/`)
892
+ * for subdirectories containing `.claude-plugin/plugin.json`,
893
+ * reads manifests, loads skills (with frontmatter parsing), hooks, and agent definitions.
894
+ *
895
+ * For each plugin, the latest version directory (lexicographically last) is loaded.
896
+ */
897
+
898
+ /** Loader for directory-based bundle plugins from the cache directory. */
899
+ declare class BundlePluginLoader {
900
+ private readonly pluginsDir;
901
+ private readonly enabledPlugins;
902
+ constructor(pluginsDir: string, enabledPlugins?: TEnabledPlugins);
903
+ /** Load all discovered and enabled bundle plugins (sync). */
904
+ loadPluginsSync(): ILoadedBundlePlugin[];
905
+ /** Load all discovered and enabled bundle plugins (async wrapper). */
906
+ loadAll(): Promise<ILoadedBundlePlugin[]>;
907
+ /**
908
+ * Discover and load plugins from the cache directory.
909
+ *
910
+ * Directory structure: `<pluginsDir>/cache/<marketplace>/<plugin>/<version>/`
911
+ * For each marketplace/plugin pair, the latest version (lexicographically last) is loaded.
912
+ */
913
+ private discoverAndLoad;
914
+ /** Read and validate a plugin.json manifest. Returns null on failure. */
915
+ private readManifest;
916
+ /**
917
+ * Check if a plugin is explicitly disabled.
918
+ * Checks both `name@marketplace` and `name` keys.
919
+ * Plugins not listed in enabledPlugins are enabled by default.
920
+ */
921
+ private isDisabled;
922
+ /** Load a single plugin's skills, hooks, agents, and MCP config. */
923
+ private loadPlugin;
924
+ /** Load skills from the plugin's skills/ directory. */
925
+ private loadSkills;
926
+ /** Load commands from the plugin's commands/ directory (flat .md files). */
927
+ private loadCommands;
928
+ /** Load hooks from hooks/hooks.json if present. */
929
+ private loadHooks;
930
+ /** Load MCP server configuration if present. Checks `.mcp.json` at plugin root first. */
931
+ private loadMcpConfig;
932
+ /** Load agent definitions from agents/ directory if present. */
933
+ private loadAgents;
934
+ }
935
+
936
+ /**
937
+ * Shared types for marketplace client and registry.
938
+ */
939
+ /** Source specification for a marketplace. */
940
+ type IMarketplaceSource = {
941
+ type: 'github';
942
+ repo: string;
943
+ ref?: string;
944
+ } | {
945
+ type: 'git';
946
+ url: string;
947
+ ref?: string;
948
+ } | {
949
+ type: 'local';
950
+ path: string;
951
+ } | {
952
+ type: 'url';
953
+ url: string;
954
+ };
955
+ /** A single plugin entry in a marketplace manifest. */
956
+ interface IMarketplacePluginEntry {
957
+ name: string;
958
+ title: string;
959
+ description: string;
960
+ source: string | {
961
+ type: 'github';
962
+ repo: string;
963
+ } | {
964
+ type: 'url';
965
+ url: string;
966
+ };
967
+ tags: string[];
968
+ }
969
+ /** Manifest format read from `.claude-plugin/marketplace.json`. */
970
+ interface IMarketplaceManifest {
971
+ name: string;
972
+ version: string;
973
+ plugins: IMarketplacePluginEntry[];
974
+ }
975
+ /** Entry in known_marketplaces.json. */
976
+ interface IKnownMarketplaceEntry {
977
+ source: IMarketplaceSource;
978
+ installLocation: string;
979
+ lastUpdated: string;
980
+ }
981
+ /** Shape of known_marketplaces.json. */
982
+ type IKnownMarketplacesRegistry = Record<string, IKnownMarketplaceEntry>;
983
+ /** Exec function type for running shell commands. */
984
+ type ExecFn$1 = (command: string, options: {
985
+ timeout: number;
986
+ stdio?: string;
987
+ }) => string | Buffer;
988
+ /** Options for constructing a MarketplaceClient. */
989
+ interface IMarketplaceClientOptions {
990
+ /** Base plugins directory (e.g., `~/.robota/plugins`). */
991
+ pluginsDir: string;
992
+ /** Custom exec function for testing (replaces child_process.execSync). */
993
+ exec?: ExecFn$1;
994
+ }
995
+
996
+ /**
997
+ * MarketplaceClient — manages marketplace registries via shallow git clones.
998
+ *
999
+ * Marketplaces are git repositories containing `.claude-plugin/marketplace.json`.
1000
+ * They are cloned to `~/.robota/plugins/marketplaces/<name>/` and tracked
1001
+ * in `known_marketplaces.json`.
1002
+ */
1003
+
1004
+ /** Manages marketplace registries via shallow git clones. */
1005
+ declare class MarketplaceClient {
1006
+ private readonly pluginsDir;
1007
+ private readonly exec;
1008
+ private readonly marketplacesDir;
1009
+ private readonly registryPath;
1010
+ constructor(options: IMarketplaceClientOptions);
1011
+ /**
1012
+ * Add a marketplace by cloning its repository.
1013
+ *
1014
+ * 1. Shallow git clone (`--depth 1`) to `marketplaces/<name>/`.
1015
+ * 2. Read `.claude-plugin/marketplace.json` for the `name` field.
1016
+ * 3. Register in `known_marketplaces.json`.
1017
+ *
1018
+ * Returns the registered marketplace name from the manifest.
1019
+ */
1020
+ addMarketplace(source: IMarketplaceSource): string;
1021
+ /**
1022
+ * Remove a marketplace.
1023
+ * Uninstalls all plugins from that marketplace, then deletes the clone directory
1024
+ * and removes from the registry.
1025
+ */
1026
+ removeMarketplace(name: string): void;
1027
+ /**
1028
+ * Update a marketplace by running git pull on its clone.
1029
+ * The manifest is re-read from disk on demand (via fetchManifest), so the
1030
+ * updated manifest is automatically available after pull.
1031
+ */
1032
+ updateMarketplace(name: string): void;
1033
+ /** List all registered marketplaces. */
1034
+ listMarketplaces(): Array<{
1035
+ name: string;
1036
+ source: IMarketplaceSource;
1037
+ lastUpdated: string;
1038
+ }>;
1039
+ /** Read the marketplace manifest from a registered marketplace's clone. */
1040
+ fetchManifest(marketplaceName: string): IMarketplaceManifest;
1041
+ /** Get the clone directory path for a registered marketplace. */
1042
+ getMarketplaceDir(name: string): string;
1043
+ /**
1044
+ * Get the current git SHA (first 12 chars) for a marketplace clone.
1045
+ * Used as a version identifier when plugins lack explicit versions.
1046
+ */
1047
+ getMarketplaceSha(name: string): string;
1048
+ /** List all available plugins across all marketplaces. */
1049
+ listAvailablePlugins(): Array<IMarketplacePluginEntry & {
1050
+ marketplace: string;
1051
+ }>;
1052
+ /** Resolve a marketplace source to a git clone URL. */
1053
+ private resolveCloneUrl;
1054
+ /** Read and parse a marketplace.json from a file path. */
1055
+ private readManifestFromPath;
1056
+ /** Default exec implementation using child_process. */
1057
+ private defaultExec;
1058
+ }
1059
+
1060
+ /**
1061
+ * BundlePluginInstaller — installs, uninstalls, enables, and disables bundle plugins.
1062
+ *
1063
+ * Resolves plugin sources from marketplace manifests, copies/clones to the
1064
+ * cache directory, and tracks installations in `installed_plugins.json`.
1065
+ */
1066
+
1067
+ /** Record of an installed plugin in installed_plugins.json. */
1068
+ interface IInstalledPluginRecord {
1069
+ pluginName: string;
1070
+ marketplace: string;
1071
+ version: string;
1072
+ installPath: string;
1073
+ installedAt: string;
1074
+ }
1075
+ /** Shape of installed_plugins.json. */
1076
+ type IInstalledPluginsRegistry = Record<string, IInstalledPluginRecord>;
1077
+ /** Exec function type for running shell commands. */
1078
+ type ExecFn = (command: string, options: {
1079
+ timeout: number;
1080
+ stdio?: string;
1081
+ }) => string | Buffer;
1082
+ /** Options for constructing a BundlePluginInstaller. */
1083
+ interface IBundlePluginInstallerOptions {
1084
+ /** Base plugins directory (e.g., `~/.robota/plugins`). */
1085
+ pluginsDir: string;
1086
+ /** Shared settings store for enable/disable persistence. */
1087
+ settingsStore: PluginSettingsStore;
1088
+ /** MarketplaceClient for reading marketplace manifests. */
1089
+ marketplaceClient: MarketplaceClient;
1090
+ /** Custom exec function for testing (replaces child_process.execSync). */
1091
+ exec?: ExecFn;
1092
+ }
1093
+ /** Installs, uninstalls, enables, and disables bundle plugins. */
1094
+ declare class BundlePluginInstaller {
1095
+ private readonly pluginsDir;
1096
+ private readonly cacheDir;
1097
+ private readonly registryPath;
1098
+ private readonly settingsStore;
1099
+ private readonly marketplaceClient;
1100
+ private readonly exec;
1101
+ constructor(options: IBundlePluginInstallerOptions);
1102
+ /**
1103
+ * Install a plugin from a marketplace.
1104
+ *
1105
+ * 1. Read marketplace manifest to find the plugin entry.
1106
+ * 2. Resolve source (relative path, github, or url).
1107
+ * 3. Copy/clone to `cache/<marketplace>/<plugin>/<version>/`.
1108
+ * 4. Record in `installed_plugins.json`.
1109
+ */
1110
+ install(pluginName: string, marketplaceName: string): Promise<void>;
1111
+ /**
1112
+ * Uninstall a plugin.
1113
+ * Removes from cache and from installed_plugins.json.
1114
+ */
1115
+ uninstall(pluginId: string): Promise<void>;
1116
+ /** Enable a plugin by setting its enabledPlugins entry to true. */
1117
+ enable(pluginId: string): Promise<void>;
1118
+ /** Disable a plugin by setting its enabledPlugins entry to false. */
1119
+ disable(pluginId: string): Promise<void>;
1120
+ /** Get all installed plugins. */
1121
+ getInstalledPlugins(): IInstalledPluginsRegistry;
1122
+ /** Get plugins installed from a specific marketplace. */
1123
+ getPluginsByMarketplace(marketplaceName: string): IInstalledPluginRecord[];
1124
+ /** Resolve the version for a plugin entry. */
1125
+ private resolveVersion;
1126
+ /**
1127
+ * Normalize source object — Claude Code manifests use `source` key instead of `type`.
1128
+ * e.g., { source: "url", url: "..." } → { type: "url", url: "..." }
1129
+ */
1130
+ private normalizeSource;
1131
+ /** Resolve the source and install the plugin. */
1132
+ private resolveAndInstall;
1133
+ /** Clone a git repository to the target directory. */
1134
+ private cloneToDir;
1135
+ /** Read the installed_plugins.json registry. */
1136
+ private readRegistry;
1137
+ /** Write the installed_plugins.json registry. */
1138
+ private writeRegistry;
1139
+ /** Default exec implementation using child_process. */
1140
+ private defaultExec;
1141
+ }
1142
+
1143
+ /**
1144
+ * Command source that discovers skills and commands from loaded BundlePlugins.
1145
+ *
1146
+ * - Skills: exposed as `/name` with `(plugin-name)` hint in description.
1147
+ * - Commands: exposed as `/plugin:command` (already namespaced by the loader).
1148
+ */
1149
+ declare class PluginCommandSource implements ICommandSource {
1150
+ readonly name = "plugin";
1151
+ private readonly plugins;
1152
+ constructor(plugins: ILoadedBundlePlugin[]);
1153
+ getCommands(): ICommand[];
1154
+ }
1155
+
1156
+ /** Registry for system commands. */
1157
+ declare class SystemCommandExecutor {
1158
+ private readonly commands;
1159
+ constructor(commands?: ISystemCommand[]);
1160
+ /** Register an additional command. */
1161
+ register(command: ISystemCommand): void;
1162
+ /** Execute a command by name. Returns null if command not found. */
1163
+ execute(name: string, session: ICommandHostContext, args: string): Promise<ICommandResult | null>;
1164
+ getCommand(name: string): ISystemCommand | undefined;
1165
+ executeCommand(command: ISystemCommand, session: ICommandHostContext, args: string): Promise<ICommandResult>;
1166
+ /** List all registered commands. */
1167
+ listCommands(): ISystemCommand[];
1168
+ listModelInvocableCommands(): ICapabilityDescriptor[];
1169
+ isModelInvocable(name: string): boolean;
1170
+ executeModelInvocable(name: string, session: ICommandHostContext, args: string): Promise<ICommandResult | null>;
1171
+ /** Check if a command exists. */
1172
+ hasCommand(name: string): boolean;
1173
+ }
1174
+
1175
+ /** Built-in system commands. */
1176
+ declare function createSystemCommands(): ISystemCommand[];
1177
+
1178
+ /**
1179
+ * Build a skill prompt from slash command input.
1180
+ * Supports variable substitution and shell command preprocessing.
1181
+ */
1182
+
1183
+ /** Context variables available during skill prompt processing */
1184
+ interface SkillPromptContext {
1185
+ /** Current session ID — substituted for ${CLAUDE_SESSION_ID} */
1186
+ sessionId?: string;
1187
+ /** Directory containing SKILL.md — substituted for ${CLAUDE_SKILL_DIR} */
1188
+ skillDir?: string;
1189
+ }
1190
+ /**
1191
+ * Substitute variables in skill content.
1192
+ *
1193
+ * Supported variables:
1194
+ * - `$ARGUMENTS` — all arguments passed to the skill
1195
+ * - `$ARGUMENTS[N]` — argument by index (0-based)
1196
+ * - `$N` — shorthand for `$ARGUMENTS[N]` (single digit, 0-9)
1197
+ * - `${CLAUDE_SESSION_ID}` — current session ID
1198
+ * - `${CLAUDE_SKILL_DIR}` — directory containing SKILL.md
1199
+ */
1200
+ declare function substituteVariables(content: string, args: string, context?: SkillPromptContext): string;
1201
+ /**
1202
+ * Preprocess shell commands in skill content.
1203
+ * Matches `` !`...` `` patterns and replaces them with command output.
1204
+ * Commands have a 5-second timeout.
1205
+ */
1206
+ declare function preprocessShellCommands(content: string): Promise<string>;
1207
+ /** Build a skill prompt from a slash command input and registry */
1208
+ declare function buildSkillPrompt(input: string, registry: CommandRegistry, context?: SkillPromptContext): Promise<string | null>;
1209
+
1210
+ /**
1211
+ * Skill execution logic.
1212
+ * Handles both fork-based (subagent) and inject-based (user message) execution.
1213
+ */
1214
+
1215
+ /** Options passed to the fork execution callback */
1216
+ interface IForkExecutionOptions {
1217
+ /** Agent identity to use (e.g., 'Explore', 'Plan') */
1218
+ agent?: string;
1219
+ /** Tools the subagent is allowed to use */
1220
+ allowedTools?: string[];
1221
+ }
1222
+ /** Callback interface for skill execution infrastructure */
1223
+ interface ISkillExecutionCallbacks {
1224
+ /**
1225
+ * Run skill content in an isolated subagent session.
1226
+ * The content becomes the subagent's prompt.
1227
+ * Returns the subagent's response.
1228
+ */
1229
+ runInFork?: (content: string, options: IForkExecutionOptions) => Promise<string>;
1230
+ }
1231
+ /** Result of skill execution */
1232
+ interface ISkillExecutionResult {
1233
+ /** Execution mode used */
1234
+ mode: 'fork' | 'inject';
1235
+ /** For inject mode: the prompt to send as a user message */
1236
+ prompt?: string;
1237
+ /** For fork mode: the subagent's response */
1238
+ result?: string;
1239
+ }
1240
+ /**
1241
+ * Execute a skill command.
1242
+ *
1243
+ * When `context: 'fork'`, the skill runs in an isolated subagent session
1244
+ * via the `runInFork` callback. Throws if `runInFork` is not available.
1245
+ * For non-fork skills, the content is returned as a prompt for injection
1246
+ * into the current session.
1247
+ */
1248
+ declare function executeSkill(skill: ICommand, args: string, callbacks: ISkillExecutionCallbacks, context?: SkillPromptContext): Promise<ISkillExecutionResult>;
1249
+
1250
+ /**
1251
+ * Types for InteractiveSession — event-driven session wrapper.
1252
+ */
1253
+
1254
+ /** Permission handler result — SDK-owned type (mirrors agent-sessions TPermissionResult).
1255
+ * true = allow, false = deny, 'allow-session' = allow and remember for this session. */
1256
+ type TPermissionResultValue = boolean | 'allow-session';
1257
+ /** Tool execution state visible to clients. */
1258
+ interface IToolState {
1259
+ toolName: string;
1260
+ firstArg: string;
1261
+ isRunning: boolean;
1262
+ result?: 'success' | 'error' | 'denied';
1263
+ diffLines?: IDiffLine[];
1264
+ diffFile?: string;
1265
+ toolResultData?: string;
1266
+ }
1267
+ /** A single diff line for Edit tool display. */
1268
+ interface IDiffLine {
1269
+ type: 'add' | 'remove' | 'context' | 'hunk';
1270
+ text: string;
1271
+ lineNumber: number;
1272
+ }
1273
+ interface IUsageSnapshot {
1274
+ kind: 'exact' | 'estimated';
1275
+ scope: 'turn';
1276
+ totalTokens: number;
1277
+ promptTokens?: number;
1278
+ completionTokens?: number;
1279
+ contextUsedTokens: number;
1280
+ contextMaxTokens: number;
1281
+ contextUsedPercentage: number;
1282
+ costStatus: 'unknown' | 'estimated' | 'exact';
1283
+ }
1284
+ /** Result of a completed prompt execution. */
1285
+ interface IExecutionResult {
1286
+ response: string;
1287
+ history: IHistoryEntry[];
1288
+ toolSummaries: IToolSummary[];
1289
+ contextState: IContextWindowState;
1290
+ usage?: IUsageSnapshot;
1291
+ }
1292
+ /** Summary of a tool call extracted from history. */
1293
+ interface IToolSummary {
1294
+ name: string;
1295
+ args: string;
1296
+ }
1297
+ /** Permission handler delegate — clients provide their own UI. */
1298
+ type TInteractivePermissionHandler = (toolName: string, toolArgs: TToolArgs) => Promise<TPermissionResultValue>;
1299
+ /** Events emitted by InteractiveSession. */
1300
+ interface IInteractiveSessionEvents {
1301
+ text_delta: (delta: string) => void;
1302
+ tool_start: (state: IToolState) => void;
1303
+ tool_end: (state: IToolState) => void;
1304
+ thinking: (isThinking: boolean) => void;
1305
+ complete: (result: IExecutionResult) => void;
1306
+ error: (error: Error) => void;
1307
+ context_update: (state: IContextWindowState) => void;
1308
+ compact: (event: ICompactEvent) => void;
1309
+ interrupted: (result: IExecutionResult) => void;
1310
+ background_task_event: (event: TBackgroundTaskEvent) => void;
1311
+ background_job_group_event: (event: TBackgroundJobGroupEvent) => void;
1312
+ }
1313
+ type TInteractiveEventName = keyof IInteractiveSessionEvents;
1314
+ /**
1315
+ * Common interface for all transport adapters.
1316
+ * Each transport exposes InteractiveSession over a specific protocol.
1317
+ */
1318
+ interface ITransportAdapter {
1319
+ /** Human-readable transport name (e.g., 'http', 'ws', 'mcp', 'headless') */
1320
+ readonly name: string;
1321
+ /** Attach an InteractiveSession to this transport. */
1322
+ attach(session: InteractiveSession): void;
1323
+ /** Start serving. What this means depends on the transport. */
1324
+ start(): Promise<void>;
1325
+ /** Stop serving and clean up resources. */
1326
+ stop(): Promise<void>;
1327
+ }
1328
+
1329
+ /**
1330
+ * Definition of an agent that can be spawned as a subagent.
1331
+ *
1332
+ * Built-in agents and custom (user-defined) agents share this shape.
1333
+ * Optional fields inherit from the parent session when omitted.
1334
+ */
1335
+ interface IAgentDefinition {
1336
+ /** Unique name used to reference the agent (e.g., 'Explore', 'Plan'). */
1337
+ name: string;
1338
+ /** Human-readable description of the agent's purpose. */
1339
+ description: string;
1340
+ /** Markdown body content used as the agent's system prompt. */
1341
+ systemPrompt: string;
1342
+ /** Model override (e.g., 'claude-haiku-4-5', 'sonnet', 'opus'). Inherits parent model when omitted. */
1343
+ model?: string;
1344
+ /** Maximum number of agentic turns the subagent may execute. */
1345
+ maxTurns?: number;
1346
+ /** Allowlist of tool names. Only these tools are available when set. */
1347
+ tools?: string[];
1348
+ /** Denylist of tool names. These tools are removed from the inherited set. */
1349
+ disallowedTools?: string[];
1350
+ }
8
1351
 
9
1352
  /**
10
1353
  * Zod schemas and TypeScript types for Robota CLI settings
11
1354
  */
12
1355
 
13
- declare const HooksSchema: z.ZodOptional<z.ZodObject<{
14
- PreToolUse: z.ZodOptional<z.ZodArray<z.ZodObject<{
15
- matcher: z.ZodString;
16
- hooks: z.ZodArray<z.ZodObject<{
17
- type: z.ZodLiteral<"command">;
18
- command: z.ZodString;
19
- }, "strip", z.ZodTypeAny, {
20
- type: "command";
21
- command: string;
22
- }, {
23
- type: "command";
24
- command: string;
25
- }>, "many">;
26
- }, "strip", z.ZodTypeAny, {
27
- matcher: string;
28
- hooks: {
29
- type: "command";
30
- command: string;
31
- }[];
32
- }, {
33
- matcher: string;
34
- hooks: {
35
- type: "command";
36
- command: string;
37
- }[];
38
- }>, "many">>;
39
- PostToolUse: z.ZodOptional<z.ZodArray<z.ZodObject<{
40
- matcher: z.ZodString;
41
- hooks: z.ZodArray<z.ZodObject<{
42
- type: z.ZodLiteral<"command">;
43
- command: z.ZodString;
44
- }, "strip", z.ZodTypeAny, {
45
- type: "command";
46
- command: string;
47
- }, {
48
- type: "command";
49
- command: string;
50
- }>, "many">;
51
- }, "strip", z.ZodTypeAny, {
52
- matcher: string;
53
- hooks: {
54
- type: "command";
55
- command: string;
56
- }[];
57
- }, {
58
- matcher: string;
59
- hooks: {
60
- type: "command";
61
- command: string;
62
- }[];
63
- }>, "many">>;
64
- SessionStart: z.ZodOptional<z.ZodArray<z.ZodObject<{
65
- matcher: z.ZodString;
66
- hooks: z.ZodArray<z.ZodObject<{
67
- type: z.ZodLiteral<"command">;
68
- command: z.ZodString;
69
- }, "strip", z.ZodTypeAny, {
70
- type: "command";
71
- command: string;
72
- }, {
73
- type: "command";
74
- command: string;
75
- }>, "many">;
76
- }, "strip", z.ZodTypeAny, {
77
- matcher: string;
78
- hooks: {
79
- type: "command";
80
- command: string;
81
- }[];
82
- }, {
83
- matcher: string;
84
- hooks: {
85
- type: "command";
86
- command: string;
87
- }[];
88
- }>, "many">>;
89
- Stop: z.ZodOptional<z.ZodArray<z.ZodObject<{
90
- matcher: z.ZodString;
91
- hooks: z.ZodArray<z.ZodObject<{
92
- type: z.ZodLiteral<"command">;
93
- command: z.ZodString;
94
- }, "strip", z.ZodTypeAny, {
95
- type: "command";
96
- command: string;
97
- }, {
98
- type: "command";
99
- command: string;
100
- }>, "many">;
101
- }, "strip", z.ZodTypeAny, {
102
- matcher: string;
103
- hooks: {
104
- type: "command";
105
- command: string;
106
- }[];
107
- }, {
108
- matcher: string;
109
- hooks: {
110
- type: "command";
111
- command: string;
112
- }[];
113
- }>, "many">>;
114
- }, "strip", z.ZodTypeAny, {
115
- PreToolUse?: {
116
- matcher: string;
117
- hooks: {
118
- type: "command";
119
- command: string;
120
- }[];
121
- }[] | undefined;
122
- PostToolUse?: {
123
- matcher: string;
124
- hooks: {
125
- type: "command";
126
- command: string;
127
- }[];
128
- }[] | undefined;
129
- SessionStart?: {
130
- matcher: string;
131
- hooks: {
132
- type: "command";
133
- command: string;
134
- }[];
135
- }[] | undefined;
136
- Stop?: {
137
- matcher: string;
138
- hooks: {
139
- type: "command";
140
- command: string;
141
- }[];
142
- }[] | undefined;
143
- }, {
144
- PreToolUse?: {
145
- matcher: string;
146
- hooks: {
147
- type: "command";
148
- command: string;
149
- }[];
150
- }[] | undefined;
151
- PostToolUse?: {
152
- matcher: string;
153
- hooks: {
154
- type: "command";
155
- command: string;
156
- }[];
157
- }[] | undefined;
158
- SessionStart?: {
159
- matcher: string;
160
- hooks: {
161
- type: "command";
162
- command: string;
163
- }[];
164
- }[] | undefined;
165
- Stop?: {
166
- matcher: string;
167
- hooks: {
168
- type: "command";
169
- command: string;
170
- }[];
171
- }[] | undefined;
172
- }>>;
173
1356
  /**
174
1357
  * Fully resolved config after merging all settings files and applying defaults.
175
1358
  */
176
1359
  interface IResolvedConfig {
177
1360
  defaultTrustLevel: 'safe' | 'moderate' | 'full';
1361
+ /** Response language code (e.g., "ko", "en"). Undefined = no language constraint. */
1362
+ language?: string;
1363
+ /** Active provider profile key when providers/currentProvider are used. */
1364
+ currentProvider?: string;
178
1365
  provider: {
179
1366
  name: string;
180
1367
  model: string;
181
1368
  apiKey: string | undefined;
1369
+ baseURL?: string;
1370
+ timeout?: number;
1371
+ options?: Record<string, TUniversalValue>;
182
1372
  };
183
1373
  permissions: {
184
1374
  allow: string[];
185
1375
  deny: string[];
186
1376
  };
187
1377
  env: Record<string, string>;
188
- hooks?: z.infer<typeof HooksSchema>;
1378
+ hooks?: THooksConfig;
1379
+ /** Plugin enablement map: plugin name -> enabled/disabled */
1380
+ enabledPlugins?: Record<string, boolean>;
1381
+ /** Extra marketplace sources: name -> { source } */
1382
+ extraKnownMarketplaces?: Record<string, {
1383
+ source: {
1384
+ type: string;
1385
+ repo?: string;
1386
+ url?: string;
1387
+ path?: string;
1388
+ ref?: string;
1389
+ };
1390
+ }>;
1391
+ /** Auto-compact threshold as a 0-1 fraction. Set false to disable automatic compaction. */
1392
+ autoCompactThreshold?: number | false;
189
1393
  }
190
1394
 
191
1395
  interface ILoadedContext {
@@ -193,16 +1397,156 @@ interface ILoadedContext {
193
1397
  agentsMd: string;
194
1398
  /** Concatenated content of all CLAUDE.md files found (root-first) */
195
1399
  claudeMd: string;
1400
+ /** Startup project memory index loaded from .robota/memory/MEMORY.md, if present */
1401
+ memoryMd?: string;
1402
+ /** Formatted active task context loaded from .agents/tasks/*.md, if present */
1403
+ taskContext?: string;
196
1404
  /** Extracted "Compact Instructions" section from CLAUDE.md, if present */
197
1405
  compactInstructions?: string;
198
1406
  }
1407
+
199
1408
  /**
200
- * Load all AGENTS.md and CLAUDE.md files found by walking up from `cwd`.
201
- * Files from higher directories appear before files from lower directories.
1409
+ * Subagent session factory assembles an isolated child Session for subagent execution.
202
1410
  *
203
- * @param cwd - Starting directory for the walk-up search
1411
+ * Unlike `createSession`, this factory does not load config files or context from disk.
1412
+ * It receives pre-resolved config and context from the parent session, applies tool
1413
+ * filtering and model resolution from the agent definition, and creates a lightweight
1414
+ * Session suitable for subagent use.
204
1415
  */
205
- declare function loadContext(cwd: string): Promise<ILoadedContext>;
1416
+
1417
+ /** Options for creating a subagent session. */
1418
+ interface ISubagentOptions {
1419
+ /** Agent definition (built-in or custom). */
1420
+ agentDefinition: IAgentDefinition;
1421
+ /** Parent's resolved config (for provider, permissions, etc.). */
1422
+ parentConfig: IResolvedConfig;
1423
+ /** Parent's loaded context (CLAUDE.md, AGENTS.md). */
1424
+ parentContext: ILoadedContext;
1425
+ /** Parent session's available tools (to inherit/filter). */
1426
+ parentTools: IToolWithEventService[];
1427
+ /** AI provider instance. */
1428
+ provider: IAIProvider;
1429
+ /** Terminal output interface. */
1430
+ terminal: ITerminalOutput;
1431
+ /** Stable session ID for transcript files. */
1432
+ sessionId?: string;
1433
+ /** Optional logger for subagent transcripts. */
1434
+ sessionLogger?: ISessionLogger;
1435
+ /** Whether this is a fork worker (uses fork suffix instead of standard). */
1436
+ isForkWorker?: boolean;
1437
+ /** Permission mode from parent (bypassPermissions, acceptEdits, etc.). */
1438
+ permissionMode?: TPermissionMode;
1439
+ /** Permission handler from parent. */
1440
+ permissionHandler?: TPermissionHandler;
1441
+ /** Plugin hooks configuration from parent session. */
1442
+ hooks?: Record<string, unknown>;
1443
+ /** Hook type executors from parent session (prompt, agent, etc.). */
1444
+ hookTypeExecutors?: IHookTypeExecutor[];
1445
+ /** Streaming callback. */
1446
+ onTextDelta?: (delta: string) => void;
1447
+ /** Tool execution callback. */
1448
+ onToolExecution?: (event: {
1449
+ type: 'start' | 'end';
1450
+ toolName: string;
1451
+ toolArgs?: TToolArgs;
1452
+ success?: boolean;
1453
+ denied?: boolean;
1454
+ toolResultData?: string;
1455
+ }) => void;
1456
+ }
1457
+ /**
1458
+ * Create a fully-configured Session for subagent execution.
1459
+ *
1460
+ * Assembles provider, tools, and system prompt from parent context and
1461
+ * agent definition, then returns a new Session instance.
1462
+ */
1463
+ declare function createSubagentSession(options: ISubagentOptions): Session;
1464
+
1465
+ interface IInProcessSubagentRunnerDeps {
1466
+ config: IResolvedConfig;
1467
+ context: ILoadedContext;
1468
+ tools: IToolWithEventService[];
1469
+ terminal: ITerminalOutput;
1470
+ provider: IAIProvider;
1471
+ permissionMode?: TPermissionMode;
1472
+ permissionHandler?: TPermissionHandler;
1473
+ hooks?: ISubagentOptions['hooks'];
1474
+ hookTypeExecutors?: IHookTypeExecutor[];
1475
+ onTextDelta?: (delta: string) => void;
1476
+ onToolExecution?: (event: {
1477
+ type: 'start' | 'end';
1478
+ toolName: string;
1479
+ toolArgs?: TToolArgs;
1480
+ success?: boolean;
1481
+ denied?: boolean;
1482
+ toolResultData?: string;
1483
+ }) => void;
1484
+ customAgentRegistry?: (name: string) => IAgentDefinition | undefined;
1485
+ }
1486
+ type TSubagentRunnerFactory = (deps: IInProcessSubagentRunnerDeps) => ISubagentRunner;
1487
+
1488
+ /**
1489
+ * Prompt hook executor — evaluates a prompt via an AI model.
1490
+ *
1491
+ * Makes a single-turn LLM call with hook input context as the prompt.
1492
+ * Parses { ok: boolean, reason?: string } from the AI response.
1493
+ *
1494
+ * Exit codes:
1495
+ * - 0: ok: true (allow/proceed)
1496
+ * - 2: ok: false (block/deny), reason in stderr
1497
+ * - 1: execution error (provider failure, parse error)
1498
+ */
1499
+
1500
+ /** A minimal provider interface for single-turn completion. */
1501
+ interface IPromptProvider {
1502
+ complete(prompt: string): Promise<string>;
1503
+ }
1504
+ /** Factory that creates a provider instance, optionally for a specific model. */
1505
+ type TProviderFactory = (model?: string) => IPromptProvider;
1506
+ /** Constructor options for PromptExecutor. */
1507
+ interface IPromptExecutorOptions {
1508
+ providerFactory: TProviderFactory;
1509
+ defaultModel?: string;
1510
+ }
1511
+ declare class PromptExecutor implements IHookTypeExecutor {
1512
+ readonly type: "prompt";
1513
+ private readonly providerFactory;
1514
+ private readonly defaultModel;
1515
+ constructor(options: IPromptExecutorOptions);
1516
+ execute(definition: IHookDefinition, input: IHookInput): Promise<IHookResult>;
1517
+ }
1518
+
1519
+ /**
1520
+ * Agent hook executor — delegates to a sub-agent session.
1521
+ *
1522
+ * Creates a subagent session with maxTurns and timeout limits,
1523
+ * runs hook input as the initial prompt, and parses the result.
1524
+ *
1525
+ * Exit codes:
1526
+ * - 0: ok: true (allow/proceed)
1527
+ * - 2: ok: false (block/deny), reason in stderr
1528
+ * - 1: execution error (session failure, parse error)
1529
+ */
1530
+
1531
+ /** A minimal session interface for running a prompt. */
1532
+ interface IAgentSession {
1533
+ run(prompt: string): Promise<string>;
1534
+ }
1535
+ /** Factory that creates a session instance with the given options. */
1536
+ type TSessionFactory = (options: {
1537
+ maxTurns?: number;
1538
+ timeout?: number;
1539
+ }) => IAgentSession;
1540
+ /** Constructor options for AgentExecutor. */
1541
+ interface IAgentExecutorOptions {
1542
+ sessionFactory: TSessionFactory;
1543
+ }
1544
+ declare class AgentExecutor implements IHookTypeExecutor {
1545
+ readonly type: "agent";
1546
+ private readonly sessionFactory;
1547
+ constructor(options: IAgentExecutorOptions);
1548
+ execute(definition: IHookDefinition, input: IHookInput): Promise<IHookResult>;
1549
+ }
206
1550
 
207
1551
  type TProjectType = 'node' | 'python' | 'rust' | 'go' | 'unknown';
208
1552
  type TPackageManager = 'pnpm' | 'yarn' | 'npm' | 'bun';
@@ -213,33 +1557,71 @@ interface IProjectInfo {
213
1557
  packageManager?: TPackageManager;
214
1558
  language: TLanguage;
215
1559
  }
216
- /**
217
- * Detect the project type, language, name, and package manager from `cwd`.
218
- */
219
- declare function detectProject(cwd: string): Promise<IProjectInfo>;
220
-
221
- /**
222
- * System prompt builder — assembles the system message sent to the AI model
223
- * from base role, project context, AGENTS.md/CLAUDE.md, tool list, and
224
- * permission trust level.
225
- */
226
1560
 
227
1561
  interface ISystemPromptParams {
228
1562
  /** Concatenated AGENTS.md content (may be empty string) */
229
1563
  agentsMd: string;
230
1564
  /** Concatenated CLAUDE.md content (may be empty string) */
231
1565
  claudeMd: string;
1566
+ /** Startup project memory index loaded from .robota/memory/MEMORY.md */
1567
+ memoryMd?: string;
1568
+ /** Formatted active task context loaded from .agents/tasks/*.md */
1569
+ taskContext?: string;
232
1570
  /** Human-readable tool descriptions, one per entry */
233
1571
  toolDescriptions: string[];
234
1572
  /** Active trust level governing permission checks */
235
1573
  trustLevel: TTrustLevel;
236
1574
  /** Detected project metadata */
237
1575
  projectInfo: IProjectInfo;
1576
+ /** Current working directory */
1577
+ cwd?: string;
1578
+ /** Response language code (e.g., "ko", "en"). If set, AI must respond in this language. */
1579
+ language?: string;
1580
+ /** Discovered skills to expose in the system prompt */
1581
+ skills?: Array<{
1582
+ name: string;
1583
+ description: string;
1584
+ disableModelInvocation?: boolean;
1585
+ }>;
1586
+ /** Discovered agents to expose in the system prompt */
1587
+ agents?: Array<{
1588
+ name: string;
1589
+ description: string;
1590
+ }>;
1591
+ /** Command descriptors to expose to the model */
1592
+ commandDescriptors?: ICapabilityDescriptor[];
238
1593
  }
239
- /**
240
- * Assemble the full system prompt string from the provided parameters.
241
- */
242
- declare function buildSystemPrompt(params: ISystemPromptParams): string;
1594
+
1595
+ type TReversibleExecutionIsolation = 'none' | 'worktree' | 'provider-sandbox';
1596
+ type TReversibleRollbackLayer = 'none' | 'edit-checkpoint' | 'worktree' | 'provider-sandbox';
1597
+ type TReversibleSideEffect = 'none' | 'file-mutation' | 'shell-process' | 'subagent' | 'unknown';
1598
+ type TReversibleSafetyStatus = 'reversible' | 'read-only' | 'requires-checkpoint' | 'requires-isolation' | 'unknown';
1599
+ interface IReversibleExecutionOptions {
1600
+ mode: 'local-first';
1601
+ isolation?: TReversibleExecutionIsolation;
1602
+ enforceUntrackedSideEffects?: boolean;
1603
+ }
1604
+ interface IReversibleToolSafetyContext {
1605
+ checkpointAvailable: boolean;
1606
+ isolation: TReversibleExecutionIsolation;
1607
+ }
1608
+ interface IReversibleToolSafetyInput {
1609
+ toolName: string;
1610
+ toolArgs?: TToolArgs;
1611
+ context: IReversibleToolSafetyContext;
1612
+ }
1613
+ interface IReversibleToolSafetyReport {
1614
+ toolName: string;
1615
+ reversible: boolean;
1616
+ sideEffect: TReversibleSideEffect;
1617
+ rollbackLayer: TReversibleRollbackLayer;
1618
+ status: TReversibleSafetyStatus;
1619
+ message: string;
1620
+ }
1621
+ declare function evaluateReversibleToolSafety(input: IReversibleToolSafetyInput): IReversibleToolSafetyReport;
1622
+ declare function wrapReversibleExecutionTools(tools: readonly IToolWithEventService[], options: IReversibleExecutionOptions & {
1623
+ checkpointAvailable: boolean;
1624
+ }): IToolWithEventService[];
243
1625
 
244
1626
  /**
245
1627
  * Session factory — assembles a fully-configured Session from config, context,
@@ -250,10 +1632,13 @@ declare function buildSystemPrompt(params: ISystemPromptParams): string;
250
1632
  * expects as pre-constructed dependencies.
251
1633
  */
252
1634
 
1635
+ type TAutoCompactThreshold = number | false;
253
1636
  /** Options for the createSession factory */
254
1637
  interface ICreateSessionOptions {
255
1638
  /** Resolved CLI configuration (model, API key, permissions) */
256
1639
  config: IResolvedConfig;
1640
+ /** Working directory used for project context, skills, and agent definitions. */
1641
+ cwd?: string;
257
1642
  /** Loaded AGENTS.md / CLAUDE.md context */
258
1643
  context: ILoadedContext;
259
1644
  /** Terminal I/O for permission prompts */
@@ -272,35 +1657,69 @@ interface ICreateSessionOptions {
272
1657
  permissionHandler?: TPermissionHandler;
273
1658
  /** Callback for text deltas — enables streaming text to the UI in real-time */
274
1659
  onTextDelta?: (delta: string) => void;
1660
+ /** Callback when context window usage is refreshed */
1661
+ onContextUpdate?: (state: IContextWindowState) => void;
275
1662
  /** Custom prompt-for-approval function (injected from CLI) */
276
1663
  promptForApproval?: (terminal: ITerminalOutput, toolName: string, toolArgs: TToolArgs) => Promise<boolean>;
277
1664
  /** Additional tools to register beyond the defaults (e.g. agent-tool) */
278
1665
  additionalTools?: IToolWithEventService[];
1666
+ /** Additional background task runners composed by the runtime shell. */
1667
+ backgroundTaskRunners?: IBackgroundTaskRunner[];
1668
+ /** Runtime shell override for subagent execution. Defaults to the SDK in-process runner. */
1669
+ subagentRunnerFactory?: TSubagentRunnerFactory;
1670
+ /** Enable agent tool, agent definitions, and subagent runtime wiring for this session. */
1671
+ enableAgentRuntime?: boolean;
1672
+ /** Callback when a tool starts or finishes execution — enables real-time tool display in UI */
1673
+ onToolExecution?: (event: {
1674
+ type: 'start' | 'end';
1675
+ toolName: string;
1676
+ toolArgs?: TToolArgs;
1677
+ success?: boolean;
1678
+ denied?: boolean;
1679
+ toolResultData?: string;
1680
+ }) => void;
279
1681
  /** Callback when context is compacted */
280
1682
  onCompact?: (summary: string) => void;
1683
+ /** Callback with structured compaction metadata */
1684
+ onCompactEvent?: (event: ICompactEvent) => void;
281
1685
  /** Instructions to include in the compaction prompt (e.g. from CLAUDE.md) */
282
1686
  compactInstructions?: string;
1687
+ /** Auto-compact threshold as a 0-1 fraction. Set false to disable automatic compaction. */
1688
+ autoCompactThreshold?: TAutoCompactThreshold;
283
1689
  /** Custom system prompt builder function */
284
1690
  systemPromptBuilder?: (params: ISystemPromptParams) => string;
285
1691
  /** Custom tool descriptions for the system prompt */
286
1692
  toolDescriptions?: string[];
287
1693
  /** Session logger — injected for pluggable session event logging. */
288
1694
  sessionLogger?: ISessionLogger;
1695
+ /** Provider factory for prompt hook executors (DI). */
1696
+ providerFactory?: TProviderFactory;
1697
+ /** Session factory for agent hook executors (DI). */
1698
+ sessionFactory?: TSessionFactory;
1699
+ /** Additional hook type executors beyond the defaults (prompt, agent). */
1700
+ additionalHookExecutors?: IHookTypeExecutor[];
1701
+ /** Override session ID (used when resuming a session to reuse the original ID) */
1702
+ sessionId?: string;
1703
+ /** Pre-approved tool names — added to permissions.allow as ToolName(*) patterns. */
1704
+ allowedTools?: string[];
1705
+ /** Text to append to the generated system prompt. */
1706
+ appendSystemPrompt?: string;
1707
+ /** Model command execution bridge. */
1708
+ modelCommandExecutor?: (command: string, args: string) => Promise<ICommandResult | null>;
1709
+ /** Predicate for commands allowed through the model command execution bridge. */
1710
+ isModelCommandInvocable?: (command: string) => boolean;
1711
+ /** Model-visible command descriptors. */
1712
+ commandDescriptors?: ICapabilityDescriptor[];
1713
+ /** Recorder used to snapshot files before Write/Edit tools mutate them. */
1714
+ editCheckpointRecorder?: IEditCheckpointRecorder;
1715
+ /** Opt-in local-first reversible execution policy for write/shell tools. */
1716
+ reversibleExecution?: IReversibleExecutionOptions;
289
1717
  }
290
- /**
291
- * Create a fully-configured Session instance.
292
- *
293
- * Assembles provider, tools, and system prompt, then passes them
294
- * to Session as pre-constructed dependencies.
295
- */
296
- declare function createSession(options: ICreateSessionOptions): Session;
297
1718
 
298
1719
  /**
299
1720
  * Default tool set factory — creates the standard set of CLI tools.
300
1721
  */
301
1722
 
302
- /** Human-readable descriptions of the built-in tools (for system prompt) */
303
- declare const DEFAULT_TOOL_DESCRIPTIONS: string[];
304
1723
  /**
305
1724
  * Create the default set of CLI tools.
306
1725
  * Returns the 8 standard tools as IToolWithEventService[].
@@ -308,54 +1727,409 @@ declare const DEFAULT_TOOL_DESCRIPTIONS: string[];
308
1727
  declare function createDefaultTools(): IToolWithEventService[];
309
1728
 
310
1729
  /**
311
- * Provider factory creates an AI provider from resolved config.
1730
+ * Framework system prompt suffixes for subagent sessions.
1731
+ *
1732
+ * These functions generate the standard prompt content injected into
1733
+ * subagent sessions to control output format and behavior.
1734
+ */
1735
+ /** Options for assembling a subagent system prompt. */
1736
+ interface ISubagentPromptOptions {
1737
+ /** Agent definition markdown body. */
1738
+ agentBody: string;
1739
+ /** CLAUDE.md content to include. */
1740
+ claudeMd?: string;
1741
+ /** AGENTS.md content to include. */
1742
+ agentsMd?: string;
1743
+ /** When true, use fork worker suffix instead of standard subagent suffix. */
1744
+ isForkWorker: boolean;
1745
+ }
1746
+ /**
1747
+ * Returns the standard subagent suffix appended to agent body for normal subagents.
1748
+ */
1749
+ declare function getSubagentSuffix(): string;
1750
+ /**
1751
+ * Returns the fork worker suffix for context:fork skill workers.
1752
+ */
1753
+ declare function getForkWorkerSuffix(): string;
1754
+ /**
1755
+ * Assembles the full system prompt for a subagent.
1756
+ *
1757
+ * Assembly order:
1758
+ * 1. Agent definition body
1759
+ * 2. CLAUDE.md content (if provided)
1760
+ * 3. AGENTS.md content (if provided)
1761
+ * 4. Framework suffix (fork worker OR standard subagent)
1762
+ */
1763
+ declare function assembleSubagentPrompt(options: ISubagentPromptOptions): string;
1764
+
1765
+ /**
1766
+ * Subagent transcript logger — creates a FileSessionLogger that writes
1767
+ * subagent session logs into a subdirectory of the parent session's log folder.
1768
+ *
1769
+ * Log structure:
1770
+ * {baseLogsDir}/{parentSessionId}/subagents/{agentId}.jsonl
312
1771
  */
313
1772
 
314
1773
  /**
315
- * Create an AI provider from the resolved config.
316
- * Currently supports Anthropic only. Throws if no API key is available.
1774
+ * Create a FileSessionLogger for a subagent session.
1775
+ *
1776
+ * The logger writes JSONL files into a `subagents/` subdirectory under the
1777
+ * parent session's log folder. The directory is created if it does not exist.
1778
+ *
1779
+ * @param parentSessionId - ID of the parent session (used as directory name)
1780
+ * @param agentId - Unique identifier for this subagent run
1781
+ * @param baseLogsDir - Root logs directory (e.g., `.robota/logs`)
1782
+ * @returns A FileSessionLogger writing to the subagent directory
317
1783
  */
318
- declare function createProvider(config: IResolvedConfig): IAIProvider;
1784
+ declare function createSubagentLogger(parentSessionId: string, _agentId: string, baseLogsDir: string): FileSessionLogger;
1785
+ /**
1786
+ * Resolve the subagent log directory path without creating it.
1787
+ *
1788
+ * Useful when the caller needs the path for display or configuration
1789
+ * but does not want to create the directory immediately.
1790
+ *
1791
+ * @param parentSessionId - ID of the parent session
1792
+ * @param baseLogsDir - Root logs directory
1793
+ * @returns The resolved subagent log directory path
1794
+ */
1795
+ declare function resolveSubagentLogDir(parentSessionId: string, baseLogsDir: string): string;
1796
+
1797
+ /**
1798
+ * Session initialization helpers for InteractiveSession.
1799
+ *
1800
+ * Handles async config/context loading, plugin merging, and session creation.
1801
+ * Also provides session-restore (resume/fork) logic.
1802
+ */
1803
+
1804
+ /** Standard construction: cwd + provider. Config/context loaded internally. */
1805
+ interface IInteractiveSessionStandardOptions {
1806
+ cwd: string;
1807
+ provider: IAIProvider;
1808
+ permissionMode?: ICreateSessionOptions['permissionMode'];
1809
+ maxTurns?: number;
1810
+ permissionHandler?: TInteractivePermissionHandler;
1811
+ sessionStore?: SessionStore;
1812
+ sessionName?: string;
1813
+ resumeSessionId?: string;
1814
+ forkSession?: boolean;
1815
+ /** Skip AGENTS.md/CLAUDE.md loading and plugin discovery. */
1816
+ bare?: boolean;
1817
+ /** Pre-approved tool names passed to createSession. */
1818
+ allowedTools?: string[];
1819
+ /** Text to append to the system prompt. */
1820
+ appendSystemPrompt?: string;
1821
+ /** Runtime-composed background task runners. */
1822
+ backgroundTaskRunners?: IBackgroundTaskRunner[];
1823
+ /** Runtime shell override for subagent execution. */
1824
+ subagentRunnerFactory?: TSubagentRunnerFactory;
1825
+ /** Optional command modules composed into this session. */
1826
+ commandModules?: readonly ICommandModule[];
1827
+ /** Host adapters available to composed command modules. */
1828
+ commandHostAdapters?: ICommandHostAdapters;
1829
+ /** Model-visible command descriptors derived from the composed command executor. */
1830
+ commandDescriptors?: readonly ICapabilityDescriptor[];
1831
+ /** Model command execution bridge. */
1832
+ modelCommandExecutor?: (command: string, args: string) => Promise<ICommandResult | null>;
1833
+ /** Predicate for commands allowed through the model command execution bridge. */
1834
+ isModelCommandInvocable?: (command: string) => boolean;
1835
+ /** Preloaded config to avoid duplicate discovery when caller needs it too. */
1836
+ config?: IResolvedConfig;
1837
+ /** Opt-in local-first reversible execution policy for write/shell tools. */
1838
+ reversibleExecution?: IReversibleExecutionOptions;
1839
+ }
1840
+ /** Test/advanced construction: inject pre-built session directly. */
1841
+ interface IInteractiveSessionInjectedOptions {
1842
+ session: Session;
1843
+ cwd?: string;
1844
+ provider?: IAIProvider;
1845
+ permissionMode?: ICreateSessionOptions['permissionMode'];
1846
+ maxTurns?: number;
1847
+ permissionHandler?: TInteractivePermissionHandler;
1848
+ sessionStore?: SessionStore;
1849
+ sessionName?: string;
1850
+ resumeSessionId?: string;
1851
+ forkSession?: boolean;
1852
+ /** Optional command modules composed into this injected session. */
1853
+ commandModules?: readonly ICommandModule[];
1854
+ /** Host adapters available to composed command modules. */
1855
+ commandHostAdapters?: ICommandHostAdapters;
1856
+ }
1857
+ /** Union of standard and injected construction options. */
1858
+ type IInteractiveSessionOptions = IInteractiveSessionStandardOptions | IInteractiveSessionInjectedOptions;
1859
+
1860
+ /**
1861
+ * InteractiveSession — the single entry point for all SDK consumers.
1862
+ *
1863
+ * Wraps Session (composition). Manages streaming text accumulation,
1864
+ * tool execution state tracking, prompt queuing, abort orchestration,
1865
+ * message history, and system command execution.
1866
+ *
1867
+ * Config/context loading is internal. Consumer provides cwd + provider.
1868
+ */
1869
+
1870
+ interface IInteractiveSessionShutdownOptions {
1871
+ reason?: TSessionEndReason;
1872
+ message?: string;
1873
+ }
1874
+ declare class InteractiveSession {
1875
+ private session;
1876
+ private readonly commandExecutor;
1877
+ private readonly listeners;
1878
+ private initialized;
1879
+ private initPromise;
1880
+ private streamingText;
1881
+ private flushTimer;
1882
+ private activeTools;
1883
+ private executing;
1884
+ private pendingPrompt;
1885
+ private pendingDisplayInput;
1886
+ private pendingRawInput;
1887
+ private history;
1888
+ private sessionStore?;
1889
+ private sessionName?;
1890
+ private cwd?;
1891
+ private pendingRestoreMessages;
1892
+ private backgroundTasks;
1893
+ private backgroundTaskEvents;
1894
+ private backgroundJobGroups;
1895
+ private backgroundJobGroupEvents;
1896
+ private memoryEvents;
1897
+ private usedMemoryReferences;
1898
+ private editCheckpointStore;
1899
+ private resumeSessionId?;
1900
+ private forkSession;
1901
+ private backgroundTaskUnsubscribe;
1902
+ private backgroundJobUnsubscribe;
1903
+ private backgroundJobOrchestrator;
1904
+ private readonly commandModules;
1905
+ private readonly commandHostAdapters?;
1906
+ private autoCompactThresholdSource;
1907
+ private shuttingDown;
1908
+ private shutdownPromise;
1909
+ constructor(options: IInteractiveSessionOptions);
1910
+ private initializeAsync;
1911
+ private ensureInitialized;
1912
+ private getSessionOrThrow;
1913
+ on<E extends TInteractiveEventName>(event: E, handler: IInteractiveSessionEvents[E]): void;
1914
+ off<E extends TInteractiveEventName>(event: E, handler: IInteractiveSessionEvents[E]): void;
1915
+ private emit;
1916
+ submit(input: string, displayInput?: string, rawInput?: string): Promise<void>;
1917
+ executeCommand(name: string, args: string): Promise<ICommandResult | null>;
1918
+ executeModelCommand(name: string, args: string): Promise<ICommandResult | null>;
1919
+ executeSkillCommand(skill: ICommand, args: string, displayInput?: string, rawInput?: string): Promise<ISkillExecutionResult>;
1920
+ listCommands(): Array<{
1921
+ name: string;
1922
+ description: string;
1923
+ }>;
1924
+ listModelInvocableCommands(): Array<{
1925
+ name: string;
1926
+ description: string;
1927
+ }>;
1928
+ abort(): void;
1929
+ shutdown(options?: IInteractiveSessionShutdownOptions): Promise<void>;
1930
+ cancelQueue(): void;
1931
+ private clearPendingQueue;
1932
+ isExecuting(): boolean;
1933
+ getPendingPrompt(): string | null;
1934
+ getFullHistory(): IHistoryEntry[];
1935
+ getMessages(): TUniversalMessage[];
1936
+ getStreamingText(): string;
1937
+ getActiveTools(): IToolState[];
1938
+ getContextState(): IContextWindowState;
1939
+ getAutoCompactThreshold(): number | false;
1940
+ getAutoCompactThresholdSource(): TAutoCompactThresholdSource;
1941
+ setAutoCompactThreshold(threshold: TAutoCompactThreshold$1, source?: TAutoCompactThresholdSource): void;
1942
+ getCommandHostAdapters(): ICommandHostAdapters;
1943
+ clearConversationHistory(): void;
1944
+ compactContext(instructions?: string): Promise<void>;
1945
+ getName(): string | undefined;
1946
+ getCwd(): string;
1947
+ getSession(): Session;
1948
+ listEditCheckpoints(): IEditCheckpointSummary[];
1949
+ inspectEditCheckpoint(checkpointId: string): IEditCheckpointInspection;
1950
+ restoreEditCheckpoint(checkpointId: string): Promise<IEditCheckpointRestoreResult>;
1951
+ rollbackEditCheckpoint(checkpointId: string): Promise<IEditCheckpointRestoreResult>;
1952
+ getUsedMemoryReferences(): IMemoryReference[];
1953
+ recordMemoryEvent(event: IMemoryEvent): void;
1954
+ listBackgroundTasks(filter?: IBackgroundTaskListFilter): IBackgroundTaskState[];
1955
+ getBackgroundTask(taskId: string): IBackgroundTaskState | undefined;
1956
+ cancelBackgroundTask(taskId: string, reason?: string): Promise<void>;
1957
+ closeBackgroundTask(taskId: string): Promise<void>;
1958
+ sendBackgroundTask(taskId: string, input: IBackgroundTaskInput): Promise<void>;
1959
+ readBackgroundTaskLog(taskId: string, cursor?: IBackgroundTaskLogCursor): Promise<IBackgroundTaskLogPage>;
1960
+ createBackgroundJobGroup(input: Omit<IBackgroundJobGroupCreateRequest, 'parentSessionId'>): IBackgroundJobGroupState;
1961
+ listBackgroundJobGroups(): IBackgroundJobGroupState[];
1962
+ getBackgroundJobGroup(groupId: string): IBackgroundJobGroupState | undefined;
1963
+ waitBackgroundJobGroup(groupId: string): Promise<IBackgroundJobGroupState>;
1964
+ listAgentDefinitions(): Array<{
1965
+ name: string;
1966
+ description: string;
1967
+ }>;
1968
+ listAgentJobs(): ISubagentJobState[];
1969
+ spawnAgentJob(input: {
1970
+ agentType: string;
1971
+ label: string;
1972
+ mode: 'foreground' | 'background';
1973
+ prompt: string;
1974
+ model?: string;
1975
+ isolation?: TBackgroundTaskIsolation;
1976
+ }): Promise<ISubagentJobState>;
1977
+ waitAgentJob(jobId: string): Promise<ISubagentJobResult>;
1978
+ sendAgentJob(jobId: string, prompt: string): Promise<void>;
1979
+ cancelAgentJob(jobId: string, reason?: string): Promise<void>;
1980
+ closeAgentJob(jobId: string): Promise<void>;
1981
+ setName(name: string): void;
1982
+ attachTransport(transport: ITransportAdapter): void;
1983
+ private executeForkSkillCommand;
1984
+ private getBackgroundTaskManagerOrThrow;
1985
+ private getBackgroundTaskManager;
1986
+ private getBackgroundJobOrchestratorOrThrow;
1987
+ private getAgentToolDepsOrThrow;
1988
+ private getSubagentManagerOrThrow;
1989
+ private resolveAgentDefinition;
1990
+ private subscribeBackgroundTaskEvents;
1991
+ private subscribeBackgroundJobGroupEvents;
1992
+ private recordBackgroundTaskEvent;
1993
+ private recordBackgroundJobGroupEvent;
1994
+ private getBackgroundTaskSnapshots;
1995
+ private getBackgroundJobGroupSnapshots;
1996
+ private persistCurrentSession;
1997
+ private startForkSkillExecution;
1998
+ private finishForkSkillExecution;
1999
+ private recordForkSkillError;
2000
+ private resolveForkAgentDefinition;
2001
+ private runSkillInFork;
2002
+ private applyForkSkillResult;
2003
+ private executeForegroundCommand;
2004
+ private executePrompt;
2005
+ private getEditCheckpointStore;
2006
+ private beginEditCheckpointTurn;
2007
+ private finalizeEditCheckpointTurn;
2008
+ private handleTextDelta;
2009
+ private handleCompactEvent;
2010
+ private handleToolExecution;
2011
+ private clearStreaming;
2012
+ private flushStreaming;
2013
+ }
319
2014
 
320
2015
  /**
321
- * query() — single entry point for running an AI agent conversation.
322
- * Automatically loads config, context, and project info.
2016
+ * createQuery() — factory that returns a prompt-only convenience function.
2017
+ *
2018
+ * Usage:
2019
+ * const query = createQuery({ provider });
2020
+ * const answer = await query('What files are here?');
323
2021
  */
324
2022
 
325
- interface IQueryOptions {
2023
+ interface ICreateQueryOptions {
2024
+ /** AI provider instance (required). */
2025
+ provider: IAIProvider;
2026
+ /** Working directory. Defaults to process.cwd(). */
326
2027
  cwd?: string;
2028
+ /** Permission mode. Defaults to 'bypassPermissions' for programmatic use. */
327
2029
  permissionMode?: TPermissionMode;
2030
+ /** Maximum agentic turns per query. */
328
2031
  maxTurns?: number;
329
- provider?: IAIProvider;
330
- permissionHandler?: (toolName: string, toolArgs: TToolArgs) => Promise<boolean>;
2032
+ /** Permission handler callback. */
2033
+ permissionHandler?: TInteractivePermissionHandler;
2034
+ /** Streaming text callback. */
331
2035
  onTextDelta?: (delta: string) => void;
332
- /** Callback when context is compacted */
333
- onCompact?: (summary: string) => void;
334
2036
  }
335
2037
  /**
336
- * query() single entry point for running an AI agent conversation.
337
- * Equivalent to Claude Agent SDK's query() function.
338
- * Automatically loads config, context, and project info.
2038
+ * Create a prompt-only query function bound to a provider.
2039
+ *
2040
+ * ```typescript
2041
+ * import { createQuery } from '@robota-sdk/agent-sdk';
2042
+ * import { AnthropicProvider } from '@robota-sdk/agent-provider-anthropic';
2043
+ *
2044
+ * const query = createQuery({ provider: new AnthropicProvider({ apiKey: '...' }) });
2045
+ * const answer = await query('List all TypeScript files');
2046
+ * ```
339
2047
  */
340
- declare function query(prompt: string, options?: IQueryOptions): Promise<string>;
2048
+ declare function createQuery(options: ICreateQueryOptions): (prompt: string) => Promise<string>;
2049
+
2050
+ type TSelfHostingVerificationPhase = 'checkpoint' | 'edit' | 'handoff' | 'verify' | 'recover';
2051
+ type TSelfHostingLoopState = 'idle' | 'checkpointed' | 'editing' | 'verifying' | 'passed' | 'failed' | 'rolled_back' | 'cancelled';
2052
+ type TSelfHostingLoopEvent = 'checkpoint_created' | 'edits_started' | 'edits_applied' | 'verify_passed' | 'verify_failed' | 'rollback_completed' | 'cancelled';
2053
+ interface ISelfHostingVerificationPlanInput {
2054
+ changedFiles: readonly string[];
2055
+ packageScopes?: readonly string[];
2056
+ baseRef?: string;
2057
+ }
2058
+ interface ISelfHostingVerificationStep {
2059
+ id: string;
2060
+ phase: TSelfHostingVerificationPhase;
2061
+ description: string;
2062
+ required: boolean;
2063
+ command?: string;
2064
+ }
2065
+ interface ISelfHostingVerificationPlan {
2066
+ changedFiles: readonly string[];
2067
+ packageScopes: readonly string[];
2068
+ baseRef: string;
2069
+ steps: readonly ISelfHostingVerificationStep[];
2070
+ }
2071
+ declare function planSelfHostingVerification(input: ISelfHostingVerificationPlanInput): ISelfHostingVerificationPlan;
2072
+ declare function transitionSelfHostingLoop(state: TSelfHostingLoopState, event: TSelfHostingLoopEvent): TSelfHostingLoopState;
341
2073
 
342
2074
  /**
343
- * Load and merge all settings files, validate with Zod, return resolved config.
344
- *
345
- * @param cwd - The working directory (project root) to search for .robota/
2075
+ * All built-in agent definitions shipped with the SDK.
2076
+ * Order matters: general-purpose is the default fallback.
346
2077
  */
347
- declare function loadConfig(cwd: string): Promise<IResolvedConfig>;
2078
+ declare const BUILT_IN_AGENTS: IAgentDefinition[];
2079
+ /**
2080
+ * Look up a built-in agent definition by name.
2081
+ * Returns `undefined` if no built-in agent matches.
2082
+ */
2083
+ declare function getBuiltInAgent(name: string): IAgentDefinition | undefined;
348
2084
 
349
2085
  /**
350
- * Permission prompt this is now CLI-specific.
351
- * Re-exported here for backward compatibility.
352
- * The canonical implementation lives in @robota-sdk/agent-cli.
2086
+ * AgentToolspawn a sub-agent with isolated context.
2087
+ *
2088
+ * Uses `SubagentManager` with an in-process runner to assemble a child Session
2089
+ * with filtered tools, model resolution, and framework system prompt. The
2090
+ * sub-agent shares the same config and context but has its own conversation
2091
+ * history.
2092
+ *
2093
+ * Each call to `createAgentTool(deps)` returns a fresh tool instance with deps
2094
+ * captured in closure, eliminating module-level mutable state and enabling
2095
+ * multiple concurrent sessions without race conditions.
353
2096
  */
354
2097
 
2098
+ /** Dependencies injected at creation time via createAgentTool factory */
2099
+ interface IAgentToolDeps extends IInProcessSubagentRunnerDeps {
2100
+ cwd?: string;
2101
+ parentSessionId?: string;
2102
+ subagentDepth?: number;
2103
+ subagentManager?: ISubagentManager;
2104
+ backgroundTaskManager?: IBackgroundTaskManager;
2105
+ /** Optional custom agent registry for resolving non-built-in agent types. */
2106
+ customAgentRegistry?: (name: string) => IAgentDefinition | undefined;
2107
+ /** Model-visible and command-visible agent definitions available to this session. */
2108
+ agentDefinitions?: IAgentDefinition[];
2109
+ }
2110
+ /** Store agent tool deps keyed by a session (or any object). */
2111
+ declare function storeAgentToolDeps(key: object, deps: IAgentToolDeps): void;
2112
+ /** Retrieve agent tool deps for a given session key. */
2113
+ declare function retrieveAgentToolDeps(key: object): IAgentToolDeps | undefined;
355
2114
  /**
356
- * Prompt the user for approval before running a tool.
2115
+ * Create an agent tool instance with deps captured in closure.
2116
+ *
2117
+ * Each session gets its own tool instance — no shared mutable state.
357
2118
  */
358
- declare function promptForApproval(terminal: ITerminalOutput, toolName: string, toolArgs: TToolArgs): Promise<boolean>;
2119
+ declare function createAgentTool(deps: IAgentToolDeps): ReturnType<typeof createZodFunctionTool>;
2120
+
2121
+ interface ICommandExecutionToolDeps {
2122
+ isModelInvocable: (command: string) => boolean;
2123
+ execute: (command: string, args: string) => Promise<ICommandResult | null>;
2124
+ }
2125
+ declare function createCommandExecutionTool(deps: ICommandExecutionToolDeps): ReturnType<typeof createZodFunctionTool>;
2126
+
2127
+ interface IBackgroundProcessToolDeps {
2128
+ backgroundTaskManager: IBackgroundTaskManager;
2129
+ cwd?: string;
2130
+ parentSessionId?: string;
2131
+ }
2132
+ declare function createBackgroundProcessTool(deps: IBackgroundProcessToolDeps): ReturnType<typeof createZodFunctionTool>;
359
2133
 
360
2134
  /**
361
2135
  * Standard Robota storage paths.
@@ -369,6 +2143,8 @@ declare function projectPaths(cwd: string): {
369
2143
  settingsLocal: string;
370
2144
  logs: string;
371
2145
  sessions: string;
2146
+ memory: string;
2147
+ checkpoints: string;
372
2148
  };
373
2149
  /** User-level ~/.robota/ paths. */
374
2150
  declare function userPaths(): {
@@ -376,14 +2152,42 @@ declare function userPaths(): {
376
2152
  sessions: string;
377
2153
  };
378
2154
 
379
- /** Dependencies injected at registration time */
380
- interface IAgentToolDeps {
381
- config: IResolvedConfig;
382
- context: ILoadedContext;
383
- projectInfo?: IProjectInfo;
2155
+ type TTaskFileStatus = 'todo' | 'in-progress' | 'blocked' | 'completed' | 'unknown';
2156
+ interface ITaskContextFile {
2157
+ path: string;
2158
+ relativePath: string;
2159
+ title: string;
2160
+ status: TTaskFileStatus;
2161
+ branch?: string;
2162
+ scope?: string;
2163
+ objective?: string;
2164
+ openItems: readonly string[];
384
2165
  }
385
- /** Set dependencies for the agent tool. Must be called before tool is used. */
386
- declare function setAgentToolDeps(deps: IAgentToolDeps): void;
387
- declare const agentTool: _robota_sdk_agent_tools.FunctionTool;
2166
+ interface ITaskSelectionOptions {
2167
+ currentBranch?: string;
2168
+ maxTasks?: number;
2169
+ }
2170
+ interface IUpdateTaskFileStatusOptions {
2171
+ now?: Date;
2172
+ progressMessage?: string;
2173
+ }
2174
+ declare function readCurrentGitBranch(cwd: string): string | undefined;
2175
+ declare function discoverTaskFiles(cwd: string): string[];
2176
+ declare function parseTaskFile(taskPath: string, cwd: string): ITaskContextFile;
2177
+ declare function selectRelevantTasks(tasks: readonly ITaskContextFile[], options?: ITaskSelectionOptions): ITaskContextFile[];
2178
+ declare function formatTaskContext(tasks: readonly ITaskContextFile[]): string;
2179
+ declare function loadTaskContext(cwd: string, options?: ITaskSelectionOptions): string;
2180
+ declare function updateTaskFileStatus(taskPath: string, status: TTaskFileStatus, options?: IUpdateTaskFileStatusOptions): void;
2181
+
2182
+ /**
2183
+ * Interactive permission prompt — asks the user whether to allow a tool invocation
2184
+ * using an arrow-key selector. Canonical implementation (SSOT).
2185
+ * Used by both agent-sdk query() and agent-cli.
2186
+ */
2187
+
2188
+ /**
2189
+ * Prompt the user for approval before running a tool.
2190
+ */
2191
+ declare function promptForApproval(terminal: ITerminalOutput, toolName: string, toolArgs: TToolArgs): Promise<boolean>;
388
2192
 
389
- export { DEFAULT_TOOL_DESCRIPTIONS, type ICreateSessionOptions, type ILoadedContext, type IProjectInfo, type IQueryOptions, type IResolvedConfig, type ISystemPromptParams, agentTool, buildSystemPrompt, createDefaultTools, createProvider, createSession, detectProject, loadConfig, loadContext, projectPaths, promptForApproval, query, setAgentToolDeps, userPaths };
2193
+ export { AUTO_COMPACT_THRESHOLD_SETTINGS_KEY, AgentExecutor, BACKGROUND_COMMAND_DESCRIPTION, BACKGROUND_COMMAND_USAGE, BUILT_IN_AGENTS, BackgroundJobOrchestrator, BuiltinCommandSource, BundlePluginInstaller, BundlePluginLoader, CLEAR_COMMAND_DESCRIPTION, COST_COMMAND_DESCRIPTION, CommandRegistry, DEFAULT_AUTO_COMPACT_THRESHOLD, DEFAULT_STATUS_LINE_COMMAND_SETTINGS, EXIT_COMMAND_DESCRIPTION, EditCheckpointStore, HELP_COMMAND_DESCRIPTION, type IAgentDefinition, type IAgentExecutorOptions, type IAgentSession, type IAgentToolDeps, type IAppendMemoryInput, type IAppendMemoryResult, type IBackgroundJobGroupCreateRequest, type IBackgroundJobGroupState, type IBackgroundJobGroupSummary, type IBackgroundJobOrchestratorOptions, type IBackgroundJobResultEnvelope, type IBackgroundProcessToolDeps, type IBundlePluginFeatures, type IBundlePluginInstallerOptions, type IBundlePluginManifest, type IBundleSkill, type ICapabilityDescriptor, type ICommand, type ICommandAvailablePlugin, type ICommandChoicePromptOption, type ICommandExecutionToolDeps, type ICommandHostAdapters, type ICommandHostContext, type ICommandInstalledPlugin, type ICommandInteraction, type ICommandListEntry, type ICommandMarketplaceSource, type ICommandMemoryStores, type ICommandModule, type ICommandPendingMemoryStore, type ICommandPermissionModeAdapter, type ICommandPickerAdapter, type ICommandPluginAdapter, type ICommandPluginReloadResult, type ICommandProcessAdapter, type ICommandProjectMemoryStore, type ICommandResult, type ICommandSessionInfo, type ICommandSessionRuntime, type ICommandSettingsAdapter, type ICommandSettingsDocument, type ICommandSource, type ICompactContextResult, type ICreateQueryOptions, type IDiffLine, type IEditCheckpointFileInspection, type IEditCheckpointFileRecord, type IEditCheckpointInspection, type IEditCheckpointInspectionPlan, type IEditCheckpointManifest, type IEditCheckpointRecorder, type IEditCheckpointRestoreResult, type IEditCheckpointSummary, type IEditCheckpointTurnInput, type IExecutionResult, type IForkExecutionOptions, type IInProcessSubagentRunnerDeps, type IInstalledPluginRecord, type IInstalledPluginsRegistry, type IInteractiveSessionEvents, type IInteractiveSessionOptions, type IInteractiveSessionShutdownOptions, type IKnownMarketplaceEntry, type IKnownMarketplacesRegistry, type ILegacyProviderSettings, type ILoadedBundlePlugin, type IMarketplaceClientOptions, type IMarketplaceManifest, type IMarketplacePluginEntry, type IMarketplaceSource, type IMemoryCandidate, type IMemoryEvent, type IMemoryPendingRecord, type IMemoryReference, type IPermissionsCommandState, type IPluginSettings, type IProjectMemorySummary, type IPromptExecutorOptions, type IPromptProvider, type IProviderCommandModuleOptions, type IProviderCommandSettingsAdapter, type IProviderProfileSettings, type IProviderSettingsBuildOptions, type IProviderSetupFlowState, type IProviderSetupInput, type IProviderSetupPatch, type IProviderSetupPromptStep, type IReversibleExecutionOptions, type IReversibleToolSafetyContext, type IReversibleToolSafetyInput, type IReversibleToolSafetyReport, type ISelfHostingVerificationPlan, type ISelfHostingVerificationPlanInput, type ISelfHostingVerificationStep, type ISkillExecutionCallbacks, type ISkillExecutionResult, type IStartupMemory, type IStatusLineCommandSettings, type ISubagentOptions, type ISubagentPromptOptions, type ISystemCommand, type ITaskContextFile, type ITaskSelectionOptions, type IToolState, type IToolSummary, type ITransportAdapter, type IUpdateTaskFileStatusOptions, type IUsageSnapshot, InteractiveSession, LANGUAGE_COMMAND_ARGUMENT_HINT, LANGUAGE_COMMAND_DESCRIPTION, MEMORY_COMMAND_ARGUMENT_HINT, MEMORY_COMMAND_DESCRIPTION, MEMORY_COMMAND_USAGE, MEMORY_INDEX_MAX_BYTES, MEMORY_INDEX_MAX_LINES, MODEL_COMMAND_ARGUMENT_HINT, MODEL_COMMAND_DESCRIPTION, MarketplaceClient, PERMISSIONS_COMMAND_DESCRIPTION, PERMISSION_MODE_ARGUMENT_HINT, PERMISSION_MODE_COMMAND_DESCRIPTION, PLUGIN_COMMAND_ARGUMENT_HINT, PLUGIN_COMMAND_DESCRIPTION, PluginCommandSource, PluginSettingsStore, ProjectMemoryStore, PromptExecutor, RECOMMENDED_RESPONSE_LANGUAGES, RELOAD_PLUGINS_COMMAND_DESCRIPTION, RENAME_COMMAND_DESCRIPTION, RENAME_COMMAND_USAGE, RESUME_COMMAND_DESCRIPTION, REWIND_COMMAND_ARGUMENT_HINT, REWIND_COMMAND_DESCRIPTION, STATUSLINE_COMMAND_ARGUMENT_HINT, STATUSLINE_COMMAND_DESCRIPTION, SkillCommandSource, type SkillPromptContext, SystemCommandExecutor, type TAutoCompactThreshold$1 as TAutoCompactThreshold, type TAutoCompactThresholdSource, type TBackgroundJobGroupEvent, type TBackgroundJobGroupEventListener, type TBackgroundJobGroupIdFactory, type TBackgroundJobGroupStatus, type TBackgroundJobWaitPolicy, type TCapabilityKind, type TCapabilitySafety, type TCommandEffect, type TCommandInteractionPrompt, type TCommandModuleSessionRequirement, type TCommandResultDataValue, type TEditCheckpointFileRestoreAction, type TEnabledPlugins, type TInteractiveEventName, type TInteractivePermissionHandler, type TMemoryCandidateStatus, type TMemoryType, type TPermissionResultValue, type TPluginInstallScope, type TPromptInput, type TProviderFactory, type TProviderSettingsDocument, type TProviderSetupFlowSubmitResult, type TProviderSetupType, type TRecommendedResponseLanguage, type TReversibleExecutionIsolation, type TReversibleRollbackLayer, type TReversibleSafetyStatus, type TReversibleSideEffect, type TSelfHostingLoopEvent, type TSelfHostingLoopState, type TSelfHostingVerificationPhase, type TSessionFactory, type TStatusLineCommandSettingsPatch, type TSubagentRunnerFactory, type TSystemCommandLifecycle, type TTaskFileStatus, VALID_PERMISSION_MODES, assembleSubagentPrompt, buildBackgroundCommandSubcommands, buildLanguageCommandSubcommands, buildMemoryCommandSubcommands, buildModelCommandSubcommands, buildPermissionModeSubcommands, buildPluginCommandSubcommands, buildProviderProfile, buildProviderSetupPatch, buildRewindCommandSubcommands, buildSkillPrompt, buildStatusLineCommandSubcommands, cancelCommandBackgroundTask, clearConversationHistory, closeCommandBackgroundTask, compactCommandContext, createAgentTool, createBackgroundProcessTool, createBuiltinCommandModule, createCommandExecutionTool, createCommandMemoryStores, createCommandPendingMemoryStore, createCommandProjectMemoryStore, createDefaultTools, createPluginRegistryReloadRequestedEffect, createPluginTuiRequestedEffect, createProviderSetupFlow, createQuery, createSessionExitRequestedEffect, createSessionPickerRequestedEffect, createSessionRenamedEffect, createSubagentLogger, createSubagentSession, createSystemCommands, discoverTaskFiles, evaluateReversibleToolSafety, executeSkill, formatCommandBackgroundTask, formatCommandBackgroundTaskList, formatCommandHelpMessage, formatCommandPermissionsMessage, formatEnvReference, formatInvalidPermissionModeMessage, formatLanguageUsageMessage, formatProviderSetupChoiceLabel, formatProviderSetupPromptLabel, formatProviderSetupSelectionPrompt, formatTaskContext, getBuiltInAgent, getForkWorkerSuffix, getProviderSetupStep, getSubagentSuffix, hasSensitiveCommandMemoryContent, hasUsableSecretReference, inspectCommandEditCheckpoint, isCommandMemoryType, isEnvReference, isMemoryType, isPermissionMode, isStatusLineCommandSettingsPatch, listCommandBackgroundTasks, listCommandEditCheckpoints, listCommandSessionAllowedTools, listCommandUsedMemoryReferences, loadTaskContext, mergeProviderPatch, parseCommandBackgroundLogCursor, parseFrontmatter, parseLanguageArgument, parsePermissionModeArgument, parseSessionNameArgument, parseTaskFile, planSelfHostingVerification, preprocessShellCommands, probeProviderProfile, projectPaths, promptForApproval, readAutoCompactThreshold, readAutoCompactThresholdSource, readCommandBackgroundTaskLog, readCommandContextState, readCommandPermissionMode, readCommandPermissionsState, readCommandSessionInfo, readCurrentGitBranch, recordCommandMemoryEvent, resetAutoCompactThresholdSetting, resolveEnvReference, resolvePermissionModeAdapter, resolvePluginCommandAdapter, resolveProviderSetupSelection, resolveSubagentLogDir, restoreCommandEditCheckpoint, retrieveAgentToolDeps, rollbackCommandEditCheckpoint, runProviderSetupPromptFlow, selectRelevantTasks, setCommandAutoCompactThreshold, setCurrentProvider, storeAgentToolDeps, submitProviderSetupValue, substituteVariables, summarizeBackgroundJobGroup, testProviderProfileCommand, transitionSelfHostingLoop, updateTaskFileStatus, upsertProviderProfile, userPaths, validateProviderProfile, validateProviderSetupValue, wrapEditCheckpointTools, wrapReversibleExecutionTools, writeAutoCompactThresholdSetting, writeCommandPermissionMode };