@triflux/core 10.48.1 → 10.50.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 (46) hide show
  1. package/hooks/agy-session-hook.mjs +1 -1
  2. package/hooks/claude-cwd-projection-refresh.mjs +7 -79
  3. package/hooks/codex-session-hook.mjs +3 -8
  4. package/hooks/hook-orchestrator.mjs +8 -648
  5. package/hooks/lib/resolve-root.mjs +1 -1
  6. package/hub/bridge.mjs +290 -51
  7. package/hub/team/claude-daemon-control.mjs +54 -6
  8. package/hub/team/claude-transcript.mjs +240 -0
  9. package/hub/team/session-context.mjs +203 -0
  10. package/hud/constants.mjs +10 -0
  11. package/hud/hud-qos-status.mjs +23 -4
  12. package/hud/providers/gemini.mjs +4 -1
  13. package/hud/renderers.mjs +10 -6
  14. package/package.json +2 -2
  15. package/scripts/lib/doctor-env-checks.mjs +0 -85
  16. package/scripts/lib/legacy-hook-cleanup.mjs +230 -0
  17. package/scripts/lib/legacy-mcp-cleanup.mjs +772 -0
  18. package/scripts/lib/mcp-guard-engine.mjs +44 -271
  19. package/scripts/lib/mcp-manifest.mjs +2 -2
  20. package/scripts/lib/session-presence.mjs +249 -0
  21. package/hooks/agent-route-guard.mjs +0 -113
  22. package/hooks/cross-review-tracker.mjs +0 -135
  23. package/hooks/cto-north-star-brief.mjs +0 -133
  24. package/hooks/error-context.mjs +0 -185
  25. package/hooks/hook-adaptive-collector.mjs +0 -88
  26. package/hooks/hook-manager.mjs +0 -426
  27. package/hooks/hook-registry.json +0 -367
  28. package/hooks/hooks.json +0 -149
  29. package/hooks/keyword-rules.json +0 -878
  30. package/hooks/mcp-config-watcher.mjs +0 -84
  31. package/hooks/permission-safe-allow.mjs +0 -267
  32. package/hooks/pipeline-stop.mjs +0 -435
  33. package/hooks/post-tool-tips.mjs +0 -306
  34. package/hooks/pre-compact-snapshot.mjs +0 -181
  35. package/hooks/safety-guard.mjs +0 -466
  36. package/hooks/session-end-cleanup.mjs +0 -360
  37. package/hooks/session-start-fast.mjs +0 -579
  38. package/hooks/session-start-lake.mjs +0 -81
  39. package/hooks/subagent-tracker.mjs +0 -281
  40. package/hooks/subagent-verifier.mjs +0 -85
  41. package/scripts/lib/cross-review-utils.mjs +0 -59
  42. package/scripts/lib/hook-utils.mjs +0 -16
  43. package/scripts/lib/keyword-rules.mjs +0 -219
  44. package/scripts/lib/mcp-gateway-health-check.mjs +0 -224
  45. package/scripts/lib/mcp-gateway-servers.mjs +0 -70
  46. package/scripts/lib/mcp-gateway-wrapper-check.mjs +0 -35
@@ -6,7 +6,7 @@ import { drainPendingSynapse as defaultDrainPendingSynapse } from "../hub/team/s
6
6
  import {
7
7
  heartbeatInteractiveSession as defaultHeartbeatInteractiveSession,
8
8
  registerInteractiveSession as defaultRegisterInteractiveSession,
9
- } from "./session-start-fast.mjs";
9
+ } from "../scripts/lib/session-presence.mjs";
10
10
 
11
11
  // hub-ensure is loaded lazily so the byte-identical packages/core mirror of this
12
12
  // file loads cleanly. packages/core mirrors scripts/lib only (not scripts/*), so a
@@ -1,83 +1,11 @@
1
1
  #!/usr/bin/env node
2
+ // ADR-0023 전환 stub. 다음 릴리스에서 지운다.
2
3
  import { readFileSync } from "node:fs";
3
- import os from "node:os";
4
- import path from "node:path";
5
- import { fileURLToPath } from "node:url";
4
+ import { cleanupLegacyHooks } from "../scripts/lib/legacy-hook-cleanup.mjs";
6
5
 
7
- import { refreshClaudeSessionProjectionCwd } from "../hub/team/claude-session-projection.mjs";
8
-
9
- function readStdin() {
10
- try {
11
- return Promise.resolve(readFileSync(0, "utf8"));
12
- } catch {
13
- return Promise.resolve("");
14
- }
15
- }
16
-
17
- export function resolveCwdChangedPayload(input = {}, env = process.env) {
18
- const sessionId = String(
19
- input.session_id ??
20
- input.sessionId ??
21
- input.session?.id ??
22
- env.CLAUDE_CODE_SESSION_ID ??
23
- env.CLAUDE_SESSION_ID ??
24
- "",
25
- ).trim();
26
- const cwd = String(
27
- input.cwd ??
28
- input.new_cwd ??
29
- input.newCwd ??
30
- input.current_cwd ??
31
- input.workspace?.cwd ??
32
- input.source?.cwd ??
33
- "",
34
- ).trim();
35
- const configDir = path.resolve(
36
- env.CLAUDE_CONFIG_DIR || path.join(os.homedir(), ".claude"),
37
- );
38
- return {
39
- eventName: String(input.hook_event_name || ""),
40
- sessionId,
41
- cwd,
42
- sessionsDir: path.join(configDir, "sessions"),
43
- };
44
- }
45
-
46
- export async function handleCwdChangedHook(stdinText, env = process.env) {
47
- let input = {};
48
- try {
49
- input = stdinText.trim() ? JSON.parse(stdinText) : {};
50
- } catch {
51
- return { code: 0, stdout: "" };
52
- }
53
- const payload = resolveCwdChangedPayload(input, env);
54
- if (payload.eventName && payload.eventName !== "CwdChanged") {
55
- return { code: 0, stdout: "" };
56
- }
57
- if (!payload.sessionId || !payload.cwd) return { code: 0, stdout: "" };
58
-
59
- const result = await refreshClaudeSessionProjectionCwd({
60
- sessionsDir: payload.sessionsDir,
61
- sessionId: payload.sessionId,
62
- cwd: payload.cwd,
63
- });
64
- if (!result.updated) return { code: 0, stdout: "" };
65
- return {
66
- code: 0,
67
- stdout: JSON.stringify({
68
- hookSpecificOutput: {
69
- hookEventName: "CwdChanged",
70
- additionalContext: `Triflux projection cwd refreshed: ${payload.cwd}`,
71
- },
72
- }),
73
- };
74
- }
75
-
76
- if (
77
- process.argv[1] &&
78
- path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)
79
- ) {
80
- const result = await handleCwdChangedHook(await readStdin());
81
- if (result.stdout) process.stdout.write(result.stdout);
82
- process.exit(result.code);
6
+ try {
7
+ readFileSync(0);
8
+ cleanupLegacyHooks();
9
+ } catch {
10
+ // 오래된 Claude hook이 남아 있어도 세션 시작을 막지 않는다.
83
11
  }
@@ -8,14 +8,9 @@ import { drainPendingSynapse as defaultDrainPendingSynapse } from "../hub/team/s
8
8
  import {
9
9
  heartbeatInteractiveSession as defaultHeartbeatInteractiveSession,
10
10
  registerInteractiveSession as defaultRegisterInteractiveSession,
11
- } from "./session-start-fast.mjs";
12
-
13
- // hub-ensure is loaded lazily so the byte-identical packages/core mirror of this
14
- // file loads cleanly. packages/core mirrors scripts/lib only (not scripts/*), so a
15
- // static `../scripts/hub-ensure.mjs` import would make the core copy throw
16
- // ERR_MODULE_NOT_FOUND at load time. The core copy is published-but-dormant — the
17
- // live codex hook always runs from the installed triflux package where the path
18
- // resolves. This mirrors session-start-fast.mjs's dynamic script-import pattern.
11
+ } from "../scripts/lib/session-presence.mjs";
12
+
13
+ // hub-ensure가 없는 core 미러도 불러올 수 있도록 지연 import한다.
19
14
  async function defaultHubEnsureRun(stdinData) {
20
15
  const { run } = await import(
21
16
  new URL("../scripts/hub-ensure.mjs", import.meta.url).href