@theia/ai-core 1.77.0-next.0 → 1.77.0-next.4
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.
- package/lib/common/index.d.ts +1 -0
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js +1 -0
- package/lib/common/index.js.map +1 -1
- package/lib/common/keyword-list.d.ts +12 -0
- package/lib/common/keyword-list.d.ts.map +1 -0
- package/lib/common/keyword-list.js +39 -0
- package/lib/common/keyword-list.js.map +1 -0
- package/lib/common/keyword-list.spec.d.ts +2 -0
- package/lib/common/keyword-list.spec.d.ts.map +1 -0
- package/lib/common/keyword-list.spec.js +45 -0
- package/lib/common/keyword-list.spec.js.map +1 -0
- package/lib/common/tool-constants.d.ts +4 -0
- package/lib/common/tool-constants.d.ts.map +1 -1
- package/lib/common/tool-constants.js +5 -1
- package/lib/common/tool-constants.js.map +1 -1
- package/package.json +9 -9
- package/src/common/index.ts +1 -0
- package/src/common/keyword-list.spec.ts +49 -0
- package/src/common/keyword-list.ts +41 -0
- package/src/common/tool-constants.ts +5 -0
package/lib/common/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAeA,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAE7B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oCAAoC,CAAC;AACnD,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":"AAeA,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,cAAc,CAAC;AAE7B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oCAAoC,CAAC;AACnD,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC"}
|
package/lib/common/index.js
CHANGED
|
@@ -45,4 +45,5 @@ tslib_1.__exportStar(require("./skill"), exports);
|
|
|
45
45
|
tslib_1.__exportStar(require("./frontmatter"), exports);
|
|
46
46
|
tslib_1.__exportStar(require("./capability-utils"), exports);
|
|
47
47
|
tslib_1.__exportStar(require("./tool-constants"), exports);
|
|
48
|
+
tslib_1.__exportStar(require("./keyword-list"), exports);
|
|
48
49
|
//# sourceMappingURL=index.js.map
|
package/lib/common/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":";;;AAAA,gFAAgF;AAChF,yCAAyC;AACzC,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;AAChF,0DAAgC;AAChC,kDAAwB;AACxB,yEAA+C;AAC/C,gEAAsC;AACtC,qEAA2C;AAC3C,oEAA0C;AAC1C,gEAAsC;AACtC,2DAAiC;AACjC,iEAAuC;AACvC,mEAAyC;AACzC,iEAAuC;AACvC,2DAAiC;AACjC,gEAAsC;AACtC,uDAA6B;AAE7B,wDAA8B;AAC9B,qDAA2B;AAC3B,wEAA8C;AAC9C,6DAAmC;AACnC,6DAAmC;AACnC,qEAA2C;AAC3C,mEAAyC;AACzC,gEAAsC;AACtC,iEAAuC;AACvC,6EAAmD;AACnD,+DAAqC;AACrC,kDAAwB;AACxB,wDAA8B;AAC9B,6DAAmC;AACnC,2DAAiC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common/index.ts"],"names":[],"mappings":";;;AAAA,gFAAgF;AAChF,yCAAyC;AACzC,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;AAChF,0DAAgC;AAChC,kDAAwB;AACxB,yEAA+C;AAC/C,gEAAsC;AACtC,qEAA2C;AAC3C,oEAA0C;AAC1C,gEAAsC;AACtC,2DAAiC;AACjC,iEAAuC;AACvC,mEAAyC;AACzC,iEAAuC;AACvC,2DAAiC;AACjC,gEAAsC;AACtC,uDAA6B;AAE7B,wDAA8B;AAC9B,qDAA2B;AAC3B,wEAA8C;AAC9C,6DAAmC;AACnC,6DAAmC;AACnC,qEAA2C;AAC3C,mEAAyC;AACzC,gEAAsC;AACtC,iEAAuC;AACvC,6EAAmD;AACnD,+DAAqC;AACrC,kDAAwB;AACxB,wDAA8B;AAC9B,6DAAmC;AACnC,2DAAiC;AACjC,yDAA+B"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface KeywordListEntry {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Renders entries for a listing tool as `- <name>: <description>` lines, descriptions collapsed to one line.
|
|
7
|
+
* With a query, keeps only the entries whose name or description contains any of its whitespace-separated
|
|
8
|
+
* keywords (case-insensitive), the entries matching the most keywords first.
|
|
9
|
+
* Returns `undefined` if no entry is left.
|
|
10
|
+
*/
|
|
11
|
+
export declare function listByKeywords(entries: KeywordListEntry[], query?: string): string | undefined;
|
|
12
|
+
//# sourceMappingURL=keyword-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyword-list.d.ts","sourceRoot":"","sources":["../../src/common/keyword-list.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,gBAAgB,EAAE,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAa9F"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2026 EclipseSource GmbH.
|
|
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.listByKeywords = listByKeywords;
|
|
19
|
+
/**
|
|
20
|
+
* Renders entries for a listing tool as `- <name>: <description>` lines, descriptions collapsed to one line.
|
|
21
|
+
* With a query, keeps only the entries whose name or description contains any of its whitespace-separated
|
|
22
|
+
* keywords (case-insensitive), the entries matching the most keywords first.
|
|
23
|
+
* Returns `undefined` if no entry is left.
|
|
24
|
+
*/
|
|
25
|
+
function listByKeywords(entries, query) {
|
|
26
|
+
const terms = query?.toLowerCase().split(/\s+/).filter(term => term.length > 0) ?? [];
|
|
27
|
+
const matches = entries
|
|
28
|
+
.map(entry => {
|
|
29
|
+
const text = `${entry.name} ${entry.description}`.toLowerCase();
|
|
30
|
+
return { entry, hits: terms.filter(term => text.includes(term)).length };
|
|
31
|
+
})
|
|
32
|
+
.filter(match => terms.length === 0 || match.hits > 0)
|
|
33
|
+
.sort((a, b) => b.hits - a.hits);
|
|
34
|
+
if (matches.length === 0) {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
return matches.map(({ entry }) => `- ${entry.name}: ${entry.description.replace(/\s+/g, ' ').trim()}`).join('\n');
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=keyword-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyword-list.js","sourceRoot":"","sources":["../../src/common/keyword-list.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,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;;AAahF,wCAaC;AAnBD;;;;;GAKG;AACH,SAAgB,cAAc,CAAC,OAA2B,EAAE,KAAc;IACtE,MAAM,KAAK,GAAG,KAAK,EAAE,WAAW,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;IACtF,MAAM,OAAO,GAAG,OAAO;SAClB,GAAG,CAAC,KAAK,CAAC,EAAE;QACT,MAAM,IAAI,GAAG,GAAG,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,WAAW,EAAE,CAAC,WAAW,EAAE,CAAC;QAChE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC7E,CAAC,CAAC;SACD,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC;SACrD,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC;IACrC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACtH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyword-list.spec.d.ts","sourceRoot":"","sources":["../../src/common/keyword-list.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2026 EclipseSource GmbH.
|
|
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 chai_1 = require("chai");
|
|
19
|
+
const keyword_list_1 = require("./keyword-list");
|
|
20
|
+
describe('listByKeywords', () => {
|
|
21
|
+
const entries = [
|
|
22
|
+
{ name: 'pdf', description: 'Extract text\nand tables from PDF files.' },
|
|
23
|
+
{ name: 'coding-workflow', description: 'Carry out a code change: refactor, bug fix.' },
|
|
24
|
+
{ name: 'ext:ponytail', description: 'Minimal code, including refactor.' }
|
|
25
|
+
];
|
|
26
|
+
it('lists every entry in order, descriptions on one line, without a query', () => {
|
|
27
|
+
const expected = '- pdf: Extract text and tables from PDF files.\n' +
|
|
28
|
+
'- coding-workflow: Carry out a code change: refactor, bug fix.\n' +
|
|
29
|
+
'- ext:ponytail: Minimal code, including refactor.';
|
|
30
|
+
(0, chai_1.expect)((0, keyword_list_1.listByKeywords)(entries)).to.equal(expected);
|
|
31
|
+
(0, chai_1.expect)((0, keyword_list_1.listByKeywords)(entries, ' ')).to.equal(expected);
|
|
32
|
+
});
|
|
33
|
+
it('keeps entries matching any keyword, case-insensitively, most matches first', () => {
|
|
34
|
+
(0, chai_1.expect)((0, keyword_list_1.listByKeywords)(entries, 'Refactor BUG')).to.equal('- coding-workflow: Carry out a code change: refactor, bug fix.\n' +
|
|
35
|
+
'- ext:ponytail: Minimal code, including refactor.');
|
|
36
|
+
});
|
|
37
|
+
it('matches against the name', () => {
|
|
38
|
+
(0, chai_1.expect)((0, keyword_list_1.listByKeywords)(entries, 'ext:')).to.equal('- ext:ponytail: Minimal code, including refactor.');
|
|
39
|
+
});
|
|
40
|
+
it('returns undefined when nothing matches or there are no entries', () => {
|
|
41
|
+
(0, chai_1.expect)((0, keyword_list_1.listByKeywords)(entries, 'calendar')).to.equal(undefined);
|
|
42
|
+
(0, chai_1.expect)((0, keyword_list_1.listByKeywords)([])).to.equal(undefined);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=keyword-list.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyword-list.spec.js","sourceRoot":"","sources":["../../src/common/keyword-list.spec.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,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,+BAA8B;AAC9B,iDAAgD;AAEhD,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC5B,MAAM,OAAO,GAAG;QACZ,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,0CAA0C,EAAE;QACxE,EAAE,IAAI,EAAE,iBAAiB,EAAE,WAAW,EAAE,6CAA6C,EAAE;QACvF,EAAE,IAAI,EAAE,cAAc,EAAE,WAAW,EAAE,mCAAmC,EAAE;KAC7E,CAAC;IAEF,EAAE,CAAC,uEAAuE,EAAE,GAAG,EAAE;QAC7E,MAAM,QAAQ,GAAG,kDAAkD;YAC/D,kEAAkE;YAClE,mDAAmD,CAAC;QACxD,IAAA,aAAM,EAAC,IAAA,6BAAc,EAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACnD,IAAA,aAAM,EAAC,IAAA,6BAAc,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4EAA4E,EAAE,GAAG,EAAE;QAClF,IAAA,aAAM,EAAC,IAAA,6BAAc,EAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CACpD,kEAAkE;YAClE,mDAAmD,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0BAA0B,EAAE,GAAG,EAAE;QAChC,IAAA,aAAM,EAAC,IAAA,6BAAc,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,mDAAmD,CAAC,CAAC;IAC1G,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gEAAgE,EAAE,GAAG,EAAE;QACtE,IAAA,aAAM,EAAC,IAAA,6BAAc,EAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAChE,IAAA,aAAM,EAAC,IAAA,6BAAc,EAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -3,4 +3,8 @@
|
|
|
3
3
|
* This tool allows agents to delegate tasks to other specialized agents.
|
|
4
4
|
*/
|
|
5
5
|
export declare const AGENT_DELEGATION_FUNCTION_ID = "delegateToAgent";
|
|
6
|
+
/**
|
|
7
|
+
* The function ID for the tool listing the chat agents that can be delegated to.
|
|
8
|
+
*/
|
|
9
|
+
export declare const LIST_AGENTS_FUNCTION_ID = "listAgents";
|
|
6
10
|
//# sourceMappingURL=tool-constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-constants.d.ts","sourceRoot":"","sources":["../../src/common/tool-constants.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AACH,eAAO,MAAM,4BAA4B,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"tool-constants.d.ts","sourceRoot":"","sources":["../../src/common/tool-constants.ts"],"names":[],"mappings":"AAgBA;;;GAGG;AACH,eAAO,MAAM,4BAA4B,oBAAoB,CAAC;AAE9D;;GAEG;AACH,eAAO,MAAM,uBAAuB,eAAe,CAAC"}
|
|
@@ -15,10 +15,14 @@
|
|
|
15
15
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
16
|
// *****************************************************************************
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.AGENT_DELEGATION_FUNCTION_ID = void 0;
|
|
18
|
+
exports.LIST_AGENTS_FUNCTION_ID = exports.AGENT_DELEGATION_FUNCTION_ID = void 0;
|
|
19
19
|
/**
|
|
20
20
|
* The function ID for the agent delegation tool.
|
|
21
21
|
* This tool allows agents to delegate tasks to other specialized agents.
|
|
22
22
|
*/
|
|
23
23
|
exports.AGENT_DELEGATION_FUNCTION_ID = 'delegateToAgent';
|
|
24
|
+
/**
|
|
25
|
+
* The function ID for the tool listing the chat agents that can be delegated to.
|
|
26
|
+
*/
|
|
27
|
+
exports.LIST_AGENTS_FUNCTION_ID = 'listAgents';
|
|
24
28
|
//# sourceMappingURL=tool-constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-constants.js","sourceRoot":"","sources":["../../src/common/tool-constants.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,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;;;GAGG;AACU,QAAA,4BAA4B,GAAG,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"tool-constants.js","sourceRoot":"","sources":["../../src/common/tool-constants.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,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;;;GAGG;AACU,QAAA,4BAA4B,GAAG,iBAAiB,CAAC;AAE9D;;GAEG;AACU,QAAA,uBAAuB,GAAG,YAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/ai-core",
|
|
3
|
-
"version": "1.77.0-next.
|
|
3
|
+
"version": "1.77.0-next.4+4f24ee401",
|
|
4
4
|
"description": "Theia - AI Core",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@theia/core": "1.77.0-next.
|
|
7
|
-
"@theia/editor": "1.77.0-next.
|
|
8
|
-
"@theia/filesystem": "1.77.0-next.
|
|
9
|
-
"@theia/monaco": "1.77.0-next.
|
|
6
|
+
"@theia/core": "1.77.0-next.4+4f24ee401",
|
|
7
|
+
"@theia/editor": "1.77.0-next.4+4f24ee401",
|
|
8
|
+
"@theia/filesystem": "1.77.0-next.4+4f24ee401",
|
|
9
|
+
"@theia/monaco": "1.77.0-next.4+4f24ee401",
|
|
10
10
|
"@theia/monaco-editor-core": "1.108.201",
|
|
11
|
-
"@theia/output": "1.77.0-next.
|
|
12
|
-
"@theia/variable-resolver": "1.77.0-next.
|
|
13
|
-
"@theia/workspace": "1.77.0-next.
|
|
11
|
+
"@theia/output": "1.77.0-next.4+4f24ee401",
|
|
12
|
+
"@theia/variable-resolver": "1.77.0-next.4+4f24ee401",
|
|
13
|
+
"@theia/workspace": "1.77.0-next.4+4f24ee401",
|
|
14
14
|
"@types/js-yaml": "^4.0.9",
|
|
15
15
|
"fast-deep-equal": "^3.1.3",
|
|
16
16
|
"js-yaml": "^4.3.2",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"nyc": {
|
|
59
59
|
"extends": "../../configs/nyc.json"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "4f24ee40105b8c53808c8293c41387304d15960c"
|
|
62
62
|
}
|
package/src/common/index.ts
CHANGED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2026 EclipseSource GmbH.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { expect } from 'chai';
|
|
18
|
+
import { listByKeywords } from './keyword-list';
|
|
19
|
+
|
|
20
|
+
describe('listByKeywords', () => {
|
|
21
|
+
const entries = [
|
|
22
|
+
{ name: 'pdf', description: 'Extract text\nand tables from PDF files.' },
|
|
23
|
+
{ name: 'coding-workflow', description: 'Carry out a code change: refactor, bug fix.' },
|
|
24
|
+
{ name: 'ext:ponytail', description: 'Minimal code, including refactor.' }
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
it('lists every entry in order, descriptions on one line, without a query', () => {
|
|
28
|
+
const expected = '- pdf: Extract text and tables from PDF files.\n' +
|
|
29
|
+
'- coding-workflow: Carry out a code change: refactor, bug fix.\n' +
|
|
30
|
+
'- ext:ponytail: Minimal code, including refactor.';
|
|
31
|
+
expect(listByKeywords(entries)).to.equal(expected);
|
|
32
|
+
expect(listByKeywords(entries, ' ')).to.equal(expected);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('keeps entries matching any keyword, case-insensitively, most matches first', () => {
|
|
36
|
+
expect(listByKeywords(entries, 'Refactor BUG')).to.equal(
|
|
37
|
+
'- coding-workflow: Carry out a code change: refactor, bug fix.\n' +
|
|
38
|
+
'- ext:ponytail: Minimal code, including refactor.');
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('matches against the name', () => {
|
|
42
|
+
expect(listByKeywords(entries, 'ext:')).to.equal('- ext:ponytail: Minimal code, including refactor.');
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('returns undefined when nothing matches or there are no entries', () => {
|
|
46
|
+
expect(listByKeywords(entries, 'calendar')).to.equal(undefined);
|
|
47
|
+
expect(listByKeywords([])).to.equal(undefined);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2026 EclipseSource GmbH.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
export interface KeywordListEntry {
|
|
18
|
+
name: string;
|
|
19
|
+
description: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Renders entries for a listing tool as `- <name>: <description>` lines, descriptions collapsed to one line.
|
|
24
|
+
* With a query, keeps only the entries whose name or description contains any of its whitespace-separated
|
|
25
|
+
* keywords (case-insensitive), the entries matching the most keywords first.
|
|
26
|
+
* Returns `undefined` if no entry is left.
|
|
27
|
+
*/
|
|
28
|
+
export function listByKeywords(entries: KeywordListEntry[], query?: string): string | undefined {
|
|
29
|
+
const terms = query?.toLowerCase().split(/\s+/).filter(term => term.length > 0) ?? [];
|
|
30
|
+
const matches = entries
|
|
31
|
+
.map(entry => {
|
|
32
|
+
const text = `${entry.name} ${entry.description}`.toLowerCase();
|
|
33
|
+
return { entry, hits: terms.filter(term => text.includes(term)).length };
|
|
34
|
+
})
|
|
35
|
+
.filter(match => terms.length === 0 || match.hits > 0)
|
|
36
|
+
.sort((a, b) => b.hits - a.hits);
|
|
37
|
+
if (matches.length === 0) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
return matches.map(({ entry }) => `- ${entry.name}: ${entry.description.replace(/\s+/g, ' ').trim()}`).join('\n');
|
|
41
|
+
}
|
|
@@ -19,3 +19,8 @@
|
|
|
19
19
|
* This tool allows agents to delegate tasks to other specialized agents.
|
|
20
20
|
*/
|
|
21
21
|
export const AGENT_DELEGATION_FUNCTION_ID = 'delegateToAgent';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The function ID for the tool listing the chat agents that can be delegated to.
|
|
25
|
+
*/
|
|
26
|
+
export const LIST_AGENTS_FUNCTION_ID = 'listAgents';
|