@burdenoff/microfe-technospam 2026.709.3 → 2026.713.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/index.js +4 -4
- package/dist/node_modules/recharts/es6/cartesian/Brush.js.map +1 -1
- package/dist/node_modules/recharts/es6/cartesian/ErrorBar.js.map +1 -1
- package/dist/node_modules/recharts/es6/cartesian/ReferenceArea.js.map +1 -1
- package/dist/node_modules/recharts/es6/cartesian/ReferenceDot.js.map +1 -1
- package/dist/node_modules/recharts/es6/cartesian/ReferenceLine.js.map +1 -1
- package/dist/node_modules/recharts/es6/cartesian/XAxis.js.map +1 -1
- package/dist/node_modules/recharts/es6/cartesian/YAxis.js.map +1 -1
- package/dist/node_modules/recharts/es6/component/ResponsiveContainer.js.map +1 -1
- package/dist/node_modules/sonner/dist/index.js.map +1 -1
- package/dist/technospam/TechnoSpamRoutes.d.ts.map +1 -1
- package/dist/technospam/TechnoSpamRoutes.js +100 -74
- package/dist/technospam/TechnoSpamRoutes.js.map +1 -1
- package/dist/technospam/components/PageLayout.d.ts.map +1 -1
- package/dist/technospam/components/PageLayout.js +26 -23
- package/dist/technospam/components/PageLayout.js.map +1 -1
- package/dist/technospam/components/TagInput.d.ts +18 -0
- package/dist/technospam/components/TagInput.d.ts.map +1 -0
- package/dist/technospam/components/TagInput.js +58 -0
- package/dist/technospam/components/TagInput.js.map +1 -0
- package/dist/technospam/components/TagStrip.d.ts +12 -0
- package/dist/technospam/components/TagStrip.d.ts.map +1 -0
- package/dist/technospam/components/TagStrip.js +20 -0
- package/dist/technospam/components/TagStrip.js.map +1 -0
- package/dist/technospam/components/index.d.ts +2 -0
- package/dist/technospam/components/index.d.ts.map +1 -1
- package/dist/technospam/components/index.js +2 -0
- package/dist/technospam/hooks/useNativeControls.d.ts +27 -0
- package/dist/technospam/hooks/useNativeControls.d.ts.map +1 -0
- package/dist/technospam/hooks/useNativeControls.js +18 -0
- package/dist/technospam/hooks/useNativeControls.js.map +1 -0
- package/dist/technospam/hooks/useTechnoSpamAnalytics.d.ts +1 -1
- package/dist/technospam/hooks/useTechnoSpamAnalytics.d.ts.map +1 -1
- package/dist/technospam/hooks/useTechnoSpamAnalytics.js.map +1 -1
- package/dist/technospam/hooks/useTechnoSpamPageView.d.ts +14 -0
- package/dist/technospam/hooks/useTechnoSpamPageView.d.ts.map +1 -0
- package/dist/technospam/hooks/useTechnoSpamPageView.js +26 -0
- package/dist/technospam/hooks/useTechnoSpamPageView.js.map +1 -0
- package/dist/technospam/index.js +1 -1
- package/dist/technospam/pages/AdminAdminDashboardPagePage.d.ts.map +1 -1
- package/dist/technospam/pages/AdminAdminDashboardPagePage.js +408 -399
- package/dist/technospam/pages/AdminAdminDashboardPagePage.js.map +1 -1
- package/dist/technospam/pages/ApplicationsProblemDetailsPagePage.d.ts.map +1 -1
- package/dist/technospam/pages/ApplicationsProblemDetailsPagePage.js +50 -55
- package/dist/technospam/pages/ApplicationsProblemDetailsPagePage.js.map +1 -1
- package/dist/technospam/pages/ApplicationsProblemsPagePage.js +25 -25
- package/dist/technospam/pages/CoursesCourseDetailsPagePage.d.ts.map +1 -1
- package/dist/technospam/pages/CoursesCourseDetailsPagePage.js +142 -144
- package/dist/technospam/pages/CoursesCourseDetailsPagePage.js.map +1 -1
- package/dist/technospam/pages/CoursesCoursesPagePage.js +30 -30
- package/dist/technospam/pages/HackathonsHackathonsPagePage.js +29 -29
- package/dist/technospam/pages/MentorshipMentorProfilePagePage.js +54 -54
- package/dist/technospam/pages/MentorshipMentorsPagePage.js +61 -61
- package/dist/technospam/pages/MentorshipSessionsPagePage.js +42 -42
- package/dist/technospam/services/createSandboxAssistantTransport.d.ts +8 -24
- package/dist/technospam/services/createSandboxAssistantTransport.d.ts.map +1 -1
- package/dist/technospam/services/createSandboxAssistantTransport.js +8 -114
- package/dist/technospam/services/createSandboxAssistantTransport.js.map +1 -1
- package/package.json +4 -4
- package/dist/generated/wspace-operations.js +0 -67
- package/dist/generated/wspace-operations.js.map +0 -1
- package/dist/technospam/services/assistantApi.d.ts +0 -76
- package/dist/technospam/services/assistantApi.d.ts.map +0 -1
- package/dist/technospam/services/assistantApi.js +0 -222
- package/dist/technospam/services/assistantApi.js.map +0 -1
|
@@ -1,120 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { useCallback as l, useMemo as u, useRef as d } from "react";
|
|
4
|
-
import { useGatewayClient as f } from "@burdenoff/fe-libs/shared/graphql";
|
|
5
|
-
import { useAuthToken as p } from "@burdenoff/fe-libs/shared/providers/shell";
|
|
1
|
+
import { gatherPageContext as e } from "../utils/pageContext.js";
|
|
2
|
+
import { useSandboxAssistantTransport as t } from "@burdenoff/fe-libs/shared/assistant";
|
|
6
3
|
//#region src/technospam/services/createSandboxAssistantTransport.ts
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
let r = sessionStorage.getItem("bf-active-profile");
|
|
13
|
-
if (!r) return "";
|
|
14
|
-
let i = localStorage.getItem(`bf-p-${r}-context`);
|
|
15
|
-
return i ? JSON.parse(i)[e] ?? "" : "";
|
|
16
|
-
} catch {
|
|
17
|
-
return "";
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function y() {
|
|
21
|
-
return new URLSearchParams(window.location.search).get("workspace") ?? v("workspaceId");
|
|
22
|
-
}
|
|
23
|
-
function b() {
|
|
24
|
-
return new URLSearchParams(window.location.search).get("org") ?? v("organizationId");
|
|
25
|
-
}
|
|
26
|
-
function x(e) {
|
|
27
|
-
return e.info?.time?.created ?? 0;
|
|
28
|
-
}
|
|
29
|
-
function S(e) {
|
|
30
|
-
return (e ?? []).filter((e) => e.type === "text" && typeof e.text == "string").map((e) => e.text?.trim() ?? "").filter(Boolean).join("\n");
|
|
31
|
-
}
|
|
32
|
-
function C(e) {
|
|
33
|
-
return (e ?? []).filter((e) => e.type === "tool" && e.tool).map((e) => {
|
|
34
|
-
let t = e.state?.status ?? "running", n = e.tool ?? "tool";
|
|
35
|
-
return t === "completed" ? `Completed: ${n}` : t === "failed" ? `Failed: ${n}` : `Running: ${n}`;
|
|
4
|
+
function n() {
|
|
5
|
+
return t({
|
|
6
|
+
product: "technospam",
|
|
7
|
+
gatherPageContext: e,
|
|
8
|
+
enableCredits: !0
|
|
36
9
|
});
|
|
37
10
|
}
|
|
38
|
-
function w(e, t) {
|
|
39
|
-
let n = e.filter((e) => e.info?.role === "assistant" && x(e) >= t).sort((e, t) => x(e) - x(t));
|
|
40
|
-
if (n.length === 0) return {
|
|
41
|
-
content: "Thinking…",
|
|
42
|
-
done: !1
|
|
43
|
-
};
|
|
44
|
-
let r = n[n.length - 1], i = S(r.parts), a = C(r.parts);
|
|
45
|
-
return {
|
|
46
|
-
content: [i, ...a].filter(Boolean).join("\n\n") || "Thinking…",
|
|
47
|
-
done: !!r.info?.time?.completed && (!!i || a.length > 0)
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
function T(e) {
|
|
51
|
-
return e.replace(/(Authorization\s*:\s*Bearer\s+)[^\s\n]+/gi, "$1[REDACTED]").replace(/(X-Workspace-Authorization\s*:\s*Bearer\s+)[^\s\n]+/gi, "$1[REDACTED]").replace(/\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9._-]+\.[A-Za-z0-9._-]+\b/g, "[REDACTED_JWT]").replace(/\bsk-ant-[A-Za-z0-9-]+\b/g, "[REDACTED_API_KEY]");
|
|
52
|
-
}
|
|
53
|
-
function E(e) {
|
|
54
|
-
let t = e instanceof Error ? e.message.toLowerCase() : String(e).toLowerCase();
|
|
55
|
-
return t.includes("rate limit exceeded") || t.includes("unauthorized") || t.includes("k8s api error 401") ? !1 : [
|
|
56
|
-
"sandbox not found",
|
|
57
|
-
"sandbox is not running",
|
|
58
|
-
"sandbox service not available yet",
|
|
59
|
-
"sandbox failed",
|
|
60
|
-
"sandbox startup timed out",
|
|
61
|
-
"assistant service did not become healthy",
|
|
62
|
-
"proxy error: 404",
|
|
63
|
-
"proxy error: 502",
|
|
64
|
-
"proxy error: 503"
|
|
65
|
-
].some((e) => t.includes(e));
|
|
66
|
-
}
|
|
67
|
-
function D() {
|
|
68
|
-
let v = f("workspace"), { getAccessToken: x, getWorkspaceToken: S, userId: C } = p(), D = d(null), O = d(null), k = l(async (n, i) => {
|
|
69
|
-
let a = D.current;
|
|
70
|
-
if (!a) {
|
|
71
|
-
if (a = await r(v, n, m, i), !a) {
|
|
72
|
-
if (!x()) throw Error("API Calls mode requires an authenticated session. Please sign in again.");
|
|
73
|
-
a = await e(v, m, n, i);
|
|
74
|
-
}
|
|
75
|
-
await s(v, a, n, i), await o(v, a, n, i), D.current = a;
|
|
76
|
-
}
|
|
77
|
-
let c = O.current;
|
|
78
|
-
return c || (c = (await t(v, a, n, m, i)).sessionId, O.current = c), {
|
|
79
|
-
sandboxId: a,
|
|
80
|
-
sessionId: c
|
|
81
|
-
};
|
|
82
|
-
}, [v, x]), A = l(async ({ prompt: e, onProgress: t, signal: r }) => {
|
|
83
|
-
let o = y();
|
|
84
|
-
if (!o) throw Error("The assistant needs an active workspace. Open a workspace and try again.");
|
|
85
|
-
let s = {
|
|
86
|
-
accessToken: x(),
|
|
87
|
-
workspaceToken: S(),
|
|
88
|
-
userId: C,
|
|
89
|
-
organizationId: b()
|
|
90
|
-
}, l = async (u) => {
|
|
91
|
-
try {
|
|
92
|
-
let { sandboxId: l, sessionId: u } = await k(o, s), d = Date.now();
|
|
93
|
-
await a(v, l, o, u, e, m, c(), s);
|
|
94
|
-
let f = Date.now() + h, p = Date.now(), y = w([], d);
|
|
95
|
-
for (; Date.now() < f;) {
|
|
96
|
-
if (r.aborted) throw Error("Cancelled");
|
|
97
|
-
if (y = w(await i(v, l, o, u, s, 50), d), t(T(y.content)), y.done) break;
|
|
98
|
-
Date.now() - p > _ && (await n(v, l, o, 600, s).catch(() => void 0), p = Date.now()), await new Promise((e) => setTimeout(e, g));
|
|
99
|
-
}
|
|
100
|
-
if (!y.done) throw Error("The assistant timed out while responding. Please try again.");
|
|
101
|
-
return { text: T(y.content) };
|
|
102
|
-
} catch (e) {
|
|
103
|
-
if (u === 1 && E(e)) return D.current = null, O.current = null, l(2);
|
|
104
|
-
throw e;
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
return l(1);
|
|
108
|
-
}, [
|
|
109
|
-
v,
|
|
110
|
-
k,
|
|
111
|
-
x,
|
|
112
|
-
S,
|
|
113
|
-
C
|
|
114
|
-
]);
|
|
115
|
-
return u(() => ({ sendPrompt: A }), [A]);
|
|
116
|
-
}
|
|
117
11
|
//#endregion
|
|
118
|
-
export {
|
|
12
|
+
export { n as useSandboxAssistantTransport };
|
|
119
13
|
|
|
120
14
|
//# sourceMappingURL=createSandboxAssistantTransport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSandboxAssistantTransport.js","names":[],"sources":["../../../src/technospam/services/createSandboxAssistantTransport.ts"],"sourcesContent":["/**\n * TechnoSpam adapter for the shared fe-libs AssistantWidget.\n *\n * The floating widget (fe-libs, Layer 1) is backend-agnostic — it calls an\n * injected `AssistantTransport`. This hook builds a transport that reuses the\n * sandbox `api-calls` agent: it provisions/reuses a sandbox, opens a session,\n * dispatches the prompt async, then polls for the streamed answer. The agent\n * introspects the GraphQL schema and performs API calls on the user's behalf\n * using their workspace token, contextual to the current screen (via\n * `gatherPageContext`).\n */\n\nimport { useCallback, useMemo, useRef } from 'react';\nimport { useGatewayClient } from '@burdenoff/fe-libs/shared/graphql';\nimport { useAuthToken } from '@burdenoff/fe-libs/shared/providers/shell';\nimport {\n createAssistantSandbox,\n createAssistantSession,\n extendAssistantSandboxTTL,\n findExistingSandbox,\n getAssistantMessages,\n sendAssistantPromptAsync,\n waitForAssistantServiceReady,\n waitForSandboxReady,\n type AssistantRawMessage,\n type AssistantSandboxAuthContext,\n} from './assistantApi';\nimport { gatherPageContext } from '#technospam/utils/pageContext';\nimport type { AssistantMode } from '#technospam/types/assistant';\n\n/**\n * Locally-defined mirror of the fe-libs `AssistantTransport` contract.\n *\n * We intentionally do NOT import the type from `@burdenoff/fe-libs` here:\n * microfe's tsconfig maps `@burdenoff/fe-libs/*` to fe-libs *source*, so\n * vite-plugin-dts would rewrite a cross-package type used in this hook's\n * public signature to a broken source-relative path in the emitted `.d.ts`.\n * Structural typing makes this shape assignable to fe-libs' `AssistantTransport`\n * at the call site (technospam-app's AppShell), which is where compatibility\n * is enforced — drift there fails the app type-check.\n */\ninterface AssistantSendArgs {\n prompt: string;\n onProgress: (partialText: string) => void;\n signal: AbortSignal;\n}\n\nexport interface AssistantTransport {\n sendPrompt: (args: AssistantSendArgs) => Promise<{ text: string }>;\n}\n\nconst MODE: AssistantMode = 'assistant';\nconst STREAM_BUDGET_MS = 180_000;\nconst POLL_INTERVAL_MS = 1500;\nconst TTL_EXTEND_INTERVAL_MS = 30_000;\n\n// ── Context helpers (mirror AssistantChatArea's resolution) ──────────\n\nfunction getProfileContextValue(key: 'workspaceId' | 'organizationId'): string {\n try {\n const activeContextKey =\n key === 'workspaceId'\n ? 'burdenoff-active-context-workspace'\n : 'burdenoff-active-context-organization';\n const activeContextValue = localStorage.getItem(activeContextKey);\n if (activeContextValue) return activeContextValue;\n\n const activeProfileId = sessionStorage.getItem('bf-active-profile');\n if (!activeProfileId) return '';\n const raw = localStorage.getItem(`bf-p-${activeProfileId}-context`);\n if (!raw) return '';\n const context = JSON.parse(raw) as { workspaceId?: string; organizationId?: string };\n return context[key] ?? '';\n } catch {\n return '';\n }\n}\n\nfunction getWorkspaceId(): string {\n const params = new URLSearchParams(window.location.search);\n return params.get('workspace') ?? getProfileContextValue('workspaceId');\n}\n\nfunction getOrganizationId(): string {\n const params = new URLSearchParams(window.location.search);\n return params.get('org') ?? getProfileContextValue('organizationId');\n}\n\n// ── Message-progress helpers (pure; mirror AssistantChatArea) ────────\n\nfunction getRawMessageCreatedAt(message: AssistantRawMessage): number {\n return message.info?.time?.created ?? 0;\n}\n\nfunction getAssistantText(parts: AssistantRawMessage['parts']): string {\n return (parts ?? [])\n .filter((part) => part.type === 'text' && typeof part.text === 'string')\n .map((part) => part.text?.trim() ?? '')\n .filter(Boolean)\n .join('\\n');\n}\n\nfunction getToolProgress(parts: AssistantRawMessage['parts']): string[] {\n return (parts ?? [])\n .filter((part) => part.type === 'tool' && part.tool)\n .map((part) => {\n const status = part.state?.status ?? 'running';\n const tool = part.tool ?? 'tool';\n if (status === 'completed') return `Completed: ${tool}`;\n if (status === 'failed') return `Failed: ${tool}`;\n return `Running: ${tool}`;\n });\n}\n\nfunction buildProgress(\n messages: AssistantRawMessage[],\n sinceMs: number\n): { content: string; done: boolean } {\n const relevant = messages\n .filter(\n (message) => message.info?.role === 'assistant' && getRawMessageCreatedAt(message) >= sinceMs\n )\n .sort((left, right) => getRawMessageCreatedAt(left) - getRawMessageCreatedAt(right));\n\n if (relevant.length === 0) return { content: 'Thinking…', done: false };\n\n const latest = relevant[relevant.length - 1]!;\n const text = getAssistantText(latest.parts);\n const toolProgress = getToolProgress(latest.parts);\n const content = [text, ...toolProgress].filter(Boolean).join('\\n\\n') || 'Thinking…';\n\n return {\n content,\n done: Boolean(latest.info?.time?.completed) && (Boolean(text) || toolProgress.length > 0),\n };\n}\n\nfunction sanitize(response: string): string {\n return response\n .replace(/(Authorization\\s*:\\s*Bearer\\s+)[^\\s\\n]+/gi, '$1[REDACTED]')\n .replace(/(X-Workspace-Authorization\\s*:\\s*Bearer\\s+)[^\\s\\n]+/gi, '$1[REDACTED]')\n .replace(/\\beyJ[A-Za-z0-9_-]+\\.[A-Za-z0-9._-]+\\.[A-Za-z0-9._-]+\\b/g, '[REDACTED_JWT]')\n .replace(/\\bsk-ant-[A-Za-z0-9-]+\\b/g, '[REDACTED_API_KEY]');\n}\n\nfunction isRecoverable(error: unknown): boolean {\n const message =\n error instanceof Error ? error.message.toLowerCase() : String(error).toLowerCase();\n if (\n message.includes('rate limit exceeded') ||\n message.includes('unauthorized') ||\n message.includes('k8s api error 401')\n ) {\n return false;\n }\n return [\n 'sandbox not found',\n 'sandbox is not running',\n 'sandbox service not available yet',\n 'sandbox failed',\n 'sandbox startup timed out',\n 'assistant service did not become healthy',\n 'proxy error: 404',\n 'proxy error: 502',\n 'proxy error: 503',\n ].some((fragment) => message.includes(fragment));\n}\n\n/**\n * Returns a memoized `AssistantTransport` wired to the TechnoSpam sandbox\n * `api-calls` agent. The sandbox + session are cached in refs so follow-up\n * turns reuse the warm environment for the lifetime of the host shell.\n */\nexport function useSandboxAssistantTransport(): AssistantTransport {\n const apollo = useGatewayClient('workspace');\n const { getAccessToken, getWorkspaceToken, userId } = useAuthToken();\n\n const sandboxIdRef = useRef<string | null>(null);\n const sessionIdRef = useRef<string | null>(null);\n\n const ensureRuntime = useCallback(\n async (\n workspaceId: string,\n authContext: AssistantSandboxAuthContext\n ): Promise<{ sandboxId: string; sessionId: string }> => {\n let sandboxId = sandboxIdRef.current;\n if (!sandboxId) {\n sandboxId = await findExistingSandbox(apollo, workspaceId, MODE, authContext);\n if (!sandboxId) {\n if (!getAccessToken()) {\n throw new Error(\n 'API Calls mode requires an authenticated session. Please sign in again.'\n );\n }\n sandboxId = await createAssistantSandbox(apollo, MODE, workspaceId, authContext);\n }\n await waitForSandboxReady(apollo, sandboxId, workspaceId, authContext);\n await waitForAssistantServiceReady(apollo, sandboxId, workspaceId, authContext);\n sandboxIdRef.current = sandboxId;\n }\n\n let sessionId = sessionIdRef.current;\n if (!sessionId) {\n const result = await createAssistantSession(\n apollo,\n sandboxId,\n workspaceId,\n MODE,\n authContext\n );\n sessionId = result.sessionId;\n sessionIdRef.current = sessionId;\n }\n\n return { sandboxId, sessionId };\n },\n [apollo, getAccessToken]\n );\n\n const sendPrompt = useCallback(\n async ({ prompt, onProgress, signal }: AssistantSendArgs): Promise<{ text: string }> => {\n const workspaceId = getWorkspaceId();\n if (!workspaceId) {\n throw new Error('The assistant needs an active workspace. Open a workspace and try again.');\n }\n const authContext: AssistantSandboxAuthContext = {\n accessToken: getAccessToken(),\n workspaceToken: getWorkspaceToken(),\n userId,\n organizationId: getOrganizationId(),\n };\n\n const run = async (attempt: 1 | 2): Promise<{ text: string }> => {\n try {\n const { sandboxId, sessionId } = await ensureRuntime(workspaceId, authContext);\n\n const startedAt = Date.now();\n await sendAssistantPromptAsync(\n apollo,\n sandboxId,\n workspaceId,\n sessionId,\n prompt,\n MODE,\n gatherPageContext(),\n authContext\n );\n\n const timeoutAt = Date.now() + STREAM_BUDGET_MS;\n let lastTtlExtensionAt = Date.now();\n let progress = buildProgress([], startedAt);\n\n while (Date.now() < timeoutAt) {\n if (signal.aborted) throw new Error('Cancelled');\n\n const messages = await getAssistantMessages(\n apollo,\n sandboxId,\n workspaceId,\n sessionId,\n authContext,\n 50\n );\n progress = buildProgress(messages, startedAt);\n onProgress(sanitize(progress.content));\n if (progress.done) break;\n\n if (Date.now() - lastTtlExtensionAt > TTL_EXTEND_INTERVAL_MS) {\n await extendAssistantSandboxTTL(\n apollo,\n sandboxId,\n workspaceId,\n 600,\n authContext\n ).catch(() => undefined);\n lastTtlExtensionAt = Date.now();\n }\n\n await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));\n }\n\n if (!progress.done) {\n throw new Error('The assistant timed out while responding. Please try again.');\n }\n\n return { text: sanitize(progress.content) };\n } catch (error) {\n // A stale/expired sandbox or session is recoverable — drop the warm\n // refs and retry once from a clean runtime.\n if (attempt === 1 && isRecoverable(error)) {\n sandboxIdRef.current = null;\n sessionIdRef.current = null;\n return run(2);\n }\n throw error;\n }\n };\n\n return run(1);\n },\n [apollo, ensureRuntime, getAccessToken, getWorkspaceToken, userId]\n );\n\n return useMemo<AssistantTransport>(() => ({ sendPrompt }), [sendPrompt]);\n}\n"],"mappings":";;;;;;AAmDA,IAAM,IAAsB,aACtB,IAAmB,MACnB,IAAmB,MACnB,IAAyB;AAI/B,SAAS,EAAuB,GAA+C;AAC7E,KAAI;EACF,IAAM,IACJ,MAAQ,gBACJ,uCACA,y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M,CAGvC,QAFA,EAAa,UAAU,MACvB,EAAa,UAAU,MAChB,EAAI,EAAE;AAEf,UAAM;;;AAIV,SAAO,EAAI,EAAE;IAEf;EAAC;EAAQ;EAAe;EAAgB;EAAmB;EAAO,CACnE;AAED,QAAO,SAAmC,EAAE,eAAY,GAAG,CAAC,EAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"createSandboxAssistantTransport.js","names":[],"sources":["../../../src/technospam/services/createSandboxAssistantTransport.ts"],"sourcesContent":["/**\n * technospam adapter for the shared fe-libs AssistantWidget transport.\n *\n * The sandbox lifecycle + poll/stream loop now lives in\n * `@burdenoff/fe-libs/shared/assistant` (one implementation for all products);\n * this is a thin wrapper. The exported name/shape are unchanged so app-shell\n * imports don't move. The public return type is a LOCALLY-declared structural\n * mirror — never re-export fe-libs types (vite-plugin-dts path rewriting).\n */\n\nimport { useSandboxAssistantTransport as useSharedTransport } from '@burdenoff/fe-libs/shared/assistant';\nimport { gatherPageContext } from '#technospam/utils/pageContext';\n\ninterface AssistantSendArgs {\n prompt: string;\n onProgress: (partialText: string) => void;\n signal: AbortSignal;\n}\n\nexport interface AssistantTransport {\n sendPrompt: (args: AssistantSendArgs) => Promise<{ text: string }>;\n prewarm?: (level?: 'probe' | 'full') => void;\n suspend?: () => void;\n}\n\nexport function useSandboxAssistantTransport(): AssistantTransport {\n return useSharedTransport({\n product: 'technospam',\n gatherPageContext: gatherPageContext,\n enableCredits: true,\n });\n}\n"],"mappings":";;;AAyBA,SAAgB,IAAmD;AACjE,QAAO,EAAmB;EACxB,SAAS;EACU;EACnB,eAAe;EAChB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@burdenoff/microfe-technospam",
|
|
3
|
-
"version": "2026.
|
|
3
|
+
"version": "2026.713.1",
|
|
4
4
|
"description": "Burdenoff TechnoSpam Microfrontend",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"types": "./dist/index.d.ts",
|
|
27
27
|
"scripts": {
|
|
28
28
|
"dev": "vite",
|
|
29
|
-
"build": "tsc && vite build",
|
|
29
|
+
"build": "MFE_DTS=1 tsc -p tsconfig.build.json && MFE_DTS=1 vite build",
|
|
30
30
|
"lint": "eslint .",
|
|
31
31
|
"format": "prettier --write \"src/**/*.{ts,tsx}\"",
|
|
32
32
|
"type:check": "tsc --noEmit",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@apollo/client": "^4.0.11",
|
|
46
|
-
"@burdenoff/fe-libs": "2026.
|
|
46
|
+
"@burdenoff/fe-libs": "2026.713.6",
|
|
47
47
|
"@tanstack/react-query": "^5.90.16",
|
|
48
48
|
"clsx": "^2.1.1",
|
|
49
49
|
"graphql": "^16.10.0",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"access": "restricted"
|
|
94
94
|
},
|
|
95
95
|
"overrides": {
|
|
96
|
-
"@burdenoff/fe-libs": "2026.
|
|
96
|
+
"@burdenoff/fe-libs": "2026.713.6",
|
|
97
97
|
"lodash": ">=4.17.21",
|
|
98
98
|
"lodash-es": ">=4.17.21",
|
|
99
99
|
"dompurify": ">=3.3.4",
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { gql as e } from "@apollo/client";
|
|
2
|
-
import "@apollo/client/react";
|
|
3
|
-
e`
|
|
4
|
-
mutation CheckAiCredits {
|
|
5
|
-
checkAiCredits
|
|
6
|
-
}
|
|
7
|
-
`, e`
|
|
8
|
-
mutation ReportAiTokenUsage($input: ReportAiTokenUsageInput!) {
|
|
9
|
-
reportAiTokenUsage(input: $input)
|
|
10
|
-
}
|
|
11
|
-
`;
|
|
12
|
-
var t = e`
|
|
13
|
-
mutation CreateSandbox($input: CreateSandboxInput!) {
|
|
14
|
-
createSandbox(input: $input) {
|
|
15
|
-
id
|
|
16
|
-
name
|
|
17
|
-
status
|
|
18
|
-
network {
|
|
19
|
-
internalUrl
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
`, n = e`
|
|
24
|
-
mutation ProxySandboxRequest($input: ProxySandboxRequestInput!) {
|
|
25
|
-
proxySandboxRequest(input: $input) {
|
|
26
|
-
status
|
|
27
|
-
body
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
`, r = e`
|
|
31
|
-
mutation ExtendSandboxTtl($id: ID!, $additionalSeconds: Int!, $context: ContextInput!) {
|
|
32
|
-
extendSandboxTTL(
|
|
33
|
-
id: $id
|
|
34
|
-
additionalSeconds: $additionalSeconds
|
|
35
|
-
context: $context
|
|
36
|
-
) {
|
|
37
|
-
id
|
|
38
|
-
expiresAt
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
`, i = e`
|
|
42
|
-
query GetSandbox($id: ID!, $context: ContextInput!) {
|
|
43
|
-
getSandbox(id: $id, context: $context) {
|
|
44
|
-
id
|
|
45
|
-
status
|
|
46
|
-
errorMessage
|
|
47
|
-
network {
|
|
48
|
-
internalUrl
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
`, a = e`
|
|
53
|
-
query GetActiveSandboxes($context: ContextInput!) {
|
|
54
|
-
getActiveSandboxes(context: $context) {
|
|
55
|
-
id
|
|
56
|
-
name
|
|
57
|
-
status
|
|
58
|
-
metadata
|
|
59
|
-
template
|
|
60
|
-
createdBy
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
`;
|
|
64
|
-
//#endregion
|
|
65
|
-
export { t as CreateSandboxDocument, r as ExtendSandboxTtlDocument, a as GetActiveSandboxesDocument, i as GetSandboxDocument, n as ProxySandboxRequestDocument };
|
|
66
|
-
|
|
67
|
-
//# sourceMappingURL=wspace-operations.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wspace-operations.js","names":[],"sources":["../../src/generated/wspace-operations.ts"],"sourcesContent":["// @ts-nocheck\nimport * as Types from './wspace-types';\n\nimport { gql } from '@apollo/client';\nimport * as Apollo from '@apollo/client';\nimport * as ApolloReactHooks from '@apollo/client/react';\nconst defaultOptions = {} as const;\nexport type CheckAiCreditsMutationVariables = Types.Exact<{ [key: string]: never; }>;\n\n\nexport type CheckAiCreditsMutation = { __typename?: 'Mutation', checkAiCredits: boolean };\n\nexport type ReportAiTokenUsageMutationVariables = Types.Exact<{\n input: Types.ReportAiTokenUsageInput;\n}>;\n\n\nexport type ReportAiTokenUsageMutation = { __typename?: 'Mutation', reportAiTokenUsage: boolean };\n\nexport type CreateSandboxMutationVariables = Types.Exact<{\n input: Types.CreateSandboxInput;\n}>;\n\n\nexport type CreateSandboxMutation = { __typename?: 'Mutation', createSandbox: { __typename?: 'Sandbox', id: string, name: string, status: Types.SandboxStatus, network: { __typename?: 'SandboxNetwork', internalUrl?: string | null } } };\n\nexport type ProxySandboxRequestMutationVariables = Types.Exact<{\n input: Types.ProxySandboxRequestInput;\n}>;\n\n\nexport type ProxySandboxRequestMutation = { __typename?: 'Mutation', proxySandboxRequest: { __typename?: 'ProxySandboxResponse', status: number, body?: Record<string, unknown> | null } };\n\nexport type ExtendSandboxTtlMutationVariables = Types.Exact<{\n id: Types.Scalars['ID']['input'];\n additionalSeconds: Types.Scalars['Int']['input'];\n context: Types.ContextInput;\n}>;\n\n\nexport type ExtendSandboxTtlMutation = { __typename?: 'Mutation', extendSandboxTTL: { __typename?: 'Sandbox', id: string, expiresAt: string } };\n\nexport type GetSandboxQueryVariables = Types.Exact<{\n id: Types.Scalars['ID']['input'];\n context: Types.ContextInput;\n}>;\n\n\nexport type GetSandboxQuery = { __typename?: 'Query', getSandbox?: { __typename?: 'Sandbox', id: string, status: Types.SandboxStatus, errorMessage?: string | null, network: { __typename?: 'SandboxNetwork', internalUrl?: string | null } } | null };\n\nexport type GetActiveSandboxesQueryVariables = Types.Exact<{\n context: Types.ContextInput;\n}>;\n\n\nexport type GetActiveSandboxesQuery = { __typename?: 'Query', getActiveSandboxes: Array<{ __typename?: 'Sandbox', id: string, name: string, status: Types.SandboxStatus, metadata?: Record<string, unknown> | null, template: Types.SandboxTemplate, createdBy: string }> };\n\n\nexport const CheckAiCreditsDocument = gql`\n mutation CheckAiCredits {\n checkAiCredits\n}\n `;\nexport type CheckAiCreditsMutationFn = Apollo.MutationFunction<Types.CheckAiCreditsMutation, Types.CheckAiCreditsMutationVariables>;\n\n/**\n * __useCheckAiCreditsMutation__\n *\n * To run a mutation, you first call `useCheckAiCreditsMutation` within a React component and pass it any options that fit your needs.\n * When your component renders, `useCheckAiCreditsMutation` returns a tuple that includes:\n * - A mutate function that you can call at any time to execute the mutation\n * - An object with fields that represent the current status of the mutation's execution\n *\n * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;\n *\n * @example\n * const [checkAiCreditsMutation, { data, loading, error }] = useCheckAiCreditsMutation({\n * variables: {\n * },\n * });\n */\nexport function useCheckAiCreditsMutation(baseOptions?: ApolloReactHooks.MutationHookOptions<Types.CheckAiCreditsMutation, Types.CheckAiCreditsMutationVariables>) {\n const options = {...defaultOptions, ...baseOptions}\n return ApolloReactHooks.useMutation<Types.CheckAiCreditsMutation, Types.CheckAiCreditsMutationVariables>(CheckAiCreditsDocument, options);\n }\nexport type CheckAiCreditsMutationHookResult = ReturnType<typeof useCheckAiCreditsMutation>;\nexport type CheckAiCreditsMutationResult = Apollo.MutationResult<Types.CheckAiCreditsMutation>;\nexport type CheckAiCreditsMutationOptions = Apollo.BaseMutationOptions<Types.CheckAiCreditsMutation, Types.CheckAiCreditsMutationVariables>;\nexport const ReportAiTokenUsageDocument = gql`\n mutation ReportAiTokenUsage($input: ReportAiTokenUsageInput!) {\n reportAiTokenUsage(input: $input)\n}\n `;\nexport type ReportAiTokenUsageMutationFn = Apollo.MutationFunction<Types.ReportAiTokenUsageMutation, Types.ReportAiTokenUsageMutationVariables>;\n\n/**\n * __useReportAiTokenUsageMutation__\n *\n * To run a mutation, you first call `useReportAiTokenUsageMutation` within a React component and pass it any options that fit your needs.\n * When your component renders, `useReportAiTokenUsageMutation` returns a tuple that includes:\n * - A mutate function that you can call at any time to execute the mutation\n * - An object with fields that represent the current status of the mutation's execution\n *\n * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;\n *\n * @example\n * const [reportAiTokenUsageMutation, { data, loading, error }] = useReportAiTokenUsageMutation({\n * variables: {\n * input: // value for 'input'\n * },\n * });\n */\nexport function useReportAiTokenUsageMutation(baseOptions?: ApolloReactHooks.MutationHookOptions<Types.ReportAiTokenUsageMutation, Types.ReportAiTokenUsageMutationVariables>) {\n const options = {...defaultOptions, ...baseOptions}\n return ApolloReactHooks.useMutation<Types.ReportAiTokenUsageMutation, Types.ReportAiTokenUsageMutationVariables>(ReportAiTokenUsageDocument, options);\n }\nexport type ReportAiTokenUsageMutationHookResult = ReturnType<typeof useReportAiTokenUsageMutation>;\nexport type ReportAiTokenUsageMutationResult = Apollo.MutationResult<Types.ReportAiTokenUsageMutation>;\nexport type ReportAiTokenUsageMutationOptions = Apollo.BaseMutationOptions<Types.ReportAiTokenUsageMutation, Types.ReportAiTokenUsageMutationVariables>;\nexport const CreateSandboxDocument = gql`\n mutation CreateSandbox($input: CreateSandboxInput!) {\n createSandbox(input: $input) {\n id\n name\n status\n network {\n internalUrl\n }\n }\n}\n `;\nexport type CreateSandboxMutationFn = Apollo.MutationFunction<Types.CreateSandboxMutation, Types.CreateSandboxMutationVariables>;\n\n/**\n * __useCreateSandboxMutation__\n *\n * To run a mutation, you first call `useCreateSandboxMutation` within a React component and pass it any options that fit your needs.\n * When your component renders, `useCreateSandboxMutation` returns a tuple that includes:\n * - A mutate function that you can call at any time to execute the mutation\n * - An object with fields that represent the current status of the mutation's execution\n *\n * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;\n *\n * @example\n * const [createSandboxMutation, { data, loading, error }] = useCreateSandboxMutation({\n * variables: {\n * input: // value for 'input'\n * },\n * });\n */\nexport function useCreateSandboxMutation(baseOptions?: ApolloReactHooks.MutationHookOptions<Types.CreateSandboxMutation, Types.CreateSandboxMutationVariables>) {\n const options = {...defaultOptions, ...baseOptions}\n return ApolloReactHooks.useMutation<Types.CreateSandboxMutation, Types.CreateSandboxMutationVariables>(CreateSandboxDocument, options);\n }\nexport type CreateSandboxMutationHookResult = ReturnType<typeof useCreateSandboxMutation>;\nexport type CreateSandboxMutationResult = Apollo.MutationResult<Types.CreateSandboxMutation>;\nexport type CreateSandboxMutationOptions = Apollo.BaseMutationOptions<Types.CreateSandboxMutation, Types.CreateSandboxMutationVariables>;\nexport const ProxySandboxRequestDocument = gql`\n mutation ProxySandboxRequest($input: ProxySandboxRequestInput!) {\n proxySandboxRequest(input: $input) {\n status\n body\n }\n}\n `;\nexport type ProxySandboxRequestMutationFn = Apollo.MutationFunction<Types.ProxySandboxRequestMutation, Types.ProxySandboxRequestMutationVariables>;\n\n/**\n * __useProxySandboxRequestMutation__\n *\n * To run a mutation, you first call `useProxySandboxRequestMutation` within a React component and pass it any options that fit your needs.\n * When your component renders, `useProxySandboxRequestMutation` returns a tuple that includes:\n * - A mutate function that you can call at any time to execute the mutation\n * - An object with fields that represent the current status of the mutation's execution\n *\n * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;\n *\n * @example\n * const [proxySandboxRequestMutation, { data, loading, error }] = useProxySandboxRequestMutation({\n * variables: {\n * input: // value for 'input'\n * },\n * });\n */\nexport function useProxySandboxRequestMutation(baseOptions?: ApolloReactHooks.MutationHookOptions<Types.ProxySandboxRequestMutation, Types.ProxySandboxRequestMutationVariables>) {\n const options = {...defaultOptions, ...baseOptions}\n return ApolloReactHooks.useMutation<Types.ProxySandboxRequestMutation, Types.ProxySandboxRequestMutationVariables>(ProxySandboxRequestDocument, options);\n }\nexport type ProxySandboxRequestMutationHookResult = ReturnType<typeof useProxySandboxRequestMutation>;\nexport type ProxySandboxRequestMutationResult = Apollo.MutationResult<Types.ProxySandboxRequestMutation>;\nexport type ProxySandboxRequestMutationOptions = Apollo.BaseMutationOptions<Types.ProxySandboxRequestMutation, Types.ProxySandboxRequestMutationVariables>;\nexport const ExtendSandboxTtlDocument = gql`\n mutation ExtendSandboxTtl($id: ID!, $additionalSeconds: Int!, $context: ContextInput!) {\n extendSandboxTTL(\n id: $id\n additionalSeconds: $additionalSeconds\n context: $context\n ) {\n id\n expiresAt\n }\n}\n `;\nexport type ExtendSandboxTtlMutationFn = Apollo.MutationFunction<Types.ExtendSandboxTtlMutation, Types.ExtendSandboxTtlMutationVariables>;\n\n/**\n * __useExtendSandboxTtlMutation__\n *\n * To run a mutation, you first call `useExtendSandboxTtlMutation` within a React component and pass it any options that fit your needs.\n * When your component renders, `useExtendSandboxTtlMutation` returns a tuple that includes:\n * - A mutate function that you can call at any time to execute the mutation\n * - An object with fields that represent the current status of the mutation's execution\n *\n * @param baseOptions options that will be passed into the mutation, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options-2;\n *\n * @example\n * const [extendSandboxTtlMutation, { data, loading, error }] = useExtendSandboxTtlMutation({\n * variables: {\n * id: // value for 'id'\n * additionalSeconds: // value for 'additionalSeconds'\n * context: // value for 'context'\n * },\n * });\n */\nexport function useExtendSandboxTtlMutation(baseOptions?: ApolloReactHooks.MutationHookOptions<Types.ExtendSandboxTtlMutation, Types.ExtendSandboxTtlMutationVariables>) {\n const options = {...defaultOptions, ...baseOptions}\n return ApolloReactHooks.useMutation<Types.ExtendSandboxTtlMutation, Types.ExtendSandboxTtlMutationVariables>(ExtendSandboxTtlDocument, options);\n }\nexport type ExtendSandboxTtlMutationHookResult = ReturnType<typeof useExtendSandboxTtlMutation>;\nexport type ExtendSandboxTtlMutationResult = Apollo.MutationResult<Types.ExtendSandboxTtlMutation>;\nexport type ExtendSandboxTtlMutationOptions = Apollo.BaseMutationOptions<Types.ExtendSandboxTtlMutation, Types.ExtendSandboxTtlMutationVariables>;\nexport const GetSandboxDocument = gql`\n query GetSandbox($id: ID!, $context: ContextInput!) {\n getSandbox(id: $id, context: $context) {\n id\n status\n errorMessage\n network {\n internalUrl\n }\n }\n}\n `;\n\n/**\n * __useGetSandboxQuery__\n *\n * To run a query within a React component, call `useGetSandboxQuery` and pass it any options that fit your needs.\n * When your component renders, `useGetSandboxQuery` returns an object from Apollo Client that contains loading, error, and data properties\n * you can use to render your UI.\n *\n * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;\n *\n * @example\n * const { data, loading, error } = useGetSandboxQuery({\n * variables: {\n * id: // value for 'id'\n * context: // value for 'context'\n * },\n * });\n */\nexport function useGetSandboxQuery(baseOptions: ApolloReactHooks.QueryHookOptions<Types.GetSandboxQuery, Types.GetSandboxQueryVariables> & ({ variables: Types.GetSandboxQueryVariables; skip?: boolean; } | { skip: boolean; }) ) {\n const options = {...defaultOptions, ...baseOptions}\n return ApolloReactHooks.useQuery<Types.GetSandboxQuery, Types.GetSandboxQueryVariables>(GetSandboxDocument, options);\n }\nexport function useGetSandboxLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions<Types.GetSandboxQuery, Types.GetSandboxQueryVariables>) {\n const options = {...defaultOptions, ...baseOptions}\n return ApolloReactHooks.useLazyQuery<Types.GetSandboxQuery, Types.GetSandboxQueryVariables>(GetSandboxDocument, options);\n }\n// @ts-ignore\nexport function useGetSandboxSuspenseQuery(baseOptions?: ApolloReactHooks.SuspenseQueryHookOptions<Types.GetSandboxQuery, Types.GetSandboxQueryVariables>): ApolloReactHooks.UseSuspenseQueryResult<Types.GetSandboxQuery, Types.GetSandboxQueryVariables>;\nexport function useGetSandboxSuspenseQuery(baseOptions?: ApolloReactHooks.SkipToken | ApolloReactHooks.SuspenseQueryHookOptions<Types.GetSandboxQuery, Types.GetSandboxQueryVariables>): ApolloReactHooks.UseSuspenseQueryResult<Types.GetSandboxQuery | undefined, Types.GetSandboxQueryVariables>;\nexport function useGetSandboxSuspenseQuery(baseOptions?: ApolloReactHooks.SkipToken | ApolloReactHooks.SuspenseQueryHookOptions<Types.GetSandboxQuery, Types.GetSandboxQueryVariables>) {\n const options = baseOptions === ApolloReactHooks.skipToken ? baseOptions : {...defaultOptions, ...baseOptions}\n return ApolloReactHooks.useSuspenseQuery<Types.GetSandboxQuery, Types.GetSandboxQueryVariables>(GetSandboxDocument, options);\n }\nexport type GetSandboxQueryHookResult = ReturnType<typeof useGetSandboxQuery>;\nexport type GetSandboxLazyQueryHookResult = ReturnType<typeof useGetSandboxLazyQuery>;\nexport type GetSandboxSuspenseQueryHookResult = ReturnType<typeof useGetSandboxSuspenseQuery>;\nexport type GetSandboxQueryResult = Apollo.QueryResult<Types.GetSandboxQuery, Types.GetSandboxQueryVariables>;\nexport const GetActiveSandboxesDocument = gql`\n query GetActiveSandboxes($context: ContextInput!) {\n getActiveSandboxes(context: $context) {\n id\n name\n status\n metadata\n template\n createdBy\n }\n}\n `;\n\n/**\n * __useGetActiveSandboxesQuery__\n *\n * To run a query within a React component, call `useGetActiveSandboxesQuery` and pass it any options that fit your needs.\n * When your component renders, `useGetActiveSandboxesQuery` returns an object from Apollo Client that contains loading, error, and data properties\n * you can use to render your UI.\n *\n * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;\n *\n * @example\n * const { data, loading, error } = useGetActiveSandboxesQuery({\n * variables: {\n * context: // value for 'context'\n * },\n * });\n */\nexport function useGetActiveSandboxesQuery(baseOptions: ApolloReactHooks.QueryHookOptions<Types.GetActiveSandboxesQuery, Types.GetActiveSandboxesQueryVariables> & ({ variables: Types.GetActiveSandboxesQueryVariables; skip?: boolean; } | { skip: boolean; }) ) {\n const options = {...defaultOptions, ...baseOptions}\n return ApolloReactHooks.useQuery<Types.GetActiveSandboxesQuery, Types.GetActiveSandboxesQueryVariables>(GetActiveSandboxesDocument, options);\n }\nexport function useGetActiveSandboxesLazyQuery(baseOptions?: ApolloReactHooks.LazyQueryHookOptions<Types.GetActiveSandboxesQuery, Types.GetActiveSandboxesQueryVariables>) {\n const options = {...defaultOptions, ...baseOptions}\n return ApolloReactHooks.useLazyQuery<Types.GetActiveSandboxesQuery, Types.GetActiveSandboxesQueryVariables>(GetActiveSandboxesDocument, options);\n }\n// @ts-ignore\nexport function useGetActiveSandboxesSuspenseQuery(baseOptions?: ApolloReactHooks.SuspenseQueryHookOptions<Types.GetActiveSandboxesQuery, Types.GetActiveSandboxesQueryVariables>): ApolloReactHooks.UseSuspenseQueryResult<Types.GetActiveSandboxesQuery, Types.GetActiveSandboxesQueryVariables>;\nexport function useGetActiveSandboxesSuspenseQuery(baseOptions?: ApolloReactHooks.SkipToken | ApolloReactHooks.SuspenseQueryHookOptions<Types.GetActiveSandboxesQuery, Types.GetActiveSandboxesQueryVariables>): ApolloReactHooks.UseSuspenseQueryResult<Types.GetActiveSandboxesQuery | undefined, Types.GetActiveSandboxesQueryVariables>;\nexport function useGetActiveSandboxesSuspenseQuery(baseOptions?: ApolloReactHooks.SkipToken | ApolloReactHooks.SuspenseQueryHookOptions<Types.GetActiveSandboxesQuery, Types.GetActiveSandboxesQueryVariables>) {\n const options = baseOptions === ApolloReactHooks.skipToken ? baseOptions : {...defaultOptions, ...baseOptions}\n return ApolloReactHooks.useSuspenseQuery<Types.GetActiveSandboxesQuery, Types.GetActiveSandboxesQueryVariables>(GetActiveSandboxesDocument, options);\n }\nexport type GetActiveSandboxesQueryHookResult = ReturnType<typeof useGetActiveSandboxesQuery>;\nexport type GetActiveSandboxesLazyQueryHookResult = ReturnType<typeof useGetActiveSandboxesLazyQuery>;\nexport type GetActiveSandboxesSuspenseQueryHookResult = ReturnType<typeof useGetActiveSandboxesSuspenseQuery>;\nexport type GetActiveSandboxesQueryResult = Apollo.QueryResult<Types.GetActiveSandboxesQuery, Types.GetActiveSandboxesQueryVariables>;"],"mappings":";;AA0DsC,CAAG;;;;OA8BC,CAAG;;;;;AA+B7C,IAAa,IAAwB,CAAG;;;;;;;;;;;OAsC3B,IAA8B,CAAG;;;;;;;OAkCjC,IAA2B,CAAG;;;;;;;;;;;OAwC9B,IAAqB,CAAG;;;;;;;;;;;OAiDxB,IAA6B,CAAG"}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { ApolloClient } from '@apollo/client';
|
|
2
|
-
import { AssistantArtifact, AssistantMode } from '../types/assistant';
|
|
3
|
-
import { PageContext } from '../utils/pageContext';
|
|
4
|
-
|
|
5
|
-
export interface AssistantPromptResult {
|
|
6
|
-
response: string;
|
|
7
|
-
tokens?: {
|
|
8
|
-
input: number;
|
|
9
|
-
output: number;
|
|
10
|
-
};
|
|
11
|
-
artifacts?: AssistantArtifact[];
|
|
12
|
-
}
|
|
13
|
-
export interface AssistantRawMessagePart {
|
|
14
|
-
type?: string;
|
|
15
|
-
text?: string;
|
|
16
|
-
tool?: string;
|
|
17
|
-
state?: {
|
|
18
|
-
status?: string;
|
|
19
|
-
input?: unknown;
|
|
20
|
-
output?: unknown;
|
|
21
|
-
raw?: unknown;
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
export interface AssistantRawMessage {
|
|
25
|
-
info?: {
|
|
26
|
-
id?: string;
|
|
27
|
-
role?: string;
|
|
28
|
-
providerID?: string;
|
|
29
|
-
modelID?: string;
|
|
30
|
-
tokens?: {
|
|
31
|
-
input: number;
|
|
32
|
-
output: number;
|
|
33
|
-
};
|
|
34
|
-
time?: {
|
|
35
|
-
created?: number;
|
|
36
|
-
completed?: number;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
parts?: AssistantRawMessagePart[];
|
|
40
|
-
}
|
|
41
|
-
export interface AssistantSandboxAuthContext {
|
|
42
|
-
accessToken?: string | null;
|
|
43
|
-
workspaceToken?: string | null;
|
|
44
|
-
userId?: string | null;
|
|
45
|
-
organizationId?: string | null;
|
|
46
|
-
}
|
|
47
|
-
export interface AssistantSessionInfo {
|
|
48
|
-
id: string;
|
|
49
|
-
mode: string;
|
|
50
|
-
}
|
|
51
|
-
export interface DownloadedAssistantArtifact {
|
|
52
|
-
filename: string;
|
|
53
|
-
mimeType: string;
|
|
54
|
-
contentBase64: string;
|
|
55
|
-
}
|
|
56
|
-
export declare function findExistingSandbox(_apollo: ApolloClient, workspaceId: string, mode: AssistantMode, authContext?: AssistantSandboxAuthContext): Promise<string | null>;
|
|
57
|
-
export declare function createAssistantSandbox(_apollo: ApolloClient, mode: AssistantMode, workspaceId: string, authContext?: AssistantSandboxAuthContext): Promise<string>;
|
|
58
|
-
export declare function waitForSandboxReady(_apollo: ApolloClient, sandboxId: string, workspaceId: string, authContext?: AssistantSandboxAuthContext, maxWaitMs?: number, onProgress?: (message: string) => void): Promise<void>;
|
|
59
|
-
export declare function waitForAssistantServiceReady(apollo: ApolloClient, sandboxId: string, workspaceId: string, authContext?: AssistantSandboxAuthContext, maxWaitMs?: number, onProgress?: (message: string) => void): Promise<void>;
|
|
60
|
-
export declare function createAssistantSession(apollo: ApolloClient, sandboxId: string, workspaceId: string, mode: AssistantMode, authContext?: AssistantSandboxAuthContext): Promise<{
|
|
61
|
-
sessionId: string;
|
|
62
|
-
}>;
|
|
63
|
-
export declare function getAssistantSession(apollo: ApolloClient, sandboxId: string, workspaceId: string, sessionId: string, authContext?: AssistantSandboxAuthContext): Promise<AssistantSessionInfo>;
|
|
64
|
-
export declare function sendAssistantPrompt(apollo: ApolloClient, sandboxId: string, workspaceId: string, sessionId: string, prompt: string, mode: AssistantMode, pageContext?: PageContext, authContext?: AssistantSandboxAuthContext): Promise<AssistantPromptResult>;
|
|
65
|
-
export declare function sendAssistantPromptAsync(apollo: ApolloClient, sandboxId: string, workspaceId: string, sessionId: string, prompt: string, mode: AssistantMode, pageContext?: PageContext, authContext?: AssistantSandboxAuthContext): Promise<void>;
|
|
66
|
-
export declare function getAssistantMessages(apollo: ApolloClient, sandboxId: string, workspaceId: string, sessionId: string, authContext?: AssistantSandboxAuthContext, limit?: number): Promise<AssistantRawMessage[]>;
|
|
67
|
-
export declare function checkAssistantAiCredits(_apollo: ApolloClient, workspaceId: string, authContext?: AssistantSandboxAuthContext): Promise<boolean>;
|
|
68
|
-
export declare function reportAssistantAiTokenUsage(_apollo: ApolloClient, workspaceId: string, sessionId: string, messageId: string, model: string | undefined, tokens: {
|
|
69
|
-
input: number;
|
|
70
|
-
output: number;
|
|
71
|
-
}, authContext?: AssistantSandboxAuthContext): Promise<void>;
|
|
72
|
-
export declare function getAssistantArtifacts(apollo: ApolloClient, sandboxId: string, workspaceId: string, sessionId: string, authContext?: AssistantSandboxAuthContext): Promise<AssistantArtifact[]>;
|
|
73
|
-
export declare function downloadAssistantArtifact(apollo: ApolloClient, sandboxId: string, workspaceId: string, sessionId: string, artifactPath: string, authContext?: AssistantSandboxAuthContext): Promise<DownloadedAssistantArtifact>;
|
|
74
|
-
export declare function sendHeartbeat(apollo: ApolloClient, sandboxId: string, workspaceId: string, sessionId: string, authContext?: AssistantSandboxAuthContext): Promise<void>;
|
|
75
|
-
export declare function extendAssistantSandboxTTL(_apollo: ApolloClient, sandboxId: string, workspaceId: string, additionalSeconds?: number, authContext?: AssistantSandboxAuthContext): Promise<void>;
|
|
76
|
-
//# sourceMappingURL=assistantApi.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assistantApi.d.ts","sourceRoot":"","sources":["../../../src/technospam/services/assistantApi.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACpF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAgGjE,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,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AC,EAAE,2BAA2B,GACxC,OAAO,CAAC,IAAI,CAAC,CAcf;AAED,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,WAAW,CAAC,EAAE,2BAA2B,GACxC,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAc9B;AAED,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,WAAW,CAAC,EAAE,2BAA2B,GACxC,OAAO,CAAC,2BAA2B,CAAC,CAsBtC;AAID,wBAAsB,aAAa,CACjC,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,WAAW,CAAC,EAAE,2BAA2B,GACxC,OAAO,CAAC,IAAI,CAAC,CAUf;AAED,wBAAsB,yBAAyB,CAC7C,OAAO,EAAE,YAAY,EACrB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,iBAAiB,SAAM,EACvB,WAAW,CAAC,EAAE,2BAA2B,GACxC,OAAO,CAAC,IAAI,CAAC,CAWf"}
|
|
@@ -1,222 +0,0 @@
|
|
|
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/technospam/services/assistantApi.ts
|
|
4
|
-
var o = "burdenoffregistry.azurecr.io", s = "alpha-proxy-auth-v1", c = "alpha-delegated-auth-v11", l = "sandbox-app-client-headers-v1";
|
|
5
|
-
function u(e) {
|
|
6
|
-
switch (e) {
|
|
7
|
-
case "general": return s;
|
|
8
|
-
case "assistant":
|
|
9
|
-
case "api-calls": return c;
|
|
10
|
-
case "vibe-plugins": return s;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
function d(e) {
|
|
14
|
-
return `${o}/wspace/ai-assistant-${e === "assistant" ? "api-calls" : e}:${u(e)}`;
|
|
15
|
-
}
|
|
16
|
-
function f(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": return {
|
|
25
|
-
cpuRequest: "150m",
|
|
26
|
-
cpuLimit: "750m",
|
|
27
|
-
memoryRequest: "384Mi",
|
|
28
|
-
memoryLimit: "1536Mi"
|
|
29
|
-
};
|
|
30
|
-
case "assistant":
|
|
31
|
-
case "api-calls": return {
|
|
32
|
-
cpuRequest: "150m",
|
|
33
|
-
cpuLimit: "750m",
|
|
34
|
-
memoryRequest: "384Mi",
|
|
35
|
-
memoryLimit: "1536Mi"
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
function p(e) {
|
|
40
|
-
let t = e.metadata?.assistantMode;
|
|
41
|
-
if (t === "assistant" || t === "general" || t === "api-calls" || t === "vibe-plugins") return t;
|
|
42
|
-
let n = e.name ?? "";
|
|
43
|
-
return n.startsWith("ai-assistant-api-calls-") ? "api-calls" : n.startsWith("ai-assistant-general-") ? "general" : n.startsWith("ai-assistant-assistant-") ? "assistant" : n.startsWith("ai-assistant-vibe-plugins-") ? "vibe-plugins" : null;
|
|
44
|
-
}
|
|
45
|
-
function m(e, t) {
|
|
46
|
-
let n = {};
|
|
47
|
-
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;
|
|
48
|
-
}
|
|
49
|
-
function h(e, t) {
|
|
50
|
-
return {
|
|
51
|
-
workspaceId: e,
|
|
52
|
-
...t?.organizationId ? { custom: { organizationId: t.organizationId } } : {}
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
async function g(e) {
|
|
56
|
-
let t = await fetch("/workspaces/graphql", {
|
|
57
|
-
method: "POST",
|
|
58
|
-
headers: {
|
|
59
|
-
"Content-Type": "application/json",
|
|
60
|
-
...m(e.workspaceId, e.authContext)?.headers ?? {}
|
|
61
|
-
},
|
|
62
|
-
body: JSON.stringify({
|
|
63
|
-
query: a(e.document),
|
|
64
|
-
variables: e.variables
|
|
65
|
-
})
|
|
66
|
-
}), n = await t.json().catch(() => null);
|
|
67
|
-
if (!t.ok) {
|
|
68
|
-
let e = n?.errors?.map((e) => e.message).join(", "), r = Error(e || `Sandbox GraphQL HTTP ${t.status}`);
|
|
69
|
-
throw r.statusCode = t.status, r.result = n ?? void 0, r;
|
|
70
|
-
}
|
|
71
|
-
if (!n) throw Error("Sandbox GraphQL returned empty response");
|
|
72
|
-
if (n.errors?.length) throw Error(n.errors.map((e) => e.message).join(", "));
|
|
73
|
-
if (!n.data) throw Error("Sandbox GraphQL returned no data");
|
|
74
|
-
return n.data;
|
|
75
|
-
}
|
|
76
|
-
async function _(e, t, r, i) {
|
|
77
|
-
return ((await g({
|
|
78
|
-
document: n,
|
|
79
|
-
variables: { context: h(t, i) },
|
|
80
|
-
workspaceId: t,
|
|
81
|
-
authContext: i
|
|
82
|
-
})).getActiveSandboxes ?? []).find((e) => (e.status === "RUNNING" || e.status === "PROVISIONING" || e.status === "PENDING") && e.template === "AI_BUILDER" && p(e) === r && (!i?.userId || e.createdBy === i.userId) && e.metadata?.authStrategy === l && e.metadata?.imageTag === u(r))?.id ?? null;
|
|
83
|
-
}
|
|
84
|
-
async function v(t, n, r, i) {
|
|
85
|
-
let a = f(n), o = [
|
|
86
|
-
{
|
|
87
|
-
name: "AI_ASSISTANT_MODE",
|
|
88
|
-
value: n
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
name: "HOSTNAME",
|
|
92
|
-
value: "0.0.0.0"
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
name: "WORKSPACE_ID",
|
|
96
|
-
value: r
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
name: "AI_ASSISTANT_PRODUCT",
|
|
100
|
-
value: "technospam"
|
|
101
|
-
}
|
|
102
|
-
], s = await g({
|
|
103
|
-
document: e,
|
|
104
|
-
variables: { input: {
|
|
105
|
-
name: `ai-assistant-${n}-${Date.now()}`,
|
|
106
|
-
description: `AI Assistant sandbox (${n} mode)`,
|
|
107
|
-
template: "AI_BUILDER",
|
|
108
|
-
mode: "DEPLOYMENT",
|
|
109
|
-
containers: [{
|
|
110
|
-
name: "ai-assistant",
|
|
111
|
-
image: d(n),
|
|
112
|
-
ports: [{
|
|
113
|
-
containerPort: 8080,
|
|
114
|
-
name: "http"
|
|
115
|
-
}],
|
|
116
|
-
env: o
|
|
117
|
-
}],
|
|
118
|
-
resources: {
|
|
119
|
-
cpuRequest: a.cpuRequest,
|
|
120
|
-
cpuLimit: a.cpuLimit,
|
|
121
|
-
memoryRequest: a.memoryRequest,
|
|
122
|
-
memoryLimit: a.memoryLimit
|
|
123
|
-
},
|
|
124
|
-
ttlSeconds: 600,
|
|
125
|
-
metadata: {
|
|
126
|
-
assistantMode: n,
|
|
127
|
-
assistantOwnerUserId: i?.userId ?? null,
|
|
128
|
-
assistantOrganizationId: i?.organizationId ?? null,
|
|
129
|
-
authStrategy: l,
|
|
130
|
-
imageTag: u(n)
|
|
131
|
-
},
|
|
132
|
-
context: h(r, i)
|
|
133
|
-
} },
|
|
134
|
-
workspaceId: r,
|
|
135
|
-
authContext: i
|
|
136
|
-
});
|
|
137
|
-
if (!s?.createSandbox?.id) throw Error("createSandbox returned empty response");
|
|
138
|
-
return s.createSandbox.id;
|
|
139
|
-
}
|
|
140
|
-
async function y(e, t, n, i, a = 3e5, o) {
|
|
141
|
-
let s = Date.now();
|
|
142
|
-
for (; Date.now() - s < a;) {
|
|
143
|
-
let e = await g({
|
|
144
|
-
document: r,
|
|
145
|
-
variables: {
|
|
146
|
-
id: t,
|
|
147
|
-
context: h(n, i)
|
|
148
|
-
},
|
|
149
|
-
workspaceId: n,
|
|
150
|
-
authContext: i
|
|
151
|
-
}), a = e?.getSandbox?.status, c = e?.getSandbox?.errorMessage;
|
|
152
|
-
if (a === "RUNNING") return;
|
|
153
|
-
if (a === "FAILED" || a === "STOPPED" || a === "EXPIRED") throw Error(c ? `Sandbox ${a.toLowerCase()}: ${c}` : `Sandbox ${a.toLowerCase()}`);
|
|
154
|
-
let l = Math.max(1, Math.round((Date.now() - s) / 1e3));
|
|
155
|
-
o?.(`Starting assistant environment... (${l}s)`), await new Promise((e) => setTimeout(e, 2e3));
|
|
156
|
-
}
|
|
157
|
-
throw Error("Sandbox startup timed out");
|
|
158
|
-
}
|
|
159
|
-
async function b(e, t, n, r, a, o, s) {
|
|
160
|
-
let c = (await g({
|
|
161
|
-
document: i,
|
|
162
|
-
variables: { input: {
|
|
163
|
-
sandboxId: t,
|
|
164
|
-
path: r,
|
|
165
|
-
method: a,
|
|
166
|
-
body: o,
|
|
167
|
-
context: h(n, s)
|
|
168
|
-
} },
|
|
169
|
-
workspaceId: n,
|
|
170
|
-
authContext: s
|
|
171
|
-
})).proxySandboxRequest;
|
|
172
|
-
if (!c || c.status >= 400) {
|
|
173
|
-
let e = c?.body;
|
|
174
|
-
throw Error(e?.error ?? `Proxy error: ${c?.status ?? "unknown"}`);
|
|
175
|
-
}
|
|
176
|
-
return c.body;
|
|
177
|
-
}
|
|
178
|
-
async function x(e, t, n, r, i = 9e4, a) {
|
|
179
|
-
let o = Date.now();
|
|
180
|
-
for (; Date.now() - o < i;) {
|
|
181
|
-
try {
|
|
182
|
-
await b(e, t, n, "/health", "GET", void 0, r);
|
|
183
|
-
return;
|
|
184
|
-
} catch (e) {
|
|
185
|
-
let t = e instanceof Error ? e.message : String(e);
|
|
186
|
-
if (!/proxy error: 502|proxy error: 503|proxy error: 404|service not available/i.test(t)) throw e;
|
|
187
|
-
}
|
|
188
|
-
let i = Math.max(1, Math.round((Date.now() - o) / 1e3));
|
|
189
|
-
a?.(`Connecting to assistant... (${i}s)`), await new Promise((e) => setTimeout(e, 2e3));
|
|
190
|
-
}
|
|
191
|
-
throw Error("Assistant service did not become healthy before timeout");
|
|
192
|
-
}
|
|
193
|
-
async function S(e, t, n, r, i) {
|
|
194
|
-
return { sessionId: (await b(e, t, n, "/sessions", "POST", { mode: r }, i)).session.id };
|
|
195
|
-
}
|
|
196
|
-
async function C(e, t, n, r, i, a, o, s) {
|
|
197
|
-
let c = {
|
|
198
|
-
mode: a,
|
|
199
|
-
prompt: i,
|
|
200
|
-
pageContext: o ?? void 0
|
|
201
|
-
};
|
|
202
|
-
await b(e, t, n, `/sessions/${r}/prompt-async`, "POST", c, s);
|
|
203
|
-
}
|
|
204
|
-
async function w(e, t, n, r, i, a = 50) {
|
|
205
|
-
return (await b(e, t, n, `/sessions/${r}/messages?limit=${a}`, "GET", void 0, i)).messages ?? [];
|
|
206
|
-
}
|
|
207
|
-
async function T(e, n, r, i = 600, a) {
|
|
208
|
-
await g({
|
|
209
|
-
document: t,
|
|
210
|
-
variables: {
|
|
211
|
-
id: n,
|
|
212
|
-
additionalSeconds: i,
|
|
213
|
-
context: h(r, a)
|
|
214
|
-
},
|
|
215
|
-
workspaceId: r,
|
|
216
|
-
authContext: a
|
|
217
|
-
});
|
|
218
|
-
}
|
|
219
|
-
//#endregion
|
|
220
|
-
export { v as createAssistantSandbox, S as createAssistantSession, T as extendAssistantSandboxTTL, _ as findExistingSandbox, w as getAssistantMessages, C as sendAssistantPromptAsync, x as waitForAssistantServiceReady, y as waitForSandboxReady };
|
|
221
|
-
|
|
222
|
-
//# sourceMappingURL=assistantApi.js.map
|