@robota-sdk/agent-sdk 3.0.0-beta.59 → 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.
- package/README.md +8 -21
- package/dist/node/index.cjs +1690 -898
- package/dist/node/index.d.cts +738 -246
- package/dist/node/index.d.ts +738 -246
- package/dist/node/index.js +1487 -805
- package/package.json +5 -5
package/dist/node/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ITerminalOutput, ISessionLogger, TPermissionHandler, Session, SessionStore, FileSessionLogger } from '@robota-sdk/agent-sessions';
|
|
2
|
-
export { ISpinner, ITerminalOutput } from '@robota-sdk/agent-sessions';
|
|
3
|
-
import {
|
|
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
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,
|
|
5
|
+
import { IBackgroundTaskManager, TBackgroundTaskStatus, IBackgroundTaskError, IBackgroundTaskListFilter, IBackgroundTaskState, IBackgroundTaskLogCursor, IBackgroundTaskLogPage, TBackgroundTaskEvent, ISubagentRunner, IBackgroundTaskRunner, IBackgroundTaskInput, ISubagentJobState, TBackgroundTaskIsolation, ISubagentJobResult, ISubagentManager } from '@robota-sdk/agent-runtime';
|
|
6
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
7
|
import { createZodFunctionTool } from '@robota-sdk/agent-tools';
|
|
8
8
|
export { TToolResult } from '@robota-sdk/agent-tools';
|
|
@@ -62,41 +62,454 @@ interface ICommandSource {
|
|
|
62
62
|
getCommands(): ICommand[];
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
|
|
66
|
-
declare
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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>;
|
|
80
509
|
}
|
|
81
510
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
*
|
|
85
|
-
* Pure functions that operate on InteractiveSession.
|
|
86
|
-
* No React, no TUI, no framework dependencies.
|
|
87
|
-
* CLI wraps these as slash commands with UI chrome.
|
|
88
|
-
*/
|
|
89
|
-
|
|
90
|
-
/** Result of a system command execution. */
|
|
91
|
-
interface ICommandResult {
|
|
92
|
-
/** Human-readable output message */
|
|
93
|
-
message: string;
|
|
94
|
-
/** Command completed successfully */
|
|
95
|
-
success: boolean;
|
|
96
|
-
/** Additional structured data (command-specific) */
|
|
97
|
-
data?: Record<string, unknown>;
|
|
98
|
-
}
|
|
99
|
-
/** A system command with name, description, and execute logic. */
|
|
511
|
+
type TSystemCommandLifecycle = 'inline' | 'blocking' | 'background';
|
|
512
|
+
/** A user-visible command with descriptor metadata and execute logic. */
|
|
100
513
|
interface ISystemCommand {
|
|
101
514
|
name: string;
|
|
102
515
|
description: string;
|
|
@@ -104,10 +517,10 @@ interface ISystemCommand {
|
|
|
104
517
|
userInvocable?: boolean;
|
|
105
518
|
argumentHint?: string;
|
|
106
519
|
safety?: TCapabilitySafety;
|
|
107
|
-
|
|
520
|
+
subcommands?: readonly ICommand[];
|
|
521
|
+
lifecycle?: TSystemCommandLifecycle;
|
|
522
|
+
execute(context: ICommandHostContext, args: string): Promise<ICommandResult> | ICommandResult;
|
|
108
523
|
}
|
|
109
|
-
/** Built-in system commands. */
|
|
110
|
-
declare function createSystemCommands(): ISystemCommand[];
|
|
111
524
|
|
|
112
525
|
type TCommandModuleSessionRequirement = 'agent-runtime';
|
|
113
526
|
/** Composable command capability module. */
|
|
@@ -124,10 +537,213 @@ interface ICommandModule {
|
|
|
124
537
|
readonly sessionRequirements?: readonly TCommandModuleSessionRequirement[];
|
|
125
538
|
}
|
|
126
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
|
+
|
|
127
742
|
/** Aggregates commands from multiple sources */
|
|
128
743
|
declare class CommandRegistry {
|
|
129
744
|
private sources;
|
|
130
745
|
addSource(source: ICommandSource): void;
|
|
746
|
+
replaceSource(name: string, source?: ICommandSource): void;
|
|
131
747
|
addModule(module: ICommandModule): void;
|
|
132
748
|
/** Get all commands, optionally filtered by prefix */
|
|
133
749
|
getCommands(filter?: string): ICommand[];
|
|
@@ -138,13 +754,14 @@ declare class CommandRegistry {
|
|
|
138
754
|
getCapabilityDescriptors(): ICapabilityDescriptor[];
|
|
139
755
|
}
|
|
140
756
|
|
|
141
|
-
/** Command source for built-in commands */
|
|
757
|
+
/** Command source for SDK-owned built-in commands. */
|
|
142
758
|
declare class BuiltinCommandSource implements ICommandSource {
|
|
143
759
|
readonly name = "builtin";
|
|
144
760
|
private readonly commands;
|
|
145
|
-
constructor();
|
|
761
|
+
constructor(systemCommands?: readonly ISystemCommand[]);
|
|
146
762
|
getCommands(): ICommand[];
|
|
147
763
|
}
|
|
764
|
+
declare function createBuiltinCommandModule(): ICommandModule;
|
|
148
765
|
|
|
149
766
|
interface IFrontmatter {
|
|
150
767
|
name?: string;
|
|
@@ -536,6 +1153,28 @@ declare class PluginCommandSource implements ICommandSource {
|
|
|
536
1153
|
getCommands(): ICommand[];
|
|
537
1154
|
}
|
|
538
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
|
+
|
|
539
1178
|
/**
|
|
540
1179
|
* Build a skill prompt from slash command input.
|
|
541
1180
|
* Supports variable substitution and shell command preprocessing.
|
|
@@ -608,90 +1247,6 @@ interface ISkillExecutionResult {
|
|
|
608
1247
|
*/
|
|
609
1248
|
declare function executeSkill(skill: ICommand, args: string, callbacks: ISkillExecutionCallbacks, context?: SkillPromptContext): Promise<ISkillExecutionResult>;
|
|
610
1249
|
|
|
611
|
-
type TBackgroundJobWaitPolicy = 'detached' | 'wait_all' | 'wait_any' | 'manual';
|
|
612
|
-
type TBackgroundJobGroupStatus = 'running' | 'completed';
|
|
613
|
-
interface IBackgroundJobResultEnvelope {
|
|
614
|
-
taskId: string;
|
|
615
|
-
label: string;
|
|
616
|
-
status: TBackgroundTaskStatus;
|
|
617
|
-
summary?: string;
|
|
618
|
-
outputRef?: string;
|
|
619
|
-
error?: IBackgroundTaskError;
|
|
620
|
-
startedAt?: string;
|
|
621
|
-
completedAt?: string;
|
|
622
|
-
}
|
|
623
|
-
interface IBackgroundJobGroupState {
|
|
624
|
-
id: string;
|
|
625
|
-
parentSessionId: string;
|
|
626
|
-
waitPolicy: TBackgroundJobWaitPolicy;
|
|
627
|
-
taskIds: string[];
|
|
628
|
-
status: TBackgroundJobGroupStatus;
|
|
629
|
-
createdAt: string;
|
|
630
|
-
updatedAt: string;
|
|
631
|
-
label?: string;
|
|
632
|
-
completedAt?: string;
|
|
633
|
-
results: IBackgroundJobResultEnvelope[];
|
|
634
|
-
}
|
|
635
|
-
interface IBackgroundJobGroupSummary {
|
|
636
|
-
groupId: string;
|
|
637
|
-
status: TBackgroundJobGroupStatus;
|
|
638
|
-
total: number;
|
|
639
|
-
completed: number;
|
|
640
|
-
failed: number;
|
|
641
|
-
cancelled: number;
|
|
642
|
-
pending: number;
|
|
643
|
-
lines: string[];
|
|
644
|
-
}
|
|
645
|
-
interface IBackgroundJobGroupCreateRequest {
|
|
646
|
-
parentSessionId: string;
|
|
647
|
-
waitPolicy: TBackgroundJobWaitPolicy;
|
|
648
|
-
taskIds: string[];
|
|
649
|
-
label?: string;
|
|
650
|
-
}
|
|
651
|
-
type TBackgroundJobGroupEvent = {
|
|
652
|
-
type: 'background_job_group_created';
|
|
653
|
-
group: IBackgroundJobGroupState;
|
|
654
|
-
} | {
|
|
655
|
-
type: 'background_job_group_updated';
|
|
656
|
-
group: IBackgroundJobGroupState;
|
|
657
|
-
} | {
|
|
658
|
-
type: 'background_job_group_completed';
|
|
659
|
-
group: IBackgroundJobGroupState;
|
|
660
|
-
};
|
|
661
|
-
type TBackgroundJobGroupEventListener = (event: TBackgroundJobGroupEvent) => void;
|
|
662
|
-
type TBackgroundJobGroupIdFactory = (request: IBackgroundJobGroupCreateRequest) => string;
|
|
663
|
-
interface IBackgroundJobOrchestratorOptions {
|
|
664
|
-
manager: IBackgroundTaskManager;
|
|
665
|
-
now?: () => string;
|
|
666
|
-
idFactory?: TBackgroundJobGroupIdFactory;
|
|
667
|
-
initialGroups?: readonly IBackgroundJobGroupState[];
|
|
668
|
-
}
|
|
669
|
-
declare class BackgroundJobOrchestrator {
|
|
670
|
-
private readonly manager;
|
|
671
|
-
private readonly now;
|
|
672
|
-
private readonly idFactory;
|
|
673
|
-
private readonly unsubscribeManager;
|
|
674
|
-
private readonly listeners;
|
|
675
|
-
private readonly groups;
|
|
676
|
-
private sequence;
|
|
677
|
-
constructor(options: IBackgroundJobOrchestratorOptions);
|
|
678
|
-
createGroup(request: IBackgroundJobGroupCreateRequest): IBackgroundJobGroupState;
|
|
679
|
-
listGroups(): IBackgroundJobGroupState[];
|
|
680
|
-
getGroup(groupId: string): IBackgroundJobGroupState | undefined;
|
|
681
|
-
waitGroup(groupId: string): Promise<IBackgroundJobGroupState>;
|
|
682
|
-
subscribe(listener: TBackgroundJobGroupEventListener): () => void;
|
|
683
|
-
dispose(): void;
|
|
684
|
-
private nextGroupId;
|
|
685
|
-
private restoreGroup;
|
|
686
|
-
private createRecord;
|
|
687
|
-
private captureExistingTerminalTasks;
|
|
688
|
-
private handleTaskEvent;
|
|
689
|
-
private captureTask;
|
|
690
|
-
private evaluateCompletion;
|
|
691
|
-
private emit;
|
|
692
|
-
}
|
|
693
|
-
declare function summarizeBackgroundJobGroup(group: IBackgroundJobGroupState): IBackgroundJobGroupSummary;
|
|
694
|
-
|
|
695
1250
|
/**
|
|
696
1251
|
* Types for InteractiveSession — event-driven session wrapper.
|
|
697
1252
|
*/
|
|
@@ -750,6 +1305,7 @@ interface IInteractiveSessionEvents {
|
|
|
750
1305
|
complete: (result: IExecutionResult) => void;
|
|
751
1306
|
error: (error: Error) => void;
|
|
752
1307
|
context_update: (state: IContextWindowState) => void;
|
|
1308
|
+
compact: (event: ICompactEvent) => void;
|
|
753
1309
|
interrupted: (result: IExecutionResult) => void;
|
|
754
1310
|
background_task_event: (event: TBackgroundTaskEvent) => void;
|
|
755
1311
|
background_job_group_event: (event: TBackgroundJobGroupEvent) => void;
|
|
@@ -832,6 +1388,8 @@ interface IResolvedConfig {
|
|
|
832
1388
|
ref?: string;
|
|
833
1389
|
};
|
|
834
1390
|
}>;
|
|
1391
|
+
/** Auto-compact threshold as a 0-1 fraction. Set false to disable automatic compaction. */
|
|
1392
|
+
autoCompactThreshold?: number | false;
|
|
835
1393
|
}
|
|
836
1394
|
|
|
837
1395
|
interface ILoadedContext {
|
|
@@ -1034,36 +1592,36 @@ interface ISystemPromptParams {
|
|
|
1034
1592
|
commandDescriptors?: ICapabilityDescriptor[];
|
|
1035
1593
|
}
|
|
1036
1594
|
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
id: string;
|
|
1046
|
-
sessionId: string;
|
|
1047
|
-
sequence: number;
|
|
1048
|
-
prompt: string;
|
|
1049
|
-
createdAt: string;
|
|
1050
|
-
fileCount: number;
|
|
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;
|
|
1051
1603
|
}
|
|
1052
|
-
interface
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
snapshotFile?: string;
|
|
1604
|
+
interface IReversibleToolSafetyContext {
|
|
1605
|
+
checkpointAvailable: boolean;
|
|
1606
|
+
isolation: TReversibleExecutionIsolation;
|
|
1056
1607
|
}
|
|
1057
|
-
interface
|
|
1058
|
-
|
|
1059
|
-
|
|
1608
|
+
interface IReversibleToolSafetyInput {
|
|
1609
|
+
toolName: string;
|
|
1610
|
+
toolArgs?: TToolArgs;
|
|
1611
|
+
context: IReversibleToolSafetyContext;
|
|
1060
1612
|
}
|
|
1061
|
-
interface
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1613
|
+
interface IReversibleToolSafetyReport {
|
|
1614
|
+
toolName: string;
|
|
1615
|
+
reversible: boolean;
|
|
1616
|
+
sideEffect: TReversibleSideEffect;
|
|
1617
|
+
rollbackLayer: TReversibleRollbackLayer;
|
|
1618
|
+
status: TReversibleSafetyStatus;
|
|
1619
|
+
message: string;
|
|
1066
1620
|
}
|
|
1621
|
+
declare function evaluateReversibleToolSafety(input: IReversibleToolSafetyInput): IReversibleToolSafetyReport;
|
|
1622
|
+
declare function wrapReversibleExecutionTools(tools: readonly IToolWithEventService[], options: IReversibleExecutionOptions & {
|
|
1623
|
+
checkpointAvailable: boolean;
|
|
1624
|
+
}): IToolWithEventService[];
|
|
1067
1625
|
|
|
1068
1626
|
/**
|
|
1069
1627
|
* Session factory — assembles a fully-configured Session from config, context,
|
|
@@ -1074,6 +1632,7 @@ interface IEditCheckpointRestoreResult {
|
|
|
1074
1632
|
* expects as pre-constructed dependencies.
|
|
1075
1633
|
*/
|
|
1076
1634
|
|
|
1635
|
+
type TAutoCompactThreshold = number | false;
|
|
1077
1636
|
/** Options for the createSession factory */
|
|
1078
1637
|
interface ICreateSessionOptions {
|
|
1079
1638
|
/** Resolved CLI configuration (model, API key, permissions) */
|
|
@@ -1121,8 +1680,12 @@ interface ICreateSessionOptions {
|
|
|
1121
1680
|
}) => void;
|
|
1122
1681
|
/** Callback when context is compacted */
|
|
1123
1682
|
onCompact?: (summary: string) => void;
|
|
1683
|
+
/** Callback with structured compaction metadata */
|
|
1684
|
+
onCompactEvent?: (event: ICompactEvent) => void;
|
|
1124
1685
|
/** Instructions to include in the compaction prompt (e.g. from CLAUDE.md) */
|
|
1125
1686
|
compactInstructions?: string;
|
|
1687
|
+
/** Auto-compact threshold as a 0-1 fraction. Set false to disable automatic compaction. */
|
|
1688
|
+
autoCompactThreshold?: TAutoCompactThreshold;
|
|
1126
1689
|
/** Custom system prompt builder function */
|
|
1127
1690
|
systemPromptBuilder?: (params: ISystemPromptParams) => string;
|
|
1128
1691
|
/** Custom tool descriptions for the system prompt */
|
|
@@ -1149,6 +1712,8 @@ interface ICreateSessionOptions {
|
|
|
1149
1712
|
commandDescriptors?: ICapabilityDescriptor[];
|
|
1150
1713
|
/** Recorder used to snapshot files before Write/Edit tools mutate them. */
|
|
1151
1714
|
editCheckpointRecorder?: IEditCheckpointRecorder;
|
|
1715
|
+
/** Opt-in local-first reversible execution policy for write/shell tools. */
|
|
1716
|
+
reversibleExecution?: IReversibleExecutionOptions;
|
|
1152
1717
|
}
|
|
1153
1718
|
|
|
1154
1719
|
/**
|
|
@@ -1229,63 +1794,6 @@ declare function createSubagentLogger(parentSessionId: string, _agentId: string,
|
|
|
1229
1794
|
*/
|
|
1230
1795
|
declare function resolveSubagentLogDir(parentSessionId: string, baseLogsDir: string): string;
|
|
1231
1796
|
|
|
1232
|
-
declare const MEMORY_INDEX_MAX_LINES = 200;
|
|
1233
|
-
declare const MEMORY_INDEX_MAX_BYTES: number;
|
|
1234
|
-
type TMemoryType = 'user' | 'feedback' | 'project' | 'reference';
|
|
1235
|
-
interface IStartupMemory {
|
|
1236
|
-
content: string;
|
|
1237
|
-
path: string;
|
|
1238
|
-
lineCount: number;
|
|
1239
|
-
truncated: boolean;
|
|
1240
|
-
}
|
|
1241
|
-
interface IMemoryTopicSummary {
|
|
1242
|
-
name: string;
|
|
1243
|
-
path: string;
|
|
1244
|
-
}
|
|
1245
|
-
interface IProjectMemorySummary {
|
|
1246
|
-
indexPath: string;
|
|
1247
|
-
topicsPath: string;
|
|
1248
|
-
topics: IMemoryTopicSummary[];
|
|
1249
|
-
}
|
|
1250
|
-
interface IAppendMemoryInput {
|
|
1251
|
-
type: TMemoryType;
|
|
1252
|
-
topic: string;
|
|
1253
|
-
text: string;
|
|
1254
|
-
}
|
|
1255
|
-
interface IAppendMemoryResult {
|
|
1256
|
-
indexPath: string;
|
|
1257
|
-
topicPath: string;
|
|
1258
|
-
topic: string;
|
|
1259
|
-
deduplicated: boolean;
|
|
1260
|
-
}
|
|
1261
|
-
declare function isMemoryType(value: string): value is TMemoryType;
|
|
1262
|
-
declare class ProjectMemoryStore {
|
|
1263
|
-
private readonly cwd;
|
|
1264
|
-
private readonly now;
|
|
1265
|
-
constructor(cwd: string, now?: () => Date);
|
|
1266
|
-
getIndexPath(): string;
|
|
1267
|
-
getTopicsPath(): string;
|
|
1268
|
-
loadStartupMemory(): IStartupMemory;
|
|
1269
|
-
list(): IProjectMemorySummary;
|
|
1270
|
-
readTopic(topic: string): string;
|
|
1271
|
-
append(input: IAppendMemoryInput): IAppendMemoryResult;
|
|
1272
|
-
}
|
|
1273
|
-
|
|
1274
|
-
interface IMemoryReference {
|
|
1275
|
-
topic: string;
|
|
1276
|
-
path: string;
|
|
1277
|
-
score: number;
|
|
1278
|
-
truncated: boolean;
|
|
1279
|
-
}
|
|
1280
|
-
interface IMemoryEvent {
|
|
1281
|
-
type: 'memory_candidate_extracted' | 'memory_candidate_queued' | 'memory_candidate_saved' | 'memory_candidate_skipped' | 'memory_candidate_approved' | 'memory_candidate_rejected' | 'memory_retrieved';
|
|
1282
|
-
at: string;
|
|
1283
|
-
candidateId?: string;
|
|
1284
|
-
topic?: string;
|
|
1285
|
-
reason?: string;
|
|
1286
|
-
data?: Record<string, TUniversalValue>;
|
|
1287
|
-
}
|
|
1288
|
-
|
|
1289
1797
|
/**
|
|
1290
1798
|
* Session initialization helpers for InteractiveSession.
|
|
1291
1799
|
*
|
|
@@ -1316,6 +1824,8 @@ interface IInteractiveSessionStandardOptions {
|
|
|
1316
1824
|
subagentRunnerFactory?: TSubagentRunnerFactory;
|
|
1317
1825
|
/** Optional command modules composed into this session. */
|
|
1318
1826
|
commandModules?: readonly ICommandModule[];
|
|
1827
|
+
/** Host adapters available to composed command modules. */
|
|
1828
|
+
commandHostAdapters?: ICommandHostAdapters;
|
|
1319
1829
|
/** Model-visible command descriptors derived from the composed command executor. */
|
|
1320
1830
|
commandDescriptors?: readonly ICapabilityDescriptor[];
|
|
1321
1831
|
/** Model command execution bridge. */
|
|
@@ -1324,6 +1834,8 @@ interface IInteractiveSessionStandardOptions {
|
|
|
1324
1834
|
isModelCommandInvocable?: (command: string) => boolean;
|
|
1325
1835
|
/** Preloaded config to avoid duplicate discovery when caller needs it too. */
|
|
1326
1836
|
config?: IResolvedConfig;
|
|
1837
|
+
/** Opt-in local-first reversible execution policy for write/shell tools. */
|
|
1838
|
+
reversibleExecution?: IReversibleExecutionOptions;
|
|
1327
1839
|
}
|
|
1328
1840
|
/** Test/advanced construction: inject pre-built session directly. */
|
|
1329
1841
|
interface IInteractiveSessionInjectedOptions {
|
|
@@ -1339,6 +1851,8 @@ interface IInteractiveSessionInjectedOptions {
|
|
|
1339
1851
|
forkSession?: boolean;
|
|
1340
1852
|
/** Optional command modules composed into this injected session. */
|
|
1341
1853
|
commandModules?: readonly ICommandModule[];
|
|
1854
|
+
/** Host adapters available to composed command modules. */
|
|
1855
|
+
commandHostAdapters?: ICommandHostAdapters;
|
|
1342
1856
|
}
|
|
1343
1857
|
/** Union of standard and injected construction options. */
|
|
1344
1858
|
type IInteractiveSessionOptions = IInteractiveSessionStandardOptions | IInteractiveSessionInjectedOptions;
|
|
@@ -1388,6 +1902,8 @@ declare class InteractiveSession {
|
|
|
1388
1902
|
private backgroundJobUnsubscribe;
|
|
1389
1903
|
private backgroundJobOrchestrator;
|
|
1390
1904
|
private readonly commandModules;
|
|
1905
|
+
private readonly commandHostAdapters?;
|
|
1906
|
+
private autoCompactThresholdSource;
|
|
1391
1907
|
private shuttingDown;
|
|
1392
1908
|
private shutdownPromise;
|
|
1393
1909
|
constructor(options: IInteractiveSessionOptions);
|
|
@@ -1398,16 +1914,8 @@ declare class InteractiveSession {
|
|
|
1398
1914
|
off<E extends TInteractiveEventName>(event: E, handler: IInteractiveSessionEvents[E]): void;
|
|
1399
1915
|
private emit;
|
|
1400
1916
|
submit(input: string, displayInput?: string, rawInput?: string): Promise<void>;
|
|
1401
|
-
executeCommand(name: string, args: string): Promise<
|
|
1402
|
-
|
|
1403
|
-
success: boolean;
|
|
1404
|
-
data?: Record<string, unknown>;
|
|
1405
|
-
} | null>;
|
|
1406
|
-
executeModelCommand(name: string, args: string): Promise<{
|
|
1407
|
-
message: string;
|
|
1408
|
-
success: boolean;
|
|
1409
|
-
data?: Record<string, unknown>;
|
|
1410
|
-
} | null>;
|
|
1917
|
+
executeCommand(name: string, args: string): Promise<ICommandResult | null>;
|
|
1918
|
+
executeModelCommand(name: string, args: string): Promise<ICommandResult | null>;
|
|
1411
1919
|
executeSkillCommand(skill: ICommand, args: string, displayInput?: string, rawInput?: string): Promise<ISkillExecutionResult>;
|
|
1412
1920
|
listCommands(): Array<{
|
|
1413
1921
|
name: string;
|
|
@@ -1428,11 +1936,19 @@ declare class InteractiveSession {
|
|
|
1428
1936
|
getStreamingText(): string;
|
|
1429
1937
|
getActiveTools(): IToolState[];
|
|
1430
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>;
|
|
1431
1945
|
getName(): string | undefined;
|
|
1432
1946
|
getCwd(): string;
|
|
1433
1947
|
getSession(): Session;
|
|
1434
1948
|
listEditCheckpoints(): IEditCheckpointSummary[];
|
|
1949
|
+
inspectEditCheckpoint(checkpointId: string): IEditCheckpointInspection;
|
|
1435
1950
|
restoreEditCheckpoint(checkpointId: string): Promise<IEditCheckpointRestoreResult>;
|
|
1951
|
+
rollbackEditCheckpoint(checkpointId: string): Promise<IEditCheckpointRestoreResult>;
|
|
1436
1952
|
getUsedMemoryReferences(): IMemoryReference[];
|
|
1437
1953
|
recordMemoryEvent(event: IMemoryEvent): void;
|
|
1438
1954
|
listBackgroundTasks(filter?: IBackgroundTaskListFilter): IBackgroundTaskState[];
|
|
@@ -1484,11 +2000,13 @@ declare class InteractiveSession {
|
|
|
1484
2000
|
private resolveForkAgentDefinition;
|
|
1485
2001
|
private runSkillInFork;
|
|
1486
2002
|
private applyForkSkillResult;
|
|
2003
|
+
private executeForegroundCommand;
|
|
1487
2004
|
private executePrompt;
|
|
1488
2005
|
private getEditCheckpointStore;
|
|
1489
2006
|
private beginEditCheckpointTurn;
|
|
1490
2007
|
private finalizeEditCheckpointTurn;
|
|
1491
2008
|
private handleTextDelta;
|
|
2009
|
+
private handleCompactEvent;
|
|
1492
2010
|
private handleToolExecution;
|
|
1493
2011
|
private clearStreaming;
|
|
1494
2012
|
private flushStreaming;
|
|
@@ -1529,32 +2047,6 @@ interface ICreateQueryOptions {
|
|
|
1529
2047
|
*/
|
|
1530
2048
|
declare function createQuery(options: ICreateQueryOptions): (prompt: string) => Promise<string>;
|
|
1531
2049
|
|
|
1532
|
-
interface IEditCheckpointStoreOptions {
|
|
1533
|
-
cwd: string;
|
|
1534
|
-
now?: () => Date;
|
|
1535
|
-
}
|
|
1536
|
-
declare class EditCheckpointStore {
|
|
1537
|
-
private readonly cwd;
|
|
1538
|
-
private readonly rootDir;
|
|
1539
|
-
private readonly now;
|
|
1540
|
-
private activeTurn;
|
|
1541
|
-
constructor(options: IEditCheckpointStoreOptions);
|
|
1542
|
-
beginTurn(input: IEditCheckpointTurnInput): Promise<IEditCheckpointSummary>;
|
|
1543
|
-
captureFile(filePath: string): Promise<void>;
|
|
1544
|
-
finalizeTurn(): Promise<IEditCheckpointSummary | undefined>;
|
|
1545
|
-
list(sessionId: string): IEditCheckpointSummary[];
|
|
1546
|
-
restoreToCheckpoint(sessionId: string, checkpointId: string): Promise<IEditCheckpointRestoreResult>;
|
|
1547
|
-
private createFileRecord;
|
|
1548
|
-
private restoreFile;
|
|
1549
|
-
private loadManifests;
|
|
1550
|
-
private nextSequence;
|
|
1551
|
-
private writeManifest;
|
|
1552
|
-
private sessionDir;
|
|
1553
|
-
private checkpointDir;
|
|
1554
|
-
}
|
|
1555
|
-
|
|
1556
|
-
declare function wrapEditCheckpointTools(tools: readonly IToolWithEventService[], recorder: IEditCheckpointRecorder): IToolWithEventService[];
|
|
1557
|
-
|
|
1558
2050
|
type TSelfHostingVerificationPhase = 'checkpoint' | 'edit' | 'handoff' | 'verify' | 'recover';
|
|
1559
2051
|
type TSelfHostingLoopState = 'idle' | 'checkpointed' | 'editing' | 'verifying' | 'passed' | 'failed' | 'rolled_back' | 'cancelled';
|
|
1560
2052
|
type TSelfHostingLoopEvent = 'checkpoint_created' | 'edits_started' | 'edits_applied' | 'verify_passed' | 'verify_failed' | 'rollback_completed' | 'cancelled';
|
|
@@ -1698,4 +2190,4 @@ declare function updateTaskFileStatus(taskPath: string, status: TTaskFileStatus,
|
|
|
1698
2190
|
*/
|
|
1699
2191
|
declare function promptForApproval(terminal: ITerminalOutput, toolName: string, toolArgs: TToolArgs): Promise<boolean>;
|
|
1700
2192
|
|
|
1701
|
-
export { AgentExecutor, BUILT_IN_AGENTS, BackgroundJobOrchestrator, BuiltinCommandSource, BundlePluginInstaller, BundlePluginLoader, CommandRegistry, EditCheckpointStore, 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 ICommandExecutionToolDeps, type ICommandModule, type ICommandResult, type ICommandSource, type ICreateQueryOptions, type IDiffLine, type IEditCheckpointFileRecord, 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 ILoadedBundlePlugin, type IMarketplaceClientOptions, type IMarketplaceManifest, type IMarketplacePluginEntry, type IMarketplaceSource, type IPluginSettings, type IProjectMemorySummary, type IPromptExecutorOptions, type IPromptProvider, type ISelfHostingVerificationPlan, type ISelfHostingVerificationPlanInput, type ISelfHostingVerificationStep, type ISkillExecutionCallbacks, type ISkillExecutionResult, type IStartupMemory, type ISubagentOptions, type ISubagentPromptOptions, type ISystemCommand, type ITaskContextFile, type ITaskSelectionOptions, type IToolState, type IToolSummary, type ITransportAdapter, type IUpdateTaskFileStatusOptions, type IUsageSnapshot, InteractiveSession, MEMORY_INDEX_MAX_BYTES, MEMORY_INDEX_MAX_LINES, MarketplaceClient, PluginCommandSource, PluginSettingsStore, ProjectMemoryStore, PromptExecutor, SkillCommandSource, type SkillPromptContext, SystemCommandExecutor, type TBackgroundJobGroupEvent, type TBackgroundJobGroupEventListener, type TBackgroundJobGroupIdFactory, type TBackgroundJobGroupStatus, type TBackgroundJobWaitPolicy, type TCapabilityKind, type TCapabilitySafety, type TCommandModuleSessionRequirement, type TEnabledPlugins, type TInteractiveEventName, type TInteractivePermissionHandler, type TMemoryType, type TPermissionResultValue, type TProviderFactory, type TSelfHostingLoopEvent, type TSelfHostingLoopState, type TSelfHostingVerificationPhase, type TSessionFactory, type TSubagentRunnerFactory, type TTaskFileStatus, assembleSubagentPrompt, buildSkillPrompt, createAgentTool, createBackgroundProcessTool, createCommandExecutionTool, createDefaultTools, createQuery, createSubagentLogger, createSubagentSession, createSystemCommands, discoverTaskFiles, executeSkill, formatTaskContext, getBuiltInAgent, getForkWorkerSuffix, getSubagentSuffix, isMemoryType, loadTaskContext, parseFrontmatter, parseTaskFile, planSelfHostingVerification, preprocessShellCommands, projectPaths, promptForApproval, readCurrentGitBranch, resolveSubagentLogDir, retrieveAgentToolDeps, selectRelevantTasks, storeAgentToolDeps, substituteVariables, summarizeBackgroundJobGroup, transitionSelfHostingLoop, updateTaskFileStatus, userPaths, wrapEditCheckpointTools };
|
|
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 };
|