@burdenoff/microfe-botmanor 2026.1120.10 → 2026.1120.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/botlit/components/ExecutionFeedback.d.ts +5 -0
- package/dist/botlit/components/ExecutionFeedback.js +55 -0
- package/dist/botlit/components/ExecutionFeedback.js.map +1 -0
- package/dist/botlit/components/KnowledgeReviewSchedule.d.ts +7 -0
- package/dist/botlit/components/KnowledgeReviewSchedule.js +92 -0
- package/dist/botlit/components/KnowledgeReviewSchedule.js.map +1 -0
- package/dist/botlit/components/SuggestionsPanel.d.ts +12 -0
- package/dist/botlit/components/SuggestionsPanel.js +219 -0
- package/dist/botlit/components/SuggestionsPanel.js.map +1 -0
- package/dist/botlit/hooks/index.d.ts +2 -2
- package/dist/botlit/hooks/index.js +2 -2
- package/dist/botlit/hooks/useAgentTuning.d.ts +87 -0
- package/dist/botlit/hooks/useAgentTuning.js +170 -0
- package/dist/botlit/hooks/useAgentTuning.js.map +1 -0
- package/dist/botlit/hooks/useAiOperations.js +1 -1
- package/dist/botlit/hooks/useAiOperations.js.map +1 -1
- package/dist/botlit/hooks/useExecutions.d.ts +30 -18
- package/dist/botlit/hooks/useExecutions.js +42 -49
- package/dist/botlit/hooks/useExecutions.js.map +1 -1
- package/dist/botlit/pages/AgentDetailPage.js +75 -70
- package/dist/botlit/pages/AgentDetailPage.js.map +1 -1
- package/dist/botlit/pages/ExecutionDetailPage.js +259 -190
- package/dist/botlit/pages/ExecutionDetailPage.js.map +1 -1
- package/dist/botlit/pages/ExecutionsPage.js +333 -210
- package/dist/botlit/pages/ExecutionsPage.js.map +1 -1
- package/dist/botlit/pages/KnowledgeBaseDetailPage.js +356 -354
- package/dist/botlit/pages/KnowledgeBaseDetailPage.js.map +1 -1
- package/dist/botlit/utils/executionStatus.d.ts +16 -0
- package/dist/botlit/utils/executionStatus.js +32 -0
- package/dist/botlit/utils/executionStatus.js.map +1 -0
- package/dist/botlit/utils/formatters.js +4 -2
- package/dist/botlit/utils/formatters.js.map +1 -1
- package/dist/generated/wspace-operations.d.ts +67 -0
- package/dist/generated/wspace-operations.js +101 -73
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/generated/wspace-types.d.ts +55 -0
- package/dist/generated/wspace-types.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { useWorkspaceId as e, useWorkspaceMutation as t, useWorkspaceQuery as n } from "./internal/workspaceGateway.js";
|
|
2
|
+
import { useMemo as r } from "react";
|
|
3
|
+
import { gql as i } from "@apollo/client";
|
|
4
|
+
// src/botlit/hooks/useAgentTuning.ts
|
|
5
|
+
var a = "\n id\n agentId\n kind\n status\n title\n recommendation\n severity\n score\n confidence\n change {\n type\n before\n after\n fallbackBefore\n fallbackAfter\n knowledgeBaseId\n }\n topics\n evidence\n draftedBy\n modelVersion\n generatedAt\n appliedAt\n", o = i`
|
|
6
|
+
query BotmanorAgentSuggestions($agentId: ID!) {
|
|
7
|
+
agentSuggestions(agentId: $agentId) {
|
|
8
|
+
${a}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
`, s = i`
|
|
12
|
+
mutation BotmanorSuggestAgentImprovements($agentId: ID!) {
|
|
13
|
+
suggestAgentImprovements(agentId: $agentId) {
|
|
14
|
+
agentId
|
|
15
|
+
runsAnalyzed
|
|
16
|
+
windowDays
|
|
17
|
+
suppressed
|
|
18
|
+
modelDrafted
|
|
19
|
+
suggestions {
|
|
20
|
+
${a}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
`, c = i`
|
|
25
|
+
mutation BotmanorAcceptAgentSuggestion($id: ID!) {
|
|
26
|
+
acceptAgentSuggestion(id: $id) {
|
|
27
|
+
draftChanged
|
|
28
|
+
suggestion {
|
|
29
|
+
${a}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
`, l = i`
|
|
34
|
+
mutation BotmanorDismissAgentSuggestion($id: ID!) {
|
|
35
|
+
dismissAgentSuggestion(id: $id) {
|
|
36
|
+
${a}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
`, u = i`
|
|
40
|
+
mutation BotmanorRateExecution($id: ID!, $rating: ExecutionFeedbackRating!) {
|
|
41
|
+
rateExecution(id: $id, rating: $rating) {
|
|
42
|
+
id
|
|
43
|
+
feedbackRating
|
|
44
|
+
feedbackAt
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
`, d = i`
|
|
48
|
+
mutation BotmanorSetKnowledgeBaseRefreshInterval($id: ID!, $days: Int) {
|
|
49
|
+
setKnowledgeBaseRefreshInterval(id: $id, days: $days) {
|
|
50
|
+
id
|
|
51
|
+
refreshIntervalDays
|
|
52
|
+
lastReviewedAt
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
`, f = i`
|
|
56
|
+
mutation BotmanorMarkKnowledgeBaseReviewed($id: ID!) {
|
|
57
|
+
markKnowledgeBaseReviewed(id: $id) {
|
|
58
|
+
id
|
|
59
|
+
refreshIntervalDays
|
|
60
|
+
lastReviewedAt
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
`, p = i`
|
|
64
|
+
query BotmanorKnowledgeBaseReviewSchedule($id: ID!) {
|
|
65
|
+
getKnowledgeBase(id: $id) {
|
|
66
|
+
id
|
|
67
|
+
refreshIntervalDays
|
|
68
|
+
lastReviewedAt
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
`, m = [];
|
|
72
|
+
function h(t) {
|
|
73
|
+
let i = e(), a = r(() => t ? { agentId: t } : void 0, [t]);
|
|
74
|
+
return n({
|
|
75
|
+
document: o,
|
|
76
|
+
variables: a,
|
|
77
|
+
enabled: !!i && !!t,
|
|
78
|
+
errorMessage: "Failed to load suggestions.",
|
|
79
|
+
fallback: m,
|
|
80
|
+
select: (e) => e?.agentSuggestions ?? m
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function g() {
|
|
84
|
+
return t({
|
|
85
|
+
document: s,
|
|
86
|
+
variables: (e) => ({ agentId: e }),
|
|
87
|
+
select: (e) => e?.suggestAgentImprovements,
|
|
88
|
+
errorMessage: "Failed to generate suggestions."
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function _() {
|
|
92
|
+
return t({
|
|
93
|
+
document: c,
|
|
94
|
+
variables: (e) => ({ id: e }),
|
|
95
|
+
select: (e) => e?.acceptAgentSuggestion,
|
|
96
|
+
errorMessage: "Failed to accept the suggestion."
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function v() {
|
|
100
|
+
return t({
|
|
101
|
+
document: l,
|
|
102
|
+
variables: (e) => ({ id: e }),
|
|
103
|
+
select: (e) => e?.dismissAgentSuggestion,
|
|
104
|
+
errorMessage: "Failed to dismiss the suggestion."
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function y() {
|
|
108
|
+
return t({
|
|
109
|
+
document: u,
|
|
110
|
+
variables: (e) => ({
|
|
111
|
+
id: e.id,
|
|
112
|
+
rating: e.rating
|
|
113
|
+
}),
|
|
114
|
+
select: (e) => e?.rateExecution,
|
|
115
|
+
errorMessage: "Failed to save the rating."
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
function b(t) {
|
|
119
|
+
let i = e(), a = r(() => t ? { id: t } : void 0, [t]);
|
|
120
|
+
return n({
|
|
121
|
+
document: p,
|
|
122
|
+
variables: a,
|
|
123
|
+
enabled: !!i && !!t,
|
|
124
|
+
errorMessage: "Failed to load the review schedule.",
|
|
125
|
+
fallback: void 0,
|
|
126
|
+
select: (e) => e?.getKnowledgeBase ?? void 0
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
function x() {
|
|
130
|
+
return t({
|
|
131
|
+
document: d,
|
|
132
|
+
variables: (e) => ({
|
|
133
|
+
id: e.id,
|
|
134
|
+
days: e.days
|
|
135
|
+
}),
|
|
136
|
+
select: (e) => e?.setKnowledgeBaseRefreshInterval,
|
|
137
|
+
errorMessage: "Failed to save the review interval."
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
function S() {
|
|
141
|
+
return t({
|
|
142
|
+
document: f,
|
|
143
|
+
variables: (e) => ({ id: e }),
|
|
144
|
+
select: (e) => e?.markKnowledgeBaseReviewed,
|
|
145
|
+
errorMessage: "Failed to mark the knowledge base reviewed."
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
var C = i`
|
|
149
|
+
query BotmanorExecutionFeedback($id: ID!) {
|
|
150
|
+
getExecution(id: $id) {
|
|
151
|
+
id
|
|
152
|
+
feedbackRating
|
|
153
|
+
feedbackAt
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
`;
|
|
157
|
+
function w(t) {
|
|
158
|
+
let i = e(), a = r(() => t ? { id: t } : void 0, [t]);
|
|
159
|
+
return n({
|
|
160
|
+
document: C,
|
|
161
|
+
variables: a,
|
|
162
|
+
enabled: !!i && !!t,
|
|
163
|
+
errorMessage: "Failed to load the rating.",
|
|
164
|
+
fallback: void 0,
|
|
165
|
+
select: (e) => e?.getExecution ?? void 0
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
export { _ as useAcceptAgentSuggestion, h as useAgentSuggestions, v as useDismissAgentSuggestion, w as useExecutionFeedback, b as useKnowledgeReviewSchedule, S as useMarkKnowledgeReviewed, y as useRateExecution, x as useSetKnowledgeRefreshInterval, g as useSuggestAgentImprovements };
|
|
169
|
+
|
|
170
|
+
//# sourceMappingURL=useAgentTuning.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useAgentTuning.js","names":["SUGGESTION_FIELDS","LIST_DOCUMENT","SUGGEST_DOCUMENT","ACCEPT_DOCUMENT","DISMISS_DOCUMENT","RATE_DOCUMENT","REFRESH_INTERVAL_DOCUMENT","MARK_REVIEWED_DOCUMENT","REVIEW_SCHEDULE_DOCUMENT","NO_SUGGESTIONS","useAgentSuggestions","workspaceId","useWorkspaceId","variables","useMemo","agentId","useWorkspaceQuery","data","useSuggestAgentImprovements","useWorkspaceMutation","useAcceptAgentSuggestion","useDismissAgentSuggestion","useRateExecution","input","useKnowledgeReviewSchedule","knowledgeBaseId","useSetKnowledgeRefreshInterval","useMarkKnowledgeReviewed","EXECUTION_FEEDBACK_DOCUMENT","useExecutionFeedback","executionId"],"sources":["../../../src/botlit/hooks/useAgentTuning.ts"],"sourcesContent":["/**\n * Evidence-based agent tuning and knowledge review hooks (BOFF-15360).\n *\n * Wrap the `agent-tuning` fields of wspace-botmanor-svc:\n * - `agentSuggestions` / `suggestAgentImprovements` / `acceptAgentSuggestion`\n * / `dismissAgentSuggestion` — the accept-or-dismiss cards on an agent;\n * - `rateExecution` — a reviewer's good/poor rating of a run's answer;\n * - `setKnowledgeBaseRefreshInterval` / `markKnowledgeBaseReviewed` — a\n * knowledge base's review schedule.\n */\nimport { gql } from '@apollo/client';\nimport { useMemo } from 'react';\n\nimport {\n type MutationState,\n type QueryResult,\n useWorkspaceId,\n useWorkspaceMutation,\n useWorkspaceQuery,\n} from './internal/workspaceGateway';\n\nexport type AgentSuggestionKind =\n 'PROMPT_EDIT' | 'KNOWLEDGE_GAP' | 'MODEL_CHANGE' | 'KNOWLEDGE_OVERDUE' | 'KNOWLEDGE_CONFLICT';\n\nexport interface AgentSuggestionChange {\n type: 'SYSTEM_PROMPT' | 'MODEL' | 'KNOWLEDGE_REVIEW';\n before: string | null;\n after: string | null;\n fallbackBefore: string[] | null;\n fallbackAfter: string[] | null;\n knowledgeBaseId: string | null;\n}\n\nexport interface AgentSuggestion {\n id: string;\n agentId: string;\n kind: AgentSuggestionKind;\n status: string;\n title: string;\n recommendation: string;\n severity: string;\n score: number;\n confidence: number;\n change: AgentSuggestionChange | null;\n topics: string[];\n evidence: Record<string, unknown>;\n draftedBy: 'MODEL' | 'RULES';\n modelVersion: string;\n generatedAt: string;\n appliedAt: string | null;\n}\n\nexport interface AgentSuggestionRun {\n suggestions: AgentSuggestion[];\n runsAnalyzed: number;\n windowDays: number;\n suppressed: number;\n modelDrafted: boolean;\n}\n\nconst SUGGESTION_FIELDS = `\n id\n agentId\n kind\n status\n title\n recommendation\n severity\n score\n confidence\n change {\n type\n before\n after\n fallbackBefore\n fallbackAfter\n knowledgeBaseId\n }\n topics\n evidence\n draftedBy\n modelVersion\n generatedAt\n appliedAt\n`;\n\nconst LIST_DOCUMENT = gql`\n query BotmanorAgentSuggestions($agentId: ID!) {\n agentSuggestions(agentId: $agentId) {\n ${SUGGESTION_FIELDS}\n }\n }\n`;\n\nconst SUGGEST_DOCUMENT = gql`\n mutation BotmanorSuggestAgentImprovements($agentId: ID!) {\n suggestAgentImprovements(agentId: $agentId) {\n agentId\n runsAnalyzed\n windowDays\n suppressed\n modelDrafted\n suggestions {\n ${SUGGESTION_FIELDS}\n }\n }\n }\n`;\n\nconst ACCEPT_DOCUMENT = gql`\n mutation BotmanorAcceptAgentSuggestion($id: ID!) {\n acceptAgentSuggestion(id: $id) {\n draftChanged\n suggestion {\n ${SUGGESTION_FIELDS}\n }\n }\n }\n`;\n\nconst DISMISS_DOCUMENT = gql`\n mutation BotmanorDismissAgentSuggestion($id: ID!) {\n dismissAgentSuggestion(id: $id) {\n ${SUGGESTION_FIELDS}\n }\n }\n`;\n\nconst RATE_DOCUMENT = gql`\n mutation BotmanorRateExecution($id: ID!, $rating: ExecutionFeedbackRating!) {\n rateExecution(id: $id, rating: $rating) {\n id\n feedbackRating\n feedbackAt\n }\n }\n`;\n\nconst REFRESH_INTERVAL_DOCUMENT = gql`\n mutation BotmanorSetKnowledgeBaseRefreshInterval($id: ID!, $days: Int) {\n setKnowledgeBaseRefreshInterval(id: $id, days: $days) {\n id\n refreshIntervalDays\n lastReviewedAt\n }\n }\n`;\n\nconst MARK_REVIEWED_DOCUMENT = gql`\n mutation BotmanorMarkKnowledgeBaseReviewed($id: ID!) {\n markKnowledgeBaseReviewed(id: $id) {\n id\n refreshIntervalDays\n lastReviewedAt\n }\n }\n`;\n\nconst REVIEW_SCHEDULE_DOCUMENT = gql`\n query BotmanorKnowledgeBaseReviewSchedule($id: ID!) {\n getKnowledgeBase(id: $id) {\n id\n refreshIntervalDays\n lastReviewedAt\n }\n }\n`;\n\nconst NO_SUGGESTIONS: AgentSuggestion[] = [];\n\n/** The agent's open suggestions. */\nexport function useAgentSuggestions(agentId: string | undefined): QueryResult<AgentSuggestion[]> {\n const workspaceId = useWorkspaceId();\n const variables = useMemo(() => (agentId ? { agentId } : undefined), [agentId]);\n return useWorkspaceQuery<{ agentSuggestions?: AgentSuggestion[] }, AgentSuggestion[]>({\n document: LIST_DOCUMENT,\n variables,\n enabled: !!workspaceId && !!agentId,\n errorMessage: 'Failed to load suggestions.',\n fallback: NO_SUGGESTIONS,\n select: (data) => data?.agentSuggestions ?? NO_SUGGESTIONS,\n });\n}\n\nexport function useSuggestAgentImprovements(): readonly [\n (agentId: string) => Promise<AgentSuggestionRun>,\n MutationState<AgentSuggestionRun>,\n] {\n return useWorkspaceMutation<\n { suggestAgentImprovements?: AgentSuggestionRun },\n string,\n AgentSuggestionRun\n >({\n document: SUGGEST_DOCUMENT,\n variables: (agentId) => ({ agentId }),\n select: (data) => data?.suggestAgentImprovements,\n errorMessage: 'Failed to generate suggestions.',\n });\n}\n\nexport function useAcceptAgentSuggestion(): readonly [\n (id: string) => Promise<{ draftChanged: boolean; suggestion: AgentSuggestion }>,\n MutationState<{ draftChanged: boolean; suggestion: AgentSuggestion }>,\n] {\n return useWorkspaceMutation<\n { acceptAgentSuggestion?: { draftChanged: boolean; suggestion: AgentSuggestion } },\n string,\n { draftChanged: boolean; suggestion: AgentSuggestion }\n >({\n document: ACCEPT_DOCUMENT,\n variables: (id) => ({ id }),\n select: (data) => data?.acceptAgentSuggestion,\n errorMessage: 'Failed to accept the suggestion.',\n });\n}\n\nexport function useDismissAgentSuggestion(): readonly [\n (id: string) => Promise<AgentSuggestion>,\n MutationState<AgentSuggestion>,\n] {\n return useWorkspaceMutation<\n { dismissAgentSuggestion?: AgentSuggestion },\n string,\n AgentSuggestion\n >({\n document: DISMISS_DOCUMENT,\n variables: (id) => ({ id }),\n select: (data) => data?.dismissAgentSuggestion,\n errorMessage: 'Failed to dismiss the suggestion.',\n });\n}\n\nexport type ExecutionFeedbackRating = 'GOOD' | 'POOR' | 'CLEAR';\n\nexport interface ExecutionFeedback {\n id: string;\n feedbackRating: number | null;\n feedbackAt: string | null;\n}\n\nexport function useRateExecution(): readonly [\n (input: { id: string; rating: ExecutionFeedbackRating }) => Promise<ExecutionFeedback>,\n MutationState<ExecutionFeedback>,\n] {\n return useWorkspaceMutation<\n { rateExecution?: ExecutionFeedback },\n { id: string; rating: ExecutionFeedbackRating },\n ExecutionFeedback\n >({\n document: RATE_DOCUMENT,\n variables: (input) => ({ id: input.id, rating: input.rating }),\n select: (data) => data?.rateExecution,\n errorMessage: 'Failed to save the rating.',\n });\n}\n\nexport interface KnowledgeReviewSchedule {\n id: string;\n refreshIntervalDays: number | null;\n lastReviewedAt: string | null;\n}\n\nexport function useKnowledgeReviewSchedule(\n knowledgeBaseId: string | undefined\n): QueryResult<KnowledgeReviewSchedule | undefined> {\n const workspaceId = useWorkspaceId();\n const variables = useMemo(\n () => (knowledgeBaseId ? { id: knowledgeBaseId } : undefined),\n [knowledgeBaseId]\n );\n return useWorkspaceQuery<\n { getKnowledgeBase?: KnowledgeReviewSchedule | null },\n KnowledgeReviewSchedule | undefined\n >({\n document: REVIEW_SCHEDULE_DOCUMENT,\n variables,\n enabled: !!workspaceId && !!knowledgeBaseId,\n errorMessage: 'Failed to load the review schedule.',\n fallback: undefined,\n select: (data) => data?.getKnowledgeBase ?? undefined,\n });\n}\n\nexport function useSetKnowledgeRefreshInterval(): readonly [\n (input: { id: string; days: number | null }) => Promise<KnowledgeReviewSchedule>,\n MutationState<KnowledgeReviewSchedule>,\n] {\n return useWorkspaceMutation<\n { setKnowledgeBaseRefreshInterval?: KnowledgeReviewSchedule },\n { id: string; days: number | null },\n KnowledgeReviewSchedule\n >({\n document: REFRESH_INTERVAL_DOCUMENT,\n variables: (input) => ({ id: input.id, days: input.days }),\n select: (data) => data?.setKnowledgeBaseRefreshInterval,\n errorMessage: 'Failed to save the review interval.',\n });\n}\n\nexport function useMarkKnowledgeReviewed(): readonly [\n (id: string) => Promise<KnowledgeReviewSchedule>,\n MutationState<KnowledgeReviewSchedule>,\n] {\n return useWorkspaceMutation<\n { markKnowledgeBaseReviewed?: KnowledgeReviewSchedule },\n string,\n KnowledgeReviewSchedule\n >({\n document: MARK_REVIEWED_DOCUMENT,\n variables: (id) => ({ id }),\n select: (data) => data?.markKnowledgeBaseReviewed,\n errorMessage: 'Failed to mark the knowledge base reviewed.',\n });\n}\n\nconst EXECUTION_FEEDBACK_DOCUMENT = gql`\n query BotmanorExecutionFeedback($id: ID!) {\n getExecution(id: $id) {\n id\n feedbackRating\n feedbackAt\n }\n }\n`;\n\n/** The reviewer rating recorded on a run. */\nexport function useExecutionFeedback(\n executionId: string | undefined\n): QueryResult<ExecutionFeedback | undefined> {\n const workspaceId = useWorkspaceId();\n const variables = useMemo(() => (executionId ? { id: executionId } : undefined), [executionId]);\n return useWorkspaceQuery<\n { getExecution?: ExecutionFeedback | null },\n ExecutionFeedback | undefined\n >({\n document: EXECUTION_FEEDBACK_DOCUMENT,\n variables,\n enabled: !!workspaceId && !!executionId,\n errorMessage: 'Failed to load the rating.',\n fallback: undefined,\n select: (data) => data?.getExecution ?? undefined,\n });\n}\n"],"mappings":";;;;AA4DA,IAAMA,IAAoB,oSA0BpBC,IAAgB,CAAG;;;QAGjBD,EAAkB;;;GAKpBE,IAAmB,CAAG;;;;;;;;;UASlBF,EAAkB;;;;GAMtBG,IAAkB,CAAG;;;;;UAKjBH,EAAkB;;;;GAMtBI,IAAmB,CAAG;;;QAGpBJ,EAAkB;;;GAKpBK,IAAgB,CAAG;;;;;;;;GAUnBC,IAA4B,CAAG;;;;;;;;GAU/BC,IAAyB,CAAG;;;;;;;;GAU5BC,IAA2B,CAAG;;;;;;;;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b;EACV,YAAY,OAAW;GAAE,IAAIiB,EAAM;GAAI,MAAMA,EAAM;EAAK;EACxD,SAAS,MAASN,GAAM;EACxB,cAAc;CAChB,CAAC;AACH;AAEA,SAAgBU,IAGd;CACA,OAAOR,EAIL;EACA,UAAUZ;EACV,YAAY,OAAQ,EAAE,MAAG;EACzB,SAAS,MAASU,GAAM;EACxB,cAAc;CAChB,CAAC;AACH;AAEA,IAAMW,IAA8B,CAAG;;;;;;;;;AAWvC,SAAgBC,EACd,GAC4C;CAC5C,IAAMlB,IAAcC,EAAe,GAC7BC,IAAYC,QAAegB,IAAc,EAAE,IAAIA,EAAY,IAAI,KAAA,GAAY,CAACA,CAAW,CAAC;CAC9F,OAAOd,EAGL;EACA,UAAUY;EACV;EACA,SAAS,CAAC,CAACjB,KAAe,CAAC,CAACmB;EAC5B,cAAc;EACd,UAAU,KAAA;EACV,SAAS,MAASb,GAAM,gBAAgB,KAAA;CAC1C,CAAC;AACH"}
|
|
@@ -24,7 +24,7 @@ function p(e) {
|
|
|
24
24
|
enabled: !!t,
|
|
25
25
|
errorMessage: "Failed to load AI operations findings.",
|
|
26
26
|
fallback: d,
|
|
27
|
-
select: (e) => (e?.aiPredictions.items ?? []).map((e) => ({
|
|
27
|
+
select: (e) => (e?.aiPredictions.items ?? []).filter((e) => !e.predictionType.startsWith("agent_tuning.")).map((e) => ({
|
|
28
28
|
id: e.id,
|
|
29
29
|
predictionType: e.predictionType,
|
|
30
30
|
subjectType: e.subjectType ?? null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAiOperations.js","names":["LIST_LIMIT","NO_PREDICTIONS","NO_RUNS","useAiPredictions","workspaceId","useWorkspaceId","filter","variables","useMemo","gqlFilter","subjectType","subjectId","status","useWorkspaceQuery","ListAiPredictionsDocument","data","item","useSetAiPredictionStatus","useWorkspaceMutation","SetAiPredictionStatusDocument","input","row","useSupervisorConfig","GetSupervisorConfigDocument","config","useConfigureSupervisor","ConfigureSupervisorDocument","useRunSupervisorNow","RunSupervisorNowDocument","result","run","useSupervisorRuns","ListSupervisorRunsDocument","predictionSeverity","severity","record","\"severity\"","predictionSubjectName","name","\"subjectName\""],"sources":["../../../src/botlit/hooks/useAiOperations.ts"],"sourcesContent":["/**\n * AI Operations hooks (BOFF-3839)\n * @module botlit/hooks\n *\n * Backed by the supervisor surface on wspace-botmanor-svc: the AiPrediction\n * feed (findings as decision cards), the supervisor configuration, run-now\n * and the run history. Read conventions come from `useExecutions`\n * (network-only, explicit error state, caller-driven refetch).\n */\n\nimport { useMemo } from 'react';\nimport {\n ConfigureSupervisorDocument,\n GetSupervisorConfigDocument,\n ListAiPredictionsDocument,\n ListSupervisorRunsDocument,\n RunSupervisorNowDocument,\n SetAiPredictionStatusDocument,\n type ConfigureSupervisorMutation,\n type ConfigureSupervisorMutationVariables,\n type GetSupervisorConfigQuery,\n type ListAiPredictionsQuery,\n type ListSupervisorRunsQuery,\n type RunSupervisorNowMutation,\n type SetAiPredictionStatusMutation,\n type SetAiPredictionStatusMutationVariables,\n} from '../../generated/wspace-operations';\nimport type {\n AiPredictionFilterInput,\n AiPredictionStatus,\n ConfigureSupervisorInput,\n} from '../../generated/wspace-types';\nimport {\n useWorkspaceId,\n useWorkspaceMutation,\n useWorkspaceQuery,\n type QueryResult,\n} from './internal/workspaceGateway';\n\nconst LIST_LIMIT = 50;\n\nexport interface AiPredictionRecord {\n id: string;\n predictionType: string;\n subjectType: string | null;\n subjectId: string | null;\n score: number;\n confidence: number;\n recommendation: string;\n status: string;\n features: Record<string, unknown> | null;\n /** Supervisor metadata: fingerprint, severity, subjectName, runId. */\n metadata: Record<string, unknown> | null;\n generatedAt: string;\n}\n\nexport interface AiPredictionsFilter {\n subjectType?: string;\n subjectId?: string;\n status?: string;\n}\n\nexport interface SupervisorConfigRecord {\n enabled: boolean;\n cron: string;\n timezone: string;\n lastRunAt: string | null;\n updatedAt: string;\n}\n\nexport interface SupervisorRunRecord {\n id: string;\n trigger: string;\n status: string;\n findings: number;\n notified: number;\n error: string | null;\n startedAt: string;\n completedAt: string | null;\n}\n\nconst NO_PREDICTIONS: AiPredictionRecord[] = [];\nconst NO_RUNS: SupervisorRunRecord[] = [];\n\nexport const aiOperationsKeys = {\n all: ['ai-operations'] as const,\n predictions: (filter?: AiPredictionsFilter) =>\n [...aiOperationsKeys.all, 'predictions', filter] as const,\n config: () => [...aiOperationsKeys.all, 'config'] as const,\n runs: () => [...aiOperationsKeys.all, 'runs'] as const,\n};\n\n/** Decision-card feed, optionally narrowed to one subject (agent/app/KB). */\nexport function useAiPredictions(filter?: AiPredictionsFilter): QueryResult<AiPredictionRecord[]> {\n const workspaceId = useWorkspaceId();\n const { subjectType, subjectId, status } = filter ?? {};\n\n const variables = useMemo(() => {\n const gqlFilter: AiPredictionFilterInput = { sourceProduct: 'botmanor' };\n if (subjectType) gqlFilter.subjectType = subjectType;\n if (subjectId) gqlFilter.subjectId = subjectId;\n if (status) gqlFilter.status = status as AiPredictionStatus;\n return { filter: gqlFilter, pagination: { limit: LIST_LIMIT, offset: 0 } };\n }, [subjectType, subjectId, status]);\n\n return useWorkspaceQuery<ListAiPredictionsQuery, AiPredictionRecord[]>({\n document: ListAiPredictionsDocument,\n variables,\n enabled: !!workspaceId,\n errorMessage: 'Failed to load AI operations findings.',\n fallback: NO_PREDICTIONS,\n select: (data) =>\n (data?.aiPredictions.items ?? []).map((item) => ({\n id: item.id,\n predictionType: item.predictionType,\n subjectType: item.subjectType ?? null,\n subjectId: item.subjectId ?? null,\n score: item.score,\n confidence: item.confidence,\n recommendation: item.recommendation,\n status: item.status,\n features: (item.features ?? null) as Record<string, unknown> | null,\n metadata: (item.metadata ?? null) as Record<string, unknown> | null,\n generatedAt: item.generatedAt,\n })),\n });\n}\n\n/** Accept / dismiss one finding. Callers refetch the feed afterwards. */\nexport function useSetAiPredictionStatus(): readonly [\n (input: { id: string; status: AiPredictionStatus }) => Promise<{ id: string; status: string }>,\n { data: { id: string; status: string } | undefined; loading: boolean; error: Error | undefined },\n] {\n return useWorkspaceMutation<\n SetAiPredictionStatusMutation,\n { id: string; status: AiPredictionStatus },\n { id: string; status: string }\n >({\n document: SetAiPredictionStatusDocument,\n variables: (input) =>\n ({ id: input.id, status: input.status }) as SetAiPredictionStatusMutationVariables,\n select: (data) => {\n const row = data?.setAiPredictionStatus;\n return row ? { id: row.id, status: row.status } : undefined;\n },\n errorMessage: 'Failed to update the finding.',\n });\n}\n\nexport function useSupervisorConfig(): QueryResult<SupervisorConfigRecord | undefined> {\n const workspaceId = useWorkspaceId();\n return useWorkspaceQuery<GetSupervisorConfigQuery, SupervisorConfigRecord | undefined>({\n document: GetSupervisorConfigDocument,\n variables: {},\n enabled: !!workspaceId,\n errorMessage: 'Failed to load the supervisor configuration.',\n fallback: undefined,\n select: (data) => {\n const config = data?.supervisorConfig;\n if (!config) return undefined;\n return {\n enabled: config.enabled,\n cron: config.cron,\n timezone: config.timezone,\n lastRunAt: config.lastRunAt ?? null,\n updatedAt: config.updatedAt,\n };\n },\n });\n}\n\nexport function useConfigureSupervisor(): readonly [\n (input: {\n enabled?: boolean;\n cron?: string;\n timezone?: string;\n }) => Promise<SupervisorConfigRecord>,\n { data: SupervisorConfigRecord | undefined; loading: boolean; error: Error | undefined },\n] {\n return useWorkspaceMutation<\n ConfigureSupervisorMutation,\n ConfigureSupervisorInput,\n SupervisorConfigRecord\n >({\n document: ConfigureSupervisorDocument,\n variables: (input) => ({ input }) as ConfigureSupervisorMutationVariables,\n select: (data) => {\n const config = data?.configureSupervisor;\n if (!config) return undefined;\n return {\n enabled: config.enabled,\n cron: config.cron,\n timezone: config.timezone,\n lastRunAt: config.lastRunAt ?? null,\n updatedAt: config.updatedAt,\n };\n },\n errorMessage: 'Failed to save the supervisor configuration.',\n });\n}\n\nexport interface RunSupervisorNowResult {\n run: SupervisorRunRecord | null;\n findings: number;\n}\n\n/** Manual fleet review (the scheduled path is the FluidGrids cron tick). */\nexport function useRunSupervisorNow(): readonly [\n () => Promise<RunSupervisorNowResult>,\n { data: RunSupervisorNowResult | undefined; loading: boolean; error: Error | undefined },\n] {\n return useWorkspaceMutation<RunSupervisorNowMutation, void, RunSupervisorNowResult>({\n document: RunSupervisorNowDocument,\n variables: () => ({}),\n select: (data) => {\n const result = data?.runSupervisorNow;\n if (!result) return undefined;\n const run = result.run;\n return {\n findings: result.findings,\n run: run\n ? {\n id: run.id,\n trigger: run.trigger,\n status: run.status,\n findings: run.findings,\n notified: run.notified,\n error: run.error ?? null,\n startedAt: run.startedAt,\n completedAt: run.completedAt ?? null,\n }\n : null,\n };\n },\n errorMessage: 'Failed to run the supervisor review.',\n });\n}\n\nexport function useSupervisorRuns(): QueryResult<SupervisorRunRecord[]> {\n const workspaceId = useWorkspaceId();\n return useWorkspaceQuery<ListSupervisorRunsQuery, SupervisorRunRecord[]>({\n document: ListSupervisorRunsDocument,\n variables: { pagination: { limit: 20, offset: 0 } },\n enabled: !!workspaceId,\n errorMessage: 'Failed to load the supervisor run history.',\n fallback: NO_RUNS,\n select: (data) =>\n (data?.supervisorRuns.items ?? []).map((run) => ({\n id: run.id,\n trigger: run.trigger,\n status: run.status,\n findings: run.findings,\n notified: run.notified,\n error: run.error ?? null,\n startedAt: run.startedAt,\n completedAt: run.completedAt ?? null,\n })),\n });\n}\n\n/** Severity from supervisor metadata (WARNING/CRITICAL/INFO), defaulting to INFO. */\nexport function predictionSeverity(record: AiPredictionRecord): string {\n const severity = record.metadata?.['severity'];\n return typeof severity === 'string' ? severity : 'INFO';\n}\n\n/** Human name the supervisor recorded for the subject, when present. */\nexport function predictionSubjectName(record: AiPredictionRecord): string {\n const name = record.metadata?.['subjectName'];\n if (typeof name === 'string' && name.length > 0) return name;\n return record.subjectId ?? record.predictionType;\n}\n"],"mappings":";;;;AAuCA,IAAMA,IAAa,IA0CbC,IAAuC,CAAC,GACxCC,IAAiC,CAAC;AAWxC,SAAgBC,EAAiB,GAAiE;CAChG,IAAMC,IAAcC,EAAe,GAC7B,EAAE,gBAAa,cAAW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AC;AACH;AAGA,SAAgBG,EAAmB,GAAoC;CACrE,IAAMC,IAAWC,EAAO,UAAWC;CACnC,OAAO,OAAOF,KAAa,WAAWA,IAAW;AACnD;AAGA,SAAgBG,EAAsB,GAAoC;CACxE,IAAMC,IAAOH,EAAO,UAAWI;CAE/B,OADI,OAAOD,KAAS,YAAYA,EAAK,SAAS,IAAUA,IACjDH,EAAO,aAAaA,EAAO;AACpC"}
|
|
1
|
+
{"version":3,"file":"useAiOperations.js","names":["LIST_LIMIT","NO_PREDICTIONS","NO_RUNS","useAiPredictions","workspaceId","useWorkspaceId","filter","variables","useMemo","gqlFilter","subjectType","subjectId","status","useWorkspaceQuery","ListAiPredictionsDocument","data","item","useSetAiPredictionStatus","useWorkspaceMutation","SetAiPredictionStatusDocument","input","row","useSupervisorConfig","GetSupervisorConfigDocument","config","useConfigureSupervisor","ConfigureSupervisorDocument","useRunSupervisorNow","RunSupervisorNowDocument","result","run","useSupervisorRuns","ListSupervisorRunsDocument","predictionSeverity","severity","record","\"severity\"","predictionSubjectName","name","\"subjectName\""],"sources":["../../../src/botlit/hooks/useAiOperations.ts"],"sourcesContent":["/**\n * AI Operations hooks (BOFF-3839)\n * @module botlit/hooks\n *\n * Backed by the supervisor surface on wspace-botmanor-svc: the AiPrediction\n * feed (findings as decision cards), the supervisor configuration, run-now\n * and the run history. Read conventions come from `useExecutions`\n * (network-only, explicit error state, caller-driven refetch).\n */\n\nimport { useMemo } from 'react';\nimport {\n ConfigureSupervisorDocument,\n GetSupervisorConfigDocument,\n ListAiPredictionsDocument,\n ListSupervisorRunsDocument,\n RunSupervisorNowDocument,\n SetAiPredictionStatusDocument,\n type ConfigureSupervisorMutation,\n type ConfigureSupervisorMutationVariables,\n type GetSupervisorConfigQuery,\n type ListAiPredictionsQuery,\n type ListSupervisorRunsQuery,\n type RunSupervisorNowMutation,\n type SetAiPredictionStatusMutation,\n type SetAiPredictionStatusMutationVariables,\n} from '../../generated/wspace-operations';\nimport type {\n AiPredictionFilterInput,\n AiPredictionStatus,\n ConfigureSupervisorInput,\n} from '../../generated/wspace-types';\nimport {\n useWorkspaceId,\n useWorkspaceMutation,\n useWorkspaceQuery,\n type QueryResult,\n} from './internal/workspaceGateway';\n\nconst LIST_LIMIT = 50;\n\nexport interface AiPredictionRecord {\n id: string;\n predictionType: string;\n subjectType: string | null;\n subjectId: string | null;\n score: number;\n confidence: number;\n recommendation: string;\n status: string;\n features: Record<string, unknown> | null;\n /** Supervisor metadata: fingerprint, severity, subjectName, runId. */\n metadata: Record<string, unknown> | null;\n generatedAt: string;\n}\n\nexport interface AiPredictionsFilter {\n subjectType?: string;\n subjectId?: string;\n status?: string;\n}\n\nexport interface SupervisorConfigRecord {\n enabled: boolean;\n cron: string;\n timezone: string;\n lastRunAt: string | null;\n updatedAt: string;\n}\n\nexport interface SupervisorRunRecord {\n id: string;\n trigger: string;\n status: string;\n findings: number;\n notified: number;\n error: string | null;\n startedAt: string;\n completedAt: string | null;\n}\n\nconst NO_PREDICTIONS: AiPredictionRecord[] = [];\nconst NO_RUNS: SupervisorRunRecord[] = [];\n\nexport const aiOperationsKeys = {\n all: ['ai-operations'] as const,\n predictions: (filter?: AiPredictionsFilter) =>\n [...aiOperationsKeys.all, 'predictions', filter] as const,\n config: () => [...aiOperationsKeys.all, 'config'] as const,\n runs: () => [...aiOperationsKeys.all, 'runs'] as const,\n};\n\n/** Decision-card feed, optionally narrowed to one subject (agent/app/KB). */\nexport function useAiPredictions(filter?: AiPredictionsFilter): QueryResult<AiPredictionRecord[]> {\n const workspaceId = useWorkspaceId();\n const { subjectType, subjectId, status } = filter ?? {};\n\n const variables = useMemo(() => {\n const gqlFilter: AiPredictionFilterInput = { sourceProduct: 'botmanor' };\n if (subjectType) gqlFilter.subjectType = subjectType;\n if (subjectId) gqlFilter.subjectId = subjectId;\n if (status) gqlFilter.status = status as AiPredictionStatus;\n return { filter: gqlFilter, pagination: { limit: LIST_LIMIT, offset: 0 } };\n }, [subjectType, subjectId, status]);\n\n return useWorkspaceQuery<ListAiPredictionsQuery, AiPredictionRecord[]>({\n document: ListAiPredictionsDocument,\n variables,\n enabled: !!workspaceId,\n errorMessage: 'Failed to load AI operations findings.',\n fallback: NO_PREDICTIONS,\n select: (data) =>\n (data?.aiPredictions.items ?? [])\n // BOFF-15360: agent tuning suggestions have their own panel and accept\n // path (acceptAgentSuggestion); they are not supervisor findings.\n .filter((item) => !item.predictionType.startsWith('agent_tuning.'))\n .map((item) => ({\n id: item.id,\n predictionType: item.predictionType,\n subjectType: item.subjectType ?? null,\n subjectId: item.subjectId ?? null,\n score: item.score,\n confidence: item.confidence,\n recommendation: item.recommendation,\n status: item.status,\n features: (item.features ?? null) as Record<string, unknown> | null,\n metadata: (item.metadata ?? null) as Record<string, unknown> | null,\n generatedAt: item.generatedAt,\n })),\n });\n}\n\n/** Accept / dismiss one finding. Callers refetch the feed afterwards. */\nexport function useSetAiPredictionStatus(): readonly [\n (input: { id: string; status: AiPredictionStatus }) => Promise<{ id: string; status: string }>,\n { data: { id: string; status: string } | undefined; loading: boolean; error: Error | undefined },\n] {\n return useWorkspaceMutation<\n SetAiPredictionStatusMutation,\n { id: string; status: AiPredictionStatus },\n { id: string; status: string }\n >({\n document: SetAiPredictionStatusDocument,\n variables: (input) =>\n ({ id: input.id, status: input.status }) as SetAiPredictionStatusMutationVariables,\n select: (data) => {\n const row = data?.setAiPredictionStatus;\n return row ? { id: row.id, status: row.status } : undefined;\n },\n errorMessage: 'Failed to update the finding.',\n });\n}\n\nexport function useSupervisorConfig(): QueryResult<SupervisorConfigRecord | undefined> {\n const workspaceId = useWorkspaceId();\n return useWorkspaceQuery<GetSupervisorConfigQuery, SupervisorConfigRecord | undefined>({\n document: GetSupervisorConfigDocument,\n variables: {},\n enabled: !!workspaceId,\n errorMessage: 'Failed to load the supervisor configuration.',\n fallback: undefined,\n select: (data) => {\n const config = data?.supervisorConfig;\n if (!config) return undefined;\n return {\n enabled: config.enabled,\n cron: config.cron,\n timezone: config.timezone,\n lastRunAt: config.lastRunAt ?? null,\n updatedAt: config.updatedAt,\n };\n },\n });\n}\n\nexport function useConfigureSupervisor(): readonly [\n (input: {\n enabled?: boolean;\n cron?: string;\n timezone?: string;\n }) => Promise<SupervisorConfigRecord>,\n { data: SupervisorConfigRecord | undefined; loading: boolean; error: Error | undefined },\n] {\n return useWorkspaceMutation<\n ConfigureSupervisorMutation,\n ConfigureSupervisorInput,\n SupervisorConfigRecord\n >({\n document: ConfigureSupervisorDocument,\n variables: (input) => ({ input }) as ConfigureSupervisorMutationVariables,\n select: (data) => {\n const config = data?.configureSupervisor;\n if (!config) return undefined;\n return {\n enabled: config.enabled,\n cron: config.cron,\n timezone: config.timezone,\n lastRunAt: config.lastRunAt ?? null,\n updatedAt: config.updatedAt,\n };\n },\n errorMessage: 'Failed to save the supervisor configuration.',\n });\n}\n\nexport interface RunSupervisorNowResult {\n run: SupervisorRunRecord | null;\n findings: number;\n}\n\n/** Manual fleet review (the scheduled path is the FluidGrids cron tick). */\nexport function useRunSupervisorNow(): readonly [\n () => Promise<RunSupervisorNowResult>,\n { data: RunSupervisorNowResult | undefined; loading: boolean; error: Error | undefined },\n] {\n return useWorkspaceMutation<RunSupervisorNowMutation, void, RunSupervisorNowResult>({\n document: RunSupervisorNowDocument,\n variables: () => ({}),\n select: (data) => {\n const result = data?.runSupervisorNow;\n if (!result) return undefined;\n const run = result.run;\n return {\n findings: result.findings,\n run: run\n ? {\n id: run.id,\n trigger: run.trigger,\n status: run.status,\n findings: run.findings,\n notified: run.notified,\n error: run.error ?? null,\n startedAt: run.startedAt,\n completedAt: run.completedAt ?? null,\n }\n : null,\n };\n },\n errorMessage: 'Failed to run the supervisor review.',\n });\n}\n\nexport function useSupervisorRuns(): QueryResult<SupervisorRunRecord[]> {\n const workspaceId = useWorkspaceId();\n return useWorkspaceQuery<ListSupervisorRunsQuery, SupervisorRunRecord[]>({\n document: ListSupervisorRunsDocument,\n variables: { pagination: { limit: 20, offset: 0 } },\n enabled: !!workspaceId,\n errorMessage: 'Failed to load the supervisor run history.',\n fallback: NO_RUNS,\n select: (data) =>\n (data?.supervisorRuns.items ?? []).map((run) => ({\n id: run.id,\n trigger: run.trigger,\n status: run.status,\n findings: run.findings,\n notified: run.notified,\n error: run.error ?? null,\n startedAt: run.startedAt,\n completedAt: run.completedAt ?? null,\n })),\n });\n}\n\n/** Severity from supervisor metadata (WARNING/CRITICAL/INFO), defaulting to INFO. */\nexport function predictionSeverity(record: AiPredictionRecord): string {\n const severity = record.metadata?.['severity'];\n return typeof severity === 'string' ? severity : 'INFO';\n}\n\n/** Human name the supervisor recorded for the subject, when present. */\nexport function predictionSubjectName(record: AiPredictionRecord): string {\n const name = record.metadata?.['subjectName'];\n if (typeof name === 'string' && name.length > 0) return name;\n return record.subjectId ?? record.predictionType;\n}\n"],"mappings":";;;;AAuCA,IAAMA,IAAa,IA0CbC,IAAuC,CAAC,GACxCC,IAAiC,CAAC;AAWxC,SAAgBC,EAAiB,GAAiE;CAChG,IAAMC,IAAcC,EAAe,GAC7B,EAAE,gBAAa,cAAW,cAAWC,KAAU,CAAC,GAEhDC,IAAYC,QAAc;EAC9B,IAAMC,IAAqC,EAAE,eAAe,WAAW;EAIvE,OAHIC,MAAa,EAAU,cAAcA,IACrCC,MAAW,EAAU,YAAYA,IACjCC,MAAQ,EAAU,SAASA,IACxB;GAAE,QAAQH;GAAW,YAAY;IAAE,OAAOT;IAAY,QAAQ;GAAE;EAAE;CAC3E,GAAG;EAACU;EAAaC;EAAWC;CAAM,CAAC;CAEnC,OAAOC,EAAgE;EACrE,UAAUC;EACV;EACA,SAAS,CAAC,CAACV;EACX,cAAc;EACd,UAAUH;EACV,SAAS,OACNc,GAAM,cAAc,SAAS,CAAC,EAAA,CAG5B,QAAQ,MAAS,CAACC,EAAK,eAAe,WAAW,eAAe,CAAC,CAAC,CAClE,KAAK,OAAU;GACd,IAAIA,EAAK;GACT,gBAAgBA,EAAK;GACrB,aAAaA,EAAK,eAAe;GACjC,WAAWA,EA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b,IAAMC,IAAMD,EAAO;GACnB,OAAO;IACL,UAAUA,EAAO;IACjB,KAAKC,IACD;KACE,IAAIA,EAAI;KACR,SAASA,EAAI;KACb,QAAQA,EAAI;KACZ,UAAUA,EAAI;KACd,UAAUA,EAAI;KACd,OAAOA,EAAI,SAAS;KACpB,WAAWA,EAAI;KACf,aAAaA,EAAI,eAAe;IAClC,IACA;GACN;EACF;EACA,cAAc;CAChB,CAAC;AACH;AAEA,SAAgBC,IAAwD;CACtE,IAAM3B,IAAcC,EAAe;CACnC,OAAOQ,EAAkE;EACvE,UAAUmB;EACV,WAAW,EAAE,YAAY;GAAE,OAAO;GAAI,QAAQ;EAAE,EAAE;EAClD,SAAS,CAAC,CAAC5B;EACX,cAAc;EACd,UAAUF;EACV,SAAS,OACNa,GAAM,eAAe,SAAS,CAAC,EAAA,CAAG,KAAK,OAAS;GAC/C,IAAIe,EAAI;GACR,SAASA,EAAI;GACb,QAAQA,EAAI;GACZ,UAAUA,EAAI;GACd,UAAUA,EAAI;GACd,OAAOA,EAAI,SAAS;GACpB,WAAWA,EAAI;GACf,aAAaA,EAAI,eAAe;EAClC,EAAE;CACN,CAAC;AACH;AAGA,SAAgBG,EAAmB,GAAoC;CACrE,IAAMC,IAAWC,EAAO,UAAWC;CACnC,OAAO,OAAOF,KAAa,WAAWA,IAAW;AACnD;AAGA,SAAgBG,EAAsB,GAAoC;CACxE,IAAMC,IAAOH,EAAO,UAAWI;CAE/B,OADI,OAAOD,KAAS,YAAYA,EAAK,SAAS,IAAUA,IACjDH,EAAO,aAAaA,EAAO;AACpC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateExecutionInput, ExecutionStatus } from '../../generated/wspace-types';
|
|
1
|
+
import { CreateExecutionInput, ExecutionStatus, ExecutionType } from '../../generated/wspace-types';
|
|
2
2
|
import { GraphQLInput } from './internal/mutationInput';
|
|
3
3
|
import { PaginatedQueryResult, QueryResult } from './internal/workspaceGateway';
|
|
4
4
|
export interface ExecutionRecord {
|
|
@@ -9,6 +9,9 @@ export interface ExecutionRecord {
|
|
|
9
9
|
output?: string | null;
|
|
10
10
|
agentId?: string | null;
|
|
11
11
|
appId?: string | null;
|
|
12
|
+
/** BOFF-12619 — display names; null when the agent or bot no longer exists. */
|
|
13
|
+
agentName?: string | null;
|
|
14
|
+
appName?: string | null;
|
|
12
15
|
conversationId?: string | null;
|
|
13
16
|
cost?: number | null;
|
|
14
17
|
duration?: number | null;
|
|
@@ -20,6 +23,8 @@ export interface ExecutionRecord {
|
|
|
20
23
|
completedAt?: string | null;
|
|
21
24
|
createdAt: string;
|
|
22
25
|
workspaceId: string;
|
|
26
|
+
/** BOFF-12620 — token split and cost recorded when the run finished. */
|
|
27
|
+
metrics?: ExecutionMetricsRecord | null;
|
|
23
28
|
}
|
|
24
29
|
export interface ExecutionMetricsRecord {
|
|
25
30
|
executionId: string;
|
|
@@ -32,11 +37,28 @@ export interface ExecutionMetricsRecord {
|
|
|
32
37
|
}
|
|
33
38
|
export interface ExecutionsFilter {
|
|
34
39
|
search?: string;
|
|
35
|
-
status?:
|
|
40
|
+
status?: ExecutionStatus[];
|
|
36
41
|
agentId?: string;
|
|
37
42
|
appId?: string;
|
|
38
43
|
conversationId?: string;
|
|
39
|
-
type?:
|
|
44
|
+
type?: ExecutionType;
|
|
45
|
+
/** ISO timestamp — runs created at or after it. */
|
|
46
|
+
startDate?: string;
|
|
47
|
+
/** ISO timestamp — runs created at or before it. */
|
|
48
|
+
endDate?: string;
|
|
49
|
+
}
|
|
50
|
+
/** Totals over every run matching a filter (`getExecutionSummary`). */
|
|
51
|
+
export interface ExecutionSummaryRecord {
|
|
52
|
+
total: number;
|
|
53
|
+
succeeded: number;
|
|
54
|
+
failed: number;
|
|
55
|
+
inProgress: number;
|
|
56
|
+
avgDurationMs?: number | null;
|
|
57
|
+
timedRuns: number;
|
|
58
|
+
totalTokens: number;
|
|
59
|
+
totalCost?: number | null;
|
|
60
|
+
pricedRuns: number;
|
|
61
|
+
unpricedRuns: number;
|
|
40
62
|
}
|
|
41
63
|
export interface ExecutionMetricsFilter {
|
|
42
64
|
agentId?: string;
|
|
@@ -62,26 +84,16 @@ export declare const executionKeys: {
|
|
|
62
84
|
metrics: () => readonly ["executions", "metrics"];
|
|
63
85
|
};
|
|
64
86
|
export declare function useExecutions(filter?: ExecutionsFilter): PaginatedQueryResult<ExecutionRecord[]>;
|
|
87
|
+
/**
|
|
88
|
+
* Totals over every run matching the same filter as {@link useExecutions}
|
|
89
|
+
* (BOFF-12614) — computed by the service over the whole history.
|
|
90
|
+
*/
|
|
91
|
+
export declare function useExecutionSummary(filter?: ExecutionsFilter): QueryResult<ExecutionSummaryRecord | null>;
|
|
65
92
|
export declare function useExecution(executionId: string | undefined): QueryResult<ExecutionRecord | null>;
|
|
66
93
|
/**
|
|
67
94
|
* Token/cost metrics for the workspace, optionally narrowed to an agent, app or
|
|
68
95
|
* date window. Returns `null` when the service has nothing recorded yet.
|
|
69
96
|
*/
|
|
70
97
|
export declare function useExecutionMetrics(filter?: ExecutionMetricsFilter): QueryResult<ExecutionMetricsRecord | null>;
|
|
71
|
-
export interface ExecutionRollup {
|
|
72
|
-
total: number;
|
|
73
|
-
succeeded: number;
|
|
74
|
-
failed: number;
|
|
75
|
-
successRate: number;
|
|
76
|
-
avgDurationMs: number;
|
|
77
|
-
totalCost: number;
|
|
78
|
-
totalTokens: number;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Rolls a list of executions up into the headline numbers shown above the table.
|
|
82
|
-
* Derived purely from the rows that were actually loaded — no server aggregate
|
|
83
|
-
* exists for this, so callers must label it as such.
|
|
84
|
-
*/
|
|
85
|
-
export declare function summariseExecutions(executions: readonly ExecutionRecord[]): ExecutionRollup;
|
|
86
98
|
export declare function useCreateExecution(): readonly [(input: CreateExecutionVariables) => Promise<ExecutionRecord>, import('./internal/workspaceGateway').MutationState<ExecutionRecord>];
|
|
87
99
|
export declare function useUpdateExecutionStatus(): readonly [(input: UpdateExecutionStatusVariables) => Promise<ExecutionRecord>, import('./internal/workspaceGateway').MutationState<ExecutionRecord>];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { GetExecutionDocument as e,
|
|
2
|
-
import { fieldsOf as
|
|
3
|
-
import { useWorkspaceId as
|
|
4
|
-
import {
|
|
1
|
+
import { GetExecutionDocument as e, GetExecutionSummaryDocument as t, ListExecutionsDocument as n } from "../../generated/wspace-operations.js";
|
|
2
|
+
import { fieldsOf as r } from "./internal/mutationInput.js";
|
|
3
|
+
import { useWorkspaceId as i, useWorkspacePaginatedQuery as a, useWorkspaceQuery as o } from "./internal/workspaceGateway.js";
|
|
4
|
+
import { useMemo as s } from "react";
|
|
5
5
|
// src/botlit/hooks/useExecutions.ts
|
|
6
6
|
var c = 100;
|
|
7
|
-
|
|
7
|
+
r({
|
|
8
8
|
agentId: !0,
|
|
9
9
|
appId: !0,
|
|
10
10
|
conversationId: !0,
|
|
@@ -13,43 +13,49 @@ n({
|
|
|
13
13
|
type: !0,
|
|
14
14
|
workspaceId: !0
|
|
15
15
|
});
|
|
16
|
-
var l =
|
|
17
|
-
function
|
|
18
|
-
|
|
16
|
+
var l = [];
|
|
17
|
+
function u(e, t) {
|
|
18
|
+
let n = t?.search?.trim();
|
|
19
|
+
return {
|
|
20
|
+
workspaceId: e,
|
|
21
|
+
statuses: t?.status && t.status.length > 0 ? t.status : void 0,
|
|
22
|
+
search: n || void 0,
|
|
23
|
+
agentId: t?.agentId || void 0,
|
|
24
|
+
appId: t?.appId || void 0,
|
|
25
|
+
conversationId: t?.conversationId || void 0,
|
|
26
|
+
type: t?.type,
|
|
27
|
+
startDate: t?.startDate || void 0,
|
|
28
|
+
endDate: t?.endDate || void 0
|
|
29
|
+
};
|
|
19
30
|
}
|
|
31
|
+
var d = (e) => e;
|
|
20
32
|
function f(e) {
|
|
21
|
-
let
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
appId: h,
|
|
26
|
-
conversationId: g,
|
|
27
|
-
type: _
|
|
28
|
-
} }), [
|
|
29
|
-
n,
|
|
30
|
-
f,
|
|
31
|
-
m,
|
|
32
|
-
h,
|
|
33
|
-
g,
|
|
34
|
-
_
|
|
35
|
-
]), y = o((e) => {
|
|
36
|
-
let t = p ? new Set(p.split(",")) : void 0, n = t && t.size > 1 ? e.filter((e) => t.has(e.status)) : e;
|
|
37
|
-
return a ? n.filter((e) => d(e, a)) : n;
|
|
38
|
-
}, [a, p]);
|
|
39
|
-
return i({
|
|
40
|
-
document: t,
|
|
41
|
-
variables: v,
|
|
33
|
+
let t = i(), r = JSON.stringify(u(t, e)), o = s(() => ({ filters: JSON.parse(r) }), [r]);
|
|
34
|
+
return a({
|
|
35
|
+
document: n,
|
|
36
|
+
variables: o,
|
|
42
37
|
pageSize: c,
|
|
43
|
-
extractRows: (e) => e?.listExecutions ??
|
|
44
|
-
select:
|
|
45
|
-
fallback:
|
|
46
|
-
enabled: !!
|
|
38
|
+
extractRows: (e) => e?.listExecutions ?? l,
|
|
39
|
+
select: d,
|
|
40
|
+
fallback: l,
|
|
41
|
+
enabled: !!t,
|
|
47
42
|
errorMessage: "Failed to load executions"
|
|
48
43
|
});
|
|
49
44
|
}
|
|
50
|
-
function p(
|
|
45
|
+
function p(e) {
|
|
46
|
+
let n = i(), r = JSON.stringify(u(n, e)), a = s(() => ({ filters: JSON.parse(r) }), [r]);
|
|
47
|
+
return o({
|
|
48
|
+
document: t,
|
|
49
|
+
variables: a,
|
|
50
|
+
select: (e) => e?.getExecutionSummary ?? null,
|
|
51
|
+
fallback: null,
|
|
52
|
+
enabled: !!n,
|
|
53
|
+
errorMessage: "Failed to load the execution summary"
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function m(t) {
|
|
51
57
|
let n = s(() => ({ id: t ?? "" }), [t]);
|
|
52
|
-
return
|
|
58
|
+
return o({
|
|
53
59
|
document: e,
|
|
54
60
|
variables: n,
|
|
55
61
|
select: (e) => e?.getExecution ?? null,
|
|
@@ -58,19 +64,6 @@ function p(t) {
|
|
|
58
64
|
errorMessage: "Failed to load execution"
|
|
59
65
|
});
|
|
60
66
|
}
|
|
61
|
-
|
|
62
|
-
let t = e.length, n = 0, r = 0, i = 0, a = 0, o = 0, s = 0;
|
|
63
|
-
for (let t of e) l.has(t.status) && (n += 1), (t.status === "FAILED" || t.status === "TIMEOUT") && (r += 1), typeof t.duration == "number" && (i += t.duration, a += 1), o += t.cost ?? 0, s += t.tokensUsed ?? 0;
|
|
64
|
-
return {
|
|
65
|
-
total: t,
|
|
66
|
-
succeeded: n,
|
|
67
|
-
failed: r,
|
|
68
|
-
successRate: t > 0 ? n / t : 0,
|
|
69
|
-
avgDurationMs: a > 0 ? i / a : 0,
|
|
70
|
-
totalCost: o,
|
|
71
|
-
totalTokens: s
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
export { m as summariseExecutions, p as useExecution, f as useExecutions };
|
|
67
|
+
export { m as useExecution, p as useExecutionSummary, f as useExecutions };
|
|
75
68
|
|
|
76
69
|
//# sourceMappingURL=useExecutions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExecutions.js","names":["LIST_LIMIT","fieldsOf","SUCCESS_STATUSES","NO_EXECUTIONS","matchesSearch","execution","needle","useExecutions","workspaceId","useWorkspaceId","search","filter","statuses","singleStatus","statusKey","variables","useMemo","agentId","appId","conversationId","type","select","useCallback","wanted","narrowed","rows","row","useWorkspacePaginatedQuery","ListExecutionsDocument","data","useExecution","executionId","useWorkspaceQuery","GetExecutionDocument","summariseExecutions","total","executions","succeeded","failed","durationSum","durationCount","totalCost","totalTokens"],"sources":["../../../src/botlit/hooks/useExecutions.ts"],"sourcesContent":["/**\n * Executions Hooks\n * @module botlit/hooks\n *\n * Backed by the live `listExecutions` / `getExecution` / `getExecutionMetrics`\n * operations plus the `createExecution` / `updateExecutionStatus` mutations on\n * wspace-botlit-svc.\n *\n * Note on filtering: `ExecutionFilterInput` accepts a SINGLE status and has no\n * free-text field, so multi-status selections and search are narrowed on the\n * client over every loaded page (see `loadMore`).\n */\n\nimport { useCallback, useMemo } from 'react';\nimport {\n CreateExecutionDocument,\n GetExecutionDocument,\n GetExecutionMetricsDocument,\n ListExecutionsDocument,\n UpdateExecutionStatusDocument,\n type CreateExecutionMutation,\n type GetExecutionMetricsQuery,\n type GetExecutionQuery,\n type ListExecutionsQuery,\n type UpdateExecutionStatusMutation,\n} from '../../generated/wspace-operations';\nimport type { CreateExecutionInput, ExecutionStatus } from '../../generated/wspace-types';\nimport { buildMutationInput, fieldsOf, type GraphQLInput } from './internal/mutationInput';\nimport {\n useWorkspaceId,\n useWorkspaceMutation,\n useWorkspacePaginatedQuery,\n useWorkspaceQuery,\n type PaginatedQueryResult,\n type QueryResult,\n} from './internal/workspaceGateway';\n\nconst LIST_LIMIT = 100;\n\nexport interface ExecutionRecord {\n id: string;\n status: string;\n type: string;\n input: string;\n output?: string | null;\n agentId?: string | null;\n appId?: string | null;\n conversationId?: string | null;\n cost?: number | null;\n duration?: number | null;\n tokensUsed?: number | null;\n errorCode?: string | null;\n errorMessage?: string | null;\n errorDetails?: Record<string, unknown> | null;\n metadata?: Record<string, unknown> | null;\n completedAt?: string | null;\n createdAt: string;\n workspaceId: string;\n}\n\nexport interface ExecutionMetricsRecord {\n executionId: string;\n cost: number;\n inputTokens: number;\n outputTokens: number;\n totalTokens: number;\n ragChunks: number;\n toolCalls: number;\n}\n\nexport interface ExecutionsFilter {\n search?: string;\n status?: string[];\n agentId?: string;\n appId?: string;\n conversationId?: string;\n type?: string;\n}\n\nexport interface ExecutionMetricsFilter {\n agentId?: string;\n appId?: string;\n startDate?: string;\n endDate?: string;\n}\n\nexport interface CreateExecutionVariables {\n input: GraphQLInput<CreateExecutionInput>;\n}\n\nconst CREATE_EXECUTION_FIELDS = fieldsOf<CreateExecutionInput>({\n agentId: true,\n appId: true,\n conversationId: true,\n input: true,\n metadata: true,\n type: true,\n workspaceId: true,\n});\n\nexport interface UpdateExecutionStatusVariables {\n id: string;\n status: ExecutionStatus;\n output?: string;\n error?: Record<string, unknown>;\n}\n\n/** Terminal statuses that count as a successful run. */\nconst SUCCESS_STATUSES = new Set(['COMPLETED']);\n\nconst NO_EXECUTIONS: ExecutionRecord[] = [];\n\nexport const executionKeys = {\n all: ['executions'] as const,\n lists: () => [...executionKeys.all, 'list'] as const,\n list: (filter?: ExecutionsFilter) => [...executionKeys.lists(), filter] as const,\n details: () => [...executionKeys.all, 'detail'] as const,\n detail: (id: string) => [...executionKeys.details(), id] as const,\n metrics: () => [...executionKeys.all, 'metrics'] as const,\n};\n\nfunction matchesSearch(execution: ExecutionRecord, needle: string): boolean {\n return (\n execution.id.toLowerCase().includes(needle) ||\n (execution.agentId ?? '').toLowerCase().includes(needle) ||\n (execution.appId ?? '').toLowerCase().includes(needle) ||\n execution.input.toLowerCase().includes(needle)\n );\n}\n\nexport function useExecutions(filter?: ExecutionsFilter): PaginatedQueryResult<ExecutionRecord[]> {\n const workspaceId = useWorkspaceId();\n const search = filter?.search?.trim().toLowerCase() ?? '';\n const statuses = filter?.status;\n const singleStatus = statuses?.length === 1 ? statuses[0] : undefined;\n const statusKey = statuses?.join(',') ?? '';\n const { agentId, appId, conversationId, type } = filter ?? {};\n\n const variables = useMemo(\n () => ({\n filters: {\n workspaceId,\n status: singleStatus,\n agentId,\n appId,\n conversationId,\n type,\n },\n }),\n [workspaceId, singleStatus, agentId, appId, conversationId, type]\n );\n\n const select = useCallback(\n (rows: ExecutionRecord[]): ExecutionRecord[] => {\n const wanted = statusKey ? new Set(statusKey.split(',')) : undefined;\n const narrowed =\n // A single status is already applied server-side.\n wanted && wanted.size > 1 ? rows.filter((row) => wanted.has(row.status)) : rows;\n return search ? narrowed.filter((row) => matchesSearch(row, search)) : narrowed;\n },\n [search, statusKey]\n );\n\n return useWorkspacePaginatedQuery<ListExecutionsQuery, ExecutionRecord, ExecutionRecord[]>({\n document: ListExecutionsDocument,\n variables,\n pageSize: LIST_LIMIT,\n extractRows: (data) => data?.listExecutions ?? NO_EXECUTIONS,\n select,\n fallback: NO_EXECUTIONS,\n enabled: Boolean(workspaceId),\n errorMessage: 'Failed to load executions',\n });\n}\n\nexport function useExecution(executionId: string | undefined): QueryResult<ExecutionRecord | null> {\n const variables = useMemo(() => ({ id: executionId ?? '' }), [executionId]);\n\n return useWorkspaceQuery<GetExecutionQuery, ExecutionRecord | null>({\n document: GetExecutionDocument,\n variables,\n select: (data) => data?.getExecution ?? null,\n fallback: null,\n enabled: Boolean(executionId),\n errorMessage: 'Failed to load execution',\n });\n}\n\n/**\n * Token/cost metrics for the workspace, optionally narrowed to an agent, app or\n * date window. Returns `null` when the service has nothing recorded yet.\n */\nexport function useExecutionMetrics(\n filter?: ExecutionMetricsFilter\n): QueryResult<ExecutionMetricsRecord | null> {\n const workspaceId = useWorkspaceId();\n const { agentId, appId, startDate, endDate } = filter ?? {};\n\n const variables = useMemo(\n () => ({ filter: { workspaceId, agentId, appId, startDate, endDate } }),\n [workspaceId, agentId, appId, startDate, endDate]\n );\n\n return useWorkspaceQuery<GetExecutionMetricsQuery, ExecutionMetricsRecord | null>({\n document: GetExecutionMetricsDocument,\n variables,\n select: (data) => data?.getExecutionMetrics ?? null,\n fallback: null,\n enabled: Boolean(workspaceId),\n errorMessage: 'Failed to load execution metrics',\n });\n}\n\nexport interface ExecutionRollup {\n total: number;\n succeeded: number;\n failed: number;\n successRate: number;\n avgDurationMs: number;\n totalCost: number;\n totalTokens: number;\n}\n\n/**\n * Rolls a list of executions up into the headline numbers shown above the table.\n * Derived purely from the rows that were actually loaded — no server aggregate\n * exists for this, so callers must label it as such.\n */\nexport function summariseExecutions(executions: readonly ExecutionRecord[]): ExecutionRollup {\n const total = executions.length;\n let succeeded = 0;\n let failed = 0;\n let durationSum = 0;\n let durationCount = 0;\n let totalCost = 0;\n let totalTokens = 0;\n\n for (const execution of executions) {\n if (SUCCESS_STATUSES.has(execution.status)) succeeded += 1;\n if (execution.status === 'FAILED' || execution.status === 'TIMEOUT') failed += 1;\n if (typeof execution.duration === 'number') {\n durationSum += execution.duration;\n durationCount += 1;\n }\n totalCost += execution.cost ?? 0;\n totalTokens += execution.tokensUsed ?? 0;\n }\n\n return {\n total,\n succeeded,\n failed,\n successRate: total > 0 ? succeeded / total : 0,\n avgDurationMs: durationCount > 0 ? durationSum / durationCount : 0,\n totalCost,\n totalTokens,\n };\n}\n\nexport function useCreateExecution() {\n return useWorkspaceMutation<CreateExecutionMutation, CreateExecutionVariables, ExecutionRecord>({\n document: CreateExecutionDocument,\n variables: ({ input }) => ({ input: buildMutationInput(input, CREATE_EXECUTION_FIELDS) }),\n select: (data) => data?.createExecution,\n errorMessage: 'Failed to start execution',\n });\n}\n\nexport function useUpdateExecutionStatus() {\n return useWorkspaceMutation<\n UpdateExecutionStatusMutation,\n UpdateExecutionStatusVariables,\n ExecutionRecord\n >({\n document: UpdateExecutionStatusDocument,\n variables: ({ id, status, output, error }) => ({\n id,\n input: {\n status,\n output,\n // The subgraph takes the failure as a message plus a JSON detail blob\n // (UpdateExecutionStatusInput); pass the caller's object through whole.\n errorMessage: typeof error?.message === 'string' ? error.message : undefined,\n errorDetails: error,\n },\n }),\n select: (data) => data?.updateExecutionStatus,\n errorMessage: 'Failed to update execution status',\n });\n}\n"],"mappings":";;;;;AAqCA,IAAMA,IAAa;AAqDaC,EAA+B;CAC7D,SAAS;CACT,OAAO;CACP,gBAAgB;CAChB,OAAO;CACP,UAAU;CACV,MAAM;CACN,aAAa;AACf,CAAC;AAUD,IAAMC,oBAAmB,IAAI,IAAI,CAAC,WAAW,CAAC,GAExCC,IAAmC,CAAC;AAW1C,SAASC,EAAc,GAA4B,GAAyB;CAC1E,OACEC,EAAU,GAAG,YAAY,CAAC,CAAC,SAASC,CAAM,MACzCD,EAAU,WAAW,GAAA,CAAI,YAAY,CAAC,CAAC,SAASC,CAAM,MACtDD,EAAU,SAAS,GAAA,CAAI,YAAY,CAAC,CAAC,SAASC,CAAM,KACrDD,EAAU,MAAM,YA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S,GACTC,IAAc,GACdC,IAAgB,GAChBC,IAAY,GACZC,IAAc;CAElB,KAAK,IAAMrC,KAAa+B,GAQtB,AAPIlC,EAAiB,IAAIG,EAAU,MAAM,MAAG,KAAa,KACrDA,EAAU,WAAW,YAAYA,EAAU,WAAW,eAAW,KAAU,IAC3E,OAAOA,EAAU,YAAa,aAChC,KAAeA,EAAU,UACzB,KAAiB,IAEnB,KAAaA,EAAU,QAAQ,GAC/B,KAAeA,EAAU,cAAc;CAGzC,OAAO;EACL;EACA;EACA;EACA,aAAa8B,IAAQ,IAAIE,IAAYF,IAAQ;EAC7C,eAAeK,IAAgB,IAAID,IAAcC,IAAgB;EACjE;EACA;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"useExecutions.js","names":["LIST_LIMIT","fieldsOf","NO_EXECUTIONS","toFilterInput","search","filter","identityRows","rows","useExecutions","workspaceId","useWorkspaceId","key","variables","useMemo","useWorkspacePaginatedQuery","ListExecutionsDocument","data","useExecutionSummary","useWorkspaceQuery","GetExecutionSummaryDocument","useExecution","executionId","GetExecutionDocument"],"sources":["../../../src/botlit/hooks/useExecutions.ts"],"sourcesContent":["/**\n * Executions Hooks\n * @module botlit/hooks\n *\n * Backed by the live `listExecutions` / `getExecution` / `getExecutionMetrics`\n * operations plus the `createExecution` / `updateExecutionStatus` mutations on\n * wspace-botlit-svc.\n *\n * Filtering (BOFF-12618): status sets, text search, agent, bot and date range\n * are all applied by the service, so every page — and the summary tiles from\n * `getExecutionSummary` — describe the whole history, not the loaded rows.\n */\n\nimport { useMemo } from 'react';\nimport {\n CreateExecutionDocument,\n GetExecutionDocument,\n GetExecutionMetricsDocument,\n GetExecutionSummaryDocument,\n ListExecutionsDocument,\n UpdateExecutionStatusDocument,\n type CreateExecutionMutation,\n type GetExecutionMetricsQuery,\n type GetExecutionQuery,\n type GetExecutionSummaryQuery,\n type ListExecutionsQuery,\n type UpdateExecutionStatusMutation,\n} from '../../generated/wspace-operations';\nimport type {\n CreateExecutionInput,\n ExecutionStatus,\n ExecutionType,\n} from '../../generated/wspace-types';\nimport { buildMutationInput, fieldsOf, type GraphQLInput } from './internal/mutationInput';\nimport {\n useWorkspaceId,\n useWorkspaceMutation,\n useWorkspacePaginatedQuery,\n useWorkspaceQuery,\n type PaginatedQueryResult,\n type QueryResult,\n} from './internal/workspaceGateway';\n\nconst LIST_LIMIT = 100;\n\nexport interface ExecutionRecord {\n id: string;\n status: string;\n type: string;\n input: string;\n output?: string | null;\n agentId?: string | null;\n appId?: string | null;\n /** BOFF-12619 — display names; null when the agent or bot no longer exists. */\n agentName?: string | null;\n appName?: string | null;\n conversationId?: string | null;\n cost?: number | null;\n duration?: number | null;\n tokensUsed?: number | null;\n errorCode?: string | null;\n errorMessage?: string | null;\n errorDetails?: Record<string, unknown> | null;\n metadata?: Record<string, unknown> | null;\n completedAt?: string | null;\n createdAt: string;\n workspaceId: string;\n /** BOFF-12620 — token split and cost recorded when the run finished. */\n metrics?: ExecutionMetricsRecord | null;\n}\n\nexport interface ExecutionMetricsRecord {\n executionId: string;\n cost: number;\n inputTokens: number;\n outputTokens: number;\n totalTokens: number;\n ragChunks: number;\n toolCalls: number;\n}\n\nexport interface ExecutionsFilter {\n search?: string;\n status?: ExecutionStatus[];\n agentId?: string;\n appId?: string;\n conversationId?: string;\n type?: ExecutionType;\n /** ISO timestamp — runs created at or after it. */\n startDate?: string;\n /** ISO timestamp — runs created at or before it. */\n endDate?: string;\n}\n\n/** Totals over every run matching a filter (`getExecutionSummary`). */\nexport interface ExecutionSummaryRecord {\n total: number;\n succeeded: number;\n failed: number;\n inProgress: number;\n avgDurationMs?: number | null;\n timedRuns: number;\n totalTokens: number;\n totalCost?: number | null;\n pricedRuns: number;\n unpricedRuns: number;\n}\n\nexport interface ExecutionMetricsFilter {\n agentId?: string;\n appId?: string;\n startDate?: string;\n endDate?: string;\n}\n\nexport interface CreateExecutionVariables {\n input: GraphQLInput<CreateExecutionInput>;\n}\n\nconst CREATE_EXECUTION_FIELDS = fieldsOf<CreateExecutionInput>({\n agentId: true,\n appId: true,\n conversationId: true,\n input: true,\n metadata: true,\n type: true,\n workspaceId: true,\n});\n\nexport interface UpdateExecutionStatusVariables {\n id: string;\n status: ExecutionStatus;\n output?: string;\n error?: Record<string, unknown>;\n}\n\nconst NO_EXECUTIONS: ExecutionRecord[] = [];\n\nexport const executionKeys = {\n all: ['executions'] as const,\n lists: () => [...executionKeys.all, 'list'] as const,\n list: (filter?: ExecutionsFilter) => [...executionKeys.lists(), filter] as const,\n details: () => [...executionKeys.all, 'detail'] as const,\n detail: (id: string) => [...executionKeys.details(), id] as const,\n metrics: () => [...executionKeys.all, 'metrics'] as const,\n};\n\n/** The `ExecutionFilterInput` for a page filter; empty values are left out. */\nfunction toFilterInput(workspaceId: string | undefined, filter?: ExecutionsFilter) {\n const search = filter?.search?.trim();\n return {\n workspaceId,\n statuses: filter?.status && filter.status.length > 0 ? filter.status : undefined,\n search: search ? search : undefined,\n agentId: filter?.agentId || undefined,\n appId: filter?.appId || undefined,\n conversationId: filter?.conversationId || undefined,\n type: filter?.type,\n startDate: filter?.startDate || undefined,\n endDate: filter?.endDate || undefined,\n };\n}\n\nconst identityRows = (rows: ExecutionRecord[]): ExecutionRecord[] => rows;\n\nexport function useExecutions(filter?: ExecutionsFilter): PaginatedQueryResult<ExecutionRecord[]> {\n const workspaceId = useWorkspaceId();\n const key = JSON.stringify(toFilterInput(workspaceId, filter));\n const variables = useMemo(\n () => ({ filters: JSON.parse(key) as ReturnType<typeof toFilterInput> }),\n [key]\n );\n\n return useWorkspacePaginatedQuery<ListExecutionsQuery, ExecutionRecord, ExecutionRecord[]>({\n document: ListExecutionsDocument,\n variables,\n pageSize: LIST_LIMIT,\n extractRows: (data) => data?.listExecutions ?? NO_EXECUTIONS,\n select: identityRows,\n fallback: NO_EXECUTIONS,\n enabled: Boolean(workspaceId),\n errorMessage: 'Failed to load executions',\n });\n}\n\n/**\n * Totals over every run matching the same filter as {@link useExecutions}\n * (BOFF-12614) — computed by the service over the whole history.\n */\nexport function useExecutionSummary(\n filter?: ExecutionsFilter\n): QueryResult<ExecutionSummaryRecord | null> {\n const workspaceId = useWorkspaceId();\n const key = JSON.stringify(toFilterInput(workspaceId, filter));\n const variables = useMemo(\n () => ({ filters: JSON.parse(key) as ReturnType<typeof toFilterInput> }),\n [key]\n );\n\n return useWorkspaceQuery<GetExecutionSummaryQuery, ExecutionSummaryRecord | null>({\n document: GetExecutionSummaryDocument,\n variables,\n select: (data) => data?.getExecutionSummary ?? null,\n fallback: null,\n enabled: Boolean(workspaceId),\n errorMessage: 'Failed to load the execution summary',\n });\n}\n\nexport function useExecution(executionId: string | undefined): QueryResult<ExecutionRecord | null> {\n const variables = useMemo(() => ({ id: executionId ?? '' }), [executionId]);\n\n return useWorkspaceQuery<GetExecutionQuery, ExecutionRecord | null>({\n document: GetExecutionDocument,\n variables,\n select: (data) => data?.getExecution ?? null,\n fallback: null,\n enabled: Boolean(executionId),\n errorMessage: 'Failed to load execution',\n });\n}\n\n/**\n * Token/cost metrics for the workspace, optionally narrowed to an agent, app or\n * date window. Returns `null` when the service has nothing recorded yet.\n */\nexport function useExecutionMetrics(\n filter?: ExecutionMetricsFilter\n): QueryResult<ExecutionMetricsRecord | null> {\n const workspaceId = useWorkspaceId();\n const { agentId, appId, startDate, endDate } = filter ?? {};\n\n const variables = useMemo(\n () => ({ filter: { workspaceId, agentId, appId, startDate, endDate } }),\n [workspaceId, agentId, appId, startDate, endDate]\n );\n\n return useWorkspaceQuery<GetExecutionMetricsQuery, ExecutionMetricsRecord | null>({\n document: GetExecutionMetricsDocument,\n variables,\n select: (data) => data?.getExecutionMetrics ?? null,\n fallback: null,\n enabled: Boolean(workspaceId),\n errorMessage: 'Failed to load execution metrics',\n });\n}\n\nexport function useCreateExecution() {\n return useWorkspaceMutation<CreateExecutionMutation, CreateExecutionVariables, ExecutionRecord>({\n document: CreateExecutionDocument,\n variables: ({ input }) => ({ input: buildMutationInput(input, CREATE_EXECUTION_FIELDS) }),\n select: (data) => data?.createExecution,\n errorMessage: 'Failed to start execution',\n });\n}\n\nexport function useUpdateExecutionStatus() {\n return useWorkspaceMutation<\n UpdateExecutionStatusMutation,\n UpdateExecutionStatusVariables,\n ExecutionRecord\n >({\n document: UpdateExecutionStatusDocument,\n variables: ({ id, status, output, error }) => ({\n id,\n input: {\n status,\n output,\n // The subgraph takes the failure as a message plus a JSON detail blob\n // (UpdateExecutionStatusInput); pass the caller's object through whole.\n errorMessage: typeof error?.message === 'string' ? error.message : undefined,\n errorDetails: error,\n },\n }),\n select: (data) => data?.updateExecutionStatus,\n errorMessage: 'Failed to update execution status',\n });\n}\n"],"mappings":";;;;;AA2CA,IAAMA,IAAa;AA4EaC,EAA+B;CAC7D,SAAS;CACT,OAAO;CACP,gBAAgB;CAChB,OAAO;CACP,UAAU;CACV,MAAM;CACN,aAAa;AACf,CAAC;AASD,IAAMC,IAAmC,CAAC;AAY1C,SAASC,EAAc,GAAiC,GAA2B;CACjF,IAAMC,IAASC,GAAQ,QAAQ,KAAK;CACpC,OAAO;EACL;EACA,UAAUA,GAAQ,UAAUA,EAAO,OAAO,SAAS,IAAIA,EAAO,SAAS,KAAA;EACvE,QAAQD,KAAkB,KAAA;EAC1B,SAASC,GAAQ,WAAW,KAAA;EAC5B,OAAOA,GAAQ,SAAS,KAAA;EACxB,gBAAgBA,GAAQ,kBAAkB,KAAA;EAC1C,MAAMA,GAAQ;EACd,WAAWA,GAAQ,aAAa,KAAA;EAChC,SAASA,GAAQ,WAAW,KAAA;CAC9B;AACF;AAEA,IAAMC,KAAgB,MAA+CC;AAErE,SAAgBC,EAAc,GAAoE;CAChG,IAAMC,IAAcC,EAAe,GAC7BC,IAAM,KAAK,UAAUR,EAAcM,GAAaJ,CAAM,CAAC,GACvDO,IAAYC,SACT,EAAE,SAAS,KAAK,MAAMF,CAAG,EAAsC,IACtE,CAACA,CAAG,CACN;CAEA,OAAOG,EAAoF;EACzF,UAAUC;EACV;EACA,UAAUf;EACV,cAA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