@loopstack/loopstack-studio 0.33.0 → 0.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (146) hide show
  1. package/dist/app/EnvironmentEmbedRoot.js +17 -25
  2. package/dist/components/layout/StudioSidebar.js +34 -34
  3. package/dist/components/messages/CompletionMessagePaper.js +25 -29
  4. package/dist/events/api-client-events.js +13 -1
  5. package/dist/events/index.js +1 -0
  6. package/dist/features/code-explorer/components/FileTabsBarBase.js +1 -1
  7. package/dist/features/code-explorer/index.js +0 -3
  8. package/dist/features/dashboard/AppLauncher.js +111 -64
  9. package/dist/features/debug/components/WorkflowFlowViewer.js +2 -1
  10. package/dist/features/debug/components/workflow-flow/WorkflowGraph.js +2 -1
  11. package/dist/features/documents/DocumentRenderer.js +42 -42
  12. package/dist/features/documents/components/DocumentList.js +1 -1
  13. package/dist/features/documents/document-details/DocumentDetails.js +0 -5
  14. package/dist/features/documents/renderers/DocumentFormRenderer.js +13 -12
  15. package/dist/features/documents/renderers/LinkMessageRenderer.js +2 -1
  16. package/dist/features/documents/renderers/useDocumentTransition.js +3 -2
  17. package/dist/features/feature-registry/FeatureRegistryProvider.js +17 -18
  18. package/dist/features/feature-registry/available-features.js +3 -2
  19. package/dist/features/feature-registry/index.js +1 -1
  20. package/dist/features/file-explorer/components/FileExplorerPanel.js +64 -43
  21. package/dist/features/file-explorer/components/FileTabsBar.js +1 -1
  22. package/dist/features/file-explorer/components/FileTree.js +1 -1
  23. package/dist/features/file-explorer/file-explorer-feature.js +15 -7
  24. package/dist/features/file-explorer/hooks/useFileExplorer.js +41 -34
  25. package/dist/features/file-explorer/index.js +1 -1
  26. package/dist/features/file-explorer/providers/FileExplorerProvider.js +91 -89
  27. package/dist/features/git/components/WorkbenchGitPanel.js +7 -10
  28. package/dist/features/git/hooks/useGit.js +55 -57
  29. package/dist/features/health/LocalHealthCheck.js +46 -47
  30. package/dist/features/oauth/OAuthPromptRenderer.js +6 -5
  31. package/dist/features/runs/Runs.js +3 -2
  32. package/dist/features/secrets/components/WorkbenchSecretsPanel.js +1 -1
  33. package/dist/features/secrets/renderers/SecretInputRenderer.js +3 -2
  34. package/dist/features/workbench/Workbench.js +16 -16
  35. package/dist/features/workbench/WorkflowItem.js +5 -8
  36. package/dist/features/workbench/components/NewRunDialog.js +173 -171
  37. package/dist/features/workbench/components/PreviewEmptyState.js +1 -1
  38. package/dist/features/workbench/components/WorkbenchIconSidebar.js +1 -1
  39. package/dist/features/workbench/components/WorkbenchRunsPanel.js +2 -1
  40. package/dist/features/workbench/components/WorkbenchSidebarShell.js +3 -3
  41. package/dist/features/workbench/components/WorkflowForms.js +1 -1
  42. package/dist/features/workbench/components/WorkflowHistoryItem.js +2 -1
  43. package/dist/features/workbench/components/buttons/WorkflowButtons.js +8 -14
  44. package/dist/features/workbench/hooks/useLlmStreamingDocuments.js +65 -132
  45. package/dist/features/workbench/hooks/useWorkflowData.js +8 -6
  46. package/dist/features/workbench/index.js +1 -1
  47. package/dist/features/workspaces/Workspaces.js +5 -3
  48. package/dist/features/workspaces/components/CreateWorkspace.js +7 -5
  49. package/dist/features/workspaces/components/ExecutionTimeline.js +69 -65
  50. package/dist/features/workspaces/components/WorkflowRunForm.js +6 -4
  51. package/dist/features/workspaces/components/WorkspaceHomePage.js +1 -1
  52. package/dist/hooks/index.js +5 -5
  53. package/dist/hooks/useAuth.js +14 -53
  54. package/dist/hooks/useConfig.js +13 -37
  55. package/dist/hooks/useDocuments.js +5 -30
  56. package/dist/hooks/useEnvironments.js +34 -24
  57. package/dist/hooks/useProcessor.js +2 -31
  58. package/dist/hooks/useSecrets.js +71 -53
  59. package/dist/hooks/useWorkflows.js +43 -172
  60. package/dist/hooks/useWorkspaces.js +24 -130
  61. package/dist/index.d.ts +137 -481
  62. package/dist/index.js +15 -17
  63. package/dist/loopstack-studio.css +1 -1
  64. package/dist/packages/client/dist/client.js +35 -0
  65. package/dist/packages/client/dist/http.js +47 -0
  66. package/dist/packages/client/dist/index.js +15 -0
  67. package/dist/packages/client/dist/queries/query-keys.js +94 -0
  68. package/dist/packages/client/dist/queries/query-options.js +97 -0
  69. package/dist/packages/client/dist/resources/auth.js +10 -0
  70. package/dist/packages/client/dist/resources/config.js +11 -0
  71. package/dist/packages/client/dist/resources/dashboard.js +4 -0
  72. package/dist/packages/client/dist/resources/documents.js +7 -0
  73. package/dist/packages/client/dist/resources/processor.js +7 -0
  74. package/dist/packages/client/dist/resources/workflows.js +13 -0
  75. package/dist/packages/client/dist/resources/workspaces.js +12 -0
  76. package/dist/packages/client/dist/stream/invalidations.js +20 -0
  77. package/dist/packages/client/dist/stream/llm-reducer.js +65 -0
  78. package/dist/packages/client/dist/stream/sse-parser.js +40 -0
  79. package/dist/packages/client/dist/stream/stream.js +147 -0
  80. package/dist/packages/contracts/dist/events/client-message-base.schema.js +6 -0
  81. package/dist/packages/contracts/dist/events/client-message.schema.js +24 -0
  82. package/dist/packages/contracts/dist/events/index.js +6 -0
  83. package/dist/packages/contracts/dist/events/llm-events.schema.js +44 -0
  84. package/dist/packages/contracts/dist/events/stream-events.schema.js +4 -0
  85. package/dist/packages/contracts/dist/events/workflow-events.schema.js +20 -0
  86. package/dist/packages/contracts/dist/events/workspace-events.schema.js +5 -0
  87. package/dist/packages/contracts/dist/types/types/ui-message.type.js +39 -0
  88. package/dist/packages/react/dist/hooks/mutations.js +175 -0
  89. package/dist/packages/react/dist/hooks/queries.js +139 -0
  90. package/dist/packages/react/dist/hooks/use-live-invalidation.js +39 -0
  91. package/dist/packages/react/dist/hooks/use-llm-stream.js +18 -0
  92. package/dist/packages/react/dist/index.js +5 -0
  93. package/dist/packages/react/dist/provider.js +15 -0
  94. package/dist/pages/DashboardPage.js +2 -1
  95. package/dist/pages/DebugWorkflowDetailsPage.js +2 -1
  96. package/dist/pages/DebugWorkflowsPage.js +2 -1
  97. package/dist/pages/EmbedWorkbenchPage.js +50 -43
  98. package/dist/pages/PreviewWorkbenchPage.js +60 -59
  99. package/dist/pages/StudioLandingPage.js +1 -1
  100. package/dist/pages/WorkbenchPage.js +53 -47
  101. package/dist/pages/WorkflowDebugPage.js +3 -2
  102. package/dist/pages/WorkspacePage.js +42 -27
  103. package/dist/pages/WorkspaceRunsPage.js +36 -27
  104. package/dist/providers/LoopstackClientProvider.js +31 -0
  105. package/dist/services/createApiClient.js +9 -3
  106. package/dist/services/index.js +0 -1
  107. package/dist/services/reporting-fetch.js +13 -0
  108. package/package.json +4 -3
  109. package/dist/api/auth.js +0 -10
  110. package/dist/api/client.js +0 -13
  111. package/dist/api/config.js +0 -11
  112. package/dist/api/dashboard.js +0 -4
  113. package/dist/api/documents.js +0 -7
  114. package/dist/api/environments.js +0 -8
  115. package/dist/api/index.js +0 -28
  116. package/dist/api/processor.js +0 -7
  117. package/dist/api/secrets.js +0 -16
  118. package/dist/api/workflows.js +0 -15
  119. package/dist/api/workspaces.js +0 -12
  120. package/dist/events/sse-client-events.js +0 -13
  121. package/dist/features/code-explorer/CodeExplorer.js +0 -6
  122. package/dist/features/code-explorer/components/CodeExplorerTree.js +0 -6
  123. package/dist/features/code-explorer/components/FileTabsBar.js +0 -4
  124. package/dist/features/code-explorer/providers/CodeExplorerProvider.js +0 -5
  125. package/dist/features/file-explorer/api/files.js +0 -7
  126. package/dist/features/git/api/git.js +0 -9
  127. package/dist/hooks/query-keys.js +0 -145
  128. package/dist/hooks/useApi.js +0 -15
  129. package/dist/hooks/useFiles.js +0 -3
  130. package/dist/node_modules/lodash/_Symbol.js +0 -7
  131. package/dist/node_modules/lodash/_baseGetTag.js +0 -13
  132. package/dist/node_modules/lodash/_baseTrim.js +0 -11
  133. package/dist/node_modules/lodash/_freeGlobal.js +0 -6
  134. package/dist/node_modules/lodash/_getRawTag.js +0 -17
  135. package/dist/node_modules/lodash/_objectToString.js +0 -10
  136. package/dist/node_modules/lodash/_root.js +0 -8
  137. package/dist/node_modules/lodash/_trimmedEndIndex.js +0 -11
  138. package/dist/node_modules/lodash/debounce.js +0 -53
  139. package/dist/node_modules/lodash/isObject.js +0 -10
  140. package/dist/node_modules/lodash/isObjectLike.js +0 -9
  141. package/dist/node_modules/lodash/isSymbol.js +0 -12
  142. package/dist/node_modules/lodash/now.js +0 -10
  143. package/dist/node_modules/lodash/toNumber.js +0 -22
  144. package/dist/providers/InvalidationEventsProvider.js +0 -41
  145. package/dist/providers/SseProvider.js +0 -37
  146. package/dist/services/eventEmitter.js +0 -12
@@ -1,18 +1,21 @@
1
+ import { useAppsConfig, useWorkspace } from "../packages/react/dist/hooks/queries.js";
2
+ import "../hooks/useConfig.js";
3
+ import "../hooks/useWorkspaces.js";
1
4
  import { useStudio } from "../providers/StudioProvider.js";
2
- import { useAppsConfig } from "../hooks/useConfig.js";
3
- import { useWorkspace } from "../hooks/useWorkspaces.js";
4
5
  import MainLayout_default from "../components/layout/MainLayout.js";
5
6
  import ErrorSnackbar_default from "../components/feedback/ErrorSnackbar.js";
7
+ import { FeatureRegistryProvider } from "../features/feature-registry/FeatureRegistryProvider.js";
8
+ import "../features/feature-registry/index.js";
6
9
  import { WorkbenchLayoutProvider } from "../features/workbench/providers/WorkbenchLayoutProvider.js";
7
10
  import { WorkbenchSidebarShell } from "../features/workbench/components/WorkbenchSidebarShell.js";
8
11
  import "../features/workspaces/components/WorkspaceHomePage.js";
9
12
  import { useDefaultEnvironmentPreviewUrl } from "../hooks/useEnvironmentPreviewUrl.js";
10
13
  import { c } from "react/compiler-runtime";
11
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
14
+ import { jsx, jsxs } from "react/jsx-runtime";
12
15
  import { useParams } from "react-router-dom";
13
16
  import { Loader2 } from "lucide-react";
14
17
  var WorkspacePage_default = () => {
15
- let h = c(30), { router: g } = useStudio(), { workspaceId: _ } = useParams(), v = useWorkspace(_), y = useAppsConfig(), b = useDefaultEnvironmentPreviewUrl(), x = v.data, S;
18
+ let h = c(35), { router: g } = useStudio(), { workspaceId: _ } = useParams(), v = useWorkspace(_), y = useAppsConfig(), b = useDefaultEnvironmentPreviewUrl(), x = v.data, S;
16
19
  h[0] === g ? S = h[1] : (S = g.getWorkspaces(), h[0] = g, h[1] = S);
17
20
  let C;
18
21
  h[2] === S ? C = h[3] : (C = {
@@ -26,37 +29,49 @@ var WorkspacePage_default = () => {
26
29
  }, h[4] = w, h[5] = T);
27
30
  let E;
28
31
  h[6] !== C || h[7] !== T ? (E = [C, T], h[6] = C, h[7] = T, h[8] = E) : E = h[8];
29
- let D = E, O = v.isLoading || y.isLoading, k;
30
- h[9] === O ? k = h[10] : (k = O ? /* @__PURE__ */ jsx(Loader2, { className: "h-6 w-6 animate-spin" }) : "", h[9] = O, h[10] = k);
32
+ let D = E, O = v.isLoading || y.isLoading;
33
+ if (!x) {
34
+ let t;
35
+ h[9] === O ? t = h[10] : (t = O ? /* @__PURE__ */ jsx(Loader2, { className: "h-6 w-6 animate-spin" }) : null, h[9] = O, h[10] = t);
36
+ let f;
37
+ h[11] === v.error ? f = h[12] : (f = /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: v.error }), h[11] = v.error, h[12] = f);
38
+ let p;
39
+ h[13] === y.error ? p = h[14] : (p = /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: y.error }), h[13] = y.error, h[14] = p);
40
+ let m;
41
+ return h[15] !== D || h[16] !== t || h[17] !== f || h[18] !== p ? (m = /* @__PURE__ */ jsxs(MainLayout_default, {
42
+ breadcrumbsData: D,
43
+ children: [
44
+ t,
45
+ f,
46
+ p
47
+ ]
48
+ }), h[15] = D, h[16] = t, h[17] = f, h[18] = p, h[19] = m) : m = h[19], m;
49
+ }
50
+ let k;
51
+ h[20] === y.error ? k = h[21] : (k = /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: y.error }), h[20] = y.error, h[21] = k);
31
52
  let A;
32
- h[11] === v.error ? A = h[12] : (A = /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: v.error }), h[11] = v.error, h[12] = A);
33
- let j;
34
- h[13] === y.error ? j = h[14] : (j = /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: y.error }), h[13] = y.error, h[14] = j);
35
- let M;
36
- h[15] !== O || h[16] !== x ? (M = x && !O ? /* @__PURE__ */ jsx("div", {
53
+ h[22] === x ? A = h[23] : (A = /* @__PURE__ */ jsx("div", {
37
54
  className: "flex flex-col items-center justify-center py-16",
38
55
  children: /* @__PURE__ */ jsx("p", {
39
56
  className: "text-muted-foreground",
40
57
  children: "No home page configured for this workspace."
41
58
  })
42
- }) : null, h[15] = O, h[16] = x, h[17] = M) : M = h[17];
43
- let N;
44
- h[18] !== k || h[19] !== A || h[20] !== j || h[21] !== M ? (N = /* @__PURE__ */ jsxs(Fragment, { children: [
45
- k,
46
- A,
47
- j,
48
- M
49
- ] }), h[18] = k, h[19] = A, h[20] = j, h[21] = M, h[22] = N) : N = h[22];
50
- let P;
51
- h[23] !== D || h[24] !== N ? (P = /* @__PURE__ */ jsx(WorkbenchSidebarShell, { children: /* @__PURE__ */ jsx(MainLayout_default, {
59
+ }), h[22] = x, h[23] = A);
60
+ let j;
61
+ h[24] !== D || h[25] !== k || h[26] !== A ? (j = /* @__PURE__ */ jsx(WorkbenchSidebarShell, { children: /* @__PURE__ */ jsxs(MainLayout_default, {
52
62
  breadcrumbsData: D,
53
- children: N
54
- }) }), h[23] = D, h[24] = N, h[25] = P) : P = h[25];
55
- let F;
56
- return h[26] !== b || h[27] !== P || h[28] !== _ ? (F = /* @__PURE__ */ jsx(WorkbenchLayoutProvider, {
63
+ children: [k, A]
64
+ }) }), h[24] = D, h[25] = k, h[26] = A, h[27] = j) : j = h[27];
65
+ let M;
66
+ h[28] !== b || h[29] !== j || h[30] !== _ ? (M = /* @__PURE__ */ jsx(WorkbenchLayoutProvider, {
57
67
  workspaceId: _,
58
68
  getEnvironmentPreviewUrl: b,
59
- children: P
60
- }), h[26] = b, h[27] = P, h[28] = _, h[29] = F) : F = h[29], F;
69
+ children: j
70
+ }), h[28] = b, h[29] = j, h[30] = _, h[31] = M) : M = h[31];
71
+ let N;
72
+ return h[32] !== M || h[33] !== x.appName ? (N = /* @__PURE__ */ jsx(FeatureRegistryProvider, {
73
+ appName: x.appName,
74
+ children: M
75
+ }), h[32] = M, h[33] = x.appName, h[34] = N) : N = h[34], N;
61
76
  };
62
77
  export { WorkspacePage_default as default };
@@ -1,17 +1,20 @@
1
+ import { useWorkspace } from "../packages/react/dist/hooks/queries.js";
2
+ import "../hooks/useWorkspaces.js";
1
3
  import { useStudio } from "../providers/StudioProvider.js";
2
- import { useWorkspace } from "../hooks/useWorkspaces.js";
3
4
  import MainLayout_default from "../components/layout/MainLayout.js";
4
5
  import ErrorSnackbar_default from "../components/feedback/ErrorSnackbar.js";
6
+ import { FeatureRegistryProvider } from "../features/feature-registry/FeatureRegistryProvider.js";
7
+ import "../features/feature-registry/index.js";
5
8
  import { WorkbenchLayoutProvider } from "../features/workbench/providers/WorkbenchLayoutProvider.js";
6
9
  import ExecutionTimeline_default from "../features/workspaces/components/ExecutionTimeline.js";
7
10
  import { WorkbenchSidebarShell } from "../features/workbench/components/WorkbenchSidebarShell.js";
8
11
  import { useDefaultEnvironmentPreviewUrl } from "../hooks/useEnvironmentPreviewUrl.js";
9
12
  import { c } from "react/compiler-runtime";
10
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
13
+ import { jsx, jsxs } from "react/jsx-runtime";
11
14
  import { useParams } from "react-router-dom";
12
15
  import { Loader2 } from "lucide-react";
13
16
  var WorkspaceRunsPage_default = () => {
14
- let h = c(34), { router: g } = useStudio(), { workspaceId: _ } = useParams(), v = useWorkspace(_), y = useDefaultEnvironmentPreviewUrl(), b = v.data, x;
17
+ let h = c(37), { router: g } = useStudio(), { workspaceId: _ } = useParams(), v = useWorkspace(_), y = useDefaultEnvironmentPreviewUrl(), b = v.data, x;
15
18
  h[0] === g ? x = h[1] : (x = g.getWorkspaces(), h[0] = g, h[1] = x);
16
19
  let S;
17
20
  h[2] === x ? S = h[3] : (S = {
@@ -36,34 +39,40 @@ var WorkspaceRunsPage_default = () => {
36
39
  T,
37
40
  E
38
41
  ], h[11] = S, h[12] = T, h[13] = D) : D = h[13];
39
- let O = D, k = b?.title ?? "", A;
40
- h[14] === k ? A = h[15] : (A = /* @__PURE__ */ jsxs("h1", {
42
+ let O = D;
43
+ if (!b) {
44
+ let n;
45
+ h[14] === v.isLoading ? n = h[15] : (n = v.isLoading ? /* @__PURE__ */ jsx(Loader2, { className: "h-6 w-6 animate-spin" }) : null, h[14] = v.isLoading, h[15] = n);
46
+ let p;
47
+ h[16] === v.error ? p = h[17] : (p = /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: v.error }), h[16] = v.error, h[17] = p);
48
+ let m;
49
+ return h[18] !== O || h[19] !== n || h[20] !== p ? (m = /* @__PURE__ */ jsxs(MainLayout_default, {
50
+ breadcrumbsData: O,
51
+ children: [n, p]
52
+ }), h[18] = O, h[19] = n, h[20] = p, h[21] = m) : m = h[21], m;
53
+ }
54
+ let k;
55
+ h[22] === b.title ? k = h[23] : (k = /* @__PURE__ */ jsxs("h1", {
41
56
  className: "mb-4 text-3xl font-bold tracking-tight",
42
- children: [k, " — Runs"]
43
- }), h[14] = k, h[15] = A);
57
+ children: [b.title, " — Runs"]
58
+ }), h[22] = b.title, h[23] = k);
59
+ let A;
60
+ h[24] === b ? A = h[25] : (A = /* @__PURE__ */ jsx(ExecutionTimeline_default, { workspace: b }), h[24] = b, h[25] = A);
44
61
  let j;
45
- h[16] === v.isLoading ? j = h[17] : (j = v.isLoading ? /* @__PURE__ */ jsx(Loader2, { className: "h-6 w-6 animate-spin" }) : "", h[16] = v.isLoading, h[17] = j);
46
- let M;
47
- h[18] === v.error ? M = h[19] : (M = /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: v.error }), h[18] = v.error, h[19] = M);
48
- let N;
49
- h[20] === b ? N = h[21] : (N = b ? /* @__PURE__ */ jsx(ExecutionTimeline_default, { workspace: b }) : "", h[20] = b, h[21] = N);
50
- let P;
51
- h[22] !== M || h[23] !== N || h[24] !== A || h[25] !== j ? (P = /* @__PURE__ */ jsxs(Fragment, { children: [
52
- A,
53
- j,
54
- M,
55
- N
56
- ] }), h[22] = M, h[23] = N, h[24] = A, h[25] = j, h[26] = P) : P = h[26];
57
- let F;
58
- h[27] !== O || h[28] !== P ? (F = /* @__PURE__ */ jsx(WorkbenchSidebarShell, { children: /* @__PURE__ */ jsx(MainLayout_default, {
62
+ h[26] !== O || h[27] !== k || h[28] !== A ? (j = /* @__PURE__ */ jsx(WorkbenchSidebarShell, { children: /* @__PURE__ */ jsxs(MainLayout_default, {
59
63
  breadcrumbsData: O,
60
- children: P
61
- }) }), h[27] = O, h[28] = P, h[29] = F) : F = h[29];
62
- let I;
63
- return h[30] !== y || h[31] !== F || h[32] !== _ ? (I = /* @__PURE__ */ jsx(WorkbenchLayoutProvider, {
64
+ children: [k, A]
65
+ }) }), h[26] = O, h[27] = k, h[28] = A, h[29] = j) : j = h[29];
66
+ let M;
67
+ h[30] !== y || h[31] !== j || h[32] !== _ ? (M = /* @__PURE__ */ jsx(WorkbenchLayoutProvider, {
64
68
  workspaceId: _,
65
69
  getEnvironmentPreviewUrl: y,
66
- children: F
67
- }), h[30] = y, h[31] = F, h[32] = _, h[33] = I) : I = h[33], I;
70
+ children: j
71
+ }), h[30] = y, h[31] = j, h[32] = _, h[33] = M) : M = h[33];
72
+ let N;
73
+ return h[34] !== M || h[35] !== b.appName ? (N = /* @__PURE__ */ jsx(FeatureRegistryProvider, {
74
+ appName: b.appName,
75
+ children: M
76
+ }), h[34] = M, h[35] = b.appName, h[36] = N) : N = h[36], N;
68
77
  };
69
78
  export { WorkspaceRunsPage_default as default };
@@ -0,0 +1,31 @@
1
+ import { LoopstackProvider } from "../packages/react/dist/provider.js";
2
+ import { createClient } from "../packages/client/dist/client.js";
3
+ import "../packages/client/dist/index.js";
4
+ import { useLiveInvalidation } from "../packages/react/dist/hooks/use-live-invalidation.js";
5
+ import "../packages/react/dist/index.js";
6
+ import { createReportingFetch } from "../services/reporting-fetch.js";
7
+ import { useStudio } from "./StudioProvider.js";
8
+ import { useMe } from "../hooks/useAuth.js";
9
+ import { c } from "react/compiler-runtime";
10
+ import { useMemo } from "react";
11
+ import { jsx, jsxs } from "react/jsx-runtime";
12
+ function LiveInvalidation() {
13
+ return useLiveInvalidation(), null;
14
+ }
15
+ function LoopstackClientProvider(u) {
16
+ let d = c(9), { children: f } = u, { environment: p } = useStudio(), { isSuccess: m } = useMe(), h;
17
+ d[0] !== p.id || d[1] !== p.url ? (h = createClient({
18
+ url: p.url,
19
+ envKey: p.id,
20
+ credentials: "include",
21
+ fetch: createReportingFetch(p.id)
22
+ }), d[0] = p.id, d[1] = p.url, d[2] = h) : h = d[2];
23
+ let g = h, _;
24
+ d[3] === m ? _ = d[4] : (_ = m ? /* @__PURE__ */ jsx(LiveInvalidation, {}) : null, d[3] = m, d[4] = _);
25
+ let v;
26
+ return d[5] !== f || d[6] !== g || d[7] !== _ ? (v = /* @__PURE__ */ jsxs(LoopstackProvider, {
27
+ client: g,
28
+ children: [_, f]
29
+ }), d[5] = f, d[6] = g, d[7] = _, d[8] = v) : v = d[8], v;
30
+ }
31
+ export { LoopstackClientProvider };
@@ -1,6 +1,12 @@
1
- import { createAxiosClient } from "../api/client.js";
2
- import { createApi } from "../api/index.js";
1
+ import { createClient } from "../packages/client/dist/client.js";
2
+ import "../packages/client/dist/index.js";
3
+ import { createReportingFetch } from "./reporting-fetch.js";
3
4
  function createApiClient(n) {
4
- return { auth: createApi(createAxiosClient(n.url, n.id)).auth };
5
+ return { auth: createClient({
6
+ url: n.url,
7
+ envKey: n.id,
8
+ credentials: "include",
9
+ fetch: createReportingFetch(n.id)
10
+ }).auth };
5
11
  }
6
12
  export { createApiClient };
@@ -1,2 +1 @@
1
1
  import { createApiClient } from "./createApiClient.js";
2
- import { eventBus } from "./eventEmitter.js";
@@ -0,0 +1,13 @@
1
+ import { ApiClientEvents, apiClientEvents } from "../events/api-client-events.js";
2
+ import "../events/index.js";
3
+ function createReportingFetch(n) {
4
+ return async (r, i) => {
5
+ try {
6
+ let a = await fetch(r, i);
7
+ return (a.status === 401 || a.status === 403) && apiClientEvents.emit(ApiClientEvents.UNAUTHORIZED, n), a;
8
+ } catch (r) {
9
+ throw r instanceof DOMException && r.name === "AbortError" || apiClientEvents.emit(ApiClientEvents.ERR_NETWORK, n), r;
10
+ }
11
+ };
12
+ }
13
+ export { createReportingFetch };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loopstack/loopstack-studio",
3
- "version": "0.33.0",
3
+ "version": "0.35.0",
4
4
  "repository": "loopstack-ai/loopstack-studio",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -26,7 +26,9 @@
26
26
  "dependencies": {
27
27
  "@fontsource/roboto": "^5.2.10",
28
28
  "@hookform/resolvers": "^5.2.2",
29
- "@loopstack/contracts": "^0.35.0",
29
+ "@loopstack/client": "^0.37.0",
30
+ "@loopstack/contracts": "^0.37.0",
31
+ "@loopstack/react": "^1.0.0",
30
32
  "@radix-ui/react-accordion": "^1.2.12",
31
33
  "@radix-ui/react-alert-dialog": "^1.1.15",
32
34
  "@radix-ui/react-avatar": "^1.1.11",
@@ -53,7 +55,6 @@
53
55
  "@tailwindcss/vite": "^4.2.2",
54
56
  "@tanstack/react-query": "^5.99.0",
55
57
  "@xyflow/react": "^12.10.2",
56
- "axios": "^1.15.0",
57
58
  "class-variance-authority": "^0.7.1",
58
59
  "clsx": "^2.1.1",
59
60
  "cmdk": "^1.1.1",
package/dist/api/auth.js DELETED
@@ -1,10 +0,0 @@
1
- function createAuthApi(e) {
2
- return {
3
- me: () => e.get("/api/v1/auth/me").then((e) => e.data),
4
- getInfo: () => e.get("/api/v1/auth/worker/health").then((e) => e.data),
5
- hubLogin: (t) => e.post("/api/v1/auth/oauth/hub", t.hubLoginRequestDto).then((e) => e.data),
6
- refresh: () => e.post("/api/v1/auth/refresh").then((e) => e.data),
7
- logout: () => e.post("/api/v1/auth/logout").then((e) => e.data)
8
- };
9
- }
10
- export { createAuthApi };
@@ -1,13 +0,0 @@
1
- import { ApiClientEvents } from "../events/api-client-events.js";
2
- import { eventBus } from "../services/eventEmitter.js";
3
- import "../services/index.js";
4
- import axios from "axios";
5
- function createAxiosClient(r, i) {
6
- let a = axios.create({
7
- baseURL: r,
8
- withCredentials: !0,
9
- headers: { "Content-Type": "application/json" }
10
- });
11
- return a.interceptors.response.use((e) => e, (n) => (n.response?.status && [401, 403].includes(n.response.status) && eventBus.emit(ApiClientEvents.UNAUTHORIZED, i), n.code === "ERR_NETWORK" && (console.error("Connection refused - server may be down"), eventBus.emit(ApiClientEvents.ERR_NETWORK, i)), Promise.reject(n))), a;
12
- }
13
- export { createAxiosClient };
@@ -1,11 +0,0 @@
1
- function createConfigApi(e) {
2
- return {
3
- getApps: () => e.get("/api/v1/config/apps").then((e) => e.data),
4
- getWorkflowConfig: (t) => e.get(`/api/v1/config/workflows/${encodeURIComponent(t.workflowName)}`).then((e) => e.data),
5
- getWorkflowSource: (t) => e.get(`/api/v1/config/workflows/${encodeURIComponent(t.workflowName)}/source`).then((e) => e.data),
6
- getToolConfigs: () => e.get("/api/v1/config/tools").then((e) => e.data),
7
- getToolConfig: (t) => e.get(`/api/v1/config/tools/${encodeURIComponent(t.toolName)}`).then((e) => e.data),
8
- getAvailableEnvironments: () => e.get("/api/v1/config/environments").then((e) => e.data)
9
- };
10
- }
11
- export { createConfigApi };
@@ -1,4 +0,0 @@
1
- function createDashboardApi(e) {
2
- return { getStats: () => e.get("/api/v1/dashboard").then((e) => e.data) };
3
- }
4
- export { createDashboardApi };
@@ -1,7 +0,0 @@
1
- function createDocumentsApi(e) {
2
- return {
3
- getById: (t) => e.get(`/api/v1/documents/${t.id}`).then((e) => e.data),
4
- getAll: (t) => e.get("/api/v1/documents", { params: t }).then((e) => e.data)
5
- };
6
- }
7
- export { createDocumentsApi };
@@ -1,8 +0,0 @@
1
- function createEnvironmentsApi(e) {
2
- return {
3
- getByWorkspace: (t) => e.get(`/api/v1/workspaces/${t}/environments`).then((e) => e.data),
4
- replaceEnvironments: (t, n) => e.put(`/api/v1/workspaces/${t}/environments`, n).then((e) => e.data),
5
- resetEnvironment: (t) => e.post(`/api/v1/workspaces/${t.workspaceId}/environments/${t.slotId}/reset`).then((e) => e.data)
6
- };
7
- }
8
- export { createEnvironmentsApi };
package/dist/api/index.js DELETED
@@ -1,28 +0,0 @@
1
- import { createFilesApi } from "../features/file-explorer/api/files.js";
2
- import { createGitApi } from "../features/git/api/git.js";
3
- import { createAuthApi } from "./auth.js";
4
- import { createConfigApi } from "./config.js";
5
- import { createDashboardApi } from "./dashboard.js";
6
- import { createDocumentsApi } from "./documents.js";
7
- import { createEnvironmentsApi } from "./environments.js";
8
- import { createProcessorApi } from "./processor.js";
9
- import { createSecretsApi } from "./secrets.js";
10
- import { createWorkflowsApi } from "./workflows.js";
11
- import { createWorkspacesApi } from "./workspaces.js";
12
- import { createAxiosClient } from "./client.js";
13
- function createApi(f) {
14
- return {
15
- auth: createAuthApi(f),
16
- config: createConfigApi(f),
17
- dashboard: createDashboardApi(f),
18
- documents: createDocumentsApi(f),
19
- environments: createEnvironmentsApi(f),
20
- files: createFilesApi(f),
21
- git: createGitApi(f),
22
- processor: createProcessorApi(f),
23
- secrets: createSecretsApi(f),
24
- workflows: createWorkflowsApi(f),
25
- workspaces: createWorkspacesApi(f)
26
- };
27
- }
28
- export { createApi };
@@ -1,7 +0,0 @@
1
- function createProcessorApi(e) {
2
- return {
3
- startWorkflow: (t) => e.post("/api/v1/processor/start", t.payload).then((e) => e.data),
4
- runWorkflow: (t) => e.post(`/api/v1/processor/run/${t.workflowId}`, t.runWorkflowPayloadDto, t.force === void 0 ? void 0 : { params: { force: t.force } }).then((e) => e.data)
5
- };
6
- }
7
- export { createProcessorApi };
@@ -1,16 +0,0 @@
1
- function createSecretsApi(e) {
2
- return {
3
- getByWorkspaceId: (t) => e.get(`/api/v1/workspaces/${t.workspaceId}/secrets`).then((e) => e.data),
4
- create: (t) => e.post(`/api/v1/workspaces/${t.workspaceId}/secrets`, {
5
- key: t.key,
6
- value: t.value
7
- }).then((e) => e.data),
8
- upsert: (t) => e.put(`/api/v1/workspaces/${t.workspaceId}/secrets/upsert`, {
9
- key: t.key,
10
- value: t.value
11
- }).then((e) => e.data),
12
- update: (t) => e.put(`/api/v1/workspaces/${t.workspaceId}/secrets/${t.id}`, { value: t.value }).then((e) => e.data),
13
- delete: (t) => e.delete(`/api/v1/workspaces/${t.workspaceId}/secrets/${t.id}`).then((e) => e.data)
14
- };
15
- }
16
- export { createSecretsApi };
@@ -1,15 +0,0 @@
1
- function createWorkflowsApi(e) {
2
- return {
3
- getById: (t) => e.get(`/api/v1/workflows/${t.id}`).then((e) => e.data),
4
- getStatusById: (t) => e.get(`/api/v1/workflows/${t.id}/status`).then((e) => e.data),
5
- getAll: (t) => e.get("/api/v1/workflows", { params: t }).then((e) => e.data),
6
- create: (t) => e.post("/api/v1/workflows", t.workflowCreateDto).then((e) => e.data),
7
- update: (t) => e.put(`/api/v1/workflows/${t.id}`, t.workflowUpdateDto).then((e) => e.data),
8
- delete: (t) => e.delete(`/api/v1/workflows/id/${t.id}`).then((e) => e.data),
9
- batchDelete: (t) => e.delete("/api/v1/workflows/batch", { data: { ids: t.ids } }).then((e) => e.data),
10
- getFileTree: (t) => e.get(`/api/v1/files/workflows/${t.workflowId}`).then((e) => e.data),
11
- getFileContent: (t) => e.get(`/api/v1/files/workflows/${t.workflowId}/${t.filePath}`).then((e) => e.data),
12
- getCheckpoints: (t) => e.get(`/api/v1/workflows/${t.id}/checkpoints`).then((e) => e.data)
13
- };
14
- }
15
- export { createWorkflowsApi };
@@ -1,12 +0,0 @@
1
- function createWorkspacesApi(e) {
2
- return {
3
- getById: (t) => e.get(`/api/v1/workspaces/${t.id}`).then((e) => e.data),
4
- getAll: (t) => e.get("/api/v1/workspaces", { params: t }).then((e) => e.data),
5
- create: (t) => e.post("/api/v1/workspaces", t.workspaceCreateDto).then((e) => e.data),
6
- update: (t) => e.put(`/api/v1/workspaces/${t.id}`, t.workspaceUpdateDto).then((e) => e.data),
7
- delete: (t) => e.delete(`/api/v1/workspaces/id/${t.id}`).then((e) => e.data),
8
- batchDelete: (t) => e.delete("/api/v1/workspaces/batch", { data: { ids: t.ids } }).then((e) => e.data),
9
- setFavourite: (t) => e.patch(`/api/v1/workspaces/${t.id}/favourite`, t.workspaceFavouriteDto).then((e) => e.data)
10
- };
11
- }
12
- export { createWorkspacesApi };
@@ -1,13 +0,0 @@
1
- const SseClientEvents = {
2
- WORKFLOW_CREATED: "workflow.created",
3
- WORKFLOW_UPDATED: "workflow.updated",
4
- DOCUMENT_CREATED: "document.created",
5
- SSE_CONNECTED: "sse.connected",
6
- LLM_RESPONSE_START: "llm.response.start",
7
- LLM_RESPONSE_TEXT_DELTA: "llm.response.text_delta",
8
- LLM_RESPONSE_THINKING_DELTA: "llm.response.thinking_delta",
9
- LLM_RESPONSE_TOOL_CALL: "llm.response.tool_call",
10
- LLM_RESPONSE_DONE: "llm.response.done",
11
- LLM_RESPONSE_ERROR: "llm.response.error"
12
- };
13
- export { SseClientEvents };
@@ -1,6 +0,0 @@
1
- import "../../lib/utils.js";
2
- import "../../components/ui/input.js";
3
- import "./providers/CodeExplorerProvider.js";
4
- import "./components/CodeExplorerTree.js";
5
- import { c } from "react/compiler-runtime";
6
- import { jsx, jsxs } from "react/jsx-runtime";
@@ -1,6 +0,0 @@
1
- import "../../../components/ui/scroll-area.js";
2
- import "../providers/CodeExplorerProvider.js";
3
- import "./CodeExplorerTreeNode.js";
4
- import { c } from "react/compiler-runtime";
5
- import { useMemo } from "react";
6
- import { jsx } from "react/jsx-runtime";
@@ -1,4 +0,0 @@
1
- import "../providers/CodeExplorerProvider.js";
2
- import "./FileTabsBarBase.js";
3
- import { c } from "react/compiler-runtime";
4
- import { jsx } from "react/jsx-runtime";
@@ -1,5 +0,0 @@
1
- import "../../../hooks/useFiles.js";
2
- import { c } from "react/compiler-runtime";
3
- import { createContext, useCallback, useContext, useEffect, useMemo, useState } from "react";
4
- import { jsx } from "react/jsx-runtime";
5
- createContext(null);
@@ -1,7 +0,0 @@
1
- function createFilesApi(e) {
2
- return {
3
- getTree: (t) => e.get(`/api/v1/workspaces/${t.workspaceId}/files/tree`, { params: t.path ? { path: t.path } : void 0 }).then((e) => e.data),
4
- readFile: (t) => e.get(`/api/v1/workspaces/${t.workspaceId}/files/read`, { params: { path: t.path } }).then((e) => e.data)
5
- };
6
- }
7
- export { createFilesApi };
@@ -1,9 +0,0 @@
1
- function createGitApi(e) {
2
- return {
3
- getStatus: (t) => e.get(`/api/v1/workspaces/${t.workspaceId}/git/status`).then((e) => e.data),
4
- getLog: (t) => e.get(`/api/v1/workspaces/${t.workspaceId}/git/log`, { params: t.limit ? { limit: t.limit } : void 0 }).then((e) => e.data),
5
- getRemote: (t) => e.get(`/api/v1/workspaces/${t.workspaceId}/git/remote`).then((e) => e.data),
6
- removeRemote: (t) => e.delete(`/api/v1/workspaces/${t.workspaceId}/git/remote`).then((e) => e.data)
7
- };
8
- }
9
- export { createGitApi };
@@ -1,145 +0,0 @@
1
- function getMeCacheKey(e) {
2
- return ["me", e];
3
- }
4
- function getHealthCacheKey(e) {
5
- return ["health", e];
6
- }
7
- function getAppTypesCacheKey(e) {
8
- return ["app-types", e];
9
- }
10
- function getWorkflowTypesCacheKey(e, C) {
11
- return [
12
- "workflowTypes",
13
- e,
14
- C
15
- ];
16
- }
17
- function getStudioAppsCacheKey(e) {
18
- return ["studio-apps", e];
19
- }
20
- function getAvailableEnvironmentsCacheKey(e) {
21
- return ["available-environments", e];
22
- }
23
- function getDashboardStatsCacheKey(e) {
24
- return [
25
- "dashboard",
26
- "stats",
27
- e
28
- ];
29
- }
30
- function getWorkflowCacheKey(e, C) {
31
- return [
32
- "workflow",
33
- e,
34
- C
35
- ];
36
- }
37
- function getWorkflowStatusCacheKey(e, C) {
38
- return [
39
- "workflowStatus",
40
- e,
41
- C
42
- ];
43
- }
44
- function getWorkflowsCacheKey(e) {
45
- return ["workflows", e];
46
- }
47
- function getChildWorkflowsCacheKey(e, C) {
48
- return [
49
- "childWorkflows",
50
- e,
51
- C
52
- ];
53
- }
54
- function getToolConfigsCacheKey(e) {
55
- return ["toolConfigs", e];
56
- }
57
- function getToolConfigCacheKey(e, C) {
58
- return [
59
- "toolConfig",
60
- e,
61
- C
62
- ];
63
- }
64
- function getWorkflowConfigCacheKey(e, C) {
65
- return [
66
- "workflowConfig",
67
- e,
68
- C
69
- ];
70
- }
71
- function getWorkflowSourceCacheKey(e, C) {
72
- return [
73
- "workflowSource",
74
- e,
75
- C
76
- ];
77
- }
78
- function getWorkspaceCacheKey(e, C) {
79
- return [
80
- "workspace",
81
- e,
82
- C
83
- ];
84
- }
85
- function getWorkspacesCacheKey(e) {
86
- return ["workspaces", e];
87
- }
88
- function getDocumentCacheKey(e, C) {
89
- return [
90
- "document",
91
- e,
92
- C
93
- ];
94
- }
95
- function getDocumentsCacheKey(e, C) {
96
- return [
97
- "documents",
98
- e,
99
- C
100
- ];
101
- }
102
- function getSecretsCacheKey(e, C) {
103
- return [
104
- "secrets",
105
- e,
106
- C
107
- ];
108
- }
109
- function getGitStatusCacheKey(e, C) {
110
- return [
111
- "gitStatus",
112
- e,
113
- C
114
- ];
115
- }
116
- function getGitLogCacheKey(e, C) {
117
- return [
118
- "gitLog",
119
- e,
120
- C
121
- ];
122
- }
123
- function getGitRemoteCacheKey(e, C) {
124
- return [
125
- "gitRemote",
126
- e,
127
- C
128
- ];
129
- }
130
- function getFileTreeCacheKey(e, C) {
131
- return [
132
- "fileTree",
133
- e,
134
- C
135
- ];
136
- }
137
- function getFileContentCacheKey(e, C, w) {
138
- return [
139
- "fileContent",
140
- e,
141
- C,
142
- w
143
- ];
144
- }
145
- export { getAppTypesCacheKey, getAvailableEnvironmentsCacheKey, getChildWorkflowsCacheKey, getDashboardStatsCacheKey, getDocumentCacheKey, getDocumentsCacheKey, getFileContentCacheKey, getFileTreeCacheKey, getGitLogCacheKey, getGitRemoteCacheKey, getGitStatusCacheKey, getHealthCacheKey, getMeCacheKey, getSecretsCacheKey, getStudioAppsCacheKey, getToolConfigCacheKey, getToolConfigsCacheKey, getWorkflowCacheKey, getWorkflowConfigCacheKey, getWorkflowSourceCacheKey, getWorkflowStatusCacheKey, getWorkflowTypesCacheKey, getWorkflowsCacheKey, getWorkspaceCacheKey, getWorkspacesCacheKey };