@lumenflow/mcp 3.1.2 → 3.1.3

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 (95) hide show
  1. package/package.json +5 -5
  2. package/dist/bin.d.ts +0 -16
  3. package/dist/bin.d.ts.map +0 -1
  4. package/dist/bin.js.map +0 -1
  5. package/dist/cli-runner.d.ts +0 -58
  6. package/dist/cli-runner.d.ts.map +0 -1
  7. package/dist/cli-runner.js +0 -164
  8. package/dist/cli-runner.js.map +0 -1
  9. package/dist/index.d.ts +0 -37
  10. package/dist/index.d.ts.map +0 -1
  11. package/dist/index.js.map +0 -1
  12. package/dist/mcp-constants.d.ts +0 -173
  13. package/dist/mcp-constants.d.ts.map +0 -1
  14. package/dist/mcp-constants.js +0 -193
  15. package/dist/mcp-constants.js.map +0 -1
  16. package/dist/resources.d.ts +0 -53
  17. package/dist/resources.d.ts.map +0 -1
  18. package/dist/resources.js +0 -131
  19. package/dist/resources.js.map +0 -1
  20. package/dist/runtime-cache.d.ts +0 -7
  21. package/dist/runtime-cache.d.ts.map +0 -1
  22. package/dist/runtime-cache.js +0 -28
  23. package/dist/runtime-cache.js.map +0 -1
  24. package/dist/runtime-tool-resolver.constants.d.ts +0 -33
  25. package/dist/runtime-tool-resolver.constants.d.ts.map +0 -1
  26. package/dist/runtime-tool-resolver.constants.js +0 -35
  27. package/dist/runtime-tool-resolver.constants.js.map +0 -1
  28. package/dist/runtime-tool-resolver.d.ts +0 -5
  29. package/dist/runtime-tool-resolver.d.ts.map +0 -1
  30. package/dist/runtime-tool-resolver.js +0 -2030
  31. package/dist/runtime-tool-resolver.js.map +0 -1
  32. package/dist/server.d.ts +0 -58
  33. package/dist/server.d.ts.map +0 -1
  34. package/dist/server.js +0 -219
  35. package/dist/server.js.map +0 -1
  36. package/dist/tools/agent-tools.d.ts +0 -18
  37. package/dist/tools/agent-tools.d.ts.map +0 -1
  38. package/dist/tools/agent-tools.js +0 -235
  39. package/dist/tools/agent-tools.js.map +0 -1
  40. package/dist/tools/context-tools.d.ts +0 -13
  41. package/dist/tools/context-tools.d.ts.map +0 -1
  42. package/dist/tools/context-tools.js +0 -58
  43. package/dist/tools/context-tools.js.map +0 -1
  44. package/dist/tools/flow-tools.d.ts +0 -22
  45. package/dist/tools/flow-tools.d.ts.map +0 -1
  46. package/dist/tools/flow-tools.js +0 -130
  47. package/dist/tools/flow-tools.js.map +0 -1
  48. package/dist/tools/initiative-tools.d.ts +0 -34
  49. package/dist/tools/initiative-tools.d.ts.map +0 -1
  50. package/dist/tools/initiative-tools.js +0 -420
  51. package/dist/tools/initiative-tools.js.map +0 -1
  52. package/dist/tools/memory-tools.d.ts +0 -58
  53. package/dist/tools/memory-tools.d.ts.map +0 -1
  54. package/dist/tools/memory-tools.js +0 -523
  55. package/dist/tools/memory-tools.js.map +0 -1
  56. package/dist/tools/orchestration-tools.d.ts +0 -18
  57. package/dist/tools/orchestration-tools.d.ts.map +0 -1
  58. package/dist/tools/orchestration-tools.js +0 -202
  59. package/dist/tools/orchestration-tools.js.map +0 -1
  60. package/dist/tools/parity-tools.d.ts +0 -122
  61. package/dist/tools/parity-tools.d.ts.map +0 -1
  62. package/dist/tools/parity-tools.js +0 -1479
  63. package/dist/tools/parity-tools.js.map +0 -1
  64. package/dist/tools/runtime-task-constants.d.ts +0 -19
  65. package/dist/tools/runtime-task-constants.d.ts.map +0 -1
  66. package/dist/tools/runtime-task-constants.js +0 -21
  67. package/dist/tools/runtime-task-constants.js.map +0 -1
  68. package/dist/tools/runtime-task-tools.d.ts +0 -10
  69. package/dist/tools/runtime-task-tools.d.ts.map +0 -1
  70. package/dist/tools/runtime-task-tools.js +0 -116
  71. package/dist/tools/runtime-task-tools.js.map +0 -1
  72. package/dist/tools/setup-tools.d.ts +0 -34
  73. package/dist/tools/setup-tools.d.ts.map +0 -1
  74. package/dist/tools/setup-tools.js +0 -254
  75. package/dist/tools/setup-tools.js.map +0 -1
  76. package/dist/tools/validation-tools.d.ts +0 -26
  77. package/dist/tools/validation-tools.d.ts.map +0 -1
  78. package/dist/tools/validation-tools.js +0 -180
  79. package/dist/tools/validation-tools.js.map +0 -1
  80. package/dist/tools/wu-tools.d.ts +0 -101
  81. package/dist/tools/wu-tools.d.ts.map +0 -1
  82. package/dist/tools/wu-tools.js +0 -964
  83. package/dist/tools/wu-tools.js.map +0 -1
  84. package/dist/tools-shared.d.ts +0 -250
  85. package/dist/tools-shared.d.ts.map +0 -1
  86. package/dist/tools-shared.js +0 -403
  87. package/dist/tools-shared.js.map +0 -1
  88. package/dist/tools.d.ts +0 -97
  89. package/dist/tools.d.ts.map +0 -1
  90. package/dist/tools.js +0 -248
  91. package/dist/tools.js.map +0 -1
  92. package/dist/worktree-enforcement.d.ts +0 -32
  93. package/dist/worktree-enforcement.d.ts.map +0 -1
  94. package/dist/worktree-enforcement.js +0 -154
  95. package/dist/worktree-enforcement.js.map +0 -1
@@ -1,403 +0,0 @@
1
- // Copyright (c) 2026 Hellmai Ltd
2
- // SPDX-License-Identifier: AGPL-3.0-only
3
- /**
4
- * @file tools-shared.ts
5
- * @description Shared types, constants, error codes, and helpers used across MCP tool domain modules.
6
- *
7
- * WU-1642: Extracted from tools.ts during domain decomposition.
8
- */
9
- import { ExecutionContextSchema, TOOL_ERROR_CODES, } from '@lumenflow/kernel';
10
- import { z } from 'zod';
11
- import { runCliCommand } from './cli-runner.js';
12
- import { getRuntimeForWorkspace, resetMcpRuntimeCache, } from './runtime-cache.js';
13
- import { packToolCapabilityResolver } from './runtime-tool-resolver.js';
14
- import { McpEnvironmentVariables, MigrationCompatModes, MigrationFallbackErrorCodes, MigrationFallbackOutcomes, MigrationFallbackReasons, } from './mcp-constants.js';
15
- // Import core functions for context operations only (async to avoid circular deps)
16
- let coreModule = null;
17
- export async function getCore() {
18
- if (!coreModule) {
19
- coreModule = await import('@lumenflow/core');
20
- }
21
- return coreModule;
22
- }
23
- /**
24
- * WU-1859: Narrowed from wildcard write (`**` / `write`) to read-only.
25
- * Maintenance-mode operations should only need read access by default;
26
- * write scopes are declared explicitly per-tool via `contextInput.allowedScopes`.
27
- */
28
- export const DEFAULT_MAINTENANCE_SCOPE = {
29
- type: 'path',
30
- pattern: '**',
31
- access: 'read',
32
- };
33
- const MAINTENANCE_TASK_PREFIX = 'maintenance';
34
- const MAINTENANCE_SESSION_PREFIX = 'session-maintenance';
35
- const MAINTENANCE_CONTEXT_MODE = 'maintenance';
36
- const TASK_CONTEXT_MODE = 'task';
37
- const DEFAULT_FALLBACK_ERROR_CODE = 'TOOL_EXECUTE_ERROR';
38
- /**
39
- * WU-1866: Allowlist of error codes that MAY trigger CLI fallback.
40
- *
41
- * Default-deny: any error code NOT in this set is returned directly to the
42
- * caller without retrying via CLI. This prevents new kernel denial codes
43
- * (e.g., future AUTH_DENIED) from silently falling through to CLI fallback.
44
- *
45
- * Only TOOL_NOT_FOUND is allowed to fall back, for migration/backward compat
46
- * when a tool exists in CLI but hasn't been registered in the kernel yet.
47
- */
48
- export const FALLBACK_ALLOWED_ERROR_CODES = new Set([
49
- TOOL_ERROR_CODES.TOOL_NOT_FOUND,
50
- ]);
51
- /**
52
- * Error codes used by tool implementations
53
- */
54
- export const ErrorCodes = {
55
- MISSING_PARAMETER: 'MISSING_PARAMETER',
56
- CONTEXT_ERROR: 'CONTEXT_ERROR',
57
- WU_LIST_ERROR: 'WU_LIST_ERROR',
58
- WU_STATUS_ERROR: 'WU_STATUS_ERROR',
59
- WU_CREATE_ERROR: 'WU_CREATE_ERROR',
60
- WU_CLAIM_ERROR: 'WU_CLAIM_ERROR',
61
- WU_DONE_ERROR: 'WU_DONE_ERROR',
62
- WRONG_LOCATION: 'WRONG_LOCATION',
63
- GATES_ERROR: 'GATES_ERROR',
64
- WU_BLOCK_ERROR: 'WU_BLOCK_ERROR',
65
- WU_UNBLOCK_ERROR: 'WU_UNBLOCK_ERROR',
66
- WU_EDIT_ERROR: 'WU_EDIT_ERROR',
67
- WU_RELEASE_ERROR: 'WU_RELEASE_ERROR',
68
- WU_RECOVER_ERROR: 'WU_RECOVER_ERROR',
69
- WU_REPAIR_ERROR: 'WU_REPAIR_ERROR',
70
- WU_DEPS_ERROR: 'WU_DEPS_ERROR',
71
- WU_PREP_ERROR: 'WU_PREP_ERROR',
72
- WU_PREFLIGHT_ERROR: 'WU_PREFLIGHT_ERROR',
73
- WU_PRUNE_ERROR: 'WU_PRUNE_ERROR',
74
- WU_DELETE_ERROR: 'WU_DELETE_ERROR',
75
- WU_CLEANUP_ERROR: 'WU_CLEANUP_ERROR',
76
- WU_BRIEF_ERROR: 'WU_BRIEF_ERROR',
77
- WU_DELEGATE_ERROR: 'WU_DELEGATE_ERROR',
78
- WU_VALIDATE_ERROR: 'WU_VALIDATE_ERROR',
79
- WU_INFER_LANE_ERROR: 'WU_INFER_LANE_ERROR',
80
- WU_UNLOCK_LANE_ERROR: 'WU_UNLOCK_LANE_ERROR',
81
- TASK_CLAIM_ERROR: 'TASK_CLAIM_ERROR',
82
- TASK_CREATE_ERROR: 'TASK_CREATE_ERROR',
83
- TASK_COMPLETE_ERROR: 'TASK_COMPLETE_ERROR',
84
- TASK_BLOCK_ERROR: 'TASK_BLOCK_ERROR',
85
- TASK_UNBLOCK_ERROR: 'TASK_UNBLOCK_ERROR',
86
- TASK_INSPECT_ERROR: 'TASK_INSPECT_ERROR',
87
- TOOL_EXECUTE_ERROR: 'TOOL_EXECUTE_ERROR',
88
- BACKLOG_PRUNE_ERROR: 'BACKLOG_PRUNE_ERROR',
89
- DOCS_SYNC_ERROR: 'DOCS_SYNC_ERROR',
90
- GATES_ALIAS_ERROR: 'GATES_ALIAS_ERROR',
91
- LANE_HEALTH_ERROR: 'LANE_HEALTH_ERROR',
92
- LANE_SUGGEST_ERROR: 'LANE_SUGGEST_ERROR',
93
- LUMENFLOW_ALIAS_ERROR: 'LUMENFLOW_ALIAS_ERROR',
94
- LUMENFLOW_GATES_ERROR: 'LUMENFLOW_GATES_ERROR',
95
- LUMENFLOW_VALIDATE_ERROR: 'LUMENFLOW_VALIDATE_ERROR',
96
- LUMENFLOW_METRICS_ERROR: 'LUMENFLOW_METRICS_ERROR',
97
- METRICS_ERROR: 'METRICS_ERROR',
98
- STATE_BOOTSTRAP_ERROR: 'STATE_BOOTSTRAP_ERROR',
99
- STATE_CLEANUP_ERROR: 'STATE_CLEANUP_ERROR',
100
- STATE_DOCTOR_ERROR: 'STATE_DOCTOR_ERROR',
101
- SYNC_TEMPLATES_ALIAS_ERROR: 'SYNC_TEMPLATES_ALIAS_ERROR',
102
- FILE_READ_ERROR: 'FILE_READ_ERROR',
103
- FILE_WRITE_ERROR: 'FILE_WRITE_ERROR',
104
- FILE_EDIT_ERROR: 'FILE_EDIT_ERROR',
105
- FILE_DELETE_ERROR: 'FILE_DELETE_ERROR',
106
- // WU-1853: Worktree enforcement for MCP file tools
107
- WORKTREE_ENFORCEMENT_BLOCKED: 'WORKTREE_ENFORCEMENT_BLOCKED',
108
- GIT_STATUS_ERROR: 'GIT_STATUS_ERROR',
109
- GIT_DIFF_ERROR: 'GIT_DIFF_ERROR',
110
- GIT_LOG_ERROR: 'GIT_LOG_ERROR',
111
- GIT_BRANCH_ERROR: 'GIT_BRANCH_ERROR',
112
- INIT_PLAN_ERROR: 'INIT_PLAN_ERROR',
113
- PLAN_CREATE_ERROR: 'PLAN_CREATE_ERROR',
114
- PLAN_EDIT_ERROR: 'PLAN_EDIT_ERROR',
115
- PLAN_LINK_ERROR: 'PLAN_LINK_ERROR',
116
- PLAN_PROMOTE_ERROR: 'PLAN_PROMOTE_ERROR',
117
- SIGNAL_CLEANUP_ERROR: 'SIGNAL_CLEANUP_ERROR',
118
- CONFIG_SET_ERROR: 'CONFIG_SET_ERROR',
119
- CONFIG_GET_ERROR: 'CONFIG_GET_ERROR',
120
- WU_PROTO_ERROR: 'WU_PROTO_ERROR',
121
- // WU-1426: Flow/Metrics error codes
122
- FLOW_BOTTLENECKS_ERROR: 'FLOW_BOTTLENECKS_ERROR',
123
- FLOW_REPORT_ERROR: 'FLOW_REPORT_ERROR',
124
- METRICS_SNAPSHOT_ERROR: 'METRICS_SNAPSHOT_ERROR',
125
- // WU-1426: Validation error codes
126
- VALIDATE_ERROR: 'VALIDATE_ERROR',
127
- VALIDATE_AGENT_SKILLS_ERROR: 'VALIDATE_AGENT_SKILLS_ERROR',
128
- VALIDATE_AGENT_SYNC_ERROR: 'VALIDATE_AGENT_SYNC_ERROR',
129
- VALIDATE_BACKLOG_SYNC_ERROR: 'VALIDATE_BACKLOG_SYNC_ERROR',
130
- VALIDATE_SKILLS_SPEC_ERROR: 'VALIDATE_SKILLS_SPEC_ERROR',
131
- // WU-1426: Setup error codes
132
- LUMENFLOW_INIT_ERROR: 'LUMENFLOW_INIT_ERROR',
133
- LUMENFLOW_DOCTOR_ERROR: 'LUMENFLOW_DOCTOR_ERROR',
134
- LUMENFLOW_INTEGRATE_ERROR: 'LUMENFLOW_INTEGRATE_ERROR',
135
- LUMENFLOW_UPGRADE_ERROR: 'LUMENFLOW_UPGRADE_ERROR',
136
- LUMENFLOW_COMMANDS_ERROR: 'LUMENFLOW_COMMANDS_ERROR',
137
- LUMENFLOW_DOCS_SYNC_ERROR: 'LUMENFLOW_DOCS_SYNC_ERROR',
138
- LUMENFLOW_RELEASE_ERROR: 'LUMENFLOW_RELEASE_ERROR',
139
- LUMENFLOW_SYNC_TEMPLATES_ERROR: 'LUMENFLOW_SYNC_TEMPLATES_ERROR',
140
- };
141
- /**
142
- * Error messages used by tool implementations
143
- */
144
- export const ErrorMessages = {
145
- ID_REQUIRED: 'id is required',
146
- LANE_REQUIRED: 'lane is required',
147
- TITLE_REQUIRED: 'title is required',
148
- PATH_REQUIRED: 'path is required',
149
- CONTENT_REQUIRED: 'content is required',
150
- OLD_STRING_REQUIRED: 'old_string is required',
151
- NEW_STRING_REQUIRED: 'new_string is required',
152
- REASON_REQUIRED: 'reason is required',
153
- CLIENT_REQUIRED: 'client is required',
154
- PARENT_WU_REQUIRED: 'parent_wu is required',
155
- SECTION_REQUIRED: 'section is required',
156
- PLAN_REQUIRED: 'plan is required',
157
- KEY_REQUIRED: 'key is required',
158
- VALUE_REQUIRED: 'value is required',
159
- };
160
- /**
161
- * CLI argument constants for commonly used flags
162
- */
163
- export const CliArgs = {
164
- DESCRIPTION: '--description',
165
- INITIATIVE: '--initiative',
166
- PHASE: '--phase',
167
- JSON: '--json',
168
- DOCS_ONLY: '--docs-only',
169
- CODE_PATHS: '--code-paths',
170
- BASE_DIR: '--base-dir',
171
- ENCODING: '--encoding',
172
- // WU-1452: Commands using --format json (initiative:*, flow:*, metrics)
173
- FORMAT_JSON: ['--format', 'json'],
174
- DRY_RUN: '--dry-run',
175
- THRESHOLD: '--threshold',
176
- RECOVER: '--recover',
177
- WU: '--wu',
178
- // WU-1851: Governed flags (3+ tool threshold)
179
- FORCE: '--force',
180
- VERBOSE: '--verbose',
181
- QUIET: '--quiet',
182
- EXECUTE: '--execute',
183
- ID: '--id',
184
- LANE: '--lane',
185
- REASON: '--reason',
186
- PATH: '--path',
187
- FORMAT: '--format',
188
- SINCE: '--since',
189
- STATUS: '--status',
190
- };
191
- /**
192
- * Shared error messages to avoid duplication across different tool categories
193
- */
194
- export const SharedErrorMessages = {
195
- WU_REQUIRED: 'wu is required',
196
- INITIATIVE_REQUIRED: 'initiative is required',
197
- };
198
- export const SuccessMessages = {
199
- ALL_GATES_PASSED: 'All gates passed',
200
- };
201
- /**
202
- * Create a successful tool result
203
- */
204
- export function success(data) {
205
- return { success: true, data };
206
- }
207
- /**
208
- * Create an error tool result
209
- */
210
- export function error(message, code) {
211
- return { success: false, error: { message, code } };
212
- }
213
- export function buildGatesArgs(input, options = {}) {
214
- const args = [];
215
- if (options.forceDocsOnly || input.docs_only)
216
- args.push(CliArgs.DOCS_ONLY);
217
- if (input.full_lint)
218
- args.push('--full-lint');
219
- if (input.full_tests)
220
- args.push('--full-tests');
221
- if (input.full_coverage)
222
- args.push('--full-coverage');
223
- if (input.coverage_mode)
224
- args.push('--coverage-mode', input.coverage_mode);
225
- if (input.verbose)
226
- args.push(CliArgs.VERBOSE);
227
- return args;
228
- }
229
- export function buildMetricsArgs(input) {
230
- const args = [];
231
- if (input.subcommand)
232
- args.push(input.subcommand);
233
- if (input.days !== undefined)
234
- args.push('--days', String(input.days));
235
- if (input.format)
236
- args.push('--format', input.format);
237
- if (input.output)
238
- args.push('--output', input.output);
239
- if (input.dry_run)
240
- args.push('--dry-run');
241
- return args;
242
- }
243
- /**
244
- * Build common argument list for wu:brief / wu:delegate prompt tools.
245
- */
246
- export function buildWuPromptArgs(input) {
247
- const args = ['--id', input.id];
248
- if (input.client)
249
- args.push('--client', input.client);
250
- if (input.thinking)
251
- args.push('--thinking');
252
- if (input.budget)
253
- args.push('--budget', String(input.budget));
254
- if (input.parent_wu)
255
- args.push('--parent-wu', input.parent_wu);
256
- if (input.no_context)
257
- args.push('--no-context');
258
- return args;
259
- }
260
- function buildMaintenanceSuffix(timestamp) {
261
- return timestamp.getTime().toString(36);
262
- }
263
- export function buildExecutionContext(input = {}) {
264
- const now = input.now ?? (() => new Date());
265
- const timestamp = now();
266
- const maintenanceSuffix = buildMaintenanceSuffix(timestamp);
267
- const taskId = input.taskId ?? `${MAINTENANCE_TASK_PREFIX}-${maintenanceSuffix}`;
268
- const runId = input.runId ?? `run-${taskId}-${maintenanceSuffix}`;
269
- const sessionId = input.sessionId ?? `${MAINTENANCE_SESSION_PREFIX}-${maintenanceSuffix}`;
270
- const invocationMode = input.taskId ? TASK_CONTEXT_MODE : MAINTENANCE_CONTEXT_MODE;
271
- return ExecutionContextSchema.parse({
272
- run_id: runId,
273
- task_id: taskId,
274
- session_id: sessionId,
275
- allowed_scopes: input.allowedScopes ?? [DEFAULT_MAINTENANCE_SCOPE],
276
- metadata: {
277
- invocation_mode: invocationMode,
278
- ...(input.metadata ?? {}),
279
- },
280
- });
281
- }
282
- export function resetExecuteViaPackRuntimeCache() {
283
- resetMcpRuntimeCache();
284
- }
285
- async function runtimeFactoryForPack(workspaceRoot) {
286
- return getRuntimeForWorkspace(workspaceRoot, packToolCapabilityResolver);
287
- }
288
- function resolveMigrationCompatMode(mode) {
289
- if (mode) {
290
- return mode;
291
- }
292
- const envMode = process.env[McpEnvironmentVariables.MIGRATION_COMPAT_MODE]?.trim().toLowerCase();
293
- return envMode === MigrationCompatModes.COMPAT
294
- ? MigrationCompatModes.COMPAT
295
- : MigrationCompatModes.STRICT;
296
- }
297
- function buildMigrationFallbackTelemetryEvent(options) {
298
- return {
299
- toolName: options.toolName,
300
- reason: options.reason,
301
- workspaceRoot: options.workspaceRoot,
302
- command: options.command,
303
- args: options.args,
304
- mode: options.mode,
305
- outcome: options.outcome,
306
- };
307
- }
308
- export async function executeViaPack(toolName, toolInput, options) {
309
- const projectRoot = options.projectRoot ?? process.cwd();
310
- const runtimeFactory = options.runtimeFactory ?? runtimeFactoryForPack;
311
- const cliRunner = options.cliRunner ?? runCliCommand;
312
- const executionContext = options.context ?? buildExecutionContext(options.contextInput);
313
- const compatMode = resolveMigrationCompatMode(options.migrationCompatMode);
314
- let runtimeFailureMessage;
315
- let fallbackReason;
316
- // Separate runtime init from tool execution so that init failures
317
- // (factory throws) still fall back to CLI, while executeTool failures
318
- // are handled by the allowlist below.
319
- let runtime;
320
- try {
321
- runtime = await runtimeFactory(projectRoot);
322
- }
323
- catch (cause) {
324
- runtimeFailureMessage = cause.message;
325
- fallbackReason = MigrationFallbackReasons.RUNTIME_INIT_FAILED;
326
- }
327
- if (runtime) {
328
- try {
329
- const runtimeResult = await runtime.executeTool(toolName, toolInput, executionContext);
330
- if (runtimeResult.success) {
331
- return success(runtimeResult);
332
- }
333
- // WU-1866: Allowlist pattern -- only error codes in
334
- // FALLBACK_ALLOWED_ERROR_CODES may trigger CLI fallback.
335
- // All other codes (including unknown/future codes) are returned
336
- // directly. This is default-deny for fallback.
337
- const errorCode = runtimeResult.error?.code;
338
- if (!errorCode || !FALLBACK_ALLOWED_ERROR_CODES.has(errorCode)) {
339
- return error(runtimeResult.error?.message ?? `${toolName} failed`, errorCode ?? DEFAULT_FALLBACK_ERROR_CODE);
340
- }
341
- runtimeFailureMessage = runtimeResult.error?.message;
342
- fallbackReason = MigrationFallbackReasons.RUNTIME_TOOL_NOT_FOUND;
343
- }
344
- catch (cause) {
345
- // WU-1866: Thrown exceptions from executeTool are returned directly.
346
- // They represent unexpected runtime failures that should not be
347
- // silently retried via CLI.
348
- return error(cause.message, DEFAULT_FALLBACK_ERROR_CODE);
349
- }
350
- }
351
- if (fallbackReason && compatMode === MigrationCompatModes.STRICT) {
352
- options.onFallbackTelemetry?.(buildMigrationFallbackTelemetryEvent({
353
- toolName,
354
- reason: fallbackReason,
355
- workspaceRoot: projectRoot,
356
- command: options.fallback.command,
357
- args: options.fallback.args ?? [],
358
- mode: compatMode,
359
- outcome: MigrationFallbackOutcomes.BLOCKED,
360
- }));
361
- const strictMessageDetail = runtimeFailureMessage ??
362
- `runtime fallback reason: ${fallbackReason === MigrationFallbackReasons.RUNTIME_INIT_FAILED ? 'runtime initialization failed' : 'runtime reported tool not found'}`;
363
- return error(`Migration fallback is disabled in strict mode for ${toolName}: ${strictMessageDetail}`, MigrationFallbackErrorCodes.DISABLED);
364
- }
365
- const fallbackResult = await cliRunner(options.fallback.command, options.fallback.args ?? [], {
366
- projectRoot,
367
- ...(options.fallbackCliOptions ?? {}),
368
- });
369
- const fallbackTelemetry = fallbackReason
370
- ? buildMigrationFallbackTelemetryEvent({
371
- toolName,
372
- reason: fallbackReason,
373
- workspaceRoot: projectRoot,
374
- command: options.fallback.command,
375
- args: options.fallback.args ?? [],
376
- mode: compatMode,
377
- outcome: fallbackResult.success
378
- ? MigrationFallbackOutcomes.SUCCEEDED
379
- : MigrationFallbackOutcomes.FAILED,
380
- })
381
- : undefined;
382
- if (fallbackTelemetry) {
383
- options.onFallbackTelemetry?.(fallbackTelemetry);
384
- }
385
- if (fallbackResult.success) {
386
- return success({
387
- message: fallbackResult.stdout || `${options.fallback.command} succeeded`,
388
- ...(fallbackTelemetry ? { fallbackTelemetry } : {}),
389
- });
390
- }
391
- const fallbackErrorCode = fallbackReason && compatMode === MigrationCompatModes.COMPAT
392
- ? (options.fallback.migrationErrorCode ??
393
- options.fallback.errorCode ??
394
- MigrationFallbackErrorCodes.EXECUTION_FAILED)
395
- : (options.fallback.errorCode ?? DEFAULT_FALLBACK_ERROR_CODE);
396
- return error(fallbackResult.stderr ||
397
- fallbackResult.error?.message ||
398
- runtimeFailureMessage ||
399
- `${options.fallback.command} failed`, fallbackErrorCode);
400
- }
401
- // Re-export cli-runner types used by domain modules
402
- export { runCliCommand };
403
- //# sourceMappingURL=tools-shared.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tools-shared.js","sourceRoot":"","sources":["../src/tools-shared.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,yCAAyC;AAEzC;;;;;GAKG;AAEH,OAAO,EACL,sBAAsB,EACtB,gBAAgB,GAGjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAA+C,MAAM,iBAAiB,CAAC;AAC7F,OAAO,EACL,sBAAsB,EACtB,oBAAoB,GAErB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,2BAA2B,EAC3B,yBAAyB,EACzB,wBAAwB,GAIzB,MAAM,oBAAoB,CAAC;AAE5B,mFAAmF;AACnF,IAAI,UAAU,GAA4C,IAAI,CAAC;AAE/D,MAAM,CAAC,KAAK,UAAU,OAAO;IAC3B,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,UAAU,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAc;IAClD,IAAI,EAAE,MA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yB,CAAC,SAAS;gBACrC,CAAC,CAAC,yBAAyB,CAAC,MAAM;SACrC,CAAC;QACJ,CAAC,CAAC,SAAS,CAAC;IACd,IAAI,iBAAiB,EAAE,CAAC;QACtB,OAAO,CAAC,mBAAmB,EAAE,CAAC,iBAAiB,CAAC,CAAC;IACnD,CAAC;IACD,IAAI,cAAc,CAAC,OAAO,EAAE,CAAC;QAC3B,OAAO,OAAO,CAAC;YACb,OAAO,EAAE,cAAc,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,YAAY;YACzE,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACpD,CAAC,CAAC;IACL,CAAC;IAED,MAAM,iBAAiB,GACrB,cAAc,IAAI,UAAU,KAAK,oBAAoB,CAAC,MAAM;QAC1D,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,kBAAkB;YACpC,OAAO,CAAC,QAAQ,CAAC,SAAS;YAC1B,2BAA2B,CAAC,gBAAgB,CAAC;QAC/C,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,SAAS,IAAI,2BAA2B,CAAC,CAAC;IAElE,OAAO,KAAK,CACV,cAAc,CAAC,MAAM;QACnB,cAAc,CAAC,KAAK,EAAE,OAAO;QAC7B,qBAAqB;QACrB,GAAG,OAAO,CAAC,QAAQ,CAAC,OAAO,SAAS,EACtC,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAED,oDAAoD;AACpD,OAAO,EAAE,aAAa,EAAyB,CAAC"}
package/dist/tools.d.ts DELETED
@@ -1,97 +0,0 @@
1
- /**
2
- * @file tools.ts
3
- * @description MCP tool barrel - re-exports all domain tool modules and assembles the allTools registry.
4
- *
5
- * WU-1642: Decomposed from monolithic tools.ts into domain-scoped modules:
6
- * - tools-shared.ts: Types, constants, helpers shared across domains
7
- * - tools/context-tools.ts: context_get, wu_list
8
- * - tools/wu-tools.ts: WU lifecycle (create, claim, done, block, edit, etc.)
9
- * - tools/initiative-tools.ts: Initiative operations
10
- * - tools/memory-tools.ts: Memory operations
11
- * - tools/agent-tools.ts: Agent session/issue operations
12
- * - tools/orchestration-tools.ts: Orchestration + spawn operations
13
- * - tools/flow-tools.ts: Flow/metrics operations
14
- * - tools/validation-tools.ts: Validation operations
15
- * - tools/setup-tools.ts: Setup/LumenFlow operations
16
- * - tools/parity-tools.ts: Wave-1 + Wave-2 public parity operations
17
- *
18
- * WU-1412: Tools available: context_get, wu_list, wu_status, wu_create, wu_claim, wu_done, gates_run
19
- * WU-1422: Additional WU tools
20
- * WU-1424: Initiative tools, Memory tools
21
- * WU-1425: Agent tools, Orchestration tools, Spawn tools
22
- * WU-1426: Flow/Metrics tools, Validation tools, Setup tools
23
- * WU-1431: Uses shared Zod schemas from @lumenflow/core for CLI/MCP parity
24
- * WU-1454: All 16 WU lifecycle commands now use shared schemas
25
- * WU-1456: Memory commands use shared schemas where available
26
- * WU-1457: All remaining commands use shared schemas
27
- * WU-1482: Wave-1 public parity tools
28
- * WU-1483: Wave-2 public parity tools
29
- * WU-1952: CLI added pack:author; MCP parity follow-up remains tracked explicitly in INIT-032.
30
- */
31
- export type { ToolResult, ToolDefinition } from './tools-shared.js';
32
- export { contextGetTool, wuListTool } from './tools/context-tools.js';
33
- export { wuStatusTool, wuCreateTool, wuClaimTool, wuSandboxTool, wuDoneTool, gatesRunTool, wuBlockTool, wuUnblockTool, wuEditTool, wuReleaseTool, wuRecoverTool, wuRepairTool, wuDepsTool, wuPrepTool, wuPreflightTool, wuPruneTool, wuDeleteTool, wuCleanupTool, wuBriefTool, wuDelegateTool, wuValidateTool, wuInferLaneTool, wuUnlockLaneTool, } from './tools/wu-tools.js';
34
- export { taskBlockTool, taskClaimTool, taskCompleteTool, taskCreateTool, taskInspectTool, taskToolExecuteTool, taskUnblockTool, } from './tools/runtime-task-tools.js';
35
- export { initiativeListTool, initiativeStatusTool, initiativeCreateTool, initiativeEditTool, initiativeAddWuTool, initiativeRemoveWuTool, initiatiBulkAssignTool, initiativePlanTool, } from './tools/initiative-tools.js';
36
- export { memInitTool, memStartTool, memReadyTool, memCheckpointTool, memCleanupTool, memContextTool, memCreateTool, memDeleteTool, memExportTool, memInboxTool, memSignalTool, memSummarizeTool, memTriageTool, memRecoverTool, } from './tools/memory-tools.js';
37
- export { agentSessionTool, agentSessionEndTool, agentLogIssueTool, agentIssuesQueryTool, } from './tools/agent-tools.js';
38
- export { orchestrateInitiativeTool, orchestrateInitStatusTool, orchestrateMonitorTool, delegationListTool, } from './tools/orchestration-tools.js';
39
- export { flowBottlenecksTool, flowReportTool, metricsSnapshotTool, lumenflowMetricsTool, metricsTool, } from './tools/flow-tools.js';
40
- export { validateTool, validateAgentSkillsTool, validateAgentSyncTool, validateBacklogSyncTool, validateSkillsSpecTool, lumenflowValidateTool, } from './tools/validation-tools.js';
41
- export { lumenflowInitTool, lumenflowDoctorTool, lumenflowIntegrateTool, lumenflowUpgradeTool, lumenflowCommandsTool, lumenflowDocsSyncTool, lumenflowReleaseTool, lumenflowSyncTemplatesTool, } from './tools/setup-tools.js';
42
- export { backlogPruneTool, docsSyncTool, gatesTool, gatesDocsTool, laneHealthTool, laneSuggestTool, lumenflowTool, lumenflowGatesTool, stateBootstrapTool, stateCleanupTool, stateDoctorTool, syncTemplatesTool, fileReadTool, fileWriteTool, fileEditTool, fileDeleteTool, gitStatusTool, gitDiffTool, gitLogTool, gitBranchTool, initPlanTool, planCreateTool, planEditTool, planLinkTool, planPromoteTool, signalCleanupTool, configSetTool, configGetTool, wuProtoTool, } from './tools/parity-tools.js';
43
- import type { ToolDefinition } from './tools-shared.js';
44
- /**
45
- * MCP parity exclusions for tools that are intentionally MCP-only or maintainer-only.
46
- *
47
- * These names are excluded from strict public CLI parity comparison because
48
- * they have no public command in packages/@lumenflow/cli/src/public-manifest.ts.
49
- */
50
- export declare const MCP_PUBLIC_PARITY_ALLOWED_EXTRA_TOOLS: readonly ["context_get", "gates_run", "initiative_remove_wu", "task_block", "task_complete", "task_create", "task_inspect", "task_unblock", "tool_execute", "validate_agent_skills", "validate_agent_sync", "validate_backlog_sync", "validate_skills_spec", "wu_list"];
51
- /**
52
- * Public CLI commands intentionally out of MCP scope.
53
- *
54
- * These normalized command names are excluded from the "missing" parity
55
- * calculation so MCP parity reflects the supported public MCP surface.
56
- */
57
- export declare const MCP_PUBLIC_PARITY_ALLOWED_MISSING_TOOLS: readonly ["lane_edit", "lane_lock", "lane_setup", "lane_status", "lane_validate", "pack_scaffold"];
58
- export interface McpManifestParityReport {
59
- missing: string[];
60
- allowedExtra: string[];
61
- unexpectedExtra: string[];
62
- }
63
- /**
64
- * Normalize public CLI command names to MCP tool naming.
65
- *
66
- * Example:
67
- * - "wu:create" -> "wu_create"
68
- * - "plan:promote" -> "plan_promote"
69
- */
70
- export declare function normalizePublicManifestCommandName(commandName: string): string;
71
- /**
72
- * Compare public CLI manifest command names against MCP tool names.
73
- */
74
- export declare function buildMcpManifestParityReport(manifestCommandNames: readonly string[], mcpToolNames: readonly string[]): McpManifestParityReport;
75
- /**
76
- * All available tools
77
- */
78
- export declare const allTools: ToolDefinition[];
79
- /**
80
- * Runtime-backed additive MCP tools.
81
- *
82
- * These are intentionally isolated from legacy CLI-shell tools so we can
83
- * migrate command-by-command without breaking parity gates.
84
- *
85
- * NOTE:
86
- * `allTools` remains the legacy parity baseline for strict CLI parity checks
87
- * that intentionally ignore runtime migration deltas.
88
- *
89
- * Phase-4 closure metrics use `registeredTools` (production registry) so
90
- * runtime-migrated tools are measured against the real server surface.
91
- */
92
- export declare const runtimeTaskTools: ToolDefinition[];
93
- /**
94
- * Production MCP registry consumed by server startup.
95
- */
96
- export declare const registeredTools: ToolDefinition[];
97
- //# sourceMappingURL=tools.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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