@dxos/plugin-observability 0.7.5-main.9d26e3a → 0.7.5-main.b19bfc8

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.
Files changed (116) hide show
  1. package/dist/lib/browser/{chunk-X6XUBXZQ.mjs → chunk-BMBRX6IW.mjs} +5 -4
  2. package/dist/lib/browser/chunk-BMBRX6IW.mjs.map +7 -0
  3. package/dist/lib/browser/{chunk-UBDF6N5K.mjs → chunk-LJICNNK4.mjs} +2 -2
  4. package/dist/lib/browser/chunk-VOXXTFUV.mjs +37 -0
  5. package/dist/lib/browser/chunk-VOXXTFUV.mjs.map +7 -0
  6. package/dist/lib/browser/chunk-WEVYEGVJ.mjs +18 -0
  7. package/dist/lib/browser/chunk-WEVYEGVJ.mjs.map +7 -0
  8. package/dist/lib/browser/client-ready-G43SJ5KX.mjs +103 -0
  9. package/dist/lib/browser/client-ready-G43SJ5KX.mjs.map +7 -0
  10. package/dist/lib/browser/index.mjs +77 -207
  11. package/dist/lib/browser/index.mjs.map +4 -4
  12. package/dist/lib/browser/intents-resolver-T4PF2V23.mjs +64 -0
  13. package/dist/lib/browser/intents-resolver-T4PF2V23.mjs.map +7 -0
  14. package/dist/lib/browser/meta.json +1 -1
  15. package/dist/lib/browser/react-surface-TRXHCMO5.mjs +24 -0
  16. package/dist/lib/browser/react-surface-TRXHCMO5.mjs.map +7 -0
  17. package/dist/lib/browser/settings-3DXJFOJA.mjs +25 -0
  18. package/dist/lib/browser/settings-3DXJFOJA.mjs.map +7 -0
  19. package/dist/lib/browser/state-LG42JNIS.mjs +26 -0
  20. package/dist/lib/browser/state-LG42JNIS.mjs.map +7 -0
  21. package/dist/lib/browser/types.mjs +2 -2
  22. package/dist/lib/node/{chunk-SIUGGDNL.cjs → chunk-7I7D7NBM.cjs} +9 -8
  23. package/dist/lib/node/chunk-7I7D7NBM.cjs.map +7 -0
  24. package/dist/lib/node/chunk-X7HWBFE2.cjs +38 -0
  25. package/dist/lib/node/chunk-X7HWBFE2.cjs.map +7 -0
  26. package/dist/lib/node/{chunk-HZSRCP4I.cjs → chunk-XBDGBB5D.cjs} +6 -6
  27. package/dist/lib/node/chunk-YHIPA37Q.cjs +65 -0
  28. package/dist/lib/node/chunk-YHIPA37Q.cjs.map +7 -0
  29. package/dist/lib/node/client-ready-352F6HCO.cjs +114 -0
  30. package/dist/lib/node/client-ready-352F6HCO.cjs.map +7 -0
  31. package/dist/lib/node/index.cjs +73 -200
  32. package/dist/lib/node/index.cjs.map +4 -4
  33. package/dist/lib/node/intents-resolver-UCNXONFF.cjs +75 -0
  34. package/dist/lib/node/intents-resolver-UCNXONFF.cjs.map +7 -0
  35. package/dist/lib/node/meta.json +1 -1
  36. package/dist/lib/node/react-surface-G4DDWTSN.cjs +48 -0
  37. package/dist/lib/node/react-surface-G4DDWTSN.cjs.map +7 -0
  38. package/dist/lib/node/settings-ZFZ4YONA.cjs +39 -0
  39. package/dist/lib/node/settings-ZFZ4YONA.cjs.map +7 -0
  40. package/dist/lib/node/state-FNK3OBM7.cjs +40 -0
  41. package/dist/lib/node/state-FNK3OBM7.cjs.map +7 -0
  42. package/dist/lib/node/types.cjs +4 -4
  43. package/dist/lib/node/types.cjs.map +1 -1
  44. package/dist/lib/node-esm/{chunk-52FTHXHB.mjs → chunk-DSC5SQ7W.mjs} +2 -2
  45. package/dist/lib/node-esm/{chunk-7GGPSKXN.mjs → chunk-HTL7V6A2.mjs} +5 -4
  46. package/dist/lib/node-esm/chunk-HTL7V6A2.mjs.map +7 -0
  47. package/dist/lib/node-esm/chunk-KPH3N6JS.mjs +19 -0
  48. package/dist/lib/node-esm/chunk-KPH3N6JS.mjs.map +7 -0
  49. package/dist/lib/node-esm/chunk-N5NBR55J.mjs +38 -0
  50. package/dist/lib/node-esm/chunk-N5NBR55J.mjs.map +7 -0
  51. package/dist/lib/node-esm/client-ready-NXRLOXLL.mjs +104 -0
  52. package/dist/lib/node-esm/client-ready-NXRLOXLL.mjs.map +7 -0
  53. package/dist/lib/node-esm/index.mjs +77 -207
  54. package/dist/lib/node-esm/index.mjs.map +4 -4
  55. package/dist/lib/node-esm/intents-resolver-IXURWG7Z.mjs +65 -0
  56. package/dist/lib/node-esm/intents-resolver-IXURWG7Z.mjs.map +7 -0
  57. package/dist/lib/node-esm/meta.json +1 -1
  58. package/dist/lib/node-esm/react-surface-QYURTQNR.mjs +25 -0
  59. package/dist/lib/node-esm/react-surface-QYURTQNR.mjs.map +7 -0
  60. package/dist/lib/node-esm/settings-UNFUTWGX.mjs +26 -0
  61. package/dist/lib/node-esm/settings-UNFUTWGX.mjs.map +7 -0
  62. package/dist/lib/node-esm/state-UXRA6NQC.mjs +27 -0
  63. package/dist/lib/node-esm/state-UXRA6NQC.mjs.map +7 -0
  64. package/dist/lib/node-esm/types.mjs +2 -2
  65. package/dist/types/src/ObservabilityPlugin.d.ts +1 -11
  66. package/dist/types/src/ObservabilityPlugin.d.ts.map +1 -1
  67. package/dist/types/src/capabilities/capabilities.d.ts +12 -0
  68. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -0
  69. package/dist/types/src/capabilities/client-ready.d.ts +10 -0
  70. package/dist/types/src/capabilities/client-ready.d.ts.map +1 -0
  71. package/dist/types/src/capabilities/index.d.ts +16 -0
  72. package/dist/types/src/capabilities/index.d.ts.map +1 -0
  73. package/dist/types/src/capabilities/intents-resolver.d.ts +7 -0
  74. package/dist/types/src/capabilities/intents-resolver.d.ts.map +1 -0
  75. package/dist/types/src/capabilities/react-surface.d.ts +4 -0
  76. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  77. package/dist/types/src/capabilities/settings.d.ts +4 -0
  78. package/dist/types/src/capabilities/settings.d.ts.map +1 -0
  79. package/dist/types/src/capabilities/state.d.ts +6 -0
  80. package/dist/types/src/capabilities/state.d.ts.map +1 -0
  81. package/dist/types/src/components/ObservabilitySettings.d.ts +6 -5
  82. package/dist/types/src/components/ObservabilitySettings.d.ts.map +1 -1
  83. package/dist/types/src/events.d.ts +5 -0
  84. package/dist/types/src/events.d.ts.map +1 -0
  85. package/dist/types/src/index.d.ts +3 -2
  86. package/dist/types/src/index.d.ts.map +1 -1
  87. package/dist/types/src/meta.d.ts +2 -2
  88. package/dist/types/src/meta.d.ts.map +1 -1
  89. package/dist/types/tsconfig.tsbuildinfo +1 -1
  90. package/package.json +21 -27
  91. package/src/ObservabilityPlugin.ts +61 -0
  92. package/src/capabilities/capabilities.ts +22 -0
  93. package/src/capabilities/client-ready.ts +98 -0
  94. package/src/capabilities/index.ts +13 -0
  95. package/src/capabilities/intents-resolver.ts +62 -0
  96. package/src/capabilities/react-surface.tsx +23 -0
  97. package/src/capabilities/settings.ts +19 -0
  98. package/src/capabilities/state.ts +21 -0
  99. package/src/components/ObservabilitySettings.tsx +15 -10
  100. package/src/events.ts +14 -0
  101. package/src/index.ts +3 -4
  102. package/src/meta.ts +2 -1
  103. package/src/translations.ts +1 -1
  104. package/dist/lib/browser/chunk-X6XUBXZQ.mjs.map +0 -7
  105. package/dist/lib/browser/meta.mjs +0 -9
  106. package/dist/lib/browser/meta.mjs.map +0 -7
  107. package/dist/lib/node/chunk-SIUGGDNL.cjs.map +0 -7
  108. package/dist/lib/node/meta.cjs +0 -30
  109. package/dist/lib/node/meta.cjs.map +0 -7
  110. package/dist/lib/node-esm/chunk-7GGPSKXN.mjs.map +0 -7
  111. package/dist/lib/node-esm/meta.mjs +0 -10
  112. package/dist/lib/node-esm/meta.mjs.map +0 -7
  113. package/src/ObservabilityPlugin.tsx +0 -215
  114. /package/dist/lib/browser/{chunk-UBDF6N5K.mjs.map → chunk-LJICNNK4.mjs.map} +0 -0
  115. /package/dist/lib/node/{chunk-HZSRCP4I.cjs.map → chunk-XBDGBB5D.cjs.map} +0 -0
  116. /package/dist/lib/node-esm/{chunk-52FTHXHB.mjs.map → chunk-DSC5SQ7W.mjs.map} +0 -0
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var client_ready_352F6HCO_exports = {};
20
+ __export(client_ready_352F6HCO_exports, {
21
+ default: () => client_ready_default
22
+ });
23
+ module.exports = __toCommonJS(client_ready_352F6HCO_exports);
24
+ var import_chunk_XBDGBB5D = require("./chunk-XBDGBB5D.cjs");
25
+ var import_chunk_X7HWBFE2 = require("./chunk-X7HWBFE2.cjs");
26
+ var import_chunk_7I7D7NBM = require("./chunk-7I7D7NBM.cjs");
27
+ var import_app_framework = require("@dxos/app-framework");
28
+ var import_observability = require("@dxos/observability");
29
+ var client_ready_default = async ({ context, namespace, observability }) => {
30
+ const manager = context.requestCapability(import_app_framework.Capabilities.PluginManager);
31
+ const { dispatchPromise: dispatch } = context.requestCapability(import_app_framework.Capabilities.IntentDispatcher);
32
+ const state = context.requestCapability(import_chunk_X7HWBFE2.ObservabilityCapabilities.State);
33
+ const client = context.requestCapability(import_chunk_X7HWBFE2.ClientCapability);
34
+ const sendPrivacyNotice = async () => {
35
+ const environment = client?.config?.values.runtime?.app?.env?.DX_ENVIRONMENT;
36
+ const notify = environment && environment !== "ci" && !environment.endsWith(".local") && !environment.endsWith(".lan");
37
+ if (!state.notified && notify) {
38
+ await dispatch((0, import_app_framework.createIntent)(import_app_framework.LayoutAction.AddToast, {
39
+ part: "toast",
40
+ subject: {
41
+ id: `${import_chunk_7I7D7NBM.OBSERVABILITY_PLUGIN}/notice`,
42
+ title: [
43
+ "observability toast label",
44
+ {
45
+ ns: import_chunk_7I7D7NBM.OBSERVABILITY_PLUGIN
46
+ }
47
+ ],
48
+ description: [
49
+ "observability toast description",
50
+ {
51
+ ns: import_chunk_7I7D7NBM.OBSERVABILITY_PLUGIN
52
+ }
53
+ ],
54
+ duration: Infinity,
55
+ icon: "ph--info--regular",
56
+ actionLabel: [
57
+ "observability toast action label",
58
+ {
59
+ ns: import_chunk_7I7D7NBM.OBSERVABILITY_PLUGIN
60
+ }
61
+ ],
62
+ actionAlt: [
63
+ "observability toast action alt",
64
+ {
65
+ ns: import_chunk_7I7D7NBM.OBSERVABILITY_PLUGIN
66
+ }
67
+ ],
68
+ closeLabel: [
69
+ "observability toast close label",
70
+ {
71
+ ns: import_chunk_7I7D7NBM.OBSERVABILITY_PLUGIN
72
+ }
73
+ ],
74
+ onAction: () => dispatch((0, import_app_framework.createIntent)(import_app_framework.SettingsAction.Open, {
75
+ plugin: import_chunk_7I7D7NBM.OBSERVABILITY_PLUGIN
76
+ }))
77
+ }
78
+ }));
79
+ state.notified = true;
80
+ }
81
+ };
82
+ manager.enabled.map((plugin) => observability?.setTag(`pluginEnabled-${plugin}`, "true", "errors"));
83
+ await dispatch((0, import_app_framework.createIntent)(import_chunk_XBDGBB5D.ObservabilityAction.SendEvent, {
84
+ name: "page.load",
85
+ properties: {
86
+ href: window.location.href,
87
+ // TODO(wittjosiah): These apis are deprecated. Is there a better way to find this information?
88
+ loadDuration: window.performance.timing.loadEventEnd - window.performance.timing.loadEventStart
89
+ }
90
+ }));
91
+ const cleanup = (0, import_observability.setupTelemetryListeners)(namespace, client, observability);
92
+ await Promise.all([
93
+ observability.setIdentityTags(client.services.services),
94
+ observability.startRuntimeMetrics(client),
95
+ observability.startNetworkMetrics(client.services.services),
96
+ observability.startSpacesMetrics(client, namespace)
97
+ ]);
98
+ if (client.halo.identity.get()) {
99
+ await sendPrivacyNotice();
100
+ } else {
101
+ const subscription = client.halo.identity.subscribe(async (identity) => {
102
+ if (identity && observability) {
103
+ await sendPrivacyNotice();
104
+ await observability.setIdentityTags(client.services.services);
105
+ subscription.unsubscribe();
106
+ }
107
+ });
108
+ }
109
+ return (0, import_app_framework.contributes)(import_chunk_X7HWBFE2.ObservabilityCapabilities.Observability, observability, async () => {
110
+ cleanup();
111
+ await observability.close();
112
+ });
113
+ };
114
+ //# sourceMappingURL=client-ready-352F6HCO.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/capabilities/client-ready.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport {\n Capabilities,\n contributes,\n createIntent,\n LayoutAction,\n SettingsAction,\n type PluginsContext,\n} from '@dxos/app-framework';\nimport { setupTelemetryListeners, type Observability } from '@dxos/observability';\n\nimport { ClientCapability, ObservabilityCapabilities } from './capabilities';\nimport { OBSERVABILITY_PLUGIN } from '../meta';\nimport { ObservabilityAction } from '../types';\n\ntype ClientReadyOptions = {\n context: PluginsContext;\n namespace: string;\n observability: Observability;\n};\n\nexport default async ({ context, namespace, observability }: ClientReadyOptions) => {\n const manager = context.requestCapability(Capabilities.PluginManager);\n const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);\n const state = context.requestCapability(ObservabilityCapabilities.State);\n const client = context.requestCapability(ClientCapability);\n\n const sendPrivacyNotice = async () => {\n const environment = client?.config?.values.runtime?.app?.env?.DX_ENVIRONMENT;\n const notify =\n environment && environment !== 'ci' && !environment.endsWith('.local') && !environment.endsWith('.lan');\n if (!state.notified && notify) {\n await dispatch(\n createIntent(LayoutAction.AddToast, {\n part: 'toast',\n subject: {\n id: `${OBSERVABILITY_PLUGIN}/notice`,\n title: ['observability toast label', { ns: OBSERVABILITY_PLUGIN }],\n description: ['observability toast description', { ns: OBSERVABILITY_PLUGIN }],\n duration: Infinity,\n icon: 'ph--info--regular',\n actionLabel: ['observability toast action label', { ns: OBSERVABILITY_PLUGIN }],\n actionAlt: ['observability toast action alt', { ns: OBSERVABILITY_PLUGIN }],\n closeLabel: ['observability toast close label', { ns: OBSERVABILITY_PLUGIN }],\n onAction: () => dispatch(createIntent(SettingsAction.Open, { plugin: OBSERVABILITY_PLUGIN })),\n },\n }),\n );\n\n state.notified = true;\n }\n };\n\n // Ensure errors are tagged with enabled plugins to help with reproductions.\n manager.enabled.map((plugin) => observability?.setTag(`pluginEnabled-${plugin}`, 'true', 'errors'));\n\n await dispatch(\n createIntent(ObservabilityAction.SendEvent, {\n name: 'page.load',\n properties: {\n href: window.location.href,\n // TODO(wittjosiah): These apis are deprecated. Is there a better way to find this information?\n loadDuration: window.performance.timing.loadEventEnd - window.performance.timing.loadEventStart,\n },\n }),\n );\n\n // Start client observability (i.e. not running as shared worker)\n // TODO(nf): how to prevent multiple instances for single shared worker?\n const cleanup = setupTelemetryListeners(namespace, client, observability);\n\n await Promise.all([\n observability.setIdentityTags(client.services.services),\n observability.startRuntimeMetrics(client),\n observability.startNetworkMetrics(client.services.services),\n observability.startSpacesMetrics(client, namespace),\n ]);\n\n if (client.halo.identity.get()) {\n await sendPrivacyNotice();\n } else {\n const subscription = client.halo.identity.subscribe(async (identity) => {\n if (identity && observability) {\n await sendPrivacyNotice();\n await observability.setIdentityTags(client.services.services);\n subscription.unsubscribe();\n }\n });\n }\n\n return contributes(ObservabilityCapabilities.Observability, observability, async () => {\n cleanup();\n await observability.close();\n });\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,2BAOO;AACP,2BAA4D;AAY5D,IAAA,uBAAe,OAAO,EAAEA,SAASC,WAAWC,cAAa,MAAsB;AAC7E,QAAMC,UAAUH,QAAQI,kBAAkBC,kCAAaC,aAAa;AACpE,QAAM,EAAEC,iBAAiBC,SAAQ,IAAKR,QAAQI,kBAAkBC,kCAAaI,gBAAgB;AAC7F,QAAMC,QAAQV,QAAQ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ASA,QAAQ;IACtDhE,cAAciE,oBAAoBtD,MAAAA;IAClCX,cAAckE,oBAAoBvD,OAAOqD,SAASA,QAAQ;IAC1DhE,cAAcmE,mBAAmBxD,QAAQZ,SAAAA;GAC1C;AAED,MAAIY,OAAOyD,KAAKC,SAASC,IAAG,GAAI;AAC9B,UAAMzD,kBAAAA;EACR,OAAO;AACL,UAAM0D,eAAe5D,OAAOyD,KAAKC,SAASG,UAAU,OAAOH,aAAAA;AACzD,UAAIA,YAAYrE,eAAe;AAC7B,cAAMa,kBAAAA;AACN,cAAMb,cAAc+D,gBAAgBpD,OAAOqD,SAASA,QAAQ;AAC5DO,qBAAaE,YAAW;MAC1B;IACF,CAAA;EACF;AAEA,aAAOC,kCAAYjE,gDAA0BkE,eAAe3E,eAAe,YAAA;AACzE2D,YAAAA;AACA,UAAM3D,cAAc4E,MAAK;EAC3B,CAAA;AACF;",
6
+ "names": ["context", "namespace", "observability", "manager", "requestCapability", "Capabilities", "PluginManager", "dispatchPromise", "dispatch", "IntentDispatcher", "state", "ObservabilityCapabilities", "State", "client", "ClientCapability", "sendPrivacyNotice", "environment", "config", "values", "runtime", "app", "env", "DX_ENVIRONMENT", "notify", "endsWith", "notified", "createIntent", "LayoutAction", "AddToast", "part", "subject", "id", "OBSERVABILITY_PLUGIN", "title", "ns", "description", "duration", "Infinity", "icon", "actionLabel", "actionAlt", "closeLabel", "onAction", "SettingsAction", "Open", "plugin", "enabled", "map", "setTag", "ObservabilityAction", "SendEvent", "name", "properties", "href", "window", "location", "loadDuration", "performance", "timing", "loadEventEnd", "loadEventStart", "cleanup", "setupTelemetryListeners", "Promise", "all", "setIdentityTags", "services", "startRuntimeMetrics", "startNetworkMetrics", "startSpacesMetrics", "halo", "identity", "get", "subscription", "subscribe", "unsubscribe", "contributes", "Observability", "close"]
7
+ }
@@ -28,43 +28,32 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  var node_exports = {};
30
30
  __export(node_exports, {
31
+ OBSERVABILITY_PLUGIN: () => import_chunk_7I7D7NBM.OBSERVABILITY_PLUGIN,
32
+ ObservabilityCapabilities: () => import_chunk_X7HWBFE2.ObservabilityCapabilities,
33
+ ObservabilityEvents: () => ObservabilityEvents,
31
34
  ObservabilityPlugin: () => ObservabilityPlugin,
32
- default: () => src_default,
33
- parseObservabilityPlugin: () => parseObservabilityPlugin
35
+ meta: () => import_chunk_7I7D7NBM.meta
34
36
  });
35
37
  module.exports = __toCommonJS(node_exports);
36
- var import_chunk_HZSRCP4I = require("./chunk-HZSRCP4I.cjs");
37
- var import_chunk_SIUGGDNL = require("./chunk-SIUGGDNL.cjs");
38
- var import_react = __toESM(require("react"));
38
+ var import_chunk_X7HWBFE2 = require("./chunk-X7HWBFE2.cjs");
39
+ var import_chunk_7I7D7NBM = require("./chunk-7I7D7NBM.cjs");
39
40
  var import_app_framework = require("@dxos/app-framework");
40
- var import_async = require("@dxos/async");
41
- var import_invariant = require("@dxos/invariant");
42
- var import_live_object = require("@dxos/live-object");
43
- var import_local_storage = require("@dxos/local-storage");
44
- var import_observability = require("@dxos/observability");
45
- var import_react2 = __toESM(require("react"));
46
41
  var import_app_framework2 = require("@dxos/app-framework");
47
- var import_react_ui = require("@dxos/react-ui");
48
- var import_react_ui_form = require("@dxos/react-ui-form");
49
- var ObservabilitySettings = ({ settings }) => {
50
- const { t } = (0, import_react_ui.useTranslation)(import_chunk_SIUGGDNL.OBSERVABILITY_PLUGIN);
51
- const { dispatchPromise: dispatch } = (0, import_app_framework2.useIntentDispatcher)();
52
- return /* @__PURE__ */ import_react2.default.createElement(import_react2.default.Fragment, null, /* @__PURE__ */ import_react2.default.createElement(import_react_ui_form.DeprecatedFormInput, {
53
- label: t("observability enabled label"),
54
- secondary: /* @__PURE__ */ import_react2.default.createElement(import_react_ui.Message.Root, {
55
- valence: "info"
56
- }, /* @__PURE__ */ import_react2.default.createElement(import_react_ui.Message.Body, null, t("observability description")))
57
- }, /* @__PURE__ */ import_react2.default.createElement(import_react_ui.Input.Switch, {
58
- checked: settings.enabled,
59
- onCheckedChange: (checked) => dispatch((0, import_app_framework2.createIntent)(import_chunk_HZSRCP4I.ObservabilityAction.Toggle, {
60
- state: !!checked
61
- }))
62
- })));
63
- };
42
+ var import_app_framework3 = require("@dxos/app-framework");
43
+ var ClientReady = (0, import_app_framework.lazy)(() => import("./client-ready-352F6HCO.cjs"));
44
+ var IntentResolver = (0, import_app_framework.lazy)(() => import("./intents-resolver-UCNXONFF.cjs"));
45
+ var ReactSurface = (0, import_app_framework.lazy)(() => import("./react-surface-G4DDWTSN.cjs"));
46
+ var ObservabilitySettings = (0, import_app_framework.lazy)(() => import("./settings-ZFZ4YONA.cjs"));
47
+ var ObservabilityState = (0, import_app_framework.lazy)(() => import("./state-FNK3OBM7.cjs"));
48
+ var ObservabilityEvents;
49
+ (function(ObservabilityEvents2) {
50
+ ObservabilityEvents2.StateReady = import_app_framework2.Events.createStateEvent(import_chunk_7I7D7NBM.OBSERVABILITY_PLUGIN);
51
+ })(ObservabilityEvents || (ObservabilityEvents = {}));
52
+ var ClientReadyEvent = (0, import_app_framework2.defineEvent)("dxos.org/plugin/client/event/client-ready");
64
53
  var translations_default = [
65
54
  {
66
55
  "en-US": {
67
- [import_chunk_SIUGGDNL.OBSERVABILITY_PLUGIN]: {
56
+ [import_chunk_7I7D7NBM.OBSERVABILITY_PLUGIN]: {
68
57
  "plugin name": "Telemetry",
69
58
  "observability toast label": "Privacy Notice",
70
59
  "observability toast description": "Composer collects usage and performance metrics to improve the product. No user data is collected.",
@@ -73,185 +62,69 @@ var translations_default = [
73
62
  "observability toast close label": "Okay",
74
63
  "observability enabled label": "Enable telemetry",
75
64
  // TODO: Add link about telemetry privacy. Make it clearer that user data is not collected.
76
- "observability description": "When enabled, basic usage data will be sent to the DXOS team in order 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."
65
+ "observability description": "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."
77
66
  }
78
67
  }
79
68
  }
80
69
  ];
81
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-observability/src/ObservabilityPlugin.tsx";
82
- var parseObservabilityPlugin = (plugin) => (plugin?.provides).observability ? plugin : void 0;
83
- var ObservabilityPlugin = (options) => {
84
- const settings = (0, import_live_object.create)({});
85
- const state = new import_local_storage.LocalStorageStore(import_chunk_SIUGGDNL.OBSERVABILITY_PLUGIN);
86
- const subscriptions = new import_async.EventSubscriptions();
87
- let observability;
88
- return {
89
- meta: import_chunk_SIUGGDNL.meta_default,
90
- initialize: async () => {
91
- settings.enabled = !await (0, import_observability.isObservabilityDisabled)(options.namespace);
92
- state.values.group = await (0, import_observability.getObservabilityGroup)(options.namespace);
93
- state.prop({
94
- key: "notified",
95
- type: import_local_storage.LocalStorageStore.bool({
96
- allowUndefined: true
97
- })
98
- });
99
- },
100
- ready: async ({ plugins }) => {
101
- const client = (0, import_app_framework.findPlugin)(plugins, "dxos.org/plugin/client")?.provides.client;
102
- const intentPlugin = (0, import_app_framework.resolvePlugin)(plugins, import_app_framework.parseIntentPlugin);
103
- const dispatch = intentPlugin?.provides?.intent?.dispatchPromise;
104
- if (!dispatch) {
105
- return;
106
- }
107
- const sendPrivacyNotice = async () => {
108
- const environment = client?.config?.values.runtime?.app?.env?.DX_ENVIRONMENT;
109
- const notify = environment && environment !== "ci" && !environment.endsWith(".local") && !environment.endsWith(".lan");
110
- if (!state.values.notified && notify) {
111
- await dispatch((0, import_app_framework.createIntent)(import_app_framework.LayoutAction.SetLayout, {
112
- element: "toast",
113
- subject: {
114
- id: `${import_chunk_SIUGGDNL.OBSERVABILITY_PLUGIN}/notice`,
115
- // TODO(wittjosiah): Non-react translation utils.
116
- title: translations_default[0]["en-US"][import_chunk_SIUGGDNL.OBSERVABILITY_PLUGIN]["observability toast label"],
117
- description: translations_default[0]["en-US"][import_chunk_SIUGGDNL.OBSERVABILITY_PLUGIN]["observability toast description"],
118
- duration: Infinity,
119
- icon: "ph--info--regular",
120
- actionLabel: translations_default[0]["en-US"][import_chunk_SIUGGDNL.OBSERVABILITY_PLUGIN]["observability toast action label"],
121
- actionAlt: translations_default[0]["en-US"][import_chunk_SIUGGDNL.OBSERVABILITY_PLUGIN]["observability toast action alt"],
122
- closeLabel: translations_default[0]["en-US"][import_chunk_SIUGGDNL.OBSERVABILITY_PLUGIN]["observability toast close label"],
123
- onAction: () => dispatch((0, import_app_framework.createIntent)(import_app_framework.SettingsAction.Open, {
124
- plugin: import_chunk_SIUGGDNL.OBSERVABILITY_PLUGIN
125
- }))
126
- }
127
- }));
128
- state.values.notified = true;
129
- }
130
- };
131
- void options.observability().then(async (obs) => {
132
- observability = obs;
133
- plugins.map((plugin) => observability?.setTag(`pluginEnabled-${plugin.meta.id}`, "true", "errors"));
134
- if (!client) {
135
- return;
136
- }
137
- await dispatch((0, import_app_framework.createIntent)(import_chunk_HZSRCP4I.ObservabilityAction.SendEvent, {
138
- name: "page.load",
139
- properties: {
140
- href: window.location.href,
141
- // TODO(wittjosiah): These apis are deprecated. Is there a better way to find this information?
142
- loadDuration: window.performance.timing.loadEventEnd - window.performance.timing.loadEventStart
143
- }
144
- }));
145
- (0, import_observability.setupTelemetryListeners)(options.namespace, client, observability);
146
- await Promise.all([
147
- observability.setIdentityTags(client.services.services),
148
- observability.startRuntimeMetrics(client),
149
- observability.startNetworkMetrics(client.services.services),
150
- observability.startSpacesMetrics(client, options.namespace)
151
- ]);
152
- if (client.halo.identity.get()) {
153
- await sendPrivacyNotice();
154
- } else {
155
- const subscription = client.halo.identity.subscribe(async (identity) => {
156
- if (identity && observability) {
157
- await sendPrivacyNotice();
158
- await observability.setIdentityTags(client.services.services);
159
- subscription.unsubscribe();
160
- }
161
- });
162
- }
70
+ var ObservabilityPlugin = (options) => (0, import_app_framework3.definePlugin)(import_chunk_7I7D7NBM.meta, [
71
+ (0, import_app_framework3.defineModule)({
72
+ id: `${import_chunk_7I7D7NBM.meta.id}/module/observability`,
73
+ activatesOn: import_app_framework3.Events.Startup,
74
+ activate: async () => (0, import_app_framework3.contributes)(import_chunk_X7HWBFE2.ObservabilityCapabilities.Observability, await options.observability())
75
+ }),
76
+ (0, import_app_framework3.defineModule)({
77
+ id: `${import_chunk_7I7D7NBM.meta.id}/module/settings`,
78
+ activatesOn: import_app_framework3.Events.SetupSettings,
79
+ activate: ObservabilitySettings
80
+ }),
81
+ (0, import_app_framework3.defineModule)({
82
+ id: `${import_chunk_7I7D7NBM.meta.id}/module/state`,
83
+ activatesOn: import_app_framework3.Events.Startup,
84
+ activatesAfter: [
85
+ ObservabilityEvents.StateReady
86
+ ],
87
+ activate: () => ObservabilityState({
88
+ namespace: options.namespace
89
+ })
90
+ }),
91
+ (0, import_app_framework3.defineModule)({
92
+ id: `${import_chunk_7I7D7NBM.meta.id}/module/translations`,
93
+ activatesOn: import_app_framework3.Events.SetupTranslations,
94
+ activate: () => (0, import_app_framework3.contributes)(import_app_framework3.Capabilities.Translations, translations_default)
95
+ }),
96
+ (0, import_app_framework3.defineModule)({
97
+ id: `${import_chunk_7I7D7NBM.meta.id}/module/intent-resolver`,
98
+ activatesOn: import_app_framework3.Events.SetupIntentResolver,
99
+ activate: (context) => IntentResolver({
100
+ context,
101
+ namespace: options.namespace
102
+ })
103
+ }),
104
+ (0, import_app_framework3.defineModule)({
105
+ id: `${import_chunk_7I7D7NBM.meta.id}/module/react-surface`,
106
+ activatesOn: import_app_framework3.Events.SetupReactSurface,
107
+ activate: ReactSurface
108
+ }),
109
+ (0, import_app_framework3.defineModule)({
110
+ id: `${import_chunk_7I7D7NBM.meta.id}/module/client-ready`,
111
+ activatesOn: (0, import_app_framework3.allOf)(import_app_framework3.Events.DispatcherReady, ObservabilityEvents.StateReady, ClientReadyEvent),
112
+ activate: async (context) => {
113
+ const observability = await options.observability();
114
+ return ClientReady({
115
+ context,
116
+ observability,
117
+ namespace: options.namespace
163
118
  });
164
- },
165
- unload: async () => {
166
- subscriptions.clear();
167
- await observability?.close();
168
- },
169
- provides: {
170
- intent: {
171
- resolvers: ({ plugins }) => {
172
- const client = (0, import_app_framework.findPlugin)(plugins, "dxos.org/plugin/client")?.provides.client;
173
- if (!client || !observability) {
174
- return [];
175
- }
176
- return [
177
- (0, import_app_framework.createResolver)(import_chunk_HZSRCP4I.ObservabilityAction.Toggle, async ({ state: state2 }) => {
178
- (0, import_invariant.invariant)(observability, "Observability instance not available", {
179
- F: __dxlog_file,
180
- L: 170,
181
- S: void 0,
182
- A: [
183
- "observability",
184
- "'Observability instance not available'"
185
- ]
186
- });
187
- settings.enabled = state2 ?? !settings.enabled;
188
- observability.event({
189
- identityId: (0, import_observability.getTelemetryIdentifier)(client),
190
- name: `${options.namespace}.observability.toggle`,
191
- properties: {
192
- enabled: settings.enabled
193
- }
194
- });
195
- observability.setMode(settings.enabled ? "basic" : "disabled");
196
- await (0, import_observability.storeObservabilityDisabled)(options.namespace, !settings.enabled);
197
- return {
198
- data: settings.enabled
199
- };
200
- }),
201
- (0, import_app_framework.createResolver)(import_chunk_HZSRCP4I.ObservabilityAction.SendEvent, async (data) => {
202
- (0, import_invariant.invariant)(observability, "Observability instance not available", {
203
- F: __dxlog_file,
204
- L: 184,
205
- S: void 0,
206
- A: [
207
- "observability",
208
- "'Observability instance not available'"
209
- ]
210
- });
211
- const event = {
212
- identityId: (0, import_observability.getTelemetryIdentifier)(client),
213
- name: `${options.namespace}.${data.name}`,
214
- properties: {
215
- ...data.properties
216
- }
217
- };
218
- observability.event(event);
219
- }),
220
- (0, import_app_framework.createResolver)(import_chunk_HZSRCP4I.ObservabilityAction.CaptureUserFeedback, async (data) => {
221
- (0, import_invariant.invariant)(observability, "Observability instance not available", {
222
- F: __dxlog_file,
223
- L: 195,
224
- S: void 0,
225
- A: [
226
- "observability",
227
- "'Observability instance not available'"
228
- ]
229
- });
230
- observability.captureUserFeedback(data.email, data.name, data.message);
231
- })
232
- ];
233
- }
234
- },
235
- observability: state.values,
236
- settings,
237
- surface: {
238
- definitions: () => (0, import_app_framework.createSurface)({
239
- id: import_chunk_SIUGGDNL.OBSERVABILITY_PLUGIN,
240
- role: "settings",
241
- filter: (data) => data.subject === import_chunk_SIUGGDNL.OBSERVABILITY_PLUGIN,
242
- component: () => /* @__PURE__ */ import_react.default.createElement(ObservabilitySettings, {
243
- settings
244
- })
245
- })
246
- },
247
- translations: translations_default
248
119
  }
249
- };
250
- };
251
- var src_default = ObservabilityPlugin;
120
+ })
121
+ ]);
252
122
  // Annotate the CommonJS export names for ESM import in node:
253
123
  0 && (module.exports = {
124
+ OBSERVABILITY_PLUGIN,
125
+ ObservabilityCapabilities,
126
+ ObservabilityEvents,
254
127
  ObservabilityPlugin,
255
- parseObservabilityPlugin
128
+ meta
256
129
  });
257
130
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../../src/ObservabilityPlugin.tsx", "../../../src/components/ObservabilitySettings.tsx", "../../../src/translations.ts", "../../../src/index.ts"],
4
- "sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport {\n type Plugin,\n type PluginDefinition,\n type IntentResolverProvides,\n type SettingsProvides,\n type SurfaceProvides,\n type TranslationsProvides,\n resolvePlugin,\n parseIntentPlugin,\n LayoutAction,\n SettingsAction,\n createSurface,\n findPlugin,\n createIntent,\n createResolver,\n} from '@dxos/app-framework';\nimport { EventSubscriptions } from '@dxos/async';\nimport { invariant } from '@dxos/invariant';\nimport { create } from '@dxos/live-object';\nimport { LocalStorageStore } from '@dxos/local-storage';\nimport {\n type Observability,\n getTelemetryIdentifier,\n setupTelemetryListeners,\n isObservabilityDisabled,\n storeObservabilityDisabled,\n getObservabilityGroup,\n} from '@dxos/observability';\nimport { type Client } from '@dxos/react-client';\n\nimport { ObservabilitySettings, type ObservabilitySettingsProps } from './components';\nimport meta, { OBSERVABILITY_PLUGIN } from './meta';\nimport translations from './translations';\nimport { ObservabilityAction } from './types';\n\nexport type ObservabilityPluginState = {\n group?: string;\n notified?: boolean;\n};\n\nexport type ObservabilityPluginProvides = IntentResolverProvides &\n SurfaceProvides &\n SettingsProvides<ObservabilitySettingsProps> &\n TranslationsProvides & {\n observability: ObservabilityPluginState;\n };\n\nexport const parseObservabilityPlugin = (plugin?: Plugin) =>\n (plugin?.provides as any).observability ? (plugin as Plugin<ObservabilityPluginProvides>) : undefined;\n\nexport const ObservabilityPlugin = (options: {\n namespace: string;\n observability: () => Promise<Observability>;\n}): PluginDefinition<ObservabilityPluginProvides> => {\n const settings = create<ObservabilitySettingsProps>({});\n const state = new LocalStorageStore<ObservabilityPluginState>(OBSERVABILITY_PLUGIN);\n const subscriptions = new EventSubscriptions();\n let observability: Observability | undefined;\n\n return {\n meta,\n initialize: async () => {\n settings.enabled = !(await isObservabilityDisabled(options.namespace));\n state.values.group = await getObservabilityGroup(options.namespace);\n state.prop({ key: 'notified', type: LocalStorageStore.bool({ allowUndefined: true }) });\n },\n ready: async ({ plugins }) => {\n const client = findPlugin<{ client: Client }>(plugins, 'dxos.org/plugin/client')?.provides.client;\n const intentPlugin = resolvePlugin(plugins, parseIntentPlugin);\n\n const dispatch = intentPlugin?.provides?.intent?.dispatchPromise;\n if (!dispatch) {\n return;\n }\n\n const sendPrivacyNotice = async () => {\n const environment = client?.config?.values.runtime?.app?.env?.DX_ENVIRONMENT;\n const notify =\n environment && environment !== 'ci' && !environment.endsWith('.local') && !environment.endsWith('.lan');\n if (!state.values.notified && notify) {\n await dispatch(\n createIntent(LayoutAction.SetLayout, {\n element: 'toast',\n subject: {\n id: `${OBSERVABILITY_PLUGIN}/notice`,\n // TODO(wittjosiah): Non-react translation utils.\n title: translations[0]['en-US'][OBSERVABILITY_PLUGIN]['observability toast label'],\n description: translations[0]['en-US'][OBSERVABILITY_PLUGIN]['observability toast description'],\n duration: Infinity,\n icon: 'ph--info--regular',\n actionLabel: translations[0]['en-US'][OBSERVABILITY_PLUGIN]['observability toast action label'],\n actionAlt: translations[0]['en-US'][OBSERVABILITY_PLUGIN]['observability toast action alt'],\n closeLabel: translations[0]['en-US'][OBSERVABILITY_PLUGIN]['observability toast close label'],\n onAction: () => dispatch(createIntent(SettingsAction.Open, { plugin: OBSERVABILITY_PLUGIN })),\n },\n }),\n );\n\n state.values.notified = true;\n }\n };\n\n // Initialize asynchronously in the background, not in plugin initialization.\n // Should not block application startup.\n void options.observability().then(async (obs) => {\n observability = obs;\n\n // Ensure errors are tagged with enabled plugins to help with reproductions.\n plugins.map((plugin) => observability?.setTag(`pluginEnabled-${plugin.meta.id}`, 'true', 'errors'));\n\n // Start client observability (i.e. not running as shared worker)\n // TODO(nf): how to prevent multiple instances for single shared worker?\n if (!client) {\n return;\n }\n\n await dispatch(\n createIntent(ObservabilityAction.SendEvent, {\n name: 'page.load',\n properties: {\n href: window.location.href,\n // TODO(wittjosiah): These apis are deprecated. Is there a better way to find this information?\n loadDuration: window.performance.timing.loadEventEnd - window.performance.timing.loadEventStart,\n },\n }),\n );\n\n setupTelemetryListeners(options.namespace, client, observability);\n\n await Promise.all([\n observability.setIdentityTags(client.services.services),\n observability.startRuntimeMetrics(client),\n observability.startNetworkMetrics(client.services.services),\n observability.startSpacesMetrics(client, options.namespace),\n ]);\n\n if (client.halo.identity.get()) {\n await sendPrivacyNotice();\n } else {\n const subscription = client.halo.identity.subscribe(async (identity) => {\n if (identity && observability) {\n await sendPrivacyNotice();\n await observability.setIdentityTags(client.services.services);\n subscription.unsubscribe();\n }\n });\n }\n });\n },\n unload: async () => {\n subscriptions.clear();\n await observability?.close();\n },\n provides: {\n intent: {\n resolvers: ({ plugins }) => {\n const client = findPlugin<{ client: Client }>(plugins, 'dxos.org/plugin/client')?.provides.client;\n if (!client || !observability) {\n return [];\n }\n\n return [\n createResolver(ObservabilityAction.Toggle, async ({ state }) => {\n invariant(observability, 'Observability instance not available');\n settings.enabled = state ?? !settings.enabled;\n observability.event({\n identityId: getTelemetryIdentifier(client),\n name: `${options.namespace}.observability.toggle`,\n properties: {\n enabled: settings.enabled,\n },\n });\n observability.setMode(settings.enabled ? 'basic' : 'disabled');\n await storeObservabilityDisabled(options.namespace, !settings.enabled);\n return { data: settings.enabled };\n }),\n createResolver(ObservabilityAction.SendEvent, async (data) => {\n invariant(observability, 'Observability instance not available');\n const event = {\n identityId: getTelemetryIdentifier(client),\n name: `${options.namespace}.${data.name}`,\n properties: {\n ...data.properties,\n },\n };\n observability.event(event);\n }),\n createResolver(ObservabilityAction.CaptureUserFeedback, async (data) => {\n invariant(observability, 'Observability instance not available');\n observability.captureUserFeedback(data.email, data.name, data.message);\n }),\n ];\n },\n },\n observability: state.values,\n settings,\n surface: {\n definitions: () =>\n createSurface({\n id: OBSERVABILITY_PLUGIN,\n role: 'settings',\n filter: (data): data is any => data.subject === OBSERVABILITY_PLUGIN,\n component: () => <ObservabilitySettings settings={settings} />,\n }),\n },\n translations,\n },\n };\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport React from 'react';\n\nimport { createIntent, useIntentDispatcher } from '@dxos/app-framework';\nimport { Input, Message, useTranslation } from '@dxos/react-ui';\nimport { DeprecatedFormInput } from '@dxos/react-ui-form';\n\nimport { OBSERVABILITY_PLUGIN } from '../meta';\nimport { ObservabilityAction } from '../types';\n\nexport type ObservabilitySettingsProps = {\n enabled?: boolean;\n // TODO(wittjosiah): Separate settings for each observability feature.\n // metrics?: boolean;\n // telemetry?: boolean;\n // errors?: boolean;\n};\n\nexport const ObservabilitySettings = ({ settings }: { settings: ObservabilitySettingsProps }) => {\n const { t } = useTranslation(OBSERVABILITY_PLUGIN);\n const { dispatchPromise: dispatch } = useIntentDispatcher();\n\n return (\n <>\n <DeprecatedFormInput\n label={t('observability enabled label')}\n secondary={\n <Message.Root valence='info'>\n <Message.Body>{t('observability description')}</Message.Body>\n </Message.Root>\n }\n >\n <Input.Switch\n checked={settings.enabled}\n onCheckedChange={(checked) => dispatch(createIntent(ObservabilityAction.Toggle, { state: !!checked }))}\n />\n </DeprecatedFormInput>\n </>\n );\n};\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { OBSERVABILITY_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [OBSERVABILITY_PLUGIN]: {\n 'plugin name': 'Telemetry',\n 'observability toast label': 'Privacy Notice',\n 'observability toast description':\n 'Composer collects usage and performance metrics to improve the product. No user data is collected.',\n 'observability toast action label': 'Settings',\n 'observability toast action alt': 'Open settings to learn more or to disable.',\n 'observability toast close label': 'Okay',\n 'observability enabled label': 'Enable telemetry',\n // TODO: Add link about telemetry privacy. Make it clearer that user data is not collected.\n 'observability description':\n 'When enabled, basic usage data will be sent to the DXOS team in order 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.',\n },\n },\n },\n];\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { ObservabilityPlugin } from './ObservabilityPlugin';\n\nexport default ObservabilityPlugin;\n\nexport * from './ObservabilityPlugin';\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mBAAkB;AAElB,2BAeO;AACP,mBAAmC;AACnC,uBAA0B;AAC1B,yBAAuB;AACvB,2BAAkC;AAClC,2BAOO;AC7BP,IAAAA,gBAAkB;AAElB,IAAAC,wBAAkD;AAClD,sBAA+C;AAC/C,2BAAoC;AAa7B,IAAMC,wBAAwB,CAAC,EAAEC,SAAQ,MAA4C;AAC1F,QAAM,EAAEC,EAAC,QAAKC,gCAAeC,0CAAAA;AAC7B,QAAM,EAAEC,iBAAiBC,SAAQ,QAAKC,2CAAAA;AAEtC,SACE,8BAAAC,QAAA,cAAA,cAAAA,QAAA,UAAA,MACE,8BAAAA,QAAA,cAACC,0CAAAA;IACCC,OAAOR,EAAE,6BAAA;IACTS,WACE,8BAAAH,QAAA,cAACI,wBAAQC,MAAI;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pB;cACF,CAAA;AACAS,4BAAc6F,QAAQxH,SAASkB,UAAU,UAAU,UAAA;AACnD,wBAAMuG,iDAA2B3F,QAAQQ,WAAW,CAACtC,SAASkB,OAAO;AACrE,qBAAO;gBAAEwG,MAAM1H,SAASkB;cAAQ;YAClC,CAAA;gBACAiG,qCAAe9F,0CAAoBiE,WAAW,OAAOoC,SAAAA;AACnDN,8CAAUzF,eAAe,wCAAA;;;;;;;;;AACzB,oBAAM0F,QAAQ;gBACZC,gBAAYC,6CAAuBtE,MAAAA;gBACnCsC,MAAM,GAAGzD,QAAQQ,SAAS,IAAIoF,KAAKnC,IAAI;gBACvCC,YAAY;kBACV,GAAGkC,KAAKlC;gBACV;cACF;AACA7D,4BAAc0F,MAAMA,KAAAA;YACtB,CAAA;gBACAF,qCAAe9F,0CAAoBsG,qBAAqB,OAAOD,SAAAA;AAC7DN,8CAAUzF,eAAe,wCAAA;;;;;;;;;AACzBA,4BAAciG,oBAAoBF,KAAKG,OAAOH,KAAKnC,MAAMmC,KAAKI,OAAO;YACvE,CAAA;;QAEJ;MACF;MACAnG,eAAeJ,MAAMgB;MACrBvC;MACA+H,SAAS;QACPC,aAAa,UACXC,oCAAc;UACZ5D,IAAIlE;UACJ+H,MAAM;UACNC,QAAQ,CAACT,SAAsBA,KAAKtD,YAAYjE;UAChDiI,WAAW,MAAM7H,6BAAAA,QAAA,cAACR,uBAAAA;YAAsBC;;QAC1C,CAAA;MACJ;MACAuE,cAAAA;IACF;EACF;AACF;AGhNA,IAAA,cAAe1C;",
6
- "names": ["import_react", "import_app_framework", "ObservabilitySettings", "settings", "t", "useTranslation", "OBSERVABILITY_PLUGIN", "dispatchPromise", "dispatch", "useIntentDispatcher", "React", "DeprecatedFormInput", "label", "secondary", "Message", "Root", "valence", "Body", "Input", "Switch", "checked", "enabled", "onCheckedChange", "createIntent", "ObservabilityAction", "Toggle", "state", "parseObservabilityPlugin", "plugin", "provides", "observability", "undefined", "ObservabilityPlugin", "options", "create", "LocalStorageStore", "subscriptions", "EventSubscriptions", "meta", "initialize", "isObservabilityDisabled", "namespace", "values", "group", "getObservabilityGroup", "prop", "key", "type", "bool", "allowUndefined", "ready", "plugins", "client", "findPlugin", "intentPlugin", "resolvePlugin", "parseIntentPlugin", "intent", "sendPrivacyNotice", "environment", "config", "runtime", "app", "env", "DX_ENVIRONMENT", "notify", "endsWith", "notified", "LayoutAction", "SetLayout", "element", "subject", "id", "title", "translations", "description", "duration", "Infinity", "icon", "actionLabel", "actionAlt", "closeLabel", "onAction", "SettingsAction", "Open", "then", "obs", "map", "setTag", "SendEvent", "name", "properties", "href", "window", "location", "loadDuration", "performance", "timing", "loadEventEnd", "loadEventStart", "setupTelemetryListeners", "Promise", "all", "setIdentityTags", "services", "startRuntimeMetrics", "startNetworkMetrics", "startSpacesMetrics", "halo", "identity", "get", "subscription", "subscribe", "unsubscribe", "unload", "clear", "close", "resolvers", "createResolver", "invariant", "event", "identityId", "getTelemetryIdentifier", "setMode", "storeObservabilityDisabled", "data", "CaptureUserFeedback", "captureUserFeedback", "email", "message", "surface", "definitions", "createSurface", "role", "filter", "component"]
3
+ "sources": ["../../../src/capabilities/index.ts", "../../../src/events.ts", "../../../src/ObservabilityPlugin.ts", "../../../src/translations.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { lazy } from '@dxos/app-framework';\n\nexport const ClientReady = lazy(() => import('./client-ready'));\nexport const IntentResolver = lazy(() => import('./intents-resolver'));\nexport const ReactSurface = lazy(() => import('./react-surface'));\nexport const ObservabilitySettings = lazy(() => import('./settings'));\nexport const ObservabilityState = lazy(() => import('./state'));\n\nexport * from './capabilities';\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { defineEvent, Events } from '@dxos/app-framework';\n\nimport { OBSERVABILITY_PLUGIN } from './meta';\n\nexport namespace ObservabilityEvents {\n export const StateReady = Events.createStateEvent(OBSERVABILITY_PLUGIN);\n}\n\n// NOTE: This is cloned from the client plugin to avoid circular dependencies.\nexport const ClientReadyEvent = defineEvent('dxos.org/plugin/client/event/client-ready');\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { allOf, Capabilities, contributes, defineModule, definePlugin, Events } from '@dxos/app-framework';\nimport { type Observability } from '@dxos/observability';\n\nimport {\n ClientReady,\n IntentResolver,\n ObservabilityCapabilities,\n ObservabilitySettings,\n ObservabilityState,\n ReactSurface,\n} from './capabilities';\nimport { ObservabilityEvents, ClientReadyEvent } from './events';\nimport { meta } from './meta';\nimport translations from './translations';\n\nexport const ObservabilityPlugin = (options: { namespace: string; observability: () => Promise<Observability> }) =>\n definePlugin(meta, [\n defineModule({\n id: `${meta.id}/module/observability`,\n activatesOn: Events.Startup,\n activate: async () => contributes(ObservabilityCapabilities.Observability, await options.observability()),\n }),\n defineModule({\n id: `${meta.id}/module/settings`,\n activatesOn: Events.SetupSettings,\n activate: ObservabilitySettings,\n }),\n defineModule({\n id: `${meta.id}/module/state`,\n activatesOn: Events.Startup,\n activatesAfter: [ObservabilityEvents.StateReady],\n activate: () => ObservabilityState({ namespace: options.namespace }),\n }),\n defineModule({\n id: `${meta.id}/module/translations`,\n activatesOn: Events.SetupTranslations,\n activate: () => contributes(Capabilities.Translations, translations),\n }),\n defineModule({\n id: `${meta.id}/module/intent-resolver`,\n activatesOn: Events.SetupIntentResolver,\n activate: (context) => IntentResolver({ context, namespace: options.namespace }),\n }),\n defineModule({\n id: `${meta.id}/module/react-surface`,\n activatesOn: Events.SetupReactSurface,\n activate: ReactSurface,\n }),\n defineModule({\n id: `${meta.id}/module/client-ready`,\n activatesOn: allOf(Events.DispatcherReady, ObservabilityEvents.StateReady, ClientReadyEvent),\n activate: async (context) => {\n const observability = await options.observability();\n return ClientReady({ context, observability, namespace: options.namespace });\n },\n }),\n ]);\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { OBSERVABILITY_PLUGIN } from './meta';\n\nexport default [\n {\n 'en-US': {\n [OBSERVABILITY_PLUGIN]: {\n 'plugin name': 'Telemetry',\n 'observability toast label': 'Privacy Notice',\n 'observability toast description':\n 'Composer collects usage and performance metrics to improve the product. No user data is collected.',\n 'observability toast action label': 'Settings',\n 'observability toast action alt': 'Open settings to learn more or to disable.',\n 'observability toast close label': 'Okay',\n 'observability enabled label': 'Enable telemetry',\n // TODO: Add link about telemetry privacy. Make it clearer that user data is not collected.\n 'observability description':\n '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.',\n },\n },\n },\n];\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,2BAAqB;ACArB,IAAAA,wBAAoC;ACApC,IAAAA,wBAAqF;AFE9E,IAAMC,kBAAcC,2BAAK,MAAM,OAAO,6BAAA,CAAA;AACtC,IAAMC,qBAAiBD,2BAAK,MAAM,OAAO,iCAAA,CAAA;AACzC,IAAME,mBAAeF,2BAAK,MAAM,OAAO,8BAAA,CAAA;AACvC,IAAMG,4BAAwBH,2BAAK,MAAM,OAAO,yBAAA,CAAA;AAChD,IAAMI,yBAAqBJ,2BAAK,MAAM,OAAO,sBAAA,CAAA;;UCFnCK,sBAAAA;uBACFC,aAAaC,6BAAOC,iBAAiBC,0CAAAA;AACpD,GAFiBJ,wBAAAA,sBAAAA,CAAAA,EAAAA;AAKV,IAAMK,uBAAmBC,mCAAY,2CAAA;AEP5C,IAAA,uBAAe;EACb;IACE,SAAS;MACP,CAACF,0CAAAA,GAAuB;QACtB,eAAe;QACf,6BAA6B;QAC7B,mCACE;QACF,oCAAoC;QACpC,kCAAkC;QAClC,mCAAmC;QACnC,+BAA+B;;QAE/B,6BACE;MACJ;IACF;EACF;;ADJK,IAAMG,sBAAsB,CAACC,gBAClCC,oCAAaC,4BAAM;MACjBC,oCAAa;IACXC,IAAI,GAAGF,2BAAKE,EAAE;IACdC,aAAaX,sBAAAA,OAAOY;IACpBC,UAAU,gBAAYC,mCAAYC,gDAA0BC,eAAe,MAAMV,QAAQW,cAAa,CAAA;EACxG,CAAA;MACAR,oCAAa;IACXC,IAAI,GAAGF,2BAAKE,EAAE;IACdC,aAAaX,sBAAAA,OAAOkB;IACpBL,UAAUjB;EACZ,CAAA;MACAa,oCAAa;IACXC,IAAI,GAAGF,2BAAKE,EAAE;IACdC,aAAaX,sBAAAA,OAAOY;IACpBO,gBAAgB;MAACrB,oBAAoBC;;IACrCc,UAAU,MAAMhB,mBAAmB;MAAEuB,WAAWd,QAAQc;IAAU,CAAA;EACpE,CAAA;MACAX,oCAAa;IACXC,IAAI,GAAGF,2BAAKE,EAAE;IACdC,aAAaX,sBAAAA,OAAOqB;IACpBR,UAAU,UAAMC,mCAAYQ,mCAAaC,cAAcC,oBAAAA;EACzD,CAAA;MACAf,oCAAa;IACXC,IAAI,GAAGF,2BAAKE,EAAE;IACdC,aAAaX,sBAAAA,OAAOyB;IACpBZ,UAAU,CAACa,YAAYhC,eAAe;MAAEgC;MAASN,WAAWd,QAAQc;IAAU,CAAA;EAChF,CAAA;MACAX,oCAAa;IACXC,IAAI,GAAGF,2BAAKE,EAAE;IACdC,aAAaX,sBAAAA,OAAO2B;IACpBd,UAAUlB;EACZ,CAAA;MACAc,oCAAa;IACXC,IAAI,GAAGF,2BAAKE,EAAE;IACdC,iBAAaiB,6BAAM5B,sBAAAA,OAAO6B,iBAAiB/B,oBAAoBC,YAAYI,gBAAAA;IAC3EU,UAAU,OAAOa,YAAAA;AACf,YAAMT,gBAAgB,MAAMX,QAAQW,cAAa;AACjD,aAAOzB,YAAY;QAAEkC;QAAST;QAAeG,WAAWd,QAAQc;MAAU,CAAA;IAC5E;EACF,CAAA;CACD;",
6
+ "names": ["import_app_framework", "ClientReady", "lazy", "IntentResolver", "ReactSurface", "ObservabilitySettings", "ObservabilityState", "ObservabilityEvents", "StateReady", "Events", "createStateEvent", "OBSERVABILITY_PLUGIN", "ClientReadyEvent", "defineEvent", "ObservabilityPlugin", "options", "definePlugin", "meta", "defineModule", "id", "activatesOn", "Startup", "activate", "contributes", "ObservabilityCapabilities", "Observability", "observability", "SetupSettings", "activatesAfter", "namespace", "SetupTranslations", "Capabilities", "Translations", "translations", "SetupIntentResolver", "context", "SetupReactSurface", "allOf", "DispatcherReady"]
7
7
  }
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var intents_resolver_UCNXONFF_exports = {};
20
+ __export(intents_resolver_UCNXONFF_exports, {
21
+ default: () => intents_resolver_default
22
+ });
23
+ module.exports = __toCommonJS(intents_resolver_UCNXONFF_exports);
24
+ var import_chunk_XBDGBB5D = require("./chunk-XBDGBB5D.cjs");
25
+ var import_chunk_X7HWBFE2 = require("./chunk-X7HWBFE2.cjs");
26
+ var import_chunk_7I7D7NBM = require("./chunk-7I7D7NBM.cjs");
27
+ var import_app_framework = require("@dxos/app-framework");
28
+ var import_observability = require("@dxos/observability");
29
+ var intents_resolver_default = ({ context, namespace }) => (0, import_app_framework.contributes)(import_app_framework.Capabilities.IntentResolver, [
30
+ (0, import_app_framework.createResolver)({
31
+ intent: import_chunk_XBDGBB5D.ObservabilityAction.Toggle,
32
+ resolve: async ({ state }) => {
33
+ const client = context.requestCapability(import_chunk_X7HWBFE2.ClientCapability);
34
+ const observability = context.requestCapability(import_chunk_X7HWBFE2.ObservabilityCapabilities.Observability);
35
+ const settings = context.requestCapability(import_app_framework.Capabilities.SettingsStore).getStore(import_chunk_7I7D7NBM.OBSERVABILITY_PLUGIN).value;
36
+ settings.enabled = state ?? !settings.enabled;
37
+ observability.event({
38
+ did: (0, import_observability.getTelemetryIdentifier)(client),
39
+ name: `${namespace}.observability.toggle`,
40
+ properties: {
41
+ enabled: settings.enabled
42
+ }
43
+ });
44
+ observability.setMode(settings.enabled ? "basic" : "disabled");
45
+ await (0, import_observability.storeObservabilityDisabled)(namespace, !settings.enabled);
46
+ return {
47
+ data: settings.enabled
48
+ };
49
+ }
50
+ }),
51
+ (0, import_app_framework.createResolver)({
52
+ intent: import_chunk_XBDGBB5D.ObservabilityAction.SendEvent,
53
+ resolve: (data) => {
54
+ const client = context.requestCapability(import_chunk_X7HWBFE2.ClientCapability);
55
+ void context.waitForCapability(import_chunk_X7HWBFE2.ObservabilityCapabilities.Observability).then((observability) => {
56
+ const event = {
57
+ did: (0, import_observability.getTelemetryIdentifier)(client),
58
+ name: `${namespace}.${data.name}`,
59
+ properties: {
60
+ ...data.properties
61
+ }
62
+ };
63
+ observability.event(event);
64
+ });
65
+ }
66
+ }),
67
+ (0, import_app_framework.createResolver)({
68
+ intent: import_chunk_XBDGBB5D.ObservabilityAction.CaptureUserFeedback,
69
+ resolve: async (data) => {
70
+ const observability = context.requestCapability(import_chunk_X7HWBFE2.ObservabilityCapabilities.Observability);
71
+ observability.captureUserFeedback(data.email, data.name, data.message);
72
+ }
73
+ })
74
+ ]);
75
+ //# sourceMappingURL=intents-resolver-UCNXONFF.cjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/capabilities/intents-resolver.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capabilities, contributes, createResolver, type PluginsContext } from '@dxos/app-framework';\nimport { getTelemetryIdentifier, storeObservabilityDisabled } from '@dxos/observability';\n\nimport { ClientCapability, ObservabilityCapabilities } from './capabilities';\nimport { type ObservabilitySettingsProps } from '../components';\nimport { OBSERVABILITY_PLUGIN } from '../meta';\nimport { ObservabilityAction } from '../types';\n\nexport default ({ context, namespace }: { context: PluginsContext; namespace: string }) =>\n contributes(Capabilities.IntentResolver, [\n createResolver({\n intent: ObservabilityAction.Toggle,\n resolve: async ({ state }) => {\n const client = context.requestCapability(ClientCapability);\n const observability = context.requestCapability(ObservabilityCapabilities.Observability);\n const settings = context\n .requestCapability(Capabilities.SettingsStore)\n .getStore<ObservabilitySettingsProps>(OBSERVABILITY_PLUGIN)!.value;\n settings.enabled = state ?? !settings.enabled;\n observability.event({\n did: getTelemetryIdentifier(client),\n name: `${namespace}.observability.toggle`,\n properties: {\n enabled: settings.enabled,\n },\n });\n observability.setMode(settings.enabled ? 'basic' : 'disabled');\n await storeObservabilityDisabled(namespace, !settings.enabled);\n return { data: settings.enabled };\n },\n }),\n createResolver({\n intent: ObservabilityAction.SendEvent,\n resolve: (data) => {\n const client = context.requestCapability(ClientCapability);\n // NOTE: This is to ensure that events fired before observability is ready are still sent.\n // TODO(wittjosiah): If the intent dispatcher supports concurrent actions in the future,\n // then this could awaited still rather than voiding.\n void context.waitForCapability(ObservabilityCapabilities.Observability).then((observability) => {\n const event = {\n did: getTelemetryIdentifier(client),\n name: `${namespace}.${data.name}`,\n properties: {\n ...data.properties,\n },\n };\n observability.event(event);\n });\n },\n }),\n createResolver({\n intent: ObservabilityAction.CaptureUserFeedback,\n resolve: async (data) => {\n const observability = context.requestCapability(ObservabilityCapabilities.Observability);\n observability.captureUserFeedback(data.email, data.name, data.message);\n },\n }),\n ]);\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,2BAA+E;AAC/E,2BAAmE;AAOnE,IAAA,2BAAe,CAAC,EAAEA,SAASC,UAAS,UAClCC,kCAAYC,kCAAaC,gBAAgB;MACvCC,qCAAe;IACbC,QAAQC,0CAAoBC;IAC5BC,SAAS,OAAO,EAAEC,MAAK,MAAE;AACvB,YAAMC,SAASX,QAAQY,kBAAkBC,sCAAAA;AACzC,YAAMC,gBAAgBd,QAAQY,kBAAkBG,gDAA0BC,aAAa;AACvF,YAAMC,WAAWjB,QACdY,kBAAkBT,kCAAae,aAAa,EAC5CC,SAAqCC,0CAAAA,EAAuBC;AAC/DJ,eAASK,UAAUZ,SAAS,CAACO,SAASK;AACtCR,oBAAcS,MAAM;QAClBC,SAAKC,6CAAuBd,MAAAA;QAC5Be,MAAM,GAAGzB,SAAAA;QACT0B,YAAY;UACVL,SAASL,SAASK;QACpB;MACF,CAAA;AACAR,oBAAcc,QAAQX,SAASK,UAAU,UAAU,UAAA;AACnD,gBAAMO,iDAA2B5B,WAAW,CAACgB,SAASK,OAAO;AAC7D,aAAO;QAAEQ,MAAMb,SAASK;MAAQ;IAClC;EACF,CAAA;MACAjB,qCAAe;IACbC,QAAQC,0CAAoBwB;IAC5BtB,SAAS,CAACqB,SAAAA;AACR,YAAMnB,SAASX,QAAQY,kBAAkBC,sCAAAA;AAIzC,WAAKb,QAAQgC,kBAAkBjB,gDAA0BC,aAAa,EAAEiB,KAAK,CAACnB,kBAAAA;AAC5E,cAAMS,QAAQ;UACZC,SAAKC,6CAAuBd,MAAAA;UAC5Be,MAAM,GAAGzB,SAAAA,IAAa6B,KAAKJ,IAAI;UAC/BC,YAAY;YACV,GAAGG,KAAKH;UACV;QACF;AACAb,sBAAcS,MAAMA,KAAAA;MACtB,CAAA;IACF;EACF,CAAA;MACAlB,qCAAe;IACbC,QAAQC,0CAAoB2B;IAC5BzB,SAAS,OAAOqB,SAAAA;AACd,YAAMhB,gBAAgBd,QAAQY,kBAAkBG,gDAA0BC,aAAa;AACvFF,oBAAcqB,oBAAoBL,KAAKM,OAAON,KAAKJ,MAAMI,KAAKO,OAAO;IACvE;EACF,CAAA;CACD;",
6
+ "names": ["context", "namespace", "contributes", "Capabilities", "IntentResolver", "createResolver", "intent", "ObservabilityAction", "Toggle", "resolve", "state", "client", "requestCapability", "ClientCapability", "observability", "ObservabilityCapabilities", "Observability", "settings", "SettingsStore", "getStore", "OBSERVABILITY_PLUGIN", "value", "enabled", "event", "did", "getTelemetryIdentifier", "name", "properties", "setMode", "storeObservabilityDisabled", "data", "SendEvent", "waitForCapability", "then", "CaptureUserFeedback", "captureUserFeedback", "email", "message"]
7
+ }