@triflux/remote 10.50.2 → 10.52.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.
Files changed (134) hide show
  1. package/cto/brief.mjs +0 -20
  2. package/cto/collect.mjs +1 -200
  3. package/cto/current.schema.json +2 -23
  4. package/cto/hygiene.mjs +2 -61
  5. package/cto/lake-root.mjs +0 -56
  6. package/cto/status.mjs +5 -187
  7. package/hub/index.mjs +0 -17
  8. package/hub/team/agent-map.json +0 -1
  9. package/hub/team/agents-row-attach.py +120 -0
  10. package/hub/team/agents-row.mjs +200 -0
  11. package/hub/team/ansi.mjs +1 -35
  12. package/hub/team/backend.mjs +9 -145
  13. package/hub/team/claude-daemon-control.mjs +1 -2
  14. package/hub/team/claude-session-projection.mjs +5 -73
  15. package/hub/team/cli/commands/attach.mjs +1 -17
  16. package/hub/team/cli/commands/control.mjs +12 -38
  17. package/hub/team/cli/commands/debug.mjs +2 -39
  18. package/hub/team/cli/commands/focus.mjs +5 -31
  19. package/hub/team/cli/commands/interrupt.mjs +6 -25
  20. package/hub/team/cli/commands/kill.mjs +1 -30
  21. package/hub/team/cli/commands/list.mjs +0 -16
  22. package/hub/team/cli/commands/send.mjs +6 -26
  23. package/hub/team/cli/commands/start/index.mjs +42 -133
  24. package/hub/team/cli/commands/start/parse-args.mjs +15 -40
  25. package/hub/team/cli/commands/start/start-headless.mjs +138 -105
  26. package/hub/team/cli/commands/start/start-mux.mjs +2 -7
  27. package/hub/team/cli/commands/status.mjs +2 -57
  28. package/hub/team/cli/commands/stop.mjs +14 -19
  29. package/hub/team/cli/help.mjs +4 -5
  30. package/hub/team/cli/manifest.mjs +5 -1
  31. package/hub/team/cli/render.mjs +0 -12
  32. package/hub/team/cli/services/runtime-mode.mjs +27 -98
  33. package/hub/team/cli/services/state-store.mjs +5 -20
  34. package/hub/team/handoff.mjs +3 -34
  35. package/hub/team/headless.mjs +108 -1296
  36. package/hub/team/orchestrator.mjs +4 -30
  37. package/hub/team/pane.mjs +6 -28
  38. package/hub/team/psmux.mjs +3 -34
  39. package/hub/team/remote-session.mjs +1 -2
  40. package/hub/team/session-context.mjs +1 -1
  41. package/hub/team/session.mjs +7 -91
  42. package/hub/team/tui-core.mjs +1 -1
  43. package/hub/team/tui-viewer.mjs +11 -58
  44. package/hub/team/tui.mjs +8 -306
  45. package/hub/team/uds-orchestrator.mjs +2 -580
  46. package/hub/team/wt-manager.mjs +2 -2
  47. package/hub/workers/factory.mjs +6 -84
  48. package/hub/workers/interface.mjs +1 -7
  49. package/hub/workers/lib/jsonrpc-core.mjs +11 -0
  50. package/hub/workers/lib/jsonrpc-ws-uds.mjs +5 -8
  51. package/package.json +3 -8
  52. package/scripts/lib/agent-route-policy.mjs +143 -62
  53. package/scripts/lib/cli-claude.mjs +0 -14
  54. package/scripts/lib/env-probe.mjs +2 -131
  55. package/scripts/lib/gemini-profiles.mjs +2 -69
  56. package/scripts/lib/legacy-mcp-cleanup.mjs +283 -0
  57. package/scripts/lib/machine-profile.mjs +3 -17
  58. package/scripts/lib/mcp-filter.mjs +109 -53
  59. package/scripts/lib/mcp-guard-engine.mjs +40 -98
  60. package/scripts/lib/mcp-health.mjs +2 -2
  61. package/scripts/lib/mcp-server-catalog.mjs +2 -2
  62. package/scripts/lib/psmux-info.mjs +11 -59
  63. package/scripts/lib/skill-template.mjs +0 -245
  64. package/hub/hub-lifecycle.mjs +0 -248
  65. package/hub/pipe.mjs +0 -825
  66. package/hub/promote-penalties.mjs +0 -138
  67. package/hub/public/dashboard.html +0 -416
  68. package/hub/schema.sql +0 -209
  69. package/hub/server.mjs +0 -3048
  70. package/hub/store-adapter.mjs +0 -182
  71. package/hub/store.mjs +0 -1736
  72. package/hub/team/build-worker-prompt.mjs +0 -92
  73. package/hub/team/check-mcp-hub.mjs +0 -49
  74. package/hub/team/claude-native-bridge.mjs +0 -987
  75. package/hub/team/cli/commands/start/start-in-process.mjs +0 -50
  76. package/hub/team/cli/commands/start/start-wt.mjs +0 -86
  77. package/hub/team/cli/services/hub-client.mjs +0 -264
  78. package/hub/team/cli/services/native-control.mjs +0 -145
  79. package/hub/team/codex-review.mjs +0 -520
  80. package/hub/team/conductor-mesh-bridge.mjs +0 -122
  81. package/hub/team/conductor-registry.mjs +0 -121
  82. package/hub/team/conductor.mjs +0 -1529
  83. package/hub/team/consensus-meta.mjs +0 -176
  84. package/hub/team/cto-auto-collect.mjs +0 -115
  85. package/hub/team/cto-pull.mjs +0 -31
  86. package/hub/team/daemon-pty-tmux-bridge.mjs +0 -146
  87. package/hub/team/dashboard.mjs +0 -322
  88. package/hub/team/event-log.mjs +0 -84
  89. package/hub/team/execution-mode.mjs +0 -324
  90. package/hub/team/extract-completion-payload.mjs +0 -110
  91. package/hub/team/headless-bridge-session.mjs +0 -17
  92. package/hub/team/health-probe.mjs +0 -435
  93. package/hub/team/interactive-native-launcher.mjs +0 -119
  94. package/hub/team/interactive-native-worker.mjs +0 -80
  95. package/hub/team/interactive-tui-transport.mjs +0 -479
  96. package/hub/team/launcher-template.mjs +0 -144
  97. package/hub/team/lead-control.mjs +0 -191
  98. package/hub/team/mcp-selector.mjs +0 -145
  99. package/hub/team/native-supervisor.mjs +0 -460
  100. package/hub/team/native.mjs +0 -727
  101. package/hub/team/recovery-store.mjs +0 -149
  102. package/hub/team/remote-probe.mjs +0 -292
  103. package/hub/team/remote-watcher.mjs +0 -506
  104. package/hub/team/runtime-strategy.mjs +0 -200
  105. package/hub/team/schemas/worker-completion.json +0 -39
  106. package/hub/team/sentinel-capture.mjs +0 -127
  107. package/hub/team/session-sync.mjs +0 -316
  108. package/hub/team/swarm-cli.mjs +0 -390
  109. package/hub/team/swarm-hypervisor.mjs +0 -2206
  110. package/hub/team/swarm-intent.mjs +0 -216
  111. package/hub/team/swarm-locks.mjs +0 -335
  112. package/hub/team/swarm-planner.mjs +0 -371
  113. package/hub/team/swarm-preflight.mjs +0 -366
  114. package/hub/team/swarm-reconciler.mjs +0 -242
  115. package/hub/team/synapse-cli.mjs +0 -458
  116. package/hub/team/synapse-http.mjs +0 -311
  117. package/hub/team/synapse-registry.mjs +0 -618
  118. package/hub/team/tui-remote-adapter.mjs +0 -377
  119. package/hub/team/tui-synapse.mjs +0 -223
  120. package/hub/team/worker-completion-validator.mjs +0 -79
  121. package/hub/team/worker-sandbox.mjs +0 -125
  122. package/hub/team/worktree-lifecycle.mjs +0 -639
  123. package/hub/team/wt-templates.json +0 -43
  124. package/hub/tools.mjs +0 -900
  125. package/hub/workers/antigravity-route-worker.mjs +0 -179
  126. package/hub/workers/codex-app-server-worker.mjs +0 -1067
  127. package/hub/workers/delegator-mcp.mjs +0 -1098
  128. package/hub/workers/lib/jsonrpc-stdio.mjs +0 -204
  129. package/scripts/lib/claudemd-scanner.mjs +0 -223
  130. package/scripts/lib/context.mjs +0 -67
  131. package/scripts/lib/dynamic-route-cli.mjs +0 -107
  132. package/scripts/lib/handoff.mjs +0 -187
  133. package/scripts/lib/logger.mjs +0 -122
  134. package/scripts/lib/stealth-fetch.mjs +0 -176
@@ -1,191 +0,0 @@
1
- import { readState } from "@triflux/core/hub/state.mjs";
2
-
3
- const DEFAULT_TIMEOUT_MS = 2500;
4
- const CONTROL_COMMAND_ALIASES = Object.freeze({
5
- stop: "abort",
6
- interrupt: "abort",
7
- });
8
-
9
- export const LEAD_CONTROL_COMMANDS = Object.freeze([
10
- "pause",
11
- "resume",
12
- "abort",
13
- "reassign",
14
- ]);
15
-
16
- function resolveFetch(fetchImpl) {
17
- if (typeof fetchImpl === "function") return fetchImpl;
18
- if (typeof globalThis.fetch === "function")
19
- return globalThis.fetch.bind(globalThis);
20
- return null;
21
- }
22
-
23
- function normalizeHubBaseUrl(hubUrl) {
24
- return String(hubUrl || "")
25
- .replace(/\/+$/, "")
26
- .replace(/\/mcp$/, "");
27
- }
28
-
29
- function normalizeCommand(command) {
30
- const raw = String(command || "")
31
- .trim()
32
- .toLowerCase();
33
- if (!raw) return "";
34
- return CONTROL_COMMAND_ALIASES[raw] || raw;
35
- }
36
-
37
- function safeAbortSignal(timeoutMs) {
38
- if (typeof AbortSignal?.timeout !== "function") return undefined;
39
- return AbortSignal.timeout(timeoutMs);
40
- }
41
-
42
- function isPidAlive(pid) {
43
- const resolvedPid = Number(pid);
44
- if (!Number.isFinite(resolvedPid) || resolvedPid <= 0) return false;
45
- try {
46
- process.kill(resolvedPid, 0);
47
- return true;
48
- } catch {
49
- return false;
50
- }
51
- }
52
-
53
- function resolveHeadlessHubUrl() {
54
- const stateUrl = normalizeHubBaseUrl(readState()?.url);
55
- if (stateUrl) return stateUrl;
56
-
57
- const envHubUrl = normalizeHubBaseUrl(process.env.TFX_HUB_URL);
58
- if (envHubUrl) return envHubUrl;
59
-
60
- const envPort = Number(process.env.TFX_HUB_PORT || "27888");
61
- const port = Number.isFinite(envPort) && envPort > 0 ? envPort : 27888;
62
- return `http://127.0.0.1:${port}`;
63
- }
64
-
65
- function hasLiveHubState() {
66
- const state = readState();
67
- return !!normalizeHubBaseUrl(state?.url) && isPidAlive(state?.pid);
68
- }
69
-
70
- function toHeadlessSessionAgentId(sessionName) {
71
- const normalizedSessionName = String(sessionName || "").trim();
72
- return normalizedSessionName ? `session:${normalizedSessionName}` : "";
73
- }
74
-
75
- function safeJson(res) {
76
- return res.json().catch(() => ({}));
77
- }
78
-
79
- export async function publishLeadControl({
80
- hubUrl,
81
- fromAgent = "lead",
82
- toAgent,
83
- command,
84
- reason = "",
85
- payload = {},
86
- traceId,
87
- correlationId,
88
- ttlMs = 3600000,
89
- timeoutMs = DEFAULT_TIMEOUT_MS,
90
- fetchImpl,
91
- } = {}) {
92
- const requestFetch = resolveFetch(fetchImpl);
93
- if (!requestFetch) {
94
- return { ok: false, error: "FETCH_UNAVAILABLE" };
95
- }
96
-
97
- const hubBase = normalizeHubBaseUrl(hubUrl);
98
- if (!hubBase) {
99
- return { ok: false, error: "HUB_URL_REQUIRED" };
100
- }
101
-
102
- const targetAgent = String(toAgent || "").trim();
103
- if (!targetAgent) {
104
- return { ok: false, error: "TARGET_AGENT_REQUIRED" };
105
- }
106
-
107
- const normalizedCommand = normalizeCommand(command);
108
- if (!LEAD_CONTROL_COMMANDS.includes(normalizedCommand)) {
109
- return {
110
- ok: false,
111
- error: "INVALID_COMMAND",
112
- allowed: LEAD_CONTROL_COMMANDS,
113
- command: normalizedCommand,
114
- };
115
- }
116
-
117
- try {
118
- const res = await requestFetch(`${hubBase}/bridge/control`, {
119
- method: "POST",
120
- headers: { "Content-Type": "application/json" },
121
- body: JSON.stringify({
122
- from_agent: String(fromAgent || "lead"),
123
- to_agent: targetAgent,
124
- command: normalizedCommand,
125
- reason: String(reason || ""),
126
- payload: payload && typeof payload === "object" ? payload : {},
127
- ttl_ms: ttlMs,
128
- trace_id: traceId,
129
- correlation_id: correlationId,
130
- }),
131
- signal: safeAbortSignal(timeoutMs),
132
- });
133
-
134
- const body = await safeJson(res);
135
- return {
136
- ok: res.ok && body?.ok !== false,
137
- status: res.status,
138
- body,
139
- command: normalizedCommand,
140
- };
141
- } catch (error) {
142
- return {
143
- ok: false,
144
- error: "CONTROL_PUBLISH_FAILED",
145
- message: error?.message || "control publish failed",
146
- command: normalizedCommand,
147
- };
148
- }
149
- }
150
-
151
- export async function publishHeadlessControl(
152
- sessionName,
153
- command,
154
- targetWorker = "*",
155
- ) {
156
- const sessionAgentId = toHeadlessSessionAgentId(sessionName);
157
- if (!sessionAgentId) {
158
- return {
159
- ok: false,
160
- noop: true,
161
- error: "SESSION_NAME_REQUIRED",
162
- command: String(command || "")
163
- .trim()
164
- .toLowerCase(),
165
- };
166
- }
167
-
168
- if (!normalizeHubBaseUrl(process.env.TFX_HUB_URL) && !hasLiveHubState()) {
169
- return {
170
- ok: false,
171
- noop: true,
172
- error: "HUB_UNAVAILABLE",
173
- command: String(command || "")
174
- .trim()
175
- .toLowerCase(),
176
- };
177
- }
178
-
179
- return await publishLeadControl({
180
- hubUrl: resolveHeadlessHubUrl(),
181
- fromAgent: "lead",
182
- toAgent: sessionAgentId,
183
- command,
184
- payload: {
185
- session_name: String(sessionName || "").trim(),
186
- target_worker: String(targetWorker || "*").trim() || "*",
187
- issued_by: "lead",
188
- issued_at: Date.now(),
189
- },
190
- });
191
- }
@@ -1,145 +0,0 @@
1
- const TASK_TYPES = Object.freeze([
2
- "implement",
3
- "review",
4
- "research",
5
- "qa",
6
- "ship",
7
- "multi",
8
- "swarm",
9
- ]);
10
-
11
- const CLI_TYPES = Object.freeze(["codex", "gemini"]);
12
-
13
- export const MCP_CATALOG = Object.freeze([
14
- Object.freeze({
15
- name: "filesystem",
16
- purpose: "Read and write workspace files",
17
- taskTypes: Object.freeze(["implement", "review", "qa", "ship"]),
18
- cli: Object.freeze(["codex", "gemini"]),
19
- }),
20
- Object.freeze({
21
- name: "github",
22
- purpose: "Inspect PRs, issues, and release state",
23
- taskTypes: Object.freeze(["review", "ship"]),
24
- cli: Object.freeze(["codex"]),
25
- }),
26
- Object.freeze({
27
- name: "browser",
28
- purpose: "Research web pages and verify browser flows",
29
- taskTypes: Object.freeze(["research", "qa"]),
30
- cli: Object.freeze(["codex", "gemini"]),
31
- }),
32
- Object.freeze({
33
- name: "context7",
34
- purpose: "Fetch current SDK and API documentation",
35
- taskTypes: Object.freeze(["implement", "review", "research"]),
36
- cli: Object.freeze(["codex", "gemini"]),
37
- }),
38
- Object.freeze({
39
- name: "exa",
40
- purpose: "Search code examples and repositories",
41
- taskTypes: Object.freeze(["research", "review"]),
42
- cli: Object.freeze(["codex", "gemini"]),
43
- }),
44
- Object.freeze({
45
- name: "tavily",
46
- purpose: "Verify current external facts and search results",
47
- taskTypes: Object.freeze(["research", "qa"]),
48
- cli: Object.freeze(["gemini"]),
49
- }),
50
- Object.freeze({
51
- name: "sequential-thinking",
52
- purpose: "Structured reasoning for audits and review",
53
- taskTypes: Object.freeze(["review"]),
54
- cli: Object.freeze(["codex"]),
55
- }),
56
- Object.freeze({
57
- name: "tfx-hub",
58
- purpose: "Coordinate triflux hub, multi-agent, and swarm work",
59
- taskTypes: Object.freeze(["ship", "multi", "swarm"]),
60
- cli: Object.freeze(["codex", "gemini"]),
61
- }),
62
- ]);
63
-
64
- function uniqueStrings(values = []) {
65
- return [
66
- ...new Set(
67
- (Array.isArray(values) ? values : [])
68
- .map((value) => String(value ?? "").trim())
69
- .filter(Boolean),
70
- ),
71
- ];
72
- }
73
-
74
- function assertOneOf(label, value, allowed) {
75
- if (!allowed.includes(value)) {
76
- throw new TypeError(`${label} must be one of: ${allowed.join(", ")}`);
77
- }
78
- }
79
-
80
- export function selectMcpServers(opts = {}) {
81
- const taskType = String(opts.taskType ?? "").trim();
82
- const cli = String(opts.cli ?? "").trim();
83
- assertOneOf("taskType", taskType, TASK_TYPES);
84
- assertOneOf("cli", cli, CLI_TYPES);
85
-
86
- const allCatalogNames = MCP_CATALOG.map((server) => server.name);
87
- const available = new Set(
88
- uniqueStrings(opts.available?.length ? opts.available : allCatalogNames),
89
- );
90
- const exclude = new Set(uniqueStrings(opts.exclude));
91
- const force = uniqueStrings(opts.force);
92
-
93
- const taskMatched = MCP_CATALOG.filter((server) =>
94
- server.taskTypes.includes(taskType),
95
- );
96
- const compatible = taskMatched.filter((server) => server.cli.includes(cli));
97
- const incompatible = taskMatched.filter(
98
- (server) => !server.cli.includes(cli),
99
- );
100
-
101
- const selected = uniqueStrings([
102
- ...compatible
103
- .map((server) => server.name)
104
- .filter((name) => available.has(name) && !exclude.has(name)),
105
- ...force.filter((name) => available.has(name) && !exclude.has(name)),
106
- ]);
107
-
108
- const reasonParts = [
109
- `task=${taskType}`,
110
- `cli=${cli}`,
111
- `selected=${selected.length ? selected.join(", ") : "none"}`,
112
- ];
113
- if (incompatible.length) {
114
- reasonParts.push(
115
- `cli-filtered=${incompatible.map((server) => server.name).join(", ")}`,
116
- );
117
- }
118
- if (force.length) reasonParts.push(`forced=${force.join(", ")}`);
119
- if (exclude.size) reasonParts.push(`excluded=${[...exclude].join(", ")}`);
120
- if (opts.available?.length) {
121
- reasonParts.push(`available=${[...available].join(", ")}`);
122
- }
123
-
124
- return {
125
- selected,
126
- reason: reasonParts.join(" | "),
127
- };
128
- }
129
-
130
- export function buildMcpArgs(servers = [], cli) {
131
- const resolvedCli = String(cli ?? "").trim();
132
- assertOneOf("cli", resolvedCli, CLI_TYPES);
133
-
134
- const selected = uniqueStrings(servers);
135
- if (!selected.length) return [];
136
-
137
- if (resolvedCli === "codex") {
138
- return selected.flatMap((server) => [
139
- "-c",
140
- `mcp_servers.${server}.enabled=true`,
141
- ]);
142
- }
143
-
144
- return ["--allowed-mcp-server-names", ...selected];
145
- }