@flame0510/project-aether 1.1.9

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 (290) hide show
  1. package/README.md +150 -0
  2. package/agent-templates/README.md +37 -0
  3. package/agent-templates/argus/AGENTS.md +52 -0
  4. package/agent-templates/argus/IDENTITY.md +7 -0
  5. package/agent-templates/argus/MEMORY.md +9 -0
  6. package/agent-templates/argus/SOUL.md +24 -0
  7. package/agent-templates/argus/TOOLS.md +8 -0
  8. package/agent-templates/atlas/AGENTS.md +47 -0
  9. package/agent-templates/atlas/HEARTBEAT.md +10 -0
  10. package/agent-templates/atlas/IDENTITY.md +6 -0
  11. package/agent-templates/atlas/MEMORY.md +9 -0
  12. package/agent-templates/atlas/SOUL.md +21 -0
  13. package/agent-templates/atlas/TOOLS.md +4 -0
  14. package/agent-templates/base-image/.trigger +0 -0
  15. package/agent-templates/base-image/Dockerfile +90 -0
  16. package/agent-templates/base-image/entrypoint.sh +37 -0
  17. package/agent-templates/custom/AGENTS.md +29 -0
  18. package/agent-templates/custom/BOOTSTRAP.md +56 -0
  19. package/agent-templates/custom/MEMORY.md +8 -0
  20. package/agent-templates/prometheus/AGENTS.md +37 -0
  21. package/agent-templates/prometheus/IDENTITY.md +6 -0
  22. package/agent-templates/prometheus/MEMORY.md +9 -0
  23. package/agent-templates/prometheus/SOUL.md +21 -0
  24. package/agent-templates/prometheus/TOOLS.md +4 -0
  25. package/app/agents/ChannelManager.tsx +465 -0
  26. package/app/agents/ImageDownloadBanner.tsx +159 -0
  27. package/app/agents/PageClient.tsx +1285 -0
  28. package/app/agents/create/PageClient.tsx +437 -0
  29. package/app/agents/create/page.tsx +126 -0
  30. package/app/agents/loading.tsx +14 -0
  31. package/app/agents/page.tsx +5 -0
  32. package/app/api/agents/[id]/backup/route.ts +169 -0
  33. package/app/api/agents/[id]/channels/pairing/route.ts +69 -0
  34. package/app/api/agents/[id]/channels/route.ts +14 -0
  35. package/app/api/agents/[id]/channels/telegram/route.ts +50 -0
  36. package/app/api/agents/[id]/lifecycle/route.ts +94 -0
  37. package/app/api/agents/[id]/recreate/route.ts +199 -0
  38. package/app/api/agents/[id]/restart/route.ts +33 -0
  39. package/app/api/agents/[id]/restore/route.ts +81 -0
  40. package/app/api/agents/[id]/route.ts +280 -0
  41. package/app/api/agents/channels-summary/route.ts +39 -0
  42. package/app/api/agents/config-json/route.ts +58 -0
  43. package/app/api/agents/create/route.ts +488 -0
  44. package/app/api/agents/download-image/route.ts +32 -0
  45. package/app/api/agents/image-status/route.ts +126 -0
  46. package/app/api/agents/route.ts +213 -0
  47. package/app/api/agents/token/route.ts +94 -0
  48. package/app/api/agents-active/route.ts +190 -0
  49. package/app/api/agents-config/route.ts +629 -0
  50. package/app/api/alerts/smoke/route.ts +26 -0
  51. package/app/api/aliases/add/route.ts +28 -0
  52. package/app/api/aliases/remove/route.ts +27 -0
  53. package/app/api/assistant/route.ts +204 -0
  54. package/app/api/auth/check/route.ts +38 -0
  55. package/app/api/auth/login/route.ts +85 -0
  56. package/app/api/auth/logout/route.ts +7 -0
  57. package/app/api/auth/status/route.ts +33 -0
  58. package/app/api/config/env/route.ts +132 -0
  59. package/app/api/config/restart/route.ts +26 -0
  60. package/app/api/containers/route.ts +75 -0
  61. package/app/api/cost-override/route.ts +46 -0
  62. package/app/api/costs/route.ts +84 -0
  63. package/app/api/credentials/[id]/reveal/route.ts +21 -0
  64. package/app/api/credentials/[id]/route.ts +52 -0
  65. package/app/api/credentials/[id]/sync/route.ts +58 -0
  66. package/app/api/credentials/detect/route.ts +246 -0
  67. package/app/api/credentials/route.ts +33 -0
  68. package/app/api/crons/[id]/route.ts +69 -0
  69. package/app/api/crons/route.ts +12 -0
  70. package/app/api/crons/runs/route.ts +31 -0
  71. package/app/api/debug/route.ts +11 -0
  72. package/app/api/envcheck/route.ts +18 -0
  73. package/app/api/events/route.ts +24 -0
  74. package/app/api/gateway/agent/route.ts +154 -0
  75. package/app/api/gateway/provider/balance/route.ts +38 -0
  76. package/app/api/gateway/provider/keys.ts +38 -0
  77. package/app/api/gateway/provider/oauth/route.ts +304 -0
  78. package/app/api/gateway/provider/route.ts +209 -0
  79. package/app/api/gateway/route.ts +223 -0
  80. package/app/api/gateway/sync.ts +189 -0
  81. package/app/api/lineage/route.ts +54 -0
  82. package/app/api/memory-context/route.ts +15 -0
  83. package/app/api/metrics/route.ts +35 -0
  84. package/app/api/models/route.ts +77 -0
  85. package/app/api/plugins/route.js +37 -0
  86. package/app/api/provider/upstream.ts +142 -0
  87. package/app/api/provider/v1/chat/completions/route.ts +146 -0
  88. package/app/api/provider/v1/models/route.ts +167 -0
  89. package/app/api/provider-usage/route.ts +629 -0
  90. package/app/api/session/route.ts +39 -0
  91. package/app/api/sessions/[id]/route.ts +38 -0
  92. package/app/api/sessions/route.ts +23 -0
  93. package/app/api/setup/agent-image/route.ts +102 -0
  94. package/app/api/setup/password/route.ts +111 -0
  95. package/app/api/setup/restart/route.ts +76 -0
  96. package/app/api/skills/delete/route.js +105 -0
  97. package/app/api/skills/promote/route.js +129 -0
  98. package/app/api/skills/route.js +203 -0
  99. package/app/api/skills/save/route.js +142 -0
  100. package/app/api/stats/route.ts +34 -0
  101. package/app/api/stats-since/route.ts +20 -0
  102. package/app/api/stream/route.ts +70 -0
  103. package/app/api/system-health/route.ts +233 -0
  104. package/app/api/tool-calls/route.ts +24 -0
  105. package/app/api/tools-config/route.ts +163 -0
  106. package/app/api/update-check/route.ts +127 -0
  107. package/app/api/version/route.ts +25 -0
  108. package/app/api/wizard/complete/route.ts +32 -0
  109. package/app/api/wizard/reset/route.ts +28 -0
  110. package/app/api/wizard/status/route.ts +28 -0
  111. package/app/api/workspace/route.ts +392 -0
  112. package/app/api/workspace/stream/route.ts +136 -0
  113. package/app/components/AppShell.tsx +33 -0
  114. package/app/components/AuthGuard.tsx +91 -0
  115. package/app/components/CostBreakdown.tsx +37 -0
  116. package/app/components/DashboardHeader.tsx +73 -0
  117. package/app/components/DashboardLayout.tsx +76 -0
  118. package/app/components/DashboardToolbar.tsx +61 -0
  119. package/app/components/FloatingActions.tsx +33 -0
  120. package/app/components/Icons.tsx +78 -0
  121. package/app/components/LineageGraphPage.tsx +142 -0
  122. package/app/components/LiveFeed.tsx +48 -0
  123. package/app/components/MobileBottomNav.tsx +84 -0
  124. package/app/components/ModelPickerModal.tsx +94 -0
  125. package/app/components/PasswordInput.tsx +86 -0
  126. package/app/components/PulseChat.tsx +362 -0
  127. package/app/components/Rev4aLoader.tsx +48 -0
  128. package/app/components/SessionDrawer.tsx +263 -0
  129. package/app/components/SessionTopology.tsx +289 -0
  130. package/app/components/Sidebar.tsx +294 -0
  131. package/app/components/Skeleton.tsx +133 -0
  132. package/app/components/SystemCockpit.tsx +169 -0
  133. package/app/components/VersionBanner.tsx +105 -0
  134. package/app/components/WizardButton.tsx +30 -0
  135. package/app/components/ui/Badge.tsx +30 -0
  136. package/app/components/ui/Button.tsx +59 -0
  137. package/app/components/ui/ConfirmModal.tsx +46 -0
  138. package/app/components/ui/FilterBar.tsx +33 -0
  139. package/app/components/ui/Input.tsx +25 -0
  140. package/app/components/ui/ItemList.tsx +83 -0
  141. package/app/components/ui/LoadingSpinner.tsx +30 -0
  142. package/app/components/ui/Metric.tsx +22 -0
  143. package/app/components/ui/Modal.tsx +42 -0
  144. package/app/components/ui/Page.tsx +18 -0
  145. package/app/components/ui/Pill.tsx +6 -0
  146. package/app/components/ui/PropertyList.tsx +24 -0
  147. package/app/components/ui/Select.tsx +26 -0
  148. package/app/components/ui/StatusCard.tsx +32 -0
  149. package/app/components/ui/Surface.tsx +14 -0
  150. package/app/components/ui/Tabs.tsx +55 -0
  151. package/app/components/ui/TemplateOption.tsx +59 -0
  152. package/app/components/ui/Toast.tsx +44 -0
  153. package/app/components/ui/index.ts +19 -0
  154. package/app/components/ui/tokens.ts +18 -0
  155. package/app/config/PageClient.tsx +293 -0
  156. package/app/config/loading.tsx +10 -0
  157. package/app/config/page.tsx +7 -0
  158. package/app/containers/ContainersClient.tsx +129 -0
  159. package/app/containers/loading.tsx +21 -0
  160. package/app/containers/page.tsx +5 -0
  161. package/app/containers/terminal/[id]/TerminalClient.tsx +313 -0
  162. package/app/containers/terminal/[id]/page.tsx +6 -0
  163. package/app/credentials/PageClient.tsx +598 -0
  164. package/app/credentials/loading.tsx +10 -0
  165. package/app/credentials/page.tsx +7 -0
  166. package/app/crons/PageClient.tsx +538 -0
  167. package/app/crons/loading.tsx +10 -0
  168. package/app/crons/page.tsx +5 -0
  169. package/app/design-system.ts +57 -0
  170. package/app/gateway/PageClient.tsx +1048 -0
  171. package/app/gateway/loading.tsx +24 -0
  172. package/app/gateway/page.tsx +5 -0
  173. package/app/globals.css +1474 -0
  174. package/app/layout.tsx +45 -0
  175. package/app/lib/models-context.tsx +41 -0
  176. package/app/lineage/loading.tsx +10 -0
  177. package/app/lineage/page.tsx +13 -0
  178. package/app/loading.tsx +16 -0
  179. package/app/login/page.tsx +160 -0
  180. package/app/memory/MemoryContextPageClient.tsx +196 -0
  181. package/app/memory/loading.tsx +10 -0
  182. package/app/memory/page.tsx +8 -0
  183. package/app/page.tsx +31 -0
  184. package/app/plugins/PageClient.tsx +296 -0
  185. package/app/plugins/loading.tsx +10 -0
  186. package/app/plugins/page.tsx +5 -0
  187. package/app/setup/PageClient.tsx +227 -0
  188. package/app/setup/loading.tsx +21 -0
  189. package/app/setup/page.tsx +7 -0
  190. package/app/skills/PageClient.tsx +499 -0
  191. package/app/skills/loading.tsx +10 -0
  192. package/app/skills/page.tsx +5 -0
  193. package/app/tools/ToolsPageClient.tsx +308 -0
  194. package/app/tools/loading.tsx +10 -0
  195. package/app/tools/page.tsx +62 -0
  196. package/app/tools/tools-catalog.ts +141 -0
  197. package/app/wizard/PageClient.tsx +485 -0
  198. package/app/wizard/icons.tsx +89 -0
  199. package/app/wizard/loading.tsx +24 -0
  200. package/app/wizard/page.tsx +7 -0
  201. package/app/wizard/storage.ts +33 -0
  202. package/app/wizard/useWizard.ts +101 -0
  203. package/app/workspace/WorkspaceClient.tsx +633 -0
  204. package/app/workspace/loading.tsx +36 -0
  205. package/app/workspace/page.tsx +8 -0
  206. package/bin/docker-entrypoint.sh +21 -0
  207. package/bin/postinstall.js +20 -0
  208. package/bin/rev4a.js +696 -0
  209. package/daemon.js +783 -0
  210. package/docs/ARCHITECTURE.md +557 -0
  211. package/docs/CONTAINER-TERMINAL.md +280 -0
  212. package/docs/DESIGN-SYSTEM.md +99 -0
  213. package/docs/FRONTEND-ARCHITECTURE.md +119 -0
  214. package/docs/REV4A.md +504 -0
  215. package/docs/dev/API-REFERENCE.md +1835 -0
  216. package/docs/dev/DATABASE.md +224 -0
  217. package/docs/dev/GATEWAY.md +300 -0
  218. package/docs/dev/PROVIDERS.md +229 -0
  219. package/docs/dev/SESSION-MAINTENANCE-PLAN.md +607 -0
  220. package/docs/dev/WORKSPACE.md +199 -0
  221. package/docs/rag/DATA-FRESHNESS.md +109 -0
  222. package/docs/rag/GLOSSARY.md +125 -0
  223. package/docs/rag/REV4A-OVERVIEW.md +135 -0
  224. package/docs/rag/WHAT-I-CAN-ANSWER.md +124 -0
  225. package/lib/agent-setup.ts +130 -0
  226. package/lib/alerts.ts +115 -0
  227. package/lib/apiFetch.ts +7 -0
  228. package/lib/auth.ts +28 -0
  229. package/lib/billing.ts +100 -0
  230. package/lib/buildAgentImage.ts +346 -0
  231. package/lib/channelManager.ts +386 -0
  232. package/lib/container.ts +60 -0
  233. package/lib/credentials/db.ts +86 -0
  234. package/lib/credentials/delivery.ts +448 -0
  235. package/lib/credentials/detect.ts +149 -0
  236. package/lib/credentials/hash.ts +9 -0
  237. package/lib/credentials/providers.ts +110 -0
  238. package/lib/credentials/vault.ts +195 -0
  239. package/lib/db-bootstrap.d.ts +3 -0
  240. package/lib/db-bootstrap.mjs +144 -0
  241. package/lib/db.ts +25 -0
  242. package/lib/docker-utils.ts +60 -0
  243. package/lib/hooks/useDashboard.ts +264 -0
  244. package/lib/hooks/useRev4aTimezone.ts +28 -0
  245. package/lib/hooks/useScreenshot.ts +30 -0
  246. package/lib/memory-context.ts +385 -0
  247. package/lib/model-catalogue.ts +131 -0
  248. package/lib/model-pricing.ts +63 -0
  249. package/lib/openclaw-cron.ts +350 -0
  250. package/lib/patterns/ApiAdapter.ts +73 -0
  251. package/lib/patterns/ApiClient.ts +65 -0
  252. package/lib/patterns/EventBus.ts +113 -0
  253. package/lib/patterns/FilterStrategy.ts +79 -0
  254. package/lib/patterns/SessionFactory.ts +117 -0
  255. package/lib/patterns/sessionPresentation.ts +117 -0
  256. package/lib/provider-balance.ts +163 -0
  257. package/lib/requireAuth.tsx +38 -0
  258. package/lib/rev4a-auth.d.ts +3 -0
  259. package/lib/rev4a-auth.js +36 -0
  260. package/lib/rev4a-paths.ts +145 -0
  261. package/lib/timezone.ts +46 -0
  262. package/lib/types/index.ts +96 -0
  263. package/lib/utils/format.ts +82 -0
  264. package/lineage.js +56 -0
  265. package/model-pricing.json +482 -0
  266. package/models.config.json +844 -0
  267. package/next-env.d.ts +6 -0
  268. package/next.config.mjs +7 -0
  269. package/package.json +82 -0
  270. package/public/apple-touch-icon.png +0 -0
  271. package/public/favicon-64.png +0 -0
  272. package/public/favicon.svg +58 -0
  273. package/public/icon-192-maskable.png +0 -0
  274. package/public/icon-192.png +0 -0
  275. package/public/icon-512-maskable.png +0 -0
  276. package/public/icon-512.png +0 -0
  277. package/public/manifest.json +38 -0
  278. package/public/rev4a-logo.png +0 -0
  279. package/public/rev4a-logo.svg +58 -0
  280. package/rev4a-rules/AGENTS.md +37 -0
  281. package/scripts/add-auth.cjs +185 -0
  282. package/scripts/backup.sh +66 -0
  283. package/scripts/check-providers.mjs +143 -0
  284. package/scripts/docker/traefik/docker-compose.yml +32 -0
  285. package/scripts/docker/traefik/dynamic/.gitkeep +18 -0
  286. package/scripts/docker/traefik/traefik.yml +37 -0
  287. package/scripts/remove-auth-profile.js +56 -0
  288. package/scripts/restore.sh +82 -0
  289. package/terminal-ws-server.js +139 -0
  290. package/tsconfig.json +42 -0
@@ -0,0 +1,96 @@
1
+ // Core domain types for Rev4a
2
+
3
+ export interface Session {
4
+ session_id: string;
5
+ parent_id?: string | null;
6
+ label?: string | null;
7
+ lineage_label?: string | null;
8
+ lineage_agent_name?: string | null;
9
+ model?: string | null;
10
+ status: SessionStatus;
11
+ tokens_in?: number | null;
12
+ tokens_out?: number | null;
13
+ cost_usd?: number | null;
14
+ started_at?: number | null;
15
+ updated_at?: number | null;
16
+ ended_at?: number | null;
17
+ task_preview?: string | null;
18
+ }
19
+
20
+ export type SessionStatus = 'working' | 'idle' | 'error' | 'active' | 'completed';
21
+
22
+ export interface SessionDetail {
23
+ session: Session;
24
+ events: SessionEvent[];
25
+ children: Session[];
26
+ }
27
+
28
+ export interface SessionEvent {
29
+ id?: string | number;
30
+ ts?: number;
31
+ type?: string;
32
+ event?: string;
33
+ data?: unknown;
34
+ session_id?: string;
35
+ session_label?: string;
36
+ label?: string;
37
+ }
38
+
39
+ export interface Costs {
40
+ today: number;
41
+ allTime: number;
42
+ allTimeSource?: string;
43
+ byModel: ModelCost[];
44
+ }
45
+
46
+ export interface ModelCost {
47
+ model: string;
48
+ cost_usd: number;
49
+ tokens_in?: number;
50
+ tokens_out?: number;
51
+ sessions?: number;
52
+ }
53
+
54
+ // SSE streaming message shapes
55
+ export type StreamMessage =
56
+ | { type: 'sessions'; data: unknown[] }
57
+ | { type: 'events'; data: unknown[] }
58
+ | { type: 'costs'; data: { today?: number } };
59
+
60
+ // Filter configuration
61
+ export interface FilterConfig {
62
+ agent: string;
63
+ showOnlyActive: boolean;
64
+ showCron: boolean;
65
+ period: Period;
66
+ }
67
+
68
+ export type Period = '1d' | '3d' | '7d' | '15d' | '30d' | 'all';
69
+
70
+ export const PERIODS: Period[] = ['1d', '3d', '7d', '15d', '30d', 'all'];
71
+ export const AGENTS = ['all', 'ops', 'website', 'lead-engine', 'scout'] as const;
72
+ export type AgentFilter = (typeof AGENTS)[number];
73
+
74
+ export const PERIOD_MS: Record<Exclude<Period, 'all'>, number> = {
75
+ '1d': 86_400_000,
76
+ '3d': 259_200_000,
77
+ '7d': 604_800_000,
78
+ '15d': 1_296_000_000,
79
+ '30d': 2_592_000_000,
80
+ };
81
+
82
+ export const ACTIVE_STATUSES = new Set<SessionStatus>(['working', 'active', 'idle']);
83
+
84
+ // Tree node for SessionTopology (D3)
85
+ export interface TreeNode {
86
+ session_id: string;
87
+ name: string;
88
+ status: SessionStatus;
89
+ lineage_label?: string | null;
90
+ task_preview?: string | null;
91
+ model?: string | null;
92
+ cost_usd?: number;
93
+ children?: TreeNode[];
94
+ _virtualRoot?: boolean;
95
+ _agentNode?: boolean;
96
+ }
@@ -0,0 +1,82 @@
1
+ // Formatting utilities — pure functions, no side effects
2
+
3
+ export function formatUsd(value: number | null | undefined): string {
4
+ return `$${Number(value ?? 0).toFixed(2)}`;
5
+ }
6
+
7
+ export function formatUsdOrDash(value: number | null | undefined): string {
8
+ if (value === null || value === undefined || !Number.isFinite(Number(value))) return '-';
9
+ return formatUsd(value);
10
+ }
11
+
12
+ export function formatTokens(value: number | null | undefined): string {
13
+ if (value === null || value === undefined) return '-';
14
+ const n = Number(value ?? 0);
15
+ if (n >= 1000) return `${(n / 1000).toFixed(1)}k`;
16
+ return String(n);
17
+ }
18
+
19
+ let _timezone = process.env.REV4A_TIMEZONE || 'Europe/Rome';
20
+
21
+ export function setTimeZone(tz: string): void {
22
+ _timezone = tz;
23
+ }
24
+
25
+ export function getTimeZone(): string {
26
+ return _timezone;
27
+ }
28
+
29
+ export function formatTimeFromUnixSeconds(ts: number | null | undefined): string {
30
+ if (!ts) return '--:--:--';
31
+ const ms = Number(ts) < 1e12 ? Number(ts) * 1000 : Number(ts);
32
+ return new Date(ms).toLocaleString('it-IT', {
33
+ timeZone: _timezone,
34
+ hour: '2-digit',
35
+ minute: '2-digit',
36
+ second: '2-digit',
37
+ hour12: false,
38
+ });
39
+ }
40
+
41
+ export function formatDuration(
42
+ startTs: number | null | undefined,
43
+ endTs: number | null | undefined,
44
+ ): string {
45
+ if (!startTs || !endTs) return '-';
46
+ const start = Number(startTs) < 1e12 ? Number(startTs) * 1000 : Number(startTs);
47
+ const end = Number(endTs) < 1e12 ? Number(endTs) * 1000 : Number(endTs);
48
+ const seconds = Math.max(0, Math.floor((end - start) / 1000));
49
+ const hh = String(Math.floor(seconds / 3600)).padStart(2, '0');
50
+ const mm = String(Math.floor((seconds % 3600) / 60)).padStart(2, '0');
51
+ const ss = String(seconds % 60).padStart(2, '0');
52
+ return `${hh}:${mm}:${ss}`;
53
+ }
54
+
55
+ export function truncate(value: string | null | undefined, max = 48): string {
56
+ const s = String(value ?? '');
57
+ if (s.length <= max) return s;
58
+ return `${s.slice(0, max - 1)}…`;
59
+ }
60
+
61
+ export function statusColor(status: string | null | undefined): string {
62
+ const s = String(status ?? 'idle').toLowerCase();
63
+ if (s === 'working' || s === 'active') return '#44e18d';
64
+ if (s === 'error') return '#f07070';
65
+ return '#89a1ad';
66
+ }
67
+
68
+ export function parseEventData(data: unknown): string {
69
+ if (!data) return '';
70
+ try {
71
+ const parsed = typeof data === 'string' ? JSON.parse(data) : data;
72
+ if (typeof parsed === 'string') return parsed;
73
+ return (
74
+ (parsed as Record<string, unknown>)?.message?.toString() ??
75
+ (parsed as Record<string, unknown>)?.text?.toString() ??
76
+ (parsed as Record<string, unknown>)?.event?.toString() ??
77
+ JSON.stringify(parsed)
78
+ );
79
+ } catch {
80
+ return String(data);
81
+ }
82
+ }
package/lineage.js ADDED
@@ -0,0 +1,56 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Rev4a Lineage — declare the parent→child hierarchy and agent name
4
+ * Usage: node /data/rev4a/lineage.js <childSessionKey> <parentSessionKey> [name]
5
+ *
6
+ * Example (Forge after spawning Atlas):
7
+ * node /data/rev4a/lineage.js \
8
+ * "agent:website:subagent:atlas-uuid" \
9
+ * "agent:website:main" \
10
+ * "Atlas 🗺️"
11
+ *
12
+ * Example (Atlas after spawning Developer):
13
+ * node /data/rev4a/lineage.js \
14
+ * "agent:website:subagent:dev-uuid" \
15
+ * "agent:website:subagent:atlas-uuid" \
16
+ * "Developer 💻"
17
+ */
18
+
19
+ 'use strict';
20
+
21
+ const Database = require('better-sqlite3');
22
+ const path = require('path');
23
+ const DB_PATH = process.env.REV4A_DB || path.join(__dirname, 'data', 'events.db');
24
+
25
+ const [,, childId, parentId, agentName] = process.argv;
26
+
27
+ if (!childId || !parentId) {
28
+ console.error('Usage: node lineage.js <childSessionKey> <parentSessionKey> [name]');
29
+ process.exit(1);
30
+ }
31
+
32
+ const db = new Database(DB_PATH);
33
+
34
+ db.prepare(`CREATE TABLE IF NOT EXISTS lineage (
35
+ child_id TEXT PRIMARY KEY,
36
+ parent_id TEXT NOT NULL,
37
+ agent_name TEXT,
38
+ declared_at INTEGER NOT NULL
39
+ )`).run();
40
+
41
+ // Add agent_name column if it doesn't exist (migration safe)
42
+ try {
43
+ db.prepare('ALTER TABLE lineage ADD COLUMN agent_name TEXT').run();
44
+ } catch (e) { /* already exists */ }
45
+
46
+ db.prepare('INSERT OR REPLACE INTO lineage (child_id, parent_id, agent_name, declared_at) VALUES (?, ?, ?, ?)')
47
+ .run(childId, parentId, agentName || null, Date.now());
48
+
49
+ // Update sessions: set parent_id and label (if name provided)
50
+ db.prepare('UPDATE sessions SET parent_id = ? WHERE session_id = ?').run(parentId, childId);
51
+ if (agentName) {
52
+ db.prepare("UPDATE sessions SET label = COALESCE(label, ?) WHERE session_id = ?").run(agentName, childId);
53
+ }
54
+
55
+ console.log(`Lineage declared: ${childId} → ${parentId}${agentName ? ` (${agentName})` : ''}`);
56
+ db.close();
@@ -0,0 +1,482 @@
1
+ {
2
+ "openai/gpt-5.6-sol": {
3
+ "input": 5.0,
4
+ "output": 30.0
5
+ },
6
+ "openai/gpt-5.6-terra": {
7
+ "input": 2.0,
8
+ "output": 12.0
9
+ },
10
+ "openai/gpt-5.6-luna": {
11
+ "input": 0.2,
12
+ "output": 1.2
13
+ },
14
+ "openai/gpt-5.5": {
15
+ "input": 5.0,
16
+ "output": 30.0
17
+ },
18
+ "openai/gpt-5.4": {
19
+ "input": 2.5,
20
+ "output": 15.0
21
+ },
22
+ "openai/gpt-5.4-mini": {
23
+ "input": 0.75,
24
+ "output": 4.5
25
+ },
26
+ "openai/gpt-5.5-pro": {
27
+ "input": 30.0,
28
+ "output": 180.0
29
+ },
30
+ "openai/gpt-5.4-pro": {
31
+ "input": 30.0,
32
+ "output": 180.0
33
+ },
34
+ "openai/gpt-5.3-codex": {
35
+ "input": 1.75,
36
+ "output": 14.0
37
+ },
38
+ "openai/o3": {
39
+ "input": 2.0,
40
+ "output": 8.0
41
+ },
42
+ "openrouter/auto": {
43
+ "input": -1,
44
+ "output": -1
45
+ },
46
+ "google/gemini-3.1-pro-preview": {
47
+ "input": 2.0,
48
+ "output": 12.0
49
+ },
50
+ "google/gemini-3-flash-preview": {
51
+ "input": 0.5,
52
+ "output": 3.0
53
+ },
54
+ "google/gemini-2.5-pro": {
55
+ "input": 1.25,
56
+ "output": 10.0
57
+ },
58
+ "google/gemini-2.5-flash": {
59
+ "input": 0.3,
60
+ "output": 2.5
61
+ },
62
+ "anthropic/claude-fable-5": {
63
+ "input": 10.0,
64
+ "output": 50.0
65
+ },
66
+ "anthropic/claude-opus-5": {
67
+ "input": 5.0,
68
+ "output": 25.0
69
+ },
70
+ "anthropic/claude-sonnet-5": {
71
+ "input": 3.0,
72
+ "output": 15.0
73
+ },
74
+ "anthropic/claude-haiku-4-5": {
75
+ "input": 1.0,
76
+ "output": 5.0
77
+ },
78
+ "anthropic/claude-opus-4.7": {
79
+ "input": 5.0,
80
+ "output": 25.0
81
+ },
82
+ "anthropic/claude-sonnet-4.6": {
83
+ "input": 3.0,
84
+ "output": 15.0
85
+ },
86
+ "deepseek/deepseek-v4-pro": {
87
+ "input": 0.44,
88
+ "output": 0.87
89
+ },
90
+ "deepseek/deepseek-v4-flash": {
91
+ "input": 0.14,
92
+ "output": 0.28
93
+ },
94
+ "kimi/kimi-k3": {
95
+ "input": 2.76,
96
+ "output": 13.8
97
+ },
98
+ "kimi/kimi-k2.7-code": {
99
+ "input": 0.9,
100
+ "output": 3.73
101
+ },
102
+ "kimi/kimi-k2.7-code-highspeed": {
103
+ "input": 1.79,
104
+ "output": 7.45
105
+ },
106
+ "kimi/kimi-k2.6": {
107
+ "input": 0.9,
108
+ "output": 3.73
109
+ },
110
+ "glm/glm-5.2": {
111
+ "input": 1.4,
112
+ "output": 4.4
113
+ },
114
+ "glm/glm-5.1": {
115
+ "input": 1.4,
116
+ "output": 4.4
117
+ },
118
+ "glm/glm-5": {
119
+ "input": 1.0,
120
+ "output": 3.2
121
+ },
122
+ "glm/glm-4.7": {
123
+ "input": 0.6,
124
+ "output": 2.2
125
+ },
126
+ "glm/glm-4.7-flash": {
127
+ "input": 0,
128
+ "output": 0
129
+ },
130
+ "glm/glm-4.7-flashx": {
131
+ "input": 0.07,
132
+ "output": 0.4
133
+ },
134
+ "glm/glm-5v-turbo": {
135
+ "input": 1.2,
136
+ "output": 4.0
137
+ },
138
+ "glm/glm-4.6v-flash": {
139
+ "input": 0,
140
+ "output": 0
141
+ },
142
+ "qwen/qwen3.7-max": {
143
+ "input": 0.83,
144
+ "output": 2.48
145
+ },
146
+ "qwen/qwen3.7-plus": {
147
+ "input": 0.22,
148
+ "output": 0.88
149
+ },
150
+ "qwen/qwen3.7-flash": {
151
+ "input": 0.03,
152
+ "output": 0.11
153
+ },
154
+ "qwen/qwen3-coder-plus": {
155
+ "input": 0.55,
156
+ "output": 2.21
157
+ },
158
+ "qwen/qwen-long": {
159
+ "input": 0.07,
160
+ "output": 0.28
161
+ },
162
+ "groq/llama-3.1-8b-instant": {
163
+ "input": 0,
164
+ "output": 0
165
+ },
166
+ "groq/llama-3.3-70b-versatile": {
167
+ "input": 0,
168
+ "output": 0
169
+ },
170
+ "openrouter/deepseek/deepseek-v4-flash": {
171
+ "input": 0.14,
172
+ "output": 0.28
173
+ },
174
+ "openrouter/google/gemini-2.5-flash": {
175
+ "input": 0.075,
176
+ "output": 0.3
177
+ },
178
+ "openrouter/google/gemini-2.5-pro": {
179
+ "input": 1.25,
180
+ "output": 5.0
181
+ },
182
+ "openrouter/anthropic/claude-sonnet-4.6": {
183
+ "input": 3.0,
184
+ "output": 15.0
185
+ },
186
+ "openrouter/deepseek/deepseek-v4-pro": {
187
+ "input": 0.43,
188
+ "output": 0.87
189
+ },
190
+ "openrouter/qwen/qwen3.7-max": {
191
+ "input": 1.48,
192
+ "output": 4.42
193
+ },
194
+ "openrouter/qwen/qwen3.7-plus": {
195
+ "input": 0.32,
196
+ "output": 1.28
197
+ },
198
+ "openrouter/qwen/qwen3.7-flash": {
199
+ "input": 0.03,
200
+ "output": 0.13
201
+ },
202
+ "openrouter/qwen/qwen3.6-plus": {
203
+ "input": 0.33,
204
+ "output": 1.95
205
+ },
206
+ "openrouter/qwen/qwen3.6-flash": {
207
+ "input": 0.19,
208
+ "output": 1.12
209
+ },
210
+ "openrouter/qwen/qwen3.6-27b": {
211
+ "input": 0.29,
212
+ "output": 2.4
213
+ },
214
+ "openrouter/qwen/qwen3.6-35b-a3b": {
215
+ "input": 0.14,
216
+ "output": 1.0
217
+ },
218
+ "openrouter/qwen/qwen3-coder": {
219
+ "input": 0.3,
220
+ "output": 1.0
221
+ },
222
+ "openrouter/qwen/qwen3-max": {
223
+ "input": 0.78,
224
+ "output": 3.9
225
+ },
226
+ "openrouter/qwen/qwen3-max-thinking": {
227
+ "input": 0.78,
228
+ "output": 3.9
229
+ },
230
+ "openrouter/qwen/qwen3-next-80b-a3b-instruct": {
231
+ "input": 0.09,
232
+ "output": 1.1
233
+ },
234
+ "openrouter/qwen/qwen3-next-80b-a3b-thinking": {
235
+ "input": 0.15,
236
+ "output": 1.2
237
+ },
238
+ "openrouter/qwen/qwen3-coder-plus": {
239
+ "input": 0.65,
240
+ "output": 3.25
241
+ },
242
+ "openrouter/qwen/qwen3.8-max": {
243
+ "input": 2.0,
244
+ "output": 6.0
245
+ },
246
+ "openrouter/qwen/qwen3.6-max-preview": {
247
+ "input": 1.03,
248
+ "output": 6.16
249
+ },
250
+ "openrouter/minimax/minimax-m3": {
251
+ "input": 0.3,
252
+ "output": 1.2
253
+ },
254
+ "openrouter/moonshotai/kimi-k2.7-code": {
255
+ "input": 0.73,
256
+ "output": 3.5
257
+ },
258
+ "openrouter/moonshotai/kimi-k2.6": {
259
+ "input": 0.59,
260
+ "output": 2.48
261
+ },
262
+ "openrouter/moonshotai/kimi-k2": {
263
+ "input": 0.57,
264
+ "output": 2.3
265
+ },
266
+ "openrouter/moonshotai/kimi-k2-thinking": {
267
+ "input": 0.6,
268
+ "output": 2.5
269
+ },
270
+ "openrouter/moonshotai/kimi-k3": {
271
+ "input": 3.0,
272
+ "output": 15.0
273
+ },
274
+ "openrouter/z-ai/glm-5.2": {
275
+ "input": 0.76,
276
+ "output": 2.42
277
+ },
278
+ "openrouter/z-ai/glm-5.1": {
279
+ "input": 0.97,
280
+ "output": 3.04
281
+ },
282
+ "openrouter/z-ai/glm-5": {
283
+ "input": 0.95,
284
+ "output": 2.55
285
+ },
286
+ "openrouter/z-ai/glm-5v-turbo": {
287
+ "input": 1.2,
288
+ "output": 4.0
289
+ },
290
+ "openrouter/z-ai/glm-5-turbo": {
291
+ "input": 1.2,
292
+ "output": 4.0
293
+ },
294
+ "openrouter/bytedance-seed/seed-2.0-mini": {
295
+ "input": 0.1,
296
+ "output": 0.4
297
+ },
298
+ "openrouter/bytedance-seed/seed-2.0-lite": {
299
+ "input": 0.25,
300
+ "output": 2.0
301
+ },
302
+ "openrouter/stepfun/step-3.7-flash": {
303
+ "input": 0.2,
304
+ "output": 1.15
305
+ },
306
+ "openrouter/stepfun/step-3.5-flash": {
307
+ "input": 0.1,
308
+ "output": 0.3
309
+ },
310
+ "openrouter/tencent/hy3": {
311
+ "input": 0.13,
312
+ "output": 0.53
313
+ },
314
+ "openrouter/tencent/hy3-preview": {
315
+ "input": 0.06,
316
+ "output": 0.21
317
+ },
318
+ "openrouter/xiaomi/mimo-v2.5-pro": {
319
+ "input": 0.43,
320
+ "output": 0.87
321
+ },
322
+ "openrouter/xiaomi/mimo-v2.5": {
323
+ "input": 0.14,
324
+ "output": 0.28
325
+ },
326
+ "openrouter/meituan/longcat-2.0": {
327
+ "input": 0.3,
328
+ "output": 1.2
329
+ },
330
+ "openrouter/kwaipilot/kat-coder-pro-v2.5": {
331
+ "input": 0.74,
332
+ "output": 2.96
333
+ },
334
+ "openrouter/nex-agi/nex-n2-pro": {
335
+ "input": 0.25,
336
+ "output": 1.0
337
+ },
338
+ "openrouter/arcee-ai/virtuoso-large": {
339
+ "input": 0.75,
340
+ "output": 1.2
341
+ },
342
+ "openrouter/deepcogito/cogito-v2.1-671b": {
343
+ "input": 1.25,
344
+ "output": 1.25
345
+ },
346
+ "openrouter/morph/morph-v3-large": {
347
+ "input": 0.9,
348
+ "output": 1.9
349
+ },
350
+ "openrouter/meta-llama/llama-4-maverick": {
351
+ "input": 0.2,
352
+ "output": 0.8
353
+ },
354
+ "openrouter/meta-llama/llama-4-scout": {
355
+ "input": 0.1,
356
+ "output": 0.3
357
+ },
358
+ "openrouter/mistralai/mistral-large-2512": {
359
+ "input": 0.5,
360
+ "output": 1.5
361
+ },
362
+ "openrouter/mistralai/mistral-medium-3.1": {
363
+ "input": 0.4,
364
+ "output": 2.0
365
+ },
366
+ "openrouter/mistralai/mistral-medium-3": {
367
+ "input": 0.4,
368
+ "output": 2.0
369
+ },
370
+ "openrouter/mistralai/codestral-2508": {
371
+ "input": 0.3,
372
+ "output": 0.9
373
+ },
374
+ "openrouter/x-ai/grok-4.20": {
375
+ "input": 1.25,
376
+ "output": 2.5
377
+ },
378
+ "openrouter/x-ai/grok-4.3": {
379
+ "input": 1.25,
380
+ "output": 2.5
381
+ },
382
+ "openrouter/amazon/nova-pro-v1": {
383
+ "input": 0.8,
384
+ "output": 3.2
385
+ },
386
+ "openrouter/nvidia/nemotron-3-super-120b-a12b": {
387
+ "input": 0.08,
388
+ "output": 0.4
389
+ },
390
+ "openrouter/nvidia/nemotron-3-ultra-550b-a55b": {
391
+ "input": 0.6,
392
+ "output": 3.6
393
+ },
394
+ "openrouter/nousresearch/hermes-4-405b": {
395
+ "input": 1.0,
396
+ "output": 3.0
397
+ },
398
+ "openrouter/thinkingmachines/inkling": {
399
+ "input": 1.0,
400
+ "output": 4.05
401
+ },
402
+ "openrouter/relace/relace-apply-3": {
403
+ "input": 0.85,
404
+ "output": 1.25
405
+ },
406
+ "openrouter/relace/relace-search": {
407
+ "input": 1.0,
408
+ "output": 3.0
409
+ },
410
+ "openrouter/google/gemini-3-flash-preview": {
411
+ "input": 0.5,
412
+ "output": 3.0
413
+ },
414
+ "openrouter/google/gemini-3.1-pro-preview": {
415
+ "input": 2.0,
416
+ "output": 12.0
417
+ },
418
+ "openrouter/google/gemini-3.6-flash": {
419
+ "input": 1.5,
420
+ "output": 7.5
421
+ },
422
+ "openrouter/anthropic/claude-opus-5": {
423
+ "input": 5.0,
424
+ "output": 25.0
425
+ },
426
+ "openrouter/anthropic/claude-sonnet-5": {
427
+ "input": 2.0,
428
+ "output": 10.0
429
+ },
430
+ "openrouter/anthropic/claude-haiku-4.5": {
431
+ "input": 1.0,
432
+ "output": 5.0
433
+ },
434
+ "openrouter/anthropic/claude-opus-4.7": {
435
+ "input": 5.0,
436
+ "output": 25.0
437
+ },
438
+ "openrouter/openai/gpt-5.6-sol": {
439
+ "input": 5.0,
440
+ "output": 30.0
441
+ },
442
+ "openrouter/openai/gpt-5.6-luna": {
443
+ "input": 0.1,
444
+ "output": 0.6
445
+ },
446
+ "openrouter/openai/gpt-5.4-mini": {
447
+ "input": 0.75,
448
+ "output": 4.5
449
+ },
450
+ "openrouter/openai/o3": {
451
+ "input": 2.0,
452
+ "output": 8.0
453
+ },
454
+ "openrouter/x-ai/grok-4.5": {
455
+ "input": 2.0,
456
+ "output": 6.0
457
+ },
458
+ "openrouter/amazon/nova-premier-v1": {
459
+ "input": 2.5,
460
+ "output": 12.5
461
+ },
462
+ "openrouter/mistralai/mistral-medium-3-5": {
463
+ "input": 1.5,
464
+ "output": 7.5
465
+ },
466
+ "openrouter/mistralai/mistral-large-2407": {
467
+ "input": 2.0,
468
+ "output": 6.0
469
+ },
470
+ "openrouter/cohere/command-a": {
471
+ "input": 2.5,
472
+ "output": 10.0
473
+ },
474
+ "openrouter/aion-labs/aion-3.0": {
475
+ "input": 3.0,
476
+ "output": 6.0
477
+ },
478
+ "openrouter/sakana/fugu-ultra": {
479
+ "input": 5.0,
480
+ "output": 30.0
481
+ }
482
+ }