replicas-cli 0.2.53 → 0.2.55

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.
package/dist/index.mjs CHANGED
@@ -1855,12 +1855,12 @@ async function interactiveCommand() {
1855
1855
  );
1856
1856
  }
1857
1857
  console.log(chalk17.gray("Starting interactive mode..."));
1858
- const { launchInteractive } = await import("./interactive-4AVPCL2D.mjs");
1858
+ const { launchInteractive } = await import("./interactive-PU7VBDB2.mjs");
1859
1859
  await launchInteractive();
1860
1860
  }
1861
1861
 
1862
1862
  // src/index.ts
1863
- var CLI_VERSION = "0.2.53";
1863
+ var CLI_VERSION = "0.2.55";
1864
1864
  var program = new Command();
1865
1865
  program.name("replicas").description("CLI for managing Replicas workspaces").version(CLI_VERSION);
1866
1866
  program.command("login").description("Authenticate with your Replicas account").action(async () => {
@@ -114,7 +114,8 @@ function useWorkspaces(page = 1, limit = 100, scope = "organization") {
114
114
  return useQuery({
115
115
  queryKey: ["workspaces", orgId, scope, page, limit],
116
116
  queryFn: () => orgFetch(`/v1/workspaces?scope=${scope}&page=${page}&limit=${limit}`),
117
- enabled: !!orgId
117
+ enabled: !!orgId,
118
+ staleTime: 1e4
118
119
  }, auth.queryClient);
119
120
  }
120
121
  function useCreateWorkspace() {
@@ -2609,6 +2610,7 @@ var MOCK_CHATS = [
2609
2610
  { id: "mock-codex", provider: "codex", title: "Codex", createdAt: "", updatedAt: "", processing: false }
2610
2611
  ];
2611
2612
  var MONOLITH_URL = process.env.REPLICAS_MONOLITH_URL || "https://api.replicas.dev";
2613
+ var workspacePollingStarted = false;
2612
2614
  var queryClient = new QueryClient({
2613
2615
  defaultOptions: {
2614
2616
  queries: {
@@ -2633,6 +2635,15 @@ function AppInner() {
2633
2635
  const renderer = useRenderer();
2634
2636
  const { width } = useTerminalDimensions3();
2635
2637
  const toast = useToast();
2638
+ const rendererRef = useRef5(renderer);
2639
+ rendererRef.current = renderer;
2640
+ if (!workspacePollingStarted) {
2641
+ workspacePollingStarted = true;
2642
+ setInterval(() => {
2643
+ queryClient.invalidateQueries({ queryKey: ["workspaces"] });
2644
+ rendererRef.current.requestRender();
2645
+ }, 3e4);
2646
+ }
2636
2647
  useEffect3(() => {
2637
2648
  const handler = (selection) => {
2638
2649
  const text = selection.getSelectedText();
@@ -2653,6 +2664,16 @@ function AppInner() {
2653
2664
  const [mockWorkspaces, setMockWorkspaces] = useState8([]);
2654
2665
  const mockToRealRef = useRef5(/* @__PURE__ */ new Map());
2655
2666
  const mockGroupRef = useRef5(/* @__PURE__ */ new Map());
2667
+ const mockPollingRef = useRef5(null);
2668
+ if (mockWorkspaces.length > 0 && !mockPollingRef.current) {
2669
+ mockPollingRef.current = setInterval(() => {
2670
+ queryClient.invalidateQueries({ queryKey: ["workspaces"] });
2671
+ rendererRef.current.requestRender();
2672
+ }, 5e3);
2673
+ } else if (mockWorkspaces.length === 0 && mockPollingRef.current) {
2674
+ clearInterval(mockPollingRef.current);
2675
+ mockPollingRef.current = null;
2676
+ }
2656
2677
  const [mockMessages, setMockMessages] = useState8([]);
2657
2678
  const [mockThinking, setMockThinking] = useState8(false);
2658
2679
  const pendingMessageRef = useRef5(/* @__PURE__ */ new Map());
@@ -2762,13 +2783,6 @@ function AppInner() {
2762
2783
  }
2763
2784
  sendMessageMutation.mutate({ message: pending });
2764
2785
  }, [selectedWorkspaceId, resolvedChatId, isMockSelected, statusData?.status]);
2765
- useEffect3(() => {
2766
- if (mockWorkspaces.length === 0) return;
2767
- const interval = setInterval(() => {
2768
- queryClient.invalidateQueries({ queryKey: ["workspaces"] });
2769
- }, 5e3);
2770
- return () => clearInterval(interval);
2771
- }, [mockWorkspaces.length]);
2772
2786
  const handleSelectWorkspace = useCallback7((workspaceId) => {
2773
2787
  setSelectedWorkspaceId(workspaceId);
2774
2788
  setSelectedChatId(null);
@@ -2779,6 +2793,9 @@ function AppInner() {
2779
2793
  setFocusPanel("chat-input");
2780
2794
  }, []);
2781
2795
  const handleFocus = useCallback7((panel) => {
2796
+ if (panel === "sidebar") {
2797
+ queryClient.invalidateQueries({ queryKey: ["workspaces"] });
2798
+ }
2782
2799
  setFocusPanel(panel);
2783
2800
  }, []);
2784
2801
  const handleCreateWorkspace = useCallback7(
@@ -2873,7 +2890,11 @@ function AppInner() {
2873
2890
  return true;
2874
2891
  });
2875
2892
  const idx = availablePanels.indexOf(current);
2876
- return availablePanels[(idx + 1) % availablePanels.length];
2893
+ const next = availablePanels[(idx + 1) % availablePanels.length];
2894
+ if (next === "sidebar") {
2895
+ queryClient.invalidateQueries({ queryKey: ["workspaces"] });
2896
+ }
2897
+ return next;
2877
2898
  });
2878
2899
  return;
2879
2900
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-cli",
3
- "version": "0.2.53",
3
+ "version": "0.2.55",
4
4
  "description": "CLI for managing Replicas workspaces - SSH into cloud dev environments with automatic port forwarding",
5
5
  "main": "dist/index.mjs",
6
6
  "bin": {