arkaos 2.2.1 → 2.3.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.
- package/VERSION +1 -1
- package/arka/SKILL.md +12 -6
- package/core/jobs/__init__.py +5 -0
- package/core/jobs/__pycache__/__init__.cpython-313.pyc +0 -0
- package/core/jobs/__pycache__/manager.cpython-313.pyc +0 -0
- package/core/jobs/manager.py +172 -0
- package/core/knowledge/__pycache__/ingest.cpython-313.pyc +0 -0
- package/core/knowledge/ingest.py +59 -12
- package/installer/cli.js +0 -0
- package/installer/index.js +262 -62
- package/package.json +1 -1
- package/pyproject.toml +1 -1
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.
|
|
1
|
+
2.3.0
|
package/arka/SKILL.md
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: arka
|
|
3
3
|
description: >
|
|
4
|
-
ArkaOS v2 main orchestrator. Routes commands to
|
|
5
|
-
to slash commands, runs standups, system monitoring,
|
|
6
|
-
The entry point for every user interaction.
|
|
4
|
+
ArkaOS v2 main orchestrator. Routes commands to 17 departments, resolves natural language
|
|
5
|
+
to slash commands, runs standups, system monitoring, dashboard, knowledge base, personas,
|
|
6
|
+
and cross-department coordination. The entry point for every user interaction.
|
|
7
7
|
allowed-tools: [Read, Write, Edit, Bash, Grep, Glob, Agent, WebFetch, WebSearch]
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
# ArkaOS v2 — Main Orchestrator
|
|
11
11
|
|
|
12
12
|
> **The Operating System for AI Agent Teams**
|
|
13
|
-
>
|
|
13
|
+
> 65 agents. 17 departments. 244+ skills. Multi-runtime. Dashboard. Knowledge RAG.
|
|
14
14
|
|
|
15
15
|
## System Commands
|
|
16
16
|
|
|
@@ -23,6 +23,11 @@ allowed-tools: [Read, Write, Edit, Bash, Grep, Glob, Agent, WebFetch, WebSearch]
|
|
|
23
23
|
| `/arka help` | List all department commands |
|
|
24
24
|
| `/arka setup` | Interactive profile setup (name, company, role, objectives) |
|
|
25
25
|
| `/arka conclave` | Activate personal AI advisory board (The Conclave) |
|
|
26
|
+
| `/arka dashboard` | Open monitoring dashboard (localhost:3333) |
|
|
27
|
+
| `/arka index` | Index Obsidian vault into knowledge base |
|
|
28
|
+
| `/arka search <query>` | Semantic search in knowledge base |
|
|
29
|
+
| `/arka keys` | Manage API keys (OpenAI, Google, fal.ai) |
|
|
30
|
+
| `/arka personas` | Manage AI personas (create, clone to agent) |
|
|
26
31
|
| `/do <description>` | Universal routing — natural language to department command |
|
|
27
32
|
|
|
28
33
|
## Universal Orchestrator (/do)
|
|
@@ -99,8 +104,9 @@ Every workflow includes a Quality Gate phase before delivery:
|
|
|
99
104
|
| Tier | Role | Count | Authority |
|
|
100
105
|
|------|------|-------|-----------|
|
|
101
106
|
| 0 | C-Suite | 6 | Veto power, strategic decisions |
|
|
102
|
-
| 1 | Squad Leads |
|
|
103
|
-
| 2 | Specialists |
|
|
107
|
+
| 1 | Squad Leads | 16 | Orchestrate department, domain decisions |
|
|
108
|
+
| 2 | Specialists | 40 | Execute within domain expertise |
|
|
109
|
+
| 3 | Support | 3 | Research, documentation, data collection |
|
|
104
110
|
|
|
105
111
|
## Cross-Department Collaboration
|
|
106
112
|
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"""SQLite-based job queue for persistent task tracking.
|
|
2
|
+
|
|
3
|
+
Cross-platform (Mac, Linux, Windows). Thread-safe. Survives restarts.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import sqlite3
|
|
7
|
+
import uuid
|
|
8
|
+
from dataclasses import dataclass, asdict
|
|
9
|
+
from datetime import datetime
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
from typing import Optional
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclass
|
|
15
|
+
class Job:
|
|
16
|
+
id: str
|
|
17
|
+
type: str = "" # youtube, pdf, audio, web, markdown, kb_index
|
|
18
|
+
source: str = "" # URL or file path
|
|
19
|
+
title: str = ""
|
|
20
|
+
status: str = "queued" # queued, processing, downloading, transcribing, embedding, completed, failed, cancelled
|
|
21
|
+
progress: int = 0 # 0-100
|
|
22
|
+
message: str = "" # Current step description
|
|
23
|
+
chunks_created: int = 0
|
|
24
|
+
media_path: str = "" # Path to downloaded media file
|
|
25
|
+
error: str = ""
|
|
26
|
+
created_at: str = ""
|
|
27
|
+
started_at: str = ""
|
|
28
|
+
completed_at: str = ""
|
|
29
|
+
|
|
30
|
+
def to_dict(self) -> dict:
|
|
31
|
+
return asdict(self)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class JobManager:
|
|
35
|
+
"""SQLite-backed job queue. Thread-safe for concurrent reads."""
|
|
36
|
+
|
|
37
|
+
def __init__(self, db_path: str | Path = ""):
|
|
38
|
+
self._db_path = str(db_path) if db_path else str(Path.home() / ".arkaos" / "jobs.db")
|
|
39
|
+
Path(self._db_path).parent.mkdir(parents=True, exist_ok=True)
|
|
40
|
+
self._init_db()
|
|
41
|
+
|
|
42
|
+
def _conn(self) -> sqlite3.Connection:
|
|
43
|
+
conn = sqlite3.connect(self._db_path)
|
|
44
|
+
conn.row_factory = sqlite3.Row
|
|
45
|
+
conn.execute("PRAGMA journal_mode=WAL") # Better concurrency
|
|
46
|
+
return conn
|
|
47
|
+
|
|
48
|
+
def _init_db(self) -> None:
|
|
49
|
+
with self._conn() as conn:
|
|
50
|
+
conn.execute("""
|
|
51
|
+
CREATE TABLE IF NOT EXISTS jobs (
|
|
52
|
+
id TEXT PRIMARY KEY,
|
|
53
|
+
type TEXT DEFAULT '',
|
|
54
|
+
source TEXT DEFAULT '',
|
|
55
|
+
title TEXT DEFAULT '',
|
|
56
|
+
status TEXT DEFAULT 'queued',
|
|
57
|
+
progress INTEGER DEFAULT 0,
|
|
58
|
+
message TEXT DEFAULT '',
|
|
59
|
+
chunks_created INTEGER DEFAULT 0,
|
|
60
|
+
media_path TEXT DEFAULT '',
|
|
61
|
+
error TEXT DEFAULT '',
|
|
62
|
+
created_at TEXT DEFAULT '',
|
|
63
|
+
started_at TEXT DEFAULT '',
|
|
64
|
+
completed_at TEXT DEFAULT ''
|
|
65
|
+
)
|
|
66
|
+
""")
|
|
67
|
+
|
|
68
|
+
def create(self, source: str, source_type: str, title: str = "") -> Job:
|
|
69
|
+
job = Job(
|
|
70
|
+
id=f"job-{uuid.uuid4().hex[:8]}",
|
|
71
|
+
type=source_type,
|
|
72
|
+
source=source,
|
|
73
|
+
title=title or f"{source_type}: {source[:60]}",
|
|
74
|
+
status="queued",
|
|
75
|
+
created_at=datetime.now().isoformat(),
|
|
76
|
+
)
|
|
77
|
+
with self._conn() as conn:
|
|
78
|
+
conn.execute(
|
|
79
|
+
"INSERT INTO jobs (id, type, source, title, status, progress, message, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",
|
|
80
|
+
(job.id, job.type, job.source, job.title, job.status, 0, "Queued", job.created_at),
|
|
81
|
+
)
|
|
82
|
+
return job
|
|
83
|
+
|
|
84
|
+
def get(self, job_id: str) -> Optional[Job]:
|
|
85
|
+
with self._conn() as conn:
|
|
86
|
+
row = conn.execute("SELECT * FROM jobs WHERE id = ?", (job_id,)).fetchone()
|
|
87
|
+
if not row:
|
|
88
|
+
return None
|
|
89
|
+
return Job(**dict(row))
|
|
90
|
+
|
|
91
|
+
def update_progress(self, job_id: str, progress: int, message: str, status: str = "processing") -> None:
|
|
92
|
+
with self._conn() as conn:
|
|
93
|
+
conn.execute(
|
|
94
|
+
"UPDATE jobs SET progress = ?, message = ?, status = ? WHERE id = ?",
|
|
95
|
+
(progress, message, status, job_id),
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
def start(self, job_id: str) -> None:
|
|
99
|
+
with self._conn() as conn:
|
|
100
|
+
conn.execute(
|
|
101
|
+
"UPDATE jobs SET status = 'processing', started_at = ? WHERE id = ?",
|
|
102
|
+
(datetime.now().isoformat(), job_id),
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
def complete(self, job_id: str, chunks_created: int = 0, media_path: str = "") -> None:
|
|
106
|
+
with self._conn() as conn:
|
|
107
|
+
conn.execute(
|
|
108
|
+
"UPDATE jobs SET status = 'completed', progress = 100, message = 'Done', chunks_created = ?, media_path = ?, completed_at = ? WHERE id = ?",
|
|
109
|
+
(chunks_created, media_path, datetime.now().isoformat(), job_id),
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
def fail(self, job_id: str, error: str) -> None:
|
|
113
|
+
with self._conn() as conn:
|
|
114
|
+
conn.execute(
|
|
115
|
+
"UPDATE jobs SET status = 'failed', error = ?, completed_at = ? WHERE id = ?",
|
|
116
|
+
(error, datetime.now().isoformat(), job_id),
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
def cancel(self, job_id: str) -> bool:
|
|
120
|
+
with self._conn() as conn:
|
|
121
|
+
result = conn.execute(
|
|
122
|
+
"UPDATE jobs SET status = 'cancelled', completed_at = ? WHERE id = ? AND status = 'queued'",
|
|
123
|
+
(datetime.now().isoformat(), job_id),
|
|
124
|
+
)
|
|
125
|
+
return result.rowcount > 0
|
|
126
|
+
|
|
127
|
+
def list_all(self, limit: int = 50) -> list[Job]:
|
|
128
|
+
with self._conn() as conn:
|
|
129
|
+
rows = conn.execute(
|
|
130
|
+
"SELECT * FROM jobs ORDER BY created_at DESC LIMIT ?", (limit,)
|
|
131
|
+
).fetchall()
|
|
132
|
+
return [Job(**dict(r)) for r in rows]
|
|
133
|
+
|
|
134
|
+
def list_active(self) -> list[Job]:
|
|
135
|
+
with self._conn() as conn:
|
|
136
|
+
rows = conn.execute(
|
|
137
|
+
"SELECT * FROM jobs WHERE status IN ('queued', 'processing', 'downloading', 'transcribing', 'embedding') ORDER BY created_at ASC"
|
|
138
|
+
).fetchall()
|
|
139
|
+
return [Job(**dict(r)) for r in rows]
|
|
140
|
+
|
|
141
|
+
def list_by_status(self, status: str, limit: int = 50) -> list[Job]:
|
|
142
|
+
with self._conn() as conn:
|
|
143
|
+
rows = conn.execute(
|
|
144
|
+
"SELECT * FROM jobs WHERE status = ? ORDER BY created_at DESC LIMIT ?", (status, limit)
|
|
145
|
+
).fetchall()
|
|
146
|
+
return [Job(**dict(r)) for r in rows]
|
|
147
|
+
|
|
148
|
+
def summary(self) -> dict:
|
|
149
|
+
with self._conn() as conn:
|
|
150
|
+
total = conn.execute("SELECT COUNT(*) FROM jobs").fetchone()[0]
|
|
151
|
+
active = conn.execute("SELECT COUNT(*) FROM jobs WHERE status IN ('queued', 'processing', 'downloading', 'transcribing', 'embedding')").fetchone()[0]
|
|
152
|
+
completed = conn.execute("SELECT COUNT(*) FROM jobs WHERE status = 'completed'").fetchone()[0]
|
|
153
|
+
failed = conn.execute("SELECT COUNT(*) FROM jobs WHERE status = 'failed'").fetchone()[0]
|
|
154
|
+
total_chunks = conn.execute("SELECT COALESCE(SUM(chunks_created), 0) FROM jobs WHERE status = 'completed'").fetchone()[0]
|
|
155
|
+
return {
|
|
156
|
+
"total": total,
|
|
157
|
+
"active": active,
|
|
158
|
+
"completed": completed,
|
|
159
|
+
"failed": failed,
|
|
160
|
+
"total_chunks": total_chunks,
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
def clear_completed(self, keep_last: int = 20) -> int:
|
|
164
|
+
with self._conn() as conn:
|
|
165
|
+
rows = conn.execute(
|
|
166
|
+
"SELECT id FROM jobs WHERE status IN ('completed', 'failed', 'cancelled') ORDER BY completed_at DESC"
|
|
167
|
+
).fetchall()
|
|
168
|
+
to_delete = [r["id"] for r in rows[keep_last:]]
|
|
169
|
+
if to_delete:
|
|
170
|
+
placeholders = ",".join("?" * len(to_delete))
|
|
171
|
+
conn.execute(f"DELETE FROM jobs WHERE id IN ({placeholders})", to_delete)
|
|
172
|
+
return len(to_delete)
|
|
Binary file
|
package/core/knowledge/ingest.py
CHANGED
|
@@ -159,15 +159,33 @@ class IngestEngine:
|
|
|
159
159
|
)
|
|
160
160
|
|
|
161
161
|
def _process_youtube(self, url: str, progress: ProgressCallback) -> tuple[str, str]:
|
|
162
|
-
"""Download YouTube video and transcribe audio.
|
|
162
|
+
"""Download YouTube video and transcribe audio.
|
|
163
|
+
|
|
164
|
+
5 distinct phases with clear progress:
|
|
165
|
+
Phase 1: Fetch video info (0-5%)
|
|
166
|
+
Phase 2: Download video (5-25%)
|
|
167
|
+
Phase 3: Extract audio (25-35%)
|
|
168
|
+
Phase 4: Transcribe audio (35-65%)
|
|
169
|
+
Phase 5: Return text for chunking/indexing (handled by caller, 75-100%)
|
|
170
|
+
"""
|
|
163
171
|
try:
|
|
164
172
|
import yt_dlp
|
|
165
173
|
except ImportError:
|
|
166
174
|
raise RuntimeError("yt-dlp not installed. Run: pip install yt-dlp")
|
|
167
175
|
|
|
168
|
-
|
|
176
|
+
# === Phase 1: Fetch video info ===
|
|
177
|
+
progress(2, "Phase 1/4 — Fetching video info...")
|
|
178
|
+
try:
|
|
179
|
+
with yt_dlp.YoutubeDL({"quiet": True, "no_warnings": True}) as ydl:
|
|
180
|
+
info = ydl.extract_info(url, download=False)
|
|
181
|
+
title = info.get("title", "YouTube Video")
|
|
182
|
+
duration = info.get("duration", 0)
|
|
183
|
+
progress(5, f"Phase 1/4 — Found: {title} ({duration}s)")
|
|
184
|
+
except Exception as e:
|
|
185
|
+
raise RuntimeError(f"YouTube access failed: {str(e)[:200]}")
|
|
169
186
|
|
|
170
|
-
# Download audio
|
|
187
|
+
# === Phase 2: Download video + extract audio ===
|
|
188
|
+
progress(8, f"Phase 2/4 — Downloading video...")
|
|
171
189
|
audio_path = str(self._media_dir / "yt_audio.wav")
|
|
172
190
|
ydl_opts = {
|
|
173
191
|
"format": "bestaudio/best",
|
|
@@ -179,21 +197,50 @@ class IngestEngine:
|
|
|
179
197
|
}],
|
|
180
198
|
"quiet": True,
|
|
181
199
|
"no_warnings": True,
|
|
200
|
+
"progress_hooks": [lambda d: progress(
|
|
201
|
+
8 + int((d.get("downloaded_bytes", 0) / max(d.get("total_bytes", 1), 1)) * 17),
|
|
202
|
+
f"Phase 2/4 — Downloading... {d.get('_percent_str', '').strip()}"
|
|
203
|
+
) if d.get("status") == "downloading" else None],
|
|
182
204
|
}
|
|
183
205
|
|
|
184
|
-
progress(10, "Downloading audio...")
|
|
185
206
|
with yt_dlp.YoutubeDL(ydl_opts) as ydl:
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
progress(
|
|
207
|
+
ydl.extract_info(url, download=True)
|
|
208
|
+
|
|
209
|
+
# === Phase 3: Extract audio (FFmpeg post-processing) ===
|
|
210
|
+
progress(28, "Phase 3/4 — Extracting audio from video...")
|
|
211
|
+
|
|
212
|
+
# Verify audio file exists
|
|
213
|
+
if not os.path.exists(audio_path):
|
|
214
|
+
# Try to find the downloaded file with different extension
|
|
215
|
+
for ext in ["wav", "m4a", "webm", "mp3", "opus"]:
|
|
216
|
+
alt = str(self._media_dir / f"yt_audio.{ext}")
|
|
217
|
+
if os.path.exists(alt):
|
|
218
|
+
audio_path = alt
|
|
219
|
+
break
|
|
220
|
+
else:
|
|
221
|
+
raise RuntimeError("Audio extraction failed — no output file found")
|
|
222
|
+
|
|
223
|
+
audio_size_mb = os.path.getsize(audio_path) / (1024 * 1024)
|
|
224
|
+
progress(35, f"Phase 3/4 — Audio extracted ({audio_size_mb:.1f} MB)")
|
|
225
|
+
|
|
226
|
+
# === Phase 4: Transcribe audio ===
|
|
227
|
+
progress(38, "Phase 4/4 — Transcribing audio (this may take a while)...")
|
|
190
228
|
text = self._transcribe_audio(audio_path)
|
|
191
229
|
|
|
192
|
-
|
|
230
|
+
if not text or len(text.strip()) < 20:
|
|
231
|
+
raise RuntimeError("Transcription produced no usable text")
|
|
232
|
+
|
|
233
|
+
word_count = len(text.split())
|
|
234
|
+
progress(70, f"Phase 4/4 — Transcribed: {word_count} words")
|
|
235
|
+
|
|
236
|
+
# Rename audio to include title for easy identification
|
|
237
|
+
safe_title = "".join(c if c.isalnum() or c in " -_" else "" for c in title)[:50].strip()
|
|
238
|
+
final_audio = self._media_dir / f"{safe_title}.wav"
|
|
193
239
|
try:
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
240
|
+
import shutil
|
|
241
|
+
shutil.move(audio_path, str(final_audio))
|
|
242
|
+
except Exception:
|
|
243
|
+
final_audio = Path(audio_path)
|
|
197
244
|
|
|
198
245
|
return text, title
|
|
199
246
|
|
package/installer/cli.js
CHANGED
|
File without changes
|
package/installer/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, copyFileSync, readFileSync, writeFileSync, readdirSync, chmodSync } from "node:fs";
|
|
1
|
+
import { existsSync, mkdirSync, copyFileSync, readFileSync, writeFileSync, readdirSync, chmodSync, cpSync } from "node:fs";
|
|
2
2
|
import { join, resolve, dirname } from "node:path";
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
import { execSync } from "node:child_process";
|
|
@@ -11,66 +11,123 @@ const ARKAOS_ROOT = resolve(__dirname, "..");
|
|
|
11
11
|
const VERSION = JSON.parse(readFileSync(join(ARKAOS_ROOT, "package.json"), "utf-8")).version;
|
|
12
12
|
|
|
13
13
|
export async function install({ runtime, path, force }) {
|
|
14
|
-
|
|
15
|
-
console.log(` Runtime: ${runtime}`);
|
|
16
|
-
|
|
14
|
+
const startTime = Date.now();
|
|
17
15
|
const config = getRuntimeConfig(runtime);
|
|
18
16
|
const installDir = path || join(homedir(), ".arkaos");
|
|
17
|
+
const isUpgrade = existsSync(join(installDir, "install-manifest.json"));
|
|
19
18
|
|
|
20
|
-
console.log(`
|
|
21
|
-
|
|
19
|
+
console.log(`
|
|
20
|
+
╔══════════════════════════════════════════════════════════╗
|
|
21
|
+
║ ArkaOS v${VERSION} — The Operating System for AI Agent Teams ║
|
|
22
|
+
╚══════════════════════════════════════════════════════════╝
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
Runtime: ${config.name}
|
|
25
|
+
Install dir: ${installDir}
|
|
26
|
+
Mode: ${isUpgrade ? "Upgrade" : "Fresh install"}
|
|
27
|
+
`);
|
|
28
|
+
|
|
29
|
+
// ═══ Step 1: Create directories ═══
|
|
30
|
+
step(1, 12, "Creating directories...");
|
|
25
31
|
ensureDir(installDir);
|
|
26
|
-
|
|
27
|
-
ensureDir(join(installDir,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
const dirs = ["config", "config/hooks", "agents", "media", "session-digests", "vault"];
|
|
33
|
+
for (const d of dirs) ensureDir(join(installDir, d));
|
|
34
|
+
ok(`${dirs.length + 1} directories ready`);
|
|
35
|
+
|
|
36
|
+
// ═══ Step 2: Detect v1 installation ═══
|
|
37
|
+
step(2, 12, "Checking for v1 installation...");
|
|
38
|
+
const v1Paths = [
|
|
39
|
+
join(homedir(), ".claude", "skills", "arka-os"),
|
|
40
|
+
join(homedir(), ".claude", "skills", "arkaos"),
|
|
41
|
+
];
|
|
42
|
+
const v1Found = v1Paths.find(p => existsSync(p));
|
|
43
|
+
if (v1Found && !existsSync(join(installDir, "migrated-from-v1"))) {
|
|
44
|
+
warn(`v1 detected at ${v1Found}`);
|
|
45
|
+
console.log(" Run 'npx arkaos migrate' after install to migrate your data.");
|
|
46
|
+
} else {
|
|
47
|
+
ok("No v1 installation found");
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// ═══ Step 3: Check Python ═══
|
|
51
|
+
step(3, 12, "Checking Python 3.11+...");
|
|
34
52
|
const pythonCmd = checkPython();
|
|
35
|
-
|
|
53
|
+
ok(`Found: ${pythonCmd}`);
|
|
36
54
|
|
|
37
|
-
// Step
|
|
38
|
-
|
|
39
|
-
|
|
55
|
+
// ═══ Step 4: Install Python core + ALL dependencies ═══
|
|
56
|
+
step(4, 12, "Installing Python dependencies (this may take a minute)...");
|
|
57
|
+
installAllPythonDeps(pythonCmd);
|
|
40
58
|
|
|
41
|
-
// Step
|
|
42
|
-
|
|
59
|
+
// ═══ Step 5: Copy configuration files ═══
|
|
60
|
+
step(5, 12, "Copying configuration files...");
|
|
43
61
|
copyConfigFiles(installDir);
|
|
62
|
+
ok("Constitution, standards, and config copied");
|
|
44
63
|
|
|
45
|
-
// Step
|
|
46
|
-
|
|
64
|
+
// ═══ Step 6: Install hooks with real paths ═══
|
|
65
|
+
step(6, 12, "Installing hooks...");
|
|
47
66
|
installHooks(installDir);
|
|
48
67
|
|
|
49
|
-
// Step
|
|
50
|
-
|
|
68
|
+
// ═══ Step 7: Configure runtime ═══
|
|
69
|
+
step(7, 12, "Configuring runtime...");
|
|
51
70
|
const adapter = await loadAdapter(runtime);
|
|
52
71
|
adapter.configureHooks(config, installDir);
|
|
72
|
+
ok(`${config.name} configured`);
|
|
53
73
|
|
|
54
|
-
// Step
|
|
55
|
-
|
|
56
|
-
|
|
74
|
+
// ═══ Step 8: Install ArkaOS skill to Claude Code ═══
|
|
75
|
+
step(8, 12, "Installing /arka skill...");
|
|
76
|
+
installSkill(config, installDir);
|
|
77
|
+
|
|
78
|
+
// ═══ Step 9: Create references and profile ═══
|
|
79
|
+
step(9, 12, "Creating references...");
|
|
57
80
|
writeFileSync(join(installDir, ".repo-path"), ARKAOS_ROOT);
|
|
58
|
-
|
|
59
|
-
const skillsDir = join(config.skillsDir, "arkaos");
|
|
81
|
+
const skillsDir = join(config.skillsDir || join(homedir(), ".claude", "skills"), "arkaos");
|
|
60
82
|
ensureDir(skillsDir);
|
|
61
83
|
writeFileSync(join(skillsDir, ".arkaos-root"), ARKAOS_ROOT);
|
|
62
|
-
|
|
84
|
+
|
|
63
85
|
const profilePath = join(installDir, "profile.json");
|
|
64
86
|
if (!existsSync(profilePath)) {
|
|
65
|
-
console.log(" New installation — profile created.");
|
|
66
87
|
writeFileSync(profilePath, JSON.stringify({
|
|
67
88
|
version: "2",
|
|
68
89
|
created: new Date().toISOString(),
|
|
69
90
|
}, null, 2));
|
|
91
|
+
ok("New profile created");
|
|
92
|
+
} else {
|
|
93
|
+
ok("Existing profile preserved");
|
|
70
94
|
}
|
|
71
95
|
|
|
72
|
-
// Step
|
|
73
|
-
|
|
96
|
+
// ═══ Step 10: Index knowledge base (if vault configured) ═══
|
|
97
|
+
step(10, 12, "Checking knowledge base...");
|
|
98
|
+
const kbDb = join(installDir, "knowledge.db");
|
|
99
|
+
if (!existsSync(kbDb)) {
|
|
100
|
+
try {
|
|
101
|
+
execSync(`${pythonCmd} "${join(ARKAOS_ROOT, "scripts", "knowledge-index.py")}" --dir "${join(ARKAOS_ROOT, "departments")}" --db "${kbDb}"`, {
|
|
102
|
+
stdio: "pipe",
|
|
103
|
+
timeout: 60000,
|
|
104
|
+
env: { ...process.env, ARKAOS_ROOT },
|
|
105
|
+
});
|
|
106
|
+
ok("ArkaOS skills indexed into knowledge base");
|
|
107
|
+
} catch {
|
|
108
|
+
warn("Knowledge indexing skipped (run 'npx arkaos index' later)");
|
|
109
|
+
}
|
|
110
|
+
} else {
|
|
111
|
+
ok("Knowledge base already exists");
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// ═══ Step 11: Verify installation ═══
|
|
115
|
+
step(11, 12, "Verifying installation...");
|
|
116
|
+
let checks = 0;
|
|
117
|
+
if (existsSync(join(installDir, "config", "constitution.yaml"))) checks++;
|
|
118
|
+
if (existsSync(join(installDir, "config", "hooks", "user-prompt-submit.sh"))) checks++;
|
|
119
|
+
if (existsSync(join(installDir, ".repo-path"))) checks++;
|
|
120
|
+
if (existsSync(profilePath)) checks++;
|
|
121
|
+
try {
|
|
122
|
+
execSync(`${pythonCmd} -c "from core.synapse.engine import SynapseEngine; print('ok')"`, {
|
|
123
|
+
stdio: "pipe", cwd: ARKAOS_ROOT, timeout: 10000,
|
|
124
|
+
});
|
|
125
|
+
checks++;
|
|
126
|
+
} catch {}
|
|
127
|
+
ok(`${checks}/5 checks passed`);
|
|
128
|
+
|
|
129
|
+
// ═══ Step 12: Finalize ═══
|
|
130
|
+
step(12, 12, "Finalizing...");
|
|
74
131
|
const manifest = {
|
|
75
132
|
version: VERSION,
|
|
76
133
|
runtime,
|
|
@@ -83,20 +140,49 @@ export async function install({ runtime, path, force }) {
|
|
|
83
140
|
};
|
|
84
141
|
writeFileSync(join(installDir, "install-manifest.json"), JSON.stringify(manifest, null, 2));
|
|
85
142
|
|
|
143
|
+
const elapsed = ((Date.now() - startTime) / 1000).toFixed(1);
|
|
144
|
+
|
|
86
145
|
console.log(`
|
|
87
|
-
|
|
146
|
+
╔══════════════════════════════════════════════════════════╗
|
|
147
|
+
║ ArkaOS v${VERSION} installed successfully! (${elapsed}s) ║
|
|
148
|
+
╚══════════════════════════════════════════════════════════╝
|
|
88
149
|
|
|
89
150
|
Runtime: ${config.name}
|
|
90
151
|
Install dir: ${installDir}
|
|
91
|
-
|
|
152
|
+
Agents: 65 across 17 departments
|
|
153
|
+
Skills: 244+ backed by enterprise frameworks
|
|
154
|
+
Knowledge: Vector DB with semantic search
|
|
155
|
+
Dashboard: Run 'npx arkaos dashboard' to start
|
|
156
|
+
|
|
157
|
+
Quick start:
|
|
158
|
+
/arka — Main orchestrator
|
|
159
|
+
/do <description> — Natural language routing
|
|
160
|
+
/dev feature — Development workflow
|
|
161
|
+
/mkt seo-audit — Marketing audit
|
|
162
|
+
/strat blue-ocean — Strategy analysis
|
|
92
163
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
164
|
+
Other commands:
|
|
165
|
+
npx arkaos dashboard — Open monitoring UI
|
|
166
|
+
npx arkaos index — Index your Obsidian vault
|
|
167
|
+
npx arkaos keys — Configure API keys
|
|
168
|
+
npx arkaos doctor — Run health checks
|
|
97
169
|
`);
|
|
98
170
|
}
|
|
99
171
|
|
|
172
|
+
// ═══ Helper Functions ═══
|
|
173
|
+
|
|
174
|
+
function step(n, total, msg) {
|
|
175
|
+
console.log(` [${n}/${total}] ${msg}`);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function ok(msg) {
|
|
179
|
+
console.log(` ✓ ${msg}`);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
function warn(msg) {
|
|
183
|
+
console.log(` ⚠ ${msg}`);
|
|
184
|
+
}
|
|
185
|
+
|
|
100
186
|
function ensureDir(dir) {
|
|
101
187
|
if (!existsSync(dir)) {
|
|
102
188
|
mkdirSync(dir, { recursive: true });
|
|
@@ -116,34 +202,119 @@ function checkPython() {
|
|
|
116
202
|
continue;
|
|
117
203
|
}
|
|
118
204
|
}
|
|
119
|
-
console.error(
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
205
|
+
console.error(`
|
|
206
|
+
✗ Python 3.11+ is required but not found.
|
|
207
|
+
|
|
208
|
+
Install Python:
|
|
209
|
+
macOS: brew install python@3.13
|
|
210
|
+
Linux: sudo apt install python3.13
|
|
211
|
+
Windows: https://python.org/downloads/
|
|
212
|
+
`);
|
|
123
213
|
process.exit(1);
|
|
124
214
|
}
|
|
125
215
|
|
|
126
|
-
function
|
|
216
|
+
function installAllPythonDeps(pythonCmd) {
|
|
217
|
+
// Core dependencies
|
|
218
|
+
const coreDeps = "pyyaml pydantic rich click jinja2";
|
|
219
|
+
// Knowledge + Vector DB
|
|
220
|
+
const knowledgeDeps = "fastembed sqlite-vss";
|
|
221
|
+
// Ingest (YouTube, PDF, web, audio)
|
|
222
|
+
const ingestDeps = "yt-dlp pdfplumber beautifulsoup4 requests";
|
|
223
|
+
// Dashboard API
|
|
224
|
+
const dashboardDeps = "fastapi uvicorn";
|
|
225
|
+
// Transcription
|
|
226
|
+
const transcriptionDeps = "faster-whisper";
|
|
227
|
+
|
|
228
|
+
const allDeps = `${coreDeps} ${knowledgeDeps} ${ingestDeps} ${dashboardDeps}`;
|
|
229
|
+
|
|
127
230
|
try {
|
|
231
|
+
// Try uv first (faster)
|
|
128
232
|
try {
|
|
129
233
|
execSync("uv --version", { stdio: "pipe" });
|
|
130
|
-
|
|
234
|
+
console.log(" Using uv (fast installer)...");
|
|
235
|
+
execSync(`uv pip install ${allDeps}`, { stdio: "pipe", timeout: 300000 });
|
|
236
|
+
ok("Core + Knowledge + Ingest + Dashboard deps installed");
|
|
237
|
+
// Transcription optional (heavy)
|
|
238
|
+
try {
|
|
239
|
+
execSync(`uv pip install ${transcriptionDeps}`, { stdio: "pipe", timeout: 300000 });
|
|
240
|
+
ok("Whisper transcription installed");
|
|
241
|
+
} catch {
|
|
242
|
+
warn("Whisper not installed (optional — needed for YouTube/audio transcription)");
|
|
243
|
+
}
|
|
131
244
|
return;
|
|
132
245
|
} catch {
|
|
133
|
-
// uv not available
|
|
246
|
+
// uv not available, use pip
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
console.log(" Installing core dependencies...");
|
|
250
|
+
execSync(`${pythonCmd} -m pip install ${coreDeps} --quiet`, { stdio: "pipe", timeout: 120000 });
|
|
251
|
+
ok("Core deps installed (pyyaml, pydantic, rich, click, jinja2)");
|
|
252
|
+
|
|
253
|
+
console.log(" Installing knowledge base dependencies...");
|
|
254
|
+
try {
|
|
255
|
+
execSync(`${pythonCmd} -m pip install ${knowledgeDeps} --quiet`, { stdio: "pipe", timeout: 180000 });
|
|
256
|
+
ok("Vector DB installed (fastembed, sqlite-vss)");
|
|
257
|
+
} catch {
|
|
258
|
+
warn("Vector DB not installed (run: pip install fastembed sqlite-vss)");
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
console.log(" Installing content ingest dependencies...");
|
|
262
|
+
try {
|
|
263
|
+
execSync(`${pythonCmd} -m pip install ${ingestDeps} --quiet`, { stdio: "pipe", timeout: 120000 });
|
|
264
|
+
ok("Ingest deps installed (yt-dlp, pdfplumber, beautifulsoup4)");
|
|
265
|
+
} catch {
|
|
266
|
+
warn("Ingest deps not fully installed (some content types may not work)");
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
console.log(" Installing dashboard dependencies...");
|
|
270
|
+
try {
|
|
271
|
+
execSync(`${pythonCmd} -m pip install ${dashboardDeps} --quiet`, { stdio: "pipe", timeout: 60000 });
|
|
272
|
+
ok("Dashboard API installed (fastapi, uvicorn)");
|
|
273
|
+
} catch {
|
|
274
|
+
warn("Dashboard API not installed (run: pip install fastapi uvicorn)");
|
|
134
275
|
}
|
|
135
|
-
|
|
276
|
+
|
|
277
|
+
console.log(" Installing transcription engine...");
|
|
278
|
+
try {
|
|
279
|
+
execSync(`${pythonCmd} -m pip install ${transcriptionDeps} --quiet`, { stdio: "pipe", timeout: 300000 });
|
|
280
|
+
ok("Whisper transcription installed");
|
|
281
|
+
} catch {
|
|
282
|
+
warn("Whisper not installed (optional — needed for YouTube/audio)");
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// Install ArkaOS itself as editable
|
|
286
|
+
try {
|
|
287
|
+
execSync(`${pythonCmd} -m pip install -e "${ARKAOS_ROOT}" --quiet`, { stdio: "pipe", timeout: 60000 });
|
|
288
|
+
} catch {}
|
|
289
|
+
|
|
136
290
|
} catch (err) {
|
|
137
|
-
|
|
138
|
-
console.
|
|
291
|
+
warn(`Some Python deps failed: ${err.message.slice(0, 100)}`);
|
|
292
|
+
console.log(" You can install manually: pip install pyyaml pydantic rich click fastembed sqlite-vss");
|
|
139
293
|
}
|
|
140
294
|
}
|
|
141
295
|
|
|
142
296
|
function copyConfigFiles(installDir) {
|
|
143
297
|
// Constitution
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
|
|
298
|
+
const files = [
|
|
299
|
+
["config/constitution.yaml", "config/constitution.yaml"],
|
|
300
|
+
];
|
|
301
|
+
|
|
302
|
+
// Standards
|
|
303
|
+
const standardsDir = join(ARKAOS_ROOT, "config", "standards");
|
|
304
|
+
if (existsSync(standardsDir)) {
|
|
305
|
+
ensureDir(join(installDir, "config", "standards"));
|
|
306
|
+
for (const f of readdirSync(standardsDir)) {
|
|
307
|
+
files.push([`config/standards/${f}`, `config/standards/${f}`]);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
for (const [src, dest] of files) {
|
|
312
|
+
const srcPath = join(ARKAOS_ROOT, src);
|
|
313
|
+
const destPath = join(installDir, dest);
|
|
314
|
+
if (existsSync(srcPath)) {
|
|
315
|
+
ensureDir(dirname(destPath));
|
|
316
|
+
copyFileSync(srcPath, destPath);
|
|
317
|
+
}
|
|
147
318
|
}
|
|
148
319
|
}
|
|
149
320
|
|
|
@@ -151,7 +322,6 @@ function installHooks(installDir) {
|
|
|
151
322
|
const hooksDir = join(installDir, "config", "hooks");
|
|
152
323
|
ensureDir(hooksDir);
|
|
153
324
|
|
|
154
|
-
// Copy v2 hooks, rename to standard names (without -v2 suffix)
|
|
155
325
|
const hookMap = {
|
|
156
326
|
"user-prompt-submit-v2.sh": "user-prompt-submit.sh",
|
|
157
327
|
"post-tool-use-v2.sh": "post-tool-use.sh",
|
|
@@ -164,22 +334,52 @@ function installHooks(installDir) {
|
|
|
164
334
|
const srcPath = join(srcHooksDir, src);
|
|
165
335
|
const destPath = join(hooksDir, dest);
|
|
166
336
|
if (existsSync(srcPath)) {
|
|
167
|
-
// Read, replace ARKAOS_ROOT placeholder, write
|
|
168
337
|
let content = readFileSync(srcPath, "utf-8");
|
|
169
|
-
//
|
|
338
|
+
// Set ARKAOS_ROOT to the npm package location (persistent)
|
|
170
339
|
content = content.replace(
|
|
171
340
|
/ARKAOS_ROOT="\$\{ARKA_OS:-\$HOME\/\.claude\/skills\/arkaos\}"/g,
|
|
172
|
-
`ARKAOS_ROOT="${
|
|
341
|
+
`ARKAOS_ROOT="${ARKAOS_ROOT}"`
|
|
173
342
|
);
|
|
174
343
|
content = content.replace(
|
|
175
344
|
/ARKAOS_HOME="\$\{HOME\}\/\.arkaos"/g,
|
|
176
345
|
`ARKAOS_HOME="${installDir}"`
|
|
177
346
|
);
|
|
178
347
|
writeFileSync(destPath, content);
|
|
179
|
-
try {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
348
|
+
try { chmodSync(destPath, 0o755); } catch {}
|
|
349
|
+
ok(`Hook: ${dest}`);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
function installSkill(config, installDir) {
|
|
355
|
+
// Copy arka/SKILL.md to Claude Code skills directory
|
|
356
|
+
const skillSrc = join(ARKAOS_ROOT, "arka", "SKILL.md");
|
|
357
|
+
const skillsBase = config.skillsDir || join(homedir(), ".claude", "skills");
|
|
358
|
+
const skillDest = join(skillsBase, "arka");
|
|
359
|
+
|
|
360
|
+
ensureDir(skillDest);
|
|
361
|
+
|
|
362
|
+
if (existsSync(skillSrc)) {
|
|
363
|
+
copyFileSync(skillSrc, join(skillDest, "SKILL.md"));
|
|
364
|
+
// Write repo path reference
|
|
365
|
+
writeFileSync(join(skillDest, ".repo-path"), ARKAOS_ROOT);
|
|
366
|
+
writeFileSync(join(skillDest, "VERSION"), VERSION);
|
|
367
|
+
ok("/arka skill installed → Claude Code can now use ArkaOS");
|
|
368
|
+
} else {
|
|
369
|
+
warn("SKILL.md not found in package");
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
// Also copy department skills as references
|
|
373
|
+
const deptSkillSrc = join(ARKAOS_ROOT, "arka", "skills");
|
|
374
|
+
if (existsSync(deptSkillSrc)) {
|
|
375
|
+
const skillsOut = join(skillDest, "skills");
|
|
376
|
+
ensureDir(skillsOut);
|
|
377
|
+
try {
|
|
378
|
+
cpSync(deptSkillSrc, skillsOut, { recursive: true });
|
|
379
|
+
ok("Department skills copied");
|
|
380
|
+
} catch {
|
|
381
|
+
// cpSync may not be available in older Node
|
|
382
|
+
warn("Department skills copy skipped");
|
|
183
383
|
}
|
|
184
384
|
}
|
|
185
385
|
}
|
package/package.json
CHANGED