@genesislcap/ai-assistant 14.439.1 → 14.439.3
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/dist/ai-assistant.d.ts +7 -0
- package/dist/dts/main/main.d.ts +7 -0
- package/dist/dts/main/main.d.ts.map +1 -1
- package/dist/esm/main/main.js +28 -7
- package/package.json +16 -16
- package/src/main/main.ts +27 -7
package/dist/ai-assistant.d.ts
CHANGED
|
@@ -935,6 +935,13 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
935
935
|
set messages(value: ChatMessage[]);
|
|
936
936
|
get state(): AiAssistantState;
|
|
937
937
|
set state(value: AiAssistantState);
|
|
938
|
+
/**
|
|
939
|
+
* Re-runs `agentsChanged` if the live `agents` array no longer matches the
|
|
940
|
+
* fingerprint of the currently installed driver. Used to apply swaps that
|
|
941
|
+
* landed during a turn (and were skipped by the `isBusy()` guard) once the
|
|
942
|
+
* driver returns to idle.
|
|
943
|
+
*/
|
|
944
|
+
private applyDeferredAgentsSwap;
|
|
938
945
|
/**
|
|
939
946
|
* Focus the main chat input if the user is still engaged with the assistant.
|
|
940
947
|
* Deferred to the next frame so any conditional re-render (e.g. unhiding the
|
package/dist/dts/main/main.d.ts
CHANGED
|
@@ -49,6 +49,13 @@ export declare class FoundationAiAssistant extends GenesisElement {
|
|
|
49
49
|
set messages(value: ChatMessage[]);
|
|
50
50
|
get state(): AiAssistantState;
|
|
51
51
|
set state(value: AiAssistantState);
|
|
52
|
+
/**
|
|
53
|
+
* Re-runs `agentsChanged` if the live `agents` array no longer matches the
|
|
54
|
+
* fingerprint of the currently installed driver. Used to apply swaps that
|
|
55
|
+
* landed during a turn (and were skipped by the `isBusy()` guard) once the
|
|
56
|
+
* driver returns to idle.
|
|
57
|
+
*/
|
|
58
|
+
private applyDeferredAgentsSwap;
|
|
52
59
|
/**
|
|
53
60
|
* Focus the main chat input if the user is still engaged with the assistant.
|
|
54
61
|
* Deferred to the next frame so any conditional re-render (e.g. unhiding the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/main/main.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,KAAK,EACV,cAAc,EACd,UAAU,EACV,4BAA4B,EAC5B,WAAW,EACZ,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAGL,cAAc,EAIf,MAAM,uBAAuB,CAAC;AAW/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAgBpD,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAChB,UAAU,EACV,gBAAgB,EACjB,MAAM,cAAc,CAAC;AAgEtB;;;;;;;;;;;;;GAaG;AACH,qBAOa,qBAAsB,SAAQ,cAAc;IAC3C,UAAU,EAAG,UAAU,CAAC;IAExB,kBAAkB,EAAE,MAAM,CAAW;IACZ,WAAW,EAAE,MAAM,CAAuB;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC5C,WAAW,EAAE,MAAM,CAA0B;IACrD;;;;;OAKG;IACiC,UAAU,CAAC,EAAE,UAAU,CAAC;IAC5D;;;OAGG;IACS,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;IACvB,UAAU,EAAE,UAAU,CAAM;IAExC;;;OAGG;IACH,IAAI,WAAW,IAAI,eAAe,CAEjC;IACW,iBAAiB,CAAC,EAAE,MAAM,OAAO,CAAC;IAC9C,0EAA0E;IACrB,UAAU,UAAS;IAIxE,OAAO,CAAC,WAAW,CAAC,CAAqB;IAEzC,IAAI,QAAQ,IAAI,WAAW,EAAE,CAE5B;IACD,IAAI,QAAQ,CAAC,KAAK,EAAE,WAAW,EAAE,EAGhC;IAED,IAAI,KAAK,IAAI,gBAAgB,CAE5B;IACD,IAAI,KAAK,CAAC,KAAK,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"main.d.ts","sour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CAQjC;IAEF,iBAAiB;IAIjB;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO;IAWnE,gGAAgG;IAChG,IACI,kBAAkB,IAAI,OAAO,CAIhC;IAED,2FAA2F;IAC3F,IACI,eAAe,IAAI,MAAM,GAAG,SAAS,CAGxC;IAED;;;;;;;;;;;OAWG;IACH,IACI,SAAS,IAAI,OAAO,CAKvB;IAED,iDAAiD;IACjD,IACI,gBAAgB,IAAI,MAAM,CAc7B;IAED;;;;;;OAMG;IACH,IACI,iBAAiB,IAAI,MAAM,GAAG,SAAS,CAM1C;IAED;;;;OAIG;IACH,IACI,oBAAoB,IAAI,MAAM,CAGjC;IAED,mBAAmB;IAInB,uBAAuB;IAIvB,8BAA8B;IAI9B,oBAAoB,CAAC,UAAU,EAAE,oBAAoB,EAAE;IAIvD,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAqEX,gBAAgB;IAehB,gBAAgB,IAAI,IAAI;IAIxB,gBAAgB,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI;IAIhC,gBAAgB,CAAC,UAAU,EAAE,cAAc,GAAG,IAAI;IAIlD,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAU5C,OAAO,CAAC,cAAc;IAetB,OAAO,CAAC,cAAc;YASR,iBAAiB;IAmC/B,eAAe;IAIf,qBAAqB,CAAC,UAAU,EAAE,MAAM;YAK1B,gBAAgB;YA4DhB,IAAI;IAyClB,qBAAqB,CAAC,CAAC,EAAE,UAAU;IAYnC,0BAA0B,CAAC,CAAC,EAAE,KAAK;CAQpC"}
|
package/dist/esm/main/main.js
CHANGED
|
@@ -176,8 +176,26 @@ let FoundationAiAssistant = FoundationAiAssistant_1 = class FoundationAiAssistan
|
|
|
176
176
|
// if they haven't moved on to something else on the page.
|
|
177
177
|
if (prev === 'loading' && value !== 'loading') {
|
|
178
178
|
this.maybeAutoFocusChatInput();
|
|
179
|
+
// Apply any agents swap deferred by the busy guard in `agentsChanged`.
|
|
180
|
+
// Host-side `agents` getters typically cache a stable reference between
|
|
181
|
+
// predicate changes, so FAST's property binding will not re-fire the
|
|
182
|
+
// setter on its own once the turn finishes — re-enter manually.
|
|
183
|
+
this.applyDeferredAgentsSwap();
|
|
179
184
|
}
|
|
180
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* Re-runs `agentsChanged` if the live `agents` array no longer matches the
|
|
188
|
+
* fingerprint of the currently installed driver. Used to apply swaps that
|
|
189
|
+
* landed during a turn (and were skipped by the `isBusy()` guard) once the
|
|
190
|
+
* driver returns to idle.
|
|
191
|
+
*/
|
|
192
|
+
applyDeferredAgentsSwap() {
|
|
193
|
+
if (!this.driver)
|
|
194
|
+
return;
|
|
195
|
+
if (this.getAgentsKey(this.agents) === this._driverAgentsKey)
|
|
196
|
+
return;
|
|
197
|
+
this.agentsChanged();
|
|
198
|
+
}
|
|
181
199
|
/**
|
|
182
200
|
* Focus the main chat input if the user is still engaged with the assistant.
|
|
183
201
|
* Deferred to the next frame so any conditional re-render (e.g. unhiding the
|
|
@@ -466,11 +484,11 @@ let FoundationAiAssistant = FoundationAiAssistant_1 = class FoundationAiAssistan
|
|
|
466
484
|
const newKey = this.getAgentsKey(this.agents);
|
|
467
485
|
if (newKey === this._driverAgentsKey)
|
|
468
486
|
return;
|
|
469
|
-
|
|
470
|
-
//
|
|
471
|
-
//
|
|
472
|
-
//
|
|
473
|
-
//
|
|
487
|
+
// Don't rebuild while the driver is busy — pending interactions and the
|
|
488
|
+
// in-flight tool loop reference the captured agents array. The swap is
|
|
489
|
+
// re-attempted from the `state` setter on the loading→idle transition.
|
|
490
|
+
// `_driverAgentsKey` is updated only after the rebuild actually installs
|
|
491
|
+
// the new agents, so the deferred re-attempt still sees the mismatch.
|
|
474
492
|
if (this.driver.isBusy())
|
|
475
493
|
return;
|
|
476
494
|
const history = (_c = (_b = (_a = this.driver).getRawHistory) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : [];
|
|
@@ -487,6 +505,7 @@ let FoundationAiAssistant = FoundationAiAssistant_1 = class FoundationAiAssistan
|
|
|
487
505
|
this.wireDriver();
|
|
488
506
|
if (history.length)
|
|
489
507
|
this.driver.loadHistory([...history]);
|
|
508
|
+
this._driverAgentsKey = newKey;
|
|
490
509
|
}
|
|
491
510
|
/** Returns a stable fingerprint for an agents array based on agent names and tool handler keys. */
|
|
492
511
|
getAgentsKey(agents) {
|
|
@@ -747,6 +766,7 @@ let FoundationAiAssistant = FoundationAiAssistant_1 = class FoundationAiAssistan
|
|
|
747
766
|
this.syncShowHalo();
|
|
748
767
|
this.fetchSuggestions();
|
|
749
768
|
this.maybeAutoFocusChatInput();
|
|
769
|
+
this.applyDeferredAgentsSwap();
|
|
750
770
|
(_b = this._executionCompletionUnsub) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
751
771
|
this._executionCompletionUnsub = undefined;
|
|
752
772
|
}
|
|
@@ -1317,9 +1337,10 @@ let FoundationAiAssistant = FoundationAiAssistant_1 = class FoundationAiAssistan
|
|
|
1317
1337
|
this.syncShowHalo();
|
|
1318
1338
|
this.fetchSuggestions();
|
|
1319
1339
|
// setState was dispatched directly via the captured ref (not via the
|
|
1320
|
-
// state setter) so the setter's
|
|
1321
|
-
//
|
|
1340
|
+
// state setter) so the setter's loading→idle cleanup path doesn't fire
|
|
1341
|
+
// here. Replicate the parts of it that matter for the post-turn settle.
|
|
1322
1342
|
this.maybeAutoFocusChatInput();
|
|
1343
|
+
this.applyDeferredAgentsSwap();
|
|
1323
1344
|
}
|
|
1324
1345
|
});
|
|
1325
1346
|
}
|
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.439.
|
|
4
|
+
"version": "14.439.3",
|
|
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.439.
|
|
68
|
-
"@genesislcap/genx": "14.439.
|
|
69
|
-
"@genesislcap/rollup-builder": "14.439.
|
|
70
|
-
"@genesislcap/ts-builder": "14.439.
|
|
71
|
-
"@genesislcap/uvu-playwright-builder": "14.439.
|
|
72
|
-
"@genesislcap/vite-builder": "14.439.
|
|
73
|
-
"@genesislcap/webpack-builder": "14.439.
|
|
67
|
+
"@genesislcap/foundation-testing": "14.439.3",
|
|
68
|
+
"@genesislcap/genx": "14.439.3",
|
|
69
|
+
"@genesislcap/rollup-builder": "14.439.3",
|
|
70
|
+
"@genesislcap/ts-builder": "14.439.3",
|
|
71
|
+
"@genesislcap/uvu-playwright-builder": "14.439.3",
|
|
72
|
+
"@genesislcap/vite-builder": "14.439.3",
|
|
73
|
+
"@genesislcap/webpack-builder": "14.439.3",
|
|
74
74
|
"@types/dompurify": "^3.0.5",
|
|
75
75
|
"@types/marked": "^5.0.2"
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@genesislcap/foundation-ai": "14.439.
|
|
79
|
-
"@genesislcap/foundation-logger": "14.439.
|
|
80
|
-
"@genesislcap/foundation-redux": "14.439.
|
|
81
|
-
"@genesislcap/foundation-ui": "14.439.
|
|
82
|
-
"@genesislcap/foundation-utils": "14.439.
|
|
83
|
-
"@genesislcap/rapid-design-system": "14.439.
|
|
84
|
-
"@genesislcap/web-core": "14.439.
|
|
78
|
+
"@genesislcap/foundation-ai": "14.439.3",
|
|
79
|
+
"@genesislcap/foundation-logger": "14.439.3",
|
|
80
|
+
"@genesislcap/foundation-redux": "14.439.3",
|
|
81
|
+
"@genesislcap/foundation-ui": "14.439.3",
|
|
82
|
+
"@genesislcap/foundation-utils": "14.439.3",
|
|
83
|
+
"@genesislcap/rapid-design-system": "14.439.3",
|
|
84
|
+
"@genesislcap/web-core": "14.439.3",
|
|
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": "75d483c70f8d48c49eca72c6da18cb42e1076dd2"
|
|
97
97
|
}
|
package/src/main/main.ts
CHANGED
|
@@ -210,9 +210,26 @@ export class FoundationAiAssistant extends GenesisElement {
|
|
|
210
210
|
// if they haven't moved on to something else on the page.
|
|
211
211
|
if (prev === 'loading' && value !== 'loading') {
|
|
212
212
|
this.maybeAutoFocusChatInput();
|
|
213
|
+
// Apply any agents swap deferred by the busy guard in `agentsChanged`.
|
|
214
|
+
// Host-side `agents` getters typically cache a stable reference between
|
|
215
|
+
// predicate changes, so FAST's property binding will not re-fire the
|
|
216
|
+
// setter on its own once the turn finishes — re-enter manually.
|
|
217
|
+
this.applyDeferredAgentsSwap();
|
|
213
218
|
}
|
|
214
219
|
}
|
|
215
220
|
|
|
221
|
+
/**
|
|
222
|
+
* Re-runs `agentsChanged` if the live `agents` array no longer matches the
|
|
223
|
+
* fingerprint of the currently installed driver. Used to apply swaps that
|
|
224
|
+
* landed during a turn (and were skipped by the `isBusy()` guard) once the
|
|
225
|
+
* driver returns to idle.
|
|
226
|
+
*/
|
|
227
|
+
private applyDeferredAgentsSwap(): void {
|
|
228
|
+
if (!this.driver) return;
|
|
229
|
+
if (this.getAgentsKey(this.agents) === this._driverAgentsKey) return;
|
|
230
|
+
this.agentsChanged();
|
|
231
|
+
}
|
|
232
|
+
|
|
216
233
|
/**
|
|
217
234
|
* Focus the main chat input if the user is still engaged with the assistant.
|
|
218
235
|
* Deferred to the next frame so any conditional re-render (e.g. unhiding the
|
|
@@ -540,11 +557,11 @@ export class FoundationAiAssistant extends GenesisElement {
|
|
|
540
557
|
// destroy pending interactions in the existing driver.
|
|
541
558
|
const newKey = this.getAgentsKey(this.agents);
|
|
542
559
|
if (newKey === this._driverAgentsKey) return;
|
|
543
|
-
|
|
544
|
-
//
|
|
545
|
-
//
|
|
546
|
-
//
|
|
547
|
-
//
|
|
560
|
+
// Don't rebuild while the driver is busy — pending interactions and the
|
|
561
|
+
// in-flight tool loop reference the captured agents array. The swap is
|
|
562
|
+
// re-attempted from the `state` setter on the loading→idle transition.
|
|
563
|
+
// `_driverAgentsKey` is updated only after the rebuild actually installs
|
|
564
|
+
// the new agents, so the deferred re-attempt still sees the mismatch.
|
|
548
565
|
if (this.driver.isBusy()) return;
|
|
549
566
|
const history = this.driver.getRawHistory?.() ?? [];
|
|
550
567
|
const oldDriver = this.driver;
|
|
@@ -559,6 +576,7 @@ export class FoundationAiAssistant extends GenesisElement {
|
|
|
559
576
|
this.driver = getOrCreateDriver(key, () => this.createDriver());
|
|
560
577
|
this.wireDriver();
|
|
561
578
|
if (history.length) this.driver.loadHistory([...history]);
|
|
579
|
+
this._driverAgentsKey = newKey;
|
|
562
580
|
}
|
|
563
581
|
|
|
564
582
|
/** Returns a stable fingerprint for an agents array based on agent names and tool handler keys. */
|
|
@@ -845,6 +863,7 @@ export class FoundationAiAssistant extends GenesisElement {
|
|
|
845
863
|
this.syncShowHalo();
|
|
846
864
|
this.fetchSuggestions();
|
|
847
865
|
this.maybeAutoFocusChatInput();
|
|
866
|
+
this.applyDeferredAgentsSwap();
|
|
848
867
|
this._executionCompletionUnsub?.();
|
|
849
868
|
this._executionCompletionUnsub = undefined;
|
|
850
869
|
}
|
|
@@ -1456,9 +1475,10 @@ export class FoundationAiAssistant extends GenesisElement {
|
|
|
1456
1475
|
this.syncShowHalo();
|
|
1457
1476
|
this.fetchSuggestions();
|
|
1458
1477
|
// setState was dispatched directly via the captured ref (not via the
|
|
1459
|
-
// state setter) so the setter's
|
|
1460
|
-
//
|
|
1478
|
+
// state setter) so the setter's loading→idle cleanup path doesn't fire
|
|
1479
|
+
// here. Replicate the parts of it that matter for the post-turn settle.
|
|
1461
1480
|
this.maybeAutoFocusChatInput();
|
|
1481
|
+
this.applyDeferredAgentsSwap();
|
|
1462
1482
|
}
|
|
1463
1483
|
}
|
|
1464
1484
|
|