@xenosystem/agent-interface-ui 0.1.19 → 0.1.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/adapters/agentHostPlatformBridge.d.ts.map +1 -1
  2. package/dist/adapters/agentHostPlatformBridge.js +21 -0
  3. package/dist/adapters/agentHostPlatformBridge.js.map +1 -1
  4. package/dist/components/agent/AgentInterface.d.ts.map +1 -1
  5. package/dist/components/agent/AgentInterface.js +33 -19
  6. package/dist/components/agent/AgentInterface.js.map +1 -1
  7. package/dist/components/agent/AgentView.d.ts.map +1 -1
  8. package/dist/components/agent/AgentView.js +55 -2
  9. package/dist/components/agent/AgentView.js.map +1 -1
  10. package/dist/components/agent/AgentWorkbenchPanel.d.ts +3 -1
  11. package/dist/components/agent/AgentWorkbenchPanel.d.ts.map +1 -1
  12. package/dist/components/agent/AgentWorkbenchPanel.js +5 -2
  13. package/dist/components/agent/AgentWorkbenchPanel.js.map +1 -1
  14. package/dist/components/agent/DevelopmentCoordinationPanel.d.ts +5 -0
  15. package/dist/components/agent/DevelopmentCoordinationPanel.d.ts.map +1 -0
  16. package/dist/components/agent/DevelopmentCoordinationPanel.js +73 -0
  17. package/dist/components/agent/DevelopmentCoordinationPanel.js.map +1 -0
  18. package/dist/components/agent/developmentCoordinationProjection.d.ts +53 -0
  19. package/dist/components/agent/developmentCoordinationProjection.d.ts.map +1 -0
  20. package/dist/components/agent/developmentCoordinationProjection.js +102 -0
  21. package/dist/components/agent/developmentCoordinationProjection.js.map +1 -0
  22. package/dist/components/agent/subagentConversationProjection.d.ts +4 -0
  23. package/dist/components/agent/subagentConversationProjection.d.ts.map +1 -0
  24. package/dist/components/agent/subagentConversationProjection.js +76 -0
  25. package/dist/components/agent/subagentConversationProjection.js.map +1 -0
  26. package/dist/components/agent/webJobProgressView.d.ts +90 -0
  27. package/dist/components/agent/webJobProgressView.d.ts.map +1 -0
  28. package/dist/components/agent/webJobProgressView.js +104 -0
  29. package/dist/components/agent/webJobProgressView.js.map +1 -0
  30. package/dist/platformApiTypes.d.ts +24 -0
  31. package/dist/platformApiTypes.d.ts.map +1 -1
  32. package/dist/platformBridge.d.ts +9 -0
  33. package/dist/platformBridge.d.ts.map +1 -1
  34. package/dist/platformBridge.js +11 -0
  35. package/dist/platformBridge.js.map +1 -1
  36. package/dist/stores/agentChatStore.d.ts +13 -2
  37. package/dist/stores/agentChatStore.d.ts.map +1 -1
  38. package/dist/stores/agentChatStore.js +77 -6
  39. package/dist/stores/agentChatStore.js.map +1 -1
  40. package/package.json +5 -5
@@ -0,0 +1,73 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import React, { useCallback, useEffect, useMemo, useState } from 'react';
3
+ import { ArrowRightLeft, RefreshCw, Repeat2, Target } from 'lucide-react';
4
+ import { getAgentPlatformBridge } from '../../platformBridge.js';
5
+ import { projectDevelopmentCoordinationState } from './developmentCoordinationProjection.js';
6
+ function tryBridge() {
7
+ try {
8
+ return getAgentPlatformBridge();
9
+ }
10
+ catch {
11
+ return null;
12
+ }
13
+ }
14
+ export function DevelopmentCoordinationPanel({ sessionId }) {
15
+ const ownerId = useMemo(() => tryBridge()?.developmentCoordination?.ownerId ?? 'interface:unavailable', []);
16
+ const [state, setState] = useState(null);
17
+ const [unreachable, setUnreachable] = useState(false);
18
+ const [busy, setBusy] = useState(false);
19
+ const [error, setError] = useState(null);
20
+ const [objective, setObjective] = useState('');
21
+ const [steering, setSteering] = useState('');
22
+ const [targetOwner, setTargetOwner] = useState('');
23
+ const refresh = useCallback(async () => {
24
+ const api = tryBridge()?.developmentCoordination;
25
+ if (!api || !sessionId) {
26
+ setUnreachable(true);
27
+ return;
28
+ }
29
+ try {
30
+ const response = await api.getState({ sessionId });
31
+ setState(projectDevelopmentCoordinationState(response.state));
32
+ setUnreachable(false);
33
+ setError(null);
34
+ }
35
+ catch (cause) {
36
+ setError(cause instanceof Error ? cause.message : 'Coordination state could not be read.');
37
+ }
38
+ }, [sessionId]);
39
+ const act = useCallback(async (action, payload) => {
40
+ const api = tryBridge()?.developmentCoordination;
41
+ if (!api)
42
+ return;
43
+ setBusy(true);
44
+ try {
45
+ const response = await api.action({ sessionId, action, payload });
46
+ setState(projectDevelopmentCoordinationState(response.state));
47
+ setError(null);
48
+ }
49
+ catch (cause) {
50
+ setError(cause instanceof Error ? cause.message : 'Coordination action failed.');
51
+ }
52
+ finally {
53
+ setBusy(false);
54
+ }
55
+ }, [sessionId]);
56
+ useEffect(() => { void refresh(); }, [refresh]);
57
+ useEffect(() => {
58
+ const subscribe = tryBridge()?.developmentCoordination?.subscribeChanged;
59
+ return subscribe?.(() => { void refresh(); });
60
+ }, [refresh]);
61
+ useEffect(() => {
62
+ // Host events cover mutations made through this process. The CLI owns the
63
+ // same durable store from a separate process, so those writes cannot reach
64
+ // this in-memory subscription. Refresh while the panel is mounted to keep
65
+ // the two frontends coherent without requiring a desktop restart.
66
+ const timer = window.setInterval(() => { void refresh(); }, 2_000);
67
+ return () => window.clearInterval(timer);
68
+ }, [refresh]);
69
+ if (unreachable)
70
+ return _jsx("p", { className: "px-3 py-3 text-[11px] text-white/32", children: "This surface cannot reach durable Goal / Loop / Handoff state." });
71
+ return (_jsxs("div", { className: "h-full overflow-y-auto px-3 py-3 space-y-3", "data-testid": "development-coordination-panel", children: [_jsxs("header", { className: "flex items-center justify-between gap-3", children: [_jsxs("div", { children: [_jsx("h2", { className: "text-[11px] uppercase tracking-[0.12em] text-white/65", children: "Development lifecycle" }), _jsx("p", { className: "text-[10px] text-white/28", children: sessionId || 'No active session' })] }), _jsx("button", { type: "button", onClick: () => void refresh(), "aria-label": "Refresh development lifecycle", className: "text-white/36 hover:text-white/72", children: _jsx(RefreshCw, { size: 14, "aria-hidden": true }) })] }), error && _jsx("p", { className: "rounded border border-red-400/20 bg-red-400/5 px-2.5 py-2 text-[10px] text-red-200/70", children: error }), _jsxs("section", { className: "rounded border border-white/[0.06] bg-black/20 px-3 py-2.5", "data-testid": "coordination-goal", children: [_jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsxs("h3", { className: "flex items-center gap-1.5 text-[10px] uppercase tracking-[0.12em] text-white/46", children: [_jsx(Target, { size: 13 }), " Goal"] }), _jsx("span", { className: "text-[10px] text-white/28", children: state?.goal?.status ?? 'none' })] }), state?.goal ? _jsxs(_Fragment, { children: [_jsx("p", { className: "mt-2 text-[12px] text-white/72", children: state.goal.objective }), _jsx("p", { className: "mt-1 text-[10px] text-white/36", children: state.goal.progress }), _jsxs("p", { className: "mt-1 text-[10px] text-white/24", children: [state.goal.completedTasks, "/", state.goal.totalTasks, " tasks \u00B7 ", state.goal.criteria.length, " criteria"] }), state.goal.currentMilestone && _jsxs("p", { className: "mt-1.5 text-[10px] text-white/42", children: ["Milestone: ", _jsx("span", { className: "text-white/62", children: state.goal.currentMilestone.title }), " \u00B7 ", state.goal.currentMilestone.status] }), state.goal.currentTask && _jsxs("p", { className: "mt-1 text-[10px] text-white/42", children: ["Current: ", _jsx("span", { className: "text-white/62", children: state.goal.currentTask.title }), state.goal.currentTask.assignedAgentId ? ` · ${state.goal.currentTask.assignedAgentId}` : ''] }), state.goal.outstanding.length > 0 && _jsxs("div", { className: "mt-2", children: [_jsx("p", { className: "text-[9px] uppercase tracking-[0.1em] text-white/24", children: "Outstanding" }), _jsx("ul", { className: "mt-1 space-y-0.5", children: state.goal.outstanding.slice(0, 5).map((item) => _jsxs("li", { className: "text-[10px] text-white/38", children: ["\u2022 ", item] }, item)) })] }), state.goal.decisions.length > 0 && _jsxs("p", { className: "mt-1.5 text-[10px] text-white/30", children: ["Latest decision: ", state.goal.decisions.at(-1)] }), _jsxs("div", { className: "mt-2 flex gap-1.5", children: [_jsx("input", { value: steering, onChange: (event) => setSteering(event.target.value), placeholder: "Steer the active goal", className: "min-w-0 flex-1 rounded border border-white/[0.08] bg-black/30 px-2 py-1 text-[10px] text-white/62" }), _jsx("button", { disabled: busy || !steering.trim(), onClick: () => { void act('goal.steer', { goalId: state.goal.id, expectedVersion: state.goal.version, instruction: steering.trim() }); setSteering(''); }, className: "rounded bg-white/[0.07] px-2 text-[10px] text-white/55 disabled:opacity-30", children: "Send" })] })] }) : _jsxs("div", { className: "mt-2 flex gap-1.5", children: [_jsx("input", { value: objective, onChange: (event) => setObjective(event.target.value), placeholder: "Define a durable goal", className: "min-w-0 flex-1 rounded border border-white/[0.08] bg-black/30 px-2 py-1 text-[10px] text-white/62" }), _jsx("button", { disabled: busy || !objective.trim(), onClick: () => { void act('goal.create', { objective: objective.trim() }); setObjective(''); }, className: "rounded bg-white/[0.07] px-2 text-[10px] text-white/55 disabled:opacity-30", children: "Create" })] })] }), _jsxs("section", { className: "rounded border border-white/[0.06] bg-black/20 px-3 py-2.5", "data-testid": "coordination-loop", children: [_jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsxs("h3", { className: "flex items-center gap-1.5 text-[10px] uppercase tracking-[0.12em] text-white/46", children: [_jsx(Repeat2, { size: 13 }), " Loop"] }), _jsx("span", { className: "text-[10px] text-white/28", children: state?.loop?.status ?? 'none' })] }), state?.loop ? _jsxs(_Fragment, { children: [_jsxs("p", { className: "mt-2 text-[11px] text-white/62", children: [state.loop.kind, " \u00B7 ", state.loop.iterations, " iterations"] }), state.loop.activity && _jsx("p", { className: "mt-1 text-[10px] text-white/32", children: state.loop.activity }), _jsxs("div", { className: "mt-2 flex gap-1.5", children: [state.loop.status === 'paused' ? _jsx("button", { disabled: busy, onClick: () => void act('loop.set_status', { loopId: state.loop.id, expectedVersion: state.loop.version, status: 'running' }), className: "rounded bg-white/[0.07] px-2 py-1 text-[10px] text-white/55", children: "Resume" }) : _jsx("button", { disabled: busy, onClick: () => void act('loop.set_status', { loopId: state.loop.id, expectedVersion: state.loop.version, status: 'paused' }), className: "rounded bg-white/[0.07] px-2 py-1 text-[10px] text-white/55", children: "Pause" }), _jsx("button", { disabled: busy, onClick: () => void act('loop.set_status', { loopId: state.loop.id, expectedVersion: state.loop.version, status: 'stopped', reason: 'Stopped from Agent Interface' }), className: "rounded border border-white/[0.07] px-2 py-1 text-[10px] text-white/42", children: "Stop" })] })] }) : _jsx("button", { disabled: busy || !state?.goal, onClick: () => void act('loop.start', { kind: 'goal-continuation', ...(state?.goal ? { goalId: state.goal.id } : {}) }), className: "mt-2 rounded bg-white/[0.07] px-2 py-1 text-[10px] text-white/55 disabled:opacity-30", children: "Start goal continuation" })] }), _jsxs("section", { className: "rounded border border-white/[0.06] bg-black/20 px-3 py-2.5", "data-testid": "coordination-handoff", children: [_jsxs("div", { className: "flex items-center justify-between gap-2", children: [_jsxs("h3", { className: "flex items-center gap-1.5 text-[10px] uppercase tracking-[0.12em] text-white/46", children: [_jsx(ArrowRightLeft, { size: 13 }), " Handoff"] }), _jsxs("span", { className: "text-[10px] text-white/28", children: ["epoch ", state?.owner?.epoch ?? '—'] })] }), _jsxs("p", { className: "mt-2 text-[10px] text-white/36", children: ["Owner: ", state?.owner?.ownerId ?? 'unclaimed'] }), !state?.owner && _jsx("button", { disabled: busy, onClick: () => void act('ownership.acquire', {}), className: "mt-2 rounded bg-white/[0.07] px-2 py-1 text-[10px] text-white/55", children: "Acquire this session" }), state?.owner?.ownerId === ownerId && _jsxs("div", { className: "mt-2 flex gap-1.5", children: [_jsx("input", { value: targetOwner, onChange: (event) => setTargetOwner(event.target.value), placeholder: "Target owner id", className: "min-w-0 flex-1 rounded border border-white/[0.08] bg-black/30 px-2 py-1 text-[10px] text-white/62" }), _jsx("button", { disabled: busy || !targetOwner.trim(), onClick: () => void act('handoff.create', { targetOwnerId: targetOwner.trim(), ...(state.goal ? { goalId: state.goal.id } : {}), ...(state.loop ? { loopId: state.loop.id } : {}) }), className: "rounded bg-white/[0.07] px-2 text-[10px] text-white/55 disabled:opacity-30", children: "Prepare" })] }), state?.handoffs.map((handoff) => _jsxs("div", { className: "mt-2 border-t border-white/[0.05] pt-2 text-[10px] text-white/34", children: [_jsx("span", { className: "text-white/55", children: handoff.status }), " \u00B7 ", handoff.sourceOwnerId, handoff.targetOwnerId ? ` → ${handoff.targetOwnerId}` : '', handoff.status === 'available' && (!handoff.targetOwnerId || handoff.targetOwnerId === ownerId) && _jsx("button", { disabled: busy, onClick: () => void act('handoff.claim', { handoffId: handoff.id }), className: "ml-2 rounded bg-white/[0.07] px-1.5 py-0.5 text-white/55", children: "Claim here" })] }, handoff.id))] })] }));
72
+ }
73
+ //# sourceMappingURL=DevelopmentCoordinationPanel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DevelopmentCoordinationPanel.js","sourceRoot":"","sources":["../../../src/components/agent/DevelopmentCoordinationPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACxE,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAA;AAChE,OAAO,EAAE,mCAAmC,EAA0C,MAAM,wCAAwC,CAAA;AAQpI,SAAS,SAAS;IAChB,IAAI,CAAC;QAAC,OAAO,sBAAsB,EAAE,CAAA;IAAC,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,IAAI,CAAA;IAAC,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,EAAE,SAAS,EAAyB;IAC/E,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE,EAAE,uBAAuB,EAAE,OAAO,IAAI,uBAAuB,EAAE,EAAE,CAAC,CAAA;IAC3G,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAA2C,IAAI,CAAC,CAAA;IAClF,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IACrD,MAAM,CAAC,IAAI,E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AE,EAAE,aAAa,EAAE,WAAW,CAAC,IAAI,EAAE,EAAE,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,EAAC,4EAA4E,wBAAiB,IAAM,EAC5nB,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,eAAsB,SAAS,EAAC,kEAAkE,aAAC,eAAM,SAAS,EAAC,eAAe,YAAE,OAAO,CAAC,MAAM,GAAQ,cAAI,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,OAAO,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,OAAO,CAAC,MAAM,KAAK,WAAW,IAAI,CAAC,CAAC,OAAO,CAAC,aAAa,IAAI,OAAO,CAAC,aAAa,KAAK,OAAO,CAAC,IAAI,iBAAQ,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,KAAK,GAAG,CAAC,eAAe,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,EAAE,SAAS,EAAC,0DAA0D,2BAAoB,KAA/f,OAAO,CAAC,EAAE,CAA4f,CAAC,IAC3iB,IACN,CACP,CAAA;AACH,CAAC"}
@@ -0,0 +1,53 @@
1
+ export interface DevelopmentCoordinationProjection {
2
+ sessionId: string;
3
+ owner?: {
4
+ ownerId: string;
5
+ leaseId: string;
6
+ epoch: number;
7
+ expiresAt: string;
8
+ };
9
+ goal?: {
10
+ id: string;
11
+ version: number;
12
+ objective: string;
13
+ status: string;
14
+ progress: string;
15
+ completedTasks: number;
16
+ totalTasks: number;
17
+ currentMilestone?: {
18
+ title: string;
19
+ status: string;
20
+ };
21
+ currentTask?: {
22
+ title: string;
23
+ status: string;
24
+ assignedAgentId?: string;
25
+ };
26
+ outstanding: string[];
27
+ decisions: string[];
28
+ criteria: Array<{
29
+ description: string;
30
+ required: boolean;
31
+ }>;
32
+ };
33
+ loop?: {
34
+ id: string;
35
+ version: number;
36
+ kind: string;
37
+ status: string;
38
+ activity?: string;
39
+ iterations: number;
40
+ };
41
+ handoffs: Array<{
42
+ id: string;
43
+ version: number;
44
+ status: string;
45
+ sourceOwnerId: string;
46
+ targetOwnerId?: string;
47
+ claimedBy?: string;
48
+ updatedAt: string;
49
+ }>;
50
+ }
51
+ /** Runtime validation at the UI boundary; persisted state is not trusted JSX input. */
52
+ export declare function projectDevelopmentCoordinationState(value: unknown): DevelopmentCoordinationProjection | null;
53
+ //# sourceMappingURL=developmentCoordinationProjection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"developmentCoordinationProjection.d.ts","sourceRoot":"","sources":["../../../src/components/agent/developmentCoordinationProjection.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iCAAiC;IAChD,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAA;IAC9E,IAAI,CAAC,EAAE;QACL,EAAE,EAAE,MAAM,CAAA;QACV,OAAO,EAAE,MAAM,CAAA;QACf,SAAS,EAAE,MAAM,CAAA;QACjB,MAAM,EAAE,MAAM,CAAA;QACd,QAAQ,EAAE,MAAM,CAAA;QAChB,cAAc,EAAE,MAAM,CAAA;QACtB,UAAU,EAAE,MAAM,CAAA;QAClB,gBAAgB,CAAC,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAA;QACpD,WAAW,CAAC,EAAE;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAC;YAAC,eAAe,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;QACzE,WAAW,EAAE,MAAM,EAAE,CAAA;QACrB,SAAS,EAAE,MAAM,EAAE,CAAA;QACnB,QAAQ,EAAE,KAAK,CAAC;YAAE,WAAW,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,OAAO,CAAA;SAAE,CAAC,CAAA;KAC5D,CAAA;IACD,IAAI,CAAC,EAAE;QACL,EAAE,EAAE,MAAM,CAAA;QACV,OAAO,EAAE,MAAM,CAAA;QACf,IAAI,EAAE,MAAM,CAAA;QACZ,MAAM,EAAE,MAAM,CAAA;QACd,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,UAAU,EAAE,MAAM,CAAA;KACnB,CAAA;IACD,QAAQ,EAAE,KAAK,CAAC;QACd,EAAE,EAAE,MAAM,CAAA;QACV,OAAO,EAAE,MAAM,CAAA;QACf,MAAM,EAAE,MAAM,CAAA;QACd,aAAa,EAAE,MAAM,CAAA;QACrB,aAAa,CAAC,EAAE,MAAM,CAAA;QACtB,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,SAAS,EAAE,MAAM,CAAA;KAClB,CAAC,CAAA;CACH;AAkBD,uFAAuF;AACvF,wBAAgB,mCAAmC,CAAC,KAAK,EAAE,OAAO,GAAG,iCAAiC,GAAG,IAAI,CAyF5G"}
@@ -0,0 +1,102 @@
1
+ function record(value) {
2
+ return value && typeof value === 'object' && !Array.isArray(value) ? value : undefined;
3
+ }
4
+ function text(value) {
5
+ return typeof value === 'string' && value.trim() ? value : undefined;
6
+ }
7
+ function integer(value) {
8
+ return typeof value === 'number' && Number.isInteger(value) ? value : undefined;
9
+ }
10
+ function records(value) {
11
+ return Array.isArray(value) ? value.map(record).filter((entry) => !!entry) : [];
12
+ }
13
+ /** Runtime validation at the UI boundary; persisted state is not trusted JSX input. */
14
+ export function projectDevelopmentCoordinationState(value) {
15
+ const state = record(value);
16
+ const sessionId = text(state?.sessionId);
17
+ if (!state || !sessionId)
18
+ return null;
19
+ const ownerRecord = record(state.owner);
20
+ const ownerId = text(ownerRecord?.ownerId);
21
+ const leaseId = text(ownerRecord?.leaseId);
22
+ const epoch = integer(ownerRecord?.epoch);
23
+ const expiresAt = text(ownerRecord?.expiresAt);
24
+ const goals = records(state.goals);
25
+ const goalRecord = [...goals].reverse().find((candidate) => !['completed', 'failed', 'cancelled'].includes(text(candidate.status) ?? '')) ?? goals.at(-1);
26
+ const progressRecord = record(goalRecord?.progress);
27
+ const criteria = records(goalRecord?.successCriteria)
28
+ .flatMap((criterion) => {
29
+ const description = text(criterion.description);
30
+ return description ? [{ description, required: criterion.required !== false }] : [];
31
+ });
32
+ const milestones = records(goalRecord?.milestones);
33
+ const tasks = records(goalRecord?.tasks);
34
+ const currentMilestoneId = text(progressRecord?.currentMilestoneId);
35
+ const currentTaskId = text(progressRecord?.currentTaskId);
36
+ const milestoneRecord = milestones.find((entry) => text(entry.id) === currentMilestoneId)
37
+ ?? milestones.find((entry) => text(entry.status) === 'active');
38
+ const taskRecord = tasks.find((entry) => text(entry.id) === currentTaskId)
39
+ ?? tasks.find((entry) => text(entry.status) === 'running');
40
+ const stringList = (input) => Array.isArray(input)
41
+ ? input.map(text).filter((entry) => !!entry)
42
+ : [];
43
+ const loops = records(state.loops);
44
+ const loopRecord = [...loops].reverse().find((candidate) => !['stopped', 'completed', 'failed'].includes(text(candidate.status) ?? '')) ?? loops.at(-1);
45
+ return {
46
+ sessionId,
47
+ ...(ownerId && leaseId && epoch !== undefined && expiresAt ? { owner: { ownerId, leaseId, epoch, expiresAt } } : {}),
48
+ ...(goalRecord && text(goalRecord.id) && integer(goalRecord.version) !== undefined && text(goalRecord.objective) && text(goalRecord.status)
49
+ ? {
50
+ goal: {
51
+ id: text(goalRecord.id),
52
+ version: integer(goalRecord.version),
53
+ objective: text(goalRecord.objective),
54
+ status: text(goalRecord.status),
55
+ progress: text(progressRecord?.summary) ?? 'No progress update yet.',
56
+ completedTasks: integer(progressRecord?.completedTaskCount) ?? 0,
57
+ totalTasks: integer(progressRecord?.totalTaskCount) ?? 0,
58
+ ...(milestoneRecord && text(milestoneRecord.title) && text(milestoneRecord.status)
59
+ ? { currentMilestone: { title: text(milestoneRecord.title), status: text(milestoneRecord.status) } }
60
+ : {}),
61
+ ...(taskRecord && text(taskRecord.title) && text(taskRecord.status)
62
+ ? { currentTask: { title: text(taskRecord.title), status: text(taskRecord.status), ...(text(taskRecord.assignedAgentId) ? { assignedAgentId: text(taskRecord.assignedAgentId) } : {}) } }
63
+ : {}),
64
+ outstanding: stringList(progressRecord?.outstanding),
65
+ decisions: stringList(progressRecord?.decisions),
66
+ criteria,
67
+ },
68
+ }
69
+ : {}),
70
+ ...(loopRecord && text(loopRecord.id) && integer(loopRecord.version) !== undefined && text(loopRecord.kind) && text(loopRecord.status)
71
+ ? {
72
+ loop: {
73
+ id: text(loopRecord.id),
74
+ version: integer(loopRecord.version),
75
+ kind: text(loopRecord.kind),
76
+ status: text(loopRecord.status),
77
+ ...(text(loopRecord.currentActivity) ? { activity: text(loopRecord.currentActivity) } : {}),
78
+ iterations: records(loopRecord.iterations).length,
79
+ },
80
+ }
81
+ : {}),
82
+ handoffs: records(state.handoffs).flatMap((handoff) => {
83
+ const id = text(handoff.id);
84
+ const version = integer(handoff.version);
85
+ const status = text(handoff.status);
86
+ const sourceOwnerId = text(handoff.sourceOwnerId);
87
+ const updatedAt = text(handoff.updatedAt);
88
+ if (!id || version === undefined || !status || !sourceOwnerId || !updatedAt)
89
+ return [];
90
+ return [{
91
+ id,
92
+ version,
93
+ status,
94
+ sourceOwnerId,
95
+ ...(text(handoff.targetOwnerId) ? { targetOwnerId: text(handoff.targetOwnerId) } : {}),
96
+ ...(text(handoff.claimedBy) ? { claimedBy: text(handoff.claimedBy) } : {}),
97
+ updatedAt,
98
+ }];
99
+ }),
100
+ };
101
+ }
102
+ //# sourceMappingURL=developmentCoordinationProjection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"developmentCoordinationProjection.js","sourceRoot":"","sources":["../../../src/components/agent/developmentCoordinationProjection.ts"],"names":[],"mappings":"AAoCA,SAAS,MAAM,CAAC,KAAc;IAC5B,OAAO,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAgC,CAAC,CAAC,CAAC,SAAS,CAAA;AACnH,CAAC;AAED,SAAS,IAAI,CAAC,KAAc;IAC1B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAA;AACtE,CAAC;AAED,SAAS,OAAO,CAAC,KAAc;IAC7B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAA;AACjF,CAAC;AAED,SAAS,OAAO,CAAC,KAAc;IAC7B,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAoC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;AACnH,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,mCAAmC,CAAC,KAAc;IAChE,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IAC3B,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;IACxC,IAAI,CAAC,KAAK,IAAI,CAAC,SAAS;QAAE,OAAO,IAAI,CAAA;IAErC,MAAM,WAAW,GAAG,MAAM,CAA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AE,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,MAAM;iBAClD;aACF;YACH,CAAC,CAAC,EAAE,CAAC;QACP,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YACpD,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;YAC3B,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;YACxC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;YACnC,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAA;YACjD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;YACzC,IAAI,CAAC,EAAE,IAAI,OAAO,KAAK,SAAS,IAAI,CAAC,MAAM,IAAI,CAAC,aAAa,IAAI,CAAC,SAAS;gBAAE,OAAO,EAAE,CAAA;YACtF,OAAO,CAAC;oBACN,EAAE;oBACF,OAAO;oBACP,MAAM;oBACN,aAAa;oBACb,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;oBACtF,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;oBAC1E,SAAS;iBACV,CAAC,CAAA;QACJ,CAAC,CAAC;KACH,CAAA;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { Conversation } from '../../stores/agentChatStore.js';
2
+ import type { SubagentWorkbenchRun, SubagentWorkbenchRuntimeEvent } from './AgentWorkbenchPanel.js';
3
+ export declare function buildSubagentConversationProjection(run: SubagentWorkbenchRun, runtimeEvents: SubagentWorkbenchRuntimeEvent[], agentId: string, parentConversationId?: string): Partial<Conversation>;
4
+ //# sourceMappingURL=subagentConversationProjection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subagentConversationProjection.d.ts","sourceRoot":"","sources":["../../../src/components/agent/subagentConversationProjection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,YAAY,EACb,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EACV,oBAAoB,EACpB,6BAA6B,EAC9B,MAAM,0BAA0B,CAAA;AAEjC,wBAAgB,mCAAmC,CACjD,GAAG,EAAE,oBAAoB,EACzB,aAAa,EAAE,6BAA6B,EAAE,EAC9C,OAAO,EAAE,MAAM,EACf,oBAAoB,SAA2B,GAC9C,OAAO,CAAC,YAAY,CAAC,CA2EvB"}
@@ -0,0 +1,76 @@
1
+ export function buildSubagentConversationProjection(run, runtimeEvents, agentId, parentConversationId = run.parentConversationId) {
2
+ const createdAt = run.createdAt || Date.now();
3
+ const completedAt = run.endedAt || run.updatedAt || createdAt;
4
+ const workspaceIdIsPath = /^[A-Za-z]:[\\/]/.test(run.workspaceId) || run.workspaceId.startsWith('/');
5
+ const rootDirectory = run.toolPolicy.allowedDirectories[0] || (workspaceIdIsPath ? run.workspaceId : undefined);
6
+ const grantedDirectories = Array.from(new Set([
7
+ ...(rootDirectory ? [rootDirectory] : []),
8
+ ...run.toolPolicy.allowedDirectories,
9
+ ]));
10
+ const result = run.summary || run.error || `Subagent status: ${run.status}`;
11
+ const messages = [
12
+ {
13
+ id: `${run.id}:objective`,
14
+ role: 'user',
15
+ content: run.objective,
16
+ timestamp: createdAt,
17
+ runtimeKind: 'agent',
18
+ },
19
+ {
20
+ id: `${run.id}:result`,
21
+ role: 'assistant',
22
+ content: result,
23
+ timestamp: completedAt,
24
+ runtimeKind: 'agent',
25
+ ...(run.error ? { error: run.error } : {}),
26
+ },
27
+ ];
28
+ const projectedRuntimeEvents = runtimeEvents.map((event) => ({
29
+ id: event.id,
30
+ sequence: event.sequence,
31
+ conversationId: run.childConversationId,
32
+ source: event.source,
33
+ type: event.type,
34
+ timestamp: event.timestamp,
35
+ ...(event.summary ? { summary: event.summary } : {}),
36
+ }));
37
+ const latestRuntimeEvent = projectedRuntimeEvents.at(-1);
38
+ return {
39
+ schemaVersion: 3,
40
+ agentId,
41
+ workspaceId: run.workspaceId,
42
+ teamId: run.teamId,
43
+ workspaceMode: rootDirectory ? 'workspace' : 'chat-only',
44
+ ...(rootDirectory ? { rootDirectory, grantedDirectories } : {}),
45
+ messages,
46
+ title: run.childAgentName || run.childAgentId,
47
+ createdAt,
48
+ lastMessageAt: completedAt,
49
+ pendingTurns: [],
50
+ checkpoints: [],
51
+ tasks: [],
52
+ sessionUi: {
53
+ coordinationSessionId: run.childConversationId,
54
+ subagentRunId: run.id,
55
+ parentConversationId,
56
+ parentAgentId: run.parentAgentId,
57
+ childAgentId: run.childAgentId,
58
+ panelOpen: true,
59
+ panelTab: 'trace',
60
+ runtimeEvents: projectedRuntimeEvents,
61
+ ...(latestRuntimeEvent?.type ? { lastRuntimeEventType: latestRuntimeEvent.type } : {}),
62
+ ...(latestRuntimeEvent?.timestamp
63
+ ? { lastRuntimeEventAt: Date.parse(latestRuntimeEvent.timestamp) || completedAt }
64
+ : {}),
65
+ ...(run.tokenUsage ? { runtimeTokenUsage: { ...run.tokenUsage } } : {}),
66
+ sessionTab: {
67
+ schemaVersion: 1,
68
+ open: true,
69
+ order: 0,
70
+ lastActiveAt: Date.now(),
71
+ lastViewedAt: Date.now(),
72
+ },
73
+ },
74
+ };
75
+ }
76
+ //# sourceMappingURL=subagentConversationProjection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subagentConversationProjection.js","sourceRoot":"","sources":["../../../src/components/agent/subagentConversationProjection.ts"],"names":[],"mappings":"AAUA,MAAM,UAAU,mCAAmC,CACjD,GAAyB,EACzB,aA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rB,oBAAoB;YACpB,aAAa,EAAE,GAAG,CAAC,aAAa;YAChC,YAAY,EAAE,GAAG,CAAC,YAAY;YAC9B,SAAS,EAAE,IAAI;YACf,QAAQ,EAAE,OAAO;YACjB,aAAa,EAAE,sBAAsB;YACrC,GAAG,CAAC,kBAAkB,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,oBAAoB,EAAE,kBAAkB,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACtF,GAAG,CAAC,kBAAkB,EAAE,SAAS;gBAC/B,CAAC,CAAC,EAAE,kBAAkB,EAAE,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,SAAS,CAAC,IAAI,WAAW,EAAE;gBACjF,CAAC,CAAC,EAAE,CAAC;YACP,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,EAAE,GAAG,GAAG,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACvE,UAAU,EAAE;gBACV,aAAa,EAAE,CAAC;gBAChB,IAAI,EAAE,IAAI;gBACV,KAAK,EAAE,CAAC;gBACR,YAAY,EAAE,IAAI,CAAC,GAAG,EAAE;gBACxB,YAAY,EAAE,IAAI,CAAC,GAAG,EAAE;aACzB;SACF;KACF,CAAA;AACH,CAAC"}
@@ -0,0 +1,90 @@
1
+ import type { WebJobProgressV1 } from '@xenosystem/agent-interface-contract';
2
+ /**
3
+ * The rendering decisions for one durable-web-job observation, as plain data.
4
+ *
5
+ * This is deliberately not inside the component. Every judgement that can be
6
+ * wrong — whether a percentage is honest, whether a Stop action would tell the
7
+ * truth, what a screen reader is told — is decided here, where it is testable
8
+ * without a DOM. The workspace collects `packages/**\/src/**\/*.test.ts` and has
9
+ * no React test environment, so logic left in JSX is logic nothing can gate.
10
+ */
11
+ export type WebJobProgressTone = 'queued' | 'running' | 'succeeded' | 'partial' | 'failed' | 'cancelled';
12
+ export interface WebJobProgressView {
13
+ jobId: string;
14
+ tone: WebJobProgressTone;
15
+ stateLabel: string;
16
+ operationLabel: string;
17
+ /**
18
+ * Whole percent of known pages that have settled, or `null` when the job has
19
+ * not yet accounted for a single page.
20
+ *
21
+ * 🔴 `null` is not 0. A crawl that has discovered nothing and a crawl that has
22
+ * discovered 400 pages and finished none are different facts, and rendering
23
+ * both as "0%" invents a denominator the server never supplied. `null` renders
24
+ * as an indeterminate bar, which claims nothing.
25
+ */
26
+ percent: number | null;
27
+ /** Short "12/40 pages" style summary, or a bare page count when nothing is known yet. */
28
+ countersText: string;
29
+ /** Everything the counters say, spelled out for assistive technology. */
30
+ valueText: string;
31
+ ariaLabel: string;
32
+ terminal: boolean;
33
+ /**
34
+ * True when the tool call that owned this job has closed while the last
35
+ * observation was still non-terminal.
36
+ *
37
+ * 🔴 This is the ONE place the "running" label is allowed to become a lie, so
38
+ * it is handled here rather than by deleting the observation somewhere in the
39
+ * store. Nothing has watched the job since the tool call ended — after a
40
+ * reload, nothing in this process ever watched it — so the honest statement is
41
+ * what was LAST SEEN, not what is happening. Dropping the observation instead
42
+ * would have to be done identically on three separate store paths, and a rule
43
+ * enforced in three places is a rule that will hold in two.
44
+ */
45
+ stale: boolean;
46
+ /** Server-supplied terminal reason, forwarded verbatim only when present. */
47
+ terminalReason?: string;
48
+ }
49
+ export declare function deriveWebJobProgressView(progress: WebJobProgressV1, toolCallStatus?: 'running' | 'done'): WebJobProgressView;
50
+ export interface WebJobStopAvailabilityInput {
51
+ progress: WebJobProgressV1;
52
+ /** Status of the tool call the job is running inside. */
53
+ toolCallStatus: 'running' | 'done';
54
+ /** Request id of the turn this tool call belongs to. */
55
+ requestId?: string | undefined;
56
+ /** Request id of the turn the host currently has in flight, if any. */
57
+ activeRequestId?: string | null | undefined;
58
+ /** Whether the composition actually exposes a cancellation path today. */
59
+ hostExposesCancellation: boolean;
60
+ }
61
+ export type WebJobStopUnavailableReason = 'job_terminal' | 'tool_call_finished' | 'turn_not_active' | 'host_exposes_no_cancellation';
62
+ export interface WebJobStopAvailability {
63
+ available: boolean;
64
+ reason?: WebJobStopUnavailableReason;
65
+ }
66
+ /**
67
+ * Decide whether a Stop control may be offered, and refuse to offer one that
68
+ * would not do what its label says.
69
+ *
70
+ * 🔴 Four conditions, and dropping any of them produces a lie rather than a bug.
71
+ * A settled job cannot be stopped. A closed tool call has no turn to interrupt.
72
+ * A turn that is not the one in flight is not the turn cancellation would reach —
73
+ * pressing Stop on an older card would cancel somebody else's work. And a
74
+ * composition that exposes no cancellation at all must show no control, because
75
+ * a button that silently does nothing is worse than an absent one.
76
+ *
77
+ * ⚠️ What this authorises is a TURN cancellation, which is the only cancellation
78
+ * this surface is allowed to reach: cancelling the durable job itself is a
79
+ * provider call, and the renderer may not make one. The label and title must say
80
+ * so — see `WEB_JOB_STOP_TITLE`.
81
+ */
82
+ export declare function webJobStopAvailability(input: WebJobStopAvailabilityInput): WebJobStopAvailability;
83
+ export declare const WEB_JOB_STOP_LABEL = "Stop";
84
+ /**
85
+ * The exact wording matters. This stops the agent turn; it does not reach into
86
+ * the web service and cancel the job, and claiming otherwise would be the
87
+ * fabricated-success failure this repo forbids.
88
+ */
89
+ export declare const WEB_JOB_STOP_TITLE = "Stop this agent turn. The web job may keep running on the server until it settles.";
90
+ //# sourceMappingURL=webJobProgressView.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webJobProgressView.d.ts","sourceRoot":"","sources":["../../../src/components/agent/webJobProgressView.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAA;AAE5E;;;;;;;;GAQG;AAEH,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,QAAQ,GAAG,WAAW,CAAA;AAExG,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,kBAAkB,CAAA;IACxB,UAAU,EAAE,MAAM,CAAA;IAClB,cAA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
4
+ map: 'Map',
5
+ crawl: 'Crawl',
6
+ render: 'Render',
7
+ extract: 'Extract',
8
+ };
9
+ const STATE_LABELS = {
10
+ queued: 'Queued',
11
+ running: 'Running',
12
+ completed: 'Completed',
13
+ partial: 'Partial',
14
+ failed: 'Failed',
15
+ cancelled: 'Cancelled',
16
+ };
17
+ const STATE_TONES = {
18
+ queued: 'queued',
19
+ running: 'running',
20
+ completed: 'succeeded',
21
+ partial: 'partial',
22
+ failed: 'failed',
23
+ cancelled: 'cancelled',
24
+ };
25
+ export function deriveWebJobProgressView(progress, toolCallStatus = 'running') {
26
+ const { counters } = progress;
27
+ const stale = !progress.terminal && toolCallStatus === 'done';
28
+ // `knownPages` is the producer's own sum and the contract validator has already
29
+ // refused any payload where it disagrees with its operands, so no division here
30
+ // can exceed 1 and none can divide by a number the counters do not support.
31
+ const settled = counters.completedPages + counters.failedPages + counters.excludedPages;
32
+ const percent = counters.knownPages > 0
33
+ ? Math.max(0, Math.min(100, Math.round((settled / counters.knownPages) * 100)))
34
+ : null;
35
+ const countersText = counters.knownPages > 0
36
+ ? `${settled}/${counters.knownPages} pages`
37
+ : 'no pages yet';
38
+ // Spoken as adjectives ("10 completed"), so no pluralisation is involved and a
39
+ // count of one cannot read as broken English in a screen reader.
40
+ const detail = [
41
+ `${counters.completedPages} completed`,
42
+ `${counters.activePages} active`,
43
+ `${counters.queuedPages} queued`,
44
+ ];
45
+ if (counters.failedPages > 0)
46
+ detail.push(`${counters.failedPages} failed`);
47
+ if (counters.excludedPages > 0)
48
+ detail.push(`${counters.excludedPages} excluded`);
49
+ const operationLabel = OPERATION_LABELS[progress.operation];
50
+ const observedLabel = STATE_LABELS[progress.state];
51
+ const stateLabel = stale ? `Last seen ${observedLabel.toLowerCase()}` : observedLabel;
52
+ const valueText = `${stateLabel}. ${countersText}. ${detail.join(', ')}.`;
53
+ return {
54
+ jobId: progress.jobId,
55
+ // A stale row is never tinted as live. `queued` is the quietest tone and is
56
+ // the right one for "we are not watching this any more".
57
+ tone: stale ? 'queued' : STATE_TONES[progress.state],
58
+ stateLabel,
59
+ operationLabel,
60
+ stale,
61
+ percent,
62
+ countersText,
63
+ valueText,
64
+ ariaLabel: `Web ${operationLabel.toLowerCase()} job progress`,
65
+ terminal: progress.terminal,
66
+ ...(progress.terminalReason ? { terminalReason: progress.terminalReason } : {}),
67
+ };
68
+ }
69
+ /**
70
+ * Decide whether a Stop control may be offered, and refuse to offer one that
71
+ * would not do what its label says.
72
+ *
73
+ * 🔴 Four conditions, and dropping any of them produces a lie rather than a bug.
74
+ * A settled job cannot be stopped. A closed tool call has no turn to interrupt.
75
+ * A turn that is not the one in flight is not the turn cancellation would reach —
76
+ * pressing Stop on an older card would cancel somebody else's work. And a
77
+ * composition that exposes no cancellation at all must show no control, because
78
+ * a button that silently does nothing is worse than an absent one.
79
+ *
80
+ * ⚠️ What this authorises is a TURN cancellation, which is the only cancellation
81
+ * this surface is allowed to reach: cancelling the durable job itself is a
82
+ * provider call, and the renderer may not make one. The label and title must say
83
+ * so — see `WEB_JOB_STOP_TITLE`.
84
+ */
85
+ export function webJobStopAvailability(input) {
86
+ if (input.progress.terminal)
87
+ return { available: false, reason: 'job_terminal' };
88
+ if (input.toolCallStatus !== 'running')
89
+ return { available: false, reason: 'tool_call_finished' };
90
+ if (!input.requestId || input.requestId !== input.activeRequestId) {
91
+ return { available: false, reason: 'turn_not_active' };
92
+ }
93
+ if (!input.hostExposesCancellation)
94
+ return { available: false, reason: 'host_exposes_no_cancellation' };
95
+ return { available: true };
96
+ }
97
+ export const WEB_JOB_STOP_LABEL = 'Stop';
98
+ /**
99
+ * The exact wording matters. This stops the agent turn; it does not reach into
100
+ * the web service and cancel the job, and claiming otherwise would be the
101
+ * fabricated-success failure this repo forbids.
102
+ */
103
+ export const WEB_JOB_STOP_TITLE = 'Stop this agent turn. The web job may keep running on the server until it settles.';
104
+ //# sourceMappingURL=webJobProgressView.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webJobProgressView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AAE,QAAQ,CAAC,QAAQ;QAC3B,GAAG,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,QAAQ,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAChF,CAAA;AACH,CAAC;AAyBD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAkC;IACvE,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ;QAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,CAAA;IAChF,IAAI,KAAK,CAAC,cAAc,KAAK,SAAS;QAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,oBAAoB,EAAE,CAAA;IACjG,IAAI,CAAC,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,SAAS,KAAK,KAAK,CAAC,eAAe,EAAE,CAAC;QAClE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAA;IACxD,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,uBAAuB;QAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,8BAA8B,EAAE,CAAA;IACvG,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAA;AAC5B,CAAC;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAA;AAExC;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAC7B,oFAAoF,CAAA"}
@@ -1146,6 +1146,7 @@ export interface XenoAPI {
1146
1146
  session?: unknown;
1147
1147
  sessionDir?: string;
1148
1148
  sessionHistoryPath?: string;
1149
+ coordinationSessionId?: string;
1149
1150
  checkpoints?: unknown[];
1150
1151
  error?: string;
1151
1152
  }>;
@@ -2603,6 +2604,29 @@ export interface XenoAPI {
2603
2604
  */
2604
2605
  subscribeChanged?: (listener: (payload: unknown) => void) => () => void;
2605
2606
  };
2607
+ developmentCoordination?: {
2608
+ /** Stable identity whose lease is owned and heartbeated by the host client. */
2609
+ ownerId: string;
2610
+ getState: (params: {
2611
+ sessionId: string;
2612
+ }) => Promise<{
2613
+ schemaVersion: 1;
2614
+ sessionId: string;
2615
+ result: unknown;
2616
+ state: object;
2617
+ }>;
2618
+ action: (params: {
2619
+ sessionId: string;
2620
+ action: 'goal.create' | 'goal.update' | 'goal.complete' | 'goal.cancel' | 'goal.steer' | 'loop.start' | 'loop.get' | 'loop.begin' | 'loop.finish' | 'loop.set_status' | 'ownership.acquire' | 'ownership.renew' | 'ownership.release' | 'handoff.create' | 'handoff.claim' | 'handoff.complete' | 'handoff.fail';
2621
+ payload?: Record<string, unknown>;
2622
+ }) => Promise<{
2623
+ schemaVersion: 1;
2624
+ sessionId: string;
2625
+ result: unknown;
2626
+ state: object;
2627
+ }>;
2628
+ subscribeChanged?: (listener: (payload: unknown) => void) => () => void;
2629
+ };
2606
2630
  review: {
2607
2631
  snapshot: (params: {
2608
2632
  runId: string;