clay-server 2.5.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 (87) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +281 -0
  3. package/bin/cli.js +2385 -0
  4. package/lib/cli-sessions.js +270 -0
  5. package/lib/config.js +237 -0
  6. package/lib/daemon.js +489 -0
  7. package/lib/ipc.js +112 -0
  8. package/lib/notes.js +120 -0
  9. package/lib/pages.js +664 -0
  10. package/lib/project.js +1433 -0
  11. package/lib/public/app.js +2795 -0
  12. package/lib/public/apple-touch-icon-dark.png +0 -0
  13. package/lib/public/apple-touch-icon.png +0 -0
  14. package/lib/public/css/base.css +264 -0
  15. package/lib/public/css/diff.css +128 -0
  16. package/lib/public/css/filebrowser.css +1114 -0
  17. package/lib/public/css/highlight.css +144 -0
  18. package/lib/public/css/icon-strip.css +296 -0
  19. package/lib/public/css/input.css +573 -0
  20. package/lib/public/css/menus.css +856 -0
  21. package/lib/public/css/messages.css +1445 -0
  22. package/lib/public/css/mobile-nav.css +354 -0
  23. package/lib/public/css/overlays.css +697 -0
  24. package/lib/public/css/rewind.css +505 -0
  25. package/lib/public/css/server-settings.css +761 -0
  26. package/lib/public/css/sidebar.css +936 -0
  27. package/lib/public/css/sticky-notes.css +358 -0
  28. package/lib/public/css/title-bar.css +314 -0
  29. package/lib/public/favicon-dark.svg +1 -0
  30. package/lib/public/favicon.svg +1 -0
  31. package/lib/public/icon-192-dark.png +0 -0
  32. package/lib/public/icon-192.png +0 -0
  33. package/lib/public/icon-512-dark.png +0 -0
  34. package/lib/public/icon-512.png +0 -0
  35. package/lib/public/icon-mono.svg +1 -0
  36. package/lib/public/index.html +762 -0
  37. package/lib/public/manifest.json +27 -0
  38. package/lib/public/modules/diff.js +398 -0
  39. package/lib/public/modules/events.js +21 -0
  40. package/lib/public/modules/filebrowser.js +1411 -0
  41. package/lib/public/modules/fileicons.js +172 -0
  42. package/lib/public/modules/icons.js +54 -0
  43. package/lib/public/modules/input.js +584 -0
  44. package/lib/public/modules/markdown.js +356 -0
  45. package/lib/public/modules/notifications.js +649 -0
  46. package/lib/public/modules/qrcode.js +70 -0
  47. package/lib/public/modules/rewind.js +345 -0
  48. package/lib/public/modules/server-settings.js +510 -0
  49. package/lib/public/modules/sidebar.js +1083 -0
  50. package/lib/public/modules/state.js +3 -0
  51. package/lib/public/modules/sticky-notes.js +688 -0
  52. package/lib/public/modules/terminal.js +697 -0
  53. package/lib/public/modules/theme.js +738 -0
  54. package/lib/public/modules/tools.js +1608 -0
  55. package/lib/public/modules/utils.js +56 -0
  56. package/lib/public/style.css +15 -0
  57. package/lib/public/sw.js +75 -0
  58. package/lib/push.js +124 -0
  59. package/lib/sdk-bridge.js +989 -0
  60. package/lib/server.js +582 -0
  61. package/lib/sessions.js +424 -0
  62. package/lib/terminal-manager.js +187 -0
  63. package/lib/terminal.js +24 -0
  64. package/lib/themes/ayu-light.json +9 -0
  65. package/lib/themes/catppuccin-latte.json +9 -0
  66. package/lib/themes/catppuccin-mocha.json +9 -0
  67. package/lib/themes/clay-light.json +10 -0
  68. package/lib/themes/clay.json +10 -0
  69. package/lib/themes/dracula.json +9 -0
  70. package/lib/themes/everforest-light.json +9 -0
  71. package/lib/themes/everforest.json +9 -0
  72. package/lib/themes/github-light.json +9 -0
  73. package/lib/themes/gruvbox-dark.json +9 -0
  74. package/lib/themes/gruvbox-light.json +9 -0
  75. package/lib/themes/monokai.json +9 -0
  76. package/lib/themes/nord-light.json +9 -0
  77. package/lib/themes/nord.json +9 -0
  78. package/lib/themes/one-dark.json +9 -0
  79. package/lib/themes/one-light.json +9 -0
  80. package/lib/themes/rose-pine-dawn.json +9 -0
  81. package/lib/themes/rose-pine.json +9 -0
  82. package/lib/themes/solarized-dark.json +9 -0
  83. package/lib/themes/solarized-light.json +9 -0
  84. package/lib/themes/tokyo-night-light.json +9 -0
  85. package/lib/themes/tokyo-night.json +9 -0
  86. package/lib/updater.js +97 -0
  87. package/package.json +47 -0
package/lib/notes.js ADDED
@@ -0,0 +1,120 @@
1
+ var fs = require("fs");
2
+ var path = require("path");
3
+ var crypto = require("crypto");
4
+ var config = require("./config");
5
+
6
+ function createNotesManager(opts) {
7
+ var cwd = opts.cwd;
8
+
9
+ // Storage path: ~/.claude-relay/notes/{encodedCwd}.json
10
+ var encodedCwd = cwd.replace(/\//g, "-");
11
+ var notesDir = path.join(config.CONFIG_DIR, "notes");
12
+ var notesFile = path.join(notesDir, encodedCwd + ".json");
13
+
14
+ // In-memory cache
15
+ var notes = loadFromDisk();
16
+
17
+ function generateId() {
18
+ return "n_" + Date.now() + "_" + crypto.randomBytes(3).toString("hex");
19
+ }
20
+
21
+ function loadFromDisk() {
22
+ try {
23
+ var data = fs.readFileSync(notesFile, "utf8");
24
+ var parsed = JSON.parse(data);
25
+ return parsed.notes || [];
26
+ } catch (e) {
27
+ return [];
28
+ }
29
+ }
30
+
31
+ function saveToDisk() {
32
+ try {
33
+ fs.mkdirSync(notesDir, { recursive: true });
34
+ var tmpPath = notesFile + ".tmp";
35
+ fs.writeFileSync(tmpPath, JSON.stringify({ notes: notes }, null, 2));
36
+ fs.renameSync(tmpPath, notesFile);
37
+ } catch (e) {
38
+ console.error("[notes] Failed to save:", e.message);
39
+ }
40
+ }
41
+
42
+ function list() {
43
+ return notes;
44
+ }
45
+
46
+ function create(data) {
47
+ var now = Date.now();
48
+ var note = {
49
+ id: generateId(),
50
+ text: data.text || "",
51
+ x: typeof data.x === "number" ? data.x : 100,
52
+ y: typeof data.y === "number" ? data.y : 100,
53
+ w: typeof data.w === "number" ? data.w : 240,
54
+ h: typeof data.h === "number" ? data.h : 180,
55
+ color: data.color || "yellow",
56
+ minimized: false,
57
+ zIndex: notes.length + 1,
58
+ createdAt: now,
59
+ updatedAt: now,
60
+ };
61
+ notes.push(note);
62
+ saveToDisk();
63
+ return note;
64
+ }
65
+
66
+ function update(id, changes) {
67
+ for (var i = 0; i < notes.length; i++) {
68
+ if (notes[i].id === id) {
69
+ var allowed = ["text", "x", "y", "w", "h", "color", "minimized", "zIndex"];
70
+ for (var j = 0; j < allowed.length; j++) {
71
+ var key = allowed[j];
72
+ if (changes[key] !== undefined) {
73
+ notes[i][key] = changes[key];
74
+ }
75
+ }
76
+ notes[i].updatedAt = Date.now();
77
+ saveToDisk();
78
+ return notes[i];
79
+ }
80
+ }
81
+ return null;
82
+ }
83
+
84
+ function remove(id) {
85
+ for (var i = 0; i < notes.length; i++) {
86
+ if (notes[i].id === id) {
87
+ notes.splice(i, 1);
88
+ saveToDisk();
89
+ return true;
90
+ }
91
+ }
92
+ return false;
93
+ }
94
+
95
+ function bringToFront(id) {
96
+ var maxZ = 0;
97
+ for (var i = 0; i < notes.length; i++) {
98
+ if (notes[i].zIndex > maxZ) maxZ = notes[i].zIndex;
99
+ }
100
+ // Normalize if z-index grows too large
101
+ if (maxZ > 10000) {
102
+ notes.sort(function (a, b) { return a.zIndex - b.zIndex; });
103
+ for (var k = 0; k < notes.length; k++) {
104
+ notes[k].zIndex = k + 1;
105
+ }
106
+ maxZ = notes.length;
107
+ }
108
+ return update(id, { zIndex: maxZ + 1 });
109
+ }
110
+
111
+ return {
112
+ list: list,
113
+ create: create,
114
+ update: update,
115
+ remove: remove,
116
+ bringToFront: bringToFront,
117
+ };
118
+ }
119
+
120
+ module.exports = { createNotesManager: createNotesManager };