@elyx-code/project-logic-tree 0.0.7222 → 0.0.7224

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.
@@ -0,0 +1,9 @@
1
+ import { IComposableCommand, ICommandStepResolution, ICommandPart } from './extensions';
2
+
3
+ export declare function getSubcommandsList(cmd: IComposableCommand): IComposableCommand[];
4
+ export declare function getSubcommandsMap(cmd: IComposableCommand): Record<string, IComposableCommand>;
5
+ /**
6
+ * Dynamically resolves the active step, placeholder, ghost hint, and completion state
7
+ * for a composable command based on the sequence of confirmed parts and active input.
8
+ */
9
+ export declare function resolveCommandStep(command: IComposableCommand | null | undefined, confirmedParts: ICommandPart[], activeSegmentText: string, _ctx?: any): ICommandStepResolution;
@@ -73,16 +73,180 @@ export interface ICommandSubcommandOption {
73
73
  description: string;
74
74
  category: string;
75
75
  }
76
+ export declare enum CommandExecutionType {
77
+ ClientProcess = "client-process",
78
+ AgentProcess = "agent-process"
79
+ }
76
80
  export interface ICommandDefinition {
77
81
  command: string;
78
82
  label: string;
79
83
  description?: string;
80
84
  category: string;
81
- executionType?: 'fe-action' | 'backend-process' | 'ai-prompt';
82
- hasRichEditor?: boolean;
85
+ executionType: CommandExecutionType | 'client-process' | 'agent-process';
83
86
  subcommands?: ICommandSubcommandOption[];
84
87
  args?: ICommandArgDef[];
85
88
  }
89
+ export declare enum NamedColor {
90
+ MainGrey = "main-grey",
91
+ LightGrey = "light-grey",
92
+ DarkGrey = "dark-grey",
93
+ LighterGrey = "lighter-grey",
94
+ BackgroundGrey = "background-grey",
95
+ MainPrimary = "main-primary",
96
+ SupportPrimary = "support-primary",
97
+ TextPrimary = "text-primary",
98
+ ContrastPrimary = "contrast-primary",
99
+ LightContrastPrimary = "light-contrast-primary",
100
+ BackgroundPrimary = "background-primary",
101
+ MainError = "main-error",
102
+ MainDarkError = "main-dark-error",
103
+ SupportError = "support-error",
104
+ TextError = "text-error",
105
+ ContrastError = "contrast-error",
106
+ BackgroundError = "background-error",
107
+ MainSuccess = "main-success",
108
+ MainDarkSuccess = "main-dark-success",
109
+ SupportSuccess = "support-success",
110
+ TextSuccess = "text-success",
111
+ ContrastSuccess = "contrast-success",
112
+ BackgroundSuccess = "background-success",
113
+ MainWarning = "main-warning",
114
+ SupportWarning = "support-warning",
115
+ TextWarning = "text-warning",
116
+ ContrastWarning = "contrast-warning",
117
+ BackgroundWarning = "background-warning",
118
+ BackgroundDefinitionEntity = "background--definition-entity",
119
+ BackgroundSupportDefinitionEntity = "background-support--definition-entity",
120
+ BackgroundSuggestionDefinitionEntity = "background-suggestion--definition-entity",
121
+ BackgroundSupportSuggestionDefinitionEntity = "background-support-suggestion--definition-entity",
122
+ BackgroundDisabledDefinitionEntity = "background-disabled--definition-entity",
123
+ IconDefinitionEntity = "icon--definition-entity",
124
+ TextDefinitionEntity = "text--definition-entity",
125
+ BackgroundProperty = "background--property",
126
+ BackgroundSupportProperty = "background-support--property",
127
+ IconProperty = "icon--property",
128
+ TextProperty = "text--property",
129
+ BackgroundFunctionCall = "background--function-call",
130
+ BackgroundOperation = "background--operation",
131
+ BackgroundSupportFunctionCall = "background-support--function-call",
132
+ BackgroundSupportOperation = "background-support--operation",
133
+ BackgroundSuggestionFunctionCall = "background-suggestion--function-call",
134
+ BackgroundSuggestionOperation = "background-suggestion--operation",
135
+ BackgroundSupportSuggestionFunctionCall = "background-support-suggestion--function-call",
136
+ BackgroundSupportSuggestionOperation = "background-support-suggestion--operation",
137
+ BackgroundDisabledFunctionCall = "background-disabled--function-call",
138
+ BackgroundDisabledOperation = "background-disabled--operation",
139
+ IconFunctionCall = "icon--function-call",
140
+ IconOperation = "icon--operation",
141
+ TextFunctionCall = "text--function-call",
142
+ TextOperation = "text--operation",
143
+ BackgroundInternalCall = "background--internal-call",
144
+ BackgroundSupportInternalCall = "background-support--internal-call",
145
+ BackgroundSuggestionInternalCall = "background-suggestion--internal-call",
146
+ BackgroundSupportSuggestionInternalCall = "background-support-suggestion--internal-call",
147
+ BackgroundDisabledInternalCall = "background-disabled--internal-call",
148
+ IconInternalCall = "icon--internal-call",
149
+ TextInternalCall = "text--internal-call",
150
+ BackgroundGlobalEvent = "background--global-event",
151
+ BackgroundFunctionDeclaration = "background--function-declaration",
152
+ BackgroundSupportGlobalEvent = "background-support--global-event",
153
+ BackgroundSupportFunctionDeclaration = "background-support--function-declaration",
154
+ BackgroundSuggestionFunctionDeclaration = "background-suggestion--function-declaration",
155
+ BackgroundSuggestionGlobalEvent = "background-suggestion--global-event",
156
+ BackgroundSupportSuggestionFunctionDeclaration = "background-support-suggestion--function-declaration",
157
+ BackgroundSupportSuggestionGlobalEvent = "background-support-suggestion--global-event",
158
+ BackgroundDisabledGlobalEvent = "background-disabled--global-event",
159
+ BackgroundDisabledFunctionDeclaration = "background-disabled--function-declaration",
160
+ IconGlobalEvent = "icon--global-event",
161
+ IconFunctionDeclaration = "icon--function-declaration",
162
+ TextGlobalEvent = "text--global-event",
163
+ TextFunctionDeclaration = "text--function-declaration",
164
+ BackgroundProject = "background--project",
165
+ BackgroundSupportProject = "background-support--project",
166
+ BackgroundSuggestionProject = "background-suggestion--project",
167
+ BackgroundSupportSuggestionProject = "background-support-suggestion--project",
168
+ BackgroundDisabledProject = "background-disabled--project",
169
+ IconProject = "icon--project",
170
+ TextProject = "text--project",
171
+ BackgroundCondition = "background--condition",
172
+ BackgroundSupportCondition = "background-support--condition",
173
+ BackgroundSuggestionCondition = "background-suggestion--condition",
174
+ BackgroundSupportSuggestionCondition = "background-support-suggestion--condition",
175
+ BackgroundDisabledCondition = "background-disabled--condition",
176
+ IconCondition = "icon--condition",
177
+ TextCondition = "text--condition",
178
+ BackgroundReturnStatement = "background--return-statement",
179
+ BackgroundLightReturnStatement = "background-light--return-statement",
180
+ BackgroundContinueStatement = "background--continue-statement",
181
+ BackgroundLightContinueStatement = "background-light--continue-statement",
182
+ BackgroundBreakStatement = "background--break-statement",
183
+ BackgroundLightBreakStatement = "background-light--break-statement",
184
+ BackgroundSupportReturnStatement = "background-support--return-statement",
185
+ BackgroundSupportContinueStatement = "background-support--continue-statement",
186
+ BackgroundSupportBreakStatement = "background-support--break-statement",
187
+ BackgroundSuggestionReturnStatement = "background-suggestion--return-statement",
188
+ BackgroundSuggestionContinueStatement = "background-suggestion--continue-statement",
189
+ BackgroundSuggestionBreakStatement = "background-suggestion--break-statement",
190
+ BackgroundSupportSuggestionReturnStatement = "background-support-suggestion--return-statement",
191
+ BackgroundSupportSuggestionContinueStatement = "background-support-suggestion--continue-statement",
192
+ BackgroundSupportSuggestionBreakStatement = "background-support-suggestion--break-statement",
193
+ BackgroundDisabledReturnStatement = "background-disabled--return-statement",
194
+ BackgroundDisabledContinueStatement = "background-disabled--continue-statement",
195
+ BackgroundDisabledBreakStatement = "background-disabled--break-statement",
196
+ IconReturnStatement = "icon--return-statement",
197
+ IconContinueStatement = "icon--continue-statement",
198
+ IconBreakStatement = "icon--break-statement",
199
+ TextReturnStatement = "text--return-statement",
200
+ TextContinueStatement = "text--continue-statement",
201
+ TextBreakStatement = "text--break-statement",
202
+ BackgroundVariableDeclaration = "background--variable-declaration",
203
+ BackgroundVariableInstance = "background--variable-instance",
204
+ BackgroundSupportVariableDeclaration = "background-support--variable-declaration",
205
+ BackgroundSupportVariableInstance = "background-support--variable-instance",
206
+ BackgroundSuggestionVariableDeclaration = "background-suggestion--variable-declaration",
207
+ BackgroundSuggestionVariableInstance = "background-suggestion--variable-instance",
208
+ BackgroundSupportSuggestionVariableDeclaration = "background-support-suggestion--variable-declaration",
209
+ BackgroundSupportSuggestionVariableInstance = "background-support-suggestion--variable-instance",
210
+ BackgroundDisabledVariableDeclaration = "background-disabled--variable-declaration",
211
+ BackgroundDisabledVariableInstance = "background-disabled--variable-instance",
212
+ IconVariableDeclaration = "icon--variable-declaration",
213
+ IconVariableInstance = "icon--variable-instance",
214
+ TextVariableDeclaration = "text--variable-declaration",
215
+ TextVariableInstance = "text--variable-instance",
216
+ BackgroundLoop = "background--loop",
217
+ BackgroundSupportLoop = "background-support--loop",
218
+ BackgroundSuggestionLoop = "background-suggestion--loop",
219
+ BackgroundSupportSuggestionLoop = "background-support-suggestion--loop",
220
+ BackgroundDisabledLoop = "background-disabled--loop",
221
+ IconLoop = "icon--loop",
222
+ TextLoop = "text--loop",
223
+ BackgroundSearch = "background--search",
224
+ BackgroundSupportSearch = "background-support--search",
225
+ BackgroundSuggestionSearch = "background-suggestion--search",
226
+ BackgroundSupportSuggestionSearch = "background-support-suggestion--search",
227
+ BackgroundDisabledSearch = "background-disabled--search",
228
+ IconSearch = "icon--search",
229
+ TextSearch = "text--search",
230
+ StringValue = "string--value",
231
+ NumberValue = "number--value",
232
+ BooleanValue = "boolean--value",
233
+ ListValue = "list--value",
234
+ ObjectValue = "object--value"
235
+ }
236
+ export interface ICommandPart {
237
+ index: number;
238
+ type: 'command' | 'subcommand' | 'option' | 'argument' | 'text' | 'node';
239
+ label: string;
240
+ sublabel?: string;
241
+ value: string;
242
+ color?: string;
243
+ namedColor?: NamedColor | string;
244
+ icon?: string;
245
+ metadata?: {
246
+ entity?: any;
247
+ [key: string]: unknown;
248
+ };
249
+ }
86
250
  export interface ICommandExecutionContext {
87
251
  project?: any;
88
252
  conversationId: string;
@@ -91,19 +255,99 @@ export interface ICommandExecutionContext {
91
255
  option?: string;
92
256
  args: Record<string, any>;
93
257
  rawInput: string;
258
+ parts?: ICommandPart[];
259
+ }
260
+ export interface ICommandAutocompleteContext {
261
+ project?: any;
262
+ conversationId?: string;
263
+ command?: string;
264
+ subcommand?: string;
265
+ option?: string;
266
+ args?: Record<string, any>;
267
+ rawInput?: string;
268
+ parts?: ICommandPart[];
269
+ [key: string]: unknown;
270
+ }
271
+ export interface IBeforeSubmitResult {
272
+ canProceed: boolean;
273
+ notification?: {
274
+ text: string;
275
+ color?: 'success' | 'error' | 'warning' | 'info';
276
+ };
277
+ widgetType?: string;
278
+ widgetPayload?: any;
279
+ message?: string;
94
280
  }
95
281
  export interface ICommandExecutionResult {
96
282
  success: boolean;
97
283
  message?: string;
98
- widgetType?: string;
99
- widgetPayload?: any;
100
- createdEntityId?: string;
101
- createdEntityName?: string;
284
+ payload?: {
285
+ command?: string;
286
+ parts?: ICommandPart[];
287
+ changeSetId?: string;
288
+ publicationId?: string;
289
+ createdEntityId?: string;
290
+ createdEntityName?: string;
291
+ icons?: Record<string, string>;
292
+ [key: string]: unknown;
293
+ };
294
+ metadata?: Record<string, unknown>;
102
295
  }
103
296
  export type CommandStage = 'normal' | 'command' | 'subcommand' | 'option' | 'args';
297
+ export type CommandStepType = 'subcommand' | 'option' | 'argument' | 'custom';
298
+ export interface ICommandOptionItem<TMetadata = any> {
299
+ id: string;
300
+ label: string;
301
+ sublabel?: string;
302
+ categoryTag?: string;
303
+ icon?: string;
304
+ color?: string;
305
+ namedColor?: NamedColor | string;
306
+ colorType?: string;
307
+ rendererId?: string;
308
+ metadata?: TMetadata;
309
+ rawEntity?: any;
310
+ }
311
+ export interface ICommandStep<TContext = any> {
312
+ id: string;
313
+ type: CommandStepType;
314
+ label: string;
315
+ placeholder?: string;
316
+ ghostHint?: string;
317
+ required?: boolean;
318
+ allowFreeText?: boolean;
319
+ getOptions?: (query: string, ctx: TContext) => Promise<ICommandOptionItem[]>;
320
+ resolvePart: (valueOrOption: any, ctx: TContext, partIndex: number) => ICommandPart;
321
+ isStepSatisfied?: (value: string | ICommandPart, ctx: TContext) => boolean;
322
+ }
323
+ export interface IComposableCommand<TContext = any> {
324
+ name: string;
325
+ label?: string;
326
+ description?: string;
327
+ category?: string;
328
+ icon?: string;
329
+ namedColor?: NamedColor | string;
330
+ subcommands?: Record<string, IComposableCommand<TContext>> | IComposableCommand<TContext>[];
331
+ steps?: ICommandStep<TContext>[];
332
+ beforeSubmit?: (ctx: ICommandExecutionContext) => Promise<IBeforeSubmitResult>;
333
+ execute?: (ctx: ICommandExecutionContext) => Promise<ICommandExecutionResult>;
334
+ getOptions?: (stage: CommandStage, query: string, ctx: ICommandAutocompleteContext) => Promise<any[]>;
335
+ }
336
+ export interface ICommandStepResolution<TContext = any> {
337
+ activeCommand: IComposableCommand<TContext> | ICommandExtension | null;
338
+ activeSubcommand?: IComposableCommand<TContext> | null;
339
+ currentStep: ICommandStep<TContext> | null;
340
+ stepIndex: number;
341
+ isComplete: boolean;
342
+ placeholder: string;
343
+ ghostHint?: string;
344
+ allowFreeText: boolean;
345
+ stage: CommandStage;
346
+ }
104
347
  export interface ICommandExtensionModule extends IExtensionModuleCore {
348
+ beforeSubmit?: (ctx: ICommandExecutionContext) => Promise<IBeforeSubmitResult>;
105
349
  execute: (ctx: ICommandExecutionContext) => Promise<ICommandExecutionResult>;
106
- getOptions?: (stage: CommandStage, query: string, ctx: any) => Promise<any[]>;
350
+ getOptions?: (stage: CommandStage, query: string, ctx: ICommandAutocompleteContext) => Promise<any[]>;
107
351
  }
108
352
  export interface IExtensionModuleCore {
109
353
  /** Called once on editor startup */
@@ -131,17 +375,17 @@ export declare class ExtensionState extends BaseExtensionState implements IExten
131
375
  export interface IRegisteredExtension<T = any> extends IExecutionClient {
132
376
  extensionsRegistry: ExtensionsRegistry;
133
377
  manifest: ExtensionManifest;
134
- command?: ICommandDefinition;
378
+ command?: ICommandDefinition | IComposableCommand;
135
379
  module: ExtensionModule<T>;
136
380
  state: IExtensionState;
137
381
  }
138
382
  export interface ICommandExtension extends IRegisteredExtension<ICommandExtensionModule> {
139
- command: ICommandDefinition;
383
+ command: ICommandDefinition | IComposableCommand;
140
384
  }
141
385
  export declare class BaseRegisteredExtension<T = any> implements IRegisteredExtension<T> {
142
386
  readonly extensionsRegistry: ExtensionsRegistry;
143
387
  manifest: ExtensionManifest;
144
- command?: ICommandDefinition;
388
+ command?: ICommandDefinition | IComposableCommand;
145
389
  module: ExtensionModule<T>;
146
390
  state: ExtensionState;
147
391
  constructor(extensionsRegistry: ExtensionsRegistry, initialState?: Record<string, any>);
@@ -1,2 +1,3 @@
1
1
  export * from './extensions';
2
2
  export * from './defaults';
3
+ export * from './command-step-resolver';