trantor 0.18.138 → 0.18.139
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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +3 -3
- package/bin/cli.mjs +4 -26
- package/bin/connect.mjs +20 -25
- package/bin/open-session.sh +16 -5
- package/hub/auth.mjs +1 -4
- package/hub/routes/admin.mjs +1 -42
- package/hub/routes/messages.mjs +2 -2
- package/hub.mjs +1 -3
- package/kimi/skills/crew/SKILL.md +1 -1
- package/kimi.plugin.json +1 -1
- package/mcp.mjs +0 -8
- package/package.json +1 -3
- package/bin/relay-watch.mjs +0 -52
- package/configs/codex-config.toml +0 -6
- package/configs/gemini-settings.json +0 -10
- package/engine/bin/__pycache__/scrooge-capabilitiescpython-314.pyc +0 -0
- package/mods/trantor-band/.claude-plugin/plugin.json +0 -5
- package/mods/trantor-band/hooks/band-lib.mjs +0 -72
- package/mods/trantor-band/hooks/hooks.json +0 -5
- package/mods/trantor-band/hooks/trantor-band.tsx +0 -83
- package/mods/trantor-band/trantor-band.test.ts +0 -70
- package/ui.html +0 -1141
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
},
|
|
7
7
|
"metadata": {
|
|
8
8
|
"description": "Trantor — the hub-world for AI agent crews: live message bus, presence, project Kanban/flow board + context-handoff for independent AI coding agents (Claude, Codex, Gemini, …)",
|
|
9
|
-
"version": "0.18.
|
|
9
|
+
"version": "0.18.139"
|
|
10
10
|
},
|
|
11
11
|
"plugins": [
|
|
12
12
|
{
|
|
13
13
|
"name": "trantor",
|
|
14
14
|
"source": "./",
|
|
15
15
|
"description": "The hub-world for AI agent crews. Say \"fire up the crew\" and Claude becomes the architect: a plan-aware Advisor routes the work (solo / cheap inline calls / live crew of Codex, GLM, Kimi & DeepSeek in their own terminal windows), a Kanban/flow command center with a testing gate tracks it, and an economics brain (Scrooge) keeps the receipts. Includes the relay MCP, a SessionStart auto-discovery hook, and a PreCompact context-handoff so a fresh session can take over a full window instead of compacting.",
|
|
16
|
-
"version": "0.18.
|
|
16
|
+
"version": "0.18.139",
|
|
17
17
|
"author": {
|
|
18
18
|
"name": "Sasha Bogojevic"
|
|
19
19
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trantor",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.139",
|
|
4
4
|
"description": "Trantor — the hub-world for AI agent crews: live message bus, presence, project Kanban/flow board + crew orchestration for independent AI coding agents (Claude, Codex, Gemini, Kimi, DeepSeek)",
|
|
5
5
|
"mcpServers": {
|
|
6
6
|
"relay": {
|
package/README.md
CHANGED
|
@@ -269,7 +269,7 @@ No cmux or tmux? Crews still work — one titled Terminal window per seat, still
|
|
|
269
269
|
|
|
270
270
|
## The dashboard — `trantor ui`
|
|
271
271
|
|
|
272
|
-
A live command center
|
|
272
|
+
A live command center in the Trantor desktop app, grouped by **project** — and a *durable,
|
|
273
273
|
self-maintaining record*, not just a snapshot. Dead sessions self-prune (no more graveyard of
|
|
274
274
|
stale boards), and the project order is **stable**: a working board updates in place instead of
|
|
275
275
|
jumping to the top while you're reading it.
|
|
@@ -506,7 +506,7 @@ GLM via OpenCode is its replacement. Gemini still works as a Scrooge cheap-model
|
|
|
506
506
|
hub.mjs ←— plain HTTP + SSE · presence/messages/board/history/lessons/learning/economics
|
|
507
507
|
(Node built-ins only · state in ~/.agent-bus/bus.json · loopback by default)
|
|
508
508
|
▲
|
|
509
|
-
dashboard (
|
|
509
|
+
dashboard (Trantor.app) · BOARD/FLOW/TIMELINE · 🧠 Learning · 🪙 savings · conversation lanes
|
|
510
510
|
```
|
|
511
511
|
|
|
512
512
|
Config: `RELAY_URL` env → `~/.agent-bus/config.json` → `http://127.0.0.1:4477`.
|
|
@@ -526,7 +526,7 @@ The `relay_*` tool names and the `~/.agent-bus` state dir remain until a later r
|
|
|
526
526
|
- You can't interrupt an agent **mid-turn**; messages land when its current turn ends (idle
|
|
527
527
|
agents wake instantly via their runner).
|
|
528
528
|
- Window spawning is macOS (Terminal.app); on Linux the launcher prints per-agent commands
|
|
529
|
-
to run in your own terminals. Hub/MCP
|
|
529
|
+
to run in your own terminals. Hub/MCP are cross-platform.
|
|
530
530
|
- The hub is deliberately tiny (in-memory + JSON file) — a coordination bus, not a message queue.
|
|
531
531
|
- Each CLI's sign-in is its own (ChatGPT, Google, Kimi accounts) — the doctor detects state
|
|
532
532
|
and names the fix, but can't log in for you.
|
package/bin/cli.mjs
CHANGED
|
@@ -110,7 +110,6 @@ switch (cmd) {
|
|
|
110
110
|
console.log(`${id} recorded in ${p}${current === id ? " (unchanged)" : ""} — commit it so worktrees and clones carry the identity`);
|
|
111
111
|
break;
|
|
112
112
|
}
|
|
113
|
-
case "watch": run("bin/relay-watch.mjs"); break;
|
|
114
113
|
case "catchup": run("bin/catchup.mjs"); break;
|
|
115
114
|
case "agents": run("bin/agents.mjs"); break;
|
|
116
115
|
case "gate": run("bin/gate.mjs"); break;
|
|
@@ -124,7 +123,6 @@ switch (cmd) {
|
|
|
124
123
|
case "balances": case "balance": case "credits": run("bin/balances.mjs"); break;
|
|
125
124
|
case "recost": run("bin/recost.mjs"); break;
|
|
126
125
|
case "handoff": run("bin/baton.mjs"); break;
|
|
127
|
-
case "adopt": run("bin/adopt.mjs"); break;
|
|
128
126
|
case "takeover": run("bin/takeover.mjs"); break;
|
|
129
127
|
case "drill": run("bin/drill-surface.mjs"); break;
|
|
130
128
|
case "summarize": run("bin/summarize.mjs"); break;
|
|
@@ -247,32 +245,13 @@ switch (cmd) {
|
|
|
247
245
|
else console.error(`Enrollment failed: ${j.error || r.statusText}`);
|
|
248
246
|
break;
|
|
249
247
|
}
|
|
250
|
-
// Prefer the desktop app: it signs hub requests in Rust; the browser has no signing key.
|
|
251
|
-
// Explain the browser's read limitation when the desktop app is unavailable.
|
|
252
248
|
case "ui": {
|
|
253
|
-
|
|
254
|
-
const { resolveProject } = await import(join(ROOT, "lib/project.mjs"));
|
|
255
|
-
const url = resolveHubInfo(resolveProject(process.cwd())).url;
|
|
256
|
-
|
|
257
|
-
let authMode = "";
|
|
258
|
-
try {
|
|
259
|
-
const r = await fetch(`${url}/health`, { signal: AbortSignal.timeout(5000) });
|
|
260
|
-
authMode = String((await r.json()).authMode || "");
|
|
261
|
-
} catch { /* hub unreachable — fall through and let the browser show that */ }
|
|
262
|
-
|
|
263
|
-
const hasApp = process.platform === "darwin" && existsSync("/Applications/Trantor.app");
|
|
264
|
-
if (authMode === "enforce" && hasApp) {
|
|
249
|
+
if (process.platform === "darwin" && existsSync("/Applications/Trantor.app")) {
|
|
265
250
|
spawn("open", ["-a", "Trantor"], { stdio: "ignore", detached: true }).unref();
|
|
266
|
-
console.log(
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
if (authMode === "enforce") {
|
|
270
|
-
console.log(`⚠ ${url} is auth:enforce. A browser cannot sign its requests, so the board will be EMPTY —`);
|
|
271
|
-
console.log(` every data endpoint returns 401. Install the desktop app instead: trantor app install`);
|
|
272
|
-
console.log(` Opening it anyway so you can see for yourself…`);
|
|
251
|
+
console.log("dashboard → Trantor.app");
|
|
252
|
+
} else {
|
|
253
|
+
console.log("The dashboard is the Trantor desktop app. Install it with: trantor app install");
|
|
273
254
|
}
|
|
274
|
-
spawn(process.platform === "darwin" ? "open" : "xdg-open", [url], { stdio: "ignore", detached: true }).unref();
|
|
275
|
-
console.log(`dashboard → ${url}`);
|
|
276
255
|
break;
|
|
277
256
|
}
|
|
278
257
|
case "version": case "-v": case "--version":
|
|
@@ -327,7 +306,6 @@ switch (cmd) {
|
|
|
327
306
|
trantor seat-why WHY a seat is down (err file, logs, pids): seat-why <agent> [--json] — quota, auth, crash, or just no pane
|
|
328
307
|
trantor seat-record the per-project seat record the advisor benches from (✓/∅/↩ per difficulty) — [--project p] [--reset <seat>] [--json]
|
|
329
308
|
trantor telemetry ship send turn history to the hub — this seat's log, or every log with --all; prints stored/duplicates/dropped per file
|
|
330
|
-
trantor watch live bus feed in the terminal
|
|
331
309
|
trantor inbox THIS session's unread bus messages, signed (works under enforce) — [--all] [--consume] [--json]
|
|
332
310
|
trantor policy the autonomy ladder: show | set <project> <1-4> | link <a> <b> --reason "<why>"
|
|
333
311
|
trantor proposals agent-proposed permissions awaiting YOUR decision: [--all] | approve <id> [--note "…"] | deny <id> --note "…"
|
package/bin/connect.mjs
CHANGED
|
@@ -19,11 +19,17 @@ const MCP = join(dirname(dirname(fileURLToPath(import.meta.url))), "mcp.mjs");
|
|
|
19
19
|
const PROJECT_INFO = resolveProjectInfo(process.cwd());
|
|
20
20
|
const PROJECT_AT_CONNECT = PROJECT_INFO.project;
|
|
21
21
|
const URL_ = resolveHubInfo(PROJECT_AT_CONNECT).url;
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
//
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
// #14536: graft is no longer an agent MCP server (0 calls from Claude sessions in 30 days, a handful
|
|
23
|
+
// from seats, ~900 tokens of tool list per turn). The desktop app still runs the graft CLI itself.
|
|
24
|
+
// Connect removes the entries older versions wrote.
|
|
25
|
+
// The [mcp_servers.graft] table up to the next table, and the comment line connect wrote for it,
|
|
26
|
+
// which a later relay env refresh can leave separated from the table.
|
|
27
|
+
function removeCodexGraft(toml) {
|
|
28
|
+
return toml
|
|
29
|
+
.replace(/^# trantor — Graft[^\n]*\n/m, "")
|
|
30
|
+
.replace(/^\[mcp_servers\.graft\]\n(?:(?!\[)[^\n]*\n?)*/m, "")
|
|
31
|
+
.replace(/\n{3,}/g, "\n\n");
|
|
32
|
+
}
|
|
27
33
|
const has = (cmd) => { try { execSync(`command -v ${cmd}`, { stdio: "ignore", shell: "/bin/sh" }); return true; } catch { return false; } };
|
|
28
34
|
const stamp = new Date().toISOString().slice(0, 10);
|
|
29
35
|
const backup = (p) => { const b = `${p}.bak-${stamp}`; if (!existsSync(b)) copyFileSync(p, b); return b; };
|
|
@@ -101,15 +107,11 @@ if (has("codex")) {
|
|
|
101
107
|
}
|
|
102
108
|
report("codex", note, p);
|
|
103
109
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if (
|
|
108
|
-
|
|
109
|
-
const gblock = `\n# trantor — Graft code-graph tools (graft_find_code/_find_all/_trace_calls/_file_api/_repo_map)\n[mcp_servers.graft]\ncommand = "${GRAFT}"\nargs = ["mcp"]\n`;
|
|
110
|
-
if (!DRY) { if (existsSync(p)) backup(p); writeFileSync(p, g + gblock); }
|
|
111
|
-
report("codex", "graft wired", p);
|
|
112
|
-
}
|
|
110
|
+
const g = existsSync(p) ? readFileSync(p, "utf8") : "";
|
|
111
|
+
const ungrafted = removeCodexGraft(g);
|
|
112
|
+
if (ungrafted !== g) {
|
|
113
|
+
if (!DRY) { backup(p); writeFileSync(p, ungrafted); }
|
|
114
|
+
report("codex", "graft MCP removed", p);
|
|
113
115
|
}
|
|
114
116
|
}
|
|
115
117
|
|
|
@@ -120,7 +122,7 @@ if (has("gemini")) {
|
|
|
120
122
|
d.mcpServers ||= {};
|
|
121
123
|
d.mcpServers.relay ||= { command: "node", args: [MCP], env: {} };
|
|
122
124
|
d.mcpServers.relay.env = { ...d.mcpServers.relay.env, ...relayEnv("gemini") };
|
|
123
|
-
|
|
125
|
+
delete d.mcpServers.graft;
|
|
124
126
|
}), p);
|
|
125
127
|
}
|
|
126
128
|
|
|
@@ -132,7 +134,7 @@ const kimiRelay = (cli, p) => report(cli, patchJson(p, d => {
|
|
|
132
134
|
d.mcpServers ||= {};
|
|
133
135
|
d.mcpServers.relay ||= { command: "node", args: [MCP], env: {} };
|
|
134
136
|
d.mcpServers.relay.env = { ...d.mcpServers.relay.env, ...relayEnv("kimi") };
|
|
135
|
-
|
|
137
|
+
delete d.mcpServers.graft;
|
|
136
138
|
}), p);
|
|
137
139
|
const kimiCodeHome = join(homedir(), ".kimi-code");
|
|
138
140
|
const kimiPaths = [join(homedir(), ".kimi", "mcp.json"), join(kimiCodeHome, "mcp.json")];
|
|
@@ -168,7 +170,7 @@ if (has("opencode")) {
|
|
|
168
170
|
d.$schema ||= "https://opencode.ai/config.json";
|
|
169
171
|
d.mcp ||= {};
|
|
170
172
|
d.mcp.relay ||= { type: "local", command: ["node", MCP], enabled: true };
|
|
171
|
-
|
|
173
|
+
delete d.mcp.graft;
|
|
172
174
|
d.mcp.relay.environment ||= {};
|
|
173
175
|
// Migrate the old generated pin too: `||=` alone left RELAY_AGENT=opencode in every existing
|
|
174
176
|
// config forever, where OpenCode overlaid it on the qwen/glm/deepseek runner environment.
|
|
@@ -225,14 +227,7 @@ if (has("dsh")) {
|
|
|
225
227
|
RELAY_AGENT: !!js process.env.RELAY_AGENT ?? 'dsh'
|
|
226
228
|
RELAY_PROJECT: !!js process.env.RELAY_PROJECT ?? ''
|
|
227
229
|
RELAY_SESSION: !!js process.env.RELAY_SESSION ?? ''
|
|
228
|
-
|
|
229
|
-
name: '@deepseek-ai/dsh-mcp-client'
|
|
230
|
-
config:
|
|
231
|
-
serverName: graft
|
|
232
|
-
transport: stdio
|
|
233
|
-
command: ${GRAFT}
|
|
234
|
-
args: ['mcp']
|
|
235
|
-
` : ""}`;
|
|
230
|
+
`;
|
|
236
231
|
// "a profile exists" is not "a profile is current": connect grows rows over time, and an existence
|
|
237
232
|
// check short-circuits on a profile written by an older connect forever. The gate is CONTENT-based:
|
|
238
233
|
// every row id this connect writes must already be in the patch, else regenerate (backed up).
|
package/bin/open-session.sh
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
# open-session.sh <dir> <command...> — open a NEW macOS Terminal window in <dir> running <command>.
|
|
3
3
|
# Lets a Claude session spawn sibling terminal sessions (e.g. to test multi-session relay flows).
|
|
4
|
+
#
|
|
5
|
+
# #14531: the new window must not carry the caller's session identity. A Terminal session that
|
|
6
|
+
# kept HERDR_PANE_ID registered itself as the agent of a herdr pane it was not in (the app then
|
|
7
|
+
# attached to an empty pane), and one that kept CLAUDE_CODE_CHILD_SESSION ran with transcript
|
|
8
|
+
# saving off, so its conversation could never be resumed. Same list as lib/seats.mjs
|
|
9
|
+
# SESSION_IDENTITY_ENV, plus the rest of herdr's pane env.
|
|
4
10
|
DIR="${1:-$HOME}"; shift; CMD="$*"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
11
|
+
SCRUB="unset HERDR_ENV HERDR_PANE_ID HERDR_TAB_ID HERDR_WORKSPACE_ID HERDR_SOCKET_PATH TRANTOR_ORCH CLAUDECODE CLAUDE_CODE_CHILD_SESSION CLAUDE_CODE_ENTRYPOINT CLAUDE_CODE_SESSION_ID"
|
|
12
|
+
LINE="$SCRUB; cd $(printf '%q' "$DIR") && $CMD"
|
|
13
|
+
if [ "${TRANTOR_OPEN_SESSION_PRINT:-}" = "1" ]; then printf '%s\n' "$LINE"; exit 0; fi
|
|
14
|
+
osascript - "$LINE" >/dev/null <<'OSA'
|
|
15
|
+
on run argv
|
|
16
|
+
tell application "Terminal"
|
|
17
|
+
do script (item 1 of argv)
|
|
18
|
+
activate
|
|
19
|
+
end tell
|
|
20
|
+
end run
|
|
10
21
|
OSA
|
package/hub/auth.mjs
CHANGED
|
@@ -13,11 +13,8 @@ const BODY_CAP_DEFAULT = 4 * 1024 * 1024;
|
|
|
13
13
|
const BODY_CAP_PROMPT = 16 * 1024 * 1024;
|
|
14
14
|
// More than 100x the measured 115,194-byte desktop snapshot.
|
|
15
15
|
const BODY_CAP_OWNER_CHAT = 16 * 1024 * 1024;
|
|
16
|
-
// About 6x the measured 10,659,828-byte real state.
|
|
17
|
-
const BODY_CAP_OWNER_IMPORT = 64 * 1024 * 1024;
|
|
18
16
|
const OWNER_BODY_CAPS = new Map([
|
|
19
17
|
["/session/chat", BODY_CAP_OWNER_CHAT],
|
|
20
|
-
["/import", BODY_CAP_OWNER_IMPORT],
|
|
21
18
|
["/handoff", BODY_CAP_DEFAULT], ["/task", BODY_CAP_DEFAULT], ["/task/update", BODY_CAP_DEFAULT],
|
|
22
19
|
]);
|
|
23
20
|
function bodyCap(P) { return P === "/session/prompt" ? BODY_CAP_PROMPT : BODY_CAP_DEFAULT; }
|
|
@@ -96,7 +93,7 @@ function cmpSemver(a, b) {
|
|
|
96
93
|
}
|
|
97
94
|
const AUTH_HEADERS = ["x-trantor-pubkey", "x-trantor-sig", "x-trantor-ts", "x-trantor-nonce"];
|
|
98
95
|
const PUBLIC_ENDPOINTS = new Set(["/", "/ui", "/health", "/enroll"]);
|
|
99
|
-
const OWNER_ENDPOINTS = new Set(["/project/delete", "/sweep", "/reconcile", "/invite", "/
|
|
96
|
+
const OWNER_ENDPOINTS = new Set(["/project/delete", "/sweep", "/reconcile", "/invite", "/policy", "/session/prompts", "/session/prompt/claim", "/session/prompt/ack", "/session/attachment"]);
|
|
100
97
|
const DEVICE_ENDPOINTS = new Set(["/device/register", "/device/unregister", "/devices"]);
|
|
101
98
|
const READ_ENDPOINTS = new Set(["/peers", "/tasks", "/events", "/inbox", "/peer", "/card", "/stream", "/history", "/projects", "/catchup", "/phases", "/recent", "/handoffs", "/verify-gates", "/claims", "/proposals", "/grants", "/overseer/context", "/overseer/status", "/session/chat", "/session/prompt", "/crew/roster", "/machines/health"]);
|
|
102
99
|
const roleRank = { read: 1, write: 2, approver: 3, owner: 4 };
|
package/hub/routes/admin.mjs
CHANGED
|
@@ -25,7 +25,7 @@ function remoteEvidence(value, file) {
|
|
|
25
25
|
export async function routeAdmin({ req, res, q, P, auth, ctx }) {
|
|
26
26
|
const {
|
|
27
27
|
state, body, json, crossProjectGuard, touch, canon, filterReadable,
|
|
28
|
-
appendEvent,
|
|
28
|
+
appendEvent, overseer, ONLINE_MS, PEER_TTL_MS, pruneClaims, fileClaims,
|
|
29
29
|
scopeAllows, duty, markDirty, HUB_VERSION, cmpSemver, prunePeers,
|
|
30
30
|
filterDiscoverable, healthOf, now, canRead, AUTH_MODE, CLAIM_TTL_MS, subFp,
|
|
31
31
|
} = ctx;
|
|
@@ -118,47 +118,6 @@ export async function routeAdmin({ req, res, q, P, auth, ctx }) {
|
|
|
118
118
|
// BEFORE every file edit and the response carries any live claims by OTHER sessions, so an
|
|
119
119
|
// orchestrator learns of a collision before the edit lands. Ephemeral like presence BY DESIGN.
|
|
120
120
|
|
|
121
|
-
// --- project adoption: merge one project's rows brought from ANOTHER hub -------------------
|
|
122
|
-
// The other half of `trantor adopt`: the CLI reads the project's rows off the machine-local hub
|
|
123
|
-
// and POSTs them here (owner-signed). Colliding card ids get FRESH ids; idempotence is the
|
|
124
|
-
// CALLER's contract: adopt refuses when the project already has cards here, unless forced.
|
|
125
|
-
if (req.method === "POST" && P === "/import") {
|
|
126
|
-
const b = await body(req);
|
|
127
|
-
const proj = canon(String(b.project || "").slice(0, 80));
|
|
128
|
-
if (!proj) return json(res, 400, { error: "project required" });
|
|
129
|
-
const existing = state.tasks.filter(t => t.project === proj).length;
|
|
130
|
-
if (existing && !b.force) return json(res, 409, { error: "project already has cards here", existing });
|
|
131
|
-
const remap = new Map();
|
|
132
|
-
const added = { tasks: 0, events: 0, messages: 0, remapped: 0 };
|
|
133
|
-
const have = new Set(state.tasks.map(t => t.id));
|
|
134
|
-
for (const t of (Array.isArray(b.tasks) ? b.tasks : [])) {
|
|
135
|
-
let id = Number(t.id);
|
|
136
|
-
if (!Number.isFinite(id)) continue;
|
|
137
|
-
if (have.has(id)) { const nid = ++state.taskSeq; remap.set(id, nid); id = nid; added.remapped++; }
|
|
138
|
-
else state.taskSeq = Math.max(state.taskSeq, id);
|
|
139
|
-
state.tasks.push({ ...t, id, project: proj });
|
|
140
|
-
have.add(id); added.tasks++;
|
|
141
|
-
}
|
|
142
|
-
for (const e of (Array.isArray(b.events) ? b.events : [])) {
|
|
143
|
-
const last = state.events[state.events.length - 1];
|
|
144
|
-
// Spread the incoming event FIRST, then stamp OUR id and project over it. The incoming `id`
|
|
145
|
-
// belongs to the other hub's log and must not survive in any form: carried into the payload
|
|
146
|
-
// it comes back on load and overwrites the real row id.
|
|
147
|
-
state.eventSeq = Math.max(Number(state.eventSeq || 0), Number(last?.id) || 0) + 1;
|
|
148
|
-
const ev = { ...e, id: state.eventSeq, project: proj };
|
|
149
|
-
const taskId = ev.taskId != null ? remap.get(Number(ev.taskId)) : undefined;
|
|
150
|
-
const importedEvent = taskId === undefined ? ev : { ...ev, taskId };
|
|
151
|
-
state.events.push(importedEvent); added.events++;
|
|
152
|
-
}
|
|
153
|
-
if (state.events.length > EVENT_CAP) state.events.splice(0, state.events.length - EVENT_CAP);
|
|
154
|
-
for (const m of (Array.isArray(b.messages) ? b.messages : [])) {
|
|
155
|
-
state.messages.push({ ...m, id: ++state.seq, project: proj }); added.messages++;
|
|
156
|
-
}
|
|
157
|
-
if (state.messages.length > 5000) state.messages.splice(0, 1000);
|
|
158
|
-
markDirty();
|
|
159
|
-
appendEvent("project.adopted", proj, String(b.by || ""), { counts: added });
|
|
160
|
-
return json(res, 200, { ok: true, ...added });
|
|
161
|
-
}
|
|
162
121
|
if (req.method === "GET" && P === "/policy") {
|
|
163
122
|
return json(res, 200, overseerPolicy());
|
|
164
123
|
}
|
package/hub/routes/messages.mjs
CHANGED
|
@@ -7,7 +7,7 @@ export async function routeMessages({ req, res, q, P, auth, ctx }) {
|
|
|
7
7
|
const {
|
|
8
8
|
state, body, json, stripNulText, copyTask, crossProjectGuard, touch, pushToStreams,
|
|
9
9
|
appendEvent, appendCardEvent, appendTaskLog, markDelivered, contractsFor, canUseInboxSession, inboxWindow,
|
|
10
|
-
deliverable, inboxReadable, inboxResponse, filterReadable, canRead, streams,
|
|
10
|
+
deliverable, inboxReadable, inboxResponse, filterReadable, canRead, streams,
|
|
11
11
|
AUTH_MODE, persistHealth, duty, now, markDirty, assertNoSecrets, PEER_TTL_MS,
|
|
12
12
|
CONTRACT_WINDOW_MS, PUBLIC_URL, turnTelemetry,
|
|
13
13
|
} = ctx;
|
|
@@ -170,7 +170,7 @@ export async function routeMessages({ req, res, q, P, auth, ctx }) {
|
|
|
170
170
|
return json(res, 200, { messages: filterReadable(auth, state.messages, m => m.project || "").slice(-n) });
|
|
171
171
|
}
|
|
172
172
|
if (req.method === "GET" && (P === "/" || P === "/ui")) {
|
|
173
|
-
res.writeHead(200, { "content-type": "text/html; charset=utf-8" }); return res.end(
|
|
173
|
+
res.writeHead(200, { "content-type": "text/html; charset=utf-8" }); return res.end("<h1>Trantor</h1><p>The dashboard is the Trantor desktop app.</p>");
|
|
174
174
|
}
|
|
175
175
|
// #8723: the count is a listing in aggregate — memory rows (past PEER_TTL_MS) never count.
|
|
176
176
|
if (P === "/health") return json(res, 200, { ok: true, authMode: AUTH_MODE, peers: Object.values(state.peers).filter(v => (v.lastSeen || 0) >= now() - PEER_TTL_MS).length, messages: state.messages.length, streams: streams.length,
|
package/hub.mjs
CHANGED
|
@@ -126,11 +126,9 @@ function recordOpOutcome(res, op) {
|
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
let UI = "";
|
|
130
|
-
try { UI = readFileSync(new URL("./ui.html", import.meta.url), "utf8"); } catch {}
|
|
131
129
|
const context = {
|
|
132
130
|
...store, ...authRuntime, ...events, ...reaper, duty, overseer, derivePhases,
|
|
133
|
-
hubSend: duty.hubSend, assertNoSecrets,
|
|
131
|
+
hubSend: duty.hubSend, assertNoSecrets, AUTH_MODE, ONLINE_MS, PEER_TTL_MS,
|
|
134
132
|
REAP_GRACE_MS, CONTRACT_WINDOW_MS, PUBLIC_URL,
|
|
135
133
|
};
|
|
136
134
|
const sessionChat = createSessionRuntime({
|
|
@@ -37,7 +37,7 @@ explicit EVENT/INTERFACE CONTRACT — cross-agent bugs come from contract drift.
|
|
|
37
37
|
2. One card per package: `relay_task_add(title, assignee, difficulty, model)` — set `model`
|
|
38
38
|
to the advisor-routed model (or the CLI's default name); difficulty + model show as badges
|
|
39
39
|
on the card. Assignees: `codex:<project>` etc. Keep one for yourself.
|
|
40
|
-
3. Open the dashboard: `trantor ui` (
|
|
40
|
+
3. Open the dashboard: `trantor ui` (opens the Trantor desktop app)
|
|
41
41
|
|
|
42
42
|
## Phase 2 — fire up the crew (with the Advisor's models)
|
|
43
43
|
**Each crew card from `relay_advise` carries a `launch` spec — run it VERBATIM; never invent a
|
package/kimi.plugin.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trantor",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.139",
|
|
4
4
|
"description": "Trantor — the hub-world for AI agent crews: live message bus, presence, project Kanban/flow board + crew orchestration for independent AI coding agents (Claude, Codex, Gemini, Kimi, DeepSeek). This manifest makes Kimi Code CLI a first-class ORCHESTRATOR, mirroring .claude-plugin/plugin.json. Hooks are the CANONICAL hooks/** executed through the kimi dialect bridge (kimi/bridge.mjs) — docs/KIMI-BRIDGE-CONTRACT.md.",
|
|
5
5
|
"interface": {
|
|
6
6
|
"displayName": "Trantor",
|
package/mcp.mjs
CHANGED
|
@@ -257,14 +257,6 @@ server.tool("relay_task_check", "Tick (or untick) one checklist item on a card.
|
|
|
257
257
|
return { content: [{ type: "text", text: `card #${id} checklist: [${done !== false ? "x" : " "}] "${task.checklist[index].text}" — ${n}/${task.checklist.length} done` }] };
|
|
258
258
|
});
|
|
259
259
|
|
|
260
|
-
server.tool("relay_phase_goal", "Set a phase's goal, shown as its header in the Flow view. Set it when you plan a phase. Phase keys match relay_task_add's `phase`.",
|
|
261
|
-
{ phase: z.string().describe("the phase key (e.g. 'P5', 'Auth', 'Launch')"), goal: z.string().describe("1-2 sentences: what this phase delivers + done-criteria"), project: z.string().optional().describe("board (default: this session's project)") },
|
|
262
|
-
async ({ phase, goal, project }) => {
|
|
263
|
-
const proj = project || PROJECT;
|
|
264
|
-
await api("POST", "/phase", { project: proj, phase, goal, by: SESSION });
|
|
265
|
-
return { content: [{ type: "text", text: `phase "${phase}" goal set for ${proj}` }] };
|
|
266
|
-
});
|
|
267
|
-
|
|
268
260
|
server.tool("relay_task_move", "Move a card: todo -> doing -> testing -> done. Never go straight to done: move to 'testing' when finished, run the tests/typecheck, then 'done' only if green, else 'failed' (relay_send what broke). blocked = waiting on something external. A move to testing or done MUST carry a `note`: what changed plus the evidence (command, pass counts).",
|
|
269
261
|
{ id: z.number(), status: z.enum(["todo","doing","testing","failed","done","blocked"]), note: z.string().max(2000).optional().describe("card-log entry; REQUIRED on testing/done"), drill: z.string().max(300).optional().describe("set the drill line in this call; done is refused without one") },
|
|
270
262
|
async ({ id, status, note, drill }) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "trantor",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.139",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"trantor": "bin/cli.mjs"
|
|
@@ -19,10 +19,8 @@
|
|
|
19
19
|
"hub.mjs",
|
|
20
20
|
"hub/",
|
|
21
21
|
"mcp.mjs",
|
|
22
|
-
"ui.html",
|
|
23
22
|
"bin/",
|
|
24
23
|
"hooks/",
|
|
25
|
-
"mods/",
|
|
26
24
|
"lib/",
|
|
27
25
|
"skills/",
|
|
28
26
|
"deploy/",
|
package/bin/relay-watch.mjs
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// relay-watch streams the bus and lists live peer status.
|
|
3
|
-
// Run `node bin/relay-watch.mjs [session]`; the default watches every session.
|
|
4
|
-
import { resolveProject, hostId, resolveHub } from "../lib/project.mjs";
|
|
5
|
-
import { loadOrCreate } from "../lib/identity.mjs";
|
|
6
|
-
import { sfetch, sfetchJson } from "../lib/signed-fetch.mjs";
|
|
7
|
-
|
|
8
|
-
const PROJECT = resolveProject(process.cwd());
|
|
9
|
-
const ME = process.env.RELAY_SESSION
|
|
10
|
-
|| (process.env.RELAY_AGENT ? `${process.env.RELAY_AGENT}:${PROJECT}` : `${hostId()}:${PROJECT}`);
|
|
11
|
-
const identity = loadOrCreate(ME, "agent");
|
|
12
|
-
const URL_BASE = resolveHub(PROJECT);
|
|
13
|
-
const SESSION = process.argv[2] || "all";
|
|
14
|
-
const t = () => new Date().toLocaleTimeString();
|
|
15
|
-
|
|
16
|
-
async function showPeers() {
|
|
17
|
-
try {
|
|
18
|
-
const { peers } = await (await sfetchJson(`${URL_BASE}/peers`, { method: "GET", identity })).json();
|
|
19
|
-
const live = peers.filter(p => p.online);
|
|
20
|
-
console.log(`\n live sessions (${live.length}):`);
|
|
21
|
-
for (const p of live) console.log(` 🟢 ${p.session}${p.machine ? ` [${p.machine}]` : ""}${p.status ? ` — ${p.status}` : ""}`);
|
|
22
|
-
console.log("");
|
|
23
|
-
} catch {}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
async function watch() {
|
|
27
|
-
console.log(`relay-watch → ${URL_BASE} (watching "${SESSION}") — Ctrl-C to stop`);
|
|
28
|
-
await showPeers();
|
|
29
|
-
for (;;) {
|
|
30
|
-
try {
|
|
31
|
-
const r = await sfetch(`${URL_BASE}/stream?session=${encodeURIComponent(SESSION)}`, { headers: { accept: "text/event-stream" } }, identity);
|
|
32
|
-
if (!r.ok || !r.body) throw new Error(`stream ${r.status}`);
|
|
33
|
-
let buf = "";
|
|
34
|
-
const dec = new TextDecoder();
|
|
35
|
-
for await (const chunk of r.body) {
|
|
36
|
-
buf += dec.decode(chunk, { stream: true });
|
|
37
|
-
let i;
|
|
38
|
-
while ((i = buf.indexOf("\n\n")) >= 0) {
|
|
39
|
-
const frame = buf.slice(0, i); buf = buf.slice(i + 2);
|
|
40
|
-
for (const line of frame.split("\n")) {
|
|
41
|
-
if (!line.startsWith("data:")) continue;
|
|
42
|
-
try { const m = JSON.parse(line.slice(5).trim()); console.log(` [${t()}] ${m.from} → ${m.to}: ${m.text}`); } catch {}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
} catch (e) {
|
|
47
|
-
console.error(` (stream dropped: ${e?.message || e} — reconnecting in 2s)`);
|
|
48
|
-
await new Promise(r => setTimeout(r, 2000));
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
watch();
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
# agent-bus for Codex CLI — add to ~/.codex/config.toml
|
|
2
|
-
# Loading this MCP auto-registers the Codex session on the bus + gives the relay_* tools.
|
|
3
|
-
[mcp_servers.relay]
|
|
4
|
-
command = "node"
|
|
5
|
-
args = ["REPLACE/WITH/ABSOLUTE/PATH/agent-bus/mcp.mjs"]
|
|
6
|
-
env = { RELAY_URL = "http://127.0.0.1:4477", RELAY_SESSION = "codex:myproject" }
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"//": "trantor for Gemini CLI — merge into ~/.gemini/settings.json (or a project .gemini/settings.json).",
|
|
3
|
-
"mcpServers": {
|
|
4
|
-
"relay": {
|
|
5
|
-
"command": "node",
|
|
6
|
-
"args": ["REPLACE/WITH/ABSOLUTE/PATH/trantor/mcp.mjs"],
|
|
7
|
-
"env": { "RELAY_URL": "http://127.0.0.1:4477", "RELAY_SESSION": "gemini:myproject" }
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
}
|
|
Binary file
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
// Pure helpers for the trantor-band pilot mod (#12091). No I/O and no Node imports on purpose:
|
|
2
|
-
// the mod runs in Claude Code's sandboxed module environment, and the tests import this file directly.
|
|
3
|
-
|
|
4
|
-
// The session id comes from Claude Code, but it names a file, so keep it to a safe alphabet.
|
|
5
|
-
export function safeId(id) {
|
|
6
|
-
return String(id ?? "").replace(/[^A-Za-z0-9_.-]/g, "_").slice(0, 120);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
// Context fill as a fraction, from $.session.usage().context. Null until the first API response.
|
|
10
|
-
export function contextFraction(context) {
|
|
11
|
-
const tokens = Number(context?.tokens);
|
|
12
|
-
const window = Number(context?.window);
|
|
13
|
-
if (context?.tokens == null || !Number.isFinite(tokens) || !Number.isFinite(window) || window <= 0 || tokens < 0) return null;
|
|
14
|
-
return Math.min(1, tokens / window);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function contextPercent(context) {
|
|
18
|
-
const frac = contextFraction(context);
|
|
19
|
-
return frac === null ? null : Math.round(frac * 100);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// The file the pilot leaves for Trantor's own code to read later.
|
|
23
|
-
export function contextRecord(context, ts) {
|
|
24
|
-
const frac = contextFraction(context);
|
|
25
|
-
if (frac === null) return null;
|
|
26
|
-
return { ts, tokens: Number(context.tokens), window: Number(context.window), frac: Math.round(frac * 10000) / 10000 };
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// The project id a checkout records in .trantor/project.json, mirroring lib/project.mjs readProjectId.
|
|
30
|
-
export function projectFromMarker(text) {
|
|
31
|
-
try {
|
|
32
|
-
const id = JSON.parse(text)?.id;
|
|
33
|
-
return /^[A-Za-z0-9][A-Za-z0-9_.-]{0,79}$/.test(String(id ?? "")) && !String(id).includes("..") ? String(id) : "";
|
|
34
|
-
} catch { return ""; }
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function basename(path) {
|
|
38
|
-
return String(path ?? "").replace(/\/+$/, "").split("/").pop() || "";
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// The newest <project>-<unix seconds>.json among a directory listing, or "" (the name handoff.mjs writes).
|
|
42
|
-
export function newestHandoffName(names, project) {
|
|
43
|
-
if (!project) return "";
|
|
44
|
-
const prefix = `${project}-`;
|
|
45
|
-
let best = "";
|
|
46
|
-
let bestTs = -1;
|
|
47
|
-
for (const name of names || []) {
|
|
48
|
-
if (!name.startsWith(prefix)) continue;
|
|
49
|
-
const rest = name.slice(prefix.length);
|
|
50
|
-
if (!/^\d+\.json$/.test(rest)) continue;
|
|
51
|
-
const ts = Number(rest.slice(0, -5));
|
|
52
|
-
if (ts > bestTs) { bestTs = ts; best = name; }
|
|
53
|
-
}
|
|
54
|
-
return best;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// "pending" (written, nobody has it), "claimed" (a fresh session holds an unexpired claim), or ""
|
|
58
|
-
// when it is consumed or unreadable. Mirrors hooks/lib/handoff-claims.mjs: consumed, claim.expiresAt.
|
|
59
|
-
export function handoffState(text, nowSeconds) {
|
|
60
|
-
let record;
|
|
61
|
-
try { record = JSON.parse(text); } catch { return ""; }
|
|
62
|
-
if (!record || record.consumed) return "";
|
|
63
|
-
return Number(record.claim?.expiresAt) > nowSeconds ? "claimed" : "pending";
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// The band's one line. Parts that are unknown are left out; an empty result means draw nothing.
|
|
67
|
-
export function bandText({ percent, handoff }) {
|
|
68
|
-
const parts = [];
|
|
69
|
-
if (Number.isFinite(percent)) parts.push(`ctx ${percent}%`);
|
|
70
|
-
if (handoff) parts.push(`handoff ${handoff}`);
|
|
71
|
-
return parts.join(" · ");
|
|
72
|
-
}
|