@genesislcap/ai-assistant 14.439.1-GENC-1250.1 → 14.439.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.
- package/dist/ai-assistant.d.ts +0 -7
- package/dist/dts/main/main.d.ts +0 -7
- package/dist/dts/main/main.d.ts.map +1 -1
- package/dist/esm/main/main.js +5 -24
- package/package.json +16 -16
- package/src/main/main.ts +5 -23
package/dist/ai-assistant.d.ts
CHANGED
|
@@ -935,13 +935,6 @@ 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;
|
|
945
938
|
/**
|
|
946
939
|
* Focus the main chat input if the user is still engaged with the assistant.
|
|
947
940
|
* Deferred to the next frame so any conditional re-render (e.g. unhiding the
|
package/dist/dts/main/main.d.ts
CHANGED
|
@@ -49,13 +49,6 @@ 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;
|
|
59
52
|
/**
|
|
60
53
|
* Focus the main chat input if the user is still engaged with the assistant.
|
|
61
54
|
* 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":"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;;;;;;;;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;IAwClB,qBAAqB,CAAC,CAAC,EAAE,UAAU;IAYnC,0BAA0B,CAAC,CAAC,EAAE,KAAK;CAQpC"}
|
package/dist/esm/main/main.js
CHANGED
|
@@ -176,26 +176,8 @@ 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();
|
|
184
179
|
}
|
|
185
180
|
}
|
|
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
|
-
}
|
|
199
181
|
/**
|
|
200
182
|
* Focus the main chat input if the user is still engaged with the assistant.
|
|
201
183
|
* Deferred to the next frame so any conditional re-render (e.g. unhiding the
|
|
@@ -484,11 +466,11 @@ let FoundationAiAssistant = FoundationAiAssistant_1 = class FoundationAiAssistan
|
|
|
484
466
|
const newKey = this.getAgentsKey(this.agents);
|
|
485
467
|
if (newKey === this._driverAgentsKey)
|
|
486
468
|
return;
|
|
487
|
-
|
|
488
|
-
//
|
|
489
|
-
//
|
|
490
|
-
//
|
|
491
|
-
//
|
|
469
|
+
this._driverAgentsKey = newKey;
|
|
470
|
+
// Don't rebuild while the driver is busy — it was created with the correct agents
|
|
471
|
+
// and has live pending interactions. This prevents the collapse element (which
|
|
472
|
+
// initially has no agents, then gets them assigned by its wrapper) from tearing
|
|
473
|
+
// down a mid-flight driver and creating a fresh idle one.
|
|
492
474
|
if (this.driver.isBusy())
|
|
493
475
|
return;
|
|
494
476
|
const history = (_c = (_b = (_a = this.driver).getRawHistory) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : [];
|
|
@@ -505,7 +487,6 @@ let FoundationAiAssistant = FoundationAiAssistant_1 = class FoundationAiAssistan
|
|
|
505
487
|
this.wireDriver();
|
|
506
488
|
if (history.length)
|
|
507
489
|
this.driver.loadHistory([...history]);
|
|
508
|
-
this._driverAgentsKey = newKey;
|
|
509
490
|
}
|
|
510
491
|
/** Returns a stable fingerprint for an agents array based on agent names and tool handler keys. */
|
|
511
492
|
getAgentsKey(agents) {
|
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.1
|
|
4
|
+
"version": "14.439.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.439.1
|
|
68
|
-
"@genesislcap/genx": "14.439.1
|
|
69
|
-
"@genesislcap/rollup-builder": "14.439.1
|
|
70
|
-
"@genesislcap/ts-builder": "14.439.1
|
|
71
|
-
"@genesislcap/uvu-playwright-builder": "14.439.1
|
|
72
|
-
"@genesislcap/vite-builder": "14.439.1
|
|
73
|
-
"@genesislcap/webpack-builder": "14.439.1
|
|
67
|
+
"@genesislcap/foundation-testing": "14.439.1",
|
|
68
|
+
"@genesislcap/genx": "14.439.1",
|
|
69
|
+
"@genesislcap/rollup-builder": "14.439.1",
|
|
70
|
+
"@genesislcap/ts-builder": "14.439.1",
|
|
71
|
+
"@genesislcap/uvu-playwright-builder": "14.439.1",
|
|
72
|
+
"@genesislcap/vite-builder": "14.439.1",
|
|
73
|
+
"@genesislcap/webpack-builder": "14.439.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.439.1
|
|
79
|
-
"@genesislcap/foundation-logger": "14.439.1
|
|
80
|
-
"@genesislcap/foundation-redux": "14.439.1
|
|
81
|
-
"@genesislcap/foundation-ui": "14.439.1
|
|
82
|
-
"@genesislcap/foundation-utils": "14.439.1
|
|
83
|
-
"@genesislcap/rapid-design-system": "14.439.1
|
|
84
|
-
"@genesislcap/web-core": "14.439.1
|
|
78
|
+
"@genesislcap/foundation-ai": "14.439.1",
|
|
79
|
+
"@genesislcap/foundation-logger": "14.439.1",
|
|
80
|
+
"@genesislcap/foundation-redux": "14.439.1",
|
|
81
|
+
"@genesislcap/foundation-ui": "14.439.1",
|
|
82
|
+
"@genesislcap/foundation-utils": "14.439.1",
|
|
83
|
+
"@genesislcap/rapid-design-system": "14.439.1",
|
|
84
|
+
"@genesislcap/web-core": "14.439.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": "6fe08a1373139e13089e2b5c8f875c81fe59a0df"
|
|
97
97
|
}
|
package/src/main/main.ts
CHANGED
|
@@ -210,26 +210,9 @@ 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();
|
|
218
213
|
}
|
|
219
214
|
}
|
|
220
215
|
|
|
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
|
-
|
|
233
216
|
/**
|
|
234
217
|
* Focus the main chat input if the user is still engaged with the assistant.
|
|
235
218
|
* Deferred to the next frame so any conditional re-render (e.g. unhiding the
|
|
@@ -557,11 +540,11 @@ export class FoundationAiAssistant extends GenesisElement {
|
|
|
557
540
|
// destroy pending interactions in the existing driver.
|
|
558
541
|
const newKey = this.getAgentsKey(this.agents);
|
|
559
542
|
if (newKey === this._driverAgentsKey) return;
|
|
560
|
-
|
|
561
|
-
//
|
|
562
|
-
//
|
|
563
|
-
//
|
|
564
|
-
//
|
|
543
|
+
this._driverAgentsKey = newKey;
|
|
544
|
+
// Don't rebuild while the driver is busy — it was created with the correct agents
|
|
545
|
+
// and has live pending interactions. This prevents the collapse element (which
|
|
546
|
+
// initially has no agents, then gets them assigned by its wrapper) from tearing
|
|
547
|
+
// down a mid-flight driver and creating a fresh idle one.
|
|
565
548
|
if (this.driver.isBusy()) return;
|
|
566
549
|
const history = this.driver.getRawHistory?.() ?? [];
|
|
567
550
|
const oldDriver = this.driver;
|
|
@@ -576,7 +559,6 @@ export class FoundationAiAssistant extends GenesisElement {
|
|
|
576
559
|
this.driver = getOrCreateDriver(key, () => this.createDriver());
|
|
577
560
|
this.wireDriver();
|
|
578
561
|
if (history.length) this.driver.loadHistory([...history]);
|
|
579
|
-
this._driverAgentsKey = newKey;
|
|
580
562
|
}
|
|
581
563
|
|
|
582
564
|
/** Returns a stable fingerprint for an agents array based on agent names and tool handler keys. */
|