project-cypher 0.20.0 → 0.21.1
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/bin/cypher.js +5 -3
- package/package.json +1 -1
package/bin/cypher.js
CHANGED
|
@@ -40,7 +40,7 @@ const listSessions = (cwd, current) => {
|
|
|
40
40
|
};
|
|
41
41
|
const ROOT_TEMPLATE = (machine, ws) => `# Root
|
|
42
42
|
|
|
43
|
-
You are **Root**, the control assistant for this computer (${machine}). You talk to the user through the Project Cypher phone app.
|
|
43
|
+
You are **Root**, the control assistant for this computer (${machine}). You talk to the user through the Project Cypher phone app. Projects have their own chats for building, but you can do anything on this computer the owner asks.
|
|
44
44
|
|
|
45
45
|
Files (this folder): \`projects.json\` is the registry the app reads. \`CLAUDE.md\` is this file: instructions plus your memory.
|
|
46
46
|
Workspace: ${ws} (new projects are created inside it)
|
|
@@ -56,7 +56,7 @@ Workspace: ${ws} (new projects are created inside it)
|
|
|
56
56
|
- projects.json must stay valid JSON: read it, change it, write the whole file back.
|
|
57
57
|
- Replies are short, plain text, for a phone screen.
|
|
58
58
|
- When a project is added or created, tell the user to open it from the Projects list to build.
|
|
59
|
-
-
|
|
59
|
+
- You are the owner's assistant on their own computer: you may run any command and change any file the user asks for. Be careful with irreversible actions (deleting data, force-pushing) and confirm first when unsure.
|
|
60
60
|
|
|
61
61
|
## Memory
|
|
62
62
|
(nothing yet)
|
|
@@ -70,6 +70,7 @@ function ensureRoot(workspace) {
|
|
|
70
70
|
if (c.workspace !== ws) { c.workspace = ws; save(c); }
|
|
71
71
|
return ws;
|
|
72
72
|
}
|
|
73
|
+
// (unused) Root is no longer restricted; kept for reference
|
|
73
74
|
const ROOT_TOOLS = 'Read,Edit,Write,Glob,Grep,Bash(ls:*),Bash(mkdir:*),Bash(git init:*),Bash(cat:*),Bash(uptime),Bash(df:*),Bash(free:*),Bash(uname:*),Bash(hostname),Bash(whoami),Bash(date),Bash(pwd)';
|
|
74
75
|
const slug = p => path.basename(p).toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '') || 'project';
|
|
75
76
|
const httpOf = s => s.replace(/\/$/, ''), wsOf = s => httpOf(s).replace(/^http/, 'ws');
|
|
@@ -380,7 +381,7 @@ const cmds = {
|
|
|
380
381
|
}
|
|
381
382
|
try { for (const d of fs.readdirSync(path.join(CFG_DIR, 'uploads'))) for (const f of fs.readdirSync(path.join(CFG_DIR, 'uploads', d))) { const fp = path.join(CFG_DIR, 'uploads', d, f); if (Date.now() - fs.statSync(fp).mtimeMs > 7 * 864e5) fs.rmSync(fp, { force: true }); } } catch {}
|
|
382
383
|
const cfg = load(); const args = ['-p', text, '--output-format', 'stream-json', '--verbose', '--permission-mode', cfg.permissionMode || 'acceptEdits'];
|
|
383
|
-
if (proj.root) { const wsd = rawCfg().workspace;
|
|
384
|
+
if (proj.root) { const wsd = rawCfg().workspace; if (wsd) args.push('--add-dir', wsd); }
|
|
384
385
|
if (saved.length) args.push('--add-dir', upDir);
|
|
385
386
|
if (typeof m.model === 'string' && /^[a-z][a-z0-9.\-\[\]]{0,60}$/i.test(m.model) && m.model !== 'default') args.push('--model', m.model);
|
|
386
387
|
if (cfg.sessions?.[proj.id]) args.push('--resume', cfg.sessions[proj.id]);
|
|
@@ -392,6 +393,7 @@ const cmds = {
|
|
|
392
393
|
let e; try { e = JSON.parse(l); } catch { return; }
|
|
393
394
|
if (e.type === 'assistant') for (const b of e.message?.content || []) {
|
|
394
395
|
if (b.type === 'text' && b.text) tx({ ...ctx, type: 'text', text: b.text });
|
|
396
|
+
else if (b.type === 'thinking' && b.thinking) tx({ ...ctx, type: 'thinking', text: String(b.thinking).slice(-600) });
|
|
395
397
|
else if (b.type === 'tool_use') { const i = b.input || {}; tx({ ...ctx, type: 'tool', name: b.name, summary: String(i.file_path || i.command || i.pattern || i.path || i.url || i.description || '').slice(0, 120) }); }
|
|
396
398
|
} else if (e.type === 'result') {
|
|
397
399
|
if (e.session_id) { const k = load(); k.sessions = { ...k.sessions, [proj.id]: e.session_id }; save(k); }
|