@loopstack/loopstack-studio 0.34.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 (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 +31 -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
@@ -1,105 +1,107 @@
1
- import { useFileContent, useFileTree } from "../hooks/useFileExplorer.js";
1
+ import { useLoopstackClient } from "../../../packages/react/dist/provider.js";
2
+ import "../../../packages/react/dist/index.js";
3
+ import { fileTreeKey, useFileContent, useFileTree } from "../hooks/useFileExplorer.js";
2
4
  import { c } from "react/compiler-runtime";
3
5
  import { createContext, useCallback, useContext, useMemo, useState } from "react";
4
6
  import { jsx } from "react/jsx-runtime";
5
7
  import { useQueryClient } from "@tanstack/react-query";
6
8
  var FileExplorerContext = createContext(null);
7
- function FileExplorerProvider(s) {
8
- let l = c(36), { variant: u, workspaceId: d, enabled: f, children: p } = s, m = f === void 0 ? !0 : f, h = useQueryClient(), g;
9
- l[0] === Symbol.for("react.memo_cache_sentinel") ? (g = /* @__PURE__ */ new Set(), l[0] = g) : g = l[0];
10
- let [_, v] = useState(g), y;
11
- l[1] === Symbol.for("react.memo_cache_sentinel") ? (y = [], l[1] = y) : y = l[1];
12
- let [b, x] = useState(y), [S, C] = useState(null), w = useFileTree(u, d, m), T = useFileContent(u, d, S?.type === "file" ? S.path : void 0, m), E;
13
- l[2] === Symbol.for("react.memo_cache_sentinel") ? (E = (e) => {
14
- v((a) => {
15
- let o = new Set(a);
16
- return o.has(e) ? o.delete(e) : o.add(e), o;
9
+ function FileExplorerProvider(u) {
10
+ let d = c(37), { variant: f, workspaceId: p, enabled: m, children: h } = u, g = m === void 0 ? !0 : m, _ = useLoopstackClient(), v = useQueryClient(), y;
11
+ d[0] === Symbol.for("react.memo_cache_sentinel") ? (y = /* @__PURE__ */ new Set(), d[0] = y) : y = d[0];
12
+ let [b, x] = useState(y), S;
13
+ d[1] === Symbol.for("react.memo_cache_sentinel") ? (S = [], d[1] = S) : S = d[1];
14
+ let [C, w] = useState(S), [T, E] = useState(null), D = useFileTree(f, p, g), O = useFileContent(f, p, T?.type === "file" ? T.path : void 0, g), k;
15
+ d[2] === Symbol.for("react.memo_cache_sentinel") ? (k = (e) => {
16
+ x((o) => {
17
+ let s = new Set(o);
18
+ return s.has(e) ? s.delete(e) : s.add(e), s;
17
19
  });
18
- }, l[2] = E) : E = l[2];
19
- let D = E, O;
20
- l[3] === Symbol.for("react.memo_cache_sentinel") ? (O = (e) => {
21
- e.type === "file" && (C(e), x((a) => a.some((a) => a.path === e.path) ? a : [...a, e]));
22
- }, l[3] = O) : O = l[3];
23
- let k = O, A;
24
- l[4] === S?.path ? A = l[5] : (A = (e) => {
25
- x((a) => {
26
- let o = a.filter((a) => a.path !== e.path);
27
- if (S?.path === e.path) if (o.length > 0) {
28
- let s = a.findIndex((a) => a.path === e.path);
29
- C(o[Math.max(0, s - 1)]);
30
- } else C(null);
31
- return o;
20
+ }, d[2] = k) : k = d[2];
21
+ let A = k, j;
22
+ d[3] === Symbol.for("react.memo_cache_sentinel") ? (j = (e) => {
23
+ e.type === "file" && (E(e), w((o) => o.some((o) => o.path === e.path) ? o : [...o, e]));
24
+ }, d[3] = j) : j = d[3];
25
+ let M = j, N;
26
+ d[4] === T?.path ? N = d[5] : (N = (e) => {
27
+ w((o) => {
28
+ let s = o.filter((o) => o.path !== e.path);
29
+ if (T?.path === e.path) if (s.length > 0) {
30
+ let l = o.findIndex((o) => o.path === e.path);
31
+ E(s[Math.max(0, l - 1)]);
32
+ } else E(null);
33
+ return s;
32
34
  });
33
- }, l[4] = S?.path, l[5] = A);
34
- let j = A, M;
35
- l[6] === S ? M = l[7] : (M = () => {
36
- S && x((e) => {
37
- let a = e.filter((e) => e.path !== S.path);
38
- if (a.length > 0) {
39
- let o = e.findIndex((e) => e.path === S.path);
40
- C(a[Math.max(0, o - 1)]);
41
- } else C(null);
42
- return a;
35
+ }, d[4] = T?.path, d[5] = N);
36
+ let P = N, F;
37
+ d[6] === T ? F = d[7] : (F = () => {
38
+ T && w((e) => {
39
+ let o = e.filter((e) => e.path !== T.path);
40
+ if (o.length > 0) {
41
+ let s = e.findIndex((e) => e.path === T.path);
42
+ E(o[Math.max(0, s - 1)]);
43
+ } else E(null);
44
+ return o;
43
45
  });
44
- }, l[6] = S, l[7] = M);
45
- let N = M, P;
46
- l[8] === Symbol.for("react.memo_cache_sentinel") ? (P = () => {
47
- x([]), C(null);
48
- }, l[8] = P) : P = l[8];
49
- let F = P, I;
50
- l[9] === Symbol.for("react.memo_cache_sentinel") ? (I = (e) => {
51
- x([e]), C(e);
52
- }, l[9] = I) : I = l[9];
53
- let L = I, R;
54
- l[10] === S ? R = l[11] : (R = (e) => {
55
- x((a) => {
56
- let o = a.findIndex((a) => a.path === e.path);
57
- if (o <= 0) return a;
58
- let s = a.slice(o);
59
- return S && a.findIndex((e) => e.path === S.path) < o && C(e), s;
46
+ }, d[6] = T, d[7] = F);
47
+ let I = F, L;
48
+ d[8] === Symbol.for("react.memo_cache_sentinel") ? (L = () => {
49
+ w([]), E(null);
50
+ }, d[8] = L) : L = d[8];
51
+ let R = L, z;
52
+ d[9] === Symbol.for("react.memo_cache_sentinel") ? (z = (e) => {
53
+ w([e]), E(e);
54
+ }, d[9] = z) : z = d[9];
55
+ let B = z, V;
56
+ d[10] === T ? V = d[11] : (V = (e) => {
57
+ w((o) => {
58
+ let s = o.findIndex((o) => o.path === e.path);
59
+ if (s <= 0) return o;
60
+ let l = o.slice(s);
61
+ return T && o.findIndex((e) => e.path === T.path) < s && E(e), l;
60
62
  });
61
- }, l[10] = S, l[11] = R);
62
- let z = R, B;
63
- l[12] === S ? B = l[13] : (B = (e) => {
64
- x((a) => {
65
- let o = a.findIndex((a) => a.path === e.path);
66
- if (o < 0 || o >= a.length - 1) return a;
67
- let s = a.slice(0, o + 1);
68
- return S && a.findIndex((e) => e.path === S.path) > o && C(e), s;
63
+ }, d[10] = T, d[11] = V);
64
+ let H = V, U;
65
+ d[12] === T ? U = d[13] : (U = (e) => {
66
+ w((o) => {
67
+ let s = o.findIndex((o) => o.path === e.path);
68
+ if (s < 0 || s >= o.length - 1) return o;
69
+ let l = o.slice(0, s + 1);
70
+ return T && o.findIndex((e) => e.path === T.path) > s && E(e), l;
69
71
  });
70
- }, l[12] = S, l[13] = B);
71
- let V = B, H;
72
- l[14] === h ? H = l[15] : (H = () => {
73
- h.invalidateQueries({ queryKey: ["file-explorer-tree"] });
74
- }, l[14] = h, l[15] = H);
75
- let U = H, W;
76
- l[16] === w.data ? W = l[17] : (W = w.data ?? [], l[16] = w.data, l[17] = W);
77
- let G = w.isLoading && !w.data, K = T.data?.content ?? null, q = T.isLoading && !!S, J;
78
- l[18] !== N || l[19] !== j || l[20] !== z || l[21] !== V || l[22] !== _ || l[23] !== b || l[24] !== U || l[25] !== S || l[26] !== W || l[27] !== G || l[28] !== K || l[29] !== q || l[30] !== w.error || l[31] !== w.isFetching ? (J = {
79
- nodes: W,
80
- isTreeLoading: G,
81
- treeError: w.error,
82
- isFetchingTree: w.isFetching,
83
- openFiles: b,
84
- selectedFile: S,
85
- fileContent: K,
86
- isContentLoading: q,
87
- expandedFolders: _,
88
- toggleFolder: D,
89
- selectFile: k,
90
- closeFile: j,
91
- closeAll: F,
92
- closeOthers: L,
93
- closeToLeft: z,
94
- closeToRight: V,
95
- clearSelection: N,
96
- refreshTree: U
97
- }, l[18] = N, l[19] = j, l[20] = z, l[21] = V, l[22] = _, l[23] = b, l[24] = U, l[25] = S, l[26] = W, l[27] = G, l[28] = K, l[29] = q, l[30] = w.error, l[31] = w.isFetching, l[32] = J) : J = l[32];
98
- let Y = J, X;
99
- return l[33] !== p || l[34] !== Y ? (X = /* @__PURE__ */ jsx(FileExplorerContext.Provider, {
100
- value: Y,
101
- children: p
102
- }), l[33] = p, l[34] = Y, l[35] = X) : X = l[35], X;
72
+ }, d[12] = T, d[13] = U);
73
+ let W = U, G;
74
+ d[14] !== _.envKey || d[15] !== v ? (G = () => {
75
+ v.invalidateQueries({ queryKey: fileTreeKey(_.envKey) });
76
+ }, d[14] = _.envKey, d[15] = v, d[16] = G) : G = d[16];
77
+ let K = G, q;
78
+ d[17] === D.data ? q = d[18] : (q = D.data ?? [], d[17] = D.data, d[18] = q);
79
+ let J = D.isLoading && !D.data, Y = O.data?.content ?? null, X = O.isLoading && !!T, Z;
80
+ d[19] !== I || d[20] !== P || d[21] !== H || d[22] !== W || d[23] !== b || d[24] !== C || d[25] !== K || d[26] !== T || d[27] !== q || d[28] !== J || d[29] !== Y || d[30] !== X || d[31] !== D.error || d[32] !== D.isFetching ? (Z = {
81
+ nodes: q,
82
+ isTreeLoading: J,
83
+ treeError: D.error,
84
+ isFetchingTree: D.isFetching,
85
+ openFiles: C,
86
+ selectedFile: T,
87
+ fileContent: Y,
88
+ isContentLoading: X,
89
+ expandedFolders: b,
90
+ toggleFolder: A,
91
+ selectFile: M,
92
+ closeFile: P,
93
+ closeAll: R,
94
+ closeOthers: B,
95
+ closeToLeft: H,
96
+ closeToRight: W,
97
+ clearSelection: I,
98
+ refreshTree: K
99
+ }, d[19] = I, d[20] = P, d[21] = H, d[22] = W, d[23] = b, d[24] = C, d[25] = K, d[26] = T, d[27] = q, d[28] = J, d[29] = Y, d[30] = X, d[31] = D.error, d[32] = D.isFetching, d[33] = Z) : Z = d[33];
100
+ let Q = Z, $;
101
+ return d[34] !== h || d[35] !== Q ? ($ = /* @__PURE__ */ jsx(FileExplorerContext.Provider, {
102
+ value: Q,
103
+ children: h
104
+ }), d[34] = h, d[35] = Q, d[36] = $) : $ = d[36], $;
103
105
  }
104
106
  function useFileExplorer() {
105
107
  let e = useContext(FileExplorerContext);
@@ -1,6 +1,7 @@
1
+ import { useCreateWorkflow, useRunWorkflow } from "../../../packages/react/dist/hooks/mutations.js";
2
+ import "../../../hooks/useWorkflows.js";
1
3
  import { useStudio } from "../../../providers/StudioProvider.js";
2
- import { useCreateWorkflow } from "../../../hooks/useWorkflows.js";
3
- import { useRunWorkflow } from "../../../hooks/useProcessor.js";
4
+ import "../../../hooks/useProcessor.js";
4
5
  import { useWorkbenchLayout } from "../../workbench/providers/WorkbenchLayoutProvider.js";
5
6
  import { SidebarPanel } from "../../workbench/components/SidebarPanel.js";
6
7
  import "../../workbench/index.js";
@@ -16,18 +17,14 @@ function WorkbenchGitPanel(y) {
16
17
  useGitInvalidation(x);
17
18
  let j = useCreateWorkflow(), M = useRunWorkflow(), N = useRemoveGitRemote(), P = j.isPending || M.isPending, F;
18
19
  b[0] !== j || b[1] !== T || b[2] !== M || b[3] !== x ? (F = () => {
19
- x && j.mutate({ workflowCreateDto: {
20
+ x && j.mutate({
20
21
  workflowName: "connectGitHub",
21
22
  title: null,
22
23
  workspaceId: x,
23
24
  transition: null,
24
25
  args: {}
25
- } }, { onSuccess: (t) => {
26
- M.mutate({
27
- workflowId: t.id,
28
- runWorkflowPayloadDto: {},
29
- force: !0
30
- }, { onSuccess: () => {
26
+ }, { onSuccess: (t) => {
27
+ M.mutate({ workflowId: t.id }, { onSuccess: () => {
31
28
  T.navigateToWorkflow(t.id);
32
29
  } });
33
30
  } });
@@ -1,78 +1,76 @@
1
- import { getGitLogCacheKey, getGitRemoteCacheKey, getGitStatusCacheKey } from "../../../hooks/query-keys.js";
2
- import { eventBus } from "../../../services/eventEmitter.js";
3
- import "../../../services/index.js";
4
- import { useApiClient } from "../../../hooks/useApi.js";
1
+ import { useLoopstackClient } from "../../../packages/react/dist/provider.js";
2
+ import { queryKeys } from "../../../packages/client/dist/queries/query-keys.js";
3
+ import "../../../packages/client/dist/index.js";
4
+ import "../../../packages/react/dist/index.js";
5
5
  import { c } from "react/compiler-runtime";
6
6
  import { useEffect } from "react";
7
7
  import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
8
- function useGitStatus(e) {
9
- let i = c(10), { envKey: o, api: s } = useApiClient(), l;
10
- i[0] !== o || i[1] !== e ? (l = getGitStatusCacheKey(o, e), i[0] = o, i[1] = e, i[2] = l) : l = i[2];
11
- let d;
12
- i[3] !== s || i[4] !== e ? (d = () => s.git.getStatus({ workspaceId: e }), i[3] = s, i[4] = e, i[5] = d) : d = i[5];
13
- let f = !!e, p;
14
- return i[6] !== l || i[7] !== d || i[8] !== f ? (p = {
8
+ var gitPath = (e) => `/api/v1/workspaces/${e}/git`;
9
+ function useGitStatus(r) {
10
+ let i = c(10), o = useLoopstackClient(), l;
11
+ i[0] !== o.envKey || i[1] !== r ? (l = queryKeys.gitStatus(o.envKey, r), i[0] = o.envKey, i[1] = r, i[2] = l) : l = i[2];
12
+ let u;
13
+ i[3] !== o.http || i[4] !== r ? (u = () => o.http.get(`${gitPath(r)}/status`), i[3] = o.http, i[4] = r, i[5] = u) : u = i[5];
14
+ let d = !!r, f;
15
+ return i[6] !== l || i[7] !== u || i[8] !== d ? (f = {
15
16
  queryKey: l,
16
- queryFn: d,
17
- enabled: f,
17
+ queryFn: u,
18
+ enabled: d,
18
19
  staleTime: 3e4,
19
20
  retry: !1
20
- }, i[6] = l, i[7] = d, i[8] = f, i[9] = p) : p = i[9], useQuery(p);
21
+ }, i[6] = l, i[7] = u, i[8] = d, i[9] = f) : f = i[9], useQuery(f);
21
22
  }
22
- function useGitLog(i, a) {
23
- let o = c(11), s = a === void 0 ? 50 : a, { envKey: l, api: d } = useApiClient(), f;
24
- o[0] !== l || o[1] !== i ? (f = getGitLogCacheKey(l, i), o[0] = l, o[1] = i, o[2] = f) : f = o[2];
25
- let p;
26
- o[3] !== d || o[4] !== s || o[5] !== i ? (p = () => d.git.getLog({
27
- workspaceId: i,
28
- limit: s
29
- }), o[3] = d, o[4] = s, o[5] = i, o[6] = p) : p = o[6];
30
- let m = !!i, h;
31
- return o[7] !== f || o[8] !== p || o[9] !== m ? (h = {
32
- queryKey: f,
33
- queryFn: p,
34
- enabled: m,
23
+ function useGitLog(r, i) {
24
+ let o = c(11), l = i === void 0 ? 50 : i, u = useLoopstackClient(), d;
25
+ o[0] !== u.envKey || o[1] !== r ? (d = queryKeys.gitLog(u.envKey, r), o[0] = u.envKey, o[1] = r, o[2] = d) : d = o[2];
26
+ let f;
27
+ o[3] !== u.http || o[4] !== l || o[5] !== r ? (f = () => u.http.get(`${gitPath(r)}/log`, { limit: l }), o[3] = u.http, o[4] = l, o[5] = r, o[6] = f) : f = o[6];
28
+ let p = !!r, m;
29
+ return o[7] !== d || o[8] !== f || o[9] !== p ? (m = {
30
+ queryKey: d,
31
+ queryFn: f,
32
+ enabled: p,
35
33
  staleTime: 3e4,
36
34
  retry: !1
37
- }, o[7] = f, o[8] = p, o[9] = m, o[10] = h) : h = o[10], useQuery(h);
35
+ }, o[7] = d, o[8] = f, o[9] = p, o[10] = m) : m = o[10], useQuery(m);
38
36
  }
39
- function useGitRemote(e) {
40
- let a = c(10), { envKey: o, api: s } = useApiClient(), l;
41
- a[0] !== o || a[1] !== e ? (l = getGitRemoteCacheKey(o, e), a[0] = o, a[1] = e, a[2] = l) : l = a[2];
42
- let d;
43
- a[3] !== s || a[4] !== e ? (d = () => s.git.getRemote({ workspaceId: e }), a[3] = s, a[4] = e, a[5] = d) : d = a[5];
44
- let f = !!e, p;
45
- return a[6] !== l || a[7] !== d || a[8] !== f ? (p = {
37
+ function useGitRemote(r) {
38
+ let i = c(10), o = useLoopstackClient(), l;
39
+ i[0] !== o.envKey || i[1] !== r ? (l = queryKeys.gitRemote(o.envKey, r), i[0] = o.envKey, i[1] = r, i[2] = l) : l = i[2];
40
+ let u;
41
+ i[3] !== o.http || i[4] !== r ? (u = () => o.http.get(`${gitPath(r)}/remote`), i[3] = o.http, i[4] = r, i[5] = u) : u = i[5];
42
+ let d = !!r, f;
43
+ return i[6] !== l || i[7] !== u || i[8] !== d ? (f = {
46
44
  queryKey: l,
47
- queryFn: d,
48
- enabled: f,
45
+ queryFn: u,
46
+ enabled: d,
49
47
  staleTime: 6e4,
50
48
  retry: !1
51
- }, a[6] = l, a[7] = d, a[8] = f, a[9] = p) : p = a[9], useQuery(p);
49
+ }, i[6] = l, i[7] = u, i[8] = d, i[9] = f) : f = i[9], useQuery(f);
52
50
  }
53
- function useGitInvalidation(l) {
54
- let u = c(5), { envKey: f } = useApiClient(), p = useQueryClient(), m, h;
55
- u[0] !== f || u[1] !== p || u[2] !== l ? (m = () => {
56
- if (l) return eventBus.on("git.updated", (o) => {
57
- o.workspaceId === l && (p.invalidateQueries({ queryKey: getGitStatusCacheKey(f, l) }), p.invalidateQueries({ queryKey: getGitLogCacheKey(f, l) }), p.invalidateQueries({ queryKey: getGitRemoteCacheKey(f, l) }));
51
+ function useGitInvalidation(i) {
52
+ let a = c(5), s = useLoopstackClient(), l = useQueryClient(), u, d;
53
+ a[0] !== s || a[1] !== l || a[2] !== i ? (u = () => {
54
+ if (i) return s.stream.on("git.updated", (e) => {
55
+ e.workspaceId === i && (l.invalidateQueries({ queryKey: queryKeys.gitStatus(s.envKey, i) }), l.invalidateQueries({ queryKey: queryKeys.gitLog(s.envKey, i) }), l.invalidateQueries({ queryKey: queryKeys.gitRemote(s.envKey, i) }));
58
56
  });
59
- }, h = [
60
- f,
61
- l,
62
- p
63
- ], u[0] = f, u[1] = p, u[2] = l, u[3] = m, u[4] = h) : (m = u[3], h = u[4]), useEffect(m, h);
57
+ }, d = [
58
+ s,
59
+ i,
60
+ l
61
+ ], a[0] = s, a[1] = l, a[2] = i, a[3] = u, a[4] = d) : (u = a[3], d = a[4]), useEffect(u, d);
64
62
  }
65
63
  function useRemoveGitRemote() {
66
- let e = c(8), { envKey: a, api: o } = useApiClient(), s = useQueryClient(), u;
67
- e[0] === o ? u = e[1] : (u = (e) => o.git.removeRemote(e), e[0] = o, e[1] = u);
64
+ let r = c(8), a = useLoopstackClient(), l = useQueryClient(), u;
65
+ r[0] === a ? u = r[1] : (u = (e) => a.http.delete(`${gitPath(e.workspaceId)}/remote`), r[0] = a, r[1] = u);
66
+ let d;
67
+ r[2] !== a || r[3] !== l ? (d = (e, n) => {
68
+ l.invalidateQueries({ queryKey: queryKeys.gitRemote(a.envKey, n.workspaceId) });
69
+ }, r[2] = a, r[3] = l, r[4] = d) : d = r[4];
68
70
  let f;
69
- e[2] !== a || e[3] !== s ? (f = (e, o) => {
70
- s.invalidateQueries({ queryKey: getGitRemoteCacheKey(a, o.workspaceId) });
71
- }, e[2] = a, e[3] = s, e[4] = f) : f = e[4];
72
- let p;
73
- return e[5] !== u || e[6] !== f ? (p = {
71
+ return r[5] !== u || r[6] !== d ? (f = {
74
72
  mutationFn: u,
75
- onSuccess: f
76
- }, e[5] = u, e[6] = f, e[7] = p) : p = e[7], useMutation(p);
73
+ onSuccess: d
74
+ }, r[5] = u, r[6] = d, r[7] = f) : f = r[7], useMutation(f);
77
75
  }
78
76
  export { useGitInvalidation, useGitLog, useGitRemote, useGitStatus, useRemoveGitRemote };
@@ -1,11 +1,10 @@
1
- import { ApiClientEvents } from "../../events/api-client-events.js";
2
- import { eventBus } from "../../services/eventEmitter.js";
3
- import "../../services/index.js";
1
+ import { useHubLogin, useRefreshSession } from "../../packages/react/dist/hooks/mutations.js";
2
+ import { ApiClientEvents, apiClientEvents } from "../../events/api-client-events.js";
3
+ import "../../events/index.js";
4
4
  import { useStudio } from "../../providers/StudioProvider.js";
5
- import { useGetHealthInfo, useWorkerAuth, useWorkerAuthTokenRefresh } from "../../hooks/useAuth.js";
5
+ import { useGetHealthInfo } from "../../hooks/useAuth.js";
6
6
  import { useCallback, useEffect, useRef, useState } from "react";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
- import { useQueryClient } from "@tanstack/react-query";
9
8
  import { RefreshCw, X } from "lucide-react";
10
9
  const Escalation = {
11
10
  None: 0,
@@ -15,58 +14,58 @@ const Escalation = {
15
14
  Connection: 4
16
15
  };
17
16
  var LocalHealthCheck_default = () => {
18
- let { environment: g } = useStudio(), [_, v] = useState(Escalation.None), y = useWorkerAuth(), b = useWorkerAuthTokenRefresh(), x = useGetHealthInfo(!1), S = useQueryClient(), C = useRef(b);
17
+ let { environment: h } = useStudio(), [g, _] = useState(Escalation.None), v = useHubLogin(), y = useRefreshSession(), b = useGetHealthInfo(!1), x = useRef(y);
18
+ x.current = y;
19
+ let S = useRef(v);
20
+ S.current = v;
21
+ let C = useRef(b);
19
22
  C.current = b;
20
- let w = useRef(y);
21
- w.current = y;
22
- let T = useRef(x);
23
- T.current = x;
24
- let E = useCallback(() => {
25
- T.current.refetch();
26
- }, []), D = useCallback(() => {
27
- C.current.mutate();
28
- }, []), O = useCallback(async () => {
23
+ let w = useCallback(() => {
24
+ C.current.refetch();
25
+ }, []), T = useCallback(() => {
26
+ x.current.mutate();
27
+ }, []), E = useCallback(async () => {
29
28
  try {
30
29
  let e = "local";
31
- g.getIdToken && (e = await g.getIdToken()), w.current.mutate({ hubLoginRequestDto: { idToken: e } });
30
+ h.getIdToken && (e = await h.getIdToken()), S.current.mutate({ idToken: e });
32
31
  } catch {
33
- v(Escalation.Debug);
32
+ _(Escalation.Debug);
34
33
  }
35
- }, [g]);
34
+ }, [h]);
36
35
  useEffect(() => {
37
- if (_ !== Escalation.Connection) return;
38
- let e = setInterval(E, 5e3);
36
+ if (g !== Escalation.Connection) return;
37
+ let e = setInterval(w, 5e3);
39
38
  return () => clearInterval(e);
40
- }, [_, E]), useEffect(() => {
41
- x.data && (v(Escalation.None), S.invalidateQueries());
42
- }, [x.data, S]), useEffect(() => {
43
- b.error && v(Escalation.Login);
44
- }, [b.error]), useEffect(() => {
45
- b.data?.status === 200 && v(Escalation.None);
39
+ }, [g, w]), useEffect(() => {
40
+ b.data && _(Escalation.None);
46
41
  }, [b.data]), useEffect(() => {
47
- y.error && v(Escalation.Debug);
42
+ y.error && _(Escalation.Login);
48
43
  }, [y.error]), useEffect(() => {
49
- y.data?.status === 200 && v(Escalation.None);
50
- }, [y.data]), useEffect(() => {
51
- _ === Escalation.Refresh ? D() : _ === Escalation.Login && O();
44
+ y.isSuccess && _(Escalation.None);
45
+ }, [y.isSuccess]), useEffect(() => {
46
+ v.error && _(Escalation.Debug);
47
+ }, [v.error]), useEffect(() => {
48
+ v.isSuccess && _(Escalation.None);
49
+ }, [v.isSuccess]), useEffect(() => {
50
+ g === Escalation.Refresh ? T() : g === Escalation.Login && E();
52
51
  }, [
53
- _,
54
- D,
55
- O
52
+ g,
53
+ T,
54
+ E
56
55
  ]), useEffect(() => {
57
- let m = eventBus.on(ApiClientEvents.UNAUTHORIZED, () => {
58
- v(Escalation.Refresh);
59
- }), h = eventBus.on(ApiClientEvents.ERR_NETWORK, () => {
60
- v(Escalation.Connection);
56
+ let e = apiClientEvents.on(ApiClientEvents.UNAUTHORIZED, () => {
57
+ _(Escalation.Refresh);
58
+ }), m = apiClientEvents.on(ApiClientEvents.ERR_NETWORK, () => {
59
+ _(Escalation.Connection);
61
60
  });
62
61
  return () => {
63
- m(), h();
62
+ e(), m();
64
63
  };
65
64
  }, []);
66
- let [k, A] = useState(!1), j = _ >= Escalation.Debug && !k;
65
+ let [D, O] = useState(!1), k = g >= Escalation.Debug && !D;
67
66
  return useEffect(() => {
68
- _ < Escalation.Debug && A(!1);
69
- }, [_]), j ? /* @__PURE__ */ jsx("div", {
67
+ g < Escalation.Debug && O(!1);
68
+ }, [g]), k ? /* @__PURE__ */ jsx("div", {
70
69
  className: "bg-destructive/10 border-destructive/30 fixed inset-x-0 bottom-0 z-50 border-t px-4 py-3",
71
70
  children: /* @__PURE__ */ jsxs("div", {
72
71
  className: "flex items-center justify-between",
@@ -81,9 +80,9 @@ var LocalHealthCheck_default = () => {
81
80
  "Please make sure the environment",
82
81
  " ",
83
82
  /* @__PURE__ */ jsxs("strong", { children: [
84
- g.name,
83
+ h.name,
85
84
  " (",
86
- g.id,
85
+ h.id,
87
86
  ")"
88
87
  ] }),
89
88
  " ",
@@ -92,12 +91,12 @@ var LocalHealthCheck_default = () => {
92
91
  })] })]
93
92
  }), /* @__PURE__ */ jsxs("div", {
94
93
  className: "flex items-center gap-2",
95
- children: [_ === Escalation.Connection && /* @__PURE__ */ jsxs("button", {
96
- onClick: E,
94
+ children: [g === Escalation.Connection && /* @__PURE__ */ jsxs("button", {
95
+ onClick: w,
97
96
  className: "bg-primary flex items-center gap-2 rounded-md px-3 py-1.5 text-sm text-white transition-colors disabled:cursor-not-allowed disabled:opacity-50",
98
- children: [/* @__PURE__ */ jsx(RefreshCw, { className: `h-3 w-3 ${x.isLoading ? "animate-spin" : ""}` }), "Retry"]
97
+ children: [/* @__PURE__ */ jsx(RefreshCw, { className: `h-3 w-3 ${b.isLoading ? "animate-spin" : ""}` }), "Retry"]
99
98
  }), /* @__PURE__ */ jsx("button", {
100
- onClick: () => A(!0),
99
+ onClick: () => O(!0),
101
100
  className: "text-muted-foreground hover:text-foreground rounded-xs p-1 transition-colors",
102
101
  children: /* @__PURE__ */ jsx(X, { className: "h-4 w-4" })
103
102
  })]
@@ -1,6 +1,7 @@
1
+ import { useRunWorkflow } from "../../packages/react/dist/hooks/mutations.js";
1
2
  import { useDocumentConfigs } from "../../hooks/useConfig.js";
2
3
  import CompletionMessagePaper_default from "../../components/messages/CompletionMessagePaper.js";
3
- import { useRunWorkflow } from "../../hooks/useProcessor.js";
4
+ import "../../hooks/useProcessor.js";
4
5
  import { useOAuthPopup } from "./useOAuthPopup.js";
5
6
  import { c } from "react/compiler-runtime";
6
7
  import React, { useCallback, useEffect, useRef } from "react";
@@ -14,7 +15,7 @@ var OAuthPromptRenderer = (f) => {
14
15
  p[5] !== A || p[6] !== g.id || p[7] !== w || p[8] !== C || p[9] !== _.id ? (j = (t, s) => {
15
16
  !C || !A.includes(C) || w.mutate({
16
17
  workflowId: g.id,
17
- runWorkflowPayloadDto: { transition: {
18
+ payload: { transition: {
18
19
  id: C,
19
20
  workflowId: _.id,
20
21
  payload: {
@@ -60,10 +61,10 @@ var OAuthPromptRenderer = (f) => {
60
61
  provider: b.provider,
61
62
  message: b.message
62
63
  }), p[31] = b.message, p[32] = b.provider, p[33] = t) : t = p[33];
63
- let l;
64
- p[34] !== R || p[35] !== y ? (l = y && /* @__PURE__ */ jsx(RetryButton, { onClick: R }), p[34] = R, p[35] = y, p[36] = l) : l = p[36];
64
+ let s;
65
+ p[34] !== R || p[35] !== y ? (s = y && /* @__PURE__ */ jsx(RetryButton, { onClick: R }), p[34] = R, p[35] = y, p[36] = s) : s = p[36];
65
66
  let u;
66
- return p[37] !== t || p[38] !== l ? (u = /* @__PURE__ */ jsxs(CompletionMessagePaper_default, { children: [t, l] }), p[37] = t, p[38] = l, p[39] = u) : u = p[39], u;
67
+ return p[37] !== t || p[38] !== s ? (u = /* @__PURE__ */ jsxs(CompletionMessagePaper_default, { children: [t, s] }), p[37] = t, p[38] = s, p[39] = u) : u = p[39], u;
67
68
  }
68
69
  let z;
69
70
  return p[40] !== b.provider || p[41] !== R || p[42] !== I || p[43] !== y || p[44] !== T || p[45] !== w.isPending ? (z = /* @__PURE__ */ jsx(CompletionMessagePaper_default, { children: /* @__PURE__ */ jsx(PopupResultView, {
@@ -1,6 +1,7 @@
1
- import { useStudio } from "../../providers/StudioProvider.js";
2
- import { useBatchDeleteWorkflows, useDeleteWorkflow, useFilterWorkflows } from "../../hooks/useWorkflows.js";
1
+ import { useDeleteWorkflow } from "../../packages/react/dist/hooks/mutations.js";
2
+ import { useBatchDeleteWorkflows, useFilterWorkflows } from "../../hooks/useWorkflows.js";
3
3
  import { useFilterWorkspaces } from "../../hooks/useWorkspaces.js";
4
+ import { useStudio } from "../../providers/StudioProvider.js";
4
5
  import { Badge } from "../../components/ui/badge.js";
5
6
  import ListView_default from "../../components/lists/ListView.js";
6
7
  import { useDebounce } from "../../hooks/useDebounce.js";
@@ -1,9 +1,10 @@
1
+ import { useRunWorkflow } from "../../../packages/react/dist/hooks/mutations.js";
1
2
  import { useDocumentConfigs } from "../../../hooks/useConfig.js";
2
3
  import { Button } from "../../../components/ui/button.js";
3
4
  import { Input } from "../../../components/ui/input.js";
4
5
  import { Label } from "../../../components/ui/label.js";
5
6
  import CompletionMessagePaper_default from "../../../components/messages/CompletionMessagePaper.js";
6
- import { useRunWorkflow } from "../../../hooks/useProcessor.js";
7
+ import "../../../hooks/useProcessor.js";
7
8
  import { useWorkbenchLayout } from "../../workbench/providers/WorkbenchLayoutProvider.js";
8
9
  import "../../workbench/index.js";
9
10
  import { useUpsertSecret } from "../../../hooks/useSecrets.js";
@@ -30,7 +31,7 @@ var SecretInputRenderer_default = ({ parentWorkflow: m, workflow: h, document: g
30
31
  }
31
32
  C.mutate({
32
33
  workflowId: m.id,
33
- runWorkflowPayloadDto: { transition: {
34
+ payload: { transition: {
34
35
  id: b,
35
36
  workflowId: h.id,
36
37
  payload: { keys: e }
@@ -1,10 +1,11 @@
1
+ import { WorkflowState } from "../../packages/contracts/dist/enums/workflow-state.enum.js";
2
+ import "../../packages/contracts/dist/enums/index.js";
3
+ import { useRunWorkflow } from "../../packages/react/dist/hooks/mutations.js";
1
4
  import { cn } from "../../lib/utils.js";
2
5
  import { Button } from "../../components/ui/button.js";
3
6
  import LoadingCentered_default from "../../components/feedback/LoadingCentered.js";
4
7
  import ErrorSnackbar_default from "../../components/feedback/ErrorSnackbar.js";
5
- import { WorkflowState } from "../../packages/contracts/dist/enums/workflow-state.enum.js";
6
- import "../../packages/contracts/dist/enums/index.js";
7
- import { useRunWorkflow } from "../../hooks/useProcessor.js";
8
+ import "../../hooks/useProcessor.js";
8
9
  import DocumentList_default from "../documents/components/DocumentList.js";
9
10
  import "../documents/index.js";
10
11
  import WorkflowForms_default from "./components/WorkflowForms.js";
@@ -37,11 +38,7 @@ var WorkflowItem_default = (h) => {
37
38
  g[16] === E?.availableTransitions ? R = g[17] : (R = E?.availableTransitions?.some(_temp), g[16] = E?.availableTransitions, g[17] = R);
38
39
  let z = R, B = E?.hasError && E.status === WorkflowState.Waiting, V = E?.hasError && !B && z !== !1, H;
39
40
  g[18] !== w || g[19] !== v ? (H = () => {
40
- w.mutate({
41
- workflowId: v,
42
- runWorkflowPayloadDto: {},
43
- force: !0
44
- });
41
+ w.mutate({ workflowId: v });
45
42
  }, g[18] = w, g[19] = v, g[20] = H) : H = g[20];
46
43
  let U = H, W = x ? "p-0" : "p-4", G;
47
44
  g[21] === W ? G = g[22] : (G = cn("flex flex-col", W), g[21] = W, g[22] = G);