open-multi-agent-kit 0.78.6 → 0.78.7

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 (169) hide show
  1. package/AGENTS.md +1 -1
  2. package/CHANGELOG.md +26 -0
  3. package/MATURITY.md +2 -2
  4. package/README.md +19 -4
  5. package/dist/brand/night-city.theme.json +80 -0
  6. package/dist/brand/palette.d.ts +73 -177
  7. package/dist/brand/palette.js +115 -39
  8. package/dist/brand/rust-forge.theme.json +216 -0
  9. package/dist/brand/theme-compiled.d.ts +61 -0
  10. package/dist/brand/theme-compiled.js +241 -0
  11. package/dist/brand/theme.js +50 -37
  12. package/dist/cli/release-promotion-gate.d.ts +8 -1
  13. package/dist/cli/release-promotion-gate.js +20 -9
  14. package/dist/cli/root.d.ts +1 -0
  15. package/dist/cli/root.js +2 -1
  16. package/dist/cli/theme/index.d.ts +11 -2
  17. package/dist/cli/theme/index.js +6 -1
  18. package/dist/cli/theme/oklab-quantize.d.ts +29 -0
  19. package/dist/cli/theme/oklab-quantize.js +105 -0
  20. package/dist/cli/theme/render-table.d.ts +59 -0
  21. package/dist/cli/theme/render-table.js +112 -0
  22. package/dist/cli/theme/status-frame.d.ts +10 -0
  23. package/dist/cli/theme/status-frame.js +22 -0
  24. package/dist/cli/theme/terminal-capability.d.ts +6 -1
  25. package/dist/cli/theme/terminal-capability.js +20 -4
  26. package/dist/cli/theme/theme-doc.d.ts +22 -0
  27. package/dist/cli/theme/theme-doc.js +97 -0
  28. package/dist/cli/theme/theme-registry.js +39 -18
  29. package/dist/cli/theme/tier-explain.d.ts +21 -0
  30. package/dist/cli/theme/tier-explain.js +60 -0
  31. package/dist/cli/ui/green-rain-renderer.js +3 -2
  32. package/dist/cli/ui/neon-grid-renderer.js +4 -3
  33. package/dist/cli/ui/rust-forge-renderer.js +17 -3
  34. package/dist/cli/ui/system24-renderer.d.ts +18 -1
  35. package/dist/cli/ui/system24-renderer.js +39 -16
  36. package/dist/cli/v2/chat-repl.js +3 -1
  37. package/dist/cli/v2/cli-v2-skeleton.d.ts +6 -0
  38. package/dist/cli/v2/cli-v2-skeleton.js +121 -9
  39. package/dist/cli/v2/interactive-prompt.d.ts +1 -0
  40. package/dist/cli/v2/interactive-prompt.js +6 -2
  41. package/dist/commands/chat/core.js +2 -2
  42. package/dist/commands/chat/runtime.js +2 -0
  43. package/dist/commands/chat/utils.js +12 -4
  44. package/dist/commands/cockpit/render.js +102 -64
  45. package/dist/commands/cockpit/utils.d.ts +2 -0
  46. package/dist/commands/design.js +18 -16
  47. package/dist/commands/doctor/checks.d.ts +0 -1
  48. package/dist/commands/doctor/checks.js +1 -36
  49. package/dist/commands/doctor/report.js +0 -11
  50. package/dist/commands/init/content.d.ts +1 -1
  51. package/dist/commands/init/content.js +3 -11
  52. package/dist/commands/init.js +2 -2
  53. package/dist/commands/mcp/config.d.ts +32 -0
  54. package/dist/commands/mcp/config.js +264 -0
  55. package/dist/commands/mcp/doctor-fix.d.ts +12 -0
  56. package/dist/commands/mcp/doctor-fix.js +261 -0
  57. package/dist/commands/mcp/doctor.d.ts +55 -0
  58. package/dist/commands/mcp/doctor.js +401 -0
  59. package/dist/commands/mcp/list.d.ts +1 -0
  60. package/dist/commands/mcp/list.js +56 -0
  61. package/dist/commands/mcp/shared.d.ts +47 -0
  62. package/dist/commands/mcp/shared.js +192 -0
  63. package/dist/commands/mcp/test.d.ts +5 -0
  64. package/dist/commands/mcp/test.js +457 -0
  65. package/dist/commands/mcp.d.ts +8 -104
  66. package/dist/commands/mcp.js +5 -1603
  67. package/dist/contracts/proof.d.ts +1 -1
  68. package/dist/goal/control-loop.d.ts +15 -0
  69. package/dist/goal/control-loop.js +39 -5
  70. package/dist/hud/render.d.ts +2 -0
  71. package/dist/hud/render.js +7 -1
  72. package/dist/mcp/secret-scanner.d.ts +6 -0
  73. package/dist/mcp/secret-scanner.js +44 -11
  74. package/dist/memory/graph-delta-log.d.ts +137 -0
  75. package/dist/memory/graph-delta-log.js +650 -0
  76. package/dist/memory/graph-viewer.js +13 -32
  77. package/dist/memory/local-graph-memory-store.d.ts +36 -3
  78. package/dist/memory/local-graph-memory-store.js +255 -10
  79. package/dist/orchestration/log-streamer.js +13 -8
  80. package/dist/orchestration/routing.d.ts +4 -0
  81. package/dist/orchestration/routing.js +28 -3
  82. package/dist/orchestration/state-persister.js +8 -1
  83. package/dist/providers/anthropic-messages-runner.d.ts +17 -0
  84. package/dist/providers/anthropic-messages-runner.js +197 -0
  85. package/dist/providers/model-registry.d.ts +1 -1
  86. package/dist/providers/model-registry.js +37 -3
  87. package/dist/providers/provider-runtime.js +27 -11
  88. package/dist/providers/thinking-levels.js +4 -1
  89. package/dist/providers/types.d.ts +3 -3
  90. package/dist/runtime/contracts/weakness-remediation.d.ts +9 -1
  91. package/dist/runtime/contracts/weakness-remediation.js +9 -1
  92. package/dist/runtime/router-v2-scoring.d.ts +8 -3
  93. package/dist/runtime/router-v2-scoring.js +27 -22
  94. package/dist/runtime/runtime-router.d.ts +5 -0
  95. package/dist/runtime/runtime-router.js +40 -8
  96. package/dist/runtime/sandbox-profile.d.ts +29 -0
  97. package/dist/runtime/sandbox-profile.js +101 -0
  98. package/dist/runtime/slash-commands.js +300 -2
  99. package/dist/runtime/tool-dispatch-contracts.d.ts +15 -0
  100. package/dist/runtime/tool-dispatch-contracts.js +12 -0
  101. package/dist/runtime/weights-config.d.ts +90 -0
  102. package/dist/runtime/weights-config.js +249 -0
  103. package/dist/schema/envelope.schema.d.ts +18 -18
  104. package/dist/schema/evidence.schema.d.ts +2 -2
  105. package/dist/schema/proof-bundle.schema.d.ts +6 -6
  106. package/dist/schema/proof-bundle.schema.js +0 -1
  107. package/dist/schema/provider.schema.d.ts +2 -2
  108. package/dist/schema/run-manifest.schema.d.ts +16 -16
  109. package/dist/theme/ansi.js +9 -2
  110. package/dist/theme/extended-palette.d.ts +85 -0
  111. package/dist/theme/extended-palette.js +108 -0
  112. package/dist/theme/layout.js +29 -8
  113. package/dist/theme/metrics.js +5 -5
  114. package/dist/theme/parallel.js +25 -15
  115. package/dist/ui/omk-sigil.js +5 -14
  116. package/dist/ui/omk-working-sweep.js +5 -15
  117. package/dist/util/chat-agent-mode.d.ts +11 -0
  118. package/dist/util/chat-agent-mode.js +41 -8
  119. package/dist/util/chat-cockpit.d.ts +9 -0
  120. package/dist/util/chat-cockpit.js +77 -20
  121. package/dist/util/fs/core.d.ts +5 -0
  122. package/dist/util/fs/core.js +35 -0
  123. package/dist/util/fs/internal.d.ts +14 -0
  124. package/dist/util/fs/internal.js +169 -0
  125. package/dist/util/fs/kimi-sync.d.ts +41 -0
  126. package/dist/util/fs/kimi-sync.js +495 -0
  127. package/dist/util/fs/logo.d.ts +2 -0
  128. package/dist/util/fs/logo.js +78 -0
  129. package/dist/util/fs/manifest.d.ts +6 -0
  130. package/dist/util/fs/manifest.js +40 -0
  131. package/dist/util/fs/mcp-diagnose.d.ts +15 -0
  132. package/dist/util/fs/mcp-diagnose.js +204 -0
  133. package/dist/util/fs/mcp-runtime-config.d.ts +23 -0
  134. package/dist/util/fs/mcp-runtime-config.js +412 -0
  135. package/dist/util/fs/paths.d.ts +13 -0
  136. package/dist/util/fs/paths.js +82 -0
  137. package/dist/util/fs/preflight.d.ts +27 -0
  138. package/dist/util/fs/preflight.js +271 -0
  139. package/dist/util/fs.d.ts +8 -128
  140. package/dist/util/fs.js +8 -1757
  141. package/dist/util/terminal-layout.js +5 -1
  142. package/dist/util/version.js +2 -1
  143. package/docs/2026-06-11/critical-issues.md +20 -0
  144. package/docs/2026-06-11/improvements.md +14 -0
  145. package/docs/2026-06-11/init-checklist.md +25 -0
  146. package/docs/2026-06-11/plan.md +20 -0
  147. package/docs/ARCHITECTURE_ANALYSIS_CODEGRAPH.md +223 -0
  148. package/docs/adr/0001-no-native-rust-lane.md +52 -0
  149. package/docs/codex-oauth-setup.md +14 -0
  150. package/docs/decisions/2026-06-10-git-history-bloat.md +61 -0
  151. package/docs/decisions/ADR-theme-dark-only-assets.md +43 -0
  152. package/docs/getting-started.md +1 -1
  153. package/docs/headroom-omk-final-summary.md +188 -0
  154. package/docs/headroom-omk-integration.md +394 -0
  155. package/docs/headroom-omk-setup-guide.md +422 -0
  156. package/docs/headroom-omk-usage-examples.md +371 -0
  157. package/docs/provider-maturity.md +1 -1
  158. package/docs/versioning.md +3 -3
  159. package/package.json +10 -10
  160. package/readmeasset/.npmignore +2 -0
  161. package/readmeasset/ASSET_INDEX.md +7 -5
  162. package/readmeasset/ASSET_PROVENANCE.md +21 -5
  163. package/readmeasset/omk-control-surfaces.svg +55 -0
  164. package/readmeasset/omk-core-loop.svg +1 -0
  165. package/readmeasset/omk-logo-mark.svg +1 -0
  166. package/readmeasset/omk-release-assertions.svg +51 -0
  167. package/dist/native/linux-x64/omk-safety +0 -0
  168. package/dist/util/native-safety.d.ts +0 -28
  169. package/dist/util/native-safety.js +0 -118
@@ -0,0 +1,82 @@
1
+ import { readFile } from "fs/promises";
2
+ import { join } from "path";
3
+ import { homedir } from "os";
4
+ import { getProjectRoot as resolveProjectRootSync, getProjectRootAsync as resolveProjectRootAsyncPath, getProjectRootDiagnostics, resolveProjectRoot, resolveProjectRootAsync, displayProjectRootPath, } from "../project-root.js";
5
+ export { getProjectRootDiagnostics, resolveProjectRoot, resolveProjectRootAsync, displayProjectRootPath, };
6
+ export function getProjectRoot() {
7
+ return resolveProjectRootSync();
8
+ }
9
+ export async function getProjectRootAsync() {
10
+ return resolveProjectRootAsyncPath();
11
+ }
12
+ export function getUserHome(env = process.env) {
13
+ return (normalizeUserHomePath(env.OMK_ORIGINAL_HOME)
14
+ ?? normalizeUserHomePath(env.HOME)
15
+ ?? normalizeUserHomePath(env.USERPROFILE)
16
+ ?? normalizeUserHomePath(homedir())
17
+ ?? homedir());
18
+ }
19
+ export function normalizeUserHomePath(value) {
20
+ if (value === undefined)
21
+ return undefined;
22
+ const trimmed = stripWrappingQuotes(value.trim());
23
+ if (!trimmed)
24
+ return undefined;
25
+ const wslPath = normalizeWslUncPath(trimmed);
26
+ return stripKimiConfigSuffix(wslPath ?? trimmed);
27
+ }
28
+ function stripWrappingQuotes(value) {
29
+ if (value.length < 2)
30
+ return value;
31
+ const first = value[0];
32
+ const last = value[value.length - 1];
33
+ if ((first === "\"" && last === "\"") || (first === "'" && last === "'")) {
34
+ return value.slice(1, -1);
35
+ }
36
+ return value;
37
+ }
38
+ function normalizeWslUncPath(value) {
39
+ const slashPath = value.replace(/\\/g, "/");
40
+ const match = slashPath.match(/^\/\/wsl(?:\.localhost|\$)\/[^/]+(?:\/(.*))?$/i);
41
+ if (!match)
42
+ return undefined;
43
+ const distroRelative = match[1] ?? "";
44
+ return `/${distroRelative}`.replace(/\/+/g, "/");
45
+ }
46
+ function stripKimiConfigSuffix(value) {
47
+ const slashPath = value.replace(/\\/g, "/");
48
+ const lower = slashPath.toLowerCase();
49
+ for (const suffix of ["/.kimi/mcp.json", "/.kimi/config.toml", "/.kimi/skills"]) {
50
+ if (lower.endsWith(suffix)) {
51
+ return value.slice(0, value.length - suffix.length);
52
+ }
53
+ }
54
+ if (lower.endsWith("/.kimi")) {
55
+ return value.slice(0, value.length - "/.kimi".length);
56
+ }
57
+ return value;
58
+ }
59
+ export function getOmkPath(subPath) {
60
+ const root = getProjectRoot();
61
+ return subPath ? join(root, ".omk", subPath) : join(root, ".omk");
62
+ }
63
+ export { validateRunId, sanitizeRunId, validateRunArtifactPath, getRunsDir, getRunPath, getRunArtifactPath, listValidRunIds, } from "../run-store.js";
64
+ export function getKimiConfigPath() {
65
+ return join(getUserHome(), ".kimi", "config.toml");
66
+ }
67
+ /** 프로젝트의 .kimi/skills 디렉토리 경로 */
68
+ export function getKimiSkillsDir() {
69
+ return join(getProjectRoot(), ".kimi", "skills");
70
+ }
71
+ /** ~/.kimi/config.toml 에서 default_model 읽기 */
72
+ export async function getKimiDefaultModel() {
73
+ const configPath = getKimiConfigPath();
74
+ try {
75
+ const content = await readFile(configPath, "utf-8");
76
+ const match = content.match(/^default_model\s*=\s*["']([^"']+)["']/m);
77
+ return match?.[1] ?? null;
78
+ }
79
+ catch {
80
+ return null;
81
+ }
82
+ }
@@ -0,0 +1,27 @@
1
+ export type RuntimeMcpPreflightMode = "warn-skip" | "strict" | "off";
2
+ export type RuntimeMcpPreflightFailureReason = "timeout" | "exit";
3
+ export type RuntimeMcpPreflightEntryStatus = "ok" | "failed" | "skipped";
4
+ export interface RuntimeMcpPreflightOptions {
5
+ timeoutMs: number;
6
+ concurrency: number;
7
+ }
8
+ export interface RuntimeMcpPreflightEntry {
9
+ name: string;
10
+ status: RuntimeMcpPreflightEntryStatus;
11
+ reason?: RuntimeMcpPreflightFailureReason | "not-npm-family" | "no-package-spec";
12
+ detail?: string;
13
+ packageSpec?: string;
14
+ }
15
+ export interface RuntimeMcpPreflightResult {
16
+ failed: Set<string>;
17
+ details: Map<string, {
18
+ reason: RuntimeMcpPreflightFailureReason;
19
+ detail: string;
20
+ }>;
21
+ entries: RuntimeMcpPreflightEntry[];
22
+ }
23
+ export declare function resolveRuntimeMcpPreflightMode(env?: Record<string, string | undefined>): RuntimeMcpPreflightMode;
24
+ export declare function resolveRuntimeMcpPreflightOptions(env?: Record<string, string | undefined>): RuntimeMcpPreflightOptions & {
25
+ mode: RuntimeMcpPreflightMode;
26
+ };
27
+ export declare function preflightRuntimeMcpServers(servers: Record<string, unknown>, options: RuntimeMcpPreflightOptions): Promise<RuntimeMcpPreflightResult>;
@@ -0,0 +1,271 @@
1
+ import { execa } from "execa";
2
+ import { basenameOfRuntimeCommand, formatPreflightFailureDetail, isRecord, QUIET_PACKAGE_MANAGER_ENV, runtimeShellInlineScripts, } from "./internal.js";
3
+ export function resolveRuntimeMcpPreflightMode(env = process.env) {
4
+ const raw = env.OMK_MCP_PREFLIGHT?.trim();
5
+ if (!raw)
6
+ return "warn-skip";
7
+ if (raw === "strict" || raw === "warn-skip")
8
+ return raw;
9
+ return "off";
10
+ }
11
+ function resolvePreflightTimeout(env = process.env) {
12
+ const raw = env.OMK_MCP_PREFLIGHT_TIMEOUT_MS;
13
+ if (!raw)
14
+ return 5000;
15
+ const n = Number.parseInt(raw, 10);
16
+ return Number.isFinite(n) && n > 0 ? n : 5000;
17
+ }
18
+ function resolvePreflightConcurrency(env = process.env) {
19
+ const raw = env.OMK_MCP_PREFLIGHT_CONCURRENCY;
20
+ if (!raw)
21
+ return 3;
22
+ const n = Number.parseInt(raw, 10);
23
+ return Number.isFinite(n) && n > 0 ? n : 3;
24
+ }
25
+ export function resolveRuntimeMcpPreflightOptions(env = process.env) {
26
+ return {
27
+ mode: resolveRuntimeMcpPreflightMode(env),
28
+ timeoutMs: resolvePreflightTimeout(env),
29
+ concurrency: resolvePreflightConcurrency(env),
30
+ };
31
+ }
32
+ const NPM_FAMILY_RUNTIME_COMMANDS = new Set([
33
+ "npm",
34
+ "npx",
35
+ "pnpm",
36
+ "yarn",
37
+ "bun",
38
+ "bunx",
39
+ "npm.cmd",
40
+ "npx.cmd",
41
+ "pnpm.cmd",
42
+ "yarn.cmd",
43
+ "bun.cmd",
44
+ "bunx.cmd",
45
+ "npm.exe",
46
+ "npx.exe",
47
+ "pnpm.exe",
48
+ "yarn.exe",
49
+ "bun.exe",
50
+ "bunx.exe",
51
+ ]);
52
+ const PACKAGE_ARG_OPTIONS_WITH_VALUE = new Set([
53
+ "-p",
54
+ "--package",
55
+ "--package-name",
56
+ "--registry",
57
+ "--cache",
58
+ "--userconfig",
59
+ "--prefix",
60
+ ]);
61
+ const PACKAGE_ARG_FLAGS = new Set([
62
+ "-y",
63
+ "--yes",
64
+ "--quiet",
65
+ "--silent",
66
+ "--no",
67
+ "--no-install",
68
+ "--ignore-existing",
69
+ "--prefer-offline",
70
+ "--offline",
71
+ ]);
72
+ function isRuntimePackageSpecifier(value) {
73
+ if (!value || value.startsWith("-") || value === "--")
74
+ return false;
75
+ if (/^(?:https?|git\+ssh|git\+https?):/i.test(value))
76
+ return false;
77
+ if (value.startsWith(".") || value.startsWith("/") || value.startsWith("~") || value.includes("\\") || value.includes(":"))
78
+ return false;
79
+ return /^(?:@[a-z0-9._~-]+\/)?[a-z0-9._~-]+(?:@[a-z0-9._~+-]+)?$/i.test(value);
80
+ }
81
+ function findPackageSpecifier(args, commandName) {
82
+ let start = 0;
83
+ if (commandName === "npm" && ["exec", "x", "dlx"].includes(args[0] ?? ""))
84
+ start = 1;
85
+ if (commandName === "pnpm" && ["dlx", "exec"].includes(args[0] ?? ""))
86
+ start = 1;
87
+ if (commandName === "yarn" && ["dlx", "exec"].includes(args[0] ?? ""))
88
+ start = 1;
89
+ if (commandName === "bun" && ["x", "runx"].includes(args[0] ?? ""))
90
+ start = 1;
91
+ for (let i = start; i < args.length; i += 1) {
92
+ const arg = args[i];
93
+ if (!arg || arg === "--")
94
+ break;
95
+ if (arg.startsWith("--package=")) {
96
+ const value = arg.slice("--package=".length);
97
+ return isRuntimePackageSpecifier(value) ? value : null;
98
+ }
99
+ if (PACKAGE_ARG_OPTIONS_WITH_VALUE.has(arg)) {
100
+ const value = args[i + 1];
101
+ if (arg === "-p" || arg === "--package" || arg === "--package-name") {
102
+ return value && isRuntimePackageSpecifier(value) ? value : null;
103
+ }
104
+ i += 1;
105
+ continue;
106
+ }
107
+ if (PACKAGE_ARG_FLAGS.has(arg))
108
+ continue;
109
+ if (arg.startsWith("-"))
110
+ continue;
111
+ return isRuntimePackageSpecifier(arg) ? arg : null;
112
+ }
113
+ return null;
114
+ }
115
+ function runtimeNpmPreflightEnv(concurrency) {
116
+ const maxSockets = String(Math.max(1, Math.min(16, concurrency)));
117
+ return {
118
+ ...QUIET_PACKAGE_MANAGER_ENV,
119
+ npm_config_maxsockets: maxSockets,
120
+ NPM_CONFIG_MAXSOCKETS: maxSockets,
121
+ };
122
+ }
123
+ function isSafeNpmPreflightEnvKey(key) {
124
+ const lower = key.toLowerCase();
125
+ if (/(?:token|secret|password|passwd|credential|auth|cookie|key)/i.test(key))
126
+ return false;
127
+ if (["http_proxy", "https_proxy", "no_proxy"].includes(lower))
128
+ return true;
129
+ if (!lower.startsWith("npm_config_"))
130
+ return false;
131
+ const npmKey = lower.slice("npm_config_".length).replace(/-/g, "_");
132
+ return [
133
+ "registry",
134
+ "proxy",
135
+ "https_proxy",
136
+ "http_proxy",
137
+ "noproxy",
138
+ "no_proxy",
139
+ "strict_ssl",
140
+ "cafile",
141
+ "userconfig",
142
+ "cache",
143
+ ].includes(npmKey);
144
+ }
145
+ function runtimeNpmPreflightServerEnv(server) {
146
+ const env = isRecord(server.env) ? server.env : {};
147
+ const safe = {};
148
+ for (const [key, value] of Object.entries(env)) {
149
+ if (!isSafeNpmPreflightEnvKey(key))
150
+ continue;
151
+ if (typeof value === "string") {
152
+ safe[key] = value;
153
+ }
154
+ }
155
+ return safe;
156
+ }
157
+ function isNpmFamilyRuntimeServer(server) {
158
+ const command = typeof server.command === "string" ? basenameOfRuntimeCommand(server.command) : "";
159
+ return NPM_FAMILY_RUNTIME_COMMANDS.has(command);
160
+ }
161
+ function buildPreflightProbeCommand(server, concurrency) {
162
+ const command = typeof server.command === "string" ? server.command : "";
163
+ if (!command)
164
+ return null;
165
+ const commandName = basenameOfRuntimeCommand(command);
166
+ if (!NPM_FAMILY_RUNTIME_COMMANDS.has(commandName))
167
+ return null;
168
+ if (runtimeShellInlineScripts(server).length > 0)
169
+ return null;
170
+ const args = Array.isArray(server.args)
171
+ ? server.args.filter((arg) => typeof arg === "string")
172
+ : [];
173
+ const packageSpec = findPackageSpecifier(args, commandName);
174
+ if (!packageSpec)
175
+ return null;
176
+ return {
177
+ command: "npm",
178
+ args: [
179
+ "view",
180
+ packageSpec,
181
+ "version",
182
+ "--json",
183
+ "--prefer-offline",
184
+ "--no-audit",
185
+ "--no-fund",
186
+ "--progress=false",
187
+ "--loglevel=error",
188
+ "--fetch-retries=0",
189
+ "--fetch-retry-mintimeout=1000",
190
+ "--fetch-retry-maxtimeout=1000",
191
+ `--maxsockets=${Math.max(1, Math.min(16, concurrency))}`,
192
+ ],
193
+ env: {
194
+ ...runtimeNpmPreflightEnv(concurrency),
195
+ ...runtimeNpmPreflightServerEnv(server),
196
+ },
197
+ packageSpec,
198
+ };
199
+ }
200
+ function safePreflightProcessEnv() {
201
+ const safe = {};
202
+ for (const key of ["PATH", "Path", "HOME", "USERPROFILE", "TMP", "TMPDIR", "TEMP", "SystemRoot", "ComSpec"]) {
203
+ const value = process.env[key];
204
+ if (value !== undefined)
205
+ safe[key] = value;
206
+ }
207
+ return safe;
208
+ }
209
+ async function runPreflightProbe(probe, timeoutMs) {
210
+ try {
211
+ const result = await execa(probe.command, probe.args, {
212
+ env: { ...safePreflightProcessEnv(), ...probe.env },
213
+ extendEnv: false,
214
+ timeout: timeoutMs,
215
+ reject: false,
216
+ stdio: "pipe",
217
+ });
218
+ if (result.timedOut) {
219
+ return { failed: true, reason: "timeout", detail: `timeout after ${timeoutMs}ms` };
220
+ }
221
+ if (result.exitCode !== 0) {
222
+ return { failed: true, reason: "exit", detail: `exit ${result.exitCode}` };
223
+ }
224
+ return { failed: false };
225
+ }
226
+ catch (err) {
227
+ const code = err.code;
228
+ return { failed: true, reason: "exit", detail: code ? `spawn failed (${code})` : "spawn failed" };
229
+ }
230
+ }
231
+ export async function preflightRuntimeMcpServers(servers, options) {
232
+ const entries = Object.entries(servers);
233
+ const failed = new Set();
234
+ const details = new Map();
235
+ const results = [];
236
+ async function probeOne([name, server]) {
237
+ if (!isRecord(server) || typeof server.url === "string" || !isNpmFamilyRuntimeServer(server)) {
238
+ results.push({ name, status: "skipped", reason: "not-npm-family" });
239
+ return;
240
+ }
241
+ const probe = buildPreflightProbeCommand(server, options.concurrency);
242
+ if (!probe) {
243
+ results.push({ name, status: "skipped", reason: "no-package-spec" });
244
+ return;
245
+ }
246
+ const result = await runPreflightProbe(probe, options.timeoutMs);
247
+ if (result.failed) {
248
+ failed.add(name);
249
+ if (result.reason && result.detail) {
250
+ details.set(name, { reason: result.reason, detail: result.detail });
251
+ }
252
+ results.push({
253
+ name,
254
+ status: "failed",
255
+ reason: result.reason ?? "exit",
256
+ detail: formatPreflightFailureDetail(result.reason, result.detail),
257
+ packageSpec: probe.packageSpec,
258
+ });
259
+ return;
260
+ }
261
+ results.push({ name, status: "ok", packageSpec: probe.packageSpec });
262
+ }
263
+ const concurrency = Math.max(1, options.concurrency);
264
+ for (let i = 0; i < entries.length; i += concurrency) {
265
+ const batch = entries.slice(i, i + concurrency);
266
+ await Promise.all(batch.map(probeOne));
267
+ }
268
+ const order = new Map(entries.map(([name], index) => [name, index]));
269
+ results.sort((a, b) => (order.get(a.name) ?? 0) - (order.get(b.name) ?? 0));
270
+ return { failed, details, entries: results };
271
+ }
package/dist/util/fs.d.ts CHANGED
@@ -1,128 +1,8 @@
1
- import { SyncManifestEntry } from "./sync-manifest.js";
2
- import { type OmkRuntimeScope } from "./resource-profile.js";
3
- import { getProjectRootDiagnostics, resolveProjectRoot, resolveProjectRootAsync, displayProjectRootPath, type ProjectRootResolution, type ProjectRootSource } from "./project-root.js";
4
- export { getProjectRootDiagnostics, resolveProjectRoot, resolveProjectRootAsync, displayProjectRootPath, type ProjectRootResolution, type ProjectRootSource, };
5
- type KimiGlobalSyncStepName = "hooks" | "mcp" | "skills" | "memory";
6
- export interface KimiGlobalSyncOptions {
7
- dryRun?: boolean;
8
- diff?: boolean;
9
- quiet?: boolean;
10
- manifest?: SyncManifestEntry[];
11
- timestamp?: string;
12
- }
13
- export interface KimiGlobalSyncStepReport {
14
- name: KimiGlobalSyncStepName;
15
- changed: boolean;
16
- blocked: boolean;
17
- skipped: boolean;
18
- error?: string;
19
- manifest: SyncManifestEntry[];
20
- }
21
- export interface KimiGlobalSyncReport {
22
- changed: boolean;
23
- blocked: boolean;
24
- steps: KimiGlobalSyncStepReport[];
25
- actions: string[];
26
- skipped: string[];
27
- errors: string[];
28
- manifest: SyncManifestEntry[];
29
- }
30
- export declare function ensureDir(path: string): Promise<void>;
31
- export declare function writeFileSafe(path: string, content: string): Promise<void>;
32
- export declare function pathExists(path: string): Promise<boolean>;
33
- export interface RuntimeMcpPruneDiagnostic {
34
- name: string;
35
- kind: string;
36
- message: string;
37
- }
38
- export interface RuntimeMcpNormalization {
39
- name: string;
40
- kind: string;
41
- message: string;
42
- }
43
- export declare function getManifestPath(): string;
44
- export declare function getBackupDir(timestamp: string): string;
45
- export declare function readManifest(): Promise<SyncManifestEntry[]>;
46
- export declare function writeManifest(entries: SyncManifestEntry[]): Promise<void>;
47
- export declare function backupFile(sourcePath: string, backupDir: string, relativePath: string): Promise<string>;
48
- export declare function isDirectory(path: string): Promise<boolean>;
49
- export declare function readTextFile(path: string, defaultValue?: string): Promise<string>;
50
- export declare function getProjectRoot(): string;
51
- export declare function getProjectRootAsync(): Promise<string>;
52
- export declare function getUserHome(env?: NodeJS.ProcessEnv): string;
53
- export declare function normalizeUserHomePath(value: string | undefined): string | undefined;
54
- export declare function getOmkPath(subPath?: string): string;
55
- export { validateRunId, sanitizeRunId, validateRunArtifactPath, getRunsDir, getRunPath, getRunArtifactPath, listValidRunIds, } from "./run-store.js";
56
- export declare function getKimiConfigPath(): string;
57
- /**
58
- * .omk/kimi.config.toml 의 hooks 를 ~/.kimi/config.toml 에 병합.
59
- * 상대 경로를 절대 경로로 변환하여 어디서 실행돼도 작동하도록 함.
60
- */
61
- export declare function mergeKimiHooks(omkConfigPath: string, options?: KimiGlobalSyncOptions): Promise<boolean>;
62
- export declare function extractHooksBlocks(content: string): string;
63
- /** 프로젝트의 .omk/mcp.json + .kimi/mcp.json → ~/.kimi/mcp.json 병합 */
64
- export declare function syncKimiMcpGlobal(options?: KimiGlobalSyncOptions): Promise<boolean>;
65
- /** 프로젝트의 .kimi/skills/* → ~/.kimi/skills/ 심링크 */
66
- export declare function syncKimiSkillsGlobal(options?: KimiGlobalSyncOptions): Promise<boolean>;
67
- /** local graph memory policy를 ~/.kimi/omk.memory.toml 에 동기화 */
68
- export declare function syncKimiMemoryGlobal(options?: KimiGlobalSyncOptions): Promise<boolean>;
69
- /** Sync hooks + MCP + skills to ~/.kimi/ at once */
70
- export declare function syncAllKimiGlobals(options?: KimiGlobalSyncOptions): Promise<KimiGlobalSyncReport>;
71
- /** Canonical OMK MCP config collection with project `.kimi/mcp.json` compatibility. */
72
- export declare function collectMcpConfigs(scope?: OmkRuntimeScope): Promise<string[]>;
73
- export declare const STALE_PACKAGE_NAMES: Record<string, string>;
74
- export declare function diagnoseRuntimeMcpServer(name: string, server: unknown): Promise<RuntimeMcpPruneDiagnostic[]>;
75
- export type RuntimeMcpPreflightMode = "warn-skip" | "strict" | "off";
76
- export type RuntimeMcpPreflightFailureReason = "timeout" | "exit";
77
- export type RuntimeMcpPreflightEntryStatus = "ok" | "failed" | "skipped";
78
- export interface RuntimeMcpPreflightOptions {
79
- timeoutMs: number;
80
- concurrency: number;
81
- }
82
- export interface RuntimeMcpPreflightEntry {
83
- name: string;
84
- status: RuntimeMcpPreflightEntryStatus;
85
- reason?: RuntimeMcpPreflightFailureReason | "not-npm-family" | "no-package-spec";
86
- detail?: string;
87
- packageSpec?: string;
88
- }
89
- export interface RuntimeMcpPreflightResult {
90
- failed: Set<string>;
91
- details: Map<string, {
92
- reason: RuntimeMcpPreflightFailureReason;
93
- detail: string;
94
- }>;
95
- entries: RuntimeMcpPreflightEntry[];
96
- }
97
- export declare function resolveRuntimeMcpPreflightMode(env?: Record<string, string | undefined>): RuntimeMcpPreflightMode;
98
- export declare function resolveRuntimeMcpPreflightOptions(env?: Record<string, string | undefined>): RuntimeMcpPreflightOptions & {
99
- mode: RuntimeMcpPreflightMode;
100
- };
101
- export declare function preflightRuntimeMcpServers(servers: Record<string, unknown>, options: RuntimeMcpPreflightOptions): Promise<RuntimeMcpPreflightResult>;
102
- export declare function pruneRuntimeMcpServers(servers: Record<string, unknown>): Promise<{
103
- servers: Record<string, unknown>;
104
- diagnostics: RuntimeMcpPruneDiagnostic[];
105
- normalizations: RuntimeMcpNormalization[];
106
- }>;
107
- export declare function writeRuntimeMcpConfig(configPaths: string[], allowlist?: readonly string[]): Promise<string | null>;
108
- /** 프로젝트의 .kimi/skills 디렉토리 경로 */
109
- export declare function getKimiSkillsDir(): string;
110
- /** ~/.kimi/config.toml 에서 default_model 읽기 */
111
- export declare function getKimiDefaultModel(): Promise<string | null>;
112
- /** .omk/config.toml 에서 안전한 logo_image 경로 읽기 (상대경로는 프로젝트 루트 기준) */
113
- export declare function getOmkLogoImagePath(): Promise<string | null>;
114
- /**
115
- * Auto-generate a built-in omk-project MCP config so users never need to
116
- * define it manually in ~/.kimi/mcp.json or .kimi/mcp.json.
117
- * The config uses the currently-running omk CLI path and sets OMK_PROJECT_ROOT
118
- * to the current project root.
119
- */
120
- export declare function writeBuiltinMcpConfig(): Promise<string | null>;
121
- /** Kimi CLI 실행 인자에 model + MCP + Skills 주입 (전역 동기화는 별도) */
122
- export declare function injectKimiGlobals(args: string[], options?: {
123
- mcpScope?: OmkRuntimeScope;
124
- skillsScope?: OmkRuntimeScope;
125
- hooksScope?: OmkRuntimeScope;
126
- role?: string;
127
- mcpAllowlist?: readonly string[];
128
- }): Promise<void>;
1
+ export * from "./fs/core.js";
2
+ export * from "./fs/paths.js";
3
+ export * from "./fs/manifest.js";
4
+ export * from "./fs/kimi-sync.js";
5
+ export * from "./fs/mcp-diagnose.js";
6
+ export * from "./fs/preflight.js";
7
+ export * from "./fs/mcp-runtime-config.js";
8
+ export * from "./fs/logo.js";