@theia/ai-tool-sketchpad 1.74.0-next.53

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 (43) hide show
  1. package/README.md +44 -0
  2. package/lib/browser/frontend-module.d.ts +5 -0
  3. package/lib/browser/frontend-module.d.ts.map +1 -0
  4. package/lib/browser/frontend-module.js +41 -0
  5. package/lib/browser/frontend-module.js.map +1 -0
  6. package/lib/browser/index.d.ts +4 -0
  7. package/lib/browser/index.d.ts.map +1 -0
  8. package/lib/browser/index.js +22 -0
  9. package/lib/browser/index.js.map +1 -0
  10. package/lib/browser/sketched-tool-contribution.d.ts +7 -0
  11. package/lib/browser/sketched-tool-contribution.d.ts.map +1 -0
  12. package/lib/browser/sketched-tool-contribution.js +42 -0
  13. package/lib/browser/sketched-tool-contribution.js.map +1 -0
  14. package/lib/browser/sketched-tool-service.d.ts +37 -0
  15. package/lib/browser/sketched-tool-service.d.ts.map +1 -0
  16. package/lib/browser/sketched-tool-service.js +266 -0
  17. package/lib/browser/sketched-tool-service.js.map +1 -0
  18. package/lib/browser/sketched-tool-widget.d.ts +23 -0
  19. package/lib/browser/sketched-tool-widget.d.ts.map +1 -0
  20. package/lib/browser/sketched-tool-widget.js +455 -0
  21. package/lib/browser/sketched-tool-widget.js.map +1 -0
  22. package/lib/common/index.d.ts +2 -0
  23. package/lib/common/index.d.ts.map +1 -0
  24. package/lib/common/index.js +20 -0
  25. package/lib/common/index.js.map +1 -0
  26. package/lib/common/sketched-tool.d.ts +51 -0
  27. package/lib/common/sketched-tool.d.ts.map +1 -0
  28. package/lib/common/sketched-tool.js +85 -0
  29. package/lib/common/sketched-tool.js.map +1 -0
  30. package/lib/package.spec.d.ts +1 -0
  31. package/lib/package.spec.d.ts.map +1 -0
  32. package/lib/package.spec.js +24 -0
  33. package/lib/package.spec.js.map +1 -0
  34. package/package.json +52 -0
  35. package/src/browser/frontend-module.ts +43 -0
  36. package/src/browser/index.ts +19 -0
  37. package/src/browser/sketched-tool-contribution.ts +37 -0
  38. package/src/browser/sketched-tool-service.ts +282 -0
  39. package/src/browser/sketched-tool-widget.tsx +707 -0
  40. package/src/browser/style/index.css +387 -0
  41. package/src/common/index.ts +17 -0
  42. package/src/common/sketched-tool.ts +118 -0
  43. package/src/package.spec.ts +25 -0
package/README.md ADDED
@@ -0,0 +1,44 @@
1
+ <div align='center'>
2
+
3
+ <br />
4
+
5
+ <img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />
6
+
7
+ <h2>ECLIPSE THEIA - AI TOOL SKETCHPAD EXTENSION</h2>
8
+
9
+ <hr />
10
+
11
+ </div>
12
+
13
+ ## Description
14
+
15
+ The `@theia/ai-tool-sketchpad` extension lets you prototype LLM tools at runtime without writing or rebuilding any code.
16
+
17
+ When designing custom AI agents, most aspects of agent behavior (system prompts, LLMs, skills, MCPs) can already be adjusted at runtime. Custom tools were the remaining gap. This extension closes it by letting you define _sketched tools_ declaratively: name, description, input parameters, and return behavior. The tool implementation is deliberately left out.
18
+
19
+ ## Usage
20
+
21
+ Open the **AI Tool Sketchpad** view (available once AI features are enabled) to create, edit, and delete sketched tools. Each tool defines:
22
+
23
+ - **Name** and **Description** exposed to the LLM.
24
+ - **Parameters**, including nested object and array parameters.
25
+ - A **Return Mode**:
26
+ - `Static Return Value` always returns a fixed string.
27
+ - `Ask At Runtime` opens a quick input at invocation time so you can supply the return value on the fly.
28
+
29
+ Sketched tools are registered in the `ToolInvocationRegistry` and become immediately available to any AI agent or chat session. Definitions are persisted as YAML and reloaded live when edited externally.
30
+
31
+ ## Additional Information
32
+
33
+ - [Theia - GitHub](https://github.com/eclipse-theia/theia)
34
+ - [Theia - Website](https://theia-ide.org/)
35
+
36
+ ## License
37
+
38
+ - [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
39
+ - [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
40
+
41
+ ## Trademark
42
+
43
+ "Theia" is a trademark of the Eclipse Foundation
44
+ <https://www.eclipse.org/theia>
@@ -0,0 +1,5 @@
1
+ import '../../src/browser/style/index.css';
2
+ import { ContainerModule } from '@theia/core/shared/inversify';
3
+ declare const _default: ContainerModule;
4
+ export default _default;
5
+ //# sourceMappingURL=frontend-module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frontend-module.d.ts","sourceRoot":"","sources":["../../src/browser/frontend-module.ts"],"names":[],"mappings":"AAgBA,OAAO,mCAAmC,CAAC;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;;AAO/D,wBAiBG"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2026 EclipseSource and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ require("../../src/browser/style/index.css");
19
+ const inversify_1 = require("@theia/core/shared/inversify");
20
+ const browser_1 = require("@theia/core/lib/browser");
21
+ const common_1 = require("../common");
22
+ const sketched_tool_service_1 = require("./sketched-tool-service");
23
+ const sketched_tool_widget_1 = require("./sketched-tool-widget");
24
+ const sketched_tool_contribution_1 = require("./sketched-tool-contribution");
25
+ exports.default = new inversify_1.ContainerModule(bind => {
26
+ // Service
27
+ bind(sketched_tool_service_1.SketchedToolServiceImpl).toSelf().inSingletonScope();
28
+ bind(common_1.SketchedToolService).toService(sketched_tool_service_1.SketchedToolServiceImpl);
29
+ bind(browser_1.FrontendApplicationContribution).toService(sketched_tool_service_1.SketchedToolServiceImpl);
30
+ // Widget
31
+ bind(sketched_tool_widget_1.SketchedToolWidget).toSelf();
32
+ bind(browser_1.WidgetFactory)
33
+ .toDynamicValue(ctx => ({
34
+ id: sketched_tool_widget_1.SketchedToolWidget.ID,
35
+ createWidget: () => ctx.container.get(sketched_tool_widget_1.SketchedToolWidget)
36
+ }))
37
+ .inSingletonScope();
38
+ // View contribution
39
+ (0, browser_1.bindViewContribution)(bind, sketched_tool_contribution_1.SketchedToolViewContribution);
40
+ });
41
+ //# sourceMappingURL=frontend-module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frontend-module.js","sourceRoot":"","sources":["../../src/browser/frontend-module.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAEhF,6CAA2C;AAE3C,4DAA+D;AAC/D,qDAA+G;AAC/G,sCAAgD;AAChD,mEAAkE;AAClE,iEAA4D;AAC5D,6EAA4E;AAE5E,kBAAe,IAAI,2BAAe,CAAC,IAAI,CAAC,EAAE;IACtC,UAAU;IACV,IAAI,CAAC,+CAAuB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC1D,IAAI,CAAC,4BAAmB,CAAC,CAAC,SAAS,CAAC,+CAAuB,CAAC,CAAC;IAC7D,IAAI,CAAC,yCAA+B,CAAC,CAAC,SAAS,CAAC,+CAAuB,CAAC,CAAC;IAEzE,SAAS;IACT,IAAI,CAAC,yCAAkB,CAAC,CAAC,MAAM,EAAE,CAAC;IAClC,IAAI,CAAC,uBAAa,CAAC;SACd,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACpB,EAAE,EAAE,yCAAkB,CAAC,EAAE;QACzB,YAAY,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,yCAAkB,CAAC;KAC5D,CAAC,CAAC;SACF,gBAAgB,EAAE,CAAC;IAExB,oBAAoB;IACpB,IAAA,8BAAoB,EAAC,IAAI,EAAE,yDAA4B,CAAC,CAAC;AAC7D,CAAC,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './sketched-tool-service';
2
+ export * from './sketched-tool-widget';
3
+ export * from './sketched-tool-contribution';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAgBA,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2026 EclipseSource and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const tslib_1 = require("tslib");
19
+ tslib_1.__exportStar(require("./sketched-tool-service"), exports);
20
+ tslib_1.__exportStar(require("./sketched-tool-widget"), exports);
21
+ tslib_1.__exportStar(require("./sketched-tool-contribution"), exports);
22
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAEhF,kEAAwC;AACxC,iEAAuC;AACvC,uEAA6C"}
@@ -0,0 +1,7 @@
1
+ import { AIViewContribution } from '@theia/ai-core/lib/browser';
2
+ import { SketchedToolWidget } from './sketched-tool-widget';
3
+ export declare const SKETCHED_TOOL_TOGGLE_COMMAND_ID = "aiToolSketchpad:toggle";
4
+ export declare class SketchedToolViewContribution extends AIViewContribution<SketchedToolWidget> {
5
+ constructor();
6
+ }
7
+ //# sourceMappingURL=sketched-tool-contribution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sketched-tool-contribution.d.ts","sourceRoot":"","sources":["../../src/browser/sketched-tool-contribution.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,eAAO,MAAM,+BAA+B,2BAA2B,CAAC;AAExE,qBACa,4BAA6B,SAAQ,kBAAkB,CAAC,kBAAkB,CAAC;;CAavF"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2026 EclipseSource and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.SketchedToolViewContribution = exports.SKETCHED_TOOL_TOGGLE_COMMAND_ID = void 0;
19
+ const tslib_1 = require("tslib");
20
+ const inversify_1 = require("@theia/core/shared/inversify");
21
+ const browser_1 = require("@theia/ai-core/lib/browser");
22
+ const sketched_tool_widget_1 = require("./sketched-tool-widget");
23
+ exports.SKETCHED_TOOL_TOGGLE_COMMAND_ID = 'aiToolSketchpad:toggle';
24
+ let SketchedToolViewContribution = class SketchedToolViewContribution extends browser_1.AIViewContribution {
25
+ constructor() {
26
+ super({
27
+ widgetId: sketched_tool_widget_1.SketchedToolWidget.ID,
28
+ widgetName: sketched_tool_widget_1.SketchedToolWidget.LABEL,
29
+ defaultWidgetOptions: {
30
+ area: 'main',
31
+ rank: 200
32
+ },
33
+ toggleCommandId: exports.SKETCHED_TOOL_TOGGLE_COMMAND_ID
34
+ });
35
+ }
36
+ };
37
+ exports.SketchedToolViewContribution = SketchedToolViewContribution;
38
+ exports.SketchedToolViewContribution = SketchedToolViewContribution = tslib_1.__decorate([
39
+ (0, inversify_1.injectable)(),
40
+ tslib_1.__metadata("design:paramtypes", [])
41
+ ], SketchedToolViewContribution);
42
+ //# sourceMappingURL=sketched-tool-contribution.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sketched-tool-contribution.js","sourceRoot":"","sources":["../../src/browser/sketched-tool-contribution.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,4DAA0D;AAC1D,wDAAgE;AAChE,iEAA4D;AAE/C,QAAA,+BAA+B,GAAG,wBAAwB,CAAC;AAGjE,IAAM,4BAA4B,GAAlC,MAAM,4BAA6B,SAAQ,4BAAsC;IAEpF;QACI,KAAK,CAAC;YACF,QAAQ,EAAE,yCAAkB,CAAC,EAAE;YAC/B,UAAU,EAAE,yCAAkB,CAAC,KAAK;YACpC,oBAAoB,EAAE;gBAClB,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,GAAG;aACZ;YACD,eAAe,EAAE,uCAA+B;SACnD,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;AAbY,oEAA4B;uCAA5B,4BAA4B;IADxC,IAAA,sBAAU,GAAE;;GACA,4BAA4B,CAaxC"}
@@ -0,0 +1,37 @@
1
+ import { DisposableCollection, Emitter, Event, URI } from '@theia/core';
2
+ import { FrontendApplicationContribution, QuickInputService } from '@theia/core/lib/browser';
3
+ import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
4
+ import { FileService } from '@theia/filesystem/lib/browser/file-service';
5
+ import { ToolInvocationRegistry, ToolRequest, ToolRequestParameters, ToolRequestParameterProperty } from '@theia/ai-core';
6
+ import { SketchedToolDefinition, SketchedToolParameterDefinition, SketchedToolService } from '../common';
7
+ export declare class SketchedToolServiceImpl implements SketchedToolService, FrontendApplicationContribution {
8
+ protected readonly fileService: FileService;
9
+ protected readonly envVariablesServer: EnvVariablesServer;
10
+ protected readonly toolInvocationRegistry: ToolInvocationRegistry;
11
+ protected readonly quickInputService: QuickInputService;
12
+ protected tools: SketchedToolDefinition[];
13
+ protected fileUri: URI | undefined;
14
+ protected readonly toDispose: DisposableCollection;
15
+ protected loading: boolean;
16
+ /** The content we last wrote to disk, used to ignore file-watch events triggered by our own writes. */
17
+ protected lastPersistedContent: string | undefined;
18
+ protected readonly onDidChangeSketchedToolsEmitter: Emitter<void>;
19
+ readonly onDidChangeSketchedTools: Event<void>;
20
+ protected init(): void;
21
+ onStart(): Promise<void>;
22
+ getSketchedTools(): SketchedToolDefinition[];
23
+ addSketchedTool(tool: SketchedToolDefinition): Promise<void>;
24
+ updateSketchedTool(tool: SketchedToolDefinition): Promise<void>;
25
+ removeSketchedTool(toolId: string): Promise<void>;
26
+ protected resolveFileUri(): Promise<URI>;
27
+ protected loadFromDisk(): Promise<void>;
28
+ onStop(): void;
29
+ protected persistToDisk(): Promise<void>;
30
+ protected watchFile(): void;
31
+ protected registerAllTools(): void;
32
+ protected toToolRequest(def: SketchedToolDefinition, name: string): ToolRequest;
33
+ protected askUserForReturnValue(toolName: string, argString: string): Promise<string>;
34
+ protected convertParameters(params: SketchedToolParameterDefinition[]): ToolRequestParameters;
35
+ protected convertParameterProperty(param: SketchedToolParameterDefinition): ToolRequestParameterProperty;
36
+ }
37
+ //# sourceMappingURL=sketched-tool-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sketched-tool-service.d.ts","sourceRoot":"","sources":["../../src/browser/sketched-tool-service.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,oBAAoB,EAAE,OAAO,EAAE,KAAK,EAAO,GAAG,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EAAE,+BAA+B,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAG1E,OAAO,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AAEzE,OAAO,EACH,sBAAsB,EACtB,WAAW,EACX,qBAAqB,EACrB,4BAA4B,EAC/B,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACH,sBAAsB,EACtB,+BAA+B,EAC/B,mBAAmB,EAEtB,MAAM,WAAW,CAAC;AAInB,qBACa,uBAAwB,YAAW,mBAAmB,EAAE,+BAA+B;IAGhG,SAAS,CAAC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAG5C,SAAS,CAAC,QAAQ,CAAC,kBAAkB,EAAE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AO,CAAC,MAAM,CAAC;IAU3F,SAAS,CAAC,iBAAiB,CAAC,MAAM,EAAE,+BAA+B,EAAE,GAAG,qBAAqB;IAkB7F,SAAS,CAAC,wBAAwB,CAAC,KAAK,EAAE,+BAA+B,GAAG,4BAA4B;CA6B3G"}
@@ -0,0 +1,266 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2026 EclipseSource and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.SketchedToolServiceImpl = void 0;
19
+ const tslib_1 = require("tslib");
20
+ const core_1 = require("@theia/core");
21
+ const browser_1 = require("@theia/core/lib/browser");
22
+ const env_variables_1 = require("@theia/core/lib/common/env-variables");
23
+ const buffer_1 = require("@theia/core/lib/common/buffer");
24
+ const inversify_1 = require("@theia/core/shared/inversify");
25
+ const file_service_1 = require("@theia/filesystem/lib/browser/file-service");
26
+ const ai_core_1 = require("@theia/ai-core");
27
+ const js_yaml_1 = require("js-yaml");
28
+ const common_1 = require("../common");
29
+ const SKETCHED_TOOLS_FILENAME = 'sketchedTools.yml';
30
+ let SketchedToolServiceImpl = class SketchedToolServiceImpl {
31
+ constructor() {
32
+ this.tools = [];
33
+ this.toDispose = new core_1.DisposableCollection();
34
+ this.loading = false;
35
+ this.onDidChangeSketchedToolsEmitter = new core_1.Emitter();
36
+ this.onDidChangeSketchedTools = this.onDidChangeSketchedToolsEmitter.event;
37
+ }
38
+ init() {
39
+ this.toDispose.push(this.onDidChangeSketchedToolsEmitter);
40
+ }
41
+ async onStart() {
42
+ this.fileUri = await this.resolveFileUri();
43
+ await this.loadFromDisk();
44
+ this.watchFile();
45
+ }
46
+ getSketchedTools() {
47
+ return [...this.tools];
48
+ }
49
+ async addSketchedTool(tool) {
50
+ this.tools.push(tool);
51
+ this.registerAllTools();
52
+ await this.persistToDisk();
53
+ this.onDidChangeSketchedToolsEmitter.fire();
54
+ }
55
+ async updateSketchedTool(tool) {
56
+ const index = this.tools.findIndex(t => t.id === tool.id);
57
+ if (index >= 0) {
58
+ this.tools[index] = tool;
59
+ }
60
+ else {
61
+ this.tools.push(tool);
62
+ }
63
+ this.registerAllTools();
64
+ await this.persistToDisk();
65
+ this.onDidChangeSketchedToolsEmitter.fire();
66
+ }
67
+ async removeSketchedTool(toolId) {
68
+ this.tools = this.tools.filter(t => t.id !== toolId);
69
+ this.registerAllTools();
70
+ await this.persistToDisk();
71
+ this.onDidChangeSketchedToolsEmitter.fire();
72
+ }
73
+ async resolveFileUri() {
74
+ const configDirUri = await this.envVariablesServer.getConfigDirUri();
75
+ return new core_1.URI(configDirUri).resolve('prompt-templates').resolve(SKETCHED_TOOLS_FILENAME);
76
+ }
77
+ async loadFromDisk() {
78
+ if (!this.fileUri) {
79
+ return;
80
+ }
81
+ this.loading = true;
82
+ try {
83
+ const exists = await this.fileService.exists(this.fileUri);
84
+ if (!exists) {
85
+ this.tools = [];
86
+ this.registerAllTools();
87
+ return;
88
+ }
89
+ const fileContent = await this.fileService.read(this.fileUri, { encoding: 'utf-8' });
90
+ if (fileContent.value === this.lastPersistedContent) {
91
+ // This change was triggered by our own write; the in-memory state is already up to date.
92
+ return;
93
+ }
94
+ const doc = (0, js_yaml_1.load)(fileContent.value);
95
+ if (Array.isArray(doc)) {
96
+ // Skip invalid entries rather than discarding all tools if one entry is malformed.
97
+ const valid = doc.filter(entry => common_1.SketchedToolDefinition.is(entry));
98
+ const skipped = doc.length - valid.length;
99
+ if (skipped > 0) {
100
+ console.debug(`Skipped ${skipped} invalid entr${skipped === 1 ? 'y' : 'ies'} in ${SKETCHED_TOOLS_FILENAME}.`);
101
+ }
102
+ this.tools = valid.map(common_1.SketchedToolDefinition.normalize);
103
+ }
104
+ else {
105
+ console.debug(`Invalid ${SKETCHED_TOOLS_FILENAME} content, ignoring.`);
106
+ this.tools = [];
107
+ }
108
+ this.registerAllTools();
109
+ this.onDidChangeSketchedToolsEmitter.fire();
110
+ }
111
+ catch (e) {
112
+ console.debug(`Error loading ${SKETCHED_TOOLS_FILENAME}: ${e.message}`, e);
113
+ }
114
+ finally {
115
+ this.loading = false;
116
+ }
117
+ }
118
+ onStop() {
119
+ this.toDispose.dispose();
120
+ }
121
+ async persistToDisk() {
122
+ if (!this.fileUri) {
123
+ return;
124
+ }
125
+ try {
126
+ const yamlContent = (0, js_yaml_1.dump)(this.tools, { lineWidth: -1 });
127
+ const buffer = buffer_1.BinaryBuffer.fromString(yamlContent);
128
+ if (await this.fileService.exists(this.fileUri)) {
129
+ await this.fileService.writeFile(this.fileUri, buffer);
130
+ }
131
+ else {
132
+ await this.fileService.createFile(this.fileUri, buffer);
133
+ }
134
+ this.lastPersistedContent = yamlContent;
135
+ }
136
+ catch (e) {
137
+ console.error(`Error persisting ${SKETCHED_TOOLS_FILENAME}: ${e.message}`, e);
138
+ }
139
+ }
140
+ watchFile() {
141
+ if (!this.fileUri) {
142
+ return;
143
+ }
144
+ const parentUri = this.fileUri.parent;
145
+ this.toDispose.push(this.fileService.watch(parentUri));
146
+ const listener = this.fileService.onDidFilesChange((event) => {
147
+ if (this.fileUri && event.contains(this.fileUri) && !this.loading) {
148
+ this.loadFromDisk();
149
+ }
150
+ });
151
+ this.toDispose.push(listener);
152
+ }
153
+ registerAllTools() {
154
+ this.toolInvocationRegistry.unregisterAllTools(common_1.SKETCHED_TOOLS_PROVIDER_NAME);
155
+ // Guard against invalid or duplicate names in hand-edited YAML: the name is the registered id,
156
+ // so an invalid name is uncallable and a duplicate would collide. Register the first valid one.
157
+ const registeredNames = new Set();
158
+ for (const def of this.tools) {
159
+ const name = def.name.trim();
160
+ if (!common_1.SketchedToolDefinition.NAME_PATTERN.test(name)) {
161
+ console.warn(`Skipping sketched tool "${def.name}": name is empty or contains invalid characters.`);
162
+ continue;
163
+ }
164
+ if (registeredNames.has(name)) {
165
+ console.warn(`Skipping sketched tool "${name}": another tool with the same name is already registered.`);
166
+ continue;
167
+ }
168
+ registeredNames.add(name);
169
+ this.toolInvocationRegistry.registerTool(this.toToolRequest(def, name));
170
+ }
171
+ }
172
+ toToolRequest(def, name) {
173
+ const parameters = this.convertParameters(def.parameters);
174
+ return {
175
+ // The readable name doubles as the id so chat completions insert a meaningful reference;
176
+ // the internal UUID (def.id) remains the persistence key, keeping renames lossless.
177
+ id: name,
178
+ name,
179
+ description: def.description,
180
+ providerName: common_1.SKETCHED_TOOLS_PROVIDER_NAME,
181
+ parameters,
182
+ handler: async (argString) => {
183
+ if (def.returnMode === 'askAtRuntime') {
184
+ return this.askUserForReturnValue(name, argString);
185
+ }
186
+ return def.staticReturn;
187
+ }
188
+ };
189
+ }
190
+ async askUserForReturnValue(toolName, argString) {
191
+ const result = await this.quickInputService.input({
192
+ prompt: core_1.nls.localize('theia/ai-tool-sketchpad/askReturnPrompt', 'Tool "{0}" was called with: {1}', toolName, argString),
193
+ placeHolder: core_1.nls.localize('theia/ai-tool-sketchpad/askReturnPlaceholder', 'Enter the return value for this tool call...')
194
+ });
195
+ return result ?? '';
196
+ }
197
+ convertParameters(params) {
198
+ const properties = {};
199
+ const required = [];
200
+ for (const param of params) {
201
+ properties[param.name] = this.convertParameterProperty(param);
202
+ if (param.required) {
203
+ required.push(param.name);
204
+ }
205
+ }
206
+ return {
207
+ type: 'object',
208
+ properties,
209
+ ...(required.length > 0 ? { required } : {})
210
+ };
211
+ }
212
+ convertParameterProperty(param) {
213
+ const prop = {
214
+ type: param.type,
215
+ description: param.description
216
+ };
217
+ if (param.type === 'object' && param.properties && param.properties.length > 0) {
218
+ const nested = this.convertParameters(param.properties);
219
+ prop.properties = nested.properties;
220
+ if (nested.required && nested.required.length > 0) {
221
+ prop.required = nested.required;
222
+ }
223
+ }
224
+ if (param.type === 'array' && param.itemType) {
225
+ if (param.itemType === 'object' && param.itemProperties && param.itemProperties.length > 0) {
226
+ const nested = this.convertParameters(param.itemProperties);
227
+ prop.items = {
228
+ type: 'object',
229
+ properties: nested.properties,
230
+ ...(nested.required && nested.required.length > 0 ? { required: nested.required } : {})
231
+ };
232
+ }
233
+ else {
234
+ prop.items = { type: param.itemType };
235
+ }
236
+ }
237
+ return prop;
238
+ }
239
+ };
240
+ exports.SketchedToolServiceImpl = SketchedToolServiceImpl;
241
+ tslib_1.__decorate([
242
+ (0, inversify_1.inject)(file_service_1.FileService),
243
+ tslib_1.__metadata("design:type", file_service_1.FileService)
244
+ ], SketchedToolServiceImpl.prototype, "fileService", void 0);
245
+ tslib_1.__decorate([
246
+ (0, inversify_1.inject)(env_variables_1.EnvVariablesServer),
247
+ tslib_1.__metadata("design:type", Object)
248
+ ], SketchedToolServiceImpl.prototype, "envVariablesServer", void 0);
249
+ tslib_1.__decorate([
250
+ (0, inversify_1.inject)(ai_core_1.ToolInvocationRegistry),
251
+ tslib_1.__metadata("design:type", Object)
252
+ ], SketchedToolServiceImpl.prototype, "toolInvocationRegistry", void 0);
253
+ tslib_1.__decorate([
254
+ (0, inversify_1.inject)(browser_1.QuickInputService),
255
+ tslib_1.__metadata("design:type", Object)
256
+ ], SketchedToolServiceImpl.prototype, "quickInputService", void 0);
257
+ tslib_1.__decorate([
258
+ (0, inversify_1.postConstruct)(),
259
+ tslib_1.__metadata("design:type", Function),
260
+ tslib_1.__metadata("design:paramtypes", []),
261
+ tslib_1.__metadata("design:returntype", void 0)
262
+ ], SketchedToolServiceImpl.prototype, "init", null);
263
+ exports.SketchedToolServiceImpl = SketchedToolServiceImpl = tslib_1.__decorate([
264
+ (0, inversify_1.injectable)()
265
+ ], SketchedToolServiceImpl);
266
+ //# sourceMappingURL=sketched-tool-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sketched-tool-service.js","sourceRoot":"","sources":["../../src/browser/sketched-tool-service.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,sCAA6E;AAC7E,qDAA6F;AAC7F,wEAA0E;AAC1E,0DAA6D;AAC7D,4DAAiF;AACjF,6EAAyE;AAEzE,4CAKwB;AACxB,qCAAqC;AACrC,sCAKmB;AAEnB,MAAM,uBAAuB,GAAG,mBAAmB,CAAC;AAG7C,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAA7B;QAcO,UAAK,GAA6B,EAAE,CAAC;QAE5B,cAAS,GAAG,IAAI,2BAAoB,EAAE,CAAC;QAChD,YAAO,GAAG,KAAK,CAAC;QAIP,oCAA+B,GAAG,IAAI,cAAO,EAAQ,CAAC;QAChE,6BAAwB,GAAgB,IAAI,CAAC,+BAA+B,CAAC,KAAK,CAAC;IA2NhG,CAAC;IAxNa,IAAI;QACV,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;IAC9D,CAAC;IAED,KAAK,CAAC,OAAO;QACT,IAAI,CAAC,OAAO,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAC3C,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;QAC1B,IAAI,CAAC,SAAS,EAAE,CAAC;IACrB,CAAC;IAED,gBAAgB;QACZ,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,IAA4B;QAC9C,IAAI,C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AAK,CAAC,QAAQ,KAAK,QAAQ,IAAI,KAAK,CAAC,cAAc,IAAI,KAAK,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACzF,MAAM,MAAM,GAAG,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;gBAC5D,IAAI,CAAC,KAAK,GAAG;oBACT,IAAI,EAAE,QAAQ;oBACd,UAAU,EAAE,MAAM,CAAC,UAAU;oBAC7B,GAAG,CAAC,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;iBAC1F,CAAC;YACN,CAAC;iBAAM,CAAC;gBACJ,IAAI,CAAC,KAAK,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;YAC1C,CAAC;QACL,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ,CAAA;AAjPY,0DAAuB;AAGb;IADlB,IAAA,kBAAM,EAAC,0BAAW,CAAC;sCACY,0BAAW;4DAAC;AAGzB;IADlB,IAAA,kBAAM,EAAC,kCAAkB,CAAC;;mEAC+B;AAGvC;IADlB,IAAA,kBAAM,EAAC,gCAAsB,CAAC;;uEACmC;AAG/C;IADlB,IAAA,kBAAM,EAAC,2BAAiB,CAAC;;kEAC8B;AAa9C;IADT,IAAA,yBAAa,GAAE;;;;mDAGf;kCA3BQ,uBAAuB;IADnC,IAAA,sBAAU,GAAE;GACA,uBAAuB,CAiPnC"}
@@ -0,0 +1,23 @@
1
+ import { ReactWidget } from '@theia/core/lib/browser';
2
+ import * as React from '@theia/core/shared/react';
3
+ import { SketchedToolDefinition, SketchedToolService } from '../common';
4
+ export declare class SketchedToolWidget extends ReactWidget {
5
+ static readonly ID = "ai-tool-sketchpad";
6
+ static readonly LABEL: string;
7
+ protected readonly sketchedToolService: SketchedToolService;
8
+ protected tools: SketchedToolDefinition[];
9
+ protected selectedToolId: string | undefined;
10
+ protected editingTool: SketchedToolDefinition | undefined;
11
+ protected isNewUnsavedTool: boolean;
12
+ protected init(): void;
13
+ protected loadTools(): void;
14
+ protected render(): React.ReactNode;
15
+ protected renderList(): React.ReactNode;
16
+ protected renderDetail(): React.ReactNode;
17
+ protected handleSelectTool: (tool: SketchedToolDefinition) => void;
18
+ protected handleAddTool: () => void;
19
+ protected handleDeleteTool: (toolId: string) => Promise<void>;
20
+ protected clearSelectionIfMatches(toolId: string): void;
21
+ protected handleSave: (tool: SketchedToolDefinition) => Promise<void>;
22
+ }
23
+ //# sourceMappingURL=sketched-tool-widget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sketched-tool-widget.d.ts","sourceRoot":"","sources":["../../src/browser/sketched-tool-widget.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAA0B,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAG9E,OAAO,KAAK,KAAK,MAAM,0BAA0B,CAAC;AAElD,OAAO,EAAE,sBAAsB,EAAsF,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAuf5J,qBACa,kBAAmB,SAAQ,WAAW;IAE/C,MAAM,CAAC,QAAQ,CAAC,EAAE,uBAAuB;IACzC,MAAM,CAAC,QAAQ,CAAC,KAAK,SAAsE;IAG3F,SAAS,CAAC,QAAQ,CAAC,mBAAmB,EAAE,mBAAmB,CAAC;IAE5D,SAAS,CAAC,KAAK,EAAE,sBAAsB,EAAE,CAAM;IAC/C,SAAS,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7C,SAAS,CAAC,WAAW,EAAE,sBAAsB,GAAG,SAAS,CAAC;IAC1D,SAAS,CAAC,gBAAgB,UAAS;IAGnC,SAAS,CAAC,IAAI,IAAI,IAAI;IAiBtB,SAAS,CAAC,SAAS,IAAI,IAAI;IAkB3B,SAAS,CAAC,MAAM,IAAI,KAAK,CAAC,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