lazy-gravity 0.9.2 → 0.11.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 (41) hide show
  1. package/dist/bin/commands/doctor.js +45 -7
  2. package/dist/bot/index.js +401 -41
  3. package/dist/bot/telegramMessageHandler.js +1 -0
  4. package/dist/commands/chatCommandHandler.js +43 -3
  5. package/dist/commands/registerSlashCommands.js +13 -1
  6. package/dist/events/interactionCreateHandler.js +456 -27
  7. package/dist/events/messageCreateHandler.js +66 -7
  8. package/dist/handlers/__tests__/fileChangeButtonAction.test.js +85 -0
  9. package/dist/handlers/approvalButtonAction.js +2 -1
  10. package/dist/handlers/errorPopupButtonAction.js +2 -1
  11. package/dist/handlers/fileChangeButtonAction.js +57 -0
  12. package/dist/handlers/genericActionButtonAction.js +72 -0
  13. package/dist/handlers/planningButtonAction.js +126 -23
  14. package/dist/handlers/planningModalSubmitAction.js +38 -0
  15. package/dist/handlers/questionSelectAction.js +70 -0
  16. package/dist/handlers/questionSkipAction.js +68 -0
  17. package/dist/handlers/runCommandButtonAction.js +2 -1
  18. package/dist/platform/discord/discordResponseRenderer.js +164 -0
  19. package/dist/platform/discord/wrappers.js +76 -0
  20. package/dist/services/approvalDetector.js +110 -35
  21. package/dist/services/artifactService.js +103 -37
  22. package/dist/services/assistantDomExtractor.js +194 -3
  23. package/dist/services/cdpBridgeManager.js +149 -8
  24. package/dist/services/cdpConnectionPool.js +22 -2
  25. package/dist/services/cdpService.js +134 -15
  26. package/dist/services/chatSessionService.js +147 -40
  27. package/dist/services/errorPopupDetector.js +23 -11
  28. package/dist/services/notificationSender.js +80 -3
  29. package/dist/services/planningDetector.js +69 -25
  30. package/dist/services/promptDispatcher.js +27 -1
  31. package/dist/services/questionDetector.js +428 -0
  32. package/dist/services/responseMonitor.js +45 -3
  33. package/dist/services/runCommandDetector.js +14 -7
  34. package/dist/ui/artifactsUi.js +4 -3
  35. package/dist/utils/consecutiveEmptyPollGate.js +21 -0
  36. package/dist/utils/fileOpenCache.js +29 -0
  37. package/dist/utils/htmlToDiscordMarkdown.js +5 -2
  38. package/dist/utils/pathUtils.js +12 -0
  39. package/dist/utils/projectResolver.js +10 -0
  40. package/dist/utils/questionActionUtils.js +47 -0
  41. package/package.json +1 -1
@@ -41,6 +41,7 @@ const cdpPorts_1 = require("../../utils/cdpPorts");
41
41
  const configLoader_1 = require("../../utils/configLoader");
42
42
  const pathUtils_1 = require("../../utils/pathUtils");
43
43
  const logger_1 = require("../../utils/logger");
44
+ const artifactService_1 = require("../../services/artifactService");
44
45
  const ok = (msg) => console.log(` ${logger_1.COLORS.green}[OK]${logger_1.COLORS.reset} ${msg}`);
45
46
  const warn = (msg) => console.log(` ${logger_1.COLORS.yellow}[--]${logger_1.COLORS.reset} ${msg}`);
46
47
  const fail = (msg) => console.log(` ${logger_1.COLORS.red}[!!]${logger_1.COLORS.reset} ${msg}`);
@@ -53,17 +54,22 @@ function checkPort(port) {
53
54
  res.on('end', () => {
54
55
  try {
55
56
  const parsed = JSON.parse(data);
56
- resolve(Array.isArray(parsed));
57
+ if (Array.isArray(parsed)) {
58
+ resolve({ alive: true, targets: parsed });
59
+ }
60
+ else {
61
+ resolve({ alive: false });
62
+ }
57
63
  }
58
64
  catch {
59
- resolve(false);
65
+ resolve({ alive: false });
60
66
  }
61
67
  });
62
68
  });
63
- req.on('error', () => resolve(false));
69
+ req.on('error', () => resolve({ alive: false }));
64
70
  req.setTimeout(2000, () => {
65
71
  req.destroy();
66
- resolve(false);
72
+ resolve({ alive: false });
67
73
  });
68
74
  });
69
75
  }
@@ -145,11 +151,15 @@ async function doctorAction() {
145
151
  // 5. CDP port check
146
152
  console.log(`\n ${logger_1.COLORS.dim}Checking CDP ports...${logger_1.COLORS.reset}`);
147
153
  let cdpOk = false;
154
+ const portResults = new Map();
148
155
  for (const port of cdpPorts_1.CDP_PORTS) {
149
- const alive = await checkPort(port);
150
- if (alive) {
156
+ const result = await checkPort(port);
157
+ if (result.alive) {
151
158
  ok(`CDP port ${port} is responding`);
152
159
  cdpOk = true;
160
+ if (result.targets) {
161
+ portResults.set(port, result.targets);
162
+ }
153
163
  }
154
164
  }
155
165
  if (!cdpOk) {
@@ -157,7 +167,35 @@ async function doctorAction() {
157
167
  hint(`Run: ${(0, pathUtils_1.getAntigravityCdpHint)(9222)}`);
158
168
  allOk = false;
159
169
  }
160
- // 6. Node.js version check
170
+ // 6. Path alignment check
171
+ console.log(`\n ${logger_1.COLORS.dim}Checking brain path alignment...${logger_1.COLORS.reset}`);
172
+ const artifactService = new artifactService_1.ArtifactService();
173
+ const resolvedPath = artifactService.getBrainBasePath();
174
+ ok(`Resolved brainBasePath: ${resolvedPath}`);
175
+ for (const port of cdpPorts_1.CDP_PORTS) {
176
+ const targets = portResults.get(port);
177
+ if (targets && Array.isArray(targets)) {
178
+ for (const t of targets) {
179
+ if (t.url?.includes('workbench')) {
180
+ const pathLower = t.url.toLowerCase();
181
+ const isIDE = pathLower.includes('antigravity%20ide') || pathLower.includes('antigravity-ide');
182
+ const resolvedLower = resolvedPath.toLowerCase();
183
+ if (isIDE && !resolvedLower.includes('antigravity-ide')) {
184
+ fail(`Path mismatch: Active IDE target is "Antigravity IDE" but brain basePath is resolved to: ${resolvedPath}`);
185
+ hint('Make sure to use .gemini/antigravity-ide/brain path.');
186
+ allOk = false;
187
+ }
188
+ else if (!isIDE && resolvedLower.includes('antigravity-ide')) {
189
+ warn(`Active IDE target does not appear to be "Antigravity IDE" but brain basePath is: ${resolvedPath}`);
190
+ }
191
+ else {
192
+ ok(`Target "${t.title}" aligns correctly with brain basePath`);
193
+ }
194
+ }
195
+ }
196
+ }
197
+ }
198
+ // 7. Node.js version check
161
199
  const nodeVersion = process.versions.node;
162
200
  const major = parseInt(nodeVersion.split('.')[0], 10);
163
201
  if (major >= 18) {