Skip to content
This repository was archived by the owner on Oct 27, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,6 @@ PI_DEFAULT_MODEL=openai/gpt-6-luna
# Below the confidence floor, Auto Review asks the user.
# RAKAZO_AUTO_REVIEW_MODEL=jev-latest
# RAKAZO_AUTO_REVIEW_MIN_CONFIDENCE=0.5
# Optional Fish Audio speech model used when a connection does not set its own.
# Default is s2.1-pro. A Fish connection can override this in Voice settings.
# FISH_TTS_MODEL=s1
# Optional local OpenAI-compatible models. Leave blank to disable the provider.
RAKAZO_LOCAL_MODELS=
RAKAZO_LOCAL_MODELS_URL=http://127.0.0.1:11434/v1
Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- This is a public repository: assume all tracked content and diffs are public. Never commit secrets, `.env` files, private URLs, personal/customer data, or real production data; use fake placeholders. Review `git status` and the staged diff before committing, and never force-add ignored files. If private data appears, stop and alert the maintainer.
- Milo is one product across web, Electron desktop, and Expo mobile; Electron hosts the web UI. Put shared behavior, contracts, API logic, and reusable UI in packages. Keep only genuinely native navigation, storage, permissions, and interactions platform-specific. Core workflows must cover every applicable surface or degrade safely for an explicit reason.
- No hosted vendor is required to run the core product. Keep LLMs, sandboxes, memory, voice, integrations, and future external services optional and behind provider-neutral interfaces. Vendor SDKs, configuration, and translation belong only in adapters and composition roots. New providers must reuse shared contracts and deterministic offline conformance tests.
- No hosted vendor is required to run the core product. Keep LLMs, sandboxes, memory, integrations, and future external services optional and behind provider-neutral interfaces. Vendor SDKs, configuration, and translation belong only in adapters and composition roots. New providers must reuse shared contracts and deterministic offline conformance tests.
- Keep UI and copy minimal. Show advanced capability progressively and only when it becomes relevant; do not add explainer text that repeats the interface. Frontends express intent and render state; the backend owns orchestration, authorization, validation, retries, recovery, and provider translation. Give controls concise accessible names when needed.
- Treat every visible word as UI. Start UX work by asking what can be removed, and prefer progressive disclosure over persistent explanation or status chrome. If a PR adds user-facing copy, its description must quote the copy, explain why it is necessary, and say why removing it or revealing it only when relevant would not work.
- Configure compatible providers and models through shared connection settings and standard protocol capabilities; never add provider- or model-specific environment variables when the generic connection can express the behavior.
Expand Down
5 changes: 2 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

### Fixed

- Fish Audio speech can use a model other than s2.1-pro. Each Fish connection can set Speech model in Voice settings; `FISH_TTS_MODEL` is the default only when that field is empty (unset still uses s2.1-pro). A failed speak, transcribe, or voice-list request logs the upstream Fish status and message, including when the error body cannot be read, and the message returned to the client does not include the API key.
- A picture attached to an earlier message is now visible to the bot when a later turn asks about it, for a model that can see images. Only the current turn carried its images; older turns arrived as a text marker, so the bot asked for the picture again. The most recent user turns now keep their images, within a fixed turn, byte, and per-model image budget. A turn whose pictures exceed the byte budget keeps the newest ones that fit. If an earlier picture cannot be read, its history marker says it is unavailable.
- A bot on a reasoning model could answer with "No response. Try again." on a harder question: thinking is billed against the same output ceiling as the reply, and the 4k default left nothing for the reply itself. Reasoning models now get a 32k output ceiling instead, still bounded by whatever the model itself allows.
- A newly created bot's thread opened empty and stayed silent until given real work, so a misread `title`/`description`/`instructions` went unnoticed until it cost a run. Creating a bot now queues one turn where it states how it understood its role and asks for anything it needs.
Expand All @@ -18,7 +17,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
- Pipedream exposed every tool of every connected app at once, so a handful of apps could fill a run's tool list. Above 20 tools the connector now offers the same lazy catalog the MCP connector uses (`pipedream_search_tools`, `pipedream_load_tool`, and `pipedream_execute_tool`), with names grouped by app.
- The Needs you computer card in a thread now includes Open, which opens that bot's computer the same way the computer panel does, including from a group member bot.
- Bots with more than 20 MCP tools failed on every Claude model behind a Claude Pro/Max/Team sign-in with "You're out of extra usage": Anthropic rejects Claude Code OAuth requests that carry a tool named `mcp_*`. The lazy catalog wrappers are now `connectors_search_tools`, `connectors_load_tool` and `connectors_execute_tool`.
- Changing a bot's model, thinking level or voice failed with a validation error once its instructions outgrew the description limit, and saving any other setting overwrote those instructions with the shorter description text. Bot settings now put the description and instructions on the wire only when that field was edited, clamped to each field's own limit.
- Changing a bot's model or thinking level failed with a validation error once its instructions outgrew the description limit, and saving any other setting overwrote those instructions with the shorter description text. Bot settings now put the description and instructions on the wire only when that field was edited, clamped to each field's own limit.

### Changed

Expand All @@ -33,7 +32,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
### Added

- Sign in with ChatGPT, for a server on the same computer as the browser or desktop app. The same sign-in can run that person's bots on their ChatGPT plan in place of Claude Code. See [Sign in with ChatGPT](docs/self-host.md#sign-in-with-chatgpt).
- Voice mode: spoken replies, hold-to-talk dictation, and half-duplex calls with ElevenLabs, OpenAI, Cartesia, or Fish Audio.
- Desktop owners using Docker can opt into running bot shell commands directly on their computer. This grants access under the owner's OS account; see [computer providers](docs/self-host.md#choosing-a-computer-provider).
- GitHub Copilot and SuperGrok / X Premium sign-in for model access.
- Spawn peer bots (each with its own thread and computer) and short-lived in-thread subagents.
Expand All @@ -45,6 +43,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

### Removed

- Voice mode (spoken replies, hold-to-talk dictation, and provider calls). Voice settings, credentials, and related APIs are gone.
- Model sign-in under `AGENT_RUNTIME=claude-code`. Every bot runs on the Claude Code CLI's own login, so web, desktop and mobile no longer show model settings or the per-bot model and thinking pickers there.
- Sign in with Claude Pro/Max. Anthropic only allows Claude subscriptions inside Claude Code, so Milo no longer signs in to Claude or calls it with a subscription token. A Claude sign-in saved earlier stops working, and a subscription token (`sk-ant-oat…`) pasted as an Anthropic key is refused. Anthropic API keys still work. To run on a Claude subscription, use `AGENT_RUNTIME=claude-code`.
- Nonfunctional Grant folder picker in the desktop app.
Expand Down
17 changes: 1 addition & 16 deletions apps/api/src/ai-consent.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ function setup() {
spaceModelPreference: { findMany: vi.fn(async () => []), findFirst: vi.fn(async () => null) },
secret: { findMany: vi.fn(async () => []) },
bot: { findMany: vi.fn(async () => []) },
spaceVoicePreference: {
findFirst: vi.fn(async () => ({ credential: { provider: "openai" }, voiceId: "alloy" })),
findMany: vi.fn(async () => [{ credential: { provider: "openai" } }]),
},
deploymentSettings: { findUnique: vi.fn(async () => null) },
aiDataConsent: { findMany: vi.fn(async () => []), upsert },
$transaction: vi.fn(async (queries) => Promise.all(queries)),
Expand All @@ -43,7 +39,6 @@ describe("consent grants", () => {
expect(status.recipients.map((recipient) => recipient.name)).toEqual(
expect.arrayContaining(["Anthropic"]),
);
expect(deps.prisma.spaceVoicePreference.findMany).not.toHaveBeenCalled();
expect(deps.prisma.bot.findMany).toHaveBeenCalledWith(
expect.objectContaining({ where: expect.objectContaining({ id: { in: ["bot"] } }) }),
);
Expand All @@ -55,24 +50,14 @@ describe("consent grants", () => {
expect(status.recipients.map((recipient) => recipient.name)).toEqual(["Claude Code"]);
expect(status.recipients[0]?.privacyUrl).toBe("https://www.anthropic.com/legal/privacy");
});
it("discloses only the selected voice provider before a voice action", async () => {
const { deps, actor } = setup();
vi.mocked(deps.prisma.spaceVoicePreference.findMany).mockResolvedValue([
{ credential: { provider: "openai" } },
{ credential: { provider: "elevenlabs" } },
] as never);
const status = await aiConsentStatus(deps, actor, { uses: ["voice"] });
expect(status.recipients).toHaveLength(1);
expect(status.recipients[0]?.name).toBe("OpenAI");
expect(deps.prisma.spaceVoicePreference.findMany).not.toHaveBeenCalled();
});
it("returns an operator policy without requiring a hosted provider", async () => {
const { deps, actor } = setup();
deps.env.privacyPolicyUrl = "https://example.com/privacy";
expect((await aiConsentStatus(deps, actor)).privacyUrl).toBe("https://example.com/privacy");
});
it("rejects stale disclosures, unknown recipients, and a changed account or Space", async () => {
const { deps, actor, upsert } = setup();
deps.env.agentRuntime = "claude-code";
const current = await aiConsentStatus(deps, actor);
const input = {
scope: current.scope,
Expand Down
22 changes: 3 additions & 19 deletions apps/api/src/ai-consent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ import {
} from "@milo/adapters";
import type { Actor, AiConsentQuery, AiConsentStatus, AiRecipient } from "@milo/contracts";
import { AI_DISCLOSURE_VERSION, AI_PRIVACY_URL } from "@milo/contracts";
import {
findDefaultModelCredential,
findDefaultVoiceCredential,
findModelCredential,
} from "@milo/db";
import { findDefaultModelCredential, findModelCredential } from "@milo/db";
import { ORPCError } from "@orpc/server";
import type { RouterDeps } from "./router.js";
import { resolveThreadTarget } from "./thread-target.js";
Expand All @@ -22,7 +18,7 @@ export async function aiConsentStatus(
actor: Actor,
query: AiConsentQuery = {},
): Promise<AiConsentStatus> {
const uses = query.uses ?? ["model", "voice"];
const uses = query.uses ?? ["model"];
const modelsEnabled = uses.includes("model") && deps.env.agentRuntime !== "scripted";
const target =
query.botId || query.groupId ? await resolveThreadTarget(deps.prisma, actor, query) : null;
Expand All @@ -31,7 +27,7 @@ export async function aiConsentStatus(
? [target.botId]
: target.memberBotIds
: undefined;
const [preferences, defaultCredential, bots, voices, settings, consents] = await Promise.all([
const [preferences, defaultCredential, bots, settings, consents] = await Promise.all([
modelsEnabled
? deps.prisma.spaceModelPreference.findMany({
where: { userId: actor.userId, spaceId: actor.spaceId },
Expand All @@ -50,16 +46,6 @@ export async function aiConsentStatus(
select: { modelProvider: true, modelId: true, thinkingLevel: true },
})
: [],
uses.includes("voice")
? query.uses
? findDefaultVoiceCredential(deps.prisma, actor).then((credential) =>
credential ? [{ credential }] : [],
)
: deps.prisma.spaceVoicePreference.findMany({
where: { userId: actor.userId, spaceId: actor.spaceId },
include: { credential: true },
})
: [],
modelsEnabled ? deps.prisma.deploymentSettings.findUnique({ where: { id: "default" } }) : null,
deps.prisma.aiDataConsent.findMany({
where: { userId: actor.userId, spaceId: actor.spaceId, version: AI_DISCLOSURE_VERSION },
Expand Down Expand Up @@ -148,8 +134,6 @@ export async function aiConsentStatus(
);
}
}
for (const voice of voices)
add(aiRecipient({ provider: voice.credential.provider, use: "voice" }));
return {
scope: createHash("sha256")
.update(JSON.stringify([actor.userId, actor.spaceId]))
Expand Down
12 changes: 0 additions & 12 deletions apps/api/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ import { mountApiRequestBodyLimits } from "./request-body-limit.js";
import type { RouterDeps } from "./router.js";
import { createRouter, saveChatGptPlan } from "./router.js";
import { mountScreenTarget } from "./screen-proxy.js";
import { mountVoiceHttpRoutes } from "./voice.js";
import { mountWebhookHttpRoutes } from "./webhook.js";

/**
Expand Down Expand Up @@ -514,17 +513,6 @@ export async function createApp(
if (matched) return c.newResponse(response.body, response);
await next();
});
mountVoiceHttpRoutes(app, { prisma, secrets }, async (c) => {
const session = await auth.api.getSession({ headers: sessionHeaders(c.req.raw) });
if (!session?.user) return null;
const actor = await requireMembership(
prisma,
session.user.id,
c.req.header("x-rakazo-space-id"),
).catch(() => null);
if (actor) enrichLogContext({ "user.id": actor.userId, "space.id": actor.spaceId });
return actor;
});
mountWebhookHttpRoutes(app, { prisma, secrets, events, jobs });

app.route(
Expand Down
6 changes: 3 additions & 3 deletions apps/api/src/request-body-limit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe("API request body limits", () => {
mountApiRequestBodyLimits(app);
app.post("/api/auth/sign-in/email", async (c) => c.json(await parse(c.req.raw)));
app.post("/rpc/test", async (c) => c.json(await parse(c.req.raw)));
app.post("/api/voice/speak", async (c) => c.json(await parse(c.req.raw)));
app.post("/api/webhooks/inbound", async (c) => c.json(await parse(c.req.raw)));

const request = (path: string, contentLength: number) =>
app.request(path, {
Expand All @@ -40,11 +40,11 @@ describe("API request body limits", () => {
});
const auth = await request("/api/auth/sign-in/email", MAX_AUTH_REQUEST_BYTES + 1);
const rpc = await request("/rpc/test", MAX_RPC_REQUEST_BYTES + 1);
const voice = await request("/api/voice/speak", MAX_RPC_REQUEST_BYTES + 1);
const webhook = await request("/api/webhooks/inbound", MAX_RPC_REQUEST_BYTES + 1);

expect(auth.status).toBe(413);
expect(rpc.status).toBe(413);
expect(voice.status).toBe(200);
expect(webhook.status).toBe(200);
expect(parse).toHaveBeenCalledOnce();
});

Expand Down
108 changes: 0 additions & 108 deletions apps/api/src/router.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2825,8 +2825,6 @@ describe("bot model auth on save", () => {
parentBotId: null,
createdAt: now,
updatedAt: now,
voiceId: null,
autoSpeak: false,
modelProvider: "openai-codex",
modelId,
thinkingLevel: null,
Expand Down Expand Up @@ -3191,112 +3189,6 @@ describe("routines.update", () => {
});
});

describe("threads.endCall", () => {
function fixture(duplicateMarker?: boolean) {
const created: { blocks?: unknown; clientNonce?: string }[] = [];
const events: { type: string; payload: Record<string, unknown> }[] = [];
const tx = {
thread: { update: vi.fn().mockResolvedValue({ nextMessageSeq: 3, nextEventSeq: 5 }) },
message: {
create: vi.fn(async ({ data }: { data: { blocks: unknown; clientNonce?: string } }) => {
if (duplicateMarker) throw Object.assign(new Error("unique"), { code: "P2002" });
created.push({ blocks: data.blocks, clientNonce: data.clientNonce });
return { id: "message-1" };
}),
},
event: vi.fn(),
task: { create: vi.fn().mockResolvedValue({ id: "task-1" }) },
run: {
create: vi.fn().mockResolvedValue({ id: "run-1" }),
findUnique: vi.fn().mockResolvedValue({ status: "queued", startedAt: null }),
},
};
tx.event = {
create: vi.fn(async ({ data }: { data: { type: string; payload: never } }) => {
events.push({ type: data.type, payload: data.payload });
return { seq: 4, threadId: "thread-1" };
}),
} as never;
const prisma = {
bot: {
findFirst: vi
.fn()
.mockResolvedValue({ id: "bot-1", thread: { id: "thread-1" }, computer: null }),
},
taughtSkill: { findFirst: vi.fn().mockResolvedValue(null) },
$transaction: vi.fn(async (run: (client: typeof tx) => unknown) => run(tx)),
} as unknown as PrismaClient;
const enqueue = vi.fn().mockResolvedValue(undefined);
const deps = {
prisma,
events: { notify: vi.fn().mockResolvedValue(undefined) },
jobs: { enqueue },
env: { sandboxProvider: "fake" },
} as unknown as RouterDeps;
const actor = {
spaceId: "space-1",
userId: "user-1",
email: "user@rakazo.test",
isDeploymentOwner: true,
} satisfies Actor;
const handler = new RPCHandler(createRouter(deps));
return {
tx,
created,
events,
enqueue,
call: () =>
handler.handle(
new Request("http://127.0.0.1/rpc/threads/endCall", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({ json: { botId: "bot-1", callId: "call-1" } }),
}),
{ prefix: "/rpc", context: { actor } },
),
};
}

it("closes the card and queues a call_end run", async () => {
const { call, created, events, tx, enqueue } = fixture();
const { response } = await call();
expect(response.status).toBe(200);
await expect(response.json()).resolves.toEqual({ json: { ok: true } });
expect(created[0]?.blocks).toEqual([
{ kind: "voice_call", callId: "call-1", title: "", farewell: "" },
]);
expect(created[0]?.clientNonce).toBe("call:call-1:marker");
expect(events.map((event) => event.type)).toEqual([
"thread.message.created",
"thread.call.ended",
]);
expect(events[1]?.payload).toMatchObject({
callId: "call-1",
title: "",
messageId: "message-1",
});
expect(events[0]?.payload).toMatchObject({ callId: "call-1", messageId: "message-1" });
expect(tx.run.create).toHaveBeenCalledWith(
expect.objectContaining({
data: expect.objectContaining({ trigger: "call_end", taskId: "task-1" }),
}),
);
expect(String(tx.run.create.mock.calls[0]?.[0]?.data?.clientNonce)).toMatch(/^call:call-1:/);
expect(enqueue).toHaveBeenCalledOnce();
});

it("is a no-op when a concurrent hang-up already wrote the marker", async () => {
const { call, created, events, tx, enqueue } = fixture(true);
const { response } = await call();
expect(response.status).toBe(200);
await expect(response.json()).resolves.toEqual({ json: { ok: true } });
expect(created).toEqual([]);
expect(events).toEqual([]);
expect(tx.run.create).not.toHaveBeenCalled();
expect(enqueue).not.toHaveBeenCalled();
});
});

describe("groups.archive", () => {
async function archiveGroup(archivedAt: Date | null) {
const calls: string[] = [];
Expand Down
Loading
Loading