@adiholick/nvstudio-mcp 1.1.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -128,6 +128,15 @@ local function getInstanceFromPath(pathString)
128
128
 
129
129
  if parts[1] == "game" then table.remove(parts, 1) end
130
130
 
131
+ -- Handle common Services directly to ensure reliability
132
+ pcall(function()
133
+ local svc = game:GetService(parts[1])
134
+ if svc then
135
+ current = svc
136
+ table.remove(parts, 1)
137
+ end
138
+ end)
139
+
131
140
  for _, part in ipairs(parts) do
132
141
  local found = current:FindFirstChild(part)
133
142
  if not found then return nil end
@@ -198,8 +207,6 @@ function startPolling()
198
207
  end)
199
208
 
200
209
  -- PENTING: Cek ulang isConnected SETELAH HTTP request selesai.
201
- -- Jika user menekan Disconnect saat request sedang berjalan,
202
- -- kita TIDAK boleh menimpa status UI "disconnected" yang sudah di-set.
203
210
  if not isConnected then
204
211
  break
205
212
  end
@@ -221,16 +228,20 @@ function startPolling()
221
228
  end)
222
229
  end
223
230
  end
231
+
232
+ -- Fast-polling (long-polling yield di server Node.js)
233
+ -- 50ms untuk safety mencegah Studio Engine freeze jika Node.js membalas instant
234
+ task.wait(0.05)
224
235
  else
225
236
  -- Fetch gagal (Node.js server mati karena IDE/Antigravity/Cursor ditutup)
226
237
  if ui then ui:setStatus("waiting") end
238
+ task.wait(1)
227
239
  end
228
240
 
229
241
  -- Cek lagi sebelum sleep (agar disconnect lebih responsif)
230
242
  if not isConnected then
231
243
  break
232
244
  end
233
- task.wait(1)
234
245
  end
235
246
  isPolling = false
236
247
  end)