@triflux/core 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 (84) hide show
  1. package/hooks/agy-session-hook.mjs +11 -56
  2. package/hooks/codex-session-hook.mjs +11 -101
  3. package/hub/bridge.mjs +65 -1250
  4. package/hub/cli-adapter-base.mjs +12 -90
  5. package/hub/codex-adapter.mjs +0 -1
  6. package/hub/codex-preflight.mjs +5 -28
  7. package/hub/index.mjs +3 -19
  8. package/hub/lib/process-utils.mjs +1 -156
  9. package/hub/lib/spawn-trace.mjs +3 -2
  10. package/hub/lib/timeout-defaults.mjs +0 -1
  11. package/hub/team/claude-daemon-control.mjs +1 -2
  12. package/hub/team/claude-session-projection.mjs +5 -73
  13. package/hub/team/nativeProxy.mjs +759 -0
  14. package/hub/team/session-context.mjs +1 -1
  15. package/hud/cli-policy.mjs +0 -22
  16. package/hud/constants.mjs +13 -26
  17. package/hud/hud-qos-status.mjs +42 -54
  18. package/hud/providers/gemini.mjs +125 -20
  19. package/hud/renderers.mjs +101 -122
  20. package/hud/utils.mjs +10 -6
  21. package/package.json +2 -6
  22. package/scripts/lib/agent-route-policy.mjs +143 -62
  23. package/scripts/lib/cli-claude.mjs +0 -14
  24. package/scripts/lib/env-probe.mjs +2 -131
  25. package/scripts/lib/gemini-profiles.mjs +2 -69
  26. package/scripts/lib/legacy-mcp-cleanup.mjs +283 -0
  27. package/scripts/lib/machine-profile.mjs +3 -17
  28. package/scripts/lib/mcp-filter.mjs +109 -53
  29. package/scripts/lib/mcp-guard-engine.mjs +40 -98
  30. package/scripts/lib/mcp-health.mjs +2 -2
  31. package/scripts/lib/mcp-server-catalog.mjs +2 -2
  32. package/scripts/lib/psmux-info.mjs +11 -59
  33. package/scripts/lib/session-presence.mjs +2 -100
  34. package/scripts/lib/skill-template.mjs +0 -245
  35. package/hub/adaptive-diagnostic.mjs +0 -350
  36. package/hub/adaptive-inject.mjs +0 -224
  37. package/hub/adaptive-memory.mjs +0 -277
  38. package/hub/adaptive.mjs +0 -172
  39. package/hub/assign-callbacks.mjs +0 -170
  40. package/hub/delegator/contracts.mjs +0 -38
  41. package/hub/delegator/index.mjs +0 -14
  42. package/hub/delegator/schema/delegator-tools.schema.json +0 -250
  43. package/hub/delegator/service.mjs +0 -336
  44. package/hub/delegator/tool-definitions.mjs +0 -35
  45. package/hub/dynamic-routing-engine.mjs +0 -511
  46. package/hub/hitl.mjs +0 -202
  47. package/hub/lib/known-errors.json +0 -72
  48. package/hub/lib/memory-store.mjs +0 -1001
  49. package/hub/lib/phase-manager.mjs +0 -493
  50. package/hub/lib/risk-tier.mjs +0 -53
  51. package/hub/lib/ssh-command.mjs +0 -231
  52. package/hub/lib/staged-file-detect.mjs +0 -43
  53. package/hub/lib/state-snapshot.mjs +0 -293
  54. package/hub/lib/tfx-route-args.mjs +0 -353
  55. package/hub/lib/trace-recorder.mjs +0 -153
  56. package/hub/lib/uuidv7.mjs +0 -45
  57. package/hub/memory-doctor.mjs +0 -640
  58. package/hub/middleware/quota-middleware.mjs +0 -70
  59. package/hub/middleware/request-logger.mjs +0 -191
  60. package/hub/paths.mjs +0 -24
  61. package/hub/pipeline/index.mjs +0 -163
  62. package/hub/pipeline/state.mjs +0 -191
  63. package/hub/pipeline/transitions.mjs +0 -131
  64. package/hub/reflexion.mjs +0 -290
  65. package/hub/role-contract.mjs +0 -314
  66. package/hub/router.mjs +0 -2026
  67. package/hub/routing-snapshot.mjs +0 -261
  68. package/hub/session-fingerprint.mjs +0 -418
  69. package/hub/state.mjs +0 -300
  70. package/hub/team/synapse-http.mjs +0 -311
  71. package/hub/team-bridge.mjs +0 -27
  72. package/mesh/index.mjs +0 -69
  73. package/mesh/mesh-budget.mjs +0 -137
  74. package/mesh/mesh-heartbeat.mjs +0 -100
  75. package/mesh/mesh-protocol.mjs +0 -96
  76. package/mesh/mesh-queue.mjs +0 -163
  77. package/mesh/mesh-registry.mjs +0 -78
  78. package/mesh/mesh-router.mjs +0 -77
  79. package/scripts/lib/claudemd-scanner.mjs +0 -223
  80. package/scripts/lib/context.mjs +0 -67
  81. package/scripts/lib/dynamic-route-cli.mjs +0 -107
  82. package/scripts/lib/handoff.mjs +0 -187
  83. package/scripts/lib/logger.mjs +0 -122
  84. package/scripts/lib/stealth-fetch.mjs +0 -176
@@ -1,176 +0,0 @@
1
- #!/usr/bin/env node
2
- // SSRF boundary: stealthFetch only accepts http: and https: URLs. It does not
3
- // guard private IPs, metadata hosts such as 169.254.x.x, or localhost; callers
4
- // must treat the URL as already inside their trust boundary.
5
-
6
- import { pathToFileURL } from "node:url";
7
-
8
- export class CloakBrowserUnavailableError extends Error {}
9
-
10
- const DEFAULT_TIMEOUT_MS = 30_000;
11
- const DEFAULT_WAIT_UNTIL = "load";
12
- const SUPPORTED_PLATFORMS = new Set([
13
- "linux:x64",
14
- "linux:arm64",
15
- "darwin:x64",
16
- "darwin:arm64",
17
- "win32:x64",
18
- ]);
19
- const EXIT_CODES = {
20
- not_installed: 3,
21
- unsupported_platform: 4,
22
- runtime_error: 5,
23
- blocked_scheme: 6,
24
- };
25
-
26
- function isSupportedPlatform(platform, arch) {
27
- return SUPPORTED_PLATFORMS.has(`${platform}:${arch}`);
28
- }
29
-
30
- function isModuleNotFound(error) {
31
- return (
32
- error?.code === "ERR_MODULE_NOT_FOUND" || error?.code === "MODULE_NOT_FOUND"
33
- );
34
- }
35
-
36
- function htmlToText(html) {
37
- return String(html || "")
38
- .replace(/<script\b[^>]*>[\s\S]*?<\/script>/giu, " ")
39
- .replace(/<style\b[^>]*>[\s\S]*?<\/style>/giu, " ")
40
- .replace(/<[^>]+>/gu, " ")
41
- .replace(/&nbsp;/giu, " ")
42
- .replace(/&amp;/giu, "&")
43
- .replace(/&lt;/giu, "<")
44
- .replace(/&gt;/giu, ">")
45
- .replace(/&quot;/giu, '"')
46
- .replace(/&#39;/gu, "'")
47
- .replace(/\s+/gu, " ")
48
- .trim();
49
- }
50
-
51
- function responseStatus(response) {
52
- if (!response) return null;
53
- if (typeof response.status === "function") return response.status();
54
- return response.status ?? null;
55
- }
56
-
57
- function responseUrl(response, fallbackUrl) {
58
- if (!response) return fallbackUrl;
59
- if (typeof response.url === "function") return response.url();
60
- return response.url ?? fallbackUrl;
61
- }
62
-
63
- function parseAllowedFetchUrl(url) {
64
- let parsed;
65
- try {
66
- parsed = new URL(url);
67
- } catch {
68
- return { ok: false, scheme: null };
69
- }
70
- if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
71
- return { ok: false, scheme: parsed.protocol };
72
- }
73
- return { ok: true, href: parsed.href };
74
- }
75
-
76
- async function closeBrowser(browser) {
77
- if (!browser || typeof browser.close !== "function") return;
78
- try {
79
- await browser.close();
80
- } catch {
81
- // best effort: fetch callers only need the primary result signal
82
- }
83
- }
84
-
85
- export async function stealthFetch(url, opts = {}) {
86
- const timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;
87
- const waitUntil = opts.waitUntil ?? DEFAULT_WAIT_UNTIL;
88
- const loadCloakBrowser = opts._import ?? (() => import("cloakbrowser"));
89
- const platform = opts._platform ?? process.platform;
90
- const arch = opts._arch ?? process.arch;
91
-
92
- if (!isSupportedPlatform(platform, arch)) {
93
- return {
94
- ok: false,
95
- reason: "unsupported_platform",
96
- platform,
97
- arch,
98
- };
99
- }
100
-
101
- const parsedUrl = parseAllowedFetchUrl(url);
102
- if (!parsedUrl.ok) {
103
- return {
104
- ok: false,
105
- reason: "blocked_scheme",
106
- scheme: parsedUrl.scheme,
107
- };
108
- }
109
-
110
- let cloakbrowser;
111
- try {
112
- cloakbrowser = await loadCloakBrowser();
113
- } catch (error) {
114
- if (isModuleNotFound(error)) return { ok: false, reason: "not_installed" };
115
- return { ok: false, reason: "runtime_error", error: String(error) };
116
- }
117
-
118
- let browser;
119
- try {
120
- const launch = cloakbrowser?.launch;
121
- if (typeof launch !== "function") {
122
- throw new CloakBrowserUnavailableError("cloakbrowser launch unavailable");
123
- }
124
- browser = await launch();
125
- const page = await browser.newPage();
126
- const response = await page.goto(parsedUrl.href, {
127
- waitUntil,
128
- timeout: timeoutMs,
129
- });
130
- const html = await page.content();
131
- return {
132
- ok: true,
133
- engine: "cloakbrowser",
134
- url: parsedUrl.href,
135
- finalUrl: responseUrl(response, parsedUrl.href),
136
- status: responseStatus(response),
137
- html,
138
- text: htmlToText(html),
139
- };
140
- } catch (error) {
141
- return { ok: false, reason: "runtime_error", error: String(error) };
142
- } finally {
143
- await closeBrowser(browser);
144
- }
145
- }
146
-
147
- export function exitCodeFor(result) {
148
- return EXIT_CODES[result?.reason] ?? 5;
149
- }
150
-
151
- export async function main(argv = process.argv) {
152
- const url = argv[2];
153
- if (!url) {
154
- console.error("usage: stealth-fetch <url>");
155
- process.exitCode = 2;
156
- return;
157
- }
158
-
159
- const result = await stealthFetch(url);
160
- if (result.ok) {
161
- console.log(JSON.stringify(result));
162
- process.exitCode = 0;
163
- return;
164
- }
165
-
166
- console.error(`[stealth-fetch] 폴백: ${result.reason}`);
167
- console.log(JSON.stringify(result));
168
- process.exitCode = exitCodeFor(result);
169
- }
170
-
171
- if (
172
- process.argv[1] &&
173
- import.meta.url === pathToFileURL(process.argv[1]).href
174
- ) {
175
- await main();
176
- }