triflux 10.43.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.
- package/README.md +3 -1
- package/adapters/codex/skills/tfx-harness/SKILL.md +66 -0
- package/adapters/codex/skills/tfx-harness/skill.json +5 -0
- package/bin/tfx-live.mjs +752 -77
- package/bin/triflux.mjs +20 -3
- package/hooks/codex-session-hook.mjs +67 -1
- package/hooks/cto-north-star-brief.mjs +3 -16
- package/hooks/error-context.mjs +3 -6
- package/hooks/hook-manager.mjs +1 -1
- package/hooks/hook-registry.json +0 -11
- package/hooks/keyword-rules.json +147 -23
- package/hooks/permission-safe-allow.mjs +36 -2
- package/hooks/session-start-fast.mjs +50 -1
- package/hooks/session-start-lake.mjs +3 -16
- package/hub/bridge.mjs +111 -5
- package/hub/cli-adapter-base.mjs +11 -2
- package/hub/codex-adapter.mjs +3 -0
- package/hub/gemini-adapter.mjs +29 -11
- package/hub/intent.mjs +24 -32
- package/hub/lib/memory-store.mjs +66 -30
- package/hub/lib/tfx-route-args.mjs +41 -4
- package/hub/pipe.mjs +10 -15
- package/hub/reflexion.mjs +0 -57
- package/hub/router.mjs +474 -24
- package/hub/schema.sql +62 -2
- package/hub/server.mjs +214 -93
- package/hub/store.mjs +682 -37
- package/hub/team/backend.mjs +4 -2
- package/hub/team/claude-daemon-control.mjs +2 -0
- package/hub/team/cli/commands/start/start-headless.mjs +2 -0
- package/hub/team/cli/commands/start/start-mux.mjs +24 -3
- package/hub/team/cli/services/runtime-mode.mjs +23 -9
- package/hub/team/codex-review.mjs +2 -3
- package/hub/team/conductor.mjs +101 -24
- package/hub/team/cto-auto-collect.mjs +2 -6
- package/hub/team/cto-pull.mjs +4 -0
- package/hub/team/dashboard-open.mjs +1 -0
- package/hub/team/execution-mode.mjs +50 -4
- package/hub/team/headless.mjs +505 -78
- package/hub/team/interactive-tui-transport.mjs +15 -1
- package/hub/team/launcher-template.mjs +19 -2
- package/hub/team/orchestrator.mjs +36 -9
- package/hub/team/pane.mjs +176 -14
- package/hub/team/psmux.mjs +79 -70
- package/hub/team/retry-state-machine.mjs +41 -13
- package/hub/team/session.mjs +57 -0
- package/hub/team/swarm-hypervisor.mjs +1 -0
- package/hub/team/swarm-preflight.mjs +47 -0
- package/hub/team/synapse-http.mjs +149 -4
- package/hub/team/terminal-opener.mjs +68 -13
- package/hub/team/tui-viewer.mjs +65 -14
- package/hub/team/worktree-lifecycle.mjs +56 -59
- package/hub/tools.mjs +17 -0
- package/hub/workers/codex-mcp.mjs +52 -7
- package/hub/workers/delegator-mcp.mjs +3 -49
- package/hud/cli-policy.mjs +69 -0
- package/hud/constants.mjs +20 -17
- package/hud/context-monitor.mjs +31 -21
- package/hud/hud-qos-status.mjs +81 -91
- package/hud/providers/claude.mjs +150 -84
- package/hud/providers/codex.mjs +10 -1
- package/hud/renderers.mjs +21 -59
- package/hud/utils.mjs +1 -15
- package/package.json +2 -1
- package/scripts/__tests__/keyword-detector.test.mjs +89 -1
- package/scripts/__tests__/lint-skills.test.mjs +68 -0
- package/scripts/__tests__/release-governance.test.mjs +94 -1
- package/scripts/__tests__/skill-surface.test.mjs +6 -4
- package/scripts/__tests__/tfx-route-bash-node-parity.test.mjs +6 -4
- package/scripts/__tests__/tfx-route-node-entry.test.mjs +53 -11
- package/scripts/claude-login-detect.mjs +107 -25
- package/scripts/ensure-agy-hooks.mjs +31 -1
- package/scripts/keyword-detector.mjs +66 -9
- package/scripts/lib/agent-route-policy.mjs +367 -0
- package/scripts/lib/cli-agy.mjs +24 -4
- package/scripts/lib/cli-codex.mjs +22 -160
- package/scripts/lib/codex-profile-config.mjs +48 -4
- package/scripts/lib/codex-recovery.sh +19 -0
- package/scripts/lib/gemini-profiles.mjs +113 -29
- package/scripts/lib/keyword-rules.mjs +24 -0
- package/scripts/lib/logger.mjs +60 -43
- package/scripts/lib/machine-profile.mjs +293 -0
- package/scripts/lib/mcp-health.mjs +44 -18
- package/scripts/lint-skills.mjs +65 -0
- package/scripts/notion-read.mjs +2 -1
- package/scripts/pack.mjs +13 -0
- package/scripts/release/check-packages-mirror.mjs +58 -1
- package/scripts/release/lib.mjs +1 -2
- package/scripts/release/prepare.mjs +24 -9
- package/scripts/remote-spawn.mjs +830 -32
- package/scripts/session-stale-cleanup.mjs +0 -1
- package/scripts/setup.mjs +548 -125
- package/scripts/sync-hub-mcp-settings.mjs +11 -3
- package/scripts/test-lock.mjs +15 -1
- package/scripts/tfx-gate-activate.mjs +4 -4
- package/scripts/tfx-route-post.mjs +90 -13
- package/scripts/tfx-route.mjs +14 -1
- package/scripts/tfx-route.sh +716 -177
- package/skills/merge-worktree/SKILL.md +3 -3
- package/skills/star-prompt/skill.json +1 -1
- package/skills/tfx-analysis/SKILL.md +8 -9
- package/skills/tfx-analysis/skill.json +1 -10
- package/skills/tfx-auto/SKILL.md +203 -46
- package/skills/tfx-auto/skill.json +2 -23
- package/skills/tfx-doctor/skill.json +0 -3
- package/skills/tfx-find/skill.json +0 -7
- package/skills/tfx-forge/SKILL.md +2 -2
- package/skills/tfx-forge/skill.json +0 -7
- package/skills/tfx-goal-clarify/skill.json +5 -0
- package/skills/tfx-harness/SKILL.md +36 -70
- package/skills/tfx-harness/skill.json +5 -0
- package/skills/tfx-hooks/SKILL.md +0 -2
- package/skills/tfx-hooks/skill.json +0 -3
- package/skills/tfx-hub/SKILL.md +2 -7
- package/skills/tfx-hub/skill.json +0 -3
- package/skills/tfx-index/skill.json +0 -6
- package/skills/tfx-interview/SKILL.md +3 -3
- package/skills/tfx-interview/skill.json +1 -13
- package/skills/tfx-live/SKILL.md +22 -1
- package/skills/tfx-live/skill.json +0 -5
- package/skills/tfx-plan/SKILL.md +7 -8
- package/skills/tfx-plan/skill.json +1 -12
- package/skills/tfx-profile/SKILL.md +25 -15
- package/skills/tfx-profile/skill.json +0 -3
- package/skills/tfx-prune/SKILL.md +7 -7
- package/skills/tfx-prune/skill.json +1 -8
- package/skills/tfx-qa/SKILL.md +7 -7
- package/skills/tfx-qa/skill.json +1 -11
- package/skills/tfx-ralph/SKILL.md +8 -11
- package/skills/tfx-remote/SKILL.md +2 -2
- package/skills/tfx-remote/skill.json +0 -3
- package/skills/tfx-research/SKILL.md +2 -2
- package/skills/tfx-research/skill.json +1 -16
- package/skills/tfx-review/SKILL.md +11 -11
- package/skills/tfx-review/skill.json +1 -11
- package/skills/tfx-setup/SKILL.md +5 -6
- package/skills/tfx-setup/skill.json +0 -3
- package/skills/tfx-ship/skill.json +1 -9
- package/skills/tfx-wt/skill.json +0 -7
- package/tui/codex-profile.mjs +13 -3
- package/tui/gemini-profile.mjs +11 -24
- package/tui/monitor.mjs +1 -0
- package/tui/setup.mjs +3 -1
- package/scripts/headless-guard-fast.sh +0 -29
- package/scripts/headless-guard.mjs +0 -523
- package/skills/tfx-autopilot/SKILL.md +0 -51
- package/skills/tfx-autopilot/skill.json +0 -12
- package/skills/tfx-codex-swarm-workspace/iteration-1/benchmark.json +0 -75
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/eval_metadata.json +0 -42
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/with_skill/grading.json +0 -39
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/with_skill/outputs/analysis.md +0 -87
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/with_skill/outputs/classification.md +0 -35
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/with_skill/outputs/commands.sh +0 -275
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/with_skill/outputs/routing.md +0 -56
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/with_skill/timing.json +0 -5
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/without_skill/grading.json +0 -39
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/without_skill/outputs/analysis.md +0 -92
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/without_skill/outputs/classification.md +0 -71
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/without_skill/outputs/commands.sh +0 -264
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/without_skill/outputs/routing.md +0 -113
- package/skills/tfx-codex-swarm-workspace/iteration-1/full-swarm-all-prds/without_skill/timing.json +0 -5
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/eval_metadata.json +0 -32
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/with_skill/grading.json +0 -29
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/with_skill/outputs/analysis.md +0 -96
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/with_skill/outputs/classification.md +0 -38
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/with_skill/outputs/commands.sh +0 -151
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/with_skill/outputs/routing.md +0 -51
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/with_skill/timing.json +0 -5
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/without_skill/grading.json +0 -29
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/without_skill/outputs/analysis.md +0 -127
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/without_skill/outputs/classification.md +0 -57
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/without_skill/outputs/commands.sh +0 -129
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/without_skill/outputs/routing.md +0 -84
- package/skills/tfx-codex-swarm-workspace/iteration-1/implicit-swarm-no-keywords/without_skill/timing.json +0 -5
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/eval_metadata.json +0 -27
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/with_skill/grading.json +0 -24
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/with_skill/outputs/analysis.md +0 -98
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/with_skill/outputs/classification.md +0 -65
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/with_skill/outputs/commands.sh +0 -123
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/with_skill/outputs/routing.md +0 -66
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/with_skill/timing.json +0 -5
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/without_skill/grading.json +0 -20
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/without_skill/outputs/analysis.md +0 -88
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/without_skill/outputs/classification.md +0 -40
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/without_skill/outputs/commands.sh +0 -130
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/without_skill/outputs/routing.md +0 -61
- package/skills/tfx-codex-swarm-workspace/iteration-1/selective-spawn-with-override/without_skill/timing.json +0 -5
- package/skills/tfx-consensus/SKILL.md +0 -56
- package/skills/tfx-consensus/skill.json +0 -8
- package/skills/tfx-debate/SKILL.md +0 -60
- package/skills/tfx-debate/skill.json +0 -14
- package/skills/tfx-fullcycle/SKILL.md +0 -47
- package/skills/tfx-fullcycle/skill.json +0 -13
- package/skills/tfx-multi/SKILL.md +0 -45
- package/skills/tfx-multi/references/agent-wrapper-rules.md +0 -94
- package/skills/tfx-multi/references/thorough-pipeline.md +0 -105
- package/skills/tfx-multi/skill.json +0 -10
- package/skills/tfx-panel/SKILL.md +0 -60
- package/skills/tfx-panel/skill.json +0 -14
- package/skills/tfx-persist/SKILL.md +0 -63
- package/skills/tfx-persist/skill.json +0 -14
- package/skills/tfx-psmux-rules/SKILL.md +0 -41
- package/skills/tfx-psmux-rules/skill.json +0 -10
- package/skills/tfx-remote-setup/SKILL.md +0 -42
- package/skills/tfx-remote-setup/skill.json +0 -10
- package/skills/tfx-remote-spawn/SKILL.md +0 -52
- package/skills/tfx-remote-spawn/skill.json +0 -10
- package/skills/tfx-swarm/SKILL.md +0 -49
- package/skills/tfx-swarm/skill.json +0 -13
|
@@ -8,11 +8,12 @@
|
|
|
8
8
|
//
|
|
9
9
|
// 기존 플래그 (Phase 2 v10.9.33+):
|
|
10
10
|
// --cli {auto|codex|antigravity|claude}
|
|
11
|
-
// --mode {quick|deep|consensus}
|
|
11
|
+
// --mode {quick|deep|consensus|live}
|
|
12
12
|
// --parallel {1|N|swarm}
|
|
13
13
|
// --retry {0|1|ralph|auto-escalate} (Phase 3 에서 ralph/auto-escalate 신규)
|
|
14
14
|
// --isolation {none|worktree}
|
|
15
15
|
// --remote {none|<host>}
|
|
16
|
+
// --rounds <N> (--mode live 전용, 기본 4)
|
|
16
17
|
//
|
|
17
18
|
// Phase 3 신규:
|
|
18
19
|
// --lead {claude|codex} (tfx-auto-codex 의미 흡수)
|
|
@@ -31,11 +32,12 @@ export const DEFAULT_OPTIONS = Object.freeze({
|
|
|
31
32
|
lead: "claude",
|
|
32
33
|
noClaudeNative: false,
|
|
33
34
|
maxIterations: 0,
|
|
35
|
+
rounds: 4,
|
|
34
36
|
});
|
|
35
37
|
|
|
36
38
|
const VALID_VALUES = Object.freeze({
|
|
37
39
|
cli: ["auto", "codex", "antigravity", "claude"],
|
|
38
|
-
mode: ["quick", "deep", "consensus"],
|
|
40
|
+
mode: ["quick", "deep", "consensus", "live"],
|
|
39
41
|
retry: ["0", "1", "ralph", "auto-escalate"],
|
|
40
42
|
isolation: ["none", "worktree"],
|
|
41
43
|
lead: ["claude", "codex"],
|
|
@@ -50,6 +52,7 @@ const VALUE_FLAGS = new Set([
|
|
|
50
52
|
"--remote",
|
|
51
53
|
"--lead",
|
|
52
54
|
"--max-iterations",
|
|
55
|
+
"--rounds",
|
|
53
56
|
]);
|
|
54
57
|
|
|
55
58
|
const BOOL_FLAGS = new Set(["--no-claude-native"]);
|
|
@@ -61,12 +64,14 @@ export function parseArgs(input) {
|
|
|
61
64
|
const opts = { ...DEFAULT_OPTIONS };
|
|
62
65
|
const warnings = [];
|
|
63
66
|
const taskTokens = [];
|
|
67
|
+
const providedFlags = new Set();
|
|
64
68
|
|
|
65
69
|
let i = 0;
|
|
66
70
|
while (i < tokens.length) {
|
|
67
71
|
const raw = tokens[i];
|
|
68
72
|
|
|
69
73
|
if (BOOL_FLAGS.has(raw)) {
|
|
74
|
+
providedFlags.add(raw);
|
|
70
75
|
applyBool(opts, raw);
|
|
71
76
|
i += 1;
|
|
72
77
|
continue;
|
|
@@ -82,6 +87,7 @@ export function parseArgs(input) {
|
|
|
82
87
|
}
|
|
83
88
|
|
|
84
89
|
if (VALUE_FLAGS.has(flag)) {
|
|
90
|
+
providedFlags.add(flag);
|
|
85
91
|
if (value === null) {
|
|
86
92
|
const next = tokens[i + 1];
|
|
87
93
|
if (next === undefined || next.startsWith("--")) {
|
|
@@ -108,7 +114,7 @@ export function parseArgs(input) {
|
|
|
108
114
|
i += 1;
|
|
109
115
|
}
|
|
110
116
|
|
|
111
|
-
validate(opts, warnings);
|
|
117
|
+
validate(opts, warnings, providedFlags);
|
|
112
118
|
|
|
113
119
|
return {
|
|
114
120
|
...opts,
|
|
@@ -196,10 +202,19 @@ function applyValue(opts, flag, value, warnings) {
|
|
|
196
202
|
}
|
|
197
203
|
break;
|
|
198
204
|
}
|
|
205
|
+
case "--rounds": {
|
|
206
|
+
const n = Number(value);
|
|
207
|
+
if (!Number.isInteger(n) || n <= 0) {
|
|
208
|
+
warnings.push(`invalid --rounds=${value}, expected positive integer`);
|
|
209
|
+
} else {
|
|
210
|
+
opts.rounds = n;
|
|
211
|
+
}
|
|
212
|
+
break;
|
|
213
|
+
}
|
|
199
214
|
}
|
|
200
215
|
}
|
|
201
216
|
|
|
202
|
-
function validate(opts, warnings) {
|
|
217
|
+
function validate(opts, warnings, providedFlags = new Set()) {
|
|
203
218
|
for (const key of Object.keys(VALID_VALUES)) {
|
|
204
219
|
if (!VALID_VALUES[key].includes(opts[key])) {
|
|
205
220
|
warnings.push(
|
|
@@ -214,6 +229,28 @@ function validate(opts, warnings) {
|
|
|
214
229
|
) {
|
|
215
230
|
warnings.push(`invalid --parallel=${opts.parallel}, expected 1|N|swarm`);
|
|
216
231
|
}
|
|
232
|
+
|
|
233
|
+
if (opts.mode === "live") {
|
|
234
|
+
const ignored = [
|
|
235
|
+
["--parallel", "parallel", DEFAULT_OPTIONS.parallel],
|
|
236
|
+
["--isolation", "isolation", DEFAULT_OPTIONS.isolation],
|
|
237
|
+
["--remote", "remote", DEFAULT_OPTIONS.remote],
|
|
238
|
+
];
|
|
239
|
+
for (const [flag, key, fallback] of ignored) {
|
|
240
|
+
if (providedFlags.has(flag)) {
|
|
241
|
+
warnings.push(`${flag} ignored with --mode live`);
|
|
242
|
+
opts[key] = fallback;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
if (providedFlags.has("--retry") && opts.retry === "ralph") {
|
|
246
|
+
warnings.push("--retry ralph ignored with --mode live");
|
|
247
|
+
opts.retry = DEFAULT_OPTIONS.retry;
|
|
248
|
+
}
|
|
249
|
+
} else if (providedFlags.has("--rounds")) {
|
|
250
|
+
warnings.push("--rounds ignored unless --mode live");
|
|
251
|
+
opts.rounds = DEFAULT_OPTIONS.rounds;
|
|
252
|
+
}
|
|
253
|
+
|
|
217
254
|
const parallelOne = opts.parallel === "1" || opts.parallel === 1;
|
|
218
255
|
if (parallelOne && opts.isolation === "worktree") {
|
|
219
256
|
warnings.push(
|
package/hub/pipe.mjs
CHANGED
|
@@ -267,18 +267,11 @@ export function createPipeServer({
|
|
|
267
267
|
const result = router.refreshAgentLease(
|
|
268
268
|
agentId,
|
|
269
269
|
payload.heartbeat_ttl_ms || heartbeatTtlMs,
|
|
270
|
+
payload.presence_generation,
|
|
271
|
+
payload,
|
|
270
272
|
);
|
|
271
273
|
if (client) touchClient(client);
|
|
272
|
-
|
|
273
|
-
return {
|
|
274
|
-
ok: false,
|
|
275
|
-
error: {
|
|
276
|
-
code: "AGENT_NOT_FOUND",
|
|
277
|
-
message: `heartbeat target not registered: ${agentId}`,
|
|
278
|
-
},
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
|
-
return { ok: true, data: result };
|
|
274
|
+
return result;
|
|
282
275
|
}
|
|
283
276
|
|
|
284
277
|
case "publish": {
|
|
@@ -357,12 +350,14 @@ export function createPipeServer({
|
|
|
357
350
|
|
|
358
351
|
case "deregister": {
|
|
359
352
|
const agentId = resolveAgentId(client, payload);
|
|
360
|
-
router.
|
|
353
|
+
const result = router.transitionAgentStatus(
|
|
354
|
+
agentId,
|
|
355
|
+
"offline",
|
|
356
|
+
payload.presence_generation,
|
|
357
|
+
payload,
|
|
358
|
+
);
|
|
361
359
|
if (client) touchClient(client);
|
|
362
|
-
return
|
|
363
|
-
ok: true,
|
|
364
|
-
data: { agent_id: agentId, status: "offline" },
|
|
365
|
-
};
|
|
360
|
+
return result;
|
|
366
361
|
}
|
|
367
362
|
|
|
368
363
|
case "send_input": {
|
package/hub/reflexion.mjs
CHANGED
|
@@ -7,8 +7,6 @@ const DEFAULT_CONFIDENCE = 0.5;
|
|
|
7
7
|
const ACTIVE_RULE_CONFIDENCE = 0.5;
|
|
8
8
|
const ADAPTIVE_PROMOTION_STEP = 0.1;
|
|
9
9
|
const ADAPTIVE_DECAY_STEP = 0.1;
|
|
10
|
-
/** @deprecated 세션 기반 decay에서 시간 기반으로 변경됨. 미사용. */
|
|
11
|
-
const _ADAPTIVE_DECAY_WINDOW = 5;
|
|
12
10
|
const ADAPTIVE_DELETE_THRESHOLD = 0.3;
|
|
13
11
|
|
|
14
12
|
function clampConfidence(value) {
|
|
@@ -102,61 +100,6 @@ function buildAdaptiveSolution(errorContext = {}, errorText = "") {
|
|
|
102
100
|
return `${toolName} 재시도 전 실패 원인을 검증하세요: ${summary}`;
|
|
103
101
|
}
|
|
104
102
|
|
|
105
|
-
function normalizeSessionIds(sessionIds) {
|
|
106
|
-
if (!Array.isArray(sessionIds)) return [];
|
|
107
|
-
return [
|
|
108
|
-
...new Set(
|
|
109
|
-
sessionIds.filter((value) => typeof value === "string" && value.trim()),
|
|
110
|
-
),
|
|
111
|
-
];
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/** @deprecated reflexion_entries 기반. adaptive_rules에서는 미사용. 세션 인식 복원 시 재활용 예정. */
|
|
115
|
-
function getAdaptiveState(rule = {}) {
|
|
116
|
-
const state = rule.adaptive_state || {};
|
|
117
|
-
const session_ids = normalizeSessionIds(state.session_ids);
|
|
118
|
-
return {
|
|
119
|
-
...state,
|
|
120
|
-
project_slug: pickString(state.project_slug, rule.context?.project_slug),
|
|
121
|
-
session_ids,
|
|
122
|
-
session_occurrences: Math.max(
|
|
123
|
-
state.session_occurrences || 0,
|
|
124
|
-
session_ids.length,
|
|
125
|
-
),
|
|
126
|
-
last_seen_session: pickSessionCount(state.last_seen_session),
|
|
127
|
-
last_decay_session: pickSessionCount(state.last_decay_session),
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/** @deprecated reflexion_entries 기반. adaptive_rules에서는 미사용. 세션 인식 복원 시 재활용 예정. */
|
|
132
|
-
function _mergeAdaptiveState(rule, errorContext = {}) {
|
|
133
|
-
const current = getAdaptiveState(rule);
|
|
134
|
-
const sessionId = pickSessionId(errorContext);
|
|
135
|
-
const sessionCount = pickSessionCount(
|
|
136
|
-
errorContext.sessionCount,
|
|
137
|
-
errorContext.session_count,
|
|
138
|
-
errorContext.context?.sessionCount,
|
|
139
|
-
errorContext.context?.session_count,
|
|
140
|
-
);
|
|
141
|
-
const session_ids = normalizeSessionIds(
|
|
142
|
-
sessionId ? [...current.session_ids, sessionId] : current.session_ids,
|
|
143
|
-
);
|
|
144
|
-
return {
|
|
145
|
-
...current,
|
|
146
|
-
project_slug: pickString(
|
|
147
|
-
pickProjectSlug(errorContext),
|
|
148
|
-
current.project_slug,
|
|
149
|
-
),
|
|
150
|
-
session_ids,
|
|
151
|
-
session_occurrences: Math.max(
|
|
152
|
-
current.session_occurrences,
|
|
153
|
-
session_ids.length,
|
|
154
|
-
),
|
|
155
|
-
last_seen_session: Math.max(current.last_seen_session, sessionCount),
|
|
156
|
-
last_decay_session: current.last_decay_session || sessionCount,
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
|
|
160
103
|
function filterEntriesByType(entries, type) {
|
|
161
104
|
return entries.filter(
|
|
162
105
|
(entry) => (entry.type || DEFAULT_REFLEXION_TYPE) === type,
|