@a5c-ai/babysitter-sdk 5.0.1-staging.71bb37a4 → 5.0.1-staging.75c8fb21
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/README.md +68 -0
- package/dist/breakpoints/evaluator.d.ts.map +1 -1
- package/dist/breakpoints/evaluator.js +31 -3
- package/dist/breakpoints/index.d.ts +2 -5
- package/dist/breakpoints/index.d.ts.map +1 -1
- package/dist/breakpoints/index.js +4 -20
- package/dist/breakpoints/proven-verification.d.ts +51 -0
- package/dist/breakpoints/proven-verification.d.ts.map +1 -0
- package/dist/breakpoints/proven-verification.js +120 -0
- package/dist/cli/commands/breakpointRules.d.ts.map +1 -1
- package/dist/cli/commands/breakpointRules.js +30 -27
- package/dist/cli/commands/compressOutput.d.ts.map +1 -1
- package/dist/cli/commands/compressOutput.js +9 -345
- package/dist/cli/commands/compressOutputHelpers.d.ts +15 -0
- package/dist/cli/commands/compressOutputHelpers.d.ts.map +1 -0
- package/dist/cli/commands/compressOutputHelpers.js +367 -0
- package/dist/cli/commands/costStats.d.ts.map +1 -1
- package/dist/cli/commands/costStats.js +35 -27
- package/dist/cli/commands/harness/install.d.ts +9 -0
- package/dist/cli/commands/harness/install.d.ts.map +1 -1
- package/dist/cli/commands/harness/install.js +20 -31
- package/dist/cli/commands/health/checks.d.ts +10 -0
- package/dist/cli/commands/health/checks.d.ts.map +1 -0
- package/dist/cli/commands/health/checks.js +268 -0
- package/dist/cli/commands/health/environment.d.ts.map +1 -1
- package/dist/cli/commands/health/environment.js +11 -1
- package/dist/cli/commands/health.d.ts +0 -15
- package/dist/cli/commands/health.d.ts.map +1 -1
- package/dist/cli/commands/health.js +5 -300
- package/dist/cli/commands/hooks/run.d.ts.map +1 -1
- package/dist/cli/commands/hooks/run.js +3 -2
- package/dist/cli/commands/instructions.d.ts +1 -1
- package/dist/cli/commands/instructions.d.ts.map +1 -1
- package/dist/cli/commands/instructions.js +72 -6
- package/dist/cli/commands/mcpServe.d.ts +2 -9
- package/dist/cli/commands/mcpServe.d.ts.map +1 -1
- package/dist/cli/commands/mcpServe.js +5 -29
- package/dist/cli/commands/runIterate.d.ts.map +1 -1
- package/dist/cli/commands/runIterate.js +7 -214
- package/dist/cli/commands/runIterateHelpers.d.ts +29 -0
- package/dist/cli/commands/runIterateHelpers.d.ts.map +1 -0
- package/dist/cli/commands/runIterateHelpers.js +134 -0
- package/dist/cli/commands/session/associate.d.ts.map +1 -1
- package/dist/cli/commands/session/associate.js +4 -36
- package/dist/cli/commands/session/iterationMessage.d.ts.map +1 -1
- package/dist/cli/commands/session/iterationMessage.js +9 -54
- package/dist/cli/commands/session/resume.d.ts.map +1 -1
- package/dist/cli/commands/session/resume.js +6 -16
- package/dist/cli/commands/skill/discoveryLocal.d.ts +1 -1
- package/dist/cli/commands/skill/discoveryLocal.d.ts.map +1 -1
- package/dist/cli/commands/skill.d.ts +1 -1
- package/dist/cli/commands/skill.d.ts.map +1 -1
- package/dist/cli/commands/skill.js +13 -12
- package/dist/cli/commands/tokensStats.d.ts.map +1 -1
- package/dist/cli/commands/tokensStats.js +40 -157
- package/dist/cli/commands/tokensStatsFormatting.d.ts +9 -0
- package/dist/cli/commands/tokensStatsFormatting.d.ts.map +1 -0
- package/dist/cli/commands/tokensStatsFormatting.js +137 -0
- package/dist/cli/main/argFlagParsers.d.ts +9 -0
- package/dist/cli/main/argFlagParsers.d.ts.map +1 -0
- package/dist/cli/main/argFlagParsers.js +346 -0
- package/dist/cli/main/argFlags.d.ts +1 -3
- package/dist/cli/main/argFlags.d.ts.map +1 -1
- package/dist/cli/main/argFlags.js +3 -343
- package/dist/cli/main/args.d.ts.map +1 -1
- package/dist/cli/main/args.js +4 -27
- package/dist/cli/main/dispatchRunSession.js +0 -10
- package/dist/cli/main/program.js +1 -1
- package/dist/cli/main/runCreate.js +2 -2
- package/dist/cli/main/runSupport.d.ts +9 -1
- package/dist/cli/main/runSupport.d.ts.map +1 -1
- package/dist/cli/main/runSupport.js +71 -1
- package/dist/cli/main/usage.d.ts.map +1 -1
- package/dist/cli/main/usage.js +43 -42
- package/dist/config/configValidation.d.ts +22 -0
- package/dist/config/configValidation.d.ts.map +1 -0
- package/dist/config/configValidation.js +140 -0
- package/dist/config/defaults.d.ts +3 -126
- package/dist/config/defaults.d.ts.map +1 -1
- package/dist/config/defaults.js +10 -258
- package/dist/config/index.d.ts +3 -2
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +15 -2
- package/dist/config/runs.d.ts +22 -0
- package/dist/config/runs.d.ts.map +1 -0
- package/dist/config/runs.js +192 -0
- package/dist/cost/index.d.ts +0 -1
- package/dist/cost/index.d.ts.map +1 -1
- package/dist/cost/index.js +2 -3
- package/dist/cost/pricing.d.ts +19 -0
- package/dist/cost/pricing.d.ts.map +1 -0
- package/dist/cost/pricing.js +135 -0
- package/dist/cost/types.d.ts +2 -79
- package/dist/cost/types.d.ts.map +1 -1
- package/dist/cost/types.js +8 -220
- package/dist/harness/BaseAdapter.d.ts +93 -0
- package/dist/harness/BaseAdapter.d.ts.map +1 -0
- package/dist/harness/BaseAdapter.js +236 -0
- package/dist/harness/adapters/claude-code.d.ts +24 -0
- package/dist/harness/adapters/claude-code.d.ts.map +1 -0
- package/dist/harness/adapters/claude-code.js +63 -0
- package/dist/harness/adapters/codex.d.ts +12 -0
- package/dist/harness/adapters/codex.d.ts.map +1 -0
- package/dist/harness/adapters/codex.js +37 -0
- package/dist/harness/adapters/cursor.d.ts +13 -0
- package/dist/harness/adapters/cursor.d.ts.map +1 -0
- package/dist/harness/adapters/cursor.js +85 -0
- package/dist/harness/adapters/gemini-cli.d.ts +12 -0
- package/dist/harness/adapters/gemini-cli.d.ts.map +1 -0
- package/dist/harness/adapters/gemini-cli.js +34 -0
- package/dist/harness/adapters/github-copilot.d.ts +13 -0
- package/dist/harness/adapters/github-copilot.d.ts.map +1 -0
- package/dist/harness/adapters/github-copilot.js +59 -0
- package/dist/harness/adapters/index.d.ts +12 -0
- package/dist/harness/adapters/index.d.ts.map +1 -0
- package/dist/harness/adapters/index.js +26 -0
- package/dist/harness/adapters/oh-my-pi.d.ts +12 -0
- package/dist/harness/adapters/oh-my-pi.d.ts.map +1 -0
- package/dist/harness/adapters/oh-my-pi.js +41 -0
- package/dist/harness/adapters/openclaw.d.ts +12 -0
- package/dist/harness/adapters/openclaw.d.ts.map +1 -0
- package/dist/harness/adapters/openclaw.js +49 -0
- package/dist/harness/adapters/opencode.d.ts +12 -0
- package/dist/harness/adapters/opencode.d.ts.map +1 -0
- package/dist/harness/adapters/opencode.js +51 -0
- package/dist/harness/adapters/pi.d.ts +12 -0
- package/dist/harness/adapters/pi.d.ts.map +1 -0
- package/dist/harness/adapters/pi.js +41 -0
- package/dist/harness/amuxFallbackMetadata.d.ts +3 -0
- package/dist/harness/amuxFallbackMetadata.d.ts.map +1 -0
- package/dist/harness/amuxFallbackMetadata.js +193 -0
- package/dist/harness/amuxMetadata.d.ts +51 -0
- package/dist/harness/amuxMetadata.d.ts.map +1 -0
- package/dist/harness/amuxMetadata.js +176 -0
- package/dist/harness/customAdapter.js +1 -1
- package/dist/harness/derivePromptContext.d.ts +75 -0
- package/dist/harness/derivePromptContext.d.ts.map +1 -0
- package/dist/harness/derivePromptContext.js +120 -0
- package/dist/harness/discovery.d.ts +21 -1
- package/dist/harness/discovery.d.ts.map +1 -1
- package/dist/harness/discovery.js +70 -0
- package/dist/harness/hooks/babysitterHooks.d.ts +23 -0
- package/dist/harness/hooks/babysitterHooks.d.ts.map +1 -0
- package/dist/harness/hooks/babysitterHooks.js +162 -0
- package/dist/harness/hooks/promptContexts.d.ts +19 -0
- package/dist/harness/hooks/promptContexts.d.ts.map +1 -0
- package/dist/harness/hooks/promptContexts.js +183 -0
- package/dist/harness/hooks/runState.d.ts.map +1 -1
- package/dist/harness/hooks/runState.js +13 -28
- package/dist/harness/hooks/sessionBinding.d.ts +28 -0
- package/dist/harness/hooks/sessionBinding.d.ts.map +1 -0
- package/dist/harness/hooks/sessionBinding.js +145 -0
- package/dist/harness/{claudeCode/stopHookState.d.ts → hooks/stopHookContinuation.d.ts} +8 -2
- package/dist/harness/hooks/stopHookContinuation.d.ts.map +1 -0
- package/dist/harness/{claudeCode/stopHookState.js → hooks/stopHookContinuation.js} +22 -21
- package/dist/harness/hooks/stopHookHandler.d.ts +35 -0
- package/dist/harness/hooks/stopHookHandler.d.ts.map +1 -0
- package/dist/harness/hooks/stopHookHandler.js +371 -0
- package/dist/harness/hooks/utils.d.ts +29 -0
- package/dist/harness/hooks/utils.d.ts.map +1 -1
- package/dist/harness/hooks/utils.js +90 -0
- package/dist/harness/index.d.ts +12 -9
- package/dist/harness/index.d.ts.map +1 -1
- package/dist/harness/index.js +20 -14
- package/dist/harness/install.d.ts +75 -0
- package/dist/harness/install.d.ts.map +1 -0
- package/dist/harness/install.js +199 -0
- package/dist/harness/installSupport.d.ts.map +1 -1
- package/dist/harness/installSupport.js +19 -0
- package/dist/harness/internal/promptContext.js +1 -1
- package/dist/harness/registry.d.ts +11 -2
- package/dist/harness/registry.d.ts.map +1 -1
- package/dist/harness/registry.js +110 -53
- package/dist/harness/types.d.ts +19 -2
- package/dist/harness/types.d.ts.map +1 -1
- package/dist/harness/unified/adapter.d.ts +5 -5
- package/dist/harness/unified/adapter.d.ts.map +1 -1
- package/dist/harness/unified/adapter.js +57 -26
- package/dist/harness/unified/capabilities.d.ts +5 -5
- package/dist/harness/unified/capabilities.js +7 -7
- package/dist/harness/unified/discovery.d.ts +1 -1
- package/dist/harness/unified/discovery.js +2 -2
- package/dist/harness/unified/promptContext.d.ts +1 -1
- package/dist/harness/unified/promptContext.js +2 -2
- package/dist/harness/unified/subprocess.d.ts +5 -5
- package/dist/harness/unified/subprocess.d.ts.map +1 -1
- package/dist/harness/unified/subprocess.js +10 -7
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/mcp/index.d.ts +0 -4
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +4 -9
- package/dist/mcp/tools/discovery.d.ts.map +1 -1
- package/dist/mcp/tools/discovery.js +3 -2
- package/dist/mcp/tools/sessions.d.ts.map +1 -1
- package/dist/mcp/tools/sessions.js +2 -8
- package/dist/mcp/transport/index.d.ts +0 -4
- package/dist/mcp/transport/index.d.ts.map +1 -1
- package/dist/mcp/transport/index.js +1 -8
- package/dist/mcp/util/resolve-run-dir.d.ts +1 -1
- package/dist/mcp/util/resolve-run-dir.d.ts.map +1 -1
- package/dist/mcp/util/resolve-run-dir.js +3 -39
- package/dist/plugins/marketplace.d.ts +1 -47
- package/dist/plugins/marketplace.d.ts.map +1 -1
- package/dist/plugins/marketplace.js +6 -186
- package/dist/plugins/marketplaceHelpers.d.ts +15 -0
- package/dist/plugins/marketplaceHelpers.d.ts.map +1 -0
- package/dist/plugins/marketplaceHelpers.js +114 -0
- package/dist/processLibrary/active.d.ts +2 -83
- package/dist/processLibrary/active.d.ts.map +1 -1
- package/dist/processLibrary/active.js +65 -167
- package/dist/processLibrary/activeTypes.d.ts +82 -0
- package/dist/processLibrary/activeTypes.d.ts.map +1 -0
- package/dist/processLibrary/activeTypes.js +6 -0
- package/dist/prompts/compose.js +1 -1
- package/dist/prompts/context.d.ts +1 -9
- package/dist/prompts/context.d.ts.map +1 -1
- package/dist/prompts/context.js +12 -20
- package/dist/prompts/parts/criticalRules.js +1 -1
- package/dist/prompts/parts/runCreation.d.ts.map +1 -1
- package/dist/prompts/parts/runCreation.js +2 -12
- package/dist/prompts/templates/commands/doctor.md +5 -5
- package/dist/prompts/templates/critical-rules.md +2 -2
- package/dist/prompts/templates/effects.md +1 -1
- package/dist/prompts/templates/iteration.md +1 -1
- package/dist/prompts/templates/process-guidelines.md +1 -1
- package/dist/prompts/templates/quick-reference.md +1 -1
- package/dist/prompts/templates/results-posting.md +2 -2
- package/dist/prompts/templates/run-creation.md +2 -2
- package/dist/prompts/templates/run-overlap-detection.md +6 -4
- package/dist/prompts/templates/task-examples.md +7 -7
- package/dist/prompts/templates/task-kinds.md +7 -3
- package/dist/prompts/types.d.ts +1 -1
- package/dist/runtime/commitEffectResult.d.ts.map +1 -1
- package/dist/runtime/commitEffectResult.js +5 -2
- package/dist/runtime/createRun.d.ts.map +1 -1
- package/dist/runtime/createRun.js +28 -14
- package/dist/runtime/errorTemplates.d.ts +101 -0
- package/dist/runtime/errorTemplates.d.ts.map +1 -0
- package/dist/runtime/errorTemplates.js +173 -0
- package/dist/runtime/exceptions.d.ts +3 -152
- package/dist/runtime/exceptions.d.ts.map +1 -1
- package/dist/runtime/exceptions.js +22 -220
- package/dist/runtime/index.d.ts +2 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +8 -1
- package/dist/runtime/intrinsics/subprocess.d.ts +5 -0
- package/dist/runtime/intrinsics/subprocess.d.ts.map +1 -0
- package/dist/runtime/intrinsics/subprocess.js +56 -0
- package/dist/runtime/intrinsics/task.d.ts +4 -3
- package/dist/runtime/intrinsics/task.d.ts.map +1 -1
- package/dist/runtime/intrinsics/task.js +31 -260
- package/dist/runtime/intrinsics/taskHelpers.d.ts +20 -0
- package/dist/runtime/intrinsics/taskHelpers.d.ts.map +1 -0
- package/dist/runtime/intrinsics/taskHelpers.js +148 -0
- package/dist/runtime/orchestrateHelpers.d.ts +16 -0
- package/dist/runtime/orchestrateHelpers.d.ts.map +1 -0
- package/dist/runtime/orchestrateHelpers.js +103 -0
- package/dist/runtime/orchestrateIteration.d.ts +2 -7
- package/dist/runtime/orchestrateIteration.d.ts.map +1 -1
- package/dist/runtime/orchestrateIteration.js +46 -267
- package/dist/runtime/policy/engine.d.ts +4 -0
- package/dist/runtime/policy/engine.d.ts.map +1 -0
- package/dist/runtime/policy/engine.js +97 -0
- package/dist/runtime/policy/index.d.ts +3 -1
- package/dist/runtime/policy/index.d.ts.map +1 -1
- package/dist/runtime/policy/index.js +9 -1
- package/dist/runtime/policy/logging.d.ts +6 -0
- package/dist/runtime/policy/logging.d.ts.map +1 -0
- package/dist/runtime/policy/logging.js +43 -0
- package/dist/runtime/policy/types.d.ts +4 -0
- package/dist/runtime/policy/types.d.ts.map +1 -1
- package/dist/runtime/processContext.d.ts +3 -0
- package/dist/runtime/processContext.d.ts.map +1 -1
- package/dist/runtime/processContext.js +3 -0
- package/dist/runtime/replay/createReplayEngine.d.ts +1 -0
- package/dist/runtime/replay/createReplayEngine.d.ts.map +1 -1
- package/dist/runtime/replay/createReplayEngine.js +26 -0
- package/dist/runtime/runLifecycleState.d.ts +7 -0
- package/dist/runtime/runLifecycleState.d.ts.map +1 -0
- package/dist/runtime/runLifecycleState.js +54 -0
- package/dist/runtime/types.d.ts +33 -1
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/session/cleanup.d.ts.map +1 -1
- package/dist/session/cleanup.js +26 -21
- package/dist/session/discovery.d.ts +4 -1
- package/dist/session/discovery.d.ts.map +1 -1
- package/dist/session/discovery.js +13 -18
- package/dist/session/types.d.ts +1 -1
- package/dist/session/types.d.ts.map +1 -1
- package/dist/session/whoami.js +2 -2
- package/dist/storage/createRunDir.d.ts.map +1 -1
- package/dist/storage/createRunDir.js +1 -0
- package/dist/storage/types.d.ts +14 -0
- package/dist/storage/types.d.ts.map +1 -1
- package/dist/tasks/kinds/index.d.ts +1 -1
- package/dist/tasks/kinds/index.d.ts.map +1 -1
- package/dist/tasks/kinds/index.js +58 -237
- package/dist/tasks/kinds/resolvers.d.ts +21 -0
- package/dist/tasks/kinds/resolvers.d.ts.map +1 -0
- package/dist/tasks/kinds/resolvers.js +124 -0
- package/dist/tasks/types.d.ts +18 -3
- package/dist/tasks/types.d.ts.map +1 -1
- package/dist/utils/ancestorWalk.d.ts +14 -0
- package/dist/utils/ancestorWalk.d.ts.map +1 -0
- package/dist/utils/ancestorWalk.js +203 -0
- package/dist/utils/sessionMarker.d.ts +3 -7
- package/dist/utils/sessionMarker.d.ts.map +1 -1
- package/dist/utils/sessionMarker.js +32 -216
- package/package.json +28 -5
- package/dist/breakpoints/approvalChains.d.ts +0 -66
- package/dist/breakpoints/approvalChains.d.ts.map +0 -1
- package/dist/breakpoints/approvalChains.js +0 -109
- package/dist/breakpoints/delegation.d.ts +0 -40
- package/dist/breakpoints/delegation.d.ts.map +0 -1
- package/dist/breakpoints/delegation.js +0 -197
- package/dist/breakpoints/delegationTypes.d.ts +0 -44
- package/dist/breakpoints/delegationTypes.d.ts.map +0 -1
- package/dist/breakpoints/delegationTypes.js +0 -8
- package/dist/breakpoints/postures.d.ts +0 -26
- package/dist/breakpoints/postures.d.ts.map +0 -1
- package/dist/breakpoints/postures.js +0 -98
- package/dist/cli/commandRegistry.d.ts +0 -27
- package/dist/cli/commandRegistry.d.ts.map +0 -1
- package/dist/cli/commandRegistry.js +0 -121
- package/dist/compression/compaction.d.ts +0 -80
- package/dist/compression/compaction.d.ts.map +0 -1
- package/dist/compression/compaction.js +0 -308
- package/dist/cost/effectCost.d.ts +0 -21
- package/dist/cost/effectCost.d.ts.map +0 -1
- package/dist/cost/effectCost.js +0 -26
- package/dist/harness/claudeCode/adapter.d.ts +0 -5
- package/dist/harness/claudeCode/adapter.d.ts.map +0 -1
- package/dist/harness/claudeCode/adapter.js +0 -101
- package/dist/harness/claudeCode/discovery.d.ts +0 -3
- package/dist/harness/claudeCode/discovery.d.ts.map +0 -1
- package/dist/harness/claudeCode/discovery.js +0 -11
- package/dist/harness/claudeCode/index.d.ts +0 -3
- package/dist/harness/claudeCode/index.d.ts.map +0 -1
- package/dist/harness/claudeCode/index.js +0 -9
- package/dist/harness/claudeCode/lifecycle.d.ts +0 -5
- package/dist/harness/claudeCode/lifecycle.d.ts.map +0 -1
- package/dist/harness/claudeCode/lifecycle.js +0 -204
- package/dist/harness/claudeCode/promptContext.d.ts +0 -3
- package/dist/harness/claudeCode/promptContext.d.ts.map +0 -1
- package/dist/harness/claudeCode/promptContext.js +0 -23
- package/dist/harness/claudeCode/sessionStart.d.ts +0 -3
- package/dist/harness/claudeCode/sessionStart.d.ts.map +0 -1
- package/dist/harness/claudeCode/sessionStart.js +0 -179
- package/dist/harness/claudeCode/shared.d.ts +0 -43
- package/dist/harness/claudeCode/shared.d.ts.map +0 -1
- package/dist/harness/claudeCode/shared.js +0 -268
- package/dist/harness/claudeCode/stopHook.d.ts +0 -3
- package/dist/harness/claudeCode/stopHook.d.ts.map +0 -1
- package/dist/harness/claudeCode/stopHook.js +0 -303
- package/dist/harness/claudeCode/stopHookState.d.ts.map +0 -1
- package/dist/harness/codex/adapter.d.ts +0 -3
- package/dist/harness/codex/adapter.d.ts.map +0 -1
- package/dist/harness/codex/adapter.js +0 -73
- package/dist/harness/codex/discovery.d.ts +0 -3
- package/dist/harness/codex/discovery.d.ts.map +0 -1
- package/dist/harness/codex/discovery.js +0 -11
- package/dist/harness/codex/hooks.d.ts +0 -4
- package/dist/harness/codex/hooks.d.ts.map +0 -1
- package/dist/harness/codex/hooks.js +0 -85
- package/dist/harness/codex/index.d.ts +0 -2
- package/dist/harness/codex/index.d.ts.map +0 -1
- package/dist/harness/codex/index.js +0 -5
- package/dist/harness/codex/install.d.ts +0 -4
- package/dist/harness/codex/install.d.ts.map +0 -1
- package/dist/harness/codex/install.js +0 -103
- package/dist/harness/codex/promptContext.d.ts +0 -3
- package/dist/harness/codex/promptContext.d.ts.map +0 -1
- package/dist/harness/codex/promptContext.js +0 -22
- package/dist/harness/codex/shared.d.ts +0 -15
- package/dist/harness/codex/shared.d.ts.map +0 -1
- package/dist/harness/codex/shared.js +0 -149
- package/dist/harness/cursor/adapter.d.ts +0 -3
- package/dist/harness/cursor/adapter.d.ts.map +0 -1
- package/dist/harness/cursor/adapter.js +0 -233
- package/dist/harness/cursor/discovery.d.ts +0 -3
- package/dist/harness/cursor/discovery.d.ts.map +0 -1
- package/dist/harness/cursor/discovery.js +0 -11
- package/dist/harness/cursor/hooks.d.ts +0 -8
- package/dist/harness/cursor/hooks.d.ts.map +0 -1
- package/dist/harness/cursor/hooks.js +0 -362
- package/dist/harness/cursor/index.d.ts +0 -2
- package/dist/harness/cursor/index.d.ts.map +0 -1
- package/dist/harness/cursor/index.js +0 -5
- package/dist/harness/cursor/promptContext.d.ts +0 -3
- package/dist/harness/cursor/promptContext.d.ts.map +0 -1
- package/dist/harness/cursor/promptContext.js +0 -22
- package/dist/harness/geminiCli/adapter.d.ts +0 -3
- package/dist/harness/geminiCli/adapter.d.ts.map +0 -1
- package/dist/harness/geminiCli/adapter.js +0 -190
- package/dist/harness/geminiCli/discovery.d.ts +0 -3
- package/dist/harness/geminiCli/discovery.d.ts.map +0 -1
- package/dist/harness/geminiCli/discovery.js +0 -11
- package/dist/harness/geminiCli/hooks.d.ts +0 -9
- package/dist/harness/geminiCli/hooks.d.ts.map +0 -1
- package/dist/harness/geminiCli/hooks.js +0 -401
- package/dist/harness/geminiCli/index.d.ts +0 -2
- package/dist/harness/geminiCli/index.d.ts.map +0 -1
- package/dist/harness/geminiCli/index.js +0 -5
- package/dist/harness/geminiCli/promptContext.d.ts +0 -3
- package/dist/harness/geminiCli/promptContext.d.ts.map +0 -1
- package/dist/harness/geminiCli/promptContext.js +0 -22
- package/dist/harness/githubCopilot/adapter.d.ts +0 -4
- package/dist/harness/githubCopilot/adapter.d.ts.map +0 -1
- package/dist/harness/githubCopilot/adapter.js +0 -215
- package/dist/harness/githubCopilot/discovery.d.ts +0 -3
- package/dist/harness/githubCopilot/discovery.d.ts.map +0 -1
- package/dist/harness/githubCopilot/discovery.js +0 -11
- package/dist/harness/githubCopilot/hooks.d.ts +0 -12
- package/dist/harness/githubCopilot/hooks.d.ts.map +0 -1
- package/dist/harness/githubCopilot/hooks.js +0 -305
- package/dist/harness/githubCopilot/index.d.ts +0 -3
- package/dist/harness/githubCopilot/index.d.ts.map +0 -1
- package/dist/harness/githubCopilot/index.js +0 -7
- package/dist/harness/githubCopilot/promptContext.d.ts +0 -3
- package/dist/harness/githubCopilot/promptContext.d.ts.map +0 -1
- package/dist/harness/githubCopilot/promptContext.js +0 -22
- package/dist/harness/ohMyPi/adapter.d.ts +0 -3
- package/dist/harness/ohMyPi/adapter.d.ts.map +0 -1
- package/dist/harness/ohMyPi/adapter.js +0 -190
- package/dist/harness/ohMyPi/discovery.d.ts +0 -3
- package/dist/harness/ohMyPi/discovery.d.ts.map +0 -1
- package/dist/harness/ohMyPi/discovery.js +0 -11
- package/dist/harness/ohMyPi/index.d.ts +0 -2
- package/dist/harness/ohMyPi/index.d.ts.map +0 -1
- package/dist/harness/ohMyPi/index.js +0 -5
- package/dist/harness/ohMyPi/promptContext.d.ts +0 -3
- package/dist/harness/ohMyPi/promptContext.d.ts.map +0 -1
- package/dist/harness/ohMyPi/promptContext.js +0 -22
- package/dist/harness/openclaw/adapter.d.ts +0 -3
- package/dist/harness/openclaw/adapter.d.ts.map +0 -1
- package/dist/harness/openclaw/adapter.js +0 -288
- package/dist/harness/openclaw/discovery.d.ts +0 -3
- package/dist/harness/openclaw/discovery.d.ts.map +0 -1
- package/dist/harness/openclaw/discovery.js +0 -11
- package/dist/harness/openclaw/index.d.ts +0 -2
- package/dist/harness/openclaw/index.d.ts.map +0 -1
- package/dist/harness/openclaw/index.js +0 -5
- package/dist/harness/openclaw/promptContext.d.ts +0 -3
- package/dist/harness/openclaw/promptContext.d.ts.map +0 -1
- package/dist/harness/openclaw/promptContext.js +0 -22
- package/dist/harness/opencode/adapter.d.ts +0 -3
- package/dist/harness/opencode/adapter.d.ts.map +0 -1
- package/dist/harness/opencode/adapter.js +0 -235
- package/dist/harness/opencode/discovery.d.ts +0 -3
- package/dist/harness/opencode/discovery.d.ts.map +0 -1
- package/dist/harness/opencode/discovery.js +0 -11
- package/dist/harness/opencode/hooks.d.ts +0 -11
- package/dist/harness/opencode/hooks.d.ts.map +0 -1
- package/dist/harness/opencode/hooks.js +0 -264
- package/dist/harness/opencode/index.d.ts +0 -2
- package/dist/harness/opencode/index.d.ts.map +0 -1
- package/dist/harness/opencode/index.js +0 -5
- package/dist/harness/opencode/promptContext.d.ts +0 -3
- package/dist/harness/opencode/promptContext.d.ts.map +0 -1
- package/dist/harness/opencode/promptContext.js +0 -22
- package/dist/harness/pi/adapter.d.ts +0 -4
- package/dist/harness/pi/adapter.d.ts.map +0 -1
- package/dist/harness/pi/adapter.js +0 -198
- package/dist/harness/pi/discovery.d.ts +0 -3
- package/dist/harness/pi/discovery.d.ts.map +0 -1
- package/dist/harness/pi/discovery.js +0 -11
- package/dist/harness/pi/index.d.ts +0 -2
- package/dist/harness/pi/index.d.ts.map +0 -1
- package/dist/harness/pi/index.js +0 -6
- package/dist/harness/pi/promptContext.d.ts +0 -3
- package/dist/harness/pi/promptContext.d.ts.map +0 -1
- package/dist/harness/pi/promptContext.js +0 -22
- package/dist/mcp/channels/allowlist.d.ts +0 -19
- package/dist/mcp/channels/allowlist.d.ts.map +0 -1
- package/dist/mcp/channels/allowlist.js +0 -140
- package/dist/mcp/channels/channelManager.d.ts +0 -64
- package/dist/mcp/channels/channelManager.d.ts.map +0 -1
- package/dist/mcp/channels/channelManager.js +0 -137
- package/dist/mcp/channels/inboundQueue.d.ts +0 -47
- package/dist/mcp/channels/inboundQueue.d.ts.map +0 -1
- package/dist/mcp/channels/inboundQueue.js +0 -96
- package/dist/mcp/channels/index.d.ts +0 -11
- package/dist/mcp/channels/index.d.ts.map +0 -1
- package/dist/mcp/channels/index.js +0 -33
- package/dist/mcp/channels/outbound.d.ts +0 -33
- package/dist/mcp/channels/outbound.d.ts.map +0 -1
- package/dist/mcp/channels/outbound.js +0 -94
- package/dist/mcp/channels/permissionRelay.d.ts +0 -62
- package/dist/mcp/channels/permissionRelay.d.ts.map +0 -1
- package/dist/mcp/channels/permissionRelay.js +0 -159
- package/dist/mcp/channels/types.d.ts +0 -135
- package/dist/mcp/channels/types.d.ts.map +0 -1
- package/dist/mcp/channels/types.js +0 -16
- package/dist/mcp/client/config.d.ts +0 -26
- package/dist/mcp/client/config.d.ts.map +0 -1
- package/dist/mcp/client/config.js +0 -140
- package/dist/mcp/client/executor.d.ts +0 -28
- package/dist/mcp/client/executor.d.ts.map +0 -1
- package/dist/mcp/client/executor.js +0 -58
- package/dist/mcp/client/index.d.ts +0 -10
- package/dist/mcp/client/index.d.ts.map +0 -1
- package/dist/mcp/client/index.js +0 -25
- package/dist/mcp/client/manager.d.ts +0 -72
- package/dist/mcp/client/manager.d.ts.map +0 -1
- package/dist/mcp/client/manager.js +0 -212
- package/dist/mcp/client/toolRegistry.d.ts +0 -48
- package/dist/mcp/client/toolRegistry.d.ts.map +0 -1
- package/dist/mcp/client/toolRegistry.js +0 -116
- package/dist/mcp/client/types.d.ts +0 -94
- package/dist/mcp/client/types.d.ts.map +0 -1
- package/dist/mcp/client/types.js +0 -13
- package/dist/mcp/transport/session.d.ts +0 -16
- package/dist/mcp/transport/session.d.ts.map +0 -1
- package/dist/mcp/transport/session.js +0 -76
- package/dist/mcp/transport/types.d.ts +0 -17
- package/dist/mcp/transport/types.d.ts.map +0 -1
- package/dist/mcp/transport/types.js +0 -5
- package/dist/mcp/transport/websocket.d.ts +0 -39
- package/dist/mcp/transport/websocket.d.ts.map +0 -1
- package/dist/mcp/transport/websocket.js +0 -269
|
@@ -18,371 +18,35 @@
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
19
|
exports.handleCompressOutput = handleCompressOutput;
|
|
20
20
|
const node_child_process_1 = require("node:child_process");
|
|
21
|
-
|
|
22
|
-
// Command-family detection
|
|
23
|
-
// ---------------------------------------------------------------------------
|
|
24
|
-
function detectCommandFamily(command) {
|
|
25
|
-
const first = command.trim().toLowerCase().split(/\s+/)[0] ?? "";
|
|
26
|
-
if (first === "git")
|
|
27
|
-
return "git";
|
|
28
|
-
if (first === "ls" || first === "dir")
|
|
29
|
-
return "ls";
|
|
30
|
-
if (first === "grep" || first === "rg" || first === "ag")
|
|
31
|
-
return "grep";
|
|
32
|
-
if (first === "diff" || first === "delta")
|
|
33
|
-
return "diff";
|
|
34
|
-
if (first === "cat" || first === "head" || first === "tail" || first === "less" || first === "more")
|
|
35
|
-
return "read";
|
|
36
|
-
return "unknown";
|
|
37
|
-
}
|
|
38
|
-
// ---------------------------------------------------------------------------
|
|
39
|
-
// Git compressor
|
|
40
|
-
// ---------------------------------------------------------------------------
|
|
41
|
-
function detectGitSubcommand(command) {
|
|
42
|
-
const parts = command.toLowerCase().trim().split(/\s+/);
|
|
43
|
-
const sub = parts.find((p, i) => i > 0 && !p.startsWith("-")) ?? "";
|
|
44
|
-
const map = {
|
|
45
|
-
diff: "diff", log: "log", status: "status", show: "show",
|
|
46
|
-
add: "add", commit: "commit", push: "push", pull: "pull",
|
|
47
|
-
branch: "branch", fetch: "fetch", stash: "stash", worktree: "worktree",
|
|
48
|
-
};
|
|
49
|
-
return map[sub] ?? "unknown";
|
|
50
|
-
}
|
|
51
|
-
function compactDiff(diff, maxLines = 100) {
|
|
52
|
-
const lines = diff.split("\n");
|
|
53
|
-
const result = [];
|
|
54
|
-
let kept = 0;
|
|
55
|
-
let currentFile = "";
|
|
56
|
-
for (const line of lines) {
|
|
57
|
-
if (kept >= maxLines)
|
|
58
|
-
break;
|
|
59
|
-
if (line.startsWith("diff --git") || line.startsWith("--- "))
|
|
60
|
-
continue;
|
|
61
|
-
if (line.startsWith("+++ ")) {
|
|
62
|
-
currentFile = line.replace(/^\+\+\+ b?\//, "");
|
|
63
|
-
result.push(`\n--- ${currentFile} ---`);
|
|
64
|
-
continue;
|
|
65
|
-
}
|
|
66
|
-
if (line.startsWith("@@"))
|
|
67
|
-
continue;
|
|
68
|
-
if (line.startsWith("+") || line.startsWith("-")) {
|
|
69
|
-
result.push(line.length > 120 ? line.slice(0, 117) + "..." : line);
|
|
70
|
-
kept++;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
if (lines.length > maxLines)
|
|
74
|
-
result.push(`\n... ${lines.length - maxLines} more lines`);
|
|
75
|
-
return result.join("\n").trim();
|
|
76
|
-
}
|
|
77
|
-
function compactLog(log, maxEntries = 20) {
|
|
78
|
-
const lines = log.split("\n");
|
|
79
|
-
const entries = [];
|
|
80
|
-
let count = 0;
|
|
81
|
-
for (const line of lines) {
|
|
82
|
-
if (count >= maxEntries)
|
|
83
|
-
break;
|
|
84
|
-
const trimmed = line.trim();
|
|
85
|
-
if (!trimmed)
|
|
86
|
-
continue;
|
|
87
|
-
if (trimmed.startsWith("commit ")) {
|
|
88
|
-
entries.push(trimmed.replace("commit ", "").slice(0, 12));
|
|
89
|
-
}
|
|
90
|
-
else if (/^[0-9a-f]{7,}/.test(trimmed)) {
|
|
91
|
-
entries.push(trimmed.length > 80 ? trimmed.slice(0, 77) + "..." : trimmed);
|
|
92
|
-
count++;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return entries.join("\n");
|
|
96
|
-
}
|
|
97
|
-
function compactStatus(status) {
|
|
98
|
-
const lines = status.split("\n");
|
|
99
|
-
const staged = [];
|
|
100
|
-
const unstaged = [];
|
|
101
|
-
const untracked = [];
|
|
102
|
-
for (const line of lines) {
|
|
103
|
-
if (!line.trim() || line.startsWith("On branch") || line.startsWith("HEAD"))
|
|
104
|
-
continue;
|
|
105
|
-
if (line.startsWith("\t")) {
|
|
106
|
-
const name = line.trim();
|
|
107
|
-
if (line.includes("new file:") || line.includes("modified:") || line.includes("deleted:")) {
|
|
108
|
-
staged.push(name);
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
unstaged.push(name);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
else if (line.startsWith("?? ")) {
|
|
115
|
-
untracked.push(line.slice(3));
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
const parts = [];
|
|
119
|
-
if (staged.length)
|
|
120
|
-
parts.push(`staged(${staged.length}): ${staged.slice(0, 5).join(", ")}`);
|
|
121
|
-
if (unstaged.length)
|
|
122
|
-
parts.push(`unstaged(${unstaged.length}): ${unstaged.slice(0, 5).join(", ")}`);
|
|
123
|
-
if (untracked.length)
|
|
124
|
-
parts.push(`untracked(${untracked.length}): ${untracked.slice(0, 5).join(", ")}`);
|
|
125
|
-
return parts.length ? parts.join("\n") : "clean";
|
|
126
|
-
}
|
|
127
|
-
function compressGitOutput(sub, raw) {
|
|
128
|
-
switch (sub) {
|
|
129
|
-
case "diff": return compactDiff(raw);
|
|
130
|
-
case "log": return compactLog(raw);
|
|
131
|
-
case "status": return compactStatus(raw);
|
|
132
|
-
case "show": return compactDiff(raw, 60);
|
|
133
|
-
case "add":
|
|
134
|
-
case "commit":
|
|
135
|
-
case "push":
|
|
136
|
-
case "pull":
|
|
137
|
-
case "fetch":
|
|
138
|
-
return raw.split("\n").filter(l => l.trim()).slice(0, 10).join("\n");
|
|
139
|
-
default:
|
|
140
|
-
return raw.split("\n").slice(0, 50).join("\n");
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
// ---------------------------------------------------------------------------
|
|
144
|
-
// Ls compressor
|
|
145
|
-
// ---------------------------------------------------------------------------
|
|
146
|
-
const NOISE_DIRS = new Set([
|
|
147
|
-
"node_modules", ".git", "target", "__pycache__", ".next", "dist", "build",
|
|
148
|
-
".cache", ".turbo", ".vercel", ".pytest_cache", ".mypy_cache", ".tox",
|
|
149
|
-
".venv", "venv", "coverage", ".nyc_output", ".DS_Store", "Thumbs.db",
|
|
150
|
-
".idea", ".vscode", ".vs", ".eggs",
|
|
151
|
-
]);
|
|
152
|
-
function humanSize(bytes) {
|
|
153
|
-
if (bytes >= 1_048_576)
|
|
154
|
-
return `${(bytes / 1_048_576).toFixed(1)}M`;
|
|
155
|
-
if (bytes >= 1024)
|
|
156
|
-
return `${(bytes / 1024).toFixed(1)}K`;
|
|
157
|
-
return `${bytes}B`;
|
|
158
|
-
}
|
|
159
|
-
function compressLsOutput(raw) {
|
|
160
|
-
const dirs = [];
|
|
161
|
-
const files = [];
|
|
162
|
-
const byExt = new Map();
|
|
163
|
-
for (const line of raw.split("\n")) {
|
|
164
|
-
if (line.startsWith("total ") || !line.trim())
|
|
165
|
-
continue;
|
|
166
|
-
const parts = line.split(/\s+/);
|
|
167
|
-
if (parts.length < 9)
|
|
168
|
-
continue;
|
|
169
|
-
const name = parts.slice(8).join(" ");
|
|
170
|
-
if (name === "." || name === "..")
|
|
171
|
-
continue;
|
|
172
|
-
if (NOISE_DIRS.has(name))
|
|
173
|
-
continue;
|
|
174
|
-
if (parts[0].startsWith("d")) {
|
|
175
|
-
dirs.push(name);
|
|
176
|
-
}
|
|
177
|
-
else if (parts[0].startsWith("-") || parts[0].startsWith("l")) {
|
|
178
|
-
const size = parseInt(parts[4] ?? "0", 10) || 0;
|
|
179
|
-
const dotPos = name.lastIndexOf(".");
|
|
180
|
-
const ext = dotPos >= 0 ? name.slice(dotPos) : "no ext";
|
|
181
|
-
byExt.set(ext, (byExt.get(ext) ?? 0) + 1);
|
|
182
|
-
files.push([name, humanSize(size)]);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
if (!dirs.length && !files.length)
|
|
186
|
-
return "(empty)\n";
|
|
187
|
-
let out = "";
|
|
188
|
-
for (const d of dirs)
|
|
189
|
-
out += `${d}/\n`;
|
|
190
|
-
for (const [name, size] of files)
|
|
191
|
-
out += `${name} ${size}\n`;
|
|
192
|
-
out += "\n";
|
|
193
|
-
let summary = `${files.length} files, ${dirs.length} dirs`;
|
|
194
|
-
if (byExt.size) {
|
|
195
|
-
const extCounts = [...byExt.entries()].sort((a, b) => b[1] - a[1]);
|
|
196
|
-
const extParts = extCounts.slice(0, 5).map(([e, c]) => `${c} ${e}`);
|
|
197
|
-
summary += ` (${extParts.join(", ")}`;
|
|
198
|
-
if (extCounts.length > 5)
|
|
199
|
-
summary += `, +${extCounts.length - 5} more`;
|
|
200
|
-
summary += ")";
|
|
201
|
-
}
|
|
202
|
-
return out + summary + "\n";
|
|
203
|
-
}
|
|
204
|
-
// ---------------------------------------------------------------------------
|
|
205
|
-
// Grep compressor
|
|
206
|
-
// ---------------------------------------------------------------------------
|
|
207
|
-
function compressGrepOutput(raw, pattern, maxResults = 50, maxLineLen = 120) {
|
|
208
|
-
if (!raw.trim())
|
|
209
|
-
return `0 matches for '${pattern}'`;
|
|
210
|
-
const byFile = new Map();
|
|
211
|
-
let total = 0;
|
|
212
|
-
for (const line of raw.split("\n")) {
|
|
213
|
-
if (!line.trim())
|
|
214
|
-
continue;
|
|
215
|
-
const parts = line.split(":");
|
|
216
|
-
if (parts.length < 3 || !/^\d+$/.test(parts[1] ?? ""))
|
|
217
|
-
continue;
|
|
218
|
-
const file = parts[0] ?? "";
|
|
219
|
-
const lineNum = parseInt(parts[1] ?? "0", 10);
|
|
220
|
-
const content = parts.slice(2).join(":");
|
|
221
|
-
const cleaned = content.trim().length > maxLineLen
|
|
222
|
-
? content.trim().slice(0, maxLineLen - 3) + "..."
|
|
223
|
-
: content.trim();
|
|
224
|
-
total++;
|
|
225
|
-
if (!byFile.has(file))
|
|
226
|
-
byFile.set(file, []);
|
|
227
|
-
byFile.get(file).push([lineNum, cleaned]);
|
|
228
|
-
}
|
|
229
|
-
if (total === 0)
|
|
230
|
-
return `0 matches for '${pattern}'`;
|
|
231
|
-
let out = `${total} matches in ${byFile.size} files:\n\n`;
|
|
232
|
-
let shown = 0;
|
|
233
|
-
for (const [file, matches] of [...byFile.entries()].sort((a, b) => a[0].localeCompare(b[0]))) {
|
|
234
|
-
if (shown >= maxResults)
|
|
235
|
-
break;
|
|
236
|
-
out += `${file} (${matches.length}):\n`;
|
|
237
|
-
for (const [ln, content] of matches.slice(0, 10)) {
|
|
238
|
-
out += ` ${String(ln).padStart(4)}: ${content}\n`;
|
|
239
|
-
shown++;
|
|
240
|
-
if (shown >= maxResults)
|
|
241
|
-
break;
|
|
242
|
-
}
|
|
243
|
-
if (matches.length > 10)
|
|
244
|
-
out += ` +${matches.length - 10}\n`;
|
|
245
|
-
out += "\n";
|
|
246
|
-
}
|
|
247
|
-
if (total > shown)
|
|
248
|
-
out += `... +${total - shown} more\n`;
|
|
249
|
-
return out;
|
|
250
|
-
}
|
|
251
|
-
// ---------------------------------------------------------------------------
|
|
252
|
-
// Diff compressor
|
|
253
|
-
// ---------------------------------------------------------------------------
|
|
254
|
-
function condenseDiff(diff) {
|
|
255
|
-
const result = [];
|
|
256
|
-
let currentFile = "";
|
|
257
|
-
let added = 0, removed = 0;
|
|
258
|
-
const changes = [];
|
|
259
|
-
const flush = () => {
|
|
260
|
-
if (currentFile && (added > 0 || removed > 0)) {
|
|
261
|
-
result.push(`${currentFile} (+${added} -${removed})`);
|
|
262
|
-
for (const c of changes.slice(0, 10))
|
|
263
|
-
result.push(` ${c}`);
|
|
264
|
-
if (changes.length > 10)
|
|
265
|
-
result.push(` ... +${changes.length - 10} more`);
|
|
266
|
-
}
|
|
267
|
-
};
|
|
268
|
-
for (const line of diff.split("\n")) {
|
|
269
|
-
if (line.startsWith("+++ ")) {
|
|
270
|
-
flush();
|
|
271
|
-
currentFile = line.replace(/^\+\+\+ b?\//, "");
|
|
272
|
-
added = 0;
|
|
273
|
-
removed = 0;
|
|
274
|
-
changes.length = 0;
|
|
275
|
-
}
|
|
276
|
-
else if (line.startsWith("+") && !line.startsWith("+++")) {
|
|
277
|
-
added++;
|
|
278
|
-
if (changes.length < 15)
|
|
279
|
-
changes.push(line.length > 70 ? line.slice(0, 67) + "..." : line);
|
|
280
|
-
}
|
|
281
|
-
else if (line.startsWith("-") && !line.startsWith("---")) {
|
|
282
|
-
removed++;
|
|
283
|
-
if (changes.length < 15)
|
|
284
|
-
changes.push(line.length > 70 ? line.slice(0, 67) + "..." : line);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
flush();
|
|
288
|
-
return result.join("\n");
|
|
289
|
-
}
|
|
290
|
-
function languageFromExtension(ext) {
|
|
291
|
-
const map = {
|
|
292
|
-
rs: "rust", py: "python", pyw: "python",
|
|
293
|
-
js: "javascript", mjs: "javascript", cjs: "javascript",
|
|
294
|
-
ts: "typescript", tsx: "typescript",
|
|
295
|
-
go: "go", c: "c", h: "c", cpp: "cpp", cc: "cpp", cxx: "cpp", hpp: "cpp",
|
|
296
|
-
java: "java", rb: "ruby", sh: "shell", bash: "shell", zsh: "shell",
|
|
297
|
-
};
|
|
298
|
-
return map[ext.toLowerCase()] ?? "unknown";
|
|
299
|
-
}
|
|
300
|
-
function commentPatterns(lang) {
|
|
301
|
-
if (lang === "python")
|
|
302
|
-
return { line: "#", blockStart: '"""', blockEnd: '"""', docBlockStart: '"""' };
|
|
303
|
-
if (lang === "ruby")
|
|
304
|
-
return { line: "#", blockStart: "=begin", blockEnd: "=end" };
|
|
305
|
-
if (lang === "shell")
|
|
306
|
-
return { line: "#" };
|
|
307
|
-
return { line: "//", blockStart: "/*", blockEnd: "*/", docBlockStart: "/**" };
|
|
308
|
-
}
|
|
309
|
-
function minimalFilter(content, lang) {
|
|
310
|
-
const patterns = commentPatterns(lang);
|
|
311
|
-
const lines = content.split("\n");
|
|
312
|
-
const result = [];
|
|
313
|
-
let inBlock = false, inDocstring = false;
|
|
314
|
-
for (const line of lines) {
|
|
315
|
-
const t = line.trim();
|
|
316
|
-
if (patterns.blockStart && patterns.blockEnd) {
|
|
317
|
-
if (!inDocstring && t.includes(patterns.blockStart) &&
|
|
318
|
-
!(patterns.docBlockStart && t.startsWith(patterns.docBlockStart))) {
|
|
319
|
-
inBlock = true;
|
|
320
|
-
}
|
|
321
|
-
if (inBlock) {
|
|
322
|
-
if (t.includes(patterns.blockEnd))
|
|
323
|
-
inBlock = false;
|
|
324
|
-
continue;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
if (lang === "python" && t.startsWith('"""')) {
|
|
328
|
-
inDocstring = !inDocstring;
|
|
329
|
-
result.push(line);
|
|
330
|
-
continue;
|
|
331
|
-
}
|
|
332
|
-
if (inDocstring) {
|
|
333
|
-
result.push(line);
|
|
334
|
-
continue;
|
|
335
|
-
}
|
|
336
|
-
if (patterns.line && t.startsWith(patterns.line)) {
|
|
337
|
-
if (patterns.docLine && t.startsWith(patterns.docLine))
|
|
338
|
-
result.push(line);
|
|
339
|
-
continue;
|
|
340
|
-
}
|
|
341
|
-
result.push(line);
|
|
342
|
-
}
|
|
343
|
-
return result.join("\n").replace(/\n{3,}/g, "\n\n").trim();
|
|
344
|
-
}
|
|
345
|
-
function compressReadOutput(content, ext) {
|
|
346
|
-
const lang = languageFromExtension(ext);
|
|
347
|
-
return minimalFilter(content, lang);
|
|
348
|
-
}
|
|
349
|
-
// ---------------------------------------------------------------------------
|
|
350
|
-
// Generic cap for unknown commands
|
|
351
|
-
// ---------------------------------------------------------------------------
|
|
352
|
-
function capLines(raw, maxLines = 200) {
|
|
353
|
-
const lines = raw.split("\n");
|
|
354
|
-
if (lines.length <= maxLines)
|
|
355
|
-
return raw;
|
|
356
|
-
return lines.slice(0, maxLines).join("\n") + `\n... +${lines.length - maxLines} more lines`;
|
|
357
|
-
}
|
|
21
|
+
const compressOutputHelpers_1 = require("./compressOutputHelpers");
|
|
358
22
|
// ---------------------------------------------------------------------------
|
|
359
23
|
// Main compressor dispatcher
|
|
360
24
|
// ---------------------------------------------------------------------------
|
|
361
25
|
function compressCommandOutput(cmdStr, rawOutput) {
|
|
362
|
-
const family = detectCommandFamily(cmdStr);
|
|
26
|
+
const family = (0, compressOutputHelpers_1.detectCommandFamily)(cmdStr);
|
|
363
27
|
switch (family) {
|
|
364
28
|
case "git": {
|
|
365
|
-
const sub = detectGitSubcommand(cmdStr);
|
|
366
|
-
return compressGitOutput(sub, rawOutput);
|
|
29
|
+
const sub = (0, compressOutputHelpers_1.detectGitSubcommand)(cmdStr);
|
|
30
|
+
return (0, compressOutputHelpers_1.compressGitOutput)(sub, rawOutput);
|
|
367
31
|
}
|
|
368
32
|
case "ls":
|
|
369
|
-
return compressLsOutput(rawOutput);
|
|
33
|
+
return (0, compressOutputHelpers_1.compressLsOutput)(rawOutput);
|
|
370
34
|
case "grep": {
|
|
371
35
|
const parts = cmdStr.split(/\s+/);
|
|
372
36
|
const pattern = parts.find((p, i) => i > 0 && !p.startsWith("-")) ?? "";
|
|
373
|
-
return compressGrepOutput(rawOutput, pattern);
|
|
37
|
+
return (0, compressOutputHelpers_1.compressGrepOutput)(rawOutput, pattern);
|
|
374
38
|
}
|
|
375
39
|
case "diff":
|
|
376
|
-
return condenseDiff(rawOutput);
|
|
40
|
+
return (0, compressOutputHelpers_1.condenseDiff)(rawOutput);
|
|
377
41
|
case "read": {
|
|
378
42
|
const parts = cmdStr.trim().split(/\s+/);
|
|
379
43
|
const filePath = parts[parts.length - 1] ?? "";
|
|
380
44
|
const dotPos = filePath.lastIndexOf(".");
|
|
381
45
|
const ext = dotPos >= 0 ? filePath.slice(dotPos + 1) : "";
|
|
382
|
-
return compressReadOutput(rawOutput, ext);
|
|
46
|
+
return (0, compressOutputHelpers_1.compressReadOutput)(rawOutput, ext);
|
|
383
47
|
}
|
|
384
48
|
default:
|
|
385
|
-
return capLines(rawOutput);
|
|
49
|
+
return (0, compressOutputHelpers_1.capLines)(rawOutput);
|
|
386
50
|
}
|
|
387
51
|
}
|
|
388
52
|
// ---------------------------------------------------------------------------
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper functions for compress-output command.
|
|
3
|
+
* Extracted from compressOutput.ts for max-lines compliance.
|
|
4
|
+
*/
|
|
5
|
+
export type CommandFamily = "git" | "ls" | "grep" | "diff" | "read" | "unknown";
|
|
6
|
+
export type GitSubcommand = "diff" | "log" | "status" | "show" | "add" | "commit" | "push" | "pull" | "branch" | "fetch" | "stash" | "worktree" | "unknown";
|
|
7
|
+
export declare function detectCommandFamily(command: string): CommandFamily;
|
|
8
|
+
export declare function detectGitSubcommand(command: string): GitSubcommand;
|
|
9
|
+
export declare function compressGitOutput(sub: GitSubcommand, raw: string): string;
|
|
10
|
+
export declare function compressLsOutput(raw: string): string;
|
|
11
|
+
export declare function compressGrepOutput(raw: string, pattern: string, maxResults?: number, maxLineLen?: number): string;
|
|
12
|
+
export declare function condenseDiff(diff: string): string;
|
|
13
|
+
export declare function compressReadOutput(content: string, ext: string): string;
|
|
14
|
+
export declare function capLines(raw: string, maxLines?: number): string;
|
|
15
|
+
//# sourceMappingURL=compressOutputHelpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compressOutputHelpers.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/compressOutputHelpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAChF,MAAM,MAAM,aAAa,GACrB,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GACrD,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,CAAC;AAU5E,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CAQlE;AAMD,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,CASlE;AAmFD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,aAAa,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAWzE;AAmBD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAmCpD;AAMD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,SAAK,EAAE,UAAU,SAAM,GAAG,MAAM,CAkC1G;AAMD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CA2BjD;AAmDD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAGvE;AAMD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,SAAM,GAAG,MAAM,CAI5D"}
|