@triflux/remote 10.25.1 → 10.27.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 (45) hide show
  1. package/hub/server.mjs +21 -8
  2. package/hub/team/agent-map.json +3 -3
  3. package/hub/team/backend.mjs +3 -9
  4. package/hub/team/build-worker-prompt.mjs +33 -2
  5. package/hub/team/claude-daemon-control.mjs +911 -0
  6. package/hub/team/claude-native-bridge.mjs +244 -11
  7. package/hub/team/claude-session-projection.mjs +10 -1
  8. package/hub/team/cli/commands/start/index.mjs +3 -6
  9. package/hub/team/cli/commands/start/parse-args.mjs +10 -3
  10. package/hub/team/cli/commands/start/start-headless.mjs +50 -20
  11. package/hub/team/cli/help.mjs +1 -1
  12. package/hub/team/cli/services/runtime-mode.mjs +6 -3
  13. package/hub/team/execution-mode.mjs +27 -12
  14. package/hub/team/headless.mjs +191 -43
  15. package/hub/team/interactive-native-launcher.mjs +106 -0
  16. package/hub/team/interactive-native-worker.mjs +80 -0
  17. package/hub/team/interactive-tui-transport.mjs +465 -0
  18. package/hub/team/launcher-template.mjs +28 -6
  19. package/hub/team/native.mjs +46 -7
  20. package/hub/team/pane.mjs +0 -5
  21. package/hub/team/psmux.mjs +3 -3
  22. package/hub/team/retry-state-machine.mjs +83 -14
  23. package/hub/team/session.mjs +5 -36
  24. package/hub/team/swarm-hypervisor.mjs +63 -14
  25. package/hub/team/swarm-preflight.mjs +3 -1
  26. package/hub/team/terminal-opener.mjs +1 -1
  27. package/hub/team/tui-core.mjs +4 -0
  28. package/hub/team/tui-lite.mjs +3 -2
  29. package/hub/team/tui-viewer.mjs +4 -4
  30. package/hub/team/tui.mjs +4 -2
  31. package/hub/team/worker-sandbox.mjs +4 -0
  32. package/hub/tools.mjs +4 -1
  33. package/hub/workers/antigravity-route-worker.mjs +169 -0
  34. package/hub/workers/delegator-mcp.mjs +58 -314
  35. package/hub/workers/factory.mjs +7 -4
  36. package/hub/workers/gemini-worker.mjs +55 -306
  37. package/hub/workers/interface.mjs +2 -1
  38. package/hub/workers/worker-utils.mjs +1 -1
  39. package/package.json +1 -1
  40. package/scripts/lib/cli-codex.mjs +3 -3
  41. package/scripts/lib/cli-gemini.mjs +20 -50
  42. package/scripts/lib/keyword-rules.mjs +1 -1
  43. package/scripts/lib/mcp-gateway-health-check.mjs +159 -0
  44. package/scripts/lib/mcp-gateway-wrapper-check.mjs +35 -0
  45. package/scripts/lib/psmux-info.mjs +50 -5
@@ -0,0 +1,169 @@
1
+ // hub/workers/antigravity-route-worker.mjs — SDK-free Antigravity route worker
2
+
3
+ import { spawn } from "node:child_process";
4
+ import { existsSync } from "node:fs";
5
+ import { dirname, resolve } from "node:path";
6
+ import { fileURLToPath } from "node:url";
7
+
8
+ const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url));
9
+ const DEFAULT_TIMEOUT_MS = 15 * 60 * 1000;
10
+
11
+ function resolveCandidatePath(candidate, cwd = process.cwd()) {
12
+ if (!candidate) return null;
13
+ const normalized = String(candidate).startsWith("/")
14
+ ? String(candidate)
15
+ : resolve(cwd, String(candidate));
16
+ return existsSync(normalized) ? normalized : null;
17
+ }
18
+
19
+ function resolveRouteScript(explicitPath, cwd = process.cwd(), env = process.env) {
20
+ const candidates = [
21
+ explicitPath,
22
+ env.TFX_DELEGATOR_ROUTE_SCRIPT,
23
+ env.TFX_ROUTE_SCRIPT,
24
+ resolve(SCRIPT_DIR, "..", "..", "scripts", "tfx-route.sh"),
25
+ resolve(cwd, "scripts", "tfx-route.sh"),
26
+ ];
27
+
28
+ for (const candidate of candidates) {
29
+ const resolved = resolveCandidatePath(candidate, cwd);
30
+ if (resolved) return resolved;
31
+ }
32
+
33
+ return null;
34
+ }
35
+
36
+ function parseRouteType(stderr = "") {
37
+ const match = String(stderr).match(/type=([a-z-]+)/);
38
+ if (!match) return "antigravity";
39
+ return match[1] === "gemini" ? "antigravity" : match[1];
40
+ }
41
+
42
+ function normalizeResult(result = {}) {
43
+ const output = result.output || result.error || "";
44
+ const exitCode = result.exitCode ?? (result.ok ? 0 : 1);
45
+ return {
46
+ response: output,
47
+ output,
48
+ exitCode,
49
+ stderr: result.stderr || "",
50
+ raw: result,
51
+ };
52
+ }
53
+
54
+ export class AntigravityRouteWorker {
55
+ type = "antigravity";
56
+
57
+ constructor(options = {}) {
58
+ this.cwd = options.cwd || process.cwd();
59
+ this.env = { ...process.env, ...(options.env || {}) };
60
+ this.routeScript = resolveRouteScript(options.routeScript, this.cwd, this.env);
61
+ this.bashCommand = options.bashCommand || this.env.BASH_BIN || "bash";
62
+ this.timeoutMs =
63
+ Number.isFinite(Number(options.timeoutMs)) && Number(options.timeoutMs) > 0
64
+ ? Number(options.timeoutMs)
65
+ : DEFAULT_TIMEOUT_MS;
66
+ this.children = new Set();
67
+ }
68
+
69
+ isReady() {
70
+ return Boolean(this.routeScript);
71
+ }
72
+
73
+ async start() {}
74
+
75
+ async stop() {
76
+ for (const child of this.children) {
77
+ child.kill("SIGTERM");
78
+ }
79
+ this.children.clear();
80
+ }
81
+
82
+ async run(prompt, options = {}) {
83
+ if (!this.routeScript) {
84
+ return normalizeResult({
85
+ ok: false,
86
+ output: "tfx-route.sh 경로를 찾지 못했습니다.",
87
+ exitCode: 70,
88
+ });
89
+ }
90
+
91
+ const timeoutMs =
92
+ Number.isFinite(Number(options.timeoutMs)) && Number(options.timeoutMs) > 0
93
+ ? Number(options.timeoutMs)
94
+ : this.timeoutMs;
95
+ const timeoutSec = Math.max(1, Math.ceil(timeoutMs / 1000));
96
+ const childArgs = [
97
+ this.routeScript,
98
+ options.agentType || "executor",
99
+ String(prompt ?? ""),
100
+ options.mcpProfile || "auto",
101
+ String(timeoutSec),
102
+ ];
103
+ const childEnv = {
104
+ ...this.env,
105
+ ...(options.env || {}),
106
+ TFX_CLI_MODE: "antigravity",
107
+ };
108
+
109
+ const result = await new Promise((resolveResult) => {
110
+ const child = spawn(this.bashCommand, childArgs, {
111
+ cwd: options.cwd || this.cwd,
112
+ env: childEnv,
113
+ stdio: ["ignore", "pipe", "pipe"],
114
+ });
115
+ this.children.add(child);
116
+
117
+ let stdout = "";
118
+ let stderr = "";
119
+ const timeout = setTimeout(() => {
120
+ child.kill("SIGTERM");
121
+ }, timeoutMs);
122
+ timeout.unref?.();
123
+
124
+ child.stdout?.setEncoding("utf8");
125
+ child.stderr?.setEncoding("utf8");
126
+ child.stdout?.on("data", (chunk) => {
127
+ stdout += chunk;
128
+ });
129
+ child.stderr?.on("data", (chunk) => {
130
+ stderr += chunk;
131
+ });
132
+ child.on("close", (code, signal) => {
133
+ clearTimeout(timeout);
134
+ this.children.delete(child);
135
+ const timedOut = signal === "SIGTERM" && code === null;
136
+ resolveResult({
137
+ ok: code === 0,
138
+ output: stdout.trim() || stderr.trim(),
139
+ stderr: stderr.trim(),
140
+ exitCode: timedOut ? 124 : (code ?? 1),
141
+ providerResolved: parseRouteType(stderr),
142
+ });
143
+ });
144
+ child.on("error", (error) => {
145
+ clearTimeout(timeout);
146
+ this.children.delete(child);
147
+ resolveResult({
148
+ ok: false,
149
+ output: error.message,
150
+ stderr,
151
+ exitCode: 1,
152
+ });
153
+ });
154
+ });
155
+
156
+ return normalizeResult(result);
157
+ }
158
+
159
+ async execute(prompt, options = {}) {
160
+ const result = await this.run(prompt, options);
161
+ return {
162
+ output: result.output,
163
+ exitCode: result.exitCode,
164
+ threadId: null,
165
+ sessionKey: null,
166
+ raw: result.raw,
167
+ };
168
+ }
169
+ }