@robota-sdk/agent-sdk 3.0.0-beta.34 → 3.0.0-beta.35

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,8 +1,8 @@
1
- import { IHookTypeExecutor, IHookDefinition, IHookInput, IHookResult, THooksConfig, TTrustLevel, TPermissionMode, IAIProvider, TToolArgs, IToolWithEventService } from '@robota-sdk/agent-core';
1
+ import { IHookTypeExecutor, IHookDefinition, IHookInput, IHookResult, THooksConfig, TTrustLevel, TPermissionMode, IAIProvider, TToolArgs, IToolWithEventService, TUniversalMessage, IContextWindowState } from '@robota-sdk/agent-core';
2
2
  export { IContextTokenUsage, IContextWindowState, IHookInput, IPermissionLists, THookEvent, THooksConfig, TPermissionDecision, TPermissionMode, TRUST_TO_MODE, TToolArgs, TTrustLevel, evaluatePermission, runHooks } from '@robota-sdk/agent-core';
3
3
  import { createZodFunctionTool } from '@robota-sdk/agent-tools';
4
4
  export { TToolResult, bashTool, editTool, globTool, grepTool, readTool, writeTool } from '@robota-sdk/agent-tools';
5
- import { ITerminalOutput, SessionStore, TPermissionHandler, ISessionLogger, Session, FileSessionLogger } from '@robota-sdk/agent-sessions';
5
+ import { ITerminalOutput, SessionStore, TPermissionHandler, ISessionLogger, Session, FileSessionLogger, TPermissionResult } from '@robota-sdk/agent-sessions';
6
6
  export { FileSessionLogger, ISessionLogger, ISessionOptions, ISessionRecord, ISpinner, ITerminalOutput, Session, SessionStore, SilentSessionLogger, TPermissionHandler, TPermissionResult, TSessionLogData } from '@robota-sdk/agent-sessions';
7
7
 
8
8
  /**
@@ -871,4 +871,234 @@ declare function retrieveAgentToolDeps(key: object): IAgentToolDeps | undefined;
871
871
  */
872
872
  declare function createAgentTool(deps: IAgentToolDeps): ReturnType<typeof createZodFunctionTool>;
873
873
 
874
- export { AgentExecutor, BUILT_IN_AGENTS, BundlePluginInstaller, BundlePluginLoader, DEFAULT_TOOL_DESCRIPTIONS, type IAgentDefinition, type IAgentExecutorOptions, type IAgentSession, type IAgentToolDeps, type IBundlePluginFeatures, type IBundlePluginInstallerOptions, type IBundlePluginManifest, type IBundleSkill, type ICreateSessionOptions, type IInstalledPluginRecord, type IInstalledPluginsRegistry, type IKnownMarketplaceEntry, type IKnownMarketplacesRegistry, type ILoadedBundlePlugin, type ILoadedContext, type IMarketplaceClientOptions, type IMarketplaceManifest, type IMarketplacePluginEntry, type IMarketplaceSource, type IPluginSettings, type IProjectInfo, type IPromptExecutorOptions, type IPromptProvider, type IQueryOptions, type IResolvedConfig, type ISubagentOptions, type ISubagentPromptOptions, type ISystemPromptParams, MarketplaceClient, PluginSettingsStore, PromptExecutor, type TEnabledPlugins, type TProviderFactory, type TSessionFactory, assembleSubagentPrompt, buildSystemPrompt, createAgentTool, createDefaultTools, createProvider, createSession, createSubagentLogger, createSubagentSession, detectProject, getBuiltInAgent, getForkWorkerSuffix, getSubagentSuffix, loadConfig, loadContext, projectPaths, promptForApproval, query, resolveSubagentLogDir, retrieveAgentToolDeps, storeAgentToolDeps, userPaths };
874
+ /** A slash command entry */
875
+ interface ISlashCommand {
876
+ /** Command name without slash (e.g., "mode") */
877
+ name: string;
878
+ /** Short description shown in autocomplete */
879
+ description: string;
880
+ /** Source identifier (e.g., "builtin", "skill") */
881
+ source: string;
882
+ /** Subcommands for hierarchical menus */
883
+ subcommands?: ISlashCommand[];
884
+ /** Execute the command. Args is everything after the command name. */
885
+ execute?: (args: string) => void | Promise<void>;
886
+ /** Full SKILL.md content (only for skill commands) */
887
+ skillContent?: string;
888
+ /** Hint for the expected argument (Claude Code frontmatter) */
889
+ argumentHint?: string;
890
+ /** When true, models cannot invoke this skill autonomously */
891
+ disableModelInvocation?: boolean;
892
+ /** When false, users cannot invoke this skill directly */
893
+ userInvocable?: boolean;
894
+ /** List of tools this skill is allowed to use */
895
+ allowedTools?: string[];
896
+ /** Preferred model for executing this skill */
897
+ model?: string;
898
+ /** Effort level hint for the skill */
899
+ effort?: string;
900
+ /** Context scope for the skill (e.g., "project") */
901
+ context?: string;
902
+ /** Agent identity to use when executing this skill */
903
+ agent?: string;
904
+ /** Plugin installation directory (plugin skills/commands only) */
905
+ pluginDir?: string;
906
+ }
907
+ /** A source that provides slash commands */
908
+ interface ICommandSource {
909
+ name: string;
910
+ getCommands(): ISlashCommand[];
911
+ }
912
+
913
+ /** Aggregates commands from multiple sources */
914
+ declare class CommandRegistry {
915
+ private sources;
916
+ addSource(source: ICommandSource): void;
917
+ /** Get all commands, optionally filtered by prefix */
918
+ getCommands(filter?: string): ISlashCommand[];
919
+ /** Resolve a short name to its fully qualified plugin:name form */
920
+ resolveQualifiedName(shortName: string): string | null;
921
+ /** Get subcommands for a specific command */
922
+ getSubcommands(commandName: string): ISlashCommand[];
923
+ }
924
+
925
+ /** Command source for built-in commands */
926
+ declare class BuiltinCommandSource implements ICommandSource {
927
+ readonly name = "builtin";
928
+ private readonly commands;
929
+ constructor();
930
+ getCommands(): ISlashCommand[];
931
+ }
932
+
933
+ interface IFrontmatter {
934
+ name?: string;
935
+ description?: string;
936
+ argumentHint?: string;
937
+ disableModelInvocation?: boolean;
938
+ userInvocable?: boolean;
939
+ allowedTools?: string[];
940
+ model?: string;
941
+ effort?: string;
942
+ context?: string;
943
+ agent?: string;
944
+ }
945
+ /** Parse YAML-like frontmatter between --- markers */
946
+ declare function parseFrontmatter(content: string): IFrontmatter | null;
947
+ /** Command source that discovers skills from multiple directories */
948
+ declare class SkillCommandSource implements ICommandSource {
949
+ readonly name = "skill";
950
+ private readonly cwd;
951
+ private readonly home;
952
+ private cachedCommands;
953
+ constructor(cwd: string, home?: string);
954
+ getCommands(): ISlashCommand[];
955
+ getModelInvocableSkills(): ISlashCommand[];
956
+ getUserInvocableSkills(): ISlashCommand[];
957
+ }
958
+
959
+ /**
960
+ * Types for InteractiveSession — event-driven session wrapper.
961
+ */
962
+
963
+ /** Tool execution state visible to clients. */
964
+ interface IToolState {
965
+ toolName: string;
966
+ firstArg: string;
967
+ isRunning: boolean;
968
+ result?: 'success' | 'error' | 'denied';
969
+ diffLines?: IDiffLine[];
970
+ diffFile?: string;
971
+ }
972
+ /** A single diff line for Edit tool display. */
973
+ interface IDiffLine {
974
+ type: 'add' | 'remove' | 'context';
975
+ content: string;
976
+ lineNumber?: number;
977
+ }
978
+ /** Result of a completed prompt execution. */
979
+ interface IExecutionResult {
980
+ response: string;
981
+ messages: TUniversalMessage[];
982
+ toolSummaries: IToolSummary[];
983
+ contextState: IContextWindowState;
984
+ }
985
+ /** Summary of a tool call extracted from history. */
986
+ interface IToolSummary {
987
+ name: string;
988
+ args: string;
989
+ }
990
+ /** Permission handler delegate — clients provide their own UI. */
991
+ type TInteractivePermissionHandler = (toolName: string, toolArgs: TToolArgs) => Promise<TPermissionResult>;
992
+ /** Events emitted by InteractiveSession. */
993
+ interface IInteractiveSessionEvents {
994
+ text_delta: (delta: string) => void;
995
+ tool_start: (state: IToolState) => void;
996
+ tool_end: (state: IToolState) => void;
997
+ thinking: (isThinking: boolean) => void;
998
+ complete: (result: IExecutionResult) => void;
999
+ error: (error: Error) => void;
1000
+ context_update: (state: IContextWindowState) => void;
1001
+ interrupted: (result: IExecutionResult) => void;
1002
+ }
1003
+ type TInteractiveEventName = keyof IInteractiveSessionEvents;
1004
+
1005
+ /**
1006
+ * InteractiveSession — event-driven session wrapper for any client.
1007
+ *
1008
+ * Wraps Session (composition) to provide streaming text accumulation,
1009
+ * tool execution state tracking, prompt queuing, abort orchestration,
1010
+ * and message history management. Previously embedded in CLI React hooks.
1011
+ *
1012
+ * Clients (CLI, web, API server, Dynamic Worker) subscribe to events
1013
+ * and call submit/abort/cancelQueue.
1014
+ */
1015
+
1016
+ interface IInteractiveSessionOptions {
1017
+ config: ICreateSessionOptions['config'];
1018
+ context: ICreateSessionOptions['context'];
1019
+ projectInfo?: ICreateSessionOptions['projectInfo'];
1020
+ sessionStore?: ICreateSessionOptions['sessionStore'];
1021
+ permissionMode?: ICreateSessionOptions['permissionMode'];
1022
+ maxTurns?: number;
1023
+ cwd?: string;
1024
+ permissionHandler?: TInteractivePermissionHandler;
1025
+ /** Optional: inject pre-built session (for testing). */
1026
+ session?: Session;
1027
+ }
1028
+ declare class InteractiveSession {
1029
+ private readonly session;
1030
+ private readonly listeners;
1031
+ private streamingText;
1032
+ private flushTimer;
1033
+ private activeTools;
1034
+ private executing;
1035
+ private pendingPrompt;
1036
+ private messages;
1037
+ constructor(options: IInteractiveSessionOptions);
1038
+ on<E extends TInteractiveEventName>(event: E, handler: IInteractiveSessionEvents[E]): void;
1039
+ off<E extends TInteractiveEventName>(event: E, handler: IInteractiveSessionEvents[E]): void;
1040
+ private emit;
1041
+ /** Submit a prompt. Queues if already executing (max 1 queued). */
1042
+ submit(input: string): Promise<void>;
1043
+ /** Abort current execution and clear queue. */
1044
+ abort(): void;
1045
+ /** Cancel queued prompt without aborting current execution. */
1046
+ cancelQueue(): void;
1047
+ isExecuting(): boolean;
1048
+ getPendingPrompt(): string | null;
1049
+ getMessages(): TUniversalMessage[];
1050
+ getStreamingText(): string;
1051
+ getActiveTools(): IToolState[];
1052
+ getContextState(): IContextWindowState;
1053
+ getSession(): Session;
1054
+ private executePrompt;
1055
+ private handleTextDelta;
1056
+ private handleToolExecution;
1057
+ private clearStreaming;
1058
+ private flushStreaming;
1059
+ private buildResult;
1060
+ private buildInterruptedResult;
1061
+ private extractToolSummaries;
1062
+ private trimCompletedTools;
1063
+ }
1064
+
1065
+ /**
1066
+ * System commands — SDK-level command execution logic.
1067
+ *
1068
+ * Pure functions that operate on InteractiveSession.
1069
+ * No React, no TUI, no framework dependencies.
1070
+ * CLI wraps these as slash commands with UI chrome.
1071
+ */
1072
+
1073
+ /** Result of a system command execution. */
1074
+ interface ICommandResult {
1075
+ /** Human-readable output message */
1076
+ message: string;
1077
+ /** Command completed successfully */
1078
+ success: boolean;
1079
+ /** Additional structured data (command-specific) */
1080
+ data?: Record<string, unknown>;
1081
+ }
1082
+ /** A system command with name, description, and execute logic. */
1083
+ interface ISystemCommand {
1084
+ name: string;
1085
+ description: string;
1086
+ execute(session: InteractiveSession, args: string): Promise<ICommandResult> | ICommandResult;
1087
+ }
1088
+ /** Built-in system commands. */
1089
+ declare function createSystemCommands(): ISystemCommand[];
1090
+ /** Registry for system commands. */
1091
+ declare class SystemCommandExecutor {
1092
+ private readonly commands;
1093
+ constructor(commands?: ISystemCommand[]);
1094
+ /** Register an additional command. */
1095
+ register(command: ISystemCommand): void;
1096
+ /** Execute a command by name. Returns null if command not found. */
1097
+ execute(name: string, session: InteractiveSession, args: string): Promise<ICommandResult | null>;
1098
+ /** List all registered commands. */
1099
+ listCommands(): ISystemCommand[];
1100
+ /** Check if a command exists. */
1101
+ hasCommand(name: string): boolean;
1102
+ }
1103
+
1104
+ export { AgentExecutor, BUILT_IN_AGENTS, BuiltinCommandSource, BundlePluginInstaller, BundlePluginLoader, CommandRegistry, DEFAULT_TOOL_DESCRIPTIONS, type IAgentDefinition, type IAgentExecutorOptions, type IAgentSession, type IAgentToolDeps, type IBundlePluginFeatures, type IBundlePluginInstallerOptions, type IBundlePluginManifest, type IBundleSkill, type ICommandResult, type ICommandSource, type ICreateSessionOptions, type IDiffLine, type IExecutionResult, type IInstalledPluginRecord, type IInstalledPluginsRegistry, type IInteractiveSessionEvents, type IInteractiveSessionOptions, type IKnownMarketplaceEntry, type IKnownMarketplacesRegistry, type ILoadedBundlePlugin, type ILoadedContext, type IMarketplaceClientOptions, type IMarketplaceManifest, type IMarketplacePluginEntry, type IMarketplaceSource, type IPluginSettings, type IProjectInfo, type IPromptExecutorOptions, type IPromptProvider, type IQueryOptions, type IResolvedConfig, type ISlashCommand, type ISubagentOptions, type ISubagentPromptOptions, type ISystemCommand, type ISystemPromptParams, type IToolState, type IToolSummary, InteractiveSession, MarketplaceClient, PluginSettingsStore, PromptExecutor, SkillCommandSource, SystemCommandExecutor, type TEnabledPlugins, type TInteractiveEventName, type TInteractivePermissionHandler, type TProviderFactory, type TSessionFactory, assembleSubagentPrompt, buildSystemPrompt, createAgentTool, createDefaultTools, createProvider, createSession, createSubagentLogger, createSubagentSession, createSystemCommands, detectProject, getBuiltInAgent, getForkWorkerSuffix, getSubagentSuffix, loadConfig, loadContext, parseFrontmatter, projectPaths, promptForApproval, query, resolveSubagentLogDir, retrieveAgentToolDeps, storeAgentToolDeps, userPaths };
@@ -1,8 +1,8 @@
1
- import { IHookTypeExecutor, IHookDefinition, IHookInput, IHookResult, THooksConfig, TTrustLevel, TPermissionMode, IAIProvider, TToolArgs, IToolWithEventService } from '@robota-sdk/agent-core';
1
+ import { IHookTypeExecutor, IHookDefinition, IHookInput, IHookResult, THooksConfig, TTrustLevel, TPermissionMode, IAIProvider, TToolArgs, IToolWithEventService, TUniversalMessage, IContextWindowState } from '@robota-sdk/agent-core';
2
2
  export { IContextTokenUsage, IContextWindowState, IHookInput, IPermissionLists, THookEvent, THooksConfig, TPermissionDecision, TPermissionMode, TRUST_TO_MODE, TToolArgs, TTrustLevel, evaluatePermission, runHooks } from '@robota-sdk/agent-core';
3
3
  import { createZodFunctionTool } from '@robota-sdk/agent-tools';
4
4
  export { TToolResult, bashTool, editTool, globTool, grepTool, readTool, writeTool } from '@robota-sdk/agent-tools';
5
- import { ITerminalOutput, SessionStore, TPermissionHandler, ISessionLogger, Session, FileSessionLogger } from '@robota-sdk/agent-sessions';
5
+ import { ITerminalOutput, SessionStore, TPermissionHandler, ISessionLogger, Session, FileSessionLogger, TPermissionResult } from '@robota-sdk/agent-sessions';
6
6
  export { FileSessionLogger, ISessionLogger, ISessionOptions, ISessionRecord, ISpinner, ITerminalOutput, Session, SessionStore, SilentSessionLogger, TPermissionHandler, TPermissionResult, TSessionLogData } from '@robota-sdk/agent-sessions';
7
7
 
8
8
  /**
@@ -871,4 +871,234 @@ declare function retrieveAgentToolDeps(key: object): IAgentToolDeps | undefined;
871
871
  */
872
872
  declare function createAgentTool(deps: IAgentToolDeps): ReturnType<typeof createZodFunctionTool>;
873
873
 
874
- export { AgentExecutor, BUILT_IN_AGENTS, BundlePluginInstaller, BundlePluginLoader, DEFAULT_TOOL_DESCRIPTIONS, type IAgentDefinition, type IAgentExecutorOptions, type IAgentSession, type IAgentToolDeps, type IBundlePluginFeatures, type IBundlePluginInstallerOptions, type IBundlePluginManifest, type IBundleSkill, type ICreateSessionOptions, type IInstalledPluginRecord, type IInstalledPluginsRegistry, type IKnownMarketplaceEntry, type IKnownMarketplacesRegistry, type ILoadedBundlePlugin, type ILoadedContext, type IMarketplaceClientOptions, type IMarketplaceManifest, type IMarketplacePluginEntry, type IMarketplaceSource, type IPluginSettings, type IProjectInfo, type IPromptExecutorOptions, type IPromptProvider, type IQueryOptions, type IResolvedConfig, type ISubagentOptions, type ISubagentPromptOptions, type ISystemPromptParams, MarketplaceClient, PluginSettingsStore, PromptExecutor, type TEnabledPlugins, type TProviderFactory, type TSessionFactory, assembleSubagentPrompt, buildSystemPrompt, createAgentTool, createDefaultTools, createProvider, createSession, createSubagentLogger, createSubagentSession, detectProject, getBuiltInAgent, getForkWorkerSuffix, getSubagentSuffix, loadConfig, loadContext, projectPaths, promptForApproval, query, resolveSubagentLogDir, retrieveAgentToolDeps, storeAgentToolDeps, userPaths };
874
+ /** A slash command entry */
875
+ interface ISlashCommand {
876
+ /** Command name without slash (e.g., "mode") */
877
+ name: string;
878
+ /** Short description shown in autocomplete */
879
+ description: string;
880
+ /** Source identifier (e.g., "builtin", "skill") */
881
+ source: string;
882
+ /** Subcommands for hierarchical menus */
883
+ subcommands?: ISlashCommand[];
884
+ /** Execute the command. Args is everything after the command name. */
885
+ execute?: (args: string) => void | Promise<void>;
886
+ /** Full SKILL.md content (only for skill commands) */
887
+ skillContent?: string;
888
+ /** Hint for the expected argument (Claude Code frontmatter) */
889
+ argumentHint?: string;
890
+ /** When true, models cannot invoke this skill autonomously */
891
+ disableModelInvocation?: boolean;
892
+ /** When false, users cannot invoke this skill directly */
893
+ userInvocable?: boolean;
894
+ /** List of tools this skill is allowed to use */
895
+ allowedTools?: string[];
896
+ /** Preferred model for executing this skill */
897
+ model?: string;
898
+ /** Effort level hint for the skill */
899
+ effort?: string;
900
+ /** Context scope for the skill (e.g., "project") */
901
+ context?: string;
902
+ /** Agent identity to use when executing this skill */
903
+ agent?: string;
904
+ /** Plugin installation directory (plugin skills/commands only) */
905
+ pluginDir?: string;
906
+ }
907
+ /** A source that provides slash commands */
908
+ interface ICommandSource {
909
+ name: string;
910
+ getCommands(): ISlashCommand[];
911
+ }
912
+
913
+ /** Aggregates commands from multiple sources */
914
+ declare class CommandRegistry {
915
+ private sources;
916
+ addSource(source: ICommandSource): void;
917
+ /** Get all commands, optionally filtered by prefix */
918
+ getCommands(filter?: string): ISlashCommand[];
919
+ /** Resolve a short name to its fully qualified plugin:name form */
920
+ resolveQualifiedName(shortName: string): string | null;
921
+ /** Get subcommands for a specific command */
922
+ getSubcommands(commandName: string): ISlashCommand[];
923
+ }
924
+
925
+ /** Command source for built-in commands */
926
+ declare class BuiltinCommandSource implements ICommandSource {
927
+ readonly name = "builtin";
928
+ private readonly commands;
929
+ constructor();
930
+ getCommands(): ISlashCommand[];
931
+ }
932
+
933
+ interface IFrontmatter {
934
+ name?: string;
935
+ description?: string;
936
+ argumentHint?: string;
937
+ disableModelInvocation?: boolean;
938
+ userInvocable?: boolean;
939
+ allowedTools?: string[];
940
+ model?: string;
941
+ effort?: string;
942
+ context?: string;
943
+ agent?: string;
944
+ }
945
+ /** Parse YAML-like frontmatter between --- markers */
946
+ declare function parseFrontmatter(content: string): IFrontmatter | null;
947
+ /** Command source that discovers skills from multiple directories */
948
+ declare class SkillCommandSource implements ICommandSource {
949
+ readonly name = "skill";
950
+ private readonly cwd;
951
+ private readonly home;
952
+ private cachedCommands;
953
+ constructor(cwd: string, home?: string);
954
+ getCommands(): ISlashCommand[];
955
+ getModelInvocableSkills(): ISlashCommand[];
956
+ getUserInvocableSkills(): ISlashCommand[];
957
+ }
958
+
959
+ /**
960
+ * Types for InteractiveSession — event-driven session wrapper.
961
+ */
962
+
963
+ /** Tool execution state visible to clients. */
964
+ interface IToolState {
965
+ toolName: string;
966
+ firstArg: string;
967
+ isRunning: boolean;
968
+ result?: 'success' | 'error' | 'denied';
969
+ diffLines?: IDiffLine[];
970
+ diffFile?: string;
971
+ }
972
+ /** A single diff line for Edit tool display. */
973
+ interface IDiffLine {
974
+ type: 'add' | 'remove' | 'context';
975
+ content: string;
976
+ lineNumber?: number;
977
+ }
978
+ /** Result of a completed prompt execution. */
979
+ interface IExecutionResult {
980
+ response: string;
981
+ messages: TUniversalMessage[];
982
+ toolSummaries: IToolSummary[];
983
+ contextState: IContextWindowState;
984
+ }
985
+ /** Summary of a tool call extracted from history. */
986
+ interface IToolSummary {
987
+ name: string;
988
+ args: string;
989
+ }
990
+ /** Permission handler delegate — clients provide their own UI. */
991
+ type TInteractivePermissionHandler = (toolName: string, toolArgs: TToolArgs) => Promise<TPermissionResult>;
992
+ /** Events emitted by InteractiveSession. */
993
+ interface IInteractiveSessionEvents {
994
+ text_delta: (delta: string) => void;
995
+ tool_start: (state: IToolState) => void;
996
+ tool_end: (state: IToolState) => void;
997
+ thinking: (isThinking: boolean) => void;
998
+ complete: (result: IExecutionResult) => void;
999
+ error: (error: Error) => void;
1000
+ context_update: (state: IContextWindowState) => void;
1001
+ interrupted: (result: IExecutionResult) => void;
1002
+ }
1003
+ type TInteractiveEventName = keyof IInteractiveSessionEvents;
1004
+
1005
+ /**
1006
+ * InteractiveSession — event-driven session wrapper for any client.
1007
+ *
1008
+ * Wraps Session (composition) to provide streaming text accumulation,
1009
+ * tool execution state tracking, prompt queuing, abort orchestration,
1010
+ * and message history management. Previously embedded in CLI React hooks.
1011
+ *
1012
+ * Clients (CLI, web, API server, Dynamic Worker) subscribe to events
1013
+ * and call submit/abort/cancelQueue.
1014
+ */
1015
+
1016
+ interface IInteractiveSessionOptions {
1017
+ config: ICreateSessionOptions['config'];
1018
+ context: ICreateSessionOptions['context'];
1019
+ projectInfo?: ICreateSessionOptions['projectInfo'];
1020
+ sessionStore?: ICreateSessionOptions['sessionStore'];
1021
+ permissionMode?: ICreateSessionOptions['permissionMode'];
1022
+ maxTurns?: number;
1023
+ cwd?: string;
1024
+ permissionHandler?: TInteractivePermissionHandler;
1025
+ /** Optional: inject pre-built session (for testing). */
1026
+ session?: Session;
1027
+ }
1028
+ declare class InteractiveSession {
1029
+ private readonly session;
1030
+ private readonly listeners;
1031
+ private streamingText;
1032
+ private flushTimer;
1033
+ private activeTools;
1034
+ private executing;
1035
+ private pendingPrompt;
1036
+ private messages;
1037
+ constructor(options: IInteractiveSessionOptions);
1038
+ on<E extends TInteractiveEventName>(event: E, handler: IInteractiveSessionEvents[E]): void;
1039
+ off<E extends TInteractiveEventName>(event: E, handler: IInteractiveSessionEvents[E]): void;
1040
+ private emit;
1041
+ /** Submit a prompt. Queues if already executing (max 1 queued). */
1042
+ submit(input: string): Promise<void>;
1043
+ /** Abort current execution and clear queue. */
1044
+ abort(): void;
1045
+ /** Cancel queued prompt without aborting current execution. */
1046
+ cancelQueue(): void;
1047
+ isExecuting(): boolean;
1048
+ getPendingPrompt(): string | null;
1049
+ getMessages(): TUniversalMessage[];
1050
+ getStreamingText(): string;
1051
+ getActiveTools(): IToolState[];
1052
+ getContextState(): IContextWindowState;
1053
+ getSession(): Session;
1054
+ private executePrompt;
1055
+ private handleTextDelta;
1056
+ private handleToolExecution;
1057
+ private clearStreaming;
1058
+ private flushStreaming;
1059
+ private buildResult;
1060
+ private buildInterruptedResult;
1061
+ private extractToolSummaries;
1062
+ private trimCompletedTools;
1063
+ }
1064
+
1065
+ /**
1066
+ * System commands — SDK-level command execution logic.
1067
+ *
1068
+ * Pure functions that operate on InteractiveSession.
1069
+ * No React, no TUI, no framework dependencies.
1070
+ * CLI wraps these as slash commands with UI chrome.
1071
+ */
1072
+
1073
+ /** Result of a system command execution. */
1074
+ interface ICommandResult {
1075
+ /** Human-readable output message */
1076
+ message: string;
1077
+ /** Command completed successfully */
1078
+ success: boolean;
1079
+ /** Additional structured data (command-specific) */
1080
+ data?: Record<string, unknown>;
1081
+ }
1082
+ /** A system command with name, description, and execute logic. */
1083
+ interface ISystemCommand {
1084
+ name: string;
1085
+ description: string;
1086
+ execute(session: InteractiveSession, args: string): Promise<ICommandResult> | ICommandResult;
1087
+ }
1088
+ /** Built-in system commands. */
1089
+ declare function createSystemCommands(): ISystemCommand[];
1090
+ /** Registry for system commands. */
1091
+ declare class SystemCommandExecutor {
1092
+ private readonly commands;
1093
+ constructor(commands?: ISystemCommand[]);
1094
+ /** Register an additional command. */
1095
+ register(command: ISystemCommand): void;
1096
+ /** Execute a command by name. Returns null if command not found. */
1097
+ execute(name: string, session: InteractiveSession, args: string): Promise<ICommandResult | null>;
1098
+ /** List all registered commands. */
1099
+ listCommands(): ISystemCommand[];
1100
+ /** Check if a command exists. */
1101
+ hasCommand(name: string): boolean;
1102
+ }
1103
+
1104
+ export { AgentExecutor, BUILT_IN_AGENTS, BuiltinCommandSource, BundlePluginInstaller, BundlePluginLoader, CommandRegistry, DEFAULT_TOOL_DESCRIPTIONS, type IAgentDefinition, type IAgentExecutorOptions, type IAgentSession, type IAgentToolDeps, type IBundlePluginFeatures, type IBundlePluginInstallerOptions, type IBundlePluginManifest, type IBundleSkill, type ICommandResult, type ICommandSource, type ICreateSessionOptions, type IDiffLine, type IExecutionResult, type IInstalledPluginRecord, type IInstalledPluginsRegistry, type IInteractiveSessionEvents, type IInteractiveSessionOptions, type IKnownMarketplaceEntry, type IKnownMarketplacesRegistry, type ILoadedBundlePlugin, type ILoadedContext, type IMarketplaceClientOptions, type IMarketplaceManifest, type IMarketplacePluginEntry, type IMarketplaceSource, type IPluginSettings, type IProjectInfo, type IPromptExecutorOptions, type IPromptProvider, type IQueryOptions, type IResolvedConfig, type ISlashCommand, type ISubagentOptions, type ISubagentPromptOptions, type ISystemCommand, type ISystemPromptParams, type IToolState, type IToolSummary, InteractiveSession, MarketplaceClient, PluginSettingsStore, PromptExecutor, SkillCommandSource, SystemCommandExecutor, type TEnabledPlugins, type TInteractiveEventName, type TInteractivePermissionHandler, type TProviderFactory, type TSessionFactory, assembleSubagentPrompt, buildSystemPrompt, createAgentTool, createDefaultTools, createProvider, createSession, createSubagentLogger, createSubagentSession, createSystemCommands, detectProject, getBuiltInAgent, getForkWorkerSuffix, getSubagentSuffix, loadConfig, loadContext, parseFrontmatter, projectPaths, promptForApproval, query, resolveSubagentLogDir, retrieveAgentToolDeps, storeAgentToolDeps, userPaths };