ai-design-system 0.1.26 → 0.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/features/WorkflowObservabilityFeature/WorkflowObservabilityFeature.stories.tsx +5 -10
- package/components/features/WorkflowObservabilityFeature/useWorkflowObservabilityFeature.d.ts +12 -0
- package/components/features/WorkflowObservabilityFeature/useWorkflowObservabilityFeature.mock.ts +48 -0
- package/dist/index.cjs +41 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.js +41 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/components/features/WorkflowObservabilityFeature/WorkflowObservabilityFeature.stories.tsx
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/nextjs-vite"
|
|
2
|
-
import { useState } from "react"
|
|
3
2
|
|
|
4
3
|
import { WorkflowObservabilityFeature } from "./WorkflowObservabilityFeature"
|
|
5
4
|
import {
|
|
@@ -61,8 +60,6 @@ export const WithStateManagement: Story = {
|
|
|
61
60
|
args: baseArgs,
|
|
62
61
|
render: () => {
|
|
63
62
|
const state = useWorkflowObservabilityFeatureMock()
|
|
64
|
-
const [searchQuery, setSearchQuery] = useState("")
|
|
65
|
-
const [selectedItemId, setSelectedItemId] = useState<string | null>(state.selectedRun.runId)
|
|
66
63
|
|
|
67
64
|
return (
|
|
68
65
|
<div className="h-dvh min-h-0 p-2">
|
|
@@ -76,13 +73,11 @@ export const WithStateManagement: Story = {
|
|
|
76
73
|
runActions={state.runActions}
|
|
77
74
|
onSearchQueryChange={state.actionHandlers?.onSearchQueryChange}
|
|
78
75
|
onSelectSpan={state.actionHandlers?.onSelectSpan}
|
|
79
|
-
inbox={{
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
onSearchQueryChange: setSearchQuery,
|
|
85
|
-
}}
|
|
76
|
+
inbox={state.inbox ? {
|
|
77
|
+
...state.inbox,
|
|
78
|
+
onSelectItem: state.actionHandlers?.onSelectInboxItem,
|
|
79
|
+
onSearchQueryChange: state.actionHandlers?.onInboxSearchQueryChange,
|
|
80
|
+
} : undefined}
|
|
86
81
|
className="h-full"
|
|
87
82
|
/>
|
|
88
83
|
</div>
|
package/components/features/WorkflowObservabilityFeature/useWorkflowObservabilityFeature.d.ts
CHANGED
|
@@ -5,10 +5,21 @@ import type {
|
|
|
5
5
|
WorkflowSpanRecord,
|
|
6
6
|
WorkflowStreamRecord,
|
|
7
7
|
} from "@/components/composites/WorkflowRunObservabilityPanel"
|
|
8
|
+
import type { InboxListItem } from "@/components/composites/InboxList"
|
|
8
9
|
|
|
9
10
|
export interface WorkflowObservabilityFeatureActionHandlers {
|
|
10
11
|
onSearchQueryChange?: (value: string) => void
|
|
11
12
|
onSelectSpan?: (spanId: string | null) => void
|
|
13
|
+
onInboxSearchQueryChange?: (value: string) => void
|
|
14
|
+
onSelectInboxItem?: (itemId: string) => void
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface WorkflowObservabilityFeatureInboxState {
|
|
18
|
+
items: InboxListItem[]
|
|
19
|
+
selectedItemId?: string | null
|
|
20
|
+
searchQuery?: string
|
|
21
|
+
isLoading?: boolean
|
|
22
|
+
emptyMessage?: string
|
|
12
23
|
}
|
|
13
24
|
|
|
14
25
|
export interface UseWorkflowObservabilityFeatureReturn {
|
|
@@ -19,6 +30,7 @@ export interface UseWorkflowObservabilityFeatureReturn {
|
|
|
19
30
|
searchQuery?: string
|
|
20
31
|
selectedSpanId?: string | null
|
|
21
32
|
runActions?: WorkflowRunAction[]
|
|
33
|
+
inbox?: WorkflowObservabilityFeatureInboxState
|
|
22
34
|
actionHandlers?: WorkflowObservabilityFeatureActionHandlers
|
|
23
35
|
}
|
|
24
36
|
|
package/components/features/WorkflowObservabilityFeature/useWorkflowObservabilityFeature.mock.ts
CHANGED
|
@@ -4,18 +4,46 @@ import type { UseWorkflowObservabilityFeatureReturn } from "./useWorkflowObserva
|
|
|
4
4
|
import {
|
|
5
5
|
selectedWorkflowRunMock,
|
|
6
6
|
workflowEventRecordsMock,
|
|
7
|
+
workflowInboxItemsMock,
|
|
7
8
|
workflowSpanRecordsMock,
|
|
8
9
|
workflowStreamRecordsMock,
|
|
9
10
|
} from "./WorkflowObservabilityFeature.mocks"
|
|
10
11
|
|
|
12
|
+
const runByInboxId: Record<string, typeof selectedWorkflowRunMock> = {
|
|
13
|
+
[selectedWorkflowRunMock.runId]: selectedWorkflowRunMock,
|
|
14
|
+
wrun_01KP45XGBHRMT7HQJXXHKBEQS5: {
|
|
15
|
+
...selectedWorkflowRunMock,
|
|
16
|
+
runId: "wrun_01KP45XGBHRMT7HQJXXHKBEQS5",
|
|
17
|
+
status: "completed",
|
|
18
|
+
createdAt: "7m ago",
|
|
19
|
+
completedAt: "today 12:45 PM",
|
|
20
|
+
duration: "43s",
|
|
21
|
+
suspensionReason: "-",
|
|
22
|
+
},
|
|
23
|
+
}
|
|
24
|
+
|
|
11
25
|
export function useWorkflowObservabilityFeatureMock(): UseWorkflowObservabilityFeatureReturn {
|
|
12
26
|
const [searchQuery, setSearchQuery] = React.useState("")
|
|
13
27
|
const [selectedSpanId, setSelectedSpanId] = React.useState<string | null>(null)
|
|
28
|
+
const [inboxSearchQuery, setInboxSearchQuery] = React.useState("")
|
|
29
|
+
const [selectedInboxItemId, setSelectedInboxItemId] = React.useState<string | null>(selectedWorkflowRunMock.runId)
|
|
14
30
|
const [selectedRun, setSelectedRun] = React.useState(selectedWorkflowRunMock)
|
|
15
31
|
const [spans, setSpans] = React.useState(workflowSpanRecordsMock)
|
|
16
32
|
const [events, setEvents] = React.useState(workflowEventRecordsMock)
|
|
17
33
|
const [streams, setStreams] = React.useState(workflowStreamRecordsMock)
|
|
18
34
|
|
|
35
|
+
const inboxItems = React.useMemo(() => {
|
|
36
|
+
const normalizedQuery = inboxSearchQuery.trim().toLowerCase()
|
|
37
|
+
if (!normalizedQuery) {
|
|
38
|
+
return workflowInboxItemsMock
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return workflowInboxItemsMock.filter((item) => {
|
|
42
|
+
const searchText = [item.title, item.subtitle, item.preview].filter(Boolean).join(" ").toLowerCase()
|
|
43
|
+
return searchText.includes(normalizedQuery)
|
|
44
|
+
})
|
|
45
|
+
}, [inboxSearchQuery])
|
|
46
|
+
|
|
19
47
|
const isRunActive = selectedRun.status === "pending" || selectedRun.status === "running"
|
|
20
48
|
const hasPendingSleeps = React.useMemo(
|
|
21
49
|
() => spans.some((span) => span.resource === "sleep" && span.state === "live"),
|
|
@@ -70,6 +98,7 @@ export function useWorkflowObservabilityFeatureMock(): UseWorkflowObservabilityF
|
|
|
70
98
|
suspensionReason: "webhook",
|
|
71
99
|
}))
|
|
72
100
|
|
|
101
|
+
setSelectedInboxItemId(newRunId)
|
|
73
102
|
setSelectedSpanId("span_generateBirthdayCard")
|
|
74
103
|
|
|
75
104
|
appendEventAndStream("run_replayed", "A new run was started from replay action.", {
|
|
@@ -177,6 +206,16 @@ export function useWorkflowObservabilityFeatureMock(): UseWorkflowObservabilityF
|
|
|
177
206
|
})
|
|
178
207
|
}, [appendEventAndStream, selectedRun.runId])
|
|
179
208
|
|
|
209
|
+
const selectInboxItem = React.useCallback((itemId: string) => {
|
|
210
|
+
setSelectedInboxItemId(itemId)
|
|
211
|
+
setSelectedSpanId(null)
|
|
212
|
+
|
|
213
|
+
const nextRun = runByInboxId[itemId]
|
|
214
|
+
if (nextRun) {
|
|
215
|
+
setSelectedRun(nextRun)
|
|
216
|
+
}
|
|
217
|
+
}, [])
|
|
218
|
+
|
|
180
219
|
return {
|
|
181
220
|
selectedRun,
|
|
182
221
|
spans,
|
|
@@ -184,6 +223,13 @@ export function useWorkflowObservabilityFeatureMock(): UseWorkflowObservabilityF
|
|
|
184
223
|
streams,
|
|
185
224
|
searchQuery,
|
|
186
225
|
selectedSpanId,
|
|
226
|
+
inbox: {
|
|
227
|
+
items: inboxItems,
|
|
228
|
+
selectedItemId: selectedInboxItemId,
|
|
229
|
+
searchQuery: inboxSearchQuery,
|
|
230
|
+
isLoading: false,
|
|
231
|
+
emptyMessage: "No runs found.",
|
|
232
|
+
},
|
|
187
233
|
runActions: [
|
|
188
234
|
{
|
|
189
235
|
id: "replay-run",
|
|
@@ -233,6 +279,8 @@ export function useWorkflowObservabilityFeatureMock(): UseWorkflowObservabilityF
|
|
|
233
279
|
actionHandlers: {
|
|
234
280
|
onSearchQueryChange: setSearchQuery,
|
|
235
281
|
onSelectSpan: setSelectedSpanId,
|
|
282
|
+
onInboxSearchQueryChange: setInboxSearchQuery,
|
|
283
|
+
onSelectInboxItem: selectInboxItem,
|
|
236
284
|
},
|
|
237
285
|
}
|
|
238
286
|
}
|
package/dist/index.cjs
CHANGED
|
@@ -10710,6 +10710,34 @@ var WorkflowObservabilityFeature = React33__namespace.memo(
|
|
|
10710
10710
|
WorkflowObservabilityFeature.displayName = "WorkflowObservabilityFeature";
|
|
10711
10711
|
|
|
10712
10712
|
// components/features/WorkflowObservabilityFeature/WorkflowObservabilityFeature.mocks.ts
|
|
10713
|
+
var selectedWorkflowRunMock = {
|
|
10714
|
+
runId: "wrun_01KP45XGBHRMT7HQJXXHKBEQS4",
|
|
10715
|
+
workflowName: "generateBirthdayCard",
|
|
10716
|
+
status: "running",
|
|
10717
|
+
createdAt: "1m ago",
|
|
10718
|
+
startedAt: "today 12:44 PM",
|
|
10719
|
+
completedAt: "-",
|
|
10720
|
+
duration: "1m 43s",
|
|
10721
|
+
expiresAt: "-",
|
|
10722
|
+
storage: "5 MB",
|
|
10723
|
+
moduleSpecifier: "./app/api/generate/generate-birthday-card.ts",
|
|
10724
|
+
resumeAt: "4/23/2026, 12:00:00 AM",
|
|
10725
|
+
suspensionReason: "webhook",
|
|
10726
|
+
argumentsPayload: {
|
|
10727
|
+
recipientName: "Maya",
|
|
10728
|
+
tone: "friendly",
|
|
10729
|
+
includeEmoji: true
|
|
10730
|
+
},
|
|
10731
|
+
inputPayload: {
|
|
10732
|
+
prompt: "Generate a birthday greeting card with confetti accents",
|
|
10733
|
+
locale: "en-US"
|
|
10734
|
+
},
|
|
10735
|
+
outputPayload: {
|
|
10736
|
+
cardId: "card_90210",
|
|
10737
|
+
status: "draft",
|
|
10738
|
+
revision: 3
|
|
10739
|
+
}
|
|
10740
|
+
};
|
|
10713
10741
|
[
|
|
10714
10742
|
{
|
|
10715
10743
|
id: "stream_1",
|
|
@@ -10725,6 +10753,19 @@ WorkflowObservabilityFeature.displayName = "WorkflowObservabilityFeature";
|
|
|
10725
10753
|
}
|
|
10726
10754
|
];
|
|
10727
10755
|
|
|
10756
|
+
// components/features/WorkflowObservabilityFeature/useWorkflowObservabilityFeature.mock.ts
|
|
10757
|
+
({
|
|
10758
|
+
[selectedWorkflowRunMock.runId]: selectedWorkflowRunMock,
|
|
10759
|
+
wrun_01KP45XGBHRMT7HQJXXHKBEQS5: __spreadProps(__spreadValues({}, selectedWorkflowRunMock), {
|
|
10760
|
+
runId: "wrun_01KP45XGBHRMT7HQJXXHKBEQS5",
|
|
10761
|
+
status: "completed",
|
|
10762
|
+
createdAt: "7m ago",
|
|
10763
|
+
completedAt: "today 12:45 PM",
|
|
10764
|
+
duration: "43s",
|
|
10765
|
+
suspensionReason: "-"
|
|
10766
|
+
})
|
|
10767
|
+
});
|
|
10768
|
+
|
|
10728
10769
|
exports.AIConversation = AIConversation;
|
|
10729
10770
|
exports.AIDocEditor = AIDocEditor;
|
|
10730
10771
|
exports.Accordion = Accordion2;
|