@motiadev/plugin-observability 0.8.2-beta.140-111855

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 (52) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +56 -0
  3. package/dist/api.d.ts +3 -0
  4. package/dist/api.d.ts.map +1 -0
  5. package/dist/components/events/code/function-call.d.ts +14 -0
  6. package/dist/components/events/code/function-call.d.ts.map +1 -0
  7. package/dist/components/events/event-icon.d.ts +8 -0
  8. package/dist/components/events/event-icon.d.ts.map +1 -0
  9. package/dist/components/events/trace-emit-event.d.ts +6 -0
  10. package/dist/components/events/trace-emit-event.d.ts.map +1 -0
  11. package/dist/components/events/trace-event.d.ts +6 -0
  12. package/dist/components/events/trace-event.d.ts.map +1 -0
  13. package/dist/components/events/trace-log-event.d.ts +6 -0
  14. package/dist/components/events/trace-log-event.d.ts.map +1 -0
  15. package/dist/components/events/trace-state-event.d.ts +6 -0
  16. package/dist/components/events/trace-state-event.d.ts.map +1 -0
  17. package/dist/components/events/trace-stream-event.d.ts +6 -0
  18. package/dist/components/events/trace-stream-event.d.ts.map +1 -0
  19. package/dist/components/hooks/use-get-endtime.d.ts +3 -0
  20. package/dist/components/hooks/use-get-endtime.d.ts.map +1 -0
  21. package/dist/components/observability-page.d.ts +2 -0
  22. package/dist/components/observability-page.d.ts.map +1 -0
  23. package/dist/components/observability-tab-label.d.ts +2 -0
  24. package/dist/components/observability-tab-label.d.ts.map +1 -0
  25. package/dist/components/trace-item/trace-item-detail.d.ts +9 -0
  26. package/dist/components/trace-item/trace-item-detail.d.ts.map +1 -0
  27. package/dist/components/trace-item/trace-item.d.ts +11 -0
  28. package/dist/components/trace-item/trace-item.d.ts.map +1 -0
  29. package/dist/components/trace-status.d.ts +9 -0
  30. package/dist/components/trace-status.d.ts.map +1 -0
  31. package/dist/components/trace-timeline.d.ts +7 -0
  32. package/dist/components/trace-timeline.d.ts.map +1 -0
  33. package/dist/components/traces-groups.d.ts +10 -0
  34. package/dist/components/traces-groups.d.ts.map +1 -0
  35. package/dist/hooks/use-get-endtime.d.ts +3 -0
  36. package/dist/hooks/use-get-endtime.d.ts.map +1 -0
  37. package/dist/index.cjs +22 -0
  38. package/dist/index.d.ts +4 -0
  39. package/dist/index.d.ts.map +1 -0
  40. package/dist/index.js +588 -0
  41. package/dist/lib/utils.d.ts +2 -0
  42. package/dist/lib/utils.d.ts.map +1 -0
  43. package/dist/plugin-observability.css +1 -0
  44. package/dist/plugin.cjs +1 -0
  45. package/dist/plugin.d.ts +3 -0
  46. package/dist/plugin.d.ts.map +1 -0
  47. package/dist/plugin.js +38 -0
  48. package/dist/stores/use-observability-store.d.ts +8 -0
  49. package/dist/stores/use-observability-store.d.ts.map +1 -0
  50. package/dist/types/observability.d.ts +79 -0
  51. package/dist/types/observability.d.ts.map +1 -0
  52. package/package.json +51 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Motia
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,56 @@
1
+ # @motiadev/plugin-observability
2
+
3
+ This package provides React components for the Motia workbench observability functionality.
4
+
5
+ ## Features
6
+
7
+ - **ObservabilityPage**: Main observability page component with trace timeline and groups
8
+ - **TraceTimeline**: Interactive timeline visualization for trace execution
9
+ - **TraceGroups**: List of trace groups with filtering and selection
10
+ - **TraceDetails**: Detailed view of individual traces with events
11
+ - **Event Visualization**: Specialized components for different event types (logs, state, emit, stream)
12
+ - **Real-time Updates**: Live updates via stream-client integration
13
+
14
+ ## TailwindCSS Compilation
15
+
16
+ This package includes TailwindCSS compilation to ensure all Tailwind classes used in the components are properly compiled and available.
17
+
18
+ ### Build Process
19
+
20
+ The build process includes two steps:
21
+
22
+ 1. **CSS Compilation**: Compiles `src/styles.css` using PostCSS and TailwindCSS
23
+ 2. **TypeScript Compilation**: Compiles TypeScript files to JavaScript
24
+
25
+ ### Development
26
+
27
+ - `pnpm run build` - Build both CSS and TypeScript
28
+ - `pnpm run dev` - Watch mode for both CSS and TypeScript
29
+ - `pnpm run clean` - Clean the dist directory
30
+
31
+ ### Configuration Files
32
+
33
+ - `src/styles.css` - Main CSS entry point with Tailwind imports
34
+
35
+ ## Components
36
+
37
+ ### Main Components
38
+
39
+ - **ObservabilityPage**: Main page component with trace timeline and groups
40
+ - **TraceTimeline**: Interactive timeline showing trace execution over time
41
+ - **TracesGroups**: List view of trace groups with status indicators
42
+ - **TraceItemDetail**: Detailed sidebar view of individual traces
43
+
44
+ ### Event Components
45
+
46
+ - **TraceEvent**: Base component for rendering different event types
47
+ - **TraceLogEvent**: Renders log entries with level indicators
48
+ - **TraceEmitEvent**: Shows event emissions
49
+ - **TraceStateEvent**: Displays state operations
50
+ - **TraceStreamEvent**: Visualizes stream operations
51
+ - **FunctionCall**: Code-style rendering of function calls
52
+
53
+ ### Utilities
54
+
55
+ - **useGetEndTime**: Hook for calculating trace end times
56
+ - **useObservabilityStore**: Zustand store for managing UI state
package/dist/api.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import { MotiaPluginContext } from '@motiadev/core';
2
+ export declare const api: ({ tracerFactory, registerApi }: MotiaPluginContext) => void;
3
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAErE,eAAO,MAAM,GAAG,GAAI,gCAAgC,kBAAkB,KAAG,IAsBxE,CAAA"}
@@ -0,0 +1,14 @@
1
+ import { default as React } from 'react';
2
+ type Props = {
3
+ topLevelClassName?: string;
4
+ objectName?: string;
5
+ functionName: string;
6
+ args: Array<string | object | false | undefined>;
7
+ callsQuantity?: number;
8
+ };
9
+ export declare const Argument: React.FC<{
10
+ arg: string | object | false;
11
+ }>;
12
+ export declare const FunctionCall: React.FC<Props>;
13
+ export {};
14
+ //# sourceMappingURL=function-call.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"function-call.d.ts","sourceRoot":"","sources":["../../../../src/components/events/code/function-call.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,KAAK,KAAK,GAAG;IACX,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,YAAY,EAAE,MAAM,CAAA;IACpB,IAAI,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC,CAAA;IAChD,aAAa,CAAC,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAAA;CAAE,CAsB/D,CAAA;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CA4BxC,CAAA"}
@@ -0,0 +1,8 @@
1
+ import { default as React } from 'react';
2
+ import { TraceEvent as TraceEventType } from '../../types/observability';
3
+ type Props = {
4
+ event: TraceEventType;
5
+ };
6
+ export declare const EventIcon: React.FC<Props>;
7
+ export {};
8
+ //# sourceMappingURL=event-icon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-icon.d.ts","sourceRoot":"","sources":["../../../src/components/events/event-icon.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAE7E,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,cAAc,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAUrC,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ import { EmitEvent } from '../../types/observability';
3
+ export declare const TraceEmitEvent: React.FC<{
4
+ event: EmitEvent;
5
+ }>;
6
+ //# sourceMappingURL=trace-emit-event.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trace-emit-event.d.ts","sourceRoot":"","sources":["../../../src/components/events/trace-emit-event.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AAG1D,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,KAAK,EAAE,SAAS,CAAA;CAAE,CAEzD,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ import { TraceEvent as TraceEventType } from '../../types/observability';
3
+ export declare const TraceEvent: React.FC<{
4
+ event: TraceEventType;
5
+ }>;
6
+ //# sourceMappingURL=trace-event.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trace-event.d.ts","sourceRoot":"","sources":["../../../src/components/events/trace-event.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAM7E,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,KAAK,EAAE,cAAc,CAAA;CAAE,CAUzD,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ import { LogEntry } from '../../types/observability';
3
+ export declare const TraceLogEvent: React.FC<{
4
+ event: LogEntry;
5
+ }>;
6
+ //# sourceMappingURL=trace-log-event.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trace-log-event.d.ts","sourceRoot":"","sources":["../../../src/components/events/trace-log-event.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AAEzD,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,KAAK,EAAE,QAAQ,CAAA;CAAE,CAMvD,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ import { StateEvent } from '../../types/observability';
3
+ export declare const TraceStateEvent: React.FC<{
4
+ event: StateEvent;
5
+ }>;
6
+ //# sourceMappingURL=trace-state-event.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trace-state-event.d.ts","sourceRoot":"","sources":["../../../src/components/events/trace-state-event.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAG3D,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,KAAK,EAAE,UAAU,CAAA;CAAE,CAQ3D,CAAA"}
@@ -0,0 +1,6 @@
1
+ import { default as React } from 'react';
2
+ import { StreamEvent } from '../../types/observability';
3
+ export declare const TraceStreamEvent: React.FC<{
4
+ event: StreamEvent;
5
+ }>;
6
+ //# sourceMappingURL=trace-stream-event.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trace-stream-event.d.ts","sourceRoot":"","sources":["../../../src/components/events/trace-stream-event.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AAG5D,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,KAAK,EAAE,WAAW,CAAA;CAAE,CAU7D,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { TraceGroup } from '../../types/observability';
2
+ export declare const useGetEndTime: (group: TraceGroup | undefined | null) => number;
3
+ //# sourceMappingURL=use-get-endtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-get-endtime.d.ts","sourceRoot":"","sources":["../../../src/components/hooks/use-get-endtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAEvD,eAAO,MAAM,aAAa,GAAI,OAAO,UAAU,GAAG,SAAS,GAAG,IAAI,WAcjE,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const ObservabilityPage: () => import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=observability-page.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"observability-page.d.ts","sourceRoot":"","sources":["../../src/components/observability-page.tsx"],"names":[],"mappings":"AASA,eAAO,MAAM,iBAAiB,+CAyE7B,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const ObservabilityTabLabel: import('react').MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
2
+ //# sourceMappingURL=observability-tab-label.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"observability-tab-label.d.ts","sourceRoot":"","sources":["../../src/components/observability-tab-label.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,qBAAqB,oFAKhC,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { default as React } from 'react';
2
+ import { Trace } from '../../types/observability';
3
+ type Props = {
4
+ trace: Trace;
5
+ onClose: () => void;
6
+ };
7
+ export declare const TraceItemDetail: React.FC<Props>;
8
+ export {};
9
+ //# sourceMappingURL=trace-item-detail.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trace-item-detail.d.ts","sourceRoot":"","sources":["../../../src/components/trace-item/trace-item-detail.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAA;AAItD,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,KAAK,CAAA;IACZ,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAwC1C,CAAA"}
@@ -0,0 +1,11 @@
1
+ import { default as React } from 'react';
2
+ import { Trace, TraceGroup } from '../../types/observability';
3
+ type Props = {
4
+ trace: Trace;
5
+ group: TraceGroup;
6
+ groupEndTime: number;
7
+ onExpand: (traceId: string) => void;
8
+ };
9
+ export declare const TraceItem: React.FC<Props>;
10
+ export {};
11
+ //# sourceMappingURL=trace-item.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trace-item.d.ts","sourceRoot":"","sources":["../../../src/components/trace-item/trace-item.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AAElE,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,KAAK,CAAA;IACZ,KAAK,EAAE,UAAU,CAAA;IACjB,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CACpC,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAgCrC,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { default as React } from 'react';
2
+ import { TraceGroup } from '../types/observability';
3
+ type Props = {
4
+ status: TraceGroup['status'];
5
+ duration?: string;
6
+ };
7
+ export declare const TraceStatusBadge: React.FC<Props>;
8
+ export {};
9
+ //# sourceMappingURL=trace-status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trace-status.d.ts","sourceRoot":"","sources":["../../src/components/trace-status.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AAEvD,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAA;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAe5C,CAAA"}
@@ -0,0 +1,7 @@
1
+ import { default as React } from 'react';
2
+ type Props = {
3
+ groupId: string;
4
+ };
5
+ export declare const TraceTimeline: React.FC<Props>;
6
+ export {};
7
+ //# sourceMappingURL=trace-timeline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trace-timeline.d.ts","sourceRoot":"","sources":["../../src/components/trace-timeline.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAS9B,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CA4DxC,CAAA"}
@@ -0,0 +1,10 @@
1
+ import { default as React } from 'react';
2
+ import { TraceGroup } from '../types/observability';
3
+ interface Props {
4
+ groups: TraceGroup[];
5
+ selectedGroupId?: string;
6
+ onGroupSelect: (group: TraceGroup) => void;
7
+ }
8
+ export declare const TracesGroups: React.FC<Props>;
9
+ export {};
10
+ //# sourceMappingURL=traces-groups.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traces-groups.d.ts","sourceRoot":"","sources":["../../src/components/traces-groups.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAGxD,UAAU,KAAK;IACb,MAAM,EAAE,UAAU,EAAE,CAAA;IACpB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,aAAa,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;CAC3C;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CA2CvC,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { TraceGroup } from '../types/observability';
2
+ export declare const useGetEndTime: (group: TraceGroup | undefined | null) => number;
3
+ //# sourceMappingURL=use-get-endtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-get-endtime.d.ts","sourceRoot":"","sources":["../../src/hooks/use-get-endtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAExD,eAAO,MAAM,aAAa,GAAI,OAAO,UAAU,GAAG,SAAS,GAAG,IAAI,WAcjE,CAAA"}
package/dist/index.cjs ADDED
@@ -0,0 +1,22 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react"),F=require("@motiadev/stream-client-react"),b=require("@motiadev/ui"),j=require("lucide-react"),de=require("zustand"),ue=require("date-fns");var y={exports:{}},E={};/**
2
+ * @license React
3
+ * react-jsx-runtime.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */var U;function me(){if(U)return E;U=1;var t=Symbol.for("react.transitional.element"),s=Symbol.for("react.fragment");function l(a,o,u){var p=null;if(u!==void 0&&(p=""+u),o.key!==void 0&&(p=""+o.key),"key"in o){u={};for(var d in o)d!=="key"&&(u[d]=o[d])}else u=o;return o=u.ref,{$$typeof:t,type:a,key:p,ref:o!==void 0?o:null,props:u}}return E.Fragment=s,E.jsx=l,E.jsxs=l,E}var w={};/**
10
+ * @license React
11
+ * react-jsx-runtime.development.js
12
+ *
13
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
14
+ *
15
+ * This source code is licensed under the MIT license found in the
16
+ * LICENSE file in the root directory of this source tree.
17
+ */var J;function fe(){return J||(J=1,process.env.NODE_ENV!=="production"&&function(){function t(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===le?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case S:return"Fragment";case K:return"Profiler";case Q:return"StrictMode";case se:return"Suspense";case ae:return"SuspenseList";case oe:return"Activity"}if(typeof r=="object")switch(typeof r.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),r.$$typeof){case H:return"Portal";case te:return(r.displayName||"Context")+".Provider";case ee:return(r._context.displayName||"Context")+".Consumer";case re:var n=r.render;return r=r.displayName,r||(r=n.displayName||n.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case ne:return n=r.displayName||null,n!==null?n:t(r.type)||"Memo";case G:n=r._payload,r=r._init;try{return t(r(n))}catch{}}return null}function s(r){return""+r}function l(r){try{s(r);var n=!1}catch{n=!0}if(n){n=console;var c=n.error,m=typeof Symbol=="function"&&Symbol.toStringTag&&r[Symbol.toStringTag]||r.constructor.name||"Object";return c.call(n,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",m),s(r)}}function a(r){if(r===S)return"<>";if(typeof r=="object"&&r!==null&&r.$$typeof===G)return"<...>";try{var n=t(r);return n?"<"+n+">":"<...>"}catch{return"<...>"}}function o(){var r=O.A;return r===null?null:r.getOwner()}function u(){return Error("react-stack-top-frame")}function p(r){if(L.call(r,"key")){var n=Object.getOwnPropertyDescriptor(r,"key").get;if(n&&n.isReactWarning)return!1}return r.key!==void 0}function d(r,n){function c(){Y||(Y=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",n))}c.isReactWarning=!0,Object.defineProperty(r,"key",{get:c,configurable:!0})}function i(){var r=t(this.type);return q[r]||(q[r]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),r=this.props.ref,r!==void 0?r:null}function k(r,n,c,m,g,v,P,C){return c=v.ref,r={$$typeof:M,type:r,key:n,props:v,_owner:g},(c!==void 0?c:null)!==null?Object.defineProperty(r,"ref",{enumerable:!1,get:i}):Object.defineProperty(r,"ref",{enumerable:!1,value:null}),r._store={},Object.defineProperty(r._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(r,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(r,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:P}),Object.defineProperty(r,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:C}),Object.freeze&&(Object.freeze(r.props),Object.freeze(r)),r}function h(r,n,c,m,g,v,P,C){var f=n.children;if(f!==void 0)if(m)if(ie(f)){for(m=0;m<f.length;m++)$(f[m]);Object.freeze&&Object.freeze(f)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else $(f);if(L.call(n,"key")){f=t(r);var N=Object.keys(n).filter(function(ce){return ce!=="key"});m=0<N.length?"{key: someKey, "+N.join(": ..., ")+": ...}":"{key: someKey}",W[f+m]||(N=0<N.length?"{"+N.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
18
+ let props = %s;
19
+ <%s {...props} />
20
+ React keys must be passed directly to JSX without using spread:
21
+ let props = %s;
22
+ <%s key={someKey} {...props} />`,m,f,N,f),W[f+m]=!0)}if(f=null,c!==void 0&&(l(c),f=""+c),p(n)&&(l(n.key),f=""+n.key),"key"in n){c={};for(var I in n)I!=="key"&&(c[I]=n[I])}else c=n;return f&&d(c,typeof r=="function"?r.displayName||r.name||"Unknown":r),k(r,f,v,g,o(),c,P,C)}function $(r){typeof r=="object"&&r!==null&&r.$$typeof===M&&r._store&&(r._store.validated=1)}var _=x,M=Symbol.for("react.transitional.element"),H=Symbol.for("react.portal"),S=Symbol.for("react.fragment"),Q=Symbol.for("react.strict_mode"),K=Symbol.for("react.profiler"),ee=Symbol.for("react.consumer"),te=Symbol.for("react.context"),re=Symbol.for("react.forward_ref"),se=Symbol.for("react.suspense"),ae=Symbol.for("react.suspense_list"),ne=Symbol.for("react.memo"),G=Symbol.for("react.lazy"),oe=Symbol.for("react.activity"),le=Symbol.for("react.client.reference"),O=_.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=Object.prototype.hasOwnProperty,ie=Array.isArray,A=console.createTask?console.createTask:function(){return null};_={react_stack_bottom_frame:function(r){return r()}};var Y,q={},z=_.react_stack_bottom_frame.bind(_,u)(),B=A(a(u)),W={};w.Fragment=S,w.jsx=function(r,n,c,m,g){var v=1e4>O.recentlyCreatedOwnerStacks++;return h(r,n,c,!1,m,g,v?Error("react-stack-top-frame"):z,v?A(a(r)):B)},w.jsxs=function(r,n,c,m,g){var v=1e4>O.recentlyCreatedOwnerStacks++;return h(r,n,c,!0,m,g,v?Error("react-stack-top-frame"):z,v?A(a(r)):B)}}()),w}var V;function xe(){return V||(V=1,process.env.NODE_ENV==="production"?y.exports=me():y.exports=fe()),y.exports}var e=xe();const R=de.create()(t=>({selectedTraceGroupId:void 0,selectedTraceId:void 0,selectTraceGroupId:s=>t({selectedTraceGroupId:s}),selectTraceId:s=>t({selectedTraceId:s})})),pe=t=>{const s=t?.endTime,[l,a]=x.useState(s||Date.now());return x.useEffect(()=>{if(s)a(s);else{const o=setInterval(()=>a(Date.now()),50);return()=>clearInterval(o)}},[s]),l},T=t=>t==null?"N/A":t<1e3?`${t}ms`:t<6e4?`${(t/1e3).toFixed(1)}s`:t<36e5?`${(t/6e4).toFixed(1)}min`:`${(t/36e5).toFixed(1)}h`,he=({trace:t,group:s,groupEndTime:l,onExpand:a})=>e.jsxs("div",{className:"flex hover:bg-muted-foreground/10 relative cursor-pointer",onClick:()=>a(t.id),"data-testid":"trace-timeline-item",children:[e.jsx("div",{className:"flex items-center min-w-[200px] max-w-[200px] h-[32px] max-h-[32px] py-4 px-2 text-sm font-semibold text-foreground truncate sticky left-0 bg-card z-9",children:t.name}),e.jsx("div",{className:"flex w-full flex-row items-center hover:bg-muted/50 rounded-md",children:e.jsx("div",{className:"relative w-full h-[32px] flex items-center",children:e.jsx("div",{className:b.cn("h-[24px] rounded-[4px] hover:opacity-80 transition-all duration-200",{"bg-[repeating-linear-gradient(140deg,#BEFE29,#BEFE29_8px,#ABE625_8px,#ABE625_16px)]":t.status==="running","bg-[repeating-linear-gradient(140deg,#2862FE,#2862FE_8px,#2358E5_8px,#2358E5_16px)]":t.status==="completed","bg-[repeating-linear-gradient(140deg,#EA2069,#EA2069_8px,#D41E60_8px,#D41E60_16px)]":t.status==="failed"}),style:{marginLeft:`${(t.startTime-s.startTime)/(l-s.startTime)*100}%`,width:t.endTime?`${(t.endTime-t.startTime)/(l-s.startTime)*100}%`:`${(Date.now()-t.startTime)/(l-s.startTime)*100}%`}})})})]}),je=({event:t})=>{if(t.type==="log")return e.jsx(j.ScrollText,{className:"w-4 h-4 text-muted-foreground"});if(t.type==="emit")return e.jsx(j.MessageCircle,{className:"w-4 h-4 text-muted-foreground"});if(t.type==="state")return e.jsx(j.Package,{className:"w-4 h-4 text-muted-foreground"});if(t.type==="stream")return e.jsx(j.Radio,{className:"w-4 h-4 text-muted-foreground"})},X=({arg:t})=>{if(typeof t=="string")return e.jsxs("span",{className:"font-mono text-blue-500",children:["'",t,"'"]});if(t===!1)return e.jsx("span",{className:"font-mono text-blue-100 font-bold bg-blue-500/50 px-2 rounded-md",children:"value"});const s=Object.entries(t);return e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-mono text-green-500",children:"{ "}),s.map(([l,a],o)=>e.jsxs("span",{children:[e.jsx("span",{className:"font-mono text-green-500",children:l}),e.jsx("span",{className:"font-mono text-muted-foreground",children:":"})," ",e.jsx(X,{arg:a}),o<s.length-1&&e.jsx(e.Fragment,{children:", "})]},l)),e.jsx("span",{className:"font-mono text-green-500",children:" }"})]})},D=({topLevelClassName:t,objectName:s,functionName:l,args:a,callsQuantity:o})=>{const u=o&&o>1,p=a.filter(d=>d!==void 0);return e.jsxs("div",{children:[t&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-mono text-pink-500",children:t}),"."]}),s&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"font-mono text-pink-500",children:s}),"."]}),e.jsx("span",{className:"font-mono text-pink-500",children:l}),e.jsx("span",{className:"font-mono text-emerald-500",children:"("}),p.map((d,i)=>e.jsxs("span",{children:[e.jsx(X,{arg:d}),i<p.length-1&&e.jsx(e.Fragment,{children:", "})]},i)),e.jsx("span",{className:"font-mono text-emerald-500",children:")"}),u&&e.jsxs("span",{className:"font-mono text-muted-foreground",children:[" x",o]})]})},be=({event:t})=>e.jsx(D,{functionName:"emit",args:[{topic:t.topic,data:!1}]}),ve=({event:t})=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(b.LevelDot,{level:t.level})," ",t.message]}),ge=({event:t})=>e.jsx(D,{objectName:"state",functionName:t.operation,args:[t.data.traceId,t.data.key,t.data.value?!1:void 0]}),Te=({event:t})=>e.jsx(D,{topLevelClassName:"streams",objectName:t.streamName,functionName:t.operation,args:[t.data.groupId,t.data.id,t.data.data?!1:void 0],callsQuantity:t.calls}),Ne=x.memo(({event:t})=>{if(t.type==="log")return e.jsx(ve,{event:t});if(t.type==="emit")return e.jsx(be,{event:t});if(t.type==="state")return e.jsx(ge,{event:t});if(t.type==="stream")return e.jsx(Te,{event:t})}),Ee=x.memo(({trace:t,onClose:s})=>e.jsxs(b.Sidebar,{onClose:s,title:"Trace Details",subtitle:`Viewing details from step ${t.name}`,actions:[{icon:e.jsx(j.X,{}),onClick:s,label:"Close"}],children:[e.jsxs("div",{className:"px-2 w-[800px] overflow-auto",children:[e.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground mb-4",children:[t.endTime&&e.jsxs("span",{children:["Duration: ",T(t.endTime-t.startTime)]}),e.jsx("div",{className:"bg-blue-500 font-bold text-xs px-[4px] py-[2px] rounded-sm text-blue-100",children:t.entryPoint.type}),t.correlationId&&e.jsxs(b.Badge,{variant:"outline",children:["Correlated: ",t.correlationId]})]}),e.jsx("div",{className:"pl-6 border-l-1 border-gray-500/40 font-mono text-xs flex flex-col gap-3",children:t.events.map((l,a)=>e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"absolute -left-[26px] top-[8px] w-1 h-1 rounded-full bg-emerald-500 outline outline-2 outline-emerald-500/50"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(je,{event:l}),e.jsxs("span",{className:"text-sm font-mono text-muted-foreground",children:["+",T(Math.floor(l.timestamp-t.startTime))]}),e.jsx(Ne,{event:l})]})]},a))})]}),t.error&&e.jsxs("div",{className:"p-4 bg-red-800/10",children:[e.jsx("div",{className:"text-sm text-red-800 dark:text-red-400 font-semibold",children:t.error.message}),e.jsx("div",{className:"text-sm text-red-800 dark:text-red-400 pl-4",children:t.error.stack})]})]})),we=x.memo(({groupId:t})=>{const{data:s}=F.useStreamItem({streamName:"motia-trace-group",groupId:"default",id:t}),{data:l}=F.useStreamGroup({streamName:"motia-trace",groupId:t}),a=pe(s),[o,u]=x.useState(1),p=R(h=>h.selectedTraceId),d=R(h=>h.selectTraceId),i=x.useMemo(()=>l?.find(h=>h.id===p),[l,p]),k=()=>{o>.5&&u(o-.1)};return s?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex flex-col flex-1 overflow-x-auto h-full relative",children:e.jsxs("div",{className:"flex flex-col items-center min-w-full sticky top-0",style:{width:`${o*1e3}px`},children:[e.jsxs("div",{className:"flex flex-1 w-full sticky top-0 bg-background z-10",children:[e.jsxs("div",{className:"w-full min-h-[37px] h-[37px] min-w-[200px] max-w-[200px] flex items-center justify-center gap-2 sticky left-0 top-0 bg-card backdrop-blur-[4px] backdrop-filter",children:[e.jsx(b.Button,{variant:"icon",size:"sm",className:"px-2",onClick:k,children:e.jsx(j.Minus,{className:"w-4 h-4 cursor-pointer"})}),e.jsxs("span",{className:"text-sm font-bold text-muted-foreground",children:[Math.floor(o*100),"%"]}),e.jsx(b.Button,{variant:"icon",size:"sm",className:"px-2",onClick:()=>u(o+.1),children:e.jsx(j.Plus,{className:"w-4 h-4 cursor-pointer"})})]}),e.jsxs("div",{className:"flex justify-between font-mono p-2 w-full text-xs text-muted-foreground bg-card",children:[e.jsx("span",{children:T(0)}),e.jsx("span",{children:T(Math.floor((a-s.startTime)*.25))}),e.jsx("span",{children:T(Math.floor((a-s.startTime)*.5))}),e.jsx("span",{children:T(Math.floor((a-s.startTime)*.75))}),e.jsx("span",{children:T(Math.floor(a-s.startTime))}),e.jsxs("div",{className:"absolute bottom-[-4px] w-full flex justify-between",children:[e.jsx("span",{className:"w-[1px] h-full bg-blue-500"}),e.jsx("span",{className:"w-[1px] h-full bg-blue-500"}),e.jsx("span",{className:"w-[1px] h-full bg-blue-500"}),e.jsx("span",{className:"w-[1px] h-full bg-blue-500"}),e.jsx("span",{className:"w-[1px] h-full bg-blue-500"})]})]})]}),e.jsx("div",{className:"flex flex-col w-full h-full",children:l?.map(h=>e.jsx(he,{trace:h,group:s,groupEndTime:a,onExpand:d},h.id))})]})}),i&&e.jsx(Ee,{trace:i,onClose:()=>d(void 0)})]}):null}),_e=({status:t,duration:s})=>{const l=x.useMemo(()=>t==="running"?"info":t==="completed"?"success":t==="failed"?"error":"default",[t]);return e.jsx(b.Badge,{variant:l,children:s&&t!=="failed"?s:t})},ye=x.memo(({groups:t,selectedGroupId:s,onGroupSelect:l})=>e.jsx("div",{className:"overflow-auto",children:t.length>0&&e.jsx("div",{children:[...t].reverse().map(a=>e.jsx("div",{"data-testid":`trace-${a.id}`,className:b.cn("motia-trace-group cursor-pointer transition-colors",s===a.id?"bg-muted-foreground/10":"hover:bg-muted/70"),onClick:()=>l(a),children:e.jsxs("div",{className:"p-3 flex flex-col gap-1",children:[e.jsxs("div",{className:"flex flex-row justify-between items-center gap-2",children:[e.jsx("span",{className:"font-semibold text-lg",children:a.name}),e.jsx(_e,{status:a.status,duration:a.endTime?T(a.endTime-a.startTime):void 0})]}),e.jsxs("div",{className:"text-xs text-muted-foreground space-y-1",children:[e.jsxs("div",{className:"flex justify-between",children:[e.jsx("div",{"data-testid":"trace-id",className:"text-xs text-muted-foreground font-mono tracking-[1px]",children:a.id}),e.jsxs("span",{children:[a.metadata.totalSteps," steps"]})]}),e.jsxs("div",{className:"flex justify-between",children:[ue.formatDistanceToNow(a.startTime)," ago"]}),a.metadata.activeSteps>0&&e.jsxs("div",{className:"text-blue-600",children:[a.metadata.activeSteps," active"]})]})]})},a.id))})})),Re=()=>{const t=R(i=>i.selectedTraceGroupId),s=R(i=>i.selectTraceGroupId),{data:l}=F.useStreamGroup({streamName:"motia-trace-group",groupId:"default"}),a=i=>s(i.id),[o,u]=x.useState(""),p=()=>fetch("/__motia/trace/clear",{method:"POST"}),d=x.useMemo(()=>l?.filter(i=>i.name.toLowerCase().includes(o.toLowerCase())||i.id.toLowerCase().includes(o.toLowerCase())),[l,o]);return x.useEffect(()=>{if(d&&d.length>0){const i=d[d.length-1];i&&i.status==="running"&&i.id!==t&&s(i.id)}else t&&s(void 0)},[d]),e.jsxs("div",{className:"grid grid-rows-[auto_1fr] h-full",children:[e.jsxs("div",{className:"flex p-2 border-b gap-2","data-testid":"logs-search-container",children:[e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(b.Input,{variant:"shade",value:o,onChange:i=>u(i.target.value),className:"px-9 font-medium",placeholder:"Search by Trace ID or Step Name"}),e.jsx(j.Search,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/50"}),e.jsx(j.X,{className:b.cn("cursor-pointer absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/50 hover:text-muted-foreground",{visible:o!=="",invisible:o===""}),onClick:()=>u("")})]}),e.jsxs(b.Button,{variant:"default",onClick:p,className:"h-[34px]",children:[e.jsx(j.Trash,{})," Clear"]})]}),e.jsxs("div",{className:"grid grid-cols-[300px_1fr] overflow-hidden",children:[e.jsx("div",{className:"w-[300px] border-r border-border overflow-auto h-full","data-testid":"traces-container",children:e.jsx(ye,{groups:d,selectedGroupId:t,onGroupSelect:a})}),e.jsxs("div",{className:"overflow-auto","data-testid":"trace-details",children:[t&&e.jsx(we,{groupId:t}),!t&&e.jsx("div",{className:"flex items-center justify-center h-full text-muted-foreground",children:"Select a trace or trace group to view the timeline"})]})]})]})},Z=x.memo(()=>e.jsxs(e.Fragment,{children:[e.jsx(j.GanttChart,{"aria-hidden":"true"}),e.jsx("span",{children:"Tracing"})]}));Z.displayName="ObservabilityTabLabel";exports.ObservabilityPage=Re;exports.ObservabilityTabLabel=Z;
@@ -0,0 +1,4 @@
1
+ export { ObservabilityPage } from './components/observability-page';
2
+ export { ObservabilityTabLabel } from './components/observability-tab-label';
3
+ export type { EmitEvent, LogEntry, ObservabilityStats, StateEvent, StreamEvent, Trace, TraceError, TraceEvent, TraceGroup, } from './types/observability';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,CAAA;AAErB,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AACnE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAA;AAC5E,YAAY,EACV,SAAS,EACT,QAAQ,EACR,kBAAkB,EAClB,UAAU,EACV,WAAW,EACX,KAAK,EACL,UAAU,EACV,UAAU,EACV,UAAU,GACX,MAAM,uBAAuB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,588 @@
1
+ import xe, { useState as C, useEffect as Z, memo as N, useMemo as F } from "react";
2
+ import { useStreamItem as pe, useStreamGroup as H } from "@motiadev/stream-client-react";
3
+ import { cn as D, LevelDot as he, Sidebar as je, Badge as Q, Button as P, Input as be } from "@motiadev/ui";
4
+ import { ScrollText as ve, MessageCircle as ge, Package as Te, Radio as Ne, X as K, Minus as Ee, Plus as we, Search as _e, Trash as ke, GanttChart as Re } from "lucide-react";
5
+ import { create as ye } from "zustand";
6
+ import { formatDistanceToNow as Se } from "date-fns";
7
+ var w = { exports: {} }, g = {};
8
+ /**
9
+ * @license React
10
+ * react-jsx-runtime.production.js
11
+ *
12
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
13
+ *
14
+ * This source code is licensed under the MIT license found in the
15
+ * LICENSE file in the root directory of this source tree.
16
+ */
17
+ var J;
18
+ function Oe() {
19
+ if (J) return g;
20
+ J = 1;
21
+ var r = Symbol.for("react.transitional.element"), s = Symbol.for("react.fragment");
22
+ function l(a, o, u) {
23
+ var x = null;
24
+ if (u !== void 0 && (x = "" + u), o.key !== void 0 && (x = "" + o.key), "key" in o) {
25
+ u = {};
26
+ for (var d in o)
27
+ d !== "key" && (u[d] = o[d]);
28
+ } else u = o;
29
+ return o = u.ref, {
30
+ $$typeof: r,
31
+ type: a,
32
+ key: x,
33
+ ref: o !== void 0 ? o : null,
34
+ props: u
35
+ };
36
+ }
37
+ return g.Fragment = s, g.jsx = l, g.jsxs = l, g;
38
+ }
39
+ var T = {};
40
+ /**
41
+ * @license React
42
+ * react-jsx-runtime.development.js
43
+ *
44
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
45
+ *
46
+ * This source code is licensed under the MIT license found in the
47
+ * LICENSE file in the root directory of this source tree.
48
+ */
49
+ var V;
50
+ function Ae() {
51
+ return V || (V = 1, process.env.NODE_ENV !== "production" && function() {
52
+ function r(t) {
53
+ if (t == null) return null;
54
+ if (typeof t == "function")
55
+ return t.$$typeof === ue ? null : t.displayName || t.name || null;
56
+ if (typeof t == "string") return t;
57
+ switch (t) {
58
+ case R:
59
+ return "Fragment";
60
+ case se:
61
+ return "Profiler";
62
+ case te:
63
+ return "StrictMode";
64
+ case le:
65
+ return "Suspense";
66
+ case ie:
67
+ return "SuspenseList";
68
+ case de:
69
+ return "Activity";
70
+ }
71
+ if (typeof t == "object")
72
+ switch (typeof t.tag == "number" && console.error(
73
+ "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
74
+ ), t.$$typeof) {
75
+ case re:
76
+ return "Portal";
77
+ case ne:
78
+ return (t.displayName || "Context") + ".Provider";
79
+ case ae:
80
+ return (t._context.displayName || "Context") + ".Consumer";
81
+ case oe:
82
+ var n = t.render;
83
+ return t = t.displayName, t || (t = n.displayName || n.name || "", t = t !== "" ? "ForwardRef(" + t + ")" : "ForwardRef"), t;
84
+ case ce:
85
+ return n = t.displayName || null, n !== null ? n : r(t.type) || "Memo";
86
+ case L:
87
+ n = t._payload, t = t._init;
88
+ try {
89
+ return r(t(n));
90
+ } catch {
91
+ }
92
+ }
93
+ return null;
94
+ }
95
+ function s(t) {
96
+ return "" + t;
97
+ }
98
+ function l(t) {
99
+ try {
100
+ s(t);
101
+ var n = !1;
102
+ } catch {
103
+ n = !0;
104
+ }
105
+ if (n) {
106
+ n = console;
107
+ var c = n.error, m = typeof Symbol == "function" && Symbol.toStringTag && t[Symbol.toStringTag] || t.constructor.name || "Object";
108
+ return c.call(
109
+ n,
110
+ "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
111
+ m
112
+ ), s(t);
113
+ }
114
+ }
115
+ function a(t) {
116
+ if (t === R) return "<>";
117
+ if (typeof t == "object" && t !== null && t.$$typeof === L)
118
+ return "<...>";
119
+ try {
120
+ var n = r(t);
121
+ return n ? "<" + n + ">" : "<...>";
122
+ } catch {
123
+ return "<...>";
124
+ }
125
+ }
126
+ function o() {
127
+ var t = y.A;
128
+ return t === null ? null : t.getOwner();
129
+ }
130
+ function u() {
131
+ return Error("react-stack-top-frame");
132
+ }
133
+ function x(t) {
134
+ if (Y.call(t, "key")) {
135
+ var n = Object.getOwnPropertyDescriptor(t, "key").get;
136
+ if (n && n.isReactWarning) return !1;
137
+ }
138
+ return t.key !== void 0;
139
+ }
140
+ function d(t, n) {
141
+ function c() {
142
+ z || (z = !0, console.error(
143
+ "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
144
+ n
145
+ ));
146
+ }
147
+ c.isReactWarning = !0, Object.defineProperty(t, "key", {
148
+ get: c,
149
+ configurable: !0
150
+ });
151
+ }
152
+ function i() {
153
+ var t = r(this.type);
154
+ return W[t] || (W[t] = !0, console.error(
155
+ "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
156
+ )), t = this.props.ref, t !== void 0 ? t : null;
157
+ }
158
+ function k(t, n, c, m, j, h, O, A) {
159
+ return c = h.ref, t = {
160
+ $$typeof: G,
161
+ type: t,
162
+ key: n,
163
+ props: h,
164
+ _owner: j
165
+ }, (c !== void 0 ? c : null) !== null ? Object.defineProperty(t, "ref", {
166
+ enumerable: !1,
167
+ get: i
168
+ }) : Object.defineProperty(t, "ref", { enumerable: !1, value: null }), t._store = {}, Object.defineProperty(t._store, "validated", {
169
+ configurable: !1,
170
+ enumerable: !1,
171
+ writable: !0,
172
+ value: 0
173
+ }), Object.defineProperty(t, "_debugInfo", {
174
+ configurable: !1,
175
+ enumerable: !1,
176
+ writable: !0,
177
+ value: null
178
+ }), Object.defineProperty(t, "_debugStack", {
179
+ configurable: !1,
180
+ enumerable: !1,
181
+ writable: !0,
182
+ value: O
183
+ }), Object.defineProperty(t, "_debugTask", {
184
+ configurable: !1,
185
+ enumerable: !1,
186
+ writable: !0,
187
+ value: A
188
+ }), Object.freeze && (Object.freeze(t.props), Object.freeze(t)), t;
189
+ }
190
+ function p(t, n, c, m, j, h, O, A) {
191
+ var f = n.children;
192
+ if (f !== void 0)
193
+ if (m)
194
+ if (me(f)) {
195
+ for (m = 0; m < f.length; m++)
196
+ M(f[m]);
197
+ Object.freeze && Object.freeze(f);
198
+ } else
199
+ console.error(
200
+ "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
201
+ );
202
+ else M(f);
203
+ if (Y.call(n, "key")) {
204
+ f = r(t);
205
+ var v = Object.keys(n).filter(function(fe) {
206
+ return fe !== "key";
207
+ });
208
+ m = 0 < v.length ? "{key: someKey, " + v.join(": ..., ") + ": ...}" : "{key: someKey}", q[f + m] || (v = 0 < v.length ? "{" + v.join(": ..., ") + ": ...}" : "{}", console.error(
209
+ `A props object containing a "key" prop is being spread into JSX:
210
+ let props = %s;
211
+ <%s {...props} />
212
+ React keys must be passed directly to JSX without using spread:
213
+ let props = %s;
214
+ <%s key={someKey} {...props} />`,
215
+ m,
216
+ f,
217
+ v,
218
+ f
219
+ ), q[f + m] = !0);
220
+ }
221
+ if (f = null, c !== void 0 && (l(c), f = "" + c), x(n) && (l(n.key), f = "" + n.key), "key" in n) {
222
+ c = {};
223
+ for (var I in n)
224
+ I !== "key" && (c[I] = n[I]);
225
+ } else c = n;
226
+ return f && d(
227
+ c,
228
+ typeof t == "function" ? t.displayName || t.name || "Unknown" : t
229
+ ), k(
230
+ t,
231
+ f,
232
+ h,
233
+ j,
234
+ o(),
235
+ c,
236
+ O,
237
+ A
238
+ );
239
+ }
240
+ function M(t) {
241
+ typeof t == "object" && t !== null && t.$$typeof === G && t._store && (t._store.validated = 1);
242
+ }
243
+ var E = xe, G = Symbol.for("react.transitional.element"), re = Symbol.for("react.portal"), R = Symbol.for("react.fragment"), te = Symbol.for("react.strict_mode"), se = Symbol.for("react.profiler"), ae = Symbol.for("react.consumer"), ne = Symbol.for("react.context"), oe = Symbol.for("react.forward_ref"), le = Symbol.for("react.suspense"), ie = Symbol.for("react.suspense_list"), ce = Symbol.for("react.memo"), L = Symbol.for("react.lazy"), de = Symbol.for("react.activity"), ue = Symbol.for("react.client.reference"), y = E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, Y = Object.prototype.hasOwnProperty, me = Array.isArray, S = console.createTask ? console.createTask : function() {
244
+ return null;
245
+ };
246
+ E = {
247
+ react_stack_bottom_frame: function(t) {
248
+ return t();
249
+ }
250
+ };
251
+ var z, W = {}, U = E.react_stack_bottom_frame.bind(
252
+ E,
253
+ u
254
+ )(), B = S(a(u)), q = {};
255
+ T.Fragment = R, T.jsx = function(t, n, c, m, j) {
256
+ var h = 1e4 > y.recentlyCreatedOwnerStacks++;
257
+ return p(
258
+ t,
259
+ n,
260
+ c,
261
+ !1,
262
+ m,
263
+ j,
264
+ h ? Error("react-stack-top-frame") : U,
265
+ h ? S(a(t)) : B
266
+ );
267
+ }, T.jsxs = function(t, n, c, m, j) {
268
+ var h = 1e4 > y.recentlyCreatedOwnerStacks++;
269
+ return p(
270
+ t,
271
+ n,
272
+ c,
273
+ !0,
274
+ m,
275
+ j,
276
+ h ? Error("react-stack-top-frame") : U,
277
+ h ? S(a(t)) : B
278
+ );
279
+ };
280
+ }()), T;
281
+ }
282
+ var X;
283
+ function Ie() {
284
+ return X || (X = 1, process.env.NODE_ENV === "production" ? w.exports = Oe() : w.exports = Ae()), w.exports;
285
+ }
286
+ var e = Ie();
287
+ const _ = ye()((r) => ({
288
+ selectedTraceGroupId: void 0,
289
+ selectedTraceId: void 0,
290
+ selectTraceGroupId: (s) => r({ selectedTraceGroupId: s }),
291
+ selectTraceId: (s) => r({ selectedTraceId: s })
292
+ })), Pe = (r) => {
293
+ const s = r?.endTime, [l, a] = C(s || Date.now());
294
+ return Z(() => {
295
+ if (s)
296
+ a(s);
297
+ else {
298
+ const o = setInterval(() => a(Date.now()), 50);
299
+ return () => clearInterval(o);
300
+ }
301
+ }, [s]), l;
302
+ }, b = (r) => r == null ? "N/A" : r < 1e3 ? `${r}ms` : r < 6e4 ? `${(r / 1e3).toFixed(1)}s` : r < 36e5 ? `${(r / 6e4).toFixed(1)}min` : `${(r / 36e5).toFixed(1)}h`, Ce = ({ trace: r, group: s, groupEndTime: l, onExpand: a }) => /* @__PURE__ */ e.jsxs(
303
+ "div",
304
+ {
305
+ className: "flex hover:bg-muted-foreground/10 relative cursor-pointer",
306
+ onClick: () => a(r.id),
307
+ "data-testid": "trace-timeline-item",
308
+ children: [
309
+ /* @__PURE__ */ e.jsx("div", { className: "flex items-center min-w-[200px] max-w-[200px] h-[32px] max-h-[32px] py-4 px-2 text-sm font-semibold text-foreground truncate sticky left-0 bg-card z-9", children: r.name }),
310
+ /* @__PURE__ */ e.jsx("div", { className: "flex w-full flex-row items-center hover:bg-muted/50 rounded-md", children: /* @__PURE__ */ e.jsx("div", { className: "relative w-full h-[32px] flex items-center", children: /* @__PURE__ */ e.jsx(
311
+ "div",
312
+ {
313
+ className: D("h-[24px] rounded-[4px] hover:opacity-80 transition-all duration-200", {
314
+ "bg-[repeating-linear-gradient(140deg,#BEFE29,#BEFE29_8px,#ABE625_8px,#ABE625_16px)]": r.status === "running",
315
+ "bg-[repeating-linear-gradient(140deg,#2862FE,#2862FE_8px,#2358E5_8px,#2358E5_16px)]": r.status === "completed",
316
+ "bg-[repeating-linear-gradient(140deg,#EA2069,#EA2069_8px,#D41E60_8px,#D41E60_16px)]": r.status === "failed"
317
+ }),
318
+ style: {
319
+ marginLeft: `${(r.startTime - s.startTime) / (l - s.startTime) * 100}%`,
320
+ width: r.endTime ? `${(r.endTime - r.startTime) / (l - s.startTime) * 100}%` : `${(Date.now() - r.startTime) / (l - s.startTime) * 100}%`
321
+ }
322
+ }
323
+ ) }) })
324
+ ]
325
+ }
326
+ ), Fe = ({ event: r }) => {
327
+ if (r.type === "log")
328
+ return /* @__PURE__ */ e.jsx(ve, { className: "w-4 h-4 text-muted-foreground" });
329
+ if (r.type === "emit")
330
+ return /* @__PURE__ */ e.jsx(ge, { className: "w-4 h-4 text-muted-foreground" });
331
+ if (r.type === "state")
332
+ return /* @__PURE__ */ e.jsx(Te, { className: "w-4 h-4 text-muted-foreground" });
333
+ if (r.type === "stream")
334
+ return /* @__PURE__ */ e.jsx(Ne, { className: "w-4 h-4 text-muted-foreground" });
335
+ }, ee = ({ arg: r }) => {
336
+ if (typeof r == "string")
337
+ return /* @__PURE__ */ e.jsxs("span", { className: "font-mono text-blue-500", children: [
338
+ "'",
339
+ r,
340
+ "'"
341
+ ] });
342
+ if (r === !1)
343
+ return /* @__PURE__ */ e.jsx("span", { className: "font-mono text-blue-100 font-bold bg-blue-500/50 px-2 rounded-md", children: "value" });
344
+ const s = Object.entries(r);
345
+ return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
346
+ /* @__PURE__ */ e.jsx("span", { className: "font-mono text-green-500", children: "{ " }),
347
+ s.map(([l, a], o) => /* @__PURE__ */ e.jsxs("span", { children: [
348
+ /* @__PURE__ */ e.jsx("span", { className: "font-mono text-green-500", children: l }),
349
+ /* @__PURE__ */ e.jsx("span", { className: "font-mono text-muted-foreground", children: ":" }),
350
+ " ",
351
+ /* @__PURE__ */ e.jsx(ee, { arg: a }),
352
+ o < s.length - 1 && /* @__PURE__ */ e.jsx(e.Fragment, { children: ", " })
353
+ ] }, l)),
354
+ /* @__PURE__ */ e.jsx("span", { className: "font-mono text-green-500", children: " }" })
355
+ ] });
356
+ }, $ = ({ topLevelClassName: r, objectName: s, functionName: l, args: a, callsQuantity: o }) => {
357
+ const u = o && o > 1, x = a.filter((d) => d !== void 0);
358
+ return /* @__PURE__ */ e.jsxs("div", { children: [
359
+ r && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
360
+ /* @__PURE__ */ e.jsx("span", { className: "font-mono text-pink-500", children: r }),
361
+ "."
362
+ ] }),
363
+ s && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
364
+ /* @__PURE__ */ e.jsx("span", { className: "font-mono text-pink-500", children: s }),
365
+ "."
366
+ ] }),
367
+ /* @__PURE__ */ e.jsx("span", { className: "font-mono text-pink-500", children: l }),
368
+ /* @__PURE__ */ e.jsx("span", { className: "font-mono text-emerald-500", children: "(" }),
369
+ x.map((d, i) => /* @__PURE__ */ e.jsxs("span", { children: [
370
+ /* @__PURE__ */ e.jsx(ee, { arg: d }),
371
+ i < x.length - 1 && /* @__PURE__ */ e.jsx(e.Fragment, { children: ", " })
372
+ ] }, i)),
373
+ /* @__PURE__ */ e.jsx("span", { className: "font-mono text-emerald-500", children: ")" }),
374
+ u && /* @__PURE__ */ e.jsxs("span", { className: "font-mono text-muted-foreground", children: [
375
+ " x",
376
+ o
377
+ ] })
378
+ ] });
379
+ }, De = ({ event: r }) => /* @__PURE__ */ e.jsx($, { functionName: "emit", args: [{ topic: r.topic, data: !1 }] }), $e = ({ event: r }) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
380
+ /* @__PURE__ */ e.jsx(he, { level: r.level }),
381
+ " ",
382
+ r.message
383
+ ] }), Me = ({ event: r }) => /* @__PURE__ */ e.jsx(
384
+ $,
385
+ {
386
+ objectName: "state",
387
+ functionName: r.operation,
388
+ args: [r.data.traceId, r.data.key, r.data.value ? !1 : void 0]
389
+ }
390
+ ), Ge = ({ event: r }) => /* @__PURE__ */ e.jsx(
391
+ $,
392
+ {
393
+ topLevelClassName: "streams",
394
+ objectName: r.streamName,
395
+ functionName: r.operation,
396
+ args: [r.data.groupId, r.data.id, r.data.data ? !1 : void 0],
397
+ callsQuantity: r.calls
398
+ }
399
+ ), Le = N(({ event: r }) => {
400
+ if (r.type === "log")
401
+ return /* @__PURE__ */ e.jsx($e, { event: r });
402
+ if (r.type === "emit")
403
+ return /* @__PURE__ */ e.jsx(De, { event: r });
404
+ if (r.type === "state")
405
+ return /* @__PURE__ */ e.jsx(Me, { event: r });
406
+ if (r.type === "stream")
407
+ return /* @__PURE__ */ e.jsx(Ge, { event: r });
408
+ }), Ye = N(({ trace: r, onClose: s }) => /* @__PURE__ */ e.jsxs(
409
+ je,
410
+ {
411
+ onClose: s,
412
+ title: "Trace Details",
413
+ subtitle: `Viewing details from step ${r.name}`,
414
+ actions: [{ icon: /* @__PURE__ */ e.jsx(K, {}), onClick: s, label: "Close" }],
415
+ children: [
416
+ /* @__PURE__ */ e.jsxs("div", { className: "px-2 w-[800px] overflow-auto", children: [
417
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-4 text-sm text-muted-foreground mb-4", children: [
418
+ r.endTime && /* @__PURE__ */ e.jsxs("span", { children: [
419
+ "Duration: ",
420
+ b(r.endTime - r.startTime)
421
+ ] }),
422
+ /* @__PURE__ */ e.jsx("div", { className: "bg-blue-500 font-bold text-xs px-[4px] py-[2px] rounded-sm text-blue-100", children: r.entryPoint.type }),
423
+ r.correlationId && /* @__PURE__ */ e.jsxs(Q, { variant: "outline", children: [
424
+ "Correlated: ",
425
+ r.correlationId
426
+ ] })
427
+ ] }),
428
+ /* @__PURE__ */ e.jsx("div", { className: "pl-6 border-l-1 border-gray-500/40 font-mono text-xs flex flex-col gap-3", children: r.events.map((l, a) => /* @__PURE__ */ e.jsxs("div", { className: "relative", children: [
429
+ /* @__PURE__ */ e.jsx("div", { className: "absolute -left-[26px] top-[8px] w-1 h-1 rounded-full bg-emerald-500 outline outline-2 outline-emerald-500/50" }),
430
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
431
+ /* @__PURE__ */ e.jsx(Fe, { event: l }),
432
+ /* @__PURE__ */ e.jsxs("span", { className: "text-sm font-mono text-muted-foreground", children: [
433
+ "+",
434
+ b(Math.floor(l.timestamp - r.startTime))
435
+ ] }),
436
+ /* @__PURE__ */ e.jsx(Le, { event: l })
437
+ ] })
438
+ ] }, a)) })
439
+ ] }),
440
+ r.error && /* @__PURE__ */ e.jsxs("div", { className: "p-4 bg-red-800/10", children: [
441
+ /* @__PURE__ */ e.jsx("div", { className: "text-sm text-red-800 dark:text-red-400 font-semibold", children: r.error.message }),
442
+ /* @__PURE__ */ e.jsx("div", { className: "text-sm text-red-800 dark:text-red-400 pl-4", children: r.error.stack })
443
+ ] })
444
+ ]
445
+ }
446
+ )), ze = N(({ groupId: r }) => {
447
+ const { data: s } = pe({
448
+ streamName: "motia-trace-group",
449
+ groupId: "default",
450
+ id: r
451
+ }), { data: l } = H({ streamName: "motia-trace", groupId: r }), a = Pe(s), [o, u] = C(1), x = _((p) => p.selectedTraceId), d = _((p) => p.selectTraceId), i = F(() => l?.find((p) => p.id === x), [l, x]), k = () => {
452
+ o > 0.5 && u(o - 0.1);
453
+ };
454
+ return s ? /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
455
+ /* @__PURE__ */ e.jsx("div", { className: "flex flex-col flex-1 overflow-x-auto h-full relative", children: /* @__PURE__ */ e.jsxs("div", { className: "flex flex-col items-center min-w-full sticky top-0", style: { width: `${o * 1e3}px` }, children: [
456
+ /* @__PURE__ */ e.jsxs("div", { className: "flex flex-1 w-full sticky top-0 bg-background z-10", children: [
457
+ /* @__PURE__ */ e.jsxs("div", { className: "w-full min-h-[37px] h-[37px] min-w-[200px] max-w-[200px] flex items-center justify-center gap-2 sticky left-0 top-0 bg-card backdrop-blur-[4px] backdrop-filter", children: [
458
+ /* @__PURE__ */ e.jsx(P, { variant: "icon", size: "sm", className: "px-2", onClick: k, children: /* @__PURE__ */ e.jsx(Ee, { className: "w-4 h-4 cursor-pointer" }) }),
459
+ /* @__PURE__ */ e.jsxs("span", { className: "text-sm font-bold text-muted-foreground", children: [
460
+ Math.floor(o * 100),
461
+ "%"
462
+ ] }),
463
+ /* @__PURE__ */ e.jsx(P, { variant: "icon", size: "sm", className: "px-2", onClick: () => u(o + 0.1), children: /* @__PURE__ */ e.jsx(we, { className: "w-4 h-4 cursor-pointer" }) })
464
+ ] }),
465
+ /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between font-mono p-2 w-full text-xs text-muted-foreground bg-card", children: [
466
+ /* @__PURE__ */ e.jsx("span", { children: b(0) }),
467
+ /* @__PURE__ */ e.jsx("span", { children: b(Math.floor((a - s.startTime) * 0.25)) }),
468
+ /* @__PURE__ */ e.jsx("span", { children: b(Math.floor((a - s.startTime) * 0.5)) }),
469
+ /* @__PURE__ */ e.jsx("span", { children: b(Math.floor((a - s.startTime) * 0.75)) }),
470
+ /* @__PURE__ */ e.jsx("span", { children: b(Math.floor(a - s.startTime)) }),
471
+ /* @__PURE__ */ e.jsxs("div", { className: "absolute bottom-[-4px] w-full flex justify-between", children: [
472
+ /* @__PURE__ */ e.jsx("span", { className: "w-[1px] h-full bg-blue-500" }),
473
+ /* @__PURE__ */ e.jsx("span", { className: "w-[1px] h-full bg-blue-500" }),
474
+ /* @__PURE__ */ e.jsx("span", { className: "w-[1px] h-full bg-blue-500" }),
475
+ /* @__PURE__ */ e.jsx("span", { className: "w-[1px] h-full bg-blue-500" }),
476
+ /* @__PURE__ */ e.jsx("span", { className: "w-[1px] h-full bg-blue-500" })
477
+ ] })
478
+ ] })
479
+ ] }),
480
+ /* @__PURE__ */ e.jsx("div", { className: "flex flex-col w-full h-full", children: l?.map((p) => /* @__PURE__ */ e.jsx(Ce, { trace: p, group: s, groupEndTime: a, onExpand: d }, p.id)) })
481
+ ] }) }),
482
+ i && /* @__PURE__ */ e.jsx(Ye, { trace: i, onClose: () => d(void 0) })
483
+ ] }) : null;
484
+ }), We = ({ status: r, duration: s }) => {
485
+ const l = F(() => r === "running" ? "info" : r === "completed" ? "success" : r === "failed" ? "error" : "default", [r]);
486
+ return /* @__PURE__ */ e.jsx(Q, { variant: l, children: s && r !== "failed" ? s : r });
487
+ }, Ue = N(({ groups: r, selectedGroupId: s, onGroupSelect: l }) => /* @__PURE__ */ e.jsx("div", { className: "overflow-auto", children: r.length > 0 && /* @__PURE__ */ e.jsx("div", { children: [...r].reverse().map((a) => /* @__PURE__ */ e.jsx(
488
+ "div",
489
+ {
490
+ "data-testid": `trace-${a.id}`,
491
+ className: D(
492
+ "motia-trace-group cursor-pointer transition-colors",
493
+ s === a.id ? "bg-muted-foreground/10" : "hover:bg-muted/70"
494
+ ),
495
+ onClick: () => l(a),
496
+ children: /* @__PURE__ */ e.jsxs("div", { className: "p-3 flex flex-col gap-1", children: [
497
+ /* @__PURE__ */ e.jsxs("div", { className: "flex flex-row justify-between items-center gap-2", children: [
498
+ /* @__PURE__ */ e.jsx("span", { className: "font-semibold text-lg", children: a.name }),
499
+ /* @__PURE__ */ e.jsx(
500
+ We,
501
+ {
502
+ status: a.status,
503
+ duration: a.endTime ? b(a.endTime - a.startTime) : void 0
504
+ }
505
+ )
506
+ ] }),
507
+ /* @__PURE__ */ e.jsxs("div", { className: "text-xs text-muted-foreground space-y-1", children: [
508
+ /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between", children: [
509
+ /* @__PURE__ */ e.jsx("div", { "data-testid": "trace-id", className: "text-xs text-muted-foreground font-mono tracking-[1px]", children: a.id }),
510
+ /* @__PURE__ */ e.jsxs("span", { children: [
511
+ a.metadata.totalSteps,
512
+ " steps"
513
+ ] })
514
+ ] }),
515
+ /* @__PURE__ */ e.jsxs("div", { className: "flex justify-between", children: [
516
+ Se(a.startTime),
517
+ " ago"
518
+ ] }),
519
+ a.metadata.activeSteps > 0 && /* @__PURE__ */ e.jsxs("div", { className: "text-blue-600", children: [
520
+ a.metadata.activeSteps,
521
+ " active"
522
+ ] })
523
+ ] })
524
+ ] })
525
+ },
526
+ a.id
527
+ )) }) })), Qe = () => {
528
+ const r = _((i) => i.selectedTraceGroupId), s = _((i) => i.selectTraceGroupId), { data: l } = H({ streamName: "motia-trace-group", groupId: "default" }), a = (i) => s(i.id), [o, u] = C(""), x = () => fetch("/__motia/trace/clear", { method: "POST" }), d = F(
529
+ () => l?.filter(
530
+ (i) => i.name.toLowerCase().includes(o.toLowerCase()) || i.id.toLowerCase().includes(o.toLowerCase())
531
+ ),
532
+ [l, o]
533
+ );
534
+ return Z(() => {
535
+ if (d && d.length > 0) {
536
+ const i = d[d.length - 1];
537
+ i && i.status === "running" && i.id !== r && s(i.id);
538
+ } else r && s(void 0);
539
+ }, [d]), /* @__PURE__ */ e.jsxs("div", { className: "grid grid-rows-[auto_1fr] h-full", children: [
540
+ /* @__PURE__ */ e.jsxs("div", { className: "flex p-2 border-b gap-2", "data-testid": "logs-search-container", children: [
541
+ /* @__PURE__ */ e.jsxs("div", { className: "flex-1 relative", children: [
542
+ /* @__PURE__ */ e.jsx(
543
+ be,
544
+ {
545
+ variant: "shade",
546
+ value: o,
547
+ onChange: (i) => u(i.target.value),
548
+ className: "px-9 font-medium",
549
+ placeholder: "Search by Trace ID or Step Name"
550
+ }
551
+ ),
552
+ /* @__PURE__ */ e.jsx(_e, { className: "absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/50" }),
553
+ /* @__PURE__ */ e.jsx(
554
+ K,
555
+ {
556
+ className: D(
557
+ "cursor-pointer absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground/50 hover:text-muted-foreground",
558
+ {
559
+ visible: o !== "",
560
+ invisible: o === ""
561
+ }
562
+ ),
563
+ onClick: () => u("")
564
+ }
565
+ )
566
+ ] }),
567
+ /* @__PURE__ */ e.jsxs(P, { variant: "default", onClick: x, className: "h-[34px]", children: [
568
+ /* @__PURE__ */ e.jsx(ke, {}),
569
+ " Clear"
570
+ ] })
571
+ ] }),
572
+ /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-[300px_1fr] overflow-hidden", children: [
573
+ /* @__PURE__ */ e.jsx("div", { className: "w-[300px] border-r border-border overflow-auto h-full", "data-testid": "traces-container", children: /* @__PURE__ */ e.jsx(Ue, { groups: d, selectedGroupId: r, onGroupSelect: a }) }),
574
+ /* @__PURE__ */ e.jsxs("div", { className: "overflow-auto", "data-testid": "trace-details", children: [
575
+ r && /* @__PURE__ */ e.jsx(ze, { groupId: r }),
576
+ !r && /* @__PURE__ */ e.jsx("div", { className: "flex items-center justify-center h-full text-muted-foreground", children: "Select a trace or trace group to view the timeline" })
577
+ ] })
578
+ ] })
579
+ ] });
580
+ }, Be = N(() => /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
581
+ /* @__PURE__ */ e.jsx(Re, { "aria-hidden": "true" }),
582
+ /* @__PURE__ */ e.jsx("span", { children: "Tracing" })
583
+ ] }));
584
+ Be.displayName = "ObservabilityTabLabel";
585
+ export {
586
+ Qe as ObservabilityPage,
587
+ Be as ObservabilityTabLabel
588
+ };
@@ -0,0 +1,2 @@
1
+ export declare const formatDuration: (duration?: number) => string;
2
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,GAAI,WAAW,MAAM,WAM/C,CAAA"}
@@ -0,0 +1 @@
1
+ /*! tailwindcss v4.1.14 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-tracking:initial;--tw-outline-style:solid;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial}}}@layer theme{:root,:host{--font-sans:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;--color-red-400:oklch(70.4% .191 22.216);--color-red-800:oklch(44.4% .177 26.899);--color-green-500:oklch(72.3% .219 149.579);--color-emerald-500:oklch(69.6% .17 162.48);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-pink-500:oklch(65.6% .241 354.308);--color-gray-500:oklch(55.1% .027 264.364);--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-lg:1.125rem;--text-lg--line-height:calc(1.75/1.125);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--radius-sm:.25rem;--radius-md:.375rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--font-weight-500:var(--font-weight-500);--font-weight-600:var(--font-weight-600);--font-weight-700:var(--font-weight-700)}}@layer base{*{border-color:var(--border)}body{background-color:var(--background);color:var(--foreground)}*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.invisible{visibility:hidden}.visible{visibility:visible}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.top-0{top:calc(var(--spacing)*0)}.top-1\/2{top:50%}.top-\[8px\]{top:8px}.right-3{right:calc(var(--spacing)*3)}.bottom-\[-4px\]{bottom:-4px}.-left-\[26px\]{left:-26px}.left-0{left:calc(var(--spacing)*0)}.left-3{left:calc(var(--spacing)*3)}.z-9{z-index:9}.z-10{z-index:10}.mb-4{margin-bottom:calc(var(--spacing)*4)}.flex{display:flex}.grid{display:grid}.h-1{height:calc(var(--spacing)*1)}.h-4{height:calc(var(--spacing)*4)}.h-\[24px\]{height:24px}.h-\[32px\]{height:32px}.h-\[34px\]{height:34px}.h-\[37px\]{height:37px}.h-full{height:100%}.max-h-\[32px\]{max-height:32px}.min-h-\[37px\]{min-height:37px}.w-1{width:calc(var(--spacing)*1)}.w-4{width:calc(var(--spacing)*4)}.w-\[1px\]{width:1px}.w-\[300px\]{width:300px}.w-\[800px\]{width:800px}.w-full{width:100%}.max-w-\[200px\]{max-width:200px}.min-w-\[200px\]{min-width:200px}.min-w-full{min-width:100%}.flex-1{flex:1}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x)var(--tw-translate-y)}.cursor-pointer{cursor:pointer}.grid-cols-\[300px_1fr\]{grid-template-columns:300px 1fr}.grid-rows-\[auto_1fr\]{grid-template-rows:auto 1fr}.flex-col{flex-direction:column}.flex-row{flex-direction:row}.items-center{align-items:center}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.gap-1{gap:calc(var(--spacing)*1)}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}.gap-4{gap:calc(var(--spacing)*4)}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*1)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*1)*calc(1 - var(--tw-space-y-reverse)))}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.rounded-\[4px\]{border-radius:4px}.rounded-full{border-radius:3.40282e38px}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l-1{border-left-style:var(--tw-border-style);border-left-width:1px}.border-border{border-color:var(--border)}.border-gray-500\/40{border-color:#6a728266}@supports (color:color-mix(in lab,red,red)){.border-gray-500\/40{border-color:color-mix(in oklab,var(--color-gray-500)40%,transparent)}}.bg-background{background-color:var(--background)}.bg-blue-500{background-color:var(--color-blue-500)}.bg-blue-500\/50{background-color:#3080ff80}@supports (color:color-mix(in lab,red,red)){.bg-blue-500\/50{background-color:color-mix(in oklab,var(--color-blue-500)50%,transparent)}}.bg-card{background-color:var(--card)}.bg-emerald-500{background-color:var(--color-emerald-500)}.bg-muted-foreground\/10{background-color:var(--muted-foreground)}@supports (color:color-mix(in lab,red,red)){.bg-muted-foreground\/10{background-color:color-mix(in oklab,var(--muted-foreground)10%,transparent)}}.bg-red-800\/10{background-color:#9f07121a}@supports (color:color-mix(in lab,red,red)){.bg-red-800\/10{background-color:color-mix(in oklab,var(--color-red-800)10%,transparent)}}.bg-\[repeating-linear-gradient\(140deg\,\#2862FE\,\#2862FE_8px\,\#2358E5_8px\,\#2358E5_16px\)\]{background-image:repeating-linear-gradient(140deg,#2862fe,#2862fe 8px,#2358e5 8px 16px)}.bg-\[repeating-linear-gradient\(140deg\,\#BEFE29\,\#BEFE29_8px\,\#ABE625_8px\,\#ABE625_16px\)\]{background-image:repeating-linear-gradient(140deg,#befe29,#befe29 8px,#abe625 8px 16px)}.bg-\[repeating-linear-gradient\(140deg\,\#EA2069\,\#EA2069_8px\,\#D41E60_8px\,\#D41E60_16px\)\]{background-image:repeating-linear-gradient(140deg,#ea2069,#ea2069 8px,#d41e60 8px 16px)}.p-2{padding:calc(var(--spacing)*2)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-9{padding-inline:calc(var(--spacing)*9)}.px-\[4px\]{padding-inline:4px}.py-4{padding-block:calc(var(--spacing)*4)}.py-\[2px\]{padding-block:2px}.pl-4{padding-left:calc(var(--spacing)*4)}.pl-6{padding-left:calc(var(--spacing)*6)}.font-mono{font-family:var(--font-mono)}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[1px\]{--tw-tracking:1px;letter-spacing:1px}.text-blue-100{color:var(--color-blue-100)}.text-blue-500{color:var(--color-blue-500)}.text-blue-600{color:var(--color-blue-600)}.text-emerald-500{color:var(--color-emerald-500)}.text-foreground{color:var(--foreground)}.text-green-500{color:var(--color-green-500)}.text-muted-foreground,.text-muted-foreground\/50{color:var(--muted-foreground)}@supports (color:color-mix(in lab,red,red)){.text-muted-foreground\/50{color:color-mix(in oklab,var(--muted-foreground)50%,transparent)}}.text-pink-500{color:var(--color-pink-500)}.text-red-800{color:var(--color-red-800)}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.outline-2{outline-style:var(--tw-outline-style);outline-width:2px}.outline-emerald-500\/50{outline-color:#00bb7f80}@supports (color:color-mix(in lab,red,red)){.outline-emerald-500\/50{outline-color:color-mix(in oklab,var(--color-emerald-500)50%,transparent)}}.backdrop-blur-\[4px\]{--tw-backdrop-blur:blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,)var(--tw-backdrop-brightness,)var(--tw-backdrop-contrast,)var(--tw-backdrop-grayscale,)var(--tw-backdrop-hue-rotate,)var(--tw-backdrop-invert,)var(--tw-backdrop-opacity,)var(--tw-backdrop-saturate,)var(--tw-backdrop-sepia,)}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}@media (hover:hover){.hover\:bg-muted-foreground\/10:hover{background-color:var(--muted-foreground)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-muted-foreground\/10:hover{background-color:color-mix(in oklab,var(--muted-foreground)10%,transparent)}}.hover\:bg-muted\/50:hover{background-color:var(--muted)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-muted\/50:hover{background-color:color-mix(in oklab,var(--muted)50%,transparent)}}.hover\:bg-muted\/70:hover{background-color:var(--muted)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-muted\/70:hover{background-color:color-mix(in oklab,var(--muted)70%,transparent)}}.hover\:text-muted-foreground:hover{color:var(--muted-foreground)}.hover\:opacity-80:hover{opacity:.8}}.dark\:text-red-400:is(.dark *){color:var(--color-red-400)}}:root{--default-font-family:"DM Sans",ui-sans-serif,sans-serif;--font-dm-mono:"DM Mono",ui-monospace,monospace;color-scheme:light dark;font-size:16px;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji"),serif;font-synthesis:none;text-rendering:optimizeLegibility;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;font-optical-sizing:auto;--font-weight-500:500;--font-weight-600:600;--font-weight-700:700;--accent-1000:#2862fe;--accent-970:#2862fef7;--accent-950:#2862fef2;--accent-900:#2862fee5;--accent-800:#2862fecc;--accent-700:#2862feb2;--accent-600:#2862fe99;--accent-500:#2862fe80;--accent-400:#2862fe66;--accent-300:#2862fe4d;--accent-200:#2862fe33;--accent-100:#2862fe1a;--accent-50:#2862fe0d;--accent-30:#2862fe08;--dark-1000:#0a0a0a;--dark-970:#0a0a0af7;--dark-950:#0a0a0af2;--dark-900:#0a0a0ae5;--dark-800:#0a0a0acc;--dark-700:#0a0a0ab2;--dark-600:#0a0a0a99;--dark-500:#0a0a0a80;--dark-400:#0a0a0a66;--dark-300:#0a0a0a4d;--dark-200:#0a0a0a33;--dark-100:#0a0a0a1a;--dark-50:#0a0a0a0d;--dark-30:#0a0a0a08;--light-1000:#fff;--light-970:#fffffff7;--light-950:#fffffff2;--light-900:#ffffffe5;--light-800:#fffc;--light-700:#ffffffb2;--light-600:#fff9;--light-500:#ffffff80;--light-400:#fff6;--light-300:#ffffff4d;--light-200:#fff3;--light-100:#ffffff1a;--light-50:#ffffff0d;--light-30:#ffffff08;--error:#d61355;--canvas-background:#ebebeb;--background:var(--light-1000);--foreground:var(--dark-1000);--surface-content:var(--dark-30);--surface-component:var(--dark-50);--surface-light-100:var(--dark-100);--surface-light-200:var(--dark-200);--border:var(--dark-100);--border-accent:var(--accent-1000);--states-hover:var(--dark-30);--states-selected:var(--dark-100);--states-active:var(--accent-1000);--text-header:var(--dark-1000);--text-body:var(--dark-600);--text-placeholder:var(--dark-400);--text-accent:var(--accent-1000);--text-error:var(--error);--icon-active:var(--dark-1000);--icon-light:var(--dark-600);--icon-component:var(--dark-400);--icon-accent:var(--accent-1000);--primary:var(--accent-1000);--primary-foreground:var(--light-1000);--secondary:var(--surface-component);--secondary-foreground:var(--text-body);--muted:var(--surface-light-100);--muted-foreground:var(--text-body);--accent:var(--accent-1000);--accent-foreground:var(--light-1000);--destructive:var(--error);--destructive-foreground:var(--light-1000);--card:var(--surface-content);--card-foreground:var(--foreground);--popover:var(--surface-content);--popover-foreground:var(--foreground);--input:var(--states-hover);--ring:var(--border-accent);--chart-1:var(--accent-1000);--chart-2:var(--accent-800);--chart-3:var(--accent-600);--chart-4:var(--accent-400);--chart-5:var(--accent-200);--header:var(--background);--header-foreground:var(--text-header);--header-primary:var(--primary);--header-primary-foreground:var(--primary-foreground);--header-accent:var(--surface-component);--header-accent-foreground:var(--text-body);--header-border:var(--border);--header-ring:var(--ring);--sidebar:var(--background);--sidebar-foreground:var(--text-header);--sidebar-primary:var(--primary);--sidebar-primary-foreground:var(--primary-foreground);--sidebar-accent:var(--surface-component);--sidebar-accent-foreground:var(--text-body);--sidebar-border:var(--border);--sidebar-ring:var(--ring);width:100%}.dark{--canvas-background:#030303;--background:var(--dark-1000);--foreground:var(--light-1000);--surface-content:var(--light-30);--surface-component:var(--light-50);--surface-light-100:var(--light-100);--surface-light-200:var(--light-200);--border:var(--light-100);--states-hover:var(--light-30);--states-selected:var(--light-100);--text-header:var(--light-1000);--text-body:var(--light-600);--text-placeholder:var(--light-400);--icon-active:var(--light-1000);--icon-light:var(--light-600);--icon-component:var(--light-400);--secondary-foreground:var(--light-600);--muted-foreground:var(--light-600);--card:var(--surface-content);--card-foreground:var(--foreground);--popover:var(--surface-content);--popover-foreground:var(--foreground);--input:var(--states-hover);--ring:var(--border-accent);--chart-1:var(--accent-1000);--chart-2:var(--accent-800);--chart-3:var(--accent-600);--chart-4:var(--accent-400);--chart-5:var(--accent-200);--header:var(--background);--header-foreground:var(--text-header);--header-primary:var(--primary);--header-primary-foreground:var(--primary-foreground);--header-accent:var(--surface-component);--header-accent-foreground:var(--text-body);--header-border:var(--border);--header-ring:var(--ring);--sidebar:var(--background);--sidebar-foreground:var(--text-header);--sidebar-primary:var(--primary);--sidebar-primary-foreground:var(--primary-foreground);--sidebar-accent:var(--surface-component);--sidebar-accent-foreground:var(--text-body);--sidebar-border:var(--border);--sidebar-ring:var(--ring)}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}
@@ -0,0 +1 @@
1
+ "use strict";const a=({tracerFactory:t,registerApi:r})=>{r({method:"POST",path:"/__motia/trace/clear"},async()=>{try{return await t.clear(),{status:200,body:{message:"Traces cleared"}}}catch(e){return{status:500,body:{error:e instanceof Error?e.message:"Unknown error"}}}})};function o(t){return a(t),{workbench:[{packageName:"@motiadev/plugin-observability",cssImports:["@motiadev/plugin-observability/dist/plugin-observability.css"],label:"Tracing",position:"bottom",componentName:"ObservabilityPage",labelIcon:"gantt-chart"}]}}module.exports=o;
@@ -0,0 +1,3 @@
1
+ import { MotiaPlugin, MotiaPluginContext } from '@motiadev/core';
2
+ export default function plugin(motia: MotiaPluginContext): MotiaPlugin;
3
+ //# sourceMappingURL=plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAGrE,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,kBAAkB,GAAG,WAAW,CAerE"}
package/dist/plugin.js ADDED
@@ -0,0 +1,38 @@
1
+ const r = ({ tracerFactory: a, registerApi: t }) => {
2
+ t(
3
+ {
4
+ method: "POST",
5
+ path: "/__motia/trace/clear"
6
+ },
7
+ async () => {
8
+ try {
9
+ return await a.clear(), {
10
+ status: 200,
11
+ body: { message: "Traces cleared" }
12
+ };
13
+ } catch (e) {
14
+ return {
15
+ status: 500,
16
+ body: { error: e instanceof Error ? e.message : "Unknown error" }
17
+ };
18
+ }
19
+ }
20
+ );
21
+ };
22
+ function o(a) {
23
+ return r(a), {
24
+ workbench: [
25
+ {
26
+ packageName: "@motiadev/plugin-observability",
27
+ cssImports: ["@motiadev/plugin-observability/dist/plugin-observability.css"],
28
+ label: "Tracing",
29
+ position: "bottom",
30
+ componentName: "ObservabilityPage",
31
+ labelIcon: "gantt-chart"
32
+ }
33
+ ]
34
+ };
35
+ }
36
+ export {
37
+ o as default
38
+ };
@@ -0,0 +1,8 @@
1
+ export type ObservabilityState = {
2
+ selectedTraceGroupId?: string;
3
+ selectedTraceId?: string;
4
+ selectTraceGroupId: (groupId?: string) => void;
5
+ selectTraceId: (traceId?: string) => void;
6
+ };
7
+ export declare const useObservabilityStore: import('zustand').UseBoundStore<import('zustand').StoreApi<ObservabilityState>>;
8
+ //# sourceMappingURL=use-observability-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-observability-store.d.ts","sourceRoot":"","sources":["../../src/stores/use-observability-store.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,kBAAkB,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9C,aAAa,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;CAC1C,CAAA;AAED,eAAO,MAAM,qBAAqB,iFAK/B,CAAA"}
@@ -0,0 +1,79 @@
1
+ export interface TraceGroup {
2
+ id: string;
3
+ correlationId: string | undefined;
4
+ name: string;
5
+ status: 'running' | 'completed' | 'failed';
6
+ startTime: number;
7
+ endTime?: number;
8
+ lastActivity: number;
9
+ metadata: {
10
+ completedSteps: number;
11
+ activeSteps: number;
12
+ totalSteps: number;
13
+ };
14
+ }
15
+ export interface Trace {
16
+ id: string;
17
+ name: string;
18
+ correlationId?: string;
19
+ parentTraceId?: string;
20
+ status: 'running' | 'completed' | 'failed';
21
+ startTime: number;
22
+ endTime?: number;
23
+ entryPoint: {
24
+ type: 'api' | 'event' | 'cron';
25
+ stepName: string;
26
+ };
27
+ events: TraceEvent[];
28
+ error?: TraceError;
29
+ }
30
+ export type TraceError = {
31
+ message: string;
32
+ code?: string | number;
33
+ stack?: string;
34
+ };
35
+ export type TraceEvent = StateEvent | EmitEvent | StreamEvent | LogEntry;
36
+ export type StateOperation = 'get' | 'getGroup' | 'set' | 'delete' | 'clear';
37
+ export type StreamOperation = 'get' | 'getGroup' | 'set' | 'delete' | 'clear' | 'send';
38
+ export interface StateEvent {
39
+ type: 'state';
40
+ timestamp: number;
41
+ operation: 'get' | 'getGroup' | 'set' | 'delete' | 'clear';
42
+ key?: string;
43
+ duration?: number;
44
+ data: any;
45
+ }
46
+ export interface EmitEvent {
47
+ type: 'emit';
48
+ timestamp: number;
49
+ topic: string;
50
+ success: boolean;
51
+ data: unknown;
52
+ }
53
+ export interface StreamEvent {
54
+ type: 'stream';
55
+ timestamp: number;
56
+ operation: StreamOperation;
57
+ streamName: string;
58
+ duration?: number;
59
+ data: {
60
+ groupId: string;
61
+ id: string;
62
+ data?: unknown;
63
+ };
64
+ calls: number;
65
+ }
66
+ export interface LogEntry {
67
+ type: 'log';
68
+ timestamp: number;
69
+ level: string;
70
+ message: string;
71
+ metadata?: unknown;
72
+ }
73
+ export interface ObservabilityStats {
74
+ total: number;
75
+ running: number;
76
+ completed: number;
77
+ failed: number;
78
+ }
79
+ //# sourceMappingURL=observability.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"observability.d.ts","sourceRoot":"","sources":["../../src/types/observability.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,aAAa,EAAE,MAAM,GAAG,SAAS,CAAA;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAA;IAC1C,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE;QACR,cAAc,EAAE,MAAM,CAAA;QACtB,WAAW,EAAE,MAAM,CAAA;QACnB,UAAU,EAAE,MAAM,CAAA;KACnB,CAAA;CACF;AAED,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAA;IAC1C,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE;QAAE,IAAI,EAAE,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;IAChE,MAAM,EAAE,UAAU,EAAE,CAAA;IACpB,KAAK,CAAC,EAAE,UAAU,CAAA;CACnB;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAED,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAA;AAExE,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,UAAU,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAA;AAC5E,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,UAAU,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAA;AAEtF,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,OAAO,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,KAAK,GAAG,UAAU,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAA;IAC1D,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,GAAG,CAAA;CACV;AAED,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,EAAE,OAAO,CAAA;CACd;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,QAAQ,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,eAAe,CAAA;IAC1B,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;IACrD,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,KAAK,CAAA;IACX,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,MAAM,CAAA;IACf,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;CACf"}
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@motiadev/plugin-observability",
3
+ "version": "0.8.2-beta.140-111855",
4
+ "type": "module",
5
+ "main": "./dist/index.js",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/index.cjs"
13
+ },
14
+ "./plugin": {
15
+ "types": "./dist/plugin.d.ts",
16
+ "import": "./dist/plugin.js",
17
+ "require": "./dist/plugin.cjs"
18
+ },
19
+ "./styles.css": "./dist/plugin-observability.css"
20
+ },
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "dependencies": {
25
+ "date-fns": "^3.6.0",
26
+ "lucide-react": "^0.545.0",
27
+ "zustand": "^5.0.8"
28
+ },
29
+ "peerDependencies": {
30
+ "@motiadev/stream-client-react": "0.8.2-beta.140-111855",
31
+ "@motiadev/ui": "0.8.2-beta.140-111855",
32
+ "@motiadev/core": "0.8.2-beta.140-111855"
33
+ },
34
+ "devDependencies": {
35
+ "@tailwindcss/vite": "^4.1.14",
36
+ "@types/express": "^5.0.3",
37
+ "@types/node": "^24.7.2",
38
+ "@types/react": "^19.2.2",
39
+ "@vitejs/plugin-react": "^5.0.4",
40
+ "react": "^19.2.0",
41
+ "tailwindcss": "^4.1.14",
42
+ "typescript": "^5.9.3",
43
+ "vite": "^7.1.10",
44
+ "vite-plugin-dts": "^4.5.4"
45
+ },
46
+ "scripts": {
47
+ "build": "vite build",
48
+ "dev": "vite build --watch",
49
+ "clean": "rm -rf dist"
50
+ }
51
+ }