@loopstack/loopstack-studio 0.29.4 → 0.30.0
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/_virtual/rolldown_runtime.js +3 -1
- package/dist/api/config.js +5 -4
- package/dist/api/environments.js +5 -1
- package/dist/api/processor.js +4 -1
- package/dist/app/EnvironmentEmbedRoot.js +22 -30
- package/dist/components/ai-elements/code-block.js +4 -4
- package/dist/components/dynamic-form/CodeContent.js +1 -1
- package/dist/components/dynamic-form/Form.js +31 -51
- package/dist/components/dynamic-form/FormBody.js +1 -1
- package/dist/components/motion/FadeIn.js +72 -0
- package/dist/components/motion/StreamingText.js +49 -0
- package/dist/components/ui/accordion.js +2 -2
- package/dist/components/ui-widgets/UiWidget.js +11 -10
- package/dist/components/ui-widgets/widgets/AiPromptInput.js +31 -28
- package/dist/events/sse-client-events.js +7 -1
- package/dist/features/code-explorer/components/FileContentViewer.js +2 -2
- package/dist/features/debug/components/WorkflowFlowViewer.js +49 -51
- package/dist/features/documents/DocumentRenderer.js +18 -17
- package/dist/features/documents/components/DocumentItem.js +42 -20
- package/dist/features/documents/components/DocumentList.js +34 -36
- package/dist/features/documents/components/DocumentMetadataPills.js +102 -49
- package/dist/features/documents/document-details/DocumentDetails.js +577 -377
- package/dist/features/documents/document-details/PromptDetails.js +118 -130
- package/dist/features/documents/document-details/document-debug-utils.js +100 -0
- package/dist/features/documents/renderers/ChoicesRenderer.js +41 -38
- package/dist/features/documents/renderers/ConfirmPromptRenderer.js +31 -28
- package/dist/features/documents/renderers/DocumentFormRenderer.js +62 -70
- package/dist/features/documents/renderers/LlmMessage.js +52 -47
- package/dist/features/documents/renderers/TextPromptRenderer.js +32 -29
- package/dist/features/documents/renderers/useDocumentTransition.js +4 -4
- package/dist/features/feature-registry/FeatureRegistryProvider.js +32 -10
- package/dist/features/feature-registry/available-features.js +12 -0
- package/dist/features/feature-registry/index.js +2 -1
- package/dist/features/file-explorer/components/FileExplorerPanel.js +55 -51
- package/dist/features/git/components/GitBranchBadge.js +31 -0
- package/dist/features/git/components/GitCommitList.js +46 -0
- package/dist/features/git/components/GitRemoteStatus.js +84 -0
- package/dist/features/git/components/WorkbenchGitPanel.js +81 -0
- package/dist/features/git/git-feature.js +12 -0
- package/dist/features/git/hooks/useGit.js +78 -0
- package/dist/features/git/index.js +1 -0
- package/dist/features/oauth/OAuthPromptRenderer.js +137 -142
- package/dist/features/runs/Runs.js +4 -4
- package/dist/features/secrets/components/WorkbenchSecretsPanel.js +1 -1
- package/dist/features/secrets/renderers/SecretInputRenderer.js +30 -29
- package/dist/features/workbench/Workbench.js +25 -33
- package/dist/features/workbench/WorkflowItem.js +9 -9
- package/dist/features/workbench/WorkflowList.js +61 -62
- package/dist/features/workbench/components/NewRunDialog.js +237 -209
- package/dist/features/workbench/components/RecentRunItem.js +3 -3
- package/dist/features/workbench/components/WorkbenchEnvironmentPanel.js +8 -8
- package/dist/features/workbench/components/WorkbenchIconSidebar.js +1 -1
- package/dist/features/workbench/components/WorkbenchSidebarShell.js +3 -3
- package/dist/features/workbench/components/WorkflowForms.js +11 -10
- package/dist/features/workbench/components/WorkflowHistoryItem.js +16 -36
- package/dist/features/workbench/components/WorkflowHistoryList.js +19 -17
- package/dist/features/workbench/components/buttons/WorkflowButtons.js +3 -3
- package/dist/features/workbench/hooks/useLlmStreamingDocuments.js +159 -0
- package/dist/features/workbench/hooks/useWorkflowData.js +58 -31
- package/dist/features/workbench/index.js +2 -2
- package/dist/features/workbench/providers/WorkbenchLayoutProvider.js +53 -53
- package/dist/features/workspaces/Workspaces.js +134 -125
- package/dist/features/workspaces/components/CreateWorkspace.js +115 -107
- package/dist/features/workspaces/components/ExecutionTimeline.js +2 -2
- package/dist/features/workspaces/components/WorkflowRunForm.js +127 -104
- package/dist/features/workspaces/components/WorkspaceHomePage.js +6 -89
- package/dist/features/workspaces/components/workflow-form/ArgumentsView.js +1 -1
- package/dist/features/workspaces/components/workflow-form/SelectionView.js +15 -15
- package/dist/hooks/index.js +3 -2
- package/dist/hooks/query-keys.js +43 -30
- package/dist/hooks/useConfig.js +28 -22
- package/dist/hooks/useEnvironments.js +27 -2
- package/dist/hooks/useProcessor.js +14 -1
- package/dist/hooks/useWorkflows.js +4 -4
- package/dist/index.d.ts +116 -15
- package/dist/index.js +9 -8
- package/dist/node_modules/d3/src/index.js +13 -13
- package/dist/node_modules/d3-scale/src/continuous.js +16 -16
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/architectureDiagram-3BPJPVTR.js +43 -43
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/blockDiagram-GPEHLZMM.js +270 -270
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-AAUBKEIU.js +90 -90
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-3OPIFGDE.js +458 -458
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-55IACEB6.js +3 -3
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-5ZQYHXKU.js +37 -37
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-727SXJPM.js +208 -208
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-KSCS5N6A.js +145 -145
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-ND2GUHAM.js +7 -7
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-O5CBEL6O.js +41 -41
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-WU5MYG2G.js +3 -3
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/cose-bilkent-S5V4N54A.js +6 -6
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-KO2AKTUF.js +30 -30
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/diagram-OG6HWLK6.js +82 -82
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/erDiagram-TEJ5UH35.js +65 -65
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/flowDiagram-I6XJVG4X.js +227 -227
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-6RSMTGT7.js +104 -104
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/gitGraphDiagram-PVQCEYII.js +104 -104
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/journeyDiagram-JHISSGLW.js +49 -49
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/quadrantDiagram-W4KKPZXB.js +101 -101
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sankeyDiagram-5OEKKPKP.js +20 -20
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-3UESZ5HK.js +354 -354
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-AJRCARHV.js +53 -53
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/timeline-definition-PNZ67QCA.js +113 -113
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/vennDiagram-CIIHVFJN.js +90 -90
- package/dist/node_modules/mermaid/dist/mermaid.core.js +156 -156
- package/dist/node_modules/motion/dist/es/react.js +9 -2
- package/dist/pages/DebugWorkflowDetailsPage.js +2 -2
- package/dist/pages/DebugWorkflowsPage.js +76 -106
- package/dist/pages/EmbedWorkbenchPage.js +1 -1
- package/dist/pages/PreviewWorkbenchPage.js +6 -6
- package/dist/pages/WorkbenchPage.js +43 -47
- package/dist/pages/WorkflowDebugPage.js +6 -12
- package/dist/pages/WorkspacePage.js +40 -66
- package/dist/pages/WorkspaceRunsPage.js +24 -31
- package/package.json +2 -2
|
@@ -1,146 +1,134 @@
|
|
|
1
1
|
import { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from "../../../components/ui/accordion.js";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
2
|
+
import { Badge } from "../../../components/ui/badge.js";
|
|
3
|
+
import { formatNumber } from "./document-debug-utils.js";
|
|
4
4
|
import { c } from "react/compiler-runtime";
|
|
5
5
|
import React from "react";
|
|
6
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
var
|
|
8
|
-
let
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}),
|
|
18
|
-
let
|
|
19
|
-
|
|
20
|
-
className: "text-sm",
|
|
21
|
-
children: [
|
|
22
|
-
}),
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
6
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
var DetailRow = (n) => {
|
|
8
|
+
let s = c(7), { label: l, children: u } = n, d;
|
|
9
|
+
s[0] === l ? d = s[1] : (d = /* @__PURE__ */ jsx("span", {
|
|
10
|
+
className: "text-muted-foreground font-medium",
|
|
11
|
+
children: l
|
|
12
|
+
}), s[0] = l, s[1] = d);
|
|
13
|
+
let f;
|
|
14
|
+
s[2] === u ? f = s[3] : (f = /* @__PURE__ */ jsx("span", {
|
|
15
|
+
className: "min-w-0 wrap-break-word",
|
|
16
|
+
children: u
|
|
17
|
+
}), s[2] = u, s[3] = f);
|
|
18
|
+
let p;
|
|
19
|
+
return s[4] !== d || s[5] !== f ? (p = /* @__PURE__ */ jsxs("div", {
|
|
20
|
+
className: "grid min-w-0 grid-cols-[7.5rem_1fr] gap-x-3 gap-y-0.5 text-sm",
|
|
21
|
+
children: [d, f]
|
|
22
|
+
}), s[4] = d, s[5] = f, s[6] = p) : p = s[6], p;
|
|
23
|
+
}, PromptDetails_default = (d) => {
|
|
24
|
+
let p = c(32), { promptData: m } = d;
|
|
25
|
+
if (!m) return null;
|
|
26
|
+
let { messages: h, response: g, cache: _ } = m, v = g?.metadata, y = v?.prompt_token != null && v?.completion_token != null ? v.prompt_token + v.completion_token : void 0, b;
|
|
27
|
+
p[0] === Symbol.for("react.memo_cache_sentinel") ? (b = ["summary", "messages"], p[0] = b) : b = p[0];
|
|
28
|
+
let x;
|
|
29
|
+
p[1] === Symbol.for("react.memo_cache_sentinel") ? (x = /* @__PURE__ */ jsx(AccordionTrigger, {
|
|
30
|
+
className: "py-3 text-sm font-semibold",
|
|
31
|
+
children: "Request summary"
|
|
32
|
+
}), p[1] = x) : x = p[1];
|
|
33
|
+
let S = h?.length ?? 0, C;
|
|
34
|
+
p[2] === S ? C = p[3] : (C = /* @__PURE__ */ jsx(DetailRow, {
|
|
35
|
+
label: "Messages",
|
|
36
|
+
children: S
|
|
37
|
+
}), p[2] = S, p[3] = C);
|
|
28
38
|
let w;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
children:
|
|
32
|
-
})
|
|
39
|
+
p[4] === _ ? w = p[5] : (w = _ && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(DetailRow, {
|
|
40
|
+
label: "Cache hit",
|
|
41
|
+
children: _.hit ? "Yes" : "No"
|
|
42
|
+
}), _.hash && /* @__PURE__ */ jsx(DetailRow, {
|
|
43
|
+
label: "Cache hash",
|
|
44
|
+
children: _.hash
|
|
45
|
+
})] }), p[4] = _, p[5] = w);
|
|
33
46
|
let T;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
children:
|
|
37
|
-
}),
|
|
47
|
+
p[6] === v ? T = p[7] : (T = v?.model && /* @__PURE__ */ jsx(DetailRow, {
|
|
48
|
+
label: "Model",
|
|
49
|
+
children: v.model
|
|
50
|
+
}), p[6] = v, p[7] = T);
|
|
38
51
|
let E;
|
|
39
|
-
|
|
52
|
+
p[8] === v ? E = p[9] : (E = v?.prompt_id && /* @__PURE__ */ jsx(DetailRow, {
|
|
53
|
+
label: "Prompt ID",
|
|
54
|
+
children: v.prompt_id
|
|
55
|
+
}), p[8] = v, p[9] = E);
|
|
40
56
|
let D;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
children: /* @__PURE__ */ jsxs(AccordionItem, {
|
|
46
|
-
value: "messages",
|
|
47
|
-
children: [T, /* @__PURE__ */ jsx(AccordionContent, { children: /* @__PURE__ */ jsx("div", {
|
|
48
|
-
className: "space-y-2",
|
|
49
|
-
children: E
|
|
50
|
-
}) })]
|
|
51
|
-
})
|
|
52
|
-
}), m[11] = E, m[12] = D);
|
|
57
|
+
p[10] === v ? D = p[11] : (D = v?.response_time != null && /* @__PURE__ */ jsxs(DetailRow, {
|
|
58
|
+
label: "Response time",
|
|
59
|
+
children: [v.response_time, " ms"]
|
|
60
|
+
}), p[10] = v, p[11] = D);
|
|
53
61
|
let O;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
children:
|
|
57
|
-
}),
|
|
58
|
-
let k
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
children:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
p[12] === v ? O = p[13] : (O = v?.prompt_token != null && /* @__PURE__ */ jsx(DetailRow, {
|
|
63
|
+
label: "Prompt tokens",
|
|
64
|
+
children: formatNumber(v.prompt_token)
|
|
65
|
+
}), p[12] = v, p[13] = O);
|
|
66
|
+
let k;
|
|
67
|
+
p[14] === v ? k = p[15] : (k = v?.completion_token != null && /* @__PURE__ */ jsx(DetailRow, {
|
|
68
|
+
label: "Completion tokens",
|
|
69
|
+
children: formatNumber(v.completion_token)
|
|
70
|
+
}), p[14] = v, p[15] = k);
|
|
71
|
+
let A;
|
|
72
|
+
p[16] === y ? A = p[17] : (A = y != null && /* @__PURE__ */ jsx(DetailRow, {
|
|
73
|
+
label: "Total tokens",
|
|
74
|
+
children: formatNumber(y)
|
|
75
|
+
}), p[16] = y, p[17] = A);
|
|
66
76
|
let j;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
children: /* @__PURE__ */ jsx(
|
|
70
|
-
className: "
|
|
71
|
-
children: "Metadata"
|
|
72
|
-
})
|
|
73
|
-
}), m[16] = j) : j = m[16];
|
|
74
|
-
let M = _?.metadata?.model, N;
|
|
75
|
-
m[17] === M ? N = m[18] : (N = /* @__PURE__ */ jsxs("p", {
|
|
76
|
-
className: "text-sm",
|
|
77
|
-
children: ["Model: ", M]
|
|
78
|
-
}), m[17] = M, m[18] = N);
|
|
79
|
-
let P = _?.metadata?.prompt_id, F;
|
|
80
|
-
m[19] === P ? F = m[20] : (F = /* @__PURE__ */ jsxs("p", {
|
|
81
|
-
className: "text-sm",
|
|
82
|
-
children: ["Prompt ID: ", P]
|
|
83
|
-
}), m[19] = P, m[20] = F);
|
|
84
|
-
let I = _?.metadata?.response_time, L;
|
|
85
|
-
m[21] === I ? L = m[22] : (L = /* @__PURE__ */ jsxs("p", {
|
|
86
|
-
className: "text-sm",
|
|
87
|
-
children: [
|
|
88
|
-
"Response Time: ",
|
|
89
|
-
I,
|
|
90
|
-
" ms"
|
|
91
|
-
]
|
|
92
|
-
}), m[21] = I, m[22] = L);
|
|
93
|
-
let R = _?.metadata?.prompt_token, z;
|
|
94
|
-
m[23] === R ? z = m[24] : (z = /* @__PURE__ */ jsxs("p", {
|
|
95
|
-
className: "text-sm",
|
|
96
|
-
children: ["Prompt Tokens: ", R]
|
|
97
|
-
}), m[23] = R, m[24] = z);
|
|
98
|
-
let B = _?.metadata?.completion_token, V;
|
|
99
|
-
m[25] === B ? V = m[26] : (V = /* @__PURE__ */ jsxs("p", {
|
|
100
|
-
className: "text-sm",
|
|
101
|
-
children: ["Completion Tokens: ", B]
|
|
102
|
-
}), m[25] = B, m[26] = V);
|
|
103
|
-
let H;
|
|
104
|
-
m[27] !== N || m[28] !== F || m[29] !== L || m[30] !== z || m[31] !== V ? (H = /* @__PURE__ */ jsxs(Card, {
|
|
105
|
-
className: "bg-gray-50",
|
|
106
|
-
children: [j, /* @__PURE__ */ jsx(CardContent, { children: /* @__PURE__ */ jsxs("div", {
|
|
107
|
-
className: "ml-4 space-y-1",
|
|
77
|
+
p[18] !== k || p[19] !== A || p[20] !== C || p[21] !== w || p[22] !== T || p[23] !== E || p[24] !== D || p[25] !== O ? (j = /* @__PURE__ */ jsxs(AccordionItem, {
|
|
78
|
+
value: "summary",
|
|
79
|
+
children: [x, /* @__PURE__ */ jsx(AccordionContent, { children: /* @__PURE__ */ jsxs("div", {
|
|
80
|
+
className: "space-y-2 pb-1",
|
|
108
81
|
children: [
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
82
|
+
C,
|
|
83
|
+
w,
|
|
84
|
+
T,
|
|
85
|
+
E,
|
|
86
|
+
D,
|
|
87
|
+
O,
|
|
88
|
+
k,
|
|
89
|
+
A
|
|
114
90
|
]
|
|
115
91
|
}) })]
|
|
116
|
-
}),
|
|
117
|
-
let
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
92
|
+
}), p[18] = k, p[19] = A, p[20] = C, p[21] = w, p[22] = T, p[23] = E, p[24] = D, p[25] = O, p[26] = j) : j = p[26];
|
|
93
|
+
let M;
|
|
94
|
+
p[27] === h ? M = p[28] : (M = h && h.length > 0 && /* @__PURE__ */ jsxs(AccordionItem, {
|
|
95
|
+
value: "messages",
|
|
96
|
+
children: [/* @__PURE__ */ jsx(AccordionTrigger, {
|
|
97
|
+
className: "py-3 text-sm font-semibold",
|
|
98
|
+
children: "Request messages"
|
|
99
|
+
}), /* @__PURE__ */ jsx(AccordionContent, { children: /* @__PURE__ */ jsx("div", {
|
|
100
|
+
className: "space-y-2",
|
|
101
|
+
children: h.map(_temp)
|
|
102
|
+
}) })]
|
|
103
|
+
}), p[27] = h, p[28] = M);
|
|
104
|
+
let N;
|
|
105
|
+
return p[29] !== j || p[30] !== M ? (N = /* @__PURE__ */ jsx("div", {
|
|
106
|
+
className: "min-w-0 space-y-3",
|
|
107
|
+
children: /* @__PURE__ */ jsxs(Accordion, {
|
|
108
|
+
type: "multiple",
|
|
109
|
+
defaultValue: b,
|
|
110
|
+
className: "min-w-0 space-y-1",
|
|
111
|
+
children: [j, M]
|
|
128
112
|
})
|
|
129
|
-
}),
|
|
130
|
-
let W;
|
|
131
|
-
return m[36] !== U || m[37] !== w || m[38] !== D ? (W = /* @__PURE__ */ jsxs("div", {
|
|
132
|
-
className: "mt-4 space-y-4",
|
|
133
|
-
children: [
|
|
134
|
-
w,
|
|
135
|
-
D,
|
|
136
|
-
U
|
|
137
|
-
]
|
|
138
|
-
}), m[36] = U, m[37] = w, m[38] = D, m[39] = W) : W = m[39], W;
|
|
113
|
+
}), p[29] = j, p[30] = M, p[31] = N) : N = p[31], N;
|
|
139
114
|
};
|
|
140
|
-
function _temp(
|
|
141
|
-
return /* @__PURE__ */
|
|
142
|
-
|
|
143
|
-
children:
|
|
144
|
-
|
|
115
|
+
function _temp(n, s) {
|
|
116
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
117
|
+
className: "min-w-0 rounded-md border p-3",
|
|
118
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
119
|
+
className: "mb-2 flex items-center gap-2",
|
|
120
|
+
children: [/* @__PURE__ */ jsx(Badge, {
|
|
121
|
+
variant: "outline",
|
|
122
|
+
className: "text-xs capitalize",
|
|
123
|
+
children: n.role
|
|
124
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
125
|
+
className: "text-muted-foreground text-xs",
|
|
126
|
+
children: [n.content.length, " chars"]
|
|
127
|
+
})]
|
|
128
|
+
}), /* @__PURE__ */ jsx("pre", {
|
|
129
|
+
className: "max-h-48 min-w-0 max-w-full overflow-x-auto overflow-y-auto font-mono text-xs whitespace-pre-wrap",
|
|
130
|
+
children: n.content
|
|
131
|
+
})]
|
|
132
|
+
}, s);
|
|
145
133
|
}
|
|
146
134
|
export { PromptDetails_default as default };
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
function summarizeDocumentContent(e) {
|
|
2
|
+
if (e == null) return { kind: "null" };
|
|
3
|
+
if (typeof e == "string") return {
|
|
4
|
+
kind: "string",
|
|
5
|
+
charCount: e.length
|
|
6
|
+
};
|
|
7
|
+
if (Array.isArray(e)) return {
|
|
8
|
+
kind: "array",
|
|
9
|
+
itemCount: e.length
|
|
10
|
+
};
|
|
11
|
+
if (typeof e != "object") return { kind: "unknown" };
|
|
12
|
+
let t = e;
|
|
13
|
+
if ("role" in t && "content" in t) {
|
|
14
|
+
let e = String(t.role), n = typeof t.id == "string" ? t.id : void 0, r = typeof t.stopReason == "string" ? t.stopReason : void 0, i = t.content;
|
|
15
|
+
if (typeof i == "string") return {
|
|
16
|
+
kind: "ui-message",
|
|
17
|
+
role: e,
|
|
18
|
+
messageId: n,
|
|
19
|
+
stopReason: r,
|
|
20
|
+
charCount: i.length
|
|
21
|
+
};
|
|
22
|
+
if (Array.isArray(i)) {
|
|
23
|
+
let t = i, a = /* @__PURE__ */ new Map();
|
|
24
|
+
for (let e of t) {
|
|
25
|
+
let t = a.get(e.type) ?? {
|
|
26
|
+
count: 0,
|
|
27
|
+
labels: []
|
|
28
|
+
};
|
|
29
|
+
t.count += 1, (e.type === "tool_call" || e.type === "server_tool_use") && t.labels.push(e.name), a.set(e.type, t);
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
kind: "ui-message",
|
|
33
|
+
role: e,
|
|
34
|
+
messageId: n,
|
|
35
|
+
stopReason: r,
|
|
36
|
+
charCount: t.reduce((e, t) => t.type === "text" || t.type === "thinking" ? e + t.text.length : t.type === "tool_result" ? e + t.content.length : e, 0),
|
|
37
|
+
blocks: [...a.entries()].map(([e, { count: t, labels: n }]) => ({
|
|
38
|
+
type: e,
|
|
39
|
+
count: t,
|
|
40
|
+
labels: n.length > 0 ? n : void 0
|
|
41
|
+
}))
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
kind: "object",
|
|
47
|
+
topLevelKeys: Object.keys(t),
|
|
48
|
+
charCount: JSON.stringify(e).length
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function extractApiResponseInfo(e) {
|
|
52
|
+
if (!e || typeof e != "object") return {};
|
|
53
|
+
let t = e;
|
|
54
|
+
if (t.usage && typeof t.usage == "object") {
|
|
55
|
+
let e = t.usage;
|
|
56
|
+
return {
|
|
57
|
+
model: typeof t.model == "string" ? t.model : void 0,
|
|
58
|
+
id: typeof t.id == "string" ? t.id : void 0,
|
|
59
|
+
stopReason: typeof t.stop_reason == "string" ? t.stop_reason : void 0,
|
|
60
|
+
usage: {
|
|
61
|
+
input: e.input_tokens,
|
|
62
|
+
output: e.output_tokens,
|
|
63
|
+
cacheRead: e.cache_read_input_tokens,
|
|
64
|
+
cacheWrite: e.cache_creation_input_tokens
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
if (Array.isArray(t.choices)) {
|
|
69
|
+
let e = t.choices[0], n = t.usage, r = n?.prompt_tokens_details;
|
|
70
|
+
return {
|
|
71
|
+
model: typeof t.model == "string" ? t.model : void 0,
|
|
72
|
+
id: typeof t.id == "string" ? t.id : void 0,
|
|
73
|
+
stopReason: typeof e?.finish_reason == "string" ? e.finish_reason : void 0,
|
|
74
|
+
usage: n ? {
|
|
75
|
+
input: n.prompt_tokens,
|
|
76
|
+
output: n.completion_tokens,
|
|
77
|
+
cacheRead: r?.cached_tokens,
|
|
78
|
+
reasoning: n.reasoning_tokens
|
|
79
|
+
} : void 0
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
return {};
|
|
83
|
+
}
|
|
84
|
+
function formatRelativeTime(e) {
|
|
85
|
+
let t = new Date(e).getTime();
|
|
86
|
+
if (Number.isNaN(t)) return String(e);
|
|
87
|
+
let n = Date.now() - t, r = Math.round(n / 1e3);
|
|
88
|
+
if (r < 60) return `${r}s ago`;
|
|
89
|
+
let i = Math.round(r / 60);
|
|
90
|
+
if (i < 60) return `${i}m ago`;
|
|
91
|
+
let a = Math.round(i / 60);
|
|
92
|
+
return a < 48 ? `${a}h ago` : `${Math.round(a / 24)}d ago`;
|
|
93
|
+
}
|
|
94
|
+
function formatDurationMs(e) {
|
|
95
|
+
return e < 1e3 ? `${e}ms` : e < 6e4 ? `${(e / 1e3).toFixed(1)}s` : `${Math.round(e / 6e4)}m ${Math.round(e % 6e4 / 1e3)}s`;
|
|
96
|
+
}
|
|
97
|
+
function formatNumber(e) {
|
|
98
|
+
return e == null ? "—" : e.toLocaleString();
|
|
99
|
+
}
|
|
100
|
+
export { extractApiResponseInfo, formatDurationMs, formatNumber, formatRelativeTime, summarizeDocumentContent };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useDocumentConfigs } from "../../../hooks/useConfig.js";
|
|
1
2
|
import { Button } from "../../../components/ui/button.js";
|
|
2
3
|
import { Label } from "../../../components/ui/label.js";
|
|
3
4
|
import { RadioGroup, RadioGroupItem } from "../../../components/ui/radio-group.js";
|
|
@@ -9,29 +10,31 @@ import { c } from "react/compiler-runtime";
|
|
|
9
10
|
import React, { useState } from "react";
|
|
10
11
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
12
|
import { Loader2 } from "lucide-react";
|
|
12
|
-
var ChoicesRenderer_default = (
|
|
13
|
-
let
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
let I;
|
|
21
|
-
|
|
22
|
-
let
|
|
23
|
-
|
|
13
|
+
var ChoicesRenderer_default = (_) => {
|
|
14
|
+
let v = c(29), { parentWorkflow: y, workflow: b, document: x, isActive: S } = _, C = x.content, w = useDocumentConfigs(), T;
|
|
15
|
+
v[0] !== x.documentName || v[1] !== w ? (T = w.get(x.documentName), v[0] = x.documentName, v[1] = w, v[2] = T) : T = v[2];
|
|
16
|
+
let { submit: E, canSubmit: D, isLoading: O } = useDocumentTransition(y, b, T), [k, A] = useState(C.answer ?? ""), [j, M] = useState(""), N = k === "__custom__", P = !!C.answer, F;
|
|
17
|
+
v[3] !== j || v[4] !== N || v[5] !== k || v[6] !== E ? (F = () => {
|
|
18
|
+
let t = N ? j.trim() : k;
|
|
19
|
+
t && E({ answer: t });
|
|
20
|
+
}, v[3] = j, v[4] = N, v[5] = k, v[6] = E, v[7] = F) : F = v[7];
|
|
21
|
+
let I = F, L = !S || !D || P, R;
|
|
22
|
+
v[8] === x.createdAt ? R = v[9] : (R = new Date(x.createdAt), v[8] = x.createdAt, v[9] = R);
|
|
23
|
+
let z;
|
|
24
|
+
v[10] === C.question ? z = v[11] : (z = /* @__PURE__ */ jsx(MarkdownContent_default, { content: C.question }), v[10] = C.question, v[11] = z);
|
|
25
|
+
let B;
|
|
26
|
+
v[12] !== C.allowCustomAnswer || v[13] !== C.answer || v[14] !== C.options || v[15] !== j || v[16] !== L || v[17] !== I || v[18] !== P || v[19] !== N || v[20] !== O || v[21] !== k ? (B = P ? /* @__PURE__ */ jsxs("div", {
|
|
24
27
|
className: "text-muted-foreground text-sm",
|
|
25
28
|
children: ["Answered: ", /* @__PURE__ */ jsx("span", {
|
|
26
29
|
className: "text-foreground font-medium",
|
|
27
|
-
children:
|
|
30
|
+
children: C.answer
|
|
28
31
|
})]
|
|
29
32
|
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
30
33
|
/* @__PURE__ */ jsxs(RadioGroup, {
|
|
31
|
-
value:
|
|
32
|
-
onValueChange:
|
|
33
|
-
disabled:
|
|
34
|
-
children: [
|
|
34
|
+
value: k,
|
|
35
|
+
onValueChange: A,
|
|
36
|
+
disabled: L,
|
|
37
|
+
children: [C.options.map(_temp), C.allowCustomAnswer && /* @__PURE__ */ jsxs("div", {
|
|
35
38
|
className: "flex items-center gap-3",
|
|
36
39
|
children: [/* @__PURE__ */ jsx(RadioGroupItem, {
|
|
37
40
|
value: "__custom__",
|
|
@@ -43,11 +46,11 @@ var ChoicesRenderer_default = (g) => {
|
|
|
43
46
|
})]
|
|
44
47
|
})]
|
|
45
48
|
}),
|
|
46
|
-
|
|
49
|
+
N && /* @__PURE__ */ jsx(Textarea, {
|
|
47
50
|
placeholder: "Type your answer...",
|
|
48
|
-
value:
|
|
49
|
-
onChange: (t) =>
|
|
50
|
-
disabled:
|
|
51
|
+
value: j,
|
|
52
|
+
onChange: (t) => M(t.target.value),
|
|
53
|
+
disabled: L,
|
|
51
54
|
className: "min-h-10",
|
|
52
55
|
rows: 2
|
|
53
56
|
}),
|
|
@@ -56,37 +59,37 @@ var ChoicesRenderer_default = (g) => {
|
|
|
56
59
|
children: /* @__PURE__ */ jsxs(Button, {
|
|
57
60
|
type: "button",
|
|
58
61
|
variant: "default",
|
|
59
|
-
disabled:
|
|
60
|
-
onClick:
|
|
62
|
+
disabled: L || O || !k || N && !j.trim(),
|
|
63
|
+
onClick: I,
|
|
61
64
|
className: "w-48",
|
|
62
|
-
children: [
|
|
65
|
+
children: [O && /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }), "Submit"]
|
|
63
66
|
})
|
|
64
67
|
})
|
|
65
|
-
] }),
|
|
66
|
-
let
|
|
67
|
-
|
|
68
|
+
] }), v[12] = C.allowCustomAnswer, v[13] = C.answer, v[14] = C.options, v[15] = j, v[16] = L, v[17] = I, v[18] = P, v[19] = N, v[20] = O, v[21] = k, v[22] = B) : B = v[22];
|
|
69
|
+
let V;
|
|
70
|
+
v[23] !== z || v[24] !== B ? (V = /* @__PURE__ */ jsxs("div", {
|
|
68
71
|
className: "flex flex-col gap-4 p-1",
|
|
69
|
-
children: [
|
|
70
|
-
}),
|
|
71
|
-
let
|
|
72
|
-
return
|
|
72
|
+
children: [z, B]
|
|
73
|
+
}), v[23] = z, v[24] = B, v[25] = V) : V = v[25];
|
|
74
|
+
let H;
|
|
75
|
+
return v[26] !== R || v[27] !== V ? (H = /* @__PURE__ */ jsx(CompletionMessagePaper_default, {
|
|
73
76
|
role: "document",
|
|
74
77
|
fullWidth: !0,
|
|
75
|
-
timestamp:
|
|
76
|
-
children:
|
|
77
|
-
}),
|
|
78
|
+
timestamp: R,
|
|
79
|
+
children: V
|
|
80
|
+
}), v[26] = R, v[27] = V, v[28] = H) : H = v[28], H;
|
|
78
81
|
};
|
|
79
|
-
function _temp(t,
|
|
82
|
+
function _temp(t, g) {
|
|
80
83
|
return /* @__PURE__ */ jsxs("div", {
|
|
81
84
|
className: "flex items-center gap-3",
|
|
82
85
|
children: [/* @__PURE__ */ jsx(RadioGroupItem, {
|
|
83
86
|
value: t,
|
|
84
|
-
id: `option-${
|
|
87
|
+
id: `option-${g}`
|
|
85
88
|
}), /* @__PURE__ */ jsx(Label, {
|
|
86
|
-
htmlFor: `option-${
|
|
89
|
+
htmlFor: `option-${g}`,
|
|
87
90
|
className: "cursor-pointer text-sm font-normal",
|
|
88
91
|
children: t
|
|
89
92
|
})]
|
|
90
|
-
},
|
|
93
|
+
}, g);
|
|
91
94
|
}
|
|
92
95
|
export { ChoicesRenderer_default as default };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useDocumentConfigs } from "../../../hooks/useConfig.js";
|
|
1
2
|
import { Button } from "../../../components/ui/button.js";
|
|
2
3
|
import CompletionMessagePaper_default from "../../../components/messages/CompletionMessagePaper.js";
|
|
3
4
|
import MarkdownContent_default from "../../../components/dynamic-form/MarkdownContent.js";
|
|
@@ -6,51 +7,53 @@ import { c } from "react/compiler-runtime";
|
|
|
6
7
|
import React from "react";
|
|
7
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
9
|
import { Loader2 } from "lucide-react";
|
|
9
|
-
var ConfirmPromptRenderer_default = (
|
|
10
|
-
let
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
let w;
|
|
17
|
-
|
|
18
|
-
let
|
|
19
|
-
|
|
10
|
+
var ConfirmPromptRenderer_default = (u) => {
|
|
11
|
+
let d = c(21), { parentWorkflow: f, workflow: p, document: m, isActive: h } = u, g = m.content, _ = useDocumentConfigs(), v;
|
|
12
|
+
d[0] !== m.documentName || d[1] !== _ ? (v = _.get(m.documentName), d[0] = m.documentName, d[1] = _, d[2] = v) : v = d[2];
|
|
13
|
+
let { submit: y, canSubmit: b, isLoading: x } = useDocumentTransition(f, p, v), S = !!g.answer, C = !h || !b || S, w;
|
|
14
|
+
d[3] === y ? w = d[4] : (w = (t) => {
|
|
15
|
+
y({ answer: t });
|
|
16
|
+
}, d[3] = y, d[4] = w);
|
|
17
|
+
let T = w, E;
|
|
18
|
+
d[5] === m.createdAt ? E = d[6] : (E = new Date(m.createdAt), d[5] = m.createdAt, d[6] = E);
|
|
19
|
+
let D;
|
|
20
|
+
d[7] === g.question ? D = d[8] : (D = /* @__PURE__ */ jsx(MarkdownContent_default, { content: g.question }), d[7] = g.question, d[8] = D);
|
|
21
|
+
let O;
|
|
22
|
+
d[9] !== g.answer || d[10] !== C || d[11] !== T || d[12] !== S || d[13] !== x ? (O = S ? /* @__PURE__ */ jsxs("div", {
|
|
20
23
|
className: "text-muted-foreground text-sm",
|
|
21
24
|
children: ["Answered: ", /* @__PURE__ */ jsx("span", {
|
|
22
25
|
className: "text-foreground font-medium",
|
|
23
|
-
children:
|
|
26
|
+
children: g.answer === "yes" ? "Yes" : "No"
|
|
24
27
|
})]
|
|
25
28
|
}) : /* @__PURE__ */ jsxs("div", {
|
|
26
29
|
className: "flex justify-end gap-3",
|
|
27
30
|
children: [/* @__PURE__ */ jsxs(Button, {
|
|
28
31
|
type: "button",
|
|
29
32
|
variant: "outline",
|
|
30
|
-
disabled:
|
|
31
|
-
onClick: () =>
|
|
33
|
+
disabled: C || x,
|
|
34
|
+
onClick: () => T("no"),
|
|
32
35
|
className: "w-32",
|
|
33
|
-
children: [
|
|
36
|
+
children: [x && /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }), "No"]
|
|
34
37
|
}), /* @__PURE__ */ jsxs(Button, {
|
|
35
38
|
type: "button",
|
|
36
39
|
variant: "default",
|
|
37
|
-
disabled:
|
|
38
|
-
onClick: () =>
|
|
40
|
+
disabled: C || x,
|
|
41
|
+
onClick: () => T("yes"),
|
|
39
42
|
className: "w-32",
|
|
40
|
-
children: [
|
|
43
|
+
children: [x && /* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }), "Yes"]
|
|
41
44
|
})]
|
|
42
|
-
}),
|
|
43
|
-
let
|
|
44
|
-
|
|
45
|
+
}), d[9] = g.answer, d[10] = C, d[11] = T, d[12] = S, d[13] = x, d[14] = O) : O = d[14];
|
|
46
|
+
let k;
|
|
47
|
+
d[15] !== D || d[16] !== O ? (k = /* @__PURE__ */ jsxs("div", {
|
|
45
48
|
className: "flex flex-col gap-4 p-1",
|
|
46
|
-
children: [
|
|
47
|
-
}),
|
|
48
|
-
let
|
|
49
|
-
return
|
|
49
|
+
children: [D, O]
|
|
50
|
+
}), d[15] = D, d[16] = O, d[17] = k) : k = d[17];
|
|
51
|
+
let A;
|
|
52
|
+
return d[18] !== E || d[19] !== k ? (A = /* @__PURE__ */ jsx(CompletionMessagePaper_default, {
|
|
50
53
|
role: "document",
|
|
51
54
|
fullWidth: !0,
|
|
52
|
-
timestamp:
|
|
53
|
-
children:
|
|
54
|
-
}),
|
|
55
|
+
timestamp: E,
|
|
56
|
+
children: k
|
|
57
|
+
}), d[18] = E, d[19] = k, d[20] = A) : A = d[20], A;
|
|
55
58
|
};
|
|
56
59
|
export { ConfirmPromptRenderer_default as default };
|