@loopstack/loopstack-studio 0.34.0 → 0.35.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.
Files changed (133) hide show
  1. package/dist/app/EnvironmentEmbedRoot.js +18 -24
  2. package/dist/components/layout/StudioSidebar.js +34 -34
  3. package/dist/events/api-client-events.js +13 -1
  4. package/dist/events/index.js +1 -0
  5. package/dist/features/code-explorer/components/FileTabsBarBase.js +1 -1
  6. package/dist/features/code-explorer/index.js +0 -3
  7. package/dist/features/dashboard/AppLauncher.js +1 -1
  8. package/dist/features/debug/components/WorkflowFlowViewer.js +2 -1
  9. package/dist/features/debug/components/workflow-flow/WorkflowGraph.js +2 -1
  10. package/dist/features/documents/components/DocumentList.js +1 -1
  11. package/dist/features/documents/document-details/DocumentDetails.js +0 -5
  12. package/dist/features/documents/renderers/DocumentFormRenderer.js +13 -12
  13. package/dist/features/documents/renderers/LinkMessageRenderer.js +2 -1
  14. package/dist/features/documents/renderers/useDocumentTransition.js +3 -2
  15. package/dist/features/feature-registry/FeatureRegistryProvider.js +2 -1
  16. package/dist/features/file-explorer/components/FileTabsBar.js +1 -1
  17. package/dist/features/file-explorer/components/FileTree.js +1 -1
  18. package/dist/features/file-explorer/hooks/useFileExplorer.js +36 -31
  19. package/dist/features/file-explorer/providers/FileExplorerProvider.js +94 -92
  20. package/dist/features/git/components/WorkbenchGitPanel.js +6 -9
  21. package/dist/features/git/hooks/useGit.js +55 -57
  22. package/dist/features/health/LocalHealthCheck.js +46 -47
  23. package/dist/features/oauth/OAuthPromptRenderer.js +6 -5
  24. package/dist/features/runs/Runs.js +3 -2
  25. package/dist/features/secrets/renderers/SecretInputRenderer.js +3 -2
  26. package/dist/features/workbench/WorkflowItem.js +5 -8
  27. package/dist/features/workbench/components/NewRunDialog.js +172 -170
  28. package/dist/features/workbench/components/PreviewEmptyState.js +1 -1
  29. package/dist/features/workbench/components/WorkbenchRunsPanel.js +2 -1
  30. package/dist/features/workbench/components/WorkflowForms.js +1 -1
  31. package/dist/features/workbench/components/WorkflowHistoryItem.js +2 -1
  32. package/dist/features/workbench/components/buttons/WorkflowButtons.js +8 -14
  33. package/dist/features/workbench/hooks/useLlmStreamingDocuments.js +65 -132
  34. package/dist/features/workbench/hooks/useWorkflowData.js +8 -6
  35. package/dist/features/workspaces/Workspaces.js +4 -2
  36. package/dist/features/workspaces/components/CreateWorkspace.js +7 -5
  37. package/dist/features/workspaces/components/ExecutionTimeline.js +69 -65
  38. package/dist/features/workspaces/components/WorkflowRunForm.js +6 -4
  39. package/dist/features/workspaces/components/WorkspaceHomePage.js +1 -1
  40. package/dist/hooks/index.js +5 -5
  41. package/dist/hooks/useAuth.js +14 -53
  42. package/dist/hooks/useConfig.js +13 -37
  43. package/dist/hooks/useDocuments.js +5 -30
  44. package/dist/hooks/useEnvironments.js +34 -24
  45. package/dist/hooks/useProcessor.js +2 -31
  46. package/dist/hooks/useSecrets.js +78 -24
  47. package/dist/hooks/useWorkflows.js +43 -172
  48. package/dist/hooks/useWorkspaces.js +24 -130
  49. package/dist/index.d.ts +130 -488
  50. package/dist/index.js +10 -12
  51. package/dist/packages/client/dist/client.js +35 -0
  52. package/dist/packages/client/dist/http.js +47 -0
  53. package/dist/packages/client/dist/index.js +15 -0
  54. package/dist/packages/client/dist/queries/query-keys.js +94 -0
  55. package/dist/packages/client/dist/queries/query-options.js +97 -0
  56. package/dist/packages/client/dist/resources/auth.js +10 -0
  57. package/dist/packages/client/dist/resources/config.js +11 -0
  58. package/dist/packages/client/dist/resources/dashboard.js +4 -0
  59. package/dist/packages/client/dist/resources/documents.js +7 -0
  60. package/dist/packages/client/dist/resources/processor.js +7 -0
  61. package/dist/packages/client/dist/resources/workflows.js +13 -0
  62. package/dist/packages/client/dist/resources/workspaces.js +12 -0
  63. package/dist/packages/client/dist/stream/invalidations.js +20 -0
  64. package/dist/packages/client/dist/stream/llm-reducer.js +65 -0
  65. package/dist/packages/client/dist/stream/sse-parser.js +40 -0
  66. package/dist/packages/client/dist/stream/stream.js +147 -0
  67. package/dist/packages/contracts/dist/events/client-message-base.schema.js +6 -0
  68. package/dist/packages/contracts/dist/events/client-message.schema.js +24 -0
  69. package/dist/packages/contracts/dist/events/index.js +6 -0
  70. package/dist/packages/contracts/dist/events/llm-events.schema.js +44 -0
  71. package/dist/packages/contracts/dist/events/stream-events.schema.js +4 -0
  72. package/dist/packages/contracts/dist/events/workflow-events.schema.js +20 -0
  73. package/dist/packages/contracts/dist/events/workspace-events.schema.js +5 -0
  74. package/dist/packages/contracts/dist/types/types/ui-message.type.js +39 -0
  75. package/dist/packages/react/dist/hooks/mutations.js +175 -0
  76. package/dist/packages/react/dist/hooks/queries.js +139 -0
  77. package/dist/packages/react/dist/hooks/use-live-invalidation.js +39 -0
  78. package/dist/packages/react/dist/hooks/use-llm-stream.js +18 -0
  79. package/dist/packages/react/dist/index.js +5 -0
  80. package/dist/packages/react/dist/provider.js +15 -0
  81. package/dist/pages/DashboardPage.js +2 -1
  82. package/dist/pages/DebugWorkflowDetailsPage.js +2 -1
  83. package/dist/pages/DebugWorkflowsPage.js +2 -1
  84. package/dist/pages/EmbedWorkbenchPage.js +5 -4
  85. package/dist/pages/PreviewWorkbenchPage.js +60 -59
  86. package/dist/pages/StudioLandingPage.js +1 -1
  87. package/dist/pages/WorkbenchPage.js +3 -2
  88. package/dist/pages/WorkflowDebugPage.js +3 -2
  89. package/dist/pages/WorkspacePage.js +3 -2
  90. package/dist/pages/WorkspaceRunsPage.js +2 -1
  91. package/dist/providers/LoopstackClientProvider.js +35 -0
  92. package/dist/services/createApiClient.js +9 -3
  93. package/dist/services/index.js +0 -1
  94. package/dist/services/reporting-fetch.js +13 -0
  95. package/package.json +4 -3
  96. package/dist/api/auth.js +0 -10
  97. package/dist/api/client.js +0 -13
  98. package/dist/api/config.js +0 -11
  99. package/dist/api/dashboard.js +0 -4
  100. package/dist/api/documents.js +0 -7
  101. package/dist/api/environments.js +0 -8
  102. package/dist/api/index.js +0 -31
  103. package/dist/api/processor.js +0 -7
  104. package/dist/api/secrets.js +0 -16
  105. package/dist/api/workflows.js +0 -15
  106. package/dist/api/workspaces.js +0 -12
  107. package/dist/events/sse-client-events.js +0 -15
  108. package/dist/features/code-explorer/CodeExplorer.js +0 -6
  109. package/dist/features/code-explorer/components/CodeExplorerTree.js +0 -6
  110. package/dist/features/code-explorer/components/FileTabsBar.js +0 -4
  111. package/dist/features/code-explorer/providers/CodeExplorerProvider.js +0 -5
  112. package/dist/features/file-explorer/api/files.js +0 -12
  113. package/dist/features/git/api/git.js +0 -9
  114. package/dist/hooks/query-keys.js +0 -145
  115. package/dist/hooks/useApi.js +0 -15
  116. package/dist/hooks/useFiles.js +0 -3
  117. package/dist/node_modules/lodash/_Symbol.js +0 -7
  118. package/dist/node_modules/lodash/_baseGetTag.js +0 -13
  119. package/dist/node_modules/lodash/_baseTrim.js +0 -11
  120. package/dist/node_modules/lodash/_freeGlobal.js +0 -6
  121. package/dist/node_modules/lodash/_getRawTag.js +0 -17
  122. package/dist/node_modules/lodash/_objectToString.js +0 -10
  123. package/dist/node_modules/lodash/_root.js +0 -8
  124. package/dist/node_modules/lodash/_trimmedEndIndex.js +0 -11
  125. package/dist/node_modules/lodash/debounce.js +0 -53
  126. package/dist/node_modules/lodash/isObject.js +0 -10
  127. package/dist/node_modules/lodash/isObjectLike.js +0 -9
  128. package/dist/node_modules/lodash/isSymbol.js +0 -12
  129. package/dist/node_modules/lodash/now.js +0 -10
  130. package/dist/node_modules/lodash/toNumber.js +0 -22
  131. package/dist/providers/InvalidationEventsProvider.js +0 -43
  132. package/dist/providers/SseProvider.js +0 -37
  133. package/dist/services/eventEmitter.js +0 -12
@@ -0,0 +1,5 @@
1
+ import { LoopstackProvider, useLoopstackClient } from "./provider.js";
2
+ import { useAppsConfig, useAvailableEnvironments, useChildWorkflows, useMe, useWorkerHealth, useWorkflow, useWorkflowCheckpoints, useWorkflowConfig, useWorkflowDocuments, useWorkflowList, useWorkflowSource, useWorkflowStatus, useWorkspace, useWorkspaceList } from "./hooks/queries.js";
3
+ import { useBatchDeleteWorkspaces, useCreateWorkflow, useCreateWorkspace, useDeleteWorkflow, useDeleteWorkspace, useHubLogin, useRefreshSession, useRunWorkflow, useSetFavouriteWorkspace, useStartWorkflow, useUpdateWorkflow, useUpdateWorkspace } from "./hooks/mutations.js";
4
+ import { useLiveInvalidation } from "./hooks/use-live-invalidation.js";
5
+ import { useLlmStream } from "./hooks/use-llm-stream.js";
@@ -0,0 +1,15 @@
1
+ import { createContext, useContext } from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+ var LoopstackContext = createContext(void 0);
4
+ function LoopstackProvider({ client: e, children: a }) {
5
+ return jsx(LoopstackContext.Provider, {
6
+ value: e,
7
+ children: a
8
+ });
9
+ }
10
+ function useLoopstackClient() {
11
+ let e = useContext(LoopstackContext);
12
+ if (!e) throw Error("useLoopstackClient must be used within a <LoopstackProvider>");
13
+ return e;
14
+ }
15
+ export { LoopstackProvider, useLoopstackClient };
@@ -1,4 +1,5 @@
1
- import { useAppsConfig } from "../hooks/useConfig.js";
1
+ import { useAppsConfig } from "../packages/react/dist/hooks/queries.js";
2
+ import "../hooks/useConfig.js";
2
3
  import MainLayout_default from "../components/layout/MainLayout.js";
3
4
  import LoadingCentered_default from "../components/feedback/LoadingCentered.js";
4
5
  import AppLauncher from "../features/dashboard/AppLauncher.js";
@@ -1,5 +1,6 @@
1
+ import { useWorkflowSource } from "../packages/react/dist/hooks/queries.js";
2
+ import { useWorkflowConfigByName } from "../hooks/useWorkflows.js";
1
3
  import { useStudio } from "../providers/StudioProvider.js";
2
- import { useWorkflowConfigByName, useWorkflowSource } from "../hooks/useWorkflows.js";
3
4
  import MainLayout_default from "../components/layout/MainLayout.js";
4
5
  import { ReactFlowProvider } from "../node_modules/@xyflow/react/dist/esm/index.js";
5
6
  import ConfigFlowViewer_default from "../features/debug/components/ConfigFlowViewer.js";
@@ -1,5 +1,6 @@
1
+ import { useAppsConfig } from "../packages/react/dist/hooks/queries.js";
2
+ import "../hooks/useConfig.js";
1
3
  import { useStudio } from "../providers/StudioProvider.js";
2
- import { useAppsConfig } from "../hooks/useConfig.js";
3
4
  import { Badge } from "../components/ui/badge.js";
4
5
  import MainLayout_default from "../components/layout/MainLayout.js";
5
6
  import { DataTable } from "../components/data-table/DataTable.js";
@@ -1,11 +1,12 @@
1
- import { useWorkflow } from "../hooks/useWorkflows.js";
2
- import { useWorkspace } from "../hooks/useWorkspaces.js";
1
+ import { useWorkflow, useWorkspace } from "../packages/react/dist/hooks/queries.js";
2
+ import { WorkflowState } from "../packages/contracts/dist/enums/workflow-state.enum.js";
3
+ import "../packages/contracts/dist/enums/index.js";
4
+ import "../hooks/useWorkflows.js";
5
+ import "../hooks/useWorkspaces.js";
3
6
  import LoadingCentered_default from "../components/feedback/LoadingCentered.js";
4
7
  import ErrorSnackbar_default from "../components/feedback/ErrorSnackbar.js";
5
8
  import { FeatureRegistryProvider } from "../features/feature-registry/FeatureRegistryProvider.js";
6
9
  import "../features/feature-registry/index.js";
7
- import { WorkflowState } from "../packages/contracts/dist/enums/workflow-state.enum.js";
8
- import "../packages/contracts/dist/enums/index.js";
9
10
  import WorkflowItem_default from "../features/workbench/WorkflowItem.js";
10
11
  import { WorkbenchLayoutProvider } from "../features/workbench/providers/WorkbenchLayoutProvider.js";
11
12
  import "../features/workbench/index.js";
@@ -1,13 +1,14 @@
1
+ import { useWorkflow } from "../packages/react/dist/hooks/queries.js";
2
+ import { WorkflowState } from "../packages/contracts/dist/enums/workflow-state.enum.js";
3
+ import "../packages/contracts/dist/enums/index.js";
4
+ import { useFilterWorkflows, useWorkflowConfigByName } from "../hooks/useWorkflows.js";
1
5
  import { useStudio } from "../providers/StudioProvider.js";
2
- import { useFilterWorkflows, useWorkflow, useWorkflowConfigByName } from "../hooks/useWorkflows.js";
3
6
  import { Button } from "../components/ui/button.js";
4
7
  import LoadingCentered_default from "../components/feedback/LoadingCentered.js";
5
8
  import ErrorSnackbar_default from "../components/feedback/ErrorSnackbar.js";
6
9
  import { ReactFlowProvider } from "../node_modules/@xyflow/react/dist/esm/index.js";
7
10
  import WorkflowFlowViewer_default from "../features/debug/components/WorkflowFlowViewer.js";
8
11
  import "../features/debug/index.js";
9
- import { WorkflowState } from "../packages/contracts/dist/enums/workflow-state.enum.js";
10
- import "../packages/contracts/dist/enums/index.js";
11
12
  import WorkflowItem_default from "../features/workbench/WorkflowItem.js";
12
13
  import WorkflowHistoryList_default from "../features/workbench/components/WorkflowHistoryList.js";
13
14
  import { NewRunDialog } from "../features/workbench/components/NewRunDialog.js";
@@ -44,16 +45,16 @@ function PreviewWorkbenchPage() {
44
45
  onNewRunSuccess: a
45
46
  }), e[3] = t, e[4] = o), o;
46
47
  }
47
- function PreviewWorkbenchContent(e) {
48
- let t = c(49), { workflowId: m, onNewRunSuccess: h } = e, _ = useRef(null), [y, b] = useState("output"), [x, S] = useState(!1), w = useWorkflow(m), T = useRef(!1), O = useWorkflowConfigByName(w.data?.workflowName), A, j;
49
- t[0] !== w.data || t[1] !== m ? (A = () => {
48
+ function PreviewWorkbenchContent(n) {
49
+ let i = c(49), { workflowId: m, onNewRunSuccess: h } = n, _ = useRef(null), [y, b] = useState("output"), [x, S] = useState(!1), w = useWorkflow(m), T = useRef(!1), O = useWorkflowConfigByName(w.data?.workflowName), A, j;
50
+ i[0] !== w.data || i[1] !== m ? (A = () => {
50
51
  !w.data || T.current || w.data.status === WorkflowState.Completed && window.parent !== window && (T.current = !0, window.parent.postMessage({
51
52
  type: EMBED_MESSAGE_TYPE,
52
53
  workflowId: m
53
54
  }, window.location.origin));
54
- }, j = [w.data, m], t[0] = w.data, t[1] = m, t[2] = A, t[3] = j) : (A = t[2], j = t[3]), useEffect(A, j);
55
+ }, j = [w.data, m], i[0] = w.data, i[1] = m, i[2] = A, i[3] = j) : (A = i[2], j = i[3]), useEffect(A, j);
55
56
  let M, N;
56
- t[4] === m ? (M = t[5], N = t[6]) : (M = () => {
57
+ i[4] === m ? (M = i[5], N = i[6]) : (M = () => {
57
58
  if (window.parent === window || !_.current) return;
58
59
  let e = new ResizeObserver(() => {
59
60
  if (!_.current) return;
@@ -65,36 +66,36 @@ function PreviewWorkbenchContent(e) {
65
66
  }, window.location.origin);
66
67
  });
67
68
  return e.observe(_.current), () => e.disconnect();
68
- }, N = [m], t[4] = m, t[5] = M, t[6] = N), useEffect(M, N);
69
+ }, N = [m], i[4] = m, i[5] = M, i[6] = N), useEffect(M, N);
69
70
  let P;
70
- t[7] === h ? P = t[8] : (P = (e) => {
71
+ i[7] === h ? P = i[8] : (P = (e) => {
71
72
  S(!1), h(e);
72
- }, t[7] = h, t[8] = P);
73
+ }, i[7] = h, i[8] = P);
73
74
  let F = P, I = _temp, L;
74
- t[9] === Symbol.for("react.memo_cache_sentinel") ? (L = {
75
+ i[9] === Symbol.for("react.memo_cache_sentinel") ? (L = {
75
76
  enableDebugMode: !1,
76
77
  showFullMessageHistory: !1
77
- }, t[9] = L) : L = t[9];
78
+ }, i[9] = L) : L = i[9];
78
79
  let R = L, z;
79
- t[10] === Symbol.for("react.memo_cache_sentinel") ? (z = {
80
+ i[10] === Symbol.for("react.memo_cache_sentinel") ? (z = {
80
81
  value: "output",
81
82
  label: "Output",
82
83
  icon: /* @__PURE__ */ jsx(ScrollText, { className: "h-3.5 w-3.5" })
83
- }, t[10] = z) : z = t[10];
84
+ }, i[10] = z) : z = i[10];
84
85
  let B;
85
- t[11] === Symbol.for("react.memo_cache_sentinel") ? (B = {
86
+ i[11] === Symbol.for("react.memo_cache_sentinel") ? (B = {
86
87
  value: "graph",
87
88
  label: "Graph",
88
89
  icon: /* @__PURE__ */ jsx(Workflow, { className: "h-3.5 w-3.5" })
89
- }, t[11] = B) : B = t[11];
90
+ }, i[11] = B) : B = i[11];
90
91
  let V;
91
- t[12] === Symbol.for("react.memo_cache_sentinel") ? (V = {
92
+ i[12] === Symbol.for("react.memo_cache_sentinel") ? (V = {
92
93
  value: "run-log",
93
94
  label: "Run Log",
94
95
  icon: /* @__PURE__ */ jsx(ListOrdered, { className: "h-3.5 w-3.5" })
95
- }, t[12] = V) : V = t[12];
96
+ }, i[12] = V) : V = i[12];
96
97
  let H;
97
- t[13] === Symbol.for("react.memo_cache_sentinel") ? (H = [
98
+ i[13] === Symbol.for("react.memo_cache_sentinel") ? (H = [
98
99
  z,
99
100
  B,
100
101
  V,
@@ -103,33 +104,33 @@ function PreviewWorkbenchContent(e) {
103
104
  label: "Logs",
104
105
  icon: /* @__PURE__ */ jsx(ScrollText, { className: "h-3.5 w-3.5" })
105
106
  }
106
- ], t[13] = H) : H = t[13];
107
+ ], i[13] = H) : H = i[13];
107
108
  let ce = H, U;
108
- t[14] === y ? U = t[15] : (U = /* @__PURE__ */ jsx("div", {
109
+ i[14] === y ? U = i[15] : (U = /* @__PURE__ */ jsx("div", {
109
110
  className: "bg-background flex items-center rounded-md border p-0.5",
110
111
  children: ce.map((e) => /* @__PURE__ */ jsxs("button", {
111
112
  onClick: () => b(e.value),
112
113
  className: `flex items-center gap-1.5 rounded-sm px-2.5 py-1 text-xs font-medium transition-colors ${y === e.value ? "bg-foreground text-background shadow-sm" : "text-muted-foreground hover:text-foreground"}`,
113
114
  children: [e.icon, e.label]
114
115
  }, e.value))
115
- }), t[14] = y, t[15] = U);
116
+ }), i[14] = y, i[15] = U);
116
117
  let W;
117
- t[16] === Symbol.for("react.memo_cache_sentinel") ? (W = /* @__PURE__ */ jsxs(Button, {
118
+ i[16] === Symbol.for("react.memo_cache_sentinel") ? (W = /* @__PURE__ */ jsxs(Button, {
118
119
  variant: "outline",
119
120
  size: "sm",
120
121
  className: "h-7 gap-1.5",
121
122
  onClick: () => S(!0),
122
123
  children: [/* @__PURE__ */ jsx(Play, { className: "h-3 w-3" }), "New Run"]
123
- }), t[16] = W) : W = t[16];
124
+ }), i[16] = W) : W = i[16];
124
125
  let G;
125
- t[17] === U ? G = t[18] : (G = /* @__PURE__ */ jsxs("div", {
126
+ i[17] === U ? G = i[18] : (G = /* @__PURE__ */ jsxs("div", {
126
127
  className: "bg-muted/50 flex h-11 shrink-0 items-center justify-between border-b px-3",
127
128
  children: [U, W]
128
- }), t[17] = U, t[18] = G);
129
+ }), i[17] = U, i[18] = G);
129
130
  let K;
130
- t[19] === w.error ? K = t[20] : (K = /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: w.error }), t[19] = w.error, t[20] = K);
131
+ i[19] === w.error ? K = i[20] : (K = /* @__PURE__ */ jsx(ErrorSnackbar_default, { error: w.error }), i[19] = w.error, i[20] = K);
131
132
  let q;
132
- t[21] !== y || t[22] !== w.data || t[23] !== w.isLoading ? (q = y === "output" && /* @__PURE__ */ jsx("div", {
133
+ i[21] !== y || i[22] !== w.data || i[23] !== w.isLoading ? (q = y === "output" && /* @__PURE__ */ jsx("div", {
133
134
  className: "px-4 py-3",
134
135
  children: /* @__PURE__ */ jsx(LoadingCentered_default, {
135
136
  loading: w.isLoading,
@@ -140,9 +141,9 @@ function PreviewWorkbenchContent(e) {
140
141
  settings: R
141
142
  }) : null
142
143
  })
143
- }), t[21] = y, t[22] = w.data, t[23] = w.isLoading, t[24] = q) : q = t[24];
144
+ }), i[21] = y, i[22] = w.data, i[23] = w.isLoading, i[24] = q) : q = i[24];
144
145
  let J;
145
- t[25] !== y || t[26] !== w.data || t[27] !== w.isLoading || t[28] !== O || t[29] !== m ? (J = y === "graph" && /* @__PURE__ */ jsx("div", {
146
+ i[25] !== y || i[26] !== w.data || i[27] !== w.isLoading || i[28] !== O || i[29] !== m ? (J = y === "graph" && /* @__PURE__ */ jsx("div", {
146
147
  className: "h-full",
147
148
  children: /* @__PURE__ */ jsx(LoadingCentered_default, {
148
149
  loading: w.isLoading,
@@ -159,16 +160,16 @@ function PreviewWorkbenchContent(e) {
159
160
  })
160
161
  })
161
162
  })
162
- }), t[25] = y, t[26] = w.data, t[27] = w.isLoading, t[28] = O, t[29] = m, t[30] = J) : J = t[30];
163
+ }), i[25] = y, i[26] = w.data, i[27] = w.isLoading, i[28] = O, i[29] = m, i[30] = J) : J = i[30];
163
164
  let Y;
164
- t[31] !== y || t[32] !== w.data ? (Y = y === "run-log" && /* @__PURE__ */ jsx("div", {
165
+ i[31] !== y || i[32] !== w.data ? (Y = y === "run-log" && /* @__PURE__ */ jsx("div", {
165
166
  className: "px-4",
166
167
  children: /* @__PURE__ */ jsx(WorkflowHistoryList_default, { workflow: w.data })
167
- }), t[31] = y, t[32] = w.data, t[33] = Y) : Y = t[33];
168
+ }), i[31] = y, i[32] = w.data, i[33] = Y) : Y = i[33];
168
169
  let X;
169
- t[34] === y ? X = t[35] : (X = y === "logs" && /* @__PURE__ */ jsx(EmbedLogsContent, {}), t[34] = y, t[35] = X);
170
+ i[34] === y ? X = i[35] : (X = y === "logs" && /* @__PURE__ */ jsx(EmbedLogsContent, {}), i[34] = y, i[35] = X);
170
171
  let Z;
171
- t[36] !== K || t[37] !== q || t[38] !== J || t[39] !== Y || t[40] !== X ? (Z = /* @__PURE__ */ jsxs("div", {
172
+ i[36] !== K || i[37] !== q || i[38] !== J || i[39] !== Y || i[40] !== X ? (Z = /* @__PURE__ */ jsxs("div", {
172
173
  className: "flex-1 overflow-auto",
173
174
  children: [
174
175
  K,
@@ -177,15 +178,15 @@ function PreviewWorkbenchContent(e) {
177
178
  Y,
178
179
  X
179
180
  ]
180
- }), t[36] = K, t[37] = q, t[38] = J, t[39] = Y, t[40] = X, t[41] = Z) : Z = t[41];
181
+ }), i[36] = K, i[37] = q, i[38] = J, i[39] = Y, i[40] = X, i[41] = Z) : Z = i[41];
181
182
  let Q;
182
- t[42] !== F || t[43] !== x ? (Q = /* @__PURE__ */ jsx(NewRunDialog, {
183
+ i[42] !== F || i[43] !== x ? (Q = /* @__PURE__ */ jsx(NewRunDialog, {
183
184
  open: x,
184
185
  onOpenChange: S,
185
186
  onSuccess: F
186
- }), t[42] = F, t[43] = x, t[44] = Q) : Q = t[44];
187
+ }), i[42] = F, i[43] = x, i[44] = Q) : Q = i[44];
187
188
  let $;
188
- return t[45] !== G || t[46] !== Z || t[47] !== Q ? ($ = /* @__PURE__ */ jsxs("div", {
189
+ return i[45] !== G || i[46] !== Z || i[47] !== Q ? ($ = /* @__PURE__ */ jsxs("div", {
189
190
  ref: _,
190
191
  className: "flex h-screen flex-col overflow-hidden",
191
192
  children: [
@@ -193,7 +194,7 @@ function PreviewWorkbenchContent(e) {
193
194
  Z,
194
195
  Q
195
196
  ]
196
- }), t[45] = G, t[46] = Z, t[47] = Q, t[48] = $) : $ = t[48], $;
197
+ }), i[45] = G, i[46] = Z, i[47] = Q, i[48] = $) : $ = i[48], $;
197
198
  }
198
199
  function _temp() {}
199
200
  var STATUS_DOT_COLORS = {
@@ -204,17 +205,17 @@ var STATUS_DOT_COLORS = {
204
205
  canceled: "bg-orange-500",
205
206
  pending: "bg-muted-foreground"
206
207
  };
207
- function PreviewEmptyState(n) {
208
- let r = c(24), { newRunDialogOpen: a, onNewRunDialogOpenChange: o, onNewRunSuccess: s } = n, l = useNavigate(), { router: u } = useStudio(), [d, f] = useState(3), m;
209
- r[0] === Symbol.for("react.memo_cache_sentinel") ? (m = { parentId: null }, r[0] = m) : m = r[0];
208
+ function PreviewEmptyState(e) {
209
+ let t = c(24), { newRunDialogOpen: r, onNewRunDialogOpenChange: o, onNewRunSuccess: s } = e, l = useNavigate(), { router: u } = useStudio(), [d, f] = useState(3), m;
210
+ t[0] === Symbol.for("react.memo_cache_sentinel") ? (m = { parentId: null }, t[0] = m) : m = t[0];
210
211
  let h = useFilterWorkflows(void 0, m, "createdAt", "DESC", 0, d), g;
211
- r[1] === h.data?.data ? g = r[2] : (g = h.data?.data ?? [], r[1] = h.data?.data, r[2] = g);
212
+ t[1] === h.data?.data ? g = t[2] : (g = h.data?.data ?? [], t[1] = h.data?.data, t[2] = g);
212
213
  let _ = g, se = h.data?.total ?? 0, y = _.length < se, x;
213
- r[3] === o ? x = r[4] : (x = () => o(!0), r[3] = o, r[4] = x);
214
+ t[3] === o ? x = t[4] : (x = () => o(!0), t[3] = o, t[4] = x);
214
215
  let C;
215
- r[5] === Symbol.for("react.memo_cache_sentinel") ? (C = /* @__PURE__ */ jsx(Play, { className: "h-3.5 w-3.5" }), r[5] = C) : C = r[5];
216
+ t[5] === Symbol.for("react.memo_cache_sentinel") ? (C = /* @__PURE__ */ jsx(Play, { className: "h-3.5 w-3.5" }), t[5] = C) : C = t[5];
216
217
  let T;
217
- r[6] === x ? T = r[7] : (T = /* @__PURE__ */ jsx("div", {
218
+ t[6] === x ? T = t[7] : (T = /* @__PURE__ */ jsx("div", {
218
219
  className: "flex justify-center",
219
220
  children: /* @__PURE__ */ jsxs(Button, {
220
221
  variant: "secondary",
@@ -223,9 +224,9 @@ function PreviewEmptyState(n) {
223
224
  onClick: x,
224
225
  children: [C, "New Run"]
225
226
  })
226
- }), r[6] = x, r[7] = T);
227
+ }), t[6] = x, t[7] = T);
227
228
  let E;
228
- r[8] !== h.isLoading || r[9] !== y || r[10] !== l || r[11] !== u || r[12] !== _ ? (E = h.isLoading && _.length === 0 ? /* @__PURE__ */ jsx("div", {
229
+ t[8] !== h.isLoading || t[9] !== y || t[10] !== l || t[11] !== u || t[12] !== _ ? (E = h.isLoading && _.length === 0 ? /* @__PURE__ */ jsx("div", {
229
230
  className: "flex justify-center py-4",
230
231
  children: /* @__PURE__ */ jsx(Loader2, { className: "text-muted-foreground h-4 w-4 animate-spin" })
231
232
  }) : _.length > 0 ? /* @__PURE__ */ jsxs("div", { children: [
@@ -248,23 +249,23 @@ function PreviewEmptyState(n) {
248
249
  onClick: () => f(_temp2),
249
250
  children: [/* @__PURE__ */ jsx(ChevronDown, { className: "h-3 w-3" }), "Load more"]
250
251
  })
251
- ] }) : null, r[8] = h.isLoading, r[9] = y, r[10] = l, r[11] = u, r[12] = _, r[13] = E) : E = r[13];
252
+ ] }) : null, t[8] = h.isLoading, t[9] = y, t[10] = l, t[11] = u, t[12] = _, t[13] = E) : E = t[13];
252
253
  let D;
253
- r[14] !== T || r[15] !== E ? (D = /* @__PURE__ */ jsxs("div", {
254
+ t[14] !== T || t[15] !== E ? (D = /* @__PURE__ */ jsxs("div", {
254
255
  className: "w-full max-w-sm space-y-6 px-4",
255
256
  children: [T, E]
256
- }), r[14] = T, r[15] = E, r[16] = D) : D = r[16];
257
+ }), t[14] = T, t[15] = E, t[16] = D) : D = t[16];
257
258
  let O;
258
- r[17] !== a || r[18] !== o || r[19] !== s ? (O = /* @__PURE__ */ jsx(NewRunDialog, {
259
- open: a,
259
+ t[17] !== r || t[18] !== o || t[19] !== s ? (O = /* @__PURE__ */ jsx(NewRunDialog, {
260
+ open: r,
260
261
  onOpenChange: o,
261
262
  onSuccess: s
262
- }), r[17] = a, r[18] = o, r[19] = s, r[20] = O) : O = r[20];
263
+ }), t[17] = r, t[18] = o, t[19] = s, t[20] = O) : O = t[20];
263
264
  let k;
264
- return r[21] !== D || r[22] !== O ? (k = /* @__PURE__ */ jsxs("div", {
265
+ return t[21] !== D || t[22] !== O ? (k = /* @__PURE__ */ jsxs("div", {
265
266
  className: "flex h-screen flex-col items-center justify-center",
266
267
  children: [D, O]
267
- }), r[21] = D, r[22] = O, r[23] = k) : k = r[23], k;
268
+ }), t[21] = D, t[22] = O, t[23] = k) : k = t[23], k;
268
269
  }
269
270
  function _temp2(e) {
270
271
  return e + 5;
@@ -330,7 +331,7 @@ function LogLine(e) {
330
331
  function EmbedLogsContent() {
331
332
  let e = c(21), t = config_default.environment.url, n = useRef(null), r;
332
333
  e[0] === Symbol.for("react.memo_cache_sentinel") ? (r = {
333
- queryKey: ["remote-agent-app-logs"],
334
+ queryKey: ["remote-agent-app-logs", t],
334
335
  queryFn: async () => {
335
336
  let e = await fetch(`${t}/api/v1/app/logs?lines=200`, { credentials: "include" });
336
337
  if (!e.ok) {
@@ -1,5 +1,5 @@
1
- import { useStudio } from "../providers/StudioProvider.js";
2
1
  import { useFilterWorkflows } from "../hooks/useWorkflows.js";
2
+ import { useStudio } from "../providers/StudioProvider.js";
3
3
  import { Button } from "../components/ui/button.js";
4
4
  import { NewRunDialog } from "../features/workbench/components/NewRunDialog.js";
5
5
  import { RecentRunItem } from "../features/workbench/components/RecentRunItem.js";
@@ -1,6 +1,7 @@
1
+ import { useWorkflow, useWorkspace } from "../packages/react/dist/hooks/queries.js";
2
+ import "../hooks/useWorkflows.js";
3
+ import "../hooks/useWorkspaces.js";
1
4
  import { useStudio } from "../providers/StudioProvider.js";
2
- import { useWorkflow } from "../hooks/useWorkflows.js";
3
- import { useWorkspace } from "../hooks/useWorkspaces.js";
4
5
  import LoadingCentered_default from "../components/feedback/LoadingCentered.js";
5
6
  import ErrorSnackbar_default from "../components/feedback/ErrorSnackbar.js";
6
7
  import { FeatureRegistryProvider } from "../features/feature-registry/FeatureRegistryProvider.js";
@@ -1,6 +1,7 @@
1
+ import { useWorkflow, useWorkspace } from "../packages/react/dist/hooks/queries.js";
2
+ import { useChildWorkflows, useWorkflowConfigByName } from "../hooks/useWorkflows.js";
3
+ import "../hooks/useWorkspaces.js";
1
4
  import { useStudio } from "../providers/StudioProvider.js";
2
- import { useChildWorkflows, useWorkflow, useWorkflowConfigByName } from "../hooks/useWorkflows.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";
6
7
  import { ReactFlowProvider } from "../node_modules/@xyflow/react/dist/esm/index.js";
@@ -1,6 +1,7 @@
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";
6
7
  import { FeatureRegistryProvider } from "../features/feature-registry/FeatureRegistryProvider.js";
@@ -1,5 +1,6 @@
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";
5
6
  import { FeatureRegistryProvider } from "../features/feature-registry/FeatureRegistryProvider.js";
@@ -0,0 +1,35 @@
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 LiveInvalidationWhenAuthenticated() {
16
+ let e = c(2), { isSuccess: s } = useMe(), l;
17
+ return e[0] === s ? l = e[1] : (l = s ? /* @__PURE__ */ jsx(LiveInvalidation, {}) : null, e[0] = s, e[1] = l), l;
18
+ }
19
+ function LoopstackClientProvider(l) {
20
+ let u = c(7), { children: d } = l, { environment: f } = useStudio(), p;
21
+ u[0] !== f.id || u[1] !== f.url ? (p = createClient({
22
+ url: f.url,
23
+ envKey: f.id,
24
+ credentials: "include",
25
+ fetch: createReportingFetch(f.id)
26
+ }), u[0] = f.id, u[1] = f.url, u[2] = p) : p = u[2];
27
+ let m = p, h;
28
+ u[3] === Symbol.for("react.memo_cache_sentinel") ? (h = /* @__PURE__ */ jsx(LiveInvalidationWhenAuthenticated, {}), u[3] = h) : h = u[3];
29
+ let g;
30
+ return u[4] !== d || u[5] !== m ? (g = /* @__PURE__ */ jsxs(LoopstackProvider, {
31
+ client: m,
32
+ children: [h, d]
33
+ }), u[4] = d, u[5] = m, u[6] = g) : g = u[6], g;
34
+ }
35
+ 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.34.0",
3
+ "version": "0.35.1",
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.36.0",
29
+ "@loopstack/client": "^0.37.1",
30
+ "@loopstack/contracts": "^0.37.0",
31
+ "@loopstack/react": "^1.0.1",
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,31 +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: {
21
- local: createFilesApi(f, "local"),
22
- remote: createFilesApi(f, "remote")
23
- },
24
- git: createGitApi(f),
25
- processor: createProcessorApi(f),
26
- secrets: createSecretsApi(f),
27
- workflows: createWorkflowsApi(f),
28
- workspaces: createWorkspacesApi(f)
29
- };
30
- }
31
- 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 };