@agimon-ai/po-web-dashboard 0.0.0-alpha.152 → 0.0.0-alpha.153

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.
@@ -238,6 +238,7 @@ function activityGroups(statuses, widgets, sessionId = null) {
238
238
  const placement = {
239
239
  ...source.placement === void 0 ? {} : { placement: source.placement },
240
240
  ...source.marksBackgroundWork === false ? { marksBackgroundWork: false } : {},
241
+ ...source.collapsible === false ? { collapsible: false } : {},
241
242
  ...source.icon === void 0 ? {} : { icon: source.icon }
242
243
  };
243
244
  if (source.statusKey !== void 0 && statuses[source.statusKey] !== void 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"composition.cjs","names":["pluginSelectionAxes","stripAnsi","isDesktopClient","pluginMinorModes","pluginActivityGroups","subscribeWebPluginRegistry","webPluginRegistryRevision","pluginDockFaces","useSyncExternalStore","pluginFileLinks","useCallback"],"sources":["../../../src/web/lib/composition.ts"],"sourcesContent":["import type {\n ActivityGroupContribution,\n DockFaceContribution,\n FileLinkMention,\n MinorModeContribution,\n SelectionAxisContribution,\n TransientTab,\n} from '@agimon-ai/po-core/web';\nimport { useCallback, useSyncExternalStore } from 'react';\n\nimport type { MinorModeProjection, MinorModeRecordProjection } from '../../types/hub';\nimport {\n isDesktopClient,\n pluginActivityGroups,\n pluginDockFaces,\n pluginFileLinks,\n pluginMinorModes,\n pluginSelectionAxes,\n subscribeWebPluginRegistry,\n webPluginRegistryRevision,\n} from './pluginRegistry';\nimport { stripAnsi } from './statusLine';\n\nexport interface SelectionAxis {\n name: string;\n command: string;\n /** The current selections, empty while the session reports none; one at most unless multi. */\n values: string[];\n emptyLabel: string;\n multi: boolean;\n}\n\nconst AXIS_LIST_SEPARATOR = ',';\n\n/**\n * The fallback axis table for the packaged bundle; a synced bundle carries\n * each axis as its owning package's plugin declaration, and the registry\n * list wins whenever any plugin declares one. Exported only so the workspace\n * composition test can hold it equal to what the packages declare.\n */\nexport const PACKAGED_SELECTION_AXES: readonly SelectionAxisContribution[] = [\n { name: 'profile', command: 'profile', statusKey: 'po-profile', emptyLabel: 'None', order: 10 },\n { name: 'domains', command: 'domains', statusKey: 'po-domain', emptyLabel: 'no domains', multi: true, order: 20 },\n];\n\n/**\n * The declared axes the session actually offers: an axis whose status key\n * the session never published stays off the bar entirely, which is how a\n * package withholds its axis when there is nothing to select.\n */\nexport function selectionAxes(statuses: Record<string, string>): SelectionAxis[] {\n const declared = pluginSelectionAxes();\n const sources: readonly SelectionAxisContribution[] = declared.length > 0 ? declared : PACKAGED_SELECTION_AXES;\n return sources.flatMap((source) => {\n const raw = statuses[source.statusKey];\n if (raw === undefined) return [];\n const multi = source.multi === true;\n const values = (multi ? stripAnsi(raw).split(AXIS_LIST_SEPARATOR) : [stripAnsi(raw)])\n .map((value) => value.trim())\n .filter(Boolean);\n return [{ name: source.name, command: source.command, values, emptyLabel: source.emptyLabel, multi }];\n });\n}\n\nexport type MinorModeAvailability = 'unavailable' | 'off' | 'on';\n\nexport interface MinorMode {\n name: string;\n /** The catalog id /minor accepts; the display name until the catalog reports. */\n id: string;\n /** Leader Space key path, as the TUI documents it. */\n keys: string;\n availability: MinorModeAvailability;\n /** What the mode itself is reporting while on. */\n detail: string;\n /** Activity group to focus instead of invoking the mode command from the cockpit. */\n activityGroup?: string;\n /** The mark the mode's package declares; the host draws a generic one without it. */\n icon?: MinorModeContribution['icon'];\n /** The action that flips the row in one click, when the mode offers it without input. */\n toggle?: 'activate' | 'deactivate';\n /**\n * Why the mode cannot be driven from here, in the words of the mode itself.\n * Empty when it can. A mode may be installed and still refuse a cockpit:\n * autonomous voice captures from the terminal's own microphone, which a\n * browser talking to a headless agent does not have.\n */\n unavailableReason: string;\n}\n\nexport interface MinorModeSource {\n name: string;\n /** The catalog mode this row drives, when the runtime registers it under another id. */\n modeId?: string;\n /** Leader Space key path, as the TUI documents it. */\n keys: string;\n /** Activity group to focus instead of invoking the mode command from the cockpit. */\n activityGroup?: string;\n icon?: MinorModeContribution['icon'];\n statusKey?: string;\n widgetKey?: string;\n hideWhenMissing?: boolean;\n desktopOnly?: boolean;\n}\n\n/**\n * The fallback minor-mode table for the packaged bundle.\n *\n * A synced bundle carries each mode as its package's own web plugin\n * contribution, and the registry list wins whenever any plugin declares one.\n * This literal survives only so the built-in-only bundle keeps rendering the\n * modes Po ships; help is listed without a signal on purpose: it\n * registers no footer entry, so the cockpit reports it as unavailable rather\n * than guessing it is off. Exported only for the workspace composition test.\n */\nexport const PACKAGED_MINOR_MODES: readonly MinorModeSource[] = [\n { name: 'help', keys: 'h e' },\n { name: 'plan', keys: 'p e', statusKey: 'plan-mode' },\n { name: 'goal', keys: 'g e', statusKey: 'goal' },\n { name: 'author', keys: 'o a' },\n // `v e` drives autonomous capture, which the runtime registers as 'voice-auto'.\n { name: 'voice', modeId: 'voice-auto', keys: 'v e', statusKey: 'po-voice' },\n {\n name: 'computer use',\n modeId: 'computer-use',\n keys: 'c e',\n statusKey: 'po-computer-use-mode',\n hideWhenMissing: true,\n },\n];\n\n/** What a mode's own package declares about how its row looks and where it leads. */\nfunction presented(source: MinorModeSource | undefined): Pick<MinorMode, 'activityGroup' | 'icon'> {\n return {\n ...(source?.activityGroup === undefined ? {} : { activityGroup: source.activityGroup }),\n ...(source?.icon === undefined ? {} : { icon: source.icon }),\n };\n}\n\n/** The declared source a catalog mode corresponds to, by id, id stem, or label. */\nfunction sourceFor(sources: readonly MinorModeSource[], mode: MinorModeRecordProjection): MinorModeSource | undefined {\n const candidates = new Set([mode.id.toLowerCase(), mode.id.toLowerCase().split('.')[0], mode.label.toLowerCase()]);\n return sources.find((source) =>\n [source.name, source.modeId].some((identity) => identity !== undefined && candidates.has(identity.toLowerCase())),\n );\n}\n\n/**\n * Catalog-backed rows: the runtime's own activation state per mode, with the\n * declared leader keys attached where a plugin documents them. Declared modes\n * the catalog does not know are still listed, as unavailable, so a mode that\n * is missing from a composition stays visible rather than silently gone.\n */\nfunction catalogMinorModes(sources: readonly MinorModeSource[], projection: MinorModeProjection): MinorMode[] {\n const rows: MinorMode[] = projection.modes\n .filter((mode) => !sourceFor(sources, mode)?.desktopOnly || isDesktopClient())\n .map((mode) => {\n const source = sourceFor(sources, mode);\n const on = mode.activation === 'active' || mode.activation === 'deactivating';\n // The catalog says per action whether it can run here and why not. A mode\n // with nothing runnable is offered as a row that cannot be clicked rather\n // than one that answers \"no actions available\" after the fact.\n const blocked = mode.actions.length > 0 && mode.actions.every((action) => !action.enabled);\n const reason = blocked ? (mode.actions.find((action) => action.disabledReason)?.disabledReason ?? '') : '';\n const toggle = on ? 'deactivate' : 'activate';\n const flips = mode.actions.some((action) => action.id === toggle && action.enabled && !action.needsInput);\n return {\n name: source?.name ?? mode.label.toLowerCase(),\n id: mode.id,\n keys: source?.keys ?? '',\n availability: blocked && !on ? 'unavailable' : on ? 'on' : 'off',\n ...presented(source),\n ...(flips ? { toggle } : {}),\n detail: mode.detail ?? (mode.activation === 'activating' ? 'activating' : ''),\n unavailableReason: reason,\n };\n });\n const seen = new Set(rows.map((row) => row.name));\n for (const source of sources) {\n if (source.hideWhenMissing === true || (source.desktopOnly && !isDesktopClient())) continue;\n if (!seen.has(source.name)) {\n rows.push({\n name: source.name,\n id: source.modeId ?? source.name,\n keys: source.keys,\n availability: 'unavailable',\n ...presented(source),\n detail: '',\n unavailableReason: 'No package in this session registers this mode.',\n });\n }\n }\n return rows;\n}\n\nexport function minorModes(\n statuses: Record<string, string>,\n widgets: readonly string[],\n projection: MinorModeProjection | null = null,\n): MinorMode[] {\n const declared = pluginMinorModes();\n const sources: readonly MinorModeSource[] = declared.length > 0 ? declared : PACKAGED_MINOR_MODES;\n if (projection) return catalogMinorModes(sources, projection);\n return sources.flatMap((source) => {\n if (source.desktopOnly && !isDesktopClient()) return [];\n if (source.statusKey !== undefined) {\n const raw = statuses[source.statusKey];\n if (raw === undefined) {\n if (source.hideWhenMissing === true) return [];\n return [\n {\n name: source.name,\n id: source.modeId ?? source.name,\n keys: source.keys,\n availability: 'unavailable' as const,\n ...presented(source),\n detail: '',\n unavailableReason: 'This session has not reported the mode.',\n },\n ];\n }\n const detail = stripAnsi(raw).trim();\n return {\n name: source.name,\n id: source.modeId ?? source.name,\n keys: source.keys,\n availability: detail ? ('on' as const) : ('off' as const),\n ...presented(source),\n detail,\n unavailableReason: '',\n };\n }\n if (source.widgetKey !== undefined && widgets.includes(source.widgetKey)) {\n return {\n name: source.name,\n id: source.modeId ?? source.name,\n keys: source.keys,\n availability: 'off' as const,\n ...presented(source),\n detail: '',\n unavailableReason: '',\n };\n }\n return {\n name: source.name,\n id: source.name,\n keys: source.keys,\n availability: 'unavailable' as const,\n ...presented(source),\n detail: '',\n unavailableReason: 'This session has not reported the mode.',\n };\n });\n}\n\nexport interface ActivityGroup {\n name: string;\n keys: string;\n /** The heading visual its package declares; the dock draws a generic one without it. */\n icon?: ActivityGroupContribution['icon'];\n /** What the publishing extension is reporting, empty when it reports nothing. */\n summary: string;\n active: boolean;\n marksBackgroundWork?: boolean;\n /** The temporary tab the group's name opens, when its package declares one. */\n transientTab?: () => TransientTab;\n /** Keeps the group visible below the dock's scrolling ordinary groups. */\n placement?: 'bottom';\n}\n\n/** Subscribe to package-owned activity sources, rewiring when the focused composition changes. */\nexport function subscribeActivitySources(listener: () => void): () => void {\n let subscriptions: (() => void)[] = [];\n const unsubscribeSources = (): void => {\n subscriptions.forEach((unsubscribe) => unsubscribe());\n subscriptions = [];\n };\n const subscribeSources = (): void => {\n subscriptions = pluginActivityGroups().flatMap((source) =>\n source.activeSource === undefined ? [] : [source.activeSource.subscribe(listener)],\n );\n };\n subscribeSources();\n const unsubscribeRegistry = subscribeWebPluginRegistry(() => {\n unsubscribeSources();\n subscribeSources();\n listener();\n });\n return () => {\n unsubscribeRegistry();\n unsubscribeSources();\n };\n}\n\nfunction activitySourceFingerprint(sessionId: string | null): string {\n const activeSources = pluginActivityGroups()\n .map((source) => (source.activeSource?.isActive(sessionId) === true ? '1' : '0'))\n .join('');\n return `${webPluginRegistryRevision()}:${activeSources}`;\n}\n\n/**\n * The groups available in this plugin composition. Status and widget signals\n * reveal legacy groups. A package-owned active source also reveals its group,\n * including while idle, so the section can remain a stable launcher unless it\n * opts into `hideWhenEmpty`.\n *\n * A group that declared `hideWhenEmpty` goes away once its session stops\n * reporting. Clearing a status reaches the page as an empty string rather than\n * an absent key, because the same map tells the selection bar which minor modes\n * exist and an absent key means \"not reported\" there. Emptiness is read here,\n * where only the dock is looking.\n */\nexport function activityGroups(\n statuses: Record<string, string>,\n widgets: readonly string[],\n sessionId: string | null = null,\n): ActivityGroup[] {\n const groups: ActivityGroup[] = [];\n for (const source of pluginActivityGroups()) {\n const tab = source.transientTab === undefined ? {} : { transientTab: source.transientTab };\n const placement = {\n ...(source.placement === undefined ? {} : { placement: source.placement }),\n ...(source.marksBackgroundWork === false ? { marksBackgroundWork: false } : {}),\n ...(source.icon === undefined ? {} : { icon: source.icon }),\n };\n if (source.statusKey !== undefined && statuses[source.statusKey] !== undefined) {\n const summary = stripAnsi(statuses[source.statusKey] ?? '').trim();\n const active =\n source.activeSource?.isActive(sessionId) ?? (source.marksBackgroundWork !== false && summary.length > 0);\n if (summary.length === 0 && source.hideWhenEmpty === true && !active) continue;\n groups.push({ name: source.name, keys: source.keys, summary, active, ...tab, ...placement });\n continue;\n }\n if (source.widgetKeys !== undefined && source.widgetKeys.some((key) => widgets.includes(key))) {\n const activeKeys = source.activeWidgetKeys ?? source.widgetKeys;\n const active =\n source.activeSource?.isActive(sessionId) ??\n (source.marksBackgroundWork !== false && activeKeys.some((key) => widgets.includes(key)));\n groups.push({ name: source.name, keys: source.keys, summary: '', active, ...tab, ...placement });\n continue;\n }\n if (source.activeSource !== undefined) {\n const active = source.activeSource.isActive(sessionId);\n if (source.hideWhenEmpty === true && !active) continue;\n groups.push({\n name: source.name,\n keys: source.keys,\n summary: '',\n active,\n ...tab,\n ...placement,\n });\n }\n }\n return groups;\n}\n\n/** Dock faces update when the active session composition changes. */\nexport function useDockFaces(sessionId: string | null): readonly DockFaceContribution[] {\n useSyncExternalStore(subscribeWebPluginRegistry, webPluginRegistryRevision, webPluginRegistryRevision);\n const subscribe = (listener: () => void) => {\n const releases = pluginDockFaces().flatMap((face) =>\n face.visibility ? [face.visibility.subscribe(listener)] : [],\n );\n return () => releases.forEach((release) => release());\n };\n const snapshot = () =>\n pluginDockFaces()\n .map((face) => (face.visibility?.isVisible(sessionId) !== false ? '1' : '0'))\n .join('');\n useSyncExternalStore(subscribe, snapshot, snapshot);\n return pluginDockFaces().filter((face) => face.visibility?.isVisible(sessionId) !== false);\n}\n\n/** Each face's badge count for the session, re-read when a face reports a change. */\nexport function useDockFaceBadges(\n faces: readonly DockFaceContribution[],\n sessionId: string | null,\n): Readonly<Record<string, number>> {\n const subscribe = (listener: () => void) => {\n const releases = faces.flatMap((face) => (face.badge ? [face.badge.subscribe(listener)] : []));\n return () => releases.forEach((release) => release());\n };\n // A string snapshot keeps useSyncExternalStore stable between unrelated renders.\n const snapshot = () =>\n faces.map((face) => `${face.id}=${face.badge ? Math.max(0, face.badge.count(sessionId)) : 0}`).join('\\n');\n const counts = useSyncExternalStore(subscribe, snapshot, snapshot);\n return Object.fromEntries(\n counts\n .split('\\n')\n .filter(Boolean)\n .map((entry) => {\n const separator = entry.lastIndexOf('=');\n return [entry.slice(0, separator), Number(entry.slice(separator + 1))];\n }),\n );\n}\n\n/** Activity groups that update when either host signals or a plugin's session store changes. */\nexport function useActivityGroups(\n statuses: Record<string, string>,\n widgets: readonly string[],\n sessionId: string | null,\n): ActivityGroup[] {\n useSyncExternalStore(\n subscribeActivitySources,\n () => activitySourceFingerprint(sessionId),\n () => activitySourceFingerprint(sessionId),\n );\n return activityGroups(statuses, widgets, sessionId);\n}\n\n/** The tab one path opens, or undefined when no installed plugin recognises it. */\nexport type FileLinkResolver = (path: string) => TransientTab | undefined;\n\ninterface FileLinkModes {\n active(sessionId: string | null): readonly string[];\n subscribe(sessionId: string | null, listener: () => void): () => void;\n}\nlet fileLinkModes: FileLinkModes | undefined;\nconst modeBindings = new Set<() => void>();\n\n/** Binds host session facts without making the composition library own session state. */\nexport function bindFileLinkModes(source: FileLinkModes): () => void {\n fileLinkModes = source;\n modeBindings.forEach((listener) => listener());\n return () => {\n if (fileLinkModes !== source) return;\n fileLinkModes = undefined;\n modeBindings.forEach((listener) => listener());\n };\n}\nfunction subscribeFileLinks(sessionId: string | null, listener: () => void): () => void {\n let unsubscribeModes = fileLinkModes?.subscribe(sessionId, listener);\n const rebindModes = () => {\n unsubscribeModes?.();\n unsubscribeModes = fileLinkModes?.subscribe(sessionId, listener);\n listener();\n };\n modeBindings.add(rebindModes);\n let subscriptions: (() => void)[] = [];\n const unsubscribeSources = (): void => {\n subscriptions.forEach((unsubscribe) => unsubscribe());\n subscriptions = [];\n };\n const subscribeSources = (): void => {\n subscriptions = pluginFileLinks().map((source) => source.subscribe(listener));\n };\n subscribeSources();\n const unsubscribeRegistry = subscribeWebPluginRegistry(() => {\n unsubscribeSources();\n subscribeSources();\n listener();\n });\n return () => {\n modeBindings.delete(rebindModes);\n unsubscribeModes?.();\n unsubscribeRegistry();\n unsubscribeSources();\n };\n}\n\nfunction activeFileLinkSources(sessionId: string | null) {\n const enabled = new Set(fileLinkModes?.active(sessionId) ?? []);\n return pluginFileLinks(sessionId).filter(\n (source) => source.requiredMinorMode === undefined || enabled.has(source.requiredMinorMode),\n );\n}\n\nfunction fileLinkFingerprint(sessionId: string | null): string {\n const sourceFingerprints = activeFileLinkSources(sessionId)\n .map((source) => `${source.requiredMinorMode ?? ''}:${source.fingerprint(sessionId)}`)\n .join('\\n');\n return `${webPluginRegistryRevision()}:${sourceFingerprints}`;\n}\n\n/**\n * The tab a path opens, from the first source that claims it.\n *\n * A path no source claims is not a link. The host cannot tell a file name from\n * a class name, and the plugin that tracks the session's files can, so the\n * decision belongs there rather than in a heuristic here.\n */\nexport function fileLinkFor(sessionId: string | null, path: string): TransientTab | undefined {\n for (const source of activeFileLinkSources(sessionId)) {\n const tab = source.resolve(sessionId, path);\n if (tab !== undefined) return tab;\n }\n return undefined;\n}\n\n/** References plugins that own a path namespace offer for an `@` being typed, such as `artifact:plan.md`. */\nexport function fileLinkMentions(sessionId: string, query: string): FileLinkMention[] {\n return activeFileLinkSources(sessionId).flatMap((source) => source.mentions?.(sessionId, query) ?? []);\n}\n\n/**\n * The tab a path the caller is sure about opens: a tool call's path argument,\n * not a token spotted in prose.\n *\n * A source that offers `openPath` answers here, and it may claim a file the\n * session never changed, which `resolve` deliberately will not. Sources\n * without it fall back to the same guess prose gets.\n */\nexport function fileTabForPath(sessionId: string | null, path: string): TransientTab | undefined {\n for (const source of activeFileLinkSources(sessionId)) {\n const tab = source.openPath?.(sessionId, path) ?? source.resolve(sessionId, path);\n if (tab !== undefined) return tab;\n }\n return undefined;\n}\n/**\n * Resolves the paths a message names against the plugins that track them.\n *\n * The resolver's identity is stable while the linkable set is, so a component\n * that hands it to a renderer does not rebuild that renderer on every frame of\n * a streaming reply.\n */\nexport function useFileLinks(sessionId: string | null): FileLinkResolver {\n const fingerprint = useSyncExternalStore(\n useCallback((listener: () => void) => subscribeFileLinks(sessionId, listener), [sessionId]),\n () => fileLinkFingerprint(sessionId),\n () => fileLinkFingerprint(sessionId),\n );\n return useCallback(\n (path: string) => fileLinkFor(sessionId, path),\n // The fingerprint is the dependency: the same path resolves differently\n // once the session's set of tracked files changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps -- fingerprint is a deliberate identity buster, not a value the callback reads.\n [sessionId, fingerprint],\n );\n}\n"],"mappings":";;;;AAgCA,MAAM,sBAAsB;;;;;;;AAQ5B,MAAa,0BAAgE,CAC3E;CAAE,MAAM;CAAW,SAAS;CAAW,WAAW;CAAc,YAAY;CAAQ,OAAO;AAAG,GAC9F;CAAE,MAAM;CAAW,SAAS;CAAW,WAAW;CAAa,YAAY;CAAc,OAAO;CAAM,OAAO;AAAG,CAClH;;;;;;AAOA,SAAgB,cAAc,UAAmD;CAC/E,MAAM,WAAWA,uBA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;;;;;AASA,SAAgB,YAAY,WAA0B,MAAwC;CAC5F,KAAK,MAAM,UAAU,sBAAsB,SAAS,GAAG;EACrD,MAAM,MAAM,OAAO,QAAQ,WAAW,IAAI;EAC1C,IAAI,QAAQ,KAAA,GAAW,OAAO;CAChC;AAEF;;AAGA,SAAgB,iBAAiB,WAAmB,OAAkC;CACpF,OAAO,sBAAsB,SAAS,CAAC,CAAC,SAAS,WAAW,OAAO,WAAW,WAAW,KAAK,KAAK,CAAC,CAAC;AACvG;;;;;;;;;AAUA,SAAgB,eAAe,WAA0B,MAAwC;CAC/F,KAAK,MAAM,UAAU,sBAAsB,SAAS,GAAG;EACrD,MAAM,MAAM,OAAO,WAAW,WAAW,IAAI,KAAK,OAAO,QAAQ,WAAW,IAAI;EAChF,IAAI,QAAQ,KAAA,GAAW,OAAO;CAChC;AAEF;;;;;;;;AAQA,SAAgB,aAAa,WAA4C;CACvE,MAAM,eAAA,GAAcE,MAAAA,qBAAAA,EAAAA,GAClBE,MAAAA,YAAAA,EAAa,aAAyB,mBAAmB,WAAW,QAAQ,GAAG,CAAC,SAAS,CAAC,SACpF,oBAAoB,SAAS,SAC7B,oBAAoB,SAAS,CACrC;CACA,QAAA,GAAOA,MAAAA,YAAAA,EACJ,SAAiB,YAAY,WAAW,IAAI,GAI7C,CAAC,WAAW,WAAW,CACzB;AACF"}
1
+ {"version":3,"file":"composition.cjs","names":["pluginSelectionAxes","stripAnsi","isDesktopClient","pluginMinorModes","pluginActivityGroups","subscribeWebPluginRegistry","webPluginRegistryRevision","pluginDockFaces","useSyncExternalStore","pluginFileLinks","useCallback"],"sources":["../../../src/web/lib/composition.ts"],"sourcesContent":["import type {\n ActivityGroupContribution,\n DockFaceContribution,\n FileLinkMention,\n MinorModeContribution,\n SelectionAxisContribution,\n TransientTab,\n} from '@agimon-ai/po-core/web';\nimport { useCallback, useSyncExternalStore } from 'react';\n\nimport type { MinorModeProjection, MinorModeRecordProjection } from '../../types/hub';\nimport {\n isDesktopClient,\n pluginActivityGroups,\n pluginDockFaces,\n pluginFileLinks,\n pluginMinorModes,\n pluginSelectionAxes,\n subscribeWebPluginRegistry,\n webPluginRegistryRevision,\n} from './pluginRegistry';\nimport { stripAnsi } from './statusLine';\n\nexport interface SelectionAxis {\n name: string;\n command: string;\n /** The current selections, empty while the session reports none; one at most unless multi. */\n values: string[];\n emptyLabel: string;\n multi: boolean;\n}\n\nconst AXIS_LIST_SEPARATOR = ',';\n\n/**\n * The fallback axis table for the packaged bundle; a synced bundle carries\n * each axis as its owning package's plugin declaration, and the registry\n * list wins whenever any plugin declares one. Exported only so the workspace\n * composition test can hold it equal to what the packages declare.\n */\nexport const PACKAGED_SELECTION_AXES: readonly SelectionAxisContribution[] = [\n { name: 'profile', command: 'profile', statusKey: 'po-profile', emptyLabel: 'None', order: 10 },\n { name: 'domains', command: 'domains', statusKey: 'po-domain', emptyLabel: 'no domains', multi: true, order: 20 },\n];\n\n/**\n * The declared axes the session actually offers: an axis whose status key\n * the session never published stays off the bar entirely, which is how a\n * package withholds its axis when there is nothing to select.\n */\nexport function selectionAxes(statuses: Record<string, string>): SelectionAxis[] {\n const declared = pluginSelectionAxes();\n const sources: readonly SelectionAxisContribution[] = declared.length > 0 ? declared : PACKAGED_SELECTION_AXES;\n return sources.flatMap((source) => {\n const raw = statuses[source.statusKey];\n if (raw === undefined) return [];\n const multi = source.multi === true;\n const values = (multi ? stripAnsi(raw).split(AXIS_LIST_SEPARATOR) : [stripAnsi(raw)])\n .map((value) => value.trim())\n .filter(Boolean);\n return [{ name: source.name, command: source.command, values, emptyLabel: source.emptyLabel, multi }];\n });\n}\n\nexport type MinorModeAvailability = 'unavailable' | 'off' | 'on';\n\nexport interface MinorMode {\n name: string;\n /** The catalog id /minor accepts; the display name until the catalog reports. */\n id: string;\n /** Leader Space key path, as the TUI documents it. */\n keys: string;\n availability: MinorModeAvailability;\n /** What the mode itself is reporting while on. */\n detail: string;\n /** Activity group to focus instead of invoking the mode command from the cockpit. */\n activityGroup?: string;\n /** The mark the mode's package declares; the host draws a generic one without it. */\n icon?: MinorModeContribution['icon'];\n /** The action that flips the row in one click, when the mode offers it without input. */\n toggle?: 'activate' | 'deactivate';\n /**\n * Why the mode cannot be driven from here, in the words of the mode itself.\n * Empty when it can. A mode may be installed and still refuse a cockpit:\n * autonomous voice captures from the terminal's own microphone, which a\n * browser talking to a headless agent does not have.\n */\n unavailableReason: string;\n}\n\nexport interface MinorModeSource {\n name: string;\n /** The catalog mode this row drives, when the runtime registers it under another id. */\n modeId?: string;\n /** Leader Space key path, as the TUI documents it. */\n keys: string;\n /** Activity group to focus instead of invoking the mode command from the cockpit. */\n activityGroup?: string;\n icon?: MinorModeContribution['icon'];\n statusKey?: string;\n widgetKey?: string;\n hideWhenMissing?: boolean;\n desktopOnly?: boolean;\n}\n\n/**\n * The fallback minor-mode table for the packaged bundle.\n *\n * A synced bundle carries each mode as its package's own web plugin\n * contribution, and the registry list wins whenever any plugin declares one.\n * This literal survives only so the built-in-only bundle keeps rendering the\n * modes Po ships; help is listed without a signal on purpose: it\n * registers no footer entry, so the cockpit reports it as unavailable rather\n * than guessing it is off. Exported only for the workspace composition test.\n */\nexport const PACKAGED_MINOR_MODES: readonly MinorModeSource[] = [\n { name: 'help', keys: 'h e' },\n { name: 'plan', keys: 'p e', statusKey: 'plan-mode' },\n { name: 'goal', keys: 'g e', statusKey: 'goal' },\n { name: 'author', keys: 'o a' },\n // `v e` drives autonomous capture, which the runtime registers as 'voice-auto'.\n { name: 'voice', modeId: 'voice-auto', keys: 'v e', statusKey: 'po-voice' },\n {\n name: 'computer use',\n modeId: 'computer-use',\n keys: 'c e',\n statusKey: 'po-computer-use-mode',\n hideWhenMissing: true,\n },\n];\n\n/** What a mode's own package declares about how its row looks and where it leads. */\nfunction presented(source: MinorModeSource | undefined): Pick<MinorMode, 'activityGroup' | 'icon'> {\n return {\n ...(source?.activityGroup === undefined ? {} : { activityGroup: source.activityGroup }),\n ...(source?.icon === undefined ? {} : { icon: source.icon }),\n };\n}\n\n/** The declared source a catalog mode corresponds to, by id, id stem, or label. */\nfunction sourceFor(sources: readonly MinorModeSource[], mode: MinorModeRecordProjection): MinorModeSource | undefined {\n const candidates = new Set([mode.id.toLowerCase(), mode.id.toLowerCase().split('.')[0], mode.label.toLowerCase()]);\n return sources.find((source) =>\n [source.name, source.modeId].some((identity) => identity !== undefined && candidates.has(identity.toLowerCase())),\n );\n}\n\n/**\n * Catalog-backed rows: the runtime's own activation state per mode, with the\n * declared leader keys attached where a plugin documents them. Declared modes\n * the catalog does not know are still listed, as unavailable, so a mode that\n * is missing from a composition stays visible rather than silently gone.\n */\nfunction catalogMinorModes(sources: readonly MinorModeSource[], projection: MinorModeProjection): MinorMode[] {\n const rows: MinorMode[] = projection.modes\n .filter((mode) => !sourceFor(sources, mode)?.desktopOnly || isDesktopClient())\n .map((mode) => {\n const source = sourceFor(sources, mode);\n const on = mode.activation === 'active' || mode.activation === 'deactivating';\n // The catalog says per action whether it can run here and why not. A mode\n // with nothing runnable is offered as a row that cannot be clicked rather\n // than one that answers \"no actions available\" after the fact.\n const blocked = mode.actions.length > 0 && mode.actions.every((action) => !action.enabled);\n const reason = blocked ? (mode.actions.find((action) => action.disabledReason)?.disabledReason ?? '') : '';\n const toggle = on ? 'deactivate' : 'activate';\n const flips = mode.actions.some((action) => action.id === toggle && action.enabled && !action.needsInput);\n return {\n name: source?.name ?? mode.label.toLowerCase(),\n id: mode.id,\n keys: source?.keys ?? '',\n availability: blocked && !on ? 'unavailable' : on ? 'on' : 'off',\n ...presented(source),\n ...(flips ? { toggle } : {}),\n detail: mode.detail ?? (mode.activation === 'activating' ? 'activating' : ''),\n unavailableReason: reason,\n };\n });\n const seen = new Set(rows.map((row) => row.name));\n for (const source of sources) {\n if (source.hideWhenMissing === true || (source.desktopOnly && !isDesktopClient())) continue;\n if (!seen.has(source.name)) {\n rows.push({\n name: source.name,\n id: source.modeId ?? source.name,\n keys: source.keys,\n availability: 'unavailable',\n ...presented(source),\n detail: '',\n unavailableReason: 'No package in this session registers this mode.',\n });\n }\n }\n return rows;\n}\n\nexport function minorModes(\n statuses: Record<string, string>,\n widgets: readonly string[],\n projection: MinorModeProjection | null = null,\n): MinorMode[] {\n const declared = pluginMinorModes();\n const sources: readonly MinorModeSource[] = declared.length > 0 ? declared : PACKAGED_MINOR_MODES;\n if (projection) return catalogMinorModes(sources, projection);\n return sources.flatMap((source) => {\n if (source.desktopOnly && !isDesktopClient()) return [];\n if (source.statusKey !== undefined) {\n const raw = statuses[source.statusKey];\n if (raw === undefined) {\n if (source.hideWhenMissing === true) return [];\n return [\n {\n name: source.name,\n id: source.modeId ?? source.name,\n keys: source.keys,\n availability: 'unavailable' as const,\n ...presented(source),\n detail: '',\n unavailableReason: 'This session has not reported the mode.',\n },\n ];\n }\n const detail = stripAnsi(raw).trim();\n return {\n name: source.name,\n id: source.modeId ?? source.name,\n keys: source.keys,\n availability: detail ? ('on' as const) : ('off' as const),\n ...presented(source),\n detail,\n unavailableReason: '',\n };\n }\n if (source.widgetKey !== undefined && widgets.includes(source.widgetKey)) {\n return {\n name: source.name,\n id: source.modeId ?? source.name,\n keys: source.keys,\n availability: 'off' as const,\n ...presented(source),\n detail: '',\n unavailableReason: '',\n };\n }\n return {\n name: source.name,\n id: source.name,\n keys: source.keys,\n availability: 'unavailable' as const,\n ...presented(source),\n detail: '',\n unavailableReason: 'This session has not reported the mode.',\n };\n });\n}\n\nexport interface ActivityGroup {\n name: string;\n keys: string;\n /** The heading visual its package declares; the dock draws a generic one without it. */\n icon?: ActivityGroupContribution['icon'];\n /** What the publishing extension is reporting, empty when it reports nothing. */\n summary: string;\n active: boolean;\n marksBackgroundWork?: boolean;\n collapsible?: boolean;\n /** The temporary tab the group's name opens, when its package declares one. */\n transientTab?: () => TransientTab;\n /** Keeps the group visible below the dock's scrolling ordinary groups. */\n placement?: 'bottom';\n}\n\n/** Subscribe to package-owned activity sources, rewiring when the focused composition changes. */\nexport function subscribeActivitySources(listener: () => void): () => void {\n let subscriptions: (() => void)[] = [];\n const unsubscribeSources = (): void => {\n subscriptions.forEach((unsubscribe) => unsubscribe());\n subscriptions = [];\n };\n const subscribeSources = (): void => {\n subscriptions = pluginActivityGroups().flatMap((source) =>\n source.activeSource === undefined ? [] : [source.activeSource.subscribe(listener)],\n );\n };\n subscribeSources();\n const unsubscribeRegistry = subscribeWebPluginRegistry(() => {\n unsubscribeSources();\n subscribeSources();\n listener();\n });\n return () => {\n unsubscribeRegistry();\n unsubscribeSources();\n };\n}\n\nfunction activitySourceFingerprint(sessionId: string | null): string {\n const activeSources = pluginActivityGroups()\n .map((source) => (source.activeSource?.isActive(sessionId) === true ? '1' : '0'))\n .join('');\n return `${webPluginRegistryRevision()}:${activeSources}`;\n}\n\n/**\n * The groups available in this plugin composition. Status and widget signals\n * reveal legacy groups. A package-owned active source also reveals its group,\n * including while idle, so the section can remain a stable launcher unless it\n * opts into `hideWhenEmpty`.\n *\n * A group that declared `hideWhenEmpty` goes away once its session stops\n * reporting. Clearing a status reaches the page as an empty string rather than\n * an absent key, because the same map tells the selection bar which minor modes\n * exist and an absent key means \"not reported\" there. Emptiness is read here,\n * where only the dock is looking.\n */\nexport function activityGroups(\n statuses: Record<string, string>,\n widgets: readonly string[],\n sessionId: string | null = null,\n): ActivityGroup[] {\n const groups: ActivityGroup[] = [];\n for (const source of pluginActivityGroups()) {\n const tab = source.transientTab === undefined ? {} : { transientTab: source.transientTab };\n const placement = {\n ...(source.placement === undefined ? {} : { placement: source.placement }),\n ...(source.marksBackgroundWork === false ? { marksBackgroundWork: false } : {}),\n ...(source.collapsible === false ? { collapsible: false } : {}),\n ...(source.icon === undefined ? {} : { icon: source.icon }),\n };\n if (source.statusKey !== undefined && statuses[source.statusKey] !== undefined) {\n const summary = stripAnsi(statuses[source.statusKey] ?? '').trim();\n const active =\n source.activeSource?.isActive(sessionId) ?? (source.marksBackgroundWork !== false && summary.length > 0);\n if (summary.length === 0 && source.hideWhenEmpty === true && !active) continue;\n groups.push({ name: source.name, keys: source.keys, summary, active, ...tab, ...placement });\n continue;\n }\n if (source.widgetKeys !== undefined && source.widgetKeys.some((key) => widgets.includes(key))) {\n const activeKeys = source.activeWidgetKeys ?? source.widgetKeys;\n const active =\n source.activeSource?.isActive(sessionId) ??\n (source.marksBackgroundWork !== false && activeKeys.some((key) => widgets.includes(key)));\n groups.push({ name: source.name, keys: source.keys, summary: '', active, ...tab, ...placement });\n continue;\n }\n if (source.activeSource !== undefined) {\n const active = source.activeSource.isActive(sessionId);\n if (source.hideWhenEmpty === true && !active) continue;\n groups.push({\n name: source.name,\n keys: source.keys,\n summary: '',\n active,\n ...tab,\n ...placement,\n });\n }\n }\n return groups;\n}\n\n/** Dock faces update when the active session composition changes. */\nexport function useDockFaces(sessionId: string | null): readonly DockFaceContribution[] {\n useSyncExternalStore(subscribeWebPluginRegistry, webPluginRegistryRevision, webPluginRegistryRevision);\n const subscribe = (listener: () => void) => {\n const releases = pluginDockFaces().flatMap((face) =>\n face.visibility ? [face.visibility.subscribe(listener)] : [],\n );\n return () => releases.forEach((release) => release());\n };\n const snapshot = () =>\n pluginDockFaces()\n .map((face) => (face.visibility?.isVisible(sessionId) !== false ? '1' : '0'))\n .join('');\n useSyncExternalStore(subscribe, snapshot, snapshot);\n return pluginDockFaces().filter((face) => face.visibility?.isVisible(sessionId) !== false);\n}\n\n/** Each face's badge count for the session, re-read when a face reports a change. */\nexport function useDockFaceBadges(\n faces: readonly DockFaceContribution[],\n sessionId: string | null,\n): Readonly<Record<string, number>> {\n const subscribe = (listener: () => void) => {\n const releases = faces.flatMap((face) => (face.badge ? [face.badge.subscribe(listener)] : []));\n return () => releases.forEach((release) => release());\n };\n // A string snapshot keeps useSyncExternalStore stable between unrelated renders.\n const snapshot = () =>\n faces.map((face) => `${face.id}=${face.badge ? Math.max(0, face.badge.count(sessionId)) : 0}`).join('\\n');\n const counts = useSyncExternalStore(subscribe, snapshot, snapshot);\n return Object.fromEntries(\n counts\n .split('\\n')\n .filter(Boolean)\n .map((entry) => {\n const separator = entry.lastIndexOf('=');\n return [entry.slice(0, separator), Number(entry.slice(separator + 1))];\n }),\n );\n}\n\n/** Activity groups that update when either host signals or a plugin's session store changes. */\nexport function useActivityGroups(\n statuses: Record<string, string>,\n widgets: readonly string[],\n sessionId: string | null,\n): ActivityGroup[] {\n useSyncExternalStore(\n subscribeActivitySources,\n () => activitySourceFingerprint(sessionId),\n () => activitySourceFingerprint(sessionId),\n );\n return activityGroups(statuses, widgets, sessionId);\n}\n\n/** The tab one path opens, or undefined when no installed plugin recognises it. */\nexport type FileLinkResolver = (path: string) => TransientTab | undefined;\n\ninterface FileLinkModes {\n active(sessionId: string | null): readonly string[];\n subscribe(sessionId: string | null, listener: () => void): () => void;\n}\nlet fileLinkModes: FileLinkModes | undefined;\nconst modeBindings = new Set<() => void>();\n\n/** Binds host session facts without making the composition library own session state. */\nexport function bindFileLinkModes(source: FileLinkModes): () => void {\n fileLinkModes = source;\n modeBindings.forEach((listener) => listener());\n return () => {\n if (fileLinkModes !== source) return;\n fileLinkModes = undefined;\n modeBindings.forEach((listener) => listener());\n };\n}\nfunction subscribeFileLinks(sessionId: string | null, listener: () => void): () => void {\n let unsubscribeModes = fileLinkModes?.subscribe(sessionId, listener);\n const rebindModes = () => {\n unsubscribeModes?.();\n unsubscribeModes = fileLinkModes?.subscribe(sessionId, listener);\n listener();\n };\n modeBindings.add(rebindModes);\n let subscriptions: (() => void)[] = [];\n const unsubscribeSources = (): void => {\n subscriptions.forEach((unsubscribe) => unsubscribe());\n subscriptions = [];\n };\n const subscribeSources = (): void => {\n subscriptions = pluginFileLinks().map((source) => source.subscribe(listener));\n };\n subscribeSources();\n const unsubscribeRegistry = subscribeWebPluginRegistry(() => {\n unsubscribeSources();\n subscribeSources();\n listener();\n });\n return () => {\n modeBindings.delete(rebindModes);\n unsubscribeModes?.();\n unsubscribeRegistry();\n unsubscribeSources();\n };\n}\n\nfunction activeFileLinkSources(sessionId: string | null) {\n const enabled = new Set(fileLinkModes?.active(sessionId) ?? []);\n return pluginFileLinks(sessionId).filter(\n (source) => source.requiredMinorMode === undefined || enabled.has(source.requiredMinorMode),\n );\n}\n\nfunction fileLinkFingerprint(sessionId: string | null): string {\n const sourceFingerprints = activeFileLinkSources(sessionId)\n .map((source) => `${source.requiredMinorMode ?? ''}:${source.fingerprint(sessionId)}`)\n .join('\\n');\n return `${webPluginRegistryRevision()}:${sourceFingerprints}`;\n}\n\n/**\n * The tab a path opens, from the first source that claims it.\n *\n * A path no source claims is not a link. The host cannot tell a file name from\n * a class name, and the plugin that tracks the session's files can, so the\n * decision belongs there rather than in a heuristic here.\n */\nexport function fileLinkFor(sessionId: string | null, path: string): TransientTab | undefined {\n for (const source of activeFileLinkSources(sessionId)) {\n const tab = source.resolve(sessionId, path);\n if (tab !== undefined) return tab;\n }\n return undefined;\n}\n\n/** References plugins that own a path namespace offer for an `@` being typed, such as `artifact:plan.md`. */\nexport function fileLinkMentions(sessionId: string, query: string): FileLinkMention[] {\n return activeFileLinkSources(sessionId).flatMap((source) => source.mentions?.(sessionId, query) ?? []);\n}\n\n/**\n * The tab a path the caller is sure about opens: a tool call's path argument,\n * not a token spotted in prose.\n *\n * A source that offers `openPath` answers here, and it may claim a file the\n * session never changed, which `resolve` deliberately will not. Sources\n * without it fall back to the same guess prose gets.\n */\nexport function fileTabForPath(sessionId: string | null, path: string): TransientTab | undefined {\n for (const source of activeFileLinkSources(sessionId)) {\n const tab = source.openPath?.(sessionId, path) ?? source.resolve(sessionId, path);\n if (tab !== undefined) return tab;\n }\n return undefined;\n}\n/**\n * Resolves the paths a message names against the plugins that track them.\n *\n * The resolver's identity is stable while the linkable set is, so a component\n * that hands it to a renderer does not rebuild that renderer on every frame of\n * a streaming reply.\n */\nexport function useFileLinks(sessionId: string | null): FileLinkResolver {\n const fingerprint = useSyncExternalStore(\n useCallback((listener: () => void) => subscribeFileLinks(sessionId, listener), [sessionId]),\n () => fileLinkFingerprint(sessionId),\n () => fileLinkFingerprint(sessionId),\n );\n return useCallback(\n (path: string) => fileLinkFor(sessionId, path),\n // The fingerprint is the dependency: the same path resolves differently\n // once the session's set of tracked files changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps -- fingerprint is a deliberate identity buster, not a value the callback reads.\n [sessionId, fingerprint],\n );\n}\n"],"mappings":";;;;AAgCA,MAAM,sBAAsB;;;;;;;AAQ5B,MAAa,0BAAgE,CAC3E;CAAE,MAAM;CAAW,SAAS;CAAW,WAAW;CAAc,YAAY;CAAQ,OAAO;AAAG,GAC9F;CAAE,MAAM;CAAW,SAAS;CAAW,WAAW;CAAa,YAAY;CAAc,OAAO;CAAM,OAAO;AAAG,CAClH;;;;;;AAOA,SAAgB,cAAc,UAAmD;CAC/E,MAAM,WAAWA,uBAAAA,oBAAoB;CAErC,QADsD,SAAS,SAAS,IAAI,WAAW,wBAAA,CACxE,SAAS,WAAW;EACjC,MAAM,MAAM,SAAS,OAAO;EAC5B,IAAI,QAAQ,KAAA,GAAW,OAAO,CAAC;EAC/B,MAAM,QAAQ,OAAO,UAAU;EAC/B,MAAM,UAAU,QAAQC,mBAAAA,UAAU,GAAG,CAAC,CAAC,MAAM,mBAAmB,IAAI,CAACA,mBAAAA,UAAU,GAAG,CAAC,EAAA,CAChF,KAAK,UAAU,MAAM,KAAK,CAAC,CAAC,CAC5B,OAAO,OAAO;EACjB,OAAO,CAAC;GAAE,MAAM,OAAO;GAAM,SAAS,OAAO;GAAS;GAAQ,YAAY,OAAO;GAAY;EAAM,CAAC;CACtG,CAAC;AACH;;;;;;;;;;;AAqDA,MAAa,uBAAmD;CAC9D;EAAE,MAAM;EAAQ,MAAM;CAAM;CAC5B;EAAE,MAAM;EAAQ,MAAM;EAAO,WAAW;CAAY;CACpD;EAAE,MAAM;EAAQ,MAAM;EAAO,WAAW;CAAO;CAC/C;EAAE,MAAM;EAAU,MAAM;CAAM;CAE9B;EAAE,MAAM;EAAS,QAAQ;EAAc,MAAM;EAAO,WAAW;CAAW;CAC1E;EACE,MAAM;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oB,SAAS,SAC7B,oBAAoB,SAAS,CACrC;CACA,QAAA,GAAOA,MAAAA,YAAAA,EACJ,SAAiB,YAAY,WAAW,IAAI,GAI7C,CAAC,WAAW,WAAW,CACzB;AACF"}
@@ -81,6 +81,7 @@ export interface ActivityGroup {
81
81
  summary: string;
82
82
  active: boolean;
83
83
  marksBackgroundWork?: boolean;
84
+ collapsible?: boolean;
84
85
  /** The temporary tab the group's name opens, when its package declares one. */
85
86
  transientTab?: () => TransientTab;
86
87
  /** Keeps the group visible below the dock's scrolling ordinary groups. */
@@ -1 +1 @@
1
- {"version":3,"file":"composition.d.mts","names":[],"sources":["../../../src/web/lib/composition.ts"],"mappings":";;;iBAuBiB;EACf;EACA;;EAEA;EACA;EACA;;;;;;;;qBAWW,kCAAkC;;;;;;wBAU/B,cAAc,UAAU,yBAAyB;YAcrD;iBAEK;EACf;;EAEA;;EAEA;EACA,cAAc;;EAEd;;EAEA;;EAEA,OAAO;;EAEP;;;;;;;EAOA;;iBAGe;EACf;;EAEA;;EAEA;;EAEA;EACA,OAAO;EACP;EACA;EACA;EACA;;;;;;;;;;;;qBAaW,+BAA+B;wBAgF5B,WACd,UAAU,wBACV,4BACA,aAAY,6BACX;iBAwDc;EACf;EACA;;EAEA,OAAO;;EAEP;EACA;EACA;;EAEA,qBAAqB;;EAErB;;;wBAIc,yBAAyB;;;;;;;;;;;;;wBA0CzB,eACd,UAAU,wBACV,4BACA,4BACC;;wBA0Ca,aAAa,oCAAoC;;wBAiBjD,kBACd,gBAAgB,wBAChB,2BACC,SAAS;;wBAqBI,kBACd,UAAU,wBACV,4BACA,2BACC;;YAUS,oBAAoB,iBAAiB;UAEvC;EACR,OAAO;EACP,UAAU,0BAA0B;;;wBAMtB,kBAAkB,QAAQ;;;;;;;;wBA4D1B,YAAY,0BAA0B,eAAe;;wBASrD,iBAAiB,mBAAmB,gBAAgB;;;;;;;;;wBAYpD,eAAe,0BAA0B,eAAe;;;;;;;;wBAcxD,aAAa,2BAA2B"}
1
+ {"version":3,"file":"composition.d.mts","names":[],"sources":["../../../src/web/lib/composition.ts"],"mappings":";;;iBAuBiB;EACf;EACA;;EAEA;EACA;EACA;;;;;;;;qBAWW,kCAAkC;;;;;;wBAU/B,cAAc,UAAU,yBAAyB;YAcrD;iBAEK;EACf;;EAEA;;EAEA;EACA,cAAc;;EAEd;;EAEA;;EAEA,OAAO;;EAEP;;;;;;;EAOA;;iBAGe;EACf;;EAEA;;EAEA;;EAEA;EACA,OAAO;EACP;EACA;EACA;EACA;;;;;;;;;;;;qBAaW,+BAA+B;wBAgF5B,WACd,UAAU,wBACV,4BACA,aAAY,6BACX;iBAwDc;EACf;EACA;;EAEA,OAAO;;EAEP;EACA;EACA;EACA;;EAEA,qBAAqB;;EAErB;;;wBAIc,yBAAyB;;;;;;;;;;;;;wBA0CzB,eACd,UAAU,wBACV,4BACA,4BACC;;wBA2Ca,aAAa,oCAAoC;;wBAiBjD,kBACd,gBAAgB,wBAChB,2BACC,SAAS;;wBAqBI,kBACd,UAAU,wBACV,4BACA,2BACC;;YAUS,oBAAoB,iBAAiB;UAEvC;EACR,OAAO;EACP,UAAU,0BAA0B;;;wBAMtB,kBAAkB,QAAQ;;;;;;;;wBA4D1B,YAAY,0BAA0B,eAAe;;wBASrD,iBAAiB,mBAAmB,gBAAgB;;;;;;;;;wBAYpD,eAAe,0BAA0B,eAAe;;;;;;;;wBAcxD,aAAa,2BAA2B"}
@@ -238,6 +238,7 @@ function activityGroups(statuses, widgets, sessionId = null) {
238
238
  const placement = {
239
239
  ...source.placement === void 0 ? {} : { placement: source.placement },
240
240
  ...source.marksBackgroundWork === false ? { marksBackgroundWork: false } : {},
241
+ ...source.collapsible === false ? { collapsible: false } : {},
241
242
  ...source.icon === void 0 ? {} : { icon: source.icon }
242
243
  };
243
244
  if (source.statusKey !== void 0 && statuses[source.statusKey] !== void 0) {
@@ -1 +1 @@
1
- {"version":3,"file":"composition.mjs","names":[],"sources":["../../../src/web/lib/composition.ts"],"sourcesContent":["import type {\n ActivityGroupContribution,\n DockFaceContribution,\n FileLinkMention,\n MinorModeContribution,\n SelectionAxisContribution,\n TransientTab,\n} from '@agimon-ai/po-core/web';\nimport { useCallback, useSyncExternalStore } from 'react';\n\nimport type { MinorModeProjection, MinorModeRecordProjection } from '../../types/hub';\nimport {\n isDesktopClient,\n pluginActivityGroups,\n pluginDockFaces,\n pluginFileLinks,\n pluginMinorModes,\n pluginSelectionAxes,\n subscribeWebPluginRegistry,\n webPluginRegistryRevision,\n} from './pluginRegistry';\nimport { stripAnsi } from './statusLine';\n\nexport interface SelectionAxis {\n name: string;\n command: string;\n /** The current selections, empty while the session reports none; one at most unless multi. */\n values: string[];\n emptyLabel: string;\n multi: boolean;\n}\n\nconst AXIS_LIST_SEPARATOR = ',';\n\n/**\n * The fallback axis table for the packaged bundle; a synced bundle carries\n * each axis as its owning package's plugin declaration, and the registry\n * list wins whenever any plugin declares one. Exported only so the workspace\n * composition test can hold it equal to what the packages declare.\n */\nexport const PACKAGED_SELECTION_AXES: readonly SelectionAxisContribution[] = [\n { name: 'profile', command: 'profile', statusKey: 'po-profile', emptyLabel: 'None', order: 10 },\n { name: 'domains', command: 'domains', statusKey: 'po-domain', emptyLabel: 'no domains', multi: true, order: 20 },\n];\n\n/**\n * The declared axes the session actually offers: an axis whose status key\n * the session never published stays off the bar entirely, which is how a\n * package withholds its axis when there is nothing to select.\n */\nexport function selectionAxes(statuses: Record<string, string>): SelectionAxis[] {\n const declared = pluginSelectionAxes();\n const sources: readonly SelectionAxisContribution[] = declared.length > 0 ? declared : PACKAGED_SELECTION_AXES;\n return sources.flatMap((source) => {\n const raw = statuses[source.statusKey];\n if (raw === undefined) return [];\n const multi = source.multi === true;\n const values = (multi ? stripAnsi(raw).split(AXIS_LIST_SEPARATOR) : [stripAnsi(raw)])\n .map((value) => value.trim())\n .filter(Boolean);\n return [{ name: source.name, command: source.command, values, emptyLabel: source.emptyLabel, multi }];\n });\n}\n\nexport type MinorModeAvailability = 'unavailable' | 'off' | 'on';\n\nexport interface MinorMode {\n name: string;\n /** The catalog id /minor accepts; the display name until the catalog reports. */\n id: string;\n /** Leader Space key path, as the TUI documents it. */\n keys: string;\n availability: MinorModeAvailability;\n /** What the mode itself is reporting while on. */\n detail: string;\n /** Activity group to focus instead of invoking the mode command from the cockpit. */\n activityGroup?: string;\n /** The mark the mode's package declares; the host draws a generic one without it. */\n icon?: MinorModeContribution['icon'];\n /** The action that flips the row in one click, when the mode offers it without input. */\n toggle?: 'activate' | 'deactivate';\n /**\n * Why the mode cannot be driven from here, in the words of the mode itself.\n * Empty when it can. A mode may be installed and still refuse a cockpit:\n * autonomous voice captures from the terminal's own microphone, which a\n * browser talking to a headless agent does not have.\n */\n unavailableReason: string;\n}\n\nexport interface MinorModeSource {\n name: string;\n /** The catalog mode this row drives, when the runtime registers it under another id. */\n modeId?: string;\n /** Leader Space key path, as the TUI documents it. */\n keys: string;\n /** Activity group to focus instead of invoking the mode command from the cockpit. */\n activityGroup?: string;\n icon?: MinorModeContribution['icon'];\n statusKey?: string;\n widgetKey?: string;\n hideWhenMissing?: boolean;\n desktopOnly?: boolean;\n}\n\n/**\n * The fallback minor-mode table for the packaged bundle.\n *\n * A synced bundle carries each mode as its package's own web plugin\n * contribution, and the registry list wins whenever any plugin declares one.\n * This literal survives only so the built-in-only bundle keeps rendering the\n * modes Po ships; help is listed without a signal on purpose: it\n * registers no footer entry, so the cockpit reports it as unavailable rather\n * than guessing it is off. Exported only for the workspace composition test.\n */\nexport const PACKAGED_MINOR_MODES: readonly MinorModeSource[] = [\n { name: 'help', keys: 'h e' },\n { name: 'plan', keys: 'p e', statusKey: 'plan-mode' },\n { name: 'goal', keys: 'g e', statusKey: 'goal' },\n { name: 'author', keys: 'o a' },\n // `v e` drives autonomous capture, which the runtime registers as 'voice-auto'.\n { name: 'voice', modeId: 'voice-auto', keys: 'v e', statusKey: 'po-voice' },\n {\n name: 'computer use',\n modeId: 'computer-use',\n keys: 'c e',\n statusKey: 'po-computer-use-mode',\n hideWhenMissing: true,\n },\n];\n\n/** What a mode's own package declares about how its row looks and where it leads. */\nfunction presented(source: MinorModeSource | undefined): Pick<MinorMode, 'activityGroup' | 'icon'> {\n return {\n ...(source?.activityGroup === undefined ? {} : { activityGroup: source.activityGroup }),\n ...(source?.icon === undefined ? {} : { icon: source.icon }),\n };\n}\n\n/** The declared source a catalog mode corresponds to, by id, id stem, or label. */\nfunction sourceFor(sources: readonly MinorModeSource[], mode: MinorModeRecordProjection): MinorModeSource | undefined {\n const candidates = new Set([mode.id.toLowerCase(), mode.id.toLowerCase().split('.')[0], mode.label.toLowerCase()]);\n return sources.find((source) =>\n [source.name, source.modeId].some((identity) => identity !== undefined && candidates.has(identity.toLowerCase())),\n );\n}\n\n/**\n * Catalog-backed rows: the runtime's own activation state per mode, with the\n * declared leader keys attached where a plugin documents them. Declared modes\n * the catalog does not know are still listed, as unavailable, so a mode that\n * is missing from a composition stays visible rather than silently gone.\n */\nfunction catalogMinorModes(sources: readonly MinorModeSource[], projection: MinorModeProjection): MinorMode[] {\n const rows: MinorMode[] = projection.modes\n .filter((mode) => !sourceFor(sources, mode)?.desktopOnly || isDesktopClient())\n .map((mode) => {\n const source = sourceFor(sources, mode);\n const on = mode.activation === 'active' || mode.activation === 'deactivating';\n // The catalog says per action whether it can run here and why not. A mode\n // with nothing runnable is offered as a row that cannot be clicked rather\n // than one that answers \"no actions available\" after the fact.\n const blocked = mode.actions.length > 0 && mode.actions.every((action) => !action.enabled);\n const reason = blocked ? (mode.actions.find((action) => action.disabledReason)?.disabledReason ?? '') : '';\n const toggle = on ? 'deactivate' : 'activate';\n const flips = mode.actions.some((action) => action.id === toggle && action.enabled && !action.needsInput);\n return {\n name: source?.name ?? mode.label.toLowerCase(),\n id: mode.id,\n keys: source?.keys ?? '',\n availability: blocked && !on ? 'unavailable' : on ? 'on' : 'off',\n ...presented(source),\n ...(flips ? { toggle } : {}),\n detail: mode.detail ?? (mode.activation === 'activating' ? 'activating' : ''),\n unavailableReason: reason,\n };\n });\n const seen = new Set(rows.map((row) => row.name));\n for (const source of sources) {\n if (source.hideWhenMissing === true || (source.desktopOnly && !isDesktopClient())) continue;\n if (!seen.has(source.name)) {\n rows.push({\n name: source.name,\n id: source.modeId ?? source.name,\n keys: source.keys,\n availability: 'unavailable',\n ...presented(source),\n detail: '',\n unavailableReason: 'No package in this session registers this mode.',\n });\n }\n }\n return rows;\n}\n\nexport function minorModes(\n statuses: Record<string, string>,\n widgets: readonly string[],\n projection: MinorModeProjection | null = null,\n): MinorMode[] {\n const declared = pluginMinorModes();\n const sources: readonly MinorModeSource[] = declared.length > 0 ? declared : PACKAGED_MINOR_MODES;\n if (projection) return catalogMinorModes(sources, projection);\n return sources.flatMap((source) => {\n if (source.desktopOnly && !isDesktopClient()) return [];\n if (source.statusKey !== undefined) {\n const raw = statuses[source.statusKey];\n if (raw === undefined) {\n if (source.hideWhenMissing === true) return [];\n return [\n {\n name: source.name,\n id: source.modeId ?? source.name,\n keys: source.keys,\n availability: 'unavailable' as const,\n ...presented(source),\n detail: '',\n unavailableReason: 'This session has not reported the mode.',\n },\n ];\n }\n const detail = stripAnsi(raw).trim();\n return {\n name: source.name,\n id: source.modeId ?? source.name,\n keys: source.keys,\n availability: detail ? ('on' as const) : ('off' as const),\n ...presented(source),\n detail,\n unavailableReason: '',\n };\n }\n if (source.widgetKey !== undefined && widgets.includes(source.widgetKey)) {\n return {\n name: source.name,\n id: source.modeId ?? source.name,\n keys: source.keys,\n availability: 'off' as const,\n ...presented(source),\n detail: '',\n unavailableReason: '',\n };\n }\n return {\n name: source.name,\n id: source.name,\n keys: source.keys,\n availability: 'unavailable' as const,\n ...presented(source),\n detail: '',\n unavailableReason: 'This session has not reported the mode.',\n };\n });\n}\n\nexport interface ActivityGroup {\n name: string;\n keys: string;\n /** The heading visual its package declares; the dock draws a generic one without it. */\n icon?: ActivityGroupContribution['icon'];\n /** What the publishing extension is reporting, empty when it reports nothing. */\n summary: string;\n active: boolean;\n marksBackgroundWork?: boolean;\n /** The temporary tab the group's name opens, when its package declares one. */\n transientTab?: () => TransientTab;\n /** Keeps the group visible below the dock's scrolling ordinary groups. */\n placement?: 'bottom';\n}\n\n/** Subscribe to package-owned activity sources, rewiring when the focused composition changes. */\nexport function subscribeActivitySources(listener: () => void): () => void {\n let subscriptions: (() => void)[] = [];\n const unsubscribeSources = (): void => {\n subscriptions.forEach((unsubscribe) => unsubscribe());\n subscriptions = [];\n };\n const subscribeSources = (): void => {\n subscriptions = pluginActivityGroups().flatMap((source) =>\n source.activeSource === undefined ? [] : [source.activeSource.subscribe(listener)],\n );\n };\n subscribeSources();\n const unsubscribeRegistry = subscribeWebPluginRegistry(() => {\n unsubscribeSources();\n subscribeSources();\n listener();\n });\n return () => {\n unsubscribeRegistry();\n unsubscribeSources();\n };\n}\n\nfunction activitySourceFingerprint(sessionId: string | null): string {\n const activeSources = pluginActivityGroups()\n .map((source) => (source.activeSource?.isActive(sessionId) === true ? '1' : '0'))\n .join('');\n return `${webPluginRegistryRevision()}:${activeSources}`;\n}\n\n/**\n * The groups available in this plugin composition. Status and widget signals\n * reveal legacy groups. A package-owned active source also reveals its group,\n * including while idle, so the section can remain a stable launcher unless it\n * opts into `hideWhenEmpty`.\n *\n * A group that declared `hideWhenEmpty` goes away once its session stops\n * reporting. Clearing a status reaches the page as an empty string rather than\n * an absent key, because the same map tells the selection bar which minor modes\n * exist and an absent key means \"not reported\" there. Emptiness is read here,\n * where only the dock is looking.\n */\nexport function activityGroups(\n statuses: Record<string, string>,\n widgets: readonly string[],\n sessionId: string | null = null,\n): ActivityGroup[] {\n const groups: ActivityGroup[] = [];\n for (const source of pluginActivityGroups()) {\n const tab = source.transientTab === undefined ? {} : { transientTab: source.transientTab };\n const placement = {\n ...(source.placement === undefined ? {} : { placement: source.placement }),\n ...(source.marksBackgroundWork === false ? { marksBackgroundWork: false } : {}),\n ...(source.icon === undefined ? {} : { icon: source.icon }),\n };\n if (source.statusKey !== undefined && statuses[source.statusKey] !== undefined) {\n const summary = stripAnsi(statuses[source.statusKey] ?? '').trim();\n const active =\n source.activeSource?.isActive(sessionId) ?? (source.marksBackgroundWork !== false && summary.length > 0);\n if (summary.length === 0 && source.hideWhenEmpty === true && !active) continue;\n groups.push({ name: source.name, keys: source.keys, summary, active, ...tab, ...placement });\n continue;\n }\n if (source.widgetKeys !== undefined && source.widgetKeys.some((key) => widgets.includes(key))) {\n const activeKeys = source.activeWidgetKeys ?? source.widgetKeys;\n const active =\n source.activeSource?.isActive(sessionId) ??\n (source.marksBackgroundWork !== false && activeKeys.some((key) => widgets.includes(key)));\n groups.push({ name: source.name, keys: source.keys, summary: '', active, ...tab, ...placement });\n continue;\n }\n if (source.activeSource !== undefined) {\n const active = source.activeSource.isActive(sessionId);\n if (source.hideWhenEmpty === true && !active) continue;\n groups.push({\n name: source.name,\n keys: source.keys,\n summary: '',\n active,\n ...tab,\n ...placement,\n });\n }\n }\n return groups;\n}\n\n/** Dock faces update when the active session composition changes. */\nexport function useDockFaces(sessionId: string | null): readonly DockFaceContribution[] {\n useSyncExternalStore(subscribeWebPluginRegistry, webPluginRegistryRevision, webPluginRegistryRevision);\n const subscribe = (listener: () => void) => {\n const releases = pluginDockFaces().flatMap((face) =>\n face.visibility ? [face.visibility.subscribe(listener)] : [],\n );\n return () => releases.forEach((release) => release());\n };\n const snapshot = () =>\n pluginDockFaces()\n .map((face) => (face.visibility?.isVisible(sessionId) !== false ? '1' : '0'))\n .join('');\n useSyncExternalStore(subscribe, snapshot, snapshot);\n return pluginDockFaces().filter((face) => face.visibility?.isVisible(sessionId) !== false);\n}\n\n/** Each face's badge count for the session, re-read when a face reports a change. */\nexport function useDockFaceBadges(\n faces: readonly DockFaceContribution[],\n sessionId: string | null,\n): Readonly<Record<string, number>> {\n const subscribe = (listener: () => void) => {\n const releases = faces.flatMap((face) => (face.badge ? [face.badge.subscribe(listener)] : []));\n return () => releases.forEach((release) => release());\n };\n // A string snapshot keeps useSyncExternalStore stable between unrelated renders.\n const snapshot = () =>\n faces.map((face) => `${face.id}=${face.badge ? Math.max(0, face.badge.count(sessionId)) : 0}`).join('\\n');\n const counts = useSyncExternalStore(subscribe, snapshot, snapshot);\n return Object.fromEntries(\n counts\n .split('\\n')\n .filter(Boolean)\n .map((entry) => {\n const separator = entry.lastIndexOf('=');\n return [entry.slice(0, separator), Number(entry.slice(separator + 1))];\n }),\n );\n}\n\n/** Activity groups that update when either host signals or a plugin's session store changes. */\nexport function useActivityGroups(\n statuses: Record<string, string>,\n widgets: readonly string[],\n sessionId: string | null,\n): ActivityGroup[] {\n useSyncExternalStore(\n subscribeActivitySources,\n () => activitySourceFingerprint(sessionId),\n () => activitySourceFingerprint(sessionId),\n );\n return activityGroups(statuses, widgets, sessionId);\n}\n\n/** The tab one path opens, or undefined when no installed plugin recognises it. */\nexport type FileLinkResolver = (path: string) => TransientTab | undefined;\n\ninterface FileLinkModes {\n active(sessionId: string | null): readonly string[];\n subscribe(sessionId: string | null, listener: () => void): () => void;\n}\nlet fileLinkModes: FileLinkModes | undefined;\nconst modeBindings = new Set<() => void>();\n\n/** Binds host session facts without making the composition library own session state. */\nexport function bindFileLinkModes(source: FileLinkModes): () => void {\n fileLinkModes = source;\n modeBindings.forEach((listener) => listener());\n return () => {\n if (fileLinkModes !== source) return;\n fileLinkModes = undefined;\n modeBindings.forEach((listener) => listener());\n };\n}\nfunction subscribeFileLinks(sessionId: string | null, listener: () => void): () => void {\n let unsubscribeModes = fileLinkModes?.subscribe(sessionId, listener);\n const rebindModes = () => {\n unsubscribeModes?.();\n unsubscribeModes = fileLinkModes?.subscribe(sessionId, listener);\n listener();\n };\n modeBindings.add(rebindModes);\n let subscriptions: (() => void)[] = [];\n const unsubscribeSources = (): void => {\n subscriptions.forEach((unsubscribe) => unsubscribe());\n subscriptions = [];\n };\n const subscribeSources = (): void => {\n subscriptions = pluginFileLinks().map((source) => source.subscribe(listener));\n };\n subscribeSources();\n const unsubscribeRegistry = subscribeWebPluginRegistry(() => {\n unsubscribeSources();\n subscribeSources();\n listener();\n });\n return () => {\n modeBindings.delete(rebindModes);\n unsubscribeModes?.();\n unsubscribeRegistry();\n unsubscribeSources();\n };\n}\n\nfunction activeFileLinkSources(sessionId: string | null) {\n const enabled = new Set(fileLinkModes?.active(sessionId) ?? []);\n return pluginFileLinks(sessionId).filter(\n (source) => source.requiredMinorMode === undefined || enabled.has(source.requiredMinorMode),\n );\n}\n\nfunction fileLinkFingerprint(sessionId: string | null): string {\n const sourceFingerprints = activeFileLinkSources(sessionId)\n .map((source) => `${source.requiredMinorMode ?? ''}:${source.fingerprint(sessionId)}`)\n .join('\\n');\n return `${webPluginRegistryRevision()}:${sourceFingerprints}`;\n}\n\n/**\n * The tab a path opens, from the first source that claims it.\n *\n * A path no source claims is not a link. The host cannot tell a file name from\n * a class name, and the plugin that tracks the session's files can, so the\n * decision belongs there rather than in a heuristic here.\n */\nexport function fileLinkFor(sessionId: string | null, path: string): TransientTab | undefined {\n for (const source of activeFileLinkSources(sessionId)) {\n const tab = source.resolve(sessionId, path);\n if (tab !== undefined) return tab;\n }\n return undefined;\n}\n\n/** References plugins that own a path namespace offer for an `@` being typed, such as `artifact:plan.md`. */\nexport function fileLinkMentions(sessionId: string, query: string): FileLinkMention[] {\n return activeFileLinkSources(sessionId).flatMap((source) => source.mentions?.(sessionId, query) ?? []);\n}\n\n/**\n * The tab a path the caller is sure about opens: a tool call's path argument,\n * not a token spotted in prose.\n *\n * A source that offers `openPath` answers here, and it may claim a file the\n * session never changed, which `resolve` deliberately will not. Sources\n * without it fall back to the same guess prose gets.\n */\nexport function fileTabForPath(sessionId: string | null, path: string): TransientTab | undefined {\n for (const source of activeFileLinkSources(sessionId)) {\n const tab = source.openPath?.(sessionId, path) ?? source.resolve(sessionId, path);\n if (tab !== undefined) return tab;\n }\n return undefined;\n}\n/**\n * Resolves the paths a message names against the plugins that track them.\n *\n * The resolver's identity is stable while the linkable set is, so a component\n * that hands it to a renderer does not rebuild that renderer on every frame of\n * a streaming reply.\n */\nexport function useFileLinks(sessionId: string | null): FileLinkResolver {\n const fingerprint = useSyncExternalStore(\n useCallback((listener: () => void) => subscribeFileLinks(sessionId, listener), [sessionId]),\n () => fileLinkFingerprint(sessionId),\n () => fileLinkFingerprint(sessionId),\n );\n return useCallback(\n (path: string) => fileLinkFor(sessionId, path),\n // The fingerprint is the dependency: the same path resolves differently\n // once the session's set of tracked files changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps -- fingerprint is a deliberate identity buster, not a value the callback reads.\n [sessionId, fingerprint],\n );\n}\n"],"mappings":";;;;AAgCA,MAAM,sBAAsB;;;;;;;AAQ5B,MAAa,0BAAgE,CAC3E;CAAE,MAAM;CAAW,SAAS;CAAW,WAAW;CAAc,YAAY;CAAQ,OAAO;AAAG,GAC9F;CAAE,MAAM;CAAW,SAAS;CAAW,WAAW;CAAa,YAAY;CAAc,OAAO;CAAM,OAAO;AAAG,CAClH;;;;;;AAOA,SAAgB,cAAc,UAAmD;CAC/E,MAAM,WAAW,oBAAoB;CAErC,QADsD,SAAS,SAAS,IAAI,WAAW,wBAAA,CACxE,SAAS,WAAW;EACjC,MAAM,MAAM,SAAS,OAAO;EAC5B,IAAI,QAAQ,KAAA,GAAW,OAAO,CAAC;EAC/B,MAAM,QAAQ,OAAO,UAAU;EAC/B,MAAM,UAAU,QAAQ,UAAU,GAAG,CAAC,CAAC,MAAM,mBAAmB,IAAI,CAAC,UAAU,GAAG,CAAC,EAAA,CAChF,KAAK,UAAU,MAAM,KAAK,CAAC,CAAC,CAC5B,OAAO,OAAO;EACjB,OAAO,CAAC;GAAE,MAAM,OAAO;GAAM,SAAS,OAAO;GAAS;GAAQ,YAAY,OAAO;GAAY;EAAM,CAAC;CACtG,CAAC;AACH;;;;;;;;;;;AAqDA,MAAa,uBAAmD;CAC9D;EAAE,MAAM;EAAQ,MAAM;CAAM;CAC5B;EAAE,MAAM;EAAQ,MAAM;EAAO,WAAW;CAAY;CACpD;EAAE,MAAM;EAAQ,MAAM;EAAO,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AC,CAAC,QAC/B,WAAW,OAAO,sBAAsB,KAAA,KAAa,QAAQ,IAAI,OAAO,iBAAiB,CAC5F;AACF;AAEA,SAAS,oBAAoB,WAAkC;CAC7D,MAAM,qBAAqB,sBAAsB,SAAS,CAAC,CACxD,KAAK,WAAW,GAAG,OAAO,qBAAqB,GAAG,GAAG,OAAO,YAAY,SAAS,GAAG,CAAC,CACrF,KAAK,IAAI;CACZ,OAAO,GAAG,0BAA0B,EAAE,GAAG;AAC3C;;;;;;;;AASA,SAAgB,YAAY,WAA0B,MAAwC;CAC5F,KAAK,MAAM,UAAU,sBAAsB,SAAS,GAAG;EACrD,MAAM,MAAM,OAAO,QAAQ,WAAW,IAAI;EAC1C,IAAI,QAAQ,KAAA,GAAW,OAAO;CAChC;AAEF;;AAGA,SAAgB,iBAAiB,WAAmB,OAAkC;CACpF,OAAO,sBAAsB,SAAS,CAAC,CAAC,SAAS,WAAW,OAAO,WAAW,WAAW,KAAK,KAAK,CAAC,CAAC;AACvG;;;;;;;;;AAUA,SAAgB,eAAe,WAA0B,MAAwC;CAC/F,KAAK,MAAM,UAAU,sBAAsB,SAAS,GAAG;EACrD,MAAM,MAAM,OAAO,WAAW,WAAW,IAAI,KAAK,OAAO,QAAQ,WAAW,IAAI;EAChF,IAAI,QAAQ,KAAA,GAAW,OAAO;CAChC;AAEF;;;;;;;;AAQA,SAAgB,aAAa,WAA4C;CACvE,MAAM,cAAc,qBAClB,aAAa,aAAyB,mBAAmB,WAAW,QAAQ,GAAG,CAAC,SAAS,CAAC,SACpF,oBAAoB,SAAS,SAC7B,oBAAoB,SAAS,CACrC;CACA,OAAO,aACJ,SAAiB,YAAY,WAAW,IAAI,GAI7C,CAAC,WAAW,WAAW,CACzB;AACF"}
1
+ {"version":3,"file":"composition.mjs","names":[],"sources":["../../../src/web/lib/composition.ts"],"sourcesContent":["import type {\n ActivityGroupContribution,\n DockFaceContribution,\n FileLinkMention,\n MinorModeContribution,\n SelectionAxisContribution,\n TransientTab,\n} from '@agimon-ai/po-core/web';\nimport { useCallback, useSyncExternalStore } from 'react';\n\nimport type { MinorModeProjection, MinorModeRecordProjection } from '../../types/hub';\nimport {\n isDesktopClient,\n pluginActivityGroups,\n pluginDockFaces,\n pluginFileLinks,\n pluginMinorModes,\n pluginSelectionAxes,\n subscribeWebPluginRegistry,\n webPluginRegistryRevision,\n} from './pluginRegistry';\nimport { stripAnsi } from './statusLine';\n\nexport interface SelectionAxis {\n name: string;\n command: string;\n /** The current selections, empty while the session reports none; one at most unless multi. */\n values: string[];\n emptyLabel: string;\n multi: boolean;\n}\n\nconst AXIS_LIST_SEPARATOR = ',';\n\n/**\n * The fallback axis table for the packaged bundle; a synced bundle carries\n * each axis as its owning package's plugin declaration, and the registry\n * list wins whenever any plugin declares one. Exported only so the workspace\n * composition test can hold it equal to what the packages declare.\n */\nexport const PACKAGED_SELECTION_AXES: readonly SelectionAxisContribution[] = [\n { name: 'profile', command: 'profile', statusKey: 'po-profile', emptyLabel: 'None', order: 10 },\n { name: 'domains', command: 'domains', statusKey: 'po-domain', emptyLabel: 'no domains', multi: true, order: 20 },\n];\n\n/**\n * The declared axes the session actually offers: an axis whose status key\n * the session never published stays off the bar entirely, which is how a\n * package withholds its axis when there is nothing to select.\n */\nexport function selectionAxes(statuses: Record<string, string>): SelectionAxis[] {\n const declared = pluginSelectionAxes();\n const sources: readonly SelectionAxisContribution[] = declared.length > 0 ? declared : PACKAGED_SELECTION_AXES;\n return sources.flatMap((source) => {\n const raw = statuses[source.statusKey];\n if (raw === undefined) return [];\n const multi = source.multi === true;\n const values = (multi ? stripAnsi(raw).split(AXIS_LIST_SEPARATOR) : [stripAnsi(raw)])\n .map((value) => value.trim())\n .filter(Boolean);\n return [{ name: source.name, command: source.command, values, emptyLabel: source.emptyLabel, multi }];\n });\n}\n\nexport type MinorModeAvailability = 'unavailable' | 'off' | 'on';\n\nexport interface MinorMode {\n name: string;\n /** The catalog id /minor accepts; the display name until the catalog reports. */\n id: string;\n /** Leader Space key path, as the TUI documents it. */\n keys: string;\n availability: MinorModeAvailability;\n /** What the mode itself is reporting while on. */\n detail: string;\n /** Activity group to focus instead of invoking the mode command from the cockpit. */\n activityGroup?: string;\n /** The mark the mode's package declares; the host draws a generic one without it. */\n icon?: MinorModeContribution['icon'];\n /** The action that flips the row in one click, when the mode offers it without input. */\n toggle?: 'activate' | 'deactivate';\n /**\n * Why the mode cannot be driven from here, in the words of the mode itself.\n * Empty when it can. A mode may be installed and still refuse a cockpit:\n * autonomous voice captures from the terminal's own microphone, which a\n * browser talking to a headless agent does not have.\n */\n unavailableReason: string;\n}\n\nexport interface MinorModeSource {\n name: string;\n /** The catalog mode this row drives, when the runtime registers it under another id. */\n modeId?: string;\n /** Leader Space key path, as the TUI documents it. */\n keys: string;\n /** Activity group to focus instead of invoking the mode command from the cockpit. */\n activityGroup?: string;\n icon?: MinorModeContribution['icon'];\n statusKey?: string;\n widgetKey?: string;\n hideWhenMissing?: boolean;\n desktopOnly?: boolean;\n}\n\n/**\n * The fallback minor-mode table for the packaged bundle.\n *\n * A synced bundle carries each mode as its package's own web plugin\n * contribution, and the registry list wins whenever any plugin declares one.\n * This literal survives only so the built-in-only bundle keeps rendering the\n * modes Po ships; help is listed without a signal on purpose: it\n * registers no footer entry, so the cockpit reports it as unavailable rather\n * than guessing it is off. Exported only for the workspace composition test.\n */\nexport const PACKAGED_MINOR_MODES: readonly MinorModeSource[] = [\n { name: 'help', keys: 'h e' },\n { name: 'plan', keys: 'p e', statusKey: 'plan-mode' },\n { name: 'goal', keys: 'g e', statusKey: 'goal' },\n { name: 'author', keys: 'o a' },\n // `v e` drives autonomous capture, which the runtime registers as 'voice-auto'.\n { name: 'voice', modeId: 'voice-auto', keys: 'v e', statusKey: 'po-voice' },\n {\n name: 'computer use',\n modeId: 'computer-use',\n keys: 'c e',\n statusKey: 'po-computer-use-mode',\n hideWhenMissing: true,\n },\n];\n\n/** What a mode's own package declares about how its row looks and where it leads. */\nfunction presented(source: MinorModeSource | undefined): Pick<MinorMode, 'activityGroup' | 'icon'> {\n return {\n ...(source?.activityGroup === undefined ? {} : { activityGroup: source.activityGroup }),\n ...(source?.icon === undefined ? {} : { icon: source.icon }),\n };\n}\n\n/** The declared source a catalog mode corresponds to, by id, id stem, or label. */\nfunction sourceFor(sources: readonly MinorModeSource[], mode: MinorModeRecordProjection): MinorModeSource | undefined {\n const candidates = new Set([mode.id.toLowerCase(), mode.id.toLowerCase().split('.')[0], mode.label.toLowerCase()]);\n return sources.find((source) =>\n [source.name, source.modeId].some((identity) => identity !== undefined && candidates.has(identity.toLowerCase())),\n );\n}\n\n/**\n * Catalog-backed rows: the runtime's own activation state per mode, with the\n * declared leader keys attached where a plugin documents them. Declared modes\n * the catalog does not know are still listed, as unavailable, so a mode that\n * is missing from a composition stays visible rather than silently gone.\n */\nfunction catalogMinorModes(sources: readonly MinorModeSource[], projection: MinorModeProjection): MinorMode[] {\n const rows: MinorMode[] = projection.modes\n .filter((mode) => !sourceFor(sources, mode)?.desktopOnly || isDesktopClient())\n .map((mode) => {\n const source = sourceFor(sources, mode);\n const on = mode.activation === 'active' || mode.activation === 'deactivating';\n // The catalog says per action whether it can run here and why not. A mode\n // with nothing runnable is offered as a row that cannot be clicked rather\n // than one that answers \"no actions available\" after the fact.\n const blocked = mode.actions.length > 0 && mode.actions.every((action) => !action.enabled);\n const reason = blocked ? (mode.actions.find((action) => action.disabledReason)?.disabledReason ?? '') : '';\n const toggle = on ? 'deactivate' : 'activate';\n const flips = mode.actions.some((action) => action.id === toggle && action.enabled && !action.needsInput);\n return {\n name: source?.name ?? mode.label.toLowerCase(),\n id: mode.id,\n keys: source?.keys ?? '',\n availability: blocked && !on ? 'unavailable' : on ? 'on' : 'off',\n ...presented(source),\n ...(flips ? { toggle } : {}),\n detail: mode.detail ?? (mode.activation === 'activating' ? 'activating' : ''),\n unavailableReason: reason,\n };\n });\n const seen = new Set(rows.map((row) => row.name));\n for (const source of sources) {\n if (source.hideWhenMissing === true || (source.desktopOnly && !isDesktopClient())) continue;\n if (!seen.has(source.name)) {\n rows.push({\n name: source.name,\n id: source.modeId ?? source.name,\n keys: source.keys,\n availability: 'unavailable',\n ...presented(source),\n detail: '',\n unavailableReason: 'No package in this session registers this mode.',\n });\n }\n }\n return rows;\n}\n\nexport function minorModes(\n statuses: Record<string, string>,\n widgets: readonly string[],\n projection: MinorModeProjection | null = null,\n): MinorMode[] {\n const declared = pluginMinorModes();\n const sources: readonly MinorModeSource[] = declared.length > 0 ? declared : PACKAGED_MINOR_MODES;\n if (projection) return catalogMinorModes(sources, projection);\n return sources.flatMap((source) => {\n if (source.desktopOnly && !isDesktopClient()) return [];\n if (source.statusKey !== undefined) {\n const raw = statuses[source.statusKey];\n if (raw === undefined) {\n if (source.hideWhenMissing === true) return [];\n return [\n {\n name: source.name,\n id: source.modeId ?? source.name,\n keys: source.keys,\n availability: 'unavailable' as const,\n ...presented(source),\n detail: '',\n unavailableReason: 'This session has not reported the mode.',\n },\n ];\n }\n const detail = stripAnsi(raw).trim();\n return {\n name: source.name,\n id: source.modeId ?? source.name,\n keys: source.keys,\n availability: detail ? ('on' as const) : ('off' as const),\n ...presented(source),\n detail,\n unavailableReason: '',\n };\n }\n if (source.widgetKey !== undefined && widgets.includes(source.widgetKey)) {\n return {\n name: source.name,\n id: source.modeId ?? source.name,\n keys: source.keys,\n availability: 'off' as const,\n ...presented(source),\n detail: '',\n unavailableReason: '',\n };\n }\n return {\n name: source.name,\n id: source.name,\n keys: source.keys,\n availability: 'unavailable' as const,\n ...presented(source),\n detail: '',\n unavailableReason: 'This session has not reported the mode.',\n };\n });\n}\n\nexport interface ActivityGroup {\n name: string;\n keys: string;\n /** The heading visual its package declares; the dock draws a generic one without it. */\n icon?: ActivityGroupContribution['icon'];\n /** What the publishing extension is reporting, empty when it reports nothing. */\n summary: string;\n active: boolean;\n marksBackgroundWork?: boolean;\n collapsible?: boolean;\n /** The temporary tab the group's name opens, when its package declares one. */\n transientTab?: () => TransientTab;\n /** Keeps the group visible below the dock's scrolling ordinary groups. */\n placement?: 'bottom';\n}\n\n/** Subscribe to package-owned activity sources, rewiring when the focused composition changes. */\nexport function subscribeActivitySources(listener: () => void): () => void {\n let subscriptions: (() => void)[] = [];\n const unsubscribeSources = (): void => {\n subscriptions.forEach((unsubscribe) => unsubscribe());\n subscriptions = [];\n };\n const subscribeSources = (): void => {\n subscriptions = pluginActivityGroups().flatMap((source) =>\n source.activeSource === undefined ? [] : [source.activeSource.subscribe(listener)],\n );\n };\n subscribeSources();\n const unsubscribeRegistry = subscribeWebPluginRegistry(() => {\n unsubscribeSources();\n subscribeSources();\n listener();\n });\n return () => {\n unsubscribeRegistry();\n unsubscribeSources();\n };\n}\n\nfunction activitySourceFingerprint(sessionId: string | null): string {\n const activeSources = pluginActivityGroups()\n .map((source) => (source.activeSource?.isActive(sessionId) === true ? '1' : '0'))\n .join('');\n return `${webPluginRegistryRevision()}:${activeSources}`;\n}\n\n/**\n * The groups available in this plugin composition. Status and widget signals\n * reveal legacy groups. A package-owned active source also reveals its group,\n * including while idle, so the section can remain a stable launcher unless it\n * opts into `hideWhenEmpty`.\n *\n * A group that declared `hideWhenEmpty` goes away once its session stops\n * reporting. Clearing a status reaches the page as an empty string rather than\n * an absent key, because the same map tells the selection bar which minor modes\n * exist and an absent key means \"not reported\" there. Emptiness is read here,\n * where only the dock is looking.\n */\nexport function activityGroups(\n statuses: Record<string, string>,\n widgets: readonly string[],\n sessionId: string | null = null,\n): ActivityGroup[] {\n const groups: ActivityGroup[] = [];\n for (const source of pluginActivityGroups()) {\n const tab = source.transientTab === undefined ? {} : { transientTab: source.transientTab };\n const placement = {\n ...(source.placement === undefined ? {} : { placement: source.placement }),\n ...(source.marksBackgroundWork === false ? { marksBackgroundWork: false } : {}),\n ...(source.collapsible === false ? { collapsible: false } : {}),\n ...(source.icon === undefined ? {} : { icon: source.icon }),\n };\n if (source.statusKey !== undefined && statuses[source.statusKey] !== undefined) {\n const summary = stripAnsi(statuses[source.statusKey] ?? '').trim();\n const active =\n source.activeSource?.isActive(sessionId) ?? (source.marksBackgroundWork !== false && summary.length > 0);\n if (summary.length === 0 && source.hideWhenEmpty === true && !active) continue;\n groups.push({ name: source.name, keys: source.keys, summary, active, ...tab, ...placement });\n continue;\n }\n if (source.widgetKeys !== undefined && source.widgetKeys.some((key) => widgets.includes(key))) {\n const activeKeys = source.activeWidgetKeys ?? source.widgetKeys;\n const active =\n source.activeSource?.isActive(sessionId) ??\n (source.marksBackgroundWork !== false && activeKeys.some((key) => widgets.includes(key)));\n groups.push({ name: source.name, keys: source.keys, summary: '', active, ...tab, ...placement });\n continue;\n }\n if (source.activeSource !== undefined) {\n const active = source.activeSource.isActive(sessionId);\n if (source.hideWhenEmpty === true && !active) continue;\n groups.push({\n name: source.name,\n keys: source.keys,\n summary: '',\n active,\n ...tab,\n ...placement,\n });\n }\n }\n return groups;\n}\n\n/** Dock faces update when the active session composition changes. */\nexport function useDockFaces(sessionId: string | null): readonly DockFaceContribution[] {\n useSyncExternalStore(subscribeWebPluginRegistry, webPluginRegistryRevision, webPluginRegistryRevision);\n const subscribe = (listener: () => void) => {\n const releases = pluginDockFaces().flatMap((face) =>\n face.visibility ? [face.visibility.subscribe(listener)] : [],\n );\n return () => releases.forEach((release) => release());\n };\n const snapshot = () =>\n pluginDockFaces()\n .map((face) => (face.visibility?.isVisible(sessionId) !== false ? '1' : '0'))\n .join('');\n useSyncExternalStore(subscribe, snapshot, snapshot);\n return pluginDockFaces().filter((face) => face.visibility?.isVisible(sessionId) !== false);\n}\n\n/** Each face's badge count for the session, re-read when a face reports a change. */\nexport function useDockFaceBadges(\n faces: readonly DockFaceContribution[],\n sessionId: string | null,\n): Readonly<Record<string, number>> {\n const subscribe = (listener: () => void) => {\n const releases = faces.flatMap((face) => (face.badge ? [face.badge.subscribe(listener)] : []));\n return () => releases.forEach((release) => release());\n };\n // A string snapshot keeps useSyncExternalStore stable between unrelated renders.\n const snapshot = () =>\n faces.map((face) => `${face.id}=${face.badge ? Math.max(0, face.badge.count(sessionId)) : 0}`).join('\\n');\n const counts = useSyncExternalStore(subscribe, snapshot, snapshot);\n return Object.fromEntries(\n counts\n .split('\\n')\n .filter(Boolean)\n .map((entry) => {\n const separator = entry.lastIndexOf('=');\n return [entry.slice(0, separator), Number(entry.slice(separator + 1))];\n }),\n );\n}\n\n/** Activity groups that update when either host signals or a plugin's session store changes. */\nexport function useActivityGroups(\n statuses: Record<string, string>,\n widgets: readonly string[],\n sessionId: string | null,\n): ActivityGroup[] {\n useSyncExternalStore(\n subscribeActivitySources,\n () => activitySourceFingerprint(sessionId),\n () => activitySourceFingerprint(sessionId),\n );\n return activityGroups(statuses, widgets, sessionId);\n}\n\n/** The tab one path opens, or undefined when no installed plugin recognises it. */\nexport type FileLinkResolver = (path: string) => TransientTab | undefined;\n\ninterface FileLinkModes {\n active(sessionId: string | null): readonly string[];\n subscribe(sessionId: string | null, listener: () => void): () => void;\n}\nlet fileLinkModes: FileLinkModes | undefined;\nconst modeBindings = new Set<() => void>();\n\n/** Binds host session facts without making the composition library own session state. */\nexport function bindFileLinkModes(source: FileLinkModes): () => void {\n fileLinkModes = source;\n modeBindings.forEach((listener) => listener());\n return () => {\n if (fileLinkModes !== source) return;\n fileLinkModes = undefined;\n modeBindings.forEach((listener) => listener());\n };\n}\nfunction subscribeFileLinks(sessionId: string | null, listener: () => void): () => void {\n let unsubscribeModes = fileLinkModes?.subscribe(sessionId, listener);\n const rebindModes = () => {\n unsubscribeModes?.();\n unsubscribeModes = fileLinkModes?.subscribe(sessionId, listener);\n listener();\n };\n modeBindings.add(rebindModes);\n let subscriptions: (() => void)[] = [];\n const unsubscribeSources = (): void => {\n subscriptions.forEach((unsubscribe) => unsubscribe());\n subscriptions = [];\n };\n const subscribeSources = (): void => {\n subscriptions = pluginFileLinks().map((source) => source.subscribe(listener));\n };\n subscribeSources();\n const unsubscribeRegistry = subscribeWebPluginRegistry(() => {\n unsubscribeSources();\n subscribeSources();\n listener();\n });\n return () => {\n modeBindings.delete(rebindModes);\n unsubscribeModes?.();\n unsubscribeRegistry();\n unsubscribeSources();\n };\n}\n\nfunction activeFileLinkSources(sessionId: string | null) {\n const enabled = new Set(fileLinkModes?.active(sessionId) ?? []);\n return pluginFileLinks(sessionId).filter(\n (source) => source.requiredMinorMode === undefined || enabled.has(source.requiredMinorMode),\n );\n}\n\nfunction fileLinkFingerprint(sessionId: string | null): string {\n const sourceFingerprints = activeFileLinkSources(sessionId)\n .map((source) => `${source.requiredMinorMode ?? ''}:${source.fingerprint(sessionId)}`)\n .join('\\n');\n return `${webPluginRegistryRevision()}:${sourceFingerprints}`;\n}\n\n/**\n * The tab a path opens, from the first source that claims it.\n *\n * A path no source claims is not a link. The host cannot tell a file name from\n * a class name, and the plugin that tracks the session's files can, so the\n * decision belongs there rather than in a heuristic here.\n */\nexport function fileLinkFor(sessionId: string | null, path: string): TransientTab | undefined {\n for (const source of activeFileLinkSources(sessionId)) {\n const tab = source.resolve(sessionId, path);\n if (tab !== undefined) return tab;\n }\n return undefined;\n}\n\n/** References plugins that own a path namespace offer for an `@` being typed, such as `artifact:plan.md`. */\nexport function fileLinkMentions(sessionId: string, query: string): FileLinkMention[] {\n return activeFileLinkSources(sessionId).flatMap((source) => source.mentions?.(sessionId, query) ?? []);\n}\n\n/**\n * The tab a path the caller is sure about opens: a tool call's path argument,\n * not a token spotted in prose.\n *\n * A source that offers `openPath` answers here, and it may claim a file the\n * session never changed, which `resolve` deliberately will not. Sources\n * without it fall back to the same guess prose gets.\n */\nexport function fileTabForPath(sessionId: string | null, path: string): TransientTab | undefined {\n for (const source of activeFileLinkSources(sessionId)) {\n const tab = source.openPath?.(sessionId, path) ?? source.resolve(sessionId, path);\n if (tab !== undefined) return tab;\n }\n return undefined;\n}\n/**\n * Resolves the paths a message names against the plugins that track them.\n *\n * The resolver's identity is stable while the linkable set is, so a component\n * that hands it to a renderer does not rebuild that renderer on every frame of\n * a streaming reply.\n */\nexport function useFileLinks(sessionId: string | null): FileLinkResolver {\n const fingerprint = useSyncExternalStore(\n useCallback((listener: () => void) => subscribeFileLinks(sessionId, listener), [sessionId]),\n () => fileLinkFingerprint(sessionId),\n () => fileLinkFingerprint(sessionId),\n );\n return useCallback(\n (path: string) => fileLinkFor(sessionId, path),\n // The fingerprint is the dependency: the same path resolves differently\n // once the session's set of tracked files changes.\n // eslint-disable-next-line react-hooks/exhaustive-deps -- fingerprint is a deliberate identity buster, not a value the callback reads.\n [sessionId, fingerprint],\n );\n}\n"],"mappings":";;;;AAgCA,MAAM,sBAAsB;;;;;;;AAQ5B,MAAa,0BAAgE,CAC3E;CAAE,MAAM;CAAW,SAAS;CAAW,WAAW;CAAc,YAAY;CAAQ,OAAO;AAAG,GAC9F;CAAE,MAAM;CAAW,SAAS;CAAW,WAAW;CAAa,YAAY;CAAc,OAAO;CAAM,OAAO;AAAG,CAClH;;;;;;AAOA,SAAgB,cAAc,UAAmD;CAC/E,MAAM,WAAW,oBAAoB;CAErC,QADsD,SAAS,SAAS,IAAI,WAAW,wBAAA,CACxE,SAAS,WAAW;EACjC,MAAM,MAAM,SAAS,OAAO;EAC5B,IAAI,QAAQ,KAAA,GAAW,OAAO,CAAC;EAC/B,MAAM,QAAQ,OAAO,UAAU;EAC/B,MAAM,UAAU,QAAQ,UAAU,GAAG,CAAC,CAAC,MAAM,mBAAmB,IAAI,CAAC,UAAU,GAAG,CAAC,EAAA,CAChF,KAAK,UAAU,MAAM,KAAK,CAAC,CAAC,CAC5B,OAAO,OAAO;EACjB,OAAO,CAAC;GAAE,MAAM,OAAO;GAAM,SAAS,OAAO;GAAS;GAAQ,YAAY,OAAO;GAAY;EAAM,CAAC;CACtG,CAAC;AACH;;;;;;;;;;;AAqDA,MAAa,uBAAmD;CAC9D;EAAE,MAAM;EAAQ,MAAM;CAAM;CAC5B;EAAE,MAAM;EAAQ,MAAM;EAAO,WAAW;CAAY;CACpD;EAAE,MAAM;EAAQ,MAAM;EAAO,WAAW;CAAO;CAC/C;EAAE,MAAM;EAAU,MAAM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OAAO,gBAAgB,SAAS,CAAC,CAAC,QAC/B,WAAW,OAAO,sBAAsB,KAAA,KAAa,QAAQ,IAAI,OAAO,iBAAiB,CAC5F;AACF;AAEA,SAAS,oBAAoB,WAAkC;CAC7D,MAAM,qBAAqB,sBAAsB,SAAS,CAAC,CACxD,KAAK,WAAW,GAAG,OAAO,qBAAqB,GAAG,GAAG,OAAO,YAAY,SAAS,GAAG,CAAC,CACrF,KAAK,IAAI;CACZ,OAAO,GAAG,0BAA0B,EAAE,GAAG;AAC3C;;;;;;;;AASA,SAAgB,YAAY,WAA0B,MAAwC;CAC5F,KAAK,MAAM,UAAU,sBAAsB,SAAS,GAAG;EACrD,MAAM,MAAM,OAAO,QAAQ,WAAW,IAAI;EAC1C,IAAI,QAAQ,KAAA,GAAW,OAAO;CAChC;AAEF;;AAGA,SAAgB,iBAAiB,WAAmB,OAAkC;CACpF,OAAO,sBAAsB,SAAS,CAAC,CAAC,SAAS,WAAW,OAAO,WAAW,WAAW,KAAK,KAAK,CAAC,CAAC;AACvG;;;;;;;;;AAUA,SAAgB,eAAe,WAA0B,MAAwC;CAC/F,KAAK,MAAM,UAAU,sBAAsB,SAAS,GAAG;EACrD,MAAM,MAAM,OAAO,WAAW,WAAW,IAAI,KAAK,OAAO,QAAQ,WAAW,IAAI;EAChF,IAAI,QAAQ,KAAA,GAAW,OAAO;CAChC;AAEF;;;;;;;;AAQA,SAAgB,aAAa,WAA4C;CACvE,MAAM,cAAc,qBAClB,aAAa,aAAyB,mBAAmB,WAAW,QAAQ,GAAG,CAAC,SAAS,CAAC,SACpF,oBAAoB,SAAS,SAC7B,oBAAoB,SAAS,CACrC;CACA,OAAO,aACJ,SAAiB,YAAY,WAAW,IAAI,GAI7C,CAAC,WAAW,WAAW,CACzB;AACF"}
@@ -1,3 +1,4 @@
1
+ const require_hostIdentity = require("./hostIdentity.cjs");
1
2
  const require_pluginScopes = require("./pluginScopes.cjs");
2
3
  let _agimon_ai_po_core_web = require("@agimon-ai/po-core/web");
3
4
  //#region src/web/lib/templateCatalog.ts
@@ -116,9 +117,12 @@ function resolveWebTemplate(templates, configured, failed = []) {
116
117
  warning: void 0
117
118
  };
118
119
  }
119
- /** A background's `web.backdrop` value: the `<pluginId>/<fillId>` of its `backdrop` fill. */
120
+ /**
121
+ * A background's `web.backdrop` value: the `<pluginId>/<fillId>` of its `backdrop` fill. A cloud host's registry
122
+ * prefixes plugin ids with its host id; config never carries that runtime prefix.
123
+ */
120
124
  function backdropId(fill) {
121
- return `${fill.pluginId}/${fill.id}`;
125
+ return `${require_hostIdentity.splitHostId(fill.pluginId)?.localId ?? fill.pluginId}/${fill.id}`;
122
126
  }
123
127
  /**
124
128
  * The one background to show, never a stack: the configured fill, else Po's bamboo, else none; `none` shows
@@ -1 +1 @@
1
- {"version":3,"file":"templateCatalog.cjs","names":["parseWebTemplate","pluginsAtScope","parseNativeTemplate","DEFAULT_TEMPLATE_ID","NO_BACKDROP","DEFAULT_BACKDROP_ID"],"sources":["../../../src/web/lib/templateCatalog.ts"],"sourcesContent":["import {\n DEFAULT_BACKDROP_ID,\n DEFAULT_TEMPLATE_ID,\n NO_BACKDROP,\n parseNativeTemplate,\n parseWebTemplate,\n type NativeTemplateContribution,\n type WebPluginDefinition,\n type WebPluginScope,\n type WebTemplateContribution,\n} from '@agimon-ai/po-core/web';\n\nimport { pluginsAtScope } from './pluginScopes';\nexport interface InstalledWebTemplate extends WebTemplateContribution {\n pluginId: string;\n}\n\nexport interface WebTemplateDiagnostic {\n kind: 'invalid-template' | 'duplicate-template';\n pluginId: string;\n message: string;\n}\n\nexport interface WebTemplateCatalog {\n templates: InstalledWebTemplate[];\n diagnostics: WebTemplateDiagnostic[];\n}\n\nlet bundledTemplates: readonly WebPluginDefinition[] = [];\n\n/** The host supplies its bundled recovery application, avoiding a library-to-template dependency. */\nexport function bindBundledWebTemplates(plugins: readonly WebPluginDefinition[]): void {\n bundledTemplates = plugins;\n}\n\n/**\n * One plugin field of template contributions, parsed entry by entry; the first owner of an id wins.\n * Bundled plugins only fill gaps: an id the host already provides is skipped without a diagnostic.\n */\nfunction collectTemplates<T extends { id: string }>(\n plugins: readonly WebPluginDefinition[],\n field: 'templates' | 'nativeTemplates',\n parse: (value: unknown) => T | undefined,\n bundled: readonly WebPluginDefinition[] = [],\n): { templates: (T & { pluginId: string })[]; diagnostics: WebTemplateDiagnostic[] } {\n const templates = new Map<string, T & { pluginId: string }>();\n const diagnostics: WebTemplateDiagnostic[] = [];\n const collect = (plugin: WebPluginDefinition, fillsGaps: boolean): void => {\n let entries: unknown;\n try {\n entries = plugin[field];\n } catch {\n diagnostics.push({\n kind: 'invalid-template',\n pluginId: plugin.id,\n message: `Template metadata from '${plugin.id}' could not be read.`,\n });\n return;\n }\n if (entries === undefined) return;\n if (!Array.isArray(entries)) {\n diagnostics.push({\n kind: 'invalid-template',\n pluginId: plugin.id,\n message: `Plugin '${plugin.id}' must declare ${field} as an array.`,\n });\n return;\n }\n for (const entry of entries) {\n let template: T | undefined;\n try {\n template = parse(entry);\n } catch {\n template = undefined;\n }\n if (template === undefined) {\n diagnostics.push({\n kind: 'invalid-template',\n pluginId: plugin.id,\n message: `Plugin '${plugin.id}' declares an invalid template or an unsupported template contract.`,\n });\n continue;\n }\n const owner = templates.get(template.id);\n if (owner !== undefined && fillsGaps) continue;\n if (owner !== undefined) {\n diagnostics.push({\n kind: 'duplicate-template',\n pluginId: plugin.id,\n message: `Template '${template.id}' is already provided by '${owner.pluginId}'; keeping the first.`,\n });\n continue;\n }\n templates.set(template.id, { ...template, pluginId: plugin.id });\n }\n };\n\n for (const plugin of plugins) collect(plugin, false);\n for (const plugin of bundled) collect(plugin, true);\n return { templates: [...templates.values()], diagnostics };\n}\n\n/** Read scoped templates, then add any bundled template the scope does not provide. */\nexport function collectWebTemplates(\n plugins: readonly WebPluginDefinition[],\n scope?: WebPluginScope,\n): WebTemplateCatalog {\n return collectTemplates(\n plugins,\n 'templates',\n parseWebTemplate,\n scope === undefined ? [] : pluginsAtScope(bundledTemplates, scope),\n );\n}\n\nexport interface InstalledNativeTemplate extends NativeTemplateContribution {\n pluginId: string;\n}\n\nexport interface NativeTemplateCatalog {\n templates: InstalledNativeTemplate[];\n diagnostics: WebTemplateDiagnostic[];\n}\n\nlet bundledNativeTemplates: readonly WebPluginDefinition[] = [];\n\n/** The phone app's bundled default layout, bound by the host exactly as the cockpit binds its own. */\nexport function bindBundledNativeTemplates(plugins: readonly WebPluginDefinition[]): void {\n bundledNativeTemplates = plugins;\n}\n\n/** Phone layouts from `nativeTemplates`, then any bundled layout the scope does not provide. */\nexport function collectNativeTemplates(\n plugins: readonly WebPluginDefinition[],\n scope?: WebPluginScope,\n): NativeTemplateCatalog {\n return collectTemplates(\n plugins,\n 'nativeTemplates',\n parseNativeTemplate,\n scope === undefined ? [] : pluginsAtScope(bundledNativeTemplates, scope),\n );\n}\n\n/** The phone app's own copy of a bundled layout, valid at the global scope, for screens no host owns. */\nexport function bundledNativeTemplate(id: string): NativeTemplateContribution | undefined {\n return collectTemplates(\n [],\n 'nativeTemplates',\n parseNativeTemplate,\n pluginsAtScope(bundledNativeTemplates, 'host'),\n ).templates.find((template) => template.id === id);\n}\n\n/** The cockpit's choice rule for the phone: configured, then the default, then the first by id. */\nexport function resolveNativeTemplate(\n templates: readonly InstalledNativeTemplate[],\n configured: string | undefined,\n failed: readonly string[] = [],\n): InstalledNativeTemplate | undefined {\n const available = templates.filter((template) => !failed.includes(template.id));\n return (\n available.find((template) => template.id === configured) ??\n available.find((template) => template.id === DEFAULT_TEMPLATE_ID) ??\n [...available].sort((left, right) => left.id.localeCompare(right.id))[0]\n );\n}\n\n/** A missing default stays in config, since another workspace may still provide it. */\nexport function resolveWebTemplate(\n templates: readonly InstalledWebTemplate[],\n configured: string | undefined,\n failed: readonly string[] = [],\n): { template: InstalledWebTemplate | undefined; warning: string | undefined } {\n const available = templates.filter((template) => !failed.includes(template.id));\n const preferred = available.find((template) => template.id === configured);\n const template =\n preferred ??\n available.find((candidate) => candidate.id === DEFAULT_TEMPLATE_ID) ??\n [...available].sort((left, right) => left.id.localeCompare(right.id))[0];\n if (!template)\n return {\n template: undefined,\n warning: 'No compatible web template is available. Add a template package to modes.yaml and run po sync.',\n };\n if (configured && !preferred)\n return { template, warning: `Configured template '${configured}' is unavailable; showing '${template.label}'.` };\n if (failed.length > 0)\n return { template, warning: 'A template could not render. A different available template is being shown.' };\n return { template, warning: undefined };\n}\n\n/** A background's `web.backdrop` value: the `<pluginId>/<fillId>` of its `backdrop` fill. */\nexport function backdropId(fill: { pluginId: string; id: string }): string {\n return `${fill.pluginId}/${fill.id}`;\n}\n\n/**\n * The one background to show, never a stack: the configured fill, else Po's bamboo, else none; `none` shows\n * none. A configured fill that is not installed stays in config, since another workspace may still provide it.\n */\nexport function resolveBackdrop<Fill extends { pluginId: string; id: string }>(\n fills: readonly Fill[],\n configured: string | undefined,\n): Fill | undefined {\n if (configured === NO_BACKDROP) return undefined;\n return (\n fills.find((fill) => backdropId(fill) === configured) ??\n fills.find((fill) => backdropId(fill) === DEFAULT_BACKDROP_ID)\n );\n}\n"],"mappings":";;;AA4BA,IAAI,mBAAmD,CAAC;;AAGxD,SAAgB,wBAAwB,SAA+C;CACrF,mBAAmB;AACrB;;;;;AAMA,SAAS,iBACP,SACA,OACA,OACA,UAA0C,CAAC,GACwC;CACnF,MAAM,4BAAY,IAAI,IAAsC;CAC5D,MAAM,cAAuC,CAAC;CAC9C,MAAM,WAAW,QAA6B,cAA6B;EACzE,IAAI;EACJ,IAAI;GACF,UAAU,OAAO;EACnB,QAAQ;GACN,YAAY,KAAK;IACf,MAAM;IACN,UAAU,OAAO;IACjB,SAAS,2BAA2B,OAAO,GAAG;GAChD,CAAC;GACD;EACF;EACA,IAAI,YAAY,KAAA,GAAW;EAC3B,IAAI,CAAC,MAAM,QAAQ,OAAO,GAAG;GAC3B,YAAY,KAAK;IACf,MAAM;IACN,UAAU,OAAO;IACjB,SAAS,WAAW,OAAO,GAAG,iBAAiB,MAAM;G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M,SAAS,WAAW,IAAI,MAAMC,uBAAAA,mBAAmB;AAEjE"}
1
+ {"version":3,"file":"templateCatalog.cjs","names":["parseWebTemplate","pluginsAtScope","parseNativeTemplate","DEFAULT_TEMPLATE_ID","splitHostId","NO_BACKDROP","DEFAULT_BACKDROP_ID"],"sources":["../../../src/web/lib/templateCatalog.ts"],"sourcesContent":["import {\n DEFAULT_BACKDROP_ID,\n DEFAULT_TEMPLATE_ID,\n NO_BACKDROP,\n parseNativeTemplate,\n parseWebTemplate,\n type NativeTemplateContribution,\n type WebPluginDefinition,\n type WebPluginScope,\n type WebTemplateContribution,\n} from '@agimon-ai/po-core/web';\n\nimport { splitHostId } from './hostIdentity';\nimport { pluginsAtScope } from './pluginScopes';\nexport interface InstalledWebTemplate extends WebTemplateContribution {\n pluginId: string;\n}\n\nexport interface WebTemplateDiagnostic {\n kind: 'invalid-template' | 'duplicate-template';\n pluginId: string;\n message: string;\n}\n\nexport interface WebTemplateCatalog {\n templates: InstalledWebTemplate[];\n diagnostics: WebTemplateDiagnostic[];\n}\n\nlet bundledTemplates: readonly WebPluginDefinition[] = [];\n\n/** The host supplies its bundled recovery application, avoiding a library-to-template dependency. */\nexport function bindBundledWebTemplates(plugins: readonly WebPluginDefinition[]): void {\n bundledTemplates = plugins;\n}\n\n/**\n * One plugin field of template contributions, parsed entry by entry; the first owner of an id wins.\n * Bundled plugins only fill gaps: an id the host already provides is skipped without a diagnostic.\n */\nfunction collectTemplates<T extends { id: string }>(\n plugins: readonly WebPluginDefinition[],\n field: 'templates' | 'nativeTemplates',\n parse: (value: unknown) => T | undefined,\n bundled: readonly WebPluginDefinition[] = [],\n): { templates: (T & { pluginId: string })[]; diagnostics: WebTemplateDiagnostic[] } {\n const templates = new Map<string, T & { pluginId: string }>();\n const diagnostics: WebTemplateDiagnostic[] = [];\n const collect = (plugin: WebPluginDefinition, fillsGaps: boolean): void => {\n let entries: unknown;\n try {\n entries = plugin[field];\n } catch {\n diagnostics.push({\n kind: 'invalid-template',\n pluginId: plugin.id,\n message: `Template metadata from '${plugin.id}' could not be read.`,\n });\n return;\n }\n if (entries === undefined) return;\n if (!Array.isArray(entries)) {\n diagnostics.push({\n kind: 'invalid-template',\n pluginId: plugin.id,\n message: `Plugin '${plugin.id}' must declare ${field} as an array.`,\n });\n return;\n }\n for (const entry of entries) {\n let template: T | undefined;\n try {\n template = parse(entry);\n } catch {\n template = undefined;\n }\n if (template === undefined) {\n diagnostics.push({\n kind: 'invalid-template',\n pluginId: plugin.id,\n message: `Plugin '${plugin.id}' declares an invalid template or an unsupported template contract.`,\n });\n continue;\n }\n const owner = templates.get(template.id);\n if (owner !== undefined && fillsGaps) continue;\n if (owner !== undefined) {\n diagnostics.push({\n kind: 'duplicate-template',\n pluginId: plugin.id,\n message: `Template '${template.id}' is already provided by '${owner.pluginId}'; keeping the first.`,\n });\n continue;\n }\n templates.set(template.id, { ...template, pluginId: plugin.id });\n }\n };\n\n for (const plugin of plugins) collect(plugin, false);\n for (const plugin of bundled) collect(plugin, true);\n return { templates: [...templates.values()], diagnostics };\n}\n\n/** Read scoped templates, then add any bundled template the scope does not provide. */\nexport function collectWebTemplates(\n plugins: readonly WebPluginDefinition[],\n scope?: WebPluginScope,\n): WebTemplateCatalog {\n return collectTemplates(\n plugins,\n 'templates',\n parseWebTemplate,\n scope === undefined ? [] : pluginsAtScope(bundledTemplates, scope),\n );\n}\n\nexport interface InstalledNativeTemplate extends NativeTemplateContribution {\n pluginId: string;\n}\n\nexport interface NativeTemplateCatalog {\n templates: InstalledNativeTemplate[];\n diagnostics: WebTemplateDiagnostic[];\n}\n\nlet bundledNativeTemplates: readonly WebPluginDefinition[] = [];\n\n/** The phone app's bundled default layout, bound by the host exactly as the cockpit binds its own. */\nexport function bindBundledNativeTemplates(plugins: readonly WebPluginDefinition[]): void {\n bundledNativeTemplates = plugins;\n}\n\n/** Phone layouts from `nativeTemplates`, then any bundled layout the scope does not provide. */\nexport function collectNativeTemplates(\n plugins: readonly WebPluginDefinition[],\n scope?: WebPluginScope,\n): NativeTemplateCatalog {\n return collectTemplates(\n plugins,\n 'nativeTemplates',\n parseNativeTemplate,\n scope === undefined ? [] : pluginsAtScope(bundledNativeTemplates, scope),\n );\n}\n\n/** The phone app's own copy of a bundled layout, valid at the global scope, for screens no host owns. */\nexport function bundledNativeTemplate(id: string): NativeTemplateContribution | undefined {\n return collectTemplates(\n [],\n 'nativeTemplates',\n parseNativeTemplate,\n pluginsAtScope(bundledNativeTemplates, 'host'),\n ).templates.find((template) => template.id === id);\n}\n\n/** The cockpit's choice rule for the phone: configured, then the default, then the first by id. */\nexport function resolveNativeTemplate(\n templates: readonly InstalledNativeTemplate[],\n configured: string | undefined,\n failed: readonly string[] = [],\n): InstalledNativeTemplate | undefined {\n const available = templates.filter((template) => !failed.includes(template.id));\n return (\n available.find((template) => template.id === configured) ??\n available.find((template) => template.id === DEFAULT_TEMPLATE_ID) ??\n [...available].sort((left, right) => left.id.localeCompare(right.id))[0]\n );\n}\n\n/** A missing default stays in config, since another workspace may still provide it. */\nexport function resolveWebTemplate(\n templates: readonly InstalledWebTemplate[],\n configured: string | undefined,\n failed: readonly string[] = [],\n): { template: InstalledWebTemplate | undefined; warning: string | undefined } {\n const available = templates.filter((template) => !failed.includes(template.id));\n const preferred = available.find((template) => template.id === configured);\n const template =\n preferred ??\n available.find((candidate) => candidate.id === DEFAULT_TEMPLATE_ID) ??\n [...available].sort((left, right) => left.id.localeCompare(right.id))[0];\n if (!template)\n return {\n template: undefined,\n warning: 'No compatible web template is available. Add a template package to modes.yaml and run po sync.',\n };\n if (configured && !preferred)\n return { template, warning: `Configured template '${configured}' is unavailable; showing '${template.label}'.` };\n if (failed.length > 0)\n return { template, warning: 'A template could not render. A different available template is being shown.' };\n return { template, warning: undefined };\n}\n\n/**\n * A background's `web.backdrop` value: the `<pluginId>/<fillId>` of its `backdrop` fill. A cloud host's registry\n * prefixes plugin ids with its host id; config never carries that runtime prefix.\n */\nexport function backdropId(fill: { pluginId: string; id: string }): string {\n return `${splitHostId(fill.pluginId)?.localId ?? fill.pluginId}/${fill.id}`;\n}\n\n/**\n * The one background to show, never a stack: the configured fill, else Po's bamboo, else none; `none` shows\n * none. A configured fill that is not installed stays in config, since another workspace may still provide it.\n */\nexport function resolveBackdrop<Fill extends { pluginId: string; id: string }>(\n fills: readonly Fill[],\n configured: string | undefined,\n): Fill | undefined {\n if (configured === NO_BACKDROP) return undefined;\n return (\n fills.find((fill) => backdropId(fill) === configured) ??\n fills.find((fill) => backdropId(fill) === DEFAULT_BACKDROP_ID)\n );\n}\n"],"mappings":";;;;AA6BA,IAAI,mBAAmD,CAAC;;AAGxD,SAAgB,wBAAwB,SAA+C;CACrF,mBAAmB;AACrB;;;;;AAMA,SAAS,iBACP,SACA,OACA,OACA,UAA0C,CAAC,GACwC;CACnF,MAAM,4BAAY,IAAI,IAAsC;CAC5D,MAAM,cAAuC,CAAC;CAC9C,MAAM,WAAW,QAA6B,cAA6B;EACzE,IAAI;EACJ,IAAI;GACF,UAAU,OAAO;EACnB,QAAQ;GACN,YAAY,KAAK;IACf,MAAM;IACN,UAAU,OAAO;IACjB,SAAS,2BAA2B,OAAO,GAAG;GAChD,CAAC;GACD;EACF;EACA,IAAI,YAAY,KAAA,GAAW;EAC3B,IAAI,CAAC,MAAM,QAAQ,OAAO,GAAG;GAC3B,YAAY,KAAK;IACf,MAAM;IACN,UAAU,OAAO;IACjB,SAAS,WAAW,OAAO,GAAG,iBAAiB,MAAM;GACvD,CAAC;GACD;EACF;EACA,KAAK,MAAM,SAAS,SAAS;GAC3B,IAAI;GACJ,IAAI;IACF,WAAW,MAAM,KAAK;GACxB,QAAQ;IACN,WAAW,KAAA;GACb;GACA,IAAI,aAAa,KAAA,GAAW;IAC1B,YAAY,KAAK;KACf,MAAM;KACN,UAAU,OAAO;KACjB,SAAS,WAAW,OAAO,GAAG;IAChC,CAAC;IACD;GACF;GACA,MAAM,QAAQ,UAAU,IAAI,SAAS,EAAE;GACvC,IAAI,UAAU,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,MAAM,UAAU,KAAK,GAAG,cAAc,MAAM,EAAE,CAAC,CAAC,CAAC;AAE1E;;AAGA,SAAgB,mBACd,WACA,YACA,SAA4B,CAAC,GACgD;CAC7E,MAAM,YAAY,UAAU,QAAQ,aAAa,CAAC,OAAO,SAAS,SAAS,EAAE,CAAC;CAC9E,MAAM,YAAY,UAAU,MAAM,aAAa,SAAS,OAAO,UAAU;CACzE,MAAM,WACJ,aACA,UAAU,MAAM,cAAc,UAAU,OAAOA,uBAAAA,mBAAmB,KAClE,CAAC,GAAG,SAAS,CAAC,CAAC,MAAM,MAAM,UAAU,KAAK,GAAG,cAAc,MAAM,EAAE,CAAC,CAAC,CAAC;CACxE,IAAI,CAAC,UACH,OAAO;EACL,UAAU,KAAA;EACV,SAAS;CACX;CACF,IAAI,cAAc,CAAC,WACjB,OAAO;EAAE;EAAU,SAAS,wBAAwB,WAAW,6BAA6B,SAAS,MAAM;CAAI;CACjH,IAAI,OAAO,SAAS,GAClB,OAAO;EAAE;EAAU,SAAS;CAA8E;CAC5G,OAAO;EAAE;EAAU,SAAS,KAAA;CAAU;AACxC;;;;;AAMA,SAAgB,WAAW,MAAgD;CACzE,OAAO,GAAGC,qBAAAA,YAAY,KAAK,QAAQ,CAAC,EAAE,WAAW,KAAK,SAAS,GAAG,KAAK;AACzE;;;;;AAMA,SAAgB,gBACd,OACA,YACkB;CAClB,IAAI,eAAeC,uBAAAA,aAAa,OAAO,KAAA;CACvC,OACE,MAAM,MAAM,SAAS,WAAW,IAAI,MAAM,UAAU,KACpD,MAAM,MAAM,SAAS,WAAW,IAAI,MAAMC,uBAAAA,mBAAmB;AAEjE"}
@@ -36,7 +36,10 @@ export declare function resolveWebTemplate(templates: readonly InstalledWebTempl
36
36
  template: InstalledWebTemplate | undefined;
37
37
  warning: string | undefined;
38
38
  };
39
- /** A background's `web.backdrop` value: the `<pluginId>/<fillId>` of its `backdrop` fill. */
39
+ /**
40
+ * A background's `web.backdrop` value: the `<pluginId>/<fillId>` of its `backdrop` fill. A cloud host's registry
41
+ * prefixes plugin ids with its host id; config never carries that runtime prefix.
42
+ */
40
43
  export declare function backdropId(fill: {
41
44
  pluginId: string;
42
45
  id: string;
@@ -1 +1 @@
1
- {"version":3,"file":"templateCatalog.d.mts","names":[],"sources":["../../../src/web/lib/templateCatalog.ts"],"mappings":";;iBAaiB,6BAA6B;EAC5C;;iBAGe;EACf;EACA;EACA;;iBAGe;EACf,WAAW;EACX,aAAa;;;wBAMC,wBAAwB,kBAAkB;;wBAwE1C,oBACd,kBAAkB,uBAClB,QAAQ,iBACP;iBASc,gCAAgC;EAC/C;;iBAGe;EACf,WAAW;EACX,aAAa;;;wBAMC,2BAA2B,kBAAkB;;wBAK7C,uBACd,kBAAkB,uBAClB,QAAQ,iBACP;;wBAUa,sBAAsB,aAAa;;wBAUnC,sBACd,oBAAoB,2BACpB,gCACA,6BACC;;wBAUa,mBACd,oBAAoB,wBACpB,gCACA;EACG,UAAU;EAAkC;;;wBAoBjC,WAAW;EAAQ;EAAkB;;;;;;wBAQrC,gBAAgB;EAAe;EAAkB;GAC/D,gBAAgB,QAChB,iCACC"}
1
+ {"version":3,"file":"templateCatalog.d.mts","names":[],"sources":["../../../src/web/lib/templateCatalog.ts"],"mappings":";;iBAciB,6BAA6B;EAC5C;;iBAGe;EACf;EACA;EACA;;iBAGe;EACf,WAAW;EACX,aAAa;;;wBAMC,wBAAwB,kBAAkB;;wBAwE1C,oBACd,kBAAkB,uBAClB,QAAQ,iBACP;iBASc,gCAAgC;EAC/C;;iBAGe;EACf,WAAW;EACX,aAAa;;;wBAMC,2BAA2B,kBAAkB;;wBAK7C,uBACd,kBAAkB,uBAClB,QAAQ,iBACP;;wBAUa,sBAAsB,aAAa;;wBAUnC,sBACd,oBAAoB,2BACpB,gCACA,6BACC;;wBAUa,mBACd,oBAAoB,wBACpB,gCACA;EACG,UAAU;EAAkC;;;;;;wBAuBjC,WAAW;EAAQ;EAAkB;;;;;;wBAQrC,gBAAgB;EAAe;EAAkB;GAC/D,gBAAgB,QAChB,iCACC"}
@@ -1,3 +1,4 @@
1
+ import { splitHostId } from "./hostIdentity.mjs";
1
2
  import { pluginsAtScope } from "./pluginScopes.mjs";
2
3
  import { DEFAULT_BACKDROP_ID, DEFAULT_TEMPLATE_ID, NO_BACKDROP, parseNativeTemplate, parseWebTemplate } from "@agimon-ai/po-core/web";
3
4
  //#region src/web/lib/templateCatalog.ts
@@ -116,9 +117,12 @@ function resolveWebTemplate(templates, configured, failed = []) {
116
117
  warning: void 0
117
118
  };
118
119
  }
119
- /** A background's `web.backdrop` value: the `<pluginId>/<fillId>` of its `backdrop` fill. */
120
+ /**
121
+ * A background's `web.backdrop` value: the `<pluginId>/<fillId>` of its `backdrop` fill. A cloud host's registry
122
+ * prefixes plugin ids with its host id; config never carries that runtime prefix.
123
+ */
120
124
  function backdropId(fill) {
121
- return `${fill.pluginId}/${fill.id}`;
125
+ return `${splitHostId(fill.pluginId)?.localId ?? fill.pluginId}/${fill.id}`;
122
126
  }
123
127
  /**
124
128
  * The one background to show, never a stack: the configured fill, else Po's bamboo, else none; `none` shows
@@ -1 +1 @@
1
- {"version":3,"file":"templateCatalog.mjs","names":[],"sources":["../../../src/web/lib/templateCatalog.ts"],"sourcesContent":["import {\n DEFAULT_BACKDROP_ID,\n DEFAULT_TEMPLATE_ID,\n NO_BACKDROP,\n parseNativeTemplate,\n parseWebTemplate,\n type NativeTemplateContribution,\n type WebPluginDefinition,\n type WebPluginScope,\n type WebTemplateContribution,\n} from '@agimon-ai/po-core/web';\n\nimport { pluginsAtScope } from './pluginScopes';\nexport interface InstalledWebTemplate extends WebTemplateContribution {\n pluginId: string;\n}\n\nexport interface WebTemplateDiagnostic {\n kind: 'invalid-template' | 'duplicate-template';\n pluginId: string;\n message: string;\n}\n\nexport interface WebTemplateCatalog {\n templates: InstalledWebTemplate[];\n diagnostics: WebTemplateDiagnostic[];\n}\n\nlet bundledTemplates: readonly WebPluginDefinition[] = [];\n\n/** The host supplies its bundled recovery application, avoiding a library-to-template dependency. */\nexport function bindBundledWebTemplates(plugins: readonly WebPluginDefinition[]): void {\n bundledTemplates = plugins;\n}\n\n/**\n * One plugin field of template contributions, parsed entry by entry; the first owner of an id wins.\n * Bundled plugins only fill gaps: an id the host already provides is skipped without a diagnostic.\n */\nfunction collectTemplates<T extends { id: string }>(\n plugins: readonly WebPluginDefinition[],\n field: 'templates' | 'nativeTemplates',\n parse: (value: unknown) => T | undefined,\n bundled: readonly WebPluginDefinition[] = [],\n): { templates: (T & { pluginId: string })[]; diagnostics: WebTemplateDiagnostic[] } {\n const templates = new Map<string, T & { pluginId: string }>();\n const diagnostics: WebTemplateDiagnostic[] = [];\n const collect = (plugin: WebPluginDefinition, fillsGaps: boolean): void => {\n let entries: unknown;\n try {\n entries = plugin[field];\n } catch {\n diagnostics.push({\n kind: 'invalid-template',\n pluginId: plugin.id,\n message: `Template metadata from '${plugin.id}' could not be read.`,\n });\n return;\n }\n if (entries === undefined) return;\n if (!Array.isArray(entries)) {\n diagnostics.push({\n kind: 'invalid-template',\n pluginId: plugin.id,\n message: `Plugin '${plugin.id}' must declare ${field} as an array.`,\n });\n return;\n }\n for (const entry of entries) {\n let template: T | undefined;\n try {\n template = parse(entry);\n } catch {\n template = undefined;\n }\n if (template === undefined) {\n diagnostics.push({\n kind: 'invalid-template',\n pluginId: plugin.id,\n message: `Plugin '${plugin.id}' declares an invalid template or an unsupported template contract.`,\n });\n continue;\n }\n const owner = templates.get(template.id);\n if (owner !== undefined && fillsGaps) continue;\n if (owner !== undefined) {\n diagnostics.push({\n kind: 'duplicate-template',\n pluginId: plugin.id,\n message: `Template '${template.id}' is already provided by '${owner.pluginId}'; keeping the first.`,\n });\n continue;\n }\n templates.set(template.id, { ...template, pluginId: plugin.id });\n }\n };\n\n for (const plugin of plugins) collect(plugin, false);\n for (const plugin of bundled) collect(plugin, true);\n return { templates: [...templates.values()], diagnostics };\n}\n\n/** Read scoped templates, then add any bundled template the scope does not provide. */\nexport function collectWebTemplates(\n plugins: readonly WebPluginDefinition[],\n scope?: WebPluginScope,\n): WebTemplateCatalog {\n return collectTemplates(\n plugins,\n 'templates',\n parseWebTemplate,\n scope === undefined ? [] : pluginsAtScope(bundledTemplates, scope),\n );\n}\n\nexport interface InstalledNativeTemplate extends NativeTemplateContribution {\n pluginId: string;\n}\n\nexport interface NativeTemplateCatalog {\n templates: InstalledNativeTemplate[];\n diagnostics: WebTemplateDiagnostic[];\n}\n\nlet bundledNativeTemplates: readonly WebPluginDefinition[] = [];\n\n/** The phone app's bundled default layout, bound by the host exactly as the cockpit binds its own. */\nexport function bindBundledNativeTemplates(plugins: readonly WebPluginDefinition[]): void {\n bundledNativeTemplates = plugins;\n}\n\n/** Phone layouts from `nativeTemplates`, then any bundled layout the scope does not provide. */\nexport function collectNativeTemplates(\n plugins: readonly WebPluginDefinition[],\n scope?: WebPluginScope,\n): NativeTemplateCatalog {\n return collectTemplates(\n plugins,\n 'nativeTemplates',\n parseNativeTemplate,\n scope === undefined ? [] : pluginsAtScope(bundledNativeTemplates, scope),\n );\n}\n\n/** The phone app's own copy of a bundled layout, valid at the global scope, for screens no host owns. */\nexport function bundledNativeTemplate(id: string): NativeTemplateContribution | undefined {\n return collectTemplates(\n [],\n 'nativeTemplates',\n parseNativeTemplate,\n pluginsAtScope(bundledNativeTemplates, 'host'),\n ).templates.find((template) => template.id === id);\n}\n\n/** The cockpit's choice rule for the phone: configured, then the default, then the first by id. */\nexport function resolveNativeTemplate(\n templates: readonly InstalledNativeTemplate[],\n configured: string | undefined,\n failed: readonly string[] = [],\n): InstalledNativeTemplate | undefined {\n const available = templates.filter((template) => !failed.includes(template.id));\n return (\n available.find((template) => template.id === configured) ??\n available.find((template) => template.id === DEFAULT_TEMPLATE_ID) ??\n [...available].sort((left, right) => left.id.localeCompare(right.id))[0]\n );\n}\n\n/** A missing default stays in config, since another workspace may still provide it. */\nexport function resolveWebTemplate(\n templates: readonly InstalledWebTemplate[],\n configured: string | undefined,\n failed: readonly string[] = [],\n): { template: InstalledWebTemplate | undefined; warning: string | undefined } {\n const available = templates.filter((template) => !failed.includes(template.id));\n const preferred = available.find((template) => template.id === configured);\n const template =\n preferred ??\n available.find((candidate) => candidate.id === DEFAULT_TEMPLATE_ID) ??\n [...available].sort((left, right) => left.id.localeCompare(right.id))[0];\n if (!template)\n return {\n template: undefined,\n warning: 'No compatible web template is available. Add a template package to modes.yaml and run po sync.',\n };\n if (configured && !preferred)\n return { template, warning: `Configured template '${configured}' is unavailable; showing '${template.label}'.` };\n if (failed.length > 0)\n return { template, warning: 'A template could not render. A different available template is being shown.' };\n return { template, warning: undefined };\n}\n\n/** A background's `web.backdrop` value: the `<pluginId>/<fillId>` of its `backdrop` fill. */\nexport function backdropId(fill: { pluginId: string; id: string }): string {\n return `${fill.pluginId}/${fill.id}`;\n}\n\n/**\n * The one background to show, never a stack: the configured fill, else Po's bamboo, else none; `none` shows\n * none. A configured fill that is not installed stays in config, since another workspace may still provide it.\n */\nexport function resolveBackdrop<Fill extends { pluginId: string; id: string }>(\n fills: readonly Fill[],\n configured: string | undefined,\n): Fill | undefined {\n if (configured === NO_BACKDROP) return undefined;\n return (\n fills.find((fill) => backdropId(fill) === configured) ??\n fills.find((fill) => backdropId(fill) === DEFAULT_BACKDROP_ID)\n );\n}\n"],"mappings":";;;AA4BA,IAAI,mBAAmD,CAAC;;AAGxD,SAAgB,wBAAwB,SAA+C;CACrF,mBAAmB;AACrB;;;;;AAMA,SAAS,iBACP,SACA,OACA,OACA,UAA0C,CAAC,GACwC;CACnF,MAAM,4BAAY,IAAI,IAAsC;CAC5D,MAAM,cAAuC,CAAC;CAC9C,MAAM,WAAW,QAA6B,cAA6B;EACzE,IAAI;EACJ,IAAI;GACF,UAAU,OAAO;EACnB,QAAQ;GACN,YAAY,KAAK;IACf,MAAM;IACN,UAAU,OAAO;IACjB,SAAS,2BAA2B,OAAO,GAAG;GAChD,CAAC;GACD;EACF;EACA,IAAI,YAAY,KAAA,GAAW;EAC3B,IAA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,WAAW,IAAI,MAAM,UAAU,KACpD,MAAM,MAAM,SAAS,WAAW,IAAI,MAAM,mBAAmB;AAEjE"}
1
+ {"version":3,"file":"templateCatalog.mjs","names":[],"sources":["../../../src/web/lib/templateCatalog.ts"],"sourcesContent":["import {\n DEFAULT_BACKDROP_ID,\n DEFAULT_TEMPLATE_ID,\n NO_BACKDROP,\n parseNativeTemplate,\n parseWebTemplate,\n type NativeTemplateContribution,\n type WebPluginDefinition,\n type WebPluginScope,\n type WebTemplateContribution,\n} from '@agimon-ai/po-core/web';\n\nimport { splitHostId } from './hostIdentity';\nimport { pluginsAtScope } from './pluginScopes';\nexport interface InstalledWebTemplate extends WebTemplateContribution {\n pluginId: string;\n}\n\nexport interface WebTemplateDiagnostic {\n kind: 'invalid-template' | 'duplicate-template';\n pluginId: string;\n message: string;\n}\n\nexport interface WebTemplateCatalog {\n templates: InstalledWebTemplate[];\n diagnostics: WebTemplateDiagnostic[];\n}\n\nlet bundledTemplates: readonly WebPluginDefinition[] = [];\n\n/** The host supplies its bundled recovery application, avoiding a library-to-template dependency. */\nexport function bindBundledWebTemplates(plugins: readonly WebPluginDefinition[]): void {\n bundledTemplates = plugins;\n}\n\n/**\n * One plugin field of template contributions, parsed entry by entry; the first owner of an id wins.\n * Bundled plugins only fill gaps: an id the host already provides is skipped without a diagnostic.\n */\nfunction collectTemplates<T extends { id: string }>(\n plugins: readonly WebPluginDefinition[],\n field: 'templates' | 'nativeTemplates',\n parse: (value: unknown) => T | undefined,\n bundled: readonly WebPluginDefinition[] = [],\n): { templates: (T & { pluginId: string })[]; diagnostics: WebTemplateDiagnostic[] } {\n const templates = new Map<string, T & { pluginId: string }>();\n const diagnostics: WebTemplateDiagnostic[] = [];\n const collect = (plugin: WebPluginDefinition, fillsGaps: boolean): void => {\n let entries: unknown;\n try {\n entries = plugin[field];\n } catch {\n diagnostics.push({\n kind: 'invalid-template',\n pluginId: plugin.id,\n message: `Template metadata from '${plugin.id}' could not be read.`,\n });\n return;\n }\n if (entries === undefined) return;\n if (!Array.isArray(entries)) {\n diagnostics.push({\n kind: 'invalid-template',\n pluginId: plugin.id,\n message: `Plugin '${plugin.id}' must declare ${field} as an array.`,\n });\n return;\n }\n for (const entry of entries) {\n let template: T | undefined;\n try {\n template = parse(entry);\n } catch {\n template = undefined;\n }\n if (template === undefined) {\n diagnostics.push({\n kind: 'invalid-template',\n pluginId: plugin.id,\n message: `Plugin '${plugin.id}' declares an invalid template or an unsupported template contract.`,\n });\n continue;\n }\n const owner = templates.get(template.id);\n if (owner !== undefined && fillsGaps) continue;\n if (owner !== undefined) {\n diagnostics.push({\n kind: 'duplicate-template',\n pluginId: plugin.id,\n message: `Template '${template.id}' is already provided by '${owner.pluginId}'; keeping the first.`,\n });\n continue;\n }\n templates.set(template.id, { ...template, pluginId: plugin.id });\n }\n };\n\n for (const plugin of plugins) collect(plugin, false);\n for (const plugin of bundled) collect(plugin, true);\n return { templates: [...templates.values()], diagnostics };\n}\n\n/** Read scoped templates, then add any bundled template the scope does not provide. */\nexport function collectWebTemplates(\n plugins: readonly WebPluginDefinition[],\n scope?: WebPluginScope,\n): WebTemplateCatalog {\n return collectTemplates(\n plugins,\n 'templates',\n parseWebTemplate,\n scope === undefined ? [] : pluginsAtScope(bundledTemplates, scope),\n );\n}\n\nexport interface InstalledNativeTemplate extends NativeTemplateContribution {\n pluginId: string;\n}\n\nexport interface NativeTemplateCatalog {\n templates: InstalledNativeTemplate[];\n diagnostics: WebTemplateDiagnostic[];\n}\n\nlet bundledNativeTemplates: readonly WebPluginDefinition[] = [];\n\n/** The phone app's bundled default layout, bound by the host exactly as the cockpit binds its own. */\nexport function bindBundledNativeTemplates(plugins: readonly WebPluginDefinition[]): void {\n bundledNativeTemplates = plugins;\n}\n\n/** Phone layouts from `nativeTemplates`, then any bundled layout the scope does not provide. */\nexport function collectNativeTemplates(\n plugins: readonly WebPluginDefinition[],\n scope?: WebPluginScope,\n): NativeTemplateCatalog {\n return collectTemplates(\n plugins,\n 'nativeTemplates',\n parseNativeTemplate,\n scope === undefined ? [] : pluginsAtScope(bundledNativeTemplates, scope),\n );\n}\n\n/** The phone app's own copy of a bundled layout, valid at the global scope, for screens no host owns. */\nexport function bundledNativeTemplate(id: string): NativeTemplateContribution | undefined {\n return collectTemplates(\n [],\n 'nativeTemplates',\n parseNativeTemplate,\n pluginsAtScope(bundledNativeTemplates, 'host'),\n ).templates.find((template) => template.id === id);\n}\n\n/** The cockpit's choice rule for the phone: configured, then the default, then the first by id. */\nexport function resolveNativeTemplate(\n templates: readonly InstalledNativeTemplate[],\n configured: string | undefined,\n failed: readonly string[] = [],\n): InstalledNativeTemplate | undefined {\n const available = templates.filter((template) => !failed.includes(template.id));\n return (\n available.find((template) => template.id === configured) ??\n available.find((template) => template.id === DEFAULT_TEMPLATE_ID) ??\n [...available].sort((left, right) => left.id.localeCompare(right.id))[0]\n );\n}\n\n/** A missing default stays in config, since another workspace may still provide it. */\nexport function resolveWebTemplate(\n templates: readonly InstalledWebTemplate[],\n configured: string | undefined,\n failed: readonly string[] = [],\n): { template: InstalledWebTemplate | undefined; warning: string | undefined } {\n const available = templates.filter((template) => !failed.includes(template.id));\n const preferred = available.find((template) => template.id === configured);\n const template =\n preferred ??\n available.find((candidate) => candidate.id === DEFAULT_TEMPLATE_ID) ??\n [...available].sort((left, right) => left.id.localeCompare(right.id))[0];\n if (!template)\n return {\n template: undefined,\n warning: 'No compatible web template is available. Add a template package to modes.yaml and run po sync.',\n };\n if (configured && !preferred)\n return { template, warning: `Configured template '${configured}' is unavailable; showing '${template.label}'.` };\n if (failed.length > 0)\n return { template, warning: 'A template could not render. A different available template is being shown.' };\n return { template, warning: undefined };\n}\n\n/**\n * A background's `web.backdrop` value: the `<pluginId>/<fillId>` of its `backdrop` fill. A cloud host's registry\n * prefixes plugin ids with its host id; config never carries that runtime prefix.\n */\nexport function backdropId(fill: { pluginId: string; id: string }): string {\n return `${splitHostId(fill.pluginId)?.localId ?? fill.pluginId}/${fill.id}`;\n}\n\n/**\n * The one background to show, never a stack: the configured fill, else Po's bamboo, else none; `none` shows\n * none. A configured fill that is not installed stays in config, since another workspace may still provide it.\n */\nexport function resolveBackdrop<Fill extends { pluginId: string; id: string }>(\n fills: readonly Fill[],\n configured: string | undefined,\n): Fill | undefined {\n if (configured === NO_BACKDROP) return undefined;\n return (\n fills.find((fill) => backdropId(fill) === configured) ??\n fills.find((fill) => backdropId(fill) === DEFAULT_BACKDROP_ID)\n );\n}\n"],"mappings":";;;;AA6BA,IAAI,mBAAmD,CAAC;;AAGxD,SAAgB,wBAAwB,SAA+C;CACrF,mBAAmB;AACrB;;;;;AAMA,SAAS,iBACP,SACA,OACA,OACA,UAA0C,CAAC,GACwC;CACnF,MAAM,4BAAY,IAAI,IAAsC;CAC5D,MAAM,cAAuC,CAAC;CAC9C,MAAM,WAAW,QAA6B,cAA6B;EACzE,IAAI;EACJ,IAAI;GACF,UAAU,OAAO;EACnB,QAAQ;GACN,YAAY,KAAK;IACf,MAAM;IACN,UAAU,OAAO;IACjB,SAAS,2BAA2B,OAAO,GAAG;GAChD,CAAC;GACD;EACF;EACA,IAAI,YAAY,KAAA,GAAW;EAC3B,IAAI,CAAC,MAAM,QAAQ,OAAO,GAAG;GAC3B,YAAY,KAAK;IACf,MAAM;IACN,UAAU,OAAO;IACjB,SAAS,WAAW,OAAO,GAAG,iBAAiB,MAAM;GACvD,CAAC;GACD;EACF;EACA,KAAK,MAAM,SAAS,SAAS;GAC3B,IAAI;GACJ,IAAI;IACF,WAAW,MAAM,KAAK;GACxB,QAAQ;IACN,WAAW,KAAA;GACb;GACA,IAAI,aAAa,KAAA,GAAW;IAC1B,YAAY,KAAK;KACf,MAAM;KACN,UAAU,OAAO;KACjB,SAAS,WAAW,OAAO,GAAG;IAChC,CAAC;IACD;GACF;GACA,MAAM,QAAQ,UAAU,IAAI,SAAS,EAAE;GACvC,IAAI,UAAU,KAAA,KAAa,WAAW;GACtC,IAAI,UAAU,KAAA,GAAW;IACvB,YAAY,KAA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,YAAY,UAAU,QAAQ,aAAa,CAAC,OAAO,SAAS,SAAS,EAAE,CAAC;CAC9E,MAAM,YAAY,UAAU,MAAM,aAAa,SAAS,OAAO,UAAU;CACzE,MAAM,WACJ,aACA,UAAU,MAAM,cAAc,UAAU,OAAO,mBAAmB,KAClE,CAAC,GAAG,SAAS,CAAC,CAAC,MAAM,MAAM,UAAU,KAAK,GAAG,cAAc,MAAM,EAAE,CAAC,CAAC,CAAC;CACxE,IAAI,CAAC,UACH,OAAO;EACL,UAAU,KAAA;EACV,SAAS;CACX;CACF,IAAI,cAAc,CAAC,WACjB,OAAO;EAAE;EAAU,SAAS,wBAAwB,WAAW,6BAA6B,SAAS,MAAM;CAAI;CACjH,IAAI,OAAO,SAAS,GAClB,OAAO;EAAE;EAAU,SAAS;CAA8E;CAC5G,OAAO;EAAE;EAAU,SAAS,KAAA;CAAU;AACxC;;;;;AAMA,SAAgB,WAAW,MAAgD;CACzE,OAAO,GAAG,YAAY,KAAK,QAAQ,CAAC,EAAE,WAAW,KAAK,SAAS,GAAG,KAAK;AACzE;;;;;AAMA,SAAgB,gBACd,OACA,YACkB;CAClB,IAAI,eAAe,aAAa,OAAO,KAAA;CACvC,OACE,MAAM,MAAM,SAAS,WAAW,IAAI,MAAM,UAAU,KACpD,MAAM,MAAM,SAAS,WAAW,IAAI,MAAM,mBAAmB;AAEjE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agimon-ai/po-web-dashboard",
3
- "version": "0.0.0-alpha.152",
3
+ "version": "0.0.0-alpha.153",
4
4
  "description": "Shared browser state, actions and optional views for Po dashboard templates.",
5
5
  "keywords": [
6
6
  "ai",
@@ -61,9 +61,9 @@
61
61
  "access": "public"
62
62
  },
63
63
  "dependencies": {
64
- "@agimon-ai/po-core": "0.0.0-alpha.152",
65
- "@agimon-ai/po-web-components": "0.0.0-alpha.152",
66
- "@agimon-ai/po-web-security": "0.0.0-alpha.152",
64
+ "@agimon-ai/po-core": "0.0.0-alpha.153",
65
+ "@agimon-ai/po-web-components": "0.0.0-alpha.153",
66
+ "@agimon-ai/po-web-security": "0.0.0-alpha.153",
67
67
  "@earendil-works/chord": "1.5.1",
68
68
  "@simplewebauthn/browser": "^14.0.0",
69
69
  "@tanstack/react-router": "1.170.45",
@@ -73,7 +73,7 @@
73
73
  "qrcode-generator": "^2.0.4"
74
74
  },
75
75
  "devDependencies": {
76
- "@agimon-ai/vibe-lint-plugin-po-web": "0.0.0-alpha.152",
76
+ "@agimon-ai/vibe-lint-plugin-po-web": "0.0.0-alpha.153",
77
77
  "@types/node": "26.6.5",
78
78
  "@types/react": "19.3.0",
79
79
  "@types/react-dom": "19.3.0",