@dxos/plugin-observability 0.8.4-main.f9ba587 → 0.8.4-main.fcc0d83b33
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/lib/browser/ObservabilitySettings-H6UKYDDT.mjs +27 -0
- package/dist/lib/browser/ObservabilitySettings-H6UKYDDT.mjs.map +7 -0
- package/dist/lib/browser/capture-user-feedback-3BXDUCZM.mjs +24 -0
- package/dist/lib/browser/capture-user-feedback-3BXDUCZM.mjs.map +7 -0
- package/dist/lib/browser/chunk-DLBA63VM.mjs +83 -0
- package/dist/lib/browser/chunk-DLBA63VM.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-VQC6DG6V.mjs +53 -0
- package/dist/lib/browser/chunk-VQC6DG6V.mjs.map +7 -0
- package/dist/lib/browser/cli/index.mjs +20 -0
- package/dist/lib/browser/cli/index.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +105 -114
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operations/index.mjs +15 -0
- package/dist/lib/browser/operations/index.mjs.map +7 -0
- package/dist/lib/browser/send-event-F3D32CJX.mjs +22 -0
- package/dist/lib/browser/send-event-F3D32CJX.mjs.map +7 -0
- package/dist/lib/browser/toggle-PPNDFGWJ.mjs +47 -0
- package/dist/lib/browser/toggle-PPNDFGWJ.mjs.map +7 -0
- package/dist/lib/browser/translations.mjs +33 -0
- package/dist/lib/browser/translations.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +16 -0
- package/dist/lib/node-esm/ObservabilitySettings-HXTWPHHR.mjs +28 -0
- package/dist/lib/node-esm/ObservabilitySettings-HXTWPHHR.mjs.map +7 -0
- package/dist/lib/node-esm/capture-user-feedback-LUPWJWGK.mjs +25 -0
- package/dist/lib/node-esm/capture-user-feedback-LUPWJWGK.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-3B7HMSKM.mjs +84 -0
- package/dist/lib/node-esm/chunk-3B7HMSKM.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-NCIKZY6L.mjs +54 -0
- package/dist/lib/node-esm/chunk-NCIKZY6L.mjs.map +7 -0
- package/dist/lib/node-esm/cli/index.mjs +21 -0
- package/dist/lib/node-esm/cli/index.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +105 -114
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operations/index.mjs +16 -0
- package/dist/lib/node-esm/operations/index.mjs.map +7 -0
- package/dist/lib/node-esm/send-event-OKTEXC7M.mjs +23 -0
- package/dist/lib/node-esm/send-event-OKTEXC7M.mjs.map +7 -0
- package/dist/lib/node-esm/toggle-YS2KFMXS.mjs +48 -0
- package/dist/lib/node-esm/toggle-YS2KFMXS.mjs.map +7 -0
- package/dist/lib/node-esm/translations.mjs +34 -0
- package/dist/lib/node-esm/translations.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +17 -0
- package/dist/lib/node-esm/types/index.mjs.map +7 -0
- package/dist/types/src/ObservabilityPlugin.d.ts +10 -3
- package/dist/types/src/ObservabilityPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +4 -2
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/client-ready.d.ts +5 -5
- package/dist/types/src/capabilities/client-ready.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +16 -15
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +5 -2
- package/dist/types/src/capabilities/settings.d.ts.map +1 -1
- package/dist/types/src/capabilities/state.d.ts +10 -3
- package/dist/types/src/capabilities/state.d.ts.map +1 -1
- package/dist/types/src/cli/index.d.ts +2 -0
- package/dist/types/src/cli/index.d.ts.map +1 -0
- package/dist/types/src/cli/plugin.d.ts +3 -0
- package/dist/types/src/cli/plugin.d.ts.map +1 -0
- package/dist/types/src/components/FeedbackForm/FeedbackForm.d.ts +9 -0
- package/dist/types/src/components/FeedbackForm/FeedbackForm.d.ts.map +1 -0
- package/dist/types/src/components/FeedbackForm/FeedbackForm.stories.d.ts +36 -0
- package/dist/types/src/components/FeedbackForm/FeedbackForm.stories.d.ts.map +1 -0
- package/dist/types/src/components/FeedbackForm/index.d.ts +2 -0
- package/dist/types/src/components/FeedbackForm/index.d.ts.map +1 -0
- package/dist/types/src/components/ObservabilitySettings/ObservabilitySettings.d.ts +6 -0
- package/dist/types/src/components/ObservabilitySettings/ObservabilitySettings.d.ts.map +1 -0
- package/dist/types/src/components/ObservabilitySettings/ObservabilitySettings.stories.d.ts +36 -0
- package/dist/types/src/components/ObservabilitySettings/ObservabilitySettings.stories.d.ts.map +1 -0
- package/dist/types/src/components/ObservabilitySettings/index.d.ts +2 -0
- package/dist/types/src/components/ObservabilitySettings/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +2 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/HelpContainer/HelpContainer.d.ts +4 -0
- package/dist/types/src/containers/HelpContainer/HelpContainer.d.ts.map +1 -0
- package/dist/types/src/containers/HelpContainer/index.d.ts +2 -0
- package/dist/types/src/containers/HelpContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +3 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/index.d.ts +1 -2
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/capture-user-feedback.d.ts +5 -0
- package/dist/types/src/operations/capture-user-feedback.d.ts.map +1 -0
- package/dist/types/src/operations/definitions.d.ts +23 -0
- package/dist/types/src/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +5 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/send-event.d.ts +5 -0
- package/dist/types/src/operations/send-event.d.ts.map +1 -0
- package/dist/types/src/operations/toggle.d.ts +5 -0
- package/dist/types/src/operations/toggle.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +17 -16
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Settings.d.ts +7 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/types/capabilities.d.ts +31 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/events.d.ts +6 -0
- package/dist/types/src/types/events.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +4 -0
- package/dist/types/src/types/index.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +73 -45
- package/src/ObservabilityPlugin.ts +72 -54
- package/src/capabilities/app-graph-builder.ts +28 -37
- package/src/capabilities/client-ready.ts +89 -79
- package/src/capabilities/index.ts +12 -8
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +33 -19
- package/src/capabilities/settings.ts +26 -14
- package/src/capabilities/state.ts +20 -12
- package/src/cli/index.ts +5 -0
- package/src/cli/plugin.ts +31 -0
- package/src/components/FeedbackForm/FeedbackForm.stories.tsx +44 -0
- package/src/components/FeedbackForm/FeedbackForm.tsx +49 -0
- package/src/components/FeedbackForm/index.ts +5 -0
- package/src/components/ObservabilitySettings/ObservabilitySettings.stories.tsx +34 -0
- package/src/components/ObservabilitySettings/ObservabilitySettings.tsx +34 -0
- package/src/components/ObservabilitySettings/index.ts +5 -0
- package/src/components/index.ts +4 -2
- package/src/containers/HelpContainer/HelpContainer.tsx +57 -0
- package/src/containers/HelpContainer/index.ts +5 -0
- package/src/containers/index.ts +7 -0
- package/src/index.ts +1 -2
- package/src/meta.ts +8 -5
- package/src/operations/capture-user-feedback.ts +22 -0
- package/src/operations/definitions.ts +76 -0
- package/src/operations/index.ts +14 -0
- package/src/operations/send-event.ts +24 -0
- package/src/operations/toggle.ts +47 -0
- package/src/translations.ts +17 -16
- package/src/types/Settings.ts +22 -0
- package/src/types/capabilities.ts +44 -0
- package/src/types/events.ts +15 -0
- package/src/types/index.ts +7 -0
- package/dist/lib/browser/app-graph-builder-DCOBBL5B.mjs +0 -43
- package/dist/lib/browser/app-graph-builder-DCOBBL5B.mjs.map +0 -7
- package/dist/lib/browser/chunk-57RVSKYP.mjs +0 -13
- package/dist/lib/browser/chunk-57RVSKYP.mjs.map +0 -7
- package/dist/lib/browser/chunk-D7WLH4F5.mjs +0 -179
- package/dist/lib/browser/chunk-D7WLH4F5.mjs.map +0 -7
- package/dist/lib/browser/chunk-N3VKS2LF.mjs +0 -175
- package/dist/lib/browser/chunk-N3VKS2LF.mjs.map +0 -7
- package/dist/lib/browser/chunk-UUOBAWT2.mjs +0 -18
- package/dist/lib/browser/chunk-UUOBAWT2.mjs.map +0 -7
- package/dist/lib/browser/client-ready-KK3EWEBV.mjs +0 -102
- package/dist/lib/browser/client-ready-KK3EWEBV.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-A4EV25OK.mjs +0 -77
- package/dist/lib/browser/intent-resolver-A4EV25OK.mjs.map +0 -7
- package/dist/lib/browser/react-surface-FUXMXVYO.mjs +0 -32
- package/dist/lib/browser/react-surface-FUXMXVYO.mjs.map +0 -7
- package/dist/lib/browser/settings-OSMKJOUM.mjs +0 -25
- package/dist/lib/browser/settings-OSMKJOUM.mjs.map +0 -7
- package/dist/lib/browser/state-VIOQS2IL.mjs +0 -26
- package/dist/lib/browser/state-VIOQS2IL.mjs.map +0 -7
- package/dist/lib/browser/types.mjs +0 -10
- package/dist/lib/node-esm/app-graph-builder-6JT2RPVM.mjs +0 -44
- package/dist/lib/node-esm/app-graph-builder-6JT2RPVM.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-4BFWCQJ5.mjs +0 -180
- package/dist/lib/node-esm/chunk-4BFWCQJ5.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7XR7KMAA.mjs +0 -15
- package/dist/lib/node-esm/chunk-7XR7KMAA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-JTKEM7PT.mjs +0 -19
- package/dist/lib/node-esm/chunk-JTKEM7PT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RG73SOOD.mjs +0 -176
- package/dist/lib/node-esm/chunk-RG73SOOD.mjs.map +0 -7
- package/dist/lib/node-esm/client-ready-EZVAX7D5.mjs +0 -103
- package/dist/lib/node-esm/client-ready-EZVAX7D5.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-7HLSOM7X.mjs +0 -78
- package/dist/lib/node-esm/intent-resolver-7HLSOM7X.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-TYVAHN2E.mjs +0 -33
- package/dist/lib/node-esm/react-surface-TYVAHN2E.mjs.map +0 -7
- package/dist/lib/node-esm/settings-S2OXVO3G.mjs +0 -26
- package/dist/lib/node-esm/settings-S2OXVO3G.mjs.map +0 -7
- package/dist/lib/node-esm/state-J2WS6L64.mjs +0 -27
- package/dist/lib/node-esm/state-J2WS6L64.mjs.map +0 -7
- package/dist/lib/node-esm/types.mjs +0 -11
- package/dist/types/src/capabilities/capabilities.d.ts +0 -12
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -7
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/components/FeedbackForm.d.ts +0 -6
- package/dist/types/src/components/FeedbackForm.d.ts.map +0 -1
- package/dist/types/src/components/HelpContainer.d.ts +0 -3
- package/dist/types/src/components/HelpContainer.d.ts.map +0 -1
- package/dist/types/src/components/ObservabilitySettings.d.ts +0 -10
- package/dist/types/src/components/ObservabilitySettings.d.ts.map +0 -1
- package/dist/types/src/events.d.ts +0 -5
- package/dist/types/src/events.d.ts.map +0 -1
- package/dist/types/src/types.d.ts +0 -286
- package/dist/types/src/types.d.ts.map +0 -1
- package/src/capabilities/capabilities.ts +0 -22
- package/src/capabilities/intent-resolver.ts +0 -68
- package/src/components/FeedbackForm.tsx +0 -82
- package/src/components/HelpContainer.tsx +0 -40
- package/src/components/ObservabilitySettings.tsx +0 -48
- package/src/events.ts +0 -14
- package/src/types.ts +0 -203
- /package/dist/lib/browser/{types.mjs.map → chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/{node-esm/types.mjs.map → browser/types/index.mjs.map} +0 -0
|
@@ -2,26 +2,40 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
5
6
|
import React from 'react';
|
|
6
7
|
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
8
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
|
+
import { Surface, useOperationInvoker, useSettingsState } from '@dxos/app-framework/ui';
|
|
10
|
+
import { AppSurface } from '@dxos/app-toolkit/ui';
|
|
9
11
|
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
+
import { ObservabilitySettings } from '#components';
|
|
13
|
+
import { HelpContainer } from '#containers';
|
|
14
|
+
import { meta } from '#meta';
|
|
15
|
+
import { ObservabilityOperation } from '#operations';
|
|
16
|
+
import { type Settings } from '#types';
|
|
12
17
|
|
|
13
|
-
export default () =>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
export default Capability.makeModule(() =>
|
|
19
|
+
Effect.succeed(
|
|
20
|
+
Capability.contributes(Capabilities.ReactSurface, [
|
|
21
|
+
Surface.create({
|
|
22
|
+
id: 'root',
|
|
23
|
+
filter: AppSurface.settings(AppSurface.Article, meta.id),
|
|
24
|
+
component: ({ data: { subject } }) => {
|
|
25
|
+
const { settings } = useSettingsState<Settings.Settings>(subject.atom);
|
|
26
|
+
const { invokePromise } = useOperationInvoker();
|
|
27
|
+
const handleSettingsChange = (cb: (current: Settings.Settings) => Settings.Settings) => {
|
|
28
|
+
const next = cb(settings);
|
|
29
|
+
void invokePromise(ObservabilityOperation.Toggle, { state: next.enabled });
|
|
30
|
+
};
|
|
31
|
+
return <ObservabilitySettings settings={settings} onSettingsChange={handleSettingsChange} />;
|
|
32
|
+
},
|
|
33
|
+
}),
|
|
34
|
+
Surface.create({
|
|
35
|
+
id: 'help',
|
|
36
|
+
role: 'deck-companion--help',
|
|
37
|
+
component: () => <HelpContainer />,
|
|
38
|
+
}),
|
|
39
|
+
]),
|
|
40
|
+
),
|
|
41
|
+
);
|
|
@@ -2,20 +2,32 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import { live } from '@dxos/live-object';
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
7
6
|
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
9
|
+
import { createKvsStore } from '@dxos/effect';
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
enabled: true,
|
|
14
|
-
});
|
|
11
|
+
import { meta } from '#meta';
|
|
12
|
+
import { ObservabilityCapabilities, Settings } from '#types';
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
14
|
+
export default Capability.makeModule(() =>
|
|
15
|
+
Effect.sync(() => {
|
|
16
|
+
const settingsAtom = createKvsStore({
|
|
17
|
+
key: meta.id,
|
|
18
|
+
schema: Settings.Settings,
|
|
19
|
+
defaultValue: () => ({
|
|
20
|
+
enabled: true,
|
|
21
|
+
}),
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
return [
|
|
25
|
+
Capability.contributes(ObservabilityCapabilities.Settings, settingsAtom),
|
|
26
|
+
Capability.contributes(AppCapabilities.Settings, {
|
|
27
|
+
prefix: meta.id,
|
|
28
|
+
schema: Settings.Settings,
|
|
29
|
+
atom: settingsAtom,
|
|
30
|
+
}),
|
|
31
|
+
];
|
|
32
|
+
}),
|
|
33
|
+
);
|
|
@@ -2,20 +2,28 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import { LocalStorageStore } from '@dxos/local-storage';
|
|
7
|
-
import { getObservabilityGroup } from '@dxos/observability';
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
8
6
|
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
7
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
|
+
import { createKvsStore } from '@dxos/effect';
|
|
9
|
+
import { Observability } from '@dxos/observability';
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
import { meta } from '#meta';
|
|
12
|
+
import { ObservabilityCapabilities } from '#types';
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
export default Capability.makeModule(
|
|
15
|
+
Effect.fnUntraced(function* ({ namespace }: { namespace: string }) {
|
|
16
|
+
const stateAtom = createKvsStore({
|
|
17
|
+
key: meta.id,
|
|
18
|
+
schema: ObservabilityCapabilities.StateSchema,
|
|
19
|
+
defaultValue: () => ({}),
|
|
20
|
+
});
|
|
16
21
|
|
|
17
|
-
|
|
18
|
-
|
|
22
|
+
// NOTE: Group is set at runtime, not persisted.
|
|
23
|
+
const group = yield* Effect.tryPromise(() => Observability.getObservabilityGroup(namespace));
|
|
24
|
+
const registry = yield* Capability.get(Capabilities.AtomRegistry);
|
|
25
|
+
registry.set(stateAtom, { ...registry.get(stateAtom), group });
|
|
19
26
|
|
|
20
|
-
|
|
21
|
-
}
|
|
27
|
+
return Capability.contributes(ObservabilityCapabilities.State, stateAtom);
|
|
28
|
+
}),
|
|
29
|
+
);
|
package/src/cli/index.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capabilities, Capability, Plugin } from '@dxos/app-framework';
|
|
8
|
+
import { AppPlugin } from '@dxos/app-toolkit';
|
|
9
|
+
import { Operation, OperationHandlerSet } from '@dxos/compute';
|
|
10
|
+
|
|
11
|
+
import { meta } from '#meta';
|
|
12
|
+
import { ObservabilityOperation } from '#operations';
|
|
13
|
+
|
|
14
|
+
// TODO(wittjosiah): Hook up.
|
|
15
|
+
export const ObservabilityPlugin = Plugin.define(meta).pipe(
|
|
16
|
+
AppPlugin.addOperationHandlerModule({
|
|
17
|
+
activate: Capability.lazy('OperationHandler', () =>
|
|
18
|
+
Promise.resolve({
|
|
19
|
+
default: Capability.makeModule<OperationHandlerSet.OperationHandlerSet>(
|
|
20
|
+
Effect.fnUntraced(function* () {
|
|
21
|
+
return Capability.contributes(
|
|
22
|
+
Capabilities.OperationHandler,
|
|
23
|
+
OperationHandlerSet.make(Operation.withHandler(ObservabilityOperation.SendEvent, () => Effect.void)),
|
|
24
|
+
);
|
|
25
|
+
}),
|
|
26
|
+
),
|
|
27
|
+
}),
|
|
28
|
+
),
|
|
29
|
+
}),
|
|
30
|
+
Plugin.make,
|
|
31
|
+
);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
|
|
7
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
8
|
+
|
|
9
|
+
import { translations } from '#translations';
|
|
10
|
+
|
|
11
|
+
import { FeedbackForm } from './FeedbackForm';
|
|
12
|
+
|
|
13
|
+
const meta = {
|
|
14
|
+
title: 'plugins/plugin-observability/components/FeedbackForm',
|
|
15
|
+
component: FeedbackForm,
|
|
16
|
+
decorators: [withTheme(), withLayout({ layout: 'column' })],
|
|
17
|
+
parameters: {
|
|
18
|
+
layout: 'fullscreen',
|
|
19
|
+
translations,
|
|
20
|
+
},
|
|
21
|
+
} satisfies Meta<typeof FeedbackForm>;
|
|
22
|
+
|
|
23
|
+
export default meta;
|
|
24
|
+
|
|
25
|
+
type Story = StoryObj<typeof meta>;
|
|
26
|
+
|
|
27
|
+
export const Default: Story = {
|
|
28
|
+
args: {
|
|
29
|
+
onSave: (values) => {
|
|
30
|
+
console.log(values);
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export const WithDownloadLogs: Story = {
|
|
36
|
+
args: {
|
|
37
|
+
onSave: (values) => {
|
|
38
|
+
console.log(values);
|
|
39
|
+
},
|
|
40
|
+
onDownloadLogs: () => {
|
|
41
|
+
console.log('download logs clicked');
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { IconButton, useTranslation } from '@dxos/react-ui';
|
|
8
|
+
import { Form, type FormRootProps, type FormSubmitProps } from '@dxos/react-ui-form';
|
|
9
|
+
|
|
10
|
+
import { meta } from '#meta';
|
|
11
|
+
import { UserFeedback } from '#operations';
|
|
12
|
+
|
|
13
|
+
export type FeedbackFormProps = Pick<FormRootProps<UserFeedback>, 'onSave'> &
|
|
14
|
+
Pick<FormSubmitProps, 'disabled'> & {
|
|
15
|
+
/** Optional handler — when supplied a "Download logs" button is rendered below the submit action. */
|
|
16
|
+
onDownloadLogs?: () => void | Promise<void>;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const defaultValues: UserFeedback = {
|
|
20
|
+
message: '',
|
|
21
|
+
includeLogs: true,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const FeedbackForm = ({ onSave, disabled, onDownloadLogs }: FeedbackFormProps) => {
|
|
25
|
+
const { t } = useTranslation(meta.id);
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<Form.Root schema={UserFeedback} defaultValues={defaultValues} onSave={onSave}>
|
|
29
|
+
<Form.Viewport>
|
|
30
|
+
<Form.Content>
|
|
31
|
+
<Form.FieldSet />
|
|
32
|
+
<Form.Submit icon='ph--paper-plane-tilt--regular' label={t('send-feedback.label')} disabled={disabled} />
|
|
33
|
+
{onDownloadLogs && (
|
|
34
|
+
<div role='none' className='flex w-full pt-form-padding'>
|
|
35
|
+
<IconButton
|
|
36
|
+
classNames='w-full'
|
|
37
|
+
type='button'
|
|
38
|
+
icon='ph--download-simple--regular'
|
|
39
|
+
label={t('download-logs.label')}
|
|
40
|
+
onClick={() => void onDownloadLogs()}
|
|
41
|
+
data-testid='download-logs-button'
|
|
42
|
+
/>
|
|
43
|
+
</div>
|
|
44
|
+
)}
|
|
45
|
+
</Form.Content>
|
|
46
|
+
</Form.Viewport>
|
|
47
|
+
</Form.Root>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
|
|
7
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
8
|
+
|
|
9
|
+
import { translations } from '#translations';
|
|
10
|
+
|
|
11
|
+
import { ObservabilitySettings } from './ObservabilitySettings';
|
|
12
|
+
|
|
13
|
+
const meta = {
|
|
14
|
+
title: 'plugins/plugin-observability/components/ObservabilitySettings',
|
|
15
|
+
component: ObservabilitySettings,
|
|
16
|
+
tags: ['settings'],
|
|
17
|
+
decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
|
|
18
|
+
parameters: {
|
|
19
|
+
layout: 'fullscreen',
|
|
20
|
+
translations,
|
|
21
|
+
},
|
|
22
|
+
} satisfies Meta<typeof ObservabilitySettings>;
|
|
23
|
+
|
|
24
|
+
export default meta;
|
|
25
|
+
|
|
26
|
+
type Story = StoryObj<typeof meta>;
|
|
27
|
+
|
|
28
|
+
export const Default: Story = {
|
|
29
|
+
args: {
|
|
30
|
+
settings: {
|
|
31
|
+
enabled: true,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { type AppSurface } from '@dxos/app-toolkit/ui';
|
|
8
|
+
import { Message, useTranslation } from '@dxos/react-ui';
|
|
9
|
+
import { Settings as SettingsForm } from '@dxos/react-ui-form';
|
|
10
|
+
|
|
11
|
+
import { meta } from '#meta';
|
|
12
|
+
import { Settings } from '#types';
|
|
13
|
+
|
|
14
|
+
export type ObservabilitySettingsProps = AppSurface.SettingsArticleProps<Settings.Settings>;
|
|
15
|
+
|
|
16
|
+
export const ObservabilitySettings = ({ settings, onSettingsChange }: ObservabilitySettingsProps) => {
|
|
17
|
+
const { t } = useTranslation(meta.id);
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<SettingsForm.Viewport>
|
|
21
|
+
<SettingsForm.Section title={t('settings.title', { ns: meta.id })}>
|
|
22
|
+
<Message.Root valence='info'>
|
|
23
|
+
<Message.Content>{t('observability.description')}</Message.Content>
|
|
24
|
+
</Message.Root>
|
|
25
|
+
<SettingsForm.FieldSet
|
|
26
|
+
readonly={!onSettingsChange}
|
|
27
|
+
schema={Settings.Settings}
|
|
28
|
+
values={settings}
|
|
29
|
+
onValuesChanged={(values) => onSettingsChange?.(() => values)}
|
|
30
|
+
/>
|
|
31
|
+
</SettingsForm.Section>
|
|
32
|
+
</SettingsForm.Viewport>
|
|
33
|
+
);
|
|
34
|
+
};
|
package/src/components/index.ts
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { type ComponentType, lazy } from 'react';
|
|
6
|
+
|
|
5
7
|
export * from './FeedbackForm';
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
+
|
|
9
|
+
export const ObservabilitySettings: ComponentType<any> = lazy(() => import('./ObservabilitySettings'));
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import React, { useCallback, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
import { useCapabilities, useCapability, useOperationInvoker } from '@dxos/app-framework/ui';
|
|
9
|
+
import { LayoutOperation } from '@dxos/app-toolkit';
|
|
10
|
+
import { runAndForwardErrors } from '@dxos/effect';
|
|
11
|
+
import { useAsyncEffect } from '@dxos/react-hooks';
|
|
12
|
+
import { osTranslations } from '@dxos/ui-theme';
|
|
13
|
+
|
|
14
|
+
import { FeedbackForm } from '#components';
|
|
15
|
+
import { meta } from '#meta';
|
|
16
|
+
import { ObservabilityOperation, type UserFeedback } from '#operations';
|
|
17
|
+
import { ObservabilityCapabilities } from '#types';
|
|
18
|
+
|
|
19
|
+
/** Renders the feedback form, disabling it when the feedback survey is unavailable. */
|
|
20
|
+
export const HelpContainer = () => {
|
|
21
|
+
const { invokePromise } = useOperationInvoker();
|
|
22
|
+
const observability = useCapability(ObservabilityCapabilities.Observability);
|
|
23
|
+
const [downloadLogs] = useCapabilities(ObservabilityCapabilities.LogDownloader);
|
|
24
|
+
const [feedbackAvailable, setFeedbackAvailable] = useState(false);
|
|
25
|
+
|
|
26
|
+
useAsyncEffect(
|
|
27
|
+
async (controller) => {
|
|
28
|
+
const available = await observability.isAvailable('feedback').pipe(
|
|
29
|
+
Effect.catchAll(() => Effect.succeed(false)),
|
|
30
|
+
Effect.catchAllDefect(() => Effect.succeed(false)),
|
|
31
|
+
runAndForwardErrors,
|
|
32
|
+
);
|
|
33
|
+
if (!controller.signal.aborted) {
|
|
34
|
+
setFeedbackAvailable(available);
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
[observability],
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
const handleSave = useCallback(
|
|
41
|
+
async (values: UserFeedback) => {
|
|
42
|
+
await invokePromise(ObservabilityOperation.CaptureUserFeedback, values);
|
|
43
|
+
await invokePromise(LayoutOperation.UpdateComplementary, { state: 'collapsed' });
|
|
44
|
+
await invokePromise(LayoutOperation.AddToast, {
|
|
45
|
+
id: `${meta.id}.feedback-success`,
|
|
46
|
+
icon: 'ph--paper-plane-tilt--regular',
|
|
47
|
+
duration: 3000,
|
|
48
|
+
title: ['feedback-toast.label', { ns: meta.id }],
|
|
49
|
+
description: ['feedback-toast.description', { ns: meta.id }],
|
|
50
|
+
closeLabel: ['close.label', { ns: osTranslations }],
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
[invokePromise],
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
return <FeedbackForm onSave={handleSave} disabled={!feedbackAvailable} onDownloadLogs={downloadLogs} />;
|
|
57
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
export { ObservabilityCapabilities } from './
|
|
6
|
-
export { ObservabilityEvents } from './events';
|
|
5
|
+
export { ObservabilityCapabilities, ObservabilityEvents } from './types';
|
|
7
6
|
export * from './components';
|
|
8
7
|
export * from './meta';
|
|
9
8
|
export * from './ObservabilityPlugin';
|
package/src/meta.ts
CHANGED
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
// Copyright 2023 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Plugin } from '@dxos/app-framework';
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
6
7
|
|
|
7
|
-
export const
|
|
8
|
-
|
|
9
|
-
export const meta: PluginMeta = {
|
|
10
|
-
id: OBSERVABILITY_PLUGIN,
|
|
8
|
+
export const meta: Plugin.Meta = {
|
|
9
|
+
id: 'org.dxos.plugin.observability',
|
|
11
10
|
name: 'Telemetry',
|
|
11
|
+
description: trim`
|
|
12
|
+
Application observability and telemetry collection for monitoring performance and usage patterns.
|
|
13
|
+
Track metrics, logs, and traces for system health and analytics.
|
|
14
|
+
`,
|
|
12
15
|
icon: 'ph--eye--regular',
|
|
13
16
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
9
|
+
|
|
10
|
+
import { ObservabilityCapabilities } from '../types';
|
|
11
|
+
import { CaptureUserFeedback } from './definitions';
|
|
12
|
+
|
|
13
|
+
const handler: Operation.WithHandler<typeof CaptureUserFeedback> = CaptureUserFeedback.pipe(
|
|
14
|
+
Operation.withHandler(
|
|
15
|
+
Effect.fnUntraced(function* (input) {
|
|
16
|
+
const observability = yield* Capability.get(ObservabilityCapabilities.Observability);
|
|
17
|
+
observability.feedback.captureUserFeedback({ message: input.message, includeLogs: input.includeLogs });
|
|
18
|
+
}),
|
|
19
|
+
),
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
export default handler;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
9
|
+
import { Format } from '@dxos/echo';
|
|
10
|
+
|
|
11
|
+
import { meta } from '#meta';
|
|
12
|
+
import { translations } from '#translations';
|
|
13
|
+
|
|
14
|
+
const t = translations[0]['en-US'][meta.id];
|
|
15
|
+
|
|
16
|
+
export const UserFeedback = Schema.Struct({
|
|
17
|
+
message: Format.Text.pipe(
|
|
18
|
+
Schema.nonEmptyString(),
|
|
19
|
+
Schema.maxLength(4_096),
|
|
20
|
+
Schema.annotations({
|
|
21
|
+
title: t['feedback-textarea.label'],
|
|
22
|
+
description: t['feedback-textarea.placeholder'],
|
|
23
|
+
}),
|
|
24
|
+
),
|
|
25
|
+
includeLogs: Schema.Boolean.pipe(
|
|
26
|
+
Schema.annotations({
|
|
27
|
+
title: t['include-debug-logs.label'],
|
|
28
|
+
}),
|
|
29
|
+
Schema.optional,
|
|
30
|
+
),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export type UserFeedback = Schema.Schema.Type<typeof UserFeedback>;
|
|
34
|
+
|
|
35
|
+
const OBSERVABILITY_OPERATION = `${meta.id}.operation`;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Operations for the Observability plugin.
|
|
39
|
+
*/
|
|
40
|
+
export const Toggle = Operation.make({
|
|
41
|
+
meta: {
|
|
42
|
+
key: `${OBSERVABILITY_OPERATION}.toggle`,
|
|
43
|
+
name: 'Toggle Observability',
|
|
44
|
+
description: 'Toggle observability on or off.',
|
|
45
|
+
},
|
|
46
|
+
services: [Capability.Service],
|
|
47
|
+
input: Schema.Struct({
|
|
48
|
+
state: Schema.optional(Schema.Boolean),
|
|
49
|
+
}),
|
|
50
|
+
output: Schema.Boolean,
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
export const CaptureUserFeedback = Operation.make({
|
|
54
|
+
meta: {
|
|
55
|
+
key: `${OBSERVABILITY_OPERATION}.capture-feedback`,
|
|
56
|
+
name: 'Capture User Feedback',
|
|
57
|
+
description: 'Capture user feedback.',
|
|
58
|
+
},
|
|
59
|
+
services: [Capability.Service],
|
|
60
|
+
input: UserFeedback,
|
|
61
|
+
output: Schema.Void,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
export const SendEvent = Operation.make({
|
|
65
|
+
meta: {
|
|
66
|
+
key: `${OBSERVABILITY_OPERATION}.send-event`,
|
|
67
|
+
name: 'Send Event',
|
|
68
|
+
description: 'Send an observability event.',
|
|
69
|
+
},
|
|
70
|
+
services: [Capability.Service],
|
|
71
|
+
input: Schema.Struct({
|
|
72
|
+
name: Schema.String.annotations({ description: 'The name of the event.' }),
|
|
73
|
+
properties: Schema.optional(Schema.Any).annotations({ description: 'Event properties.' }),
|
|
74
|
+
}),
|
|
75
|
+
output: Schema.Void,
|
|
76
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { OperationHandlerSet } from '@dxos/compute';
|
|
6
|
+
|
|
7
|
+
export * as ObservabilityOperation from './definitions';
|
|
8
|
+
export { UserFeedback } from './definitions';
|
|
9
|
+
|
|
10
|
+
export const ObservabilityOperationHandlerSet = OperationHandlerSet.lazy(
|
|
11
|
+
() => import('./capture-user-feedback'),
|
|
12
|
+
() => import('./send-event'),
|
|
13
|
+
() => import('./toggle'),
|
|
14
|
+
);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capability } from '@dxos/app-framework';
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
9
|
+
|
|
10
|
+
import { ObservabilityCapabilities } from '../types';
|
|
11
|
+
import { SendEvent } from './definitions';
|
|
12
|
+
|
|
13
|
+
const handler: Operation.WithHandler<typeof SendEvent> = SendEvent.pipe(
|
|
14
|
+
Operation.withHandler(
|
|
15
|
+
Effect.fnUntraced(function* (input) {
|
|
16
|
+
// NOTE: This is to ensure that events fired before observability is ready are still sent.
|
|
17
|
+
const observability = yield* Capability.waitFor(ObservabilityCapabilities.Observability);
|
|
18
|
+
const properties = input.properties ?? {};
|
|
19
|
+
observability.events.captureEvent(input.name, properties);
|
|
20
|
+
}),
|
|
21
|
+
),
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export default handler;
|