triflux 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.
- package/CLAUDE.md +57 -41
- package/README.ko.md +41 -45
- package/README.md +41 -45
- package/adapters/codex/skills/tfx-live/SKILL.md +25 -11
- package/bin/tfx-live.mjs +341 -104
- package/bin/triflux.mjs +147 -2624
- package/config/mcp-registry.json +3 -12
- package/cto/brief.mjs +0 -20
- package/cto/collect.mjs +1 -200
- package/cto/current.schema.json +2 -23
- package/cto/hygiene.mjs +2 -61
- package/cto/lake-root.mjs +0 -56
- package/cto/status.mjs +5 -187
- package/hooks/agy-session-hook.mjs +11 -56
- package/hooks/codex-session-hook.mjs +11 -101
- package/hub/bridge.mjs +65 -1250
- package/hub/cli-adapter-base.mjs +12 -90
- package/hub/codex-adapter.mjs +0 -1
- package/hub/codex-preflight.mjs +5 -28
- package/hub/lib/process-utils.mjs +1 -156
- package/hub/lib/spawn-trace.mjs +3 -2
- package/hub/lib/timeout-defaults.mjs +0 -1
- package/hub/team/agent-map.json +0 -1
- package/hub/team/agents-row-attach.py +120 -0
- package/hub/team/agents-row.mjs +200 -0
- package/hub/team/ansi.mjs +1 -35
- package/hub/team/backend.mjs +9 -145
- package/hub/team/claude-daemon-control.mjs +1 -2
- package/hub/team/claude-session-projection.mjs +5 -73
- 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 +2 -39
- 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 +42 -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 +2 -7
- 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/runtime-mode.mjs +27 -98
- package/hub/team/cli/services/state-store.mjs +5 -20
- package/hub/team/codex-queue.mjs +385 -0
- package/hub/team/handoff.mjs +3 -34
- package/hub/team/headless.mjs +108 -1296
- package/hub/team/orchestrator.mjs +4 -30
- package/hub/team/pane.mjs +6 -28
- package/hub/team/psmux.mjs +3 -34
- package/hub/team/remote-session.mjs +1 -2
- package/hub/team/session-context.mjs +1 -1
- package/hub/team/session.mjs +7 -91
- package/hub/team/tui-core.mjs +1 -1
- package/hub/team/tui-viewer.mjs +11 -58
- package/hub/team/tui.mjs +8 -306
- package/hub/team/uds-orchestrator.mjs +2 -580
- package/hub/team/wt-manager.mjs +2 -2
- package/hub/workers/factory.mjs +6 -84
- package/hub/workers/interface.mjs +1 -7
- package/hub/workers/lib/jsonrpc-core.mjs +11 -0
- package/hub/workers/lib/jsonrpc-ws-uds.mjs +5 -8
- package/hud/cli-policy.mjs +0 -22
- package/hud/constants.mjs +13 -26
- package/hud/hud-qos-status.mjs +42 -54
- package/hud/providers/gemini.mjs +125 -20
- package/hud/renderers.mjs +101 -122
- package/hud/utils.mjs +10 -6
- package/package.json +7 -12
- package/scripts/__tests__/mcp-guard-engine-http-headers.test.mjs +6 -6
- package/scripts/__tests__/mcp-guard-engine-policy-sync.test.mjs +1 -4
- package/scripts/__tests__/mcp-guard-engine-proactive-sync.test.mjs +16 -21
- package/scripts/__tests__/mcp-guard-engine-stdio-sync.test.mjs +1 -1
- package/scripts/__tests__/mcp-guard-engine-sync-http-headers.test.mjs +2 -2
- package/scripts/__tests__/mcp-guard-engine.test.mjs +56 -63
- package/scripts/__tests__/spawn-trace.test.mjs +16 -0
- package/scripts/check-codex-config-stable.mjs +4 -37
- package/scripts/claude-login-detect.mjs +0 -1
- package/scripts/claudemd-sync.mjs +1 -28
- package/scripts/lib/agent-route-policy.mjs +143 -62
- package/scripts/lib/cli-claude.mjs +0 -14
- package/scripts/lib/env-probe.mjs +2 -131
- package/scripts/lib/gemini-profiles.mjs +2 -69
- package/scripts/lib/legacy-mcp-cleanup.mjs +283 -0
- package/scripts/lib/machine-profile.mjs +3 -17
- package/scripts/lib/mcp-filter.mjs +109 -53
- package/scripts/lib/mcp-guard-engine.mjs +40 -98
- 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/session-presence.mjs +2 -100
- package/scripts/lib/skill-template.mjs +0 -245
- package/scripts/pack.mjs +8 -83
- package/scripts/preflight-cache.mjs +5 -18
- package/scripts/release/check-packages-mirror.mjs +2 -8
- package/scripts/release/version-manifest.json +9 -1
- package/scripts/setup.mjs +100 -417
- package/scripts/test-lock.mjs +0 -1
- package/scripts/tfx-route-post.mjs +5 -69
- package/scripts/tfx-route-worker.mjs +4 -79
- package/scripts/tfx-route.sh +169 -1495
- package/scripts/wt-cli.mjs +1 -2
- package/skills/tfx-auto/SKILL.md +123 -741
- package/skills/tfx-auto/references/consensus-schema.md +161 -0
- package/skills/tfx-auto/references/tmux-observation.md +97 -0
- package/skills/tfx-doctor/SKILL.md +5 -6
- package/skills/tfx-lead/SKILL.md +195 -0
- package/skills/tfx-live/SKILL.md +25 -11
- package/skills/tfx-remote/SKILL.md +24 -87
- package/skills/tfx-research/SKILL.md +13 -20
- package/skills/tfx-review/SKILL.md +33 -35
- package/skills/tfx-setup/SKILL.md +1 -1
- package/skills/tfx-ship/SKILL.md +6 -27
- package/skills/tfx-wt/SKILL.md +34 -68
- package/bin/tfx-doctor-tui.mjs +0 -7
- package/bin/tfx-setup-tui.mjs +0 -7
- package/config/routing-policy.json +0 -124
- package/docs/assets/consensus-flow.svg +0 -125
- package/docs/assets/deep-vs-light.svg +0 -193
- package/docs/assets/demo-dark.gif +0 -0
- package/docs/assets/demo-light.gif +0 -0
- package/docs/assets/demo-psmux.gif +0 -0
- package/hub/adaptive-diagnostic.mjs +0 -350
- package/hub/adaptive-inject.mjs +0 -224
- package/hub/adaptive-memory.mjs +0 -277
- package/hub/adaptive.mjs +0 -172
- package/hub/assign-callbacks.mjs +0 -170
- package/hub/delegator/contracts.mjs +0 -38
- package/hub/delegator/index.mjs +0 -14
- package/hub/delegator/schema/delegator-tools.schema.json +0 -250
- package/hub/delegator/service.mjs +0 -336
- package/hub/delegator/tool-definitions.mjs +0 -35
- package/hub/dynamic-routing-engine.mjs +0 -511
- package/hub/hitl.mjs +0 -202
- package/hub/hub-lifecycle.mjs +0 -248
- package/hub/lib/known-errors.json +0 -72
- package/hub/lib/memory-store.mjs +0 -1001
- package/hub/lib/phase-manager.mjs +0 -493
- package/hub/lib/risk-tier.mjs +0 -53
- package/hub/lib/ssh-command.mjs +0 -231
- package/hub/lib/staged-file-detect.mjs +0 -43
- package/hub/lib/state-snapshot.mjs +0 -293
- package/hub/lib/tfx-route-args.mjs +0 -353
- package/hub/lib/trace-recorder.mjs +0 -153
- package/hub/lib/uuidv7.mjs +0 -45
- package/hub/memory-doctor.mjs +0 -640
- package/hub/middleware/quota-middleware.mjs +0 -70
- package/hub/middleware/request-logger.mjs +0 -191
- package/hub/paths.mjs +0 -24
- package/hub/pipe.mjs +0 -825
- package/hub/pipeline/index.mjs +0 -163
- package/hub/pipeline/state.mjs +0 -191
- package/hub/pipeline/transitions.mjs +0 -131
- package/hub/promote-penalties.mjs +0 -138
- package/hub/public/dashboard.html +0 -416
- package/hub/reflexion.mjs +0 -290
- package/hub/role-contract.mjs +0 -314
- package/hub/router.mjs +0 -2026
- package/hub/routing-snapshot.mjs +0 -261
- package/hub/schema.sql +0 -209
- package/hub/server.mjs +0 -3048
- package/hub/session-fingerprint.mjs +0 -418
- package/hub/state.mjs +0 -300
- package/hub/store-adapter.mjs +0 -182
- package/hub/store.mjs +0 -1736
- 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/hub-client.mjs +0 -264
- 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-registry.mjs +0 -121
- package/hub/team/conductor.mjs +0 -1529
- package/hub/team/consensus-meta.mjs +0 -176
- package/hub/team/cto-auto-collect.mjs +0 -115
- 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/lead-control.mjs +0 -191
- 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/session-sync.mjs +0 -316
- package/hub/team/swarm-cli.mjs +0 -390
- package/hub/team/swarm-hypervisor.mjs +0 -2206
- package/hub/team/swarm-intent.mjs +0 -216
- 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/synapse-cli.mjs +0 -458
- package/hub/team/synapse-http.mjs +0 -311
- package/hub/team/synapse-registry.mjs +0 -618
- package/hub/team/tui-remote-adapter.mjs +0 -377
- package/hub/team/tui-synapse.mjs +0 -223
- package/hub/team/worker-completion-validator.mjs +0 -79
- package/hub/team/worker-sandbox.mjs +0 -125
- package/hub/team/worktree-lifecycle.mjs +0 -639
- package/hub/team/wt-templates.json +0 -43
- package/hub/team-bridge.mjs +0 -27
- package/hub/tools.mjs +0 -900
- package/hub/workers/antigravity-route-worker.mjs +0 -179
- package/hub/workers/codex-app-server-worker.mjs +0 -1067
- package/hub/workers/delegator-mcp.mjs +0 -1098
- package/hub/workers/lib/jsonrpc-stdio.mjs +0 -204
- package/mesh/index.mjs +0 -69
- package/mesh/mesh-budget.mjs +0 -137
- package/mesh/mesh-heartbeat.mjs +0 -100
- package/mesh/mesh-protocol.mjs +0 -96
- package/mesh/mesh-queue.mjs +0 -163
- package/mesh/mesh-registry.mjs +0 -78
- package/mesh/mesh-router.mjs +0 -77
- package/scripts/__tests__/skill-surface.test.mjs +0 -93
- package/scripts/cache-doctor.mjs +0 -156
- package/scripts/cache-warmup.mjs +0 -630
- package/scripts/completions/tfx.bash +0 -74
- package/scripts/completions/tfx.fish +0 -57
- package/scripts/completions/tfx.zsh +0 -98
- package/scripts/demo.mjs +0 -197
- package/scripts/doctor-dynamic-routing.mjs +0 -87
- package/scripts/hub-ensure.mjs +0 -842
- package/scripts/hub-watchdog.mjs +0 -90
- package/scripts/lib/claudemd-scanner.mjs +0 -223
- package/scripts/lib/context.mjs +0 -67
- package/scripts/lib/dynamic-route-cli.mjs +0 -107
- package/scripts/lib/handoff.mjs +0 -187
- package/scripts/lib/logger.mjs +0 -122
- package/scripts/lib/stealth-fetch.mjs +0 -176
- package/scripts/notion-read.mjs +0 -686
- package/scripts/snapshot-codex-state.mjs +0 -37
- package/scripts/snapshot-gemini-state.mjs +0 -37
- package/scripts/sync-codex-auth.mjs +0 -71
- package/scripts/sync-hub-mcp-settings.mjs +0 -697
- package/skills/_templates/base.md +0 -4
- package/skills/_templates/deep.md +0 -6
- package/skills/shared/telemetry-segment.md +0 -6
- package/tui/core.mjs +0 -266
- package/tui/doctor.mjs +0 -375
- package/tui/monitor-data.mjs +0 -152
- package/tui/monitor.mjs +0 -318
- package/tui/setup.mjs +0 -506
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 380" fill="none">
|
|
2
|
-
<defs>
|
|
3
|
-
<linearGradient id="bg" x1="0" y1="0" x2="800" y2="380">
|
|
4
|
-
<stop offset="0%" stop-color="#0d1117"/>
|
|
5
|
-
<stop offset="100%" stop-color="#161b22"/>
|
|
6
|
-
</linearGradient>
|
|
7
|
-
<linearGradient id="light-grad" x1="0" y1="0" x2="1" y2="1">
|
|
8
|
-
<stop offset="0%" stop-color="#3fb950"/>
|
|
9
|
-
<stop offset="100%" stop-color="#238636"/>
|
|
10
|
-
</linearGradient>
|
|
11
|
-
<linearGradient id="deep-grad" x1="0" y1="0" x2="1" y2="1">
|
|
12
|
-
<stop offset="0%" stop-color="#f0883e"/>
|
|
13
|
-
<stop offset="100%" stop-color="#db6d28"/>
|
|
14
|
-
</linearGradient>
|
|
15
|
-
<linearGradient id="claude" x1="0" y1="0" x2="1" y2="1">
|
|
16
|
-
<stop offset="0%" stop-color="#d4a574"/>
|
|
17
|
-
<stop offset="100%" stop-color="#c0956c"/>
|
|
18
|
-
</linearGradient>
|
|
19
|
-
<linearGradient id="codex" x1="0" y1="0" x2="1" y2="1">
|
|
20
|
-
<stop offset="0%" stop-color="#10a37f"/>
|
|
21
|
-
<stop offset="100%" stop-color="#0d8c6d"/>
|
|
22
|
-
</linearGradient>
|
|
23
|
-
<linearGradient id="antigravity" x1="0" y1="0" x2="1" y2="1">
|
|
24
|
-
<stop offset="0%" stop-color="#4285f4"/>
|
|
25
|
-
<stop offset="100%" stop-color="#3b78e7"/>
|
|
26
|
-
</linearGradient>
|
|
27
|
-
<filter id="glow">
|
|
28
|
-
<feGaussianBlur stdDeviation="2" result="blur"/>
|
|
29
|
-
<feMerge><feMergeNode in="blur"/><feMergeNode in="SourceGraphic"/></feMerge>
|
|
30
|
-
</filter>
|
|
31
|
-
</defs>
|
|
32
|
-
|
|
33
|
-
<!-- Background -->
|
|
34
|
-
<rect width="800" height="380" rx="12" fill="url(#bg)"/>
|
|
35
|
-
<rect width="800" height="380" rx="12" fill="none" stroke="#30363d" stroke-width="1"/>
|
|
36
|
-
|
|
37
|
-
<!-- Title -->
|
|
38
|
-
<text x="400" y="30" text-anchor="middle" fill="#e6edf3" font-family="SF Mono,Consolas,monospace" font-size="16" font-weight="bold">Deep vs Light Modes</text>
|
|
39
|
-
<text x="400" y="48" text-anchor="middle" fill="#8b949e" font-family="SF Mono,Consolas,monospace" font-size="11">Every domain offers both — choose speed or depth</text>
|
|
40
|
-
|
|
41
|
-
<!-- ===== Center divider ===== -->
|
|
42
|
-
<line x1="400" y1="60" x2="400" y2="340" stroke="#30363d" stroke-width="1" stroke-dasharray="6,4"/>
|
|
43
|
-
<text x="400" y="356" text-anchor="middle" fill="#484f58" font-family="SF Mono,Consolas,monospace" font-size="8">vs</text>
|
|
44
|
-
|
|
45
|
-
<!-- ============================================ -->
|
|
46
|
-
<!-- LEFT: LIGHT MODE -->
|
|
47
|
-
<!-- ============================================ -->
|
|
48
|
-
|
|
49
|
-
<!-- Light header -->
|
|
50
|
-
<rect x="130" y="62" width="140" height="28" rx="14" fill="#3fb950" opacity="0.15" stroke="#3fb950" stroke-width="1"/>
|
|
51
|
-
<text x="200" y="81" text-anchor="middle" fill="#3fb950" font-family="SF Mono,Consolas,monospace" font-size="13" font-weight="bold">Light Mode</text>
|
|
52
|
-
|
|
53
|
-
<!-- Light subtitle -->
|
|
54
|
-
<text x="200" y="105" text-anchor="middle" fill="#8b949e" font-family="SF Mono,Consolas,monospace" font-size="9">Single CLI · Fast · Token-Efficient</text>
|
|
55
|
-
|
|
56
|
-
<!-- Request box -->
|
|
57
|
-
<rect x="140" y="120" width="120" height="28" rx="6" fill="#161b22" stroke="#3fb950" stroke-width="0.8"/>
|
|
58
|
-
<text x="200" y="138" text-anchor="middle" fill="#e6edf3" font-family="SF Mono,Consolas,monospace" font-size="10">Request</text>
|
|
59
|
-
|
|
60
|
-
<!-- Arrow down -->
|
|
61
|
-
<line x1="200" y1="148" x2="200" y2="165" stroke="#3fb950" stroke-width="1.5"/>
|
|
62
|
-
<polygon points="194,162 200,170 206,162" fill="#3fb950"/>
|
|
63
|
-
|
|
64
|
-
<!-- Single CLI: Codex -->
|
|
65
|
-
<rect x="128" y="172" width="144" height="52" rx="8" fill="#0d1f17" stroke="#10a37f" stroke-width="1.5"/>
|
|
66
|
-
<circle cx="150" cy="192" r="7" fill="url(#codex)"/>
|
|
67
|
-
<text x="168" y="196" fill="#10a37f" font-family="SF Mono,Consolas,monospace" font-size="11" font-weight="bold">Codex CLI</text>
|
|
68
|
-
<text x="140" y="214" fill="#8b949e" font-family="SF Mono,Consolas,monospace" font-size="8">Single-model execution</text>
|
|
69
|
-
|
|
70
|
-
<!-- Arrow down -->
|
|
71
|
-
<line x1="200" y1="224" x2="200" y2="242" stroke="#3fb950" stroke-width="2"/>
|
|
72
|
-
<polygon points="194,239 200,248 206,239" fill="#3fb950"/>
|
|
73
|
-
|
|
74
|
-
<!-- Direct Output -->
|
|
75
|
-
<rect x="140" y="250" width="120" height="28" rx="6" fill="#0d1f17" stroke="#238636" stroke-width="1.5"/>
|
|
76
|
-
<text x="200" y="268" text-anchor="middle" fill="#3fb950" font-family="SF Mono,Consolas,monospace" font-size="10" font-weight="bold">Direct Output</text>
|
|
77
|
-
|
|
78
|
-
<!-- Light metrics -->
|
|
79
|
-
<rect x="52" y="296" width="72" height="32" rx="6" fill="#3fb950" opacity="0.08" stroke="#3fb950" stroke-width="0.5"/>
|
|
80
|
-
<text x="88" y="310" text-anchor="middle" fill="#3fb950" font-family="SF Mono,Consolas,monospace" font-size="9" font-weight="bold">3-15K</text>
|
|
81
|
-
<text x="88" y="322" text-anchor="middle" fill="#8b949e" font-family="SF Mono,Consolas,monospace" font-size="7">tokens</text>
|
|
82
|
-
|
|
83
|
-
<rect x="134" y="296" width="72" height="32" rx="6" fill="#3fb950" opacity="0.08" stroke="#3fb950" stroke-width="0.5"/>
|
|
84
|
-
<text x="170" y="310" text-anchor="middle" fill="#3fb950" font-family="SF Mono,Consolas,monospace" font-size="9" font-weight="bold">Seconds</text>
|
|
85
|
-
<text x="170" y="322" text-anchor="middle" fill="#8b949e" font-family="SF Mono,Consolas,monospace" font-size="7">speed</text>
|
|
86
|
-
|
|
87
|
-
<rect x="216" y="296" width="72" height="32" rx="6" fill="#3fb950" opacity="0.08" stroke="#3fb950" stroke-width="0.5"/>
|
|
88
|
-
<text x="252" y="310" text-anchor="middle" fill="#3fb950" font-family="SF Mono,Consolas,monospace" font-size="9" font-weight="bold">Good</text>
|
|
89
|
-
<text x="252" y="322" text-anchor="middle" fill="#8b949e" font-family="SF Mono,Consolas,monospace" font-size="7">accuracy</text>
|
|
90
|
-
|
|
91
|
-
<rect x="298" y="296" width="82" height="32" rx="6" fill="#3fb950" opacity="0.08" stroke="#3fb950" stroke-width="0.5"/>
|
|
92
|
-
<text x="339" y="310" text-anchor="middle" fill="#3fb950" font-family="SF Mono,Consolas,monospace" font-size="9" font-weight="bold">Possible</text>
|
|
93
|
-
<text x="339" y="322" text-anchor="middle" fill="#8b949e" font-family="SF Mono,Consolas,monospace" font-size="7">bias</text>
|
|
94
|
-
|
|
95
|
-
<!-- Use when -->
|
|
96
|
-
<text x="200" y="350" text-anchor="middle" fill="#8b949e" font-family="SF Mono,Consolas,monospace" font-size="8">Quick tasks, known patterns, iteration</text>
|
|
97
|
-
|
|
98
|
-
<!-- ============================================ -->
|
|
99
|
-
<!-- RIGHT: DEEP MODE -->
|
|
100
|
-
<!-- ============================================ -->
|
|
101
|
-
|
|
102
|
-
<!-- Deep header -->
|
|
103
|
-
<rect x="530" y="62" width="140" height="28" rx="14" fill="#f0883e" opacity="0.15" stroke="#f0883e" stroke-width="1"/>
|
|
104
|
-
<text x="600" y="81" text-anchor="middle" fill="#f0883e" font-family="SF Mono,Consolas,monospace" font-size="13" font-weight="bold">Deep Mode</text>
|
|
105
|
-
|
|
106
|
-
<!-- Deep subtitle -->
|
|
107
|
-
<text x="600" y="105" text-anchor="middle" fill="#8b949e" font-family="SF Mono,Consolas,monospace" font-size="9">Tri-CLI · Thorough · Consensus-Verified</text>
|
|
108
|
-
|
|
109
|
-
<!-- Request box -->
|
|
110
|
-
<rect x="540" y="120" width="120" height="28" rx="6" fill="#161b22" stroke="#f0883e" stroke-width="0.8"/>
|
|
111
|
-
<text x="600" y="138" text-anchor="middle" fill="#e6edf3" font-family="SF Mono,Consolas,monospace" font-size="10">Request</text>
|
|
112
|
-
|
|
113
|
-
<!-- Three parallel arrows down (fan out) -->
|
|
114
|
-
<line x1="560" y1="148" x2="510" y2="172" stroke="#d4a574" stroke-width="1.2"/>
|
|
115
|
-
<line x1="600" y1="148" x2="600" y2="172" stroke="#10a37f" stroke-width="1.2"/>
|
|
116
|
-
<line x1="640" y1="148" x2="690" y2="172" stroke="#4285f4" stroke-width="1.2"/>
|
|
117
|
-
|
|
118
|
-
<!-- Three CLI boxes -->
|
|
119
|
-
<!-- Claude -->
|
|
120
|
-
<rect x="460" y="172" width="76" height="42" rx="5" fill="#1c1917" stroke="#d4a574" stroke-width="1"/>
|
|
121
|
-
<circle cx="476" cy="188" r="5" fill="url(#claude)"/>
|
|
122
|
-
<text x="488" y="192" fill="#d4a574" font-family="SF Mono,Consolas,monospace" font-size="8" font-weight="bold">Claude</text>
|
|
123
|
-
<text x="468" y="206" fill="#8b949e" font-family="SF Mono,Consolas,monospace" font-size="7">Arch</text>
|
|
124
|
-
|
|
125
|
-
<!-- Codex -->
|
|
126
|
-
<rect x="562" y="172" width="76" height="42" rx="5" fill="#0d1f17" stroke="#10a37f" stroke-width="1"/>
|
|
127
|
-
<circle cx="578" cy="188" r="5" fill="url(#codex)"/>
|
|
128
|
-
<text x="590" y="192" fill="#10a37f" font-family="SF Mono,Consolas,monospace" font-size="8" font-weight="bold">Codex</text>
|
|
129
|
-
<text x="570" y="206" fill="#8b949e" font-family="SF Mono,Consolas,monospace" font-size="7">Sec/Perf</text>
|
|
130
|
-
|
|
131
|
-
<!-- Antigravity -->
|
|
132
|
-
<rect x="664" y="172" width="76" height="42" rx="5" fill="#0d1520" stroke="#4285f4" stroke-width="1"/>
|
|
133
|
-
<circle cx="680" cy="188" r="5" fill="url(#antigravity)"/>
|
|
134
|
-
<text x="692" y="192" fill="#4285f4" font-family="SF Mono,Consolas,monospace" font-size="8" font-weight="bold">Antigravity</text>
|
|
135
|
-
<text x="672" y="206" fill="#8b949e" font-family="SF Mono,Consolas,monospace" font-size="7">UX/Docs</text>
|
|
136
|
-
|
|
137
|
-
<!-- ISOLATED badges -->
|
|
138
|
-
<rect x="475" y="163" width="42" height="12" rx="6" fill="#da3633" opacity="0.7"/>
|
|
139
|
-
<text x="496" y="172" text-anchor="middle" fill="#fff" font-family="SF Mono,Consolas,monospace" font-size="6" font-weight="bold">ISOLATED</text>
|
|
140
|
-
<rect x="579" y="163" width="42" height="12" rx="6" fill="#da3633" opacity="0.7"/>
|
|
141
|
-
<text x="600" y="172" text-anchor="middle" fill="#fff" font-family="SF Mono,Consolas,monospace" font-size="6" font-weight="bold">ISOLATED</text>
|
|
142
|
-
<rect x="679" y="163" width="42" height="12" rx="6" fill="#da3633" opacity="0.7"/>
|
|
143
|
-
<text x="700" y="172" text-anchor="middle" fill="#fff" font-family="SF Mono,Consolas,monospace" font-size="6" font-weight="bold">ISOLATED</text>
|
|
144
|
-
|
|
145
|
-
<!-- Merge arrows (fan in) -->
|
|
146
|
-
<line x1="498" y1="214" x2="560" y2="233" stroke="#d4a574" stroke-width="1" stroke-dasharray="3"/>
|
|
147
|
-
<line x1="600" y1="214" x2="600" y2="233" stroke="#10a37f" stroke-width="1" stroke-dasharray="3"/>
|
|
148
|
-
<line x1="702" y1="214" x2="640" y2="233" stroke="#4285f4" stroke-width="1" stroke-dasharray="3"/>
|
|
149
|
-
|
|
150
|
-
<!-- Cross-Validation bar -->
|
|
151
|
-
<rect x="540" y="233" width="120" height="18" rx="4" fill="#161b22" stroke="#30363d" stroke-width="0.8"/>
|
|
152
|
-
<text x="600" y="245" text-anchor="middle" fill="#8b949e" font-family="SF Mono,Consolas,monospace" font-size="8">Cross-Validate</text>
|
|
153
|
-
|
|
154
|
-
<!-- Arrow to gate -->
|
|
155
|
-
<line x1="600" y1="251" x2="600" y2="260" stroke="#f0883e" stroke-width="1.5"/>
|
|
156
|
-
|
|
157
|
-
<!-- Consensus Gate diamond -->
|
|
158
|
-
<polygon points="600,261 625,275 600,289 575,275" fill="#1c1510" stroke="#f0883e" stroke-width="1.5" filter="url(#glow)"/>
|
|
159
|
-
<text x="600" y="279" text-anchor="middle" fill="#f0883e" font-family="SF Mono,Consolas,monospace" font-size="8" font-weight="bold">≥70%</text>
|
|
160
|
-
|
|
161
|
-
<!-- Verified Output -->
|
|
162
|
-
<line x1="625" y1="275" x2="660" y2="275" stroke="#3fb950" stroke-width="1.5"/>
|
|
163
|
-
<rect x="662" y="263" width="88" height="24" rx="5" fill="#0d1f17" stroke="#238636" stroke-width="1.2"/>
|
|
164
|
-
<text x="706" y="279" text-anchor="middle" fill="#3fb950" font-family="SF Mono,Consolas,monospace" font-size="9" font-weight="bold">VERIFIED</text>
|
|
165
|
-
|
|
166
|
-
<!-- Retry loop -->
|
|
167
|
-
<line x1="575" y1="275" x2="455" y2="275" stroke="#f85149" stroke-width="0.8" stroke-dasharray="3"/>
|
|
168
|
-
<path d="M455,275 L445,275 L445,195 L460,195" stroke="#f85149" stroke-width="0.8" stroke-dasharray="3" fill="none"/>
|
|
169
|
-
<text x="442" y="240" fill="#f85149" font-family="SF Mono,Consolas,monospace" font-size="6" transform="rotate(-90,442,240)">RETRY</text>
|
|
170
|
-
|
|
171
|
-
<!-- Deep metrics -->
|
|
172
|
-
<rect x="452" y="296" width="72" height="32" rx="6" fill="#f0883e" opacity="0.08" stroke="#f0883e" stroke-width="0.5"/>
|
|
173
|
-
<text x="488" y="310" text-anchor="middle" fill="#f0883e" font-family="SF Mono,Consolas,monospace" font-size="9" font-weight="bold">20-80K</text>
|
|
174
|
-
<text x="488" y="322" text-anchor="middle" fill="#8b949e" font-family="SF Mono,Consolas,monospace" font-size="7">tokens</text>
|
|
175
|
-
|
|
176
|
-
<rect x="534" y="296" width="72" height="32" rx="6" fill="#f0883e" opacity="0.08" stroke="#f0883e" stroke-width="0.5"/>
|
|
177
|
-
<text x="570" y="310" text-anchor="middle" fill="#f0883e" font-family="SF Mono,Consolas,monospace" font-size="9" font-weight="bold">Minutes</text>
|
|
178
|
-
<text x="570" y="322" text-anchor="middle" fill="#8b949e" font-family="SF Mono,Consolas,monospace" font-size="7">speed</text>
|
|
179
|
-
|
|
180
|
-
<rect x="616" y="296" width="72" height="32" rx="6" fill="#f0883e" opacity="0.08" stroke="#f0883e" stroke-width="0.5"/>
|
|
181
|
-
<text x="652" y="310" text-anchor="middle" fill="#f0883e" font-family="SF Mono,Consolas,monospace" font-size="9" font-weight="bold">Excellent</text>
|
|
182
|
-
<text x="652" y="322" text-anchor="middle" fill="#8b949e" font-family="SF Mono,Consolas,monospace" font-size="7">accuracy</text>
|
|
183
|
-
|
|
184
|
-
<rect x="698" y="296" width="82" height="32" rx="6" fill="#f0883e" opacity="0.08" stroke="#f0883e" stroke-width="0.5"/>
|
|
185
|
-
<text x="739" y="310" text-anchor="middle" fill="#f0883e" font-family="SF Mono,Consolas,monospace" font-size="9" font-weight="bold">Eliminated</text>
|
|
186
|
-
<text x="739" y="322" text-anchor="middle" fill="#8b949e" font-family="SF Mono,Consolas,monospace" font-size="7">bias</text>
|
|
187
|
-
|
|
188
|
-
<!-- Use when -->
|
|
189
|
-
<text x="600" y="350" text-anchor="middle" fill="#8b949e" font-family="SF Mono,Consolas,monospace" font-size="8">Critical decisions, unknown territory, production</text>
|
|
190
|
-
|
|
191
|
-
<!-- ===== Footer ===== -->
|
|
192
|
-
<text x="400" y="373" text-anchor="middle" fill="#484f58" font-family="SF Mono,Consolas,monospace" font-size="8">triflux v10.26 — Choose the right mode for every task</text>
|
|
193
|
-
</svg>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,350 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
2
|
-
import { dirname, resolve } from "node:path";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
|
-
|
|
5
|
-
import { normalizeError } from "./reflexion.mjs";
|
|
6
|
-
|
|
7
|
-
const DEFAULT_KNOWN_ERRORS_PATH = resolve(
|
|
8
|
-
dirname(fileURLToPath(import.meta.url)),
|
|
9
|
-
"lib/known-errors.json",
|
|
10
|
-
);
|
|
11
|
-
const DEFAULT_CONFIDENCE = 0.5;
|
|
12
|
-
const ADAPTIVE_CONFIDENCE_STEP = 0.1;
|
|
13
|
-
const MAX_ADAPTIVE_CONFIDENCE = 0.95;
|
|
14
|
-
|
|
15
|
-
function clone(value) {
|
|
16
|
-
return value == null ? value : JSON.parse(JSON.stringify(value));
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function pickString(...values) {
|
|
20
|
-
for (const value of values) {
|
|
21
|
-
if (typeof value === "string" && value.trim()) return value.trim();
|
|
22
|
-
}
|
|
23
|
-
return "";
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function pickObject(...values) {
|
|
27
|
-
return (
|
|
28
|
-
values.find(
|
|
29
|
-
(value) => value && typeof value === "object" && !Array.isArray(value),
|
|
30
|
-
) || {}
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function clampConfidence(value, fallback = DEFAULT_CONFIDENCE) {
|
|
35
|
-
const numeric = Number(value);
|
|
36
|
-
if (!Number.isFinite(numeric)) return fallback;
|
|
37
|
-
return Math.max(0, Math.min(1, numeric));
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function normalizeLookup(text) {
|
|
41
|
-
return String(text || "")
|
|
42
|
-
.trim()
|
|
43
|
-
.toLowerCase();
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
function readPathValue(source, path) {
|
|
47
|
-
if (!source || !path) return undefined;
|
|
48
|
-
return String(path)
|
|
49
|
-
.split(".")
|
|
50
|
-
.filter(Boolean)
|
|
51
|
-
.reduce((current, key) => current?.[key], source);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function renderTemplate(template, observation, signature) {
|
|
55
|
-
if (!template) return "";
|
|
56
|
-
const context = pickObject(observation.context);
|
|
57
|
-
const dna = pickObject(observation.dna);
|
|
58
|
-
const dnaValue = signature.dna_factor
|
|
59
|
-
? (readPathValue(dna, signature.dna_factor) ??
|
|
60
|
-
readPathValue(context, signature.dna_factor) ??
|
|
61
|
-
readPathValue(observation, signature.dna_factor))
|
|
62
|
-
: undefined;
|
|
63
|
-
const variables = {
|
|
64
|
-
...context,
|
|
65
|
-
...pickObject(observation.variables),
|
|
66
|
-
host: pickString(observation.host, context.host),
|
|
67
|
-
value: dnaValue,
|
|
68
|
-
};
|
|
69
|
-
return String(template).replace(/\{([^}]+)\}/gu, (match, key) => {
|
|
70
|
-
const value = variables[key];
|
|
71
|
-
return value == null || value === "" ? match : String(value);
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function buildKnownContextText(observation) {
|
|
76
|
-
return normalizeLookup(
|
|
77
|
-
[
|
|
78
|
-
pickString(observation.contextLabel, observation.context),
|
|
79
|
-
pickString(observation.phase),
|
|
80
|
-
pickString(observation.step),
|
|
81
|
-
]
|
|
82
|
-
.filter(Boolean)
|
|
83
|
-
.join(" "),
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function buildErrorText(observation = {}) {
|
|
88
|
-
return [
|
|
89
|
-
pickString(observation.error),
|
|
90
|
-
pickString(observation.stderr),
|
|
91
|
-
pickString(observation.tool_output, observation.output),
|
|
92
|
-
pickString(observation.message),
|
|
93
|
-
]
|
|
94
|
-
.filter(Boolean)
|
|
95
|
-
.join("\n")
|
|
96
|
-
.trim();
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
function normalizeObservation(observation = {}) {
|
|
100
|
-
const errorText = buildErrorText(observation);
|
|
101
|
-
const projectSlug = pickString(
|
|
102
|
-
observation.project_slug,
|
|
103
|
-
observation.projectSlug,
|
|
104
|
-
observation.context?.project_slug,
|
|
105
|
-
observation.context?.projectSlug,
|
|
106
|
-
);
|
|
107
|
-
return {
|
|
108
|
-
...clone(observation),
|
|
109
|
-
errorText,
|
|
110
|
-
errorPattern: normalizeError(errorText),
|
|
111
|
-
projectSlug,
|
|
112
|
-
tool: pickString(observation.tool, observation.tool_name),
|
|
113
|
-
contextText: buildKnownContextText(observation),
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
function compileSignatures(raw = {}) {
|
|
118
|
-
return Object.entries(raw.signatures || {}).map(([id, signature]) => ({
|
|
119
|
-
id,
|
|
120
|
-
...clone(signature),
|
|
121
|
-
matcher: new RegExp(String(signature.pattern || ""), "iu"),
|
|
122
|
-
}));
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export function loadKnownErrors(filePath = DEFAULT_KNOWN_ERRORS_PATH) {
|
|
126
|
-
try {
|
|
127
|
-
const parsed = JSON.parse(readFileSync(filePath, "utf8"));
|
|
128
|
-
return {
|
|
129
|
-
path: filePath,
|
|
130
|
-
version: parsed.version ?? 1,
|
|
131
|
-
signatures: compileSignatures(parsed),
|
|
132
|
-
};
|
|
133
|
-
} catch {
|
|
134
|
-
return { path: filePath, version: 0, signatures: [] };
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
function scoreKnownMatch(signature, observation) {
|
|
139
|
-
if (
|
|
140
|
-
!observation.errorText ||
|
|
141
|
-
!signature.matcher.test(observation.errorText)
|
|
142
|
-
) {
|
|
143
|
-
return null;
|
|
144
|
-
}
|
|
145
|
-
if (
|
|
146
|
-
signature.tool &&
|
|
147
|
-
observation.tool &&
|
|
148
|
-
normalizeLookup(signature.tool) !== normalizeLookup(observation.tool)
|
|
149
|
-
) {
|
|
150
|
-
return null;
|
|
151
|
-
}
|
|
152
|
-
if (
|
|
153
|
-
signature.context &&
|
|
154
|
-
observation.contextText &&
|
|
155
|
-
!observation.contextText.includes(normalizeLookup(signature.context))
|
|
156
|
-
) {
|
|
157
|
-
return null;
|
|
158
|
-
}
|
|
159
|
-
return clampConfidence(
|
|
160
|
-
Number(signature.confidence_base ?? DEFAULT_CONFIDENCE) +
|
|
161
|
-
(signature.tool && observation.tool ? 0.02 : 0) +
|
|
162
|
-
(signature.context && observation.contextText ? 0.02 : 0) +
|
|
163
|
-
(signature.dna_factor ? 0.01 : 0),
|
|
164
|
-
);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
function severityFromConfidence(confidence, fallback = "medium") {
|
|
168
|
-
if (confidence >= 0.9) return "critical";
|
|
169
|
-
if (confidence >= 0.75) return "high";
|
|
170
|
-
if (confidence >= 0.55) return "medium";
|
|
171
|
-
return fallback;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
export function matchKnownError(catalog, observationInput = {}) {
|
|
175
|
-
const observation = normalizeObservation(observationInput);
|
|
176
|
-
const matched = (catalog?.signatures || [])
|
|
177
|
-
.map((signature) => {
|
|
178
|
-
const confidence = scoreKnownMatch(signature, observation);
|
|
179
|
-
return confidence == null ? null : { signature, confidence };
|
|
180
|
-
})
|
|
181
|
-
.filter(Boolean)
|
|
182
|
-
.sort((left, right) => right.confidence - left.confidence)[0];
|
|
183
|
-
|
|
184
|
-
if (!matched) return null;
|
|
185
|
-
const { signature, confidence } = matched;
|
|
186
|
-
return {
|
|
187
|
-
matched: true,
|
|
188
|
-
source: "known",
|
|
189
|
-
signature_id: signature.id,
|
|
190
|
-
project_slug: observation.projectSlug,
|
|
191
|
-
error_pattern: observation.errorPattern,
|
|
192
|
-
error_message: observation.errorText,
|
|
193
|
-
confidence,
|
|
194
|
-
severity: signature.severity || severityFromConfidence(confidence),
|
|
195
|
-
tool: signature.tool || observation.tool,
|
|
196
|
-
context: signature.context || observation.contextText || null,
|
|
197
|
-
root_cause: signature.root_cause || "known failure pattern",
|
|
198
|
-
rule: renderTemplate(signature.rule_template, observation, signature),
|
|
199
|
-
fix: signature.fix || null,
|
|
200
|
-
dna_factor: signature.dna_factor || null,
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
function resolveRuleStore(options = {}) {
|
|
205
|
-
return options.store || options.adaptiveMemory || null;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
function ensureAdaptiveRule(store, observation) {
|
|
209
|
-
if (
|
|
210
|
-
!store?.findAdaptiveRule ||
|
|
211
|
-
!store?.addAdaptiveRule ||
|
|
212
|
-
!observation.projectSlug
|
|
213
|
-
) {
|
|
214
|
-
return null;
|
|
215
|
-
}
|
|
216
|
-
const identity = {
|
|
217
|
-
project_slug: observation.projectSlug,
|
|
218
|
-
pattern: observation.errorPattern,
|
|
219
|
-
};
|
|
220
|
-
const current = store.findAdaptiveRule(
|
|
221
|
-
identity.project_slug,
|
|
222
|
-
identity.pattern,
|
|
223
|
-
);
|
|
224
|
-
if (!current) {
|
|
225
|
-
return store.addAdaptiveRule(identity);
|
|
226
|
-
}
|
|
227
|
-
if (!store.updateRuleConfidence) return current;
|
|
228
|
-
return store.updateRuleConfidence(
|
|
229
|
-
identity.project_slug,
|
|
230
|
-
identity.pattern,
|
|
231
|
-
Math.min(
|
|
232
|
-
MAX_ADAPTIVE_CONFIDENCE,
|
|
233
|
-
current.confidence + ADAPTIVE_CONFIDENCE_STEP,
|
|
234
|
-
),
|
|
235
|
-
{ hit_count_increment: 1 },
|
|
236
|
-
);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
function buildAdaptiveDiagnosis(rule, observation) {
|
|
240
|
-
if (!rule) {
|
|
241
|
-
return {
|
|
242
|
-
matched: false,
|
|
243
|
-
source: "novel",
|
|
244
|
-
project_slug: observation.projectSlug,
|
|
245
|
-
error_pattern: observation.errorPattern,
|
|
246
|
-
error_message: observation.errorText,
|
|
247
|
-
confidence: DEFAULT_CONFIDENCE,
|
|
248
|
-
severity: "low",
|
|
249
|
-
root_cause: "새로운 실패 패턴으로 분류됨",
|
|
250
|
-
rule: "",
|
|
251
|
-
fix: null,
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
const matched =
|
|
255
|
-
Number(rule.hit_count || 0) > 1 ||
|
|
256
|
-
Number(rule.confidence || 0) > DEFAULT_CONFIDENCE;
|
|
257
|
-
const confidence = clampConfidence(rule.confidence, DEFAULT_CONFIDENCE);
|
|
258
|
-
return {
|
|
259
|
-
matched,
|
|
260
|
-
source: matched ? "adaptive" : "novel",
|
|
261
|
-
project_slug: rule.project_slug,
|
|
262
|
-
error_pattern: rule.pattern,
|
|
263
|
-
error_message: observation.errorText,
|
|
264
|
-
confidence,
|
|
265
|
-
severity: severityFromConfidence(confidence, matched ? "medium" : "low"),
|
|
266
|
-
root_cause: matched
|
|
267
|
-
? "반복 관측된 adaptive rule과 일치"
|
|
268
|
-
: "adaptive memory에 첫 관측으로 저장됨",
|
|
269
|
-
rule: matched
|
|
270
|
-
? `프로젝트 ${rule.project_slug}에서 동일 패턴이 ${rule.hit_count}회 관측되었습니다.`
|
|
271
|
-
: `프로젝트 ${rule.project_slug}의 adaptive memory에 패턴을 기록했습니다.`,
|
|
272
|
-
fix: matched
|
|
273
|
-
? "최근 성공한 수정/회피 전략을 재적용하세요."
|
|
274
|
-
: "추가 관측 후 adaptive rule을 승격하세요.",
|
|
275
|
-
adaptive_rule: clone(rule),
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
function createHealthyState(catalog) {
|
|
280
|
-
return {
|
|
281
|
-
state: "healthy",
|
|
282
|
-
known_errors_count: catalog.signatures.length,
|
|
283
|
-
last_error: null,
|
|
284
|
-
};
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
function createDegradedState(error) {
|
|
288
|
-
return {
|
|
289
|
-
state: "degraded",
|
|
290
|
-
known_errors_count: 0,
|
|
291
|
-
last_error: {
|
|
292
|
-
name: error?.name || "Error",
|
|
293
|
-
message: error?.message || "unknown adaptive diagnostic error",
|
|
294
|
-
},
|
|
295
|
-
};
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
export function createDiagnosticPipeline(options = {}) {
|
|
299
|
-
const store = resolveRuleStore(options);
|
|
300
|
-
let catalog = options.knownErrors
|
|
301
|
-
? { signatures: compileSignatures({ signatures: options.knownErrors }) }
|
|
302
|
-
: null;
|
|
303
|
-
let health = catalog ? createHealthyState(catalog) : null;
|
|
304
|
-
|
|
305
|
-
function ensureCatalog() {
|
|
306
|
-
if (catalog) return catalog;
|
|
307
|
-
try {
|
|
308
|
-
catalog = loadKnownErrors(
|
|
309
|
-
options.knownErrorsPath || DEFAULT_KNOWN_ERRORS_PATH,
|
|
310
|
-
);
|
|
311
|
-
health = createHealthyState(catalog);
|
|
312
|
-
} catch (error) {
|
|
313
|
-
catalog = { signatures: [] };
|
|
314
|
-
health = createDegradedState(error);
|
|
315
|
-
}
|
|
316
|
-
return catalog;
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
function diagnoseFailure(observationInput = {}) {
|
|
320
|
-
const observation = normalizeObservation(observationInput);
|
|
321
|
-
const nextCatalog = ensureCatalog();
|
|
322
|
-
const known = matchKnownError(nextCatalog, observation);
|
|
323
|
-
if (known) return known;
|
|
324
|
-
const adaptiveRule = observation.errorPattern
|
|
325
|
-
? ensureAdaptiveRule(store, observation)
|
|
326
|
-
: null;
|
|
327
|
-
return buildAdaptiveDiagnosis(adaptiveRule, observation);
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
function getHealth() {
|
|
331
|
-
return clone(health || (ensureCatalog() && health));
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
function listKnownErrors() {
|
|
335
|
-
return (ensureCatalog().signatures || []).map(({ matcher, ...signature }) =>
|
|
336
|
-
clone(signature),
|
|
337
|
-
);
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
return Object.freeze({
|
|
341
|
-
diagnose: diagnoseFailure,
|
|
342
|
-
diagnoseFailure,
|
|
343
|
-
run: diagnoseFailure,
|
|
344
|
-
getHealth,
|
|
345
|
-
listKnownErrors,
|
|
346
|
-
});
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
export { DEFAULT_KNOWN_ERRORS_PATH };
|
|
350
|
-
export default createDiagnosticPipeline;
|