@burdenoff/microfe-bigconsole 2026.624.2 → 2026.625.1
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/bigconsole/BigConsoleRoutes.js +93 -93
- package/dist/bigconsole/assistant/assistantApi.js +215 -0
- package/dist/bigconsole/assistant/assistantApi.js.map +1 -0
- package/dist/bigconsole/assistant/createSandboxAssistantTransport.js +119 -0
- package/dist/bigconsole/assistant/createSandboxAssistantTransport.js.map +1 -0
- package/dist/bigconsole/assistant/index.js +2 -0
- package/dist/bigconsole/assistant/pageContext.js +51 -0
- package/dist/bigconsole/assistant/pageContext.js.map +1 -0
- package/dist/bigconsole/components/dashboard/CreateDashboardDialog.js +48 -48
- package/dist/bigconsole/components/dashboard/DashboardToolbar.js +52 -52
- package/dist/bigconsole/components/dashboard/DrilldownBreadcrumb.js.map +1 -1
- package/dist/bigconsole/components/dashboard/ExportDashboardDialog.js +33 -33
- package/dist/bigconsole/components/dashboard/ImportDashboardDialog.js +179 -179
- package/dist/bigconsole/components/dashboard/ImportDashboardDialog.js.map +1 -1
- package/dist/bigconsole/components/dashboard/WidgetPalette.js +38 -38
- package/dist/bigconsole/components/datasink/DataSinkTableViewer.js +32 -32
- package/dist/bigconsole/components/datasink/ExportDataSinkDialog.js +31 -31
- package/dist/bigconsole/components/datasink/ImportDataSinkDialog.js +98 -98
- package/dist/bigconsole/components/datasink/ImportDataSinkDialog.js.map +1 -1
- package/dist/bigconsole/components/parser/ExportParserDialog.js +31 -31
- package/dist/bigconsole/components/parser/ImportParserDialog.js +162 -162
- package/dist/bigconsole/components/parser/ImportParserDialog.js.map +1 -1
- package/dist/bigconsole/components/widgets/ActionConfigDialog.js +79 -79
- package/dist/bigconsole/components/widgets/ActionConfigDialog.js.map +1 -1
- package/dist/bigconsole/components/widgets/DrilldownConfigPanel.js.map +1 -1
- package/dist/bigconsole/components/widgets/PropertiesPanel.js +307 -307
- package/dist/bigconsole/components/widgets/PropertiesPanel.js.map +1 -1
- package/dist/bigconsole/components/widgets/WidgetConfigDialog.js +222 -222
- package/dist/bigconsole/components/widgets/WidgetConfigDialog.js.map +1 -1
- package/dist/bigconsole/components/widgets/WidgetTypeSelector.js +23 -23
- package/dist/bigconsole/index.js +3 -0
- package/dist/bigconsole/pages/DashboardBuilderPage.js +74 -74
- package/dist/bigconsole/pages/DashboardBuilderPage.js.map +1 -1
- package/dist/bigconsole/pages/DashboardViewPage.js +168 -189
- package/dist/bigconsole/pages/DashboardViewPage.js.map +1 -1
- package/dist/bigconsole/pages/DashboardsPage.js +266 -310
- package/dist/bigconsole/pages/DashboardsPage.js.map +1 -1
- package/dist/bigconsole/pages/DataParsersPage.js +148 -194
- package/dist/bigconsole/pages/DataParsersPage.js.map +1 -1
- package/dist/bigconsole/pages/DataSinkBuilderPage.js +252 -246
- package/dist/bigconsole/pages/DataSinkBuilderPage.js.map +1 -1
- package/dist/bigconsole/pages/DataSinkViewPage.js +256 -231
- package/dist/bigconsole/pages/DataSinkViewPage.js.map +1 -1
- package/dist/bigconsole/pages/DataSinksPage.js +173 -219
- package/dist/bigconsole/pages/DataSinksPage.js.map +1 -1
- package/dist/bigconsole/pages/HomePage.js +125 -141
- package/dist/bigconsole/pages/HomePage.js.map +1 -1
- package/dist/bigconsole/pages/InsightsPage.js +159 -184
- package/dist/bigconsole/pages/InsightsPage.js.map +1 -1
- package/dist/bigconsole/pages/ParserBuilderPage.js +401 -393
- package/dist/bigconsole/pages/ParserBuilderPage.js.map +1 -1
- package/dist/bigconsole/pages/ParserViewPage.js +220 -201
- package/dist/bigconsole/pages/ParserViewPage.js.map +1 -1
- package/dist/bigconsole/pages/PipelineBuilderPage.js +212 -206
- package/dist/bigconsole/pages/PipelineBuilderPage.js.map +1 -1
- package/dist/bigconsole/pages/PipelineViewPage.js +204 -181
- package/dist/bigconsole/pages/PipelineViewPage.js.map +1 -1
- package/dist/bigconsole/pages/PipelinesPage.js +107 -150
- package/dist/bigconsole/pages/PipelinesPage.js.map +1 -1
- package/dist/bigconsole/pages/SettingsPage.js +184 -171
- package/dist/bigconsole/pages/SettingsPage.js.map +1 -1
- package/dist/bigconsole/pages/WidgetDemoPage.js +69 -81
- package/dist/bigconsole/pages/WidgetDemoPage.js.map +1 -1
- package/dist/bigconsole/pages/WorkflowViewPage.js +230 -216
- package/dist/bigconsole/pages/WorkflowViewPage.js.map +1 -1
- package/dist/bigconsole/pages/WorkflowsPage.js +106 -149
- package/dist/bigconsole/pages/WorkflowsPage.js.map +1 -1
- package/dist/generated/wspace-operations.js +87 -36
- package/dist/generated/wspace-operations.js.map +1 -1
- package/dist/index.js +3 -1
- package/package.json +6 -2
|
@@ -5,20 +5,20 @@ import n from "./hooks/useWorkflowOperations.js";
|
|
|
5
5
|
import { BOOTSTRAP_RETRY_DELAY_MS as r } from "./constants.js";
|
|
6
6
|
import { Suspense as i, lazy as a, memo as o, useEffect as s, useMemo as c, useRef as l, useState as u } from "react";
|
|
7
7
|
import { Navigate as d, Route as f, Routes as p, useParams as m } from "react-router-dom";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { Spinner as h } from "@burdenoff/fe-libs/ui";
|
|
9
|
+
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
10
10
|
import { ExecutionDetailPage as v, ExecutionsListPage as y, HistoryPage as b, NodesPage as x, SettingsPage as S, TemplatesPage as C, WorkflowBuilderPage as w } from "@burdenoff/fluidgrids-fe-sdk";
|
|
11
11
|
//#region src/bigconsole/BigConsoleRoutes.tsx
|
|
12
12
|
var T = a(() => import("./pages/DashboardsPage.js")), E = a(() => import("./pages/DashboardViewPage.js")), D = a(() => import("./pages/DashboardBuilderPage.js")), O = a(() => import("./pages/DataSourcesPage.js")), k = a(() => import("./pages/InsightsPage.js")), A = a(() => import("./pages/SettingsPage.js")), j = a(() => import("./pages/WidgetDemoPage.js")), M = a(() => import("./pages/WorkflowsPage.js").then((e) => ({ default: e.WorkflowsPage }))), N = a(() => import("./pages/WorkflowViewPage.js").then((e) => ({ default: e.WorkflowViewPage }))), P = a(() => import("./pages/DataSinksPage.js")), F = a(() => import("./pages/DataSinkViewPage.js")), I = a(() => import("./pages/DataSinkBuilderPage.js")), L = a(() => import("./pages/DataParsersPage.js")), R = a(() => import("./pages/ParserViewPage.js")), z = a(() => import("./pages/ParserBuilderPage.js")), B = a(() => import("./pages/PipelinesPage.js")), V = a(() => import("./pages/PipelineViewPage.js")), H = a(() => import("./pages/PipelineBuilderPage.js"));
|
|
13
13
|
function U() {
|
|
14
|
-
return /* @__PURE__ */
|
|
14
|
+
return /* @__PURE__ */ g("div", {
|
|
15
15
|
className: "flex items-center justify-center min-h-[400px]",
|
|
16
|
-
children: /* @__PURE__ */ h
|
|
16
|
+
children: /* @__PURE__ */ g(h, { className: "h-8 w-8" })
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
var W = () => `/workflows/workflow/${crypto.randomUUID()}/v1`;
|
|
20
20
|
function G() {
|
|
21
|
-
return /* @__PURE__ */
|
|
21
|
+
return /* @__PURE__ */ g(d, {
|
|
22
22
|
to: c(() => W(), []),
|
|
23
23
|
replace: !0
|
|
24
24
|
});
|
|
@@ -47,188 +47,188 @@ var K = o(function() {
|
|
|
47
47
|
t,
|
|
48
48
|
a,
|
|
49
49
|
i
|
|
50
|
-
]), o ? /* @__PURE__ */
|
|
50
|
+
]), o ? /* @__PURE__ */ _("div", {
|
|
51
51
|
className: "p-6 flex flex-col items-center justify-center min-h-[400px] text-center gap-4",
|
|
52
|
-
children: [/* @__PURE__ */
|
|
52
|
+
children: [/* @__PURE__ */ g("p", {
|
|
53
53
|
className: "text-sm text-text-secondary",
|
|
54
54
|
children: o
|
|
55
|
-
}), /* @__PURE__ */
|
|
55
|
+
}), /* @__PURE__ */ g("button", {
|
|
56
56
|
type: "button",
|
|
57
57
|
onClick: () => i("/workflows"),
|
|
58
58
|
className: "px-4 py-2 text-sm font-medium text-text-primary bg-bg-sunken hover:bg-border-default rounded-md transition-colors",
|
|
59
59
|
children: "Back to Workflows"
|
|
60
60
|
})]
|
|
61
|
-
}) : /* @__PURE__ */
|
|
61
|
+
}) : /* @__PURE__ */ g("div", {
|
|
62
62
|
className: "flex items-center justify-center min-h-[400px]",
|
|
63
|
-
children: /* @__PURE__ */ h
|
|
63
|
+
children: /* @__PURE__ */ g(h, { className: "h-8 w-8" })
|
|
64
64
|
});
|
|
65
65
|
});
|
|
66
66
|
function q(e) {
|
|
67
|
-
return /* @__PURE__ */
|
|
68
|
-
fallback: /* @__PURE__ */
|
|
69
|
-
children: /* @__PURE__ */
|
|
70
|
-
/* @__PURE__ */
|
|
67
|
+
return /* @__PURE__ */ g(i, {
|
|
68
|
+
fallback: /* @__PURE__ */ g(U, {}),
|
|
69
|
+
children: /* @__PURE__ */ _(p, { children: [
|
|
70
|
+
/* @__PURE__ */ g(f, {
|
|
71
71
|
path: "/",
|
|
72
|
-
element: /* @__PURE__ */
|
|
72
|
+
element: /* @__PURE__ */ g(t, {})
|
|
73
73
|
}),
|
|
74
|
-
/* @__PURE__ */
|
|
74
|
+
/* @__PURE__ */ g(f, {
|
|
75
75
|
path: "/dashboards",
|
|
76
|
-
element: /* @__PURE__ */
|
|
76
|
+
element: /* @__PURE__ */ g(T, {})
|
|
77
77
|
}),
|
|
78
|
-
/* @__PURE__ */
|
|
78
|
+
/* @__PURE__ */ g(f, {
|
|
79
79
|
path: "/dashboards/:dashboardId",
|
|
80
|
-
element: /* @__PURE__ */
|
|
80
|
+
element: /* @__PURE__ */ g(E, {})
|
|
81
81
|
}),
|
|
82
|
-
/* @__PURE__ */
|
|
82
|
+
/* @__PURE__ */ g(f, {
|
|
83
83
|
path: "/dashboards/:dashboardId/builder",
|
|
84
|
-
element: /* @__PURE__ */
|
|
84
|
+
element: /* @__PURE__ */ g(D, {})
|
|
85
85
|
}),
|
|
86
|
-
/* @__PURE__ */
|
|
86
|
+
/* @__PURE__ */ g(f, {
|
|
87
87
|
path: "/datasources",
|
|
88
|
-
element: /* @__PURE__ */
|
|
88
|
+
element: /* @__PURE__ */ g(O, {})
|
|
89
89
|
}),
|
|
90
|
-
/* @__PURE__ */
|
|
90
|
+
/* @__PURE__ */ g(f, {
|
|
91
91
|
path: "/insights",
|
|
92
|
-
element: /* @__PURE__ */
|
|
92
|
+
element: /* @__PURE__ */ g(k, {})
|
|
93
93
|
}),
|
|
94
|
-
/* @__PURE__ */
|
|
94
|
+
/* @__PURE__ */ g(f, {
|
|
95
95
|
path: "/settings",
|
|
96
|
-
element: /* @__PURE__ */
|
|
96
|
+
element: /* @__PURE__ */ g(A, {})
|
|
97
97
|
}),
|
|
98
|
-
/* @__PURE__ */
|
|
98
|
+
/* @__PURE__ */ g(f, {
|
|
99
99
|
path: "/widgets/demo",
|
|
100
|
-
element: /* @__PURE__ */
|
|
100
|
+
element: /* @__PURE__ */ g(j, {})
|
|
101
101
|
}),
|
|
102
|
-
/* @__PURE__ */
|
|
102
|
+
/* @__PURE__ */ g(f, {
|
|
103
103
|
path: "/datasinks",
|
|
104
|
-
element: /* @__PURE__ */
|
|
104
|
+
element: /* @__PURE__ */ g(P, {})
|
|
105
105
|
}),
|
|
106
|
-
/* @__PURE__ */
|
|
106
|
+
/* @__PURE__ */ g(f, {
|
|
107
107
|
path: "/datasinks/new",
|
|
108
|
-
element: /* @__PURE__ */
|
|
108
|
+
element: /* @__PURE__ */ g(I, {})
|
|
109
109
|
}),
|
|
110
|
-
/* @__PURE__ */
|
|
110
|
+
/* @__PURE__ */ g(f, {
|
|
111
111
|
path: "/datasinks/:dataSinkId",
|
|
112
|
-
element: /* @__PURE__ */
|
|
112
|
+
element: /* @__PURE__ */ g(F, {})
|
|
113
113
|
}),
|
|
114
|
-
/* @__PURE__ */
|
|
114
|
+
/* @__PURE__ */ g(f, {
|
|
115
115
|
path: "/datasinks/:dataSinkId/edit",
|
|
116
|
-
element: /* @__PURE__ */
|
|
116
|
+
element: /* @__PURE__ */ g(I, {})
|
|
117
117
|
}),
|
|
118
|
-
/* @__PURE__ */
|
|
118
|
+
/* @__PURE__ */ g(f, {
|
|
119
119
|
path: "/parsers",
|
|
120
|
-
element: /* @__PURE__ */
|
|
120
|
+
element: /* @__PURE__ */ g(L, {})
|
|
121
121
|
}),
|
|
122
|
-
/* @__PURE__ */
|
|
122
|
+
/* @__PURE__ */ g(f, {
|
|
123
123
|
path: "/parsers/new",
|
|
124
|
-
element: /* @__PURE__ */
|
|
124
|
+
element: /* @__PURE__ */ g(z, {})
|
|
125
125
|
}),
|
|
126
|
-
/* @__PURE__ */
|
|
126
|
+
/* @__PURE__ */ g(f, {
|
|
127
127
|
path: "/parsers/:parserId",
|
|
128
|
-
element: /* @__PURE__ */
|
|
128
|
+
element: /* @__PURE__ */ g(R, {})
|
|
129
129
|
}),
|
|
130
|
-
/* @__PURE__ */
|
|
130
|
+
/* @__PURE__ */ g(f, {
|
|
131
131
|
path: "/parsers/:parserId/edit",
|
|
132
|
-
element: /* @__PURE__ */
|
|
132
|
+
element: /* @__PURE__ */ g(z, {})
|
|
133
133
|
}),
|
|
134
|
-
/* @__PURE__ */
|
|
134
|
+
/* @__PURE__ */ g(f, {
|
|
135
135
|
path: "/dashboards/:consoleId/parsers",
|
|
136
|
-
element: /* @__PURE__ */
|
|
136
|
+
element: /* @__PURE__ */ g(L, {})
|
|
137
137
|
}),
|
|
138
|
-
/* @__PURE__ */
|
|
138
|
+
/* @__PURE__ */ g(f, {
|
|
139
139
|
path: "/dashboards/:consoleId/parsers/new",
|
|
140
|
-
element: /* @__PURE__ */
|
|
140
|
+
element: /* @__PURE__ */ g(z, {})
|
|
141
141
|
}),
|
|
142
|
-
/* @__PURE__ */
|
|
142
|
+
/* @__PURE__ */ g(f, {
|
|
143
143
|
path: "/dashboards/:consoleId/parsers/:parserId",
|
|
144
|
-
element: /* @__PURE__ */
|
|
144
|
+
element: /* @__PURE__ */ g(R, {})
|
|
145
145
|
}),
|
|
146
|
-
/* @__PURE__ */
|
|
146
|
+
/* @__PURE__ */ g(f, {
|
|
147
147
|
path: "/dashboards/:consoleId/parsers/:parserId/edit",
|
|
148
|
-
element: /* @__PURE__ */
|
|
148
|
+
element: /* @__PURE__ */ g(z, {})
|
|
149
149
|
}),
|
|
150
|
-
/* @__PURE__ */
|
|
150
|
+
/* @__PURE__ */ g(f, {
|
|
151
151
|
path: "/workflows",
|
|
152
|
-
element: /* @__PURE__ */
|
|
152
|
+
element: /* @__PURE__ */ g(M, {})
|
|
153
153
|
}),
|
|
154
|
-
/* @__PURE__ */
|
|
154
|
+
/* @__PURE__ */ g(f, {
|
|
155
155
|
path: "/workflows/list",
|
|
156
|
-
element: /* @__PURE__ */
|
|
156
|
+
element: /* @__PURE__ */ g(M, {})
|
|
157
157
|
}),
|
|
158
|
-
/* @__PURE__ */
|
|
158
|
+
/* @__PURE__ */ g(f, {
|
|
159
159
|
path: "/workflows/new",
|
|
160
|
-
element: /* @__PURE__ */
|
|
160
|
+
element: /* @__PURE__ */ g(G, {})
|
|
161
161
|
}),
|
|
162
|
-
/* @__PURE__ */
|
|
162
|
+
/* @__PURE__ */ g(f, {
|
|
163
163
|
path: "/workflows/builder",
|
|
164
|
-
element: /* @__PURE__ */
|
|
164
|
+
element: /* @__PURE__ */ g(w, {})
|
|
165
165
|
}),
|
|
166
|
-
/* @__PURE__ */
|
|
166
|
+
/* @__PURE__ */ g(f, {
|
|
167
167
|
path: "/workflows/builder/:id/:version",
|
|
168
|
-
element: /* @__PURE__ */
|
|
168
|
+
element: /* @__PURE__ */ g(w, {})
|
|
169
169
|
}),
|
|
170
|
-
/* @__PURE__ */
|
|
170
|
+
/* @__PURE__ */ g(f, {
|
|
171
171
|
path: "/workflows/workflow/:id/:version",
|
|
172
|
-
element: /* @__PURE__ */
|
|
172
|
+
element: /* @__PURE__ */ g(w, {})
|
|
173
173
|
}),
|
|
174
|
-
/* @__PURE__ */
|
|
174
|
+
/* @__PURE__ */ g(f, {
|
|
175
175
|
path: "/workflows/runs",
|
|
176
|
-
element: /* @__PURE__ */
|
|
176
|
+
element: /* @__PURE__ */ g(y, {})
|
|
177
177
|
}),
|
|
178
|
-
/* @__PURE__ */
|
|
178
|
+
/* @__PURE__ */ g(f, {
|
|
179
179
|
path: "/workflows/runs/:runId",
|
|
180
|
-
element: /* @__PURE__ */
|
|
180
|
+
element: /* @__PURE__ */ g(v, {})
|
|
181
181
|
}),
|
|
182
|
-
/* @__PURE__ */
|
|
182
|
+
/* @__PURE__ */ g(f, {
|
|
183
183
|
path: "/workflows/history",
|
|
184
|
-
element: /* @__PURE__ */
|
|
184
|
+
element: /* @__PURE__ */ g(b, {})
|
|
185
185
|
}),
|
|
186
|
-
/* @__PURE__ */
|
|
186
|
+
/* @__PURE__ */ g(f, {
|
|
187
187
|
path: "/workflows/templates",
|
|
188
|
-
element: /* @__PURE__ */
|
|
188
|
+
element: /* @__PURE__ */ g(C, {})
|
|
189
189
|
}),
|
|
190
|
-
/* @__PURE__ */
|
|
190
|
+
/* @__PURE__ */ g(f, {
|
|
191
191
|
path: "/workflows/nodes",
|
|
192
|
-
element: /* @__PURE__ */
|
|
192
|
+
element: /* @__PURE__ */ g(x, {})
|
|
193
193
|
}),
|
|
194
|
-
/* @__PURE__ */
|
|
194
|
+
/* @__PURE__ */ g(f, {
|
|
195
195
|
path: "/workflows/settings",
|
|
196
|
-
element: /* @__PURE__ */
|
|
196
|
+
element: /* @__PURE__ */ g(S, {})
|
|
197
197
|
}),
|
|
198
|
-
/* @__PURE__ */
|
|
198
|
+
/* @__PURE__ */ g(f, {
|
|
199
199
|
path: "/workflows/:workflowId",
|
|
200
|
-
element: /* @__PURE__ */
|
|
200
|
+
element: /* @__PURE__ */ g(N, {})
|
|
201
201
|
}),
|
|
202
|
-
/* @__PURE__ */
|
|
202
|
+
/* @__PURE__ */ g(f, {
|
|
203
203
|
path: "/workflows/:workflowId/edit",
|
|
204
|
-
element: /* @__PURE__ */
|
|
204
|
+
element: /* @__PURE__ */ g(K, {})
|
|
205
205
|
}),
|
|
206
|
-
/* @__PURE__ */
|
|
206
|
+
/* @__PURE__ */ g(f, {
|
|
207
207
|
path: "/workflow/:id/:version",
|
|
208
|
-
element: /* @__PURE__ */
|
|
208
|
+
element: /* @__PURE__ */ g(w, {})
|
|
209
209
|
}),
|
|
210
|
-
/* @__PURE__ */
|
|
210
|
+
/* @__PURE__ */ g(f, {
|
|
211
211
|
path: "/list",
|
|
212
|
-
element: /* @__PURE__ */
|
|
212
|
+
element: /* @__PURE__ */ g(d, {
|
|
213
213
|
to: "/bigconsole/workflows/list",
|
|
214
214
|
replace: !0
|
|
215
215
|
})
|
|
216
216
|
}),
|
|
217
|
-
/* @__PURE__ */
|
|
217
|
+
/* @__PURE__ */ g(f, {
|
|
218
218
|
path: "/pipelines",
|
|
219
|
-
element: /* @__PURE__ */
|
|
219
|
+
element: /* @__PURE__ */ g(B, {})
|
|
220
220
|
}),
|
|
221
|
-
/* @__PURE__ */
|
|
221
|
+
/* @__PURE__ */ g(f, {
|
|
222
222
|
path: "/pipelines/new",
|
|
223
|
-
element: /* @__PURE__ */
|
|
223
|
+
element: /* @__PURE__ */ g(H, {})
|
|
224
224
|
}),
|
|
225
|
-
/* @__PURE__ */
|
|
225
|
+
/* @__PURE__ */ g(f, {
|
|
226
226
|
path: "/pipelines/:pipelineId",
|
|
227
|
-
element: /* @__PURE__ */
|
|
227
|
+
element: /* @__PURE__ */ g(V, {})
|
|
228
228
|
}),
|
|
229
|
-
/* @__PURE__ */
|
|
229
|
+
/* @__PURE__ */ g(f, {
|
|
230
230
|
path: "/pipelines/:pipelineId/edit",
|
|
231
|
-
element: /* @__PURE__ */
|
|
231
|
+
element: /* @__PURE__ */ g(H, {})
|
|
232
232
|
})
|
|
233
233
|
] })
|
|
234
234
|
});
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { CreateSandboxDocument as e, ExtendSandboxTtlDocument as t, GetActiveSandboxesDocument as n, GetSandboxDocument as r, ProxySandboxRequestDocument as i } from "../../generated/wspace-operations.js";
|
|
2
|
+
import { print as a } from "graphql";
|
|
3
|
+
//#region src/bigconsole/assistant/assistantApi.ts
|
|
4
|
+
var o = "burdenoffregistry.azurecr.io", s = "alpha-proxy-auth-v1", c = "alpha-proxy-auth-v1", l = "alpha-delegated-auth-v11", u = "sandbox-app-client-headers-v1";
|
|
5
|
+
function d(e) {
|
|
6
|
+
switch (e) {
|
|
7
|
+
case "general": return s;
|
|
8
|
+
case "vibe-plugins": return c;
|
|
9
|
+
case "assistant":
|
|
10
|
+
case "api-calls": return l;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function f(e) {
|
|
14
|
+
return `${o}/wspace/ai-assistant-${e === "assistant" ? "api-calls" : e}:${d(e)}`;
|
|
15
|
+
}
|
|
16
|
+
function p(e) {
|
|
17
|
+
switch (e) {
|
|
18
|
+
case "general": return {
|
|
19
|
+
cpuRequest: "100m",
|
|
20
|
+
cpuLimit: "500m",
|
|
21
|
+
memoryRequest: "256Mi",
|
|
22
|
+
memoryLimit: "1Gi"
|
|
23
|
+
};
|
|
24
|
+
case "vibe-plugins":
|
|
25
|
+
case "assistant":
|
|
26
|
+
case "api-calls": return {
|
|
27
|
+
cpuRequest: "150m",
|
|
28
|
+
cpuLimit: "750m",
|
|
29
|
+
memoryRequest: "384Mi",
|
|
30
|
+
memoryLimit: "1536Mi"
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function m(e) {
|
|
35
|
+
let t = e.metadata?.assistantMode;
|
|
36
|
+
if (t === "assistant" || t === "general" || t === "api-calls" || t === "vibe-plugins") return t;
|
|
37
|
+
let n = e.name ?? "";
|
|
38
|
+
return n.startsWith("ai-assistant-vibe-plugins-") ? "vibe-plugins" : n.startsWith("ai-assistant-api-calls-") ? "api-calls" : n.startsWith("ai-assistant-general-") ? "general" : n.startsWith("ai-assistant-assistant-") ? "assistant" : null;
|
|
39
|
+
}
|
|
40
|
+
function h(e, t) {
|
|
41
|
+
let n = {};
|
|
42
|
+
return t?.accessToken && (n.authorization = `Bearer ${t.accessToken}`), t?.workspaceToken && (n["x-workspace-authorization"] = `Bearer ${t.workspaceToken}`), e && (n["x-workspace-id"] = e), t?.userId && (n["x-actor-id"] = t.userId, n["x-actor-type"] = "user"), t?.organizationId && (n["x-org-id"] = t.organizationId), Object.keys(n).length > 0 ? { headers: n } : void 0;
|
|
43
|
+
}
|
|
44
|
+
function g(e, t) {
|
|
45
|
+
return {
|
|
46
|
+
workspaceId: e,
|
|
47
|
+
...t?.organizationId ? { custom: { organizationId: t.organizationId } } : {}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
async function _(e) {
|
|
51
|
+
let t = await fetch("/workspaces/graphql", {
|
|
52
|
+
method: "POST",
|
|
53
|
+
headers: {
|
|
54
|
+
"Content-Type": "application/json",
|
|
55
|
+
...h(e.workspaceId, e.authContext)?.headers ?? {}
|
|
56
|
+
},
|
|
57
|
+
body: JSON.stringify({
|
|
58
|
+
query: a(e.document),
|
|
59
|
+
variables: e.variables
|
|
60
|
+
})
|
|
61
|
+
}), n = await t.json().catch(() => null);
|
|
62
|
+
if (!t.ok) {
|
|
63
|
+
let e = n?.errors?.map((e) => e.message).join(", "), r = Error(e || `Sandbox GraphQL HTTP ${t.status}`);
|
|
64
|
+
throw r.statusCode = t.status, r.result = n ?? void 0, r;
|
|
65
|
+
}
|
|
66
|
+
if (!n) throw Error("Sandbox GraphQL returned empty response");
|
|
67
|
+
if (n.errors?.length) throw Error(n.errors.map((e) => e.message).join(", "));
|
|
68
|
+
if (!n.data) throw Error("Sandbox GraphQL returned no data");
|
|
69
|
+
return n.data;
|
|
70
|
+
}
|
|
71
|
+
async function v(e, t, r) {
|
|
72
|
+
return ((await _({
|
|
73
|
+
document: n,
|
|
74
|
+
variables: { context: g(e, r) },
|
|
75
|
+
workspaceId: e,
|
|
76
|
+
authContext: r
|
|
77
|
+
})).getActiveSandboxes ?? []).find((e) => (e.status === "RUNNING" || e.status === "PROVISIONING" || e.status === "PENDING") && e.template === "AI_BUILDER" && m(e) === t && (!r?.userId || e.createdBy === r.userId) && e.metadata?.authStrategy === u && e.metadata?.imageTag === d(t))?.id ?? null;
|
|
78
|
+
}
|
|
79
|
+
async function y(t, n, r) {
|
|
80
|
+
let i = p(t), a = [
|
|
81
|
+
{
|
|
82
|
+
name: "AI_ASSISTANT_MODE",
|
|
83
|
+
value: t
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: "HOSTNAME",
|
|
87
|
+
value: "0.0.0.0"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: "WORKSPACE_ID",
|
|
91
|
+
value: n
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: "AI_ASSISTANT_PRODUCT",
|
|
95
|
+
value: "bigconsole"
|
|
96
|
+
}
|
|
97
|
+
], o = await _({
|
|
98
|
+
document: e,
|
|
99
|
+
variables: { input: {
|
|
100
|
+
name: `ai-assistant-${t}-${Date.now()}`,
|
|
101
|
+
description: `AI Assistant sandbox (${t} mode)`,
|
|
102
|
+
template: "AI_BUILDER",
|
|
103
|
+
mode: "DEPLOYMENT",
|
|
104
|
+
containers: [{
|
|
105
|
+
name: "ai-assistant",
|
|
106
|
+
image: f(t),
|
|
107
|
+
ports: [{
|
|
108
|
+
containerPort: 8080,
|
|
109
|
+
name: "http"
|
|
110
|
+
}],
|
|
111
|
+
env: a
|
|
112
|
+
}],
|
|
113
|
+
resources: {
|
|
114
|
+
cpuRequest: i.cpuRequest,
|
|
115
|
+
cpuLimit: i.cpuLimit,
|
|
116
|
+
memoryRequest: i.memoryRequest,
|
|
117
|
+
memoryLimit: i.memoryLimit
|
|
118
|
+
},
|
|
119
|
+
ttlSeconds: 600,
|
|
120
|
+
metadata: {
|
|
121
|
+
assistantMode: t,
|
|
122
|
+
assistantOwnerUserId: r?.userId ?? null,
|
|
123
|
+
assistantOrganizationId: r?.organizationId ?? null,
|
|
124
|
+
authStrategy: u,
|
|
125
|
+
imageTag: d(t)
|
|
126
|
+
},
|
|
127
|
+
context: g(n, r)
|
|
128
|
+
} },
|
|
129
|
+
workspaceId: n,
|
|
130
|
+
authContext: r
|
|
131
|
+
});
|
|
132
|
+
if (!o?.createSandbox?.id) throw Error("createSandbox returned empty response");
|
|
133
|
+
return o.createSandbox.id;
|
|
134
|
+
}
|
|
135
|
+
async function b(e, t, n, i = 3e5) {
|
|
136
|
+
let a = Date.now();
|
|
137
|
+
for (; Date.now() - a < i;) {
|
|
138
|
+
let i = await _({
|
|
139
|
+
document: r,
|
|
140
|
+
variables: {
|
|
141
|
+
id: e,
|
|
142
|
+
context: g(t, n)
|
|
143
|
+
},
|
|
144
|
+
workspaceId: t,
|
|
145
|
+
authContext: n
|
|
146
|
+
}), a = i?.getSandbox?.status, o = i?.getSandbox?.errorMessage;
|
|
147
|
+
if (a === "RUNNING") return;
|
|
148
|
+
if (a === "FAILED" || a === "STOPPED" || a === "EXPIRED") throw Error(o ? `Sandbox ${a.toLowerCase()}: ${o}` : `Sandbox ${a.toLowerCase()}`);
|
|
149
|
+
await new Promise((e) => setTimeout(e, 2e3));
|
|
150
|
+
}
|
|
151
|
+
throw Error("Sandbox startup timed out");
|
|
152
|
+
}
|
|
153
|
+
async function x(e, t, n, r, a, o) {
|
|
154
|
+
let s = (await _({
|
|
155
|
+
document: i,
|
|
156
|
+
variables: { input: {
|
|
157
|
+
sandboxId: e,
|
|
158
|
+
path: n,
|
|
159
|
+
method: r,
|
|
160
|
+
body: a,
|
|
161
|
+
context: g(t, o)
|
|
162
|
+
} },
|
|
163
|
+
workspaceId: t,
|
|
164
|
+
authContext: o
|
|
165
|
+
})).proxySandboxRequest;
|
|
166
|
+
if (!s || s.status >= 400) {
|
|
167
|
+
let e = s?.body;
|
|
168
|
+
throw Error(e?.error ?? `Proxy error: ${s?.status ?? "unknown"}`);
|
|
169
|
+
}
|
|
170
|
+
return s.body;
|
|
171
|
+
}
|
|
172
|
+
async function S(e, t, n, r = 9e4) {
|
|
173
|
+
let i = Date.now();
|
|
174
|
+
for (; Date.now() - i < r;) {
|
|
175
|
+
try {
|
|
176
|
+
await x(e, t, "/health", "GET", void 0, n);
|
|
177
|
+
return;
|
|
178
|
+
} catch (e) {
|
|
179
|
+
let t = e instanceof Error ? e.message : String(e);
|
|
180
|
+
if (!/proxy error: 502|proxy error: 503|proxy error: 404|service not available/i.test(t)) throw e;
|
|
181
|
+
}
|
|
182
|
+
await new Promise((e) => setTimeout(e, 2e3));
|
|
183
|
+
}
|
|
184
|
+
throw Error("Assistant service did not become healthy before timeout");
|
|
185
|
+
}
|
|
186
|
+
async function C(e, t, n, r) {
|
|
187
|
+
return { sessionId: (await x(e, t, "/sessions", "POST", { mode: n }, r)).session.id };
|
|
188
|
+
}
|
|
189
|
+
async function w(e, t, n, r, i, a, o) {
|
|
190
|
+
let s = {
|
|
191
|
+
mode: i,
|
|
192
|
+
prompt: r,
|
|
193
|
+
pageContext: a ?? void 0
|
|
194
|
+
};
|
|
195
|
+
await x(e, t, `/sessions/${n}/prompt-async`, "POST", s, o);
|
|
196
|
+
}
|
|
197
|
+
async function T(e, t, n, r, i = 50) {
|
|
198
|
+
return (await x(e, t, `/sessions/${n}/messages?limit=${i}`, "GET", void 0, r)).messages ?? [];
|
|
199
|
+
}
|
|
200
|
+
async function E(e, n, r = 600, i) {
|
|
201
|
+
await _({
|
|
202
|
+
document: t,
|
|
203
|
+
variables: {
|
|
204
|
+
id: e,
|
|
205
|
+
additionalSeconds: r,
|
|
206
|
+
context: g(n, i)
|
|
207
|
+
},
|
|
208
|
+
workspaceId: n,
|
|
209
|
+
authContext: i
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
//#endregion
|
|
213
|
+
export { y as createAssistantSandbox, C as createAssistantSession, E as extendAssistantSandboxTTL, v as findExistingSandbox, T as getAssistantMessages, w as sendAssistantPromptAsync, S as waitForAssistantServiceReady, b as waitForSandboxReady };
|
|
214
|
+
|
|
215
|
+
//# sourceMappingURL=assistantApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assistantApi.js","names":[],"sources":["../../../src/bigconsole/assistant/assistantApi.ts"],"sourcesContent":["/**\n * AI Assistant API service for BigConsole.\n *\n * All requests go through the wspace-public-gateway (GraphQL Federation):\n * Frontend → wspace-public-gateway → wspace-sandbox-svc → ai-assistant (sandbox)\n *\n * This is a faithful port of microfe-vibecontrols' `services/assistantApi.ts`,\n * adapted for BigConsole: the only product-specific difference is\n * `AI_ASSISTANT_PRODUCT=bigconsole` in the sandbox container env (drives the\n * agent's per-product docs fetch + system prompt).\n */\n\nimport { print, type DocumentNode } from 'graphql';\nimport type { AssistantMode, AssistantRawMessage, AssistantSandboxAuthContext } from './types';\nimport type { PageContext } from './pageContext';\nimport {\n CreateSandboxDocument,\n GetSandboxDocument,\n GetActiveSandboxesDocument,\n ProxySandboxRequestDocument,\n ExtendSandboxTtlDocument,\n} from '../../generated/wspace-operations';\n\n// ── Image registry ─────────────────────────────────────────────────\n\nconst ACR_REGISTRY = 'burdenoffregistry.azurecr.io';\nconst GENERAL_IMAGE_TAG = import.meta.env.VITE_APP_ENV === 'prod' ? 'prod' : 'alpha-proxy-auth-v1';\nconst VIBE_PLUGINS_IMAGE_TAG = import.meta.env.VITE_APP_ENV === 'prod' ? 'prod' : 'alpha-proxy-auth-v1';\nconst API_CALLS_IMAGE_TAG = import.meta.env.VITE_APP_ENV === 'prod' ? 'prod' : 'alpha-delegated-auth-v11';\nconst ASSISTANT_API_AUTH_STRATEGY = 'sandbox-app-client-headers-v1';\n\nfunction getImageTagForMode(mode: AssistantMode): string {\n switch (mode) {\n case 'general':\n return GENERAL_IMAGE_TAG;\n case 'vibe-plugins':\n return VIBE_PLUGINS_IMAGE_TAG;\n // The combined default mode runs in the api-calls image (it can make calls).\n case 'assistant':\n case 'api-calls':\n return API_CALLS_IMAGE_TAG;\n }\n}\n\nfunction getImageForMode(mode: AssistantMode): string {\n // `assistant` reuses the api-calls image — one image, mode selected at runtime\n // via AI_ASSISTANT_MODE. So the image segment is api-calls for both.\n const imageMode = mode === 'assistant' ? 'api-calls' : mode;\n return `${ACR_REGISTRY}/wspace/ai-assistant-${imageMode}:${getImageTagForMode(mode)}`;\n}\n\nfunction getResourcesForMode(mode: AssistantMode): {\n cpuRequest: string;\n cpuLimit: string;\n memoryRequest: string;\n memoryLimit: string;\n} {\n switch (mode) {\n case 'general':\n return {\n cpuRequest: '100m',\n cpuLimit: '500m',\n memoryRequest: '256Mi',\n memoryLimit: '1Gi',\n };\n case 'vibe-plugins':\n case 'assistant':\n case 'api-calls':\n return {\n cpuRequest: '150m',\n cpuLimit: '750m',\n memoryRequest: '384Mi',\n memoryLimit: '1536Mi',\n };\n }\n}\n\nfunction resolveSandboxAssistantMode(sandbox: {\n metadata: Record<string, unknown> | null;\n name?: string | null;\n}): AssistantMode | null {\n const metadataMode = sandbox.metadata?.assistantMode;\n if (\n metadataMode === 'assistant' ||\n metadataMode === 'general' ||\n metadataMode === 'api-calls' ||\n metadataMode === 'vibe-plugins'\n ) {\n return metadataMode;\n }\n\n const name = sandbox.name ?? '';\n if (name.startsWith('ai-assistant-vibe-plugins-')) return 'vibe-plugins';\n if (name.startsWith('ai-assistant-api-calls-')) return 'api-calls';\n if (name.startsWith('ai-assistant-general-')) return 'general';\n if (name.startsWith('ai-assistant-assistant-')) return 'assistant';\n return null;\n}\n\n// ── Types ───────────────────────────────────────────────────────────\n\ninterface GraphQLResponse<TData> {\n data?: TData;\n errors?: Array<{ message: string }>;\n}\n\ninterface ProxyResponse {\n proxySandboxRequest: {\n status: number;\n body: Record<string, unknown>;\n };\n}\n\nfunction getGatewayRequestContext(\n workspaceId: string,\n authContext?: AssistantSandboxAuthContext\n): { headers?: Record<string, string> } | undefined {\n const headers: Record<string, string> = {};\n\n if (authContext?.accessToken) {\n headers.authorization = `Bearer ${authContext.accessToken}`;\n }\n\n if (authContext?.workspaceToken) {\n headers['x-workspace-authorization'] = `Bearer ${authContext.workspaceToken}`;\n }\n\n if (workspaceId) {\n headers['x-workspace-id'] = workspaceId;\n }\n\n if (authContext?.userId) {\n headers['x-actor-id'] = authContext.userId;\n headers['x-actor-type'] = 'user';\n }\n\n if (authContext?.organizationId) {\n headers['x-org-id'] = authContext.organizationId;\n }\n\n return Object.keys(headers).length > 0 ? { headers } : undefined;\n}\n\nfunction buildSandboxContextInput(\n workspaceId: string,\n authContext?: AssistantSandboxAuthContext\n): Record<string, unknown> {\n return {\n workspaceId,\n ...(authContext?.organizationId\n ? {\n custom: {\n organizationId: authContext.organizationId,\n },\n }\n : {}),\n };\n}\n\nasync function executeSandboxGraphQL<TData>(params: {\n document: DocumentNode;\n variables: Record<string, unknown>;\n workspaceId: string;\n authContext?: AssistantSandboxAuthContext;\n}): Promise<TData> {\n const response = await fetch('/workspaces/graphql', {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n ...(getGatewayRequestContext(params.workspaceId, params.authContext)?.headers ?? {}),\n },\n body: JSON.stringify({\n query: print(params.document),\n variables: params.variables,\n }),\n });\n\n const result = (await response.json().catch(() => null)) as GraphQLResponse<TData> | null;\n\n if (!response.ok) {\n const messages = result?.errors?.map((error: { message: string }) => error.message).join(', ');\n const httpError = new Error(messages || `Sandbox GraphQL HTTP ${response.status}`) as Error & {\n statusCode?: number;\n result?: unknown;\n };\n httpError.statusCode = response.status;\n httpError.result = result ?? undefined;\n throw httpError;\n }\n\n if (!result) {\n throw new Error('Sandbox GraphQL returned empty response');\n }\n\n if (result.errors?.length) {\n throw new Error(result.errors.map((error: { message: string }) => error.message).join(', '));\n }\n\n if (!result.data) {\n throw new Error('Sandbox GraphQL returned no data');\n }\n\n return result.data;\n}\n\n// ── Find existing sandbox for a mode ───────────────────────────────\n\nexport async function findExistingSandbox(\n workspaceId: string,\n mode: AssistantMode,\n authContext?: AssistantSandboxAuthContext\n): Promise<string | null> {\n const data = await executeSandboxGraphQL<{\n getActiveSandboxes: Array<{\n id: string;\n name: string;\n status: string;\n metadata: Record<string, unknown> | null;\n template: string;\n createdBy: string;\n }>;\n }>({\n document: GetActiveSandboxesDocument,\n variables: { context: buildSandboxContextInput(workspaceId, authContext) },\n workspaceId,\n authContext,\n });\n const sandboxes = data.getActiveSandboxes ?? [];\n\n return (\n sandboxes.find(\n (s) =>\n (s.status === 'RUNNING' || s.status === 'PROVISIONING' || s.status === 'PENDING') &&\n s.template === 'AI_BUILDER' &&\n resolveSandboxAssistantMode(s) === mode &&\n (!authContext?.userId || s.createdBy === authContext.userId) &&\n s.metadata?.authStrategy === ASSISTANT_API_AUTH_STRATEGY &&\n s.metadata?.imageTag === getImageTagForMode(mode)\n )?.id ?? null\n );\n}\n\n// ── Sandbox lifecycle ──────────────────────────────────────────────\n\nexport async function createAssistantSandbox(\n mode: AssistantMode,\n workspaceId: string,\n authContext?: AssistantSandboxAuthContext\n): Promise<string> {\n const resources = getResourcesForMode(mode);\n const env = [\n { name: 'AI_ASSISTANT_MODE', value: mode },\n { name: 'HOSTNAME', value: '0.0.0.0' },\n { name: 'WORKSPACE_ID', value: workspaceId },\n // Product the user is in — drives the agent's dynamic per-product docs fetch\n // (the docs repo is `<product>-docs`) and personalizes its system prompt.\n // This package is the BigConsole MFE, so the product is bigconsole.\n { name: 'AI_ASSISTANT_PRODUCT', value: 'bigconsole' },\n ];\n\n const data = await executeSandboxGraphQL<{ createSandbox: { id: string } }>({\n document: CreateSandboxDocument,\n variables: {\n input: {\n name: `ai-assistant-${mode}-${Date.now()}`,\n description: `AI Assistant sandbox (${mode} mode)`,\n template: 'AI_BUILDER',\n mode: 'DEPLOYMENT',\n containers: [\n {\n name: 'ai-assistant',\n image: getImageForMode(mode),\n // The agent (start-assistant.sh) binds :8080; the sandbox svc proxies\n // to this declared containerPort, so it MUST be 8080.\n ports: [{ containerPort: 8080, name: 'http' }],\n env,\n },\n ],\n resources: {\n cpuRequest: resources.cpuRequest,\n cpuLimit: resources.cpuLimit,\n memoryRequest: resources.memoryRequest,\n memoryLimit: resources.memoryLimit,\n },\n ttlSeconds: 600,\n metadata: {\n assistantMode: mode,\n assistantOwnerUserId: authContext?.userId ?? null,\n assistantOrganizationId: authContext?.organizationId ?? null,\n authStrategy: ASSISTANT_API_AUTH_STRATEGY,\n imageTag: getImageTagForMode(mode),\n },\n context: buildSandboxContextInput(workspaceId, authContext),\n },\n },\n workspaceId,\n authContext,\n });\n\n if (!data?.createSandbox?.id) {\n throw new Error('createSandbox returned empty response');\n }\n return data.createSandbox.id;\n}\n\nexport async function waitForSandboxReady(\n sandboxId: string,\n workspaceId: string,\n authContext?: AssistantSandboxAuthContext,\n maxWaitMs = 300_000\n): Promise<void> {\n const start = Date.now();\n while (Date.now() - start < maxWaitMs) {\n const data = await executeSandboxGraphQL<{\n getSandbox: { status?: string; errorMessage?: string } | null;\n }>({\n document: GetSandboxDocument,\n variables: { id: sandboxId, context: buildSandboxContextInput(workspaceId, authContext) },\n workspaceId,\n authContext,\n });\n const status = data?.getSandbox?.status;\n const errorMessage = data?.getSandbox?.errorMessage as string | undefined;\n if (status === 'RUNNING') return;\n if (status === 'FAILED' || status === 'STOPPED' || status === 'EXPIRED') {\n throw new Error(\n errorMessage ? `Sandbox ${status.toLowerCase()}: ${errorMessage}` : `Sandbox ${status.toLowerCase()}`\n );\n }\n await new Promise((r) => setTimeout(r, 2000));\n }\n throw new Error('Sandbox startup timed out');\n}\n\n// ── Proxy calls to ai-assistant (via gateway → sandbox-svc) ───────\n\nasync function proxyToSandbox(\n sandboxId: string,\n workspaceId: string,\n path: string,\n method: string,\n body?: unknown,\n authContext?: AssistantSandboxAuthContext\n): Promise<Record<string, unknown>> {\n const result = await executeSandboxGraphQL<ProxyResponse>({\n document: ProxySandboxRequestDocument,\n variables: {\n input: {\n sandboxId,\n path,\n method,\n body,\n context: buildSandboxContextInput(workspaceId, authContext),\n },\n },\n workspaceId,\n authContext,\n });\n\n const proxyResult = result.proxySandboxRequest;\n if (!proxyResult || proxyResult.status >= 400) {\n const errBody = proxyResult?.body as Record<string, unknown> | undefined;\n throw new Error((errBody?.error as string) ?? `Proxy error: ${proxyResult?.status ?? 'unknown'}`);\n }\n\n return proxyResult.body;\n}\n\nexport async function waitForAssistantServiceReady(\n sandboxId: string,\n workspaceId: string,\n authContext?: AssistantSandboxAuthContext,\n maxWaitMs = 90_000\n): Promise<void> {\n const startedAt = Date.now();\n\n while (Date.now() - startedAt < maxWaitMs) {\n try {\n await proxyToSandbox(sandboxId, workspaceId, '/health', 'GET', undefined, authContext);\n return;\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error);\n if (!/proxy error: 502|proxy error: 503|proxy error: 404|service not available/i.test(message)) {\n throw error;\n }\n }\n\n await new Promise((resolve) => setTimeout(resolve, 2000));\n }\n\n throw new Error('Assistant service did not become healthy before timeout');\n}\n\n// ── Session management ─────────────────────────────────────────────\n\nexport async function createAssistantSession(\n sandboxId: string,\n workspaceId: string,\n mode: AssistantMode,\n authContext?: AssistantSandboxAuthContext\n): Promise<{ sessionId: string }> {\n const body = await proxyToSandbox(sandboxId, workspaceId, '/sessions', 'POST', { mode }, authContext);\n const session = body.session as Record<string, unknown>;\n return { sessionId: session.id as string };\n}\n\n// ── Send prompt ────────────────────────────────────────────────────\n\nexport async function sendAssistantPromptAsync(\n sandboxId: string,\n workspaceId: string,\n sessionId: string,\n prompt: string,\n mode: AssistantMode,\n pageContext?: PageContext,\n authContext?: AssistantSandboxAuthContext\n): Promise<void> {\n const requestBody = {\n mode,\n prompt,\n pageContext: pageContext ?? undefined,\n };\n\n await proxyToSandbox(sandboxId, workspaceId, `/sessions/${sessionId}/prompt-async`, 'POST', requestBody, authContext);\n}\n\nexport async function getAssistantMessages(\n sandboxId: string,\n workspaceId: string,\n sessionId: string,\n authContext?: AssistantSandboxAuthContext,\n limit = 50\n): Promise<AssistantRawMessage[]> {\n const body = await proxyToSandbox(\n sandboxId,\n workspaceId,\n `/sessions/${sessionId}/messages?limit=${limit}`,\n 'GET',\n undefined,\n authContext\n );\n\n return (body.messages as AssistantRawMessage[] | undefined) ?? [];\n}\n\n// ── TTL extension (keep the sandbox warm across the turn) ──────────\n\nexport async function extendAssistantSandboxTTL(\n sandboxId: string,\n workspaceId: string,\n additionalSeconds = 600,\n authContext?: AssistantSandboxAuthContext\n): Promise<void> {\n await executeSandboxGraphQL<{ extendSandboxTTL: { id: string } }>({\n document: ExtendSandboxTtlDocument,\n variables: {\n id: sandboxId,\n additionalSeconds,\n context: buildSandboxContextInput(workspaceId, authContext),\n },\n workspaceId,\n authContext,\n });\n}\n"],"mappings":";;;AAyBA,IAAM,IAAe,gCACf,IAAuE,uBACvE,IAA4E,uBAC5E,IAAyE,4BACzE,IAA8B;AAEpC,SAAS,EAAmB,GAA6B;AACvD,SAAQ,GAAR;EACE,KAAK,UACH,QAAO;EACT,KAAK,eACH,QAAO;EAET,KAAK;EACL,KAAK,YACH,QAAO;;;AAIb,SAAS,EAAgB,GAA6B;AAIpD,QAAO,GAAG,EAAa,uBADL,MAAS,cAAc,cAAc,EACC,GAAG,EAAmB,EAAK;;AAGrF,SAAS,EAAoB,GAK3B;AACA,SAAQ,GAAR;EACE,KAAK,UACH,QAAO;GACL,YAAY;GACZ,UAAU;GACV,eAAe;GACf,aAAa;GACd;EACH,KAAK;EACL,KAAK;EACL,KAAK,YACH,QAAO;GACL,YAAY;GACZ,UAAU;GACV,eAAe;GACf,aAAa;GACd;;;AAIP,SAAS,EAA4B,GAGZ;CACvB,IAAM,IAAe,EAAQ,UAAU;AACvC,KACE,MAAiB,eACjB,MAAiB,aACjB,MAAiB,eACjB,MAAiB,eAEjB,QAAO;CAGT,IAAM,IAAO,EAAQ,QAAQ;AAK7B,QAJI,EAAK,WAAW,6BAA6B,GAAS,iBACtD,EAAK,WAAW,0BAA0B,GAAS,cACnD,EAAK,WAAW,wBAAwB,GAAS,YACjD,EAAK,WAAW,0BAA0B,GAAS,cAChD;;AAiBT,SAAS,EACP,GACA,GACkD;CAClD,IAAM,IAAkC,EAAE;AAuB1C,QArBI,GAAa,gBACf,EAAQ,gBAAgB,UAAU,EAAY,gBAG5C,GAAa,mBACf,EAAQ,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