claude-simple 0.2.5 → 0.2.7

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.
package/README.md CHANGED
@@ -213,6 +213,8 @@ Legacy Node hub: `npm run gateway` → `gateway.js` (prefer the Go binary).
213
213
  | Codex | `codex exec --json` / `codex exec resume <id>` | thread_id | `~/.codex/sessions/**/rollout-*.jsonl` |
214
214
  | Grok | `grok -p … --output-format streaming-json` | `--resume <id>` | `~/.grok/sessions/<cwd>/<id>/` |
215
215
 
216
+ The Memory tab lists files for the selected session's agent and loads their contents on click: Claude project memory, Codex account memory, or Grok session memory. Meta Agent can use `get_session_jsonl` to inspect a specific agent session's raw JSONL in bounded pages.
217
+
216
218
  ## Scripts
217
219
 
218
220
  | Script | Description |
package/bin/edge-ctl.js CHANGED
@@ -10,6 +10,7 @@ import { spawn, spawnSync } from 'child_process';
10
10
  import fs from 'fs';
11
11
  import os from 'os';
12
12
  import path from 'path';
13
+ import { fileURLToPath } from 'url';
13
14
 
14
15
  const LAUNCHD_LABEL = 'system/com.claude-simple.edge';
15
16
  const LAUNCHD_PLIST = '/Library/LaunchDaemons/com.claude-simple.edge.plist';
@@ -63,15 +64,31 @@ function detectBackend() {
63
64
  return null;
64
65
  }
65
66
 
66
- function asRootArgs(cmd, args) {
67
- if (process.getuid && process.getuid() === 0) return { cmd, args };
68
- if (!hasCmd('sudo')) return { cmd, args };
69
- return { cmd: 'sudo', args: [cmd, ...args] };
67
+ function isRoot() {
68
+ return typeof process.getuid === 'function' && process.getuid() === 0;
69
+ }
70
+
71
+ /** Re-exec this CLI via sudo so launchctl/systemctl can touch the system unit. */
72
+ function ensureRoot() {
73
+ if (isRoot()) return;
74
+ if (!hasCmd('sudo')) return;
75
+ const script = fileURLToPath(import.meta.url);
76
+ const args = process.argv.slice(2);
77
+ const candidates = ['/usr/local/bin/claude-edge', process.argv[1], script].filter(Boolean);
78
+ const seen = new Set();
79
+ for (const entry of candidates) {
80
+ const resolved = path.resolve(entry);
81
+ if (seen.has(resolved) || !fs.existsSync(resolved)) continue;
82
+ seen.add(resolved);
83
+ const r = spawnSync('sudo', ['-n', resolved, ...args], { stdio: 'inherit' });
84
+ if (r.status === 0) process.exit(0);
85
+ }
86
+ const r = spawnSync('sudo', [process.execPath, script, ...args], { stdio: 'inherit' });
87
+ process.exit(r.status ?? 1);
70
88
  }
71
89
 
72
90
  function runRoot(cmd, args, opts = {}) {
73
- const t = asRootArgs(cmd, args);
74
- return run(t.cmd, t.args, opts);
91
+ return run(cmd, args, opts);
75
92
  }
76
93
 
77
94
  function fail(msg, extra) {
@@ -108,6 +125,7 @@ function tailFile(file, n) {
108
125
  }
109
126
 
110
127
  function cmdStatus(backend) {
128
+ ensureRoot();
111
129
  if (backend === 'launchd') {
112
130
  const r = runRoot('launchctl', ['print', LAUNCHD_LABEL]);
113
131
  if (r.status !== 0) {
@@ -156,6 +174,7 @@ function cmdStatus(backend) {
156
174
  }
157
175
 
158
176
  function cmdStart(backend) {
177
+ ensureRoot();
159
178
  if (backend === 'launchd') {
160
179
  runRoot('launchctl', ['enable', LAUNCHD_LABEL]);
161
180
  const loaded = runRoot('launchctl', ['print', LAUNCHD_LABEL]);
@@ -174,6 +193,7 @@ function cmdStart(backend) {
174
193
  }
175
194
 
176
195
  function cmdStop(backend) {
196
+ ensureRoot();
177
197
  if (backend === 'launchd') {
178
198
  runRoot('launchctl', ['disable', LAUNCHD_LABEL]);
179
199
  runRoot('launchctl', ['bootout', LAUNCHD_LABEL]);
@@ -186,6 +206,7 @@ function cmdStop(backend) {
186
206
  }
187
207
 
188
208
  function cmdRestart(backend) {
209
+ ensureRoot();
189
210
  if (backend === 'launchd') {
190
211
  runRoot('launchctl', ['enable', LAUNCHD_LABEL]);
191
212
  const loaded = runRoot('launchctl', ['print', LAUNCHD_LABEL]);
@@ -204,6 +225,7 @@ function cmdRestart(backend) {
204
225
  }
205
226
 
206
227
  function cmdLogs(backend, mode) {
228
+ if (backend === 'systemd') ensureRoot();
207
229
  if (backend === 'launchd') {
208
230
  if (mode === '-f' || mode === '--follow') {
209
231
  const child = spawn('tail', ['-n', '50', '-F', MAC_OUT, MAC_ERR], { stdio: 'inherit' });