@puredesktop/puredesktop-ui-bridge 1.0.0-beta.1
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/package.json +96 -0
- package/src/agents/runtime/agentLiveReducer.test.ts +72 -0
- package/src/agents/runtime/agentLiveReducer.ts +139 -0
- package/src/agents/runtime/agentRunEventTypes.ts +115 -0
- package/src/agents/runtime/contextWindowUsage.test.ts +38 -0
- package/src/agents/runtime/contextWindowUsage.ts +25 -0
- package/src/agents/runtime/index.ts +24 -0
- package/src/agents/runtime/mapAgentMessages.ts +54 -0
- package/src/agents/runtime/mapAgentSnapshot.ts +71 -0
- package/src/agents/runtime/mergeUsageTurn.ts +23 -0
- package/src/agents/runtime/pendingToolCalls.test.ts +85 -0
- package/src/agents/runtime/pendingToolCalls.ts +14 -0
- package/src/agents/runtime/toolRequiresApproval.ts +20 -0
- package/src/agents/runtime/unresolvedToolCalls.ts +42 -0
- package/src/bridge/agentModelTiers.ts +50 -0
- package/src/bridge/agentToolHandlers.ts +23 -0
- package/src/bridge/agentToolHelpers.test.ts +27 -0
- package/src/bridge/agentToolHelpers.ts +20 -0
- package/src/bridge/agentTypes.ts +294 -0
- package/src/bridge/agents.d.mts +113 -0
- package/src/bridge/agents.mjs +233 -0
- package/src/bridge/agents.ts +62 -0
- package/src/bridge/appSettings.d.mts +9 -0
- package/src/bridge/appSettings.mjs +18 -0
- package/src/bridge/appSettings.ts +4 -0
- package/src/bridge/applyThemeFromHost.d.mts +7 -0
- package/src/bridge/applyThemeFromHost.mjs +33 -0
- package/src/bridge/assets.d.mts +66 -0
- package/src/bridge/assets.mjs +121 -0
- package/src/bridge/catalog.d.mts +5 -0
- package/src/bridge/catalog.mjs +24 -0
- package/src/bridge/catalog.ts +1 -0
- package/src/bridge/client.d.mts +19 -0
- package/src/bridge/client.mjs +147 -0
- package/src/bridge/collectionAssetAdapter.ts +63 -0
- package/src/bridge/collectionAssets.d.mts +1 -0
- package/src/bridge/collectionAssets.mjs +2 -0
- package/src/bridge/collectionAssets.ts +1 -0
- package/src/bridge/collectionDocumentHtml.test.ts +71 -0
- package/src/bridge/collectionDocumentHtml.ts +118 -0
- package/src/bridge/collectionImagePaste.test.ts +32 -0
- package/src/bridge/collectionImagePaste.ts +130 -0
- package/src/bridge/context.mjs +12 -0
- package/src/bridge/credentials.mjs +22 -0
- package/src/bridge/dialog.d.mts +5 -0
- package/src/bridge/dialog.mjs +13 -0
- package/src/bridge/events.d.mts +14 -0
- package/src/bridge/events.mjs +12 -0
- package/src/bridge/filePreviewKind.test.ts +43 -0
- package/src/bridge/filePreviewKind.ts +76 -0
- package/src/bridge/fs.d.mts +41 -0
- package/src/bridge/fs.mjs +82 -0
- package/src/bridge/fs.test.ts +16 -0
- package/src/bridge/fs.ts +10 -0
- package/src/bridge/index.ts +12 -0
- package/src/bridge/inlinePreview.d.mts +35 -0
- package/src/bridge/inlinePreview.mjs +99 -0
- package/src/bridge/inlinePreview.test.ts +56 -0
- package/src/bridge/inlinePreview.ts +13 -0
- package/src/bridge/methods.d.mts +115 -0
- package/src/bridge/methods.mjs +132 -0
- package/src/bridge/os.d.mts +11 -0
- package/src/bridge/os.mjs +26 -0
- package/src/bridge/plugins.d.mts +9 -0
- package/src/bridge/plugins.mjs +31 -0
- package/src/bridge/plugins.ts +5 -0
- package/src/bridge/preferences.d.mts +7 -0
- package/src/bridge/preferences.mjs +17 -0
- package/src/bridge/preferences.ts +13 -0
- package/src/bridge/printDocument.test.ts +47 -0
- package/src/bridge/printDocument.ts +75 -0
- package/src/bridge/pureRender/adapters.test.ts +144 -0
- package/src/bridge/pureRender/adapters.ts +175 -0
- package/src/bridge/pureRender/assets.test.ts +44 -0
- package/src/bridge/pureRender/base.css +76 -0
- package/src/bridge/pureRender/compiler.test.ts +279 -0
- package/src/bridge/pureRender/compiler.ts +660 -0
- package/src/bridge/pureRender/document.test.ts +283 -0
- package/src/bridge/pureRender/document.ts +35 -0
- package/src/bridge/pureRender/extraction.test.ts +432 -0
- package/src/bridge/pureRender/extraction.ts +1023 -0
- package/src/bridge/pureRender/flow.css +3 -0
- package/src/bridge/pureRender/index.ts +66 -0
- package/src/bridge/pureRender/normalize.test.ts +442 -0
- package/src/bridge/pureRender/normalize.ts +682 -0
- package/src/bridge/pureRender/presets.ts +365 -0
- package/src/bridge/pureRender/profiles/book.css +19 -0
- package/src/bridge/pureRender/profiles/manuscript.css +11 -0
- package/src/bridge/pureRender/profiles/writer.css +10 -0
- package/src/bridge/pureRender/reset.css +5 -0
- package/src/bridge/pureRender/samples.ts +94 -0
- package/src/bridge/pureRender/styles.ts +164 -0
- package/src/bridge/pureRender/theme.test.ts +53 -0
- package/src/bridge/pureRender/theme.ts +258 -0
- package/src/bridge/pureRender/tokens/default.css +36 -0
- package/src/bridge/pureRender/tokens/default.json +32 -0
- package/src/bridge/pureRender/types.ts +264 -0
- package/src/bridge/pureRender/visualLayoutInspection.test.ts +57 -0
- package/src/bridge/pureRender/visualLayoutInspection.ts +161 -0
- package/src/bridge/react/useDebouncedEffect.ts +21 -0
- package/src/bridge/react/useIpc.tsx +75 -0
- package/src/bridge/react/usePlatformAgentRunLiveState.tsx +78 -0
- package/src/bridge/react/usePlatformAgentSessionDrive.tsx +729 -0
- package/src/bridge/react/usePlatformAgentSessions.tsx +60 -0
- package/src/bridge/react/usePlatformAgentTools.tsx +82 -0
- package/src/bridge/react/usePlatformAppManifest.tsx +32 -0
- package/src/bridge/react/usePlatformBridge.tsx +56 -0
- package/src/bridge/react/usePlatformDeepLink.tsx +57 -0
- package/src/bridge/react/usePlatformFileBinaryDataUrl.tsx +54 -0
- package/src/bridge/react/usePlatformFilePreview.tsx +92 -0
- package/src/bridge/react/usePlatformPreferences.tsx +77 -0
- package/src/bridge/react/usePlatformThemeDocumentAttrs.ts +35 -0
- package/src/bridge/react/usePlatformThemeFromBridge.tsx +16 -0
- package/src/bridge/react/usePlatformViewportResource.test.tsx +106 -0
- package/src/bridge/react/usePlatformViewportResource.tsx +72 -0
- package/src/bridge/react/useScheduledTask.tsx +59 -0
- package/src/bridge/render.d.mts +31 -0
- package/src/bridge/render.mjs +62 -0
- package/src/bridge/render.ts +8 -0
- package/src/bridge/screenAnnotation.test.ts +103 -0
- package/src/bridge/screenAnnotation.ts +269 -0
- package/src/bridge/theme.d.mts +3 -0
- package/src/bridge/theme.mjs +9 -0
- package/src/bridge/types.ts +439 -0
- package/src/bridge/watch.d.mts +9 -0
- package/src/bridge/watch.mjs +34 -0
- package/src/bridge/watch.ts +1 -0
- package/src/bridge/window.d.mts +44 -0
- package/src/bridge/window.mjs +33 -0
- package/src/chrome/index.ts +1 -0
- package/src/components/accessibility/AccessibilityReviewDialog.test.tsx +104 -0
- package/src/components/accessibility/AccessibilityReviewDialog.tsx +350 -0
- package/src/components/accessibility/accessibilityReview.test.ts +101 -0
- package/src/components/accessibility/accessibilityReview.ts +639 -0
- package/src/components/accessibility/index.ts +16 -0
- package/src/components/agent-feedback/ScreenAnnotationAgentDialog.tsx +509 -0
- package/src/components/agent-feedback/index.ts +5 -0
- package/src/components/agents/AgentComposer.tsx +34 -0
- package/src/components/agents/AgentContextUsageBar.tsx +127 -0
- package/src/components/agents/AgentDrawerPanel.tsx +82 -0
- package/src/components/agents/AgentMarkdown.tsx +12 -0
- package/src/components/agents/AgentMessageBubble.tsx +82 -0
- package/src/components/agents/AgentMessageList.tsx +47 -0
- package/src/components/agents/AgentModelMenu.tsx +55 -0
- package/src/components/agents/AgentThinkingBlock.tsx +66 -0
- package/src/components/agents/AgentToolApprovalActions.tsx +65 -0
- package/src/components/agents/AgentToolCallCard.tsx +26 -0
- package/src/components/agents/AgentToolPendingList.tsx +39 -0
- package/src/components/agents/AgentToolPendingReview.tsx +118 -0
- package/src/components/agents/agentPanelStyles.ts +79 -0
- package/src/components/agents/agentTypes.ts +96 -0
- package/src/components/agents/formatToolCallArguments.test.ts +16 -0
- package/src/components/agents/formatToolCallArguments.ts +9 -0
- package/src/components/agents/index.ts +40 -0
- package/src/components/assets/AssetLibraryDialog.tsx +5 -0
- package/src/components/assets/asset-library/AssetLibraryDialog.tsx +43 -0
- package/src/components/assets/asset-library/AssetLibraryWorkspace.tsx +54 -0
- package/src/components/assets/asset-library/detail/AssetLibraryDetailActions.tsx +68 -0
- package/src/components/assets/asset-library/detail/AssetLibraryDetailHeader.tsx +56 -0
- package/src/components/assets/asset-library/detail/AssetLibraryDetailPane.tsx +90 -0
- package/src/components/assets/asset-library/detail/AssetLibraryDetailPreview.tsx +67 -0
- package/src/components/assets/asset-library/detail/AssetLibraryInlinePreview.tsx +87 -0
- package/src/components/assets/asset-library/detail/AssetLibraryInlineSourceField.tsx +29 -0
- package/src/components/assets/asset-library/detail/AssetLibraryMetadataFields.tsx +34 -0
- package/src/components/assets/asset-library/detail/AssetLibraryUsagePanel.tsx +46 -0
- package/src/components/assets/asset-library/detail/AssetLibraryVersionsPanel.tsx +145 -0
- package/src/components/assets/asset-library/helpers/assetKind.ts +74 -0
- package/src/components/assets/asset-library/helpers.ts +41 -0
- package/src/components/assets/asset-library/hooks/useAssetDetailDraft.ts +81 -0
- package/src/components/assets/asset-library/hooks/useAssetLibraryDialog.ts +233 -0
- package/src/components/assets/asset-library/hooks/useAssetLibraryMutations.ts +266 -0
- package/src/components/assets/asset-library/hooks/useAssetLibrarySelectionSync.ts +24 -0
- package/src/components/assets/asset-library/hooks/useAssetLibraryVersions.ts +145 -0
- package/src/components/assets/asset-library/hooks/useInlineAssetPreview.ts +44 -0
- package/src/components/assets/asset-library/index.ts +19 -0
- package/src/components/assets/asset-library/layout/assetLibraryLayout.ts +201 -0
- package/src/components/assets/asset-library/shared/fieldStyles.ts +62 -0
- package/src/components/assets/asset-library/sidebar/AssetLibraryFilterPills.tsx +89 -0
- package/src/components/assets/asset-library/sidebar/AssetLibraryList.tsx +91 -0
- package/src/components/assets/asset-library/sidebar/AssetLibraryListRow.tsx +99 -0
- package/src/components/assets/asset-library/sidebar/AssetLibraryListStatus.tsx +24 -0
- package/src/components/assets/asset-library/sidebar/AssetLibrarySidebar.tsx +48 -0
- package/src/components/assets/asset-library/sidebar/AssetLibrarySidebarActions.tsx +38 -0
- package/src/components/assets/asset-library/sidebar/AssetLibrarySidebarToolbar.tsx +78 -0
- package/src/components/assets/asset-library/sidebar/AssetListThumbnail.tsx +86 -0
- package/src/components/assets/asset-library/types.ts +128 -0
- package/src/components/assets/asset-library/utils/assetLibraryUtils.ts +181 -0
- package/src/components/assets/asset-library/utils/pathBasename.ts +5 -0
- package/src/components/assets/asset-library/utils/sanitizeUploadFileName.ts +7 -0
- package/src/components/assets/asset-library/utils/uploadCollectionAsset.ts +52 -0
- package/src/components/chrome/OverlayActionCapsule.test.tsx +82 -0
- package/src/components/chrome/OverlayActionCapsule.tsx +90 -0
- package/src/components/chrome/PanelTabStrip.tsx +113 -0
- package/src/components/chrome/PlatformIcon.tsx +27 -0
- package/src/components/chrome/PureAppWordmark.tsx +89 -0
- package/src/components/chrome/ShellWindowControls.tsx +51 -0
- package/src/components/chrome/ThemeModeButton.tsx +16 -0
- package/src/components/chrome/Titlebar.tsx +79 -0
- package/src/components/chrome/WorkspaceTabStrip.tsx +300 -0
- package/src/components/chrome/index.ts +31 -0
- package/src/components/chrome/workspaceTabTypes.ts +29 -0
- package/src/components/common/buttons/Button.tsx +241 -0
- package/src/components/common/buttons/ChoiceChip.tsx +73 -0
- package/src/components/common/buttons/CleanButton.tsx +34 -0
- package/src/components/common/buttons/IconButton.tsx +89 -0
- package/src/components/common/buttons/QuietAction.tsx +29 -0
- package/src/components/common/buttons/SegmentedControl.tsx +67 -0
- package/src/components/common/buttons/TextActionButton.tsx +55 -0
- package/src/components/common/buttons/TextLink.tsx +38 -0
- package/src/components/common/canvas/CanvasElementFrame.test.tsx +79 -0
- package/src/components/common/canvas/CanvasElementFrame.tsx +182 -0
- package/src/components/common/canvas/canvasGeometry.test.ts +66 -0
- package/src/components/common/canvas/canvasGeometry.ts +133 -0
- package/src/components/common/canvas/index.ts +27 -0
- package/src/components/common/canvas/useCanvasDragResize.test.tsx +152 -0
- package/src/components/common/canvas/useCanvasDragResize.ts +161 -0
- package/src/components/common/chat/ChatAssistantMessage.tsx +81 -0
- package/src/components/common/chat/ChatBox.tsx +189 -0
- package/src/components/common/chat/ChatMarkdown.tsx +109 -0
- package/src/components/common/chat/ChatModelMenu.tsx +258 -0
- package/src/components/common/chat/ChatStatusRow.tsx +24 -0
- package/src/components/common/chat/ChatThinkingIndicator.tsx +54 -0
- package/src/components/common/chat/ChatThread.tsx +59 -0
- package/src/components/common/chat/ChatToolRow.tsx +141 -0
- package/src/components/common/chat/ChatUserBubble.tsx +45 -0
- package/src/components/common/chat/chatUtils.ts +7 -0
- package/src/components/common/chat/index.ts +24 -0
- package/src/components/common/connections/ConnectionSetup.tsx +529 -0
- package/src/components/common/connections/index.ts +26 -0
- package/src/components/common/containers/AppFrame.test.tsx +47 -0
- package/src/components/common/containers/AppFrame.tsx +65 -0
- package/src/components/common/containers/AppHeader.tsx +60 -0
- package/src/components/common/containers/AutoFillGrid.tsx +37 -0
- package/src/components/common/containers/Collapsible.tsx +43 -0
- package/src/components/common/containers/CollapsibleGrid.tsx +174 -0
- package/src/components/common/containers/MotionScope.tsx +32 -0
- package/src/components/common/containers/PageHeader.tsx +35 -0
- package/src/components/common/containers/PanelToolbarHeader.tsx +113 -0
- package/src/components/common/containers/QuietDisclosure.tsx +91 -0
- package/src/components/common/containers/QuietSurface.tsx +41 -0
- package/src/components/common/containers/ScrollPanel.tsx +33 -0
- package/src/components/common/containers/StatusBar.tsx +42 -0
- package/src/components/common/containers/SurfacePanel.tsx +66 -0
- package/src/components/common/containers/ToolbarStrip.tsx +80 -0
- package/src/components/common/containers/flex.ts +117 -0
- package/src/components/common/containers/useOpenTransition.ts +33 -0
- package/src/components/common/context/ContextSelector.tsx +269 -0
- package/src/components/common/context/index.ts +7 -0
- package/src/components/common/desk/ActionReader.tsx +270 -0
- package/src/components/common/desk/ActivityLedger.tsx +143 -0
- package/src/components/common/desk/CreationDesk.tsx +139 -0
- package/src/components/common/desk/DailyBrief.tsx +160 -0
- package/src/components/common/desk/DeskCard.tsx +157 -0
- package/src/components/common/desk/index.ts +30 -0
- package/src/components/common/dropdown/ContextMenu.tsx +87 -0
- package/src/components/common/dropdown/MenuButtonDropdown.tsx +121 -0
- package/src/components/common/dropdown/MenuDropdown.tsx +63 -0
- package/src/components/common/dropdown/MenuDropdownEntry.tsx +51 -0
- package/src/components/common/dropdown/MenuDropdownItem.tsx +82 -0
- package/src/components/common/dropdown/MenuDropdownSubmenu.tsx +145 -0
- package/src/components/common/dropdown/MenuPanel.tsx +69 -0
- package/src/components/common/dropdown/MenuPortal.tsx +162 -0
- package/src/components/common/dropdown/MenuPortalLayer.tsx +6 -0
- package/src/components/common/dropdown/SelectMenu.tsx +243 -0
- package/src/components/common/dropdown/SelectMenuControl.tsx +23 -0
- package/src/components/common/dropdown/SelectMenuOptions.tsx +38 -0
- package/src/components/common/dropdown/menuPortalConstants.ts +11 -0
- package/src/components/common/dropdown/menuTypes.ts +71 -0
- package/src/components/common/dropdown/menuViewportPosition.test.ts +139 -0
- package/src/components/common/dropdown/menuViewportPosition.ts +122 -0
- package/src/components/common/dropdown/selectMenuLayout.test.ts +42 -0
- package/src/components/common/dropdown/selectMenuLayout.ts +123 -0
- package/src/components/common/dropdown/useMenuAnchorPosition.ts +109 -0
- package/src/components/common/dropdown/useSelectMenuAnchor.ts +30 -0
- package/src/components/common/evidence/StructuredEvidenceView.test.tsx +77 -0
- package/src/components/common/evidence/StructuredEvidenceView.tsx +312 -0
- package/src/components/common/evidence/index.ts +13 -0
- package/src/components/common/feedback/Badge.tsx +33 -0
- package/src/components/common/feedback/CapabilityPills.tsx +36 -0
- package/src/components/common/feedback/EmptyState.tsx +132 -0
- package/src/components/common/feedback/InfoHint.tsx +67 -0
- package/src/components/common/feedback/InlineBanner.tsx +82 -0
- package/src/components/common/feedback/PlatformChip.tsx +104 -0
- package/src/components/common/feedback/QuietPill.tsx +75 -0
- package/src/components/common/feedback/WorkProgressPanel.tsx +156 -0
- package/src/components/common/feedback/index.ts +33 -0
- package/src/components/common/inputs/BareInput.tsx +31 -0
- package/src/components/common/inputs/BareTextarea.tsx +10 -0
- package/src/components/common/inputs/Checkbox.tsx +13 -0
- package/src/components/common/inputs/FieldControlShell.tsx +49 -0
- package/src/components/common/inputs/FormField.tsx +40 -0
- package/src/components/common/inputs/HybridSearchField.tsx +280 -0
- package/src/components/common/inputs/InlineComposer.tsx +197 -0
- package/src/components/common/inputs/PaletteCirclePicker.tsx +26 -0
- package/src/components/common/inputs/PaletteDropdown.tsx +413 -0
- package/src/components/common/inputs/Radio.tsx +19 -0
- package/src/components/common/inputs/SearchField.tsx +128 -0
- package/src/components/common/inputs/SelectField.tsx +169 -0
- package/src/components/common/inputs/SurfacePalettePicker.tsx +54 -0
- package/src/components/common/inputs/TextAreaField.tsx +22 -0
- package/src/components/common/inputs/TextField.tsx +51 -0
- package/src/components/common/inputs/ToggleSwitch.tsx +110 -0
- package/src/components/common/inputs/WorkspacePicker.tsx +349 -0
- package/src/components/common/inputs/fieldStyles.ts +137 -0
- package/src/components/common/layout/PanelGroup.tsx +479 -0
- package/src/components/common/layout/index.ts +31 -0
- package/src/components/common/layout/panelLayoutConstants.ts +7 -0
- package/src/components/common/layout/panelLayoutPersistence.ts +35 -0
- package/src/components/common/layout/panelLayoutState.test.ts +38 -0
- package/src/components/common/layout/panelLayoutState.ts +174 -0
- package/src/components/common/layout/panelLayoutTypes.ts +19 -0
- package/src/components/common/layout/tabs/Tabs.tsx +136 -0
- package/src/components/common/lists/listRowStyles.ts +32 -0
- package/src/components/common/lists/quiet-ledger/QuietActivityList.tsx +64 -0
- package/src/components/common/lists/quiet-ledger/QuietLedgerRow.tsx +119 -0
- package/src/components/common/lists/quiet-ledger/index.ts +9 -0
- package/src/components/common/lists/reorderable/DragHandle.tsx +65 -0
- package/src/components/common/lists/reorderable/ReorderableList.tsx +280 -0
- package/src/components/common/lists/reorderable/ReorderableListRow.tsx +102 -0
- package/src/components/common/lists/reorderable/ReorderableSections.tsx +344 -0
- package/src/components/common/lists/reorderable/ReorderableSectionsDemo.tsx +94 -0
- package/src/components/common/lists/reorderable/index.ts +15 -0
- package/src/components/common/lists/reorderable/reorderableUtils.test.ts +28 -0
- package/src/components/common/lists/reorderable/reorderableUtils.ts +23 -0
- package/src/components/common/lists/reorderable/types.ts +40 -0
- package/src/components/common/lists/reorderable/useReorderableDragState.ts +49 -0
- package/src/components/common/media/ImageReferencePicker.tsx +242 -0
- package/src/components/common/menubar/MenuBar.tsx +78 -0
- package/src/components/common/menubar/MenuBarTrigger.tsx +70 -0
- package/src/components/common/narrative/NarrativeMention.tsx +74 -0
- package/src/components/common/navigation/PathBreadcrumbs.tsx +78 -0
- package/src/components/common/navigation/UnderlineTabs.tsx +83 -0
- package/src/components/common/overlays/InstallAppPromptDialog.tsx +59 -0
- package/src/components/common/overlays/Modal.tsx +285 -0
- package/src/components/common/overlays/ModalChromeHeader.tsx +105 -0
- package/src/components/common/overlays/ObjectActionStrip.tsx +80 -0
- package/src/components/common/people/AutoUpdateReviewList.tsx +182 -0
- package/src/components/common/people/EntityList.tsx +122 -0
- package/src/components/common/people/EntityPortrait.tsx +64 -0
- package/src/components/common/people/LinkedDossierList.tsx +99 -0
- package/src/components/common/people/OpportunityList.tsx +94 -0
- package/src/components/common/people/PeopleSourceList.tsx +145 -0
- package/src/components/common/people/RelationshipDossier.tsx +168 -0
- package/src/components/common/people/RelationshipMap.tsx +362 -0
- package/src/components/common/people/index.ts +40 -0
- package/src/components/common/preview/FileAudioPreview.tsx +89 -0
- package/src/components/common/preview/FileImagePreview.tsx +88 -0
- package/src/components/common/preview/FilePdfPreview.tsx +87 -0
- package/src/components/common/preview/FileTextPreview.tsx +96 -0
- package/src/components/common/preview/FileVideoPreview.tsx +87 -0
- package/src/components/common/preview/PlatformFilePreview.tsx +166 -0
- package/src/components/common/preview/previewLayout.ts +27 -0
- package/src/components/common/render/Each.tsx +42 -0
- package/src/components/common/research/EvidenceDossier.tsx +894 -0
- package/src/components/common/research/index.ts +7 -0
- package/src/components/common/tiles/CatalogCard.tsx +116 -0
- package/src/components/common/tiles/Tile.tsx +45 -0
- package/src/components/common/tiles/TileGrid.tsx +13 -0
- package/src/components/common/typography/Heading.tsx +27 -0
- package/src/components/common/typography/Kicker.tsx +30 -0
- package/src/components/common/typography/Text.tsx +80 -0
- package/src/components/credentials/CredentialsPanel.tsx +169 -0
- package/src/components/credentials/credentialsTypes.ts +14 -0
- package/src/components/data/DataChart.tsx +913 -0
- package/src/components/data/dataTable.ts +99 -0
- package/src/components/editor/EditorCommentPromptDialog.tsx +124 -0
- package/src/components/editor/EditorLinkPromptDialog.tsx +65 -0
- package/src/components/print-design/PrintDesignPanel.test.tsx +1446 -0
- package/src/components/print-design/PrintDesignPanel.tsx +3043 -0
- package/src/components/print-design/index.ts +9 -0
- package/src/components/proofing/PagedProofDialog.tsx +453 -0
- package/src/components/proofing/index.ts +4 -0
- package/src/editor/DocumentEditor.tsx +28 -0
- package/src/editor/EditorViewModeToggle.tsx +35 -0
- package/src/editor/index.ts +97 -0
- package/src/editor/toolbarOverlays.ts +8 -0
- package/src/index.ts +209 -0
- package/src/theme/ThemeProvider.tsx +113 -0
- package/src/theme/appAccents.ts +87 -0
- package/src/theme/buildThemeBridgePayload.ts +23 -0
- package/src/theme/composePlatformTheme.test.ts +30 -0
- package/src/theme/composePlatformTheme.ts +23 -0
- package/src/theme/platformFont.d.mts +7 -0
- package/src/theme/platformFont.mjs +20 -0
- package/src/theme/platformFont.ts +6 -0
- package/src/theme/reportsShellChromeSelectors.ts +136 -0
- package/src/theme/styled.d.ts +5 -0
- package/src/theme/surfacePalettes.ts +178 -0
- package/src/theme/surfaceRoleSelectors.ts +113 -0
- package/src/theme/themeVars.ts +13 -0
- package/src/theme/themes/dark.ts +59 -0
- package/src/theme/themes/light.ts +60 -0
- package/src/theme/themes/palette.ts +44 -0
- package/src/theme/themes/shared.ts +68 -0
- package/src/theme/tokens.ts +114 -0
- package/src/theme/utils/GlobalStyles.ts +88 -0
- package/src/theme/utils/appFrameDocumentStyles.d.mts +5 -0
- package/src/theme/utils/appFrameDocumentStyles.mjs +89 -0
- package/src/theme/utils/appFrameDocumentStyles.ts +5 -0
- package/src/theme/utils/applyTheme.ts +50 -0
- package/src/theme/utils/cssVariables.ts +49 -0
- package/src/theme/utils/useInjectThemeIntoIframe.ts +40 -0
- package/src/utils/extensionIconMap.ts +123 -0
- package/src/utils/generalUtils.ts +157 -0
- package/src/writing/DraftAssistantDialog.tsx +279 -0
- package/src/writing/WritingStyleManager.tsx +416 -0
- package/src/writing/condenseWritingStyle.ts +103 -0
- package/src/writing/draftTextWithAgent.ts +134 -0
- package/src/writing/index.ts +39 -0
- package/src/writing/styleStore.ts +32 -0
- package/src/writing/writingStyle.test.ts +122 -0
- package/src/writing/writingStyle.ts +217 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
import { AgentUiRunState } from '../../components/agents/agentTypes.js'
|
|
3
|
+
import { derivePendingToolCalls } from './pendingToolCalls.js'
|
|
4
|
+
import { toolRequiresApproval } from './toolRequiresApproval.js'
|
|
5
|
+
|
|
6
|
+
describe('derivePendingToolCalls', () => {
|
|
7
|
+
it('returns unresolved tool calls when state is pending_tools', () => {
|
|
8
|
+
const pending = derivePendingToolCalls(
|
|
9
|
+
[
|
|
10
|
+
{
|
|
11
|
+
role: 'assistant',
|
|
12
|
+
content: '',
|
|
13
|
+
toolCalls: [
|
|
14
|
+
{
|
|
15
|
+
id: 'tc-1',
|
|
16
|
+
name: 'book:read',
|
|
17
|
+
arguments: {},
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
AgentUiRunState.PendingTools,
|
|
23
|
+
)
|
|
24
|
+
expect(pending.map(call => call.id)).toEqual(['tc-1'])
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
it('returns empty when state is not pending_tools', () => {
|
|
28
|
+
expect(
|
|
29
|
+
derivePendingToolCalls(
|
|
30
|
+
[
|
|
31
|
+
{
|
|
32
|
+
role: 'assistant',
|
|
33
|
+
content: '',
|
|
34
|
+
toolCalls: [
|
|
35
|
+
{ id: 'tc-1', name: 'book:read', arguments: {} },
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
AgentUiRunState.AwaitingUser,
|
|
40
|
+
),
|
|
41
|
+
).toEqual([])
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
describe('toolRequiresApproval', () => {
|
|
46
|
+
it('honors approval overrides over defaults', () => {
|
|
47
|
+
expect(
|
|
48
|
+
toolRequiresApproval('book:read', {
|
|
49
|
+
allowedTargetApps: ['book'],
|
|
50
|
+
approvalOverrides: { 'book:read': false },
|
|
51
|
+
}),
|
|
52
|
+
).toBe(false)
|
|
53
|
+
expect(
|
|
54
|
+
toolRequiresApproval('book:write', {
|
|
55
|
+
allowedTargetApps: ['book'],
|
|
56
|
+
approvalOverrides: { 'book:read': false },
|
|
57
|
+
defaultRequiresApproval: true,
|
|
58
|
+
}),
|
|
59
|
+
).toBe(true)
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
it('never requires approval for harness context read tools when policy is merged', () => {
|
|
63
|
+
expect(
|
|
64
|
+
toolRequiresApproval('harness.grep_context', {
|
|
65
|
+
allowedTargetApps: ['book'],
|
|
66
|
+
defaultRequiresApproval: true,
|
|
67
|
+
approvalOverrides: {
|
|
68
|
+
'harness.grep_context': false,
|
|
69
|
+
'harness.invoke_agent': true,
|
|
70
|
+
'harness.read_context_chunk': false,
|
|
71
|
+
},
|
|
72
|
+
}),
|
|
73
|
+
).toBe(false)
|
|
74
|
+
expect(
|
|
75
|
+
toolRequiresApproval('harness.invoke_agent', {
|
|
76
|
+
allowedTargetApps: ['book'],
|
|
77
|
+
defaultRequiresApproval: true,
|
|
78
|
+
approvalOverrides: {
|
|
79
|
+
'harness.grep_context': false,
|
|
80
|
+
'harness.invoke_agent': true,
|
|
81
|
+
},
|
|
82
|
+
}),
|
|
83
|
+
).toBe(true)
|
|
84
|
+
})
|
|
85
|
+
})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PlatformAgentMessage } from '../../bridge/agentTypes.js'
|
|
2
|
+
import { AgentUiRunState } from '../../components/agents/agentTypes.js'
|
|
3
|
+
import type { AgentUiToolCall } from '../../components/agents/agentTypes.js'
|
|
4
|
+
import { unresolvedToolCalls } from './unresolvedToolCalls.js'
|
|
5
|
+
|
|
6
|
+
export function derivePendingToolCalls(
|
|
7
|
+
messages: readonly PlatformAgentMessage[],
|
|
8
|
+
state: string,
|
|
9
|
+
): AgentUiToolCall[] {
|
|
10
|
+
if (state !== AgentUiRunState.PendingTools) {
|
|
11
|
+
return []
|
|
12
|
+
}
|
|
13
|
+
return unresolvedToolCalls(messages)
|
|
14
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { PlatformAgentSessionToolPolicy } from '../../bridge/agentTypes.js'
|
|
2
|
+
|
|
3
|
+
/** Resolve whether a qualified tool name needs user approval before routing. */
|
|
4
|
+
export function toolRequiresApproval(
|
|
5
|
+
qualifiedName: string,
|
|
6
|
+
policy: PlatformAgentSessionToolPolicy,
|
|
7
|
+
): boolean {
|
|
8
|
+
if (
|
|
9
|
+
policy.approvalOverrides &&
|
|
10
|
+
Object.hasOwn(policy.approvalOverrides, qualifiedName)
|
|
11
|
+
) {
|
|
12
|
+
return policy.approvalOverrides[qualifiedName]!
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (policy.defaultRequiresApproval !== undefined) {
|
|
16
|
+
return policy.defaultRequiresApproval
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return true
|
|
20
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { PlatformAgentMessage } from '../../bridge/agentTypes.js'
|
|
2
|
+
import type { AgentUiToolCall } from '../../components/agents/agentTypes.js'
|
|
3
|
+
|
|
4
|
+
function lastAssistantToolRequest(
|
|
5
|
+
messages: readonly PlatformAgentMessage[],
|
|
6
|
+
): PlatformAgentMessage | undefined {
|
|
7
|
+
for (let index = messages.length - 1; index >= 0; index -= 1) {
|
|
8
|
+
const message = messages[index]
|
|
9
|
+
if (message.role === 'assistant' && message.toolCalls?.length) {
|
|
10
|
+
return message
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return undefined
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Tool calls on the latest assistant tool-request turn that lack a matching tool result. */
|
|
17
|
+
export function unresolvedToolCalls(
|
|
18
|
+
messages: readonly PlatformAgentMessage[],
|
|
19
|
+
): AgentUiToolCall[] {
|
|
20
|
+
const assistantTurn = lastAssistantToolRequest(messages)
|
|
21
|
+
if (!assistantTurn?.toolCalls?.length) {
|
|
22
|
+
return []
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const resolvedIds = new Set(
|
|
26
|
+
messages
|
|
27
|
+
.filter(
|
|
28
|
+
message =>
|
|
29
|
+
message.role === 'tool' &&
|
|
30
|
+
typeof message.toolCallId === 'string',
|
|
31
|
+
)
|
|
32
|
+
.map(message => message.toolCallId as string),
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
return assistantTurn.toolCalls
|
|
36
|
+
.filter(call => !resolvedIds.has(call.id))
|
|
37
|
+
.map(call => ({
|
|
38
|
+
id: call.id,
|
|
39
|
+
name: call.name,
|
|
40
|
+
arguments: { ...call.arguments },
|
|
41
|
+
}))
|
|
42
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/** Default high-tier model id (matches shell catalog). */
|
|
2
|
+
export const DEFAULT_AGENT_HIGH_LEVEL_MODEL_ID = 'deepseek:deepseek-v4-pro'
|
|
3
|
+
|
|
4
|
+
/** Default low-tier model id (matches shell catalog). */
|
|
5
|
+
export const DEFAULT_AGENT_LOW_LEVEL_MODEL_ID = 'deepseek:deepseek-v4-flash'
|
|
6
|
+
|
|
7
|
+
/** Session model sentinel — resolved per user message in the shell agent host. */
|
|
8
|
+
export const AGENT_AUTO_MODEL_ID = 'auto'
|
|
9
|
+
export const AGENT_AUTO_MODEL_LABEL = 'Auto'
|
|
10
|
+
|
|
11
|
+
export function isAgentAutoModelId(modelId: string | undefined | null): boolean {
|
|
12
|
+
return modelId === AGENT_AUTO_MODEL_ID
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface PlatformAgentModelTiers {
|
|
16
|
+
lowLevelModelId: string
|
|
17
|
+
highLevelModelId: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface PlatformAgentSessionConfigPatch {
|
|
21
|
+
modelId?: string
|
|
22
|
+
sessionPrompt?: string
|
|
23
|
+
toolPolicy?: {
|
|
24
|
+
allowedTargetApps?: string[]
|
|
25
|
+
routeReadinessMs?: number
|
|
26
|
+
handlerResponseMs?: number
|
|
27
|
+
defaultRequiresApproval?: boolean
|
|
28
|
+
approvalOverrides?: Record<string, boolean>
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface PlatformAgentSessionScopeDefaults {
|
|
33
|
+
global?: PlatformAgentSessionConfigPatch
|
|
34
|
+
apps?: Record<string, PlatformAgentSessionConfigPatch>
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Resolve tier ids from shell preferences with catalog fallbacks. */
|
|
38
|
+
export function resolveAgentModelTiersFromPrefs(
|
|
39
|
+
prefs: {
|
|
40
|
+
agentModelTiers?: Partial<PlatformAgentModelTiers>
|
|
41
|
+
} | null | undefined,
|
|
42
|
+
): PlatformAgentModelTiers {
|
|
43
|
+
const stored = prefs?.agentModelTiers
|
|
44
|
+
return {
|
|
45
|
+
lowLevelModelId:
|
|
46
|
+
stored?.lowLevelModelId?.trim() || DEFAULT_AGENT_LOW_LEVEL_MODEL_ID,
|
|
47
|
+
highLevelModelId:
|
|
48
|
+
stored?.highLevelModelId?.trim() || DEFAULT_AGENT_HIGH_LEVEL_MODEL_ID,
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AgentToolHandler,
|
|
3
|
+
AgentToolHandlerResult,
|
|
4
|
+
AgentToolInvokeContext,
|
|
5
|
+
} from './react/usePlatformAgentTools.js'
|
|
6
|
+
|
|
7
|
+
export type AgentToolHandlerFn<TContext> = (
|
|
8
|
+
context: TContext,
|
|
9
|
+
invoke: AgentToolInvokeContext,
|
|
10
|
+
) => Promise<AgentToolHandlerResult>
|
|
11
|
+
|
|
12
|
+
/** Bind tab-scoped context to modular per-tool handler functions. */
|
|
13
|
+
export function createAgentToolHandlers<TContext>(
|
|
14
|
+
definitions: Record<string, AgentToolHandlerFn<TContext>>,
|
|
15
|
+
getContext: () => TContext,
|
|
16
|
+
): Record<string, AgentToolHandler> {
|
|
17
|
+
return Object.fromEntries(
|
|
18
|
+
Object.entries(definitions).map(([name, handler]) => [
|
|
19
|
+
name,
|
|
20
|
+
(invoke: AgentToolInvokeContext) => handler(getContext(), invoke),
|
|
21
|
+
]),
|
|
22
|
+
)
|
|
23
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest'
|
|
2
|
+
import {
|
|
3
|
+
agentToolErrorContent,
|
|
4
|
+
formatAgentToolJson,
|
|
5
|
+
readAgentToolStringArg,
|
|
6
|
+
} from './agentToolHelpers.js'
|
|
7
|
+
|
|
8
|
+
describe('agentToolHelpers', () => {
|
|
9
|
+
it('reads trimmed string args', () => {
|
|
10
|
+
expect(
|
|
11
|
+
readAgentToolStringArg({ bookPath: ' /tmp/book ' }, 'bookPath'),
|
|
12
|
+
).toBe('/tmp/book')
|
|
13
|
+
expect(readAgentToolStringArg({}, 'bookPath')).toBeNull()
|
|
14
|
+
expect(readAgentToolStringArg({ bookPath: ' ' }, 'bookPath')).toBeNull()
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it('formats JSON tool payloads', () => {
|
|
18
|
+
expect(formatAgentToolJson({ ok: true })).toBe('{\n "ok": true\n}')
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
it('builds error results', () => {
|
|
22
|
+
expect(agentToolErrorContent('nope')).toEqual({
|
|
23
|
+
content: 'nope',
|
|
24
|
+
isError: true,
|
|
25
|
+
})
|
|
26
|
+
})
|
|
27
|
+
})
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export function readAgentToolStringArg(
|
|
2
|
+
args: Record<string, unknown>,
|
|
3
|
+
key: string,
|
|
4
|
+
): string | null {
|
|
5
|
+
const value = args[key]
|
|
6
|
+
if (typeof value !== 'string') return null
|
|
7
|
+
const trimmed = value.trim()
|
|
8
|
+
return trimmed.length > 0 ? trimmed : null
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function formatAgentToolJson(value: unknown): string {
|
|
12
|
+
return JSON.stringify(value, null, 2)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function agentToolErrorContent(message: string): {
|
|
16
|
+
content: string
|
|
17
|
+
isError: true
|
|
18
|
+
} {
|
|
19
|
+
return { content: message, isError: true }
|
|
20
|
+
}
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
/** Plugin-facing agent session types — mirror shell store shape without importing shell code. */
|
|
2
|
+
|
|
3
|
+
export const PlatformAgentSessionScope = {
|
|
4
|
+
App: 'app',
|
|
5
|
+
Global: 'global',
|
|
6
|
+
} as const
|
|
7
|
+
|
|
8
|
+
export type PlatformAgentSessionScope =
|
|
9
|
+
(typeof PlatformAgentSessionScope)[keyof typeof PlatformAgentSessionScope]
|
|
10
|
+
|
|
11
|
+
export type PlatformAgentUiRunState =
|
|
12
|
+
| 'ready'
|
|
13
|
+
| 'pending_tools'
|
|
14
|
+
| 'awaiting_user'
|
|
15
|
+
| 'failed'
|
|
16
|
+
| 'interrupted'
|
|
17
|
+
|
|
18
|
+
export type PlatformAgentMessageRole = 'system' | 'user' | 'assistant' | 'tool'
|
|
19
|
+
|
|
20
|
+
export interface PlatformAgentImageAttachment {
|
|
21
|
+
type: 'image'
|
|
22
|
+
mimeType: string
|
|
23
|
+
data: string
|
|
24
|
+
name?: string
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type PlatformAgentMessageAttachment = PlatformAgentImageAttachment
|
|
28
|
+
|
|
29
|
+
export interface PlatformAgentUiToolCall {
|
|
30
|
+
id: string
|
|
31
|
+
name: string
|
|
32
|
+
arguments: Record<string, unknown>
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type PlatformAgentMessageContentPart =
|
|
36
|
+
| { type: 'text'; text: string }
|
|
37
|
+
| {
|
|
38
|
+
type: 'image_url'
|
|
39
|
+
imageUrl: string
|
|
40
|
+
mimeType?: string
|
|
41
|
+
detail?: 'auto' | 'low' | 'high'
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** An image attached to a user message, delivered to vision-capable models. */
|
|
45
|
+
export interface PlatformAgentImageBlock {
|
|
46
|
+
/** MIME type, e.g. 'image/png'. */
|
|
47
|
+
mediaType: string
|
|
48
|
+
/** Raw base64 payload — NO `data:` URL prefix. */
|
|
49
|
+
dataBase64: string
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface PlatformAgentMessage {
|
|
53
|
+
role: PlatformAgentMessageRole
|
|
54
|
+
content: string
|
|
55
|
+
contentParts?: PlatformAgentMessageContentPart[]
|
|
56
|
+
attachments?: PlatformAgentMessageAttachment[]
|
|
57
|
+
toolCallId?: string
|
|
58
|
+
toolCalls?: PlatformAgentUiToolCall[]
|
|
59
|
+
images?: PlatformAgentImageBlock[]
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface PlatformAgentSessionToolPolicy {
|
|
63
|
+
/** Empty list allows routing to any app with registered tools. */
|
|
64
|
+
allowedTargetApps: string[]
|
|
65
|
+
routeReadinessMs?: number
|
|
66
|
+
handlerResponseMs?: number
|
|
67
|
+
defaultRequiresApproval?: boolean
|
|
68
|
+
approvalOverrides?: Record<string, boolean>
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface PlatformAgentSessionConfig {
|
|
72
|
+
modelId: string
|
|
73
|
+
/** Appended after the app's agents.md base prompt. */
|
|
74
|
+
sessionPrompt?: string
|
|
75
|
+
/** Full system prompt override. When set, replaces agents.md and sessionPrompt. */
|
|
76
|
+
systemPrompt?: string
|
|
77
|
+
toolPolicy?: PlatformAgentSessionToolPolicy
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export interface PlatformAgentSessionMetadata {
|
|
81
|
+
title: string
|
|
82
|
+
createdAt: string
|
|
83
|
+
updatedAt: string
|
|
84
|
+
restoreTabId?: string
|
|
85
|
+
lastActiveAt?: string
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export interface PlatformAgentSessionSnapshot {
|
|
89
|
+
state: PlatformAgentUiRunState
|
|
90
|
+
turn: number
|
|
91
|
+
messages: PlatformAgentMessage[]
|
|
92
|
+
error?: string
|
|
93
|
+
interruptedReason?: string
|
|
94
|
+
contextCompaction?: {
|
|
95
|
+
summary: string
|
|
96
|
+
activeFromIndex: number
|
|
97
|
+
updatedAt: string
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface PlatformAgentSessionRecord {
|
|
102
|
+
version: 1
|
|
103
|
+
sessionId: string
|
|
104
|
+
scope: PlatformAgentSessionScope
|
|
105
|
+
appSlug?: string
|
|
106
|
+
config: PlatformAgentSessionConfig
|
|
107
|
+
metadata: PlatformAgentSessionMetadata
|
|
108
|
+
snapshot: PlatformAgentSessionSnapshot
|
|
109
|
+
runId?: string
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface PlatformAgentSessionSummary {
|
|
113
|
+
sessionId: string
|
|
114
|
+
title: string
|
|
115
|
+
updatedAt: string
|
|
116
|
+
state: PlatformAgentUiRunState
|
|
117
|
+
restoreTabId?: string
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export interface PlatformCreateAgentSessionRequest {
|
|
121
|
+
scope: PlatformAgentSessionScope
|
|
122
|
+
appSlug?: string
|
|
123
|
+
title?: string
|
|
124
|
+
config?: PlatformAgentSessionConfigPatch
|
|
125
|
+
restoreTabId?: string
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export type PlatformAgentSessionConfigPatch = Omit<
|
|
129
|
+
Partial<PlatformAgentSessionConfig>,
|
|
130
|
+
'toolPolicy'
|
|
131
|
+
> & {
|
|
132
|
+
toolPolicy?: Partial<PlatformAgentSessionToolPolicy>
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface PlatformListAgentSessionsRequest {
|
|
136
|
+
scope: PlatformAgentSessionScope
|
|
137
|
+
appSlug?: string
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface PlatformReadAgentSessionRequest {
|
|
141
|
+
scope: PlatformAgentSessionScope
|
|
142
|
+
sessionId: string
|
|
143
|
+
appSlug?: string
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export interface PlatformUpdateAgentSessionRequest {
|
|
147
|
+
query: PlatformReadAgentSessionRequest
|
|
148
|
+
patch: {
|
|
149
|
+
config?: PlatformAgentSessionConfigPatch
|
|
150
|
+
metadata?: Partial<PlatformAgentSessionMetadata>
|
|
151
|
+
snapshot?: PlatformAgentSessionSnapshot
|
|
152
|
+
runId?: string | null
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/** Host → plugin streaming event payload (subset; extended per event type in main). */
|
|
157
|
+
export interface PlatformAgentRunEvent {
|
|
158
|
+
runId: string
|
|
159
|
+
seq: number
|
|
160
|
+
type: string
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** Live run snapshot returned by the agents.run.* bridge methods. */
|
|
164
|
+
export interface PlatformAgentRunSnapshot {
|
|
165
|
+
runId: string
|
|
166
|
+
state: PlatformAgentUiRunState
|
|
167
|
+
turn: number
|
|
168
|
+
messages: PlatformAgentMessage[]
|
|
169
|
+
error?: string
|
|
170
|
+
interruptedReason?: string
|
|
171
|
+
effectiveModelId?: string
|
|
172
|
+
routingTier?: 'low' | 'high'
|
|
173
|
+
usage?: PlatformAgentRunUsage
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export interface PlatformAgentRunUsage {
|
|
177
|
+
inputTokens: number
|
|
178
|
+
outputTokens: number
|
|
179
|
+
totalTokens: number
|
|
180
|
+
contextWindowTokens?: number
|
|
181
|
+
contextFillTokens?: number
|
|
182
|
+
estimated?: boolean
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/** Snapshot + main-resolved routing policy (`readAgentRunContext`). */
|
|
186
|
+
export interface PlatformAgentRunContext {
|
|
187
|
+
snapshot: PlatformAgentRunSnapshot
|
|
188
|
+
effectiveToolPolicy: PlatformAgentSessionToolPolicy
|
|
189
|
+
sessionId: string
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/** Shared session handle for session-drive bridge methods. */
|
|
193
|
+
export interface PlatformAgentSessionDriveRequest {
|
|
194
|
+
session: PlatformReadAgentSessionRequest
|
|
195
|
+
restoreTabId?: string
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export interface PlatformSendAgentSessionMessageRequest
|
|
199
|
+
extends PlatformAgentSessionDriveRequest {
|
|
200
|
+
message: string
|
|
201
|
+
attachments?: PlatformAgentMessageAttachment[]
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export interface PlatformRejectAgentSessionToolsRequest
|
|
205
|
+
extends PlatformAgentSessionDriveRequest {
|
|
206
|
+
rejectReason?: string
|
|
207
|
+
toolCallIds?: string[]
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export interface PlatformApproveAgentSessionToolsRequest
|
|
211
|
+
extends PlatformAgentSessionDriveRequest {
|
|
212
|
+
toolCallIds?: string[]
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export interface PlatformInterruptAgentSessionRequest
|
|
216
|
+
extends PlatformAgentSessionDriveRequest {
|
|
217
|
+
reason?: string
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/** Result of shell-driven session operations (send, approve, advance pending). */
|
|
221
|
+
export interface PlatformAgentSessionDriveResult {
|
|
222
|
+
session: PlatformAgentSessionRecord
|
|
223
|
+
snapshot: PlatformAgentRunSnapshot
|
|
224
|
+
/** Merged manifest + session policy when settlement paused on manual tools. */
|
|
225
|
+
effectiveToolPolicy?: PlatformAgentSessionToolPolicy
|
|
226
|
+
/** Unresolved tools that still need explicit user approval. */
|
|
227
|
+
manualPendingToolCalls: PlatformAgentUiToolCall[]
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export interface PlatformAgentLlmMenuOption {
|
|
231
|
+
value: string
|
|
232
|
+
label: string
|
|
233
|
+
contextWindowTokens?: number
|
|
234
|
+
supportsImageInput?: boolean
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export interface PlatformReadAgentLlmMenuOptionsRequest {
|
|
238
|
+
selectedModelId?: string
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export interface PlatformLocalModelRuntimeStatus {
|
|
242
|
+
ok: boolean
|
|
243
|
+
runtime: 'ollama'
|
|
244
|
+
error?: string
|
|
245
|
+
loaded: ReadonlyArray<{
|
|
246
|
+
name: string
|
|
247
|
+
size: number
|
|
248
|
+
processor?: string
|
|
249
|
+
context?: number
|
|
250
|
+
until?: string
|
|
251
|
+
}>
|
|
252
|
+
installed: readonly string[]
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/** Materialize a run for an existing session and send the first message. */
|
|
256
|
+
export interface PlatformStartAgentRunRequest {
|
|
257
|
+
session: PlatformReadAgentSessionRequest
|
|
258
|
+
message: string
|
|
259
|
+
contentParts?: PlatformAgentMessageContentPart[]
|
|
260
|
+
/** Image attachments for the initial user message (vision input). */
|
|
261
|
+
images?: PlatformAgentImageBlock[]
|
|
262
|
+
attachments?: PlatformAgentMessageAttachment[]
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export interface PlatformCallAgentModelRequest {
|
|
266
|
+
runId: string
|
|
267
|
+
sessionId: string
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* Route policy-approved pending tool calls to their registered app tabs and
|
|
272
|
+
* resolve them. Tools still pending afterwards require user approval.
|
|
273
|
+
*/
|
|
274
|
+
export interface PlatformResolveAgentToolCallsRequest {
|
|
275
|
+
runId: string
|
|
276
|
+
session: PlatformReadAgentSessionRequest
|
|
277
|
+
resolutions?: PlatformToolResolution | PlatformToolResolution[]
|
|
278
|
+
toolCallIds?: string[]
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export type PlatformToolResolution =
|
|
282
|
+
| { action: 'approve' }
|
|
283
|
+
| { action: 'reject'; reason?: string }
|
|
284
|
+
| { action: 'edit'; content: string }
|
|
285
|
+
|
|
286
|
+
export interface PlatformSendAgentRunMessageRequest {
|
|
287
|
+
runId: string
|
|
288
|
+
message: string
|
|
289
|
+
attachments?: PlatformAgentMessageAttachment[]
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export interface PlatformReadAgentRunContextRequest {
|
|
293
|
+
runId: string
|
|
294
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
PlatformAgentLlmMenuOption,
|
|
3
|
+
PlatformAgentRunContext,
|
|
4
|
+
PlatformAgentRunEvent,
|
|
5
|
+
PlatformAgentRunSnapshot,
|
|
6
|
+
PlatformApproveAgentSessionToolsRequest,
|
|
7
|
+
PlatformAgentSessionDriveRequest,
|
|
8
|
+
PlatformAgentSessionDriveResult,
|
|
9
|
+
PlatformCallAgentModelRequest,
|
|
10
|
+
PlatformInterruptAgentSessionRequest,
|
|
11
|
+
PlatformLocalModelRuntimeStatus,
|
|
12
|
+
PlatformReadAgentLlmMenuOptionsRequest,
|
|
13
|
+
PlatformReadAgentRunContextRequest,
|
|
14
|
+
PlatformRejectAgentSessionToolsRequest,
|
|
15
|
+
PlatformResolveAgentToolCallsRequest,
|
|
16
|
+
PlatformSendAgentRunMessageRequest,
|
|
17
|
+
PlatformSendAgentSessionMessageRequest,
|
|
18
|
+
PlatformStartAgentRunRequest,
|
|
19
|
+
PlatformAgentSessionRecord,
|
|
20
|
+
PlatformAgentSessionSummary,
|
|
21
|
+
PlatformCreateAgentSessionRequest,
|
|
22
|
+
PlatformListAgentSessionsRequest,
|
|
23
|
+
PlatformReadAgentSessionRequest,
|
|
24
|
+
PlatformUpdateAgentSessionRequest,
|
|
25
|
+
} from './agentTypes.js'
|
|
26
|
+
|
|
27
|
+
export function createAgentSession(
|
|
28
|
+
request: PlatformCreateAgentSessionRequest,
|
|
29
|
+
): Promise<PlatformAgentSessionRecord>
|
|
30
|
+
|
|
31
|
+
export function listAgentSessions(
|
|
32
|
+
request: PlatformListAgentSessionsRequest,
|
|
33
|
+
): Promise<PlatformAgentSessionSummary[]>
|
|
34
|
+
|
|
35
|
+
export function readAgentSession(
|
|
36
|
+
request: PlatformReadAgentSessionRequest,
|
|
37
|
+
): Promise<PlatformAgentSessionRecord>
|
|
38
|
+
|
|
39
|
+
export function updateAgentSession(
|
|
40
|
+
request: PlatformUpdateAgentSessionRequest,
|
|
41
|
+
): Promise<PlatformAgentSessionRecord>
|
|
42
|
+
|
|
43
|
+
export function deleteAgentSession(
|
|
44
|
+
request: PlatformReadAgentSessionRequest,
|
|
45
|
+
): Promise<void>
|
|
46
|
+
|
|
47
|
+
export function sendAgentSessionMessage(
|
|
48
|
+
request: PlatformSendAgentSessionMessageRequest,
|
|
49
|
+
): Promise<PlatformAgentSessionDriveResult>
|
|
50
|
+
|
|
51
|
+
export function approveAgentSessionTools(
|
|
52
|
+
request: PlatformApproveAgentSessionToolsRequest,
|
|
53
|
+
): Promise<PlatformAgentSessionDriveResult | null>
|
|
54
|
+
|
|
55
|
+
export function rejectAgentSessionTools(
|
|
56
|
+
request: PlatformRejectAgentSessionToolsRequest,
|
|
57
|
+
): Promise<PlatformAgentSessionDriveResult | null>
|
|
58
|
+
|
|
59
|
+
export function advanceAgentSessionPending(
|
|
60
|
+
request: PlatformAgentSessionDriveRequest,
|
|
61
|
+
): Promise<PlatformAgentSessionDriveResult | null>
|
|
62
|
+
|
|
63
|
+
export function interruptAgentSession(
|
|
64
|
+
request: PlatformInterruptAgentSessionRequest,
|
|
65
|
+
): Promise<PlatformAgentSessionDriveResult>
|
|
66
|
+
|
|
67
|
+
export function onAgentRunEvent(
|
|
68
|
+
listener: (payload: PlatformAgentRunEvent) => void,
|
|
69
|
+
): () => void
|
|
70
|
+
|
|
71
|
+
export function startAgentRun(
|
|
72
|
+
request: PlatformStartAgentRunRequest,
|
|
73
|
+
): Promise<PlatformAgentRunSnapshot>
|
|
74
|
+
|
|
75
|
+
export function callAgentRunModel(
|
|
76
|
+
request: PlatformCallAgentModelRequest,
|
|
77
|
+
): Promise<PlatformAgentRunSnapshot>
|
|
78
|
+
|
|
79
|
+
export function resolveAgentRunToolCalls(
|
|
80
|
+
request: PlatformResolveAgentToolCallsRequest,
|
|
81
|
+
): Promise<PlatformAgentRunSnapshot>
|
|
82
|
+
|
|
83
|
+
export function sendAgentRunMessage(
|
|
84
|
+
request: PlatformSendAgentRunMessageRequest,
|
|
85
|
+
): Promise<PlatformAgentRunSnapshot>
|
|
86
|
+
|
|
87
|
+
export function readAgentRunContext(
|
|
88
|
+
request: PlatformReadAgentRunContextRequest,
|
|
89
|
+
): Promise<PlatformAgentRunContext>
|
|
90
|
+
|
|
91
|
+
export function readAgentLlmMenuOptions(
|
|
92
|
+
request?: PlatformReadAgentLlmMenuOptionsRequest,
|
|
93
|
+
): Promise<PlatformAgentLlmMenuOption[]>
|
|
94
|
+
|
|
95
|
+
export function readLocalModelsStatus(): Promise<PlatformLocalModelRuntimeStatus>
|
|
96
|
+
|
|
97
|
+
export function registerAgentTools(request: {
|
|
98
|
+
tools: string[]
|
|
99
|
+
}): Promise<{ ok: boolean; tools: string[] }>
|
|
100
|
+
|
|
101
|
+
export function onAgentToolInvoke(
|
|
102
|
+
handler: (payload: {
|
|
103
|
+
invokeId: string
|
|
104
|
+
toolCallId: string
|
|
105
|
+
name: string
|
|
106
|
+
shortName: string
|
|
107
|
+
arguments: Record<string, unknown>
|
|
108
|
+
}) => Promise<{
|
|
109
|
+
toolCallId: string
|
|
110
|
+
content: string
|
|
111
|
+
isError?: boolean
|
|
112
|
+
}>,
|
|
113
|
+
): () => void
|