/* global window, React */
// ============================================================
// Bottom — TP Agent ORA strip
// ============================================================
const { useState: useAgentState } = React;
function OraCard({ kind, item }) {
return (
{item.label}
{item.wave && {item.wave}}
{item.action && !item.dimmed && (
)}
);
}
function AgentStrip({ trip, expanded, onToggle, overview }) {
const ora = overview ? window.CROSS_ORA : trip.ora;
// wave attribution: how many waves the signals span
const wavesTouched = !overview && trip
? Array.from(new Set([...ora.observe, ...ora.reason, ...ora.act].map(c => (c.wave || '').split(' ')[0]).filter(Boolean)))
: [];
return (
TP
TP Agent
{overview ? (
<>
Reasoning across
Wave 7 · all trips
>
) : (
<>
Suggestions for
{trip.id}
·
signals from
{wavesTouched.map(w => {w})}
>
)}
·
{ora.act.filter(a => !a.dimmed).length} action{ora.act.filter(a=>!a.dimmed).length===1?'':'s'} ready
⌃
{expanded && (
<>
1
Observe
{ora.observe.map((o, i) =>
)}
2
Reason
{ora.reason.map((o, i) =>
)}
3
Act
{ora.act.map((o, i) =>
)}
>
)}
);
}
function ChatBar() {
const [text, setText] = useAgentState('');
const [reply, setReply] = useAgentState(null);
const send = () => {
if (!text.trim()) return;
// Canned demo reply
setReply(`On Wave 7, TR-4879 and TR-4889 have ≥24h slack. TR-4883 is held on inventory and will not move regardless. Defer-safe: 2.`);
setText('');
};
return (
<>
→
setText(e.target.value)}
onKeyDown={e => { if (e.key === 'Enter') send(); }}
/>
{reply && (
)}
>
);
}
Object.assign(window, { AgentStrip });