babylonjs-editor 5.5.2-alpha.0 → 5.5.2

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.
Files changed (38) hide show
  1. package/build/src/index.js +1 -1
  2. package/declaration/src/editor/layout/assets-browser/events/gui.d.ts +7 -0
  3. package/declaration/src/editor/layout/assets-browser/events/material.d.ts +7 -0
  4. package/declaration/src/editor/layout/assets-browser/events/particles.d.ts +8 -0
  5. package/declaration/src/editor/layout/assets-browser/events/scene.d.ts +7 -0
  6. package/declaration/src/editor/layout/assets-browser.d.ts +1 -0
  7. package/declaration/src/editor/layout/assistant/agents.d.ts +47 -0
  8. package/declaration/src/editor/layout/assistant/antigravity.d.ts +107 -0
  9. package/declaration/src/editor/layout/assistant/claude.d.ts +30 -0
  10. package/declaration/src/editor/layout/assistant/codex.d.ts +84 -0
  11. package/declaration/src/editor/layout/assistant/config.d.ts +109 -0
  12. package/declaration/src/editor/layout/assistant/executable.d.ts +80 -0
  13. package/declaration/src/editor/layout/assistant/hooks.d.ts +105 -0
  14. package/declaration/src/editor/layout/assistant/icon.d.ts +21 -0
  15. package/declaration/src/editor/layout/assistant/skills.d.ts +33 -0
  16. package/declaration/src/editor/layout/assistant/watcher.d.ts +43 -0
  17. package/declaration/src/editor/layout/assistant.d.ts +142 -0
  18. package/declaration/src/editor/layout/console.d.ts +33 -0
  19. package/declaration/src/editor/layout/toolbar.d.ts +2 -0
  20. package/declaration/src/editor/layout.d.ts +22 -0
  21. package/declaration/src/editor/main.d.ts +19 -0
  22. package/declaration/src/editor/menu.d.ts +1 -0
  23. package/declaration/src/mcp/mcp.d.ts +46 -2
  24. package/declaration/src/mcp/meshes/decals.d.ts +28 -0
  25. package/declaration/src/mcp/play/keys.d.ts +26 -0
  26. package/declaration/src/mcp/play/play.d.ts +29 -0
  27. package/declaration/src/mcp/screenshot.d.ts +3 -2
  28. package/declaration/src/mcp/scripts/scripts.d.ts +3 -3
  29. package/declaration/src/mcp/scripts/values.d.ts +33 -0
  30. package/declaration/src/mcp/server.d.ts +49 -0
  31. package/declaration/src/mcp/tools/resolve.d.ts +1 -0
  32. package/declaration/src/project/agent-data.d.ts +21 -0
  33. package/declaration/src/project/save/save.d.ts +2 -0
  34. package/declaration/src/tools/local-storage.d.ts +20 -0
  35. package/declaration/src/tools/node-pty.d.ts +25 -5
  36. package/declaration/src/tools/scene/play/override.d.ts +6 -0
  37. package/declaration/src/ui/toolbar.d.ts +5 -1
  38. package/package.json +1 -1
@@ -99,7 +99,7 @@ electron_1.ipcMain.on("app:quit", () => {
99
99
  }
100
100
  });
101
101
  let dashboardWindow = null;
102
- let menuOptions = { enableExperimentalFeatures: false, openedTabs: [] };
102
+ let menuOptions = { enableExperimentalFeatures: false, openedTabs: [], assistantOpen: false };
103
103
  electron_1.ipcMain.on("editor:setup-menu", (_, options) => {
104
104
  menuOptions = options;
105
105
  (0, menu_1.setupEditorMenu)(options);
@@ -1,2 +1,9 @@
1
1
  import { Editor } from "../../../main";
2
2
  export declare function listenGuiAssetsEvents(editor: Editor): void;
3
+ /**
4
+ * Parses again the content of the GUI of the scene created from the given serialized GUI, matched by its unique id.
5
+ * @param editor defines the reference to the editor.
6
+ * @param data defines the content of the GUI asset (.gui).
7
+ * @returns the number of GUI reloaded.
8
+ */
9
+ export declare function reloadGuiTexture(editor: Editor, data: any): number;
@@ -1,2 +1,9 @@
1
+ import { NodeMaterial } from "babylonjs";
1
2
  import { Editor } from "../../../main";
2
3
  export declare function listenMaterialAssetsEvents(editor: Editor): void;
4
+ /**
5
+ * Rebuilds the given node material from the given serialized node material.
6
+ * @param material defines the node material of the scene to rebuild.
7
+ * @param materialData defines the content of the node material asset (.material).
8
+ */
9
+ export declare function reloadNodeMaterial(material: NodeMaterial, materialData: any): void;
@@ -1,2 +1,10 @@
1
1
  import { Editor } from "../../../main";
2
2
  export declare function listenParticleAssetsEvents(editor: Editor): void;
3
+ /**
4
+ * Rebuilds every node particle system set of the scene created from the given serialized node particle system
5
+ * set, matched by its id.
6
+ * @param editor defines the reference to the editor.
7
+ * @param particlesData defines the content of the node particle system set asset (.npss).
8
+ * @returns the number of node particle system sets rebuilt.
9
+ */
10
+ export declare function reloadNodeParticleSystemSets(editor: Editor, particlesData: any): Promise<number>;
@@ -1,2 +1,9 @@
1
1
  import { Editor } from "../../../main";
2
2
  export declare function listenSceneAssetsEvents(editor: Editor): void;
3
+ /**
4
+ * Reloads every link of the current scene to the given scene.
5
+ * @param editor defines the reference to the editor.
6
+ * @param absolutePath defines the absolute path of the linked scene (.scene).
7
+ * @returns the number of scene links reloaded.
8
+ */
9
+ export declare function reloadSceneLinks(editor: Editor, absolutePath: string): Promise<number>;
@@ -37,6 +37,7 @@ export declare class EditorAssetsBrowser extends Component<IEditorAssetsBrowserP
37
37
  * Returns wether or not the currently browsed folder is the /src folder.
38
38
  */
39
39
  isSrcFolder(): boolean;
40
+ private _isAgentDataFolder;
40
41
  private _refreshFilesTreeNodes;
41
42
  /**
42
43
  * Sets the new path being browsed by the assets browser.
@@ -0,0 +1,47 @@
1
+ import { IAssistantExecutable } from "./executable";
2
+ /**
3
+ * Defines the coding agents the AI assistant can run.
4
+ */
5
+ export type EditorAssistantAgentId = "claude" | "codex" | "antigravity";
6
+ export interface IEditorAssistantAgent {
7
+ /**
8
+ * Defines the identifier of the agent, used to remember the choice of the user.
9
+ */
10
+ id: EditorAssistantAgentId;
11
+ /**
12
+ * Defines the name of the agent shown to the user.
13
+ */
14
+ name: string;
15
+ /**
16
+ * Defines the name of the model the agent talks with, shown to the user.
17
+ */
18
+ modelName: string;
19
+ /**
20
+ * Defines the account the user signs in with in the agent.
21
+ */
22
+ account: string;
23
+ /**
24
+ * Defines the desktop app that comes with the agent, if any.
25
+ */
26
+ desktopApp: string | null;
27
+ /**
28
+ * Defines the URL of the documentation explaining how to install the agent.
29
+ */
30
+ setupUrl: string;
31
+ /**
32
+ * Returns the command installing the agent, run in PowerShell on Windows and in a terminal elsewhere.
33
+ * @param windows defines wether or not the user is on Windows.
34
+ */
35
+ getInstallCommand(windows: boolean): string;
36
+ /**
37
+ * Finds the executable of the agent installed on this computer.
38
+ * @param customPath defines the path of the executable chosen by the user, if any.
39
+ */
40
+ findExecutable(customPath?: string | null): Promise<IAssistantExecutable | null>;
41
+ }
42
+ export declare const assistantAgents: IEditorAssistantAgent[];
43
+ /**
44
+ * Returns the agent of the given identifier, or Claude Code when it is not known.
45
+ * @param id defines the identifier of the agent, as stored in the preferences of the user.
46
+ */
47
+ export declare function getAssistantAgent(id: string | null): IEditorAssistantAgent;
@@ -0,0 +1,107 @@
1
+ import type { EditorAssistantWorkState, IAssistantHooksServer } from "./hooks";
2
+ import { IAssistantMcpConfigurationOptions } from "./config";
3
+ import { IAssistantExecutable, IExecutableLocationOptions } from "./executable";
4
+ /**
5
+ * Defines the name of the plugin the assistant gives to Antigravity CLI: its MCP server is "babylonjs_editor" in
6
+ * Antigravity CLI, which prefixes the MCP servers of plugins with their name. Kept short: Antigravity CLI refuses the
7
+ * tools whose full name, "mcp_babylonjs_editor_<tool>", is longer than 64 characters.
8
+ */
9
+ export declare const antigravityPluginName = "babylonjs";
10
+ /**
11
+ * Defines the description of the plugin, which also tells it was written by the editor.
12
+ */
13
+ export declare const antigravityPluginDescription = "Babylon.js Editor: the tools and skills of the editor, added by its AI assistant while it runs Antigravity CLI.";
14
+ /**
15
+ * Defines the name of the folder of the plugin holding one file per session of the assistant using it, with the
16
+ * identifier of the process of its editor window.
17
+ */
18
+ export declare const antigravityPluginSessionsDirectoryName = ".sessions";
19
+ /**
20
+ * Defines the hook events of Antigravity CLI the assistant follows to know what it is doing. "PreToolUse" is not one of
21
+ * them: Antigravity CLI denies the tool when its hook doesn't decide.
22
+ */
23
+ export declare const antigravityHookEvents: string[];
24
+ /**
25
+ * Defines the answer the hooks server of the assistant gives to Antigravity CLI, which reads the output of its hooks as
26
+ * JSON: an empty object lets it go on as if there was no hook.
27
+ */
28
+ export declare const antigravityHookAnswer = "{}";
29
+ /**
30
+ * Returns the paths where the installers of Antigravity CLI put its executable, in order of preference.
31
+ * @param options defines the platform, the home directory and the environment of the user.
32
+ */
33
+ export declare function getAntigravityInstallationCandidates(options?: IExecutableLocationOptions): string[];
34
+ /**
35
+ * Extracts the version of Antigravity CLI from the output of "agy --version", e.g. "1.2.12": Antigravity CLI prints
36
+ * the version alone.
37
+ * @param output defines the output of the command.
38
+ */
39
+ export declare function parseAntigravityVersion(output: string): string | null;
40
+ /**
41
+ * Finds the Antigravity CLI executable installed on this computer: the one chosen by the user, the one in the PATH of
42
+ * the user, then the one the installers of Antigravity CLI create.
43
+ * @param customPath defines the path of the executable chosen by the user, if any.
44
+ * @returns the first executable that answers "agy --version", or null when none is found.
45
+ */
46
+ export declare function findAntigravityExecutable(customPath?: string | null): Promise<IAssistantExecutable | null>;
47
+ /**
48
+ * Returns the absolute path of the plugin of the assistant among the plugins of the user: Antigravity CLI can't be
49
+ * given MCP servers nor plugins for a single session, and doesn't load the ones of the project before the user signed
50
+ * in.
51
+ * @param options defines the platform, the home directory and the environment of the user.
52
+ */
53
+ export declare function getAntigravityPluginDirectory(options?: IExecutableLocationOptions): string;
54
+ /**
55
+ * Returns the hooks of the plugin: each hook event is sent to the hooks server of the assistant with curl, which comes
56
+ * with macOS, Windows and most Linux distributions. Like the MCP server, the hooks get the URL and the token of the
57
+ * server from the environment of Antigravity CLI, which runs them with "sh -c" or "cmd /c".
58
+ * @param platform defines the platform of the user.
59
+ */
60
+ export declare function createAntigravityHooks(platform?: NodeJS.Platform): object;
61
+ /**
62
+ * Returns what the assistant is doing after the given hook event of Antigravity CLI.
63
+ * @param event defines the name of the hook event.
64
+ */
65
+ export declare function getAssistantWorkStateAfterAntigravityHook(event: string): EditorAssistantWorkState;
66
+ /**
67
+ * Returns wether or not the given output of Antigravity CLI, without its escape sequences, asks the user to allow a
68
+ * tool, a command or a URL.
69
+ * @param text defines the output of Antigravity CLI.
70
+ */
71
+ export declare function isAntigravityApprovalPrompt(text: string): boolean;
72
+ /**
73
+ * Returns the MCP configuration of the plugin: the MCP server of the editor, run by the executable of the editor itself.
74
+ * It has no token nor URL: it gets the ones of the editor window from the environment of Antigravity CLI, which the
75
+ * processes it starts inherit.
76
+ * @param options defines the MCP server of the editor.
77
+ */
78
+ export declare function createAntigravityMcpConfiguration(options: IAssistantMcpConfigurationOptions): object;
79
+ /**
80
+ * Writes the plugin of the assistant among the plugins of Antigravity CLI for the given session: the MCP server of the
81
+ * editor, its skills and the hooks telling the assistant what Antigravity CLI is doing. A plugin of the same name that
82
+ * wasn't written by the editor is left untouched.
83
+ * @param sessionId defines the identifier of the session of the assistant.
84
+ * @param options defines the MCP server of the editor.
85
+ * @param skillsPluginDirectory defines the absolute path of the plugin of the assistant bundled with the editor, holding
86
+ * its skills, if built.
87
+ * @throws when a plugin of the same name, not written by the editor, exists.
88
+ */
89
+ export declare function addAntigravityPlugin(sessionId: string, options: IAssistantMcpConfigurationOptions, skillsPluginDirectory: string | null): Promise<void>;
90
+ /**
91
+ * Removes the given session from the plugin of the assistant, and the plugin once no session of the assistant uses it
92
+ * anymore: the other sessions of Antigravity CLI of the user don't start the MCP server of the editor. Never throws.
93
+ * @param sessionId defines the identifier of the session of the assistant.
94
+ */
95
+ export declare function removeAntigravityPlugin(sessionId: string): Promise<void>;
96
+ /**
97
+ * Returns the arguments Antigravity CLI is started with.
98
+ * @param resume defines wether or not to continue the last conversation of the project instead of starting a new one.
99
+ */
100
+ export declare function getAntigravityArguments(resume: boolean): string[];
101
+ /**
102
+ * Returns the environment variables to give to Antigravity CLI so the MCP server of the editor it starts is connected
103
+ * to the window the assistant belongs to, and its hooks to the assistant.
104
+ * @param options defines the HTTP server of the editor window.
105
+ * @param hooksServer defines the HTTP server of the assistant receiving the hook events.
106
+ */
107
+ export declare function getAntigravityEnvironment(options: IAssistantMcpConfigurationOptions, hooksServer: IAssistantHooksServer): Record<string, string>;
@@ -0,0 +1,30 @@
1
+ import { IAssistantExecutable, IExecutableLocationOptions } from "./executable";
2
+ /**
3
+ * Returns the paths where the installers of Claude Code put its executable, in order of preference.
4
+ * @param options defines the platform, the home directory and the environment of the user.
5
+ */
6
+ export declare function getClaudeInstallationCandidates(options?: IExecutableLocationOptions): string[];
7
+ /**
8
+ * Returns the folder where the Claude desktop app keeps the versions of Claude Code it downloaded, or null when the
9
+ * platform has no desktop app.
10
+ * @param options defines the platform, the home directory and the environment of the user.
11
+ */
12
+ export declare function getClaudeDesktopAppCodeDirectory(options?: IExecutableLocationOptions): string | null;
13
+ /**
14
+ * Returns the paths the executable of Claude Code can have in a version folder of the Claude desktop app.
15
+ * @param versionDirectory defines the absolute path of the folder of the version.
16
+ * @param platform defines the platform of the user.
17
+ */
18
+ export declare function getClaudeDesktopAppExecutableCandidates(versionDirectory: string, platform: NodeJS.Platform): string[];
19
+ /**
20
+ * Extracts the version of Claude Code from the output of "claude --version", e.g. "2.1.283 (Claude Code)".
21
+ * @param output defines the output of the command.
22
+ */
23
+ export declare function parseClaudeVersion(output: string): string | null;
24
+ /**
25
+ * Finds the Claude Code executable installed on this computer: the one chosen by the user, the one in the PATH of the
26
+ * user, the ones the installers of Claude Code create, and finally the one downloaded by the Claude desktop app.
27
+ * @param customPath defines the path of the executable chosen by the user, if any.
28
+ * @returns the first executable that answers "claude --version", or null when none is found.
29
+ */
30
+ export declare function findClaudeExecutable(customPath?: string | null): Promise<IAssistantExecutable | null>;
@@ -0,0 +1,84 @@
1
+ import type { EditorAssistantWorkState } from "./hooks";
2
+ import { IAssistantMcpConfigurationOptions } from "./config";
3
+ import { IAssistantExecutable, IExecutableLocationOptions } from "./executable";
4
+ /**
5
+ * Defines the time, in seconds, Codex waits for the MCP server of the editor to start. It is run by the executable of
6
+ * the editor, which starts slower than Node.js.
7
+ */
8
+ export declare const codexMcpStartupTimeout = 30;
9
+ /**
10
+ * Defines the time, in seconds, Codex waits for a tool of the editor. Importing a large asset takes longer than the 60
11
+ * seconds Codex waits by default.
12
+ */
13
+ export declare const codexMcpToolTimeout = 600;
14
+ /**
15
+ * Defines the items of the title Codex gives to its terminal. The assistant follows what Codex is doing through it:
16
+ * Codex tells it only there when it doesn't run hooks the user trusted.
17
+ */
18
+ export declare const codexTerminalTitleItems: string[];
19
+ /**
20
+ * Defines the oldest version of Codex known to have the "--no-daemon" option: an unknown option makes Codex refuse to
21
+ * start. The overrides of the configuration can't be given to the shared background server of Codex, which it says in
22
+ * a warning unless it is told not to use it.
23
+ */
24
+ export declare const codexNoDaemonMinimumVersion = "0.158.0";
25
+ /**
26
+ * Defines the instructions given to the model of Codex. Codex doesn't give the instructions of the MCP servers to its
27
+ * models, and the recent ones only see the tools they search for: without them, the model doesn't know the editor is
28
+ * connected and edits the files of the project instead. Written without quotes nor line breaks to stay a TOML literal
29
+ * string (see toTomlString).
30
+ */
31
+ export declare const codexDeveloperInstructions: string;
32
+ /**
33
+ * Defines the environment variables Codex gives to the MCP server of the editor. They are given to Codex rather than
34
+ * written in its arguments, which the other users of the computer can read.
35
+ */
36
+ export declare const codexForwardedEnvironmentVariables: string[];
37
+ /**
38
+ * Returns the paths where the installers of Codex put its executable, in order of preference.
39
+ * @param options defines the platform, the home directory and the environment of the user.
40
+ */
41
+ export declare function getCodexInstallationCandidates(options?: IExecutableLocationOptions): string[];
42
+ /**
43
+ * Returns the paths of the executable of Codex the desktop apps of OpenAI come with, in order of preference.
44
+ * @param options defines the platform, the home directory and the environment of the user.
45
+ */
46
+ export declare function getCodexDesktopAppCandidates(options?: IExecutableLocationOptions): string[];
47
+ /**
48
+ * Extracts the version of Codex from the output of "codex --version", e.g. "codex-cli 0.158.0".
49
+ * @param output defines the output of the command.
50
+ */
51
+ export declare function parseCodexVersion(output: string): string | null;
52
+ /**
53
+ * Finds the Codex executable installed on this computer: the one chosen by the user, the one in the PATH of the user,
54
+ * the ones the installers of Codex create, and finally the one of the desktop apps of OpenAI.
55
+ * @param customPath defines the path of the executable chosen by the user, if any.
56
+ * @returns the first executable that answers "codex --version", or null when none is found.
57
+ */
58
+ export declare function findCodexExecutable(customPath?: string | null): Promise<IAssistantExecutable | null>;
59
+ /**
60
+ * Returns the given text as a TOML string. It is a literal string when possible: it keeps the backslashes of the paths
61
+ * on Windows as they are, and has no double quotes, which cmd.exe can't give to the batch file npm creates for Codex.
62
+ * @param value defines the text to write.
63
+ */
64
+ export declare function toTomlString(value: string): string;
65
+ /**
66
+ * Returns the arguments Codex is started with. The MCP server of the editor and the title of the terminal are given as
67
+ * overrides of the configuration of the user, which stays untouched.
68
+ * @param options defines the MCP server of the editor, run by the executable of the editor itself so no Node.js
69
+ * installation is needed.
70
+ * @param resume defines wether or not to continue the last conversation of the project instead of starting a new one.
71
+ * @param version defines the version of Codex, like "0.158.0".
72
+ */
73
+ export declare function getCodexArguments(options: IAssistantMcpConfigurationOptions, resume: boolean, version: string): string[];
74
+ /**
75
+ * Returns the environment variables to give to Codex so it connects the MCP server of the editor to its window.
76
+ * @param options defines the HTTP server of the editor window the assistant belongs to.
77
+ */
78
+ export declare function getCodexEnvironment(options: IAssistantMcpConfigurationOptions): Record<string, string>;
79
+ /**
80
+ * Returns what Codex is doing according to the title it gives to its terminal, like "⠋ Working", "Ready" or
81
+ * "[ ! ] Action Required", or null when the title doesn't tell it.
82
+ * @param title defines the title of the terminal.
83
+ */
84
+ export declare function getAssistantWorkStateFromCodexTitle(title: string): EditorAssistantWorkState | null;
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Defines the name of the MCP server of the editor in the configuration given to Claude Code. Its tools are named
3
+ * "mcp__babylonjs-editor__<tool>" in Claude Code.
4
+ */
5
+ export declare const assistantMcpServerName = "babylonjs-editor";
6
+ /**
7
+ * Defines the time, in seconds, Claude Code waits for the assistant to receive a hook event. The assistant answers
8
+ * right away: a busy editor must not keep Claude Code waiting for longer.
9
+ */
10
+ export declare const assistantHookTimeout = 5;
11
+ /**
12
+ * Defines the tools of the editor Claude Code may use without asking the user first: reading the project, and
13
+ * composing the scene with content the user sees appear live. Deleting, saving, downloading, writing or running code
14
+ * (playing the scene runs the scripts of the project) and batches (which can run any tool) keep asking, as Claude
15
+ * Code does by default.
16
+ */
17
+ export declare const assistantAllowedEditorTools: string[];
18
+ export interface IAssistantMcpConfigurationOptions {
19
+ /**
20
+ * Defines the absolute path of the executable of the editor, which runs the MCP server as Node.js does.
21
+ */
22
+ executablePath: string;
23
+ /**
24
+ * Defines the absolute path of the bundled MCP server script.
25
+ */
26
+ serverScriptPath: string;
27
+ /**
28
+ * Defines the URL of the HTTP server of the editor window the assistant belongs to.
29
+ */
30
+ url: string;
31
+ /**
32
+ * Defines the token the HTTP server of the editor expects.
33
+ */
34
+ token: string;
35
+ }
36
+ /**
37
+ * Creates the MCP configuration given to Claude Code: the MCP server of the editor, run by the executable of the
38
+ * editor itself so no Node.js installation is needed, and connected to the window the assistant belongs to.
39
+ */
40
+ export declare function createAssistantMcpConfiguration(options: IAssistantMcpConfigurationOptions): object;
41
+ export interface IAssistantHooksConfigurationOptions {
42
+ /**
43
+ * Defines the URL of the HTTP server of the assistant that receives the hook events.
44
+ */
45
+ url: string;
46
+ /**
47
+ * Defines the token the HTTP server of the assistant expects.
48
+ */
49
+ token: string;
50
+ }
51
+ /**
52
+ * Creates the hooks given to Claude Code so it tells the assistant what it is doing: each event is sent as a POST
53
+ * request to "<url>/<event>".
54
+ */
55
+ export declare function createAssistantHooks(options: IAssistantHooksConfigurationOptions): object;
56
+ /**
57
+ * Creates the additional settings given to Claude Code for the session.
58
+ * @param hooks defines the HTTP server of the assistant the hook events are sent to, if the version of Claude Code
59
+ * supports it.
60
+ */
61
+ export declare function createAssistantSettings(hooks?: IAssistantHooksConfigurationOptions | null): object;
62
+ /**
63
+ * Defines the oldest version of Claude Code the assistant gives its plugin to. Claude Code refuses to start with an
64
+ * option it doesn't know, and "--plugin-dir" is known to exist in this version.
65
+ */
66
+ export declare const assistantPluginMinimumClaudeVersion = "2.1.101";
67
+ /**
68
+ * Returns wether or not the given version of Claude Code can load the plugin of the assistant for the session.
69
+ * @param claudeVersion defines the version of Claude Code, like "2.1.283".
70
+ */
71
+ export declare function supportsAssistantPlugin(claudeVersion: string): boolean;
72
+ /**
73
+ * Returns the arguments Claude Code is started with.
74
+ * @param mcpConfigurationPath defines the absolute path of the MCP configuration file.
75
+ * @param settingsPath defines the absolute path of the settings file.
76
+ * @param resume defines wether or not to continue the last conversation of the project instead of starting a new one.
77
+ * @param pluginDirectory defines the absolute path of the plugin of the assistant, holding the skills of the editor,
78
+ * loaded for the session only.
79
+ */
80
+ export declare function getClaudeArguments(mcpConfigurationPath: string, settingsPath: string, resume: boolean, pluginDirectory?: string | null): string[];
81
+ /**
82
+ * Returns the command line cmd.exe runs a batch file (like the "claude.cmd" npm creates) with, on Windows.
83
+ * @param batchFile defines the absolute path of the batch file.
84
+ * @param args defines the arguments, which must not contain double quotes.
85
+ */
86
+ export declare function getWindowsBatchCommandLine(batchFile: string, args: string[]): string;
87
+ /**
88
+ * Returns the absolute path of the MCP server bundled with the editor. In a packaged editor, it is unpacked from the
89
+ * asar archive so another process can run it.
90
+ * @param appPath defines the path of the application, as returned by "app.getAppPath()".
91
+ */
92
+ export declare function getAssistantMcpServerScriptPath(appPath: string): string;
93
+ /**
94
+ * Returns the absolute path of the plugin of the assistant bundled with the editor: the skills of the editor, built
95
+ * from the ones of the website. In a packaged editor, it is unpacked from the asar archive so the agents can read it.
96
+ * @param appPath defines the path of the application, as returned by "app.getAppPath()".
97
+ */
98
+ export declare function getAssistantPluginDirectory(appPath: string): string;
99
+ /**
100
+ * Writes the MCP configuration and the settings of the session in the given folder, only readable by the user as
101
+ * they hold the tokens of the editor.
102
+ * @param hooks defines the HTTP server of the assistant the hook events are sent to, if the version of Claude Code
103
+ * supports it.
104
+ * @returns the absolute paths of the two files.
105
+ */
106
+ export declare function writeAssistantConfiguration(directory: string, options: IAssistantMcpConfigurationOptions, hooks?: IAssistantHooksConfigurationOptions | null): Promise<{
107
+ mcpConfigurationPath: string;
108
+ settingsPath: string;
109
+ }>;
@@ -0,0 +1,80 @@
1
+ export type AssistantExecutableSource = "custom" | "path" | "installation" | "desktop-app";
2
+ export interface IAssistantExecutable {
3
+ /**
4
+ * Defines the absolute path of the executable of the agent.
5
+ */
6
+ path: string;
7
+ /**
8
+ * Defines where the executable was found.
9
+ */
10
+ source: AssistantExecutableSource;
11
+ /**
12
+ * Defines the version of the agent, as reported by "<executable> --version".
13
+ */
14
+ version: string;
15
+ }
16
+ export interface IAssistantExecutableCandidate {
17
+ /**
18
+ * Defines the absolute path the executable may have.
19
+ */
20
+ path: string;
21
+ /**
22
+ * Defines where the executable comes from when it is found at this path.
23
+ */
24
+ source: AssistantExecutableSource;
25
+ }
26
+ export interface IExecutableLocationOptions {
27
+ platform: NodeJS.Platform;
28
+ home: string;
29
+ env: NodeJS.ProcessEnv;
30
+ }
31
+ export declare function getDefaultLocationOptions(): IExecutableLocationOptions;
32
+ /**
33
+ * Compares two versions made of numbers separated by dots, like "2.1.283".
34
+ * @returns a negative number when a is older than b, a positive one when it is newer, 0 when they are equal.
35
+ */
36
+ export declare function compareVersions(a: string, b: string): number;
37
+ /**
38
+ * Extracts the absolute path of the executable from the output of "command -v <command>" (macOS, Linux) or "where
39
+ * <command>" (Windows). Interactive shells may print other lines, and an alias prints its command.
40
+ * @param output defines the output of the command.
41
+ * @param platform defines the platform of the user.
42
+ * @param command defines the name of the command that was looked up, like "claude".
43
+ */
44
+ export declare function parseCommandLookupOutput(output: string, platform: NodeJS.Platform, command: string): string | null;
45
+ export declare function execFileOutput(file: string, args: string[], timeout: number): Promise<string | null>;
46
+ /**
47
+ * Returns the version of the given executable, or null when it is not a working executable of the agent.
48
+ * @param path defines the absolute path of the executable.
49
+ * @param parseVersion defines the function extracting the version from the output of "<executable> --version".
50
+ */
51
+ export declare function getExecutableVersion(path: string, parseVersion: (output: string) => string | null): Promise<string | null>;
52
+ /**
53
+ * Returns the absolute path of the given command in the PATH of the user, or null when it is not found.
54
+ * @param command defines the name of the command, like "claude".
55
+ */
56
+ export declare function findCommandInPath(command: string): Promise<string | null>;
57
+ export interface IFindExecutableOptions {
58
+ /**
59
+ * Defines the name of the command of the agent, looked up in the PATH of the user.
60
+ */
61
+ command: string;
62
+ /**
63
+ * Defines the path of the executable chosen by the user, if any.
64
+ */
65
+ customPath?: string | null;
66
+ /**
67
+ * Defines the function extracting the version from the output of "<executable> --version".
68
+ */
69
+ parseVersion: (output: string) => string | null;
70
+ /**
71
+ * Defines the function returning the other paths the executable may have, in order of preference.
72
+ */
73
+ getCandidates: () => Promise<IAssistantExecutableCandidate[]>;
74
+ }
75
+ /**
76
+ * Finds the executable of an agent installed on this computer: the one chosen by the user, the one in the PATH of the
77
+ * user, then the given candidates.
78
+ * @returns the first executable that answers "<executable> --version", or null when none is found.
79
+ */
80
+ export declare function findExecutable(options: IFindExecutableOptions): Promise<IAssistantExecutable | null>;
@@ -0,0 +1,105 @@
1
+ import { IncomingMessage, ServerResponse } from "http";
2
+ /**
3
+ * Defines what the AI assistant is doing: nothing, working on a request of the user, or waiting for the user to answer
4
+ * it, to allow a tool for example.
5
+ */
6
+ export type EditorAssistantWorkState = "idle" | "working" | "waiting";
7
+ /**
8
+ * Defines the oldest version of Claude Code the assistant follows with hooks. HTTP hooks exist since 2.1.63, and before
9
+ * 2.1.101 a hook event Claude Code didn't know made it ignore the whole settings file, permissions included.
10
+ */
11
+ export declare const assistantHooksMinimumClaudeVersion = "2.1.101";
12
+ /**
13
+ * Defines the hook events of Claude Code the assistant follows to know what it is doing. Claude Code sends each of them
14
+ * to the HTTP server of the assistant as a POST request on "/<event>".
15
+ */
16
+ export declare const assistantHookEvents: string[];
17
+ /**
18
+ * Defines the fields of the input of the hook events the assistant reads.
19
+ */
20
+ export interface IAssistantHookInput {
21
+ /**
22
+ * Defines the type of the notification, for "Notification" events.
23
+ */
24
+ notification_type?: string;
25
+ /**
26
+ * Defines the text of the notification, for "Notification" events.
27
+ */
28
+ message?: string;
29
+ /**
30
+ * Defines the type of the error, for "StopFailure" events.
31
+ */
32
+ error?: string;
33
+ /**
34
+ * Defines the last message of the turn, which is the text of the error for "StopFailure" events.
35
+ */
36
+ last_assistant_message?: string;
37
+ /**
38
+ * Defines why Antigravity CLI stopped, like "NO_TOOL_CALL" or "error", for its "Stop" events.
39
+ */
40
+ terminationReason?: string;
41
+ }
42
+ export interface IAssistantHooksServer {
43
+ /**
44
+ * Defines the URL of the server, on the loopback interface.
45
+ */
46
+ readonly url: string;
47
+ /**
48
+ * Defines the token the requests must send in the "x-babylonjs-editor-token" header.
49
+ */
50
+ readonly token: string;
51
+ /**
52
+ * Stops listening.
53
+ */
54
+ close(): Promise<void>;
55
+ }
56
+ /**
57
+ * Returns wether or not the given version of Claude Code can tell the assistant what it is doing through hooks.
58
+ * @param claudeVersion defines the version of Claude Code, like "2.1.283".
59
+ */
60
+ export declare function supportsAssistantHooks(claudeVersion: string): boolean;
61
+ /**
62
+ * Returns wether or not the given "Notification" hook event tells that Claude Code waits for the user to answer.
63
+ * @param input defines the input of the hook event.
64
+ */
65
+ export declare function isAssistantInputNotification(input: IAssistantHookInput): boolean;
66
+ /**
67
+ * Returns what the assistant is doing after the given hook event of Claude Code.
68
+ * @param state defines what the assistant was doing.
69
+ * @param event defines the name of the hook event.
70
+ * @param input defines the input of the hook event.
71
+ */
72
+ export declare function getAssistantWorkStateAfterHook(state: EditorAssistantWorkState, event: string, input: IAssistantHookInput): EditorAssistantWorkState;
73
+ /**
74
+ * Returns what the assistant is doing after the user typed the given data in its terminal. Claude Code stops the
75
+ * current request, without running any hook, when the user presses Escape or Ctrl+C.
76
+ * @param state defines what the assistant was doing.
77
+ * @param data defines the data typed by the user.
78
+ */
79
+ export declare function getAssistantWorkStateAfterInput(state: EditorAssistantWorkState, data: string): EditorAssistantWorkState;
80
+ export interface IAssistantHooksServerOptions {
81
+ /**
82
+ * Defines the hook events the server accepts. Defaults to the ones of Claude Code.
83
+ */
84
+ events?: string[];
85
+ /**
86
+ * Defines the body of the answers, which the agent reads as the result of the hook. Defaults to an empty body, which
87
+ * lets Claude Code go on as if there was no hook.
88
+ */
89
+ body?: string;
90
+ }
91
+ /**
92
+ * Creates the function handling the hook events the agent sends to the assistant. It always answers with the same body,
93
+ * which lets the agent go on as if there was no hook.
94
+ * @param token defines the token requests must send in the "x-babylonjs-editor-token" header.
95
+ * @param onHook defines the function called with the name and the input of each hook event.
96
+ * @param options defines the events accepted and the body of the answers.
97
+ */
98
+ export declare function createAssistantHooksListener(token: string, onHook: (event: string, input: IAssistantHookInput) => void, options?: IAssistantHooksServerOptions): (req: IncomingMessage, res: ServerResponse) => Promise<void>;
99
+ /**
100
+ * Starts the HTTP server the agent sends the hook events of the assistant to. It only listens on the loopback
101
+ * interface, on a port chosen by the system, and expects a new random token.
102
+ * @param onHook defines the function called with the name and the input of each hook event.
103
+ * @param options defines the events accepted and the body of the answers.
104
+ */
105
+ export declare function startAssistantHooksServer(onHook: (event: string, input: IAssistantHookInput) => void, options?: IAssistantHooksServerOptions): Promise<IAssistantHooksServer>;
@@ -0,0 +1,21 @@
1
+ import { ReactNode } from "react";
2
+ import type { EditorAssistantWorkState } from "./hooks";
3
+ export interface IEditorAssistantIconProps {
4
+ /**
5
+ * Defines what the assistant is doing.
6
+ */
7
+ workState: EditorAssistantWorkState;
8
+ /**
9
+ * Defines the size of the icon, in pixels.
10
+ */
11
+ size: number;
12
+ /**
13
+ * Defines wether or not the icon is painted with a multicolor gradient instead of the color of the text. The
14
+ * spinner shown while the assistant works always has the color of the text.
15
+ */
16
+ multicolor?: boolean;
17
+ }
18
+ /**
19
+ * Displays the icon of the AI assistant: a spinner while it works, and a dot while it waits for the user to answer.
20
+ */
21
+ export declare function EditorAssistantIcon(props: IEditorAssistantIconProps): ReactNode;