@genesislcap/ai-assistant 14.428.0 → 14.428.1
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrating-driver.d.ts","sourceRoot":"","sources":["../../../../src/components/orchestrating-driver/orchestrating-driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,WAAW,EAEZ,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,WAAW,EAA8C,MAAM,qBAAqB,CAAC;AAGnG,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AA+CxE;;;;;;GAMG;AACH,qBAAa,mBAAoB,SAAQ,WAAY,YAAW,QAAQ;IAWpE,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM;IAXzB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA0B;IACtD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAsB;IAChD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,uBAAuB,CAAS;IACjD,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAS;IAE3C,WAAW,CAAC,EAAE,WAAW,CAAC;gBAGP,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,WAAW,EAAE,EACtC,OAAO,GAAE;QACP,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,uBAAuB,CAAC,EAAE,MAAM,CAAC;QACjC,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;KACvB;IA6CR,kBAAkB,CAAC,aAAa,EAAE,MAAM,E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C,uBAAuB,CAAS;IACjD,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAS;IAE3C,WAAW,CAAC,EAAE,WAAW,CAAC;gBAGP,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,WAAW,EAAE,EACtC,OAAO,GAAE;QACP,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,uBAAuB,CAAC,EAAE,MAAM,CAAC;QACjC,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;KACvB;IA6CR,kBAAkB,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI;IAIhE,MAAM,IAAI,OAAO;IAIjB,WAAW,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,IAAI;IAI1C,aAAa,IAAI,SAAS,WAAW,EAAE;IAIjC,cAAc,CAClB,OAAO,EAAE,WAAW,EAAE,EACtB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,YAAY,CAAC,EAAE,eAAe,EAAE,GAC/B,OAAO,CAAC,MAAM,EAAE,CAAC;IASd,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA0DrF,mBAAmB,CAAC,eAAe,CAAC,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAIrF,OAAO,CAAC,UAAU;YAsBJ,QAAQ;IA2EtB,OAAO,CAAC,mBAAmB;CAO5B"}
|
|
@@ -107,7 +107,7 @@ export class OrchestratingDriver extends EventTarget {
|
|
|
107
107
|
detail: [...history, { role: 'user', content: input, attachments }],
|
|
108
108
|
}));
|
|
109
109
|
this.dispatchEvent(new CustomEvent('orchestrating-start'));
|
|
110
|
-
let currentAgent = yield this.classify(input, history);
|
|
110
|
+
let currentAgent = yield this.classify(input, history, this.activeAgent);
|
|
111
111
|
let isHandoff = false;
|
|
112
112
|
let handoffs = 0;
|
|
113
113
|
let handoffSummary = '';
|
|
@@ -167,7 +167,7 @@ export class OrchestratingDriver extends EventTarget {
|
|
|
167
167
|
this.dispatchEvent(new CustomEvent('orchestrating-stop'));
|
|
168
168
|
this.dispatchEvent(new CustomEvent('agent-changed', { detail: agent }));
|
|
169
169
|
}
|
|
170
|
-
classify(input, history) {
|
|
170
|
+
classify(input, history, contextAgent) {
|
|
171
171
|
return __awaiter(this, void 0, void 0, function* () {
|
|
172
172
|
var _a, _b;
|
|
173
173
|
if (this.specialists.length === 0) {
|
|
@@ -181,7 +181,10 @@ export class OrchestratingDriver extends EventTarget {
|
|
|
181
181
|
.slice(-this.classifierHistoryLength)
|
|
182
182
|
.map((m) => `${m.role === 'user' ? 'User' : 'Assistant'}: ${m.content}`)
|
|
183
183
|
.join('\n');
|
|
184
|
-
const
|
|
184
|
+
const continuationHint = contextAgent && isSpecialist(contextAgent)
|
|
185
|
+
? `\n\nThe previous turn was handled by "${contextAgent.name}". If the new message is a refinement, correction, or continuation of that work, prefer "${contextAgent.name}" — unless the topic has clearly shifted to another specialist's domain.`
|
|
186
|
+
: '';
|
|
187
|
+
const classifierPrompt = `You are a routing classifier. Call select_agent with the index of the best matching agent for the user message. Use -1 only if the request is entirely unrelated to every agent listed — prefer the closest match when in doubt. If the request spans multiple agents, pick the one that should act first; I will re-classify and route again once that agent is done.\n\nAgents:\n${agentList}${continuationHint}${recentMessages ? `\n\nRecent conversation:\n${recentMessages}` : ''}`;
|
|
185
188
|
const routingTool = {
|
|
186
189
|
name: 'select_agent',
|
|
187
190
|
description: 'Select the most appropriate agent for the user message.',
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/ai-assistant",
|
|
3
3
|
"description": "Genesis AI Assistant micro-frontend",
|
|
4
|
-
"version": "14.428.
|
|
4
|
+
"version": "14.428.1",
|
|
5
5
|
"license": "SEE LICENSE IN license.txt",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/ai-assistant.d.ts",
|
|
@@ -64,24 +64,24 @@
|
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
|
-
"@genesislcap/foundation-testing": "14.428.
|
|
68
|
-
"@genesislcap/genx": "14.428.
|
|
69
|
-
"@genesislcap/rollup-builder": "14.428.
|
|
70
|
-
"@genesislcap/ts-builder": "14.428.
|
|
71
|
-
"@genesislcap/uvu-playwright-builder": "14.428.
|
|
72
|
-
"@genesislcap/vite-builder": "14.428.
|
|
73
|
-
"@genesislcap/webpack-builder": "14.428.
|
|
67
|
+
"@genesislcap/foundation-testing": "14.428.1",
|
|
68
|
+
"@genesislcap/genx": "14.428.1",
|
|
69
|
+
"@genesislcap/rollup-builder": "14.428.1",
|
|
70
|
+
"@genesislcap/ts-builder": "14.428.1",
|
|
71
|
+
"@genesislcap/uvu-playwright-builder": "14.428.1",
|
|
72
|
+
"@genesislcap/vite-builder": "14.428.1",
|
|
73
|
+
"@genesislcap/webpack-builder": "14.428.1",
|
|
74
74
|
"@types/dompurify": "^3.0.5",
|
|
75
75
|
"@types/marked": "^5.0.2"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@genesislcap/foundation-ai": "14.428.
|
|
79
|
-
"@genesislcap/foundation-logger": "14.428.
|
|
80
|
-
"@genesislcap/foundation-redux": "14.428.
|
|
81
|
-
"@genesislcap/foundation-ui": "14.428.
|
|
82
|
-
"@genesislcap/foundation-utils": "14.428.
|
|
83
|
-
"@genesislcap/rapid-design-system": "14.428.
|
|
84
|
-
"@genesislcap/web-core": "14.428.
|
|
78
|
+
"@genesislcap/foundation-ai": "14.428.1",
|
|
79
|
+
"@genesislcap/foundation-logger": "14.428.1",
|
|
80
|
+
"@genesislcap/foundation-redux": "14.428.1",
|
|
81
|
+
"@genesislcap/foundation-ui": "14.428.1",
|
|
82
|
+
"@genesislcap/foundation-utils": "14.428.1",
|
|
83
|
+
"@genesislcap/rapid-design-system": "14.428.1",
|
|
84
|
+
"@genesislcap/web-core": "14.428.1",
|
|
85
85
|
"dompurify": "^3.3.1",
|
|
86
86
|
"marked": "^17.0.3"
|
|
87
87
|
},
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
"publishConfig": {
|
|
94
94
|
"access": "public"
|
|
95
95
|
},
|
|
96
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "d0e41cc5c5065743cafe34d97ccf4a83480436f1"
|
|
97
97
|
}
|
|
@@ -168,7 +168,7 @@ export class OrchestratingDriver extends EventTarget implements AiDriver {
|
|
|
168
168
|
);
|
|
169
169
|
|
|
170
170
|
this.dispatchEvent(new CustomEvent('orchestrating-start'));
|
|
171
|
-
let currentAgent = await this.classify(input, history);
|
|
171
|
+
let currentAgent = await this.classify(input, history, this.activeAgent);
|
|
172
172
|
let isHandoff = false;
|
|
173
173
|
let handoffs = 0;
|
|
174
174
|
let handoffSummary = '';
|
|
@@ -240,7 +240,11 @@ export class OrchestratingDriver extends EventTarget implements AiDriver {
|
|
|
240
240
|
this.dispatchEvent(new CustomEvent('agent-changed', { detail: agent }));
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
-
private async classify(
|
|
243
|
+
private async classify(
|
|
244
|
+
input: string,
|
|
245
|
+
history: ChatMessage[],
|
|
246
|
+
contextAgent?: AgentConfig,
|
|
247
|
+
): Promise<AgentConfig> {
|
|
244
248
|
if (this.specialists.length === 0) {
|
|
245
249
|
return this.fallback ?? { name: 'Assistant', fallback: true };
|
|
246
250
|
}
|
|
@@ -255,7 +259,12 @@ export class OrchestratingDriver extends EventTarget implements AiDriver {
|
|
|
255
259
|
.map((m) => `${m.role === 'user' ? 'User' : 'Assistant'}: ${m.content}`)
|
|
256
260
|
.join('\n');
|
|
257
261
|
|
|
258
|
-
const
|
|
262
|
+
const continuationHint =
|
|
263
|
+
contextAgent && isSpecialist(contextAgent)
|
|
264
|
+
? `\n\nThe previous turn was handled by "${contextAgent.name}". If the new message is a refinement, correction, or continuation of that work, prefer "${contextAgent.name}" — unless the topic has clearly shifted to another specialist's domain.`
|
|
265
|
+
: '';
|
|
266
|
+
|
|
267
|
+
const classifierPrompt = `You are a routing classifier. Call select_agent with the index of the best matching agent for the user message. Use -1 only if the request is entirely unrelated to every agent listed — prefer the closest match when in doubt. If the request spans multiple agents, pick the one that should act first; I will re-classify and route again once that agent is done.\n\nAgents:\n${agentList}${continuationHint}${recentMessages ? `\n\nRecent conversation:\n${recentMessages}` : ''}`;
|
|
259
268
|
|
|
260
269
|
const routingTool = {
|
|
261
270
|
name: 'select_agent',
|