@peers-app/peers-ui 0.27.3 → 0.27.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/screens/network-viewer/group-details-modal.d.ts +4 -0
- package/dist/screens/network-viewer/group-details-modal.js +6 -46
- package/dist/screens/network-viewer/network-viewer-ipc.d.ts +3 -2
- package/dist/screens/network-viewer/network-viewer-ipc.js +6 -0
- package/dist/screens/network-viewer/sync-recovery.js +103 -1
- package/dist/screens/variables/variable-details.js +2 -1
- package/dist/tabs-layout/network-status-indicator.js +26 -12
- package/dist/tabs-layout/use-network-status.d.ts +6 -1
- package/dist/tabs-layout/use-network-status.js +27 -4
- package/package.json +9 -3
- package/.claude/settings.local.json +0 -34
- package/.github/README.md +0 -52
- package/.github/workflows/delete-all-artifacts.yml +0 -49
- package/.github/workflows/publish.yml +0 -51
- package/babel.config.js +0 -7
- package/biome.json +0 -198
- package/dist/app-updates/app-updates-consumer.test.d.ts +0 -1
- package/dist/app-updates/app-updates-consumer.test.js +0 -56
- package/dist/app-updates/app-updates-settings.test.d.ts +0 -1
- package/dist/app-updates/app-updates-settings.test.js +0 -93
- package/dist/app-updates/remote-app-update-panel.test.d.ts +0 -1
- package/dist/app-updates/remote-app-update-panel.test.js +0 -165
- package/dist/components/access-level-field.test.d.ts +0 -1
- package/dist/components/access-level-field.test.js +0 -28
- package/dist/components/message-logs/tool-access-approval-card.test.d.ts +0 -1
- package/dist/components/message-logs/tool-access-approval-card.test.js +0 -102
- package/dist/components/responsive-section-nav.test.d.ts +0 -1
- package/dist/components/responsive-section-nav.test.js +0 -45
- package/dist/globals-hash.test.d.ts +0 -1
- package/dist/globals-hash.test.js +0 -16
- package/dist/hooks/use-observable-state.test.d.ts +0 -1
- package/dist/hooks/use-observable-state.test.js +0 -64
- package/dist/hooks/use-observable.test.d.ts +0 -1
- package/dist/hooks/use-observable.test.js +0 -191
- package/dist/hooks/use-rows.test.d.ts +0 -1
- package/dist/hooks/use-rows.test.js +0 -175
- package/dist/hooks/use-tool.test.d.ts +0 -1
- package/dist/hooks/use-tool.test.js +0 -190
- package/dist/host-shell/host-shell-consumer.test.d.ts +0 -1
- package/dist/host-shell/host-shell-consumer.test.js +0 -28
- package/dist/root-layout/root-layout-host.test.d.ts +0 -1
- package/dist/root-layout/root-layout-host.test.js +0 -86
- package/dist/screens/account/account-screen.test.d.ts +0 -1
- package/dist/screens/account/account-screen.test.js +0 -51
- package/dist/screens/assistants/assistant-config.test.d.ts +0 -1
- package/dist/screens/assistants/assistant-config.test.js +0 -57
- package/dist/screens/contacts/contact-list.test.d.ts +0 -1
- package/dist/screens/contacts/contact-list.test.js +0 -48
- package/dist/screens/device-pairing/device-pairing.test.d.ts +0 -1
- package/dist/screens/device-pairing/device-pairing.test.js +0 -119
- package/dist/screens/devices/devices-list.test.d.ts +0 -1
- package/dist/screens/devices/devices-list.test.js +0 -53
- package/dist/screens/groups/group-list.test.d.ts +0 -1
- package/dist/screens/groups/group-list.test.js +0 -38
- package/dist/screens/identity/identity-routes.test.d.ts +0 -1
- package/dist/screens/identity/identity-routes.test.js +0 -51
- package/dist/screens/identity/identity-screen.test.d.ts +0 -1
- package/dist/screens/identity/identity-screen.test.js +0 -103
- package/dist/screens/invites/accept-invite.test.d.ts +0 -1
- package/dist/screens/invites/accept-invite.test.js +0 -103
- package/dist/screens/invites/activity-view.test.d.ts +0 -1
- package/dist/screens/invites/activity-view.test.js +0 -108
- package/dist/screens/invites/invite-classify.test.d.ts +0 -1
- package/dist/screens/invites/invite-classify.test.js +0 -115
- package/dist/screens/network-viewer/network-viewer-ipc.test.d.ts +0 -1
- package/dist/screens/network-viewer/network-viewer-ipc.test.js +0 -61
- package/dist/screens/network-viewer/network-viewer.section.test.d.ts +0 -1
- package/dist/screens/network-viewer/network-viewer.section.test.js +0 -63
- package/dist/screens/network-viewer/sync-recovery.test.d.ts +0 -1
- package/dist/screens/network-viewer/sync-recovery.test.js +0 -104
- package/dist/screens/packages/package-helpers.test.d.ts +0 -1
- package/dist/screens/packages/package-helpers.test.js +0 -53
- package/dist/screens/packages/package-runtime-status.test.d.ts +0 -1
- package/dist/screens/packages/package-runtime-status.test.js +0 -50
- package/dist/screens/packages/packages-ipc.test.d.ts +0 -1
- package/dist/screens/packages/packages-ipc.test.js +0 -43
- package/dist/screens/settings/settings-page.test.d.ts +0 -1
- package/dist/screens/settings/settings-page.test.js +0 -19
- package/dist/screens/tools/tool-access-ipc.test.d.ts +0 -1
- package/dist/screens/tools/tool-access-ipc.test.js +0 -40
- package/dist/screens/tools/tool-catalog-ipc.test.d.ts +0 -1
- package/dist/screens/tools/tool-catalog-ipc.test.js +0 -52
- package/dist/tabs-layout/network-status-indicator.test.d.ts +0 -1
- package/dist/tabs-layout/network-status-indicator.test.js +0 -665
- package/dist/tabs-layout/tabs-state.test.d.ts +0 -1
- package/dist/tabs-layout/tabs-state.test.js +0 -110
- package/dist/tabs-layout/use-network-status.test.d.ts +0 -1
- package/dist/tabs-layout/use-network-status.test.js +0 -45
- package/dist/ui-router/ui-loader.test.d.ts +0 -1
- package/dist/ui-router/ui-loader.test.js +0 -91
- package/jest.config.js +0 -25
- package/release-guard.js +0 -10
- package/src/app-updates/app-update-controls.tsx +0 -73
- package/src/app-updates/app-updates-consumer.test.ts +0 -83
- package/src/app-updates/app-updates-consumer.ts +0 -121
- package/src/app-updates/app-updates-settings.test.tsx +0 -109
- package/src/app-updates/app-updates-settings.tsx +0 -136
- package/src/app-updates/remote-app-update-panel.test.tsx +0 -205
- package/src/app-updates/remote-app-update-panel.tsx +0 -210
- package/src/app-updates/use-app-update-status.ts +0 -16
- package/src/command-palette/command-palette-ui.tsx +0 -564
- package/src/command-palette/command-palette.ts +0 -242
- package/src/components/access-level-field.test.tsx +0 -32
- package/src/components/access-level-field.tsx +0 -68
- package/src/components/checkbox.tsx +0 -25
- package/src/components/group-switcher.tsx +0 -526
- package/src/components/input-date.tsx +0 -29
- package/src/components/input-number.tsx +0 -83
- package/src/components/input.tsx +0 -25
- package/src/components/inverse-lazy-list.tsx +0 -107
- package/src/components/io-schema-values.tsx +0 -103
- package/src/components/io-schema.tsx +0 -259
- package/src/components/lazy-list.tsx +0 -115
- package/src/components/list-screen.tsx +0 -126
- package/src/components/loading-indicator.tsx +0 -7
- package/src/components/markdown-editor/autolink-plugin.tsx +0 -29
- package/src/components/markdown-editor/editor-inline.tsx +0 -9
- package/src/components/markdown-editor/editor.tsx +0 -158
- package/src/components/markdown-editor/markdown-plugin.tsx +0 -202
- package/src/components/markdown-editor/mention-node.ts +0 -204
- package/src/components/markdown-editor/mentions-plugin.tsx +0 -354
- package/src/components/markdown-editor/move-line-plugin.tsx +0 -186
- package/src/components/markdown-editor/select-line-boundary-plugin.tsx +0 -95
- package/src/components/markdown-editor/theme.ts +0 -46
- package/src/components/markdown-editor/toolbar.tsx +0 -269
- package/src/components/markdown-with-mentions.tsx +0 -198
- package/src/components/message-logs/message-logs.tsx +0 -523
- package/src/components/message-logs/tool-access-approval-card.test.tsx +0 -127
- package/src/components/message-logs/tool-access-approval-card.tsx +0 -178
- package/src/components/messages/avatar.tsx +0 -171
- package/src/components/messages/channel-message-list.tsx +0 -189
- package/src/components/messages/channel-view.tsx +0 -92
- package/src/components/messages/message-compose.tsx +0 -192
- package/src/components/messages/message-display.tsx +0 -231
- package/src/components/messages/thread-message-list.tsx +0 -135
- package/src/components/qr-scanner.tsx +0 -180
- package/src/components/responsive-section-nav.test.tsx +0 -88
- package/src/components/responsive-section-nav.tsx +0 -92
- package/src/components/router.tsx +0 -175
- package/src/components/save-button.tsx +0 -134
- package/src/components/sortable-list.tsx +0 -130
- package/src/components/tabs.tsx +0 -76
- package/src/components/tooltip.tsx +0 -43
- package/src/components/trust-level-badge.tsx +0 -44
- package/src/components/trust-level-dropdown.tsx +0 -136
- package/src/components/typeahead.tsx +0 -357
- package/src/globals-hash.test.ts +0 -19
- package/src/globals.tsx +0 -226
- package/src/hooks/index.ts +0 -8
- package/src/hooks/use-host-contract.ts +0 -75
- package/src/hooks/use-observable-state.test.tsx +0 -101
- package/src/hooks/use-observable-state.ts +0 -29
- package/src/hooks/use-observable.test.tsx +0 -258
- package/src/hooks/use-observable.ts +0 -67
- package/src/hooks/use-on-screen.ts +0 -24
- package/src/hooks/use-promise.ts +0 -34
- package/src/hooks/use-rows.test.tsx +0 -196
- package/src/hooks/use-rows.ts +0 -120
- package/src/hooks/use-subscription.ts +0 -24
- package/src/hooks/use-tool.test.tsx +0 -225
- package/src/hooks/use-tool.ts +0 -116
- package/src/host-shell/host-shell-consumer.test.ts +0 -32
- package/src/host-shell/host-shell-consumer.ts +0 -53
- package/src/index.tsx +0 -42
- package/src/mention-configs.ts +0 -185
- package/src/operator-console/operator-console-state.ts +0 -119
- package/src/operator-console/operator-console.tsx +0 -233
- package/src/peers-services-registration.ts +0 -6
- package/src/root-layout/global-overlays.ts +0 -50
- package/src/root-layout/layout-picker.tsx +0 -47
- package/src/root-layout/layouts/full-screen-layout.tsx +0 -144
- package/src/root-layout/layouts/tabs-with-console-layout.tsx +0 -260
- package/src/root-layout/root-layout-host.test.tsx +0 -108
- package/src/root-layout/root-layout-host.tsx +0 -147
- package/src/root-layout/root-layout-registry.ts +0 -51
- package/src/root-layout/root-layout-state.ts +0 -55
- package/src/root-layout/root-layout.ts +0 -32
- package/src/screens/account/account-screen.test.tsx +0 -65
- package/src/screens/account/account-screen.tsx +0 -942
- package/src/screens/assistants/assistant-config.test.tsx +0 -54
- package/src/screens/assistants/assistant-config.tsx +0 -121
- package/src/screens/assistants/assistant-details.tsx +0 -89
- package/src/screens/assistants/assistant-info.tsx +0 -66
- package/src/screens/assistants/assistant-list.tsx +0 -145
- package/src/screens/assistants/assistant-tools.tsx +0 -82
- package/src/screens/console-logs/console-logs-list.tsx +0 -374
- package/src/screens/console-logs/log-display.tsx +0 -137
- package/src/screens/console-logs/log-filters.tsx +0 -64
- package/src/screens/console-logs/mobile-log-card.tsx +0 -161
- package/src/screens/console-logs/resizable-table-header.tsx +0 -110
- package/src/screens/contacts/contact-details.tsx +0 -123
- package/src/screens/contacts/contact-list.test.tsx +0 -59
- package/src/screens/contacts/contact-list.tsx +0 -286
- package/src/screens/contacts/index.ts +0 -2
- package/src/screens/data-explorer/data-explorer.tsx +0 -633
- package/src/screens/data-explorer/index.ts +0 -6
- package/src/screens/data-explorer/query-executor.tsx +0 -520
- package/src/screens/device-pairing/device-pairing.test.tsx +0 -143
- package/src/screens/device-pairing/device-pairing.tsx +0 -461
- package/src/screens/device-pairing/identity-ipc.ts +0 -25
- package/src/screens/device-pairing/index.ts +0 -2
- package/src/screens/device-pairing/use-device-pairing-state.ts +0 -15
- package/src/screens/devices/devices-list.test.tsx +0 -68
- package/src/screens/devices/devices-list.tsx +0 -365
- package/src/screens/devices/index.ts +0 -1
- package/src/screens/groups/group-details.tsx +0 -160
- package/src/screens/groups/group-invite-panel.tsx +0 -311
- package/src/screens/groups/group-list.test.tsx +0 -44
- package/src/screens/groups/group-list.tsx +0 -317
- package/src/screens/groups/group-members.tsx +0 -343
- package/src/screens/groups/index.ts +0 -3
- package/src/screens/identity/identity-routes.test.ts +0 -70
- package/src/screens/identity/identity-routes.ts +0 -301
- package/src/screens/identity/identity-screen.test.tsx +0 -138
- package/src/screens/identity/identity-screen.tsx +0 -282
- package/src/screens/identity/index.ts +0 -2
- package/src/screens/identity/invite-contact-panel.tsx +0 -45
- package/src/screens/identity/profile-invite.tsx +0 -93
- package/src/screens/invites/accept-invite.test.tsx +0 -115
- package/src/screens/invites/accept-invite.tsx +0 -318
- package/src/screens/invites/activity-view.test.tsx +0 -127
- package/src/screens/invites/activity-view.tsx +0 -162
- package/src/screens/invites/index.ts +0 -6
- package/src/screens/invites/invite-capture.ts +0 -104
- package/src/screens/invites/invite-classify.test.ts +0 -129
- package/src/screens/invites/invite-share.tsx +0 -104
- package/src/screens/invites/invites-ipc.ts +0 -25
- package/src/screens/invites/pending-invites-list.tsx +0 -256
- package/src/screens/network-viewer/connection-troubleshooter.tsx +0 -395
- package/src/screens/network-viewer/cpu-usage-graph.tsx +0 -294
- package/src/screens/network-viewer/device-details-modal.tsx +0 -339
- package/src/screens/network-viewer/group-details-modal.tsx +0 -421
- package/src/screens/network-viewer/index.ts +0 -8
- package/src/screens/network-viewer/network-viewer-ipc.test.ts +0 -72
- package/src/screens/network-viewer/network-viewer-ipc.ts +0 -39
- package/src/screens/network-viewer/network-viewer-section.ts +0 -12
- package/src/screens/network-viewer/network-viewer.section.test.tsx +0 -68
- package/src/screens/network-viewer/network-viewer.tsx +0 -708
- package/src/screens/network-viewer/remote-logs-panel.tsx +0 -190
- package/src/screens/network-viewer/sync-recovery.test.tsx +0 -114
- package/src/screens/network-viewer/sync-recovery.tsx +0 -461
- package/src/screens/network-viewer/usage-graph.tsx +0 -455
- package/src/screens/packages/local-folder-grants-panel.tsx +0 -290
- package/src/screens/packages/local-folders-ipc.ts +0 -28
- package/src/screens/packages/package-details.tsx +0 -166
- package/src/screens/packages/package-helpers.test.ts +0 -57
- package/src/screens/packages/package-helpers.ts +0 -137
- package/src/screens/packages/package-info.tsx +0 -354
- package/src/screens/packages/package-list.tsx +0 -519
- package/src/screens/packages/package-network-panel.tsx +0 -82
- package/src/screens/packages/package-new-local.tsx +0 -100
- package/src/screens/packages/package-runtime-status.test.tsx +0 -58
- package/src/screens/packages/package-runtime-status.tsx +0 -68
- package/src/screens/packages/package-versions.tsx +0 -298
- package/src/screens/packages/packages-ipc.test.ts +0 -47
- package/src/screens/packages/packages-ipc.ts +0 -125
- package/src/screens/peer-types/peer-type-details.tsx +0 -172
- package/src/screens/peer-types/peer-type-list.tsx +0 -64
- package/src/screens/search/global-search.tsx +0 -406
- package/src/screens/settings/color-mode-dropdown.tsx +0 -82
- package/src/screens/settings/settings-page.test.tsx +0 -24
- package/src/screens/settings/settings-page.tsx +0 -426
- package/src/screens/setup-user.tsx +0 -355
- package/src/screens/tools/tool-access-ipc.test.ts +0 -55
- package/src/screens/tools/tool-access-ipc.ts +0 -27
- package/src/screens/tools/tool-catalog-ipc.test.ts +0 -52
- package/src/screens/tools/tool-catalog-ipc.ts +0 -51
- package/src/screens/tools/tool-details.tsx +0 -52
- package/src/screens/tools/tool-info.tsx +0 -45
- package/src/screens/tools/tool-list.tsx +0 -106
- package/src/screens/tools/tool-schema.tsx +0 -44
- package/src/screens/tools/tool-test-details.tsx +0 -89
- package/src/screens/tools/tool-test-list.tsx +0 -73
- package/src/screens/variables/variable-details.tsx +0 -289
- package/src/screens/variables/variable-list.tsx +0 -110
- package/src/screens/welcome-modal.tsx +0 -294
- package/src/screens/workflows/workflow-details.tsx +0 -115
- package/src/screens/workflows/workflow-info.tsx +0 -22
- package/src/screens/workflows/workflow-instructions.tsx +0 -134
- package/src/screens/workflows/workflow-list.tsx +0 -117
- package/src/setupTests.ts +0 -38
- package/src/system-apps/assistants.app.ts +0 -7
- package/src/system-apps/console-logs.app.ts +0 -7
- package/src/system-apps/data-explorer.app.ts +0 -8
- package/src/system-apps/identity.app.ts +0 -9
- package/src/system-apps/index.ts +0 -77
- package/src/system-apps/mobile-settings.app.ts +0 -7
- package/src/system-apps/network-viewer.app.ts +0 -8
- package/src/system-apps/packages.app.ts +0 -7
- package/src/system-apps/search.app.ts +0 -8
- package/src/system-apps/settings.app.ts +0 -7
- package/src/system-apps/threads.app.ts +0 -7
- package/src/system-apps/tools.app.ts +0 -7
- package/src/system-apps/types.app.ts +0 -7
- package/src/system-apps/variables.app.ts +0 -7
- package/src/system-apps/workflows.app.ts +0 -7
- package/src/tabs-layout/network-status-indicator.test.tsx +0 -799
- package/src/tabs-layout/network-status-indicator.tsx +0 -756
- package/src/tabs-layout/tabs-layout.tsx +0 -857
- package/src/tabs-layout/tabs-state.test.ts +0 -152
- package/src/tabs-layout/tabs-state.ts +0 -587
- package/src/tabs-layout/use-network-status.test.tsx +0 -58
- package/src/tabs-layout/use-network-status.ts +0 -68
- package/src/ui-defaults/index.ts +0 -2
- package/src/ui-defaults/list-screen.tsx +0 -94
- package/src/ui-defaults/markdown-field.tsx +0 -87
- package/src/ui-router/routes-loader.ts +0 -193
- package/src/ui-router/ui-loader.test.tsx +0 -108
- package/src/ui-router/ui-loader.tsx +0 -606
- package/src/utils.ts +0 -95
- package/tsconfig.json +0 -18
|
@@ -1,355 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
hydrateKeys,
|
|
3
|
-
isid,
|
|
4
|
-
newid,
|
|
5
|
-
newKeys,
|
|
6
|
-
openMessageWithPublicKey,
|
|
7
|
-
signMessageWithSecretKey,
|
|
8
|
-
} from "@peers-app/peers-sdk";
|
|
9
|
-
import { useState } from "react";
|
|
10
|
-
import { useObservable } from "../hooks";
|
|
11
|
-
import { DestinationDevicePairing } from "./device-pairing";
|
|
12
|
-
import { identityTools } from "./device-pairing/identity-ipc";
|
|
13
|
-
import { colorMode } from "./settings/color-mode-dropdown";
|
|
14
|
-
|
|
15
|
-
type SetupStep = "select-user-type" | "complete";
|
|
16
|
-
|
|
17
|
-
export const SetupUser = () => {
|
|
18
|
-
const [_colorMode] = useObservable(colorMode);
|
|
19
|
-
const [step, _setStep] = useState<SetupStep>("select-user-type");
|
|
20
|
-
const [showPairing, setShowPairing] = useState(false);
|
|
21
|
-
const [isExistingUser, setIsExistingUser] = useState<boolean | null>(null);
|
|
22
|
-
const [userId, setUserId] = useState("");
|
|
23
|
-
const [secretKey, setSecretKey] = useState("");
|
|
24
|
-
const [error, setError] = useState("");
|
|
25
|
-
const [isValidating, setIsValidating] = useState(false);
|
|
26
|
-
|
|
27
|
-
document.getElementById("appLoadingDiv")?.remove();
|
|
28
|
-
|
|
29
|
-
const isDark = _colorMode === "dark";
|
|
30
|
-
|
|
31
|
-
const handleNewUser = async () => {
|
|
32
|
-
setError("");
|
|
33
|
-
setIsValidating(true);
|
|
34
|
-
|
|
35
|
-
try {
|
|
36
|
-
// Generate new user credentials
|
|
37
|
-
const keys = newKeys();
|
|
38
|
-
const _userId = newid();
|
|
39
|
-
|
|
40
|
-
// signIn triggers device init, which installs peers-core into the personal
|
|
41
|
-
// context (S3-first, bundle fallback).
|
|
42
|
-
await (await identityTools()).signIn({ userId: _userId, secretKey: keys.secretKey });
|
|
43
|
-
|
|
44
|
-
// Success - reload the app (peers-services registration runs after Welcome modal)
|
|
45
|
-
window.location.reload();
|
|
46
|
-
} catch (err) {
|
|
47
|
-
setError(`Error creating new user: ${String(err).replaceAll("\n", " ")}`);
|
|
48
|
-
setIsValidating(false);
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const handleExistingUser = async () => {
|
|
53
|
-
setError("");
|
|
54
|
-
|
|
55
|
-
// Validate inputs
|
|
56
|
-
if (!userId.trim() || !secretKey.trim()) {
|
|
57
|
-
setError("Please enter both User ID and Secret Key");
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (isid(userId) !== true) {
|
|
62
|
-
setError("Invalid User ID format");
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
setIsValidating(true);
|
|
67
|
-
|
|
68
|
-
try {
|
|
69
|
-
// Validate secret key
|
|
70
|
-
const keys = hydrateKeys(secretKey);
|
|
71
|
-
const msg = newid();
|
|
72
|
-
const msgSigned = signMessageWithSecretKey(msg, keys.secretKey);
|
|
73
|
-
const msgOpened = openMessageWithPublicKey(msgSigned, keys.publicKey);
|
|
74
|
-
|
|
75
|
-
if (msg !== msgOpened) {
|
|
76
|
-
throw new Error("Secret key validation failed");
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
await (await identityTools()).signIn({ userId, secretKey: keys.secretKey });
|
|
80
|
-
|
|
81
|
-
// Success - reload the app
|
|
82
|
-
window.location.reload();
|
|
83
|
-
} catch (err) {
|
|
84
|
-
setError(`Invalid credentials: ${String(err).replaceAll("\n", " ")}`);
|
|
85
|
-
setIsValidating(false);
|
|
86
|
-
}
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
if (showPairing) {
|
|
90
|
-
return (
|
|
91
|
-
<div
|
|
92
|
-
className="container-fluid d-flex align-items-start justify-content-center"
|
|
93
|
-
style={{ paddingTop: "20px", backgroundColor: isDark ? "#212529" : "#f8f9fa" }}
|
|
94
|
-
>
|
|
95
|
-
<div
|
|
96
|
-
className="card shadow"
|
|
97
|
-
style={{
|
|
98
|
-
maxWidth: "560px",
|
|
99
|
-
width: "100%",
|
|
100
|
-
backgroundColor: isDark ? "#2d3238" : "#ffffff",
|
|
101
|
-
}}
|
|
102
|
-
>
|
|
103
|
-
<div className="card-body p-4 p-md-5">
|
|
104
|
-
<DestinationDevicePairing onBack={() => setShowPairing(false)} />
|
|
105
|
-
</div>
|
|
106
|
-
</div>
|
|
107
|
-
</div>
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// Step 1: Select User Type
|
|
112
|
-
if (step === "select-user-type" && isExistingUser === null) {
|
|
113
|
-
return (
|
|
114
|
-
<div
|
|
115
|
-
className="container-fluid d-flex align-items-start justify-content-center"
|
|
116
|
-
style={{ paddingTop: "20px", backgroundColor: isDark ? "#212529" : "#f8f9fa" }}
|
|
117
|
-
>
|
|
118
|
-
<div
|
|
119
|
-
className="card shadow"
|
|
120
|
-
style={{
|
|
121
|
-
maxWidth: "500px",
|
|
122
|
-
width: "100%",
|
|
123
|
-
backgroundColor: isDark ? "#2d3238" : "#ffffff",
|
|
124
|
-
}}
|
|
125
|
-
>
|
|
126
|
-
<div className="card-body p-4 p-md-5">
|
|
127
|
-
<div className="text-center mb-4">
|
|
128
|
-
<h2 className={`fw-bold mb-2 ${isDark ? "text-light" : ""}`}>Welcome to Peers</h2>
|
|
129
|
-
<p className={isDark ? "text-light opacity-75" : "text-muted"}>
|
|
130
|
-
Let's get you set up
|
|
131
|
-
</p>
|
|
132
|
-
</div>
|
|
133
|
-
|
|
134
|
-
<div className="d-grid gap-3">
|
|
135
|
-
<button
|
|
136
|
-
className="btn btn-lg btn-primary py-3"
|
|
137
|
-
onClick={() => setIsExistingUser(false)}
|
|
138
|
-
>
|
|
139
|
-
<div className="d-flex align-items-center justify-content-center">
|
|
140
|
-
<i className="bi bi-person-plus fs-4 me-2" />
|
|
141
|
-
<div className="text-start">
|
|
142
|
-
<div className="fw-semibold">New account</div>
|
|
143
|
-
<small className="opacity-75">Create a new account on this device</small>
|
|
144
|
-
</div>
|
|
145
|
-
</div>
|
|
146
|
-
</button>
|
|
147
|
-
|
|
148
|
-
<button
|
|
149
|
-
className={`btn btn-lg py-3 ${isDark ? "btn-outline-light" : "btn-outline-primary"}`}
|
|
150
|
-
onClick={() => setShowPairing(true)}
|
|
151
|
-
>
|
|
152
|
-
<div className="d-flex align-items-center justify-content-center">
|
|
153
|
-
<i className="bi bi-phone fs-4 me-2" />
|
|
154
|
-
<div className="text-start">
|
|
155
|
-
<div className="fw-semibold">Sign in from another device</div>
|
|
156
|
-
<small className="opacity-75">
|
|
157
|
-
Show a code to a device that is already signed in
|
|
158
|
-
</small>
|
|
159
|
-
</div>
|
|
160
|
-
</div>
|
|
161
|
-
</button>
|
|
162
|
-
|
|
163
|
-
<details className="text-center mt-2">
|
|
164
|
-
<summary
|
|
165
|
-
className={`small ${isDark ? "text-light opacity-75" : "text-muted"}`}
|
|
166
|
-
style={{ cursor: "pointer" }}
|
|
167
|
-
>
|
|
168
|
-
Advanced
|
|
169
|
-
</summary>
|
|
170
|
-
<button
|
|
171
|
-
type="button"
|
|
172
|
-
className={`btn btn-sm mt-2 ${isDark ? "btn-outline-light" : "btn-outline-secondary"}`}
|
|
173
|
-
onClick={() => setIsExistingUser(true)}
|
|
174
|
-
>
|
|
175
|
-
<i className="bi bi-key me-1" />
|
|
176
|
-
Enter a user ID and secret key
|
|
177
|
-
</button>
|
|
178
|
-
</details>
|
|
179
|
-
</div>
|
|
180
|
-
</div>
|
|
181
|
-
</div>
|
|
182
|
-
</div>
|
|
183
|
-
);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
// Step 2: New User Confirmation
|
|
187
|
-
if (isExistingUser === false) {
|
|
188
|
-
return (
|
|
189
|
-
<div
|
|
190
|
-
className="container-fluid d-flex align-items-start justify-content-center"
|
|
191
|
-
style={{ paddingTop: "20px", backgroundColor: isDark ? "#212529" : "#f8f9fa" }}
|
|
192
|
-
>
|
|
193
|
-
<div
|
|
194
|
-
className="card shadow"
|
|
195
|
-
style={{
|
|
196
|
-
maxWidth: "500px",
|
|
197
|
-
width: "100%",
|
|
198
|
-
backgroundColor: isDark ? "#2d3238" : "#ffffff",
|
|
199
|
-
}}
|
|
200
|
-
>
|
|
201
|
-
<div className="card-body p-4 p-md-5">
|
|
202
|
-
<div className="text-center mb-4">
|
|
203
|
-
<i className="bi bi-person-plus-fill text-primary fs-1 mb-3 d-block" />
|
|
204
|
-
<h3 className={`fw-bold mb-2 ${isDark ? "text-light" : ""}`}>Create New Account</h3>
|
|
205
|
-
<p className={isDark ? "text-light opacity-75" : "text-muted"}>
|
|
206
|
-
We'll generate secure credentials for you
|
|
207
|
-
</p>
|
|
208
|
-
</div>
|
|
209
|
-
|
|
210
|
-
{error && (
|
|
211
|
-
<div className="alert alert-danger" role="alert">
|
|
212
|
-
<i className="bi bi-exclamation-triangle me-2" />
|
|
213
|
-
{error}
|
|
214
|
-
</div>
|
|
215
|
-
)}
|
|
216
|
-
|
|
217
|
-
<div className="d-grid gap-2">
|
|
218
|
-
<button
|
|
219
|
-
className="btn btn-lg btn-primary"
|
|
220
|
-
onClick={handleNewUser}
|
|
221
|
-
disabled={isValidating}
|
|
222
|
-
>
|
|
223
|
-
{isValidating ? (
|
|
224
|
-
<>
|
|
225
|
-
<span className="spinner-border spinner-border-sm me-2" />
|
|
226
|
-
Creating Account...
|
|
227
|
-
</>
|
|
228
|
-
) : (
|
|
229
|
-
<>
|
|
230
|
-
<i className="bi bi-check-circle me-2" />
|
|
231
|
-
Create Account
|
|
232
|
-
</>
|
|
233
|
-
)}
|
|
234
|
-
</button>
|
|
235
|
-
|
|
236
|
-
<button
|
|
237
|
-
className="btn btn-outline-secondary"
|
|
238
|
-
onClick={() => setIsExistingUser(null)}
|
|
239
|
-
disabled={isValidating}
|
|
240
|
-
>
|
|
241
|
-
<i className="bi bi-arrow-left me-2" />
|
|
242
|
-
Back
|
|
243
|
-
</button>
|
|
244
|
-
</div>
|
|
245
|
-
</div>
|
|
246
|
-
</div>
|
|
247
|
-
</div>
|
|
248
|
-
);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
// Step 3: Existing User Sign In
|
|
252
|
-
if (isExistingUser === true) {
|
|
253
|
-
return (
|
|
254
|
-
<div
|
|
255
|
-
className="container-fluid d-flex align-items-start justify-content-center"
|
|
256
|
-
style={{ paddingTop: "20px", backgroundColor: isDark ? "#212529" : "#f8f9fa" }}
|
|
257
|
-
>
|
|
258
|
-
<div
|
|
259
|
-
className="card shadow"
|
|
260
|
-
style={{
|
|
261
|
-
maxWidth: "500px",
|
|
262
|
-
width: "100%",
|
|
263
|
-
backgroundColor: isDark ? "#2d3238" : "#ffffff",
|
|
264
|
-
}}
|
|
265
|
-
>
|
|
266
|
-
<div className="card-body p-4 p-md-5">
|
|
267
|
-
<div className="text-center mb-2">
|
|
268
|
-
<h3 className={`fw-bold mb-2 ${isDark ? "text-light" : ""}`}>
|
|
269
|
-
<span>Sign In</span>
|
|
270
|
-
|
|
271
|
-
<i className="bi bi-box-arrow-in-right text-primary" />
|
|
272
|
-
</h3>
|
|
273
|
-
<p className={isDark ? "text-light opacity-75" : "text-muted"}>
|
|
274
|
-
Paste your user ID and secret key. If you have another signed-in device, “Sign in
|
|
275
|
-
from another device” is easier and safer.
|
|
276
|
-
</p>
|
|
277
|
-
</div>
|
|
278
|
-
|
|
279
|
-
{error && (
|
|
280
|
-
<div className="alert alert-danger" role="alert">
|
|
281
|
-
<i className="bi bi-exclamation-triangle me-2" />
|
|
282
|
-
{error}
|
|
283
|
-
</div>
|
|
284
|
-
)}
|
|
285
|
-
|
|
286
|
-
<form
|
|
287
|
-
onSubmit={(e) => {
|
|
288
|
-
e.preventDefault();
|
|
289
|
-
handleExistingUser();
|
|
290
|
-
}}
|
|
291
|
-
>
|
|
292
|
-
<div className="mb-3">
|
|
293
|
-
<label htmlFor="userId" className="form-label fw-semibold">
|
|
294
|
-
User ID
|
|
295
|
-
</label>
|
|
296
|
-
<input
|
|
297
|
-
id="userId"
|
|
298
|
-
type="text"
|
|
299
|
-
className="form-control form-control-lg"
|
|
300
|
-
placeholder="Enter your user ID"
|
|
301
|
-
value={userId}
|
|
302
|
-
onChange={(e) => setUserId(e.target.value)}
|
|
303
|
-
disabled={isValidating}
|
|
304
|
-
/>
|
|
305
|
-
</div>
|
|
306
|
-
|
|
307
|
-
<div className="mb-4">
|
|
308
|
-
<label htmlFor="secretKey" className="form-label fw-semibold">
|
|
309
|
-
Secret Key
|
|
310
|
-
</label>
|
|
311
|
-
<input
|
|
312
|
-
id="secretKey"
|
|
313
|
-
type="password"
|
|
314
|
-
className="form-control form-control-lg"
|
|
315
|
-
placeholder="Enter your secret key"
|
|
316
|
-
value={secretKey}
|
|
317
|
-
onChange={(e) => setSecretKey(e.target.value)}
|
|
318
|
-
disabled={isValidating}
|
|
319
|
-
/>
|
|
320
|
-
</div>
|
|
321
|
-
|
|
322
|
-
<div className="d-grid gap-2">
|
|
323
|
-
<button type="submit" className="btn btn-lg btn-primary" disabled={isValidating}>
|
|
324
|
-
{isValidating ? (
|
|
325
|
-
<>
|
|
326
|
-
<span className="spinner-border spinner-border-sm me-2" />
|
|
327
|
-
Signing In...
|
|
328
|
-
</>
|
|
329
|
-
) : (
|
|
330
|
-
<>
|
|
331
|
-
<i className="bi bi-check-circle me-2" />
|
|
332
|
-
Sign In
|
|
333
|
-
</>
|
|
334
|
-
)}
|
|
335
|
-
</button>
|
|
336
|
-
|
|
337
|
-
<button
|
|
338
|
-
type="button"
|
|
339
|
-
className="btn btn-outline-secondary"
|
|
340
|
-
onClick={() => setIsExistingUser(null)}
|
|
341
|
-
disabled={isValidating}
|
|
342
|
-
>
|
|
343
|
-
<i className="bi bi-arrow-left me-2" />
|
|
344
|
-
Back
|
|
345
|
-
</button>
|
|
346
|
-
</div>
|
|
347
|
-
</form>
|
|
348
|
-
</div>
|
|
349
|
-
</div>
|
|
350
|
-
</div>
|
|
351
|
-
);
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
return null;
|
|
355
|
-
};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
CONTRACT_REQUEST_CHANNEL,
|
|
3
|
-
inProcessTransportPair,
|
|
4
|
-
newid,
|
|
5
|
-
registerHostContractTransport,
|
|
6
|
-
} from "@peers-app/peers-sdk";
|
|
7
|
-
import { getToolAccessControlConsumer } from "./tool-access-ipc";
|
|
8
|
-
|
|
9
|
-
function setupHost() {
|
|
10
|
-
const calls: Array<{
|
|
11
|
-
dataContextId?: string;
|
|
12
|
-
member: string;
|
|
13
|
-
name: string;
|
|
14
|
-
operation: string;
|
|
15
|
-
}> = [];
|
|
16
|
-
const [consumerTransport, providerTransport] = inProcessTransportPair();
|
|
17
|
-
providerTransport.on(CONTRACT_REQUEST_CHANNEL, (call) => {
|
|
18
|
-
calls.push(call);
|
|
19
|
-
if (call.member === "tool" && call.name === "approve") {
|
|
20
|
-
return { result: { status: "executed" } };
|
|
21
|
-
}
|
|
22
|
-
return undefined;
|
|
23
|
-
});
|
|
24
|
-
return {
|
|
25
|
-
calls,
|
|
26
|
-
dispose: registerHostContractTransport(consumerTransport),
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
describe("Tool Access Control host consumers", () => {
|
|
31
|
-
it("caches per context and scopes calls to the requested context", async () => {
|
|
32
|
-
const host = setupHost();
|
|
33
|
-
const groupContextId = newid();
|
|
34
|
-
const personalContextId = newid();
|
|
35
|
-
const groupConsumer = await getToolAccessControlConsumer(groupContextId);
|
|
36
|
-
|
|
37
|
-
expect(await getToolAccessControlConsumer(groupContextId)).toBe(groupConsumer);
|
|
38
|
-
expect(await getToolAccessControlConsumer(personalContextId)).not.toBe(groupConsumer);
|
|
39
|
-
|
|
40
|
-
await groupConsumer.tools.approve({
|
|
41
|
-
approvalId: newid(),
|
|
42
|
-
nonce: newid(),
|
|
43
|
-
scope: "once",
|
|
44
|
-
});
|
|
45
|
-
expect(host.calls).toContainEqual(
|
|
46
|
-
expect.objectContaining({
|
|
47
|
-
dataContextId: groupContextId,
|
|
48
|
-
member: "tool",
|
|
49
|
-
name: "approve",
|
|
50
|
-
}),
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
host.dispose();
|
|
54
|
-
});
|
|
55
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getToolAccessControlContractDefinition,
|
|
3
|
-
hostContractConsumer,
|
|
4
|
-
type IHostContractConsumer,
|
|
5
|
-
type IToolAccessControlConsumer,
|
|
6
|
-
} from "@peers-app/peers-sdk";
|
|
7
|
-
|
|
8
|
-
const consumers = new Map<string, IHostContractConsumer<IToolAccessControlConsumer>>();
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Return a typed local-host consumer for Tool Access Control in `dataContextId`.
|
|
12
|
-
*
|
|
13
|
-
* One consumer is cached per data context and rebuilt when the host transport changes.
|
|
14
|
-
*/
|
|
15
|
-
export async function getToolAccessControlConsumer(
|
|
16
|
-
dataContextId: string,
|
|
17
|
-
): Promise<IToolAccessControlConsumer> {
|
|
18
|
-
let handle = consumers.get(dataContextId);
|
|
19
|
-
if (!handle) {
|
|
20
|
-
handle = hostContractConsumer<IToolAccessControlConsumer>(
|
|
21
|
-
getToolAccessControlContractDefinition(),
|
|
22
|
-
{ dataContextId: async () => dataContextId },
|
|
23
|
-
);
|
|
24
|
-
consumers.set(dataContextId, handle);
|
|
25
|
-
}
|
|
26
|
-
return handle.get();
|
|
27
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
const list = jest.fn();
|
|
2
|
-
const get = jest.fn();
|
|
3
|
-
const rows = jest.fn();
|
|
4
|
-
const mainContentPath = jest.fn();
|
|
5
|
-
jest.mock("../../globals", () => ({ mainContentPath }));
|
|
6
|
-
let transport = true;
|
|
7
|
-
jest.mock("@peers-app/peers-sdk", () => ({
|
|
8
|
-
getDefaultDataContext: async () => ({ dataContextId: "group" }),
|
|
9
|
-
getHostContractTransport: () => (transport ? {} : undefined),
|
|
10
|
-
getToolCatalogContractDefinition: () => ({}),
|
|
11
|
-
hostContractConsumer: () => ({ get: async () => ({ tools: { listTools: list, getTool: get } }) }),
|
|
12
|
-
Tools: () => ({ list: rows, get: async (toolId: string) => ({ toolId, name: "historical" }) }),
|
|
13
|
-
}));
|
|
14
|
-
|
|
15
|
-
import { toolMentionConfig, valueTypeMentionConfig } from "../../mention-configs";
|
|
16
|
-
import { getToolDetails, listWorkflowMentionTools } from "./tool-catalog-ipc";
|
|
17
|
-
|
|
18
|
-
beforeEach(() => {
|
|
19
|
-
jest.clearAllMocks();
|
|
20
|
-
transport = true;
|
|
21
|
-
});
|
|
22
|
-
test("tool mentions include only workflow-invocable catalog tools", async () => {
|
|
23
|
-
list.mockResolvedValue({
|
|
24
|
-
tools: [
|
|
25
|
-
{ toolId: "run", name: "Run", workflowInvocable: true },
|
|
26
|
-
{ toolId: "approve", name: "Approve", workflowInvocable: false },
|
|
27
|
-
],
|
|
28
|
-
});
|
|
29
|
-
expect(await toolMentionConfig.query("run")).toEqual([{ kind: "tool", id: "run", name: "Run" }]);
|
|
30
|
-
expect(rows).not.toHaveBeenCalled();
|
|
31
|
-
expect(await toolMentionConfig.getById("old")).toEqual({
|
|
32
|
-
kind: "tool",
|
|
33
|
-
id: "old",
|
|
34
|
-
name: "historical",
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
test("type mentions navigate directly through the UI route observable", () => {
|
|
38
|
-
valueTypeMentionConfig.onClick?.({ kind: "valueType", id: "type-id", name: "Type" });
|
|
39
|
-
expect(mainContentPath).toHaveBeenCalledWith("peer-types/type-id");
|
|
40
|
-
});
|
|
41
|
-
test("browser fallback omits quarantined rows and preserves historical detail", async () => {
|
|
42
|
-
transport = false;
|
|
43
|
-
rows.mockResolvedValue([
|
|
44
|
-
{ toolId: "old", name: "Old" },
|
|
45
|
-
{ toolId: "bad", name: "Bad", catalogState: "quarantined" },
|
|
46
|
-
]);
|
|
47
|
-
expect(await listWorkflowMentionTools("", 10)).toEqual([{ toolId: "old", name: "Old" }]);
|
|
48
|
-
expect(await getToolDetails("old")).toEqual({
|
|
49
|
-
row: { toolId: "old", name: "historical" },
|
|
50
|
-
entry: undefined,
|
|
51
|
-
});
|
|
52
|
-
});
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getDefaultDataContext,
|
|
3
|
-
getHostContractTransport,
|
|
4
|
-
getToolCatalogContractDefinition,
|
|
5
|
-
hostContractConsumer,
|
|
6
|
-
type IHostContractConsumer,
|
|
7
|
-
type IToolCatalogConsumer,
|
|
8
|
-
type IToolCatalogEntry,
|
|
9
|
-
Tools,
|
|
10
|
-
} from "@peers-app/peers-sdk";
|
|
11
|
-
|
|
12
|
-
const consumers = new Map<string, IHostContractConsumer<IToolCatalogConsumer>>();
|
|
13
|
-
/** Obtain a catalog consumer for the selected host context; PWA callers can fall back to rows. */
|
|
14
|
-
export async function getToolCatalogConsumer(
|
|
15
|
-
dataContextId?: string,
|
|
16
|
-
): Promise<IToolCatalogConsumer> {
|
|
17
|
-
if (!getHostContractTransport()) throw new Error("Tool catalog host transport unavailable");
|
|
18
|
-
dataContextId ??= (await getDefaultDataContext()).dataContextId;
|
|
19
|
-
let handle = consumers.get(dataContextId);
|
|
20
|
-
if (!handle) {
|
|
21
|
-
const id = dataContextId;
|
|
22
|
-
handle = hostContractConsumer<IToolCatalogConsumer>(getToolCatalogContractDefinition(), {
|
|
23
|
-
dataContextId: async () => id,
|
|
24
|
-
});
|
|
25
|
-
consumers.set(id, handle);
|
|
26
|
-
}
|
|
27
|
-
return handle.get();
|
|
28
|
-
}
|
|
29
|
-
/** Get live tool details, retaining historical row metadata when the host catalog is absent. */
|
|
30
|
-
export async function getToolDetails(toolId: string) {
|
|
31
|
-
const row = await Tools().get(toolId);
|
|
32
|
-
if (!row) return undefined;
|
|
33
|
-
let entry: IToolCatalogEntry | undefined;
|
|
34
|
-
try {
|
|
35
|
-
entry = (await (await getToolCatalogConsumer()).tools.getTool({ toolIdOrName: toolId })).tool;
|
|
36
|
-
} catch {
|
|
37
|
-
/* Browser-only hosts retain catalog rows. */
|
|
38
|
-
}
|
|
39
|
-
return { row, entry };
|
|
40
|
-
}
|
|
41
|
-
/** Query workflow mention candidates; unavailable browser hosts retain non-quarantined rows. */
|
|
42
|
-
export async function listWorkflowMentionTools(query: string, limit: number) {
|
|
43
|
-
try {
|
|
44
|
-
const { tools } = await (await getToolCatalogConsumer()).tools.listTools({ query, limit: 500 });
|
|
45
|
-
return tools.filter((entry) => entry.workflowInvocable).slice(0, limit);
|
|
46
|
-
} catch {
|
|
47
|
-
return (await Tools().list({ name: { $matchWords: query } }, { pageSize: 500 }))
|
|
48
|
-
.filter((row) => row.catalogState !== "quarantined")
|
|
49
|
-
.slice(0, limit);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { LoadingIndicator } from "../../components/loading-indicator";
|
|
2
|
-
import { ScreenTabBody, Tabs } from "../../components/tabs";
|
|
3
|
-
import { usePromise } from "../../hooks";
|
|
4
|
-
import { updateActiveTabTitle } from "../../tabs-layout/tabs-state";
|
|
5
|
-
import { getToolDetails } from "./tool-catalog-ipc";
|
|
6
|
-
import { ToolInfo } from "./tool-info";
|
|
7
|
-
import { ToolSchema } from "./tool-schema";
|
|
8
|
-
|
|
9
|
-
/** Read-only permanent tool metadata and live provider details. */
|
|
10
|
-
export const ToolDetails = (props: { toolId: string }) => {
|
|
11
|
-
const details = usePromise(
|
|
12
|
-
async () => {
|
|
13
|
-
const details = await getToolDetails(props.toolId);
|
|
14
|
-
if (details) updateActiveTabTitle(details.entry?.name || details.row.name || "Tool");
|
|
15
|
-
return details ?? null;
|
|
16
|
-
},
|
|
17
|
-
undefined,
|
|
18
|
-
[props.toolId],
|
|
19
|
-
);
|
|
20
|
-
if (details === null) return <div>Tool not found</div>;
|
|
21
|
-
if (!details) return <LoadingIndicator />;
|
|
22
|
-
const { row, entry } = details;
|
|
23
|
-
return (
|
|
24
|
-
<div className="container-fluid p-3">
|
|
25
|
-
<h4>
|
|
26
|
-
<i className="bi bi-tools me-2" />
|
|
27
|
-
{entry?.name ?? row.name}
|
|
28
|
-
</h4>
|
|
29
|
-
<Tabs
|
|
30
|
-
key={row.toolId}
|
|
31
|
-
tabs={[
|
|
32
|
-
{
|
|
33
|
-
name: "Info",
|
|
34
|
-
content: (
|
|
35
|
-
<ScreenTabBody>
|
|
36
|
-
<ToolInfo tool={row} entry={entry} />
|
|
37
|
-
</ScreenTabBody>
|
|
38
|
-
),
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
name: "Schema",
|
|
42
|
-
content: (
|
|
43
|
-
<ScreenTabBody>
|
|
44
|
-
<ToolSchema tool={row} entry={entry} />
|
|
45
|
-
</ScreenTabBody>
|
|
46
|
-
),
|
|
47
|
-
},
|
|
48
|
-
]}
|
|
49
|
-
/>
|
|
50
|
-
</div>
|
|
51
|
-
);
|
|
52
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { getAccessLevelLabel, type ITool, type IToolCatalogEntry } from "@peers-app/peers-sdk";
|
|
2
|
-
import { MarkdownWithMentions } from "../../components/markdown-with-mentions";
|
|
3
|
-
|
|
4
|
-
/** Display permanent identity and the host’s current dispatch and access projection. */
|
|
5
|
-
export const ToolInfo = ({ tool, entry }: { tool: ITool; entry?: IToolCatalogEntry }) => {
|
|
6
|
-
const target = entry?.target;
|
|
7
|
-
const level = entry?.access?.accessLevel;
|
|
8
|
-
return (
|
|
9
|
-
<div>
|
|
10
|
-
{tool.isAssistantRunner && <span className="badge bg-secondary">Assistant runner</span>}
|
|
11
|
-
<dl>
|
|
12
|
-
<dt>ID</dt>
|
|
13
|
-
<dd>{tool.toolId}</dd>
|
|
14
|
-
<dt>Aliases</dt>
|
|
15
|
-
<dd>{entry?.aliases.join(", ") ?? tool.toolId}</dd>
|
|
16
|
-
<dt>Contract</dt>
|
|
17
|
-
<dd>
|
|
18
|
-
{target
|
|
19
|
-
? `${target.contractId}@${target.version}`
|
|
20
|
-
: tool.contractId
|
|
21
|
-
? `${tool.contractId}@${tool.contractVersion}`
|
|
22
|
-
: "Unresolved"}
|
|
23
|
-
</dd>
|
|
24
|
-
<dt>Member</dt>
|
|
25
|
-
<dd>{target?.toolName ?? tool.toolName ?? tool.name}</dd>
|
|
26
|
-
<dt>Provider</dt>
|
|
27
|
-
<dd>{entry?.provider?.activePackageId ?? "Unavailable"}</dd>
|
|
28
|
-
<dt>Dispatch</dt>
|
|
29
|
-
<dd>
|
|
30
|
-
{entry?.availability.dispatch ?? "Host catalog unavailable"}
|
|
31
|
-
{entry?.availability.message && `: ${entry.availability.message}`}
|
|
32
|
-
</dd>
|
|
33
|
-
<dt>Live access</dt>
|
|
34
|
-
<dd>{level === undefined ? "Unavailable" : `${getAccessLevelLabel(level)} (${level})`}</dd>
|
|
35
|
-
<dt>Workflow</dt>
|
|
36
|
-
<dd>
|
|
37
|
-
{entry ? (entry.workflowInvocable ? "Available" : "Excluded or unavailable") : "Unknown"}
|
|
38
|
-
{entry?.availability.requiresWorkflowRun && "; workflow run required"}
|
|
39
|
-
</dd>
|
|
40
|
-
</dl>
|
|
41
|
-
<MarkdownWithMentions content={entry?.usageDescription ?? tool.usageDescription} />
|
|
42
|
-
{tool.detailedDescription && <MarkdownWithMentions content={tool.detailedDescription} />}
|
|
43
|
-
</div>
|
|
44
|
-
);
|
|
45
|
-
};
|