Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
Merge the one waiting-on-you state into the inbox panel
milind-soni7d214b5c7e84
diff --cc server/index.tsindex 50eaf99c4c,1dca1cc291..1d4d1b5151--- a/server/index.ts+++ b/server/index.ts@@@ -228,7 -228,7 +228,7 @@@ import { createOneOnOneGoals } from "./import { BUILT_IN_DRIVERS } from "./drivers/builtIn.ts";import { openCodeProviderKeysAllowed, setOpenCodeProviderKeyPolicy } from "./drivers/acp/opencode-go.ts";- import { openCardRows, readMessageText, recallMessages, recentMessages, closeMessageSearch, closeMessageDb, chatFollowups, cancelledChatFollowup, settleChatFollowups, threadsReferencing, logNotification, lastRowAt } from "./message-db.ts";-import { readMessageText, recallMessages, recentMessages, closeMessageSearch, closeMessageDb, chatFollowups, cancelledChatFollowup, settleChatFollowups, threadsReferencing, logNotification, lastRowAt, threadsWithCardsSince } from "./message-db.ts";++import { openCardRows, readMessageText, recallMessages, recentMessages, closeMessageSearch, closeMessageDb, chatFollowups, cancelledChatFollowup, settleChatFollowups, threadsReferencing, logNotification, lastRowAt, threadsWithCardsSince } from "./message-db.ts";import { briefCrossingLabel, claimRecallCrossings, recallCrossingLabel } from "./recall-disclosure.ts";import { parseSince, parseUntil, recentWork, recentWorkPrompt, turnOutcomeLine } from "./recent-work.ts";import { chiefEscalationsEnabled, NEEDS_INPUT_GATE, peerApprovalGate, RAISED_GATE } from "./escalations.ts";diff --cc server/message-db.tsindex d70fce4663,8f812f2485..169058ee10--- a/server/message-db.ts+++ b/server/message-db.ts@@@ -559,16 -561,16 +561,26 @@@ export function attentionRows(since: nu).all(since, since, since) as unknown as AttentionRow[];}+/** Every card still open, oldest first, whenever it was asked. */+export function openCardRows(): Array<{ threadId: string; id: string; at: number; card: string | null; fromBotId: string | null }> {+ return db().prepare(+ "SELECT thread_id AS threadId, id, at, json_extract(json, '$.card') AS card, json_extract(json, '$.from.botId') AS fromBotId " ++ `FROM messages INDEXED BY messages_work_at WHERE ${WORK_KINDS} AND kind = 'options' ` ++ "AND json_extract(json, '$.card.requestId') IS NOT NULL AND json_extract(json, '$.card.answered') IS NULL AND coalesce(json_extract(json, '$.card.dismissed'), 0) = 0 " ++ "AND coalesce(json_extract(json, '$.card.expired'), 0) = 0 AND json_extract(json, '$.helperIntro') IS NULL AND json_extract(json, '$.inbox') IS NULL ORDER BY at",+ ).all() as Array<{ threadId: string; id: string; at: number; card: string | null; fromBotId: string | null }>;+}++ /** The conversations with a card asked since `since` that has not been answered, oldest first; the caller reads each card. */+ export function threadsWithCardsSince(since: number): string[] {+ const rows = db().prepare(+ `SELECT DISTINCT thread_id AS threadId FROM messages INDEXED BY messages_cards_at WHERE ${CARD_KINDS} AND at >= ? ` ++ `UNION SELECT DISTINCT thread_id AS threadId FROM messages INDEXED BY messages_work_at WHERE ${WORK_KINDS} AND kind = 'options' AND at >= ? ` ++ "AND json_extract(json, '$.card.requestId') IS NOT NULL AND json_extract(json, '$.card.answered') IS NULL AND coalesce(json_extract(json, '$.card.dismissed'), 0) = 0",+ ).all(since, since) as Array<{ threadId: string }>;+ return rows.map((row) => row.threadId);+ }+/** Successful tool calls after a time whose row mentions `word` (case-insensitive), newest last. */export function successfulCallsMentioning(since: number, word: string): Array<{ at: number; name: string; input: string | null }> {return db().prepare(