@agimon-ai/po-web-dashboard 0.0.0-alpha.52 → 0.0.0-alpha.53

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core.cjs CHANGED
@@ -16,6 +16,7 @@ const require_transport = require("./web/lib/transport.cjs");
16
16
  const require_pluginSlotProps = require("./web/lib/pluginSlotProps.cjs");
17
17
  const require_protocolHubSocket = require("./web/lib/protocolHubSocket.cjs");
18
18
  const require_sessionModel = require("./web/lib/sessionModel.cjs");
19
+ const require_qrMatrix = require("./web/lib/qrMatrix.cjs");
19
20
  const require_sessionSummary = require("./web/lib/sessionSummary.cjs");
20
21
  const require_sessionRailModel = require("./web/lib/sessionRailModel.cjs");
21
22
  const require_toolCompletionTabs = require("./web/lib/toolCompletionTabs.cjs");
@@ -190,6 +191,7 @@ exports.projectedGroups = require_contextComposition.projectedGroups;
190
191
  exports.promoteQueuedCommand = require_commands.promoteQueuedCommand;
191
192
  exports.promoteQueuedMessage = require_sessionStore.promoteQueuedMessage;
192
193
  exports.promptCommand = require_commands.promptCommand;
194
+ exports.qrMatrix = require_qrMatrix.qrMatrix;
193
195
  exports.qualifyHostId = require_hostIdentity.qualifyHostId;
194
196
  exports.qualifyHostKey = require_hostIdentity.qualifyHostKey;
195
197
  exports.queueFollowUp = require_sessionStore.queueFollowUp;
package/dist/core.d.mts CHANGED
@@ -1,3 +1,4 @@
1
+ import { qrMatrix } from "./web/lib/qrMatrix.mjs";
1
2
  import { AgentInfo, AssistantEntry, CommandInfo, DialogMethod, DialogRequest, EditorTextRequest, EntryKind, InputSender, IntercomEntry, ModelChoice, NoticeEntry, ProfileIdentity, QueuedEntry, ReduceSessionOptions, SessionState, SessionStats, SettledEntry, TimelineEntry, ToolEntry, UserEntry, UserImage, appendQueued, appendUserPrompt, applySelectionAnswer, clearDialog, clearQueuedEntries, imagesFromContent, initialSessionState, isSupportedImageMimeType, prependHistory, reduceSession, removeQueuedEntry, replaceQueuedEntries, selectionStatuses, summariseArgs, textFromContent } from "./web/lib/sessionModel.mjs";
2
3
  import { BUILTIN_COMMANDS, RpcImage, abortCommand, builtinCommandFrame, clearQueueCommand, compactCommand, dialogCancelled, dialogConfirmed, dialogValue, enqueueAutomaticCommand, followUpCommand, getAvailableModelsCommand, getAvailableThinkingLevelsCommand, getCommandsCommand, getSessionStatsCommand, getStateCommand, promoteQueuedCommand, promptCommand, removeQueuedCommand, resumeQueueCommand, rewindCommand, setModelCommand, setSessionNameCommand, setThinkingLevelCommand, steerCommand } from "./web/lib/commands.mjs";
3
4
  import { CompletionItem, CompletionKind, CompletionTrigger, MAX_COMPLETION_ITEMS, TRIGGER_CHARS, commandCompletions, fileCompletions, triggerTokenAt } from "./web/lib/composerCompletion.mjs";
@@ -34,4 +35,4 @@ import { bindSessionFileLinkModes, sessionMinorModes } from "./web/stores/fileLi
34
35
  import { createToolCompletionTabs } from "./web/lib/toolCompletionTabs.mjs";
35
36
  import { createWebMcpSimulator } from "./web/lib/webmcpSimulator.mjs";
36
37
  import { localHostId, parseHostKey, qualifyHostId, qualifyHostKey, splitHostId } from "./web/lib/hostIdentity.mjs";
37
- export { type ActivityGroup, AgentInfo, AssistantEntry, AttachPhase, BUILTIN_COMMANDS, CommandInfo, CompletionItem, CompletionKind, CompletionTrigger, ComposerPromptClaim, type ContextGroup, type ContextItemSource, DialogMethod, DialogPromptClaim, DialogRequest, EditorTextRequest, EntryKind, HOST_SLOTS, HistoryPage, ImageRefScope, InputSender, InstallDiagnostic, InstallDiagnosticKind, InstalledContextAction, InstalledHomeContribution, type InstalledNativeTemplate, InstalledRepositorySettingsPanel, InstalledSettingsPanel, InstalledUserMessageAction, IntercomEntry, LEGACY_WORKSPACE_ID, MAX_COMPLETION_ITEMS, MenuClaim, MenuKind, MenuState, type MinorMode, ModelChoice, type NativeTemplateCatalog, NoticeEntry, ProfileIdentity, QueuedEntry, RailRestartState, RailSessionInput, ReduceSessionOptions, ResolvedFill, RpcImage, type SelectionAxis, SessionMeta, SessionRailModelInput, SessionSocket, SessionSocketHandlers, SessionState, SessionStats, SessionsState, SettledEntry, StatusClock, StatusLineInput, TRIGGER_CHARS, ThreadTranscriptReader, TimelineEntry, ToolEntry, ToolPromptClaim, ToolPromptInput, ToolRendererBoundary, type TransientTabActions, UPDATE_REQUIRED_REASON, UiTraceRecord, UiTraceSink, UserEntry, UserImage, WebPluginRegistry, WorkspacesState, abbreviateCwd, abortCommand, abortRun, activateWebPluginHost, activateWebPluginSession, activateWebPluginWorkspace, activeSessionId, activityGroupSlot, activityGroups, answerDialogConfirm, answerDialogValue, appendQueued, appendUserPrompt, applyCaptureFrame, applyHistoryPage, applyProtocolQueue, applyProtocolTranscript, applySelectionAnswer, applySessionBacklog, applySessionFrame, applySessionLifecycle, applySessionRemoved, applySessionUpsert, applySessionsSnapshot, applyThreadFrame, applyThreadTranscriptFrame, applyWorkspaceRemoved, applyWorkspaceUpsert, applyWorkspacesSnapshot, beginSessionReplay, beginSessionTransfer, bindBundledNativeTemplates, bindHistoryReader, bindHostTransport, bindImageReader, bindSessionFileLinkModes, bindSessionProtocol, bindSessionWebWorkspace, bindThreadReader, bindTransport, buildRailWorkspaces, builtinCommandFrame, cancelDialog, claimDialogMenu, clearDialog, clearPendingMenu, clearQueueCommand, clearQueuedEntries, clearQueuedMessages, closeTransientTab, commandCompletions, compactCommand, completeSessionTransfer, contextGroups, createDashboardTransport, createPagedTranscript, createProtocolHubSocket, createToolCompletionTabs, createWebMcpSimulator, createWebPluginRegistry, deleteQueuedMessage, dialogCancelled, dialogConfirmed, dialogValue, disconnectCaptures, dispatchChannelFrame, dispatchHeldSessionChannel, dropPluginSessionData, dropSessionStore, dropThreads, dropTransientTabs, endSessionReplay, enqueueAutomaticCommand, fileCompletions, fileTabForPath, findTransientTab, flushUiTrace, followUpCommand, getAvailableModelsCommand, getAvailableThinkingLevelsCommand, getCommandsCommand, getSessionStatsCommand, getStateCommand, globalSlotFills, hasSessionProtocol, heldSessionChannels, heldThreads, heldVoiceSessions, holdSessionChannels, holdVoiceSession, imagesFromContent, inactiveTotal, initialSessionState, installGlobalWebPlugins, installSessionWebPlugins, installWebPlugins, installWorkspaceWebPlugins, installedWebPlugins, invokeServerMethod, isDesktopClient, isSupportedImageMimeType, loadImageRef, loadModelChoices, localHostId, markSocketClosed, markUpdateRequired, menuStore, mergeScopedPlugins, minorModes, nativeTemplateCatalog, noSessions, noteRender, noteStoreUpdate, notifyHubConnected, onCaptureStatus, onComposerSubmitted, onHubConnected, openTransientTab, ownerLabel, ownersOf, paletteCommands, parseHostKey, parseSelection, pendingMenuFor, pendingSetupView, personaInitials, pluginActivityGroups, pluginContextActions, pluginDockFaces, pluginFileLinks, pluginHomeContributions, pluginLeaderBindings, pluginMinorModes, pluginRepositorySettingsPanels, pluginSelectionAxes, pluginSessionContext, pluginSettingsPanels, pluginSettingsSections, pluginSlotProps, pluginToolRenderer, pluginUserMessageActions, pluginsAtScope, prependHistory, projectedGroups, promoteQueuedCommand, promoteQueuedMessage, promptCommand, qualifyHostId, qualifyHostKey, queueFollowUp, queueFollowUpWithAck, railSessionStatus, reduceSession, refreshSessionFacts, refreshSessionSelection, refreshSessionStats, releaseDialogMenu, releaseProtocolTranscript, releaseTransport, removeHostWebPlugins, removeQueuedCommand, removeQueuedEntry, removeSessionWebPlugins, removeWorkspaceWebPlugins, renameSession, replaceQueuedEntries, requestLatestHistory, requestNewerHistory, requestOlderHistory, requestSessionProtocolFrame, resetMenuStore, resetSessionStore, resetSessionStores, resetSessions, resetThreads, resetWebPlugins, resetWorkspaces, resolveNativeTemplate, resolveParentId, resubscribeThreads, resumeQueueCommand, resumeQueuedMessages, reuseRailWorkspaces, rewindCommand, rewindToMessage, runCommand, runningCount, sameRailEntries, sameRailEntry, seedHistoryCursor, selectFastMode, selectModel, selectThinkingLevel, selectWorkspace, selectionAxes, selectionStatuses, sendFrame, sendFrameWithAck, sendHubFrame, sendSessionProtocolFrame, sessionMinorModes, sessionStatusClock, sessionStatusLine, sessionStoreFor, sessionToolRenderer, sessionWebPluginsInstalled, sessionsStore, setActiveSession, setAgentLock, setHasNewerHistory, setModelCommand, setPendingMenu, setSessionNameCommand, setSessionStreamed, setThinkingLevelCommand, setTransientTabSession, setUiTraceSink, setWebPluginLoadDiagnostics, slotFills, splitHostId, startPluginDefinitions, startWebPlugins, steerCommand, streamedSessions, submitCapture, submitMessage, submitMessageWithAck, subscribeActivitySources, subscribeThread, subscribeWebPluginRegistry, summariseArgs, summaryValueEqual, textFromContent, threadStoreKey, toolMessageProps, toolPromptClaim, totalTokens, traceProfilerRender, traceStore, transientTabsStore, transportForHost, triggerTokenAt, unsubscribeThread, updateDialogDraft, useActiveSession, useActiveSessionMeta, useActivityGroups, useDialogDraft, useDockFaceBadges, useDockFaces, useFileLinks, useHasOlderHistory, useImageRefs, useNoSessions, useRailEntries, useRailEntry, useRenderTrace, useTransientTabs, validateComposerCapture, waitForSession, watchHubThread, webPluginDiagnostics, webPluginRegistryForHost, webPluginRegistryRevision, webPluginsInstalled, webTabs, webTemplateCatalog, workspaceName, workspaceSlotFills, workspacesStore };
38
+ export { type ActivityGroup, AgentInfo, AssistantEntry, AttachPhase, BUILTIN_COMMANDS, CommandInfo, CompletionItem, CompletionKind, CompletionTrigger, ComposerPromptClaim, type ContextGroup, type ContextItemSource, DialogMethod, DialogPromptClaim, DialogRequest, EditorTextRequest, EntryKind, HOST_SLOTS, HistoryPage, ImageRefScope, InputSender, InstallDiagnostic, InstallDiagnosticKind, InstalledContextAction, InstalledHomeContribution, type InstalledNativeTemplate, InstalledRepositorySettingsPanel, InstalledSettingsPanel, InstalledUserMessageAction, IntercomEntry, LEGACY_WORKSPACE_ID, MAX_COMPLETION_ITEMS, MenuClaim, MenuKind, MenuState, type MinorMode, ModelChoice, type NativeTemplateCatalog, NoticeEntry, ProfileIdentity, QueuedEntry, RailRestartState, RailSessionInput, ReduceSessionOptions, ResolvedFill, RpcImage, type SelectionAxis, SessionMeta, SessionRailModelInput, SessionSocket, SessionSocketHandlers, SessionState, SessionStats, SessionsState, SettledEntry, StatusClock, StatusLineInput, TRIGGER_CHARS, ThreadTranscriptReader, TimelineEntry, ToolEntry, ToolPromptClaim, ToolPromptInput, ToolRendererBoundary, type TransientTabActions, UPDATE_REQUIRED_REASON, UiTraceRecord, UiTraceSink, UserEntry, UserImage, WebPluginRegistry, WorkspacesState, abbreviateCwd, abortCommand, abortRun, activateWebPluginHost, activateWebPluginSession, activateWebPluginWorkspace, activeSessionId, activityGroupSlot, activityGroups, answerDialogConfirm, answerDialogValue, appendQueued, appendUserPrompt, applyCaptureFrame, applyHistoryPage, applyProtocolQueue, applyProtocolTranscript, applySelectionAnswer, applySessionBacklog, applySessionFrame, applySessionLifecycle, applySessionRemoved, applySessionUpsert, applySessionsSnapshot, applyThreadFrame, applyThreadTranscriptFrame, applyWorkspaceRemoved, applyWorkspaceUpsert, applyWorkspacesSnapshot, beginSessionReplay, beginSessionTransfer, bindBundledNativeTemplates, bindHistoryReader, bindHostTransport, bindImageReader, bindSessionFileLinkModes, bindSessionProtocol, bindSessionWebWorkspace, bindThreadReader, bindTransport, buildRailWorkspaces, builtinCommandFrame, cancelDialog, claimDialogMenu, clearDialog, clearPendingMenu, clearQueueCommand, clearQueuedEntries, clearQueuedMessages, closeTransientTab, commandCompletions, compactCommand, completeSessionTransfer, contextGroups, createDashboardTransport, createPagedTranscript, createProtocolHubSocket, createToolCompletionTabs, createWebMcpSimulator, createWebPluginRegistry, deleteQueuedMessage, dialogCancelled, dialogConfirmed, dialogValue, disconnectCaptures, dispatchChannelFrame, dispatchHeldSessionChannel, dropPluginSessionData, dropSessionStore, dropThreads, dropTransientTabs, endSessionReplay, enqueueAutomaticCommand, fileCompletions, fileTabForPath, findTransientTab, flushUiTrace, followUpCommand, getAvailableModelsCommand, getAvailableThinkingLevelsCommand, getCommandsCommand, getSessionStatsCommand, getStateCommand, globalSlotFills, hasSessionProtocol, heldSessionChannels, heldThreads, heldVoiceSessions, holdSessionChannels, holdVoiceSession, imagesFromContent, inactiveTotal, initialSessionState, installGlobalWebPlugins, installSessionWebPlugins, installWebPlugins, installWorkspaceWebPlugins, installedWebPlugins, invokeServerMethod, isDesktopClient, isSupportedImageMimeType, loadImageRef, loadModelChoices, localHostId, markSocketClosed, markUpdateRequired, menuStore, mergeScopedPlugins, minorModes, nativeTemplateCatalog, noSessions, noteRender, noteStoreUpdate, notifyHubConnected, onCaptureStatus, onComposerSubmitted, onHubConnected, openTransientTab, ownerLabel, ownersOf, paletteCommands, parseHostKey, parseSelection, pendingMenuFor, pendingSetupView, personaInitials, pluginActivityGroups, pluginContextActions, pluginDockFaces, pluginFileLinks, pluginHomeContributions, pluginLeaderBindings, pluginMinorModes, pluginRepositorySettingsPanels, pluginSelectionAxes, pluginSessionContext, pluginSettingsPanels, pluginSettingsSections, pluginSlotProps, pluginToolRenderer, pluginUserMessageActions, pluginsAtScope, prependHistory, projectedGroups, promoteQueuedCommand, promoteQueuedMessage, promptCommand, qrMatrix, qualifyHostId, qualifyHostKey, queueFollowUp, queueFollowUpWithAck, railSessionStatus, reduceSession, refreshSessionFacts, refreshSessionSelection, refreshSessionStats, releaseDialogMenu, releaseProtocolTranscript, releaseTransport, removeHostWebPlugins, removeQueuedCommand, removeQueuedEntry, removeSessionWebPlugins, removeWorkspaceWebPlugins, renameSession, replaceQueuedEntries, requestLatestHistory, requestNewerHistory, requestOlderHistory, requestSessionProtocolFrame, resetMenuStore, resetSessionStore, resetSessionStores, resetSessions, resetThreads, resetWebPlugins, resetWorkspaces, resolveNativeTemplate, resolveParentId, resubscribeThreads, resumeQueueCommand, resumeQueuedMessages, reuseRailWorkspaces, rewindCommand, rewindToMessage, runCommand, runningCount, sameRailEntries, sameRailEntry, seedHistoryCursor, selectFastMode, selectModel, selectThinkingLevel, selectWorkspace, selectionAxes, selectionStatuses, sendFrame, sendFrameWithAck, sendHubFrame, sendSessionProtocolFrame, sessionMinorModes, sessionStatusClock, sessionStatusLine, sessionStoreFor, sessionToolRenderer, sessionWebPluginsInstalled, sessionsStore, setActiveSession, setAgentLock, setHasNewerHistory, setModelCommand, setPendingMenu, setSessionNameCommand, setSessionStreamed, setThinkingLevelCommand, setTransientTabSession, setUiTraceSink, setWebPluginLoadDiagnostics, slotFills, splitHostId, startPluginDefinitions, startWebPlugins, steerCommand, streamedSessions, submitCapture, submitMessage, submitMessageWithAck, subscribeActivitySources, subscribeThread, subscribeWebPluginRegistry, summariseArgs, summaryValueEqual, textFromContent, threadStoreKey, toolMessageProps, toolPromptClaim, totalTokens, traceProfilerRender, traceStore, transientTabsStore, transportForHost, triggerTokenAt, unsubscribeThread, updateDialogDraft, useActiveSession, useActiveSessionMeta, useActivityGroups, useDialogDraft, useDockFaceBadges, useDockFaces, useFileLinks, useHasOlderHistory, useImageRefs, useNoSessions, useRailEntries, useRailEntry, useRenderTrace, useTransientTabs, validateComposerCapture, waitForSession, watchHubThread, webPluginDiagnostics, webPluginRegistryForHost, webPluginRegistryRevision, webPluginsInstalled, webTabs, webTemplateCatalog, workspaceName, workspaceSlotFills, workspacesStore };
package/dist/core.mjs CHANGED
@@ -15,6 +15,7 @@ import { bindHostTransport, bindTransport, createDashboardTransport, invokeServe
15
15
  import { pluginSessionContext, pluginSlotProps } from "./web/lib/pluginSlotProps.mjs";
16
16
  import { createProtocolHubSocket } from "./web/lib/protocolHubSocket.mjs";
17
17
  import { appendQueued, appendUserPrompt, applySelectionAnswer, clearDialog, clearQueuedEntries, imagesFromContent, initialSessionState, isSupportedImageMimeType, prependHistory, reduceSession, removeQueuedEntry, replaceQueuedEntries, selectionStatuses, summariseArgs, textFromContent } from "./web/lib/sessionModel.mjs";
18
+ import { qrMatrix } from "./web/lib/qrMatrix.mjs";
18
19
  import { abbreviateCwd, personaInitials, runningCount, sessionStatusClock, sessionStatusLine, summaryValueEqual } from "./web/lib/sessionSummary.mjs";
19
20
  import { LEGACY_WORKSPACE_ID, buildRailWorkspaces, pendingSetupView, railSessionStatus, reuseRailWorkspaces, workspaceName } from "./web/lib/sessionRailModel.mjs";
20
21
  import { createToolCompletionTabs } from "./web/lib/toolCompletionTabs.mjs";
@@ -34,4 +35,4 @@ import { closeTransientTab, dropTransientTabs, findTransientTab, openTransientTa
34
35
  import { applyWorkspaceRemoved, applyWorkspaceUpsert, applyWorkspacesSnapshot, resetWorkspaces, selectWorkspace, workspacesStore } from "./web/stores/workspacesStore.mjs";
35
36
  import { updateDialogDraft, useDialogDraft } from "./web/stores/dialogDraftStore.mjs";
36
37
  import { createWebMcpSimulator } from "./web/lib/webmcpSimulator.mjs";
37
- export { BUILTIN_COMMANDS, HOST_SLOTS, ImageRefScope, LEGACY_WORKSPACE_ID, MAX_COMPLETION_ITEMS, TRIGGER_CHARS, ToolRendererBoundary, UPDATE_REQUIRED_REASON, abbreviateCwd, abortCommand, abortRun, activateWebPluginHost, activateWebPluginSession, activateWebPluginWorkspace, activeSessionId, activityGroupSlot, activityGroups, answerDialogConfirm, answerDialogValue, appendQueued, appendUserPrompt, applyCaptureFrame, applyHistoryPage, applyProtocolQueue, applyProtocolTranscript, applySelectionAnswer, applySessionBacklog, applySessionFrame, applySessionLifecycle, applySessionRemoved, applySessionUpsert, applySessionsSnapshot, applyThreadFrame, applyThreadTranscriptFrame, applyWorkspaceRemoved, applyWorkspaceUpsert, applyWorkspacesSnapshot, beginSessionReplay, beginSessionTransfer, bindBundledNativeTemplates, bindHistoryReader, bindHostTransport, bindImageReader, bindSessionFileLinkModes, bindSessionProtocol, bindSessionWebWorkspace, bindThreadReader, bindTransport, buildRailWorkspaces, builtinCommandFrame, cancelDialog, claimDialogMenu, clearDialog, clearPendingMenu, clearQueueCommand, clearQueuedEntries, clearQueuedMessages, closeTransientTab, commandCompletions, compactCommand, completeSessionTransfer, contextGroups, createDashboardTransport, createPagedTranscript, createProtocolHubSocket, createToolCompletionTabs, createWebMcpSimulator, createWebPluginRegistry, deleteQueuedMessage, dialogCancelled, dialogConfirmed, dialogValue, disconnectCaptures, dispatchChannelFrame, dispatchHeldSessionChannel, dropPluginSessionData, dropSessionStore, dropThreads, dropTransientTabs, endSessionReplay, enqueueAutomaticCommand, fileCompletions, fileTabForPath, findTransientTab, flushUiTrace, followUpCommand, getAvailableModelsCommand, getAvailableThinkingLevelsCommand, getCommandsCommand, getSessionStatsCommand, getStateCommand, globalSlotFills, hasSessionProtocol, heldSessionChannels, heldThreads, heldVoiceSessions, holdSessionChannels, holdVoiceSession, imagesFromContent, inactiveTotal, initialSessionState, installGlobalWebPlugins, installSessionWebPlugins, installWebPlugins, installWorkspaceWebPlugins, installedWebPlugins, invokeServerMethod, isDesktopClient, isSupportedImageMimeType, loadImageRef, loadModelChoices, localHostId, markSocketClosed, markUpdateRequired, menuStore, mergeScopedPlugins, minorModes, nativeTemplateCatalog, noSessions, noteRender, noteStoreUpdate, notifyHubConnected, onCaptureStatus, onComposerSubmitted, onHubConnected, openTransientTab, ownerLabel, ownersOf, paletteCommands, parseHostKey, parseSelection, pendingMenuFor, pendingSetupView, personaInitials, pluginActivityGroups, pluginContextActions, pluginDockFaces, pluginFileLinks, pluginHomeContributions, pluginLeaderBindings, pluginMinorModes, pluginRepositorySettingsPanels, pluginSelectionAxes, pluginSessionContext, pluginSettingsPanels, pluginSettingsSections, pluginSlotProps, pluginToolRenderer, pluginUserMessageActions, pluginsAtScope, prependHistory, projectedGroups, promoteQueuedCommand, promoteQueuedMessage, promptCommand, qualifyHostId, qualifyHostKey, queueFollowUp, queueFollowUpWithAck, railSessionStatus, reduceSession, refreshSessionFacts, refreshSessionSelection, refreshSessionStats, releaseDialogMenu, releaseProtocolTranscript, releaseTransport, removeHostWebPlugins, removeQueuedCommand, removeQueuedEntry, removeSessionWebPlugins, removeWorkspaceWebPlugins, renameSession, replaceQueuedEntries, requestLatestHistory, requestNewerHistory, requestOlderHistory, requestSessionProtocolFrame, resetMenuStore, resetSessionStore, resetSessionStores, resetSessions, resetThreads, resetWebPlugins, resetWorkspaces, resolveNativeTemplate, resolveParentId, resubscribeThreads, resumeQueueCommand, resumeQueuedMessages, reuseRailWorkspaces, rewindCommand, rewindToMessage, runCommand, runningCount, sameRailEntries, sameRailEntry, seedHistoryCursor, selectFastMode, selectModel, selectThinkingLevel, selectWorkspace, selectionAxes, selectionStatuses, sendFrame, sendFrameWithAck, sendHubFrame, sendSessionProtocolFrame, sessionMinorModes, sessionStatusClock, sessionStatusLine, sessionStoreFor, sessionToolRenderer, sessionWebPluginsInstalled, sessionsStore, setActiveSession, setAgentLock, setHasNewerHistory, setModelCommand, setPendingMenu, setSessionNameCommand, setSessionStreamed, setThinkingLevelCommand, setTransientTabSession, setUiTraceSink, setWebPluginLoadDiagnostics, slotFills, splitHostId, startPluginDefinitions, startWebPlugins, steerCommand, streamedSessions, submitCapture, submitMessage, submitMessageWithAck, subscribeActivitySources, subscribeThread, subscribeWebPluginRegistry, summariseArgs, summaryValueEqual, textFromContent, threadStoreKey, toolMessageProps, toolPromptClaim, totalTokens, traceProfilerRender, traceStore, transientTabsStore, transportForHost, triggerTokenAt, unsubscribeThread, updateDialogDraft, useActiveSession, useActiveSessionMeta, useActivityGroups, useDialogDraft, useDockFaceBadges, useDockFaces, useFileLinks, useHasOlderHistory, useImageRefs, useNoSessions, useRailEntries, useRailEntry, useRenderTrace, useTransientTabs, validateComposerCapture, waitForSession, watchHubThread, webPluginDiagnostics, webPluginRegistryForHost, webPluginRegistryRevision, webPluginsInstalled, webTabs, webTemplateCatalog, workspaceName, workspaceSlotFills, workspacesStore };
38
+ export { BUILTIN_COMMANDS, HOST_SLOTS, ImageRefScope, LEGACY_WORKSPACE_ID, MAX_COMPLETION_ITEMS, TRIGGER_CHARS, ToolRendererBoundary, UPDATE_REQUIRED_REASON, abbreviateCwd, abortCommand, abortRun, activateWebPluginHost, activateWebPluginSession, activateWebPluginWorkspace, activeSessionId, activityGroupSlot, activityGroups, answerDialogConfirm, answerDialogValue, appendQueued, appendUserPrompt, applyCaptureFrame, applyHistoryPage, applyProtocolQueue, applyProtocolTranscript, applySelectionAnswer, applySessionBacklog, applySessionFrame, applySessionLifecycle, applySessionRemoved, applySessionUpsert, applySessionsSnapshot, applyThreadFrame, applyThreadTranscriptFrame, applyWorkspaceRemoved, applyWorkspaceUpsert, applyWorkspacesSnapshot, beginSessionReplay, beginSessionTransfer, bindBundledNativeTemplates, bindHistoryReader, bindHostTransport, bindImageReader, bindSessionFileLinkModes, bindSessionProtocol, bindSessionWebWorkspace, bindThreadReader, bindTransport, buildRailWorkspaces, builtinCommandFrame, cancelDialog, claimDialogMenu, clearDialog, clearPendingMenu, clearQueueCommand, clearQueuedEntries, clearQueuedMessages, closeTransientTab, commandCompletions, compactCommand, completeSessionTransfer, contextGroups, createDashboardTransport, createPagedTranscript, createProtocolHubSocket, createToolCompletionTabs, createWebMcpSimulator, createWebPluginRegistry, deleteQueuedMessage, dialogCancelled, dialogConfirmed, dialogValue, disconnectCaptures, dispatchChannelFrame, dispatchHeldSessionChannel, dropPluginSessionData, dropSessionStore, dropThreads, dropTransientTabs, endSessionReplay, enqueueAutomaticCommand, fileCompletions, fileTabForPath, findTransientTab, flushUiTrace, followUpCommand, getAvailableModelsCommand, getAvailableThinkingLevelsCommand, getCommandsCommand, getSessionStatsCommand, getStateCommand, globalSlotFills, hasSessionProtocol, heldSessionChannels, heldThreads, heldVoiceSessions, holdSessionChannels, holdVoiceSession, imagesFromContent, inactiveTotal, initialSessionState, installGlobalWebPlugins, installSessionWebPlugins, installWebPlugins, installWorkspaceWebPlugins, installedWebPlugins, invokeServerMethod, isDesktopClient, isSupportedImageMimeType, loadImageRef, loadModelChoices, localHostId, markSocketClosed, markUpdateRequired, menuStore, mergeScopedPlugins, minorModes, nativeTemplateCatalog, noSessions, noteRender, noteStoreUpdate, notifyHubConnected, onCaptureStatus, onComposerSubmitted, onHubConnected, openTransientTab, ownerLabel, ownersOf, paletteCommands, parseHostKey, parseSelection, pendingMenuFor, pendingSetupView, personaInitials, pluginActivityGroups, pluginContextActions, pluginDockFaces, pluginFileLinks, pluginHomeContributions, pluginLeaderBindings, pluginMinorModes, pluginRepositorySettingsPanels, pluginSelectionAxes, pluginSessionContext, pluginSettingsPanels, pluginSettingsSections, pluginSlotProps, pluginToolRenderer, pluginUserMessageActions, pluginsAtScope, prependHistory, projectedGroups, promoteQueuedCommand, promoteQueuedMessage, promptCommand, qrMatrix, qualifyHostId, qualifyHostKey, queueFollowUp, queueFollowUpWithAck, railSessionStatus, reduceSession, refreshSessionFacts, refreshSessionSelection, refreshSessionStats, releaseDialogMenu, releaseProtocolTranscript, releaseTransport, removeHostWebPlugins, removeQueuedCommand, removeQueuedEntry, removeSessionWebPlugins, removeWorkspaceWebPlugins, renameSession, replaceQueuedEntries, requestLatestHistory, requestNewerHistory, requestOlderHistory, requestSessionProtocolFrame, resetMenuStore, resetSessionStore, resetSessionStores, resetSessions, resetThreads, resetWebPlugins, resetWorkspaces, resolveNativeTemplate, resolveParentId, resubscribeThreads, resumeQueueCommand, resumeQueuedMessages, reuseRailWorkspaces, rewindCommand, rewindToMessage, runCommand, runningCount, sameRailEntries, sameRailEntry, seedHistoryCursor, selectFastMode, selectModel, selectThinkingLevel, selectWorkspace, selectionAxes, selectionStatuses, sendFrame, sendFrameWithAck, sendHubFrame, sendSessionProtocolFrame, sessionMinorModes, sessionStatusClock, sessionStatusLine, sessionStoreFor, sessionToolRenderer, sessionWebPluginsInstalled, sessionsStore, setActiveSession, setAgentLock, setHasNewerHistory, setModelCommand, setPendingMenu, setSessionNameCommand, setSessionStreamed, setThinkingLevelCommand, setTransientTabSession, setUiTraceSink, setWebPluginLoadDiagnostics, slotFills, splitHostId, startPluginDefinitions, startWebPlugins, steerCommand, streamedSessions, submitCapture, submitMessage, submitMessageWithAck, subscribeActivitySources, subscribeThread, subscribeWebPluginRegistry, summariseArgs, summaryValueEqual, textFromContent, threadStoreKey, toolMessageProps, toolPromptClaim, totalTokens, traceProfilerRender, traceStore, transientTabsStore, transportForHost, triggerTokenAt, unsubscribeThread, updateDialogDraft, useActiveSession, useActiveSessionMeta, useActivityGroups, useDialogDraft, useDockFaceBadges, useDockFaces, useFileLinks, useHasOlderHistory, useImageRefs, useNoSessions, useRailEntries, useRailEntry, useRenderTrace, useTransientTabs, validateComposerCapture, waitForSession, watchHubThread, webPluginDiagnostics, webPluginRegistryForHost, webPluginRegistryRevision, webPluginsInstalled, webTabs, webTemplateCatalog, workspaceName, workspaceSlotFills, workspacesStore };
package/dist/index.d.mts CHANGED
@@ -1,3 +1,4 @@
1
+ import { qrMatrix } from "./web/lib/qrMatrix.mjs";
1
2
  import { AgentInfo, AssistantEntry, CommandInfo, DialogMethod, DialogRequest, EditorTextRequest, EntryKind, InputSender, IntercomEntry, ModelChoice, NoticeEntry, ProfileIdentity, QueuedEntry, ReduceSessionOptions, SessionState, SessionStats, SettledEntry, TimelineEntry, ToolEntry, UserEntry, UserImage, appendQueued, appendUserPrompt, applySelectionAnswer, clearDialog, clearQueuedEntries, imagesFromContent, initialSessionState, isSupportedImageMimeType, prependHistory, reduceSession, removeQueuedEntry, replaceQueuedEntries, selectionStatuses, summariseArgs, textFromContent } from "./web/lib/sessionModel.mjs";
2
3
  import { BUILTIN_COMMANDS, RpcImage, abortCommand, builtinCommandFrame, clearQueueCommand, compactCommand, dialogCancelled, dialogConfirmed, dialogValue, enqueueAutomaticCommand, followUpCommand, getAvailableModelsCommand, getAvailableThinkingLevelsCommand, getCommandsCommand, getSessionStatsCommand, getStateCommand, promoteQueuedCommand, promptCommand, removeQueuedCommand, resumeQueueCommand, rewindCommand, setModelCommand, setSessionNameCommand, setThinkingLevelCommand, steerCommand } from "./web/lib/commands.mjs";
3
4
  import { CompletionItem, CompletionKind, CompletionTrigger, MAX_COMPLETION_ITEMS, TRIGGER_CHARS, commandCompletions, fileCompletions, triggerTokenAt } from "./web/lib/composerCompletion.mjs";
@@ -47,7 +48,6 @@ import { createProtocolLink, protocolSocketUrl } from "./web/lib/piTransport.mjs
47
48
  import { WebPluginCompositionPhase, WebPluginCompositionState, WebPluginMountState, WebTemplateDecision, bindWebPluginCompositions, focusWorkspaceWebPlugins, refreshWebPluginCompositions, reloadWebTemplateDecision, retryWebPluginCompositions, webPluginCompositionStore, webPluginMountState } from "./web/lib/pluginCompositions.mjs";
48
49
  import { focusPrompt, registerPromptInput } from "./web/lib/promptFocus.mjs";
49
50
  import { toQueuedEntries, toTimelineEntries } from "./web/lib/protocolTimeline.mjs";
50
- import { qrMatrix } from "./web/lib/qrMatrix.mjs";
51
51
  import { PairingResult, StateResult, approvePairing, denyPairing, disableRemoteAccess, enableRemoteAccess, fetchRemoteState, mintPairingCode, revokeDevice, revokeTrustedDevice, saveRemoteSettings } from "./web/lib/remoteApi.mjs";
52
52
  import { onSealedSignInRequired, rememberHostChannelKey, rememberedHostChannelKey, resetSealedSessions, restoreSealedSession, sealedHttpSession, sealedProtocolSession, sealedSession } from "./web/lib/sealedSession.mjs";
53
53
  import { bindSessionActivityRenderer, releaseSessionActivityRenderer, renderSessionActivity } from "./web/lib/sessionActivityRenderer.mjs";
@@ -11,7 +11,6 @@ const SECTION_ICON = {
11
11
  notifications: _agimon_ai_po_web_components.BellIcon,
12
12
  images: _agimon_ai_po_web_components.ImageIcon,
13
13
  remote: _agimon_ai_po_web_components.GlobeIcon,
14
- hosts: _agimon_ai_po_web_components.ServerIcon,
15
14
  plugins: _agimon_ai_po_web_components.PuzzleIcon,
16
15
  repositories: _agimon_ai_po_web_components.FolderIcon
17
16
  };
@@ -1 +1 @@
1
- {"version":3,"file":"SettingsMenu.cjs","names":["SparklesIcon","PaletteIcon","BellIcon","ImageIcon","GlobeIcon","ServerIcon","PuzzleIcon","FolderIcon","SlidersIcon","NavTab","Link","SectionLabel","useState","settingsSections","GearIcon","Button","ChevronUpIcon","Dialog","DialogContent","DialogHeader","DialogTitle","DialogBody"],"sources":["../../../../src/web/features/settings/SettingsMenu.tsx"],"sourcesContent":["import {\n BellIcon,\n Button,\n ChevronUpIcon,\n Dialog,\n DialogBody,\n DialogContent,\n DialogHeader,\n DialogTitle,\n FolderIcon,\n GearIcon,\n GlobeIcon,\n ImageIcon,\n NavTab,\n PaletteIcon,\n PuzzleIcon,\n SectionLabel,\n ServerIcon,\n SlidersIcon,\n SparklesIcon,\n} from '@agimon-ai/po-web-components';\nimport { Link } from '@tanstack/react-router';\nimport { useState, type ComponentType } from 'react';\n\nimport { settingsSections, type SettingsSection, type SettingsWorkspace } from '../../lib/settingsSections';\n\n/** Host pages get their own mark; a plugin page brings its own or shares the sliders. */\nconst SECTION_ICON: Readonly<Record<string, ComponentType<{ className?: string }>>> = {\n providers: SparklesIcon,\n appearance: PaletteIcon,\n notifications: BellIcon,\n images: ImageIcon,\n remote: GlobeIcon,\n hosts: ServerIcon,\n plugins: PuzzleIcon,\n repositories: FolderIcon,\n};\n\nfunction SectionLinks({\n active,\n sections,\n onNavigate,\n repositoryId,\n}: {\n active: string | undefined;\n sections: readonly SettingsSection[];\n onNavigate?: () => void;\n repositoryId?: string;\n}) {\n return sections.map((section) => {\n const current = section.id === active;\n const Icon = section.icon ?? SECTION_ICON[section.id] ?? SlidersIcon;\n return (\n <NavTab\n key={section.id}\n asChild\n active={current}\n className=\"min-h-9 min-w-0 gap-2.5 rounded-md px-3 py-2 text-po-text focus-visible:ring-2 focus-visible:ring-po-green data-[active=true]:text-po-green\"\n >\n <Link\n to=\"/settings/$section\"\n params={{ section: section.id }}\n search={{ workspace: repositoryId }}\n data-testid={`settings-section-${section.id}`}\n aria-current={current ? 'page' : undefined}\n onClick={onNavigate}\n >\n <Icon className=\"size-4 shrink-0\" />\n <span className=\"block min-w-0 truncate first-letter:uppercase\">{section.label}</span>\n </Link>\n </NavTab>\n );\n });\n}\n\n/** Host pages first, then what plugins added, so a reader knows who owns a setting. */\nfunction SectionGroups(props: {\n active: string | undefined;\n workspace: SettingsWorkspace;\n sections: readonly SettingsSection[];\n onNavigate?: () => void;\n repositoryId?: string;\n}) {\n const { workspace, sections, ...links } = props;\n const fromPlugin = (section: SettingsSection) =>\n section.contribution !== undefined || section.panel !== undefined || section.repositoryPanel !== undefined;\n const groups = [\n { label: workspace, sections: sections.filter((section) => !fromPlugin(section)) },\n { label: 'from plugins', sections: sections.filter(fromPlugin) },\n ].filter((group) => group.sections.length > 0);\n return groups.map((group, index) => (\n <div key={group.label} className={`flex flex-col gap-0.5 ${index > 0 ? 'pt-5' : ''}`}>\n <SectionLabel className=\"px-3 pb-2\">{group.label}</SectionLabel>\n <SectionLinks {...links} sections={group.sections} />\n </div>\n ));\n}\n\nexport function SettingsMenu({\n active,\n workspace,\n repositoryId,\n}: {\n active: string | undefined;\n workspace: SettingsWorkspace;\n repositoryId?: string;\n}) {\n const [open, setOpen] = useState(false);\n const sections = settingsSections(workspace);\n const current = sections.find((section) => section.id === active) ?? sections[0];\n const CurrentIcon = current ? (current.icon ?? SECTION_ICON[current.id] ?? SlidersIcon) : GearIcon;\n\n return (\n <>\n <div className=\"shrink-0 border-b border-po-border bg-po-panel/40 p-2 lg:hidden\">\n <Button\n variant=\"outline\"\n size=\"sm\"\n data-testid=\"settings-menu-open\"\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n onClick={() => setOpen(true)}\n className=\"h-auto w-full justify-between gap-3 px-3 py-2 text-left whitespace-normal\"\n >\n <span className=\"flex min-w-0 items-center gap-2.5\">\n <CurrentIcon className=\"h-3.5 w-3.5 shrink-0 text-po-green\" />\n <span className=\"flex min-w-0 flex-col gap-0.5\">\n <span className=\"truncate text-base font-medium text-po-hi first-letter:uppercase\">\n {current?.label ?? workspace}\n </span>\n <span className=\"truncate text-sm font-normal text-po-dim\">{current?.detail}</span>\n </span>\n </span>\n <ChevronUpIcon className=\"h-3.5 w-3.5 shrink-0 text-po-faint\" />\n </Button>\n </div>\n\n <nav\n data-testid=\"settings-menu\"\n aria-label={`${workspace} settings sections`}\n className=\"hidden w-56 shrink-0 flex-col overflow-y-auto border-r border-po-border-soft px-3 py-6 lg:flex\"\n >\n <SectionGroups active={active} workspace={workspace} sections={sections} repositoryId={repositoryId} />\n </nav>\n\n <Dialog open={open} onOpenChange={setOpen}>\n <DialogContent\n width=\"lg\"\n data-testid=\"settings-menu-sheet\"\n aria-describedby={undefined}\n className=\"top-auto bottom-0 left-0 max-h-[min(72dvh,560px)] !w-full !max-w-none translate-x-0 translate-y-0 rounded-t-xl rounded-b-none border-x-0 border-b-0 data-[state=open]:animate-none lg:hidden\"\n >\n <span aria-hidden className=\"mx-auto mt-2 h-1 w-10 shrink-0 rounded-full bg-po-border\" />\n <DialogHeader dismissible closeLabel=\"close settings menu\" className=\"py-2.5\">\n <DialogTitle className=\"first-letter:uppercase\">{workspace} settings</DialogTitle>\n </DialogHeader>\n <DialogBody className=\"gap-1 p-2 pb-[max(0.75rem,env(safe-area-inset-bottom))]\">\n <nav aria-label={`${workspace} settings sections`} className=\"flex flex-col\">\n <SectionGroups\n active={active}\n workspace={workspace}\n sections={sections}\n repositoryId={repositoryId}\n onNavigate={() => setOpen(false)}\n />\n </nav>\n </DialogBody>\n </DialogContent>\n </Dialog>\n </>\n );\n}\n"],"mappings":";;;;;;;AA2BA,MAAM,eAAgF;CACpF,WAAWA,6BAAAA;CACX,YAAYC,6BAAAA;CACZ,eAAeC,6BAAAA;CACf,QAAQC,6BAAAA;CACR,QAAQC,6BAAAA;CACR,OAAOC,6BAAAA;CACP,SAASC,6BAAAA;CACT,cAAcC,6BAAAA;AAChB;AAEA,SAAS,aAAa,EACpB,QACA,UACA,YACA,gBAMC;CACD,OAAO,SAAS,KAAK,YAAY;EAC/B,MAAM,UAAU,QAAQ,OAAO;EAC/B,MAAM,OAAO,QAAQ,QAAQ,aAAa,QAAQ,OAAOC,6BAAAA;EACzD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,6BAAAA,QAAD;GAEE,SAAA;GACA,QAAQ;GACR,WAAU;GAEV,UAAA,iBAAA,GAAA,kBAAA,KAAA,CAACC,uBAAAA,MAAD;IACE,IAAG;IACH,QAAQ,EAAE,SAAS,QAAQ,GAAG;IAC9B,QAAQ,EAAE,WAAW,aAAa;IAClC,eAAa,oBAAoB,QAAQ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,WAAU;IAJZ,UAAA;KAME,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;MAAM,eAAA;MAAY,WAAU;KAA4D,CAAA;KACxF,iBAAA,GAAA,kBAAA,IAAA,CAACC,6BAAAA,cAAD;MAAc,aAAA;MAAY,YAAW;MAAsB,WAAU;MACnE,UAAA,iBAAA,GAAA,kBAAA,KAAA,CAACC,6BAAAA,aAAD;OAAa,WAAU;OAAvB,UAAA,CAAiD,WAAU,WAAsB;;KACrE,CAAA;KACd,iBAAA,GAAA,kBAAA,IAAA,CAACC,6BAAAA,YAAD;MAAY,WAAU;MACpB,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;OAAK,cAAY,GAAG,UAAU;OAAqB,WAAU;OAC3D,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,eAAD;QACU;QACG;QACD;QACI;QACd,kBAAkB,QAAQ,KAAK;OAChC,CAAA;MACE,CAAA;KACK,CAAA;IACC;;EACT,CAAA;CACR,EAAA,CAAA;AAEN"}
1
+ {"version":3,"file":"SettingsMenu.cjs","names":["SparklesIcon","PaletteIcon","BellIcon","ImageIcon","GlobeIcon","PuzzleIcon","FolderIcon","SlidersIcon","NavTab","Link","SectionLabel","useState","settingsSections","GearIcon","Button","ChevronUpIcon","Dialog","DialogContent","DialogHeader","DialogTitle","DialogBody"],"sources":["../../../../src/web/features/settings/SettingsMenu.tsx"],"sourcesContent":["import {\n BellIcon,\n Button,\n ChevronUpIcon,\n Dialog,\n DialogBody,\n DialogContent,\n DialogHeader,\n DialogTitle,\n FolderIcon,\n GearIcon,\n GlobeIcon,\n ImageIcon,\n NavTab,\n PaletteIcon,\n PuzzleIcon,\n SectionLabel,\n SlidersIcon,\n SparklesIcon,\n} from '@agimon-ai/po-web-components';\nimport { Link } from '@tanstack/react-router';\nimport { useState, type ComponentType } from 'react';\n\nimport { settingsSections, type SettingsSection, type SettingsWorkspace } from '../../lib/settingsSections';\n\n/** Host pages get their own mark; a plugin page brings its own or shares the sliders. */\nconst SECTION_ICON: Readonly<Record<string, ComponentType<{ className?: string }>>> = {\n providers: SparklesIcon,\n appearance: PaletteIcon,\n notifications: BellIcon,\n images: ImageIcon,\n remote: GlobeIcon,\n plugins: PuzzleIcon,\n repositories: FolderIcon,\n};\n\nfunction SectionLinks({\n active,\n sections,\n onNavigate,\n repositoryId,\n}: {\n active: string | undefined;\n sections: readonly SettingsSection[];\n onNavigate?: () => void;\n repositoryId?: string;\n}) {\n return sections.map((section) => {\n const current = section.id === active;\n const Icon = section.icon ?? SECTION_ICON[section.id] ?? SlidersIcon;\n return (\n <NavTab\n key={section.id}\n asChild\n active={current}\n className=\"min-h-9 min-w-0 gap-2.5 rounded-md px-3 py-2 text-po-text focus-visible:ring-2 focus-visible:ring-po-green data-[active=true]:text-po-green\"\n >\n <Link\n to=\"/settings/$section\"\n params={{ section: section.id }}\n search={{ workspace: repositoryId }}\n data-testid={`settings-section-${section.id}`}\n aria-current={current ? 'page' : undefined}\n onClick={onNavigate}\n >\n <Icon className=\"size-4 shrink-0\" />\n <span className=\"block min-w-0 truncate first-letter:uppercase\">{section.label}</span>\n </Link>\n </NavTab>\n );\n });\n}\n\n/** Host pages first, then what plugins added, so a reader knows who owns a setting. */\nfunction SectionGroups(props: {\n active: string | undefined;\n workspace: SettingsWorkspace;\n sections: readonly SettingsSection[];\n onNavigate?: () => void;\n repositoryId?: string;\n}) {\n const { workspace, sections, ...links } = props;\n const fromPlugin = (section: SettingsSection) =>\n section.contribution !== undefined || section.panel !== undefined || section.repositoryPanel !== undefined;\n const groups = [\n { label: workspace, sections: sections.filter((section) => !fromPlugin(section)) },\n { label: 'from plugins', sections: sections.filter(fromPlugin) },\n ].filter((group) => group.sections.length > 0);\n return groups.map((group, index) => (\n <div key={group.label} className={`flex flex-col gap-0.5 ${index > 0 ? 'pt-5' : ''}`}>\n <SectionLabel className=\"px-3 pb-2\">{group.label}</SectionLabel>\n <SectionLinks {...links} sections={group.sections} />\n </div>\n ));\n}\n\nexport function SettingsMenu({\n active,\n workspace,\n repositoryId,\n}: {\n active: string | undefined;\n workspace: SettingsWorkspace;\n repositoryId?: string;\n}) {\n const [open, setOpen] = useState(false);\n const sections = settingsSections(workspace);\n const current = sections.find((section) => section.id === active) ?? sections[0];\n const CurrentIcon = current ? (current.icon ?? SECTION_ICON[current.id] ?? SlidersIcon) : GearIcon;\n\n return (\n <>\n <div className=\"shrink-0 border-b border-po-border bg-po-panel/40 p-2 lg:hidden\">\n <Button\n variant=\"outline\"\n size=\"sm\"\n data-testid=\"settings-menu-open\"\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n onClick={() => setOpen(true)}\n className=\"h-auto w-full justify-between gap-3 px-3 py-2 text-left whitespace-normal\"\n >\n <span className=\"flex min-w-0 items-center gap-2.5\">\n <CurrentIcon className=\"h-3.5 w-3.5 shrink-0 text-po-green\" />\n <span className=\"flex min-w-0 flex-col gap-0.5\">\n <span className=\"truncate text-base font-medium text-po-hi first-letter:uppercase\">\n {current?.label ?? workspace}\n </span>\n <span className=\"truncate text-sm font-normal text-po-dim\">{current?.detail}</span>\n </span>\n </span>\n <ChevronUpIcon className=\"h-3.5 w-3.5 shrink-0 text-po-faint\" />\n </Button>\n </div>\n\n <nav\n data-testid=\"settings-menu\"\n aria-label={`${workspace} settings sections`}\n className=\"hidden w-56 shrink-0 flex-col overflow-y-auto border-r border-po-border-soft px-3 py-6 lg:flex\"\n >\n <SectionGroups active={active} workspace={workspace} sections={sections} repositoryId={repositoryId} />\n </nav>\n\n <Dialog open={open} onOpenChange={setOpen}>\n <DialogContent\n width=\"lg\"\n data-testid=\"settings-menu-sheet\"\n aria-describedby={undefined}\n className=\"top-auto bottom-0 left-0 max-h-[min(72dvh,560px)] !w-full !max-w-none translate-x-0 translate-y-0 rounded-t-xl rounded-b-none border-x-0 border-b-0 data-[state=open]:animate-none lg:hidden\"\n >\n <span aria-hidden className=\"mx-auto mt-2 h-1 w-10 shrink-0 rounded-full bg-po-border\" />\n <DialogHeader dismissible closeLabel=\"close settings menu\" className=\"py-2.5\">\n <DialogTitle className=\"first-letter:uppercase\">{workspace} settings</DialogTitle>\n </DialogHeader>\n <DialogBody className=\"gap-1 p-2 pb-[max(0.75rem,env(safe-area-inset-bottom))]\">\n <nav aria-label={`${workspace} settings sections`} className=\"flex flex-col\">\n <SectionGroups\n active={active}\n workspace={workspace}\n sections={sections}\n repositoryId={repositoryId}\n onNavigate={() => setOpen(false)}\n />\n </nav>\n </DialogBody>\n </DialogContent>\n </Dialog>\n </>\n );\n}\n"],"mappings":";;;;;;;AA0BA,MAAM,eAAgF;CACpF,WAAWA,6BAAAA;CACX,YAAYC,6BAAAA;CACZ,eAAeC,6BAAAA;CACf,QAAQC,6BAAAA;CACR,QAAQC,6BAAAA;CACR,SAASC,6BAAAA;CACT,cAAcC,6BAAAA;AAChB;AAEA,SAAS,aAAa,EACpB,QACA,UACA,YACA,gBAMC;CACD,OAAO,SAAS,KAAK,YAAY;EAC/B,MAAM,UAAU,QAAQ,OAAO;EAC/B,MAAM,OAAO,QAAQ,QAAQ,aAAa,QAAQ,OAAOC,6BAAAA;EACzD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACC,6BAAAA,QAAD;GAEE,SAAA;GACA,QAAQ;GACR,WAAU;GAEV,UAAA,iBAAA,GAAA,kBAAA,KAAA,CAACC,uBAAAA,MAAD;IACE,IAAG;IACH,QAAQ,EAAE,SAAS,QAAQ,GAAG;IAC9B,QAAQ,EAAE,WAAW,aAAa;IAClC,eAAa,oBAAoB,QAAQ;IACzC,gBAAc,UAAU,SAAS,KAAA;IACjC,SAAS;IANX,UAAA,CAQE,iBAAA,GAAA,kBAAA,IAAA,CAAC,MAAD,EAAM,WAAU,kBAAmB,CAAA,GACnC,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;KAAM,WAAU;KAAiD,UAAA,QAAQ;IAAY,CAAA,CACjF;;EACA,GAhBD,QAAQ,EAgBP;CAEZ,CAAC;AACH;;AAGA,SAAS,cAAc,O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,WAAsB;;KACrE,CAAA;KACd,iBAAA,GAAA,kBAAA,IAAA,CAACC,6BAAAA,YAAD;MAAY,WAAU;MACpB,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,OAAD;OAAK,cAAY,GAAG,UAAU;OAAqB,WAAU;OAC3D,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,eAAD;QACU;QACG;QACD;QACI;QACd,kBAAkB,QAAQ,KAAK;OAChC,CAAA;MACE,CAAA;KACK,CAAA;IACC;;EACT,CAAA;CACR,EAAA,CAAA;AAEN"}
@@ -1 +1 @@
1
- {"version":3,"file":"SettingsMenu.d.mts","names":[],"sources":["../../../../src/web/features/settings/SettingsMenu.tsx"],"mappings":";;wBAkGgB,eACd,QACA,WACA;EAEA;EACA,WAAW;EACX;oBACD,IAAA"}
1
+ {"version":3,"file":"SettingsMenu.d.mts","names":[],"sources":["../../../../src/web/features/settings/SettingsMenu.tsx"],"mappings":";;wBAgGgB,eACd,QACA,WACA;EAEA;EACA,WAAW;EACX;oBACD,IAAA"}
@@ -2,7 +2,7 @@ import { settingsSections } from "../../lib/settingsSections.mjs";
2
2
  import { useState } from "react";
3
3
  import { Link } from "@tanstack/react-router";
4
4
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
5
- import { BellIcon, Button, ChevronUpIcon, Dialog, DialogBody, DialogContent, DialogHeader, DialogTitle, FolderIcon, GearIcon, GlobeIcon, ImageIcon, NavTab, PaletteIcon, PuzzleIcon, SectionLabel, ServerIcon, SlidersIcon, SparklesIcon } from "@agimon-ai/po-web-components";
5
+ import { BellIcon, Button, ChevronUpIcon, Dialog, DialogBody, DialogContent, DialogHeader, DialogTitle, FolderIcon, GearIcon, GlobeIcon, ImageIcon, NavTab, PaletteIcon, PuzzleIcon, SectionLabel, SlidersIcon, SparklesIcon } from "@agimon-ai/po-web-components";
6
6
  //#region src/web/features/settings/SettingsMenu.tsx
7
7
  /** Host pages get their own mark; a plugin page brings its own or shares the sliders. */
8
8
  const SECTION_ICON = {
@@ -11,7 +11,6 @@ const SECTION_ICON = {
11
11
  notifications: BellIcon,
12
12
  images: ImageIcon,
13
13
  remote: GlobeIcon,
14
- hosts: ServerIcon,
15
14
  plugins: PuzzleIcon,
16
15
  repositories: FolderIcon
17
16
  };
@@ -1 +1 @@
1
- {"version":3,"file":"SettingsMenu.mjs","names":[],"sources":["../../../../src/web/features/settings/SettingsMenu.tsx"],"sourcesContent":["import {\n BellIcon,\n Button,\n ChevronUpIcon,\n Dialog,\n DialogBody,\n DialogContent,\n DialogHeader,\n DialogTitle,\n FolderIcon,\n GearIcon,\n GlobeIcon,\n ImageIcon,\n NavTab,\n PaletteIcon,\n PuzzleIcon,\n SectionLabel,\n ServerIcon,\n SlidersIcon,\n SparklesIcon,\n} from '@agimon-ai/po-web-components';\nimport { Link } from '@tanstack/react-router';\nimport { useState, type ComponentType } from 'react';\n\nimport { settingsSections, type SettingsSection, type SettingsWorkspace } from '../../lib/settingsSections';\n\n/** Host pages get their own mark; a plugin page brings its own or shares the sliders. */\nconst SECTION_ICON: Readonly<Record<string, ComponentType<{ className?: string }>>> = {\n providers: SparklesIcon,\n appearance: PaletteIcon,\n notifications: BellIcon,\n images: ImageIcon,\n remote: GlobeIcon,\n hosts: ServerIcon,\n plugins: PuzzleIcon,\n repositories: FolderIcon,\n};\n\nfunction SectionLinks({\n active,\n sections,\n onNavigate,\n repositoryId,\n}: {\n active: string | undefined;\n sections: readonly SettingsSection[];\n onNavigate?: () => void;\n repositoryId?: string;\n}) {\n return sections.map((section) => {\n const current = section.id === active;\n const Icon = section.icon ?? SECTION_ICON[section.id] ?? SlidersIcon;\n return (\n <NavTab\n key={section.id}\n asChild\n active={current}\n className=\"min-h-9 min-w-0 gap-2.5 rounded-md px-3 py-2 text-po-text focus-visible:ring-2 focus-visible:ring-po-green data-[active=true]:text-po-green\"\n >\n <Link\n to=\"/settings/$section\"\n params={{ section: section.id }}\n search={{ workspace: repositoryId }}\n data-testid={`settings-section-${section.id}`}\n aria-current={current ? 'page' : undefined}\n onClick={onNavigate}\n >\n <Icon className=\"size-4 shrink-0\" />\n <span className=\"block min-w-0 truncate first-letter:uppercase\">{section.label}</span>\n </Link>\n </NavTab>\n );\n });\n}\n\n/** Host pages first, then what plugins added, so a reader knows who owns a setting. */\nfunction SectionGroups(props: {\n active: string | undefined;\n workspace: SettingsWorkspace;\n sections: readonly SettingsSection[];\n onNavigate?: () => void;\n repositoryId?: string;\n}) {\n const { workspace, sections, ...links } = props;\n const fromPlugin = (section: SettingsSection) =>\n section.contribution !== undefined || section.panel !== undefined || section.repositoryPanel !== undefined;\n const groups = [\n { label: workspace, sections: sections.filter((section) => !fromPlugin(section)) },\n { label: 'from plugins', sections: sections.filter(fromPlugin) },\n ].filter((group) => group.sections.length > 0);\n return groups.map((group, index) => (\n <div key={group.label} className={`flex flex-col gap-0.5 ${index > 0 ? 'pt-5' : ''}`}>\n <SectionLabel className=\"px-3 pb-2\">{group.label}</SectionLabel>\n <SectionLinks {...links} sections={group.sections} />\n </div>\n ));\n}\n\nexport function SettingsMenu({\n active,\n workspace,\n repositoryId,\n}: {\n active: string | undefined;\n workspace: SettingsWorkspace;\n repositoryId?: string;\n}) {\n const [open, setOpen] = useState(false);\n const sections = settingsSections(workspace);\n const current = sections.find((section) => section.id === active) ?? sections[0];\n const CurrentIcon = current ? (current.icon ?? SECTION_ICON[current.id] ?? SlidersIcon) : GearIcon;\n\n return (\n <>\n <div className=\"shrink-0 border-b border-po-border bg-po-panel/40 p-2 lg:hidden\">\n <Button\n variant=\"outline\"\n size=\"sm\"\n data-testid=\"settings-menu-open\"\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n onClick={() => setOpen(true)}\n className=\"h-auto w-full justify-between gap-3 px-3 py-2 text-left whitespace-normal\"\n >\n <span className=\"flex min-w-0 items-center gap-2.5\">\n <CurrentIcon className=\"h-3.5 w-3.5 shrink-0 text-po-green\" />\n <span className=\"flex min-w-0 flex-col gap-0.5\">\n <span className=\"truncate text-base font-medium text-po-hi first-letter:uppercase\">\n {current?.label ?? workspace}\n </span>\n <span className=\"truncate text-sm font-normal text-po-dim\">{current?.detail}</span>\n </span>\n </span>\n <ChevronUpIcon className=\"h-3.5 w-3.5 shrink-0 text-po-faint\" />\n </Button>\n </div>\n\n <nav\n data-testid=\"settings-menu\"\n aria-label={`${workspace} settings sections`}\n className=\"hidden w-56 shrink-0 flex-col overflow-y-auto border-r border-po-border-soft px-3 py-6 lg:flex\"\n >\n <SectionGroups active={active} workspace={workspace} sections={sections} repositoryId={repositoryId} />\n </nav>\n\n <Dialog open={open} onOpenChange={setOpen}>\n <DialogContent\n width=\"lg\"\n data-testid=\"settings-menu-sheet\"\n aria-describedby={undefined}\n className=\"top-auto bottom-0 left-0 max-h-[min(72dvh,560px)] !w-full !max-w-none translate-x-0 translate-y-0 rounded-t-xl rounded-b-none border-x-0 border-b-0 data-[state=open]:animate-none lg:hidden\"\n >\n <span aria-hidden className=\"mx-auto mt-2 h-1 w-10 shrink-0 rounded-full bg-po-border\" />\n <DialogHeader dismissible closeLabel=\"close settings menu\" className=\"py-2.5\">\n <DialogTitle className=\"first-letter:uppercase\">{workspace} settings</DialogTitle>\n </DialogHeader>\n <DialogBody className=\"gap-1 p-2 pb-[max(0.75rem,env(safe-area-inset-bottom))]\">\n <nav aria-label={`${workspace} settings sections`} className=\"flex flex-col\">\n <SectionGroups\n active={active}\n workspace={workspace}\n sections={sections}\n repositoryId={repositoryId}\n onNavigate={() => setOpen(false)}\n />\n </nav>\n </DialogBody>\n </DialogContent>\n </Dialog>\n </>\n );\n}\n"],"mappings":";;;;;;;AA2BA,MAAM,eAAgF;CACpF,WAAW;CACX,YAAY;CACZ,eAAe;CACf,QAAQ;CACR,QAAQ;CACR,OAAO;CACP,SAAS;CACT,cAAc;AAChB;AAEA,SAAS,aAAa,EACpB,QACA,UACA,YACA,gBAMC;CACD,OAAO,SAAS,KAAK,YAAY;EAC/B,MAAM,UAAU,QAAQ,OAAO;EAC/B,MA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A,oBAAC,eAAD;QACU;QACG;QACD;QACI;QACd,kBAAkB,QAAQ,KAAK;OAChC,CAAA;MACE,CAAA;KACK,CAAA;IACC;;EACT,CAAA;CACR,EAAA,CAAA;AAEN"}
1
+ {"version":3,"file":"SettingsMenu.mjs","names":[],"sources":["../../../../src/web/features/settings/SettingsMenu.tsx"],"sourcesContent":["import {\n BellIcon,\n Button,\n ChevronUpIcon,\n Dialog,\n DialogBody,\n DialogContent,\n DialogHeader,\n DialogTitle,\n FolderIcon,\n GearIcon,\n GlobeIcon,\n ImageIcon,\n NavTab,\n PaletteIcon,\n PuzzleIcon,\n SectionLabel,\n SlidersIcon,\n SparklesIcon,\n} from '@agimon-ai/po-web-components';\nimport { Link } from '@tanstack/react-router';\nimport { useState, type ComponentType } from 'react';\n\nimport { settingsSections, type SettingsSection, type SettingsWorkspace } from '../../lib/settingsSections';\n\n/** Host pages get their own mark; a plugin page brings its own or shares the sliders. */\nconst SECTION_ICON: Readonly<Record<string, ComponentType<{ className?: string }>>> = {\n providers: SparklesIcon,\n appearance: PaletteIcon,\n notifications: BellIcon,\n images: ImageIcon,\n remote: GlobeIcon,\n plugins: PuzzleIcon,\n repositories: FolderIcon,\n};\n\nfunction SectionLinks({\n active,\n sections,\n onNavigate,\n repositoryId,\n}: {\n active: string | undefined;\n sections: readonly SettingsSection[];\n onNavigate?: () => void;\n repositoryId?: string;\n}) {\n return sections.map((section) => {\n const current = section.id === active;\n const Icon = section.icon ?? SECTION_ICON[section.id] ?? SlidersIcon;\n return (\n <NavTab\n key={section.id}\n asChild\n active={current}\n className=\"min-h-9 min-w-0 gap-2.5 rounded-md px-3 py-2 text-po-text focus-visible:ring-2 focus-visible:ring-po-green data-[active=true]:text-po-green\"\n >\n <Link\n to=\"/settings/$section\"\n params={{ section: section.id }}\n search={{ workspace: repositoryId }}\n data-testid={`settings-section-${section.id}`}\n aria-current={current ? 'page' : undefined}\n onClick={onNavigate}\n >\n <Icon className=\"size-4 shrink-0\" />\n <span className=\"block min-w-0 truncate first-letter:uppercase\">{section.label}</span>\n </Link>\n </NavTab>\n );\n });\n}\n\n/** Host pages first, then what plugins added, so a reader knows who owns a setting. */\nfunction SectionGroups(props: {\n active: string | undefined;\n workspace: SettingsWorkspace;\n sections: readonly SettingsSection[];\n onNavigate?: () => void;\n repositoryId?: string;\n}) {\n const { workspace, sections, ...links } = props;\n const fromPlugin = (section: SettingsSection) =>\n section.contribution !== undefined || section.panel !== undefined || section.repositoryPanel !== undefined;\n const groups = [\n { label: workspace, sections: sections.filter((section) => !fromPlugin(section)) },\n { label: 'from plugins', sections: sections.filter(fromPlugin) },\n ].filter((group) => group.sections.length > 0);\n return groups.map((group, index) => (\n <div key={group.label} className={`flex flex-col gap-0.5 ${index > 0 ? 'pt-5' : ''}`}>\n <SectionLabel className=\"px-3 pb-2\">{group.label}</SectionLabel>\n <SectionLinks {...links} sections={group.sections} />\n </div>\n ));\n}\n\nexport function SettingsMenu({\n active,\n workspace,\n repositoryId,\n}: {\n active: string | undefined;\n workspace: SettingsWorkspace;\n repositoryId?: string;\n}) {\n const [open, setOpen] = useState(false);\n const sections = settingsSections(workspace);\n const current = sections.find((section) => section.id === active) ?? sections[0];\n const CurrentIcon = current ? (current.icon ?? SECTION_ICON[current.id] ?? SlidersIcon) : GearIcon;\n\n return (\n <>\n <div className=\"shrink-0 border-b border-po-border bg-po-panel/40 p-2 lg:hidden\">\n <Button\n variant=\"outline\"\n size=\"sm\"\n data-testid=\"settings-menu-open\"\n aria-haspopup=\"dialog\"\n aria-expanded={open}\n onClick={() => setOpen(true)}\n className=\"h-auto w-full justify-between gap-3 px-3 py-2 text-left whitespace-normal\"\n >\n <span className=\"flex min-w-0 items-center gap-2.5\">\n <CurrentIcon className=\"h-3.5 w-3.5 shrink-0 text-po-green\" />\n <span className=\"flex min-w-0 flex-col gap-0.5\">\n <span className=\"truncate text-base font-medium text-po-hi first-letter:uppercase\">\n {current?.label ?? workspace}\n </span>\n <span className=\"truncate text-sm font-normal text-po-dim\">{current?.detail}</span>\n </span>\n </span>\n <ChevronUpIcon className=\"h-3.5 w-3.5 shrink-0 text-po-faint\" />\n </Button>\n </div>\n\n <nav\n data-testid=\"settings-menu\"\n aria-label={`${workspace} settings sections`}\n className=\"hidden w-56 shrink-0 flex-col overflow-y-auto border-r border-po-border-soft px-3 py-6 lg:flex\"\n >\n <SectionGroups active={active} workspace={workspace} sections={sections} repositoryId={repositoryId} />\n </nav>\n\n <Dialog open={open} onOpenChange={setOpen}>\n <DialogContent\n width=\"lg\"\n data-testid=\"settings-menu-sheet\"\n aria-describedby={undefined}\n className=\"top-auto bottom-0 left-0 max-h-[min(72dvh,560px)] !w-full !max-w-none translate-x-0 translate-y-0 rounded-t-xl rounded-b-none border-x-0 border-b-0 data-[state=open]:animate-none lg:hidden\"\n >\n <span aria-hidden className=\"mx-auto mt-2 h-1 w-10 shrink-0 rounded-full bg-po-border\" />\n <DialogHeader dismissible closeLabel=\"close settings menu\" className=\"py-2.5\">\n <DialogTitle className=\"first-letter:uppercase\">{workspace} settings</DialogTitle>\n </DialogHeader>\n <DialogBody className=\"gap-1 p-2 pb-[max(0.75rem,env(safe-area-inset-bottom))]\">\n <nav aria-label={`${workspace} settings sections`} className=\"flex flex-col\">\n <SectionGroups\n active={active}\n workspace={workspace}\n sections={sections}\n repositoryId={repositoryId}\n onNavigate={() => setOpen(false)}\n />\n </nav>\n </DialogBody>\n </DialogContent>\n </Dialog>\n </>\n );\n}\n"],"mappings":";;;;;;;AA0BA,MAAM,eAAgF;CACpF,WAAW;CACX,YAAY;CACZ,eAAe;CACf,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,cAAc;AAChB;AAEA,SAAS,aAAa,EACpB,QACA,UACA,YACA,gBAMC;CACD,OAAO,SAAS,KAAK,YAAY;EAC/B,MAAM,UAAU,QAAQ,OAAO;EAC/B,MAAM,OAAO,QAAQ,QAAQ,aAAa,QAAQ,OAAO;EACzD,OACE,oBAAC,QAAD;GAEE,SAAA;GACA,QAAQ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AAA;IACC;;EACT,CAAA;CACR,EAAA,CAAA;AAEN"}
@@ -31,12 +31,6 @@ const GENERAL_SETTINGS_SECTIONS = [
31
31
  detail: "save a named tunnel and expose live sessions to MCP clients",
32
32
  workspace: "general"
33
33
  },
34
- {
35
- id: "hosts",
36
- label: "hosts",
37
- detail: "add or forget the other hosts this cockpit shows",
38
- workspace: "general"
39
- },
40
34
  {
41
35
  id: "plugins",
42
36
  label: "plugins",
@@ -1 +1 @@
1
- {"version":3,"file":"settingsSections.cjs","names":["pluginSettingsSections","pluginSettingsPanels","pluginRepositorySettingsPanels"],"sources":["../../../src/web/lib/settingsSections.ts"],"sourcesContent":["import type { SettingsSectionContribution } from '@agimon-ai/po-core/web';\n\nimport {\n pluginRepositorySettingsPanels,\n pluginSettingsPanels,\n pluginSettingsSections,\n type InstalledRepositorySettingsPanel,\n type InstalledSettingsPanel,\n} from './pluginRegistry';\n\n/**\n * The settings menu, as data: the rail's gear and the settings page both\n * need to name a section, and neither feature may import the other.\n *\n * The host's own pages come first and keep fixed positions, because they\n * are about the cockpit itself rather than about a package. Contributed pages\n * sort after them, by their declared order and then their id, so the menu is\n * stable across syncs whatever order plugins install in.\n */\nexport type SettingsWorkspace = 'general' | 'repository';\n\nexport interface SettingsSection {\n id: string;\n label: string;\n detail: string;\n /** A contributed page's own menu mark; host pages take theirs from the menu. */\n icon?: SettingsSectionContribution['icon'];\n workspace: SettingsWorkspace;\n /** The fields a contributed page renders; absent on the host's own pages. */\n contribution?: SettingsSectionContribution;\n /** Package panel hosted inside the repository workspace. */\n repositoryPanel?: InstalledRepositorySettingsPanel;\n /** A page the contributing package draws itself, rather than fields the host renders. */\n panel?: InstalledSettingsPanel;\n}\n\nconst GENERAL_SETTINGS_SECTIONS: readonly SettingsSection[] = [\n {\n id: 'providers',\n label: 'providers',\n detail: 'sign in to the model providers Pi can use',\n workspace: 'general',\n },\n {\n id: 'appearance',\n label: 'appearance',\n detail: 'pick the theme the cockpit renders with',\n workspace: 'general',\n },\n {\n id: 'notifications',\n label: 'notifications',\n detail: 'allow live session notifications in this browser',\n workspace: 'general',\n },\n {\n id: 'images',\n label: 'images',\n detail: 'how large an image may be when it reaches a model',\n workspace: 'general',\n },\n {\n id: 'remote',\n label: 'remote control',\n detail: 'save a named tunnel and expose live sessions to MCP clients',\n workspace: 'general',\n },\n {\n id: 'hosts',\n label: 'hosts',\n detail: 'add or forget the other hosts this cockpit shows',\n workspace: 'general',\n },\n {\n id: 'plugins',\n label: 'plugins',\n detail: 'the web plugins this bundle carries and what their install resolved',\n workspace: 'general',\n },\n];\n\nconst REPOSITORY_DEFAULTS_SECTION: SettingsSection = {\n id: 'repositories',\n label: 'defaults',\n detail: 'mode, domains, and profile',\n workspace: 'repository',\n};\n\nconst DEFAULT_CONTRIBUTED_ORDER = 1000;\n\n/** Repository-workspace copies need their own route id, since the id is the route param. */\nconst REPOSITORY_SECTION_PREFIX = 'repository-';\n\nexport const DEFAULT_SETTINGS_SECTION = GENERAL_SETTINGS_SECTIONS[0]!.id;\nexport const DEFAULT_REPOSITORY_SETTINGS_SECTION = REPOSITORY_DEFAULTS_SECTION.id;\n\ninterface MenuOrdered {\n id: string;\n order?: number;\n}\n\nfunction byMenuOrder(left: MenuOrdered, right: MenuOrdered): number {\n return (\n (left.order ?? DEFAULT_CONTRIBUTED_ORDER) - (right.order ?? DEFAULT_CONTRIBUTED_ORDER) ||\n left.id.localeCompare(right.id)\n );\n}\n\n/**\n * Every page the menu offers. Read through a function rather than held in a\n * const: plugins install before the first render, but a module-level array\n * evaluated at import time would freeze the list before that happened.\n */\nexport function settingsSections(workspace?: SettingsWorkspace): readonly SettingsSection[] {\n const contributions = [...pluginSettingsSections()].sort(byMenuOrder);\n // The same page is offered in both workspaces. Scope comes from the workspace\n // the reader is in, so the general copy edits the global file and the\n // repository copy edits whichever repository the workspace picker holds.\n const contributed = contributions.map((contribution) => ({\n id: contribution.id,\n label: contribution.label,\n detail: contribution.detail,\n icon: contribution.icon,\n workspace: 'general' as const,\n contribution,\n }));\n const contributedForRepository = [...pluginSettingsSections('workspace')].sort(byMenuOrder).map((contribution) => ({\n id: `${REPOSITORY_SECTION_PREFIX}${contribution.id}`,\n label: contribution.label,\n detail: contribution.detail,\n icon: contribution.icon,\n workspace: 'repository' as const,\n contribution,\n }));\n // A self-drawn page has no scope to switch: it reports rather than writes,\n // so it appears once, in the general workspace, and not as a repository copy.\n const panels = [...pluginSettingsPanels()].sort(byMenuOrder).map((panel) => ({\n id: panel.id,\n label: panel.label,\n detail: panel.detail,\n icon: panel.icon,\n workspace: 'general' as const,\n panel,\n }));\n const repositoryPanels = pluginRepositorySettingsPanels().map((repositoryPanel) => ({\n id: `${REPOSITORY_SECTION_PREFIX}${repositoryPanel.pluginId}`,\n label: repositoryPanel.label,\n detail: repositoryPanel.detail,\n icon: repositoryPanel.icon,\n workspace: 'repository' as const,\n repositoryPanel,\n }));\n const all = [\n ...GENERAL_SETTINGS_SECTIONS,\n ...contributed,\n ...panels,\n REPOSITORY_DEFAULTS_SECTION,\n ...repositoryPanels,\n ...contributedForRepository,\n ];\n return workspace === undefined ? all : all.filter((section) => section.workspace === workspace);\n}\n\nexport function settingsSection(id: string | undefined): SettingsSection | undefined {\n return settingsSections().find((section) => section.id === id);\n}\n"],"mappings":";;AAoCA,MAAM,4BAAwD;CAC5D;EACE,IAAI;EACJ,OAAO;EACP,QAAQ;EACR,WAAW;CACb;CACA;EACE,IAAI;EACJ,OAAO;EACP,QAAQ;EACR,WAAW;CACb;CACA;EACE,IAAI;EACJ,OAAO;EACP,QAAQ;EACR,WAAW;CACb;CACA;EACE,IAAI;EACJ,OAAO;EACP,QAAQ;EACR,WAAW;CACb;CACA;EACE,IAAI;EACJ,OAAO;EACP,QAAQ;EACR,WAAW;CACb;CACA;EACE,IAAI;EACJ,OAAO;EACP,QAAQ;EACR,WAAW;CACb;CACA;EACE,IAAI;EACJ,OAAO;EACP,QAAQ;EACR,WAAW;CACb;AACF;AAEA,MAAM,8BAA+C;CACnD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O,cAAc,KAAA,IAAY,MAAM,IAAI,QAAQ,YAAY,QAAQ,cAAc,SAAS;AAChG;AAEA,SAAgB,gBAAgB,IAAqD;CACnF,OAAO,iBAAiB,CAAC,CAAC,MAAM,YAAY,QAAQ,OAAO,EAAE;AAC/D"}
1
+ {"version":3,"file":"settingsSections.cjs","names":["pluginSettingsSections","pluginSettingsPanels","pluginRepositorySettingsPanels"],"sources":["../../../src/web/lib/settingsSections.ts"],"sourcesContent":["import type { SettingsSectionContribution } from '@agimon-ai/po-core/web';\n\nimport {\n pluginRepositorySettingsPanels,\n pluginSettingsPanels,\n pluginSettingsSections,\n type InstalledRepositorySettingsPanel,\n type InstalledSettingsPanel,\n} from './pluginRegistry';\n\n/**\n * The settings menu, as data: the rail's gear and the settings page both\n * need to name a section, and neither feature may import the other.\n *\n * The host's own pages come first and keep fixed positions, because they\n * are about the cockpit itself rather than about a package. Contributed pages\n * sort after them, by their declared order and then their id, so the menu is\n * stable across syncs whatever order plugins install in.\n */\nexport type SettingsWorkspace = 'general' | 'repository';\n\nexport interface SettingsSection {\n id: string;\n label: string;\n detail: string;\n /** A contributed page's own menu mark; host pages take theirs from the menu. */\n icon?: SettingsSectionContribution['icon'];\n workspace: SettingsWorkspace;\n /** The fields a contributed page renders; absent on the host's own pages. */\n contribution?: SettingsSectionContribution;\n /** Package panel hosted inside the repository workspace. */\n repositoryPanel?: InstalledRepositorySettingsPanel;\n /** A page the contributing package draws itself, rather than fields the host renders. */\n panel?: InstalledSettingsPanel;\n}\n\n// No hosts page: on the web one domain is one hub. Adding hosts lives in the Po app.\nconst GENERAL_SETTINGS_SECTIONS: readonly SettingsSection[] = [\n {\n id: 'providers',\n label: 'providers',\n detail: 'sign in to the model providers Pi can use',\n workspace: 'general',\n },\n {\n id: 'appearance',\n label: 'appearance',\n detail: 'pick the theme the cockpit renders with',\n workspace: 'general',\n },\n {\n id: 'notifications',\n label: 'notifications',\n detail: 'allow live session notifications in this browser',\n workspace: 'general',\n },\n {\n id: 'images',\n label: 'images',\n detail: 'how large an image may be when it reaches a model',\n workspace: 'general',\n },\n {\n id: 'remote',\n label: 'remote control',\n detail: 'save a named tunnel and expose live sessions to MCP clients',\n workspace: 'general',\n },\n {\n id: 'plugins',\n label: 'plugins',\n detail: 'the web plugins this bundle carries and what their install resolved',\n workspace: 'general',\n },\n];\n\nconst REPOSITORY_DEFAULTS_SECTION: SettingsSection = {\n id: 'repositories',\n label: 'defaults',\n detail: 'mode, domains, and profile',\n workspace: 'repository',\n};\n\nconst DEFAULT_CONTRIBUTED_ORDER = 1000;\n\n/** Repository-workspace copies need their own route id, since the id is the route param. */\nconst REPOSITORY_SECTION_PREFIX = 'repository-';\n\nexport const DEFAULT_SETTINGS_SECTION = GENERAL_SETTINGS_SECTIONS[0]!.id;\nexport const DEFAULT_REPOSITORY_SETTINGS_SECTION = REPOSITORY_DEFAULTS_SECTION.id;\n\ninterface MenuOrdered {\n id: string;\n order?: number;\n}\n\nfunction byMenuOrder(left: MenuOrdered, right: MenuOrdered): number {\n return (\n (left.order ?? DEFAULT_CONTRIBUTED_ORDER) - (right.order ?? DEFAULT_CONTRIBUTED_ORDER) ||\n left.id.localeCompare(right.id)\n );\n}\n\n/**\n * Every page the menu offers. Read through a function rather than held in a\n * const: plugins install before the first render, but a module-level array\n * evaluated at import time would freeze the list before that happened.\n */\nexport function settingsSections(workspace?: SettingsWorkspace): readonly SettingsSection[] {\n const contributions = [...pluginSettingsSections()].sort(byMenuOrder);\n // The same page is offered in both workspaces. Scope comes from the workspace\n // the reader is in, so the general copy edits the global file and the\n // repository copy edits whichever repository the workspace picker holds.\n const contributed = contributions.map((contribution) => ({\n id: contribution.id,\n label: contribution.label,\n detail: contribution.detail,\n icon: contribution.icon,\n workspace: 'general' as const,\n contribution,\n }));\n const contributedForRepository = [...pluginSettingsSections('workspace')].sort(byMenuOrder).map((contribution) => ({\n id: `${REPOSITORY_SECTION_PREFIX}${contribution.id}`,\n label: contribution.label,\n detail: contribution.detail,\n icon: contribution.icon,\n workspace: 'repository' as const,\n contribution,\n }));\n // A self-drawn page has no scope to switch: it reports rather than writes,\n // so it appears once, in the general workspace, and not as a repository copy.\n const panels = [...pluginSettingsPanels()].sort(byMenuOrder).map((panel) => ({\n id: panel.id,\n label: panel.label,\n detail: panel.detail,\n icon: panel.icon,\n workspace: 'general' as const,\n panel,\n }));\n const repositoryPanels = pluginRepositorySettingsPanels().map((repositoryPanel) => ({\n id: `${REPOSITORY_SECTION_PREFIX}${repositoryPanel.pluginId}`,\n label: repositoryPanel.label,\n detail: repositoryPanel.detail,\n icon: repositoryPanel.icon,\n workspace: 'repository' as const,\n repositoryPanel,\n }));\n const all = [\n ...GENERAL_SETTINGS_SECTIONS,\n ...contributed,\n ...panels,\n REPOSITORY_DEFAULTS_SECTION,\n ...repositoryPanels,\n ...contributedForRepository,\n ];\n return workspace === undefined ? all : all.filter((section) => section.workspace === workspace);\n}\n\nexport function settingsSection(id: string | undefined): SettingsSection | undefined {\n return settingsSections().find((section) => section.id === id);\n}\n"],"mappings":";;AAqCA,MAAM,4BAAwD;CAC5D;EACE,IAAI;EACJ,OAAO;EACP,QAAQ;EACR,WAAW;CACb;CACA;EACE,IAAI;EACJ,OAAO;EACP,QAAQ;EACR,WAAW;CACb;CACA;EACE,IAAI;EACJ,OAAO;EACP,QAAQ;EACR,WAAW;CACb;CACA;EACE,IAAI;EACJ,OAAO;EACP,QAAQ;EACR,WAAW;CACb;CACA;EACE,IAAI;EACJ,OAAO;EACP,QAAQ;EACR,WAAW;CACb;CACA;EACE,IAAI;EACJ,OAAO;EACP,QAAQ;EACR,WAAW;CACb;AACF;AAEA,MAAM,8BAA+C;CACnD,IAAI;CACJ,OAAO;CACP,QAAQ;CACR,WAAW;AACb;AAEA,MAAM,4BAA4B;;AAGlC,MAAM,4BAA4B;AAElC,MAAa,2BAA2B,0BAA0B,EAAE,CAAE;AACtE,MAAa,sCAAsC,4BAA4B;AAO/E,SAAS,YAAY,MAAmB,OAA4B;CAClE,QACG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settingsSections.d.mts","names":[],"sources":["../../../src/web/lib/settingsSections.ts"],"mappings":";;;;;;;;;;;;YAmBY;iBAEK;EACf;EACA;EACA;;EAEA,OAAO;EACP,WAAW;;EAEX,eAAe;;EAEf,kBAAkB;;EAElB,QAAQ;;qBA4DG;qBACA;;;;;;wBAmBG,iBAAiB,YAAY,6BAA6B;wBAkD1D,gBAAgB,yBAAyB"}
1
+ {"version":3,"file":"settingsSections.d.mts","names":[],"sources":["../../../src/web/lib/settingsSections.ts"],"mappings":";;;;;;;;;;;;YAmBY;iBAEK;EACf;EACA;EACA;;EAEA,OAAO;EACP,WAAW;;EAEX,eAAe;;EAEf,kBAAkB;;EAElB,QAAQ;;qBAuDG;qBACA;;;;;;wBAmBG,iBAAiB,YAAY,6BAA6B;wBAkD1D,gBAAgB,yBAAyB"}
@@ -31,12 +31,6 @@ const GENERAL_SETTINGS_SECTIONS = [
31
31
  detail: "save a named tunnel and expose live sessions to MCP clients",
32
32
  workspace: "general"
33
33
  },
34
- {
35
- id: "hosts",
36
- label: "hosts",
37
- detail: "add or forget the other hosts this cockpit shows",
38
- workspace: "general"
39
- },
40
34
  {
41
35
  id: "plugins",
42
36
  label: "plugins",
@@ -1 +1 @@
1
- {"version":3,"file":"settingsSections.mjs","names":[],"sources":["../../../src/web/lib/settingsSections.ts"],"sourcesContent":["import type { SettingsSectionContribution } from '@agimon-ai/po-core/web';\n\nimport {\n pluginRepositorySettingsPanels,\n pluginSettingsPanels,\n pluginSettingsSections,\n type InstalledRepositorySettingsPanel,\n type InstalledSettingsPanel,\n} from './pluginRegistry';\n\n/**\n * The settings menu, as data: the rail's gear and the settings page both\n * need to name a section, and neither feature may import the other.\n *\n * The host's own pages come first and keep fixed positions, because they\n * are about the cockpit itself rather than about a package. Contributed pages\n * sort after them, by their declared order and then their id, so the menu is\n * stable across syncs whatever order plugins install in.\n */\nexport type SettingsWorkspace = 'general' | 'repository';\n\nexport interface SettingsSection {\n id: string;\n label: string;\n detail: string;\n /** A contributed page's own menu mark; host pages take theirs from the menu. */\n icon?: SettingsSectionContribution['icon'];\n workspace: SettingsWorkspace;\n /** The fields a contributed page renders; absent on the host's own pages. */\n contribution?: SettingsSectionContribution;\n /** Package panel hosted inside the repository workspace. */\n repositoryPanel?: InstalledRepositorySettingsPanel;\n /** A page the contributing package draws itself, rather than fields the host renders. */\n panel?: InstalledSettingsPanel;\n}\n\nconst GENERAL_SETTINGS_SECTIONS: readonly SettingsSection[] = [\n {\n id: 'providers',\n label: 'providers',\n detail: 'sign in to the model providers Pi can use',\n workspace: 'general',\n },\n {\n id: 'appearance',\n label: 'appearance',\n detail: 'pick the theme the cockpit renders with',\n workspace: 'general',\n },\n {\n id: 'notifications',\n label: 'notifications',\n detail: 'allow live session notifications in this browser',\n workspace: 'general',\n },\n {\n id: 'images',\n label: 'images',\n detail: 'how large an image may be when it reaches a model',\n workspace: 'general',\n },\n {\n id: 'remote',\n label: 'remote control',\n detail: 'save a named tunnel and expose live sessions to MCP clients',\n workspace: 'general',\n },\n {\n id: 'hosts',\n label: 'hosts',\n detail: 'add or forget the other hosts this cockpit shows',\n workspace: 'general',\n },\n {\n id: 'plugins',\n label: 'plugins',\n detail: 'the web plugins this bundle carries and what their install resolved',\n workspace: 'general',\n },\n];\n\nconst REPOSITORY_DEFAULTS_SECTION: SettingsSection = {\n id: 'repositories',\n label: 'defaults',\n detail: 'mode, domains, and profile',\n workspace: 'repository',\n};\n\nconst DEFAULT_CONTRIBUTED_ORDER = 1000;\n\n/** Repository-workspace copies need their own route id, since the id is the route param. */\nconst REPOSITORY_SECTION_PREFIX = 'repository-';\n\nexport const DEFAULT_SETTINGS_SECTION = GENERAL_SETTINGS_SECTIONS[0]!.id;\nexport const DEFAULT_REPOSITORY_SETTINGS_SECTION = REPOSITORY_DEFAULTS_SECTION.id;\n\ninterface MenuOrdered {\n id: string;\n order?: number;\n}\n\nfunction byMenuOrder(left: MenuOrdered, right: MenuOrdered): number {\n return (\n (left.order ?? DEFAULT_CONTRIBUTED_ORDER) - (right.order ?? DEFAULT_CONTRIBUTED_ORDER) ||\n left.id.localeCompare(right.id)\n );\n}\n\n/**\n * Every page the menu offers. Read through a function rather than held in a\n * const: plugins install before the first render, but a module-level array\n * evaluated at import time would freeze the list before that happened.\n */\nexport function settingsSections(workspace?: SettingsWorkspace): readonly SettingsSection[] {\n const contributions = [...pluginSettingsSections()].sort(byMenuOrder);\n // The same page is offered in both workspaces. Scope comes from the workspace\n // the reader is in, so the general copy edits the global file and the\n // repository copy edits whichever repository the workspace picker holds.\n const contributed = contributions.map((contribution) => ({\n id: contribution.id,\n label: contribution.label,\n detail: contribution.detail,\n icon: contribution.icon,\n workspace: 'general' as const,\n contribution,\n }));\n const contributedForRepository = [...pluginSettingsSections('workspace')].sort(byMenuOrder).map((contribution) => ({\n id: `${REPOSITORY_SECTION_PREFIX}${contribution.id}`,\n label: contribution.label,\n detail: contribution.detail,\n icon: contribution.icon,\n workspace: 'repository' as const,\n contribution,\n }));\n // A self-drawn page has no scope to switch: it reports rather than writes,\n // so it appears once, in the general workspace, and not as a repository copy.\n const panels = [...pluginSettingsPanels()].sort(byMenuOrder).map((panel) => ({\n id: panel.id,\n label: panel.label,\n detail: panel.detail,\n icon: panel.icon,\n workspace: 'general' as const,\n panel,\n }));\n const repositoryPanels = pluginRepositorySettingsPanels().map((repositoryPanel) => ({\n id: `${REPOSITORY_SECTION_PREFIX}${repositoryPanel.pluginId}`,\n label: repositoryPanel.label,\n detail: repositoryPanel.detail,\n icon: repositoryPanel.icon,\n workspace: 'repository' as const,\n repositoryPanel,\n }));\n const all = [\n ...GENERAL_SETTINGS_SECTIONS,\n ...contributed,\n ...panels,\n REPOSITORY_DEFAULTS_SECTION,\n ...repositoryPanels,\n ...contributedForRepository,\n ];\n return workspace === undefined ? all : all.filter((section) => section.workspace === workspace);\n}\n\nexport function settingsSection(id: string | undefined): SettingsSection | undefined {\n return settingsSections().find((section) => section.id === id);\n}\n"],"mappings":";;AAoCA,MAAM,4BAAwD;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C,KAAK,WAAW;EAC3E,IAAI,MAAM;EACV,OAAO,MAAM;EACb,QAAQ,MAAM;EACd,MAAM,MAAM;EACZ,WAAW;EACX;CACF,EAAE;CACF,MAAM,mBAAmB,+BAA+B,CAAC,CAAC,KAAK,qBAAqB;EAClF,IAAI,GAAG,4BAA4B,gBAAgB;EACnD,OAAO,gBAAgB;EACvB,QAAQ,gBAAgB;EACxB,MAAM,gBAAgB;EACtB,WAAW;EACX;CACF,EAAE;CACF,MAAM,MAAM;EACV,GAAG;EACH,GAAG;EACH,GAAG;EACH;EACA,GAAG;EACH,GAAG;CACL;CACA,OAAO,cAAc,KAAA,IAAY,MAAM,IAAI,QAAQ,YAAY,QAAQ,cAAc,SAAS;AAChG;AAEA,SAAgB,gBAAgB,IAAqD;CACnF,OAAO,iBAAiB,CAAC,CAAC,MAAM,YAAY,QAAQ,OAAO,EAAE;AAC/D"}
1
+ {"version":3,"file":"settingsSections.mjs","names":[],"sources":["../../../src/web/lib/settingsSections.ts"],"sourcesContent":["import type { SettingsSectionContribution } from '@agimon-ai/po-core/web';\n\nimport {\n pluginRepositorySettingsPanels,\n pluginSettingsPanels,\n pluginSettingsSections,\n type InstalledRepositorySettingsPanel,\n type InstalledSettingsPanel,\n} from './pluginRegistry';\n\n/**\n * The settings menu, as data: the rail's gear and the settings page both\n * need to name a section, and neither feature may import the other.\n *\n * The host's own pages come first and keep fixed positions, because they\n * are about the cockpit itself rather than about a package. Contributed pages\n * sort after them, by their declared order and then their id, so the menu is\n * stable across syncs whatever order plugins install in.\n */\nexport type SettingsWorkspace = 'general' | 'repository';\n\nexport interface SettingsSection {\n id: string;\n label: string;\n detail: string;\n /** A contributed page's own menu mark; host pages take theirs from the menu. */\n icon?: SettingsSectionContribution['icon'];\n workspace: SettingsWorkspace;\n /** The fields a contributed page renders; absent on the host's own pages. */\n contribution?: SettingsSectionContribution;\n /** Package panel hosted inside the repository workspace. */\n repositoryPanel?: InstalledRepositorySettingsPanel;\n /** A page the contributing package draws itself, rather than fields the host renders. */\n panel?: InstalledSettingsPanel;\n}\n\n// No hosts page: on the web one domain is one hub. Adding hosts lives in the Po app.\nconst GENERAL_SETTINGS_SECTIONS: readonly SettingsSection[] = [\n {\n id: 'providers',\n label: 'providers',\n detail: 'sign in to the model providers Pi can use',\n workspace: 'general',\n },\n {\n id: 'appearance',\n label: 'appearance',\n detail: 'pick the theme the cockpit renders with',\n workspace: 'general',\n },\n {\n id: 'notifications',\n label: 'notifications',\n detail: 'allow live session notifications in this browser',\n workspace: 'general',\n },\n {\n id: 'images',\n label: 'images',\n detail: 'how large an image may be when it reaches a model',\n workspace: 'general',\n },\n {\n id: 'remote',\n label: 'remote control',\n detail: 'save a named tunnel and expose live sessions to MCP clients',\n workspace: 'general',\n },\n {\n id: 'plugins',\n label: 'plugins',\n detail: 'the web plugins this bundle carries and what their install resolved',\n workspace: 'general',\n },\n];\n\nconst REPOSITORY_DEFAULTS_SECTION: SettingsSection = {\n id: 'repositories',\n label: 'defaults',\n detail: 'mode, domains, and profile',\n workspace: 'repository',\n};\n\nconst DEFAULT_CONTRIBUTED_ORDER = 1000;\n\n/** Repository-workspace copies need their own route id, since the id is the route param. */\nconst REPOSITORY_SECTION_PREFIX = 'repository-';\n\nexport const DEFAULT_SETTINGS_SECTION = GENERAL_SETTINGS_SECTIONS[0]!.id;\nexport const DEFAULT_REPOSITORY_SETTINGS_SECTION = REPOSITORY_DEFAULTS_SECTION.id;\n\ninterface MenuOrdered {\n id: string;\n order?: number;\n}\n\nfunction byMenuOrder(left: MenuOrdered, right: MenuOrdered): number {\n return (\n (left.order ?? DEFAULT_CONTRIBUTED_ORDER) - (right.order ?? DEFAULT_CONTRIBUTED_ORDER) ||\n left.id.localeCompare(right.id)\n );\n}\n\n/**\n * Every page the menu offers. Read through a function rather than held in a\n * const: plugins install before the first render, but a module-level array\n * evaluated at import time would freeze the list before that happened.\n */\nexport function settingsSections(workspace?: SettingsWorkspace): readonly SettingsSection[] {\n const contributions = [...pluginSettingsSections()].sort(byMenuOrder);\n // The same page is offered in both workspaces. Scope comes from the workspace\n // the reader is in, so the general copy edits the global file and the\n // repository copy edits whichever repository the workspace picker holds.\n const contributed = contributions.map((contribution) => ({\n id: contribution.id,\n label: contribution.label,\n detail: contribution.detail,\n icon: contribution.icon,\n workspace: 'general' as const,\n contribution,\n }));\n const contributedForRepository = [...pluginSettingsSections('workspace')].sort(byMenuOrder).map((contribution) => ({\n id: `${REPOSITORY_SECTION_PREFIX}${contribution.id}`,\n label: contribution.label,\n detail: contribution.detail,\n icon: contribution.icon,\n workspace: 'repository' as const,\n contribution,\n }));\n // A self-drawn page has no scope to switch: it reports rather than writes,\n // so it appears once, in the general workspace, and not as a repository copy.\n const panels = [...pluginSettingsPanels()].sort(byMenuOrder).map((panel) => ({\n id: panel.id,\n label: panel.label,\n detail: panel.detail,\n icon: panel.icon,\n workspace: 'general' as const,\n panel,\n }));\n const repositoryPanels = pluginRepositorySettingsPanels().map((repositoryPanel) => ({\n id: `${REPOSITORY_SECTION_PREFIX}${repositoryPanel.pluginId}`,\n label: repositoryPanel.label,\n detail: repositoryPanel.detail,\n icon: repositoryPanel.icon,\n workspace: 'repository' as const,\n repositoryPanel,\n }));\n const all = [\n ...GENERAL_SETTINGS_SECTIONS,\n ...contributed,\n ...panels,\n REPOSITORY_DEFAULTS_SECTION,\n ...repositoryPanels,\n ...contributedForRepository,\n ];\n return workspace === undefined ? all : all.filter((section) => section.workspace === workspace);\n}\n\nexport function settingsSection(id: string | undefined): SettingsSection | undefined {\n return settingsSections().find((section) => section.id === id);\n}\n"],"mappings":";;AAqCA,MAAM,4BAAwD;CAC5D;EACE,IAAI;EACJ,OAAO;EACP,QAAQ;EACR,WAAW;CACb;CACA;EACE,IAAI;EACJ,OAAO;EACP,QAAQ;EACR,WAAW;CACb;CACA;EACE,IAAI;EACJ,OAAO;EACP,QAAQ;EACR,WAAW;CACb;CACA;EACE,IAAI;EACJ,OAAO;EACP,QAAQ;EACR,WAAW;CACb;CACA;E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,EAAE;CACF,MAAM,MAAM;EACV,GAAG;EACH,GAAG;EACH,GAAG;EACH;EACA,GAAG;EACH,GAAG;CACL;CACA,OAAO,cAAc,KAAA,IAAY,MAAM,IAAI,QAAQ,YAAY,QAAQ,cAAc,SAAS;AAChG;AAEA,SAAgB,gBAAgB,IAAqD;CACnF,OAAO,iBAAiB,CAAC,CAAC,MAAM,YAAY,QAAQ,OAAO,EAAE;AAC/D"}
@@ -75,7 +75,9 @@ async function refreshPasskeys() {
75
75
  ...body.support.reason === void 0 ? {} : { reason: body.support.reason },
76
76
  count: body.credentials.length
77
77
  } });
78
- } catch {}
78
+ } catch (error) {
79
+ console.warn("Passkey support could not be read", error);
80
+ }
79
81
  }
80
82
  async function addPasskey() {
81
83
  begin();
@@ -127,6 +129,7 @@ async function newPairingCode() {
127
129
  return;
128
130
  }
129
131
  set({
132
+ step: "pairing",
130
133
  pairUrl: minted.pairUrl,
131
134
  pairCode: minted.manualCode,
132
135
  pairFingerprint: minted.fingerprint,
@@ -1 +1 @@
1
- {"version":3,"file":"remoteAccessStore.cjs","names":["Store","sealedHttpSession","passkeysAvailable","registerPasskey","fetchRemoteState","enableRemoteAccess","disableRemoteAccess","mintPairingCode","approvePairing","denyPairing","revokeDevice","revokeTrustedDevice","saveRemoteSettings"],"sources":["../../../src/web/stores/remoteAccessStore.ts"],"sourcesContent":["import { Store } from '@tanstack/store';\n\nimport type { RemoteAccessSettings, RemoteAccessStateView } from '../../types/remoteAccess';\nimport {\n approvePairing,\n denyPairing,\n disableRemoteAccess,\n enableRemoteAccess,\n fetchRemoteState,\n mintPairingCode,\n revokeDevice,\n revokeTrustedDevice,\n saveRemoteSettings,\n} from '../lib/remoteApi';\nimport { sealedHttpSession } from '../lib/sealedSession';\nimport { passkeysAvailable, registerPasskey } from '../lib/webauthnClient';\n\n/** Which panel of the dialog is showing. Options first, then the code to scan. */\nexport type RemoteStep = 'closed' | 'options' | 'pairing';\n\nexport interface PasskeySupportView {\n supported: boolean;\n reason?: string;\n count: number;\n}\n\nexport interface RemoteAccessState {\n step: RemoteStep;\n /** Undefined until the passkey surface has been asked about. */\n passkeys?: PasskeySupportView;\n /** Undefined until the first load answers. */\n view?: RemoteAccessStateView;\n /** The URL the QR encodes; present only while a code is live. */\n pairUrl?: string;\n /** Short code accepted by the same pairing claim for manual entry. */\n pairCode?: string;\n /** Signing-key fingerprint the user compares during manual pairing. */\n pairFingerprint?: string;\n pairRevision?: number;\n pairExpiresAt?: string;\n busy: boolean;\n error?: string;\n}\n\nexport const remoteAccessStore = new Store<RemoteAccessState>({ step: 'closed', busy: false });\nconst pendingSettings = new Set<Partial<RemoteAccessSettings>>();\n\nfunction set(patch: Partial<RemoteAccessState>): void {\n const view = patch.view;\n if (view !== undefined && pendingSettings.size > 0)\n patch = {\n ...patch,\n view: {\n ...view,\n settings: [...pendingSettings].reduce<RemoteAccessSettings>(\n (settings, draft) => ({ ...settings, ...draft }),\n view.settings,\n ),\n },\n };\n remoteAccessStore.setState((state) => ({ ...state, ...patch }));\n}\n\n/** Clears the previous error before an action, so a stale one never outlives its cause. */\nfunction begin(): void {\n set({ busy: true, error: undefined });\n}\n\nfunction settle(outcome: { state: RemoteAccessStateView } | { error: string }): boolean {\n if ('error' in outcome) {\n set({ busy: false, error: outcome.error });\n return false;\n }\n set({ busy: false, view: outcome.state });\n return true;\n}\n\nexport function openRemoteDialog(): void {\n set({ step: 'options', error: undefined });\n void refreshRemoteState();\n}\n\nexport function closeRemoteDialog(): void {\n // The code is left to expire on its own rather than cancelled here: closing\n // the dialog while a phone is mid-scan should not strand it.\n set({ step: 'closed', error: undefined });\n}\n\nexport function showRemoteOptions(): void {\n set({ step: 'options', error: undefined });\n}\n\n/** Whether this tunnel and this browser can carry a passkey at all. */\nexport async function refreshPasskeys(): Promise<void> {\n try {\n const response = await sealedHttpSession.fetch('/api/remote/passkeys', { credentials: 'same-origin' });\n if (!response.ok) return;\n const body = (await response.json()) as {\n support: { supported: boolean; reason?: string };\n credentials: unknown[];\n };\n set({\n passkeys: {\n supported: body.support.supported && passkeysAvailable(),\n ...(body.support.reason === undefined ? {} : { reason: body.support.reason }),\n count: body.credentials.length,\n },\n });\n } catch {\n // The hub is unreachable; the state refresh reports that already.\n }\n}\n\nexport async function addPasskey(): Promise<void> {\n begin();\n const outcome = await registerPasskey();\n set({ busy: false, ...(outcome.ok ? {} : { error: outcome.error }) });\n await refreshPasskeys();\n}\n\nexport async function refreshRemoteState(): Promise<void> {\n const outcome = await fetchRemoteState();\n if ('error' in outcome) {\n set({ error: outcome.error });\n return;\n }\n // An unchanged answer keeps the same view, so redundant refreshes do not re-render consumers.\n if (pendingSettings.size === 0 && JSON.stringify(remoteAccessStore.state.view) === JSON.stringify(outcome.state))\n return;\n set({ view: outcome.state });\n}\n\n/** Turns the tunnel on and moves straight to the code, which is what the user came for. */\nexport async function turnRemoteAccessOn(): Promise<void> {\n begin();\n const outcome = await enableRemoteAccess();\n if (!settle(outcome)) return;\n await Promise.all([newPairingCode(), refreshPasskeys()]);\n set({ step: 'pairing' });\n}\n\nexport async function turnRemoteAccessOff(): Promise<void> {\n begin();\n if (!settle(await disableRemoteAccess())) return;\n set({\n step: 'options',\n pairUrl: undefined,\n pairCode: undefined,\n pairFingerprint: undefined,\n pairRevision: undefined,\n pairExpiresAt: undefined,\n });\n}\n\nexport async function newPairingCode(): Promise<void> {\n const minted = await mintPairingCode();\n if ('error' in minted) {\n set({\n error: minted.error,\n pairUrl: undefined,\n pairCode: undefined,\n pairFingerprint: undefined,\n pairRevision: undefined,\n });\n return;\n }\n set({\n pairUrl: minted.pairUrl,\n pairCode: minted.manualCode,\n pairFingerprint: minted.fingerprint,\n pairRevision: minted.revision,\n pairExpiresAt: minted.expiresAt,\n });\n}\n\nexport async function approveDevice(requestId: string): Promise<void> {\n settle(await approvePairing(requestId));\n}\n\nexport async function denyDevice(requestId: string): Promise<void> {\n settle(await denyPairing(requestId));\n}\n\nexport async function revokePairedDevice(id: string): Promise<void> {\n begin();\n settle(await revokeDevice(id));\n}\n\nexport async function revokeTrustedNativeDevice(id: string): Promise<void> {\n begin();\n settle(await revokeTrustedDevice(id));\n}\n\nlet settingsWrites: Promise<unknown> = Promise.resolve();\n\nexport async function updateRemoteSettings(patch: Partial<RemoteAccessSettings>): Promise<boolean> {\n // Keep autosave edits responsive, but serialize writes across app replacements.\n const draft = { ...patch };\n pendingSettings.add(draft);\n const view = remoteAccessStore.state.view;\n if (view !== undefined) set({ view: { ...view, settings: { ...view.settings, ...draft } }, error: undefined });\n const write = () => saveRemoteSettings(draft);\n const pending = settingsWrites.then(write, write);\n settingsWrites = pending;\n const outcome = await pending;\n pendingSettings.delete(draft);\n if ('error' in outcome) {\n set({ error: outcome.error });\n if (settingsWrites === pending) void refreshRemoteState();\n return false;\n }\n const current = remoteAccessStore.state.view;\n if (current !== undefined && settingsWrites === pending)\n set({ view: { ...current, settings: outcome.settings }, error: undefined });\n return true;\n}\n"],"mappings":";;;;AA4CA,MAAa,oBAAoB,8BAAIA,EAAAA,CAAAA,MAAyB;CAAE,MAAM;CAAU,MAAM;AAAM,CAAC;AAC7F,MAAM,kCAAkB,IAAI,IAAmC;AAE/D,SAAS,IAAI,OAAyC;CACpD,MAAM,OAAO,MAAM;CACnB,IAAI,SAAS,KAAA,KAAa,gBAAgB,OAAO,GAC/C,QAAQ;EACN,GAAG;EACH,MAAM;GACJ,GAAG;GACH,UAAU,CAAC,GAAG,eAAe,CAAC,CAAC,QAC5B,UAAU,WAAW;IAAE,GAAG;IAAU,GAAG;GAAM,IAC9C,KAAK,QACP;EACF;CACF;CACF,kBAAkB,UAAU,WAAW;EAAE,GAAG;EAAO,GAAG;CAAM,EAAE;AAChE;;AAGA,SAAS,QAAc;CACrB,IAAI;EAAE,MAAM;EAAM,OAAO,KAAA;CAAU,CAAC;AACtC;AAEA,SAAS,OAAO,SAAwE;CACtF,IAAI,WAAW,SAAS;EACtB,IAAI;GAAE,MAAM;GAAO,OAAO,QAAQ;EAAM,CAAC;EACzC,OAAO;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;CACzB,MAAM,OAAO,kBAAkB,MAAM;CACrC,IAAI,SAAS,KAAA,GAAW,IAAI;EAAE,MAAM;GAAE,GAAG;GAAM,UAAU;IAAE,GAAG,KAAK;IAAU,GAAG;GAAM;EAAE;EAAG,OAAO,KAAA;CAAU,CAAC;CAC7G,MAAM,cAAcC,kBAAAA,mBAAmB,KAAK;CAC5C,MAAM,UAAU,eAAe,KAAK,OAAO,KAAK;CAChD,iBAAiB;CACjB,MAAM,UAAU,MAAM;CACtB,gBAAgB,OAAO,KAAK;CAC5B,IAAI,WAAW,SAAS;EACtB,IAAI,EAAE,OAAO,QAAQ,MAAM,CAAC;EAC5B,IAAI,mBAAmB,SAAS,mBAAwB;EACxD,OAAO;CACT;CACA,MAAM,UAAU,kBAAkB,MAAM;CACxC,IAAI,YAAY,KAAA,KAAa,mBAAmB,SAC9C,IAAI;EAAE,MAAM;GAAE,GAAG;GAAS,UAAU,QAAQ;EAAS;EAAG,OAAO,KAAA;CAAU,CAAC;CAC5E,OAAO;AACT"}
1
+ {"version":3,"file":"remoteAccessStore.cjs","names":["Store","sealedHttpSession","passkeysAvailable","registerPasskey","fetchRemoteState","enableRemoteAccess","disableRemoteAccess","mintPairingCode","approvePairing","denyPairing","revokeDevice","revokeTrustedDevice","saveRemoteSettings"],"sources":["../../../src/web/stores/remoteAccessStore.ts"],"sourcesContent":["import { Store } from '@tanstack/store';\n\nimport type { RemoteAccessSettings, RemoteAccessStateView } from '../../types/remoteAccess';\nimport {\n approvePairing,\n denyPairing,\n disableRemoteAccess,\n enableRemoteAccess,\n fetchRemoteState,\n mintPairingCode,\n revokeDevice,\n revokeTrustedDevice,\n saveRemoteSettings,\n} from '../lib/remoteApi';\nimport { sealedHttpSession } from '../lib/sealedSession';\nimport { passkeysAvailable, registerPasskey } from '../lib/webauthnClient';\n\n/** Which panel of the dialog is showing. Options first, then the code to scan. */\nexport type RemoteStep = 'closed' | 'options' | 'pairing';\n\nexport interface PasskeySupportView {\n supported: boolean;\n reason?: string;\n count: number;\n}\n\nexport interface RemoteAccessState {\n step: RemoteStep;\n /** Undefined until the passkey surface has been asked about. */\n passkeys?: PasskeySupportView;\n /** Undefined until the first load answers. */\n view?: RemoteAccessStateView;\n /** The URL the QR encodes; present only while a code is live. */\n pairUrl?: string;\n /** Short code accepted by the same pairing claim for manual entry. */\n pairCode?: string;\n /** Signing-key fingerprint the user compares during manual pairing. */\n pairFingerprint?: string;\n pairRevision?: number;\n pairExpiresAt?: string;\n busy: boolean;\n error?: string;\n}\n\nexport const remoteAccessStore = new Store<RemoteAccessState>({ step: 'closed', busy: false });\nconst pendingSettings = new Set<Partial<RemoteAccessSettings>>();\n\nfunction set(patch: Partial<RemoteAccessState>): void {\n const view = patch.view;\n if (view !== undefined && pendingSettings.size > 0)\n patch = {\n ...patch,\n view: {\n ...view,\n settings: [...pendingSettings].reduce<RemoteAccessSettings>(\n (settings, draft) => ({ ...settings, ...draft }),\n view.settings,\n ),\n },\n };\n remoteAccessStore.setState((state) => ({ ...state, ...patch }));\n}\n\n/** Clears the previous error before an action, so a stale one never outlives its cause. */\nfunction begin(): void {\n set({ busy: true, error: undefined });\n}\n\nfunction settle(outcome: { state: RemoteAccessStateView } | { error: string }): boolean {\n if ('error' in outcome) {\n set({ busy: false, error: outcome.error });\n return false;\n }\n set({ busy: false, view: outcome.state });\n return true;\n}\n\nexport function openRemoteDialog(): void {\n set({ step: 'options', error: undefined });\n void refreshRemoteState();\n}\n\nexport function closeRemoteDialog(): void {\n // The code is left to expire on its own rather than cancelled here: closing\n // the dialog while a phone is mid-scan should not strand it.\n set({ step: 'closed', error: undefined });\n}\n\nexport function showRemoteOptions(): void {\n set({ step: 'options', error: undefined });\n}\n\n/** Whether this tunnel and this browser can carry a passkey at all. */\nexport async function refreshPasskeys(): Promise<void> {\n try {\n const response = await sealedHttpSession.fetch('/api/remote/passkeys', { credentials: 'same-origin' });\n if (!response.ok) return;\n const body = (await response.json()) as {\n support: { supported: boolean; reason?: string };\n credentials: unknown[];\n };\n set({\n passkeys: {\n supported: body.support.supported && passkeysAvailable(),\n ...(body.support.reason === undefined ? {} : { reason: body.support.reason }),\n count: body.credentials.length,\n },\n });\n } catch (error) {\n // The hub is unreachable; the state refresh reports that to the person already.\n console.warn('Passkey support could not be read', error);\n }\n}\n\nexport async function addPasskey(): Promise<void> {\n begin();\n const outcome = await registerPasskey();\n set({ busy: false, ...(outcome.ok ? {} : { error: outcome.error }) });\n await refreshPasskeys();\n}\n\nexport async function refreshRemoteState(): Promise<void> {\n const outcome = await fetchRemoteState();\n if ('error' in outcome) {\n set({ error: outcome.error });\n return;\n }\n // An unchanged answer keeps the same view, so redundant refreshes do not re-render consumers.\n if (pendingSettings.size === 0 && JSON.stringify(remoteAccessStore.state.view) === JSON.stringify(outcome.state))\n return;\n set({ view: outcome.state });\n}\n\n/** Turns the tunnel on and moves straight to the code, which is what the user came for. */\nexport async function turnRemoteAccessOn(): Promise<void> {\n begin();\n const outcome = await enableRemoteAccess();\n if (!settle(outcome)) return;\n await Promise.all([newPairingCode(), refreshPasskeys()]);\n set({ step: 'pairing' });\n}\n\nexport async function turnRemoteAccessOff(): Promise<void> {\n begin();\n if (!settle(await disableRemoteAccess())) return;\n set({\n step: 'options',\n pairUrl: undefined,\n pairCode: undefined,\n pairFingerprint: undefined,\n pairRevision: undefined,\n pairExpiresAt: undefined,\n });\n}\n\nexport async function newPairingCode(): Promise<void> {\n const minted = await mintPairingCode();\n if ('error' in minted) {\n set({\n error: minted.error,\n pairUrl: undefined,\n pairCode: undefined,\n pairFingerprint: undefined,\n pairRevision: undefined,\n });\n return;\n }\n set({\n step: 'pairing',\n pairUrl: minted.pairUrl,\n pairCode: minted.manualCode,\n pairFingerprint: minted.fingerprint,\n pairRevision: minted.revision,\n pairExpiresAt: minted.expiresAt,\n });\n}\n\nexport async function approveDevice(requestId: string): Promise<void> {\n settle(await approvePairing(requestId));\n}\n\nexport async function denyDevice(requestId: string): Promise<void> {\n settle(await denyPairing(requestId));\n}\n\nexport async function revokePairedDevice(id: string): Promise<void> {\n begin();\n settle(await revokeDevice(id));\n}\n\nexport async function revokeTrustedNativeDevice(id: string): Promise<void> {\n begin();\n settle(await revokeTrustedDevice(id));\n}\n\nlet settingsWrites: Promise<unknown> = Promise.resolve();\n\nexport async function updateRemoteSettings(patch: Partial<RemoteAccessSettings>): Promise<boolean> {\n // Keep autosave edits responsive, but serialize writes across app replacements.\n const draft = { ...patch };\n pendingSettings.add(draft);\n const view = remoteAccessStore.state.view;\n if (view !== undefined) set({ view: { ...view, settings: { ...view.settings, ...draft } }, error: undefined });\n const write = () => saveRemoteSettings(draft);\n const pending = settingsWrites.then(write, write);\n settingsWrites = pending;\n const outcome = await pending;\n pendingSettings.delete(draft);\n if ('error' in outcome) {\n set({ error: outcome.error });\n if (settingsWrites === pending) void refreshRemoteState();\n return false;\n }\n const current = remoteAccessStore.state.view;\n if (current !== undefined && settingsWrites === pending)\n set({ view: { ...current, settings: outcome.settings }, error: undefined });\n return true;\n}\n"],"mappings":";;;;AA4CA,MAAa,oBAAoB,8BAAIA,EAAAA,CAAAA,MAAyB;CAAE,MAAM;CAAU,MAAM;AAAM,CAAC;AAC7F,MAAM,kCAAkB,IAAI,IAAmC;AAE/D,SAAS,IAAI,OAAyC;CACpD,MAAM,OAAO,MAAM;CACnB,IAAI,SAAS,KAAA,KAAa,gBAAgB,OAAO,GAC/C,QAAQ;EACN,GAAG;EACH,MAAM;GACJ,GAAG;GACH,UAAU,CAAC,GAAG,eAAe,CAAC,CAAC,QAC5B,UAAU,WAAW;IAAE,GAAG;IAAU,GAAG;GAAM,IAC9C,KAAK,QACP;EACF;CACF;CACF,kBAAkB,UAAU,WAAW;EAAE,GAAG;EAAO,GAAG;CAAM,EAAE;AAChE;;AAGA,SAAS,QAAc;CACrB,IAAI;EAAE,MAAM;EAAM,OAAO,KAAA;CAAU,CAAC;AACtC;AAEA,SAAS,OAAO,SAAwE;CACtF,IAAI,WAAW,SAAS;EACtB,IAAI;GAAE,MAAM;G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remoteAccessStore.d.mts","names":[],"sources":["../../../src/web/stores/remoteAccessStore.ts"],"mappings":";;;;YAkBY;iBAEK;EACf;EACA;EACA;;iBAGe;EACf,MAAM;;EAEN,WAAW;;EAEX,OAAO;;EAEP;;EAEA;;EAEA;EACA;EACA;EACA;EACA;;qBAGW,mBAAiB,MAAA;wBAiCd;wBAKA;wBAMA;;wBAKM,mBAAmB;wBAqBnB,cAAc;wBAOd,sBAAsB;;wBAatB,sBAAsB;wBAQtB,uBAAuB;wBAavB,kBAAkB;wBAsBlB,cAAc,oBAAoB;wBAIlC,WAAW,oBAAoB;wBAI/B,mBAAmB,aAAa;wBAKhC,0BAA0B,aAAa;wBAOvC,qBAAqB,OAAO,QAAQ,wBAAwB"}
@@ -76,7 +76,9 @@ async function refreshPasskeys() {
76
76
  ...body.support.reason === void 0 ? {} : { reason: body.support.reason },
77
77
  count: body.credentials.length
78
78
  } });
79
- } catch {}
79
+ } catch (error) {
80
+ console.warn("Passkey support could not be read", error);
81
+ }
80
82
  }
81
83
  async function addPasskey() {
82
84
  begin();
@@ -128,6 +130,7 @@ async function newPairingCode() {
128
130
  return;
129
131
  }
130
132
  set({
133
+ step: "pairing",
131
134
  pairUrl: minted.pairUrl,
132
135
  pairCode: minted.manualCode,
133
136
  pairFingerprint: minted.fingerprint,
@@ -1 +1 @@
1
- {"version":3,"file":"remoteAccessStore.mjs","names":[],"sources":["../../../src/web/stores/remoteAccessStore.ts"],"sourcesContent":["import { Store } from '@tanstack/store';\n\nimport type { RemoteAccessSettings, RemoteAccessStateView } from '../../types/remoteAccess';\nimport {\n approvePairing,\n denyPairing,\n disableRemoteAccess,\n enableRemoteAccess,\n fetchRemoteState,\n mintPairingCode,\n revokeDevice,\n revokeTrustedDevice,\n saveRemoteSettings,\n} from '../lib/remoteApi';\nimport { sealedHttpSession } from '../lib/sealedSession';\nimport { passkeysAvailable, registerPasskey } from '../lib/webauthnClient';\n\n/** Which panel of the dialog is showing. Options first, then the code to scan. */\nexport type RemoteStep = 'closed' | 'options' | 'pairing';\n\nexport interface PasskeySupportView {\n supported: boolean;\n reason?: string;\n count: number;\n}\n\nexport interface RemoteAccessState {\n step: RemoteStep;\n /** Undefined until the passkey surface has been asked about. */\n passkeys?: PasskeySupportView;\n /** Undefined until the first load answers. */\n view?: RemoteAccessStateView;\n /** The URL the QR encodes; present only while a code is live. */\n pairUrl?: string;\n /** Short code accepted by the same pairing claim for manual entry. */\n pairCode?: string;\n /** Signing-key fingerprint the user compares during manual pairing. */\n pairFingerprint?: string;\n pairRevision?: number;\n pairExpiresAt?: string;\n busy: boolean;\n error?: string;\n}\n\nexport const remoteAccessStore = new Store<RemoteAccessState>({ step: 'closed', busy: false });\nconst pendingSettings = new Set<Partial<RemoteAccessSettings>>();\n\nfunction set(patch: Partial<RemoteAccessState>): void {\n const view = patch.view;\n if (view !== undefined && pendingSettings.size > 0)\n patch = {\n ...patch,\n view: {\n ...view,\n settings: [...pendingSettings].reduce<RemoteAccessSettings>(\n (settings, draft) => ({ ...settings, ...draft }),\n view.settings,\n ),\n },\n };\n remoteAccessStore.setState((state) => ({ ...state, ...patch }));\n}\n\n/** Clears the previous error before an action, so a stale one never outlives its cause. */\nfunction begin(): void {\n set({ busy: true, error: undefined });\n}\n\nfunction settle(outcome: { state: RemoteAccessStateView } | { error: string }): boolean {\n if ('error' in outcome) {\n set({ busy: false, error: outcome.error });\n return false;\n }\n set({ busy: false, view: outcome.state });\n return true;\n}\n\nexport function openRemoteDialog(): void {\n set({ step: 'options', error: undefined });\n void refreshRemoteState();\n}\n\nexport function closeRemoteDialog(): void {\n // The code is left to expire on its own rather than cancelled here: closing\n // the dialog while a phone is mid-scan should not strand it.\n set({ step: 'closed', error: undefined });\n}\n\nexport function showRemoteOptions(): void {\n set({ step: 'options', error: undefined });\n}\n\n/** Whether this tunnel and this browser can carry a passkey at all. */\nexport async function refreshPasskeys(): Promise<void> {\n try {\n const response = await sealedHttpSession.fetch('/api/remote/passkeys', { credentials: 'same-origin' });\n if (!response.ok) return;\n const body = (await response.json()) as {\n support: { supported: boolean; reason?: string };\n credentials: unknown[];\n };\n set({\n passkeys: {\n supported: body.support.supported && passkeysAvailable(),\n ...(body.support.reason === undefined ? {} : { reason: body.support.reason }),\n count: body.credentials.length,\n },\n });\n } catch {\n // The hub is unreachable; the state refresh reports that already.\n }\n}\n\nexport async function addPasskey(): Promise<void> {\n begin();\n const outcome = await registerPasskey();\n set({ busy: false, ...(outcome.ok ? {} : { error: outcome.error }) });\n await refreshPasskeys();\n}\n\nexport async function refreshRemoteState(): Promise<void> {\n const outcome = await fetchRemoteState();\n if ('error' in outcome) {\n set({ error: outcome.error });\n return;\n }\n // An unchanged answer keeps the same view, so redundant refreshes do not re-render consumers.\n if (pendingSettings.size === 0 && JSON.stringify(remoteAccessStore.state.view) === JSON.stringify(outcome.state))\n return;\n set({ view: outcome.state });\n}\n\n/** Turns the tunnel on and moves straight to the code, which is what the user came for. */\nexport async function turnRemoteAccessOn(): Promise<void> {\n begin();\n const outcome = await enableRemoteAccess();\n if (!settle(outcome)) return;\n await Promise.all([newPairingCode(), refreshPasskeys()]);\n set({ step: 'pairing' });\n}\n\nexport async function turnRemoteAccessOff(): Promise<void> {\n begin();\n if (!settle(await disableRemoteAccess())) return;\n set({\n step: 'options',\n pairUrl: undefined,\n pairCode: undefined,\n pairFingerprint: undefined,\n pairRevision: undefined,\n pairExpiresAt: undefined,\n });\n}\n\nexport async function newPairingCode(): Promise<void> {\n const minted = await mintPairingCode();\n if ('error' in minted) {\n set({\n error: minted.error,\n pairUrl: undefined,\n pairCode: undefined,\n pairFingerprint: undefined,\n pairRevision: undefined,\n });\n return;\n }\n set({\n pairUrl: minted.pairUrl,\n pairCode: minted.manualCode,\n pairFingerprint: minted.fingerprint,\n pairRevision: minted.revision,\n pairExpiresAt: minted.expiresAt,\n });\n}\n\nexport async function approveDevice(requestId: string): Promise<void> {\n settle(await approvePairing(requestId));\n}\n\nexport async function denyDevice(requestId: string): Promise<void> {\n settle(await denyPairing(requestId));\n}\n\nexport async function revokePairedDevice(id: string): Promise<void> {\n begin();\n settle(await revokeDevice(id));\n}\n\nexport async function revokeTrustedNativeDevice(id: string): Promise<void> {\n begin();\n settle(await revokeTrustedDevice(id));\n}\n\nlet settingsWrites: Promise<unknown> = Promise.resolve();\n\nexport async function updateRemoteSettings(patch: Partial<RemoteAccessSettings>): Promise<boolean> {\n // Keep autosave edits responsive, but serialize writes across app replacements.\n const draft = { ...patch };\n pendingSettings.add(draft);\n const view = remoteAccessStore.state.view;\n if (view !== undefined) set({ view: { ...view, settings: { ...view.settings, ...draft } }, error: undefined });\n const write = () => saveRemoteSettings(draft);\n const pending = settingsWrites.then(write, write);\n settingsWrites = pending;\n const outcome = await pending;\n pendingSettings.delete(draft);\n if ('error' in outcome) {\n set({ error: outcome.error });\n if (settingsWrites === pending) void refreshRemoteState();\n return false;\n }\n const current = remoteAccessStore.state.view;\n if (current !== undefined && settingsWrites === pending)\n set({ view: { ...current, settings: outcome.settings }, error: undefined });\n return true;\n}\n"],"mappings":";;;;;AA4CA,MAAa,oBAAoB,IAAI,MAAyB;CAAE,MAAM;CAAU,MAAM;AAAM,CAAC;AAC7F,MAAM,kCAAkB,IAAI,IAAmC;AAE/D,SAAS,IAAI,OAAyC;CACpD,MAAM,OAAO,MAAM;CACnB,IAAI,SAAS,KAAA,KAAa,gBAAgB,OAAO,GAC/C,QAAQ;EACN,GAAG;EACH,MAAM;GACJ,GAAG;GACH,UAAU,CAAC,GAAG,eAAe,CAAC,CAAC,QAC5B,UAAU,WAAW;IAAE,GAAG;IAAU,GAAG;GAAM,IAC9C,KAAK,QACP;EACF;CACF;CACF,kBAAkB,UAAU,WAAW;EAAE,GAAG;EAAO,GAAG;CAAM,EAAE;AAChE;;AAGA,SAAS,QAAc;CACrB,IAAI;EAAE,MAAM;EAAM,OAAO,KAAA;CAAU,CAAC;AACtC;AAEA,SAAS,OAAO,SAAwE;CACtF,IAAI,WAAW,SAAS;EACtB,IAAI;GAAE,MA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AAW,IAAI;EAAE,MAAM;GAAE,GAAG;GAAM,UAAU;IAAE,GAAG,KAAK;IAAU,GAAG;GAAM;EAAE;EAAG,OAAO,KAAA;CAAU,CAAC;CAC7G,MAAM,cAAc,mBAAmB,KAAK;CAC5C,MAAM,UAAU,eAAe,KAAK,OAAO,KAAK;CAChD,iBAAiB;CACjB,MAAM,UAAU,MAAM;CACtB,gBAAgB,OAAO,KAAK;CAC5B,IAAI,WAAW,SAAS;EACtB,IAAI,EAAE,OAAO,QAAQ,MAAM,CAAC;EAC5B,IAAI,mBAAmB,SAAS,mBAAwB;EACxD,OAAO;CACT;CACA,MAAM,UAAU,kBAAkB,MAAM;CACxC,IAAI,YAAY,KAAA,KAAa,mBAAmB,SAC9C,IAAI;EAAE,MAAM;GAAE,GAAG;GAAS,UAAU,QAAQ;EAAS;EAAG,OAAO,KAAA;CAAU,CAAC;CAC5E,OAAO;AACT"}
1
+ {"version":3,"file":"remoteAccessStore.mjs","names":[],"sources":["../../../src/web/stores/remoteAccessStore.ts"],"sourcesContent":["import { Store } from '@tanstack/store';\n\nimport type { RemoteAccessSettings, RemoteAccessStateView } from '../../types/remoteAccess';\nimport {\n approvePairing,\n denyPairing,\n disableRemoteAccess,\n enableRemoteAccess,\n fetchRemoteState,\n mintPairingCode,\n revokeDevice,\n revokeTrustedDevice,\n saveRemoteSettings,\n} from '../lib/remoteApi';\nimport { sealedHttpSession } from '../lib/sealedSession';\nimport { passkeysAvailable, registerPasskey } from '../lib/webauthnClient';\n\n/** Which panel of the dialog is showing. Options first, then the code to scan. */\nexport type RemoteStep = 'closed' | 'options' | 'pairing';\n\nexport interface PasskeySupportView {\n supported: boolean;\n reason?: string;\n count: number;\n}\n\nexport interface RemoteAccessState {\n step: RemoteStep;\n /** Undefined until the passkey surface has been asked about. */\n passkeys?: PasskeySupportView;\n /** Undefined until the first load answers. */\n view?: RemoteAccessStateView;\n /** The URL the QR encodes; present only while a code is live. */\n pairUrl?: string;\n /** Short code accepted by the same pairing claim for manual entry. */\n pairCode?: string;\n /** Signing-key fingerprint the user compares during manual pairing. */\n pairFingerprint?: string;\n pairRevision?: number;\n pairExpiresAt?: string;\n busy: boolean;\n error?: string;\n}\n\nexport const remoteAccessStore = new Store<RemoteAccessState>({ step: 'closed', busy: false });\nconst pendingSettings = new Set<Partial<RemoteAccessSettings>>();\n\nfunction set(patch: Partial<RemoteAccessState>): void {\n const view = patch.view;\n if (view !== undefined && pendingSettings.size > 0)\n patch = {\n ...patch,\n view: {\n ...view,\n settings: [...pendingSettings].reduce<RemoteAccessSettings>(\n (settings, draft) => ({ ...settings, ...draft }),\n view.settings,\n ),\n },\n };\n remoteAccessStore.setState((state) => ({ ...state, ...patch }));\n}\n\n/** Clears the previous error before an action, so a stale one never outlives its cause. */\nfunction begin(): void {\n set({ busy: true, error: undefined });\n}\n\nfunction settle(outcome: { state: RemoteAccessStateView } | { error: string }): boolean {\n if ('error' in outcome) {\n set({ busy: false, error: outcome.error });\n return false;\n }\n set({ busy: false, view: outcome.state });\n return true;\n}\n\nexport function openRemoteDialog(): void {\n set({ step: 'options', error: undefined });\n void refreshRemoteState();\n}\n\nexport function closeRemoteDialog(): void {\n // The code is left to expire on its own rather than cancelled here: closing\n // the dialog while a phone is mid-scan should not strand it.\n set({ step: 'closed', error: undefined });\n}\n\nexport function showRemoteOptions(): void {\n set({ step: 'options', error: undefined });\n}\n\n/** Whether this tunnel and this browser can carry a passkey at all. */\nexport async function refreshPasskeys(): Promise<void> {\n try {\n const response = await sealedHttpSession.fetch('/api/remote/passkeys', { credentials: 'same-origin' });\n if (!response.ok) return;\n const body = (await response.json()) as {\n support: { supported: boolean; reason?: string };\n credentials: unknown[];\n };\n set({\n passkeys: {\n supported: body.support.supported && passkeysAvailable(),\n ...(body.support.reason === undefined ? {} : { reason: body.support.reason }),\n count: body.credentials.length,\n },\n });\n } catch (error) {\n // The hub is unreachable; the state refresh reports that to the person already.\n console.warn('Passkey support could not be read', error);\n }\n}\n\nexport async function addPasskey(): Promise<void> {\n begin();\n const outcome = await registerPasskey();\n set({ busy: false, ...(outcome.ok ? {} : { error: outcome.error }) });\n await refreshPasskeys();\n}\n\nexport async function refreshRemoteState(): Promise<void> {\n const outcome = await fetchRemoteState();\n if ('error' in outcome) {\n set({ error: outcome.error });\n return;\n }\n // An unchanged answer keeps the same view, so redundant refreshes do not re-render consumers.\n if (pendingSettings.size === 0 && JSON.stringify(remoteAccessStore.state.view) === JSON.stringify(outcome.state))\n return;\n set({ view: outcome.state });\n}\n\n/** Turns the tunnel on and moves straight to the code, which is what the user came for. */\nexport async function turnRemoteAccessOn(): Promise<void> {\n begin();\n const outcome = await enableRemoteAccess();\n if (!settle(outcome)) return;\n await Promise.all([newPairingCode(), refreshPasskeys()]);\n set({ step: 'pairing' });\n}\n\nexport async function turnRemoteAccessOff(): Promise<void> {\n begin();\n if (!settle(await disableRemoteAccess())) return;\n set({\n step: 'options',\n pairUrl: undefined,\n pairCode: undefined,\n pairFingerprint: undefined,\n pairRevision: undefined,\n pairExpiresAt: undefined,\n });\n}\n\nexport async function newPairingCode(): Promise<void> {\n const minted = await mintPairingCode();\n if ('error' in minted) {\n set({\n error: minted.error,\n pairUrl: undefined,\n pairCode: undefined,\n pairFingerprint: undefined,\n pairRevision: undefined,\n });\n return;\n }\n set({\n step: 'pairing',\n pairUrl: minted.pairUrl,\n pairCode: minted.manualCode,\n pairFingerprint: minted.fingerprint,\n pairRevision: minted.revision,\n pairExpiresAt: minted.expiresAt,\n });\n}\n\nexport async function approveDevice(requestId: string): Promise<void> {\n settle(await approvePairing(requestId));\n}\n\nexport async function denyDevice(requestId: string): Promise<void> {\n settle(await denyPairing(requestId));\n}\n\nexport async function revokePairedDevice(id: string): Promise<void> {\n begin();\n settle(await revokeDevice(id));\n}\n\nexport async function revokeTrustedNativeDevice(id: string): Promise<void> {\n begin();\n settle(await revokeTrustedDevice(id));\n}\n\nlet settingsWrites: Promise<unknown> = Promise.resolve();\n\nexport async function updateRemoteSettings(patch: Partial<RemoteAccessSettings>): Promise<boolean> {\n // Keep autosave edits responsive, but serialize writes across app replacements.\n const draft = { ...patch };\n pendingSettings.add(draft);\n const view = remoteAccessStore.state.view;\n if (view !== undefined) set({ view: { ...view, settings: { ...view.settings, ...draft } }, error: undefined });\n const write = () => saveRemoteSettings(draft);\n const pending = settingsWrites.then(write, write);\n settingsWrites = pending;\n const outcome = await pending;\n pendingSettings.delete(draft);\n if ('error' in outcome) {\n set({ error: outcome.error });\n if (settingsWrites === pending) void refreshRemoteState();\n return false;\n }\n const current = remoteAccessStore.state.view;\n if (current !== undefined && settingsWrites === pending)\n set({ view: { ...current, settings: outcome.settings }, error: undefined });\n return true;\n}\n"],"mappings":";;;;;AA4CA,MAAa,oBAAoB,IAAI,MAAyB;CAAE,MAAM;CAAU,MAAM;AAAM,CAAC;AAC7F,MAAM,kCAAkB,IAAI,IAAmC;AAE/D,SAAS,IAAI,OAAyC;CACpD,MAAM,OAAO,MAAM;CACnB,IAAI,SAAS,KAAA,KAAa,gBAAgB,OAAO,GAC/C,QAAQ;EACN,GAAG;EACH,MAAM;GACJ,GAAG;GACH,UAAU,CAAC,GAAG,eAAe,CAAC,CAAC,QAC5B,UAAU,WAAW;IAAE,GAAG;IAAU,GAAG;GAAM,IAC9C,KAAK,QACP;EACF;CACF;CACF,kBAAkB,UAAU,WAAW;EAAE,GAAG;EAAO,GAAG;CAAM,EAAE;AAChE;;AAGA,SAAS,QAAc;CACrB,IAAI;EAAE,MAAM;EAAM,OAAO,KAAA;CAAU,CAAC;AACtC;AAEA,SAAS,OAAO,SAAwE;CACtF,IAAI,WAAW,SAAS;EACtB,IAAI;GAAE,MAAM;GAAO,OAAO,QAAQ;EAAM,CAAC;EACzC,OAAO;CACT;CACA,IAAI;EAAE,MAAM;EAAO,MAAM,QAAQ;CAAM,CAAC;CACxC,OAAO;AACT;AAEA,SAAgB,mBAAyB;CACvC,IAAI;EAAE,MAAM;EAAW,OAAO,KAAA;CAAU,CAAC;CACzC,mBAAwB;AA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,UAAU,eAAe,KAAK,OAAO,KAAK;CAChD,iBAAiB;CACjB,MAAM,UAAU,MAAM;CACtB,gBAAgB,OAAO,KAAK;CAC5B,IAAI,WAAW,SAAS;EACtB,IAAI,EAAE,OAAO,QAAQ,MAAM,CAAC;EAC5B,IAAI,mBAAmB,SAAS,mBAAwB;EACxD,OAAO;CACT;CACA,MAAM,UAAU,kBAAkB,MAAM;CACxC,IAAI,YAAY,KAAA,KAAa,mBAAmB,SAC9C,IAAI;EAAE,MAAM;GAAE,GAAG;GAAS,UAAU,QAAQ;EAAS;EAAG,OAAO,KAAA;CAAU,CAAC;CAC5E,OAAO;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agimon-ai/po-web-dashboard",
3
- "version": "0.0.0-alpha.52",
3
+ "version": "0.0.0-alpha.53",
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.52",
65
- "@agimon-ai/po-web-components": "0.0.0-alpha.52",
66
- "@agimon-ai/po-web-security": "0.0.0-alpha.52",
64
+ "@agimon-ai/po-core": "0.0.0-alpha.53",
65
+ "@agimon-ai/po-web-components": "0.0.0-alpha.53",
66
+ "@agimon-ai/po-web-security": "0.0.0-alpha.53",
67
67
  "@earendil-works/chord": "1.4.0",
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.52",
76
+ "@agimon-ai/vibe-lint-plugin-po-web": "0.0.0-alpha.53",
77
77
  "@types/node": "26.6.5",
78
78
  "@types/react": "19.3.0",
79
79
  "@types/react-dom": "19.3.0",