@triflux/remote 10.44.0 → 10.45.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 (39) hide show
  1. package/hub/pipe.mjs +10 -15
  2. package/hub/schema.sql +1 -0
  3. package/hub/server.mjs +172 -93
  4. package/hub/store.mjs +127 -61
  5. package/hub/team/backend.mjs +4 -2
  6. package/hub/team/claude-daemon-control.mjs +2 -0
  7. package/hub/team/cli/commands/start/start-headless.mjs +2 -0
  8. package/hub/team/cli/commands/start/start-mux.mjs +24 -3
  9. package/hub/team/cli/services/runtime-mode.mjs +23 -9
  10. package/hub/team/conductor.mjs +80 -24
  11. package/hub/team/cto-auto-collect.mjs +2 -6
  12. package/hub/team/cto-pull.mjs +4 -0
  13. package/hub/team/dashboard-open.mjs +1 -0
  14. package/hub/team/execution-mode.mjs +38 -2
  15. package/hub/team/headless.mjs +493 -82
  16. package/hub/team/interactive-tui-transport.mjs +15 -1
  17. package/hub/team/launcher-template.mjs +17 -1
  18. package/hub/team/orchestrator.mjs +36 -9
  19. package/hub/team/pane.mjs +176 -14
  20. package/hub/team/psmux.mjs +79 -70
  21. package/hub/team/retry-state-machine.mjs +39 -16
  22. package/hub/team/session.mjs +57 -0
  23. package/hub/team/synapse-http.mjs +149 -4
  24. package/hub/team/terminal-opener.mjs +68 -13
  25. package/hub/team/tui-viewer.mjs +65 -14
  26. package/hub/tools.mjs +10 -1
  27. package/hub/workers/codex-mcp.mjs +8 -3
  28. package/hub/workers/delegator-mcp.mjs +1 -1
  29. package/package.json +1 -1
  30. package/scripts/lib/agent-route-policy.mjs +84 -24
  31. package/scripts/lib/cli-agy.mjs +24 -4
  32. package/scripts/lib/cli-codex.mjs +2 -0
  33. package/scripts/lib/codex-profile-config.mjs +26 -8
  34. package/scripts/lib/codex-recovery.sh +19 -0
  35. package/scripts/lib/gemini-profiles.mjs +113 -29
  36. package/scripts/lib/keyword-rules.mjs +12 -0
  37. package/scripts/lib/logger.mjs +60 -43
  38. package/scripts/lib/machine-profile.mjs +293 -0
  39. package/scripts/lib/mcp-health.mjs +44 -18
@@ -2,16 +2,12 @@ import { existsSync, statSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
 
4
4
  import { resolveLakeRootDir } from "../../cto/lake-root.mjs";
5
+ import { resolveRoleControlSnapshot } from "@triflux/core/hub/lib/cto-env.mjs";
5
6
 
6
7
  const DEFAULT_DEBOUNCE_MS = 120_000;
7
- const OFF_VALUES = new Set(["0", "false", "off", "no"]);
8
8
 
9
9
  export function isCtoAutoCollectDisabled(env = process.env) {
10
- return OFF_VALUES.has(
11
- String(env?.TFX_CTO_AUTO_COLLECT ?? "")
12
- .trim()
13
- .toLowerCase(),
14
- );
10
+ return !resolveRoleControlSnapshot(env).auto_collect_enabled;
15
11
  }
16
12
 
17
13
  function freshCurrentMd(projectRoot, now, debounceMs) {
@@ -1,6 +1,8 @@
1
1
  import { readFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
 
4
+ import { resolveRoleControlSnapshot } from "@triflux/core/hub/lib/cto-env.mjs";
5
+
4
6
  function defaultLakeRoot() {
5
7
  return join(process.cwd(), ".triflux", "lake");
6
8
  }
@@ -9,9 +11,11 @@ function defaultLakeRoot() {
9
11
  * Read the CTO north-star lake snapshot without affecting runtime control flow.
10
12
  * @param {object} [opts]
11
13
  * @param {string} [opts.lakeRoot] Directory containing current.json.
14
+ * @param {object} [opts.env] Environment values used for the CTO kill-switch.
12
15
  * @returns {object|null}
13
16
  */
14
17
  export function readCtoSnapshot(opts = {}) {
18
+ if (!resolveRoleControlSnapshot(opts.env).north_star_enabled) return null;
15
19
  try {
16
20
  const lakeRoot = opts.lakeRoot || defaultLakeRoot();
17
21
  const parsed = JSON.parse(
@@ -47,6 +47,7 @@ export async function openHeadlessDashboardTarget(sessionName, opts = {}) {
47
47
  title: title || `▲ ${safeSession}`,
48
48
  cwd,
49
49
  profile: opts.profile ?? "triflux",
50
+ targetPane: opts.targetPane,
50
51
  });
51
52
  return await opened;
52
53
  } catch {
@@ -4,6 +4,15 @@ import { existsSync, readFileSync } from "node:fs";
4
4
  import { dirname, resolve as pathResolve } from "node:path";
5
5
  import { resolveNestedCodexAgentProfile } from "../../scripts/lib/cli-codex.mjs";
6
6
  import { codexProfileConfigOverrides } from "../../scripts/lib/codex-profile-config.mjs";
7
+ import {
8
+ resolveGeminiModel,
9
+ resolveGeminiProfileForPurpose,
10
+ } from "../../scripts/lib/gemini-profiles.mjs";
11
+ import {
12
+ buildDisabledCliError,
13
+ normalizeCliName,
14
+ resolveCliPolicy,
15
+ } from "../../scripts/lib/machine-profile.mjs";
7
16
  import { whichCommand } from "@triflux/core/hub/platform.mjs";
8
17
 
9
18
  const WIN32_EXT_PRECEDENCE = [".cmd", ".exe", ".bat", ".ps1"];
@@ -96,6 +105,19 @@ export function resolveCliExecutable(cli, opts = {}) {
96
105
 
97
106
  export function buildSpawnSpecForMode(mode, opts = {}) {
98
107
  const cli = normalizeCli(opts.cli || "codex");
108
+
109
+ // TFX_DISABLE_* SSOT 집행. route 를 우회하는 spawn 경로도 tfx-route.sh 와 같은
110
+ // 정책을 따른다. 정책 판독은 런타임 process.env 와 machine profile 만 쓰고,
111
+ // 자식에게 넘길 세션 env(opts.env)는 쓰지 않는다. 주입 시임은 opts.cliPolicy
112
+ // (계산된 정책)와 opts.policyEnv(env 객체) 둘뿐이다.
113
+ // claude 처럼 정책 대상이 아닌 CLI 는 프로파일 파일을 읽지 않는다.
114
+ if (normalizeCliName(cli)) {
115
+ const cliPolicy =
116
+ opts.cliPolicy ?? resolveCliPolicy(opts.policyEnv ?? process.env);
117
+ const blockedCli = buildDisabledCliError(cli, cliPolicy);
118
+ if (blockedCli) throw blockedCli;
119
+ }
120
+
99
121
  const prompt = asPrompt(opts.prompt);
100
122
  const commandName = cli === "antigravity" ? "agy" : cli;
101
123
  const resolvedCommand = resolveCliExecutable(commandName, opts);
@@ -126,12 +148,26 @@ export function buildSpawnSpecForMode(mode, opts = {}) {
126
148
  };
127
149
 
128
150
  if (cli === "antigravity") {
129
- const args = ["--print", "--dangerously-skip-permissions"];
151
+ // agy 1.1.27: --print 는 값(프롬프트)을 받는 마지막 인자다. stdin 프롬프트는
152
+ // "empty prompt" 로 거부되므로 argv 로 넘긴다.
153
+ // effort 는 역할별 SSOT(scripts/lib/gemini-profiles.mjs). 명시 model 이 우선한다.
154
+ const model =
155
+ typeof opts.model === "string" && opts.model.trim()
156
+ ? resolveGeminiModel(opts.model.trim(), {
157
+ profilesPath: opts.geminiProfilesPath,
158
+ })
159
+ : resolveGeminiModel(
160
+ resolveGeminiProfileForPurpose(opts.role || opts.agent),
161
+ { profilesPath: opts.geminiProfilesPath },
162
+ );
163
+ const args = ["--dangerously-skip-permissions"];
164
+ if (model) args.push("--model", model);
165
+ args.push("--print", prompt);
130
166
  return {
131
167
  ...wrap(args),
132
168
  useExec: true,
133
169
  shell: false,
134
- stdinPrompt: prompt.length > 0,
170
+ stdinPrompt: false,
135
171
  prompt,
136
172
  };
137
173
  }