@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
|
@@ -0,0 +1,367 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Helper functions for compress-output command.
|
|
4
|
+
* Extracted from compressOutput.ts for max-lines compliance.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.detectCommandFamily = detectCommandFamily;
|
|
8
|
+
exports.detectGitSubcommand = detectGitSubcommand;
|
|
9
|
+
exports.compressGitOutput = compressGitOutput;
|
|
10
|
+
exports.compressLsOutput = compressLsOutput;
|
|
11
|
+
exports.compressGrepOutput = compressGrepOutput;
|
|
12
|
+
exports.condenseDiff = condenseDiff;
|
|
13
|
+
exports.compressReadOutput = compressReadOutput;
|
|
14
|
+
exports.capLines = capLines;
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
// Command-family detection
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
function detectCommandFamily(command) {
|
|
19
|
+
const first = command.trim().toLowerCase().split(/\s+/)[0] ?? "";
|
|
20
|
+
if (first === "git")
|
|
21
|
+
return "git";
|
|
22
|
+
if (first === "ls" || first === "dir")
|
|
23
|
+
return "ls";
|
|
24
|
+
if (first === "grep" || first === "rg" || first === "ag")
|
|
25
|
+
return "grep";
|
|
26
|
+
if (first === "diff" || first === "delta")
|
|
27
|
+
return "diff";
|
|
28
|
+
if (first === "cat" || first === "head" || first === "tail" || first === "less" || first === "more")
|
|
29
|
+
return "read";
|
|
30
|
+
return "unknown";
|
|
31
|
+
}
|
|
32
|
+
// ---------------------------------------------------------------------------
|
|
33
|
+
// Git compressor
|
|
34
|
+
// ---------------------------------------------------------------------------
|
|
35
|
+
function detectGitSubcommand(command) {
|
|
36
|
+
const parts = command.toLowerCase().trim().split(/\s+/);
|
|
37
|
+
const sub = parts.find((p, i) => i > 0 && !p.startsWith("-")) ?? "";
|
|
38
|
+
const map = {
|
|
39
|
+
diff: "diff", log: "log", status: "status", show: "show",
|
|
40
|
+
add: "add", commit: "commit", push: "push", pull: "pull",
|
|
41
|
+
branch: "branch", fetch: "fetch", stash: "stash", worktree: "worktree",
|
|
42
|
+
};
|
|
43
|
+
return map[sub] ?? "unknown";
|
|
44
|
+
}
|
|
45
|
+
function compactDiff(diff, maxLines = 100) {
|
|
46
|
+
const lines = diff.split("\n");
|
|
47
|
+
const result = [];
|
|
48
|
+
let kept = 0;
|
|
49
|
+
let currentFile = "";
|
|
50
|
+
for (const line of lines) {
|
|
51
|
+
if (kept >= maxLines)
|
|
52
|
+
break;
|
|
53
|
+
if (line.startsWith("diff --git") || line.startsWith("--- "))
|
|
54
|
+
continue;
|
|
55
|
+
if (line.startsWith("+++ ")) {
|
|
56
|
+
currentFile = line.replace(/^\+\+\+ b?\//, "");
|
|
57
|
+
result.push(`\n--- ${currentFile} ---`);
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
if (line.startsWith("@@"))
|
|
61
|
+
continue;
|
|
62
|
+
if (line.startsWith("+") || line.startsWith("-")) {
|
|
63
|
+
result.push(line.length > 120 ? line.slice(0, 117) + "..." : line);
|
|
64
|
+
kept++;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (lines.length > maxLines)
|
|
68
|
+
result.push(`\n... ${lines.length - maxLines} more lines`);
|
|
69
|
+
return result.join("\n").trim();
|
|
70
|
+
}
|
|
71
|
+
function compactLog(log, maxEntries = 20) {
|
|
72
|
+
const lines = log.split("\n");
|
|
73
|
+
const entries = [];
|
|
74
|
+
let count = 0;
|
|
75
|
+
for (const line of lines) {
|
|
76
|
+
if (count >= maxEntries)
|
|
77
|
+
break;
|
|
78
|
+
const trimmed = line.trim();
|
|
79
|
+
if (!trimmed)
|
|
80
|
+
continue;
|
|
81
|
+
if (trimmed.startsWith("commit ")) {
|
|
82
|
+
entries.push(trimmed.replace("commit ", "").slice(0, 12));
|
|
83
|
+
}
|
|
84
|
+
else if (/^[0-9a-f]{7,}/.test(trimmed)) {
|
|
85
|
+
entries.push(trimmed.length > 80 ? trimmed.slice(0, 77) + "..." : trimmed);
|
|
86
|
+
count++;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return entries.join("\n");
|
|
90
|
+
}
|
|
91
|
+
function compactStatus(status) {
|
|
92
|
+
const lines = status.split("\n");
|
|
93
|
+
const staged = [];
|
|
94
|
+
const unstaged = [];
|
|
95
|
+
const untracked = [];
|
|
96
|
+
let section = null;
|
|
97
|
+
for (const line of lines) {
|
|
98
|
+
if (!line.trim() || line.startsWith("On branch") || line.startsWith("HEAD"))
|
|
99
|
+
continue;
|
|
100
|
+
if (line.startsWith("Changes to be committed")) {
|
|
101
|
+
section = "staged";
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (line.startsWith("Changes not staged for commit")) {
|
|
105
|
+
section = "unstaged";
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
if (line.startsWith("Untracked files")) {
|
|
109
|
+
section = "untracked";
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
if (line.startsWith("\t")) {
|
|
113
|
+
const name = line.trim();
|
|
114
|
+
if (section === "staged") {
|
|
115
|
+
staged.push(name);
|
|
116
|
+
}
|
|
117
|
+
else if (section === "unstaged") {
|
|
118
|
+
unstaged.push(name);
|
|
119
|
+
}
|
|
120
|
+
else if (section === "untracked") {
|
|
121
|
+
untracked.push(name);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
else if (line.startsWith("?? ")) {
|
|
125
|
+
untracked.push(line.slice(3));
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
const parts = [];
|
|
129
|
+
if (staged.length)
|
|
130
|
+
parts.push(`staged(${staged.length}): ${staged.slice(0, 5).join(", ")}`);
|
|
131
|
+
if (unstaged.length)
|
|
132
|
+
parts.push(`unstaged(${unstaged.length}): ${unstaged.slice(0, 5).join(", ")}`);
|
|
133
|
+
if (untracked.length)
|
|
134
|
+
parts.push(`untracked(${untracked.length}): ${untracked.slice(0, 5).join(", ")}`);
|
|
135
|
+
return parts.length ? parts.join("\n") : "clean";
|
|
136
|
+
}
|
|
137
|
+
function compressGitOutput(sub, raw) {
|
|
138
|
+
switch (sub) {
|
|
139
|
+
case "diff": return compactDiff(raw);
|
|
140
|
+
case "log": return compactLog(raw);
|
|
141
|
+
case "status": return compactStatus(raw);
|
|
142
|
+
case "show": return compactDiff(raw, 60);
|
|
143
|
+
case "add":
|
|
144
|
+
case "commit":
|
|
145
|
+
case "push":
|
|
146
|
+
case "pull":
|
|
147
|
+
case "fetch":
|
|
148
|
+
return raw.split("\n").filter(l => l.trim()).slice(0, 10).join("\n");
|
|
149
|
+
default:
|
|
150
|
+
return raw.split("\n").slice(0, 50).join("\n");
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
// ---------------------------------------------------------------------------
|
|
154
|
+
// Ls compressor
|
|
155
|
+
// ---------------------------------------------------------------------------
|
|
156
|
+
const NOISE_DIRS = new Set([
|
|
157
|
+
"node_modules", ".git", "target", "__pycache__", ".next", "dist", "build",
|
|
158
|
+
".cache", ".turbo", ".vercel", ".pytest_cache", ".mypy_cache", ".tox",
|
|
159
|
+
".venv", "venv", "coverage", ".nyc_output", ".DS_Store", "Thumbs.db",
|
|
160
|
+
".idea", ".vscode", ".vs", ".eggs",
|
|
161
|
+
]);
|
|
162
|
+
function humanSize(bytes) {
|
|
163
|
+
if (bytes >= 1_048_576)
|
|
164
|
+
return `${(bytes / 1_048_576).toFixed(1)}M`;
|
|
165
|
+
if (bytes >= 1024)
|
|
166
|
+
return `${(bytes / 1024).toFixed(1)}K`;
|
|
167
|
+
return `${bytes}B`;
|
|
168
|
+
}
|
|
169
|
+
function compressLsOutput(raw) {
|
|
170
|
+
const dirs = [];
|
|
171
|
+
const files = [];
|
|
172
|
+
const byExt = new Map();
|
|
173
|
+
for (const line of raw.split("\n")) {
|
|
174
|
+
if (line.startsWith("total ") || !line.trim())
|
|
175
|
+
continue;
|
|
176
|
+
const parts = line.split(/\s+/);
|
|
177
|
+
if (parts.length < 9)
|
|
178
|
+
continue;
|
|
179
|
+
const name = parts.slice(8).join(" ");
|
|
180
|
+
if (name === "." || name === "..")
|
|
181
|
+
continue;
|
|
182
|
+
if (NOISE_DIRS.has(name))
|
|
183
|
+
continue;
|
|
184
|
+
if (parts[0].startsWith("d")) {
|
|
185
|
+
dirs.push(name);
|
|
186
|
+
}
|
|
187
|
+
else if (parts[0].startsWith("-") || parts[0].startsWith("l")) {
|
|
188
|
+
const size = parseInt(parts[4] ?? "0", 10) || 0;
|
|
189
|
+
const dotPos = name.lastIndexOf(".");
|
|
190
|
+
const ext = dotPos >= 0 ? name.slice(dotPos) : "no ext";
|
|
191
|
+
byExt.set(ext, (byExt.get(ext) ?? 0) + 1);
|
|
192
|
+
files.push([name, humanSize(size)]);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (!dirs.length && !files.length)
|
|
196
|
+
return "(empty)\n";
|
|
197
|
+
let out = "";
|
|
198
|
+
for (const d of dirs)
|
|
199
|
+
out += `${d}/\n`;
|
|
200
|
+
for (const [name, size] of files)
|
|
201
|
+
out += `${name} ${size}\n`;
|
|
202
|
+
out += "\n";
|
|
203
|
+
let summary = `${files.length} files, ${dirs.length} dirs`;
|
|
204
|
+
if (byExt.size) {
|
|
205
|
+
const extCounts = [...byExt.entries()].sort((a, b) => b[1] - a[1]);
|
|
206
|
+
const extParts = extCounts.slice(0, 5).map(([e, c]) => `${c} ${e}`);
|
|
207
|
+
summary += ` (${extParts.join(", ")}`;
|
|
208
|
+
if (extCounts.length > 5)
|
|
209
|
+
summary += `, +${extCounts.length - 5} more`;
|
|
210
|
+
summary += ")";
|
|
211
|
+
}
|
|
212
|
+
return out + summary + "\n";
|
|
213
|
+
}
|
|
214
|
+
// ---------------------------------------------------------------------------
|
|
215
|
+
// Grep compressor
|
|
216
|
+
// ---------------------------------------------------------------------------
|
|
217
|
+
function compressGrepOutput(raw, pattern, maxResults = 50, maxLineLen = 120) {
|
|
218
|
+
if (!raw.trim())
|
|
219
|
+
return `0 matches for '${pattern}'`;
|
|
220
|
+
const byFile = new Map();
|
|
221
|
+
let total = 0;
|
|
222
|
+
for (const line of raw.split("\n")) {
|
|
223
|
+
if (!line.trim())
|
|
224
|
+
continue;
|
|
225
|
+
const parts = line.split(":");
|
|
226
|
+
if (parts.length < 3 || !/^\d+$/.test(parts[1] ?? ""))
|
|
227
|
+
continue;
|
|
228
|
+
const file = parts[0] ?? "";
|
|
229
|
+
const lineNum = parseInt(parts[1] ?? "0", 10);
|
|
230
|
+
const content = parts.slice(2).join(":");
|
|
231
|
+
const cleaned = content.trim().length > maxLineLen
|
|
232
|
+
? content.trim().slice(0, maxLineLen - 3) + "..."
|
|
233
|
+
: content.trim();
|
|
234
|
+
total++;
|
|
235
|
+
if (!byFile.has(file))
|
|
236
|
+
byFile.set(file, []);
|
|
237
|
+
byFile.get(file).push([lineNum, cleaned]);
|
|
238
|
+
}
|
|
239
|
+
if (total === 0)
|
|
240
|
+
return `0 matches for '${pattern}'`;
|
|
241
|
+
let out = `${total} matches in ${byFile.size} files:\n\n`;
|
|
242
|
+
let shown = 0;
|
|
243
|
+
for (const [file, matches] of [...byFile.entries()].sort((a, b) => a[0].localeCompare(b[0]))) {
|
|
244
|
+
if (shown >= maxResults)
|
|
245
|
+
break;
|
|
246
|
+
out += `${file} (${matches.length}):\n`;
|
|
247
|
+
for (const [ln, content] of matches.slice(0, 10)) {
|
|
248
|
+
out += ` ${String(ln).padStart(4)}: ${content}\n`;
|
|
249
|
+
shown++;
|
|
250
|
+
if (shown >= maxResults)
|
|
251
|
+
break;
|
|
252
|
+
}
|
|
253
|
+
if (matches.length > 10)
|
|
254
|
+
out += ` +${matches.length - 10}\n`;
|
|
255
|
+
out += "\n";
|
|
256
|
+
}
|
|
257
|
+
if (total > shown)
|
|
258
|
+
out += `... +${total - shown} more\n`;
|
|
259
|
+
return out;
|
|
260
|
+
}
|
|
261
|
+
// ---------------------------------------------------------------------------
|
|
262
|
+
// Diff compressor
|
|
263
|
+
// ---------------------------------------------------------------------------
|
|
264
|
+
function condenseDiff(diff) {
|
|
265
|
+
const result = [];
|
|
266
|
+
let currentFile = "";
|
|
267
|
+
let added = 0, removed = 0;
|
|
268
|
+
const changes = [];
|
|
269
|
+
const flush = () => {
|
|
270
|
+
if (currentFile && (added > 0 || removed > 0)) {
|
|
271
|
+
result.push(`${currentFile} (+${added} -${removed})`);
|
|
272
|
+
for (const c of changes.slice(0, 10))
|
|
273
|
+
result.push(` ${c}`);
|
|
274
|
+
if (changes.length > 10)
|
|
275
|
+
result.push(` ... +${changes.length - 10} more`);
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
for (const line of diff.split("\n")) {
|
|
279
|
+
if (line.startsWith("+++ ")) {
|
|
280
|
+
flush();
|
|
281
|
+
currentFile = line.replace(/^\+\+\+ b?\//, "");
|
|
282
|
+
added = 0;
|
|
283
|
+
removed = 0;
|
|
284
|
+
changes.length = 0;
|
|
285
|
+
}
|
|
286
|
+
else if (line.startsWith("+") && !line.startsWith("+++")) {
|
|
287
|
+
added++;
|
|
288
|
+
if (changes.length < 15)
|
|
289
|
+
changes.push(line.length > 70 ? line.slice(0, 67) + "..." : line);
|
|
290
|
+
}
|
|
291
|
+
else if (line.startsWith("-") && !line.startsWith("---")) {
|
|
292
|
+
removed++;
|
|
293
|
+
if (changes.length < 15)
|
|
294
|
+
changes.push(line.length > 70 ? line.slice(0, 67) + "..." : line);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
flush();
|
|
298
|
+
return result.join("\n");
|
|
299
|
+
}
|
|
300
|
+
function languageFromExtension(ext) {
|
|
301
|
+
const map = {
|
|
302
|
+
rs: "rust", py: "python", pyw: "python",
|
|
303
|
+
js: "javascript", mjs: "javascript", cjs: "javascript",
|
|
304
|
+
ts: "typescript", tsx: "typescript",
|
|
305
|
+
go: "go", c: "c", h: "c", cpp: "cpp", cc: "cpp", cxx: "cpp", hpp: "cpp",
|
|
306
|
+
java: "java", rb: "ruby", sh: "shell", bash: "shell", zsh: "shell",
|
|
307
|
+
};
|
|
308
|
+
return map[ext.toLowerCase()] ?? "unknown";
|
|
309
|
+
}
|
|
310
|
+
function commentPatterns(lang) {
|
|
311
|
+
if (lang === "python")
|
|
312
|
+
return { line: "#", blockStart: '"""', blockEnd: '"""', docBlockStart: '"""' };
|
|
313
|
+
if (lang === "ruby")
|
|
314
|
+
return { line: "#", blockStart: "=begin", blockEnd: "=end" };
|
|
315
|
+
if (lang === "shell")
|
|
316
|
+
return { line: "#" };
|
|
317
|
+
return { line: "//", blockStart: "/*", blockEnd: "*/", docBlockStart: "/**" };
|
|
318
|
+
}
|
|
319
|
+
function minimalFilter(content, lang) {
|
|
320
|
+
const patterns = commentPatterns(lang);
|
|
321
|
+
const lines = content.split("\n");
|
|
322
|
+
const result = [];
|
|
323
|
+
let inBlock = false, inDocstring = false;
|
|
324
|
+
for (const line of lines) {
|
|
325
|
+
const t = line.trim();
|
|
326
|
+
if (patterns.blockStart && patterns.blockEnd) {
|
|
327
|
+
if (!inDocstring && t.includes(patterns.blockStart) &&
|
|
328
|
+
!(patterns.docBlockStart && t.startsWith(patterns.docBlockStart))) {
|
|
329
|
+
inBlock = true;
|
|
330
|
+
}
|
|
331
|
+
if (inBlock) {
|
|
332
|
+
if (t.includes(patterns.blockEnd))
|
|
333
|
+
inBlock = false;
|
|
334
|
+
continue;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
if (lang === "python" && t.startsWith('"""')) {
|
|
338
|
+
inDocstring = !inDocstring;
|
|
339
|
+
result.push(line);
|
|
340
|
+
continue;
|
|
341
|
+
}
|
|
342
|
+
if (inDocstring) {
|
|
343
|
+
result.push(line);
|
|
344
|
+
continue;
|
|
345
|
+
}
|
|
346
|
+
if (patterns.line && t.startsWith(patterns.line)) {
|
|
347
|
+
if (patterns.docLine && t.startsWith(patterns.docLine))
|
|
348
|
+
result.push(line);
|
|
349
|
+
continue;
|
|
350
|
+
}
|
|
351
|
+
result.push(line);
|
|
352
|
+
}
|
|
353
|
+
return result.join("\n").replace(/\n{3,}/g, "\n\n").trim();
|
|
354
|
+
}
|
|
355
|
+
function compressReadOutput(content, ext) {
|
|
356
|
+
const lang = languageFromExtension(ext);
|
|
357
|
+
return minimalFilter(content, lang);
|
|
358
|
+
}
|
|
359
|
+
// ---------------------------------------------------------------------------
|
|
360
|
+
// Generic cap for unknown commands
|
|
361
|
+
// ---------------------------------------------------------------------------
|
|
362
|
+
function capLines(raw, maxLines = 200) {
|
|
363
|
+
const lines = raw.split("\n");
|
|
364
|
+
if (lines.length <= maxLines)
|
|
365
|
+
return raw;
|
|
366
|
+
return lines.slice(0, maxLines).join("\n") + `\n... +${lines.length - maxLines} more lines`;
|
|
367
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"costStats.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/costStats.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,OAAO,KAAK,EACV,gBAAgB,EAKjB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"costStats.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/costStats.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,OAAO,KAAK,EACV,gBAAgB,EAKjB,MAAM,kBAAkB,CAAC;AAmQ1B,wBAAsB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAuChF"}
|
|
@@ -46,7 +46,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
46
46
|
exports.handleCostStats = handleCostStats;
|
|
47
47
|
const node_fs_1 = require("node:fs");
|
|
48
48
|
const path = __importStar(require("node:path"));
|
|
49
|
-
const
|
|
49
|
+
const config_1 = require("../../config");
|
|
50
50
|
const storage_1 = require("../../storage");
|
|
51
51
|
const journal_1 = require("../../cost/journal");
|
|
52
52
|
// ============================================================================
|
|
@@ -74,8 +74,8 @@ function col(text, color, useColors) {
|
|
|
74
74
|
// ============================================================================
|
|
75
75
|
// Single Run
|
|
76
76
|
// ============================================================================
|
|
77
|
-
async function costStatsForRun(
|
|
78
|
-
const runDir =
|
|
77
|
+
async function costStatsForRun(runId, runsDirOverride) {
|
|
78
|
+
const runDir = (0, config_1.resolveExistingRunDir)(runId, { override: runsDirOverride });
|
|
79
79
|
let stat;
|
|
80
80
|
try {
|
|
81
81
|
stat = await node_fs_1.promises.stat(runDir);
|
|
@@ -91,30 +91,39 @@ async function costStatsForRun(runsDir, runId) {
|
|
|
91
91
|
// ============================================================================
|
|
92
92
|
// All Runs
|
|
93
93
|
// ============================================================================
|
|
94
|
-
async function costStatsForAllRuns(
|
|
95
|
-
let entries;
|
|
96
|
-
try {
|
|
97
|
-
entries = await node_fs_1.promises.readdir(runsDir);
|
|
98
|
-
}
|
|
99
|
-
catch {
|
|
100
|
-
entries = [];
|
|
101
|
-
}
|
|
94
|
+
async function costStatsForAllRuns(readableRunsDirs) {
|
|
102
95
|
const runs = [];
|
|
103
|
-
|
|
104
|
-
|
|
96
|
+
const seenRunDirs = new Set();
|
|
97
|
+
for (const runsDir of readableRunsDirs) {
|
|
98
|
+
let entries;
|
|
105
99
|
try {
|
|
106
|
-
|
|
107
|
-
if (!s.isDirectory())
|
|
108
|
-
continue;
|
|
100
|
+
entries = await node_fs_1.promises.readdir(runsDir);
|
|
109
101
|
}
|
|
110
102
|
catch {
|
|
111
|
-
|
|
103
|
+
entries = [];
|
|
104
|
+
}
|
|
105
|
+
for (const entry of entries) {
|
|
106
|
+
const runDir = path.join(runsDir, entry);
|
|
107
|
+
let normalizedRunDir;
|
|
108
|
+
try {
|
|
109
|
+
const s = await node_fs_1.promises.stat(runDir);
|
|
110
|
+
if (!s.isDirectory())
|
|
111
|
+
continue;
|
|
112
|
+
normalizedRunDir = path.resolve(runDir);
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
if (seenRunDirs.has(normalizedRunDir)) {
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
seenRunDirs.add(normalizedRunDir);
|
|
121
|
+
const events = await (0, storage_1.loadJournal)(runDir);
|
|
122
|
+
const stats = (0, journal_1.computeRunCostStats)(entry, events);
|
|
123
|
+
if (stats.eventCount === 0)
|
|
124
|
+
continue;
|
|
125
|
+
runs.push(stats);
|
|
112
126
|
}
|
|
113
|
-
const events = await (0, storage_1.loadJournal)(runDir);
|
|
114
|
-
const stats = (0, journal_1.computeRunCostStats)(entry, events);
|
|
115
|
-
if (stats.eventCount === 0)
|
|
116
|
-
continue;
|
|
117
|
-
runs.push(stats);
|
|
118
127
|
}
|
|
119
128
|
let totalInputTokens = 0;
|
|
120
129
|
let totalOutputTokens = 0;
|
|
@@ -277,11 +286,10 @@ function printAggregateTable(agg, useColors) {
|
|
|
277
286
|
// Main Handler
|
|
278
287
|
// ============================================================================
|
|
279
288
|
async function handleCostStats(options) {
|
|
280
|
-
const
|
|
281
|
-
const resolvedRunsDir = path.resolve(runsDir);
|
|
289
|
+
const readableRunsDirs = (0, config_1.getReadableRunsDirs)({ override: options.runsDir });
|
|
282
290
|
const useColors = supportsColors();
|
|
283
291
|
if (options.all) {
|
|
284
|
-
const agg = await costStatsForAllRuns(
|
|
292
|
+
const agg = await costStatsForAllRuns(readableRunsDirs);
|
|
285
293
|
if (options.json) {
|
|
286
294
|
console.log(JSON.stringify(agg, null, 2));
|
|
287
295
|
}
|
|
@@ -291,9 +299,9 @@ async function handleCostStats(options) {
|
|
|
291
299
|
return 0;
|
|
292
300
|
}
|
|
293
301
|
if (options.runId) {
|
|
294
|
-
const stats = await costStatsForRun(
|
|
302
|
+
const stats = await costStatsForRun(options.runId, options.runsDir);
|
|
295
303
|
if (!stats) {
|
|
296
|
-
const msg = `Run not found: ${options.runId} (looked in ${
|
|
304
|
+
const msg = `Run not found: ${options.runId} (looked in ${readableRunsDirs.join(", ")})`;
|
|
297
305
|
if (options.json) {
|
|
298
306
|
console.error(JSON.stringify({ error: msg }));
|
|
299
307
|
}
|
|
@@ -2,7 +2,16 @@ import type { HarnessInstallOptions } from "../../../harness";
|
|
|
2
2
|
export interface HarnessInstallCommandArgs extends HarnessInstallOptions {
|
|
3
3
|
harnessName?: string;
|
|
4
4
|
}
|
|
5
|
+
/**
|
|
6
|
+
* Install a harness CLI via agent-mux.
|
|
7
|
+
*/
|
|
5
8
|
export declare function handleHarnessInstall(args: HarnessInstallCommandArgs): Promise<number>;
|
|
9
|
+
/**
|
|
10
|
+
* Install a babysitter plugin for a harness.
|
|
11
|
+
*
|
|
12
|
+
* Plugin installation remains harness-specific since it involves babysitter's
|
|
13
|
+
* own plugin packaging. This uses the published per-harness plugin installer.
|
|
14
|
+
*/
|
|
6
15
|
export declare function handleHarnessInstallPlugin(args: HarnessInstallCommandArgs): Promise<number>;
|
|
7
16
|
export declare function formatHarnessInstallError(error: unknown, json: boolean): number;
|
|
8
17
|
//# sourceMappingURL=install.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/harness/install.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/harness/install.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EAEtB,MAAM,kBAAkB,CAAC;AAS1B,MAAM,WAAW,yBAA0B,SAAQ,qBAAqB;IACtE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAsDD;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC,MAAM,CAAC,CAK3F;AAED;;;;;GAKG;AACH,wBAAsB,0BAA0B,CAAC,IAAI,EAAE,yBAAyB,GAAG,OAAO,CAAC,MAAM,CAAC,CAKjG;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,CAW/E"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.handleHarnessInstall = handleHarnessInstall;
|
|
4
4
|
exports.handleHarnessInstallPlugin = handleHarnessInstallPlugin;
|
|
5
5
|
exports.formatHarnessInstallError = formatHarnessInstallError;
|
|
6
|
-
const
|
|
6
|
+
const install_1 = require("../../../harness/install");
|
|
7
7
|
const exceptions_1 = require("../../../runtime/exceptions");
|
|
8
8
|
function supportsColors() {
|
|
9
9
|
if (process.env.NO_COLOR !== undefined)
|
|
@@ -17,12 +17,18 @@ function formatInstallResult(payload, json) {
|
|
|
17
17
|
console.log(JSON.stringify(payload, null, 2));
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
|
+
if (payload.status) {
|
|
21
|
+
console.log(`Status: ${payload.status}`);
|
|
22
|
+
}
|
|
20
23
|
if (payload.warning) {
|
|
21
24
|
console.log(`Warning: ${payload.warning}`);
|
|
22
25
|
}
|
|
23
26
|
if (payload.summary) {
|
|
24
27
|
console.log(payload.summary);
|
|
25
28
|
}
|
|
29
|
+
if (payload.error) {
|
|
30
|
+
console.log(`Error: ${payload.error}`);
|
|
31
|
+
}
|
|
26
32
|
if (payload.command) {
|
|
27
33
|
console.log(`Command: ${payload.command}`);
|
|
28
34
|
}
|
|
@@ -42,43 +48,26 @@ function requireHarnessName(harnessName, commandName) {
|
|
|
42
48
|
}
|
|
43
49
|
return harnessName;
|
|
44
50
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
throw new exceptions_1.BabysitterRuntimeError("UnsupportedHarnessInstall", `${commandName} does not support "${harnessName}" yet.`, {
|
|
49
|
-
category: exceptions_1.ErrorCategory.Validation,
|
|
50
|
-
suggestions: [
|
|
51
|
-
"Supported harnesses: claude-code, codex, gemini-cli, pi, oh-my-pi",
|
|
52
|
-
],
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
const run = adapter[kind];
|
|
56
|
-
if (!run) {
|
|
57
|
-
throw new exceptions_1.BabysitterRuntimeError("UnsupportedHarnessInstall", `${commandName} does not support "${harnessName}" yet.`, {
|
|
58
|
-
category: exceptions_1.ErrorCategory.Validation,
|
|
59
|
-
suggestions: [
|
|
60
|
-
"Supported harnesses: claude-code, codex, gemini-cli, pi, oh-my-pi",
|
|
61
|
-
],
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
return {
|
|
65
|
-
adapter,
|
|
66
|
-
run: run.bind(adapter),
|
|
67
|
-
};
|
|
68
|
-
}
|
|
51
|
+
/**
|
|
52
|
+
* Install a harness CLI via agent-mux.
|
|
53
|
+
*/
|
|
69
54
|
async function handleHarnessInstall(args) {
|
|
70
55
|
const harnessName = requireHarnessName(args.harnessName, "harness:install");
|
|
71
|
-
const
|
|
72
|
-
const result = await run(args);
|
|
56
|
+
const result = await (0, install_1.installHarnessViaAmux)(harnessName, args);
|
|
73
57
|
formatInstallResult(result, args.json);
|
|
74
|
-
return 0;
|
|
58
|
+
return result.success === false ? 1 : 0;
|
|
75
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Install a babysitter plugin for a harness.
|
|
62
|
+
*
|
|
63
|
+
* Plugin installation remains harness-specific since it involves babysitter's
|
|
64
|
+
* own plugin packaging. This uses the published per-harness plugin installer.
|
|
65
|
+
*/
|
|
76
66
|
async function handleHarnessInstallPlugin(args) {
|
|
77
67
|
const harnessName = requireHarnessName(args.harnessName, "harness:install-plugin");
|
|
78
|
-
const
|
|
79
|
-
const result = await run(args);
|
|
68
|
+
const result = await (0, install_1.installHarnessPlugin)(harnessName, args);
|
|
80
69
|
formatInstallResult(result, args.json);
|
|
81
|
-
return 0;
|
|
70
|
+
return result.success === false ? 1 : 0;
|
|
82
71
|
}
|
|
83
72
|
function formatHarnessInstallError(error, json) {
|
|
84
73
|
const err = error instanceof Error
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Individual health check implementations.
|
|
3
|
+
* Extracted from health.ts for max-lines compliance.
|
|
4
|
+
*/
|
|
5
|
+
import type { HealthCheck } from "../health";
|
|
6
|
+
export declare function checkSdkVersion(): Promise<HealthCheck>;
|
|
7
|
+
export declare function checkNodeVersion(): HealthCheck;
|
|
8
|
+
export declare function checkA5cDirectory(cwd: string): Promise<HealthCheck>;
|
|
9
|
+
export declare function checkPackageDependency(cwd: string): Promise<HealthCheck>;
|
|
10
|
+
//# sourceMappingURL=checks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/health/checks.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAsC7C,wBAAsB,eAAe,IAAI,OAAO,CAAC,WAAW,CAAC,CAuB5D;AAED,wBAAgB,gBAAgB,IAAI,WAAW,CAsC9C;AAED,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CA8EzE;AAED,wBAAsB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CA4D9E"}
|