Skip to content

armgit / AiSOC

Public Imported from GitHub
0

Open-source AI Security Operations Center: alert fusion, LLM-agent triage, MITRE ATT&CK investigation, and a replayable decision ledger for every agent step. Self-hostable, runs with no API keys, MIT licensed. Ships an MCP server for Claude, Cursor and Continue.

fix(web): three cross-branch interactions in the war-room panel

beenuar528f8976b7c5
diff --git a/apps/web/src/components/cases/CaseWorkspace.test.tsx b/apps/web/src/components/cases/CaseWorkspace.test.tsx
index 22f992634..687910331 100644
--- a/apps/web/src/components/cases/CaseWorkspace.test.tsx
+++ b/apps/web/src/components/cases/CaseWorkspace.test.tsx
@@ -47,6 +47,16 @@ vi.mock('swr', () => ({
mutate: vi.fn(async () => undefined),
};
}
+ if (Array.isArray(key) && key[0] === 'war-rooms') {
+ // Depth 9.4's panel reads a list; an empty one renders its empty state
+ // without the panel swallowing the case fetch below.
+ return {
+ data: [],
+ error: undefined,
+ isLoading: false,
+ mutate: vi.fn(async () => undefined),
+ };
+ }
// Default: case workspace fetch.
return {
data: swrState.caseData,
diff --git a/apps/web/src/components/cases/WarRoomPanel.tsx b/apps/web/src/components/cases/WarRoomPanel.tsx
index 4c483e521..2783dd15d 100644
--- a/apps/web/src/components/cases/WarRoomPanel.tsx
+++ b/apps/web/src/components/cases/WarRoomPanel.tsx
@@ -79,7 +79,7 @@ export function WarRoomPanel({ caseId }: { caseId: string }) {
return (
<section className="bg-gray-900/60 border border-gray-800/60 rounded-xl p-4 space-y-3" aria-label="War room">
<div className="flex items-center justify-between">
- <h3 className="text-sm font-semibold text-gray-200">War room</h3>
+ <h2 className="text-sm font-semibold text-gray-200">War room</h2>
<div className="flex items-center gap-2">
<button
type="button"
diff --git a/apps/web/src/components/playbooks/stepSchemas.ts b/apps/web/src/components/playbooks/stepSchemas.ts
index 3e659c1f6..eb535536f 100644
--- a/apps/web/src/components/playbooks/stepSchemas.ts
+++ b/apps/web/src/components/playbooks/stepSchemas.ts
@@ -683,7 +683,11 @@ export const STEP_SCHEMAS: Record<StepType, StepSchema> = {
label: 'Ask over',
kind: 'select',
required: false,
- options: ['slack', 'teams', 'email'],
+ options: [
+ { value: 'slack', label: 'Slack' },
+ { value: 'teams', label: 'Teams' },
+ { value: 'email', label: 'Email' },
+ ],
help: 'Which configured destination the question goes out on. Defaults to Slack.',
},
{
@@ -699,7 +703,7 @@ export const STEP_SCHEMAS: Record<StepType, StepSchema> = {
{
key: 'manager',
label: 'Escalate to',
- kind: 'text',
+ kind: 'string',
required: false,
placeholder: 'Leave blank to use the directory',
help:
diff --git a/apps/web/src/lib/api.ts b/apps/web/src/lib/api.ts
index 38bf5cc61..628302c48 100644
--- a/apps/web/src/lib/api.ts
+++ b/apps/web/src/lib/api.ts
@@ -7336,6 +7336,43 @@ export interface AnalystWorkload {
unassigned: { open_cases: number; open_high_or_critical: number };
}
+/**
+ * One war room row, as `GET /api/v1/war-rooms/cases/{id}` returns it.
+ *
+ * `last_synced_at: null` means the sweep has never run for this room — a
+ * different fact from "ran and had nothing to say", and the panel renders
+ * them differently. `last_error` is empty on success; a room that has
+ * silently stopped mirroring is worse than one that was never opened, so
+ * the reason is surfaced rather than swallowed.
+ */
+export interface WarRoom {
+ id: string;
+ case_id: string;
+ provider: string;
+ channel_id: string;
+ channel_name: string;
+ channel_url: string;
+ state: string;
+ opened_by: string;
+ last_synced_at: string | null;
+ last_error: string;
+}
+
+// Depth 9.4 — case war rooms. #1315 shipped WarRoomPanel importing this
+// client without adding it, so the component could not typecheck; added by
+// the merge train against the server's own response models.
+export const warRoomApi = {
+ forCase: (caseId: string) => request<WarRoom[]>(`/api/v1/war-rooms/cases/${encodeURIComponent(caseId)}`),
+
+ /** Open fails loudly by design: the analyst pressed a button, so a vendor
+ * refusal surfaces as the vendor's own sentence rather than a quiet retry. */
+ open: (caseId: string, provider: 'slack' | 'teams') =>
+ request<WarRoom>(`/api/v1/war-rooms/cases/${encodeURIComponent(caseId)}`, {
+ method: 'POST',
+ body: JSON.stringify({ provider }),
+ }),
+};
+
export const caseDepthApi = {
/**
* Apply one triage decision to many alerts.
diff --git a/apps/web/src/test/a11y.test.tsx b/apps/web/src/test/a11y.test.tsx
index d56c152ba..28dd158c3 100644
--- a/apps/web/src/test/a11y.test.tsx
+++ b/apps/web/src/test/a11y.test.tsx
@@ -238,6 +238,11 @@ function swrFixture(key: string): unknown {
pageSize: 25,
};
}
+ if (key === "war-rooms" || key.startsWith("war-rooms/")) {
+ // Depth 9.4 panel: a list, and empty is the state every stock install is
+ // in. The panel's empty state is what axe should see.
+ return [];
+ }
if (key === "case" || key.startsWith("case/") || key.includes("/cases/")) {
return {
id: "c1",