Files
AgentCompany/tests/unit/run-message-poller.test.ts
ZacharyZhang-NYandClaude Opus 5.5 245ff66336
Build Release Installers / Release for the tag (push) Successful in 16s
Build Release Installers / Windows installer (NSIS x64) (push) Successful in 1m48s
Build Release Installers / Linux packages (AppImage + deb x64) (push) Successful in 2m21s
CI / Typecheck, lint, tests, e2e (push) Successful in 3m52s
Build Release Installers / macOS installers (dmg + zip, x64 + arm64) (push) Successful in 7m15s
1.5.1: refined office, chat in the app language, current OpenAI models, own connector keys
- Home: the goal title box is two line boxes tall (2.8em), so a third line no longer peeks out.
- Chat messages, reply fallbacks and assignment DMs follow the app display language; tasks and documents keep the working language.
- OpenAI and GPT-account model lists match OpenAI's current line-up; default gpt-6.1-sol.
- Onboarding connectors step takes the operator's Composio and logo.dev keys, then lists the toolkits the Composio project enables; without a key Connectors leaves the sidebar.
- Google Antigravity removed end to end (migration 111), with the remote-revocation path only it used.
- Office: 2x pixel people with outlines, rim light, walk, typing and blink; dithered real-clock lighting; detailed furniture and floors.
- Per-agent model picker lists the provider's whole model list, live when connected.
- Chat wake context breaks same-millisecond ties by insertion order; the mid-run inbox dedupes by message id.
- The stored "clock" theme reads back instead of falling to "system".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-09 21:12:19 -04:00

42 lines
2.6 KiB
TypeScript

import { randomUUID } from "node:crypto";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { describe, expect, test } from "vitest";
import { DatabaseConnection } from "../../src/main/database/connection";
import { OrganizationService } from "../../src/main/services/organization-service";
import { ChatService } from "../../src/main/services/chat-service";
import { createRunMessagePoller } from "../../src/main/services/chat-wake-context";
describe("the mid-run inbox", () => {
test("injects each new message once, even after another company's deletion frees message row numbers", () => {
const connection = new DatabaseConnection(join(tmpdir(), `ac-inbox-${randomUUID()}.db`));
const db = connection.db;
const organization = new OrganizationService(db);
const chat = new ChatService(db);
const company = (name: string) => {
const orgId = organization.createOrganization({ organizationName: name, employeeName: "Yang", mission: "m", goal: "g" });
const agentId = organization.createAgent({ orgId, name: "Dana", role: "Engineer", department: "Engineering", modelProviderId: null, modelId: null, budgetCents: 1000, managerAgentId: null });
const employeeId = (db.prepare("select id from employees where org_id = ?").get(orgId) as { id: string }).id;
const spaceId = chat.ensureDirectSpace(orgId, { type: "employee", id: employeeId }, { type: "agent", id: agentId });
const say = (bodyMd: string, threadId: string | null) => {
const messageId = chat.sendMessage({ orgId, spaceId, threadId, senderType: "employee", senderId: employeeId, bodyMd, attachmentFileIds: [] });
return (db.prepare("select thread_id from chat_messages where id = ?").get(messageId) as { thread_id: string }).thread_id;
};
return { orgId, agentId, say };
};
const ours = connection.transaction(() => company("Ours"));
const threadId = ours.say("Start.", null);
const theirs = connection.transaction(() => company("Theirs"));
for (let i = 0; i < 5; i++) theirs.say(`Noise ${i}`, null);
const injected: string[] = [];
const poll = createRunMessagePoller(db, { orgId: ours.orgId, agentId: ours.agentId, sourceThreadId: threadId, runStartedAt: new Date(0).toISOString(), onInjected: (entries) => injected.push(...entries.map((entry) => entry.id)) });
expect(poll()).toBeNull();
connection.transaction(() => organization.deleteOrganization(theirs.orgId));
ours.say("Correction.", threadId);
expect(poll()).toContain("Correction.");
expect(poll()).toBeNull();
expect(injected).toHaveLength(1);
connection.close();
});
});