@burdenoff/microfe-botmanor 2026.1120.4 → 2026.1120.5
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/hooks/useExecutions.js +36 -42
- package/dist/botlit/hooks/useExecutions.js.map +1 -1
- package/dist/botlit/hooks/useRerunExecution.d.ts +5 -0
- package/dist/botlit/hooks/useRerunExecution.js +29 -0
- package/dist/botlit/hooks/useRerunExecution.js.map +1 -0
- package/dist/botlit/pages/ExecutionDetailPage.js +66 -72
- package/dist/botlit/pages/ExecutionDetailPage.js.map +1 -1
- package/dist/generated/wspace-operations.js +68 -70
- package/dist/generated/wspace-operations.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { useWorkspaceId as
|
|
4
|
-
import { useCallback as
|
|
1
|
+
import { GetExecutionDocument as e, ListExecutionsDocument as t } from "../../generated/wspace-operations.js";
|
|
2
|
+
import { fieldsOf as n } from "./internal/mutationInput.js";
|
|
3
|
+
import { useWorkspaceId as r, useWorkspacePaginatedQuery as i, useWorkspaceQuery as a } from "./internal/workspaceGateway.js";
|
|
4
|
+
import { useCallback as o, useMemo as s } from "react";
|
|
5
5
|
// src/botlit/hooks/useExecutions.ts
|
|
6
|
-
var
|
|
6
|
+
var c = 100;
|
|
7
|
+
n({
|
|
7
8
|
agentId: !0,
|
|
8
9
|
appId: !0,
|
|
9
10
|
conversationId: !0,
|
|
@@ -11,54 +12,55 @@ var d = 100, f = i({
|
|
|
11
12
|
metadata: !0,
|
|
12
13
|
type: !0,
|
|
13
14
|
workspaceId: !0
|
|
14
|
-
})
|
|
15
|
-
|
|
15
|
+
});
|
|
16
|
+
var l = /* @__PURE__ */ new Set(["COMPLETED"]), u = [];
|
|
17
|
+
function d(e, t) {
|
|
16
18
|
return e.id.toLowerCase().includes(t) || (e.agentId ?? "").toLowerCase().includes(t) || (e.appId ?? "").toLowerCase().includes(t) || e.input.toLowerCase().includes(t);
|
|
17
19
|
}
|
|
18
|
-
function
|
|
19
|
-
let
|
|
20
|
-
workspaceId:
|
|
21
|
-
status:
|
|
22
|
-
agentId:
|
|
23
|
-
appId:
|
|
20
|
+
function f(e) {
|
|
21
|
+
let n = r(), a = e?.search?.trim().toLowerCase() ?? "", l = e?.status, f = l?.length === 1 ? l[0] : void 0, p = l?.join(",") ?? "", { agentId: m, appId: h, conversationId: g, type: _ } = e ?? {}, v = s(() => ({ filters: {
|
|
22
|
+
workspaceId: n,
|
|
23
|
+
status: f,
|
|
24
|
+
agentId: m,
|
|
25
|
+
appId: h,
|
|
24
26
|
conversationId: g,
|
|
25
27
|
type: _
|
|
26
28
|
} }), [
|
|
27
|
-
|
|
28
|
-
o,
|
|
29
|
+
n,
|
|
29
30
|
f,
|
|
30
|
-
|
|
31
|
+
m,
|
|
32
|
+
h,
|
|
31
33
|
g,
|
|
32
34
|
_
|
|
33
|
-
]), y =
|
|
34
|
-
let t =
|
|
35
|
-
return
|
|
36
|
-
}, [
|
|
37
|
-
return
|
|
38
|
-
document:
|
|
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,
|
|
39
41
|
variables: v,
|
|
40
|
-
pageSize:
|
|
41
|
-
extractRows: (e) => e?.listExecutions ??
|
|
42
|
+
pageSize: c,
|
|
43
|
+
extractRows: (e) => e?.listExecutions ?? u,
|
|
42
44
|
select: y,
|
|
43
|
-
fallback:
|
|
44
|
-
enabled: !!
|
|
45
|
+
fallback: u,
|
|
46
|
+
enabled: !!n,
|
|
45
47
|
errorMessage: "Failed to load executions"
|
|
46
48
|
});
|
|
47
49
|
}
|
|
48
|
-
function
|
|
49
|
-
let n =
|
|
50
|
-
return
|
|
51
|
-
document:
|
|
50
|
+
function p(t) {
|
|
51
|
+
let n = s(() => ({ id: t ?? "" }), [t]);
|
|
52
|
+
return a({
|
|
53
|
+
document: e,
|
|
52
54
|
variables: n,
|
|
53
55
|
select: (e) => e?.getExecution ?? null,
|
|
54
56
|
fallback: null,
|
|
55
|
-
enabled: !!
|
|
57
|
+
enabled: !!t,
|
|
56
58
|
errorMessage: "Failed to load execution"
|
|
57
59
|
});
|
|
58
60
|
}
|
|
59
|
-
function
|
|
61
|
+
function m(e) {
|
|
60
62
|
let t = e.length, n = 0, r = 0, i = 0, a = 0, o = 0, s = 0;
|
|
61
|
-
for (let t of e)
|
|
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;
|
|
62
64
|
return {
|
|
63
65
|
total: t,
|
|
64
66
|
succeeded: n,
|
|
@@ -69,14 +71,6 @@ function v(e) {
|
|
|
69
71
|
totalTokens: s
|
|
70
72
|
};
|
|
71
73
|
}
|
|
72
|
-
|
|
73
|
-
return o({
|
|
74
|
-
document: e,
|
|
75
|
-
variables: ({ input: e }) => ({ input: r(e, f) }),
|
|
76
|
-
select: (e) => e?.createExecution,
|
|
77
|
-
errorMessage: "Failed to start execution"
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
export { v as summariseExecutions, y as useCreateExecution, _ as useExecution, g as useExecutions };
|
|
74
|
+
export { m as summariseExecutions, p as useExecution, f as useExecutions };
|
|
81
75
|
|
|
82
76
|
//# sourceMappingURL=useExecutions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useExecutions.js","names":["LIST_LIMIT","CREATE_EXECUTION_FIELDS","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","useCreateExecution","useWorkspaceMutation","CreateExecutionDocument","buildMutationInput","input"],"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,KAqDbC,IAA0BC,EAA+B;CAC7D,SAAS;CACT,OAAO;CACP,gBAAgB;CAChB,OAAO;CACP,UAAU;CACV,MAAM;CACN,aAAa;AACf,CAAC,GAUKC,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,YAAY,CAAC,CAAC,SAASC,CAAM;AAEjD;AAEA,SAAgBC,EAAc,GAAoE;CAChG,IAAMC,IAAcC,EAAe,GAC7BC,IAASC,GAAQ,QAAQ,KAAK,CAAC,CAAC,YAAY,KAAK,IACjDC,IAAWD,GAAQ,QACnBE,IAAeD,GAAU,WAAW,IAAIA,EAAS,KAAK,KAAA,GACtDE,IAAYF,GAAU,KAAK,GAAG,KAAK,IACnC,EAAE,YAAS,UAAO,mBAAgB,YAASD,KAAU,CAAC,GAEtDI,IAAYC,SACT,EACL,SAAS;EACP;EACA,QAAQH;EACR;EACA;EACA;EACA;CACF,EACF,IACA;EAACL;EAAaK;EAAcI;EAASC;EAAOC;EAAgBC;CAAI,CAClE,GAEMC,IAASC,GACZ,MAA+C;EAC9C,IAAMC,IAAST,IAAY,IAAI,IAAIA,EAAU,MAAM,GAAG,CAAC,IAAI,KAAA,GACrDU,IAEJD,KAAUA,EAAO,OAAO,IAAIE,EAAK,QAAQ,MAAQF,EAAO,IAAIG,EAAI,MAAM,CAAC,IAAID;EAC7E,OAAOf,IAASc,EAAS,QAAQ,MAAQpB,EAAcsB,GAAKhB,CAAM,CAAC,IAAIc;CACzE,GACA,CAACd,GAAQI,CAAS,CACpB;CAEA,OAAOa,EAAoF;EACzF,UAAUC;EACV;EACA,UAAU7B;EACV,cAAc,MAAS8B,GAAM,kBAAkB1B;EAC/C;EACA,UAAUA;EACV,SAAS,EAAQK;EACjB,cAAc;CAChB,CAAC;AACH;AAEA,SAAgBsB,EAAa,GAAsE;CACjG,IAAMf,IAAYC,SAAe,EAAE,IAAIe,KAAe,GAAG,IAAI,CAACA,CAAW,CAAC;CAE1E,OAAOC,EAA6D;EAClE,UAAUC;EACV;EACA,SAAS,MAASJ,GAAM,gBAAgB;EACxC,UAAU;EACV,SAAS,EAAQE;EACjB,cAAc;CAChB,CAAC;AACH;AA0CA,SAAgBG,EAAoB,GAAyD;CAC3F,IAAMC,IAAQC,EAAW,QACrBC,IAAY,GACZC,IAAS,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;AAEA,SAAgBG,IAAqB;CACnC,OAAOC,EAAyF;EAC9F,UAAUC;EACV,YAAY,EAAE,gBAAa,EAAE,OAAOC,EAAmBC,GAAO/C,CAAuB,EAAE;EACvF,SAAS,MAAS6B,GAAM;EACxB,cAAc;CAChB,CAAC;AACH"}
|
|
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,YAAY,CAAC,CAAC,SAASC,CAAM;AAEjD;AAEA,SAAgBC,EAAc,GAAoE;CAChG,IAAMC,IAAcC,EAAe,GAC7BC,IAASC,GAAQ,QAAQ,KAAK,CAAC,CAAC,YAAY,KAAK,IACjDC,IAAWD,GAAQ,QACnBE,IAAeD,GAAU,WAAW,IAAIA,EAAS,KAAK,KAAA,GACtDE,IAAYF,GAAU,KAAK,GAAG,KAAK,IACnC,EAAE,YAAS,UAAO,mBAAgB,YAASD,KAAU,CAAC,GAEtDI,IAAYC,SACT,EACL,SAAS;EACP;EACA,QAAQH;EACR;EACA;EACA;EACA;CACF,EACF,IACA;EAACL;EAAaK;EAAcI;EAASC;EAAOC;EAAgBC;CAAI,CAClE,GAEMC,IAASC,GACZ,MAA+C;EAC9C,IAAMC,IAAST,IAAY,IAAI,IAAIA,EAAU,MAAM,GAAG,CAAC,IAAI,KAAA,GACrDU,IAEJD,KAAUA,EAAO,OAAO,IAAIE,EAAK,QAAQ,MAAQF,EAAO,IAAIG,EAAI,MAAM,CAAC,IAAID;EAC7E,OAAOf,IAASc,EAAS,QAAQ,MAAQpB,EAAcsB,GAAKhB,CAAM,CAAC,IAAIc;CACzE,GACA,CAACd,GAAQI,CAAS,CACpB;CAEA,OAAOa,EAAoF;EACzF,UAAUC;EACV;EACA,UAAU5B;EACV,cAAc,MAAS6B,GAAM,kBAAkB1B;EAC/C;EACA,UAAUA;EACV,SAAS,EAAQK;EACjB,cAAc;CAChB,CAAC;AACH;AAEA,SAAgBsB,EAAa,GAAsE;CACjG,IAAMf,IAAYC,SAAe,EAAE,IAAIe,KAAe,GAAG,IAAI,CAACA,CAAW,CAAC;CAE1E,OAAOC,EAA6D;EAClE,UAAUC;EACV;EACA,SAAS,MAASJ,GAAM,gBAAgB;EACxC,UAAU;EACV,SAAS,EAAQE;EACjB,cAAc;CAChB,CAAC;AACH;AA0CA,SAAgBG,EAAoB,GAAyD;CAC3F,IAAMC,IAAQC,EAAW,QACrBC,IAAY,GACZC,IAAS,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"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { graphqlErrorMessage as e } from "../utils/errors.js";
|
|
2
|
+
import { gql as t } from "@apollo/client";
|
|
3
|
+
import { useGatewayClient as n } from "@burdenoff/fe-libs/shared/graphql";
|
|
4
|
+
import { useMutation as r } from "@tanstack/react-query";
|
|
5
|
+
// src/botlit/hooks/useRerunExecution.ts
|
|
6
|
+
var i = t`
|
|
7
|
+
mutation RerunExecution($id: ID!) {
|
|
8
|
+
rerunExecution(id: $id) {
|
|
9
|
+
id
|
|
10
|
+
status
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
14
|
+
function a() {
|
|
15
|
+
let t = n("workspace");
|
|
16
|
+
return r({ mutationFn: async (n) => {
|
|
17
|
+
let r = await t.mutate({
|
|
18
|
+
mutation: i,
|
|
19
|
+
variables: { id: n }
|
|
20
|
+
}), a = r.error;
|
|
21
|
+
if (a != null) throw Error(e(a, "Failed to re-run execution"));
|
|
22
|
+
let o = r.data?.rerunExecution;
|
|
23
|
+
if (!o) throw Error("Failed to re-run execution");
|
|
24
|
+
return o;
|
|
25
|
+
} });
|
|
26
|
+
}
|
|
27
|
+
export { a as useRerunExecution };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=useRerunExecution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRerunExecution.js","names":["RERUN_EXECUTION","useRerunExecution","client","useGatewayClient","useMutation","response","operationError","graphqlErrorMessage","created"],"sources":["../../../src/botlit/hooks/useRerunExecution.ts"],"sourcesContent":["/**\n * Run an execution again (BOFF-15360).\n *\n * `rerunExecution` copies the stored run's input, agent and bot into a new\n * PENDING execution, returns it at once and runs it in the background, so the\n * request stays well inside the gateway timeout. Creating a copy with\n * `createExecution` alone left the new run PENDING until the reaper marked it\n * ORPHANED, because nothing dispatched it.\n *\n * @module botlit/hooks/useRerunExecution\n */\nimport { gql } from '@apollo/client';\nimport { useMutation } from '@tanstack/react-query';\nimport { useGatewayClient } from '@burdenoff/fe-libs/shared/graphql';\nimport { graphqlErrorMessage } from '../utils/errors';\n\nconst RERUN_EXECUTION = gql`\n mutation RerunExecution($id: ID!) {\n rerunExecution(id: $id) {\n id\n status\n }\n }\n`;\n\nexport interface RerunExecutionResult {\n id: string;\n status: string;\n}\n\nexport function useRerunExecution() {\n const client = useGatewayClient('workspace');\n return useMutation({\n mutationFn: async (id: string): Promise<RerunExecutionResult> => {\n const response = await client.mutate<{ rerunExecution: RerunExecutionResult }>({\n mutation: RERUN_EXECUTION,\n variables: { id },\n });\n // Apollo v4 resolves (not rejects) with `error` set on GraphQL errors.\n const operationError = (response as { error?: unknown }).error;\n if (operationError != null)\n throw new Error(graphqlErrorMessage(operationError, 'Failed to re-run execution'));\n const created = response.data?.rerunExecution;\n if (!created) throw new Error('Failed to re-run execution');\n return created;\n },\n });\n}\n"],"mappings":";;;;;AAgBA,IAAMA,IAAkB,CAAG;;;;;;;;AAc3B,SAAgBC,IAAoB;CAClC,IAAMC,IAASC,EAAiB,WAAW;CAC3C,OAAOC,EAAY,EACjB,YAAY,OAAO,MAA8C;EAC/D,IAAMC,IAAW,MAAMH,EAAO,OAAiD;GAC7E,UAAUF;GACV,WAAW,EAAE,MAAG;EAClB,CAAC,GAEKM,IAAkBD,EAAiC;EACzD,IAAIC,KAAkB,MACpB,MAAU,MAAMC,EAAoBD,GAAgB,4BAA4B,CAAC;EACnF,IAAME,IAAUH,EAAS,MAAM;EAC/B,IAAI,CAACG,GAAS,MAAU,MAAM,4BAA4B;EAC1D,OAAOA;CACT,EACF,CAAC;AACH"}
|
|
@@ -9,41 +9,38 @@ import { Button as p } from "../components/Button.js";
|
|
|
9
9
|
import { Badge as m } from "../components/Badge.js";
|
|
10
10
|
import { ErrorState as h } from "../components/ErrorState.js";
|
|
11
11
|
import { ExecutionModelFallback as g } from "../components/ExecutionModelFallback.js";
|
|
12
|
-
import {
|
|
12
|
+
import { useExecution as _ } from "../hooks/useExecutions.js";
|
|
13
|
+
import { useRerunExecution as v } from "../hooks/useRerunExecution.js";
|
|
13
14
|
import { formatCurrency as y, formatDuration as b, formatNumber as x, formatRelativeTime as S } from "../utils/formatters.js";
|
|
14
|
-
import {
|
|
15
|
-
import { ExecutionStatus as w } from "../../generated/wspace-types.js";
|
|
15
|
+
import { ExecutionStatus as C } from "../../generated/wspace-types.js";
|
|
16
16
|
import "../permissions/index.js";
|
|
17
|
+
import { useEffect as w } from "react";
|
|
17
18
|
import { PagePurpose as T } from "@burdenoff/fe-libs/ui";
|
|
18
19
|
import { jsx as E, jsxs as D } from "react/jsx-runtime";
|
|
19
20
|
import { useParams as O } from "react-router";
|
|
20
21
|
import { AlertTriangle as k, ArrowLeft as A, CheckCircle as j, Clock as M, Copy as N, DollarSign as P, Hourglass as F, Play as I, RefreshCw as L, XCircle as R, Zap as z } from "lucide-react";
|
|
21
22
|
import { toast as B } from "sonner";
|
|
22
23
|
// src/botlit/pages/ExecutionDetailPage.tsx
|
|
23
|
-
var V = [
|
|
24
|
-
"AGENT",
|
|
25
|
-
"APP",
|
|
26
|
-
"WORKFLOW"
|
|
27
|
-
], H = (e) => {
|
|
24
|
+
var V = 3e3, H = /* @__PURE__ */ new Set(["AGENT", "APP"]), U = (e) => {
|
|
28
25
|
switch (e) {
|
|
29
|
-
case
|
|
26
|
+
case C.Completed: return /* @__PURE__ */ E(j, {
|
|
30
27
|
className: "text-status-success-text",
|
|
31
28
|
size: 20
|
|
32
29
|
});
|
|
33
|
-
case
|
|
34
|
-
case
|
|
30
|
+
case C.Failed:
|
|
31
|
+
case C.Timeout: return /* @__PURE__ */ E(R, {
|
|
35
32
|
className: "text-status-error-text",
|
|
36
33
|
size: 20
|
|
37
34
|
});
|
|
38
|
-
case
|
|
35
|
+
case C.Cancelled: return /* @__PURE__ */ E(R, {
|
|
39
36
|
className: "text-text-secondary",
|
|
40
37
|
size: 20
|
|
41
38
|
});
|
|
42
|
-
case
|
|
39
|
+
case C.Running: return /* @__PURE__ */ E(L, {
|
|
43
40
|
className: "text-status-info-text motion-safe:animate-spin",
|
|
44
41
|
size: 20
|
|
45
42
|
});
|
|
46
|
-
case
|
|
43
|
+
case C.Pending: return /* @__PURE__ */ E(F, {
|
|
47
44
|
className: "text-status-warning-text",
|
|
48
45
|
size: 20
|
|
49
46
|
});
|
|
@@ -52,52 +49,49 @@ var V = [
|
|
|
52
49
|
size: 20
|
|
53
50
|
});
|
|
54
51
|
}
|
|
55
|
-
},
|
|
52
|
+
}, W = (e) => {
|
|
56
53
|
switch (e) {
|
|
57
|
-
case
|
|
58
|
-
case
|
|
59
|
-
case
|
|
60
|
-
case
|
|
61
|
-
case
|
|
54
|
+
case C.Completed: return "success";
|
|
55
|
+
case C.Failed:
|
|
56
|
+
case C.Timeout: return "destructive";
|
|
57
|
+
case C.Pending: return "warning";
|
|
58
|
+
case C.Running: return "default";
|
|
62
59
|
default: return "secondary";
|
|
63
60
|
}
|
|
64
|
-
},
|
|
65
|
-
let { executionId:
|
|
66
|
-
if (
|
|
61
|
+
}, G = () => {
|
|
62
|
+
let { executionId: j } = O(), { navigateTo: F } = e(), { data: R, loading: G, error: K, refetch: q } = _(j), J = v(), Y = R?.status;
|
|
63
|
+
if (w(() => {
|
|
64
|
+
if (Y !== C.Pending && Y !== C.Running) return;
|
|
65
|
+
let e = setInterval(() => void q(), V);
|
|
66
|
+
return () => clearInterval(e);
|
|
67
|
+
}, [Y, q]), G && !R) return /* @__PURE__ */ E(o, {
|
|
67
68
|
title: "Loading...",
|
|
68
69
|
children: /* @__PURE__ */ E("div", { className: "h-96 bg-bg-sunken motion-safe:animate-vc-shimmer rounded-lg" })
|
|
69
70
|
});
|
|
70
|
-
if (
|
|
71
|
+
if (K) return /* @__PURE__ */ E(o, {
|
|
71
72
|
title: "Execution",
|
|
72
73
|
children: /* @__PURE__ */ E(h, {
|
|
73
74
|
resource: "this execution",
|
|
74
|
-
error:
|
|
75
|
-
onRetry: () => void
|
|
75
|
+
error: K,
|
|
76
|
+
onRetry: () => void q()
|
|
76
77
|
})
|
|
77
78
|
});
|
|
78
|
-
if (!
|
|
79
|
+
if (!R) return /* @__PURE__ */ E(o, {
|
|
79
80
|
title: "Execution Not Found",
|
|
80
81
|
children: /* @__PURE__ */ E(s, {
|
|
81
82
|
illustration: "empty-search",
|
|
82
83
|
title: "Execution Not Found",
|
|
83
84
|
description: "The execution doesn't exist.",
|
|
84
85
|
action: /* @__PURE__ */ E(p, {
|
|
85
|
-
onClick: () =>
|
|
86
|
+
onClick: () => F("executions"),
|
|
86
87
|
children: "Back to Executions"
|
|
87
88
|
})
|
|
88
89
|
})
|
|
89
90
|
});
|
|
90
|
-
let
|
|
91
|
+
let X = async () => {
|
|
91
92
|
try {
|
|
92
|
-
let e = await
|
|
93
|
-
|
|
94
|
-
type: C(F.type, V, "AGENT"),
|
|
95
|
-
input: F.input,
|
|
96
|
-
appId: F.appId,
|
|
97
|
-
agentId: F.agentId,
|
|
98
|
-
metadata: { sourceExecutionId: F.id }
|
|
99
|
-
} });
|
|
100
|
-
B.success("Re-run started"), j(`executions/${e.id}`);
|
|
93
|
+
let e = await J.mutateAsync(R.id);
|
|
94
|
+
B.success("Re-run started"), F(`executions/${e.id}`);
|
|
101
95
|
} catch (e) {
|
|
102
96
|
B.error(e instanceof Error ? e.message : "Failed to re-run execution");
|
|
103
97
|
}
|
|
@@ -109,26 +103,26 @@ var V = [
|
|
|
109
103
|
/* @__PURE__ */ E(p, {
|
|
110
104
|
variant: "ghost",
|
|
111
105
|
size: "icon",
|
|
112
|
-
onClick: () =>
|
|
106
|
+
onClick: () => F("executions"),
|
|
113
107
|
children: /* @__PURE__ */ E(A, { size: 20 })
|
|
114
108
|
}),
|
|
115
|
-
|
|
109
|
+
U(R.status),
|
|
116
110
|
/* @__PURE__ */ D("div", { children: [/* @__PURE__ */ D("div", {
|
|
117
111
|
className: "flex items-center gap-2",
|
|
118
112
|
children: [/* @__PURE__ */ D("span", { children: [
|
|
119
113
|
"Execution ",
|
|
120
|
-
|
|
114
|
+
R.id.slice(0, 8),
|
|
121
115
|
"…"
|
|
122
116
|
] }), /* @__PURE__ */ E(m, {
|
|
123
|
-
variant:
|
|
124
|
-
children:
|
|
117
|
+
variant: W(R.status),
|
|
118
|
+
children: R.status
|
|
125
119
|
})]
|
|
126
120
|
}), /* @__PURE__ */ D("p", {
|
|
127
121
|
className: "text-sm font-normal text-text-secondary",
|
|
128
122
|
children: [
|
|
129
|
-
|
|
123
|
+
R.appId ?? "—",
|
|
130
124
|
" / ",
|
|
131
|
-
|
|
125
|
+
R.agentId ?? "—"
|
|
132
126
|
]
|
|
133
127
|
})] })
|
|
134
128
|
]
|
|
@@ -139,15 +133,15 @@ var V = [
|
|
|
139
133
|
variant: "outline",
|
|
140
134
|
leftIcon: /* @__PURE__ */ E(N, { size: 16 }),
|
|
141
135
|
onClick: () => {
|
|
142
|
-
n(
|
|
136
|
+
n(R.id), t() && r("Copied");
|
|
143
137
|
},
|
|
144
138
|
children: "Copy ID"
|
|
145
|
-
}), /* @__PURE__ */ E(a, {
|
|
139
|
+
}), H.has(R.type) && /* @__PURE__ */ E(a, {
|
|
146
140
|
permission: i.EXECUTION_CREATE,
|
|
147
141
|
children: /* @__PURE__ */ E(p, {
|
|
148
142
|
leftIcon: /* @__PURE__ */ E(I, { size: 16 }),
|
|
149
|
-
onClick: () => void
|
|
150
|
-
isLoading:
|
|
143
|
+
onClick: () => void X(),
|
|
144
|
+
isLoading: J.isPending,
|
|
151
145
|
children: "Run again"
|
|
152
146
|
})
|
|
153
147
|
})]
|
|
@@ -171,7 +165,7 @@ var V = [
|
|
|
171
165
|
/* @__PURE__ */ E(M, { className: "h-6 w-6 mx-auto mb-2 text-text-secondary" }),
|
|
172
166
|
/* @__PURE__ */ E("p", {
|
|
173
167
|
className: "text-2xl font-bold tabular-nums",
|
|
174
|
-
children:
|
|
168
|
+
children: R.duration === null || R.duration === void 0 ? "—" : b(R.duration)
|
|
175
169
|
}),
|
|
176
170
|
/* @__PURE__ */ E("p", {
|
|
177
171
|
className: "text-sm text-text-secondary",
|
|
@@ -188,7 +182,7 @@ var V = [
|
|
|
188
182
|
/* @__PURE__ */ E(z, { className: "h-6 w-6 mx-auto mb-2 text-text-secondary" }),
|
|
189
183
|
/* @__PURE__ */ E("p", {
|
|
190
184
|
className: "text-2xl font-bold tabular-nums",
|
|
191
|
-
children: x(
|
|
185
|
+
children: x(R.tokensUsed)
|
|
192
186
|
}),
|
|
193
187
|
/* @__PURE__ */ E("p", {
|
|
194
188
|
className: "text-sm text-text-secondary",
|
|
@@ -205,7 +199,7 @@ var V = [
|
|
|
205
199
|
/* @__PURE__ */ E(P, { className: "h-6 w-6 mx-auto mb-2 text-text-secondary" }),
|
|
206
200
|
/* @__PURE__ */ E("p", {
|
|
207
201
|
className: "text-2xl font-bold tabular-nums",
|
|
208
|
-
children: y(
|
|
202
|
+
children: y(R.cost)
|
|
209
203
|
}),
|
|
210
204
|
/* @__PURE__ */ E("p", {
|
|
211
205
|
className: "text-sm text-text-secondary",
|
|
@@ -222,7 +216,7 @@ var V = [
|
|
|
222
216
|
/* @__PURE__ */ E(L, { className: "h-6 w-6 mx-auto mb-2 text-text-secondary" }),
|
|
223
217
|
/* @__PURE__ */ E("p", {
|
|
224
218
|
className: "text-2xl font-bold capitalize",
|
|
225
|
-
children:
|
|
219
|
+
children: R.type.toLowerCase()
|
|
226
220
|
}),
|
|
227
221
|
/* @__PURE__ */ E("p", {
|
|
228
222
|
className: "text-sm text-text-secondary",
|
|
@@ -233,17 +227,17 @@ var V = [
|
|
|
233
227
|
})
|
|
234
228
|
]
|
|
235
229
|
}),
|
|
236
|
-
(
|
|
230
|
+
(R.errorMessage || R.errorCode) && /* @__PURE__ */ D(c, { children: [/* @__PURE__ */ D(d, { children: [/* @__PURE__ */ D(f, {
|
|
237
231
|
className: "flex items-center gap-2 text-status-error-text",
|
|
238
232
|
children: [/* @__PURE__ */ E(k, { size: 18 }), "Failure"]
|
|
239
|
-
}),
|
|
233
|
+
}), R.errorCode && /* @__PURE__ */ E(u, { children: R.errorCode })] }), /* @__PURE__ */ D(l, {
|
|
240
234
|
className: "space-y-3",
|
|
241
|
-
children: [
|
|
235
|
+
children: [R.errorMessage && /* @__PURE__ */ E("p", {
|
|
242
236
|
className: "text-sm text-text-primary",
|
|
243
|
-
children:
|
|
244
|
-
}),
|
|
237
|
+
children: R.errorMessage
|
|
238
|
+
}), R.errorDetails && /* @__PURE__ */ E("pre", {
|
|
245
239
|
className: "max-h-64 overflow-auto rounded-lg bg-bg-sunken p-3 font-mono text-xs",
|
|
246
|
-
children: JSON.stringify(
|
|
240
|
+
children: JSON.stringify(R.errorDetails, null, 2)
|
|
247
241
|
})]
|
|
248
242
|
})] }),
|
|
249
243
|
/* @__PURE__ */ D(c, { children: [/* @__PURE__ */ E(d, { children: /* @__PURE__ */ E(f, { children: "Run Details" }) }), /* @__PURE__ */ E(l, { children: /* @__PURE__ */ D("div", {
|
|
@@ -254,42 +248,42 @@ var V = [
|
|
|
254
248
|
children: "Execution ID"
|
|
255
249
|
}), /* @__PURE__ */ E("p", {
|
|
256
250
|
className: "font-mono text-sm break-all",
|
|
257
|
-
children:
|
|
251
|
+
children: R.id
|
|
258
252
|
})] }),
|
|
259
253
|
/* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("p", {
|
|
260
254
|
className: "text-sm text-text-secondary",
|
|
261
255
|
children: "Bot"
|
|
262
256
|
}), /* @__PURE__ */ E("p", {
|
|
263
257
|
className: "font-mono text-sm break-all",
|
|
264
|
-
children:
|
|
258
|
+
children: R.appId ?? "—"
|
|
265
259
|
})] }),
|
|
266
260
|
/* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("p", {
|
|
267
261
|
className: "text-sm text-text-secondary",
|
|
268
262
|
children: "Agent"
|
|
269
263
|
}), /* @__PURE__ */ E("p", {
|
|
270
264
|
className: "font-mono text-sm break-all",
|
|
271
|
-
children:
|
|
265
|
+
children: R.agentId ?? "—"
|
|
272
266
|
})] }),
|
|
273
267
|
/* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("p", {
|
|
274
268
|
className: "text-sm text-text-secondary",
|
|
275
269
|
children: "Conversation"
|
|
276
270
|
}), /* @__PURE__ */ E("p", {
|
|
277
271
|
className: "font-mono text-sm break-all",
|
|
278
|
-
children:
|
|
272
|
+
children: R.conversationId ?? "—"
|
|
279
273
|
})] }),
|
|
280
274
|
/* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("p", {
|
|
281
275
|
className: "text-sm text-text-secondary",
|
|
282
276
|
children: "Started"
|
|
283
277
|
}), /* @__PURE__ */ E("p", {
|
|
284
278
|
className: "font-medium",
|
|
285
|
-
children: S(
|
|
279
|
+
children: S(R.createdAt)
|
|
286
280
|
})] }),
|
|
287
281
|
/* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("p", {
|
|
288
282
|
className: "text-sm text-text-secondary",
|
|
289
283
|
children: "Completed"
|
|
290
284
|
}), /* @__PURE__ */ E("p", {
|
|
291
285
|
className: "font-medium",
|
|
292
|
-
children: S(
|
|
286
|
+
children: S(R.completedAt)
|
|
293
287
|
})] })
|
|
294
288
|
]
|
|
295
289
|
}) })] }),
|
|
@@ -297,24 +291,24 @@ var V = [
|
|
|
297
291
|
className: "grid grid-cols-1 gap-6 lg:grid-cols-2",
|
|
298
292
|
children: [/* @__PURE__ */ D(c, { children: [/* @__PURE__ */ E(d, { children: /* @__PURE__ */ E(f, { children: "Input" }) }), /* @__PURE__ */ E(l, { children: /* @__PURE__ */ E("pre", {
|
|
299
293
|
className: "max-h-96 overflow-auto whitespace-pre-wrap rounded-lg bg-bg-sunken p-3 text-sm",
|
|
300
|
-
children:
|
|
301
|
-
}) })] }), /* @__PURE__ */ D(c, { children: [/* @__PURE__ */ E(d, { children: /* @__PURE__ */ E(f, { children: "Output" }) }), /* @__PURE__ */ E(l, { children:
|
|
294
|
+
children: R.input
|
|
295
|
+
}) })] }), /* @__PURE__ */ D(c, { children: [/* @__PURE__ */ E(d, { children: /* @__PURE__ */ E(f, { children: "Output" }) }), /* @__PURE__ */ E(l, { children: R.output ? /* @__PURE__ */ E("pre", {
|
|
302
296
|
className: "max-h-96 overflow-auto whitespace-pre-wrap rounded-lg bg-bg-sunken p-3 text-sm",
|
|
303
|
-
children:
|
|
297
|
+
children: R.output
|
|
304
298
|
}) : /* @__PURE__ */ E("p", {
|
|
305
299
|
className: "text-sm text-text-secondary",
|
|
306
300
|
children: "This run has not produced an output yet."
|
|
307
301
|
}) })] })]
|
|
308
302
|
}),
|
|
309
|
-
/* @__PURE__ */ E(g, { metadata:
|
|
310
|
-
|
|
303
|
+
/* @__PURE__ */ E(g, { metadata: R.metadata }),
|
|
304
|
+
R.metadata && Object.keys(R.metadata).length > 0 && /* @__PURE__ */ D(c, { children: [/* @__PURE__ */ E(d, { children: /* @__PURE__ */ E(f, { children: "Metadata" }) }), /* @__PURE__ */ E(l, { children: /* @__PURE__ */ E("pre", {
|
|
311
305
|
className: "max-h-64 overflow-auto rounded-lg bg-bg-sunken p-3 font-mono text-xs",
|
|
312
|
-
children: JSON.stringify(
|
|
306
|
+
children: JSON.stringify(R.metadata, null, 2)
|
|
313
307
|
}) })] })
|
|
314
308
|
]
|
|
315
309
|
})
|
|
316
310
|
});
|
|
317
311
|
};
|
|
318
|
-
export {
|
|
312
|
+
export { G as ExecutionDetailPage };
|
|
319
313
|
|
|
320
314
|
//# sourceMappingURL=ExecutionDetailPage.js.map
|