AP2.2b/c: A1-Stufenwechsel, Team-Fix, Agent-Anlage, Steuerungs-Hinweise.

AP2.0e rotiert Recurring bei maturity_stage reached. Maturity-Strategie priorisiert Routinen. Team zeigt Namen und Agent-Formular. Archetyp-Hints in Kontrolle und Stufe-A-Gruppierung bei Anlage.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
LarsandCursor committed 2026-07-12 16:19:55 +02:00
1 parent 2b0d5dd3d9
commit 0b57e2ec75
18 files changed
+507 -107

No files matched your search

+7
View File
@@ -16,6 +16,13 @@ export function getActor(id) {
return apiFetch(`/api/actors/${id}`)
}
export function createActor(body) {
return apiFetch('/api/actors', {
method: 'POST',
body: JSON.stringify(body),
})
}
/** Fallback wenn Actor Directory nicht erreichbar (AP0.6-Kompatibilität). */
export function actorsFromContext(context) {
if (!context?.actor?.id) return []
@@ -0,0 +1,35 @@
import { Link } from 'react-router-dom'
import { scopedPath } from '../utils/routes.js'
const HINTS = {
'initiative.maturity_journey': {
text: 'Reifegrad: Heutige Übung (Rhythmus) und aktive Stufe steuern den nächsten Schritt.',
link: { to: '/control/journey', label: 'Rhythmen & Journey' },
},
'initiative.linear_project': {
text: 'Linear: Nächster Schritt am kritischen Pfad — Abhängigkeiten im Gate-Graph.',
link: { to: '/plan/gates', label: 'Gate-Graph öffnen' },
},
'initiative.product': {
text: 'Product: Eingang triagieren, committete Actions — optional Sprint-Zeitbox.',
link: { to: '/plan/inbox', label: 'Zum Eingang' },
},
'initiative.program': {
text: 'Programm: Gate-Horizont und Abschluss im Blick behalten.',
link: { to: '/plan/gates', label: 'Phasen / Gates' },
},
}
export function ArchetypeSteeringHints({ archetypeKey }) {
const hint = HINTS[archetypeKey]
if (!hint) return null
return (
<p className="steering-archetype-hints muted">
{hint.text}{' '}
<Link to={scopedPath(hint.link.to)} className="link-inline">
{hint.link.label}
</Link>
</p>
)
}
+21 -6
View File
@@ -1,7 +1,7 @@
import { useEffect, useState } from 'react'
import { INITIATIVE_STATUSES, PRIORITIES } from '../constants/status.js'
import { INITIATIVE_STATUS_LABELS, PRIORITY_LABELS } from '../constants/status.js'
import { INITIATIVE_ARCHETYPE_LABELS } from '../constants/initiativeArchetypes.js'
import { INITIATIVE_ARCHETYPE_LABELS, STUFE_A_ARCHETYPE_KEYS } from '../constants/initiativeArchetypes.js'
import { listEntityArchetypes, getArchetypeStarterPreview } from '../api/entityArchetypes.js'
import {
getInitiativeFields,
@@ -129,6 +129,8 @@ export function InitiativeForm({
const formReady = archetypes && !fieldsLoading
const selectedArchetype = (archetypes || []).find((item) => item.key === archetypeKey)
const stufeA = (archetypes || []).filter((item) => STUFE_A_ARCHETYPE_KEYS.has(item.key))
const otherArchetypes = (archetypes || []).filter((item) => !STUFE_A_ARCHETYPE_KEYS.has(item.key))
return (
<form className="form workspace-form initiative-form" onSubmit={handleSubmit}>
@@ -146,11 +148,24 @@ export function InitiativeForm({
onChange={(e) => setArchetypeKey(e.target.value)}
disabled={!archetypes}
>
{(archetypes || []).map((item) => (
<option key={item.key} value={item.key}>
{item.label}
</option>
))}
{stufeA.length > 0 && (
<optgroup label="MVP Stufe A (empfohlen)">
{stufeA.map((item) => (
<option key={item.key} value={item.key}>
{item.label}
</option>
))}
</optgroup>
)}
{otherArchetypes.length > 0 && (
<optgroup label="Weitere Archetypen">
{otherArchetypes.map((item) => (
<option key={item.key} value={item.key}>
{item.label}
</option>
))}
</optgroup>
)}
</select>
{selectedArchetype?.description && (
<span className="muted form-hint">{selectedArchetype.description}</span>
@@ -5,6 +5,7 @@ import {
} from '../constants/operating.js'
import { MILESTONE_STATUS_LABELS } from '../constants/status.js'
import { methodDescriptionForKey } from '../utils/archetypes.js'
import { ArchetypeSteeringHints } from './ArchetypeSteeringHints.jsx'
import { Link } from 'react-router-dom'
import { scopedPath } from '../utils/routes.js'
@@ -106,6 +107,7 @@ export function SteeringSnapshotPanel({
{steering_guidance && (
<p className="steering-guidance">{steering_guidance}</p>
)}
<ArchetypeSteeringHints archetypeKey={archetype_key} />
</div>
<span className="badge status-badge status-active steering-lifecycle-badge">
{displayLabel}
@@ -1,4 +1,10 @@
/** Fallback-Labels bis API geladen (AP1.10a / AP2.0). */
/** MVP Stufe A — geführte Referenz-Archetypen (AP2.2a). */
export const STUFE_A_ARCHETYPE_KEYS = new Set([
'initiative.maturity_journey',
'initiative.linear_project',
'initiative.product',
'initiative.program',
])
export const INITIATIVE_ARCHETYPE_LABELS = {
'initiative.generic': 'Allgemeines Vorhaben',
'initiative.maturity_journey': 'Reifegrad-Entwicklung',
+113 -42
View File
@@ -1,64 +1,135 @@
import { useEffect, useState } from 'react'
import { Link } from 'react-router-dom'
import { getActorWorkload } from '../../api/workspace.js'
import { createActor, listActors } from '../../api/actors.js'
import { useSession } from '../../context/SessionContext.jsx'
import { ModeShell } from '../../components/ModeShell.jsx'
import { LoadingState } from '../../components/LoadingState.jsx'
import { ErrorState } from '../../components/ErrorState.jsx'
import { scopedPath } from '../../utils/routes.js'
const ACTOR_TYPE_LABELS = {
human: 'Person',
agent: 'Agent / Vibe-Coder',
working_group: 'Gruppe',
external_system: 'Externes System',
}
export function TeamPage() {
const { hasCapability } = useSession()
const [rows, setRows] = useState(null)
const [actors, setActors] = useState([])
const [error, setError] = useState(null)
const [agentName, setAgentName] = useState('')
const [busy, setBusy] = useState(false)
async function load() {
setError(null)
try {
const [workload, directory] = await Promise.all([
getActorWorkload(),
listActors({ include_inactive: false }),
])
setRows(workload)
setActors(directory)
} catch (err) {
setError(err.message)
}
}
useEffect(() => {
let cancelled = false
getActorWorkload()
.then((data) => {
if (!cancelled) setRows(data)
})
.catch((err) => {
if (!cancelled) setError(err.message)
})
return () => {
cancelled = true
}
load()
}, [])
async function handleCreateAgent(e) {
e.preventDefault()
const name = agentName.trim()
if (!name) return
setBusy(true)
try {
await createActor({ name, actor_type: 'agent' })
setAgentName('')
await load()
} catch (err) {
setError(err.message)
} finally {
setBusy(false)
}
}
const canManage = hasCapability('kairo.actor.manage')
return (
<div className="app-page">
<ModeShell modeKey="team" />
{rows === null && !error && <LoadingState message="Lade Team-Auslastung …" />}
{error && <ErrorState message={error} />}
{rows === null && !error && <LoadingState message="Lade Team …" />}
{error && <ErrorState message={error} onRetry={load} />}
{rows && (
<section className="card">
<h2 className="card-title">Auslastung nach Actor</h2>
{rows.length === 0 ? (
<p className="muted">Keine Zuweisungen im Portfolio.</p>
) : (
<ul className="team-workload-list">
{rows.map((row) => (
<li key={row.actor_id} className="team-workload-list__item">
<div>
<strong>{row.actor_name || row.actor_id}</strong>
<span className="muted">
{' '}
· {row.open_actions ?? 0} offen
{(row.blocked_actions ?? 0) > 0
? ` · ${row.blocked_actions} blockiert`
: ''}
</span>
</div>
<Link to={scopedPath('/work/mine')} className="link-inline">
Queue ansehen
</Link>
</li>
))}
</ul>
)}
<p className="page-footer-link muted">
AP1.9b erweitert Team um Filter nach Vorhaben und direkte Zuweisungslinks.
</p>
</section>
<>
<section className="card">
<h2 className="card-title">Actor-Verzeichnis</h2>
{actors.length === 0 ? (
<p className="muted">Keine Actors im Tenant.</p>
) : (
<ul className="team-workload-list">
{actors.map((actor) => (
<li key={actor.id} className="team-workload-list__item">
<div>
<strong>{actor.name}</strong>
<span className="muted">
{' '}
· {ACTOR_TYPE_LABELS[actor.actor_type] || actor.actor_type}
</span>
</div>
</li>
))}
</ul>
)}
{canManage && (
<form className="form inline-form team-agent-form" onSubmit={handleCreateAgent}>
<label>
Agent anlegen (Vibe-Coder)
<input
value={agentName}
onChange={(e) => setAgentName(e.target.value)}
placeholder="z. B. Cursor Agent"
maxLength={255}
/>
</label>
<button type="submit" className="btn btn-primary btn-sm" disabled={busy}>
{busy ? 'Anlegen …' : 'Agent anlegen'}
</button>
</form>
)}
</section>
<section className="card">
<h2 className="card-title">Auslastung nach Actor</h2>
{rows.length === 0 ? (
<p className="muted">Keine Zuweisungen im Portfolio.</p>
) : (
<ul className="team-workload-list">
{rows.map((row) => (
<li key={row.actor_id} className="team-workload-list__item">
<div>
<strong>{row.display_name || row.actor_name || row.actor_id}</strong>
<span className="muted">
{' '}
· {row.open_actions ?? 0} offen
{(row.blocked_actions ?? 0) > 0
? ` · ${row.blocked_actions} blockiert`
: ''}
</span>
</div>
<Link to={scopedPath('/work/mine')} className="link-inline">
Queue ansehen
</Link>
</li>
))}
</ul>
)}
</section>
</>
)}
</div>
)