@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
@@ -0,0 +1,44 @@
1
+ import { ClientMessageBaseSchema } from "./client-message-base.schema.js";
2
+ import { UIMessageSchema } from "../types/types/ui-message.type.js";
3
+ import { z } from "zod";
4
+ const LlmNormalizedMessageSchema = UIMessageSchema.extend({
5
+ id: z.string().optional(),
6
+ text: z.string(),
7
+ stopReason: z.enum([
8
+ "end_turn",
9
+ "tool_use",
10
+ "max_tokens",
11
+ "stop_sequence"
12
+ ]).optional()
13
+ });
14
+ var LlmResponseEventBaseSchema = ClientMessageBaseSchema.extend({
15
+ workflowId: z.string(),
16
+ messageId: z.string()
17
+ });
18
+ const LlmResponseStartEventSchema = LlmResponseEventBaseSchema.extend({ type: z.literal("llm.response.start") }), LlmResponseTextDeltaEventSchema = LlmResponseEventBaseSchema.extend({
19
+ type: z.literal("llm.response.text_delta"),
20
+ delta: z.string()
21
+ }), LlmResponseThinkingDeltaEventSchema = LlmResponseEventBaseSchema.extend({
22
+ type: z.literal("llm.response.thinking_delta"),
23
+ delta: z.string()
24
+ }), LlmResponseToolCallEventSchema = LlmResponseEventBaseSchema.extend({
25
+ type: z.literal("llm.response.tool_call"),
26
+ id: z.string(),
27
+ name: z.string(),
28
+ args: z.record(z.string(), z.unknown())
29
+ }), LlmResponseDoneEventSchema = LlmResponseEventBaseSchema.extend({
30
+ type: z.literal("llm.response.done"),
31
+ message: LlmNormalizedMessageSchema
32
+ }), LlmResponseErrorEventSchema = LlmResponseEventBaseSchema.extend({
33
+ type: z.literal("llm.response.error"),
34
+ error: z.string()
35
+ });
36
+ z.discriminatedUnion("type", [
37
+ LlmResponseStartEventSchema,
38
+ LlmResponseTextDeltaEventSchema,
39
+ LlmResponseThinkingDeltaEventSchema,
40
+ LlmResponseToolCallEventSchema,
41
+ LlmResponseDoneEventSchema,
42
+ LlmResponseErrorEventSchema
43
+ ]);
44
+ export { LlmNormalizedMessageSchema, LlmResponseDoneEventSchema, LlmResponseErrorEventSchema, LlmResponseStartEventSchema, LlmResponseTextDeltaEventSchema, LlmResponseThinkingDeltaEventSchema, LlmResponseToolCallEventSchema };
@@ -0,0 +1,4 @@
1
+ import { ClientMessageBaseSchema } from "./client-message-base.schema.js";
2
+ import { z } from "zod";
3
+ const StreamResetEventSchema = ClientMessageBaseSchema.extend({ type: z.literal("stream.reset") });
4
+ export { StreamResetEventSchema };
@@ -0,0 +1,20 @@
1
+ import { WorkflowState } from "../enums/workflow-state.enum.js";
2
+ import { ClientMessageBaseSchema } from "./client-message-base.schema.js";
3
+ import { z } from "zod";
4
+ const WorkflowCreatedEventSchema = ClientMessageBaseSchema.extend({
5
+ type: z.literal("workflow.created"),
6
+ id: z.string(),
7
+ workflowId: z.string(),
8
+ parentId: z.string().optional()
9
+ }), WorkflowUpdatedEventSchema = ClientMessageBaseSchema.extend({
10
+ type: z.literal("workflow.updated"),
11
+ id: z.string(),
12
+ workflowId: z.string(),
13
+ parentId: z.string().optional(),
14
+ status: z.enum(WorkflowState),
15
+ place: z.string().optional()
16
+ }), DocumentCreatedEventSchema = ClientMessageBaseSchema.extend({
17
+ type: z.literal("document.created"),
18
+ workflowId: z.string()
19
+ });
20
+ export { DocumentCreatedEventSchema, WorkflowCreatedEventSchema, WorkflowUpdatedEventSchema };
@@ -0,0 +1,5 @@
1
+ import { ClientMessageBaseSchema } from "./client-message-base.schema.js";
2
+ import { z } from "zod";
3
+ var WorkspaceEventBaseSchema = ClientMessageBaseSchema.extend({ workspaceId: z.string() });
4
+ const SecretUpsertedEventSchema = WorkspaceEventBaseSchema.extend({ type: z.literal("secret.upserted") }), SecretDeletedEventSchema = WorkspaceEventBaseSchema.extend({ type: z.literal("secret.deleted") }), GitUpdatedEventSchema = WorkspaceEventBaseSchema.extend({ type: z.literal("git.updated") });
5
+ export { GitUpdatedEventSchema, SecretDeletedEventSchema, SecretUpsertedEventSchema };
@@ -0,0 +1,39 @@
1
+ import { z } from "zod";
2
+ const UITextBlockSchema = z.object({
3
+ type: z.literal("text"),
4
+ text: z.string()
5
+ }), UIThinkingBlockSchema = z.object({
6
+ type: z.literal("thinking"),
7
+ text: z.string()
8
+ }), UIToolCallBlockSchema = z.object({
9
+ type: z.literal("tool_call"),
10
+ id: z.string(),
11
+ name: z.string(),
12
+ args: z.record(z.string(), z.unknown())
13
+ }), UIServerToolUseBlockSchema = z.object({
14
+ type: z.literal("server_tool_use"),
15
+ id: z.string(),
16
+ name: z.string(),
17
+ input: z.record(z.string(), z.unknown())
18
+ }), UIServerToolResultBlockSchema = z.object({
19
+ type: z.literal("server_tool_result"),
20
+ toolUseId: z.string(),
21
+ content: z.unknown()
22
+ }), UIToolResultBlockSchema = z.object({
23
+ type: z.literal("tool_result"),
24
+ toolCallId: z.string(),
25
+ content: z.string(),
26
+ isError: z.boolean()
27
+ }), UIContentBlockSchema = z.discriminatedUnion("type", [
28
+ UITextBlockSchema,
29
+ UIThinkingBlockSchema,
30
+ UIToolCallBlockSchema,
31
+ UIServerToolUseBlockSchema,
32
+ UIServerToolResultBlockSchema,
33
+ UIToolResultBlockSchema
34
+ ]), UIMessageSchema = z.object({
35
+ role: z.enum(["user", "assistant"]),
36
+ text: z.string().optional(),
37
+ blocks: z.array(UIContentBlockSchema).optional()
38
+ });
39
+ export { UIMessageSchema };
@@ -0,0 +1,175 @@
1
+ import { useLoopstackClient } from "../provider.js";
2
+ import { queryKeys } from "../../../client/dist/queries/query-keys.js";
3
+ import "../../../client/dist/index.js";
4
+ import { c } from "react/compiler-runtime";
5
+ import { useMutation, useQueryClient } from "@tanstack/react-query";
6
+ function useStartWorkflow() {
7
+ let f = c(8), p = useLoopstackClient(), m = useQueryClient(), h;
8
+ f[0] === p ? h = f[1] : (h = (e) => p.processor.start(e), f[0] = p, f[1] = h);
9
+ let g;
10
+ f[2] !== p || f[3] !== m ? (g = () => {
11
+ m.invalidateQueries({ queryKey: queryKeys.workflows(p.envKey) });
12
+ }, f[2] = p, f[3] = m, f[4] = g) : g = f[4];
13
+ let _;
14
+ return f[5] !== h || f[6] !== g ? (_ = {
15
+ mutationFn: h,
16
+ onSuccess: g
17
+ }, f[5] = h, f[6] = g, f[7] = _) : _ = f[7], useMutation(_);
18
+ }
19
+ function useRunWorkflow() {
20
+ let f = c(8), p = useLoopstackClient(), m = useQueryClient(), h;
21
+ f[0] === p ? h = f[1] : (h = (e) => {
22
+ let { workflowId: u, payload: d } = e;
23
+ return p.processor.run(u, d);
24
+ }, f[0] = p, f[1] = h);
25
+ let g;
26
+ f[2] !== p || f[3] !== m ? (g = () => {
27
+ m.invalidateQueries({ queryKey: queryKeys.workflows(p.envKey) });
28
+ }, f[2] = p, f[3] = m, f[4] = g) : g = f[4];
29
+ let _;
30
+ return f[5] !== h || f[6] !== g ? (_ = {
31
+ mutationFn: h,
32
+ onSuccess: g
33
+ }, f[5] = h, f[6] = g, f[7] = _) : _ = f[7], useMutation(_);
34
+ }
35
+ function useCreateWorkflow() {
36
+ let f = c(8), p = useLoopstackClient(), m = useQueryClient(), h;
37
+ f[0] === p ? h = f[1] : (h = (e) => p.workflows.create(e), f[0] = p, f[1] = h);
38
+ let g;
39
+ f[2] !== p || f[3] !== m ? (g = () => {
40
+ m.invalidateQueries({ queryKey: queryKeys.workflows(p.envKey) });
41
+ }, f[2] = p, f[3] = m, f[4] = g) : g = f[4];
42
+ let _;
43
+ return f[5] !== h || f[6] !== g ? (_ = {
44
+ mutationFn: h,
45
+ onSuccess: g
46
+ }, f[5] = h, f[6] = g, f[7] = _) : _ = f[7], useMutation(_);
47
+ }
48
+ function useUpdateWorkflow() {
49
+ let f = c(8), p = useLoopstackClient(), m = useQueryClient(), h;
50
+ f[0] === p ? h = f[1] : (h = (e) => {
51
+ let { id: u, payload: d } = e;
52
+ return p.workflows.update(u, d);
53
+ }, f[0] = p, f[1] = h);
54
+ let g;
55
+ f[2] !== p || f[3] !== m ? (g = (e, d) => {
56
+ m.invalidateQueries({ queryKey: queryKeys.workflow(p.envKey, d.id) }), m.invalidateQueries({ queryKey: queryKeys.workflows(p.envKey) });
57
+ }, f[2] = p, f[3] = m, f[4] = g) : g = f[4];
58
+ let _;
59
+ return f[5] !== h || f[6] !== g ? (_ = {
60
+ mutationFn: h,
61
+ onSuccess: g
62
+ }, f[5] = h, f[6] = g, f[7] = _) : _ = f[7], useMutation(_);
63
+ }
64
+ function useDeleteWorkflow() {
65
+ let f = c(8), p = useLoopstackClient(), m = useQueryClient(), h;
66
+ f[0] === p ? h = f[1] : (h = (e) => p.workflows.delete(e), f[0] = p, f[1] = h);
67
+ let g;
68
+ f[2] !== p || f[3] !== m ? (g = (e, d) => {
69
+ m.removeQueries({ queryKey: queryKeys.workflow(p.envKey, d) }), m.invalidateQueries({ queryKey: queryKeys.workflows(p.envKey) });
70
+ }, f[2] = p, f[3] = m, f[4] = g) : g = f[4];
71
+ let _;
72
+ return f[5] !== h || f[6] !== g ? (_ = {
73
+ mutationFn: h,
74
+ onSuccess: g
75
+ }, f[5] = h, f[6] = g, f[7] = _) : _ = f[7], useMutation(_);
76
+ }
77
+ function useCreateWorkspace() {
78
+ let f = c(8), p = useLoopstackClient(), m = useQueryClient(), h;
79
+ f[0] === p ? h = f[1] : (h = (e) => p.workspaces.create(e), f[0] = p, f[1] = h);
80
+ let g;
81
+ f[2] !== p || f[3] !== m ? (g = () => {
82
+ m.invalidateQueries({ queryKey: queryKeys.workspaces(p.envKey) });
83
+ }, f[2] = p, f[3] = m, f[4] = g) : g = f[4];
84
+ let _;
85
+ return f[5] !== h || f[6] !== g ? (_ = {
86
+ mutationFn: h,
87
+ onSuccess: g
88
+ }, f[5] = h, f[6] = g, f[7] = _) : _ = f[7], useMutation(_);
89
+ }
90
+ function useUpdateWorkspace() {
91
+ let f = c(8), p = useLoopstackClient(), m = useQueryClient(), h;
92
+ f[0] === p ? h = f[1] : (h = (e) => {
93
+ let { id: u, payload: d } = e;
94
+ return p.workspaces.update(u, d);
95
+ }, f[0] = p, f[1] = h);
96
+ let g;
97
+ f[2] !== p || f[3] !== m ? (g = (e, d) => {
98
+ m.invalidateQueries({ queryKey: queryKeys.workspace(p.envKey, d.id) }), m.invalidateQueries({ queryKey: queryKeys.workspaces(p.envKey) });
99
+ }, f[2] = p, f[3] = m, f[4] = g) : g = f[4];
100
+ let _;
101
+ return f[5] !== h || f[6] !== g ? (_ = {
102
+ mutationFn: h,
103
+ onSuccess: g
104
+ }, f[5] = h, f[6] = g, f[7] = _) : _ = f[7], useMutation(_);
105
+ }
106
+ function useSetFavouriteWorkspace() {
107
+ let f = c(8), p = useLoopstackClient(), m = useQueryClient(), h;
108
+ f[0] === p ? h = f[1] : (h = (e) => {
109
+ let { id: u, isFavourite: d } = e;
110
+ return p.workspaces.setFavourite(u, d);
111
+ }, f[0] = p, f[1] = h);
112
+ let g;
113
+ f[2] !== p || f[3] !== m ? (g = (e, d) => {
114
+ m.invalidateQueries({ queryKey: queryKeys.workspace(p.envKey, d.id) }), m.invalidateQueries({ queryKey: queryKeys.workspaces(p.envKey) });
115
+ }, f[2] = p, f[3] = m, f[4] = g) : g = f[4];
116
+ let _;
117
+ return f[5] !== h || f[6] !== g ? (_ = {
118
+ mutationFn: h,
119
+ onSuccess: g
120
+ }, f[5] = h, f[6] = g, f[7] = _) : _ = f[7], useMutation(_);
121
+ }
122
+ function useDeleteWorkspace() {
123
+ let f = c(8), p = useLoopstackClient(), m = useQueryClient(), h;
124
+ f[0] === p ? h = f[1] : (h = (e) => p.workspaces.delete(e), f[0] = p, f[1] = h);
125
+ let g;
126
+ f[2] !== p || f[3] !== m ? (g = (e, d) => {
127
+ m.removeQueries({ queryKey: queryKeys.workspace(p.envKey, d) }), m.invalidateQueries({ queryKey: queryKeys.workspaces(p.envKey) });
128
+ }, f[2] = p, f[3] = m, f[4] = g) : g = f[4];
129
+ let _;
130
+ return f[5] !== h || f[6] !== g ? (_ = {
131
+ mutationFn: h,
132
+ onSuccess: g
133
+ }, f[5] = h, f[6] = g, f[7] = _) : _ = f[7], useMutation(_);
134
+ }
135
+ function useBatchDeleteWorkspaces() {
136
+ let f = c(8), p = useLoopstackClient(), m = useQueryClient(), h;
137
+ f[0] === p ? h = f[1] : (h = (e) => p.workspaces.batchDelete(e), f[0] = p, f[1] = h);
138
+ let g;
139
+ f[2] !== p || f[3] !== m ? (g = (e, d) => {
140
+ for (let e of d) m.removeQueries({ queryKey: queryKeys.workspace(p.envKey, e) });
141
+ m.invalidateQueries({ queryKey: queryKeys.workspaces(p.envKey) });
142
+ }, f[2] = p, f[3] = m, f[4] = g) : g = f[4];
143
+ let _;
144
+ return f[5] !== h || f[6] !== g ? (_ = {
145
+ mutationFn: h,
146
+ onSuccess: g
147
+ }, f[5] = h, f[6] = g, f[7] = _) : _ = f[7], useMutation(_);
148
+ }
149
+ function useHubLogin() {
150
+ let f = c(8), p = useLoopstackClient(), m = useQueryClient(), h;
151
+ f[0] === p ? h = f[1] : (h = (e) => p.auth.hubLogin(e), f[0] = p, f[1] = h);
152
+ let g;
153
+ f[2] !== p || f[3] !== m ? (g = () => {
154
+ m.invalidateQueries({ queryKey: queryKeys.me(p.envKey) }), m.invalidateQueries({ queryKey: queryKeys.workerHealth(p.envKey) });
155
+ }, f[2] = p, f[3] = m, f[4] = g) : g = f[4];
156
+ let _;
157
+ return f[5] !== h || f[6] !== g ? (_ = {
158
+ mutationFn: h,
159
+ onSuccess: g
160
+ }, f[5] = h, f[6] = g, f[7] = _) : _ = f[7], useMutation(_);
161
+ }
162
+ function useRefreshSession() {
163
+ let f = c(8), p = useLoopstackClient(), m = useQueryClient(), h;
164
+ f[0] === p ? h = f[1] : (h = () => p.auth.refresh(), f[0] = p, f[1] = h);
165
+ let g;
166
+ f[2] !== p || f[3] !== m ? (g = () => {
167
+ m.invalidateQueries({ queryKey: queryKeys.me(p.envKey) }), m.invalidateQueries({ queryKey: queryKeys.workerHealth(p.envKey) });
168
+ }, f[2] = p, f[3] = m, f[4] = g) : g = f[4];
169
+ let _;
170
+ return f[5] !== h || f[6] !== g ? (_ = {
171
+ mutationFn: h,
172
+ onSuccess: g
173
+ }, f[5] = h, f[6] = g, f[7] = _) : _ = f[7], useMutation(_);
174
+ }
175
+ export { useBatchDeleteWorkspaces, useCreateWorkflow, useCreateWorkspace, useDeleteWorkflow, useDeleteWorkspace, useHubLogin, useRefreshSession, useRunWorkflow, useSetFavouriteWorkspace, useStartWorkflow, useUpdateWorkflow, useUpdateWorkspace };
@@ -0,0 +1,139 @@
1
+ import { useLoopstackClient } from "../provider.js";
2
+ import { c } from "react/compiler-runtime";
3
+ import { useQuery } from "@tanstack/react-query";
4
+ function useWorkflow(d, f) {
5
+ let p = c(7), m = useLoopstackClient(), h;
6
+ p[0] !== m.queries || p[1] !== d ? (h = m.queries.workflow(d), p[0] = m.queries, p[1] = d, p[2] = h) : h = p[2];
7
+ let g = !!d && (f?.enabled ?? !0), _;
8
+ return p[3] !== f || p[4] !== h || p[5] !== g ? (_ = {
9
+ ...h,
10
+ ...f,
11
+ enabled: g
12
+ }, p[3] = f, p[4] = h, p[5] = g, p[6] = _) : _ = p[6], useQuery(_);
13
+ }
14
+ function useWorkflowStatus(d, f) {
15
+ let p = c(7), m = useLoopstackClient(), h;
16
+ p[0] !== m.queries || p[1] !== d ? (h = m.queries.workflowStatus(d), p[0] = m.queries, p[1] = d, p[2] = h) : h = p[2];
17
+ let g = !!d && (f?.enabled ?? !0), _;
18
+ return p[3] !== f || p[4] !== h || p[5] !== g ? (_ = {
19
+ ...h,
20
+ ...f,
21
+ enabled: g
22
+ }, p[3] = f, p[4] = h, p[5] = g, p[6] = _) : _ = p[6], useQuery(_);
23
+ }
24
+ function useWorkflowList(d, f) {
25
+ let p = c(6), m = useLoopstackClient(), h;
26
+ p[0] !== m.queries || p[1] !== d ? (h = m.queries.workflowList(d), p[0] = m.queries, p[1] = d, p[2] = h) : h = p[2];
27
+ let g;
28
+ return p[3] !== f || p[4] !== h ? (g = {
29
+ ...h,
30
+ ...f
31
+ }, p[3] = f, p[4] = h, p[5] = g) : g = p[5], useQuery(g);
32
+ }
33
+ function useChildWorkflows(d, f) {
34
+ let p = c(7), m = useLoopstackClient(), h;
35
+ p[0] !== m.queries || p[1] !== d ? (h = m.queries.childWorkflows(d), p[0] = m.queries, p[1] = d, p[2] = h) : h = p[2];
36
+ let g = !!d && (f?.enabled ?? !0), _;
37
+ return p[3] !== f || p[4] !== h || p[5] !== g ? (_ = {
38
+ ...h,
39
+ ...f,
40
+ enabled: g
41
+ }, p[3] = f, p[4] = h, p[5] = g, p[6] = _) : _ = p[6], useQuery(_);
42
+ }
43
+ function useWorkflowCheckpoints(d, f) {
44
+ let p = c(7), m = useLoopstackClient(), h;
45
+ p[0] !== m.queries || p[1] !== d ? (h = m.queries.workflowCheckpoints(d), p[0] = m.queries, p[1] = d, p[2] = h) : h = p[2];
46
+ let g = !!d && (f?.enabled ?? !0), _;
47
+ return p[3] !== f || p[4] !== h || p[5] !== g ? (_ = {
48
+ ...h,
49
+ ...f,
50
+ enabled: g
51
+ }, p[3] = f, p[4] = h, p[5] = g, p[6] = _) : _ = p[6], useQuery(_);
52
+ }
53
+ function useWorkflowDocuments(d, f) {
54
+ let p = c(7), m = useLoopstackClient(), h;
55
+ p[0] !== m.queries || p[1] !== d ? (h = m.queries.documents(d), p[0] = m.queries, p[1] = d, p[2] = h) : h = p[2];
56
+ let g = !!d && (f?.enabled ?? !0), _;
57
+ return p[3] !== f || p[4] !== h || p[5] !== g ? (_ = {
58
+ ...h,
59
+ ...f,
60
+ enabled: g
61
+ }, p[3] = f, p[4] = h, p[5] = g, p[6] = _) : _ = p[6], useQuery(_);
62
+ }
63
+ function useWorkspace(d, f) {
64
+ let p = c(7), m = useLoopstackClient(), h;
65
+ p[0] !== m.queries || p[1] !== d ? (h = m.queries.workspace(d), p[0] = m.queries, p[1] = d, p[2] = h) : h = p[2];
66
+ let g = !!d && (f?.enabled ?? !0), _;
67
+ return p[3] !== f || p[4] !== h || p[5] !== g ? (_ = {
68
+ ...h,
69
+ ...f,
70
+ enabled: g
71
+ }, p[3] = f, p[4] = h, p[5] = g, p[6] = _) : _ = p[6], useQuery(_);
72
+ }
73
+ function useWorkspaceList(d, f) {
74
+ let p = c(6), m = useLoopstackClient(), h;
75
+ p[0] !== m.queries || p[1] !== d ? (h = m.queries.workspaceList(d), p[0] = m.queries, p[1] = d, p[2] = h) : h = p[2];
76
+ let g;
77
+ return p[3] !== f || p[4] !== h ? (g = {
78
+ ...h,
79
+ ...f
80
+ }, p[3] = f, p[4] = h, p[5] = g) : g = p[5], useQuery(g);
81
+ }
82
+ function useAppsConfig(d) {
83
+ let f = c(5), p = useLoopstackClient(), m;
84
+ f[0] === p.queries ? m = f[1] : (m = p.queries.apps(), f[0] = p.queries, f[1] = m);
85
+ let h;
86
+ return f[2] !== d || f[3] !== m ? (h = {
87
+ ...m,
88
+ ...d
89
+ }, f[2] = d, f[3] = m, f[4] = h) : h = f[4], useQuery(h);
90
+ }
91
+ function useWorkflowConfig(d, f) {
92
+ let p = c(7), m = useLoopstackClient(), h;
93
+ p[0] !== m.queries || p[1] !== d ? (h = m.queries.workflowConfig(d), p[0] = m.queries, p[1] = d, p[2] = h) : h = p[2];
94
+ let g = !!d && (f?.enabled ?? !0), _;
95
+ return p[3] !== f || p[4] !== h || p[5] !== g ? (_ = {
96
+ ...h,
97
+ ...f,
98
+ enabled: g
99
+ }, p[3] = f, p[4] = h, p[5] = g, p[6] = _) : _ = p[6], useQuery(_);
100
+ }
101
+ function useWorkflowSource(d, f) {
102
+ let p = c(7), m = useLoopstackClient(), h;
103
+ p[0] !== m.queries || p[1] !== d ? (h = m.queries.workflowSource(d), p[0] = m.queries, p[1] = d, p[2] = h) : h = p[2];
104
+ let g = !!d && (f?.enabled ?? !0), _;
105
+ return p[3] !== f || p[4] !== h || p[5] !== g ? (_ = {
106
+ ...h,
107
+ ...f,
108
+ enabled: g
109
+ }, p[3] = f, p[4] = h, p[5] = g, p[6] = _) : _ = p[6], useQuery(_);
110
+ }
111
+ function useAvailableEnvironments(d) {
112
+ let f = c(5), p = useLoopstackClient(), m;
113
+ f[0] === p.queries ? m = f[1] : (m = p.queries.availableEnvironments(), f[0] = p.queries, f[1] = m);
114
+ let h;
115
+ return f[2] !== d || f[3] !== m ? (h = {
116
+ ...m,
117
+ ...d
118
+ }, f[2] = d, f[3] = m, f[4] = h) : h = f[4], useQuery(h);
119
+ }
120
+ function useMe(d) {
121
+ let f = c(5), p = useLoopstackClient(), m;
122
+ f[0] === p.queries ? m = f[1] : (m = p.queries.me(), f[0] = p.queries, f[1] = m);
123
+ let h;
124
+ return f[2] !== d || f[3] !== m ? (h = {
125
+ ...m,
126
+ retry: !1,
127
+ ...d
128
+ }, f[2] = d, f[3] = m, f[4] = h) : h = f[4], useQuery(h);
129
+ }
130
+ function useWorkerHealth(d) {
131
+ let f = c(5), p = useLoopstackClient(), m;
132
+ f[0] === p.queries ? m = f[1] : (m = p.queries.workerHealth(), f[0] = p.queries, f[1] = m);
133
+ let h;
134
+ return f[2] !== d || f[3] !== m ? (h = {
135
+ ...m,
136
+ ...d
137
+ }, f[2] = d, f[3] = m, f[4] = h) : h = f[4], useQuery(h);
138
+ }
139
+ export { useAppsConfig, useAvailableEnvironments, useChildWorkflows, useMe, useWorkerHealth, useWorkflow, useWorkflowCheckpoints, useWorkflowConfig, useWorkflowDocuments, useWorkflowList, useWorkflowSource, useWorkflowStatus, useWorkspace, useWorkspaceList };
@@ -0,0 +1,39 @@
1
+ import { useLoopstackClient } from "../provider.js";
2
+ import { resolveInvalidations } from "../../../client/dist/stream/invalidations.js";
3
+ import "../../../client/dist/index.js";
4
+ import { c } from "react/compiler-runtime";
5
+ import { useEffect } from "react";
6
+ import { useQueryClient } from "@tanstack/react-query";
7
+ function useLiveInvalidation(a) {
8
+ let o = c(11), s;
9
+ o[0] === a ? s = o[1] : (s = a === void 0 ? {} : a, o[0] = a, o[1] = s);
10
+ let l = s, u = useLoopstackClient(), d = useQueryClient(), f = l.debounceMs ?? 300, p;
11
+ o[2] !== u.envKey || o[3] !== u.stream || o[4] !== f || o[5] !== d ? (p = () => {
12
+ let e = /* @__PURE__ */ new Map(), r = (n) => {
13
+ let r = JSON.stringify(n), i = e.get(r);
14
+ i && clearTimeout(i), e.set(r, setTimeout(() => {
15
+ e.delete(r), d.invalidateQueries({ queryKey: n });
16
+ }, f));
17
+ }, i = u.stream.onAny((e) => {
18
+ if ("userId" in e) {
19
+ if (e.type === "stream.reset") {
20
+ d.invalidateQueries({ predicate: (e) => e.queryKey[1] === u.envKey });
21
+ return;
22
+ }
23
+ for (let i of resolveInvalidations(e, u.envKey)) r(i);
24
+ }
25
+ });
26
+ return () => {
27
+ i();
28
+ for (let n of e.values()) clearTimeout(n);
29
+ e.clear();
30
+ };
31
+ }, o[2] = u.envKey, o[3] = u.stream, o[4] = f, o[5] = d, o[6] = p) : p = o[6];
32
+ let m;
33
+ o[7] !== u || o[8] !== f || o[9] !== d ? (m = [
34
+ u,
35
+ d,
36
+ f
37
+ ], o[7] = u, o[8] = f, o[9] = d, o[10] = m) : m = o[10], useEffect(p, m);
38
+ }
39
+ export { useLiveInvalidation };
@@ -0,0 +1,18 @@
1
+ import { useLoopstackClient } from "../provider.js";
2
+ import { isLlmResponseEvent } from "../../../contracts/dist/events/client-message.schema.js";
3
+ import "../../../contracts/dist/events/index.js";
4
+ import { reduceLlmStream } from "../../../client/dist/stream/llm-reducer.js";
5
+ import "../../../client/dist/index.js";
6
+ import { c } from "react/compiler-runtime";
7
+ import { useEffect, useState } from "react";
8
+ function useLlmStream(o) {
9
+ let s = c(5), l = useLoopstackClient(), u;
10
+ s[0] === Symbol.for("react.memo_cache_sentinel") ? (u = {}, s[0] = u) : u = s[0];
11
+ let [d, f] = useState(u), p, m;
12
+ return s[1] !== l || s[2] !== o ? (p = () => {
13
+ if (f({}), o) return l.stream.onAny((e) => {
14
+ "userId" in e && isLlmResponseEvent(e) && e.workflowId === o && f((a) => reduceLlmStream(a, e));
15
+ });
16
+ }, m = [l, o], s[1] = l, s[2] = o, s[3] = p, s[4] = m) : (p = s[3], m = s[4]), useEffect(p, m), d;
17
+ }
18
+ export { useLlmStream };
@@ -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";