@marinoscar/vault-web 0.0.0-bootstrap → 0.1.0-next.3
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/CHANGELOG.md +32 -0
- package/LICENSE +21 -0
- package/README.md +99 -0
- package/dist/agent/headless/agentActivity.d.ts +53 -0
- package/dist/agent/headless/agentActivity.js +58 -0
- package/dist/agent/headless/index.d.ts +2 -0
- package/dist/agent/headless/index.js +3 -0
- package/dist/agent/headless/useAgentActivity.d.ts +9 -0
- package/dist/agent/headless/useAgentActivity.js +30 -0
- package/dist/agent/ui/components/AgentActivityTable.d.ts +25 -0
- package/dist/agent/ui/components/AgentActivityTable.js +114 -0
- package/dist/agent/ui/index.d.ts +3 -0
- package/dist/agent/ui/index.js +4 -0
- package/dist/agent/ui/pages/AgentAccessSettingsPage.d.ts +7 -0
- package/dist/agent/ui/pages/AgentAccessSettingsPage.js +70 -0
- package/dist/agent/ui/pages/AgentActivityPage.d.ts +6 -0
- package/dist/agent/ui/pages/AgentActivityPage.js +61 -0
- package/dist/backups/headless/backupContents.d.ts +69 -0
- package/dist/backups/headless/backupContents.js +133 -0
- package/dist/backups/headless/backupPassword.d.ts +34 -0
- package/dist/backups/headless/backupPassword.js +80 -0
- package/dist/backups/headless/backupSchedule.d.ts +56 -0
- package/dist/backups/headless/backupSchedule.js +189 -0
- package/dist/backups/headless/index.d.ts +4 -0
- package/dist/backups/headless/index.js +5 -0
- package/dist/backups/headless/useBackupRunHistory.d.ts +36 -0
- package/dist/backups/headless/useBackupRunHistory.js +83 -0
- package/dist/backups/ui/components/AdminBackupDownloadDialog.d.ts +20 -0
- package/dist/backups/ui/components/AdminBackupDownloadDialog.js +65 -0
- package/dist/backups/ui/components/BackupContentsGroup.d.ts +17 -0
- package/dist/backups/ui/components/BackupContentsGroup.js +21 -0
- package/dist/backups/ui/components/BackupPasswordFields.d.ts +18 -0
- package/dist/backups/ui/components/BackupPasswordFields.js +40 -0
- package/dist/backups/ui/components/BackupRunsTable.d.ts +44 -0
- package/dist/backups/ui/components/BackupRunsTable.js +61 -0
- package/dist/backups/ui/components/DataBackup.d.ts +14 -0
- package/dist/backups/ui/components/DataBackup.js +169 -0
- package/dist/backups/ui/components/ScheduledBackups.d.ts +13 -0
- package/dist/backups/ui/components/ScheduledBackups.js +304 -0
- package/dist/backups/ui/index.d.ts +8 -0
- package/dist/backups/ui/index.js +9 -0
- package/dist/backups/ui/pages/BackupSettingsPage.d.ts +8 -0
- package/dist/backups/ui/pages/BackupSettingsPage.js +19 -0
- package/dist/backups/ui/pages/MyBackupsPage.d.ts +8 -0
- package/dist/backups/ui/pages/MyBackupsPage.js +19 -0
- package/dist/brand/BrandLockup.d.ts +14 -0
- package/dist/brand/BrandLockup.js +13 -0
- package/dist/brand/assets/vault-mark.png +0 -0
- package/dist/brand/contrast.d.ts +8 -0
- package/dist/brand/contrast.js +21 -0
- package/dist/brand/index.d.ts +7 -0
- package/dist/brand/index.js +8 -0
- package/dist/brand/mark.d.ts +6 -0
- package/dist/brand/mark.js +7 -0
- package/dist/brand/theme.d.ts +25 -0
- package/dist/brand/theme.js +84 -0
- package/dist/brand/tokens.d.ts +52 -0
- package/dist/brand/tokens.js +54 -0
- package/dist/cards/headless/cardExpiry.d.ts +57 -0
- package/dist/cards/headless/cardExpiry.js +138 -0
- package/dist/cards/headless/cardFormat.d.ts +60 -0
- package/dist/cards/headless/cardFormat.js +135 -0
- package/dist/cards/headless/cardImage.d.ts +293 -0
- package/dist/cards/headless/cardImage.js +518 -0
- package/dist/cards/headless/index.d.ts +6 -0
- package/dist/cards/headless/index.js +7 -0
- package/dist/cards/headless/useCardImport.d.ts +137 -0
- package/dist/cards/headless/useCardImport.js +391 -0
- package/dist/cards/headless/useCardRenewal.d.ts +102 -0
- package/dist/cards/headless/useCardRenewal.js +305 -0
- package/dist/cards/headless/useCards.d.ts +80 -0
- package/dist/cards/headless/useCards.js +114 -0
- package/dist/cards/ui/components/AiEgressNotice.d.ts +13 -0
- package/dist/cards/ui/components/AiEgressNotice.js +18 -0
- package/dist/cards/ui/components/CardCaptureStep.d.ts +59 -0
- package/dist/cards/ui/components/CardCaptureStep.js +96 -0
- package/dist/cards/ui/components/CardCropAdjuster.d.ts +43 -0
- package/dist/cards/ui/components/CardCropAdjuster.js +215 -0
- package/dist/cards/ui/components/CardCropReview.d.ts +51 -0
- package/dist/cards/ui/components/CardCropReview.js +88 -0
- package/dist/cards/ui/components/CardExpiryBadge.d.ts +8 -0
- package/dist/cards/ui/components/CardExpiryBadge.js +43 -0
- package/dist/cards/ui/components/CardFieldDiff.d.ts +37 -0
- package/dist/cards/ui/components/CardFieldDiff.js +66 -0
- package/dist/cards/ui/components/CardFlowStepper.d.ts +24 -0
- package/dist/cards/ui/components/CardFlowStepper.js +23 -0
- package/dist/cards/ui/components/CardReviewForm.d.ts +44 -0
- package/dist/cards/ui/components/CardReviewForm.js +102 -0
- package/dist/cards/ui/components/CardScanModelSection.d.ts +23 -0
- package/dist/cards/ui/components/CardScanModelSection.js +81 -0
- package/dist/cards/ui/components/CardTile.d.ts +40 -0
- package/dist/cards/ui/components/CardTile.js +94 -0
- package/dist/cards/ui/index.d.ts +15 -0
- package/dist/cards/ui/index.js +16 -0
- package/dist/cards/ui/pages/AiSettingsPage.d.ts +12 -0
- package/dist/cards/ui/pages/AiSettingsPage.js +24 -0
- package/dist/cards/ui/pages/CardsPage.d.ts +26 -0
- package/dist/cards/ui/pages/CardsPage.js +160 -0
- package/dist/cards/ui/pages/ImportCardPage.d.ts +24 -0
- package/dist/cards/ui/pages/ImportCardPage.js +343 -0
- package/dist/cards/ui/pages/RenewCardPage.d.ts +35 -0
- package/dist/cards/ui/pages/RenewCardPage.js +350 -0
- package/dist/core/headless/api.d.ts +272 -0
- package/dist/core/headless/api.js +425 -0
- package/dist/core/headless/cardScanAvailability.d.ts +20 -0
- package/dist/core/headless/cardScanAvailability.js +27 -0
- package/dist/core/headless/clipboard.d.ts +60 -0
- package/dist/core/headless/clipboard.js +101 -0
- package/dist/core/headless/http.d.ts +41 -0
- package/dist/core/headless/http.js +50 -0
- package/dist/core/headless/index.d.ts +12 -0
- package/dist/core/headless/index.js +13 -0
- package/dist/core/headless/relativeTime.d.ts +7 -0
- package/dist/core/headless/relativeTime.js +28 -0
- package/dist/core/headless/saveBlob.d.ts +6 -0
- package/dist/core/headless/saveBlob.js +21 -0
- package/dist/core/headless/types.d.ts +441 -0
- package/dist/core/headless/types.js +49 -0
- package/dist/core/headless/useAiStatus.d.ts +41 -0
- package/dist/core/headless/useAiStatus.js +42 -0
- package/dist/core/headless/useCopyToClipboard.d.ts +20 -0
- package/dist/core/headless/useCopyToClipboard.js +52 -0
- package/dist/core/headless/useDashboardResource.d.ts +22 -0
- package/dist/core/headless/useDashboardResource.js +52 -0
- package/dist/core/headless/useSystemSettings.d.ts +17 -0
- package/dist/core/headless/useSystemSettings.js +106 -0
- package/dist/core/headless/useUserSettings.d.ts +13 -0
- package/dist/core/headless/useUserSettings.js +103 -0
- package/dist/core/ui/ErrorBoundary.d.ts +15 -0
- package/dist/core/ui/ErrorBoundary.js +27 -0
- package/dist/core/ui/LoadingSpinner.d.ts +6 -0
- package/dist/core/ui/LoadingSpinner.js +14 -0
- package/dist/core/ui/SettingsPageFrame.d.ts +19 -0
- package/dist/core/ui/SettingsPageFrame.js +12 -0
- package/dist/core/ui/StorageSettingsLink.d.ts +19 -0
- package/dist/core/ui/StorageSettingsLink.js +26 -0
- package/dist/core/ui/index.d.ts +4 -0
- package/dist/core/ui/index.js +5 -0
- package/dist/home/headless/homeLinks.d.ts +24 -0
- package/dist/home/headless/homeLinks.js +24 -0
- package/dist/home/headless/index.d.ts +1 -0
- package/dist/home/headless/index.js +2 -0
- package/dist/home/ui/components/BackupStatusPanel.d.ts +28 -0
- package/dist/home/ui/components/BackupStatusPanel.js +99 -0
- package/dist/home/ui/components/DashboardPanel.d.ts +33 -0
- package/dist/home/ui/components/DashboardPanel.js +21 -0
- package/dist/home/ui/components/ExpiringCardsPanel.d.ts +31 -0
- package/dist/home/ui/components/ExpiringCardsPanel.js +35 -0
- package/dist/home/ui/components/FirstRunPanel.d.ts +7 -0
- package/dist/home/ui/components/FirstRunPanel.js +21 -0
- package/dist/home/ui/components/QuickActions.d.ts +14 -0
- package/dist/home/ui/components/QuickActions.js +40 -0
- package/dist/home/ui/components/RecentSecretsPanel.d.ts +19 -0
- package/dist/home/ui/components/RecentSecretsPanel.js +20 -0
- package/dist/home/ui/components/StatsRow.d.ts +19 -0
- package/dist/home/ui/components/StatsRow.js +46 -0
- package/dist/home/ui/components/WelcomeHeader.d.ts +11 -0
- package/dist/home/ui/components/WelcomeHeader.js +15 -0
- package/dist/home/ui/index.d.ts +9 -0
- package/dist/home/ui/index.js +10 -0
- package/dist/home/ui/pages/HomePage.d.ts +14 -0
- package/dist/home/ui/pages/HomePage.js +121 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/media/headless/index.d.ts +2 -0
- package/dist/media/headless/index.js +3 -0
- package/dist/media/headless/useMediaFiles.d.ts +20 -0
- package/dist/media/headless/useMediaFiles.js +82 -0
- package/dist/media/headless/useMediaFolders.d.ts +22 -0
- package/dist/media/headless/useMediaFolders.js +81 -0
- package/dist/media/ui/components/FolderList.d.ts +19 -0
- package/dist/media/ui/components/FolderList.js +36 -0
- package/dist/media/ui/components/MediaList.d.ts +20 -0
- package/dist/media/ui/components/MediaList.js +55 -0
- package/dist/media/ui/components/MediaPlayer.d.ts +7 -0
- package/dist/media/ui/components/MediaPlayer.js +361 -0
- package/dist/media/ui/index.d.ts +10 -0
- package/dist/media/ui/index.js +11 -0
- package/dist/media/ui/pages/CreateFolderPage.d.ts +1 -0
- package/dist/media/ui/pages/CreateFolderPage.js +39 -0
- package/dist/media/ui/pages/EditFolderPage.d.ts +1 -0
- package/dist/media/ui/pages/EditFolderPage.js +59 -0
- package/dist/media/ui/pages/MediaFolderPage.d.ts +1 -0
- package/dist/media/ui/pages/MediaFolderPage.js +68 -0
- package/dist/media/ui/pages/MediaFoldersPage.d.ts +1 -0
- package/dist/media/ui/pages/MediaFoldersPage.js +58 -0
- package/dist/media/ui/pages/MediaPlayerPage.d.ts +1 -0
- package/dist/media/ui/pages/MediaPlayerPage.js +76 -0
- package/dist/media/ui/pages/MediaUploadPage.d.ts +1 -0
- package/dist/media/ui/pages/MediaUploadPage.js +88 -0
- package/dist/media/ui/pages/RenameMediaFilePage.d.ts +1 -0
- package/dist/media/ui/pages/RenameMediaFilePage.js +63 -0
- package/dist/navigation/destinations.d.ts +50 -0
- package/dist/navigation/destinations.js +109 -0
- package/dist/navigation/index.d.ts +1 -0
- package/dist/navigation/index.js +4 -0
- package/dist/secrets/headless/fieldOptionsValidation.d.ts +45 -0
- package/dist/secrets/headless/fieldOptionsValidation.js +79 -0
- package/dist/secrets/headless/index.d.ts +6 -0
- package/dist/secrets/headless/index.js +7 -0
- package/dist/secrets/headless/secretFields.d.ts +86 -0
- package/dist/secrets/headless/secretFields.js +190 -0
- package/dist/secrets/headless/useSecretDetail.d.ts +33 -0
- package/dist/secrets/headless/useSecretDetail.js +87 -0
- package/dist/secrets/headless/useSecretTypes.d.ts +16 -0
- package/dist/secrets/headless/useSecretTypes.js +62 -0
- package/dist/secrets/headless/useSecrets.d.ts +24 -0
- package/dist/secrets/headless/useSecrets.js +59 -0
- package/dist/secrets/headless/useTotpCode.d.ts +24 -0
- package/dist/secrets/headless/useTotpCode.js +116 -0
- package/dist/secrets/ui/components/CardImages.d.ts +31 -0
- package/dist/secrets/ui/components/CardImages.js +208 -0
- package/dist/secrets/ui/components/DynamicSecretFields.d.ts +10 -0
- package/dist/secrets/ui/components/DynamicSecretFields.js +90 -0
- package/dist/secrets/ui/components/FieldDefinitionBuilder.d.ts +13 -0
- package/dist/secrets/ui/components/FieldDefinitionBuilder.js +114 -0
- package/dist/secrets/ui/components/FieldOptionsEditor.d.ts +15 -0
- package/dist/secrets/ui/components/FieldOptionsEditor.js +45 -0
- package/dist/secrets/ui/components/SecretAttachments.d.ts +15 -0
- package/dist/secrets/ui/components/SecretAttachments.js +106 -0
- package/dist/secrets/ui/components/SecretForm.d.ts +34 -0
- package/dist/secrets/ui/components/SecretForm.js +83 -0
- package/dist/secrets/ui/components/SecretFormDialog.d.ts +15 -0
- package/dist/secrets/ui/components/SecretFormDialog.js +95 -0
- package/dist/secrets/ui/components/SecretTypeFormDialog.d.ts +15 -0
- package/dist/secrets/ui/components/SecretTypeFormDialog.js +92 -0
- package/dist/secrets/ui/components/SecretTypeIcon.d.ts +8 -0
- package/dist/secrets/ui/components/SecretTypeIcon.js +16 -0
- package/dist/secrets/ui/components/SecretTypesList.d.ts +10 -0
- package/dist/secrets/ui/components/SecretTypesList.js +13 -0
- package/dist/secrets/ui/components/SecretValueField.d.ts +20 -0
- package/dist/secrets/ui/components/SecretValueField.js +52 -0
- package/dist/secrets/ui/components/SecretVersionDrawer.d.ts +22 -0
- package/dist/secrets/ui/components/SecretVersionDrawer.js +131 -0
- package/dist/secrets/ui/components/SecretsTable.d.ts +49 -0
- package/dist/secrets/ui/components/SecretsTable.js +174 -0
- package/dist/secrets/ui/components/TotpCodeCard.d.ts +8 -0
- package/dist/secrets/ui/components/TotpCodeCard.js +34 -0
- package/dist/secrets/ui/index.d.ts +20 -0
- package/dist/secrets/ui/index.js +21 -0
- package/dist/secrets/ui/pages/CreateSecretPage.d.ts +2 -0
- package/dist/secrets/ui/pages/CreateSecretPage.js +25 -0
- package/dist/secrets/ui/pages/CreateSecretTypePage.d.ts +1 -0
- package/dist/secrets/ui/pages/CreateSecretTypePage.js +62 -0
- package/dist/secrets/ui/pages/EditSecretPage.d.ts +5 -0
- package/dist/secrets/ui/pages/EditSecretPage.js +55 -0
- package/dist/secrets/ui/pages/EditSecretTypePage.d.ts +1 -0
- package/dist/secrets/ui/pages/EditSecretTypePage.js +88 -0
- package/dist/secrets/ui/pages/SecretDetailPage.d.ts +7 -0
- package/dist/secrets/ui/pages/SecretDetailPage.js +182 -0
- package/dist/secrets/ui/pages/SecretTypesPage.d.ts +1 -0
- package/dist/secrets/ui/pages/SecretTypesPage.js +23 -0
- package/dist/secrets/ui/pages/SecretsPage.d.ts +6 -0
- package/dist/secrets/ui/pages/SecretsPage.js +179 -0
- package/dist/settings/ui/components/FeatureFlagsList.d.ts +7 -0
- package/dist/settings/ui/components/FeatureFlagsList.js +46 -0
- package/dist/settings/ui/components/ImageUpload.d.ts +6 -0
- package/dist/settings/ui/components/ImageUpload.js +61 -0
- package/dist/settings/ui/components/ProfileSettings.d.ts +11 -0
- package/dist/settings/ui/components/ProfileSettings.js +55 -0
- package/dist/settings/ui/components/ThemeSettings.d.ts +7 -0
- package/dist/settings/ui/components/ThemeSettings.js +24 -0
- package/dist/settings/ui/components/UISettings.d.ts +9 -0
- package/dist/settings/ui/components/UISettings.js +25 -0
- package/dist/settings/ui/components/UserProfileCard.d.ts +1 -0
- package/dist/settings/ui/components/UserProfileCard.js +39 -0
- package/dist/settings/ui/components/UserSettingsSection.d.ts +23 -0
- package/dist/settings/ui/components/UserSettingsSection.js +29 -0
- package/dist/settings/ui/index.d.ts +10 -0
- package/dist/settings/ui/index.js +11 -0
- package/dist/settings/ui/pages/AppearanceSettingsPage.d.ts +6 -0
- package/dist/settings/ui/pages/AppearanceSettingsPage.js +11 -0
- package/dist/settings/ui/pages/GeneralSettingsPage.d.ts +9 -0
- package/dist/settings/ui/pages/GeneralSettingsPage.js +41 -0
- package/dist/settings/ui/pages/ProfileSettingsPage.d.ts +6 -0
- package/dist/settings/ui/pages/ProfileSettingsPage.js +11 -0
- package/package.json +146 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# @marinoscar/vault-web
|
|
2
|
+
|
|
3
|
+
## 0.1.0-next.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- d16fe7b: The package READMEs say how to install from npm (the `next` dist-tag, the peers, provenance) for the first published release (#192). No code change.
|
|
8
|
+
|
|
9
|
+
## 0.1.0-next.2
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 14f844c: Add the `agent` slice (`@marinoscar/vault-web/agent/headless` and `/agent/ui`): the per-user `AgentActivityPage` (what apps did with your logins, filterable, with a link to Connected apps) and the admin `AgentAccessSettingsPage` (the agent API's kill switch and per-minute limits). `SystemSettings` carries `agentAccess`.
|
|
14
|
+
- 60b975f: Add per-secret agent access to the secrets UI: an "Allow agents to use this login" switch on the Credential detail page, an "Agents" chip in the list and an "Agent access" filter (`?agent=fill|none`). `SecretListItem` carries `agentAccess` and `agentAccessChangedAt`; new `updateSecretAgentAccess` client and `useSecretDetail().setAgentAccess`.
|
|
15
|
+
- d85c2f9: Add authenticator codes (TOTP) to Credential secrets: the form validates a pasted `otpauth://` link or base32 key (and shows the API's field error), and the detail page has an "Authenticator code" card that fetches the code on demand (`POST /secrets/:id/totp`), shows it grouped with a countdown ring and a copy button, and refreshes it on expiry. New `getSecretTotp`, `useTotpCode`, `groupTotpCode`, `TotpCodeCard`, `TOTP_FIELD_NAME`, `fieldErrorsFromApiError`.
|
|
16
|
+
- 2318f0a: Card scanning availability now comes from the platform's `GET /api/ai/config` instead of the removed `GET /api/ai/status` alias. `useAiStatus` reads it through `useAiConfig` of `@marinoscar/platform-web/ai/headless` (the host's shared copy when one is mounted) and applies the new pure helper `isCardScanAvailable(config)`, the same rule as the API. Its result keeps `cardExtractEnabled`, `canUseAi`, `isLoading`, `error` and `refresh`; `status` is replaced by `config` (the platform's `AiPublicConfig`). Breaking: the exported `getAiStatus` and the `AiStatus` type are removed.
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- 92dae83: vault-api: the `agent` OAuth protected resource (`/api/agent/v1`) with the scopes `vault:items_read`, `vault:items_fill` and `vault:items_write` (`registerVaultAgentOAuth`, `./agent` export), the `secrets:fill` permission and `GET /api/agent/v1/whoami`. vault-web: `/oauth/consent` and `/oauth/error` are unowned routes.
|
|
21
|
+
- 1934687: Require `@marinoscar/platform-api`, `@marinoscar/platform-contract` and `@marinoscar/platform-web` `0.1.0-next.37` (peer and dev dependencies). No API change in the Vault packages.
|
|
22
|
+
- 7bb426b: The Secrets list's table layout no longer expects a host `DataTablePreferencesProvider`: without one it takes the platform datatable's default port, the `dataTables` namespace of `/api/user-settings` over the host's client (#153). Docs and the test harness follow; no runtime change for a host that still mounts a provider.
|
|
23
|
+
|
|
24
|
+
## 0.1.0-next.1
|
|
25
|
+
|
|
26
|
+
### Minor Changes
|
|
27
|
+
|
|
28
|
+
- 1486f4f: Add `@marinoscar/vault-web`: the Vault domain pages, components, hooks, navigation destinations and brand, moved out of `apps/web` (E12.3, #104).
|
|
29
|
+
|
|
30
|
+
## 0.1.0-next.0
|
|
31
|
+
|
|
32
|
+
- Initial version (E12.3, issue 104). The domain pages, components and hooks, the navigation destinations and the brand moved out of `apps/web` without a visual or behaviour change; see the README.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Oscar Marin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# @marinoscar/vault-web
|
|
2
|
+
|
|
3
|
+
The React side of the Vault domain: the pages, components and hooks of secrets, secret types, payment cards, media folders, backups and Home, Vault's own settings card pages, the navigation destinations and the brand (tokens, themes, mark). ESM only, `sideEffects: false`, one subpath per slice. `apps/web` is the host: it routes to these pages, mounts the providers and binds the platform ([ADR-0001](../../docs/decisions/0001-packages-first.md)).
|
|
4
|
+
|
|
5
|
+
## Purpose and scope
|
|
6
|
+
|
|
7
|
+
The package holds the domain's user interface written once, so a second host (a desktop edition, a kiosk build) mounts the same pages instead of copying them. It does not hold the shell, the routes, the settings registries or hubs, the identity, AI, telemetry, notification or database-backup bindings, the service worker or the Vite configuration: those are the host's. Platform slices (`DataTable`, `SettingsHub`, identity guards, the AI config page) come from `@marinoscar/platform-web`, never copied here.
|
|
8
|
+
|
|
9
|
+
Status: experimental. Introduced in E12.3 (issue 104) by moving the domain code out of `apps/web/src` with no visual or behaviour change (the visual baselines are unchanged); `apps/web` imports it from these subpaths.
|
|
10
|
+
|
|
11
|
+
Entry points (`<slice>/headless` holds hooks, calls and helpers; `<slice>/ui` holds components and pages; pages are named exports, `SecretsPage` and so on):
|
|
12
|
+
|
|
13
|
+
- `@marinoscar/vault-web`: the root, `VAULT_WEB_PACKAGE` only.
|
|
14
|
+
- `@marinoscar/vault-web/core/headless`: `configureVaultWeb` (the HTTP port), the domain calls (`getSecrets`, `getBackupSchedule`, ...), the wire types, `useCopyToClipboard`, `useDashboardResource`, `useAiStatus` (card scanning from the platform's `GET /api/ai/config`) with its pure rule `isCardScanAvailable`, `useSystemSettings`, `useUserSettings`, `saveBlobAsFile`, `formatRelativeTime`.
|
|
15
|
+
- `@marinoscar/vault-web/core/ui`: `LoadingSpinner`, `ErrorBoundary`, `SettingsPageFrame`, `StorageSettingsLink`.
|
|
16
|
+
- `@marinoscar/vault-web/secrets/headless`, `@marinoscar/vault-web/secrets/ui`: secrets and secret types (list, detail, create, edit, versions, attachments, the type builder and its pages).
|
|
17
|
+
- `@marinoscar/vault-web/cards/headless`, `@marinoscar/vault-web/cards/ui`: payment cards (Cards, scan import, renewal, the card-scanning model section and the AI settings page that carries it).
|
|
18
|
+
- `@marinoscar/vault-web/media/headless`, `@marinoscar/vault-web/media/ui`: media folders and files.
|
|
19
|
+
- `@marinoscar/vault-web/backups/headless`, `@marinoscar/vault-web/backups/ui`: scheduled (admin) and personal backups, the My backups and Backups settings pages.
|
|
20
|
+
- `@marinoscar/vault-web/agent/headless`: `getAgentActivity` (the caller's agent activity, `GET /api/agent-activity`), `useAgentActivity`, the `AgentActivityItem` type (local to the package until the contract type is imported), the query and page types, `AGENT_ACTIVITY_ACTIONS`, `AGENT_ACTION_LABELS`, `agentAppLabel`. The `AgentAccessSettings` type and `AGENT_ACCESS_DEFAULTS` live in `core/headless`, not here.
|
|
21
|
+
- `@marinoscar/vault-web/agent/ui`: `AgentActivityPage` (route `/settings/agent-activity`, card permission `secrets:read`), `AgentActivityTable`, `AgentAccessSettingsPage` (route `/admin/settings/agent-access`, card permission `system_settings:read`; saving needs `system_settings:write`; reads and writes the `agentAccess` system-settings namespace).
|
|
22
|
+
- `@marinoscar/vault-web/home/headless`, `@marinoscar/vault-web/home/ui`: the Home dashboard.
|
|
23
|
+
- `@marinoscar/vault-web/settings/ui`: Vault's General, Profile and Appearance settings card pages.
|
|
24
|
+
- `@marinoscar/vault-web/brand`: `BRAND_TOKENS`, `PRODUCT_NAME`, `PRODUCT_TAGLINE`, `VAULT_THEMES`, `vaultLightTheme`, `vaultDarkTheme`, `contrastRatio`, `BrandLockup`, `VAULT_MARK_URL`.
|
|
25
|
+
- `@marinoscar/vault-web/brand/assets/vault-mark.png`: the mark image itself.
|
|
26
|
+
- `@marinoscar/vault-web/navigation`: `DESTINATIONS`, `DESTINATION_ROUTES`, `UNOWNED_ROUTES`, `owns`, `isDestinationVisible`.
|
|
27
|
+
|
|
28
|
+
## Install and peer dependencies
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install @marinoscar/vault-web@next @marinoscar/vault-contract@next
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Published to npm under the `next` dist-tag until 1.0, with a provenance attestation; the install, the dist-tag policy and the current publication status are in [docs/PACKAGES.md](../../docs/PACKAGES.md#installing-from-npm). npm 7 or later installs the peers below by itself; list them in the host's `package.json` to choose their versions. The package is ESM only.
|
|
35
|
+
|
|
36
|
+
Everything React and MUI is a peer, so the host keeps one copy of each (two Reacts or two MUI theme contexts break hooks and theming):
|
|
37
|
+
|
|
38
|
+
| Package | Range | Needed by |
|
|
39
|
+
|---|---|---|
|
|
40
|
+
| `react`, `react-dom` | `^19.2.7` | every slice |
|
|
41
|
+
| `react-router-dom` | `^7.17.0` | pages and navigation |
|
|
42
|
+
| `@mui/material`, `@mui/icons-material`, `@mui/utils` | `^9.1.0` / `^9.0.0` | every `ui` subpath and `brand` |
|
|
43
|
+
| `@marinoscar/platform-web` | the exact version in `peerDependencies` (the platform release the package is built against) | the shell, identity, data table, settings and AI pieces the pages use |
|
|
44
|
+
| `@marinoscar/vault-contract` | `>=0.0.0-0 \|\| >=0.1.0-0` | wire constants and types |
|
|
45
|
+
|
|
46
|
+
The host's bundler must understand an image import (Vite does): `BrandLockup` imports the PNG next to it.
|
|
47
|
+
|
|
48
|
+
## Quick start
|
|
49
|
+
|
|
50
|
+
```tsx
|
|
51
|
+
// The host, once, before the first render (apps/web/src/services/api.ts).
|
|
52
|
+
import { PlatformHttpClient } from '@marinoscar/platform-web/core';
|
|
53
|
+
import { configureVaultWeb } from '@marinoscar/vault-web/core/headless';
|
|
54
|
+
|
|
55
|
+
export const api = new PlatformHttpClient({ baseUrl: '/api', refreshLockName: 'vault-auth-refresh' });
|
|
56
|
+
configureVaultWeb({ http: api, apiBaseUrl: '/api' });
|
|
57
|
+
|
|
58
|
+
// A route (apps/web/src/App.tsx).
|
|
59
|
+
const SecretsPage = lazy(() => import('@marinoscar/vault-web/secrets/ui').then((m) => ({ default: m.SecretsPage })));
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
The pages expect what the host mounts above them: a router, `ShellRoot` with `VAULT_THEMES`, the platform identity `AuthProvider` (for `useAuth` / `usePermissions`), and a `PlatformHostProvider`. A `DataTablePreferencesProvider` is optional: without one the Secrets list uses the platform's default port, the `dataTables` namespace of `/api/user-settings` over the host's client.
|
|
63
|
+
|
|
64
|
+
## Configuration
|
|
65
|
+
|
|
66
|
+
`configureVaultWeb({ http, apiBaseUrl? })` is the only configuration. `http` is the host's `PlatformHttpClient` (the same instance the platform's `AuthProvider` drives, so the bearer token and the refresh are shared); `apiBaseUrl` (default `/api`) is read only by the two raw `fetch` calls that stream an attachment. A slice that calls the API before it is configured throws `VaultWebNotConfiguredError`. The package reads no environment or build-time variable.
|
|
67
|
+
|
|
68
|
+
## Extension-point catalog
|
|
69
|
+
|
|
70
|
+
| Extension point | Where | What a host varies |
|
|
71
|
+
|---|---|---|
|
|
72
|
+
| HTTP port | `configureVaultWeb` (`core/headless`) | the transport, base URL and refresh lock |
|
|
73
|
+
| Table layout store | the host's `DataTablePreferencesProvider`, else the platform default (`/user-settings`, `dataTables`) | where the Secrets list keeps its column, sort and page-size layout |
|
|
74
|
+
| Platform host | the host's `PlatformHostProvider` | the viewer, permissions and features the packaged platform pieces read |
|
|
75
|
+
| Theme | `VAULT_THEMES` passed to `ShellRoot` | the host may extend or replace the themes |
|
|
76
|
+
|
|
77
|
+
## Build and test
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
npm run build -w @marinoscar/vault-web # tsc (NodeNext) to dist/, then copies the brand image
|
|
81
|
+
npm run typecheck -w @marinoscar/vault-web # src and test (bundler resolution) plus the NodeNext build check
|
|
82
|
+
npm run test:run -w @marinoscar/vault-web # Vitest + React Testing Library + MSW, jsdom
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The suites render through `test/utils/test-utils.tsx`, which mounts what the host mounts without importing the host; `test/setup.ts` configures the HTTP port against the MSW handlers in `test/mocks/`.
|
|
86
|
+
|
|
87
|
+
## Security notes
|
|
88
|
+
|
|
89
|
+
- The browser never calls an AI provider: card scanning posts to `POST /api/secrets/cards/extract` and shows `AiEgressNotice`; the CVV is never sent, returned or seeded into the review form.
|
|
90
|
+
- Secret values come only from the detail view, are copied through `useCopyToClipboard` and are never written to `localStorage`, logs or error reports. Backup passwords live in component state only.
|
|
91
|
+
- The UI presents and the API authorizes: a hidden button is not a permission check.
|
|
92
|
+
|
|
93
|
+
## Links
|
|
94
|
+
|
|
95
|
+
- [ADR-0001, packages first](../../docs/decisions/0001-packages-first.md)
|
|
96
|
+
- [The Vault packages](../../docs/PACKAGES.md)
|
|
97
|
+
- [The host's rules](../../apps/web/AGENTS.md)
|
|
98
|
+
- [UX refresh spec](../../docs/specs/ux-refresh.md)
|
|
99
|
+
- [Changelog](CHANGELOG.md)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/** What an agent did: the audit actions of the agent credential API. */
|
|
2
|
+
export type AgentActivityAction = 'lookup' | 'fill' | 'totp' | 'create' | 'rotate' | 'agent_access';
|
|
3
|
+
/** The credential an agent call authenticated with. */
|
|
4
|
+
export type AgentCredentialKind = 'oauth' | 'pat' | 'session';
|
|
5
|
+
/**
|
|
6
|
+
* One row of `GET /api/agent-activity`. Never carries a value, code or seed: only who, what, where and why.
|
|
7
|
+
* (The contract type moves to `@marinoscar/vault-contract/agent` later; this is the same shape.)
|
|
8
|
+
*/
|
|
9
|
+
export interface AgentActivityItem {
|
|
10
|
+
id: string;
|
|
11
|
+
/** ISO timestamp. */
|
|
12
|
+
at: string;
|
|
13
|
+
action: AgentActivityAction;
|
|
14
|
+
result: 'ok' | 'denied';
|
|
15
|
+
/** The denial reason when `result` is `denied`. */
|
|
16
|
+
reason?: string;
|
|
17
|
+
secretId: string | null;
|
|
18
|
+
secretName: string | null;
|
|
19
|
+
/** The field name touched (never its value). */
|
|
20
|
+
field: string | null;
|
|
21
|
+
/** The website the agent was acting on. */
|
|
22
|
+
origin: string | null;
|
|
23
|
+
/** The agent's stated purpose. */
|
|
24
|
+
purpose: string | null;
|
|
25
|
+
credentialKind: AgentCredentialKind | null;
|
|
26
|
+
clientId: string | null;
|
|
27
|
+
clientName: string | null;
|
|
28
|
+
}
|
|
29
|
+
export declare const AGENT_ACTIVITY_ACTIONS: readonly AgentActivityAction[];
|
|
30
|
+
export declare const AGENT_ACTION_LABELS: Record<AgentActivityAction, string>;
|
|
31
|
+
export interface AgentActivityQuery {
|
|
32
|
+
/** 1-based. */
|
|
33
|
+
page?: number;
|
|
34
|
+
pageSize?: number;
|
|
35
|
+
action?: AgentActivityAction;
|
|
36
|
+
secretId?: string;
|
|
37
|
+
clientId?: string;
|
|
38
|
+
/** ISO. */
|
|
39
|
+
from?: string;
|
|
40
|
+
/** ISO. */
|
|
41
|
+
to?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface AgentActivityPage {
|
|
44
|
+
items: AgentActivityItem[];
|
|
45
|
+
total: number;
|
|
46
|
+
}
|
|
47
|
+
/** The name shown for the app behind a row. */
|
|
48
|
+
export declare function agentAppLabel(item: Pick<AgentActivityItem, 'clientName' | 'credentialKind'>): string;
|
|
49
|
+
/**
|
|
50
|
+
* One page of the caller's agent activity. Read through the raw body (the shared client drops
|
|
51
|
+
* `meta` when it unwraps `{ data }`), and tolerant of both list envelopes the API uses.
|
|
52
|
+
*/
|
|
53
|
+
export declare function getAgentActivity(query?: AgentActivityQuery): Promise<AgentActivityPage>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { api } from '../../core/headless/http.js';
|
|
2
|
+
export const AGENT_ACTIVITY_ACTIONS = [
|
|
3
|
+
'lookup',
|
|
4
|
+
'fill',
|
|
5
|
+
'totp',
|
|
6
|
+
'create',
|
|
7
|
+
'rotate',
|
|
8
|
+
'agent_access',
|
|
9
|
+
];
|
|
10
|
+
export const AGENT_ACTION_LABELS = {
|
|
11
|
+
lookup: 'Looked up',
|
|
12
|
+
fill: 'Filled',
|
|
13
|
+
totp: 'One-time code',
|
|
14
|
+
create: 'Created',
|
|
15
|
+
rotate: 'Rotated',
|
|
16
|
+
agent_access: 'Access changed',
|
|
17
|
+
};
|
|
18
|
+
/** The name shown for the app behind a row. */
|
|
19
|
+
export function agentAppLabel(item) {
|
|
20
|
+
if (item.clientName)
|
|
21
|
+
return item.clientName;
|
|
22
|
+
if (item.credentialKind === 'pat')
|
|
23
|
+
return 'Personal access token';
|
|
24
|
+
if (item.credentialKind === 'session')
|
|
25
|
+
return 'Vault session';
|
|
26
|
+
return 'Unknown app';
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* One page of the caller's agent activity. Read through the raw body (the shared client drops
|
|
30
|
+
* `meta` when it unwraps `{ data }`), and tolerant of both list envelopes the API uses.
|
|
31
|
+
*/
|
|
32
|
+
export async function getAgentActivity(query = {}) {
|
|
33
|
+
const params = new URLSearchParams();
|
|
34
|
+
if (query.page)
|
|
35
|
+
params.set('page', String(query.page));
|
|
36
|
+
if (query.pageSize)
|
|
37
|
+
params.set('pageSize', String(query.pageSize));
|
|
38
|
+
if (query.action)
|
|
39
|
+
params.set('action', query.action);
|
|
40
|
+
if (query.secretId)
|
|
41
|
+
params.set('secretId', query.secretId);
|
|
42
|
+
if (query.clientId)
|
|
43
|
+
params.set('clientId', query.clientId);
|
|
44
|
+
if (query.from)
|
|
45
|
+
params.set('from', query.from);
|
|
46
|
+
if (query.to)
|
|
47
|
+
params.set('to', query.to);
|
|
48
|
+
const qs = params.toString();
|
|
49
|
+
const { blob } = await api.get(`/agent-activity${qs ? `?${qs}` : ''}`, {
|
|
50
|
+
responseType: 'blobWithHeaders',
|
|
51
|
+
});
|
|
52
|
+
const body = JSON.parse(await blob.text());
|
|
53
|
+
const data = body.data;
|
|
54
|
+
const items = Array.isArray(data) ? data : (data?.items ?? []);
|
|
55
|
+
const meta = body.meta ?? (Array.isArray(data) ? undefined : data?.meta);
|
|
56
|
+
const total = meta?.total ?? meta?.totalItems ?? items.length;
|
|
57
|
+
return { items, total };
|
|
58
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type AgentActivityItem, type AgentActivityQuery } from './agentActivity.js';
|
|
2
|
+
export interface UseAgentActivityResult {
|
|
3
|
+
items: AgentActivityItem[];
|
|
4
|
+
total: number;
|
|
5
|
+
loading: boolean;
|
|
6
|
+
error: string | null;
|
|
7
|
+
}
|
|
8
|
+
/** Loads one page of agent activity whenever the query changes; only the latest request writes state. */
|
|
9
|
+
export declare function useAgentActivity(query: AgentActivityQuery): UseAgentActivityResult;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { getAgentActivity } from './agentActivity.js';
|
|
3
|
+
/** Loads one page of agent activity whenever the query changes; only the latest request writes state. */
|
|
4
|
+
export function useAgentActivity(query) {
|
|
5
|
+
const [state, setState] = useState({ items: [], total: 0, loading: true, error: null });
|
|
6
|
+
const key = JSON.stringify(query);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
let current = true;
|
|
9
|
+
setState((s) => ({ ...s, loading: true, error: null }));
|
|
10
|
+
getAgentActivity(JSON.parse(key))
|
|
11
|
+
.then((page) => {
|
|
12
|
+
if (current)
|
|
13
|
+
setState({ items: page.items, total: page.total, loading: false, error: null });
|
|
14
|
+
})
|
|
15
|
+
.catch((err) => {
|
|
16
|
+
if (current) {
|
|
17
|
+
setState({
|
|
18
|
+
items: [],
|
|
19
|
+
total: 0,
|
|
20
|
+
loading: false,
|
|
21
|
+
error: err instanceof Error ? err.message : 'Failed to load agent activity',
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
return () => {
|
|
26
|
+
current = false;
|
|
27
|
+
};
|
|
28
|
+
}, [key]);
|
|
29
|
+
return state;
|
|
30
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { DataTableRendererMode } from '@marinoscar/platform-web/datatable/headless';
|
|
2
|
+
import { type AgentActivityItem } from '../../headless/agentActivity.js';
|
|
3
|
+
export declare const AGENT_ACTIVITY_TABLE_ID = "agent-activity";
|
|
4
|
+
export declare const AGENT_ACTIVITY_PAGE_SIZES: number[];
|
|
5
|
+
export interface AgentActivityTableProps {
|
|
6
|
+
rows: AgentActivityItem[];
|
|
7
|
+
total: number;
|
|
8
|
+
/** 0-based, as the platform table counts. */
|
|
9
|
+
page: number;
|
|
10
|
+
pageSize: number;
|
|
11
|
+
loading: boolean;
|
|
12
|
+
error: string | null;
|
|
13
|
+
onPaginationChange: (next: {
|
|
14
|
+
page: number;
|
|
15
|
+
pageSize: number;
|
|
16
|
+
}) => void;
|
|
17
|
+
/** True when a filter is active, so the empty state says "no match". */
|
|
18
|
+
filtered?: boolean;
|
|
19
|
+
renderer?: DataTableRendererMode;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The agent activity list on the platform `DataTable`: a grid on desktop, cards on a phone (the
|
|
23
|
+
* table measures its own container). Server-paged; no value, code or seed is ever in a row.
|
|
24
|
+
*/
|
|
25
|
+
export declare function AgentActivityTable(props: AgentActivityTableProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext, useEffect, useState } from 'react';
|
|
3
|
+
import { Link as RouterLink } from 'react-router-dom';
|
|
4
|
+
import { Box, Chip, Link, Tooltip, Typography } from '@mui/material';
|
|
5
|
+
import { SmartToyOutlined as EmptyIcon } from '@mui/icons-material';
|
|
6
|
+
import { DataTable } from '@marinoscar/platform-web/datatable/ui';
|
|
7
|
+
import { AGENT_ACTION_LABELS, agentAppLabel, } from '../../headless/agentActivity.js';
|
|
8
|
+
export const AGENT_ACTIVITY_TABLE_ID = 'agent-activity';
|
|
9
|
+
export const AGENT_ACTIVITY_PAGE_SIZES = [10, 25, 50, 100];
|
|
10
|
+
const LayoutReport = createContext(null);
|
|
11
|
+
function LayoutProbe({ layout }) {
|
|
12
|
+
const report = useContext(LayoutReport);
|
|
13
|
+
useEffect(() => report?.(layout), [report, layout]);
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
const SLOTS = { Toolbar: LayoutProbe };
|
|
17
|
+
function Dash() {
|
|
18
|
+
return (_jsx(Typography, { variant: "body2", component: "span", sx: { color: 'text.disabled' }, "aria-label": "None", children: "\u2014" }));
|
|
19
|
+
}
|
|
20
|
+
function ResultChip({ row }) {
|
|
21
|
+
if (row.result === 'ok')
|
|
22
|
+
return _jsx(Chip, { size: "small", color: "success", variant: "outlined", label: "OK" });
|
|
23
|
+
const chip = _jsx(Chip, { size: "small", color: "error", variant: "outlined", label: "Denied" });
|
|
24
|
+
return row.reason ? (_jsx(Tooltip, { title: row.reason, children: _jsx("span", { tabIndex: 0, "aria-label": `Denied: ${row.reason}`, children: chip }) })) : (chip);
|
|
25
|
+
}
|
|
26
|
+
function SecretLink({ row }) {
|
|
27
|
+
if (!row.secretId)
|
|
28
|
+
return _jsx(Dash, {});
|
|
29
|
+
return (_jsx(Link, { component: RouterLink, to: `/secrets/${row.secretId}`, underline: "hover", sx: { overflowWrap: 'anywhere' }, children: row.secretName ?? 'Secret' }));
|
|
30
|
+
}
|
|
31
|
+
function TimeLabel({ iso }) {
|
|
32
|
+
return _jsx("time", { dateTime: iso, children: new Date(iso).toLocaleString() });
|
|
33
|
+
}
|
|
34
|
+
const COLUMNS = [
|
|
35
|
+
{
|
|
36
|
+
id: 'at',
|
|
37
|
+
label: 'Time',
|
|
38
|
+
priority: 'primary',
|
|
39
|
+
hideable: false,
|
|
40
|
+
width: 180,
|
|
41
|
+
value: (row) => new Date(row.at).toLocaleString(),
|
|
42
|
+
render: (row) => _jsx(TimeLabel, { iso: row.at }),
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: 'app',
|
|
46
|
+
label: 'App',
|
|
47
|
+
priority: 'primary',
|
|
48
|
+
flex: 1,
|
|
49
|
+
minWidth: 140,
|
|
50
|
+
value: (row) => agentAppLabel(row),
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
id: 'action',
|
|
54
|
+
label: 'Action',
|
|
55
|
+
priority: 'secondary',
|
|
56
|
+
width: 130,
|
|
57
|
+
value: (row) => AGENT_ACTION_LABELS[row.action] ?? row.action,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: 'secret',
|
|
61
|
+
label: 'Secret',
|
|
62
|
+
priority: 'secondary',
|
|
63
|
+
flex: 1,
|
|
64
|
+
minWidth: 140,
|
|
65
|
+
value: (row) => row.secretName ?? '',
|
|
66
|
+
render: (row) => _jsx(SecretLink, { row: row }),
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: 'origin',
|
|
70
|
+
label: 'Website',
|
|
71
|
+
priority: 'secondary',
|
|
72
|
+
flex: 1,
|
|
73
|
+
minWidth: 140,
|
|
74
|
+
truncate: true,
|
|
75
|
+
value: (row) => row.origin ?? '',
|
|
76
|
+
render: (row) => (row.origin ? _jsx("span", { children: row.origin }) : _jsx(Dash, {})),
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
id: 'purpose',
|
|
80
|
+
label: 'Purpose',
|
|
81
|
+
priority: 'detail',
|
|
82
|
+
flex: 1.2,
|
|
83
|
+
minWidth: 160,
|
|
84
|
+
truncate: true,
|
|
85
|
+
value: (row) => row.purpose ?? '',
|
|
86
|
+
render: (row) => (row.purpose ? _jsx("span", { children: row.purpose }) : _jsx(Dash, {})),
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: 'result',
|
|
90
|
+
label: 'Result',
|
|
91
|
+
priority: 'primary',
|
|
92
|
+
width: 110,
|
|
93
|
+
value: (row) => (row.result === 'ok' ? 'OK' : 'Denied'),
|
|
94
|
+
render: (row) => _jsx(ResultChip, { row: row }),
|
|
95
|
+
},
|
|
96
|
+
];
|
|
97
|
+
/**
|
|
98
|
+
* The agent activity list on the platform `DataTable`: a grid on desktop, cards on a phone (the
|
|
99
|
+
* table measures its own container). Server-paged; no value, code or seed is ever in a row.
|
|
100
|
+
*/
|
|
101
|
+
export function AgentActivityTable(props) {
|
|
102
|
+
const { rows, total, page, pageSize, loading, error, onPaginationChange, filtered = false, renderer } = props;
|
|
103
|
+
const [, setLayout] = useState('desktop');
|
|
104
|
+
const emptyState = (_jsxs(Box, { sx: { py: 4, display: 'flex', flexDirection: 'column', alignItems: 'center', gap: 1, textAlign: 'center' }, children: [_jsx(EmptyIcon, { sx: { fontSize: 40, color: 'text.secondary' } }), _jsx(Typography, { variant: "body2", sx: { color: 'text.secondary', maxWidth: 420 }, children: filtered
|
|
105
|
+
? 'No agent activity matches your filters.'
|
|
106
|
+
: "No agent activity yet. Agents only see logins you allow on the secret's page." })] }));
|
|
107
|
+
return (_jsx(Box, { sx: { minWidth: 0 }, children: _jsx(LayoutReport.Provider, { value: setLayout, children: _jsx(DataTable, { tableId: AGENT_ACTIVITY_TABLE_ID, ariaLabel: "Agent activity", columns: COLUMNS, rows: rows, rowId: (row) => row.id, loading: loading, error: error, emptyState: emptyState, pagination: {
|
|
108
|
+
page,
|
|
109
|
+
pageSize,
|
|
110
|
+
total,
|
|
111
|
+
onPaginationChange,
|
|
112
|
+
pageSizeOptions: AGENT_ACTIVITY_PAGE_SIZES,
|
|
113
|
+
}, disableExport: true, renderer: renderer, tabletBreakpoint: 840, slots: SLOTS }) }) }));
|
|
114
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// Agent access: the per-user Agent activity page and the admin kill switch page.
|
|
2
|
+
export * from './components/AgentActivityTable.js';
|
|
3
|
+
export { default as AgentAccessSettingsPage } from './pages/AgentAccessSettingsPage.js';
|
|
4
|
+
export { default as AgentActivityPage } from './pages/AgentActivityPage.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `Agent access` card of the Console (`/admin/settings/agent-access`, E14.7): the deployment
|
|
3
|
+
* kill switch and the per-minute limits of the agent credential API (`agentAccess` system
|
|
4
|
+
* settings). Read needs `system_settings:read` (the route gates on it); every control is disabled
|
|
5
|
+
* without `system_settings:write`.
|
|
6
|
+
*/
|
|
7
|
+
export default function AgentAccessSettingsPage(): import("react").JSX.Element;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { Navigate } from 'react-router-dom';
|
|
4
|
+
import { Alert, Box, Button, FormControlLabel, Paper, Snackbar, Switch, TextField, Typography } from '@mui/material';
|
|
5
|
+
import { usePermissions } from '@marinoscar/platform-web/identity/headless';
|
|
6
|
+
import { useSystemSettings } from '../../../core/headless/useSystemSettings.js';
|
|
7
|
+
import { LoadingSpinner } from '../../../core/ui/LoadingSpinner.js';
|
|
8
|
+
import { SettingsPageFrame } from '../../../core/ui/SettingsPageFrame.js';
|
|
9
|
+
import { AGENT_ACCESS_DEFAULTS } from '../../../core/headless/types.js';
|
|
10
|
+
const LIMITS = [
|
|
11
|
+
{ key: 'lookupPerMinute', label: 'Lookups per minute', help: 'Finding a login for a website.' },
|
|
12
|
+
{ key: 'fillPerMinute', label: 'Fills per minute', help: 'Handing a login to an agent.' },
|
|
13
|
+
{ key: 'totpPerMinute', label: 'One-time codes per minute', help: 'Reading a one-time code.' },
|
|
14
|
+
{ key: 'writePerMinute', label: 'Writes per minute', help: 'Creating or rotating a login.' },
|
|
15
|
+
];
|
|
16
|
+
const MIN = 1;
|
|
17
|
+
const MAX = 600;
|
|
18
|
+
const validLimit = (text) => /^\d+$/.test(text) && Number(text) >= MIN && Number(text) <= MAX;
|
|
19
|
+
/**
|
|
20
|
+
* The `Agent access` card of the Console (`/admin/settings/agent-access`, E14.7): the deployment
|
|
21
|
+
* kill switch and the per-minute limits of the agent credential API (`agentAccess` system
|
|
22
|
+
* settings). Read needs `system_settings:read` (the route gates on it); every control is disabled
|
|
23
|
+
* without `system_settings:write`.
|
|
24
|
+
*/
|
|
25
|
+
export default function AgentAccessSettingsPage() {
|
|
26
|
+
const { hasPermission } = usePermissions();
|
|
27
|
+
const { settings, isLoading, error, isSaving, updateSettings } = useSystemSettings();
|
|
28
|
+
const current = settings?.agentAccess ?? AGENT_ACCESS_DEFAULTS;
|
|
29
|
+
const [enabled, setEnabled] = useState(current.enabled);
|
|
30
|
+
const [limits, setLimits] = useState(() => toText(current));
|
|
31
|
+
const [success, setSuccess] = useState(null);
|
|
32
|
+
const [failure, setFailure] = useState(null);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
setEnabled(current.enabled);
|
|
35
|
+
setLimits(toText(current));
|
|
36
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
37
|
+
}, [settings?.version]);
|
|
38
|
+
if (!hasPermission('system_settings:read'))
|
|
39
|
+
return _jsx(Navigate, { to: "/", replace: true });
|
|
40
|
+
const canWrite = hasPermission('system_settings:write');
|
|
41
|
+
if (isLoading)
|
|
42
|
+
return _jsx(LoadingSpinner, {});
|
|
43
|
+
const allValid = LIMITS.every(({ key }) => validLimit(limits[key]));
|
|
44
|
+
const dirty = enabled !== current.enabled || LIMITS.some(({ key }) => Number(limits[key]) !== current[key]);
|
|
45
|
+
const save = async () => {
|
|
46
|
+
try {
|
|
47
|
+
const next = {
|
|
48
|
+
enabled,
|
|
49
|
+
lookupPerMinute: Number(limits.lookupPerMinute),
|
|
50
|
+
fillPerMinute: Number(limits.fillPerMinute),
|
|
51
|
+
totpPerMinute: Number(limits.totpPerMinute),
|
|
52
|
+
writePerMinute: Number(limits.writePerMinute),
|
|
53
|
+
};
|
|
54
|
+
await updateSettings({ agentAccess: next });
|
|
55
|
+
setSuccess('Settings saved');
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
setFailure(err instanceof Error ? err.message : 'Failed to save');
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
return (_jsxs(SettingsPageFrame, { title: "Agent access", description: `The kill switch and rate limits for apps that use logins on a person's behalf${canWrite ? '' : ' (read-only)'}`, children: [error && (_jsx(Alert, { severity: "error", sx: { mb: 3 }, children: error })), _jsxs(Paper, { sx: { p: { xs: 2, sm: 3 } }, children: [_jsx(FormControlLabel, { control: _jsx(Switch, { checked: enabled, onChange: (e) => setEnabled(e.target.checked), disabled: !canWrite || isSaving }), label: "Allow agents to use opened logins" }), _jsx(Typography, { variant: "body2", sx: { color: 'text.secondary', mt: 0.5, mb: 3 }, children: "When off, every agent request is refused for everyone, whatever each person has allowed on a login. Agents can only use logins their owner opened to agents on the secret's page." }), _jsx(Box, { sx: { display: 'grid', gap: 2, gridTemplateColumns: { xs: '1fr', sm: '1fr 1fr' } }, children: LIMITS.map(({ key, label, help }) => (_jsx(TextField, { label: label, value: limits[key], onChange: (e) => setLimits((l) => ({ ...l, [key]: e.target.value })), disabled: !canWrite || isSaving, error: !validLimit(limits[key]), helperText: validLimit(limits[key]) ? help : `Enter a whole number from ${MIN} to ${MAX}.`, slotProps: { htmlInput: { inputMode: 'numeric', min: MIN, max: MAX } }, type: "number" }, key))) }), _jsx(Typography, { variant: "caption", sx: { display: 'block', color: 'text.secondary', mt: 1 }, children: "Each limit counts per app and person." }), canWrite && (_jsx(Button, { variant: "contained", sx: { mt: 3 }, onClick: save, disabled: !dirty || !allValid || isSaving, children: "Save" }))] }), _jsx(Snackbar, { open: !!success, autoHideDuration: 3000, onClose: () => setSuccess(null), message: success }), _jsx(Snackbar, { open: !!failure, autoHideDuration: 5000, onClose: () => setFailure(null), children: _jsx(Alert, { severity: "error", onClose: () => setFailure(null), children: failure }) })] }));
|
|
62
|
+
}
|
|
63
|
+
function toText(s) {
|
|
64
|
+
return {
|
|
65
|
+
lookupPerMinute: String(s.lookupPerMinute),
|
|
66
|
+
fillPerMinute: String(s.fillPerMinute),
|
|
67
|
+
totpPerMinute: String(s.totpPerMinute),
|
|
68
|
+
writePerMinute: String(s.writePerMinute),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `Agent activity` card (`/settings/agent-activity`, E14.7): what apps did with the caller's
|
|
3
|
+
* logins, with filters and a link to Connected apps to revoke one. Read needs `secrets:read`
|
|
4
|
+
* (the route gates on it).
|
|
5
|
+
*/
|
|
6
|
+
export default function AgentActivityPage(): import("react").JSX.Element;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
3
|
+
import { Link as RouterLink } from 'react-router-dom';
|
|
4
|
+
import { Box, Button, MenuItem, TextField } from '@mui/material';
|
|
5
|
+
import { AppsOutlined as AppsIcon } from '@mui/icons-material';
|
|
6
|
+
import { SettingsPageFrame } from '../../../core/ui/SettingsPageFrame.js';
|
|
7
|
+
import { AGENT_ACTION_LABELS, AGENT_ACTIVITY_ACTIONS, } from '../../headless/agentActivity.js';
|
|
8
|
+
import { useAgentActivity } from '../../headless/useAgentActivity.js';
|
|
9
|
+
import { AgentActivityTable, AGENT_ACTIVITY_PAGE_SIZES } from '../components/AgentActivityTable.js';
|
|
10
|
+
/** A `YYYY-MM-DD` input value as the start (or end) of that local day, ISO. */
|
|
11
|
+
function dayBound(value, end) {
|
|
12
|
+
if (!value)
|
|
13
|
+
return undefined;
|
|
14
|
+
const d = new Date(`${value}${end ? 'T23:59:59.999' : 'T00:00:00'}`);
|
|
15
|
+
return Number.isNaN(d.getTime()) ? undefined : d.toISOString();
|
|
16
|
+
}
|
|
17
|
+
const FIELD_SX = { flex: '1 1 160px', minWidth: 0, '& .MuiInputBase-root': { minHeight: 44 } };
|
|
18
|
+
/**
|
|
19
|
+
* The `Agent activity` card (`/settings/agent-activity`, E14.7): what apps did with the caller's
|
|
20
|
+
* logins, with filters and a link to Connected apps to revoke one. Read needs `secrets:read`
|
|
21
|
+
* (the route gates on it).
|
|
22
|
+
*/
|
|
23
|
+
export default function AgentActivityPage() {
|
|
24
|
+
const [action, setAction] = useState('');
|
|
25
|
+
const [clientId, setClientId] = useState('');
|
|
26
|
+
const [from, setFrom] = useState('');
|
|
27
|
+
const [to, setTo] = useState('');
|
|
28
|
+
const [page, setPage] = useState(0);
|
|
29
|
+
const [pageSize, setPageSize] = useState(AGENT_ACTIVITY_PAGE_SIZES[1]);
|
|
30
|
+
// Apps seen so far, so the filter keeps offering one after it narrows the list to itself.
|
|
31
|
+
const [apps, setApps] = useState(new Map());
|
|
32
|
+
const query = useMemo(() => ({
|
|
33
|
+
page: page + 1,
|
|
34
|
+
pageSize,
|
|
35
|
+
action: action || undefined,
|
|
36
|
+
clientId: clientId || undefined,
|
|
37
|
+
from: dayBound(from, false),
|
|
38
|
+
to: dayBound(to, true),
|
|
39
|
+
}), [page, pageSize, action, clientId, from, to]);
|
|
40
|
+
const { items, total, loading, error } = useAgentActivity(query);
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
const additions = items.filter((i) => i.clientId && !apps.has(i.clientId));
|
|
43
|
+
if (additions.length === 0)
|
|
44
|
+
return;
|
|
45
|
+
setApps((prev) => {
|
|
46
|
+
const next = new Map(prev);
|
|
47
|
+
for (const i of additions)
|
|
48
|
+
next.set(i.clientId, i.clientName ?? 'Unknown app');
|
|
49
|
+
return next;
|
|
50
|
+
});
|
|
51
|
+
}, [items, apps]);
|
|
52
|
+
const filtered = Boolean(action || clientId || from || to);
|
|
53
|
+
const reset = (fn) => {
|
|
54
|
+
fn();
|
|
55
|
+
setPage(0);
|
|
56
|
+
};
|
|
57
|
+
return (_jsxs(SettingsPageFrame, { title: "Agent activity", description: "Which apps used or changed your logins, on which website and why. Never a password or code.", maxWidth: "lg", children: [_jsx(Box, { sx: { mb: 2 }, children: _jsx(Button, { component: RouterLink, to: "/settings/connected-apps", variant: "outlined", startIcon: _jsx(AppsIcon, {}), children: "Manage connected apps" }) }), _jsxs(Box, { role: "search", "aria-label": "Filter agent activity", sx: { display: 'flex', flexWrap: 'wrap', gap: 1.5, mb: 2, minWidth: 0 }, children: [_jsxs(TextField, { select: true, size: "small", label: "Action", value: action, onChange: (e) => reset(() => setAction(e.target.value)), sx: FIELD_SX, slotProps: { select: { displayEmpty: true }, inputLabel: { shrink: true } }, children: [_jsx(MenuItem, { value: "", children: "All actions" }), AGENT_ACTIVITY_ACTIONS.map((a) => (_jsx(MenuItem, { value: a, children: AGENT_ACTION_LABELS[a] }, a)))] }), _jsxs(TextField, { select: true, size: "small", label: "App", value: clientId, onChange: (e) => reset(() => setClientId(e.target.value)), sx: FIELD_SX, slotProps: { select: { displayEmpty: true }, inputLabel: { shrink: true } }, children: [_jsx(MenuItem, { value: "", children: "All apps" }), [...apps.entries()].map(([id, name]) => (_jsx(MenuItem, { value: id, children: name }, id)))] }), _jsx(TextField, { size: "small", type: "date", label: "From", value: from, onChange: (e) => reset(() => setFrom(e.target.value)), sx: FIELD_SX, slotProps: { inputLabel: { shrink: true } } }), _jsx(TextField, { size: "small", type: "date", label: "To", value: to, onChange: (e) => reset(() => setTo(e.target.value)), sx: FIELD_SX, slotProps: { inputLabel: { shrink: true } } })] }), _jsx(AgentActivityTable, { rows: items, total: total, page: page, pageSize: pageSize, loading: loading, error: error, filtered: filtered, onPaginationChange: (next) => {
|
|
58
|
+
setPage(next.page);
|
|
59
|
+
setPageSize(next.pageSize);
|
|
60
|
+
} })] }));
|
|
61
|
+
}
|