explorbot 0.1.4 → 0.1.6

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 (42) hide show
  1. package/dist/rules/planner/styles/curious.md +18 -5
  2. package/dist/rules/planner/styles/normal.md +4 -4
  3. package/dist/rules/planner/styles/psycho.md +14 -11
  4. package/dist/rules/researcher/container-rules.md +15 -0
  5. package/dist/rules/researcher/section-example.md +12 -0
  6. package/dist/src/ai/captain/web-mode.js +9 -1
  7. package/dist/src/ai/historian.js +6 -0
  8. package/dist/src/ai/pilot.js +23 -2
  9. package/dist/src/ai/researcher/cache.js +6 -0
  10. package/dist/src/ai/researcher/deep-analysis.js +65 -9
  11. package/dist/src/ai/researcher/sections.js +103 -0
  12. package/dist/src/ai/researcher.js +30 -103
  13. package/dist/src/ai/task-agent.js +7 -27
  14. package/dist/src/ai/tester.js +19 -4
  15. package/dist/src/ai/tools.js +27 -2
  16. package/dist/src/commands/explore-command.js +4 -9
  17. package/dist/src/experience-tracker.js +126 -1
  18. package/dist/src/explorbot.js +9 -2
  19. package/dist/src/explorer.js +12 -1
  20. package/dist/src/utils/aria.js +39 -2
  21. package/package.json +1 -1
  22. package/rules/planner/styles/curious.md +18 -5
  23. package/rules/planner/styles/normal.md +4 -4
  24. package/rules/planner/styles/psycho.md +14 -11
  25. package/rules/researcher/container-rules.md +15 -0
  26. package/rules/researcher/section-example.md +12 -0
  27. package/src/ai/captain/web-mode.ts +9 -1
  28. package/src/ai/historian.ts +7 -0
  29. package/src/ai/pilot.ts +23 -3
  30. package/src/ai/researcher/cache.ts +5 -0
  31. package/src/ai/researcher/deep-analysis.ts +74 -9
  32. package/src/ai/researcher/sections.ts +122 -0
  33. package/src/ai/researcher.ts +31 -105
  34. package/src/ai/task-agent.ts +7 -31
  35. package/src/ai/tester.ts +20 -4
  36. package/src/ai/tools.ts +33 -1
  37. package/src/commands/explore-command.ts +4 -9
  38. package/src/config.ts +1 -0
  39. package/src/experience-tracker.ts +136 -1
  40. package/src/explorbot.ts +9 -2
  41. package/src/explorer.ts +10 -1
  42. package/src/utils/aria.ts +40 -2
package/src/utils/aria.ts CHANGED
@@ -355,8 +355,41 @@ export interface FocusAreaResult {
355
355
  name: string | null;
356
356
  }
357
357
 
358
+ const CLOSE_OVERLAY_BUTTON_RE = /^close\s+(modal|dialog|popup|drawer|panel|sheet)\b/i;
359
+
360
+ const findOverlayByCloseButton = (nodeList: AriaNode[]): FocusAreaResult | null => {
361
+ const closeIdx = nodeList.findIndex((n) => n.role === 'button' && CLOSE_OVERLAY_BUTTON_RE.test(n.name || ''));
362
+ if (closeIdx !== -1) {
363
+ let heading: AriaNode | undefined;
364
+ for (let i = closeIdx - 1; i >= 0; i--) {
365
+ if (nodeList[i].role === 'heading' && nodeList[i].name) {
366
+ heading = nodeList[i];
367
+ break;
368
+ }
369
+ }
370
+ if (!heading) {
371
+ for (let i = closeIdx + 1; i < nodeList.length; i++) {
372
+ if (nodeList[i].role === 'heading' && nodeList[i].name) {
373
+ heading = nodeList[i];
374
+ break;
375
+ }
376
+ }
377
+ }
378
+ return {
379
+ detected: true,
380
+ type: 'dialog',
381
+ name: heading?.name || null,
382
+ };
383
+ }
384
+ for (const node of nodeList) {
385
+ const inner = findOverlayByCloseButton(node.children);
386
+ if (inner) return inner;
387
+ }
388
+ return null;
389
+ };
390
+
358
391
  export const detectFocusArea = (snapshot: string | null): FocusAreaResult => {
359
- const nodes = parseAriaSnapshot(snapshot);
392
+ const nodes = parseAriaSnapshot(snapshot, true);
360
393
 
361
394
  const findFocusArea = (nodeList: AriaNode[]): FocusAreaResult | null => {
362
395
  for (const node of nodeList) {
@@ -385,7 +418,12 @@ export const detectFocusArea = (snapshot: string | null): FocusAreaResult => {
385
418
  };
386
419
 
387
420
  const result = findFocusArea(nodes);
388
- return result || { detected: false, type: null, name: null };
421
+ if (result) return result;
422
+
423
+ const fallback = findOverlayByCloseButton(nodes);
424
+ if (fallback && fallback.name) return fallback;
425
+
426
+ return { detected: false, type: null, name: null };
389
427
  };
390
428
 
391
429
  export const collectInteractiveNodes = (snapshot: string | null): Array<Record<string, unknown>> => {