appback-remoteagent 0.13.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 (46) hide show
  1. package/.env.example +39 -0
  2. package/LICENSE +21 -0
  3. package/README.md +371 -0
  4. package/bin/remoteagent.js +2 -0
  5. package/dist/adapters/claude-adapter.js +78 -0
  6. package/dist/adapters/codex-adapter.js +241 -0
  7. package/dist/adapters/provider-adapter.js +1 -0
  8. package/dist/adapters/shell-adapter.js +44 -0
  9. package/dist/adapters/windows-shell.js +111 -0
  10. package/dist/bot.js +2135 -0
  11. package/dist/config.js +170 -0
  12. package/dist/index.js +534 -0
  13. package/dist/secret-helper.js +24 -0
  14. package/dist/services/agent-memory-service.js +737 -0
  15. package/dist/services/bot-management-service.js +626 -0
  16. package/dist/services/bridge-service.js +807 -0
  17. package/dist/services/local-ui-service.js +533 -0
  18. package/dist/services/provider-setup-service.js +284 -0
  19. package/dist/services/remote-shell-service.js +97 -0
  20. package/dist/store/file-store.js +690 -0
  21. package/dist/telegram-fetch.js +85 -0
  22. package/dist/types.js +1 -0
  23. package/docs/ARCHITECTURE.md +170 -0
  24. package/docs/COKACDIR_NOTES.md +79 -0
  25. package/docs/ERROR_NORMALIZATION.md +46 -0
  26. package/docs/MINI_APP.md +112 -0
  27. package/docs/MVP.md +108 -0
  28. package/docs/OPERATIONS.md +181 -0
  29. package/docs/RELEASING.md +87 -0
  30. package/docs/SESSION_DIRECTORY_PLAN.md +506 -0
  31. package/package.json +47 -0
  32. package/scripts/bump-version.sh +23 -0
  33. package/scripts/finish-claude-login.sh +48 -0
  34. package/scripts/install-claude.sh +6 -0
  35. package/scripts/install-codex.sh +8 -0
  36. package/scripts/install.ps1 +51 -0
  37. package/scripts/install.sh +101 -0
  38. package/scripts/mock-adapter.sh +7 -0
  39. package/scripts/restart-after-bot-op.sh +118 -0
  40. package/scripts/selftest-telegram-update.mjs +359 -0
  41. package/scripts/start-claude-login.sh +4 -0
  42. package/scripts/start.ps1 +39 -0
  43. package/scripts/start.sh +54 -0
  44. package/scripts/stop.ps1 +40 -0
  45. package/scripts/stop.sh +39 -0
  46. package/tsconfig.json +20 -0
@@ -0,0 +1,40 @@
1
+ $ErrorActionPreference = "Stop"
2
+
3
+ $dataDir = if ($env:DATA_DIR) { $env:DATA_DIR } else { Join-Path $HOME ".remoteagent" }
4
+ $pidFile = Join-Path $dataDir "remoteagent.pid"
5
+
6
+ function Get-DescendantProcessIds {
7
+ param(
8
+ [int]$ParentId
9
+ )
10
+
11
+ $children = @(Get-CimInstance Win32_Process -Filter "ParentProcessId = $ParentId" -ErrorAction SilentlyContinue)
12
+ $ids = @()
13
+
14
+ foreach ($child in $children) {
15
+ $ids += [int]$child.ProcessId
16
+ $ids += @(Get-DescendantProcessIds -ParentId ([int]$child.ProcessId))
17
+ }
18
+
19
+ return $ids
20
+ }
21
+
22
+ if (-not (Test-Path $pidFile)) {
23
+ Write-Host "RemoteAgent is not running."
24
+ exit 0
25
+ }
26
+
27
+ $remoteAgentPid = [int](Get-Content $pidFile)
28
+ $allPids = @($remoteAgentPid) + @(Get-DescendantProcessIds -ParentId $remoteAgentPid)
29
+ $runningPids = @($allPids | Where-Object { Get-Process -Id $_ -ErrorAction SilentlyContinue })
30
+
31
+ if ($runningPids.Count -gt 0) {
32
+ $runningPids = @($runningPids | Sort-Object -Descending)
33
+ $runningPids | ForEach-Object { Stop-Process -Id $_ -Force -ErrorAction SilentlyContinue }
34
+
35
+ Write-Host "Stopped RemoteAgent process tree: $($runningPids -join ', ')"
36
+ } else {
37
+ Write-Host "RemoteAgent PID file existed, but process was not running."
38
+ }
39
+
40
+ Remove-Item $pidFile -Force -ErrorAction SilentlyContinue
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ DATA_DIR="${DATA_DIR:-$HOME/.remoteagent}"
5
+ PID_FILE="$DATA_DIR/remoteagent.pid"
6
+
7
+ if command -v systemctl >/dev/null 2>&1 && systemctl cat remoteagent >/dev/null 2>&1; then
8
+ if sudo -n true >/dev/null 2>&1; then
9
+ sudo systemctl stop remoteagent
10
+ exit 0
11
+ fi
12
+
13
+ echo "remoteagent.service is installed. Use sudo systemctl stop remoteagent." >&2
14
+ exit 1
15
+ fi
16
+
17
+ if [ ! -f "$PID_FILE" ]; then
18
+ echo "RemoteAgent is not running."
19
+ exit 0
20
+ fi
21
+
22
+ PID="$(cat "$PID_FILE")"
23
+ if kill -0 "$PID" 2>/dev/null; then
24
+ kill "$PID"
25
+ wait_for_exit=0
26
+ while kill -0 "$PID" 2>/dev/null; do
27
+ wait_for_exit=$((wait_for_exit + 1))
28
+ if [ "$wait_for_exit" -ge 20 ]; then
29
+ kill -9 "$PID" 2>/dev/null || true
30
+ break
31
+ fi
32
+ sleep 0.2
33
+ done
34
+ echo "Stopped RemoteAgent PID $PID"
35
+ else
36
+ echo "RemoteAgent PID file existed, but process was not running."
37
+ fi
38
+
39
+ rm -f "$PID_FILE"
package/tsconfig.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "outDir": "dist",
7
+ "rootDir": "src",
8
+ "strict": true,
9
+ "esModuleInterop": true,
10
+ "forceConsistentCasingInFileNames": true,
11
+ "skipLibCheck": true,
12
+ "resolveJsonModule": true,
13
+ "types": [
14
+ "node"
15
+ ]
16
+ },
17
+ "include": [
18
+ "src/**/*.ts"
19
+ ]
20
+ }