@memberjunction/ng-conversations 6.1.3 → 6.2.0-edge.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 +1 -1
- package/dist/lib/components/conversation/conversation-chat-area.component.d.ts.map +1 -1
- package/dist/lib/components/conversation/conversation-chat-area.component.js +9 -26
- package/dist/lib/components/conversation/conversation-chat-area.component.js.map +1 -1
- package/dist/lib/components/realtime/channels/channel-onboarding-panel.component.d.ts +1 -1
- package/dist/lib/components/realtime/channels/channel-onboarding-panel.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/channels/channel-onboarding-panel.component.js.map +1 -1
- package/dist/lib/components/realtime/channels/client-context-channel.d.ts +1 -1
- package/dist/lib/components/realtime/channels/client-context-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/channels/client-context-channel.js +1 -1
- package/dist/lib/components/realtime/channels/client-context-channel.js.map +1 -1
- package/dist/lib/components/realtime/channels/realtime-channel-pane.component.d.ts +1 -1
- package/dist/lib/components/realtime/channels/realtime-channel-pane.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/channels/realtime-channel-pane.component.js +3 -0
- package/dist/lib/components/realtime/channels/realtime-channel-pane.component.js.map +1 -1
- package/dist/lib/components/realtime/media/media-channel.d.ts +2 -1
- package/dist/lib/components/realtime/media/media-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/media/media-channel.js +1 -1
- package/dist/lib/components/realtime/media/media-channel.js.map +1 -1
- package/dist/lib/components/realtime/realtime-activity-rail.component.d.ts +1 -1
- package/dist/lib/components/realtime/realtime-activity-rail.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-activity-rail.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-agent-banner.component.d.ts +1 -1
- package/dist/lib/components/realtime/realtime-agent-banner.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-agent-banner.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-composer.component.d.ts +3 -1
- package/dist/lib/components/realtime/realtime-composer.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-composer.component.js +26 -8
- package/dist/lib/components/realtime/realtime-composer.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-delegation-card.component.d.ts +1 -1
- package/dist/lib/components/realtime/realtime-delegation-card.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-delegation-card.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-session-overlay.component.d.ts +2 -2
- package/dist/lib/components/realtime/realtime-session-overlay.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-session-overlay.component.js +1 -1
- package/dist/lib/components/realtime/realtime-session-overlay.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-session-state.d.ts +2 -3
- package/dist/lib/components/realtime/realtime-session-state.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-session-state.js +3 -2
- package/dist/lib/components/realtime/realtime-session-state.js.map +1 -1
- package/dist/lib/components/realtime/realtime-session-thread.component.d.ts +17 -1
- package/dist/lib/components/realtime/realtime-session-thread.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-session-thread.component.js +122 -45
- package/dist/lib/components/realtime/realtime-session-thread.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-session-timeline-card.component.d.ts +1 -9
- package/dist/lib/components/realtime/realtime-session-timeline-card.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-session-timeline-card.component.js +13 -43
- package/dist/lib/components/realtime/realtime-session-timeline-card.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tabs.component.d.ts +2 -2
- package/dist/lib/components/realtime/realtime-surface-tabs.component.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tabs.component.js.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tabs.model.d.ts +1 -1
- package/dist/lib/components/realtime/realtime-surface-tabs.model.d.ts.map +1 -1
- package/dist/lib/components/realtime/realtime-surface-tabs.model.js.map +1 -1
- package/dist/lib/components/realtime/remote-browser/remote-browser-channel.d.ts +1 -1
- package/dist/lib/components/realtime/remote-browser/remote-browser-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/remote-browser/remote-browser-channel.js +1 -1
- package/dist/lib/components/realtime/remote-browser/remote-browser-channel.js.map +1 -1
- package/dist/lib/components/realtime/whiteboard/whiteboard-channel.d.ts +1 -1
- package/dist/lib/components/realtime/whiteboard/whiteboard-channel.d.ts.map +1 -1
- package/dist/lib/components/realtime/whiteboard/whiteboard-channel.js +1 -1
- package/dist/lib/components/realtime/whiteboard/whiteboard-channel.js.map +1 -1
- package/dist/lib/conversations.module.d.ts.map +1 -1
- package/dist/lib/conversations.module.js.map +1 -1
- package/dist/lib/services/browser-realtime-media-host.d.ts +24 -0
- package/dist/lib/services/browser-realtime-media-host.d.ts.map +1 -0
- package/dist/lib/services/browser-realtime-media-host.js +95 -0
- package/dist/lib/services/browser-realtime-media-host.js.map +1 -0
- package/dist/lib/services/conversation-attachment.service.d.ts +24 -2
- package/dist/lib/services/conversation-attachment.service.d.ts.map +1 -1
- package/dist/lib/services/conversation-attachment.service.js +43 -4
- package/dist/lib/services/conversation-attachment.service.js.map +1 -1
- package/dist/lib/services/graphql-attachment-blob-store.d.ts +44 -0
- package/dist/lib/services/graphql-attachment-blob-store.d.ts.map +1 -0
- package/dist/lib/services/graphql-attachment-blob-store.js +113 -0
- package/dist/lib/services/graphql-attachment-blob-store.js.map +1 -0
- package/dist/lib/services/mention-autocomplete.service.d.ts +17 -141
- package/dist/lib/services/mention-autocomplete.service.d.ts.map +1 -1
- package/dist/lib/services/mention-autocomplete.service.js +15 -460
- package/dist/lib/services/mention-autocomplete.service.js.map +1 -1
- package/dist/lib/services/realtime-session-review.service.d.ts +1 -1
- package/dist/lib/services/realtime-session-review.service.d.ts.map +1 -1
- package/dist/lib/services/realtime-session-review.service.js +1 -1
- package/dist/lib/services/realtime-session-review.service.js.map +1 -1
- package/dist/lib/services/realtime-session.service.d.ts +16 -1150
- package/dist/lib/services/realtime-session.service.d.ts.map +1 -1
- package/dist/lib/services/realtime-session.service.js +28 -2430
- package/dist/lib/services/realtime-session.service.js.map +1 -1
- package/dist/lib/utils/realtime-session-timeline.d.ts +8 -79
- package/dist/lib/utils/realtime-session-timeline.d.ts.map +1 -1
- package/dist/lib/utils/realtime-session-timeline.js +8 -89
- package/dist/lib/utils/realtime-session-timeline.js.map +1 -1
- package/dist/public-api.d.ts +2 -2
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +6 -2
- package/dist/public-api.js.map +1 -1
- package/package.json +33 -32
- package/dist/lib/components/realtime/channels/base-realtime-channel-client.d.ts +0 -384
- package/dist/lib/components/realtime/channels/base-realtime-channel-client.d.ts.map +0 -1
- package/dist/lib/components/realtime/channels/base-realtime-channel-client.js +0 -231
- package/dist/lib/components/realtime/channels/base-realtime-channel-client.js.map +0 -1
- package/dist/lib/services/delegation-result-parser.d.ts +0 -50
- package/dist/lib/services/delegation-result-parser.d.ts.map +0 -1
- package/dist/lib/services/delegation-result-parser.js +0 -60
- package/dist/lib/services/delegation-result-parser.js.map +0 -1
- package/dist/lib/services/narration-template.d.ts +0 -42
- package/dist/lib/services/narration-template.d.ts.map +0 -1
- package/dist/lib/services/narration-template.js +0 -73
- package/dist/lib/services/narration-template.js.map +0 -1
- package/dist/lib/services/skill-picker-narrowing.d.ts +0 -13
- package/dist/lib/services/skill-picker-narrowing.d.ts.map +0 -1
- package/dist/lib/services/skill-picker-narrowing.js +0 -13
- package/dist/lib/services/skill-picker-narrowing.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base-realtime-channel-client.js","sourceRoot":"","sources":["../../../../../src/lib/components/realtime/channels/base-realtime-channel-client.ts"],"names":[],"mappings":"AA+KA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,OAAgB,yBAAyB;IAC7C;;;OAGG;IACO,OAAO,GAAkC,IAAI,CAAC;IAsBxD;;;;;;OAMG;IACH,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IAoBD;;;;;;;;;;;;;OAaG;IACI,mBAAmB;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;OAKG;IACI,UAAU;QACf,OAAO,IAAI,CAAC,mBAAmB,EAAE,IAAI,IAAI,CAAC;IAC5C,CAAC;IAED;;;;;;;;;;OAUG;IACI,oBAAoB;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAYD;;;;;OAKG;IACI,aAAa;QAClB,8BAA8B;IAChC,CAAC;IAED;;;;OAIG;IACI,UAAU,CAAC,GAA2B;QAC3C,IAAI,CAAC,OAAO,GAAG,GAAG,CAAC;QACnB,IAAI,CAAC,YAAY,EAAE,CAAC;IACtB,CAAC;IAED;;;;OAIG;IACO,YAAY;QACpB,iCAAiC;IACnC,CAAC;IAED;;;;;OAKG;IACI,gBAAgB;QACrB,yBAAyB;IAC3B,CAAC;IAED;;;;OAIG;IACO,sBAAsB,GAAG,IAAI,CAAC;IAC9B,uBAAuB,GAAG,GAAG,CAAC;IAExC;;;;;;;;;;;;;OAaG;IACO,KAAK,CAAC,qBAAqB;QACnC,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,EAAE,cAAc,IAAI,IAAI,CAAC;QACvD,IAAI,SAAS,EAAE,CAAC;YACd,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,uBAAuB,CAAC,CAAC;QAC7D,KAAK,IAAI,MAAM,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC,sBAAsB,EAAE,MAAM,IAAI,UAAU,EAAE,CAAC;YAChF,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;YACtE,sEAAsE;YACtE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;gBAClB,OAAO,IAAI,CAAC;YACd,CAAC;YACD,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;YACvC,IAAI,EAAE,EAAE,CAAC;gBACP,OAAO,EAAE,CAAC;YACZ,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC,OAAO,EAAE,cAAc,IAAI,IAAI,CAAC;IAC9C,CAAC;IAED;;;;OAIG;IACI,cAAc;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;;;;;;;;;OAUG;IACI,YAAY,CAAC,SAAiB;QACnC,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;OAKG;IACI,gBAAgB;QACrB,oDAAoD;IACtD,CAAC;IAED;;;OAGG;IACI,gBAAgB;QACrB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED;;;OAGG;IACI,aAAa;QAClB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED;;;;;OAKG;IACI,OAAO;QACZ,IAAI,CAAC,aAAa,EAAE,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;IACtB,CAAC;CACF","sourcesContent":["import type { Type } from '@angular/core';\nimport type { Observable } from 'rxjs';\nimport { IMetadataProvider } from '@memberjunction/core';\nimport { JSONValue, RealtimeToolDefinition, RealtimeTrackDescriptor, RealtimeTrackDirection } from '@memberjunction/ai';\nimport type { BaseRealtimeClient } from '@memberjunction/ai-realtime-client';\nimport type { AppContextSnapshot } from '@memberjunction/ai-core-plus';\n\n/**\n * Host services handed to a {@link BaseRealtimeChannelClient} at {@link BaseRealtimeChannelClient.Initialize}.\n *\n * The context is the plugin's ONLY line back to the live session — channels never talk to\n * `RealtimeSessionService` (or any host component) directly, which is what keeps them drop-in\n * plugins. Every member is host-implemented:\n *\n * - the SESSION SERVICE supplies {@link SendContextNote} (perception feed into the live\n * model), {@link RequestSave} (debounced state-of-record persistence onto the session's\n * `MJ: AI Agent Session Channels` row) and {@link AgentName};\n * - the OVERLAY SHELL wires {@link SetFocusMode} (through the service's focus stream) so a\n * channel surface can request the focus layout — main call column collapsed, surface\n * panel filling the overlay, floating call pill riding on top.\n */\nexport interface RealtimeChannelContext {\n /** Display name of the agent the live session fronts (e.g. `\"Sage\"`), fixed at session start. */\n AgentName: string;\n\n /**\n * The MJ metadata provider the live session runs on — the SAME `IMetadataProvider` instance that\n * authenticates the session (NOT necessarily the global default). A channel whose surface renders\n * MemberJunction-backed data (e.g. the Media channel streaming an `MJ: Files` record through\n * `mj-storage-media-player`) threads THIS provider into its surface / GraphQL calls so it stays\n * multi-provider safe. `null` only in degenerate/early states; channels fall back to the global\n * default when absent.\n */\n Provider: IMetadataProvider | null;\n\n /**\n * Feeds a background context note into the live realtime model (no spoken reply is\n * requested) — the PERCEPTION direction of the channel: serialized state deltas flow here\n * so the agent stays aware of what's on the surface. No-op when the session isn't live.\n */\n SendContextNote(text: string): void;\n\n /**\n * Asks the host to persist `stateJson` as this channel's state of record. The host\n * DEBOUNCES (a change burst becomes one save) and flushes any pending save at session\n * teardown — the plugin just calls this on every state mutation and never schedules\n * timers itself. Best-effort: persistence failures are logged host-side, never thrown.\n */\n RequestSave(stateJson: string): void;\n\n /**\n * Requests (or releases) the FOCUS layout for this channel's surface: the overlay\n * collapses the main call column so the surface owns the screen, with a compact floating\n * call pill keeping mute / thread / end reachable. Any channel may request it; the host\n * tracks which channel holds focus and routes the pill's \"exit\" back to it via\n * {@link BaseRealtimeChannelClient.RequestFocusExit}.\n */\n SetFocusMode(on: boolean): void;\n\n /**\n * Asks the live model to SPEAK a response to the supplied instructions RIGHT NOW —\n * the channel's \"react to this\" path, e.g. a widget submission the user expects an\n * audible reaction to ({@link SendContextNote} deliberately never triggers speech).\n * Rides the realtime client's spoken-update channel, so on some providers the spoken\n * reply is narration-kind (ephemeral, not persisted as a caption). OPTIONAL member:\n * older host contexts may not supply it — plugins must call it null-safely.\n */\n RequestSpokenResponse?(instructions: string): void;\n\n /**\n * Persists a snapshot of the channel's state as a first-class versioned artifact\n * (`MJ: Artifacts` + version, linked into conversation history when possible) — e.g. the\n * whiteboard's \"Save to artifacts\". Distinct from {@link RealtimeChannelContext.RequestSave},\n * which maintains the session's rolling state of record. Best-effort: resolves to the\n * created Artifact ID, or `null` on failure (logged host-side, never thrown). Works during\n * the call AND right after it ends (the host retains the session id for late saves).\n */\n SaveAsArtifact(name: string, contentJson: string): Promise<string | null>;\n\n /**\n * The live `MJ: AI Agent Sessions` id this channel belongs to, or `null` before the\n * session has minted / after it has torn down. A channel whose tools or surface drive a\n * SERVER-SIDE resource (e.g. the Remote Browser channel's server-hosted browser) passes\n * this as the `agentSessionID` argument to its own GraphQL resolvers via\n * {@link ExecuteServerAction}. Most channels (whiteboard, shared doc) keep all state\n * client-side and never read it.\n */\n AgentSessionID: string | null;\n\n /**\n * Executes a CHANNEL-SPECIFIC GraphQL operation against the session's MJ server — the\n * escape hatch for channels backed by a SERVER-SIDE resource that the generic\n * {@link RequestSave} / {@link SaveAsArtifact} contract doesn't cover (e.g. the Remote\n * Browser channel driving a server-hosted browser through its own\n * `ExecuteRemoteBrowserAction` mutation + `RemoteBrowserSnapshot` query).\n *\n * The host runs the operation through the SAME provider the live session uses, so the\n * request rides the authenticated session. Best-effort and tolerant: a transport or\n * server error resolves to `null` (logged host-side) rather than throwing, so a channel\n * can map the failure to a model-readable result string without `try/catch`.\n *\n * @typeParam TResult The expected shape of the GraphQL operation's data payload.\n * @param query The GraphQL query/mutation document.\n * @param variables The operation variables (all JSON-serializable).\n * @returns The operation's `data` payload, or `null` on any failure / when no session is live.\n */\n ExecuteServerAction<TResult>(query: string, variables: Record<string, JSONValue>): Promise<TResult | null>;\n\n /**\n * OPTIONAL — the live app-context stream (where the user is, what they see, and the available\n * client-tool + agent manifest), pushed by the host (Explorer) at session start and on subsequent\n * changes. The headless `ClientContextChannel` subscribes to this and streams deltas to the model\n * via {@link SendContextNote}. Absent on hosts that don't supply app context (e.g. custom apps);\n * channels must read it null-safely.\n */\n AppContext$?: Observable<AppContextSnapshot | null>;\n\n /**\n * OPTIONAL — executes a host-registered surface CLIENT TOOL by name (the handlers the host wired\n * from the active surface's `SetAgentClientTools`). The headless `ClientContextChannel`'s\n * `ContextTool` proxy routes the model's `{ action, params }` here so a surface tool runs in the\n * browser with no server round-trip. Best-effort and tolerant — resolves to a structured result\n * (never throws); `Success: false` for an unknown tool or a thrown handler. Absent on hosts that\n * register no client tools.\n *\n * @param name The client-tool name (the model's `action`).\n * @param params The tool parameters (the model's `params`).\n * @returns A structured result the channel serializes back to the model.\n */\n ExecuteClientTool?(\n name: string,\n params: Record<string, unknown>\n ): Promise<{ Success: boolean; Result?: unknown; ErrorMessage?: string }>;\n\n /**\n * OPTIONAL — sends a visual frame into the live session's inbound video track\n * (e.g. from Whiteboard or Remote Browser video bridges). No-op when the session\n * has not established an inbound video track or is not live.\n *\n * @param base64Image The image data (base64-encoded JPEG/PNG).\n * @param mimeType The image MIME type (defaults to 'image/jpeg').\n */\n SendVideoFrame?(base64Image: string, mimeType?: string): void;\n\n /**\n * OPTIONAL — checks whether a media track is currently established on the live session.\n */\n IsTrackEstablished?(modality: string, direction: RealtimeTrackDirection): boolean;\n\n /**\n * OPTIONAL — the underlying {@link BaseRealtimeClient} driving the media and transport planes.\n */\n Client?: BaseRealtimeClient | null;\n}\n\n/**\n * The first-run INTRO content for an interactive channel — the concise \"what is this surface\n * and how do I use it\" copy the overlay shows the very first time a user opens this channel's\n * tab (persisted \"seen\" per user, so it's shown ONCE per channel per user).\n *\n * A channel opts in by overriding {@link BaseRealtimeChannelClient.GetOnboardingDetails}; the\n * default returns `null`, so the base Voice/text channel (which has no plugin at all) AND any\n * plugin that doesn't override it show nothing.\n */\nexport interface ChannelOnboardingDetails {\n /** Short title, usually the surface name (e.g. `\"Whiteboard\"`). */\n Heading: string;\n /** One or two sentences: what the surface is and what the user can expect to see on it. */\n Description: string;\n /** Optional quick-tip bullets (kept to 2-3 short, scannable lines). */\n Tips?: string[];\n /** Optional Font Awesome icon class for the intro panel (e.g. `'fa-solid fa-chalkboard'`). */\n IconClass?: string;\n}\n\n/**\n * Base class for CLIENT-SIDE interactive-channel plugins (per\n * `plans/ai-agent-sessions.md` → \"Interactive Channels\" / \"Pluggable Channel Interfaces\").\n *\n * An interactive channel is a bidirectional surface the session's single realtime agent\n * both PERCEIVES and ACTS UPON (whiteboard, shared doc, map, …). A concrete plugin\n * contributes everything the channel needs, so the session service / call overlay carry\n * ZERO channel-specific wiring:\n *\n * 1. a CLIENT-EXECUTED TOOL SET ({@link GetToolDefinitions}, declared to the realtime\n * model at session mint) plus the local executor ({@link ApplyAgentTool}) the host\n * routes `{@link ToolNamePrefix}*` calls to — the ACTION direction;\n * 2. a STATE→CONTEXT SERIALIZER policy — the plugin owns its state engine and pushes\n * coalesced deltas through {@link RealtimeChannelContext.SendContextNote} — the\n * PERCEPTION direction;\n * 3. an OPTIONAL ANGULAR SURFACE ({@link GetSurfaceComponent}) the overlay creates dynamically\n * in a channel tab, handed back through {@link BindSurface} so the plugin wires its own\n * inputs/outputs (the host never knows the component's API). A channel may be **server-only**\n * (no rendered surface) — e.g. a bridge-contributed meeting-controls or native-whiteboard\n * channel whose surface lives on the external platform, not in MJ. Such a channel returns\n * `null` from {@link GetSurfaceComponent} ({@link HasSurface} is `false`) and the overlay\n * simply skips its tab while still wiring its tools + perception;\n * 4. a STATE OF RECORD ({@link SerializeState}, persisted via\n * {@link RealtimeChannelContext.RequestSave} under {@link ChannelName}).\n *\n * ### Registration & resolution (mirrors the realtime model drivers)\n * Concrete plugins are `@RegisterClass(BaseRealtimeChannelClient, '<ClientPluginClass>')`\n * and are resolved at session start from the `MJ: AI Agent Channels` registry: each ACTIVE\n * row's `ClientPluginClass` is the ClassFactory key (exactly how `BaseRealtimeClient`\n * drivers resolve by provider key). Ship a `Load<YourChannel>()` no-op alongside the class\n * and call it from a static code path to defeat tree-shaking.\n *\n * ### Lifecycle — ONE INSTANCE PER SESSION (not a singleton)\n * `ClassFactory.CreateInstance` → {@link Initialize}(ctx) → zero or more\n * {@link BindSurface}/{@link UnbindSurface} cycles (the surface pane is created/destroyed\n * with the overlay's tab panel, e.g. collapse/expand) → {@link Dispose} at teardown.\n * {@link ApplyAgentTool} MUST work with NO surface bound (apply to the state engine\n * directly; skip the UI garnish) — tool calls can arrive while the panel is collapsed.\n *\n * @typeParam TSurface The plugin's Angular surface component type. The host only ever\n * sees the default (`object`) — the typed parameter exists so concrete plugins get a\n * fully typed {@link BindSurface} without casts.\n */\nexport abstract class BaseRealtimeChannelClient<TSurface extends object = object> {\n /**\n * The host context, available from {@link Initialize} until {@link Dispose}.\n * `null` outside that window — guard with `?.` in any code that can run early/late.\n */\n protected Context: RealtimeChannelContext | null = null;\n\n /**\n * The channel definition name — MUST match the `MJ: AI Agent Channels` row's `Name`\n * (e.g. `'Whiteboard'`). Used as the persistence key for {@link SerializeState} saves\n * and as the channel tab's stable key.\n */\n public abstract get ChannelName(): string;\n\n /**\n * The shared name prefix of every tool this channel exposes (e.g. `'Whiteboard_'`).\n * The host registers ONE local-execution route per plugin: tool calls whose name starts\n * with this prefix go to {@link ApplyAgentTool} instead of the server relay.\n */\n public abstract get ToolNamePrefix(): string;\n\n /** Label for the channel's tab on the overlay's surface panel (e.g. `'Whiteboard'`). */\n public abstract get TabTitle(): string;\n\n /** Font Awesome icon class for the channel's tab (e.g. `'fa-solid fa-chalkboard'`). */\n public abstract get TabIcon(): string;\n\n /**\n * OPTIONAL accent color for the channel's tab (a CSS color string, e.g. an `hsl()` /\n * token). When a plugin supplies one, the overlay paints the tab's dot + active underline\n * with it; when omitted (the default `null`), the overlay derives a stable, deterministic\n * color from the {@link ChannelName} so every channel still reads as a distinct, colored\n * surface. A channel only overrides this to enforce a specific brand accent.\n */\n public get TabColor(): string | null {\n return null;\n }\n\n /**\n * The channel's CLIENT-EXECUTED tool declarations, aggregated by the session service\n * into the `clientTools` set declared to the realtime model at session mint. The server\n * only DECLARES these — execution stays in the browser via {@link ApplyAgentTool}.\n */\n public abstract GetToolDefinitions(): RealtimeToolDefinition[];\n\n /**\n * Executes ONE agent tool call locally (the ACTION direction) and returns the result\n * JSON string fed back to the model as the `tool_response`. Called for every tool whose\n * name starts with {@link ToolNamePrefix}. Must work both WITH a bound surface (apply +\n * UI garnish) and WITHOUT one (apply to the state engine directly — the tab pane may not\n * exist, e.g. the surface panel is collapsed). Should not throw: return a\n * `{ success: false, error }` payload so the model can narrate the failure (the host\n * additionally wraps anything thrown).\n */\n public abstract ApplyAgentTool(toolName: string, argsJson: string): string | Promise<string>;\n\n /**\n * The Angular component the overlay creates dynamically as this channel's tab pane, or `null`\n * for a **server-only** channel that renders no MJ surface (its surface, if any, lives on the\n * external platform — e.g. a bridge-contributed native whiteboard or meeting-controls channel).\n *\n * When this returns `null`, the overlay renders NO tab for the channel and never calls\n * {@link BindSurface}/{@link UnbindSurface} — but the channel's tools ({@link GetToolDefinitions} /\n * {@link ApplyAgentTool}) and perception ({@link RealtimeChannelContext.SendContextNote}) still run.\n * A created surface instance is handed straight back via {@link BindSurface}; the host treats it as\n * opaque.\n *\n * Default: `null` (server-only). A channel with a rendered surface overrides this to return its\n * component type.\n */\n public GetSurfaceComponent(): Type<TSurface> | null {\n return null;\n }\n\n /**\n * Whether this channel has a rendered MJ surface ({@link GetSurfaceComponent} returns non-null).\n * The overlay uses this to decide whether to register a surface tab; server-only channels are\n * `false`. Override only if surface availability must be decided WITHOUT constructing the type\n * (the default calls {@link GetSurfaceComponent} once).\n */\n public HasSurface(): boolean {\n return this.GetSurfaceComponent() != null;\n }\n\n /**\n * The channel's FIRST-RUN INTRO content, or `null` when the channel offers no onboarding.\n * The overlay shows this once per channel per user — the first time the user opens this\n * channel's surface tab — and remembers \"seen\" via the user's settings (NOT localStorage),\n * so it never re-appears on later sessions or other devices.\n *\n * Default: `null` (no intro). The base Voice/text channel has no plugin at all, so it never\n * shows an intro; an interactive channel with a surface worth explaining (whiteboard, remote\n * browser, …) overrides this to return its {@link ChannelOnboardingDetails}. A plugin that\n * doesn't override it simply shows nothing — onboarding is strictly opt-in.\n */\n public GetOnboardingDetails(): ChannelOnboardingDetails | null {\n return null;\n }\n\n /**\n * Called by the host right after it created the surface component (and BEFORE the\n * component's first change detection, so inputs set here are visible in its `ngOnInit`).\n * The plugin — which knows its own component type — sets inputs (state engine, agent\n * name, …) and subscribes outputs here, wiring perception/garnish flows back through\n * {@link Context}. May be called again with a NEW instance after an\n * {@link UnbindSurface} (the pane is destroyed/recreated with the tab panel).\n */\n public abstract BindSurface(instance: TSurface): void;\n\n /**\n * Called by the host when the surface component is being destroyed (tab panel\n * collapsed / overlay torn down). Drop the instance reference and unsubscribe any\n * output subscriptions — after this, {@link ApplyAgentTool} runs in its no-surface\n * mode. Default: no-op.\n */\n public UnbindSurface(): void {\n // default: nothing to release\n }\n\n /**\n * Binds the host context and invokes the {@link OnInitialize} hook. Called exactly once\n * per session, right after ClassFactory instantiation and before any tool call or\n * surface bind.\n */\n public Initialize(ctx: RealtimeChannelContext): void {\n this.Context = ctx;\n this.OnInitialize();\n }\n\n /**\n * Subclass hook invoked from {@link Initialize} once {@link Context} is bound — wire\n * state-engine subscriptions (e.g. state change → `Context.RequestSave(...)`) here.\n * Default: no-op.\n */\n protected OnInitialize(): void {\n // default: nothing to initialize\n }\n\n /**\n * Subclass hook invoked once the realtime session is connected and live (the client driver\n * is created, connected, and media tracks negotiated). Channels that establish media bridges\n * (e.g. video streaming) can start them here when `Context.Client` is available.\n * Default: no-op.\n */\n public OnSessionStarted(): void {\n // default: nothing to do\n }\n\n /**\n * Max time {@link ResolveAgentSessionId} waits for the session id to bind before giving up, and the\n * poll interval it re-checks on. Protected so tests can shrink the wait; production keeps the\n * defaults (the real mint race is sub-second, 8s is generous headroom).\n */\n protected SessionIdWaitTimeoutMs = 8000;\n protected SessionIdWaitIntervalMs = 200;\n\n /**\n * Resolves the live {@link RealtimeChannelContext.AgentSessionID}, briefly WAITING for it when it\n * isn't bound yet rather than giving up instantly. `AgentSessionID` is a live getter over the\n * session service's current id: it reads `null` in the window BEFORE the session mints (the\n * realtime model can fire a tool call the very first beat it connects, before `mintSession`\n * resolves) and again AFTER teardown. Server-backed tool paths (e.g. the Remote Browser channel's\n * `browser_*` tools) call this instead of reading `Context?.AgentSessionID` synchronously, so a tool\n * invoked a beat early WAITS for the session to come live — defense-in-depth against the\n * \"session id missing\" race — instead of returning a hard failure to the model.\n *\n * Returns the id as soon as it's non-null (the common path resolves immediately, no delay), or\n * `null` if it's still unbound after {@link SessionIdWaitTimeoutMs} — or the channel was\n * {@link Dispose}d in the meantime (`Context` goes null, so we stop waiting on a torn-down session).\n */\n protected async ResolveAgentSessionId(): Promise<string | null> {\n const immediate = this.Context?.AgentSessionID ?? null;\n if (immediate) {\n return immediate;\n }\n const intervalMs = Math.max(1, this.SessionIdWaitIntervalMs);\n for (let waited = 0; waited < this.SessionIdWaitTimeoutMs; waited += intervalMs) {\n await new Promise<void>((resolve) => setTimeout(resolve, intervalMs));\n // Context goes null on Dispose() — the session is gone, stop waiting.\n if (!this.Context) {\n return null;\n }\n const id = this.Context.AgentSessionID;\n if (id) {\n return id;\n }\n }\n return this.Context?.AgentSessionID ?? null;\n }\n\n /**\n * Serializes the channel's current state of record (the payload persisted on the\n * session's channel row), or `null` when the channel keeps no persistent state.\n * Default: `null`.\n */\n public SerializeState(): string | null {\n return null;\n }\n\n /**\n * Restores a PRIOR session's saved channel state (the payload a previous session\n * persisted via {@link SerializeState} / {@link RealtimeChannelContext.RequestSave}).\n * Invoked by the session host AFTER {@link Initialize} and BEFORE any surface binding,\n * when a prior session's saved state exists for this channel.\n *\n * Returns `true` when the state was applied; `false` when the channel ignored it —\n * either because it keeps no persistent state (this default) or because the payload was\n * malformed/incompatible. Implementations MUST be tolerant: never throw on bad input,\n * just return `false` and start fresh.\n */\n public RestoreState(stateJson: string): boolean {\n return false;\n }\n\n /**\n * The focus pill's \"exit\" affordance, routed by the overlay to the channel that holds\n * focus. Implementations should leave focus mode through their OWN surface (so surface\n * toggles stay in sync), ultimately emitting `Context.SetFocusMode(false)`. The overlay\n * defensively clears its layout flag as well, so a no-op default is safe.\n */\n public RequestFocusExit(): void {\n // default: the overlay's defensive clear handles it\n }\n\n /**\n * Media tracks this client channel can SOURCE — samples flowing into the model.\n * Default `[]`.\n */\n public GetSourcedTracks(): readonly RealtimeTrackDescriptor[] {\n return [];\n }\n\n /**\n * Media tracks this client channel can SINK — samples flowing from the model OUT.\n * Default `[]`.\n */\n public GetSunkTracks(): readonly RealtimeTrackDescriptor[] {\n return [];\n }\n\n /**\n * Tears the plugin down at session end: release the surface binding, unsubscribe\n * state-engine subscriptions, then drop the context. Subclasses overriding this MUST\n * call `super.Dispose()`. Any final state save has already been flushed by the host\n * (the debounced {@link RealtimeChannelContext.RequestSave} pipeline) before disposal.\n */\n public Dispose(): void {\n this.UnbindSurface();\n this.Context = null;\n }\n}\n"]}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pure parsing of the serialized realtime tool result (`ResultJson`) the server's
|
|
3
|
-
* `RealtimeToolBroker` produces — `{ success, output, runId?, artifacts? }` on success or
|
|
4
|
-
* `{ success: false, error }` on failure. Kept framework-free (no Angular / GraphQL
|
|
5
|
-
* imports) so it is unit-testable in isolation and the {@link RealtimeSessionService}
|
|
6
|
-
* stays focused on session orchestration.
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* One artifact a delegated run produced, as reported in the tool ResultJson
|
|
10
|
-
* (`artifacts: [{ artifactId, artifactVersionId, name }]`). The call overlay opens each
|
|
11
|
-
* in its own artifact tab on the tabbed surface panel.
|
|
12
|
-
*/
|
|
13
|
-
export interface ParsedDelegationArtifact {
|
|
14
|
-
/** The `MJ: Artifacts` row id. */
|
|
15
|
-
ArtifactID: string;
|
|
16
|
-
/** The `MJ: Artifact Versions` row id of the version the run produced. */
|
|
17
|
-
ArtifactVersionID: string;
|
|
18
|
-
/** The artifact's display name (used as the tab title). */
|
|
19
|
-
Name: string;
|
|
20
|
-
}
|
|
21
|
-
/** The normalized shape a tool ResultJson parses into. */
|
|
22
|
-
export interface ParsedDelegationResult {
|
|
23
|
-
/** Whether the delegated work succeeded (`success !== false`; non-JSON payloads default to true). */
|
|
24
|
-
Success: boolean;
|
|
25
|
-
/** The result text — the agent's output, or the structured error message on failure. */
|
|
26
|
-
Output: string;
|
|
27
|
-
/**
|
|
28
|
-
* ID of the delegated agent run (`MJ: AI Agent Runs`) when the server reported one
|
|
29
|
-
* (`runId` in the JSON). Lets developer tooling link straight to the run record.
|
|
30
|
-
*/
|
|
31
|
-
RunID?: string;
|
|
32
|
-
/**
|
|
33
|
-
* Artifacts the delegated run produced, when the server reported any (`artifacts` in
|
|
34
|
-
* the JSON). Drives the overlay's auto-opened artifact tabs. `undefined` when absent,
|
|
35
|
-
* empty, or malformed.
|
|
36
|
-
*/
|
|
37
|
-
Artifacts?: ParsedDelegationArtifact[];
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Parses the broker's `{success, output, runId, artifacts}` | `{success:false, error}` ResultJson.
|
|
41
|
-
* If the payload isn't JSON, the raw string is surfaced as the output (success assumed) —
|
|
42
|
-
* mirroring the spoken path, which feeds whatever came back to the model verbatim.
|
|
43
|
-
*/
|
|
44
|
-
export declare function ParseDelegationResultJson(resultJson: string): ParsedDelegationResult;
|
|
45
|
-
/**
|
|
46
|
-
* Convert snake_case or colon-delimited tool names (e.g. `File_Storage_List_Objects` or `File Storage: List Objects`)
|
|
47
|
-
* to a clean human-readable title (e.g. `File Storage List Objects`).
|
|
48
|
-
*/
|
|
49
|
-
export declare function FormatToolName(toolName?: string): string;
|
|
50
|
-
//# sourceMappingURL=delegation-result-parser.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"delegation-result-parser.d.ts","sourceRoot":"","sources":["../../../src/lib/services/delegation-result-parser.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACvC,kCAAkC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,0EAA0E;IAC1E,iBAAiB,EAAE,MAAM,CAAC;IAC1B,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;CACd;AAED,0DAA0D;AAC1D,MAAM,WAAW,sBAAsB;IACrC,qGAAqG;IACrG,OAAO,EAAE,OAAO,CAAC;IACjB,wFAAwF;IACxF,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,SAAS,CAAC,EAAE,wBAAwB,EAAE,CAAC;CACxC;AASD;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,sBAAsB,CAkBpF;AAwBD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAMxD"}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pure parsing of the serialized realtime tool result (`ResultJson`) the server's
|
|
3
|
-
* `RealtimeToolBroker` produces — `{ success, output, runId?, artifacts? }` on success or
|
|
4
|
-
* `{ success: false, error }` on failure. Kept framework-free (no Angular / GraphQL
|
|
5
|
-
* imports) so it is unit-testable in isolation and the {@link RealtimeSessionService}
|
|
6
|
-
* stays focused on session orchestration.
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Parses the broker's `{success, output, runId, artifacts}` | `{success:false, error}` ResultJson.
|
|
10
|
-
* If the payload isn't JSON, the raw string is surfaced as the output (success assumed) —
|
|
11
|
-
* mirroring the spoken path, which feeds whatever came back to the model verbatim.
|
|
12
|
-
*/
|
|
13
|
-
export function ParseDelegationResultJson(resultJson) {
|
|
14
|
-
try {
|
|
15
|
-
const parsed = JSON.parse(resultJson);
|
|
16
|
-
return {
|
|
17
|
-
Success: parsed.success !== false,
|
|
18
|
-
Output: parsed.output ?? parsed.error ?? '',
|
|
19
|
-
RunID: typeof parsed.runId === 'string' && parsed.runId.length > 0 ? parsed.runId : undefined,
|
|
20
|
-
Artifacts: parseArtifacts(parsed.artifacts)
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
catch {
|
|
24
|
-
return { Success: true, Output: resultJson };
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Normalizes the raw `artifacts` array: entries must carry non-empty `artifactId` and
|
|
29
|
-
* `artifactVersionId` strings (malformed entries are dropped); a missing/blank `name`
|
|
30
|
-
* falls back to `"Artifact"`. Returns `undefined` when nothing valid remains.
|
|
31
|
-
*/
|
|
32
|
-
function parseArtifacts(raw) {
|
|
33
|
-
if (!Array.isArray(raw)) {
|
|
34
|
-
return undefined;
|
|
35
|
-
}
|
|
36
|
-
const artifacts = [];
|
|
37
|
-
for (const entry of raw) {
|
|
38
|
-
const artifactId = typeof entry?.artifactId === 'string' ? entry.artifactId : '';
|
|
39
|
-
const versionId = typeof entry?.artifactVersionId === 'string' ? entry.artifactVersionId : '';
|
|
40
|
-
if (artifactId.length === 0 || versionId.length === 0) {
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
const name = typeof entry.name === 'string' && entry.name.trim().length > 0 ? entry.name.trim() : 'Artifact';
|
|
44
|
-
artifacts.push({ ArtifactID: artifactId, ArtifactVersionID: versionId, Name: name });
|
|
45
|
-
}
|
|
46
|
-
return artifacts.length > 0 ? artifacts : undefined;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Convert snake_case or colon-delimited tool names (e.g. `File_Storage_List_Objects` or `File Storage: List Objects`)
|
|
50
|
-
* to a clean human-readable title (e.g. `File Storage List Objects`).
|
|
51
|
-
*/
|
|
52
|
-
export function FormatToolName(toolName) {
|
|
53
|
-
if (!toolName)
|
|
54
|
-
return 'Action';
|
|
55
|
-
return toolName
|
|
56
|
-
.replace(/[_\-:]+/g, ' ')
|
|
57
|
-
.replace(/\s+/g, ' ')
|
|
58
|
-
.trim();
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=delegation-result-parser.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"delegation-result-parser.js","sourceRoot":"","sources":["../../../src/lib/services/delegation-result-parser.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA0CH;;;;GAIG;AACH,MAAM,UAAU,yBAAyB,CAAC,UAAkB;IAC1D,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAMnC,CAAC;QACF,OAAO;YACL,OAAO,EAAE,MAAM,CAAC,OAAO,KAAK,KAAK;YACjC,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,KAAK,IAAI,EAAE;YAC3C,KAAK,EAAE,OAAO,MAAM,CAAC,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;YAC7F,SAAS,EAAE,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC;SAC5C,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;IAC/C,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,SAAS,cAAc,CAAC,GAAY;IAClC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACxB,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,SAAS,GAA+B,EAAE,CAAC;IACjD,KAAK,MAAM,KAAK,IAAI,GAA8B,EAAE,CAAC;QACnD,MAAM,UAAU,GAAG,OAAO,KAAK,EAAE,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC;QACjF,MAAM,SAAS,GAAG,OAAO,KAAK,EAAE,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9F,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtD,SAAS;QACX,CAAC;QACD,MAAM,IAAI,GAAG,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC;QAC7G,SAAS,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,iBAAiB,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IACvF,CAAC;IACD,OAAO,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;AACtD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,QAAiB;IAC9C,IAAI,CAAC,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAC/B,OAAO,QAAQ;SACZ,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC;SACxB,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,IAAI,EAAE,CAAC;AACZ,CAAC","sourcesContent":["/**\n * Pure parsing of the serialized realtime tool result (`ResultJson`) the server's\n * `RealtimeToolBroker` produces — `{ success, output, runId?, artifacts? }` on success or\n * `{ success: false, error }` on failure. Kept framework-free (no Angular / GraphQL\n * imports) so it is unit-testable in isolation and the {@link RealtimeSessionService}\n * stays focused on session orchestration.\n */\n\n/**\n * One artifact a delegated run produced, as reported in the tool ResultJson\n * (`artifacts: [{ artifactId, artifactVersionId, name }]`). The call overlay opens each\n * in its own artifact tab on the tabbed surface panel.\n */\nexport interface ParsedDelegationArtifact {\n /** The `MJ: Artifacts` row id. */\n ArtifactID: string;\n /** The `MJ: Artifact Versions` row id of the version the run produced. */\n ArtifactVersionID: string;\n /** The artifact's display name (used as the tab title). */\n Name: string;\n}\n\n/** The normalized shape a tool ResultJson parses into. */\nexport interface ParsedDelegationResult {\n /** Whether the delegated work succeeded (`success !== false`; non-JSON payloads default to true). */\n Success: boolean;\n /** The result text — the agent's output, or the structured error message on failure. */\n Output: string;\n /**\n * ID of the delegated agent run (`MJ: AI Agent Runs`) when the server reported one\n * (`runId` in the JSON). Lets developer tooling link straight to the run record.\n */\n RunID?: string;\n /**\n * Artifacts the delegated run produced, when the server reported any (`artifacts` in\n * the JSON). Drives the overlay's auto-opened artifact tabs. `undefined` when absent,\n * empty, or malformed.\n */\n Artifacts?: ParsedDelegationArtifact[];\n}\n\n/** The raw camelCase artifact entry shape the broker serializes. */\ninterface RawDelegationArtifact {\n artifactId?: unknown;\n artifactVersionId?: unknown;\n name?: unknown;\n}\n\n/**\n * Parses the broker's `{success, output, runId, artifacts}` | `{success:false, error}` ResultJson.\n * If the payload isn't JSON, the raw string is surfaced as the output (success assumed) —\n * mirroring the spoken path, which feeds whatever came back to the model verbatim.\n */\nexport function ParseDelegationResultJson(resultJson: string): ParsedDelegationResult {\n try {\n const parsed = JSON.parse(resultJson) as {\n success?: boolean;\n output?: string;\n error?: string;\n runId?: string;\n artifacts?: unknown;\n };\n return {\n Success: parsed.success !== false,\n Output: parsed.output ?? parsed.error ?? '',\n RunID: typeof parsed.runId === 'string' && parsed.runId.length > 0 ? parsed.runId : undefined,\n Artifacts: parseArtifacts(parsed.artifacts)\n };\n } catch {\n return { Success: true, Output: resultJson };\n }\n}\n\n/**\n * Normalizes the raw `artifacts` array: entries must carry non-empty `artifactId` and\n * `artifactVersionId` strings (malformed entries are dropped); a missing/blank `name`\n * falls back to `\"Artifact\"`. Returns `undefined` when nothing valid remains.\n */\nfunction parseArtifacts(raw: unknown): ParsedDelegationArtifact[] | undefined {\n if (!Array.isArray(raw)) {\n return undefined;\n }\n const artifacts: ParsedDelegationArtifact[] = [];\n for (const entry of raw as RawDelegationArtifact[]) {\n const artifactId = typeof entry?.artifactId === 'string' ? entry.artifactId : '';\n const versionId = typeof entry?.artifactVersionId === 'string' ? entry.artifactVersionId : '';\n if (artifactId.length === 0 || versionId.length === 0) {\n continue;\n }\n const name = typeof entry.name === 'string' && entry.name.trim().length > 0 ? entry.name.trim() : 'Artifact';\n artifacts.push({ ArtifactID: artifactId, ArtifactVersionID: versionId, Name: name });\n }\n return artifacts.length > 0 ? artifacts : undefined;\n}\n\n/**\n * Convert snake_case or colon-delimited tool names (e.g. `File_Storage_List_Objects` or `File Storage: List Objects`)\n * to a clean human-readable title (e.g. `File Storage List Objects`).\n */\nexport function FormatToolName(toolName?: string): string {\n if (!toolName) return 'Action';\n return toolName\n .replace(/[_\\-:]+/g, ' ')\n .replace(/\\s+/g, ' ')\n .trim();\n}\n"]}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Pure helpers for building the one-off spoken progress-narration instructions a
|
|
3
|
-
* realtime voice session sends to the model while delegated work runs.
|
|
4
|
-
*
|
|
5
|
-
* The instruction text is DB-driven: the server resolves the `Realtime Co-Agent - Progress Narration`
|
|
6
|
-
* prompt's `TemplateText` at session start and threads it to the browser. The template may use:
|
|
7
|
-
* - `{{ progressMessage }}` — the aggregated progress digest (one or more updates, oldest first)
|
|
8
|
-
* - `{{ priorNarrations }}` — what the model has ALREADY said aloud for this task (so it can
|
|
9
|
-
* continue the story instead of repeating itself)
|
|
10
|
-
* - `{{ updateNumber }}` — 1-based count of spoken updates for this task
|
|
11
|
-
* When a deployment hasn't synced that prompt yet, the built-in
|
|
12
|
-
* {@link DefaultNarrationInstructions} fallback keeps narration working with the same semantics.
|
|
13
|
-
*/
|
|
14
|
-
/** Options accompanying the progress digest when building narration instructions. */
|
|
15
|
-
export interface NarrationBuildOptions {
|
|
16
|
-
/** The narration utterances the model has already spoken for this task, oldest first. */
|
|
17
|
-
PriorNarrations?: string[];
|
|
18
|
-
/** 1-based number of this spoken update within the current task. */
|
|
19
|
-
UpdateNumber?: number;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Builds the built-in (fallback) narration instructions — same semantics as the DB template:
|
|
23
|
-
* first person, varied phrasing that continues from what was already said, no repeats.
|
|
24
|
-
*
|
|
25
|
-
* @param digest The aggregated progress digest (one or more updates, oldest first).
|
|
26
|
-
* @param options Prior narrations + update number for phrasing variation/chaining.
|
|
27
|
-
* @returns The complete spoken-update instruction text.
|
|
28
|
-
*/
|
|
29
|
-
export declare function DefaultNarrationInstructions(digest: string, options?: NarrationBuildOptions): string;
|
|
30
|
-
/**
|
|
31
|
-
* Builds the narration instructions from the server-provided template by substituting
|
|
32
|
-
* `{{ progressMessage }}`, `{{ priorNarrations }}`, and `{{ updateNumber }}` (space and no-space
|
|
33
|
-
* variants). Falls back to {@link DefaultNarrationInstructions} when the template is absent or
|
|
34
|
-
* blank (deployments that haven't synced the narration prompt).
|
|
35
|
-
*
|
|
36
|
-
* @param template The DB-driven instruction template, or `null`/`undefined` when unavailable.
|
|
37
|
-
* @param digest The aggregated progress digest (one or more updates, oldest first).
|
|
38
|
-
* @param options Prior narrations + update number for phrasing variation/chaining.
|
|
39
|
-
* @returns The complete spoken-update instruction text.
|
|
40
|
-
*/
|
|
41
|
-
export declare function BuildNarrationInstructions(template: string | null | undefined, digest: string, options?: NarrationBuildOptions): string;
|
|
42
|
-
//# sourceMappingURL=narration-template.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"narration-template.d.ts","sourceRoot":"","sources":["../../../src/lib/services/narration-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,qFAAqF;AACrF,MAAM,WAAW,qBAAqB;IACpC,yFAAyF;IACzF,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,oEAAoE;IACpE,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAuBD;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,MAAM,CAcpG;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,0BAA0B,CACxC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EACnC,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,qBAAqB,GAC9B,MAAM,CAQR"}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Pure helpers for building the one-off spoken progress-narration instructions a
|
|
3
|
-
* realtime voice session sends to the model while delegated work runs.
|
|
4
|
-
*
|
|
5
|
-
* The instruction text is DB-driven: the server resolves the `Realtime Co-Agent - Progress Narration`
|
|
6
|
-
* prompt's `TemplateText` at session start and threads it to the browser. The template may use:
|
|
7
|
-
* - `{{ progressMessage }}` — the aggregated progress digest (one or more updates, oldest first)
|
|
8
|
-
* - `{{ priorNarrations }}` — what the model has ALREADY said aloud for this task (so it can
|
|
9
|
-
* continue the story instead of repeating itself)
|
|
10
|
-
* - `{{ updateNumber }}` — 1-based count of spoken updates for this task
|
|
11
|
-
* When a deployment hasn't synced that prompt yet, the built-in
|
|
12
|
-
* {@link DefaultNarrationInstructions} fallback keeps narration working with the same semantics.
|
|
13
|
-
*/
|
|
14
|
-
const PROGRESS_TOKENS = ['{{ progressMessage }}', '{{progressMessage}}'];
|
|
15
|
-
const PRIOR_TOKENS = ['{{ priorNarrations }}', '{{priorNarrations}}'];
|
|
16
|
-
const NUMBER_TOKENS = ['{{ updateNumber }}', '{{updateNumber}}'];
|
|
17
|
-
/** Replaces every occurrence of each token with the value. */
|
|
18
|
-
function replaceTokens(text, tokens, value) {
|
|
19
|
-
let out = text;
|
|
20
|
-
for (const t of tokens) {
|
|
21
|
-
out = out.split(t).join(value);
|
|
22
|
-
}
|
|
23
|
-
return out;
|
|
24
|
-
}
|
|
25
|
-
/** Formats the prior spoken narrations for injection ("none yet" when this is the first update). */
|
|
26
|
-
function formatPriorNarrations(prior) {
|
|
27
|
-
if (!prior || prior.length === 0) {
|
|
28
|
-
return 'Nothing yet — this is your first spoken update for this task.';
|
|
29
|
-
}
|
|
30
|
-
return prior.map((p) => `- "${p}"`).join('\n');
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Builds the built-in (fallback) narration instructions — same semantics as the DB template:
|
|
34
|
-
* first person, varied phrasing that continues from what was already said, no repeats.
|
|
35
|
-
*
|
|
36
|
-
* @param digest The aggregated progress digest (one or more updates, oldest first).
|
|
37
|
-
* @param options Prior narrations + update number for phrasing variation/chaining.
|
|
38
|
-
* @returns The complete spoken-update instruction text.
|
|
39
|
-
*/
|
|
40
|
-
export function DefaultNarrationInstructions(digest, options) {
|
|
41
|
-
const updateNumber = options?.UpdateNumber ?? 1;
|
|
42
|
-
return (`Live progress on the work YOU are doing for the user (oldest first): ${digest}. ` +
|
|
43
|
-
`This is spoken update #${updateNumber} for this task. You have already told the user:\n` +
|
|
44
|
-
`${formatPriorNarrations(options?.PriorNarrations)}\n` +
|
|
45
|
-
`Say ONE short, natural sentence in the FIRST PERSON continuing the story of what you are doing. ` +
|
|
46
|
-
`For the first update something like "I'm pulling that up now" is fine; for later updates VARY the ` +
|
|
47
|
-
`phrasing and build on what you last said ("Got the first part — grabbing the rest", "Almost there, ` +
|
|
48
|
-
`just double-checking the numbers") instead of repeating an "I'm now…" pattern. Never repeat ` +
|
|
49
|
-
`information you've already conveyed — only add what's new. Strictly first person: the words "it" ` +
|
|
50
|
-
`and the agent's name must not be the subject of your sentence, and never say generic filler like ` +
|
|
51
|
-
`"it's still running in the background".`);
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Builds the narration instructions from the server-provided template by substituting
|
|
55
|
-
* `{{ progressMessage }}`, `{{ priorNarrations }}`, and `{{ updateNumber }}` (space and no-space
|
|
56
|
-
* variants). Falls back to {@link DefaultNarrationInstructions} when the template is absent or
|
|
57
|
-
* blank (deployments that haven't synced the narration prompt).
|
|
58
|
-
*
|
|
59
|
-
* @param template The DB-driven instruction template, or `null`/`undefined` when unavailable.
|
|
60
|
-
* @param digest The aggregated progress digest (one or more updates, oldest first).
|
|
61
|
-
* @param options Prior narrations + update number for phrasing variation/chaining.
|
|
62
|
-
* @returns The complete spoken-update instruction text.
|
|
63
|
-
*/
|
|
64
|
-
export function BuildNarrationInstructions(template, digest, options) {
|
|
65
|
-
if (!template || template.trim().length === 0) {
|
|
66
|
-
return DefaultNarrationInstructions(digest, options);
|
|
67
|
-
}
|
|
68
|
-
let out = replaceTokens(template, PROGRESS_TOKENS, digest);
|
|
69
|
-
out = replaceTokens(out, PRIOR_TOKENS, formatPriorNarrations(options?.PriorNarrations));
|
|
70
|
-
out = replaceTokens(out, NUMBER_TOKENS, String(options?.UpdateNumber ?? 1));
|
|
71
|
-
return out;
|
|
72
|
-
}
|
|
73
|
-
//# sourceMappingURL=narration-template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"narration-template.js","sourceRoot":"","sources":["../../../src/lib/services/narration-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAUH,MAAM,eAAe,GAAG,CAAC,uBAAuB,EAAE,qBAAqB,CAAC,CAAC;AACzE,MAAM,YAAY,GAAG,CAAC,uBAAuB,EAAE,qBAAqB,CAAC,CAAC;AACtE,MAAM,aAAa,GAAG,CAAC,oBAAoB,EAAE,kBAAkB,CAAC,CAAC;AAEjE,8DAA8D;AAC9D,SAAS,aAAa,CAAC,IAAY,EAAE,MAAgB,EAAE,KAAa;IAClE,IAAI,GAAG,GAAG,IAAI,CAAC;IACf,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;QACvB,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,oGAAoG;AACpG,SAAS,qBAAqB,CAAC,KAA2B;IACxD,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjC,OAAO,+DAA+D,CAAC;IACzE,CAAC;IACD,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,4BAA4B,CAAC,MAAc,EAAE,OAA+B;IAC1F,MAAM,YAAY,GAAG,OAAO,EAAE,YAAY,IAAI,CAAC,CAAC;IAChD,OAAO,CACL,wEAAwE,MAAM,IAAI;QAClF,0BAA0B,YAAY,mDAAmD;QACzF,GAAG,qBAAqB,CAAC,OAAO,EAAE,eAAe,CAAC,IAAI;QACtD,kGAAkG;QAClG,oGAAoG;QACpG,qGAAqG;QACrG,8FAA8F;QAC9F,mGAAmG;QACnG,mGAAmG;QACnG,yCAAyC,CAC1C,CAAC;AACJ,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,0BAA0B,CACxC,QAAmC,EACnC,MAAc,EACd,OAA+B;IAE/B,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9C,OAAO,4BAA4B,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;IACD,IAAI,GAAG,GAAG,aAAa,CAAC,QAAQ,EAAE,eAAe,EAAE,MAAM,CAAC,CAAC;IAC3D,GAAG,GAAG,aAAa,CAAC,GAAG,EAAE,YAAY,EAAE,qBAAqB,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC,CAAC;IACxF,GAAG,GAAG,aAAa,CAAC,GAAG,EAAE,aAAa,EAAE,MAAM,CAAC,OAAO,EAAE,YAAY,IAAI,CAAC,CAAC,CAAC,CAAC;IAC5E,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["/**\n * @fileoverview Pure helpers for building the one-off spoken progress-narration instructions a\n * realtime voice session sends to the model while delegated work runs.\n *\n * The instruction text is DB-driven: the server resolves the `Realtime Co-Agent - Progress Narration`\n * prompt's `TemplateText` at session start and threads it to the browser. The template may use:\n * - `{{ progressMessage }}` — the aggregated progress digest (one or more updates, oldest first)\n * - `{{ priorNarrations }}` — what the model has ALREADY said aloud for this task (so it can\n * continue the story instead of repeating itself)\n * - `{{ updateNumber }}` — 1-based count of spoken updates for this task\n * When a deployment hasn't synced that prompt yet, the built-in\n * {@link DefaultNarrationInstructions} fallback keeps narration working with the same semantics.\n */\n\n/** Options accompanying the progress digest when building narration instructions. */\nexport interface NarrationBuildOptions {\n /** The narration utterances the model has already spoken for this task, oldest first. */\n PriorNarrations?: string[];\n /** 1-based number of this spoken update within the current task. */\n UpdateNumber?: number;\n}\n\nconst PROGRESS_TOKENS = ['{{ progressMessage }}', '{{progressMessage}}'];\nconst PRIOR_TOKENS = ['{{ priorNarrations }}', '{{priorNarrations}}'];\nconst NUMBER_TOKENS = ['{{ updateNumber }}', '{{updateNumber}}'];\n\n/** Replaces every occurrence of each token with the value. */\nfunction replaceTokens(text: string, tokens: string[], value: string): string {\n let out = text;\n for (const t of tokens) {\n out = out.split(t).join(value);\n }\n return out;\n}\n\n/** Formats the prior spoken narrations for injection (\"none yet\" when this is the first update). */\nfunction formatPriorNarrations(prior: string[] | undefined): string {\n if (!prior || prior.length === 0) {\n return 'Nothing yet — this is your first spoken update for this task.';\n }\n return prior.map((p) => `- \"${p}\"`).join('\\n');\n}\n\n/**\n * Builds the built-in (fallback) narration instructions — same semantics as the DB template:\n * first person, varied phrasing that continues from what was already said, no repeats.\n *\n * @param digest The aggregated progress digest (one or more updates, oldest first).\n * @param options Prior narrations + update number for phrasing variation/chaining.\n * @returns The complete spoken-update instruction text.\n */\nexport function DefaultNarrationInstructions(digest: string, options?: NarrationBuildOptions): string {\n const updateNumber = options?.UpdateNumber ?? 1;\n return (\n `Live progress on the work YOU are doing for the user (oldest first): ${digest}. ` +\n `This is spoken update #${updateNumber} for this task. You have already told the user:\\n` +\n `${formatPriorNarrations(options?.PriorNarrations)}\\n` +\n `Say ONE short, natural sentence in the FIRST PERSON continuing the story of what you are doing. ` +\n `For the first update something like \"I'm pulling that up now\" is fine; for later updates VARY the ` +\n `phrasing and build on what you last said (\"Got the first part — grabbing the rest\", \"Almost there, ` +\n `just double-checking the numbers\") instead of repeating an \"I'm now…\" pattern. Never repeat ` +\n `information you've already conveyed — only add what's new. Strictly first person: the words \"it\" ` +\n `and the agent's name must not be the subject of your sentence, and never say generic filler like ` +\n `\"it's still running in the background\".`\n );\n}\n\n/**\n * Builds the narration instructions from the server-provided template by substituting\n * `{{ progressMessage }}`, `{{ priorNarrations }}`, and `{{ updateNumber }}` (space and no-space\n * variants). Falls back to {@link DefaultNarrationInstructions} when the template is absent or\n * blank (deployments that haven't synced the narration prompt).\n *\n * @param template The DB-driven instruction template, or `null`/`undefined` when unavailable.\n * @param digest The aggregated progress digest (one or more updates, oldest first).\n * @param options Prior narrations + update number for phrasing variation/chaining.\n * @returns The complete spoken-update instruction text.\n */\nexport function BuildNarrationInstructions(\n template: string | null | undefined,\n digest: string,\n options?: NarrationBuildOptions\n): string {\n if (!template || template.trim().length === 0) {\n return DefaultNarrationInstructions(digest, options);\n }\n let out = replaceTokens(template, PROGRESS_TOKENS, digest);\n out = replaceTokens(out, PRIOR_TOKENS, formatPriorNarrations(options?.PriorNarrations));\n out = replaceTokens(out, NUMBER_TOKENS, String(options?.UpdateNumber ?? 1));\n return out;\n}\n"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The '/' picker's narrowing rule, as a pure function so it can be tested against the real code:
|
|
3
|
-
* the skills to offer are the user's RUNNABLE set intersected with the target agent's ACCEPTED set
|
|
4
|
-
* (`AIEngineBase.GetSkillsForAgent(agent)` — `AcceptsSkills` + `MJ: AI Agent Skills` grants).
|
|
5
|
-
* Intersection only: the agent's set can remove a skill the user could run, never add one the user
|
|
6
|
-
* could not. Order follows `runnable`. UUIDs are compared case-insensitively.
|
|
7
|
-
*/
|
|
8
|
-
export declare function IntersectAcceptedSkills<T extends {
|
|
9
|
-
ID: string;
|
|
10
|
-
}>(runnable: T[], accepted: ReadonlyArray<{
|
|
11
|
-
ID: string;
|
|
12
|
-
}>): T[];
|
|
13
|
-
//# sourceMappingURL=skill-picker-narrowing.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"skill-picker-narrowing.d.ts","sourceRoot":"","sources":["../../../src/lib/services/skill-picker-narrowing.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,EAAE,QAAQ,EAAE,aAAa,CAAC;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,CAAC,EAAE,CAG7H"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { NormalizeUUID } from '@memberjunction/global';
|
|
2
|
-
/**
|
|
3
|
-
* The '/' picker's narrowing rule, as a pure function so it can be tested against the real code:
|
|
4
|
-
* the skills to offer are the user's RUNNABLE set intersected with the target agent's ACCEPTED set
|
|
5
|
-
* (`AIEngineBase.GetSkillsForAgent(agent)` — `AcceptsSkills` + `MJ: AI Agent Skills` grants).
|
|
6
|
-
* Intersection only: the agent's set can remove a skill the user could run, never add one the user
|
|
7
|
-
* could not. Order follows `runnable`. UUIDs are compared case-insensitively.
|
|
8
|
-
*/
|
|
9
|
-
export function IntersectAcceptedSkills(runnable, accepted) {
|
|
10
|
-
const acceptedIDs = new Set(accepted.map(sk => NormalizeUUID(sk.ID)));
|
|
11
|
-
return runnable.filter(sk => acceptedIDs.has(NormalizeUUID(sk.ID)));
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=skill-picker-narrowing.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"skill-picker-narrowing.js","sourceRoot":"","sources":["../../../src/lib/services/skill-picker-narrowing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CAA2B,QAAa,EAAE,QAAuC;IACtH,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACtE,OAAO,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACtE,CAAC","sourcesContent":["import { NormalizeUUID } from '@memberjunction/global';\n\n/**\n * The '/' picker's narrowing rule, as a pure function so it can be tested against the real code:\n * the skills to offer are the user's RUNNABLE set intersected with the target agent's ACCEPTED set\n * (`AIEngineBase.GetSkillsForAgent(agent)` — `AcceptsSkills` + `MJ: AI Agent Skills` grants).\n * Intersection only: the agent's set can remove a skill the user could run, never add one the user\n * could not. Order follows `runnable`. UUIDs are compared case-insensitively.\n */\nexport function IntersectAcceptedSkills<T extends { ID: string }>(runnable: T[], accepted: ReadonlyArray<{ ID: string }>): T[] {\n const acceptedIDs = new Set(accepted.map(sk => NormalizeUUID(sk.ID)));\n return runnable.filter(sk => acceptedIDs.has(NormalizeUUID(sk.ID)));\n}\n"]}
|