@memberjunction/ng-conversations 5.41.0 → 5.43.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.
Files changed (69) hide show
  1. package/dist/__tests__/remote-browser-channel.test.js +163 -1
  2. package/dist/__tests__/remote-browser-channel.test.js.map +1 -1
  3. package/dist/lib/components/collection/collections-full-view.component.d.ts +105 -2
  4. package/dist/lib/components/collection/collections-full-view.component.d.ts.map +1 -1
  5. package/dist/lib/components/collection/collections-full-view.component.js +1378 -489
  6. package/dist/lib/components/collection/collections-full-view.component.js.map +1 -1
  7. package/dist/lib/components/conversation/conversation-chat-area.component.d.ts +4 -0
  8. package/dist/lib/components/conversation/conversation-chat-area.component.d.ts.map +1 -1
  9. package/dist/lib/components/conversation/conversation-chat-area.component.js +13 -8
  10. package/dist/lib/components/conversation/conversation-chat-area.component.js.map +1 -1
  11. package/dist/lib/components/conversation/conversation-list.component.d.ts +98 -5
  12. package/dist/lib/components/conversation/conversation-list.component.d.ts.map +1 -1
  13. package/dist/lib/components/conversation/conversation-list.component.js +1102 -401
  14. package/dist/lib/components/conversation/conversation-list.component.js.map +1 -1
  15. package/dist/lib/components/mention/mention-dropdown.component.js +37 -19
  16. package/dist/lib/components/mention/mention-dropdown.component.js.map +1 -1
  17. package/dist/lib/components/mention/mention-editor.component.d.ts.map +1 -1
  18. package/dist/lib/components/mention/mention-editor.component.js +10 -3
  19. package/dist/lib/components/mention/mention-editor.component.js.map +1 -1
  20. package/dist/lib/components/message/message-input.component.js +1 -1
  21. package/dist/lib/components/message/message-input.component.js.map +1 -1
  22. package/dist/lib/components/message/message-item.component.d.ts +5 -0
  23. package/dist/lib/components/message/message-item.component.d.ts.map +1 -1
  24. package/dist/lib/components/message/message-item.component.js +26 -3
  25. package/dist/lib/components/message/message-item.component.js.map +1 -1
  26. package/dist/lib/components/project/project-form-modal.component.d.ts +5 -1
  27. package/dist/lib/components/project/project-form-modal.component.d.ts.map +1 -1
  28. package/dist/lib/components/project/project-form-modal.component.js +104 -85
  29. package/dist/lib/components/project/project-form-modal.component.js.map +1 -1
  30. package/dist/lib/components/realtime/channels/base-realtime-channel-client.d.ts +22 -0
  31. package/dist/lib/components/realtime/channels/base-realtime-channel-client.d.ts.map +1 -1
  32. package/dist/lib/components/realtime/channels/base-realtime-channel-client.js +40 -0
  33. package/dist/lib/components/realtime/channels/base-realtime-channel-client.js.map +1 -1
  34. package/dist/lib/components/realtime/realtime-agent-picker.component.d.ts +12 -1
  35. package/dist/lib/components/realtime/realtime-agent-picker.component.d.ts.map +1 -1
  36. package/dist/lib/components/realtime/realtime-agent-picker.component.js +97 -19
  37. package/dist/lib/components/realtime/realtime-agent-picker.component.js.map +1 -1
  38. package/dist/lib/components/realtime/remote-browser/remote-browser-channel.d.ts +33 -0
  39. package/dist/lib/components/realtime/remote-browser/remote-browser-channel.d.ts.map +1 -1
  40. package/dist/lib/components/realtime/remote-browser/remote-browser-channel.js +164 -7
  41. package/dist/lib/components/realtime/remote-browser/remote-browser-channel.js.map +1 -1
  42. package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.d.ts +35 -2
  43. package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.d.ts.map +1 -1
  44. package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.js +67 -4
  45. package/dist/lib/components/realtime/remote-browser/remote-browser-surface.component.js.map +1 -1
  46. package/dist/lib/components/realtime/remote-browser/remote-browser-tools.d.ts +1 -0
  47. package/dist/lib/components/realtime/remote-browser/remote-browser-tools.d.ts.map +1 -1
  48. package/dist/lib/components/realtime/remote-browser/remote-browser-tools.js +13 -0
  49. package/dist/lib/components/realtime/remote-browser/remote-browser-tools.js.map +1 -1
  50. package/dist/lib/components/workspace/conversation-workspace.component.d.ts +4 -0
  51. package/dist/lib/components/workspace/conversation-workspace.component.d.ts.map +1 -1
  52. package/dist/lib/components/workspace/conversation-workspace.component.js +13 -8
  53. package/dist/lib/components/workspace/conversation-workspace.component.js.map +1 -1
  54. package/dist/lib/models/conversation-state.model.d.ts +1 -1
  55. package/dist/lib/models/conversation-state.model.d.ts.map +1 -1
  56. package/dist/lib/models/conversation-state.model.js.map +1 -1
  57. package/dist/lib/services/artifact-state.service.d.ts +1 -1
  58. package/dist/lib/services/artifact-state.service.d.ts.map +1 -1
  59. package/dist/lib/services/artifact-state.service.js +7 -2
  60. package/dist/lib/services/artifact-state.service.js.map +1 -1
  61. package/dist/lib/services/mention-autocomplete.service.d.ts +25 -5
  62. package/dist/lib/services/mention-autocomplete.service.d.ts.map +1 -1
  63. package/dist/lib/services/mention-autocomplete.service.js +86 -18
  64. package/dist/lib/services/mention-autocomplete.service.js.map +1 -1
  65. package/dist/lib/services/realtime-pairing.d.ts +8 -7
  66. package/dist/lib/services/realtime-pairing.d.ts.map +1 -1
  67. package/dist/lib/services/realtime-pairing.js +19 -9
  68. package/dist/lib/services/realtime-pairing.js.map +1 -1
  69. package/package.json +26 -26
@@ -1 +1 @@
1
- {"version":3,"file":"realtime-pairing.js","sourceRoot":"","sources":["../../../src/lib/services/realtime-pairing.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAgC9D;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,QAA2B,EAAE,SAAiB;IACtF,MAAM,EAAE,GAAG,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACnC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,YAAY,CAAC,mBAAmB,CAAe,QAAQ,EAAE,YAAY,CAAiB,CAAC;QACtG,MAAM,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;QAChD,MAAM,IA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AgC,CAAC,gBAA2C;IAC1F,MAAM,OAAO,GAAG,gBAAgB,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IAC/C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAE,EAAE,eAAe,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;AACpE,CAAC","sourcesContent":["import { IMetadataProvider } from '@memberjunction/core';\nimport { NormalizeUUID, UUIDsEqual } from '@memberjunction/global';\nimport { AIEngineBase } from '@memberjunction/ai-engine-base';\n\n/**\n * The narrow read-only projection of an `MJ: AI Agent Co Agents` row the voice UI consumes\n * (loaded via {@link LoadCoAgentPairings} from {@link AIEngineBase}'s cached `AgentCoAgents`;\n * only **Active** rows of relationship **Type `'CoAgent'`** with a specific agent target —\n * type-level rows express the resolution-chain default, not a target restriction, and\n * reserved relationship types are ignored until their features ship). Pairing semantics: a\n * co-agent with ZERO such rows is **universal** (it can front any target agent — the\n * zero-config default); a co-agent WITH rows may front exactly the listed targets, with the\n * `IsDefault` row as its preselected target.\n */\nexport interface RealtimePairedAgentRow {\n /** The pairing row id. */\n ID: string;\n /** The Realtime-type co-agent the pairing belongs to. */\n CoAgentID: string;\n /** The target agent this co-agent may front. */\n TargetAgentID: string;\n /** Denormalized target-agent display name (from the base view). */\n TargetAgent: string | null;\n /** When true, this target is the co-agent's default (at most one per co-agent). */\n IsDefault: boolean;\n /** Display/list ordering of the pairing rows. */\n Sequence: number | null;\n}\n\n/** Minimal agent shape the pure pairing/co-agent helpers operate on. */\nexport interface RealtimeAgentLike {\n ID: string;\n}\n\n/**\n * Loads the pairing rows for one co-agent from {@link AIEngineBase}'s cached\n * `MJ: AI Agent Co Agents` metadata (provider-scoped engine instance, lazy `Config`),\n * in `Sequence` order. The engine's BaseEntity-event reactivity keeps the cache fresh —\n * no per-call RunView round-trip.\n *\n * Tolerant by design: any failure degrades to an EMPTY list — i.e. \"no pairing\n * constraint\". The client gate is pure disclosure; the server independently validates\n * the co-agent/target pairing at session mint.\n */\nexport async function LoadCoAgentPairings(provider: IMetadataProvider, coAgentId: string): Promise<RealtimePairedAgentRow[]> {\n const id = coAgentId?.trim() ?? '';\n if (id.length === 0) {\n return [];\n }\n try {\n const engine = AIEngineBase.GetProviderInstance<AIEngineBase>(provider, AIEngineBase) as AIEngineBase;\n await engine.Config(false, undefined, provider);\n const rows = (engine.AgentCoAgents ?? [])\n .filter(p =>\n p.Type === 'CoAgent' &&\n p.Status === 'Active' &&\n p.TargetAgentID != null &&\n UUIDsEqual(p.CoAgentID, id))\n .map<RealtimePairedAgentRow>(p => ({\n ID: p.ID,\n CoAgentID: p.CoAgentID,\n TargetAgentID: p.TargetAgentID!,\n TargetAgent: p.TargetAgent ?? null,\n IsDefault: p.IsDefault,\n Sequence: p.Sequence ?? null\n }));\n return SortPairings(rows);\n } catch (error) {\n console.warn('[RealtimePairing] Co-agent pairing lookup unavailable — treating co-agent as universal:', error);\n return [];\n }\n}\n\n/**\n * Returns the pairing rows in canonical display order: `Sequence` ascending (null/missing\n * sequences last), ties broken by target-agent name. Pure; never mutates the input.\n */\nexport function SortPairings(pairings: readonly RealtimePairedAgentRow[]): RealtimePairedAgentRow[] {\n return [...pairings].sort((a, b) => {\n const aSeq = a.Sequence ?? Number.MAX_SAFE_INTEGER;\n const bSeq = b.Sequence ?? Number.MAX_SAFE_INTEGER;\n if (aSeq !== bSeq) {\n return aSeq - bSeq;\n }\n return (a.TargetAgent ?? '').localeCompare(b.TargetAgent ?? '');\n });\n}\n\n/**\n * Applies the pairing constraint to a candidate target-agent list:\n * - ZERO pairing rows → the co-agent is universal; the candidates are returned unchanged\n * (today's flow untouched).\n * - One or more rows → only candidates that appear among the pairing targets are\n * returned, ordered by the pairings' `Sequence`. Paired targets the user can't see /\n * run (absent from `agents`) are silently dropped.\n *\n * Pure and UUID-casing safe (`NormalizeUUID` keys).\n */\nexport function ConstrainTargetsToPairings<T extends RealtimeAgentLike>(\n agents: readonly T[],\n pairings: readonly RealtimePairedAgentRow[]\n): T[] {\n if (!pairings || pairings.length === 0) {\n return [...agents];\n }\n const agentsById = new Map<string, T>();\n for (const agent of agents) {\n agentsById.set(NormalizeUUID(agent.ID), agent);\n }\n const constrained: T[] = [];\n const seen = new Set<string>();\n for (const pairing of SortPairings(pairings)) {\n const key = NormalizeUUID(pairing.TargetAgentID);\n const agent = agentsById.get(key);\n if (agent && !seen.has(key)) {\n seen.add(key);\n constrained.push(agent);\n }\n }\n return constrained;\n}\n\n/**\n * The co-agent's default target from its pairing rows — the first `IsDefault` row in\n * `Sequence` order (server enforces at most one, but the helper stays deterministic\n * regardless). `null` when there are no rows or none is marked default.\n */\nexport function DefaultPairedTargetId(pairings: readonly RealtimePairedAgentRow[]): string | null {\n for (const pairing of SortPairings(pairings ?? [])) {\n if (pairing.IsDefault) {\n return pairing.TargetAgentID;\n }\n }\n return null;\n}\n\n/**\n * Whether the pairing rows permit `targetAgentId` as a target. ZERO rows means the\n * co-agent is universal (always allowed); otherwise the target must appear among the\n * rows. Missing/empty target id is never allowed against a constrained co-agent.\n */\nexport function PairingsAllowTarget(pairings: readonly RealtimePairedAgentRow[], targetAgentId: string | null | undefined): boolean {\n if (!pairings || pairings.length === 0) {\n return true;\n }\n if (!targetAgentId) {\n return false;\n }\n return pairings.some(p => UUIDsEqual(p.TargetAgentID, targetAgentId));\n}\n\n/**\n * Filters an agent list down to ACTIVE Realtime-type **co-agent** candidates. The input\n * is expected to already be the run-permission-filtered active-agent set the host uses\n * for routing/@mentions, so this only applies the agent-TYPE cut (trim +\n * case-insensitive match on the denormalized `Type` name).\n */\nexport function FilterRealtimeCoAgents<T extends { Type: string | null }>(agents: readonly T[]): T[] {\n return agents.filter(a => (a.Type ?? '').trim().toLowerCase() === 'realtime');\n}\n\n/**\n * A selectable realtime model option in the voice picker (narrow read-only projection of\n * `MJ: AI Models` — only the fields the dropdown renders).\n */\nexport interface RealtimeModelOption {\n /** The `MJ: AI Models` row id. */\n ID: string;\n /** The model's display name. */\n Name: string;\n}\n\n/**\n * The minimal `MJ: AI Models` row shape {@link BuildRealtimeModelOptions} consumes —\n * structurally satisfied by `AIEngineBase`'s cached `Models` entities.\n */\nexport interface VoiceModelCandidate {\n /** The `MJ: AI Models` row id. */\n ID: string;\n /** The model's display name. */\n Name: string;\n /** Denormalized model-type name (e.g. 'LLM', 'Realtime'). */\n AIModelType: string | null;\n /** Whether the model is active and selectable. */\n IsActive: boolean;\n}\n\n/**\n * Builds the \"Voice model\" dropdown options from a cached model list: ACTIVE models whose\n * type is `Realtime` (trim + case-insensitive — SQL-collation parity with the previous\n * `IsActive = 1 AND AIModelType = 'Realtime'` filter), projected to {@link RealtimeModelOption}\n * and sorted by Name. Pure; never mutates the input.\n */\nexport function BuildRealtimeModelOptions(models: ReadonlyArray<VoiceModelCandidate>): RealtimeModelOption[] {\n return models\n .filter(m => m.IsActive && (m.AIModelType ?? '').trim().toLowerCase() === 'realtime')\n .map<RealtimeModelOption>(m => ({ ID: m.ID, Name: m.Name }))\n .sort((a, b) => (a.Name ?? '').localeCompare(b.Name ?? ''));\n}\n\n/**\n * Builds the `configOverridesJson` payload for the `StartRealtimeClientSession` mint from\n * what the (authorization-gated) pickers chose. Currently the only override is the\n * explicit realtime model preference; the envelope shape —\n * `{\"realtime\":{\"modelPreference\":\"<id>\"}}` — is the pinned server contract and is\n * structured so future overrides ride alongside without reshaping.\n *\n * @returns The JSON string, or `null` when nothing was overridden (the common case —\n * `null` keeps the mint identical to today's behavior).\n */\nexport function BuildRealtimeConfigOverridesJson(preferredModelId: string | null | undefined): string | null {\n const modelId = preferredModelId?.trim() ?? '';\n if (modelId.length === 0) {\n return null;\n }\n return JSON.stringify({ realtime: { modelPreference: modelId } });\n}\n"]}
1
+ {"version":3,"file":"realtime-pairing.js","sourceRoot":"","sources":["../../../src/lib/services/realtime-pairing.ts"],"names":[],"mappings":"AACA,OAA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CAAC;AACtC,CAAC","sourcesContent":["import { IMetadataProvider } from '@memberjunction/core';\nimport { NormalizeUUID, UUIDsEqual } from '@memberjunction/global';\nimport { AIEngineBase } from '@memberjunction/ai-engine-base';\n\n/**\n * The narrow read-only projection of an `MJ: AI Agent Co Agents` row the voice UI consumes\n * (loaded via {@link LoadCoAgentPairings} from {@link AIEngineBase}'s cached `AgentCoAgents`;\n * only **Active** rows of relationship **Type `'CoAgent'`** with a specific agent target —\n * type-level rows express the resolution-chain default, not a target restriction, and\n * reserved relationship types are ignored until their features ship). Pairing semantics: a\n * co-agent with ZERO such rows is **universal** (it can front any target agent — the\n * zero-config default); a co-agent WITH rows may front exactly the listed targets, with the\n * `IsDefault` row as its preselected target.\n */\nexport interface RealtimePairedAgentRow {\n /** The pairing row id. */\n ID: string;\n /** The Realtime-type co-agent the pairing belongs to. */\n CoAgentID: string;\n /** The target agent this co-agent may front. */\n TargetAgentID: string;\n /** Denormalized target-agent display name (from the base view). */\n TargetAgent: string | null;\n /** When true, this target is the co-agent's default (at most one per co-agent). */\n IsDefault: boolean;\n /** Display/list ordering of the pairing rows. */\n Sequence: number | null;\n}\n\n/** Minimal agent shape the pure pairing/co-agent helpers operate on. */\nexport interface RealtimeAgentLike {\n ID: string;\n}\n\n/**\n * Loads the pairing rows for one co-agent from {@link AIEngineBase}'s cached\n * `MJ: AI Agent Co Agents` metadata (provider-scoped engine instance, lazy `Config`),\n * in `Sequence` order. The engine's BaseEntity-event reactivity keeps the cache fresh —\n * no per-call RunView round-trip.\n *\n * Tolerant by design: any failure degrades to an EMPTY list — i.e. \"no pairing\n * constraint\". The client gate is pure disclosure; the server independently validates\n * the co-agent/target pairing at session mint.\n */\nexport async function LoadCoAgentPairings(provider: IMetadataProvider, coAgentId: string): Promise<RealtimePairedAgentRow[]> {\n const id = coAgentId?.trim() ?? '';\n if (id.length === 0) {\n return [];\n }\n try {\n const engine = AIEngineBase.GetProviderInstance<AIEngineBase>(provider, AIEngineBase) as AIEngineBase;\n await engine.Config(false, undefined, provider);\n const rows = (engine.AgentCoAgents ?? [])\n .filter(p =>\n p.Type === 'CoAgent' &&\n p.Status === 'Active' &&\n p.TargetAgentID != null &&\n UUIDsEqual(p.CoAgentID, id))\n .map<RealtimePairedAgentRow>(p => ({\n ID: p.ID,\n CoAgentID: p.CoAgentID,\n TargetAgentID: p.TargetAgentID!,\n TargetAgent: p.TargetAgent ?? null,\n IsDefault: p.IsDefault,\n Sequence: p.Sequence ?? null\n }));\n return SortPairings(rows);\n } catch (error) {\n console.warn('[RealtimePairing] Co-agent pairing lookup unavailable — treating co-agent as universal:', error);\n return [];\n }\n}\n\n/**\n * Returns the pairing rows in canonical display order: `Sequence` ascending (null/missing\n * sequences last), ties broken by target-agent name. Pure; never mutates the input.\n */\nexport function SortPairings(pairings: readonly RealtimePairedAgentRow[]): RealtimePairedAgentRow[] {\n return [...pairings].sort((a, b) => {\n const aSeq = a.Sequence ?? Number.MAX_SAFE_INTEGER;\n const bSeq = b.Sequence ?? Number.MAX_SAFE_INTEGER;\n if (aSeq !== bSeq) {\n return aSeq - bSeq;\n }\n return (a.TargetAgent ?? '').localeCompare(b.TargetAgent ?? '');\n });\n}\n\n/**\n * Applies the pairing constraint to a candidate target-agent list:\n * - ZERO pairing rows → the co-agent is universal; the candidates are returned unchanged\n * (today's flow untouched).\n * - One or more rows → only candidates that appear among the pairing targets are\n * returned, ordered by the pairings' `Sequence`. Paired targets the user can't see /\n * run (absent from `agents`) are silently dropped.\n *\n * Pure and UUID-casing safe (`NormalizeUUID` keys).\n */\nexport function ConstrainTargetsToPairings<T extends RealtimeAgentLike>(\n agents: readonly T[],\n pairings: readonly RealtimePairedAgentRow[]\n): T[] {\n if (!pairings || pairings.length === 0) {\n return [...agents];\n }\n const agentsById = new Map<string, T>();\n for (const agent of agents) {\n agentsById.set(NormalizeUUID(agent.ID), agent);\n }\n const constrained: T[] = [];\n const seen = new Set<string>();\n for (const pairing of SortPairings(pairings)) {\n const key = NormalizeUUID(pairing.TargetAgentID);\n const agent = agentsById.get(key);\n if (agent && !seen.has(key)) {\n seen.add(key);\n constrained.push(agent);\n }\n }\n return constrained;\n}\n\n/**\n * The co-agent's default target from its pairing rows — the first `IsDefault` row in\n * `Sequence` order (server enforces at most one, but the helper stays deterministic\n * regardless). `null` when there are no rows or none is marked default.\n */\nexport function DefaultPairedTargetId(pairings: readonly RealtimePairedAgentRow[]): string | null {\n for (const pairing of SortPairings(pairings ?? [])) {\n if (pairing.IsDefault) {\n return pairing.TargetAgentID;\n }\n }\n return null;\n}\n\n/**\n * Whether the pairing rows permit `targetAgentId` as a target. ZERO rows means the\n * co-agent is universal (always allowed); otherwise the target must appear among the\n * rows. Missing/empty target id is never allowed against a constrained co-agent.\n */\nexport function PairingsAllowTarget(pairings: readonly RealtimePairedAgentRow[], targetAgentId: string | null | undefined): boolean {\n if (!pairings || pairings.length === 0) {\n return true;\n }\n if (!targetAgentId) {\n return false;\n }\n return pairings.some(p => UUIDsEqual(p.TargetAgentID, targetAgentId));\n}\n\n/**\n * Filters an agent list down to ACTIVE Realtime-type **co-agent** candidates. The input\n * is expected to already be the run-permission-filtered active-agent set the host uses\n * for routing/@mentions, so this only applies the agent-TYPE cut (trim +\n * case-insensitive match on the denormalized `Type` name).\n */\nexport function FilterRealtimeCoAgents<T extends { Type: string | null }>(agents: readonly T[]): T[] {\n return agents.filter(a => (a.Type ?? '').trim().toLowerCase() === 'realtime');\n}\n\n/**\n * A selectable realtime model option in the voice picker (narrow read-only projection of\n * `MJ: AI Models` — only the fields the dropdown renders).\n */\nexport interface RealtimeModelOption {\n /** The `MJ: AI Models` row id. */\n ID: string;\n /** The model's display name. */\n Name: string;\n}\n\n/**\n * The minimal `MJ: AI Models` row shape {@link BuildRealtimeModelOptions} consumes —\n * structurally satisfied by `AIEngineBase`'s cached `Models` entities.\n */\nexport interface VoiceModelCandidate {\n /** The `MJ: AI Models` row id. */\n ID: string;\n /** The model's display name. */\n Name: string;\n /** Denormalized model-type name (e.g. 'LLM', 'Realtime'). */\n AIModelType: string | null;\n /** Whether the model is active and selectable. */\n IsActive: boolean;\n}\n\n/**\n * Builds the \"Voice model\" dropdown options from a cached model list: ACTIVE models whose\n * type is `Realtime` (trim + case-insensitive — SQL-collation parity with the previous\n * `IsActive = 1 AND AIModelType = 'Realtime'` filter), projected to {@link RealtimeModelOption}\n * and sorted by Name. Pure; never mutates the input.\n */\nexport function BuildRealtimeModelOptions(models: ReadonlyArray<VoiceModelCandidate>): RealtimeModelOption[] {\n return models\n .filter(m => m.IsActive && (m.AIModelType ?? '').trim().toLowerCase() === 'realtime')\n .map<RealtimeModelOption>(m => ({ ID: m.ID, Name: m.Name }))\n .sort((a, b) => (a.Name ?? '').localeCompare(b.Name ?? ''));\n}\n\n/**\n * Builds the `configOverridesJson` payload for the `StartRealtimeClientSession` mint from\n * what the (authorization-gated) pickers chose — an explicit realtime model preference and/or a\n * per-provider voice. The envelope (`{\"realtime\":{\"modelPreference\":\"<id>\",\"voice\":{\"providers\":\n * {\"openai\":{\"voice\":\"<v>\"}}}}}`) is the pinned server contract, merged into the effective config\n * server-side (highest precedence).\n *\n * @param preferredModelId The explicit `MJ: AI Models` id, or null/empty for none.\n * @param preferredVoice The provider-native voice id (e.g. `echo`), or null/empty for none.\n * @returns The JSON string, or `null` when nothing was overridden (keeps the mint identical to default).\n */\nexport function BuildRealtimeConfigOverridesJson(\n preferredModelId: string | null | undefined,\n preferredVoice?: string | null | undefined,\n): string | null {\n const modelId = preferredModelId?.trim() ?? '';\n const voice = preferredVoice?.trim() ?? '';\n if (modelId.length === 0 && voice.length === 0) {\n return null;\n }\n const realtime: { modelPreference?: string; voice?: { providers: Record<string, { voice: string }> } } = {};\n if (modelId.length > 0) {\n realtime.modelPreference = modelId;\n }\n if (voice.length > 0) {\n // Per-provider voice shape matches GetProviderVoiceSettings; `openai` is the realtime provider today.\n realtime.voice = { providers: { openai: { voice } } };\n }\n return JSON.stringify({ realtime });\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/ng-conversations",
3
- "version": "5.41.0",
3
+ "version": "5.43.0",
4
4
  "description": "MemberJunction: Conversation, Collection, and Artifact management components for any Angular application",
5
5
  "main": "./dist/public-api.js",
6
6
  "typings": "./dist/public-api.d.ts",
@@ -31,31 +31,31 @@
31
31
  "dependencies": {
32
32
  "@angular/animations": "21.1.3",
33
33
  "@angular/cdk": "21.1.3",
34
- "@memberjunction/ai": "5.41.0",
35
- "@memberjunction/ai-agent-client": "5.41.0",
36
- "@memberjunction/ai-core-plus": "5.41.0",
37
- "@memberjunction/ai-engine-base": "5.41.0",
38
- "@memberjunction/ai-realtime-client": "5.41.0",
39
- "@memberjunction/conversations-runtime": "5.41.0",
40
- "@memberjunction/core": "5.41.0",
41
- "@memberjunction/core-entities": "5.41.0",
42
- "@memberjunction/global": "5.41.0",
43
- "@memberjunction/graphql-dataprovider": "5.41.0",
44
- "@memberjunction/interactive-component-types": "5.41.0",
45
- "@memberjunction/ng-agent-client": "5.41.0",
46
- "@memberjunction/ng-artifacts": "5.41.0",
47
- "@memberjunction/ng-base-types": "5.41.0",
48
- "@memberjunction/ng-code-editor": "5.41.0",
49
- "@memberjunction/ng-container-directives": "5.41.0",
50
- "@memberjunction/ng-forms": "5.41.0",
51
- "@memberjunction/ng-markdown": "5.41.0",
52
- "@memberjunction/ng-notifications": "5.41.0",
53
- "@memberjunction/ng-resource-permissions": "5.41.0",
54
- "@memberjunction/ng-shared-generic": "5.41.0",
55
- "@memberjunction/ng-tasks": "5.41.0",
56
- "@memberjunction/ng-testing": "5.41.0",
57
- "@memberjunction/ng-ui-components": "5.41.0",
58
- "@memberjunction/ng-whiteboard": "5.41.0",
34
+ "@memberjunction/ai": "5.43.0",
35
+ "@memberjunction/ai-agent-client": "5.43.0",
36
+ "@memberjunction/ai-core-plus": "5.43.0",
37
+ "@memberjunction/ai-engine-base": "5.43.0",
38
+ "@memberjunction/ai-realtime-client": "5.43.0",
39
+ "@memberjunction/conversations-runtime": "5.43.0",
40
+ "@memberjunction/core": "5.43.0",
41
+ "@memberjunction/core-entities": "5.43.0",
42
+ "@memberjunction/global": "5.43.0",
43
+ "@memberjunction/graphql-dataprovider": "5.43.0",
44
+ "@memberjunction/interactive-component-types": "5.43.0",
45
+ "@memberjunction/ng-agent-client": "5.43.0",
46
+ "@memberjunction/ng-artifacts": "5.43.0",
47
+ "@memberjunction/ng-base-types": "5.43.0",
48
+ "@memberjunction/ng-code-editor": "5.43.0",
49
+ "@memberjunction/ng-container-directives": "5.43.0",
50
+ "@memberjunction/ng-forms": "5.43.0",
51
+ "@memberjunction/ng-markdown": "5.43.0",
52
+ "@memberjunction/ng-notifications": "5.43.0",
53
+ "@memberjunction/ng-resource-permissions": "5.43.0",
54
+ "@memberjunction/ng-shared-generic": "5.43.0",
55
+ "@memberjunction/ng-tasks": "5.43.0",
56
+ "@memberjunction/ng-testing": "5.43.0",
57
+ "@memberjunction/ng-ui-components": "5.43.0",
58
+ "@memberjunction/ng-whiteboard": "5.43.0",
59
59
  "rxjs": "^7.8.2",
60
60
  "tslib": "^2.8.1"
61
61
  },