@dxos/plugin-observability 0.8.4-main.f5c0578 → 0.8.4-main.fcfe5033a5
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-EM7ABGCA.mjs +31 -0
- package/dist/lib/browser/ObservabilitySettings-EM7ABGCA.mjs.map +7 -0
- package/dist/lib/browser/capture-user-feedback-H4KPG7PC.mjs +25 -0
- package/dist/lib/browser/capture-user-feedback-H4KPG7PC.mjs.map +7 -0
- package/dist/lib/browser/chunk-6WX6ST5B.mjs +49 -0
- package/dist/lib/browser/chunk-6WX6ST5B.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/browser/chunk-K33HLC3Z.mjs +33 -0
- package/dist/lib/browser/chunk-K33HLC3Z.mjs.map +7 -0
- package/dist/lib/browser/chunk-VZR3FNBD.mjs +85 -0
- package/dist/lib/browser/chunk-VZR3FNBD.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 +93 -113
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operations/index.mjs +16 -0
- package/dist/lib/browser/operations/index.mjs.map +7 -0
- package/dist/lib/browser/send-event-BICCRJ2W.mjs +23 -0
- package/dist/lib/browser/send-event-BICCRJ2W.mjs.map +7 -0
- package/dist/lib/browser/toggle-NV2X62VV.mjs +48 -0
- package/dist/lib/browser/toggle-NV2X62VV.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +12 -6
- package/dist/lib/node-esm/ObservabilitySettings-VP4A362Z.mjs +32 -0
- package/dist/lib/node-esm/ObservabilitySettings-VP4A362Z.mjs.map +7 -0
- package/dist/lib/node-esm/capture-user-feedback-DTL3DUXB.mjs +26 -0
- package/dist/lib/node-esm/capture-user-feedback-DTL3DUXB.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-FZRJBWSE.mjs +86 -0
- package/dist/lib/node-esm/chunk-FZRJBWSE.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-JGHMP7UL.mjs +35 -0
- package/dist/lib/node-esm/chunk-JGHMP7UL.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-QZKJ2TUU.mjs +50 -0
- package/dist/lib/node-esm/chunk-QZKJ2TUU.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 +93 -113
- 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 +17 -0
- package/dist/lib/node-esm/operations/index.mjs.map +7 -0
- package/dist/lib/node-esm/send-event-IWZKYZBI.mjs +24 -0
- package/dist/lib/node-esm/send-event-IWZKYZBI.mjs.map +7 -0
- package/dist/lib/node-esm/toggle-NJWUAPD4.mjs +49 -0
- package/dist/lib/node-esm/toggle-NJWUAPD4.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +12 -6
- package/dist/types/src/ObservabilityPlugin.d.ts +5 -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 +6 -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 +37 -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 +2 -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 +18 -15
- 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 +25 -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 +3 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +64 -35
- package/src/ObservabilityPlugin.ts +59 -53
- package/src/capabilities/app-graph-builder.ts +27 -37
- package/src/capabilities/client-ready.ts +68 -81
- 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 -13
- package/src/cli/index.ts +5 -0
- package/src/cli/plugin.ts +31 -0
- package/src/components/FeedbackForm/FeedbackForm.stories.tsx +32 -0
- package/src/components/FeedbackForm/FeedbackForm.tsx +33 -0
- package/src/components/FeedbackForm/index.ts +5 -0
- package/src/components/ObservabilitySettings/ObservabilitySettings.stories.tsx +33 -0
- package/src/components/ObservabilitySettings/ObservabilitySettings.tsx +38 -0
- package/src/components/ObservabilitySettings/index.ts +5 -0
- package/src/components/index.ts +4 -2
- package/src/containers/HelpContainer/HelpContainer.tsx +56 -0
- package/src/containers/HelpContainer/index.ts +5 -0
- package/src/containers/index.ts +7 -0
- package/src/index.ts +2 -2
- package/src/meta.ts +8 -5
- package/src/operations/capture-user-feedback.ts +22 -0
- package/src/operations/definitions.ts +77 -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 +18 -16
- package/src/types/Settings.ts +19 -0
- package/src/types/capabilities.ts +37 -0
- package/src/types/events.ts +15 -0
- package/src/types/index.ts +3 -1
- package/dist/lib/browser/app-graph-builder-2SLFJVUL.mjs +0 -43
- package/dist/lib/browser/app-graph-builder-2SLFJVUL.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-AL5RST75.mjs +0 -191
- package/dist/lib/browser/chunk-AL5RST75.mjs.map +0 -7
- package/dist/lib/browser/chunk-EAA6E4FU.mjs +0 -175
- package/dist/lib/browser/chunk-EAA6E4FU.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-NBJRF7OJ.mjs +0 -102
- package/dist/lib/browser/client-ready-NBJRF7OJ.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-NPEP5KJQ.mjs +0 -77
- package/dist/lib/browser/intent-resolver-NPEP5KJQ.mjs.map +0 -7
- package/dist/lib/browser/react-surface-245UEKB5.mjs +0 -32
- package/dist/lib/browser/react-surface-245UEKB5.mjs.map +0 -7
- package/dist/lib/browser/settings-4WW5E4VA.mjs +0 -25
- package/dist/lib/browser/settings-4WW5E4VA.mjs.map +0 -7
- package/dist/lib/browser/state-N7RLB477.mjs +0 -26
- package/dist/lib/browser/state-N7RLB477.mjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-MMH6BVY4.mjs +0 -44
- package/dist/lib/node-esm/app-graph-builder-MMH6BVY4.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-5W5V4TVX.mjs +0 -192
- package/dist/lib/node-esm/chunk-5W5V4TVX.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-D6QRS2CR.mjs +0 -176
- package/dist/lib/node-esm/chunk-D6QRS2CR.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/client-ready-XDI3JWUY.mjs +0 -103
- package/dist/lib/node-esm/client-ready-XDI3JWUY.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-OH4MMH5I.mjs +0 -78
- package/dist/lib/node-esm/intent-resolver-OH4MMH5I.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-ZR3IU2ZM.mjs +0 -33
- package/dist/lib/node-esm/react-surface-ZR3IU2ZM.mjs.map +0 -7
- package/dist/lib/node-esm/settings-BKKLNOFT.mjs +0 -26
- package/dist/lib/node-esm/settings-BKKLNOFT.mjs.map +0 -7
- package/dist/lib/node-esm/state-LKANNCJJ.mjs +0 -27
- package/dist/lib/node-esm/state-LKANNCJJ.mjs.map +0 -7
- 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/schema.d.ts +0 -313
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/capabilities/capabilities.ts +0 -22
- package/src/capabilities/intent-resolver.ts +0 -69
- package/src/components/FeedbackForm.tsx +0 -82
- package/src/components/HelpContainer.tsx +0 -41
- package/src/components/ObservabilitySettings.tsx +0 -48
- package/src/events.ts +0 -14
- package/src/types/schema.ts +0 -216
|
@@ -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,21 +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 {
|
|
7
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
|
+
import { createKvsStore } from '@dxos/effect';
|
|
9
|
+
import { Observability } from '@dxos/observability';
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { meta } from '#meta';
|
|
12
|
+
import { ObservabilityCapabilities } from '#types';
|
|
12
13
|
|
|
13
|
-
export default
|
|
14
|
-
|
|
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
|
+
});
|
|
15
21
|
|
|
16
|
-
|
|
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 });
|
|
17
26
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return contributes(ObservabilityCapabilities.State, state.values, () => state.close());
|
|
22
|
-
};
|
|
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/operation';
|
|
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,32 @@
|
|
|
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
|
+
import { FeedbackForm } from './FeedbackForm';
|
|
11
|
+
|
|
12
|
+
const meta = {
|
|
13
|
+
title: 'plugins/plugin-observability/components/FeedbackForm',
|
|
14
|
+
component: FeedbackForm,
|
|
15
|
+
decorators: [withTheme(), withLayout({ layout: 'column' })],
|
|
16
|
+
parameters: {
|
|
17
|
+
layout: 'fullscreen',
|
|
18
|
+
translations,
|
|
19
|
+
},
|
|
20
|
+
} satisfies Meta<typeof FeedbackForm>;
|
|
21
|
+
|
|
22
|
+
export default meta;
|
|
23
|
+
|
|
24
|
+
type Story = StoryObj<typeof meta>;
|
|
25
|
+
|
|
26
|
+
export const Default: Story = {
|
|
27
|
+
args: {
|
|
28
|
+
onSave: (values) => {
|
|
29
|
+
console.log(values);
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { 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'> & Pick<FormSubmitProps, 'disabled'>;
|
|
14
|
+
|
|
15
|
+
const defaultValues: UserFeedback = {
|
|
16
|
+
message: '',
|
|
17
|
+
includeLogs: true,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const FeedbackForm = ({ onSave, disabled }: FeedbackFormProps) => {
|
|
21
|
+
const { t } = useTranslation(meta.id);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Form.Root schema={UserFeedback} defaultValues={defaultValues} onSave={onSave}>
|
|
25
|
+
<Form.Viewport>
|
|
26
|
+
<Form.Content>
|
|
27
|
+
<Form.FieldSet />
|
|
28
|
+
<Form.Submit icon='ph--paper-plane-tilt--regular' label={t('send-feedback.label')} disabled={disabled} />
|
|
29
|
+
</Form.Content>
|
|
30
|
+
</Form.Viewport>
|
|
31
|
+
</Form.Root>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
import { ObservabilitySettings } from './ObservabilitySettings';
|
|
11
|
+
|
|
12
|
+
const meta = {
|
|
13
|
+
title: 'plugins/plugin-observability/components/ObservabilitySettings',
|
|
14
|
+
component: ObservabilitySettings,
|
|
15
|
+
tags: ['settings'],
|
|
16
|
+
decorators: [withTheme(), withLayout({ layout: 'fullscreen' })],
|
|
17
|
+
parameters: {
|
|
18
|
+
layout: 'fullscreen',
|
|
19
|
+
translations,
|
|
20
|
+
},
|
|
21
|
+
} satisfies Meta<typeof ObservabilitySettings>;
|
|
22
|
+
|
|
23
|
+
export default meta;
|
|
24
|
+
|
|
25
|
+
type Story = StoryObj<typeof meta>;
|
|
26
|
+
|
|
27
|
+
export const Default: Story = {
|
|
28
|
+
args: {
|
|
29
|
+
settings: {
|
|
30
|
+
enabled: true,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
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 { Input, Message, useTranslation } from '@dxos/react-ui';
|
|
9
|
+
import { Settings as SettingsForm } from '@dxos/react-ui-form';
|
|
10
|
+
|
|
11
|
+
import { meta } from '#meta';
|
|
12
|
+
import { type 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.Item
|
|
26
|
+
title={t('observability-enabled.label')}
|
|
27
|
+
description={t('observability-enabled.description')}
|
|
28
|
+
>
|
|
29
|
+
<Input.Switch
|
|
30
|
+
disabled={!onSettingsChange}
|
|
31
|
+
checked={settings.enabled}
|
|
32
|
+
onCheckedChange={(checked) => onSettingsChange?.((s) => ({ ...s, enabled: !!checked }))}
|
|
33
|
+
/>
|
|
34
|
+
</SettingsForm.Item>
|
|
35
|
+
</SettingsForm.Section>
|
|
36
|
+
</SettingsForm.Viewport>
|
|
37
|
+
);
|
|
38
|
+
};
|
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,56 @@
|
|
|
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 { 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 [feedbackAvailable, setFeedbackAvailable] = useState(false);
|
|
24
|
+
|
|
25
|
+
useAsyncEffect(
|
|
26
|
+
async (controller) => {
|
|
27
|
+
const available = await observability.isAvailable('feedback').pipe(
|
|
28
|
+
Effect.catchAll(() => Effect.succeed(false)),
|
|
29
|
+
Effect.catchAllDefect(() => Effect.succeed(false)),
|
|
30
|
+
runAndForwardErrors,
|
|
31
|
+
);
|
|
32
|
+
if (!controller.signal.aborted) {
|
|
33
|
+
setFeedbackAvailable(available);
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
[observability],
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
const handleSave = useCallback(
|
|
40
|
+
async (values: UserFeedback) => {
|
|
41
|
+
await invokePromise(ObservabilityOperation.CaptureUserFeedback, values);
|
|
42
|
+
await invokePromise(LayoutOperation.UpdateComplementary, { state: 'collapsed' });
|
|
43
|
+
await invokePromise(LayoutOperation.AddToast, {
|
|
44
|
+
id: `${meta.id}.feedback-success`,
|
|
45
|
+
icon: 'ph--paper-plane-tilt--regular',
|
|
46
|
+
duration: 3000,
|
|
47
|
+
title: ['feedback-toast.label', { ns: meta.id }],
|
|
48
|
+
description: ['feedback-toast.description', { ns: meta.id }],
|
|
49
|
+
closeLabel: ['close.label', { ns: osTranslations }],
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
[invokePromise],
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
return <FeedbackForm onSave={handleSave} disabled={!feedbackAvailable} />;
|
|
56
|
+
};
|
package/src/index.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
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';
|
|
9
|
+
export { translations as observabilityTranslations } from './translations';
|
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/operation';
|
|
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,77 @@
|
|
|
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 { Format } from '@dxos/echo';
|
|
9
|
+
import { Operation } from '@dxos/operation';
|
|
10
|
+
|
|
11
|
+
import { meta } from '#meta';
|
|
12
|
+
|
|
13
|
+
import { translations } from '../translations';
|
|
14
|
+
|
|
15
|
+
const t = translations[0]['en-US'][meta.id];
|
|
16
|
+
|
|
17
|
+
export const UserFeedback = Schema.Struct({
|
|
18
|
+
message: Format.Text.pipe(
|
|
19
|
+
Schema.nonEmptyString(),
|
|
20
|
+
Schema.maxLength(4_096),
|
|
21
|
+
Schema.annotations({
|
|
22
|
+
title: t['feedback-textarea.label'],
|
|
23
|
+
description: t['feedback-textarea.placeholder'],
|
|
24
|
+
}),
|
|
25
|
+
),
|
|
26
|
+
includeLogs: Schema.Boolean.pipe(
|
|
27
|
+
Schema.annotations({
|
|
28
|
+
title: t['include-debug-logs.label'],
|
|
29
|
+
}),
|
|
30
|
+
Schema.optional,
|
|
31
|
+
),
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export type UserFeedback = Schema.Schema.Type<typeof UserFeedback>;
|
|
35
|
+
|
|
36
|
+
const OBSERVABILITY_OPERATION = `${meta.id}.operation`;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Operations for the Observability plugin.
|
|
40
|
+
*/
|
|
41
|
+
export const Toggle = Operation.make({
|
|
42
|
+
meta: {
|
|
43
|
+
key: `${OBSERVABILITY_OPERATION}.toggle`,
|
|
44
|
+
name: 'Toggle Observability',
|
|
45
|
+
description: 'Toggle observability on or off.',
|
|
46
|
+
},
|
|
47
|
+
services: [Capability.Service],
|
|
48
|
+
input: Schema.Struct({
|
|
49
|
+
state: Schema.optional(Schema.Boolean),
|
|
50
|
+
}),
|
|
51
|
+
output: Schema.Boolean,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export const CaptureUserFeedback = Operation.make({
|
|
55
|
+
meta: {
|
|
56
|
+
key: `${OBSERVABILITY_OPERATION}.capture-feedback`,
|
|
57
|
+
name: 'Capture User Feedback',
|
|
58
|
+
description: 'Capture user feedback.',
|
|
59
|
+
},
|
|
60
|
+
services: [Capability.Service],
|
|
61
|
+
input: UserFeedback,
|
|
62
|
+
output: Schema.Void,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
export const SendEvent = Operation.make({
|
|
66
|
+
meta: {
|
|
67
|
+
key: `${OBSERVABILITY_OPERATION}.send-event`,
|
|
68
|
+
name: 'Send Event',
|
|
69
|
+
description: 'Send an observability event.',
|
|
70
|
+
},
|
|
71
|
+
services: [Capability.Service],
|
|
72
|
+
input: Schema.Struct({
|
|
73
|
+
name: Schema.String.annotations({ description: 'The name of the event.' }),
|
|
74
|
+
properties: Schema.optional(Schema.Any).annotations({ description: 'Event properties.' }),
|
|
75
|
+
}),
|
|
76
|
+
output: Schema.Void,
|
|
77
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { OperationHandlerSet } from '@dxos/operation';
|
|
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/operation';
|
|
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;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
|
+
import { AppCapabilities } from '@dxos/app-toolkit';
|
|
9
|
+
import { Observability } from '@dxos/observability';
|
|
10
|
+
import { Operation } from '@dxos/operation';
|
|
11
|
+
|
|
12
|
+
import { meta } from '#meta';
|
|
13
|
+
|
|
14
|
+
import { ObservabilityCapabilities, type Settings } from '../types';
|
|
15
|
+
import { Toggle } from './definitions';
|
|
16
|
+
|
|
17
|
+
const handler: Operation.WithHandler<typeof Toggle> = Toggle.pipe(
|
|
18
|
+
Operation.withHandler(
|
|
19
|
+
Effect.fnUntraced(function* (input) {
|
|
20
|
+
const namespace = yield* Capability.get(ObservabilityCapabilities.Namespace);
|
|
21
|
+
const observability = yield* Capability.get(ObservabilityCapabilities.Observability);
|
|
22
|
+
const capabilities = yield* Capability.Service;
|
|
23
|
+
const registry = capabilities.get(Capabilities.AtomRegistry);
|
|
24
|
+
const allSettings = capabilities.getAll(AppCapabilities.Settings);
|
|
25
|
+
const settingsObj = allSettings.find((s: AppCapabilities.Settings) => s.prefix === meta.id);
|
|
26
|
+
if (!settingsObj) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
const settings = registry.get(settingsObj.atom) as Settings.Settings;
|
|
30
|
+
const newEnabled = input.state ?? !settings.enabled;
|
|
31
|
+
registry.set(settingsObj.atom, { ...settings, enabled: newEnabled });
|
|
32
|
+
observability.events.captureEvent('observability.toggle', {
|
|
33
|
+
enabled: newEnabled,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
if (newEnabled) {
|
|
37
|
+
yield* observability.enable();
|
|
38
|
+
} else {
|
|
39
|
+
yield* observability.disable();
|
|
40
|
+
}
|
|
41
|
+
yield* Effect.promise(() => Observability.storeObservabilityDisabled(namespace, !newEnabled));
|
|
42
|
+
return newEnabled;
|
|
43
|
+
}),
|
|
44
|
+
),
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
export default handler;
|
package/src/translations.ts
CHANGED
|
@@ -4,30 +4,32 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Resource } from '@dxos/react-ui';
|
|
6
6
|
|
|
7
|
-
import { meta } from '
|
|
7
|
+
import { meta } from '#meta';
|
|
8
8
|
|
|
9
9
|
export const translations = [
|
|
10
10
|
{
|
|
11
11
|
'en-US': {
|
|
12
12
|
[meta.id]: {
|
|
13
|
-
'plugin
|
|
14
|
-
'
|
|
15
|
-
'observability
|
|
13
|
+
'plugin.name': 'Telemetry',
|
|
14
|
+
'settings.title': 'Telemetry settings',
|
|
15
|
+
'observability-toast.label': 'Privacy Notice',
|
|
16
|
+
'observability-toast.description':
|
|
16
17
|
'Composer collects usage and performance metrics to improve the product. No user data is collected.',
|
|
17
|
-
'observability
|
|
18
|
-
'observability
|
|
19
|
-
'observability
|
|
20
|
-
'observability
|
|
18
|
+
'observability-toast-action.label': 'Settings',
|
|
19
|
+
'observability-toast-action.alt': 'Open settings to learn more or to disable.',
|
|
20
|
+
'observability-toast-close.label': 'Okay',
|
|
21
|
+
'observability-enabled.label': 'Enable telemetry',
|
|
22
|
+
'observability-enabled.description': 'Send anonymous usage and performance data to help improve the product.',
|
|
21
23
|
// TODO: Add link about telemetry privacy. Make it clearer that user data is not collected.
|
|
22
|
-
'observability
|
|
24
|
+
'observability.description':
|
|
23
25
|
'When enabled, basic usage data will used to improve the product. This may include performance metrics, error logs, and usage data. No personally identifiable information, other than your public key, is included with this data and no private data ever leaves your devices.',
|
|
24
|
-
|
|
25
|
-
'
|
|
26
|
-
'feedback
|
|
27
|
-
'
|
|
28
|
-
'send
|
|
29
|
-
'feedback
|
|
30
|
-
'feedback
|
|
26
|
+
'help.label': 'Feedback & Support',
|
|
27
|
+
'feedback-textarea.label': 'Feedback',
|
|
28
|
+
'feedback-textarea.placeholder': 'Please enter your feedback, technical issue, or feature request.',
|
|
29
|
+
'include-debug-logs.label': 'Include debug logs',
|
|
30
|
+
'send-feedback.label': 'Send Feedback',
|
|
31
|
+
'feedback-toast.label': 'Thank you for your feedback!',
|
|
32
|
+
'feedback-toast.description': 'We will review your feedback and get back to you as soon as possible.',
|
|
31
33
|
},
|
|
32
34
|
},
|
|
33
35
|
},
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2023 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
// @import-as-namespace
|
|
6
|
+
|
|
7
|
+
import * as Schema from 'effect/Schema';
|
|
8
|
+
|
|
9
|
+
export const Settings = Schema.mutable(
|
|
10
|
+
Schema.Struct({
|
|
11
|
+
enabled: Schema.Boolean,
|
|
12
|
+
// TODO(wittjosiah): Separate settings for each observability feature.
|
|
13
|
+
// metrics?: boolean;
|
|
14
|
+
// telemetry?: boolean;
|
|
15
|
+
// errors?: boolean;
|
|
16
|
+
}),
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export interface Settings extends Schema.Schema.Type<typeof Settings> {}
|