Skip to content

DataGrid - AI Assistant: Implement GridCommands class#33460

Open
dmirgaev wants to merge 20 commits intoDevExpress:26_1from
dmirgaev:26_1__datagrid_commands
Open

DataGrid - AI Assistant: Implement GridCommands class#33460
dmirgaev wants to merge 20 commits intoDevExpress:26_1from
dmirgaev:26_1__datagrid_commands

Conversation

@dmirgaev
Copy link
Copy Markdown
Contributor

No description provided.

@dmirgaev dmirgaev self-assigned this Apr 29, 2026
Copilot AI review requested due to automatic review settings April 29, 2026 16:19
@dmirgaev dmirgaev requested review from a team as code owners April 29, 2026 16:19
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces the internal infrastructure for a DataGrid AI Assistant command system by adding a GridCommands utility (schema building, response validation, sequential command execution) plus initial scaffolding for an AIAssistantIntegrationController. It also updates dependencies and adds new localization keys for assistant error/abort messaging.

Changes:

  • Add GridCommands (+ spec doc) and supporting types for command schema generation (JSON Schema draft-07 via Zod) and command execution.
  • Add a new AIAssistantIntegrationController (currently with stubbed buildContext / buildResponseSchema).
  • Add Jest tests for GridCommands and update AI assistant integration controller test import; update deps (zod-to-json-schema) and add new message keys.

Reviewed changes

Copilot reviewed 37 out of 39 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pnpm-lock.yaml Locks zod-to-json-schema@3.24.6 and pins zod specifier for devextreme importer.
packages/devextreme/package.json Adds zod-to-json-schema dependency; pins zod to an exact version.
packages/devextreme/js/localization/messages/ar.json Adds AI assistant error + execution-abort message keys.
packages/devextreme/js/localization/messages/bg.json Adds AI assistant error + execution-abort message keys.
packages/devextreme/js/localization/messages/ca.json Adds AI assistant error + execution-abort message keys.
packages/devextreme/js/localization/messages/cs.json Adds AI assistant error + execution-abort message keys.
packages/devextreme/js/localization/messages/da.json Adds AI assistant error + execution-abort message keys.
packages/devextreme/js/localization/messages/de.json Adds AI assistant error + execution-abort message keys.
packages/devextreme/js/localization/messages/el.json Adds AI assistant error + execution-abort message keys.
packages/devextreme/js/localization/messages/en.json Adds AI assistant error + execution-abort message keys.
packages/devextreme/js/localization/messages/es.json Adds AI assistant error + execution-abort message keys.
packages/devextreme/js/localization/messages/fa.json Adds AI assistant error + execution-abort message keys.
packages/devextreme/js/localization/messages/fi.json Adds AI assistant error + execution-abort message keys.
packages/devextreme/js/localization/messages/fr.json Adds AI assistant error + execution-abort message keys.
packages/devextreme/js/localization/messages/hu.json Adds AI assistant error + execution-abort message keys.
packages/devextreme/js/localization/messages/it.json Adds AI assistant error + execution-abort message keys.
packages/devextreme/js/localization/messages/ja.json Adds AI assistant error + execution-abort message keys.
packages/devextreme/js/localization/messages/ko.json Adds AI assistant error + execution-abort message keys.
packages/devextreme/js/localization/messages/lt.json Adds AI assistant error + execution-abort message keys.
packages/devextreme/js/localization/messages/lv.json Adds AI assistant error + execution-abort message keys.
packages/devextreme/js/localization/messages/nb.json Adds AI assistant error + execution-abort message keys.
packages/devextreme/js/localization/messages/nl.json Adds AI assistant error + execution-abort message keys.
packages/devextreme/js/localization/messages/pl.json Adds AI assistant error + execution-abort message keys.
packages/devextreme/js/localization/messages/pt.json Adds AI assistant error + execution-abort message keys.
packages/devextreme/js/localization/messages/ro.json Adds AI assistant error + execution-abort message keys.
packages/devextreme/js/localization/messages/ru.json Adds AI assistant error + execution-abort message keys.
packages/devextreme/js/localization/messages/sl.json Adds AI assistant error + execution-abort message keys.
packages/devextreme/js/localization/messages/sv.json Adds AI assistant error + execution-abort message keys.
packages/devextreme/js/localization/messages/tr.json Adds AI assistant error + execution-abort message keys.
packages/devextreme/js/localization/messages/uk.json Adds AI assistant error + execution-abort message keys.
packages/devextreme/js/localization/messages/vi.json Adds AI assistant error + execution-abort message keys.
packages/devextreme/js/localization/messages/zh.json Adds AI assistant error + execution-abort message keys.
packages/devextreme/js/localization/messages/zh-tw.json Adds AI assistant error + execution-abort message keys.
packages/devextreme/js/__internal/grids/grid_core/ai_assistant/types.ts Adds JSON schema type + message customization types for command execution results.
packages/devextreme/js/__internal/grids/grid_core/ai_assistant/grid_commands_spec.md Adds a detailed implementation specification for GridCommands and command set.
packages/devextreme/js/__internal/grids/grid_core/ai_assistant/grid_commands.ts Implements GridCommands (schema generation, validation, sequential execution, abort + message customization).
packages/devextreme/js/__internal/grids/grid_core/ai_assistant/ai_assistant_integration_controller.ts Adds controller scaffold for sending AI requests and aborting them (context/schema currently stubbed).
packages/devextreme/js/__internal/grids/grid_core/ai_assistant/tests/grid_commands.test.ts Adds Jest coverage for GridCommands behaviors (schema, validate, execute, abort, reentrancy, customization).
packages/devextreme/js/__internal/grids/grid_core/ai_assistant/tests/ai_assistant_integration_controller.integration.test.ts Updates test import path to the new controller file.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

@dmirgaev dmirgaev force-pushed the 26_1__datagrid_commands branch from 40151ee to 530a7ff Compare April 29, 2026 17:24
Copilot AI review requested due to automatic review settings April 29, 2026 17:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 38 out of 40 changed files in this pull request and generated 7 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Comment thread packages/devextreme/js/__internal/grids/grid_core/ai_assistant/grid_commands.ts Outdated
Comment thread packages/devextreme/js/__internal/grids/grid_core/ai_assistant/grid_commands.ts Outdated
Copilot AI review requested due to automatic review settings April 30, 2026 08:47
@dmirgaev dmirgaev force-pushed the 26_1__datagrid_commands branch from c9fabe8 to 395f2ed Compare April 30, 2026 08:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 37 out of 39 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (2)

packages/devextreme/js/__internal/grids/grid_core/ai_assistant/ai_assistant_controller.ts:95

  • GridCommands is instantiated with an empty command registry. With the current GridCommands.validate/executeCommands behavior this makes every AI-produced action unknown/invalid, so the assistant can never successfully validate/execute commands. Register the available grid commands here (e.g., from ./commands/*) or otherwise ensure the controller passes a non-empty, feature-appropriate command list.
  public init(): void {
    this.gridCommands = new GridCommands(this.component, []);
    this.messageStore = new ArrayStore<Message, string>({
      key: 'id',
    });
    this.aiAssistantIntegrationController = new AIAssistantIntegrationController(this.component);
    this.aiAssistantIntegrationController.init();

packages/devextreme/js/__internal/grids/grid_core/ai_assistant/ai_assistant_controller.ts:95

  • processResponse calls this.gridCommands?.validate(response.actions), but GridCommands.validate currently expects an object with an actions array (it checks res.actions). This mismatch makes validation always fail at runtime. Align the API by either changing GridCommands.validate to accept an actions array, or by passing the full response shape from here.
  public init(): void {
    this.gridCommands = new GridCommands(this.component, []);
    this.messageStore = new ArrayStore<Message, string>({
      key: 'id',
    });
    this.aiAssistantIntegrationController = new AIAssistantIntegrationController(this.component);
    this.aiAssistantIntegrationController.init();

Copilot AI review requested due to automatic review settings April 30, 2026 10:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 40 out of 42 changed files in this pull request and generated 3 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Copilot AI review requested due to automatic review settings April 30, 2026 15:12
@dmirgaev dmirgaev force-pushed the 26_1__datagrid_commands branch from 83ae1dd to 80be63d Compare April 30, 2026 15:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 40 out of 42 changed files in this pull request and generated 1 comment.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)

packages/devextreme/js/__internal/grids/grid_core/ai_assistant/ai_assistant_controller.ts:96

  • AIAssistantController constructs GridCommands with an empty command registry. With the new GridCommands.validate() implementation, any non-empty response.actions will be rejected as “unknown command”, making AI assistant execution fail even when the provider returns actions. The controller needs to pass the actual list of supported GridCommands (or delay validation/execution until commands are registered).
  public init(): void {
    this.gridCommands = new GridCommands(this.component, []);
    this.messageStore = new ArrayStore<Message, string>({
      key: 'id',
    });
    this.aiAssistantIntegrationController = new AIAssistantIntegrationController(this.component);
    this.aiAssistantIntegrationController.init();
  }

Comment on lines +80 to +98
public buildResponseSchema(): JsonSchema {
const branches = [...this.commands.values()].map((command) => {
const argsSchema = zodToJsonSchema(command.schema, { target: 'jsonSchema7' });

// Remove $schema from nested schemas since it's only necessary at root
delete argsSchema.$schema;

return {
type: 'object',
description: command.description,
required: ['name', 'args'],
additionalProperties: false,
properties: {
name: {
type: 'string',
enum: [command.name],
},
args: argsSchema,
},
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

buildResponseSchema() generates JSON Schema from command.schema, but validate() enforces command.schema.strict(). If a command schema is not strict, the LLM may produce extra properties that appear valid per the generated JSON Schema but will be rejected by validate(). Consider generating the schema from the same strict schema you validate against (or otherwise ensure both paths enforce the same additional-properties behavior).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants