@memberjunction/ai-agents 6.2.0-edge.7 → 6.2.0
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/README.md +15 -0
- package/dist/MemoryWriteManager.d.ts +12 -0
- package/dist/MemoryWriteManager.d.ts.map +1 -1
- package/dist/MemoryWriteManager.js +18 -3
- package/dist/MemoryWriteManager.js.map +1 -1
- package/dist/agent-types/loop-agent-prompt-params.d.ts +20 -0
- package/dist/agent-types/loop-agent-prompt-params.d.ts.map +1 -1
- package/dist/agent-types/loop-agent-prompt-params.js +4 -1
- package/dist/agent-types/loop-agent-prompt-params.js.map +1 -1
- package/dist/base-agent.d.ts +85 -5
- package/dist/base-agent.d.ts.map +1 -1
- package/dist/base-agent.js +296 -50
- package/dist/base-agent.js.map +1 -1
- package/dist/client-tool-results.d.ts +12 -0
- package/dist/client-tool-results.d.ts.map +1 -1
- package/dist/client-tool-results.js +21 -0
- package/dist/client-tool-results.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/realtime/bridge-realtime-session-factory.d.ts +3 -3
- package/dist/realtime/bridge-realtime-session-factory.d.ts.map +1 -1
- package/dist/realtime/bridge-realtime-session-factory.js +12 -6
- package/dist/realtime/bridge-realtime-session-factory.js.map +1 -1
- package/dist/realtime/realtime-client-session-service.d.ts +50 -23
- package/dist/realtime/realtime-client-session-service.d.ts.map +1 -1
- package/dist/realtime/realtime-client-session-service.js +84 -44
- package/dist/realtime/realtime-client-session-service.js.map +1 -1
- package/dist/realtime/realtime-platform-credentials.d.ts +65 -0
- package/dist/realtime/realtime-platform-credentials.d.ts.map +1 -0
- package/dist/realtime/realtime-platform-credentials.js +148 -0
- package/dist/realtime/realtime-platform-credentials.js.map +1 -0
- package/dist/realtime/realtime-vendor-resolution.d.ts +41 -2
- package/dist/realtime/realtime-vendor-resolution.d.ts.map +1 -1
- package/dist/realtime/realtime-vendor-resolution.js +86 -4
- package/dist/realtime/realtime-vendor-resolution.js.map +1 -1
- package/package.json +20 -20
|
@@ -47,7 +47,8 @@ import { BridgeRealtimeUsageRecorder } from './bridge-realtime-usage-recorder.js
|
|
|
47
47
|
import { RealtimeToolBroker, INVOKE_TARGET_AGENT_TOOL_NAME, INVOKE_TARGET_AGENT_DESCRIPTION, BuildRealtimeAgentFraming } from './realtime-tool-broker.js';
|
|
48
48
|
import { NARRATION_PROMPT_NAME, LEGACY_NARRATION_PROMPT_NAME, ResolveNarrationInstructionsTemplate } from './realtime-narration.js';
|
|
49
49
|
import { BuildVoiceMannerSection, BuildAppRealtimeOverridesJson, DeepMergeConfigs, FindDeprecatedRealtimeVideoKeys, GetModelCatalogSessionSettings, GetDisclosureForTarget, GetNarrationPaceMs, GetProviderVoiceSettings, GetSessionTuningSettings, GetWatchesMeetingVideo, ResolveEffectiveRealtimeConfig, MatchProviderVoiceSettings, GetDirectActionsConfig, IsActionAllowedForDirectInvocation } from './realtime-coagent-config.js';
|
|
50
|
-
import { ListRealtimeVendorsForModel, SelectRealtimeVendorForModel } from './realtime-vendor-resolution.js';
|
|
50
|
+
import { ListRealtimeVendorsForModel, SelectRealtimeVendorForModel, RealtimeKeyFixHint } from './realtime-vendor-resolution.js';
|
|
51
|
+
import { RealtimePlatformCredentials, ResolveRealtimePlatformCredentials } from './realtime-platform-credentials.js';
|
|
51
52
|
import { AIEngineBase, MergeRealtimeUsageRecord } from '@memberjunction/ai-engine-base';
|
|
52
53
|
import { BuildSessionChannelPolicy } from './realtime-channel-policy.js';
|
|
53
54
|
/**
|
|
@@ -621,9 +622,9 @@ export class RealtimeClientSessionService {
|
|
|
621
622
|
const appSettingsJson = await this.resolveAppRealtimeOverrides(input.ApplicationID, contextUser, provider);
|
|
622
623
|
const effectiveConfig = this.resolveEffectiveConfig(coAgent, input.ConfigOverridesJson, targetAgent, appSettingsJson);
|
|
623
624
|
this.logDeprecatedVideoKeys(effectiveConfig, coAgent, targetAgent);
|
|
624
|
-
const outcome = await this.resolveModelForSession(input, coAgent, effectiveConfig);
|
|
625
|
+
const outcome = await this.resolveModelForSession(input, coAgent, effectiveConfig, contextUser);
|
|
625
626
|
if (!outcome.Resolution) {
|
|
626
|
-
return { Success: false, ErrorMessage: outcome.ErrorMessage ?? this.noModelMessage() };
|
|
627
|
+
return { Success: false, ErrorMessage: outcome.ErrorMessage ?? this.noModelMessage(input.CredentialScope) };
|
|
627
628
|
}
|
|
628
629
|
const resolution = outcome.Resolution;
|
|
629
630
|
let hostTools = input.HostTools;
|
|
@@ -1593,39 +1594,65 @@ export class RealtimeClientSessionService {
|
|
|
1593
1594
|
* @param input The prepare-session input (carries the optional preferred model id).
|
|
1594
1595
|
* @param coAgent The resolved co-agent (threaded to the default-resolution seam).
|
|
1595
1596
|
* @param effectiveConfig The resolved effective configuration (carries `modelPreference` and the video setting).
|
|
1597
|
+
* @param contextUser The calling user, as whom the platform's MJ Credentials are read.
|
|
1596
1598
|
* @returns The resolution outcome (resolution or failure reason).
|
|
1597
1599
|
*/
|
|
1598
|
-
async resolveModelForSession(input, coAgent, effectiveConfig) {
|
|
1600
|
+
async resolveModelForSession(input, coAgent, effectiveConfig, contextUser) {
|
|
1599
1601
|
// One resolver for every branch below, built here rather than per branch so the requested-model,
|
|
1600
1602
|
// configured-preference and default paths cannot disagree about which credentials the session
|
|
1601
|
-
// may use. It answers with the session's RUN keys only: resolveVendorAndInstantiate layers
|
|
1602
|
-
//
|
|
1603
|
-
//
|
|
1604
|
-
//
|
|
1603
|
+
// may use. It answers with the session's RUN keys only: resolveVendorAndInstantiate layers the
|
|
1604
|
+
// platform's MJ Credentials over it and this service's getAPIKeyForDriver seam under it, giving
|
|
1605
|
+
// platform credential → run key → seam → (the seam's default) env. A resolver that fell back to
|
|
1606
|
+
// the environment itself would answer before the seam, so a subclass that overrides the seam
|
|
1607
|
+
// would lose to AI_VENDOR_API_KEY__<driver>.
|
|
1605
1608
|
const resolveRunKey = this.buildRunKeyResolver(input.APIKeys);
|
|
1606
1609
|
const scope = input.CredentialScope ?? 'Any';
|
|
1610
|
+
// MJ Credential resolution is async and vendor selection is not, so every candidate vendor's
|
|
1611
|
+
// credential is resolved here, once, before any branch selects.
|
|
1612
|
+
const platform = await this.resolvePlatformCredentials(input.CredentialScope, coAgent, input.PreferredModelID, contextUser);
|
|
1607
1613
|
const preferAvatar = effectiveConfig?.realtime?.video?.enabled === true && RealtimeSessionCanShowAvatar(input);
|
|
1608
1614
|
if (input.PreferredModelID) {
|
|
1609
|
-
return this.resolvePreferredRealtimeModel(input.PreferredModelID, resolveRunKey, scope, preferAvatar);
|
|
1615
|
+
return this.resolvePreferredRealtimeModel(input.PreferredModelID, resolveRunKey, scope, preferAvatar, platform);
|
|
1610
1616
|
}
|
|
1611
|
-
const fromConfig = this.resolveConfiguredModelPreference(effectiveConfig, resolveRunKey, scope, preferAvatar);
|
|
1617
|
+
const fromConfig = this.resolveConfiguredModelPreference(effectiveConfig, resolveRunKey, scope, preferAvatar, platform);
|
|
1612
1618
|
if (fromConfig) {
|
|
1613
1619
|
return { Resolution: fromConfig };
|
|
1614
1620
|
}
|
|
1615
|
-
const resolution = await this.resolveDefaultRealtimeModel(coAgent, preferAvatar, resolveRunKey, scope);
|
|
1616
|
-
return resolution ? { Resolution: resolution } : { ErrorMessage: this.noModelMessage() };
|
|
1621
|
+
const resolution = await this.resolveDefaultRealtimeModel(coAgent, preferAvatar, resolveRunKey, scope, platform);
|
|
1622
|
+
return resolution ? { Resolution: resolution } : { ErrorMessage: this.noModelMessage(scope) };
|
|
1623
|
+
}
|
|
1624
|
+
/**
|
|
1625
|
+
* The platform MJ Credentials of every vendor this session might select: the Active Realtime
|
|
1626
|
+
* models' vendors, plus an explicitly requested model's. **Overridable seam** (tests substitute
|
|
1627
|
+
* credentials without a credential store). `'RuntimeOnly'` resolves none.
|
|
1628
|
+
*
|
|
1629
|
+
* @param credentialScope The session's credential scope.
|
|
1630
|
+
* @param coAgent The co-agent (its candidate models are the default walk's).
|
|
1631
|
+
* @param preferredModelID An explicitly requested model, which may sit outside the default walk.
|
|
1632
|
+
* @param contextUser The user the credentials are read as.
|
|
1633
|
+
* @returns The resolved credentials.
|
|
1634
|
+
*/
|
|
1635
|
+
async resolvePlatformCredentials(credentialScope, coAgent, preferredModelID, contextUser) {
|
|
1636
|
+
if (!CredentialScopeAllows(credentialScope, 'PlatformCredential')) {
|
|
1637
|
+
return RealtimePlatformCredentials.None;
|
|
1638
|
+
}
|
|
1639
|
+
const modelIDs = this.selectRealtimeModelCandidates(coAgent).map(m => m.ID);
|
|
1640
|
+
if (preferredModelID && !modelIDs.some(id => UUIDsEqual(id, preferredModelID))) {
|
|
1641
|
+
modelIDs.unshift(preferredModelID);
|
|
1642
|
+
}
|
|
1643
|
+
return ResolveRealtimePlatformCredentials(modelIDs, contextUser, credentialScope);
|
|
1617
1644
|
}
|
|
1618
1645
|
/**
|
|
1619
1646
|
* The default walk. With `preferAvatar` (the co-agent's video setting is on and the session could show an avatar),
|
|
1620
1647
|
* it takes the first candidate that shows one ({@link ResolveAvatarRealtimeModel}). When none does, or without it, it
|
|
1621
1648
|
* takes {@link resolveRealtimeModel}'s choice; when one was preferred, one log line says the call stays audio only.
|
|
1622
1649
|
*/
|
|
1623
|
-
async resolveDefaultRealtimeModel(coAgent, preferAvatar, resolve, credentialScope) {
|
|
1624
|
-
const withAvatar = preferAvatar ? this.ResolveAvatarRealtimeModel(coAgent, resolve, credentialScope) : null;
|
|
1650
|
+
async resolveDefaultRealtimeModel(coAgent, preferAvatar, resolve, credentialScope, platform) {
|
|
1651
|
+
const withAvatar = preferAvatar ? this.ResolveAvatarRealtimeModel(coAgent, resolve, credentialScope, platform) : null;
|
|
1625
1652
|
if (withAvatar) {
|
|
1626
1653
|
return withAvatar;
|
|
1627
1654
|
}
|
|
1628
|
-
const resolution = await this.resolveRealtimeModel(coAgent, resolve, credentialScope, preferAvatar);
|
|
1655
|
+
const resolution = await this.resolveRealtimeModel(coAgent, resolve, credentialScope, preferAvatar, platform);
|
|
1629
1656
|
if (preferAvatar && resolution) {
|
|
1630
1657
|
LogStatus('[RealtimeCoAgent] Video is on, but no realtime model with a usable key shows an avatar (its Video/Output row ' +
|
|
1631
1658
|
`and its endpoint): using '${resolution.ModelName ?? resolution.APIName}' on ${resolution.DriverClass ?? 'its driver'}, audio only.`);
|
|
@@ -1642,14 +1669,15 @@ export class RealtimeClientSessionService {
|
|
|
1642
1669
|
* @param coAgent The co-agent (reserved for future per-agent model preference).
|
|
1643
1670
|
* @param resolve The session's run-scoped key resolver (run keys only; see {@link resolveVendorAndInstantiate}).
|
|
1644
1671
|
* @param credentialScope The session's credential scope; see {@link resolveVendorAndInstantiate}.
|
|
1672
|
+
* @param platform The platform MJ Credentials resolved for the session; see {@link resolveVendorAndInstantiate}.
|
|
1645
1673
|
* @returns The resolution, or `null` when no candidate shows an avatar.
|
|
1646
1674
|
*/
|
|
1647
|
-
ResolveAvatarRealtimeModel(coAgent, resolve, credentialScope = 'Any') {
|
|
1648
|
-
const resolveKey = this.buildKeyChain(resolve, credentialScope);
|
|
1675
|
+
ResolveAvatarRealtimeModel(coAgent, resolve, credentialScope = 'Any', platform = RealtimePlatformCredentials.None) {
|
|
1649
1676
|
for (const model of this.selectRealtimeModelCandidates(coAgent)) {
|
|
1650
1677
|
if (ReadRealtimeVideoOutputRow(model.ID, AIEngine.Instance) === 'unsupported') {
|
|
1651
1678
|
continue;
|
|
1652
1679
|
}
|
|
1680
|
+
const resolveKey = this.buildKeyChain(resolve, credentialScope, platform, model.ID);
|
|
1653
1681
|
for (const vendor of ListRealtimeVendorsForModel(model.ID)) {
|
|
1654
1682
|
const resolution = this.instantiateRealtimeVendor(model, vendor, resolveKey);
|
|
1655
1683
|
if (resolution?.Model.SupportsClientDirect && RealtimeModelShowsAvatar(resolution, AIEngine.Instance)) {
|
|
@@ -1682,9 +1710,10 @@ export class RealtimeClientSessionService {
|
|
|
1682
1710
|
* @param resolve The session's run-scoped key resolver (run keys only; see {@link resolveVendorAndInstantiate}).
|
|
1683
1711
|
* @param credentialScope The session's credential scope; see {@link resolveVendorAndInstantiate}.
|
|
1684
1712
|
* @param showsAvatar Whether the session will show an avatar; see {@link resolveVendorAndInstantiate}.
|
|
1713
|
+
* @param platform The platform MJ Credentials resolved for the session; see {@link resolveVendorAndInstantiate}.
|
|
1685
1714
|
* @returns The resolution, or `null` when no preference is configured or it can't be satisfied.
|
|
1686
1715
|
*/
|
|
1687
|
-
resolveConfiguredModelPreference(effectiveConfig, resolve, credentialScope = 'Any', showsAvatar = false) {
|
|
1716
|
+
resolveConfiguredModelPreference(effectiveConfig, resolve, credentialScope = 'Any', showsAvatar = false, platform = RealtimePlatformCredentials.None) {
|
|
1688
1717
|
const preference = effectiveConfig?.realtime?.modelPreference;
|
|
1689
1718
|
if (!preference) {
|
|
1690
1719
|
return null;
|
|
@@ -1700,7 +1729,7 @@ export class RealtimeClientSessionService {
|
|
|
1700
1729
|
`'${model.Name}' but it is not an Active Realtime model — falling through to default resolution.`);
|
|
1701
1730
|
return null;
|
|
1702
1731
|
}
|
|
1703
|
-
const resolution = this.resolveVendorAndInstantiate(model, resolve, credentialScope, showsAvatar);
|
|
1732
|
+
const resolution = this.resolveVendorAndInstantiate(model, resolve, credentialScope, showsAvatar, platform);
|
|
1704
1733
|
if (!resolution) {
|
|
1705
1734
|
LogError(`RealtimeClientSessionService: configured realtime model preference '${model.Name}' has no usable ` +
|
|
1706
1735
|
'vendor DriverClass/API key — falling through to default resolution.');
|
|
@@ -1735,9 +1764,10 @@ export class RealtimeClientSessionService {
|
|
|
1735
1764
|
* @param resolve The session's run-scoped key resolver (run keys only; see {@link resolveVendorAndInstantiate}).
|
|
1736
1765
|
* @param credentialScope The session's credential scope; see {@link resolveVendorAndInstantiate}.
|
|
1737
1766
|
* @param showsAvatar Whether the session will show an avatar; see {@link resolveVendorAndInstantiate}.
|
|
1767
|
+
* @param platform The platform MJ Credentials resolved for the session; see {@link resolveVendorAndInstantiate}.
|
|
1738
1768
|
* @returns The resolution outcome (resolution or a specific failure reason).
|
|
1739
1769
|
*/
|
|
1740
|
-
resolvePreferredRealtimeModel(preferredModelID, resolve, credentialScope = 'Any', showsAvatar = false) {
|
|
1770
|
+
resolvePreferredRealtimeModel(preferredModelID, resolve, credentialScope = 'Any', showsAvatar = false, platform = RealtimePlatformCredentials.None) {
|
|
1741
1771
|
const model = this.findModelByID(preferredModelID);
|
|
1742
1772
|
if (!model) {
|
|
1743
1773
|
return { ErrorMessage: `The requested realtime model (id '${preferredModelID}') was not found in AI model metadata.` };
|
|
@@ -1748,11 +1778,11 @@ export class RealtimeClientSessionService {
|
|
|
1748
1778
|
if (!this.isRealtimeModel(model)) {
|
|
1749
1779
|
return { ErrorMessage: `The requested model '${model.Name}' is not a Realtime model (its type is '${model.AIModelType}').` };
|
|
1750
1780
|
}
|
|
1751
|
-
const resolution = this.resolveVendorAndInstantiate(model, resolve, credentialScope, showsAvatar);
|
|
1781
|
+
const resolution = this.resolveVendorAndInstantiate(model, resolve, credentialScope, showsAvatar, platform);
|
|
1752
1782
|
if (!resolution) {
|
|
1753
1783
|
return {
|
|
1754
|
-
ErrorMessage: `The requested model '${model.Name}' has no active vendor with a usable DriverClass/API key ` +
|
|
1755
|
-
|
|
1784
|
+
ErrorMessage: `The requested model '${model.Name}' has no active vendor with a usable DriverClass/API key, so the ` +
|
|
1785
|
+
`voice session could not be started with it. ${RealtimeKeyFixHint(credentialScope)}`
|
|
1756
1786
|
};
|
|
1757
1787
|
}
|
|
1758
1788
|
return { Resolution: resolution };
|
|
@@ -1783,9 +1813,10 @@ export class RealtimeClientSessionService {
|
|
|
1783
1813
|
* @param resolve The session's run-scoped key resolver (run keys only; see {@link resolveVendorAndInstantiate}).
|
|
1784
1814
|
* @param credentialScope The session's credential scope; see {@link resolveVendorAndInstantiate}.
|
|
1785
1815
|
* @param showsAvatar Whether the session will show an avatar; see {@link resolveVendorAndInstantiate}.
|
|
1816
|
+
* @param platform The platform MJ Credentials resolved for the session; see {@link resolveVendorAndInstantiate}.
|
|
1786
1817
|
* @returns The resolved model + identifiers, or `null`.
|
|
1787
1818
|
*/
|
|
1788
|
-
async resolveRealtimeModel(coAgent, resolve, credentialScope = 'Any', showsAvatar = false) {
|
|
1819
|
+
async resolveRealtimeModel(coAgent, resolve, credentialScope = 'Any', showsAvatar = false, platform = RealtimePlatformCredentials.None) {
|
|
1789
1820
|
// Walk candidates in descending PowerRank, returning the FIRST that fully resolves to a usable
|
|
1790
1821
|
// client-direct driver (active vendor + API key + ClassFactory driver + SupportsClientDirect).
|
|
1791
1822
|
// Single-pick dead-ended whenever the highest-power model lacked a key or client-direct support
|
|
@@ -1793,7 +1824,7 @@ export class RealtimeClientSessionService {
|
|
|
1793
1824
|
// surfaced "No usable Realtime model" instead of falling through to a model that works.
|
|
1794
1825
|
const candidates = this.selectRealtimeModelCandidates(coAgent);
|
|
1795
1826
|
for (const model of candidates) {
|
|
1796
|
-
const resolution = this.resolveVendorAndInstantiate(model, resolve, credentialScope, showsAvatar);
|
|
1827
|
+
const resolution = this.resolveVendorAndInstantiate(model, resolve, credentialScope, showsAvatar, platform);
|
|
1797
1828
|
if (resolution && resolution.Model.SupportsClientDirect) {
|
|
1798
1829
|
return resolution;
|
|
1799
1830
|
}
|
|
@@ -1804,9 +1835,11 @@ export class RealtimeClientSessionService {
|
|
|
1804
1835
|
* Shared tail of model resolution: picks the vendor (with a usable API key) for an
|
|
1805
1836
|
* already-chosen model entity and instantiates its realtime driver.
|
|
1806
1837
|
*
|
|
1807
|
-
* Key precedence, per driver class:
|
|
1808
|
-
*
|
|
1809
|
-
*
|
|
1838
|
+
* Key precedence, per driver class: the platform's MJ Credential for the model's vendor
|
|
1839
|
+
* (`platform`), then `resolve` (the session's run keys), then this service's
|
|
1840
|
+
* {@link getAPIKeyForDriver} seam, whose default is the environment key — the order a prompt
|
|
1841
|
+
* resolves its key in. Vendor selection and the mint use that one chain, so a session is never
|
|
1842
|
+
* routed to a vendor it cannot then be minted on, nor minted on a different key than selection saw.
|
|
1810
1843
|
*
|
|
1811
1844
|
* @param model The chosen model entity.
|
|
1812
1845
|
* @param resolve The session's run-scoped key resolver. Expected to answer with run keys only:
|
|
@@ -1820,11 +1853,13 @@ export class RealtimeClientSessionService {
|
|
|
1820
1853
|
* other keyed vendor that does is taken, when there is one. So a vendor that renders avatars (Vertex AI for Gemini
|
|
1821
1854
|
* 3.8 Live, with its own billing and limits) takes a session only when it will show an avatar, or when it is the
|
|
1822
1855
|
* only keyed vendor; and a session that will show one goes to such a vendor whatever the Priority order.
|
|
1856
|
+
* @param platform The platform MJ Credentials resolved for the session before selection
|
|
1857
|
+
* ({@link resolvePlatformCredentials}); `None` leaves the run keys and the seam.
|
|
1823
1858
|
* @returns The full resolution, or `null` when no vendor/key/driver can be satisfied.
|
|
1824
1859
|
*/
|
|
1825
|
-
resolveVendorAndInstantiate(model, resolve, credentialScope = 'Any', showsAvatar = false) {
|
|
1826
|
-
const resolveKey = this.buildKeyChain(resolve, credentialScope);
|
|
1827
|
-
const vendor = this.selectRealtimeVendor(model.ID, resolveKey);
|
|
1860
|
+
resolveVendorAndInstantiate(model, resolve, credentialScope = 'Any', showsAvatar = false, platform = RealtimePlatformCredentials.None) {
|
|
1861
|
+
const resolveKey = this.buildKeyChain(resolve, credentialScope, platform, model.ID);
|
|
1862
|
+
const vendor = this.selectRealtimeVendor(model.ID, resolveKey, credentialScope);
|
|
1828
1863
|
const first = vendor ? this.instantiateRealtimeVendor(model, vendor, resolveKey) : null;
|
|
1829
1864
|
if (!vendor || !first) {
|
|
1830
1865
|
return first;
|
|
@@ -1837,15 +1872,18 @@ export class RealtimeClientSessionService {
|
|
|
1837
1872
|
});
|
|
1838
1873
|
}
|
|
1839
1874
|
/**
|
|
1840
|
-
* The session's complete key chain for vendor selection and
|
|
1841
|
-
*
|
|
1842
|
-
*
|
|
1843
|
-
* step: the seam's default is the platform key.
|
|
1875
|
+
* The session's complete key chain for one model's vendor selection and mint (see
|
|
1876
|
+
* {@link resolveVendorAndInstantiate}): the platform's MJ Credential for the model's vendor, then the run's keys, then
|
|
1877
|
+
* this service's own seam (which subclasses and tests override). A scope that rules out the platform's credentials
|
|
1878
|
+
* has no first step, and one that rules out the environment has no last: the seam's default is the platform key.
|
|
1844
1879
|
*/
|
|
1845
|
-
buildKeyChain(resolve, credentialScope) {
|
|
1846
|
-
|
|
1880
|
+
buildKeyChain(resolve, credentialScope, platform = RealtimePlatformCredentials.None, modelID) {
|
|
1881
|
+
const runThenSeam = CredentialScopeAllows(credentialScope, 'Environment')
|
|
1847
1882
|
? (driverClass) => resolve?.(driverClass) ?? this.getAPIKeyForDriver(driverClass)
|
|
1848
1883
|
: (driverClass) => resolve?.(driverClass);
|
|
1884
|
+
return modelID && CredentialScopeAllows(credentialScope, 'PlatformCredential')
|
|
1885
|
+
? platform.ResolverFor(modelID, runThenSeam)
|
|
1886
|
+
: runThenSeam;
|
|
1849
1887
|
}
|
|
1850
1888
|
/** Instantiates a vendor's realtime driver with its key from the chain; `null` when the key or the driver is missing. */
|
|
1851
1889
|
instantiateRealtimeVendor(model, vendor, resolveKey) {
|
|
@@ -1914,10 +1952,11 @@ export class RealtimeClientSessionService {
|
|
|
1914
1952
|
*
|
|
1915
1953
|
* @param modelID The chosen model's id.
|
|
1916
1954
|
* @param resolve The complete key chain to select against; defaults to {@link getAPIKeyForDriver}.
|
|
1955
|
+
* @param credentialScope The session's credential scope (words the log line when no vendor qualifies).
|
|
1917
1956
|
* @returns The vendor driver/api identifiers, or `null` when none has a usable key.
|
|
1918
1957
|
*/
|
|
1919
|
-
selectRealtimeVendor(modelID, resolve) {
|
|
1920
|
-
return SelectRealtimeVendorForModel(modelID, resolve ?? ((driverClass) => this.getAPIKeyForDriver(driverClass)));
|
|
1958
|
+
selectRealtimeVendor(modelID, resolve, credentialScope) {
|
|
1959
|
+
return SelectRealtimeVendorForModel(modelID, resolve ?? ((driverClass) => this.getAPIKeyForDriver(driverClass)), credentialScope);
|
|
1921
1960
|
}
|
|
1922
1961
|
/**
|
|
1923
1962
|
* Resolves the DB-driven progress-narration instruction template: the Active `MJ: AI Prompts`
|
|
@@ -3100,14 +3139,15 @@ export class RealtimeClientSessionService {
|
|
|
3100
3139
|
return { Signal: controller.signal, Dispose: dispose };
|
|
3101
3140
|
}
|
|
3102
3141
|
/**
|
|
3103
|
-
* The
|
|
3142
|
+
* The message returned when no usable Realtime model can be resolved: what is missing and how to
|
|
3143
|
+
* supply it. The server log carries a line per skipped model naming each vendor and what it needed.
|
|
3104
3144
|
*
|
|
3145
|
+
* @param credentialScope The session's credential scope (which key sources could have answered).
|
|
3105
3146
|
* @returns The failure message.
|
|
3106
3147
|
*/
|
|
3107
|
-
noModelMessage() {
|
|
3108
|
-
return ('No usable Realtime model could be resolved for the Realtime Co-Agent
|
|
3109
|
-
|
|
3110
|
-
'(e.g. AI_VENDOR_API_KEY__<driver>).');
|
|
3148
|
+
noModelMessage(credentialScope) {
|
|
3149
|
+
return ('No usable Realtime model could be resolved for the Realtime Co-Agent: no active vendor of an active ' +
|
|
3150
|
+
`model of AIModelType 'Realtime' has a usable key. ${RealtimeKeyFixHint(credentialScope)}`);
|
|
3111
3151
|
}
|
|
3112
3152
|
}
|
|
3113
3153
|
//# sourceMappingURL=realtime-client-session-service.js.map
|