stella-coder 5.3.1 → 5.3.2

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 (51) hide show
  1. package/COMMANDS.md +47 -0
  2. package/install-av.bat +17 -0
  3. package/install-stella-pkg.bat +21 -0
  4. package/oneline-av.ps1 +7 -0
  5. package/oneline-stella.ps1 +2 -0
  6. package/package.json +1 -1
  7. package/releases/stella-antivirus/database.mjs +871 -0
  8. package/releases/stella-antivirus/index.mjs +8 -0
  9. package/releases/stella-antivirus/install-av.bat +12 -0
  10. package/releases/stella-antivirus/scanner.mjs +591 -0
  11. package/releases/stella-antivirus/ui.mjs +570 -0
  12. package/releases/stella-antivirus.zip +0 -0
  13. package/releases/stella-coder/README.md +67 -0
  14. package/releases/stella-coder/adb.mjs +200 -0
  15. package/releases/stella-coder/autonomous-agent.mjs +550 -0
  16. package/releases/stella-coder/banner.mjs +46 -0
  17. package/releases/stella-coder/browser-control.mjs +274 -0
  18. package/releases/stella-coder/build.mjs +151 -0
  19. package/releases/stella-coder/charts.mjs +411 -0
  20. package/releases/stella-coder/coding-brain.mjs +753 -0
  21. package/releases/stella-coder/game-engine.mjs +708 -0
  22. package/releases/stella-coder/gdrive-backup.mjs +338 -0
  23. package/releases/stella-coder/git-api.mjs +407 -0
  24. package/releases/stella-coder/gmail.mjs +415 -0
  25. package/releases/stella-coder/home-assistant.mjs +168 -0
  26. package/releases/stella-coder/index.mjs +5810 -0
  27. package/releases/stella-coder/install-stella.bat +12 -0
  28. package/releases/stella-coder/markdown.mjs +100 -0
  29. package/releases/stella-coder/mcp.mjs +296 -0
  30. package/releases/stella-coder/package.json +67 -0
  31. package/releases/stella-coder/presentations.mjs +1106 -0
  32. package/releases/stella-coder/protect.mjs +182 -0
  33. package/releases/stella-coder/screen-monitor.mjs +334 -0
  34. package/releases/stella-coder/sea-config.json +5 -0
  35. package/releases/stella-coder/security.mjs +237 -0
  36. package/releases/stella-coder/subagents.mjs +142 -0
  37. package/releases/stella-coder/telegram-bot.mjs +824 -0
  38. package/releases/stella-coder/tg-server.mjs +116 -0
  39. package/releases/stella-coder/theme.mjs +91 -0
  40. package/releases/stella-coder/tools.mjs +3143 -0
  41. package/releases/stella-coder/web-parser.mjs +229 -0
  42. package/releases/stella-coder/yandex-maps.mjs +426 -0
  43. package/releases/stella-coder.zip +0 -0
  44. package/run-antivirus.bat +4 -0
  45. package/setup-antivirus.bat +64 -0
  46. package/setup-full.bat +65 -0
  47. package/setup-stella.bat +46 -0
  48. package/stella-cli/index.mjs +11 -1
  49. package/stella-cli/protect.mjs +182 -0
  50. package/stella.bat +3 -0
  51. package/tests/test-modules.mjs +101 -0
@@ -0,0 +1,200 @@
1
+ import { execSync } from "node:child_process"
2
+ import fs from "node:fs"
3
+ import path from "node:path"
4
+ import os from "node:os"
5
+
6
+ const ADB_DIR = path.join(os.homedir(), ".stella", "adb")
7
+
8
+ function ensureDir() { if (!fs.existsSync(ADB_DIR)) fs.mkdirSync(ADB_DIR, { recursive: true }) }
9
+
10
+ function adb(args) {
11
+ try {
12
+ return execSync(`adb ${args}`, { encoding: "utf8", timeout: 10000 }).trim()
13
+ } catch (e) {
14
+ return { error: e.stderr?.trim() || e.message }
15
+ }
16
+ }
17
+
18
+ export class ADB {
19
+ constructor() { ensureDir() }
20
+
21
+ isAvailable() {
22
+ try {
23
+ execSync("adb --version", { encoding: "utf8", stdio: "ignore" })
24
+ return true
25
+ } catch { return false }
26
+ }
27
+
28
+ getDevices() {
29
+ const out = adb("devices")
30
+ if (out.error) return { success: false, error: out.error }
31
+ const lines = out.split("\n").filter(l => l.trim() && !l.includes("List of devices"))
32
+ const devices = lines.map(l => { const [id, status] = l.trim().split(/\s+/); return { id, status } })
33
+ return { success: true, devices }
34
+ }
35
+
36
+ getState(serial) {
37
+ const s = serial ? `-s ${serial}` : ""
38
+ const out = adb(`${s} get-state`)
39
+ return out.error ? { success: false, error: out.error } : { success: true, state: out }
40
+ }
41
+
42
+ shell(serial, cmd) {
43
+ const s = serial ? `-s ${serial}` : ""
44
+ const out = adb(`${s} shell ${cmd}`)
45
+ return out.error ? { success: false, error: out.error } : { success: true, output: out }
46
+ }
47
+
48
+ screenshot(serial) {
49
+ ensureDir()
50
+ const s = serial ? `-s ${serial}` : ""
51
+ const filename = `screenshot_${Date.now()}.png`
52
+ const localPath = path.join(ADB_DIR, filename)
53
+ adb(`${s} exec-out screencap -p > "${localPath}"`)
54
+ if (fs.existsSync(localPath) && fs.statSync(localPath).size > 0) {
55
+ return { success: true, path: localPath }
56
+ }
57
+ try {
58
+ adb(`${s} shell screencap -p /sdcard/screen.png`)
59
+ adb(`${s} pull /sdcard/screen.png "${localPath}"`)
60
+ adb(`${s} shell rm /sdcard/screen.png`)
61
+ if (fs.existsSync(localPath) && fs.statSync(localPath).size > 0) return { success: true, path: localPath }
62
+ } catch {}
63
+ return { success: false, error: "Screenshot failed" }
64
+ }
65
+
66
+ tap(serial, x, y) {
67
+ const s = serial ? `-s ${serial}` : ""
68
+ const out = adb(`${s} shell input tap ${x} ${y}`)
69
+ return out.error ? { success: false, error: out.error } : { success: true }
70
+ }
71
+
72
+ swipe(serial, x1, y1, x2, y2, duration = 300) {
73
+ const s = serial ? `-s ${serial}` : ""
74
+ const out = adb(`${s} shell input swipe ${x1} ${y1} ${x2} ${y2} ${duration}`)
75
+ return out.error ? { success: false, error: out.error } : { success: true }
76
+ }
77
+
78
+ text(serial, text) {
79
+ const s = serial ? `-s ${serial}` : ""
80
+ const escaped = text.replace(/ /g, "%s").replace(/"/g, '\\"')
81
+ const out = adb(`${s} shell input text "${escaped}"`)
82
+ return out.error ? { success: false, error: out.error } : { success: true }
83
+ }
84
+
85
+ key(serial, keycode) {
86
+ const s = serial ? `-s ${serial}` : ""
87
+ const out = adb(`${s} shell input keyevent ${keycode}`)
88
+ return out.error ? { success: false, error: out.error } : { success: true }
89
+ }
90
+
91
+ pressHome(serial) { return this.key(serial, 3) }
92
+ pressBack(serial) { return this.key(serial, 4) }
93
+ pressMenu(serial) { return this.key(serial, 82) }
94
+ pressPower(serial) { return this.key(serial, 26) }
95
+ pressVolumeUp(serial) { return this.key(serial, 24) }
96
+ pressVolumeDown(serial) { return this.key(serial, 25) }
97
+
98
+ installApp(serial, apkPath) {
99
+ if (!fs.existsSync(apkPath)) return { success: false, error: "APK not found" }
100
+ const s = serial ? `-s ${serial}` : ""
101
+ const out = adb(`${s} install "${apkPath}"`)
102
+ if (out.error) return { success: false, error: out.error }
103
+ return { success: true, output: out }
104
+ }
105
+
106
+ uninstallApp(serial, packageName) {
107
+ const s = serial ? `-s ${serial}` : ""
108
+ const out = adb(`${s} uninstall ${packageName}`)
109
+ if (out.error) return { success: false, error: out.error }
110
+ return { success: true, output: out }
111
+ }
112
+
113
+ listPackages(serial, filter = "") {
114
+ const s = serial ? `-s ${serial}` : ""
115
+ const out = adb(`${s} shell pm list packages ${filter}`)
116
+ if (out.error) return { success: false, error: out.error }
117
+ const packages = out.split("\n").filter(l => l.trim()).map(l => l.replace("package:", "").trim())
118
+ return { success: true, packages }
119
+ }
120
+
121
+ getBattery(serial) {
122
+ const s = serial ? `-s ${serial}` : ""
123
+ const out = adb(`${s} shell dumpsys battery`)
124
+ if (out.error) return { success: false, error: out.error }
125
+ const level = out.match(/level:\s*(\d+)/)?.[1]
126
+ const temp = out.match(/temperature:\s*(\d+)/)?.[1]
127
+ const status = out.match(/status:\s*(\d+)/)?.[1]
128
+ const statusMap = { 1: "unknown", 2: "charging", 3: "discharging", 4: "not charging", 5: "full" }
129
+ return { success: true, level: parseInt(level), temperature: temp ? parseInt(temp) / 10 : null, status: statusMap[status] || "unknown" }
130
+ }
131
+
132
+ getInfo(serial) {
133
+ const s = serial ? `-s ${serial}` : ""
134
+ const model = adb(`${s} shell getprop ro.product.model`)
135
+ const brand = adb(`${s} shell getprop ro.product.brand`)
136
+ const android = adb(`${s} shell getprop ro.build.version.release`)
137
+ const sdk = adb(`${s} shell getprop ro.build.version.sdk`)
138
+ const resolution = adb(`${s} shell wm size`)
139
+ const density = adb(`${s} shell wm density`)
140
+ return {
141
+ success: true,
142
+ model: model.error ? "unknown" : model,
143
+ brand: brand.error ? "unknown" : brand,
144
+ android: android.error ? "unknown" : android,
145
+ sdk: sdk.error ? "unknown" : sdk,
146
+ resolution: resolution.error ? "unknown" : resolution.replace("Physical size: ", ""),
147
+ density: density.error ? "unknown" : density.replace("Physical density: ", ""),
148
+ }
149
+ }
150
+
151
+ startApp(serial, packageName) {
152
+ return this.shell(serial, `monkey -p ${packageName} -c android.intent.category.LAUNCHER 1`)
153
+ }
154
+
155
+ killApp(serial, packageName) {
156
+ return this.shell(serial, `am force-stop ${packageName}`)
157
+ }
158
+
159
+ pullFile(serial, remotePath, localPath) {
160
+ const s = serial ? `-s ${serial}` : ""
161
+ ensureDir()
162
+ const dest = localPath || path.join(ADB_DIR, path.basename(remotePath))
163
+ const out = adb(`${s} pull "${remotePath}" "${dest}"`)
164
+ if (out.error) return { success: false, error: out.error }
165
+ return { success: true, path: dest }
166
+ }
167
+
168
+ pushFile(serial, localPath, remotePath) {
169
+ const s = serial ? `-s ${serial}` : ""
170
+ const out = adb(`${s} push "${localPath}" "${remotePath}"`)
171
+ if (out.error) return { success: false, error: out.error }
172
+ return { success: true }
173
+ }
174
+
175
+ reboot(serial) {
176
+ const s = serial ? `-s ${serial}` : ""
177
+ const out = adb(`${s} reboot`)
178
+ if (out.error) return { success: false, error: out.error }
179
+ return { success: true }
180
+ }
181
+
182
+ logcat(serial, filter = "", lines = 50) {
183
+ const s = serial ? `-s ${serial}` : ""
184
+ const out = adb(`${s} logcat -d -t ${lines} ${filter}`)
185
+ if (out.error) return { success: false, error: out.error }
186
+ return { success: true, log: out }
187
+ }
188
+
189
+ wifiConnect(ip, port = 5555) {
190
+ const out = adb(`connect ${ip}:${port}`)
191
+ if (out.error) return { success: false, error: out.error }
192
+ return { success: true, output: out }
193
+ }
194
+
195
+ wifiDisconnect(ip) {
196
+ const out = adb(`disconnect ${ip}`)
197
+ if (out.error) return { success: false, error: out.error }
198
+ return { success: true, output: out }
199
+ }
200
+ }