fix(orchestrator): keep subagents behind their agent on the 3D time axis
With depth = time, #agents/3d drew subagents behind the session that spawned them. A subagent took the mtime of its meta.json, which is rewritten when it finishes, and a session took the moment the hub first saw its name, or the window end when it had none. Sessions now take the first line of their transcript and subagents the first line of theirs, both from /api/subagents, with the old values as fallback. SpaceView.notBeforeParent moves a spawned node without a time, or with one before its parent's, to its parent's time, nested subagents included, so no subagent lies before the agent that spawned it. The 3D signature carries the time, so the nodes move once the lifetimes load. 🎯 Fix: 93 % 💥 Break: 2 % 💸 Cost: 100 % ⏱️ Time: – 🛡️ Security: 100 % 🏆 Score: 91 🚦 Gate: ✅ 90/5, cost and time <= 100, security 100 % Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ba97f7cc2e
commit
86b55dbc91
4 files changed
+38
-7
No files matched your search
@@ -74,6 +74,27 @@ const SpaceView = (() => {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param nodes - {id, kind, parent, ts} records.
|
||||
* @param spawned - the kinds spawned by their parent, such as subagents.
|
||||
* @returns copies of the nodes in which a spawned node without a time or
|
||||
* with one before its parent's takes its parent's time.
|
||||
*/
|
||||
function notBeforeParent(nodes, spawned) {
|
||||
const byId = new Map(nodes.map((node) => [node.id, node]));
|
||||
const settled = new Map();
|
||||
const at = (node) => {
|
||||
if (!settled.has(node.id)) {
|
||||
settled.set(node.id, node.ts);
|
||||
const parent = spawned.has(node.kind) ? byId.get(node.parent) : undefined;
|
||||
const floor = parent ? at(parent) : NaN;
|
||||
settled.set(node.id, Number.isFinite(floor) && !(node.ts >= floor) ? floor : node.ts);
|
||||
}
|
||||
return settled.get(node.id);
|
||||
};
|
||||
return nodes.map((node) => ({...node, ts: at(node)}));
|
||||
}
|
||||
|
||||
function clampView(kind, view) {
|
||||
const limits = LIMITS[kind];
|
||||
const wrapped = kind === "graph" ? {...view, yaw: signed(view.yaw)} : {...view, azimuth: around(view.azimuth)};
|
||||
@@ -119,7 +140,7 @@ const SpaceView = (() => {
|
||||
|
||||
return {
|
||||
DEFAULTS, LIMITS, AXES, DEPTH, LEVELS, REACH,
|
||||
clamp, ease, turn, rotation, apply, camera, project, depthSort, depthOf, clampView, tidy, tween, lens, place, horizon, compass,
|
||||
clamp, ease, turn, rotation, apply, camera, project, depthSort, depthOf, notBeforeParent, clampView, tidy, tween, lens, place, horizon, compass,
|
||||
};
|
||||
})();
|
||||
if (typeof module === "object" && module.exports) {
|
||||
|
||||
Reference in new issue
Block a user