summaryrefslogtreecommitdiff
path: root/makima/frontend/src/components/directives/DirectiveList.tsx
diff options
context:
space:
mode:
authorsoryu <soryu@soryu.co>2026-05-08 16:34:11 +0100
committerGitHub <noreply@github.com>2026-05-08 16:34:11 +0100
commitdce7f50e503dc374aaf879df33e725af16c4cc78 (patch)
tree50b6aad1aa47e56b61f0700e224028bb7578cb91 /makima/frontend/src/components/directives/DirectiveList.tsx
parente4f1622a0f0ac74707cc1c9810e0b99e948d1319 (diff)
downloadsoryu-dce7f50e503dc374aaf879df33e725af16c4cc78.tar.gz
soryu-dce7f50e503dc374aaf879df33e725af16c4cc78.zip
feat(directives): drop directives.goal — orchestration reads contract body (#132)
Hard cut. The unified contracts surface owns spec text now; the directive itself is just a folder. The orchestrator daemon reads the active contract's body when it spawns, replans, or runs completion. Schema (migration 20260510000000): - DROP TABLE directive_goal_history - ALTER TABLE directives DROP COLUMN goal - ALTER TABLE directives DROP COLUMN goal_updated_at New repo helper: - get_active_contract_body(directive_id) — picks the active|queued|draft contract (in that order), most-recent first. Backend cuts: - Directive / DirectiveSummary / CreateDirectiveRequest / UpdateDirectiveRequest lose goal & goalUpdatedAt. - CreateDirectiveRequest gains optional `contractBody` — when provided, create_directive_for_owner auto-creates a first contract with that body in the same transaction. - Removed: update_directive_goal, update_directive_goal_keep_orchestrator, save_directive_goal_history, get_directive_goal_history, DirectiveGoalHistory model, UpdateGoalRequest. - Removed handlers::directives::update_goal + the /directives/{id}/goal route. - orchestration::directive::build_planning_prompt / build_completion_prompt / build_order_pickup_prompt now take a `contract_body: &str` instead of `goal_history`. classify_goal_change + try_interrupt_planner_with_goal_edit + GoalChangeKind + GoalEditInterruptResult removed (they were only useful for the small-vs-large goal-edit interrupt cycle). CLI: - `makima directive update-goal` removed (UpdateGoalArgs deleted, Commands enum trimmed, ApiClient::directive_update_goal + UpdateGoalRequest deleted). Frontend: - Directive / DirectiveSummary / CreateDirectiveRequest types lose goal & goalUpdatedAt; CreateDirectiveRequest gains `contractBody`. - useDirective drops updateGoal helper. - api.ts updateDirectiveGoal removed. - Legacy DirectiveList + DirectiveDetail components deleted; the /directives route now always renders the document-mode page. The user-settings documentModeEnabled flag is no longer consulted at the route level. - NewContractModal passes body via contractBody. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'makima/frontend/src/components/directives/DirectiveList.tsx')
-rw-r--r--makima/frontend/src/components/directives/DirectiveList.tsx140
1 files changed, 0 insertions, 140 deletions
diff --git a/makima/frontend/src/components/directives/DirectiveList.tsx b/makima/frontend/src/components/directives/DirectiveList.tsx
deleted file mode 100644
index a35c8b1..0000000
--- a/makima/frontend/src/components/directives/DirectiveList.tsx
+++ /dev/null
@@ -1,140 +0,0 @@
-import { useState, useMemo } from "react";
-import type { DirectiveSummary, DirectiveStatus } from "../../lib/api";
-import { useSupervisorQuestions } from "../../contexts/SupervisorQuestionsContext";
-import { DirectiveContextMenu } from "./DirectiveContextMenu";
-
-const STATUS_BADGE: Record<DirectiveStatus, { color: string; label: string }> = {
- draft: { color: "text-[#7788aa] border-[#2a3a5a]", label: "DRAFT" },
- active: { color: "text-green-400 border-green-800", label: "ACTIVE" },
- idle: { color: "text-yellow-400 border-yellow-800", label: "IDLE" },
- paused: { color: "text-orange-400 border-orange-800", label: "PAUSED" },
- inactive: { color: "text-[#9bc3ff] border-[#3f6fb3]", label: "INACTIVE" },
- archived: { color: "text-[#556677] border-[#2a3a5a]", label: "ARCHIVED" },
-};
-
-interface DirectiveListProps {
- directives: DirectiveSummary[];
- selectedId: string | null;
- onSelect: (id: string) => void;
- onCreate: () => void;
- onStart?: (directive: DirectiveSummary) => void;
- onPause?: (directive: DirectiveSummary) => void;
- onArchive?: (directive: DirectiveSummary) => void;
- onDelete?: (directive: DirectiveSummary) => void;
- onGoToPR?: (directive: DirectiveSummary) => void;
-}
-
-export function DirectiveList({ directives, selectedId, onSelect, onCreate, onStart, onPause, onArchive, onDelete, onGoToPR }: DirectiveListProps) {
- const { pendingQuestions } = useSupervisorQuestions();
- const [contextMenuPosition, setContextMenuPosition] = useState<{ x: number; y: number } | null>(null);
- const [contextMenuDirective, setContextMenuDirective] = useState<DirectiveSummary | null>(null);
-
- const handleContextMenu = (e: React.MouseEvent, directive: DirectiveSummary) => {
- e.preventDefault();
- setContextMenuPosition({ x: e.clientX, y: e.clientY });
- setContextMenuDirective(directive);
- };
-
- const closeContextMenu = () => {
- setContextMenuPosition(null);
- setContextMenuDirective(null);
- };
-
- const questionsPerDirective = useMemo(() => {
- const counts = new Map<string, number>();
- for (const q of pendingQuestions) {
- if (q.directiveId) {
- counts.set(q.directiveId, (counts.get(q.directiveId) || 0) + 1);
- }
- }
- return counts;
- }, [pendingQuestions]);
-
- return (
- <div className="flex flex-col h-full">
- <div className="flex items-center justify-between px-3 py-2 border-b border-dashed border-[rgba(117,170,252,0.2)]">
- <span className="text-[11px] font-mono text-[#9bc3ff] uppercase tracking-wide">
- Directives
- </span>
- <button
- type="button"
- onClick={onCreate}
- className="text-[11px] font-mono text-[#75aafc] hover:text-white bg-transparent border border-[rgba(117,170,252,0.3)] rounded px-2 py-0.5 hover:border-[rgba(117,170,252,0.6)] transition-colors"
- >
- + New
- </button>
- </div>
- <div className="flex-1 overflow-y-auto">
- {directives.length === 0 ? (
- <div className="px-3 py-6 text-center text-[#556677] font-mono text-[11px]">
- No directives yet
- </div>
- ) : (
- directives.map((d) => {
- const badge = STATUS_BADGE[d.status] || STATUS_BADGE.draft;
- const progress = d.totalSteps > 0
- ? Math.round((d.completedSteps / d.totalSteps) * 100)
- : 0;
-
- return (
- <button
- key={d.id}
- type="button"
- onClick={() => onSelect(d.id)}
- onContextMenu={(e) => handleContextMenu(e, d)}
- className={`w-full text-left px-3 py-2.5 border-b border-[rgba(117,170,252,0.1)] hover:bg-[rgba(117,170,252,0.05)] transition-colors ${
- selectedId === d.id ? "bg-[rgba(117,170,252,0.1)]" : ""
- }`}
- >
- <div className="flex items-center justify-between mb-1">
- <span className="text-[12px] font-mono text-white truncate pr-2">
- {d.title}
- </span>
- {questionsPerDirective.has(d.id) && (
- <span className="inline-block w-2.5 h-2.5 rounded-full bg-amber-400 animate-pulse shrink-0" title={`${questionsPerDirective.get(d.id)} pending question(s)`} />
- )}
- <span
- className={`text-[9px] font-mono ${badge.color} border rounded px-1.5 py-0.5 shrink-0`}
- >
- {badge.label}
- </span>
- </div>
- <p className="text-[10px] text-[#7788aa] font-mono truncate mb-1.5">
- {d.goal}
- </p>
- {d.totalSteps > 0 && (
- <div className="flex items-center gap-2">
- <div className="flex-1 h-1 bg-[#1a2540] rounded overflow-hidden">
- <div
- className="h-full bg-emerald-600 rounded transition-all"
- style={{ width: `${progress}%` }}
- />
- </div>
- <span className="text-[9px] font-mono text-[#556677] shrink-0">
- {d.completedSteps}/{d.totalSteps}
- </span>
- </div>
- )}
- </button>
- );
- })
- )}
- </div>
-
- {/* Context Menu */}
- {contextMenuPosition && contextMenuDirective && (
- <DirectiveContextMenu
- x={contextMenuPosition.x}
- y={contextMenuPosition.y}
- directive={contextMenuDirective}
- onClose={closeContextMenu}
- onStart={() => onStart?.(contextMenuDirective)}
- onPause={() => onPause?.(contextMenuDirective)}
- onArchive={() => onArchive?.(contextMenuDirective)}
- onDelete={() => onDelete?.(contextMenuDirective)}
- onGoToPR={() => onGoToPR?.(contextMenuDirective)}
- />
- )}
- </div>
- );
-}