Skip to content

an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions

Merge branch 'feature/desktop-notifications' into integration/roadmap

Chaitanya Girie179aaf65eab
diff --cc src/main/config.ts
index 81ccbf1e,8f53f5cd..aa712955
--- a/src/main/config.ts
+++ b/src/main/config.ts
@@@ -30,8 -19,8 +30,10 @@@ export interface HarnessConfig
semanticMemory: boolean;
/** Embedding model for the palace: lightweight 'minilm' or multilingual 'embeddinggemma'. */
embeddingModel: 'minilm' | 'embeddinggemma';
+ /** Recurring auto-dispatch missions handled by the scheduler. */
+ missions?: ScheduledMission[];
+ /** Fire native desktop notifications on agent lifecycle events (idle finish / waiting for input). */
+ notifications?: boolean;
}
const DEFAULTS: HarnessConfig = {
@@@ -42,7 -31,7 +44,8 @@@
defaultCommand: 'claude',
semanticMemory: true,
embeddingModel: 'minilm',
- missions: []
++ missions: [],
+ notifications: false
};
function configPath(): string {
diff --cc src/main/index.ts
index 11143811,7fa33621..595388be
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@@ -382,62 -302,9 +382,65 @@@ ipcMain.handle('app:resetAll', () =>
app.exit(0);
});
+// ─── IPC: token telemetry (real usage + est. cost from CC transcripts) ───────
+ipcMain.handle('hive:agentUsage', (_evt, cwd: unknown) =>
+ typeof cwd === 'string' ? readAgentUsage(cwd) : null);
+
+// ─── IPC: scheduled missions (recurring auto-dispatch) ──────────────────────
+ipcMain.handle('missions:list', () => readConfig().missions ?? []);
+ipcMain.handle('missions:save', (_evt, missions) => {
+ writeConfig({ missions: missions as ScheduledMission[] });
+ syncMissions();
+ return { ok: true };
+});
+
+// ─── IPC: full-text search across hive files (board, tasks, memory) ──────────
+ipcMain.handle('hive:textSearch', (_evt, query: unknown) => {
+ if (typeof query !== 'string' || !query.trim()) return { ok: false, results: [] };
+ const root = hive.root();
+ if (!root) return { ok: false, results: [] };
+ const q = query.toLowerCase();
+ const results: Array<{ source: string; excerpt: string }> = [];
+ // Each target file is (path, readable label). agents/<id>/memory.md is expanded below.
+ const targets: Array<{ path: string; source: string }> = [
+ { path: join(root, 'board.md'), source: 'board.md' },
+ { path: join(root, 'tasks.json'), source: 'tasks.json' }
+ ];
+ const agentsDir = join(root, 'agents');
+ if (existsSync(agentsDir)) {
+ for (const id of readdirSync(agentsDir)) {
+ targets.push({ path: join(agentsDir, id, 'memory.md'), source: `${id}/memory.md` });
+ }
+ }
+ for (const { path, source } of targets) {
+ if (!existsSync(path)) continue;
+ let hits = 0;
+ for (const line of readFileSync(path, 'utf8').split('\n')) {
+ if (hits >= 3) break;
+ const idx = line.toLowerCase().indexOf(q);
+ if (idx === -1) continue;
+ // ~40 chars of context on either side of the match.
+ const excerpt = line.slice(Math.max(0, idx - 40), idx + q.length + 40).trim();
+ results.push({ source, excerpt });
+ hits++;
+ }
+ }
+ return { ok: true, results };
+});
+
+// ─── IPC: GitHub issue ingestion (gh CLI) ────────────────────────────────────
+ipcMain.handle('github:issues', (_evt, cwd: unknown) =>
+ typeof cwd === 'string' ? listIssues(cwd) : { ok: false, error: 'no cwd' }
+);
+
+// ─── IPC: GitHub CI status watcher (gh CLI) ──────────────────────────────────
+ipcMain.handle('github:ciRuns', (_evt, cwd: unknown) =>
+ typeof cwd === 'string' ? listCIRuns(cwd) : { ok: false, error: 'no cwd' }
+);
+
+ // ─── IPC: desktop notifications toggle ──────────────────────────────────────
+ ipcMain.handle('app:setNotifications', (_evt, val) => writeConfig({ notifications: val === true }));
+
app.whenReady().then(() => {
// Bootstrap the hive (if harnessHome is configured) and start the message router.
if (hive.enabled()) {
diff --cc src/preload/index.ts
index a762db7b,d4535bd6..df345325
--- a/src/preload/index.ts
+++ b/src/preload/index.ts
@@@ -90,7 -65,7 +90,8 @@@ export interface HarnessConfig
defaultModel?: string;
semanticMemory: boolean;
embeddingModel: 'minilm' | 'embeddinggemma';
+ missions?: ScheduledMission[];
+ notifications?: boolean;
}
export interface MemoryStatus {
@@@ -275,38 -222,10 +276,43 @@@ const api =
* into onboarding. The process exits, so this promise never resolves. */
resetAll: (): Promise<void> => ipcRenderer.invoke('app:resetAll'),
+ // ─── Token telemetry (real usage + est. cost from CC transcripts) ──────────
+ /** Sum input/output/cache tokens + estimated USD cost for an agent from its
+ * Claude Code transcripts. Returns null for an invalid cwd. */
+ agentUsage: (cwd: string): Promise<AgentUsage | null> =>
+ ipcRenderer.invoke('hive:agentUsage', cwd),
+
+ // ─── Task kanban (hive/tasks.json) ───────────────────────────────────────
+ /** Overwrite the hive task ledger with the full task list and commit it. */
+ hiveWriteTasks: (tasks: HiveTask[]): Promise<{ ok: boolean; error?: string }> =>
+ ipcRenderer.invoke('hive:writeTasks', tasks),
+
+ // ─── Scheduled missions (recurring auto-dispatch) ──────────────────────────
+ listMissions: (): Promise<ScheduledMission[]> => ipcRenderer.invoke('missions:list'),
+ saveMissions: (missions: ScheduledMission[]): Promise<{ ok: boolean }> =>
+ ipcRenderer.invoke('missions:save', missions),
+
+ // ─── Full-text search across hive files (board, tasks, memory) ─────────────
+ textSearch: (q: string): Promise<{ ok: boolean; results: Array<{ source: string; excerpt: string }> }> =>
+ ipcRenderer.invoke('hive:textSearch', q),
+
+ // ─── GitHub issue ingestion (gh CLI) ───────────────────────────────────────
+ /** List up to 30 open issues in the repo at `cwd` via the `gh` CLI. Returns
+ * `{ ok: false, error }` if `gh` is missing/unauthenticated or `cwd` isn't a repo. */
+ githubIssues: (cwd: string): Promise<{ ok: boolean; issues?: GHIssue[]; error?: string }> =>
+ ipcRenderer.invoke('github:issues', cwd),
+
+ // ─── GitHub CI status watcher (gh CLI) ─────────────────────────────────────
+ /** List up to 5 recent CI (GitHub Actions) runs in the repo at `cwd` via the
+ * `gh` CLI. Returns `{ ok: false, error }` if `gh` is missing/unauthenticated,
+ * `cwd` isn't a repo, or the repo has no Actions. */
+ githubCIRuns: (cwd: string): Promise<{ ok: boolean; runs?: CIRun[]; error?: string }> =>
- ipcRenderer.invoke('github:ciRuns', cwd)
++ ipcRenderer.invoke('github:ciRuns', cwd),
++
+ // ─── Desktop notifications ───────────────────────────────────────────────────
+ /** Toggle native desktop notifications for agent lifecycle events. */
+ setNotifications: (v: boolean): Promise<HarnessConfig> =>
+ ipcRenderer.invoke('app:setNotifications', v)
};
contextBridge.exposeInMainWorld('cth', api);