triflux 10.28.1 → 10.30.0
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/bin/triflux.mjs +21 -0
- package/cto/brief.mjs +93 -0
- package/cto/collect.mjs +846 -0
- package/cto/current.schema.json +181 -0
- package/cto/dashboard.mjs +412 -0
- package/cto/index.mjs +44 -0
- package/cto/status.mjs +260 -0
- package/hooks/cto-north-star-brief.mjs +146 -0
- package/hooks/hook-orchestrator.mjs +24 -0
- package/hooks/hook-registry.json +22 -0
- package/hooks/session-end-cleanup.mjs +15 -0
- package/hooks/session-start-fast.mjs +158 -0
- package/hooks/session-start-lake.mjs +94 -0
- package/hub/codex-adapter.mjs +3 -0
- package/hub/server.mjs +44 -1
- package/hub/team/conductor.mjs +18 -0
- package/hub/team/cto-pull.mjs +27 -0
- package/hub/team/synapse-http.mjs +119 -13
- package/hub/team/synapse-registry.mjs +187 -10
- package/hub/workers/lib/jsonrpc-core.mjs +299 -0
- package/hub/workers/lib/jsonrpc-stdio.mjs +17 -276
- package/hub/workers/lib/jsonrpc-ws-uds.mjs +27 -234
- package/hud/constants.mjs +22 -0
- package/hud/hud-qos-status.mjs +18 -1
- package/hud/providers/claude.mjs +88 -13
- package/hud/providers/cto.mjs +73 -0
- package/hud/renderers.mjs +4 -2
- package/package.json +2 -1
- package/scripts/pack.mjs +4 -0
- package/scripts/release/check-packages-mirror.mjs +48 -0
- package/scripts/tfx-route.sh +61 -0
package/bin/triflux.mjs
CHANGED
|
@@ -491,6 +491,15 @@ const CLI_COMMAND_SCHEMAS = Object.freeze({
|
|
|
491
491
|
},
|
|
492
492
|
},
|
|
493
493
|
},
|
|
494
|
+
cto: {
|
|
495
|
+
usage: "tfx cto <collect|status|dashboard> [options]",
|
|
496
|
+
description: "repo-local authority layer console",
|
|
497
|
+
subcommands: {
|
|
498
|
+
collect: "refresh .triflux/lake/current.json from authority sources",
|
|
499
|
+
status: "print the current authority summary",
|
|
500
|
+
dashboard: "render the CTO console dashboard, optionally with --watch",
|
|
501
|
+
},
|
|
502
|
+
},
|
|
494
503
|
multi: {
|
|
495
504
|
usage:
|
|
496
505
|
"tfx multi [--dashboard-layout lite|single|split-2col|split-3col|auto] <subcommand|task>",
|
|
@@ -7466,6 +7475,18 @@ async function main() {
|
|
|
7466
7475
|
);
|
|
7467
7476
|
return;
|
|
7468
7477
|
}
|
|
7478
|
+
case "cto": {
|
|
7479
|
+
if (cmdArgs.some(isHelpArg)) {
|
|
7480
|
+
printCommandHelp("cto");
|
|
7481
|
+
return;
|
|
7482
|
+
}
|
|
7483
|
+
const { pathToFileURL } = await import("node:url");
|
|
7484
|
+
const { cmdCto } = await import(
|
|
7485
|
+
pathToFileURL(join(PKG_ROOT, "cto", "index.mjs")).href
|
|
7486
|
+
);
|
|
7487
|
+
await cmdCto(cmdArgs, { json: JSON_OUTPUT });
|
|
7488
|
+
return;
|
|
7489
|
+
}
|
|
7469
7490
|
case "multi": {
|
|
7470
7491
|
const subcommand = cmdArgs[0] || "";
|
|
7471
7492
|
if (cmdArgs.some(isHelpArg)) {
|
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 };
|