@loopstack/loopstack-studio 0.37.0 → 0.38.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.
@@ -15,85 +15,87 @@ import "../oauth/index.js";
15
15
  import ChoicesRenderer_default from "./renderers/ChoicesRenderer.js";
16
16
  import ConfirmPromptRenderer_default from "./renderers/ConfirmPromptRenderer.js";
17
17
  import LinkMessageRenderer_default from "./renderers/LinkMessageRenderer.js";
18
+ import TerminalMessageRenderer_default from "./renderers/TerminalMessageRenderer.js";
18
19
  import TextPromptRenderer_default from "./renderers/TextPromptRenderer.js";
19
20
  import { c } from "react/compiler-runtime";
20
21
  import React, { useMemo } from "react";
21
22
  import { Fragment as Fragment$1, jsx } from "react/jsx-runtime";
22
23
  var coreRendererRegistry = new Map([
23
- ["ai-message", ({ document: e, isLastItem: g }) => /* @__PURE__ */ jsx(AiMessage_default, {
24
+ ["ai-message", ({ document: e, isLastItem: _ }) => /* @__PURE__ */ jsx(AiMessage_default, {
24
25
  document: e,
25
- isLastItem: g
26
+ isLastItem: _
26
27
  })],
27
- ["llm-message", ({ document: e, isLastItem: g }) => /* @__PURE__ */ jsx(LlmMessage_default, {
28
+ ["llm-message", ({ document: e, isLastItem: _ }) => /* @__PURE__ */ jsx(LlmMessage_default, {
28
29
  document: e,
29
- isLastItem: g
30
+ isLastItem: _
30
31
  })],
31
32
  ["debug", ({ document: e }) => /* @__PURE__ */ jsx("div", {
32
33
  className: "mb-4 flex",
33
34
  children: /* @__PURE__ */ jsx(DocumentDebugRenderer_default, { document: e })
34
35
  })],
35
- ["form", ({ parentWorkflow: e, workflow: _, document: v, isActive: y }) => /* @__PURE__ */ jsx(CompletionMessagePaper_default, {
36
+ ["form", ({ parentWorkflow: e, workflow: v, document: y, isActive: b }) => /* @__PURE__ */ jsx(CompletionMessagePaper_default, {
36
37
  role: "document",
37
38
  fullWidth: !0,
38
- timestamp: new Date(v.createdAt),
39
+ timestamp: new Date(y.createdAt),
39
40
  children: /* @__PURE__ */ jsx(DocumentFormRenderer_default, {
40
41
  parentWorkflow: e,
41
- workflow: _,
42
- document: v,
43
- enabled: y,
44
- viewOnly: !y
42
+ workflow: v,
43
+ document: y,
44
+ enabled: b,
45
+ viewOnly: !b
45
46
  })
46
47
  })],
47
48
  ["message", ({ document: e }) => /* @__PURE__ */ jsx(DocumentMessageRenderer_default, { document: e })],
48
49
  ["error", ({ document: e }) => /* @__PURE__ */ jsx(ErrorMessageRenderer_default, { document: e })],
49
50
  ["plain", ({ document: e }) => /* @__PURE__ */ jsx(PlainMessageRenderer_default, { document: e })],
50
51
  ["markdown", ({ document: e }) => /* @__PURE__ */ jsx(MarkdownMessageRenderer_default, { document: e })],
51
- ["link", ({ workflow: e, document: g }) => /* @__PURE__ */ jsx(LinkMessageRenderer_default, {
52
+ ["terminal", ({ document: e }) => /* @__PURE__ */ jsx(TerminalMessageRenderer_default, { document: e })],
53
+ ["link", ({ workflow: e, document: _ }) => /* @__PURE__ */ jsx(LinkMessageRenderer_default, {
52
54
  workflow: e,
53
- document: g
55
+ document: _
54
56
  })],
55
- ["oauth-prompt", ({ parentWorkflow: e, workflow: g, document: _, isActive: v }) => /* @__PURE__ */ jsx(OAuthPromptRenderer_default, {
57
+ ["oauth-prompt", ({ parentWorkflow: e, workflow: _, document: v, isActive: y }) => /* @__PURE__ */ jsx(OAuthPromptRenderer_default, {
56
58
  parentWorkflow: e,
57
- workflow: g,
58
- document: _,
59
- isActive: v
59
+ workflow: _,
60
+ document: v,
61
+ isActive: y
60
62
  })],
61
- ["text-prompt", ({ parentWorkflow: e, workflow: g, document: _, isActive: v }) => /* @__PURE__ */ jsx(TextPromptRenderer_default, {
63
+ ["text-prompt", ({ parentWorkflow: e, workflow: _, document: v, isActive: y }) => /* @__PURE__ */ jsx(TextPromptRenderer_default, {
62
64
  parentWorkflow: e,
63
- workflow: g,
64
- document: _,
65
- isActive: v
65
+ workflow: _,
66
+ document: v,
67
+ isActive: y
66
68
  })],
67
- ["choices", ({ parentWorkflow: e, workflow: g, document: _, isActive: v }) => /* @__PURE__ */ jsx(ChoicesRenderer_default, {
69
+ ["choices", ({ parentWorkflow: e, workflow: _, document: v, isActive: y }) => /* @__PURE__ */ jsx(ChoicesRenderer_default, {
68
70
  parentWorkflow: e,
69
- workflow: g,
70
- document: _,
71
- isActive: v
71
+ workflow: _,
72
+ document: v,
73
+ isActive: y
72
74
  })],
73
- ["confirm-prompt", ({ parentWorkflow: e, workflow: g, document: _, isActive: v }) => /* @__PURE__ */ jsx(ConfirmPromptRenderer_default, {
75
+ ["confirm-prompt", ({ parentWorkflow: e, workflow: _, document: v, isActive: y }) => /* @__PURE__ */ jsx(ConfirmPromptRenderer_default, {
74
76
  parentWorkflow: e,
75
- workflow: g,
76
- document: _,
77
- isActive: v
77
+ workflow: _,
78
+ document: v,
79
+ isActive: y
78
80
  })]
79
81
  ]);
80
82
  function resolveWidgetName(e) {
81
- let g = e;
82
- return g?.widgets?.[0]?.widget ? g.widgets[0].widget : g?.form?.widget ? g.form.widget : "form";
83
+ let _ = e;
84
+ return _?.widgets?.[0]?.widget ? _.widgets[0].widget : _?.form?.widget ? _.form.widget : "form";
83
85
  }
84
- var DocumentRenderer_default = (g) => {
85
- let v = c(9), y = useFeatureRegistry(), b = useDocumentConfigs(), x = g.document, S;
86
- if (v[0] !== x.documentName || v[1] !== b || v[2] !== y) {
87
- let e = resolveWidgetName(b.get(x.documentName)?.ui), g;
88
- if (v[4] !== y) {
89
- g = /* @__PURE__ */ new Map();
90
- for (let e of y) if (e.documentRenderers) for (let [_, v] of Object.entries(e.documentRenderers)) g.set(_, v);
91
- v[4] = y, v[5] = g;
92
- } else g = v[5];
93
- let _ = g;
94
- S = coreRendererRegistry.get(e) ?? _.get(e), v[0] = x.documentName, v[1] = b, v[2] = y, v[3] = S;
95
- } else S = v[3];
96
- let C = S, w;
97
- return v[6] !== C || v[7] !== g ? (w = /* @__PURE__ */ jsx("div", { children: C ? /* @__PURE__ */ jsx(C, { ...g }) : /* @__PURE__ */ jsx(Fragment$1, { children: "unknown document type" }) }), v[6] = C, v[7] = g, v[8] = w) : w = v[8], w;
86
+ var DocumentRenderer_default = (_) => {
87
+ let y = c(9), b = useFeatureRegistry(), x = useDocumentConfigs(), S = _.document, C;
88
+ if (y[0] !== S.documentName || y[1] !== x || y[2] !== b) {
89
+ let e = resolveWidgetName(x.get(S.documentName)?.ui), _;
90
+ if (y[4] !== b) {
91
+ _ = /* @__PURE__ */ new Map();
92
+ for (let e of b) if (e.documentRenderers) for (let [v, y] of Object.entries(e.documentRenderers)) _.set(v, y);
93
+ y[4] = b, y[5] = _;
94
+ } else _ = y[5];
95
+ let v = _;
96
+ C = coreRendererRegistry.get(e) ?? v.get(e), y[0] = S.documentName, y[1] = x, y[2] = b, y[3] = C;
97
+ } else C = y[3];
98
+ let w = C, T;
99
+ return y[6] !== w || y[7] !== _ ? (T = /* @__PURE__ */ jsx("div", { children: w ? /* @__PURE__ */ jsx(w, { ..._ }) : /* @__PURE__ */ jsx(Fragment$1, { children: "unknown document type" }) }), y[6] = w, y[7] = _, y[8] = T) : T = y[8], T;
98
100
  };
99
101
  export { DocumentRenderer_default as default };
@@ -0,0 +1,51 @@
1
+ import { parseAnsi } from "./ansi.js";
2
+ import { c } from "react/compiler-runtime";
3
+ import React, { useEffect, useMemo, useRef } from "react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ var TerminalMessageRenderer_default = (s) => {
6
+ let l = c(14), { document: u } = s, { text: d, title: f } = u.content, p = d ?? "", m;
7
+ l[0] === p ? m = l[1] : (m = parseAnsi(p), l[0] = p, l[1] = m);
8
+ let h = m, g = useRef(null), _;
9
+ l[2] === Symbol.for("react.memo_cache_sentinel") ? (_ = () => {
10
+ let e = g.current;
11
+ e && (e.scrollTop = e.scrollHeight);
12
+ }, l[2] = _) : _ = l[2];
13
+ let v;
14
+ l[3] === d ? v = l[4] : (v = [d], l[3] = d, l[4] = v), useEffect(_, v);
15
+ let y;
16
+ l[5] === f ? y = l[6] : (y = f && /* @__PURE__ */ jsxs("div", {
17
+ className: "flex items-center gap-2 border-b border-white/10 px-3 py-1.5",
18
+ children: [/* @__PURE__ */ jsxs("span", {
19
+ className: "flex gap-1.5",
20
+ "aria-hidden": !0,
21
+ children: [
22
+ /* @__PURE__ */ jsx("span", { className: "h-2.5 w-2.5 rounded-full bg-[#ff5f56]" }),
23
+ /* @__PURE__ */ jsx("span", { className: "h-2.5 w-2.5 rounded-full bg-[#ffbd2e]" }),
24
+ /* @__PURE__ */ jsx("span", { className: "h-2.5 w-2.5 rounded-full bg-[#27c93f]" })
25
+ ]
26
+ }), /* @__PURE__ */ jsx("span", {
27
+ className: "font-mono text-xs text-white/60",
28
+ children: f
29
+ })]
30
+ }), l[5] = f, l[6] = y);
31
+ let b;
32
+ l[7] === h ? b = l[8] : (b = h.map(_temp), l[7] = h, l[8] = b);
33
+ let x;
34
+ l[9] === b ? x = l[10] : (x = /* @__PURE__ */ jsx("pre", {
35
+ ref: g,
36
+ className: "max-h-96 overflow-auto px-3 py-2 font-mono text-xs leading-relaxed whitespace-pre-wrap text-[#d4d4d4]",
37
+ children: b
38
+ }), l[9] = b, l[10] = x);
39
+ let S;
40
+ return l[11] !== y || l[12] !== x ? (S = /* @__PURE__ */ jsxs("div", {
41
+ className: "mb-4 overflow-hidden rounded-lg border border-black/30 bg-[#1e1e1e] shadow-sm",
42
+ children: [y, x]
43
+ }), l[11] = y, l[12] = x, l[13] = S) : S = l[13], S;
44
+ };
45
+ function _temp(e, o) {
46
+ return /* @__PURE__ */ jsx("span", {
47
+ style: e.style,
48
+ children: e.text
49
+ }, o);
50
+ }
51
+ export { TerminalMessageRenderer_default as default };
@@ -0,0 +1,77 @@
1
+ var PALETTE_16 = [
2
+ "#000000",
3
+ "#cd3131",
4
+ "#0dbc79",
5
+ "#e5e510",
6
+ "#2472c8",
7
+ "#bc3fbc",
8
+ "#11a8cd",
9
+ "#e5e5e5",
10
+ "#666666",
11
+ "#f14c4c",
12
+ "#23d18b",
13
+ "#f5f543",
14
+ "#3b8eea",
15
+ "#d670d6",
16
+ "#29b8db",
17
+ "#ffffff"
18
+ ], CUBE_STEPS = [
19
+ 0,
20
+ 95,
21
+ 135,
22
+ 175,
23
+ 215,
24
+ 255
25
+ ];
26
+ function xterm256ToHex(n) {
27
+ if (n < 16) return PALETTE_16[n];
28
+ if (n <= 231) {
29
+ let e = n - 16;
30
+ return `rgb(${CUBE_STEPS[Math.floor(e / 36) % 6]}, ${CUBE_STEPS[Math.floor(e / 6) % 6]}, ${CUBE_STEPS[e % 6]})`;
31
+ }
32
+ let r = 8 + (n - 232) * 10;
33
+ return `rgb(${r}, ${r}, ${r})`;
34
+ }
35
+ function apply(t, r) {
36
+ for (let i = 0; i < r.length; i++) {
37
+ let a = r[i];
38
+ if (a === 0) t.fg = t.bg = void 0, t.bold = t.dim = t.italic = t.underline = !1;
39
+ else if (a === 1) t.bold = !0;
40
+ else if (a === 2) t.dim = !0;
41
+ else if (a === 3) t.italic = !0;
42
+ else if (a === 4) t.underline = !0;
43
+ else if (a === 22) t.bold = t.dim = !1;
44
+ else if (a === 23) t.italic = !1;
45
+ else if (a === 24) t.underline = !1;
46
+ else if (a >= 30 && a <= 37) t.fg = PALETTE_16[a - 30];
47
+ else if (a >= 90 && a <= 97) t.fg = PALETTE_16[a - 90 + 8];
48
+ else if (a === 39) t.fg = void 0;
49
+ else if (a >= 40 && a <= 47) t.bg = PALETTE_16[a - 40];
50
+ else if (a >= 100 && a <= 107) t.bg = PALETTE_16[a - 100 + 8];
51
+ else if (a === 49) t.bg = void 0;
52
+ else if (a === 38 || a === 48) {
53
+ let e = a === 38 ? "fg" : "bg";
54
+ r[i + 1] === 5 ? (t[e] = xterm256ToHex(r[i + 2]), i += 2) : r[i + 1] === 2 && (t[e] = `rgb(${r[i + 2]}, ${r[i + 3]}, ${r[i + 4]})`, i += 4);
55
+ }
56
+ }
57
+ }
58
+ function toStyle(t) {
59
+ let n = {}, r = t.fg;
60
+ if (t.bold && r) {
61
+ let t = PALETTE_16.indexOf(r);
62
+ t >= 0 && t < 8 && (r = PALETTE_16[t + 8]);
63
+ }
64
+ return r && (n.color = r), t.bg && (n.backgroundColor = t.bg), t.bold && (n.fontWeight = 700), t.dim && (n.opacity = .6), t.italic && (n.fontStyle = "italic"), t.underline && (n.textDecoration = "underline"), n;
65
+ }
66
+ var SGR = /\x1b\[([0-9;]*)m/g;
67
+ function parseAnsi(e) {
68
+ let t = [], n = {}, o = 0, s, c = (e) => {
69
+ e && t.push({
70
+ text: e,
71
+ style: toStyle(n)
72
+ });
73
+ };
74
+ for (SGR.lastIndex = 0; (s = SGR.exec(e)) !== null;) c(e.slice(o, s.index)), apply(n, s[1] === "" ? [0] : s[1].split(";").map((e) => Number(e) || 0)), o = SGR.lastIndex;
75
+ return c(e.slice(o)), t;
76
+ }
77
+ export { parseAnsi };
@@ -5,7 +5,7 @@ import { BareWaitCard, FailedRunCard, NotSupportedCard } from "./prompts/cards.j
5
5
  import { Transcript } from "./Transcript.js";
6
6
  import { SandboxRunButton } from "./prompts/SandboxRunButton.js";
7
7
  import { promptRegistry } from "./prompts/registry.js";
8
- import { composeTranscript } from "./transcript.js";
8
+ import { composeTranscript } from "./transcript-model.js";
9
9
  import { useRunPrompts } from "./useRunPrompts.js";
10
10
  import { useRunTree } from "./useRunTree.js";
11
11
  import { useStreamingNodes } from "./useTreeLlmStreams.js";
@@ -136,6 +136,6 @@ function _temp2(e) {
136
136
  }, e.slotId);
137
137
  }
138
138
  function _temp(e) {
139
- return !!e.connectionUrl && (!!e.workerId || e.local);
139
+ return !!e.connectionUrl && (!!e.workerId || e.local) && e.status === "running";
140
140
  }
141
141
  export { WorkbenchPreviewPanel };
@@ -73,7 +73,7 @@ function WorkbenchLayoutProvider(u) {
73
73
  }), d[36] = f, d[37] = J, d[38] = Y) : Y = d[38], Y;
74
74
  }
75
75
  function _temp2(e) {
76
- return !!e.connectionUrl && (!!e.workerId || e.local);
76
+ return !!e.connectionUrl && (!!e.workerId || e.local) && e.status === "running";
77
77
  }
78
78
  function _temp(e) {
79
79
  return e.status === "running";
@@ -1,43 +1,37 @@
1
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";
2
4
  import "../packages/react/dist/index.js";
3
5
  import { c } from "react/compiler-runtime";
4
6
  import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
5
7
  var environmentsPath = (e) => `/api/v1/workspaces/${e}/environments`;
6
- function useWorkspaceEnvironments(r) {
7
- let a = c(10), o = useLoopstackClient(), s;
8
- a[0] !== o.envKey || a[1] !== r ? (s = [
9
- "workspace-environments",
10
- o.envKey,
11
- r
12
- ], a[0] = o.envKey, a[1] = r, a[2] = s) : s = a[2];
13
- let l;
14
- a[3] !== o.http || a[4] !== r ? (l = () => o.http.get(environmentsPath(r)), a[3] = o.http, a[4] = r, a[5] = l) : l = a[5];
15
- let u = !!r, d;
16
- return a[6] !== s || a[7] !== l || a[8] !== u ? (d = {
17
- queryKey: s,
18
- queryFn: l,
19
- enabled: u
20
- }, a[6] = s, a[7] = l, a[8] = u, a[9] = d) : d = a[9], useQuery(d);
8
+ function useWorkspaceEnvironments(i) {
9
+ let o = c(10), s = useLoopstackClient(), l;
10
+ o[0] !== s.envKey || o[1] !== i ? (l = queryKeys.environments(s.envKey, i), o[0] = s.envKey, o[1] = i, o[2] = l) : l = o[2];
11
+ let u;
12
+ o[3] !== s.http || o[4] !== i ? (u = () => s.http.get(environmentsPath(i)), o[3] = s.http, o[4] = i, o[5] = u) : u = o[5];
13
+ let d = !!i, f;
14
+ return o[6] !== l || o[7] !== u || o[8] !== d ? (f = {
15
+ queryKey: l,
16
+ queryFn: u,
17
+ enabled: d
18
+ }, o[6] = l, o[7] = u, o[8] = d, o[9] = f) : f = o[9], useQuery(f);
21
19
  }
22
20
  function useReplaceEnvironments() {
23
- let i = c(8), o = useLoopstackClient(), s = useQueryClient(), l;
24
- i[0] === o ? l = i[1] : (l = (e) => o.http.put(environmentsPath(e.workspaceId), e.environments), i[0] = o, i[1] = l);
25
- let u;
26
- i[2] !== o || i[3] !== s ? (u = (e, n) => {
27
- s.invalidateQueries({ queryKey: [
28
- "workspace-environments",
29
- o.envKey,
30
- n.workspaceId
31
- ] });
32
- }, i[2] = o, i[3] = s, i[4] = u) : u = i[4];
21
+ let a = c(8), s = useLoopstackClient(), l = useQueryClient(), u;
22
+ a[0] === s ? u = a[1] : (u = (e) => s.http.put(environmentsPath(e.workspaceId), e.environments), a[0] = s, a[1] = u);
33
23
  let d;
34
- return i[5] !== l || i[6] !== u ? (d = {
35
- mutationFn: l,
36
- onSuccess: u
37
- }, i[5] = l, i[6] = u, i[7] = d) : d = i[7], useMutation(d);
24
+ a[2] !== s || a[3] !== l ? (d = (e, r) => {
25
+ l.invalidateQueries({ queryKey: queryKeys.environments(s.envKey, r.workspaceId) });
26
+ }, a[2] = s, a[3] = l, a[4] = d) : d = a[4];
27
+ let f;
28
+ return a[5] !== u || a[6] !== d ? (f = {
29
+ mutationFn: u,
30
+ onSuccess: d
31
+ }, a[5] = u, a[6] = d, a[7] = f) : f = a[7], useMutation(f);
38
32
  }
39
33
  function useResetEnvironment() {
40
- let i = c(2), a = useLoopstackClient(), o;
41
- return i[0] === a ? o = i[1] : (o = { mutationFn: (e) => a.http.post(`${environmentsPath(e.workspaceId)}/${e.slotId}/reset`) }, i[0] = a, i[1] = o), useMutation(o);
34
+ let n = c(2), a = useLoopstackClient(), o;
35
+ return n[0] === a ? o = n[1] : (o = { mutationFn: (e) => a.http.post(`${environmentsPath(e.workspaceId)}/${e.slotId}/reset`) }, n[0] = a, n[1] = o), useMutation(o);
42
36
  }
43
37
  export { useReplaceEnvironments, useResetEnvironment, useWorkspaceEnvironments };
@@ -1,4 +1,4 @@
1
1
  var globalThis_ = typeof globalThis == "object" && globalThis || typeof window == "object" && window || typeof self == "object" && self || typeof global == "object" && global || (function() {
2
2
  return this;
3
- })() || Function("return this")();
3
+ })();
4
4
  export { globalThis_ };
@@ -1,7 +1,7 @@
1
- import { isPrimitive } from "../../predicate/isPrimitive.js";
1
+ import { isArray } from "../predicate/isArray.js";
2
2
  import { getTag } from "../_internal/getTag.js";
3
3
  import { argumentsTag, arrayBufferTag, arrayTag, booleanTag, dataViewTag, dateTag, float32ArrayTag, float64ArrayTag, int16ArrayTag, int32ArrayTag, int8ArrayTag, mapTag, numberTag, objectTag, regexpTag, setTag, stringTag, symbolTag, uint16ArrayTag, uint32ArrayTag, uint8ArrayTag, uint8ClampedArrayTag } from "../_internal/tags.js";
4
- import { isArray } from "../predicate/isArray.js";
4
+ import { isPrimitive } from "../../predicate/isPrimitive.js";
5
5
  import { isTypedArray } from "../predicate/isTypedArray.js";
6
6
  function clone(D) {
7
7
  if (isPrimitive(D)) return D;
@@ -1,25 +1,25 @@
1
1
  import { getTag } from "../_internal/getTag.js";
2
- import { argumentsTag, booleanTag, numberTag, objectTag, stringTag } from "../_internal/tags.js";
2
+ import { argumentsTag, booleanTag, numberTag, stringTag } from "../_internal/tags.js";
3
3
  import { cloneDeepWith, copyProperties } from "../../object/cloneDeepWith.js";
4
- function cloneDeepWith$1(o, c) {
5
- return cloneDeepWith(o, (s, l, u, d) => {
6
- let f = c?.(s, l, u, d);
4
+ function cloneDeepWith$1(s, c) {
5
+ return cloneDeepWith(s, (o, l, u, d) => {
6
+ let f = c?.(o, l, u, d);
7
7
  if (f !== void 0) return f;
8
- if (typeof o == "object") {
9
- if (getTag(o) === "[object Object]" && typeof o.constructor != "function") {
8
+ if (typeof s == "object") {
9
+ if (getTag(s) === "[object Object]" && typeof s.constructor != "function") {
10
10
  let e = {};
11
- return d.set(o, e), copyProperties(e, o, u, d), e;
11
+ return d.set(s, e), copyProperties(e, s, u, d), e;
12
12
  }
13
- switch (Object.prototype.toString.call(o)) {
13
+ switch (Object.prototype.toString.call(s)) {
14
14
  case numberTag:
15
15
  case stringTag:
16
16
  case booleanTag: {
17
- let e = new o.constructor(o?.valueOf());
18
- return copyProperties(e, o), e;
17
+ let e = new s.constructor(s?.valueOf());
18
+ return copyProperties(e, s), e;
19
19
  }
20
20
  case argumentsTag: {
21
21
  let e = {};
22
- return copyProperties(e, o), e.length = o.length, e[Symbol.iterator] = o[Symbol.iterator], e;
22
+ return copyProperties(e, s), e.length = s.length, e[Symbol.iterator] = s[Symbol.iterator], e;
23
23
  }
24
24
  default: return;
25
25
  }
@@ -1,13 +1,13 @@
1
- import { isUnsafeProperty } from "../../_internal/isUnsafeProperty.js";
2
- import { isPrimitive } from "../../predicate/isPrimitive.js";
1
+ import { isPlainObject } from "../predicate/isPlainObject.js";
3
2
  import { getSymbols } from "../_internal/getSymbols.js";
4
3
  import { isBuffer } from "../../predicate/isBuffer.js";
4
+ import { isUnsafeProperty } from "../../_internal/isUnsafeProperty.js";
5
+ import { isPrimitive } from "../../predicate/isPrimitive.js";
5
6
  import { cloneDeep } from "./cloneDeep.js";
6
7
  import { isArguments } from "../predicate/isArguments.js";
7
8
  import { isObjectLike } from "../predicate/isObjectLike.js";
8
9
  import { isArrayLikeObject } from "../predicate/isArrayLikeObject.js";
9
10
  import { isTypedArray } from "../predicate/isTypedArray.js";
10
- import { isPlainObject } from "../predicate/isPlainObject.js";
11
11
  import { clone } from "../../object/clone.js";
12
12
  function mergeWith(e, ...s) {
13
13
  let c = s.slice(0, -1), l = s[s.length - 1], u = e;
@@ -26,9 +26,9 @@ function mergeWithDeep(f, p, m, h) {
26
26
  }
27
27
  let g = [...Object.keys(p), ...getSymbols(p)];
28
28
  for (let s = 0; s < g.length; s++) {
29
- let c = g[s];
30
- if (isUnsafeProperty(c)) continue;
31
- let d = p[c], _ = f[c];
29
+ let u = g[s];
30
+ if (isUnsafeProperty(u)) continue;
31
+ let d = p[u], _ = f[u];
32
32
  if (isArguments(d) && (d = { ...d }), isArguments(_) && (_ = { ..._ }), isBuffer(d) && (d = cloneDeep(d)), Array.isArray(d)) if (Array.isArray(_)) {
33
33
  let e = [], s = Reflect.ownKeys(_);
34
34
  for (let c = 0; c < s.length; c++) {
@@ -41,8 +41,8 @@ function mergeWithDeep(f, p, m, h) {
41
41
  for (let s = 0; s < _.length; s++) e[s] = _[s];
42
42
  _ = e;
43
43
  } else _ = [];
44
- let v = m(_, d, c, f, p, h);
45
- v === void 0 ? Array.isArray(d) || isObjectLike(_) && isObjectLike(d) && (isPlainObject(_) || isPlainObject(d) || isTypedArray(_) || isTypedArray(d)) ? f[c] = mergeWithDeep(_, d, m, h) : _ == null && isPlainObject(d) ? f[c] = mergeWithDeep({}, d, m, h) : _ == null && isTypedArray(d) ? f[c] = cloneDeep(d) : (_ === void 0 || d !== void 0) && (f[c] = d) : f[c] = v;
44
+ let v = m(_, d, u, f, p, h);
45
+ v === void 0 ? Array.isArray(d) || isObjectLike(_) && isObjectLike(d) && (isPlainObject(_) || isPlainObject(d) || isTypedArray(_) || isTypedArray(d)) ? f[u] = mergeWithDeep(_, d, m, h) : _ == null && isPlainObject(d) ? f[u] = mergeWithDeep({}, d, m, h) : _ == null && isTypedArray(d) ? f[u] = cloneDeep(d) : (_ === void 0 || d !== void 0) && (f[u] = d) : f[u] = v;
46
46
  }
47
47
  return f;
48
48
  }
@@ -1,12 +1,12 @@
1
- import { isArrayLike } from "./isArrayLike.js";
2
1
  import { isBuffer } from "../../predicate/isBuffer.js";
2
+ import { isArrayLike } from "./isArrayLike.js";
3
3
  import { isArguments } from "./isArguments.js";
4
- import { isPrototype } from "../_internal/isPrototype.js";
5
4
  import { isTypedArray } from "./isTypedArray.js";
5
+ import { isPrototype } from "../_internal/isPrototype.js";
6
6
  function isEmpty(a) {
7
7
  if (a == null) return !0;
8
8
  if (isArrayLike(a)) return typeof a.splice != "function" && typeof a != "string" && !isBuffer(a) && !isTypedArray(a) && !isArguments(a) ? !1 : a.length === 0;
9
- if (typeof a == "object") {
9
+ if (typeof a == "object" || typeof a == "function") {
10
10
  if (a instanceof Map || a instanceof Set) return a.size === 0;
11
11
  let e = Object.keys(a);
12
12
  return isPrototype(a) ? e.filter((e) => e !== "constructor").length === 0 : e.length === 0;
@@ -16,14 +16,9 @@ function clone(n) {
16
16
  let e;
17
17
  return e = n instanceof AggregateError ? new i(n.errors, n.message, { cause: n.cause }) : new i(n.message, { cause: n.cause }), e.stack = n.stack, Object.assign(e, n), e;
18
18
  }
19
- if (typeof File < "u" && n instanceof File) return new i([n], n.name, {
19
+ return typeof File < "u" && n instanceof File ? new i([n], n.name, {
20
20
  type: n.type,
21
21
  lastModified: n.lastModified
22
- });
23
- if (typeof n == "object") {
24
- let e = Object.create(r);
25
- return Object.assign(e, n);
26
- }
27
- return n;
22
+ }) : typeof n == "object" ? Object.assign(Object.create(r), n) : n;
28
23
  }
29
24
  export { clone };
@@ -1,91 +1,91 @@
1
- import { isPrimitive } from "../predicate/isPrimitive.js";
2
1
  import { getSymbols } from "../compat/_internal/getSymbols.js";
3
2
  import { getTag } from "../compat/_internal/getTag.js";
4
3
  import { argumentsTag, arrayBufferTag, arrayTag, booleanTag, dataViewTag, dateTag, float32ArrayTag, float64ArrayTag, int16ArrayTag, int32ArrayTag, int8ArrayTag, mapTag, numberTag, objectTag, regexpTag, setTag, stringTag, symbolTag, uint16ArrayTag, uint32ArrayTag, uint8ArrayTag, uint8ClampedArrayTag } from "../compat/_internal/tags.js";
5
4
  import { isBuffer } from "../predicate/isBuffer.js";
5
+ import { isPrimitive } from "../predicate/isPrimitive.js";
6
6
  import { isTypedArray } from "../predicate/isTypedArray.js";
7
- function cloneDeepWith(t, C) {
8
- return cloneDeepWithImpl(t, void 0, t, /* @__PURE__ */ new Map(), C);
7
+ function cloneDeepWith(e, C) {
8
+ return cloneDeepWithImpl(e, void 0, e, /* @__PURE__ */ new Map(), C);
9
9
  }
10
- function cloneDeepWithImpl(C, w, T, E = /* @__PURE__ */ new Map(), D = void 0) {
11
- let O = D?.(C, w, T, E);
12
- if (O !== void 0) return O;
13
- if (isPrimitive(C)) return C;
14
- if (E.has(C)) return E.get(C);
15
- if (Array.isArray(C)) {
16
- let t = Array(C.length);
17
- E.set(C, t);
18
- for (let w = 0; w < C.length; w++) t[w] = cloneDeepWithImpl(C[w], w, T, E, D);
19
- return Object.hasOwn(C, "index") && (t.index = C.index), Object.hasOwn(C, "input") && (t.input = C.input), t;
10
+ function cloneDeepWithImpl(e, C, w, T = /* @__PURE__ */ new Map(), E = void 0) {
11
+ let D = E?.(e, C, w, T);
12
+ if (D !== void 0) return D;
13
+ if (isPrimitive(e)) return e;
14
+ if (T.has(e)) return T.get(e);
15
+ if (Array.isArray(e)) {
16
+ let C = Array(e.length);
17
+ T.set(e, C);
18
+ for (let D = 0; D < e.length; D++) C[D] = cloneDeepWithImpl(e[D], D, w, T, E);
19
+ return Object.hasOwn(e, "index") && (C.index = e.index), Object.hasOwn(e, "input") && (C.input = e.input), C;
20
20
  }
21
- if (C instanceof Date) return new Date(C.getTime());
22
- if (C instanceof RegExp) {
23
- let t = new RegExp(C.source, C.flags);
24
- return t.lastIndex = C.lastIndex, t;
21
+ if (e instanceof Date) return new Date(e.getTime());
22
+ if (e instanceof RegExp) {
23
+ let C = new RegExp(e.source, e.flags);
24
+ return C.lastIndex = e.lastIndex, C;
25
25
  }
26
- if (C instanceof Map) {
27
- let t = /* @__PURE__ */ new Map();
28
- E.set(C, t);
29
- for (let [w, O] of C) t.set(w, cloneDeepWithImpl(O, w, T, E, D));
30
- return t;
26
+ if (e instanceof Map) {
27
+ let C = /* @__PURE__ */ new Map();
28
+ T.set(e, C);
29
+ for (let [D, O] of e) C.set(D, cloneDeepWithImpl(O, D, w, T, E));
30
+ return C;
31
31
  }
32
- if (C instanceof Set) {
33
- let t = /* @__PURE__ */ new Set();
34
- E.set(C, t);
35
- for (let w of C) t.add(cloneDeepWithImpl(w, void 0, T, E, D));
36
- return t;
32
+ if (e instanceof Set) {
33
+ let C = /* @__PURE__ */ new Set();
34
+ T.set(e, C);
35
+ for (let D of e) C.add(cloneDeepWithImpl(D, void 0, w, T, E));
36
+ return C;
37
37
  }
38
- if (isBuffer(C)) return C.subarray();
39
- if (isTypedArray(C)) {
40
- let t = new (Object.getPrototypeOf(C)).constructor(C.length);
41
- E.set(C, t);
42
- for (let w = 0; w < C.length; w++) t[w] = cloneDeepWithImpl(C[w], w, T, E, D);
43
- return t;
38
+ if (isBuffer(e)) return e.subarray();
39
+ if (isTypedArray(e)) {
40
+ let C = new (Object.getPrototypeOf(e)).constructor(e.length);
41
+ T.set(e, C);
42
+ for (let D = 0; D < e.length; D++) C[D] = cloneDeepWithImpl(e[D], D, w, T, E);
43
+ return C;
44
44
  }
45
- if (C instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && C instanceof SharedArrayBuffer) return C.slice(0);
46
- if (C instanceof DataView) {
47
- let t = new DataView(C.buffer.slice(0), C.byteOffset, C.byteLength);
48
- return E.set(C, t), copyProperties(t, C, T, E, D), t;
45
+ if (e instanceof ArrayBuffer || typeof SharedArrayBuffer < "u" && e instanceof SharedArrayBuffer) return e.slice(0);
46
+ if (e instanceof DataView) {
47
+ let C = new DataView(e.buffer.slice(0), e.byteOffset, e.byteLength);
48
+ return T.set(e, C), copyProperties(C, e, w, T, E), C;
49
49
  }
50
- if (typeof File < "u" && C instanceof File) {
51
- let t = new File([C], C.name, { type: C.type });
52
- return E.set(C, t), copyProperties(t, C, T, E, D), t;
50
+ if (typeof File < "u" && e instanceof File) {
51
+ let C = new File([e], e.name, { type: e.type });
52
+ return T.set(e, C), copyProperties(C, e, w, T, E), C;
53
53
  }
54
- if (typeof Blob < "u" && C instanceof Blob) {
55
- let t = new Blob([C], { type: C.type });
56
- return E.set(C, t), copyProperties(t, C, T, E, D), t;
54
+ if (typeof Blob < "u" && e instanceof Blob) {
55
+ let C = new Blob([e], { type: e.type });
56
+ return T.set(e, C), copyProperties(C, e, w, T, E), C;
57
57
  }
58
- if (C instanceof Error) {
59
- let t = structuredClone(C);
60
- return E.set(C, t), t.message = C.message, t.name = C.name, t.stack = C.stack, t.cause = C.cause, t.constructor = C.constructor, copyProperties(t, C, T, E, D), t;
58
+ if (e instanceof Error) {
59
+ let C = structuredClone(e);
60
+ return T.set(e, C), C.message = e.message, C.name = e.name, C.stack = e.stack, C.cause = e.cause, C.constructor = e.constructor, copyProperties(C, e, w, T, E), C;
61
61
  }
62
- if (C instanceof Boolean) {
63
- let t = new Boolean(C.valueOf());
64
- return E.set(C, t), copyProperties(t, C, T, E, D), t;
62
+ if (e instanceof Boolean) {
63
+ let C = new Boolean(e.valueOf());
64
+ return T.set(e, C), copyProperties(C, e, w, T, E), C;
65
65
  }
66
- if (C instanceof Number) {
67
- let t = new Number(C.valueOf());
68
- return E.set(C, t), copyProperties(t, C, T, E, D), t;
66
+ if (e instanceof Number) {
67
+ let C = new Number(e.valueOf());
68
+ return T.set(e, C), copyProperties(C, e, w, T, E), C;
69
69
  }
70
- if (C instanceof String) {
71
- let t = new String(C.valueOf());
72
- return E.set(C, t), copyProperties(t, C, T, E, D), t;
70
+ if (e instanceof String) {
71
+ let C = new String(e.valueOf());
72
+ return T.set(e, C), copyProperties(C, e, w, T, E), C;
73
73
  }
74
- if (typeof C == "object" && isCloneableObject(C)) {
75
- let t = Object.create(Object.getPrototypeOf(C));
76
- return E.set(C, t), copyProperties(t, C, T, E, D), t;
74
+ if (typeof e == "object" && isCloneableObject(e)) {
75
+ let C = Object.create(Object.getPrototypeOf(e));
76
+ return T.set(e, C), copyProperties(C, e, w, T, E), C;
77
77
  }
78
- return C;
78
+ return e;
79
79
  }
80
- function copyProperties(t, w, T = t, E, D) {
80
+ function copyProperties(C, w, T = C, E, D) {
81
81
  let O = [...Object.keys(w), ...getSymbols(w)];
82
- for (let C = 0; C < O.length; C++) {
83
- let k = O[C], A = Object.getOwnPropertyDescriptor(t, k);
84
- (A == null || A.writable) && (t[k] = cloneDeepWithImpl(w[k], k, T, E, D));
82
+ for (let e = 0; e < O.length; e++) {
83
+ let k = O[e], A = Object.getOwnPropertyDescriptor(C, k);
84
+ (A == null || A.writable) && (C[k] = cloneDeepWithImpl(w[k], k, T, E, D));
85
85
  }
86
86
  }
87
- function isCloneableObject(t) {
88
- switch (getTag(t)) {
87
+ function isCloneableObject(e) {
88
+ switch (getTag(e)) {
89
89
  case argumentsTag:
90
90
  case arrayTag:
91
91
  case arrayBufferTag:
@@ -75,6 +75,11 @@ const queryKeys = {
75
75
  e,
76
76
  t
77
77
  ],
78
+ environments: (e, t) => [
79
+ "workspace-environments",
80
+ e,
81
+ t
82
+ ],
78
83
  gitStatus: (e, t) => [
79
84
  "gitStatus",
80
85
  e,
@@ -16,6 +16,7 @@ function resolveInvalidations(t, n) {
16
16
  case "document.created": return [queryKeys.documents(n, t.workflowId)];
17
17
  case "secret.upserted":
18
18
  case "secret.deleted": return [queryKeys.secrets(n, t.workspaceId)];
19
+ case "environment.updated": return [queryKeys.environments(n, t.workspaceId)];
19
20
  case "git.updated": return [
20
21
  queryKeys.gitStatus(n, t.workspaceId),
21
22
  queryKeys.gitLog(n, t.workspaceId),
@@ -1,5 +1,5 @@
1
1
  import { DocumentCreatedEventSchema, WorkflowCreatedEventSchema, WorkflowUpdatedEventSchema } from "./workflow-events.schema.js";
2
- import { GitUpdatedEventSchema, SecretDeletedEventSchema, SecretUpsertedEventSchema } from "./workspace-events.schema.js";
2
+ import { EnvironmentUpdatedEventSchema, GitUpdatedEventSchema, SecretDeletedEventSchema, SecretUpsertedEventSchema } from "./workspace-events.schema.js";
3
3
  import { LlmResponseDoneEventSchema, LlmResponseErrorEventSchema, LlmResponseStartEventSchema, LlmResponseTextDeltaEventSchema, LlmResponseThinkingDeltaEventSchema, LlmResponseToolCallEventSchema } from "./llm-events.schema.js";
4
4
  import { StreamResetEventSchema } from "./stream-events.schema.js";
5
5
  import { z } from "zod";
@@ -10,6 +10,7 @@ const ClientMessageSchema = z.discriminatedUnion("type", [
10
10
  SecretUpsertedEventSchema,
11
11
  SecretDeletedEventSchema,
12
12
  GitUpdatedEventSchema,
13
+ EnvironmentUpdatedEventSchema,
13
14
  LlmResponseStartEventSchema,
14
15
  LlmResponseTextDeltaEventSchema,
15
16
  LlmResponseThinkingDeltaEventSchema,
@@ -1,6 +1,6 @@
1
1
  import { ClientMessageBaseSchema } from "./client-message-base.schema.js";
2
2
  import { DocumentCreatedEventSchema, WorkflowCreatedEventSchema, WorkflowUpdatedEventSchema } from "./workflow-events.schema.js";
3
- import { GitUpdatedEventSchema, SecretDeletedEventSchema, SecretUpsertedEventSchema } from "./workspace-events.schema.js";
3
+ import { EnvironmentUpdatedEventSchema, GitUpdatedEventSchema, SecretDeletedEventSchema, SecretUpsertedEventSchema } from "./workspace-events.schema.js";
4
4
  import { LlmNormalizedMessageSchema, LlmResponseDoneEventSchema, LlmResponseErrorEventSchema, LlmResponseStartEventSchema, LlmResponseTextDeltaEventSchema, LlmResponseThinkingDeltaEventSchema, LlmResponseToolCallEventSchema } from "./llm-events.schema.js";
5
5
  import { StreamResetEventSchema } from "./stream-events.schema.js";
6
6
  import { ClientMessageSchema, isLlmResponseEvent } from "./client-message.schema.js";
@@ -1,5 +1,5 @@
1
1
  import { ClientMessageBaseSchema } from "./client-message-base.schema.js";
2
2
  import { z } from "zod";
3
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 };
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") }), EnvironmentUpdatedEventSchema = WorkspaceEventBaseSchema.extend({ type: z.literal("environment.updated") });
5
+ export { EnvironmentUpdatedEventSchema, GitUpdatedEventSchema, SecretDeletedEventSchema, SecretUpsertedEventSchema };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loopstack/loopstack-studio",
3
- "version": "0.37.0",
3
+ "version": "0.38.0",
4
4
  "repository": "loopstack-ai/loopstack-studio",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -26,9 +26,9 @@
26
26
  "dependencies": {
27
27
  "@fontsource/roboto": "^5.2.10",
28
28
  "@hookform/resolvers": "^5.2.2",
29
- "@loopstack/client": "^0.39.0",
30
- "@loopstack/contracts": "^0.39.0",
31
- "@loopstack/react": "^3.0.0",
29
+ "@loopstack/client": "^0.41.0",
30
+ "@loopstack/contracts": "^0.41.0",
31
+ "@loopstack/react": "^4.0.0",
32
32
  "@radix-ui/react-accordion": "^1.2.12",
33
33
  "@radix-ui/react-alert-dialog": "^1.1.15",
34
34
  "@radix-ui/react-avatar": "^1.1.11",