context-drop 0.0.0-stage → 0.3.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 (60) hide show
  1. package/MIT-LICENSE +21 -0
  2. package/README.md +710 -2
  3. package/app/assets/javascripts/context_drop/context_drop.js +9949 -0
  4. package/dist/app/javascript/context_drop/api-client.d.ts +53 -0
  5. package/dist/app/javascript/context_drop/api-client.js +470 -0
  6. package/dist/app/javascript/context_drop/element-picker.d.ts +111 -0
  7. package/dist/app/javascript/context_drop/element-picker.js +1428 -0
  8. package/dist/app/javascript/context_drop/icons.d.ts +34 -0
  9. package/dist/app/javascript/context_drop/icons.js +34 -0
  10. package/dist/app/javascript/context_drop/index.d.ts +7 -0
  11. package/dist/app/javascript/context_drop/index.js +9 -0
  12. package/dist/app/javascript/context_drop/markdown.d.ts +7 -0
  13. package/dist/app/javascript/context_drop/markdown.js +129 -0
  14. package/dist/app/javascript/context_drop/sanitizer.d.ts +38 -0
  15. package/dist/app/javascript/context_drop/sanitizer.js +769 -0
  16. package/dist/app/javascript/context_drop/screenshot.d.ts +21 -0
  17. package/dist/app/javascript/context_drop/screenshot.js +245 -0
  18. package/dist/app/javascript/context_drop/styles.d.ts +1 -0
  19. package/dist/app/javascript/context_drop/styles.js +2196 -0
  20. package/dist/app/javascript/context_drop/types.d.ts +316 -0
  21. package/dist/app/javascript/context_drop/types.js +1 -0
  22. package/dist/app/javascript/context_drop/widget.d.ts +206 -0
  23. package/dist/app/javascript/context_drop/widget.js +3752 -0
  24. package/dist/src/cli.d.ts +3 -0
  25. package/dist/src/cli.js +207 -0
  26. package/dist/src/index.d.ts +5 -0
  27. package/dist/src/index.js +5 -0
  28. package/dist/src/mcp/dispatcher.d.ts +42 -0
  29. package/dist/src/mcp/dispatcher.js +895 -0
  30. package/dist/src/mcp/environment-router.d.ts +38 -0
  31. package/dist/src/mcp/environment-router.js +174 -0
  32. package/dist/src/mcp/index.d.ts +24 -0
  33. package/dist/src/mcp/index.js +75 -0
  34. package/dist/src/mcp/remote-client.d.ts +25 -0
  35. package/dist/src/mcp/remote-client.js +98 -0
  36. package/dist/src/next/index.d.ts +13 -0
  37. package/dist/src/next/index.js +25 -0
  38. package/dist/src/next/server.d.ts +1 -0
  39. package/dist/src/next/server.js +1 -0
  40. package/dist/src/react/index.d.ts +104 -0
  41. package/dist/src/react/index.js +144 -0
  42. package/dist/src/server/handler.d.ts +48 -0
  43. package/dist/src/server/handler.js +1180 -0
  44. package/dist/src/server/index.d.ts +8 -0
  45. package/dist/src/server/index.js +8 -0
  46. package/dist/src/server/sanitizer.d.ts +15 -0
  47. package/dist/src/server/sanitizer.js +201 -0
  48. package/dist/src/server/storage/local.d.ts +22 -0
  49. package/dist/src/server/storage/local.js +827 -0
  50. package/dist/src/server/storage/memory.d.ts +8 -0
  51. package/dist/src/server/storage/memory.js +387 -0
  52. package/dist/src/server/storage/postgres.d.ts +27 -0
  53. package/dist/src/server/storage/postgres.js +629 -0
  54. package/dist/src/server/types.d.ts +227 -0
  55. package/dist/src/server/types.js +7 -0
  56. package/dist/src/server/upload-validator.d.ts +16 -0
  57. package/dist/src/server/upload-validator.js +196 -0
  58. package/dist/src/widget/index.d.ts +1 -0
  59. package/dist/src/widget/index.js +1 -0
  60. package/package.json +99 -4
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Authored inline SVG icon set for ContextDrop.
3
+ * All icons share a 16x16 or 20x20 viewBox, 1.75px stroke weight, and round caps/joins.
4
+ */
5
+ export declare const ICON_PIN = "<svg viewBox=\"0 0 20 20\" width=\"15\" height=\"15\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M11.8 3.2l5 5-2.1 2.1-1.8-.6-3.2 3.2.6 2.5-1.6 1.6-3.1-3.1-3.1 3.1v-.1l3.1-3.1-3.1-3.1 1.6-1.6 2.5.6 3.2-3.2-.6-1.8 2.1-2.1z\"/></svg>";
6
+ export declare const ICON_PIN_DROP = "<svg viewBox=\"0 0 20 20\" width=\"15\" height=\"15\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M10 2.5a4.5 4.5 0 0 1 4.5 4.5c0 3.1-4.5 7.5-4.5 7.5S5.5 10.1 5.5 7A4.5 4.5 0 0 1 10 2.5z\"/><circle cx=\"10\" cy=\"7\" r=\"1.6\"/><path d=\"M5 17.5h10\"/></svg>";
7
+ export declare const ICON_LAYERS = "<svg viewBox=\"0 0 20 20\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><polygon points=\"10 2.5 17.5 6.5 10 10.5 2.5 6.5 10 2.5\"/><polyline points=\"2.5 10.2 10 14.2 17.5 10.2\"/><polyline points=\"2.5 13.8 10 17.8 17.5 13.8\"/></svg>";
8
+ export declare const ICON_CHEVRON_UP = "<svg viewBox=\"0 0 16 16\" width=\"12\" height=\"12\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><polyline points=\"3.5 10 8 5.5 12.5 10\"/></svg>";
9
+ export declare const ICON_CHEVRON_DOWN = "<svg viewBox=\"0 0 16 16\" width=\"12\" height=\"12\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><polyline points=\"3.5 6 8 10.5 12.5 6\"/></svg>";
10
+ export declare const ICON_CHEVRON_RIGHT = "<svg viewBox=\"0 0 16 16\" width=\"11\" height=\"11\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><polyline points=\"6 3.5 10.5 8 6 12.5\"/></svg>";
11
+ export declare const ICON_SCROLL_VERTICAL = "<svg viewBox=\"0 0 16 16\" width=\"12\" height=\"12\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><polyline points=\"5.25 5.75 8 3 10.75 5.75\"/><polyline points=\"5.25 10.25 8 13 10.75 10.25\"/></svg>";
12
+ export declare const ICON_CAMERA = "<svg viewBox=\"0 0 20 20\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M3 6.5h2.5l1.4-2h6.2l1.4 2H17a1.5 1.5 0 0 1 1.5 1.5v7.5A1.5 1.5 0 0 1 17 17H3a1.5 1.5 0 0 1-1.5-1.5V8A1.5 1.5 0 0 1 3 6.5z\"/><circle cx=\"10\" cy=\"11.5\" r=\"2.75\"/></svg>";
13
+ export declare const ICON_IMAGE = "<svg viewBox=\"0 0 20 20\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><rect x=\"2.5\" y=\"3.5\" width=\"15\" height=\"13\" rx=\"2\"/><circle cx=\"7\" cy=\"8\" r=\"1.3\"/><path d=\"M17.5 13.2l-3.8-3.7L6 16.5\"/></svg>";
14
+ export declare const ICON_SEND = "<svg viewBox=\"0 0 20 20\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.85\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M10 16V4\"/><polyline points=\"5 9 10 4 15 9\"/></svg>";
15
+ export declare const ICON_CLOSE = "<svg viewBox=\"0 0 16 16\" width=\"13\" height=\"13\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><line x1=\"4\" y1=\"4\" x2=\"12\" y2=\"12\"/><line x1=\"12\" y1=\"4\" x2=\"4\" y2=\"12\"/></svg>";
16
+ export declare const ICON_MINIMIZE = "<svg viewBox=\"0 0 16 16\" width=\"13\" height=\"13\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><line x1=\"3.5\" y1=\"8\" x2=\"12.5\" y2=\"8\"/></svg>";
17
+ export declare const ICON_EXPAND = "<svg viewBox=\"0 0 16 16\" width=\"13\" height=\"13\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><polyline points=\"6 3.5 12.5 3.5 12.5 10\"/><line x1=\"12.5\" y1=\"3.5\" x2=\"3.5\" y2=\"12.5\"/></svg>";
18
+ export declare const ICON_GRIP = "<svg viewBox=\"0 0 12 16\" width=\"10\" height=\"14\" fill=\"currentColor\" aria-hidden=\"true\"><circle cx=\"3.5\" cy=\"4\" r=\"1.1\"/><circle cx=\"8.5\" cy=\"4\" r=\"1.1\"/><circle cx=\"3.5\" cy=\"8\" r=\"1.1\"/><circle cx=\"8.5\" cy=\"8\" r=\"1.1\"/><circle cx=\"3.5\" cy=\"12\" r=\"1.1\"/><circle cx=\"8.5\" cy=\"12\" r=\"1.1\"/></svg>";
19
+ export declare const ICON_CHECK = "<svg viewBox=\"0 0 16 16\" width=\"12\" height=\"12\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><polyline points=\"3.5 8.5 6.5 11.5 12.5 4.5\"/></svg>";
20
+ export declare const ICON_CHAT = "<svg viewBox=\"0 0 20 20\" width=\"15\" height=\"15\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M4 4h12a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H8l-4 3v-3H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z\"/></svg>";
21
+ export declare const ICON_SIDEBAR = "<svg viewBox=\"0 0 20 20\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><rect x=\"2.5\" y=\"3.5\" width=\"15\" height=\"13\" rx=\"2\"/><line x1=\"12\" y1=\"3.5\" x2=\"12\" y2=\"16.5\"/></svg>";
22
+ export declare const ICON_CODE_PROMPT = "<svg viewBox=\"0 0 20 20\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><rect x=\"2.5\" y=\"3.5\" width=\"15\" height=\"13\" rx=\"2\"/><polyline points=\"6.5 8 9.2 10 6.5 12\"/><line x1=\"10.8\" y1=\"12\" x2=\"13.8\" y2=\"12\"/></svg>";
23
+ export declare const ICON_KEY = "<svg viewBox=\"0 0 20 20\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><circle cx=\"7\" cy=\"12\" r=\"3.5\"/><path d=\"M9.6 9.4L16.5 2.5\"/><path d=\"M14 5l2.2 2.2\"/><path d=\"M12 7l1.8 1.8\"/></svg>";
24
+ export declare const ICON_FILE_CODE = "<svg viewBox=\"0 0 20 20\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M11.5 2.5H5.5a1.5 1.5 0 0 0-1.5 1.5v12a1.5 1.5 0 0 0 1.5 1.5h9a1.5 1.5 0 0 0 1.5-1.5V7l-4.5-4.5z\"/><polyline points=\"11.5 2.5 11.5 7 16 7\"/><polyline points=\"8.2 10.5 6.5 12 8.2 13.5\"/><polyline points=\"11.8 10.5 13.5 12 11.8 13.5\"/></svg>";
25
+ export declare const ICON_SEARCH = "<svg viewBox=\"0 0 20 20\" width=\"13\" height=\"13\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><circle cx=\"9\" cy=\"9\" r=\"5.5\"/><line x1=\"13\" y1=\"13\" x2=\"17\" y2=\"17\"/></svg>";
26
+ export declare const ICON_PLUS = "<svg viewBox=\"0 0 16 16\" width=\"13\" height=\"13\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><line x1=\"8\" y1=\"3.5\" x2=\"8\" y2=\"12.5\"/><line x1=\"3.5\" y1=\"8\" x2=\"12.5\" y2=\"8\"/></svg>";
27
+ export declare const ICON_UNDO = "<svg viewBox=\"0 0 16 16\" width=\"13\" height=\"13\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><polyline points=\"5.5 4.5 2.5 7.5 5.5 10.5\"/><path d=\"M2.5 7.5h7.2a3.8 3.8 0 0 1 0 7.6H8.5\"/></svg>";
28
+ export declare const ICON_INBOX = "<svg viewBox=\"0 0 20 20\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M3.5 11.5L5.2 4.5h9.6l1.7 7v4a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1v-4z\"/><path d=\"M3.5 11.5h3.8l1.2 2h3l1.2-2h3.8\"/></svg>";
29
+ export declare const ICON_SHIELD = "<svg viewBox=\"0 0 20 20\" width=\"13\" height=\"13\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M10 2.5l6 2.3v4.7c0 4.1-2.6 6.8-6 8-3.4-1.2-6-3.9-6-8V4.8l6-2.3z\"/></svg>";
30
+ export declare const ICON_PUSH_LAYOUT = "<svg viewBox=\"0 0 16 16\" width=\"13\" height=\"13\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><rect x=\"2\" y=\"2.5\" width=\"12\" height=\"11\" rx=\"1.8\"/><line x1=\"9.5\" y1=\"2.5\" x2=\"9.5\" y2=\"13.5\"/><polyline points=\"6.5 6.2 4.7 8 6.5 9.8\"/></svg>";
31
+ export declare const ICON_SUN = "<svg viewBox=\"0 0 20 20\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><circle cx=\"10\" cy=\"10\" r=\"3.75\"/><line x1=\"10\" y1=\"2\" x2=\"10\" y2=\"4\"/><line x1=\"10\" y1=\"16\" x2=\"10\" y2=\"18\"/><line x1=\"2\" y1=\"10\" x2=\"4\" y2=\"10\"/><line x1=\"16\" y1=\"10\" x2=\"18\" y2=\"10\"/><line x1=\"4.34\" y1=\"4.34\" x2=\"5.75\" y2=\"5.75\"/><line x1=\"14.25\" y1=\"14.25\" x2=\"15.66\" y2=\"15.66\"/><line x1=\"4.34\" y1=\"15.66\" x2=\"5.75\" y2=\"14.25\"/><line x1=\"14.25\" y1=\"5.75\" x2=\"15.66\" y2=\"4.34\"/></svg>";
32
+ export declare const ICON_MOON = "<svg viewBox=\"0 0 20 20\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M17.2 12.8A7.5 7.5 0 0 1 7.2 2.8a7.5 7.5 0 1 0 10 10z\"/></svg>";
33
+ export declare const ICON_EDIT = "<svg viewBox=\"0 0 16 16\" width=\"13\" height=\"13\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M11.2 2.5a1.5 1.5 0 0 1 2.1 2.1L5.8 12.1 2.7 13l.9-3.1 7.6-7.4z\"/></svg>";
34
+ export declare const ICON_TRASH = "<svg viewBox=\"0 0 16 16\" width=\"13\" height=\"13\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.75\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\"><path d=\"M2.8 4.5h10.4\"/><path d=\"M6.2 4.5V3.2a.9.9 0 0 1 .9-.9h1.8a.9.9 0 0 1 .9.9v1.3\"/><path d=\"M4.2 4.5l.6 8.3a1.2 1.2 0 0 0 1.2 1.1h4a1.2 1.2 0 0 0 1.2-1.1l.6-8.3\"/></svg>";
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Authored inline SVG icon set for ContextDrop.
3
+ * All icons share a 16x16 or 20x20 viewBox, 1.75px stroke weight, and round caps/joins.
4
+ */
5
+ export const ICON_PIN = `<svg viewBox="0 0 20 20" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M11.8 3.2l5 5-2.1 2.1-1.8-.6-3.2 3.2.6 2.5-1.6 1.6-3.1-3.1-3.1 3.1v-.1l3.1-3.1-3.1-3.1 1.6-1.6 2.5.6 3.2-3.2-.6-1.8 2.1-2.1z"/></svg>`;
6
+ export const ICON_PIN_DROP = `<svg viewBox="0 0 20 20" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 2.5a4.5 4.5 0 0 1 4.5 4.5c0 3.1-4.5 7.5-4.5 7.5S5.5 10.1 5.5 7A4.5 4.5 0 0 1 10 2.5z"/><circle cx="10" cy="7" r="1.6"/><path d="M5 17.5h10"/></svg>`;
7
+ export const ICON_LAYERS = `<svg viewBox="0 0 20 20" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polygon points="10 2.5 17.5 6.5 10 10.5 2.5 6.5 10 2.5"/><polyline points="2.5 10.2 10 14.2 17.5 10.2"/><polyline points="2.5 13.8 10 17.8 17.5 13.8"/></svg>`;
8
+ export const ICON_CHEVRON_UP = `<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="3.5 10 8 5.5 12.5 10"/></svg>`;
9
+ export const ICON_CHEVRON_DOWN = `<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="3.5 6 8 10.5 12.5 6"/></svg>`;
10
+ export const ICON_CHEVRON_RIGHT = `<svg viewBox="0 0 16 16" width="11" height="11" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="6 3.5 10.5 8 6 12.5"/></svg>`;
11
+ export const ICON_SCROLL_VERTICAL = `<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="5.25 5.75 8 3 10.75 5.75"/><polyline points="5.25 10.25 8 13 10.75 10.25"/></svg>`;
12
+ export const ICON_CAMERA = `<svg viewBox="0 0 20 20" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 6.5h2.5l1.4-2h6.2l1.4 2H17a1.5 1.5 0 0 1 1.5 1.5v7.5A1.5 1.5 0 0 1 17 17H3a1.5 1.5 0 0 1-1.5-1.5V8A1.5 1.5 0 0 1 3 6.5z"/><circle cx="10" cy="11.5" r="2.75"/></svg>`;
13
+ export const ICON_IMAGE = `<svg viewBox="0 0 20 20" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2.5" y="3.5" width="15" height="13" rx="2"/><circle cx="7" cy="8" r="1.3"/><path d="M17.5 13.2l-3.8-3.7L6 16.5"/></svg>`;
14
+ export const ICON_SEND = `<svg viewBox="0 0 20 20" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.85" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 16V4"/><polyline points="5 9 10 4 15 9"/></svg>`;
15
+ export const ICON_CLOSE = `<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="4" y1="4" x2="12" y2="12"/><line x1="12" y1="4" x2="4" y2="12"/></svg>`;
16
+ export const ICON_MINIMIZE = `<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="3.5" y1="8" x2="12.5" y2="8"/></svg>`;
17
+ export const ICON_EXPAND = `<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="6 3.5 12.5 3.5 12.5 10"/><line x1="12.5" y1="3.5" x2="3.5" y2="12.5"/></svg>`;
18
+ export const ICON_GRIP = `<svg viewBox="0 0 12 16" width="10" height="14" fill="currentColor" aria-hidden="true"><circle cx="3.5" cy="4" r="1.1"/><circle cx="8.5" cy="4" r="1.1"/><circle cx="3.5" cy="8" r="1.1"/><circle cx="8.5" cy="8" r="1.1"/><circle cx="3.5" cy="12" r="1.1"/><circle cx="8.5" cy="12" r="1.1"/></svg>`;
19
+ export const ICON_CHECK = `<svg viewBox="0 0 16 16" width="12" height="12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="3.5 8.5 6.5 11.5 12.5 4.5"/></svg>`;
20
+ export const ICON_CHAT = `<svg viewBox="0 0 20 20" width="15" height="15" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 4h12a2 2 0 0 1 2 2v7a2 2 0 0 1-2 2H8l-4 3v-3H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z"/></svg>`;
21
+ export const ICON_SIDEBAR = `<svg viewBox="0 0 20 20" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2.5" y="3.5" width="15" height="13" rx="2"/><line x1="12" y1="3.5" x2="12" y2="16.5"/></svg>`;
22
+ export const ICON_CODE_PROMPT = `<svg viewBox="0 0 20 20" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2.5" y="3.5" width="15" height="13" rx="2"/><polyline points="6.5 8 9.2 10 6.5 12"/><line x1="10.8" y1="12" x2="13.8" y2="12"/></svg>`;
23
+ export const ICON_KEY = `<svg viewBox="0 0 20 20" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="7" cy="12" r="3.5"/><path d="M9.6 9.4L16.5 2.5"/><path d="M14 5l2.2 2.2"/><path d="M12 7l1.8 1.8"/></svg>`;
24
+ export const ICON_FILE_CODE = `<svg viewBox="0 0 20 20" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M11.5 2.5H5.5a1.5 1.5 0 0 0-1.5 1.5v12a1.5 1.5 0 0 0 1.5 1.5h9a1.5 1.5 0 0 0 1.5-1.5V7l-4.5-4.5z"/><polyline points="11.5 2.5 11.5 7 16 7"/><polyline points="8.2 10.5 6.5 12 8.2 13.5"/><polyline points="11.8 10.5 13.5 12 11.8 13.5"/></svg>`;
25
+ export const ICON_SEARCH = `<svg viewBox="0 0 20 20" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="9" cy="9" r="5.5"/><line x1="13" y1="13" x2="17" y2="17"/></svg>`;
26
+ export const ICON_PLUS = `<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><line x1="8" y1="3.5" x2="8" y2="12.5"/><line x1="3.5" y1="8" x2="12.5" y2="8"/></svg>`;
27
+ export const ICON_UNDO = `<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="5.5 4.5 2.5 7.5 5.5 10.5"/><path d="M2.5 7.5h7.2a3.8 3.8 0 0 1 0 7.6H8.5"/></svg>`;
28
+ export const ICON_INBOX = `<svg viewBox="0 0 20 20" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3.5 11.5L5.2 4.5h9.6l1.7 7v4a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1v-4z"/><path d="M3.5 11.5h3.8l1.2 2h3l1.2-2h3.8"/></svg>`;
29
+ export const ICON_SHIELD = `<svg viewBox="0 0 20 20" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10 2.5l6 2.3v4.7c0 4.1-2.6 6.8-6 8-3.4-1.2-6-3.9-6-8V4.8l6-2.3z"/></svg>`;
30
+ export const ICON_PUSH_LAYOUT = `<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2" y="2.5" width="12" height="11" rx="1.8"/><line x1="9.5" y1="2.5" x2="9.5" y2="13.5"/><polyline points="6.5 6.2 4.7 8 6.5 9.8"/></svg>`;
31
+ export const ICON_SUN = `<svg viewBox="0 0 20 20" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="10" cy="10" r="3.75"/><line x1="10" y1="2" x2="10" y2="4"/><line x1="10" y1="16" x2="10" y2="18"/><line x1="2" y1="10" x2="4" y2="10"/><line x1="16" y1="10" x2="18" y2="10"/><line x1="4.34" y1="4.34" x2="5.75" y2="5.75"/><line x1="14.25" y1="14.25" x2="15.66" y2="15.66"/><line x1="4.34" y1="15.66" x2="5.75" y2="14.25"/><line x1="14.25" y1="5.75" x2="15.66" y2="4.34"/></svg>`;
32
+ export const ICON_MOON = `<svg viewBox="0 0 20 20" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M17.2 12.8A7.5 7.5 0 0 1 7.2 2.8a7.5 7.5 0 1 0 10 10z"/></svg>`;
33
+ export const ICON_EDIT = `<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M11.2 2.5a1.5 1.5 0 0 1 2.1 2.1L5.8 12.1 2.7 13l.9-3.1 7.6-7.4z"/></svg>`;
34
+ export const ICON_TRASH = `<svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M2.8 4.5h10.4"/><path d="M6.2 4.5V3.2a.9.9 0 0 1 .9-.9h1.8a.9.9 0 0 1 .9.9v1.3"/><path d="M4.2 4.5l.6 8.3a1.2 1.2 0 0 0 1.2 1.1h4a1.2 1.2 0 0 0 1.2-1.1l.6-8.3"/></svg>`;
@@ -0,0 +1,7 @@
1
+ export * from "./types.js";
2
+ export * from "./sanitizer.js";
3
+ export * from "./styles.js";
4
+ export * from "./api-client.js";
5
+ export * from "./screenshot.js";
6
+ export * from "./element-picker.js";
7
+ export * from "./widget.js";
@@ -0,0 +1,9 @@
1
+ import { registerContextDropWidget } from "./widget.js";
2
+ export * from "./types.js";
3
+ export * from "./sanitizer.js";
4
+ export * from "./styles.js";
5
+ export * from "./api-client.js";
6
+ export * from "./screenshot.js";
7
+ export * from "./element-picker.js";
8
+ export * from "./widget.js";
9
+ registerContextDropWidget();
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Safe, zero-dependency Markdown and unified-diff renderer for ContextDrop Agent responses.
3
+ * Escapes all HTML entities before formatting inline code, bold text, lists, and code blocks.
4
+ */
5
+ export declare function escapeHtml(raw: string): string;
6
+ export declare function renderSafeMarkdown(markdown: string): string;
7
+ export declare function buildUnifiedDiffElement(doc: Document, diffText: string): HTMLDivElement;
@@ -0,0 +1,129 @@
1
+ /**
2
+ * Safe, zero-dependency Markdown and unified-diff renderer for ContextDrop Agent responses.
3
+ * Escapes all HTML entities before formatting inline code, bold text, lists, and code blocks.
4
+ */
5
+ export function escapeHtml(raw) {
6
+ return String(raw)
7
+ .replace(/&/g, "&amp;")
8
+ .replace(/</g, "&lt;")
9
+ .replace(/>/g, "&gt;")
10
+ .replace(/"/g, "&quot;")
11
+ .replace(/'/g, "&#39;");
12
+ }
13
+ function formatInlineMarkdown(escapedLine) {
14
+ const codeTokens = [];
15
+ const withCodePlaceholders = escapedLine.replace(/`([^`]+)`/g, (_match, code) => {
16
+ const idx = codeTokens.length;
17
+ codeTokens.push(`<code class="cd-md-code">${code}</code>`);
18
+ return `\u0000CDCODE${idx}\u0000`;
19
+ });
20
+ const withBold = withCodePlaceholders.replace(/\*\*([^*]+)\*\*/g, "<strong>$1</strong>");
21
+ return withBold.replace(/\u0000CDCODE(\d+)\u0000/g, (_m, idxStr) => {
22
+ const idx = Number(idxStr);
23
+ return codeTokens[idx] ?? "";
24
+ });
25
+ }
26
+ export function renderSafeMarkdown(markdown) {
27
+ const source = String(markdown || "").replace(/\r\n/g, "\n").trim();
28
+ if (!source)
29
+ return "";
30
+ const fenceParts = source.split(/```([a-zA-Z0-9_-]*)\n([\s\S]*?)```/g);
31
+ const htmlBlocks = [];
32
+ for (let i = 0; i < fenceParts.length; i += 3) {
33
+ const proseChunk = fenceParts[i] || "";
34
+ if (proseChunk.trim().length > 0) {
35
+ htmlBlocks.push(renderProseBlocks(proseChunk));
36
+ }
37
+ if (i + 2 < fenceParts.length) {
38
+ const lang = escapeHtml((fenceParts[i + 1] || "").trim());
39
+ const codeBody = escapeHtml((fenceParts[i + 2] || "").replace(/\n$/, ""));
40
+ const langAttr = lang ? ` data-lang="${lang}"` : "";
41
+ htmlBlocks.push(`<pre class="cd-md-pre"${langAttr}><code class="cd-md-code-block">${codeBody}</code></pre>`);
42
+ }
43
+ }
44
+ return htmlBlocks.join("");
45
+ }
46
+ function renderProseBlocks(prose) {
47
+ const lines = prose.split("\n");
48
+ const out = [];
49
+ let paragraphLines = [];
50
+ let listItems = [];
51
+ let listTag = null;
52
+ const flushParagraph = () => {
53
+ if (paragraphLines.length === 0)
54
+ return;
55
+ out.push(`<p class="cd-md-p">${paragraphLines.join("<br>")}</p>`);
56
+ paragraphLines = [];
57
+ };
58
+ const flushList = () => {
59
+ if (!listTag || listItems.length === 0)
60
+ return;
61
+ out.push(`<${listTag} class="cd-md-list">${listItems.join("")}</${listTag}>`);
62
+ listItems = [];
63
+ listTag = null;
64
+ };
65
+ for (const rawLine of lines) {
66
+ const trimmed = rawLine.trim();
67
+ if (!trimmed) {
68
+ flushParagraph();
69
+ flushList();
70
+ continue;
71
+ }
72
+ const headingMatch = trimmed.match(/^(#{1,3})\s+(.+)$/);
73
+ if (headingMatch) {
74
+ flushParagraph();
75
+ flushList();
76
+ out.push(`<p class="cd-md-heading">${formatInlineMarkdown(escapeHtml(headingMatch[2]))}</p>`);
77
+ continue;
78
+ }
79
+ const bulletMatch = trimmed.match(/^[-*]\s+(.+)$/);
80
+ if (bulletMatch) {
81
+ flushParagraph();
82
+ if (listTag && listTag !== "ul")
83
+ flushList();
84
+ listTag = "ul";
85
+ listItems.push(`<li>${formatInlineMarkdown(escapeHtml(bulletMatch[1]))}</li>`);
86
+ continue;
87
+ }
88
+ const orderedMatch = trimmed.match(/^\d+\.\s+(.+)$/);
89
+ if (orderedMatch) {
90
+ flushParagraph();
91
+ if (listTag && listTag !== "ol")
92
+ flushList();
93
+ listTag = "ol";
94
+ listItems.push(`<li>${formatInlineMarkdown(escapeHtml(orderedMatch[1]))}</li>`);
95
+ continue;
96
+ }
97
+ flushList();
98
+ paragraphLines.push(formatInlineMarkdown(escapeHtml(trimmed)));
99
+ }
100
+ flushParagraph();
101
+ flushList();
102
+ return out.join("");
103
+ }
104
+ export function buildUnifiedDiffElement(doc, diffText) {
105
+ const container = doc.createElement("div");
106
+ container.className = "cd-diff-lines";
107
+ const lines = String(diffText || "").replace(/\r\n/g, "\n").split("\n");
108
+ for (const line of lines) {
109
+ if (line.startsWith("--- ") || line.startsWith("+++ ")) {
110
+ continue;
111
+ }
112
+ const row = doc.createElement("div");
113
+ if (line.startsWith("@@")) {
114
+ row.className = "cd-diff-line cd-diff-hunk";
115
+ }
116
+ else if (line.startsWith("+")) {
117
+ row.className = "cd-diff-line cd-diff-add";
118
+ }
119
+ else if (line.startsWith("-")) {
120
+ row.className = "cd-diff-line cd-diff-del";
121
+ }
122
+ else {
123
+ row.className = "cd-diff-line cd-diff-ctx";
124
+ }
125
+ row.textContent = line.length > 0 ? line : " ";
126
+ container.appendChild(row);
127
+ }
128
+ return container;
129
+ }
@@ -0,0 +1,38 @@
1
+ import type { BoundingRectSnapshot, ElementCandidateInfo, ElementCandidateRelation, ElementReferenceSnapshot, SmartComponentDescription } from "./types.js";
2
+ export declare const MANDATORY_EXCLUDED_SELECTORS: readonly string[];
3
+ export declare const ALLOWED_HTML_ATTRIBUTES: readonly string[];
4
+ export declare function buildExcludedSelectorList(customSelectors?: string[]): string[];
5
+ export declare function getParentOrHostElement(node: Element | null): Element | null;
6
+ export declare function isElementExcluded(node: Element | null, customSelectors?: string[]): boolean;
7
+ export declare function isSelectableElement(node: Element | null, customSelectors?: string[]): boolean;
8
+ export declare function extractSanitizedAttributes(el: Element): Record<string, string>;
9
+ export declare function extractSanitizedText(el: Element, customSelectors?: string[]): string | null;
10
+ export declare function computeSelector(el: Element): string;
11
+ export declare function computeDomPath(el: Element): string;
12
+ export declare function computeBoundingRect(el: Element): BoundingRectSnapshot;
13
+ export declare function describeElementCandidate(el: Element, relation: ElementCandidateRelation, depth: number, customSelectors?: string[]): ElementCandidateInfo;
14
+ /**
15
+ * Resolves a hovered/clicked DOM leaf into a meaningful, human-recognizable UI component
16
+ * for Production ("smart") mode so non-technical users never wrestle with tiny `<span>`/`<svg>`
17
+ * fragments or overlapping DevTools layer lists.
18
+ */
19
+ export declare function resolveSmartComponent(primaryTarget: Element | null, customSelectors?: string[]): Element | null;
20
+ /**
21
+ * Produces a plain-language, jargon-free label for any DOM element (e.g. `"Upgrade Cluster" button`,
22
+ * `"Order Summary" card`, `"Email Address" input field`) with zero CSS selectors or pixel metrics.
23
+ */
24
+ export declare function describeSmartComponent(el: Element, customSelectors?: string[], originalLeaf?: Element | null): SmartComponentDescription;
25
+ export declare function computeFriendlyComponentLabel(el: Element, customSelectors?: string[]): string;
26
+ export declare function resolveAncestorChain(el: Element | null, customSelectors?: string[], maxDepth?: number): Element[];
27
+ /**
28
+ * Builds an ordered list of candidate elements for a pointer location so users can
29
+ * disambiguate overlapping sibling layers, deeply nested children, and parent containers.
30
+ *
31
+ * Order:
32
+ * 1. Direct child elements (if the target is a container with immediate selectable children)
33
+ * 2. Primary hovered/clicked target ("target")
34
+ * 3. Overlapping non-ancestor elements at the same screen coordinate ("overlap")
35
+ * 4. DOM ancestors from immediate parent up to top-level layout section ("ancestor")
36
+ */
37
+ export declare function resolveCandidateStack(primaryTarget: Element | null, pointElements?: Element[], customSelectors?: string[], maxCandidates?: number): ElementCandidateInfo[];
38
+ export declare function captureElementSnapshot(el: Element, customSelectors?: string[], clientRef?: string, extraMetadata?: Record<string, unknown>): ElementReferenceSnapshot | null;