@elyx-code/project-logic-tree 0.0.7219 → 0.0.7221

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.
@@ -59,6 +59,52 @@ export interface ExtensionManifest {
59
59
  contexts: ExtensionContextType[];
60
60
  dependencies?: string[];
61
61
  }
62
+ export interface ICommandArgDef {
63
+ name: string;
64
+ type: 'string' | 'number' | 'boolean' | 'entity-selector' | 'enum';
65
+ description?: string;
66
+ placeholder?: string;
67
+ required?: boolean;
68
+ options?: string[];
69
+ }
70
+ export interface ICommandSubcommandOption {
71
+ name: string;
72
+ label: string;
73
+ description: string;
74
+ category: string;
75
+ }
76
+ export interface ICommandDefinition {
77
+ command: string;
78
+ label: string;
79
+ description?: string;
80
+ category: string;
81
+ executionType?: 'fe-action' | 'backend-process' | 'ai-prompt';
82
+ hasRichEditor?: boolean;
83
+ subcommands?: ICommandSubcommandOption[];
84
+ args?: ICommandArgDef[];
85
+ }
86
+ export interface ICommandExecutionContext {
87
+ project?: any;
88
+ conversationId: string;
89
+ command: string;
90
+ subcommand?: string;
91
+ option?: string;
92
+ args: Record<string, any>;
93
+ rawInput: string;
94
+ }
95
+ export interface ICommandExecutionResult {
96
+ success: boolean;
97
+ message?: string;
98
+ widgetType?: string;
99
+ widgetPayload?: any;
100
+ createdEntityId?: string;
101
+ createdEntityName?: string;
102
+ }
103
+ export type CommandStage = 'normal' | 'command' | 'subcommand' | 'option' | 'args';
104
+ export interface ICommandExtensionModule extends IExtensionModuleCore {
105
+ execute: (ctx: ICommandExecutionContext) => Promise<ICommandExecutionResult>;
106
+ getOptions?: (stage: CommandStage, query: string, ctx: any) => Promise<any[]>;
107
+ }
62
108
  export interface IExtensionModuleCore {
63
109
  /** Called once on editor startup */
64
110
  init?(contexts: IExtensionContext[]): Promise<void> | void;
@@ -85,12 +131,17 @@ export declare class ExtensionState extends BaseExtensionState implements IExten
85
131
  export interface IRegisteredExtension<T = any> extends IExecutionClient {
86
132
  extensionsRegistry: ExtensionsRegistry;
87
133
  manifest: ExtensionManifest;
134
+ command?: ICommandDefinition;
88
135
  module: ExtensionModule<T>;
89
136
  state: IExtensionState;
90
137
  }
138
+ export interface ICommandExtension extends IRegisteredExtension<ICommandExtensionModule> {
139
+ command: ICommandDefinition;
140
+ }
91
141
  export declare class BaseRegisteredExtension<T = any> implements IRegisteredExtension<T> {
92
142
  readonly extensionsRegistry: ExtensionsRegistry;
93
143
  manifest: ExtensionManifest;
144
+ command?: ICommandDefinition;
94
145
  module: ExtensionModule<T>;
95
146
  state: ExtensionState;
96
147
  constructor(extensionsRegistry: ExtensionsRegistry, initialState?: Record<string, any>);
@@ -12,6 +12,8 @@ export interface IBaseExtensionsContext {
12
12
  export declare class ExtensionsRegistry<TEditorContext extends Omit<IEditorContext, '_editor'> = IEditorContext, TProjectLogicContext extends DefaultProjectLogicContext = DefaultProjectLogicContext, TCompilerContext extends ICompilerContext = ICompilerContext, TPublicationRunContext extends Omit<IPublicationRunContext, '_publicationRun'> = Omit<DefaultPublicationRunContext, '_publicationRun'>, TEditorGUIContext extends ExtensionContextBase<ExtensionContextType.EditorGUI> = any, TGUIContext extends ExtensionContextBase<ExtensionContextType.GUI> = any> implements Omit<IEventsBus, 'destroy'> {
13
13
  private events;
14
14
  private extensionsRegistry;
15
+ private commandsRegistryMap;
16
+ private commandsListCache;
15
17
  private initialized;
16
18
  private initializedContexts;
17
19
  onResolveEditorContextCallback: () => TEditorContext | null;
@@ -33,6 +35,10 @@ export declare class ExtensionsRegistry<TEditorContext extends Omit<IEditorConte
33
35
  requestContexts(_module: IRegisteredExtension<any>, _contextTypes?: ExtensionContextType[]): (TEditorContext | TProjectLogicContext | TCompilerContext | TPublicationRunContext | TEditorGUIContext | TGUIContext)[];
34
36
  requestExtension<T = any>(moduleId: string): IRegisteredExtension<T>;
35
37
  register(extension: IRegisteredExtension<any>): void;
38
+ getCommands(options?: {
39
+ contextType?: ExtensionContextType;
40
+ globalOnly?: boolean;
41
+ }): IRegisteredExtension[];
36
42
  initAll(): Promise<void>;
37
43
  initForReady(): Promise<void>;
38
44
  destroyAll(): Promise<void>;