@memberjunction/realtime-widget 6.3.0-edge.0 → 6.3.0-edge.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/embed/chunks/UserViewEngine-EEVXGC4A.js +7 -0
- package/dist/embed/chunks/{chunk-PYHZMJHO.js → chunk-6RWWXOZB.js} +2102 -675
- package/dist/embed/chunks/{chunk-P7OZVUW4.js → chunk-AJBMDBQR.js} +101 -25
- package/dist/embed/chunks/{chunk-MIJGWKAT.js → chunk-CIZSPKQR.js} +10 -1
- package/dist/embed/chunks/{chunk-3SGPPDAR.js → chunk-KHEWGJIZ.js} +3131 -3027
- package/dist/embed/chunks/{chunk-CFNJUN5T.js → chunk-SXFIY47F.js} +25570 -2591
- package/dist/embed/chunks/{dist-PBT4EYQL.js → dist-L2XMFU32.js} +5 -5
- package/dist/embed/chunks/{guest-tool-relay-US5DJL75.js → guest-tool-relay-JGHE3J5R.js} +6 -6
- package/dist/embed/chunks/{guest-voice-mint-VBOHRPWJ.js → guest-voice-mint-I6KQRNKA.js} +6 -6
- package/dist/embed/chunks/{realtime-voice-controller-4ZREZIRH.js → realtime-voice-controller-Z75RH5BM.js} +34 -6
- package/dist/embed/chunks/{runtime-widget-transport-JX4WL4BP.js → runtime-widget-transport-UXJAHD5F.js} +13 -11
- package/dist/embed/mj-widget.js +9 -8
- package/dist/session/widget-session-client.js +2 -2
- package/dist/session/widget-session-client.js.map +1 -1
- package/dist/transport/runtime-widget-transport.d.ts.map +1 -1
- package/dist/transport/runtime-widget-transport.js +2 -1
- package/dist/transport/runtime-widget-transport.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +9 -9
- package/dist/embed/chunks/UserViewEngine-SLKE6LBB.js +0 -7
|
@@ -3,15 +3,18 @@ import {
|
|
|
3
3
|
ArtifactMetadataEngine,
|
|
4
4
|
ConversationEngine,
|
|
5
5
|
ConversationUtility,
|
|
6
|
-
|
|
6
|
+
EDGE_PRE_DISCOVERY_DATA_KEY,
|
|
7
7
|
FileStorageEngineBase,
|
|
8
8
|
MJAICredentialBindingEntity,
|
|
9
9
|
MJAIModelPriceUnitTypeEntity,
|
|
10
|
+
QueryEngine,
|
|
11
|
+
SanitizeEdgePreDiscoveryHint,
|
|
10
12
|
TemplateEngineBase,
|
|
11
13
|
coerceFailedExecuteAgentResult,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
g,
|
|
15
|
+
ns,
|
|
16
|
+
tt
|
|
17
|
+
} from "./chunk-SXFIY47F.js";
|
|
15
18
|
import {
|
|
16
19
|
BaseEngine,
|
|
17
20
|
BaseEntity,
|
|
@@ -22,17 +25,19 @@ import {
|
|
|
22
25
|
PermissionConstrainedError,
|
|
23
26
|
RegisterForStartup,
|
|
24
27
|
RunView
|
|
25
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-6RWWXOZB.js";
|
|
26
29
|
import {
|
|
30
|
+
ApplyPlattCalibration,
|
|
27
31
|
ParseModelConfiguration,
|
|
28
32
|
ParseVendorConfiguration,
|
|
29
33
|
ResolveEffectiveModelConfiguration
|
|
30
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-CIZSPKQR.js";
|
|
31
35
|
import {
|
|
32
36
|
BaseSingleton,
|
|
33
37
|
BehaviorSubject,
|
|
34
38
|
EMPTY,
|
|
35
39
|
IndexByUUID,
|
|
40
|
+
IsBrowser,
|
|
36
41
|
MJGlobal,
|
|
37
42
|
NormalizeUUID,
|
|
38
43
|
RegisterClass,
|
|
@@ -44,7 +49,7 @@ import {
|
|
|
44
49
|
ValidationErrorInfo,
|
|
45
50
|
ValidationErrorType,
|
|
46
51
|
throttleTime
|
|
47
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-KHEWGJIZ.js";
|
|
48
53
|
|
|
49
54
|
// ../../AI/BaseAIEngine/dist/PriceUnitTypes.js
|
|
50
55
|
var __decorate = function(decorators, target, key, desc) {
|
|
@@ -2134,6 +2139,66 @@ var AIEngineBase = class AIEngineBase2 extends BaseEngine {
|
|
|
2134
2139
|
const vendor = modelVendor?.VendorID ? this.VendorsByID.get(NormalizeUUID(modelVendor.VendorID)) : void 0;
|
|
2135
2140
|
return ResolveEffectiveModelConfiguration(ParseModelConfiguration(modelType?.ModelConfiguration), ParseModelConfiguration(model.ModelConfiguration), ParseVendorConfiguration(vendor?.Configuration)?.ModelDefaults, ParseModelConfiguration(modelVendor?.ModelConfiguration));
|
|
2136
2141
|
}
|
|
2142
|
+
/**
|
|
2143
|
+
* Every Platt calibration declared for a decision model: its effective
|
|
2144
|
+
* `ModelConfiguration.Decision.Calibrations` at the model layer (the model type's bag, then the
|
|
2145
|
+
* model's own), or an empty list when the model is unknown or declares none (before the engine
|
|
2146
|
+
* loads, every model is unknown).
|
|
2147
|
+
* Consumers look a fit up with {@link FindDecisionCalibration}, which matches the use, the
|
|
2148
|
+
* question and the exact resolved model.
|
|
2149
|
+
*
|
|
2150
|
+
* @param modelName The MJ decision model's name (`Jev`, `LLM Decision`), as the decision run
|
|
2151
|
+
* reports it. Matched case-insensitively, ignoring surrounding spaces.
|
|
2152
|
+
*/
|
|
2153
|
+
GetDecisionCalibrations(modelName) {
|
|
2154
|
+
const target = modelName?.trim().toLowerCase();
|
|
2155
|
+
if (!target) {
|
|
2156
|
+
return [];
|
|
2157
|
+
}
|
|
2158
|
+
let models;
|
|
2159
|
+
try {
|
|
2160
|
+
models = this.Models;
|
|
2161
|
+
} catch (err) {
|
|
2162
|
+
if (err instanceof PermissionConstrainedError) {
|
|
2163
|
+
return [];
|
|
2164
|
+
}
|
|
2165
|
+
throw err;
|
|
2166
|
+
}
|
|
2167
|
+
const model = models.find((m) => m.Name?.trim().toLowerCase() === target);
|
|
2168
|
+
const calibrations = model ? this.GetEffectiveModelConfiguration(model.ID)?.Decision?.Calibrations : void 0;
|
|
2169
|
+
return Array.isArray(calibrations) ? calibrations : [];
|
|
2170
|
+
}
|
|
2171
|
+
/**
|
|
2172
|
+
* The calibration fitted for this use and question on the exact model that answered, or null when
|
|
2173
|
+
* there is none, so the consumer treats the answer as unsure. The model's name selects its declared
|
|
2174
|
+
* calibrations ({@link GetDecisionCalibrations}); the use, the question and the resolved model must
|
|
2175
|
+
* then match one entry exactly, after trimming. A missing name or resolved model, or an entry whose
|
|
2176
|
+
* `A` or `B` is not a finite number, matches nothing.
|
|
2177
|
+
*
|
|
2178
|
+
* @param key The decision use and the question within it.
|
|
2179
|
+
* @param answeredBy The MJ decision model that answered and the exact model behind it.
|
|
2180
|
+
*/
|
|
2181
|
+
FindDecisionCalibration(key, answeredBy) {
|
|
2182
|
+
const modelName = answeredBy.ModelName?.trim();
|
|
2183
|
+
const resolvedModel = answeredBy.ResolvedModel?.trim();
|
|
2184
|
+
if (!modelName || !resolvedModel) {
|
|
2185
|
+
return null;
|
|
2186
|
+
}
|
|
2187
|
+
const entry = this.GetDecisionCalibrations(modelName).find((c) => c.Use?.trim() === key.Use && c.Question?.trim() === key.Question && c.ResolvedModel?.trim() === resolvedModel && Number.isFinite(c.A) && Number.isFinite(c.B));
|
|
2188
|
+
return entry ? { A: entry.A, B: entry.B } : null;
|
|
2189
|
+
}
|
|
2190
|
+
/**
|
|
2191
|
+
* A raw probability (a Likelihood, or a Choice's confidence) calibrated for the model that
|
|
2192
|
+
* answered, or null when it has no calibration for this use and question.
|
|
2193
|
+
*
|
|
2194
|
+
* @param key The decision use and the question within it.
|
|
2195
|
+
* @param probability The raw probability.
|
|
2196
|
+
* @param answeredBy The MJ decision model that answered and the exact model behind it.
|
|
2197
|
+
*/
|
|
2198
|
+
CalibrateDecisionProbability(key, probability, answeredBy) {
|
|
2199
|
+
const calibration = this.FindDecisionCalibration(key, answeredBy);
|
|
2200
|
+
return calibration ? ApplyPlattCalibration(probability, calibration) : null;
|
|
2201
|
+
}
|
|
2137
2202
|
get Prompts() {
|
|
2138
2203
|
return this.GetConfigData("_prompts");
|
|
2139
2204
|
}
|
|
@@ -3195,7 +3260,7 @@ var AIEngineBase = class AIEngineBase2 extends BaseEngine {
|
|
|
3195
3260
|
}
|
|
3196
3261
|
};
|
|
3197
3262
|
AIEngineBase = AIEngineBase_1 = __decorate2([
|
|
3198
|
-
RegisterForStartup()
|
|
3263
|
+
RegisterForStartup({ deferred: IsBrowser() })
|
|
3199
3264
|
], AIEngineBase);
|
|
3200
3265
|
|
|
3201
3266
|
// ../../AI/BaseAIEngine/dist/RealtimeCostLines.js
|
|
@@ -3650,7 +3715,7 @@ var AgentClientSession = class {
|
|
|
3650
3715
|
if (!provider) {
|
|
3651
3716
|
return { Success: false, ErrorMessage: "GraphQL provider not available" };
|
|
3652
3717
|
}
|
|
3653
|
-
const aiClient = new
|
|
3718
|
+
const aiClient = new tt(provider);
|
|
3654
3719
|
try {
|
|
3655
3720
|
const agentShim = { ID: params.AgentId };
|
|
3656
3721
|
const messages = params.Messages.map((m) => ({
|
|
@@ -3708,7 +3773,7 @@ var AgentClientSession = class {
|
|
|
3708
3773
|
if (!provider) {
|
|
3709
3774
|
return { Success: false, ErrorMessage: "GraphQL provider not available" };
|
|
3710
3775
|
}
|
|
3711
|
-
const aiClient = new
|
|
3776
|
+
const aiClient = new tt(provider);
|
|
3712
3777
|
try {
|
|
3713
3778
|
const gqlParams = {
|
|
3714
3779
|
userMessageId: params.UserMessageId,
|
|
@@ -4199,7 +4264,7 @@ var MentionAutocomplete = class extends BaseSingleton {
|
|
|
4199
4264
|
this.agentsCache = await this.filterAgentsByRunPermission(candidateAgents, currentUser);
|
|
4200
4265
|
this.usersCache = [currentUser];
|
|
4201
4266
|
this.entitiesCache = this.loadReadableEntities(currentUser, provider);
|
|
4202
|
-
this.queriesCache = this.loadRunnableQueries(currentUser, provider);
|
|
4267
|
+
this.queriesCache = await this.loadRunnableQueries(currentUser, provider);
|
|
4203
4268
|
this.queriesEntityIcon = this.resolveQueriesEntityIcon(provider);
|
|
4204
4269
|
this.skillsCache = await this.filterSkillsByRunPermission(currentUser);
|
|
4205
4270
|
this.provider = provider;
|
|
@@ -4260,24 +4325,33 @@ var MentionAutocomplete = class extends BaseSingleton {
|
|
|
4260
4325
|
}
|
|
4261
4326
|
}
|
|
4262
4327
|
/**
|
|
4263
|
-
* Load queries the current user
|
|
4328
|
+
* Load queries the current user can run, from the provider's QueryEngine (loaded here if it
|
|
4329
|
+
* has not loaded yet). A query is runnable when the user holds its run permission and, for a
|
|
4330
|
+
* query without explicit permission rows, can read every entity it references.
|
|
4264
4331
|
* These are the candidates surfaced for #query mentions.
|
|
4265
4332
|
*/
|
|
4266
|
-
loadRunnableQueries(user, provider) {
|
|
4333
|
+
async loadRunnableQueries(user, provider) {
|
|
4267
4334
|
try {
|
|
4268
|
-
const
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
return query.UserCanRun(user);
|
|
4272
|
-
} catch {
|
|
4273
|
-
return false;
|
|
4274
|
-
}
|
|
4275
|
-
});
|
|
4335
|
+
const engine = this.queryEngineFor(provider);
|
|
4336
|
+
await engine.Config(false, user, provider);
|
|
4337
|
+
return engine.Queries.filter((query) => this.userCanRunQuery(query, user));
|
|
4276
4338
|
} catch (error) {
|
|
4277
4339
|
console.error("Failed to load queries for mention autocomplete:", error);
|
|
4278
4340
|
return [];
|
|
4279
4341
|
}
|
|
4280
4342
|
}
|
|
4343
|
+
/** The QueryEngine for the given provider, or the global one when no provider is given. */
|
|
4344
|
+
queryEngineFor(provider) {
|
|
4345
|
+
return provider ? QueryEngine.GetProviderInstance(provider, QueryEngine) : QueryEngine.Instance;
|
|
4346
|
+
}
|
|
4347
|
+
/** Whether the user can run the query; a permission-check error excludes it (fail closed). */
|
|
4348
|
+
userCanRunQuery(query, user) {
|
|
4349
|
+
try {
|
|
4350
|
+
return query.UserCanRun(user).canRun;
|
|
4351
|
+
} catch {
|
|
4352
|
+
return false;
|
|
4353
|
+
}
|
|
4354
|
+
}
|
|
4281
4355
|
/**
|
|
4282
4356
|
* Resolve the generic icon used for all query mentions from the 'MJ: Queries' entity.
|
|
4283
4357
|
*/
|
|
@@ -4861,7 +4935,7 @@ var ConversationStreaming = class {
|
|
|
4861
4935
|
return;
|
|
4862
4936
|
}
|
|
4863
4937
|
try {
|
|
4864
|
-
const dataProvider =
|
|
4938
|
+
const dataProvider = g.Instance;
|
|
4865
4939
|
this.watchSocketAcknowledgement(dataProvider);
|
|
4866
4940
|
this.pushStatusSubscription = dataProvider.PushStatusUpdates().subscribe({
|
|
4867
4941
|
next: (status) => {
|
|
@@ -5395,7 +5469,7 @@ var ConversationLiveness = class {
|
|
|
5395
5469
|
}
|
|
5396
5470
|
let socketWired = false;
|
|
5397
5471
|
try {
|
|
5398
|
-
const provider =
|
|
5472
|
+
const provider = g.Instance;
|
|
5399
5473
|
if (provider) {
|
|
5400
5474
|
this.subscriptions.add(provider.SocketReconnected$.subscribe(() => this.Trigger("socket-reconnected")));
|
|
5401
5475
|
socketWired = true;
|
|
@@ -5493,11 +5567,11 @@ var ConversationTail = class {
|
|
|
5493
5567
|
return this.client;
|
|
5494
5568
|
}
|
|
5495
5569
|
try {
|
|
5496
|
-
const provider =
|
|
5570
|
+
const provider = g.Instance;
|
|
5497
5571
|
if (!provider) {
|
|
5498
5572
|
return void 0;
|
|
5499
5573
|
}
|
|
5500
|
-
this.client = new
|
|
5574
|
+
this.client = new ns(provider);
|
|
5501
5575
|
return this.client;
|
|
5502
5576
|
} catch {
|
|
5503
5577
|
return void 0;
|
|
@@ -5570,6 +5644,7 @@ var ConversationAgentRunner = class {
|
|
|
5570
5644
|
const candidateAgents = AIEngineBase.Instance.Agents.filter((a) => !UUIDsEqual(a.ID, agent.ID) && !a.ParentID && a.Status === "Active" && a.InvocationMode !== "Sub-Agent");
|
|
5571
5645
|
const permittedAgents = currentUser ? await this.filterAgentsByPermissions(candidateAgents, currentUser) : candidateAgents;
|
|
5572
5646
|
const availableAgents = NarrowToAllowedAgents(permittedAgents, input.AllowedAgentIDs);
|
|
5647
|
+
const sanitizedEdgeHint = input.EdgePreDiscoveryHint ? SanitizeEdgePreDiscoveryHint(input.EdgePreDiscoveryHint, availableAgents) : null;
|
|
5573
5648
|
LogStatusEx({
|
|
5574
5649
|
message: `[ConversationAgentRunner] Available agents for routing: ${availableAgents.length} (filtered from ${candidateAgents.length} candidates)`,
|
|
5575
5650
|
verboseOnly: true
|
|
@@ -5585,6 +5660,7 @@ var ConversationAgentRunner = class {
|
|
|
5585
5660
|
Name: a.Name,
|
|
5586
5661
|
Description: a.Description
|
|
5587
5662
|
})),
|
|
5663
|
+
...sanitizedEdgeHint ? { [EDGE_PRE_DISCOVERY_DATA_KEY]: sanitizedEdgeHint } : {},
|
|
5588
5664
|
conversationId: input.conversationId,
|
|
5589
5665
|
latestMessageId: input.message.ID,
|
|
5590
5666
|
...input.appContext ? { appContext: input.appContext } : {},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
IsPlainObject,
|
|
3
3
|
SafeDeepMerge
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KHEWGJIZ.js";
|
|
5
5
|
|
|
6
6
|
// ../../AI/Core/dist/generic/baseModel.js
|
|
7
7
|
var BaseResult = class {
|
|
@@ -2684,6 +2684,14 @@ var BaseLLM = class extends BaseModel {
|
|
|
2684
2684
|
}
|
|
2685
2685
|
};
|
|
2686
2686
|
|
|
2687
|
+
// ../../AI/Core/dist/generic/decision.types.js
|
|
2688
|
+
var PLATT_LOGIT_CLAMP = 1e-6;
|
|
2689
|
+
function ApplyPlattCalibration(p, calibration) {
|
|
2690
|
+
const clamped = Math.min(1 - PLATT_LOGIT_CLAMP, Math.max(PLATT_LOGIT_CLAMP, p));
|
|
2691
|
+
const logit = Math.log(clamped / (1 - clamped));
|
|
2692
|
+
return 1 / (1 + Math.exp(-(calibration.A * logit + calibration.B)));
|
|
2693
|
+
}
|
|
2694
|
+
|
|
2687
2695
|
// ../../AI/Core/dist/generic/apiKeyDictionary.js
|
|
2688
2696
|
var AIAPIKeys = class _AIAPIKeys {
|
|
2689
2697
|
static {
|
|
@@ -3686,6 +3694,7 @@ function fragmentTiming(data, init) {
|
|
|
3686
3694
|
}
|
|
3687
3695
|
|
|
3688
3696
|
export {
|
|
3697
|
+
ApplyPlattCalibration,
|
|
3689
3698
|
RealtimeConversationMemory,
|
|
3690
3699
|
RenderRealtimeMemorySeed,
|
|
3691
3700
|
RenderRealtimeMemorySeedAsContextNote,
|