Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
94206b3
feat(overview): generated project brief backend (inbox slice I)
raphaeltm Nov 16, 2026
8dbe7d3
test(overview): brief capability, facts and reply validation tests
raphaeltm Nov 16, 2026
149efae
feat(web): generated brief on the Project Overview (inbox slice I)
raphaeltm Nov 16, 2026
8063222
docs: Project Overview brief, its admin settings and API field
raphaeltm Nov 16, 2026
10d2cd3
docs: complete admin settings row for the brief
raphaeltm Nov 16, 2026
9414277
docs: fix admin settings table row
raphaeltm Nov 16, 2026
d2aa231
fix(overview): address security, Cloudflare and UI review of the brief
raphaeltm Nov 16, 2026
729c842
style: lint fixes
raphaeltm Nov 16, 2026
e1e0f70
fix(web): keep keyboard focus on the brief's toggle across expand and…
raphaeltm Nov 16, 2026
744e932
test(overview): page responds while the model call is pending; review…
raphaeltm Nov 16, 2026
d5076f0
task: archive inbox slice I task file (staging pending in PR)
raphaeltm Nov 16, 2026
1106826
Merge origin/main into inbox slice I; brief pane shadow check
raphaeltm Nov 16, 2026
7a3d12a
fix(overview): address CodeRabbit review of the brief
raphaeltm Nov 16, 2026
05b13d3
refactor(overview): SonarCloud findings on the brief
raphaeltm Nov 16, 2026
f24c219
Merge origin/main into inbox slice I (slice E, Insights receipt)
raphaeltm Nov 16, 2026
55fa20c
chore(migrations): renumber project_briefs to 0255
raphaeltm Nov 16, 2026
0bdeff7
Merge origin/main into inbox slice I (Insights H)
raphaeltm Nov 16, 2026
dba297e
Merge remote-tracking branch 'origin/main' into sam/implement-slice-i…
raphaeltm Nov 17, 2026
87152c2
fix(overview): space the brief's words around item names
raphaeltm Nov 17, 2026
fbe8547
Merge origin/main into inbox slice I
raphaeltm Nov 17, 2026
9644b8e
Merge remote-tracking branch 'origin/main' into sam/implement-slice-i…
raphaeltm Nov 17, 2026
67174be
fix(overview-brief): route through the L12 model target resolver
raphaeltm Nov 17, 2026
c5e9777
fix(overview-brief): only complete sentences reach the page
raphaeltm Nov 17, 2026
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
42 changes: 42 additions & 0 deletions apps/api/src/db/migrations/0255_project_briefs.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
-- Inbox slice I (idea 01M7G03ZCQ6TM6CMEYDRKQ8ST9, section 4.3): the generated brief on the
-- Project Overview. One row per project, the only home of the brief (no copies).
-- Writer: refreshProjectBriefIfDue() (apps/api/src/services/project-brief/refresh.ts).
-- Reader: readProjectBrief() (packages/operations/src/project-brief-read.ts), one statement in
-- the Overview's aggregated read.
-- It lives in D1 beside the Overview's other reads because it is read per project with them, and
-- every fact it is built from is in D1.
--
-- brief_json is NULL when the project was quiet at the last check (nothing to say). The ref_*
-- columns list the asks, running chats, automations and accounts the brief names, so the read can
-- drop a claim that is no longer true (or no longer visible to every member). Times are epoch milliseconds. generation_day/count is the
-- per-UTC-day generation budget (a daily cap by design: it resets on a new day, not on success).
--
-- Additive only (rule 31): a new table and two indexes. Deleting a project deletes its brief (it
-- has no meaning without the project and nothing references it).
CREATE TABLE IF NOT EXISTS project_briefs (
project_id TEXT PRIMARY KEY REFERENCES projects(id) ON DELETE CASCADE,
brief_json TEXT,
ref_asks_json TEXT NOT NULL DEFAULT '[]',
ref_chats_json TEXT NOT NULL DEFAULT '[]',
ref_automations_json TEXT NOT NULL DEFAULT '[]',
ref_accounts_json TEXT NOT NULL DEFAULT '[]',
fingerprint TEXT,
generated_at INTEGER,
checked_at INTEGER,
stale INTEGER NOT NULL DEFAULT 0,
pending_since INTEGER,
generation_day TEXT,
generation_count INTEGER NOT NULL DEFAULT 0,
last_error TEXT,
last_error_at INTEGER,
updated_at INTEGER NOT NULL
);

-- The brief's facts read each trigger's newest finished runs and a project's failed tasks' chats
-- on every check (readBriefFacts, packages/operations/src/project-brief-facts.ts). Without these,
-- the first walks and sorts every execution of every trigger (90 days of history), and the second
-- walks the project's whole chat history.
CREATE INDEX IF NOT EXISTS idx_trigger_executions_trigger_sequence
ON trigger_executions(trigger_id, sequence_number, created_at);
CREATE INDEX IF NOT EXISTS idx_session_summaries_task
ON session_summaries(task_id);
33 changes: 26 additions & 7 deletions apps/api/src/routes/project-overview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,24 @@
* GET /api/projects/:projectId/overview — the Project Overview page's one aggregated read
* (Inbox slice F1). A thin adapter over the shared `projectOverviewGet` operation, which owns
* the membership check, the queries and their limits (policy 5cb362e8).
*
* After the response, the generated brief (inbox slice I) is brought up to date in the
* background (`refreshProjectBriefIfDue`): the page shows the stored brief at once and never
* waits on the model. The refresh runs only after the read authorized the viewer.
*/
import { projectOverviewGet, toOperationHttpError } from '@simple-agent-manager/operations';
import {
getProjectBriefSettings,
projectOverviewGet,
toOperationHttpError,
} from '@simple-agent-manager/operations';
import { Hono } from 'hono';

import type { Env } from '../env';
import { log } from '../lib/logger';
import { parsePositiveInt, requireRouteParam } from '../lib/route-helpers';
import { getUserId, requireApproved, requireAuth } from '../middleware/auth';
import { webOperationContext } from '../operation-ports';
import { refreshProjectBriefIfDue } from '../services/project-brief/refresh';

export const projectOverviewRoutes = new Hono<{ Bindings: Env }>();

Expand All @@ -18,14 +28,23 @@ projectOverviewRoutes.get('/', requireAuth(), requireApproved(), async (c) => {
const projectId = requireRouteParam(c, 'projectId');
const runningLimit = parsePositiveInt(c.req.query('runningLimit'), 0) || undefined;
const recentLimit = parsePositiveInt(c.req.query('recentLimit'), 0) || undefined;
const ctx = webOperationContext(c, userId);
let result;
try {
const result = await projectOverviewGet(webOperationContext(c, userId), {
projectId,
runningLimit,
recentLimit,
});
return c.json(result);
result = await projectOverviewGet(ctx, { projectId, runningLimit, recentLimit });
} catch (error) {
throw toOperationHttpError(error);
}

const refresh = getProjectBriefSettings(ctx).then((settings) =>
refreshProjectBriefIfDue({ env: c.env, projectId: result.projectId, settings })
);
try {
c.executionCtx.waitUntil(refresh);
} catch {
// No ExecutionContext (some test harnesses): the refresh never throws, so it may run
// detached; it is simply not kept alive past the response.
log.warn('project_brief.refresh_detached', { projectId });
}
return c.json(result);
});
2 changes: 2 additions & 0 deletions apps/api/src/services/admin-setting-definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type {
InsightsInstallationSettingName,
InsightsPageSettingName,
InsightsReceiptSettingName,
ProjectBriefSettingName,
} from '@simple-agent-manager/operations';

import type { Env } from '../env';
Expand Down Expand Up @@ -50,6 +51,7 @@ export type AdminSettingName =
| InsightsPageSettingName
| InsightsInstallationSettingName
| InsightsCloudflareCostSettingName
| ProjectBriefSettingName
| RuntimeSecretRequestSettingName
| AgentEmailSettingName
| FleetOpsSettingName
Expand Down
35 changes: 35 additions & 0 deletions apps/api/src/services/admin-settings-overview-brief-definitions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/**
* Project Overview brief controls (inbox slice I). The definitions live in
* `@simple-agent-manager/operations` beside the resolver the Overview read and the generator use;
* this file registers them in the admin settings registry under "AI models", next to the other
* platform model spend controls.
*/
import {
PROJECT_BRIEF_ENABLED_SETTING,
PROJECT_BRIEF_INTEGER_SETTINGS,
} from '@simple-agent-manager/operations';

import {
type AdminSettingDefinition,
integerDefinition,
switchDefinition,
} from './admin-setting-definitions';

export const OVERVIEW_BRIEF_SETTINGS: AdminSettingDefinition[] = [
switchDefinition(
PROJECT_BRIEF_ENABLED_SETTING.name,
PROJECT_BRIEF_ENABLED_SETTING.defaultValue,
'AI models',
PROJECT_BRIEF_ENABLED_SETTING.description,
{}
),
...PROJECT_BRIEF_INTEGER_SETTINGS.map((setting) =>
integerDefinition(
setting.name,
setting.defaultValue,
'AI models',
setting.description,
setting.range
)
),
];
2 changes: 2 additions & 0 deletions apps/api/src/services/admin-settings-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { NODE_TUNNEL_SETTINGS } from './admin-settings-node-tunnel-definitions';
import { OPERATIONS_TELEMETRY_SETTINGS } from './admin-settings-operations-telemetry-definitions';
import { OPERATOR_SETTINGS } from './admin-settings-operator-definitions';
import { OUTBOUND_SETTINGS } from './admin-settings-outbound-definitions';
import { OVERVIEW_BRIEF_SETTINGS } from './admin-settings-overview-brief-definitions';
import { AI_PROXY_SETTINGS } from './ai-proxy-settings';
import { llmEndpointSettingDefinitions } from './llm-endpoint-settings';
export {
Expand Down Expand Up @@ -41,6 +42,7 @@ const definitions = [
...OPERATIONS_TELEMETRY_SETTINGS,
...OUTBOUND_SETTINGS,
...INSTRUCTION_BUDGET_SETTINGS,
...OVERVIEW_BRIEF_SETTINGS,
];

export const ADMIN_SETTINGS_REGISTRY: readonly AdminSettingDefinition[] = Object.freeze(
Expand Down
Loading
Loading