@triflux/remote 10.32.0 → 10.33.1
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.
- package/cto/brief.mjs +93 -0
- package/cto/collect.mjs +846 -0
- package/cto/current.schema.json +181 -0
- package/cto/status.mjs +260 -0
- package/hub/hub-lifecycle.mjs +242 -0
- package/hub/mac-focus.mjs +94 -0
- package/hub/mac-tray.swift +133 -0
- package/hub/promote-penalties.mjs +138 -0
- package/hub/public/tray.html +626 -0
- package/hub/server.mjs +228 -45
- package/hub/team/claude-agent-session-normalizer.mjs +53 -0
- package/hub/team/claude-daemon-control.mjs +63 -59
- package/hub/team/claude-session-projection.mjs +57 -0
- package/hub/team/cli/services/hub-client.mjs +12 -3
- package/hub/team/conductor.mjs +18 -0
- package/hub/team/cto-pull.mjs +27 -0
- package/hub/team/uds-orchestrator.mjs +607 -0
- package/hub/tray-lifecycle.mjs +131 -0
- package/hub/tray-runtime.mjs +265 -0
- package/hub/tray-state.mjs +448 -0
- package/hub/tray.mjs +93 -4
- package/hub/workers/antigravity-route-worker.mjs +14 -4
- package/hub/workers/delegator-mcp.mjs +2 -5
- package/hub/workers/factory.mjs +1 -1
- package/hub/workers/gemini-worker.mjs +2 -1
- package/package.json +7 -2
- package/scripts/lib/env-probe.mjs +38 -8
package/cto/brief.mjs
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
const BRIEF_VERSION = "cto-lake.v1";
|
|
2
|
+
const MAX_BRIEF_BYTES = 2048;
|
|
3
|
+
const TRUNCATION_MARKER = "... truncated";
|
|
4
|
+
|
|
5
|
+
function oneLine(value, fallback = "n/a") {
|
|
6
|
+
const text =
|
|
7
|
+
typeof value === "string"
|
|
8
|
+
? value
|
|
9
|
+
: value === null || value === undefined
|
|
10
|
+
? fallback
|
|
11
|
+
: JSON.stringify(value);
|
|
12
|
+
return String(text).replace(/\s+/g, " ").trim() || fallback;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function compactDetail(value) {
|
|
16
|
+
const text = oneLine(value);
|
|
17
|
+
return text.length > 140 ? `${text.slice(0, 137)}...` : text;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function formatGoal(goal) {
|
|
21
|
+
const id = oneLine(goal?.id, "goal");
|
|
22
|
+
const status = oneLine(goal?.status, "unknown");
|
|
23
|
+
const title = oneLine(
|
|
24
|
+
goal?.title || goal?.objective || goal?.summary,
|
|
25
|
+
"untitled",
|
|
26
|
+
);
|
|
27
|
+
return `- ${id} ${status}: ${title}`;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function formatShard(shard) {
|
|
31
|
+
const id = oneLine(shard?.id || shard?.name || shard?.sessionId, "shard");
|
|
32
|
+
const status = oneLine(shard?.status || shard?.state, "unknown");
|
|
33
|
+
const detail = oneLine(shard?.summary || shard?.objective || shard?.task, "");
|
|
34
|
+
return detail ? `- ${id} ${status}: ${detail}` : `- ${id} ${status}`;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function formatEvent(event) {
|
|
38
|
+
const ts = oneLine(event?.ts, "unknown_ts");
|
|
39
|
+
const name = oneLine(event?.event, "event");
|
|
40
|
+
const summary = oneLine(event?.summary, "");
|
|
41
|
+
return summary ? `- ${ts} ${name}: ${summary}` : `- ${ts} ${name}`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function enforceCap(text) {
|
|
45
|
+
if (Buffer.byteLength(text, "utf8") <= MAX_BRIEF_BYTES) return text;
|
|
46
|
+
const marker = `\n${TRUNCATION_MARKER}`;
|
|
47
|
+
let candidate = text;
|
|
48
|
+
while (
|
|
49
|
+
candidate.length > 0 &&
|
|
50
|
+
Buffer.byteLength(`${candidate}${marker}`, "utf8") > MAX_BRIEF_BYTES
|
|
51
|
+
) {
|
|
52
|
+
candidate = candidate.slice(0, -1);
|
|
53
|
+
}
|
|
54
|
+
return `${candidate.replace(/\s+$/u, "")}${marker}`;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function renderBrief(current) {
|
|
58
|
+
const repo = current?.repo || {};
|
|
59
|
+
const summary = current?.summary || {};
|
|
60
|
+
const hub = current?.sources?.tfx_hub || {};
|
|
61
|
+
const activeGoals = Array.isArray(summary.active_goals)
|
|
62
|
+
? summary.active_goals.slice(0, 3)
|
|
63
|
+
: [];
|
|
64
|
+
const swarmShards = Array.isArray(summary.swarm_shards)
|
|
65
|
+
? summary.swarm_shards.slice(0, 2)
|
|
66
|
+
: [];
|
|
67
|
+
const recentEvents = Array.isArray(current?.ledger_tail)
|
|
68
|
+
? current.ledger_tail.slice(-2)
|
|
69
|
+
: [];
|
|
70
|
+
|
|
71
|
+
const lines = [
|
|
72
|
+
`brief_version: ${BRIEF_VERSION}`,
|
|
73
|
+
"repo_state",
|
|
74
|
+
`branch: ${oneLine(repo.branch, "unknown")} head: ${oneLine(repo.head, "unknown")} dirty: ${repo.dirty === true}`,
|
|
75
|
+
`summary: ${oneLine(summary.repo_state, "no repo summary")}`,
|
|
76
|
+
"active_goals",
|
|
77
|
+
...(activeGoals.length > 0 ? activeGoals.map(formatGoal) : ["- none"]),
|
|
78
|
+
"swarm_shards",
|
|
79
|
+
...(swarmShards.length > 0 ? swarmShards.map(formatShard) : ["- none"]),
|
|
80
|
+
"hub_status",
|
|
81
|
+
`status: ${oneLine(hub.status, "unknown")} available: ${hub.available === true} detail: ${compactDetail(hub.detail)}`,
|
|
82
|
+
"recent_events",
|
|
83
|
+
...(recentEvents.length > 0 ? recentEvents.map(formatEvent) : ["- none"]),
|
|
84
|
+
"generated_at",
|
|
85
|
+
oneLine(current?.generated_at, "unknown"),
|
|
86
|
+
"injection_note",
|
|
87
|
+
"read by agent hooks; align to this north-star",
|
|
88
|
+
];
|
|
89
|
+
|
|
90
|
+
return enforceCap(`${lines.join("\n")}\n`);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export { BRIEF_VERSION, MAX_BRIEF_BYTES };
|