@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,176 +0,0 @@
1
- const VALID_SHAPES = new Set(["consensus", "debate", "panel"]);
2
- const VALID_ACTIONS = new Set([
3
- "merge",
4
- "FIX_FIRST",
5
- "close",
6
- "defer",
7
- "split",
8
- ]);
9
- const DEFAULT_SHAPE = "consensus";
10
-
11
- export const CONSENSUS_SHAPE_COMPLEXITY = Object.freeze({
12
- consensus: 1.0,
13
- debate: 1.2,
14
- panel: 1.4,
15
- });
16
-
17
- export const CONSENSUS_MARKDOWN_SECTIONS = Object.freeze({
18
- consensus: Object.freeze([
19
- "## 합의 결과: {topic}",
20
- "### Consensus Score",
21
- "### 합의 항목",
22
- "### disputed items",
23
- "### resolved items",
24
- "### user decision needed",
25
- "### meta judgment",
26
- ]),
27
- debate: Object.freeze([
28
- "## 토론 결과: {topic}",
29
- "### 비교 대상",
30
- "### 평가 기준",
31
- "### 합의 사항",
32
- "### 최종 추천",
33
- "### 리스크 및 완화 방안",
34
- "### meta judgment",
35
- ]),
36
- panel: Object.freeze([
37
- "## 전문가 패널 보고서: {topic}",
38
- "### 패널 구성",
39
- "### 패널 합의",
40
- "### 소수 견해",
41
- "### 핵심 추천",
42
- "### 미해결 쟁점",
43
- "### 다음 단계",
44
- "### meta judgment",
45
- ]),
46
- });
47
-
48
- function toArray(value) {
49
- if (Array.isArray(value)) return value.filter(Boolean);
50
- if (value == null) return [];
51
- return [value].filter(Boolean);
52
- }
53
-
54
- function normalizeShape(shape) {
55
- return VALID_SHAPES.has(shape) ? shape : DEFAULT_SHAPE;
56
- }
57
-
58
- function normalizeRecommendedAction(action) {
59
- return VALID_ACTIONS.has(action) ? action : "defer";
60
- }
61
-
62
- function normalizeStringList(items) {
63
- return [
64
- ...new Set(
65
- toArray(items)
66
- .map((item) => String(item).trim())
67
- .filter(Boolean),
68
- ),
69
- ];
70
- }
71
-
72
- function normalizeSeverityBucket(items) {
73
- return toArray(items).map((item) =>
74
- typeof item === "string" ? { id: item, summary: item } : { ...item },
75
- );
76
- }
77
-
78
- function buildSeverityClassification({ p1 = [], p2 = [], p3 = [] } = {}) {
79
- return {
80
- p1: normalizeSeverityBucket(p1),
81
- p2: normalizeSeverityBucket(p2),
82
- p3: normalizeSeverityBucket(p3),
83
- };
84
- }
85
-
86
- function buildConsensusVsDispute({ agreements = [], conflicts = [] } = {}) {
87
- return {
88
- agreements: toArray(agreements).map((item) =>
89
- typeof item === "string" ? { summary: item } : { ...item },
90
- ),
91
- conflicts: toArray(conflicts).map((item) =>
92
- typeof item === "string"
93
- ? { summary: item, parties: [] }
94
- : { parties: [], ...item },
95
- ),
96
- };
97
- }
98
-
99
- function inferStatus(participants) {
100
- const statuses = participants.map((participant) => participant.status);
101
- if (statuses.length === 0) return "needs_user_input";
102
- if (statuses.every((status) => status === "success")) return "complete";
103
- if (statuses.some((status) => status === "needs_user_input"))
104
- return "needs_user_input";
105
- return "partial";
106
- }
107
-
108
- export function normalizeParticipants(participants = []) {
109
- return toArray(participants).map((participant) => {
110
- if (typeof participant === "string") {
111
- return { name: participant, status: "success" };
112
- }
113
-
114
- return {
115
- name: participant?.name ?? "unknown",
116
- status: participant?.status ?? "success",
117
- ...participant,
118
- };
119
- });
120
- }
121
-
122
- export function buildMetaJudgment({
123
- severity = {},
124
- consensus = {},
125
- recommendedAction = "defer",
126
- followupIssues = [],
127
- modeSpecificMeta = {},
128
- } = {}) {
129
- return {
130
- severity_classification: buildSeverityClassification(severity),
131
- consensus_vs_dispute: buildConsensusVsDispute(consensus),
132
- recommended_action: normalizeRecommendedAction(recommendedAction),
133
- followup_issues: normalizeStringList(followupIssues),
134
- mode_specific_meta: { ...modeSpecificMeta },
135
- };
136
- }
137
-
138
- export function buildConsensusArtifactMeta({
139
- shape = DEFAULT_SHAPE,
140
- topic = "",
141
- cliSet = "triad",
142
- participants = [],
143
- status,
144
- } = {}) {
145
- const normalizedParticipants = normalizeParticipants(participants);
146
- return {
147
- mode: "consensus",
148
- shape: normalizeShape(shape),
149
- topic,
150
- cli_set: cliSet,
151
- participants: normalizedParticipants,
152
- status: status ?? inferStatus(normalizedParticipants),
153
- };
154
- }
155
-
156
- export function buildConsensusEnvelope({
157
- shape = DEFAULT_SHAPE,
158
- topic = "",
159
- cliSet = "triad",
160
- participants = [],
161
- metaJudgment = {},
162
- } = {}) {
163
- return {
164
- ...buildConsensusArtifactMeta({ shape, topic, cliSet, participants }),
165
- meta_judgment: buildMetaJudgment(metaJudgment),
166
- };
167
- }
168
-
169
- export function getShapeContract(shape = DEFAULT_SHAPE) {
170
- const normalizedShape = normalizeShape(shape);
171
- return {
172
- shape: normalizedShape,
173
- complexity: CONSENSUS_SHAPE_COMPLEXITY[normalizedShape],
174
- required_markdown_sections: CONSENSUS_MARKDOWN_SECTIONS[normalizedShape],
175
- };
176
- }
@@ -1,115 +0,0 @@
1
- import { existsSync, statSync } from "node:fs";
2
- import { join } from "node:path";
3
-
4
- import { resolveLakeRootDir } from "../../cto/lake-root.mjs";
5
- import { resolveRoleControlSnapshot } from "../lib/cto-env.mjs";
6
-
7
- const DEFAULT_DEBOUNCE_MS = 120_000;
8
-
9
- export function isCtoAutoCollectDisabled(env = process.env) {
10
- return !resolveRoleControlSnapshot(env).auto_collect_enabled;
11
- }
12
-
13
- function freshCurrentMd(projectRoot, now, debounceMs) {
14
- try {
15
- const currentMd = join(projectRoot, ".triflux", "lake", "current.md");
16
- if (!existsSync(currentMd)) return false;
17
- return now - statSync(currentMd).mtimeMs < debounceMs;
18
- } catch {
19
- return false;
20
- }
21
- }
22
-
23
- export function createCtoAutoCollector(opts = {}) {
24
- const registry = opts.registry;
25
- const runCollect = opts.runCollect;
26
- const logger = opts.logger || null;
27
- const debounceMs = Number(opts.debounceMs || DEFAULT_DEBOUNCE_MS);
28
- const now = opts.now || (() => Date.now());
29
- const env = opts.env || process.env;
30
- const lastCollectMs = opts.lastCollectMs || new Map();
31
- const inFlight = new Set();
32
-
33
- function handleSessionStarted({ sessionId, session } = {}) {
34
- if (isCtoAutoCollectDisabled(env))
35
- return { triggered: false, reason: "disabled" };
36
- if (!registry || typeof registry.querySessions !== "function") {
37
- return { triggered: false, reason: "missing-registry" };
38
- }
39
- if (typeof runCollect !== "function") {
40
- return { triggered: false, reason: "missing-runCollect" };
41
- }
42
-
43
- const cwd = typeof session?.cwd === "string" ? session.cwd : "";
44
- const worktree =
45
- typeof session?.worktreePath === "string" ? session.worktreePath : "";
46
- const projectRoot = resolveLakeRootDir(worktree || cwd);
47
- if (!projectRoot)
48
- return { triggered: false, reason: "missing-project-root" };
49
-
50
- let peers = [];
51
- try {
52
- peers = registry.querySessions({
53
- cwd,
54
- worktree,
55
- excludeSessionId: sessionId,
56
- });
57
- } catch (error) {
58
- logger?.warn?.(
59
- { sessionId, err: String(error?.message || error) },
60
- "cto.auto_collect.query_failed",
61
- );
62
- // peer 조회 실패는 collect 를 막지 않는다 — peer 정보는 이제 라벨 용도뿐이라
63
- // registry 일시 장애에도 solo 로 진행해 collect 회복력을 유지한다.
64
- peers = [];
65
- }
66
- // 단일 세션(peer 0개)도 허용한다 — 사용자 선택. peer 유무와 무관하게
67
- // 아래 debounce + fresh-lake 게이트가 collect 빈도를 제어한다.
68
- //
69
- // 주의: peerCount 는 best-effort 라벨이다. querySessions 는 raw
70
- // cwd/worktreePath 로 매칭하지만 projectRoot 는 resolved git toplevel 이라,
71
- // 같은 repo 의 다른 하위 폴더 세션은 peer 로 안 잡혀 triggered-solo 로 보고될
72
- // 수 있다. 즉 라벨은 repo-scoped 가 아니라 exact-cwd-scoped 다 — 향후 peer
73
- // 기반 로직을 이 라벨 위에 다시 올릴 때 주의한다.
74
- const peerCount = Array.isArray(peers) ? peers.length : 0;
75
-
76
- const currentTime = now();
77
- const last = lastCollectMs.get(projectRoot) || 0;
78
- if (currentTime - last < debounceMs) {
79
- return { triggered: false, reason: "debounced" };
80
- }
81
- if (freshCurrentMd(projectRoot, currentTime, debounceMs)) {
82
- lastCollectMs.set(projectRoot, currentTime);
83
- return { triggered: false, reason: "fresh-lake" };
84
- }
85
-
86
- lastCollectMs.set(projectRoot, currentTime);
87
- const promise = Promise.resolve()
88
- .then(() => runCollect([], { rootDir: projectRoot }))
89
- .catch((error) => {
90
- logger?.warn?.(
91
- { projectRoot, err: String(error?.message || error) },
92
- "cto.auto_collect.failed",
93
- );
94
- })
95
- .finally(() => {
96
- inFlight.delete(promise);
97
- });
98
- inFlight.add(promise);
99
- return {
100
- triggered: true,
101
- reason: peerCount > 0 ? "triggered" : "triggered-solo",
102
- projectRoot,
103
- peerCount,
104
- };
105
- }
106
-
107
- async function drain() {
108
- await Promise.allSettled([...inFlight]);
109
- }
110
-
111
- return Object.freeze({
112
- handleSessionStarted,
113
- drain,
114
- });
115
- }
@@ -1,31 +0,0 @@
1
- import { readFileSync } from "node:fs";
2
- import { join } from "node:path";
3
-
4
- import { resolveRoleControlSnapshot } from "../lib/cto-env.mjs";
5
-
6
- function defaultLakeRoot() {
7
- return join(process.cwd(), ".triflux", "lake");
8
- }
9
-
10
- /**
11
- * Read the CTO north-star lake snapshot without affecting runtime control flow.
12
- * @param {object} [opts]
13
- * @param {string} [opts.lakeRoot] Directory containing current.json.
14
- * @param {object} [opts.env] Environment values used for the CTO kill-switch.
15
- * @returns {object|null}
16
- */
17
- export function readCtoSnapshot(opts = {}) {
18
- if (!resolveRoleControlSnapshot(opts.env).north_star_enabled) return null;
19
- try {
20
- const lakeRoot = opts.lakeRoot || defaultLakeRoot();
21
- const parsed = JSON.parse(
22
- readFileSync(join(lakeRoot, "current.json"), "utf8"),
23
- );
24
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
25
- return null;
26
- }
27
- return parsed;
28
- } catch {
29
- return null;
30
- }
31
- }
@@ -1,146 +0,0 @@
1
- import { pathToFileURL } from "node:url";
2
-
3
- import { createInteractiveTuiTransport } from "./interactive-tui-transport.mjs";
4
-
5
- const DEFAULT_COLS = 120;
6
- const DEFAULT_ROWS = 40;
7
- const SIGNAL_EXIT_CODES = new Map([
8
- ["SIGHUP", 129],
9
- ["SIGINT", 130],
10
- ["SIGTERM", 143],
11
- ]);
12
-
13
- export function encodeBridgeConfig(config) {
14
- return Buffer.from(JSON.stringify(config), "utf8").toString("base64");
15
- }
16
-
17
- export function parseBridgeConfig(argv = []) {
18
- const index = argv.indexOf("--config");
19
- if (index < 0 || !argv[index + 1]) {
20
- throw new Error("--config <base64-json> is required");
21
- }
22
- return JSON.parse(Buffer.from(argv[index + 1], "base64").toString("utf8"));
23
- }
24
-
25
- export async function runBridge({
26
- config,
27
- stdin,
28
- stdout,
29
- signals,
30
- createTransport = createInteractiveTuiTransport,
31
- } = {}) {
32
- if (!config?.sessionName) throw new Error("config.sessionName is required");
33
- if (!stdin) throw new Error("stdin is required");
34
- if (!stdout) throw new Error("stdout is required");
35
- if (!signals) throw new Error("signals is required");
36
-
37
- const transport = createTransport({
38
- sessionName: config.sessionName,
39
- cwd: config.cwd,
40
- launchCmd: config.launchCmd,
41
- env: config.env || {},
42
- onData: (chunk) => stdout.write(chunk),
43
- });
44
- let shutdownPromise = null;
45
-
46
- const currentSize = () => ({
47
- cols: stdout.columns || config.cols || DEFAULT_COLS,
48
- rows: stdout.rows || config.rows || DEFAULT_ROWS,
49
- });
50
-
51
- const shutdown = async ({ exitCode, exitProcess = false } = {}) => {
52
- if (!shutdownPromise) {
53
- shutdownPromise = (async () => {
54
- unregister();
55
- await transport.stop();
56
- })();
57
- }
58
- await shutdownPromise;
59
- if (exitProcess && typeof signals.exit === "function") {
60
- signals.exit(exitCode ?? 0);
61
- }
62
- };
63
-
64
- const writeInput = (chunk) => {
65
- void transport.writeInput(chunk).catch(() => {
66
- void shutdown({ exitCode: 1, exitProcess: true });
67
- });
68
- };
69
- const resize = () => {
70
- void transport.resize(currentSize()).catch(() => {
71
- void shutdown({ exitCode: 1, exitProcess: true });
72
- });
73
- };
74
- const stdinEnd = () => {
75
- void shutdown({ exitCode: 0, exitProcess: true });
76
- };
77
- const signalHandlers = new Map(
78
- [...SIGNAL_EXIT_CODES].map(([signal, exitCode]) => [
79
- signal,
80
- () => {
81
- void shutdown({ exitCode, exitProcess: true });
82
- },
83
- ]),
84
- );
85
- const uncaughtException = () => {
86
- void shutdown({ exitCode: 1, exitProcess: true });
87
- };
88
- const beforeExit = () => {
89
- void shutdown();
90
- };
91
- const exit = () => {
92
- void shutdown();
93
- };
94
-
95
- function unregister() {
96
- stdin.off?.("data", writeInput);
97
- stdin.off?.("end", stdinEnd);
98
- stdout.off?.("resize", resize);
99
- signals.off?.("uncaughtException", uncaughtException);
100
- signals.off?.("beforeExit", beforeExit);
101
- signals.off?.("exit", exit);
102
- for (const [signal, handler] of signalHandlers) {
103
- signals.off?.(signal, handler);
104
- }
105
- }
106
-
107
- stdin.on("data", writeInput);
108
- stdin.on("end", stdinEnd);
109
- stdout.on?.("resize", resize);
110
- signals.on?.("uncaughtException", uncaughtException);
111
- signals.on?.("beforeExit", beforeExit);
112
- signals.on?.("exit", exit);
113
- for (const [signal, handler] of signalHandlers) {
114
- signals.on?.(signal, handler);
115
- }
116
-
117
- try {
118
- await transport.start();
119
- await transport.resize(currentSize());
120
- } catch (error) {
121
- await shutdown().catch(() => {});
122
- throw error;
123
- }
124
-
125
- return { shutdown };
126
- }
127
-
128
- async function main() {
129
- const config = parseBridgeConfig(process.argv.slice(2));
130
- await runBridge({
131
- config,
132
- stdin: process.stdin,
133
- stdout: process.stdout,
134
- signals: process,
135
- });
136
- }
137
-
138
- if (
139
- process.argv[1] &&
140
- import.meta.url === pathToFileURL(process.argv[1]).href
141
- ) {
142
- main().catch((error) => {
143
- console.error(error?.stack || error?.message || String(error));
144
- process.exit(1);
145
- });
146
- }