Surface (requirement 001 phase 2): navigation Stream (Inbox, Regeln) / Agents / Artifacts with keys 1-3 and hash routes (#graph and #tree redirect), header with title, command palette and settings only, server-side badges (unsnoozed inbox, beats within 900 s, open jobs), a Mayday banner with "aufheben", four stream chips with agent:/art:/seit: search, Filter and time menus, the inbox in main, an agents toolbar (Funk an alle with Newsletter, Broadcast, Pan-Pan, Security, Mayday; Priorität; Tag/Nacht), Post or Call in the agent panel, Ambiente in the settings and read-aloud over the seven classes with Mayday locked. Rename (decision 9): hub/ is orchestrator/, the package kvb_orchestrator, the unit kvb-orchestrator-runner.service, scripts/orchestrator.sh, environment KVB_ORCHESTRATOR_*, make targets orchestrator-*, the MCP server, image and compose project kvb-orchestrator, the guard header X-Kvb-Orchestrator and the message marker [kvb-orchestrator msg <id>]. install runs migrate first: it stops the old container, removes its image and code, moves state, approvals and pinned keys, swaps the MCP registration, the PermissionRequest hook and the runner unit, and changes nothing on a second run (scratch-HOME test with stub docker, claude and systemctl). Saved views fall back to the old localStorage key once. MEDUSA acceptances carried to the renamed paths: 82 rows whose lines are unchanged (reason prefixed "renamed from <old path>, line unchanged"), and 7 rows whose text changed only in the product name, the package name, a temp prefix or a new class argument, each upheld by one kvb-think-criticize skeptic (approval.py:60, messaging.py:53, server.py:56, tests/hub_support.py:64, passkey.py:205, page-agent.js:75, language.py:46). Cost 101 %: the longer name adds 15 tokens of skill text; the operator approved it with the commit. 🎯 Fix: 92 % 💥 Break: 4 % 💸 Cost: 101 % ⏱️ Time: – 🛡️ Security: 100 % 💰 Value: ? 🏆 Score: 87 🚦 Gate: ⚠️ cost 101 % > 100: ask the operator before the commit Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
67 lines
2.4 KiB
JavaScript
67 lines
2.4 KiB
JavaScript
const SpacePick = (() => {
|
|
"use strict";
|
|
const {clamp, project} = typeof SpaceView === "object" ? SpaceView : require("./space-view.js");
|
|
const {arcPoints} = typeof SpacePaint === "object" ? SpacePaint : require("./space-paint.js");
|
|
const CURVE = 8;
|
|
|
|
function gap(x, y, a, b) {
|
|
const dx = b.x - a.x;
|
|
const dy = b.y - a.y;
|
|
const length = dx * dx + dy * dy;
|
|
const share = length ? clamp(((x - a.x) * dx + (y - a.y) * dy) / length, 0, 1) : 0;
|
|
return Math.hypot(a.x + dx * share - x, a.y + dy * share - y);
|
|
}
|
|
|
|
function nearest(x, y, marks) {
|
|
if (marks.some((mark) => mark === null)) {
|
|
return {distance: Infinity, depth: Infinity};
|
|
}
|
|
if (marks.length === 1) {
|
|
return {distance: Math.hypot(marks[0].x - x, marks[0].y - y), depth: marks[0].depth};
|
|
}
|
|
let best = {distance: Infinity, depth: Infinity};
|
|
for (let index = 1; index < marks.length; index += 1) {
|
|
const distance = gap(x, y, marks[index - 1], marks[index]);
|
|
if (distance < best.distance) {
|
|
best = {distance, depth: (marks[index - 1].depth + marks[index].depth) / 2};
|
|
}
|
|
}
|
|
return best;
|
|
}
|
|
|
|
function curve(marks) {
|
|
if (marks.some((mark) => mark === null)) {
|
|
return marks;
|
|
}
|
|
const [a, b, c] = marks;
|
|
return Array.from({length: CURVE + 1}, (_, index) => {
|
|
const t = index / CURVE;
|
|
const u = 1 - t;
|
|
return {x: u * u * a.x + 2 * u * t * b.x + t * t * c.x, y: u * u * a.y + 2 * u * t * b.y + t * t * c.y, depth: u * u * a.depth + 2 * u * t * b.depth + t * t * c.depth};
|
|
});
|
|
}
|
|
|
|
function pick(built, cam, x, y, reach) {
|
|
let best = null;
|
|
const consider = (found, hit) => {
|
|
if (found.distance > reach) {
|
|
return;
|
|
}
|
|
if (!best || found.distance < best.distance - 0.5 || (found.distance <= best.distance + 0.5 && found.depth < best.depth)) {
|
|
best = {...hit, distance: found.distance, depth: found.depth};
|
|
}
|
|
};
|
|
built.lines.forEach((line, index) => consider(nearest(x, y, line.points.map((entry) => project(cam, entry))), {kind: "line", index, line}));
|
|
built.arcs.forEach((arc, index) => {
|
|
const marks = arcPoints(arc).map((entry) => project(cam, entry));
|
|
consider(nearest(x, y, arc.kind === "broadcast" ? [...marks, marks[0]] : curve(marks)), {kind: "arc", index, arc});
|
|
});
|
|
return best;
|
|
}
|
|
|
|
return {pick};
|
|
})();
|
|
if (typeof module === "object" && module.exports) {
|
|
module.exports = SpacePick;
|
|
}
|