@triflux/remote 10.50.2 → 10.51.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.
- package/cto/brief.mjs +0 -12
- package/cto/collect.mjs +0 -73
- package/cto/current.schema.json +0 -4
- package/cto/status.mjs +2 -50
- package/hub/index.mjs +0 -8
- package/hub/team/agent-map.json +0 -1
- package/hub/team/ansi.mjs +1 -35
- package/hub/team/backend.mjs +9 -145
- package/hub/team/cli/commands/attach.mjs +1 -17
- package/hub/team/cli/commands/control.mjs +12 -38
- package/hub/team/cli/commands/debug.mjs +1 -37
- package/hub/team/cli/commands/focus.mjs +5 -31
- package/hub/team/cli/commands/interrupt.mjs +6 -25
- package/hub/team/cli/commands/kill.mjs +1 -30
- package/hub/team/cli/commands/list.mjs +0 -16
- package/hub/team/cli/commands/send.mjs +6 -26
- package/hub/team/cli/commands/start/index.mjs +41 -133
- package/hub/team/cli/commands/start/parse-args.mjs +15 -40
- package/hub/team/cli/commands/start/start-headless.mjs +138 -105
- package/hub/team/cli/commands/start/start-mux.mjs +0 -3
- package/hub/team/cli/commands/status.mjs +2 -57
- package/hub/team/cli/commands/stop.mjs +14 -19
- package/hub/team/cli/help.mjs +4 -5
- package/hub/team/cli/manifest.mjs +5 -1
- package/hub/team/cli/render.mjs +0 -12
- package/hub/team/cli/services/hub-client.mjs +2 -88
- package/hub/team/cli/services/runtime-mode.mjs +27 -98
- package/hub/team/handoff.mjs +3 -34
- package/hub/team/headless.mjs +13 -754
- package/hub/team/orchestrator.mjs +4 -30
- package/hub/team/pane.mjs +6 -28
- package/hub/team/psmux.mjs +0 -1
- package/hub/team/remote-session.mjs +1 -2
- package/hub/team/session.mjs +7 -91
- package/hub/team/swarm-intent.mjs +0 -198
- package/hub/team/tui-core.mjs +1 -1
- package/hub/team/tui-viewer.mjs +2 -2
- package/hub/team/tui.mjs +8 -269
- package/hub/team/wt-manager.mjs +2 -2
- package/hub/workers/factory.mjs +4 -37
- package/hub/workers/lib/jsonrpc-ws-uds.mjs +0 -2
- package/package.json +1 -1
- package/scripts/lib/agent-route-policy.mjs +162 -14
- package/scripts/lib/claudemd-scanner.mjs +2 -199
- package/scripts/lib/cli-claude.mjs +0 -2
- package/scripts/lib/context.mjs +3 -19
- package/scripts/lib/env-probe.mjs +5 -64
- package/scripts/lib/gemini-profiles.mjs +2 -69
- package/scripts/lib/machine-profile.mjs +3 -17
- package/scripts/lib/mcp-filter.mjs +109 -53
- package/scripts/lib/mcp-health.mjs +2 -2
- package/scripts/lib/mcp-server-catalog.mjs +2 -2
- package/scripts/lib/psmux-info.mjs +11 -59
- package/scripts/lib/skill-template.mjs +0 -245
- package/hub/team/build-worker-prompt.mjs +0 -92
- package/hub/team/check-mcp-hub.mjs +0 -49
- package/hub/team/claude-native-bridge.mjs +0 -987
- package/hub/team/cli/commands/start/start-in-process.mjs +0 -50
- package/hub/team/cli/commands/start/start-wt.mjs +0 -86
- package/hub/team/cli/services/native-control.mjs +0 -145
- package/hub/team/codex-review.mjs +0 -520
- package/hub/team/conductor-mesh-bridge.mjs +0 -122
- package/hub/team/conductor.mjs +0 -1529
- package/hub/team/consensus-meta.mjs +0 -176
- package/hub/team/cto-pull.mjs +0 -31
- package/hub/team/daemon-pty-tmux-bridge.mjs +0 -146
- package/hub/team/dashboard.mjs +0 -322
- package/hub/team/event-log.mjs +0 -84
- package/hub/team/execution-mode.mjs +0 -324
- package/hub/team/extract-completion-payload.mjs +0 -110
- package/hub/team/headless-bridge-session.mjs +0 -17
- package/hub/team/health-probe.mjs +0 -435
- package/hub/team/interactive-native-launcher.mjs +0 -119
- package/hub/team/interactive-native-worker.mjs +0 -80
- package/hub/team/interactive-tui-transport.mjs +0 -479
- package/hub/team/launcher-template.mjs +0 -144
- package/hub/team/mcp-selector.mjs +0 -145
- package/hub/team/native-supervisor.mjs +0 -460
- package/hub/team/native.mjs +0 -727
- package/hub/team/recovery-store.mjs +0 -149
- package/hub/team/remote-probe.mjs +0 -292
- package/hub/team/remote-watcher.mjs +0 -506
- package/hub/team/runtime-strategy.mjs +0 -200
- package/hub/team/schemas/worker-completion.json +0 -39
- package/hub/team/sentinel-capture.mjs +0 -127
- package/hub/team/swarm-cli.mjs +0 -390
- package/hub/team/swarm-hypervisor.mjs +0 -2206
- package/hub/team/swarm-locks.mjs +0 -335
- package/hub/team/swarm-planner.mjs +0 -371
- package/hub/team/swarm-preflight.mjs +0 -366
- package/hub/team/swarm-reconciler.mjs +0 -242
- package/hub/team/tui-remote-adapter.mjs +0 -377
- package/hub/team/worker-completion-validator.mjs +0 -79
- package/hub/team/worktree-lifecycle.mjs +0 -639
- package/hub/team/wt-templates.json +0 -43
- package/hub/workers/antigravity-route-worker.mjs +0 -179
- package/scripts/lib/dynamic-route-cli.mjs +0 -107
|
@@ -1,31 +1,5 @@
|
|
|
1
|
-
import { existsSync, readdirSync, readFileSync } from "node:fs";
|
|
2
|
-
import {
|
|
3
|
-
basename,
|
|
4
|
-
extname,
|
|
5
|
-
isAbsolute,
|
|
6
|
-
join,
|
|
7
|
-
relative,
|
|
8
|
-
resolve,
|
|
9
|
-
} from "node:path";
|
|
10
|
-
|
|
11
|
-
const IF_TAG_RE = /{{\s*(#if\s+([A-Za-z0-9_.-]+)|\/if)\s*}}/g;
|
|
12
|
-
const PARTIAL_RE = /{{>\s*([A-Za-z0-9_./-]+)\s*}}/g;
|
|
13
|
-
const FILE_INCLUDE_RE = /{{#include\s+([A-Za-z0-9_./-]+)\s*}}/g;
|
|
14
|
-
const VARIABLE_RE = /{{\s*([A-Za-z0-9_.-]+)\s*}}/g;
|
|
15
1
|
const FRONTMATTER_RE = /^---\r?\n(?:([\s\S]*?)\r?\n)?---\r?\n?/;
|
|
16
2
|
|
|
17
|
-
function isTruthy(value) {
|
|
18
|
-
if (typeof value === "string") return value.trim().length > 0;
|
|
19
|
-
return Boolean(value);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function normalizeVariable(context, key) {
|
|
23
|
-
if (Object.hasOwn(context, key)) return context[key];
|
|
24
|
-
const upper = key.toUpperCase();
|
|
25
|
-
if (Object.hasOwn(context, upper)) return context[upper];
|
|
26
|
-
return undefined;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
3
|
function parseBoolean(raw) {
|
|
30
4
|
if (typeof raw !== "string") return undefined;
|
|
31
5
|
if (raw === "true") return true;
|
|
@@ -120,175 +94,6 @@ function parseFrontmatterBlock(block) {
|
|
|
120
94
|
return data;
|
|
121
95
|
}
|
|
122
96
|
|
|
123
|
-
function evaluateConditionals(source, context) {
|
|
124
|
-
const matcher = new RegExp(IF_TAG_RE.source, "g");
|
|
125
|
-
|
|
126
|
-
function walk(startIndex, nested) {
|
|
127
|
-
let output = "";
|
|
128
|
-
let cursor = startIndex;
|
|
129
|
-
|
|
130
|
-
while (true) {
|
|
131
|
-
const found = matcher.exec(source);
|
|
132
|
-
if (!found) {
|
|
133
|
-
if (nested) throw new Error("Unclosed {{#if ...}} block in template");
|
|
134
|
-
output += source.slice(cursor);
|
|
135
|
-
return { output, index: source.length };
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
output += source.slice(cursor, found.index);
|
|
139
|
-
cursor = matcher.lastIndex;
|
|
140
|
-
|
|
141
|
-
const directive = found[1];
|
|
142
|
-
const flag = found[2];
|
|
143
|
-
if (directive.startsWith("#if")) {
|
|
144
|
-
const nestedResult = walk(cursor, true);
|
|
145
|
-
cursor = nestedResult.index;
|
|
146
|
-
matcher.lastIndex = cursor;
|
|
147
|
-
if (isTruthy(normalizeVariable(context, flag))) {
|
|
148
|
-
output += nestedResult.output;
|
|
149
|
-
}
|
|
150
|
-
continue;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
if (!nested) {
|
|
154
|
-
throw new Error("Unexpected {{/if}} without matching {{#if ...}}");
|
|
155
|
-
}
|
|
156
|
-
return { output, index: cursor };
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
return walk(0, false).output;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
function renderPartials(source, context, partials, options, includeStack) {
|
|
164
|
-
return source.replace(PARTIAL_RE, (_full, partialName) => {
|
|
165
|
-
const partial = partials[partialName];
|
|
166
|
-
if (partial == null) {
|
|
167
|
-
throw new Error(`Missing partial: ${partialName}`);
|
|
168
|
-
}
|
|
169
|
-
if (includeStack.includes(partialName)) {
|
|
170
|
-
const chain = [...includeStack, partialName].join(" -> ");
|
|
171
|
-
throw new Error(`Circular partial include: ${chain}`);
|
|
172
|
-
}
|
|
173
|
-
return renderWithContext(partial, context, partials, options, [
|
|
174
|
-
...includeStack,
|
|
175
|
-
partialName,
|
|
176
|
-
]);
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
function normalizeIncludeName(includeName) {
|
|
181
|
-
return includeName.replace(/\\/g, "/");
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
function resolveIncludeContent(includeName, options) {
|
|
185
|
-
const normalizedName = normalizeIncludeName(includeName);
|
|
186
|
-
if (Object.hasOwn(options.includes, normalizedName)) {
|
|
187
|
-
return options.includes[normalizedName];
|
|
188
|
-
}
|
|
189
|
-
if (!options.includeBaseDir) {
|
|
190
|
-
throw new Error(`Missing include: ${normalizedName}`);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
const baseDir = resolve(options.includeBaseDir);
|
|
194
|
-
const fullPath = resolve(baseDir, normalizedName);
|
|
195
|
-
const relativePath = relative(baseDir, fullPath);
|
|
196
|
-
const isInsideBaseDir =
|
|
197
|
-
relativePath === "" ||
|
|
198
|
-
(!relativePath.startsWith("..") && !isAbsolute(relativePath));
|
|
199
|
-
|
|
200
|
-
if (!isInsideBaseDir || !existsSync(fullPath)) {
|
|
201
|
-
throw new Error(`Missing include: ${normalizedName}`);
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
const content = readFileSync(fullPath, "utf8");
|
|
205
|
-
options.includes[normalizedName] = content;
|
|
206
|
-
return content;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
function renderFileIncludes(source, context, partials, options, includeStack) {
|
|
210
|
-
return source.replace(FILE_INCLUDE_RE, (_full, includeName) => {
|
|
211
|
-
const normalizedName = normalizeIncludeName(includeName);
|
|
212
|
-
const content = resolveIncludeContent(normalizedName, options);
|
|
213
|
-
if (includeStack.includes(normalizedName)) {
|
|
214
|
-
const chain = [...includeStack, normalizedName].join(" -> ");
|
|
215
|
-
throw new Error(`Circular template include: ${chain}`);
|
|
216
|
-
}
|
|
217
|
-
return renderWithContext(content, context, partials, options, [
|
|
218
|
-
...includeStack,
|
|
219
|
-
normalizedName,
|
|
220
|
-
]);
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
function renderVariables(source, context) {
|
|
225
|
-
return source.replace(VARIABLE_RE, (full, key) => {
|
|
226
|
-
const value = normalizeVariable(context, key);
|
|
227
|
-
if (value == null) {
|
|
228
|
-
throw new Error(`Missing template variable: ${key}`);
|
|
229
|
-
}
|
|
230
|
-
return String(value);
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
function renderWithContext(
|
|
235
|
-
source,
|
|
236
|
-
context,
|
|
237
|
-
partials,
|
|
238
|
-
options,
|
|
239
|
-
includeStack = [],
|
|
240
|
-
) {
|
|
241
|
-
const afterIf = evaluateConditionals(source, context);
|
|
242
|
-
const afterPartials = renderPartials(
|
|
243
|
-
afterIf,
|
|
244
|
-
context,
|
|
245
|
-
partials,
|
|
246
|
-
options,
|
|
247
|
-
includeStack,
|
|
248
|
-
);
|
|
249
|
-
const afterFileIncludes = renderFileIncludes(
|
|
250
|
-
afterPartials,
|
|
251
|
-
context,
|
|
252
|
-
partials,
|
|
253
|
-
options,
|
|
254
|
-
includeStack,
|
|
255
|
-
);
|
|
256
|
-
return renderVariables(afterFileIncludes, context);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
function readAllTemplateFiles(rootDir, currentDir = rootDir) {
|
|
260
|
-
if (!rootDir || !existsSync(rootDir)) return [];
|
|
261
|
-
|
|
262
|
-
const entries = readdirSync(currentDir, { withFileTypes: true }).sort(
|
|
263
|
-
(left, right) => left.name.localeCompare(right.name),
|
|
264
|
-
);
|
|
265
|
-
const files = [];
|
|
266
|
-
|
|
267
|
-
for (const entry of entries) {
|
|
268
|
-
const fullPath = join(currentDir, entry.name);
|
|
269
|
-
if (entry.isDirectory()) {
|
|
270
|
-
files.push(...readAllTemplateFiles(rootDir, fullPath));
|
|
271
|
-
continue;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
if (!entry.isFile()) continue;
|
|
275
|
-
if (!entry.name.endsWith(".md") && !entry.name.endsWith(".tmpl")) continue;
|
|
276
|
-
|
|
277
|
-
const relativePath = relative(rootDir, fullPath).replace(/\\/g, "/");
|
|
278
|
-
const content = readFileSync(fullPath, "utf8");
|
|
279
|
-
files.push({ fullPath, relativePath, content });
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
return files;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
function setPartial(partials, key, value) {
|
|
286
|
-
if (!key) return;
|
|
287
|
-
if (!Object.hasOwn(partials, key)) {
|
|
288
|
-
partials[key] = value;
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
|
|
292
97
|
export function parseFrontmatter(source) {
|
|
293
98
|
const match = source.match(FRONTMATTER_RE);
|
|
294
99
|
if (!match) return { data: {}, body: source };
|
|
@@ -297,53 +102,3 @@ export function parseFrontmatter(source) {
|
|
|
297
102
|
const body = source.slice(match[0].length);
|
|
298
103
|
return { data, body };
|
|
299
104
|
}
|
|
300
|
-
|
|
301
|
-
export function buildSkillTemplateContext({
|
|
302
|
-
frontmatter = {},
|
|
303
|
-
skillDirName = "",
|
|
304
|
-
} = {}) {
|
|
305
|
-
const context = { ...frontmatter };
|
|
306
|
-
const skillName = String(frontmatter.name || skillDirName || "").trim();
|
|
307
|
-
const skillDescription = String(frontmatter.description || "").trim();
|
|
308
|
-
|
|
309
|
-
let deep = frontmatter.DEEP ?? frontmatter.deep;
|
|
310
|
-
if (typeof deep === "string") {
|
|
311
|
-
const parsed = parseBoolean(deep.trim().toLowerCase());
|
|
312
|
-
deep = parsed ?? deep;
|
|
313
|
-
}
|
|
314
|
-
if (typeof deep !== "boolean") {
|
|
315
|
-
deep = /(^|[-_])deep($|[-_])/i.test(skillName);
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
context.SKILL_NAME = skillName;
|
|
319
|
-
context.SKILL_DESCRIPTION = skillDescription;
|
|
320
|
-
context.DEEP = deep;
|
|
321
|
-
return context;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
export function loadTemplatePartials(partialsDir) {
|
|
325
|
-
const files = readAllTemplateFiles(partialsDir);
|
|
326
|
-
const partials = {};
|
|
327
|
-
|
|
328
|
-
for (const file of files) {
|
|
329
|
-
const extension = extname(file.relativePath);
|
|
330
|
-
const withoutExt = extension
|
|
331
|
-
? file.relativePath.slice(0, -extension.length)
|
|
332
|
-
: file.relativePath;
|
|
333
|
-
const normalized = withoutExt.replace(/\\/g, "/");
|
|
334
|
-
const base = basename(normalized);
|
|
335
|
-
|
|
336
|
-
setPartial(partials, normalized, file.content);
|
|
337
|
-
setPartial(partials, base, file.content);
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
return partials;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
export function renderSkillTemplate(template, context = {}, options = {}) {
|
|
344
|
-
const { partials = {}, includes = {}, includeBaseDir = "" } = options;
|
|
345
|
-
return renderWithContext(template, context, partials, {
|
|
346
|
-
includeBaseDir,
|
|
347
|
-
includes: { ...includes },
|
|
348
|
-
});
|
|
349
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
// hub/team/build-worker-prompt.mjs — append Completion Protocol to PRD prompt (#125)
|
|
2
|
-
//
|
|
3
|
-
// swarm-hypervisor injects a Completion Protocol appendix into every worker
|
|
4
|
-
// prompt so that workers emit a sentinel-framed JSON payload conductor.mjs can
|
|
5
|
-
// reliably capture (see sentinel-capture.mjs and extract-completion-payload.mjs).
|
|
6
|
-
//
|
|
7
|
-
// Pure module — no I/O — so the appendix and merge logic can be unit-tested
|
|
8
|
-
// without spawning conductors.
|
|
9
|
-
|
|
10
|
-
import { SENTINEL_BEGIN, SENTINEL_END } from "./sentinel-capture.mjs";
|
|
11
|
-
|
|
12
|
-
function normalizeLeaseFiles(leaseFiles) {
|
|
13
|
-
if (!Array.isArray(leaseFiles)) return [];
|
|
14
|
-
return leaseFiles
|
|
15
|
-
.map((file) => (typeof file === "string" ? file.trim() : ""))
|
|
16
|
-
.filter(Boolean);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function formatLeaseFiles(leaseFiles) {
|
|
20
|
-
const normalized = normalizeLeaseFiles(leaseFiles);
|
|
21
|
-
if (normalized.length === 0) return "- (none declared)";
|
|
22
|
-
return normalized.map((file) => `- ${file}`).join("\n");
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function normalizeWorktreePath(worktreePath) {
|
|
26
|
-
return typeof worktreePath === "string" ? worktreePath.trim() : "";
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export function buildLeaseScopedAcceptanceAppendix({
|
|
30
|
-
leaseFiles = [],
|
|
31
|
-
worktreePath,
|
|
32
|
-
} = {}) {
|
|
33
|
-
const normalizedWorktreePath = normalizeWorktreePath(worktreePath);
|
|
34
|
-
const rootLine = normalizedWorktreePath
|
|
35
|
-
? `작업 루트(절대경로): ${normalizedWorktreePath} — 아래 lease 경로와 모든 상대경로는 이 루트 기준으로만 해석한다.\n`
|
|
36
|
-
: "";
|
|
37
|
-
|
|
38
|
-
return `
|
|
39
|
-
|
|
40
|
-
## Lease-scoped Acceptance / Lint Guard (자동 삽입됨)
|
|
41
|
-
${rootLine}- 위 PRD 본문의 모든 제약과 acceptance 기준은 이 appendix 이후에도 그대로 유효하다.
|
|
42
|
-
- 이 shard 의 파일 lease:
|
|
43
|
-
${formatLeaseFiles(leaseFiles)}
|
|
44
|
-
- Acceptance, lint, and format checks are scoped to files changed by this shard; if that set is unclear, use only the lease list above.
|
|
45
|
-
- Do not run repo-wide format/lint fixers such as \`biome check --write .\`, \`biome --write .\`, \`npm run lint:fix\`, or broad \`npm run lint\` to absorb unrelated drift.
|
|
46
|
-
- For Biome, use \`npx biome check <changed-files-or-lease-files>\`; add \`--write\` only when every target is a changed/leased file you intend to commit.
|
|
47
|
-
- Pre-existing lint drift outside the lease is not this shard's acceptance responsibility; report it instead of editing it.
|
|
48
|
-
`;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export const COMPLETION_PROTOCOL_APPENDIX = `
|
|
52
|
-
|
|
53
|
-
## Completion Protocol (자동 삽입됨)
|
|
54
|
-
<!-- swarm hypervisor 가 이 섹션을 worker prompt 에 자동 주입합니다.
|
|
55
|
-
PRD 작성자는 이 섹션을 수정하지 마세요.
|
|
56
|
-
상세: hub/team/build-worker-prompt.mjs / sentinel-capture.mjs (#125). -->
|
|
57
|
-
|
|
58
|
-
작업의 마지막 단계로, stdout 에 다음 형식의 완료 payload 를 정확히 한 번 출력하라:
|
|
59
|
-
|
|
60
|
-
${SENTINEL_BEGIN}
|
|
61
|
-
{"shard":"<shard name>","status":"ok","commits_made":[{"sha":"<40-char full sha>","message":"<commit msg>"}]}
|
|
62
|
-
${SENTINEL_END}
|
|
63
|
-
|
|
64
|
-
규약:
|
|
65
|
-
- 두 sentinel 마커는 각자 자기 줄에 단독으로 출력 (앞뒤 newline)
|
|
66
|
-
- 마커 사이 본문은 단일 JSON object (배열/primitive 금지)
|
|
67
|
-
- status 값은 ok | failed | blocked 중 하나
|
|
68
|
-
- payload 출력 직전 \`git log -1 --format=%H\` 로 보고할 sha 가 실재하는지 검증하라
|
|
69
|
-
- 코드 변경이 기대되는 shard 에서 변경/커밋을 못 했으면 status:failed 와 함께 reason 필드로 사유를 보고하라 — 그 경우 빈 commits_made 에 status:ok 는 금지
|
|
70
|
-
- no-op shard 는 status:ok + 빈 commits_made 배열 허용
|
|
71
|
-
- 마커 쌍은 stdout 에 정확히 한 번만 출력해야 함. 재emit 시 conductor 는 첫 BEGIN..END 한 쌍만 채택하며, 이후 stdout 은 무시한다.
|
|
72
|
-
- ${SENTINEL_BEGIN} 만 출력하고 ${SENTINEL_END} 누락 시 conductor 가 truncation 으로 명확히 reject
|
|
73
|
-
`;
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* Append the Completion Protocol section to a PRD prompt.
|
|
77
|
-
*
|
|
78
|
-
* @param {string|null|undefined} prdPrompt — original PRD body
|
|
79
|
-
* @param {{ leaseFiles?: string[], worktreePath?: string }} [opts] — shard file lease and absolute worktree root for scoped acceptance
|
|
80
|
-
* @returns {string} prompt with appendix
|
|
81
|
-
*/
|
|
82
|
-
export function buildWorkerPrompt(prdPrompt, opts = {}) {
|
|
83
|
-
const body = typeof prdPrompt === "string" ? prdPrompt : "";
|
|
84
|
-
return (
|
|
85
|
-
body +
|
|
86
|
-
buildLeaseScopedAcceptanceAppendix({
|
|
87
|
-
leaseFiles: opts.leaseFiles,
|
|
88
|
-
worktreePath: opts.worktreePath,
|
|
89
|
-
}) +
|
|
90
|
-
COMPLETION_PROTOCOL_APPENDIX
|
|
91
|
-
);
|
|
92
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
// hub/team/check-mcp-hub.mjs — health-probe L2 용 hub /health ping 체커.
|
|
2
|
-
// health-probe.mjs 의 checkMcp 로 주입되어 `mcp_initializing` state 판정에 사용.
|
|
3
|
-
// hub /health 가 200 이면 OK (MCP transport 인프라 살아있음), 그 외는 fail.
|
|
4
|
-
|
|
5
|
-
const DEFAULT_HUB_URL = "http://127.0.0.1:27888";
|
|
6
|
-
const DEFAULT_TIMEOUT_MS = 3000;
|
|
7
|
-
|
|
8
|
-
function resolveHubHealthUrl(hubUrl) {
|
|
9
|
-
const base = hubUrl || process.env.TFX_HUB_URL || DEFAULT_HUB_URL;
|
|
10
|
-
// `/mcp` suffix 제거 (triflux convention — bridge.mjs:54, hub-client.mjs,
|
|
11
|
-
// lead-control.mjs, session-sync.mjs 전부 TFX_HUB_URL 을 MCP transport URL
|
|
12
|
-
// 로 쓰고 base URL 이 필요할 때 `/mcp$` 를 strip 한다). 제거하지 않으면
|
|
13
|
-
// `.../mcp/health` 가 되어 hub 가 404 로 응답 → L2 영구 fail → heartbeat
|
|
14
|
-
// 이 지속적으로 `mcp_initializing` 로 grace — #173 Codex P2 review.
|
|
15
|
-
return base.replace(/\/mcp\/?$/, "").replace(/\/+$/, "") + "/health";
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Hub /health 기반 L2 checker factory.
|
|
20
|
-
* @param {object} [opts]
|
|
21
|
-
* @param {string} [opts.hubUrl] — override. 미지정 시 TFX_HUB_URL env 또는 default.
|
|
22
|
-
* @param {number} [opts.timeoutMs=3000] — fetch timeout (ms).
|
|
23
|
-
* @param {typeof fetch} [opts.fetchFn] — fetch 오버라이드 (테스트용).
|
|
24
|
-
* @returns {() => Promise<boolean>} — true = hub healthy, false = degraded/down/timeout.
|
|
25
|
-
*/
|
|
26
|
-
export function createHubHealthChecker(opts = {}) {
|
|
27
|
-
const url = resolveHubHealthUrl(opts.hubUrl);
|
|
28
|
-
const timeoutMs = Number.isFinite(opts.timeoutMs)
|
|
29
|
-
? opts.timeoutMs
|
|
30
|
-
: DEFAULT_TIMEOUT_MS;
|
|
31
|
-
const fetchFn = opts.fetchFn || globalThis.fetch;
|
|
32
|
-
|
|
33
|
-
return async function checkMcpHubHealth() {
|
|
34
|
-
if (typeof fetchFn !== "function") return false;
|
|
35
|
-
const controller = new AbortController();
|
|
36
|
-
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
37
|
-
try {
|
|
38
|
-
const res = await fetchFn(url, {
|
|
39
|
-
method: "GET",
|
|
40
|
-
signal: controller.signal,
|
|
41
|
-
});
|
|
42
|
-
return res.ok === true;
|
|
43
|
-
} catch {
|
|
44
|
-
return false;
|
|
45
|
-
} finally {
|
|
46
|
-
clearTimeout(timer);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
}
|