AP1.1: Method Registry — product_milestone_driven + Methode wählbar
Deploy Development / deploy (push) Successful in 45s
Test Suite / pytest-backend (push) Successful in 1m23s
Test Suite / lint-backend (push) Successful in 2s
Test Suite / compose-smoke (push) Has been skipped
Test Suite / k6 /api/health Baseline (push) Successful in 18s
Test Suite / playwright-smoke (push) Successful in 12s

Zweite Built-in-Methode mit meilensteinorientierter NextAction-Strategie, API und UI-Auswahl pro Vorhaben; AP0.10d Validation-Vorlagen.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-07-05 17:24:17 +02:00
1 parent 95feba6204
commit fc956d4ceb
27 files changed
+684 -15

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
import { apiFetch } from './client.js'
export function listSteeringMethods() {
return apiFetch('/api/steering/methods')
}
export function updateInitiativeSteeringMethod(initiativeId, methodKey) {
return apiFetch(`/api/steering/initiatives/${initiativeId}/context`, {
method: 'PATCH',
body: JSON.stringify({ method_key: methodKey }),
})
}
@@ -17,7 +17,15 @@ function formatDate(iso) {
}
}
export function SteeringSnapshotPanel({ snapshot, loading, error }) {
export function SteeringSnapshotPanel({
snapshot,
loading,
error,
methods = [],
canManageMethod = false,
onMethodChange,
methodBusy = false,
}) {
if (loading) {
return (
<section className="card steering-snapshot">
@@ -42,6 +50,8 @@ export function SteeringSnapshotPanel({ snapshot, loading, error }) {
const {
lifecycle_state,
lifecycle_label,
method_key,
method_label,
operating_phase,
operating_phase_deprecated,
phase_signals,
@@ -66,6 +76,29 @@ export function SteeringSnapshotPanel({ snapshot, loading, error }) {
<span className="badge status-badge status-active">{displayLabel}</span>
</div>
{(method_label || canManageMethod) && (
<p className="steering-method-row">
<span className="muted">Methode: </span>
{canManageMethod && methods.length > 0 ? (
<select
className="inline-select steering-method-select"
value={method_key || 'generic_operating'}
disabled={methodBusy}
onChange={(e) => onMethodChange?.(e.target.value)}
aria-label="Steuerungsmethode"
>
{methods.map((m) => (
<option key={m.key} value={m.key}>
{m.label}
</option>
))}
</select>
) : (
<strong>{method_label || method_key}</strong>
)}
</p>
)}
{phaseDesc && <p className="steering-phase-desc">{phaseDesc}</p>}
{phase_signals?.length > 0 && (
@@ -62,6 +62,7 @@ import { DecisionsSection } from '../components/DecisionsSection.jsx'
import { ReviewsSection } from '../components/ReviewsSection.jsx'
import { RecurringSection } from '../components/RecurringSection.jsx'
import { SteeringSnapshotPanel } from '../components/SteeringSnapshotPanel.jsx'
import { listSteeringMethods, updateInitiativeSteeringMethod } from '../api/steering.js'
import { EmptyState } from '../components/EmptyState.jsx'
import { ErrorState } from '../components/ErrorState.jsx'
import { LoadingState } from '../components/LoadingState.jsx'
@@ -93,6 +94,8 @@ export function InitiativeDetailPage() {
const [steeringSnapshot, setSteeringSnapshot] = useState(null)
const [steeringSnapshotLoading, setSteeringSnapshotLoading] = useState(false)
const [steeringSnapshotError, setSteeringSnapshotError] = useState(null)
const [steeringMethods, setSteeringMethods] = useState([])
const [methodBusy, setMethodBusy] = useState(false)
const [loading, setLoading] = useState(true)
const [error, setError] = useState(null)
const [showActionForm, setShowActionForm] = useState(false)
@@ -124,6 +127,9 @@ export function InitiativeDetailPage() {
loads.push(listInitiativeDecisions(id).then(setDecisions).catch(() => setDecisions([])))
loads.push(listInitiativeReviews(id).then(setReviews).catch(() => setReviews([])))
loads.push(listInitiativeRecurring(id).then(setRecurringItems).catch(() => setRecurringItems([])))
loads.push(
listSteeringMethods().then(setSteeringMethods).catch(() => setSteeringMethods([]))
)
loads.push(
(async () => {
setSteeringSnapshotLoading(true)
@@ -159,6 +165,18 @@ export function InitiativeDetailPage() {
(steeringSnapshot?.actions || []).map((a) => [a.id, a])
)
async function handleMethodChange(methodKey) {
setMethodBusy(true)
try {
await updateInitiativeSteeringMethod(id, methodKey)
setSteeringSnapshot(await getInitiativeSteeringSnapshot(id))
} catch (err) {
setSteeringSnapshotError(err.message)
} finally {
setMethodBusy(false)
}
}
async function handleCreateAction(payload) {
setFormBusy(true)
try {
@@ -498,6 +516,10 @@ export function InitiativeDetailPage() {
snapshot={steeringSnapshot}
loading={steeringSnapshotLoading}
error={steeringSnapshotError}
methods={steeringMethods}
canManageMethod={capabilities.has('kairo.initiative.manage')}
onMethodChange={handleMethodChange}
methodBusy={methodBusy}
/>
)}
+9
View File
@@ -629,6 +629,15 @@
margin: 0.75rem 0 0;
}
.steering-method-row {
margin: 0.5rem 0 0;
font-size: 0.9rem;
}
.steering-method-select {
max-width: 100%;
}
.steering-phase-desc {
margin: 0.5rem 0 0;
color: var(--jk-text);