@memberjunction/realtime-widget 6.2.0-edge.6 → 6.2.0-edge.7

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,6 +1,6 @@
1
1
  import {
2
2
  IsPlainObject
3
- } from "./chunk-ZX4SRAYD.js";
3
+ } from "./chunk-VXA62VEQ.js";
4
4
 
5
5
  // ../../AI/Core/dist/generic/baseModel.js
6
6
  var BaseResult = class {
@@ -97,7 +97,28 @@ function RealtimeDiagLog(message) {
97
97
  console.log(sanitized);
98
98
  }
99
99
  }
100
+ function ClampSessionSecondsValue(...candidates) {
101
+ let smallest;
102
+ for (const c of candidates) {
103
+ if (typeof c !== "number" || !Number.isInteger(c) || c <= 0)
104
+ continue;
105
+ if (smallest === void 0 || c < smallest)
106
+ smallest = c;
107
+ }
108
+ return smallest;
109
+ }
100
110
  var BaseRealtimeModel = class extends BaseModel {
111
+ static {
112
+ this.DriverFacts = Object.freeze({});
113
+ }
114
+ /**
115
+ * Returns the smallest candidate that is a positive integer; see {@link ClampSessionSecondsValue}.
116
+ * The rule "the caller's bag wins only if smaller" lives there, once: pass the provider
117
+ * cap and the bag cap together.
118
+ */
119
+ ClampSessionSeconds(...candidates) {
120
+ return ClampSessionSecondsValue(...candidates);
121
+ }
101
122
  static {
102
123
  this.SupportsDynamicToolSet = false;
103
124
  }
@@ -8,10 +8,10 @@ import {
8
8
  MJAIModelPriceUnitTypeEntity,
9
9
  TemplateEngineBase,
10
10
  coerceFailedExecuteAgentResult,
11
- cr,
12
11
  h,
13
- ve
14
- } from "./chunk-MRWWS7FK.js";
12
+ lr,
13
+ we
14
+ } from "./chunk-46L5OHPT.js";
15
15
  import {
16
16
  BaseEngine,
17
17
  BaseEntity,
@@ -22,12 +22,12 @@ import {
22
22
  PermissionConstrainedError,
23
23
  RegisterForStartup,
24
24
  RunView
25
- } from "./chunk-N3BM2W5J.js";
25
+ } from "./chunk-MQPAK26D.js";
26
26
  import {
27
27
  ParseModelConfiguration,
28
28
  ParseVendorConfiguration,
29
29
  ResolveEffectiveModelConfiguration
30
- } from "./chunk-VZ6KR7K2.js";
30
+ } from "./chunk-4IZZL4GA.js";
31
31
  import {
32
32
  BaseSingleton,
33
33
  BehaviorSubject,
@@ -44,7 +44,7 @@ import {
44
44
  ValidationErrorInfo,
45
45
  ValidationErrorType,
46
46
  throttleTime
47
- } from "./chunk-ZX4SRAYD.js";
47
+ } from "./chunk-VXA62VEQ.js";
48
48
 
49
49
  // ../../AI/BaseAIEngine/dist/PriceUnitTypes.js
50
50
  var __decorate = function(decorators, target, key, desc) {
@@ -923,8 +923,8 @@ var AIEngineBase = class AIEngineBase2 extends BaseEngine {
923
923
  ];
924
924
  this.appendRealtimeRegistryConfigs(params, provider);
925
925
  const [, , loadResult] = await Promise.all([
926
- TemplateEngineBase.Instance.Config(false, contextUser),
927
- ArtifactMetadataEngine.Instance.Config(false, contextUser),
926
+ TemplateEngineBase.Instance.Config(false, contextUser, provider),
927
+ ArtifactMetadataEngine.Instance.Config(false, contextUser, provider),
928
928
  this.Load(params, provider, forceRefresh, contextUser)
929
929
  ]);
930
930
  return loadResult;
@@ -1357,6 +1357,51 @@ var AIEngineBase = class AIEngineBase2 extends BaseEngine {
1357
1357
  get AgentCategories() {
1358
1358
  return this.GetConfigData("_agentCategories");
1359
1359
  }
1360
+ /**
1361
+ * Resolves the file storage account an agent's files should go to, along with the tier that
1362
+ * supplied it (`Override`, `Agent`, `Category`, `AgentType`, `Fallback`, or `None`) and whether
1363
+ * a system fallback had to choose among multiple active accounts (`Ambiguous`).
1364
+ *
1365
+ * Resolution chain (first non-null wins):
1366
+ * 1. `overrideStorageAccountId` — a runtime override (`Source: 'Override'`)
1367
+ * 2. Agent-level `DefaultStorageAccountID` (`Source: 'Agent'`)
1368
+ * 3. Category hierarchy — walks up the agent's category tree via `ParentID` (`Source: 'Category'`)
1369
+ * 4. Agent Type-level `DefaultStorageAccountID` (`Source: 'AgentType'`)
1370
+ * 5. System fallback — {@link FileStorageEngineBase.ResolveDefaultAccount} over the active accounts
1371
+ * (`Source: 'Fallback'`, `Ambiguous: resolution.Ambiguous`), or `Source: 'None'` when none is active.
1372
+ *
1373
+ * @param agent - The agent being resolved for
1374
+ * @param overrideStorageAccountId - Optional runtime override; wins outright when set
1375
+ * @returns The storage account ID, source tier, and ambiguity flag
1376
+ */
1377
+ ResolveAgentStorageAccount(agent, overrideStorageAccountId) {
1378
+ if (overrideStorageAccountId) {
1379
+ return { AccountID: overrideStorageAccountId, Source: "Override", Ambiguous: false };
1380
+ }
1381
+ if (agent.DefaultStorageAccountID) {
1382
+ return { AccountID: agent.DefaultStorageAccountID, Source: "Agent", Ambiguous: false };
1383
+ }
1384
+ const categoryAccountId = this.resolveCategoryStorageAccountID(agent.CategoryID);
1385
+ if (categoryAccountId) {
1386
+ return { AccountID: categoryAccountId, Source: "Category", Ambiguous: false };
1387
+ }
1388
+ const agentType = agent.TypeID ? this.AgentTypes.find((at) => UUIDsEqual(at.ID, agent.TypeID)) : void 0;
1389
+ if (agentType?.DefaultStorageAccountID) {
1390
+ return { AccountID: agentType.DefaultStorageAccountID, Source: "AgentType", Ambiguous: false };
1391
+ }
1392
+ const resolution = FileStorageEngineBase.Instance.ResolveDefaultAccount();
1393
+ if (resolution.Ambiguous && resolution.Chosen) {
1394
+ this.warnAmbiguousStorageFallback(agent, agentType?.Name, resolution.Candidates.map((c) => `'${c.account.Name}' (${c.provider.Name})`), resolution.Chosen.account.Name);
1395
+ }
1396
+ if (resolution.Chosen) {
1397
+ return {
1398
+ AccountID: resolution.Chosen.account.ID,
1399
+ Source: "Fallback",
1400
+ Ambiguous: resolution.Ambiguous
1401
+ };
1402
+ }
1403
+ return { AccountID: null, Source: "None", Ambiguous: false };
1404
+ }
1360
1405
  /**
1361
1406
  * Resolves the file storage account an agent's files should go to. This is the golden path for
1362
1407
  * agent storage routing, so agents, actions and UI that need "where would this agent store a file?"
@@ -1377,21 +1422,7 @@ var AIEngineBase = class AIEngineBase2 extends BaseEngine {
1377
1422
  * @returns The storage account ID, or `null` when no account is configured or active
1378
1423
  */
1379
1424
  ResolveAgentStorageAccountID(agent, overrideStorageAccountId) {
1380
- if (overrideStorageAccountId)
1381
- return overrideStorageAccountId;
1382
- if (agent.DefaultStorageAccountID)
1383
- return agent.DefaultStorageAccountID;
1384
- const categoryAccountId = this.resolveCategoryStorageAccountID(agent.CategoryID);
1385
- if (categoryAccountId)
1386
- return categoryAccountId;
1387
- const agentType = agent.TypeID ? this.AgentTypes.find((at) => UUIDsEqual(at.ID, agent.TypeID)) : void 0;
1388
- if (agentType?.DefaultStorageAccountID)
1389
- return agentType.DefaultStorageAccountID;
1390
- const resolution = FileStorageEngineBase.Instance.ResolveDefaultAccount();
1391
- if (resolution.Ambiguous && resolution.Chosen) {
1392
- this.warnAmbiguousStorageFallback(agent, agentType?.Name, resolution.Candidates.map((c) => `'${c.account.Name}' (${c.provider.Name})`), resolution.Chosen.account.Name);
1393
- }
1394
- return resolution.Chosen?.account.ID ?? null;
1425
+ return this.ResolveAgentStorageAccount(agent, overrideStorageAccountId).AccountID;
1395
1426
  }
1396
1427
  /** Walks up the category tree from `categoryId` and returns the first `DefaultStorageAccountID` found. */
1397
1428
  resolveCategoryStorageAccountID(categoryId) {
@@ -1840,9 +1871,10 @@ var AIEngineBase = class AIEngineBase2 extends BaseEngine {
1840
1871
  * Use instead of `PromptModels.filter(pm => UUIDsEqual(pm.PromptID, id))` in hot paths.
1841
1872
  */
1842
1873
  get PromptModelsByPromptID() {
1874
+ const promptModels = this.PromptModels;
1843
1875
  if (!this._promptModelsByPromptID) {
1844
1876
  const map = /* @__PURE__ */ new Map();
1845
- for (const pm of this._promptModels) {
1877
+ for (const pm of promptModels) {
1846
1878
  const key = NormalizeUUID(pm.PromptID);
1847
1879
  const list = map.get(key);
1848
1880
  if (list) {
@@ -3030,6 +3062,7 @@ var AIEngineBase = class AIEngineBase2 extends BaseEngine {
3030
3062
  OrderBy: "RunAt DESC",
3031
3063
  MaxRows: 1,
3032
3064
  // get only the latest one
3065
+ SkipTotalRowCount: true,
3033
3066
  ResultType: "entity_object"
3034
3067
  }, this.ContextUser);
3035
3068
  if (result && result.Success && result.Results && result.Results.length > 0) {
@@ -3617,7 +3650,7 @@ var AgentClientSession = class {
3617
3650
  if (!provider) {
3618
3651
  return { Success: false, ErrorMessage: "GraphQL provider not available" };
3619
3652
  }
3620
- const aiClient = new ve(provider);
3653
+ const aiClient = new we(provider);
3621
3654
  try {
3622
3655
  const agentShim = { ID: params.AgentId };
3623
3656
  const messages = params.Messages.map((m) => ({
@@ -3675,7 +3708,7 @@ var AgentClientSession = class {
3675
3708
  if (!provider) {
3676
3709
  return { Success: false, ErrorMessage: "GraphQL provider not available" };
3677
3710
  }
3678
- const aiClient = new ve(provider);
3711
+ const aiClient = new we(provider);
3679
3712
  try {
3680
3713
  const gqlParams = {
3681
3714
  userMessageId: params.UserMessageId,
@@ -4689,6 +4722,7 @@ var DefaultAgentResolver = class _DefaultAgentResolver {
4689
4722
  EntityName: "MJ: Applications",
4690
4723
  ExtraFilter: `ID = '${applicationId}'`,
4691
4724
  MaxRows: 1,
4725
+ SkipTotalRowCount: true,
4692
4726
  ResultType: "entity_object"
4693
4727
  }, contextUser);
4694
4728
  if (!result.Success || !result.Results || result.Results.length === 0) {
@@ -5463,7 +5497,7 @@ var ConversationTail = class {
5463
5497
  if (!provider) {
5464
5498
  return void 0;
5465
5499
  }
5466
- this.client = new cr(provider);
5500
+ this.client = new lr(provider);
5467
5501
  return this.client;
5468
5502
  } catch {
5469
5503
  return void 0;
@@ -6042,6 +6076,10 @@ function closeReasonChip(reason) {
6042
6076
  return { Label: "Error", Tone: "error" };
6043
6077
  case "Janitor":
6044
6078
  return { Label: "Timed out", Tone: "neutral" };
6079
+ case "TimeLimit":
6080
+ return { Label: "Time limit", Tone: "neutral" };
6081
+ case "Idle":
6082
+ return { Label: "Idle \u2014 no activity", Tone: "neutral" };
6045
6083
  case "Shutdown":
6046
6084
  return { Label: "Interrupted", Tone: "neutral" };
6047
6085
  default: